@skdx/react-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/dist/chat-composer/ChatComposer.cjs +2 -0
- package/dist/chat-composer/ChatComposer.d.cts +20 -0
- package/dist/chat-composer/ChatComposer.d.ts +20 -0
- package/dist/chat-composer/ChatComposer.js +2 -0
- package/dist/chat-composer/index.d.cts +2 -0
- package/dist/chat-composer/index.d.ts +2 -0
- package/dist/chat-composer/types.d.cts +96 -0
- package/dist/chat-composer/types.d.ts +96 -0
- package/dist/chat-message/ChatMessage.cjs +2 -0
- package/dist/chat-message/ChatMessage.d.cts +23 -0
- package/dist/chat-message/ChatMessage.d.ts +23 -0
- package/dist/chat-message/ChatMessage.js +2 -0
- package/dist/chat-message/index.d.cts +2 -0
- package/dist/chat-message/index.d.ts +2 -0
- package/dist/chat-message/types.d.cts +57 -0
- package/dist/chat-message/types.d.ts +57 -0
- package/dist/comment/Comment.cjs +2 -0
- package/dist/comment/Comment.d.cts +22 -0
- package/dist/comment/Comment.d.ts +22 -0
- package/dist/comment/Comment.js +2 -0
- package/dist/comment/index.d.cts +2 -0
- package/dist/comment/index.d.ts +2 -0
- package/dist/comment/types.d.cts +47 -0
- package/dist/comment/types.d.ts +47 -0
- package/dist/comment-thread/CommentThread.cjs +2 -0
- package/dist/comment-thread/CommentThread.d.cts +21 -0
- package/dist/comment-thread/CommentThread.d.ts +21 -0
- package/dist/comment-thread/CommentThread.js +2 -0
- package/dist/comment-thread/index.d.cts +2 -0
- package/dist/comment-thread/index.d.ts +2 -0
- package/dist/comment-thread/types.d.cts +46 -0
- package/dist/comment-thread/types.d.ts +46 -0
- package/dist/confirm-dialog/ConfirmDialog.cjs +2 -0
- package/dist/confirm-dialog/ConfirmDialog.d.cts +31 -0
- package/dist/confirm-dialog/ConfirmDialog.d.ts +31 -0
- package/dist/confirm-dialog/ConfirmDialog.js +2 -0
- package/dist/confirm-dialog/index.d.cts +2 -0
- package/dist/confirm-dialog/index.d.ts +2 -0
- package/dist/confirm-dialog/types.d.cts +114 -0
- package/dist/confirm-dialog/types.d.ts +114 -0
- package/dist/conversation-list/ConversationList.cjs +2 -0
- package/dist/conversation-list/ConversationList.d.cts +20 -0
- package/dist/conversation-list/ConversationList.d.ts +20 -0
- package/dist/conversation-list/ConversationList.js +2 -0
- package/dist/conversation-list/index.d.cts +2 -0
- package/dist/conversation-list/index.d.ts +2 -0
- package/dist/conversation-list/types.d.cts +94 -0
- package/dist/conversation-list/types.d.ts +94 -0
- package/dist/empty-state/EmptyState.cjs +2 -0
- package/dist/empty-state/EmptyState.d.cts +21 -0
- package/dist/empty-state/EmptyState.d.ts +21 -0
- package/dist/empty-state/EmptyState.js +2 -0
- package/dist/empty-state/index.d.cts +2 -0
- package/dist/empty-state/index.d.ts +2 -0
- package/dist/empty-state/types.d.cts +36 -0
- package/dist/empty-state/types.d.ts +36 -0
- package/dist/filter-bar/FilterBar.cjs +2 -0
- package/dist/filter-bar/FilterBar.d.cts +23 -0
- package/dist/filter-bar/FilterBar.d.ts +23 -0
- package/dist/filter-bar/FilterBar.js +2 -0
- package/dist/filter-bar/index.d.cts +2 -0
- package/dist/filter-bar/index.d.ts +2 -0
- package/dist/filter-bar/types.d.cts +81 -0
- package/dist/filter-bar/types.d.ts +81 -0
- package/dist/forgot-password-page/ForgotPasswordPage.cjs +2 -0
- package/dist/forgot-password-page/ForgotPasswordPage.d.cts +20 -0
- package/dist/forgot-password-page/ForgotPasswordPage.d.ts +20 -0
- package/dist/forgot-password-page/ForgotPasswordPage.js +2 -0
- package/dist/forgot-password-page/index.d.cts +2 -0
- package/dist/forgot-password-page/index.d.ts +2 -0
- package/dist/forgot-password-page/types.d.cts +54 -0
- package/dist/forgot-password-page/types.d.ts +54 -0
- package/dist/form-section/FormSection.cjs +2 -0
- package/dist/form-section/FormSection.d.cts +22 -0
- package/dist/form-section/FormSection.d.ts +22 -0
- package/dist/form-section/FormSection.js +2 -0
- package/dist/form-section/index.d.cts +2 -0
- package/dist/form-section/index.d.ts +2 -0
- package/dist/form-section/types.d.cts +27 -0
- package/dist/form-section/types.d.ts +27 -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/AuthPanel.d.cts +54 -0
- package/dist/internal/AuthPanel.d.ts +54 -0
- package/dist/internal/Region.d.cts +17 -0
- package/dist/internal/Region.d.ts +17 -0
- package/dist/internal/formValue.d.cts +6 -0
- package/dist/internal/formValue.d.ts +6 -0
- package/dist/notification-center/NotificationCenter.cjs +2 -0
- package/dist/notification-center/NotificationCenter.d.cts +21 -0
- package/dist/notification-center/NotificationCenter.d.ts +21 -0
- package/dist/notification-center/NotificationCenter.js +2 -0
- package/dist/notification-center/index.d.cts +2 -0
- package/dist/notification-center/index.d.ts +2 -0
- package/dist/notification-center/types.d.cts +104 -0
- package/dist/notification-center/types.d.ts +104 -0
- package/dist/onboarding-checklist/OnboardingChecklist.cjs +2 -0
- package/dist/onboarding-checklist/OnboardingChecklist.d.cts +25 -0
- package/dist/onboarding-checklist/OnboardingChecklist.d.ts +25 -0
- package/dist/onboarding-checklist/OnboardingChecklist.js +2 -0
- package/dist/onboarding-checklist/index.d.cts +2 -0
- package/dist/onboarding-checklist/index.d.ts +2 -0
- package/dist/onboarding-checklist/types.d.cts +67 -0
- package/dist/onboarding-checklist/types.d.ts +67 -0
- package/dist/reset-password-page/ResetPasswordPage.cjs +2 -0
- package/dist/reset-password-page/ResetPasswordPage.d.cts +20 -0
- package/dist/reset-password-page/ResetPasswordPage.d.ts +20 -0
- package/dist/reset-password-page/ResetPasswordPage.js +2 -0
- package/dist/reset-password-page/index.d.cts +2 -0
- package/dist/reset-password-page/index.d.ts +2 -0
- package/dist/reset-password-page/types.d.cts +64 -0
- package/dist/reset-password-page/types.d.ts +64 -0
- package/dist/sign-in-page/SignInPage.cjs +1 -1
- package/dist/sign-in-page/SignInPage.d.cts +1 -1
- package/dist/sign-in-page/SignInPage.d.ts +1 -1
- package/dist/sign-in-page/SignInPage.js +1 -1
- package/dist/sign-up-page/SignUpPage.cjs +2 -0
- package/dist/sign-up-page/SignUpPage.d.cts +21 -0
- package/dist/sign-up-page/SignUpPage.d.ts +21 -0
- package/dist/sign-up-page/SignUpPage.js +2 -0
- package/dist/sign-up-page/index.d.cts +2 -0
- package/dist/sign-up-page/index.d.ts +2 -0
- package/dist/sign-up-page/types.d.cts +100 -0
- package/dist/sign-up-page/types.d.ts +100 -0
- package/dist/stat-card/StatCard.cjs +2 -0
- package/dist/stat-card/StatCard.d.cts +22 -0
- package/dist/stat-card/StatCard.d.ts +22 -0
- package/dist/stat-card/StatCard.js +2 -0
- package/dist/stat-card/index.d.cts +2 -0
- package/dist/stat-card/index.d.ts +2 -0
- package/dist/stat-card/types.d.cts +71 -0
- package/dist/stat-card/types.d.ts +71 -0
- package/dist/usage-card/UsageCard.cjs +2 -0
- package/dist/usage-card/UsageCard.d.cts +17 -0
- package/dist/usage-card/UsageCard.d.ts +17 -0
- package/dist/usage-card/UsageCard.js +2 -0
- package/dist/usage-card/index.d.cts +2 -0
- package/dist/usage-card/index.d.ts +2 -0
- package/dist/usage-card/types.d.cts +50 -0
- package/dist/usage-card/types.d.ts +50 -0
- package/dist/usage-card/usage.d.cts +18 -0
- package/dist/usage-card/usage.d.ts +18 -0
- package/dist/user-menu/UserMenu.cjs +2 -0
- package/dist/user-menu/UserMenu.d.cts +19 -0
- package/dist/user-menu/UserMenu.d.ts +19 -0
- package/dist/user-menu/UserMenu.js +2 -0
- package/dist/user-menu/index.d.cts +2 -0
- package/dist/user-menu/index.d.ts +2 -0
- package/dist/user-menu/types.d.cts +89 -0
- package/dist/user-menu/types.d.ts +89 -0
- package/dist/verification-page/VerificationPage.cjs +2 -0
- package/dist/verification-page/VerificationPage.d.cts +20 -0
- package/dist/verification-page/VerificationPage.d.ts +20 -0
- package/dist/verification-page/VerificationPage.js +2 -0
- package/dist/verification-page/index.d.cts +2 -0
- package/dist/verification-page/index.d.ts +2 -0
- package/dist/verification-page/types.d.cts +89 -0
- package/dist/verification-page/types.d.ts +89 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.cjs +2 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.d.cts +25 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.d.ts +25 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.js +2 -0
- package/dist/workspace-switcher/index.d.cts +2 -0
- package/dist/workspace-switcher/index.d.ts +2 -0
- package/dist/workspace-switcher/types.d.cts +151 -0
- package/dist/workspace-switcher/types.d.ts +151 -0
- package/package.json +194 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";var g=Object.create;var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var y=(e,t)=>{for(var o in t)d(e,o,{get:t[o],enumerable:!0})},x=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of k(t))!v.call(e,r)&&r!==o&&d(e,r,{get:()=>t[r],enumerable:!(i=b(t,r))||i.enumerable});return e};var P=(e,t,o)=>(o=e!=null?g(S(e)):{},x(t||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e)),F=e=>x(d({},"__esModule",{value:!0}),e);var $={};y($,{FormSection:()=>f});module.exports=F($);var m=P(require("react"),1),c=require("@skdx/react");function R(...e){let t="";for(let o of e)o&&(t=t?`${t} ${o}`:o);return t}function s(e,t,o){let i=t==="root",r=i?`skdx-${e}`:`skdx-${e}__${t}`,a={className:R(r,o),"data-part":t};return i&&(a["data-skdx-component"]=e),a}var n=require("react/jsx-runtime"),f=({title:e,description:t,headingLevel:o=2,actions:i,variant:r,children:a,...u})=>{let l=m.useId(),p=m.useId();return(0,n.jsxs)("section",{"data-variant":r,"aria-labelledby":l,"aria-describedby":t?p:void 0,...u,...s("form-section","root",u.className),children:[(0,n.jsxs)("div",{...s("form-section","header"),children:[(0,n.jsx)(c.Heading,{as:`h${o}`,id:l,...s("form-section","title"),children:e}),t?(0,n.jsx)(c.Text,{as:"p",tone:"muted",id:p,...s("form-section","description"),children:t}):null]}),(0,n.jsx)("div",{...s("form-section","content"),children:a}),i?(0,n.jsx)("div",{...s("form-section","footer"),children:i}):null]})};f.displayName="FormSection";0&&(module.exports={FormSection});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FormSectionProps } from './types.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* Titled group inside a larger form: a heading, supporting text, the
|
|
5
|
+
* group's fields and a footer for the group's own actions, composing
|
|
6
|
+
* Heading and Text around consumer-supplied fields.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <FormSection
|
|
11
|
+
* title="Billing address"
|
|
12
|
+
* description="Used for invoices and receipts."
|
|
13
|
+
* actions={<Button type="submit">Save</Button>}
|
|
14
|
+
* >
|
|
15
|
+
* <TextField label="Street" />
|
|
16
|
+
* </FormSection>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const FormSection: {
|
|
20
|
+
({ title, description, headingLevel, actions, variant, children, ...props }: FormSectionProps): React.ReactNode;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FormSectionProps } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Titled group inside a larger form: a heading, supporting text, the
|
|
5
|
+
* group's fields and a footer for the group's own actions, composing
|
|
6
|
+
* Heading and Text around consumer-supplied fields.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <FormSection
|
|
11
|
+
* title="Billing address"
|
|
12
|
+
* description="Used for invoices and receipts."
|
|
13
|
+
* actions={<Button type="submit">Save</Button>}
|
|
14
|
+
* >
|
|
15
|
+
* <TextField label="Street" />
|
|
16
|
+
* </FormSection>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const FormSection: {
|
|
20
|
+
({ title, description, headingLevel, actions, variant, children, ...props }: FormSectionProps): React.ReactNode;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import*as d from"react";import{Heading as x,Text as g}from"@skdx/react";function p(...e){let t="";for(let o of e)o&&(t=t?`${t} ${o}`:o);return t}function r(e,t,o){let i=t==="root",a=i?`skdx-${e}`:`skdx-${e}__${t}`,n={className:p(a,o),"data-part":t};return i&&(n["data-skdx-component"]=e),n}import{jsx as s,jsxs as u}from"react/jsx-runtime";var l=({title:e,description:t,headingLevel:o=2,actions:i,variant:a,children:n,...c})=>{let m=d.useId(),f=d.useId();return u("section",{"data-variant":a,"aria-labelledby":m,"aria-describedby":t?f:void 0,...c,...r("form-section","root",c.className),children:[u("div",{...r("form-section","header"),children:[s(x,{as:`h${o}`,id:m,...r("form-section","title"),children:e}),t?s(g,{as:"p",tone:"muted",id:f,...r("form-section","description"),children:t}):null]}),s("div",{...r("form-section","content"),children:n}),i?s("div",{...r("form-section","footer"),children:i}):null]})};l.displayName="FormSection";export{l as FormSection};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
/** Props for the {@link FormSection} block. */
|
|
3
|
+
export interface FormSectionProps extends React.ComponentPropsWithRef<'section'> {
|
|
4
|
+
/** Heading text naming the group, rendered into a derived Heading that names the section. */
|
|
5
|
+
title: string;
|
|
6
|
+
/**
|
|
7
|
+
* Supporting copy rendered below the title, explaining the group's fields.
|
|
8
|
+
* @default undefined — no description region renders and aria-describedby is omitted.
|
|
9
|
+
*/
|
|
10
|
+
description?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Outline level of the derived title heading, from `1` down to `6` inside a larger form outline.
|
|
13
|
+
* @default 2
|
|
14
|
+
*/
|
|
15
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Save, cancel or other controls rendered in a footer below the group's fields.
|
|
18
|
+
* @default undefined — no footer region renders.
|
|
19
|
+
*/
|
|
20
|
+
actions?: React.ReactNode | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Layout rung mirrored to `data-variant`; `bordered` draws a bounded panel and `split`
|
|
23
|
+
* places the header beside the content on wide viewports.
|
|
24
|
+
* @default undefined — plain, stacked layout.
|
|
25
|
+
*/
|
|
26
|
+
variant?: 'bordered' | 'split' | (string & {}) | undefined;
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
/** Props for the {@link FormSection} block. */
|
|
3
|
+
export interface FormSectionProps extends React.ComponentPropsWithRef<'section'> {
|
|
4
|
+
/** Heading text naming the group, rendered into a derived Heading that names the section. */
|
|
5
|
+
title: string;
|
|
6
|
+
/**
|
|
7
|
+
* Supporting copy rendered below the title, explaining the group's fields.
|
|
8
|
+
* @default undefined — no description region renders and aria-describedby is omitted.
|
|
9
|
+
*/
|
|
10
|
+
description?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Outline level of the derived title heading, from `1` down to `6` inside a larger form outline.
|
|
13
|
+
* @default 2
|
|
14
|
+
*/
|
|
15
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Save, cancel or other controls rendered in a footer below the group's fields.
|
|
18
|
+
* @default undefined — no footer region renders.
|
|
19
|
+
*/
|
|
20
|
+
actions?: React.ReactNode | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Layout rung mirrored to `data-variant`; `bordered` draws a bounded panel and `split`
|
|
23
|
+
* places the header beside the content on wide viewports.
|
|
24
|
+
* @default undefined — plain, stacked layout.
|
|
25
|
+
*/
|
|
26
|
+
variant?: 'bordered' | 'split' | (string & {}) | undefined;
|
|
27
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var a=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var N=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:!0})},B=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of U(e))!L.call(t,o)&&o!==r&&a(t,o,{get:()=>e[o],enumerable:!(i=v(e,o))||i.enumerable});return t};var M=t=>B(a({},"__esModule",{value:!0}),t);var O={};N(O,{ChatComposer:()=>P.ChatComposer,ChatMessage:()=>g.ChatMessage,Comment:()=>C.Comment,CommentThread:()=>f.CommentThread,ConfirmDialog:()=>d.ConfirmDialog,ConversationList:()=>x.ConversationList,DashboardLayout:()=>s.DashboardLayout,EmptyState:()=>m.EmptyState,FilterBar:()=>c.FilterBar,ForgotPasswordPage:()=>F.ForgotPasswordPage,FormSection:()=>h.FormSection,NotificationCenter:()=>S.NotificationCenter,OnboardingChecklist:()=>l.OnboardingChecklist,PageContainer:()=>n.PageContainer,ResetPasswordPage:()=>k.ResetPasswordPage,SignInPage:()=>p.SignInPage,SignUpPage:()=>w.SignUpPage,StatCard:()=>y.StatCard,UsageCard:()=>D.UsageCard,UserMenu:()=>b.UserMenu,VerificationPage:()=>u.VerificationPage,WorkspaceSwitcher:()=>I.WorkspaceSwitcher,defaultProviderLabel:()=>p.defaultProviderLabel});module.exports=M(O);var s=require("./dashboard-layout/DashboardLayout.cjs"),n=require("./page-container/PageContainer.cjs"),p=require("./sign-in-page/SignInPage.cjs"),m=require("./empty-state/EmptyState.cjs"),y=require("./stat-card/StatCard.cjs"),P=require("./chat-composer/ChatComposer.cjs"),g=require("./chat-message/ChatMessage.cjs"),C=require("./comment/Comment.cjs"),f=require("./comment-thread/CommentThread.cjs"),d=require("./confirm-dialog/ConfirmDialog.cjs"),x=require("./conversation-list/ConversationList.cjs"),c=require("./filter-bar/FilterBar.cjs"),h=require("./form-section/FormSection.cjs"),S=require("./notification-center/NotificationCenter.cjs"),l=require("./onboarding-checklist/OnboardingChecklist.cjs"),D=require("./usage-card/UsageCard.cjs"),b=require("./user-menu/UserMenu.cjs"),I=require("./workspace-switcher/WorkspaceSwitcher.cjs"),w=require("./sign-up-page/SignUpPage.cjs"),F=require("./forgot-password-page/ForgotPasswordPage.cjs"),k=require("./reset-password-page/ResetPasswordPage.cjs"),u=require("./verification-page/VerificationPage.cjs");0&&(module.exports={ChatComposer,ChatMessage,Comment,CommentThread,ConfirmDialog,ConversationList,DashboardLayout,EmptyState,FilterBar,ForgotPasswordPage,FormSection,NotificationCenter,OnboardingChecklist,PageContainer,ResetPasswordPage,SignInPage,SignUpPage,StatCard,UsageCard,UserMenu,VerificationPage,WorkspaceSwitcher,defaultProviderLabel});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
export { DashboardLayout, type DashboardLayoutProps, type DashboardNavigationItem, type DashboardNavigationKind, } from './dashboard-layout/index.cjs';
|
|
2
2
|
export { PageContainer, type PageContainerProps, type PageContainerBreadcrumb, } from './page-container/index.cjs';
|
|
3
3
|
export { SignInPage, defaultProviderLabel, type SignInPageProps, type SignInProvider, type SignInDetail, } from './sign-in-page/index.cjs';
|
|
4
|
+
export { EmptyState, type EmptyStateProps } from './empty-state/index.cjs';
|
|
5
|
+
export { StatCard, type StatCardProps } from './stat-card/index.cjs';
|
|
6
|
+
export { ChatComposer, type ChatComposerProps, type ChatComposerSendDetail, type ChatComposerSubmitKey, } from './chat-composer/index.cjs';
|
|
7
|
+
export { ChatMessage, type ChatMessageProps } from './chat-message/index.cjs';
|
|
8
|
+
export { Comment, type CommentProps } from './comment/index.cjs';
|
|
9
|
+
export { CommentThread, type CommentThreadProps } from './comment-thread/index.cjs';
|
|
10
|
+
export { ConfirmDialog, type ConfirmDialogProps } from './confirm-dialog/index.cjs';
|
|
11
|
+
export { ConversationList, type ConversationListItem, type ConversationListProps, } from './conversation-list/index.cjs';
|
|
12
|
+
export { FilterBar, type FilterBarFilter, type FilterBarProps } from './filter-bar/index.cjs';
|
|
13
|
+
export { FormSection, type FormSectionProps } from './form-section/index.cjs';
|
|
14
|
+
export { NotificationCenter, type NotificationCenterItem, type NotificationCenterProps, } from './notification-center/index.cjs';
|
|
15
|
+
export { OnboardingChecklist, type OnboardingChecklistItem, type OnboardingChecklistItemState, type OnboardingChecklistProps, } from './onboarding-checklist/index.cjs';
|
|
16
|
+
export { UsageCard, type UsageCardProps } from './usage-card/index.cjs';
|
|
17
|
+
export { UserMenu, type UserMenuProps } from './user-menu/index.cjs';
|
|
18
|
+
export { WorkspaceSwitcher, type WorkspaceSwitcherItem, type WorkspaceSwitcherProps, } from './workspace-switcher/index.cjs';
|
|
19
|
+
export { SignUpPage, type SignUpPageProps, type SignUpDetail } from './sign-up-page/index.cjs';
|
|
20
|
+
export { ForgotPasswordPage, type ForgotPasswordPageProps, type ForgotPasswordDetail, } from './forgot-password-page/index.cjs';
|
|
21
|
+
export { ResetPasswordPage, type ResetPasswordPageProps, type ResetPasswordDetail, } from './reset-password-page/index.cjs';
|
|
22
|
+
export { VerificationPage, type VerificationPageProps, type VerificationDetail, } from './verification-page/index.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
export { DashboardLayout, type DashboardLayoutProps, type DashboardNavigationItem, type DashboardNavigationKind, } from './dashboard-layout/index.js';
|
|
2
2
|
export { PageContainer, type PageContainerProps, type PageContainerBreadcrumb, } from './page-container/index.js';
|
|
3
3
|
export { SignInPage, defaultProviderLabel, type SignInPageProps, type SignInProvider, type SignInDetail, } from './sign-in-page/index.js';
|
|
4
|
+
export { EmptyState, type EmptyStateProps } from './empty-state/index.js';
|
|
5
|
+
export { StatCard, type StatCardProps } from './stat-card/index.js';
|
|
6
|
+
export { ChatComposer, type ChatComposerProps, type ChatComposerSendDetail, type ChatComposerSubmitKey, } from './chat-composer/index.js';
|
|
7
|
+
export { ChatMessage, type ChatMessageProps } from './chat-message/index.js';
|
|
8
|
+
export { Comment, type CommentProps } from './comment/index.js';
|
|
9
|
+
export { CommentThread, type CommentThreadProps } from './comment-thread/index.js';
|
|
10
|
+
export { ConfirmDialog, type ConfirmDialogProps } from './confirm-dialog/index.js';
|
|
11
|
+
export { ConversationList, type ConversationListItem, type ConversationListProps, } from './conversation-list/index.js';
|
|
12
|
+
export { FilterBar, type FilterBarFilter, type FilterBarProps } from './filter-bar/index.js';
|
|
13
|
+
export { FormSection, type FormSectionProps } from './form-section/index.js';
|
|
14
|
+
export { NotificationCenter, type NotificationCenterItem, type NotificationCenterProps, } from './notification-center/index.js';
|
|
15
|
+
export { OnboardingChecklist, type OnboardingChecklistItem, type OnboardingChecklistItemState, type OnboardingChecklistProps, } from './onboarding-checklist/index.js';
|
|
16
|
+
export { UsageCard, type UsageCardProps } from './usage-card/index.js';
|
|
17
|
+
export { UserMenu, type UserMenuProps } from './user-menu/index.js';
|
|
18
|
+
export { WorkspaceSwitcher, type WorkspaceSwitcherItem, type WorkspaceSwitcherProps, } from './workspace-switcher/index.js';
|
|
19
|
+
export { SignUpPage, type SignUpPageProps, type SignUpDetail } from './sign-up-page/index.js';
|
|
20
|
+
export { ForgotPasswordPage, type ForgotPasswordPageProps, type ForgotPasswordDetail, } from './forgot-password-page/index.js';
|
|
21
|
+
export { ResetPasswordPage, type ResetPasswordPageProps, type ResetPasswordDetail, } from './reset-password-page/index.js';
|
|
22
|
+
export { VerificationPage, type VerificationPageProps, type VerificationDetail, } from './verification-page/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{DashboardLayout as o}from"./dashboard-layout/DashboardLayout.js";import{PageContainer as
|
|
2
|
+
import{DashboardLayout as o}from"./dashboard-layout/DashboardLayout.js";import{PageContainer as p}from"./page-container/PageContainer.js";import{SignInPage as i,defaultProviderLabel as s}from"./sign-in-page/SignInPage.js";import{EmptyState as m}from"./empty-state/EmptyState.js";import{StatCard as P}from"./stat-card/StatCard.js";import{ChatComposer as C}from"./chat-composer/ChatComposer.js";import{ChatMessage as d}from"./chat-message/ChatMessage.js";import{Comment as c}from"./comment/Comment.js";import{CommentThread as S}from"./comment-thread/CommentThread.js";import{ConfirmDialog as D}from"./confirm-dialog/ConfirmDialog.js";import{ConversationList as I}from"./conversation-list/ConversationList.js";import{FilterBar as F}from"./filter-bar/FilterBar.js";import{FormSection as u}from"./form-section/FormSection.js";import{NotificationCenter as U}from"./notification-center/NotificationCenter.js";import{OnboardingChecklist as N}from"./onboarding-checklist/OnboardingChecklist.js";import{UsageCard as M}from"./usage-card/UsageCard.js";import{UserMenu as R}from"./user-menu/UserMenu.js";import{WorkspaceSwitcher as W}from"./workspace-switcher/WorkspaceSwitcher.js";import{SignUpPage as K}from"./sign-up-page/SignUpPage.js";import{ForgotPasswordPage as j}from"./forgot-password-page/ForgotPasswordPage.js";import{ResetPasswordPage as z}from"./reset-password-page/ResetPasswordPage.js";import{VerificationPage as G}from"./verification-page/VerificationPage.js";export{C as ChatComposer,d as ChatMessage,c as Comment,S as CommentThread,D as ConfirmDialog,I as ConversationList,o as DashboardLayout,m as EmptyState,F as FilterBar,j as ForgotPasswordPage,u as FormSection,U as NotificationCenter,N as OnboardingChecklist,p as PageContainer,z as ResetPasswordPage,i as SignInPage,K as SignUpPage,P as StatCard,M as UsageCard,R as UserMenu,G as VerificationPage,W as WorkspaceSwitcher,s as defaultProviderLabel};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SkdxPartAttributes } from './part.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* The part bags an {@link AuthPanel} spreads onto the elements it renders. Each page builds
|
|
5
|
+
* them itself, since the parity tooling reads the part helper's family and part names as string literals.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface AuthPanelParts {
|
|
10
|
+
/** Root `<section>` bag, already merged with the consumer's `className` by the caller. */
|
|
11
|
+
root: SkdxPartAttributes;
|
|
12
|
+
/** Bag for the card the heading, error and content sit in. */
|
|
13
|
+
panel: SkdxPartAttributes;
|
|
14
|
+
/** Bag for the derived `<h1>` that names the section. */
|
|
15
|
+
title: SkdxPartAttributes;
|
|
16
|
+
/** Bag for the derived error Alert. */
|
|
17
|
+
error: SkdxPartAttributes;
|
|
18
|
+
/**
|
|
19
|
+
* Bag for the footer region; omit it on a page whose contract declares no footer part.
|
|
20
|
+
* @default undefined — the footer region never renders.
|
|
21
|
+
*/
|
|
22
|
+
footer?: SkdxPartAttributes | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Props for {@link AuthPanel}, the shell shared by the authentication blocks.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export interface AuthPanelProps extends React.ComponentPropsWithRef<'section'> {
|
|
30
|
+
/** Part bags the page computed for its own family. */
|
|
31
|
+
parts: AuthPanelParts;
|
|
32
|
+
/** Heading text, rendered into the derived `<h1>` that names the section. */
|
|
33
|
+
title: string;
|
|
34
|
+
/**
|
|
35
|
+
* Message rendered into the derived error Alert above the content.
|
|
36
|
+
* @default undefined — no error region renders.
|
|
37
|
+
*/
|
|
38
|
+
error?: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Navigation rendered below the content, inside the footer region.
|
|
41
|
+
* @default undefined — no footer region renders.
|
|
42
|
+
*/
|
|
43
|
+
footer?: React.ReactNode | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Shell of every authentication block: a `<section>` named by its own heading, wrapping a
|
|
47
|
+
* panel that holds the heading, an optional error Alert, the page's content and a footer.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare const AuthPanel: {
|
|
52
|
+
({ parts, title, error, footer, children, ...rest }: AuthPanelProps): React.ReactNode;
|
|
53
|
+
displayName: string;
|
|
54
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SkdxPartAttributes } from './part.js';
|
|
3
|
+
/**
|
|
4
|
+
* The part bags an {@link AuthPanel} spreads onto the elements it renders. Each page builds
|
|
5
|
+
* them itself, since the parity tooling reads the part helper's family and part names as string literals.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface AuthPanelParts {
|
|
10
|
+
/** Root `<section>` bag, already merged with the consumer's `className` by the caller. */
|
|
11
|
+
root: SkdxPartAttributes;
|
|
12
|
+
/** Bag for the card the heading, error and content sit in. */
|
|
13
|
+
panel: SkdxPartAttributes;
|
|
14
|
+
/** Bag for the derived `<h1>` that names the section. */
|
|
15
|
+
title: SkdxPartAttributes;
|
|
16
|
+
/** Bag for the derived error Alert. */
|
|
17
|
+
error: SkdxPartAttributes;
|
|
18
|
+
/**
|
|
19
|
+
* Bag for the footer region; omit it on a page whose contract declares no footer part.
|
|
20
|
+
* @default undefined — the footer region never renders.
|
|
21
|
+
*/
|
|
22
|
+
footer?: SkdxPartAttributes | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Props for {@link AuthPanel}, the shell shared by the authentication blocks.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export interface AuthPanelProps extends React.ComponentPropsWithRef<'section'> {
|
|
30
|
+
/** Part bags the page computed for its own family. */
|
|
31
|
+
parts: AuthPanelParts;
|
|
32
|
+
/** Heading text, rendered into the derived `<h1>` that names the section. */
|
|
33
|
+
title: string;
|
|
34
|
+
/**
|
|
35
|
+
* Message rendered into the derived error Alert above the content.
|
|
36
|
+
* @default undefined — no error region renders.
|
|
37
|
+
*/
|
|
38
|
+
error?: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Navigation rendered below the content, inside the footer region.
|
|
41
|
+
* @default undefined — no footer region renders.
|
|
42
|
+
*/
|
|
43
|
+
footer?: React.ReactNode | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Shell of every authentication block: a `<section>` named by its own heading, wrapping a
|
|
47
|
+
* panel that holds the heading, an optional error Alert, the page's content and a footer.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare const AuthPanel: {
|
|
52
|
+
({ parts, title, error, footer, children, ...rest }: AuthPanelProps): React.ReactNode;
|
|
53
|
+
displayName: string;
|
|
54
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { SkdxPartAttributes } from './part.cjs';
|
|
3
|
+
/** Props for {@link Region}. @internal */
|
|
4
|
+
export interface RegionProps {
|
|
5
|
+
part: SkdxPartAttributes;
|
|
6
|
+
children?: React.ReactNode | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Optional wrapper for a consumer-supplied node: renders the part's `<div>` only when there
|
|
10
|
+
* is something to put in it, so a block's recipe stays free of one ternary per slot.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const Region: {
|
|
15
|
+
({ part, children }: RegionProps): React.ReactNode;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { SkdxPartAttributes } from './part.js';
|
|
3
|
+
/** Props for {@link Region}. @internal */
|
|
4
|
+
export interface RegionProps {
|
|
5
|
+
part: SkdxPartAttributes;
|
|
6
|
+
children?: React.ReactNode | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Optional wrapper for a consumer-supplied node: renders the part's `<div>` only when there
|
|
10
|
+
* is something to put in it, so a block's recipe stays free of one ternary per slot.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const Region: {
|
|
15
|
+
({ part, children }: RegionProps): React.ReactNode;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";var L=Object.create;var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var E=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},x=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of z(e))!B.call(t,o)&&o!==n&&u(t,o,{get:()=>e[o],enumerable:!(r=w(e,o))||r.enumerable});return t};var F=(t,e,n)=>(n=t!=null?L(A(t)):{},x(e||!t||!t.__esModule?u(n,"default",{value:t,enumerable:!0}):n,t)),H=t=>x(u({},"__esModule",{value:!0}),t);var D={};E(D,{NotificationCenter:()=>b});module.exports=H(D);var m=F(require("react"),1),c=require("@skdx/react"),y=require("../empty-state/EmptyState.cjs");function U(...t){let e="";for(let n of t)n&&(e=e?`${e} ${n}`:n);return e}function a(t,e,n){let r=e==="root",o=r?`skdx-${t}`:`skdx-${t}__${e}`,d={className:U(o,n),"data-part":e};return r&&(d["data-skdx-component"]=t),d}var i=require("react/jsx-runtime");function _({item:t,now:e,onSelect:n,onReadChange:r,renderLeading:o,renderActions:d,markReadLabel:p,markUnreadLabel:N}){let s=(0,i.jsxs)(m.Fragment,{children:[(0,i.jsx)("span",{...a("notification-center","item-title"),children:t.title}),t.description?(0,i.jsx)("span",{...a("notification-center","description"),children:t.description}):null,t.timestamp!==void 0?(0,i.jsx)(c.Time,{value:t.timestamp,relative:!0,now:e,...a("notification-center","time")}):null]});return(0,i.jsxs)("li",{"data-read":t.read?"":void 0,...a("notification-center","item"),children:[o?(0,i.jsx)("div",{"aria-hidden":"true",...a("notification-center","leading"),children:o(t)}):null,n?(0,i.jsx)("button",{type:"button",onClick:()=>n(t),...a("notification-center","body"),children:s}):(0,i.jsx)("div",{...a("notification-center","body"),children:s}),r||d?(0,i.jsxs)("div",{...a("notification-center","item-actions"),children:[d?.(t),r?(0,i.jsx)(c.Button,{size:"sm",variant:"ghost",onClick:()=>r(t,!t.read),...a("notification-center","read-toggle"),children:t.read?N:p}):null]}):null]})}var b=({notifications:t,title:e="Notifications",headingLevel:n=2,markAllReadLabel:r="Mark all as read",markReadLabel:o="Mark as read",markUnreadLabel:d="Mark as unread",emptyTitle:p="No notifications",emptyDescription:N,loading:s=!1,now:R,renderLeading:h,renderActions:I,actions:k,onSelect:P,onReadChange:S,onMarkAllRead:g,...v})=>{let C=m.useId(),$=t.filter(f=>!f.read).length,l;return s?l=(0,i.jsxs)("div",{"aria-hidden":"true",...a("notification-center","loading"),children:[(0,i.jsx)(c.Skeleton,{shape:"line"}),(0,i.jsx)(c.Skeleton,{shape:"line"}),(0,i.jsx)(c.Skeleton,{shape:"line"})]}):t.length===0?l=(0,i.jsx)(y.EmptyState,{title:p,description:N,size:"sm",...a("notification-center","empty")}):l=(0,i.jsx)("ul",{...a("notification-center","list"),children:t.map(f=>(0,i.jsx)(_,{item:f,now:R,onSelect:P,onReadChange:S,renderLeading:h,renderActions:I,markReadLabel:o,markUnreadLabel:d},f.id))}),(0,i.jsxs)("section",{"aria-labelledby":C,"aria-busy":s,...v,...a("notification-center","root",v.className),children:[(0,i.jsxs)("div",{...a("notification-center","header"),children:[(0,i.jsx)(c.Heading,{as:`h${n}`,id:C,...a("notification-center","title"),children:e}),k||g?(0,i.jsxs)("div",{...a("notification-center","actions"),children:[k,g?(0,i.jsx)(c.Button,{size:"sm",variant:"ghost",onClick:g,disabled:$===0,...a("notification-center","mark-all-read"),children:r}):null]}):null]}),l]})};b.displayName="NotificationCenter";0&&(module.exports={NotificationCenter});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NotificationCenterProps } from './types.cjs';
|
|
3
|
+
/**
|
|
4
|
+
* Notification list block: read/unread state, timestamps, a leading visual
|
|
5
|
+
* and per-item and mark-all-read actions, rendered as panel content for a
|
|
6
|
+
* Popover, Drawer, Dialog or page — the block owns no overlay of its own.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <NotificationCenter
|
|
11
|
+
* notifications={notifications}
|
|
12
|
+
* onSelect={(item) => open(item)}
|
|
13
|
+
* onReadChange={(item, read) => markRead(item.id, read)}
|
|
14
|
+
* onMarkAllRead={() => markAllRead()}
|
|
15
|
+
* />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const NotificationCenter: {
|
|
19
|
+
({ notifications, title, headingLevel, markAllReadLabel, markReadLabel, markUnreadLabel, emptyTitle, emptyDescription, loading, now, renderLeading, renderActions, actions, onSelect, onReadChange, onMarkAllRead, ...props }: NotificationCenterProps): React.ReactNode;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { NotificationCenterProps } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Notification list block: read/unread state, timestamps, a leading visual
|
|
5
|
+
* and per-item and mark-all-read actions, rendered as panel content for a
|
|
6
|
+
* Popover, Drawer, Dialog or page — the block owns no overlay of its own.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <NotificationCenter
|
|
11
|
+
* notifications={notifications}
|
|
12
|
+
* onSelect={(item) => open(item)}
|
|
13
|
+
* onReadChange={(item, read) => markRead(item.id, read)}
|
|
14
|
+
* onMarkAllRead={() => markAllRead()}
|
|
15
|
+
* />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const NotificationCenter: {
|
|
19
|
+
({ notifications, title, headingLevel, markAllReadLabel, markReadLabel, markUnreadLabel, emptyTitle, emptyDescription, loading, now, renderLeading, renderActions, actions, onSelect, onReadChange, onMarkAllRead, ...props }: NotificationCenterProps): React.ReactNode;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import*as u from"react";import{Button as C,Heading as L,Skeleton as g,Time as w}from"@skdx/react";import{EmptyState as z}from"../empty-state/EmptyState.js";function $(...t){let n="";for(let a of t)a&&(n=n?`${n} ${a}`:a);return n}function e(t,n,a){let o=n==="root",d=o?`skdx-${t}`:`skdx-${t}__${n}`,r={className:$(d,a),"data-part":n};return o&&(r["data-skdx-component"]=t),r}import{jsx as i,jsxs as c}from"react/jsx-runtime";function A({item:t,now:n,onSelect:a,onReadChange:o,renderLeading:d,renderActions:r,markReadLabel:m,markUnreadLabel:p}){let s=c(u.Fragment,{children:[i("span",{...e("notification-center","item-title"),children:t.title}),t.description?i("span",{...e("notification-center","description"),children:t.description}):null,t.timestamp!==void 0?i(w,{value:t.timestamp,relative:!0,now:n,...e("notification-center","time")}):null]});return c("li",{"data-read":t.read?"":void 0,...e("notification-center","item"),children:[d?i("div",{"aria-hidden":"true",...e("notification-center","leading"),children:d(t)}):null,a?i("button",{type:"button",onClick:()=>a(t),...e("notification-center","body"),children:s}):i("div",{...e("notification-center","body"),children:s}),o||r?c("div",{...e("notification-center","item-actions"),children:[r?.(t),o?i(C,{size:"sm",variant:"ghost",onClick:()=>o(t,!t.read),...e("notification-center","read-toggle"),children:t.read?p:m}):null]}):null]})}var x=({notifications:t,title:n="Notifications",headingLevel:a=2,markAllReadLabel:o="Mark all as read",markReadLabel:d="Mark as read",markUnreadLabel:r="Mark as unread",emptyTitle:m="No notifications",emptyDescription:p,loading:s=!1,now:y,renderLeading:R,renderActions:h,actions:b,onSelect:I,onReadChange:P,onMarkAllRead:N,...k})=>{let v=u.useId(),S=t.filter(f=>!f.read).length,l;return s?l=c("div",{"aria-hidden":"true",...e("notification-center","loading"),children:[i(g,{shape:"line"}),i(g,{shape:"line"}),i(g,{shape:"line"})]}):t.length===0?l=i(z,{title:m,description:p,size:"sm",...e("notification-center","empty")}):l=i("ul",{...e("notification-center","list"),children:t.map(f=>i(A,{item:f,now:y,onSelect:I,onReadChange:P,renderLeading:R,renderActions:h,markReadLabel:d,markUnreadLabel:r},f.id))}),c("section",{"aria-labelledby":v,"aria-busy":s,...k,...e("notification-center","root",k.className),children:[c("div",{...e("notification-center","header"),children:[i(L,{as:`h${a}`,id:v,...e("notification-center","title"),children:n}),b||N?c("div",{...e("notification-center","actions"),children:[b,N?i(C,{size:"sm",variant:"ghost",onClick:N,disabled:S===0,...e("notification-center","mark-all-read"),children:o}):null]}):null]}),l]})};x.displayName="NotificationCenter";export{x as NotificationCenter};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { DateInput } from '@skdx/react';
|
|
3
|
+
/** One entry of {@link NotificationCenterProps.notifications} — a single notification. */
|
|
4
|
+
export interface NotificationCenterItem {
|
|
5
|
+
/** Identifier reported back through every callback and used as the list item's key. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Headline text rendered as the notification's title. */
|
|
8
|
+
title: string;
|
|
9
|
+
/**
|
|
10
|
+
* Supporting copy rendered below the title.
|
|
11
|
+
* @default undefined — no description renders for this item.
|
|
12
|
+
*/
|
|
13
|
+
description?: string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Instant the notification occurred, rendered into a derived Time.
|
|
16
|
+
* @default undefined — no timestamp renders for this item.
|
|
17
|
+
*/
|
|
18
|
+
timestamp?: DateInput | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the notification has been read, driving `data-read` and the read-toggle label.
|
|
21
|
+
* @default undefined — treated as unread.
|
|
22
|
+
*/
|
|
23
|
+
read?: boolean | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** Props for the {@link NotificationCenter} block. */
|
|
26
|
+
export interface NotificationCenterProps extends Omit<React.ComponentPropsWithRef<'section'>, 'onSelect'> {
|
|
27
|
+
/** The notifications to list, in render order. */
|
|
28
|
+
notifications: ReadonlyArray<NotificationCenterItem>;
|
|
29
|
+
/**
|
|
30
|
+
* Heading text, rendered into a derived Heading that names the section.
|
|
31
|
+
* @default 'Notifications'
|
|
32
|
+
*/
|
|
33
|
+
title?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Outline level of the derived title heading, from `1` down to `6`.
|
|
36
|
+
* @default 2
|
|
37
|
+
*/
|
|
38
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Text of the mark-all-read button, rendered only when `onMarkAllRead` is given.
|
|
41
|
+
* @default 'Mark all as read'
|
|
42
|
+
*/
|
|
43
|
+
markAllReadLabel?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Text of a per-item toggle when its notification is unread.
|
|
46
|
+
* @default 'Mark as read'
|
|
47
|
+
*/
|
|
48
|
+
markReadLabel?: string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Text of a per-item toggle when its notification is read.
|
|
51
|
+
* @default 'Mark as unread'
|
|
52
|
+
*/
|
|
53
|
+
markUnreadLabel?: string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Heading text of the derived EmptyState shown when `notifications` is empty.
|
|
56
|
+
* @default 'No notifications'
|
|
57
|
+
*/
|
|
58
|
+
emptyTitle?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Supporting copy of the derived EmptyState shown when `notifications` is empty.
|
|
61
|
+
* @default undefined — the empty state renders with no description.
|
|
62
|
+
*/
|
|
63
|
+
emptyDescription?: string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Shows a skeleton region instead of the list while notifications are still loading.
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
loading?: boolean | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Reference instant every item's relative timestamp is measured from.
|
|
71
|
+
* @default undefined — each Time reads the instant once at render.
|
|
72
|
+
*/
|
|
73
|
+
now?: Date | number | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Renders a decorative avatar or icon beside one notification, always `aria-hidden`.
|
|
76
|
+
* @default undefined — no leading region renders.
|
|
77
|
+
*/
|
|
78
|
+
renderLeading?: ((item: NotificationCenterItem) => React.ReactNode) | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Renders extra controls beside one notification's read/unread toggle.
|
|
81
|
+
* @default undefined — no extra per-item controls render.
|
|
82
|
+
*/
|
|
83
|
+
renderActions?: ((item: NotificationCenterItem) => React.ReactNode) | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Header controls rendered beside the mark-all-read button.
|
|
86
|
+
* @default undefined — no extra header controls render.
|
|
87
|
+
*/
|
|
88
|
+
actions?: React.ReactNode | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Fires when a notification's body is activated, rendered as a button only while this is given.
|
|
91
|
+
* @default undefined — a notification body renders as a plain container.
|
|
92
|
+
*/
|
|
93
|
+
onSelect?: ((item: NotificationCenterItem) => void) | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Fires with the next read state when a per-item toggle is activated, rendered only while this is given.
|
|
96
|
+
* @default undefined — no per-item read toggle renders.
|
|
97
|
+
*/
|
|
98
|
+
onReadChange?: ((item: NotificationCenterItem, read: boolean) => void) | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Fires when the mark-all-read button is activated, rendered only while this is given.
|
|
101
|
+
* @default undefined — no mark-all-read button renders.
|
|
102
|
+
*/
|
|
103
|
+
onMarkAllRead?: (() => void) | undefined;
|
|
104
|
+
}
|