@admin-layout/tailwind-ui 12.2.4-alpha.32 → 12.2.4-alpha.33
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/lib/components/Dialog/Dialog.d.ts +20 -0
- package/lib/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.js +98 -0
- package/lib/components/Dialog/Dialog.js.map +1 -0
- package/lib/components/Dialog/index.d.ts +3 -0
- package/lib/components/Dialog/index.d.ts.map +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export interface DialogProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
title?: string;
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onSave?: () => void;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
saveLabel?: string;
|
|
11
|
+
cancelLabel?: string;
|
|
12
|
+
saveDisabled?: boolean;
|
|
13
|
+
hideFooter?: boolean;
|
|
14
|
+
width?: CSSProperties['width'];
|
|
15
|
+
height?: CSSProperties['height'];
|
|
16
|
+
className?: string;
|
|
17
|
+
bodyClassName?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function Dialog({ isOpen, title, subtitle, onClose, onSave, loading, children, saveLabel, cancelLabel, saveDisabled, hideFooter, width, height, className, bodyClassName, }: DialogProps): React.JSX.Element;
|
|
20
|
+
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAA4B,MAAM,OAAO,CAAC;AAGlF,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAoBD,wBAAgB,MAAM,CAAC,EACnB,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAkB,EAClB,WAAsB,EACtB,YAAY,EACZ,UAAU,EACV,KAAK,EACL,MAAM,EACN,SAAS,EACT,aAAa,GAChB,EAAE,WAAW,qBAuGb"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {X}from'lucide-react';import React__default,{useRef,useId,useEffect}from'react';import {cn}from'../../utils/util.js';const DEFAULT_DIALOG_WIDTH = '32rem';
|
|
2
|
+
const DEFAULT_DIALOG_HEIGHT = 'auto';
|
|
3
|
+
const DEFAULT_DIALOG_MIN_WIDTH = 'min(20rem, 90vw)';
|
|
4
|
+
const DEFAULT_DIALOG_MIN_HEIGHT = 'min(12rem, 90vh)';
|
|
5
|
+
const DEFAULT_DIALOG_MAX_WIDTH = '90vw';
|
|
6
|
+
const DEFAULT_DIALOG_MAX_HEIGHT = '90vh';
|
|
7
|
+
function getDialogStyle(width, height) {
|
|
8
|
+
return {
|
|
9
|
+
width: width ?? DEFAULT_DIALOG_WIDTH,
|
|
10
|
+
height: height ?? DEFAULT_DIALOG_HEIGHT,
|
|
11
|
+
minWidth: DEFAULT_DIALOG_MIN_WIDTH,
|
|
12
|
+
minHeight: DEFAULT_DIALOG_MIN_HEIGHT,
|
|
13
|
+
maxWidth: DEFAULT_DIALOG_MAX_WIDTH,
|
|
14
|
+
maxHeight: DEFAULT_DIALOG_MAX_HEIGHT
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function Dialog({
|
|
18
|
+
isOpen,
|
|
19
|
+
title,
|
|
20
|
+
subtitle,
|
|
21
|
+
onClose,
|
|
22
|
+
onSave,
|
|
23
|
+
loading,
|
|
24
|
+
children,
|
|
25
|
+
saveLabel = 'Save',
|
|
26
|
+
cancelLabel = 'Cancel',
|
|
27
|
+
saveDisabled,
|
|
28
|
+
hideFooter,
|
|
29
|
+
width,
|
|
30
|
+
height,
|
|
31
|
+
className,
|
|
32
|
+
bodyClassName
|
|
33
|
+
}) {
|
|
34
|
+
const dialogRef = useRef(null);
|
|
35
|
+
const titleId = useId();
|
|
36
|
+
const trimmedTitle = title?.trim();
|
|
37
|
+
const trimmedSubtitle = subtitle?.trim();
|
|
38
|
+
const hasHeader = Boolean(trimmedTitle);
|
|
39
|
+
const dialogStyle = getDialogStyle(width, height);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const dialog = dialogRef.current;
|
|
42
|
+
if (!dialog) return;
|
|
43
|
+
if (isOpen && !dialog.open) {
|
|
44
|
+
dialog.showModal();
|
|
45
|
+
} else if (!isOpen && dialog.open) {
|
|
46
|
+
dialog.close();
|
|
47
|
+
}
|
|
48
|
+
}, [isOpen]);
|
|
49
|
+
return React__default.createElement("dialog", {
|
|
50
|
+
ref: dialogRef,
|
|
51
|
+
onClose: onClose,
|
|
52
|
+
onClick: event => {
|
|
53
|
+
if (event.target === dialogRef.current) {
|
|
54
|
+
dialogRef.current?.close();
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"aria-labelledby": trimmedTitle ? titleId : undefined,
|
|
58
|
+
"aria-label": !trimmedTitle ? trimmedSubtitle || 'Dialog' : undefined,
|
|
59
|
+
className: "m-0 h-screen max-h-none w-screen max-w-none border-0 bg-transparent p-4 backdrop:bg-black/50 backdrop:backdrop-blur-sm open:fixed open:inset-0 open:flex open:items-center open:justify-center sm:p-6"
|
|
60
|
+
}, React__default.createElement("div", {
|
|
61
|
+
style: dialogStyle,
|
|
62
|
+
className: cn('themed-modal relative flex w-full flex-col overflow-hidden rounded-themed-lg border border-border bg-card text-card-foreground shadow-themed-xl animate-in fade-in zoom-in-95 duration-200', className)
|
|
63
|
+
}, hasHeader && React__default.createElement("div", {
|
|
64
|
+
className: "flex items-start justify-between gap-4 bg-card px-6 py-4 text-card-foreground"
|
|
65
|
+
}, React__default.createElement("div", null, React__default.createElement("h3", {
|
|
66
|
+
id: titleId,
|
|
67
|
+
className: "text-xl font-semibold text-card-foreground"
|
|
68
|
+
}, trimmedTitle), trimmedSubtitle && React__default.createElement("p", {
|
|
69
|
+
className: "mt-1 text-sm text-muted-foreground"
|
|
70
|
+
}, trimmedSubtitle)), React__default.createElement("button", {
|
|
71
|
+
type: "button",
|
|
72
|
+
onClick: onClose,
|
|
73
|
+
className: "rounded-themed bg-transparent p-1 text-muted-foreground transition-colors hover:bg-secondary/80 hover:text-foreground focus-themed",
|
|
74
|
+
"aria-label": "Close dialog"
|
|
75
|
+
}, React__default.createElement(X, {
|
|
76
|
+
className: "h-6 w-6"
|
|
77
|
+
}))), !hasHeader && React__default.createElement("button", {
|
|
78
|
+
type: "button",
|
|
79
|
+
onClick: onClose,
|
|
80
|
+
className: "absolute right-4 top-4 z-10 rounded-themed bg-transparent p-1 text-muted-foreground transition-colors hover:bg-secondary/80 hover:text-foreground focus-themed",
|
|
81
|
+
"aria-label": "Close dialog"
|
|
82
|
+
}, React__default.createElement(X, {
|
|
83
|
+
className: "h-6 w-6"
|
|
84
|
+
})), React__default.createElement("div", {
|
|
85
|
+
className: cn('min-h-0 flex-1 overflow-y-auto bg-card px-6 py-4 text-card-foreground', !hasHeader && 'pt-14', bodyClassName)
|
|
86
|
+
}, children), !hideFooter && React__default.createElement("div", {
|
|
87
|
+
className: "flex items-center justify-end gap-3 bg-card px-6 py-4 text-card-foreground"
|
|
88
|
+
}, React__default.createElement("button", {
|
|
89
|
+
type: "button",
|
|
90
|
+
onClick: onClose,
|
|
91
|
+
className: "rounded-themed border border-border bg-secondary px-4 py-2 text-sm font-medium text-secondary-foreground transition-colors hover:bg-secondary/80 focus-themed"
|
|
92
|
+
}, cancelLabel), onSave && React__default.createElement("button", {
|
|
93
|
+
type: "button",
|
|
94
|
+
onClick: onSave,
|
|
95
|
+
disabled: loading || saveDisabled,
|
|
96
|
+
className: "themed-button rounded-themed px-4 py-2 text-sm font-medium focus-themed disabled:cursor-not-allowed disabled:opacity-50"
|
|
97
|
+
}, loading ? 'Saving...' : saveLabel))));
|
|
98
|
+
}export{Dialog};//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":[null],"names":[],"mappings":"kIAMI,oBAAe,GAAA,OAAA;MACf,qBAAkB,GAAA,MAAA;MAClB,wBAAoB,GAAA,kBAAA;AACpB,MAAA,yBAAoB,GAAA,kBAAA;MACpB,wBAAkB,GAAA,MAAA;MAClB,yBAAqB,GAAA,MAAA;SACrB,cAAmB,CAAA,KAAA,EAAA,MAAA,EAAA;SACnB;IACA,KAAA,EAAA,KAAY,IAAG,oBAAQ;IACvB,MAAA,EAAA,MAAa,IAAA,qBAAQ;AACrB,IAAA,QAAQ,EAAA,wBAAuB;AAC/B,IAAA,SAAS,EAAA,yBAAwB;IACjC,QAAA,EAAU,wBAAS;IACnB,SAAA,EAAA;AACH,GAAA;AAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as PageLoading}from'./components/PageLoading/index.js';export{ApplicationErrorHandler}from'./components/ErrorHandlers/ApplicationErrorHandler.js';export{ErrorBoundary}from'./components/ErrorHandlers/ErrorBoundary.js';export{LayoutErrorBoundary}from'./components/ErrorHandlers/LayoutErrorBoundary.js';export{RemixErrorBoundary}from'./components/ErrorHandlers/RemixErrorBoundary.js';export{SPAErrorBoundary}from'./components/ErrorHandlers/SPAErrorBoundary.js';export{ReactTable}from'./components/ReactTable/Table.js';export{DefaultColumnFilter,SelectColumnFilter}from'./components/ReactTable/TableFilters.js';export{Error404}from'./components/ErrorPages/404.js';export{Error500}from'./components/ErrorPages/500.js';export{Error403}from'./components/ErrorPages/403.js';export{PageContainer}from'./components/PageContainer/PageContainer.js';export{Spin}from'./components/Spin/index.js';export{OTPInput}from'./components/OTP/OTPInput.js';export{SingleInput}from'./components/OTP/SingleInput.js';export{useOTPInput}from'./components/OTP/hooks.js';export{OTPVerification}from'./components/OTP/OTPVerification.js';export{SearchInput}from'./components/Search/SearchInput.js';export{Select,SelectContent,SelectItem,SelectSearch,SelectTrigger,SelectValue}from'./components/Select/Select.js';export{DatePicker}from'./components/DatePicker/DatePicker.js';export{TailwindUiButton}from'./components/Button/Button.js';export{TailwindThemeProvider,ThemeContext,themes}from'./components/ThemeProvider/ThemeProvider.js';export{ThemeToggle}from'./components/ThemeProvider/ThemeToggle.js';export{LanguageMenuDropdown}from'./components/LanguageMenuDropdown/LanguageMenuDropdown.js';export{InputToolBar}from'./components/InputToolBar/InputToolBar.js';export{getDefaultLeftItems,getDefaultRightItems}from'./components/InputToolBar/defaults.js';export{MarkdownBreadcrumbs}from'./components/Markdown/MarkdownBreadcrumbs.js';export{MarkdownCopyButton}from'./components/Markdown/MarkdownCopyButton.js';export{MarkdownHeader}from'./components/Markdown/MarkdownHeader.js';export{MarkdownNavigation}from'./components/Markdown/MarkdownNavigation.js';export{MarkdownPage}from'./components/Markdown/MarkdownPage.js';export{MarkdownTableOfContents}from'./components/Markdown/MarkdownTableOfContents.js';export{useTheme}from'./hooks/useTheme.js';export{useWindowSize}from'./hooks/useWindowSize.js';export{ToastContainer,useToast,useToastCloseAll}from'./hooks/useToast.js';export{useMediaQuery}from'./hooks/useMediaQuery.js';export{cn}from'./utils/util.js';//# sourceMappingURL=index.js.map
|
|
1
|
+
export{default as PageLoading}from'./components/PageLoading/index.js';export{ApplicationErrorHandler}from'./components/ErrorHandlers/ApplicationErrorHandler.js';export{ErrorBoundary}from'./components/ErrorHandlers/ErrorBoundary.js';export{LayoutErrorBoundary}from'./components/ErrorHandlers/LayoutErrorBoundary.js';export{RemixErrorBoundary}from'./components/ErrorHandlers/RemixErrorBoundary.js';export{SPAErrorBoundary}from'./components/ErrorHandlers/SPAErrorBoundary.js';export{ReactTable}from'./components/ReactTable/Table.js';export{DefaultColumnFilter,SelectColumnFilter}from'./components/ReactTable/TableFilters.js';export{Error404}from'./components/ErrorPages/404.js';export{Error500}from'./components/ErrorPages/500.js';export{Error403}from'./components/ErrorPages/403.js';export{PageContainer}from'./components/PageContainer/PageContainer.js';export{Spin}from'./components/Spin/index.js';export{OTPInput}from'./components/OTP/OTPInput.js';export{SingleInput}from'./components/OTP/SingleInput.js';export{useOTPInput}from'./components/OTP/hooks.js';export{OTPVerification}from'./components/OTP/OTPVerification.js';export{SearchInput}from'./components/Search/SearchInput.js';export{Select,SelectContent,SelectItem,SelectSearch,SelectTrigger,SelectValue}from'./components/Select/Select.js';export{DatePicker}from'./components/DatePicker/DatePicker.js';export{Dialog}from'./components/Dialog/Dialog.js';export{TailwindUiButton}from'./components/Button/Button.js';export{TailwindThemeProvider,ThemeContext,themes}from'./components/ThemeProvider/ThemeProvider.js';export{ThemeToggle}from'./components/ThemeProvider/ThemeToggle.js';export{LanguageMenuDropdown}from'./components/LanguageMenuDropdown/LanguageMenuDropdown.js';export{InputToolBar}from'./components/InputToolBar/InputToolBar.js';export{getDefaultLeftItems,getDefaultRightItems}from'./components/InputToolBar/defaults.js';export{MarkdownBreadcrumbs}from'./components/Markdown/MarkdownBreadcrumbs.js';export{MarkdownCopyButton}from'./components/Markdown/MarkdownCopyButton.js';export{MarkdownHeader}from'./components/Markdown/MarkdownHeader.js';export{MarkdownNavigation}from'./components/Markdown/MarkdownNavigation.js';export{MarkdownPage}from'./components/Markdown/MarkdownPage.js';export{MarkdownTableOfContents}from'./components/Markdown/MarkdownTableOfContents.js';export{useTheme}from'./hooks/useTheme.js';export{useWindowSize}from'./hooks/useWindowSize.js';export{ToastContainer,useToast,useToastCloseAll}from'./hooks/useToast.js';export{useMediaQuery}from'./hooks/useMediaQuery.js';export{cn}from'./utils/util.js';//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/tailwind-ui",
|
|
3
|
-
"version": "12.2.4-alpha.
|
|
3
|
+
"version": "12.2.4-alpha.33",
|
|
4
4
|
"description": "Sample core for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"watch": "npm run build:lib:watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@admin-layout/client": "12.2.4-alpha.
|
|
32
|
+
"@admin-layout/client": "12.2.4-alpha.33",
|
|
33
33
|
"@radix-ui/react-accordion": "^1.2.0",
|
|
34
34
|
"@radix-ui/react-alert-dialog": "^1.1.1",
|
|
35
35
|
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"typescript": {
|
|
91
91
|
"definition": "lib/index.d.ts"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "49cfebf1d5ba912cb947f5359c502d34078cab2f"
|
|
94
94
|
}
|