@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
@@ -2,176 +2,30 @@
2
2
  /* #endif */
3
3
  /* #ifndef harmony */
4
4
  /* #endif */
5
- .nut-image {
6
- display: block;
7
- position: relative;
8
- }
9
- .nut-image-default {
10
- display: block;
11
- width: 100%;
12
- height: 100%;
13
- }
14
- .nut-image.nut-image-round {
15
- border-radius: 50%;
16
- overflow: hidden;
17
- }
18
- .nut-image-loading {
19
- width: 100%;
20
- height: 100%;
21
- position: absolute;
22
- top: 0;
23
- left: 0;
24
- display: flex;
25
- flex-direction: column;
26
- align-items: center;
27
- justify-content: center;
28
- background: var(--nutui-color-background, #f2f3f5);
29
- background-size: 100% 100%;
30
- }
31
- .nut-image-error {
32
- width: 100%;
33
- height: 100%;
34
- position: absolute;
35
- top: 0;
36
- left: 0;
37
- display: flex;
38
- flex-direction: column;
39
- align-items: center;
40
- justify-content: center;
41
- background: var(--nutui-color-background, #f2f3f5);
42
- background-size: 100% 100%;
43
- }
44
-
45
- [dir=rtl] .nut-image .nut-img-loading,
46
- .nut-rtl .nut-image .nut-img-loading {
47
- left: auto;
48
- right: 0;
49
- }
50
- [dir=rtl] .nut-image .nut-img-error,
51
- .nut-rtl .nut-image .nut-img-error {
52
- left: auto;
53
- right: 0;
54
- }
55
-
56
- .nut-avatar-group {
57
- display: flex;
58
- flex-direction: row;
59
- flex: 0 0 auto;
60
- }
61
- .nut-avatar-group-avatar,
62
- .nut-avatar-group .nut-avatar {
63
- border: 1px solid #fff;
64
- margin-left: -8px;
65
- }
66
- .nut-avatar-group-avatar:not(:first-of-type),
67
- .nut-avatar-group .nut-avatar:not(:first-of-type) {
68
- margin-left: -8px;
69
- }
70
-
71
- [dir=rtl] .nut-avatar-group .nut-avatar:not(:first-of-type),
72
- .nut-rtl .nut-avatar-group .nut-avatar:not(:first-of-type) {
73
- margin-left: 0;
74
- margin-right: -8px;
75
- }
76
-
77
- .nut-avatar {
78
- position: relative;
79
- flex: 0 0 auto;
80
- display: flex;
81
- justify-content: center;
82
- align-items: center;
83
- width: var(--nutui-avatar-normal-width, 40px);
84
- height: var(--nutui-avatar-normal-height, 40px);
85
- }
86
- .nut-avatar-round {
87
- border-radius: 999px;
88
- overflow: hidden;
89
- }
90
- .nut-avatar-square {
91
- border-radius: var(--nutui-avatar-square, 5px);
92
- }
93
- .nut-avatar-first-child {
94
- margin-left: 0;
95
- margin-right: 0;
96
- }
97
- .nut-avatar-img {
98
- width: 100%;
99
- height: 100%;
100
- flex-shrink: 0;
101
- background-size: 100% 100%;
102
- background-repeat: no-repeat;
103
- background-position: center center;
104
- }
105
- .nut-avatar-icon {
106
- background-size: 100% 100%;
107
- }
108
- .nut-avatar-text {
109
- display: flex;
110
- justify-content: center;
111
- align-items: center;
112
- }
113
- .nut-avatar-large {
114
- width: var(--nutui-avatar-large-width, 60px);
115
- height: var(--nutui-avatar-large-height, 60px);
116
- }
117
- .nut-avatar-large-img {
118
- width: var(--nutui-avatar-large-width, 60px);
119
- height: var(--nutui-avatar-large-height, 60px);
120
- }
121
- .nut-avatar-large-icon {
122
- width: var(--nutui-avatar-large-width, 60px);
123
- height: var(--nutui-avatar-large-height, 60px);
124
- }
125
- .nut-avatar-large-text {
126
- width: var(--nutui-avatar-large-width, 60px);
127
- height: var(--nutui-avatar-large-height, 60px);
128
- }
129
- .nut-avatar-small {
130
- width: var(--nutui-avatar-small-width, 32px);
131
- height: var(--nutui-avatar-small-height, 32px);
132
- }
133
- .nut-avatar-small-text {
134
- width: var(--nutui-avatar-small-width, 32px);
135
- height: var(--nutui-avatar-small-height, 32px);
136
- }
137
-
138
5
  .nut-skeleton {
139
- display: inline-block;
140
- position: relative;
141
- overflow: hidden;
142
- vertical-align: middle;
143
- width: 100%;
6
+ line-height: 0px;
7
+ font-size: 0px;
144
8
  }
145
9
  .nut-skeleton-content {
146
- display: flex;
147
- flex-direction: row;
148
- }
149
- .nut-skeleton-content-avatar {
150
- margin-right: 20px;
151
- background: var(--nutui-skeleton-background, var(--nutui-color-background, #f2f3f5)) !important;
152
- }
153
- .nut-skeleton-content-block {
10
+ position: relative;
11
+ display: inline-flex;
154
12
  width: var(--nutui-skeleton-line-width, 100%);
155
- height: var(--nutui-skeleton-line-height, 15px);
156
- background: var(--nutui-skeleton-background, var(--nutui-color-background, #f2f3f5));
157
- margin-top: 10px;
158
- border-radius: var(--nutui-skeleton-line-border-radius, 0);
13
+ background: var(--nutui-skeleton-background, var(--nutui-color-background-sunken, #f7f8fc));
14
+ border-radius: var(--nutui-skeleton-line-border-radius, var(--nutui-radius-xs, 4px));
15
+ overflow: hidden;
159
16
  }
160
- .nut-skeleton-content-line {
161
- width: 100%;
162
- display: flex;
163
- flex-direction: column;
17
+ .nut-skeleton-content-normal {
18
+ height: var(--nutui-skeleton-line-normal-height, 24px);
164
19
  }
165
- .nut-skeleton-content-line .nut-skeleton-content-block:last-child {
166
- width: 70%;
20
+ .nut-skeleton-content-large {
21
+ height: var(--nutui-skeleton-line-large-height, 32px);
167
22
  }
168
- .nut-skeleton-content-title {
169
- width: 30%;
170
- height: var(--nutui-skeleton-line-height, 15px);
171
- background: var(--nutui-skeleton-background, var(--nutui-color-background, #f2f3f5));
23
+ .nut-skeleton-content-small {
24
+ height: var(--nutui-skeleton-line-small-height, 16px);
25
+ margin-top: 8px;
172
26
  }
173
- .nut-skeleton-content-block-last-child {
174
- width: 55%;
27
+ .nut-skeleton-content-small-0 {
28
+ margin-top: 0;
175
29
  }
176
30
  .nut-skeleton-animation {
177
31
  position: absolute;
@@ -180,33 +34,36 @@
180
34
  width: 100%;
181
35
  height: 100%;
182
36
  z-index: 1;
183
- animation: nut-skeleton 2s ease-in-out 0s infinite;
37
+ background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.02) 50%, rgba(0, 0, 0, 0) 100%);
38
+ animation-name: nut-skeleton;
39
+ animation-delay: 0s;
40
+ animation-duration: 0.6s;
41
+ animation-direction: normal;
42
+ animation-fill-mode: both;
43
+ animation-play-state: running;
44
+ animation-iteration-count: 1;
45
+ animation-timing-function: linear;
184
46
  }
185
47
  @keyframes nut-skeleton {
186
- 0% {
187
- background-position-x: -500px;
48
+ from {
49
+ transform: translateX(-100%);
188
50
  }
189
51
  to {
190
- background-position-x: calc(500px + 100%);
52
+ transform: translateX(100%);
191
53
  }
192
54
  }
193
55
 
194
- [dir=rtl] .nut-skeleton-content .nut-avatar,
195
- .nut-rtl .nut-skeleton-content .nut-avatar {
196
- margin-right: 0;
197
- margin-left: 20px;
198
- }
199
56
  [dir=rtl] .nut-skeleton-animation,
200
57
  .nut-rtl .nut-skeleton-animation {
201
58
  left: auto;
202
59
  right: 0;
203
- animation: nut-skeleton-rtl 2s ease-in-out 0s infinite;
60
+ animation: nut-skeleton-rtl 2s linear 0s infinite;
204
61
  }
205
62
  @keyframes nut-skeleton-rtl {
206
- 0% {
207
- background-position-x: calc(500px + 100%);
63
+ from {
64
+ transform: translateX(100%);
208
65
  }
209
66
  to {
210
- background-position-x: -500px;
67
+ transform: translateX(-100%);
211
68
  }
212
69
  }
@@ -45,6 +45,11 @@
45
45
  .nut-switch-button-close-rtl {
46
46
  left: calc(100% - var(--nutui-switch-height, 28px) + var(--nutui-switch-border-width, 2px));
47
47
  }
48
+ .nut-switch-button .nut-icon {
49
+ width: calc((var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) * 2) / 2);
50
+ height: calc((var(--nutui-switch-height, 28px) - var(--nutui-switch-border-width, 2px) * 2) / 2);
51
+ color: var(--nutui-switch-active-disabled-background-color, var(--nutui-color-primary-disabled-special, #ffadbe));
52
+ }
48
53
  .nut-switch-close {
49
54
  background-color: var(--nutui-switch-inactive-background-color, var(--nutui-color-text-disabled, #c2c4cc));
50
55
  }
@@ -40,6 +40,11 @@
40
40
  left: calc(100% - $switch-height + $switch-border-width);
41
41
  }
42
42
  }
43
+ .nut-icon {
44
+ width: calc(($switch-height - $switch-border-width * 2) / 2);
45
+ height: calc(($switch-height - $switch-border-width * 2) / 2);
46
+ color: $switch-active-disabled-background-color;
47
+ }
43
48
  }
44
49
 
45
50
  &-close {
@@ -3,23 +3,26 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
5
5
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
6
- import React from "react";
6
+ import React, { useEffect, useState } from "react";
7
7
  import classNames from "classnames";
8
+ import { Loading1 } from "@nutui/icons-react";
8
9
  import { ComponentDefaults } from "../../utils/typings";
9
10
  import { usePropsValue } from "../../hooks/use-props-value";
10
11
  import { useRtl } from "../configprovider";
11
12
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
12
13
  disabled: false,
13
14
  activeText: '',
14
- inactiveText: ''
15
+ inactiveText: '',
16
+ loadingIcon: /*#__PURE__*/ React.createElement(Loading1, null)
15
17
  });
16
18
  export var Switch = function(props) {
17
- var _ref = _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 = _object_without_properties(_ref, [
19
+ var _ref = _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 = _object_without_properties(_ref, [
18
20
  "checked",
19
21
  "defaultChecked",
20
22
  "disabled",
21
23
  "activeText",
22
24
  "inactiveText",
25
+ "loadingIcon",
23
26
  "className",
24
27
  "style",
25
28
  "onChange"
@@ -30,6 +33,12 @@ export var Switch = function(props) {
30
33
  value: checked,
31
34
  defaultValue: defaultChecked
32
35
  }), 2), value = _usePropsValue[0], setValue = _usePropsValue[1];
36
+ useEffect(function() {
37
+ changing && setChanging(false);
38
+ }, [
39
+ value
40
+ ]);
41
+ var _useState = _sliced_to_array(useState(false), 2), changing = _useState[0], setChanging = _useState[1];
33
42
  var classes = function() {
34
43
  var _obj;
35
44
  return classNames([
@@ -38,17 +47,18 @@ export var Switch = function(props) {
38
47
  (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-close"), !value), _define_property(_obj, "".concat(classPrefix, "-disabled"), disabled), _define_property(_obj, "".concat(classPrefix, "-disabled-close"), disabled && !value), _obj)
39
48
  ]);
40
49
  };
41
- var onClick = function(event) {
42
- if (disabled) return;
43
- onChange && onChange(!value, event);
50
+ var onClick = function() {
51
+ if (disabled || changing) return;
52
+ if (props.onChange) {
53
+ setChanging(true);
54
+ props.onChange(!value);
55
+ }
44
56
  setValue(!value);
45
57
  };
46
58
  var _obj, _obj1;
47
59
  return /*#__PURE__*/ React.createElement("div", _object_spread({
48
60
  className: classes(),
49
- onClick: function(e) {
50
- return onClick(e);
51
- },
61
+ onClick: onClick,
52
62
  style: style
53
63
  }, rest), /*#__PURE__*/ React.createElement("div", {
54
64
  className: classNames([
@@ -60,9 +70,9 @@ export var Switch = function(props) {
60
70
  ],
61
71
  (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-button-open-rtl"), rtl && value), _define_property(_obj, "".concat(classPrefix, "-button-close-rtl"), rtl && !value), _obj)
62
72
  ])
63
- }, !value && !activeText && /*#__PURE__*/ React.createElement("div", {
73
+ }, changing && loadingIcon ? /*#__PURE__*/ React.createElement(React.Fragment, null, loadingIcon) : /*#__PURE__*/ React.createElement(React.Fragment, null, !value && !activeText && /*#__PURE__*/ React.createElement("div", {
64
74
  className: "".concat(classPrefix, "-close-line")
65
- })), activeText && /*#__PURE__*/ React.createElement("div", {
75
+ }))), activeText && /*#__PURE__*/ React.createElement("div", {
66
76
  className: classNames("".concat(classPrefix, "-label"), (_obj1 = {}, _define_property(_obj1, "".concat(classPrefix, "-label-open"), value), _define_property(_obj1, "".concat(classPrefix, "-label-close"), !value), _define_property(_obj1, "".concat(classPrefix, "-label-open-rtl"), rtl && value), _define_property(_obj1, "".concat(classPrefix, "-label-close-rtl"), rtl && !value), _define_property(_obj1, "".concat(classPrefix, "-label-close-disabled"), disabled && !value), _obj1))
67
77
  }, value ? activeText : inactiveText));
68
78
  };
@@ -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,
@@ -2,22 +2,24 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
2
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
5
- import React from "react";
5
+ import React, { useMemo } from "react";
6
6
  import classNames from "classnames";
7
7
  import { ComponentDefaults } from "../../utils/typings";
8
8
  import { usePropsValue } from "../../hooks/use-props-value";
9
9
  import TabbarItem from "../tabbaritem";
10
10
  import TabbarContext from "./context";
11
+ import SafeArea from "../safearea/index";
11
12
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
12
13
  defaultValue: 0,
13
14
  fixed: false,
14
15
  inactiveColor: '',
15
16
  activeColor: '',
17
+ direction: 'vertical',
16
18
  safeArea: false,
17
- onSwitch: function(value) {}
19
+ onSwitch: function() {}
18
20
  });
19
21
  export var Tabbar = function(props) {
20
- var _$_object_spread = _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;
22
+ var _$_object_spread = _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;
21
23
  var classPrefix = 'nut-tabbar';
22
24
  var _usePropsValue = _sliced_to_array(usePropsValue({
23
25
  value: value,
@@ -25,11 +27,26 @@ export var Tabbar = function(props) {
25
27
  finalValue: 0,
26
28
  onChange: onSwitch
27
29
  }), 2), selectIndex = _usePropsValue[0], setSelectIndex = _usePropsValue[1];
30
+ var sizeCls = useMemo(function() {
31
+ var size = React.Children.count(children);
32
+ var _obj;
33
+ return size > 3 ? '' : classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix, "-wrap-3"), size === 3), _define_property(_obj, "".concat(classPrefix, "-wrap-2"), size === 2), _define_property(_obj, "".concat(classPrefix, "-wrap-").concat(direction), size === 2 && direction !== 'vertical'), _obj));
34
+ }, [
35
+ children,
36
+ direction
37
+ ]);
38
+ var itemDirection = useMemo(function() {
39
+ var size = React.Children.count(children);
40
+ return size === 2 && direction !== 'vertical' && direction;
41
+ }, [
42
+ direction,
43
+ children
44
+ ]);
28
45
  return /*#__PURE__*/ React.createElement("div", {
29
46
  className: classNames(classPrefix, _define_property({}, "".concat(classPrefix, "-fixed"), fixed), className),
30
47
  style: style
31
48
  }, /*#__PURE__*/ React.createElement("div", {
32
- className: "".concat(classPrefix, "-wrap")
49
+ className: "".concat(classPrefix, "-wrap ").concat(sizeCls)
33
50
  }, /*#__PURE__*/ React.createElement(TabbarContext.Provider, {
34
51
  value: {
35
52
  selectIndex: selectIndex,
@@ -38,12 +55,12 @@ export var Tabbar = function(props) {
38
55
  handleClick: setSelectIndex
39
56
  }
40
57
  }, React.Children.map(children, function(child, index) {
41
- if (!/*#__PURE__*/ React.isValidElement(child)) return null;
42
- return /*#__PURE__*/ React.cloneElement(child, _object_spread_props(_object_spread({}, child.props), {
43
- index: index
44
- }));
45
- }))), (fixed || safeArea) && /*#__PURE__*/ React.createElement("div", {
46
- className: "".concat(classPrefix, "-safe-area")
58
+ return /*#__PURE__*/ React.isValidElement(child) ? /*#__PURE__*/ React.cloneElement(child, _object_spread_props(_object_spread({}, child.props), {
59
+ index: index,
60
+ direction: itemDirection
61
+ })) : null;
62
+ }))), (fixed || safeArea) && /*#__PURE__*/ React.createElement(SafeArea, {
63
+ position: "bottom"
47
64
  }));
48
65
  };
49
66
  Tabbar.displayName = 'NutTabbar';