@nutui/nutui-react 2.3.6 → 2.3.7

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 (88) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/Address/style/style.css +1 -1
  3. package/dist/esm/Cascader/style/style.css +1 -1
  4. package/dist/esm/CheckboxGroup.js +16 -5
  5. package/dist/esm/CircleProgress/style/style.css +1 -1
  6. package/dist/esm/Dialog/style/style.css +1 -1
  7. package/dist/esm/Dialog.js +25 -4
  8. package/dist/esm/ImagePreview/style/style.css +1 -1
  9. package/dist/esm/ImagePreview.js +8 -2
  10. package/dist/esm/NumberKeyboard.js +4 -3
  11. package/dist/esm/Popover/style/style.css +1 -1
  12. package/dist/esm/Popover.js +61 -57
  13. package/dist/esm/Table/style/style.css +1 -1
  14. package/dist/esm/Table.js +1 -1
  15. package/dist/esm/Tabs/style/style.css +1 -1
  16. package/dist/esm/Tour/style/style.css +1 -1
  17. package/dist/esm/Uploader/style/style.css +1 -1
  18. package/dist/esm/Uploader.js +1 -1
  19. package/dist/esm/checkbox2.js +0 -4
  20. package/dist/esm/get-scroll-parent.js +16 -0
  21. package/dist/esm/tabs2.js +2 -4
  22. package/dist/esm/types/src/packages/checkbox/checkbox.d.ts +7 -6
  23. package/dist/esm/types/src/packages/checkbox/checkbox.taro.d.ts +7 -6
  24. package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.d.ts +3 -2
  25. package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.taro.d.ts +3 -2
  26. package/dist/esm/types/src/packages/checkboxgroup/context.d.ts +3 -1
  27. package/dist/esm/types/src/packages/checkboxgroup/types.d.ts +3 -0
  28. package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
  29. package/dist/esm/types/src/packages/dialog/config.d.ts +9 -6
  30. package/dist/esm/types/src/packages/dialog/confirm.d.ts +3 -3
  31. package/dist/esm/types/src/packages/dialog/content.d.ts +1 -0
  32. package/dist/esm/types/src/packages/dialog/content.taro.d.ts +1 -0
  33. package/dist/esm/types/src/packages/dialog/dialog.d.ts +2 -2
  34. package/dist/esm/types/src/packages/dialog/dialog.taro.d.ts +2 -2
  35. package/dist/esm/types/src/packages/dialog/dialogwrap.d.ts +1 -0
  36. package/dist/esm/types/src/packages/dialog/index.d.ts +1 -0
  37. package/dist/esm/types/src/packages/imagepreview/imagepreview.d.ts +4 -1
  38. package/dist/esm/types/src/packages/imagepreview/imagepreview.taro.d.ts +4 -1
  39. package/dist/esm/types/src/packages/imagepreview/index.d.ts +1 -1
  40. package/dist/esm/types/src/packages/imagepreview/index.taro.d.ts +1 -1
  41. package/dist/esm/types/src/packages/numberkeyboard/numberkeyboard.d.ts +2 -1
  42. package/dist/esm/types/src/packages/numberkeyboard/numberkeyboard.taro.d.ts +2 -1
  43. package/dist/esm/types/src/utils/get-scroll-parent.d.ts +1 -0
  44. package/dist/locales/base.js +1 -1
  45. package/dist/locales/en-US.js +1 -1
  46. package/dist/locales/id-ID.js +1 -1
  47. package/dist/locales/tr-TR.js +1 -1
  48. package/dist/locales/zh-CN.js +1 -1
  49. package/dist/locales/zh-TW.js +1 -1
  50. package/dist/locales/zh-UG.js +1 -1
  51. package/dist/nutui.react.es.js +201 -111
  52. package/dist/nutui.react.umd.js +201 -111
  53. package/dist/packages/circleprogress/circleprogress.scss +3 -1
  54. package/dist/packages/dialog/dialog.scss +25 -0
  55. package/dist/packages/imagepreview/imagepreview.scss +24 -0
  56. package/dist/packages/popover/popover.scss +1 -1
  57. package/dist/packages/table/table.scss +12 -1
  58. package/dist/packages/tabs/tabs.scss +16 -1
  59. package/dist/packages/uploader/uploader.scss +4 -6
  60. package/dist/style.css +1 -1
  61. package/dist/style.mjs +1 -1
  62. package/dist/styles/variables-jmapp.scss +6 -0
  63. package/dist/styles/variables.scss +6 -0
  64. package/dist/types/packages/button/button.d.ts +11 -3
  65. package/dist/types/packages/checkbox/checkbox.d.ts +7 -6
  66. package/dist/types/packages/checkbox/checkbox.taro.d.ts +7 -6
  67. package/dist/types/packages/checkboxgroup/checkboxgroup.d.ts +7 -2
  68. package/dist/types/packages/checkboxgroup/checkboxgroup.taro.d.ts +3 -2
  69. package/dist/types/packages/checkboxgroup/context.d.ts +3 -1
  70. package/dist/types/packages/checkboxgroup/types.d.ts +3 -0
  71. package/dist/types/packages/configprovider/types.d.ts +1 -1
  72. package/dist/types/packages/dialog/config.d.ts +9 -6
  73. package/dist/types/packages/dialog/confirm.d.ts +3 -3
  74. package/dist/types/packages/dialog/content.d.ts +1 -0
  75. package/dist/types/packages/dialog/content.taro.d.ts +1 -0
  76. package/dist/types/packages/dialog/dialog.d.ts +2 -2
  77. package/dist/types/packages/dialog/dialog.taro.d.ts +2 -2
  78. package/dist/types/packages/dialog/dialogwrap.d.ts +1 -0
  79. package/dist/types/packages/dialog/index.d.ts +1 -0
  80. package/dist/types/packages/imagepreview/imagepreview.d.ts +12 -1
  81. package/dist/types/packages/imagepreview/imagepreview.taro.d.ts +4 -1
  82. package/dist/types/packages/imagepreview/index.d.ts +1 -1
  83. package/dist/types/packages/imagepreview/index.taro.d.ts +1 -1
  84. package/dist/types/packages/numberkeyboard/numberkeyboard.d.ts +7 -2
  85. package/dist/types/packages/numberkeyboard/numberkeyboard.taro.d.ts +2 -1
  86. package/dist/types/packages/space/space.d.ts +1 -1
  87. package/dist/types/utils/get-scroll-parent.d.ts +1 -0
  88. package/package.json +1 -1
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
8
8
  return value;
9
9
  };
10
10
  /*!
11
- * @nutui/nutui-react v2.3.6 Fri Jan 12 2024 15:48:36 GMT+0800 (China Standard Time)
11
+ * @nutui/nutui-react v2.3.7 Fri Jan 19 2024 16:33:26 GMT+0800 (China Standard Time)
12
12
  * (c) 2023 @jdf2e.
13
13
  * Released under the MIT License.
14
14
  */
@@ -4431,6 +4431,20 @@ Check the top-level render call using <` + t2 + ">.");
4431
4431
  }
4432
4432
  return root2;
4433
4433
  }
4434
+ function getAllScrollableParents(element, scrollableParents = []) {
4435
+ if (!element) {
4436
+ return scrollableParents;
4437
+ }
4438
+ const isScrollable = element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
4439
+ if (isScrollable) {
4440
+ if (element.nodeName === "HTML") {
4441
+ scrollableParents.push(document);
4442
+ } else {
4443
+ scrollableParents.push(element);
4444
+ }
4445
+ }
4446
+ return getAllScrollableParents(element.parentElement, scrollableParents);
4447
+ }
4434
4448
  let passiveSupported = false;
4435
4449
  if (canUseDom) {
4436
4450
  try {
@@ -11416,7 +11430,9 @@ Please add \`${key}Action\` when creating your handler.`);
11416
11430
  activeType === "line" && /* @__PURE__ */ React.createElement(
11417
11431
  "div",
11418
11432
  {
11419
- className: `${classPrefix$j}-titles-item-line`,
11433
+ className: classNames(`${classPrefix$j}-titles-item-line`, {
11434
+ [`${classPrefix$j}-titles-item-line-${direction}`]: true
11435
+ }),
11420
11436
  style: tabsActiveStyle
11421
11437
  }
11422
11438
  ),
@@ -11432,9 +11448,7 @@ Please add \`${key}Action\` when creating your handler.`);
11432
11448
  "div",
11433
11449
  {
11434
11450
  className: classNames(
11435
- {
11436
- ellipsis: true
11437
- },
11451
+ `${classPrefix$j}-ellipsis`,
11438
11452
  `${classPrefix$j}-titles-item-text`
11439
11453
  )
11440
11454
  },
@@ -13616,28 +13630,33 @@ Please add \`${key}Action\` when creating your handler.`);
13616
13630
  const Context$1 = CheckboxGroupContext;
13617
13631
  const defaultProps$$ = {
13618
13632
  max: void 0,
13633
+ min: void 0,
13619
13634
  labelPosition: "right",
13620
13635
  direction: "vertical",
13621
13636
  onChange: (value) => {
13622
13637
  },
13638
+ onLimit: (type2) => {
13639
+ },
13623
13640
  options: []
13624
13641
  };
13625
13642
  const classPrefix$i = "nut-checkboxgroup";
13626
13643
  const CheckboxGroup = React.forwardRef(
13627
13644
  (props, ref) => {
13628
- const { children } = { ...defaultProps$$, ...props };
13629
13645
  const {
13646
+ children,
13630
13647
  className,
13631
13648
  disabled,
13632
13649
  onChange,
13633
13650
  value,
13634
13651
  defaultValue,
13635
13652
  max,
13653
+ min,
13654
+ onLimit,
13636
13655
  labelPosition,
13637
13656
  direction,
13638
13657
  options: options2,
13639
13658
  ...rest
13640
- } = props;
13659
+ } = { ...defaultProps$$, ...props };
13641
13660
  React.useImperativeHandle(ref, () => ({
13642
13661
  toggle(state) {
13643
13662
  if (state === false) {
@@ -13682,7 +13701,7 @@ Please add \`${key}Action\` when creating your handler.`);
13682
13701
  }
13683
13702
  );
13684
13703
  });
13685
- }, [options2, max]);
13704
+ }, [options2, max, min]);
13686
13705
  return /* @__PURE__ */ React.createElement(
13687
13706
  Context$1.Provider,
13688
13707
  {
@@ -13690,13 +13709,22 @@ Please add \`${key}Action\` when creating your handler.`);
13690
13709
  labelPosition: labelPosition || "right",
13691
13710
  disabled,
13692
13711
  max,
13712
+ onLimit,
13693
13713
  value: _value,
13694
13714
  check: (value2) => {
13695
13715
  const combined = [..._value, value2];
13716
+ if (max !== void 0) {
13717
+ if (combined.length > max) {
13718
+ return onLimit == null ? void 0 : onLimit("max");
13719
+ }
13720
+ }
13696
13721
  setValue(combined);
13697
13722
  },
13698
13723
  uncheck: (value2) => {
13699
13724
  const reduced = _value.filter((item) => item !== value2);
13725
+ if (min !== void 0 && reduced.length < min) {
13726
+ return onLimit == null ? void 0 : onLimit("min");
13727
+ }
13700
13728
  setValue(reduced);
13701
13729
  }
13702
13730
  }
@@ -13835,10 +13863,6 @@ Please add \`${key}Action\` when creating your handler.`);
13835
13863
  if (disabled)
13836
13864
  return;
13837
13865
  const latestChecked = !innerChecked;
13838
- if (ctx2 && ctx2.max !== void 0) {
13839
- if (latestChecked && ctx2.value.length >= ctx2.max)
13840
- return;
13841
- }
13842
13866
  setChecked(latestChecked);
13843
13867
  };
13844
13868
  const renderButton = () => {
@@ -17022,6 +17046,7 @@ Please add \`${key}Action\` when creating your handler.`);
17022
17046
  const defaultProps$R = {
17023
17047
  ...ComponentDefaults,
17024
17048
  visible: false,
17049
+ rightActions: "",
17025
17050
  type: "default",
17026
17051
  custom: [],
17027
17052
  random: false,
@@ -17032,6 +17057,7 @@ Please add \`${key}Action\` when creating your handler.`);
17032
17057
  const { locale } = useConfig();
17033
17058
  const {
17034
17059
  title,
17060
+ rightActions,
17035
17061
  confirmText,
17036
17062
  visible,
17037
17063
  type: type2,
@@ -17147,7 +17173,7 @@ Please add \`${key}Action\` when creating your handler.`);
17147
17173
  className: `${classPrefix2}-header-close`,
17148
17174
  onClick: onConfirm
17149
17175
  },
17150
- locale.done
17176
+ rightActions || locale.done
17151
17177
  )), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-body` }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-body-keys` }, keysList == null ? void 0 : keysList.map((item) => {
17152
17178
  return /* @__PURE__ */ React.createElement(NumberKeyboardKey, { key: item.id, item });
17153
17179
  })), type2 === "rightColumn" && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-sidebar` }, /* @__PURE__ */ React.createElement(
@@ -18578,7 +18604,7 @@ Please add \`${key}Action\` when creating your handler.`);
18578
18604
  className: `nut-uploader-preview ${previewType}`,
18579
18605
  key: item.uid
18580
18606
  },
18581
- previewType === "picture" && deletable && /* @__PURE__ */ React.createElement(
18607
+ previewType === "picture" && !children && deletable && /* @__PURE__ */ React.createElement(
18582
18608
  o$3,
18583
18609
  {
18584
18610
  color: "rgba(0,0,0,0.6)",
@@ -19202,7 +19228,16 @@ Please add \`${key}Action\` when creating your handler.`);
19202
19228
  };
19203
19229
  const confirm$1 = confirm;
19204
19230
  const Content = (props) => {
19205
- const { visible, title, header, footer, footerDirection, onClick, children } = props;
19231
+ const {
19232
+ visible,
19233
+ title,
19234
+ header,
19235
+ footer,
19236
+ close,
19237
+ footerDirection,
19238
+ onClick,
19239
+ children
19240
+ } = props;
19206
19241
  const classPrefix2 = "nut-dialog";
19207
19242
  const renderHeader = () => {
19208
19243
  return title ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-header` }, title) : null;
@@ -19228,6 +19263,7 @@ Please add \`${key}Action\` when creating your handler.`);
19228
19263
  style: props.style,
19229
19264
  onClick: (e2) => handleClick2(e2)
19230
19265
  },
19266
+ close,
19231
19267
  header,
19232
19268
  /* @__PURE__ */ React.createElement(
19233
19269
  "div",
@@ -19308,6 +19344,8 @@ Please add \`${key}Action\` when creating your handler.`);
19308
19344
  disableConfirmButton: false,
19309
19345
  footerDirection: "horizontal",
19310
19346
  lockScroll: true,
19347
+ closeIconPosition: "top-right",
19348
+ closeIcon: false,
19311
19349
  beforeCancel: () => true,
19312
19350
  beforeClose: () => true
19313
19351
  };
@@ -19323,6 +19361,8 @@ Please add \`${key}Action\` when creating your handler.`);
19323
19361
  closeOnOverlayClick,
19324
19362
  confirmText,
19325
19363
  cancelText,
19364
+ closeIconPosition,
19365
+ closeIcon,
19326
19366
  onClose,
19327
19367
  onCancel,
19328
19368
  onConfirm,
@@ -19369,6 +19409,23 @@ Please add \`${key}Action\` when creating your handler.`);
19369
19409
  confirmText || locale.confirm
19370
19410
  ));
19371
19411
  };
19412
+ const renderCloseIcon = () => {
19413
+ if (!closeIcon)
19414
+ return null;
19415
+ const handleCancel = () => {
19416
+ if (!(beforeCancel == null ? void 0 : beforeCancel()))
19417
+ return;
19418
+ if (!(beforeClose == null ? void 0 : beforeClose()))
19419
+ return;
19420
+ onClose == null ? void 0 : onClose();
19421
+ onCancel == null ? void 0 : onCancel();
19422
+ };
19423
+ const closeClasses = classNames({
19424
+ [`${classPrefix2}-close`]: true,
19425
+ [`${classPrefix2}-close-${closeIconPosition}`]: true
19426
+ });
19427
+ return /* @__PURE__ */ React.createElement("div", { className: closeClasses, onClick: handleCancel }, React.isValidElement(closeIcon) ? closeIcon : /* @__PURE__ */ React.createElement(r$2, null));
19428
+ };
19372
19429
  return /* @__PURE__ */ React.createElement("div", { style: { display: visible ? "block" : "none" } }, /* @__PURE__ */ React.createElement(
19373
19430
  DialogWrap,
19374
19431
  {
@@ -19376,6 +19433,7 @@ Please add \`${key}Action\` when creating your handler.`);
19376
19433
  visible,
19377
19434
  lockScroll,
19378
19435
  footer: renderFooter(),
19436
+ close: renderCloseIcon(),
19379
19437
  onClose,
19380
19438
  onCancel
19381
19439
  }
@@ -20359,8 +20417,6 @@ Please add \`${key}Action\` when creating your handler.`);
20359
20417
  const popoverRef = React.useRef(null);
20360
20418
  const popoverContentRef = React.useRef(null);
20361
20419
  const [showPopup, setShowPopup] = React.useState(false);
20362
- const [elWidth, setElWidth] = React.useState(0);
20363
- const [elHeight, setElHeight] = React.useState(0);
20364
20420
  const [rootPosition, setRootPosition] = React.useState();
20365
20421
  React.useEffect(() => {
20366
20422
  setShowPopup(visible);
@@ -20369,19 +20425,34 @@ Please add \`${key}Action\` when creating your handler.`);
20369
20425
  getContentWidth();
20370
20426
  }, 0);
20371
20427
  }
20428
+ }, [visible, location]);
20429
+ const update2 = React.useRef((e2) => {
20430
+ getContentWidth();
20431
+ });
20432
+ React.useEffect(() => {
20433
+ if (visible) {
20434
+ scrollableParents.forEach((parent) => {
20435
+ parent.addEventListener("scroll", update2.current, { passive: true });
20436
+ });
20437
+ } else {
20438
+ scrollableParents.forEach(
20439
+ (parent) => parent.removeEventListener("scroll", update2.current)
20440
+ );
20441
+ }
20372
20442
  }, [visible]);
20373
- let element;
20374
- if (canUseDom) {
20375
- element = targetId && document.querySelector(`#${targetId}`);
20443
+ let element = null;
20444
+ let targetSet = [];
20445
+ if (canUseDom && targetId) {
20446
+ element = document.querySelector(`#${targetId}`);
20447
+ targetSet = [element, popoverContentRef.current];
20448
+ } else {
20449
+ targetSet = [popoverRef.current, popoverContentRef.current];
20376
20450
  }
20377
- const targetSet = [
20378
- targetId ? element : popoverRef.current,
20379
- popoverContentRef.current
20380
- ];
20381
20451
  useClickAway(
20382
20452
  () => {
20383
- props.onClick && props.onClick();
20384
- onClose && onClose();
20453
+ var _a2;
20454
+ (_a2 = props.onClick) == null ? void 0 : _a2.call(props);
20455
+ onClose == null ? void 0 : onClose();
20385
20456
  },
20386
20457
  targetSet,
20387
20458
  "touchstart",
@@ -20389,37 +20460,20 @@ Please add \`${key}Action\` when creating your handler.`);
20389
20460
  visible,
20390
20461
  closeOnOutsideClick
20391
20462
  );
20463
+ const scrollableParents = React.useMemo(() => {
20464
+ return getAllScrollableParents(element || popoverRef.current);
20465
+ }, [element, popoverRef.current]);
20392
20466
  const getContentWidth = () => {
20393
- let rect = getRect(popoverRef.current);
20394
- const scrollDis = document.documentElement.scrollTop || window.scrollY;
20395
- if (targetId) {
20396
- setTimeout(() => {
20397
- rect = getRect(document.querySelector(`#${targetId}`));
20398
- setRootPosition({
20399
- width: rect.width,
20400
- height: rect.height,
20401
- left: rect.left,
20402
- top: rect.top + scrollDis,
20403
- right: rect.right
20404
- });
20405
- if (popoverContentRef.current) {
20406
- setElWidth(popoverContentRef.current.clientWidth);
20407
- setElHeight(popoverContentRef.current.clientHeight);
20408
- }
20409
- }, 0);
20410
- } else {
20411
- setRootPosition({
20412
- width: rect.width,
20413
- height: rect.height,
20414
- left: rect.left,
20415
- top: rect.top + scrollDis,
20416
- right: rect.right
20417
- });
20418
- if (popoverContentRef.current) {
20419
- setElWidth(popoverContentRef.current.clientWidth);
20420
- setElHeight(popoverContentRef.current.clientHeight);
20421
- }
20422
- }
20467
+ const rect = getRect(
20468
+ targetId ? document.querySelector(`#${targetId}`) : popoverRef.current
20469
+ );
20470
+ setRootPosition({
20471
+ width: rect.width,
20472
+ height: rect.height,
20473
+ left: rect.left,
20474
+ top: rect.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop),
20475
+ right: rect.right
20476
+ });
20423
20477
  };
20424
20478
  const classes = classNames(
20425
20479
  {
@@ -20429,16 +20483,16 @@ Please add \`${key}Action\` when creating your handler.`);
20429
20483
  );
20430
20484
  const popoverArrow = () => {
20431
20485
  const prefixCls2 = "nut-popover-arrow";
20432
- const loca = location;
20433
- const direction = loca.split("-")[0];
20434
- return `${prefixCls2} ${prefixCls2}-${direction} ${prefixCls2}-${loca}`;
20486
+ const direction = location.split("-")[0];
20487
+ return `${prefixCls2} ${prefixCls2}-${direction} ${prefixCls2}-${location}`;
20435
20488
  };
20436
20489
  const getRootPosition = () => {
20490
+ var _a2, _b;
20437
20491
  const styles = {};
20438
20492
  if (!rootPosition)
20439
20493
  return {};
20440
- const contentWidth = elWidth;
20441
- const contentHeight = elHeight;
20494
+ const contentWidth = (_a2 = popoverContentRef.current) == null ? void 0 : _a2.clientWidth;
20495
+ const contentHeight = (_b = popoverContentRef.current) == null ? void 0 : _b.clientHeight;
20442
20496
  const { width, height, left, top, right } = rootPosition;
20443
20497
  const direction = location.split("-")[0];
20444
20498
  const skew = location.split("-")[1];
@@ -20478,7 +20532,7 @@ Please add \`${key}Action\` when creating your handler.`);
20478
20532
  }
20479
20533
  return styles;
20480
20534
  };
20481
- const popoverArrowStyle = () => {
20535
+ const arrowStyle = () => {
20482
20536
  const styles = {};
20483
20537
  const direction = location.split("-")[0];
20484
20538
  const skew = location.split("-")[1];
@@ -20510,12 +20564,13 @@ Please add \`${key}Action\` when creating your handler.`);
20510
20564
  return styles;
20511
20565
  };
20512
20566
  const handleSelect = (item, index) => {
20567
+ var _a2;
20513
20568
  if (!item.disabled) {
20514
- onSelect && onSelect(item, index);
20569
+ onSelect == null ? void 0 : onSelect(item, index);
20515
20570
  }
20516
20571
  if (closeOnActionClick) {
20517
- props.onClick && props.onClick();
20518
- onClose && onClose();
20572
+ (_a2 = props.onClick) == null ? void 0 : _a2.call(props);
20573
+ onClose == null ? void 0 : onClose();
20519
20574
  }
20520
20575
  };
20521
20576
  return /* @__PURE__ */ React.createElement(React.Fragment, null, !targetId && /* @__PURE__ */ React.createElement(
@@ -20524,55 +20579,69 @@ Please add \`${key}Action\` when creating your handler.`);
20524
20579
  className: "nut-popover-wrapper",
20525
20580
  ref: popoverRef,
20526
20581
  onClick: () => {
20527
- props.onClick && props.onClick();
20582
+ var _a2;
20583
+ (_a2 = props.onClick) == null ? void 0 : _a2.call(props);
20528
20584
  if (!visible) {
20529
- onOpen && onOpen();
20585
+ onOpen == null ? void 0 : onOpen();
20530
20586
  } else {
20531
- onClose && onClose();
20587
+ onClose == null ? void 0 : onClose();
20532
20588
  }
20533
20589
  },
20534
20590
  style
20535
20591
  },
20536
20592
  Array.isArray(children) ? children[0] : children
20537
- ), /* @__PURE__ */ React.createElement("div", { className: classes, style: getRootPosition() }, /* @__PURE__ */ React.createElement(
20538
- Popup,
20539
- {
20540
- className: `nut-popover-content nut-popover-content-${location}`,
20541
- visible: showPopup,
20542
- overlay,
20543
- position: "default",
20544
- ...rest
20545
- },
20546
- /* @__PURE__ */ React.createElement("div", { className: "nut-popover-content-group", ref: popoverContentRef }, showArrow && /* @__PURE__ */ React.createElement("div", { className: popoverArrow(), style: popoverArrowStyle() }), Array.isArray(children) ? children[1] : "", list.map((item, index) => {
20547
- return /* @__PURE__ */ React.createElement(
20593
+ ), ReactDOM.createPortal(
20594
+ /* @__PURE__ */ React.createElement("div", { className: classes, style: getRootPosition() }, /* @__PURE__ */ React.createElement(
20595
+ Popup,
20596
+ {
20597
+ className: `nut-popover-content nut-popover-content-${location}`,
20598
+ visible: showPopup,
20599
+ overlay,
20600
+ position: "default",
20601
+ lockScroll: false,
20602
+ ...rest
20603
+ },
20604
+ /* @__PURE__ */ React.createElement(
20548
20605
  "div",
20549
20606
  {
20550
- className: classNames(
20607
+ className: "nut-popover-content-group",
20608
+ ref: popoverContentRef
20609
+ },
20610
+ showArrow && /* @__PURE__ */ React.createElement("div", { className: popoverArrow(), style: arrowStyle() }),
20611
+ Array.isArray(children) ? children[1] : null,
20612
+ list.map((item, index) => {
20613
+ return /* @__PURE__ */ React.createElement(
20614
+ "div",
20551
20615
  {
20552
- "nut-popover-menu-item": true,
20553
- "nut-popover-menu-disabled": item.disabled
20616
+ className: classNames(
20617
+ {
20618
+ "nut-popover-menu-item": true,
20619
+ "nut-popover-menu-disabled": item.disabled
20620
+ },
20621
+ item.className
20622
+ ),
20623
+ key: item.key || index,
20624
+ onClick: () => handleSelect(item, index)
20554
20625
  },
20555
- item.className
20556
- ),
20557
- key: item.key || index,
20558
- onClick: () => handleSelect(item, index)
20559
- },
20560
- item.icon ? /* @__PURE__ */ React.createElement("div", { className: "nut-popover-menu-item-icon" }, item.icon) : null,
20561
- /* @__PURE__ */ React.createElement("div", { className: "nut-popover-menu-item-name" }, item.name),
20562
- item.action && item.action.icon ? /* @__PURE__ */ React.createElement(
20563
- "div",
20564
- {
20565
- className: "nut-popover-menu-item-action-icon",
20566
- onClick: (e2) => {
20567
- var _a2, _b;
20568
- return (_b = (_a2 = item.action) == null ? void 0 : _a2.onClick) == null ? void 0 : _b.call(_a2, e2);
20569
- }
20570
- },
20571
- item.action.icon
20572
- ) : null
20573
- );
20574
- }))
20575
- )));
20626
+ item.icon ? /* @__PURE__ */ React.createElement("div", { className: "nut-popover-menu-item-icon" }, item.icon) : null,
20627
+ /* @__PURE__ */ React.createElement("div", { className: "nut-popover-menu-item-name" }, item.name),
20628
+ item.action && item.action.icon ? /* @__PURE__ */ React.createElement(
20629
+ "div",
20630
+ {
20631
+ className: "nut-popover-menu-item-action-icon",
20632
+ onClick: (e2) => {
20633
+ var _a2, _b;
20634
+ return (_b = (_a2 = item.action) == null ? void 0 : _a2.onClick) == null ? void 0 : _b.call(_a2, e2);
20635
+ }
20636
+ },
20637
+ item.action.icon
20638
+ ) : null
20639
+ );
20640
+ })
20641
+ )
20642
+ )),
20643
+ document.body
20644
+ ));
20576
20645
  };
20577
20646
  Popover.defaultProps = defaultProps$y;
20578
20647
  Popover.displayName = "NutPopover";
@@ -22984,6 +23053,8 @@ Please add \`${key}Action\` when creating your handler.`);
22984
23053
  closeOnContentClick: false,
22985
23054
  indicator: false,
22986
23055
  indicatorColor: "#fff",
23056
+ closeIcon: false,
23057
+ closeIconPosition: "top-right",
22987
23058
  onChange: (value) => {
22988
23059
  },
22989
23060
  onClose: () => {
@@ -23001,6 +23072,8 @@ Please add \`${key}Action\` when creating your handler.`);
23001
23072
  indicator,
23002
23073
  autoPlay,
23003
23074
  closeOnContentClick,
23075
+ closeIcon,
23076
+ closeIconPosition,
23004
23077
  onClose
23005
23078
  } = props;
23006
23079
  const classPrefix2 = "nut-imagepreview";
@@ -23183,7 +23256,15 @@ Please add \`${key}Action\` when creating your handler.`);
23183
23256
  )
23184
23257
  )
23185
23258
  ),
23186
- /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-index` }, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0))
23259
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-index` }, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0)),
23260
+ closeIcon !== false ? /* @__PURE__ */ React.createElement(
23261
+ "div",
23262
+ {
23263
+ className: `${classPrefix2}-close ${closeIconPosition}`,
23264
+ onClick: onCloseInner
23265
+ },
23266
+ closeIcon === true ? /* @__PURE__ */ React.createElement(r$2, null) : closeIcon
23267
+ ) : null
23187
23268
  );
23188
23269
  };
23189
23270
  ImagePreview.defaultProps = defaultProps$f;
@@ -23671,16 +23752,25 @@ Please add \`${key}Action\` when creating your handler.`);
23671
23752
  return /* @__PURE__ */ React.createElement("div", { className: bodyClassPrefix, key: index }, renderBodyTds(item, index));
23672
23753
  });
23673
23754
  };
23674
- return /* @__PURE__ */ React.createElement("div", { className: cls, ...rest }, /* @__PURE__ */ React.createElement("div", { className: classNames(`${classPrefix2}-wrapper`), style }, /* @__PURE__ */ React.createElement(
23755
+ return /* @__PURE__ */ React.createElement("div", { className: cls, ...rest }, /* @__PURE__ */ React.createElement(
23675
23756
  "div",
23676
23757
  {
23677
- className: classNames(`${classPrefix2}-main`, {
23678
- [`${classPrefix2}-main-striped`]: striped
23679
- })
23758
+ className: classNames(
23759
+ `${classPrefix2}-wrapper ${isSticky ? `${classPrefix2}-wrapper-sticky` : ""}`
23760
+ ),
23761
+ style
23680
23762
  },
23681
- showHeader && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-main-head` }, /* @__PURE__ */ React.createElement("div", { className: headerClassPrefix }, renderHeadCells())),
23682
- /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-main-body` }, renderBodyTrs())
23683
- )), isSticky ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
23763
+ /* @__PURE__ */ React.createElement(
23764
+ "div",
23765
+ {
23766
+ className: classNames(`${classPrefix2}-main`, {
23767
+ [`${classPrefix2}-main-striped`]: striped
23768
+ })
23769
+ },
23770
+ showHeader && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-main-head` }, /* @__PURE__ */ React.createElement("div", { className: headerClassPrefix }, renderHeadCells())),
23771
+ /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-main-body` }, renderBodyTrs())
23772
+ )
23773
+ ), isSticky ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
23684
23774
  "div",
23685
23775
  {
23686
23776
  className: `${classPrefix2}-sticky-left`,
@@ -3,7 +3,9 @@
3
3
 
4
4
  &-hover {
5
5
  stroke: $circleprogress-primary-color;
6
- transition: stroke-dasharray 0.6s ease 0s, stroke 0.6s ease 0s;
6
+ transition:
7
+ stroke-dasharray 0.2s ease-in-out 0s,
8
+ stroke 0.2s ease 0s;
7
9
  }
8
10
 
9
11
  &-path {
@@ -32,6 +32,31 @@
32
32
  animation-duration: 0.3s;
33
33
  }
34
34
 
35
+ &-close {
36
+ position: absolute !important;
37
+ z-index: 1;
38
+ cursor: pointer;
39
+ width: $dialog-close-width;
40
+ height: $dialog-close-height;
41
+ display: flex;
42
+ justify-content: center;
43
+ align-items: center;
44
+ top: $dialog-close-top;
45
+ color: $dialog-close-color;
46
+
47
+ &-top-right {
48
+ right: $dialog-close-right;
49
+ }
50
+
51
+ &-top-left {
52
+ left: $dialog-close-left;
53
+ }
54
+
55
+ &:active {
56
+ opacity: 0.7;
57
+ }
58
+ }
59
+
35
60
  &-header {
36
61
  display: block;
37
62
  text-align: center;
@@ -26,6 +26,30 @@
26
26
  }
27
27
  }
28
28
 
29
+ &-close {
30
+ position: fixed;
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ z-index: 2002;
35
+ background: transparent;
36
+ color: $white;
37
+ &.top-right {
38
+ top: 50px;
39
+ right: 20px;
40
+ }
41
+ &.top-left {
42
+ top: 50px;
43
+ left: 20px;
44
+ }
45
+ &.bottom {
46
+ bottom: 50px;
47
+ left: 0;
48
+ right: 0;
49
+ text-align: center;
50
+ }
51
+ }
52
+
29
53
  &-pop {
30
54
  height: 100%;
31
55
  background: transparent !important;
@@ -96,7 +96,7 @@
96
96
  border-bottom: 1px solid $popover-divider-color;
97
97
 
98
98
  &:last-child {
99
- margin-bottom: 2px;
99
+ margin-bottom: 0px;
100
100
  border-bottom: none;
101
101
  }
102
102