wz-h5-design 1.0.4 → 1.0.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.
Files changed (55) hide show
  1. package/dist/Button/style/index.css +1 -1
  2. package/dist/Button/style.css +1 -1
  3. package/dist/ButtonGroup/index.js +1 -1
  4. package/dist/ButtonGroup/index.umd.cjs +1 -1
  5. package/dist/ButtonGroup/style/index.css +1 -1
  6. package/dist/ButtonGroup/style.css +1 -1
  7. package/dist/Cell/style/index.css +1 -1
  8. package/dist/Cell/style.css +1 -1
  9. package/dist/Checkbox/style/index.css +1 -1
  10. package/dist/Checkbox/style.css +1 -1
  11. package/dist/Dialog/style.css +1 -1
  12. package/dist/Divider/style/index.css +1 -1
  13. package/dist/Divider/style.css +1 -1
  14. package/dist/GridView/index.js +26 -2
  15. package/dist/GridView/index.umd.cjs +1 -1
  16. package/dist/GridView/style/index.css +1 -1
  17. package/dist/GridView/style.css +1 -1
  18. package/dist/Input/index.js +47 -5
  19. package/dist/Input/index.umd.cjs +1 -1
  20. package/dist/Input/style/index.css +1 -1
  21. package/dist/Input/style.css +1 -1
  22. package/dist/Popup/style/index.css +1 -1
  23. package/dist/Popup/style.css +1 -1
  24. package/dist/Radio/style/index.css +1 -1
  25. package/dist/Radio/style.css +1 -1
  26. package/dist/Search/index.js +10 -2
  27. package/dist/Search/index.umd.cjs +1 -1
  28. package/dist/Search/style/index.css +1 -1
  29. package/dist/Search/style.css +1 -1
  30. package/dist/Switch/index.js +10 -3
  31. package/dist/Switch/index.umd.cjs +1 -1
  32. package/dist/Switch/style/index.css +1 -1
  33. package/dist/Switch/style.css +1 -1
  34. package/dist/Tabbar/index.js +6 -3
  35. package/dist/Tabbar/index.umd.cjs +1 -1
  36. package/dist/Tabbar/style/index.css +1 -1
  37. package/dist/Tabbar/style.css +1 -1
  38. package/dist/Tabs/index.js +57 -17
  39. package/dist/Tabs/index.umd.cjs +1 -1
  40. package/dist/Tabs/style/index.css +1 -1
  41. package/dist/Tabs/style.css +1 -1
  42. package/dist/Tooltip/index.js +59 -14
  43. package/dist/Tooltip/index.umd.cjs +2 -2
  44. package/dist/Tooltip/style/index.css +1 -1
  45. package/dist/Tooltip/style.css +1 -1
  46. package/dist/style.css +1 -1
  47. package/dist/types/components/GridView/GridView.d.ts +8 -0
  48. package/dist/types/components/Input/Input.d.ts +11 -1
  49. package/dist/types/components/Search/Search.d.ts +1 -0
  50. package/dist/types/components/Tabbar/Tabbar.d.ts +2 -0
  51. package/dist/types/components/Tabs/Tabs.d.ts +4 -1
  52. package/dist/types/components/Tooltip/Tooltip.d.ts +6 -2
  53. package/dist/wz-h5-design.es.js +186 -44
  54. package/dist/wz-h5-design.umd.js +2 -2
  55. package/package.json +1 -1
@@ -5,8 +5,16 @@ export interface GridViewItemProps {
5
5
  icon?: React.ReactNode;
6
6
  /** 文本内容 */
7
7
  text?: React.ReactNode;
8
+ /** 文本颜色 */
9
+ textColor?: string;
10
+ /** 文本大小 */
11
+ textSize?: number | string;
8
12
  /** 描述文本 */
9
13
  description?: React.ReactNode;
14
+ /** 描述文本颜色 */
15
+ descriptionColor?: string;
16
+ /** 描述文本大小 */
17
+ descriptionSize?: number | string;
10
18
  /** 徽章内容 */
11
19
  badge?: React.ReactNode;
12
20
  /** 角标内容 */
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "./Input.scss";
3
- type InputTypes = "text" | "password" | "textarea" | "number";
3
+ type InputTypes = "text" | "password" | "textarea" | "number" | "code";
4
4
  export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
5
5
  clearable?: boolean;
6
6
  align?: "left" | "center" | "right";
@@ -12,6 +12,16 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
12
12
  borderRadius?: string;
13
13
  backgroundColor?: string;
14
14
  bordered?: true;
15
+ /** 验证码倒计时秒数,默认60秒 */
16
+ codeCountdown?: number;
17
+ /** 点击获取验证码回调 */
18
+ onGetCode?: () => void | Promise<void>;
19
+ /** 获取验证码按钮文字 */
20
+ codeText?: string;
21
+ /** 倒计时中的文字,{s}会被替换为秒数 */
22
+ codeCountingText?: string;
23
+ /** 重新获取验证码文字 */
24
+ codeResendText?: string;
15
25
  }
16
26
  export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
17
27
  export {};
@@ -11,6 +11,7 @@ export interface SearchProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
11
11
  suffix?: React.ReactNode;
12
12
  leftIcon?: React.ReactNode;
13
13
  actionText?: React.ReactNode;
14
+ actionColor?: string;
14
15
  showCancel?: boolean;
15
16
  cancelText?: React.ReactNode;
16
17
  background?: string;
@@ -13,6 +13,8 @@ export interface TabbarItemProps {
13
13
  badge?: React.ReactNode;
14
14
  /** 将徽标渲染为气泡样式 */
15
15
  badgeAsBubble?: boolean;
16
+ /** 是否只显示小红点(无内容) */
17
+ dot?: boolean;
16
18
  /** 自定义激活状态下图标和文字颜色 */
17
19
  activeColor?: string;
18
20
  /** 是否为特殊突起按钮 */
@@ -7,7 +7,8 @@ export interface TabPaneProps {
7
7
  badge?: ReactNode;
8
8
  }
9
9
  export interface TabsProps {
10
- type?: 'line' | 'card' | 'pills';
10
+ type?: 'line' | 'card' | 'text';
11
+ align?: 'center' | 'left';
11
12
  value?: number;
12
13
  defaultValue?: number;
13
14
  onChange?: (index: number) => void;
@@ -18,6 +19,8 @@ export interface TabsProps {
18
19
  contentClassName?: string;
19
20
  contentStyle?: React.CSSProperties;
20
21
  children: ReactNode;
22
+ /** 最大标签数量,默认5 */
23
+ maxTabs?: number;
21
24
  }
22
25
  export declare const TabPane: React.FC<TabPaneProps>;
23
26
  export declare const Tabs: React.FC<TabsProps> & {
@@ -11,7 +11,11 @@ export interface TooltipProps {
11
11
  visible?: boolean;
12
12
  onVisibleChange?: (visible: boolean) => void;
13
13
  showMask?: boolean;
14
- action?: React.ReactNode;
15
- closeIcon?: React.ReactNode;
14
+ /** 操作按钮文字 */
15
+ actionText?: string;
16
+ /** 操作按钮点击回调 */
17
+ onAction?: () => void;
18
+ /** 是否显示关闭按钮 */
19
+ closable?: boolean;
16
20
  }
17
21
  export declare const Tooltip: FC<TooltipProps>;
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import React, { forwardRef, useState, useRef, useMemo, useContext, createContext, createElement, Children, useEffect, useImperativeHandle, useLayoutEffect } from "react";
2
+ import React, { forwardRef, useState, useRef, useMemo, useContext, createContext, createElement, useCallback, Children, useEffect, useImperativeHandle, useLayoutEffect } from "react";
3
3
  import { createRoot } from "react-dom/client";
4
4
  const Button = forwardRef(({
5
5
  type = "primary",
@@ -121,7 +121,7 @@ const ButtonGroup = ({
121
121
  height,
122
122
  padding = "2px 10px",
123
123
  fixed = false,
124
- gap = 12,
124
+ gap = 9,
125
125
  className = "",
126
126
  style = {},
127
127
  children
@@ -356,11 +356,17 @@ const Switch = ({
356
356
  const [innerValue, setInnerValue] = useState(defaultValue);
357
357
  const isControlled = value !== void 0;
358
358
  const checked = isControlled ? value : innerValue;
359
- const text = checked ? activeText || DEFAULT_ACTIVE_TEXT : inactiveText || DEFAULT_INACTIVE_TEXT;
359
+ const activeTextDisplay = activeText || DEFAULT_ACTIVE_TEXT;
360
+ const inactiveTextDisplay = inactiveText || DEFAULT_INACTIVE_TEXT;
361
+ const text = checked ? activeTextDisplay : inactiveTextDisplay;
360
362
  const textWidth = showText ? `${text.length * 12 + 8}px` : "0px";
363
+ const maxTextLen = Math.max(activeTextDisplay.length, inactiveTextDisplay.length);
361
364
  const baseWidth = size === "large" ? 62 : 60;
362
- const switchWidthNum = showText ? text.length * 12 + 40 : baseWidth;
365
+ const calculatedWidth = showText ? maxTextLen * 12 + 40 : baseWidth;
366
+ const switchWidthNum = Math.max(calculatedWidth, baseWidth);
363
367
  const switchWidth = `${switchWidthNum}px`;
368
+ const sliderSize = size === "large" ? 24 : 22;
369
+ const sliderTranslateX = checked ? switchWidthNum - sliderSize - 4 : 0;
364
370
  const onBg = activeColor ? activeColor.includes("gradient") ? activeColor : activeColor : void 0;
365
371
  const handleClick = () => {
366
372
  if (disabled) return;
@@ -379,7 +385,8 @@ const Switch = ({
379
385
  /* @__PURE__ */ jsx(
380
386
  "div",
381
387
  {
382
- className: `wz-switch-slider ${checked ? "wz-switch-slider-on" : "wz-switch-slider-off"}`
388
+ className: `wz-switch-slider ${checked ? "wz-switch-slider-on" : "wz-switch-slider-off"}`,
389
+ style: { transform: `translateX(${sliderTranslateX}px)` }
383
390
  }
384
391
  )
385
392
  ]
@@ -438,14 +445,17 @@ var classnames = { exports: {} };
438
445
  var classnamesExports = classnames.exports;
439
446
  const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
440
447
  const TabbarItem = (props) => {
441
- const { title, icon, activeIcon, badge, badgeAsBubble, hump, active, onItemClick, onClick, activeColor } = props;
448
+ const { title, icon, activeIcon, badge, badgeAsBubble, dot, hump, active, onItemClick, onClick, activeColor } = props;
442
449
  const renderIcon = (iconSource) => {
443
450
  if (typeof iconSource === "string") {
444
- return /* @__PURE__ */ jsx(Icon, { name: iconSource });
451
+ return /* @__PURE__ */ jsx(Icon, { size: 22, name: iconSource });
445
452
  }
446
453
  return iconSource;
447
454
  };
448
455
  const renderBadge = () => {
456
+ if (dot) {
457
+ return /* @__PURE__ */ jsx("div", { className: "wz-tabbar-item-dot" });
458
+ }
449
459
  if (!badge) return null;
450
460
  if (badgeAsBubble) {
451
461
  return /* @__PURE__ */ jsx("div", { className: "wz-tabbar-item-badge-custom", children: /* @__PURE__ */ jsxs("div", { className: "wz-tabbar-item-badge-bubble", children: [
@@ -474,7 +484,7 @@ const TabbarItem = (props) => {
474
484
  active ? renderIcon(activeIcon || icon) : renderIcon(icon),
475
485
  renderBadge()
476
486
  ] }),
477
- /* @__PURE__ */ jsx("div", { className: "wz-tabbar-item-title", children: title })
487
+ !hump && /* @__PURE__ */ jsx("div", { className: "wz-tabbar-item-title", children: title })
478
488
  ] });
479
489
  };
480
490
  const Tabbar = (props) => {
@@ -625,6 +635,7 @@ const TabPane = ({ children }) => {
625
635
  };
626
636
  const Tabs = ({
627
637
  type = "line",
638
+ align = "center",
628
639
  value,
629
640
  defaultValue = 0,
630
641
  onChange,
@@ -634,33 +645,72 @@ const Tabs = ({
634
645
  headerStyle,
635
646
  contentClassName = "",
636
647
  contentStyle,
637
- children
648
+ children,
649
+ maxTabs = 5
638
650
  }) => {
639
651
  const isControlled = value !== void 0;
640
652
  const [innerValue, setInnerValue] = useState(defaultValue);
641
653
  const activeIndex = isControlled ? value : innerValue;
642
- const panes = Children.toArray(children).filter(Boolean);
654
+ const headerRef = useRef(null);
655
+ const isDragging = useRef(false);
656
+ const startX = useRef(0);
657
+ const scrollLeft = useRef(0);
658
+ const handleMouseDown = useCallback((e) => {
659
+ if (align !== "left" || !headerRef.current) return;
660
+ isDragging.current = true;
661
+ startX.current = e.pageX - headerRef.current.offsetLeft;
662
+ scrollLeft.current = headerRef.current.scrollLeft;
663
+ }, [align]);
664
+ const handleMouseMove = useCallback((e) => {
665
+ if (!isDragging.current || !headerRef.current) return;
666
+ e.preventDefault();
667
+ const x = e.pageX - headerRef.current.offsetLeft;
668
+ const walk = (x - startX.current) * 1.5;
669
+ headerRef.current.scrollLeft = scrollLeft.current - walk;
670
+ }, []);
671
+ const handleMouseUp = useCallback(() => {
672
+ isDragging.current = false;
673
+ }, []);
674
+ const handleMouseLeave = useCallback(() => {
675
+ isDragging.current = false;
676
+ }, []);
677
+ const allPanes = Children.toArray(children).filter(Boolean);
678
+ const panes = allPanes.slice(0, maxTabs);
643
679
  const handleTabClick = (idx, disabled) => {
644
680
  if (disabled) return;
645
681
  if (!isControlled) setInnerValue(idx);
646
682
  onChange == null ? void 0 : onChange(idx);
647
683
  };
648
- return /* @__PURE__ */ jsxs("div", { className: `wz-tabs wz-tabs-${type} ${className}`, style, children: [
649
- /* @__PURE__ */ jsx("div", { className: `wz-tabs-header ${headerClassName}`, style: headerStyle, children: panes.map((pane, idx) => /* @__PURE__ */ jsxs(
684
+ const cardTabStyle = type === "card" ? {
685
+ flex: panes.length > 3 ? "0 0 calc((100% - 28px) / 3)" : "1"
686
+ } : void 0;
687
+ return /* @__PURE__ */ jsxs("div", { className: `wz-tabs wz-tabs-${type}${align === "left" ? " wz-tabs-align-left" : ""} ${className}`, style, children: [
688
+ /* @__PURE__ */ jsx(
650
689
  "div",
651
690
  {
652
- className: `wz-tabs-tab${idx === activeIndex ? " wz-tabs-tab-active" : ""}${pane.props.disabled ? " wz-tabs-tab-disabled" : ""}`,
653
- onClick: () => handleTabClick(idx, pane.props.disabled),
654
- children: [
655
- /* @__PURE__ */ jsxs("div", { className: "wz-tabs-tab-text", children: [
656
- pane.props.title,
657
- pane.props.badge && /* @__PURE__ */ jsx("div", { className: "wz-tabs-badge", children: pane.props.badge })
658
- ] }),
659
- idx === activeIndex && type === "line" && /* @__PURE__ */ jsx("div", { className: "wz-tabs-underline" })
660
- ]
661
- },
662
- idx
663
- )) }),
691
+ ref: headerRef,
692
+ className: `wz-tabs-header ${headerClassName}`,
693
+ style: headerStyle,
694
+ onMouseDown: handleMouseDown,
695
+ onMouseMove: handleMouseMove,
696
+ onMouseUp: handleMouseUp,
697
+ onMouseLeave: handleMouseLeave,
698
+ children: panes.map((pane, idx) => /* @__PURE__ */ jsx(
699
+ "div",
700
+ {
701
+ className: `wz-tabs-tab${idx === activeIndex ? " wz-tabs-tab-active" : ""}${pane.props.disabled ? " wz-tabs-tab-disabled" : ""}`,
702
+ style: cardTabStyle,
703
+ onClick: () => handleTabClick(idx, pane.props.disabled),
704
+ children: /* @__PURE__ */ jsxs("div", { className: "wz-tabs-tab-text", children: [
705
+ pane.props.title,
706
+ pane.props.badge && /* @__PURE__ */ jsx("div", { className: "wz-tabs-badge", children: pane.props.badge }),
707
+ idx === activeIndex && type === "line" && /* @__PURE__ */ jsx("div", { className: "wz-tabs-underline" })
708
+ ] })
709
+ },
710
+ idx
711
+ ))
712
+ }
713
+ ),
664
714
  /* @__PURE__ */ jsx("div", { className: `wz-tabs-content ${contentClassName}`, style: contentStyle, children: panes[activeIndex] })
665
715
  ] });
666
716
  };
@@ -1051,7 +1101,7 @@ const Cascader = ({
1051
1101
  const Input = forwardRef(
1052
1102
  ({
1053
1103
  clearable = false,
1054
- align = "center",
1104
+ align = "left",
1055
1105
  value,
1056
1106
  defaultValue,
1057
1107
  onChange,
@@ -1066,12 +1116,49 @@ const Input = forwardRef(
1066
1116
  borderRadius,
1067
1117
  backgroundColor,
1068
1118
  bordered,
1119
+ codeCountdown = 60,
1120
+ onGetCode,
1121
+ codeText = "获取验证码",
1122
+ codeCountingText = "{s}s后重新获取",
1123
+ codeResendText = "重新获取验证码",
1069
1124
  ...props
1070
1125
  }, ref) => {
1071
1126
  const isControlled = value !== void 0;
1072
1127
  const [innerValue, setInnerValue] = useState(defaultValue || "");
1073
1128
  const showClear = clearable && !!(isControlled ? value : innerValue);
1074
1129
  const [passwordVisible, setPasswordVisible] = useState(false);
1130
+ const [counting, setCounting] = useState(false);
1131
+ const [countdown, setCountdown] = useState(codeCountdown);
1132
+ const [hasSent, setHasSent] = useState(false);
1133
+ const [suffixWidth, setSuffixWidth] = useState(0);
1134
+ const suffixRef = useRef(null);
1135
+ useEffect(() => {
1136
+ if (suffixRef.current) {
1137
+ const width = suffixRef.current.offsetWidth;
1138
+ setSuffixWidth(width);
1139
+ }
1140
+ }, [counting, countdown, hasSent, suffix, codeText, codeCountingText, codeResendText]);
1141
+ useEffect(() => {
1142
+ let timer;
1143
+ if (counting && countdown > 0) {
1144
+ timer = setInterval(() => {
1145
+ setCountdown((prev) => prev - 1);
1146
+ }, 1e3);
1147
+ } else if (countdown === 0) {
1148
+ setCounting(false);
1149
+ setCountdown(codeCountdown);
1150
+ }
1151
+ return () => clearInterval(timer);
1152
+ }, [counting, countdown, codeCountdown]);
1153
+ const handleGetCode = useCallback(async () => {
1154
+ if (counting) return;
1155
+ try {
1156
+ await (onGetCode == null ? void 0 : onGetCode());
1157
+ setCounting(true);
1158
+ setHasSent(true);
1159
+ } catch {
1160
+ }
1161
+ }, [counting, onGetCode]);
1075
1162
  const handleChange = (e) => {
1076
1163
  if (!isControlled) setInnerValue(e.target.value);
1077
1164
  onChange == null ? void 0 : onChange(e);
@@ -1096,7 +1183,8 @@ const Input = forwardRef(
1096
1183
  textAlign: align,
1097
1184
  borderRadius,
1098
1185
  backgroundColor,
1099
- border: bordered !== void 0 ? void 0 : "none"
1186
+ border: bordered !== void 0 ? void 0 : "none",
1187
+ ...suffixWidth > 0 && (suffix || type === "code") ? { paddingRight: suffixWidth + 22 + 12 } : {}
1100
1188
  };
1101
1189
  const currentValue = isControlled ? value : innerValue;
1102
1190
  const count = (currentValue == null ? void 0 : currentValue.toString().length) || 0;
@@ -1148,15 +1236,19 @@ const Input = forwardRef(
1148
1236
  return /* @__PURE__ */ jsxs(
1149
1237
  "div",
1150
1238
  {
1151
- className: `wz-input-affix-wrapper ${type === "textarea" ? "wz-input-affix-wrapper-textarea" : ""} ${suffix ? "wz-input-has-suffix" : ""} ${bordered === void 0 ? "wz-input-no-border" : ""}`,
1239
+ className: `wz-input-affix-wrapper ${type === "textarea" ? "wz-input-affix-wrapper-textarea" : ""} ${suffix || type === "code" ? "wz-input-has-suffix" : ""} ${bordered === void 0 ? "wz-input-no-border" : ""} ${clearable ? "wz-input-has-clear" : ""} ${type === "password" ? "wz-input-has-password" : ""}`,
1152
1240
  style: wrapperStyle,
1153
1241
  children: [
1154
1242
  renderInput(),
1155
1243
  showClear && !props.disabled && type !== "textarea" && !suffix && /* @__PURE__ */ jsx("span", { className: "wz-input-clear", onClick: handleClear, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 22 }) }),
1156
1244
  type === "password" && !suffix && /* @__PURE__ */ jsx("span", { className: "wz-input-password", onClick: handlePasswordVisible, children: /* @__PURE__ */ jsx(Icon, { name: passwordVisible ? "eyes-close" : "eyes-open", size: 22 }) }),
1157
- suffix && /* @__PURE__ */ jsxs("div", { className: "wz-input-suffix", children: [
1245
+ suffix && /* @__PURE__ */ jsxs("div", { className: "wz-input-suffix", ref: suffixRef, children: [
1158
1246
  /* @__PURE__ */ jsx("span", { className: "wz-input-suffix-divider" }),
1159
1247
  suffix
1248
+ ] }),
1249
+ type === "code" && /* @__PURE__ */ jsxs("div", { className: "wz-input-suffix", ref: !suffix ? suffixRef : void 0, children: [
1250
+ /* @__PURE__ */ jsx("span", { className: "wz-input-suffix-divider" }),
1251
+ counting ? /* @__PURE__ */ jsx("span", { className: "wz-input-code-btn wz-input-code-btn--disabled", children: codeCountingText.replace("{s}", String(countdown)) }) : /* @__PURE__ */ jsx("span", { className: "wz-input-code-btn", onClick: handleGetCode, children: hasSent ? codeResendText : codeText })
1160
1252
  ] })
1161
1253
  ]
1162
1254
  }
@@ -1238,6 +1330,7 @@ const Search = forwardRef(
1238
1330
  suffix,
1239
1331
  leftIcon = /* @__PURE__ */ jsx(Icon, { name: "search", size: 16 }),
1240
1332
  actionText = "搜索",
1333
+ actionColor,
1241
1334
  showCancel = false,
1242
1335
  cancelText = "返回",
1243
1336
  background,
@@ -1334,13 +1427,20 @@ const Search = forwardRef(
1334
1427
  ...props
1335
1428
  }
1336
1429
  ),
1337
- showClear && /* @__PURE__ */ jsx("div", { className: "wz-search-clear", onMouseDown: handleClear, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 16, color: "#BDBDBD" }) })
1430
+ showClear && /* @__PURE__ */ jsx("div", { className: "wz-search-clear", onMouseDown: handleClear, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 16, color: "#CCCCCC" }) })
1338
1431
  ]
1339
1432
  }
1340
1433
  ),
1341
1434
  actionText && /* @__PURE__ */ jsxs("div", { className: "wz-search-action", onClick: handleSearch, children: [
1342
1435
  /* @__PURE__ */ jsx("div", { className: "wz-search-divider" }),
1343
- /* @__PURE__ */ jsx("div", { className: "wz-search-action-text", children: actionText })
1436
+ /* @__PURE__ */ jsx(
1437
+ "div",
1438
+ {
1439
+ className: "wz-search-action-text",
1440
+ style: actionColor ? { color: actionColor } : void 0,
1441
+ children: actionText
1442
+ }
1443
+ )
1344
1444
  ] })
1345
1445
  ]
1346
1446
  }
@@ -1925,7 +2025,11 @@ Grid.Item = GridItem;
1925
2025
  const GridViewItem = ({
1926
2026
  icon,
1927
2027
  text,
2028
+ textColor,
2029
+ textSize,
1928
2030
  description,
2031
+ descriptionColor,
2032
+ descriptionSize,
1929
2033
  badge,
1930
2034
  corner,
1931
2035
  onClick,
@@ -1972,8 +2076,28 @@ const GridViewItem = ({
1972
2076
  /* @__PURE__ */ jsxs("div", { className: "wz-grid-view-item__content", children: [
1973
2077
  icon && /* @__PURE__ */ jsx("div", { className: "wz-grid-view-item__icon", children: icon }),
1974
2078
  /* @__PURE__ */ jsxs("div", { className: "wz-grid-view-item__text", children: [
1975
- text && /* @__PURE__ */ jsx("div", { className: "wz-grid-view-item__title", children: text }),
1976
- description && /* @__PURE__ */ jsx("div", { className: "wz-grid-view-item__desc", children: description })
2079
+ text && /* @__PURE__ */ jsx(
2080
+ "div",
2081
+ {
2082
+ className: "wz-grid-view-item__title",
2083
+ style: {
2084
+ ...textColor ? { color: textColor } : {},
2085
+ ...textSize ? { fontSize: typeof textSize === "number" ? `${textSize}px` : textSize } : {}
2086
+ },
2087
+ children: text
2088
+ }
2089
+ ),
2090
+ description && /* @__PURE__ */ jsx(
2091
+ "div",
2092
+ {
2093
+ className: "wz-grid-view-item__desc",
2094
+ style: {
2095
+ ...descriptionColor ? { color: descriptionColor } : {},
2096
+ ...descriptionSize ? { fontSize: typeof descriptionSize === "number" ? `${descriptionSize}px` : descriptionSize } : {}
2097
+ },
2098
+ children: description
2099
+ }
2100
+ )
1977
2101
  ] })
1978
2102
  ] }),
1979
2103
  badge && /* @__PURE__ */ jsx("div", { className: "wz-grid-view-item__badge", children: badge })
@@ -2367,8 +2491,9 @@ const Tooltip = ({
2367
2491
  visible,
2368
2492
  onVisibleChange,
2369
2493
  showMask = false,
2370
- action,
2371
- closeIcon
2494
+ actionText,
2495
+ onAction,
2496
+ closable = false
2372
2497
  }) => {
2373
2498
  const [internalVisible, setInternalVisible] = useState(false);
2374
2499
  const [computedStyle, setComputedStyle] = useState({});
@@ -2383,8 +2508,8 @@ const Tooltip = ({
2383
2508
  }
2384
2509
  onVisibleChange == null ? void 0 : onVisibleChange(newVisible);
2385
2510
  };
2386
- useLayoutEffect(() => {
2387
- if (currentVisible && tooltipRef.current && triggerRef.current) {
2511
+ const updatePosition = useCallback(() => {
2512
+ if (tooltipRef.current && triggerRef.current) {
2388
2513
  const bubbleEl = tooltipRef.current;
2389
2514
  const triggerEl = triggerRef.current;
2390
2515
  const { width: bubbleWidth, height: bubbleHeight } = bubbleEl.getBoundingClientRect();
@@ -2417,7 +2542,24 @@ const Tooltip = ({
2417
2542
  "--wz-tooltip-arrow-left": `${arrowLeft}px`
2418
2543
  });
2419
2544
  }
2420
- }, [currentVisible]);
2545
+ }, []);
2546
+ useLayoutEffect(() => {
2547
+ if (currentVisible) {
2548
+ updatePosition();
2549
+ }
2550
+ }, [currentVisible, updatePosition]);
2551
+ useEffect(() => {
2552
+ if (!currentVisible) return;
2553
+ const handleScroll = () => {
2554
+ updatePosition();
2555
+ };
2556
+ window.addEventListener("scroll", handleScroll, true);
2557
+ window.addEventListener("resize", handleScroll);
2558
+ return () => {
2559
+ window.removeEventListener("scroll", handleScroll, true);
2560
+ window.removeEventListener("resize", handleScroll);
2561
+ };
2562
+ }, [currentVisible, updatePosition]);
2421
2563
  const handleWrapperClick = () => {
2422
2564
  if (trigger === "click") {
2423
2565
  handleVisibleChange(!currentVisible);
@@ -2439,17 +2581,17 @@ const Tooltip = ({
2439
2581
  const renderBubble = () => {
2440
2582
  if (!currentVisible) return null;
2441
2583
  const renderAction = () => {
2442
- if (!action) return null;
2443
- const originalOnClick = action.props.onClick;
2444
- const newOnClick = (e) => {
2445
- originalOnClick == null ? void 0 : originalOnClick(e);
2584
+ if (!actionText) return null;
2585
+ const handleActionClick = (e) => {
2586
+ e.stopPropagation();
2587
+ onAction == null ? void 0 : onAction();
2446
2588
  handleVisibleChange(false);
2447
2589
  };
2448
- return /* @__PURE__ */ jsx("div", { className: "wz-tooltip-bubble__action-slot", children: React.cloneElement(action, { onClick: newOnClick }) });
2590
+ return /* @__PURE__ */ jsx("div", { className: "wz-tooltip-bubble__action-slot", children: /* @__PURE__ */ jsx("span", { className: "wz-tooltip-bubble__action-btn", onClick: handleActionClick, children: actionText }) });
2449
2591
  };
2450
2592
  const renderCloseIcon = () => {
2451
- if (!closeIcon) return null;
2452
- return /* @__PURE__ */ jsx("div", { className: "wz-tooltip-bubble__close-slot", children: React.cloneElement(closeIcon, { onClick: handleClose }) });
2593
+ if (!closable) return null;
2594
+ return /* @__PURE__ */ jsx("div", { className: "wz-tooltip-bubble__close-slot", children: /* @__PURE__ */ jsx("span", { className: "wz-tooltip-bubble__close-btn", onClick: handleClose, children: /* @__PURE__ */ jsx(Icon, { name: "close", type: "yunying" }) }) });
2453
2595
  };
2454
2596
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2455
2597
  showMask && /* @__PURE__ */ jsx("div", { className: "wz-tooltip-mask", onClick: handleClose }),