@fibrae/semi-ui-svelte 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/README.zh-CN.md +8 -4
- package/dist/components/anchor/interface.d.ts +14 -0
- package/dist/components/audio-player/interface.d.ts +5 -0
- package/dist/components/auto-complete/interface.d.ts +29 -0
- package/dist/components/avatar/interface.d.ts +24 -0
- package/dist/components/backtop/interface.d.ts +2 -0
- package/dist/components/badge/interface.d.ts +7 -0
- package/dist/components/banner/interface.d.ts +7 -0
- package/dist/components/breadcrumb/interface.d.ts +10 -0
- package/dist/components/button/interface.d.ts +18 -0
- package/dist/components/calendar/interface.d.ts +16 -0
- package/dist/components/card/interface.d.ts +18 -0
- package/dist/components/carousel/interface.d.ts +16 -0
- package/dist/components/cascader/cascader.svelte +1 -0
- package/dist/components/cascader/interface.d.ts +57 -0
- package/dist/components/checkbox/interface.d.ts +19 -0
- package/dist/components/code-highlight/interface.d.ts +3 -0
- package/dist/components/collapse/interface.d.ts +16 -0
- package/dist/components/collapsible/interface.d.ts +10 -0
- package/dist/components/color-picker/interface.d.ts +10 -0
- package/dist/components/config-provider/interface.d.ts +7 -0
- package/dist/components/cropper/interface.d.ts +11 -0
- package/dist/components/date-picker/interface.d.ts +47 -0
- package/dist/components/descriptions/interface.d.ts +6 -0
- package/dist/components/divider/interface.d.ts +4 -0
- package/dist/components/dropdown/interface.d.ts +8 -0
- package/dist/components/empty/interface.d.ts +7 -0
- package/dist/components/feedback/interface.d.ts +16 -0
- package/dist/components/float-button/interface.d.ts +14 -0
- package/dist/components/form/interface.d.ts +47 -0
- package/dist/components/form/label.svelte +2 -2
- package/dist/components/grid/interface.d.ts +13 -0
- package/dist/components/highlight/interface.d.ts +7 -0
- package/dist/components/hot-keys/interface.d.ts +3 -0
- package/dist/components/image/interface.d.ts +59 -0
- package/dist/components/input/interface.d.ts +67 -0
- package/dist/components/input-number/interface.d.ts +24 -0
- package/dist/components/json-viewer/interface.d.ts +7 -0
- package/dist/components/layout/interface.d.ts +3 -0
- package/dist/components/list/interface.d.ts +18 -0
- package/dist/components/locale/interface.d.ts +4 -0
- package/dist/components/lottie/interface.d.ts +2 -0
- package/dist/components/markdown-render/interface.d.ts +5 -0
- package/dist/components/modal/interface.d.ts +29 -0
- package/dist/components/navigation/interface.d.ts +47 -0
- package/dist/components/overflow-list/interface.d.ts +11 -0
- package/dist/components/pagination/interface.d.ts +12 -0
- package/dist/components/pincode/interface.d.ts +8 -0
- package/dist/components/popconfirm/interface.d.ts +12 -0
- package/dist/components/popover/interface.d.ts +30 -0
- package/dist/components/progress/interface.d.ts +13 -0
- package/dist/components/radio/interface.d.ts +22 -0
- package/dist/components/rating/interface.d.ts +12 -0
- package/dist/components/resizable/interface.d.ts +30 -0
- package/dist/components/scroll-list/interface.d.ts +6 -0
- package/dist/components/select/interface.d.ts +63 -0
- package/dist/components/side-sheet/interface.d.ts +19 -0
- package/dist/components/skeleton/interface.d.ts +7 -0
- package/dist/components/slider/interface.d.ts +23 -0
- package/dist/components/space/interface.d.ts +4 -0
- package/dist/components/spin/interface.d.ts +7 -0
- package/dist/components/steps/interface.d.ts +9 -0
- package/dist/components/switch/interface.d.ts +7 -0
- package/dist/components/table/interface.d.ts +48 -0
- package/dist/components/tabs/interface.d.ts +29 -0
- package/dist/components/tag/interface.d.ts +22 -0
- package/dist/components/tag-input/interface.d.ts +29 -0
- package/dist/components/time-picker/interface.d.ts +31 -0
- package/dist/components/timeline/interface.d.ts +5 -0
- package/dist/components/tooltip/interface.d.ts +20 -0
- package/dist/components/tooltip/tooltip.svelte +3 -0
- package/dist/components/transfer/interface.d.ts +18 -0
- package/dist/components/tree/interface.d.ts +45 -0
- package/dist/components/tree-select/interface.d.ts +55 -0
- package/dist/components/typography/interface.d.ts +33 -0
- package/dist/components/upload/interface.d.ts +64 -0
- package/dist/components/user-guide/interface.d.ts +15 -0
- package/dist/components/video-player/interface.d.ts +22 -0
- package/dist/styles.css +1 -1
- package/docs/advanced/dark-mode.md +288 -0
- package/docs/basic/button.md +605 -0
- package/docs/basic/divider.md +103 -0
- package/docs/basic/float-button.md +246 -0
- package/docs/basic/grid.md +427 -0
- package/docs/basic/layout.md +459 -0
- package/docs/basic/resizable.md +584 -0
- package/docs/basic/space.md +163 -0
- package/docs/basic/tokens.md +425 -0
- package/docs/basic/typography.md +615 -0
- package/docs/changes-from-semi.md +105 -0
- package/docs/ecosystem/tailwind.md +210 -0
- package/docs/experience/accessibility.md +82 -0
- package/docs/experience/content-guidelines.md +819 -0
- package/docs/experience/internationalization.md +7 -0
- package/docs/feedback/banner.md +198 -0
- package/docs/feedback/feedback.md +294 -0
- package/docs/feedback/notification.md +401 -0
- package/docs/feedback/popconfirm.md +243 -0
- package/docs/feedback/progress.md +389 -0
- package/docs/feedback/skeleton.md +388 -0
- package/docs/feedback/spin.md +172 -0
- package/docs/feedback/toast.md +393 -0
- package/docs/input/auto-complete.md +399 -0
- package/docs/input/cascader.md +1558 -0
- package/docs/input/checkbox.md +408 -0
- package/docs/input/color-picker.md +175 -0
- package/docs/input/date-picker.md +942 -0
- package/docs/input/form.md +2550 -0
- package/docs/input/input-number.md +451 -0
- package/docs/input/input.md +640 -0
- package/docs/input/pincode.md +191 -0
- package/docs/input/radio.md +337 -0
- package/docs/input/rating.md +214 -0
- package/docs/input/select.md +1230 -0
- package/docs/input/slider.md +347 -0
- package/docs/input/switch.md +206 -0
- package/docs/input/tag-input.md +465 -0
- package/docs/input/time-picker.md +358 -0
- package/docs/input/transfer.md +1061 -0
- package/docs/input/tree-select.md +1300 -0
- package/docs/input/upload.md +1811 -0
- package/docs/llms.txt +147 -0
- package/docs/navigation/anchor.md +377 -0
- package/docs/navigation/backtop.md +100 -0
- package/docs/navigation/breadcrumb.md +284 -0
- package/docs/navigation/navigation.md +851 -0
- package/docs/navigation/pagination.md +217 -0
- package/docs/navigation/steps.md +315 -0
- package/docs/navigation/tabs.md +754 -0
- package/docs/navigation/tree.md +1956 -0
- package/docs/other/config-provider.md +599 -0
- package/docs/other/locale.md +353 -0
- package/docs/plus/audio-player.md +155 -0
- package/docs/plus/code-highlight.md +150 -0
- package/docs/plus/drag-move.md +214 -0
- package/docs/plus/hot-keys.md +174 -0
- package/docs/plus/json-viewer.md +392 -0
- package/docs/plus/lottie.md +176 -0
- package/docs/plus/markdown-render.md +240 -0
- package/docs/plus/video-player.md +325 -0
- package/docs/show/avatar.md +475 -0
- package/docs/show/badge.md +276 -0
- package/docs/show/calendar.md +352 -0
- package/docs/show/card.md +485 -0
- package/docs/show/carousel.md +592 -0
- package/docs/show/collapse.md +289 -0
- package/docs/show/collapsible.md +216 -0
- package/docs/show/cropper.md +285 -0
- package/docs/show/descriptions.md +325 -0
- package/docs/show/dropdown.md +466 -0
- package/docs/show/empty.md +225 -0
- package/docs/show/highlight.md +144 -0
- package/docs/show/image.md +433 -0
- package/docs/show/list.md +927 -0
- package/docs/show/modal.md +517 -0
- package/docs/show/overflow-list.md +272 -0
- package/docs/show/popover.md +534 -0
- package/docs/show/scroll-list.md +156 -0
- package/docs/show/side-sheet.md +274 -0
- package/docs/show/table.md +5437 -0
- package/docs/show/tag.md +428 -0
- package/docs/show/timeline.md +277 -0
- package/docs/show/tooltip.md +442 -0
- package/docs/show/user-guide.md +419 -0
- package/docs/start/getting-started.md +234 -0
- package/docs/start/introduction.md +57 -0
- package/docs/start/overview.md +21 -0
- package/package.json +5 -4
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
> Tooltip is used to identify an element or attach a small amount of auxiliary information. The most typical scenario is to explain the meaning of the icon to the user, display the truncated text, display the description of the picture, and so on.
|
|
4
|
+
|
|
5
|
+
Package: `@fibrae/semi-ui-svelte`. Web page: https://semi-design-next.pages.dev/en-US/svelte/show/tooltip/
|
|
6
|
+
|
|
7
|
+
## Demos
|
|
8
|
+
|
|
9
|
+
### How to import
|
|
10
|
+
|
|
11
|
+
```svelte
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { Tooltip } from '@fibrae/semi-ui-svelte';
|
|
14
|
+
</script>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Cautions
|
|
18
|
+
|
|
19
|
+
Tooltip applies the trigger attributes and event listeners to the trigger element, and positions the popup against the real DOM element of that trigger. The trigger can be written in two ways:
|
|
20
|
+
|
|
21
|
+
1. The `child` snippet: `{#snippet child({ props })}<button {...props}>…</button>{/snippet}`. `props` carries `data-popupid`, `tabindex`, `aria-describedby` and an attachment that hands the element to Tooltip, and must be spread as a whole on an actual DOM element or on a component that passes the attributes to its root DOM element. Use this form for focusable triggers such as Button or Input
|
|
22
|
+
2. The content inside the tag (`children`): text or other content is wrapped in Tooltip's own span (`semi-tooltip-trigger-wrapper`) that becomes the trigger. When the span holds a focusable element it leaves the Tab order and a warning is logged in development
|
|
23
|
+
|
|
24
|
+
`content` is a snippet too: write `{#snippet content()}...{/snippet}` inside the Tooltip tag.
|
|
25
|
+
|
|
26
|
+
```svelte
|
|
27
|
+
<script lang="ts">
|
|
28
|
+
import { Space, Tag, Tooltip } from '@fibrae/semi-ui-svelte';
|
|
29
|
+
|
|
30
|
+
const style = 'border: 2px solid var(--semi-color-border); padding-inline-start: 4px; padding-inline-end: 4px; border-radius: 4px';
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<Space>
|
|
34
|
+
<Tooltip>
|
|
35
|
+
<Tag {style}>Component</Tag>
|
|
36
|
+
{#snippet content()}semi design{/snippet}
|
|
37
|
+
</Tooltip>
|
|
38
|
+
<Tooltip>
|
|
39
|
+
Text
|
|
40
|
+
{#snippet content()}semi design{/snippet}
|
|
41
|
+
</Tooltip>
|
|
42
|
+
<Tooltip>
|
|
43
|
+
{#snippet child({ props })}
|
|
44
|
+
<span {...props} {style}>DOM</span>
|
|
45
|
+
{/snippet}
|
|
46
|
+
{#snippet content()}semi design{/snippet}
|
|
47
|
+
</Tooltip>
|
|
48
|
+
</Space>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Position
|
|
52
|
+
|
|
53
|
+
The direction and alignment position of the popup layer can be configured through `position`. For detailed optional values of position, please refer to the API document below
|
|
54
|
+
|
|
55
|
+
When configured as `topLeft`, it pops up, and the popup layer is left-aligned with the children (when arrowPointAtCenter=false) . When configured as `topRight`, it pops up, and the popup layer is right-aligned with the children (when arrowPointAtCenter=false) . Same for other directions
|
|
56
|
+
|
|
57
|
+
```svelte
|
|
58
|
+
<script lang="ts">
|
|
59
|
+
import { Tag, Tooltip, type Position } from '@fibrae/semi-ui-svelte';
|
|
60
|
+
|
|
61
|
+
const tops: [Position, string][] = [
|
|
62
|
+
['topLeft', 'TL'],
|
|
63
|
+
['top', 'Top'],
|
|
64
|
+
['topRight', 'TR'],
|
|
65
|
+
];
|
|
66
|
+
const lefts: [Position, string][] = [
|
|
67
|
+
['leftTop', 'LT'],
|
|
68
|
+
['left', 'Left'],
|
|
69
|
+
['leftBottom', 'LB'],
|
|
70
|
+
];
|
|
71
|
+
const rights: [Position, string][] = [
|
|
72
|
+
['rightTop', 'RT'],
|
|
73
|
+
['right', 'Right'],
|
|
74
|
+
['rightBottom', 'RB'],
|
|
75
|
+
];
|
|
76
|
+
const bottoms: [Position, string][] = [
|
|
77
|
+
['bottomLeft', 'BL'],
|
|
78
|
+
['bottom', 'Bottom'],
|
|
79
|
+
['bottomRight', 'BR'],
|
|
80
|
+
];
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<div>
|
|
84
|
+
<div style="margin-inline-start: 80px; white-space: nowrap">
|
|
85
|
+
{#each tops as [position, label] (position)}
|
|
86
|
+
<Tooltip arrowPointAtCenter={false} {position}>
|
|
87
|
+
<Tag style="margin: 8px; padding: 20px">{label}</Tag>
|
|
88
|
+
{#snippet content()}
|
|
89
|
+
<article>
|
|
90
|
+
<p>hi semi</p>
|
|
91
|
+
<p>hi semi</p>
|
|
92
|
+
</article>
|
|
93
|
+
{/snippet}
|
|
94
|
+
</Tooltip>
|
|
95
|
+
{/each}
|
|
96
|
+
</div>
|
|
97
|
+
<div style="width: 80px; float: left">
|
|
98
|
+
{#each lefts as [position, label] (position)}
|
|
99
|
+
<Tooltip arrowPointAtCenter={false} {position}>
|
|
100
|
+
<Tag style="margin: 8px; padding: 20px; width: 60px">{label}</Tag>
|
|
101
|
+
{#snippet content()}
|
|
102
|
+
<article>
|
|
103
|
+
<p>hi semi</p>
|
|
104
|
+
<p>hi semi</p>
|
|
105
|
+
</article>
|
|
106
|
+
{/snippet}
|
|
107
|
+
</Tooltip>
|
|
108
|
+
{/each}
|
|
109
|
+
</div>
|
|
110
|
+
<div style="width: 40px; margin-inline-start: 300px">
|
|
111
|
+
{#each rights as [position, label] (position)}
|
|
112
|
+
<Tooltip arrowPointAtCenter={false} {position}>
|
|
113
|
+
<Tag style="margin: 8px; padding: 20px; width: 60px">{label}</Tag>
|
|
114
|
+
{#snippet content()}
|
|
115
|
+
<article>
|
|
116
|
+
<p>hi semi</p>
|
|
117
|
+
<p>hi semi</p>
|
|
118
|
+
</article>
|
|
119
|
+
{/snippet}
|
|
120
|
+
</Tooltip>
|
|
121
|
+
{/each}
|
|
122
|
+
</div>
|
|
123
|
+
<div style="margin-inline-start: 80px; clear: both; white-space: nowrap">
|
|
124
|
+
{#each bottoms as [position, label] (position)}
|
|
125
|
+
<Tooltip arrowPointAtCenter={false} {position}>
|
|
126
|
+
<Tag style="margin: 8px; padding: 20px; width: 60px">{label}</Tag>
|
|
127
|
+
{#snippet content()}
|
|
128
|
+
<article>
|
|
129
|
+
<p>hi semi</p>
|
|
130
|
+
<p>hi semi</p>
|
|
131
|
+
</article>
|
|
132
|
+
{/snippet}
|
|
133
|
+
</Tooltip>
|
|
134
|
+
{/each}
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Arrow Point at Center
|
|
140
|
+
|
|
141
|
+
By default `arrowPointAtCenter=true`, the small triangle always points to the center of the children element.\
|
|
142
|
+
You can set it to false and the little triangle will no longer keep pointing to the center of the element. The popover is aligned to the edges of the children
|
|
143
|
+
|
|
144
|
+
```svelte
|
|
145
|
+
<script lang="ts">
|
|
146
|
+
import { Button, Tooltip } from '@fibrae/semi-ui-svelte';
|
|
147
|
+
</script>
|
|
148
|
+
|
|
149
|
+
<div>
|
|
150
|
+
<Tooltip position="topLeft">
|
|
151
|
+
{#snippet child({ props })}
|
|
152
|
+
<Button {...props} style="margin-inline-end: 8px" type="secondary">指向元素中心</Button>
|
|
153
|
+
{/snippet}
|
|
154
|
+
{#snippet content()}semi design tooltip{/snippet}
|
|
155
|
+
</Tooltip>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div style="margin-block-start: 20px">
|
|
159
|
+
<Tooltip arrowPointAtCenter={false} position="topLeft">
|
|
160
|
+
{#snippet child({ props })}
|
|
161
|
+
<Button {...props} style="margin-inline-end: 8px; width: 120px" type="secondary">边缘对齐</Button>
|
|
162
|
+
{/snippet}
|
|
163
|
+
{#snippet content()}semi design tooltip{/snippet}
|
|
164
|
+
</Tooltip>
|
|
165
|
+
</div>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Trigger Timing
|
|
169
|
+
|
|
170
|
+
- Configure the timing of the trigger display, the default is `hover`, optional `hover` / `focus` / `click` / `custom` / `contextMenu`.
|
|
171
|
+
- When set to `custom`, it needs to be used in conjunction with the `visible`attribute, at which point the display is completely controlled
|
|
172
|
+
- The `contextMenu` (right-click) trigger is available
|
|
173
|
+
|
|
174
|
+
```svelte
|
|
175
|
+
<script lang="ts">
|
|
176
|
+
import { Button, Input, Radio, RadioGroup, Tooltip, type RadioValue } from '@fibrae/semi-ui-svelte';
|
|
177
|
+
|
|
178
|
+
let visible = $state<RadioValue | undefined>(false);
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
{#snippet text()}hi semi{/snippet}
|
|
182
|
+
|
|
183
|
+
<div>
|
|
184
|
+
<Tooltip content={text}>
|
|
185
|
+
{#snippet child({ props })}
|
|
186
|
+
<Button {...props} style="margin-block-end: 20px" theme="solid" type="tertiary">悬停显示</Button>
|
|
187
|
+
{/snippet}
|
|
188
|
+
</Tooltip>
|
|
189
|
+
<br />
|
|
190
|
+
<Tooltip content={text} trigger="click">
|
|
191
|
+
{#snippet child({ props })}
|
|
192
|
+
<Button {...props} style="margin-block-end: 20px">点击显示</Button>
|
|
193
|
+
{/snippet}
|
|
194
|
+
</Tooltip>
|
|
195
|
+
<br />
|
|
196
|
+
<Tooltip content={text} trigger="focus">
|
|
197
|
+
{#snippet child({ props })}
|
|
198
|
+
<Input {...props} aria-label="聚焦显示" placeholder="聚焦显示" style="width: 100px; margin-block-end: 20px" />
|
|
199
|
+
{/snippet}
|
|
200
|
+
</Tooltip>
|
|
201
|
+
<br />
|
|
202
|
+
<Tooltip content={text} trigger="contextMenu">
|
|
203
|
+
{#snippet child({ props })}
|
|
204
|
+
<Button {...props} style="margin-block-end: 20px" theme="solid" type="secondary">右键点击展示</Button>
|
|
205
|
+
{/snippet}
|
|
206
|
+
</Tooltip>
|
|
207
|
+
<br />
|
|
208
|
+
<Tooltip content={text} trigger="custom" visible={visible === true}>
|
|
209
|
+
{#snippet child({ props })}
|
|
210
|
+
<span {...props} style="display: inline-block" tabindex="-1">
|
|
211
|
+
<RadioGroup bind:value={visible} type="button">
|
|
212
|
+
<Radio value={true}>受控显示</Radio>
|
|
213
|
+
<Radio value={false}>受控隐藏</Radio>
|
|
214
|
+
</RadioGroup>
|
|
215
|
+
</span>
|
|
216
|
+
{/snippet}
|
|
217
|
+
</Tooltip>
|
|
218
|
+
</div>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Conditional trigger (condition)
|
|
222
|
+
|
|
223
|
+
When `condition={false}`, Tooltip will not respond to hover/click/focus triggers (with `trigger="custom"`, `visible` still shows it); when condition changes from true to false, an open popup closes at once; with `visible` controlled it only calls `onVisibleChange(false)`, and the popup closes once the caller writes `visible` back.
|
|
224
|
+
|
|
225
|
+
```svelte
|
|
226
|
+
<script lang="ts">
|
|
227
|
+
import { Button, Space, Switch, Tooltip, Typography } from '@fibrae/semi-ui-svelte';
|
|
228
|
+
|
|
229
|
+
let enabled = $state(true);
|
|
230
|
+
const text = $derived(`condition is ${enabled ? 'true' : 'false'}`);
|
|
231
|
+
</script>
|
|
232
|
+
|
|
233
|
+
<Space align="center">
|
|
234
|
+
<Typography.Text id="tooltip-condition-label">condition</Typography.Text>
|
|
235
|
+
<Switch aria-labelledby="tooltip-condition-label" bind:checked={enabled} />
|
|
236
|
+
<Tooltip condition={enabled} trigger="hover">
|
|
237
|
+
{#snippet child({ props })}
|
|
238
|
+
<Button {...props}>Hover me</Button>
|
|
239
|
+
{/snippet}
|
|
240
|
+
{#snippet content()}{text}{/snippet}
|
|
241
|
+
</Tooltip>
|
|
242
|
+
<Tooltip condition={enabled} trigger="click">
|
|
243
|
+
{#snippet child({ props })}
|
|
244
|
+
<Button {...props}>Click me</Button>
|
|
245
|
+
{/snippet}
|
|
246
|
+
{#snippet content()}{text}{/snippet}
|
|
247
|
+
</Tooltip>
|
|
248
|
+
</Space>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Override Style
|
|
252
|
+
|
|
253
|
+
Configure specific styles for the pop-up layer through `class` and `style` (a string), such as overriding the default maxWidth (240px)
|
|
254
|
+
|
|
255
|
+
```svelte
|
|
256
|
+
<script lang="ts">
|
|
257
|
+
import { Tag, Tooltip } from '@fibrae/semi-ui-svelte';
|
|
258
|
+
</script>
|
|
259
|
+
|
|
260
|
+
<div>
|
|
261
|
+
<Tooltip class="another-classname" style="max-width: 320px">
|
|
262
|
+
<Tag style="margin-inline-end: 8px">Custom Style And ClassName</Tag>
|
|
263
|
+
{#snippet content()}hi semi semi semi semi semi semi semi{/snippet}
|
|
264
|
+
</Tooltip>
|
|
265
|
+
</div>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Use with Popver or Popconfirm
|
|
269
|
+
|
|
270
|
+
Tooltip, Popconfirm, and Popover all bind related events on the trigger (mouseenter / mouseleave / click ....) and add trigger attributes such as `aria-describedby` and `data-popupid`.\
|
|
271
|
+
When the outer component receives plain content as children, it is wrapped in the outer component's own span, which cannot describe the focusable element inside it, and a warning is logged in development.\
|
|
272
|
+
To keep each component's own trigger attributes, add a layer of elements (div or span) in the middle as the trigger of the outer one: the outer component spreads `props` on it through the `child` snippet and sets `tabindex={-1}`, and the inner one spreads `props` on the real trigger through its own `child` snippet.
|
|
273
|
+
|
|
274
|
+
```svelte
|
|
275
|
+
<script lang="ts">
|
|
276
|
+
import { Button, Popconfirm, Tooltip } from '@fibrae/semi-ui-svelte';
|
|
277
|
+
</script>
|
|
278
|
+
|
|
279
|
+
<Popconfirm style="width: 320px">
|
|
280
|
+
{#snippet child({ props })}
|
|
281
|
+
<span {...props} style="display: inline-block" tabindex="-1">
|
|
282
|
+
<Tooltip>
|
|
283
|
+
{#snippet child({ props })}
|
|
284
|
+
<Button {...props} type="danger">删除</Button>
|
|
285
|
+
{/snippet}
|
|
286
|
+
{#snippet content()}删除评价{/snippet}
|
|
287
|
+
</Tooltip>
|
|
288
|
+
</span>
|
|
289
|
+
{/snippet}
|
|
290
|
+
{#snippet title()}确认{/snippet}
|
|
291
|
+
{#snippet content()}是否确认删除{/snippet}
|
|
292
|
+
</Popconfirm>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Show Tooltip only when the content overflows
|
|
296
|
+
|
|
297
|
+
Semi provides the Typography component for this scenario, so you do not need to check for overflow yourself before showing a Tooltip. For details, see the [Typography documentation](../basic/typography.md#ellipsis).
|
|
298
|
+
|
|
299
|
+
```svelte
|
|
300
|
+
<script lang="ts">
|
|
301
|
+
import { Typography } from '@fibrae/semi-ui-svelte';
|
|
302
|
+
</script>
|
|
303
|
+
|
|
304
|
+
<div>
|
|
305
|
+
<Typography.Title ellipsis={{ showTooltip: true }} heading={5} style="width: 250px">是一个很长很长很长很长5号标题</Typography.Title>
|
|
306
|
+
<br />
|
|
307
|
+
<Typography.Text ellipsis={{ showTooltip: true, pos: 'middle' }} link style="width: 150px">是一个很长很长很长很长的链接</Typography.Text>
|
|
308
|
+
<br />
|
|
309
|
+
<br />
|
|
310
|
+
<Typography.Paragraph ellipsis={{ rows: 3, showTooltip: { type: 'popover', opts: { style: 'width: 300px' } } }} style="width: 300px">
|
|
311
|
+
多行截断,展示 Popover:Semi Design Next 是 Semi Design 的社区版设计系统,一套组件在 React、Vue、Solid、Svelte 中原生可用。设计系统包含设计语言以及一整套可复用的前端组件,帮助设计师与开发者更容易地打造高质量的、用户体验一致的、符合设计规范的 Web 应用。
|
|
312
|
+
</Typography.Paragraph>
|
|
313
|
+
</div>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## API Reference
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
**Props**
|
|
321
|
+
|
|
322
|
+
| Property | Description | Type | Default |
|
|
323
|
+
| - | - | - | - |
|
|
324
|
+
| afterClose | Called after the popup has closed and its leave animation has finished. | `() => void` | - |
|
|
325
|
+
| afterOpen | Called after the popup has opened and its enter animation has finished, or right after opening when there is no enter animation, controlled or not; not called for an open that is closed before the enter animation ends. | `() => void` | - |
|
|
326
|
+
| aria-describedby | aria-describedby of the popup when its role is dialog. | `string` | - |
|
|
327
|
+
| aria-label | aria-label of the popup when its role is dialog. | `string` | - |
|
|
328
|
+
| aria-labelledby | aria-labelledby of the popup when its role is dialog. | `string` | - |
|
|
329
|
+
| arrow | Snippet that replaces the default arrow while showArrow is true. | `Snippet` | - |
|
|
330
|
+
| arrowPointAtCenter | Whether the arrow points at the center of the trigger. Requires showArrow. | `boolean` | `true` |
|
|
331
|
+
| autoAdjustOverflow | Whether the popup flips automatically when it would be clipped. | `boolean` | `true` |
|
|
332
|
+
| child | Snippet that renders the trigger element itself; spread its `{ props }` on the trigger as a whole (`<button {...props}>`). It wins over children. Use it for every focusable trigger such as Button or Input. | `Snippet<[{ props: TooltipTriggerProps }]>` | - |
|
|
333
|
+
| children | The trigger, written inside the tag; it is wrapped in Tooltip's own span (`semi-tooltip-trigger-wrapper`), which suits text and content that cannot take focus. | `Snippet` | - |
|
|
334
|
+
| class | Class name of the popup. | `string` | - |
|
|
335
|
+
| classNames | Class names of the inner parts, keyed by `wrapper` (the span that wraps the trigger when a wrapper is needed); merged with the built-in classes. | `Partial<Record<TooltipPart, ClassValue>>` | - |
|
|
336
|
+
| clickToHide | Whether a click on the popup or anything inside it closes the popup. | `boolean` | - |
|
|
337
|
+
| clickTriggerToHide | Whether a click on the trigger closes an open popup. | `boolean` | - |
|
|
338
|
+
| closeOnEsc | Whether Esc closes the open popup. With trigger custom it only calls onEscKeyDown and the caller decides whether to close. | `boolean` | `true` |
|
|
339
|
+
| condition | Whether the popup may be triggered. Only an explicit false disables the hover, click and focus triggers; with trigger custom, visible still shows the popup. Changing it from true to false closes an open popup at once; with a controlled visible it only calls onVisibleChange(false), and the popup closes once the caller writes back. | `boolean` | `true` |
|
|
340
|
+
| content | Snippet for the popup content, with the parameter `{ initialFocusRef }`: write `{@attach initialFocusRef}` on the element that should receive focus when the popup opens. | `Snippet<[RenderContentProps]>` | - |
|
|
341
|
+
| disableArrowKeyDown | Whether the arrow keys on the trigger are prevented from moving focus into the popup. | `boolean` | `false` |
|
|
342
|
+
| disableFocusListener | Whether keyboard focus is ignored when trigger is hover. | `boolean` | `false` |
|
|
343
|
+
| guardFocus | Whether Tab cycles inside the popup while focus is in it. | `boolean` | `false` |
|
|
344
|
+
| keepDOM | Whether the popup content stays mounted while closed. | `boolean` | `false` |
|
|
345
|
+
| motion | Whether the popup is animated. | `boolean` | `true` |
|
|
346
|
+
| mouseEnterDelay | Milliseconds before the popup shows after the pointer enters. Applies to the hover and focus triggers. | `number` | `50` |
|
|
347
|
+
| mouseLeaveDelay | Milliseconds before the popup hides after the pointer leaves. Applies to the hover and focus triggers; not less than mouseEnterDelay. | `number` | `50` |
|
|
348
|
+
| onClickOutSide | Called when the mouse is pressed outside of the trigger and the open popup. Only for trigger click, contextMenu or custom, or with clickTriggerToHide. | `(event: MouseEvent) => void` | - |
|
|
349
|
+
| onEscKeyDown | Called when Esc is pressed while the popup is open and closeOnEsc is true. | `(event: KeyboardEvent) => void` | - |
|
|
350
|
+
| onOpen | Called once per opening when the popup is shown, as its enter animation starts, before afterOpen, controlled or not; not called for a hover open withdrawn because the pointer already left. | `() => void` | - |
|
|
351
|
+
| onVisibleChange | Called when the visibility of the popup changes; with a controlled visible it reports only requests from user interaction, not changes the parent makes to visible. | `(visible: boolean) => void` | - |
|
|
352
|
+
| position | Position of the popup relative to the trigger element. | `Position` | `"top"` |
|
|
353
|
+
| preventScroll | Whether focusing an element avoids scrolling it into view. | `boolean` | - |
|
|
354
|
+
| returnFocusOnClose | Whether focus returns to the trigger after the popup closes. | `boolean` | `false` |
|
|
355
|
+
| role | ARIA role of the popup. | `string` | `"tooltip"` |
|
|
356
|
+
| showArrow | Whether the arrow is shown. | `boolean` | `true` |
|
|
357
|
+
| spacing | Distance in pixels between the popup and the trigger. An object sets the horizontal and vertical distances. | `number \| { x: number; y: number }` | `8` |
|
|
358
|
+
| stopPropagation | Whether click, mousedown and focus in/out events on the popup stop propagating. | `boolean` | - |
|
|
359
|
+
| style | Style string of the popup, written before the positioning declarations; its `background-color` also colors the arrow. | `string` | - |
|
|
360
|
+
| styles | Inline style strings of the inner parts, keyed like `classNames`; applied after the span's built-in style. | `Partial<Record<TooltipPart, string>>` | - |
|
|
361
|
+
| trigger | When the popup shows. With custom, visible alone decides. | `'click' \| 'contextMenu' \| 'custom' \| 'focus' \| 'hover'` | `"hover"` |
|
|
362
|
+
| visible | Whether the popup is shown; bind it with `bind:visible`. `bind:visible={get, set}` makes it fully controlled, and when given this value decides. | `boolean` | - |
|
|
363
|
+
| wrapperId | id of the popup element, referenced by the trigger's ARIA attributes. Generated when omitted. | `string` | - |
|
|
364
|
+
| wrapWhenSpecial | Whether a disabled or loading Semi Button, Switch or Checkbox that fills the default span gets its pointer events through the span to trigger the popup; false leaves it as it is. | `boolean` | `true` |
|
|
365
|
+
|
|
366
|
+
**Methods**
|
|
367
|
+
|
|
368
|
+
| Method | Description | Type |
|
|
369
|
+
| - | - | - |
|
|
370
|
+
| focusTrigger | Focuses the trigger element. Only works when returnFocusOnClose is true and trigger is not custom. | `() => void` |
|
|
371
|
+
| getPopup | Returns the popup element, or `null` while the popup is not in the document. | `() => HTMLDivElement \| null` |
|
|
372
|
+
| getPopupId | Returns the id of the popup element. | `() => string` |
|
|
373
|
+
| hide | Closes the popup. With a controlled visible it only calls onVisibleChange for the caller to write back. | `() => void` |
|
|
374
|
+
| rePosition | Recomputes the popup position from the trigger's current position at once. The popup already follows scrolling, window resizing, trigger moves and size changes of the trigger or popup, so this is rarely needed; following a trigger move lands a frame late, so call this to align within the same frame. | `() => void` |
|
|
375
|
+
|
|
376
|
+
Tooltip has no root DOM element: `class` and `style` (a string) land on the popup, and other undeclared attributes are discarded. The trigger attributes are added to the trigger element only. `visible` is bindable and there is no `defaultVisible`. The popup renders only after mount and is not output on the server. `useTooltipDescription` is not provided (the popup id is already in the `props` of `child`).
|
|
377
|
+
|
|
378
|
+
## Accessibility
|
|
379
|
+
|
|
380
|
+
### ARIA
|
|
381
|
+
|
|
382
|
+
- Tooltip has a tooltip role, following the definition of Tooltip in the [WAI-ARIA](https://www.w3.org/TR/wai-aria-practices/#tooltip) specification
|
|
383
|
+
- Tooltip's content and children
|
|
384
|
+
- about content
|
|
385
|
+
- The wrapper of content will be automatically added with id attribute to match the `aria-describedby` of children and associate content with children
|
|
386
|
+
- about children
|
|
387
|
+
- There should be an explicit connection between the content of the Tooltip and its children. Tooltip will automatically add the `aria-describedby` attribute to the children element, the value is the id of the content wrapper.
|
|
388
|
+
- If the children of your Tooltip are Icon and do not contain visible text, we recommend that you add the `aria-label` attribute to the children to describe accordingly
|
|
389
|
+
|
|
390
|
+
```svelte
|
|
391
|
+
<!-- Good practices, add aria-label to the tooltip trigger -->
|
|
392
|
+
<Tooltip>
|
|
393
|
+
{#snippet child({ props })}
|
|
394
|
+
<IconSetting {...props} aria-label="Settings" />
|
|
395
|
+
{/snippet}
|
|
396
|
+
{#snippet content()}<p id="description">Edit your setting</p>{/snippet}
|
|
397
|
+
</Tooltip>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Content Guidelines
|
|
401
|
+
|
|
402
|
+
- Only display information description and guidance, do not display error information
|
|
403
|
+
- Only extra links and buttons not in tooltip
|
|
404
|
+
- Try to simplify the description to one sentence without showing punctuation marks
|
|
405
|
+
|
|
406
|
+
## Design Tokens
|
|
407
|
+
|
|
408
|
+
The design token table of this component is on the web page: <https://semi-design-next.pages.dev/en-US/svelte/show/tooltip/>
|
|
409
|
+
|
|
410
|
+
## FAQ
|
|
411
|
+
|
|
412
|
+
- **Why do some forms of content not wrap when the content in Tooltip is very long?**\
|
|
413
|
+
The Tooltip popup sets [overflow-wrap](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap) to break-word, so an overlong word breaks onto the next line. Different language content (e.g. English, Chinese, combination of English and Chinese) needs different line breaking; if the default does not fit, adjust the line break related CSS properties through style and className (class in Vue).
|
|
414
|
+
|
|
415
|
+
## Changes from Semi Design
|
|
416
|
+
|
|
417
|
+
From the project release notes (written in Chinese). Your knowledge of Semi Design does not cover these.
|
|
418
|
+
|
|
419
|
+
- 破坏性:Popover 删除 `contentClassName`、`arrowStyle`,改用 `classNames`、`styles` 的 `content`(内容卡片)、`arrow` 键,`styles.arrow` 仍是 `borderColor`、`backgroundColor`、`borderOpacity` 这组箭头颜色;Tooltip 删除 `wrapperClassName`,改用 `classNames.wrapper`,新增 `styles.wrapper`,作用在触发元素被包裹时的 span 上。
|
|
420
|
+
- 破坏性:弹层改用 Popover API 进入 top layer,Portal 到触发元素所在根节点,不受祖先 `overflow`、`transform`、`z-index` 影响,也不在触发元素 DOM 内。位置按视口计算,`x-placement` 是自动翻转后的方位;放得下视口的弹层夹在视口内,触发器滚出或被裁出可见区域时弹层隐藏;打开期间随滚动、窗口 resize、触发器或弹层的尺寸变化重新定位,只随触发器所在区域的滚动重算,同一帧内的多个弹层一起重算;触发器只因别处布局变化而移动时也会跟随,但晚一帧。Tooltip、Popover、Dropdown 与 Select 的 ref 都提供 `rePosition()`(Popover 的 `PopoverHandle` 为新增),立即按触发器当前位置重新定位,一般无需调用。Tooltip 左右两侧边角方位(`leftTop`、`leftBottom`、`rightTop`、`rightBottom`)的箭头离弹层角 1px 更远,与 Popover 和上下方位一致,`arrowPointAtCenter` 时正对触发器中心。
|
|
421
|
+
- 新增:页面有固定顶栏时,在 `:root` 上设 CSS 变量 `--semi-tooltip-viewport-inset-top`(顶栏高度,可写 `calc()`、`var()`),所有基于 Tooltip 的弹层把视口顶部这一段当作不可用:翻转与夹取都避开它,触发器整个落在顶栏下方时弹层隐藏。top layer 不受 `z-index` 影响,顶栏无法靠层级盖住弹层。打开时读取一次,打开期间修改要到下次打开才生效。
|
|
422
|
+
- 新增:Tooltip、Popover 与 Dropdown 的 ref 提供 `getPopup()`,返回当前弹层元素,未显示时为 `null`(Svelte 经 `bind:this` 调用,Dropdown 原有);React、Solid 的 Tooltip、Popover 新增 `aria-describedby`,`role="dialog"` 时落在弹层上,其他 role 不落弹层。
|
|
423
|
+
- 破坏性:删除 Tooltip、Popover、Popconfirm 的 `getPopupContainer`、`zIndex`、`margin`、`rePosKey`,`numbers.DEFAULT_Z_INDEX`、`MARGIN`、`ARROW_BOUNDING`,以及 `arrowBounding`、`transformFromCenter`、`ArrowBounding`;新增 `TooltipHandle.hide()`。`onEscKeyDown`、`onClickOutSide` 的参数类型改为原生 `KeyboardEvent`、`MouseEvent`。
|
|
424
|
+
- 行为变化:`closeOnEsc` 默认 `true`(Modal 内的提示先按 Esc 只关提示,旧行为传 `closeOnEsc={false}`);Popover 的 `disableFocusListener` 默认改为 `false`;新增 `afterOpen`(Vue `afterOpen` 事件,进场动画结束后调用)与 `onOpen`(Vue `open` 事件,弹层显示时调用,早于 `afterOpen`),Popover、Popconfirm、Dropdown 一并转发;受控 `visible` 只报告请求,触发器操作只报告 `onVisibleChange(true)`、关闭类操作只报告 `(false)`,React 在 `visible={false}` 时须在回调中回写才会打开。
|
|
425
|
+
- 行为变化:进出场改为 keyframes 动画(`semi-tooltip-zoom-in`、`semi-tooltip-zoom-out`),Popover、Dropdown 同样适用;关闭时弹层在出场动画期间仍为 `:popover-open`,动画结束才隐藏,出场中重新打开从头播放进场。覆盖过弹层 `transition` 的自定义样式改为覆盖 `animation`。
|
|
426
|
+
- 行为变化:弹层在打开回调执行前就被关闭(如 `trigger="focus"` 聚焦后立即失焦)时,先补报一次 `onVisibleChange(true)` 再报 `(false)`,两者成对。
|
|
427
|
+
- 行为变化:React 中触发元素卸载后仍显示的弹层,在外部按下时照常通知 `onClickOutSide` 并按触发方式关闭,与 Vue 一致。
|
|
428
|
+
- 行为变化:出场动画期间重新打开时,这次出场作废并立即调用一次 `afterClose`,每次显示都有自己的 `afterClose`(Modal、SideSheet 仍把它算作同一次显示)。在外部元素的 mousedown 处理中打开受控的 `trigger="custom"` 弹层时,同一次按下不再算点击外部。React、Solid 中 `trigger="custom"` 的弹层,在触发器内渲染的 Portal 里按下不算点击外部(Solid 只在 `onMouseDown` 经 `getTriggerProps` 传入时)。Popover 的箭头 svg 带 `aria-hidden="true"`。
|
|
429
|
+
- 行为变化:Select、AutoComplete、Cascader、TreeSelect 与 AIChatDialogue 的「更多」菜单打开时的点击外部改由弹层判断。React、Vue、Svelte 的 mousedown 监听从 `document` 移到 `window`(Solid 原本就在 `window`),在 `document` 上被 `stopPropagation()` 拦下的按下不再关闭下拉;TreeSelect 聚焦但未打开时的失焦判断仍监听 `document`。
|
|
430
|
+
- 行为变化:Select、TreeSelect、Cascader、AutoComplete 的下拉打开而焦点不在组件内时,按 Esc 也关闭下拉(原来 Esc 被弹层认领后没有任何反应);Select 在 `loading` 时仍不响应。
|
|
431
|
+
- 行为变化:hover、focus 触发的提示(`role="tooltip"`,含 hover 触发的 Popover)同一时间只显示一组:一个打开时关闭其他已打开的,几个在延迟内先后请求显示时只显示最后一个,嵌套在其触发器或弹层中的除外(参照 Radix Tooltip、React Aria);Dropdown 等其他 role 的弹层不参与。hover 触发的弹层(含 Dropdown)只在触发器 `:focus-visible` 时随聚焦打开,点击或鼠标关闭 Modal 后由脚本还回的焦点不再打开。
|
|
432
|
+
- 行为变化:hover 触发的弹层(含 Popover、Dropdown 及其子菜单、Navigation 弹出的子菜单)有指针宽限:鼠标离开触发器后,只要朝弹层一侧移动、且在离开点与弹层近侧两角围成的三角区内,弹层就保持打开,途中经过的其他 hover 触发器也不打开,最长 300ms(参照 Radix Menu)。离开三角区、反向移动或超时后,照常按 `mouseLeaveDelay` 关闭,指针此时停留的触发器再按 `mouseEnterDelay` 打开。默认开启,没有开关;只在主指针可悬停(`(hover: hover)`)时生效,键盘焦点打开的弹层不受影响。
|
|
433
|
+
- 行为变化:Tooltip、Popover、Dropdown 的弹层在关闭动画期间不响应指针(参照 Ant Design 的 leave motion)。原来指针扫过正在淡出、已经透明的弹层会让它重新打开,打开后又因触发器未被悬停而立即关闭,表现为菜单闪现。
|
|
434
|
+
- 行为变化:hover 触发的弹层在隐藏后重新显示时,若指针与焦点都已离开触发器与弹层则关闭;隐藏期间受控 `visible` 变为 false 或 `condition` 变为 false,重新显示时关闭。React 的 `<Activity>` 隐藏不再误发 `afterClose`;Svelte 无出场动画的关闭,`afterClose` 推迟一个微任务。
|
|
435
|
+
- Svelte:触发器默认包进 Tooltip 自己的 span(`semi-tooltip-trigger-wrapper`);可聚焦的触发器改用 `child` snippet:`{#snippet child({ props })}<button {...props}>…</button>{/snippet}`,`props` 带 `data-popupid`、`tabindex`、`aria-describedby` 和取元素引用的 attachment,必须整体展开;`role="dialog"` 且元素可承载弹层状态时另带 `aria-haspopup`、`aria-expanded`、`aria-controls`;包装 span 里有可聚焦元素时,span 退出 Tab 顺序并在开发期告警。
|
|
436
|
+
- Svelte:`visible` 可绑定,配 `onVisibleChange`;事件为 `onClickOutSide`、`onEscKeyDown`、`onOpen`、`afterOpen`、`afterClose`;`content({ initialFocusRef })` 的 `initialFocusRef` 是回调,可直接写 `{@attach initialFocusRef}`;箭头用 `arrow` snippet;`class`、`style` 只落在弹层上,`style` 只接受字符串,其中的 `background-color` 也给箭头着色;对外方法 `focusTrigger`、`getPopupId`、`hide`、`rePosition` 经 `bind:this` 调用。
|
|
437
|
+
- Svelte:不提供 `useTooltipDescription`(弹层 id 已在 `child` 的 `props` 里);弹层只在挂载后渲染,服务端不输出。
|
|
438
|
+
- Svelte:span 内唯一的子元素(Button 的组分隔线不算)是 Semi Button、IconButton、Switch、Checkbox 时,由它们向 Tooltip 登记:disabled 或 loading 的 Button、IconButton 在 `click`、`contextMenu` 触发(loading 时除 `custom` 外的所有触发)下由 span 接管指针;loading 的 Button 的 `aria-describedby` 与弹层状态落在按钮上,span 的 `tabindex` 为 -1;Switch、Checkbox 的描述落在 input 上,Tab 只停在 input;新增 `wrapWhenSpecial`(默认 true);原生 `<button disabled>` 与 `child` snippet 里的特殊触发器不识别,首帧与服务端不知道特殊状态,挂载后才补上。
|
|
439
|
+
- Svelte:`stopPropagation` 在弹层元素的 Svelte `onclick` 里执行(含 `stopImmediatePropagation`),弹层内容的 `onclick` 正常收到点击;在 Svelte 事件委托注册之前添加的 document 点击监听仍会收到事件,之后添加的收不到。
|
|
440
|
+
- Svelte:Popover 触发器写法同 Tooltip,可聚焦触发器用 `child` snippet 展开 `props`,不传时包进 Tooltip 的 span;内容用 `content({ initialFocusRef })` snippet;`visible` 可绑定,配 `onVisibleChange`,没有 `defaultVisible`;对话框名称键为 `'aria-label'`、`'aria-labelledby'`、`'aria-describedby'`;`class`、`style` 落在弹层上,`style` 只接受字符串,未传 `arrowStyle` 时箭头颜色读 `style` 里的 `background-color`、`border-color`;`focusTrigger()`、`rePosition()` 经 `bind:this` 调用;箭头 svg 带 `aria-hidden="true"`。
|
|
441
|
+
- 行为变化:`guardFocus` 的 Tab 环由 FocusTrapHandle 处理,焦点停在弹层容器本身时按 Tab 也被圈住;`guardFocus` 每次打开读取一次,打开期间修改要到下次打开才生效。`mouseLeaveDelay` 小于 `mouseEnterDelay` 的警告统一按 `(mouseLeaveDelay ?? 0) < (mouseEnterDelay ?? 0)` 判断,两个延时变化时重新检查。
|
|
442
|
+
- 行为变化:Vue、Solid、Svelte 的弹层在 KeepAlive 激活、`<Activity>` 重新显示时也会重新检查指针是否仍在触发器上(React 原本如此);Vue KeepAlive 失活时释放弹层的 layer。
|