@nutui/nutui-react 1.3.9 → 1.3.10-beta.0

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 (53) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/esm/Button.js +3 -1
  3. package/dist/esm/Checkbox.js +7 -121
  4. package/dist/esm/CheckboxGroup.js +36 -4
  5. package/dist/esm/Input.js +11 -4
  6. package/dist/esm/Menu.js +3 -2
  7. package/dist/esm/MenuItem.js +1 -2
  8. package/dist/esm/NoticeBar.js +12 -16
  9. package/dist/esm/Price.js +20 -23
  10. package/dist/esm/Radio.js +6 -115
  11. package/dist/esm/RadioGroup.js +36 -6
  12. package/dist/esm/TabbarItem.js +6 -5
  13. package/dist/esm/Tag.js +6 -4
  14. package/dist/esm/checkbox-255983fc.js +121 -0
  15. package/dist/esm/radio-cf953c7a.js +118 -0
  16. package/dist/esm/types/src/packages/checkbox/checkbox.d.ts +6 -1
  17. package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.d.ts +2 -0
  18. package/dist/esm/types/src/packages/checkboxgroup/type.d.ts +6 -0
  19. package/dist/esm/types/src/packages/input/input.d.ts +1 -0
  20. package/dist/esm/types/src/packages/nutui.react.taro.scss.d.ts +91 -0
  21. package/dist/esm/types/src/packages/price/price.d.ts +2 -0
  22. package/dist/esm/types/src/packages/radiogroup/radiogroup.d.ts +2 -0
  23. package/dist/esm/types/src/packages/radiogroup/type.d.ts +7 -0
  24. package/dist/esm/types/src/packages/tabbaritem/tabbaritem.d.ts +1 -1
  25. package/dist/locales/base.js +1 -1
  26. package/dist/locales/en-US.js +1 -1
  27. package/dist/locales/id-ID.js +1 -1
  28. package/dist/locales/zh-CN.js +1 -1
  29. package/dist/locales/zh-TW.js +1 -1
  30. package/dist/nutui.react.es.js +162 -83
  31. package/dist/nutui.react.umd.js +162 -83
  32. package/dist/packages/badge/badge.scss +10 -10
  33. package/dist/packages/button/button.scss +3 -3
  34. package/dist/packages/cell/cell.scss +1 -4
  35. package/dist/packages/cellgroup/cellgroup.scss +8 -0
  36. package/dist/packages/countdown/countdown.scss +1 -1
  37. package/dist/packages/infiniteloading/infiniteloading.scss +1 -1
  38. package/dist/packages/inputnumber/inputnumber.scss +3 -3
  39. package/dist/packages/noticebar/noticebar.scss +3 -0
  40. package/dist/packages/price/price.scss +27 -11
  41. package/dist/packages/radio/radio.scss +8 -7
  42. package/dist/packages/shortpassword/shortpassword.scss +4 -4
  43. package/dist/packages/skeleton/skeleton.scss +1 -1
  44. package/dist/packages/swiper/swiper.scss +4 -4
  45. package/dist/packages/switch/switch.scss +8 -8
  46. package/dist/packages/timepannel/timepannel.scss +3 -3
  47. package/dist/packages/timeselect/timeselect.scss +4 -4
  48. package/dist/style.css +1 -1
  49. package/dist/style.es.js +1 -1
  50. package/dist/styles/variables.scss +573 -248
  51. package/dist/types/index.d.ts +19 -3
  52. package/package.json +1 -1
  53. package/dist/esm/context-aa058329.js +0 -6
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.3.9-beta.0 Wed Nov 02 2022 15:15:31 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v1.3.10-beta.0 Wed Nov 09 2022 13:40:16 GMT+0800 (China Standard Time)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -223,7 +223,9 @@ const Button = (props) => {
223
223
  classPrefix: iconClassPrefix,
224
224
  fontClassName: iconFontClassName,
225
225
  name: icon
226
- }) : "", children));
226
+ }) : "", /* @__PURE__ */ React__default.createElement("div", {
227
+ className: "text"
228
+ }, children)));
227
229
  };
228
230
  Button.defaultProps = defaultProps$1k;
229
231
  Button.displayName = "NutButton";
@@ -3231,7 +3233,7 @@ const defaultProps$16 = {
3231
3233
  ...ComponentDefaults,
3232
3234
  dot: false,
3233
3235
  size: "",
3234
- classPrefix: "nut-icon",
3236
+ className: "",
3235
3237
  tabTitle: "",
3236
3238
  icon: "",
3237
3239
  href: "",
@@ -3248,7 +3250,8 @@ const TabbarItem = (props) => {
3248
3250
  const {
3249
3251
  dot,
3250
3252
  size,
3251
- classPrefix,
3253
+ className,
3254
+ style,
3252
3255
  tabTitle,
3253
3256
  icon,
3254
3257
  href,
@@ -3278,8 +3281,9 @@ const TabbarItem = (props) => {
3278
3281
  }
3279
3282
  }, [active, history, href, to2]);
3280
3283
  return /* @__PURE__ */ React__default.createElement("div", {
3281
- className: `${b2({ active })}`,
3284
+ className: `${b2({ active })} ${className}`,
3282
3285
  style: {
3286
+ ...style,
3283
3287
  color: active ? activeColor : unactiveColor
3284
3288
  },
3285
3289
  onClick: () => {
@@ -4270,6 +4274,17 @@ const dragConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigRe
4270
4274
  return _objectSpread2(_objectSpread2({}, DEFAULT_DRAG_AXIS_THRESHOLD), value);
4271
4275
  }
4272
4276
  });
4277
+ function clampStateInternalMovementToBounds(state) {
4278
+ const [ox, oy] = state.overflow;
4279
+ const [dx, dy] = state._delta;
4280
+ const [dirx, diry] = state._direction;
4281
+ if (ox < 0 && dx > 0 && dirx < 0 || ox > 0 && dx < 0 && dirx > 0) {
4282
+ state._movement[0] = state._movementBound[0];
4283
+ }
4284
+ if (oy < 0 && dy > 0 && diry < 0 || oy > 0 && dy < 0 && diry > 0) {
4285
+ state._movement[1] = state._movementBound[1];
4286
+ }
4287
+ }
4273
4288
  const SCALE_ANGLE_RATIO_INTENT_DEG = 30;
4274
4289
  const PINCH_WHEEL_RATIO = 100;
4275
4290
  class PinchEngine extends Engine {
@@ -4499,6 +4514,7 @@ class PinchEngine extends Engine {
4499
4514
  const state = this.state;
4500
4515
  state._delta = [-wheelValues(event)[1] / PINCH_WHEEL_RATIO * state.offset[0], 0];
4501
4516
  V.addTo(state._movement, state._delta);
4517
+ clampStateInternalMovementToBounds(state);
4502
4518
  this.state.origin = [event.clientX, event.clientY];
4503
4519
  this.compute(event);
4504
4520
  this.emit();
@@ -4518,9 +4534,11 @@ class PinchEngine extends Engine {
4518
4534
  bindFunction(device, "end", this[device + "End"].bind(this));
4519
4535
  bindFunction(device, "cancel", this[device + "End"].bind(this));
4520
4536
  }
4521
- bindFunction("wheel", "", this.wheel.bind(this), {
4522
- passive: false
4523
- });
4537
+ if (this.config.pinchOnWheel) {
4538
+ bindFunction("wheel", "", this.wheel.bind(this), {
4539
+ passive: false
4540
+ });
4541
+ }
4524
4542
  }
4525
4543
  }
4526
4544
  const pinchConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {
@@ -4573,6 +4591,9 @@ const pinchConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolv
4573
4591
  if (value === void 0)
4574
4592
  return "ctrlKey";
4575
4593
  return value;
4594
+ },
4595
+ pinchOnWheel(value = true) {
4596
+ return value;
4576
4597
  }
4577
4598
  });
4578
4599
  class MoveEngine extends CoordinatesEngine {
@@ -4671,15 +4692,7 @@ class WheelEngine extends CoordinatesEngine {
4671
4692
  const state = this.state;
4672
4693
  state._delta = wheelValues(event);
4673
4694
  V.addTo(state._movement, state._delta);
4674
- const [ox, oy] = state.overflow;
4675
- const [dx, dy] = state._delta;
4676
- const [dirx, diry] = state._direction;
4677
- if (ox < 0 && dx > 0 && dirx < 0 || ox > 0 && dx < 0 && dirx > 0) {
4678
- state._movement[0] = state._movementBound[0];
4679
- }
4680
- if (oy < 0 && dy > 0 && diry < 0 || oy > 0 && dy < 0 && diry > 0) {
4681
- state._movement[1] = state._movementBound[1];
4682
- }
4695
+ clampStateInternalMovementToBounds(state);
4683
4696
  this.compute(event);
4684
4697
  this.emit();
4685
4698
  }
@@ -4990,10 +5003,16 @@ class Controller$1 {
4990
5003
  }
4991
5004
  const nativeBindFunction = bindToProps(props, sharedConfig.eventOptions, !!target);
4992
5005
  for (const eventKey in this.nativeHandlers) {
4993
- nativeBindFunction(eventKey, "", (event) => this.nativeHandlers[eventKey](_objectSpread2(_objectSpread2({}, this.state.shared), {}, {
4994
- event,
4995
- args
4996
- })), void 0, true);
5006
+ nativeBindFunction(
5007
+ eventKey,
5008
+ "",
5009
+ (event) => this.nativeHandlers[eventKey](_objectSpread2(_objectSpread2({}, this.state.shared), {}, {
5010
+ event,
5011
+ args
5012
+ })),
5013
+ void 0,
5014
+ true
5015
+ );
4997
5016
  }
4998
5017
  }
4999
5018
  for (const handlerProp in props) {
@@ -9126,7 +9145,7 @@ const Menu = (props) => {
9126
9145
  }, React__default.Children.toArray(children).map((child, index) => {
9127
9146
  if (!child)
9128
9147
  return null;
9129
- const { disabled, title, value, direction, options: options2 } = child.props;
9148
+ const { disabled, title, value, direction, options: options2, className: className2 } = child.props;
9130
9149
  const currentTitle = options2 == null ? void 0 : options2.filter(
9131
9150
  (option) => option.value === value
9132
9151
  );
@@ -9143,7 +9162,7 @@ const Menu = (props) => {
9143
9162
  className: `nut-menu__item ${classNames({
9144
9163
  active: itemShow[index],
9145
9164
  disabled
9146
- })}`,
9165
+ })} ${className2}`,
9147
9166
  style: { color: itemShow[index] ? activeColor : "" },
9148
9167
  key: index,
9149
9168
  onClick: () => {
@@ -9184,7 +9203,6 @@ const MenuItem = (props) => {
9184
9203
  useConfig();
9185
9204
  const mergedProps = { ...defaultProps$Z, ...props };
9186
9205
  const {
9187
- className,
9188
9206
  style,
9189
9207
  options: options2,
9190
9208
  value,
@@ -9268,7 +9286,7 @@ const MenuItem = (props) => {
9268
9286
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", {
9269
9287
  className: `placeholder-element ${classNames({
9270
9288
  up: direction === "up"
9271
- })} ${className}`,
9289
+ })}`,
9272
9290
  style: placeholderStyle(),
9273
9291
  onClick: () => parent.toggleItemShow(orderKey)
9274
9292
  }), /* @__PURE__ */ React__default.createElement(Overlay, {
@@ -10838,13 +10856,22 @@ const defaultProps$V = {
10838
10856
  checkedValue: [],
10839
10857
  max: void 0,
10840
10858
  onChange: (value) => {
10841
- }
10859
+ },
10860
+ options: []
10842
10861
  };
10843
10862
  const CheckboxGroup = React__default.forwardRef(
10844
10863
  (props, ref) => {
10845
10864
  const { children } = { ...defaultProps$V, ...props };
10846
10865
  const b2 = cn("checkboxgroup");
10847
- const { className, disabled, onChange, checkedValue, max, ...rest } = props;
10866
+ const {
10867
+ className,
10868
+ disabled,
10869
+ onChange,
10870
+ checkedValue,
10871
+ max,
10872
+ options: options2,
10873
+ ...rest
10874
+ } = props;
10848
10875
  const [innerDisabled, setInnerDisabled] = useState(disabled);
10849
10876
  const [innerValue, setInnerValue] = useState(checkedValue);
10850
10877
  useImperativeHandle(ref, () => ({
@@ -10896,6 +10923,11 @@ const CheckboxGroup = React__default.forwardRef(
10896
10923
  return false;
10897
10924
  return (innerValue == null ? void 0 : innerValue.indexOf(child.props.label || child.children)) > -1;
10898
10925
  }
10926
+ function validateChecked(value) {
10927
+ if (innerValue === null)
10928
+ return false;
10929
+ return innerValue === value;
10930
+ }
10899
10931
  function getParentVals() {
10900
10932
  return innerValue;
10901
10933
  }
@@ -10914,10 +10946,26 @@ const CheckboxGroup = React__default.forwardRef(
10914
10946
  });
10915
10947
  });
10916
10948
  }
10949
+ const renderOptionsChildren = useCallback(() => {
10950
+ return options2 == null ? void 0 : options2.map(({ label, value, disabled: disabled2, onChange: onChange2, ...rest2 }) => {
10951
+ const childChecked = validateChecked(value);
10952
+ return /* @__PURE__ */ React__default.createElement(Checkbox, {
10953
+ key: value == null ? void 0 : value.toString(),
10954
+ children: label,
10955
+ label: value,
10956
+ disabled: innerDisabled ? true : disabled2,
10957
+ onChange: handleChildChange,
10958
+ ...rest2,
10959
+ max,
10960
+ getParentVals,
10961
+ checked: childChecked
10962
+ });
10963
+ });
10964
+ }, [innerValue]);
10917
10965
  return /* @__PURE__ */ React__default.createElement("div", {
10918
10966
  className: `${b2()} ${className || ""}`,
10919
10967
  ...rest
10920
- }, cloneChildren());
10968
+ }, (options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : cloneChildren());
10921
10969
  }
10922
10970
  );
10923
10971
  CheckboxGroup.defaultProps = defaultProps$V;
@@ -11957,6 +12005,7 @@ function formatNumber(value, allowDot = true, allowMinus = true) {
11957
12005
  const defaultProps$R = {
11958
12006
  ...ComponentDefaults,
11959
12007
  type: "text",
12008
+ name: "",
11960
12009
  defaultValue: "",
11961
12010
  placeholder: "",
11962
12011
  label: "",
@@ -11989,11 +12038,12 @@ const defaultProps$R = {
11989
12038
  slotButton: null,
11990
12039
  slotInput: null
11991
12040
  };
11992
- const Input = (props) => {
12041
+ const Input = forwardRef((props, ref) => {
11993
12042
  const { locale } = useConfig();
11994
12043
  const {
11995
12044
  children,
11996
12045
  type,
12046
+ name,
11997
12047
  defaultValue,
11998
12048
  placeholder,
11999
12049
  label,
@@ -12073,6 +12123,9 @@ const Input = (props) => {
12073
12123
  resetValidation();
12074
12124
  }
12075
12125
  }, [inputValue]);
12126
+ useImperativeHandle(ref, () => {
12127
+ return inputRef.current;
12128
+ });
12076
12129
  const inputClass = useCallback(() => {
12077
12130
  const prefixCls = "nut-input";
12078
12131
  return [
@@ -12204,6 +12257,7 @@ const Input = (props) => {
12204
12257
  handleClickInput(e2);
12205
12258
  }
12206
12259
  }, type === "textarea" ? /* @__PURE__ */ React__default.createElement("textarea", {
12260
+ name,
12207
12261
  className: "input-text",
12208
12262
  ref: inputRef,
12209
12263
  style: {
@@ -12226,6 +12280,7 @@ const Input = (props) => {
12226
12280
  handleInput(e2);
12227
12281
  }
12228
12282
  }) : /* @__PURE__ */ React__default.createElement("input", {
12283
+ name,
12229
12284
  className: "input-text",
12230
12285
  ref: inputRef,
12231
12286
  style: { textAlign: inputAlign },
@@ -12276,7 +12331,7 @@ const Input = (props) => {
12276
12331
  textAlign: errorMessageAlign
12277
12332
  }
12278
12333
  }, errorMessage) : null)));
12279
- };
12334
+ });
12280
12335
  Input.defaultProps = defaultProps$R;
12281
12336
  Input.displayName = "NutInput";
12282
12337
  const radioContext = {
@@ -12289,13 +12344,22 @@ const defaultProps$Q = {
12289
12344
  textPosition: "right",
12290
12345
  onChange: (value) => {
12291
12346
  },
12292
- direction: "vertical"
12347
+ direction: "vertical",
12348
+ options: []
12293
12349
  };
12294
12350
  const RadioGroup = React__default.forwardRef(
12295
12351
  (props, ref) => {
12296
12352
  const { children } = { ...defaultProps$Q, ...props };
12297
12353
  cn("RadioGroup");
12298
- const { className, value, onChange, textPosition, direction, ...rest } = props;
12354
+ const {
12355
+ className,
12356
+ value,
12357
+ onChange,
12358
+ textPosition,
12359
+ direction,
12360
+ options: options2,
12361
+ ...rest
12362
+ } = props;
12299
12363
  const [val2State, setVal2State] = useState(value);
12300
12364
  useEffect(() => {
12301
12365
  setVal2State(value);
@@ -12305,6 +12369,11 @@ const RadioGroup = React__default.forwardRef(
12305
12369
  return false;
12306
12370
  return val2State === child.props.value;
12307
12371
  }
12372
+ function validateChecked(value2) {
12373
+ if (val2State === null)
12374
+ return false;
12375
+ return val2State === value2;
12376
+ }
12308
12377
  function cloneChildren() {
12309
12378
  return React__default.Children.map(children, (child, index) => {
12310
12379
  const childChecked = validateChildChecked(child);
@@ -12317,6 +12386,21 @@ const RadioGroup = React__default.forwardRef(
12317
12386
  });
12318
12387
  });
12319
12388
  }
12389
+ const renderOptionsChildren = useCallback(() => {
12390
+ return options2 == null ? void 0 : options2.map(({ label, value: value2, disabled, onChange: onChange2, ...rest2 }) => {
12391
+ const childChecked = validateChecked(value2);
12392
+ return /* @__PURE__ */ React__default.createElement(Radio, {
12393
+ key: value2 == null ? void 0 : value2.toString(),
12394
+ children: label,
12395
+ value: value2,
12396
+ disabled,
12397
+ onChange: onChange2,
12398
+ ...rest2,
12399
+ textPosition,
12400
+ checked: childChecked
12401
+ });
12402
+ });
12403
+ }, [val2State]);
12320
12404
  return /* @__PURE__ */ React__default.createElement(RadioContext.Provider, {
12321
12405
  value: {
12322
12406
  onChange: (val) => {
@@ -12325,9 +12409,9 @@ const RadioGroup = React__default.forwardRef(
12325
12409
  }
12326
12410
  }
12327
12411
  }, /* @__PURE__ */ React__default.createElement("div", {
12328
- className: `nut-radiogroup nut-radiogroup--${props.direction}`,
12412
+ className: `nut-radiogroup nut-radiogroup--${props.direction} ${className || ""}`,
12329
12413
  ...rest
12330
- }, cloneChildren()));
12414
+ }, (options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : cloneChildren()));
12331
12415
  }
12332
12416
  );
12333
12417
  RadioGroup.defaultProps = defaultProps$Q;
@@ -16097,13 +16181,11 @@ const NoticeBar = (props) => {
16097
16181
  }
16098
16182
  }, n2 * speed);
16099
16183
  };
16100
- const go = (item) => {
16101
- click && click(item);
16102
- onClick && onClick(item);
16103
- };
16104
- const handleClickIcon = () => {
16105
- close && close(scrollList[0]);
16106
- onClose && onClose(scrollList[0]);
16184
+ const handleClickIcon = (event) => {
16185
+ event.stopPropagation();
16186
+ SetShowNoticeBar(!closeMode);
16187
+ close && close(event);
16188
+ onClose && onClose(event);
16107
16189
  };
16108
16190
  const iconShow = () => {
16109
16191
  if (leftIcon === "close") {
@@ -16179,9 +16261,10 @@ const NoticeBar = (props) => {
16179
16261
  fontClassName: iconFontClassName,
16180
16262
  name: rightIcon || "close",
16181
16263
  color
16182
- })) : null) : null, scrollList.current.length > 0 && direction === "vertical" ? /* @__PURE__ */ React__default.createElement("div", {
16264
+ })) : null) : null, showNoticeBar && scrollList.current.length > 0 && direction === "vertical" ? /* @__PURE__ */ React__default.createElement("div", {
16183
16265
  className: "nut-noticebar-vertical",
16184
- style: barStyle
16266
+ style: barStyle,
16267
+ onClick: handleClick2
16185
16268
  }, children ? /* @__PURE__ */ React__default.createElement("div", {
16186
16269
  className: "horseLamp_list",
16187
16270
  style: horseLampStyle
@@ -16194,20 +16277,17 @@ const NoticeBar = (props) => {
16194
16277
  return /* @__PURE__ */ React__default.createElement("li", {
16195
16278
  className: "horseLamp_list_item",
16196
16279
  style: { height },
16197
- key: index,
16198
- onClick: () => {
16199
- go(item);
16200
- }
16280
+ key: index
16201
16281
  }, item);
16202
16282
  })), /* @__PURE__ */ React__default.createElement("div", {
16203
16283
  className: "go",
16204
- onClick: () => {
16205
- handleClickIcon();
16284
+ onClick: (e2) => {
16285
+ handleClickIcon(e2);
16206
16286
  }
16207
16287
  }, rightIcon || (closeMode ? /* @__PURE__ */ React__default.createElement(Icon$1, {
16208
16288
  classPrefix: iconClassPrefix,
16209
16289
  fontClassName: iconFontClassName,
16210
- name: "cross",
16290
+ name: rightIcon || "close",
16211
16291
  color,
16212
16292
  size: "11px"
16213
16293
  }) : null))) : null);
@@ -16953,6 +17033,8 @@ const defaultProps$o = {
16953
17033
  symbol: "&yen;",
16954
17034
  decimalDigits: 2,
16955
17035
  thousands: false,
17036
+ position: "before",
17037
+ size: "large",
16956
17038
  className: ""
16957
17039
  };
16958
17040
  const Price = (props) => {
@@ -16962,6 +17044,8 @@ const Price = (props) => {
16962
17044
  symbol,
16963
17045
  decimalDigits,
16964
17046
  thousands,
17047
+ position,
17048
+ size,
16965
17049
  className,
16966
17050
  ...rest
16967
17051
  } = {
@@ -16969,18 +17053,8 @@ const Price = (props) => {
16969
17053
  ...props
16970
17054
  };
16971
17055
  const b2 = cn("price");
16972
- const replaceSpecialChar = (symbol2) => {
16973
- let desSymbol = symbol2;
16974
- desSymbol = symbol2.replace(/&quot;/g, '"');
16975
- desSymbol = symbol2.replace(/&amp;/g, "&");
16976
- desSymbol = symbol2.replace(/&lt;/g, "<");
16977
- desSymbol = symbol2.replace(/&gt;/g, ">");
16978
- desSymbol = symbol2.replace(/&nbsp;/g, " ");
16979
- desSymbol = symbol2.replace(/&yen;/g, "\uFFE5");
16980
- return desSymbol;
16981
- };
16982
17056
  const showSymbol = () => {
16983
- return { __html: (needSymbol ? replaceSpecialChar(symbol) : "") || "" };
17057
+ return { __html: needSymbol ? symbol : "" };
16984
17058
  };
16985
17059
  const checkPoint = (price2) => {
16986
17060
  return String(price2).indexOf(".") > 0;
@@ -17006,7 +17080,7 @@ const Price = (props) => {
17006
17080
  }
17007
17081
  if (checkPoint(decimalNum)) {
17008
17082
  decimalNum = Number(decimalNum).toFixed(decimalDigits);
17009
- decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1];
17083
+ decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1] || 0;
17010
17084
  } else {
17011
17085
  decimalNum = 0;
17012
17086
  }
@@ -17014,19 +17088,22 @@ const Price = (props) => {
17014
17088
  const resultFixed = Number(result).toFixed(decimalDigits);
17015
17089
  return String(resultFixed).substring(2, resultFixed.length);
17016
17090
  };
17091
+ const renderSymbol = () => {
17092
+ return /* @__PURE__ */ React__default.createElement("div", {
17093
+ className: `${b2("symbol")} ${b2(`symbol-${size}`)}`,
17094
+ dangerouslySetInnerHTML: showSymbol()
17095
+ });
17096
+ };
17017
17097
  return /* @__PURE__ */ React__default.createElement("div", {
17018
17098
  className: `${b2()} ${className}`,
17019
17099
  ...rest
17020
- }, needSymbol ? /* @__PURE__ */ React__default.createElement("div", {
17021
- className: `${b2("symbol")}`,
17022
- dangerouslySetInnerHTML: showSymbol()
17023
- }) : null, /* @__PURE__ */ React__default.createElement("div", {
17024
- className: `${b2("big")}`
17025
- }, formatThousands(price)), /* @__PURE__ */ React__default.createElement("div", {
17026
- className: `${b2("point")}`
17027
- }, "."), /* @__PURE__ */ React__default.createElement("div", {
17028
- className: `${b2("small")}`
17029
- }, formatDecimal(price)));
17100
+ }, needSymbol && position === "before" ? renderSymbol() : null, /* @__PURE__ */ React__default.createElement("div", {
17101
+ className: `${b2("integer")} ${b2(`integer-${size}`)}`
17102
+ }, formatThousands(price)), decimalDigits !== 0 ? /* @__PURE__ */ React__default.createElement("div", {
17103
+ className: `${b2("decimal")} ${b2(`decimal-${size}`)}`
17104
+ }, ".") : null, /* @__PURE__ */ React__default.createElement("div", {
17105
+ className: `${b2("decimal")} ${b2(`decimal-${size}`)}`
17106
+ }, formatDecimal(price)), needSymbol && position === "after" ? renderSymbol() : null);
17030
17107
  };
17031
17108
  Price.defaultProps = defaultProps$o;
17032
17109
  Price.displayName = "NutPrice";
@@ -17109,6 +17186,8 @@ const defaultProps$m = {
17109
17186
  };
17110
17187
  const Tag = (props) => {
17111
17188
  const {
17189
+ className,
17190
+ style,
17112
17191
  color,
17113
17192
  plain,
17114
17193
  type,
@@ -17157,23 +17236,23 @@ const Tag = (props) => {
17157
17236
  }
17158
17237
  };
17159
17238
  const getStyle = () => {
17160
- const style = {};
17239
+ const style2 = {};
17161
17240
  if (textColor) {
17162
- style.color = textColor;
17241
+ style2.color = textColor;
17163
17242
  if (plain) {
17164
- style.background = "#fff";
17243
+ style2.background = "#fff";
17165
17244
  } else if (color) {
17166
- style.background = color;
17245
+ style2.background = color;
17167
17246
  }
17168
17247
  } else if (color) {
17169
- style.color = "#fff";
17170
- style.background = color;
17248
+ style2.color = "#fff";
17249
+ style2.background = color;
17171
17250
  }
17172
- return style;
17251
+ return style2;
17173
17252
  };
17174
17253
  return /* @__PURE__ */ React__default.createElement("div", null, closeable ? isTagShow && /* @__PURE__ */ React__default.createElement("div", {
17175
- className: `${btnName}`,
17176
- style: getStyle(),
17254
+ className: `${btnName} ${className}`,
17255
+ style: { ...style, ...getStyle() },
17177
17256
  onClick: (e2) => handleClick2(e2)
17178
17257
  }, children && /* @__PURE__ */ React__default.createElement("span", {
17179
17258
  className: "text"
@@ -17190,8 +17269,8 @@ const Tag = (props) => {
17190
17269
  }
17191
17270
  }
17192
17271
  })) : /* @__PURE__ */ React__default.createElement("div", {
17193
- className: `${btnName}`,
17194
- style: getStyle(),
17272
+ className: `${btnName} ${className}`,
17273
+ style: { ...style, ...getStyle() },
17195
17274
  onClick: (e2) => handleClick2(e2)
17196
17275
  }, children && /* @__PURE__ */ React__default.createElement("span", {
17197
17276
  className: "text"