@nutui/nutui-react-taro 3.0.0-beta.1 → 3.0.0-beta.2

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 (40) hide show
  1. package/dist/cjs/packages/button/button.js +1 -1
  2. package/dist/cjs/packages/input/input.js +3 -5
  3. package/dist/cjs/packages/input/style/input.scss +4 -0
  4. package/dist/cjs/packages/input/style/style.css +4 -0
  5. package/dist/cjs/packages/overlay/style/style.harmony.css +5 -3
  6. package/dist/cjs/packages/pulltorefresh/pulltorefresh.js +1 -1
  7. package/dist/cjs/packages/tag/tag.d.ts +1 -1
  8. package/dist/cjs/packages/tag/tag.js +5 -11
  9. package/dist/cjs/packages/toast/style/style.css +56 -30
  10. package/dist/cjs/packages/toast/style/style.harmony.css +51 -62
  11. package/dist/cjs/packages/toast/style/toast.scss +65 -49
  12. package/dist/cjs/packages/toast/toast.d.ts +7 -7
  13. package/dist/cjs/packages/toast/toast.js +24 -19
  14. package/dist/cjs/packages/trendarrow/style/style.css +2 -1
  15. package/dist/cjs/packages/trendarrow/style/style.harmony.css +3 -2
  16. package/dist/cjs/packages/trendarrow/style/trendarrow.scss +2 -1
  17. package/dist/cjs/packages/trendarrow/trendarrow.js +6 -4
  18. package/dist/es/packages/button/button.js +1 -1
  19. package/dist/es/packages/input/input.js +3 -5
  20. package/dist/es/packages/input/style/input.scss +4 -0
  21. package/dist/es/packages/input/style/style.css +4 -0
  22. package/dist/es/packages/overlay/style/style.harmony.css +5 -3
  23. package/dist/es/packages/pulltorefresh/pulltorefresh.js +2 -2
  24. package/dist/es/packages/tag/tag.d.ts +1 -1
  25. package/dist/es/packages/tag/tag.js +6 -14
  26. package/dist/es/packages/toast/style/style.css +56 -30
  27. package/dist/es/packages/toast/style/style.harmony.css +51 -62
  28. package/dist/es/packages/toast/style/toast.scss +65 -49
  29. package/dist/es/packages/toast/toast.d.ts +15 -71
  30. package/dist/es/packages/toast/toast.js +25 -20
  31. package/dist/es/packages/trendarrow/style/style.css +2 -1
  32. package/dist/es/packages/trendarrow/style/style.harmony.css +3 -2
  33. package/dist/es/packages/trendarrow/style/trendarrow.scss +2 -1
  34. package/dist/es/packages/trendarrow/trendarrow.d.ts +11 -55
  35. package/dist/es/packages/trendarrow/trendarrow.js +6 -4
  36. package/dist/nutui.react.umd.js +315 -276
  37. package/dist/style.css +1 -1
  38. package/dist/styles/themes/default.scss +21 -21
  39. package/dist/styles/variables-jrkf.scss +21 -27
  40. package/package.json +2 -2
@@ -9,12 +9,20 @@
9
9
  }
10
10
 
11
11
  .nut-toast {
12
+ /* #ifdef rn */
13
+ position: absolute;
14
+ /* #endif */
15
+ /* #ifndef rn */
12
16
  position: fixed;
17
+ /* #endif */
13
18
  left: 0;
14
19
  top: 0;
20
+ display: flex;
21
+ flex-direction: row;
22
+ justify-content: center;
23
+ align-items: center;
15
24
  width: 100%;
16
25
  height: 100%;
17
- text-align: center;
18
26
  pointer-events: none;
19
27
  z-index: 1300;
20
28
 
@@ -23,24 +31,25 @@
23
31
  --nutui-overlay-zIndex: 1300;
24
32
  }
25
33
 
26
- &-small {
27
- .nut-toast-inner {
28
- font-size: $font-size-s;
29
- }
30
- }
31
-
32
- &-large {
33
- .nut-toast-inner {
34
- font-size: $font-size-l;
35
- }
34
+ &-overlay-default-taro {
35
+ /* #ifdef harmony */
36
+ background-color: rgba(0, 0, 0, 0);
37
+ z-index: 1300;
38
+ /* #endif */
39
+ /* #ifndef harmony */
40
+ --nutui-overlay-bg-color: rgba(0, 0, 0, 0);
41
+ --nutui-overlay-zIndex: 1300;
42
+ /* #endif */
36
43
  }
37
44
 
38
45
  &-inner {
39
- display: flex;
40
- flex-direction: column;
41
46
  position: absolute;
42
- left: 50%;
43
47
  top: $toast-inner-top;
48
+ transform: translate(-0, -50%);
49
+ display: flex;
50
+ flex-direction: column;
51
+ justify-content: center;
52
+ align-items: center;
44
53
  min-width: 30%;
45
54
  max-width: 95.7%;
46
55
  font-size: $toast-text-font-size;
@@ -50,21 +59,33 @@
50
59
  background: $toast-inner-bg-color;
51
60
  border-radius: $toast-inner-border-radius;
52
61
  color: $toast-font-color;
53
- transform: translate(-50%, -50%);
54
62
 
55
- &.normal {
63
+ &-normal {
56
64
  word-break: normal;
57
65
  word-wrap: normal;
58
66
  }
59
67
 
60
- &.break-word {
68
+ &-break-word {
61
69
  word-break: normal;
62
70
  word-wrap: break-word;
63
71
  }
72
+
73
+ &-small {
74
+ font-size: $font-size-s;
75
+ }
76
+
77
+ &-large {
78
+ font-size: $font-size-l;
79
+ }
64
80
  }
65
81
 
66
82
  &-center {
67
- top: var(--nutui-toast-inner-top, 50%);
83
+ /* #ifdef rn */
84
+ top: var(--nutui-toast-inner-top, 38%);
85
+ /* #endif */
86
+ /* #ifndef rn */
87
+ top: var(--nutui-toast-inner-top, 48%);
88
+ /* #endif */
68
89
  }
69
90
 
70
91
  &-bottom {
@@ -76,7 +97,9 @@
76
97
  }
77
98
 
78
99
  &-text {
79
- &:empty {
100
+ color: #ffffff;
101
+ text-align: $toast-inner-text-align;
102
+ &-empty {
80
103
  margin-bottom: -8px;
81
104
  }
82
105
  }
@@ -85,42 +108,36 @@
85
108
  color: #ffffff;
86
109
  font-size: $toast-title-font-size;
87
110
  font-weight: 500;
88
-
89
- &:empty {
90
- margin-bottom: -8px;
91
- }
111
+ text-align: $toast-inner-text-align;
92
112
  }
93
113
 
94
- &-has-icon {
95
- .nut-toast-icon-wrapper {
96
- width: 100%;
97
- display: flex;
98
- align-items: center;
99
- justify-content: center;
100
- margin-bottom: 8px;
101
-
102
- .nut-icon {
103
- width: 24px;
104
- height: 24px;
105
- }
106
- }
114
+ &-icon {
115
+ width: 24px;
116
+ height: 24px;
117
+ color: #ffffff;
107
118
  }
108
119
 
109
- &-loading {
110
- .nut-toast-inner {
111
- display: inline-flex;
112
- flex-direction: column;
113
- justify-content: center;
114
- align-items: center;
120
+ &-icon-wrapper {
121
+ width: 100%;
122
+ display: flex;
123
+ align-items: center;
124
+ justify-content: center;
125
+ margin-bottom: 8px;
126
+ color: #ffffff;
127
+
128
+ &-icon {
129
+ width: 24px;
130
+ height: 24px;
115
131
  }
132
+ }
116
133
 
117
- .nut-toast-icon-wrapper {
118
- animation: rotation 2s linear infinite;
134
+ &-rtl {
135
+ left: auto;
136
+ right: 0;
119
137
 
120
- .nut-icon {
121
- width: 24px;
122
- height: 24px;
123
- }
138
+ &-inner {
139
+ left: auto;
140
+ right: 50%;
124
141
  }
125
142
  }
126
143
  }
@@ -133,7 +150,6 @@
133
150
  &-inner {
134
151
  left: auto;
135
152
  right: 50%;
136
- transform: translate(50%, -50%);
137
153
  }
138
154
  }
139
155
 
@@ -5,78 +5,22 @@ export type ToastSize = 'small' | 'base' | 'large';
5
5
  export type ToastWordBreak = 'normal' | 'break-all' | 'break-word';
6
6
  export interface ToastProps extends BasicComponent {
7
7
  id?: string;
8
- maskClassName?: string;
9
- /**
10
- * 自定义内容区类名
11
- * @default -
12
- */
13
- contentClassName?: string
14
- /**
15
- * 自定义内容区样式
16
- * @default -
17
- */
18
- contentStyle?: React.CSSProperties
19
- /**
20
- * 自定义图标,对应icon组件,支持图片链接
21
- * @default -
22
- */
23
- icon: React.ReactNode
8
+ duration: number;
9
+ position?: ToastPosition;
10
+ title: string;
11
+ closeOnOverlayClick: boolean;
12
+ lockScroll: boolean;
13
+ size: ToastSize;
14
+ icon: React.ReactNode;
24
15
  iconSize: string;
25
- /**
26
- * 消息文本内容
27
- * @default -
28
- */
29
- content: React.ReactNode
30
- /**
31
- * 展示时长(秒),值为 0 时,toast 不会自动消失(loading类型默认为0)
32
- * @default 2
33
- */
34
- duration: number
35
- /**
36
- * toast展示位置
37
- * @default center
38
- */
39
- position?: ToastPosition
40
- /**
41
- * 弹框类型 可选值(text、success、fail、warn、loading)
42
- * @default -
43
- */
44
- type: string
45
- /**
46
- * 标题
47
- * @default -
48
- */
49
- title: string
50
- /**
51
- * 是否在点击遮罩层后关闭提示
52
- * @default false
53
- */
54
- closeOnOverlayClick: boolean
55
- /**
56
- * 背景是否锁定
57
- * @default false
58
- */
59
- lockScroll: boolean
60
- /**
61
- * 文案尺寸,三选一
62
- * @default base
63
- */
64
- size: ToastSize
65
- /**
66
- * 弹窗是否显示开关
67
- * @default false
68
- */
69
- visible: boolean
70
- /**
71
- * 换行截断方式
72
- * @default break-all
73
- */
74
- wordBreak?: ToastWordBreak
75
- /**
76
- * 关闭时触发的事件
77
- * @default null
78
- */
79
- onClose: () => void
16
+ maskClassName?: string;
17
+ content: React.ReactNode;
18
+ contentClassName?: string;
19
+ contentStyle?: React.CSSProperties;
20
+ type: string;
21
+ visible: boolean;
22
+ wordBreak?: ToastWordBreak;
23
+ onClose: () => void;
80
24
  /**
81
25
  * @deprecated Please use `content` prop instead.
82
26
  */
@@ -1,30 +1,31 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
2
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
3
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
5
4
  import React, { useEffect, useRef } from "react";
6
5
  import classNames from "classnames";
7
- import { View } from "@tarojs/components";
6
+ import { Text, View } from "@tarojs/components";
8
7
  import { Failure, Loading, Success, Tips } from "@nutui/icons-react-taro";
9
8
  import Overlay from "../overlay/index";
10
9
  import { ComponentDefaults } from "../../utils/typings";
11
10
  import { customEvents, useCustomEvent, useCustomEventsPath, useParams } from "../../utils/use-custom-event";
12
11
  import { usePropsValue } from "../../utils/use-props-value";
12
+ import { useRtl } from "../configprovider/index";
13
+ import { harmony } from "../../utils/platform-taro";
13
14
  import { mergeProps } from "../../utils/merge-props";
14
15
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
15
16
  id: '',
17
+ duration: 2,
18
+ position: 'center',
19
+ title: '',
20
+ size: 'base',
16
21
  icon: null,
17
22
  iconSize: '20',
18
23
  content: '',
19
24
  msg: '',
20
- duration: 2,
21
- position: 'center',
22
25
  type: 'text',
23
- title: '',
24
26
  closeOnOverlayClick: false,
25
27
  lockScroll: false,
26
28
  contentClassName: '',
27
- size: 'base',
28
29
  visible: false,
29
30
  wordBreak: 'break-all',
30
31
  onClose: function() {}
@@ -34,6 +35,7 @@ var classPrefix = 'nut-toast';
34
35
  export var Toast = function(props) {
35
36
  var _useParams = useParams(mergeProps(defaultProps, props)), _useParams_params = _useParams.params, id = _useParams_params.id, position = _useParams_params.position, contentStyle = _useParams_params.contentStyle, icon = _useParams_params.icon, iconSize = _useParams_params.iconSize, content = _useParams_params.content, msg = _useParams_params.msg, duration = _useParams_params.duration, type = _useParams_params.type, title = _useParams_params.title, closeOnOverlayClick = _useParams_params.closeOnOverlayClick, lockScroll = _useParams_params.lockScroll, contentClassName = _useParams_params.contentClassName, visible = _useParams_params.visible, size = _useParams_params.size, className = _useParams_params.className, style = _useParams_params.style, onClose = _useParams_params.onClose, wordBreak = _useParams_params.wordBreak, setParams = _useParams.setParams;
36
37
  var timer = useRef(-1);
38
+ var rtl = useRtl();
37
39
  var _usePropsValue = _sliced_to_array(usePropsValue({
38
40
  value: visible,
39
41
  defaultValue: undefined,
@@ -93,10 +95,7 @@ export var Toast = function(props) {
93
95
  }
94
96
  };
95
97
  var hasIcon = function() {
96
- if (type !== 'text') {
97
- return true;
98
- }
99
- return !!icon;
98
+ return type !== 'text' || !!icon;
100
99
  };
101
100
  var iconName = function() {
102
101
  if (icon) {
@@ -104,6 +103,7 @@ export var Toast = function(props) {
104
103
  }
105
104
  return ({
106
105
  success: /*#__PURE__*/ React.createElement(Success, {
106
+ className: "nut-toast-icon",
107
107
  color: "#ffffff",
108
108
  size: iconSize
109
109
  }),
@@ -121,13 +121,18 @@ export var Toast = function(props) {
121
121
  })
122
122
  })[type];
123
123
  };
124
- var classes = classNames(_define_property({
125
- 'nut-toast-has-icon': icon
126
- }, "nut-toast-".concat(size), true));
124
+ var classes = classNames({
125
+ 'nut-toast-has-icon': icon,
126
+ 'nut-toast-rtl': rtl
127
+ });
128
+ var styles = harmony() ? {
129
+ left: '50%',
130
+ transform: 'translate(-50%, -50%)'
131
+ } : null;
127
132
  return /*#__PURE__*/ React.createElement(React.Fragment, null, innerVisible ? /*#__PURE__*/ React.createElement(Overlay, {
128
133
  visible: innerVisible,
129
134
  style: style,
130
- className: "".concat(classPrefix, "-overlay-default ").concat(className),
135
+ className: "".concat(classPrefix, "-overlay-default-taro ").concat(className),
131
136
  closeOnOverlayClick: closeOnOverlayClick,
132
137
  lockScroll: lockScroll,
133
138
  onClick: function() {
@@ -137,14 +142,14 @@ export var Toast = function(props) {
137
142
  className: "".concat(classPrefix, " ").concat(classes),
138
143
  id: id
139
144
  }, /*#__PURE__*/ React.createElement(View, {
140
- className: "".concat(classPrefix, "-inner ").concat(classPrefix, "-").concat(position, " ").concat(contentClassName, " ").concat(wordBreak),
141
- style: contentStyle
142
- }, hasIcon() ? /*#__PURE__*/ React.createElement("p", {
145
+ className: "".concat(classPrefix, "-inner ").concat(classPrefix, "-").concat(position, " ").concat(contentClassName, " ").concat(classPrefix, "-inner-").concat(size, " ").concat(classPrefix, "-inner-").concat(wordBreak),
146
+ style: _object_spread({}, styles, contentStyle)
147
+ }, hasIcon() ? /*#__PURE__*/ React.createElement(View, {
143
148
  className: "".concat(classPrefix, "-icon-wrapper")
144
- }, iconName()) : null, title ? /*#__PURE__*/ React.createElement(View, {
149
+ }, iconName()) : null, title ? /*#__PURE__*/ React.createElement(Text, {
145
150
  className: "".concat(classPrefix, "-title")
146
- }, title) : null, /*#__PURE__*/ React.createElement("span", {
147
- className: "".concat(classPrefix, "-text")
151
+ }, title) : null, /*#__PURE__*/ React.createElement(Text, {
152
+ className: "".concat(classPrefix, "-text ").concat(content ? '' : "".concat(classPrefix, "-text-empty"))
148
153
  }, content || msg)))) : null);
149
154
  };
150
155
  export function show(selector, options) {
@@ -1,5 +1,6 @@
1
1
  .nut-trendarrow {
2
- display: inline-flex;
2
+ display: flex;
3
+ flex-direction: row;
3
4
  align-items: center;
4
5
  color: var(--nutui-color-title, #1a1a1a);
5
6
  font-size: var(--nutui-trendarrow-font-size, 14px);
@@ -1,7 +1,8 @@
1
1
  .nut-trendarrow {
2
- display: inline-flex;
2
+ display: flex;
3
+ flex-direction: row;
3
4
  align-items: center;
4
- color: #1A1A1A;
5
+ color: #1a1a1a;
5
6
  font-size: 14px;
6
7
  }
7
8
  .nut-trendarrow-icon-before {
@@ -1,5 +1,6 @@
1
1
  .nut-trendarrow {
2
- display: inline-flex;
2
+ display: flex;
3
+ flex-direction: row;
3
4
  align-items: center;
4
5
  color: $color-title;
5
6
  font-size: $trendarrow-font-size;
@@ -1,60 +1,16 @@
1
1
  import React, { FunctionComponent } from 'react';
2
2
  import { BasicComponent } from "../../utils/typings";
3
3
  export interface TrendArrowProps extends BasicComponent {
4
- /**
5
- * 数值,大于0时箭头向上,小于0时箭头向下
6
- * @default -
7
- */
8
- value: number
9
- /**
10
- * 小数位精度
11
- * @default 2
12
- */
13
- digits: number
14
- /**
15
- * 是否显示加减号
16
- * @default false
17
- */
18
- symbol: boolean
19
- /**
20
- * 是否显示 0
21
- * @default false
22
- */
23
- zero: boolean
24
- /**
25
- * 是否在数字左侧显示箭头
26
- * @default false
27
- */
28
- left: boolean
29
- /**
30
- * 文字颜色是否与箭头同步
31
- * @default true
32
- */
33
- sync: boolean
34
- /**
35
- * 文字颜色
36
- * @default #333333
37
- */
38
- color: string
39
- /**
40
- * 向上箭头颜色
41
- * @default #FF0F23
42
- */
43
- riseColor: string
44
- /**
45
- * 向下箭头颜色
46
- * @default #64b578
47
- */
48
- dropColor: string
49
- /**
50
- * 自定义向上箭头icon
51
- * @default <TriangleUp/>
52
- */
53
- riseIcon: React.ReactNode
54
- /**
55
- * 自定义向下箭头icon
56
- * @default <TriangleDown/>
57
- */
58
- dropIcon: React.ReactNode
4
+ value: number;
5
+ digits: number;
6
+ symbol: boolean;
7
+ zero: boolean;
8
+ left: boolean;
9
+ sync: boolean;
10
+ color: string;
11
+ riseColor: string;
12
+ dropColor: string;
13
+ riseIcon: React.ReactNode;
14
+ dropIcon: React.ReactNode;
59
15
  }
60
16
  export declare const TrendArrow: FunctionComponent<Partial<TrendArrowProps> & React.HTMLAttributes<HTMLDivElement>>;
@@ -3,7 +3,9 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
3
  import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
4
4
  import React, { useRef } from "react";
5
5
  import { TriangleDown, TriangleUp } from "@nutui/icons-react-taro";
6
+ import { View, Text } from "@tarojs/components";
6
7
  import { ComponentDefaults } from "../../utils/typings";
8
+ import { harmony } from "../../utils/platform-taro";
7
9
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
8
10
  value: 0,
9
11
  digits: 2,
@@ -12,8 +14,8 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
12
14
  left: false,
13
15
  sync: true,
14
16
  color: '#333',
15
- riseColor: 'var(--nutui-brand-6)',
16
- dropColor: 'var(--nutui-secondary-1)',
17
+ riseColor: harmony() ? '#ff0f23' : 'var(--nutui-brand-6)',
18
+ dropColor: harmony() ? '#14cc33' : 'var(--nutui-secondary-1)',
17
19
  riseIcon: null,
18
20
  dropIcon: null
19
21
  });
@@ -72,12 +74,12 @@ export var TrendArrow = function(props) {
72
74
  }();
73
75
  var renderContent = function(left) {
74
76
  var classNameSuffix = !left ? 'icon-after' : 'icon-before';
75
- return /*#__PURE__*/ React.createElement("span", {
77
+ return /*#__PURE__*/ React.createElement(Text, {
76
78
  className: "".concat(classPrefix, "-").concat(classNameSuffix, " ").concat(classPrefix, "-value"),
77
79
  style: calcStyle
78
80
  }, calcRate);
79
81
  };
80
- return /*#__PURE__*/ React.createElement("div", _object_spread({
82
+ return /*#__PURE__*/ React.createElement(View, _object_spread({
81
83
  className: "".concat(classPrefix, " ").concat(className),
82
84
  style: style
83
85
  }, rest), !left && renderContent(!left), Number(value) !== 0 && /*#__PURE__*/ React.createElement(React.Fragment, null, rateTrend.current ? /*#__PURE__*/ React.createElement(React.Fragment, null, riseIcon || /*#__PURE__*/ React.createElement(TriangleUp, {