@nutui/nutui-react 1.5.4 → 1.5.5

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 v1.5.4 Wed May 10 2023 17:38:50 GMT+0800 (中国标准时间)
12
+ * @nutui/nutui-react v1.5.5 Wed May 17 2023 16:14:07 GMT+0800 (China Standard Time)
13
13
  * (c) 2023 @jdf2e.
14
14
  * Released under the MIT License.
15
15
  */
@@ -33,10 +33,15 @@ var __publicField = (obj, key, value) => {
33
33
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
34
34
  const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
35
35
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
36
- function getDefaultExportFromCjs(x) {
37
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
38
- }
39
- var classname = { exports: {} };
36
+ var classnameExports = {};
37
+ var classname = {
38
+ get exports() {
39
+ return classnameExports;
40
+ },
41
+ set exports(v) {
42
+ classnameExports = v;
43
+ }
44
+ };
40
45
  var classname_production_min = {};
41
46
  var hasRequiredClassname_production_min;
42
47
  function requireClassname_production_min() {
@@ -44,37 +49,37 @@ var __publicField = (obj, key, value) => {
44
49
  return classname_production_min;
45
50
  hasRequiredClassname_production_min = 1;
46
51
  function r(r2) {
47
- function t2(t3, i, a, o) {
48
- var f = i ? e + t3 + r2.e + i : e + t3, v = f;
52
+ function e2(e3, i, a, o) {
53
+ var f = i ? t + e3 + r2.e + i : t + e3, v = f;
49
54
  if (a) {
50
- var s = " " + v + r2.m;
51
- for (var u in a)
52
- if (a.hasOwnProperty(u)) {
53
- var p = a[u];
54
- true === p ? v += s + u : p && (v += s + u + n + p);
55
+ var u = " " + v + r2.m;
56
+ for (var s in a)
57
+ if (a.hasOwnProperty(s)) {
58
+ var p = a[s];
59
+ true === p ? v += u + s : p && (v += u + s + n + p);
55
60
  }
56
61
  }
57
62
  if (void 0 !== o)
58
- for (var y = 0, c = (o = Array.isArray(o) ? o : [o]).length; y < c; y++) {
59
- var l = o[y];
60
- if (l && "string" == typeof l.valueOf())
61
- for (var g = l.valueOf().split(" "), d = 0; d < g.length; d++) {
63
+ for (var c = 0, l = o.length; c < l; c++) {
64
+ var y = o[c];
65
+ if (y && "string" == typeof y.valueOf())
66
+ for (var g = y.valueOf().split(" "), d = 0; d < g.length; d++) {
62
67
  var h = g[d];
63
68
  h !== f && (v += " " + h);
64
69
  }
65
70
  }
66
71
  return v;
67
72
  }
68
- var e = r2.n || "", n = r2.v || r2.m;
69
- return function(r3, e2) {
73
+ var t = r2.n || "", n = r2.v || r2.m;
74
+ return function(r3, t2) {
70
75
  return function(n2, i, a) {
71
- return "string" == typeof n2 ? "string" == typeof i || Array.isArray(i) ? t2(r3, n2, void 0, i) : t2(r3, n2, i, a) : t2(r3, e2, n2, i);
76
+ return "string" == typeof n2 ? Array.isArray(i) ? e2(r3, n2, void 0, i) : e2(r3, n2, i, a) : e2(r3, t2, n2, i);
72
77
  };
73
78
  };
74
79
  }
75
80
  Object.defineProperty(classname_production_min, "__esModule", { value: true });
76
- var t = r({ e: "-", m: "_" });
77
- classname_production_min.cn = t, classname_production_min.withNaming = r;
81
+ var e = r({ e: "-", m: "_" });
82
+ classname_production_min.cn = e, classname_production_min.withNaming = r;
78
83
  return classname_production_min;
79
84
  }
80
85
  var classname_development = {};
@@ -104,7 +109,6 @@ var __publicField = (obj, key, value) => {
104
109
  }
105
110
  }
106
111
  if (mix !== void 0) {
107
- mix = Array.isArray(mix) ? mix : [mix];
108
112
  for (var i = 0, len = mix.length; i < len; i++) {
109
113
  var value = mix[i];
110
114
  if (!value || typeof value.valueOf() !== "string")
@@ -123,7 +127,7 @@ var __publicField = (obj, key, value) => {
123
127
  return function cnGenerator(b2, e) {
124
128
  return function(elemOrMods, elemModsOrBlockMix, elemMix) {
125
129
  if (typeof elemOrMods === "string") {
126
- if (typeof elemModsOrBlockMix === "string" || Array.isArray(elemModsOrBlockMix)) {
130
+ if (Array.isArray(elemModsOrBlockMix)) {
127
131
  return stringify(b2, elemOrMods, void 0, elemModsOrBlockMix);
128
132
  }
129
133
  return stringify(b2, elemOrMods, elemModsOrBlockMix, elemMix);
@@ -140,12 +144,13 @@ var __publicField = (obj, key, value) => {
140
144
  classname_development.withNaming = withNaming;
141
145
  return classname_development;
142
146
  }
143
- if (process.env.NODE_ENV === "production") {
144
- classname.exports = requireClassname_production_min();
145
- } else {
146
- classname.exports = requireClassname_development();
147
- }
148
- var classnameExports = classname.exports;
147
+ (function(module2) {
148
+ if (process.env.NODE_ENV === "production") {
149
+ module2.exports = requireClassname_production_min();
150
+ } else {
151
+ module2.exports = requireClassname_development();
152
+ }
153
+ })(classname);
149
154
  const cn = classnameExports.withNaming({ n: "nut-", e: "__", m: "--", v: "-" });
150
155
  const defaultProps$1s = {
151
156
  name: "",
@@ -757,7 +762,6 @@ var __publicField = (obj, key, value) => {
757
762
  return string2.match(pattern2) || [];
758
763
  }
759
764
  var lodash_kebabcase = kebabCase;
760
- const kebabCase$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_kebabcase);
761
765
  const zhCN = {
762
766
  save: "保存",
763
767
  confirm: "确认",
@@ -905,7 +909,7 @@ var __publicField = (obj, key, value) => {
905
909
  function convertThemeVarsToCSSVars(themeVars) {
906
910
  const cssVars = {};
907
911
  Object.keys(themeVars).forEach((key) => {
908
- cssVars[`--${kebabCase$1(key)}`] = themeVars[key];
912
+ cssVars[`--${lodash_kebabcase(key)}`] = themeVars[key];
909
913
  });
910
914
  return cssVars;
911
915
  }
@@ -942,7 +946,6 @@ var __publicField = (obj, key, value) => {
942
946
  isLazy: false
943
947
  };
944
948
  const Image$1 = (props) => {
945
- useConfig();
946
949
  const {
947
950
  children,
948
951
  className,
@@ -968,15 +971,16 @@ var __publicField = (obj, key, value) => {
968
971
  } = { ...defaultProps$1n, ...props };
969
972
  const [loading, setLoading] = React.useState(true);
970
973
  const [isError, setIsError] = React.useState(false);
971
- const [_src, setSrc] = React.useState("");
974
+ const imgRef = React.useRef(null);
972
975
  React.useEffect(() => {
973
- if (src) {
974
- setSrc(src);
975
- setIsError(false);
976
+ if (imgRef.current && imgRef.current.complete && imgRef.current.naturalHeight !== 0) {
977
+ setLoading(false);
978
+ } else if (src) {
976
979
  setLoading(true);
977
980
  }
978
981
  }, [src]);
979
982
  const load = () => {
983
+ setIsError(false);
980
984
  setLoading(false);
981
985
  onLoad && onLoad();
982
986
  };
@@ -1056,9 +1060,10 @@ var __publicField = (obj, key, value) => {
1056
1060
  isLazy ? /* @__PURE__ */ React.createElement(
1057
1061
  "img",
1058
1062
  {
1063
+ ref: imgRef,
1059
1064
  className: "nut-img lazyload",
1060
1065
  style: styles,
1061
- "data-src": _src,
1066
+ "data-src": src,
1062
1067
  alt,
1063
1068
  loading: "lazy",
1064
1069
  onLoad: load,
@@ -1067,9 +1072,10 @@ var __publicField = (obj, key, value) => {
1067
1072
  ) : /* @__PURE__ */ React.createElement(
1068
1073
  "img",
1069
1074
  {
1075
+ ref: imgRef,
1070
1076
  className: "nut-img",
1071
1077
  style: styles,
1072
- src: _src,
1078
+ src,
1073
1079
  alt,
1074
1080
  onLoad: load,
1075
1081
  onError: error
@@ -1081,7 +1087,15 @@ var __publicField = (obj, key, value) => {
1081
1087
  };
1082
1088
  Image$1.defaultProps = defaultProps$1n;
1083
1089
  Image$1.displayName = "NutImage";
1084
- var classnames = { exports: {} };
1090
+ var classnamesExports = {};
1091
+ var classnames = {
1092
+ get exports() {
1093
+ return classnamesExports;
1094
+ },
1095
+ set exports(v) {
1096
+ classnamesExports = v;
1097
+ }
1098
+ };
1085
1099
  /*!
1086
1100
  Copyright (c) 2018 Jed Watson.
1087
1101
  Licensed under the MIT License (MIT), see
@@ -1128,8 +1142,7 @@ var __publicField = (obj, key, value) => {
1128
1142
  }
1129
1143
  })();
1130
1144
  })(classnames);
1131
- var classnamesExports = classnames.exports;
1132
- const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
1145
+ const classNames = classnamesExports;
1133
1146
  const defaultOverlayProps = {
1134
1147
  zIndex: 1e3,
1135
1148
  duration: 0.3,
@@ -1244,8 +1257,24 @@ var __publicField = (obj, key, value) => {
1244
1257
  subClass.prototype.constructor = subClass;
1245
1258
  _setPrototypeOf$1(subClass, superClass);
1246
1259
  }
1247
- var propTypes = { exports: {} };
1248
- var reactIs = { exports: {} };
1260
+ var propTypesExports = {};
1261
+ var propTypes = {
1262
+ get exports() {
1263
+ return propTypesExports;
1264
+ },
1265
+ set exports(v) {
1266
+ propTypesExports = v;
1267
+ }
1268
+ };
1269
+ var reactIsExports = {};
1270
+ var reactIs = {
1271
+ get exports() {
1272
+ return reactIsExports;
1273
+ },
1274
+ set exports(v) {
1275
+ reactIsExports = v;
1276
+ }
1277
+ };
1249
1278
  var reactIs_production_min = {};
1250
1279
  /** @license React v16.13.1
1251
1280
  * react-is.production.min.js
@@ -1516,14 +1545,16 @@ var __publicField = (obj, key, value) => {
1516
1545
  var hasRequiredReactIs;
1517
1546
  function requireReactIs() {
1518
1547
  if (hasRequiredReactIs)
1519
- return reactIs.exports;
1548
+ return reactIsExports;
1520
1549
  hasRequiredReactIs = 1;
1521
- if (process.env.NODE_ENV === "production") {
1522
- reactIs.exports = requireReactIs_production_min();
1523
- } else {
1524
- reactIs.exports = requireReactIs_development();
1525
- }
1526
- return reactIs.exports;
1550
+ (function(module2) {
1551
+ if (process.env.NODE_ENV === "production") {
1552
+ module2.exports = requireReactIs_production_min();
1553
+ } else {
1554
+ module2.exports = requireReactIs_development();
1555
+ }
1556
+ })(reactIs);
1557
+ return reactIsExports;
1527
1558
  }
1528
1559
  /*
1529
1560
  object-assign
@@ -2190,8 +2221,6 @@ var __publicField = (obj, key, value) => {
2190
2221
  } else {
2191
2222
  propTypes.exports = requireFactoryWithThrowingShims()();
2192
2223
  }
2193
- var propTypesExports = propTypes.exports;
2194
- const PropTypes = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
2195
2224
  function hasClass(element, className) {
2196
2225
  if (element.classList)
2197
2226
  return !!className && element.classList.contains(className);
@@ -2221,22 +2250,22 @@ var __publicField = (obj, key, value) => {
2221
2250
  const config$1 = {
2222
2251
  disabled: false
2223
2252
  };
2224
- var timeoutsShape = process.env.NODE_ENV !== "production" ? PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
2225
- enter: PropTypes.number,
2226
- exit: PropTypes.number,
2227
- appear: PropTypes.number
2253
+ var timeoutsShape = process.env.NODE_ENV !== "production" ? propTypesExports.oneOfType([propTypesExports.number, propTypesExports.shape({
2254
+ enter: propTypesExports.number,
2255
+ exit: propTypesExports.number,
2256
+ appear: propTypesExports.number
2228
2257
  }).isRequired]) : null;
2229
- var classNamesShape = process.env.NODE_ENV !== "production" ? PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
2230
- enter: PropTypes.string,
2231
- exit: PropTypes.string,
2232
- active: PropTypes.string
2233
- }), PropTypes.shape({
2234
- enter: PropTypes.string,
2235
- enterDone: PropTypes.string,
2236
- enterActive: PropTypes.string,
2237
- exit: PropTypes.string,
2238
- exitDone: PropTypes.string,
2239
- exitActive: PropTypes.string
2258
+ var classNamesShape = process.env.NODE_ENV !== "production" ? propTypesExports.oneOfType([propTypesExports.string, propTypesExports.shape({
2259
+ enter: propTypesExports.string,
2260
+ exit: propTypesExports.string,
2261
+ active: propTypesExports.string
2262
+ }), propTypesExports.shape({
2263
+ enter: propTypesExports.string,
2264
+ enterDone: propTypesExports.string,
2265
+ enterActive: propTypesExports.string,
2266
+ exit: propTypesExports.string,
2267
+ exitDone: propTypesExports.string,
2268
+ exitActive: propTypesExports.string
2240
2269
  })]) : null;
2241
2270
  const TransitionGroupContext = React.createContext(null);
2242
2271
  var forceReflow = function forceReflow2(node) {
@@ -2486,10 +2515,10 @@ var __publicField = (obj, key, value) => {
2486
2515
  * (see
2487
2516
  * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
2488
2517
  */
2489
- nodeRef: PropTypes.shape({
2490
- current: typeof Element === "undefined" ? PropTypes.any : function(propValue, key, componentName, location, propFullName, secret) {
2518
+ nodeRef: propTypesExports.shape({
2519
+ current: typeof Element === "undefined" ? propTypesExports.any : function(propValue, key, componentName, location, propFullName, secret) {
2491
2520
  var value = propValue[key];
2492
- return PropTypes.instanceOf(value && "ownerDocument" in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
2521
+ return propTypesExports.instanceOf(value && "ownerDocument" in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
2493
2522
  }
2494
2523
  }),
2495
2524
  /**
@@ -2506,23 +2535,23 @@ var __publicField = (obj, key, value) => {
2506
2535
  * </Transition>
2507
2536
  * ```
2508
2537
  */
2509
- children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,
2538
+ children: propTypesExports.oneOfType([propTypesExports.func.isRequired, propTypesExports.element.isRequired]).isRequired,
2510
2539
  /**
2511
2540
  * Show the component; triggers the enter or exit states
2512
2541
  */
2513
- in: PropTypes.bool,
2542
+ in: propTypesExports.bool,
2514
2543
  /**
2515
2544
  * By default the child component is mounted immediately along with
2516
2545
  * the parent `Transition` component. If you want to "lazy mount" the component on the
2517
2546
  * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
2518
2547
  * mounted, even on "exited", unless you also specify `unmountOnExit`.
2519
2548
  */
2520
- mountOnEnter: PropTypes.bool,
2549
+ mountOnEnter: propTypesExports.bool,
2521
2550
  /**
2522
2551
  * By default the child component stays mounted after it reaches the `'exited'` state.
2523
2552
  * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
2524
2553
  */
2525
- unmountOnExit: PropTypes.bool,
2554
+ unmountOnExit: propTypesExports.bool,
2526
2555
  /**
2527
2556
  * By default the child component does not perform the enter transition when
2528
2557
  * it first mounts, regardless of the value of `in`. If you want this
@@ -2534,15 +2563,15 @@ var __publicField = (obj, key, value) => {
2534
2563
  * > additional `.appear-*` classes, that way you can choose to style it
2535
2564
  * > differently.
2536
2565
  */
2537
- appear: PropTypes.bool,
2566
+ appear: propTypesExports.bool,
2538
2567
  /**
2539
2568
  * Enable or disable enter transitions.
2540
2569
  */
2541
- enter: PropTypes.bool,
2570
+ enter: propTypesExports.bool,
2542
2571
  /**
2543
2572
  * Enable or disable exit transitions.
2544
2573
  */
2545
- exit: PropTypes.bool,
2574
+ exit: propTypesExports.bool,
2546
2575
  /**
2547
2576
  * The duration of the transition, in milliseconds.
2548
2577
  * Required unless `addEndListener` is provided.
@@ -2592,7 +2621,7 @@ var __publicField = (obj, key, value) => {
2592
2621
  * }}
2593
2622
  * ```
2594
2623
  */
2595
- addEndListener: PropTypes.func,
2624
+ addEndListener: propTypesExports.func,
2596
2625
  /**
2597
2626
  * Callback fired before the "entering" status is applied. An extra parameter
2598
2627
  * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
@@ -2601,7 +2630,7 @@ var __publicField = (obj, key, value) => {
2601
2630
  *
2602
2631
  * @type Function(node: HtmlElement, isAppearing: bool) -> void
2603
2632
  */
2604
- onEnter: PropTypes.func,
2633
+ onEnter: propTypesExports.func,
2605
2634
  /**
2606
2635
  * Callback fired after the "entering" status is applied. An extra parameter
2607
2636
  * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
@@ -2610,7 +2639,7 @@ var __publicField = (obj, key, value) => {
2610
2639
  *
2611
2640
  * @type Function(node: HtmlElement, isAppearing: bool)
2612
2641
  */
2613
- onEntering: PropTypes.func,
2642
+ onEntering: propTypesExports.func,
2614
2643
  /**
2615
2644
  * Callback fired after the "entered" status is applied. An extra parameter
2616
2645
  * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
@@ -2619,7 +2648,7 @@ var __publicField = (obj, key, value) => {
2619
2648
  *
2620
2649
  * @type Function(node: HtmlElement, isAppearing: bool) -> void
2621
2650
  */
2622
- onEntered: PropTypes.func,
2651
+ onEntered: propTypesExports.func,
2623
2652
  /**
2624
2653
  * Callback fired before the "exiting" status is applied.
2625
2654
  *
@@ -2627,7 +2656,7 @@ var __publicField = (obj, key, value) => {
2627
2656
  *
2628
2657
  * @type Function(node: HtmlElement) -> void
2629
2658
  */
2630
- onExit: PropTypes.func,
2659
+ onExit: propTypesExports.func,
2631
2660
  /**
2632
2661
  * Callback fired after the "exiting" status is applied.
2633
2662
  *
@@ -2635,7 +2664,7 @@ var __publicField = (obj, key, value) => {
2635
2664
  *
2636
2665
  * @type Function(node: HtmlElement) -> void
2637
2666
  */
2638
- onExiting: PropTypes.func,
2667
+ onExiting: propTypesExports.func,
2639
2668
  /**
2640
2669
  * Callback fired after the "exited" status is applied.
2641
2670
  *
@@ -2643,7 +2672,7 @@ var __publicField = (obj, key, value) => {
2643
2672
  *
2644
2673
  * @type Function(node: HtmlElement) -> void
2645
2674
  */
2646
- onExited: PropTypes.func
2675
+ onExited: propTypesExports.func
2647
2676
  } : {};
2648
2677
  function noop$2() {
2649
2678
  }
@@ -2882,7 +2911,7 @@ var __publicField = (obj, key, value) => {
2882
2911
  *
2883
2912
  * @type Function(node: HtmlElement, isAppearing: bool)
2884
2913
  */
2885
- onEnter: PropTypes.func,
2914
+ onEnter: propTypesExports.func,
2886
2915
  /**
2887
2916
  * A `<Transition>` callback fired immediately after the 'enter-active' or
2888
2917
  * 'appear-active' class is applied.
@@ -2891,7 +2920,7 @@ var __publicField = (obj, key, value) => {
2891
2920
  *
2892
2921
  * @type Function(node: HtmlElement, isAppearing: bool)
2893
2922
  */
2894
- onEntering: PropTypes.func,
2923
+ onEntering: propTypesExports.func,
2895
2924
  /**
2896
2925
  * A `<Transition>` callback fired immediately after the 'enter' or
2897
2926
  * 'appear' classes are **removed** and the `done` class is added to the DOM node.
@@ -2900,7 +2929,7 @@ var __publicField = (obj, key, value) => {
2900
2929
  *
2901
2930
  * @type Function(node: HtmlElement, isAppearing: bool)
2902
2931
  */
2903
- onEntered: PropTypes.func,
2932
+ onEntered: propTypesExports.func,
2904
2933
  /**
2905
2934
  * A `<Transition>` callback fired immediately after the 'exit' class is
2906
2935
  * applied.
@@ -2909,7 +2938,7 @@ var __publicField = (obj, key, value) => {
2909
2938
  *
2910
2939
  * @type Function(node: HtmlElement)
2911
2940
  */
2912
- onExit: PropTypes.func,
2941
+ onExit: propTypesExports.func,
2913
2942
  /**
2914
2943
  * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
2915
2944
  *
@@ -2917,7 +2946,7 @@ var __publicField = (obj, key, value) => {
2917
2946
  *
2918
2947
  * @type Function(node: HtmlElement)
2919
2948
  */
2920
- onExiting: PropTypes.func,
2949
+ onExiting: propTypesExports.func,
2921
2950
  /**
2922
2951
  * A `<Transition>` callback fired immediately after the 'exit' classes
2923
2952
  * are **removed** and the `exit-done` class is added to the DOM node.
@@ -2926,7 +2955,7 @@ var __publicField = (obj, key, value) => {
2926
2955
  *
2927
2956
  * @type Function(node: HtmlElement)
2928
2957
  */
2929
- onExited: PropTypes.func
2958
+ onExited: propTypesExports.func
2930
2959
  }) : {};
2931
2960
  const CSSTransition$1 = CSSTransition;
2932
2961
  const defaultProps$1m = {