@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,284 @@
|
|
|
1
|
+
# Breadcrumb
|
|
2
|
+
|
|
3
|
+
> Breadcrumbs allow users to make selections from a range of values and provide an auxiliary navigation that can return to previous page.
|
|
4
|
+
|
|
5
|
+
Package: `@fibrae/semi-ui-svelte`. Web page: https://semi-design-next.pages.dev/en-US/svelte/navigation/breadcrumb/
|
|
6
|
+
|
|
7
|
+
## Demos
|
|
8
|
+
|
|
9
|
+
### How to import
|
|
10
|
+
|
|
11
|
+
```svelte
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { Breadcrumb } from '@fibrae/semi-ui-svelte';
|
|
14
|
+
</script>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Svelte has no `Breadcrumb.Item`; each item is described by `routes`.
|
|
18
|
+
|
|
19
|
+
### Basic Usage
|
|
20
|
+
|
|
21
|
+
```svelte
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { Breadcrumb } from '@fibrae/semi-ui-svelte';
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<Breadcrumb routes={['Semi-ui', 'Breadcrumb', 'Default']} />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### With Icons
|
|
30
|
+
|
|
31
|
+
A level can show an icon only, or an icon together with text.
|
|
32
|
+
|
|
33
|
+
Use the `icon` snippet. Its parameter carries the `route` and `index` of the item, plus the `size` and `class` to pass on to the icon: `<IconHome {size} class={className} />`. Pick the icon by index; an item without an icon renders nothing. For an icon-only item, set `name` to an empty string and give the icon an `aria-label`.
|
|
34
|
+
|
|
35
|
+
```svelte
|
|
36
|
+
<script lang="ts">
|
|
37
|
+
import { IconArticle, IconHome } from '@fibrae/semi-icons-svelte';
|
|
38
|
+
import { Breadcrumb } from '@fibrae/semi-ui-svelte';
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<Breadcrumb routes={['', 'Breadcrumb', 'With Icon']}>
|
|
42
|
+
{#snippet icon(iconContext)}
|
|
43
|
+
{#if iconContext.index === 0}
|
|
44
|
+
<IconHome aria-label="Home" class={iconContext.class} size={iconContext.size} />
|
|
45
|
+
{:else if iconContext.index === 1}
|
|
46
|
+
<IconArticle class={iconContext.class} size={iconContext.size} />
|
|
47
|
+
{/if}
|
|
48
|
+
{/snippet}
|
|
49
|
+
</Breadcrumb>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Size
|
|
53
|
+
|
|
54
|
+
You can set the `compact` property to `false` to increase the size of icons and texts.
|
|
55
|
+
|
|
56
|
+
```svelte
|
|
57
|
+
<script lang="ts">
|
|
58
|
+
import { IconHome } from '@fibrae/semi-icons-svelte';
|
|
59
|
+
import { Breadcrumb, type BreadcrumbIconContext } from '@fibrae/semi-ui-svelte';
|
|
60
|
+
|
|
61
|
+
const routes = ['', 'Breadcrumb', 'Loose'];
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
{#snippet icon(iconContext: BreadcrumbIconContext)}
|
|
65
|
+
{#if iconContext.index === 0}
|
|
66
|
+
<IconHome aria-label="Home" class={iconContext.class} size={iconContext.size} />
|
|
67
|
+
{/if}
|
|
68
|
+
{/snippet}
|
|
69
|
+
|
|
70
|
+
<!-- Several breadcrumbs on one page are told apart by aria-label -->
|
|
71
|
+
<div>
|
|
72
|
+
<Breadcrumb aria-label="紧凑面包屑" compact {icon} {routes} />
|
|
73
|
+
<br />
|
|
74
|
+
<Breadcrumb aria-label="宽松面包屑" compact={false} {icon} {routes} />
|
|
75
|
+
</div>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Custom Separator
|
|
79
|
+
|
|
80
|
+
Default separator is `/`.
|
|
81
|
+
|
|
82
|
+
`separator` takes text; for a separator made of nodes, use the `separator` snippet. A single route can carry a `separator` field to override the shared one.
|
|
83
|
+
|
|
84
|
+
```svelte
|
|
85
|
+
<script lang="ts">
|
|
86
|
+
import { IconArrowRight } from '@fibrae/semi-icons-svelte';
|
|
87
|
+
import { Breadcrumb } from '@fibrae/semi-ui-svelte';
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<!-- Several breadcrumbs on one page are told apart by aria-label -->
|
|
91
|
+
<div>
|
|
92
|
+
<Breadcrumb aria-label="文字分隔符" routes={['Semi-ui', 'Breadcrumb', 'Default']} separator=">" />
|
|
93
|
+
<br />
|
|
94
|
+
<Breadcrumb aria-label="图标分隔符" routes={['Semi-ui', 'Breadcrumb', 'Default']}>
|
|
95
|
+
{#snippet separator()}
|
|
96
|
+
<IconArrowRight size="small" />
|
|
97
|
+
{/snippet}
|
|
98
|
+
</Breadcrumb>
|
|
99
|
+
<br />
|
|
100
|
+
<Breadcrumb aria-label="单项分隔符" routes={[{ name: 'Semi-ui', separator: ':' }, 'Breadcrumb', 'Default']} />
|
|
101
|
+
</div>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Truncated Logic
|
|
105
|
+
|
|
106
|
+
The truncation happens if the text is overflowed. Default max-width is set to 150px. You could use `showTooltip` to customize ellipsis behavior.
|
|
107
|
+
|
|
108
|
+
The title comes from the `name` of the route and is treated as text, taking part in truncation and the Tooltip; the content of the `item` snippet renders inline and is not truncated.
|
|
109
|
+
|
|
110
|
+
```svelte
|
|
111
|
+
<script lang="ts">
|
|
112
|
+
import { Breadcrumb, Typography } from '@fibrae/semi-ui-svelte';
|
|
113
|
+
|
|
114
|
+
const routes = ['首页', '当这个页面标题很长很长很长时需要省略', '详情页'];
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<!-- Several breadcrumbs on one page are told apart by aria-label -->
|
|
118
|
+
<Typography.Text size="small">默认行为</Typography.Text>
|
|
119
|
+
<Breadcrumb aria-label="默认行为" {routes} />
|
|
120
|
+
<br />
|
|
121
|
+
<Typography.Text size="small">省略但不显示Tooltip</Typography.Text>
|
|
122
|
+
<Breadcrumb aria-label="省略但不显示Tooltip" {routes} showTooltip={false} />
|
|
123
|
+
<br />
|
|
124
|
+
<Typography.Text size="small">不截断</Typography.Text>
|
|
125
|
+
<Breadcrumb aria-label="不截断" {routes} showTooltip={{ width: 'auto' }} />
|
|
126
|
+
<br />
|
|
127
|
+
<Typography.Text size="small">从标题中间开始省略</Typography.Text>
|
|
128
|
+
<Breadcrumb aria-label="从标题中间开始省略" {routes} showTooltip={{ ellipsisPos: 'middle' }} />
|
|
129
|
+
<br />
|
|
130
|
+
<Typography.Text size="small">自定义 Tooltip 参数</Typography.Text>
|
|
131
|
+
<Breadcrumb aria-label="自定义 Tooltip 参数" {routes} showTooltip={{ opts: { position: 'topLeft' } }} />
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
When the number of levels exceeds `maxItemCount` (default 4), the second level through level n-m+1 (counted from 1, and never past the penultimate level) are replaced by ellipsis by default, where n is the number of levels and m is `maxItemCount`. You can click the ellipsis to reveal all levels. The first, the current and the last level always stay visible. When `activeIndex` points at a level that would be collapsed, the current level stays visible instead: of the candidates before and after it, the run with more levels is collapsed (the one before it on a tie), so there is still only one ellipsis. With no candidates nothing is collapsed, and more levels than `maxItemCount` may show. You could use `maxItemCount` to set the number exceeded to trigger auto collapse.
|
|
135
|
+
|
|
136
|
+
```svelte
|
|
137
|
+
<script lang="ts">
|
|
138
|
+
import { Breadcrumb } from '@fibrae/semi-ui-svelte';
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<Breadcrumb routes={['首页', '当层级很多的时候', '又一层', '再一层', '上上一层', '上一层', '详情页']} />
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Custom Ellipsis
|
|
145
|
+
|
|
146
|
+
There are two ellipsis area rendering types provided inside the component. You can set and select the desired rendering type through `moreType`. The optional values of `moreType` are `default` and `popover`.
|
|
147
|
+
|
|
148
|
+
```svelte
|
|
149
|
+
<script lang="ts">
|
|
150
|
+
import { Breadcrumb } from '@fibrae/semi-ui-svelte';
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
<Breadcrumb moreType="popover" routes={['首页', '当层级很多的时候', '又一层', '再一层', '上上一层', '上一层', '详情页']} />
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
To customize the ellipsis area in another form, use the `more` snippet. Its parameter `restItems` holds the collapsed items as `{ route, index }`. It takes precedence over `moreType` when provided.
|
|
157
|
+
|
|
158
|
+
```svelte
|
|
159
|
+
<script lang="ts">
|
|
160
|
+
import { IconMore } from '@fibrae/semi-icons-svelte';
|
|
161
|
+
import { Breadcrumb, Popover, type BreadcrumbRoute } from '@fibrae/semi-ui-svelte';
|
|
162
|
+
|
|
163
|
+
const separator = '-';
|
|
164
|
+
const onClick = (route: BreadcrumbRoute, event: MouseEvent) => console.log(route, event);
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<Breadcrumb {onClick} routes={['首页', '当层级很多的时候', '又一层', '再一层', '上上一层', '上一层', '详情页']}>
|
|
168
|
+
{#snippet more(moreContext)}
|
|
169
|
+
<Popover showArrow style="padding: 12px">
|
|
170
|
+
{#snippet child({ props })}<IconMore {...props} tabindex={-1} />{/snippet}
|
|
171
|
+
{#snippet content()}
|
|
172
|
+
{#each moreContext.restItems as item, i (item.index)}
|
|
173
|
+
<span>{item.route.name}</span>
|
|
174
|
+
{#if i < moreContext.restItems.length - 1}
|
|
175
|
+
<span style="color: var(--semi-color-text-2); margin-inline-end: 6px">{separator}</span>
|
|
176
|
+
{/if}
|
|
177
|
+
{/each}
|
|
178
|
+
{/snippet}
|
|
179
|
+
</Popover>
|
|
180
|
+
{/snippet}
|
|
181
|
+
</Breadcrumb>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Route Object
|
|
185
|
+
|
|
186
|
+
Breadcrumb takes an array of strings or route objects consisting of `{ name, path, href }` through `routes`; there is no `Breadcrumb.Item`. Use the `item` snippet to render a custom title (inline, without truncation) and the `icon` snippet for icons; both receive the `route` and `index` of the item. A route holds data only, and `routes[].onClick` is not supported: use `onClick` of Breadcrumb instead (it is a function prop, and whether it is passed decides if items without `href` are keyboard operable). Its first parameter is the route of the item, and a string route arrives as `{ name }`.
|
|
187
|
+
|
|
188
|
+
- `name`: Name displayed, default with an empty string. When route passed in is a string only, it is set to name property.
|
|
189
|
+
- `path`: Routing path.
|
|
190
|
+
- `href`: Link destination and is mounted on the `<a>` tag.
|
|
191
|
+
|
|
192
|
+
```svelte
|
|
193
|
+
<script lang="ts">
|
|
194
|
+
import { IconArticle, IconHome } from '@fibrae/semi-icons-svelte';
|
|
195
|
+
import { Breadcrumb, type BreadcrumbRoute } from '@fibrae/semi-ui-svelte';
|
|
196
|
+
|
|
197
|
+
const iconRoutes: (BreadcrumbRoute | string)[] = [{ path: '/', href: '/' }, { path: '/breadcrumb', href: '/zh-CN/navigation/breadcrumb', name: 'breadcrumb' }, 'with icon'];
|
|
198
|
+
</script>
|
|
199
|
+
|
|
200
|
+
<!-- Several breadcrumbs on one page are told apart by aria-label -->
|
|
201
|
+
<div>
|
|
202
|
+
<Breadcrumb aria-label="字符串路由" routes={['Semi-ui', 'Breadcrumb', 'Default']} />
|
|
203
|
+
<br />
|
|
204
|
+
<Breadcrumb aria-label="带图标的路由" routes={iconRoutes}>
|
|
205
|
+
{#snippet icon(iconContext)}
|
|
206
|
+
{#if iconContext.index === 0}
|
|
207
|
+
<IconHome aria-label="首页" class={iconContext.class} size={iconContext.size} />
|
|
208
|
+
{:else if iconContext.index === 1}
|
|
209
|
+
<IconArticle class={iconContext.class} size={iconContext.size} />
|
|
210
|
+
{/if}
|
|
211
|
+
{/snippet}
|
|
212
|
+
</Breadcrumb>
|
|
213
|
+
<br />
|
|
214
|
+
<Breadcrumb aria-label="长标题路由" routes={['首页', '当这个页面标题很长时需要省略', '详情页']} />
|
|
215
|
+
</div>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## API reference
|
|
219
|
+
|
|
220
|
+
### Breadcrumb
|
|
221
|
+
|
|
222
|
+
**Props**
|
|
223
|
+
|
|
224
|
+
| Property | Description | Type | Default |
|
|
225
|
+
| - | - | - | - |
|
|
226
|
+
| activeIndex | Controlled index of the current item, counted from 0. The last item is current when omitted. | `number` | - |
|
|
227
|
+
| autoCollapse | Whether items beyond maxItemCount collapse automatically. | `boolean` | `true` |
|
|
228
|
+
| compact | Whether the compact size is used. | `boolean` | `true` |
|
|
229
|
+
| icon | Icon of each item, with the route, its index, size and class as parameters. Pass the last two to the icon. An empty result renders no icon. | `Snippet<[BreadcrumbIconContext]>` | - |
|
|
230
|
+
| item | Custom title of each item, with the route and its index as parameters. It renders inline, without truncation. | `Snippet<[BreadcrumbRouteContext]>` | - |
|
|
231
|
+
| maxItemCount | Number of levels above which the breadcrumb collapses. | `number` | `4` |
|
|
232
|
+
| more | Custom ellipsis area. The parameter restItems holds the collapsed items as `{ route, index }`. | `Snippet<[BreadcrumbMoreContext]>` | - |
|
|
233
|
+
| moreType | Built-in rendering of the ellipsis area: default or popover. The more snippet wins when it is provided. | `BreadcrumbMoreType` | `"default"` |
|
|
234
|
+
| onClick | Called on click with the route of the item (`{ name }` for a string route) and the native MouseEvent. It is a function prop, not the native click listener of the nav; passing it makes items without href operable with Enter as well. | `BreadcrumbClick` | - |
|
|
235
|
+
| routes | Route information as an array of route objects or strings. | `Array<BreadcrumbRoute \| string>` | `[]` |
|
|
236
|
+
| separator | Separator, either text or a snippet. | `string \| Snippet` | `"/"` |
|
|
237
|
+
| showTooltip | Whether a Tooltip shows for an overflowing title, with its options: width is the overflow width, ellipsisPos truncates at the end or in the middle, and opts are passed to the Tooltip without content, with class and style landing on the popup. | `boolean \| BreadcrumbShowTooltip` | `{ width: 150, ellipsisPos: 'end' }` |
|
|
238
|
+
|
|
239
|
+
`class`, `style`, `aria-label` and other native attributes land on the `nav` root; `onClick` is a function prop, not the native click listener of the `nav`.
|
|
240
|
+
|
|
241
|
+
### Breadcrumb.Item
|
|
242
|
+
|
|
243
|
+
Svelte has no `Breadcrumb.Item`; the data of each item is described under Route below.
|
|
244
|
+
|
|
245
|
+
### Route
|
|
246
|
+
|
|
247
|
+
| Properties | Instructions | type | Default |
|
|
248
|
+
| - | - | - | - |
|
|
249
|
+
| href | Link destinations | `string` | - |
|
|
250
|
+
| name | Routing name | `string` | - |
|
|
251
|
+
| path | Routing path | `string` | - |
|
|
252
|
+
| noLink | To remove hover and active effect on an item | `boolean` | - |
|
|
253
|
+
| separator | Text separator of the item, used to override parent separator | `string` | - |
|
|
254
|
+
| key | Key of the item | `string \| number` | - |
|
|
255
|
+
|
|
256
|
+
The icon of a route is rendered by the `icon` snippet, and a custom title by the `item` snippet. `data-*` fields are passed to the item.
|
|
257
|
+
|
|
258
|
+
## Accessibility
|
|
259
|
+
|
|
260
|
+
- Breadcrumb supports the `aria-label` props to indicate the function of the Breadcrumb
|
|
261
|
+
- Breadcrumb will set `aria-current='page'` for the current item
|
|
262
|
+
|
|
263
|
+
## Content Guidelines
|
|
264
|
+
|
|
265
|
+
- Each page link should be short and clearly reflect the location or entity it links to
|
|
266
|
+
- Write in sentence case
|
|
267
|
+
|
|
268
|
+
## Design Tokens
|
|
269
|
+
|
|
270
|
+
The design token table of this component is on the web page: <https://semi-design-next.pages.dev/en-US/svelte/navigation/breadcrumb/>
|
|
271
|
+
|
|
272
|
+
## Changes from Semi Design
|
|
273
|
+
|
|
274
|
+
From the project release notes (written in Chinese). Your knowledge of Semi Design does not cover these.
|
|
275
|
+
|
|
276
|
+
- 破坏性:删除 `Breadcrumb.Item.isBreadcrumbItem`,改为声明 `elementType: 'Breadcrumb.Item'`;`onClick` 第一个参数类型改为 `BreadcrumbItemInfo | RouteProps`,children 写法下 `name` 是 `ReactNode`。
|
|
277
|
+
- `maxItemCount` 小于 2 时首项与当前项仍显示;`activeIndex` 指向折叠区间内的项时,当前项保持可见,改为隐藏其前后较长的一段;没有 `href` 的项仅在有 `onClick` 时可聚焦;非 `Breadcrumb.Item` 的子节点各包一层 `li` 后渲染。
|
|
278
|
+
- 破坏性:DOM 改为 APG 的 `nav > ol.semi-breadcrumb-list > li`,读屏报出项数。Breadcrumb.Item 的根元素与未声明属性的落点由 `span` 改为 `li`(React 的 `ref` 类型为 `HTMLLIElement`,Props 的原生属性随之按 `li` 声明);`moreType="popover"` 弹层里的隐藏项包在 `ol` 中,分隔符是带 `aria-hidden` 的 `li`;React `renderMore`、Vue `#more` 收到的项节点是 `li`,自行渲染时放进 `ol` 或 `ul`。按 `.semi-breadcrumb-wrapper > .semi-breadcrumb-item-wrap` 写的选择器改为经过 `.semi-breadcrumb-list`。
|
|
279
|
+
- 修复(Vue):显式传 `aria-label={undefined}` 时 `nav` 仍以语言包的 `Breadcrumb.label` 命名,与 React、Solid 一致。
|
|
280
|
+
- 修复(React):非 `Breadcrumb.Item` 的子元素才触发开发期告警;此前写反,合法的 `Breadcrumb.Item` 误报,`<div />` 等不报。
|
|
281
|
+
- Solid 破坏性:路由数据里不放节点。`RouteProps` 删除 `icon`,`name`、`separator` 改为 `string`;路由图标由 Breadcrumb 的 `renderIcon(route, index)` 提供(对应 Vue 的 `#icon="{ route, index }"`),自定义标题仍用 `renderItem(route)`;`Breadcrumb.Item` 的 `icon` 不变。
|
|
282
|
+
- Solid 破坏性:`renderMore` 收到被折叠项的数据 `Array<RouteProps | BreadcrumbItemProps>`(routes 写法为路由对象,children 写法为各 `Breadcrumb.Item` 的 props,其 `children`、`icon` 在显示处读取才创建),不再收到现成节点,由使用方渲染;隐藏项变化时重新调用。
|
|
283
|
+
- Svelte:只提供 `routes` 加 `item`、`icon`、`separator`、`more` snippet,不提供 `Breadcrumb.Item` 子组件;`separator` 是字符串或 snippet;`icon` snippet 的参数带 `size`、`class`,要由使用方传给图标;`more` snippet 收到 `restItems`(`{ route, index }` 数据);`item` snippet 的内容按内联渲染,不走截断的 Typography。
|
|
284
|
+
- React、Solid 破坏性(类型):`showTooltip` 对象形式的类型 `showToolTipProps` 改名 `ShowTooltipProps`。
|