ehscan-react-components 0.1.14 → 0.1.16
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 +25 -0
- package/dist/Window.d.ts +1 -0
- package/dist/Window.js +1 -81
- package/dist/style/window.css +22 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,31 @@
|
|
|
66
66
|
| `--btn-bg-trash` | trashBtn | `lightgray` |
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
|
|
70
|
+
# Window
|
|
71
|
+
|
|
72
|
+
## styling
|
|
73
|
+
|
|
74
|
+
| Variable | Default | Description |
|
|
75
|
+
| ------------------------------------ | ----------------------------- | ---------------------------------- |
|
|
76
|
+
| `--ext-window-bck-color` | `white` | Window background color |
|
|
77
|
+
| `--ext-window-width` | `400px` | Window default width |
|
|
78
|
+
| `--ext-window-min-height` | `300px` | Window minimum height |
|
|
79
|
+
| `--ext-window-border-radius` | `12px` | Window border radius |
|
|
80
|
+
| `--ext-window-shadow` | `rgba(50,50,93,0.25) ...` | Box shadow for window |
|
|
81
|
+
| `--ext-window-opacity` | `0` | Initial opacity (used for fade-in) |
|
|
82
|
+
| `--ext-window-transition` | `opacity 0.4s ease-in-out` | Fade transition |
|
|
83
|
+
| `--ext-window-header-bck-color` | `var(--ext-window-bck-color)` | Header background color |
|
|
84
|
+
| `--ext-window-close-bck` | `aqua` | Close button background |
|
|
85
|
+
| `--ext-window-body-bck` | `transparent` | Body background color |
|
|
86
|
+
| `--ext-window-footer-bck` | `transparent` | Footer background color |
|
|
87
|
+
| `--ext-window-footer-min-height` | `50px` | Footer min height |
|
|
88
|
+
| `--ext-window-scrollbar-thumb` | `white` | Scrollbar thumb color |
|
|
89
|
+
| `--ext-window-scrollbar-thumb-hover` | `#555` | Scrollbar thumb color on hover |
|
|
90
|
+
| `--ext-window-resize-bck` | `darkgreen` | Resize handle background |
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
69
94
|
----
|
|
70
95
|
# Changelog
|
|
71
96
|
|
package/dist/Window.d.ts
CHANGED
package/dist/Window.js
CHANGED
|
@@ -1,87 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// import React, { useRef, useEffect, useState } from "react";
|
|
3
|
-
// import { useDraggable } from "./tools/useDraggable"; // adjust path as needed
|
|
4
|
-
// export interface WindowProps {
|
|
5
|
-
// trackMove?: (args?: any) => void;
|
|
6
|
-
// open: boolean;
|
|
7
|
-
// initialPosition?: { x: number; y: number };
|
|
8
|
-
// initialWidth?: number;
|
|
9
|
-
// initialBodyPadding?: number;
|
|
10
|
-
// header?: React.ReactNode;
|
|
11
|
-
// body?: React.ReactNode;
|
|
12
|
-
// footer?: React.ReactNode;
|
|
13
|
-
// onClose?: () => void;
|
|
14
|
-
// }
|
|
15
|
-
// export default function Window({
|
|
16
|
-
// trackMove,
|
|
17
|
-
// open,
|
|
18
|
-
// initialPosition = { x: 600, y: 100 },
|
|
19
|
-
// initialWidth = 400,
|
|
20
|
-
// initialBodyPadding = 20,
|
|
21
|
-
// header,
|
|
22
|
-
// body,
|
|
23
|
-
// footer,
|
|
24
|
-
// onClose,
|
|
25
|
-
// }: WindowProps) {
|
|
26
|
-
// const targetRef = useRef<HTMLDivElement>(null);
|
|
27
|
-
// const headerRef = useRef<HTMLDivElement>(null);
|
|
28
|
-
// const resizeHandleRef = useRef<HTMLDivElement>(null);
|
|
29
|
-
// const bodyRef = useRef<HTMLDivElement>(null);
|
|
30
|
-
// const footerRef = useRef<HTMLDivElement>(null);
|
|
31
|
-
// const [maxHeight] = useState("auto");
|
|
32
|
-
// const [bodyPadding] = useState(initialBodyPadding);
|
|
33
|
-
// const [windowWidth] = useState(initialWidth);
|
|
34
|
-
// useDraggable(open, targetRef, headerRef, bodyRef, resizeHandleRef, bodyPadding, trackMove);
|
|
35
|
-
// useEffect(() => { //init
|
|
36
|
-
// if (!bodyRef.current || !targetRef.current || !headerRef.current) return;
|
|
37
|
-
// const headerHeight = headerRef.current.offsetHeight;
|
|
38
|
-
// const topPosition = targetRef.current.getBoundingClientRect().top;
|
|
39
|
-
// const availableHeight = window.innerHeight - topPosition - 20; // 20px bottom margin
|
|
40
|
-
// const bodyMaxHeight = Math.max(100, availableHeight - headerHeight - 2 * bodyPadding);
|
|
41
|
-
// bodyRef.current.style.maxHeight = `${bodyMaxHeight}px`;
|
|
42
|
-
// bodyRef.current.style.overflowY = "auto";
|
|
43
|
-
// }, [bodyPadding]);
|
|
44
|
-
// const [fadeIn, setFadeIn] = useState(false)
|
|
45
|
-
// useEffect(() => {
|
|
46
|
-
// if (open === undefined) return;
|
|
47
|
-
// setTimeout(() => {
|
|
48
|
-
// setFadeIn(open)
|
|
49
|
-
// }, 0)
|
|
50
|
-
// }, [open])
|
|
51
|
-
// if (!open) return null;
|
|
52
|
-
// return (
|
|
53
|
-
// <div ref={targetRef} className={`ext-window${fadeIn ? ' fadein' : ''}`} style={{ left: `${initialPosition.x}px`, top: `${initialPosition.y}px`, minWidth: `${windowWidth}px` }}>
|
|
54
|
-
// {/* Header */}
|
|
55
|
-
// <div ref={headerRef} className="ext-window-header">
|
|
56
|
-
// {header ?? (
|
|
57
|
-
// <>
|
|
58
|
-
// <div className="ext-window-drag-handle">||</div>
|
|
59
|
-
// <div className="ext-window-header-title">Header</div>
|
|
60
|
-
// <div onClick={onClose}>close</div>
|
|
61
|
-
// </>
|
|
62
|
-
// )}
|
|
63
|
-
// </div>
|
|
64
|
-
// {/* Body */}
|
|
65
|
-
// <div
|
|
66
|
-
// ref={bodyRef}
|
|
67
|
-
// className="ext-window-body _ewb"
|
|
68
|
-
// style={{ padding: `${bodyPadding}px` }}
|
|
69
|
-
// >
|
|
70
|
-
// {body ?? <>Body</>}
|
|
71
|
-
// </div>
|
|
72
|
-
// {/* Footer */}
|
|
73
|
-
// {footer && (
|
|
74
|
-
// <div ref={footerRef} className="ext-window-footer">
|
|
75
|
-
// {footer}
|
|
76
|
-
// </div>
|
|
77
|
-
// )}
|
|
78
|
-
// {/* Resize handle */}
|
|
79
|
-
// <div className="resize-handle" ref={resizeHandleRef} />
|
|
80
|
-
// </div>
|
|
81
|
-
// );
|
|
82
|
-
// }
|
|
83
2
|
import { useRef, useEffect, useState } from "react";
|
|
84
3
|
import { useDraggable } from "./tools/useDraggable"; // adjust path as needed
|
|
4
|
+
import './style/window.css';
|
|
85
5
|
export const Window = ({ trackMove, open, initialPosition = { x: 600, y: 100 }, initialWidth = 400, initialBodyPadding = 20, header, body, footer, onClose, }) => {
|
|
86
6
|
const targetRef = useRef(null);
|
|
87
7
|
const headerRef = useRef(null);
|
package/dist/style/window.css
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/* 🪟 ExtWindow Base */
|
|
2
2
|
.ext-window {
|
|
3
3
|
/* --ext-window-bck-color: white;
|
|
4
|
+
--ext-window-width: 400px;
|
|
5
|
+
--ext-window-min-height: 300px;
|
|
4
6
|
--ext-window-border-radius: 12px;
|
|
5
7
|
--ext-window-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
|
|
6
8
|
--ext-window-opacity: 0;
|
|
7
|
-
--ext-window-transition: opacity 0.4s ease-in-out;
|
|
8
|
-
--ext-window-width: 400px;
|
|
9
|
-
--ext-window-min-height: 300px; */
|
|
9
|
+
--ext-window-transition: opacity 0.4s ease-in-out; */
|
|
10
10
|
|
|
11
11
|
background-color: var(--ext-window-bck-color, white);
|
|
12
12
|
position: absolute;
|
|
13
13
|
width: var(--ext-window-width, 400px);
|
|
14
14
|
min-height: var(--ext-window-min-height, 300px);
|
|
15
15
|
border-radius: var(--ext-window-border-radius, 12px);
|
|
16
|
-
box-shadow: var(--ext-window-shadow);
|
|
16
|
+
box-shadow: var(--ext-window-shadow, rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px);
|
|
17
17
|
opacity: var(--ext-window-opacity, 0);
|
|
18
|
-
transition: var(--ext-window-transition);
|
|
18
|
+
transition: var(--ext-window-transition, opacity 0.4s ease-in-out);
|
|
19
|
+
user-select: none;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
.ext-window.fadein {
|
|
@@ -28,19 +29,20 @@
|
|
|
28
29
|
padding: 0 10px;
|
|
29
30
|
border-radius: var(--ext-window-border-radius, 12px) var(--ext-window-border-radius, 12px) 0 0;
|
|
30
31
|
background-color: var(--ext-window-header-bck-color);
|
|
32
|
+
display: flex;
|
|
31
33
|
align-items: center;
|
|
32
34
|
justify-content: center;
|
|
35
|
+
gap: 10px;
|
|
33
36
|
height: 50px;
|
|
34
|
-
display: flex;
|
|
35
37
|
user-select: none;
|
|
36
|
-
|
|
38
|
+
cursor: pointer;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
.ext-window-header-title {
|
|
40
42
|
flex: 1;
|
|
41
|
-
line-height: 1.4;
|
|
42
43
|
display: flex;
|
|
43
44
|
align-items: center;
|
|
45
|
+
line-height: 1.4;
|
|
44
46
|
padding: 5px 0 2px 0;
|
|
45
47
|
cursor: move;
|
|
46
48
|
}
|
|
@@ -61,9 +63,20 @@
|
|
|
61
63
|
background-color: var(--ext-window-body-bck, transparent);
|
|
62
64
|
min-height: var(--ext-window-min-height, 300px);
|
|
63
65
|
overflow: auto;
|
|
64
|
-
user-select: none;
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
/* Footer */
|
|
69
|
+
.ext-window-footer {
|
|
70
|
+
background-color: var(--ext-window-footer-bck, transparent);
|
|
71
|
+
min-height: var(--ext-window-footer-min-height, 50px);
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: flex-end;
|
|
75
|
+
gap: 10px;
|
|
76
|
+
padding: 0 10px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Scrollbars for WebKit */
|
|
67
80
|
._ewb::-webkit-scrollbar {
|
|
68
81
|
width: 0;
|
|
69
82
|
background-color: var(--ext-window-bck-color, white);
|