@nutui/nutui-react 3.0.5 → 3.0.6

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 (94) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/dist/cjs/packages/badge/badge.js +4 -3
  3. package/dist/cjs/packages/badge/style/badge.scss +4 -0
  4. package/dist/cjs/packages/badge/style/style.css +9 -6
  5. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  6. package/dist/cjs/packages/datepicker/style/style.css +3 -0
  7. package/dist/cjs/packages/datepickerview/style/style.css +3 -0
  8. package/dist/cjs/packages/fixednav/style/style.css +9 -6
  9. package/dist/cjs/packages/indicator/indicator.js +1 -1
  10. package/dist/cjs/packages/lottie/index.d.ts +1 -1
  11. package/dist/cjs/packages/lottie/index.js +2 -2
  12. package/dist/cjs/packages/notify/Notification.d.ts +3 -9
  13. package/dist/cjs/packages/notify/Notification.js +27 -7
  14. package/dist/cjs/packages/notify/notify.d.ts +0 -4
  15. package/dist/cjs/packages/notify/notify.js +6 -34
  16. package/dist/cjs/packages/notify/style/notify.scss +39 -36
  17. package/dist/cjs/packages/notify/style/style.css +36 -31
  18. package/dist/cjs/packages/picker/style/style.css +3 -0
  19. package/dist/cjs/packages/pickerview/style/pickerview.scss +3 -0
  20. package/dist/cjs/packages/pickerview/style/style.css +3 -0
  21. package/dist/cjs/packages/skeleton/skeleton.js +64 -49
  22. package/dist/cjs/packages/skeleton/style/index.js +0 -1
  23. package/dist/cjs/packages/skeleton/style/skeleton.scss +40 -46
  24. package/dist/cjs/packages/skeleton/style/style.css +32 -175
  25. package/dist/cjs/packages/switch/style/style.css +5 -0
  26. package/dist/cjs/packages/switch/style/switch.scss +5 -0
  27. package/dist/cjs/packages/switch/switch.js +22 -11
  28. package/dist/cjs/packages/tabbar/style/style.css +54 -45
  29. package/dist/cjs/packages/tabbar/style/tabbar.scss +28 -19
  30. package/dist/cjs/packages/tabbar/tabbar.js +28 -10
  31. package/dist/cjs/packages/tabbaritem/style/style.css +30 -27
  32. package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +32 -29
  33. package/dist/cjs/packages/tabbaritem/tabbaritem.js +34 -13
  34. package/dist/cjs/types/spec/badge/base.d.ts +1 -0
  35. package/dist/cjs/types/spec/indicator/base.d.ts +1 -1
  36. package/dist/cjs/types/spec/notify/base.d.ts +7 -2
  37. package/dist/cjs/types/spec/searchbar/taro.d.ts +10 -7
  38. package/dist/cjs/types/spec/skeleton/base.d.ts +7 -5
  39. package/dist/cjs/types/spec/switch/base.d.ts +3 -2
  40. package/dist/cjs/types/spec/switch/h5.d.ts +1 -1
  41. package/dist/cjs/types/spec/switch/taro.d.ts +1 -4
  42. package/dist/cjs/types/spec/tabbar/base.d.ts +7 -4
  43. package/dist/es/packages/badge/badge.js +4 -3
  44. package/dist/es/packages/badge/style/badge.scss +4 -0
  45. package/dist/es/packages/badge/style/style.css +9 -6
  46. package/dist/es/packages/configprovider/types.d.ts +1 -1
  47. package/dist/es/packages/datepicker/style/style.css +3 -0
  48. package/dist/es/packages/datepickerview/style/style.css +3 -0
  49. package/dist/es/packages/fixednav/style/style.css +9 -6
  50. package/dist/es/packages/indicator/indicator.js +1 -1
  51. package/dist/es/packages/lottie/index.d.ts +1 -1
  52. package/dist/es/packages/lottie/index.js +1 -1
  53. package/dist/es/packages/notify/Notification.d.ts +3 -9
  54. package/dist/es/packages/notify/Notification.js +27 -7
  55. package/dist/es/packages/notify/notify.d.ts +0 -4
  56. package/dist/es/packages/notify/notify.js +6 -34
  57. package/dist/es/packages/notify/style/notify.scss +39 -36
  58. package/dist/es/packages/notify/style/style.css +36 -31
  59. package/dist/es/packages/picker/style/style.css +3 -0
  60. package/dist/es/packages/pickerview/style/pickerview.scss +3 -0
  61. package/dist/es/packages/pickerview/style/style.css +3 -0
  62. package/dist/es/packages/skeleton/skeleton.js +63 -49
  63. package/dist/es/packages/skeleton/style/index.js +0 -1
  64. package/dist/es/packages/skeleton/style/skeleton.scss +40 -46
  65. package/dist/es/packages/skeleton/style/style.css +32 -175
  66. package/dist/es/packages/switch/style/style.css +5 -0
  67. package/dist/es/packages/switch/style/switch.scss +5 -0
  68. package/dist/es/packages/switch/switch.js +21 -11
  69. package/dist/es/packages/tabbar/style/style.css +54 -45
  70. package/dist/es/packages/tabbar/style/tabbar.scss +28 -19
  71. package/dist/es/packages/tabbar/tabbar.js +27 -10
  72. package/dist/es/packages/tabbaritem/style/style.css +30 -27
  73. package/dist/es/packages/tabbaritem/style/tabbaritem.scss +32 -29
  74. package/dist/es/packages/tabbaritem/tabbaritem.js +34 -13
  75. package/dist/es/types/spec/badge/base.d.ts +4 -0
  76. package/dist/es/types/spec/indicator/base.d.ts +1 -1
  77. package/dist/es/types/spec/notify/base.d.ts +22 -5
  78. package/dist/es/types/spec/searchbar/taro.d.ts +10 -7
  79. package/dist/es/types/spec/skeleton/base.d.ts +19 -14
  80. package/dist/es/types/spec/switch/base.d.ts +6 -2
  81. package/dist/es/types/spec/switch/h5.d.ts +1 -1
  82. package/dist/es/types/spec/switch/taro.d.ts +1 -4
  83. package/dist/es/types/spec/tabbar/base.d.ts +7 -4
  84. package/dist/nutui.react.umd.js +334 -284
  85. package/dist/style.css +1 -1
  86. package/dist/style.scss +45 -45
  87. package/dist/styles/variables-jmapp.scss +23 -1
  88. package/dist/styles/variables-jrkf.scss +23 -1
  89. package/dist/styles/variables.scss +35 -37
  90. package/package.json +1 -1
  91. /package/dist/cjs/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
  92. /package/dist/cjs/packages/lottie/{web.js → lottie.js} +0 -0
  93. /package/dist/es/packages/lottie/{web.d.ts → lottie.d.ts} +0 -0
  94. /package/dist/es/packages/lottie/{web.js → lottie.js} +0 -0
@@ -9,28 +9,32 @@ Object.defineProperty(exports, "Switch", {
9
9
  }
10
10
  });
11
11
  var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
+ var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
13
  var _define_property = require("@swc/helpers/_/_define_property");
13
14
  var _object_spread = require("@swc/helpers/_/_object_spread");
14
15
  var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
15
16
  var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
16
17
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
17
- var _react = /*#__PURE__*/ _interop_require_default._(require("react"));
18
+ var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
18
19
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
20
+ var _iconsreact = require("@nutui/icons-react");
19
21
  var _typings = require("../../utils/typings");
20
22
  var _usepropsvalue = require("../../hooks/use-props-value");
21
23
  var _configprovider = require("../configprovider");
22
24
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
23
25
  disabled: false,
24
26
  activeText: '',
25
- inactiveText: ''
27
+ inactiveText: '',
28
+ loadingIcon: /*#__PURE__*/ _react.default.createElement(_iconsreact.Loading1, null)
26
29
  });
27
30
  var Switch = function Switch(props) {
28
- var _ref = (0, _object_spread._)({}, defaultProps, props), checked = _ref.checked, defaultChecked = _ref.defaultChecked, disabled = _ref.disabled, activeText = _ref.activeText, inactiveText = _ref.inactiveText, className = _ref.className, style = _ref.style, onChange = _ref.onChange, rest = (0, _object_without_properties._)(_ref, [
31
+ var _ref = (0, _object_spread._)({}, defaultProps, props), checked = _ref.checked, defaultChecked = _ref.defaultChecked, disabled = _ref.disabled, activeText = _ref.activeText, inactiveText = _ref.inactiveText, loadingIcon = _ref.loadingIcon, className = _ref.className, style = _ref.style, onChange = _ref.onChange, rest = (0, _object_without_properties._)(_ref, [
29
32
  "checked",
30
33
  "defaultChecked",
31
34
  "disabled",
32
35
  "activeText",
33
36
  "inactiveText",
37
+ "loadingIcon",
34
38
  "className",
35
39
  "style",
36
40
  "onChange"
@@ -41,6 +45,12 @@ var Switch = function Switch(props) {
41
45
  value: checked,
42
46
  defaultValue: defaultChecked
43
47
  }), 2), value = _usePropsValue[0], setValue = _usePropsValue[1];
48
+ (0, _react.useEffect)(function() {
49
+ changing && setChanging(false);
50
+ }, [
51
+ value
52
+ ]);
53
+ var _useState = (0, _sliced_to_array._)((0, _react.useState)(false), 2), changing = _useState[0], setChanging = _useState[1];
44
54
  var classes = function classes() {
45
55
  var _obj;
46
56
  return (0, _classnames.default)([
@@ -49,17 +59,18 @@ var Switch = function Switch(props) {
49
59
  (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-close"), !value), (0, _define_property._)(_obj, "".concat(classPrefix, "-disabled"), disabled), (0, _define_property._)(_obj, "".concat(classPrefix, "-disabled-close"), disabled && !value), _obj)
50
60
  ]);
51
61
  };
52
- var onClick = function onClick(event) {
53
- if (disabled) return;
54
- onChange && onChange(!value, event);
62
+ var onClick = function onClick() {
63
+ if (disabled || changing) return;
64
+ if (props.onChange) {
65
+ setChanging(true);
66
+ props.onChange(!value);
67
+ }
55
68
  setValue(!value);
56
69
  };
57
70
  var _obj, _obj1;
58
71
  return /*#__PURE__*/ _react.default.createElement("div", (0, _object_spread._)({
59
72
  className: classes(),
60
- onClick: function onClick1(e) {
61
- return onClick(e);
62
- },
73
+ onClick: onClick,
63
74
  style: style
64
75
  }, rest), /*#__PURE__*/ _react.default.createElement("div", {
65
76
  className: (0, _classnames.default)([
@@ -71,9 +82,9 @@ var Switch = function Switch(props) {
71
82
  ],
72
83
  (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-button-open-rtl"), rtl && value), (0, _define_property._)(_obj, "".concat(classPrefix, "-button-close-rtl"), rtl && !value), _obj)
73
84
  ])
74
- }, !value && !activeText && /*#__PURE__*/ _react.default.createElement("div", {
85
+ }, changing && loadingIcon ? /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, loadingIcon) : /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, !value && !activeText && /*#__PURE__*/ _react.default.createElement("div", {
75
86
  className: "".concat(classPrefix, "-close-line")
76
- })), activeText && /*#__PURE__*/ _react.default.createElement("div", {
87
+ }))), activeText && /*#__PURE__*/ _react.default.createElement("div", {
77
88
  className: (0, _classnames.default)("".concat(classPrefix, "-label"), (_obj1 = {}, (0, _define_property._)(_obj1, "".concat(classPrefix, "-label-open"), value), (0, _define_property._)(_obj1, "".concat(classPrefix, "-label-close"), !value), (0, _define_property._)(_obj1, "".concat(classPrefix, "-label-open-rtl"), rtl && value), (0, _define_property._)(_obj1, "".concat(classPrefix, "-label-close-rtl"), rtl && !value), (0, _define_property._)(_obj1, "".concat(classPrefix, "-label-close-disabled"), disabled && !value), _obj1))
78
89
  }, value ? activeText : inactiveText));
79
90
  };
@@ -52,6 +52,9 @@
52
52
  background: var(--nutui-badge-background-color, var(--nutui-color-primary, #ff0f23));
53
53
  z-index: 1;
54
54
  }
55
+ .nut-badge-disabled {
56
+ background: var(--nutui-badge-background-disabled-color, var(--nutui-color-text-disabled, #c2c4cc));
57
+ }
55
58
  .nut-badge-number {
56
59
  font-family: "JD";
57
60
  }
@@ -77,14 +80,14 @@
77
80
  height: var(--nutui-badge-dot-width, 6px);
78
81
  }
79
82
  .nut-badge-dot-small {
80
- min-width: var(--nutui-badge-dot-width, 4px);
81
- width: var(--nutui-badge-dot-width, 4px);
82
- height: var(--nutui-badge-dot-width, 4px);
83
+ min-width: var(--nutui-badge-dot-small-width, 4px);
84
+ width: var(--nutui-badge-dot-small-width, 4px);
85
+ height: var(--nutui-badge-dot-small-width, 4px);
83
86
  }
84
87
  .nut-badge-dot-large {
85
- min-width: var(--nutui-badge-dot-width, 8px);
86
- width: var(--nutui-badge-dot-width, 8px);
87
- height: var(--nutui-badge-dot-width, 8px);
88
+ min-width: var(--nutui-badge-dot-large-width, 8px);
89
+ width: var(--nutui-badge-dot-large-width, 8px);
90
+ height: var(--nutui-badge-dot-large-width, 8px);
88
91
  }
89
92
  .nut-badge-outline {
90
93
  background: #ffffff;
@@ -97,25 +100,16 @@
97
100
  .nut-tabbar-item {
98
101
  display: flex;
99
102
  flex-direction: column;
100
- justify-content: center;
101
103
  align-items: center;
102
104
  flex: 1;
103
- text-align: center;
104
- text-decoration: none;
105
+ padding: 6px 0 2px;
105
106
  color: var(--nutui-tabbar-inactive-color, var(--nutui-color-title, #1a1a1a));
106
107
  height: 100%;
107
108
  }
108
- .nut-tabbar-item-icon-box {
109
- padding: 0px;
110
- display: flex;
111
- flex-direction: column;
112
- align-items: center;
113
- position: relative;
114
- }
115
- .nut-tabbar-item-icon-box .nut-icon {
116
- width: 22px;
117
- height: 22px;
118
- font-size: 22px;
109
+ .nut-tabbar-item .nut-icon {
110
+ width: 24px;
111
+ height: 24px;
112
+ font-size: 24px;
119
113
  /* #ifdef harmony*/
120
114
  color: var(--nutui-tabbar-inactive-color, var(--nutui-color-title, #1a1a1a));
121
115
  /* #endif*/
@@ -123,23 +117,32 @@
123
117
  color: inherit;
124
118
  /* #endif*/
125
119
  }
126
- .nut-tabbar-item-icon-box-nav {
120
+ .nut-tabbar-item-text {
127
121
  display: block;
128
122
  color: var(--nutui-color-text, #505259);
129
- font-size: var(--nutui-tabbar-text-font-size, var(--nutui-font-size-xs, 11px));
130
- line-height: var(--nutui-tabbar-text-font-size, var(--nutui-font-size-xs, 11px));
131
- margin-top: var(--nutui-tabbar-text-margin-top, 3px);
123
+ font-size: var(--nutui-tabbar-text-font-size, var(--nutui-font-size-xxs, 10px));
124
+ line-height: var(--nutui-tabbar-text-font-size, var(--nutui-font-size-xxs, 10px));
125
+ margin-top: var(--nutui-tabbar-text-margin-top, 4px);
132
126
  }
133
- .nut-tabbar-item-icon-box-large {
127
+ .nut-tabbar-item .nut-image-default {
128
+ width: 38px;
129
+ height: 38px;
130
+ border-radius: 38px;
131
+ }
132
+ .nut-tabbar-item-large {
133
+ justify-content: center;
134
+ padding: 0;
135
+ }
136
+ .nut-tabbar-item-large .nut-tabbar-item-text {
134
137
  font-size: var(--nutui-tabbar-text-large-font-size, var(--nutui-font-size-l, 16px));
135
138
  margin-top: 0;
136
- line-height: var(--nutui-tabbar-text-line-height, 20px);
139
+ line-height: var(--nutui-tabbar-text-large-font-size, var(--nutui-font-size-l, 16px));
137
140
  font-weight: var(--nutui-tabbar-text-large-font-weight, var(--nutui-font-weight, 400));
138
141
  }
139
142
  .nut-tabbar-item-active {
140
143
  color: var(--nutui-tabbar-active-color, var(--nutui-color-primary, #ff0f23));
141
144
  }
142
- .nut-tabbar-item-active .nut-tabbar-item-icon-box,
145
+ .nut-tabbar-item-active .nut-tabbar-item-text,
143
146
  .nut-tabbar-item-active .nut-icon {
144
147
  /* #ifdef harmony*/
145
148
  color: var(--nutui-tabbar-active-color, var(--nutui-color-primary, #ff0f23));
@@ -152,38 +155,44 @@
152
155
  .nut-tabbar {
153
156
  border: 0px;
154
157
  box-shadow: var(--nutui-tabbar-box-shadow, none);
155
- border-bottom: var(--nutui-tabbar-border-bottom, 1px solid #eee);
156
- border-top: var(--nutui-tabbar-border-top, 1px solid #eee);
158
+ border-bottom: var(--nutui-tabbar-border-bottom, 0);
159
+ border-top: var(--nutui-tabbar-border-top, 0);
157
160
  width: 100%;
158
- display: flex;
159
- flex-direction: column;
160
- justify-content: center;
161
- align-items: center;
162
- box-sizing: border-box;
163
161
  background: var(--nutui-color-background-overlay, #ffffff);
164
162
  }
165
163
  .nut-tabbar-wrap {
166
- width: 100%;
167
- height: var(--nutui-tabbar-height, 50px);
164
+ height: var(--nutui-tabbar-height, 46px);
168
165
  display: flex;
166
+ }
167
+ .nut-tabbar-wrap-3 {
168
+ padding: 0 16px;
169
+ }
170
+ .nut-tabbar-wrap-2 {
171
+ padding: 0 32px;
172
+ }
173
+ .nut-tabbar-wrap-horizontal {
174
+ align-items: center;
175
+ }
176
+ .nut-tabbar-wrap-horizontal .nut-tabbar-item {
169
177
  flex-direction: row;
170
178
  justify-content: center;
171
- align-items: center;
172
179
  }
173
- .nut-tabbar:last-child {
174
- border-right: 0;
180
+ .nut-tabbar-wrap-horizontal .nut-tabbar-item .nut-icon {
181
+ width: 20px;
182
+ height: 20px;
183
+ }
184
+ .nut-tabbar-wrap-horizontal .nut-tabbar-item .nut-tabbar-item-text {
185
+ margin: 0 4px 0 6px;
186
+ font-size: 14px;
187
+ }
188
+ .nut-tabbar-wrap-horizontal .nut-tabbar-item .nut-badge-sup::after {
189
+ border: 0;
175
190
  }
176
191
  .nut-tabbar-fixed {
177
192
  position: fixed;
178
193
  bottom: 0px;
179
194
  left: 0px;
180
195
  }
181
- .nut-tabbar-safe-area {
182
- display: block;
183
- width: 100%;
184
- padding-bottom: constant(safe-area-inset-bottom);
185
- padding-bottom: env(safe-area-inset-bottom);
186
- }
187
196
 
188
197
  [dir=rtl] .nut-tabbar:last-child,
189
198
  .nut-rtl .nut-tabbar:last-child {
@@ -4,24 +4,40 @@
4
4
  border-bottom: $tabbar-border-bottom;
5
5
  border-top: $tabbar-border-top;
6
6
  width: 100%;
7
- display: flex;
8
- flex-direction: column;
9
- justify-content: center;
10
- align-items: center;
11
- box-sizing: border-box;
12
7
  background: $color-background-overlay;
13
8
 
14
9
  &-wrap {
15
- width: 100%;
16
10
  height: $tabbar-height;
17
11
  display: flex;
18
- flex-direction: row;
19
- justify-content: center;
20
- align-items: center;
21
- }
22
12
 
23
- &:last-child {
24
- border-right: 0;
13
+ &-3 {
14
+ padding: 0 16px;
15
+ }
16
+
17
+ &-2 {
18
+ padding: 0 32px;
19
+ }
20
+
21
+ &-horizontal {
22
+ align-items: center;
23
+ .nut-tabbar-item {
24
+ flex-direction: row;
25
+ justify-content: center;
26
+ .nut-icon {
27
+ width: 20px;
28
+ height: 20px;
29
+ }
30
+ .nut-tabbar-item-text {
31
+ margin: 0 4px 0 6px;
32
+ font-size: 14px;
33
+ }
34
+ .nut-badge-sup {
35
+ &::after {
36
+ border: 0;
37
+ }
38
+ }
39
+ }
40
+ }
25
41
  }
26
42
 
27
43
  &-fixed {
@@ -29,13 +45,6 @@
29
45
  bottom: 0px;
30
46
  left: 0px;
31
47
  }
32
-
33
- &-safe-area {
34
- display: block;
35
- width: 100%;
36
- padding-bottom: constant(safe-area-inset-bottom);
37
- padding-bottom: env(safe-area-inset-bottom);
38
- }
39
48
  }
40
49
 
41
50
  [dir='rtl'] .nut-tabbar,
@@ -9,26 +9,29 @@ Object.defineProperty(exports, "Tabbar", {
9
9
  }
10
10
  });
11
11
  var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
+ var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
13
  var _define_property = require("@swc/helpers/_/_define_property");
13
14
  var _object_spread = require("@swc/helpers/_/_object_spread");
14
15
  var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
15
16
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
16
- var _react = /*#__PURE__*/ _interop_require_default._(require("react"));
17
+ var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
17
18
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
18
19
  var _typings = require("../../utils/typings");
19
20
  var _usepropsvalue = require("../../hooks/use-props-value");
20
21
  var _tabbaritem = /*#__PURE__*/ _interop_require_default._(require("../tabbaritem"));
21
22
  var _context = /*#__PURE__*/ _interop_require_default._(require("./context"));
23
+ var _index = /*#__PURE__*/ _interop_require_default._(require("../safearea/index"));
22
24
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
23
25
  defaultValue: 0,
24
26
  fixed: false,
25
27
  inactiveColor: '',
26
28
  activeColor: '',
29
+ direction: 'vertical',
27
30
  safeArea: false,
28
- onSwitch: function onSwitch(value) {}
31
+ onSwitch: function onSwitch() {}
29
32
  });
30
33
  var Tabbar = function Tabbar(props) {
31
- var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), children = _$_object_spread.children, defaultValue = _$_object_spread.defaultValue, value = _$_object_spread.value, fixed = _$_object_spread.fixed, activeColor = _$_object_spread.activeColor, inactiveColor = _$_object_spread.inactiveColor, safeArea = _$_object_spread.safeArea, className = _$_object_spread.className, style = _$_object_spread.style, onSwitch = _$_object_spread.onSwitch;
34
+ var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), children = _$_object_spread.children, defaultValue = _$_object_spread.defaultValue, value = _$_object_spread.value, fixed = _$_object_spread.fixed, activeColor = _$_object_spread.activeColor, inactiveColor = _$_object_spread.inactiveColor, direction = _$_object_spread.direction, safeArea = _$_object_spread.safeArea, className = _$_object_spread.className, style = _$_object_spread.style, onSwitch = _$_object_spread.onSwitch;
32
35
  var classPrefix = 'nut-tabbar';
33
36
  var _usePropsValue = (0, _sliced_to_array._)((0, _usepropsvalue.usePropsValue)({
34
37
  value: value,
@@ -36,11 +39,26 @@ var Tabbar = function Tabbar(props) {
36
39
  finalValue: 0,
37
40
  onChange: onSwitch
38
41
  }), 2), selectIndex = _usePropsValue[0], setSelectIndex = _usePropsValue[1];
42
+ var sizeCls = (0, _react.useMemo)(function() {
43
+ var size = _react.default.Children.count(children);
44
+ var _obj;
45
+ return size > 3 ? '' : (0, _classnames.default)((_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-wrap-3"), size === 3), (0, _define_property._)(_obj, "".concat(classPrefix, "-wrap-2"), size === 2), (0, _define_property._)(_obj, "".concat(classPrefix, "-wrap-").concat(direction), size === 2 && direction !== 'vertical'), _obj));
46
+ }, [
47
+ children,
48
+ direction
49
+ ]);
50
+ var itemDirection = (0, _react.useMemo)(function() {
51
+ var size = _react.default.Children.count(children);
52
+ return size === 2 && direction !== 'vertical' && direction;
53
+ }, [
54
+ direction,
55
+ children
56
+ ]);
39
57
  return /*#__PURE__*/ _react.default.createElement("div", {
40
58
  className: (0, _classnames.default)(classPrefix, (0, _define_property._)({}, "".concat(classPrefix, "-fixed"), fixed), className),
41
59
  style: style
42
60
  }, /*#__PURE__*/ _react.default.createElement("div", {
43
- className: "".concat(classPrefix, "-wrap")
61
+ className: "".concat(classPrefix, "-wrap ").concat(sizeCls)
44
62
  }, /*#__PURE__*/ _react.default.createElement(_context.default.Provider, {
45
63
  value: {
46
64
  selectIndex: selectIndex,
@@ -49,12 +67,12 @@ var Tabbar = function Tabbar(props) {
49
67
  handleClick: setSelectIndex
50
68
  }
51
69
  }, _react.default.Children.map(children, function(child, index) {
52
- if (!/*#__PURE__*/ _react.default.isValidElement(child)) return null;
53
- return /*#__PURE__*/ _react.default.cloneElement(child, (0, _object_spread_props._)((0, _object_spread._)({}, child.props), {
54
- index: index
55
- }));
56
- }))), (fixed || safeArea) && /*#__PURE__*/ _react.default.createElement("div", {
57
- className: "".concat(classPrefix, "-safe-area")
70
+ return /*#__PURE__*/ _react.default.isValidElement(child) ? /*#__PURE__*/ _react.default.cloneElement(child, (0, _object_spread_props._)((0, _object_spread._)({}, child.props), {
71
+ index: index,
72
+ direction: itemDirection
73
+ })) : null;
74
+ }))), (fixed || safeArea) && /*#__PURE__*/ _react.default.createElement(_index.default, {
75
+ position: "bottom"
58
76
  }));
59
77
  };
60
78
  Tabbar.displayName = 'NutTabbar';
@@ -52,6 +52,9 @@
52
52
  background: var(--nutui-badge-background-color, var(--nutui-color-primary, #ff0f23));
53
53
  z-index: 1;
54
54
  }
55
+ .nut-badge-disabled {
56
+ background: var(--nutui-badge-background-disabled-color, var(--nutui-color-text-disabled, #c2c4cc));
57
+ }
55
58
  .nut-badge-number {
56
59
  font-family: "JD";
57
60
  }
@@ -77,14 +80,14 @@
77
80
  height: var(--nutui-badge-dot-width, 6px);
78
81
  }
79
82
  .nut-badge-dot-small {
80
- min-width: var(--nutui-badge-dot-width, 4px);
81
- width: var(--nutui-badge-dot-width, 4px);
82
- height: var(--nutui-badge-dot-width, 4px);
83
+ min-width: var(--nutui-badge-dot-small-width, 4px);
84
+ width: var(--nutui-badge-dot-small-width, 4px);
85
+ height: var(--nutui-badge-dot-small-width, 4px);
83
86
  }
84
87
  .nut-badge-dot-large {
85
- min-width: var(--nutui-badge-dot-width, 8px);
86
- width: var(--nutui-badge-dot-width, 8px);
87
- height: var(--nutui-badge-dot-width, 8px);
88
+ min-width: var(--nutui-badge-dot-large-width, 8px);
89
+ width: var(--nutui-badge-dot-large-width, 8px);
90
+ height: var(--nutui-badge-dot-large-width, 8px);
88
91
  }
89
92
  .nut-badge-outline {
90
93
  background: #ffffff;
@@ -97,25 +100,16 @@
97
100
  .nut-tabbar-item {
98
101
  display: flex;
99
102
  flex-direction: column;
100
- justify-content: center;
101
103
  align-items: center;
102
104
  flex: 1;
103
- text-align: center;
104
- text-decoration: none;
105
+ padding: 6px 0 2px;
105
106
  color: var(--nutui-tabbar-inactive-color, var(--nutui-color-title, #1a1a1a));
106
107
  height: 100%;
107
108
  }
108
- .nut-tabbar-item-icon-box {
109
- padding: 0px;
110
- display: flex;
111
- flex-direction: column;
112
- align-items: center;
113
- position: relative;
114
- }
115
- .nut-tabbar-item-icon-box .nut-icon {
116
- width: 22px;
117
- height: 22px;
118
- font-size: 22px;
109
+ .nut-tabbar-item .nut-icon {
110
+ width: 24px;
111
+ height: 24px;
112
+ font-size: 24px;
119
113
  /* #ifdef harmony*/
120
114
  color: var(--nutui-tabbar-inactive-color, var(--nutui-color-title, #1a1a1a));
121
115
  /* #endif*/
@@ -123,23 +117,32 @@
123
117
  color: inherit;
124
118
  /* #endif*/
125
119
  }
126
- .nut-tabbar-item-icon-box-nav {
120
+ .nut-tabbar-item-text {
127
121
  display: block;
128
122
  color: var(--nutui-color-text, #505259);
129
- font-size: var(--nutui-tabbar-text-font-size, var(--nutui-font-size-xs, 11px));
130
- line-height: var(--nutui-tabbar-text-font-size, var(--nutui-font-size-xs, 11px));
131
- margin-top: var(--nutui-tabbar-text-margin-top, 3px);
123
+ font-size: var(--nutui-tabbar-text-font-size, var(--nutui-font-size-xxs, 10px));
124
+ line-height: var(--nutui-tabbar-text-font-size, var(--nutui-font-size-xxs, 10px));
125
+ margin-top: var(--nutui-tabbar-text-margin-top, 4px);
126
+ }
127
+ .nut-tabbar-item .nut-image-default {
128
+ width: 38px;
129
+ height: 38px;
130
+ border-radius: 38px;
131
+ }
132
+ .nut-tabbar-item-large {
133
+ justify-content: center;
134
+ padding: 0;
132
135
  }
133
- .nut-tabbar-item-icon-box-large {
136
+ .nut-tabbar-item-large .nut-tabbar-item-text {
134
137
  font-size: var(--nutui-tabbar-text-large-font-size, var(--nutui-font-size-l, 16px));
135
138
  margin-top: 0;
136
- line-height: var(--nutui-tabbar-text-line-height, 20px);
139
+ line-height: var(--nutui-tabbar-text-large-font-size, var(--nutui-font-size-l, 16px));
137
140
  font-weight: var(--nutui-tabbar-text-large-font-weight, var(--nutui-font-weight, 400));
138
141
  }
139
142
  .nut-tabbar-item-active {
140
143
  color: var(--nutui-tabbar-active-color, var(--nutui-color-primary, #ff0f23));
141
144
  }
142
- .nut-tabbar-item-active .nut-tabbar-item-icon-box,
145
+ .nut-tabbar-item-active .nut-tabbar-item-text,
143
146
  .nut-tabbar-item-active .nut-icon {
144
147
  /* #ifdef harmony*/
145
148
  color: var(--nutui-tabbar-active-color, var(--nutui-color-primary, #ff0f23));
@@ -1,45 +1,48 @@
1
1
  .nut-tabbar-item {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- justify-content: center;
5
4
  align-items: center;
6
5
  flex: 1;
7
- text-align: center;
8
- text-decoration: none;
6
+ padding: 6px 0 2px;
9
7
  color: $tabbar-inactive-color;
10
8
  height: 100%;
11
9
 
12
- &-icon-box {
13
- padding: 0px;
14
- display: flex;
15
- flex-direction: column;
16
- align-items: center;
17
- position: relative;
10
+ .nut-icon {
11
+ width: 24px;
12
+ height: 24px;
13
+ font-size: 24px;
14
+ /* #ifdef harmony*/
15
+ color: $tabbar-inactive-color;
16
+ /* #endif*/
17
+ /* #ifndef harmony*/
18
+ color: inherit;
19
+ /* #endif*/
20
+ }
18
21
 
19
- .nut-icon {
20
- width: 22px;
21
- height: 22px;
22
- font-size: 22px;
23
- /* #ifdef harmony*/
24
- color: $tabbar-inactive-color;
25
- /* #endif*/
26
- /* #ifndef harmony*/
27
- color: inherit;
28
- /* #endif*/
29
- }
22
+ &-text {
23
+ display: block;
24
+ color: $color-text;
25
+ font-size: $tabbar-text-font-size;
26
+ line-height: $tabbar-text-font-size;
27
+ margin-top: $tabbar-text-margin-top;
28
+ }
30
29
 
31
- &-nav {
32
- display: block;
33
- color: $color-text;
34
- font-size: $tabbar-text-font-size;
35
- line-height: $tabbar-text-font-size;
36
- margin-top: $tabbar-text-margin-top;
30
+ .nut-image {
31
+ &-default {
32
+ width: 38px;
33
+ height: 38px;
34
+ border-radius: 38px;
37
35
  }
36
+ }
37
+
38
+ &-large {
39
+ justify-content: center;
40
+ padding: 0;
38
41
 
39
- &-large {
42
+ .nut-tabbar-item-text {
40
43
  font-size: $tabbar-text-large-font-size;
41
44
  margin-top: 0;
42
- line-height: $tabbar-text-line-height;
45
+ line-height: $tabbar-text-large-font-size;
43
46
  font-weight: $tabbar-text-large-font-weight;
44
47
  }
45
48
  }
@@ -47,7 +50,7 @@
47
50
  &-active {
48
51
  color: $tabbar-active-color;
49
52
 
50
- .nut-tabbar-item-icon-box,
53
+ .nut-tabbar-item-text,
51
54
  .nut-icon {
52
55
  /* #ifdef harmony*/
53
56
  color: $tabbar-active-color;
@@ -26,11 +26,12 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
26
26
  dot: false,
27
27
  max: 99,
28
28
  top: '0',
29
- right: '0'
29
+ right: '0',
30
+ direction: 'vertical'
30
31
  });
31
32
  var TabbarItem = function TabbarItem(props) {
32
33
  var ctx = (0, _react.useContext)(_context.default);
33
- var _ref = (0, _object_spread._)({}, defaultProps, props), className = _ref.className, style = _ref.style, title = _ref.title, icon = _ref.icon, value = _ref.value, dot = _ref.dot, max = _ref.max, top = _ref.top, right = _ref.right, index = _ref.index, rest = (0, _object_without_properties._)(_ref, [
34
+ var _ref = (0, _object_spread._)({}, defaultProps, props), className = _ref.className, style = _ref.style, title = _ref.title, icon = _ref.icon, value = _ref.value, dot = _ref.dot, max = _ref.max, top = _ref.top, right = _ref.right, index = _ref.index, direction = _ref.direction, onActiveClick = _ref.onActiveClick, rest = (0, _object_without_properties._)(_ref, [
34
35
  "className",
35
36
  "style",
36
37
  "title",
@@ -40,15 +41,19 @@ var TabbarItem = function TabbarItem(props) {
40
41
  "max",
41
42
  "top",
42
43
  "right",
43
- "index"
44
+ "index",
45
+ "direction",
46
+ "onActiveClick"
44
47
  ]);
45
48
  var active = index === (ctx === null || ctx === void 0 ? void 0 : ctx.selectIndex);
46
49
  var classPrefix = 'nut-tabbar-item';
47
- var tabbarItemClass = (0, _classnames.default)(classPrefix, (0, _define_property._)({}, "".concat(classPrefix, "-active"), active), className);
48
- var boxPrefix = "".concat(classPrefix, "-icon-box");
49
- var titleClass = (0, _classnames.default)(boxPrefix, "".concat(boxPrefix, "-nav"), (0, _define_property._)({}, "".concat(boxPrefix, "-large"), !icon));
50
+ var _obj;
51
+ var tabbarItemClass = (0, _classnames.default)(classPrefix, (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-active"), active), (0, _define_property._)(_obj, "".concat(classPrefix, "-large"), !icon || !title), _obj), className);
52
+ var renderNodeWithActive = function renderNodeWithActive(node) {
53
+ return node && typeof node === 'function' ? node(active) : node;
54
+ };
50
55
  var badgeProps = {
51
- value: value,
56
+ value: renderNodeWithActive(value),
52
57
  dot: dot,
53
58
  max: max,
54
59
  top: top,
@@ -57,8 +62,26 @@ var TabbarItem = function TabbarItem(props) {
57
62
  };
58
63
  var renderTitleText = function renderTitleText() {
59
64
  return title && /*#__PURE__*/ _react.default.createElement("div", {
60
- className: titleClass
61
- }, title);
65
+ className: "".concat(classPrefix, "-text")
66
+ }, renderNodeWithActive(title));
67
+ };
68
+ var renderTitle = function renderTitle() {
69
+ return /*#__PURE__*/ _react.default.createElement(_index.default, (0, _object_spread._)({
70
+ size: "normal"
71
+ }, badgeProps), renderTitleText());
72
+ };
73
+ var renderIcon = function renderIcon() {
74
+ return renderNodeWithActive(icon);
75
+ };
76
+ var renderIconAndTitle = function renderIconAndTitle() {
77
+ return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_index.default, (0, _object_spread_props._)((0, _object_spread._)({
78
+ size: "normal"
79
+ }, badgeProps), {
80
+ top: 3
81
+ }), renderIcon()), renderTitleText());
82
+ };
83
+ var renderDualItem = function renderDualItem() {
84
+ return dot ? null : /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, renderIcon(), renderTitleText(), /*#__PURE__*/ _react.default.createElement(_index.default, badgeProps));
62
85
  };
63
86
  return /*#__PURE__*/ _react.default.createElement("div", (0, _object_spread._)({
64
87
  className: tabbarItemClass,
@@ -66,9 +89,7 @@ var TabbarItem = function TabbarItem(props) {
66
89
  color: active ? ctx === null || ctx === void 0 ? void 0 : ctx.activeColor : ctx === null || ctx === void 0 ? void 0 : ctx.inactiveColor
67
90
  }, style),
68
91
  onClick: function onClick() {
69
- return ctx === null || ctx === void 0 ? void 0 : ctx.handleClick(index);
92
+ return active ? onActiveClick === null || onActiveClick === void 0 ? void 0 : onActiveClick() : ctx === null || ctx === void 0 ? void 0 : ctx.handleClick(index);
70
93
  }
71
- }, rest), icon ? /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_index.default, badgeProps, /*#__PURE__*/ _react.default.createElement("div", {
72
- className: boxPrefix
73
- }, icon)), renderTitleText()) : /*#__PURE__*/ _react.default.createElement(_index.default, badgeProps, renderTitleText()));
94
+ }, rest), direction === 'horizontal' && !dot ? renderDualItem() : /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, icon && renderIconAndTitle(), !icon && renderTitle()));
74
95
  };