@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,201 @@
1
+ # Radio 单选框
2
+
3
+ ### 介绍
4
+
5
+ 在一组备选项中进行单选。
6
+
7
+ ### 引入
8
+
9
+ ```tsx
10
+ import { Radio } from "@fjyueke/bify-core";
11
+ ```
12
+
13
+ ## 代码演示
14
+
15
+ ### 基础用法
16
+
17
+ 通过 `value` 绑定值当前选中项的 name。
18
+
19
+ ```tsx
20
+ <Radio.Group defaultValue="1">
21
+ <Radio name="1">单选框 1</Radio>
22
+ <Radio name="2">单选框 2</Radio>
23
+ </Radio.Group>
24
+ ```
25
+
26
+ ### 水平排列
27
+
28
+ 将 `direction` 属性设置为 `horizontal` 后,单选框组会变成水平排列。
29
+
30
+ ```tsx
31
+ <Radio.Group defaultValue="1" direction="horizontal">
32
+ <Radio name="1">单选框 1</Radio>
33
+ <Radio name="2">单选框 2</Radio>
34
+ </Radio.Group>
35
+ ```
36
+
37
+ ### 禁用状态
38
+
39
+ 通过 `disabled` 属性禁止选项切换,在 `Radio` 上设置 `disabled` 可以禁用单个选项。
40
+
41
+ ```tsx
42
+ <Radio.Group defaultValue="1" disabled>
43
+ <Radio name="1">单选框 1</Radio>
44
+ <Radio name="2">单选框 2</Radio>
45
+ </Radio.Group>
46
+ ```
47
+
48
+ ### 自定义形状
49
+
50
+ 将 `shape` 属性设置为 `square`,单选框的形状会变成方形。
51
+
52
+ ```tsx
53
+ <Radio.Group defaultValue="1">
54
+ <Radio name="1" shape="square">
55
+ 单选框 1
56
+ </Radio>
57
+ <Radio name="2" shape="square">
58
+ 单选框 2
59
+ </Radio>
60
+ </Radio.Group>
61
+ ```
62
+
63
+ ### 自定义颜色
64
+
65
+ 通过 `css` 属性设置选中状态的图标颜色。
66
+
67
+ ```tsx
68
+ <Radio.Group className="custom-color" defaultValue="1">
69
+ <Radio name="1">单选框 1</Radio>
70
+ <Radio name="2">单选框 2</Radio>
71
+ </Radio.Group>
72
+ ```
73
+
74
+ ```scss
75
+ .custom-color {
76
+ --radio-checked-icon-background-color: #ee0a24;
77
+ --radio-checked-icon-border-color: #ee0a24;
78
+ }
79
+ ```
80
+
81
+ ### 自定义大小
82
+
83
+ 通过 `size` 属性可以自定义图标的大小。
84
+
85
+ ```tsx
86
+ <Radio.Group defaultValue="1" size={24}>
87
+ <Radio name="1">单选框 1</Radio>
88
+ <Radio name="2">单选框 2</Radio>
89
+ </Radio.Group>
90
+ ```
91
+
92
+ ### 自定义图标
93
+
94
+ 通过 `icon` 属性自定义图标。
95
+
96
+ ```tsx
97
+ function CustomIconRadio() {
98
+ const [value, setValue] = useState("1")
99
+ return (
100
+ <Radio.Group value={value} onChange={setValue}>
101
+ <Radio
102
+ name="1"
103
+ icon={
104
+ <Image
105
+ src={`https://img.yzcdn.cn/vant/user-${value === "1" ? "active" : "inactive"}.png`}
106
+ style={{
107
+ width: "25px",
108
+ height: "20px",
109
+ }}
110
+ />
111
+ }
112
+ >
113
+ 单选框 1
114
+ </Radio>
115
+ <Radio
116
+ name="2"
117
+ icon={
118
+ <Image
119
+ src={`https://img.yzcdn.cn/vant/user-${value === "2" ? "active" : "inactive"}.png`}
120
+ style={{
121
+ width: "25px",
122
+ height: "20px",
123
+ }}
124
+ />
125
+ }
126
+ >
127
+ 单选框 1
128
+ </Radio>
129
+ </Radio.Group>
130
+ )
131
+ }
132
+ ```
133
+
134
+ ### 与 Cell 组件一起使用
135
+
136
+ 此时你需要再引入 `Cell` 和 `Cell.Group` 组件。
137
+
138
+ ```tsx
139
+ <Radio.Group defaultValue="1">
140
+ <Cell.Group clickable>
141
+ <Cell title="单选框 1">
142
+ <Radio name="1" />
143
+ </Cell>
144
+ <Cell title="单选框 2">
145
+ <Radio name="2" />
146
+ </Cell>
147
+ </Cell.Group>
148
+ </Radio.Group>
149
+ ```
150
+
151
+ ## API
152
+
153
+ ### Radio Props
154
+
155
+ | 参数 | 说明 | 类型 | 默认值 |
156
+ | -------------- | ------------------------- | ------------------ | --------- |
157
+ | name | 标识符 | _any_ | - |
158
+ | shape | 形状,可选值为 `square` | _string_ | `round` |
159
+ | disabled | 是否为禁用状态 | _boolean_ | `false` |
160
+ | size | 图标大小,默认单位为`px` | _number \| string_ | `20px` |
161
+
162
+ ### Radio.Group Props
163
+
164
+ | 参数 | 说明 | 类型 | 默认值 |
165
+ | --- | --- | --- | --- |
166
+ | defaultValue | 默认选中项的标识符 | _any_ | - |
167
+ | value | 当前选中项的标识符 | _any_ | - |
168
+ | disabled | 是否禁用所有单选框 | _boolean_ | `false` |
169
+ | direction | 排列方向,可选值为`horizontal` | _string_ | `vertical` |
170
+ | size | 所有单选框的图标大小,默认单位为`px` | _number \| string_ | `20px` |
171
+
172
+ ### Radio.Group Events
173
+
174
+ | 事件名 | 说明 | 回调参数 |
175
+ | ------ | ------------------------ | -------------- |
176
+ | onChange | 当绑定值变化时触发的事件 | _name: string_ |
177
+
178
+ ## 主题定制
179
+
180
+ ### 样式变量
181
+
182
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
183
+
184
+ | 名称 | 默认值 | 描述 |
185
+ |----------------------------------------|----------------------------------|-----|
186
+ | --radio-size | _20px * $hd_ | - |
187
+ | --radio-font-size | _var(--font-size-lg)_ | - |
188
+ | --radio-border-color | _var(--gray-5)_ | - |
189
+ | --radio-transition-duration | _var(--animation-duration-fast)_ | - |
190
+ | --radio-gap | _var(--padding-sm)_ | - |
191
+ | --radio-label-margin | _var(--padding-xs)_ | - |
192
+ | --radio-label-color | _var(--text-color)_ | - |
193
+ | --radio-label-line-height | _var(--radio-size)_ | - |
194
+ | --radio-disabled-label-color | _var(--gray-5)_ | - |
195
+ | --radio-icon-font-size | _var(--radio-size)_ | - |
196
+ | --radio-checked-icon-color | _var(--white)_ | - |
197
+ | --radio-checked-icon-border-color | _var(--primary-color)_ | - |
198
+ | --radio-checked-icon-background-color | _var(--primary-color)_ | - |
199
+ | --radio-disabled-icon-color | _var(--gray-5)_ | - |
200
+ | --radio-disabled-icon-border-color | _var(--gray-5)_ | - |
201
+ | --radio-disabled-icon-background-color | _var(--border-color)_ | - |
@@ -0,0 +1,103 @@
1
+ import { Cell, Image, Radio } 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 CustomIconRadio() {
8
+ const [value, setValue] = useState("1")
9
+ return (
10
+ <Radio.Group value={value} onChange={setValue}>
11
+ <Radio
12
+ name="1"
13
+ icon={
14
+ <Image
15
+ src={`https://img.yzcdn.cn/vant/user-${value === "1" ? "active" : "inactive"}.png`}
16
+ style={{
17
+ width: "25px",
18
+ height: "20px",
19
+ }}
20
+ />
21
+ }
22
+ >
23
+ 单选框 1
24
+ </Radio>
25
+ <Radio
26
+ name="2"
27
+ icon={
28
+ <Image
29
+ src={`https://img.yzcdn.cn/vant/user-${value === "2" ? "active" : "inactive"}.png`}
30
+ style={{
31
+ width: "25px",
32
+ height: "20px",
33
+ }}
34
+ />
35
+ }
36
+ >
37
+ 单选框 1
38
+ </Radio>
39
+ </Radio.Group>
40
+ )
41
+ }
42
+
43
+ export default function RadioDemo() {
44
+ return (
45
+ <Page title="Radio 单选框" className="radio-demo">
46
+ <Block title="基础用法">
47
+ <Radio.Group defaultValue="1">
48
+ <Radio name="1">单选框 1</Radio>
49
+ <Radio name="2">单选框 2</Radio>
50
+ </Radio.Group>
51
+ </Block>
52
+ <Block title="水平排列">
53
+ <Radio.Group defaultValue="1" direction="horizontal">
54
+ <Radio name="1">单选框 1</Radio>
55
+ <Radio name="2">单选框 2</Radio>
56
+ </Radio.Group>
57
+ </Block>
58
+ <Block title="禁用状态">
59
+ <Radio.Group defaultValue="1" disabled>
60
+ <Radio name="1">单选框 1</Radio>
61
+ <Radio name="2">单选框 2</Radio>
62
+ </Radio.Group>
63
+ </Block>
64
+ <Block title="自定义形状">
65
+ <Radio.Group defaultValue="1">
66
+ <Radio name="1" shape="square">
67
+ 单选框 1
68
+ </Radio>
69
+ <Radio name="2" shape="square">
70
+ 单选框 2
71
+ </Radio>
72
+ </Radio.Group>
73
+ </Block>
74
+ <Block title="自定义颜色">
75
+ <Radio.Group className="custom-color" defaultValue="1">
76
+ <Radio name="1">单选框 1</Radio>
77
+ <Radio name="2">单选框 2</Radio>
78
+ </Radio.Group>
79
+ </Block>
80
+ <Block title="自定义大小">
81
+ <Radio.Group defaultValue="1" size={24}>
82
+ <Radio name="1">单选框 1</Radio>
83
+ <Radio name="2">单选框 2</Radio>
84
+ </Radio.Group>
85
+ </Block>
86
+ <Block title="自定义图标">
87
+ <CustomIconRadio />
88
+ </Block>
89
+ <Block title="与 Cell 组件一起使用" className="radio-cell-group">
90
+ <Radio.Group defaultValue="1">
91
+ <Cell.Group clickable>
92
+ <Cell title="单选框 1">
93
+ <Radio name="1" />
94
+ </Cell>
95
+ <Cell title="单选框 2">
96
+ <Radio name="2" />
97
+ </Cell>
98
+ </Cell.Group>
99
+ </Radio.Group>
100
+ </Block>
101
+ </Page>
102
+ )
103
+ }
@@ -0,0 +1,23 @@
1
+ ## API
2
+
3
+ ### Props
4
+
5
+ | 参数 | 说明 | 类型 | 默认值 |
6
+ | --- | --- | --- | --- |
7
+ | defaultValue | 默认当前分值 | _number_ | - |
8
+ | value | 当前分值 | _number_ | - |
9
+ | count | 图标总数 | _number \| string_ | `5` |
10
+ | size | 图标大小,默认单位为`px` | _number \| string_ | `20px` |
11
+ | gutter | 图标间距,默认单位为`px` | _number \| string_ | `4px` |
12
+ | icon | 选中时的图标 | _string_ | `<Star />` |
13
+ | emptyIcon | 未选中时的图标 | _string_ | `<StarOutlined />` |
14
+ | allowHalf | 是否允许半选 | _boolean_ | `false` |
15
+ | readonly | 是否为只读状态,只读状态下无法修改评分 | _boolean_ | `false` |
16
+ | disabled | 是否禁用评分 | _boolean_ | `false` |
17
+ | touchable | 是否可以通过滑动手势选择评分 | _boolean_ | `true` |
18
+
19
+ ### Events
20
+
21
+ | 事件名 | 说明 | 回调参数 |
22
+ | ------ | ------------------------ | -------- |
23
+ | onChange | 当前分值变化时触发的事件 | _value :number_ |
@@ -0,0 +1,122 @@
1
+ # Rate 评分
2
+
3
+ ### 介绍
4
+
5
+ 用于对事物进行评级操作。
6
+
7
+ ### 引入
8
+
9
+ ```tsx
10
+ import { Rate } from "@fjyueke/bify-core"
11
+ ```
12
+
13
+ ## 代码演示
14
+
15
+ ### 基础用法
16
+
17
+ 通过 `value` 来绑定当前评分值。
18
+
19
+ ```tsx
20
+ <Rate value={3} />
21
+ ```
22
+
23
+ ### 自定义图标
24
+
25
+ 通过 `fullIcon` 属性设置选中时的图标,`voidIcon` 属性设置未选中时的图标。
26
+
27
+ ```tsx
28
+ <Rate defaultValue={3} icon={<Like />} emptyIcon={<LikeOutlined />} />
29
+ ```
30
+
31
+ ### 自定义样式
32
+
33
+ 通过 `size` 属性设置图标大小,`css` 设置选中时的颜色,`emptyIcon` 设置未选中时的颜色。
34
+
35
+ ```tsx
36
+ <Rate className="custom-color" defaultValue={3} allowHalf size={25} emptyIcon={<Star />} />
37
+ ```
38
+
39
+ ```scss
40
+ .custom-color {
41
+ --rate-icon-empty-color: #eee;
42
+ --rate-icon-full-color: #ffd21e;
43
+ }
44
+ ```
45
+
46
+ ### 半星
47
+
48
+ 设置 `allowHalf` 属性后可以选中半星。
49
+
50
+ ```tsx
51
+ <Rate defaultValue={3} allowHalf />
52
+ ```
53
+
54
+ ### 自定义数量
55
+
56
+ 通过 `count` 属性设置评分总数。
57
+
58
+ ```tsx
59
+ <Rate defaultValue={3} count={6} />
60
+ ```
61
+
62
+ ### 禁用状态
63
+
64
+ 通过 `disabled` 属性来禁用评分。
65
+
66
+ ```tsx
67
+ <Rate defaultValue={3} disabled />
68
+ ```
69
+
70
+ ### 只读状态
71
+
72
+ 通过 `readonly` 属性将评分设置为只读状态。
73
+
74
+ ```tsx
75
+ <Rate defaultValue={3} readonly />
76
+ ```
77
+
78
+ ### 只读状态显示小数
79
+
80
+ 设置 `readonly` 和 `allowHalf` 属性后,Rate 组件可以展示任意小数结果。
81
+
82
+ ```tsx
83
+ <Rate defaultValue={3.3} readonly allowHalf />
84
+ ```
85
+
86
+ ## API
87
+
88
+ ### Props
89
+
90
+ | 参数 | 说明 | 类型 | 默认值 |
91
+ | --- | --- | --- | --- |
92
+ | defaultValue | 默认当前分值 | _number_ | - |
93
+ | value | 当前分值 | _number_ | - |
94
+ | count | 图标总数 | _number \| string_ | `5` |
95
+ | size | 图标大小,默认单位为`px` | _number \| string_ | `20px` |
96
+ | gutter | 图标间距,默认单位为`px` | _number \| string_ | `4px` |
97
+ | icon | 选中时的图标 | _string_ | `<Star />` |
98
+ | emptyIcon | 未选中时的图标 | _string_ | `<StarOutlined />` |
99
+ | allowHalf | 是否允许半选 | _boolean_ | `false` |
100
+ | readonly | 是否为只读状态,只读状态下无法修改评分 | _boolean_ | `false` |
101
+ | disabled | 是否禁用评分 | _boolean_ | `false` |
102
+ | touchable | 是否可以通过滑动手势选择评分 | _boolean_ | `true` |
103
+
104
+ ### Events
105
+
106
+ | 事件名 | 说明 | 回调参数 |
107
+ | ------ | ------------------------ | -------- |
108
+ | onChange | 当前分值变化时触发的事件 | _value :number_ |
109
+
110
+ ## 主题定制
111
+
112
+ ### 样式变量
113
+
114
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
115
+
116
+ | 名称 | 默认值 | 描述 |
117
+ |--------------------------|-----------------------|-----|
118
+ | rate-icon-size | _20px * $hd_ | - |
119
+ | rate-icon-gutter | _var(--padding-base)_ | - |
120
+ | rate-icon-empty-color | _var(--gray-5)_ | - |
121
+ | rate-icon-full-color | _var(--danger-color)_ | - |
122
+ | rate-icon-disabled-color | _var(--gray-5)_ | - |
@@ -0,0 +1,36 @@
1
+ import { Rate } from "@fjyueke/bify-core"
2
+ import { Like, LikeOutlined, Star } from "@fjyueke/bify-icons"
3
+ import Block from "../../../components/block"
4
+ import Page from "../../../components/page"
5
+ import "./index.scss"
6
+
7
+ export default function RateDemo() {
8
+ return (
9
+ <Page title="Rate 评分" className="rate-demo">
10
+ <Block title="基础用法">
11
+ <Rate defaultValue={3} />
12
+ </Block>
13
+ <Block title="自定义图标">
14
+ <Rate defaultValue={3} icon={<Like />} emptyIcon={<LikeOutlined />} />
15
+ </Block>
16
+ <Block title="自定义样式">
17
+ <Rate className="custom-color" defaultValue={3} allowHalf size={25} emptyIcon={<Star />} />
18
+ </Block>
19
+ <Block title="半星">
20
+ <Rate defaultValue={3} allowHalf />
21
+ </Block>
22
+ <Block title="自定义数量">
23
+ <Rate defaultValue={3} count={6} />
24
+ </Block>
25
+ <Block title="禁用状态">
26
+ <Rate defaultValue={3} disabled />
27
+ </Block>
28
+ <Block title="只读状态">
29
+ <Rate defaultValue={3} readonly />
30
+ </Block>
31
+ <Block title="只读状态显示小数">
32
+ <Rate defaultValue={3.3} readonly allowHalf />
33
+ </Block>
34
+ </Page>
35
+ )
36
+ }
@@ -0,0 +1,23 @@
1
+ ## API
2
+
3
+ ### Props
4
+
5
+ | 参数 | 说明 | 类型 | 默认值 |
6
+ | :-------- | --------------------------------------------- | ---------- | ------ |
7
+ | startNum | 起始数值 | _number_ | `0` |
8
+ | targetNum | 目标数值 | _number_ | `-` |
9
+ | textList | 内容数组,用于翻转非数字内 | _string[]_ | `[]` |
10
+ | duration | 动画时长,单位为秒 | _number_ | `2` |
11
+ | direction | 文本翻滚方向,值为 `down` 和 `up` | _string_ | `down` |
12
+ | autoStart | 是否自动开始动画 | _boolean_ | `true` |
13
+ | stopOrder | 各个数位动画停止先后顺序,值为 `ltr` 和 `rtl` | _string_ | `ltr` |
14
+ | height | 数字高度,单位为 `px` | _number_ | `40` |
15
+
16
+ ### 方法
17
+
18
+ 通过 `ref` 可以获取到 RollingText 实例并调用实例方法
19
+
20
+ | 方法名 | 说明 | 参数 | 返回值 |
21
+ | :----- | -------- | ---- | ------ |
22
+ | start | 开始动画 | \_ | - |
23
+ | reset | 重置动画 | \_ | - |
@@ -0,0 +1,153 @@
1
+ # RollingText 翻滚文本动效
2
+
3
+ ### 介绍
4
+
5
+ 文本翻滚动效,可以翻滚数字和其他类型文本。
6
+
7
+ 请升级 `taroify` 到 >= `v0.1.0-alpha.6` 版本来使用该组件。
8
+
9
+ ### 引入
10
+
11
+ ```tsx
12
+ import { RollingText } from "@fjyueke/bify-core"
13
+ ```
14
+
15
+ ## 代码演示
16
+
17
+ ### 基础用法
18
+
19
+ 你可以通过 `startNum` 设置起始数值,`targetNum` 设置目标数值。RollingText 组件会自动开始动画,从起始数值翻滚到目标数值。
20
+
21
+ ```tsx
22
+ <RollingText startNum={0} targetNum={123} />
23
+ ```
24
+
25
+ ### 设置翻滚方向
26
+
27
+ 你可以通过 `direction` 属性设置数字的翻滚方向,默认为向下翻滚,设置为 `up` 即可向上翻滚。
28
+
29
+ ```tsx
30
+ <RollingText startNum={0} targetNum={432} direction="up" />
31
+ ```
32
+
33
+ ### 设置各数位停止顺序
34
+
35
+ 你可以通过 `stopOrder` 属性设置动画各个数位的停止先后顺序。默认先停止高位,设置为 `rtl` 可以先从个位停止。
36
+
37
+ ```tsx
38
+ <RollingText startNum={0} targetNum={54321} stopOrder="rtl" />
39
+ ```
40
+
41
+ ### 翻转非数字内容
42
+
43
+ 你可以使用 `textList` 属性设置非数字内容的翻转。组件会从数组的第一项翻转到最后一项,请确保数组长度大于等于 2,以及每一项的长度一致。
44
+
45
+ ```javascript
46
+ const textList = ["aaaaa", "bbbbb", "ccccc", "ddddd", "eeeee", "fffff", "ggggg"]
47
+ ```
48
+
49
+ ```tsx
50
+ <RollingText textList={textList} duration={1} />
51
+ ```
52
+
53
+ ### 自定义样式
54
+
55
+ RollingText 组件提供了一些 CSS 变量,你可以覆盖这些变量来自定义样式,也可以直接修改组件的样式。此外,你还可以通过 `height` 属性设置数字高度。
56
+
57
+ ```tsx
58
+ <RollingText className="my-rolling-text" height={54} startNum={12345} targetNum={54321} />
59
+ ```
60
+
61
+ ```css
62
+ .my-rolling-text {
63
+ --rolling-text-background: #1989fa;
64
+ --rolling-text-color: white;
65
+ --rolling-text-font-size: 48px;
66
+ --rolling-text-gap: 12px;
67
+ --rolling-text-item-border-radius: 10px;
68
+ --rolling-text-item-width: 80px;
69
+ }
70
+ ```
71
+
72
+ ### 手动控制
73
+
74
+ 通过 ref 获取到组件实例后,你可以调用 `start`、`reset` 方法,`start` 方法用于开始动画,`reset` 方法用于重置动画。
75
+
76
+ ```tsx
77
+ import { useRef } from "react"
78
+ import { View } from "@tarojs/components"
79
+ import { RollingText, Button } from "@fjyueke/bify-core"
80
+ import type { RollingTextRef } from "@fjyueke/bify-core/rolling-text"
81
+
82
+ function HandRollingText() {
83
+ const ref = useRef<RollingTextRef>()
84
+
85
+ const start = () => {
86
+ ref.current?.start()
87
+ }
88
+
89
+ const reset = () => {
90
+ ref.current?.reset()
91
+ }
92
+
93
+ return (
94
+ <View>
95
+ <RollingText
96
+ ref={ref}
97
+ className="my-rolling-text"
98
+ height={54}
99
+ startNum={0}
100
+ targetNum={54321}
101
+ autoStart={false}
102
+ />
103
+ <View className="rolling-text-btn">
104
+ <Button color="primary" onClick={start}>
105
+ 开始
106
+ </Button>
107
+ <Button color="primary" className="rolling-text-right" onClick={reset}>
108
+ 重置
109
+ </Button>
110
+ </View>
111
+ </View>
112
+ )
113
+ }
114
+ ```
115
+
116
+ ## API
117
+
118
+ ### Props
119
+
120
+ | 参数 | 说明 | 类型 | 默认值 |
121
+ | :-------- | --------------------------------------------- | ---------- | ------ |
122
+ | startNum | 起始数值 | _number_ | `0` |
123
+ | targetNum | 目标数值 | _number_ | `-` |
124
+ | textList | 内容数组,用于翻转非数字内 | _string[]_ | `[]` |
125
+ | duration | 动画时长,单位为秒 | _number_ | `2` |
126
+ | direction | 文本翻滚方向,值为 `down` 和 `up` | _string_ | `down` |
127
+ | autoStart | 是否自动开始动画 | _boolean_ | `true` |
128
+ | stopOrder | 各个数位动画停止先后顺序,值为 `ltr` 和 `rtl` | _string_ | `ltr` |
129
+ | height | 数字高度,单位为 `px` | _number_ | `40` |
130
+
131
+ ### 方法
132
+
133
+ 通过 `ref` 可以获取到 RollingText 实例并调用实例方法
134
+
135
+ | 方法名 | 说明 | 参数 | 返回值 |
136
+ | :----- | -------- | ---- | ------ |
137
+ | start | 开始动画 | \_ | - |
138
+ | reset | 重置动画 | \_ | - |
139
+
140
+ ## 主题定制
141
+
142
+ ### 样式变量
143
+
144
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
145
+
146
+ | 名称 | 默认值 | 描述 |
147
+ | --------------------------------- | --------- | ---------------- |
148
+ | --rolling-text-background | _inherit_ | 单个数位背景色 |
149
+ | --rolling-text-color | _#323233_ | 数字颜色 |
150
+ | --rolling-text-font-size | _28px_ | 字体大小 |
151
+ | --rolling-text-gap | _0px_ | 数位之间的间隔 |
152
+ | --rolling-text-item-width | _30px_ | 单个数位宽度 |
153
+ | --rolling-text-item-border-radius | _0px_ | 单个数位边框圆角 |