@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,21 @@
1
+ ## API
2
+
3
+ ### NumberKeyboard Props
4
+
5
+ | 参数 | 说明 | 类型 | 默认值 |
6
+ | --- | --- | --- | --- |
7
+ | value | 当前输入值 | _string_ | - |
8
+ | open | 是否显示键盘 | _boolean_ | - |
9
+ | title | 键盘标题 | _string_ | - |
10
+ | maxlength | 输入值最大长度 | _number \| string_ | - |
11
+ | transition | 是否开启过场动画 | _boolean_ | `true` |
12
+ | extraKey | 底部额外按键的内容 | _ReactNode \| [ReactNode, ReactNode]_ | `''` |
13
+ | random | 是否将通过随机顺序展示按键 | _boolean_ | `false` |
14
+
15
+ ### NumberKeyboard Events
16
+
17
+ | 事件名 | 说明 | 回调参数 |
18
+ | ------ | ------------------------------ | ------------- |
19
+ | onChange | 点击按键时触发 | key: 按键内容 |
20
+ | onBackspace | 点击删除键时触发 | - |
21
+ | onHide | 点击关闭按钮时触发 | - |
@@ -0,0 +1,247 @@
1
+ # NumberKeyboard 数字键盘
2
+
3
+ ### 介绍
4
+
5
+ 虚拟数字键盘,可以配合[密码输入框组件](/components/password-input/)或自定义的输入框组件使用。
6
+
7
+ ### 引入
8
+
9
+ ```tsx
10
+ import { NumberKeyboard } from "@fjyueke/bify-core";
11
+ ```
12
+
13
+ ## 代码演示
14
+
15
+ ### 默认样式
16
+
17
+ 数字键盘提供了 `onKeyPress`、`onBackspace`、`onHide` 事件,分别对应输入内容、删除内容和隐藏键盘。
18
+
19
+ ```tsx
20
+ function BasicNumberKeyboard(props: KeyboardProps) {
21
+ const { keyboard, onKeyboard, onKeyPress } = props
22
+ return (
23
+ <>
24
+ <Cell
25
+ clickable
26
+ title="弹出默认键盘"
27
+ isLink
28
+ onClick={() => onKeyboard?.("basic")}
29
+ />
30
+ <NumberKeyboard
31
+ open={keyboard === "basic"}
32
+ onKeyPress={onKeyPress}
33
+ onHide={() => onKeyboard?.("")}
34
+ />
35
+ </>
36
+ )
37
+ }
38
+ ```
39
+
40
+ > 点击键盘以外的区域时,键盘会自动收起,通过阻止元素上的 touchstart 事件冒泡可以避免键盘收起。
41
+
42
+ ### 带右侧栏的键盘
43
+
44
+ 使用 `NumberKeyboard.Sidebar` 子组件可以用来展示键盘的右侧栏,常用于输入金额的场景。
45
+
46
+ ```tsx
47
+ function SidebarNumberKeyboard(props: KeyboardProps) {
48
+ const { keyboard, onKeyboard, onKeyPress } = props
49
+ return (
50
+ <>
51
+ <Cell
52
+ clickable
53
+ title="弹出带右侧栏的键盘"
54
+ isLink
55
+ onClick={() => onKeyboard?.("sidebar")}
56
+ />
57
+ <NumberKeyboard
58
+ open={keyboard === "sidebar"}
59
+ extraKey={[undefined, "."]}
60
+ onKeyPress={onKeyPress}
61
+ onHide={() => onKeyboard?.("")}
62
+ >
63
+ <NumberKeyboard.Sidebar>
64
+ <NumberKeyboard.Key size="large" code="backspace" />
65
+ <NumberKeyboard.Key size="large" code="keyboard-hide" color="blue">
66
+ 完成
67
+ </NumberKeyboard.Key>
68
+ </NumberKeyboard.Sidebar>
69
+ </NumberKeyboard>
70
+ </>
71
+ )
72
+ }
73
+
74
+ ```
75
+
76
+ ### 身份证号键盘
77
+
78
+ 通过 `extraKey` 属性可以设置左下角按键内容,比如需要输入身份证号时,可以将 `extraKey` 设置为 `X`。
79
+
80
+ ```tsx
81
+ function IdCardNumberKeyboard(props: KeyboardProps) {
82
+ const { keyboard, onKeyboard, onKeyPress } = props
83
+ return (
84
+ <>
85
+ <Cell
86
+ clickable
87
+ title="弹出身份证号键盘"
88
+ isLink
89
+ onClick={() => onKeyboard?.("idCard")}
90
+ />
91
+ <NumberKeyboard
92
+ open={keyboard === "idcard"}
93
+ extraKey="X"
94
+ onKeyPress={onKeyPress}
95
+ onHide={() => onKeyboard?.("")}
96
+ >
97
+ <NumberKeyboard.Header>
98
+ <NumberKeyboard.Button>完成</NumberKeyboard.Button>
99
+ </NumberKeyboard.Header>
100
+ </NumberKeyboard>
101
+ </>
102
+ )
103
+ }
104
+ ```
105
+
106
+ ### 键盘标题
107
+
108
+ 通过 `title` 属性可以设置键盘标题。
109
+
110
+ ```tsx
111
+ function TitleNumberKeyboard(props: KeyboardProps) {
112
+ const { keyboard, onKeyboard, onKeyPress } = props
113
+ return (
114
+ <>
115
+ <Cell
116
+ clickable
117
+ title="弹出身份证号键盘"
118
+ isLink
119
+ onClick={() => onKeyboard?.("title")}
120
+ />
121
+ <NumberKeyboard
122
+ open={keyboard === "title"}
123
+ title="键盘标题"
124
+ extraKey="."
125
+ onKeyPress={onKeyPress}
126
+ onHide={() => onKeyboard?.("")}
127
+ >
128
+ <NumberKeyboard.Header>
129
+ <NumberKeyboard.Button>完成</NumberKeyboard.Button>
130
+ </NumberKeyboard.Header>
131
+ </NumberKeyboard>
132
+ </>
133
+ )
134
+ }
135
+ ```
136
+
137
+ ### 配置多个按键
138
+
139
+ 将 `extraKey` 配置成数组,可以实现配置多个按键。
140
+
141
+ ```tsx
142
+ function NumberKeyboardWithKeys(props: KeyboardProps) {
143
+ const { keyboard, onKeyboard, onKeyPress } = props
144
+ return (
145
+ <>
146
+ <Cell
147
+ clickable
148
+ title="弹出配置多个按键的键盘"
149
+ isLink
150
+ onClick={() => onKeyboard?.("keys")}
151
+ />
152
+ <NumberKeyboard
153
+ open={keyboard === "keys"}
154
+ extraKey={["00", "."]}
155
+ onKeyPress={onKeyPress}
156
+ onHide={() => onKeyboard?.("")}
157
+ >
158
+ <NumberKeyboard.Sidebar>
159
+ <NumberKeyboard.Key size="large" code="backspace" />
160
+ <NumberKeyboard.Key size="large" code="keyboard-hide" color="blue">
161
+ 完成
162
+ </NumberKeyboard.Key>
163
+ </NumberKeyboard.Sidebar>
164
+ </NumberKeyboard>
165
+ </>
166
+ )
167
+ }
168
+ ```
169
+
170
+ ### 随机数字键盘
171
+
172
+ 通过 `random` 属性可以随机排序数字键盘,常用于安全等级较高的场景。
173
+
174
+ ```tsx
175
+ function RandomNumberKeyboard(props: KeyboardProps) {
176
+ const { keyboard, onKeyboard, onKeyPress } = props
177
+ return (
178
+ <>
179
+ <Cell
180
+ clickable
181
+ title="弹出配置随机数字的键盘"
182
+ isLink
183
+ onClick={() => onKeyboard?.("random")}
184
+ />
185
+ <NumberKeyboard
186
+ open={keyboard === "random"}
187
+ random
188
+ onKeyPress={onKeyPress}
189
+ onHide={() => onKeyboard?.("")}
190
+ />
191
+ </>
192
+ )
193
+ }
194
+ ```
195
+
196
+ ## API
197
+
198
+ ### NumberKeyboard Props
199
+
200
+ | 参数 | 说明 | 类型 | 默认值 |
201
+ | --- | --- | --- | --- |
202
+ | value | 当前输入值 | _string_ | - |
203
+ | open | 是否显示键盘 | _boolean_ | - |
204
+ | title | 键盘标题 | _string_ | - |
205
+ | maxlength | 输入值最大长度 | _number \| string_ | - |
206
+ | transition | 是否开启过场动画 | _boolean_ | `true` |
207
+ | extraKey | 底部额外按键的内容 | _ReactNode \| [ReactNode, ReactNode]_ | `''` |
208
+ | random | 是否将通过随机顺序展示按键 | _boolean_ | `false` |
209
+
210
+ ### NumberKeyboard Events
211
+
212
+ | 事件名 | 说明 | 回调参数 |
213
+ | ------ | ------------------------------ | ------------- |
214
+ | onChange | 点击按键时触发 | key: 按键内容 |
215
+ | onBackspace | 点击删除键时触发 | - |
216
+ | onHide | 点击关闭按钮时触发 | - |
217
+
218
+ ## 主题定制
219
+
220
+ ### 样式变量
221
+
222
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
223
+
224
+ | 名称 | 默认值 | 描述 |
225
+ |---------------------------------------------|---------------------------------------------|-----|
226
+ | number-keyboard-z-index | _100_ | - |
227
+ | number-keyboard-background-color | _var(--gray-2)_ | - |
228
+ | number-keyboard-with-title-border-radius | _20px * $hd 20px * $hd 0 0_ | - |
229
+ | number-keyboard-header-color | _var(--gray-7)_ | - |
230
+ | number-keyboard-header-padding-top | _6px * $hd_ | - |
231
+ | number-keyboard-header-height | _34px * $hd_ | - |
232
+ | number-keyboard-header-font-size | _var(--font-size-lg)_ | - |
233
+ | number-keyboard-key-height | _48px * $hd_ | - |
234
+ | number-keyboard-key-font-size | _28px * $hd_ | - |
235
+ | number-keyboard-key-background-color | _var(--white, $white)_ | - |
236
+ | number-keyboard-key-border-radius | _var(--border-radius-lg)_ | - |
237
+ | number-keyboard-key-line-height | _1.5_ | - |
238
+ | number-keyboard-key-active-background-color | _var(--gray-3)_ | - |
239
+ | number-keyboard-key-active-opacity | _var(--active-opacity)_ | - |
240
+ | number-keyboard-large-key-font-size | _var(--font-size-lg)_ | - |
241
+ | number-keyboard-hide-padding | _0 var(--padding-md)_ | - |
242
+ | number-keyboard-hide-font-size | _24px * $hd_ | - |
243
+ | number-keyboard-hide-color | _var(--text-link-color)_ | - |
244
+ | number-keyboard-hide-active-opacity | _var(--number-keyboard-key-active-opacity)_ | - |
245
+ | number-keyboard-backspace-font-size | _22px * $hd_ | - |
246
+ | number-keyboard-button-color | _var(--white)_ | - |
247
+ | number-keyboard-button-background-color | _var(--primary-color)_ | - |
@@ -0,0 +1,201 @@
1
+ import { Cell, NumberKeyboard, Toast } from "@fjyueke/bify-core"
2
+ import { ArrowRight } from "@fjyueke/bify-icons"
3
+ import { useState } from "react"
4
+ import BlockCard from "../../../components/block-card"
5
+ import Page from "../../../components/page"
6
+ import "./index.scss"
7
+
8
+ interface KeyboardProps {
9
+ keyboard?: string
10
+
11
+ onKeyboard?(keyboard: string): void
12
+
13
+ onKeyPress?(value: string | number, code: string): void
14
+ }
15
+
16
+ function BasicNumberKeyboard(props: KeyboardProps) {
17
+ const { keyboard, onKeyboard, onKeyPress } = props
18
+ return (
19
+ <>
20
+ <Cell
21
+ clickable
22
+ title="弹出默认键盘"
23
+ isLink
24
+ onClick={() => onKeyboard?.("basic")}
25
+ />
26
+ <NumberKeyboard
27
+ open={keyboard === "basic"}
28
+ onKeyPress={onKeyPress}
29
+ onHide={() => onKeyboard?.("")}
30
+ />
31
+ </>
32
+ )
33
+ }
34
+
35
+ function SidebarNumberKeyboard(props: KeyboardProps) {
36
+ const { keyboard, onKeyboard, onKeyPress } = props
37
+ return (
38
+ <>
39
+ <Cell
40
+ clickable
41
+ title="弹出带右侧栏的键盘"
42
+ isLink
43
+ onClick={() => onKeyboard?.("sidebar")}
44
+ />
45
+ <NumberKeyboard
46
+ open={keyboard === "sidebar"}
47
+ extraKey={[undefined, "."]}
48
+ onKeyPress={onKeyPress}
49
+ onHide={() => onKeyboard?.("")}
50
+ >
51
+ <NumberKeyboard.Sidebar>
52
+ <NumberKeyboard.Key size="large" code="backspace" />
53
+ <NumberKeyboard.Key size="large" code="keyboard-hide" color="blue">
54
+ 完成
55
+ </NumberKeyboard.Key>
56
+ </NumberKeyboard.Sidebar>
57
+ </NumberKeyboard>
58
+ </>
59
+ )
60
+ }
61
+
62
+ function IdCardNumberKeyboard(props: KeyboardProps) {
63
+ const { keyboard, onKeyboard, onKeyPress } = props
64
+ return (
65
+ <>
66
+ <Cell
67
+ clickable
68
+ title="弹出身份证号键盘"
69
+ isLink
70
+ onClick={() => onKeyboard?.("idCard")}
71
+ />
72
+ <NumberKeyboard
73
+ open={keyboard === "idCard"}
74
+ extraKey="X"
75
+ onKeyPress={onKeyPress}
76
+ onHide={() => onKeyboard?.("")}
77
+ >
78
+ <NumberKeyboard.Header>
79
+ <NumberKeyboard.Button>完成</NumberKeyboard.Button>
80
+ </NumberKeyboard.Header>
81
+ </NumberKeyboard>
82
+ </>
83
+ )
84
+ }
85
+
86
+ function TitleNumberKeyboard(props: KeyboardProps) {
87
+ const { keyboard, onKeyboard, onKeyPress } = props
88
+ return (
89
+ <>
90
+ <Cell
91
+ clickable
92
+ title="弹出带标题的键盘"
93
+ isLink
94
+ onClick={() => onKeyboard?.("title")}
95
+ />
96
+ <NumberKeyboard
97
+ open={keyboard === "title"}
98
+ title="键盘标题"
99
+ extraKey="."
100
+ onKeyPress={onKeyPress}
101
+ onHide={() => onKeyboard?.("")}
102
+ >
103
+ <NumberKeyboard.Header>
104
+ <NumberKeyboard.Button>完成</NumberKeyboard.Button>
105
+ </NumberKeyboard.Header>
106
+ </NumberKeyboard>
107
+ </>
108
+ )
109
+ }
110
+
111
+ function NumberKeyboardWithKeys(props: KeyboardProps) {
112
+ const { keyboard, onKeyboard, onKeyPress } = props
113
+ return (
114
+ <>
115
+ <Cell
116
+ clickable
117
+ title="弹出配置多个按键的键盘"
118
+ isLink
119
+ onClick={() => onKeyboard?.("keys")}
120
+ />
121
+ <NumberKeyboard
122
+ open={keyboard === "keys"}
123
+ extraKey={["00", "."]}
124
+ onKeyPress={onKeyPress}
125
+ onHide={() => onKeyboard?.("")}
126
+ >
127
+ <NumberKeyboard.Sidebar>
128
+ <NumberKeyboard.Key size="large" code="backspace" />
129
+ <NumberKeyboard.Key size="large" code="keyboard-hide" color="blue">
130
+ 完成
131
+ </NumberKeyboard.Key>
132
+ </NumberKeyboard.Sidebar>
133
+ </NumberKeyboard>
134
+ </>
135
+ )
136
+ }
137
+
138
+ function RandomNumberKeyboard(props: KeyboardProps) {
139
+ const { keyboard, onKeyboard, onKeyPress } = props
140
+ return (
141
+ <>
142
+ <Cell
143
+ clickable
144
+ title="弹出配置随机数字的键盘"
145
+ isLink
146
+ onClick={() => onKeyboard?.("random")}
147
+ />
148
+ <NumberKeyboard
149
+ open={keyboard === "random"}
150
+ random
151
+ onKeyPress={onKeyPress}
152
+ onHide={() => onKeyboard?.("")}
153
+ />
154
+ </>
155
+ )
156
+ }
157
+
158
+ export default function NumberKeyboardDemo() {
159
+ const [keyboard, setKeyboard] = useState("basic")
160
+ const [open, setOpen] = useState(false)
161
+ const [value, setValue] = useState<any>()
162
+
163
+ const onKeyPress = (aValue: string | number, code: string) => {
164
+ setOpen(code !== "keyboard-hide")
165
+ if (code === "backspace") {
166
+ setValue("backspace")
167
+ } else if (code === "extra") {
168
+ setValue(`输入:${aValue}`)
169
+ }
170
+ }
171
+
172
+ return (
173
+ <Page title="NumberKeyboard 数字键盘" className="number-keyboard-demo">
174
+ <BlockCard>
175
+ <BasicNumberKeyboard keyboard={keyboard} onKeyboard={setKeyboard} onKeyPress={onKeyPress} />
176
+ <SidebarNumberKeyboard
177
+ keyboard={keyboard}
178
+ onKeyboard={setKeyboard}
179
+ onKeyPress={onKeyPress}
180
+ />
181
+ <IdCardNumberKeyboard
182
+ keyboard={keyboard}
183
+ onKeyboard={setKeyboard}
184
+ onKeyPress={onKeyPress}
185
+ />
186
+ <TitleNumberKeyboard keyboard={keyboard} onKeyboard={setKeyboard} onKeyPress={onKeyPress} />
187
+ <NumberKeyboardWithKeys
188
+ keyboard={keyboard}
189
+ onKeyboard={setKeyboard}
190
+ onKeyPress={onKeyPress}
191
+ />
192
+ <RandomNumberKeyboard
193
+ keyboard={keyboard}
194
+ onKeyboard={setKeyboard}
195
+ onKeyPress={onKeyPress}
196
+ />
197
+ </BlockCard>
198
+ <Toast open={open} duration={800} onClose={() => setOpen(false)} children={value} />
199
+ </Page>
200
+ )
201
+ }
@@ -0,0 +1,18 @@
1
+ ## API
2
+
3
+ ### Props
4
+
5
+ | 参数 | 说明 | 类型 | 默认值 |
6
+ | ------------------------- | -------------------------- | -------- | ------ |
7
+ | current | 当前页码 | _number_ | - |
8
+ | mode `v0.1.0-alpha.9` | 显示模式,可选值为 simple | _string_ | multi |
9
+ | prevText `v0.1.0-alpha.9` | 上一页按钮文字 | _string_ | 上一页 |
10
+ | nextText `v0.1.0-alpha.9` | 下一页按钮文字 | _string_ | 下一页 |
11
+ | siblingCount | 当前页码两侧显示的数字个数 | _number_ | `2` |
12
+ | count | 总页数 | _number_ | - |
13
+
14
+ ### Events
15
+
16
+ | 事件名 | 说明 | 回调参数 |
17
+ | -------- | -------------- | -------- |
18
+ | onChange | 页码改变时触发 | - |
@@ -0,0 +1,113 @@
1
+ # Pagination 分页
2
+
3
+ ### 介绍
4
+
5
+ 数据量过多时,采用分页的形式将数据分隔,每次只加载一个页面。
6
+
7
+ ### 引入
8
+
9
+ ```js
10
+ import { Pagination } from "@fjyueke/bify-core"
11
+ ```
12
+
13
+ ## 代码演示
14
+
15
+ ### 基础用法
16
+
17
+ 通过 `current` 来绑定当前页码。
18
+
19
+ ```tsx
20
+ export default function BasicPagination() {
21
+ const [current, setCurrent] = useState<number>(1)
22
+ return <Pagination current={current} count={10} onChange={(page) => setCurrent(page)} />
23
+ }
24
+ ```
25
+
26
+ ### 简单模式
27
+
28
+ 将 `mode` 设置为 `simple` 来切换到简单模式,此时分页器不会展示具体的页码按钮。
29
+
30
+ ```tsx
31
+ export default function BasicPagination() {
32
+ const [current, setCurrent] = useState<number>(1)
33
+ return (
34
+ <Pagination current={current} count={10} mode="simple" onChange={(page) => setCurrent(page)} />
35
+ )
36
+ }
37
+ ```
38
+
39
+ ### 显示省略号
40
+
41
+ 设置 `Pagination.Item.type` 为 `start-ellipsis` 或者 `end-ellipsis` 展示省略号按钮,点击后可以快速跳转。
42
+
43
+ ```tsx
44
+ function PaginationWithEllipses() {
45
+ const [current, setCurrent] = useState<number>(1)
46
+ return (
47
+ <Pagination current={current} siblingCount={1} count={13} onChange={(page) => setCurrent(page)}>
48
+ <Pagination.Item type="start-ellipsis" />
49
+ <Pagination.Item type="end-ellipsis" />
50
+ </Pagination>
51
+ )
52
+ }
53
+ ```
54
+
55
+ ### 自定义按钮
56
+
57
+ 通过 `Pagination.Item` 组件来自定义分页按钮的内容。
58
+
59
+ ```tsx
60
+ function PaginationWithCustomButton() {
61
+ const [current, setCurrent] = useState<number>(1)
62
+ return (
63
+ <Pagination current={current} count={6} onChange={(page) => setCurrent(page)}>
64
+ <Pagination.Item type="previous">
65
+ <ArrowLeft />
66
+ </Pagination.Item>
67
+ <Pagination.Item type="next">
68
+ <ArrowRight />
69
+ </Pagination.Item>
70
+ </Pagination>
71
+ )
72
+ }
73
+ ```
74
+
75
+ ## API
76
+
77
+ ### Props
78
+
79
+ | 参数 | 说明 | 类型 | 默认值 |
80
+ | ------------------------- | -------------------------- | -------- | ------ |
81
+ | current | 当前页码 | _number_ | - |
82
+ | mode `v0.1.0-alpha.9` | 显示模式,可选值为 simple | _string_ | multi |
83
+ | prevText `v0.1.0-alpha.9` | 上一页按钮文字 | _string_ | 上一页 |
84
+ | nextText `v0.1.0-alpha.9` | 下一页按钮文字 | _string_ | 下一页 |
85
+ | siblingCount | 当前页码两侧显示的数字个数 | _number_ | `2` |
86
+ | count | 总页数 | _number_ | - |
87
+
88
+ ### Events
89
+
90
+ | 事件名 | 说明 | 回调参数 |
91
+ | -------- | -------------- | -------- |
92
+ | onChange | 页码改变时触发 | - |
93
+
94
+ ## 主题定制
95
+
96
+ ### 样式变量
97
+
98
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider](/components/config-provider/) 组件。
99
+
100
+ | 名称 | 默认值 | 描述 |
101
+ | ------------------------------------------- | ------------------------------ | ---- |
102
+ | --pagination-height | _40px \* $hd_ | - |
103
+ | --pagination-font-size | _var(--font-size-md)_ | - |
104
+ | --pagination-background-color | _var(--white)_ | - |
105
+ | --pagination-item-min-width | _36px \* $hd_ | - |
106
+ | --pagination-item-color | _var(--blue)_ | - |
107
+ | --pagination-item-active-color | _var(--white)_ | - |
108
+ | --pagination-item-active-background-color | _var(--pagination-item-color)_ | - |
109
+ | --pagination-item-disabled-color | _var(--gray-7)_ | - |
110
+ | --pagination-item-disabled-background-color | _var(--background-color)_ | - |
111
+ | --pagination-item-disabled-opacity | _var(--disabled-opacity)_ | - |
112
+ | --pagination-button-padding | _0 var(--padding-base)_ | - |
113
+ | --pagination-desc-color | _var(--gray-7)_ | - |
@@ -0,0 +1,73 @@
1
+ import { Pagination } from "@fjyueke/bify-core"
2
+ import { ArrowLeft, ArrowRight } from "@fjyueke/bify-icons"
3
+ import { useState } from "react"
4
+ import Block from "../../../components/block"
5
+ import Page from "../../../components/page"
6
+ import "./index.scss"
7
+
8
+ function BasicPagination() {
9
+ const [current, setCurrent] = useState<number>(1)
10
+ return (
11
+ <Block title="基础用法">
12
+ <Pagination current={current} count={10} onChange={(page) => setCurrent(page)} />
13
+ </Block>
14
+ )
15
+ }
16
+
17
+ function SimplePagination() {
18
+ const [current, setCurrent] = useState<number>(1)
19
+ return (
20
+ <Block title="简单模式">
21
+ <Pagination
22
+ current={current}
23
+ count={10}
24
+ mode="simple"
25
+ onChange={(page) => setCurrent(page)}
26
+ />
27
+ </Block>
28
+ )
29
+ }
30
+
31
+ function PaginationWithEllipses() {
32
+ const [current, setCurrent] = useState<number>(1)
33
+ return (
34
+ <Block title="显示省略号">
35
+ <Pagination
36
+ current={current}
37
+ siblingCount={1}
38
+ count={13}
39
+ onChange={(page) => setCurrent(page)}
40
+ >
41
+ <Pagination.Item type="start-ellipsis" />
42
+ <Pagination.Item type="end-ellipsis" />
43
+ </Pagination>
44
+ </Block>
45
+ )
46
+ }
47
+
48
+ function PaginationWithCustomButton() {
49
+ const [current, setCurrent] = useState<number>(1)
50
+ return (
51
+ <Block title="自定义按钮">
52
+ <Pagination current={current} count={6} onChange={(page) => setCurrent(page)}>
53
+ <Pagination.Item type="previous">
54
+ <ArrowLeft />
55
+ </Pagination.Item>
56
+ <Pagination.Item type="next">
57
+ <ArrowRight />
58
+ </Pagination.Item>
59
+ </Pagination>
60
+ </Block>
61
+ )
62
+ }
63
+
64
+ export default function PaginationDemo() {
65
+ return (
66
+ <Page title="Pagination 分页" className="pagination-demo">
67
+ <BasicPagination />
68
+ <SimplePagination />
69
+ <PaginationWithEllipses />
70
+ <PaginationWithCustomButton />
71
+ </Page>
72
+ )
73
+ }
@@ -0,0 +1,25 @@
1
+ ## API
2
+
3
+ ### PasswordInput Props
4
+
5
+ | 参数 | 说明 | 类型 | 默认值 |
6
+ |----------|-------------------------------------|--------------|-----------------------------|
7
+ | value | 密码值 | _string_ | `''` |
8
+ | length | 密码最大长度 | _number \| string_ | `6` |
9
+ | gutter | 输入框格子之间的间距,如 `20px` `2em`,默认单位为`px` | _number \| string_ | `0` |
10
+ | mask | 是否隐藏密码内容 | _boolean_ | `true` |
11
+ | focus | 是否聚焦,聚焦时会显示光标 | _boolean_ | `false` |
12
+ | feedback | 输入框下方文字提示 | _ReactText \| PasswordInputFeedbackProps \| ReactElement_ | - |
13
+
14
+ ### PasswordInput Events
15
+
16
+ | 事件名 | 说明 | 回调参数 |
17
+ |---------|----------|------|
18
+ | onFocus | 输入框聚焦时触发 | - |
19
+
20
+
21
+ ### PasswordInput.Feedback Props
22
+
23
+ | 参数 | 说明 | 类型 | 默认值 |
24
+ |-------|---------------------------------------------------------|----------|-----|
25
+ | color | 颜色,可选值为 `primary` `info` `success` `warning` `danger` | _string_ | - |