@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.
Files changed (165) hide show
  1. package/README.md +8 -4
  2. package/README.zh-CN.md +8 -4
  3. package/dist/components/anchor/interface.d.ts +14 -0
  4. package/dist/components/audio-player/interface.d.ts +5 -0
  5. package/dist/components/auto-complete/interface.d.ts +29 -0
  6. package/dist/components/avatar/interface.d.ts +24 -0
  7. package/dist/components/backtop/interface.d.ts +2 -0
  8. package/dist/components/badge/interface.d.ts +7 -0
  9. package/dist/components/banner/interface.d.ts +7 -0
  10. package/dist/components/breadcrumb/interface.d.ts +10 -0
  11. package/dist/components/button/interface.d.ts +18 -0
  12. package/dist/components/calendar/interface.d.ts +16 -0
  13. package/dist/components/card/interface.d.ts +18 -0
  14. package/dist/components/carousel/interface.d.ts +16 -0
  15. package/dist/components/cascader/interface.d.ts +57 -0
  16. package/dist/components/checkbox/interface.d.ts +19 -0
  17. package/dist/components/code-highlight/interface.d.ts +3 -0
  18. package/dist/components/collapse/interface.d.ts +16 -0
  19. package/dist/components/collapsible/interface.d.ts +10 -0
  20. package/dist/components/color-picker/interface.d.ts +10 -0
  21. package/dist/components/config-provider/interface.d.ts +7 -0
  22. package/dist/components/cropper/interface.d.ts +11 -0
  23. package/dist/components/date-picker/interface.d.ts +47 -0
  24. package/dist/components/descriptions/interface.d.ts +6 -0
  25. package/dist/components/divider/interface.d.ts +4 -0
  26. package/dist/components/dropdown/interface.d.ts +8 -0
  27. package/dist/components/empty/interface.d.ts +7 -0
  28. package/dist/components/feedback/interface.d.ts +16 -0
  29. package/dist/components/float-button/interface.d.ts +14 -0
  30. package/dist/components/form/interface.d.ts +47 -0
  31. package/dist/components/grid/interface.d.ts +13 -0
  32. package/dist/components/highlight/interface.d.ts +7 -0
  33. package/dist/components/hot-keys/interface.d.ts +3 -0
  34. package/dist/components/image/interface.d.ts +59 -0
  35. package/dist/components/input/interface.d.ts +67 -0
  36. package/dist/components/input-number/interface.d.ts +24 -0
  37. package/dist/components/json-viewer/interface.d.ts +7 -0
  38. package/dist/components/layout/interface.d.ts +3 -0
  39. package/dist/components/list/interface.d.ts +18 -0
  40. package/dist/components/locale/interface.d.ts +4 -0
  41. package/dist/components/lottie/interface.d.ts +2 -0
  42. package/dist/components/markdown-render/interface.d.ts +5 -0
  43. package/dist/components/modal/interface.d.ts +29 -0
  44. package/dist/components/navigation/interface.d.ts +47 -0
  45. package/dist/components/overflow-list/interface.d.ts +11 -0
  46. package/dist/components/pagination/interface.d.ts +12 -0
  47. package/dist/components/pincode/interface.d.ts +8 -0
  48. package/dist/components/popconfirm/interface.d.ts +12 -0
  49. package/dist/components/popover/interface.d.ts +30 -0
  50. package/dist/components/progress/interface.d.ts +13 -0
  51. package/dist/components/radio/interface.d.ts +22 -0
  52. package/dist/components/rating/interface.d.ts +12 -0
  53. package/dist/components/resizable/interface.d.ts +30 -0
  54. package/dist/components/scroll-list/interface.d.ts +6 -0
  55. package/dist/components/select/interface.d.ts +63 -0
  56. package/dist/components/side-sheet/interface.d.ts +19 -0
  57. package/dist/components/skeleton/interface.d.ts +7 -0
  58. package/dist/components/slider/interface.d.ts +23 -0
  59. package/dist/components/space/interface.d.ts +4 -0
  60. package/dist/components/spin/interface.d.ts +7 -0
  61. package/dist/components/steps/interface.d.ts +9 -0
  62. package/dist/components/switch/interface.d.ts +7 -0
  63. package/dist/components/table/interface.d.ts +48 -0
  64. package/dist/components/tabs/interface.d.ts +29 -0
  65. package/dist/components/tag/interface.d.ts +22 -0
  66. package/dist/components/tag-input/interface.d.ts +29 -0
  67. package/dist/components/time-picker/interface.d.ts +31 -0
  68. package/dist/components/timeline/interface.d.ts +5 -0
  69. package/dist/components/tooltip/interface.d.ts +20 -0
  70. package/dist/components/transfer/interface.d.ts +18 -0
  71. package/dist/components/tree/interface.d.ts +45 -0
  72. package/dist/components/tree-select/interface.d.ts +55 -0
  73. package/dist/components/typography/interface.d.ts +33 -0
  74. package/dist/components/upload/interface.d.ts +64 -0
  75. package/dist/components/user-guide/interface.d.ts +15 -0
  76. package/dist/components/video-player/interface.d.ts +22 -0
  77. package/docs/advanced/dark-mode.md +288 -0
  78. package/docs/basic/button.md +605 -0
  79. package/docs/basic/divider.md +103 -0
  80. package/docs/basic/float-button.md +246 -0
  81. package/docs/basic/grid.md +427 -0
  82. package/docs/basic/layout.md +459 -0
  83. package/docs/basic/resizable.md +584 -0
  84. package/docs/basic/space.md +163 -0
  85. package/docs/basic/tokens.md +425 -0
  86. package/docs/basic/typography.md +615 -0
  87. package/docs/changes-from-semi.md +105 -0
  88. package/docs/ecosystem/tailwind.md +210 -0
  89. package/docs/experience/accessibility.md +82 -0
  90. package/docs/experience/content-guidelines.md +819 -0
  91. package/docs/experience/internationalization.md +7 -0
  92. package/docs/feedback/banner.md +198 -0
  93. package/docs/feedback/feedback.md +294 -0
  94. package/docs/feedback/notification.md +401 -0
  95. package/docs/feedback/popconfirm.md +243 -0
  96. package/docs/feedback/progress.md +389 -0
  97. package/docs/feedback/skeleton.md +388 -0
  98. package/docs/feedback/spin.md +172 -0
  99. package/docs/feedback/toast.md +393 -0
  100. package/docs/input/auto-complete.md +399 -0
  101. package/docs/input/cascader.md +1558 -0
  102. package/docs/input/checkbox.md +408 -0
  103. package/docs/input/color-picker.md +175 -0
  104. package/docs/input/date-picker.md +942 -0
  105. package/docs/input/form.md +2550 -0
  106. package/docs/input/input-number.md +451 -0
  107. package/docs/input/input.md +640 -0
  108. package/docs/input/pincode.md +191 -0
  109. package/docs/input/radio.md +337 -0
  110. package/docs/input/rating.md +214 -0
  111. package/docs/input/select.md +1230 -0
  112. package/docs/input/slider.md +347 -0
  113. package/docs/input/switch.md +206 -0
  114. package/docs/input/tag-input.md +465 -0
  115. package/docs/input/time-picker.md +358 -0
  116. package/docs/input/transfer.md +1061 -0
  117. package/docs/input/tree-select.md +1300 -0
  118. package/docs/input/upload.md +1811 -0
  119. package/docs/llms.txt +147 -0
  120. package/docs/navigation/anchor.md +377 -0
  121. package/docs/navigation/backtop.md +100 -0
  122. package/docs/navigation/breadcrumb.md +284 -0
  123. package/docs/navigation/navigation.md +851 -0
  124. package/docs/navigation/pagination.md +217 -0
  125. package/docs/navigation/steps.md +315 -0
  126. package/docs/navigation/tabs.md +754 -0
  127. package/docs/navigation/tree.md +1956 -0
  128. package/docs/other/config-provider.md +599 -0
  129. package/docs/other/locale.md +353 -0
  130. package/docs/plus/audio-player.md +155 -0
  131. package/docs/plus/code-highlight.md +150 -0
  132. package/docs/plus/drag-move.md +214 -0
  133. package/docs/plus/hot-keys.md +174 -0
  134. package/docs/plus/json-viewer.md +392 -0
  135. package/docs/plus/lottie.md +176 -0
  136. package/docs/plus/markdown-render.md +240 -0
  137. package/docs/plus/video-player.md +325 -0
  138. package/docs/show/avatar.md +475 -0
  139. package/docs/show/badge.md +276 -0
  140. package/docs/show/calendar.md +352 -0
  141. package/docs/show/card.md +485 -0
  142. package/docs/show/carousel.md +592 -0
  143. package/docs/show/collapse.md +289 -0
  144. package/docs/show/collapsible.md +216 -0
  145. package/docs/show/cropper.md +285 -0
  146. package/docs/show/descriptions.md +325 -0
  147. package/docs/show/dropdown.md +466 -0
  148. package/docs/show/empty.md +225 -0
  149. package/docs/show/highlight.md +144 -0
  150. package/docs/show/image.md +433 -0
  151. package/docs/show/list.md +927 -0
  152. package/docs/show/modal.md +517 -0
  153. package/docs/show/overflow-list.md +272 -0
  154. package/docs/show/popover.md +534 -0
  155. package/docs/show/scroll-list.md +156 -0
  156. package/docs/show/side-sheet.md +274 -0
  157. package/docs/show/table.md +5437 -0
  158. package/docs/show/tag.md +428 -0
  159. package/docs/show/timeline.md +277 -0
  160. package/docs/show/tooltip.md +442 -0
  161. package/docs/show/user-guide.md +419 -0
  162. package/docs/start/getting-started.md +234 -0
  163. package/docs/start/introduction.md +57 -0
  164. package/docs/start/overview.md +21 -0
  165. package/package.json +5 -4
@@ -0,0 +1,277 @@
1
+ # Timeline
2
+
3
+ > Timeline component is used to display a series of information vertically.
4
+
5
+ Package: `@fibrae/semi-ui-svelte`. Web page: https://semi-design-next.pages.dev/en-US/svelte/show/timeline/
6
+
7
+ ## Demos
8
+
9
+ ### How to import
10
+
11
+ ```svelte
12
+ <script lang="ts">
13
+ import { Timeline } from '@fibrae/semi-ui-svelte';
14
+ </script>
15
+ ```
16
+
17
+ ### Basic Usage
18
+
19
+ The Svelte version has no `Timeline.Item`: write every node in `dataSource`. `time`, `extra` and `content` are strings or numbers, and `type` and `color` style the dot.
20
+
21
+ ```svelte
22
+ <script lang="ts">
23
+ import { Timeline, type TimelineData } from '@fibrae/semi-ui-svelte';
24
+
25
+ const dataSource: TimelineData[] = [
26
+ { time: '2019-07-14 10:35', content: '第一个节点内容' },
27
+ { time: '2019-06-13 16:17', content: '第二个节点内容' },
28
+ { time: '2019-05-14 18:34', content: '第三个节点内容' },
29
+ ];
30
+ </script>
31
+
32
+ <Timeline {dataSource} />
33
+ ```
34
+
35
+ ### Type
36
+
37
+ You can use `type` to set the type of a time node, using one of: `default`,`ongoing`, `success`, `warning`, `Error`. The corresponding dot will have a corresponding color.
38
+
39
+ ```svelte
40
+ <script lang="ts">
41
+ import { Timeline, type TimelineData } from '@fibrae/semi-ui-svelte';
42
+
43
+ const dataSource: TimelineData[] = [
44
+ { time: '2019-07-14 10:35', content: '审核中', type: 'ongoing' },
45
+ { time: '2019-06-13 16:17', content: '发布成功', type: 'success' },
46
+ { time: '2019-05-14 18:34', content: '审核失败', type: 'error' },
47
+ ];
48
+ </script>
49
+
50
+ <Timeline {dataSource} />
51
+ ```
52
+
53
+ ### Custom node
54
+
55
+ You can use the `dot` snippet of a `dataSource` item to customize the icon of that node and `color` to customize the dot color; nodes without `dot` draw the default circle. Style the node content through the `content` snippet. Use the `time` and `extra` snippets for the time and the extra content; both take the parameter `{ item, index }`.
56
+
57
+ ```svelte
58
+ <script lang="ts">
59
+ import { IconAlertTriangle } from '@fibrae/semi-icons-svelte';
60
+ import { Timeline, type TimelineData } from '@fibrae/semi-ui-svelte';
61
+
62
+ const dataSource: TimelineData[] = [
63
+ { time: '2019-07-14 10:35', content: '默认样式的节点' },
64
+ { time: '2019-06-13 16:17', content: '自定义图标', type: 'warning', dot: warningDot },
65
+ { time: '2019-05-14 18:34', content: '自定义节点颜色', color: 'pink' },
66
+ { time: '2019-04-10 12:20', content: '自定义节点样式' },
67
+ ];
68
+ </script>
69
+
70
+ {#snippet warningDot()}<IconAlertTriangle />{/snippet}
71
+
72
+ <Timeline {dataSource}>
73
+ {#snippet content({ item, index })}
74
+ {#if index === 3}
75
+ <span style="font-size: 18px">{item.content}</span>
76
+ {:else}
77
+ {item.content}
78
+ {/if}
79
+ {/snippet}
80
+ </Timeline>
81
+ ```
82
+
83
+ ### Timeline Position
84
+
85
+ Use `mode` to set the position of the timeline, using one of: `left`, `center`, `alternate`, `right`.
86
+
87
+ #### Left (default)
88
+
89
+ ```svelte
90
+ <script lang="ts">
91
+ import { Timeline, type TimelineData } from '@fibrae/semi-ui-svelte';
92
+
93
+ const dataSource: TimelineData[] = [
94
+ { time: '2019-07-14 10:35', extra: '节点辅助说明信息', content: '第一个节点内容' },
95
+ { time: '2019-06-13 16:17', extra: '节点辅助说明信息', content: '第二个节点内容' },
96
+ { time: '2019-05-14 18:34', extra: '节点辅助说明信息', content: '第三个节点内容' },
97
+ { time: '2019-05-09 09:12', extra: '节点辅助说明信息', content: '第四个节点内容' },
98
+ ];
99
+ </script>
100
+
101
+ <Timeline {dataSource} mode="left" />
102
+ ```
103
+
104
+ #### Center
105
+
106
+ ```svelte
107
+ <script lang="ts">
108
+ import { Timeline, type TimelineData } from '@fibrae/semi-ui-svelte';
109
+
110
+ const dataSource: TimelineData[] = [
111
+ { time: '2019-07-14 10:35', extra: '节点辅助说明信息', content: '第一个节点内容' },
112
+ { time: '2019-06-13 16:17', extra: '节点辅助说明信息', content: '第二个节点内容' },
113
+ { time: '2019-05-14 18:34', extra: '节点辅助说明信息', content: '第三个节点内容' },
114
+ { time: '2019-05-09 09:12', extra: '节点辅助说明信息', content: '第四个节点内容' },
115
+ ];
116
+ </script>
117
+
118
+ <Timeline {dataSource} mode="center" />
119
+ ```
120
+
121
+ #### Alternate
122
+
123
+ Items alternate by the children actually rendered: a child that is not rendered because its condition is false takes no position.
124
+
125
+ ```svelte
126
+ <script lang="ts">
127
+ import { Timeline, type TimelineData } from '@fibrae/semi-ui-svelte';
128
+
129
+ const dataSource: TimelineData[] = [
130
+ { time: '2019-07-14 10:35', extra: '节点辅助说明信息', content: '第一个节点内容' },
131
+ { time: '2019-06-13 16:17', extra: '节点辅助说明信息', content: '第二个节点内容' },
132
+ { time: '2019-05-14 18:34', extra: '节点辅助说明信息', content: '第三个节点内容' },
133
+ { time: '2019-05-09 09:12', extra: '节点辅助说明信息', content: '第四个节点内容' },
134
+ ];
135
+ </script>
136
+
137
+ <Timeline {dataSource} mode="alternate" />
138
+ ```
139
+
140
+ #### Right
141
+
142
+ ```svelte
143
+ <script lang="ts">
144
+ import { Timeline, type TimelineData } from '@fibrae/semi-ui-svelte';
145
+
146
+ const dataSource: TimelineData[] = [
147
+ { time: '2019-07-14 10:35', extra: '节点辅助说明信息', content: '第一个节点内容' },
148
+ { time: '2019-06-13 16:17', extra: '节点辅助说明信息', content: '第二个节点内容' },
149
+ { time: '2019-05-14 18:34', extra: '节点辅助说明信息', content: '第三个节点内容' },
150
+ { time: '2019-05-09 09:12', extra: '节点辅助说明信息', content: '第四个节点内容' },
151
+ ];
152
+ </script>
153
+
154
+ <Timeline {dataSource} mode="right" />
155
+ ```
156
+
157
+ ### DataSource
158
+
159
+ `content`, `time` and `extra` of a `dataSource` item accept only strings or numbers. For custom rendering, use the snippets `content`, `time` and `extra`, called with `{ item, index }`; for a custom dot, set the `dot` snippet of the item, which takes no argument.
160
+
161
+ ```svelte
162
+ <script lang="ts">
163
+ import { IconAlertTriangle } from '@fibrae/semi-icons-svelte';
164
+ import { Timeline, type TimelineData } from '@fibrae/semi-ui-svelte';
165
+
166
+ const dataSource: TimelineData[] = [
167
+ {
168
+ time: '2019-07-14 10:35',
169
+ extra: '节点辅助说明信息',
170
+ content: '第一个节点内容',
171
+ type: 'ongoing',
172
+ },
173
+ {
174
+ time: '2019-06-13 16:17',
175
+ extra: '节点辅助说明信息',
176
+ content: '第二个节点内容',
177
+ color: 'pink',
178
+ },
179
+ {
180
+ time: '2019-05-14 18:34',
181
+ extra: '节点辅助说明信息',
182
+ content: '第三个节点内容',
183
+ type: 'warning',
184
+ dot: warningDot,
185
+ },
186
+ {
187
+ time: '2019-05-09 09:12',
188
+ extra: '节点辅助说明信息',
189
+ content: '第四个节点内容',
190
+ type: 'success',
191
+ },
192
+ ];
193
+ </script>
194
+
195
+ {#snippet warningDot()}<IconAlertTriangle />{/snippet}
196
+
197
+ <Timeline {dataSource} mode="alternate">
198
+ {#snippet content({ item, index })}
199
+ {#if index === 1}
200
+ <span style="font-size: 18px">{item.content}</span>
201
+ {:else}
202
+ {item.content}
203
+ {/if}
204
+ {/snippet}
205
+ </Timeline>
206
+ ```
207
+
208
+ ## API reference
209
+
210
+ ### TimeLine
211
+
212
+ **Props**
213
+
214
+ | Property | Description | Type | Default |
215
+ | - | - | - | - |
216
+ | content | Snippet for the content of each dataSource item, with the parameter `{ item, index }`. Defaults to item.content. | `Snippet<[TimelineSnippetProps]>` | - |
217
+ | dataSource | Data array the items are rendered from. See the item fields below; `dot` is the snippet of a custom dot for that item, and the default circle is drawn when unset. | `TimelineData[]` | - |
218
+ | extra | Snippet for the extra content of each dataSource item, with the parameter `{ item, index }`. Defaults to item.extra. | `Snippet<[TimelineSnippetProps]>` | - |
219
+ | mode | Position of the timeline relative to the content: left, right, center or alternate. | `TimelineMode` | `"left"` |
220
+ | time | Snippet for the time of each dataSource item, with the parameter `{ item, index }`. Defaults to item.time. | `Snippet<[TimelineSnippetProps]>` | - |
221
+
222
+ `class`, `style` (a string) and native attributes such as `id` and `aria-label` are passed to the root `ul`.
223
+
224
+ Fields of a `dataSource` item:
225
+
226
+ | Field | Description | Type | Default |
227
+ | - | - | - | - |
228
+ | content | Node content; use the `content` snippet for custom content | `string \| number` | - |
229
+ | time | Time text; use the `time` snippet for custom content | `string \| number` | - |
230
+ | extra | Extra content; use the `extra` snippet for custom content | `string \| number` | - |
231
+ | dot | Custom dot; the default circle is drawn when unset | `Snippet` | - |
232
+ | color | Custom color of the dot | `string` | - |
233
+ | type | Mode of the dot | `'default' \| 'ongoing' \| 'success' \| 'warning' \| 'error'` | `default` |
234
+ | position | Custom position of the node, overriding the mode of TimeLine | `'left' \| 'right'` | - |
235
+ | onClick | Called when the node is clicked, with a `MouseEvent`; clicks in the `extra` area do not trigger it | `(event: MouseEvent) => void` | - |
236
+ | class | Class name of the `li` | `ClassValue` | - |
237
+ | style | Style string of the `li` | `string` | - |
238
+
239
+ ### TimeLine.Item
240
+
241
+ The Svelte version has no `TimeLine.Item`: a node is an item of `dataSource`, with the fields in the table above. `class`, `style` and other `li` attributes are written in the item and land on the `li`. With `onClick`, the content area has `role="button"` and `tabindex="0"` and responds to `Enter` and `Space`. A container is not rendered when its `time` or `extra` is empty.
242
+
243
+ ## Accessibility
244
+
245
+ ### ARIA
246
+
247
+ - The element of dot and line between dots in TimeLine have a `aria-hidden`, indicates that they do not support Accessibility API.
248
+ - Supporting API `aria-label` to specify TimeLine's label.
249
+
250
+ ```svelte
251
+ <script lang="ts">
252
+ import { Timeline } from '@fibrae/semi-ui-svelte';
253
+
254
+ const dataSource = [
255
+ { time: '2015-09-01', content: 'Accident started' },
256
+ { time: '2015-09-01', content: 'Process' },
257
+ ];
258
+ </script>
259
+
260
+ <Timeline aria-label="Accident timeline" {dataSource} />
261
+ ```
262
+
263
+ ## Design Tokens
264
+
265
+ The design token table of this component is on the web page: <https://semi-design-next.pages.dev/en-US/svelte/show/timeline/>
266
+
267
+ ## Changes from Semi Design
268
+
269
+ From the project release notes (written in Chinese). Your knowledge of Semi Design does not cover these.
270
+
271
+ - 破坏性(类型):List 的 `grid` 只接受 Row 与 Col 的指定属性,不再接受任意 div 属性(如 `id`);Timeline `dataSource` 项的 `Data` 不再接受 `children`,改用 `content`。
272
+ - 可点击的 List.Item 在 li 内渲染原生 `<button>` 作为唯一焦点目标,`tabIndex`、`aria-*` 落在按钮上,点击 `extra` 内元素不再触发 `onClick`,children 中的交互内容需移到 `extra`;新增类名 `semi-list-item-clickable`、`semi-list-item-button`;可点击的 Timeline.Item 的 children 外包一层 `role="button"` 的 `semi-timeline-item-content-main`;依赖 `.semi-list-items .semi-list-empty` 的选择器改为 `.semi-list-empty`;`children` 为空数组时显示空状态。
273
+ - Solid 破坏性(类型):Timeline `dataSource` 项的 `content`、`time`、`extra` 只接受 `string | number`,删除 `dot` 字段,自定义内容用 `renderContent`、`renderDot`、`renderTime`、`renderExtra`(参数 `(item, index)`,`renderDot` 没有默认值)。`Timeline.Item` 的 `dot`、`time`、`extra` 不变。
274
+ - Svelte 破坏性:Timeline 不提供 `Timeline.Item`,只用 `dataSource` 加 `content`、`time`、`extra` snippet(参数 `{ item, index }`);自定义圆点逐项设置:`TimelineData.dot?: Snippet`,设了的节点按自定义圆点(`head-custom`)渲染,未设的节点画默认圆点,没有组件级 `dot` snippet;`dataSource` 项的 `class`、`style`(字符串)与其他 li 属性落在 `li` 上。
275
+ - Svelte:导出为 `List`、`ListItem`;`onClick`、`onRightClick` 是函数 prop,类型中去掉了小写的 `onclick`、`oncontextmenu`;`item`、`header`、`footer`、`emptyContent`、`loadMore`、`children` 都是 snippet,`item` 参数 `{ item, index }`。
276
+ - Svelte:空状态按 `children` snippet 是否存在判断(Vue 版按内容是否为空);ListItem 的 `header`、`main`、`extra` 同样按 snippet 是否存在判断。
277
+ - Timeline(React):`extra`、`time` 为 0 时渲染在各自容器内,不再作为裸文本出现在正文后。