@fjyueke/bify-mcp 1.0.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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +248 -0
- package/metaData/components/action-sheet/api.md +74 -0
- package/metaData/components/action-sheet/doc.md +243 -0
- package/metaData/components/action-sheet/example/index.tsx +116 -0
- package/metaData/components/area-picker/api.md +25 -0
- package/metaData/components/area-picker/doc.md +132 -0
- package/metaData/components/area-picker/example/index.tsx +60 -0
- package/metaData/components/avatar/api.md +19 -0
- package/metaData/components/avatar/doc.md +170 -0
- package/metaData/components/avatar/example/index.tsx +76 -0
- package/metaData/components/back-top/api.md +21 -0
- package/metaData/components/back-top/doc.md +142 -0
- package/metaData/components/back-top/example/index.tsx +96 -0
- package/metaData/components/backdrop/api.md +20 -0
- package/metaData/components/backdrop/doc.md +98 -0
- package/metaData/components/backdrop/example/index.tsx +33 -0
- package/metaData/components/badge/api.md +10 -0
- package/metaData/components/badge/doc.md +169 -0
- package/metaData/components/badge/example/index.tsx +81 -0
- package/metaData/components/button/api.md +31 -0
- package/metaData/components/button/doc.md +235 -0
- package/metaData/components/button/example/index.tsx +235 -0
- package/metaData/components/calendar/api.md +62 -0
- package/metaData/components/calendar/doc.md +516 -0
- package/metaData/components/calendar/example/index.tsx +501 -0
- package/metaData/components/cascader/api.md +55 -0
- package/metaData/components/cascader/doc.md +358 -0
- package/metaData/components/cascader/example/index.tsx +159 -0
- package/metaData/components/cell/api.md +37 -0
- package/metaData/components/cell/doc.md +158 -0
- package/metaData/components/cell/example/index.tsx +44 -0
- package/metaData/components/checkbox/api.md +35 -0
- package/metaData/components/checkbox/doc.md +203 -0
- package/metaData/components/checkbox/example/index.tsx +94 -0
- package/metaData/components/circle/api.md +17 -0
- package/metaData/components/circle/doc.md +123 -0
- package/metaData/components/circle/example/index.tsx +81 -0
- package/metaData/components/collapse/api.md +31 -0
- package/metaData/components/collapse/doc.md +142 -0
- package/metaData/components/collapse/example/index.tsx +81 -0
- package/metaData/components/config-provider/api.md +7 -0
- package/metaData/components/config-provider/doc.md +193 -0
- package/metaData/components/config-provider/example/index.tsx +54 -0
- package/metaData/components/countdown/api.md +46 -0
- package/metaData/components/countdown/doc.md +167 -0
- package/metaData/components/countdown/example/index.tsx +70 -0
- package/metaData/components/datetime-picker/api.md +25 -0
- package/metaData/components/datetime-picker/doc.md +317 -0
- package/metaData/components/datetime-picker/example/index.tsx +265 -0
- package/metaData/components/dialog/api.md +66 -0
- package/metaData/components/dialog/doc.md +292 -0
- package/metaData/components/dialog/example/index.tsx +138 -0
- package/metaData/components/divider/api.md +15 -0
- package/metaData/components/divider/doc.md +108 -0
- package/metaData/components/divider/example/index.tsx +45 -0
- package/metaData/components/dropdown-menu/api.md +37 -0
- package/metaData/components/dropdown-menu/doc.md +279 -0
- package/metaData/components/dropdown-menu/example/index.tsx +182 -0
- package/metaData/components/empty/api.md +20 -0
- package/metaData/components/empty/doc.md +126 -0
- package/metaData/components/empty/example/index.tsx +66 -0
- package/metaData/components/field/api.md +10 -0
- package/metaData/components/field/doc.md +274 -0
- package/metaData/components/field/example/index.tsx +203 -0
- package/metaData/components/fixed-nav/api.md +21 -0
- package/metaData/components/fixed-nav/doc.md +196 -0
- package/metaData/components/fixed-nav/example/index.tsx +80 -0
- package/metaData/components/fixed-view/api.md +10 -0
- package/metaData/components/fixed-view/doc.md +25 -0
- package/metaData/components/fixed-view/example/index.tsx +12 -0
- package/metaData/components/flex/api.md +18 -0
- package/metaData/components/flex/doc.md +103 -0
- package/metaData/components/flex/example/index.tsx +58 -0
- package/metaData/components/floating-bubble/api.md +18 -0
- package/metaData/components/floating-bubble/doc.md +94 -0
- package/metaData/components/floating-bubble/example/index.tsx +55 -0
- package/metaData/components/floating-panel/api.md +19 -0
- package/metaData/components/floating-panel/doc.md +174 -0
- package/metaData/components/floating-panel/example/index.tsx +131 -0
- package/metaData/components/form/api.md +124 -0
- package/metaData/components/form/doc.md +759 -0
- package/metaData/components/form/example/index.tsx +222 -0
- package/metaData/components/grid/api.md +28 -0
- package/metaData/components/grid/doc.md +167 -0
- package/metaData/components/grid/example/index.tsx +80 -0
- package/metaData/components/image/api.md +42 -0
- package/metaData/components/image/doc.md +117 -0
- package/metaData/components/image/example/index.tsx +76 -0
- package/metaData/components/index-list/api.md +39 -0
- package/metaData/components/index-list/doc.md +176 -0
- package/metaData/components/index-list/example/index.tsx +110 -0
- package/metaData/components/list/api.md +30 -0
- package/metaData/components/list/doc.md +317 -0
- package/metaData/components/list/example/index.tsx +218 -0
- package/metaData/components/loading/api.md +10 -0
- package/metaData/components/loading/doc.md +113 -0
- package/metaData/components/loading/example/index.tsx +47 -0
- package/metaData/components/navbar/api.md +26 -0
- package/metaData/components/navbar/doc.md +85 -0
- package/metaData/components/navbar/example/index.tsx +28 -0
- package/metaData/components/notice-bar/api.md +28 -0
- package/metaData/components/notice-bar/doc.md +154 -0
- package/metaData/components/notice-bar/example/index.tsx +107 -0
- package/metaData/components/notify/api.md +28 -0
- package/metaData/components/notify/doc.md +140 -0
- package/metaData/components/notify/example/index.tsx +89 -0
- package/metaData/components/number-keyboard/api.md +21 -0
- package/metaData/components/number-keyboard/doc.md +247 -0
- package/metaData/components/number-keyboard/example/index.tsx +201 -0
- package/metaData/components/pagination/api.md +18 -0
- package/metaData/components/pagination/doc.md +113 -0
- package/metaData/components/pagination/example/index.tsx +73 -0
- package/metaData/components/password-input/api.md +25 -0
- package/metaData/components/password-input/doc.md +126 -0
- package/metaData/components/password-input/example/index.tsx +124 -0
- package/metaData/components/picker/api.md +61 -0
- package/metaData/components/picker/doc.md +336 -0
- package/metaData/components/picker/example/index.tsx +232 -0
- package/metaData/components/popup/api.md +48 -0
- package/metaData/components/popup/doc.md +150 -0
- package/metaData/components/popup/example/index.tsx +214 -0
- package/metaData/components/progress/api.md +11 -0
- package/metaData/components/progress/doc.md +105 -0
- package/metaData/components/progress/example/index.tsx +58 -0
- package/metaData/components/pull-refresh/api.md +18 -0
- package/metaData/components/pull-refresh/doc.md +198 -0
- package/metaData/components/pull-refresh/example/index.tsx +153 -0
- package/metaData/components/radio/api.md +26 -0
- package/metaData/components/radio/doc.md +201 -0
- package/metaData/components/radio/example/index.tsx +103 -0
- package/metaData/components/rate/api.md +23 -0
- package/metaData/components/rate/doc.md +122 -0
- package/metaData/components/rate/example/index.tsx +36 -0
- package/metaData/components/rolling-text/api.md +23 -0
- package/metaData/components/rolling-text/doc.md +153 -0
- package/metaData/components/rolling-text/example/index.tsx +150 -0
- package/metaData/components/safe-area/api.md +8 -0
- package/metaData/components/safe-area/doc.md +30 -0
- package/metaData/components/safe-area/example/index.tsx +16 -0
- package/metaData/components/search/api.md +35 -0
- package/metaData/components/search/doc.md +185 -0
- package/metaData/components/search/example/index.tsx +101 -0
- package/metaData/components/share-sheet/api.md +48 -0
- package/metaData/components/share-sheet/doc.md +215 -0
- package/metaData/components/share-sheet/example/index.tsx +143 -0
- package/metaData/components/sidebar/api.md +28 -0
- package/metaData/components/sidebar/doc.md +122 -0
- package/metaData/components/sidebar/example/index.tsx +58 -0
- package/metaData/components/signature/api.md +19 -0
- package/metaData/components/signature/doc.md +115 -0
- package/metaData/components/signature/example/index.tsx +56 -0
- package/metaData/components/skeleton/api.md +45 -0
- package/metaData/components/skeleton/doc.md +131 -0
- package/metaData/components/skeleton/example/index.tsx +80 -0
- package/metaData/components/slider/api.md +28 -0
- package/metaData/components/slider/doc.md +151 -0
- package/metaData/components/slider/example/index.tsx +54 -0
- package/metaData/components/space/api.md +12 -0
- package/metaData/components/space/doc.md +125 -0
- package/metaData/components/space/example/index.tsx +75 -0
- package/metaData/components/stepper/api.md +37 -0
- package/metaData/components/stepper/doc.md +152 -0
- package/metaData/components/stepper/example/index.tsx +45 -0
- package/metaData/components/steps/api.md +9 -0
- package/metaData/components/steps/doc.md +143 -0
- package/metaData/components/steps/example/index.tsx +93 -0
- package/metaData/components/sticky/api.md +16 -0
- package/metaData/components/sticky/doc.md +87 -0
- package/metaData/components/sticky/example/index.tsx +62 -0
- package/metaData/components/swipe-cell/api.md +19 -0
- package/metaData/components/swipe-cell/doc.md +105 -0
- package/metaData/components/swipe-cell/example/index.tsx +62 -0
- package/metaData/components/swiper/api.md +22 -0
- package/metaData/components/swiper/doc.md +228 -0
- package/metaData/components/swiper/example/index.tsx +118 -0
- package/metaData/components/switch/api.md +17 -0
- package/metaData/components/switch/doc.md +110 -0
- package/metaData/components/switch/example/index.tsx +57 -0
- package/metaData/components/tabbar/api.md +27 -0
- package/metaData/components/tabbar/doc.md +160 -0
- package/metaData/components/tabbar/example/index.tsx +99 -0
- package/metaData/components/tabs/api.md +36 -0
- package/metaData/components/tabs/doc.md +307 -0
- package/metaData/components/tabs/example/index.tsx +231 -0
- package/metaData/components/tag/api.md +17 -0
- package/metaData/components/tag/doc.md +162 -0
- package/metaData/components/tag/example/index.tsx +84 -0
- package/metaData/components/text-ellipsis/api.md +26 -0
- package/metaData/components/text-ellipsis/doc.md +135 -0
- package/metaData/components/text-ellipsis/example/index.tsx +44 -0
- package/metaData/components/timeline/api.md +20 -0
- package/metaData/components/timeline/doc.md +210 -0
- package/metaData/components/timeline/example/index.tsx +145 -0
- package/metaData/components/toast/api.md +39 -0
- package/metaData/components/toast/doc.md +256 -0
- package/metaData/components/toast/example/index.tsx +136 -0
- package/metaData/components/tree-select/api.md +19 -0
- package/metaData/components/tree-select/doc.md +185 -0
- package/metaData/components/tree-select/example/index.tsx +112 -0
- package/metaData/components/uploader/api.md +32 -0
- package/metaData/components/uploader/doc.md +340 -0
- package/metaData/components/uploader/example/index.tsx +222 -0
- package/metaData/components/watermark/api.md +18 -0
- package/metaData/components/watermark/doc.md +97 -0
- package/metaData/components/watermark/example/index.tsx +62 -0
- package/metaData/components-index.json +274 -0
- package/package.json +56 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Image, Swiper, Toast } from "@fjyueke/bify-core"
|
|
2
|
+
import { useState } from "react"
|
|
3
|
+
import Block from "../../../components/block"
|
|
4
|
+
import Page from "../../../components/page"
|
|
5
|
+
import "./index.scss"
|
|
6
|
+
|
|
7
|
+
function BasicSwiper() {
|
|
8
|
+
return (
|
|
9
|
+
<Swiper className="basic-swiper" autoplay={4000}>
|
|
10
|
+
<Swiper.Indicator />
|
|
11
|
+
<Swiper.Item>1</Swiper.Item>
|
|
12
|
+
<Swiper.Item>2</Swiper.Item>
|
|
13
|
+
<Swiper.Item>3</Swiper.Item>
|
|
14
|
+
<Swiper.Item>4</Swiper.Item>
|
|
15
|
+
</Swiper>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function ImageSwiper() {
|
|
20
|
+
return (
|
|
21
|
+
<Swiper className="image-swiper" lazyRender autoplay={4000}>
|
|
22
|
+
<Swiper.Indicator />
|
|
23
|
+
<Swiper.Item>
|
|
24
|
+
<Image className="image" src="https://img01.yzcdn.cn/vant/apple-1.jpg" />
|
|
25
|
+
</Swiper.Item>
|
|
26
|
+
<Swiper.Item>
|
|
27
|
+
<Image className="image" src="https://img01.yzcdn.cn/vant/apple-2.jpg" />
|
|
28
|
+
</Swiper.Item>
|
|
29
|
+
<Swiper.Item>
|
|
30
|
+
<Image className="image" src="https://img01.yzcdn.cn/vant/apple-3.jpg" />
|
|
31
|
+
</Swiper.Item>
|
|
32
|
+
<Swiper.Item>
|
|
33
|
+
<Image className="image" src="https://img01.yzcdn.cn/vant/apple-4.jpg" />
|
|
34
|
+
</Swiper.Item>
|
|
35
|
+
</Swiper>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function SwiperWithOnChange() {
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
<Toast id="toast" />
|
|
43
|
+
<Swiper
|
|
44
|
+
className="onchange-swiper"
|
|
45
|
+
onChange={(value) => Toast.open(`当前 Swipe 索引:${value}`)}
|
|
46
|
+
>
|
|
47
|
+
<Swiper.Indicator />
|
|
48
|
+
<Swiper.Item>1</Swiper.Item>
|
|
49
|
+
<Swiper.Item>2</Swiper.Item>
|
|
50
|
+
<Swiper.Item>3</Swiper.Item>
|
|
51
|
+
<Swiper.Item>4</Swiper.Item>
|
|
52
|
+
</Swiper>
|
|
53
|
+
</>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function SwiperWithCustomWidth() {
|
|
58
|
+
return (
|
|
59
|
+
<Swiper className="basic-swiper" loop={false} width={300}>
|
|
60
|
+
<Swiper.Indicator />
|
|
61
|
+
<Swiper.Item>1</Swiper.Item>
|
|
62
|
+
<Swiper.Item>2</Swiper.Item>
|
|
63
|
+
<Swiper.Item>3</Swiper.Item>
|
|
64
|
+
<Swiper.Item>4</Swiper.Item>
|
|
65
|
+
</Swiper>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function VerticalSwiper() {
|
|
70
|
+
return (
|
|
71
|
+
<Swiper className="vertical-swiper" direction="vertical" autoplay={4000}>
|
|
72
|
+
<Swiper.Indicator />
|
|
73
|
+
<Swiper.Item>1</Swiper.Item>
|
|
74
|
+
<Swiper.Item>2</Swiper.Item>
|
|
75
|
+
<Swiper.Item>3</Swiper.Item>
|
|
76
|
+
<Swiper.Item>4</Swiper.Item>
|
|
77
|
+
</Swiper>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function SwiperWithCustomIndicator() {
|
|
82
|
+
const [value, setValue] = useState(0)
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Swiper className="basic-swiper" onChange={setValue}>
|
|
86
|
+
<Swiper.Item>1</Swiper.Item>
|
|
87
|
+
<Swiper.Item>2</Swiper.Item>
|
|
88
|
+
<Swiper.Item>3</Swiper.Item>
|
|
89
|
+
<Swiper.Item>4</Swiper.Item>
|
|
90
|
+
<Swiper.Indicator className="custom-indicator">{value + 1}/4</Swiper.Indicator>
|
|
91
|
+
</Swiper>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default function SwiperDemo() {
|
|
96
|
+
return (
|
|
97
|
+
<Page title="Swiper 轮播" className="swiper-demo">
|
|
98
|
+
<Block title="基础用法">
|
|
99
|
+
<BasicSwiper />
|
|
100
|
+
</Block>
|
|
101
|
+
<Block title="懒加载">
|
|
102
|
+
<ImageSwiper />
|
|
103
|
+
</Block>
|
|
104
|
+
<Block title="监听 change 事件">
|
|
105
|
+
<SwiperWithOnChange />
|
|
106
|
+
</Block>
|
|
107
|
+
<Block title="纵向滚动">
|
|
108
|
+
<VerticalSwiper />
|
|
109
|
+
</Block>
|
|
110
|
+
<Block title="自定义滑块大小">
|
|
111
|
+
<SwiperWithCustomWidth />
|
|
112
|
+
</Block>
|
|
113
|
+
<Block title="自定义指示器">
|
|
114
|
+
<SwiperWithCustomIndicator />
|
|
115
|
+
</Block>
|
|
116
|
+
</Page>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| -------------- | ------------------------ | ------------------ | --------- |
|
|
7
|
+
| defaultChecked | 默认开关选中状态 | _boolean_ | `false` |
|
|
8
|
+
| checked | 开关选中状态 | _boolean_ | `false` |
|
|
9
|
+
| loading | 是否为加载状态 | _boolean_ | `false` |
|
|
10
|
+
| disabled | 是否为禁用状态 | _boolean_ | `false` |
|
|
11
|
+
| size | 开关尺寸,默认单位为`px` | _number \| string_ | `30px` |
|
|
12
|
+
|
|
13
|
+
### Events
|
|
14
|
+
|
|
15
|
+
| 事件名 | 说明 | 回调参数 |
|
|
16
|
+
| ------ | ------------------ | ------------------- |
|
|
17
|
+
| onChange | 开关状态切换时触发 | _value: boolean_ |
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Switch 开关
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
用于在打开和关闭状态之间进行切换。
|
|
6
|
+
|
|
7
|
+
### 引入
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Switch } from "@fjyueke/bify-core"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 代码演示
|
|
14
|
+
|
|
15
|
+
### 基础用法
|
|
16
|
+
|
|
17
|
+
通过 `checked` 绑定开关的选中状态,`true` 表示开,`false` 表示关。
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<Switch />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 禁用状态
|
|
24
|
+
|
|
25
|
+
通过 `disabled` 属性来禁用开关,禁用状态下开关不可点击。
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Switch disabled />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 加载状态
|
|
32
|
+
|
|
33
|
+
通过 `loading` 属性设置开关为加载状态,加载状态下开关不可点击。
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<Switch loading />
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 自定义大小
|
|
40
|
+
|
|
41
|
+
通过 `size` 属性自定义开关的大小。
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<Switch size="24" />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 自定义颜色
|
|
48
|
+
|
|
49
|
+
通过 `css` 设置打开与关闭时的背景色。
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<Switch className="custom-color" />
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```scss
|
|
56
|
+
.custom-color {
|
|
57
|
+
--switch-background-color: #dcdee0;
|
|
58
|
+
--switch-checked-color: #ee0a24;
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 搭配单元格使用
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<Cell align="center" title="标题" rightIcon={<Switch size="24" />} />
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## API
|
|
69
|
+
|
|
70
|
+
### Props
|
|
71
|
+
|
|
72
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
73
|
+
| -------------- | ------------------------ | ------------------ | --------- |
|
|
74
|
+
| defaultChecked | 默认开关选中状态 | _boolean_ | `false` |
|
|
75
|
+
| checked | 开关选中状态 | _boolean_ | `false` |
|
|
76
|
+
| loading | 是否为加载状态 | _boolean_ | `false` |
|
|
77
|
+
| disabled | 是否为禁用状态 | _boolean_ | `false` |
|
|
78
|
+
| size | 开关尺寸,默认单位为`px` | _number \| string_ | `30px` |
|
|
79
|
+
|
|
80
|
+
### Events
|
|
81
|
+
|
|
82
|
+
| 事件名 | 说明 | 回调参数 |
|
|
83
|
+
| ------ | ------------------ | ------------------- |
|
|
84
|
+
| onChange | 开关状态切换时触发 | _value: boolean_ |
|
|
85
|
+
|
|
86
|
+
## 主题定制
|
|
87
|
+
|
|
88
|
+
### 样式变量
|
|
89
|
+
|
|
90
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
|
|
91
|
+
|
|
92
|
+
| 名称 | 默认值 | 描述 |
|
|
93
|
+
|---------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|-----|
|
|
94
|
+
| switch-size | _30px * $hd_ | - |
|
|
95
|
+
| switch-font-size | _var(--switch-size)_ | - |
|
|
96
|
+
| switch-width | _2em_ | - |
|
|
97
|
+
| switch-height | _1em_ | - |
|
|
98
|
+
| switch-border | _var(--border-width-base) solid rgba(0, 0, 0, 0.1)_ | - |
|
|
99
|
+
| switch-background-color | _var(--white)_ | - |
|
|
100
|
+
| switch-transition-duration | _var(--animation-duration-base)_ | - |
|
|
101
|
+
| switch-node-size | _1em_ | - |
|
|
102
|
+
| switch-node-width | _var(--switch-node-size)_ | - |
|
|
103
|
+
| switch-node-height | _var(--switch-node-size)_ | - |
|
|
104
|
+
| switch-node-translate-x | _translateX(calc(var(--switch-width) - var(--switch-node-size)))_ | - |
|
|
105
|
+
| switch-node-background-color | _var(--white)_ | - |
|
|
106
|
+
| switch-node-box-shadow | _0 3px * $hd 1px * $hd 0 rgba(0, 0, 0, 0.05), <br/>0 2px * $hd 2px * $hd 0 rgba(0, 0, 0, 0.1),<br/> 0 3px * $hd 3px * $hd 0 rgba(0, 0, 0, 0.05)_ | - |
|
|
107
|
+
| switch-checked-color | _var(var(--primary-color)_ | - |
|
|
108
|
+
| switch-checked-background-color | _var(--switch-checked-color)_ | - |
|
|
109
|
+
| switch-loading-color | _var(--switch-checked-color)_ | - |
|
|
110
|
+
| switch-disabled-opacity | _var(--disabled-opacity)_ | - |
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Cell, Switch } from "@fjyueke/bify-core"
|
|
2
|
+
import { useState } from "react"
|
|
3
|
+
import Block from "../../../components/block"
|
|
4
|
+
import Page from "../../../components/page"
|
|
5
|
+
import "./index.scss"
|
|
6
|
+
|
|
7
|
+
interface SwitchListProps {
|
|
8
|
+
checked?: boolean
|
|
9
|
+
|
|
10
|
+
onChange?(checked: boolean): void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function BasicSwitch({ checked, onChange }: SwitchListProps) {
|
|
14
|
+
return <Switch checked={checked} onChange={onChange} />
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function DisabledSwitch({ checked }: SwitchListProps) {
|
|
18
|
+
return <Switch checked={checked} disabled />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function LoadingSwitch({ checked }: SwitchListProps) {
|
|
22
|
+
return <Switch checked={checked} loading />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function SwitchList() {
|
|
26
|
+
const [checked, setChecked] = useState(false)
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<Block title="基础用法">
|
|
30
|
+
<BasicSwitch checked={checked} onChange={setChecked} />
|
|
31
|
+
</Block>
|
|
32
|
+
<Block title="禁用状态">
|
|
33
|
+
<DisabledSwitch checked={checked} />
|
|
34
|
+
</Block>
|
|
35
|
+
<Block title="加载状态">
|
|
36
|
+
<LoadingSwitch checked={checked} />
|
|
37
|
+
</Block>
|
|
38
|
+
</>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default function SwitchDemo() {
|
|
43
|
+
return (
|
|
44
|
+
<Page title="Switch 开关" className="switch-demo">
|
|
45
|
+
<SwitchList />
|
|
46
|
+
<Block title="自定义大小">
|
|
47
|
+
<Switch size="24" />
|
|
48
|
+
</Block>
|
|
49
|
+
<Block title="自定义颜色">
|
|
50
|
+
<Switch className="custom-color" defaultChecked />
|
|
51
|
+
</Block>
|
|
52
|
+
<Block title="搭配单元格使用" className="switch-with-cell">
|
|
53
|
+
<Cell align="center" title="标题" rightIcon={<Switch size="24" />} />
|
|
54
|
+
</Block>
|
|
55
|
+
</Page>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Tabbar Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
|--------------|---------------------------|-----------|---------|
|
|
7
|
+
| defaultValue | 默认选中标签的标识或索引值 | _any_ | `0` |
|
|
8
|
+
| value | 当前选中标签的标识或索引值 | _any_ | `0` |
|
|
9
|
+
| bordered | 是否显示外边框 | _boolean_ | `false` |
|
|
10
|
+
| fixed | 是否固定在底部 | _boolean_ | `false` |
|
|
11
|
+
| safeArea | 安全区域,可选值 `top` `bottom`,仅在`fixed=true`时有效 | _string_ | - |
|
|
12
|
+
| placeholder | 固定在底部时,是否在标签位置生成一个等高的占位元素 | _boolean_ | `false` |
|
|
13
|
+
|
|
14
|
+
### Tabbar Events
|
|
15
|
+
|
|
16
|
+
| 事件名 | 说明 | 回调参数 |
|
|
17
|
+
| ------ | -------------- | -------------------------- |
|
|
18
|
+
| onChange | 切换标签时触发 | _value: any_ |
|
|
19
|
+
|
|
20
|
+
### Tabbar.TabItem Props
|
|
21
|
+
|
|
22
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
23
|
+
|----------|------------------------------------------------|-------------|----------|
|
|
24
|
+
| value | 标签值,作为匹配的标识符 | _any_ | - |
|
|
25
|
+
| icon | [图标](/components/icon)或[图片](/components/image) | _ReactNode_ | - |
|
|
26
|
+
| badge | 图标上徽标的内容 | _boolean \| number \| string \| Badge \| ReactNode_ | - |
|
|
27
|
+
| children | 标签名 | _ReactNode_ | - |
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Tabbar 标签栏
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
底部导航栏,用于在不同页面之间进行切换。
|
|
6
|
+
|
|
7
|
+
### 引入
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Tabbar } from "@fjyueke/bify-core"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 代码演示
|
|
14
|
+
|
|
15
|
+
### 基础用法
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Tabbar } from "@fjyueke/bify-core"
|
|
19
|
+
import { FriendsOutlined, HomeOutlined, Search, SettingOutlined } from "@fjyueke/bify-icons"
|
|
20
|
+
|
|
21
|
+
function BasicTabbar() {
|
|
22
|
+
return (
|
|
23
|
+
<Tabbar>
|
|
24
|
+
<Tabbar.TabItem icon={<HomeOutlined />}>标签</Tabbar.TabItem>
|
|
25
|
+
<Tabbar.TabItem icon={<Search />}>标签</Tabbar.TabItem>
|
|
26
|
+
<Tabbar.TabItem icon={<FriendsOutlined />}>标签</Tabbar.TabItem>
|
|
27
|
+
<Tabbar.TabItem icon={<SettingOutlined />}>标签</Tabbar.TabItem>
|
|
28
|
+
</Tabbar>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 通过标识匹配
|
|
35
|
+
|
|
36
|
+
在标签 `Tabbar.TabItem` 指定 `value` 属性的情况下,`value` 的值为当前标签的 `value`。
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { Tabbar } from "@fjyueke/bify-core"
|
|
40
|
+
import { FriendsOutlined, HomeOutlined, Search, SettingOutlined } from "@fjyueke/bify-icons"
|
|
41
|
+
|
|
42
|
+
function KeyTabbar() {
|
|
43
|
+
return (
|
|
44
|
+
<Tabbar defaultValue="1">
|
|
45
|
+
<Tabbar.TabItem value="1" icon={<HomeOutlined />}>
|
|
46
|
+
标签
|
|
47
|
+
</Tabbar.TabItem>
|
|
48
|
+
<Tabbar.TabItem value="2" icon={<Search />}>
|
|
49
|
+
标签
|
|
50
|
+
</Tabbar.TabItem>
|
|
51
|
+
<Tabbar.TabItem value="3" icon={<FriendsOutlined />}>
|
|
52
|
+
标签
|
|
53
|
+
</Tabbar.TabItem>
|
|
54
|
+
<Tabbar.TabItem value="4" icon={<SettingOutlined />}>
|
|
55
|
+
标签
|
|
56
|
+
</Tabbar.TabItem>
|
|
57
|
+
</Tabbar>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 徽标提示
|
|
63
|
+
|
|
64
|
+
设置 `badge` 属性为 `true` 后,会在图标右上角展示一个小红点;设置 `badge` 属性为 `number` 后,会在图标右上角展示相应的徽标。
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { Badge, Tabbar } from "@fjyueke/bify-core"
|
|
68
|
+
import { FriendsOutlined, HomeOutlined, Search, SettingOutlined } from "@fjyueke/bify-icons"
|
|
69
|
+
|
|
70
|
+
function BadgeTabbar() {
|
|
71
|
+
return (
|
|
72
|
+
<Tabbar>
|
|
73
|
+
<Tabbar.TabItem icon={<HomeOutlined />}>标签</Tabbar.TabItem>
|
|
74
|
+
<Tabbar.TabItem badge icon={<Search />}>
|
|
75
|
+
标签
|
|
76
|
+
</Tabbar.TabItem>
|
|
77
|
+
<Tabbar.TabItem badge="5" icon={<FriendsOutlined />}>
|
|
78
|
+
标签
|
|
79
|
+
</Tabbar.TabItem>
|
|
80
|
+
<Tabbar.TabItem badge={<Badge content={100} max={99} />} icon={<SettingOutlined />}>
|
|
81
|
+
标签
|
|
82
|
+
</Tabbar.TabItem>
|
|
83
|
+
</Tabbar>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 自定义颜色
|
|
89
|
+
|
|
90
|
+
通过 css 设置设置选中或未选择标签的颜色。
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import { Tabbar } from "@fjyueke/bify-core"
|
|
94
|
+
import { FriendsOutlined, HomeOutlined, Search, SettingOutlined } from "@fjyueke/bify-icons"
|
|
95
|
+
|
|
96
|
+
function TabbarWithCustomColor() {
|
|
97
|
+
return (
|
|
98
|
+
<Tabbar className="custom-color">
|
|
99
|
+
<Tabbar.TabItem icon={<HomeOutlined />}>标签</Tabbar.TabItem>
|
|
100
|
+
<Tabbar.TabItem icon={<Search />}>标签</Tabbar.TabItem>
|
|
101
|
+
<Tabbar.TabItem icon={<FriendsOutlined />}>标签</Tabbar.TabItem>
|
|
102
|
+
<Tabbar.TabItem icon={<SettingOutlined />}>标签</Tabbar.TabItem>
|
|
103
|
+
</Tabbar>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```scss
|
|
109
|
+
.custom-color {
|
|
110
|
+
--tabbar-item-color: #000;
|
|
111
|
+
--tabbar-item-active-color: #ee0a24;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## API
|
|
116
|
+
|
|
117
|
+
### Tabbar Props
|
|
118
|
+
|
|
119
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
120
|
+
|--------------|---------------------------|-----------|---------|
|
|
121
|
+
| defaultValue | 默认选中标签的标识或索引值 | _any_ | `0` |
|
|
122
|
+
| value | 当前选中标签的标识或索引值 | _any_ | `0` |
|
|
123
|
+
| bordered | 是否显示外边框 | _boolean_ | `false` |
|
|
124
|
+
| fixed | 是否固定在底部 | _boolean_ | `false` |
|
|
125
|
+
| safeArea | 安全区域,可选值 `top` `bottom`,仅在`fixed=true`时有效 | _string_ | - |
|
|
126
|
+
| placeholder | 固定在底部时,是否在标签位置生成一个等高的占位元素 | _boolean_ | `false` |
|
|
127
|
+
|
|
128
|
+
### Tabbar Events
|
|
129
|
+
|
|
130
|
+
| 事件名 | 说明 | 回调参数 |
|
|
131
|
+
| ------ | -------------- | -------------------------- |
|
|
132
|
+
| onChange | 切换标签时触发 | _value: any_ |
|
|
133
|
+
|
|
134
|
+
### Tabbar.TabItem Props
|
|
135
|
+
|
|
136
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
137
|
+
|----------|------------------------------------------------|-------------|----------|
|
|
138
|
+
| value | 标签值,作为匹配的标识符 | _any_ | - |
|
|
139
|
+
| icon | [图标](/components/icon)或[图片](/components/image) | _ReactNode_ | - |
|
|
140
|
+
| badge | 图标上徽标的内容 | _boolean \| number \| string \| Badge \| ReactNode_ | - |
|
|
141
|
+
| children | 标签名 | _ReactNode_ | - |
|
|
142
|
+
|
|
143
|
+
## 主题定制
|
|
144
|
+
|
|
145
|
+
### 样式变量
|
|
146
|
+
|
|
147
|
+
组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
|
|
148
|
+
|
|
149
|
+
| 名称 | 默认值 | 描述 |
|
|
150
|
+
|---------------------------------------|-----------------------|-----|
|
|
151
|
+
| --tabbar-height | _50px * $hd_ | - |
|
|
152
|
+
| --tabbar-z-index | _1_ | - |
|
|
153
|
+
| --tabbar-background-color | _var(--white)_ | - |
|
|
154
|
+
| --tabbar-item-font-size | _var(--font-size-sm)_ | - |
|
|
155
|
+
| --tabbar-item-color | _var(--gray-7)_ | - |
|
|
156
|
+
| --tabbar-item-line-height | _1_ | - |
|
|
157
|
+
| --tabbar-item-icon-size | _22px * $hd_ | - |
|
|
158
|
+
| --tabbar-item-margin-bottom | _4px * $hd_ | - |
|
|
159
|
+
| --tabbar-item-active-color | _var(--blue)_ | - |
|
|
160
|
+
| --tabbar-item-active-background-color | _var(--white)_ | - |
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Badge, Tabbar, Toast } from "@fjyueke/bify-core"
|
|
2
|
+
import { FriendsOutlined, HomeOutlined, Search, SettingOutlined } from "@fjyueke/bify-icons"
|
|
3
|
+
import Block from "../../../components/block"
|
|
4
|
+
import Page from "../../../components/page"
|
|
5
|
+
import "./index.scss"
|
|
6
|
+
|
|
7
|
+
function BasicTabbar() {
|
|
8
|
+
return (
|
|
9
|
+
<Tabbar>
|
|
10
|
+
<Tabbar.TabItem icon={<HomeOutlined />}>标签</Tabbar.TabItem>
|
|
11
|
+
<Tabbar.TabItem icon={<Search />}>标签</Tabbar.TabItem>
|
|
12
|
+
<Tabbar.TabItem icon={<FriendsOutlined />}>标签</Tabbar.TabItem>
|
|
13
|
+
<Tabbar.TabItem icon={<SettingOutlined />}>标签</Tabbar.TabItem>
|
|
14
|
+
</Tabbar>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function KeyTabbar() {
|
|
19
|
+
return (
|
|
20
|
+
<Tabbar defaultValue="1">
|
|
21
|
+
<Tabbar.TabItem value="1" icon={<HomeOutlined />}>
|
|
22
|
+
标签
|
|
23
|
+
</Tabbar.TabItem>
|
|
24
|
+
<Tabbar.TabItem value="2" icon={<Search />}>
|
|
25
|
+
标签
|
|
26
|
+
</Tabbar.TabItem>
|
|
27
|
+
<Tabbar.TabItem value="3" icon={<FriendsOutlined />}>
|
|
28
|
+
标签
|
|
29
|
+
</Tabbar.TabItem>
|
|
30
|
+
<Tabbar.TabItem value="4" icon={<SettingOutlined />}>
|
|
31
|
+
标签
|
|
32
|
+
</Tabbar.TabItem>
|
|
33
|
+
</Tabbar>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function BadgeTabbar() {
|
|
38
|
+
return (
|
|
39
|
+
<Tabbar>
|
|
40
|
+
<Tabbar.TabItem icon={<HomeOutlined />}>标签</Tabbar.TabItem>
|
|
41
|
+
<Tabbar.TabItem badge icon={<Search />}>
|
|
42
|
+
标签
|
|
43
|
+
</Tabbar.TabItem>
|
|
44
|
+
<Tabbar.TabItem badge="5" icon={<FriendsOutlined />}>
|
|
45
|
+
标签
|
|
46
|
+
</Tabbar.TabItem>
|
|
47
|
+
<Tabbar.TabItem badge={<Badge content={100} max={99} />} icon={<SettingOutlined />}>
|
|
48
|
+
标签
|
|
49
|
+
</Tabbar.TabItem>
|
|
50
|
+
</Tabbar>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function TabbarWithCustomColor() {
|
|
55
|
+
return (
|
|
56
|
+
<Tabbar className="custom-color">
|
|
57
|
+
<Tabbar.TabItem icon={<HomeOutlined />}>标签</Tabbar.TabItem>
|
|
58
|
+
<Tabbar.TabItem icon={<Search />}>标签</Tabbar.TabItem>
|
|
59
|
+
<Tabbar.TabItem icon={<FriendsOutlined />}>标签</Tabbar.TabItem>
|
|
60
|
+
<Tabbar.TabItem icon={<SettingOutlined />}>标签</Tabbar.TabItem>
|
|
61
|
+
</Tabbar>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function EventTabbar() {
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<Toast id="toast" />
|
|
69
|
+
<Tabbar onChange={(value) => Toast.open(`标签 ${Number(value) + 1}`)}>
|
|
70
|
+
<Tabbar.TabItem icon={<HomeOutlined />}>标签</Tabbar.TabItem>
|
|
71
|
+
<Tabbar.TabItem icon={<Search />}>标签</Tabbar.TabItem>
|
|
72
|
+
<Tabbar.TabItem icon={<FriendsOutlined />}>标签</Tabbar.TabItem>
|
|
73
|
+
<Tabbar.TabItem icon={<SettingOutlined />}>标签</Tabbar.TabItem>
|
|
74
|
+
</Tabbar>
|
|
75
|
+
</>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default function TabbarDemo() {
|
|
80
|
+
return (
|
|
81
|
+
<Page title="Tabbar 标签栏" className="tabbar-demo">
|
|
82
|
+
<Block title="基础用法">
|
|
83
|
+
<BasicTabbar />
|
|
84
|
+
</Block>
|
|
85
|
+
<Block title="通过 value 匹配">
|
|
86
|
+
<KeyTabbar />
|
|
87
|
+
</Block>
|
|
88
|
+
<Block title="徽标提示">
|
|
89
|
+
<BadgeTabbar />
|
|
90
|
+
</Block>
|
|
91
|
+
<Block title="自定义颜色">
|
|
92
|
+
<TabbarWithCustomColor />
|
|
93
|
+
</Block>
|
|
94
|
+
<Block title="监听切换事件">
|
|
95
|
+
<EventTabbar />
|
|
96
|
+
</Block>
|
|
97
|
+
</Page>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## API
|
|
2
|
+
|
|
3
|
+
### Tabs Props
|
|
4
|
+
|
|
5
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
6
|
+
| ----------------------------------- | -------------------------------------------------------------- | --------------------------------------------------- | ------- |
|
|
7
|
+
| defaultValue | 绑定默认选中标签的标识符 | _number \| string_ | `0` |
|
|
8
|
+
| value | 绑定当前选中标签的标识符 | _number \| string_ | `0` |
|
|
9
|
+
| theme | 样式风格类型,可选值为 `card` | _string_ | `line` |
|
|
10
|
+
| duration | 动画时间,单位毫秒 | _number \| string_ | `300` |
|
|
11
|
+
| animated | 是否开启切换标签内容时的转场动画 | _boolean_ | `false` |
|
|
12
|
+
| bordered | 是否显示标签栏外边框,仅在 `type="line"` 时有效 | _boolean_ | `false` |
|
|
13
|
+
| ellipsis | 是否省略过长的标题文字 | _boolean_ | `true` |
|
|
14
|
+
| sticky | 是否使用粘性定位布局 | _boolean \| { offsetTop }_ | `false` |
|
|
15
|
+
| shrink | 是否使用收缩布局 | _booleans_ | `false` |
|
|
16
|
+
| swipeable | 是否开启手势左右滑动切换 | _boolean_ | `false` |
|
|
17
|
+
| swipeThreshold <br>`v0.1.0-alpha.8` | 滚动阈值,标签数量超过阈值且总宽度超过标签栏宽度时开始横向滚动 | _number_ | `5` |
|
|
18
|
+
| lazyRender | 是否延迟渲染未展示的选项卡 | _boolean_ | `false` |
|
|
19
|
+
| dot <br>`v0.1.1-alpha.11` | 是否展示为小红点 | _boolean_ | `false` |
|
|
20
|
+
| badge <br>`v0.1.1-alpha.11` | 图标上徽标的内容 | _boolean \| number \| string \| Badge \| ReactNode_ | - |
|
|
21
|
+
|
|
22
|
+
### Tabs.Pane Props
|
|
23
|
+
|
|
24
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
25
|
+
| -------- | -------------------- | ------------------ | ------------ |
|
|
26
|
+
| value | 标签值,作为匹配的值 | _number \| string_ | 标签的索引值 |
|
|
27
|
+
| title | 标题 | _ReactNode_ | - |
|
|
28
|
+
| disabled | 是否禁用标签 | _boolean_ | `false` |
|
|
29
|
+
| children | 标签面板内容 | _ReactNode_ | - |
|
|
30
|
+
|
|
31
|
+
### Tabs Events
|
|
32
|
+
|
|
33
|
+
| 事件名 | 说明 | 回调参数 |
|
|
34
|
+
| ---------- | ------------------------ | ----------------------------------- |
|
|
35
|
+
| onTabClick | 点击标签时触发 | _event : Tabs.TabEvent_ |
|
|
36
|
+
| onChange | 当前激活的标签改变时触发 | _value: any, event : Tabs.TabEvent_ |
|