@ray-js/smart-ui 2.2.2-beta-5 → 2.2.2-beta-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-zh_CN.md +56 -0
- package/dist/@types/circle/index.d.ts +49 -34
- package/dist/@types/config-provider/theme-vars.d.ts +2 -1
- package/dist/@types/index.d.ts +1 -0
- package/dist/@types/popover/index.d.ts +16 -0
- package/dist/@types/popover/index.js +1 -0
- package/dist/circle/index.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/popover/Popover.d.ts +2 -0
- package/dist/popover/Popover.js +4 -0
- package/dist/popover/PropTypes.d.ts +2 -0
- package/dist/popover/PropTypes.js +1 -0
- package/dist/popover/index.d.ts +5 -0
- package/dist/popover/index.js +3 -0
- package/package.json +4 -3
package/README-zh_CN.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[English](./README.md) | 简体中文
|
|
2
|
+
|
|
3
|
+
# @ray-js/smart-ui
|
|
4
|
+
|
|
5
|
+
## 介绍
|
|
6
|
+
|
|
7
|
+
`@ray-js/smart-ui` 是一个基于 `Ray` 框架和 `@tuya-miniapp/smart-ui` 的 React 组件库,旨在提供符合智能小程序移动端设计规范的轻量、可靠的 UI 组件。通过结合 `Ray` 的规范适配中间层和内置的完善 TS 类型,我们提供了一整套适用于智能小程序的 React 组件,让开发者能够快速构建符合设计规范的移动端应用。
|
|
8
|
+
|
|
9
|
+
## 预览
|
|
10
|
+
|
|
11
|
+
扫描下方智能小程序二维码,体验组件库示例。
|
|
12
|
+
|
|
13
|
+
<img src="https://images.tuyacn.com/content-platform/hestia/1716260412b7f2ae02271.png" width="200" height="200">
|
|
14
|
+
|
|
15
|
+
## 使用之前
|
|
16
|
+
|
|
17
|
+
使用 Smart UI 前,请确保你已经学习过智能小程序官方的 [Ray 开发概述](https://developer.tuya.com/cn/miniapp/develop/ray/guide/overview) 和 [Ray 组件介绍](https://developer.tuya.com/cn/miniapp/develop/ray/framework/component)。
|
|
18
|
+
|
|
19
|
+
## 安装
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# 通过 yarn 安装(推荐)
|
|
23
|
+
yarn add @ray-js/smart-ui
|
|
24
|
+
|
|
25
|
+
# 通过 npm 安装
|
|
26
|
+
npm i @ray-js/smart-ui
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 使用组件
|
|
30
|
+
|
|
31
|
+
以按钮组件为例
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
import { Button } from '@ray-js/smart-ui';
|
|
35
|
+
|
|
36
|
+
export default function Demo() {
|
|
37
|
+
return <Button type="info">信息按钮</Button>;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 在开发者工具中预览
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# 安装项目依赖
|
|
45
|
+
$ yarn
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
打开 [Tuya MiniApp Tools](https://developer.tuya.com/cn/miniapp/devtools/tools),把 `example` 目录添加进去就可以预览示例了。
|
|
49
|
+
|
|
50
|
+
## 基础库版本
|
|
51
|
+
|
|
52
|
+
@ray-js/smart-ui 从智能小程序基础库 `2.19.0` 版本 `@ray-js/ray@^1.5.1` 及 IDE `0.6.5` 开始提供稳定的支持。
|
|
53
|
+
|
|
54
|
+
## 开源协议
|
|
55
|
+
|
|
56
|
+
本项目基于 [MIT](https://zh.wikipedia.org/wiki/MIT%E8%A8%B1%E5%8F%AF%E8%AD%89) 协议,请自由地享受和参与开源。
|
|
@@ -1,58 +1,73 @@
|
|
|
1
1
|
import { SmartComponent } from '../base';
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
3
|
export interface SmartCircleProps {
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @default 0
|
|
5
|
+
* canvasId,可选,默认会随机生成一个
|
|
7
6
|
*/
|
|
8
|
-
|
|
7
|
+
canvasId?: string;
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
9
|
+
* 子元素
|
|
10
|
+
* 默认值:undefined
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
children?: ReactNode;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @default '100px'
|
|
14
|
+
* 类名
|
|
15
|
+
* 默认值:undefined
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
className?: string;
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @default '#1989fa'
|
|
19
|
+
* 样式 (v2.1.7)
|
|
20
|
+
* 默认值:undefined
|
|
23
21
|
*/
|
|
24
|
-
|
|
22
|
+
customStyle?: CSSProperties;
|
|
25
23
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @default '#fff'
|
|
24
|
+
* 填充颜色
|
|
25
|
+
* 默认值:'#007AFF'
|
|
29
26
|
*/
|
|
30
|
-
|
|
27
|
+
fillColor?: string;
|
|
31
28
|
/**
|
|
32
|
-
*
|
|
29
|
+
* 遮罩颜色
|
|
30
|
+
* 默认值:'#ffffff'
|
|
31
|
+
*/
|
|
32
|
+
maskColor?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 样式风格
|
|
35
|
+
* 可选值:`basic`、`angle`、`angle2`
|
|
36
|
+
*/
|
|
37
|
+
mode?: 'basic' | 'angle' | 'angle2';
|
|
38
|
+
/**
|
|
39
|
+
* 百分比
|
|
40
|
+
* 默认值:0
|
|
41
|
+
*/
|
|
42
|
+
percent?: number;
|
|
43
|
+
/**
|
|
44
|
+
* 是否圆形
|
|
45
|
+
* 默认值:true
|
|
33
46
|
*/
|
|
34
|
-
|
|
47
|
+
round?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 尺寸
|
|
50
|
+
* 默认值:'100px'
|
|
51
|
+
*/
|
|
52
|
+
size?: string;
|
|
35
53
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* @default 50
|
|
54
|
+
* 样式 (已废弃 v2.1.7)
|
|
55
|
+
* 默认值:undefined
|
|
39
56
|
*/
|
|
40
|
-
|
|
57
|
+
style?: CSSProperties;
|
|
41
58
|
/**
|
|
42
|
-
*
|
|
59
|
+
* 滑槽颜色
|
|
60
|
+
* 默认值:'#d3d3d3'
|
|
43
61
|
*/
|
|
44
|
-
|
|
62
|
+
trackColor?: string;
|
|
45
63
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @default 4
|
|
64
|
+
* 滑槽宽度
|
|
65
|
+
* 默认值:'10px'
|
|
49
66
|
*/
|
|
50
|
-
|
|
67
|
+
trackWidth?: string;
|
|
51
68
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @default true
|
|
69
|
+
* 渐变色
|
|
55
70
|
*/
|
|
56
|
-
|
|
71
|
+
fillColorStops?: Record<string, string>;
|
|
57
72
|
}
|
|
58
73
|
export type SmartCircle = SmartComponent<SmartCircleProps>;
|
|
@@ -42,8 +42,9 @@ type IndexBarThemeVars = 'indexBarIndexFontSize' | 'indexBarIndexLineHeight';
|
|
|
42
42
|
type SkeletonThemeVars = 'skeletonPadding' | 'skeletonRowHeight' | 'skeletonRowBackgroundColor' | 'skeletonRowMarginTop' | 'skeletonAvatarBackgroundColor' | 'skeletonAnimationDuration';
|
|
43
43
|
type CascaderThemeVars = 'cascaderHeaderHeight' | 'cascaderHeaderPadding' | 'cascaderTitleFontSize' | 'cascaderTitleLineHeight' | 'cascaderCloseIconSize' | 'cascaderCloseIconColor' | 'cascaderSelectedIconSize' | 'cascaderTabsHeight' | 'cascaderActiveColor' | 'cascaderOptionsHeight' | 'cascaderOptionDisabledColor' | 'cascaderTabColor' | 'cascaderUnselectedTabColor' | 'cascaderTabInactiveColor' | 'cascaderTextColor';
|
|
44
44
|
type CustomKeyboardThemeVars = 'customKeyboardBgColor' | 'customKeyboardTextColor' | 'customKeyboardBorderColor' | 'customKeyboardPlaceholderColor' | 'customKeyboardPopupBgColor' | 'customKeyboardPopupItemColor' | 'customKeyboardPopupConfirmColor' | 'customKeyboardPopupTextColor' | 'customKeyboardPopupHoverColor';
|
|
45
|
+
type PopoverThemeVars = 'popoverBackgroundColor' | 'popoverBoxShadow' | 'popoverPadding' | 'popoverBorderRadius';
|
|
45
46
|
/**
|
|
46
47
|
* 主题变量
|
|
47
48
|
*/
|
|
48
|
-
export type ThemeVars = Record<CommonThemeVars | IconThemeVars | ActionSheetThemeVars | BottomSheetThemeVars | ButtonThemeVars | CalendarThemeVars | CellThemeVars | CheckboxThemeVars | CircleThemeVars | CollapseThemeVars | CountDownThemeVars | DialogThemeVars | FieldThemeVars | ImageThemeVars | LoadingThemeVars | NavBarThemeVars | NoticeBarThemeVars | NotifyThemeVars | OverlayThemeVars | PickerThemeVars | PopupThemeVars | ProgressThemeVars | RadioThemeVars | RateThemeVars | SwitchThemeVars | SearchThemeVars | SidebarThemeVars | SliderThemeVars | StepperThemeVars | StepsThemeVars | TabbarThemeVars | TabThemeVars | TagThemeVars | ToastThemeVars | GridThemeVars | DividerThemeVars | EmptyThemeVars | TreeSelectThemeVars | DropdownMenuThemeVars | IndexAnchorThemeVars | IndexBarThemeVars | SkeletonThemeVars | CascaderThemeVars | CustomKeyboardThemeVars, string>;
|
|
49
|
+
export type ThemeVars = Record<CommonThemeVars | IconThemeVars | ActionSheetThemeVars | BottomSheetThemeVars | ButtonThemeVars | CalendarThemeVars | CellThemeVars | CheckboxThemeVars | CircleThemeVars | CollapseThemeVars | CountDownThemeVars | DialogThemeVars | FieldThemeVars | ImageThemeVars | LoadingThemeVars | NavBarThemeVars | NoticeBarThemeVars | NotifyThemeVars | OverlayThemeVars | PickerThemeVars | PopupThemeVars | ProgressThemeVars | RadioThemeVars | RateThemeVars | SwitchThemeVars | SearchThemeVars | SidebarThemeVars | SliderThemeVars | StepperThemeVars | StepsThemeVars | TabbarThemeVars | TabThemeVars | TagThemeVars | ToastThemeVars | GridThemeVars | DividerThemeVars | EmptyThemeVars | TreeSelectThemeVars | DropdownMenuThemeVars | IndexAnchorThemeVars | IndexBarThemeVars | SkeletonThemeVars | CascaderThemeVars | CustomKeyboardThemeVars | PopoverThemeVars, string>;
|
|
49
50
|
export {};
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -60,3 +60,4 @@ export { SmartTreeSelect, SmartTreeSelectEvents, SmartTreeSelectExternalClassNam
|
|
|
60
60
|
export { SmartCascader, SmartCascaderProps } from './cascader';
|
|
61
61
|
export { SmartBattery, SmartBatteryProps } from './battery';
|
|
62
62
|
export { SmartCustomKeyboard, SmartCustomKeyboardProps, SmartCustomKeyboardEvents, } from './custom-keyboard';
|
|
63
|
+
export { SmartPopover, SmartPopoverEvents, SmartPopoverExternalClassName, SmartPopoverProps, } from './popover';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SmartBaseExternalClassName, SmartComponent, SmartEventHandler } from '../base';
|
|
3
|
+
import { SmartTransitionEvents } from '../transition';
|
|
4
|
+
export interface SmartPopoverProps {
|
|
5
|
+
placement?: 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'left' | 'leftTop' | 'leftBottom' | 'right' | 'rightTop' | 'rightBottom';
|
|
6
|
+
show?: boolean;
|
|
7
|
+
customStyle?: React.CSSProperties;
|
|
8
|
+
zIndex?: number;
|
|
9
|
+
duration?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SmartPopoverEvents extends SmartTransitionEvents {
|
|
12
|
+
onClose?: SmartEventHandler;
|
|
13
|
+
onShowChange?: SmartEventHandler;
|
|
14
|
+
}
|
|
15
|
+
export type SmartPopoverExternalClassName = SmartBaseExternalClassName;
|
|
16
|
+
export type SmartPopover = SmartComponent<SmartPopoverProps, SmartPopoverEvents, SmartPopoverExternalClassName>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/circle/index.js
CHANGED
|
@@ -5,13 +5,13 @@ function Circle(props) {
|
|
|
5
5
|
// @ts-ignore 属性修改,breaking change 向下兼容
|
|
6
6
|
, Object.assign({
|
|
7
7
|
// @ts-ignore 属性修改,breaking change 向下兼容
|
|
8
|
-
size: props.size,
|
|
8
|
+
size: props.size || '100px',
|
|
9
9
|
// @ts-ignore 属性修改,breaking change 向下兼容
|
|
10
|
-
trackWidth: props['stroke-width'],
|
|
10
|
+
trackWidth: props['stroke-width'] || 10,
|
|
11
11
|
// @ts-ignore 属性修改,breaking change 向下兼容
|
|
12
|
-
trackColor: props['layer-color'],
|
|
12
|
+
trackColor: props['layer-color'] || '#d3d3d3',
|
|
13
13
|
// @ts-ignore 属性修改,breaking change 向下兼容
|
|
14
|
-
fillColor: props.color,
|
|
14
|
+
fillColor: props.color || '#007AFF',
|
|
15
15
|
// @ts-ignore 属性修改,breaking change 向下兼容
|
|
16
16
|
percent: props.value, customStyle: props.style }, props)));
|
|
17
17
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -59,3 +59,4 @@ export { SmartTreeSelect, SmartTreeSelectEvents, SmartTreeSelectExternalClassNam
|
|
|
59
59
|
export { SmartCascader, SmartCascaderProps, Cascader } from './cascader';
|
|
60
60
|
export { SmartBattery, SmartBatteryProps, Battery } from './battery';
|
|
61
61
|
export { SmartCustomKeyboard, SmartCustomKeyboardProps, SmartCustomKeyboardEvents, CustomKeyboard, } from './custom-keyboard';
|
|
62
|
+
export { Popover, SmartPopoverEvents, SmartPopoverExternalClassName, SmartPopoverProps, } from './popover';
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { SmartPopover } from './PropTypes';
|
|
3
|
+
declare const Popover: import("react").FC<SmartPopover>;
|
|
4
|
+
export { Popover };
|
|
5
|
+
export { SmartPopover, SmartPopoverEvents, SmartPopoverExternalClassName, SmartPopoverProps, } from './PropTypes';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/smart-ui",
|
|
3
|
-
"version": "2.2.2-beta-
|
|
3
|
+
"version": "2.2.2-beta-7",
|
|
4
4
|
"description": "轻量、可靠的智能小程序 UI 组件库",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"syncMiniappData": "node ./build/syncMiniappData.js",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"main": "dist/index.js",
|
|
12
12
|
"files": [
|
|
13
|
-
"dist"
|
|
13
|
+
"dist",
|
|
14
|
+
"README-zh_CN.md"
|
|
14
15
|
],
|
|
15
16
|
"publishConfig": {
|
|
16
17
|
"access": "public",
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"@ray-js/components-ty-slider": "^0.3.1",
|
|
38
|
-
"@tuya-miniapp/smart-ui": "2.3.0-beta-
|
|
39
|
+
"@tuya-miniapp/smart-ui": "2.3.0-beta-9",
|
|
39
40
|
"lodash-es": "^4.17.21"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|