@nutui/nutui-react 2.0.21-beta.0 → 2.0.22

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.
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  return value;
10
10
  };
11
11
  /*!
12
- * @nutui/nutui-react v2.0.21 Wed Oct 18 2023 17:52:14 GMT+0800 (China Standard Time)
12
+ * @nutui/nutui-react v2.0.22 Fri Oct 27 2023 18:21:25 GMT+0800 (China Standard Time)
13
13
  * (c) 2023 @jdf2e.
14
14
  * Released under the MIT License.
15
15
  */
@@ -12189,13 +12189,13 @@ Please add \`${key}Action\` when creating your handler.`);
12189
12189
  stateRef.current = value;
12190
12190
  }
12191
12191
  const setState = React.useCallback(
12192
- (v) => {
12192
+ (v, forceTrigger = false) => {
12193
12193
  const prevState = stateRef.current;
12194
12194
  stateRef.current = v;
12195
- if (prevState !== stateRef.current) {
12195
+ if (prevState !== stateRef.current || forceTrigger) {
12196
12196
  forceUpdate();
12197
+ onChange == null ? void 0 : onChange(v);
12197
12198
  }
12198
- onChange == null ? void 0 : onChange(v);
12199
12199
  },
12200
12200
  [value, onChange]
12201
12201
  );
@@ -14576,6 +14576,19 @@ Please add \`${key}Action\` when creating your handler.`);
14576
14576
  isHorizontal
14577
14577
  };
14578
14578
  }
14579
+ let passiveSupported = false;
14580
+ if (canUseDom) {
14581
+ try {
14582
+ const opts = Object.defineProperty({}, "passive", {
14583
+ get() {
14584
+ passiveSupported = true;
14585
+ }
14586
+ });
14587
+ window.addEventListener("test-passive-supported", null, opts);
14588
+ } catch (e) {
14589
+ console.log(e);
14590
+ }
14591
+ }
14579
14592
  const InternalPickerPanel = (props, ref) => {
14580
14593
  const {
14581
14594
  keyIndex = 0,
@@ -14741,6 +14754,19 @@ Please add \`${key}Action\` when creating your handler.`);
14741
14754
  stopMomentum,
14742
14755
  moving: moving.current
14743
14756
  }));
14757
+ React.useEffect(() => {
14758
+ var _a2, _b, _c;
14759
+ const options22 = passiveSupported ? { passive: false } : false;
14760
+ (_a2 = PickerPanelRef.current) == null ? void 0 : _a2.addEventListener("touchstart", touchStart, options22);
14761
+ (_b = PickerPanelRef.current) == null ? void 0 : _b.addEventListener("touchmove", touchMove, options22);
14762
+ (_c = PickerPanelRef.current) == null ? void 0 : _c.addEventListener("touchend", touchEnd, options22);
14763
+ return () => {
14764
+ var _a3, _b2, _c2;
14765
+ (_a3 = PickerPanelRef.current) == null ? void 0 : _a3.removeEventListener("touchstart", touchStart);
14766
+ (_b2 = PickerPanelRef.current) == null ? void 0 : _b2.removeEventListener("touchmove", touchMove);
14767
+ (_c2 = PickerPanelRef.current) == null ? void 0 : _c2.removeEventListener("touchend", touchEnd);
14768
+ };
14769
+ });
14744
14770
  return /* @__PURE__ */ React.createElement(
14745
14771
  "div",
14746
14772
  {
@@ -14989,7 +15015,7 @@ Please add \`${key}Action\` when creating your handler.`);
14989
15015
  if (moving) {
14990
15016
  isConfirmEvent.current = true;
14991
15017
  } else {
14992
- setSelectedValue(innerValue);
15018
+ setSelectedValue(innerValue, true);
14993
15019
  closePicker();
14994
15020
  }
14995
15021
  setTimeout(() => {
@@ -16950,7 +16976,7 @@ Please add \`${key}Action\` when creating your handler.`);
16950
16976
  }
16951
16977
  setValue(val);
16952
16978
  const eventHandler = props[trigger];
16953
- if (eventHandler && typeof eventHandler === "function") {
16979
+ if (eventHandler && typeof eventHandler === "function" && trigger !== "onChange") {
16954
16980
  eventHandler(val);
16955
16981
  }
16956
16982
  };
@@ -20375,7 +20401,7 @@ Please add \`${key}Action\` when creating your handler.`);
20375
20401
  content: "",
20376
20402
  closeable: false,
20377
20403
  wrap: false,
20378
- leftIcon: null,
20404
+ leftIcon: /* @__PURE__ */ React.createElement(k$1, { width: 16, height: 16 }),
20379
20405
  rightIcon: null,
20380
20406
  delay: 1,
20381
20407
  scrollable: null,
@@ -20697,7 +20723,7 @@ Please add \`${key}Action\` when creating your handler.`);
20697
20723
  stopAutoPlay();
20698
20724
  };
20699
20725
  }, []);
20700
- return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className || ""}`, style }, showNoticeBar && direction === "horizontal" ? /* @__PURE__ */ React.createElement("div", { className: noticebarClass, style: barStyle, onClick: handleClick2 }, /* @__PURE__ */ React.createElement("div", { className: "left-icon" }, leftIcon || /* @__PURE__ */ React.createElement(k$1, { width: 16, height: 16 })), /* @__PURE__ */ React.createElement("div", { ref: wrapRef, className: "wrap" }, /* @__PURE__ */ React.createElement(
20726
+ return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2} ${className || ""}`, style }, showNoticeBar && direction === "horizontal" ? /* @__PURE__ */ React.createElement("div", { className: noticebarClass, style: barStyle, onClick: handleClick2 }, leftIcon ? /* @__PURE__ */ React.createElement("div", { className: "left-icon" }, leftIcon) : null, /* @__PURE__ */ React.createElement("div", { ref: wrapRef, className: "wrap" }, /* @__PURE__ */ React.createElement(
20701
20727
  "div",
20702
20728
  {
20703
20729
  ref: contentRef,
@@ -21199,19 +21225,6 @@ Please add \`${key}Action\` when creating your handler.`);
21199
21225
  return position;
21200
21226
  }
21201
21227
  const sleep = (time) => new Promise((resolve) => setTimeout(resolve, time));
21202
- let passiveSupported = false;
21203
- if (canUseDom) {
21204
- try {
21205
- const opts = Object.defineProperty({}, "passive", {
21206
- get() {
21207
- passiveSupported = true;
21208
- }
21209
- });
21210
- window.addEventListener("test-passive-supported", null, opts);
21211
- } catch (e) {
21212
- console.log(e);
21213
- }
21214
- }
21215
21228
  const defaultProps$w = {
21216
21229
  ...ComponentDefaults,
21217
21230
  pullingText: "",
@@ -1,8 +1,3 @@
1
- .nut-theme-dark {
2
- .nut-tabpane {
3
- background: $dark4;
4
- }
5
- }
6
1
  .nut-tabpane {
7
2
  width: 100%;
8
3
  flex-shrink: 0;
@@ -12,9 +7,6 @@
12
7
  padding: 24px 20px;
13
8
  box-sizing: border-box;
14
9
  overflow: auto;
15
- &.active {
16
- // overflow: visible;
17
- }
18
10
 
19
11
  &.inactive {
20
12
  overflow: visible;
@@ -5,14 +5,13 @@
5
5
  }
6
6
 
7
7
  .nut-tabs__titles {
8
+ display: flex;
8
9
  box-sizing: border-box;
9
10
  height: $tabs-horizontal-titles-height;
10
11
  padding: 0 10px;
11
- display: flex;
12
12
  user-select: none;
13
13
  background: $tabs-titles-background-color;
14
14
  border-radius: $tabs-titles-border-radius;
15
- flex-shrink: 0;
16
15
  overflow: hidden;
17
16
 
18
17
  &::-webkit-scrollbar {
@@ -20,6 +19,7 @@
20
19
  width: 0;
21
20
  background: transparent;
22
21
  }
22
+
23
23
  .nut-tabs__list {
24
24
  width: 100%;
25
25
  height: auto;
@@ -39,23 +39,19 @@
39
39
  .nut-tabs__titles--scrollable {
40
40
  overflow-x: auto;
41
41
  overflow-y: hidden;
42
-
43
- .nut-tabs__titles-item {
44
- width: auto;
45
- }
46
42
  }
47
43
 
48
44
  .nut-tabs__titles-item {
49
45
  position: relative;
50
46
  min-width: $tabs-horizontal-titles-item-min-width;
51
47
  display: flex;
52
- flex: 1;
48
+ flex: 1 0 auto;
49
+ padding: 0 10px;
53
50
  align-items: center;
54
51
  justify-content: center;
55
52
  margin: 0 $nut-tabs-title-gap;
56
53
  font-size: $tabs-titles-item-font-size;
57
54
  color: $tabs-titles-item-color;
58
- overflow: hidden;
59
55
  text-overflow: ellipsis;
60
56
  white-space: nowrap;
61
57
 
@@ -139,6 +135,7 @@
139
135
  padding: 0;
140
136
  width: $tabs-vertical-titles-width;
141
137
  flex-shrink: 0;
138
+
142
139
  .nut-tabs__list {
143
140
  width: 100%;
144
141
  display: flex;
@@ -197,6 +194,7 @@
197
194
  overflow-x: auto;
198
195
  overflow-y: hidden;
199
196
  height: $tabs-horizontal-titles-height;
197
+
200
198
  .nut-tabs__list {
201
199
  width: 100%;
202
200
  display: flex;