@ray-js/smart-ui 2.13.1 → 2.13.2-beta-1

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 (103) hide show
  1. package/es/@types/config-provider/index.d.ts +7 -2
  2. package/es/@types/config-provider/theme-vars.d.ts +1 -1
  3. package/es/action-sheet/README.md +613 -0
  4. package/es/battery/README.md +149 -0
  5. package/es/bottom-sheet/README.md +495 -0
  6. package/es/button/README.md +335 -0
  7. package/es/calendar/README.md +513 -0
  8. package/es/cascader/README.md +326 -0
  9. package/es/cell/README.md +317 -0
  10. package/es/checkbox/README.md +481 -0
  11. package/es/circle/README.md +132 -0
  12. package/es/col/README.md +162 -0
  13. package/es/collapse/README.md +127 -0
  14. package/es/config-provider/README.md +150 -0
  15. package/es/count-down/README.md +201 -0
  16. package/es/custom-keyboard/README.md +122 -0
  17. package/es/datetime-picker/README.md +438 -0
  18. package/es/dialog/README.md +451 -0
  19. package/es/divider/README.md +132 -0
  20. package/es/dropdown-menu/README.md +331 -0
  21. package/es/empty/README.md +119 -0
  22. package/es/field/README.md +455 -0
  23. package/es/grid/README.md +273 -0
  24. package/es/icon/README.md +178 -0
  25. package/es/image/README.md +225 -0
  26. package/es/index-bar/README.md +186 -0
  27. package/es/loading/README.md +120 -0
  28. package/es/nav-bar/README.md +410 -0
  29. package/es/notice-bar/README.md +274 -0
  30. package/es/notify/README.md +121 -0
  31. package/es/overlay/README.md +128 -0
  32. package/es/picker/README.md +412 -0
  33. package/es/popover/README.md +338 -0
  34. package/es/popup/README.md +272 -0
  35. package/es/progress/README.md +88 -0
  36. package/es/radio/README.md +423 -0
  37. package/es/rate/README.md +248 -0
  38. package/es/search/README.md +290 -0
  39. package/es/sidebar/README.md +176 -0
  40. package/es/skeleton/README.md +141 -0
  41. package/es/slider/README.md +444 -0
  42. package/es/stepper/README.md +231 -0
  43. package/es/sticky/README.md +91 -0
  44. package/es/swipe-cell/README.md +217 -0
  45. package/es/switch/README.md +316 -0
  46. package/es/tab/README.md +501 -0
  47. package/es/tabbar/README.md +397 -0
  48. package/es/tag/README.md +215 -0
  49. package/es/toast/README.md +293 -0
  50. package/es/transition/README.md +140 -0
  51. package/es/tree-select/README.md +348 -0
  52. package/lib/@types/config-provider/index.d.ts +7 -2
  53. package/lib/@types/config-provider/theme-vars.d.ts +1 -1
  54. package/lib/action-sheet/README.md +613 -0
  55. package/lib/battery/README.md +149 -0
  56. package/lib/bottom-sheet/README.md +495 -0
  57. package/lib/button/README.md +335 -0
  58. package/lib/calendar/README.md +513 -0
  59. package/lib/cascader/README.md +326 -0
  60. package/lib/cell/README.md +317 -0
  61. package/lib/checkbox/README.md +481 -0
  62. package/lib/circle/README.md +132 -0
  63. package/lib/col/README.md +162 -0
  64. package/lib/collapse/README.md +127 -0
  65. package/lib/config-provider/README.md +150 -0
  66. package/lib/count-down/README.md +201 -0
  67. package/lib/custom-keyboard/README.md +122 -0
  68. package/lib/datetime-picker/README.md +438 -0
  69. package/lib/dialog/README.md +451 -0
  70. package/lib/divider/README.md +132 -0
  71. package/lib/dropdown-menu/README.md +331 -0
  72. package/lib/empty/README.md +119 -0
  73. package/lib/field/README.md +455 -0
  74. package/lib/grid/README.md +273 -0
  75. package/lib/icon/README.md +178 -0
  76. package/lib/image/README.md +225 -0
  77. package/lib/index-bar/README.md +186 -0
  78. package/lib/loading/README.md +120 -0
  79. package/lib/nav-bar/README.md +410 -0
  80. package/lib/notice-bar/README.md +274 -0
  81. package/lib/notify/README.md +121 -0
  82. package/lib/overlay/README.md +128 -0
  83. package/lib/picker/README.md +412 -0
  84. package/lib/popover/README.md +338 -0
  85. package/lib/popup/README.md +272 -0
  86. package/lib/progress/README.md +88 -0
  87. package/lib/radio/README.md +423 -0
  88. package/lib/rate/README.md +248 -0
  89. package/lib/search/README.md +290 -0
  90. package/lib/sidebar/README.md +176 -0
  91. package/lib/skeleton/README.md +141 -0
  92. package/lib/slider/README.md +444 -0
  93. package/lib/stepper/README.md +231 -0
  94. package/lib/sticky/README.md +91 -0
  95. package/lib/swipe-cell/README.md +217 -0
  96. package/lib/switch/README.md +316 -0
  97. package/lib/tab/README.md +501 -0
  98. package/lib/tabbar/README.md +397 -0
  99. package/lib/tag/README.md +215 -0
  100. package/lib/toast/README.md +293 -0
  101. package/lib/transition/README.md +140 -0
  102. package/lib/tree-select/README.md +348 -0
  103. package/package.json +3 -3
@@ -0,0 +1,451 @@
1
+ ---
2
+ category: 反馈
3
+ assets: SearchDeviceTipModal,GatewayAddDeviceProgress
4
+ ---
5
+
6
+ # Dialog 弹出框
7
+
8
+ ### 介绍
9
+
10
+ 弹出模态框,常用于消息提示、消息确认,或在当前页面内完成特定的交互操作,支持函数调用和组件调用两种方式。
11
+
12
+ ### 引入
13
+
14
+ ```jsx
15
+ import { Dialog, DialogInstance } from '@ray-js/smart-ui';
16
+ ```
17
+
18
+ ## 代码演示
19
+
20
+ ```warning:⚠️注意
21
+ 通过 DialogInstance 方式调用组件时,页面上需要存在对应 Id 的 Dialog 组件,且 Id 全局不能重复哦!
22
+ ```
23
+
24
+ ### 提示弹窗
25
+
26
+ 用于提示一些消息,只包含一个确认按钮。
27
+
28
+ ```jsx
29
+ import React from 'react';
30
+ import { DialogInstance, Dialog, Button } from '@ray-js/smart-ui';
31
+
32
+ export default function Demo() {
33
+ const open = () => {
34
+ DialogInstance.alert({
35
+ message: '弹窗内容',
36
+ }).then(() => {
37
+ // on close
38
+ });
39
+ }
40
+ return (
41
+ <>
42
+ <Dialog id="smart-dialog" />
43
+ <Button onClick={open}>点击展示</Button>
44
+ </>
45
+ )
46
+ }
47
+ ```
48
+
49
+ ### 消息确认
50
+
51
+ `DialogInstance.confirm`用于确认消息,包含取消和确认按钮; `selector` 属性可以自定义的选择对应 Id 的 `Dialog` 组件。
52
+
53
+ ```jsx
54
+ import React from 'react';
55
+ import { DialogInstance, Dialog, Button } from '@ray-js/smart-ui';
56
+
57
+ export default function Demo() {
58
+ const open = () => {
59
+ DialogInstance.confirm({
60
+ selector: '#smart-dialog2',
61
+ title: '标题',
62
+ message: '弹窗内容',
63
+ })
64
+ .then(() => {
65
+ // 确认
66
+ })
67
+ .catch(() => {
68
+ // 取消
69
+ });
70
+ }
71
+ return (
72
+ <>
73
+ <Dialog id="smart-dialog2" />
74
+ <Button onClick={open}>点击展示</Button>
75
+ </>
76
+ )
77
+ }
78
+ ```
79
+
80
+ ### 输入框
81
+
82
+ 用于输入文案信息,此时默认最大输入限制`maxlength`是`20`;`emptyDisabled` `v2.7.0` 属性可以限制输入框内为空时无法提交。
83
+
84
+ ```jsx
85
+ import React from 'react';
86
+ import { DialogInstance, Dialog, Button } from '@ray-js/smart-ui';
87
+
88
+ const beforeClose = (action: 'confirm' | 'cancel' | 'overlay', value?: string): Promise<boolean> => {
89
+ return new Promise((resolve) => {
90
+ if (action === 'confirm') {
91
+ // 不存在输入值则拦截确认操作
92
+ resolve(!!value);
93
+ } else {
94
+ resolve(true);
95
+ }
96
+ });
97
+ }
98
+
99
+ export default function Demo() {
100
+ const open = () => {
101
+ DialogInstance.input({
102
+ title: 'Title',
103
+ value: '',
104
+ beforeClose,
105
+ emptyDisabled: true,
106
+ cancelButtonText: 'Sub Action',
107
+ })
108
+ .then(() => {
109
+ console.log('=== onConfirm', res);
110
+ const inputValue = res?.data?.inputValue;
111
+ })
112
+ .catch(() => {
113
+ // on cancel
114
+ });
115
+ }
116
+ return (
117
+ <>
118
+ <Dialog id="smart-dialog" />
119
+ <Button onClick={open}>点击展示</Button>
120
+ </>
121
+ )
122
+ }
123
+ ```
124
+
125
+ ### 圆角按钮样式
126
+
127
+ 将 theme 选项设置为 `round-button` 可以展示圆角按钮风格的弹窗。
128
+
129
+ ```jsx
130
+ import React from 'react';
131
+ import { DialogInstance, Dialog, Button } from '@ray-js/smart-ui';
132
+
133
+ export default function Demo() {
134
+ const openHasTitle = () => {
135
+ DialogInstance.alert({
136
+ title: '标题',
137
+ message: '弹窗内容',
138
+ theme: 'round-button',
139
+ }).then(() => {
140
+ // on close
141
+ });
142
+ }
143
+ const open = () => {
144
+ DialogInstance.alert({
145
+ message: '弹窗内容',
146
+ theme: 'round-button',
147
+ showCancelButton: true,
148
+ cancelButtonText: '取消'
149
+ }).then(() => {
150
+ // on close
151
+ });
152
+ }
153
+ return (
154
+ <>
155
+ <Dialog id="smart-dialog" />
156
+ <Button onClick={openHasTitle}>点击展示(有标题)</Button>
157
+ <Button onClick={open}>点击展示(无标题)</Button>
158
+ </>
159
+ )
160
+ }
161
+ ```
162
+
163
+ ### 异步关闭
164
+
165
+ 通过 `beforeClose` 属性可以传入一个回调函数,在弹窗关闭前进行特定操作。
166
+ > 注意:只支持API方式调用,不支持组件方式使用
167
+
168
+ ```jsx
169
+ import React from 'react';
170
+ import { DialogInstance, Dialog, Button } from '@ray-js/smart-ui';
171
+
172
+ const beforeClose = (action: 'confirm' | 'cancel' | 'overlay', value?: string): Promise<boolean> => {
173
+ return new Promise((resolve) => {
174
+ setTimeout(() => {
175
+ if (action === 'confirm') {
176
+ resolve(true);
177
+ } else {
178
+ // 拦截取消操作
179
+ resolve(false);
180
+ }
181
+ }, 1000);
182
+ });
183
+ }
184
+
185
+ export default function Demo() {
186
+ const open = () => {
187
+ DialogInstance.confirm({
188
+ title: '标题',
189
+ message: '弹窗内容',
190
+ beforeClose,
191
+ });
192
+ }
193
+ return (
194
+ <>
195
+ <Dialog id="smart-dialog" />
196
+ <Button onClick={open}>点击展示</Button>
197
+ </>
198
+ )
199
+ }
200
+ ```
201
+
202
+
203
+ ### 自定义图标 `v2.6.3`
204
+
205
+ icon 属性支持传入 svg string,底层用的是 SmartUI 的 Icon 组件,icon 属性就是传入name属性到 Icon 组件上
206
+
207
+
208
+ ```jsx
209
+ import React from 'react';
210
+ import { DialogInstance, Dialog, Button } from '@ray-js/smart-ui';
211
+ import AlarmIcon from '@tuya-miniapp/icons/dist/svg/Alarm';
212
+
213
+ export default function Demo() {
214
+ const open = () => {
215
+ DialogInstance.confirm({
216
+ title: 'Title',
217
+ icon: AlarmIcon,
218
+ iconColor: '#1989fa',
219
+ iconSize: '36px',
220
+ message: 'body',
221
+ cancelButtonText: 'Sub Action',
222
+ });
223
+ }
224
+ return (
225
+ <>
226
+ <Dialog id="smart-dialog" />
227
+ <Button onClick={open}>点击展示</Button>
228
+ </>
229
+ )
230
+ }
231
+ ```
232
+
233
+ ### 组件调用
234
+
235
+ 如果需要在弹窗内嵌入组件或其他自定义内容,可以使用组件调用的方式。
236
+
237
+ ```jsx
238
+ import React from 'react';
239
+ import { Dialog, Button, Image, SmartEventHandler } from '@ray-js/smart-ui';
240
+ import { View } from '@ray-js/ray';
241
+
242
+ export default function Demo() {
243
+ const [show, setShow] = React.useState(true);
244
+
245
+ const onClose: SmartEventHandler = event => {
246
+ const { detail } = event;
247
+ if (detail === 'confirm') {
248
+ setShow(false);
249
+ }
250
+ };
251
+
252
+ return (
253
+ <>
254
+ <Button onClick={() => setShow(true)}>点击展示</Button>
255
+ <Dialog
256
+ useSlot
257
+ title="标题"
258
+ show={show}
259
+ showCancelButton
260
+ onClose={onClose}
261
+ >
262
+ <View style={{ display: 'flex', justifyContent: 'center' }}>
263
+ <Image height="88" width="88" src="https://static1.tuyacn.com/static/tuya-miniapp-doc/_next/static/images/logo-small.png" />
264
+ </View>
265
+ </Dialog>
266
+ </>
267
+ )
268
+ }
269
+ ```
270
+
271
+ ### 自定义样式
272
+
273
+ 如果需要自定义样式,建议使用 `customClass` 实现,不在推荐 `className` 属性(在自定义组件中使用并不会生效),使用方法如下
274
+
275
+ 方式一:组件调用
276
+
277
+ ```jsx
278
+ <Dialog
279
+ title="标题"
280
+ message="弹窗内容"
281
+ show={show}
282
+ customClass="my-custom-class"
283
+ />
284
+ ```
285
+
286
+ 方式二:API 调用
287
+
288
+ ```jsx
289
+ <Dialog id="smart-dialog" customClass="my-custom-class" />
290
+ ```
291
+
292
+ ## API
293
+
294
+ ### 方法
295
+
296
+ | 方法名 | 参数 | 返回值 | 介绍 |
297
+ | -------- | --------- | --------- | --------- |
298
+ | DialogInstance | `options` | `Promise` | 展示弹窗 |
299
+ | DialogInstance.alert | `options` | `Promise` | 展示消息提示弹窗 |
300
+ | DialogInstance.close | - | `void` | 关闭弹窗, 并清空缓存队列 |
301
+ | DialogInstance.confirm | `options` | `Promise` | 展示消息确认弹窗 |
302
+ | DialogInstance.input | `options` | `Promise` | 展示输入框弹窗 |
303
+ | DialogInstance.resetDefaultOptions | - | `void` | 重置默认配置,对所有 Dialog 生效 |
304
+ | DialogInstance.setDefaultOptions | `options` | `void` | 修改默认配置,对所有 Dialog 生效 |
305
+ | DialogInstance.stopLoading | - | `void` | 停止按钮的加载状态 |
306
+
307
+ ### Options
308
+
309
+ icon: AlarmIcon,
310
+ iconColor: '#1989fa',
311
+ iconSize: '36px',
312
+
313
+ 通过函数调用 Dialog 时,支持传入以下选项:
314
+
315
+ | 参数 | 说明 | 类型 | 默认值 |
316
+ | ------------ | --------- | -------------- | --------- |
317
+ | icon | 是否显示警告图标,或者icon的name值 | _boolean_ `v2.6.3` _boolean \| string_ `v2.6.3` | `false` |
318
+ | iconColor `v2.6.3` | icon的颜色 | _string_ | `#F04C4C` |
319
+ | iconSize `v2.6.3` | icon的大小 | _string_ | - |
320
+ | maxlength | 最大输入长度,设置为 -1 的时候不限制最大长度 | _number_ | `20` |
321
+ | message | 文本内容,支持通过`\n`换行 | _string_ | - |
322
+ | messageAlign | 内容对齐方式,可选值为`left` `right` | _string_ | `center` |
323
+ | password | 是否是密码类型 | _boolean_ | `false` |
324
+ | placeholder | 输入框为空时占位符 | _string_ | - |
325
+ | theme | 样式风格,可选值为`round-button` | _string_ | `default` |
326
+ | title | 标题 | _string_ | - |
327
+ | value | 输入框的初始值 | _string_ | - |
328
+ | onInput `v2.10.0` | 输入回调 | _(value: string) => void_ | - |
329
+ | width | 弹窗宽度,默认单位为`px` | _string \| number_ | `320px` |
330
+ | zIndex | z-index 层级 | _number_ | `100` |
331
+ | customStyle | 自定义样式 | _string_ | '' |
332
+ | selector | 自定义选择器 | _string_ | `#smart-dialog` |
333
+ | cancelButtonText | 取消按钮的文案 | _string_ | `Cancel` |
334
+ | closeOnClickOverlay | 点击遮罩层时是否关闭弹窗 | _boolean_ | `false` |
335
+ | confirmButtonText | 确认按钮的文案 | _string_ | `Confirm` |
336
+ | overlay | 是否展示遮罩层 | _boolean_ | `true` |
337
+ | overlayStyle | 自定义遮罩层样式 | _object_ | - |
338
+ | showCancelButton | 是否展示取消按钮 | _boolean_ | `false` |
339
+ | showConfirmButton | 是否展示确认按钮 | _boolean_ | `true` |
340
+ | beforeClose | 关闭前的回调函数,返回 `false` 可阻止关闭,支持返回 Promise | _(action) => boolean \| Promise\<boolean\>_ | - |
341
+ | context | 选择器的选择范围,可以传入自定义组件的 this 作为上下文 | _object_ | 当前页面 |
342
+ | transition | 动画名称,可选值为`fade` `none` | _string_ | `scale` |
343
+ | nativeDisabled `v2.3.8` | 开启弹框期间是否禁用本地手势 | _boolean_ | `false` |
344
+ | autoClose `v2.6.3` | 是否自动点击回调后关闭 | _boolean_ | `true` |
345
+ | emptyDisabled `v2.7.0` | 输入框模式,value 为空时 无法提交 | _boolean_ | `false` |
346
+ | fullCoverView `v2.11.1` | 是否使用 cover-view 包裹弹层,用于覆盖原生组件(如 map、video)时使用 | _boolean_ | `false` |
347
+
348
+ ### Props
349
+
350
+ 通过组件调用 Dialog 时,支持以下 Props:
351
+
352
+ | 参数 | 说明 | 类型 | 默认值 |
353
+ | ----------------- | --------- | ------------ | --------- |
354
+ | confirmButtonId | 确认按钮的标识符,作为底层原生 button 组件的 id 值 | _string_ | - |
355
+ | icon | 是否显示警告图标,或者icon的name值 | _boolean_ `v2.0.0` _boolean \| string_ `v2.6.3` | `false` |
356
+ | iconColor `v2.6.3` | icon的颜色 | _string_ | `#F04C4C` |
357
+ | iconSize `v2.6.3` | icon的大小 | _string_ | - |
358
+ | maxlength | 最大输入长度,设置为 -1 的时候不限制最大长度 | _number_ | `20` |
359
+ | message | 文本内容,支持通过`\n`换行 | _string_ | - |
360
+ | messageAlign | 内容对齐方式,可选值为`left` `right` | _string_ | `center` |
361
+ | password | 是否是密码类型 | _boolean_ | `false` |
362
+ | placeholder | 输入框为空时占位符 | _string_ | - |
363
+ | show | 是否显示弹窗 | _boolean_ | - |
364
+ | theme | 样式风格,可选值为`round-button` | _string_ | `default` |
365
+ | title | 标题 | _string_ | - |
366
+ | value | 输入框的初始值 | _string_ | - |
367
+ | width | 弹窗宽度,默认单位为`px` | _string \| number_ | `320px` |
368
+ | zIndex | z-index 层级 | _number_ | `100` |
369
+ | customStyle | 自定义样式 | _React.CSSProperties_ | - |
370
+ | showConfirmButton | 是否展示确认按钮 | _boolean_ | `true` |
371
+ | cancelButtonColor | 取消按钮的字体颜色 | _string_ | `#333` |
372
+ | cancelButtonText | 取消按钮的文案 | _string_ | `取消` |
373
+ | closeOnClickOverlay | 点击遮罩层时是否关闭弹窗 | _boolean_ | `false` |
374
+ | confirmButtonColor | 确认按钮的字体颜色 | _string_ | `#ee0a24` |
375
+ | confirmButtonText | 确认按钮的文案 | _string_ | `确认` |
376
+ | overlay | 是否展示遮罩层 | _boolean_ | `true` |
377
+ | overlayStyle | 自定义遮罩层样式 | _object_ | - |
378
+ | showCancelButton | 是否展示取消按钮 | _boolean_ | `false` |
379
+ | useCancelButtonSlot | 是否使用自定义取消按钮的插槽 | _boolean_ | `false` |
380
+ | useConfirmButtonSlot | 是否使用自定义确认按钮的插槽 | _boolean_ | `false` |
381
+ | useSlot | 是否使用自定义内容的插槽 | _boolean_ | `false` |
382
+ | useTitleSlot | 是否使用自定义标题的插槽 | _boolean_ | `false` |
383
+ | beforeClose | 关闭前的回调函数,返回 `false` 可阻止关闭,支持返回 Promise | _(action, value?: string) => boolean \| Promise\<boolean\>_ | - |
384
+ | transition | 动画名称,可选值为`fade` | _string_ | `scale` |
385
+ | autoClose `v2.6.3` | 是否自动点击回调后关闭 | _boolean_ | `false` |
386
+ | emptyDisabled `v2.7.0` | 输入框模式,value 为空时 无法提交 | _boolean_ | `false` |
387
+ | fullCoverView `v2.11.1` | 是否使用 cover-view 包裹弹层,用于覆盖原生组件(如 map、video)时使用 | _boolean_ | `false` |
388
+
389
+
390
+ ### Events
391
+
392
+ | 事件 | 说明 | 回调参数 |
393
+ | ------------ | -------------- | ------------ |
394
+ | onCancel | 点击取消按钮时触发 | - |
395
+ | onClose | 弹窗关闭时触发 | event.detail: 触发关闭事件的来源,<br>枚举为`confirm`,`cancel`,`overlay` |
396
+ | onConfirm | 点击确认按钮时触发 | - |
397
+
398
+ ### Slot
399
+
400
+ | 名称 | 说明 |
401
+ | ---------- | ----------------------- |
402
+ | cancelButton | 自定义`cancel-button`显示内容,需要 `use-cancel-button-slot` 为 `true` |
403
+ | confirmButton | 自定义`confirm-button`显示内容,需要 `use-confirm-button-slot` 为 `true` |
404
+ | title | 自定义`title`显示内容,如果设置了`title`属性则不生效 |
405
+
406
+ ### 外部样式类
407
+
408
+ | 类名 | 说明 |
409
+ | -------------------- | -------------- |
410
+ | cancelButtonClass | 取消按钮样式类 |
411
+ | confirmButtonClass | 确认按钮样式类 |
412
+ | customClass | 根节点样式类 |
413
+
414
+ ### 样式变量
415
+
416
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider)。
417
+ | 名称 | 默认值 | 描述 |
418
+ | ------------ | --------- | ---- |
419
+ | --dialog-cancel-color `v2.1.7` | _var(--app-B4-N3, rgba(0, 0, 0, 0.5))_ | 取消按钮颜色 |
420
+ | --dialog-confirm-color `v2.1.7` | _var(--app-B4-N1, rgba(0, 0, 0, 1))_ | 确认按钮颜色 |
421
+ | --dialog-confirm-font-weight `v2.5.1` | _normal_ | 确认按钮的字重 |
422
+ | --dialog-cancel-font-weight `v2.5.1` | _normal_ | 取消按钮字重 |
423
+ | --dialog-width | _311px_ | 弹窗宽度 |
424
+ | --dialog-small-screen-width | _90%_ | 小屏幕弹窗宽度 |
425
+ | --dialog-font-size | _16px_ | 对话框字体大小 |
426
+ | --dialog-border-radius | _16px_ | 圆角半径 |
427
+ | --dialog-background-color | _var(--smart-ui-dialog-background, rgba(255, 255, 255, 1))_ | 背景颜色 |
428
+ | --dialog-header-font-color | _var(--app-B4-N1, rgba(0, 0, 0, 1))_ | 标题字体颜色 |
429
+ | --dialog-header-font-weight | _400_ | 标题字体粗细 |
430
+ | --dialog-header-line-height | _24px_ | 标题行高 |
431
+ | --dialog-header-padding `v2.3.5` | _0_ | 头部标题内边距 |
432
+ | --dialog-header-padding-top | _24px_ | 头部标题顶部内边距 |
433
+ | --dialog-header-padding-side `v2.13.0` | _16px_ | 头部标题左右内边距 |
434
+ | --dialog-header-isolated-padding | _@padding-lg 0_ | 标题内边距 |
435
+ | --dialog-message-padding | _24px_ | 消息内边距 |
436
+ | --dialog-message-font-size | _16px_ | 消息字体大小 |
437
+ | --dialog-message-line-height | _20px_ | 消息行高 |
438
+ | --dialog-message-max-height | _60vh_ | 消息最大高度 |
439
+ | --dialog-message-text-color | _var(--app-B4-N1, rgba(0, 0, 0, 1))_ | 消息字体颜色 |
440
+ | --dialog-has-title-message-font-size | _14px_ | 标题消息字体大小 |
441
+ | --dialog-has-title-message-text-color | _var(--app-B4-N3, rgba(0, 0, 0, 0.5))_ | 标题消息字体颜色 |
442
+ | --dialog-has-title-message-padding-top | _8px_ | 标题消息顶部内边距 |
443
+ | --dialog-header-icon-size | _39px_ | 图标大小 |
444
+ | --dialog-input-height | _40px_ | 输入框高度 |
445
+ | --dialog-input-background-color | _var(--app-B4-N9, rgba(0, 0, 0, 0.05))_ | 输入框背景色 |
446
+ | --dialog-input-color `v2.13.1` | _var(--app-B4-N1, rgba(0, 0, 0, 1))_ | 输入框文字颜色 |
447
+ | --dialog-input-margin | _0 16px 24px_ | 输入框外边距 |
448
+ | --dialog-input-padding | _0 10px_ | 输入框内边距 |
449
+ | --dialog-input-border-radius | _10px_ | 输入框圆角半径 |
450
+ | --dialog-input-font-size | _14px_ | 输入框字体大小 |
451
+ | --dialog--round-button-border-radius `v2.3.5` | _20px_ `v2.3.5` _301px_ `v2.7.1` | 当设置`theme: 'round-button'`的按钮圆角 |
@@ -0,0 +1,132 @@
1
+ ---
2
+ category: 展示
3
+ ---
4
+
5
+ # Divider 分割线
6
+
7
+ ### 介绍
8
+
9
+ 用于将内容分隔为多个区域。
10
+
11
+ ### 引入
12
+
13
+ ```jsx
14
+ import { Divider } from '@ray-js/smart-ui';
15
+ ```
16
+
17
+ ## 代码演示
18
+
19
+ ### 基础用法
20
+
21
+ ```jsx
22
+ import { Divider } from '@ray-js/smart-ui';
23
+ import React from 'react';
24
+
25
+ export default function Demo() {
26
+ return <Divider />;
27
+ }
28
+ ```
29
+
30
+ ### 使用 hairline
31
+
32
+ ```jsx
33
+ import { Divider } from '@ray-js/smart-ui';
34
+ import React from 'react';
35
+
36
+ export default function Demo() {
37
+ return <Divider hairline />
38
+ }
39
+ ```
40
+
41
+ ### 虚线
42
+
43
+ ```jsx
44
+ import { Divider } from '@ray-js/smart-ui';
45
+ import React from 'react';
46
+
47
+ export default function Demo() {
48
+ return <Divider dashed />
49
+ }
50
+ ```
51
+
52
+ ### 内容位置
53
+
54
+ ```jsx
55
+ import { Divider } from '@ray-js/smart-ui';
56
+ import React from 'react';
57
+
58
+ export default function Demo() {
59
+ return <>
60
+ <Divider contentPosition="center">文本</Divider>
61
+ <Divider contentPosition="left">文本</Divider>
62
+ <Divider contentPosition="right">文本</Divider>
63
+ </>
64
+ }
65
+ ```
66
+
67
+ ### 自定义属性
68
+
69
+ ```jsx
70
+ import { Divider } from '@ray-js/smart-ui';
71
+ import React from 'react';
72
+
73
+ export default function Demo() {
74
+ return <>
75
+ <Divider contentPosition="center" textColor="#1989fa">文本颜色</Divider>
76
+ <Divider contentPosition="center" borderColor="#1989fa"> border 颜色 </Divider>
77
+ <Divider contentPosition="center" fontSize="18">字体大小</Divider>
78
+ </>
79
+ }
80
+ ```
81
+
82
+ ### 自定义样式
83
+
84
+ ```jsx
85
+ import { Divider } from '@ray-js/smart-ui';
86
+ import React from 'react';
87
+
88
+ export default function Demo() {
89
+ return <Divider
90
+ contentPosition="center"
91
+ customStyle={{
92
+ color: '#1989fa',
93
+ borderColor: '#1989fa',
94
+ fontSize: '18px'
95
+ }}
96
+ >
97
+ 文本
98
+ </Divider>
99
+ }
100
+ ```
101
+
102
+ ## API
103
+
104
+ ### Props
105
+
106
+ | 参数 | 说明 | 类型 | 默认值 |
107
+ | ---------------- | --------------------------------- | --------- | ------ |
108
+ | contentPosition | 文本位置,`left` `center` `right` | _string_ | - |
109
+ | customStyle | 自定义样式 | _React.CSSProperties_ | - |
110
+ | dashed | 虚线 | _boolean_ | false |
111
+ | hairline | 细线 | _boolean_ | false |
112
+
113
+ ### Slot
114
+
115
+ | 名称 | 说明 |
116
+ | ---- | -------------- |
117
+ | 默认 | 自定义文本内容 |
118
+
119
+ ### 样式变量
120
+
121
+ 组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 [ConfigProvider 组件](/material/smartui?comId=config-provider)。
122
+
123
+ | 名称 | 默认值 | 描述 |
124
+ | ----------------------------- | -------------------------------------- | ---- |
125
+ | --divider-margin | _@padding-md 0_ | 上下边距 |
126
+ | --divider-text-color | _#969799_ | 文本颜色 |
127
+ | --divider-font-size | _14px_ | 字体大小 |
128
+ | --divider-line-height | _24px_ | 行高 |
129
+ | --divider-border-color | _var(--app-B6-N7, rgba(0, 0, 0, 0.1))_ | 边框颜色 |
130
+ | --divider-content-padding | _16px_ | 内容内边距 |
131
+ | --divider-content-left-width | _10%_ | 左侧内容宽度 |
132
+ | --divider-content-right-width | _10%_ | 右侧内容宽度 |