ehscan-react-components 0.1.46 → 0.1.47

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.
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef, useEffect, useState } from "react";
3
3
  import { useDraggable } from "../tools/useDraggable"; // adjust path as needed
4
- import styles from './style/window.module.css';
4
+ import styles from '../style/window.module.css';
5
5
  export const Window = ({ trackMove, open, initialPosition = { x: 600, y: 100 }, initialWidth = 400, initialBodyPadding = 20, header, body, footer, onClose, }) => {
6
6
  const targetRef = useRef(null);
7
7
  const headerRef = useRef(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ehscan-react-components",
3
- "version": "0.1.46",
3
+ "version": "0.1.47",
4
4
  "description": "components",
5
5
  "main": "dist/Components.js",
6
6
  "types": "dist/Components.d.ts",
package/dist/Window.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import React from "react";
2
- import './style/window.css';
3
- export interface Props {
4
- trackMove?: (args?: any) => void;
5
- open: boolean;
6
- initialPosition?: {
7
- x: number;
8
- y: number;
9
- };
10
- initialWidth?: number;
11
- initialBodyPadding?: number;
12
- header?: React.ReactNode;
13
- body?: React.ReactNode;
14
- footer?: React.ReactNode;
15
- onClose?: () => void;
16
- }
17
- export declare const Window: React.FC<Props>;
package/dist/Window.js DELETED
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRef, useEffect, useState } from "react";
3
- import { useDraggable } from "./tools/useDraggable"; // adjust path as needed
4
- import './style/window.css';
5
- export const Window = ({ trackMove, open, initialPosition = { x: 600, y: 100 }, initialWidth = 400, initialBodyPadding = 20, header, body, footer, onClose, }) => {
6
- const targetRef = useRef(null);
7
- const headerRef = useRef(null);
8
- const resizeHandleRef = useRef(null);
9
- const bodyRef = useRef(null);
10
- const footerRef = useRef(null);
11
- const [bodyPadding] = useState(initialBodyPadding);
12
- const [windowWidth] = useState(initialWidth);
13
- useDraggable(open, targetRef, headerRef, bodyRef, resizeHandleRef, bodyPadding, trackMove);
14
- useEffect(() => {
15
- if (!bodyRef.current || !targetRef.current || !headerRef.current)
16
- return;
17
- const headerHeight = headerRef.current.offsetHeight;
18
- const topPosition = targetRef.current.getBoundingClientRect().top;
19
- const availableHeight = window.innerHeight - topPosition - 20; // 20px bottom margin
20
- const bodyMaxHeight = Math.max(100, availableHeight - headerHeight - 2 * bodyPadding);
21
- bodyRef.current.style.maxHeight = `${bodyMaxHeight}px`;
22
- bodyRef.current.style.overflowY = "auto";
23
- }, [bodyPadding]);
24
- const [fadeIn, setFadeIn] = useState(false);
25
- useEffect(() => {
26
- if (open === undefined)
27
- return;
28
- setTimeout(() => {
29
- setFadeIn(open);
30
- }, 0);
31
- }, [open]);
32
- if (!open)
33
- return null;
34
- return (_jsxs("div", { ref: targetRef, className: `ext-window${fadeIn ? ' fadein' : ''}`, style: { left: `${initialPosition.x}px`, top: `${initialPosition.y}px`, minWidth: `${windowWidth}px` }, children: [_jsx("div", { ref: headerRef, className: "ext-window-header", children: header !== null && header !== void 0 ? header : (_jsxs(_Fragment, { children: [_jsx("div", { className: "ext-window-drag-handle", children: "||" }), _jsx("div", { className: "ext-window-header-title", children: "Header" }), _jsx("div", { onClick: onClose, children: "close" })] })) }), _jsx("div", { ref: bodyRef, className: "ext-window-body _ewb", style: { padding: `${bodyPadding}px` }, children: body !== null && body !== void 0 ? body : _jsx(_Fragment, { children: "Body" }) }), footer && (_jsx("div", { ref: footerRef, className: "ext-window-footer", children: footer })), _jsx("div", { className: "resize-handle", ref: resizeHandleRef })] }));
35
- };
@@ -1,82 +0,0 @@
1
- /* 🪟 ExtWindow Base */
2
- .ext-window {
3
- /* --ext-window-bck-color: white;
4
- --ext-window-width: 400px;
5
- --ext-window-min-height: 300px;
6
- --ext-window-border-radius: 12px;
7
- --ext-window-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
8
- --ext-window-opacity: 0;
9
- --ext-window-transition: opacity 0.4s ease-in-out; */
10
- background-color: var(--ext-window-bck-color, white);
11
- position: absolute;
12
- width: var(--ext-window-width, 400px);
13
- min-height: var(--ext-window-min-height, 300px);
14
- border-radius: var(--ext-window-border-radius, 12px);
15
- 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);
16
- opacity: var(--ext-window-opacity, 0);
17
- transition: var(--ext-window-transition, opacity 0.4s ease-in-out);
18
- user-select: none;
19
- }
20
-
21
- .ext-window.fadein {
22
- opacity: 1;
23
- }
24
-
25
- /* Header */
26
- .ext-window-header {
27
- border-radius: var(--ext-window-border-radius, 12px) var(--ext-window-border-radius, 12px) 0 0;
28
- background-color: var(--ext-window-header-bck-color, transparent);
29
- height: var(--ext-window-header-height, 50px);
30
- cursor: pointer;
31
- display: flex;
32
- }
33
-
34
- /* Body */
35
- .ext-window-body {
36
- background-color: var(--ext-window-body-bck, transparent);
37
- min-height: var(--ext-window-min-height, 200px);
38
- overflow: auto;
39
- }
40
-
41
- /* Footer */
42
- .ext-window-footer {
43
- background-color: var(--ext-window-footer-bck, transparent);
44
- height: var(--ext-window-footer-height, 50px);
45
- border-radius: 0 0 var(--ext-window-border-radius, 12px) var(--ext-window-border-radius, 12px);
46
- }
47
-
48
- /* Scrollbars for WebKit */
49
- ._ewb::-webkit-scrollbar {
50
- width: 6px;
51
- background-color: var(--ext-window-bck-color, white);
52
- }
53
-
54
- ._ewb:hover::-webkit-scrollbar {
55
- width: 6px;
56
- }
57
-
58
- ._ewb::-webkit-scrollbar-thumb {
59
- background-color: var(--ext-window-scrollbar-thumb, white);
60
- border-radius: 12px;
61
- }
62
-
63
- ._ewb:hover::-webkit-scrollbar-thumb {
64
- background-color: var(--ext-window-scrollbar-thumb-hover, #555);
65
- }
66
-
67
- /* Resize handle */
68
- .resize-handle {
69
- width: 7px;
70
- height: 120px;
71
- position: absolute;
72
- top: 50%;
73
- right: 0;
74
- transform: translateY(-50%);
75
- cursor: e-resize;
76
- background-color: transparent;
77
- border-radius: 22px 0 0 22px;
78
- }
79
-
80
- .resize-handle:hover {
81
- background: var(--ext-window-resize-bck, darkgrey);
82
- }