@tiny-codes/react-easy 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/es/components/ConfirmAction/index.js +4 -4
- package/es/components/ConfirmAction/index.js.map +1 -1
- package/es/components/FloatDrawer/index.d.ts +173 -0
- package/es/components/FloatDrawer/index.js +173 -0
- package/es/components/FloatDrawer/index.js.map +1 -0
- package/es/components/FloatDrawer/style/index.d.ts +3 -0
- package/es/components/FloatDrawer/style/index.js +187 -0
- package/es/components/FloatDrawer/style/index.js.map +1 -0
- package/es/components/index.d.ts +2 -0
- package/es/components/index.js +1 -0
- package/es/components/index.js.map +1 -1
- package/lib/components/ConfirmAction/index.js +3 -3
- package/lib/components/ConfirmAction/index.js.map +2 -2
- package/lib/components/FloatDrawer/index.d.ts +173 -0
- package/lib/components/FloatDrawer/index.js +193 -0
- package/lib/components/FloatDrawer/index.js.map +7 -0
- package/lib/components/FloatDrawer/style/index.d.ts +3 -0
- package/lib/components/FloatDrawer/style/index.js +234 -0
- package/lib/components/FloatDrawer/style/index.js.map +7 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +3 -0
- package/lib/components/index.js.map +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/FloatDrawer/index.tsx
|
|
30
|
+
var FloatDrawer_exports = {};
|
|
31
|
+
__export(FloatDrawer_exports, {
|
|
32
|
+
default: () => FloatDrawer_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(FloatDrawer_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_icons = require("@ant-design/icons");
|
|
39
|
+
var import_useRefFunction = __toESM(require("../../hooks/useRefFunction"));
|
|
40
|
+
var import_style = __toESM(require("./style"));
|
|
41
|
+
var FloatDrawer = (props) => {
|
|
42
|
+
const {
|
|
43
|
+
open,
|
|
44
|
+
position = "right",
|
|
45
|
+
cardProps,
|
|
46
|
+
children,
|
|
47
|
+
className,
|
|
48
|
+
classNames: classNamesInProps,
|
|
49
|
+
style,
|
|
50
|
+
styles,
|
|
51
|
+
cacheKey,
|
|
52
|
+
defaultSize = 300,
|
|
53
|
+
minSize = 0,
|
|
54
|
+
maxSize = Infinity,
|
|
55
|
+
onOpenChange
|
|
56
|
+
} = props;
|
|
57
|
+
const { getPrefixCls } = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
|
|
58
|
+
const prefixCls = getPrefixCls("re-float-drawer");
|
|
59
|
+
const [wrapCSSVar, hashId, cssVarCls] = (0, import_style.default)(prefixCls);
|
|
60
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)();
|
|
61
|
+
const [size, setSize] = (0, import_react.useState)(
|
|
62
|
+
cacheKey && localStorage.getItem(cacheKey) ? Number(localStorage.getItem(cacheKey)) || defaultSize : defaultSize
|
|
63
|
+
);
|
|
64
|
+
const sizeMap = (0, import_react.useMemo)(() => {
|
|
65
|
+
const type = position === "left" || position === "right" ? "width" : "height";
|
|
66
|
+
return {
|
|
67
|
+
[type]: size
|
|
68
|
+
};
|
|
69
|
+
}, [position, size]);
|
|
70
|
+
const [isDragging, setIsDragging] = (0, import_react.useState)(false);
|
|
71
|
+
const dragStartPos = (0, import_react.useRef)(0);
|
|
72
|
+
const dragStartSize = (0, import_react.useRef)(size);
|
|
73
|
+
const classString = (0, import_classnames.default)(
|
|
74
|
+
prefixCls,
|
|
75
|
+
className,
|
|
76
|
+
{
|
|
77
|
+
[`${prefixCls}-open`]: isOpen,
|
|
78
|
+
[`${prefixCls}-closed`]: !isOpen,
|
|
79
|
+
[`${prefixCls}-${position}`]: position
|
|
80
|
+
},
|
|
81
|
+
hashId,
|
|
82
|
+
cssVarCls
|
|
83
|
+
);
|
|
84
|
+
const closeIcon = (0, import_react.useMemo)(() => {
|
|
85
|
+
return position === "left" ? /* @__PURE__ */ React.createElement(import_icons.RightOutlined, null) : position === "top" ? /* @__PURE__ */ React.createElement(import_icons.DownOutlined, null) : position === "bottom" ? /* @__PURE__ */ React.createElement(import_icons.UpOutlined, null) : /* @__PURE__ */ React.createElement(import_icons.LeftOutlined, null);
|
|
86
|
+
}, [position]);
|
|
87
|
+
const openIcon = (0, import_react.useMemo)(() => {
|
|
88
|
+
return position === "left" ? /* @__PURE__ */ React.createElement(import_icons.LeftOutlined, null) : position === "top" ? /* @__PURE__ */ React.createElement(import_icons.UpOutlined, null) : position === "bottom" ? /* @__PURE__ */ React.createElement(import_icons.DownOutlined, null) : /* @__PURE__ */ React.createElement(import_icons.RightOutlined, null);
|
|
89
|
+
}, [position]);
|
|
90
|
+
const toggleDrawer = () => {
|
|
91
|
+
setIsOpen(!isOpen);
|
|
92
|
+
onOpenChange == null ? void 0 : onOpenChange(!isOpen);
|
|
93
|
+
};
|
|
94
|
+
const handleResizeStart = (0, import_useRefFunction.default)((e) => {
|
|
95
|
+
setIsDragging(true);
|
|
96
|
+
if (position === "top" || position === "bottom") {
|
|
97
|
+
dragStartPos.current = e.clientY;
|
|
98
|
+
} else {
|
|
99
|
+
dragStartPos.current = e.clientX;
|
|
100
|
+
}
|
|
101
|
+
dragStartSize.current = size;
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
});
|
|
104
|
+
const handleResize = (0, import_useRefFunction.default)((e) => {
|
|
105
|
+
if (isDragging) {
|
|
106
|
+
let newSize;
|
|
107
|
+
if (position === "left") {
|
|
108
|
+
newSize = dragStartSize.current - (dragStartPos.current - e.clientX);
|
|
109
|
+
} else if (position === "top") {
|
|
110
|
+
newSize = dragStartSize.current - (dragStartPos.current - e.clientY);
|
|
111
|
+
} else if (position === "bottom") {
|
|
112
|
+
newSize = dragStartSize.current - (e.clientY - dragStartPos.current);
|
|
113
|
+
} else {
|
|
114
|
+
newSize = dragStartSize.current - (e.clientX - dragStartPos.current);
|
|
115
|
+
}
|
|
116
|
+
if (newSize >= minSize && newSize <= maxSize) {
|
|
117
|
+
setSize(newSize);
|
|
118
|
+
if (cacheKey) {
|
|
119
|
+
localStorage.setItem(cacheKey, String(newSize));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const handleResizeEnd = (0, import_useRefFunction.default)(() => {
|
|
125
|
+
setIsDragging(false);
|
|
126
|
+
});
|
|
127
|
+
(0, import_react.useEffect)(() => {
|
|
128
|
+
setIsOpen(open);
|
|
129
|
+
}, [open]);
|
|
130
|
+
(0, import_react.useEffect)(() => {
|
|
131
|
+
if (isDragging) {
|
|
132
|
+
window.addEventListener("mousemove", handleResize);
|
|
133
|
+
window.addEventListener("mouseup", handleResizeEnd);
|
|
134
|
+
} else {
|
|
135
|
+
window.removeEventListener("mousemove", handleResize);
|
|
136
|
+
window.removeEventListener("mouseup", handleResizeEnd);
|
|
137
|
+
}
|
|
138
|
+
return () => {
|
|
139
|
+
window.removeEventListener("mousemove", handleResize);
|
|
140
|
+
window.removeEventListener("mouseup", handleResizeEnd);
|
|
141
|
+
};
|
|
142
|
+
}, [isDragging]);
|
|
143
|
+
return wrapCSSVar(
|
|
144
|
+
/* @__PURE__ */ React.createElement("div", { className: classString, style }, /* @__PURE__ */ React.createElement(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
className: (0, import_classnames.default)(`${prefixCls}-drawer`, classNamesInProps == null ? void 0 : classNamesInProps.drawer),
|
|
148
|
+
style: { ...sizeMap, ...styles == null ? void 0 : styles.drawer }
|
|
149
|
+
},
|
|
150
|
+
/* @__PURE__ */ React.createElement(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
className: (0, import_classnames.default)(
|
|
154
|
+
`${prefixCls}-resize-handle`,
|
|
155
|
+
isDragging && `${prefixCls}-resize-handle-dragging`,
|
|
156
|
+
classNamesInProps == null ? void 0 : classNamesInProps.resizeHandle
|
|
157
|
+
),
|
|
158
|
+
style: styles == null ? void 0 : styles.resizeHandle,
|
|
159
|
+
onMouseDown: handleResizeStart
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ React.createElement("div", { className: (0, import_classnames.default)(`${prefixCls}-content`, classNamesInProps == null ? void 0 : classNamesInProps.content), style: styles == null ? void 0 : styles.content }, /* @__PURE__ */ React.createElement(
|
|
163
|
+
import_antd.Card,
|
|
164
|
+
{
|
|
165
|
+
bordered: false,
|
|
166
|
+
variant: "borderless",
|
|
167
|
+
className: (0, import_classnames.default)(`${prefixCls}-card`, classNamesInProps == null ? void 0 : classNamesInProps.card),
|
|
168
|
+
style: styles == null ? void 0 : styles.card,
|
|
169
|
+
...cardProps
|
|
170
|
+
},
|
|
171
|
+
children
|
|
172
|
+
)),
|
|
173
|
+
/* @__PURE__ */ React.createElement(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
className: (0, import_classnames.default)(`${prefixCls}-expand-handle`, classNamesInProps == null ? void 0 : classNamesInProps.expandHandle),
|
|
177
|
+
style: styles == null ? void 0 : styles.expandHandle,
|
|
178
|
+
onClick: toggleDrawer
|
|
179
|
+
},
|
|
180
|
+
/* @__PURE__ */ React.createElement(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
className: (0, import_classnames.default)(`${prefixCls}-handle-icon`, classNamesInProps == null ? void 0 : classNamesInProps.handleIcon),
|
|
184
|
+
style: styles == null ? void 0 : styles.handleIcon
|
|
185
|
+
},
|
|
186
|
+
isOpen ? openIcon : closeIcon
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
))
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
var FloatDrawer_default = FloatDrawer;
|
|
193
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/FloatDrawer/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { CSSProperties, FC, ReactNode } from 'react';\nimport { useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { Card, type CardProps, ConfigProvider } from 'antd';\nimport classNames from 'classnames';\nimport { DownOutlined, LeftOutlined, RightOutlined, UpOutlined } from '@ant-design/icons';\nimport useRefFunction from '../../hooks/useRefFunction';\nimport useStyle from './style';\n\nexport interface FloatDrawerProps {\n /**\n * **EN:** Whether the drawer is open\n *\n * **CN:** 抽屉是否打开\n */\n open?: boolean;\n /**\n * **EN:** Position of the drawer\n *\n * **CN:** 抽屉的位置\n *\n * @default 'right'\n */\n position?: 'left' | 'right' | 'top' | 'bottom';\n /**\n * **EN:** Default size of the drawer. If the drawer is placed on the left or right, this is the\n * width, otherwise it is the height.\n *\n * **CN:** 抽屉的默认宽度。如果抽屉放在左侧或右侧,则为宽度,否则为高度。\n *\n * @default 300\n */\n defaultSize?: number;\n /**\n * **EN:** Minimum size of the drawer\n *\n * **CN:** 抽屉的最小宽度\n *\n * @default 0\n */\n minSize?: number;\n /**\n * **EN:** Maximum size of the drawer\n *\n * **CN:** 抽屉的最大宽度\n *\n * @default Infinity\n */\n maxSize?: number;\n /**\n * **EN:** Cache key for storing the drawer size in localStorage. If not set, the size will not be\n * cached.\n *\n * **CN:** 指定一个localStorage缓存键,用于记忆抽屉宽度。如果不设置,则不使用缓存。\n */\n cacheKey?: string;\n /**\n * **EN:** Custom class name for the root element\n *\n * **CN:** 根元素的自定义类名\n */\n className?: string;\n /**\n * **EN:** Custom class names for specific elements\n *\n * **CN:** 特定元素的自定义类名\n */\n classNames?: {\n /**\n * **EN:** Class name for the drawer element\n *\n * **CN:** 抽屉元素的类名\n */\n drawer?: string;\n /**\n * **EN:** Class name for the expand handle\n *\n * **CN:** 展开手柄的类名\n */\n expandHandle?: string;\n /**\n * **EN:** Class name for the resize handle\n *\n * **CN:** 调整大小手柄的类名\n */\n resizeHandle?: string;\n /**\n * **EN:** Class name for the handle icon\n *\n * **CN:** 手柄图标的类名\n */\n handleIcon?: string;\n /**\n * **EN:** Class name for the content area\n *\n * **CN:** 内容区域的类名\n */\n content?: string;\n /**\n * **EN:** Class name for the card element\n *\n * **CN:** 卡片元素的类名\n */\n card?: string;\n };\n /**\n * **EN:** Custom styles for the root element\n *\n * **CN:** 根元素的自定义样式\n */\n style?: CSSProperties;\n /**\n * **EN:** Custom styles for specific elements\n *\n * **CN:** 特定元素的自定义样式\n */\n styles?: {\n /**\n * **EN:** Styles for the drawer element\n *\n * **CN:** 抽屉元素的样式\n */\n drawer?: CSSProperties;\n /**\n * **EN:** Styles for the expand handle\n *\n * **CN:** 展开手柄的样式\n */\n expandHandle?: CSSProperties;\n /**\n * **EN:** Styles for the resize handle\n *\n * **CN:** 调整大小手柄的样式\n */\n resizeHandle?: CSSProperties;\n /**\n * **EN:** Styles for the handle icon\n *\n * **CN:** 手柄图标的样式\n */\n handleIcon?: CSSProperties;\n /**\n * **EN:** Styles for the content area\n *\n * **CN:** 内容区域的样式\n */\n content?: CSSProperties;\n /**\n * **EN:** Styles for the card element\n *\n * **CN:** 卡片元素的样式\n */\n card?: CSSProperties;\n };\n /**\n * **EN:** Custom properties for the card element\n *\n * **CN:** 卡片元素的自定义属性\n */\n cardProps?: Omit<CardProps, 'children'>;\n /**\n * **EN:** Content to be rendered inside the drawer\n *\n * **CN:** 抽屉内容\n */\n children?: ReactNode;\n /**\n * **EN:** Callback function when the open state changes\n *\n * **CN:** 打开状态变化时的回调函数\n */\n onOpenChange?: (open: boolean) => void;\n}\n\n/**\n * **EN:** FloatDrawer component for creating a draggable, resizable drawer\n *\n * **CN:** FloatDrawer组件,用于创建可拖动、可调整大小的抽屉\n */\nconst FloatDrawer: FC<FloatDrawerProps> = (props) => {\n const {\n open,\n position = 'right',\n cardProps,\n children,\n className,\n classNames: classNamesInProps,\n style,\n styles,\n cacheKey,\n defaultSize = 300,\n minSize = 0,\n maxSize = +Infinity,\n onOpenChange,\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('re-float-drawer');\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [isOpen, setIsOpen] = useState<boolean>();\n const [size, setSize] = useState(\n cacheKey && localStorage.getItem(cacheKey) ? Number(localStorage.getItem(cacheKey)) || defaultSize : defaultSize\n );\n const sizeMap = useMemo(() => {\n const type = position === 'left' || position === 'right' ? 'width' : 'height';\n return {\n [type]: size,\n };\n }, [position, size]);\n const [isDragging, setIsDragging] = useState(false);\n const dragStartPos = useRef<number>(0);\n const dragStartSize = useRef<number>(size);\n const classString = classNames(\n prefixCls,\n className,\n {\n [`${prefixCls}-open`]: isOpen,\n [`${prefixCls}-closed`]: !isOpen,\n [`${prefixCls}-${position}`]: position,\n },\n hashId,\n cssVarCls\n );\n const closeIcon = useMemo(() => {\n return position === 'left' ? (\n <RightOutlined />\n ) : position === 'top' ? (\n <DownOutlined />\n ) : position === 'bottom' ? (\n <UpOutlined />\n ) : (\n <LeftOutlined />\n );\n }, [position]);\n const openIcon = useMemo(() => {\n return position === 'left' ? (\n <LeftOutlined />\n ) : position === 'top' ? (\n <UpOutlined />\n ) : position === 'bottom' ? (\n <DownOutlined />\n ) : (\n <RightOutlined />\n );\n }, [position]);\n\n // Handle drawer visibility\n const toggleDrawer = () => {\n setIsOpen(!isOpen);\n onOpenChange?.(!isOpen);\n };\n\n // Handle resize events\n const handleResizeStart = useRefFunction((e: React.MouseEvent) => {\n setIsDragging(true);\n if (position === 'top' || position === 'bottom') {\n dragStartPos.current = e.clientY;\n } else {\n dragStartPos.current = e.clientX;\n }\n dragStartSize.current = size;\n e.preventDefault();\n });\n const handleResize = useRefFunction((e: MouseEvent) => {\n if (isDragging) {\n let newSize: number;\n if (position === 'left') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientX);\n } else if (position === 'top') {\n newSize = dragStartSize.current - (dragStartPos.current - e.clientY);\n } else if (position === 'bottom') {\n newSize = dragStartSize.current - (e.clientY - dragStartPos.current);\n } else {\n newSize = dragStartSize.current - (e.clientX - dragStartPos.current);\n }\n if (newSize >= minSize && newSize <= maxSize) {\n setSize(newSize);\n if (cacheKey) {\n localStorage.setItem(cacheKey, String(newSize));\n }\n }\n }\n });\n const handleResizeEnd = useRefFunction(() => {\n setIsDragging(false);\n });\n\n // Controlled open state\n useEffect(() => {\n setIsOpen(open);\n }, [open]);\n\n // Handle global events\n useEffect(() => {\n if (isDragging) {\n window.addEventListener('mousemove', handleResize);\n window.addEventListener('mouseup', handleResizeEnd);\n } else {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n }\n return () => {\n window.removeEventListener('mousemove', handleResize);\n window.removeEventListener('mouseup', handleResizeEnd);\n };\n }, [isDragging]);\n\n return wrapCSSVar(\n <div className={classString} style={style}>\n <div\n className={classNames(`${prefixCls}-drawer`, classNamesInProps?.drawer)}\n style={{ ...sizeMap, ...styles?.drawer }}\n >\n <div\n className={classNames(\n `${prefixCls}-resize-handle`,\n isDragging && `${prefixCls}-resize-handle-dragging`,\n classNamesInProps?.resizeHandle\n )}\n style={styles?.resizeHandle}\n onMouseDown={handleResizeStart}\n />\n <div className={classNames(`${prefixCls}-content`, classNamesInProps?.content)} style={styles?.content}>\n <Card\n bordered={false}\n variant=\"borderless\"\n className={classNames(`${prefixCls}-card`, classNamesInProps?.card)}\n style={styles?.card}\n {...cardProps}\n >\n {children}\n </Card>\n </div>\n <div\n className={classNames(`${prefixCls}-expand-handle`, classNamesInProps?.expandHandle)}\n style={styles?.expandHandle}\n onClick={toggleDrawer}\n >\n <div\n className={classNames(`${prefixCls}-handle-icon`, classNamesInProps?.handleIcon)}\n style={styles?.handleIcon}\n >\n {isOpen ? openIcon : closeIcon}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default FloatDrawer;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAiE;AACjE,kBAAqD;AACrD,wBAAuB;AACvB,mBAAsE;AACtE,4BAA2B;AAC3B,mBAAqB;AA4KrB,IAAM,cAAoC,CAAC,UAAU;AACnD,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAA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RefFunction"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: (prefixCls: string, rootCls?: string | undefined) => readonly [(node: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>, string, string];
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/FloatDrawer/style/index.ts
|
|
20
|
+
var style_exports = {};
|
|
21
|
+
__export(style_exports, {
|
|
22
|
+
default: () => style_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(style_exports);
|
|
25
|
+
var import_internal = require("antd/es/theme/internal");
|
|
26
|
+
var genStyle = (token) => {
|
|
27
|
+
const { componentCls } = token;
|
|
28
|
+
return {
|
|
29
|
+
[componentCls]: {
|
|
30
|
+
position: "absolute",
|
|
31
|
+
display: "flex",
|
|
32
|
+
overflow: "visible",
|
|
33
|
+
zIndex: token.zIndexPopupBase,
|
|
34
|
+
["&-left"]: {
|
|
35
|
+
left: 0,
|
|
36
|
+
top: 0,
|
|
37
|
+
bottom: 0
|
|
38
|
+
},
|
|
39
|
+
["&-right"]: {
|
|
40
|
+
right: 0,
|
|
41
|
+
top: 0,
|
|
42
|
+
bottom: 0
|
|
43
|
+
},
|
|
44
|
+
["&-top"]: {
|
|
45
|
+
left: 0,
|
|
46
|
+
right: 0,
|
|
47
|
+
top: 0
|
|
48
|
+
},
|
|
49
|
+
["&-bottom"]: {
|
|
50
|
+
left: 0,
|
|
51
|
+
right: 0,
|
|
52
|
+
bottom: 0
|
|
53
|
+
},
|
|
54
|
+
[`&${componentCls}-open`]: {
|
|
55
|
+
// visibility: 'visible',
|
|
56
|
+
},
|
|
57
|
+
[`&${componentCls}-closed`]: {
|
|
58
|
+
pointerEvents: "none"
|
|
59
|
+
},
|
|
60
|
+
[`${componentCls}-drawer`]: {
|
|
61
|
+
transition: "transform 0.3s ease-in-out",
|
|
62
|
+
overflow: "visible"
|
|
63
|
+
},
|
|
64
|
+
[`&${componentCls}-left ${componentCls}-drawer,
|
|
65
|
+
&${componentCls}-right ${componentCls}-drawer`]: {
|
|
66
|
+
height: "100%"
|
|
67
|
+
},
|
|
68
|
+
[`&${componentCls}-top ${componentCls}-drawer,
|
|
69
|
+
&${componentCls}-bottom ${componentCls}-drawer`]: {
|
|
70
|
+
width: "100%"
|
|
71
|
+
},
|
|
72
|
+
[`&${componentCls}-open${componentCls}-left ${componentCls}-drawer,
|
|
73
|
+
&${componentCls}-open${componentCls}-right ${componentCls}-drawer,
|
|
74
|
+
&${componentCls}-open${componentCls}-top ${componentCls}-drawer,
|
|
75
|
+
&${componentCls}-open${componentCls}-bottom ${componentCls}-drawer`]: {
|
|
76
|
+
transform: "translate(0, 0)"
|
|
77
|
+
},
|
|
78
|
+
[`&${componentCls}-open${componentCls}-left ${componentCls}-drawer`]: {
|
|
79
|
+
boxShadow: `2px 0 10px ${token.colorFill}`
|
|
80
|
+
},
|
|
81
|
+
[`&${componentCls}-open${componentCls}-right ${componentCls}-drawer`]: {
|
|
82
|
+
boxShadow: `-2px 0 10px ${token.colorFill}`
|
|
83
|
+
},
|
|
84
|
+
[`&${componentCls}-open${componentCls}-top ${componentCls}-drawer`]: {
|
|
85
|
+
boxShadow: `0 2px 10px ${token.colorFill}`
|
|
86
|
+
},
|
|
87
|
+
[`&${componentCls}-open${componentCls}-bottom ${componentCls}-drawer`]: {
|
|
88
|
+
boxShadow: `0 -2px 10px ${token.colorFill}`
|
|
89
|
+
},
|
|
90
|
+
[`&${componentCls}-closed${componentCls}-left ${componentCls}-drawer`]: {
|
|
91
|
+
transform: "translateX(-100%)"
|
|
92
|
+
},
|
|
93
|
+
[`&${componentCls}-closed${componentCls}-right ${componentCls}-drawer`]: {
|
|
94
|
+
transform: "translateX(100%)"
|
|
95
|
+
},
|
|
96
|
+
[`&${componentCls}-closed${componentCls}-top ${componentCls}-drawer`]: {
|
|
97
|
+
transform: "translateY(-100%)"
|
|
98
|
+
},
|
|
99
|
+
[`&${componentCls}-closed${componentCls}-bottom ${componentCls}-drawer`]: {
|
|
100
|
+
transform: "translateY(100%)"
|
|
101
|
+
},
|
|
102
|
+
[`${componentCls}-expand-handle`]: {
|
|
103
|
+
position: "absolute",
|
|
104
|
+
zIndex: 2,
|
|
105
|
+
cursor: "pointer",
|
|
106
|
+
color: token.colorTextTertiary,
|
|
107
|
+
backgroundColor: isLightColor(token.colorBgBase) ? "#fafafa" : "#141414",
|
|
108
|
+
display: "flex",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
justifyContent: "center",
|
|
111
|
+
pointerEvents: "all",
|
|
112
|
+
"&:hover": {
|
|
113
|
+
color: token.colorText,
|
|
114
|
+
backgroundColor: isLightColor(token.colorBgBase) ? "#f0f0f0" : "#1a1a1a"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
[`&${componentCls}-left ${componentCls}-expand-handle,
|
|
118
|
+
&${componentCls}-right ${componentCls}-expand-handle`]: {
|
|
119
|
+
top: "50%",
|
|
120
|
+
width: 24,
|
|
121
|
+
height: 60
|
|
122
|
+
},
|
|
123
|
+
[`&${componentCls}-top ${componentCls}-expand-handle,
|
|
124
|
+
&${componentCls}-bottom ${componentCls}-expand-handle`]: {
|
|
125
|
+
left: "50%",
|
|
126
|
+
width: 60,
|
|
127
|
+
height: 24
|
|
128
|
+
},
|
|
129
|
+
[`&${componentCls}-left ${componentCls}-expand-handle`]: {
|
|
130
|
+
right: 0,
|
|
131
|
+
transform: "translate(100%, -50%)",
|
|
132
|
+
borderRadius: "0 8px 8px 0",
|
|
133
|
+
boxShadow: `2px 0 5px ${token.colorFill}`
|
|
134
|
+
},
|
|
135
|
+
[`&${componentCls}-right ${componentCls}-expand-handle`]: {
|
|
136
|
+
left: 0,
|
|
137
|
+
transform: "translate(-100%, -50%)",
|
|
138
|
+
borderRadius: "8px 0 0 8px",
|
|
139
|
+
boxShadow: `-2px 0 5px ${token.colorFill}`
|
|
140
|
+
},
|
|
141
|
+
[`&${componentCls}-top ${componentCls}-expand-handle`]: {
|
|
142
|
+
bottom: 0,
|
|
143
|
+
transform: "translate(-50%, 100%)",
|
|
144
|
+
borderRadius: "0 0 8px 8px",
|
|
145
|
+
boxShadow: `0 2px 5px ${token.colorFill}`
|
|
146
|
+
},
|
|
147
|
+
[`&${componentCls}-bottom ${componentCls}-expand-handle`]: {
|
|
148
|
+
top: 0,
|
|
149
|
+
transform: "translate(-50%, -100%)",
|
|
150
|
+
borderRadius: "8px 8px 0 0",
|
|
151
|
+
boxShadow: `0 -2px 5px ${token.colorFill}`
|
|
152
|
+
},
|
|
153
|
+
[`${componentCls}-handle-icon`]: {
|
|
154
|
+
userSelect: "none",
|
|
155
|
+
lineHeight: 0
|
|
156
|
+
},
|
|
157
|
+
[`${componentCls}-resize-handle`]: {
|
|
158
|
+
position: "absolute",
|
|
159
|
+
border: `1px solid transparent`,
|
|
160
|
+
zIndex: 1,
|
|
161
|
+
backgroundColor: token.colorBgTextHover,
|
|
162
|
+
"&:hover": {
|
|
163
|
+
backgroundColor: token.colorBgTextActive
|
|
164
|
+
},
|
|
165
|
+
"&&-dragging": {
|
|
166
|
+
backgroundColor: token.colorBgTextActive
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
[`&${componentCls}-left ${componentCls}-resize-handle`]: {
|
|
170
|
+
right: 0,
|
|
171
|
+
width: 1,
|
|
172
|
+
height: "100%",
|
|
173
|
+
cursor: "col-resize"
|
|
174
|
+
},
|
|
175
|
+
[`&${componentCls}-right ${componentCls}-resize-handle`]: {
|
|
176
|
+
left: 0,
|
|
177
|
+
width: 1,
|
|
178
|
+
height: "100%",
|
|
179
|
+
cursor: "col-resize"
|
|
180
|
+
},
|
|
181
|
+
[`&${componentCls}-top ${componentCls}-resize-handle`]: {
|
|
182
|
+
bottom: 0,
|
|
183
|
+
height: 1,
|
|
184
|
+
width: "100%",
|
|
185
|
+
cursor: "row-resize"
|
|
186
|
+
},
|
|
187
|
+
[`&${componentCls}-bottom ${componentCls}-resize-handle`]: {
|
|
188
|
+
top: 0,
|
|
189
|
+
height: 1,
|
|
190
|
+
width: "100%",
|
|
191
|
+
cursor: "row-resize"
|
|
192
|
+
},
|
|
193
|
+
[`${componentCls}-content`]: {
|
|
194
|
+
height: "100%",
|
|
195
|
+
[`${componentCls}-card`]: {
|
|
196
|
+
display: "flex",
|
|
197
|
+
flexDirection: "column",
|
|
198
|
+
height: "100%",
|
|
199
|
+
[`${token.antCls}-card-body`]: {
|
|
200
|
+
flex: 1,
|
|
201
|
+
minHeight: 0,
|
|
202
|
+
overflow: "auto"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
function isLightColor(color) {
|
|
210
|
+
var _a;
|
|
211
|
+
let r = 0, g = 0, b = 0;
|
|
212
|
+
if (color.startsWith("#")) {
|
|
213
|
+
let hex = color.substring(1);
|
|
214
|
+
if (hex.length === 3) {
|
|
215
|
+
hex = hex.split("").map((c) => c + c).join("");
|
|
216
|
+
}
|
|
217
|
+
r = parseInt(hex.substring(0, 2), 16);
|
|
218
|
+
g = parseInt(hex.substring(2, 4), 16);
|
|
219
|
+
b = parseInt(hex.substring(4, 6), 16);
|
|
220
|
+
} else if (color.startsWith("rgb")) {
|
|
221
|
+
const values = ((_a = color.match(/\d+/g)) == null ? void 0 : _a.map(Number)) || [];
|
|
222
|
+
[r, g, b] = values;
|
|
223
|
+
}
|
|
224
|
+
r = r / 255;
|
|
225
|
+
g = g / 255;
|
|
226
|
+
b = b / 255;
|
|
227
|
+
r = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
|
|
228
|
+
g = g <= 0.03928 ? g / 12.92 : Math.pow((g + 0.055) / 1.055, 2.4);
|
|
229
|
+
b = b <= 0.03928 ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4);
|
|
230
|
+
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
231
|
+
return luminance > 0.5;
|
|
232
|
+
}
|
|
233
|
+
var style_default = (0, import_internal.genStyleHooks)("re-float-drawer", genStyle);
|
|
234
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/FloatDrawer/style/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { genStyleHooks } from 'antd/es/theme/internal';\nimport type { AliasToken, GenerateStyle } from 'antd/es/theme/internal';\nimport type { CSSObject } from '@ant-design/cssinjs';\nimport type { FullToken } from '@ant-design/cssinjs-utils';\n\ntype REFloatDrawerToken = FullToken<{ ''?: object }, AliasToken, ''>;\n\nconst genStyle: GenerateStyle<REFloatDrawerToken> = (token): CSSObject => {\n const { componentCls } = token;\n return {\n [componentCls]: {\n position: 'absolute',\n display: 'flex',\n overflow: 'visible',\n zIndex: token.zIndexPopupBase,\n ['&-left']: {\n left: 0,\n top: 0,\n bottom: 0,\n },\n ['&-right']: {\n right: 0,\n top: 0,\n bottom: 0,\n },\n ['&-top']: {\n left: 0,\n right: 0,\n top: 0,\n },\n ['&-bottom']: {\n left: 0,\n right: 0,\n bottom: 0,\n },\n\n [`&${componentCls}-open`]: {\n // visibility: 'visible',\n },\n [`&${componentCls}-closed`]: {\n pointerEvents: 'none',\n },\n [`${componentCls}-drawer`]: {\n transition: 'transform 0.3s ease-in-out',\n overflow: 'visible',\n },\n [`&${componentCls}-left ${componentCls}-drawer,\n &${componentCls}-right ${componentCls}-drawer`]: {\n height: '100%',\n },\n [`&${componentCls}-top ${componentCls}-drawer,\n &${componentCls}-bottom ${componentCls}-drawer`]: {\n width: '100%',\n },\n [`&${componentCls}-open${componentCls}-left ${componentCls}-drawer,\n &${componentCls}-open${componentCls}-right ${componentCls}-drawer,\n &${componentCls}-open${componentCls}-top ${componentCls}-drawer,\n &${componentCls}-open${componentCls}-bottom ${componentCls}-drawer`]: {\n transform: 'translate(0, 0)',\n },\n [`&${componentCls}-open${componentCls}-left ${componentCls}-drawer`]: {\n boxShadow: `2px 0 10px ${token.colorFill}`,\n },\n [`&${componentCls}-open${componentCls}-right ${componentCls}-drawer`]: {\n boxShadow: `-2px 0 10px ${token.colorFill}`,\n },\n [`&${componentCls}-open${componentCls}-top ${componentCls}-drawer`]: {\n boxShadow: `0 2px 10px ${token.colorFill}`,\n },\n [`&${componentCls}-open${componentCls}-bottom ${componentCls}-drawer`]: {\n boxShadow: `0 -2px 10px ${token.colorFill}`,\n },\n [`&${componentCls}-closed${componentCls}-left ${componentCls}-drawer`]: {\n transform: 'translateX(-100%)',\n },\n [`&${componentCls}-closed${componentCls}-right ${componentCls}-drawer`]: {\n transform: 'translateX(100%)',\n },\n [`&${componentCls}-closed${componentCls}-top ${componentCls}-drawer`]: {\n transform: 'translateY(-100%)',\n },\n [`&${componentCls}-closed${componentCls}-bottom ${componentCls}-drawer`]: {\n transform: 'translateY(100%)',\n },\n [`${componentCls}-expand-handle`]: {\n position: 'absolute',\n zIndex: 2,\n cursor: 'pointer',\n color: token.colorTextTertiary,\n backgroundColor: isLightColor(token.colorBgBase) ? '#fafafa' : '#141414',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n pointerEvents: 'all',\n '&:hover': {\n color: token.colorText,\n backgroundColor: isLightColor(token.colorBgBase) ? '#f0f0f0' : '#1a1a1a',\n },\n },\n [`&${componentCls}-left ${componentCls}-expand-handle,\n &${componentCls}-right ${componentCls}-expand-handle`]: {\n top: '50%',\n width: 24,\n height: 60,\n },\n [`&${componentCls}-top ${componentCls}-expand-handle,\n &${componentCls}-bottom ${componentCls}-expand-handle`]: {\n left: '50%',\n width: 60,\n height: 24,\n },\n [`&${componentCls}-left ${componentCls}-expand-handle`]: {\n right: 0,\n transform: 'translate(100%, -50%)',\n borderRadius: '0 8px 8px 0',\n boxShadow: `2px 0 5px ${token.colorFill}`,\n },\n [`&${componentCls}-right ${componentCls}-expand-handle`]: {\n left: 0,\n transform: 'translate(-100%, -50%)',\n borderRadius: '8px 0 0 8px',\n boxShadow: `-2px 0 5px ${token.colorFill}`,\n },\n [`&${componentCls}-top ${componentCls}-expand-handle`]: {\n bottom: 0,\n transform: 'translate(-50%, 100%)',\n borderRadius: '0 0 8px 8px',\n boxShadow: `0 2px 5px ${token.colorFill}`,\n },\n [`&${componentCls}-bottom ${componentCls}-expand-handle`]: {\n top: 0,\n transform: 'translate(-50%, -100%)',\n borderRadius: '8px 8px 0 0',\n boxShadow: `0 -2px 5px ${token.colorFill}`,\n },\n [`${componentCls}-handle-icon`]: {\n userSelect: 'none',\n lineHeight: 0,\n },\n [`${componentCls}-resize-handle`]: {\n position: 'absolute',\n border: `1px solid transparent`,\n zIndex: 1,\n backgroundColor: token.colorBgTextHover,\n '&:hover': {\n backgroundColor: token.colorBgTextActive,\n },\n '&&-dragging': {\n backgroundColor: token.colorBgTextActive,\n },\n },\n [`&${componentCls}-left ${componentCls}-resize-handle`]: {\n right: 0,\n width: 1,\n height: '100%',\n cursor: 'col-resize',\n },\n [`&${componentCls}-right ${componentCls}-resize-handle`]: {\n left: 0,\n width: 1,\n height: '100%',\n cursor: 'col-resize',\n },\n [`&${componentCls}-top ${componentCls}-resize-handle`]: {\n bottom: 0,\n height: 1,\n width: '100%',\n cursor: 'row-resize',\n },\n [`&${componentCls}-bottom ${componentCls}-resize-handle`]: {\n top: 0,\n height: 1,\n width: '100%',\n cursor: 'row-resize',\n },\n [`${componentCls}-content`]: {\n height: '100%',\n [`${componentCls}-card`]: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n\n [`${token.antCls}-card-body`]: {\n flex: 1,\n minHeight: 0,\n overflow: 'auto',\n },\n },\n },\n },\n };\n};\n\nfunction isLightColor(color: string): boolean {\n let r = 0,\n g = 0,\n b = 0;\n\n if (color.startsWith('#')) {\n let hex = color.substring(1);\n if (hex.length === 3) {\n hex = hex\n .split('')\n .map((c) => c + c)\n .join('');\n }\n r = parseInt(hex.substring(0, 2), 16);\n g = parseInt(hex.substring(2, 4), 16);\n b = parseInt(hex.substring(4, 6), 16);\n } else if (color.startsWith('rgb')) {\n const values = color.match(/\\d+/g)?.map(Number) || [];\n [r, g, b] = values;\n }\n r = r / 255;\n g = g / 255;\n b = b / 255;\n\n r = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);\n g = g <= 0.03928 ? g / 12.92 : Math.pow((g + 0.055) / 1.055, 2.4);\n b = b <= 0.03928 ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4);\n\n const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n return luminance > 0.5;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default genStyleHooks('re-float-drawer' as any, genStyle);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA8B;AAO9B,IA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AI,KAAK,UAAU,IAAI,QAAQ,KAAK,KAAK,IAAI,SAAS,OAAO,GAAG;AAEhE,QAAM,YAAY,SAAS,IAAI,SAAS,IAAI,SAAS;AAErD,SAAO,YAAY;AACrB;AAGA,IAAO,oBAAQ,+BAAc,mBAA0B,QAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -8,6 +8,8 @@ export type { ConfirmActionProps, ConfirmActionTrigger, ConfirmActionRef } from
|
|
|
8
8
|
export { withDefaultConfirmActionProps } from './ConfirmAction';
|
|
9
9
|
export { default as ConfirmAction } from './ConfirmAction';
|
|
10
10
|
export { default as DeleteConfirmAction } from './DeleteConfirmAction';
|
|
11
|
+
export type { FloatDrawerProps } from './FloatDrawer';
|
|
12
|
+
export { default as FloatDrawer } from './FloatDrawer';
|
|
11
13
|
export type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';
|
|
12
14
|
export { withDefaultModalActionProps, withModalAction } from './ModalAction';
|
|
13
15
|
export { default as ModalAction } from './ModalAction';
|
package/lib/components/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(components_exports, {
|
|
|
33
33
|
ConfigProvider: () => import_ConfigProvider.default,
|
|
34
34
|
ConfirmAction: () => import_ConfirmAction2.default,
|
|
35
35
|
DeleteConfirmAction: () => import_DeleteConfirmAction.default,
|
|
36
|
+
FloatDrawer: () => import_FloatDrawer.default,
|
|
36
37
|
ModalAction: () => import_ModalAction2.default,
|
|
37
38
|
ReactEasyContext: () => import_context.default,
|
|
38
39
|
withDefaultConfirmActionProps: () => import_ConfirmAction.withDefaultConfirmActionProps,
|
|
@@ -46,6 +47,7 @@ var import_context = __toESM(require("./ConfigProvider/context"));
|
|
|
46
47
|
var import_ConfirmAction = require("./ConfirmAction");
|
|
47
48
|
var import_ConfirmAction2 = __toESM(require("./ConfirmAction"));
|
|
48
49
|
var import_DeleteConfirmAction = __toESM(require("./DeleteConfirmAction"));
|
|
50
|
+
var import_FloatDrawer = __toESM(require("./FloatDrawer"));
|
|
49
51
|
var import_ModalAction = require("./ModalAction");
|
|
50
52
|
var import_ModalAction2 = __toESM(require("./ModalAction"));
|
|
51
53
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -54,6 +56,7 @@ var import_ModalAction2 = __toESM(require("./ModalAction"));
|
|
|
54
56
|
ConfigProvider,
|
|
55
57
|
ConfirmAction,
|
|
56
58
|
DeleteConfirmAction,
|
|
59
|
+
FloatDrawer,
|
|
57
60
|
ModalAction,
|
|
58
61
|
ReactEasyContext,
|
|
59
62
|
withDefaultConfirmActionProps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/index.tsx"],
|
|
4
|
-
"sourcesContent": ["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ConfigProviderProps } from './ConfigProvider';\nexport { default as ConfigProvider } from './ConfigProvider';\nexport type { ReactEasyContextProps } from './ConfigProvider/context';\nexport { default as ReactEasyContext } from './ConfigProvider/context';\n\nexport type { ConfirmActionProps, ConfirmActionTrigger, ConfirmActionRef } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\n\nexport type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';\nexport { withDefaultModalActionProps, withModalAction } from './ModalAction';\nexport { default as ModalAction } from './ModalAction';\n\n// export * from '../utils';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsC;AAGtC,4BAA0C;AAE1C,qBAA4C;AAG5C,2BAA8C;AAC9C,IAAAA,wBAAyC;AAGzC,iCAA+C;AAG/C,yBAA6D;AAC7D,IAAAC,sBAAuC;",
|
|
4
|
+
"sourcesContent": ["export type { BreakLinesProps } from './BreakLines';\nexport { default as BreakLines } from './BreakLines';\n\nexport type { ConfigProviderProps } from './ConfigProvider';\nexport { default as ConfigProvider } from './ConfigProvider';\nexport type { ReactEasyContextProps } from './ConfigProvider/context';\nexport { default as ReactEasyContext } from './ConfigProvider/context';\n\nexport type { ConfirmActionProps, ConfirmActionTrigger, ConfirmActionRef } from './ConfirmAction';\nexport { withDefaultConfirmActionProps } from './ConfirmAction';\nexport { default as ConfirmAction } from './ConfirmAction';\n\n// export * from './DeleteConfirmAction';\nexport { default as DeleteConfirmAction } from './DeleteConfirmAction';\n\nexport type { FloatDrawerProps } from './FloatDrawer';\nexport { default as FloatDrawer } from './FloatDrawer';\n\nexport type { ModalActionProps, FormCompPropsConstraint, ModalActionTrigger, ModalActionRef } from './ModalAction';\nexport { withDefaultModalActionProps, withModalAction } from './ModalAction';\nexport { default as ModalAction } from './ModalAction';\n\n// export * from '../utils';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsC;AAGtC,4BAA0C;AAE1C,qBAA4C;AAG5C,2BAA8C;AAC9C,IAAAA,wBAAyC;AAGzC,iCAA+C;AAG/C,yBAAuC;AAGvC,yBAA6D;AAC7D,IAAAC,sBAAuC;",
|
|
6
6
|
"names": ["import_ConfirmAction", "import_ModalAction"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiny-codes/react-easy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Helps you use React and AntDesign more easily",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@tiny-codes/code-style-all-in-one": "^1.1.5",
|
|
42
|
+
"@tiny-codes/eslint-plugin-react-hooks": "^4.6.0",
|
|
42
43
|
"@types/jest": "^29.5.14",
|
|
43
44
|
"@types/node": "^22.13.14",
|
|
44
45
|
"@types/react": "^19.0.12",
|