@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.
Files changed (210) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +248 -0
  5. package/metaData/components/action-sheet/api.md +74 -0
  6. package/metaData/components/action-sheet/doc.md +243 -0
  7. package/metaData/components/action-sheet/example/index.tsx +116 -0
  8. package/metaData/components/area-picker/api.md +25 -0
  9. package/metaData/components/area-picker/doc.md +132 -0
  10. package/metaData/components/area-picker/example/index.tsx +60 -0
  11. package/metaData/components/avatar/api.md +19 -0
  12. package/metaData/components/avatar/doc.md +170 -0
  13. package/metaData/components/avatar/example/index.tsx +76 -0
  14. package/metaData/components/back-top/api.md +21 -0
  15. package/metaData/components/back-top/doc.md +142 -0
  16. package/metaData/components/back-top/example/index.tsx +96 -0
  17. package/metaData/components/backdrop/api.md +20 -0
  18. package/metaData/components/backdrop/doc.md +98 -0
  19. package/metaData/components/backdrop/example/index.tsx +33 -0
  20. package/metaData/components/badge/api.md +10 -0
  21. package/metaData/components/badge/doc.md +169 -0
  22. package/metaData/components/badge/example/index.tsx +81 -0
  23. package/metaData/components/button/api.md +31 -0
  24. package/metaData/components/button/doc.md +235 -0
  25. package/metaData/components/button/example/index.tsx +235 -0
  26. package/metaData/components/calendar/api.md +62 -0
  27. package/metaData/components/calendar/doc.md +516 -0
  28. package/metaData/components/calendar/example/index.tsx +501 -0
  29. package/metaData/components/cascader/api.md +55 -0
  30. package/metaData/components/cascader/doc.md +358 -0
  31. package/metaData/components/cascader/example/index.tsx +159 -0
  32. package/metaData/components/cell/api.md +37 -0
  33. package/metaData/components/cell/doc.md +158 -0
  34. package/metaData/components/cell/example/index.tsx +44 -0
  35. package/metaData/components/checkbox/api.md +35 -0
  36. package/metaData/components/checkbox/doc.md +203 -0
  37. package/metaData/components/checkbox/example/index.tsx +94 -0
  38. package/metaData/components/circle/api.md +17 -0
  39. package/metaData/components/circle/doc.md +123 -0
  40. package/metaData/components/circle/example/index.tsx +81 -0
  41. package/metaData/components/collapse/api.md +31 -0
  42. package/metaData/components/collapse/doc.md +142 -0
  43. package/metaData/components/collapse/example/index.tsx +81 -0
  44. package/metaData/components/config-provider/api.md +7 -0
  45. package/metaData/components/config-provider/doc.md +193 -0
  46. package/metaData/components/config-provider/example/index.tsx +54 -0
  47. package/metaData/components/countdown/api.md +46 -0
  48. package/metaData/components/countdown/doc.md +167 -0
  49. package/metaData/components/countdown/example/index.tsx +70 -0
  50. package/metaData/components/datetime-picker/api.md +25 -0
  51. package/metaData/components/datetime-picker/doc.md +317 -0
  52. package/metaData/components/datetime-picker/example/index.tsx +265 -0
  53. package/metaData/components/dialog/api.md +66 -0
  54. package/metaData/components/dialog/doc.md +292 -0
  55. package/metaData/components/dialog/example/index.tsx +138 -0
  56. package/metaData/components/divider/api.md +15 -0
  57. package/metaData/components/divider/doc.md +108 -0
  58. package/metaData/components/divider/example/index.tsx +45 -0
  59. package/metaData/components/dropdown-menu/api.md +37 -0
  60. package/metaData/components/dropdown-menu/doc.md +279 -0
  61. package/metaData/components/dropdown-menu/example/index.tsx +182 -0
  62. package/metaData/components/empty/api.md +20 -0
  63. package/metaData/components/empty/doc.md +126 -0
  64. package/metaData/components/empty/example/index.tsx +66 -0
  65. package/metaData/components/field/api.md +10 -0
  66. package/metaData/components/field/doc.md +274 -0
  67. package/metaData/components/field/example/index.tsx +203 -0
  68. package/metaData/components/fixed-nav/api.md +21 -0
  69. package/metaData/components/fixed-nav/doc.md +196 -0
  70. package/metaData/components/fixed-nav/example/index.tsx +80 -0
  71. package/metaData/components/fixed-view/api.md +10 -0
  72. package/metaData/components/fixed-view/doc.md +25 -0
  73. package/metaData/components/fixed-view/example/index.tsx +12 -0
  74. package/metaData/components/flex/api.md +18 -0
  75. package/metaData/components/flex/doc.md +103 -0
  76. package/metaData/components/flex/example/index.tsx +58 -0
  77. package/metaData/components/floating-bubble/api.md +18 -0
  78. package/metaData/components/floating-bubble/doc.md +94 -0
  79. package/metaData/components/floating-bubble/example/index.tsx +55 -0
  80. package/metaData/components/floating-panel/api.md +19 -0
  81. package/metaData/components/floating-panel/doc.md +174 -0
  82. package/metaData/components/floating-panel/example/index.tsx +131 -0
  83. package/metaData/components/form/api.md +124 -0
  84. package/metaData/components/form/doc.md +759 -0
  85. package/metaData/components/form/example/index.tsx +222 -0
  86. package/metaData/components/grid/api.md +28 -0
  87. package/metaData/components/grid/doc.md +167 -0
  88. package/metaData/components/grid/example/index.tsx +80 -0
  89. package/metaData/components/image/api.md +42 -0
  90. package/metaData/components/image/doc.md +117 -0
  91. package/metaData/components/image/example/index.tsx +76 -0
  92. package/metaData/components/index-list/api.md +39 -0
  93. package/metaData/components/index-list/doc.md +176 -0
  94. package/metaData/components/index-list/example/index.tsx +110 -0
  95. package/metaData/components/list/api.md +30 -0
  96. package/metaData/components/list/doc.md +317 -0
  97. package/metaData/components/list/example/index.tsx +218 -0
  98. package/metaData/components/loading/api.md +10 -0
  99. package/metaData/components/loading/doc.md +113 -0
  100. package/metaData/components/loading/example/index.tsx +47 -0
  101. package/metaData/components/navbar/api.md +26 -0
  102. package/metaData/components/navbar/doc.md +85 -0
  103. package/metaData/components/navbar/example/index.tsx +28 -0
  104. package/metaData/components/notice-bar/api.md +28 -0
  105. package/metaData/components/notice-bar/doc.md +154 -0
  106. package/metaData/components/notice-bar/example/index.tsx +107 -0
  107. package/metaData/components/notify/api.md +28 -0
  108. package/metaData/components/notify/doc.md +140 -0
  109. package/metaData/components/notify/example/index.tsx +89 -0
  110. package/metaData/components/number-keyboard/api.md +21 -0
  111. package/metaData/components/number-keyboard/doc.md +247 -0
  112. package/metaData/components/number-keyboard/example/index.tsx +201 -0
  113. package/metaData/components/pagination/api.md +18 -0
  114. package/metaData/components/pagination/doc.md +113 -0
  115. package/metaData/components/pagination/example/index.tsx +73 -0
  116. package/metaData/components/password-input/api.md +25 -0
  117. package/metaData/components/password-input/doc.md +126 -0
  118. package/metaData/components/password-input/example/index.tsx +124 -0
  119. package/metaData/components/picker/api.md +61 -0
  120. package/metaData/components/picker/doc.md +336 -0
  121. package/metaData/components/picker/example/index.tsx +232 -0
  122. package/metaData/components/popup/api.md +48 -0
  123. package/metaData/components/popup/doc.md +150 -0
  124. package/metaData/components/popup/example/index.tsx +214 -0
  125. package/metaData/components/progress/api.md +11 -0
  126. package/metaData/components/progress/doc.md +105 -0
  127. package/metaData/components/progress/example/index.tsx +58 -0
  128. package/metaData/components/pull-refresh/api.md +18 -0
  129. package/metaData/components/pull-refresh/doc.md +198 -0
  130. package/metaData/components/pull-refresh/example/index.tsx +153 -0
  131. package/metaData/components/radio/api.md +26 -0
  132. package/metaData/components/radio/doc.md +201 -0
  133. package/metaData/components/radio/example/index.tsx +103 -0
  134. package/metaData/components/rate/api.md +23 -0
  135. package/metaData/components/rate/doc.md +122 -0
  136. package/metaData/components/rate/example/index.tsx +36 -0
  137. package/metaData/components/rolling-text/api.md +23 -0
  138. package/metaData/components/rolling-text/doc.md +153 -0
  139. package/metaData/components/rolling-text/example/index.tsx +150 -0
  140. package/metaData/components/safe-area/api.md +8 -0
  141. package/metaData/components/safe-area/doc.md +30 -0
  142. package/metaData/components/safe-area/example/index.tsx +16 -0
  143. package/metaData/components/search/api.md +35 -0
  144. package/metaData/components/search/doc.md +185 -0
  145. package/metaData/components/search/example/index.tsx +101 -0
  146. package/metaData/components/share-sheet/api.md +48 -0
  147. package/metaData/components/share-sheet/doc.md +215 -0
  148. package/metaData/components/share-sheet/example/index.tsx +143 -0
  149. package/metaData/components/sidebar/api.md +28 -0
  150. package/metaData/components/sidebar/doc.md +122 -0
  151. package/metaData/components/sidebar/example/index.tsx +58 -0
  152. package/metaData/components/signature/api.md +19 -0
  153. package/metaData/components/signature/doc.md +115 -0
  154. package/metaData/components/signature/example/index.tsx +56 -0
  155. package/metaData/components/skeleton/api.md +45 -0
  156. package/metaData/components/skeleton/doc.md +131 -0
  157. package/metaData/components/skeleton/example/index.tsx +80 -0
  158. package/metaData/components/slider/api.md +28 -0
  159. package/metaData/components/slider/doc.md +151 -0
  160. package/metaData/components/slider/example/index.tsx +54 -0
  161. package/metaData/components/space/api.md +12 -0
  162. package/metaData/components/space/doc.md +125 -0
  163. package/metaData/components/space/example/index.tsx +75 -0
  164. package/metaData/components/stepper/api.md +37 -0
  165. package/metaData/components/stepper/doc.md +152 -0
  166. package/metaData/components/stepper/example/index.tsx +45 -0
  167. package/metaData/components/steps/api.md +9 -0
  168. package/metaData/components/steps/doc.md +143 -0
  169. package/metaData/components/steps/example/index.tsx +93 -0
  170. package/metaData/components/sticky/api.md +16 -0
  171. package/metaData/components/sticky/doc.md +87 -0
  172. package/metaData/components/sticky/example/index.tsx +62 -0
  173. package/metaData/components/swipe-cell/api.md +19 -0
  174. package/metaData/components/swipe-cell/doc.md +105 -0
  175. package/metaData/components/swipe-cell/example/index.tsx +62 -0
  176. package/metaData/components/swiper/api.md +22 -0
  177. package/metaData/components/swiper/doc.md +228 -0
  178. package/metaData/components/swiper/example/index.tsx +118 -0
  179. package/metaData/components/switch/api.md +17 -0
  180. package/metaData/components/switch/doc.md +110 -0
  181. package/metaData/components/switch/example/index.tsx +57 -0
  182. package/metaData/components/tabbar/api.md +27 -0
  183. package/metaData/components/tabbar/doc.md +160 -0
  184. package/metaData/components/tabbar/example/index.tsx +99 -0
  185. package/metaData/components/tabs/api.md +36 -0
  186. package/metaData/components/tabs/doc.md +307 -0
  187. package/metaData/components/tabs/example/index.tsx +231 -0
  188. package/metaData/components/tag/api.md +17 -0
  189. package/metaData/components/tag/doc.md +162 -0
  190. package/metaData/components/tag/example/index.tsx +84 -0
  191. package/metaData/components/text-ellipsis/api.md +26 -0
  192. package/metaData/components/text-ellipsis/doc.md +135 -0
  193. package/metaData/components/text-ellipsis/example/index.tsx +44 -0
  194. package/metaData/components/timeline/api.md +20 -0
  195. package/metaData/components/timeline/doc.md +210 -0
  196. package/metaData/components/timeline/example/index.tsx +145 -0
  197. package/metaData/components/toast/api.md +39 -0
  198. package/metaData/components/toast/doc.md +256 -0
  199. package/metaData/components/toast/example/index.tsx +136 -0
  200. package/metaData/components/tree-select/api.md +19 -0
  201. package/metaData/components/tree-select/doc.md +185 -0
  202. package/metaData/components/tree-select/example/index.tsx +112 -0
  203. package/metaData/components/uploader/api.md +32 -0
  204. package/metaData/components/uploader/doc.md +340 -0
  205. package/metaData/components/uploader/example/index.tsx +222 -0
  206. package/metaData/components/watermark/api.md +18 -0
  207. package/metaData/components/watermark/doc.md +97 -0
  208. package/metaData/components/watermark/example/index.tsx +62 -0
  209. package/metaData/components-index.json +274 -0
  210. package/package.json +56 -0
@@ -0,0 +1,142 @@
1
+ # BackTop 回到顶部
2
+
3
+ ### 介绍
4
+
5
+ 返回页面顶部的操作按钮。
6
+
7
+ 请升级 `taroify` 到 >= `0.1.0-alpha.4` 版本来使用该组件。
8
+
9
+ ### 引入
10
+
11
+ ```tsx
12
+ import { BackTop } from "@fjyueke/bify-core"
13
+ ```
14
+
15
+ ## 代码演示
16
+
17
+ ### 基础用法
18
+
19
+ 请滚动右侧的示例页面,当页面滚动 200px 时,右下角会出现返回顶部按钮。
20
+
21
+ ```tsx
22
+ const list = [...Array(50).keys()]
23
+ ;<View>
24
+ <Cell.Group>
25
+ {arr.map((v) => {
26
+ return <Cell key={v}>{v}</Cell>
27
+ })}
28
+ </Cell.Group>
29
+ <BackTop />
30
+ </View>
31
+ ```
32
+
33
+ ### 自定义位置
34
+
35
+ 通过 right 和 bottom 属性来设置组件距离右侧和底部的位置。
36
+
37
+ ```tsx
38
+ function CustomContent) {
39
+ const list = [...Array(50).keys()];
40
+
41
+ return (
42
+ <View>
43
+ <Cell.Group>
44
+ {list.map((v) => {
45
+ return (
46
+ <Cell key={v}>{v}</Cell>
47
+ )
48
+ })}
49
+ </Cell.Group>
50
+ <BackTop />
51
+ </View>
52
+ )
53
+ }
54
+ ```
55
+
56
+ ### 自定义内容
57
+
58
+ 使用 `children` 来自定义组件展示的内容。
59
+
60
+ ```tsx
61
+ function CustomContent() {
62
+ const list = [...Array(50).keys()]
63
+
64
+ return (
65
+ <View>
66
+ <Cell.Group>
67
+ {list.map((v) => {
68
+ return <Cell key={v}>{v}</Cell>
69
+ })}
70
+ </Cell.Group>
71
+ <BackTop>返回顶部</BackTop>
72
+ </View>
73
+ )
74
+ }
75
+ ```
76
+
77
+ ```css
78
+ .custom-back-top {
79
+ width: 160px;
80
+ font-size: 28px;
81
+ text-align: center;
82
+ }
83
+ ```
84
+
85
+ ### 瞬间滚动
86
+
87
+ 当设置 `immediate` 属性后,页面滚动的过程不再有过渡效果,而是瞬间滚动到顶部。
88
+
89
+ ```tsx
90
+ function SetImmediate() {
91
+ const list = [...Array(50).keys()]
92
+
93
+ return (
94
+ <View>
95
+ <Cell.Group>
96
+ {list.map((v) => {
97
+ return <Cell key={v}>{v}</Cell>
98
+ })}
99
+ </Cell.Group>
100
+ <BackTop immediate />
101
+ </View>
102
+ )
103
+ }
104
+ ```
105
+
106
+ ## API
107
+
108
+ ### Props
109
+
110
+ | 参数 | 说明 | 类型 | 默认值 |
111
+ | --------- | ----------------------------------- | --------- | -------- | ---- |
112
+ | right | 距离页面右侧的距离,默认单位为 `px` | _number_ | _string_ | `30` |
113
+ | bottom | 距离页面底部的距离,默认单位为 `px` | _number_ | _string_ | `40` |
114
+ | offset | 滚动高度达到此参数值时才显示组件 | _number_ | `200` |
115
+ | immediate | 是否瞬间滚动到顶部 | _boolean_ | `false` |
116
+ | zIndex | 设置组件的 z-index 层级 | _number_ | `100` |
117
+
118
+ ### Event
119
+
120
+ | 事件 | 说明 | 回调参数 |
121
+ | ------- | -------------- | ------------------- |
122
+ | onClick | 点击组件时触发 | _event:ITouchEvent_ |
123
+
124
+ ### 注意
125
+
126
+ 非 `H5` 项目需要显式调用 `onClick`
127
+
128
+ ## 主题定制
129
+
130
+ ### 样式变量
131
+
132
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
133
+
134
+ | 名称 | 默认值 | 描述 |
135
+ | --------------------- | -------------------- | ---- |
136
+ | --back-top-size | _80px_ | - |
137
+ | --back-top-icon-size | _40px_ | - |
138
+ | --back-top-right | _60px_ | - |
139
+ | --back-top-bottom | _80px_ | - |
140
+ | --back-top-z-index | _100_ | - |
141
+ | --back-top-text-color | _#fff_ | - |
142
+ | --back-top-background | _var(--blue, $blue)_ | - |
@@ -0,0 +1,96 @@
1
+ import { BackTop, Cell, Tabs } from "@fjyueke/bify-core"
2
+ import { useState } from "react"
3
+ import { View } from "@tarojs/components";
4
+ import Page from "../../../components/page"
5
+ import "./index.scss"
6
+
7
+ function BasicBackTop() {
8
+ const list = [...Array(50).keys()];
9
+
10
+ return (
11
+ <View>
12
+ <Cell.Group>
13
+ {list.map(v => {
14
+ return (
15
+ <Cell key={v}>{v}</Cell>
16
+ )
17
+ })}
18
+ </Cell.Group>
19
+ <BackTop />
20
+ </View>
21
+ )
22
+ }
23
+
24
+ function CustomLocation() {
25
+ const list = [...Array(50).keys()];
26
+
27
+ return (
28
+ <View>
29
+ <Cell.Group>
30
+ {list.map((v) => {
31
+ return (
32
+ <Cell key={v}>{v}</Cell>
33
+ )
34
+ })}
35
+ </Cell.Group>
36
+ <BackTop right={100} bottom={200} />
37
+ </View>
38
+ )
39
+ }
40
+
41
+ function CustomContent() {
42
+ const list = [...Array(50).keys()];
43
+
44
+ return (
45
+ <View>
46
+ <Cell.Group>
47
+ {list.map((v) => {
48
+ return (
49
+ <Cell key={v}>{v}</Cell>
50
+ )
51
+ })}
52
+ </Cell.Group>
53
+ <BackTop className="custom-back-top">返回顶部</BackTop>
54
+ </View>
55
+ )
56
+ }
57
+
58
+ function SetImmediate() {
59
+ const list = [...Array(50).keys()];
60
+
61
+ return (
62
+ <View>
63
+ <Cell.Group>
64
+ {list.map((v) => {
65
+ return (
66
+ <Cell key={v}>{v}</Cell>
67
+ )
68
+ })}
69
+ </Cell.Group>
70
+ <BackTop immediate />
71
+ </View>
72
+ )
73
+ }
74
+
75
+ export default function BackTopDemo() {
76
+ const [value, setValue] = useState(0)
77
+
78
+ return (
79
+ <Page title="BackTop 回到顶部" className="back-top-demo">
80
+ <Tabs value={value} onChange={setValue}>
81
+ <Tabs.TabPane title="基础用法">
82
+ <BasicBackTop />
83
+ </Tabs.TabPane>
84
+ <Tabs.TabPane title="自定义位置">
85
+ <CustomLocation />
86
+ </Tabs.TabPane>
87
+ <Tabs.TabPane title="自定义内容">
88
+ <CustomContent />
89
+ </Tabs.TabPane>
90
+ <Tabs.TabPane title="瞬间滚动">
91
+ <SetImmediate />
92
+ </Tabs.TabPane>
93
+ </Tabs>
94
+ </Page>
95
+ )
96
+ }
@@ -0,0 +1,20 @@
1
+ ## API
2
+
3
+ ### Props
4
+
5
+ | 参数 | 说明 | 类型 | 默认值 |
6
+ | ----------- | ------------------------ | ----------- | ------- |
7
+ | className | 自定义类名 | _string_ | - |
8
+ | children | 用于在遮罩层上方嵌入内容 | _ReactNode_ | - |
9
+ | defaultOpen | 是否默认展示遮罩层 | _boolean_ | `false` |
10
+ | open | 是否展示遮罩层 | _boolean_ | `false` |
11
+ | duration | 动画时长,单位毫秒 | _number_ | `300` |
12
+ | lock | 是否锁定背景滚动 | _boolean_ | `true` |
13
+ | closeable | 点击遮罩层时是否关闭 | _boolean_ | `false` |
14
+
15
+ ### Event
16
+
17
+ | 事件 | 说明 | 回调参数 |
18
+ | ------- | ---------- | ------- |
19
+ | onClick | 点击时触发 | - |
20
+ | onClose | 关闭时触发 | - |
@@ -0,0 +1,98 @@
1
+ # Backdrop 背景板
2
+
3
+ ### 介绍
4
+
5
+ 创建一个背景幕,用于强调特定的页面元素,并阻止用户进行其他操作。
6
+
7
+ ### 引入
8
+
9
+ ```jsx
10
+ import { Backdrop } from "@fjyueke/bify-core"
11
+ ```
12
+
13
+ ## 代码演示
14
+
15
+ ### 基础用法
16
+
17
+ ```jsx
18
+ import { Backdrop, Button } from "@fjyueke/bify-core"
19
+
20
+ function BackdropExample() {
21
+ const [open, setOpen] = useState(false)
22
+ return (
23
+ <>
24
+ <Button onClick={() => setOpen(true)}>显示背景板</Button>
25
+ <Backdrop open={open} closeable onClose={() => setOpen(false)} />
26
+ </>
27
+ )
28
+ }
29
+ ```
30
+
31
+ ### 嵌入内容
32
+
33
+ 通过 children 可以在背景板上嵌入任意内容。
34
+
35
+ ```jsx
36
+ import { Backdrop, Button } from "@fjyueke/bify-core"
37
+
38
+ function BackdropExample() {
39
+ const [open, setOpen] = useState(false)
40
+ return (
41
+ <>
42
+ <Button onClick={() => setOpen(true)}>嵌入内容</Button>
43
+ <Backdrop open={open} closeable onClose={() => setOpen(false)}>
44
+ <View className="content-wrapper">
45
+ <View className="content-block" />
46
+ </View>
47
+ </Backdrop>
48
+ </>
49
+ )
50
+ }
51
+ ```
52
+
53
+ ```scss
54
+ .content-wrapper {
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ height: 100%;
59
+ }
60
+
61
+ .content-block {
62
+ width: 60px * 2;
63
+ height: 60px * 2;
64
+ background-color: #fff;
65
+ }
66
+ ```
67
+
68
+ ## API
69
+
70
+ ### Props
71
+
72
+ | 参数 | 说明 | 类型 | 默认值 |
73
+ | ----------- | ------------------------ | ----------- | ------- |
74
+ | className | 自定义类名 | _string_ | - |
75
+ | children | 用于在遮罩层上方嵌入内容 | _ReactNode_ | - |
76
+ | defaultOpen | 是否默认展示遮罩层 | _boolean_ | `false` |
77
+ | open | 是否展示遮罩层 | _boolean_ | `false` |
78
+ | duration | 动画时长,单位毫秒 | _number_ | `300` |
79
+ | lock | 是否锁定背景滚动 | _boolean_ | `true` |
80
+ | closeable | 点击遮罩层时是否关闭 | _boolean_ | `false` |
81
+
82
+ ### Event
83
+
84
+ | 事件 | 说明 | 回调参数 |
85
+ | ------- | ---------- | ------- |
86
+ | onClick | 点击时触发 | - |
87
+ | onClose | 关闭时触发 | - |
88
+
89
+ ## 主题定制
90
+
91
+ ### 样式变量
92
+
93
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
94
+
95
+ | 名称 | 默认值 | 描述 |
96
+ | --------------------------- | -------------------- | ---- |
97
+ | --backdrop-z-index | _1000_ | - |
98
+ | --backdrop-background-color | _rgba(0, 0, 0, 0.7)_ | - |
@@ -0,0 +1,33 @@
1
+ import { Backdrop, Button } from "@fjyueke/bify-core"
2
+ import { View } from "@tarojs/components"
3
+ import { useState } from "react"
4
+ import Block from "../../../components/block"
5
+ import Page from "../../../components/page"
6
+
7
+ import "./index.scss"
8
+
9
+ export default function BackdropDemo() {
10
+ const [open, setOpen] = useState(false)
11
+ const [opened2, setOpened2] = useState(false)
12
+
13
+ return (
14
+ <Page title="Backdrop" className="backdrop-demo">
15
+ <Block title="基础用法">
16
+ <Button variant="contained" color="primary" onClick={() => setOpen(true)}>
17
+ 显示背景板
18
+ </Button>
19
+ <Backdrop open={open} closeable onClose={() => setOpen(false)} />
20
+ </Block>
21
+ <Block title="嵌入内容">
22
+ <Button variant="contained" color="primary" onClick={() => setOpened2(true)}>
23
+ 嵌入内容
24
+ </Button>
25
+ <Backdrop open={opened2} closeable onClose={() => setOpened2(false)}>
26
+ <View className="content-wrapper">
27
+ <View className="content-block" />
28
+ </View>
29
+ </Backdrop>
30
+ </Block>
31
+ </Page>
32
+ )
33
+ }
@@ -0,0 +1,10 @@
1
+ ## API
2
+
3
+ ### Props
4
+
5
+ | 参数 | 说明 | 类型 | 默认值 |
6
+ | -------- | ------------------------------------------------------------ | ------------------ | ----------- |
7
+ | content | 徽标内容 | _ReactNode_ | - |
8
+ | dot | 是否展示为小红点 | _boolean_ | `false` |
9
+ | max | 最大值,超过最大值会显示 `{max}+`,仅当 content 为数字时有效 | _number \| string_ | - |
10
+ | position | 徽标位置,可选值为 `top-left` `bottom-left` `bottom-right` | _string_ | `top-right` |
@@ -0,0 +1,169 @@
1
+ # Badge 徽标
2
+
3
+ ### 介绍
4
+
5
+ 在右上角展示徽标数字或小红点。
6
+
7
+ 请升级 `taroify` 到 >= `v0.3.0-alpha.0` 版本来使用该组件。
8
+
9
+ ### 引入
10
+
11
+ ```ts
12
+ import { Badge } from "@fjyueke/bify-core"
13
+ ```
14
+
15
+ ## 代码演示
16
+
17
+ ### 基础用法
18
+
19
+ 设置 `content` 属性后,Badge 会在子元素的右上角显示对应的徽标,也可以通过 `dot` 来显示小红点。
20
+
21
+ ```tsx
22
+ <Badge content={5}>
23
+ <View className="badge-block" />
24
+ </Badge>
25
+ <Badge content="10">
26
+ <View className="badge-block" />
27
+ </Badge>
28
+ <Badge content="Hot">
29
+ <View className="badge-block" />
30
+ </Badge>
31
+ <Badge dot>
32
+ <View className="badge-block" />
33
+ </Badge>
34
+ ```
35
+
36
+ ```scss
37
+ .badge-block {
38
+ width: 40px * 2;
39
+ height: 40px * 2;
40
+ background: #f2f3f5ff;
41
+ border-radius: 4px * 2;
42
+ }
43
+ ```
44
+
45
+ ### 最大值
46
+
47
+ 设置 `max` 属性后,当 `content` 的数值超过最大值时,会自动显示为 `{max}+`。
48
+
49
+ ```tsx
50
+ <Badge content={10} max={9}>
51
+ <View className="badge-block" />
52
+ </Badge>
53
+ <Badge content={21} max={20}>
54
+ <View className="badge-block" />
55
+ </Badge>
56
+ <Badge content={100} max={99}>
57
+ <View className="badge-block" />
58
+ </Badge>
59
+ ```
60
+
61
+ ### 自定义颜色
62
+
63
+ 通过 `color` 属性来设置徽标的颜色。
64
+
65
+ ```tsx
66
+ <Badge className="custom-color" content={5}>
67
+ <View className="badge-block" />
68
+ </Badge>
69
+ <Badge className="custom-color" content={10}>
70
+ <View className="badge-block" />
71
+ </Badge>
72
+ <Badge className="custom-color" content="Hot">
73
+ <View className="badge-block" />
74
+ </Badge>
75
+ <Badge className="custom-color" dot>
76
+ <View className="badge-block" />
77
+ </Badge>
78
+ ```
79
+
80
+ ```scss
81
+ .custom-color {
82
+ --badge-background-color: red;
83
+ }
84
+ ```
85
+
86
+ ### 自定义徽标内容
87
+
88
+ 通过 `content` 属性可以自定义徽标的内容,比如插入一个图标。
89
+
90
+ ```tsx
91
+ <Badge content={<Success className="badge-icon" />}>
92
+ <View className="badge-block" />
93
+ </Badge>
94
+ <Badge content={<Cross className="badge-icon" />}>
95
+ <View className="badge-block" />
96
+ </Badge>
97
+ <Badge content={<Down className="badge-icon" />}>
98
+ <View className="badge-block" />
99
+ </Badge>
100
+ ```
101
+
102
+ ```scss
103
+ .badge-icon {
104
+ display: block;
105
+ margin-left: 0;
106
+ font-size: 10px * 2;
107
+ line-height: 16px * 2;
108
+ }
109
+ ```
110
+
111
+ ### 自定义徽标位置
112
+
113
+ 通过 `position` 属性来设置徽标的位置。
114
+
115
+ ```tsx
116
+ <Badge content={10} position="top-left">
117
+ <View className="badge-block" />
118
+ </Badge>
119
+ <Badge content={10} position="top-right">
120
+ <View className="badge-block" />
121
+ </Badge>
122
+ <Badge content={10} position="bottom-left">
123
+ <View className="badge-block" />
124
+ </Badge>
125
+ <Badge content={10} position="bottom-right">
126
+ <View className="badge-block" />
127
+ </Badge>
128
+ ```
129
+
130
+ ### 独立展示
131
+
132
+ 当 Badge 没有子元素时,会作为一个独立的元素进行展示。
133
+
134
+ ```tsx
135
+ <Badge content="20" />
136
+ <Badge content={100} max={99} />
137
+ ```
138
+
139
+ ## API
140
+
141
+ ### Props
142
+
143
+ | 参数 | 说明 | 类型 | 默认值 |
144
+ | -------- | ------------------------------------------------------------ | ------------------ | ----------- |
145
+ | content | 徽标内容 | _ReactNode_ | - |
146
+ | dot | 是否展示为小红点 | _boolean_ | `false` |
147
+ | max | 最大值,超过最大值会显示 `{max}+`,仅当 content 为数字时有效 | _number \| string_ | - |
148
+ | position | 徽标位置,可选值为 `top-left` `bottom-left` `bottom-right` | _string_ | `top-right` |
149
+
150
+ ## 主题定制
151
+
152
+ ### 样式变量
153
+
154
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
155
+
156
+ | 名称 | 默认值 | 描述 |
157
+ | ------------------------ | ------------------------------------------------------- | ---- |
158
+ | --badge-size | _16px \* $hd_ | - |
159
+ | --badge-color | _var(--white)_ | - |
160
+ | --badge-padding | _0 3px \* $hd_ | - |
161
+ | --badge-font-family | _-apple-system-font, helvetica neue, arial, sans-serif_ | - |
162
+ | --badge-font-size | _var(--font-size-sm)_ | - |
163
+ | --badge-font-weight | _var(--font-weight-bold)_ | - |
164
+ | --badge-border-width | _var(--border-width-base)_ | - |
165
+ | --badge-border-color | _var(--white)_ | - |
166
+ | --badge-border-radius | _var(--border-radius-max)_ | - |
167
+ | --badge-background-color | _var(--red)_ | - |
168
+ | --badge-dot-color | _var(--badge-background-color)_ | - |
169
+ | --badge-dot-size | _8PX_ | - |
@@ -0,0 +1,81 @@
1
+ import { Badge } from "@fjyueke/bify-core"
2
+ import { Cross, Down, Success } from "@fjyueke/bify-icons"
3
+ import { View } from "@tarojs/components"
4
+ import Block from "../../../components/block"
5
+ import Page from "../../../components/page"
6
+ import "./index.scss"
7
+
8
+ export default function BadgeDemo() {
9
+ return (
10
+ <Page title="Badge 徽标" className="badge-demo">
11
+ <Block title="基础用法">
12
+ <Badge content={5}>
13
+ <View className="badge-block" />
14
+ </Badge>
15
+ <Badge content="10">
16
+ <View className="badge-block" />
17
+ </Badge>
18
+ <Badge content="Hot">
19
+ <View className="badge-block" />
20
+ </Badge>
21
+ <Badge dot>
22
+ <View className="badge-block" />
23
+ </Badge>
24
+ </Block>
25
+ <Block title="最大值">
26
+ <Badge content={10} max={9}>
27
+ <View className="badge-block" />
28
+ </Badge>
29
+ <Badge content={21} max={20}>
30
+ <View className="badge-block" />
31
+ </Badge>
32
+ <Badge content={100} max={99}>
33
+ <View className="badge-block" />
34
+ </Badge>
35
+ </Block>
36
+ <Block title="自定义颜色">
37
+ <Badge className="custom-color" content={5}>
38
+ <View className="badge-block" />
39
+ </Badge>
40
+ <Badge className="custom-color" content={10}>
41
+ <View className="badge-block" />
42
+ </Badge>
43
+ <Badge className="custom-color" content="Hot">
44
+ <View className="badge-block" />
45
+ </Badge>
46
+ <Badge className="custom-color" dot>
47
+ <View className="badge-block" />
48
+ </Badge>
49
+ </Block>
50
+ <Block title="自定义徽标内容">
51
+ <Badge content={<Success className="badge-icon" />}>
52
+ <View className="badge-block" />
53
+ </Badge>
54
+ <Badge content={<Cross className="badge-icon" />}>
55
+ <View className="badge-block" />
56
+ </Badge>
57
+ <Badge content={<Down className="badge-icon" />}>
58
+ <View className="badge-block" />
59
+ </Badge>
60
+ </Block>
61
+ <Block title="自定义徽标位置">
62
+ <Badge content={10} position="top-left">
63
+ <View className="badge-block" />
64
+ </Badge>
65
+ <Badge content={10} position="top-right">
66
+ <View className="badge-block" />
67
+ </Badge>
68
+ <Badge content={10} position="bottom-left">
69
+ <View className="badge-block" />
70
+ </Badge>
71
+ <Badge content={10} position="bottom-right">
72
+ <View className="badge-block" />
73
+ </Badge>
74
+ </Block>
75
+ <Block title="独立展示" className="independent-badges">
76
+ <Badge content="20" />
77
+ <Badge content={100} max={99} />
78
+ </Block>
79
+ </Page>
80
+ )
81
+ }
@@ -0,0 +1,31 @@
1
+ ## API
2
+
3
+ ### Props
4
+
5
+ | 参数 | 说明 | 类型 | 默认值 |
6
+ |--------------|--------------------------------------------------|---------------------------------------------------------|-------------|
7
+ | variant | 按钮变种,可选值为 `contained` `text` `outlined` | _string_ | `contained` |
8
+ | color | 按钮颜色,可选值为 `primary` `success` `warning` `danger` | _string_ | `default` |
9
+ | size | 尺寸,可选值为 `large` `small` `mini` | _string_ | `medium` |
10
+ | shape | 按钮形状,可选值为 `square` `round` | _string_ | `square` |
11
+ | icon | 左侧[图标](/components/icon)或[图片](/components/image) | _ReactNode_ | - |
12
+ | iconPosition <br>`v0.1.1-alpha.0` | 图标展示位置,可选值为 `right` | _string_ | `left` |
13
+ | formType | 原生 button 标签的 type 属性 | _string_ | `button` |
14
+ | block | 是否为块级元素 | _boolean_ | `false` |
15
+ | disabled | 是否禁用按钮 | _boolean_ | `false` |
16
+ | hairline | 是否使用 0.5px 边框 | _boolean_ | `false` |
17
+ | loading | 是否显示为加载状态 | _boolean \| [LoadingProps](/components/loading/#props)_ | `false` |
18
+ | children | 按钮文字 | _string_ | - |
19
+
20
+
21
+ ### Button.Group Props
22
+
23
+ | 参数 | 说明 | 类型 | 默认值 |
24
+ |----------|--------------------------------------------------|-----------|-------------|
25
+ | variant | 按钮变种,可选值为 `contained` `text` `outlined` | _string_ | `contained` |
26
+ | color | 按钮颜色,可选值为 `primary` `success` `warning` `danger` | _string_ | `default` |
27
+ | size | 尺寸,可选值为 `large` `small` `mini` | _string_ | `medium` |
28
+ | shape | 按钮形状,可选值为 `round` | _string_ | `square` |
29
+ | block | 是否为块级元素 | _boolean_ | - |
30
+ | disabled | 是否禁用按钮 | _boolean_ | - |
31
+ | hairline | 是否使用 0.5px 边框 | _boolean_ | - |