wz-h5-design 1.0.8 → 1.0.9

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 (86) hide show
  1. package/dist/Cell/iconfont-qKgLSSmj.js +35 -0
  2. package/dist/Cell/index.js +1 -1
  3. package/dist/Cell/index.umd.cjs +1 -1
  4. package/dist/Cell/style/index.css +1 -1
  5. package/dist/Cell/style.css +1 -1
  6. package/dist/CheckList/iconfont-qKgLSSmj.js +35 -0
  7. package/dist/CheckList/index.js +1 -1
  8. package/dist/CheckList/index.umd.cjs +1 -1
  9. package/dist/Checkbox/iconfont-qKgLSSmj.js +35 -0
  10. package/dist/Checkbox/index.js +1 -1
  11. package/dist/Checkbox/index.umd.cjs +1 -1
  12. package/dist/DatePicker/index.js +42 -6
  13. package/dist/DatePicker/index.umd.cjs +1 -1
  14. package/dist/DateRangePicker/iconfont-qKgLSSmj.js +35 -0
  15. package/dist/DateRangePicker/index.js +43 -7
  16. package/dist/DateRangePicker/index.umd.cjs +1 -1
  17. package/dist/Divider/index.js +2 -2
  18. package/dist/Divider/index.umd.cjs +1 -1
  19. package/dist/DropDownMenu/iconfont-qKgLSSmj.js +35 -0
  20. package/dist/DropDownMenu/index.js +1 -1
  21. package/dist/DropDownMenu/index.umd.cjs +1 -1
  22. package/dist/Icon/iconfont-qKgLSSmj.js +35 -0
  23. package/dist/Icon/index.js +1 -1
  24. package/dist/Icon/index.umd.cjs +1 -1
  25. package/dist/Input/iconfont-qKgLSSmj.js +35 -0
  26. package/dist/Input/index.js +17 -8
  27. package/dist/Input/index.umd.cjs +1 -1
  28. package/dist/Input/style/index.css +1 -1
  29. package/dist/Input/style.css +1 -1
  30. package/dist/NavBar/iconfont-qKgLSSmj.js +35 -0
  31. package/dist/NavBar/index.js +1 -1
  32. package/dist/NavBar/index.umd.cjs +1 -1
  33. package/dist/Radio/iconfont-qKgLSSmj.js +35 -0
  34. package/dist/Radio/index.js +1 -1
  35. package/dist/Radio/index.umd.cjs +1 -1
  36. package/dist/Search/iconfont-qKgLSSmj.js +35 -0
  37. package/dist/Search/index.js +1 -1
  38. package/dist/Search/index.umd.cjs +1 -1
  39. package/dist/Stepper/iconfont-qKgLSSmj.js +35 -0
  40. package/dist/Stepper/index.js +1 -1
  41. package/dist/Stepper/index.umd.cjs +1 -1
  42. package/dist/Tabbar/iconfont-qKgLSSmj.js +35 -0
  43. package/dist/Tabbar/index.js +1 -1
  44. package/dist/Tabbar/index.umd.cjs +1 -1
  45. package/dist/Tag/index.js +1 -1
  46. package/dist/Tag/index.umd.cjs +1 -1
  47. package/dist/TimePicker/index.js +24 -12
  48. package/dist/TimePicker/index.umd.cjs +1 -1
  49. package/dist/Tip/iconfont-qKgLSSmj.js +35 -0
  50. package/dist/Tip/index.js +8 -16
  51. package/dist/Tip/index.umd.cjs +1 -1
  52. package/dist/Tip/style/index.css +1 -1
  53. package/dist/Tip/style.css +1 -1
  54. package/dist/Toast/iconfont-qKgLSSmj.js +35 -0
  55. package/dist/Toast/index.js +3 -6
  56. package/dist/Toast/index.umd.cjs +1 -1
  57. package/dist/Tooltip/iconfont-qKgLSSmj.js +35 -0
  58. package/dist/Tooltip/index.js +1 -1
  59. package/dist/Tooltip/index.umd.cjs +1 -1
  60. package/dist/assets/fonts/yunying/iconfont.css +19 -15
  61. package/dist/assets/fonts/yunying/iconfont.ttf +0 -0
  62. package/dist/assets/fonts/yunying/iconfont.woff +0 -0
  63. package/dist/assets/fonts/yunying/iconfont.woff2 +0 -0
  64. package/dist/iconfont-qKgLSSmj.js +35 -0
  65. package/dist/style.css +1 -1
  66. package/dist/types/components/Input/Input.d.ts +6 -0
  67. package/dist/types/components/Tip/Tip.d.ts +7 -2
  68. package/dist/wz-h5-design.es.js +93 -47
  69. package/dist/wz-h5-design.umd.js +1 -1
  70. package/package.json +1 -1
  71. package/dist/Cell/iconfont-B9h4iRmM.js +0 -35
  72. package/dist/CheckList/iconfont-B9h4iRmM.js +0 -35
  73. package/dist/Checkbox/iconfont-B9h4iRmM.js +0 -35
  74. package/dist/DateRangePicker/iconfont-B9h4iRmM.js +0 -35
  75. package/dist/DropDownMenu/iconfont-B9h4iRmM.js +0 -35
  76. package/dist/Icon/iconfont-B9h4iRmM.js +0 -35
  77. package/dist/Input/iconfont-B9h4iRmM.js +0 -35
  78. package/dist/NavBar/iconfont-B9h4iRmM.js +0 -35
  79. package/dist/Radio/iconfont-B9h4iRmM.js +0 -35
  80. package/dist/Search/iconfont-B9h4iRmM.js +0 -35
  81. package/dist/Stepper/iconfont-B9h4iRmM.js +0 -35
  82. package/dist/Tabbar/iconfont-B9h4iRmM.js +0 -35
  83. package/dist/Tip/iconfont-B9h4iRmM.js +0 -35
  84. package/dist/Toast/iconfont-B9h4iRmM.js +0 -35
  85. package/dist/Tooltip/iconfont-B9h4iRmM.js +0 -35
  86. package/dist/iconfont-B9h4iRmM.js +0 -35
@@ -12,6 +12,12 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
12
12
  borderRadius?: string;
13
13
  backgroundColor?: string;
14
14
  bordered?: true;
15
+ /** 变体:plain 用于 Cell 内,underline 底部边框样式,filled 灰色填充背景,filled-rounded 圆角填充背景 */
16
+ variant?: "default" | "plain" | "underline" | "filled" | "filled-rounded";
17
+ /** 错误状态 */
18
+ error?: boolean;
19
+ /** 错误提示信息 */
20
+ errorMessage?: string;
15
21
  /** 验证码倒计时秒数,默认60秒 */
16
22
  codeCountdown?: number;
17
23
  /** 点击获取验证码回调 */
@@ -29,9 +29,9 @@ export interface TipProps {
29
29
  */
30
30
  bold?: boolean;
31
31
  /**
32
- * @description 左侧图标名称
32
+ * @description 自定义左侧图标
33
33
  */
34
- icon?: string;
34
+ icon?: ReactNode;
35
35
  /**
36
36
  * @description 是否显示操作按钮
37
37
  * @default false
@@ -46,6 +46,11 @@ export interface TipProps {
46
46
  * @description 操作按钮点击事件
47
47
  */
48
48
  onAction?: () => void;
49
+ /**
50
+ * @description 文字对齐方式
51
+ * @default 'center'
52
+ */
53
+ align?: 'left' | 'center';
49
54
  }
50
55
  export declare const Tip: FC<TipProps>;
51
56
  export default Tip;
@@ -168,7 +168,7 @@ const loadIconSymbol = (type) => {
168
168
  try {
169
169
  switch (type) {
170
170
  case "yunying":
171
- import("./iconfont-B9h4iRmM.js");
171
+ import("./iconfont-qKgLSSmj.js");
172
172
  break;
173
173
  case "qitu":
174
174
  import("./iconfont-CXxMq4G2.js");
@@ -1163,6 +1163,9 @@ const Input = forwardRef(
1163
1163
  borderRadius,
1164
1164
  backgroundColor,
1165
1165
  bordered,
1166
+ variant = "default",
1167
+ error = false,
1168
+ errorMessage,
1166
1169
  codeCountdown = 60,
1167
1170
  onGetCode,
1168
1171
  codeText = "获取验证码",
@@ -1231,7 +1234,8 @@ const Input = forwardRef(
1231
1234
  borderRadius,
1232
1235
  backgroundColor,
1233
1236
  border: bordered !== void 0 ? void 0 : "none",
1234
- ...suffixWidth > 0 && (suffix || type === "code") ? { paddingRight: suffixWidth + 22 + 12 } : {}
1237
+ // plain filled 变体不使用动态 paddingRight
1238
+ ...suffixWidth > 0 && (suffix || type === "code") && variant === "default" ? { paddingRight: suffixWidth + 14 } : {}
1235
1239
  };
1236
1240
  const currentValue = isControlled ? value : innerValue;
1237
1241
  const count = (currentValue == null ? void 0 : currentValue.toString().length) || 0;
@@ -1283,20 +1287,25 @@ const Input = forwardRef(
1283
1287
  return /* @__PURE__ */ jsxs(
1284
1288
  "div",
1285
1289
  {
1286
- 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" : ""}`,
1290
+ 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" : ""} ${variant === "plain" ? "wz-input-plain" : ""} ${variant === "underline" ? "wz-input-underline" : ""} ${variant === "filled" || variant === "filled-rounded" ? "wz-input-filled" : ""} ${variant === "filled-rounded" ? "wz-input-filled-rounded" : ""} ${error ? "wz-input-error" : ""}`,
1287
1291
  style: wrapperStyle,
1288
1292
  children: [
1289
1293
  renderInput(),
1290
- showClear && !props.disabled && type !== "textarea" && !suffix && /* @__PURE__ */ jsx("span", { className: "wz-input-clear", onClick: handleClear, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 22 }) }),
1291
- type === "password" && !suffix && /* @__PURE__ */ jsx("span", { className: "wz-input-password", onClick: handlePasswordVisible, children: /* @__PURE__ */ jsx(Icon, { name: passwordVisible ? "eyes-close" : "eyes-open", size: 22 }) }),
1294
+ showClear && !props.disabled && type !== "textarea" && !suffix && type !== "code" && /* @__PURE__ */ jsx("span", { className: "wz-input-clear", onClick: handleClear, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 22 }) }),
1295
+ type === "password" && !suffix && /* @__PURE__ */ jsx("span", { className: "wz-input-password", onClick: handlePasswordVisible, children: /* @__PURE__ */ jsx(Icon, { type: "wzdaili", name: passwordVisible ? "kekan" : "bukekan", size: 22 }) }),
1292
1296
  suffix && /* @__PURE__ */ jsxs("div", { className: "wz-input-suffix", ref: suffixRef, children: [
1293
1297
  /* @__PURE__ */ jsx("span", { className: "wz-input-suffix-divider" }),
1294
1298
  suffix
1295
1299
  ] }),
1296
- type === "code" && /* @__PURE__ */ jsxs("div", { className: "wz-input-suffix", ref: !suffix ? suffixRef : void 0, children: [
1297
- /* @__PURE__ */ jsx("span", { className: "wz-input-suffix-divider" }),
1300
+ type === "code" && /* @__PURE__ */ jsxs("div", { className: "wz-input-suffix wz-input-code-suffix", ref: !suffix ? suffixRef : void 0, children: [
1301
+ showClear && !props.disabled && /* @__PURE__ */ jsxs(Fragment, { children: [
1302
+ /* @__PURE__ */ jsx("span", { className: "wz-input-clear", onClick: handleClear, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 22 }) }),
1303
+ /* @__PURE__ */ jsx("span", { className: "wz-input-suffix-divider" })
1304
+ ] }),
1305
+ !showClear && /* @__PURE__ */ jsx("span", { className: "wz-input-suffix-divider" }),
1298
1306
  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 })
1299
- ] })
1307
+ ] }),
1308
+ errorMessage && error && /* @__PURE__ */ jsx("div", { className: "wz-input-error-message", children: errorMessage })
1300
1309
  ]
1301
1310
  }
1302
1311
  );
@@ -1327,8 +1336,8 @@ const Divider = ({
1327
1336
  className: `wz-divider wz-divider--${direction} ${className}`,
1328
1337
  style: {
1329
1338
  background: color || defaultColor,
1330
- width: isVertical ? 1 : length || "100%",
1331
- height: isVertical ? length || 16 : 2,
1339
+ width: isVertical ? 2 : length || "100%",
1340
+ height: isVertical ? length || 24 : 2,
1332
1341
  margin,
1333
1342
  ...style
1334
1343
  }
@@ -1531,10 +1540,14 @@ const TimePicker = ({
1531
1540
  }, [value, pickerOptions]);
1532
1541
  useEffect(() => {
1533
1542
  if (wrapperRef.current) {
1534
- wrapperRef.current.scrollTo({
1535
- top: current * itemHeight,
1536
- behavior: "smooth"
1537
- });
1543
+ if (wrapperRef.current.scrollTo) {
1544
+ wrapperRef.current.scrollTo({
1545
+ top: current * itemHeight,
1546
+ behavior: "smooth"
1547
+ });
1548
+ } else {
1549
+ wrapperRef.current.scrollTop = current * itemHeight;
1550
+ }
1538
1551
  }
1539
1552
  }, [current, itemHeight]);
1540
1553
  const handleTouchStart2 = (e) => {
@@ -1607,18 +1620,26 @@ const TimePicker = ({
1607
1620
  const dragType = useRef(null);
1608
1621
  useEffect(() => {
1609
1622
  if (hourRef.current) {
1610
- hourRef.current.scrollTo({
1611
- top: currentHour * itemHeight,
1612
- behavior: "smooth"
1613
- });
1623
+ if (hourRef.current.scrollTo) {
1624
+ hourRef.current.scrollTo({
1625
+ top: currentHour * itemHeight,
1626
+ behavior: "smooth"
1627
+ });
1628
+ } else {
1629
+ hourRef.current.scrollTop = currentHour * itemHeight;
1630
+ }
1614
1631
  }
1615
1632
  }, [currentHour, itemHeight]);
1616
1633
  useEffect(() => {
1617
1634
  if (minuteRef.current) {
1618
- minuteRef.current.scrollTo({
1619
- top: currentMinute * itemHeight,
1620
- behavior: "smooth"
1621
- });
1635
+ if (minuteRef.current.scrollTo) {
1636
+ minuteRef.current.scrollTo({
1637
+ top: currentMinute * itemHeight,
1638
+ behavior: "smooth"
1639
+ });
1640
+ } else {
1641
+ minuteRef.current.scrollTop = currentMinute * itemHeight;
1642
+ }
1622
1643
  }
1623
1644
  }, [currentMinute, itemHeight]);
1624
1645
  const handleTouchStart = (type2) => (e) => {
@@ -1736,13 +1757,31 @@ const DatePicker = ({
1736
1757
  const isDragging = useRef(false);
1737
1758
  const dragType = useRef(null);
1738
1759
  useLayoutEffect(() => {
1739
- if (yearRef.current) yearRef.current.scrollTo({ top: (year - minYear) * itemHeight, behavior: "auto" });
1760
+ if (yearRef.current) {
1761
+ if (yearRef.current.scrollTo) {
1762
+ yearRef.current.scrollTo({ top: (year - minYear) * itemHeight, behavior: "auto" });
1763
+ } else {
1764
+ yearRef.current.scrollTop = (year - minYear) * itemHeight;
1765
+ }
1766
+ }
1740
1767
  }, [year, itemHeight, minYear]);
1741
1768
  useLayoutEffect(() => {
1742
- if (monthRef.current) monthRef.current.scrollTo({ top: (month - 1) * itemHeight, behavior: "auto" });
1769
+ if (monthRef.current) {
1770
+ if (monthRef.current.scrollTo) {
1771
+ monthRef.current.scrollTo({ top: (month - 1) * itemHeight, behavior: "auto" });
1772
+ } else {
1773
+ monthRef.current.scrollTop = (month - 1) * itemHeight;
1774
+ }
1775
+ }
1743
1776
  }, [month, itemHeight]);
1744
1777
  useLayoutEffect(() => {
1745
- if (dayRef.current) dayRef.current.scrollTo({ top: (day - 1) * itemHeight, behavior: "auto" });
1778
+ if (dayRef.current) {
1779
+ if (dayRef.current.scrollTo) {
1780
+ dayRef.current.scrollTo({ top: (day - 1) * itemHeight, behavior: "auto" });
1781
+ } else {
1782
+ dayRef.current.scrollTop = (day - 1) * itemHeight;
1783
+ }
1784
+ }
1746
1785
  }, [day, itemHeight]);
1747
1786
  const handleTouchStart = (type) => (e) => {
1748
1787
  var _a, _b, _c;
@@ -1806,9 +1845,27 @@ const DatePicker = ({
1806
1845
  setYear(y);
1807
1846
  setMonth(m);
1808
1847
  setDay(d);
1809
- if (yearRef.current) yearRef.current.scrollTo({ top: (y - minYear) * itemHeight, behavior: "auto" });
1810
- if (monthRef.current) monthRef.current.scrollTo({ top: (m - 1) * itemHeight, behavior: "auto" });
1811
- if (dayRef.current) dayRef.current.scrollTo({ top: (d - 1) * itemHeight, behavior: "auto" });
1848
+ if (yearRef.current) {
1849
+ if (yearRef.current.scrollTo) {
1850
+ yearRef.current.scrollTo({ top: (y - minYear) * itemHeight, behavior: "auto" });
1851
+ } else {
1852
+ yearRef.current.scrollTop = (y - minYear) * itemHeight;
1853
+ }
1854
+ }
1855
+ if (monthRef.current) {
1856
+ if (monthRef.current.scrollTo) {
1857
+ monthRef.current.scrollTo({ top: (m - 1) * itemHeight, behavior: "auto" });
1858
+ } else {
1859
+ monthRef.current.scrollTop = (m - 1) * itemHeight;
1860
+ }
1861
+ }
1862
+ if (dayRef.current) {
1863
+ if (dayRef.current.scrollTo) {
1864
+ dayRef.current.scrollTo({ top: (d - 1) * itemHeight, behavior: "auto" });
1865
+ } else {
1866
+ dayRef.current.scrollTop = (d - 1) * itemHeight;
1867
+ }
1868
+ }
1812
1869
  }
1813
1870
  }, [value]);
1814
1871
  const renderColumn = (options, current, ref, type) => /* @__PURE__ */ jsxs(
@@ -2222,7 +2279,7 @@ const Tag = (props) => {
2222
2279
  if (borderColor && type === "line") {
2223
2280
  newStyle.borderColor = borderColor;
2224
2281
  }
2225
- if (bgColor) {
2282
+ if (bgColor && type === "solid") {
2226
2283
  newStyle.backgroundColor = bgColor;
2227
2284
  }
2228
2285
  if (borderRadius !== void 0) {
@@ -2245,17 +2302,9 @@ const Tip = ({
2245
2302
  icon,
2246
2303
  showAction = false,
2247
2304
  actionText = "查看",
2248
- onAction
2305
+ onAction,
2306
+ align = "center"
2249
2307
  }) => {
2250
- const contentRef = useRef(null);
2251
- const [isMultiLine, setIsMultiLine] = useState(false);
2252
- useEffect(() => {
2253
- if (contentRef.current && !marquee) {
2254
- const el = contentRef.current;
2255
- const lineHeight = parseFloat(getComputedStyle(el).lineHeight) || 20;
2256
- setIsMultiLine(el.scrollHeight > lineHeight * 1.5);
2257
- }
2258
- }, [content, marquee]);
2259
2308
  if (!visible) {
2260
2309
  return null;
2261
2310
  }
@@ -2264,15 +2313,15 @@ const Tip = ({
2264
2313
  const tipClass = classNames(baseClass, className, {
2265
2314
  [`${baseClass}--marquee`]: marquee,
2266
2315
  [`${baseClass}--bold`]: bold,
2267
- [`${baseClass}--center`]: !marquee && !isMultiLine,
2268
- [`${baseClass}--left`]: !marquee && isMultiLine,
2316
+ [`${baseClass}--left`]: align === "left",
2317
+ [`${baseClass}--center`]: align === "center",
2269
2318
  [`${baseClass}--has-icon`]: !!icon,
2270
2319
  [`${baseClass}--has-right`]: hasRightArea
2271
2320
  });
2272
2321
  const contentNode = marquee ? /* @__PURE__ */ jsx("div", { className: `${baseClass}-marquee-box`, children: /* @__PURE__ */ jsx("span", { children: content }) }) : content;
2273
2322
  return /* @__PURE__ */ jsxs("div", { className: tipClass, children: [
2274
- /* @__PURE__ */ jsxs("div", { className: `${baseClass}-content`, ref: contentRef, children: [
2275
- icon && /* @__PURE__ */ jsx("span", { className: `${baseClass}-icon`, children: /* @__PURE__ */ jsx(Icon, { name: icon, size: 16 }) }),
2323
+ /* @__PURE__ */ jsxs("div", { className: `${baseClass}-content`, children: [
2324
+ icon && /* @__PURE__ */ jsx("span", { className: `${baseClass}-icon`, children: icon }),
2276
2325
  /* @__PURE__ */ jsx("span", { className: `${baseClass}-text`, children: contentNode })
2277
2326
  ] }),
2278
2327
  showAction && /* @__PURE__ */ jsx("div", { className: `${baseClass}-action`, onClick: onAction, children: actionText }),
@@ -2457,13 +2506,10 @@ const Toast$1 = ({
2457
2506
  visible = false,
2458
2507
  onClose
2459
2508
  }) => {
2460
- const [show2, setShow] = useState(visible);
2461
2509
  useEffect(() => {
2462
- setShow(visible);
2463
2510
  let timer;
2464
2511
  if (visible && duration > 0) {
2465
2512
  timer = setTimeout(() => {
2466
- setShow(false);
2467
2513
  onClose == null ? void 0 : onClose();
2468
2514
  }, duration);
2469
2515
  }
@@ -2471,7 +2517,7 @@ const Toast$1 = ({
2471
2517
  clearTimeout(timer);
2472
2518
  };
2473
2519
  }, [visible, duration, onClose]);
2474
- const toastClass = classNames("wz-toast", { "wz-toast-visible": show2 });
2520
+ const toastClass = classNames("wz-toast", { "wz-toast-visible": visible });
2475
2521
  const iconClass = classNames("wz-toast-icon");
2476
2522
  return /* @__PURE__ */ jsx("div", { className: toastClass, children: /* @__PURE__ */ jsxs("div", { className: "wz-toast-content", children: [
2477
2523
  icon && /* @__PURE__ */ jsx("div", { className: iconClass, children: icon }),