Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
db6ff8a
Migrate Dropdown from radix-ui to base-ui
abhishekxix Jan 7, 2026
47577a7
Migrate Dialog from radix-ui to base-ui
abhishekxix Jan 7, 2026
0fb4d38
Remove radix-ui dialog and dropdown menu
abhishekxix Jan 7, 2026
9a0e925
Migrate Tooltip from radix-ui to base-ui
abhishekxix Jan 8, 2026
d8cf571
Remove radix-ui tooltip
abhishekxix Jan 8, 2026
7fc2d6b
WIP: Migrate toast component from radix-ui to base-ui
abhishekxix Jan 8, 2026
f8393ec
Migrate Toast from radix-ui to base-ui
abhishekxix Jan 9, 2026
e30b1b7
Remove radix-ui toast
abhishekxix Jan 9, 2026
e472a45
Fix timeout logic
abhishekxix Jan 9, 2026
40ec5d0
Add type keyword to type imports
abhishekxix Jan 9, 2026
d5b067b
Update toast styles for animation
abhishekxix Jan 9, 2026
42bf300
Fix dropdown not showing inside dialog
abhishekxix Jan 12, 2026
8fc9565
Convert conditional classes to clsx call
abhishekxix Jan 12, 2026
4b987c1
Prevent layout shift on dropdown open
abhishekxix Jan 12, 2026
fa53325
Update packages/frappe-ui-react/src/components/dropdown/dropdown.tsx
abhishekxix Jan 12, 2026
7ba1eb2
Replace string interpolation with clsx
abhishekxix Jan 12, 2026
696587d
Revert the initial z-index for dropdown and dialog
abhishekxix Jan 12, 2026
dfe4f8a
Fix escaping issue in toast description
abhishekxix Jan 13, 2026
e3c8d0a
Fix async issues and add test cases for dropdown
abhishekxix Jan 14, 2026
6d65f32
Add more test cases for dropdown component
abhishekxix Jan 14, 2026
6eea34d
Add test cases for toast
abhishekxix Jan 14, 2026
e732ac7
Add test cases for tooltip
abhishekxix Jan 14, 2026
c2e64de
Remove unused import for act
abhishekxix Jan 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
906 changes: 68 additions & 838 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions packages/frappe-ui-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,10 @@
"publish:remote": "npm publish"
},
"dependencies": {
"@base-ui/react": "^1.0.0",
"@floating-ui/react": "^0.27.13",
"@headlessui/react": "^2.2.6",
"@popperjs/core": "^2.11.8",
"@radix-ui/react-dialog": "^1.1.14",
"@radix-ui/react-dropdown-menu": "^2.1.15",
"@radix-ui/react-toast": "^1.2.15",
"@radix-ui/react-tooltip": "^1.2.7",
"@tailwindcss/vite": "^4.1.11",
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
Expand Down
18 changes: 9 additions & 9 deletions packages/frappe-ui-react/src/components/dialog/dialog.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@keyframes dialog-overlay-in {
@keyframes dialog-backdrop-in {
from {
opacity: 0;
}
Expand All @@ -7,7 +7,7 @@
}
}

@keyframes dialog-overlay-out {
@keyframes dialog-backdrop-out {
from {
opacity: 1;
}
Expand Down Expand Up @@ -38,18 +38,18 @@
}
}

.dialog-overlay[data-state='open'] {
animation: dialog-overlay-in 100ms ease-out;
.dialog-backdrop[data-open] {
animation: dialog-backdrop-in 100ms ease-out;
}

.dialog-overlay[data-state='closed'] {
animation: dialog-overlay-out 150ms ease-in;
.dialog-backdrop[data-closed] {
animation: dialog-backdrop-out 150ms ease-in;
}

.dialog-content[data-state='open'] {
.dialog-content[data-open] {
animation: dialog-content-in 100ms ease-out;
}

.dialog-content[data-state='closed'] {
.dialog-content[data-closed] {
animation: dialog-content-out 150ms ease-in;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ export const WithInteractiveComponents: Story = {
setAutocompleteValue(_value as AutocompleteOption)
}
/>
<div className="space-y-3">
<label className="block text-sm font-medium text-gray-700">
<div>
<label className="block text-sm font-medium text-gray-700 mb-3">
Select an option:
</label>
<Dropdown options={dropdownOptions} placement="left">
Expand Down
111 changes: 53 additions & 58 deletions packages/frappe-ui-react/src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import React, { useMemo } from "react";
import {
Root,
Portal,
Overlay,
Content,
Close,
Description,
Title,
} from "@radix-ui/react-dialog";
import { useMemo } from "react";
import { Dialog as BaseDialog } from "@base-ui/react/dialog";
import { X } from "lucide-react";
import clsx from "clsx";
import { Button } from "../button";
Expand All @@ -34,12 +26,6 @@ const Dialog = ({
actions = [],
} = options;

const handleInteractOutside = (e: Event) => {
if (disableOutsideClickToClose) {
e.preventDefault();
}
};

const closeDialog = () => onOpenChange(false);

const icon = useMemo(() => {
Expand Down Expand Up @@ -100,20 +86,24 @@ const Dialog = ({
}, [icon]);

return (
<Root open={open} onOpenChange={onOpenChange}>
<Portal>
<Overlay
className="dialog-overlay fixed inset-0 bg-black-overlay-200 backdrop-filter backdrop-blur-[12px] overflow-y-auto z-[11]"
<BaseDialog.Root
open={open}
onOpenChange={onOpenChange}
disablePointerDismissal={disableOutsideClickToClose}
>
<BaseDialog.Portal>
<BaseDialog.Backdrop
className="dialog-backdrop fixed inset-0 bg-black-overlay-200 backdrop-filter backdrop-blur-[12px] overflow-y-auto z-[11]"
data-dialog={"dialog"}
onAnimationEnd={() => !open && onAfterLeave?.()}
>
<div
<BaseDialog.Viewport
className={clsx(
"flex min-h-screen flex-col items-center px-4 py-4 text-center",
dialogPositionClasses
)}
>
<Content
<BaseDialog.Popup
className={clsx(
"dialog-content my-8 inline-block w-full transform overflow-hidden rounded-xl bg-surface-modal text-left align-middle shadow-xl",
{
Expand All @@ -130,8 +120,6 @@ const Dialog = ({
"max-w-xs": size === "xs",
}
)}
onEscapeKeyDown={closeDialog}
onInteractOutside={handleInteractOutside}
>
<div className="bg-surface-modal px-4 pb-6 pt-5 sm:px-6">
<div className="flex">
Expand All @@ -152,41 +140,48 @@ const Dialog = ({
/>
</div>
)}
<Title asChild>
{typeof title === "string" ? (
<h3
className="text-2xl font-semibold leading-6 text-ink-gray-9"
data-testid="dialog-title"
>
{title || "Untitled"}
</h3>
) : (
title && title()
)}
</Title>
<BaseDialog.Title
render={
typeof title === "string" || !title ? (
<h3
className="text-2xl font-semibold leading-6 text-ink-gray-9"
data-testid="dialog-title"
>
{title || "Untitled"}
</h3>
) : (
title()
)
}
/>
</div>
<Close asChild>
<Button
variant="ghost"
onClick={closeDialog}
data-testid="dialog-close"
>
<X className="h-4 w-4 text-ink-gray-9" />
</Button>
</Close>
<BaseDialog.Close
render={
<Button
variant="ghost"
onClick={closeDialog}
data-testid="dialog-close"
>
<X className="h-4 w-4 text-ink-gray-9" />
</Button>
}
nativeButton={true}
/>
</div>

{children
? children
: message && (
<Description asChild>
<p
className="text-p-base text-ink-gray-7"
data-testid="dialog-description"
>
{message}
</p>
</Description>
<BaseDialog.Description
render={
<p
className="text-p-base text-ink-gray-7"
data-testid="dialog-description"
>
{message}
</p>
}
/>
)}
</div>
</div>
Expand All @@ -209,11 +204,11 @@ const Dialog = ({
)}
</div>
)}
</Content>
</div>
</Overlay>
</Portal>
</Root>
</BaseDialog.Popup>
</BaseDialog.Viewport>
</BaseDialog.Backdrop>
</BaseDialog.Portal>
</BaseDialog.Root>
);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/frappe-ui-react/src/components/dialog/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface DialogActionButtonProps {
}

export interface DialogOptions {
title?: (() => React.ReactNode) | string;
title?: (() => React.ReactElement) | string;
message?: string;
size?:
| "xs"
Expand Down
Loading