@manhphi1309/dialog 0.3.7 → 0.3.9
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/index.cjs +7 -5
- package/dist/index.d.cts +6 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +7 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -152,7 +152,7 @@ function DialogOverlay({ className, ...props }) {
|
|
|
152
152
|
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
153
153
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogPortal, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(radix_ui.Dialog.Content, {
|
|
154
154
|
"data-slot": "dialog-content",
|
|
155
|
-
className: (0, _manhphi1309_utils.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2
|
|
155
|
+
className: (0, _manhphi1309_utils.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl bg-popover text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
156
156
|
...props,
|
|
157
157
|
children: [children, showCloseButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.Dialog.Close, {
|
|
158
158
|
"data-slot": "dialog-close",
|
|
@@ -181,10 +181,10 @@ function DialogContent({ className, children, showCloseButton = true, ...props }
|
|
|
181
181
|
* <DialogDescription>This action is irreversible.</DialogDescription>
|
|
182
182
|
* </DialogHeader>
|
|
183
183
|
*/
|
|
184
|
-
function DialogHeader({ className, ...props }) {
|
|
184
|
+
function DialogHeader({ className, withSeparator = false, ...props }) {
|
|
185
185
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
186
186
|
"data-slot": "dialog-header",
|
|
187
|
-
className: (0, _manhphi1309_utils.cn)("flex flex-col gap-2
|
|
187
|
+
className: (0, _manhphi1309_utils.cn)("flex flex-col gap-2 p-4", withSeparator && "border-b border-border", className),
|
|
188
188
|
...props
|
|
189
189
|
});
|
|
190
190
|
}
|
|
@@ -390,7 +390,7 @@ function ResponsiveDialogContent({ className, children, showCloseButton = true,
|
|
|
390
390
|
const isMobile = (0, _manhphi1309_hooks.useIsMobile)();
|
|
391
391
|
const { snap } = react.useContext(ResponsiveDialogContext);
|
|
392
392
|
if (isMobile) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_manhphi1309_drawer.DrawerContent, {
|
|
393
|
-
className: (0, _manhphi1309_utils.cn)(snap && "h-[96dvh
|
|
393
|
+
className: (0, _manhphi1309_utils.cn)(snap && "h-[calc(96dvh-env(safe-area-inset-top))]", className),
|
|
394
394
|
...props,
|
|
395
395
|
children
|
|
396
396
|
});
|
|
@@ -411,16 +411,18 @@ function ResponsiveDialogContent({ className, children, showCloseButton = true,
|
|
|
411
411
|
* Typically contains `ResponsiveDialogTitle` and optionally
|
|
412
412
|
* `ResponsiveDialogDescription`.
|
|
413
413
|
*/
|
|
414
|
-
function ResponsiveDialogHeader({ className, leftAction, rightAction, children, ...props }) {
|
|
414
|
+
function ResponsiveDialogHeader({ className, leftAction, rightAction, withSeparator = false, children, ...props }) {
|
|
415
415
|
if ((0, _manhphi1309_hooks.useIsMobile)()) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_manhphi1309_drawer.DrawerHeader, {
|
|
416
416
|
leftAction,
|
|
417
417
|
rightAction,
|
|
418
418
|
className,
|
|
419
|
+
withSeparator,
|
|
419
420
|
...props,
|
|
420
421
|
children
|
|
421
422
|
});
|
|
422
423
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogHeader, {
|
|
423
424
|
className,
|
|
425
|
+
withSeparator,
|
|
424
426
|
...props,
|
|
425
427
|
children
|
|
426
428
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -127,8 +127,11 @@ declare function DialogContent({
|
|
|
127
127
|
*/
|
|
128
128
|
declare function DialogHeader({
|
|
129
129
|
className,
|
|
130
|
+
withSeparator,
|
|
130
131
|
...props
|
|
131
|
-
}: React.ComponentProps<"div">
|
|
132
|
+
}: React.ComponentProps<"div"> & {
|
|
133
|
+
withSeparator?: boolean;
|
|
134
|
+
}): React.JSX.Element;
|
|
132
135
|
/**
|
|
133
136
|
* Layout wrapper for the **bottom action area** of a dialog.
|
|
134
137
|
* Bleeds to the content panel edges (`-mx-4 -mb-4`), adds a top border
|
|
@@ -295,11 +298,13 @@ declare function ResponsiveDialogHeader({
|
|
|
295
298
|
className,
|
|
296
299
|
leftAction,
|
|
297
300
|
rightAction,
|
|
301
|
+
withSeparator,
|
|
298
302
|
children,
|
|
299
303
|
...props
|
|
300
304
|
}: React.ComponentProps<"div"> & {
|
|
301
305
|
leftAction?: React.ReactNode;
|
|
302
306
|
rightAction?: React.ReactNode;
|
|
307
|
+
withSeparator?: boolean;
|
|
303
308
|
}): React.JSX.Element;
|
|
304
309
|
/**
|
|
305
310
|
* Layout wrapper for the **bottom action area** of the responsive
|
package/dist/index.d.mts
CHANGED
|
@@ -127,8 +127,11 @@ declare function DialogContent({
|
|
|
127
127
|
*/
|
|
128
128
|
declare function DialogHeader({
|
|
129
129
|
className,
|
|
130
|
+
withSeparator,
|
|
130
131
|
...props
|
|
131
|
-
}: React.ComponentProps<"div">
|
|
132
|
+
}: React.ComponentProps<"div"> & {
|
|
133
|
+
withSeparator?: boolean;
|
|
134
|
+
}): React.JSX.Element;
|
|
132
135
|
/**
|
|
133
136
|
* Layout wrapper for the **bottom action area** of a dialog.
|
|
134
137
|
* Bleeds to the content panel edges (`-mx-4 -mb-4`), adds a top border
|
|
@@ -295,11 +298,13 @@ declare function ResponsiveDialogHeader({
|
|
|
295
298
|
className,
|
|
296
299
|
leftAction,
|
|
297
300
|
rightAction,
|
|
301
|
+
withSeparator,
|
|
298
302
|
children,
|
|
299
303
|
...props
|
|
300
304
|
}: React.ComponentProps<"div"> & {
|
|
301
305
|
leftAction?: React.ReactNode;
|
|
302
306
|
rightAction?: React.ReactNode;
|
|
307
|
+
withSeparator?: boolean;
|
|
303
308
|
}): React.JSX.Element;
|
|
304
309
|
/**
|
|
305
310
|
* Layout wrapper for the **bottom action area** of the responsive
|
package/dist/index.mjs
CHANGED
|
@@ -128,7 +128,7 @@ function DialogOverlay({ className, ...props }) {
|
|
|
128
128
|
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
129
129
|
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
|
|
130
130
|
"data-slot": "dialog-content",
|
|
131
|
-
className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2
|
|
131
|
+
className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl bg-popover text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
132
132
|
...props,
|
|
133
133
|
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
134
134
|
"data-slot": "dialog-close",
|
|
@@ -157,10 +157,10 @@ function DialogContent({ className, children, showCloseButton = true, ...props }
|
|
|
157
157
|
* <DialogDescription>This action is irreversible.</DialogDescription>
|
|
158
158
|
* </DialogHeader>
|
|
159
159
|
*/
|
|
160
|
-
function DialogHeader({ className, ...props }) {
|
|
160
|
+
function DialogHeader({ className, withSeparator = false, ...props }) {
|
|
161
161
|
return /* @__PURE__ */ jsx("div", {
|
|
162
162
|
"data-slot": "dialog-header",
|
|
163
|
-
className: cn("flex flex-col gap-2
|
|
163
|
+
className: cn("flex flex-col gap-2 p-4", withSeparator && "border-b border-border", className),
|
|
164
164
|
...props
|
|
165
165
|
});
|
|
166
166
|
}
|
|
@@ -366,7 +366,7 @@ function ResponsiveDialogContent({ className, children, showCloseButton = true,
|
|
|
366
366
|
const isMobile = useIsMobile();
|
|
367
367
|
const { snap } = React.useContext(ResponsiveDialogContext);
|
|
368
368
|
if (isMobile) return /* @__PURE__ */ jsx(DrawerContent, {
|
|
369
|
-
className: cn(snap && "h-[96dvh
|
|
369
|
+
className: cn(snap && "h-[calc(96dvh-env(safe-area-inset-top))]", className),
|
|
370
370
|
...props,
|
|
371
371
|
children
|
|
372
372
|
});
|
|
@@ -387,16 +387,18 @@ function ResponsiveDialogContent({ className, children, showCloseButton = true,
|
|
|
387
387
|
* Typically contains `ResponsiveDialogTitle` and optionally
|
|
388
388
|
* `ResponsiveDialogDescription`.
|
|
389
389
|
*/
|
|
390
|
-
function ResponsiveDialogHeader({ className, leftAction, rightAction, children, ...props }) {
|
|
390
|
+
function ResponsiveDialogHeader({ className, leftAction, rightAction, withSeparator = false, children, ...props }) {
|
|
391
391
|
if (useIsMobile()) return /* @__PURE__ */ jsx(DrawerHeader, {
|
|
392
392
|
leftAction,
|
|
393
393
|
rightAction,
|
|
394
394
|
className,
|
|
395
|
+
withSeparator,
|
|
395
396
|
...props,
|
|
396
397
|
children
|
|
397
398
|
});
|
|
398
399
|
return /* @__PURE__ */ jsx(DialogHeader, {
|
|
399
400
|
className,
|
|
401
|
+
withSeparator,
|
|
400
402
|
...props,
|
|
401
403
|
children
|
|
402
404
|
});
|