@sula-tech/webcomponents 0.23.1 → 0.24.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/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 +578 -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 +996 -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 +450 -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 +633 -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 +576 -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 +175 -0
- package/dist/types/components/sula-workbench-menu/sula-workbench-menu.stories.d.ts +145 -0
- package/dist/types/components.d.ts +267 -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-68a6d489.entry.js +807 -0
- package/dist/webcomponents/p-68a6d489.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 +32 -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,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.SulaCalendarStatus = void 0;
|
|
4
|
+
(function (SulaCalendarStatus) {
|
|
5
|
+
SulaCalendarStatus["Default"] = "default";
|
|
6
|
+
SulaCalendarStatus["Error"] = "error";
|
|
7
|
+
})(exports.SulaCalendarStatus || (exports.SulaCalendarStatus = {}));
|
|
8
|
+
//# sourceMappingURL=sula-calendar.model-CxjS_EJv.js.map
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=sula-calendar.model-CxjS_EJv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-calendar.model-CxjS_EJv.js","sources":["src/components/sula-calendar/model/sula-calendar.model.ts"],"sourcesContent":["export enum SulaCalendarStatus {\n Default = 'default',\n Error = 'error',\n}\n\nexport interface SulaCalendarDay {\n date: Date;\n day: number;\n isCurrentMonth: boolean;\n isSelected: boolean;\n isRangeStart: boolean;\n isRangeEnd: boolean;\n isInRange: boolean;\n isRangePreview: boolean;\n isToday: boolean;\n isDisabled: boolean;\n}\n\nexport interface SulaCalendarRange {\n start: string;\n end: string;\n}\n\nexport interface SulaCalendarWeekday {\n short: string;\n long: string;\n}\n\nexport interface SulaCalendarMonthChange {\n month: number;\n year: number;\n}\n"],"names":["SulaCalendarStatus"],"mappings":";;AAAYA;AAAZ,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACjB,CAAC,EAHWA,0BAAkB,KAAlBA,0BAAkB,GAG7B,EAAA,CAAA,CAAA;;"}
|
|
@@ -11,12 +11,6 @@ exports.SulaMenuLabelOverflow = void 0;
|
|
|
11
11
|
SulaMenuLabelOverflow["Truncate"] = "truncate";
|
|
12
12
|
SulaMenuLabelOverflow["Wrap"] = "wrap";
|
|
13
13
|
})(exports.SulaMenuLabelOverflow || (exports.SulaMenuLabelOverflow = {}));
|
|
14
|
+
//# sourceMappingURL=sula-menu.model-BDxbWyPG.js.map
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
(function (SulaCalendarStatus) {
|
|
17
|
-
SulaCalendarStatus["Default"] = "default";
|
|
18
|
-
SulaCalendarStatus["Error"] = "error";
|
|
19
|
-
})(exports.SulaCalendarStatus || (exports.SulaCalendarStatus = {}));
|
|
20
|
-
//# sourceMappingURL=sula-calendar.model-BI5cNrUo.js.map
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=sula-calendar.model-BI5cNrUo.js.map
|
|
16
|
+
//# sourceMappingURL=sula-menu.model-BDxbWyPG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-menu.model-BDxbWyPG.js","sources":["src/components/sula-menu/model/sula-menu.model.ts"],"sourcesContent":["export enum SulaMenuDensity {\n Compact = 'compact',\n Default = 'default',\n Comfortable = 'comfortable',\n}\n\nexport enum SulaMenuLabelOverflow {\n Truncate = 'truncate',\n Wrap = 'wrap',\n}\n\nexport interface SulaMenuMainItem extends SulaMenuItem {\n children?: SulaMenuSubItem[];\n}\n\nexport interface SulaMenuSubItem extends SulaMenuItem {\n children?: SulaMenuItem[];\n}\n\nexport interface SulaMenuItem {\n id: string;\n label: string;\n icon: string;\n hidden?: boolean;\n open?: boolean;\n route?: string;\n expanded?: boolean;\n selected?: boolean;\n disabled?: boolean;\n}\n\nexport type SelectedMenuItem = {\n id: string;\n parentItemId?: string;\n parentChildId?: string;\n};\n"],"names":["SulaMenuDensity","SulaMenuLabelOverflow"],"mappings":";;AAAYA;AAAZ,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,eAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAC7B,CAAC,EAJWA,uBAAe,KAAfA,uBAAe,GAI1B,EAAA,CAAA,CAAA;AAEWC;AAAZ,CAAA,UAAY,qBAAqB,EAAA;AAC/B,IAAA,qBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,qBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACf,CAAC,EAHWA,6BAAqB,KAArBA,6BAAqB,GAGhC,EAAA,CAAA,CAAA;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-BjAGuSPl.js');
|
|
4
|
+
|
|
5
|
+
const sulaProfileMenuCss = "*,: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}.block{display:block}.flex{display:flex}.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{display:block}.profile-avatar img{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.profile-divider{background:var(--color-line-general);height:1px;margin:4px 8px}.profile-option{align-items:center;background:none;border:0;border-radius:8px;box-sizing:border-box;display:flex;font:inherit;gap:8px;min-height:40px;padding:0 8px;text-align:left;width:100%}button.profile-option{cursor:pointer;transition:background-color .15s ease-out}button.profile-option:hover:not(.is-disabled){background:var(--color-states-empty-bg-hover)}button.profile-option.is-disabled{cursor:not-allowed}button.profile-option:focus-visible{outline:2px solid var(--color-feedback-informational);outline-offset:-2px}.profile-option sula-icon{display:flex;flex:none;justify-content:center;width:20px}.profile-option sula-switch{flex:none;pointer-events:none;transform:scale(.75);transform-origin:right center}: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)}.visible{visibility:visible}.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}.hidden{display:none}.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)}.h-10{height:2.5rem}.w-10{width:2.5rem}.gap-12{gap:.75rem}.rounded-sm{border-radius:.75rem}.pb-12{padding-bottom:.75rem}.pt-8{padding-top:.5rem}@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\")}.mr-16{margin-right:1rem}.h-12{height:.75rem}.h-32{height:2rem}.h-4{height:.25rem}.h-\\[28px\\]{height:28px}.min-h-\\[85px\\]{min-height:85px}.w-12{width:.75rem}.w-56{width:3.5rem}.w-\\[10px\\]{width:10px}.w-\\[280px\\]{width:280px}.w-\\[28px\\]{width:28px}.justify-start{justify-content:flex-start}.space-x-12>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.75rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.75rem*var(--tw-space-x-reverse))}.break-words{overflow-wrap:break-word}.rounded-md{border-radius:1.25rem}.rounded-xxl{border-radius:18.75rem}.bg-negative-negative-1{background-color:var(--color-negative-negative-1)}.bg-neutral-neutral-3{background-color:var(--color-neutral-neutral-3)}.bg-neutral-neutral-4{background-color:var(--color-neutral-neutral-4)}.bg-states-bg-disabled{background-color:var(--color-states-bg-disabled)}.bg-surface-on-body{background-color:var(--color-surface-on-body)}.p-2{padding:.125rem}.px-24{padding-left:1.5rem;padding-right:1.5rem}.py-16{padding-bottom:1rem;padding-top:1rem}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.active\\:bg-states-empty-bg-pressed:active{background-color:var(--color-states-empty-bg-pressed)}";
|
|
6
|
+
|
|
7
|
+
const SulaProfileMenu = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.itemClicked = index.createEvent(this, "itemClicked");
|
|
11
|
+
this.switchChanged = index.createEvent(this, "switchChanged");
|
|
12
|
+
/**
|
|
13
|
+
* Options of the list. Use `divider` for a separator and `hasSwitch` + `active` for a toggle row.
|
|
14
|
+
*/
|
|
15
|
+
this.items = [];
|
|
16
|
+
}
|
|
17
|
+
handleClick(item) {
|
|
18
|
+
if (item.disabled)
|
|
19
|
+
return;
|
|
20
|
+
if (!item.hasSwitch) {
|
|
21
|
+
this.itemClicked.emit(item);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const active = !item.active;
|
|
25
|
+
const updated = Object.assign(Object.assign({}, item), { active });
|
|
26
|
+
this.items = this.items.map(current => (current.id === item.id ? updated : current));
|
|
27
|
+
this.switchChanged.emit({ item: updated, active });
|
|
28
|
+
}
|
|
29
|
+
getInitials(name) {
|
|
30
|
+
return name
|
|
31
|
+
.split(' ')
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.slice(0, 2)
|
|
34
|
+
.map(part => part[0].toUpperCase())
|
|
35
|
+
.join('');
|
|
36
|
+
}
|
|
37
|
+
renderItem(item) {
|
|
38
|
+
if (item.divider)
|
|
39
|
+
return index.h("div", { key: item.id, part: "divider", class: "profile-divider", role: "separator" });
|
|
40
|
+
return (index.h("button", { key: item.id, type: "button", part: "option", class: { 'profile-option': true, 'is-disabled': !!item.disabled }, role: item.hasSwitch ? 'switch' : undefined, "aria-checked": item.hasSwitch ? String(!!item.active) : undefined, "aria-disabled": item.disabled ? 'true' : undefined, onClick: () => this.handleClick(item) }, item.icon && index.h("sula-icon", { icon: item.icon, customClass: `text-lg ${item.disabled ? 'text-icon-disabled' : 'text-icon-primary'}` }), index.h("span", { class: { 'profile-option-label min-w-0 flex-1 truncate text-sm': true, 'text-text-secondary': !item.disabled, 'text-text-disabled': !!item.disabled } }, item.label), item.hasSwitch && index.h("sula-switch", { active: !!item.active, disabled: !!item.disabled, ref: el => el === null || el === void 0 ? void 0 : el.setAttribute('inert', '') })));
|
|
41
|
+
}
|
|
42
|
+
render() {
|
|
43
|
+
if (!this.user)
|
|
44
|
+
return index.h(index.Host, null);
|
|
45
|
+
const { name, email, photo } = this.user;
|
|
46
|
+
const items = this.items.filter(item => !item.hidden);
|
|
47
|
+
return (index.h(index.Host, null, index.h("div", { part: "card", class: "profile-card flex flex-col rounded-sm bg-surface-body px-8 pb-12 pt-8" }, index.h("div", { class: "profile-header flex min-w-0 items-center gap-12 p-8" }, index.h("span", { class: "profile-avatar flex h-10 w-10 flex-none items-center justify-center overflow-hidden rounded-full bg-brand-primary text-sm font-semibold text-negative-negative-1" }, photo ? index.h("img", { src: photo, alt: name }) : this.getInitials(name)), index.h("span", { class: "flex min-w-0 flex-col" }, index.h("span", { part: "name", class: "profile-name truncate text-sm font-semibold text-text-primary" }, name), email && index.h("span", { class: "profile-email truncate text-xs text-text-secondary" }, email))), items.length > 0 && !items[0].divider && index.h("div", { part: "divider", class: "profile-divider", role: "separator" }), items.map(item => this.renderItem(item)), index.h("slot", null))));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
SulaProfileMenu.style = sulaProfileMenuCss;
|
|
51
|
+
|
|
52
|
+
exports.sula_profile_menu = SulaProfileMenu;
|
|
53
|
+
//# sourceMappingURL=sula-profile-menu.entry.cjs.js.map
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=sula-profile-menu.cjs.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"sula-profile-menu.entry.cjs.js","mappings":";;;;AAAA,MAAM,kBAAkB,GAAG,i1jBAAi1jB;;MCmB/1jB,eAAe,GAAA,MAAA;AAL5B,IAAA,WAAA,CAAA,OAAA,EAAA;;;;AAWE;;AAEG;AACsB,QAAA,IAAK,CAAA,KAAA,GAA0B,EAAE;AAqF3D;AAzES,IAAA,WAAW,CAAC,IAAyB,EAAA;QAC3C,IAAI,IAAI,CAAC,QAAQ;YAAE;AACnB,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;AACnB,YAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3B;;AAEF,QAAA,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM;AAC3B,QAAA,MAAM,OAAO,GAAQ,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,IAAI,CAAE,EAAA,EAAA,MAAM,GAAE;AACnC,QAAA,IAAI,CAAC,KAAK,GAAG,I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,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAI,CAAA,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAC3D,EACPA,OAAM,CAAA,MAAA,EAAA,EAAA,KAAK,EAAC,uBAAuB,EAAA,EACjCA,OAAM,CAAA,MAAA,EAAA,EAAA,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,+DAA+D,EACpF,EAAA,IAAI,CACA,EACN,KAAK,IAAIA,kBAAM,KAAK,EAAC,oDAAoD,EAAE,EAAA,KAAK,CAAQ,CACpF,CACH,EAEL,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,IAAIA,OAAK,CAAA,KAAA,EAAA,EAAA,IAAI,EAAC,SAAS,EAAC,KAAK,EAAC,iBAAiB,EAAC,IAAI,EAAC,WAAW,EAAO,CAAA,EAC5G,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAEzCA,OAAa,CAAA,MAAA,EAAA,IAAA,CAAA,CACT,CACD;;;;;;;","names":["h","Host"],"sources":["src/components/sula-profile-menu/sula-profile-menu.scss?tag=sula-profile-menu&encapsulation=shadow","src/components/sula-profile-menu/sula-profile-menu.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.profile-avatar img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.profile-divider {\n height: 1px;\n margin: 4px 8px;\n background: var(--color-line-general);\n}\n\n.profile-option {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 40px;\n padding: 0 8px;\n box-sizing: border-box;\n border: 0;\n border-radius: 8px;\n background: none;\n font: inherit;\n text-align: left;\n}\n\nbutton.profile-option {\n cursor: pointer;\n transition: background-color 150ms ease-out;\n\n &:hover:not(.is-disabled) {\n background: var(--color-states-empty-bg-hover);\n }\n\n &.is-disabled {\n cursor: not-allowed;\n }\n\n &:focus-visible {\n outline: 2px solid var(--color-feedback-informational);\n outline-offset: -2px;\n }\n}\n\n/* Fixed icon box keeps labels aligned whatever the glyph width. */\n.profile-option sula-icon {\n display: flex;\n flex: none;\n justify-content: center;\n width: 20px;\n}\n\n/* The DS switch is 56x32; scaled down so the row keeps the menu item height. */\n.profile-option sula-switch {\n flex: none;\n pointer-events: none;\n transform: scale(0.75);\n transform-origin: right center;\n}\n","import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport { SulaProfileMenuItem, SulaProfileMenuSwitchChange, SulaProfileMenuUser } from './model/sula-profile-menu.model';\n\n/**\n * Profile card with the logged user and a configurable list of options.\n * It has no positioning of its own: place it inside a popover, dropdown or panel.\n * The component only emits events: what each option does is up to the host application.\n *\n * @slot - Extra content rendered after the options.\n * @part card - Card container.\n * @part name - User name.\n * @part option - Each option row.\n * @part divider - Each separator line.\n */\n@Component({\n tag: 'sula-profile-menu',\n styleUrl: 'sula-profile-menu.scss',\n shadow: true,\n})\nexport class SulaProfileMenu {\n /**\n * Logged user. Without a photo, the initials are shown.\n */\n @Prop() user?: SulaProfileMenuUser;\n\n /**\n * Options of the list. Use `divider` for a separator and `hasSwitch` + `active` for a toggle row.\n */\n @Prop({ mutable: true }) items: SulaProfileMenuItem[] = [];\n\n /**\n * Emitted when an option without switch is clicked\n */\n @Event() itemClicked: EventEmitter<SulaProfileMenuItem>;\n\n /**\n * Emitted when the switch of an option changes\n */\n @Event() switchChanged: EventEmitter<SulaProfileMenuSwitchChange>;\n\n private handleClick(item: SulaProfileMenuItem) {\n if (item.disabled) return;\n if (!item.hasSwitch) {\n this.itemClicked.emit(item);\n return;\n }\n const active = !item.active;\n const updated = { ...item, active };\n this.items = this.items.map(current => (current.id === item.id ? updated : current));\n this.switchChanged.emit({ item: updated, active });\n }\n\n private getInitials(name: string) {\n return name\n .split(' ')\n .filter(Boolean)\n .slice(0, 2)\n .map(part => part[0].toUpperCase())\n .join('');\n }\n\n private renderItem(item: SulaProfileMenuItem) {\n if (item.divider) return <div key={item.id} part=\"divider\" class=\"profile-divider\" role=\"separator\"></div>;\n\n return (\n <button\n key={item.id}\n type=\"button\"\n part=\"option\"\n class={{ 'profile-option': true, 'is-disabled': !!item.disabled }}\n role={item.hasSwitch ? 'switch' : undefined}\n aria-checked={item.hasSwitch ? String(!!item.active) : undefined}\n aria-disabled={item.disabled ? 'true' : undefined}\n onClick={() => this.handleClick(item)}\n >\n {item.icon && <sula-icon icon={item.icon} customClass={`text-lg ${item.disabled ? 'text-icon-disabled' : 'text-icon-primary'}`}></sula-icon>}\n <span class={{ 'profile-option-label min-w-0 flex-1 truncate text-sm': true, 'text-text-secondary': !item.disabled, 'text-text-disabled': !!item.disabled }}>\n {item.label}\n </span>\n {/* The row is the switch control; the inner switch is only visual. */}\n {item.hasSwitch && <sula-switch active={!!item.active} disabled={!!item.disabled} ref={el => el?.setAttribute('inert', '')}></sula-switch>}\n </button>\n );\n }\n\n render() {\n if (!this.user) return <Host />;\n const { name, email, photo } = this.user;\n const items = this.items.filter(item => !item.hidden);\n\n return (\n <Host>\n <div part=\"card\" class=\"profile-card flex flex-col rounded-sm bg-surface-body px-8 pb-12 pt-8\">\n <div class=\"profile-header flex min-w-0 items-center gap-12 p-8\">\n <span class=\"profile-avatar flex h-10 w-10 flex-none items-center justify-center overflow-hidden rounded-full bg-brand-primary text-sm font-semibold text-negative-negative-1\">\n {photo ? <img src={photo} alt={name} /> : this.getInitials(name)}\n </span>\n <span class=\"flex min-w-0 flex-col\">\n <span part=\"name\" class=\"profile-name truncate text-sm font-semibold text-text-primary\">\n {name}\n </span>\n {email && <span class=\"profile-email truncate text-xs text-text-secondary\">{email}</span>}\n </span>\n </div>\n\n {items.length > 0 && !items[0].divider && <div part=\"divider\" class=\"profile-divider\" role=\"separator\"></div>}\n {items.map(item => this.renderItem(item))}\n\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-profile-menu.entry.cjs.js","sources":["src/components/sula-profile-menu/sula-profile-menu.scss?tag=sula-profile-menu&encapsulation=shadow","src/components/sula-profile-menu/sula-profile-menu.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.profile-avatar img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.profile-divider {\n height: 1px;\n margin: 4px 8px;\n background: var(--color-line-general);\n}\n\n.profile-option {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n min-height: 40px;\n padding: 0 8px;\n box-sizing: border-box;\n border: 0;\n border-radius: 8px;\n background: none;\n font: inherit;\n text-align: left;\n}\n\nbutton.profile-option {\n cursor: pointer;\n transition: background-color 150ms ease-out;\n\n &:hover:not(.is-disabled) {\n background: var(--color-states-empty-bg-hover);\n }\n\n &.is-disabled {\n cursor: not-allowed;\n }\n\n &:focus-visible {\n outline: 2px solid var(--color-feedback-informational);\n outline-offset: -2px;\n }\n}\n\n/* Fixed icon box keeps labels aligned whatever the glyph width. */\n.profile-option sula-icon {\n display: flex;\n flex: none;\n justify-content: center;\n width: 20px;\n}\n\n/* The DS switch is 56x32; scaled down so the row keeps the menu item height. */\n.profile-option sula-switch {\n flex: none;\n pointer-events: none;\n transform: scale(0.75);\n transform-origin: right center;\n}\n","import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport { SulaProfileMenuItem, SulaProfileMenuSwitchChange, SulaProfileMenuUser } from './model/sula-profile-menu.model';\n\n/**\n * Profile card with the logged user and a configurable list of options.\n * It has no positioning of its own: place it inside a popover, dropdown or panel.\n * The component only emits events: what each option does is up to the host application.\n *\n * @slot - Extra content rendered after the options.\n * @part card - Card container.\n * @part name - User name.\n * @part option - Each option row.\n * @part divider - Each separator line.\n */\n@Component({\n tag: 'sula-profile-menu',\n styleUrl: 'sula-profile-menu.scss',\n shadow: true,\n})\nexport class SulaProfileMenu {\n /**\n * Logged user. Without a photo, the initials are shown.\n */\n @Prop() user?: SulaProfileMenuUser;\n\n /**\n * Options of the list. Use `divider` for a separator and `hasSwitch` + `active` for a toggle row.\n */\n @Prop({ mutable: true }) items: SulaProfileMenuItem[] = [];\n\n /**\n * Emitted when an option without switch is clicked\n */\n @Event() itemClicked: EventEmitter<SulaProfileMenuItem>;\n\n /**\n * Emitted when the switch of an option changes\n */\n @Event() switchChanged: EventEmitter<SulaProfileMenuSwitchChange>;\n\n private handleClick(item: SulaProfileMenuItem) {\n if (item.disabled) return;\n if (!item.hasSwitch) {\n this.itemClicked.emit(item);\n return;\n }\n const active = !item.active;\n const updated = { ...item, active };\n this.items = this.items.map(current => (current.id === item.id ? updated : current));\n this.switchChanged.emit({ item: updated, active });\n }\n\n private getInitials(name: string) {\n return name\n .split(' ')\n .filter(Boolean)\n .slice(0, 2)\n .map(part => part[0].toUpperCase())\n .join('');\n }\n\n private renderItem(item: SulaProfileMenuItem) {\n if (item.divider) return <div key={item.id} part=\"divider\" class=\"profile-divider\" role=\"separator\"></div>;\n\n return (\n <button\n key={item.id}\n type=\"button\"\n part=\"option\"\n class={{ 'profile-option': true, 'is-disabled': !!item.disabled }}\n role={item.hasSwitch ? 'switch' : undefined}\n aria-checked={item.hasSwitch ? String(!!item.active) : undefined}\n aria-disabled={item.disabled ? 'true' : undefined}\n onClick={() => this.handleClick(item)}\n >\n {item.icon && <sula-icon icon={item.icon} customClass={`text-lg ${item.disabled ? 'text-icon-disabled' : 'text-icon-primary'}`}></sula-icon>}\n <span class={{ 'profile-option-label min-w-0 flex-1 truncate text-sm': true, 'text-text-secondary': !item.disabled, 'text-text-disabled': !!item.disabled }}>\n {item.label}\n </span>\n {/* The row is the switch control; the inner switch is only visual. */}\n {item.hasSwitch && <sula-switch active={!!item.active} disabled={!!item.disabled} ref={el => el?.setAttribute('inert', '')}></sula-switch>}\n </button>\n );\n }\n\n render() {\n if (!this.user) return <Host />;\n const { name, email, photo } = this.user;\n const items = this.items.filter(item => !item.hidden);\n\n return (\n <Host>\n <div part=\"card\" class=\"profile-card flex flex-col rounded-sm bg-surface-body px-8 pb-12 pt-8\">\n <div class=\"profile-header flex min-w-0 items-center gap-12 p-8\">\n <span class=\"profile-avatar flex h-10 w-10 flex-none items-center justify-center overflow-hidden rounded-full bg-brand-primary text-sm font-semibold text-negative-negative-1\">\n {photo ? <img src={photo} alt={name} /> : this.getInitials(name)}\n </span>\n <span class=\"flex min-w-0 flex-col\">\n <span part=\"name\" class=\"profile-name truncate text-sm font-semibold text-text-primary\">\n {name}\n </span>\n {email && <span class=\"profile-email truncate text-xs text-text-secondary\">{email}</span>}\n </span>\n </div>\n\n {items.length > 0 && !items[0].divider && <div part=\"divider\" class=\"profile-divider\" role=\"separator\"></div>}\n {items.map(item => this.renderItem(item))}\n\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"],"names":["h","Host"],"mappings":";;;;AAAA,MAAM,kBAAkB,GAAG,i1jBAAi1jB;;MCmB/1jB,eAAe,GAAA,MAAA;AAL5B,IAAA,WAAA,CAAA,OAAA,EAAA;;;;AAWE;;AAEG;AACsB,QAAA,IAAK,CAAA,KAAA,GAA0B,EAAE;AAqF3D;AAzES,IAAA,WAAW,CAAC,IAAyB,EAAA;QAC3C,IAAI,IAAI,CAAC,QAAQ;YAAE;AACnB,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;AACnB,YAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3B;;AAEF,QAAA,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM;AAC3B,QAAA,MAAM,OAAO,GAAQ,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,IAAI,CAAE,EAAA,EAAA,MAAM,GAAE;AACnC,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,OAAO,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;AACp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