@skdx/web-components-blocks 0.1.0 → 0.35.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/custom-elements.json +5072 -290
- package/dist/chat-composer/ChatComposer.cjs +41 -0
- package/dist/chat-composer/ChatComposer.d.cts +125 -0
- package/dist/chat-composer/ChatComposer.d.ts +125 -0
- package/dist/chat-composer/ChatComposer.js +41 -0
- package/dist/chat-composer/index.cjs +1 -0
- package/dist/chat-composer/index.d.cts +1 -0
- package/dist/chat-composer/index.d.ts +1 -0
- package/dist/chat-composer/index.js +1 -0
- package/dist/chat-message/ChatMessage.cjs +26 -0
- package/dist/chat-message/ChatMessage.d.cts +74 -0
- package/dist/chat-message/ChatMessage.d.ts +74 -0
- package/dist/chat-message/ChatMessage.js +26 -0
- package/dist/chat-message/index.cjs +1 -0
- package/dist/chat-message/index.d.cts +1 -0
- package/dist/chat-message/index.d.ts +1 -0
- package/dist/chat-message/index.js +1 -0
- package/dist/comment/Comment.cjs +26 -0
- package/dist/comment/Comment.d.cts +66 -0
- package/dist/comment/Comment.d.ts +66 -0
- package/dist/comment/Comment.js +26 -0
- package/dist/comment/index.cjs +1 -0
- package/dist/comment/index.d.cts +1 -0
- package/dist/comment/index.d.ts +1 -0
- package/dist/comment/index.js +1 -0
- package/dist/comment-thread/CommentThread.cjs +27 -0
- package/dist/comment-thread/CommentThread.d.cts +67 -0
- package/dist/comment-thread/CommentThread.d.ts +67 -0
- package/dist/comment-thread/CommentThread.js +27 -0
- package/dist/comment-thread/index.cjs +1 -0
- package/dist/comment-thread/index.d.cts +1 -0
- package/dist/comment-thread/index.d.ts +1 -0
- package/dist/comment-thread/index.js +1 -0
- package/dist/confirm-dialog/ConfirmDialog.cjs +38 -0
- package/dist/confirm-dialog/ConfirmDialog.d.cts +101 -0
- package/dist/confirm-dialog/ConfirmDialog.d.ts +101 -0
- package/dist/confirm-dialog/ConfirmDialog.js +38 -0
- package/dist/confirm-dialog/index.cjs +1 -0
- package/dist/confirm-dialog/index.d.cts +1 -0
- package/dist/confirm-dialog/index.d.ts +1 -0
- package/dist/confirm-dialog/index.js +1 -0
- package/dist/conversation-list/ConversationList.cjs +52 -0
- package/dist/conversation-list/ConversationList.d.cts +124 -0
- package/dist/conversation-list/ConversationList.d.ts +124 -0
- package/dist/conversation-list/ConversationList.js +52 -0
- package/dist/conversation-list/index.cjs +1 -0
- package/dist/conversation-list/index.d.cts +1 -0
- package/dist/conversation-list/index.d.ts +1 -0
- package/dist/conversation-list/index.js +1 -0
- package/dist/dashboard-layout/DashboardLayout.cjs +6 -7
- package/dist/dashboard-layout/DashboardLayout.js +9 -10
- package/dist/empty-state/EmptyState.cjs +29 -0
- package/dist/empty-state/EmptyState.d.cts +69 -0
- package/dist/empty-state/EmptyState.d.ts +69 -0
- package/dist/empty-state/EmptyState.js +29 -0
- package/dist/empty-state/index.cjs +1 -0
- package/dist/empty-state/index.d.cts +1 -0
- package/dist/empty-state/index.d.ts +1 -0
- package/dist/empty-state/index.js +1 -0
- package/dist/filter-bar/FilterBar.cjs +44 -0
- package/dist/filter-bar/FilterBar.d.cts +110 -0
- package/dist/filter-bar/FilterBar.d.ts +110 -0
- package/dist/filter-bar/FilterBar.js +44 -0
- package/dist/filter-bar/index.cjs +1 -0
- package/dist/filter-bar/index.d.cts +1 -0
- package/dist/filter-bar/index.d.ts +1 -0
- package/dist/filter-bar/index.js +1 -0
- package/dist/forgot-password-page/ForgotPasswordPage.cjs +57 -0
- package/dist/forgot-password-page/ForgotPasswordPage.d.cts +95 -0
- package/dist/forgot-password-page/ForgotPasswordPage.d.ts +95 -0
- package/dist/forgot-password-page/ForgotPasswordPage.js +57 -0
- package/dist/forgot-password-page/index.cjs +1 -0
- package/dist/forgot-password-page/index.d.cts +1 -0
- package/dist/forgot-password-page/index.d.ts +1 -0
- package/dist/forgot-password-page/index.js +1 -0
- package/dist/form-section/FormSection.cjs +28 -0
- package/dist/form-section/FormSection.d.cts +63 -0
- package/dist/form-section/FormSection.d.ts +63 -0
- package/dist/form-section/FormSection.js +28 -0
- package/dist/form-section/index.cjs +1 -0
- package/dist/form-section/index.d.cts +1 -0
- package/dist/form-section/index.d.ts +1 -0
- package/dist/form-section/index.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +1 -1
- package/dist/internal/slots.cjs +1 -1
- package/dist/internal/slots.d.cts +2 -0
- package/dist/internal/slots.d.ts +2 -0
- package/dist/internal/slots.js +1 -1
- package/dist/notification-center/NotificationCenter.cjs +74 -0
- package/dist/notification-center/NotificationCenter.d.cts +147 -0
- package/dist/notification-center/NotificationCenter.d.ts +147 -0
- package/dist/notification-center/NotificationCenter.js +74 -0
- package/dist/notification-center/index.cjs +1 -0
- package/dist/notification-center/index.d.cts +1 -0
- package/dist/notification-center/index.d.ts +1 -0
- package/dist/notification-center/index.js +1 -0
- package/dist/onboarding-checklist/OnboardingChecklist.cjs +55 -0
- package/dist/onboarding-checklist/OnboardingChecklist.d.cts +89 -0
- package/dist/onboarding-checklist/OnboardingChecklist.d.ts +89 -0
- package/dist/onboarding-checklist/OnboardingChecklist.js +55 -0
- package/dist/onboarding-checklist/index.cjs +1 -0
- package/dist/onboarding-checklist/index.d.cts +1 -0
- package/dist/onboarding-checklist/index.d.ts +1 -0
- package/dist/onboarding-checklist/index.js +1 -0
- package/dist/reset-password-page/ResetPasswordPage.cjs +59 -0
- package/dist/reset-password-page/ResetPasswordPage.d.cts +104 -0
- package/dist/reset-password-page/ResetPasswordPage.d.ts +104 -0
- package/dist/reset-password-page/ResetPasswordPage.js +59 -0
- package/dist/reset-password-page/index.cjs +1 -0
- package/dist/reset-password-page/index.d.cts +1 -0
- package/dist/reset-password-page/index.d.ts +1 -0
- package/dist/reset-password-page/index.js +1 -0
- package/dist/sign-up-page/SignUpPage.cjs +97 -0
- package/dist/sign-up-page/SignUpPage.d.cts +133 -0
- package/dist/sign-up-page/SignUpPage.d.ts +133 -0
- package/dist/sign-up-page/SignUpPage.js +97 -0
- package/dist/sign-up-page/index.cjs +1 -0
- package/dist/sign-up-page/index.d.cts +1 -0
- package/dist/sign-up-page/index.d.ts +1 -0
- package/dist/sign-up-page/index.js +1 -0
- package/dist/stat-card/StatCard.cjs +61 -0
- package/dist/stat-card/StatCard.d.cts +90 -0
- package/dist/stat-card/StatCard.d.ts +90 -0
- package/dist/stat-card/StatCard.js +61 -0
- package/dist/stat-card/index.cjs +1 -0
- package/dist/stat-card/index.d.cts +1 -0
- package/dist/stat-card/index.d.ts +1 -0
- package/dist/stat-card/index.js +1 -0
- package/dist/usage-card/UsageCard.cjs +42 -0
- package/dist/usage-card/UsageCard.d.cts +81 -0
- package/dist/usage-card/UsageCard.d.ts +81 -0
- package/dist/usage-card/UsageCard.js +42 -0
- package/dist/usage-card/index.cjs +1 -0
- package/dist/usage-card/index.d.cts +1 -0
- package/dist/usage-card/index.d.ts +1 -0
- package/dist/usage-card/index.js +1 -0
- package/dist/usage-card/usage.cjs +1 -0
- package/dist/usage-card/usage.d.cts +18 -0
- package/dist/usage-card/usage.d.ts +18 -0
- package/dist/usage-card/usage.js +1 -0
- package/dist/user-menu/UserMenu.cjs +30 -0
- package/dist/user-menu/UserMenu.d.cts +84 -0
- package/dist/user-menu/UserMenu.d.ts +84 -0
- package/dist/user-menu/UserMenu.js +30 -0
- package/dist/user-menu/index.cjs +1 -0
- package/dist/user-menu/index.d.cts +1 -0
- package/dist/user-menu/index.d.ts +1 -0
- package/dist/user-menu/index.js +1 -0
- package/dist/verification-page/VerificationPage.cjs +63 -0
- package/dist/verification-page/VerificationPage.d.cts +149 -0
- package/dist/verification-page/VerificationPage.d.ts +149 -0
- package/dist/verification-page/VerificationPage.js +63 -0
- package/dist/verification-page/index.cjs +1 -0
- package/dist/verification-page/index.d.cts +1 -0
- package/dist/verification-page/index.d.ts +1 -0
- package/dist/verification-page/index.js +1 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.cjs +69 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.d.cts +165 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.d.ts +165 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.js +69 -0
- package/dist/workspace-switcher/index.cjs +1 -0
- package/dist/workspace-switcher/index.d.cts +1 -0
- package/dist/workspace-switcher/index.d.ts +1 -0
- package/dist/workspace-switcher/index.js +1 -0
- package/package.json +275 -9
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var p=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var i=(l,n,a,o)=>{for(var r=o>1?void 0:o?g(n,a):n,h=l.length-1,u;h>=0;h--)(u=l[h])&&(r=(o?u(n,a,r):u(r))||r);return o&&r&&p(n,a,r),r};import{html as s,LitElement as m,nothing as t}from"lit";import{property as d}from"lit/decorators.js";import{customElement as v}from"../internal/define.js";import{placeSlotted as x}from"../internal/slots.js";import"@skdx/web-components/progress";import"@skdx/web-components/skeleton";import"@skdx/web-components/text";import"@skdx/web-components/visually-hidden";var b="data-skdx-stat-card-generated",k=0;function c(l,n,a){a===void 0?l.removeAttribute(n):l.setAttribute(n,a)}var e=class extends m{constructor(){super(...arguments);this.loading=!1;this.labelId=`skdx-stat-card-label-${++k}`}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.setAttribute("role","group"),this.setAttribute("aria-labelledby",this.labelId),queueMicrotask(()=>this.requestUpdate())}region(a){return this.querySelector(`.skdx-stat-card__${a}`)}hasSlotted(a){return this.querySelector(`[slot="${a}"]`)!==null}updated(){c(this,"data-trend",this.trend),c(this,"data-sentiment",this.sentiment),c(this,"data-state",this.loading?"loading":void 0),c(this,"aria-busy",this.loading?"true":void 0),x(this,b,{value:this.querySelector(".skdx-stat-card__value skdx-text"),icon:this.region("icon"),"trend-icon":this.region("trend-icon"),visual:this.region("visual"),footer:this.region("footer"),actions:this.region("actions")},null)}trendRegion(){return s`<span
|
|
2
|
+
class="skdx-stat-card__trend"
|
|
3
|
+
data-trend=${this.trend??t}
|
|
4
|
+
data-sentiment=${this.sentiment??t}
|
|
5
|
+
>
|
|
6
|
+
${this.hasSlotted("trend-icon")?s`<span
|
|
7
|
+
class="skdx-stat-card__trend-icon"
|
|
8
|
+
aria-hidden="true"
|
|
9
|
+
></span>`:t}${this.changeLabel?s`<skdx-visually-hidden>${this.changeLabel}</skdx-visually-hidden>`:t}${this.change}
|
|
10
|
+
</span>`}render(){return s`
|
|
11
|
+
<div
|
|
12
|
+
class="skdx-stat-card__header"
|
|
13
|
+
data-skdx-stat-card-generated
|
|
14
|
+
>
|
|
15
|
+
${this.hasSlotted("icon")?s`<span
|
|
16
|
+
class="skdx-stat-card__icon"
|
|
17
|
+
aria-hidden="true"
|
|
18
|
+
></span>`:t}
|
|
19
|
+
<span
|
|
20
|
+
class="skdx-stat-card__label"
|
|
21
|
+
id=${this.labelId}
|
|
22
|
+
>${this.label??""}</span
|
|
23
|
+
>
|
|
24
|
+
${this.hasSlotted("actions")?s`<div class="skdx-stat-card__actions"></div>`:t}
|
|
25
|
+
</div>
|
|
26
|
+
<div
|
|
27
|
+
class="skdx-stat-card__body"
|
|
28
|
+
data-skdx-stat-card-generated
|
|
29
|
+
>
|
|
30
|
+
<span class="skdx-stat-card__value">
|
|
31
|
+
${this.loading?s`<skdx-skeleton .shape=${"line"}></skdx-skeleton>`:t}
|
|
32
|
+
<skdx-text
|
|
33
|
+
as="span"
|
|
34
|
+
.variant=${"numeric"}
|
|
35
|
+
?hidden=${this.loading}
|
|
36
|
+
></skdx-text>
|
|
37
|
+
</span>
|
|
38
|
+
${this.change!==void 0&&!this.loading?this.trendRegion():t}
|
|
39
|
+
</div>
|
|
40
|
+
${this.description?s`<skdx-text
|
|
41
|
+
class="skdx-stat-card__description"
|
|
42
|
+
as="p"
|
|
43
|
+
.tone=${"muted"}
|
|
44
|
+
data-skdx-stat-card-generated
|
|
45
|
+
>${this.description}</skdx-text
|
|
46
|
+
>`:t}
|
|
47
|
+
${typeof this.progress=="number"?s`<skdx-progress
|
|
48
|
+
class="skdx-stat-card__progress"
|
|
49
|
+
.value=${this.progress}
|
|
50
|
+
aria-labelledby=${this.labelId}
|
|
51
|
+
data-skdx-stat-card-generated
|
|
52
|
+
></skdx-progress>`:t}
|
|
53
|
+
${this.hasSlotted("visual")?s`<div
|
|
54
|
+
class="skdx-stat-card__visual"
|
|
55
|
+
data-skdx-stat-card-generated
|
|
56
|
+
></div>`:t}
|
|
57
|
+
${this.hasSlotted("footer")?s`<div
|
|
58
|
+
class="skdx-stat-card__footer"
|
|
59
|
+
data-skdx-stat-card-generated
|
|
60
|
+
></div>`:t}
|
|
61
|
+
`}};i([d({type:String})],e.prototype,"label",2),i([d({type:String})],e.prototype,"change",2),i([d({type:String})],e.prototype,"trend",2),i([d({type:String})],e.prototype,"sentiment",2),i([d({type:String,attribute:"change-label"})],e.prototype,"changeLabel",2),i([d({type:String})],e.prototype,"description",2),i([d({type:Number})],e.prototype,"progress",2),i([d({type:Boolean})],e.prototype,"loading",2),e=i([v("skdx-stat-card","stat-card","root")],e);export{e as SkdxStatCard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var m=(t,r)=>{for(var d in r)o(t,d,{get:r[d],enumerable:!0})},p=(t,r,d,x)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of f(r))!k.call(t,a)&&a!==d&&o(t,a,{get:()=>r[a],enumerable:!(x=e(r,a))||x.enumerable});return t};var C=t=>p(o({},"__esModule",{value:!0}),t);var b={};m(b,{SkdxStatCard:()=>S.SkdxStatCard});module.exports=C(b);var S=require("./StatCard.cjs");0&&(module.exports={SkdxStatCard});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxStatCard } from './StatCard.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxStatCard } from './StatCard.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SkdxStatCard as a}from"./StatCard.js";export{a as SkdxStatCard};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";var m=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var $=(r,t)=>{for(var e in t)m(r,e,{get:t[e],enumerable:!0})},_=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of v(t))!x.call(r,i)&&i!==e&&m(r,i,{get:()=>t[i],enumerable:!(n=c(t,i))||n.enumerable});return r};var k=r=>_(m({},"__esModule",{value:!0}),r),d=(r,t,e,n)=>{for(var i=n>1?void 0:n?c(t,e):t,u=r.length-1,o;u>=0;u--)(o=r[u])&&(i=(n?o(t,e,i):o(i))||i);return n&&i&&m(t,e,i),i};var T={};$(T,{SkdxUsageCard:()=>a});module.exports=k(T);var s=require("lit"),l=require("lit/decorators.js"),h=require("../internal/define.cjs"),f=require("../internal/slots.cjs"),g=require("./usage.cjs"),R=require("@skdx/web-components/progress"),A=require("@skdx/web-components/text");var y="data-skdx-usage-card-generated",L=0;function p(r,t,e){e===void 0?r.removeAttribute(t):r.setAttribute(t,e)}var a=class extends s.LitElement{constructor(){super(...arguments);this.unlimitedLabel="Unlimited";this.labelId=`skdx-usage-card-label-${++L}`}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.setAttribute("role","group"),this.setAttribute("aria-labelledby",this.labelId),queueMicrotask(()=>this.requestUpdate())}region(e){return this.querySelector(`.skdx-usage-card__${e}`)}hasSlotted(e){return this.querySelector(`[slot="${e}"]`)!==null}get format(){return this.formatValue??String}get reading(){if(this.limit===null)return{limitText:this.unlimitedLabel,overLimit:!1,range:null};if(this.limit===void 0)return{limitText:void 0,overLimit:!1,range:null};let e=(0,g.usageMeter)(this.used??0,this.limit);return{limitText:`/ ${this.format(e.limit)}`,overLimit:e.overLimit,range:e.range}}updated(){p(this,"data-state",this.reading.overLimit?"over-limit":void 0),p(this,"data-status",this.status),(0,f.placeSlotted)(this,y,{actions:this.region("actions"),footer:this.region("footer")},null)}render(){let{limitText:e,range:n}=this.reading,i=this.format,u=this.unit?` ${this.unit}`:"";return s.html`
|
|
2
|
+
<div
|
|
3
|
+
class="skdx-usage-card__header"
|
|
4
|
+
data-skdx-usage-card-generated
|
|
5
|
+
>
|
|
6
|
+
<span
|
|
7
|
+
class="skdx-usage-card__label"
|
|
8
|
+
id=${this.labelId}
|
|
9
|
+
>${this.label??""}</span
|
|
10
|
+
>
|
|
11
|
+
${this.hasSlotted("actions")?s.html`<div class="skdx-usage-card__actions"></div>`:s.nothing}
|
|
12
|
+
</div>
|
|
13
|
+
<div
|
|
14
|
+
class="skdx-usage-card__value"
|
|
15
|
+
data-skdx-usage-card-generated
|
|
16
|
+
>
|
|
17
|
+
<span class="skdx-usage-card__used">${i((0,g.normalizeUsage)(this.used??0))}</span>
|
|
18
|
+
${e===void 0?s.nothing:s.html`<span class="skdx-usage-card__limit">${e}</span>`}
|
|
19
|
+
${this.unit?s.html`<span class="skdx-usage-card__unit">${this.unit}</span>`:s.nothing}
|
|
20
|
+
</div>
|
|
21
|
+
${n?s.html`<skdx-progress
|
|
22
|
+
class="skdx-usage-card__progress"
|
|
23
|
+
role="meter"
|
|
24
|
+
min="0"
|
|
25
|
+
.max=${n.max}
|
|
26
|
+
.value=${n.value}
|
|
27
|
+
aria-labelledby=${this.labelId}
|
|
28
|
+
.getValueLabel=${(o,E,b)=>`${i(o)} / ${i(b)}${u}`}
|
|
29
|
+
data-skdx-usage-card-generated
|
|
30
|
+
></skdx-progress>`:s.nothing}
|
|
31
|
+
${this.description?s.html`<skdx-text
|
|
32
|
+
class="skdx-usage-card__description"
|
|
33
|
+
as="p"
|
|
34
|
+
.tone=${"muted"}
|
|
35
|
+
data-skdx-usage-card-generated
|
|
36
|
+
>${this.description}</skdx-text
|
|
37
|
+
>`:s.nothing}
|
|
38
|
+
${this.hasSlotted("footer")?s.html`<div
|
|
39
|
+
class="skdx-usage-card__footer"
|
|
40
|
+
data-skdx-usage-card-generated
|
|
41
|
+
></div>`:s.nothing}
|
|
42
|
+
`}};d([(0,l.property)({type:String})],a.prototype,"label",2),d([(0,l.property)({type:Number})],a.prototype,"used",2),d([(0,l.property)({type:Number})],a.prototype,"limit",2),d([(0,l.property)({type:String})],a.prototype,"unit",2),d([(0,l.property)({attribute:!1})],a.prototype,"formatValue",2),d([(0,l.property)({type:String,attribute:"unlimited-label"})],a.prototype,"unlimitedLabel",2),d([(0,l.property)({type:String})],a.prototype,"description",2),d([(0,l.property)({type:String})],a.prototype,"status",2),a=d([(0,h.customElement)("skdx-usage-card","usage-card","root")],a);0&&(module.exports={SkdxUsageCard});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/progress';
|
|
3
|
+
import '@skdx/web-components/text';
|
|
4
|
+
/**
|
|
5
|
+
* Quota tile block: a label, the amount used against a limit, a derived meter
|
|
6
|
+
* and a status colour, all inside one `role="group"` named by its own label.
|
|
7
|
+
* Handles a finite, zero, unlimited or unknown limit without division errors,
|
|
8
|
+
* and derives over-limit from the numbers rather than a status property.
|
|
9
|
+
*
|
|
10
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
11
|
+
* targets: `.skdx-usage-card` on the host, then `__header`, `__label`,
|
|
12
|
+
* `__actions`, `__value`, `__used`, `__limit`, `__unit`, `__progress`,
|
|
13
|
+
* `__description` and `__footer`. `data-state` and `data-status` sit on the
|
|
14
|
+
* host for the skin to read.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <skdx-usage-card
|
|
19
|
+
* label="Storage"
|
|
20
|
+
* used="42"
|
|
21
|
+
* limit="50"
|
|
22
|
+
* unit="GB"
|
|
23
|
+
* ></skdx-usage-card>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @slot actions - Controls rendered at the end of the header, such as a manage-plan link.
|
|
27
|
+
* @slot footer - Content rendered in a footer region below the card, such as renewal metadata.
|
|
28
|
+
*/
|
|
29
|
+
export declare class SkdxUsageCard extends LitElement {
|
|
30
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
31
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
32
|
+
/** Name of the quota, rendered into the label that names the group through `aria-labelledby`. */
|
|
33
|
+
label: string;
|
|
34
|
+
/** The current amount consumed, formatted by `formatValue` for the value region and the meter. */
|
|
35
|
+
used: number;
|
|
36
|
+
/**
|
|
37
|
+
* The finite cap `used` is measured against; `null` renders `unlimitedLabel` instead of a number.
|
|
38
|
+
* @default undefined — the limit is unknown, so no limit text or meter renders.
|
|
39
|
+
*/
|
|
40
|
+
limit?: number | null | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Unit label rendered after the limit text, such as "GB" or "seats".
|
|
43
|
+
* @default undefined — no unit region renders.
|
|
44
|
+
*/
|
|
45
|
+
unit?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Formats `used` and `limit` for the consumer's own locale and precision.
|
|
48
|
+
* @default String — the raw number is rendered as-is.
|
|
49
|
+
*/
|
|
50
|
+
formatValue?: ((value: number) => string) | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Text rendered in place of a limit number when `limit` is `null`.
|
|
53
|
+
* @default 'Unlimited'
|
|
54
|
+
*/
|
|
55
|
+
unlimitedLabel: string;
|
|
56
|
+
/**
|
|
57
|
+
* Supporting copy rendered below the meter, in the skin's muted tone.
|
|
58
|
+
* @default undefined — no description region renders.
|
|
59
|
+
*/
|
|
60
|
+
description?: string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Colour role written to `data-status`, tinting the meter fill and the used amount.
|
|
63
|
+
* @default undefined — the skin's own default colour.
|
|
64
|
+
*/
|
|
65
|
+
status?: 'info' | 'success' | 'warning' | 'danger' | (string & {}) | undefined;
|
|
66
|
+
/** Generated label id, published as the group's `aria-labelledby`. */
|
|
67
|
+
private readonly labelId;
|
|
68
|
+
connectedCallback(): void;
|
|
69
|
+
private region;
|
|
70
|
+
/** Whether the consumer supplied anything for `name` — still true once it has been moved in. */
|
|
71
|
+
private hasSlotted;
|
|
72
|
+
private get format();
|
|
73
|
+
private get reading();
|
|
74
|
+
protected updated(): void;
|
|
75
|
+
render(): TemplateResult;
|
|
76
|
+
}
|
|
77
|
+
declare global {
|
|
78
|
+
interface HTMLElementTagNameMap {
|
|
79
|
+
'skdx-usage-card': SkdxUsageCard;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/progress';
|
|
3
|
+
import '@skdx/web-components/text';
|
|
4
|
+
/**
|
|
5
|
+
* Quota tile block: a label, the amount used against a limit, a derived meter
|
|
6
|
+
* and a status colour, all inside one `role="group"` named by its own label.
|
|
7
|
+
* Handles a finite, zero, unlimited or unknown limit without division errors,
|
|
8
|
+
* and derives over-limit from the numbers rather than a status property.
|
|
9
|
+
*
|
|
10
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
11
|
+
* targets: `.skdx-usage-card` on the host, then `__header`, `__label`,
|
|
12
|
+
* `__actions`, `__value`, `__used`, `__limit`, `__unit`, `__progress`,
|
|
13
|
+
* `__description` and `__footer`. `data-state` and `data-status` sit on the
|
|
14
|
+
* host for the skin to read.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <skdx-usage-card
|
|
19
|
+
* label="Storage"
|
|
20
|
+
* used="42"
|
|
21
|
+
* limit="50"
|
|
22
|
+
* unit="GB"
|
|
23
|
+
* ></skdx-usage-card>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @slot actions - Controls rendered at the end of the header, such as a manage-plan link.
|
|
27
|
+
* @slot footer - Content rendered in a footer region below the card, such as renewal metadata.
|
|
28
|
+
*/
|
|
29
|
+
export declare class SkdxUsageCard extends LitElement {
|
|
30
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
31
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
32
|
+
/** Name of the quota, rendered into the label that names the group through `aria-labelledby`. */
|
|
33
|
+
label: string;
|
|
34
|
+
/** The current amount consumed, formatted by `formatValue` for the value region and the meter. */
|
|
35
|
+
used: number;
|
|
36
|
+
/**
|
|
37
|
+
* The finite cap `used` is measured against; `null` renders `unlimitedLabel` instead of a number.
|
|
38
|
+
* @default undefined — the limit is unknown, so no limit text or meter renders.
|
|
39
|
+
*/
|
|
40
|
+
limit?: number | null | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Unit label rendered after the limit text, such as "GB" or "seats".
|
|
43
|
+
* @default undefined — no unit region renders.
|
|
44
|
+
*/
|
|
45
|
+
unit?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Formats `used` and `limit` for the consumer's own locale and precision.
|
|
48
|
+
* @default String — the raw number is rendered as-is.
|
|
49
|
+
*/
|
|
50
|
+
formatValue?: ((value: number) => string) | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Text rendered in place of a limit number when `limit` is `null`.
|
|
53
|
+
* @default 'Unlimited'
|
|
54
|
+
*/
|
|
55
|
+
unlimitedLabel: string;
|
|
56
|
+
/**
|
|
57
|
+
* Supporting copy rendered below the meter, in the skin's muted tone.
|
|
58
|
+
* @default undefined — no description region renders.
|
|
59
|
+
*/
|
|
60
|
+
description?: string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Colour role written to `data-status`, tinting the meter fill and the used amount.
|
|
63
|
+
* @default undefined — the skin's own default colour.
|
|
64
|
+
*/
|
|
65
|
+
status?: 'info' | 'success' | 'warning' | 'danger' | (string & {}) | undefined;
|
|
66
|
+
/** Generated label id, published as the group's `aria-labelledby`. */
|
|
67
|
+
private readonly labelId;
|
|
68
|
+
connectedCallback(): void;
|
|
69
|
+
private region;
|
|
70
|
+
/** Whether the consumer supplied anything for `name` — still true once it has been moved in. */
|
|
71
|
+
private hasSlotted;
|
|
72
|
+
private get format();
|
|
73
|
+
private get reading();
|
|
74
|
+
protected updated(): void;
|
|
75
|
+
render(): TemplateResult;
|
|
76
|
+
}
|
|
77
|
+
declare global {
|
|
78
|
+
interface HTMLElementTagNameMap {
|
|
79
|
+
'skdx-usage-card': SkdxUsageCard;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var s=(l,r,e,a)=>{for(var i=a>1?void 0:a?h(r,e):r,o=l.length-1,m;o>=0;o--)(m=l[o])&&(i=(a?m(r,e,i):m(i))||i);return a&&i&&p(r,e,i),i};import{html as d,LitElement as f,nothing as u}from"lit";import{property as n}from"lit/decorators.js";import{customElement as b}from"../internal/define.js";import{placeSlotted as v}from"../internal/slots.js";import{normalizeUsage as x,usageMeter as $}from"./usage.js";import"@skdx/web-components/progress";import"@skdx/web-components/text";var _="data-skdx-usage-card-generated",k=0;function g(l,r,e){e===void 0?l.removeAttribute(r):l.setAttribute(r,e)}var t=class extends f{constructor(){super(...arguments);this.unlimitedLabel="Unlimited";this.labelId=`skdx-usage-card-label-${++k}`}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.setAttribute("role","group"),this.setAttribute("aria-labelledby",this.labelId),queueMicrotask(()=>this.requestUpdate())}region(e){return this.querySelector(`.skdx-usage-card__${e}`)}hasSlotted(e){return this.querySelector(`[slot="${e}"]`)!==null}get format(){return this.formatValue??String}get reading(){if(this.limit===null)return{limitText:this.unlimitedLabel,overLimit:!1,range:null};if(this.limit===void 0)return{limitText:void 0,overLimit:!1,range:null};let e=$(this.used??0,this.limit);return{limitText:`/ ${this.format(e.limit)}`,overLimit:e.overLimit,range:e.range}}updated(){g(this,"data-state",this.reading.overLimit?"over-limit":void 0),g(this,"data-status",this.status),v(this,_,{actions:this.region("actions"),footer:this.region("footer")},null)}render(){let{limitText:e,range:a}=this.reading,i=this.format,o=this.unit?` ${this.unit}`:"";return d`
|
|
2
|
+
<div
|
|
3
|
+
class="skdx-usage-card__header"
|
|
4
|
+
data-skdx-usage-card-generated
|
|
5
|
+
>
|
|
6
|
+
<span
|
|
7
|
+
class="skdx-usage-card__label"
|
|
8
|
+
id=${this.labelId}
|
|
9
|
+
>${this.label??""}</span
|
|
10
|
+
>
|
|
11
|
+
${this.hasSlotted("actions")?d`<div class="skdx-usage-card__actions"></div>`:u}
|
|
12
|
+
</div>
|
|
13
|
+
<div
|
|
14
|
+
class="skdx-usage-card__value"
|
|
15
|
+
data-skdx-usage-card-generated
|
|
16
|
+
>
|
|
17
|
+
<span class="skdx-usage-card__used">${i(x(this.used??0))}</span>
|
|
18
|
+
${e===void 0?u:d`<span class="skdx-usage-card__limit">${e}</span>`}
|
|
19
|
+
${this.unit?d`<span class="skdx-usage-card__unit">${this.unit}</span>`:u}
|
|
20
|
+
</div>
|
|
21
|
+
${a?d`<skdx-progress
|
|
22
|
+
class="skdx-usage-card__progress"
|
|
23
|
+
role="meter"
|
|
24
|
+
min="0"
|
|
25
|
+
.max=${a.max}
|
|
26
|
+
.value=${a.value}
|
|
27
|
+
aria-labelledby=${this.labelId}
|
|
28
|
+
.getValueLabel=${(m,y,c)=>`${i(m)} / ${i(c)}${o}`}
|
|
29
|
+
data-skdx-usage-card-generated
|
|
30
|
+
></skdx-progress>`:u}
|
|
31
|
+
${this.description?d`<skdx-text
|
|
32
|
+
class="skdx-usage-card__description"
|
|
33
|
+
as="p"
|
|
34
|
+
.tone=${"muted"}
|
|
35
|
+
data-skdx-usage-card-generated
|
|
36
|
+
>${this.description}</skdx-text
|
|
37
|
+
>`:u}
|
|
38
|
+
${this.hasSlotted("footer")?d`<div
|
|
39
|
+
class="skdx-usage-card__footer"
|
|
40
|
+
data-skdx-usage-card-generated
|
|
41
|
+
></div>`:u}
|
|
42
|
+
`}};s([n({type:String})],t.prototype,"label",2),s([n({type:Number})],t.prototype,"used",2),s([n({type:Number})],t.prototype,"limit",2),s([n({type:String})],t.prototype,"unit",2),s([n({attribute:!1})],t.prototype,"formatValue",2),s([n({type:String,attribute:"unlimited-label"})],t.prototype,"unlimitedLabel",2),s([n({type:String})],t.prototype,"description",2),s([n({type:String})],t.prototype,"status",2),t=s([b("skdx-usage-card","usage-card","root")],t);export{t as SkdxUsageCard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(a,r)=>{for(var e in r)o(a,e,{get:r[e],enumerable:!0})},s=(a,r,e,x)=>{if(r&&typeof r=="object"||typeof r=="function")for(let d of k(r))!m.call(a,d)&&d!==e&&o(a,d,{get:()=>r[d],enumerable:!(x=g(r,d))||x.enumerable});return a};var t=a=>s(o({},"__esModule",{value:!0}),a);var C={};p(C,{SkdxUsageCard:()=>f.SkdxUsageCard});module.exports=t(C);var f=require("./UsageCard.cjs");0&&(module.exports={SkdxUsageCard});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxUsageCard } from './UsageCard.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxUsageCard } from './UsageCard.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SkdxUsageCard as d}from"./UsageCard.js";export{d as SkdxUsageCard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var l=(e,r)=>{for(var n in r)i(e,n,{get:r[n],enumerable:!0})},g=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of o(r))!s.call(e,a)&&a!==n&&i(e,a,{get:()=>r[a],enumerable:!(t=u(r,a))||t.enumerable});return e};var b=e=>g(i({},"__esModule",{value:!0}),e);var x={};l(x,{normalizeUsage:()=>m,usageMeter:()=>f});module.exports=b(x);function m(e){return Number.isNaN(e)?0:Math.max(e,0)}function f(e,r){let n=m(e),t=m(r);return t===0?{limit:t,overLimit:n>0,range:null}:{limit:t,overLimit:n>t,range:{max:t,value:Math.min(n,t)}}}0&&(module.exports={normalizeUsage,usageMeter});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @internal Clamps a raw amount into a safe non-negative number: `NaN` becomes `0`, a negative clamps to `0`. */
|
|
2
|
+
export declare function normalizeUsage(value: number): number;
|
|
3
|
+
/** @internal The `[0, max]` range a finite, positive limit renders as a meter. */
|
|
4
|
+
export interface UsageMeterRange {
|
|
5
|
+
max: number;
|
|
6
|
+
value: number;
|
|
7
|
+
}
|
|
8
|
+
/** @internal What a finite limit resolves to: its normalized value, whether usage exceeds it, and the meter range to render. */
|
|
9
|
+
export interface UsageMeterResult {
|
|
10
|
+
limit: number;
|
|
11
|
+
overLimit: boolean;
|
|
12
|
+
range: UsageMeterRange | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal Derives the meter range and over-limit flag for a finite limit.
|
|
16
|
+
* A zero limit renders no meter but counts as over-limit as soon as anything is used.
|
|
17
|
+
*/
|
|
18
|
+
export declare function usageMeter(used: number, limit: number): UsageMeterResult;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @internal Clamps a raw amount into a safe non-negative number: `NaN` becomes `0`, a negative clamps to `0`. */
|
|
2
|
+
export declare function normalizeUsage(value: number): number;
|
|
3
|
+
/** @internal The `[0, max]` range a finite, positive limit renders as a meter. */
|
|
4
|
+
export interface UsageMeterRange {
|
|
5
|
+
max: number;
|
|
6
|
+
value: number;
|
|
7
|
+
}
|
|
8
|
+
/** @internal What a finite limit resolves to: its normalized value, whether usage exceeds it, and the meter range to render. */
|
|
9
|
+
export interface UsageMeterResult {
|
|
10
|
+
limit: number;
|
|
11
|
+
overLimit: boolean;
|
|
12
|
+
range: UsageMeterRange | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal Derives the meter range and over-limit flag for a finite limit.
|
|
16
|
+
* A zero limit renders no meter but counts as over-limit as soon as anything is used.
|
|
17
|
+
*/
|
|
18
|
+
export declare function usageMeter(used: number, limit: number): UsageMeterResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(r){return Number.isNaN(r)?0:Math.max(r,0)}function i(r,a){let t=n(r),e=n(a);return e===0?{limit:e,overLimit:t>0,range:null}:{limit:e,overLimit:t>e,range:{max:e,value:Math.min(t,e)}}}export{n as normalizeUsage,i as usageMeter};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";var m=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var k=(t,e)=>{for(var a in e)m(t,a,{get:e[a],enumerable:!0})},f=(t,e,a,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of h(e))!v.call(t,r)&&r!==a&&m(t,r,{get:()=>e[r],enumerable:!(d=p(e,r))||d.enumerable});return t};var x=t=>f(m({},"__esModule",{value:!0}),t),i=(t,e,a,d)=>{for(var r=d>1?void 0:d?p(e,a):e,u=t.length-1,l;u>=0;u--)(l=t[u])&&(r=(d?l(e,a,r):l(r))||r);return d&&r&&m(e,a,r),r};var T={};k(T,{SkdxUserMenu:()=>s});module.exports=x(T);var n=require("lit"),o=require("lit/decorators.js"),c=require("../internal/define.cjs"),g=require("../internal/slots.cjs"),y=require("@skdx/web-components/avatar"),E=require("@skdx/web-components/primitives/menu");var _="data-skdx-user-menu-generated",b={fromAttribute:t=>t!=="false"},s=class extends n.LitElement{constructor(){super(...arguments);this.defaultOpen=!1;this.side="bottom";this.align="end"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.requestUpdate())}get hasTrigger(){return this.querySelector('[slot="trigger"]')!==null}updated(){this.variant&&!this.hasTrigger?this.setAttribute("data-variant",this.variant):this.removeAttribute("data-variant");let a=this.querySelector("skdx-menu-trigger");(0,g.placeSlotted)(this,_,{trigger:a,status:a},this.querySelector("skdx-menu-content"))}derivedTrigger(){return n.html`<skdx-avatar
|
|
2
|
+
class="skdx-user-menu__avatar"
|
|
3
|
+
src=${this.avatarSrc??n.nothing}
|
|
4
|
+
name=${this.name??n.nothing}
|
|
5
|
+
decorative
|
|
6
|
+
.size=${"sm"}
|
|
7
|
+
></skdx-avatar>
|
|
8
|
+
<span class="skdx-user-menu__identity">
|
|
9
|
+
<span class="skdx-user-menu__name">${this.name??""}</span>
|
|
10
|
+
${this.description?n.html`<span class="skdx-user-menu__description">${this.description}</span>`:n.nothing}
|
|
11
|
+
</span>`}render(){return n.html`
|
|
12
|
+
<skdx-menu-root
|
|
13
|
+
data-skdx-user-menu-generated
|
|
14
|
+
.open=${this.open}
|
|
15
|
+
?default-open=${this.defaultOpen}
|
|
16
|
+
>
|
|
17
|
+
<skdx-menu-trigger>${this.hasTrigger?n.nothing:this.derivedTrigger()}</skdx-menu-trigger>
|
|
18
|
+
<skdx-menu-content
|
|
19
|
+
class="skdx-user-menu__content"
|
|
20
|
+
side=${this.side}
|
|
21
|
+
align=${this.align}
|
|
22
|
+
>
|
|
23
|
+
<skdx-menu-label class="skdx-user-menu__header">
|
|
24
|
+
<span class="skdx-user-menu__name">${this.name??""}</span>
|
|
25
|
+
${this.description?n.html`<span class="skdx-user-menu__description">${this.description}</span>`:n.nothing}
|
|
26
|
+
</skdx-menu-label>
|
|
27
|
+
<skdx-menu-separator></skdx-menu-separator>
|
|
28
|
+
</skdx-menu-content>
|
|
29
|
+
</skdx-menu-root>
|
|
30
|
+
`}};i([(0,o.property)({type:String})],s.prototype,"name",2),i([(0,o.property)({type:String})],s.prototype,"description",2),i([(0,o.property)({type:String,attribute:"avatar-src"})],s.prototype,"avatarSrc",2),i([(0,o.property)({type:String})],s.prototype,"variant",2),i([(0,o.property)({converter:b})],s.prototype,"open",2),i([(0,o.property)({type:Boolean,attribute:"default-open"})],s.prototype,"defaultOpen",2),i([(0,o.property)({type:String})],s.prototype,"side",2),i([(0,o.property)({type:String})],s.prototype,"align",2),s=i([(0,c.customElement)("skdx-user-menu","user-menu","root")],s);0&&(module.exports={SkdxUserMenu});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/avatar';
|
|
3
|
+
import '@skdx/web-components/primitives/menu';
|
|
4
|
+
/**
|
|
5
|
+
* The signed-in user's menu: a derived trigger showing an avatar, name and
|
|
6
|
+
* description that opens a panel repeating the identity above the
|
|
7
|
+
* application's own entries.
|
|
8
|
+
*
|
|
9
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
10
|
+
* targets: `.skdx-user-menu` on the host, then `__avatar`, `__identity`,
|
|
11
|
+
* `__name`, `__description`, `__content` and `__header`. `data-variant` sits on
|
|
12
|
+
* the host while the derived trigger renders.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```html
|
|
16
|
+
* <skdx-user-menu name="Ada Lovelace" description="ada@example.com" avatar-src="/ada.png">
|
|
17
|
+
* <skdx-menu-item>Profile</skdx-menu-item>
|
|
18
|
+
* <skdx-menu-item>Sign out</skdx-menu-item>
|
|
19
|
+
* </skdx-user-menu>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @slot - The application's own menu entries, rendered below the repeated identity header.
|
|
23
|
+
* @slot trigger - Content that replaces the derived avatar-and-identity trigger entirely.
|
|
24
|
+
* @slot status - An extra indicator rendered after the identity in the trigger.
|
|
25
|
+
* @fires open-change - Fires with the new open state whenever the trigger opens or closes the menu.
|
|
26
|
+
* @fires open-change-complete - Fires with the new open state once the panel's enter or exit animation has settled.
|
|
27
|
+
* @fires escape-key-down - Fires when Escape is pressed while the menu is open; `preventDefault()` keeps it open.
|
|
28
|
+
* @fires pointer-down-outside - Fires on a pointer-down outside the panel while open; `preventDefault()` keeps it open.
|
|
29
|
+
* @fires focus-outside - Fires when focus moves outside the panel while open; `preventDefault()` keeps it open.
|
|
30
|
+
* @fires interact-outside - Fires for either kind of outside interaction, just before the specific event.
|
|
31
|
+
* @fires close-auto-focus - Fires before focus returns to the trigger on close; `preventDefault()` suppresses that return.
|
|
32
|
+
*/
|
|
33
|
+
export declare class SkdxUserMenu extends LitElement {
|
|
34
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
35
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
36
|
+
/** The signed-in user's name, rendered in the trigger and repeated in the menu header. */
|
|
37
|
+
name: string;
|
|
38
|
+
/**
|
|
39
|
+
* Secondary text such as an email or role, rendered below the name in the trigger and the header.
|
|
40
|
+
* @default undefined — no description renders in either place.
|
|
41
|
+
*/
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Source of the identity image, passed straight through to the derived Avatar.
|
|
45
|
+
* @default undefined — the Avatar renders its initials fallback.
|
|
46
|
+
*/
|
|
47
|
+
avatarSrc?: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Visual rung written to `data-variant`; `'compact'` visually hides the identity text while keeping it as the accessible name.
|
|
50
|
+
* @default undefined — the identity text stays visible.
|
|
51
|
+
*/
|
|
52
|
+
variant?: 'compact' | (string & {}) | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the menu is open, for controlled usage paired with `open-change`.
|
|
55
|
+
* @default undefined — uncontrolled, following `defaultOpen`.
|
|
56
|
+
*/
|
|
57
|
+
open?: boolean | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the menu starts open, for uncontrolled usage.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
defaultOpen: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Which side of the trigger the menu panel opens on.
|
|
65
|
+
* @default 'bottom'
|
|
66
|
+
*/
|
|
67
|
+
side: 'top' | 'right' | 'bottom' | 'left';
|
|
68
|
+
/**
|
|
69
|
+
* Alignment of the menu panel relative to the side it opens on.
|
|
70
|
+
* @default 'end'
|
|
71
|
+
*/
|
|
72
|
+
align: 'start' | 'center' | 'end';
|
|
73
|
+
connectedCallback(): void;
|
|
74
|
+
/** Whether the consumer supplied their own trigger — still true once it has been moved in. */
|
|
75
|
+
private get hasTrigger();
|
|
76
|
+
protected updated(): void;
|
|
77
|
+
private derivedTrigger;
|
|
78
|
+
render(): TemplateResult;
|
|
79
|
+
}
|
|
80
|
+
declare global {
|
|
81
|
+
interface HTMLElementTagNameMap {
|
|
82
|
+
'skdx-user-menu': SkdxUserMenu;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/avatar';
|
|
3
|
+
import '@skdx/web-components/primitives/menu';
|
|
4
|
+
/**
|
|
5
|
+
* The signed-in user's menu: a derived trigger showing an avatar, name and
|
|
6
|
+
* description that opens a panel repeating the identity above the
|
|
7
|
+
* application's own entries.
|
|
8
|
+
*
|
|
9
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
10
|
+
* targets: `.skdx-user-menu` on the host, then `__avatar`, `__identity`,
|
|
11
|
+
* `__name`, `__description`, `__content` and `__header`. `data-variant` sits on
|
|
12
|
+
* the host while the derived trigger renders.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```html
|
|
16
|
+
* <skdx-user-menu name="Ada Lovelace" description="ada@example.com" avatar-src="/ada.png">
|
|
17
|
+
* <skdx-menu-item>Profile</skdx-menu-item>
|
|
18
|
+
* <skdx-menu-item>Sign out</skdx-menu-item>
|
|
19
|
+
* </skdx-user-menu>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @slot - The application's own menu entries, rendered below the repeated identity header.
|
|
23
|
+
* @slot trigger - Content that replaces the derived avatar-and-identity trigger entirely.
|
|
24
|
+
* @slot status - An extra indicator rendered after the identity in the trigger.
|
|
25
|
+
* @fires open-change - Fires with the new open state whenever the trigger opens or closes the menu.
|
|
26
|
+
* @fires open-change-complete - Fires with the new open state once the panel's enter or exit animation has settled.
|
|
27
|
+
* @fires escape-key-down - Fires when Escape is pressed while the menu is open; `preventDefault()` keeps it open.
|
|
28
|
+
* @fires pointer-down-outside - Fires on a pointer-down outside the panel while open; `preventDefault()` keeps it open.
|
|
29
|
+
* @fires focus-outside - Fires when focus moves outside the panel while open; `preventDefault()` keeps it open.
|
|
30
|
+
* @fires interact-outside - Fires for either kind of outside interaction, just before the specific event.
|
|
31
|
+
* @fires close-auto-focus - Fires before focus returns to the trigger on close; `preventDefault()` suppresses that return.
|
|
32
|
+
*/
|
|
33
|
+
export declare class SkdxUserMenu extends LitElement {
|
|
34
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
35
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
36
|
+
/** The signed-in user's name, rendered in the trigger and repeated in the menu header. */
|
|
37
|
+
name: string;
|
|
38
|
+
/**
|
|
39
|
+
* Secondary text such as an email or role, rendered below the name in the trigger and the header.
|
|
40
|
+
* @default undefined — no description renders in either place.
|
|
41
|
+
*/
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Source of the identity image, passed straight through to the derived Avatar.
|
|
45
|
+
* @default undefined — the Avatar renders its initials fallback.
|
|
46
|
+
*/
|
|
47
|
+
avatarSrc?: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Visual rung written to `data-variant`; `'compact'` visually hides the identity text while keeping it as the accessible name.
|
|
50
|
+
* @default undefined — the identity text stays visible.
|
|
51
|
+
*/
|
|
52
|
+
variant?: 'compact' | (string & {}) | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the menu is open, for controlled usage paired with `open-change`.
|
|
55
|
+
* @default undefined — uncontrolled, following `defaultOpen`.
|
|
56
|
+
*/
|
|
57
|
+
open?: boolean | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the menu starts open, for uncontrolled usage.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
defaultOpen: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Which side of the trigger the menu panel opens on.
|
|
65
|
+
* @default 'bottom'
|
|
66
|
+
*/
|
|
67
|
+
side: 'top' | 'right' | 'bottom' | 'left';
|
|
68
|
+
/**
|
|
69
|
+
* Alignment of the menu panel relative to the side it opens on.
|
|
70
|
+
* @default 'end'
|
|
71
|
+
*/
|
|
72
|
+
align: 'start' | 'center' | 'end';
|
|
73
|
+
connectedCallback(): void;
|
|
74
|
+
/** Whether the consumer supplied their own trigger — still true once it has been moved in. */
|
|
75
|
+
private get hasTrigger();
|
|
76
|
+
protected updated(): void;
|
|
77
|
+
private derivedTrigger;
|
|
78
|
+
render(): TemplateResult;
|
|
79
|
+
}
|
|
80
|
+
declare global {
|
|
81
|
+
interface HTMLElementTagNameMap {
|
|
82
|
+
'skdx-user-menu': SkdxUserMenu;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var t=(a,i,n,d)=>{for(var s=d>1?void 0:d?c(i,n):i,u=a.length-1,l;u>=0;u--)(l=a[u])&&(s=(d?l(i,n,s):l(s))||s);return d&&s&&p(i,n,s),s};import{html as m,LitElement as g,nothing as o}from"lit";import{property as r}from"lit/decorators.js";import{customElement as h}from"../internal/define.js";import{placeSlotted as v}from"../internal/slots.js";import"@skdx/web-components/avatar";import"@skdx/web-components/primitives/menu";var k="data-skdx-user-menu-generated",f={fromAttribute:a=>a!=="false"},e=class extends g{constructor(){super(...arguments);this.defaultOpen=!1;this.side="bottom";this.align="end"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.requestUpdate())}get hasTrigger(){return this.querySelector('[slot="trigger"]')!==null}updated(){this.variant&&!this.hasTrigger?this.setAttribute("data-variant",this.variant):this.removeAttribute("data-variant");let n=this.querySelector("skdx-menu-trigger");v(this,k,{trigger:n,status:n},this.querySelector("skdx-menu-content"))}derivedTrigger(){return m`<skdx-avatar
|
|
2
|
+
class="skdx-user-menu__avatar"
|
|
3
|
+
src=${this.avatarSrc??o}
|
|
4
|
+
name=${this.name??o}
|
|
5
|
+
decorative
|
|
6
|
+
.size=${"sm"}
|
|
7
|
+
></skdx-avatar>
|
|
8
|
+
<span class="skdx-user-menu__identity">
|
|
9
|
+
<span class="skdx-user-menu__name">${this.name??""}</span>
|
|
10
|
+
${this.description?m`<span class="skdx-user-menu__description">${this.description}</span>`:o}
|
|
11
|
+
</span>`}render(){return m`
|
|
12
|
+
<skdx-menu-root
|
|
13
|
+
data-skdx-user-menu-generated
|
|
14
|
+
.open=${this.open}
|
|
15
|
+
?default-open=${this.defaultOpen}
|
|
16
|
+
>
|
|
17
|
+
<skdx-menu-trigger>${this.hasTrigger?o:this.derivedTrigger()}</skdx-menu-trigger>
|
|
18
|
+
<skdx-menu-content
|
|
19
|
+
class="skdx-user-menu__content"
|
|
20
|
+
side=${this.side}
|
|
21
|
+
align=${this.align}
|
|
22
|
+
>
|
|
23
|
+
<skdx-menu-label class="skdx-user-menu__header">
|
|
24
|
+
<span class="skdx-user-menu__name">${this.name??""}</span>
|
|
25
|
+
${this.description?m`<span class="skdx-user-menu__description">${this.description}</span>`:o}
|
|
26
|
+
</skdx-menu-label>
|
|
27
|
+
<skdx-menu-separator></skdx-menu-separator>
|
|
28
|
+
</skdx-menu-content>
|
|
29
|
+
</skdx-menu-root>
|
|
30
|
+
`}};t([r({type:String})],e.prototype,"name",2),t([r({type:String})],e.prototype,"description",2),t([r({type:String,attribute:"avatar-src"})],e.prototype,"avatarSrc",2),t([r({type:String})],e.prototype,"variant",2),t([r({converter:f})],e.prototype,"open",2),t([r({type:Boolean,attribute:"default-open"})],e.prototype,"defaultOpen",2),t([r({type:String})],e.prototype,"side",2),t([r({type:String})],e.prototype,"align",2),e=t([h("skdx-user-menu","user-menu","root")],e);export{e as SkdxUserMenu};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var s=(r,e)=>{for(var x in e)d(r,x,{get:e[x],enumerable:!0})},t=(r,e,x,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of n(e))!p.call(r,o)&&o!==x&&d(r,o,{get:()=>e[o],enumerable:!(f=m(e,o))||f.enumerable});return r};var u=r=>t(d({},"__esModule",{value:!0}),r);var M={};s(M,{SkdxUserMenu:()=>k.SkdxUserMenu});module.exports=u(M);var k=require("./UserMenu.cjs");0&&(module.exports={SkdxUserMenu});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxUserMenu } from './UserMenu.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxUserMenu } from './UserMenu.js';
|