@sula-tech/webcomponents 0.23.1 → 0.24.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/cjs/index.cjs.js +8 -7
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sula-avatar_32.cjs.entry.js +24 -23
- package/dist/cjs/sula-avatar_32.cjs.entry.js.map +1 -1
- package/dist/cjs/sula-calendar.model-CxjS_EJv.js +10 -0
- package/dist/cjs/sula-calendar.model-CxjS_EJv.js.map +1 -0
- package/dist/cjs/{sula-calendar.model-BI5cNrUo.js → sula-menu.model-BDxbWyPG.js} +2 -8
- package/dist/cjs/sula-menu.model-BDxbWyPG.js.map +1 -0
- package/dist/cjs/sula-profile-menu.cjs.entry.js +55 -0
- package/dist/cjs/sula-profile-menu.cjs.entry.js.map +1 -0
- package/dist/cjs/sula-profile-menu.entry.cjs.js.map +1 -0
- package/dist/cjs/sula-workbench-menu.cjs.entry.js +602 -0
- package/dist/cjs/sula-workbench-menu.cjs.entry.js.map +1 -0
- package/dist/cjs/sula-workbench-menu.entry.cjs.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-menu/sula-menu.css +1 -1
- package/dist/collection/components/sula-menu/sula-menu.js +13 -13
- package/dist/collection/components/sula-menu/sula-menu.js.map +1 -1
- package/dist/collection/components/sula-profile-menu/model/sula-profile-menu.model.js +2 -0
- package/dist/collection/components/sula-profile-menu/model/sula-profile-menu.model.js.map +1 -0
- package/dist/collection/components/sula-profile-menu/sula-profile-menu.css +1 -0
- package/dist/collection/components/sula-profile-menu/sula-profile-menu.js +163 -0
- package/dist/collection/components/sula-profile-menu/sula-profile-menu.js.map +1 -0
- package/dist/collection/components/sula-profile-menu/sula-profile-menu.stories.js +74 -0
- package/dist/collection/components/sula-profile-menu/sula-profile-menu.stories.js.map +1 -0
- package/dist/collection/components/sula-switch/sula-switch.css +1 -1
- package/dist/collection/components/sula-workbench-menu/model/sula-workbench-menu.model.js +2 -0
- package/dist/collection/components/sula-workbench-menu/model/sula-workbench-menu.model.js.map +1 -0
- package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.css +1 -0
- package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.js +1040 -0
- package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.js.map +1 -0
- package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.stories.js +490 -0
- package/dist/collection/components/sula-workbench-menu/sula-workbench-menu.stories.js.map +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/components/{p-Dl7qXhBf.js → p-B_WIoxzn.js} +4 -4
- package/dist/components/{p-Dl7qXhBf.js.map → p-B_WIoxzn.js.map} +1 -1
- package/dist/components/{p-V9D4rqf7.js → p-BssyNhpP.js} +3 -3
- package/dist/components/{p-V9D4rqf7.js.map → p-BssyNhpP.js.map} +1 -1
- package/dist/components/{p-DzGiAQVF.js → p-CGpfhGAG.js} +3 -3
- package/dist/components/{p-DzGiAQVF.js.map → p-CGpfhGAG.js.map} +1 -1
- package/dist/components/{p-DRskhGOW.js → p-CWTfj4TV.js} +3 -3
- package/dist/components/{p-DRskhGOW.js.map → p-CWTfj4TV.js.map} +1 -1
- package/dist/components/p-DEhN6ZhJ.js +110 -0
- package/dist/components/p-DEhN6ZhJ.js.map +1 -0
- package/dist/components/{p-DjPqgTzy.js → p-DK8hW-Cd.js} +3 -3
- package/dist/components/{p-DjPqgTzy.js.map → p-DK8hW-Cd.js.map} +1 -1
- package/dist/components/{p-BhhQBGyJ.js → p-DwZCdDhF.js} +3 -3
- package/dist/components/{p-BhhQBGyJ.js.map → p-DwZCdDhF.js.map} +1 -1
- package/dist/components/{p-jsqtM3Ie.js → p-GEr9Dmhq.js} +3 -3
- package/dist/components/{p-jsqtM3Ie.js.map → p-GEr9Dmhq.js.map} +1 -1
- package/dist/components/p-KitH8bea.js +84 -0
- package/dist/components/p-KitH8bea.js.map +1 -0
- package/dist/components/sula-avatar.js +1 -1
- package/dist/components/sula-badge.js +1 -1
- package/dist/components/sula-breadcrumb.js +1 -1
- package/dist/components/sula-button.js +1 -1
- package/dist/components/sula-calendar.js +2 -2
- package/dist/components/sula-checkbox.js +1 -1
- package/dist/components/sula-chip.js +2 -2
- package/dist/components/sula-dropdown.js +1 -1
- package/dist/components/sula-icon-picker.js +4 -4
- package/dist/components/sula-icon.js +1 -1
- package/dist/components/sula-menu-select-list.js +1 -1
- package/dist/components/sula-menu.js +15 -15
- package/dist/components/sula-menu.js.map +1 -1
- package/dist/components/sula-modal.js +2 -2
- package/dist/components/sula-profile-menu.d.ts +11 -0
- package/dist/components/sula-profile-menu.js +9 -0
- package/dist/components/sula-profile-menu.js.map +1 -0
- package/dist/components/sula-progress-bar.js +1 -1
- package/dist/components/sula-search-bar.js +1 -1
- package/dist/components/sula-segmented-control.js +1 -1
- package/dist/components/sula-switch.js +1 -105
- package/dist/components/sula-switch.js.map +1 -1
- package/dist/components/sula-tag.js +1 -1
- package/dist/components/sula-textfield.js +1 -1
- package/dist/components/sula-tiles.js +1 -1
- package/dist/components/sula-timeline-list.js +1 -1
- package/dist/components/sula-toast-stack.js +2 -2
- package/dist/components/sula-toast.js +1 -1
- package/dist/components/sula-toggle.js +1 -1
- package/dist/components/sula-tooltip.js +1 -1
- package/dist/components/sula-workbench-menu.d.ts +11 -0
- package/dist/components/sula-workbench-menu.js +659 -0
- package/dist/components/sula-workbench-menu.js.map +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sula-avatar_32.entry.js +18 -17
- package/dist/esm/sula-avatar_32.entry.js.map +1 -1
- package/dist/esm/sula-calendar.model-Cp_4qTxj.js +10 -0
- package/dist/esm/sula-calendar.model-Cp_4qTxj.js.map +1 -0
- package/dist/esm/{sula-calendar.model-BbsLJDfp.js → sula-menu.model-Cs9RR1ZV.js} +3 -9
- package/dist/esm/sula-menu.model-Cs9RR1ZV.js.map +1 -0
- package/dist/esm/sula-profile-menu.entry.js +53 -0
- package/dist/esm/sula-profile-menu.entry.js.map +1 -0
- package/dist/esm/sula-workbench-menu.entry.js +600 -0
- package/dist/esm/sula-workbench-menu.entry.js.map +1 -0
- package/dist/esm/webcomponents.js +1 -1
- package/dist/types/components/sula-profile-menu/model/sula-profile-menu.model.d.ts +22 -0
- package/dist/types/components/sula-profile-menu/sula-profile-menu.d.ts +35 -0
- package/dist/types/components/sula-profile-menu/sula-profile-menu.stories.d.ts +34 -0
- package/dist/types/components/sula-workbench-menu/model/sula-workbench-menu.model.d.ts +19 -0
- package/dist/types/components/sula-workbench-menu/sula-workbench-menu.d.ts +182 -0
- package/dist/types/components/sula-workbench-menu/sula-workbench-menu.stories.d.ts +168 -0
- package/dist/types/components.d.ts +275 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/webcomponents/index.esm.js +3 -1
- package/dist/webcomponents/index.esm.js.map +1 -1
- package/dist/webcomponents/p-50ad82d0.entry.js +827 -0
- package/dist/webcomponents/p-50ad82d0.entry.js.map +1 -0
- package/dist/webcomponents/p-88e5171a.entry.js +100 -0
- package/dist/webcomponents/p-88e5171a.entry.js.map +1 -0
- package/dist/webcomponents/{p-20b3135d.entry.js → p-907588e9.entry.js} +193 -191
- package/dist/webcomponents/{p-20b3135d.entry.js.map → p-907588e9.entry.js.map} +1 -1
- package/dist/webcomponents/p-Cp_4qTxj.js +10 -0
- package/dist/webcomponents/p-Cp_4qTxj.js.map +1 -0
- package/dist/webcomponents/{p-BbsLJDfp.js → p-Cs9RR1ZV.js} +4 -11
- package/dist/webcomponents/p-Cs9RR1ZV.js.map +1 -0
- package/dist/webcomponents/sula-profile-menu.entry.esm.js.map +1 -0
- package/dist/webcomponents/sula-workbench-menu.entry.esm.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +34 -9
- package/package.json +1 -1
- package/dist/cjs/sula-calendar.model-BI5cNrUo.js.map +0 -1
- package/dist/esm/sula-calendar.model-BbsLJDfp.js.map +0 -1
- package/dist/webcomponents/p-BbsLJDfp.js.map +0 -1
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-DYfmicjp.js';
|
|
2
|
+
import { S as SulaMenuDensity, a as SulaMenuLabelOverflow } from './p-Cs9RR1ZV.js';
|
|
3
|
+
import { d as defineCustomElement$4 } from './p-DK8hW-Cd.js';
|
|
4
|
+
import { d as defineCustomElement$3 } from './p-KitH8bea.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './p-DEhN6ZhJ.js';
|
|
6
|
+
|
|
7
|
+
const sulaWorkbenchMenuCss = "*,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{font-family:Figtree;line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.visible{visibility:visible}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.block{display:block}.flex{display:flex}.hidden{display:none}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.border{border-width:1px}.outline{outline-style:solid}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}:host,:host button,:host input,:host option,:host select,:host textarea{font-family:Figtree,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}:host{--sula-menu-width:280px;--sula-menu-collapsed-width:88px;--sula-menu-main-item-font-size:1rem;--sula-menu-main-item-line-height:1.25rem;--sula-menu-sub-item-font-size:0.9375rem;--sula-menu-main-item-max-lines:2;--sula-menu-main-item-padding-block:0.5rem;display:block;height:100%;overflow:visible;position:relative;transition:width .36s cubic-bezier(.22,1,.36,1);width:var(--sula-menu-width)}:host(.menu-host--density-compact){--sula-menu-main-item-font-size:0.875rem;--sula-menu-main-item-line-height:1.125rem;--sula-menu-sub-item-font-size:0.8125rem;--sula-menu-main-item-padding-block:0.375rem}:host(.menu-host--density-comfortable){--sula-menu-main-item-font-size:1.0625rem;--sula-menu-main-item-line-height:1.5rem;--sula-menu-sub-item-font-size:1rem;--sula-menu-main-item-padding-block:0.625rem}:host(.menu-host--collapsed){width:var(--sula-menu-collapsed-width)}.menu-shell{min-height:100%;overflow:hidden;padding:20px 0 12px;position:relative;transition:padding .36s cubic-bezier(.22,1,.36,1),width .36s cubic-bezier(.22,1,.36,1),transform .36s cubic-bezier(.22,1,.36,1),box-shadow .36s cubic-bezier(.22,1,.36,1),border-radius .28s cubic-bezier(.4,0,.2,1),background-color .22s cubic-bezier(.4,0,.2,1);width:100%}.menu-shell--expanded{box-shadow:0 10px 24px rgba(15,23,42,.08),0 2px 8px rgba(15,23,42,.06);padding:20px 20px 12px;width:var(--sula-menu-width)}.menu-shell--collapsed{box-shadow:0 8px 18px rgba(15,23,42,.06),0 1px 4px rgba(15,23,42,.04)}.menu-shell--preview{border-radius:0 24px 24px 0;bottom:0;box-shadow:0 28px 60px rgba(15,23,42,.18),0 10px 24px rgba(15,23,42,.12);left:0;position:absolute;top:0;width:var(--sula-menu-width);z-index:2}.menu-header{gap:0;transition:padding .36s cubic-bezier(.22,1,.36,1)}.menu-group+.menu-group{margin-top:8px}.submenu>li.is-selected{position:relative}.submenu>li.is-selected:before{background:var(--color-brand-primary,#f05223);border-radius:2px;bottom:6px;content:\"\";left:-9.5px;position:absolute;top:6px;width:2px}.menu-toggle{background:var(--color-surface-body,#fff);border:1px solid var(--color-line-general,#e5e6e6);border-radius:999px;color:var(--color-icon-primary,#6c6e6e);cursor:pointer;height:32px;margin-left:auto;padding:0;transition:color .16s cubic-bezier(.4,0,.2,1),border-color .16s cubic-bezier(.4,0,.2,1),background-color .16s cubic-bezier(.4,0,.2,1);width:32px}.menu-toggle:hover{border-color:var(--color-brand-primary,#f05223);color:var(--color-brand-primary,#f05223)}.menu-toggle:focus-visible{outline:2px solid var(--color-states-bg-focus,#1355b4);outline-offset:2px}.menu-shell--collapsed .menu-toggle{margin:16px 0 0}.menu-shell--collapsed .menu-item{margin-inline:0;padding-block:10px}.menu-shell--collapsed .item-icon{height:20px;width:20px}.menu-shell--collapsed .item-icon i{font-size:20px}.menu-shell--expanded .user-info{margin-inline:0}.menu-shell--collapsed .menu-footer{padding-inline:18px}.menu-shell--collapsed .menu-nav{scrollbar-width:none}.menu-shell--collapsed .menu-nav::-webkit-scrollbar{display:none}.menu-copy--hidden.menu-item-label--wrap{white-space:nowrap}.menu-nav{padding-bottom:16px;scrollbar-color:var(--color-line-general-strong,#bfc0c0) transparent;scrollbar-width:thin;transition:padding .36s cubic-bezier(.22,1,.36,1)}.menu-shell--expanded .menu-nav{margin-inline:-20px;padding-left:20px;padding-right:14px;scrollbar-gutter:stable}.menu-nav::-webkit-scrollbar{width:6px}.menu-nav::-webkit-scrollbar-track{background:transparent}.menu-nav::-webkit-scrollbar-thumb{background:var(--color-line-general-strong,#bfc0c0);border-radius:999px}.menu-nav::-webkit-scrollbar-thumb:hover{background:var(--color-text-disabled,#949595)}.item-icon{height:16px;width:16px}.menu-nav .menu-item,.menu-nav .menu-item>div,.menu-nav .submenu-item,.menu-nav .submenu-item-branch-caret,.menu-nav .submenu-item-branch-content{align-items:flex-start}.submenu-item .submenu-item-label{font-size:var(--sula-menu-sub-item-font-size);line-height:1.25rem}.menu-nav .item-icon,.menu-nav .menu-item-caret,.menu-nav .submenu-item-branch-caret{height:1.25rem}.menu-shell--expanded .menu-item .item-icon{width:18px}.menu-shell--expanded .menu-item .item-icon i{font-size:18px}.menu-footer{transition:padding .36s cubic-bezier(.22,1,.36,1)}.menu-brand-image{flex:0 0 auto;transition:margin .32s cubic-bezier(.22,1,.36,1),transform .32s cubic-bezier(.22,1,.36,1)}.menu-copy{display:block;max-width:220px;min-width:0;opacity:1;overflow:hidden;transform:translateX(0);transform-origin:left center;transition:max-width .32s cubic-bezier(.22,1,.36,1),opacity .2s cubic-bezier(.4,0,.2,1),transform .32s cubic-bezier(.22,1,.36,1);white-space:nowrap}.menu-copy--visible{max-width:100%;opacity:1;pointer-events:auto;transform:translateX(0)}.menu-copy--hidden{max-width:0;opacity:0;pointer-events:none;transform:translateX(-10px)}.menu-title{flex:1 1 auto;min-width:0}.menu-title.menu-copy--visible{max-width:100%}.menu-item-label{flex:1 1 auto;font-size:var(--sula-menu-main-item-font-size);line-height:var(--sula-menu-main-item-line-height)}.menu-item-label--truncate{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.menu-item-label--wrap{-webkit-box-orient:vertical;-webkit-line-clamp:var(--sula-menu-main-item-max-lines);line-clamp:var(--sula-menu-main-item-max-lines);display:-webkit-box;overflow:hidden;overflow-wrap:anywhere;text-overflow:clip;white-space:normal;word-break:break-word}.menu-item{margin-inline:-8px;padding-block:var(--sula-menu-main-item-padding-block);transition:background-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1),border-color .24s cubic-bezier(.22,1,.36,1),margin-left .24s cubic-bezier(.22,1,.36,1),padding .32s cubic-bezier(.22,1,.36,1)}.menu-item-caret{max-width:16px;opacity:1;overflow:hidden;transition:transform .28s cubic-bezier(.22,1,.36,1),opacity .18s cubic-bezier(.4,0,.2,1),max-width .28s cubic-bezier(.22,1,.36,1),margin-left .28s cubic-bezier(.22,1,.36,1)}.menu-item-caret--visible{margin-left:12px;max-width:16px;opacity:1}.menu-item-caret--hidden{margin-left:0;max-width:0;opacity:0;transform:translateX(-8px)}.menu-item-caret--expanded{transform:rotate(180deg)}.submenu{max-height:0;opacity:0;overflow:hidden;pointer-events:none;transform:translateY(-6px);transform-origin:top left;transition:max-height .26s cubic-bezier(.22,1,.36,1),opacity .12s cubic-bezier(.4,0,.2,1),transform .18s cubic-bezier(.22,1,.36,1);will-change:max-height,opacity,transform}.submenu--expanded{max-height:999px;opacity:1;pointer-events:auto;transform:translateY(0)}.submenu-item{transition:background-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1),transform .24s cubic-bezier(.22,1,.36,1)}.submenu-item--branch{transition:background-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1),border-color .24s cubic-bezier(.22,1,.36,1),margin-left .24s cubic-bezier(.22,1,.36,1)}.submenu-item-branch-content{min-width:0}.submenu-branch{transform-origin:top left}.submenu-grandchild-item{transition:background-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1),transform .24s cubic-bezier(.22,1,.36,1)}.submenu-grandchild-label{display:block}.menu-header--drilldown{animation:drill-header-in .22s cubic-bezier(.4,0,.2,1)}.identity-strip{align-items:center;background:transparent;border:none;border-radius:8px;color:inherit;cursor:pointer;display:flex;flex:1 1 auto;font:inherit;margin:0 0 0 -8px;min-width:0;padding:6px 8px;text-align:left;transition:background-color .16s cubic-bezier(.4,0,.2,1)}.identity-row{margin-bottom:12px}.identity-strip:hover{background:var(--color-surface-on-body,#f3f4f4)}.identity-image{border-radius:5px;flex:none;height:20px;margin-right:8px;overflow:hidden;width:20px}.identity-image img{display:block;height:100%;width:100%}.identity-label{color:var(--color-text-secondary,#6c6e6e);font-size:13px;font-weight:500;min-width:0}.breadcrumb-row{margin-bottom:10px;min-width:0;position:relative}.back-btn,.breadcrumb-row{align-items:center;display:flex}.back-btn{background:transparent;border:none;border-radius:8px;cursor:pointer;flex:none;height:28px;justify-content:center;margin:0 2px 0 -6px;padding:0;transition:background-color .16s cubic-bezier(.4,0,.2,1);width:28px}.back-btn:hover{background:var(--color-surface-on-body,#f3f4f4)}.crumb-trail{flex:1 1 auto;gap:2px;min-width:0}.crumb-btn{background:transparent;border:none;border-radius:6px;color:var(--color-text-secondary,#6c6e6e);cursor:pointer;flex:0 1 auto;font:inherit;font-size:12px;font-weight:500;max-width:120px;min-width:28px;overflow:hidden;padding:3px 4px;text-align:left;text-overflow:ellipsis;transition:background-color .16s cubic-bezier(.4,0,.2,1),color .16s cubic-bezier(.4,0,.2,1);white-space:nowrap}.crumb-btn:hover{background:var(--color-surface-on-body,#f3f4f4);color:var(--color-text-primary,#313333)}.crumb-btn--ellipsis{align-items:center;display:flex;flex:none;max-width:none;padding:3px 5px}.crumb-sep{color:var(--color-text-disabled,#949595);flex:none}.crumb-dropdown{background:var(--color-surface-body,#fff);border:1px solid var(--color-line-general,#e5e6e6);border-radius:10px;box-shadow:0 14px 32px rgba(15,23,42,.16);display:flex;flex-direction:column;gap:1px;max-width:230px;min-width:172px;padding:6px;position:absolute;z-index:30}.crumb-dropdown-item{align-items:center;background:transparent;border:none;border-radius:6px;color:var(--color-text-primary,#313333);cursor:pointer;display:flex;font:inherit;font-size:13px;gap:8px;overflow:hidden;padding:7px 8px;text-align:left;white-space:nowrap}.crumb-dropdown-item:hover{background:var(--color-surface-on-body,#f3f4f4)}.context-row{min-width:0}.context-icon{height:20px;margin-right:8px;width:20px}.context-title{min-width:0}.menu-panel--forward{animation:drill-slide-forward .26s cubic-bezier(.22,1,.36,1)}.menu-panel--back{animation:drill-slide-back .26s cubic-bezier(.22,1,.36,1)}@keyframes drill-header-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes drill-slide-forward{0%{opacity:0;transform:translateX(20px)}to{opacity:1;transform:translateX(0)}}@keyframes drill-slide-back{0%{opacity:0;transform:translateX(-20px)}to{opacity:1;transform:translateX(0)}}sula-icon{align-items:center;display:inline-flex;flex:none;justify-content:center;line-height:1}sula-icon>i{display:block;line-height:1}.item-icon>.menu-item-image,.item-icon>sula-icon{flex:none}.menu-item-image{display:block;flex:none;-o-object-fit:contain;object-fit:contain;transition:opacity .2s cubic-bezier(.4,0,.2,1)}.menu-item-image--sm{height:.875rem;width:.875rem}.menu-item-image--md{height:1rem;width:1rem}.menu-item-image--lg{height:1.25rem;width:1.25rem}.menu-item-image.is-faded{opacity:.5}.item-icon>.menu-item-image{aspect-ratio:1/1;height:auto;width:100%}.menu-item-image--mask{background-color:currentColor;-webkit-mask:var(--menu-item-image) center/contain no-repeat;mask:var(--menu-item-image) center/contain no-repeat}.user-copy{display:flex;flex-direction:column;min-width:0;overflow:hidden;transition:max-width .32s cubic-bezier(.22,1,.36,1),opacity .2s cubic-bezier(.4,0,.2,1)}.user-copy--visible{max-width:100%;opacity:1;transition:max-width .32s cubic-bezier(.22,1,.36,1),opacity .2s cubic-bezier(.4,0,.2,1) .12s}.user-copy--hidden{max-width:0;opacity:0}.user-avatar img{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.profile-popover{background:var(--color-surface-body);border:1px solid var(--color-line-general);border-radius:12px;box-shadow:0 12px 32px rgba(15,23,42,.12),0 2px 8px rgba(15,23,42,.06);box-sizing:border-box;opacity:0;outline:none;position:fixed;transform:translateY(6px) scale(.98);transform-origin:bottom left;transition:opacity .16s cubic-bezier(.4,0,.2,1),transform .2s cubic-bezier(.22,1,.36,1),visibility 0s linear .2s;visibility:hidden;width:256px;z-index:60}.profile-popover--side{transform:translateX(-6px) scale(.98)}.profile-popover--open{opacity:1;transform:none;transition:opacity .16s cubic-bezier(.4,0,.2,1),transform .2s cubic-bezier(.22,1,.36,1);visibility:visible}@media (prefers-reduced-motion:reduce){.menu-brand-image,.menu-copy,.menu-footer,.menu-header,.menu-header--drilldown,.menu-item,.menu-item-caret,.menu-nav,.menu-panel--back,.menu-panel--forward,.menu-shell,.menu-toggle,.submenu,.submenu-item,:host{animation:none}.menu-item-caret,.profile-popover,.submenu-grandchild-item,.submenu-item{transition:none}}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:300;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Light.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:300;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-LightItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:400;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Regular.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:400;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Italic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:500;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Medium.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:500;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-MediumItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:600;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-SemiBold.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:600;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-SemiBoldItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:700;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Bold.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:700;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-BoldItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:800;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-ExtraBold.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:800;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-ExtraBoldItalic.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:normal;font-weight:900;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-Black.ttf) format(\"truetype\")}@font-face{font-display:swap;font-family:Figtree;font-style:italic;font-weight:900;src:local(\"Figtree\"),url(@sula-tech/tailwind-css-plugin/assets/fonts/Figtree-BlackItalic.ttf) format(\"truetype\")}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#012b15;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#330d00;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#402705;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#401204;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#402301;--color-gray-50:#fff;--color-gray-100:#f3f4f4;--color-gray-200:#e5e6e6;--color-gray-300:#bfc0c0;--color-gray-400:#acaeae;--color-gray-500:#949595;--color-gray-600:#737575;--color-gray-700:#6c6e6e;--color-gray-800:#313333;--color-gray-900:#272929;--color-gray-950:#191d1d;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#071e40;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:rgba(25,29,29,.02);--color-black-opacity-100:rgba(25,29,29,.05);--color-black-opacity-200:rgba(25,29,29,.11);--color-black-opacity-300:rgba(25,29,29,.28);--color-black-opacity-400:rgba(25,29,29,.36);--color-black-opacity-500:rgba(25,29,29,.44);--color-black-opacity-600:rgba(25,29,29,.62);--color-black-opacity-700:rgba(25,29,29,.64);--color-black-opacity-800:rgba(25,29,29,.72);--color-black-opacity-900:rgba(25,29,29,.8);--color-black-opacity-950:rgba(25,29,29,.96);--color-shadow-opacity-50:rgba(0,0,0,.04);--color-shadow-opacity-100:rgba(0,0,0,.06);--color-shadow-opacity-200:rgba(0,0,0,.12);--color-shadow-opacity-300:rgba(0,0,0,.2);--color-shadow-opacity-400:rgba(0,0,0,.32);--color-shadow-opacity-500:rgba(0,0,0,.5);--color-shadow-opacity-600:rgba(0,0,0,.55);--color-shadow-opacity-700:rgba(0,0,0,.64);--color-shadow-opacity-800:rgba(0,0,0,.73);--color-shadow-opacity-900:rgba(0,0,0,.8);--color-shadow-opacity-950:rgba(0,0,0,.91);--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f3f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#313333;--color-text-secondary:#6c6e6e;--color-text-disabled:#949595;--color-text-link:#1355b4;--color-states-empty-bg-hover:rgba(25,29,29,.05);--color-states-empty-bg-pressed:rgba(25,29,29,.11);--color-states-bg-disabled:rgba(25,29,29,.02);--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e5e6e6;--color-states-negative-pressed:#bfc0c0;--color-icon-primary:#6c6e6e;--color-icon-secondary:#fff;--color-icon-tertiary:#b30404;--color-icon-disabled:#acaeae;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f3f4f4;--color-neutral-neutral-3:#acaeae;--color-neutral-neutral-4:#949595;--color-neutral-neutral-5:#737575;--color-neutral-neutral-6:#6c6e6e;--color-neutral-neutral-7:#313333;--color-neutral-neutral-8:#272929;--color-negative-negative-1:#fff;--color-negative-negative-2:#313333;--color-opacity-body:#fffc;--color-opacity-on-body:rgba(25,29,29,.02);--color-opacity-overlay:rgba(25,29,29,.62);--color-opacity-on-overlay:#ffffff1a;--color-opacity-toast:#ffffff45;--color-line-input:#949595;--color-line-general-strong:#bfc0c0;--color-line-general:#e5e6e6;--color-line-hair:rgba(25,29,29,.05);--color-box-shadow-body:#fff;--color-box-shadow-shadow-color-1:rgba(0,0,0,.04);--color-box-shadow-shadow-color-2:rgba(0,0,0,.06)}.static{position:static}.z-50{z-index:50}.mb-16{margin-bottom:1rem}.mb-24{margin-bottom:1.5rem}.mb-40{margin-bottom:2.5rem}.ml-8{margin-left:.5rem}.ml-\\[24px\\]{margin-left:24px}.ml-\\[8px\\]{margin-left:8px}.mr-6{margin-right:1.5rem}.mt-8{margin-top:.5rem}.inline{display:inline}.h-9{height:2.25rem}.h-full{height:100%}.max-h-10{max-height:2.5rem}.w-9{width:2.25rem}.w-full{width:100%}.min-w-0{min-width:0}.max-w-10{max-width:2.5rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{user-select:none}.resize{resize:both}.list-none{list-style-type:none}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-8{gap:.5rem}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded-full{border-radius:9999px}.rounded-xs{border-radius:.5rem}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-t{border-top-width:1px}.border-line-general{border-color:var(--color-line-general)}.bg-brand-primary{background-color:var(--color-brand-primary)}.bg-states-empty-bg-hover{background-color:var(--color-states-empty-bg-hover)}.bg-surface-body{background-color:var(--color-surface-body)}.p-8{padding:.5rem}.px-0{padding-left:0;padding-right:0}.px-12{padding-left:.75rem;padding-right:.75rem}.px-8{padding-left:.5rem;padding-right:.5rem}.py-8{padding-bottom:.5rem;padding-top:.5rem}.pb-24{padding-bottom:1.5rem}.pl-8{padding-left:.5rem}.pr-8{padding-right:.5rem}.pt-12{padding-top:.75rem}.text-left{text-align:left}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.leading-7{line-height:1.75rem}.leading-tight{line-height:1.25}.text-brand-primary{color:var(--color-brand-primary)}.text-icon-disabled{color:var(--color-icon-disabled)}.text-icon-primary{color:var(--color-icon-primary)}.text-negative-negative-1{color:var(--color-negative-negative-1)}.text-text-disabled{color:var(--color-text-disabled)}.text-text-primary{color:var(--color-text-primary)}.text-text-secondary{color:var(--color-text-secondary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\\:bg-states-empty-bg-hover:hover{background-color:var(--color-states-empty-bg-hover)}";
|
|
8
|
+
|
|
9
|
+
const SulaWorkbenchMenu$1 = /*@__PURE__*/ proxyCustomElement(class SulaWorkbenchMenu extends H {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
this.__attachShadow();
|
|
14
|
+
this.itemSelected = createEvent(this, "itemSelected");
|
|
15
|
+
this.itemClicked = createEvent(this, "itemClicked");
|
|
16
|
+
this.levelChanged = createEvent(this, "levelChanged");
|
|
17
|
+
this.profileClicked = createEvent(this, "profileClicked");
|
|
18
|
+
this.profileItemClicked = createEvent(this, "profileItemClicked");
|
|
19
|
+
this.profileSwitchChanged = createEvent(this, "profileSwitchChanged");
|
|
20
|
+
this.menuToggled = createEvent(this, "menuToggled");
|
|
21
|
+
/**
|
|
22
|
+
* Menu title
|
|
23
|
+
*/
|
|
24
|
+
this.menuTitle = '';
|
|
25
|
+
/**
|
|
26
|
+
* Menu image
|
|
27
|
+
*/
|
|
28
|
+
this.image = '';
|
|
29
|
+
/**
|
|
30
|
+
* Menu width in expanded state. Use a CSS length that does not depend on the
|
|
31
|
+
* host width, for example: 256px, 20rem or clamp(16rem, 25vw, 24rem).
|
|
32
|
+
*/
|
|
33
|
+
this.width = '';
|
|
34
|
+
/**
|
|
35
|
+
* Density applied to menu items.
|
|
36
|
+
*/
|
|
37
|
+
this.density = SulaMenuDensity.Default;
|
|
38
|
+
/**
|
|
39
|
+
* Overflow behavior for item labels.
|
|
40
|
+
*/
|
|
41
|
+
this.labelOverflow = SulaMenuLabelOverflow.Wrap;
|
|
42
|
+
/**
|
|
43
|
+
* Depth (1-based) from which items with children open a drill-down panel instead of expanding in place.
|
|
44
|
+
* With the default of 3, the first two levels expand inline and deeper branches drill down.
|
|
45
|
+
*/
|
|
46
|
+
this.drilldownLevel = 3;
|
|
47
|
+
/**
|
|
48
|
+
* Menu items. Each item may use `icon` (icon font class) or `image` (URL or data URI of an image or SVG).
|
|
49
|
+
*/
|
|
50
|
+
this.items = [];
|
|
51
|
+
/**
|
|
52
|
+
* Icon used for items without `icon` or `image`. Use an empty string to show no icon.
|
|
53
|
+
*/
|
|
54
|
+
this.defaultIcon = 'ph ph-dot-outline';
|
|
55
|
+
/**
|
|
56
|
+
* Options of the profile popover. Use `divider` for a separator and `hasSwitch` + `active` for a toggle row.
|
|
57
|
+
*/
|
|
58
|
+
this.profileItems = [];
|
|
59
|
+
this.collapsed = false;
|
|
60
|
+
this.previewExpanded = false;
|
|
61
|
+
this.stack = [];
|
|
62
|
+
this.direction = 'forward';
|
|
63
|
+
this.selectedPath = [];
|
|
64
|
+
this.crumbMenu = { open: false, left: 0, top: 0 };
|
|
65
|
+
this.profileOpen = false;
|
|
66
|
+
this.hovering = false;
|
|
67
|
+
}
|
|
68
|
+
get normalizedWidth() {
|
|
69
|
+
var _a;
|
|
70
|
+
const value = (_a = this.width) === null || _a === void 0 ? void 0 : _a.trim();
|
|
71
|
+
return value ? value : undefined;
|
|
72
|
+
}
|
|
73
|
+
get hostStyleVariables() {
|
|
74
|
+
return Object.assign({}, (this.normalizedWidth ? { '--sula-menu-width': this.normalizedWidth } : {}));
|
|
75
|
+
}
|
|
76
|
+
componentWillLoad() {
|
|
77
|
+
this.syncWithItems(this.items);
|
|
78
|
+
}
|
|
79
|
+
syncWithItems(items) {
|
|
80
|
+
const nextSelected = this.findSelectedIds(items);
|
|
81
|
+
if (nextSelected) {
|
|
82
|
+
this.selectedPath = nextSelected;
|
|
83
|
+
}
|
|
84
|
+
else if (!this.selectedPath.length || !this.isStillSelectable(items, this.selectedPath)) {
|
|
85
|
+
this.selectedPath = [];
|
|
86
|
+
}
|
|
87
|
+
this.stack = this.rebuildStack(items, this.stack);
|
|
88
|
+
if (this.drillPath)
|
|
89
|
+
this.applyDrillPath(this.drillPath);
|
|
90
|
+
}
|
|
91
|
+
syncDrillPath(path) {
|
|
92
|
+
if (path)
|
|
93
|
+
this.applyDrillPath(path);
|
|
94
|
+
}
|
|
95
|
+
applyDrillPath(path) {
|
|
96
|
+
var _a;
|
|
97
|
+
const next = [];
|
|
98
|
+
let level = this.items;
|
|
99
|
+
for (const id of path) {
|
|
100
|
+
const match = this.getVisibleItems(level).find(item => item.id === id);
|
|
101
|
+
if (!match)
|
|
102
|
+
break;
|
|
103
|
+
next.push(match);
|
|
104
|
+
level = (_a = match.children) !== null && _a !== void 0 ? _a : [];
|
|
105
|
+
}
|
|
106
|
+
const same = next.length === this.stack.length && next.every((item, index) => item.id === this.stack[index].id);
|
|
107
|
+
if (same)
|
|
108
|
+
return;
|
|
109
|
+
this.direction = next.length < this.stack.length ? 'back' : 'forward';
|
|
110
|
+
this.stack = next;
|
|
111
|
+
}
|
|
112
|
+
componentDidRender() {
|
|
113
|
+
this.positionProfile();
|
|
114
|
+
}
|
|
115
|
+
onDocumentClick(event) {
|
|
116
|
+
const path = event.composedPath();
|
|
117
|
+
if (this.profileOpen && !path.includes(this.profileEl) && !path.includes(this.userInfoEl))
|
|
118
|
+
this.closeProfile();
|
|
119
|
+
if (!this.crumbMenu.open)
|
|
120
|
+
return;
|
|
121
|
+
if (path.includes(this.crumbEllipsisEl) || path.includes(this.crumbDropdownEl))
|
|
122
|
+
return;
|
|
123
|
+
this.closeCrumbMenu();
|
|
124
|
+
}
|
|
125
|
+
onDocumentKeydown(event) {
|
|
126
|
+
var _a;
|
|
127
|
+
if (event.key !== 'Escape')
|
|
128
|
+
return;
|
|
129
|
+
this.closeCrumbMenu();
|
|
130
|
+
if (this.profileOpen) {
|
|
131
|
+
this.closeProfile();
|
|
132
|
+
(_a = this.userInfoEl) === null || _a === void 0 ? void 0 : _a.focus();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
onWindowResize() {
|
|
136
|
+
this.positionProfile();
|
|
137
|
+
}
|
|
138
|
+
getVisibleItems(items) {
|
|
139
|
+
var _a;
|
|
140
|
+
return (_a = items === null || items === void 0 ? void 0 : items.filter(item => !item.hidden)) !== null && _a !== void 0 ? _a : [];
|
|
141
|
+
}
|
|
142
|
+
hasVisibleChildren(item) {
|
|
143
|
+
return this.getVisibleItems(item.children).length > 0;
|
|
144
|
+
}
|
|
145
|
+
isDrilled() {
|
|
146
|
+
return this.stack.length >= this.drilldownLevel;
|
|
147
|
+
}
|
|
148
|
+
findSelectedIds(items, trail = []) {
|
|
149
|
+
for (const item of this.getVisibleItems(items)) {
|
|
150
|
+
if (!this.hasVisibleChildren(item)) {
|
|
151
|
+
if (item.selected)
|
|
152
|
+
return [...trail, item.id];
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
const nested = this.findSelectedIds(item.children, [...trail, item.id]);
|
|
156
|
+
if (nested)
|
|
157
|
+
return nested;
|
|
158
|
+
}
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
isStillSelectable(items, path) {
|
|
162
|
+
const found = this.findPath(items, path[path.length - 1]);
|
|
163
|
+
return !!found && !this.hasVisibleChildren(found[found.length - 1]);
|
|
164
|
+
}
|
|
165
|
+
toggleExpanded(items, id) {
|
|
166
|
+
return items.map(item => {
|
|
167
|
+
if (item.id === id)
|
|
168
|
+
return Object.assign(Object.assign({}, item), { expanded: !item.expanded });
|
|
169
|
+
if (!item.children)
|
|
170
|
+
return item;
|
|
171
|
+
return Object.assign(Object.assign({}, item), { children: this.toggleExpanded(item.children, id) });
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
findPath(items, id, trail = []) {
|
|
175
|
+
var _a;
|
|
176
|
+
for (const item of this.getVisibleItems(items)) {
|
|
177
|
+
const next = [...trail, item];
|
|
178
|
+
if (item.id === id)
|
|
179
|
+
return next;
|
|
180
|
+
const nested = this.findPath((_a = item.children) !== null && _a !== void 0 ? _a : [], id, next);
|
|
181
|
+
if (nested)
|
|
182
|
+
return nested;
|
|
183
|
+
}
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
rebuildStack(items, previous) {
|
|
187
|
+
var _a;
|
|
188
|
+
const next = [];
|
|
189
|
+
let level = items;
|
|
190
|
+
for (const ancestor of previous) {
|
|
191
|
+
const match = this.getVisibleItems(level).find(item => item.id === ancestor.id);
|
|
192
|
+
if (!match)
|
|
193
|
+
break;
|
|
194
|
+
next.push(match);
|
|
195
|
+
level = (_a = match.children) !== null && _a !== void 0 ? _a : [];
|
|
196
|
+
}
|
|
197
|
+
return next;
|
|
198
|
+
}
|
|
199
|
+
isActive(item, branch) {
|
|
200
|
+
if (branch)
|
|
201
|
+
return this.selectedPath.includes(item.id);
|
|
202
|
+
return this.selectedPath.length > 0 && this.selectedPath[this.selectedPath.length - 1] === item.id;
|
|
203
|
+
}
|
|
204
|
+
isFaded(item, active) {
|
|
205
|
+
return !!item.disabled && !active;
|
|
206
|
+
}
|
|
207
|
+
emitLevel() {
|
|
208
|
+
this.levelChanged.emit(this.stack.map(item => item.id));
|
|
209
|
+
}
|
|
210
|
+
toggleInline(id) {
|
|
211
|
+
this.items = this.toggleExpanded(this.items, id);
|
|
212
|
+
}
|
|
213
|
+
enterDrill(item) {
|
|
214
|
+
var _a;
|
|
215
|
+
const path = (_a = this.findPath(this.items, item.id)) !== null && _a !== void 0 ? _a : [item];
|
|
216
|
+
this.direction = 'forward';
|
|
217
|
+
this.stack = path;
|
|
218
|
+
this.closeCrumbMenu();
|
|
219
|
+
this.emitLevel();
|
|
220
|
+
}
|
|
221
|
+
markSelected(items, id) {
|
|
222
|
+
return items.map(item => (Object.assign(Object.assign(Object.assign({}, item), { selected: item.id === id }), (item.children ? { children: this.markSelected(item.children, id) } : {}))));
|
|
223
|
+
}
|
|
224
|
+
// Selection lives on the items (like `expanded`), so re-assigning items when a branch is
|
|
225
|
+
// toggled keeps the user's choice instead of falling back to the initially selected item.
|
|
226
|
+
selectItem(item) {
|
|
227
|
+
var _a;
|
|
228
|
+
const path = (_a = this.findPath(this.items, item.id)) !== null && _a !== void 0 ? _a : [item];
|
|
229
|
+
this.items = this.markSelected(this.items, item.id);
|
|
230
|
+
this.selectedPath = path.map(p => p.id);
|
|
231
|
+
this.itemSelected.emit(item);
|
|
232
|
+
}
|
|
233
|
+
handleRowClick(item, depth) {
|
|
234
|
+
if (item.disabled)
|
|
235
|
+
return;
|
|
236
|
+
this.itemClicked.emit(item);
|
|
237
|
+
if (this.hasVisibleChildren(item)) {
|
|
238
|
+
if (depth < this.drilldownLevel) {
|
|
239
|
+
this.toggleInline(item.id);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
this.enterDrill(item);
|
|
243
|
+
}
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
this.selectItem(item);
|
|
247
|
+
}
|
|
248
|
+
goToDepth(index) {
|
|
249
|
+
this.direction = 'back';
|
|
250
|
+
this.stack = index < 0 ? [] : this.stack.slice(0, index + 1);
|
|
251
|
+
this.closeCrumbMenu();
|
|
252
|
+
this.emitLevel();
|
|
253
|
+
}
|
|
254
|
+
toggleCrumbMenu(event) {
|
|
255
|
+
if (this.crumbMenu.open) {
|
|
256
|
+
this.closeCrumbMenu();
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const button = event.currentTarget;
|
|
260
|
+
this.crumbMenu = {
|
|
261
|
+
open: true,
|
|
262
|
+
left: button.offsetLeft,
|
|
263
|
+
top: button.offsetTop + button.offsetHeight + 6,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
closeCrumbMenu() {
|
|
267
|
+
if (this.crumbMenu.open)
|
|
268
|
+
this.crumbMenu = Object.assign(Object.assign({}, this.crumbMenu), { open: false });
|
|
269
|
+
}
|
|
270
|
+
toggleMenu() {
|
|
271
|
+
this.closeProfile();
|
|
272
|
+
if (this.collapsed) {
|
|
273
|
+
this.collapsed = false;
|
|
274
|
+
this.previewExpanded = false;
|
|
275
|
+
this.menuToggled.emit(true);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
this.collapsed = true;
|
|
279
|
+
this.menuToggled.emit(false);
|
|
280
|
+
this.previewExpanded = false;
|
|
281
|
+
}
|
|
282
|
+
handleMenuMouseEnter() {
|
|
283
|
+
this.hovering = true;
|
|
284
|
+
if (this.collapsed)
|
|
285
|
+
this.previewExpanded = true;
|
|
286
|
+
}
|
|
287
|
+
// While the popover is open the preview stays expanded, so the popover keeps its anchor.
|
|
288
|
+
handleMenuMouseLeave() {
|
|
289
|
+
this.hovering = false;
|
|
290
|
+
if (this.collapsed && !this.profileOpen)
|
|
291
|
+
this.previewExpanded = false;
|
|
292
|
+
}
|
|
293
|
+
toggleProfile() {
|
|
294
|
+
if (this.profileOpen) {
|
|
295
|
+
this.closeProfile();
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (this.profileClicked.emit(this.user).defaultPrevented)
|
|
299
|
+
return;
|
|
300
|
+
this.profileOpen = true;
|
|
301
|
+
requestAnimationFrame(() => { var _a; return (_a = this.profileEl) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
302
|
+
}
|
|
303
|
+
closeProfile() {
|
|
304
|
+
if (!this.profileOpen)
|
|
305
|
+
return;
|
|
306
|
+
this.profileOpen = false;
|
|
307
|
+
if (this.collapsed && !this.hovering)
|
|
308
|
+
this.previewExpanded = false;
|
|
309
|
+
}
|
|
310
|
+
// Fixed position, so ancestors with overflow hidden do not clip the popover.
|
|
311
|
+
positionProfile() {
|
|
312
|
+
if (!this.profileOpen || !this.profileEl || !this.userInfoEl || !this.shellEl)
|
|
313
|
+
return;
|
|
314
|
+
const gap = 8;
|
|
315
|
+
const inset = 12;
|
|
316
|
+
const anchor = this.userInfoEl.getBoundingClientRect();
|
|
317
|
+
const shell = this.shellEl.getBoundingClientRect();
|
|
318
|
+
const style = this.profileEl.style;
|
|
319
|
+
if (!this.collapsed || this.previewExpanded) {
|
|
320
|
+
style.left = `${shell.left + inset}px`;
|
|
321
|
+
style.width = `${shell.width - inset * 2}px`;
|
|
322
|
+
style.bottom = `${window.innerHeight - anchor.top + gap}px`;
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
style.left = `${shell.right + gap}px`;
|
|
326
|
+
style.width = '';
|
|
327
|
+
style.bottom = `${window.innerHeight - anchor.bottom}px`;
|
|
328
|
+
}
|
|
329
|
+
// Inner events are composed; stopping them avoids clashing with this menu's own itemClicked.
|
|
330
|
+
handleProfileItemClicked(event) {
|
|
331
|
+
event.stopPropagation();
|
|
332
|
+
this.closeProfile();
|
|
333
|
+
this.profileItemClicked.emit(event.detail);
|
|
334
|
+
}
|
|
335
|
+
handleProfileSwitchChanged(event) {
|
|
336
|
+
event.stopPropagation();
|
|
337
|
+
const { item } = event.detail;
|
|
338
|
+
this.profileItems = this.profileItems.map(current => (current.id === item.id ? item : current));
|
|
339
|
+
this.profileSwitchChanged.emit(event.detail);
|
|
340
|
+
}
|
|
341
|
+
renderProfilePopover(expandedView) {
|
|
342
|
+
return (h("div", { part: "profile-popover", role: "dialog", "aria-label": `Perfil de ${this.user.name}`, "aria-hidden": String(!this.profileOpen), tabIndex: -1, ref: el => (this.profileEl = el), class: {
|
|
343
|
+
'profile-popover': true,
|
|
344
|
+
'profile-popover--open': this.profileOpen,
|
|
345
|
+
'profile-popover--side': !expandedView,
|
|
346
|
+
} }, h("sula-profile-menu", { user: this.user, items: this.profileItems, onItemClicked: event => this.handleProfileItemClicked(event), onSwitchChanged: event => this.handleProfileSwitchChanged(event) }, h("slot", { name: "profile-content" }))));
|
|
347
|
+
}
|
|
348
|
+
isValidIcon(icon) {
|
|
349
|
+
return !!icon && /ph-[a-z]/.test(icon);
|
|
350
|
+
}
|
|
351
|
+
isSvg(image) {
|
|
352
|
+
return /^data:image\/svg\+xml/i.test(image) || /\.svg(\?|#|$)/i.test(image);
|
|
353
|
+
}
|
|
354
|
+
iconOf(item) {
|
|
355
|
+
return this.isValidIcon(item.icon) ? item.icon : this.defaultIcon;
|
|
356
|
+
}
|
|
357
|
+
hasIcon(item) {
|
|
358
|
+
return !!item.image || this.isValidIcon(this.iconOf(item));
|
|
359
|
+
}
|
|
360
|
+
renderItemIcon(item, customClass, size, faded = false) {
|
|
361
|
+
if (!this.hasIcon(item))
|
|
362
|
+
return null;
|
|
363
|
+
if (item.image && this.isSvg(item.image)) {
|
|
364
|
+
// SVGs are painted with currentColor through a mask, so they follow the same state colors as the icon font.
|
|
365
|
+
return (h("span", { class: `menu-item-image menu-item-image--mask menu-item-image--${size} ${customClass}`, style: { '--menu-item-image': `url("${item.image.replace(/"/g, '%22')}")` }, "aria-hidden": "true" }));
|
|
366
|
+
}
|
|
367
|
+
if (item.image) {
|
|
368
|
+
return (h("img", { class: { 'menu-item-image': true, [`menu-item-image--${size}`]: true, 'is-faded': faded }, src: item.image, alt: "" }));
|
|
369
|
+
}
|
|
370
|
+
return h("sula-icon", { icon: this.iconOf(item), customClass: customClass });
|
|
371
|
+
}
|
|
372
|
+
getInitials(name) {
|
|
373
|
+
return name
|
|
374
|
+
.split(' ')
|
|
375
|
+
.filter(Boolean)
|
|
376
|
+
.slice(0, 2)
|
|
377
|
+
.map(part => part[0].toUpperCase())
|
|
378
|
+
.join('');
|
|
379
|
+
}
|
|
380
|
+
renderUserInfo(expandedView) {
|
|
381
|
+
const user = this.user;
|
|
382
|
+
return (h("button", { type: "button", class: {
|
|
383
|
+
'user-info flex min-w-0 cursor-pointer items-center rounded-xs p-8 text-left hover:bg-states-empty-bg-hover': true,
|
|
384
|
+
'user-info--active bg-states-empty-bg-hover': this.profileOpen,
|
|
385
|
+
'w-full': expandedView,
|
|
386
|
+
}, title: `Ver perfil de ${user.name}`, "aria-label": `Ver perfil de ${user.name}`, "aria-haspopup": "dialog", "aria-expanded": String(this.profileOpen), ref: el => (this.userInfoEl = el), onClick: () => this.toggleProfile() }, h("span", { class: "user-avatar flex h-9 w-9 flex-none items-center justify-center overflow-hidden rounded-full bg-brand-primary text-sm font-semibold text-negative-negative-1" }, user.photo ? h("img", { src: user.photo, alt: user.name }) : this.getInitials(user.name)), h("span", { "aria-hidden": !expandedView, class: {
|
|
387
|
+
'user-copy': true,
|
|
388
|
+
'ml-8': true,
|
|
389
|
+
'user-copy--visible': expandedView,
|
|
390
|
+
'user-copy--hidden': !expandedView,
|
|
391
|
+
} }, h("span", { part: "user-name", class: "user-name truncate text-sm font-semibold text-text-primary" }, user.name), user.email && h("span", { part: "user-email", class: "user-email truncate text-xs text-text-secondary" }, user.email))));
|
|
392
|
+
}
|
|
393
|
+
getIconClass(active, faded, size) {
|
|
394
|
+
if (faded)
|
|
395
|
+
return `text-icon-disabled ${size}`;
|
|
396
|
+
if (active)
|
|
397
|
+
return `text-brand-primary ${size}`;
|
|
398
|
+
return `text-icon-primary ${size}`;
|
|
399
|
+
}
|
|
400
|
+
renderCollapseButton() {
|
|
401
|
+
const label = this.collapsed ? 'Expandir menu' : 'Recolher menu';
|
|
402
|
+
return (h("button", { type: "button", class: "menu-toggle flex flex-none items-center justify-center", title: label, "aria-label": label, "aria-expanded": String(!this.collapsed), onClick: () => this.toggleMenu() }, h("sula-icon", { icon: `ph-bold ph-caret-${this.collapsed ? 'right' : 'left'}`, customClass: "text-lg" })));
|
|
403
|
+
}
|
|
404
|
+
renderRootHeader(expandedView) {
|
|
405
|
+
return (h("div", { class: {
|
|
406
|
+
'menu-header flex items-center': true,
|
|
407
|
+
'mb-40': expandedView,
|
|
408
|
+
'mb-24 flex-col justify-center px-0': !expandedView,
|
|
409
|
+
} }, this.image && (h("div", { class: { 'menu-brand-image max-h-10 max-w-10 overflow-hidden': true, 'mr-6': expandedView } }, h("img", { src: this.image, alt: this.menuTitle }))), h("div", { "aria-hidden": !expandedView, title: expandedView ? this.menuTitle : undefined, class: {
|
|
410
|
+
'menu-title menu-copy': true,
|
|
411
|
+
'menu-copy--visible': expandedView,
|
|
412
|
+
'menu-copy--hidden': !expandedView,
|
|
413
|
+
} }, h("h1", { part: "title", class: "truncate text-2xl font-bold leading-7 text-text-secondary" }, this.menuTitle)), this.renderCollapseButton()));
|
|
414
|
+
}
|
|
415
|
+
renderTrail(ancestors) {
|
|
416
|
+
const hasHidden = ancestors.length > 2;
|
|
417
|
+
const visible = hasHidden ? ancestors.slice(-2) : ancestors;
|
|
418
|
+
const crumbs = [];
|
|
419
|
+
if (hasHidden) {
|
|
420
|
+
crumbs.push(h("button", { key: "ellipsis", type: "button", class: "crumb-btn crumb-btn--ellipsis", "aria-haspopup": "true", "aria-expanded": String(this.crumbMenu.open), title: `${ancestors.length - 2} nível(is) anterior(es)`, ref: el => (this.crumbEllipsisEl = el), onClick: event => this.toggleCrumbMenu(event) }, h("sula-icon", { icon: "ph-bold ph-dots-three", customClass: "text-base text-text-secondary" })));
|
|
421
|
+
}
|
|
422
|
+
visible.forEach(ancestor => {
|
|
423
|
+
crumbs.push(h("button", { key: ancestor.id, type: "button", class: "crumb-btn", title: ancestor.label, onClick: () => this.goToDepth(this.stack.indexOf(ancestor)) }, ancestor.label));
|
|
424
|
+
});
|
|
425
|
+
const nodes = [];
|
|
426
|
+
crumbs.forEach((crumb, index) => {
|
|
427
|
+
if (index > 0)
|
|
428
|
+
nodes.push(h("sula-icon", { key: `sep-${index}`, icon: "ph ph-caret-right", customClass: "crumb-sep text-xs" }));
|
|
429
|
+
nodes.push(crumb);
|
|
430
|
+
});
|
|
431
|
+
return (h("nav", { class: "crumb-trail flex min-w-0 items-center", "aria-label": "Caminho de navega\u00E7\u00E3o" }, nodes));
|
|
432
|
+
}
|
|
433
|
+
renderCrumbDropdown(ancestors) {
|
|
434
|
+
if (!this.crumbMenu.open || ancestors.length <= 2)
|
|
435
|
+
return null;
|
|
436
|
+
const hidden = ancestors.slice(0, -2);
|
|
437
|
+
return (h("div", { class: "crumb-dropdown", role: "menu", ref: el => (this.crumbDropdownEl = el), style: { left: `${this.crumbMenu.left}px`, top: `${this.crumbMenu.top}px` } }, hidden.map(ancestor => (h("button", { key: ancestor.id, type: "button", role: "menuitem", class: "crumb-dropdown-item", onClick: () => this.goToDepth(this.stack.indexOf(ancestor)) }, h("span", { class: "item-icon flex flex-none items-center justify-center" }, this.renderItemIcon(ancestor, 'text-sm text-icon-primary', 'sm')), h("span", { class: "truncate" }, ancestor.label))))));
|
|
438
|
+
}
|
|
439
|
+
renderDrillHeader(activeParent) {
|
|
440
|
+
const ancestors = this.stack.slice(0, -1);
|
|
441
|
+
const backLabel = ancestors.length ? ancestors[ancestors.length - 1].label : this.menuTitle || 'Início';
|
|
442
|
+
const backButton = (h("button", { type: "button", class: "back-btn", title: `Voltar para ${backLabel}`, "aria-label": `Voltar para ${backLabel}`, onClick: () => this.goToDepth(this.stack.length - 2) }, h("sula-icon", { icon: "ph ph-arrow-left", customClass: "text-lg text-icon-primary" })));
|
|
443
|
+
return (h("div", { class: "menu-header menu-header--drilldown mb-16 flex flex-col border-b border-line-general pb-24" }, h("div", { class: "identity-row flex items-center" }, h("button", { type: "button", class: "identity-strip", title: `Ir para o início de ${this.menuTitle}`, onClick: () => this.goToDepth(-1) }, this.image && (h("span", { class: "identity-image" }, h("img", { src: this.image, alt: "" }))), h("span", { class: "identity-label truncate" }, this.menuTitle)), this.renderCollapseButton()), ancestors.length > 0 && (h("div", { class: "breadcrumb-row" }, backButton, this.renderTrail(ancestors), this.renderCrumbDropdown(ancestors))), h("div", { class: { 'context-row flex items-center min-w-0': true, 'mt-8': ancestors.length > 0 } }, ancestors.length === 0 && backButton, this.hasIcon(activeParent) && (h("span", { class: "context-icon flex flex-none items-center justify-center" }, this.renderItemIcon(activeParent, 'text-xl text-brand-primary', 'md'))), h("h1", { part: "title", class: "context-title truncate text-xl font-semibold leading-tight text-text-primary" }, activeParent.label))));
|
|
444
|
+
}
|
|
445
|
+
renderDrillRow(item, reserve) {
|
|
446
|
+
const branch = this.hasVisibleChildren(item);
|
|
447
|
+
const active = this.isActive(item, branch);
|
|
448
|
+
const faded = this.isFaded(item, active);
|
|
449
|
+
return (h("li", { class: "list-none", key: item.id }, h("div", { class: {
|
|
450
|
+
'menu-item flex items-center justify-between rounded-xs px-8': true,
|
|
451
|
+
'cursor-pointer hover:bg-states-empty-bg-hover': !item.disabled && !active,
|
|
452
|
+
'cursor-pointer': !item.disabled && active,
|
|
453
|
+
'cursor-not-allowed': !!item.disabled,
|
|
454
|
+
}, "aria-disabled": !!item.disabled, onClick: () => this.handleRowClick(item, this.stack.length + 1) }, h("span", { class: "flex min-w-0 flex-1 items-center gap-8" }, this.renderIconSlot(item, this.getIconClass(active, faded, 'text-base'), faded, reserve), h("span", { part: "item-label", class: {
|
|
455
|
+
'menu-item-label truncate': this.labelOverflow !== SulaMenuLabelOverflow.Wrap,
|
|
456
|
+
'menu-item-label menu-item-label--wrap': this.labelOverflow === SulaMenuLabelOverflow.Wrap,
|
|
457
|
+
'font-bold text-text-primary': active,
|
|
458
|
+
'text-text-disabled': faded,
|
|
459
|
+
'text-text-secondary': !active && !faded,
|
|
460
|
+
} }, item.label)), branch && h("sula-icon", { icon: "ph ph-caret-right", customClass: faded ? 'text-text-disabled text-xs' : 'text-text-secondary text-xs' }))));
|
|
461
|
+
}
|
|
462
|
+
renderDrillPanel() {
|
|
463
|
+
const activeParent = this.stack[this.stack.length - 1];
|
|
464
|
+
const panelKey = this.stack.map(item => item.id).join('/');
|
|
465
|
+
return (h("ul", { key: panelKey, class: {
|
|
466
|
+
'menu-panel flex flex-col': true,
|
|
467
|
+
'menu-panel--forward': this.direction === 'forward',
|
|
468
|
+
'menu-panel--back': this.direction === 'back',
|
|
469
|
+
} }, this.getVisibleItems(activeParent.children).map(item => this.renderDrillRow(item, this.siblingsHaveIcon(activeParent.children)))));
|
|
470
|
+
}
|
|
471
|
+
getMainIconClass(active, faded) {
|
|
472
|
+
if (faded)
|
|
473
|
+
return 'text-icon-disabled text-base';
|
|
474
|
+
if (active)
|
|
475
|
+
return 'text-brand-primary text-base';
|
|
476
|
+
return 'text-icon-primary text-base';
|
|
477
|
+
}
|
|
478
|
+
getMainCaretClass(active, faded) {
|
|
479
|
+
if (faded)
|
|
480
|
+
return 'text-text-disabled text-xs';
|
|
481
|
+
if (active)
|
|
482
|
+
return 'text-text-primary text-xs';
|
|
483
|
+
return 'text-text-secondary text-xs';
|
|
484
|
+
}
|
|
485
|
+
getSubIconClass(faded, selected = false) {
|
|
486
|
+
if (faded)
|
|
487
|
+
return 'text-icon-disabled text-base';
|
|
488
|
+
if (selected)
|
|
489
|
+
return 'text-brand-primary text-base';
|
|
490
|
+
return 'text-icon-primary text-base';
|
|
491
|
+
}
|
|
492
|
+
getSubCaretClass(faded) {
|
|
493
|
+
return faded ? 'text-icon-disabled text-xs' : 'text-icon-primary text-xs';
|
|
494
|
+
}
|
|
495
|
+
siblingsHaveIcon(items) {
|
|
496
|
+
return this.getVisibleItems(items).some(sibling => this.hasIcon(sibling));
|
|
497
|
+
}
|
|
498
|
+
renderIconSlot(item, customClass, faded, reserve = true) {
|
|
499
|
+
if (!reserve && !this.hasIcon(item))
|
|
500
|
+
return null;
|
|
501
|
+
return h("span", { class: "item-icon flex flex-none items-center justify-center" }, this.renderItemIcon(item, customClass, 'lg', faded));
|
|
502
|
+
}
|
|
503
|
+
renderMainRow(item, expandedView, branch, expanded, active, faded, reserve) {
|
|
504
|
+
const labelOverflowTruncate = this.labelOverflow === SulaMenuLabelOverflow.Truncate;
|
|
505
|
+
return (h("div", { class: {
|
|
506
|
+
'menu-item flex items-center rounded-xs px-8': true,
|
|
507
|
+
'cursor-pointer hover:bg-states-empty-bg-hover': !item.disabled,
|
|
508
|
+
'cursor-not-allowed': !!item.disabled,
|
|
509
|
+
'justify-between': expandedView,
|
|
510
|
+
'justify-center': !expandedView,
|
|
511
|
+
}, title: !expandedView ? item.label : undefined, "aria-disabled": !!item.disabled, onClick: () => this.handleRowClick(item, 1) }, h("div", { class: { 'flex items-center': true, 'flex-1 min-w-0 gap-8': expandedView, 'justify-center': !expandedView } }, this.renderIconSlot(item, this.getMainIconClass(active, faded), faded, reserve), h("span", { part: "main-item-label", title: expandedView ? item.label : undefined, "aria-hidden": !expandedView, class: {
|
|
512
|
+
'menu-item-label menu-copy': true,
|
|
513
|
+
'menu-item-label--truncate': labelOverflowTruncate,
|
|
514
|
+
'menu-item-label--wrap': !labelOverflowTruncate,
|
|
515
|
+
'menu-copy--visible': expandedView,
|
|
516
|
+
'menu-copy--hidden': !expandedView,
|
|
517
|
+
'font-bold text-text-primary': active,
|
|
518
|
+
'text-text-disabled': faded,
|
|
519
|
+
'text-text-secondary': !active && !faded,
|
|
520
|
+
} }, item.label)), branch && (h("sula-icon", { "aria-hidden": !expandedView, class: {
|
|
521
|
+
'menu-item-caret flex items-center justify-center': true,
|
|
522
|
+
'menu-item-caret--expanded': expanded,
|
|
523
|
+
'menu-item-caret--visible': expandedView,
|
|
524
|
+
'menu-item-caret--hidden': !expandedView,
|
|
525
|
+
}, icon: "ph ph-caret-down", customClass: this.getMainCaretClass(active, faded) }))));
|
|
526
|
+
}
|
|
527
|
+
renderSubRow(item, expandedView, branch, expanded, active, faded, drill, reserve) {
|
|
528
|
+
const caretIcon = drill ? 'ph-bold ph-caret-right' : `ph-bold ph-caret-${expanded && expandedView ? 'up' : 'down'}`;
|
|
529
|
+
const onClick = () => this.handleRowClick(item, this.depthOf(item));
|
|
530
|
+
const rowClass = {
|
|
531
|
+
'submenu-item flex min-w-0 items-center rounded-xs py-8 pr-8 select-none': true,
|
|
532
|
+
'submenu-item--branch w-full': branch,
|
|
533
|
+
'cursor-pointer hover:bg-states-empty-bg-hover': !item.disabled,
|
|
534
|
+
'cursor-not-allowed': !!item.disabled,
|
|
535
|
+
'font-bold': active && branch,
|
|
536
|
+
};
|
|
537
|
+
const label = (h("span", { class: {
|
|
538
|
+
'submenu-item-label min-w-0 flex-1': true,
|
|
539
|
+
'ml-8': reserve || this.hasIcon(item),
|
|
540
|
+
'menu-item-label--truncate': this.labelOverflow === SulaMenuLabelOverflow.Truncate,
|
|
541
|
+
'menu-item-label--wrap': this.labelOverflow !== SulaMenuLabelOverflow.Truncate,
|
|
542
|
+
'text-text-primary': !faded,
|
|
543
|
+
'text-text-disabled': faded,
|
|
544
|
+
'font-bold': active,
|
|
545
|
+
} }, item.label));
|
|
546
|
+
if (!branch) {
|
|
547
|
+
return (h("a", { class: rowClass, style: { paddingLeft: '8px' }, title: item.label, "aria-disabled": !!item.disabled, onClick: onClick }, this.renderIconSlot(item, this.getSubIconClass(faded, active && !branch), faded, reserve), label));
|
|
548
|
+
}
|
|
549
|
+
return (h("a", { class: rowClass, style: { paddingLeft: '8px' }, title: item.label, "aria-disabled": !!item.disabled, onClick: onClick }, h("div", { class: "submenu-item-branch-content flex min-w-0 flex-1 items-center" }, this.renderIconSlot(item, this.getSubIconClass(faded, active && !branch), faded, reserve), label), h("div", { class: "submenu-item-branch-caret flex flex-none items-center justify-end pl-8" }, h("sula-icon", { icon: caretIcon, customClass: this.getSubCaretClass(faded) }))));
|
|
550
|
+
}
|
|
551
|
+
depthOf(item) {
|
|
552
|
+
const path = this.findPath(this.items, item.id);
|
|
553
|
+
return path ? path.length : 1;
|
|
554
|
+
}
|
|
555
|
+
renderInlineList(items, depth, expandedView) {
|
|
556
|
+
const reserve = this.siblingsHaveIcon(items);
|
|
557
|
+
return this.getVisibleItems(items).map(item => {
|
|
558
|
+
const branch = this.hasVisibleChildren(item);
|
|
559
|
+
const drill = branch && depth >= this.drilldownLevel;
|
|
560
|
+
const inline = branch && !drill;
|
|
561
|
+
const expanded = inline && !!item.expanded;
|
|
562
|
+
const active = this.isActive(item, branch) || expanded;
|
|
563
|
+
const faded = this.isFaded(item, active);
|
|
564
|
+
const row = depth === 1
|
|
565
|
+
? this.renderMainRow(item, expandedView, branch, expanded, active, faded, reserve)
|
|
566
|
+
: this.renderSubRow(item, expandedView, branch, expanded, active, faded, drill, reserve);
|
|
567
|
+
return (h("li", { class: { 'decoration-none list-none': true, 'menu-group': depth === 1, 'is-selected': depth > 1 && active && !branch }, key: item.id }, row, inline && (h("ul", { "aria-hidden": !expandedView || !expanded, class: {
|
|
568
|
+
submenu: true,
|
|
569
|
+
'submenu--expanded': expandedView && expanded,
|
|
570
|
+
'ml-[8px] border-l border-line-general pl-8': depth === 1,
|
|
571
|
+
'submenu-branch ml-[24px] border-l border-line-general pl-8': depth > 1,
|
|
572
|
+
} }, this.renderInlineList(item.children, depth + 1, expandedView)))));
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
render() {
|
|
576
|
+
const expandedView = !this.collapsed || this.previewExpanded;
|
|
577
|
+
const drilled = expandedView && this.isDrilled();
|
|
578
|
+
const activeParent = this.stack[this.stack.length - 1];
|
|
579
|
+
return (h(Host, { key: '12139fb88e9b991a07d0b29689133d6b76b66f5c', class: {
|
|
580
|
+
'menu-host--collapsed': this.collapsed,
|
|
581
|
+
'menu-host--preview': this.collapsed && this.previewExpanded,
|
|
582
|
+
'menu-host--density-compact': this.density === SulaMenuDensity.Compact,
|
|
583
|
+
'menu-host--density-comfortable': this.density === SulaMenuDensity.Comfortable,
|
|
584
|
+
}, style: this.hostStyleVariables, onMouseEnter: () => this.handleMenuMouseEnter(), onMouseLeave: () => this.handleMenuMouseLeave() }, h("aside", { key: 'db4cb78b76e39572c4700a81c618bde1c6d00002', part: "shell", ref: el => (this.shellEl = el), class: {
|
|
585
|
+
'menu-shell flex h-full flex-col bg-surface-body shadow-md z-50': true,
|
|
586
|
+
'menu-shell--collapsed': this.collapsed && !this.previewExpanded,
|
|
587
|
+
'menu-shell--expanded': expandedView,
|
|
588
|
+
'menu-shell--preview': this.collapsed && this.previewExpanded,
|
|
589
|
+
} }, drilled ? this.renderDrillHeader(activeParent) : this.renderRootHeader(expandedView), h("nav", { key: 'cf399fa304cb289804790b729e45c1f5edc72876', class: {
|
|
590
|
+
'menu-nav flex h-full flex-col overflow-y-auto overflow-x-hidden': true,
|
|
591
|
+
'px-12': !expandedView,
|
|
592
|
+
} }, drilled ? (this.renderDrillPanel()) : (h("ul", { class: "flex flex-col" }, this.renderInlineList(this.items, 1, expandedView)))), this.user && (h("div", { key: '64ae669ebe5b7e0ac48e900bdce4b658cfbd91af', class: "menu-footer border-t border-line-general pt-12" }, this.renderUserInfo(expandedView)))), this.user && this.renderProfilePopover(expandedView)));
|
|
593
|
+
}
|
|
594
|
+
get el() { return this; }
|
|
595
|
+
static get watchers() { return {
|
|
596
|
+
"items": ["syncWithItems"],
|
|
597
|
+
"drillPath": ["syncDrillPath"]
|
|
598
|
+
}; }
|
|
599
|
+
static get style() { return sulaWorkbenchMenuCss; }
|
|
600
|
+
}, [1, "sula-workbench-menu", {
|
|
601
|
+
"menuTitle": [1, "menu-title"],
|
|
602
|
+
"image": [1],
|
|
603
|
+
"width": [1],
|
|
604
|
+
"density": [1],
|
|
605
|
+
"labelOverflow": [1, "label-overflow"],
|
|
606
|
+
"drilldownLevel": [2, "drilldown-level"],
|
|
607
|
+
"drillPath": [16, "drill-path"],
|
|
608
|
+
"items": [1040],
|
|
609
|
+
"user": [16],
|
|
610
|
+
"defaultIcon": [1, "default-icon"],
|
|
611
|
+
"profileItems": [1040, "profile-items"],
|
|
612
|
+
"collapsed": [32],
|
|
613
|
+
"previewExpanded": [32],
|
|
614
|
+
"stack": [32],
|
|
615
|
+
"direction": [32],
|
|
616
|
+
"selectedPath": [32],
|
|
617
|
+
"crumbMenu": [32],
|
|
618
|
+
"profileOpen": [32]
|
|
619
|
+
}, [[4, "click", "onDocumentClick"], [4, "keydown", "onDocumentKeydown"], [9, "resize", "onWindowResize"]], {
|
|
620
|
+
"items": ["syncWithItems"],
|
|
621
|
+
"drillPath": ["syncDrillPath"]
|
|
622
|
+
}]);
|
|
623
|
+
function defineCustomElement$1() {
|
|
624
|
+
if (typeof customElements === "undefined") {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
const components = ["sula-workbench-menu", "sula-icon", "sula-profile-menu", "sula-switch"];
|
|
628
|
+
components.forEach(tagName => { switch (tagName) {
|
|
629
|
+
case "sula-workbench-menu":
|
|
630
|
+
if (!customElements.get(tagName)) {
|
|
631
|
+
customElements.define(tagName, SulaWorkbenchMenu$1);
|
|
632
|
+
}
|
|
633
|
+
break;
|
|
634
|
+
case "sula-icon":
|
|
635
|
+
if (!customElements.get(tagName)) {
|
|
636
|
+
defineCustomElement$4();
|
|
637
|
+
}
|
|
638
|
+
break;
|
|
639
|
+
case "sula-profile-menu":
|
|
640
|
+
if (!customElements.get(tagName)) {
|
|
641
|
+
defineCustomElement$3();
|
|
642
|
+
}
|
|
643
|
+
break;
|
|
644
|
+
case "sula-switch":
|
|
645
|
+
if (!customElements.get(tagName)) {
|
|
646
|
+
defineCustomElement$2();
|
|
647
|
+
}
|
|
648
|
+
break;
|
|
649
|
+
} });
|
|
650
|
+
}
|
|
651
|
+
defineCustomElement$1();
|
|
652
|
+
|
|
653
|
+
const SulaWorkbenchMenu = SulaWorkbenchMenu$1;
|
|
654
|
+
const defineCustomElement = defineCustomElement$1;
|
|
655
|
+
|
|
656
|
+
export { SulaWorkbenchMenu, defineCustomElement };
|
|
657
|
+
//# sourceMappingURL=sula-workbench-menu.js.map
|
|
658
|
+
|
|
659
|
+
//# sourceMappingURL=sula-workbench-menu.js.map
|