@skdx/react-blocks 0.36.0 → 0.37.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/dashboard-layout/DashboardLayout.cjs +1 -1
- package/dist/dashboard-layout/DashboardLayout.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/package.json +4 -14
- package/dist/confirm-dialog/ConfirmDialog.cjs +0 -2
- package/dist/confirm-dialog/ConfirmDialog.d.cts +0 -31
- package/dist/confirm-dialog/ConfirmDialog.d.ts +0 -31
- package/dist/confirm-dialog/ConfirmDialog.js +0 -2
- package/dist/confirm-dialog/index.d.cts +0 -2
- package/dist/confirm-dialog/index.d.ts +0 -2
- package/dist/confirm-dialog/types.d.cts +0 -114
- package/dist/confirm-dialog/types.d.ts +0 -114
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var R=Object.create;var u=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var $=(t,a)=>{for(var o in a)u(t,o,{get:a[o],enumerable:!0})},
|
|
2
|
+
"use strict";var R=Object.create;var u=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var $=(t,a)=>{for(var o in a)u(t,o,{get:a[o],enumerable:!0})},y=(t,a,o,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of L(a))!I.call(t,d)&&d!==o&&u(t,d,{get:()=>a[d],enumerable:!(r=T(a,d))||r.enumerable});return t};var p=(t,a,o)=>(o=t!=null?R(S(t)):{},y(a||!t||!t.__esModule?u(o,"default",{value:t,enumerable:!0}):o,t)),A=t=>y(u({},"__esModule",{value:!0}),t);var C={};$(C,{DashboardLayout:()=>c});module.exports=A(C);var k=p(require("react"),1),x=require("@skdx/react");function O(...t){let a="";for(let o of t)o&&(a=a?`${a} ${o}`:o);return a}function e(t,a,o){let r=a==="root",d=r?`skdx-${t}`:`skdx-${t}__${a}`,s={className:O(d,o),"data-part":a};return r&&(s["data-skdx-component"]=t),s}var g=p(require("react"),1);function m(t,a,o){let[r,d]=g.useState(a),s=t!==void 0;return[s?t:r,i=>{s||d(i),o?.(i)}]}var n=require("react/jsx-runtime");function N({items:t}){return(0,n.jsx)("ul",{...e("dashboard-layout","nav-list"),children:t.map((a,o)=>{let r=a.kind??"item";return r==="divider"?(0,n.jsx)("li",{children:(0,n.jsx)("hr",{...e("dashboard-layout","nav-divider")})},o):r==="header"?(0,n.jsx)("li",{...e("dashboard-layout","nav-header"),children:a.label},o):(0,n.jsxs)("li",{children:[a.href===void 0?(0,n.jsx)("span",{...e("dashboard-layout","nav-item"),children:a.label}):(0,n.jsx)("a",{href:a.href,"aria-current":a.current?"page":void 0,...e("dashboard-layout","nav-item"),children:a.label}),a.href===void 0&&a.children&&a.children.length>0?(0,n.jsx)(N,{items:a.children}):null]},o)})})}var c=({title:t,navigation:a,navOpen:o,defaultNavOpen:r=!0,navLabel:d="Main navigation",navToggleLabel:s="Toggle navigation",onNavOpenChange:b,branding:h,actions:i,children:D,...v})=>{let f=k.useId(),[l,P]=m(o,r,b);return(0,n.jsxs)("div",{"data-nav-open":l?"":void 0,...v,...e("dashboard-layout","root",v.className),children:[(0,n.jsxs)("header",{...e("dashboard-layout","app-bar"),children:[(0,n.jsx)(x.Button,{iconOnly:!0,"aria-expanded":l,"aria-controls":f,"aria-label":s,onClick:()=>{P(!l)},...e("dashboard-layout","nav-toggle"),children:"\u2630"}),(0,n.jsx)("div",{...e("dashboard-layout","branding"),children:h}),t?(0,n.jsx)("span",{...e("dashboard-layout","title"),children:t}):null,(0,n.jsx)("div",{...e("dashboard-layout","actions"),children:i})]}),(0,n.jsxs)("div",{...e("dashboard-layout","body"),children:[(0,n.jsx)("nav",{id:f,"aria-label":d,hidden:!l,...e("dashboard-layout","nav"),children:(0,n.jsx)(N,{items:a})}),(0,n.jsx)("main",{...e("dashboard-layout","content"),children:D})]})]})};c.displayName="DashboardLayout";0&&(module.exports={DashboardLayout});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import*as p from"react";import{Button as D}from"@skdx/react";function N(...n){let a="";for(let e of n)e&&(a=a?`${a} ${e}`:e);return a}function t(n,a,e){let r=a==="root",s=r?`skdx-${n}`:`skdx-${n}__${a}`,d={className:N(s,e),"data-part":a};return r&&(d["data-skdx-component"]=n),d}import*as
|
|
2
|
+
import*as p from"react";import{Button as D}from"@skdx/react";function N(...n){let a="";for(let e of n)e&&(a=a?`${a} ${e}`:e);return a}function t(n,a,e){let r=a==="root",s=r?`skdx-${n}`:`skdx-${n}__${a}`,d={className:N(s,e),"data-part":a};return r&&(d["data-skdx-component"]=n),d}import*as f from"react";function y(n,a,e){let[r,s]=f.useState(a),d=n!==void 0;return[d?n:r,i=>{d||s(i),e?.(i)}]}import{jsx as o,jsxs as u}from"react/jsx-runtime";function g({items:n}){return o("ul",{...t("dashboard-layout","nav-list"),children:n.map((a,e)=>{let r=a.kind??"item";return r==="divider"?o("li",{children:o("hr",{...t("dashboard-layout","nav-divider")})},e):r==="header"?o("li",{...t("dashboard-layout","nav-header"),children:a.label},e):u("li",{children:[a.href===void 0?o("span",{...t("dashboard-layout","nav-item"),children:a.label}):o("a",{href:a.href,"aria-current":a.current?"page":void 0,...t("dashboard-layout","nav-item"),children:a.label}),a.href===void 0&&a.children&&a.children.length>0?o(g,{items:a.children}):null]},e)})})}var m=({title:n,navigation:a,navOpen:e,defaultNavOpen:r=!0,navLabel:s="Main navigation",navToggleLabel:d="Toggle navigation",onNavOpenChange:c,branding:b,actions:i,children:k,...h})=>{let v=p.useId(),[l,x]=y(e,r,c);return u("div",{"data-nav-open":l?"":void 0,...h,...t("dashboard-layout","root",h.className),children:[u("header",{...t("dashboard-layout","app-bar"),children:[o(D,{iconOnly:!0,"aria-expanded":l,"aria-controls":v,"aria-label":d,onClick:()=>{x(!l)},...t("dashboard-layout","nav-toggle"),children:"\u2630"}),o("div",{...t("dashboard-layout","branding"),children:b}),n?o("span",{...t("dashboard-layout","title"),children:n}):null,o("div",{...t("dashboard-layout","actions"),children:i})]}),u("div",{...t("dashboard-layout","body"),children:[o("nav",{id:v,"aria-label":s,hidden:!l,...t("dashboard-layout","nav"),children:o(g,{items:a})}),o("main",{...t("dashboard-layout","content"),children:k})]})]})};m.displayName="DashboardLayout";export{m as DashboardLayout};
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var a=Object.defineProperty;var
|
|
2
|
+
"use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:!0})},N=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of v(e))!U.call(t,o)&&o!==r&&a(t,o,{get:()=>e[o],enumerable:!(i=u(e,o))||i.enumerable});return t};var B=t=>N(a({},"__esModule",{value:!0}),t);var M={};L(M,{ChatComposer:()=>P.ChatComposer,ChatMessage:()=>g.ChatMessage,Comment:()=>C.Comment,CommentThread:()=>f.CommentThread,ConversationList:()=>d.ConversationList,DashboardLayout:()=>s.DashboardLayout,EmptyState:()=>m.EmptyState,FilterBar:()=>x.FilterBar,ForgotPasswordPage:()=>w.ForgotPasswordPage,FormSection:()=>c.FormSection,NotificationCenter:()=>h.NotificationCenter,OnboardingChecklist:()=>S.OnboardingChecklist,PageContainer:()=>n.PageContainer,ResetPasswordPage:()=>F.ResetPasswordPage,SignInPage:()=>p.SignInPage,SignUpPage:()=>I.SignUpPage,StatCard:()=>y.StatCard,UsageCard:()=>l.UsageCard,UserMenu:()=>b.UserMenu,VerificationPage:()=>k.VerificationPage,WorkspaceSwitcher:()=>D.WorkspaceSwitcher,defaultProviderLabel:()=>p.defaultProviderLabel});module.exports=B(M);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("./conversation-list/ConversationList.cjs"),x=require("./filter-bar/FilterBar.cjs"),c=require("./form-section/FormSection.cjs"),h=require("./notification-center/NotificationCenter.cjs"),S=require("./onboarding-checklist/OnboardingChecklist.cjs"),l=require("./usage-card/UsageCard.cjs"),b=require("./user-menu/UserMenu.cjs"),D=require("./workspace-switcher/WorkspaceSwitcher.cjs"),I=require("./sign-up-page/SignUpPage.cjs"),w=require("./forgot-password-page/ForgotPasswordPage.cjs"),F=require("./reset-password-page/ResetPasswordPage.cjs"),k=require("./verification-page/VerificationPage.cjs");0&&(module.exports={ChatComposer,ChatMessage,Comment,CommentThread,ConversationList,DashboardLayout,EmptyState,FilterBar,ForgotPasswordPage,FormSection,NotificationCenter,OnboardingChecklist,PageContainer,ResetPasswordPage,SignInPage,SignUpPage,StatCard,UsageCard,UserMenu,VerificationPage,WorkspaceSwitcher,defaultProviderLabel});
|
package/dist/index.d.cts
CHANGED
|
@@ -7,7 +7,6 @@ export { ChatComposer, type ChatComposerProps, type ChatComposerSendDetail, type
|
|
|
7
7
|
export { ChatMessage, type ChatMessageProps } from './chat-message/index.cjs';
|
|
8
8
|
export { Comment, type CommentProps } from './comment/index.cjs';
|
|
9
9
|
export { CommentThread, type CommentThreadProps } from './comment-thread/index.cjs';
|
|
10
|
-
export { ConfirmDialog, type ConfirmDialogProps } from './confirm-dialog/index.cjs';
|
|
11
10
|
export { ConversationList, type ConversationListItem, type ConversationListProps, } from './conversation-list/index.cjs';
|
|
12
11
|
export { FilterBar, type FilterBarFilter, type FilterBarProps } from './filter-bar/index.cjs';
|
|
13
12
|
export { FormSection, type FormSectionProps } from './form-section/index.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export { ChatComposer, type ChatComposerProps, type ChatComposerSendDetail, type
|
|
|
7
7
|
export { ChatMessage, type ChatMessageProps } from './chat-message/index.js';
|
|
8
8
|
export { Comment, type CommentProps } from './comment/index.js';
|
|
9
9
|
export { CommentThread, type CommentThreadProps } from './comment-thread/index.js';
|
|
10
|
-
export { ConfirmDialog, type ConfirmDialogProps } from './confirm-dialog/index.js';
|
|
11
10
|
export { ConversationList, type ConversationListItem, type ConversationListProps, } from './conversation-list/index.js';
|
|
12
11
|
export { FilterBar, type FilterBarFilter, type FilterBarProps } from './filter-bar/index.js';
|
|
13
12
|
export { FormSection, type FormSectionProps } from './form-section/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 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{
|
|
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{ConversationList as b}from"./conversation-list/ConversationList.js";import{FilterBar as I}from"./filter-bar/FilterBar.js";import{FormSection as F}from"./form-section/FormSection.js";import{NotificationCenter as u}from"./notification-center/NotificationCenter.js";import{OnboardingChecklist as U}from"./onboarding-checklist/OnboardingChecklist.js";import{UsageCard as N}from"./usage-card/UsageCard.js";import{UserMenu as M}from"./user-menu/UserMenu.js";import{WorkspaceSwitcher as R}from"./workspace-switcher/WorkspaceSwitcher.js";import{SignUpPage as W}from"./sign-up-page/SignUpPage.js";import{ForgotPasswordPage as K}from"./forgot-password-page/ForgotPasswordPage.js";import{ResetPasswordPage as j}from"./reset-password-page/ResetPasswordPage.js";import{VerificationPage as z}from"./verification-page/VerificationPage.js";export{C as ChatComposer,d as ChatMessage,c as Comment,S as CommentThread,b as ConversationList,o as DashboardLayout,m as EmptyState,I as FilterBar,K as ForgotPasswordPage,F as FormSection,u as NotificationCenter,U as OnboardingChecklist,p as PageContainer,j as ResetPasswordPage,i as SignInPage,W as SignUpPage,P as StatCard,N as UsageCard,M as UserMenu,z as VerificationPage,R as WorkspaceSwitcher,s as defaultProviderLabel};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skdx/react-blocks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "React blocks for the SkandaDX design system — page-level compositions of @skdx/react styled by @skdx/skins",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -73,16 +73,6 @@
|
|
|
73
73
|
"default": "./dist/comment-thread/CommentThread.cjs"
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
|
-
"./confirm-dialog": {
|
|
77
|
-
"import": {
|
|
78
|
-
"types": "./dist/confirm-dialog/index.d.ts",
|
|
79
|
-
"default": "./dist/confirm-dialog/ConfirmDialog.js"
|
|
80
|
-
},
|
|
81
|
-
"require": {
|
|
82
|
-
"types": "./dist/confirm-dialog/index.d.cts",
|
|
83
|
-
"default": "./dist/confirm-dialog/ConfirmDialog.cjs"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
76
|
"./conversation-list": {
|
|
87
77
|
"import": {
|
|
88
78
|
"types": "./dist/conversation-list/index.d.ts",
|
|
@@ -265,7 +255,7 @@
|
|
|
265
255
|
"peerDependencies": {
|
|
266
256
|
"react": "^19.0.0",
|
|
267
257
|
"react-dom": "^19.0.0",
|
|
268
|
-
"@skdx/react": "^0.
|
|
258
|
+
"@skdx/react": "^0.37.0"
|
|
269
259
|
},
|
|
270
260
|
"devDependencies": {
|
|
271
261
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -283,8 +273,8 @@
|
|
|
283
273
|
"tsup": "^8.5.1",
|
|
284
274
|
"typescript": "^6.0.3",
|
|
285
275
|
"vitest": "^4.1.10",
|
|
286
|
-
"@skdx/react": "0.
|
|
287
|
-
"@skdx/shared": "0.
|
|
276
|
+
"@skdx/react": "0.37.0",
|
|
277
|
+
"@skdx/shared": "0.37.0"
|
|
288
278
|
},
|
|
289
279
|
"scripts": {
|
|
290
280
|
"lint": "eslint . --cache --cache-location node_modules/.cache/eslint/",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";var g=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var F=(t,o)=>{for(var n in o)g(t,n,{get:o[n],enumerable:!0})},S=(t,o,n,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of T(o))!B.call(t,r)&&r!==n&&g(t,r,{get:()=>o[r],enumerable:!(l=$(o,r))||l.enumerable});return t};var w=t=>S(g({},"__esModule",{value:!0}),t);var z={};F(z,{ConfirmDialog:()=>f});module.exports=w(z);var c=require("@skdx/react"),i=require("@skdx/react/primitives/dialog");function _(...t){let o="";for(let n of t)n&&(o=o?`${o} ${n}`:n);return o}function e(t,o,n){let l=o==="root",r=l?`skdx-${t}`:`skdx-${t}__${o}`,s={className:_(r,n),"data-part":o};return l&&(s["data-skdx-component"]=t),s}var a=require("react/jsx-runtime"),f=({open:t,defaultOpen:o=!1,onOpenChange:n,onOpenChangeComplete:l,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:x,onInteractOutside:k,onOpenAutoFocus:y,onCloseAutoFocus:P,trigger:m,title:b,description:u,confirmLabel:A="Confirm",cancelLabel:O="Cancel",destructive:D=!1,pending:d=!1,disabled:v=!1,size:R,onConfirm:h,onCancel:N,children:p,...C})=>(0,a.jsxs)(i.DialogRoot,{open:t,defaultOpen:o,onOpenChange:n,onOpenChangeComplete:l,role:"alertdialog",modal:!0,dismiss:d?"none":"escape",status:D?"danger":void 0,children:[m?(0,a.jsx)(i.DialogTrigger,{asChild:!0,children:m}):null,(0,a.jsxs)(i.DialogPortal,{children:[(0,a.jsx)(i.DialogOverlay,{}),(0,a.jsxs)(i.DialogContent,{onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:x,onInteractOutside:k,onOpenAutoFocus:y,onCloseAutoFocus:P,...C,size:R,...e("confirm-dialog","root",C.className),children:[(0,a.jsx)(i.DialogTitle,{...e("confirm-dialog","title"),children:b}),u?(0,a.jsx)(i.DialogDescription,{...e("confirm-dialog","description"),children:u}):null,p?(0,a.jsx)("div",{...e("confirm-dialog","body"),children:p}):null,(0,a.jsxs)("div",{...e("confirm-dialog","footer"),children:[(0,a.jsx)(i.DialogCancel,{asChild:!0,children:(0,a.jsx)(c.Button,{variant:"ghost",disabled:d,onClick:N,...e("confirm-dialog","cancel"),children:O})}),(0,a.jsx)(i.DialogAction,{asChild:!0,children:(0,a.jsx)(c.Button,{variant:D?"danger":"primary",loading:d,disabled:d||v,onClick:h,...e("confirm-dialog","confirm"),children:A})})]})]})]})]});f.displayName="ConfirmDialog";0&&(module.exports={ConfirmDialog});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type * as React from 'react';
|
|
2
|
-
import type { ConfirmDialogProps } from './types.cjs';
|
|
3
|
-
/**
|
|
4
|
-
* Confirmation dialog block for a destructive, irreversible or sensitive
|
|
5
|
-
* action, composing the core alert dialog primitives with a `Button` footer
|
|
6
|
-
* and an externally controlled pending state that disables both buttons and
|
|
7
|
-
* blocks dismissal while the confirmed request is in flight.
|
|
8
|
-
*
|
|
9
|
-
* A synchronous confirmation with no pending state is served by the core
|
|
10
|
-
* `<Dialog role="alertdialog">` recipe alone.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* <ConfirmDialog
|
|
15
|
-
* trigger={<Button variant="danger">Delete project</Button>}
|
|
16
|
-
* title="Delete this project?"
|
|
17
|
-
* description="This cannot be undone."
|
|
18
|
-
* destructive
|
|
19
|
-
* pending={isDeleting}
|
|
20
|
-
* onConfirm={(event) => {
|
|
21
|
-
* event.preventDefault();
|
|
22
|
-
* setDeleting(true);
|
|
23
|
-
* void deleteProject().finally(() => setDeleting(false));
|
|
24
|
-
* }}
|
|
25
|
-
* />
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare const ConfirmDialog: {
|
|
29
|
-
({ open, defaultOpen, onOpenChange, onOpenChangeComplete, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onOpenAutoFocus, onCloseAutoFocus, trigger, title, description, confirmLabel, cancelLabel, destructive, pending, disabled, size, onConfirm, onCancel, children, ...props }: ConfirmDialogProps): React.ReactNode;
|
|
30
|
-
displayName: string;
|
|
31
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type * as React from 'react';
|
|
2
|
-
import type { ConfirmDialogProps } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Confirmation dialog block for a destructive, irreversible or sensitive
|
|
5
|
-
* action, composing the core alert dialog primitives with a `Button` footer
|
|
6
|
-
* and an externally controlled pending state that disables both buttons and
|
|
7
|
-
* blocks dismissal while the confirmed request is in flight.
|
|
8
|
-
*
|
|
9
|
-
* A synchronous confirmation with no pending state is served by the core
|
|
10
|
-
* `<Dialog role="alertdialog">` recipe alone.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* <ConfirmDialog
|
|
15
|
-
* trigger={<Button variant="danger">Delete project</Button>}
|
|
16
|
-
* title="Delete this project?"
|
|
17
|
-
* description="This cannot be undone."
|
|
18
|
-
* destructive
|
|
19
|
-
* pending={isDeleting}
|
|
20
|
-
* onConfirm={(event) => {
|
|
21
|
-
* event.preventDefault();
|
|
22
|
-
* setDeleting(true);
|
|
23
|
-
* void deleteProject().finally(() => setDeleting(false));
|
|
24
|
-
* }}
|
|
25
|
-
* />
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare const ConfirmDialog: {
|
|
29
|
-
({ open, defaultOpen, onOpenChange, onOpenChangeComplete, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onOpenAutoFocus, onCloseAutoFocus, trigger, title, description, confirmLabel, cancelLabel, destructive, pending, disabled, size, onConfirm, onCancel, children, ...props }: ConfirmDialogProps): React.ReactNode;
|
|
30
|
-
displayName: string;
|
|
31
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import{Button as D}from"@skdx/react";import{DialogAction as $,DialogCancel as T,DialogContent as B,DialogDescription as F,DialogOverlay as S,DialogPortal as w,DialogRoot as _,DialogTitle as z,DialogTrigger as E}from"@skdx/react/primitives/dialog";function N(...a){let o="";for(let n of a)n&&(o=o?`${o} ${n}`:n);return o}function t(a,o,n){let r=o==="root",d=r?`skdx-${a}`:`skdx-${a}__${o}`,e={className:N(d,n),"data-part":o};return r&&(e["data-skdx-component"]=a),e}import{jsx as i,jsxs as s}from"react/jsx-runtime";var p=({open:a,defaultOpen:o=!1,onOpenChange:n,onOpenChangeComplete:r,onEscapeKeyDown:d,onPointerDownOutside:e,onFocusOutside:C,onInteractOutside:x,onOpenAutoFocus:k,onCloseAutoFocus:y,trigger:g,title:P,description:c,confirmLabel:b="Confirm",cancelLabel:A="Cancel",destructive:f=!1,pending:l=!1,disabled:O=!1,size:v,onConfirm:R,onCancel:h,children:m,...u})=>s(_,{open:a,defaultOpen:o,onOpenChange:n,onOpenChangeComplete:r,role:"alertdialog",modal:!0,dismiss:l?"none":"escape",status:f?"danger":void 0,children:[g?i(E,{asChild:!0,children:g}):null,s(w,{children:[i(S,{}),s(B,{onEscapeKeyDown:d,onPointerDownOutside:e,onFocusOutside:C,onInteractOutside:x,onOpenAutoFocus:k,onCloseAutoFocus:y,...u,size:v,...t("confirm-dialog","root",u.className),children:[i(z,{...t("confirm-dialog","title"),children:P}),c?i(F,{...t("confirm-dialog","description"),children:c}):null,m?i("div",{...t("confirm-dialog","body"),children:m}):null,s("div",{...t("confirm-dialog","footer"),children:[i(T,{asChild:!0,children:i(D,{variant:"ghost",disabled:l,onClick:h,...t("confirm-dialog","cancel"),children:A})}),i($,{asChild:!0,children:i(D,{variant:f?"danger":"primary",loading:l,disabled:l||O,onClick:R,...t("confirm-dialog","confirm"),children:b})})]})]})]})]});p.displayName="ConfirmDialog";export{p as ConfirmDialog};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type * as React from 'react';
|
|
2
|
-
import type { DialogContent } from '@skdx/react/primitives/dialog';
|
|
3
|
-
type ContentProps = React.ComponentProps<typeof DialogContent>;
|
|
4
|
-
/** Props for the {@link ConfirmDialog} block. */
|
|
5
|
-
export interface ConfirmDialogProps extends Omit<React.ComponentPropsWithRef<'dialog'>, 'title' | 'open' | 'onCancel'> {
|
|
6
|
-
/**
|
|
7
|
-
* Whether the dialog is open, for controlled usage. Pair with `onOpenChange`.
|
|
8
|
-
* @default undefined — uncontrolled, tracks its own open state internally.
|
|
9
|
-
*/
|
|
10
|
-
open?: boolean | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Whether the dialog starts open, for uncontrolled usage.
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
|
-
defaultOpen?: boolean | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Fires with the new open state whenever the dialog opens or closes, controlled or not.
|
|
18
|
-
* @default undefined — no-op if omitted.
|
|
19
|
-
*/
|
|
20
|
-
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Fires with the new open state once the enter or exit animation has settled.
|
|
23
|
-
* @default undefined — no-op if omitted.
|
|
24
|
-
*/
|
|
25
|
-
onOpenChangeComplete?: ((open: boolean) => void) | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Fires when Escape is pressed while open; `preventDefault()` keeps it open.
|
|
28
|
-
* @default undefined — no-op if omitted.
|
|
29
|
-
*/
|
|
30
|
-
onEscapeKeyDown?: ContentProps['onEscapeKeyDown'];
|
|
31
|
-
/**
|
|
32
|
-
* Fires on a pointer-down outside the content while open; `preventDefault()` keeps it open.
|
|
33
|
-
* @default undefined — no-op if omitted.
|
|
34
|
-
*/
|
|
35
|
-
onPointerDownOutside?: ContentProps['onPointerDownOutside'];
|
|
36
|
-
/**
|
|
37
|
-
* Fires when focus moves outside the content while open; `preventDefault()` keeps it open.
|
|
38
|
-
* @default undefined — no-op if omitted.
|
|
39
|
-
*/
|
|
40
|
-
onFocusOutside?: ContentProps['onFocusOutside'];
|
|
41
|
-
/**
|
|
42
|
-
* Fires for either kind of outside interaction, just before the specific event.
|
|
43
|
-
* @default undefined — no-op if omitted.
|
|
44
|
-
*/
|
|
45
|
-
onInteractOutside?: ContentProps['onInteractOutside'];
|
|
46
|
-
/**
|
|
47
|
-
* Fires before focus moves into the content on open; `preventDefault()` leaves focus where it is.
|
|
48
|
-
* @default undefined — no-op if omitted.
|
|
49
|
-
*/
|
|
50
|
-
onOpenAutoFocus?: ContentProps['onOpenAutoFocus'];
|
|
51
|
-
/**
|
|
52
|
-
* Fires before focus returns to the trigger on close; `preventDefault()` suppresses that return.
|
|
53
|
-
* @default undefined — no-op if omitted.
|
|
54
|
-
*/
|
|
55
|
-
onCloseAutoFocus?: ContentProps['onCloseAutoFocus'];
|
|
56
|
-
/**
|
|
57
|
-
* Element that opens the dialog, decorated with the trigger's open behavior via `asChild`.
|
|
58
|
-
* @default undefined — no trigger renders; open the dialog through `open`/`onOpenChange` instead.
|
|
59
|
-
*/
|
|
60
|
-
trigger?: React.ReactElement | undefined;
|
|
61
|
-
/** Heading text rendered into the panel's title, naming and labelling the dialog. */
|
|
62
|
-
title: string;
|
|
63
|
-
/**
|
|
64
|
-
* Supporting sentence rendered into the panel's description, read alongside the title.
|
|
65
|
-
* @default undefined — no description region renders.
|
|
66
|
-
*/
|
|
67
|
-
description?: string | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Text of the button that carries out the confirmed action.
|
|
70
|
-
* @default 'Confirm'
|
|
71
|
-
*/
|
|
72
|
-
confirmLabel?: string | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Text of the button that abandons the action.
|
|
75
|
-
* @default 'Cancel'
|
|
76
|
-
*/
|
|
77
|
-
cancelLabel?: string | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Renders the confirm button in the skin's danger weight and marks the panel `data-status="danger"`, for an irreversible or destructive action.
|
|
80
|
-
* @default false
|
|
81
|
-
*/
|
|
82
|
-
destructive?: boolean | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* Marks the confirmed request as in flight: disables both buttons, renders the confirm button's loading state, and blocks Escape dismissal until it clears.
|
|
85
|
-
* @default false
|
|
86
|
-
*/
|
|
87
|
-
pending?: boolean | undefined;
|
|
88
|
-
/**
|
|
89
|
-
* Disables the confirm button on its own, independent of `pending` — for example until a typed confirmation matches.
|
|
90
|
-
* @default false
|
|
91
|
-
*/
|
|
92
|
-
disabled?: boolean | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* Panel width rung the skin reads, fed to the underlying dialog panel.
|
|
95
|
-
* @default undefined — the skin's own default width.
|
|
96
|
-
*/
|
|
97
|
-
size?: 'sm' | 'md' | 'lg' | (string & {}) | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* Fires when the confirm button is activated, before the dialog closes. Call `event.preventDefault()` to hold the panel open while an async request runs, typically alongside `pending`.
|
|
100
|
-
* @default undefined — no-op if omitted.
|
|
101
|
-
*/
|
|
102
|
-
onConfirm?: ((event: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
103
|
-
/**
|
|
104
|
-
* Fires when the cancel button is activated, before the dialog closes. Call `event.preventDefault()` to keep the panel open.
|
|
105
|
-
* @default undefined — no-op if omitted.
|
|
106
|
-
*/
|
|
107
|
-
onCancel?: ((event: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
108
|
-
/**
|
|
109
|
-
* Extra content rendered between the description and the footer buttons.
|
|
110
|
-
* @default undefined — no body region renders.
|
|
111
|
-
*/
|
|
112
|
-
children?: React.ReactNode | undefined;
|
|
113
|
-
}
|
|
114
|
-
export {};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type * as React from 'react';
|
|
2
|
-
import type { DialogContent } from '@skdx/react/primitives/dialog';
|
|
3
|
-
type ContentProps = React.ComponentProps<typeof DialogContent>;
|
|
4
|
-
/** Props for the {@link ConfirmDialog} block. */
|
|
5
|
-
export interface ConfirmDialogProps extends Omit<React.ComponentPropsWithRef<'dialog'>, 'title' | 'open' | 'onCancel'> {
|
|
6
|
-
/**
|
|
7
|
-
* Whether the dialog is open, for controlled usage. Pair with `onOpenChange`.
|
|
8
|
-
* @default undefined — uncontrolled, tracks its own open state internally.
|
|
9
|
-
*/
|
|
10
|
-
open?: boolean | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Whether the dialog starts open, for uncontrolled usage.
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
|
-
defaultOpen?: boolean | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Fires with the new open state whenever the dialog opens or closes, controlled or not.
|
|
18
|
-
* @default undefined — no-op if omitted.
|
|
19
|
-
*/
|
|
20
|
-
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Fires with the new open state once the enter or exit animation has settled.
|
|
23
|
-
* @default undefined — no-op if omitted.
|
|
24
|
-
*/
|
|
25
|
-
onOpenChangeComplete?: ((open: boolean) => void) | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Fires when Escape is pressed while open; `preventDefault()` keeps it open.
|
|
28
|
-
* @default undefined — no-op if omitted.
|
|
29
|
-
*/
|
|
30
|
-
onEscapeKeyDown?: ContentProps['onEscapeKeyDown'];
|
|
31
|
-
/**
|
|
32
|
-
* Fires on a pointer-down outside the content while open; `preventDefault()` keeps it open.
|
|
33
|
-
* @default undefined — no-op if omitted.
|
|
34
|
-
*/
|
|
35
|
-
onPointerDownOutside?: ContentProps['onPointerDownOutside'];
|
|
36
|
-
/**
|
|
37
|
-
* Fires when focus moves outside the content while open; `preventDefault()` keeps it open.
|
|
38
|
-
* @default undefined — no-op if omitted.
|
|
39
|
-
*/
|
|
40
|
-
onFocusOutside?: ContentProps['onFocusOutside'];
|
|
41
|
-
/**
|
|
42
|
-
* Fires for either kind of outside interaction, just before the specific event.
|
|
43
|
-
* @default undefined — no-op if omitted.
|
|
44
|
-
*/
|
|
45
|
-
onInteractOutside?: ContentProps['onInteractOutside'];
|
|
46
|
-
/**
|
|
47
|
-
* Fires before focus moves into the content on open; `preventDefault()` leaves focus where it is.
|
|
48
|
-
* @default undefined — no-op if omitted.
|
|
49
|
-
*/
|
|
50
|
-
onOpenAutoFocus?: ContentProps['onOpenAutoFocus'];
|
|
51
|
-
/**
|
|
52
|
-
* Fires before focus returns to the trigger on close; `preventDefault()` suppresses that return.
|
|
53
|
-
* @default undefined — no-op if omitted.
|
|
54
|
-
*/
|
|
55
|
-
onCloseAutoFocus?: ContentProps['onCloseAutoFocus'];
|
|
56
|
-
/**
|
|
57
|
-
* Element that opens the dialog, decorated with the trigger's open behavior via `asChild`.
|
|
58
|
-
* @default undefined — no trigger renders; open the dialog through `open`/`onOpenChange` instead.
|
|
59
|
-
*/
|
|
60
|
-
trigger?: React.ReactElement | undefined;
|
|
61
|
-
/** Heading text rendered into the panel's title, naming and labelling the dialog. */
|
|
62
|
-
title: string;
|
|
63
|
-
/**
|
|
64
|
-
* Supporting sentence rendered into the panel's description, read alongside the title.
|
|
65
|
-
* @default undefined — no description region renders.
|
|
66
|
-
*/
|
|
67
|
-
description?: string | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Text of the button that carries out the confirmed action.
|
|
70
|
-
* @default 'Confirm'
|
|
71
|
-
*/
|
|
72
|
-
confirmLabel?: string | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Text of the button that abandons the action.
|
|
75
|
-
* @default 'Cancel'
|
|
76
|
-
*/
|
|
77
|
-
cancelLabel?: string | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Renders the confirm button in the skin's danger weight and marks the panel `data-status="danger"`, for an irreversible or destructive action.
|
|
80
|
-
* @default false
|
|
81
|
-
*/
|
|
82
|
-
destructive?: boolean | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* Marks the confirmed request as in flight: disables both buttons, renders the confirm button's loading state, and blocks Escape dismissal until it clears.
|
|
85
|
-
* @default false
|
|
86
|
-
*/
|
|
87
|
-
pending?: boolean | undefined;
|
|
88
|
-
/**
|
|
89
|
-
* Disables the confirm button on its own, independent of `pending` — for example until a typed confirmation matches.
|
|
90
|
-
* @default false
|
|
91
|
-
*/
|
|
92
|
-
disabled?: boolean | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* Panel width rung the skin reads, fed to the underlying dialog panel.
|
|
95
|
-
* @default undefined — the skin's own default width.
|
|
96
|
-
*/
|
|
97
|
-
size?: 'sm' | 'md' | 'lg' | (string & {}) | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* Fires when the confirm button is activated, before the dialog closes. Call `event.preventDefault()` to hold the panel open while an async request runs, typically alongside `pending`.
|
|
100
|
-
* @default undefined — no-op if omitted.
|
|
101
|
-
*/
|
|
102
|
-
onConfirm?: ((event: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
103
|
-
/**
|
|
104
|
-
* Fires when the cancel button is activated, before the dialog closes. Call `event.preventDefault()` to keep the panel open.
|
|
105
|
-
* @default undefined — no-op if omitted.
|
|
106
|
-
*/
|
|
107
|
-
onCancel?: ((event: React.MouseEvent<HTMLButtonElement>) => void) | undefined;
|
|
108
|
-
/**
|
|
109
|
-
* Extra content rendered between the description and the footer buttons.
|
|
110
|
-
* @default undefined — no body region renders.
|
|
111
|
-
*/
|
|
112
|
-
children?: React.ReactNode | undefined;
|
|
113
|
-
}
|
|
114
|
-
export {};
|