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.
- package/README.md +51 -0
- package/dist/Button/index.js +84 -0
- package/dist/Button/index.umd.cjs +1 -0
- package/dist/Button/style/index.css +1 -0
- package/dist/Button/style/index.js +1 -0
- package/dist/Button/style.css +1 -0
- package/dist/Card/index.js +32 -0
- package/dist/Card/index.umd.cjs +1 -0
- package/dist/Card/style/index.css +1 -0
- package/dist/Card/style/index.js +1 -0
- package/dist/Card/style.css +1 -0
- package/dist/Cascader/index.js +94 -0
- package/dist/Cascader/index.umd.cjs +1 -0
- package/dist/Cascader/style/index.css +1 -0
- package/dist/Cascader/style/index.js +1 -0
- package/dist/Cascader/style.css +1 -0
- package/dist/Cell/index.js +135 -0
- package/dist/Cell/index.umd.cjs +6 -0
- package/dist/Cell/style/index.css +1 -0
- package/dist/Cell/style/index.js +1 -0
- package/dist/Cell/style.css +1 -0
- package/dist/CheckList/index.js +34 -0
- package/dist/CheckList/index.umd.cjs +1 -0
- package/dist/CheckList/style/index.css +1 -0
- package/dist/CheckList/style/index.js +1 -0
- package/dist/CheckList/style.css +1 -0
- package/dist/Checkbox/index.js +84 -0
- package/dist/Checkbox/index.umd.cjs +1 -0
- package/dist/Checkbox/style/index.css +1 -0
- package/dist/Checkbox/style/index.js +1 -0
- package/dist/Checkbox/style.css +1 -0
- package/dist/Collapse/index.js +72 -0
- package/dist/Collapse/index.umd.cjs +1 -0
- package/dist/Collapse/style/index.css +1 -0
- package/dist/Collapse/style/index.js +1 -0
- package/dist/Collapse/style.css +1 -0
- package/dist/DatePicker/index.js +154 -0
- package/dist/DatePicker/index.umd.cjs +1 -0
- package/dist/DatePicker/style/index.css +1 -0
- package/dist/DatePicker/style/index.js +1 -0
- package/dist/DatePicker/style.css +1 -0
- package/dist/DateRangePicker/index.js +220 -0
- package/dist/DateRangePicker/index.umd.cjs +1 -0
- package/dist/DateRangePicker/style/index.css +1 -0
- package/dist/DateRangePicker/style/index.js +1 -0
- package/dist/DateRangePicker/style.css +1 -0
- package/dist/Dialog/index.js +216 -0
- package/dist/Dialog/index.umd.cjs +6 -0
- package/dist/Dialog/style/index.css +1 -0
- package/dist/Dialog/style/index.js +1 -0
- package/dist/Dialog/style.css +1 -0
- package/dist/Divider/index.js +27 -0
- package/dist/Divider/index.umd.cjs +1 -0
- package/dist/Divider/style/index.css +1 -0
- package/dist/Divider/style/index.js +1 -0
- package/dist/Divider/style.css +1 -0
- package/dist/DropDownMenu/index.js +111 -0
- package/dist/DropDownMenu/index.umd.cjs +1 -0
- package/dist/DropDownMenu/style/index.css +1 -0
- package/dist/DropDownMenu/style/index.js +1 -0
- package/dist/DropDownMenu/style.css +1 -0
- package/dist/Flex/index.js +85 -0
- package/dist/Flex/index.umd.cjs +1 -0
- package/dist/Flex/style/index.css +1 -0
- package/dist/Flex/style/index.js +1 -0
- package/dist/Flex/style.css +1 -0
- package/dist/Grid/index.js +54 -0
- package/dist/Grid/index.umd.cjs +1 -0
- package/dist/Grid/style/index.css +1 -0
- package/dist/Grid/style/index.js +1 -0
- package/dist/Grid/style.css +1 -0
- package/dist/GridView/index.js +90 -0
- package/dist/GridView/index.umd.cjs +1 -0
- package/dist/GridView/style/index.css +1 -0
- package/dist/GridView/style/index.js +1 -0
- package/dist/GridView/style.css +1 -0
- package/dist/Icon/index.js +31 -0
- package/dist/Icon/index.umd.cjs +1 -0
- package/dist/Icon/style/index.css +1 -0
- package/dist/Icon/style/index.js +1 -0
- package/dist/Icon/style.css +1 -0
- package/dist/Input/index.js +148 -0
- package/dist/Input/index.umd.cjs +1 -0
- package/dist/Input/style/index.css +1 -0
- package/dist/Input/style/index.js +1 -0
- package/dist/Input/style.css +1 -0
- package/dist/NavBar/index.js +175 -0
- package/dist/NavBar/index.umd.cjs +6 -0
- package/dist/NavBar/style/index.css +1 -0
- package/dist/NavBar/style/index.js +1 -0
- package/dist/NavBar/style.css +1 -0
- package/dist/Popup/index.js +124 -0
- package/dist/Popup/index.umd.cjs +1 -0
- package/dist/Popup/style/index.css +1 -0
- package/dist/Popup/style/index.js +1 -0
- package/dist/Popup/style.css +1 -0
- package/dist/Radio/index.js +82 -0
- package/dist/Radio/index.umd.cjs +1 -0
- package/dist/Radio/style/index.css +1 -0
- package/dist/Radio/style/index.js +1 -0
- package/dist/Radio/style.css +1 -0
- package/dist/Search/index.js +158 -0
- package/dist/Search/index.umd.cjs +1 -0
- package/dist/Search/style/index.css +1 -0
- package/dist/Search/style/index.js +1 -0
- package/dist/Search/style.css +1 -0
- package/dist/Stepper/index.js +140 -0
- package/dist/Stepper/index.umd.cjs +1 -0
- package/dist/Stepper/style/index.css +1 -0
- package/dist/Stepper/style/index.js +1 -0
- package/dist/Stepper/style.css +1 -0
- package/dist/Switch/index.js +53 -0
- package/dist/Switch/index.umd.cjs +1 -0
- package/dist/Switch/style/index.css +1 -0
- package/dist/Switch/style/index.js +1 -0
- package/dist/Switch/style.css +1 -0
- package/dist/Tabbar/index.js +159 -0
- package/dist/Tabbar/index.umd.cjs +6 -0
- package/dist/Tabbar/style/index.css +1 -0
- package/dist/Tabbar/style/index.js +1 -0
- package/dist/Tabbar/style.css +1 -0
- package/dist/Tabs/index.js +50 -0
- package/dist/Tabs/index.umd.cjs +1 -0
- package/dist/Tabs/style/index.css +1 -0
- package/dist/Tabs/style/index.js +1 -0
- package/dist/Tabs/style.css +1 -0
- package/dist/Tag/index.js +96 -0
- package/dist/Tag/index.umd.cjs +6 -0
- package/dist/Tag/style/index.css +1 -0
- package/dist/Tag/style/index.js +1 -0
- package/dist/Tag/style.css +1 -0
- package/dist/TimePicker/index.js +201 -0
- package/dist/TimePicker/index.umd.cjs +1 -0
- package/dist/TimePicker/style/index.css +1 -0
- package/dist/TimePicker/style/index.js +1 -0
- package/dist/TimePicker/style.css +1 -0
- package/dist/Tip/index.js +104 -0
- package/dist/Tip/index.umd.cjs +6 -0
- package/dist/Tip/style/index.css +1 -0
- package/dist/Tip/style/index.js +1 -0
- package/dist/Tip/style.css +1 -0
- package/dist/Toast/index.js +183 -0
- package/dist/Toast/index.umd.cjs +6 -0
- package/dist/Toast/style/index.css +1 -0
- package/dist/Toast/style/index.js +1 -0
- package/dist/Toast/style.css +1 -0
- package/dist/Tooltip/index.js +172 -0
- package/dist/Tooltip/index.umd.cjs +6 -0
- package/dist/Tooltip/style/index.css +1 -0
- package/dist/Tooltip/style/index.js +1 -0
- package/dist/Tooltip/style.css +1 -0
- package/dist/assets/fonts/qitu/iconfont.css +140 -0
- package/dist/assets/fonts/qitu/iconfont.ttf +0 -0
- package/dist/assets/fonts/qitu/iconfont.woff +0 -0
- package/dist/assets/fonts/qitu/iconfont.woff2 +0 -0
- package/dist/assets/fonts/qituyonghu/iconfont.css +64 -0
- package/dist/assets/fonts/qituyonghu/iconfont.ttf +0 -0
- package/dist/assets/fonts/qituyonghu/iconfont.woff +0 -0
- package/dist/assets/fonts/qituyonghu/iconfont.woff2 +0 -0
- package/dist/assets/fonts/wzdaili/iconfont.css +71 -0
- package/dist/assets/fonts/wzdaili/iconfont.ttf +0 -0
- package/dist/assets/fonts/wzdaili/iconfont.woff +0 -0
- package/dist/assets/fonts/wzdaili/iconfont.woff2 +0 -0
- package/dist/assets/fonts/wzyonghu/iconfont.css +97 -0
- package/dist/assets/fonts/wzyonghu/iconfont.ttf +0 -0
- package/dist/assets/fonts/wzyonghu/iconfont.woff +0 -0
- package/dist/assets/fonts/wzyonghu/iconfont.woff2 +0 -0
- package/dist/assets/fonts/yunying/iconfont.css +303 -0
- package/dist/assets/fonts/yunying/iconfont.ttf +0 -0
- package/dist/assets/fonts/yunying/iconfont.woff +0 -0
- package/dist/assets/fonts/yunying/iconfont.woff2 +0 -0
- package/dist/style.css +1 -0
- package/dist/types/components/Button/Button.d.ts +16 -0
- package/dist/types/components/Button/index.d.ts +5 -0
- package/dist/types/components/Card/Card.d.ts +15 -0
- package/dist/types/components/Card/index.d.ts +3 -0
- package/dist/types/components/Cascader/Cascader.d.ts +14 -0
- package/dist/types/components/Cascader/index.d.ts +3 -0
- package/dist/types/components/Cell/Cell.d.ts +24 -0
- package/dist/types/components/Cell/CellGroup.d.ts +8 -0
- package/dist/types/components/Cell/index.d.ts +8 -0
- package/dist/types/components/CheckList/CheckList.d.ts +11 -0
- package/dist/types/components/CheckList/index.d.ts +3 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +62 -0
- package/dist/types/components/Checkbox/index.d.ts +3 -0
- package/dist/types/components/Collapse/Collapse.d.ts +17 -0
- package/dist/types/components/Collapse/index.d.ts +3 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +13 -0
- package/dist/types/components/DatePicker/index.d.ts +3 -0
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +13 -0
- package/dist/types/components/DateRangePicker/index.d.ts +3 -0
- package/dist/types/components/Dialog/Dialog.d.ts +16 -0
- package/dist/types/components/Dialog/imperative.d.ts +8 -0
- package/dist/types/components/Dialog/index.d.ts +8 -0
- package/dist/types/components/Divider/Divider.d.ts +11 -0
- package/dist/types/components/Divider/index.d.ts +3 -0
- package/dist/types/components/DropDownMenu/DropdownMenu.d.ts +19 -0
- package/dist/types/components/DropDownMenu/index.d.ts +2 -0
- package/dist/types/components/Flex/Flex.d.ts +25 -0
- package/dist/types/components/Flex/index.d.ts +3 -0
- package/dist/types/components/Grid/Grid.d.ts +22 -0
- package/dist/types/components/Grid/index.d.ts +3 -0
- package/dist/types/components/GridView/GridView.d.ts +59 -0
- package/dist/types/components/GridView/index.d.ts +2 -0
- package/dist/types/components/Icon/Icon.d.ts +12 -0
- package/dist/types/components/Icon/icon-data.d.ts +42 -0
- package/dist/types/components/Icon/index.d.ts +3 -0
- package/dist/types/components/Input/Input.d.ts +17 -0
- package/dist/types/components/Input/index.d.ts +3 -0
- package/dist/types/components/NavBar/NavBar.d.ts +20 -0
- package/dist/types/components/NavBar/index.d.ts +3 -0
- package/dist/types/components/Popup/Popup.d.ts +23 -0
- package/dist/types/components/Popup/index.d.ts +3 -0
- package/dist/types/components/Radio/Radio.d.ts +62 -0
- package/dist/types/components/Radio/index.d.ts +3 -0
- package/dist/types/components/Search/Search.d.ts +26 -0
- package/dist/types/components/Search/index.d.ts +3 -0
- package/dist/types/components/Stepper/Stepper.d.ts +22 -0
- package/dist/types/components/Stepper/index.d.ts +3 -0
- package/dist/types/components/Switch/Switch.d.ts +16 -0
- package/dist/types/components/Switch/index.d.ts +3 -0
- package/dist/types/components/Tabbar/Tabbar.d.ts +39 -0
- package/dist/types/components/Tabbar/index.d.ts +3 -0
- package/dist/types/components/Tabs/Tabs.d.ts +25 -0
- package/dist/types/components/Tabs/index.d.ts +3 -0
- package/dist/types/components/Tag/Tag.d.ts +39 -0
- package/dist/types/components/Tag/index.d.ts +3 -0
- package/dist/types/components/TimePicker/TimePicker.d.ts +12 -0
- package/dist/types/components/TimePicker/index.d.ts +3 -0
- package/dist/types/components/Tip/Tip.d.ts +32 -0
- package/dist/types/components/Tip/index.d.ts +3 -0
- package/dist/types/components/Toast/Toast.d.ts +11 -0
- package/dist/types/components/Toast/index.d.ts +15 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +17 -0
- package/dist/types/components/Tooltip/index.d.ts +3 -0
- package/dist/types/components/index.d.ts +31 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/utils/color.d.ts +1 -0
- package/dist/wz-h5-design.es.js +2449 -0
- package/dist/wz-h5-design.umd.js +6 -0
- package/package.json +84 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
function getDefaultExportFromCjs(x) {
|
|
3
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
|
+
}
|
|
5
|
+
var classnames$1 = { exports: {} };
|
|
6
|
+
/*!
|
|
7
|
+
Copyright (c) 2018 Jed Watson.
|
|
8
|
+
Licensed under the MIT License (MIT), see
|
|
9
|
+
http://jedwatson.github.io/classnames
|
|
10
|
+
*/
|
|
11
|
+
(function(module) {
|
|
12
|
+
(function() {
|
|
13
|
+
var hasOwn = {}.hasOwnProperty;
|
|
14
|
+
function classNames() {
|
|
15
|
+
var classes = [];
|
|
16
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
17
|
+
var arg = arguments[i];
|
|
18
|
+
if (!arg) continue;
|
|
19
|
+
var argType = typeof arg;
|
|
20
|
+
if (argType === "string" || argType === "number") {
|
|
21
|
+
classes.push(arg);
|
|
22
|
+
} else if (Array.isArray(arg)) {
|
|
23
|
+
if (arg.length) {
|
|
24
|
+
var inner = classNames.apply(null, arg);
|
|
25
|
+
if (inner) {
|
|
26
|
+
classes.push(inner);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
} else if (argType === "object") {
|
|
30
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
31
|
+
classes.push(arg.toString());
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
for (var key in arg) {
|
|
35
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
36
|
+
classes.push(key);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return classes.join(" ");
|
|
42
|
+
}
|
|
43
|
+
if (module.exports) {
|
|
44
|
+
classNames.default = classNames;
|
|
45
|
+
module.exports = classNames;
|
|
46
|
+
} else {
|
|
47
|
+
window.classNames = classNames;
|
|
48
|
+
}
|
|
49
|
+
})();
|
|
50
|
+
})(classnames$1);
|
|
51
|
+
var classnamesExports = classnames$1.exports;
|
|
52
|
+
const classnames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
53
|
+
const Icon = ({
|
|
54
|
+
name,
|
|
55
|
+
size = 24,
|
|
56
|
+
color = "currentColor",
|
|
57
|
+
className = "",
|
|
58
|
+
style,
|
|
59
|
+
onClick,
|
|
60
|
+
type = "yunying"
|
|
61
|
+
// 默认使用yunying图标库
|
|
62
|
+
}) => {
|
|
63
|
+
const iconStyle = {
|
|
64
|
+
fontSize: typeof size === "number" ? `${size}px` : size,
|
|
65
|
+
color,
|
|
66
|
+
...style
|
|
67
|
+
};
|
|
68
|
+
const iconFontClass = `iconfont-${type}`;
|
|
69
|
+
const iconPrefix = "icon-";
|
|
70
|
+
const iconClass = `${iconPrefix}${name}`;
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
"i",
|
|
73
|
+
{
|
|
74
|
+
className: `wz-icon ${iconFontClass} ${iconClass} ${className}`,
|
|
75
|
+
style: iconStyle,
|
|
76
|
+
onClick
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
const Tip = ({
|
|
81
|
+
content,
|
|
82
|
+
className,
|
|
83
|
+
visible = true,
|
|
84
|
+
onClose,
|
|
85
|
+
action,
|
|
86
|
+
marquee = false
|
|
87
|
+
}) => {
|
|
88
|
+
if (!visible) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const baseClass = "wz-tip";
|
|
92
|
+
const tipClass = classnames(baseClass, className, {
|
|
93
|
+
[`${baseClass}--marquee`]: marquee
|
|
94
|
+
});
|
|
95
|
+
const contentNode = marquee ? /* @__PURE__ */ jsx("div", { className: `${baseClass}-marquee-box`, children: /* @__PURE__ */ jsx("span", { children: content }) }) : content;
|
|
96
|
+
return /* @__PURE__ */ jsxs("div", { className: tipClass, children: [
|
|
97
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}-content`, children: contentNode }),
|
|
98
|
+
action && /* @__PURE__ */ jsx("div", { className: `${baseClass}-action`, children: action }),
|
|
99
|
+
onClose && /* @__PURE__ */ jsx("div", { className: `${baseClass}-close`, onClick: onClose, children: /* @__PURE__ */ jsx(Icon, { name: "close", size: 16 }) })
|
|
100
|
+
] });
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
Tip as default
|
|
104
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["react/jsx-runtime"],n):(e="undefined"!=typeof globalThis?globalThis:e||self).Tip=n(e.jsxRuntime)}(this,(function(e){"use strict";function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,o={exports:{}};
|
|
2
|
+
/*!
|
|
3
|
+
Copyright (c) 2018 Jed Watson.
|
|
4
|
+
Licensed under the MIT License (MIT), see
|
|
5
|
+
http://jedwatson.github.io/classnames
|
|
6
|
+
*/t=o,function(){var e={}.hasOwnProperty;function n(){for(var t=[],o=0;o<arguments.length;o++){var i=arguments[o];if(i){var s=typeof i;if("string"===s||"number"===s)t.push(i);else if(Array.isArray(i)){if(i.length){var r=n.apply(null,i);r&&t.push(r)}}else if("object"===s){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){t.push(i.toString());continue}for(var l in i)e.call(i,l)&&i[l]&&t.push(l)}}}return t.join(" ")}t.exports?(n.default=n,t.exports=n):window.classNames=n}();const i=n(o.exports),s=({name:n,size:t=24,color:o="currentColor",className:i="",style:s,onClick:r,type:l="yunying"})=>{const c={fontSize:"number"==typeof t?`${t}px`:t,color:o,...s},a=`iconfont-${l}`,u=`icon-${n}`;return e.jsx("i",{className:`wz-icon ${a} ${u} ${i}`,style:c,onClick:r})};return({content:n,className:t,visible:o=!0,onClose:r,action:l,marquee:c=!1})=>{if(!o)return null;const a="wz-tip",u=i(a,t,{[`${a}--marquee`]:c}),f=c?e.jsx("div",{className:`${a}-marquee-box`,children:e.jsx("span",{children:n})}):n;return e.jsxs("div",{className:u,children:[e.jsx("div",{className:`${a}-content`,children:f}),l&&e.jsx("div",{className:`${a}-action`,children:l}),r&&e.jsx("div",{className:`${a}-close`,onClick:r,children:e.jsx(s,{name:"close",size:16})})]})}}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wz-tip{color:#ff4d4f;background-color:#ff4d4f1f;align-items:center;padding:6px 12px;font-size:13px;display:flex}.wz-tip-content{flex:1}.wz-tip-close{cursor:pointer;margin-left:8px}.wz-tip-action{margin-left:8px}.wz-tip--marquee .wz-tip-content{white-space:nowrap;overflow:hidden}.wz-tip--marquee .wz-tip-marquee-box{padding-left:100%;animation:10s linear infinite marquee;display:inline-block}.wz-tip--marquee .wz-tip-marquee-box span{padding-right:1.5em}@keyframes marquee{to{transform:translate(-100%)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wz-tip{color:#ff4d4f;background-color:#ff4d4f1f;align-items:center;padding:6px 12px;font-size:13px;display:flex}.wz-tip-content{flex:1}.wz-tip-close{cursor:pointer;margin-left:8px}.wz-tip-action{margin-left:8px}.wz-tip--marquee .wz-tip-content{white-space:nowrap;overflow:hidden}.wz-tip--marquee .wz-tip-marquee-box{padding-left:100%;animation:10s linear infinite marquee;display:inline-block}.wz-tip--marquee .wz-tip-marquee-box span{padding-right:1.5em}@keyframes marquee{to{transform:translate(-100%)}}.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:""}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
function getDefaultExportFromCjs(x) {
|
|
5
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
6
|
+
}
|
|
7
|
+
var classnames = { exports: {} };
|
|
8
|
+
/*!
|
|
9
|
+
Copyright (c) 2018 Jed Watson.
|
|
10
|
+
Licensed under the MIT License (MIT), see
|
|
11
|
+
http://jedwatson.github.io/classnames
|
|
12
|
+
*/
|
|
13
|
+
(function(module) {
|
|
14
|
+
(function() {
|
|
15
|
+
var hasOwn = {}.hasOwnProperty;
|
|
16
|
+
function classNames2() {
|
|
17
|
+
var classes = [];
|
|
18
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
19
|
+
var arg = arguments[i];
|
|
20
|
+
if (!arg) continue;
|
|
21
|
+
var argType = typeof arg;
|
|
22
|
+
if (argType === "string" || argType === "number") {
|
|
23
|
+
classes.push(arg);
|
|
24
|
+
} else if (Array.isArray(arg)) {
|
|
25
|
+
if (arg.length) {
|
|
26
|
+
var inner = classNames2.apply(null, arg);
|
|
27
|
+
if (inner) {
|
|
28
|
+
classes.push(inner);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} else if (argType === "object") {
|
|
32
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
33
|
+
classes.push(arg.toString());
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
for (var key in arg) {
|
|
37
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
38
|
+
classes.push(key);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return classes.join(" ");
|
|
44
|
+
}
|
|
45
|
+
if (module.exports) {
|
|
46
|
+
classNames2.default = classNames2;
|
|
47
|
+
module.exports = classNames2;
|
|
48
|
+
} else {
|
|
49
|
+
window.classNames = classNames2;
|
|
50
|
+
}
|
|
51
|
+
})();
|
|
52
|
+
})(classnames);
|
|
53
|
+
var classnamesExports = classnames.exports;
|
|
54
|
+
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
55
|
+
const Toast$1 = ({
|
|
56
|
+
content,
|
|
57
|
+
duration = 2e3,
|
|
58
|
+
icon,
|
|
59
|
+
visible = false,
|
|
60
|
+
onClose
|
|
61
|
+
}) => {
|
|
62
|
+
const [show2, setShow] = useState(visible);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
setShow(visible);
|
|
65
|
+
let timer;
|
|
66
|
+
if (visible && duration > 0) {
|
|
67
|
+
timer = setTimeout(() => {
|
|
68
|
+
setShow(false);
|
|
69
|
+
onClose == null ? void 0 : onClose();
|
|
70
|
+
}, duration);
|
|
71
|
+
}
|
|
72
|
+
return () => {
|
|
73
|
+
clearTimeout(timer);
|
|
74
|
+
};
|
|
75
|
+
}, [visible, duration, onClose]);
|
|
76
|
+
const toastClass = classNames("wz-toast", { "wz-toast-visible": show2 });
|
|
77
|
+
const iconClass = classNames("wz-toast-icon");
|
|
78
|
+
return /* @__PURE__ */ jsx("div", { className: toastClass, children: /* @__PURE__ */ jsxs("div", { className: "wz-toast-content", children: [
|
|
79
|
+
icon && /* @__PURE__ */ jsx("div", { className: iconClass, children: icon }),
|
|
80
|
+
/* @__PURE__ */ jsx("div", { className: "wz-toast-text", children: content })
|
|
81
|
+
] }) });
|
|
82
|
+
};
|
|
83
|
+
const Icon = ({
|
|
84
|
+
name,
|
|
85
|
+
size = 24,
|
|
86
|
+
color = "currentColor",
|
|
87
|
+
className = "",
|
|
88
|
+
style,
|
|
89
|
+
onClick,
|
|
90
|
+
type = "yunying"
|
|
91
|
+
// 默认使用yunying图标库
|
|
92
|
+
}) => {
|
|
93
|
+
const iconStyle = {
|
|
94
|
+
fontSize: typeof size === "number" ? `${size}px` : size,
|
|
95
|
+
color,
|
|
96
|
+
...style
|
|
97
|
+
};
|
|
98
|
+
const iconFontClass = `iconfont-${type}`;
|
|
99
|
+
const iconPrefix = "icon-";
|
|
100
|
+
const iconClass = `${iconPrefix}${name}`;
|
|
101
|
+
return /* @__PURE__ */ jsx(
|
|
102
|
+
"i",
|
|
103
|
+
{
|
|
104
|
+
className: `wz-icon ${iconFontClass} ${iconClass} ${className}`,
|
|
105
|
+
style: iconStyle,
|
|
106
|
+
onClick
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
let root = null;
|
|
111
|
+
let container = null;
|
|
112
|
+
const destroy = () => {
|
|
113
|
+
if (root) {
|
|
114
|
+
root.unmount();
|
|
115
|
+
root = null;
|
|
116
|
+
}
|
|
117
|
+
if (container && container.parentNode) {
|
|
118
|
+
container.parentNode.removeChild(container);
|
|
119
|
+
container = null;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const renderToast = (props) => {
|
|
123
|
+
if (!container) {
|
|
124
|
+
container = document.createElement("div");
|
|
125
|
+
document.body.appendChild(container);
|
|
126
|
+
root = createRoot(container);
|
|
127
|
+
}
|
|
128
|
+
root.render(/* @__PURE__ */ jsx(Toast$1, { ...props }));
|
|
129
|
+
};
|
|
130
|
+
const show = (props) => {
|
|
131
|
+
const toastProps = typeof props === "string" ? { content: props } : props;
|
|
132
|
+
renderToast({ ...toastProps, visible: true, onClose: destroy });
|
|
133
|
+
};
|
|
134
|
+
const success = (content, duration) => {
|
|
135
|
+
renderToast({
|
|
136
|
+
content,
|
|
137
|
+
duration,
|
|
138
|
+
icon: /* @__PURE__ */ jsx(Icon, { name: "check-round", size: 37.14 }),
|
|
139
|
+
visible: true,
|
|
140
|
+
onClose: destroy
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
const fail = (content, duration) => {
|
|
144
|
+
renderToast({
|
|
145
|
+
content,
|
|
146
|
+
duration,
|
|
147
|
+
icon: /* @__PURE__ */ jsx(Icon, { name: "close", size: 37.14 }),
|
|
148
|
+
visible: true,
|
|
149
|
+
onClose: destroy
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
const loading = (content, duration) => {
|
|
153
|
+
renderToast({
|
|
154
|
+
content,
|
|
155
|
+
duration,
|
|
156
|
+
icon: /* @__PURE__ */ jsx(Icon, { name: "loading", size: 37.14 }),
|
|
157
|
+
visible: true,
|
|
158
|
+
onClose: destroy
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
const warn = (content, duration) => {
|
|
162
|
+
renderToast({
|
|
163
|
+
content,
|
|
164
|
+
duration,
|
|
165
|
+
icon: /* @__PURE__ */ jsx(Icon, { name: "info", size: 37.14 }),
|
|
166
|
+
visible: true,
|
|
167
|
+
onClose: destroy
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
const hide = () => {
|
|
171
|
+
renderToast({ content: "", visible: false });
|
|
172
|
+
destroy();
|
|
173
|
+
};
|
|
174
|
+
const Toast = { show, success, fail, loading, warn, hide };
|
|
175
|
+
export {
|
|
176
|
+
Toast,
|
|
177
|
+
fail,
|
|
178
|
+
hide,
|
|
179
|
+
loading,
|
|
180
|
+
show,
|
|
181
|
+
success,
|
|
182
|
+
warn
|
|
183
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react-dom/client"),require("react")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react-dom/client","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Toast={},e.jsxRuntime,e.client,e.React)}(this,(function(e,t,n,o){"use strict";function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s,r={exports:{}};
|
|
2
|
+
/*!
|
|
3
|
+
Copyright (c) 2018 Jed Watson.
|
|
4
|
+
Licensed under the MIT License (MIT), see
|
|
5
|
+
http://jedwatson.github.io/classnames
|
|
6
|
+
*/s=r,function(){var e={}.hasOwnProperty;function t(){for(var n=[],o=0;o<arguments.length;o++){var i=arguments[o];if(i){var s=typeof i;if("string"===s||"number"===s)n.push(i);else if(Array.isArray(i)){if(i.length){var r=t.apply(null,i);r&&n.push(r)}}else if("object"===s){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){n.push(i.toString());continue}for(var l in i)e.call(i,l)&&i[l]&&n.push(l)}}}return n.join(" ")}s.exports?(t.default=t,s.exports=t):window.classNames=t}();const l=i(r.exports),c=({content:e,duration:n=2e3,icon:i,visible:s=!1,onClose:r})=>{const[c,a]=o.useState(s);o.useEffect((()=>{let e;return a(s),s&&n>0&&(e=setTimeout((()=>{a(!1),null==r||r()}),n)),()=>{clearTimeout(e)}}),[s,n,r]);const u=l("wz-toast",{"wz-toast-visible":c}),d=l("wz-toast-icon");return t.jsx("div",{className:u,children:t.jsxs("div",{className:"wz-toast-content",children:[i&&t.jsx("div",{className:d,children:i}),t.jsx("div",{className:"wz-toast-text",children:e})]})})},a=({name:e,size:n=24,color:o="currentColor",className:i="",style:s,onClick:r,type:l="yunying"})=>{const c={fontSize:"number"==typeof n?`${n}px`:n,color:o,...s},a=`iconfont-${l}`,u=`icon-${e}`;return t.jsx("i",{className:`wz-icon ${a} ${u} ${i}`,style:c,onClick:r})};let u=null,d=null;const f=()=>{u&&(u.unmount(),u=null),d&&d.parentNode&&(d.parentNode.removeChild(d),d=null)},p=e=>{d||(d=document.createElement("div"),document.body.appendChild(d),u=n.createRoot(d)),u.render(t.jsx(c,{...e}))},m=e=>{p({..."string"==typeof e?{content:e}:e,visible:!0,onClose:f})},v=(e,n)=>{p({content:e,duration:n,icon:t.jsx(a,{name:"check-round",size:37.14}),visible:!0,onClose:f})},h=(e,n)=>{p({content:e,duration:n,icon:t.jsx(a,{name:"close",size:37.14}),visible:!0,onClose:f})},x=(e,n)=>{p({content:e,duration:n,icon:t.jsx(a,{name:"loading",size:37.14}),visible:!0,onClose:f})},y=(e,n)=>{p({content:e,duration:n,icon:t.jsx(a,{name:"info",size:37.14}),visible:!0,onClose:f})},b=()=>{p({content:"",visible:!1}),f()},j={show:m,success:v,fail:h,loading:x,warn:y,hide:b};e.Toast=j,e.fail=h,e.hide=b,e.loading=x,e.show=m,e.success=v,e.warn=y,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wz-toast{color:#fff;z-index:9999;opacity:0;pointer-events:none;background-color:#000000b3;border-radius:7.43px;flex-direction:column;justify-content:center;align-items:center;width:130px;height:130px;padding:10px 20px;transition:opacity .3s;display:flex;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.wz-toast-visible{opacity:1;pointer-events:auto}.wz-toast-content{text-align:center}.wz-toast-icon{margin-bottom:8px}.wz-toast-icon-loading .wz-icon{animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wz-toast-text{font-size:14px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wz-toast{color:#fff;z-index:9999;opacity:0;pointer-events:none;background-color:#000000b3;border-radius:7.43px;flex-direction:column;justify-content:center;align-items:center;width:130px;height:130px;padding:10px 20px;transition:opacity .3s;display:flex;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}.wz-toast-visible{opacity:1;pointer-events:auto}.wz-toast-content{text-align:center}.wz-toast-icon{margin-bottom:8px}.wz-toast-icon-loading .wz-icon{animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wz-toast-text{font-size:14px}.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:""}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState, useRef, useLayoutEffect } from "react";
|
|
3
|
+
function getDefaultExportFromCjs(x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
5
|
+
}
|
|
6
|
+
var classnames = { 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 classNames2() {
|
|
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 = classNames2.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
|
+
classNames2.default = classNames2;
|
|
46
|
+
module.exports = classNames2;
|
|
47
|
+
} else {
|
|
48
|
+
window.classNames = classNames2;
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
})(classnames);
|
|
52
|
+
var classnamesExports = classnames.exports;
|
|
53
|
+
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
54
|
+
const Tooltip = ({
|
|
55
|
+
content,
|
|
56
|
+
children,
|
|
57
|
+
className,
|
|
58
|
+
style,
|
|
59
|
+
color,
|
|
60
|
+
textColor,
|
|
61
|
+
trigger = "click",
|
|
62
|
+
visible,
|
|
63
|
+
onVisibleChange,
|
|
64
|
+
showMask = false,
|
|
65
|
+
action,
|
|
66
|
+
closeIcon
|
|
67
|
+
}) => {
|
|
68
|
+
const [internalVisible, setInternalVisible] = useState(false);
|
|
69
|
+
const [computedStyle, setComputedStyle] = useState({});
|
|
70
|
+
const [currentPlacement, setCurrentPlacement] = useState("bottom");
|
|
71
|
+
const tooltipRef = useRef(null);
|
|
72
|
+
const triggerRef = useRef(null);
|
|
73
|
+
const isControlled = visible !== void 0;
|
|
74
|
+
const currentVisible = isControlled ? visible : internalVisible;
|
|
75
|
+
const handleVisibleChange = (newVisible) => {
|
|
76
|
+
if (!isControlled) {
|
|
77
|
+
setInternalVisible(newVisible);
|
|
78
|
+
}
|
|
79
|
+
onVisibleChange == null ? void 0 : onVisibleChange(newVisible);
|
|
80
|
+
};
|
|
81
|
+
useLayoutEffect(() => {
|
|
82
|
+
if (currentVisible && tooltipRef.current && triggerRef.current) {
|
|
83
|
+
const bubbleEl = tooltipRef.current;
|
|
84
|
+
const triggerEl = triggerRef.current;
|
|
85
|
+
const { width: bubbleWidth, height: bubbleHeight } = bubbleEl.getBoundingClientRect();
|
|
86
|
+
const { top: triggerTop, left: triggerLeft, width: triggerWidth, height: triggerHeight } = triggerEl.getBoundingClientRect();
|
|
87
|
+
const { innerWidth, innerHeight } = window;
|
|
88
|
+
const margin = 8;
|
|
89
|
+
let finalTop;
|
|
90
|
+
let finalLeft = triggerLeft + triggerWidth / 2 - bubbleWidth / 2;
|
|
91
|
+
let finalPlacement = "bottom";
|
|
92
|
+
if (finalLeft < margin) {
|
|
93
|
+
finalLeft = margin;
|
|
94
|
+
}
|
|
95
|
+
if (finalLeft + bubbleWidth > innerWidth - margin) {
|
|
96
|
+
finalLeft = innerWidth - bubbleWidth - margin;
|
|
97
|
+
}
|
|
98
|
+
finalTop = triggerTop + triggerHeight + margin;
|
|
99
|
+
if (finalTop + bubbleHeight > innerHeight - margin) {
|
|
100
|
+
finalPlacement = "top";
|
|
101
|
+
finalTop = triggerTop - bubbleHeight - margin;
|
|
102
|
+
}
|
|
103
|
+
if (finalTop < margin) {
|
|
104
|
+
finalPlacement = "bottom";
|
|
105
|
+
finalTop = triggerTop + triggerHeight + margin;
|
|
106
|
+
}
|
|
107
|
+
const arrowLeft = triggerLeft + triggerWidth / 2 - finalLeft;
|
|
108
|
+
setCurrentPlacement(finalPlacement);
|
|
109
|
+
setComputedStyle({
|
|
110
|
+
top: `${finalTop}px`,
|
|
111
|
+
left: `${finalLeft}px`,
|
|
112
|
+
"--wz-tooltip-arrow-left": `${arrowLeft}px`
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, [currentVisible]);
|
|
116
|
+
const handleWrapperClick = () => {
|
|
117
|
+
if (trigger === "click") {
|
|
118
|
+
handleVisibleChange(!currentVisible);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const handleClose = (e) => {
|
|
122
|
+
e.stopPropagation();
|
|
123
|
+
handleVisibleChange(false);
|
|
124
|
+
};
|
|
125
|
+
const classes = classNames("wz-tooltip-bubble", `wz-tooltip-bubble--placement-${currentPlacement}`, className);
|
|
126
|
+
const bubbleStyle = {
|
|
127
|
+
...style,
|
|
128
|
+
...computedStyle,
|
|
129
|
+
opacity: computedStyle.top ? 1 : 0,
|
|
130
|
+
transition: "opacity 150ms ease-in",
|
|
131
|
+
"--wz-tooltip-bubble-bg": color,
|
|
132
|
+
color: textColor
|
|
133
|
+
};
|
|
134
|
+
const renderBubble = () => {
|
|
135
|
+
if (!currentVisible) return null;
|
|
136
|
+
const renderAction = () => {
|
|
137
|
+
if (!action) return null;
|
|
138
|
+
const originalOnClick = action.props.onClick;
|
|
139
|
+
const newOnClick = (e) => {
|
|
140
|
+
originalOnClick == null ? void 0 : originalOnClick(e);
|
|
141
|
+
handleVisibleChange(false);
|
|
142
|
+
};
|
|
143
|
+
return /* @__PURE__ */ jsx("div", { className: "wz-tooltip-bubble__action-slot", children: React.cloneElement(action, { onClick: newOnClick }) });
|
|
144
|
+
};
|
|
145
|
+
const renderCloseIcon = () => {
|
|
146
|
+
if (!closeIcon) return null;
|
|
147
|
+
return /* @__PURE__ */ jsx("div", { className: "wz-tooltip-bubble__close-slot", children: React.cloneElement(closeIcon, { onClick: handleClose }) });
|
|
148
|
+
};
|
|
149
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
150
|
+
showMask && /* @__PURE__ */ jsx("div", { className: "wz-tooltip-mask", onClick: handleClose }),
|
|
151
|
+
/* @__PURE__ */ jsxs("div", { className: classes, style: bubbleStyle, ref: tooltipRef, children: [
|
|
152
|
+
/* @__PURE__ */ jsx("div", { className: "wz-tooltip-bubble__arrow" }),
|
|
153
|
+
/* @__PURE__ */ jsxs("div", { className: "wz-tooltip-bubble__inner", children: [
|
|
154
|
+
/* @__PURE__ */ jsx("div", { className: "wz-tooltip-bubble__body", children: content }),
|
|
155
|
+
renderAction(),
|
|
156
|
+
renderCloseIcon()
|
|
157
|
+
] })
|
|
158
|
+
] })
|
|
159
|
+
] });
|
|
160
|
+
};
|
|
161
|
+
const triggerProps = {
|
|
162
|
+
onClick: handleWrapperClick,
|
|
163
|
+
ref: triggerRef
|
|
164
|
+
};
|
|
165
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
166
|
+
React.cloneElement(children, triggerProps),
|
|
167
|
+
renderBubble()
|
|
168
|
+
] });
|
|
169
|
+
};
|
|
170
|
+
export {
|
|
171
|
+
Tooltip as default
|
|
172
|
+
};
|
|
@@ -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).Tooltip=t(e.jsxRuntime,e.React)}(this,(function(e,t){"use strict";function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,l={exports:{}};
|
|
2
|
+
/*!
|
|
3
|
+
Copyright (c) 2018 Jed Watson.
|
|
4
|
+
Licensed under the MIT License (MIT), see
|
|
5
|
+
http://jedwatson.github.io/classnames
|
|
6
|
+
*/n=l,function(){var e={}.hasOwnProperty;function t(){for(var o=[],n=0;n<arguments.length;n++){var l=arguments[n];if(l){var i=typeof l;if("string"===i||"number"===i)o.push(l);else if(Array.isArray(l)){if(l.length){var r=t.apply(null,l);r&&o.push(r)}}else if("object"===i){if(l.toString!==Object.prototype.toString&&!l.toString.toString().includes("[native code]")){o.push(l.toString());continue}for(var s in l)e.call(l,s)&&l[s]&&o.push(s)}}}return o.join(" ")}n.exports?(t.default=t,n.exports=t):window.classNames=t}();const i=o(l.exports);return({content:o,children:n,className:l,style:r,color:s,textColor:c,trigger:a="click",visible:u,onVisibleChange:p,showMask:d=!1,action:f,closeIcon:b})=>{const[h,m]=t.useState(!1),[g,x]=t.useState({}),[w,y]=t.useState("bottom"),j=t.useRef(null),v=t.useRef(null),_=void 0!==u,z=_?u:h,k=e=>{_||m(e),null==p||p(e)};t.useLayoutEffect((()=>{if(z&&j.current&&v.current){const e=j.current,t=v.current,{width:o,height:n}=e.getBoundingClientRect(),{top:l,left:i,width:r,height:s}=t.getBoundingClientRect(),{innerWidth:c,innerHeight:a}=window,u=8;let p,d=i+r/2-o/2,f="bottom";d<u&&(d=u),d+o>c-u&&(d=c-o-u),p=l+s+u,p+n>a-u&&(f="top",p=l-n-u),p<u&&(f="bottom",p=l+s+u);const b=i+r/2-d;y(f),x({top:`${p}px`,left:`${d}px`,"--wz-tooltip-arrow-left":`${b}px`})}}),[z]);const C=e=>{e.stopPropagation(),k(!1)},N=i("wz-tooltip-bubble",`wz-tooltip-bubble--placement-${w}`,l),S={...r,...g,opacity:g.top?1:0,transition:"opacity 150ms ease-in","--wz-tooltip-bubble-bg":s,color:c},R={onClick:()=>{"click"===a&&k(!z)},ref:v};return e.jsxs(e.Fragment,{children:[t.cloneElement(n,R),(()=>{if(!z)return null;return e.jsxs(e.Fragment,{children:[d&&e.jsx("div",{className:"wz-tooltip-mask",onClick:C}),e.jsxs("div",{className:N,style:S,ref:j,children:[e.jsx("div",{className:"wz-tooltip-bubble__arrow"}),e.jsxs("div",{className:"wz-tooltip-bubble__inner",children:[e.jsx("div",{className:"wz-tooltip-bubble__body",children:o}),(()=>{if(!f)return null;const o=f.props.onClick;return e.jsx("div",{className:"wz-tooltip-bubble__action-slot",children:t.cloneElement(f,{onClick:e=>{null==o||o(e),k(!1)}})})})(),b?e.jsx("div",{className:"wz-tooltip-bubble__close-slot",children:t.cloneElement(b,{onClick:C})}):null]})]})]})})()]})}}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wz-tooltip-mask{z-index:1000;background-color:#0006;position:fixed;top:0;bottom:0;left:0;right:0}.wz-tooltip-bubble{z-index:1001;background:var(--wz-tooltip-bubble-bg,#fff);border-radius:5px;flex-direction:column;justify-content:center;align-items:center;height:30px;font-size:14px;font-weight:400;display:flex;position:fixed;box-shadow:0 0 10px #0000001a}.wz-tooltip-bubble__inner{align-items:center;padding:12px 16px;display:flex}.wz-tooltip-bubble__action-slot,.wz-tooltip-bubble__close-slot{align-items:center;display:flex}.wz-tooltip-bubble__action-slot{order:2;margin-left:auto;padding-left:12px}.wz-tooltip-bubble__close-slot{order:3;padding-left:8px}.wz-tooltip-bubble--placement-top .wz-tooltip-bubble__arrow{border-top-color:var(--wz-tooltip-bubble-bg,#fff);top:100%}.wz-tooltip-bubble--placement-bottom .wz-tooltip-bubble__arrow{border-bottom-color:var(--wz-tooltip-bubble-bg,#fff);bottom:100%}.wz-tooltip-bubble__arrow{left:var(--wz-tooltip-arrow-left,50%);border:8px solid #0000;width:0;height:0;position:absolute;transform:translate(-50%)}.wz-tooltip-bubble__close-icon{color:inherit;opacity:.7;order:3;width:16px;height:16px;margin-left:12px;font-size:16px;position:relative;top:auto;right:auto}.wz-tooltip-bubble__close-icon:hover{opacity:1}.wz-tooltip-bubble__content{flex-direction:column;width:100%;padding:16px;display:flex}.wz-tooltip-bubble__title{color:var(--wz-tooltip-bubble-text-color,#333);margin-bottom:8px;font-size:16px;font-weight:500}.wz-tooltip-bubble__body{color:inherit;flex:1;order:1;font-size:14px;line-height:1.5}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wz-tooltip-mask{z-index:1000;background-color:#0006;position:fixed;top:0;bottom:0;left:0;right:0}.wz-tooltip-bubble{z-index:1001;background:var(--wz-tooltip-bubble-bg,#fff);border-radius:5px;flex-direction:column;justify-content:center;align-items:center;height:30px;font-size:14px;font-weight:400;display:flex;position:fixed;box-shadow:0 0 10px #0000001a}.wz-tooltip-bubble__inner{align-items:center;padding:12px 16px;display:flex}.wz-tooltip-bubble__action-slot,.wz-tooltip-bubble__close-slot{align-items:center;display:flex}.wz-tooltip-bubble__action-slot{order:2;margin-left:auto;padding-left:12px}.wz-tooltip-bubble__close-slot{order:3;padding-left:8px}.wz-tooltip-bubble--placement-top .wz-tooltip-bubble__arrow{border-top-color:var(--wz-tooltip-bubble-bg,#fff);top:100%}.wz-tooltip-bubble--placement-bottom .wz-tooltip-bubble__arrow{border-bottom-color:var(--wz-tooltip-bubble-bg,#fff);bottom:100%}.wz-tooltip-bubble__arrow{left:var(--wz-tooltip-arrow-left,50%);border:8px solid #0000;width:0;height:0;position:absolute;transform:translate(-50%)}.wz-tooltip-bubble__close-icon{color:inherit;opacity:.7;order:3;width:16px;height:16px;margin-left:12px;font-size:16px;position:relative;top:auto;right:auto}.wz-tooltip-bubble__close-icon:hover{opacity:1}.wz-tooltip-bubble__content{flex-direction:column;width:100%;padding:16px;display:flex}.wz-tooltip-bubble__title{color:var(--wz-tooltip-bubble-text-color,#333);margin-bottom:8px;font-size:16px;font-weight:500}.wz-tooltip-bubble__body{color:inherit;flex:1;order:1;font-size:14px;line-height:1.5}
|