diff --git a/package.json b/package.json index 907d05d..553ed29 100644 --- a/package.json +++ b/package.json @@ -16,19 +16,7 @@ }, "release": { "branches": [ - "main", - { - "name": "remove-unused-components", - "prerelease": true - }, - { - "name": "refactor-simpler-build", - "prerelease": true - }, - { - "name": "dark-mode-selector-css", - "prerelease": true - } + "main" ] }, "publishConfig": { diff --git a/src/shadcn/ui/dialog.tsx b/src/shadcn/ui/dialog.tsx index e07ea8a..e1a0d56 100644 --- a/src/shadcn/ui/dialog.tsx +++ b/src/shadcn/ui/dialog.tsx @@ -16,41 +16,93 @@ const DialogClose = DialogPrimitive.Close const DialogOverlay = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - + React.ComponentPropsWithoutRef>(({className, ...props}, ref) => ( + <> + + )) DialogOverlay.displayName = DialogPrimitive.Overlay.displayName const DialogContent = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - {children} - - - Close - - - -)) + React.ComponentPropsWithoutRef & { + isDismissable?: boolean + isBottomDialog?: boolean + } +>(({ + className, + children, + isDismissable = true, + isBottomDialog = false, + ...props }, + ref) => { + const base = [ + "z-50", + "fixed", + "grid gap-4 p-6", + "border", + "bg-background", + "duration-200", + "data-[state=open]:animate-in data-[state=closed]:animate-out", + ] + + const centerStyles = [ + "max-w-lg", + "left-[50%] top-[50%]", + "translate-x-[-50%] translate-y-[-50%]", + "sm:rounded-lg", + "shadow-lg", + "data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0", + "data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95", + "data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]", + "data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]", + ].join(" ") + + const bottomStyles = [ + "left-0 bottom-0", + "w-full max-w-none", + "data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom", + ].join(" ") + + return ( + + + { + if (!isDismissable) e.preventDefault() + }} + onEscapeKeyDown={(e) => { + if (!isDismissable) e.preventDefault() + }} + {...props} + > + {children} + + {isDismissable && ( + + + Close + + )} + + + ) +}) DialogContent.displayName = DialogPrimitive.Content.displayName const DialogHeader = ({ diff --git a/src/shadcn/ui/sheet.tsx b/src/shadcn/ui/sheet.tsx index e5eed5b..98de3f9 100644 --- a/src/shadcn/ui/sheet.tsx +++ b/src/shadcn/ui/sheet.tsx @@ -21,7 +21,7 @@ const SheetOverlay = React.forwardRef< >(({ className, ...props }, ref) => ( { +const DialogDemo = (props: {isOpen: boolean, isBottomDialog: boolean, isDismissable: boolean}) => { return ( - - Open - - - Are you sure absolutely sure? - - This action cannot be undone. This will permanently delete your - account and remove your data from our servers. - - - - +
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

+ + + + Privacy Notice + +
+

+ We use cookies and similar technologies to improve your experience on our site, to analyze our traffic, and to understand where our audience is coming from. +

+
+ +
+ + +
+
+
+
+
+
+
+
); }; + const meta: Meta = { component: DialogDemo, + argTypes: { + isBottomDialog: { + control: 'boolean', + description: 'Positions the dialog at the bottom of the screen.', + defaultValue: false, + }, + isDismissable: { + control: 'boolean', + description: 'Whether the dialog can be dismissed.', + defaultValue: true, + }, + isOpen: { + control: 'boolean', + description: 'Controls whether the dialog is open or closed.', + defaultValue: true, + } + } }; export default meta; export const Default: StoryObj = { - args: {}, + args: { + isOpen: true, + isBottomDialog: false, + isDismissable: true, + }, };