-
Fast hover
-
- Base UI defaults (600ms / 300ms) are tuned for link previews. Override per trigger for
- denser UIs.
+function CustomDelayDemo() {
+ return (
+
+
+ Snappy trigger
+
+
+
+
Fast hover
+
+ Base UI defaults (600ms / 300ms) are tuned for link previews. Override per trigger for
+ denser UIs.
+
-
-
-
-)
+
+
+ )
+}
export const CustomDelays: Story = {
render: () =>
,
diff --git a/packages/dify-ui/src/scroll-area/__tests__/index.spec.tsx b/packages/dify-ui/src/scroll-area/__tests__/index.spec.tsx
index 4f451bb0e31..9bfa04cbed8 100644
--- a/packages/dify-ui/src/scroll-area/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/scroll-area/__tests__/index.spec.tsx
@@ -1,4 +1,4 @@
-import type * as React from 'react'
+import * as React from 'react'
import { render } from 'vitest-browser-react'
import {
ScrollArea,
@@ -105,7 +105,7 @@ describe('scroll area', () => {
it('should keep accessible region semantics on the viewport', async () => {
const screen = await render(
- <>
+
Installed apps
{
- >,
+ ,
)
const viewport = screen.getByRole('region', { name: 'Installed apps' })
diff --git a/packages/dify-ui/src/segmented-control/__tests__/index.spec.tsx b/packages/dify-ui/src/segmented-control/__tests__/index.spec.tsx
index 2e12732a9ec..2a3b5e27644 100644
--- a/packages/dify-ui/src/segmented-control/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/segmented-control/__tests__/index.spec.tsx
@@ -1,11 +1,11 @@
-import type * as React from 'react'
+import * as React from 'react'
import { userEvent } from 'vite-plus/test/browser'
import { render } from 'vitest-browser-react'
import { SegmentedControl, SegmentedControlDivider, SegmentedControlItem } from '../index'
function SegmentedControlTypeExamples() {
return (
- <>
+
value={10} onValueChange={() => {}} aria-label="Page size">
value={10}>10
value={20}>20
@@ -14,7 +14,7 @@ function SegmentedControlTypeExamples() {
One
- >
+
)
}
diff --git a/packages/dify-ui/src/segmented-control/index.stories.tsx b/packages/dify-ui/src/segmented-control/index.stories.tsx
index b8bbc174eed..d9e3ed5b8f6 100644
--- a/packages/dify-ui/src/segmented-control/index.stories.tsx
+++ b/packages/dify-ui/src/segmented-control/index.stories.tsx
@@ -30,14 +30,18 @@ type SegmentedControlProps = {
noPadding?: boolean
}
-const Icon = () =>
+function Icon() {
+ return
+}
-const Item = () => (
-
-
- Item
-
-)
+function Item() {
+ return (
+
+
+ Item
+
+ )
+}
function SegmentedControlExample({
defaultValue,
diff --git a/packages/dify-ui/src/select/index.stories.tsx b/packages/dify-ui/src/select/index.stories.tsx
index d137ae41c3a..d596732f4c4 100644
--- a/packages/dify-ui/src/select/index.stories.tsx
+++ b/packages/dify-ui/src/select/index.stories.tsx
@@ -298,7 +298,7 @@ export const ReadOnly: Story = {
),
}
-const ControlledDemo = () => {
+function ControlledDemo() {
const [value, setValue] = React.useState
('balanced')
return (
@@ -336,7 +336,7 @@ export const Controlled: Story = {
render: () => ,
}
-const MultipleControlledDemo = () => {
+function MultipleControlledDemo() {
const [value, setValue] = React.useState(['us-east', 'eu-west'])
return (
diff --git a/packages/dify-ui/src/status-dot/__tests__/index.spec.tsx b/packages/dify-ui/src/status-dot/__tests__/index.spec.tsx
index 63473337a16..967931c8453 100644
--- a/packages/dify-ui/src/status-dot/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/status-dot/__tests__/index.spec.tsx
@@ -1,13 +1,14 @@
+import * as React from 'react'
import { render } from 'vitest-browser-react'
import { StatusDot, StatusDotSkeleton } from '../index'
describe('StatusDot', () => {
it('hides the visual indicator and its loading placeholder from assistive technology', async () => {
const screen = await render(
- <>
+
- >,
+ ,
)
await expect.element(screen.getByTestId('dot')).toHaveAttribute('aria-hidden', 'true')
@@ -16,14 +17,14 @@ describe('StatusDot', () => {
it('does not allow consumers to override the decorative contract', async () => {
const screen = await render(
- <>
+
{/* @ts-expect-error StatusDot is always decorative */}
{/* @ts-expect-error Status semantics belong to the surrounding component */}
{/* @ts-expect-error StatusDotSkeleton is always decorative */}
- >,
+ ,
)
await expect.element(screen.getByTestId('dot')).toHaveAttribute('aria-hidden', 'true')
diff --git a/packages/dify-ui/src/switch/__tests__/types.tsx b/packages/dify-ui/src/switch/__tests__/types.tsx
index d18e14c2588..3575d67fd53 100644
--- a/packages/dify-ui/src/switch/__tests__/types.tsx
+++ b/packages/dify-ui/src/switch/__tests__/types.tsx
@@ -1,5 +1,6 @@
import type { SwitchProps } from '@langgenius/dify-ui/switch'
import { Switch } from '@langgenius/dify-ui/switch'
+import * as React from 'react'
function SwitchTypeExamples() {
const onCheckedChange: NonNullable = (checked, details) => {
@@ -7,12 +8,12 @@ function SwitchTypeExamples() {
}
return (
- <>
+
void checked} />
{/* @ts-expect-error the composite owns its thumb and loading indicator */}
Custom thumb
- >
+
)
}
diff --git a/packages/dify-ui/src/switch/index.stories.tsx b/packages/dify-ui/src/switch/index.stories.tsx
index afee0f88d1e..f84263db04f 100644
--- a/packages/dify-ui/src/switch/index.stories.tsx
+++ b/packages/dify-ui/src/switch/index.stories.tsx
@@ -50,7 +50,7 @@ type SwitchDemoProps = Partial<
checked?: boolean
}
-const SwitchDemo = (args: SwitchDemoProps) => {
+function SwitchDemo(args: SwitchDemoProps) {
const [enabled, setEnabled] = React.useState(args.checked ?? false)
return (
@@ -113,7 +113,7 @@ export const DisabledOn: Story = {
},
}
-const AllStatesDemo = () => {
+function AllStatesDemo() {
const sizes = ['xs', 'sm', 'md', 'lg'] as const
return (
@@ -202,7 +202,7 @@ export const AllStates: Story = {
},
}
-const SizeComparisonDemo = () => {
+function SizeComparisonDemo() {
const [states, setStates] = React.useState({
xs: false,
sm: false,
@@ -260,7 +260,7 @@ export const SizeComparison: Story = {
render: () => ,
}
-const LoadingDemo = () => {
+function LoadingDemo() {
const [loading, setLoading] = React.useState(true)
return (
@@ -362,7 +362,7 @@ function useMockUpdateAutoRetrySettingMutation({
}
}
-const MutationLoadingDemo = () => {
+function MutationLoadingDemo() {
const autoRetrySetting = useMockAutoRetrySettingQuery()
const updateAutoRetrySetting = useMockUpdateAutoRetrySettingMutation({
onSuccess: autoRetrySetting.setData,
@@ -406,26 +406,28 @@ export const MutationLoadingGuard: Story = {
},
}
-const SkeletonDemo = () => (
-
-
-
-
Extra Small skeleton
+function SkeletonDemo() {
+ return (
+
+
+
+ Extra Small skeleton
+
+
+
+ Small skeleton
+
+
+
+ Regular skeleton
+
+
+
+ Large skeleton
+
-
-
- Small skeleton
-
-
-
- Regular skeleton
-
-
-
- Large skeleton
-
-
-)
+ )
+}
export const Skeleton: Story = {
render: () =>
,
diff --git a/packages/dify-ui/src/textarea/index.stories.tsx b/packages/dify-ui/src/textarea/index.stories.tsx
index 98e21a18af6..65c198f6a1e 100644
--- a/packages/dify-ui/src/textarea/index.stories.tsx
+++ b/packages/dify-ui/src/textarea/index.stories.tsx
@@ -110,7 +110,7 @@ export const States: Story = {
),
}
-const FormDemo = () => {
+function FormDemo() {
const [savedDescription, setSavedDescription] = React.useState
(null)
return (
@@ -153,7 +153,7 @@ export const WithField: Story = {
render: () => ,
}
-const ControlledDemo = () => {
+function ControlledDemo() {
const [value, setValue] = React.useState(
'Summarize customer feedback into actionable product themes.',
)
@@ -180,7 +180,7 @@ export const Controlled: Story = {
),
}
-const CharacterCounterDemo = () => {
+function CharacterCounterDemo() {
const maxLength = 120
const [value, setValue] = React.useState(
'Summarize customer feedback into actionable product themes.',
diff --git a/packages/dify-ui/src/toast/__tests__/index.spec.tsx b/packages/dify-ui/src/toast/__tests__/index.spec.tsx
index f4b18dd7058..9cf5de8b106 100644
--- a/packages/dify-ui/src/toast/__tests__/index.spec.tsx
+++ b/packages/dify-ui/src/toast/__tests__/index.spec.tsx
@@ -1,4 +1,5 @@
import type { ToastManager, ToastViewportProps } from '../index'
+import * as React from 'react'
import { userEvent } from 'vite-plus/test/browser'
import { render } from 'vitest-browser-react'
import {
@@ -88,7 +89,7 @@ describe('@langgenius/dify-ui/toast', () => {
it('should not intercept pointer events below a collapsed top-anchored stack', async () => {
const screen = await render(
- <>
+
- >,
+ ,
)
toast('Older notification')
@@ -134,7 +135,7 @@ describe('@langgenius/dify-ui/toast', () => {
try {
const screen = await render(
- <>
+