@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,459 @@
|
|
|
1
|
+
# Layout
|
|
2
|
+
|
|
3
|
+
> Used to quickly divide the overall layout of the page
|
|
4
|
+
|
|
5
|
+
Package: `@fibrae/semi-ui-svelte`. Web page: https://semi-design-next.pages.dev/en-US/svelte/basic/layout/
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
- `Layout`: Layout containers. You can nest `Header` `Sider` `Content` `Footer` or `Layout` itself inside.
|
|
10
|
+
- `Header`: Head component, can only be used inside `Layout`.
|
|
11
|
+
- `Sider`: Sidebar, can only be used inside `Layout`.
|
|
12
|
+
- `Content`: Content component, can only be used inside `Layout`.
|
|
13
|
+
- `Footer`: Footer component, can only be used inside `Layout`.
|
|
14
|
+
|
|
15
|
+
> **Notice**
|
|
16
|
+
>
|
|
17
|
+
> 1、Layout components are implemented with Flex layout. Browser compatibility may need to be considered. 
|
|
18
|
+
> 2、The Layout component will only help you implement the layout, but will not include styles such as background color, text color, width and height. You can pass in style according to your actual needs or write a separate css implementation given a specific class name
|
|
19
|
+
|
|
20
|
+
## Demos
|
|
21
|
+
|
|
22
|
+
### How to import
|
|
23
|
+
|
|
24
|
+
```svelte
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import { Layout, LayoutContent, LayoutFooter, LayoutHeader, LayoutSider } from '@fibrae/semi-ui-svelte';
|
|
27
|
+
</script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The subcomponents are `LayoutHeader`, `LayoutSider`, `LayoutContent` and `LayoutFooter`, which stand for `Layout.Header`, `Layout.Sider`, `Layout.Content` and `Layout.Footer` below, and are imported by name.
|
|
31
|
+
|
|
32
|
+
### Three-section Layout
|
|
33
|
+
|
|
34
|
+
```svelte
|
|
35
|
+
<script lang="ts">
|
|
36
|
+
import { Layout } from '@fibrae/semi-ui-svelte';
|
|
37
|
+
|
|
38
|
+
const commonStyle = 'height: 64px; line-height: 64px; background: var(--semi-color-fill-0)';
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<Layout class="components-layout-demo">
|
|
42
|
+
<Layout.Header style={commonStyle}>Header</Layout.Header>
|
|
43
|
+
<Layout.Content style="height: 300px; line-height: 300px">Content</Layout.Content>
|
|
44
|
+
<Layout.Footer style={commonStyle}>Footer</Layout.Footer>
|
|
45
|
+
</Layout>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Left-sidebar Layout
|
|
49
|
+
|
|
50
|
+
```svelte
|
|
51
|
+
<script lang="ts">
|
|
52
|
+
import { Layout } from '@fibrae/semi-ui-svelte';
|
|
53
|
+
|
|
54
|
+
const commonStyle = 'height: 64px; line-height: 64px; background: var(--semi-color-fill-0)';
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<Layout class="components-layout-demo">
|
|
58
|
+
<Layout.Header style={commonStyle}>Header</Layout.Header>
|
|
59
|
+
<Layout>
|
|
60
|
+
<Layout.Sider style="width: 120px; background: var(--semi-color-fill-2)">Sider</Layout.Sider>
|
|
61
|
+
<Layout.Content style="height: 300px; line-height: 300px">Content</Layout.Content>
|
|
62
|
+
</Layout>
|
|
63
|
+
<Layout.Footer style={commonStyle}>Footer</Layout.Footer>
|
|
64
|
+
</Layout>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Right-sidebar Layout
|
|
68
|
+
|
|
69
|
+
```svelte
|
|
70
|
+
<script lang="ts">
|
|
71
|
+
import { Layout } from '@fibrae/semi-ui-svelte';
|
|
72
|
+
|
|
73
|
+
const commonStyle = 'height: 64px; line-height: 64px; background: var(--semi-color-fill-0)';
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<Layout class="components-layout-demo">
|
|
77
|
+
<Layout.Header style={commonStyle}>Header</Layout.Header>
|
|
78
|
+
<Layout>
|
|
79
|
+
<Layout.Content style="height: 300px; line-height: 300px">Content</Layout.Content>
|
|
80
|
+
<Layout.Sider style="width: 120px; background: var(--semi-color-fill-2)">Sider</Layout.Sider>
|
|
81
|
+
</Layout>
|
|
82
|
+
<Layout.Footer style={commonStyle}>Footer</Layout.Footer>
|
|
83
|
+
</Layout>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Sidebar Layout
|
|
87
|
+
|
|
88
|
+
```svelte
|
|
89
|
+
<script lang="ts">
|
|
90
|
+
import { Layout } from '@fibrae/semi-ui-svelte';
|
|
91
|
+
|
|
92
|
+
const commonStyle = 'height: 64px; line-height: 64px; background: var(--semi-color-fill-0)';
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<Layout class="components-layout-demo">
|
|
96
|
+
<Layout.Sider style="width: 120px; background: var(--semi-color-fill-2)">Sider</Layout.Sider>
|
|
97
|
+
<Layout>
|
|
98
|
+
<Layout.Header style={commonStyle}>Header</Layout.Header>
|
|
99
|
+
<Layout.Content style="height: 300px; line-height: 300px">Content</Layout.Content>
|
|
100
|
+
<Layout.Footer style={commonStyle}>Footer</Layout.Footer>
|
|
101
|
+
</Layout>
|
|
102
|
+
</Layout>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Responsive Layout
|
|
106
|
+
|
|
107
|
+
Six response sizes are preset in the sidebar: `xs`,`sm`,`md`,`lg`,`xl`,`xxl`. You can use `breakpoint` to set breakpoints.
|
|
108
|
+
|
|
109
|
+
Use `onBreakpoint` to call callback functions.
|
|
110
|
+
|
|
111
|
+
```svelte
|
|
112
|
+
<script lang="ts">
|
|
113
|
+
import { Layout } from '@fibrae/semi-ui-svelte';
|
|
114
|
+
|
|
115
|
+
const commonStyle = 'height: 64px; line-height: 64px; background: var(--semi-color-fill-0)';
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<Layout class="components-layout-demo">
|
|
119
|
+
<Layout.Header style={commonStyle}>Header</Layout.Header>
|
|
120
|
+
<Layout>
|
|
121
|
+
<Layout.Sider breakpoint={['md']} onBreakpoint={(screen, matches) => console.log(screen, matches)} style="width: 120px; background: var(--semi-color-fill-2)">Sider</Layout.Sider>
|
|
122
|
+
<Layout.Content style="height: 300px; line-height: 300px">Content</Layout.Content>
|
|
123
|
+
</Layout>
|
|
124
|
+
<Layout.Footer style={commonStyle}>Footer</Layout.Footer>
|
|
125
|
+
</Layout>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Layout Examples
|
|
129
|
+
|
|
130
|
+
### Top-nav Layout
|
|
131
|
+
|
|
132
|
+
```svelte
|
|
133
|
+
<script lang="ts">
|
|
134
|
+
import { IconBell, IconHelpCircle, IconHome, IconLive, IconSemiLogo, IconSetting } from '@fibrae/semi-icons-svelte';
|
|
135
|
+
import { Avatar, Breadcrumb, Button, Layout, Nav, Skeleton } from '@fibrae/semi-ui-svelte';
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
{#snippet header()}
|
|
139
|
+
<Nav.Header>
|
|
140
|
+
<IconSemiLogo style="font-size: 36px" />
|
|
141
|
+
</Nav.Header>
|
|
142
|
+
{/snippet}
|
|
143
|
+
|
|
144
|
+
{#snippet footer()}
|
|
145
|
+
<Nav.Footer>
|
|
146
|
+
<Button aria-label="通知" style="color: var(--semi-color-text-2); margin-inline-end: 12px" theme="borderless">
|
|
147
|
+
{#snippet icon()}
|
|
148
|
+
<IconBell size="large" />
|
|
149
|
+
{/snippet}
|
|
150
|
+
</Button>
|
|
151
|
+
<Button aria-label="帮助" style="color: var(--semi-color-text-2); margin-inline-end: 12px" theme="borderless">
|
|
152
|
+
{#snippet icon()}
|
|
153
|
+
<IconHelpCircle size="large" />
|
|
154
|
+
{/snippet}
|
|
155
|
+
</Button>
|
|
156
|
+
<Avatar color="orange" size="small">YJ</Avatar>
|
|
157
|
+
</Nav.Footer>
|
|
158
|
+
{/snippet}
|
|
159
|
+
|
|
160
|
+
<Layout style="border: 1px solid var(--semi-color-border)">
|
|
161
|
+
<Layout.Header style="background-color: var(--semi-color-bg-1)">
|
|
162
|
+
<div>
|
|
163
|
+
<Nav {footer} {header} mode="horizontal" selectedKeys={['Home']}>
|
|
164
|
+
<Nav.Item itemKey="Home" text="首页">
|
|
165
|
+
{#snippet icon()}
|
|
166
|
+
<IconHome size="large" />
|
|
167
|
+
{/snippet}
|
|
168
|
+
</Nav.Item>
|
|
169
|
+
<Nav.Item itemKey="Live" text="直播">
|
|
170
|
+
{#snippet icon()}
|
|
171
|
+
<IconLive size="large" />
|
|
172
|
+
{/snippet}
|
|
173
|
+
</Nav.Item>
|
|
174
|
+
<Nav.Item itemKey="Setting" text="设置">
|
|
175
|
+
{#snippet icon()}
|
|
176
|
+
<IconSetting size="large" />
|
|
177
|
+
{/snippet}
|
|
178
|
+
</Nav.Item>
|
|
179
|
+
</Nav>
|
|
180
|
+
</div>
|
|
181
|
+
</Layout.Header>
|
|
182
|
+
<Layout.Content style="padding: 24px; background-color: var(--semi-color-bg-0)">
|
|
183
|
+
<Breadcrumb routes={['首页', '当这个页面标题很长时需要省略', '上一页', '详情页']} style="margin-block-end: 24px" />
|
|
184
|
+
<div style="border-radius: 10px; border: 1px solid var(--semi-color-border); height: 376px; padding: 32px">
|
|
185
|
+
<Skeleton loading>
|
|
186
|
+
{#snippet placeholder()}
|
|
187
|
+
<Skeleton.Paragraph rows={2} />
|
|
188
|
+
{/snippet}
|
|
189
|
+
<p>Hi, Semi dance dance.</p>
|
|
190
|
+
<p>Hi, Semi dance dance.</p>
|
|
191
|
+
</Skeleton>
|
|
192
|
+
</div>
|
|
193
|
+
</Layout.Content>
|
|
194
|
+
<Layout.Footer style="display: flex; justify-content: space-between; padding: 20px; color: var(--semi-color-text-2); background-color: var(--semi-grey-0)">
|
|
195
|
+
<span style="display: flex; align-items: center">
|
|
196
|
+
<IconSemiLogo size="large" style="margin-inline-end: 8px" />
|
|
197
|
+
<span>Copyright © 2023 Semi Design Next. All Rights Reserved. </span>
|
|
198
|
+
</span>
|
|
199
|
+
<span>
|
|
200
|
+
<span style="margin-inline-end: 24px">平台客服</span>
|
|
201
|
+
<span>反馈建议</span>
|
|
202
|
+
</span>
|
|
203
|
+
</Layout.Footer>
|
|
204
|
+
</Layout>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Top-Nav SideBar Layout
|
|
208
|
+
|
|
209
|
+
```svelte
|
|
210
|
+
<script lang="ts">
|
|
211
|
+
import { IconBell, IconHelpCircle, IconHistogram, IconHome, IconLive, IconSemiLogo, IconSetting } from '@fibrae/semi-icons-svelte';
|
|
212
|
+
import { Avatar, Breadcrumb, Button, Layout, Nav, Skeleton, type NavItems } from '@fibrae/semi-ui-svelte';
|
|
213
|
+
|
|
214
|
+
const items: NavItems = [
|
|
215
|
+
{ itemKey: 'Home', text: '首页' },
|
|
216
|
+
{ itemKey: 'Histogram', text: '基础数据' },
|
|
217
|
+
{ itemKey: 'Live', text: '测试功能' },
|
|
218
|
+
{ itemKey: 'Setting', text: '设置' },
|
|
219
|
+
];
|
|
220
|
+
const icons = { Home: IconHome, Histogram: IconHistogram, Live: IconLive, Setting: IconSetting };
|
|
221
|
+
</script>
|
|
222
|
+
|
|
223
|
+
{#snippet topHeader()}
|
|
224
|
+
<Nav.Header>
|
|
225
|
+
<IconSemiLogo style="height: 36px; font-size: 36px" />
|
|
226
|
+
</Nav.Header>
|
|
227
|
+
{/snippet}
|
|
228
|
+
|
|
229
|
+
{#snippet topFooter()}
|
|
230
|
+
<Nav.Footer>
|
|
231
|
+
<Button aria-label="通知" style="color: var(--semi-color-text-2); margin-inline-end: 12px" theme="borderless">
|
|
232
|
+
{#snippet icon()}
|
|
233
|
+
<IconBell size="large" />
|
|
234
|
+
{/snippet}
|
|
235
|
+
</Button>
|
|
236
|
+
<Button aria-label="帮助" style="color: var(--semi-color-text-2); margin-inline-end: 12px" theme="borderless">
|
|
237
|
+
{#snippet icon()}
|
|
238
|
+
<IconHelpCircle size="large" />
|
|
239
|
+
{/snippet}
|
|
240
|
+
</Button>
|
|
241
|
+
<Avatar color="orange" size="small">YJ</Avatar>
|
|
242
|
+
</Nav.Footer>
|
|
243
|
+
{/snippet}
|
|
244
|
+
|
|
245
|
+
<Layout style="border: 1px solid var(--semi-color-border)">
|
|
246
|
+
<Layout.Header style="background-color: var(--semi-color-bg-1)">
|
|
247
|
+
<div>
|
|
248
|
+
<Nav aria-label="顶部导航" footer={topFooter} header={topHeader} mode="horizontal" selectedKeys={['Home']}>
|
|
249
|
+
<!-- Nav renders its children straight into the list, so other content needs its own li -->
|
|
250
|
+
<li style="display: contents">
|
|
251
|
+
<span style="color: var(--semi-color-text-2)">
|
|
252
|
+
<span style="margin-inline-end: 24px; color: var(--semi-color-text-0); font-weight: 600">模版推荐</span>
|
|
253
|
+
<span style="margin-inline-end: 24px">所有模版</span>
|
|
254
|
+
<span>我的模版</span>
|
|
255
|
+
</span>
|
|
256
|
+
</li>
|
|
257
|
+
</Nav>
|
|
258
|
+
</div>
|
|
259
|
+
</Layout.Header>
|
|
260
|
+
<Layout>
|
|
261
|
+
<Layout.Sider style="background-color: var(--semi-color-bg-1)">
|
|
262
|
+
<Nav aria-label="侧边导航" footer={{ collapseButton: true }} {items} selectedKeys={['Home']} style="max-width: 220px; height: 100%">
|
|
263
|
+
{#snippet icon({ item })}
|
|
264
|
+
{@const Icon = icons[item.itemKey as keyof typeof icons]}
|
|
265
|
+
<Icon size="large" />
|
|
266
|
+
{/snippet}
|
|
267
|
+
</Nav>
|
|
268
|
+
</Layout.Sider>
|
|
269
|
+
<Layout.Content style="padding: 24px; background-color: var(--semi-color-bg-0)">
|
|
270
|
+
<Breadcrumb routes={['首页', '当这个页面标题很长时需要省略', '上一页', '详情页']} style="margin-block-end: 24px" />
|
|
271
|
+
<div style="border-radius: 10px; border: 1px solid var(--semi-color-border); height: 376px; padding: 32px">
|
|
272
|
+
<Skeleton loading>
|
|
273
|
+
{#snippet placeholder()}
|
|
274
|
+
<Skeleton.Paragraph rows={2} />
|
|
275
|
+
{/snippet}
|
|
276
|
+
<p>Hi, Semi dance dance.</p>
|
|
277
|
+
<p>Hi, Semi dance dance.</p>
|
|
278
|
+
</Skeleton>
|
|
279
|
+
</div>
|
|
280
|
+
</Layout.Content>
|
|
281
|
+
</Layout>
|
|
282
|
+
<Layout.Footer style="display: flex; justify-content: space-between; padding: 20px; color: var(--semi-color-text-2); background-color: var(--semi-grey-0)">
|
|
283
|
+
<span style="display: flex; align-items: center">
|
|
284
|
+
<IconSemiLogo size="large" style="margin-inline-end: 8px" />
|
|
285
|
+
<span>Copyright © 2023 Semi Design Next. All Rights Reserved. </span>
|
|
286
|
+
</span>
|
|
287
|
+
<span>
|
|
288
|
+
<span style="margin-inline-end: 24px">平台客服</span>
|
|
289
|
+
<span>反馈建议</span>
|
|
290
|
+
</span>
|
|
291
|
+
</Layout.Footer>
|
|
292
|
+
</Layout>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### SideBar Navigation
|
|
296
|
+
|
|
297
|
+
```svelte
|
|
298
|
+
<script lang="ts">
|
|
299
|
+
import { IconBell, IconHelpCircle, IconHistogram, IconHome, IconLive, IconSemiLogo, IconSetting } from '@fibrae/semi-icons-svelte';
|
|
300
|
+
import { Avatar, Breadcrumb, Button, Layout, Nav, Skeleton, type NavItems } from '@fibrae/semi-ui-svelte';
|
|
301
|
+
|
|
302
|
+
const items: NavItems = [
|
|
303
|
+
{ itemKey: 'Home', text: '首页' },
|
|
304
|
+
{ itemKey: 'Histogram', text: '基础数据' },
|
|
305
|
+
{ itemKey: 'Live', text: '测试功能' },
|
|
306
|
+
{ itemKey: 'Setting', text: '设置' },
|
|
307
|
+
];
|
|
308
|
+
const icons = { Home: IconHome, Histogram: IconHistogram, Live: IconLive, Setting: IconSetting };
|
|
309
|
+
</script>
|
|
310
|
+
|
|
311
|
+
{#snippet sideHeader()}
|
|
312
|
+
<Nav.Header text="Semi Design">
|
|
313
|
+
{#snippet logo()}
|
|
314
|
+
<IconSemiLogo style="font-size: 36px" />
|
|
315
|
+
{/snippet}
|
|
316
|
+
</Nav.Header>
|
|
317
|
+
{/snippet}
|
|
318
|
+
|
|
319
|
+
{#snippet topFooter()}
|
|
320
|
+
<Nav.Footer>
|
|
321
|
+
<Button aria-label="通知" style="color: var(--semi-color-text-2); margin-inline-end: 12px" theme="borderless">
|
|
322
|
+
{#snippet icon()}
|
|
323
|
+
<IconBell size="large" />
|
|
324
|
+
{/snippet}
|
|
325
|
+
</Button>
|
|
326
|
+
<Button aria-label="帮助" style="color: var(--semi-color-text-2); margin-inline-end: 12px" theme="borderless">
|
|
327
|
+
{#snippet icon()}
|
|
328
|
+
<IconHelpCircle size="large" />
|
|
329
|
+
{/snippet}
|
|
330
|
+
</Button>
|
|
331
|
+
<Avatar color="orange" size="small">YJ</Avatar>
|
|
332
|
+
</Nav.Footer>
|
|
333
|
+
{/snippet}
|
|
334
|
+
|
|
335
|
+
<Layout style="border: 1px solid var(--semi-color-border)">
|
|
336
|
+
<Layout.Sider style="background-color: var(--semi-color-bg-1)">
|
|
337
|
+
<Nav aria-label="侧边导航" footer={{ collapseButton: true }} header={sideHeader} {items} selectedKeys={['Home']} style="max-width: 220px; height: 100%">
|
|
338
|
+
{#snippet icon({ item })}
|
|
339
|
+
{@const Icon = icons[item.itemKey as keyof typeof icons]}
|
|
340
|
+
<Icon size="large" />
|
|
341
|
+
{/snippet}
|
|
342
|
+
</Nav>
|
|
343
|
+
</Layout.Sider>
|
|
344
|
+
<Layout>
|
|
345
|
+
<Layout.Header style="background-color: var(--semi-color-bg-1)">
|
|
346
|
+
<Nav aria-label="顶部导航" footer={topFooter} mode="horizontal" />
|
|
347
|
+
</Layout.Header>
|
|
348
|
+
<Layout.Content style="padding: 24px; background-color: var(--semi-color-bg-0)">
|
|
349
|
+
<Breadcrumb routes={['首页', '当这个页面标题很长时需要省略', '上一页', '详情页']} style="margin-block-end: 24px" />
|
|
350
|
+
<div style="border-radius: 10px; border: 1px solid var(--semi-color-border); height: 376px; padding: 32px">
|
|
351
|
+
<Skeleton loading>
|
|
352
|
+
{#snippet placeholder()}
|
|
353
|
+
<Skeleton.Paragraph rows={2} />
|
|
354
|
+
{/snippet}
|
|
355
|
+
<p>Hi, Semi dance dance.</p>
|
|
356
|
+
<p>Hi, Semi dance dance.</p>
|
|
357
|
+
</Skeleton>
|
|
358
|
+
</div>
|
|
359
|
+
</Layout.Content>
|
|
360
|
+
<Layout.Footer style="display: flex; justify-content: space-between; padding: 20px; color: var(--semi-color-text-2); background-color: var(--semi-grey-0)">
|
|
361
|
+
<span style="display: flex; align-items: center">
|
|
362
|
+
<IconSemiLogo size="large" style="margin-inline-end: 8px" />
|
|
363
|
+
<span>Copyright © 2019 Semi Design Next. All Rights Reserved. </span>
|
|
364
|
+
</span>
|
|
365
|
+
<span>
|
|
366
|
+
<span style="margin-inline-end: 24px">平台客服</span>
|
|
367
|
+
<span>反馈建议</span>
|
|
368
|
+
</span>
|
|
369
|
+
</Layout.Footer>
|
|
370
|
+
</Layout>
|
|
371
|
+
</Layout>
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## API Reference
|
|
375
|
+
|
|
376
|
+
### Layout
|
|
377
|
+
|
|
378
|
+
**Props**
|
|
379
|
+
|
|
380
|
+
| Property | Description | Type | Default |
|
|
381
|
+
| - | - | - | - |
|
|
382
|
+
| children | Content of the Layout: LayoutHeader, LayoutSider, LayoutContent, LayoutFooter or a nested Layout. | `Snippet` | - |
|
|
383
|
+
| hasSider | Indicates that a Sider is inside. A Sider among the direct children is detected automatically; a deeper one registers after mount, so pass true during server rendering to avoid style flashing. Passing false cannot remove the has-sider class that a Sider adds. | `boolean` | - |
|
|
384
|
+
| tagName | Tag name of the root element. | `keyof HTMLElementTagNameMap` | `"section"` |
|
|
385
|
+
|
|
386
|
+
`class`, `style` and native attributes (including `role` and `aria-*`) land on the root element.
|
|
387
|
+
|
|
388
|
+
### Layout.Header, Layout.Footer, Layout.Content
|
|
389
|
+
|
|
390
|
+
The three share one API. Their default tags are `header`, `footer` and `main`.
|
|
391
|
+
|
|
392
|
+
#### Layout.Header
|
|
393
|
+
|
|
394
|
+
**Props**
|
|
395
|
+
|
|
396
|
+
| Property | Description | Type | Default |
|
|
397
|
+
| - | - | - | - |
|
|
398
|
+
| children | Content of the header. | `Snippet` | - |
|
|
399
|
+
| tagName | Tag name of the root element. | `keyof HTMLElementTagNameMap` | `"header"` |
|
|
400
|
+
|
|
401
|
+
#### Layout.Footer
|
|
402
|
+
|
|
403
|
+
**Props**
|
|
404
|
+
|
|
405
|
+
| Property | Description | Type | Default |
|
|
406
|
+
| - | - | - | - |
|
|
407
|
+
| children | Content of the footer. | `Snippet` | - |
|
|
408
|
+
| tagName | Tag name of the root element. | `keyof HTMLElementTagNameMap` | `"footer"` |
|
|
409
|
+
|
|
410
|
+
#### Layout.Content
|
|
411
|
+
|
|
412
|
+
**Props**
|
|
413
|
+
|
|
414
|
+
| Property | Description | Type | Default |
|
|
415
|
+
| - | - | - | - |
|
|
416
|
+
| children | Content of the main area. | `Snippet` | - |
|
|
417
|
+
| tagName | Tag name of the root element. | `keyof HTMLElementTagNameMap` | `"main"` |
|
|
418
|
+
|
|
419
|
+
`class`, `style` and native attributes (including `role` and `aria-*`) land on each root element.
|
|
420
|
+
|
|
421
|
+
### Layout.Sider
|
|
422
|
+
|
|
423
|
+
**Props**
|
|
424
|
+
|
|
425
|
+
| Property | Description | Type | Default |
|
|
426
|
+
| - | - | - | - |
|
|
427
|
+
| breakpoint | Breakpoints that trigger the responsive layout: xs, sm, md, lg, xl or xxl. Read once at mount. | `Array<keyof ResponsiveMap>` | - |
|
|
428
|
+
| children | Content of the sider. | `Snippet` | - |
|
|
429
|
+
| onBreakpoint | Called once at mount for each screen listed in breakpoint with the current viewport state, then whenever it starts or stops matching, with the screen name and whether it matches. | `(screen: keyof ResponsiveMap, match: boolean) => void` | - |
|
|
430
|
+
|
|
431
|
+
`class`, `style` and native attributes and events (including `role`, `aria-*` and `onclick`) land on the root `aside` element.
|
|
432
|
+
|
|
433
|
+
### responsive map
|
|
434
|
+
|
|
435
|
+
```text
|
|
436
|
+
{
|
|
437
|
+
xs: '(max-width: 575px)',
|
|
438
|
+
sm: '(min-width: 576px)',
|
|
439
|
+
md: '(min-width: 768px)',
|
|
440
|
+
lg: '(min-width: 992px)',
|
|
441
|
+
xl: '(min-width: 1200px)',
|
|
442
|
+
xxl: '(min-width: 1600px)',
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
## Accessibility
|
|
447
|
+
|
|
448
|
+
### ARIA
|
|
449
|
+
|
|
450
|
+
- Sider renders an `aside`; pass `aria-label` to describe what this Sider is for.
|
|
451
|
+
- Header and Footer render `header` and `footer` by default. Inside the `section` of a Layout they are not banner or contentinfo landmarks; pass `role="banner"` or `role="contentinfo"` when they are the header or footer of the whole page.
|
|
452
|
+
- Content renders `main` by default, and a page should have only one `main`; when nesting, use `tagName` to switch to another tag.
|
|
453
|
+
- Header, Content and Footer accept `role` and `aria-label` to describe the corresponding element.
|
|
454
|
+
|
|
455
|
+
## Changes from Semi Design
|
|
456
|
+
|
|
457
|
+
From the project release notes (written in Chinese). Your knowledge of Semi Design does not cover these.
|
|
458
|
+
|
|
459
|
+
- Svelte:`Layout.Header` 等之外另有具名导出 `LayoutHeader`、`LayoutFooter`、`LayoutContent`、`LayoutSider`;Sider 回调为 `onBreakpoint`;嵌套较深的 Sider 需传 `hasSider`(服务端首帧缺 `has-sider`)。
|