@ganpatiinfo/gids-core-web 16.0.0 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gids-profile-menu.js +1 -1
- package/dist/gids-profile.js +1 -1
- package/dist/p-BAs2-lhK.js +1 -0
- package/dist/types/components/webComponents/GidsProfile/GidsProfile.d.ts +4 -0
- package/dist/types/components/webComponents/GidsProfileMenu/GidsProfileMenu.d.ts +4 -0
- package/dist/types/components.d.ts +3 -0
- package/dist-bundled/es/gids-profile-menu.js +4 -4
- package/dist-bundled/es/gids-profile.js +37 -31
- package/dist-bundled/es/p-BAs2-lhK-31X-j6-3.js +82 -0
- package/dist-bundled/umd/gids-profile-menu.umd.js +2 -2
- package/dist-bundled/umd/gids-profile.umd.js +2 -2
- package/dist-bundled/umd-complete/gids-core-web.umd.js +4 -4
- package/package.json +4 -4
- package/dist/p-CcpdJCql.js +0 -1
- package/dist-bundled/es/p-CcpdJCql-CkEW2RAp.js +0 -64
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as
|
|
1
|
+
import{G as s,d as o}from"./p-BAs2-lhK.js";const p=s,r=o;export{p as GidsProfileMenu,r as defineCustomElement}
|
package/dist/gids-profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e,p as o,H as r,h as i,d as a}from"./p-Bf3p-DY2.js";import{GidsProfileWebUtils as t}from"@ganpatiinfo/gids-web-shared";import{GidsProfileMenuHeaderCommonUtils as l}from"@ganpatiinfo/gids-core-shared";import{d as n,G as s}from"./p-oJFgjzK5.js";import{G as d}from"./p-CXFvqDBs.js";import{G as p}from"./p-D4Pimu_8.js";import{d as g}from"./p-CcpdJCql.js";const{getGidsProfileClassNames:c,getGidsProfileTextClassNames:f}=t,{getProfileHeaderMenuAvatarText:h}=l,u=o(class extends r{constructor(e){super(),!1!==e&&this.__registerHost(),this.expanded=!1,this.profileControlAppearance="default",this.profileControlAvatarVisible=!0,this.profileControlAvatarBadgeVisible=!0,this.profileControlBorderRadius="none",this.profileControlShadow="none",this.profileControlLeadingIconSize="sm",this.profileControlTrailingIconSize="sm",this.profileControlLeadingIconAppearance="filled",this.profileControlTrailingIconAppearance="filled",this.profileMenuItems=[],this.headerDividerVisible=!1,this.headerVisible=!1,this.listSectionDividerVisible=!1,this.isMenuExpanded=!1,this.onProfileControlPress=e=>{if(this.hasMenu()){const o=!this.isMenuExpanded;this.isMenuExpanded=o,this.onPressProfileControl&&this.onPressProfileControl({originalEvent:e,id:this.id,menuId:this?.menuId,expanded:o,profileControlTitle:this?.profileControlTitle,profileControlSupportingText:this?.profileControlSupportingText})}},this.onPressProfileMenuItem=e=>{this.isMenuExpanded=!1,this.onPressProfileMenuItem&&this.onPressProfileMenuItem({...e})},this.positionProfileMenu=()=>{const e=this.hostElement?.querySelector(".gids-profile__dropdown-menu-container");if(!e)return;const o=this.hostElement.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight;e.style.maxHeight="none";const a=e.getBoundingClientRect(),t=i-o.bottom-8,l=o.top-4,n=a.height>t&&l>t,s=n?l:t;e.style.maxHeight=a.height>s?s+"px":"none";const d=e.getBoundingClientRect();let p=o.left;p+d.width>r-4&&(p=r-d.width-4),p<4&&(p=4),e.style.left=p-o.left+"px",e.style.top=n?-d.height-4+"px":o.height+4+"px"},this.getProfileControlAvatarText=()=>{const e=this?.profileControlAvatarProps,o=this?.profileControlTitle;return e?.text??h({headerTitle:o})},this.hasHeaderItem=()=>{const e=this?.headerItem,o=this?.headerVisible;return!(!o||!(e?.avatarVisible||e?.avatarProps&&Object.keys(e).length>0||e?.headerSupportingText||e?.headerTitle))},this.hasMenu=()=>!!(this?.profileMenuItems&&this.profileMenuItems.length>0||this.hasHeaderItem()),this.handleDocumentClick=e=>{this.isMenuExpanded&&(e.composedPath().includes(this.hostElement)||(this.isMenuExpanded=!1))}}idChanged(e){this.id=e}profileControlAppearanceChanged(e){this.profileControlAppearance=e}profileControlAvatarPropsChanged(e){this.profileControlAvatarProps=e}expansionChanged(e){this.expanded=e,this.isMenuExpanded=e}profileControlAvatarVisibleChanged(e){this.profileControlAvatarVisible=e}profileControlAvatarBadgeVisibleChanged(e){this.profileControlAvatarBadgeVisible=e}profileControlBorderRadiusChanged(e){this.profileControlBorderRadius=e}profileControlShadowChanged(e){this.profileControlShadow=e}listSectionDividerVisibleChanged(e){this.listSectionDividerVisible=e}profileControlLeadingIconChanged(e){this.profileControlLeadingIcon=e}profileControlTrailingIconChanged(e){this.profileControlTrailingIcon=e}profileControlTitleChanged(e){this.profileControlTitle=e}profileControlSupportingTextChanged(e){this.profileControlSupportingText=e}headerDividerVisibleChanged(e){this.headerDividerVisible=e}headerItemChanged(e){this.headerItem=e}headerVisibleChanged(e){this.headerVisible=e}profileMenuItemsChanged(e){this.profileMenuItems=e}connectedCallback(){this.isMenuExpanded=this?.expanded??!1}componentDidLoad(){document.addEventListener("click",this.handleDocumentClick)}componentDidRender(){this.isMenuExpanded&&this.hasMenu()&&requestAnimationFrame((()=>{this.positionProfileMenu()}))}disconnectedCallback(){document.removeEventListener("click",this.handleDocumentClick)}render(){const e=this?.profileControlAppearance??"default",o=this?.profileControlAvatarProps,r=o?.badgeProps,t=this?.profileControlAvatarVisible??!1,l=this?.profileControlAvatarBadgeVisible??!1,n=this?.profileControlBorderRadius??"none",g=this?.profileControlShadow??"none",h=this?.profileControlLeadingIcon,u=this?.profileControlTrailingIcon,v=this?.profileControlTitle??"",b=this?.profileControlSupportingText??"",C=this?.profileMenuItems??[],m=this?.headerDividerVisible??!1,x=this?.headerVisible??!1,_=this?.headerItem,k=this?.listSectionDividerVisible??!1,y=this?.menuId,w=this?.isMenuExpanded??!1,I=this.hasMenu(),V=this?.profileControlLeadingIconSize??"sm",A=this?.profileControlTrailingIconSize??"sm",T=this?.profileControlLeadingIconAppearance??"filled",S=this?.profileControlTrailingIconAppearance??"filled",P=c({profileControlAppearance:e,profileControlBorderRadius:n,profileControlShadow:g,expanded:w&&I}),D=o?.size??"sm",{titleClasses:B,supportingTextClasses:z}=f({profileControlAppearance:e});let M=o?.color??"brand";return"brand"===e&&(M=o?.color??"default"),i(a,{key:"e3b93542314bfff5a8f7c901b83fb66aa6339df5",class:P,onClick:this.onProfileControlPress,"menu-expanded":w},h?i(p,{name:h,size:V,appearance:T}):void 0,i("div",{key:"4d9c9cb57ead65b8f9df399f1aca1588d34d9746",class:"gids-profile__main-container"},t?i(s,{appearance:o?.appearance??"text",color:M,size:D,text:this.getProfileControlAvatarText(),imageSrc:o?.imageSrc??"",alt:o?.alt??"alt-img",badge:l?i(d,{appearance:r?.appearance??"information",type:r?.type,count:r?.count,outline:r?.outline}):void 0}):void 0,i("div",{key:"0f77df6a414da0a0c4322aff50790354ff43d0a0",class:"gids-profile__content-container"},i("span",{key:"a5b101bb070f00b90615e5589f31db479d0c9dc2",class:B},v),i("p",{key:"d55873ea2defcd4d456a513daecc8e3e907984fe",class:z},b))),u?i(p,{name:u,size:A,appearance:S}):void 0,I&&w?i("div",{class:"gids-profile__dropdown-menu-container",id:y,role:"profilePickerbox",onClick:e=>e.stopPropagation()},i("gids-profile-menu",{headerItem:_,headerDividerVisible:m,headerVisible:x,listSectionDividerVisible:k,profileMenuItems:C,onHeaderAvatarPress:this.onHeaderAvatarPress,onHeaderTitlePress:this.onHeaderTitlePress,onHeaderSupportingTextPress:this.onHeaderSupportingTextPress,onProfileMenuItemPress:this.onPressProfileMenuItem})):void 0)}get hostElement(){return this}static get watchers(){return{id:[{idChanged:0}],profileControlAppearance:[{profileControlAppearanceChanged:0}],profileControlAvatarProps:[{profileControlAvatarPropsChanged:0}],expanded:[{expansionChanged:0}],profileControlAvatarVisible:[{profileControlAvatarVisibleChanged:0}],profileControlAvatarBadgeVisible:[{profileControlAvatarBadgeVisibleChanged:0}],profileControlBorderRadius:[{profileControlBorderRadiusChanged:0}],profileControlShadow:[{profileControlShadowChanged:0}],listSectionDividerVisible:[{listSectionDividerVisibleChanged:0}],profileControlLeadingIcon:[{profileControlLeadingIconChanged:0}],profileControlTrailingIcon:[{profileControlTrailingIconChanged:0}],profileControlTitle:[{profileControlTitleChanged:0}],profileControlSupportingText:[{profileControlSupportingTextChanged:0}],headerDividerVisible:[{headerDividerVisibleChanged:0}],headerItem:[{headerItemChanged:0}],headerVisible:[{headerVisibleChanged:0}],profileMenuItems:[{profileMenuItemsChanged:0}]}}static get style(){return".gids-profile{position:relative;display:flex;align-items:center;justify-content:space-between;gap:var(--gids-gap-150);cursor:pointer;background-color:var(--gids-color-background-neutral-default);padding:var(--gids-padding-vertical-edge-to-element-150) var(--gids-padding-horizontal-edge-to-element-200);--gidsIcon-color:var(--gids-color-icon-subtle);border-radius:var(--gids-border-radius-none)}.gids-profile:hover{background-color:var(--gids-color-background-neutral-hovered)}.gids-profile:active{background-color:var(--gids-color-background-neutral-pressed)}.gids-profile__main-container{display:flex;align-items:center;flex:1;gap:var(--gids-gap-100)}.gids-profile__content-container{display:flex;flex-direction:column;align-items:flex-start;justify-content:center}.gids-profile__title-typography{font-family:var(--gids-typography-label-small__font-family);font-size:var(--gids-typography-label-small__font-size);font-weight:var(--gids-typography-label-small__font-weight);letter-spacing:var(--gids-typography-label-small__letter-spacing);line-height:var(--gids-typography-label-small__line-height);text-transform:var(--gids-typography-label-small__text-transform, inherit);font-variant-caps:var(--gids-typography-label-small__font-variant-caps, inherit)}.gids-profile__supporting-text-typography{margin:0;padding:0;font-family:var(--gids-typography-paragraph-x-small__font-family);font-size:var(--gids-typography-paragraph-x-small__font-size);font-weight:var(--gids-typography-paragraph-x-small__font-weight);letter-spacing:var(--gids-typography-paragraph-x-small__letter-spacing);line-height:var(--gids-typography-paragraph-x-small__line-height);text-transform:var(--gids-typography-paragraph-x-small__text-transform, inherit);font-variant-caps:var(--gids-typography-paragraph-x-small__font-variant-caps, inherit)}.gids-profile__title-default{color:var(--gids-color-text-default)}.gids-profile__supporting-text-default{color:var(--gids-color-text-subtlest)}.gids-profile__title-brand{color:var(--gids-color-text-default)}.gids-profile__supporting-text-brand{color:var(--gids-color-text-subtlest)}.gids-profile__title-subtle{color:var(--gids-color-text-default)}.gids-profile__supporting-text-subtle{color:var(--gids-color-text-subtlest)}.gids-profile__title-positive{color:var(--gids-color-text-default)}.gids-profile__supporting-text-positive{color:var(--gids-color-text-subtlest)}.gids-profile__title-information{color:var(--gids-color-text-default)}.gids-profile__supporting-text-information{color:var(--gids-color-text-subtlest)}.gids-profile__title-warning{color:var(--gids-color-text-default)}.gids-profile__supporting-text-warning{color:var(--gids-color-text-subtlest)}.gids-profile__title-danger{color:var(--gids-color-text-default)}.gids-profile__supporting-text-danger{color:var(--gids-color-text-subtlest)}.gids-profile--appearance-brand{background-color:var(--gids-color-background-brand-subtlest-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-brand:hover{background-color:var(--gids-color-background-brand-subtlest-hovered)}.gids-profile--appearance-brand:active{background-color:var(--gids-color-background-brand-subtlest-pressed)}.gids-profile--appearance-danger{background-color:var(--gids-color-background-danger-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-danger:hover{background-color:var(--gids-color-background-danger-hovered)}.gids-profile--appearance-danger:active{background-color:var(--gids-color-background-danger-pressed)}.gids-profile--appearance-information{background-color:var(--gids-color-background-information-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-information:hover{background-color:var(--gids-color-background-information-hovered)}.gids-profile--appearance-information:active{background-color:var(--gids-color-background-information-pressed)}.gids-profile--appearance-positive{background-color:var(--gids-color-background-positive-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-positive:hover{background-color:var(--gids-color-background-positive-hovered)}.gids-profile--appearance-positive:active{background-color:var(--gids-color-background-positive-pressed)}.gids-profile--appearance-subtle{background-color:var(--gids-color-background-neutral-subtle-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-subtle:hover{background-color:var(--gids-color-background-neutral-subtle-hovered)}.gids-profile--appearance-subtle:active{background-color:var(--gids-color-background-neutral-subtle-pressed)}.gids-profile--appearance-warning{background-color:var(--gids-color-background-warning-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-warning:hover{background-color:var(--gids-color-background-warning-hovered)}.gids-profile--appearance-warning:active{background-color:var(--gids-color-background-warning-pressed)}.gids-profile--border-radius-sm{border-radius:var(--gids-border-radius-sm)}.gids-profile--border-radius-md{border-radius:var(--gids-border-radius-md)}.gids-profile--border-radius-lg{border-radius:var(--gids-border-radius-lg)}.gids-profile--border-radius-full{border-radius:var(--gids-border-radius-full)}.gids-profile--shadow-overflow{box-shadow:var(--gids-elevation-shadow-overflow)}.gids-profile--shadow-overlay{box-shadow:var(--gids-elevation-shadow-overlay)}.gids-profile--shadow-raised{box-shadow:var(--gids-elevation-shadow-raised)}.gids-profile__dropdown-menu-container{position:absolute;left:0;top:calc(100% + var(--gids-gap-050));z-index:3;display:none;flex-direction:column;align-self:stretch;min-width:var(--gids-width-2-xs);min-height:55px;overflow-x:hidden;overflow-y:auto;background-color:var(--gids-elevation-surface-overlay-default);box-shadow:var(--gids-elevation-shadow-overlay);border-radius:var(--gids-border-radius-lg)}.gids-profile__dropdown-menu-container>*{flex-shrink:0}.gids-profile--expanded .gids-profile__dropdown-menu-container{display:flex}.gids-profile--expanded .gids-profile__chevron{transform:rotate(180deg)}"}},[0,"gids-profile",{id:[1],menuId:[1,"menu-id"],expanded:[4],profileControlAppearance:[1,"profile-control-appearance"],profileControlAvatarProps:[16],profileControlAvatarVisible:[4,"profile-control-avatar-visible"],profileControlAvatarBadgeVisible:[4,"profile-control-avatar-badge-visible"],profileControlBorderRadius:[1,"profile-control-border-radius"],profileControlShadow:[1,"profile-control-shadow"],profileControlLeadingIcon:[1,"profile-control-leading-icon"],profileControlTrailingIcon:[1,"profile-control-trailing-icon"],profileControlLeadingIconSize:[1,"profile-control-leading-icon-size"],profileControlTrailingIconSize:[1,"profile-control-trailing-icon-size"],profileControlLeadingIconAppearance:[1,"profile-control-leading-icon-appearance"],profileControlTrailingIconAppearance:[1,"profile-control-trailing-icon-appearance"],profileControlTitle:[1,"profile-control-title"],profileControlSupportingText:[1,"profile-control-supporting-text"],profileMenuItems:[16],headerDividerVisible:[4,"header-divider-visible"],headerVisible:[4,"header-visible"],headerItem:[16],listSectionDividerVisible:[4,"list-section-divider-visible"],onHeaderAvatarPress:[16],onHeaderTitlePress:[16],onHeaderSupportingTextPress:[16],onProfileMenuItemPress:[16],onPressProfileControl:[16],isMenuExpanded:[32]},void 0,{id:[{idChanged:0}],profileControlAppearance:[{profileControlAppearanceChanged:0}],profileControlAvatarProps:[{profileControlAvatarPropsChanged:0}],expanded:[{expansionChanged:0}],profileControlAvatarVisible:[{profileControlAvatarVisibleChanged:0}],profileControlAvatarBadgeVisible:[{profileControlAvatarBadgeVisibleChanged:0}],profileControlBorderRadius:[{profileControlBorderRadiusChanged:0}],profileControlShadow:[{profileControlShadowChanged:0}],listSectionDividerVisible:[{listSectionDividerVisibleChanged:0}],profileControlLeadingIcon:[{profileControlLeadingIconChanged:0}],profileControlTrailingIcon:[{profileControlTrailingIconChanged:0}],profileControlTitle:[{profileControlTitleChanged:0}],profileControlSupportingText:[{profileControlSupportingTextChanged:0}],headerDividerVisible:[{headerDividerVisibleChanged:0}],headerItem:[{headerItemChanged:0}],headerVisible:[{headerVisibleChanged:0}],profileMenuItems:[{profileMenuItemsChanged:0}]}]);function v(){"undefined"!=typeof customElements&&["gids-profile","gids-profile-menu","gids-profile-menu-header"].forEach((o=>{switch(o){case"gids-profile":customElements.get(e(o))||customElements.define(e(o),u);break;case"gids-profile-menu":customElements.get(e(o))||g();break;case"gids-profile-menu-header":customElements.get(e(o))||n()}}))}v();const b=u,C=v;export{b as GidsProfile,C as defineCustomElement}
|
|
1
|
+
import{t as e,p as o,H as i,h as r,d as a}from"./p-Bf3p-DY2.js";import{GidsProfileWebUtils as t}from"@ganpatiinfo/gids-web-shared";import{GidsProfileMenuHeaderCommonUtils as l}from"@ganpatiinfo/gids-core-shared";import{d as s,G as n}from"./p-oJFgjzK5.js";import{G as d}from"./p-CXFvqDBs.js";import{G as p}from"./p-D4Pimu_8.js";import{d as g}from"./p-BAs2-lhK.js";const{getGidsProfileClassNames:c,getGidsProfileTextClassNames:h}=t,{getProfileHeaderMenuAvatarText:f}=l,u=o(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.expanded=!1,this.profileControlAppearance="default",this.profileControlAvatarVisible=!0,this.profileControlAvatarBadgeVisible=!0,this.profileControlBorderRadius="none",this.profileControlShadow="none",this.profileControlLeadingIconSize="sm",this.profileControlTrailingIconSize="sm",this.profileControlLeadingIconAppearance="filled",this.profileControlTrailingIconAppearance="filled",this.profileMenuItems=[],this.headerDividerVisible=!1,this.headerVisible=!1,this.listSectionDividerVisible=!1,this.isMenuExpanded=!1,this.selectedProfileMenuItemId=void 0,this.onProfileControlPress=e=>{if(e&&e.stopPropagation(),this.hasMenu()){const o=!this.isMenuExpanded;this.isMenuExpanded=o,this.onPressProfileControl&&this.onPressProfileControl({originalEvent:e,id:this.id,menuId:this?.menuId,expanded:o,profileControlTitle:this?.profileControlTitle,profileControlSupportingText:this?.profileControlSupportingText})}},this.onPressProfileMenuItem=e=>{e?.originalEvent&&(e.originalEvent?.stopPropagation(),e.originalEvent?.preventDefault()),this.isMenuExpanded=!1,this.selectedProfileMenuItemId=e.id,this.onProfileMenuItemPress&&this.onProfileMenuItemPress({...e})},this.onPressHeaderAvatar=e=>{e?.originalEvent&&e.originalEvent?.stopPropagation(),this.isMenuExpanded=!1,this.onHeaderAvatarPress&&this.onHeaderAvatarPress({...e})},this.onPressHeaderTitle=e=>{e?.originalEvent&&e.originalEvent?.stopPropagation(),this.isMenuExpanded=!1,this.onHeaderAvatarPress&&this.onHeaderAvatarPress({...e})},this.onPressHeaderSupportingText=e=>{e?.originalEvent&&e.originalEvent?.stopPropagation(),this.isMenuExpanded=!1,this.onHeaderAvatarPress&&this.onHeaderAvatarPress({...e})},this.positionProfileMenu=()=>{const e=this.hostElement?.querySelector(".gids-profile__dropdown-menu-container");if(!e)return;const o=this.hostElement.getBoundingClientRect(),i=window.innerWidth,r=window.innerHeight;e.style.maxHeight="none";const a=e.getBoundingClientRect(),t=r-o.bottom-8,l=o.top-4,s=a.height>t&&l>t,n=s?l:t;e.style.maxHeight=a.height>n?n+"px":"none";const d=e.getBoundingClientRect();let p=o.left;p+d.width>i-4&&(p=i-d.width-4),p<4&&(p=4),e.style.left=p-o.left+"px",e.style.top=s?-d.height-4+"px":o.height+4+"px"},this.getProfileControlAvatarText=()=>{const e=this?.profileControlAvatarProps,o=this?.profileControlTitle;return e?.text??f({headerTitle:o})},this.hasHeaderItem=()=>{const e=this?.headerItem,o=this?.headerVisible;return!(!o||!(e?.avatarVisible||e?.avatarProps&&Object.keys(e).length>0||e?.headerSupportingText||e?.headerTitle))},this.hasMenu=()=>!!(this?.profileMenuItems&&this.profileMenuItems.length>0||this.hasHeaderItem()),this.handleDocumentClick=e=>{this.isMenuExpanded&&(e.composedPath().includes(this.hostElement)||(this.isMenuExpanded=!1))}}idChanged(e){this.id=e}profileControlAppearanceChanged(e){this.profileControlAppearance=e}profileControlAvatarPropsChanged(e){this.profileControlAvatarProps=e}expansionChanged(e){this.expanded=e,this.isMenuExpanded=e}profileControlAvatarVisibleChanged(e){this.profileControlAvatarVisible=e}profileControlAvatarBadgeVisibleChanged(e){this.profileControlAvatarBadgeVisible=e}profileControlBorderRadiusChanged(e){this.profileControlBorderRadius=e}profileControlShadowChanged(e){this.profileControlShadow=e}listSectionDividerVisibleChanged(e){this.listSectionDividerVisible=e}profileControlLeadingIconChanged(e){this.profileControlLeadingIcon=e}profileControlTrailingIconChanged(e){this.profileControlTrailingIcon=e}profileControlTitleChanged(e){this.profileControlTitle=e}profileControlSupportingTextChanged(e){this.profileControlSupportingText=e}headerDividerVisibleChanged(e){this.headerDividerVisible=e}headerItemChanged(e){this.headerItem=e}headerVisibleChanged(e){this.headerVisible=e}profileMenuItemsChanged(e){this.profileMenuItems=e}connectedCallback(){this.isMenuExpanded=this?.expanded??!1}componentDidLoad(){document.addEventListener("click",this.handleDocumentClick)}componentDidRender(){this.isMenuExpanded&&this.hasMenu()&&requestAnimationFrame((()=>{this.positionProfileMenu()}))}disconnectedCallback(){document.removeEventListener("click",this.handleDocumentClick)}render(){const e=this?.profileControlAppearance??"default",o=this?.profileControlAvatarProps,i=o?.badgeProps,t=this?.profileControlAvatarVisible??!1,l=this?.profileControlAvatarBadgeVisible??!1,s=this?.profileControlBorderRadius??"none",g=this?.profileControlShadow??"none",f=this?.profileControlLeadingIcon,u=this?.profileControlTrailingIcon,v=this?.profileControlTitle??"",b=this?.profileControlSupportingText??"",C=this?.profileMenuItems??[],m=this?.headerDividerVisible??!1,x=this?.headerVisible??!1,_=this?.headerItem,k=this?.listSectionDividerVisible??!1,y=this?.menuId,w=this?.isMenuExpanded??!1,I=this.hasMenu(),A=this.selectedProfileMenuItemId,V=this?.profileControlLeadingIconSize??"sm",T=this?.profileControlTrailingIconSize??"sm",S=this?.profileControlLeadingIconAppearance??"filled",P=this?.profileControlTrailingIconAppearance??"filled",D=c({profileControlAppearance:e,profileControlBorderRadius:s,profileControlShadow:g,expanded:w&&I}),B=o?.size??"sm",{titleClasses:z,supportingTextClasses:M}=h({profileControlAppearance:e});let j=o?.color??"brand";return"brand"===e&&(j=o?.color??"default"),r(a,{key:"45b84a12b6b66d6a0d2ce45bfa2fb3ede2f758aa",class:D,onClick:this.onProfileControlPress,"menu-expanded":w},f?r(p,{name:f,size:V,appearance:S}):void 0,r("div",{key:"2eb131b7efc5ecda1fc407e04cdee8aba4176771",class:"gids-profile__main-container"},t?r(n,{appearance:o?.appearance??"text",color:j,size:B,text:this.getProfileControlAvatarText(),imageSrc:o?.imageSrc??"",alt:o?.alt??"alt-img",badge:l?r(d,{appearance:i?.appearance??"information",type:i?.type,count:i?.count,outline:i?.outline}):void 0}):void 0,r("div",{key:"ae4cb682230b5a2e227cdb23c45c9159535638e1",class:"gids-profile__content-container"},r("span",{key:"81fa38851c46526b7e714dabbe7bdabd9735ee8e",class:z},v),r("p",{key:"47a5f275b796bdaab1e8b2d437e61698d65a2fab",class:M},b))),u?r(p,{name:u,size:T,appearance:P}):void 0,I&&w?r("div",{class:"gids-profile__dropdown-menu-container",id:y,role:"profilePickerbox",onClick:e=>e.stopPropagation()},r("gids-profile-menu",{headerItem:_,headerDividerVisible:m,headerVisible:x,listSectionDividerVisible:k,profileMenuItems:C,onHeaderAvatarPress:this.onPressHeaderAvatar,onHeaderTitlePress:this.onPressHeaderTitle,onHeaderSupportingTextPress:this.onPressHeaderSupportingText,onProfileMenuItemPress:this.onPressProfileMenuItem,selectedProfileMenuItemId:A})):void 0)}get hostElement(){return this}static get watchers(){return{id:[{idChanged:0}],profileControlAppearance:[{profileControlAppearanceChanged:0}],profileControlAvatarProps:[{profileControlAvatarPropsChanged:0}],expanded:[{expansionChanged:0}],profileControlAvatarVisible:[{profileControlAvatarVisibleChanged:0}],profileControlAvatarBadgeVisible:[{profileControlAvatarBadgeVisibleChanged:0}],profileControlBorderRadius:[{profileControlBorderRadiusChanged:0}],profileControlShadow:[{profileControlShadowChanged:0}],listSectionDividerVisible:[{listSectionDividerVisibleChanged:0}],profileControlLeadingIcon:[{profileControlLeadingIconChanged:0}],profileControlTrailingIcon:[{profileControlTrailingIconChanged:0}],profileControlTitle:[{profileControlTitleChanged:0}],profileControlSupportingText:[{profileControlSupportingTextChanged:0}],headerDividerVisible:[{headerDividerVisibleChanged:0}],headerItem:[{headerItemChanged:0}],headerVisible:[{headerVisibleChanged:0}],profileMenuItems:[{profileMenuItemsChanged:0}]}}static get style(){return".gids-profile{position:relative;display:flex;align-items:center;justify-content:space-between;gap:var(--gids-gap-150);cursor:pointer;background-color:var(--gids-color-background-neutral-default);padding:var(--gids-padding-vertical-edge-to-element-150) var(--gids-padding-horizontal-edge-to-element-200);--gidsIcon-color:var(--gids-color-icon-subtle);border-radius:var(--gids-border-radius-none)}.gids-profile:hover{background-color:var(--gids-color-background-neutral-hovered)}.gids-profile:active{background-color:var(--gids-color-background-neutral-pressed)}.gids-profile__main-container{display:flex;align-items:center;flex:1;gap:var(--gids-gap-100)}.gids-profile__content-container{display:flex;flex-direction:column;align-items:flex-start;justify-content:center}.gids-profile__title-typography{font-family:var(--gids-typography-label-small__font-family);font-size:var(--gids-typography-label-small__font-size);font-weight:var(--gids-typography-label-small__font-weight);letter-spacing:var(--gids-typography-label-small__letter-spacing);line-height:var(--gids-typography-label-small__line-height);text-transform:var(--gids-typography-label-small__text-transform, inherit);font-variant-caps:var(--gids-typography-label-small__font-variant-caps, inherit)}.gids-profile__supporting-text-typography{margin:0;padding:0;font-family:var(--gids-typography-paragraph-x-small__font-family);font-size:var(--gids-typography-paragraph-x-small__font-size);font-weight:var(--gids-typography-paragraph-x-small__font-weight);letter-spacing:var(--gids-typography-paragraph-x-small__letter-spacing);line-height:var(--gids-typography-paragraph-x-small__line-height);text-transform:var(--gids-typography-paragraph-x-small__text-transform, inherit);font-variant-caps:var(--gids-typography-paragraph-x-small__font-variant-caps, inherit)}.gids-profile__title-default{color:var(--gids-color-text-default)}.gids-profile__supporting-text-default{color:var(--gids-color-text-subtlest)}.gids-profile__title-brand{color:var(--gids-color-text-default)}.gids-profile__supporting-text-brand{color:var(--gids-color-text-subtlest)}.gids-profile__title-subtle{color:var(--gids-color-text-default)}.gids-profile__supporting-text-subtle{color:var(--gids-color-text-subtlest)}.gids-profile__title-positive{color:var(--gids-color-text-default)}.gids-profile__supporting-text-positive{color:var(--gids-color-text-subtlest)}.gids-profile__title-information{color:var(--gids-color-text-default)}.gids-profile__supporting-text-information{color:var(--gids-color-text-subtlest)}.gids-profile__title-warning{color:var(--gids-color-text-default)}.gids-profile__supporting-text-warning{color:var(--gids-color-text-subtlest)}.gids-profile__title-danger{color:var(--gids-color-text-default)}.gids-profile__supporting-text-danger{color:var(--gids-color-text-subtlest)}.gids-profile--appearance-brand{background-color:var(--gids-color-background-brand-subtlest-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-brand:hover{background-color:var(--gids-color-background-brand-subtlest-hovered)}.gids-profile--appearance-brand:active{background-color:var(--gids-color-background-brand-subtlest-pressed)}.gids-profile--appearance-danger{background-color:var(--gids-color-background-danger-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-danger:hover{background-color:var(--gids-color-background-danger-hovered)}.gids-profile--appearance-danger:active{background-color:var(--gids-color-background-danger-pressed)}.gids-profile--appearance-information{background-color:var(--gids-color-background-information-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-information:hover{background-color:var(--gids-color-background-information-hovered)}.gids-profile--appearance-information:active{background-color:var(--gids-color-background-information-pressed)}.gids-profile--appearance-positive{background-color:var(--gids-color-background-positive-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-positive:hover{background-color:var(--gids-color-background-positive-hovered)}.gids-profile--appearance-positive:active{background-color:var(--gids-color-background-positive-pressed)}.gids-profile--appearance-subtle{background-color:var(--gids-color-background-neutral-subtle-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-subtle:hover{background-color:var(--gids-color-background-neutral-subtle-hovered)}.gids-profile--appearance-subtle:active{background-color:var(--gids-color-background-neutral-subtle-pressed)}.gids-profile--appearance-warning{background-color:var(--gids-color-background-warning-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-warning:hover{background-color:var(--gids-color-background-warning-hovered)}.gids-profile--appearance-warning:active{background-color:var(--gids-color-background-warning-pressed)}.gids-profile--border-radius-sm{border-radius:var(--gids-border-radius-sm)}.gids-profile--border-radius-md{border-radius:var(--gids-border-radius-md)}.gids-profile--border-radius-lg{border-radius:var(--gids-border-radius-lg)}.gids-profile--border-radius-full{border-radius:var(--gids-border-radius-full)}.gids-profile--shadow-overflow{box-shadow:var(--gids-elevation-shadow-overflow)}.gids-profile--shadow-overlay{box-shadow:var(--gids-elevation-shadow-overlay)}.gids-profile--shadow-raised{box-shadow:var(--gids-elevation-shadow-raised)}.gids-profile__dropdown-menu-container{position:absolute;left:0;top:calc(100% + var(--gids-gap-050));z-index:3;display:none;flex-direction:column;align-self:stretch;min-width:var(--gids-width-2-xs);min-height:55px;overflow-x:hidden;overflow-y:auto;background-color:var(--gids-elevation-surface-overlay-default);box-shadow:var(--gids-elevation-shadow-overlay);border-radius:var(--gids-border-radius-lg)}.gids-profile__dropdown-menu-container>*{flex-shrink:0}.gids-profile--expanded .gids-profile__dropdown-menu-container{display:flex}.gids-profile--expanded .gids-profile__chevron{transform:rotate(180deg)}"}},[0,"gids-profile",{id:[1],menuId:[1,"menu-id"],expanded:[4],profileControlAppearance:[1,"profile-control-appearance"],profileControlAvatarProps:[16],profileControlAvatarVisible:[4,"profile-control-avatar-visible"],profileControlAvatarBadgeVisible:[4,"profile-control-avatar-badge-visible"],profileControlBorderRadius:[1,"profile-control-border-radius"],profileControlShadow:[1,"profile-control-shadow"],profileControlLeadingIcon:[1,"profile-control-leading-icon"],profileControlTrailingIcon:[1,"profile-control-trailing-icon"],profileControlLeadingIconSize:[1,"profile-control-leading-icon-size"],profileControlTrailingIconSize:[1,"profile-control-trailing-icon-size"],profileControlLeadingIconAppearance:[1,"profile-control-leading-icon-appearance"],profileControlTrailingIconAppearance:[1,"profile-control-trailing-icon-appearance"],profileControlTitle:[1,"profile-control-title"],profileControlSupportingText:[1,"profile-control-supporting-text"],profileMenuItems:[16],headerDividerVisible:[4,"header-divider-visible"],headerVisible:[4,"header-visible"],headerItem:[16],listSectionDividerVisible:[4,"list-section-divider-visible"],onHeaderAvatarPress:[16],onHeaderTitlePress:[16],onHeaderSupportingTextPress:[16],onProfileMenuItemPress:[16],onPressProfileControl:[16],isMenuExpanded:[32],selectedProfileMenuItemId:[32]},void 0,{id:[{idChanged:0}],profileControlAppearance:[{profileControlAppearanceChanged:0}],profileControlAvatarProps:[{profileControlAvatarPropsChanged:0}],expanded:[{expansionChanged:0}],profileControlAvatarVisible:[{profileControlAvatarVisibleChanged:0}],profileControlAvatarBadgeVisible:[{profileControlAvatarBadgeVisibleChanged:0}],profileControlBorderRadius:[{profileControlBorderRadiusChanged:0}],profileControlShadow:[{profileControlShadowChanged:0}],listSectionDividerVisible:[{listSectionDividerVisibleChanged:0}],profileControlLeadingIcon:[{profileControlLeadingIconChanged:0}],profileControlTrailingIcon:[{profileControlTrailingIconChanged:0}],profileControlTitle:[{profileControlTitleChanged:0}],profileControlSupportingText:[{profileControlSupportingTextChanged:0}],headerDividerVisible:[{headerDividerVisibleChanged:0}],headerItem:[{headerItemChanged:0}],headerVisible:[{headerVisibleChanged:0}],profileMenuItems:[{profileMenuItemsChanged:0}]}]);function v(){"undefined"!=typeof customElements&&["gids-profile","gids-profile-menu","gids-profile-menu-header"].forEach((o=>{switch(o){case"gids-profile":customElements.get(e(o))||customElements.define(e(o),u);break;case"gids-profile-menu":customElements.get(e(o))||g();break;case"gids-profile-menu-header":customElements.get(e(o))||s()}}))}v();const b=u,C=v;export{b as GidsProfile,C as defineCustomElement}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e,p as i,H as t,h as s,d}from"./p-Bf3p-DY2.js";import{GidsProfileMenuWebUtils as n}from"@ganpatiinfo/gids-web-shared";import{a as r,b as o}from"./p-BrYLEey4.js";import{G as a,a as h}from"./p-Bs8TP3Rb.js";import{d as l}from"./p-oJFgjzK5.js";const{getGidsProfileMenuClassNames:m}=n,c=i(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.headerVisible=!1,this.listSectionDividerVisible=!1,this.headerDividerVisible=!0,this.profileMenuItems=[],this.selectedProfileMenuItem=void 0,this.onListItemPress=({event:e,sectionIndex:i,itemIndex:t,item:s})=>{const d={...s,sectionIndex:i,itemIndex:t};this.onProfileMenuItemPress&&!this.isItemAlreadySelected(d)&&this.onProfileMenuItemPress({originalEvent:e,id:s.id,sectionIndex:i,itemIndex:t,leadingLabel:s?.leadingLabel,leadingSupport:s?.leadingSupport,trailingLabel:s?.trailingLabel,trailingSupport:s?.trailingSupport}),this.profileMenuItemSelection(d)},this.defaultSelectedProfileMenuItem=()=>{const e=this?.profileMenuItems??[],i=this?.selectedProfileMenuItemId??void 0;e.length>0&&i&&e.map(((e,t)=>{const s=e?.items??[],d=s.findIndex((e=>e?.id===i));if(null!=d&&-1!==d){const e=s[d];e&&(this.selectedProfileMenuItem={...e,id:e.id,sectionIndex:t,itemIndex:d})}}))},this.profileMenuItemSelection=e=>{e?.id&&(this.isItemAlreadySelected(e)||(this.selectedProfileMenuItem=e))},this.isItemAlreadySelected=e=>e.id===this?.selectedProfileMenuItem?.id&&e?.sectionIndex===this?.selectedProfileMenuItem?.sectionIndex&&e?.itemIndex===this?.selectedProfileMenuItem?.itemIndex,this.isThisItemSelected=e=>e?.id===this?.selectedProfileMenuItem?.id&&e?.sectionIndex===this?.selectedProfileMenuItem?.sectionIndex&&e?.itemIndex===this?.selectedProfileMenuItem?.itemIndex,this.hasHeaderItem=()=>{const e=this?.headerItem,i=this?.headerVisible;return!(!i||!(e?.avatarVisible||e?.avatarProps&&Object.keys(e).length>0||e?.headerSupportingText||e?.headerTitle))},this.hasProfileMenuItems=()=>{const e=this?.profileMenuItems??[];return!!(e.length>0&&e[0]?.items&&e[0].items.length>0||this.hasHeaderItem())}}headerItemChanged(e){this.headerItem=e}headerVisibleChanged(e){this.headerVisible=e}selectedProfileMenuItemIdChanged(e){this.selectedProfileMenuItemId=e}profileMenuItemsChanged(e){this.profileMenuItems=e,this.defaultSelectedProfileMenuItem()}connectedCallback(){}componentDidLoad(){this.defaultSelectedProfileMenuItem()}render(){const e=this?.headerItem,i=this?.headerVisible,t=this?.headerDividerVisible,n=this?.listSectionDividerVisible,l=this?.profileMenuItems??[],c=m();return s(d,{key:"fec444e1cba6478290b950ff0faae84ce0944e23",class:c},s(a,{key:"33a803ebe9285016b9bbd679dab827272ab46458",type:this.hasProfileMenuItems()?"default":"no-options"},i?s("div",{class:"gids-profile-menu__header-container"},s("gids-profile-menu-header",{...e,onHeaderAvatarPress:this.onHeaderAvatarPress,onHeaderTitlePress:this.onHeaderTitlePress,onHeaderSupportingTextPress:this.onHeaderSupportingTextPress})):void 0,t&&this.hasHeaderItem()?s("div",{class:"gids-profile-menu__header-divider-container"},s(r,null)):void 0,l.map(((e,i)=>s(h,{key:`${i+1}`,sectionLabel:e?.sectionLabel??""},(e?.items??[]).map(((e,t)=>{const d=this.isThisItemSelected({...e,sectionIndex:i,itemIndex:t});return console.log("_thisItemSelected",d),s(o,{...e,key:`${t+1}`,id:e.id,index:t,onPressListItem:s=>this.onListItemPress({event:s,sectionIndex:i,itemIndex:t,item:e}),selected:d},e?.leadingLabel)})),i<l.length-1&&n?s(r,null):void 0)))))}get hostElement(){return this}static get watchers(){return{headerItem:[{headerItemChanged:0}],headerVisible:[{headerVisibleChanged:0}],selectedProfileMenuItemId:[{selectedProfileMenuItemIdChanged:0}],profileMenuItems:[{profileMenuItemsChanged:0}]}}static get style(){return".gids-profile-menu .gids-divider{width:100%}.gids-profile-menu__header-divider-container{width:100%;padding-bottom:var(--gids-padding-vertical-edge-to-element-200)}.gids-profile-menu__header-container{display:flex;width:100%;padding:var(--gids-padding-vertical-edge-to-element-150) 0px}"}},[0,"gids-profile-menu",{headerItem:[16],selectedProfileMenuItemId:[1,"selected-profile-menu-item-id"],headerVisible:[4,"header-visible"],listSectionDividerVisible:[4,"list-section-divider-visible"],headerDividerVisible:[4,"header-divider-visible"],profileMenuItems:[16],onHeaderAvatarPress:[16],onHeaderTitlePress:[16],onHeaderSupportingTextPress:[16],onProfileMenuItemPress:[16],selectedProfileMenuItem:[32]},void 0,{headerItem:[{headerItemChanged:0}],headerVisible:[{headerVisibleChanged:0}],selectedProfileMenuItemId:[{selectedProfileMenuItemIdChanged:0}],profileMenuItems:[{profileMenuItemsChanged:0}]}]);function p(){"undefined"!=typeof customElements&&["gids-profile-menu","gids-profile-menu-header"].forEach((i=>{switch(i){case"gids-profile-menu":customElements.get(e(i))||customElements.define(e(i),c);break;case"gids-profile-menu-header":customElements.get(e(i))||l()}}))}p();export{c as G,p as d}
|
|
@@ -33,6 +33,7 @@ export declare class GidsProfile implements GidsProfileBaseWebProps {
|
|
|
33
33
|
onProfileMenuItemPress?: (event: GidsProfileMenuItemEvent<GidsProfilePressCustomEvents>) => void;
|
|
34
34
|
onPressProfileControl?: (event: GidsProfileControlEvent<GidsProfilePressCustomEvents>) => void;
|
|
35
35
|
isMenuExpanded?: boolean;
|
|
36
|
+
selectedProfileMenuItemId?: string;
|
|
36
37
|
protected idChanged(next: string): void;
|
|
37
38
|
protected profileControlAppearanceChanged(next: GidsProfileAppearance): void;
|
|
38
39
|
protected profileControlAvatarPropsChanged(next: GidsProfileControlAvatarProps<string>): void;
|
|
@@ -56,6 +57,9 @@ export declare class GidsProfile implements GidsProfileBaseWebProps {
|
|
|
56
57
|
disconnectedCallback(): void;
|
|
57
58
|
private onProfileControlPress;
|
|
58
59
|
private onPressProfileMenuItem;
|
|
60
|
+
private onPressHeaderAvatar;
|
|
61
|
+
private onPressHeaderTitle;
|
|
62
|
+
private onPressHeaderSupportingText;
|
|
59
63
|
private positionProfileMenu;
|
|
60
64
|
private getProfileControlAvatarText;
|
|
61
65
|
private hasHeaderItem;
|
|
@@ -5,6 +5,7 @@ export type GidsProfileMenuBaseWebProps = GidsProfileMenuWebProps<GidsProfileMen
|
|
|
5
5
|
export declare class GidsProfileMenu implements GidsProfileMenuBaseWebProps {
|
|
6
6
|
private hostElement;
|
|
7
7
|
headerItem?: GidsProfileMenuHeaderItem<GidsProfileMenuPressCustomEvents, string>;
|
|
8
|
+
selectedProfileMenuItemId?: string;
|
|
8
9
|
headerVisible?: boolean;
|
|
9
10
|
listSectionDividerVisible?: boolean;
|
|
10
11
|
headerDividerVisible?: boolean;
|
|
@@ -16,9 +17,12 @@ export declare class GidsProfileMenu implements GidsProfileMenuBaseWebProps {
|
|
|
16
17
|
selectedProfileMenuItem?: GidsProfileMenuItemEventDetails;
|
|
17
18
|
protected headerItemChanged(next: GidsProfileMenuHeaderItem<GidsProfileMenuPressCustomEvents, string>): void;
|
|
18
19
|
protected headerVisibleChanged(next: boolean): void;
|
|
20
|
+
protected selectedProfileMenuItemIdChanged(next: string): void;
|
|
19
21
|
protected profileMenuItemsChanged(next: GidsProfileMenuGroupedItem[]): void;
|
|
20
22
|
connectedCallback(): void;
|
|
23
|
+
componentDidLoad(): void;
|
|
21
24
|
private onListItemPress;
|
|
25
|
+
private defaultSelectedProfileMenuItem;
|
|
22
26
|
private profileMenuItemSelection;
|
|
23
27
|
private isItemAlreadySelected;
|
|
24
28
|
private isThisItemSelected;
|
|
@@ -1041,6 +1041,7 @@ export namespace Components {
|
|
|
1041
1041
|
* @default []
|
|
1042
1042
|
*/
|
|
1043
1043
|
"profileMenuItems"?: GidsProfileMenuGroupedItem[];
|
|
1044
|
+
"selectedProfileMenuItemId"?: string;
|
|
1044
1045
|
}
|
|
1045
1046
|
interface GidsProfileMenuHeader {
|
|
1046
1047
|
/**
|
|
@@ -2716,6 +2717,7 @@ declare namespace LocalJSX {
|
|
|
2716
2717
|
* @default []
|
|
2717
2718
|
*/
|
|
2718
2719
|
"profileMenuItems"?: GidsProfileMenuGroupedItem[];
|
|
2720
|
+
"selectedProfileMenuItemId"?: string;
|
|
2719
2721
|
}
|
|
2720
2722
|
interface GidsProfileMenuHeader {
|
|
2721
2723
|
/**
|
|
@@ -3309,6 +3311,7 @@ declare namespace LocalJSX {
|
|
|
3309
3311
|
"listSectionDividerVisible": boolean;
|
|
3310
3312
|
}
|
|
3311
3313
|
interface GidsProfileMenuAttributes {
|
|
3314
|
+
"selectedProfileMenuItemId": string;
|
|
3312
3315
|
"headerVisible": boolean;
|
|
3313
3316
|
"listSectionDividerVisible": boolean;
|
|
3314
3317
|
"headerDividerVisible": boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
1
|
+
import { c as e, p as o } from "./p-BAs2-lhK-31X-j6-3.js";
|
|
2
|
+
const p = e, r = o;
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
p as GidsProfileMenu,
|
|
5
|
+
r as defineCustomElement
|
|
6
6
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { L as z, u as B, D as
|
|
2
|
-
import { m as
|
|
3
|
-
import { p as
|
|
1
|
+
import { L as z, u as B, D as o, P as L, q as c } from "./p-Bf3p-DY2-CPqEc-vc.js";
|
|
2
|
+
import { m as R, l as j, u as $ } from "./p-oJFgjzK5-CzagP1qD.js";
|
|
3
|
+
import { p as G } from "./p-CXFvqDBs-offadaUn.js";
|
|
4
4
|
import { d as b } from "./p-D4Pimu_8-ARSuGBs4.js";
|
|
5
|
-
import {
|
|
6
|
-
import { c as
|
|
7
|
-
const
|
|
5
|
+
import { p as q } from "./p-BAs2-lhK-31X-j6-3.js";
|
|
6
|
+
import { c as N } from "./clsx-OuTLNxxd.js";
|
|
7
|
+
const O = ({ profileControlAppearance: e, profileControlBorderRadius: i, profileControlShadow: r, expanded: a }, l) => N("gids-profile", {
|
|
8
8
|
// Appearances
|
|
9
9
|
// 'gids-profile--appearance-default': profileControlAppearance === 'default', // By default so not needed
|
|
10
10
|
"gids-profile--appearance-brand": e === "brand",
|
|
@@ -21,12 +21,12 @@ const N = ({ profileControlAppearance: e, profileControlBorderRadius: i, profile
|
|
|
21
21
|
"gids-profile--border-radius-full": i === "full",
|
|
22
22
|
// Shadows
|
|
23
23
|
// 'gids-profile--shadow-none': profileControlShadow === 'none', // By default so not needed
|
|
24
|
-
"gids-profile--shadow-overflow":
|
|
25
|
-
"gids-profile--shadow-overlay":
|
|
26
|
-
"gids-profile--shadow-raised":
|
|
24
|
+
"gids-profile--shadow-overflow": r === "overflow",
|
|
25
|
+
"gids-profile--shadow-overlay": r === "overlay",
|
|
26
|
+
"gids-profile--shadow-raised": r === "raised",
|
|
27
27
|
// Expansion
|
|
28
28
|
"gids-profile--expanded": a
|
|
29
|
-
}, l),
|
|
29
|
+
}, l), F = ({ profileControlAppearance: e }) => {
|
|
30
30
|
switch (e) {
|
|
31
31
|
case "brand":
|
|
32
32
|
return {
|
|
@@ -64,32 +64,38 @@ const N = ({ profileControlAppearance: e, profileControlBorderRadius: i, profile
|
|
|
64
64
|
supportingTextClasses: "gids-profile__supporting-text-typography gids-profile__supporting-text-default"
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
},
|
|
67
|
+
}, W = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
68
68
|
__proto__: null,
|
|
69
|
-
getGidsProfileClassNames:
|
|
70
|
-
getGidsProfileTextClassNames:
|
|
71
|
-
}, Symbol.toStringTag, { value: "Module" })), { getGidsProfileClassNames:
|
|
69
|
+
getGidsProfileClassNames: O,
|
|
70
|
+
getGidsProfileTextClassNames: F
|
|
71
|
+
}, Symbol.toStringTag, { value: "Module" })), { getGidsProfileClassNames: J, getGidsProfileTextClassNames: K } = W, { getProfileHeaderMenuAvatarText: Q } = j, C = z(class extends B {
|
|
72
72
|
constructor(e) {
|
|
73
|
-
super(), e !== !1 && this.__registerHost(), this.expanded = !1, this.profileControlAppearance = "default", this.profileControlAvatarVisible = !0, this.profileControlAvatarBadgeVisible = !0, this.profileControlBorderRadius = "none", this.profileControlShadow = "none", this.profileControlLeadingIconSize = "sm", this.profileControlTrailingIconSize = "sm", this.profileControlLeadingIconAppearance = "filled", this.profileControlTrailingIconAppearance = "filled", this.profileMenuItems = [], this.headerDividerVisible = !1, this.headerVisible = !1, this.listSectionDividerVisible = !1, this.isMenuExpanded = !1, this.onProfileControlPress = (i) => {
|
|
74
|
-
if (this.hasMenu()) {
|
|
75
|
-
const
|
|
76
|
-
this.isMenuExpanded =
|
|
73
|
+
super(), e !== !1 && this.__registerHost(), this.expanded = !1, this.profileControlAppearance = "default", this.profileControlAvatarVisible = !0, this.profileControlAvatarBadgeVisible = !0, this.profileControlBorderRadius = "none", this.profileControlShadow = "none", this.profileControlLeadingIconSize = "sm", this.profileControlTrailingIconSize = "sm", this.profileControlLeadingIconAppearance = "filled", this.profileControlTrailingIconAppearance = "filled", this.profileMenuItems = [], this.headerDividerVisible = !1, this.headerVisible = !1, this.listSectionDividerVisible = !1, this.isMenuExpanded = !1, this.selectedProfileMenuItemId = void 0, this.onProfileControlPress = (i) => {
|
|
74
|
+
if (i && i.stopPropagation(), this.hasMenu()) {
|
|
75
|
+
const r = !this.isMenuExpanded;
|
|
76
|
+
this.isMenuExpanded = r, this.onPressProfileControl && this.onPressProfileControl({ originalEvent: i, id: this.id, menuId: this?.menuId, expanded: r, profileControlTitle: this?.profileControlTitle, profileControlSupportingText: this?.profileControlSupportingText });
|
|
77
77
|
}
|
|
78
78
|
}, this.onPressProfileMenuItem = (i) => {
|
|
79
|
-
this.isMenuExpanded = !1, this.
|
|
79
|
+
i?.originalEvent && (i.originalEvent?.stopPropagation(), i.originalEvent?.preventDefault()), this.isMenuExpanded = !1, this.selectedProfileMenuItemId = i.id, this.onProfileMenuItemPress && this.onProfileMenuItemPress({ ...i });
|
|
80
|
+
}, this.onPressHeaderAvatar = (i) => {
|
|
81
|
+
i?.originalEvent && i.originalEvent?.stopPropagation(), this.isMenuExpanded = !1, this.onHeaderAvatarPress && this.onHeaderAvatarPress({ ...i });
|
|
82
|
+
}, this.onPressHeaderTitle = (i) => {
|
|
83
|
+
i?.originalEvent && i.originalEvent?.stopPropagation(), this.isMenuExpanded = !1, this.onHeaderAvatarPress && this.onHeaderAvatarPress({ ...i });
|
|
84
|
+
}, this.onPressHeaderSupportingText = (i) => {
|
|
85
|
+
i?.originalEvent && i.originalEvent?.stopPropagation(), this.isMenuExpanded = !1, this.onHeaderAvatarPress && this.onHeaderAvatarPress({ ...i });
|
|
80
86
|
}, this.positionProfileMenu = () => {
|
|
81
87
|
const i = this.hostElement?.querySelector(".gids-profile__dropdown-menu-container");
|
|
82
88
|
if (!i) return;
|
|
83
|
-
const
|
|
89
|
+
const r = this.hostElement.getBoundingClientRect(), a = window.innerWidth, l = window.innerHeight;
|
|
84
90
|
i.style.maxHeight = "none";
|
|
85
|
-
const g = i.getBoundingClientRect(), s = l -
|
|
91
|
+
const g = i.getBoundingClientRect(), s = l - r.bottom - 8, n = r.top - 4, d = g.height > s && n > s, f = d ? n : s;
|
|
86
92
|
i.style.maxHeight = g.height > f ? f + "px" : "none";
|
|
87
93
|
const p = i.getBoundingClientRect();
|
|
88
|
-
let t =
|
|
89
|
-
t + p.width > a - 4 && (t = a - p.width - 4), t < 4 && (t = 4), i.style.left = t -
|
|
94
|
+
let t = r.left;
|
|
95
|
+
t + p.width > a - 4 && (t = a - p.width - 4), t < 4 && (t = 4), i.style.left = t - r.left + "px", i.style.top = d ? -p.height - 4 + "px" : r.height + 4 + "px";
|
|
90
96
|
}, this.getProfileControlAvatarText = () => {
|
|
91
|
-
const i = this?.profileControlAvatarProps,
|
|
92
|
-
return i?.text ??
|
|
97
|
+
const i = this?.profileControlAvatarProps, r = this?.profileControlTitle;
|
|
98
|
+
return i?.text ?? Q({ headerTitle: r });
|
|
93
99
|
}, this.hasHeaderItem = () => {
|
|
94
100
|
const i = this?.headerItem;
|
|
95
101
|
return !(!this?.headerVisible || !(i?.avatarVisible || i?.avatarProps && Object.keys(i).length > 0 || i?.headerSupportingText || i?.headerTitle));
|
|
@@ -163,9 +169,9 @@ const N = ({ profileControlAppearance: e, profileControlBorderRadius: i, profile
|
|
|
163
169
|
document.removeEventListener("click", this.handleDocumentClick);
|
|
164
170
|
}
|
|
165
171
|
render() {
|
|
166
|
-
const e = this?.profileControlAppearance ?? "default", i = this?.profileControlAvatarProps,
|
|
172
|
+
const e = this?.profileControlAppearance ?? "default", i = this?.profileControlAvatarProps, r = i?.badgeProps, a = this?.profileControlAvatarVisible ?? !1, l = this?.profileControlAvatarBadgeVisible ?? !1, g = this?.profileControlBorderRadius ?? "none", s = this?.profileControlShadow ?? "none", n = this?.profileControlLeadingIcon, d = this?.profileControlTrailingIcon, f = this?.profileControlTitle ?? "", p = this?.profileControlSupportingText ?? "", t = this?.profileMenuItems ?? [], _ = this?.headerDividerVisible ?? !1, x = this?.headerVisible ?? !1, y = this?.headerItem, I = this?.listSectionDividerVisible ?? !1, P = this?.menuId, h = this?.isMenuExpanded ?? !1, u = this.hasMenu(), w = this.selectedProfileMenuItemId, k = this?.profileControlLeadingIconSize ?? "sm", T = this?.profileControlTrailingIconSize ?? "sm", A = this?.profileControlLeadingIconAppearance ?? "filled", V = this?.profileControlTrailingIconAppearance ?? "filled", M = J({ profileControlAppearance: e, profileControlBorderRadius: g, profileControlShadow: s, expanded: h && u }), S = i?.size ?? "sm", { titleClasses: E, supportingTextClasses: D } = K({ profileControlAppearance: e });
|
|
167
173
|
let v = i?.color ?? "brand";
|
|
168
|
-
return e === "brand" && (v = i?.color ?? "default"),
|
|
174
|
+
return e === "brand" && (v = i?.color ?? "default"), o(L, { key: "45b84a12b6b66d6a0d2ce45bfa2fb3ede2f758aa", class: M, onClick: this.onProfileControlPress, "menu-expanded": h }, n ? o(b, { name: n, size: k, appearance: A }) : void 0, o("div", { key: "2eb131b7efc5ecda1fc407e04cdee8aba4176771", class: "gids-profile__main-container" }, a ? o(R, { appearance: i?.appearance ?? "text", color: v, size: S, text: this.getProfileControlAvatarText(), imageSrc: i?.imageSrc ?? "", alt: i?.alt ?? "alt-img", badge: l ? o(G, { appearance: r?.appearance ?? "information", type: r?.type, count: r?.count, outline: r?.outline }) : void 0 }) : void 0, o("div", { key: "ae4cb682230b5a2e227cdb23c45c9159535638e1", class: "gids-profile__content-container" }, o("span", { key: "81fa38851c46526b7e714dabbe7bdabd9735ee8e", class: E }, f), o("p", { key: "47a5f275b796bdaab1e8b2d437e61698d65a2fab", class: D }, p))), d ? o(b, { name: d, size: T, appearance: V }) : void 0, u && h ? o("div", { class: "gids-profile__dropdown-menu-container", id: P, role: "profilePickerbox", onClick: (H) => H.stopPropagation() }, o("gids-profile-menu", { headerItem: y, headerDividerVisible: _, headerVisible: x, listSectionDividerVisible: I, profileMenuItems: t, onHeaderAvatarPress: this.onPressHeaderAvatar, onHeaderTitlePress: this.onPressHeaderTitle, onHeaderSupportingTextPress: this.onPressHeaderSupportingText, onProfileMenuItemPress: this.onPressProfileMenuItem, selectedProfileMenuItemId: w })) : void 0);
|
|
169
175
|
}
|
|
170
176
|
get hostElement() {
|
|
171
177
|
return this;
|
|
@@ -176,7 +182,7 @@ const N = ({ profileControlAppearance: e, profileControlBorderRadius: i, profile
|
|
|
176
182
|
static get style() {
|
|
177
183
|
return ".gids-profile{position:relative;display:flex;align-items:center;justify-content:space-between;gap:var(--gids-gap-150);cursor:pointer;background-color:var(--gids-color-background-neutral-default);padding:var(--gids-padding-vertical-edge-to-element-150) var(--gids-padding-horizontal-edge-to-element-200);--gidsIcon-color:var(--gids-color-icon-subtle);border-radius:var(--gids-border-radius-none)}.gids-profile:hover{background-color:var(--gids-color-background-neutral-hovered)}.gids-profile:active{background-color:var(--gids-color-background-neutral-pressed)}.gids-profile__main-container{display:flex;align-items:center;flex:1;gap:var(--gids-gap-100)}.gids-profile__content-container{display:flex;flex-direction:column;align-items:flex-start;justify-content:center}.gids-profile__title-typography{font-family:var(--gids-typography-label-small__font-family);font-size:var(--gids-typography-label-small__font-size);font-weight:var(--gids-typography-label-small__font-weight);letter-spacing:var(--gids-typography-label-small__letter-spacing);line-height:var(--gids-typography-label-small__line-height);text-transform:var(--gids-typography-label-small__text-transform, inherit);font-variant-caps:var(--gids-typography-label-small__font-variant-caps, inherit)}.gids-profile__supporting-text-typography{margin:0;padding:0;font-family:var(--gids-typography-paragraph-x-small__font-family);font-size:var(--gids-typography-paragraph-x-small__font-size);font-weight:var(--gids-typography-paragraph-x-small__font-weight);letter-spacing:var(--gids-typography-paragraph-x-small__letter-spacing);line-height:var(--gids-typography-paragraph-x-small__line-height);text-transform:var(--gids-typography-paragraph-x-small__text-transform, inherit);font-variant-caps:var(--gids-typography-paragraph-x-small__font-variant-caps, inherit)}.gids-profile__title-default{color:var(--gids-color-text-default)}.gids-profile__supporting-text-default{color:var(--gids-color-text-subtlest)}.gids-profile__title-brand{color:var(--gids-color-text-default)}.gids-profile__supporting-text-brand{color:var(--gids-color-text-subtlest)}.gids-profile__title-subtle{color:var(--gids-color-text-default)}.gids-profile__supporting-text-subtle{color:var(--gids-color-text-subtlest)}.gids-profile__title-positive{color:var(--gids-color-text-default)}.gids-profile__supporting-text-positive{color:var(--gids-color-text-subtlest)}.gids-profile__title-information{color:var(--gids-color-text-default)}.gids-profile__supporting-text-information{color:var(--gids-color-text-subtlest)}.gids-profile__title-warning{color:var(--gids-color-text-default)}.gids-profile__supporting-text-warning{color:var(--gids-color-text-subtlest)}.gids-profile__title-danger{color:var(--gids-color-text-default)}.gids-profile__supporting-text-danger{color:var(--gids-color-text-subtlest)}.gids-profile--appearance-brand{background-color:var(--gids-color-background-brand-subtlest-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-brand:hover{background-color:var(--gids-color-background-brand-subtlest-hovered)}.gids-profile--appearance-brand:active{background-color:var(--gids-color-background-brand-subtlest-pressed)}.gids-profile--appearance-danger{background-color:var(--gids-color-background-danger-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-danger:hover{background-color:var(--gids-color-background-danger-hovered)}.gids-profile--appearance-danger:active{background-color:var(--gids-color-background-danger-pressed)}.gids-profile--appearance-information{background-color:var(--gids-color-background-information-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-information:hover{background-color:var(--gids-color-background-information-hovered)}.gids-profile--appearance-information:active{background-color:var(--gids-color-background-information-pressed)}.gids-profile--appearance-positive{background-color:var(--gids-color-background-positive-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-positive:hover{background-color:var(--gids-color-background-positive-hovered)}.gids-profile--appearance-positive:active{background-color:var(--gids-color-background-positive-pressed)}.gids-profile--appearance-subtle{background-color:var(--gids-color-background-neutral-subtle-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-subtle:hover{background-color:var(--gids-color-background-neutral-subtle-hovered)}.gids-profile--appearance-subtle:active{background-color:var(--gids-color-background-neutral-subtle-pressed)}.gids-profile--appearance-warning{background-color:var(--gids-color-background-warning-default);--gidsIcon-color:var(--gids-color-icon-subtle)}.gids-profile--appearance-warning:hover{background-color:var(--gids-color-background-warning-hovered)}.gids-profile--appearance-warning:active{background-color:var(--gids-color-background-warning-pressed)}.gids-profile--border-radius-sm{border-radius:var(--gids-border-radius-sm)}.gids-profile--border-radius-md{border-radius:var(--gids-border-radius-md)}.gids-profile--border-radius-lg{border-radius:var(--gids-border-radius-lg)}.gids-profile--border-radius-full{border-radius:var(--gids-border-radius-full)}.gids-profile--shadow-overflow{box-shadow:var(--gids-elevation-shadow-overflow)}.gids-profile--shadow-overlay{box-shadow:var(--gids-elevation-shadow-overlay)}.gids-profile--shadow-raised{box-shadow:var(--gids-elevation-shadow-raised)}.gids-profile__dropdown-menu-container{position:absolute;left:0;top:calc(100% + var(--gids-gap-050));z-index:3;display:none;flex-direction:column;align-self:stretch;min-width:var(--gids-width-2-xs);min-height:55px;overflow-x:hidden;overflow-y:auto;background-color:var(--gids-elevation-surface-overlay-default);box-shadow:var(--gids-elevation-shadow-overlay);border-radius:var(--gids-border-radius-lg)}.gids-profile__dropdown-menu-container>*{flex-shrink:0}.gids-profile--expanded .gids-profile__dropdown-menu-container{display:flex}.gids-profile--expanded .gids-profile__chevron{transform:rotate(180deg)}";
|
|
178
184
|
}
|
|
179
|
-
}, [0, "gids-profile", { id: [1], menuId: [1, "menu-id"], expanded: [4], profileControlAppearance: [1, "profile-control-appearance"], profileControlAvatarProps: [16], profileControlAvatarVisible: [4, "profile-control-avatar-visible"], profileControlAvatarBadgeVisible: [4, "profile-control-avatar-badge-visible"], profileControlBorderRadius: [1, "profile-control-border-radius"], profileControlShadow: [1, "profile-control-shadow"], profileControlLeadingIcon: [1, "profile-control-leading-icon"], profileControlTrailingIcon: [1, "profile-control-trailing-icon"], profileControlLeadingIconSize: [1, "profile-control-leading-icon-size"], profileControlTrailingIconSize: [1, "profile-control-trailing-icon-size"], profileControlLeadingIconAppearance: [1, "profile-control-leading-icon-appearance"], profileControlTrailingIconAppearance: [1, "profile-control-trailing-icon-appearance"], profileControlTitle: [1, "profile-control-title"], profileControlSupportingText: [1, "profile-control-supporting-text"], profileMenuItems: [16], headerDividerVisible: [4, "header-divider-visible"], headerVisible: [4, "header-visible"], headerItem: [16], listSectionDividerVisible: [4, "list-section-divider-visible"], onHeaderAvatarPress: [16], onHeaderTitlePress: [16], onHeaderSupportingTextPress: [16], onProfileMenuItemPress: [16], onPressProfileControl: [16], isMenuExpanded: [32] }, void 0, { id: [{ idChanged: 0 }], profileControlAppearance: [{ profileControlAppearanceChanged: 0 }], profileControlAvatarProps: [{ profileControlAvatarPropsChanged: 0 }], expanded: [{ expansionChanged: 0 }], profileControlAvatarVisible: [{ profileControlAvatarVisibleChanged: 0 }], profileControlAvatarBadgeVisible: [{ profileControlAvatarBadgeVisibleChanged: 0 }], profileControlBorderRadius: [{ profileControlBorderRadiusChanged: 0 }], profileControlShadow: [{ profileControlShadowChanged: 0 }], listSectionDividerVisible: [{ listSectionDividerVisibleChanged: 0 }], profileControlLeadingIcon: [{ profileControlLeadingIconChanged: 0 }], profileControlTrailingIcon: [{ profileControlTrailingIconChanged: 0 }], profileControlTitle: [{ profileControlTitleChanged: 0 }], profileControlSupportingText: [{ profileControlSupportingTextChanged: 0 }], headerDividerVisible: [{ headerDividerVisibleChanged: 0 }], headerItem: [{ headerItemChanged: 0 }], headerVisible: [{ headerVisibleChanged: 0 }], profileMenuItems: [{ profileMenuItemsChanged: 0 }] }]);
|
|
185
|
+
}, [0, "gids-profile", { id: [1], menuId: [1, "menu-id"], expanded: [4], profileControlAppearance: [1, "profile-control-appearance"], profileControlAvatarProps: [16], profileControlAvatarVisible: [4, "profile-control-avatar-visible"], profileControlAvatarBadgeVisible: [4, "profile-control-avatar-badge-visible"], profileControlBorderRadius: [1, "profile-control-border-radius"], profileControlShadow: [1, "profile-control-shadow"], profileControlLeadingIcon: [1, "profile-control-leading-icon"], profileControlTrailingIcon: [1, "profile-control-trailing-icon"], profileControlLeadingIconSize: [1, "profile-control-leading-icon-size"], profileControlTrailingIconSize: [1, "profile-control-trailing-icon-size"], profileControlLeadingIconAppearance: [1, "profile-control-leading-icon-appearance"], profileControlTrailingIconAppearance: [1, "profile-control-trailing-icon-appearance"], profileControlTitle: [1, "profile-control-title"], profileControlSupportingText: [1, "profile-control-supporting-text"], profileMenuItems: [16], headerDividerVisible: [4, "header-divider-visible"], headerVisible: [4, "header-visible"], headerItem: [16], listSectionDividerVisible: [4, "list-section-divider-visible"], onHeaderAvatarPress: [16], onHeaderTitlePress: [16], onHeaderSupportingTextPress: [16], onProfileMenuItemPress: [16], onPressProfileControl: [16], isMenuExpanded: [32], selectedProfileMenuItemId: [32] }, void 0, { id: [{ idChanged: 0 }], profileControlAppearance: [{ profileControlAppearanceChanged: 0 }], profileControlAvatarProps: [{ profileControlAvatarPropsChanged: 0 }], expanded: [{ expansionChanged: 0 }], profileControlAvatarVisible: [{ profileControlAvatarVisibleChanged: 0 }], profileControlAvatarBadgeVisible: [{ profileControlAvatarBadgeVisibleChanged: 0 }], profileControlBorderRadius: [{ profileControlBorderRadiusChanged: 0 }], profileControlShadow: [{ profileControlShadowChanged: 0 }], listSectionDividerVisible: [{ listSectionDividerVisibleChanged: 0 }], profileControlLeadingIcon: [{ profileControlLeadingIconChanged: 0 }], profileControlTrailingIcon: [{ profileControlTrailingIconChanged: 0 }], profileControlTitle: [{ profileControlTitleChanged: 0 }], profileControlSupportingText: [{ profileControlSupportingTextChanged: 0 }], headerDividerVisible: [{ headerDividerVisibleChanged: 0 }], headerItem: [{ headerItemChanged: 0 }], headerVisible: [{ headerVisibleChanged: 0 }], profileMenuItems: [{ profileMenuItemsChanged: 0 }] }]);
|
|
180
186
|
function m() {
|
|
181
187
|
typeof customElements < "u" && ["gids-profile", "gids-profile-menu", "gids-profile-menu-header"].forEach(((e) => {
|
|
182
188
|
switch (e) {
|
|
@@ -184,7 +190,7 @@ function m() {
|
|
|
184
190
|
customElements.get(c(e)) || customElements.define(c(e), C);
|
|
185
191
|
break;
|
|
186
192
|
case "gids-profile-menu":
|
|
187
|
-
customElements.get(c(e)) ||
|
|
193
|
+
customElements.get(c(e)) || q();
|
|
188
194
|
break;
|
|
189
195
|
case "gids-profile-menu-header":
|
|
190
196
|
customElements.get(c(e)) || $();
|
|
@@ -192,8 +198,8 @@ function m() {
|
|
|
192
198
|
}));
|
|
193
199
|
}
|
|
194
200
|
m();
|
|
195
|
-
const
|
|
201
|
+
const re = C, oe = m;
|
|
196
202
|
export {
|
|
197
|
-
|
|
203
|
+
re as GidsProfile,
|
|
198
204
|
oe as defineCustomElement
|
|
199
205
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { q as h, L as f, u as p, D as d, P as g } from "./p-Bf3p-DY2-CPqEc-vc.js";
|
|
2
|
+
import { b as u, v as P } from "./p-BrYLEey4-DuajY4uD.js";
|
|
3
|
+
import { i as b, a as M } from "./p-Bs8TP3Rb-BdcS7d5q.js";
|
|
4
|
+
import { u as v } from "./p-oJFgjzK5-CzagP1qD.js";
|
|
5
|
+
import { c as x } from "./clsx-OuTLNxxd.js";
|
|
6
|
+
const S = (i) => x("gids-profile-menu", i), V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7
|
+
__proto__: null,
|
|
8
|
+
getGidsProfileMenuClassNames: S
|
|
9
|
+
}, Symbol.toStringTag, { value: "Module" })), { getGidsProfileMenuClassNames: C } = V, _ = f(class extends p {
|
|
10
|
+
constructor(i) {
|
|
11
|
+
super(), i !== !1 && this.__registerHost(), this.headerVisible = !1, this.listSectionDividerVisible = !1, this.headerDividerVisible = !0, this.profileMenuItems = [], this.selectedProfileMenuItem = void 0, this.onListItemPress = ({ event: e, sectionIndex: n, itemIndex: o, item: t }) => {
|
|
12
|
+
const r = { ...t, sectionIndex: n, itemIndex: o };
|
|
13
|
+
this.onProfileMenuItemPress && !this.isItemAlreadySelected(r) && this.onProfileMenuItemPress({ originalEvent: e, id: t.id, sectionIndex: n, itemIndex: o, leadingLabel: t?.leadingLabel, leadingSupport: t?.leadingSupport, trailingLabel: t?.trailingLabel, trailingSupport: t?.trailingSupport }), this.profileMenuItemSelection(r);
|
|
14
|
+
}, this.defaultSelectedProfileMenuItem = () => {
|
|
15
|
+
const e = this?.profileMenuItems ?? [], n = this?.selectedProfileMenuItemId ?? void 0;
|
|
16
|
+
e.length > 0 && n && e.map(((o, t) => {
|
|
17
|
+
const r = o?.items ?? [], l = r.findIndex(((s) => s?.id === n));
|
|
18
|
+
if (l != null && l !== -1) {
|
|
19
|
+
const s = r[l];
|
|
20
|
+
s && (this.selectedProfileMenuItem = { ...s, id: s.id, sectionIndex: t, itemIndex: l });
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
}, this.profileMenuItemSelection = (e) => {
|
|
24
|
+
e?.id && (this.isItemAlreadySelected(e) || (this.selectedProfileMenuItem = e));
|
|
25
|
+
}, this.isItemAlreadySelected = (e) => e.id === this?.selectedProfileMenuItem?.id && e?.sectionIndex === this?.selectedProfileMenuItem?.sectionIndex && e?.itemIndex === this?.selectedProfileMenuItem?.itemIndex, this.isThisItemSelected = (e) => e?.id === this?.selectedProfileMenuItem?.id && e?.sectionIndex === this?.selectedProfileMenuItem?.sectionIndex && e?.itemIndex === this?.selectedProfileMenuItem?.itemIndex, this.hasHeaderItem = () => {
|
|
26
|
+
const e = this?.headerItem;
|
|
27
|
+
return !(!this?.headerVisible || !(e?.avatarVisible || e?.avatarProps && Object.keys(e).length > 0 || e?.headerSupportingText || e?.headerTitle));
|
|
28
|
+
}, this.hasProfileMenuItems = () => {
|
|
29
|
+
const e = this?.profileMenuItems ?? [];
|
|
30
|
+
return !!(e.length > 0 && e[0]?.items && e[0].items.length > 0 || this.hasHeaderItem());
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
headerItemChanged(i) {
|
|
34
|
+
this.headerItem = i;
|
|
35
|
+
}
|
|
36
|
+
headerVisibleChanged(i) {
|
|
37
|
+
this.headerVisible = i;
|
|
38
|
+
}
|
|
39
|
+
selectedProfileMenuItemIdChanged(i) {
|
|
40
|
+
this.selectedProfileMenuItemId = i;
|
|
41
|
+
}
|
|
42
|
+
profileMenuItemsChanged(i) {
|
|
43
|
+
this.profileMenuItems = i, this.defaultSelectedProfileMenuItem();
|
|
44
|
+
}
|
|
45
|
+
connectedCallback() {
|
|
46
|
+
}
|
|
47
|
+
componentDidLoad() {
|
|
48
|
+
this.defaultSelectedProfileMenuItem();
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
const i = this?.headerItem, e = this?.headerVisible, n = this?.headerDividerVisible, o = this?.listSectionDividerVisible, t = this?.profileMenuItems ?? [], r = C();
|
|
52
|
+
return d(g, { key: "fec444e1cba6478290b950ff0faae84ce0944e23", class: r }, d(b, { key: "33a803ebe9285016b9bbd679dab827272ab46458", type: this.hasProfileMenuItems() ? "default" : "no-options" }, e ? d("div", { class: "gids-profile-menu__header-container" }, d("gids-profile-menu-header", { ...i, onHeaderAvatarPress: this.onHeaderAvatarPress, onHeaderTitlePress: this.onHeaderTitlePress, onHeaderSupportingTextPress: this.onHeaderSupportingTextPress })) : void 0, n && this.hasHeaderItem() ? d("div", { class: "gids-profile-menu__header-divider-container" }, d(u, null)) : void 0, t.map(((l, s) => d(M, { key: `${s + 1}`, sectionLabel: l?.sectionLabel ?? "" }, (l?.items ?? []).map(((a, m) => {
|
|
53
|
+
const c = this.isThisItemSelected({ ...a, sectionIndex: s, itemIndex: m });
|
|
54
|
+
return console.log("_thisItemSelected", c), d(P, { ...a, key: `${m + 1}`, id: a.id, index: m, onPressListItem: (I) => this.onListItemPress({ event: I, sectionIndex: s, itemIndex: m, item: a }), selected: c }, a?.leadingLabel);
|
|
55
|
+
})), s < t.length - 1 && o ? d(u, null) : void 0)))));
|
|
56
|
+
}
|
|
57
|
+
get hostElement() {
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
static get watchers() {
|
|
61
|
+
return { headerItem: [{ headerItemChanged: 0 }], headerVisible: [{ headerVisibleChanged: 0 }], selectedProfileMenuItemId: [{ selectedProfileMenuItemIdChanged: 0 }], profileMenuItems: [{ profileMenuItemsChanged: 0 }] };
|
|
62
|
+
}
|
|
63
|
+
static get style() {
|
|
64
|
+
return ".gids-profile-menu .gids-divider{width:100%}.gids-profile-menu__header-divider-container{width:100%;padding-bottom:var(--gids-padding-vertical-edge-to-element-200)}.gids-profile-menu__header-container{display:flex;width:100%;padding:var(--gids-padding-vertical-edge-to-element-150) 0px}";
|
|
65
|
+
}
|
|
66
|
+
}, [0, "gids-profile-menu", { headerItem: [16], selectedProfileMenuItemId: [1, "selected-profile-menu-item-id"], headerVisible: [4, "header-visible"], listSectionDividerVisible: [4, "list-section-divider-visible"], headerDividerVisible: [4, "header-divider-visible"], profileMenuItems: [16], onHeaderAvatarPress: [16], onHeaderTitlePress: [16], onHeaderSupportingTextPress: [16], onProfileMenuItemPress: [16], selectedProfileMenuItem: [32] }, void 0, { headerItem: [{ headerItemChanged: 0 }], headerVisible: [{ headerVisibleChanged: 0 }], selectedProfileMenuItemId: [{ selectedProfileMenuItemIdChanged: 0 }], profileMenuItems: [{ profileMenuItemsChanged: 0 }] }]);
|
|
67
|
+
function y() {
|
|
68
|
+
typeof customElements < "u" && ["gids-profile-menu", "gids-profile-menu-header"].forEach(((i) => {
|
|
69
|
+
switch (i) {
|
|
70
|
+
case "gids-profile-menu":
|
|
71
|
+
customElements.get(h(i)) || customElements.define(h(i), _);
|
|
72
|
+
break;
|
|
73
|
+
case "gids-profile-menu-header":
|
|
74
|
+
customElements.get(h(i)) || v();
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
y();
|
|
79
|
+
export {
|
|
80
|
+
_ as c,
|
|
81
|
+
y as p
|
|
82
|
+
};
|