@fibrae/semi-ui-svelte 0.9.1 → 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/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/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/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/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,592 @@
|
|
|
1
|
+
# Carousel
|
|
2
|
+
|
|
3
|
+
> Carousel is a media component that can display the effect of playing multiple pictures in turn in a visualization application.
|
|
4
|
+
|
|
5
|
+
Package: `@fibrae/semi-ui-svelte`. Web page: https://semi-design-next.pages.dev/en-US/svelte/show/carousel/
|
|
6
|
+
|
|
7
|
+
## Demos
|
|
8
|
+
|
|
9
|
+
### How to import
|
|
10
|
+
|
|
11
|
+
```svelte
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { Carousel } from '@fibrae/semi-ui-svelte';
|
|
14
|
+
</script>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Basic Carousel
|
|
18
|
+
|
|
19
|
+
Basic carousel
|
|
20
|
+
|
|
21
|
+
In Svelte the slides are rendered from `items` data and a `slide` snippet; the children form is not accepted. Write `{#snippet slide({ item, index })}...{/snippet}` inside the Carousel tag, one slide per item; the carousel wraps each slide in an element carrying the role and `inert`.
|
|
22
|
+
|
|
23
|
+
```svelte
|
|
24
|
+
<script lang="ts">
|
|
25
|
+
import { Carousel, Space, Typography } from '@fibrae/semi-ui-svelte';
|
|
26
|
+
|
|
27
|
+
const logo = '/assets/placeholder/logo.svg';
|
|
28
|
+
const slides = [
|
|
29
|
+
{
|
|
30
|
+
src: '/assets/carousel/bg-1.png',
|
|
31
|
+
title: 'Semi 设计管理系统',
|
|
32
|
+
lines: ['从 Semi Design,到 Any Design', '快速定制你的设计系统,并应用在设计稿和代码中'],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
src: '/assets/carousel/bg-2.png',
|
|
36
|
+
title: 'Semi 物料市场',
|
|
37
|
+
lines: ['面向业务场景的定制化组件,支持线上预览和调试', '内容由 Semi Design 用户共建'],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
src: '/assets/carousel/bg-3.png',
|
|
41
|
+
title: 'Semi 设计/代码模板',
|
|
42
|
+
lines: ['一套组件,四个框架原生可用', '在 React、Vue、Solid、Svelte 中共用同一套设计'],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
const titleStyle = 'position: absolute; top: 100px; left: 100px';
|
|
46
|
+
const colorStyle = 'color: #1C1F23';
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<Carousel items={slides} style="width: 100%; height: 400px" theme="dark">
|
|
50
|
+
{#snippet slide({ item })}
|
|
51
|
+
<div style="height: 100%; background-size: cover; background-image: url('{item.src}')">
|
|
52
|
+
<Space align="start" spacing="medium" style={titleStyle} vertical>
|
|
53
|
+
<img alt="semi_logo" src={logo} style="width: 87px; height: 31px" />
|
|
54
|
+
<Typography.Title heading={2} style={colorStyle}>{item.title}</Typography.Title>
|
|
55
|
+
<Space align="start" vertical>
|
|
56
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[0]}</Typography.Paragraph>
|
|
57
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[1]}</Typography.Paragraph>
|
|
58
|
+
</Space>
|
|
59
|
+
</Space>
|
|
60
|
+
</div>
|
|
61
|
+
{/snippet}
|
|
62
|
+
</Carousel>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Theme Switch
|
|
66
|
+
|
|
67
|
+
Three themes are defined by default: `primary`、`light`、`dark`
|
|
68
|
+
|
|
69
|
+
```svelte
|
|
70
|
+
<script lang="ts">
|
|
71
|
+
import { Carousel, Radio, RadioGroup, Space, Typography, type CarouselProps, type RadioValue } from '@fibrae/semi-ui-svelte';
|
|
72
|
+
|
|
73
|
+
let theme = $state<CarouselProps['theme']>('primary');
|
|
74
|
+
const logo = '/assets/placeholder/logo.svg';
|
|
75
|
+
const slides = [
|
|
76
|
+
{
|
|
77
|
+
src: '/assets/carousel/bg-1.png',
|
|
78
|
+
title: 'Semi 设计管理系统',
|
|
79
|
+
lines: ['从 Semi Design,到 Any Design', '快速定制你的设计系统,并应用在设计稿和代码中'],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
src: '/assets/carousel/bg-2.png',
|
|
83
|
+
title: 'Semi 物料市场',
|
|
84
|
+
lines: ['面向业务场景的定制化组件,支持线上预览和调试', '内容由 Semi Design 用户共建'],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
src: '/assets/carousel/bg-3.png',
|
|
88
|
+
title: 'Semi 设计/代码模板',
|
|
89
|
+
lines: ['一套组件,四个框架原生可用', '在 React、Vue、Solid、Svelte 中共用同一套设计'],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
const titleStyle = 'position: absolute; top: 100px; left: 100px';
|
|
93
|
+
const colorStyle = 'color: #1C1F23';
|
|
94
|
+
|
|
95
|
+
const changeTheme = (value?: RadioValue) => {
|
|
96
|
+
if (value === 'primary' || value === 'light' || value === 'dark') theme = value;
|
|
97
|
+
};
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<div>
|
|
101
|
+
<Carousel autoPlay={false} items={slides} style="width: 100%; height: 400px" {theme}>
|
|
102
|
+
{#snippet slide({ item })}
|
|
103
|
+
<div style="height: 100%; background-size: cover; background-image: url('{item.src}')">
|
|
104
|
+
<Space align="start" spacing="medium" style={titleStyle} vertical>
|
|
105
|
+
<img alt="semi_logo" src={logo} style="width: 87px; height: 31px" />
|
|
106
|
+
<Typography.Title heading={2} style={colorStyle}>{item.title}</Typography.Title>
|
|
107
|
+
<Space align="start" vertical>
|
|
108
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[0]}</Typography.Paragraph>
|
|
109
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[1]}</Typography.Paragraph>
|
|
110
|
+
</Space>
|
|
111
|
+
</Space>
|
|
112
|
+
</div>
|
|
113
|
+
{/snippet}
|
|
114
|
+
</Carousel>
|
|
115
|
+
<br />
|
|
116
|
+
<Space>
|
|
117
|
+
<div>主题</div>
|
|
118
|
+
<RadioGroup aria-label="主题" name="demo-carousel-theme" onChange={(e) => changeTheme(e.target.value)} type="button" value={theme}>
|
|
119
|
+
<Radio value="primary">primary</Radio>
|
|
120
|
+
<Radio value="light">light</Radio>
|
|
121
|
+
<Radio value="dark">dark</Radio>
|
|
122
|
+
</RadioGroup>
|
|
123
|
+
</Space>
|
|
124
|
+
</div>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Indicators
|
|
128
|
+
|
|
129
|
+
Indicators can be adjusted for type, position, size\
|
|
130
|
+
type: `dot`、`line`、`columnar`\
|
|
131
|
+
position: `left`、`center`、`right`\
|
|
132
|
+
size: `small`、`medium`
|
|
133
|
+
|
|
134
|
+
```svelte
|
|
135
|
+
<script lang="ts">
|
|
136
|
+
import { Carousel, Radio, RadioGroup, Space, Typography, type CarouselProps, type RadioValue } from '@fibrae/semi-ui-svelte';
|
|
137
|
+
|
|
138
|
+
let size = $state<CarouselProps['indicatorSize']>('small');
|
|
139
|
+
let type = $state<CarouselProps['indicatorType']>('dot');
|
|
140
|
+
let position = $state<CarouselProps['indicatorPosition']>('left');
|
|
141
|
+
const logo = '/assets/placeholder/logo.svg';
|
|
142
|
+
const slides = [
|
|
143
|
+
{
|
|
144
|
+
src: '/assets/carousel/bg-1.png',
|
|
145
|
+
title: 'Semi 设计管理系统',
|
|
146
|
+
lines: ['从 Semi Design,到 Any Design', '快速定制你的设计系统,并应用在设计稿和代码中'],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
src: '/assets/carousel/bg-2.png',
|
|
150
|
+
title: 'Semi 物料市场',
|
|
151
|
+
lines: ['面向业务场景的定制化组件,支持线上预览和调试', '内容由 Semi Design 用户共建'],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
src: '/assets/carousel/bg-3.png',
|
|
155
|
+
title: 'Semi 设计/代码模板',
|
|
156
|
+
lines: ['一套组件,四个框架原生可用', '在 React、Vue、Solid、Svelte 中共用同一套设计'],
|
|
157
|
+
},
|
|
158
|
+
];
|
|
159
|
+
const titleStyle = 'position: absolute; top: 100px; left: 100px';
|
|
160
|
+
const colorStyle = 'color: #1C1F23';
|
|
161
|
+
|
|
162
|
+
const changeType = (value?: RadioValue) => {
|
|
163
|
+
if (value === 'dot' || value === 'line' || value === 'columnar') type = value;
|
|
164
|
+
};
|
|
165
|
+
const changePosition = (value?: RadioValue) => {
|
|
166
|
+
if (value === 'left' || value === 'center' || value === 'right') position = value;
|
|
167
|
+
};
|
|
168
|
+
const changeSize = (value?: RadioValue) => {
|
|
169
|
+
if (value === 'small' || value === 'medium') size = value;
|
|
170
|
+
};
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<div>
|
|
174
|
+
<Carousel autoPlay={false} indicatorPosition={position} indicatorSize={size} indicatorType={type} items={slides} style="width: 100%; height: 400px" theme="dark">
|
|
175
|
+
{#snippet slide({ item })}
|
|
176
|
+
<div style="height: 100%; background-size: cover; background-image: url('{item.src}')">
|
|
177
|
+
<Space align="start" spacing="medium" style={titleStyle} vertical>
|
|
178
|
+
<img alt="semi_logo" src={logo} style="width: 87px; height: 31px" />
|
|
179
|
+
<Typography.Title heading={2} style={colorStyle}>{item.title}</Typography.Title>
|
|
180
|
+
<Space align="start" vertical>
|
|
181
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[0]}</Typography.Paragraph>
|
|
182
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[1]}</Typography.Paragraph>
|
|
183
|
+
</Space>
|
|
184
|
+
</Space>
|
|
185
|
+
</div>
|
|
186
|
+
{/snippet}
|
|
187
|
+
</Carousel>
|
|
188
|
+
<br />
|
|
189
|
+
<Space align="start" vertical>
|
|
190
|
+
<Space>
|
|
191
|
+
<div>类型</div>
|
|
192
|
+
<RadioGroup aria-label="指示器类型" name="demo-carousel-indicator-type" onChange={(e) => changeType(e.target.value)} type="button" value={type}>
|
|
193
|
+
<Radio value="dot">dot</Radio>
|
|
194
|
+
<Radio value="line">line</Radio>
|
|
195
|
+
<Radio value="columnar">columnar</Radio>
|
|
196
|
+
</RadioGroup>
|
|
197
|
+
</Space>
|
|
198
|
+
<Space>
|
|
199
|
+
<div>位置</div>
|
|
200
|
+
<RadioGroup aria-label="指示器位置" name="demo-carousel-indicator-position" onChange={(e) => changePosition(e.target.value)} type="button" value={position}>
|
|
201
|
+
<Radio value="left">left</Radio>
|
|
202
|
+
<Radio value="center">center</Radio>
|
|
203
|
+
<Radio value="right">right</Radio>
|
|
204
|
+
</RadioGroup>
|
|
205
|
+
</Space>
|
|
206
|
+
<Space>
|
|
207
|
+
<div>尺寸</div>
|
|
208
|
+
<RadioGroup aria-label="指示器尺寸" name="demo-carousel-indicator-size" onChange={(e) => changeSize(e.target.value)} type="button" value={size}>
|
|
209
|
+
<Radio value="small">small</Radio>
|
|
210
|
+
<Radio value="medium">medium</Radio>
|
|
211
|
+
</RadioGroup>
|
|
212
|
+
</Space>
|
|
213
|
+
</Space>
|
|
214
|
+
</div>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Arrows
|
|
218
|
+
|
|
219
|
+
Control whether the arrow is visible through the showArrow property\
|
|
220
|
+
If the arrow is visible, use the arrowType property to control the timing of the arrow display
|
|
221
|
+
|
|
222
|
+
```svelte
|
|
223
|
+
<script lang="ts">
|
|
224
|
+
import { Carousel, Radio, RadioGroup, Space, Typography, type CarouselProps, type RadioValue } from '@fibrae/semi-ui-svelte';
|
|
225
|
+
|
|
226
|
+
let arrowType = $state<CarouselProps['arrowType']>('always');
|
|
227
|
+
let show = $state(true);
|
|
228
|
+
const logo = '/assets/placeholder/logo.svg';
|
|
229
|
+
const slides = [
|
|
230
|
+
{
|
|
231
|
+
src: '/assets/carousel/bg-1.png',
|
|
232
|
+
title: 'Semi 设计管理系统',
|
|
233
|
+
lines: ['从 Semi Design,到 Any Design', '快速定制你的设计系统,并应用在设计稿和代码中'],
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
src: '/assets/carousel/bg-2.png',
|
|
237
|
+
title: 'Semi 物料市场',
|
|
238
|
+
lines: ['面向业务场景的定制化组件,支持线上预览和调试', '内容由 Semi Design 用户共建'],
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
src: '/assets/carousel/bg-3.png',
|
|
242
|
+
title: 'Semi 设计/代码模板',
|
|
243
|
+
lines: ['一套组件,四个框架原生可用', '在 React、Vue、Solid、Svelte 中共用同一套设计'],
|
|
244
|
+
},
|
|
245
|
+
];
|
|
246
|
+
const titleStyle = 'position: absolute; top: 100px; left: 100px';
|
|
247
|
+
const colorStyle = 'color: #1C1F23';
|
|
248
|
+
|
|
249
|
+
const changeShow = (value?: RadioValue) => {
|
|
250
|
+
if (typeof value === 'boolean') show = value;
|
|
251
|
+
};
|
|
252
|
+
const changeArrowType = (value?: RadioValue) => {
|
|
253
|
+
if (value === 'always' || value === 'hover') arrowType = value;
|
|
254
|
+
};
|
|
255
|
+
</script>
|
|
256
|
+
|
|
257
|
+
<div>
|
|
258
|
+
<Carousel {arrowType} autoPlay={false} items={slides} showArrow={show} style="width: 100%; height: 400px" theme="dark">
|
|
259
|
+
{#snippet slide({ item })}
|
|
260
|
+
<div style="height: 100%; background-size: cover; background-image: url('{item.src}')">
|
|
261
|
+
<Space align="start" spacing="medium" style={titleStyle} vertical>
|
|
262
|
+
<img alt="semi_logo" src={logo} style="width: 87px; height: 31px" />
|
|
263
|
+
<Typography.Title heading={2} style={colorStyle}>{item.title}</Typography.Title>
|
|
264
|
+
<Space align="start" vertical>
|
|
265
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[0]}</Typography.Paragraph>
|
|
266
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[1]}</Typography.Paragraph>
|
|
267
|
+
</Space>
|
|
268
|
+
</Space>
|
|
269
|
+
</div>
|
|
270
|
+
{/snippet}
|
|
271
|
+
</Carousel>
|
|
272
|
+
<br />
|
|
273
|
+
<Space align="start" vertical>
|
|
274
|
+
<Space>
|
|
275
|
+
<div>展示箭头</div>
|
|
276
|
+
<RadioGroup aria-label="展示箭头" name="demo-carousel-visibility" onChange={(e) => changeShow(e.target.value)} type="button" value={show}>
|
|
277
|
+
<Radio value>show</Radio>
|
|
278
|
+
<Radio value={false}>hide</Radio>
|
|
279
|
+
</RadioGroup>
|
|
280
|
+
</Space>
|
|
281
|
+
<Space>
|
|
282
|
+
<div>展示时机</div>
|
|
283
|
+
<RadioGroup aria-label="展示时机" name="demo-carousel-arrow-type" onChange={(e) => changeArrowType(e.target.value)} type="button" value={arrowType}>
|
|
284
|
+
<Radio value="always">always</Radio>
|
|
285
|
+
<Radio value="hover">hover</Radio>
|
|
286
|
+
</RadioGroup>
|
|
287
|
+
</Space>
|
|
288
|
+
</Space>
|
|
289
|
+
</div>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Custom Arrow
|
|
293
|
+
|
|
294
|
+
Customize the attributes of the arrow buttons (`aria-label`, `style`, `onclick` and so on) through `leftArrow.props` and `rightArrow.props` of `arrowProps`; your `onclick` runs before the built-in handler and your `class` is merged with the built-in classes. Use the `leftArrow` and `rightArrow` snippets for the icons; an empty snippet leaves the button empty.
|
|
295
|
+
|
|
296
|
+
```svelte
|
|
297
|
+
<script lang="ts">
|
|
298
|
+
import { IconArrowLeft, IconArrowRight } from '@fibrae/semi-icons-svelte';
|
|
299
|
+
import { Carousel, Space, Typography } from '@fibrae/semi-ui-svelte';
|
|
300
|
+
|
|
301
|
+
const logo = '/assets/placeholder/logo.svg';
|
|
302
|
+
const slides = [
|
|
303
|
+
{
|
|
304
|
+
src: '/assets/carousel/bg-1.png',
|
|
305
|
+
title: 'Semi 设计管理系统',
|
|
306
|
+
lines: ['从 Semi Design,到 Any Design', '快速定制你的设计系统,并应用在设计稿和代码中'],
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
src: '/assets/carousel/bg-2.png',
|
|
310
|
+
title: 'Semi 物料市场',
|
|
311
|
+
lines: ['面向业务场景的定制化组件,支持线上预览和调试', '内容由 Semi Design 用户共建'],
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
src: '/assets/carousel/bg-3.png',
|
|
315
|
+
title: 'Semi 设计/代码模板',
|
|
316
|
+
lines: ['一套组件,四个框架原生可用', '在 React、Vue、Solid、Svelte 中共用同一套设计'],
|
|
317
|
+
},
|
|
318
|
+
];
|
|
319
|
+
const titleStyle = 'position: absolute; top: 100px; left: 100px';
|
|
320
|
+
const colorStyle = 'color: #1C1F23';
|
|
321
|
+
const arrowProps = {
|
|
322
|
+
leftArrow: { props: { 'aria-label': '上一张' } },
|
|
323
|
+
rightArrow: { props: { 'aria-label': '下一张' } },
|
|
324
|
+
};
|
|
325
|
+
</script>
|
|
326
|
+
|
|
327
|
+
<div>
|
|
328
|
+
<Carousel {arrowProps} autoPlay={false} items={slides} style="width: 100%; height: 400px" theme="dark">
|
|
329
|
+
{#snippet slide({ item })}
|
|
330
|
+
<div style="height: 100%; background-size: cover; background-image: url('{item.src}')">
|
|
331
|
+
<Space align="start" spacing="medium" style={titleStyle} vertical>
|
|
332
|
+
<img alt="semi_logo" src={logo} style="width: 87px; height: 31px" />
|
|
333
|
+
<Typography.Title heading={2} style={colorStyle}>{item.title}</Typography.Title>
|
|
334
|
+
<Space align="start" vertical>
|
|
335
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[0]}</Typography.Paragraph>
|
|
336
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[1]}</Typography.Paragraph>
|
|
337
|
+
</Space>
|
|
338
|
+
</Space>
|
|
339
|
+
</div>
|
|
340
|
+
{/snippet}
|
|
341
|
+
{#snippet leftArrow()}
|
|
342
|
+
<IconArrowLeft size="large" />
|
|
343
|
+
{/snippet}
|
|
344
|
+
{#snippet rightArrow()}
|
|
345
|
+
<IconArrowRight size="large" />
|
|
346
|
+
{/snippet}
|
|
347
|
+
</Carousel>
|
|
348
|
+
</div>
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Play Parameters
|
|
352
|
+
|
|
353
|
+
Pass the parameter interval to autoPlay to control the time interval between two pictures, and pass hoverToPause to control whether to stop playing when the mouse is placed on the picture
|
|
354
|
+
|
|
355
|
+
A carousel mounted with no more than one slide does not play; when slides are added later and there are more than one, it starts playing according to `autoPlay`.
|
|
356
|
+
|
|
357
|
+
```svelte
|
|
358
|
+
<script lang="ts">
|
|
359
|
+
import { Carousel, Space, Typography } from '@fibrae/semi-ui-svelte';
|
|
360
|
+
|
|
361
|
+
const logo = '/assets/placeholder/logo.svg';
|
|
362
|
+
const slides = [
|
|
363
|
+
{
|
|
364
|
+
src: '/assets/carousel/bg-1.png',
|
|
365
|
+
title: 'Semi 设计管理系统',
|
|
366
|
+
lines: ['从 Semi Design,到 Any Design', '快速定制你的设计系统,并应用在设计稿和代码中'],
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
src: '/assets/carousel/bg-2.png',
|
|
370
|
+
title: 'Semi 物料市场',
|
|
371
|
+
lines: ['面向业务场景的定制化组件,支持线上预览和调试', '内容由 Semi Design 用户共建'],
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
src: '/assets/carousel/bg-3.png',
|
|
375
|
+
title: 'Semi 设计/代码模板',
|
|
376
|
+
lines: ['一套组件,四个框架原生可用', '在 React、Vue、Solid、Svelte 中共用同一套设计'],
|
|
377
|
+
},
|
|
378
|
+
];
|
|
379
|
+
const titleStyle = 'position: absolute; top: 100px; left: 100px';
|
|
380
|
+
const colorStyle = 'color: #1C1F23';
|
|
381
|
+
</script>
|
|
382
|
+
|
|
383
|
+
<div>
|
|
384
|
+
<Carousel autoPlay={{ interval: 1500, hoverToPause: true }} items={slides} style="width: 100%; height: 400px" theme="dark">
|
|
385
|
+
{#snippet slide({ item })}
|
|
386
|
+
<div style="height: 100%; background-size: cover; background-image: url('{item.src}')">
|
|
387
|
+
<Space align="start" spacing="medium" style={titleStyle} vertical>
|
|
388
|
+
<img alt="semi_logo" src={logo} style="width: 87px; height: 31px" />
|
|
389
|
+
<Typography.Title heading={2} style={colorStyle}>{item.title}</Typography.Title>
|
|
390
|
+
<Space align="start" vertical>
|
|
391
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[0]}</Typography.Paragraph>
|
|
392
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[1]}</Typography.Paragraph>
|
|
393
|
+
</Space>
|
|
394
|
+
</Space>
|
|
395
|
+
</div>
|
|
396
|
+
{/snippet}
|
|
397
|
+
</Carousel>
|
|
398
|
+
</div>
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Animation and Speed
|
|
402
|
+
|
|
403
|
+
Control the animation by giving the animation property, optional values are `fade`, `slide`\
|
|
404
|
+
Control the switching time between two pictures by giving the speed attribute, the unit is ms
|
|
405
|
+
|
|
406
|
+
```svelte
|
|
407
|
+
<script lang="ts">
|
|
408
|
+
import { Carousel, Space, Typography } from '@fibrae/semi-ui-svelte';
|
|
409
|
+
|
|
410
|
+
const logo = '/assets/placeholder/logo.svg';
|
|
411
|
+
const slides = [
|
|
412
|
+
{
|
|
413
|
+
src: '/assets/carousel/bg-1.png',
|
|
414
|
+
title: 'Semi 设计管理系统',
|
|
415
|
+
lines: ['从 Semi Design,到 Any Design', '快速定制你的设计系统,并应用在设计稿和代码中'],
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
src: '/assets/carousel/bg-2.png',
|
|
419
|
+
title: 'Semi 物料市场',
|
|
420
|
+
lines: ['面向业务场景的定制化组件,支持线上预览和调试', '内容由 Semi Design 用户共建'],
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
src: '/assets/carousel/bg-3.png',
|
|
424
|
+
title: 'Semi 设计/代码模板',
|
|
425
|
+
lines: ['一套组件,四个框架原生可用', '在 React、Vue、Solid、Svelte 中共用同一套设计'],
|
|
426
|
+
},
|
|
427
|
+
];
|
|
428
|
+
const titleStyle = 'position: absolute; top: 100px; left: 100px';
|
|
429
|
+
const colorStyle = 'color: #1C1F23';
|
|
430
|
+
</script>
|
|
431
|
+
|
|
432
|
+
<div>
|
|
433
|
+
<Carousel animation="fade" autoPlay={false} items={slides} speed={1000} style="width: 100%; height: 400px" theme="dark">
|
|
434
|
+
{#snippet slide({ item })}
|
|
435
|
+
<div style="height: 100%; background-size: cover; background-image: url('{item.src}')">
|
|
436
|
+
<Space align="start" spacing="medium" style={titleStyle} vertical>
|
|
437
|
+
<img alt="semi_logo" src={logo} style="width: 87px; height: 31px" />
|
|
438
|
+
<Typography.Title heading={2} style={colorStyle}>{item.title}</Typography.Title>
|
|
439
|
+
<Space align="start" vertical>
|
|
440
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[0]}</Typography.Paragraph>
|
|
441
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[1]}</Typography.Paragraph>
|
|
442
|
+
</Space>
|
|
443
|
+
</Space>
|
|
444
|
+
</div>
|
|
445
|
+
{/snippet}
|
|
446
|
+
</Carousel>
|
|
447
|
+
</div>
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### Controlled Carousel
|
|
451
|
+
|
|
452
|
+
Bind the current index with `bind:activeIndex`; `onChange(activeIndex, preIndex)` additionally gives the new index and the previous one. Call `play`, `stop`, `goTo`, `prev` and `next` through `bind:this`.
|
|
453
|
+
|
|
454
|
+
```svelte
|
|
455
|
+
<script lang="ts">
|
|
456
|
+
import { Carousel, Space, Typography } from '@fibrae/semi-ui-svelte';
|
|
457
|
+
|
|
458
|
+
let activeIndex = $state(0);
|
|
459
|
+
const logo = '/assets/placeholder/logo.svg';
|
|
460
|
+
const slides = [
|
|
461
|
+
{
|
|
462
|
+
src: '/assets/carousel/bg-1.png',
|
|
463
|
+
title: 'Semi 设计管理系统',
|
|
464
|
+
lines: ['从 Semi Design,到 Any Design', '快速定制你的设计系统,并应用在设计稿和代码中'],
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
src: '/assets/carousel/bg-2.png',
|
|
468
|
+
title: 'Semi 物料市场',
|
|
469
|
+
lines: ['面向业务场景的定制化组件,支持线上预览和调试', '内容由 Semi Design 用户共建'],
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
src: '/assets/carousel/bg-3.png',
|
|
473
|
+
title: 'Semi 设计/代码模板',
|
|
474
|
+
lines: ['一套组件,四个框架原生可用', '在 React、Vue、Solid、Svelte 中共用同一套设计'],
|
|
475
|
+
},
|
|
476
|
+
];
|
|
477
|
+
const titleStyle = 'position: absolute; top: 100px; left: 100px';
|
|
478
|
+
const colorStyle = 'color: #1C1F23';
|
|
479
|
+
</script>
|
|
480
|
+
|
|
481
|
+
<div>
|
|
482
|
+
<Carousel autoPlay={false} bind:activeIndex items={slides} style="width: 100%; height: 400px" theme="dark">
|
|
483
|
+
{#snippet slide({ item })}
|
|
484
|
+
<div style="height: 100%; background-size: cover; background-image: url('{item.src}')">
|
|
485
|
+
<Space align="start" spacing="medium" style={titleStyle} vertical>
|
|
486
|
+
<img alt="semi_logo" src={logo} style="width: 87px; height: 31px" />
|
|
487
|
+
<Typography.Title heading={2} style={colorStyle}>{item.title}</Typography.Title>
|
|
488
|
+
<Space align="start" vertical>
|
|
489
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[0]}</Typography.Paragraph>
|
|
490
|
+
<Typography.Paragraph style={colorStyle}>{item.lines[1]}</Typography.Paragraph>
|
|
491
|
+
</Space>
|
|
492
|
+
</Space>
|
|
493
|
+
</div>
|
|
494
|
+
{/snippet}
|
|
495
|
+
</Carousel>
|
|
496
|
+
</div>
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### API reference
|
|
500
|
+
|
|
501
|
+
**Props**
|
|
502
|
+
|
|
503
|
+
| Property | Description | Type | Default |
|
|
504
|
+
| - | - | - | - |
|
|
505
|
+
| activeIndex | Index of the slide being shown; bind it with `bind:activeIndex`. Passing undefined hands control back, continuing from the last controlled index. | `number` | - |
|
|
506
|
+
| animation | Transition animation: slide or fade. | `'fade' \| 'slide'` | `"slide"` |
|
|
507
|
+
| arrowProps | Data for the previous and next arrow buttons: `leftArrow.props` and `rightArrow.props` hold the button attributes. `onclick` and `class` are merged with the built-in handler and classes. Use the `leftArrow` and `rightArrow` snippets for the icons. | `ArrowProps` | - |
|
|
508
|
+
| arrowType | When the arrows are shown: always or hover. | `'always' \| 'hover'` | `"always"` |
|
|
509
|
+
| autoPlay | Whether to play automatically, or an object with interval (milliseconds between slides, default 2000) and hoverToPause (pause while hovered, default true). | `CarouselAutoPlay` | `true` |
|
|
510
|
+
| indicatorPosition | Indicator position: left, center or right. | `'center' \| 'left' \| 'right'` | `"center"` |
|
|
511
|
+
| indicatorSize | Indicator size: small or medium. | `'medium' \| 'small'` | `"small"` |
|
|
512
|
+
| indicatorType | Indicator type: dot, line or columnar. | `'columnar' \| 'dot' \| 'line'` | `"dot"` |
|
|
513
|
+
| items | Data for the slides, one per item, rendered by the `slide` snippet; the count is known before the first render. | `readonly T[]` | - |
|
|
514
|
+
| leftArrow | Snippet for the icon of the previous arrow. An empty snippet leaves the button empty. | `Snippet` | - |
|
|
515
|
+
| onChange | Called when the shown slide changes, with the new index and the previous index. | `(activeIndex: number, preIndex: number) => void` | - |
|
|
516
|
+
| onfocusin | Called when focus enters the carousel; autoplay pauses as well. | `FocusEventHandler<T> \| null` | - |
|
|
517
|
+
| onfocusout | Called when focus leaves the carousel; autoplay resumes as well. | `FocusEventHandler<T> \| null` | - |
|
|
518
|
+
| onmouseenter | Called when the pointer enters the carousel; with `hoverToPause` autoplay pauses as well. | `MouseEventHandler<T> \| null` | - |
|
|
519
|
+
| onmouseleave | Called when the pointer leaves the carousel; autoplay resumes as well. | `MouseEventHandler<T> \| null` | - |
|
|
520
|
+
| rightArrow | Snippet for the icon of the next arrow. An empty snippet leaves the button empty. | `Snippet` | - |
|
|
521
|
+
| showArrow | Whether to show the arrows. | `boolean` | `true` |
|
|
522
|
+
| showIndicator | Whether to show the indicator. | `boolean` | `true` |
|
|
523
|
+
| slide | Snippet for the content of one slide, with the parameter `{ item, index }`; the carousel wraps each slide in an element carrying the classes, role and `inert`. | `Snippet<[CarouselSlideContext<T>]>` | - |
|
|
524
|
+
| slideDirection | Slide direction when the animation is slide: left or right. | `'left' \| 'right'` | `"left"` |
|
|
525
|
+
| speed | Transition duration in milliseconds. | `number` | `300` |
|
|
526
|
+
| theme | Theme of the indicator and arrows: primary, light or dark. | `'dark' \| 'light' \| 'primary'` | `"light"` |
|
|
527
|
+
| trigger | How the indicator switches slides: click or hover. | `'click' \| 'hover'` | `"click"` |
|
|
528
|
+
|
|
529
|
+
**Methods**
|
|
530
|
+
|
|
531
|
+
| Method | Description | Type |
|
|
532
|
+
| - | - | - |
|
|
533
|
+
| goTo | Goes to the given index; an out-of-range index wraps around. | `(targetIndex: number) => void` |
|
|
534
|
+
| next | Goes to the next slide. | `() => void` |
|
|
535
|
+
| play | Starts autoplay, even when autoPlay is off. | `() => void` |
|
|
536
|
+
| prev | Goes to the previous slide. | `() => void` |
|
|
537
|
+
| stop | Stops autoplay. | `() => void` |
|
|
538
|
+
|
|
539
|
+
`class`, `style` and native attributes, including `aria-label` and `aria-labelledby`, land on the root element (`role="region"`).
|
|
540
|
+
|
|
541
|
+
## Accessibility
|
|
542
|
+
|
|
543
|
+
Carousel follows the [WAI-ARIA Carousel](https://www.w3.org/WAI/ARIA/apg/patterns/carousel/) pattern.
|
|
544
|
+
|
|
545
|
+
### ARIA
|
|
546
|
+
|
|
547
|
+
- The root is `role="region"` with `aria-roledescription` "carousel". A region needs a name to become a landmark, so describe what the carousel shows with `aria-label` or `aria-labelledby`.
|
|
548
|
+
- With indicators, each slide is the `tabpanel` of its indicator (`tab`), linked by `aria-controls` and `aria-labelledby`; an `id` already on a slide is kept. Without indicators, each slide is `role="group"` with `aria-roledescription` "slide" and the name "Slide N".
|
|
549
|
+
- Slides other than the current one are `inert`: their content cannot be focused and screen readers skip it. A slide must be an element or a component that puts props such as `inert`, `role` and `id` on its DOM, just like the class name and style.
|
|
550
|
+
- The slides container is `aria-live="off"` while rotating and `polite` otherwise, so a slide the user switches to is announced and an automatic switch is not.
|
|
551
|
+
- The arrow buttons are named from the locale ("Previous index", "Next index") by default; custom arrow content with readable text (text, or an element with `aria-label`) names the button instead; a name passed with `arrowProps.leftArrow.props['aria-label']` or its right counterpart wins over both.
|
|
552
|
+
|
|
553
|
+
### Keyboard and Focus
|
|
554
|
+
|
|
555
|
+
- Keyboard focus inside the carousel (an arrow, an indicator or focusable content in a slide) pauses autoplay until focus leaves, after which autoplay resumes (the APG advises staying stopped, which this differs from), and switching from the keyboard meanwhile does not restart it. A mouse click on an arrow does not pause.
|
|
556
|
+
- The previous and next arrows are native `button` elements: focus them with `Tab` and activate them with `Enter` or `Space`.
|
|
557
|
+
- The indicators form a `tablist` in which only the current one is in the `Tab` sequence. While focus is on an indicator:
|
|
558
|
+
- `ArrowLeft` goes to the previous slide and `ArrowRight` to the next one, wrapping around at both ends, and focus follows to the new current indicator. In RTL the directions are swapped.
|
|
559
|
+
- `Home` goes to the first slide and `End` to the last one.
|
|
560
|
+
|
|
561
|
+
## Design Tokens
|
|
562
|
+
|
|
563
|
+
The design token table of this component is on the web page: <https://semi-design-next.pages.dev/en-US/svelte/show/carousel/>
|
|
564
|
+
|
|
565
|
+
## Changes from Semi Design
|
|
566
|
+
|
|
567
|
+
From the project release notes (written in Chinese). Your knowledge of Semi Design does not cover these.
|
|
568
|
+
|
|
569
|
+
- ScrollList:滚动列(TimePicker 的时间列同用)的键盘处理放行带 Alt、Ctrl、Meta 的按键(如 Alt+ArrowDown),不再 `preventDefault`、不改选中项。
|
|
570
|
+
- Carousel:`ref.stop()` 后手动切换、焦点离开、幻灯片增加等都不再恢复自动播放,直到 `ref.play()`;`prefers-reduced-motion: reduce` 时不自动播放且无切换动画;键盘焦点进入时暂停自动播放;非当前幻灯片带 `inert`。
|
|
571
|
+
- Carousel 箭头改为原生 `<button type="button">`(`arrowProps.*.props` 类型改为 `ButtonHTMLAttributes<HTMLButtonElement>`),指示点改为 `role="tab"` 的 button;新增语言包键 `Carousel.indicators`、`Carousel.slideN`、`Carousel.carousel`、`Carousel.slide`(自定义语言包需补齐)与主题变量 `$radius-carousel_arrow`,箭头高度由 39px 改为 32px。
|
|
572
|
+
- Typography 的复制按钮与展开、收起控件改为原生 `<button type="button">`,`ellipsis.onExpand` 事件类型改为 `React.MouseEvent<HTMLButtonElement>`,复制按钮不再带内联 `margin-left`;`ellipsis` 对象中写成 `undefined` 的 `rows`、`pos`、`suffix` 取默认值(`1`、`'end'`、`''`);无 `href` 的 `link` 有点击监听时获得 `role="link"`;`disabled` 的 `link` 不再触发 `link.onClick`。
|
|
573
|
+
- 修复(Vue、Svelte):`link` 里写成 `undefined` 的 `aria-describedby` 不再覆盖省略提示的关联,链接仍以 Tooltip 作描述,与 React、Solid 一致。
|
|
574
|
+
- 破坏性:Numeral 不再支持函数 children;`CopyableConfig`、`LinkType` 的深路径从 `typography/title` 移到 `typography/interface`;`BaseTypographyProps` 不再从入口导出;类型上 `ScrollItemProps` 不再包含 `children`,ScrollItem 的 `motion` 收为 `boolean`,`onSelect` 参数收窄为 `T & { type?: string | number; index: number }`。
|
|
575
|
+
- 破坏性(类型):React、Solid 的 `CopyableProps` 的 `content`、`duration` 必填,经 `Typography` 的 `copyable` 使用不受影响。
|
|
576
|
+
- React、Solid 破坏性(深路径导入):`typography/copyable` 只有默认导出,删除同名的具名导出 `Copyable`。
|
|
577
|
+
- ScrollList 的各列不显示滚动条(原来随系统设置显示),用滚轮、拖动或方向键滚动。
|
|
578
|
+
- ScrollItem wheel 模式的高亮行(`.semi-scrolllist-item-selected`)由渲染输出,重新渲染改写类名时不再丢失;React、Solid 的 `transform` 参数 `value` 类型为 `T['value']`(原为 `any`),与 Vue、Svelte 一致。
|
|
579
|
+
- Solid 破坏性:箭头内容由 `arrowProps.leftArrow.children`、`arrowProps.rightArrow.children` 改为 Carousel 的 `leftArrow`、`rightArrow` 属性(`JSX.Element`,`null` 时按钮为空,与 Vue 的 `#leftArrow`、`#rightArrow` 一致),只在显示箭头时创建,`ArrowButton` 只剩 `props`;箭头按钮的 `x-semi-prop` 改为 `leftArrow`、`rightArrow`。
|
|
580
|
+
- Solid 破坏性(类型):`copyable` 配置的 `copyTip`、`successTip` 改为 `string | (() => JSX.Element)`,`icon` 改为 `() => JSX.Element`(`icon: () => <X />`),只在对应内容显示时调用。
|
|
581
|
+
- Solid 破坏性:Numeral 只格式化字符串与数字 children,每个分别格式化(动态插值 `{price()}` 单独成段,与 React 一致);元素 children(含子组件渲染出的元素)原样输出,其中的文字不格式化。copyable 按钮的可访问名称只取字符串的 `copyTip`(未复制时)与 `successTip`(已复制时),否则用语言包的 `copy`、`copied`;`icon`、`successTip` 渲染出的元素上的 `aria-label` 不再参与命名。
|
|
582
|
+
- Svelte 破坏性:Carousel 的幻灯片用 `items` 数据 prop 加 `slide` snippet(参数 `{ item, index }`),不接受 children 形式,Carousel 给每张包一层带 role、`inert` 的元素;箭头内容为 `leftArrow`、`rightArrow` snippet;`activeIndex` 可绑定,回调 `onChange(activeIndex, preIndex)`;`play`、`stop`、`goTo`、`prev`、`next` 经 `bind:this` 调用。
|
|
583
|
+
- Svelte:Typography 的 `Text`、`Title`、`Paragraph`、`Numeral` 与根组件 `Typography` 均为具名导出,平铺在包根;`copyable` 配置对象只含 `content`、`duration`、`class`、`style`(字符串)、`onCopy`,图标、提示、自定义渲染改用 snippet `copyIcon`、`copyTip`、`copySuccessTip`、`copyAction`(参数 `{ copied, copy, config }`);`ellipsis` 的 `onExpand` 写在 `ellipsis` 配置里。
|
|
584
|
+
- Svelte:`showTooltip` 的 `opts` 同时接受 Tooltip 与 Popover 属性(`type` 为 `'popover'` 时渲染带箭头的 Popover,类名含 `semi-typography-ellipsis-popover`),提示内容用 `ellipsisContent` snippet,整体接管提示用 `ellipsisTooltip` snippet(参数 `{ content, trigger }`);`icon` 为 snippet;`component` 只接受字符串标签名。
|
|
585
|
+
- Svelte:省略截断时,完整文本留在 DOM 中并设 `hidden`,根元素的 `textContent` 含全文;Numeral 格式化与图标 small 尺寸在挂载后才应用,服务端输出原始文本与默认图标尺寸。
|
|
586
|
+
- Svelte:ScrollList 的 `header`、`footer` 接受字符串或 snippet,传了就渲染;ScrollItem 的 `selectedIndex` 可绑定,配 `onSelect(data)`;`ScrollList.Item` 与具名导出 `ScrollItem` 是同一组件;`scrollToIndex` 经 `bind:this` 调用。
|
|
587
|
+
- 破坏性(Solid):Carousel 给每张幻灯片外包一层 `div.semi-carousel-content-item`,class、`role`、`aria-*`、`id`、`inert` 与切换动画写在包装元素上,使用方的幻灯片元素原样保留,要撑满轮播区域需自己设置 `height: 100%`(同 Svelte);按幻灯片元素写的 `.semi-carousel-content-item` 选择器改为选包装元素;幻灯片自带的 `id`、`aria-label` 不再用作 tab 的 `aria-controls` 目标与幻灯片名称。服务端 HTML 已带这些 class 与属性。
|
|
588
|
+
- Typography(React):`showTooltip.type` 显式为 `undefined` 时按默认 Tooltip 渲染,不再抛错。
|
|
589
|
+
- Typography:Numeral 不接受 `ellipsis`(类型与文档本就未声明),经透传带上也不截断(四个框架一致)。
|
|
590
|
+
- Typography:展开后按钮消失(可展开且不可收起)时,只在按钮持有焦点的情况下,于按钮移除后把焦点交给文字根元素(`tabindex="-1"`);按钮保留时焦点留在按钮上。React、Solid 不再在点击时无条件同步聚焦根元素(四个框架一致)。
|
|
591
|
+
- Typography(Vue):JS 省略的首帧按原插槽渲染,测量后再截断,放得下的内容不再先压成纯文本再恢复。
|
|
592
|
+
- ScrollList:cycled wheel 不再移动 `<li>`,DOM 顺序就是渲染顺序,列表长度变化后顺序、选中定位与点击回调值都正确,选中项立即定位且无动画。隐藏状态下挂载或隐藏后再显示的列,显示时定位到选中项,不触发 `onSelect`。任何定位都取消进行中的滚动动画,包括 `scrollToIndex(_, 0)`。删除 `ItemFoundation` 的 `shouldAppend`、`shouldPrepend`。
|