Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(dify-ui): export Base UI event types under component names (#43876)
yyh7068d0d60ab1
diff --git a/packages/dify-ui/README.md b/packages/dify-ui/README.mdindex 44c1bee059e..223aecf4061 100644--- a/packages/dify-ui/README.md+++ b/packages/dify-ui/README.md@@ -54,6 +54,7 @@ Utilities:- `./cn` re-exports `cn` from the `cn` package through Dify UI's public subpath.- `./use-merged-refs` exports `useMergedRefs` for combining internal and caller refs, including callback cleanup.- `./use-ref-with-init` exports `useRefWithInit` for lazy ref initialization. Later initializer or argument changes do not reset the ref; initialization runs during render and must be safe to retry or discard.+- `./use-render` exports `useRender` for building a part with Base UI's `render` prop, `className(state)` callback and state data attributes; `./merge-props` exports `mergeProps` for chaining event handlers and merging `className`/`style` when composing parts.- `./styles.css` provides design tokens, theme variables, and shared utilities.## Guidesdiff --git a/packages/dify-ui/docs/authoring.md b/packages/dify-ui/docs/authoring.mdindex 2540bebff7d..0a8691f9718 100644--- a/packages/dify-ui/docs/authoring.md+++ b/packages/dify-ui/docs/authoring.md@@ -5,6 +5,12 @@ module-local and publish the complete surface through separate `export { ... }``export type { ... }` manifests at the bottom of the file. Do not mix scattered inline exportswith the manifest or use wildcard exports.+## Base UI imports++Import a Base UI part once per module and read its types from that binding's namespace, such as+`BaseRadio.Root.Props`. Use `import type` only when the module has no runtime use of the part. Do+not keep a value import and a type import of the same module side by side.+## React importsUse React namespace imports throughout this package, including stories and tests. Use@@ -62,9 +68,13 @@ A type is not public merely because Base UI names it or an implementation once eaddition to matching component props, export a type only when it pairs with a public factory or areal consumer must name it independently.-State, event details and reasons, controlled-state helpers, context values, render helpers,-styling helpers, and upstream passthrough aliases are private by default. Public props-already provide contextual typing for inline render and event callbacks.+State, controlled-state helpers, context values, render helpers, styling helpers, and upstream+passthrough aliases are private by default. Public props already provide contextual typing for+inline render and event callbacks.++Event details and reasons are the exception. A component that aliases or wraps a Base UI part+re-exports that part's `*EventDetails` and `*EventReason` types under its own name. A composite+that only uses a part internally does not. `State` and enum namespaces stay private.Preserve upstream `className` and `style` callbacks. Resolve `className` with the owning Base UIpart's state before merging default classes with `cn()`, including through composite wrappers.diff --git a/packages/dify-ui/package.json b/packages/dify-ui/package.jsonindex 4bb1321d102..80f24c1b82d 100644--- a/packages/dify-ui/package.json+++ b/packages/dify-ui/package.json@@ -17,6 +17,14 @@"types": "./src/use-ref-with-init.ts","import": "./src/use-ref-with-init.ts"},+ "./use-render": {+ "types": "./src/use-render.ts",+ "import": "./src/use-render.ts"+ },+ "./merge-props": {+ "types": "./src/merge-props.ts",+ "import": "./src/merge-props.ts"+ },"./alert-dialog": {"types": "./src/alert-dialog/index.tsx","import": "./src/alert-dialog/index.tsx"diff --git a/packages/dify-ui/src/alert-dialog/__tests__/types.tsx b/packages/dify-ui/src/alert-dialog/__tests__/types.tsxindex 439d467cb70..ac73e335063 100644--- a/packages/dify-ui/src/alert-dialog/__tests__/types.tsx+++ b/packages/dify-ui/src/alert-dialog/__tests__/types.tsx@@ -1,5 +1,13 @@-import type { AlertDialogActions, AlertDialogProps } from '@langgenius/dify-ui/alert-dialog'-import { AlertDialog } from '@langgenius/dify-ui/alert-dialog'+import type {+ AlertDialogActions,+ AlertDialogHandle,+ AlertDialogProps,+} from '@langgenius/dify-ui/alert-dialog'+import {+ AlertDialog,+ AlertDialogTrigger,+ createAlertDialogHandle,+} from '@langgenius/dify-ui/alert-dialog'import * as React from 'react'import { expectTypeOf } from 'vite-plus/test'@@ -10,3 +18,30 @@ export function alertDialogActionsTypeContract() {>()return <AlertDialog actionsRef={actionsRef} />}++type Payload = { documentId: string }++export function alertDialogHandleTypeContracts() {+ const handle = createAlertDialogHandle<Payload>()+ expectTypeOf(handle).toEqualTypeOf<AlertDialogHandle<Payload>>()+ const trigger = (+ <AlertDialogTrigger handle={handle} payload={{ documentId: 'document-1' }}>+ Delete+ </AlertDialogTrigger>+ )+ const dialog = (+ <AlertDialog handle={handle}>+ {({ payload }) => {+ expectTypeOf(payload).toEqualTypeOf<Payload | undefined>()+ return <span>{payload?.documentId}</span>+ }}+ </AlertDialog>+ )+ const invalid = (+ // @ts-expect-error Detached triggers preserve the handle payload contract.+ <AlertDialogTrigger handle={handle} payload={{ documentId: 1 }}>+ Delete+ </AlertDialogTrigger>+ )+ return { trigger, dialog, invalid }+}diff --git a/packages/dify-ui/src/alert-dialog/index.tsx b/packages/dify-ui/src/alert-dialog/index.tsxindex 9f51c5f3a67..f25ea6bec82 100644--- a/packages/dify-ui/src/alert-dialog/index.tsx+++ b/packages/dify-ui/src/alert-dialog/index.tsx@@ -15,10 +15,14 @@ import {const AlertDialog = BaseAlertDialog.Rootconst AlertDialogTitle = BaseAlertDialog.Titleconst AlertDialogDescription = BaseAlertDialog.Description+const createAlertDialogHandle = BaseAlertDialog.createHandletype AlertDialogActions = BaseAlertDialog.Root.Actions+type AlertDialogChangeEventReason = BaseAlertDialog.Root.ChangeEventReason+type AlertDialogChangeEventDetails = BaseAlertDialog.Root.ChangeEventDetailstype AlertDialogProps<Payload = unknown> = BaseAlertDialog.Root.Props<Payload>+type AlertDialogHandle<Payload = unknown> = BaseAlertDialog.Handle<Payload>type AlertDialogTriggerProps<Payload = unknown> = BaseAlertDialog.Trigger.Props<Payload>function AlertDialogTrigger<Payload = unknown>({@@ -114,15 +118,19 @@ export {AlertDialogFooter,AlertDialogTitle,AlertDialogTrigger,+ createAlertDialogHandle,}export type {AlertDialogActions,AlertDialogCancelButtonProps,+ AlertDialogChangeEventDetails,+ AlertDialogChangeEventReason,AlertDialogConfirmButtonProps,AlertDialogContentProps,AlertDialogDescriptionProps,AlertDialogFooterProps,+ AlertDialogHandle,AlertDialogProps,AlertDialogTitleProps,AlertDialogTriggerProps,diff --git a/packages/dify-ui/src/autocomplete/index.tsx b/packages/dify-ui/src/autocomplete/index.tsxindex a7599c2e5e4..23710b37462 100644--- a/packages/dify-ui/src/autocomplete/index.tsx+++ b/packages/dify-ui/src/autocomplete/index.tsx@@ -19,8 +19,11 @@ import { parsePlacement } from '../placement'type AutocompleteActions = BaseAutocomplete.Root.Actionstype AutocompleteProps<ItemValue> = BaseAutocomplete.Root.Props<ItemValue>+type AutocompleteChangeEventReason = BaseAutocomplete.Root.ChangeEventReasontype AutocompleteChangeEventDetails = BaseAutocomplete.Root.ChangeEventDetailstype AutocompleteOpenChangeEventDetails = BaseAutocomplete.Root.OpenChangeEventDetails+type AutocompleteHighlightEventReason = BaseAutocomplete.Root.HighlightEventReason+type AutocompleteHighlightEventDetails = BaseAutocomplete.Root.HighlightEventDetailstype AutocompleteGroupedProps<Items extends readonly { items: readonly unknown[] }[]> = Omit<AutocompleteProps<Items[number]['items'][number]>,'items'@@ -439,6 +442,7 @@ export {export type {AutocompleteActions,AutocompleteChangeEventDetails,+ AutocompleteChangeEventReason,AutocompleteClearProps,AutocompleteCollectionProps,AutocompleteEmptyProps,@@ -446,6 +450,8 @@ export type {AutocompleteGroupedProps,AutocompleteGroupLabelProps,AutocompleteGroupProps,+ AutocompleteHighlightEventDetails,+ AutocompleteHighlightEventReason,AutocompleteIconProps,AutocompleteInputGroupProps,AutocompleteInputProps,diff --git a/packages/dify-ui/src/button/index.tsx b/packages/dify-ui/src/button/index.tsxindex 40f1bdb7b02..72278558630 100644--- a/packages/dify-ui/src/button/index.tsx+++ b/packages/dify-ui/src/button/index.tsx@@ -1,6 +1,5 @@'use client'-import type { Button as BaseButtonNS } from '@base-ui/react/button'import type { VariantProps } from 'class-variance-authority'import { Button as BaseButton } from '@base-ui/react/button'import { cva } from 'class-variance-authority'@@ -104,7 +103,7 @@ const buttonVariants = cva(},)-type ButtonProps = BaseButtonNS.Props &+type ButtonProps = BaseButton.Props &VariantProps<typeof buttonVariants> & {/*** Marks an action as pending, blocks activation, and keeps the button focusable by default.diff --git a/packages/dify-ui/src/checkbox-group/index.tsx b/packages/dify-ui/src/checkbox-group/index.tsxindex a080d0b1788..fb188dbc426 100644--- a/packages/dify-ui/src/checkbox-group/index.tsx+++ b/packages/dify-ui/src/checkbox-group/index.tsx@@ -1,11 +1,12 @@'use client'-import type { CheckboxGroup as BaseCheckboxGroupNS } from '@base-ui/react/checkbox-group'import { CheckboxGroup as BaseCheckboxGroup } from '@base-ui/react/checkbox-group'-type CheckboxGroupProps = BaseCheckboxGroupNS.Props+type CheckboxGroupProps = BaseCheckboxGroup.Props+type CheckboxGroupChangeEventReason = BaseCheckboxGroup.ChangeEventReason+type CheckboxGroupChangeEventDetails = BaseCheckboxGroup.ChangeEventDetailsconst CheckboxGroup = BaseCheckboxGroupexport { CheckboxGroup }-export type { CheckboxGroupProps }+export type { CheckboxGroupChangeEventDetails, CheckboxGroupChangeEventReason, CheckboxGroupProps }diff --git a/packages/dify-ui/src/checkbox/index.tsx b/packages/dify-ui/src/checkbox/index.tsxindex d3d8032920a..64e95196e96 100644--- a/packages/dify-ui/src/checkbox/index.tsx+++ b/packages/dify-ui/src/checkbox/index.tsx@@ -1,6 +1,5 @@'use client'-import type { Checkbox as BaseCheckboxNS } from '@base-ui/react/checkbox'import type * as React from 'react'import { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox'import { cn } from '../cn'@@ -27,7 +26,9 @@ const checkboxIndicatorClassName =const checkboxSkeletonClassName = 'size-4 shrink-0 rounded-sm bg-text-quaternary opacity-20'-type CheckboxProps = Omit<BaseCheckboxNS.Root.Props, 'children'>+type CheckboxProps = Omit<BaseCheckbox.Root.Props, 'children'>+type CheckboxChangeEventReason = BaseCheckbox.Root.ChangeEventReason+type CheckboxChangeEventDetails = BaseCheckbox.Root.ChangeEventDetailsfunction Checkbox({ className, ...props }: CheckboxProps) {return (@@ -61,4 +62,9 @@ function CheckboxSkeleton({ className, ...props }: CheckboxSkeletonProps) {export { Checkbox, CheckboxSkeleton }-export type { CheckboxProps, CheckboxSkeletonProps }+export type {+ CheckboxChangeEventDetails,+ CheckboxChangeEventReason,+ CheckboxProps,+ CheckboxSkeletonProps,+}diff --git a/packages/dify-ui/src/collapsible/index.tsx b/packages/dify-ui/src/collapsible/index.tsxindex f98a196f2a2..80c5c172790 100644--- a/packages/dify-ui/src/collapsible/index.tsx+++ b/packages/dify-ui/src/collapsible/index.tsx@@ -1,12 +1,13 @@'use client'-import type { Collapsible as BaseCollapsibleNS } from '@base-ui/react/collapsible'import { Collapsible as BaseCollapsible } from '@base-ui/react/collapsible'import { cn } from '../cn'import { resolveClassName } from '../internals/resolve-class-name'import { triggerFocusClassName } from '../overlay-shared'-type CollapsibleProps = BaseCollapsibleNS.Root.Props+type CollapsibleProps = BaseCollapsible.Root.Props+type CollapsibleChangeEventReason = BaseCollapsible.Root.ChangeEventReason+type CollapsibleChangeEventDetails = BaseCollapsible.Root.ChangeEventDetailsfunction Collapsible({ className, ...props }: CollapsibleProps) {return (<BaseCollapsible.Root@@ -16,7 +17,7 @@ function Collapsible({ className, ...props }: CollapsibleProps) {)}-type CollapsibleTriggerProps = BaseCollapsibleNS.Trigger.Props+type CollapsibleTriggerProps = BaseCollapsible.Trigger.Propsfunction CollapsibleTrigger({ className, ...props }: CollapsibleTriggerProps) {return (<BaseCollapsible.Trigger@@ -26,7 +27,7 @@ function CollapsibleTrigger({ className, ...props }: CollapsibleTriggerProps) {)}-type CollapsiblePanelProps = BaseCollapsibleNS.Panel.Props+type CollapsiblePanelProps = BaseCollapsible.Panel.Propsfunction CollapsiblePanel({ className, ...props }: CollapsiblePanelProps) {return (<BaseCollapsible.Panel@@ -45,4 +46,10 @@ function CollapsiblePanel({ className, ...props }: CollapsiblePanelProps) {export { Collapsible, CollapsiblePanel, CollapsibleTrigger }-export type { CollapsiblePanelProps, CollapsibleProps, CollapsibleTriggerProps }+export type {+ CollapsibleChangeEventDetails,+ CollapsibleChangeEventReason,+ CollapsiblePanelProps,+ CollapsibleProps,+ CollapsibleTriggerProps,+}diff --git a/packages/dify-ui/src/combobox/index.tsx b/packages/dify-ui/src/combobox/index.tsxindex 1aa597825b6..7949828c0cd 100644--- a/packages/dify-ui/src/combobox/index.tsx+++ b/packages/dify-ui/src/combobox/index.tsx@@ -25,8 +25,11 @@ type ComboboxProps<Item = Value,> = BaseCombobox.Root.Props<Value, Multiple, Item> &([Multiple] extends [true] ? { multiple: true } : unknown)+type ComboboxChangeEventReason = BaseCombobox.Root.ChangeEventReasontype ComboboxChangeEventDetails = BaseCombobox.Root.ChangeEventDetailstype ComboboxOpenChangeEventDetails = BaseCombobox.Root.OpenChangeEventDetails+type ComboboxHighlightEventReason = BaseCombobox.Root.HighlightEventReason+type ComboboxHighlightEventDetails = BaseCombobox.Root.HighlightEventDetailsfunction Combobox<Value, Multiple extends boolean | undefined = false, Item = Value>(props: ComboboxProps<Value, Multiple, Item>,@@ -533,6 +536,7 @@ export {export type {ComboboxActions,ComboboxChangeEventDetails,+ ComboboxChangeEventReason,ComboboxChipProps,ComboboxChipRemoveProps,ComboboxChipsProps,@@ -541,6 +545,8 @@ export type {ComboboxEmptyProps,ComboboxGroupLabelProps,ComboboxGroupProps,+ ComboboxHighlightEventDetails,+ ComboboxHighlightEventReason,ComboboxIconProps,ComboboxInputGroupProps,ComboboxInputProps,diff --git a/packages/dify-ui/src/context-menu/index.tsx b/packages/dify-ui/src/context-menu/index.tsxindex a5d119625ad..b17287b46e7 100644--- a/packages/dify-ui/src/context-menu/index.tsx+++ b/packages/dify-ui/src/context-menu/index.tsx@@ -23,18 +23,21 @@ const ContextMenuSub = BaseContextMenu.SubmenuRootconst ContextMenuGroup = BaseContextMenu.Grouptype ContextMenuProps = BaseContextMenu.Root.Propstype ContextMenuActions = BaseContextMenu.Root.Actions+type ContextMenuChangeEventReason = BaseContextMenu.Root.ChangeEventReason+type ContextMenuChangeEventDetails = BaseContextMenu.Root.ChangeEventDetailstype ContextMenuTriggerProps = BaseContextMenu.Trigger.Propstype ContextMenuSubProps = BaseContextMenu.SubmenuRoot.Props+type ContextMenuSubChangeEventReason = BaseContextMenu.SubmenuRoot.ChangeEventReason+type ContextMenuSubChangeEventDetails = BaseContextMenu.SubmenuRoot.ChangeEventDetailstype ContextMenuGroupProps = BaseContextMenu.Group.Props+type ContextMenuRadioGroupChangeEventReason = BaseContextMenu.RadioGroup.ChangeEventReason+type ContextMenuRadioGroupChangeEventDetails = BaseContextMenu.RadioGroup.ChangeEventDetailstype ContextMenuRadioGroupProps<Value = unknown> = Omit<BaseContextMenu.RadioGroup.Props,'defaultValue' | 'onValueChange' | 'value'> & {defaultValue?: Value- onValueChange?: (- value: Value,- eventDetails: BaseContextMenu.RadioGroup.ChangeEventDetails,- ) => void+ onValueChange?: (value: Value, eventDetails: ContextMenuRadioGroupChangeEventDetails) => voidvalue?: Value}type ContextMenuItemVariant = MenuItemVariant@@ -152,6 +155,8 @@ function ContextMenuCheckboxItem({ className, ...props }: ContextMenuCheckboxIte}type ContextMenuCheckboxItemProps = BaseContextMenu.CheckboxItem.Props+type ContextMenuCheckboxItemChangeEventReason = BaseContextMenu.CheckboxItem.ChangeEventReason+type ContextMenuCheckboxItemChangeEventDetails = BaseContextMenu.CheckboxItem.ChangeEventDetailsfunction ContextMenuCheckboxItemIndicator({className,@@ -299,6 +304,10 @@ export {export type {ContextMenuActions,+ ContextMenuChangeEventDetails,+ ContextMenuChangeEventReason,+ ContextMenuCheckboxItemChangeEventDetails,+ ContextMenuCheckboxItemChangeEventReason,ContextMenuCheckboxItemIndicatorProps,ContextMenuCheckboxItemProps,ContextMenuContentProps,@@ -307,10 +316,14 @@ export type {ContextMenuItemProps,ContextMenuLinkItemProps,ContextMenuProps,+ ContextMenuRadioGroupChangeEventDetails,+ ContextMenuRadioGroupChangeEventReason,ContextMenuRadioGroupProps,ContextMenuRadioItemIndicatorProps,ContextMenuRadioItemProps,ContextMenuSeparatorProps,+ ContextMenuSubChangeEventDetails,+ ContextMenuSubChangeEventReason,ContextMenuSubContentProps,ContextMenuSubProps,ContextMenuSubTriggerProps,diff --git a/packages/dify-ui/src/dialog/index.tsx b/packages/dify-ui/src/dialog/index.tsxindex 61b38faf723..2e2057dcdac 100644--- a/packages/dify-ui/src/dialog/index.tsx+++ b/packages/dify-ui/src/dialog/index.tsx@@ -18,6 +18,8 @@ const DialogClose = BaseDialog.Closeconst createDialogHandle = BaseDialog.createHandletype DialogActions = BaseDialog.Root.Actions+type DialogChangeEventReason = BaseDialog.Root.ChangeEventReason+type DialogChangeEventDetails = BaseDialog.Root.ChangeEventDetailstype DialogProps<Payload = unknown> = BaseDialog.Root.Props<Payload>type DialogHandle<Payload = unknown> = BaseDialog.Handle<Payload>@@ -116,6 +118,8 @@ export {export type {DialogActions,DialogBackdropProps,+ DialogChangeEventDetails,+ DialogChangeEventReason,DialogCloseProps,DialogContentProps,DialogDescriptionProps,diff --git a/packages/dify-ui/src/drawer/index.tsx b/packages/dify-ui/src/drawer/index.tsxindex fbfe86c5b61..d40338b8fae 100644--- a/packages/dify-ui/src/drawer/index.tsx+++ b/packages/dify-ui/src/drawer/index.tsx@@ -17,6 +17,10 @@ const DrawerClose = BaseDrawer.Closeconst createDrawerHandle = BaseDrawer.createHandletype DrawerActions = BaseDrawer.Root.Actions+type DrawerChangeEventReason = BaseDrawer.Root.ChangeEventReason+type DrawerChangeEventDetails = BaseDrawer.Root.ChangeEventDetails+type DrawerSnapPointChangeEventReason = BaseDrawer.Root.SnapPointChangeEventReason+type DrawerSnapPointChangeEventDetails = BaseDrawer.Root.SnapPointChangeEventDetailstype DrawerProps<Payload = unknown> = BaseDrawer.Root.Props<Payload>type DrawerHandle<Payload = unknown> = BaseDrawer.Handle<Payload>@@ -134,6 +138,8 @@ export {export type {DrawerActions,DrawerBackdropProps,+ DrawerChangeEventDetails,+ DrawerChangeEventReason,DrawerCloseProps,DrawerContentProps,DrawerDescriptionProps,@@ -144,6 +150,8 @@ export type {DrawerPortalProps,DrawerProps,DrawerProviderProps,+ DrawerSnapPointChangeEventDetails,+ DrawerSnapPointChangeEventReason,DrawerSwipeAreaProps,DrawerTitleProps,DrawerTriggerProps,diff --git a/packages/dify-ui/src/dropdown-menu/index.tsx b/packages/dify-ui/src/dropdown-menu/index.tsxindex bc7d62a8b03..ed3a1c8175c 100644--- a/packages/dify-ui/src/dropdown-menu/index.tsx+++ b/packages/dify-ui/src/dropdown-menu/index.tsx@@ -36,6 +36,10 @@ const useDropdownMenuFilter = Menu.useFiltertype DropdownMenuHandle<Payload = unknown> = Menu.Handle<Payload>type DropdownMenuActions = Menu.Root.Actions+type DropdownMenuChangeEventReason = Menu.Root.ChangeEventReason+type DropdownMenuChangeEventDetails = Menu.Root.ChangeEventDetails+type DropdownMenuHighlightEventReason = Menu.Root.HighlightEventReason+type DropdownMenuHighlightEventDetails = Menu.Root.HighlightEventDetailstype DropdownMenuProps<Payload = unknown> = Menu.Root.Props<Payload>type DropdownMenuTriggerProps<Payload = unknown> = Menu.Trigger.Props<Payload>@@ -53,8 +57,12 @@ function DropdownMenuTrigger<Payload = unknown>({}type DropdownMenuPortalProps = Menu.Portal.Propstype DropdownMenuSubProps = Menu.SubmenuRoot.Props+type DropdownMenuSubChangeEventReason = Menu.SubmenuRoot.ChangeEventReason+type DropdownMenuSubChangeEventDetails = Menu.SubmenuRoot.ChangeEventDetailstype DropdownMenuGroupProps = Menu.Group.Propstype DropdownMenuFilterProviderProps = Menu.FilterProvider.Props+type DropdownMenuFilterProviderChangeEventReason = Menu.FilterProvider.ChangeEventReason+type DropdownMenuFilterProviderChangeEventDetails = Menu.FilterProvider.ChangeEventDetailstype DropdownMenuInputGroupProps = InputGroupProps@@ -145,12 +153,14 @@ function DropdownMenuList({ className, ...props }: DropdownMenuListProps) {/>)}+type DropdownMenuRadioGroupChangeEventReason = Menu.RadioGroup.ChangeEventReason+type DropdownMenuRadioGroupChangeEventDetails = Menu.RadioGroup.ChangeEventDetailstype DropdownMenuRadioGroupProps<Value = unknown> = Omit<Menu.RadioGroup.Props,'defaultValue' | 'onValueChange' | 'value'> & {defaultValue?: Value- onValueChange?: (value: Value, eventDetails: Menu.RadioGroup.ChangeEventDetails) => void+ onValueChange?: (value: Value, eventDetails: DropdownMenuRadioGroupChangeEventDetails) => voidvalue?: Value}type DropdownMenuItemVariant = MenuItemVariant@@ -194,6 +204,8 @@ function DropdownMenuRadioItemIndicator({type DropdownMenuRadioItemIndicatorProps = Omit<Menu.RadioItemIndicator.Props, 'children'>type DropdownMenuCheckboxItemProps = Menu.CheckboxItem.Props+type DropdownMenuCheckboxItemChangeEventReason = Menu.CheckboxItem.ChangeEventReason+type DropdownMenuCheckboxItemChangeEventDetails = Menu.CheckboxItem.ChangeEventDetailsfunction DropdownMenuCheckboxItem({ className, ...props }: DropdownMenuCheckboxItemProps) {return (@@ -447,15 +459,23 @@ export {export type {DropdownMenuActions,+ DropdownMenuChangeEventDetails,+ DropdownMenuChangeEventReason,+ DropdownMenuCheckboxItemChangeEventDetails,+ DropdownMenuCheckboxItemChangeEventReason,DropdownMenuCheckboxItemIndicatorProps,DropdownMenuCheckboxItemProps,DropdownMenuClearProps,DropdownMenuContentProps,DropdownMenuEmptyProps,+ DropdownMenuFilterProviderChangeEventDetails,+ DropdownMenuFilterProviderChangeEventReason,DropdownMenuFilterProviderProps,DropdownMenuGroupLabelProps,DropdownMenuGroupProps,DropdownMenuHandle,+ DropdownMenuHighlightEventDetails,+ DropdownMenuHighlightEventReason,DropdownMenuInputGroupProps,DropdownMenuInputProps,DropdownMenuItemProps,@@ -465,10 +485,14 @@ export type {DropdownMenuPortalProps,DropdownMenuPositionerProps,DropdownMenuProps,+ DropdownMenuRadioGroupChangeEventDetails,+ DropdownMenuRadioGroupChangeEventReason,DropdownMenuRadioGroupProps,DropdownMenuRadioItemIndicatorProps,DropdownMenuRadioItemProps,DropdownMenuSeparatorProps,+ DropdownMenuSubChangeEventDetails,+ DropdownMenuSubChangeEventReason,DropdownMenuSubContentProps,DropdownMenuSubProps,DropdownMenuSubTriggerProps,diff --git a/packages/dify-ui/src/field/index.tsx b/packages/dify-ui/src/field/index.tsxindex b905cc0a45a..69c6d26947a 100644--- a/packages/dify-ui/src/field/index.tsx+++ b/packages/dify-ui/src/field/index.tsx@@ -1,14 +1,13 @@'use client'-import type { Field as BaseFieldNS } from '@base-ui/react/field'import { Field as BaseField } from '@base-ui/react/field'import { cn } from '../cn'import { formLabelClassName } from '../form-control-shared'import { resolveClassName } from '../internals/resolve-class-name'-type FieldActions = BaseFieldNS.Root.Actions+type FieldActions = BaseField.Root.Actions-type FieldProps = BaseFieldNS.Root.Props+type FieldProps = BaseField.Root.Propsfunction Field({ className, ...props }: FieldProps) {return (@@ -21,7 +20,7 @@ function Field({ className, ...props }: FieldProps) {)}-type FieldItemProps = BaseFieldNS.Item.Props+type FieldItemProps = BaseField.Item.Propsfunction FieldItem({ className, ...props }: FieldItemProps) {return (@@ -32,7 +31,7 @@ function FieldItem({ className, ...props }: FieldItemProps) {)}-type FieldLabelProps = BaseFieldNS.Label.Props+type FieldLabelProps = BaseField.Label.Propsfunction FieldLabel({ className, ...props }: FieldLabelProps) {return (@@ -43,7 +42,7 @@ function FieldLabel({ className, ...props }: FieldLabelProps) {)}-type FieldDescriptionProps = BaseFieldNS.Description.Props+type FieldDescriptionProps = BaseField.Description.Propsfunction FieldDescription({ className, ...props }: FieldDescriptionProps) {return (@@ -56,7 +55,7 @@ function FieldDescription({ className, ...props }: FieldDescriptionProps) {)}-type FieldErrorProps = BaseFieldNS.Error.Props+type FieldErrorProps = BaseField.Error.Propsfunction FieldError({ className, ...props }: FieldErrorProps) {return (@@ -69,7 +68,7 @@ function FieldError({ className, ...props }: FieldErrorProps) {)}-type FieldValidityProps = BaseFieldNS.Validity.Props+type FieldValidityProps = BaseField.Validity.Propsconst FieldValidity = BaseField.Validitydiff --git a/packages/dify-ui/src/fieldset/index.tsx b/packages/dify-ui/src/fieldset/index.tsxindex 8a6acdfadb7..c981acf81cf 100644--- a/packages/dify-ui/src/fieldset/index.tsx+++ b/packages/dify-ui/src/fieldset/index.tsx@@ -1,11 +1,10 @@'use client'-import type { Fieldset as BaseFieldsetNS } from '@base-ui/react/fieldset'import { Fieldset as BaseFieldset } from '@base-ui/react/fieldset'import { cn } from '../cn'import { resolveClassName } from '../internals/resolve-class-name'-type FieldsetProps = BaseFieldsetNS.Root.Props+type FieldsetProps = BaseFieldset.Root.Propsfunction Fieldset({ className, ...props }: FieldsetProps) {return (@@ -16,7 +15,7 @@ function Fieldset({ className, ...props }: FieldsetProps) {)}-type FieldsetLegendProps = BaseFieldsetNS.Legend.Props+type FieldsetLegendProps = BaseFieldset.Legend.Propsfunction FieldsetLegend({ className, ...props }: FieldsetLegendProps) {return (diff --git a/packages/dify-ui/src/form/index.tsx b/packages/dify-ui/src/form/index.tsxindex c5e3b07499a..19796cd6f40 100644--- a/packages/dify-ui/src/form/index.tsx+++ b/packages/dify-ui/src/form/index.tsx@@ -1,14 +1,14 @@'use client'-import type { Form as BaseFormNS } from '@base-ui/react/form'import { Form as BaseForm } from '@base-ui/react/form'const Form = BaseForm-type FormActions = BaseFormNS.Actions+type FormActions = BaseForm.Actions+type FormSubmitEventReason = BaseForm.SubmitEventReason+type FormSubmitEventDetails = BaseForm.SubmitEventDetails-type FormProps<FormValues extends BaseFormNS.Values = BaseFormNS.Values> =- BaseFormNS.Props<FormValues>+type FormProps<FormValues extends BaseForm.Values = BaseForm.Values> = BaseForm.Props<FormValues>export { Form }-export type { FormActions, FormProps }+export type { FormActions, FormProps, FormSubmitEventDetails, FormSubmitEventReason }diff --git a/packages/dify-ui/src/icon-button/index.tsx b/packages/dify-ui/src/icon-button/index.tsxindex 95279b6ae55..959bab9f2f0 100644--- a/packages/dify-ui/src/icon-button/index.tsx+++ b/packages/dify-ui/src/icon-button/index.tsx@@ -1,6 +1,5 @@'use client'-import type { Button as BaseButtonNS } from '@base-ui/react/button'import type { VariantProps } from 'class-variance-authority'import type * as React from 'react'import { Button as BaseButton } from '@base-ui/react/button'@@ -18,7 +17,7 @@ type AccessibleName ='aria-labelledby': string}-type IconButtonProps = Omit<BaseButtonNS.Props, 'aria-label' | 'aria-labelledby' | 'children'> &+type IconButtonProps = Omit<BaseButton.Props, 'aria-label' | 'aria-labelledby' | 'children'> &AccessibleName &VariantProps<typeof iconButtonVariants> & {children: React.ReactElementdiff --git a/packages/dify-ui/src/infotip/index.tsx b/packages/dify-ui/src/infotip/index.tsxindex 706a256e780..9991a876b40 100644--- a/packages/dify-ui/src/infotip/index.tsx+++ b/packages/dify-ui/src/infotip/index.tsx@@ -24,6 +24,8 @@ const iconSizeClassNames = {const Infotip = BasePopover.Rootconst InfotipTitle = BasePopover.Titletype InfotipActions = BasePopover.Root.Actions+type InfotipChangeEventReason = BasePopover.Root.ChangeEventReason+type InfotipChangeEventDetails = BasePopover.Root.ChangeEventDetailstype InfotipProps<Payload = unknown> = BasePopover.Root.Props<Payload>type InfotipTitleProps = BasePopover.Title.Props@@ -110,6 +112,8 @@ function InfotipContent({export { Infotip, InfotipContent, InfotipTitle, InfotipTrigger }export type {InfotipActions,+ InfotipChangeEventDetails,+ InfotipChangeEventReason,InfotipContentProps,InfotipProps,InfotipTitleProps,diff --git a/packages/dify-ui/src/input-group/index.tsx b/packages/dify-ui/src/input-group/index.tsxindex d125f4cb507..bc1461c7c95 100644--- a/packages/dify-ui/src/input-group/index.tsx+++ b/packages/dify-ui/src/input-group/index.tsx@@ -1,6 +1,5 @@'use client'-import type { Input as BaseInputNS } from '@base-ui/react/input'import type { VariantProps } from 'class-variance-authority'import type * as React from 'react'import { Input as BaseInput } from '@base-ui/react/input'@@ -56,7 +55,7 @@ function InputGroup({ className, onMouseDown, ...props }: InputGroupProps) {)}-type InputGroupInputProps = Omit<BaseInputNS.Props, 'render' | 'size'>+type InputGroupInputProps = Omit<BaseInput.Props, 'render' | 'size'>function InputGroupInput({ className, ...props }: InputGroupInputProps) {return (diff --git a/packages/dify-ui/src/input/index.tsx b/packages/dify-ui/src/input/index.tsxindex f8995116ed0..cfd311ec82b 100644--- a/packages/dify-ui/src/input/index.tsx+++ b/packages/dify-ui/src/input/index.tsx@@ -1,12 +1,13 @@'use client'-import type { Input as BaseInputNS } from '@base-ui/react/input'import { Input as BaseInput } from '@base-ui/react/input'import { cn } from '../cn'import { textControlClassName } from '../form-control-shared'import { resolveClassName } from '../internals/resolve-class-name'-type InputProps = Omit<BaseInputNS.Props, 'size'>+type InputProps = Omit<BaseInput.Props, 'size'>+type InputChangeEventReason = BaseInput.ChangeEventReason+type InputChangeEventDetails = BaseInput.ChangeEventDetailsfunction Input({ className, ...props }: InputProps) {return (@@ -24,4 +25,4 @@ function Input({ className, ...props }: InputProps) {}export { Input }-export type { InputProps }+export type { InputChangeEventDetails, InputChangeEventReason, InputProps }diff --git a/packages/dify-ui/src/merge-props.ts b/packages/dify-ui/src/merge-props.tsnew file mode 100644index 00000000000..c6f694d37f2--- /dev/null+++ b/packages/dify-ui/src/merge-props.ts@@ -0,0 +1 @@+export { mergeProps } from '@base-ui/react/merge-props'diff --git a/packages/dify-ui/src/number-field/index.tsx b/packages/dify-ui/src/number-field/index.tsxindex f74905824b6..db5093ba91e 100644--- a/packages/dify-ui/src/number-field/index.tsx+++ b/packages/dify-ui/src/number-field/index.tsx@@ -10,6 +10,10 @@ import { resolveClassName } from '../internals/resolve-class-name'const NumberField = BaseNumberField.Roottype NumberFieldProps = BaseNumberField.Root.Props+type NumberFieldChangeEventReason = BaseNumberField.Root.ChangeEventReason+type NumberFieldChangeEventDetails = BaseNumberField.Root.ChangeEventDetails+type NumberFieldCommitEventReason = BaseNumberField.Root.CommitEventReason+type NumberFieldCommitEventDetails = BaseNumberField.Root.CommitEventDetailsconst numberFieldGroupVariants = cva([textControlGroupClassName, 'group/number-field items-stretch overflow-hidden'],@@ -226,6 +230,10 @@ export {NumberFieldUnit,}export type {+ NumberFieldChangeEventDetails,+ NumberFieldChangeEventReason,+ NumberFieldCommitEventDetails,+ NumberFieldCommitEventReason,NumberFieldControlsProps,NumberFieldDecrementProps,NumberFieldGroupProps,diff --git a/packages/dify-ui/src/pagination/index.tsx b/packages/dify-ui/src/pagination/index.tsxindex 9245cdec8ec..f651674fe67 100644--- a/packages/dify-ui/src/pagination/index.tsx+++ b/packages/dify-ui/src/pagination/index.tsx@@ -1,6 +1,5 @@'use client'-import type { Button as BaseButtonNS } from '@base-ui/react/button'import { Button as BaseButton } from '@base-ui/react/button'import { mergeProps } from '@base-ui/react/merge-props'import { useRender } from '@base-ui/react/use-render'@@ -210,11 +209,11 @@ function PaginationNavigation({ render, className, ...props }: PaginationNavigat})}-type PaginationPreviousProps = Omit<BaseButtonNS.Props, 'children'> & {+type PaginationPreviousProps = Omit<BaseButton.Props, 'children'> & {children?: React.ReactNode}-type PaginationNextProps = Omit<BaseButtonNS.Props, 'children'> & {+type PaginationNextProps = Omit<BaseButton.Props, 'children'> & {children?: React.ReactNode}@@ -296,7 +295,7 @@ function PaginationNext({)}-type PaginationPageJumpProps = Omit<BaseButtonNS.Props, 'children'> & {+type PaginationPageJumpProps = Omit<BaseButton.Props, 'children'> & {inputLabel?: stringchildren?: React.ReactNode}@@ -437,7 +436,7 @@ function PaginationPageList({ render, className, ...props }: PaginationPageListP})}-type PaginationPageProps = Omit<BaseButtonNS.Props, 'children'> & {+type PaginationPageProps = Omit<BaseButton.Props, 'children'> & {page: numberchildren?: React.ReactNode}diff --git a/packages/dify-ui/src/popover/index.tsx b/packages/dify-ui/src/popover/index.tsxindex 34c78011d4d..81f4aa70c21 100644--- a/packages/dify-ui/src/popover/index.tsx+++ b/packages/dify-ui/src/popover/index.tsx@@ -14,11 +14,15 @@ const PopoverPortal = BasePopover.Portalconst PopoverClose = BasePopover.Closeconst PopoverTitle = BasePopover.Titleconst PopoverDescription = BasePopover.Description+// Transition container for one popup shared by several triggers; unstyled passthrough.+const PopoverViewport = BasePopover.Viewportconst createPopoverHandle = BasePopover.createHandletype PopoverActions = BasePopover.Root.Actionstype PopoverProps<Payload = unknown> = BasePopover.Root.Props<Payload>+type PopoverChangeEventReason = BasePopover.Root.ChangeEventReason+type PopoverChangeEventDetails = BasePopover.Root.ChangeEventDetailstype PopoverArrowProps = BasePopover.Arrow.Propstype PopoverPortalProps = BasePopover.Portal.Propstype PopoverHandle<Payload = unknown> = BasePopover.Handle<Payload>@@ -35,6 +39,7 @@ function PopoverTrigger<Payload = unknown>({ className, ...props }: PopoverTriggtype PopoverCloseProps = BasePopover.Close.Propstype PopoverTitleProps = BasePopover.Title.Propstype PopoverDescriptionProps = BasePopover.Description.Props+type PopoverViewportProps = BasePopover.Viewport.Propstype PopoverBackdropProps = BasePopover.Backdrop.Props@@ -134,11 +139,14 @@ export {PopoverPositioner,PopoverTitle,PopoverTrigger,+ PopoverViewport,}export type {PopoverActions,PopoverArrowProps,PopoverBackdropProps,+ PopoverChangeEventDetails,+ PopoverChangeEventReason,PopoverCloseProps,PopoverContentProps,PopoverDescriptionProps,@@ -149,4 +157,5 @@ export type {PopoverProps,PopoverTitleProps,PopoverTriggerProps,+ PopoverViewportProps,}diff --git a/packages/dify-ui/src/preview-card/index.tsx b/packages/dify-ui/src/preview-card/index.tsxindex 8446592efb5..85cadd098b8 100644--- a/packages/dify-ui/src/preview-card/index.tsx+++ b/packages/dify-ui/src/preview-card/index.tsx@@ -27,6 +27,8 @@ const PreviewCardViewport = BasePreviewCard.Viewportconst createPreviewCardHandle = BasePreviewCard.createHandletype PreviewCardActions = BasePreviewCard.Root.Actions+type PreviewCardChangeEventReason = BasePreviewCard.Root.ChangeEventReason+type PreviewCardChangeEventDetails = BasePreviewCard.Root.ChangeEventDetailstype PreviewCardProps<Payload = unknown> = BasePreviewCard.Root.Props<Payload>type PreviewCardHandle<Payload = unknown> = BasePreviewCard.Handle<Payload>@@ -118,6 +120,8 @@ export {}export type {PreviewCardActions,+ PreviewCardChangeEventDetails,+ PreviewCardChangeEventReason,PreviewCardContentProps,PreviewCardHandle,PreviewCardPopupProps,diff --git a/packages/dify-ui/src/radio-group/index.tsx b/packages/dify-ui/src/radio-group/index.tsxindex 016f257ebf9..f9142e502f2 100644--- a/packages/dify-ui/src/radio-group/index.tsx+++ b/packages/dify-ui/src/radio-group/index.tsx@@ -1,7 +1,5 @@'use client'-import type { Radio as BaseRadioNS } from '@base-ui/react/radio'-import type { RadioGroup as BaseRadioGroupNS } from '@base-ui/react/radio-group'import type * as React from 'react'import { Radio as BaseRadio } from '@base-ui/react/radio'import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group'@@ -9,7 +7,9 @@ import { cn } from '../cn'import { checkedControlFocusClassName } from '../form-control-shared'import { resolveClassName } from '../internals/resolve-class-name'-type RadioGroupProps<Value = string> = BaseRadioGroupNS.Props<Value>+type RadioGroupProps<Value = string> = BaseRadioGroup.Props<Value>+type RadioGroupChangeEventReason = BaseRadioGroup.ChangeEventReason+type RadioGroupChangeEventDetails = BaseRadioGroup.ChangeEventDetailsfunction RadioGroup<Value = string>({ className, ...props }: RadioGroupProps<Value>) {return (@@ -20,13 +20,13 @@ function RadioGroup<Value = string>({ className, ...props }: RadioGroupProps<Val)}-type RadioItemProps<Value = string> = BaseRadioNS.Root.Props<Value>+type RadioItemProps<Value = string> = BaseRadio.Root.Props<Value>function RadioItem<Value = string>({ className, ...props }: RadioItemProps<Value>) {return <BaseRadio.Root<Value> className={className} {...props} />}-type RadioControlProps = Omit<BaseRadioNS.Indicator.Props, 'children' | 'keepMounted'>+type RadioControlProps = Omit<BaseRadio.Indicator.Props, 'children' | 'keepMounted'>function RadioControl({ className, ...props }: RadioControlProps) {return (@@ -87,4 +87,12 @@ function RadioSkeleton({ className, ...props }: RadioSkeletonProps) {export { Radio, RadioControl, RadioGroup, RadioItem, RadioSkeleton }-export type { RadioControlProps, RadioGroupProps, RadioItemProps, RadioProps, RadioSkeletonProps }+export type {+ RadioControlProps,+ RadioGroupChangeEventDetails,+ RadioGroupChangeEventReason,+ RadioGroupProps,+ RadioItemProps,+ RadioProps,+ RadioSkeletonProps,+}diff --git a/packages/dify-ui/src/segmented-control/index.tsx b/packages/dify-ui/src/segmented-control/index.tsxindex 0f03a421a95..8be49b90b4a 100644--- a/packages/dify-ui/src/segmented-control/index.tsx+++ b/packages/dify-ui/src/segmented-control/index.tsx@@ -1,7 +1,5 @@'use client'-import type { Radio as BaseRadioNS } from '@base-ui/react/radio'-import type { RadioGroup as BaseRadioGroupNS } from '@base-ui/react/radio-group'import type * as React from 'react'import { Radio as BaseRadio } from '@base-ui/react/radio'import { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group'@@ -19,7 +17,7 @@ type SegmentedControlSelectionProps<Value> =}type SegmentedControlProps<Value = string> = Omit<- BaseRadioGroupNS.Props<Value>,+ BaseRadioGroup.Props<Value>,'defaultValue' | 'value'> &SegmentedControlSelectionProps<Value>@@ -38,7 +36,7 @@ function SegmentedControl<Value = string>({ className, ...props }: SegmentedCont)}-type SegmentedControlItemProps<Value = string> = BaseRadioNS.Root.Props<Value>+type SegmentedControlItemProps<Value = string> = BaseRadio.Root.Props<Value>function SegmentedControlItem<Value = string>({className,diff --git a/packages/dify-ui/src/select/index.tsx b/packages/dify-ui/src/select/index.tsxindex 998bda89b22..43f9a47f9c9 100644--- a/packages/dify-ui/src/select/index.tsx+++ b/packages/dify-ui/src/select/index.tsx@@ -18,6 +18,7 @@ import {import { parsePlacement } from '../placement'type SelectActions = BaseSelect.Root.Actions+type SelectChangeEventReason = BaseSelect.Root.ChangeEventReasontype SelectChangeEventDetails = BaseSelect.Root.ChangeEventDetailstype SelectOpenChangeEventDetails = BaseSelect.Root.OpenChangeEventDetails@@ -298,6 +299,7 @@ export {export type {SelectActions,SelectChangeEventDetails,+ SelectChangeEventReason,SelectContentProps,SelectGroupLabelProps,SelectGroupProps,diff --git a/packages/dify-ui/src/slider/index.tsx b/packages/dify-ui/src/slider/index.tsxindex 53730e26ee3..bef3af03fbc 100644--- a/packages/dify-ui/src/slider/index.tsx+++ b/packages/dify-ui/src/slider/index.tsx@@ -7,6 +7,10 @@ import { resolveClassName } from '../internals/resolve-class-name'type SliderRootValue = NonNullable<BaseSlider.Root.Props['value']>type SliderProps<Value extends SliderRootValue = SliderRootValue> = BaseSlider.Root.Props<Value>+type SliderChangeEventReason = BaseSlider.Root.ChangeEventReason+type SliderChangeEventDetails = BaseSlider.Root.ChangeEventDetails+type SliderCommitEventReason = BaseSlider.Root.CommitEventReason+type SliderCommitEventDetails = BaseSlider.Root.CommitEventDetailsfunction Slider<Value extends SliderRootValue = SliderRootValue>({className,@@ -123,6 +127,10 @@ export {}export type {+ SliderChangeEventDetails,+ SliderChangeEventReason,+ SliderCommitEventDetails,+ SliderCommitEventReason,SliderControlProps,SliderIndicatorProps,SliderLabelProps,diff --git a/packages/dify-ui/src/switch/index.tsx b/packages/dify-ui/src/switch/index.tsxindex f3c6ec44b2f..17218ae91c0 100644--- a/packages/dify-ui/src/switch/index.tsx+++ b/packages/dify-ui/src/switch/index.tsx@@ -1,6 +1,5 @@'use client'-import type { Switch as BaseSwitchNS } from '@base-ui/react/switch'import type { VariantProps } from 'class-variance-authority'import type * as React from 'react'import { Switch as BaseSwitch } from '@base-ui/react/switch'@@ -72,10 +71,9 @@ type UncontrolledSwitchProps = {type SwitchControlProps = ControlledSwitchProps | UncontrolledSwitchProps-type SwitchProps = Omit<- BaseSwitchNS.Root.Props,- 'checked' | 'children' | 'defaultChecked' | 'size'-> &+type SwitchChangeEventReason = BaseSwitch.Root.ChangeEventReason+type SwitchChangeEventDetails = BaseSwitch.Root.ChangeEventDetails+type SwitchProps = Omit<BaseSwitch.Root.Props, 'checked' | 'children' | 'defaultChecked' | 'size'> &VariantProps<typeof switchRootVariants> &SwitchControlProps & {loading?: boolean@@ -131,4 +129,4 @@ function SwitchSkeleton({ size = 'md', className, ...props }: SwitchSkeletonPropexport { Switch, SwitchSkeleton }-export type { SwitchProps, SwitchSkeletonProps }+export type { SwitchChangeEventDetails, SwitchChangeEventReason, SwitchProps, SwitchSkeletonProps }diff --git a/packages/dify-ui/src/tabs/index.tsx b/packages/dify-ui/src/tabs/index.tsxindex ae3d6bd6880..ed95cc8feb8 100644--- a/packages/dify-ui/src/tabs/index.tsx+++ b/packages/dify-ui/src/tabs/index.tsx@@ -1,14 +1,15 @@'use client'-import type { Tabs as BaseTabsNS } from '@base-ui/react/tabs'import { Tabs as BaseTabs } from '@base-ui/react/tabs'import { cn } from '../cn'import { resolveClassName } from '../internals/resolve-class-name'-type TabsProps = BaseTabsNS.Root.Props+type TabsProps = BaseTabs.Root.Props+type TabsChangeEventReason = BaseTabs.Root.ChangeEventReason+type TabsChangeEventDetails = BaseTabs.Root.ChangeEventDetailsconst Tabs = BaseTabs.Root-type TabsListProps = BaseTabsNS.List.Props+type TabsListProps = BaseTabs.List.Propsfunction TabsList({ className, ...props }: TabsListProps) {return (@@ -19,7 +20,7 @@ function TabsList({ className, ...props }: TabsListProps) {)}-type TabsTabProps = BaseTabsNS.Tab.Props+type TabsTabProps = BaseTabs.Tab.Propsfunction TabsTab({ className, ...props }: TabsTabProps) {return (@@ -35,7 +36,7 @@ function TabsTab({ className, ...props }: TabsTabProps) {)}-type TabsPanelProps = BaseTabsNS.Panel.Props+type TabsPanelProps = BaseTabs.Panel.Propsfunction TabsPanel({ className, ...props }: TabsPanelProps) {return (@@ -52,8 +53,16 @@ function TabsPanel({ className, ...props }: TabsPanelProps) {}const TabsIndicator = BaseTabs.Indicator-type TabsIndicatorProps = BaseTabsNS.Indicator.Props+type TabsIndicatorProps = BaseTabs.Indicator.Propsexport { Tabs, TabsIndicator, TabsList, TabsPanel, TabsTab }-export type { TabsIndicatorProps, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps }+export type {+ TabsChangeEventDetails,+ TabsChangeEventReason,+ TabsIndicatorProps,+ TabsListProps,+ TabsPanelProps,+ TabsProps,+ TabsTabProps,+}diff --git a/packages/dify-ui/src/textarea/index.tsx b/packages/dify-ui/src/textarea/index.tsxindex 5c93e51d7f4..b4b3b2704dc 100644--- a/packages/dify-ui/src/textarea/index.tsx+++ b/packages/dify-ui/src/textarea/index.tsx@@ -1,6 +1,5 @@'use client'-import type { Field as BaseFieldNS } from '@base-ui/react/field'import type { VariantProps } from 'class-variance-authority'import type * as React from 'react'import { Field as BaseField } from '@base-ui/react/field'@@ -23,7 +22,7 @@ const textareaVariants = cva([textControlClassName, 'min-h-20 overflow-auto'], {})type TextareaValue = string | number-type TextareaChangeEventDetails = BaseFieldNS.Control.ChangeEventDetails+type TextareaChangeEventDetails = BaseField.Control.ChangeEventDetailstype TextareaOnValueChange = (value: string, eventDetails: TextareaChangeEventDetails) => voidtype ControlledTextareaProps = {@@ -57,12 +56,12 @@ type TextareaElementProps = Omit<type TextareaControlProps = ControlledTextareaProps | UncontrolledTextareaPropstype TextareaVariantProps = VariantProps<typeof textareaVariants>type FieldControlTextareaProps = Omit<- BaseFieldNS.Control.Props,+ BaseField.Control.Props,'className' | 'defaultValue' | 'onValueChange' | 'render' | 'value'>type TextareaProps = TextareaElementProps &- Pick<BaseFieldNS.Control.Props, 'className' | 'style'> &+ Pick<BaseField.Control.Props, 'className' | 'style'> &TextareaOnlyProps &TextareaControlProps &TextareaVariantProps & {diff --git a/packages/dify-ui/src/toggle/index.tsx b/packages/dify-ui/src/toggle/index.tsxindex 65196a44708..75494b0bb60 100644--- a/packages/dify-ui/src/toggle/index.tsx+++ b/packages/dify-ui/src/toggle/index.tsx@@ -1,12 +1,13 @@'use client'-import type { Toggle as BaseToggleNS } from '@base-ui/react/toggle'import { Toggle as BaseToggle } from '@base-ui/react/toggle'-type ToggleProps<Value extends string = string> = BaseToggleNS.Props<Value>+type ToggleProps<Value extends string = string> = BaseToggle.Props<Value>+type ToggleChangeEventReason = BaseToggle.ChangeEventReason+type ToggleChangeEventDetails = BaseToggle.ChangeEventDetailsconst Toggle = BaseToggleexport { Toggle }-export type { ToggleProps }+export type { ToggleChangeEventDetails, ToggleChangeEventReason, ToggleProps }diff --git a/packages/dify-ui/src/tooltip/index.tsx b/packages/dify-ui/src/tooltip/index.tsxindex b19d3f3c1c3..3f2d97537ec 100644--- a/packages/dify-ui/src/tooltip/index.tsx+++ b/packages/dify-ui/src/tooltip/index.tsx@@ -14,6 +14,8 @@ const TooltipTrigger = BaseTooltip.Triggertype TooltipProviderProps = BaseTooltip.Provider.Propstype TooltipActions = BaseTooltip.Root.Actions+type TooltipChangeEventReason = BaseTooltip.Root.ChangeEventReason+type TooltipChangeEventDetails = BaseTooltip.Root.ChangeEventDetailstype TooltipProps<Payload = unknown> = BaseTooltip.Root.Props<Payload>type TooltipTriggerProps<Payload = unknown> = BaseTooltip.Trigger.Props<Payload>@@ -58,6 +60,8 @@ export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }export type {TooltipActions,+ TooltipChangeEventDetails,+ TooltipChangeEventReason,TooltipContentProps,TooltipProps,TooltipProviderProps,diff --git a/packages/dify-ui/src/use-render.ts b/packages/dify-ui/src/use-render.tsnew file mode 100644index 00000000000..9b5f19bdbd6--- /dev/null+++ b/packages/dify-ui/src/use-render.ts@@ -0,0 +1,3 @@+'use client'++export { useRender } from '@base-ui/react/use-render'diff --git a/web/app/components/app/app-publisher/publisher-content/publisher-panel/index.tsx b/web/app/components/app/app-publisher/publisher-content/publisher-panel/index.tsxindex 07003c91b09..3d82fbe2f58 100644--- a/web/app/components/app/app-publisher/publisher-content/publisher-panel/index.tsx+++ b/web/app/components/app/app-publisher/publisher-content/publisher-panel/index.tsx@@ -1,4 +1,4 @@-import type { PopoverProps } from '@langgenius/dify-ui/popover'+import type { PopoverChangeEventDetails } from '@langgenius/dify-ui/popover'import type { ComponentProps } from 'react'import type { AppPublisherProps } from '../../types'import { Button } from '@langgenius/dify-ui/button'@@ -36,7 +36,7 @@ export function PublisherPanel({const popupRef = useRef<HTMLDivElement>(null)const { t } = useTranslation(['workflow'])const [deploymentConfigurationOpen, setDeploymentConfigurationOpen] = useState(false)- const handleOpenChange: NonNullable<PopoverProps['onOpenChange']> = (nextOpen, eventDetails) => {+ const handleOpenChange = (nextOpen: boolean, eventDetails: PopoverChangeEventDetails) => {const isOutsideDismiss =eventDetails.reason === 'outside-press' || eventDetails.reason === 'focus-out'if (!nextOpen && deploymentConfigurationOpen && isOutsideDismiss) {diff --git a/web/app/components/datasets/hit-testing/components/chunk-detail-dialog.tsx b/web/app/components/datasets/hit-testing/components/chunk-detail-dialog.tsxindex aa86955c05b..ea26284cc93 100644--- a/web/app/components/datasets/hit-testing/components/chunk-detail-dialog.tsx+++ b/web/app/components/datasets/hit-testing/components/chunk-detail-dialog.tsx@@ -1,5 +1,5 @@'use client'-import type { DialogProps } from '@langgenius/dify-ui/dialog'+import type { DialogChangeEventDetails } from '@langgenius/dify-ui/dialog'import type { FileAppearanceTypeEnum } from '@/app/components/base/file-uploader/types'import type { HitTesting } from '@/models/datasets'import { cn } from '@langgenius/dify-ui/cn'@@ -31,7 +31,7 @@ const i18nPrefix = ''type ChunkDetailDialogProps = {payload: HitTestingopen: boolean- onOpenChange: DialogProps['onOpenChange']+ onOpenChange: (open: boolean, eventDetails: DialogChangeEventDetails) => void}export function ChunkDetailDialog({ payload, open, onOpenChange }: ChunkDetailDialogProps) {diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsxindex 8fb2b24db3c..219ef05144b 100644--- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx@@ -1,5 +1,5 @@import type { ModelType } from '@dify/contracts/api/console/workspaces/types.gen'-import type { ComponentProps } from 'react'+import type { PreviewCardHandle } from '@langgenius/dify-ui/preview-card'import type {ModelSelectorModel,ModelSelectorModelPredicate,@@ -38,8 +38,6 @@ export type ModelSelectorPreviewPayload = {modelItem: ModelSelectorModel}-type PreviewCardHandle = NonNullable<ComponentProps<typeof PreviewCardTrigger>['handle']>-type PopupItemProps = {defaultModel?: ModelSelectorValuemodel: ModelSelectorProviderdiff --git a/web/app/components/tools/workflow-tool/index.tsx b/web/app/components/tools/workflow-tool/index.tsxindex 29cddfa4d8f..9b515d5141a 100644--- a/web/app/components/tools/workflow-tool/index.tsx+++ b/web/app/components/tools/workflow-tool/index.tsx@@ -1,5 +1,4 @@'use client'-import type { DrawerProps } from '@langgenius/dify-ui/drawer'import type {Emoji,WorkflowToolOutputSource,@@ -97,8 +96,8 @@ const WorkflowToolDrawerFrame = ({onHide,children,}: WorkflowToolDrawerFrameProps) => {- const handleOpenChange = React.useCallback<NonNullable<DrawerProps['onOpenChange']>>(- (open) => {+ const handleOpenChange = React.useCallback(+ (open: boolean) => {if (!open) onHide()},[onHide],diff --git a/web/app/components/workflow/block-selector/index.tsx b/web/app/components/workflow/block-selector/index.tsxindex 204e8ee0a7b..fc76a7f505d 100644--- a/web/app/components/workflow/block-selector/index.tsx+++ b/web/app/components/workflow/block-selector/index.tsx@@ -1,8 +1,8 @@import type { RagPipelineDatasourceProviderResponse } from '@dify/contracts/api/console/rag/types.gen'import type {+ PopoverChangeEventDetails,PopoverPopupProps,PopoverPositionerProps,- PopoverProps,PopoverTriggerProps,} from '@langgenius/dify-ui/popover'import type { CSSProperties, KeyboardEvent, MouseEventHandler, Ref } from 'react'@@ -37,10 +37,7 @@ export type BlockSelectorProps = Pick<finalFocus?: PopoverPopupProps['finalFocus']triggerRef?: Ref<HTMLButtonElement>open?: boolean- onOpenChange?: (- open: boolean,- details?: Parameters<NonNullable<PopoverProps['onOpenChange']>>[1],- ) => void+ onOpenChange?: (open: boolean, details?: PopoverChangeEventDetails) => voidonSelect: OnSelectBlocktrigger?: NonNullable<PopoverTriggerProps['render']>triggerTooltip?: string@@ -98,7 +95,7 @@ function BlockSelector({const searchInputRef = useRef<HTMLInputElement>(null)const open = openFromProps === undefined ? localOpen : openFromPropsconst handleOpenChange = useCallback(- (newOpen: boolean, details?: Parameters<NonNullable<PopoverProps['onOpenChange']>>[1]) => {+ (newOpen: boolean, details?: PopoverChangeEventDetails) => {if (newOpen && disabled) returnsetLocalOpen(newOpen)diff --git a/web/app/components/workflow/nodes/_base/components/node-handle.tsx b/web/app/components/workflow/nodes/_base/components/node-handle.tsxindex 4ea57ec9268..e26dc4bd2fa 100644--- a/web/app/components/workflow/nodes/_base/components/node-handle.tsx+++ b/web/app/components/workflow/nodes/_base/components/node-handle.tsx@@ -1,5 +1,5 @@+import type { PopoverChangeEventDetails } from '@langgenius/dify-ui/popover'import type { MouseEvent } from 'react'-import type { BlockSelectorProps } from '../../../block-selector'import type { BlockDefaultValue } from '../../../block-selector/types'import type { Node } from '../../../types'import { cn } from '@langgenius/dify-ui/cn'@@ -51,14 +51,11 @@ export const NodeTargetHandle = memo()const isConnectable = !!availablePrevBlocks.length- const handleOpenChange = useCallback<NonNullable<BlockSelectorProps['onOpenChange']>>(- (v, details) => {- preserveOutsideFocusRef.current =- details?.reason === 'outside-press' || details?.reason === 'focus-out'- setOpen(v)- },- [],- )+ const handleOpenChange = useCallback((v: boolean, details?: PopoverChangeEventDetails) => {+ preserveOutsideFocusRef.current =+ details?.reason === 'outside-press' || details?.reason === 'focus-out'+ setOpen(v)+ }, [])const handleHandleClick = useCallback((e: MouseEvent) => {e.stopPropagation()@@ -181,14 +178,11 @@ export const NodeSourceHandle = memo(hasAgentV2OutputRoutes(data) ||data.type === BlockEnum.HumanInput ||data.error_strategy === ErrorHandleTypeEnum.failBranch- const handleOpenChange = useCallback<NonNullable<BlockSelectorProps['onOpenChange']>>(- (v, details) => {- preserveOutsideFocusRef.current =- details?.reason === 'outside-press' || details?.reason === 'focus-out'- setOpen(v)- },- [],- )+ const handleOpenChange = useCallback((v: boolean, details?: PopoverChangeEventDetails) => {+ preserveOutsideFocusRef.current =+ details?.reason === 'outside-press' || details?.reason === 'focus-out'+ setOpen(v)+ }, [])const handleHandleClick = useCallback((e: MouseEvent) => {e.stopPropagation()preserveOutsideFocusRef.current = false