@skdx/web-components-blocks 0.34.0 → 0.36.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 +5076 -294
- 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/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/page-container/PageContainer.cjs +5 -5
- package/dist/page-container/PageContainer.js +2 -2
- 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 +61 -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 +61 -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 +272 -6
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var t=(s,o,a,r)=>{for(var d=r>1?void 0:r?h(o,a):o,c=s.length-1,g;c>=0;c--)(g=s[c])&&(d=(r?g(o,a,d):g(d))||d);return r&&d&&u(o,a,d),d};import{html as l,LitElement as m,nothing as n}from"lit";import{property as i}from"lit/decorators.js";import{customElement as f}from"../internal/define.js";import{hasUnslottedChild as b,placeSlotted as y}from"../internal/slots.js";import"@skdx/web-components/primitives/dialog";var p="data-skdx-confirm-dialog-generated",k={fromAttribute:s=>s!=="false"},e=class extends m{constructor(){super(...arguments);this.defaultOpen=!1;this.confirmLabel="Confirm";this.cancelLabel="Cancel";this.destructive=!1;this.pending=!1;this.disabled=!1}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.requestUpdate())}region(a){return this.querySelector(`.skdx-confirm-dialog__${a}`)}get hasTrigger(){return this.querySelector('[slot="trigger"], [data-skdx-slot="trigger"]')!==null}get hasBody(){return b(this,p)||(this.region("body")?.hasChildNodes()??!1)}updated(){y(this,p,{trigger:this.querySelector("skdx-dialog-trigger")},this.region("body"))}render(){return l`
|
|
2
|
+
<skdx-dialog-root
|
|
3
|
+
role="alertdialog"
|
|
4
|
+
data-skdx-confirm-dialog-generated
|
|
5
|
+
.open=${this.open}
|
|
6
|
+
?default-open=${this.defaultOpen}
|
|
7
|
+
dismiss=${this.pending?"none":"escape"}
|
|
8
|
+
>
|
|
9
|
+
${this.hasTrigger?l`<skdx-dialog-trigger></skdx-dialog-trigger>`:n}
|
|
10
|
+
<skdx-dialog-overlay></skdx-dialog-overlay>
|
|
11
|
+
<skdx-dialog-content
|
|
12
|
+
.size=${this.size}
|
|
13
|
+
.status=${this.destructive?"danger":void 0}
|
|
14
|
+
>
|
|
15
|
+
<skdx-dialog-title class="skdx-confirm-dialog__title"
|
|
16
|
+
>${this.title??""}</skdx-dialog-title
|
|
17
|
+
>
|
|
18
|
+
${this.description?l`<skdx-dialog-description class="skdx-confirm-dialog__description"
|
|
19
|
+
>${this.description}</skdx-dialog-description
|
|
20
|
+
>`:n}
|
|
21
|
+
${this.hasBody?l`<div class="skdx-confirm-dialog__body"></div>`:n}
|
|
22
|
+
<div class="skdx-confirm-dialog__footer">
|
|
23
|
+
<skdx-dialog-cancel
|
|
24
|
+
class="skdx-confirm-dialog__cancel"
|
|
25
|
+
?disabled=${this.pending}
|
|
26
|
+
>${this.cancelLabel}</skdx-dialog-cancel
|
|
27
|
+
>
|
|
28
|
+
<skdx-dialog-action
|
|
29
|
+
class="skdx-confirm-dialog__confirm"
|
|
30
|
+
data-status=${this.destructive?"danger":n}
|
|
31
|
+
?data-loading=${this.pending}
|
|
32
|
+
?disabled=${this.pending||this.disabled}
|
|
33
|
+
>${this.confirmLabel}</skdx-dialog-action
|
|
34
|
+
>
|
|
35
|
+
</div>
|
|
36
|
+
</skdx-dialog-content>
|
|
37
|
+
</skdx-dialog-root>
|
|
38
|
+
`}};t([i({converter:k})],e.prototype,"open",2),t([i({type:Boolean,attribute:"default-open"})],e.prototype,"defaultOpen",2),t([i({type:String})],e.prototype,"title",2),t([i({type:String})],e.prototype,"description",2),t([i({type:String,attribute:"confirm-label"})],e.prototype,"confirmLabel",2),t([i({type:String,attribute:"cancel-label"})],e.prototype,"cancelLabel",2),t([i({type:Boolean})],e.prototype,"destructive",2),t([i({type:Boolean})],e.prototype,"pending",2),t([i({type:Boolean})],e.prototype,"disabled",2),t([i({type:String})],e.prototype,"size",2),e=t([f("skdx-confirm-dialog","confirm-dialog","root")],e);export{e as SkdxConfirmDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var m=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var e=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var k=(r,o)=>{for(var i in o)m(r,i,{get:o[i],enumerable:!0})},l=(r,o,i,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let f of e(o))!g.call(r,f)&&f!==i&&m(r,f,{get:()=>o[f],enumerable:!(x=d(o,f))||x.enumerable});return r};var n=r=>l(m({},"__esModule",{value:!0}),r);var p={};k(p,{SkdxConfirmDialog:()=>a.SkdxConfirmDialog});module.exports=n(p);var a=require("./ConfirmDialog.cjs");0&&(module.exports={SkdxConfirmDialog});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxConfirmDialog } from './ConfirmDialog.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxConfirmDialog } from './ConfirmDialog.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SkdxConfirmDialog as f}from"./ConfirmDialog.js";export{f as SkdxConfirmDialog};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";var d=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var v=(r,n)=>{for(var e in n)d(r,e,{get:n[e],enumerable:!0})},h=(r,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of x(n))!b.call(r,s)&&s!==e&&d(r,s,{get:()=>n[s],enumerable:!(i=c(n,s))||i.enumerable});return r};var k=r=>h(d({},"__esModule",{value:!0}),r),l=(r,n,e,i)=>{for(var s=i>1?void 0:i?c(n,e):n,u=r.length-1,p;u>=0;u--)(p=r[u])&&(s=(i?p(n,e,s):p(s))||s);return i&&s&&d(n,e,s),s};var $={};v($,{SkdxConversationList:()=>a});module.exports=k($);var t=require("lit"),o=require("lit/decorators.js"),m=require("../internal/define.cjs"),g=require("../internal/events.cjs"),V=require("@skdx/web-components/badge"),w=require("@skdx/web-components/primitives/listbox"),T=require("@skdx/web-components/skeleton"),D=require("@skdx/web-components/time"),I=require("@skdx/web-components/visually-hidden"),L=require("../empty-state/index.cjs");var f=[0,1,2];function y(r){let n=new Map([[void 0,[]]]);for(let e of r){let i=n.get(e.group);i?i.push(e):n.set(e.group,[e])}return[...n].filter(([,e])=>e.length>0)}var a=class extends t.LitElement{constructor(){super(...arguments);this.label="Conversations";this.unreadLabel="Unread";this.emptyTitle="No conversations";this.loading=!1;this.handleValueChange=e=>{e.stopPropagation();let i=e.detail,s=i.selectedValue??"";this.uncontrolledValue=s,this.requestUpdate(),(0,g.emit)(this,"value-change",{value:s,previousValue:i.previousValue[0]??null,reason:i.reason})}}createRenderRoot(){return this}get selected(){return this.value??this.uncontrolledValue??this.defaultValue??""}updated(){this.setAttribute("aria-busy",String(this.loading));let e=this.querySelector(":scope > skdx-listbox");e&&(e.value=this.selected)}row(e){let i=e.timestamp!==void 0||e.badge!==void 0;return t.html`<skdx-listbox-item
|
|
2
|
+
class="skdx-conversation-list__item"
|
|
3
|
+
value=${e.id}
|
|
4
|
+
text-value=${e.title}
|
|
5
|
+
?disabled=${e.disabled===!0}
|
|
6
|
+
?data-unread=${e.unread===!0}
|
|
7
|
+
>
|
|
8
|
+
${this.renderLeading?t.html`<span
|
|
9
|
+
class="skdx-conversation-list__leading"
|
|
10
|
+
aria-hidden="true"
|
|
11
|
+
>
|
|
12
|
+
${this.renderLeading(e)}
|
|
13
|
+
</span>`:t.nothing}
|
|
14
|
+
<span class="skdx-conversation-list__body">
|
|
15
|
+
<span class="skdx-conversation-list__title"
|
|
16
|
+
>${e.title}${e.unread===!0?t.html`<skdx-visually-hidden> ${this.unreadLabel}</skdx-visually-hidden>`:t.nothing}</span
|
|
17
|
+
>
|
|
18
|
+
${e.preview?t.html`<span class="skdx-conversation-list__preview">${e.preview}</span>`:t.nothing}
|
|
19
|
+
</span>
|
|
20
|
+
${i?t.html`<span class="skdx-conversation-list__meta">
|
|
21
|
+
${e.timestamp===void 0?t.nothing:t.html`<skdx-time
|
|
22
|
+
class="skdx-conversation-list__time"
|
|
23
|
+
relative
|
|
24
|
+
.value=${e.timestamp}
|
|
25
|
+
.now=${this.now}
|
|
26
|
+
></skdx-time>`}
|
|
27
|
+
${e.badge===void 0?t.nothing:t.html`<skdx-badge
|
|
28
|
+
class="skdx-conversation-list__badge"
|
|
29
|
+
.size=${"sm"}
|
|
30
|
+
.label=${e.badge}
|
|
31
|
+
></skdx-badge>`}
|
|
32
|
+
</span>`:t.nothing}
|
|
33
|
+
</skdx-listbox-item>`}section(e,i){return e===void 0?t.html`${i.map(s=>this.row(s))}`:t.html`<skdx-listbox-group class="skdx-conversation-list__group">
|
|
34
|
+
<skdx-listbox-label class="skdx-conversation-list__group-label">${e}</skdx-listbox-label>
|
|
35
|
+
${i.map(s=>this.row(s))}
|
|
36
|
+
</skdx-listbox-group>`}render(){let e=this.items??[];return this.loading?t.html`<div
|
|
37
|
+
class="skdx-conversation-list__loading"
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
>
|
|
40
|
+
${f.map(()=>t.html`<skdx-skeleton></skdx-skeleton>`)}
|
|
41
|
+
</div>`:e.length===0?t.html`<skdx-empty-state
|
|
42
|
+
class="skdx-conversation-list__empty"
|
|
43
|
+
.title=${this.emptyTitle}
|
|
44
|
+
.description=${this.emptyDescription}
|
|
45
|
+
.size=${"sm"}
|
|
46
|
+
></skdx-empty-state>`:t.html`<skdx-listbox
|
|
47
|
+
class="skdx-conversation-list__list"
|
|
48
|
+
aria-label=${this.label}
|
|
49
|
+
@value-change=${this.handleValueChange}
|
|
50
|
+
>
|
|
51
|
+
${y(e).map(([i,s])=>this.section(i,s))}
|
|
52
|
+
</skdx-listbox>`}};l([(0,o.property)({attribute:!1})],a.prototype,"items",2),l([(0,o.property)({type:String})],a.prototype,"value",2),l([(0,o.property)({type:String,attribute:"default-value"})],a.prototype,"defaultValue",2),l([(0,o.property)({type:String})],a.prototype,"label",2),l([(0,o.property)({type:String,attribute:"unread-label"})],a.prototype,"unreadLabel",2),l([(0,o.property)({type:String,attribute:"empty-title"})],a.prototype,"emptyTitle",2),l([(0,o.property)({type:String,attribute:"empty-description"})],a.prototype,"emptyDescription",2),l([(0,o.property)({type:Boolean})],a.prototype,"loading",2),l([(0,o.property)({attribute:!1})],a.prototype,"now",2),l([(0,o.property)({attribute:!1})],a.prototype,"renderLeading",2),a=l([(0,m.customElement)("skdx-conversation-list","conversation-list","root")],a);0&&(module.exports={SkdxConversationList});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/badge';
|
|
3
|
+
import '@skdx/web-components/primitives/listbox';
|
|
4
|
+
import '@skdx/web-components/skeleton';
|
|
5
|
+
import '@skdx/web-components/time';
|
|
6
|
+
import '@skdx/web-components/visually-hidden';
|
|
7
|
+
import '../empty-state/index.cjs';
|
|
8
|
+
/** One conversation or thread row of a `<skdx-conversation-list>`. */
|
|
9
|
+
export interface SkdxConversationListItem {
|
|
10
|
+
/** Identifier committed as the list's selected value when this row is chosen. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Primary line of the row, and the text the list's typeahead matches on. */
|
|
13
|
+
title: string;
|
|
14
|
+
/** Secondary line under the title, clamped by the skin. @default undefined — no preview line renders. */
|
|
15
|
+
preview?: string;
|
|
16
|
+
/** Instant rendered as a relative timestamp in the row's meta column. @default undefined — no timestamp renders. */
|
|
17
|
+
timestamp?: Date | string;
|
|
18
|
+
/** Marks the row as not yet read, mirrored to `data-unread` on the option. @default false */
|
|
19
|
+
unread?: boolean;
|
|
20
|
+
/** Short count or status text rendered into a small Badge beside the timestamp. @default undefined — no badge renders. */
|
|
21
|
+
badge?: string;
|
|
22
|
+
/** Heading this row belongs under; rows sharing it render inside one group. @default undefined — the row renders ungrouped. */
|
|
23
|
+
group?: string;
|
|
24
|
+
/** Excludes this row from selection and from keyboard and typeahead navigation. @default false */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** What a `value-change` event carries: the chosen conversation, the one it replaced, and what drove the move. */
|
|
28
|
+
export interface SkdxConversationListValueChangeDetail {
|
|
29
|
+
/** The newly selected conversation's id, empty when the selection was cleared. */
|
|
30
|
+
value: string;
|
|
31
|
+
/** The conversation selected before this change, or `null` when there was none. */
|
|
32
|
+
previousValue: string | null;
|
|
33
|
+
/** What drove the change. */
|
|
34
|
+
reason: 'keyboard' | 'pointer' | 'programmatic';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Conversation navigation block: a single-select listbox of threads with a
|
|
38
|
+
* title, preview, relative timestamp, unread mark and badge, plus grouping and
|
|
39
|
+
* its own loading and empty states. It routes nowhere — it reports the chosen
|
|
40
|
+
* conversation and the consumer navigates.
|
|
41
|
+
*
|
|
42
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
43
|
+
* targets: `.skdx-conversation-list` on the host, then `__loading`, `__empty`,
|
|
44
|
+
* `__list`, `__group`, `__group-label`, `__item`, `__leading`, `__body`,
|
|
45
|
+
* `__title`, `__preview`, `__meta`, `__time` and `__badge`. `data-unread` sits
|
|
46
|
+
* on a row that has not been read.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```html
|
|
50
|
+
* <skdx-conversation-list id="threads" default-value="ada"></skdx-conversation-list>
|
|
51
|
+
* <script>
|
|
52
|
+
* const threads = document.getElementById('threads');
|
|
53
|
+
* threads.items = [{ id: 'ada', title: 'Ada Lovelace', preview: 'Sounds good', unread: true }];
|
|
54
|
+
* threads.addEventListener('value-change', (event) => open(event.detail.value));
|
|
55
|
+
* </script>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @fires value-change - Fires with `{ value, previousValue, reason }` whenever the selection moves by pointer or keyboard.
|
|
59
|
+
*/
|
|
60
|
+
export declare class SkdxConversationList extends LitElement {
|
|
61
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
62
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
63
|
+
/** The conversations to render, in order, each one a selectable option keyed by its id. */
|
|
64
|
+
items: readonly SkdxConversationListItem[];
|
|
65
|
+
/**
|
|
66
|
+
* Selected conversation's id, for controlled usage paired with `value-change`.
|
|
67
|
+
* @default undefined — uncontrolled, following `defaultValue`.
|
|
68
|
+
*/
|
|
69
|
+
value?: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Conversation selected on first render, used only while uncontrolled.
|
|
72
|
+
* @default undefined — nothing is selected until a row is chosen.
|
|
73
|
+
*/
|
|
74
|
+
defaultValue?: string | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Accessible name of the derived listbox holding the conversation rows.
|
|
77
|
+
* @default 'Conversations'
|
|
78
|
+
*/
|
|
79
|
+
label: string;
|
|
80
|
+
/**
|
|
81
|
+
* Visually hidden text appended to an unread row's title, so the mark is spoken.
|
|
82
|
+
* @default 'Unread'
|
|
83
|
+
*/
|
|
84
|
+
unreadLabel: string;
|
|
85
|
+
/**
|
|
86
|
+
* Heading of the derived EmptyState shown when there is nothing to list.
|
|
87
|
+
* @default 'No conversations'
|
|
88
|
+
*/
|
|
89
|
+
emptyTitle: string;
|
|
90
|
+
/**
|
|
91
|
+
* Supporting copy under the empty state's heading, explaining the gap.
|
|
92
|
+
* @default undefined — the empty state renders its heading alone.
|
|
93
|
+
*/
|
|
94
|
+
emptyDescription?: string | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Replaces the rows with decorative placeholder lines and marks the host `aria-busy`.
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
loading: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Reference instant the relative row timestamps are measured from.
|
|
102
|
+
* @default undefined — each Time reads the instant once at render.
|
|
103
|
+
*/
|
|
104
|
+
now?: Date | number | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Renders a decorative leading region for one row, such as an avatar or a status dot.
|
|
107
|
+
* @default undefined — no leading region renders in any row.
|
|
108
|
+
*/
|
|
109
|
+
renderLeading?: ((item: SkdxConversationListItem) => unknown) | undefined;
|
|
110
|
+
/** What the list last chose; outranked by `value` whenever the consumer controls the selection. */
|
|
111
|
+
private uncontrolledValue?;
|
|
112
|
+
/** The conversation selected right now, controlled or not. */
|
|
113
|
+
private get selected();
|
|
114
|
+
private readonly handleValueChange;
|
|
115
|
+
protected updated(): void;
|
|
116
|
+
private row;
|
|
117
|
+
private section;
|
|
118
|
+
render(): TemplateResult;
|
|
119
|
+
}
|
|
120
|
+
declare global {
|
|
121
|
+
interface HTMLElementTagNameMap {
|
|
122
|
+
'skdx-conversation-list': SkdxConversationList;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/badge';
|
|
3
|
+
import '@skdx/web-components/primitives/listbox';
|
|
4
|
+
import '@skdx/web-components/skeleton';
|
|
5
|
+
import '@skdx/web-components/time';
|
|
6
|
+
import '@skdx/web-components/visually-hidden';
|
|
7
|
+
import '../empty-state/index.js';
|
|
8
|
+
/** One conversation or thread row of a `<skdx-conversation-list>`. */
|
|
9
|
+
export interface SkdxConversationListItem {
|
|
10
|
+
/** Identifier committed as the list's selected value when this row is chosen. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Primary line of the row, and the text the list's typeahead matches on. */
|
|
13
|
+
title: string;
|
|
14
|
+
/** Secondary line under the title, clamped by the skin. @default undefined — no preview line renders. */
|
|
15
|
+
preview?: string;
|
|
16
|
+
/** Instant rendered as a relative timestamp in the row's meta column. @default undefined — no timestamp renders. */
|
|
17
|
+
timestamp?: Date | string;
|
|
18
|
+
/** Marks the row as not yet read, mirrored to `data-unread` on the option. @default false */
|
|
19
|
+
unread?: boolean;
|
|
20
|
+
/** Short count or status text rendered into a small Badge beside the timestamp. @default undefined — no badge renders. */
|
|
21
|
+
badge?: string;
|
|
22
|
+
/** Heading this row belongs under; rows sharing it render inside one group. @default undefined — the row renders ungrouped. */
|
|
23
|
+
group?: string;
|
|
24
|
+
/** Excludes this row from selection and from keyboard and typeahead navigation. @default false */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** What a `value-change` event carries: the chosen conversation, the one it replaced, and what drove the move. */
|
|
28
|
+
export interface SkdxConversationListValueChangeDetail {
|
|
29
|
+
/** The newly selected conversation's id, empty when the selection was cleared. */
|
|
30
|
+
value: string;
|
|
31
|
+
/** The conversation selected before this change, or `null` when there was none. */
|
|
32
|
+
previousValue: string | null;
|
|
33
|
+
/** What drove the change. */
|
|
34
|
+
reason: 'keyboard' | 'pointer' | 'programmatic';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Conversation navigation block: a single-select listbox of threads with a
|
|
38
|
+
* title, preview, relative timestamp, unread mark and badge, plus grouping and
|
|
39
|
+
* its own loading and empty states. It routes nowhere — it reports the chosen
|
|
40
|
+
* conversation and the consumer navigates.
|
|
41
|
+
*
|
|
42
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
43
|
+
* targets: `.skdx-conversation-list` on the host, then `__loading`, `__empty`,
|
|
44
|
+
* `__list`, `__group`, `__group-label`, `__item`, `__leading`, `__body`,
|
|
45
|
+
* `__title`, `__preview`, `__meta`, `__time` and `__badge`. `data-unread` sits
|
|
46
|
+
* on a row that has not been read.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```html
|
|
50
|
+
* <skdx-conversation-list id="threads" default-value="ada"></skdx-conversation-list>
|
|
51
|
+
* <script>
|
|
52
|
+
* const threads = document.getElementById('threads');
|
|
53
|
+
* threads.items = [{ id: 'ada', title: 'Ada Lovelace', preview: 'Sounds good', unread: true }];
|
|
54
|
+
* threads.addEventListener('value-change', (event) => open(event.detail.value));
|
|
55
|
+
* </script>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @fires value-change - Fires with `{ value, previousValue, reason }` whenever the selection moves by pointer or keyboard.
|
|
59
|
+
*/
|
|
60
|
+
export declare class SkdxConversationList extends LitElement {
|
|
61
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
62
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
63
|
+
/** The conversations to render, in order, each one a selectable option keyed by its id. */
|
|
64
|
+
items: readonly SkdxConversationListItem[];
|
|
65
|
+
/**
|
|
66
|
+
* Selected conversation's id, for controlled usage paired with `value-change`.
|
|
67
|
+
* @default undefined — uncontrolled, following `defaultValue`.
|
|
68
|
+
*/
|
|
69
|
+
value?: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Conversation selected on first render, used only while uncontrolled.
|
|
72
|
+
* @default undefined — nothing is selected until a row is chosen.
|
|
73
|
+
*/
|
|
74
|
+
defaultValue?: string | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Accessible name of the derived listbox holding the conversation rows.
|
|
77
|
+
* @default 'Conversations'
|
|
78
|
+
*/
|
|
79
|
+
label: string;
|
|
80
|
+
/**
|
|
81
|
+
* Visually hidden text appended to an unread row's title, so the mark is spoken.
|
|
82
|
+
* @default 'Unread'
|
|
83
|
+
*/
|
|
84
|
+
unreadLabel: string;
|
|
85
|
+
/**
|
|
86
|
+
* Heading of the derived EmptyState shown when there is nothing to list.
|
|
87
|
+
* @default 'No conversations'
|
|
88
|
+
*/
|
|
89
|
+
emptyTitle: string;
|
|
90
|
+
/**
|
|
91
|
+
* Supporting copy under the empty state's heading, explaining the gap.
|
|
92
|
+
* @default undefined — the empty state renders its heading alone.
|
|
93
|
+
*/
|
|
94
|
+
emptyDescription?: string | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Replaces the rows with decorative placeholder lines and marks the host `aria-busy`.
|
|
97
|
+
* @default false
|
|
98
|
+
*/
|
|
99
|
+
loading: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Reference instant the relative row timestamps are measured from.
|
|
102
|
+
* @default undefined — each Time reads the instant once at render.
|
|
103
|
+
*/
|
|
104
|
+
now?: Date | number | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Renders a decorative leading region for one row, such as an avatar or a status dot.
|
|
107
|
+
* @default undefined — no leading region renders in any row.
|
|
108
|
+
*/
|
|
109
|
+
renderLeading?: ((item: SkdxConversationListItem) => unknown) | undefined;
|
|
110
|
+
/** What the list last chose; outranked by `value` whenever the consumer controls the selection. */
|
|
111
|
+
private uncontrolledValue?;
|
|
112
|
+
/** The conversation selected right now, controlled or not. */
|
|
113
|
+
private get selected();
|
|
114
|
+
private readonly handleValueChange;
|
|
115
|
+
protected updated(): void;
|
|
116
|
+
private row;
|
|
117
|
+
private section;
|
|
118
|
+
render(): TemplateResult;
|
|
119
|
+
}
|
|
120
|
+
declare global {
|
|
121
|
+
interface HTMLElementTagNameMap {
|
|
122
|
+
'skdx-conversation-list': SkdxConversationList;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var a=(d,l,e,t)=>{for(var s=t>1?void 0:t?m(l,e):l,u=d.length-1,p;u>=0;u--)(p=d[u])&&(s=(t?p(l,e,s):p(s))||s);return t&&s&&c(l,e,s),s};import{html as n,LitElement as g,nothing as o}from"lit";import{property as r}from"lit/decorators.js";import{customElement as x}from"../internal/define.js";import{emit as b}from"../internal/events.js";import"@skdx/web-components/badge";import"@skdx/web-components/primitives/listbox";import"@skdx/web-components/skeleton";import"@skdx/web-components/time";import"@skdx/web-components/visually-hidden";import"../empty-state/index.js";var v=[0,1,2];function h(d){let l=new Map([[void 0,[]]]);for(let e of d){let t=l.get(e.group);t?t.push(e):l.set(e.group,[e])}return[...l].filter(([,e])=>e.length>0)}var i=class extends g{constructor(){super(...arguments);this.label="Conversations";this.unreadLabel="Unread";this.emptyTitle="No conversations";this.loading=!1;this.handleValueChange=e=>{e.stopPropagation();let t=e.detail,s=t.selectedValue??"";this.uncontrolledValue=s,this.requestUpdate(),b(this,"value-change",{value:s,previousValue:t.previousValue[0]??null,reason:t.reason})}}createRenderRoot(){return this}get selected(){return this.value??this.uncontrolledValue??this.defaultValue??""}updated(){this.setAttribute("aria-busy",String(this.loading));let e=this.querySelector(":scope > skdx-listbox");e&&(e.value=this.selected)}row(e){let t=e.timestamp!==void 0||e.badge!==void 0;return n`<skdx-listbox-item
|
|
2
|
+
class="skdx-conversation-list__item"
|
|
3
|
+
value=${e.id}
|
|
4
|
+
text-value=${e.title}
|
|
5
|
+
?disabled=${e.disabled===!0}
|
|
6
|
+
?data-unread=${e.unread===!0}
|
|
7
|
+
>
|
|
8
|
+
${this.renderLeading?n`<span
|
|
9
|
+
class="skdx-conversation-list__leading"
|
|
10
|
+
aria-hidden="true"
|
|
11
|
+
>
|
|
12
|
+
${this.renderLeading(e)}
|
|
13
|
+
</span>`:o}
|
|
14
|
+
<span class="skdx-conversation-list__body">
|
|
15
|
+
<span class="skdx-conversation-list__title"
|
|
16
|
+
>${e.title}${e.unread===!0?n`<skdx-visually-hidden> ${this.unreadLabel}</skdx-visually-hidden>`:o}</span
|
|
17
|
+
>
|
|
18
|
+
${e.preview?n`<span class="skdx-conversation-list__preview">${e.preview}</span>`:o}
|
|
19
|
+
</span>
|
|
20
|
+
${t?n`<span class="skdx-conversation-list__meta">
|
|
21
|
+
${e.timestamp===void 0?o:n`<skdx-time
|
|
22
|
+
class="skdx-conversation-list__time"
|
|
23
|
+
relative
|
|
24
|
+
.value=${e.timestamp}
|
|
25
|
+
.now=${this.now}
|
|
26
|
+
></skdx-time>`}
|
|
27
|
+
${e.badge===void 0?o:n`<skdx-badge
|
|
28
|
+
class="skdx-conversation-list__badge"
|
|
29
|
+
.size=${"sm"}
|
|
30
|
+
.label=${e.badge}
|
|
31
|
+
></skdx-badge>`}
|
|
32
|
+
</span>`:o}
|
|
33
|
+
</skdx-listbox-item>`}section(e,t){return e===void 0?n`${t.map(s=>this.row(s))}`:n`<skdx-listbox-group class="skdx-conversation-list__group">
|
|
34
|
+
<skdx-listbox-label class="skdx-conversation-list__group-label">${e}</skdx-listbox-label>
|
|
35
|
+
${t.map(s=>this.row(s))}
|
|
36
|
+
</skdx-listbox-group>`}render(){let e=this.items??[];return this.loading?n`<div
|
|
37
|
+
class="skdx-conversation-list__loading"
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
>
|
|
40
|
+
${v.map(()=>n`<skdx-skeleton></skdx-skeleton>`)}
|
|
41
|
+
</div>`:e.length===0?n`<skdx-empty-state
|
|
42
|
+
class="skdx-conversation-list__empty"
|
|
43
|
+
.title=${this.emptyTitle}
|
|
44
|
+
.description=${this.emptyDescription}
|
|
45
|
+
.size=${"sm"}
|
|
46
|
+
></skdx-empty-state>`:n`<skdx-listbox
|
|
47
|
+
class="skdx-conversation-list__list"
|
|
48
|
+
aria-label=${this.label}
|
|
49
|
+
@value-change=${this.handleValueChange}
|
|
50
|
+
>
|
|
51
|
+
${h(e).map(([t,s])=>this.section(t,s))}
|
|
52
|
+
</skdx-listbox>`}};a([r({attribute:!1})],i.prototype,"items",2),a([r({type:String})],i.prototype,"value",2),a([r({type:String,attribute:"default-value"})],i.prototype,"defaultValue",2),a([r({type:String})],i.prototype,"label",2),a([r({type:String,attribute:"unread-label"})],i.prototype,"unreadLabel",2),a([r({type:String,attribute:"empty-title"})],i.prototype,"emptyTitle",2),a([r({type:String,attribute:"empty-description"})],i.prototype,"emptyDescription",2),a([r({type:Boolean})],i.prototype,"loading",2),a([r({attribute:!1})],i.prototype,"now",2),a([r({attribute:!1})],i.prototype,"renderLeading",2),i=a([x("skdx-conversation-list","conversation-list","root")],i);export{i as SkdxConversationList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var d=(e,t)=>{for(var i in t)n(e,i,{get:t[i],enumerable:!0})},k=(e,t,i,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of x(t))!C.call(e,o)&&o!==i&&n(e,o,{get:()=>t[o],enumerable:!(a=r(t,o))||a.enumerable});return e};var p=e=>k(n({},"__esModule",{value:!0}),e);var v={};d(v,{SkdxConversationList:()=>s.SkdxConversationList});module.exports=p(v);var s=require("./ConversationList.cjs");0&&(module.exports={SkdxConversationList});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxConversationList, type SkdxConversationListItem, type SkdxConversationListValueChangeDetail, } from './ConversationList.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxConversationList, type SkdxConversationListItem, type SkdxConversationListValueChangeDetail, } from './ConversationList.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SkdxConversationList as o}from"./ConversationList.js";export{o as SkdxConversationList};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var x=(a,t)=>{for(var e in t)l(a,e,{get:t[e],enumerable:!0})},k=(a,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of v(t))!y.call(a,s)&&s!==e&&l(a,s,{get:()=>t[s],enumerable:!(r=m(t,s))||r.enumerable});return a};var $=a=>k(l({},"__esModule",{value:!0}),a),d=(a,t,e,r)=>{for(var s=r>1?void 0:r?m(t,e):t,p=a.length-1,c;p>=0;p--)(c=a[p])&&(s=(r?c(t,e,s):c(s))||s);return r&&s&&l(t,e,s),s};var b={};x(b,{SkdxEmptyState:()=>n});module.exports=$(b);var i=require("lit"),o=require("lit/decorators.js"),u=require("../internal/define.cjs"),h=require("../internal/slots.cjs"),T=require("@skdx/web-components/heading"),L=require("@skdx/web-components/text");var g="data-skdx-empty-state-generated",_=0,n=class extends i.LitElement{constructor(){super(...arguments);this.headingLevel=3;this.align="center";this.titleId=`skdx-empty-state-title-${++_}`}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.requestUpdate())}region(e){return this.querySelector(`.skdx-empty-state__${e}`)}hasSlotted(e){return this.querySelector(`[slot="${e}"], [data-skdx-slot="${e}"]`)!==null}get hasContent(){return(0,h.hasUnslottedChild)(this,g)||(this.region("content")?.hasChildNodes()??!1)}updated(){this.setAttribute("data-align",this.align),this.size===void 0?this.removeAttribute("data-size"):this.setAttribute("data-size",this.size),(0,h.placeSlotted)(this,g,{icon:this.region("icon"),actions:this.region("actions")},this.region("content"))}render(){return i.html`
|
|
2
|
+
${this.hasSlotted("icon")?i.html`<div
|
|
3
|
+
class="skdx-empty-state__icon"
|
|
4
|
+
aria-hidden="true"
|
|
5
|
+
data-skdx-empty-state-generated
|
|
6
|
+
></div>`:i.nothing}
|
|
7
|
+
<skdx-heading
|
|
8
|
+
class="skdx-empty-state__title"
|
|
9
|
+
as=${`h${this.headingLevel}`}
|
|
10
|
+
id=${this.titleId}
|
|
11
|
+
data-skdx-empty-state-generated
|
|
12
|
+
>${this.title??""}</skdx-heading
|
|
13
|
+
>
|
|
14
|
+
${this.description?i.html`<skdx-text
|
|
15
|
+
class="skdx-empty-state__description"
|
|
16
|
+
as="p"
|
|
17
|
+
.tone=${"muted"}
|
|
18
|
+
data-skdx-empty-state-generated
|
|
19
|
+
>${this.description}</skdx-text
|
|
20
|
+
>`:i.nothing}
|
|
21
|
+
${this.hasContent?i.html`<div
|
|
22
|
+
class="skdx-empty-state__content"
|
|
23
|
+
data-skdx-empty-state-generated
|
|
24
|
+
></div>`:i.nothing}
|
|
25
|
+
${this.hasSlotted("actions")?i.html`<div
|
|
26
|
+
class="skdx-empty-state__actions"
|
|
27
|
+
data-skdx-empty-state-generated
|
|
28
|
+
></div>`:i.nothing}
|
|
29
|
+
`}};d([(0,o.property)({type:String})],n.prototype,"title",2),d([(0,o.property)({type:String})],n.prototype,"description",2),d([(0,o.property)({type:Number,attribute:"heading-level"})],n.prototype,"headingLevel",2),d([(0,o.property)({type:String})],n.prototype,"size",2),d([(0,o.property)({type:String})],n.prototype,"align",2),n=d([(0,u.customElement)("skdx-empty-state","empty-state","root")],n);0&&(module.exports={SkdxEmptyState});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/heading';
|
|
3
|
+
import '@skdx/web-components/text';
|
|
4
|
+
/** Whether a consumer child bound for the default region is still waiting to be placed. */
|
|
5
|
+
/**
|
|
6
|
+
* Placeholder block for a region with nothing to show — no content yet, no
|
|
7
|
+
* results, first use, or disconnected — composing a Heading, a Text
|
|
8
|
+
* description and consumer-supplied icon and actions.
|
|
9
|
+
*
|
|
10
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
11
|
+
* targets: `.skdx-empty-state` on the host, then `__icon`, `__title`,
|
|
12
|
+
* `__description`, `__content` and `__actions`. `data-size` and `data-align`
|
|
13
|
+
* sit on the host for the skin to read.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <skdx-empty-state
|
|
18
|
+
* title="No invoices yet"
|
|
19
|
+
* description="Invoices you create will show up here."
|
|
20
|
+
* >
|
|
21
|
+
* <svg slot="icon"></svg>
|
|
22
|
+
* <skdx-button slot="actions">Create invoice</skdx-button>
|
|
23
|
+
* </skdx-empty-state>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @slot - Extra content rendered between the description and the actions region.
|
|
27
|
+
* @slot icon - Decorative illustration or glyph rendered above the title.
|
|
28
|
+
* @slot actions - Primary and secondary controls rendered below the content.
|
|
29
|
+
*/
|
|
30
|
+
export declare class SkdxEmptyState extends LitElement {
|
|
31
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
32
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
33
|
+
/** Heading text naming the empty region, rendered into a derived Heading. */
|
|
34
|
+
title: string;
|
|
35
|
+
/**
|
|
36
|
+
* Supporting copy rendered below the title, explaining why the region is empty.
|
|
37
|
+
* @default undefined — no description region renders.
|
|
38
|
+
*/
|
|
39
|
+
description?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Outline level of the derived title heading, lowered or raised to fit the surrounding outline.
|
|
42
|
+
* @default 3
|
|
43
|
+
*/
|
|
44
|
+
headingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
45
|
+
/**
|
|
46
|
+
* Visual size rung, written to `data-size` on the host; the skin scales the icon, spacing and title by it.
|
|
47
|
+
* @default undefined — the skin's own default size.
|
|
48
|
+
*/
|
|
49
|
+
size?: 'sm' | 'md' | 'lg' | (string & {}) | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Text and content alignment rung, written to `data-align` on the host.
|
|
52
|
+
* @default 'center'
|
|
53
|
+
*/
|
|
54
|
+
align: 'center' | 'start' | (string & {});
|
|
55
|
+
/** Generated title id, so a consumer can name a surrounding landmark with it. */
|
|
56
|
+
private readonly titleId;
|
|
57
|
+
connectedCallback(): void;
|
|
58
|
+
private region;
|
|
59
|
+
/** Whether the consumer supplied anything for `name` — still true once it has been moved in. */
|
|
60
|
+
private hasSlotted;
|
|
61
|
+
private get hasContent();
|
|
62
|
+
protected updated(): void;
|
|
63
|
+
render(): TemplateResult;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
'skdx-empty-state': SkdxEmptyState;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/heading';
|
|
3
|
+
import '@skdx/web-components/text';
|
|
4
|
+
/** Whether a consumer child bound for the default region is still waiting to be placed. */
|
|
5
|
+
/**
|
|
6
|
+
* Placeholder block for a region with nothing to show — no content yet, no
|
|
7
|
+
* results, first use, or disconnected — composing a Heading, a Text
|
|
8
|
+
* description and consumer-supplied icon and actions.
|
|
9
|
+
*
|
|
10
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
11
|
+
* targets: `.skdx-empty-state` on the host, then `__icon`, `__title`,
|
|
12
|
+
* `__description`, `__content` and `__actions`. `data-size` and `data-align`
|
|
13
|
+
* sit on the host for the skin to read.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <skdx-empty-state
|
|
18
|
+
* title="No invoices yet"
|
|
19
|
+
* description="Invoices you create will show up here."
|
|
20
|
+
* >
|
|
21
|
+
* <svg slot="icon"></svg>
|
|
22
|
+
* <skdx-button slot="actions">Create invoice</skdx-button>
|
|
23
|
+
* </skdx-empty-state>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @slot - Extra content rendered between the description and the actions region.
|
|
27
|
+
* @slot icon - Decorative illustration or glyph rendered above the title.
|
|
28
|
+
* @slot actions - Primary and secondary controls rendered below the content.
|
|
29
|
+
*/
|
|
30
|
+
export declare class SkdxEmptyState extends LitElement {
|
|
31
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
32
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
33
|
+
/** Heading text naming the empty region, rendered into a derived Heading. */
|
|
34
|
+
title: string;
|
|
35
|
+
/**
|
|
36
|
+
* Supporting copy rendered below the title, explaining why the region is empty.
|
|
37
|
+
* @default undefined — no description region renders.
|
|
38
|
+
*/
|
|
39
|
+
description?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Outline level of the derived title heading, lowered or raised to fit the surrounding outline.
|
|
42
|
+
* @default 3
|
|
43
|
+
*/
|
|
44
|
+
headingLevel: 1 | 2 | 3 | 4 | 5 | 6;
|
|
45
|
+
/**
|
|
46
|
+
* Visual size rung, written to `data-size` on the host; the skin scales the icon, spacing and title by it.
|
|
47
|
+
* @default undefined — the skin's own default size.
|
|
48
|
+
*/
|
|
49
|
+
size?: 'sm' | 'md' | 'lg' | (string & {}) | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Text and content alignment rung, written to `data-align` on the host.
|
|
52
|
+
* @default 'center'
|
|
53
|
+
*/
|
|
54
|
+
align: 'center' | 'start' | (string & {});
|
|
55
|
+
/** Generated title id, so a consumer can name a surrounding landmark with it. */
|
|
56
|
+
private readonly titleId;
|
|
57
|
+
connectedCallback(): void;
|
|
58
|
+
private region;
|
|
59
|
+
/** Whether the consumer supplied anything for `name` — still true once it has been moved in. */
|
|
60
|
+
private hasSlotted;
|
|
61
|
+
private get hasContent();
|
|
62
|
+
protected updated(): void;
|
|
63
|
+
render(): TemplateResult;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
'skdx-empty-state': SkdxEmptyState;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var m=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var i=(l,a,e,d)=>{for(var s=d>1?void 0:d?g(a,e):a,h=l.length-1,p;h>=0;h--)(p=l[h])&&(s=(d?p(a,e,s):p(s))||s);return d&&s&&m(a,e,s),s};import{html as n,LitElement as u,nothing as o}from"lit";import{property as r}from"lit/decorators.js";import{customElement as v}from"../internal/define.js";import{hasUnslottedChild as y,placeSlotted as x}from"../internal/slots.js";import"@skdx/web-components/heading";import"@skdx/web-components/text";var c="data-skdx-empty-state-generated",k=0,t=class extends u{constructor(){super(...arguments);this.headingLevel=3;this.align="center";this.titleId=`skdx-empty-state-title-${++k}`}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.requestUpdate())}region(e){return this.querySelector(`.skdx-empty-state__${e}`)}hasSlotted(e){return this.querySelector(`[slot="${e}"], [data-skdx-slot="${e}"]`)!==null}get hasContent(){return y(this,c)||(this.region("content")?.hasChildNodes()??!1)}updated(){this.setAttribute("data-align",this.align),this.size===void 0?this.removeAttribute("data-size"):this.setAttribute("data-size",this.size),x(this,c,{icon:this.region("icon"),actions:this.region("actions")},this.region("content"))}render(){return n`
|
|
2
|
+
${this.hasSlotted("icon")?n`<div
|
|
3
|
+
class="skdx-empty-state__icon"
|
|
4
|
+
aria-hidden="true"
|
|
5
|
+
data-skdx-empty-state-generated
|
|
6
|
+
></div>`:o}
|
|
7
|
+
<skdx-heading
|
|
8
|
+
class="skdx-empty-state__title"
|
|
9
|
+
as=${`h${this.headingLevel}`}
|
|
10
|
+
id=${this.titleId}
|
|
11
|
+
data-skdx-empty-state-generated
|
|
12
|
+
>${this.title??""}</skdx-heading
|
|
13
|
+
>
|
|
14
|
+
${this.description?n`<skdx-text
|
|
15
|
+
class="skdx-empty-state__description"
|
|
16
|
+
as="p"
|
|
17
|
+
.tone=${"muted"}
|
|
18
|
+
data-skdx-empty-state-generated
|
|
19
|
+
>${this.description}</skdx-text
|
|
20
|
+
>`:o}
|
|
21
|
+
${this.hasContent?n`<div
|
|
22
|
+
class="skdx-empty-state__content"
|
|
23
|
+
data-skdx-empty-state-generated
|
|
24
|
+
></div>`:o}
|
|
25
|
+
${this.hasSlotted("actions")?n`<div
|
|
26
|
+
class="skdx-empty-state__actions"
|
|
27
|
+
data-skdx-empty-state-generated
|
|
28
|
+
></div>`:o}
|
|
29
|
+
`}};i([r({type:String})],t.prototype,"title",2),i([r({type:String})],t.prototype,"description",2),i([r({type:Number,attribute:"heading-level"})],t.prototype,"headingLevel",2),i([r({type:String})],t.prototype,"size",2),i([r({type:String})],t.prototype,"align",2),t=i([v("skdx-empty-state","empty-state","root")],t);export{t as SkdxEmptyState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var o in t)p(e,o,{get:t[o],enumerable:!0})},k=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of a(t))!d.call(e,m)&&m!==o&&p(e,m,{get:()=>t[m],enumerable:!(r=S(t,m))||r.enumerable});return e};var y=e=>k(p({},"__esModule",{value:!0}),e);var E={};f(E,{SkdxEmptyState:()=>x.SkdxEmptyState});module.exports=y(E);var x=require("./EmptyState.cjs");0&&(module.exports={SkdxEmptyState});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxEmptyState } from './EmptyState.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxEmptyState } from './EmptyState.js';
|