wz-h5-design 1.0.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 (241) hide show
  1. package/README.md +51 -0
  2. package/dist/Button/index.js +84 -0
  3. package/dist/Button/index.umd.cjs +1 -0
  4. package/dist/Button/style/index.css +1 -0
  5. package/dist/Button/style/index.js +1 -0
  6. package/dist/Button/style.css +1 -0
  7. package/dist/Card/index.js +32 -0
  8. package/dist/Card/index.umd.cjs +1 -0
  9. package/dist/Card/style/index.css +1 -0
  10. package/dist/Card/style/index.js +1 -0
  11. package/dist/Card/style.css +1 -0
  12. package/dist/Cascader/index.js +94 -0
  13. package/dist/Cascader/index.umd.cjs +1 -0
  14. package/dist/Cascader/style/index.css +1 -0
  15. package/dist/Cascader/style/index.js +1 -0
  16. package/dist/Cascader/style.css +1 -0
  17. package/dist/Cell/index.js +135 -0
  18. package/dist/Cell/index.umd.cjs +6 -0
  19. package/dist/Cell/style/index.css +1 -0
  20. package/dist/Cell/style/index.js +1 -0
  21. package/dist/Cell/style.css +1 -0
  22. package/dist/CheckList/index.js +34 -0
  23. package/dist/CheckList/index.umd.cjs +1 -0
  24. package/dist/CheckList/style/index.css +1 -0
  25. package/dist/CheckList/style/index.js +1 -0
  26. package/dist/CheckList/style.css +1 -0
  27. package/dist/Checkbox/index.js +84 -0
  28. package/dist/Checkbox/index.umd.cjs +1 -0
  29. package/dist/Checkbox/style/index.css +1 -0
  30. package/dist/Checkbox/style/index.js +1 -0
  31. package/dist/Checkbox/style.css +1 -0
  32. package/dist/Collapse/index.js +72 -0
  33. package/dist/Collapse/index.umd.cjs +1 -0
  34. package/dist/Collapse/style/index.css +1 -0
  35. package/dist/Collapse/style/index.js +1 -0
  36. package/dist/Collapse/style.css +1 -0
  37. package/dist/DatePicker/index.js +154 -0
  38. package/dist/DatePicker/index.umd.cjs +1 -0
  39. package/dist/DatePicker/style/index.css +1 -0
  40. package/dist/DatePicker/style/index.js +1 -0
  41. package/dist/DatePicker/style.css +1 -0
  42. package/dist/DateRangePicker/index.js +220 -0
  43. package/dist/DateRangePicker/index.umd.cjs +1 -0
  44. package/dist/DateRangePicker/style/index.css +1 -0
  45. package/dist/DateRangePicker/style/index.js +1 -0
  46. package/dist/DateRangePicker/style.css +1 -0
  47. package/dist/Dialog/index.js +216 -0
  48. package/dist/Dialog/index.umd.cjs +6 -0
  49. package/dist/Dialog/style/index.css +1 -0
  50. package/dist/Dialog/style/index.js +1 -0
  51. package/dist/Dialog/style.css +1 -0
  52. package/dist/Divider/index.js +27 -0
  53. package/dist/Divider/index.umd.cjs +1 -0
  54. package/dist/Divider/style/index.css +1 -0
  55. package/dist/Divider/style/index.js +1 -0
  56. package/dist/Divider/style.css +1 -0
  57. package/dist/DropDownMenu/index.js +111 -0
  58. package/dist/DropDownMenu/index.umd.cjs +1 -0
  59. package/dist/DropDownMenu/style/index.css +1 -0
  60. package/dist/DropDownMenu/style/index.js +1 -0
  61. package/dist/DropDownMenu/style.css +1 -0
  62. package/dist/Flex/index.js +85 -0
  63. package/dist/Flex/index.umd.cjs +1 -0
  64. package/dist/Flex/style/index.css +1 -0
  65. package/dist/Flex/style/index.js +1 -0
  66. package/dist/Flex/style.css +1 -0
  67. package/dist/Grid/index.js +54 -0
  68. package/dist/Grid/index.umd.cjs +1 -0
  69. package/dist/Grid/style/index.css +1 -0
  70. package/dist/Grid/style/index.js +1 -0
  71. package/dist/Grid/style.css +1 -0
  72. package/dist/GridView/index.js +90 -0
  73. package/dist/GridView/index.umd.cjs +1 -0
  74. package/dist/GridView/style/index.css +1 -0
  75. package/dist/GridView/style/index.js +1 -0
  76. package/dist/GridView/style.css +1 -0
  77. package/dist/Icon/index.js +31 -0
  78. package/dist/Icon/index.umd.cjs +1 -0
  79. package/dist/Icon/style/index.css +1 -0
  80. package/dist/Icon/style/index.js +1 -0
  81. package/dist/Icon/style.css +1 -0
  82. package/dist/Input/index.js +148 -0
  83. package/dist/Input/index.umd.cjs +1 -0
  84. package/dist/Input/style/index.css +1 -0
  85. package/dist/Input/style/index.js +1 -0
  86. package/dist/Input/style.css +1 -0
  87. package/dist/NavBar/index.js +175 -0
  88. package/dist/NavBar/index.umd.cjs +6 -0
  89. package/dist/NavBar/style/index.css +1 -0
  90. package/dist/NavBar/style/index.js +1 -0
  91. package/dist/NavBar/style.css +1 -0
  92. package/dist/Popup/index.js +124 -0
  93. package/dist/Popup/index.umd.cjs +1 -0
  94. package/dist/Popup/style/index.css +1 -0
  95. package/dist/Popup/style/index.js +1 -0
  96. package/dist/Popup/style.css +1 -0
  97. package/dist/Radio/index.js +82 -0
  98. package/dist/Radio/index.umd.cjs +1 -0
  99. package/dist/Radio/style/index.css +1 -0
  100. package/dist/Radio/style/index.js +1 -0
  101. package/dist/Radio/style.css +1 -0
  102. package/dist/Search/index.js +158 -0
  103. package/dist/Search/index.umd.cjs +1 -0
  104. package/dist/Search/style/index.css +1 -0
  105. package/dist/Search/style/index.js +1 -0
  106. package/dist/Search/style.css +1 -0
  107. package/dist/Stepper/index.js +140 -0
  108. package/dist/Stepper/index.umd.cjs +1 -0
  109. package/dist/Stepper/style/index.css +1 -0
  110. package/dist/Stepper/style/index.js +1 -0
  111. package/dist/Stepper/style.css +1 -0
  112. package/dist/Switch/index.js +53 -0
  113. package/dist/Switch/index.umd.cjs +1 -0
  114. package/dist/Switch/style/index.css +1 -0
  115. package/dist/Switch/style/index.js +1 -0
  116. package/dist/Switch/style.css +1 -0
  117. package/dist/Tabbar/index.js +159 -0
  118. package/dist/Tabbar/index.umd.cjs +6 -0
  119. package/dist/Tabbar/style/index.css +1 -0
  120. package/dist/Tabbar/style/index.js +1 -0
  121. package/dist/Tabbar/style.css +1 -0
  122. package/dist/Tabs/index.js +50 -0
  123. package/dist/Tabs/index.umd.cjs +1 -0
  124. package/dist/Tabs/style/index.css +1 -0
  125. package/dist/Tabs/style/index.js +1 -0
  126. package/dist/Tabs/style.css +1 -0
  127. package/dist/Tag/index.js +96 -0
  128. package/dist/Tag/index.umd.cjs +6 -0
  129. package/dist/Tag/style/index.css +1 -0
  130. package/dist/Tag/style/index.js +1 -0
  131. package/dist/Tag/style.css +1 -0
  132. package/dist/TimePicker/index.js +201 -0
  133. package/dist/TimePicker/index.umd.cjs +1 -0
  134. package/dist/TimePicker/style/index.css +1 -0
  135. package/dist/TimePicker/style/index.js +1 -0
  136. package/dist/TimePicker/style.css +1 -0
  137. package/dist/Tip/index.js +104 -0
  138. package/dist/Tip/index.umd.cjs +6 -0
  139. package/dist/Tip/style/index.css +1 -0
  140. package/dist/Tip/style/index.js +1 -0
  141. package/dist/Tip/style.css +1 -0
  142. package/dist/Toast/index.js +183 -0
  143. package/dist/Toast/index.umd.cjs +6 -0
  144. package/dist/Toast/style/index.css +1 -0
  145. package/dist/Toast/style/index.js +1 -0
  146. package/dist/Toast/style.css +1 -0
  147. package/dist/Tooltip/index.js +172 -0
  148. package/dist/Tooltip/index.umd.cjs +6 -0
  149. package/dist/Tooltip/style/index.css +1 -0
  150. package/dist/Tooltip/style/index.js +1 -0
  151. package/dist/Tooltip/style.css +1 -0
  152. package/dist/assets/fonts/qitu/iconfont.css +140 -0
  153. package/dist/assets/fonts/qitu/iconfont.ttf +0 -0
  154. package/dist/assets/fonts/qitu/iconfont.woff +0 -0
  155. package/dist/assets/fonts/qitu/iconfont.woff2 +0 -0
  156. package/dist/assets/fonts/qituyonghu/iconfont.css +64 -0
  157. package/dist/assets/fonts/qituyonghu/iconfont.ttf +0 -0
  158. package/dist/assets/fonts/qituyonghu/iconfont.woff +0 -0
  159. package/dist/assets/fonts/qituyonghu/iconfont.woff2 +0 -0
  160. package/dist/assets/fonts/wzdaili/iconfont.css +71 -0
  161. package/dist/assets/fonts/wzdaili/iconfont.ttf +0 -0
  162. package/dist/assets/fonts/wzdaili/iconfont.woff +0 -0
  163. package/dist/assets/fonts/wzdaili/iconfont.woff2 +0 -0
  164. package/dist/assets/fonts/wzyonghu/iconfont.css +97 -0
  165. package/dist/assets/fonts/wzyonghu/iconfont.ttf +0 -0
  166. package/dist/assets/fonts/wzyonghu/iconfont.woff +0 -0
  167. package/dist/assets/fonts/wzyonghu/iconfont.woff2 +0 -0
  168. package/dist/assets/fonts/yunying/iconfont.css +303 -0
  169. package/dist/assets/fonts/yunying/iconfont.ttf +0 -0
  170. package/dist/assets/fonts/yunying/iconfont.woff +0 -0
  171. package/dist/assets/fonts/yunying/iconfont.woff2 +0 -0
  172. package/dist/style.css +1 -0
  173. package/dist/types/components/Button/Button.d.ts +16 -0
  174. package/dist/types/components/Button/index.d.ts +5 -0
  175. package/dist/types/components/Card/Card.d.ts +15 -0
  176. package/dist/types/components/Card/index.d.ts +3 -0
  177. package/dist/types/components/Cascader/Cascader.d.ts +14 -0
  178. package/dist/types/components/Cascader/index.d.ts +3 -0
  179. package/dist/types/components/Cell/Cell.d.ts +24 -0
  180. package/dist/types/components/Cell/CellGroup.d.ts +8 -0
  181. package/dist/types/components/Cell/index.d.ts +8 -0
  182. package/dist/types/components/CheckList/CheckList.d.ts +11 -0
  183. package/dist/types/components/CheckList/index.d.ts +3 -0
  184. package/dist/types/components/Checkbox/Checkbox.d.ts +62 -0
  185. package/dist/types/components/Checkbox/index.d.ts +3 -0
  186. package/dist/types/components/Collapse/Collapse.d.ts +17 -0
  187. package/dist/types/components/Collapse/index.d.ts +3 -0
  188. package/dist/types/components/DatePicker/DatePicker.d.ts +13 -0
  189. package/dist/types/components/DatePicker/index.d.ts +3 -0
  190. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +13 -0
  191. package/dist/types/components/DateRangePicker/index.d.ts +3 -0
  192. package/dist/types/components/Dialog/Dialog.d.ts +16 -0
  193. package/dist/types/components/Dialog/imperative.d.ts +8 -0
  194. package/dist/types/components/Dialog/index.d.ts +8 -0
  195. package/dist/types/components/Divider/Divider.d.ts +11 -0
  196. package/dist/types/components/Divider/index.d.ts +3 -0
  197. package/dist/types/components/DropDownMenu/DropdownMenu.d.ts +19 -0
  198. package/dist/types/components/DropDownMenu/index.d.ts +2 -0
  199. package/dist/types/components/Flex/Flex.d.ts +25 -0
  200. package/dist/types/components/Flex/index.d.ts +3 -0
  201. package/dist/types/components/Grid/Grid.d.ts +22 -0
  202. package/dist/types/components/Grid/index.d.ts +3 -0
  203. package/dist/types/components/GridView/GridView.d.ts +59 -0
  204. package/dist/types/components/GridView/index.d.ts +2 -0
  205. package/dist/types/components/Icon/Icon.d.ts +12 -0
  206. package/dist/types/components/Icon/icon-data.d.ts +42 -0
  207. package/dist/types/components/Icon/index.d.ts +3 -0
  208. package/dist/types/components/Input/Input.d.ts +17 -0
  209. package/dist/types/components/Input/index.d.ts +3 -0
  210. package/dist/types/components/NavBar/NavBar.d.ts +20 -0
  211. package/dist/types/components/NavBar/index.d.ts +3 -0
  212. package/dist/types/components/Popup/Popup.d.ts +23 -0
  213. package/dist/types/components/Popup/index.d.ts +3 -0
  214. package/dist/types/components/Radio/Radio.d.ts +62 -0
  215. package/dist/types/components/Radio/index.d.ts +3 -0
  216. package/dist/types/components/Search/Search.d.ts +26 -0
  217. package/dist/types/components/Search/index.d.ts +3 -0
  218. package/dist/types/components/Stepper/Stepper.d.ts +22 -0
  219. package/dist/types/components/Stepper/index.d.ts +3 -0
  220. package/dist/types/components/Switch/Switch.d.ts +16 -0
  221. package/dist/types/components/Switch/index.d.ts +3 -0
  222. package/dist/types/components/Tabbar/Tabbar.d.ts +39 -0
  223. package/dist/types/components/Tabbar/index.d.ts +3 -0
  224. package/dist/types/components/Tabs/Tabs.d.ts +25 -0
  225. package/dist/types/components/Tabs/index.d.ts +3 -0
  226. package/dist/types/components/Tag/Tag.d.ts +39 -0
  227. package/dist/types/components/Tag/index.d.ts +3 -0
  228. package/dist/types/components/TimePicker/TimePicker.d.ts +12 -0
  229. package/dist/types/components/TimePicker/index.d.ts +3 -0
  230. package/dist/types/components/Tip/Tip.d.ts +32 -0
  231. package/dist/types/components/Tip/index.d.ts +3 -0
  232. package/dist/types/components/Toast/Toast.d.ts +11 -0
  233. package/dist/types/components/Toast/index.d.ts +15 -0
  234. package/dist/types/components/Tooltip/Tooltip.d.ts +17 -0
  235. package/dist/types/components/Tooltip/index.d.ts +3 -0
  236. package/dist/types/components/index.d.ts +31 -0
  237. package/dist/types/index.d.ts +7 -0
  238. package/dist/types/utils/color.d.ts +1 -0
  239. package/dist/wz-h5-design.es.js +2449 -0
  240. package/dist/wz-h5-design.umd.js +6 -0
  241. package/package.json +84 -0
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react/jsx-runtime"),require("react")):"function"==typeof define&&define.amd?define(["react/jsx-runtime","react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Switch=t(e.jsxRuntime,e.React)}(this,(function(e,t){"use strict";return({value:i,defaultValue:s=!1,onChange:n,disabled:c=!1,showText:l=!0,activeText:a="",inactiveText:d="",style:o,className:r="",size:u="default",activeColor:h})=>{const[w,f]=t.useState(s),x=void 0!==i,m=x?i:w,p=m?a||"开启":d||"关闭",z=l?12*p.length+8+"px":"0px",g="large"===u?62:60,v=`${l?12*p.length+40:g}px`,b=h?(h.includes("gradient"),h):void 0,j=m&&h?{background:b}:{};return e.jsxs("div",{className:`wz-switch-bg ${m?"wz-switch-on":"wz-switch-off"}${c?" wz-switch-disabled":""}${r?" "+r:""} wz-switch-${u}`,style:{width:v,minWidth:`${g}px`,...o,...j},onClick:()=>{c||(x||f(!m),null==n||n(!m))},children:[l&&e.jsx("span",{className:"wz-switch-text",style:{width:z},children:p}),e.jsx("div",{className:"wz-switch-slider "+(m?"wz-switch-slider-on":"wz-switch-slider-off")})]})}}));
@@ -0,0 +1 @@
1
+ .wz-switch-bg{cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none;align-items:center;transition:background .2s;display:flex;position:relative;box-shadow:0 1px 3px #00000014}.wz-switch-default{border-radius:26px;height:26px}.wz-switch-default .wz-switch-slider{width:22px;height:22px;top:2px}.wz-switch-default .wz-switch-text{top:5px}.wz-switch-large{border-radius:28px;height:28px}.wz-switch-large .wz-switch-slider{width:24px;height:24px}.wz-switch-large .wz-switch-text{top:6px}.wz-switch-off{background:#ccc;box-shadow:inset 0 0 2px #0000001a}.wz-switch-on{background:var(--wz-primary-color,#22c94d);box-shadow:inset 0 0 2px #0eb54999}.wz-switch-text{text-align:center;color:#fff;z-index:2;pointer-events:none;height:16px;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;font-size:12px;font-weight:600;line-height:16px;position:absolute;left:29px}.wz-switch-on .wz-switch-text{color:#fff;left:8px}.wz-switch-slider{z-index:3;background:#fff;border-radius:50%;width:22px;height:22px;transition:right .2s,left .2s;position:absolute;top:2px;box-shadow:0 1px 3px #00000014}.wz-switch-slider-on{left:auto;right:2px}.wz-switch-slider-off{left:2px;right:auto}.wz-switch-disabled{opacity:.6;cursor:not-allowed}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ .wz-switch-bg{cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;outline:none;align-items:center;transition:background .2s;display:flex;position:relative;box-shadow:0 1px 3px #00000014}.wz-switch-default{border-radius:26px;height:26px}.wz-switch-default .wz-switch-slider{width:22px;height:22px;top:2px}.wz-switch-default .wz-switch-text{top:5px}.wz-switch-large{border-radius:28px;height:28px}.wz-switch-large .wz-switch-slider{width:24px;height:24px}.wz-switch-large .wz-switch-text{top:6px}.wz-switch-off{background:#ccc;box-shadow:inset 0 0 2px #0000001a}.wz-switch-on{background:var(--wz-primary-color,#22c94d);box-shadow:inset 0 0 2px #0eb54999}.wz-switch-text{text-align:center;color:#fff;z-index:2;pointer-events:none;height:16px;font-family:"Alibaba PuHuiTi 2.0",Alibaba-PuHuiTi-Regular,PingFang SC,Microsoft YaHei,Arial,sans-serif;font-size:12px;font-weight:600;line-height:16px;position:absolute;left:29px}.wz-switch-on .wz-switch-text{color:#fff;left:8px}.wz-switch-slider{z-index:3;background:#fff;border-radius:50%;width:22px;height:22px;transition:right .2s,left .2s;position:absolute;top:2px;box-shadow:0 1px 3px #00000014}.wz-switch-slider-on{left:auto;right:2px}.wz-switch-slider-off{left:2px;right:auto}.wz-switch-disabled{opacity:.6;cursor:not-allowed}
@@ -0,0 +1,159 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React, { createElement, useMemo } from "react";
3
+ function getDefaultExportFromCjs(x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
+ }
6
+ var classnames$1 = { exports: {} };
7
+ /*!
8
+ Copyright (c) 2018 Jed Watson.
9
+ Licensed under the MIT License (MIT), see
10
+ http://jedwatson.github.io/classnames
11
+ */
12
+ (function(module) {
13
+ (function() {
14
+ var hasOwn = {}.hasOwnProperty;
15
+ function classNames() {
16
+ var classes = [];
17
+ for (var i = 0; i < arguments.length; i++) {
18
+ var arg = arguments[i];
19
+ if (!arg) continue;
20
+ var argType = typeof arg;
21
+ if (argType === "string" || argType === "number") {
22
+ classes.push(arg);
23
+ } else if (Array.isArray(arg)) {
24
+ if (arg.length) {
25
+ var inner = classNames.apply(null, arg);
26
+ if (inner) {
27
+ classes.push(inner);
28
+ }
29
+ }
30
+ } else if (argType === "object") {
31
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
32
+ classes.push(arg.toString());
33
+ continue;
34
+ }
35
+ for (var key in arg) {
36
+ if (hasOwn.call(arg, key) && arg[key]) {
37
+ classes.push(key);
38
+ }
39
+ }
40
+ }
41
+ }
42
+ return classes.join(" ");
43
+ }
44
+ if (module.exports) {
45
+ classNames.default = classNames;
46
+ module.exports = classNames;
47
+ } else {
48
+ window.classNames = classNames;
49
+ }
50
+ })();
51
+ })(classnames$1);
52
+ var classnamesExports = classnames$1.exports;
53
+ const classnames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
54
+ const Icon = ({
55
+ name,
56
+ size = 24,
57
+ color = "currentColor",
58
+ className = "",
59
+ style,
60
+ onClick,
61
+ type = "yunying"
62
+ // 默认使用yunying图标库
63
+ }) => {
64
+ const iconStyle = {
65
+ fontSize: typeof size === "number" ? `${size}px` : size,
66
+ color,
67
+ ...style
68
+ };
69
+ const iconFontClass = `iconfont-${type}`;
70
+ const iconPrefix = "icon-";
71
+ const iconClass = `${iconPrefix}${name}`;
72
+ return /* @__PURE__ */ jsx(
73
+ "i",
74
+ {
75
+ className: `wz-icon ${iconFontClass} ${iconClass} ${className}`,
76
+ style: iconStyle,
77
+ onClick
78
+ }
79
+ );
80
+ };
81
+ const TabbarItem = (props) => {
82
+ const { title, icon, activeIcon, badge, badgeAsBubble, hump, active, onItemClick, onClick, activeColor } = props;
83
+ const renderIcon = (iconSource) => {
84
+ if (typeof iconSource === "string") {
85
+ return /* @__PURE__ */ jsx(Icon, { name: iconSource });
86
+ }
87
+ return iconSource;
88
+ };
89
+ const renderBadge = () => {
90
+ if (!badge) return null;
91
+ if (badgeAsBubble) {
92
+ return /* @__PURE__ */ jsx("div", { className: "wz-tabbar-item-badge-custom", children: /* @__PURE__ */ jsxs("div", { className: "wz-tabbar-item-badge-bubble", children: [
93
+ badge,
94
+ /* @__PURE__ */ jsx("div", { className: "wz-tabbar-item-badge-bubble-arrow" })
95
+ ] }) });
96
+ }
97
+ if (React.isValidElement(badge)) {
98
+ return /* @__PURE__ */ jsx("div", { className: "wz-tabbar-item-badge-custom", children: badge });
99
+ }
100
+ return /* @__PURE__ */ jsx("div", { className: "wz-tabbar-item-badge", children: badge });
101
+ };
102
+ const itemCls = classnames("wz-tabbar-item", {
103
+ "wz-tabbar-item-active": !hump && active,
104
+ "wz-tabbar-item-hump": hump
105
+ });
106
+ const itemStyle = useMemo(() => {
107
+ const style = {};
108
+ if (active && activeColor) {
109
+ style.color = activeColor;
110
+ }
111
+ return style;
112
+ }, [active, activeColor]);
113
+ return /* @__PURE__ */ jsxs("div", { className: itemCls, style: itemStyle, onClick: hump ? onClick : onItemClick, children: [
114
+ /* @__PURE__ */ jsxs("div", { className: "wz-tabbar-item-icon", children: [
115
+ active ? renderIcon(activeIcon || icon) : renderIcon(icon),
116
+ renderBadge()
117
+ ] }),
118
+ /* @__PURE__ */ jsx("div", { className: "wz-tabbar-item-title", children: title })
119
+ ] });
120
+ };
121
+ const Tabbar = (props) => {
122
+ var _a;
123
+ const {
124
+ activeKey,
125
+ defaultActiveKey,
126
+ onChange,
127
+ items,
128
+ fixed = true,
129
+ className,
130
+ style
131
+ } = props;
132
+ const [currentKey, setCurrentKey] = React.useState(
133
+ activeKey ?? defaultActiveKey ?? ((_a = items == null ? void 0 : items[0]) == null ? void 0 : _a.key)
134
+ );
135
+ React.useEffect(() => {
136
+ if (activeKey !== void 0) {
137
+ setCurrentKey(activeKey);
138
+ }
139
+ }, [activeKey]);
140
+ const handleItemClick = (key) => {
141
+ if (activeKey === void 0) {
142
+ setCurrentKey(key);
143
+ }
144
+ onChange == null ? void 0 : onChange(key);
145
+ };
146
+ const containerCls = classnames("wz-tabbar", { "wz-tabbar-fixed": fixed }, className);
147
+ return /* @__PURE__ */ jsx("div", { className: containerCls, style, children: items.map((item) => /* @__PURE__ */ createElement(
148
+ TabbarItem,
149
+ {
150
+ ...item,
151
+ key: item.key,
152
+ active: !item.hump && currentKey === item.key,
153
+ onItemClick: () => handleItemClick(item.key)
154
+ }
155
+ )) });
156
+ };
157
+ export {
158
+ Tabbar as default
159
+ };
@@ -0,0 +1,6 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react/jsx-runtime"),require("react")):"function"==typeof define&&define.amd?define(["react/jsx-runtime","react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Tabbar=t(e.jsxRuntime,e.React)}(this,(function(e,t){"use strict";function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i,r={exports:{}};
2
+ /*!
3
+ Copyright (c) 2018 Jed Watson.
4
+ Licensed under the MIT License (MIT), see
5
+ http://jedwatson.github.io/classnames
6
+ */i=r,function(){var e={}.hasOwnProperty;function t(){for(var a=[],i=0;i<arguments.length;i++){var r=arguments[i];if(r){var n=typeof r;if("string"===n||"number"===n)a.push(r);else if(Array.isArray(r)){if(r.length){var s=t.apply(null,r);s&&a.push(s)}}else if("object"===n){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){a.push(r.toString());continue}for(var o in r)e.call(r,o)&&r[o]&&a.push(o)}}}return a.join(" ")}i.exports?(t.default=t,i.exports=t):window.classNames=t}();const n=a(r.exports),s=({name:t,size:a=24,color:i="currentColor",className:r="",style:n,onClick:s,type:o="yunying"})=>{const l={fontSize:"number"==typeof a?`${a}px`:a,color:i,...n},c=`iconfont-${o}`,u=`icon-${t}`;return e.jsx("i",{className:`wz-icon ${c} ${u} ${r}`,style:l,onClick:s})},o=a=>{const{title:i,icon:r,activeIcon:o,badge:l,badgeAsBubble:c,hump:u,active:d,onItemClick:b,onClick:m,activeColor:f}=a,p=t=>"string"==typeof t?e.jsx(s,{name:t}):t,v=n("wz-tabbar-item",{"wz-tabbar-item-active":!u&&d,"wz-tabbar-item-hump":u}),y=t.useMemo((()=>{const e={};return d&&f&&(e.color=f),e}),[d,f]);return e.jsxs("div",{className:v,style:y,onClick:u?m:b,children:[e.jsxs("div",{className:"wz-tabbar-item-icon",children:[p(d&&o||r),l?c?e.jsx("div",{className:"wz-tabbar-item-badge-custom",children:e.jsxs("div",{className:"wz-tabbar-item-badge-bubble",children:[l,e.jsx("div",{className:"wz-tabbar-item-badge-bubble-arrow"})]})}):t.isValidElement(l)?e.jsx("div",{className:"wz-tabbar-item-badge-custom",children:l}):e.jsx("div",{className:"wz-tabbar-item-badge",children:l}):null]}),e.jsx("div",{className:"wz-tabbar-item-title",children:i})]})};return a=>{var i;const{activeKey:r,defaultActiveKey:s,onChange:l,items:c,fixed:u=!0,className:d,style:b}=a,[m,f]=t.useState(r??s??(null==(i=null==c?void 0:c[0])?void 0:i.key));t.useEffect((()=>{void 0!==r&&f(r)}),[r]);const p=n("wz-tabbar",{"wz-tabbar-fixed":u},d);return e.jsx("div",{className:p,style:b,children:c.map((e=>t.createElement(o,{...e,key:e.key,active:!e.hump&&m===e.key,onItemClick:()=>{return t=e.key,void 0===r&&f(t),void(null==l||l(t));var t}})))})}}));
@@ -0,0 +1 @@
1
+ :root{--wz-tabbar-height:52px;--wz-tabbar-bg-color:#fff;--wz-tabbar-border-color:#f0f0f0;--wz-tabbar-item-text-color:#666;--wz-tabbar-item-active-text-color:#0eb549;--wz-tabbar-item-icon-size:24px;--wz-tabbar-item-text-font-size:10px;--wz-tabbar-badge-bg-color:#ff4d4f;--wz-tabbar-badge-color:#fff;--wz-tabbar-badge-font-size:12px}.wz-tabbar{height:var(--wz-tabbar-height);background-color:var(--wz-tabbar-bg-color);border-top:1px solid var(--wz-tabbar-border-color);box-sizing:border-box;width:100%;display:flex}.wz-tabbar.wz-tabbar-fixed{z-index:999;position:fixed;bottom:0;left:0;right:0}body:has(.wz-tabbar-fixed){padding-bottom:var(--wz-tabbar-height)}.wz-tabbar-item{color:var(--wz-tabbar-item-text-color);cursor:pointer;-webkit-tap-highlight-color:transparent;outline:none;flex-direction:column;flex:1;justify-content:center;align-items:center;display:flex}.wz-tabbar-item .wz-tabbar-item-icon{font-size:var(--wz-tabbar-item-icon-size);margin-bottom:4px;position:relative}.wz-tabbar-item .wz-tabbar-item-icon .wz-tabbar-item-badge{background-color:var(--wz-tabbar-badge-bg-color);color:var(--wz-tabbar-badge-color);font-size:var(--wz-tabbar-badge-font-size);text-align:center;box-sizing:border-box;border-radius:10px;min-width:16px;height:16px;padding:0 4px;line-height:16px;position:absolute;top:-2px;right:-8px;transform:translate(50%,-10%)}.wz-tabbar-item .wz-tabbar-item-icon .wz-tabbar-item-badge-custom{z-index:1;position:absolute;top:-25px;left:50%;transform:translate(-50%)}.wz-tabbar-item .wz-tabbar-item-badge-bubble{color:#fff;white-space:nowrap;background:linear-gradient(135deg,#ff9c38,#fd631a);border-radius:9px;padding:4px 8px;font-size:10px;position:relative}.wz-tabbar-item .wz-tabbar-item-badge-bubble-arrow{content:"";border-top:4px solid #fe7f36;border-left:4px solid #0000;border-right:4px solid #0000;width:0;height:0;margin-left:-4px;position:absolute;bottom:-4px;left:50%}.wz-tabbar-item .wz-tabbar-item-title{font-size:var(--wz-tabbar-item-text-font-size)}.wz-tabbar-item.wz-tabbar-item-active{color:var(--wz-tabbar-item-active-text-color)}.wz-tabbar-item.wz-tabbar-item-hump .wz-tabbar-item-icon{color:#fff;background:linear-gradient(135deg,#89d028,#1fa71f);border:none;border-radius:50%;justify-content:center;align-items:center;width:48px;height:48px;margin-top:-30px;display:flex;box-shadow:0 -2px 4px #0000000d}.wz-tabbar-item.wz-tabbar-item-hump .wz-tabbar-item-title{margin-top:4px}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ .wz-icon{justify-content:center;align-items:center;transition:color .2s ease-in-out;display:inline-flex}.wz-icon-home:before{content:""}.wz-icon-search:before{content:""}.wz-icon-person:before{content:""}.wz-icon-settings:before{content:""}.wz-icon-notifications:before{content:""}.wz-icon-message:before{content:""}.wz-icon-favorite:before{content:""}.wz-icon-star:before{content:""}.wz-icon-close:before{content:""}.wz-icon-check:before{content:""}.wz-icon-arrow-back:before{content:""}.wz-icon-arrow-forward:before{content:""}.wz-icon-menu:before{content:""}.wz-icon-more:before{content:""}.wz-icon-add:before{content:""}.wz-icon-edit:before{content:""}.wz-icon-delete:before{content:""}.wz-icon-share:before{content:""}.wz-icon-download:before{content:""}.wz-icon-upload:before{content:""}.wz-icon-refresh:before{content:""}.wz-icon-help:before{content:""}.wz-icon-info:before{content:""}.wz-icon-warning:before{content:""}.wz-icon-error:before{content:""}.wz-icon-success:before{content:""}:root{--wz-tabbar-height:52px;--wz-tabbar-bg-color:#fff;--wz-tabbar-border-color:#f0f0f0;--wz-tabbar-item-text-color:#666;--wz-tabbar-item-active-text-color:#0eb549;--wz-tabbar-item-icon-size:24px;--wz-tabbar-item-text-font-size:10px;--wz-tabbar-badge-bg-color:#ff4d4f;--wz-tabbar-badge-color:#fff;--wz-tabbar-badge-font-size:12px}.wz-tabbar{height:var(--wz-tabbar-height);background-color:var(--wz-tabbar-bg-color);border-top:1px solid var(--wz-tabbar-border-color);box-sizing:border-box;width:100%;display:flex}.wz-tabbar.wz-tabbar-fixed{z-index:999;position:fixed;bottom:0;left:0;right:0}body:has(.wz-tabbar-fixed){padding-bottom:var(--wz-tabbar-height)}.wz-tabbar-item{color:var(--wz-tabbar-item-text-color);cursor:pointer;-webkit-tap-highlight-color:transparent;outline:none;flex-direction:column;flex:1;justify-content:center;align-items:center;display:flex}.wz-tabbar-item .wz-tabbar-item-icon{font-size:var(--wz-tabbar-item-icon-size);margin-bottom:4px;position:relative}.wz-tabbar-item .wz-tabbar-item-icon .wz-tabbar-item-badge{background-color:var(--wz-tabbar-badge-bg-color);color:var(--wz-tabbar-badge-color);font-size:var(--wz-tabbar-badge-font-size);text-align:center;box-sizing:border-box;border-radius:10px;min-width:16px;height:16px;padding:0 4px;line-height:16px;position:absolute;top:-2px;right:-8px;transform:translate(50%,-10%)}.wz-tabbar-item .wz-tabbar-item-icon .wz-tabbar-item-badge-custom{z-index:1;position:absolute;top:-25px;left:50%;transform:translate(-50%)}.wz-tabbar-item .wz-tabbar-item-badge-bubble{color:#fff;white-space:nowrap;background:linear-gradient(135deg,#ff9c38,#fd631a);border-radius:9px;padding:4px 8px;font-size:10px;position:relative}.wz-tabbar-item .wz-tabbar-item-badge-bubble-arrow{content:"";border-top:4px solid #fe7f36;border-left:4px solid #0000;border-right:4px solid #0000;width:0;height:0;margin-left:-4px;position:absolute;bottom:-4px;left:50%}.wz-tabbar-item .wz-tabbar-item-title{font-size:var(--wz-tabbar-item-text-font-size)}.wz-tabbar-item.wz-tabbar-item-active{color:var(--wz-tabbar-item-active-text-color)}.wz-tabbar-item.wz-tabbar-item-hump .wz-tabbar-item-icon{color:#fff;background:linear-gradient(135deg,#89d028,#1fa71f);border:none;border-radius:50%;justify-content:center;align-items:center;width:48px;height:48px;margin-top:-30px;display:flex;box-shadow:0 -2px 4px #0000000d}.wz-tabbar-item.wz-tabbar-item-hump .wz-tabbar-item-title{margin-top:4px}
@@ -0,0 +1,50 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useState, Children } from "react";
3
+ const TabPane = ({ children }) => {
4
+ return /* @__PURE__ */ jsx(Fragment, { children });
5
+ };
6
+ const Tabs = ({
7
+ type = "line",
8
+ value,
9
+ defaultValue = 0,
10
+ onChange,
11
+ className = "",
12
+ style,
13
+ headerClassName = "",
14
+ headerStyle,
15
+ contentClassName = "",
16
+ contentStyle,
17
+ children
18
+ }) => {
19
+ const isControlled = value !== void 0;
20
+ const [innerValue, setInnerValue] = useState(defaultValue);
21
+ const activeIndex = isControlled ? value : innerValue;
22
+ const panes = Children.toArray(children).filter(Boolean);
23
+ const handleTabClick = (idx, disabled) => {
24
+ if (disabled) return;
25
+ if (!isControlled) setInnerValue(idx);
26
+ onChange == null ? void 0 : onChange(idx);
27
+ };
28
+ return /* @__PURE__ */ jsxs("div", { className: `wz-tabs wz-tabs-${type} ${className}`, style, children: [
29
+ /* @__PURE__ */ jsx("div", { className: `wz-tabs-header ${headerClassName}`, style: headerStyle, children: panes.map((pane, idx) => /* @__PURE__ */ jsxs(
30
+ "div",
31
+ {
32
+ className: `wz-tabs-tab${idx === activeIndex ? " wz-tabs-tab-active" : ""}${pane.props.disabled ? " wz-tabs-tab-disabled" : ""}`,
33
+ onClick: () => handleTabClick(idx, pane.props.disabled),
34
+ children: [
35
+ /* @__PURE__ */ jsxs("div", { className: "wz-tabs-tab-text", children: [
36
+ pane.props.title,
37
+ pane.props.badge && /* @__PURE__ */ jsx("div", { className: "wz-tabs-badge", children: pane.props.badge })
38
+ ] }),
39
+ idx === activeIndex && type === "line" && /* @__PURE__ */ jsx("div", { className: "wz-tabs-underline" })
40
+ ]
41
+ },
42
+ idx
43
+ )) }),
44
+ /* @__PURE__ */ jsx("div", { className: `wz-tabs-content ${contentClassName}`, style: contentStyle, children: panes[activeIndex] })
45
+ ] });
46
+ };
47
+ Tabs.TabPane = TabPane;
48
+ export {
49
+ Tabs as default
50
+ };
@@ -0,0 +1 @@
1
+ !function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s(require("react/jsx-runtime"),require("react")):"function"==typeof define&&define.amd?define(["react/jsx-runtime","react"],s):(e="undefined"!=typeof globalThis?globalThis:e||self).Tabs=s(e.jsxRuntime,e.React)}(this,(function(e,s){"use strict";const a=({type:a="line",value:t,defaultValue:l=0,onChange:n,className:i="",style:d,headerClassName:r="",headerStyle:c,contentClassName:o="",contentStyle:b,children:u})=>{const m=void 0!==t,[p,h]=s.useState(l),f=m?t:p,x=s.Children.toArray(u).filter(Boolean);return e.jsxs("div",{className:`wz-tabs wz-tabs-${a} ${i}`,style:d,children:[e.jsx("div",{className:`wz-tabs-header ${r}`,style:c,children:x.map(((s,t)=>e.jsxs("div",{className:`wz-tabs-tab${t===f?" wz-tabs-tab-active":""}${s.props.disabled?" wz-tabs-tab-disabled":""}`,onClick:()=>((e,s)=>{s||(m||h(e),null==n||n(e))})(t,s.props.disabled),children:[e.jsxs("div",{className:"wz-tabs-tab-text",children:[s.props.title,s.props.badge&&e.jsx("div",{className:"wz-tabs-badge",children:s.props.badge})]}),t===f&&"line"===a&&e.jsx("div",{className:"wz-tabs-underline"})]},t)))}),e.jsx("div",{className:`wz-tabs-content ${o}`,style:b,children:x[f]})]})};return a.TabPane=({children:s})=>e.jsx(e.Fragment,{children:s}),a}));
@@ -0,0 +1 @@
1
+ .wz-tabs{box-sizing:border-box;background:#fff;width:100%}.wz-tabs-header{z-index:1;background:#fff;border-bottom:1px solid #dcdfe6;display:flex;position:relative}.wz-tabs-tab{text-align:center;color:#666;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;background:0 0;outline:none;flex:1;padding:12px 0;font-size:14px;transition:color .2s ease-in-out;position:relative}.wz-tabs-tab-active{color:var(--wz-primary-color,#22c94d);font-weight:600}.wz-tabs-tab-disabled{color:#c0c4cc;cursor:not-allowed;opacity:.5}.wz-tabs-tab-text{display:inline-block;position:relative}.wz-tabs-tab .wz-tabs-badge{color:#fff;white-space:nowrap;z-index:1;box-sizing:border-box;text-align:center;background-color:#ff4d4f;border-radius:16px;min-width:16px;height:16px;padding:0 4px;font-size:12px;line-height:16px;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.wz-tabs-underline{background:var(--wz-primary-color,#22c94d);border-radius:2px;width:40%;height:2px;transition:all .2s ease-in-out;position:absolute;bottom:0;left:50%;transform:translate(-50%)}.wz-tabs-content{color:#666;background:#fff;padding:12px;font-size:14px}.wz-tabs-card .wz-tabs-header{background-color:#0000;border-bottom:none;gap:14px}.wz-tabs-card .wz-tabs-tab{color:#333;background-color:#f5f5f5;border:none;border-radius:20px;margin:0;padding:6px 16px;font-size:14px;line-height:20px;transition:all .3s}.wz-tabs-card .wz-tabs-tab-active{background-color:var(--wz-primary-color,#22c94d);color:#fff;font-weight:700}.wz-tabs-card .wz-tabs-tab-disabled{color:#ccc;cursor:not-allowed;background-color:#f5f5f5}.wz-tabs-card .wz-tabs-content{padding-top:10px}.wz-tabs-pills .wz-tabs-header{background-color:#0000;border-bottom:none;flex-wrap:wrap;gap:14px}.wz-tabs-pills .wz-tabs-tab{color:#333;flex:initial;background-color:#f5f5f5;border:none;border-radius:20px;margin:0;padding:6px 16px;font-size:14px;line-height:20px;transition:all .3s}.wz-tabs-pills .wz-tabs-tab-active{background-color:var(--wz-primary-color,#22c94d);color:#fff;font-weight:700}.wz-tabs-pills .wz-tabs-tab-disabled{color:#ccc;cursor:not-allowed;background-color:#f5f5f5}.wz-tabs-pills .wz-tabs-content{padding-top:10px}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ .wz-tabs{box-sizing:border-box;background:#fff;width:100%}.wz-tabs-header{z-index:1;background:#fff;border-bottom:1px solid #dcdfe6;display:flex;position:relative}.wz-tabs-tab{text-align:center;color:#666;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;background:0 0;outline:none;flex:1;padding:12px 0;font-size:14px;transition:color .2s ease-in-out;position:relative}.wz-tabs-tab-active{color:var(--wz-primary-color,#22c94d);font-weight:600}.wz-tabs-tab-disabled{color:#c0c4cc;cursor:not-allowed;opacity:.5}.wz-tabs-tab-text{display:inline-block;position:relative}.wz-tabs-tab .wz-tabs-badge{color:#fff;white-space:nowrap;z-index:1;box-sizing:border-box;text-align:center;background-color:#ff4d4f;border-radius:16px;min-width:16px;height:16px;padding:0 4px;font-size:12px;line-height:16px;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.wz-tabs-underline{background:var(--wz-primary-color,#22c94d);border-radius:2px;width:40%;height:2px;transition:all .2s ease-in-out;position:absolute;bottom:0;left:50%;transform:translate(-50%)}.wz-tabs-content{color:#666;background:#fff;padding:12px;font-size:14px}.wz-tabs-card .wz-tabs-header{background-color:#0000;border-bottom:none;gap:14px}.wz-tabs-card .wz-tabs-tab{color:#333;background-color:#f5f5f5;border:none;border-radius:20px;margin:0;padding:6px 16px;font-size:14px;line-height:20px;transition:all .3s}.wz-tabs-card .wz-tabs-tab-active{background-color:var(--wz-primary-color,#22c94d);color:#fff;font-weight:700}.wz-tabs-card .wz-tabs-tab-disabled{color:#ccc;cursor:not-allowed;background-color:#f5f5f5}.wz-tabs-card .wz-tabs-content{padding-top:10px}.wz-tabs-pills .wz-tabs-header{background-color:#0000;border-bottom:none;flex-wrap:wrap;gap:14px}.wz-tabs-pills .wz-tabs-tab{color:#333;flex:initial;background-color:#f5f5f5;border:none;border-radius:20px;margin:0;padding:6px 16px;font-size:14px;line-height:20px;transition:all .3s}.wz-tabs-pills .wz-tabs-tab-active{background-color:var(--wz-primary-color,#22c94d);color:#fff;font-weight:700}.wz-tabs-pills .wz-tabs-tab-disabled{color:#ccc;cursor:not-allowed;background-color:#f5f5f5}.wz-tabs-pills .wz-tabs-content{padding-top:10px}
@@ -0,0 +1,96 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ function getDefaultExportFromCjs(x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
+ }
6
+ var classnames$1 = { exports: {} };
7
+ /*!
8
+ Copyright (c) 2018 Jed Watson.
9
+ Licensed under the MIT License (MIT), see
10
+ http://jedwatson.github.io/classnames
11
+ */
12
+ (function(module) {
13
+ (function() {
14
+ var hasOwn = {}.hasOwnProperty;
15
+ function classNames() {
16
+ var classes = [];
17
+ for (var i = 0; i < arguments.length; i++) {
18
+ var arg = arguments[i];
19
+ if (!arg) continue;
20
+ var argType = typeof arg;
21
+ if (argType === "string" || argType === "number") {
22
+ classes.push(arg);
23
+ } else if (Array.isArray(arg)) {
24
+ if (arg.length) {
25
+ var inner = classNames.apply(null, arg);
26
+ if (inner) {
27
+ classes.push(inner);
28
+ }
29
+ }
30
+ } else if (argType === "object") {
31
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
32
+ classes.push(arg.toString());
33
+ continue;
34
+ }
35
+ for (var key in arg) {
36
+ if (hasOwn.call(arg, key) && arg[key]) {
37
+ classes.push(key);
38
+ }
39
+ }
40
+ }
41
+ }
42
+ return classes.join(" ");
43
+ }
44
+ if (module.exports) {
45
+ classNames.default = classNames;
46
+ module.exports = classNames;
47
+ } else {
48
+ window.classNames = classNames;
49
+ }
50
+ })();
51
+ })(classnames$1);
52
+ var classnamesExports = classnames$1.exports;
53
+ const classnames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
54
+ function hexToRgba(hex, opacity) {
55
+ let newHex = hex.replace("#", "");
56
+ if (newHex.length === 3) {
57
+ newHex = newHex.split("").map((char) => char + char).join("");
58
+ }
59
+ const r = parseInt(newHex.substring(0, 2), 16);
60
+ const g = parseInt(newHex.substring(2, 4), 16);
61
+ const b = parseInt(newHex.substring(4, 6), 16);
62
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
63
+ }
64
+ const Tag = (props) => {
65
+ const {
66
+ type = "solid",
67
+ size = "large",
68
+ color,
69
+ bgColor,
70
+ fontWeight,
71
+ className,
72
+ style,
73
+ children
74
+ } = props;
75
+ const classes = classnames("wz-tag", `wz-tag-${type}`, `wz-tag-${size}`, className);
76
+ const tagStyle = useMemo(() => {
77
+ const newStyle = { ...style };
78
+ if (color) {
79
+ newStyle.color = color;
80
+ if (type === "line") {
81
+ newStyle.borderColor = hexToRgba(color, 0.5);
82
+ }
83
+ }
84
+ if (bgColor && type === "solid") {
85
+ newStyle.backgroundColor = bgColor;
86
+ }
87
+ if (fontWeight) {
88
+ newStyle.fontWeight = fontWeight;
89
+ }
90
+ return newStyle;
91
+ }, [type, color, bgColor, fontWeight, style]);
92
+ return /* @__PURE__ */ jsx("div", { className: classes, style: tagStyle, children });
93
+ };
94
+ export {
95
+ Tag as default
96
+ };
@@ -0,0 +1,6 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react/jsx-runtime"),require("react")):"function"==typeof define&&define.amd?define(["react/jsx-runtime","react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Tag=t(e.jsxRuntime,e.React)}(this,(function(e,t){"use strict";function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,o={exports:{}};
2
+ /*!
3
+ Copyright (c) 2018 Jed Watson.
4
+ Licensed under the MIT License (MIT), see
5
+ http://jedwatson.github.io/classnames
6
+ */n=o,function(){var e={}.hasOwnProperty;function t(){for(var r=[],n=0;n<arguments.length;n++){var o=arguments[n];if(o){var i=typeof o;if("string"===i||"number"===i)r.push(o);else if(Array.isArray(o)){if(o.length){var s=t.apply(null,o);s&&r.push(s)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){r.push(o.toString());continue}for(var a in o)e.call(o,a)&&o[a]&&r.push(a)}}}return r.join(" ")}n.exports?(t.default=t,n.exports=t):window.classNames=t}();const i=r(o.exports);return r=>{const{type:n="solid",size:o="large",color:s,bgColor:a,fontWeight:l,className:u,style:c,children:f}=r,p=i("wz-tag",`wz-tag-${n}`,`wz-tag-${o}`,u),d=t.useMemo((()=>{const e={...c};return s&&(e.color=s,"line"===n&&(e.borderColor=function(e,t){let r=e.replace("#","");return 3===r.length&&(r=r.split("").map((e=>e+e)).join("")),`rgba(${parseInt(r.substring(0,2),16)}, ${parseInt(r.substring(2,4),16)}, ${parseInt(r.substring(4,6),16)}, ${t})`}(s,.5))),a&&"solid"===n&&(e.backgroundColor=a),l&&(e.fontWeight=l),e}),[n,s,a,l,c]);return e.jsx("div",{className:p,style:d,children:f})}}));
@@ -0,0 +1 @@
1
+ .wz-tag{white-space:nowrap;box-sizing:border-box;vertical-align:middle;align-items:center;display:inline-flex}.wz-tag.wz-tag-solid{color:#666;background-color:#f7f7f7}.wz-tag.wz-tag-line{background-color:#0000;border:1px solid}.wz-tag.wz-tag-large{border-radius:4px;height:22px;padding:0 10px;font-size:13px;line-height:20px}.wz-tag.wz-tag-small{border-radius:3px;height:20px;padding:0 8px;font-size:12px;line-height:18px}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ .wz-tag{white-space:nowrap;box-sizing:border-box;vertical-align:middle;align-items:center;display:inline-flex}.wz-tag.wz-tag-solid{color:#666;background-color:#f7f7f7}.wz-tag.wz-tag-line{background-color:#0000;border:1px solid}.wz-tag.wz-tag-large{border-radius:4px;height:22px;padding:0 10px;font-size:13px;line-height:20px}.wz-tag.wz-tag-small{border-radius:3px;height:20px;padding:0 8px;font-size:12px;line-height:18px}
@@ -0,0 +1,201 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useRef, useEffect } from "react";
3
+ const defaultSingleOptions = Array.from({ length: 24 }, (_, i) => `${i + 1}小时`);
4
+ const hourOptions = Array.from({ length: 24 }, (_, i) => i.toString().padStart(2, "0"));
5
+ const minuteOptions = Array.from({ length: 60 }, (_, i) => i.toString().padStart(2, "0"));
6
+ const TimePicker = ({
7
+ type = "single",
8
+ options,
9
+ value,
10
+ onChange,
11
+ className = "",
12
+ style,
13
+ itemHeight = 48
14
+ }) => {
15
+ if (type === "single") {
16
+ const pickerOptions = options && options.length > 0 ? options : defaultSingleOptions;
17
+ const [current, setCurrent] = useState(() => {
18
+ const idx = value ? pickerOptions.indexOf(value) : 0;
19
+ return idx >= 0 ? idx : 0;
20
+ });
21
+ const wrapperRef = useRef(null);
22
+ const startY2 = useRef(0);
23
+ const startScroll2 = useRef(0);
24
+ const isDragging2 = useRef(false);
25
+ useEffect(() => {
26
+ if (value && pickerOptions.includes(value)) {
27
+ setCurrent(pickerOptions.indexOf(value));
28
+ }
29
+ }, [value, pickerOptions]);
30
+ useEffect(() => {
31
+ if (wrapperRef.current) {
32
+ wrapperRef.current.scrollTo({
33
+ top: current * itemHeight,
34
+ behavior: "smooth"
35
+ });
36
+ }
37
+ }, [current, itemHeight]);
38
+ const handleTouchStart2 = (e) => {
39
+ var _a;
40
+ isDragging2.current = true;
41
+ startY2.current = e.touches[0].clientY;
42
+ startScroll2.current = ((_a = wrapperRef.current) == null ? void 0 : _a.scrollTop) || 0;
43
+ };
44
+ const handleTouchMove2 = (e) => {
45
+ if (!isDragging2.current) return;
46
+ const deltaY = e.touches[0].clientY - startY2.current;
47
+ if (wrapperRef.current) {
48
+ wrapperRef.current.scrollTop = startScroll2.current - deltaY;
49
+ }
50
+ };
51
+ const handleTouchEnd2 = () => {
52
+ isDragging2.current = false;
53
+ if (!wrapperRef.current) return;
54
+ const idx = Math.round(wrapperRef.current.scrollTop / itemHeight);
55
+ setCurrent(idx);
56
+ onChange == null ? void 0 : onChange(pickerOptions[idx]);
57
+ };
58
+ const handleScroll2 = () => {
59
+ if (!isDragging2.current && wrapperRef.current) {
60
+ const idx = Math.round(wrapperRef.current.scrollTop / itemHeight);
61
+ setCurrent(idx);
62
+ onChange == null ? void 0 : onChange(pickerOptions[idx]);
63
+ }
64
+ };
65
+ const isItemActive = (index) => index === current;
66
+ return /* @__PURE__ */ jsxs("div", { className: `wz-time-picker ${className}`, style, children: [
67
+ /* @__PURE__ */ jsx("div", { className: "wz-time-picker-mask wz-time-picker-mask-top", style: { height: itemHeight } }),
68
+ /* @__PURE__ */ jsx("div", { className: "wz-time-picker-indicator", style: { height: itemHeight } }),
69
+ /* @__PURE__ */ jsxs(
70
+ "div",
71
+ {
72
+ className: "wz-time-picker-list",
73
+ ref: wrapperRef,
74
+ style: { height: itemHeight * 3 },
75
+ onTouchStart: handleTouchStart2,
76
+ onTouchMove: handleTouchMove2,
77
+ onTouchEnd: handleTouchEnd2,
78
+ onScroll: handleScroll2,
79
+ children: [
80
+ /* @__PURE__ */ jsx("div", { style: { height: itemHeight } }),
81
+ pickerOptions.map((opt, idx) => /* @__PURE__ */ jsx(
82
+ "div",
83
+ {
84
+ className: `wz-time-picker-item${isItemActive(idx) ? " active" : ""}`,
85
+ style: { height: itemHeight },
86
+ children: opt
87
+ },
88
+ opt
89
+ )),
90
+ /* @__PURE__ */ jsx("div", { style: { height: itemHeight } })
91
+ ]
92
+ }
93
+ ),
94
+ /* @__PURE__ */ jsx("div", { className: "wz-time-picker-mask wz-time-picker-mask-bottom", style: { height: itemHeight } })
95
+ ] });
96
+ }
97
+ const [hour, minute] = value ? value.split(":") : [hourOptions[0], minuteOptions[0]];
98
+ const [currentHour, setCurrentHour] = useState(hourOptions.indexOf(hour));
99
+ const [currentMinute, setCurrentMinute] = useState(minuteOptions.indexOf(minute));
100
+ const hourRef = useRef(null);
101
+ const minuteRef = useRef(null);
102
+ const startY = useRef(0);
103
+ const startScroll = useRef(0);
104
+ const isDragging = useRef(false);
105
+ const dragType = useRef(null);
106
+ useEffect(() => {
107
+ if (hourRef.current) {
108
+ hourRef.current.scrollTo({
109
+ top: currentHour * itemHeight,
110
+ behavior: "smooth"
111
+ });
112
+ }
113
+ }, [currentHour, itemHeight]);
114
+ useEffect(() => {
115
+ if (minuteRef.current) {
116
+ minuteRef.current.scrollTo({
117
+ top: currentMinute * itemHeight,
118
+ behavior: "smooth"
119
+ });
120
+ }
121
+ }, [currentMinute, itemHeight]);
122
+ const handleTouchStart = (type2) => (e) => {
123
+ var _a, _b;
124
+ isDragging.current = true;
125
+ dragType.current = type2;
126
+ startY.current = e.touches[0].clientY;
127
+ startScroll.current = (type2 === "hour" ? (_a = hourRef.current) == null ? void 0 : _a.scrollTop : (_b = minuteRef.current) == null ? void 0 : _b.scrollTop) || 0;
128
+ };
129
+ const handleTouchMove = (e) => {
130
+ if (!isDragging.current || !dragType.current) return;
131
+ const deltaY = e.touches[0].clientY - startY.current;
132
+ if (dragType.current === "hour" && hourRef.current) {
133
+ hourRef.current.scrollTop = startScroll.current - deltaY;
134
+ } else if (dragType.current === "minute" && minuteRef.current) {
135
+ minuteRef.current.scrollTop = startScroll.current - deltaY;
136
+ }
137
+ };
138
+ const handleTouchEnd = () => {
139
+ if (!isDragging.current || !dragType.current) return;
140
+ if (dragType.current === "hour" && hourRef.current) {
141
+ const idx = Math.round(hourRef.current.scrollTop / itemHeight);
142
+ setCurrentHour(idx);
143
+ onChange == null ? void 0 : onChange(`${hourOptions[idx]}:${minuteOptions[currentMinute]}`);
144
+ } else if (dragType.current === "minute" && minuteRef.current) {
145
+ const idx = Math.round(minuteRef.current.scrollTop / itemHeight);
146
+ setCurrentMinute(idx);
147
+ onChange == null ? void 0 : onChange(`${hourOptions[currentHour]}:${minuteOptions[idx]}`);
148
+ }
149
+ isDragging.current = false;
150
+ dragType.current = null;
151
+ };
152
+ const handleScroll = (type2) => () => {
153
+ if (isDragging.current) return;
154
+ if (type2 === "hour" && hourRef.current) {
155
+ const idx = Math.round(hourRef.current.scrollTop / itemHeight);
156
+ setCurrentHour(idx);
157
+ onChange == null ? void 0 : onChange(`${hourOptions[idx]}:${minuteOptions[currentMinute]}`);
158
+ } else if (type2 === "minute" && minuteRef.current) {
159
+ const idx = Math.round(minuteRef.current.scrollTop / itemHeight);
160
+ setCurrentMinute(idx);
161
+ onChange == null ? void 0 : onChange(`${hourOptions[currentHour]}:${minuteOptions[idx]}`);
162
+ }
163
+ };
164
+ const renderColumn = (options2, current, ref, type2) => /* @__PURE__ */ jsxs(
165
+ "div",
166
+ {
167
+ className: "wz-time-picker-list",
168
+ ref,
169
+ style: { height: itemHeight * 3 },
170
+ onTouchStart: handleTouchStart(type2),
171
+ onTouchMove: handleTouchMove,
172
+ onTouchEnd: handleTouchEnd,
173
+ onScroll: handleScroll(type2),
174
+ children: [
175
+ /* @__PURE__ */ jsx("div", { style: { height: itemHeight } }),
176
+ options2.map((opt, idx) => /* @__PURE__ */ jsx(
177
+ "div",
178
+ {
179
+ className: `wz-time-picker-item${idx === current ? " active" : ""}`,
180
+ style: { height: itemHeight },
181
+ children: opt
182
+ },
183
+ opt
184
+ )),
185
+ /* @__PURE__ */ jsx("div", { style: { height: itemHeight } })
186
+ ]
187
+ }
188
+ );
189
+ return /* @__PURE__ */ jsxs("div", { className: `wz-time-picker wz-time-picker-double ${className}`, style, children: [
190
+ /* @__PURE__ */ jsx("div", { className: "wz-time-picker-mask wz-time-picker-mask-top", style: { height: itemHeight } }),
191
+ /* @__PURE__ */ jsx("div", { className: "wz-time-picker-indicator", style: { height: itemHeight } }),
192
+ /* @__PURE__ */ jsxs("div", { className: "wz-time-picker-double-columns", children: [
193
+ renderColumn(hourOptions, currentHour, hourRef, "hour"),
194
+ renderColumn(minuteOptions, currentMinute, minuteRef, "minute")
195
+ ] }),
196
+ /* @__PURE__ */ jsx("div", { className: "wz-time-picker-mask wz-time-picker-mask-bottom", style: { height: itemHeight } })
197
+ ] });
198
+ };
199
+ export {
200
+ TimePicker as default
201
+ };
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react/jsx-runtime"),require("react")):"function"==typeof define&&define.amd?define(["react/jsx-runtime","react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).TimePicker=t(e.jsxRuntime,e.React)}(this,(function(e,t){"use strict";const r=Array.from({length:24},((e,t)=>`${t+1}小时`)),c=Array.from({length:24},((e,t)=>t.toString().padStart(2,"0"))),n=Array.from({length:60},((e,t)=>t.toString().padStart(2,"0")));return({type:s="single",options:i,value:u,onChange:l,className:o="",style:a,itemHeight:h=48})=>{if("single"===s){const c=i&&i.length>0?i:r,[n,s]=t.useState((()=>{const e=u?c.indexOf(u):0;return e>=0?e:0})),m=t.useRef(null),d=t.useRef(0),f=t.useRef(0),p=t.useRef(!1);t.useEffect((()=>{u&&c.includes(u)&&s(c.indexOf(u))}),[u,c]),t.useEffect((()=>{m.current&&m.current.scrollTo({top:n*h,behavior:"smooth"})}),[n,h]);const v=e=>{var t;p.current=!0,d.current=e.touches[0].clientY,f.current=(null==(t=m.current)?void 0:t.scrollTop)||0},k=e=>{if(!p.current)return;const t=e.touches[0].clientY-d.current;m.current&&(m.current.scrollTop=f.current-t)},g=()=>{if(p.current=!1,!m.current)return;const e=Math.round(m.current.scrollTop/h);s(e),null==l||l(c[e])},x=()=>{if(!p.current&&m.current){const e=Math.round(m.current.scrollTop/h);s(e),null==l||l(c[e])}},y=e=>e===n;return e.jsxs("div",{className:`wz-time-picker ${o}`,style:a,children:[e.jsx("div",{className:"wz-time-picker-mask wz-time-picker-mask-top",style:{height:h}}),e.jsx("div",{className:"wz-time-picker-indicator",style:{height:h}}),e.jsxs("div",{className:"wz-time-picker-list",ref:m,style:{height:3*h},onTouchStart:v,onTouchMove:k,onTouchEnd:g,onScroll:x,children:[e.jsx("div",{style:{height:h}}),c.map(((t,r)=>e.jsx("div",{className:"wz-time-picker-item"+(y(r)?" active":""),style:{height:h},children:t},t))),e.jsx("div",{style:{height:h}})]}),e.jsx("div",{className:"wz-time-picker-mask wz-time-picker-mask-bottom",style:{height:h}})]})}const[m,d]=u?u.split(":"):[c[0],n[0]],[f,p]=t.useState(c.indexOf(m)),[v,k]=t.useState(n.indexOf(d)),g=t.useRef(null),x=t.useRef(null),y=t.useRef(0),T=t.useRef(0),j=t.useRef(!1),w=t.useRef(null);t.useEffect((()=>{g.current&&g.current.scrollTo({top:f*h,behavior:"smooth"})}),[f,h]),t.useEffect((()=>{x.current&&x.current.scrollTo({top:v*h,behavior:"smooth"})}),[v,h]);const z=e=>t=>{var r,c;j.current=!0,w.current=e,y.current=t.touches[0].clientY,T.current=("hour"===e?null==(r=g.current)?void 0:r.scrollTop:null==(c=x.current)?void 0:c.scrollTop)||0},N=e=>{if(!j.current||!w.current)return;const t=e.touches[0].clientY-y.current;"hour"===w.current&&g.current?g.current.scrollTop=T.current-t:"minute"===w.current&&x.current&&(x.current.scrollTop=T.current-t)},R=()=>{if(j.current&&w.current){if("hour"===w.current&&g.current){const e=Math.round(g.current.scrollTop/h);p(e),null==l||l(`${c[e]}:${n[v]}`)}else if("minute"===w.current&&x.current){const e=Math.round(x.current.scrollTop/h);k(e),null==l||l(`${c[f]}:${n[e]}`)}j.current=!1,w.current=null}},S=e=>()=>{if(!j.current)if("hour"===e&&g.current){const e=Math.round(g.current.scrollTop/h);p(e),null==l||l(`${c[e]}:${n[v]}`)}else if("minute"===e&&x.current){const e=Math.round(x.current.scrollTop/h);k(e),null==l||l(`${c[f]}:${n[e]}`)}},$=(t,r,c,n)=>e.jsxs("div",{className:"wz-time-picker-list",ref:c,style:{height:3*h},onTouchStart:z(n),onTouchMove:N,onTouchEnd:R,onScroll:S(n),children:[e.jsx("div",{style:{height:h}}),t.map(((t,c)=>e.jsx("div",{className:"wz-time-picker-item"+(c===r?" active":""),style:{height:h},children:t},t))),e.jsx("div",{style:{height:h}})]});return e.jsxs("div",{className:`wz-time-picker wz-time-picker-double ${o}`,style:a,children:[e.jsx("div",{className:"wz-time-picker-mask wz-time-picker-mask-top",style:{height:h}}),e.jsx("div",{className:"wz-time-picker-indicator",style:{height:h}}),e.jsxs("div",{className:"wz-time-picker-double-columns",children:[$(c,f,g,"hour"),$(n,v,x,"minute")]}),e.jsx("div",{className:"wz-time-picker-mask wz-time-picker-mask-bottom",style:{height:h}})]})}}));
@@ -0,0 +1 @@
1
+ .wz-time-picker{background:var(--wz-time-picker-bg,#f5f5f5);-webkit-user-select:none;user-select:none;touch-action:pan-y;width:100%;position:relative;overflow:hidden}.wz-time-picker-list{-webkit-overflow-scrolling:touch;scrollbar-width:none;z-index:2;position:relative;overflow-y:scroll}.wz-time-picker-list::-webkit-scrollbar{display:none}.wz-time-picker-item{font-size:var(--wz-time-picker-font-size,22px);color:var(--wz-time-picker-item-color,#bbb);background:0 0;justify-content:center;align-items:center;font-weight:600;transition:color .2s;display:flex}.wz-time-picker-item.active{color:var(--wz-time-picker-active-color,#111)}.wz-time-picker-mask{z-index:3;pointer-events:none;position:absolute;left:0;right:0}.wz-time-picker-mask-top{background:linear-gradient(to bottom,var(--wz-time-picker-bg,#f5f5f5)20%,#f5f5f500);top:0}.wz-time-picker-mask-bottom{background:linear-gradient(to top,var(--wz-time-picker-bg,#f5f5f5)20%,#f5f5f500);bottom:0}.wz-time-picker-indicator{z-index:1;pointer-events:none;background:var(--wz-time-picker-active-bg,#fff);border-radius:10px;position:absolute;top:50%;left:10px;right:10px;transform:translateY(-50%)}.wz-time-picker-list:after{content:"";z-index:-1;pointer-events:none;display:block;position:absolute;top:33.33%;bottom:33.33%;left:0;right:0}.wz-time-picker-item:nth-child(n+2):nth-child(-n+99):nth-child(2n){color:var(--wz-time-picker-active-color,#111)}.wz-time-picker-double-columns{flex-direction:row;width:100%;height:100%;display:flex}.wz-time-picker-list{flex:1 1 0;min-width:0}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ .wz-time-picker{background:var(--wz-time-picker-bg,#f5f5f5);-webkit-user-select:none;user-select:none;touch-action:pan-y;width:100%;position:relative;overflow:hidden}.wz-time-picker-list{-webkit-overflow-scrolling:touch;scrollbar-width:none;z-index:2;position:relative;overflow-y:scroll}.wz-time-picker-list::-webkit-scrollbar{display:none}.wz-time-picker-item{font-size:var(--wz-time-picker-font-size,22px);color:var(--wz-time-picker-item-color,#bbb);background:0 0;justify-content:center;align-items:center;font-weight:600;transition:color .2s;display:flex}.wz-time-picker-item.active{color:var(--wz-time-picker-active-color,#111)}.wz-time-picker-mask{z-index:3;pointer-events:none;position:absolute;left:0;right:0}.wz-time-picker-mask-top{background:linear-gradient(to bottom,var(--wz-time-picker-bg,#f5f5f5)20%,#f5f5f500);top:0}.wz-time-picker-mask-bottom{background:linear-gradient(to top,var(--wz-time-picker-bg,#f5f5f5)20%,#f5f5f500);bottom:0}.wz-time-picker-indicator{z-index:1;pointer-events:none;background:var(--wz-time-picker-active-bg,#fff);border-radius:10px;position:absolute;top:50%;left:10px;right:10px;transform:translateY(-50%)}.wz-time-picker-list:after{content:"";z-index:-1;pointer-events:none;display:block;position:absolute;top:33.33%;bottom:33.33%;left:0;right:0}.wz-time-picker-item:nth-child(n+2):nth-child(-n+99):nth-child(2n){color:var(--wz-time-picker-active-color,#111)}.wz-time-picker-double-columns{flex-direction:row;width:100%;height:100%;display:flex}.wz-time-picker-list{flex:1 1 0;min-width:0}