-
Notifications
You must be signed in to change notification settings - Fork 3k
[WEB-5482] fix: propel package types #8158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
anmolsinghbhatia
wants to merge
4
commits into
preview
Choose a base branch
from
fix-propel-package-type-fix
base: preview
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,18 @@ export interface DialogTitleProps extends React.ComponentProps<typeof BaseDialog | |
| children: React.ReactNode; | ||
| } | ||
|
|
||
| export interface DialogPortalProps extends React.ComponentProps<typeof BaseDialog.Portal> { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prefer types over interfaces for prop types, you don't need declaration merging for props |
||
| children: React.ReactNode; | ||
| } | ||
|
|
||
| export interface DialogOverlayProps extends React.ComponentProps<typeof BaseDialog.Backdrop> { | ||
| className?: string; | ||
| } | ||
|
|
||
| export interface DialogTriggerProps extends React.ComponentProps<typeof BaseDialog.Trigger> { | ||
| children: React.ReactNode; | ||
| } | ||
|
|
||
| // Constants | ||
| const OVERLAY_CLASSNAME = cn("fixed inset-0 z-backdrop bg-custom-backdrop"); | ||
| const BASE_CLASSNAME = "relative text-left bg-custom-background-100 rounded-lg shadow-md w-full z-modal"; | ||
|
|
@@ -45,7 +57,7 @@ const getPositionClassNames = (position: DialogPosition) => | |
| "top-8 left-1/2 -translate-x-1/2": position === "top", | ||
| }); | ||
|
|
||
| const DialogPortal = memo(function DialogPortal({ children, ...props }) { | ||
| const DialogPortal = memo<DialogPortalProps>(function DialogPortal({ children, ...props }: DialogPortalProps) { | ||
| return ( | ||
| <BaseDialog.Portal data-slot="dialog-portal" {...props}> | ||
| {children} | ||
|
|
@@ -54,12 +66,12 @@ const DialogPortal = memo(function DialogPortal({ children, ...props }) { | |
| }); | ||
| DialogPortal.displayName = "DialogPortal"; | ||
|
|
||
| const DialogOverlay = memo(function DialogOverlay({ className, ...props }) { | ||
| const DialogOverlay = memo<DialogOverlayProps>(function DialogOverlay({ className, ...props }: DialogOverlayProps) { | ||
| return <BaseDialog.Backdrop data-slot="dialog-overlay" className={cn(OVERLAY_CLASSNAME, className)} {...props} />; | ||
| }); | ||
| DialogOverlay.displayName = "DialogOverlay"; | ||
|
|
||
| const DialogComponent = memo(function DialogComponent({ children, ...props }) { | ||
| const DialogComponent = memo<DialogProps>(function DialogComponent({ children, ...props }: DialogProps) { | ||
| return ( | ||
| <BaseDialog.Root data-slot="dialog" {...props}> | ||
| {children} | ||
|
|
@@ -68,7 +80,7 @@ const DialogComponent = memo(function DialogComponent({ children, ...props }) { | |
| }); | ||
| DialogComponent.displayName = "Dialog"; | ||
|
|
||
| const DialogTrigger = memo(function DialogTrigger({ children, ...props }) { | ||
| const DialogTrigger = memo<DialogTriggerProps>(function DialogTrigger({ children, ...props }: DialogTriggerProps) { | ||
| return ( | ||
| <BaseDialog.Trigger data-slot="dialog-trigger" {...props}> | ||
| {children} | ||
|
|
@@ -100,7 +112,7 @@ const DialogPanel = forwardRef(function DialogPanel( | |
| }); | ||
| DialogPanel.displayName = "DialogPanel"; | ||
|
|
||
| const DialogTitle = memo(function DialogTitle({ className, children, ...props }) { | ||
| const DialogTitle = memo<DialogTitleProps>(function DialogTitle({ className, children, ...props }: DialogTitleProps) { | ||
| return ( | ||
| <BaseDialog.Title | ||
| data-slot="dialog-title" | ||
|
|
@@ -115,12 +127,13 @@ const DialogTitle = memo(function DialogTitle({ className, children, ...props }) | |
| DialogTitle.displayName = "DialogTitle"; | ||
|
|
||
| // Create the compound Dialog component with proper typing | ||
| const Dialog = Object.assign(DialogComponent, { | ||
| Panel: DialogPanel, | ||
| Title: DialogTitle, | ||
| }) as typeof DialogComponent & { | ||
| const Dialog = DialogComponent as typeof DialogComponent & { | ||
| Panel: typeof DialogPanel; | ||
| Title: typeof DialogTitle; | ||
| Trigger: typeof DialogTrigger; | ||
| }; | ||
| Dialog.Panel = DialogPanel; | ||
| Dialog.Title = DialogTitle; | ||
| Dialog.Trigger = DialogTrigger; | ||
|
|
||
| export { Dialog, DialogTitle, DialogPanel }; | ||
| export { Dialog, DialogTitle, DialogPanel, DialogTrigger }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ export interface PopoverContentProps extends React.ComponentProps<typeof BasePop | |
| } | ||
|
|
||
| // PopoverContent component | ||
| const PopoverContent = React.memo(function PopoverContent({ | ||
| const PopoverContent = React.memo<PopoverContentProps>(function PopoverContent({ | ||
| children, | ||
| className, | ||
| placement, | ||
|
|
@@ -23,7 +23,7 @@ const PopoverContent = React.memo(function PopoverContent({ | |
| containerRef, | ||
| positionerClassName, | ||
| ...props | ||
| }) { | ||
| }: PopoverContentProps) { | ||
| // side and align calculations | ||
| const { finalSide, finalAlign } = React.useMemo(() => { | ||
| if (placement) { | ||
|
|
@@ -45,28 +45,29 @@ const PopoverContent = React.memo(function PopoverContent({ | |
| }); | ||
|
|
||
| // wrapper components | ||
| const PopoverTrigger = React.memo(function PopoverTrigger(props) { | ||
| const PopoverTrigger = React.memo(function PopoverTrigger(props: React.ComponentProps<typeof BasePopover.Trigger>) { | ||
| return <BasePopover.Trigger data-slot="popover-trigger" {...props} />; | ||
| }); | ||
|
|
||
| const PopoverPortal = React.memo(function PopoverPortal(props) { | ||
| const PopoverPortal = React.memo(function PopoverPortal(props: React.ComponentProps<typeof BasePopover.Portal>) { | ||
| return <BasePopover.Portal data-slot="popover-portal" {...props} />; | ||
| }); | ||
|
|
||
| const PopoverPositioner = React.memo(function PopoverPositioner(props) { | ||
| const PopoverPositioner = React.memo(function PopoverPositioner(props: React.ComponentProps<typeof BasePopover.Positioner>) { | ||
| return <BasePopover.Positioner data-slot="popover-positioner" {...props} />; | ||
| }); | ||
|
|
||
| // compound components | ||
| const Popover = Object.assign( | ||
| React.memo<React.ComponentProps<typeof BasePopover.Root>>(function Popover(props) { | ||
| return <BasePopover.Root data-slot="popover" {...props} />; | ||
| }), | ||
| { | ||
| Button: PopoverTrigger, | ||
| Panel: PopoverContent, | ||
| } | ||
| ); | ||
| const PopoverRoot = React.memo<React.ComponentProps<typeof BasePopover.Root>>(function Popover(props) { | ||
| return <BasePopover.Root data-slot="popover" {...props} />; | ||
| }); | ||
|
|
||
| const Popover = PopoverRoot as typeof PopoverRoot & { | ||
| Button: typeof PopoverTrigger; | ||
| Panel: typeof PopoverContent; | ||
| }; | ||
| Popover.Button = PopoverTrigger; | ||
| Popover.Panel = PopoverContent; | ||
|
|
||
| // display names | ||
| PopoverContent.displayName = "PopoverContent"; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.