ehscan-react-components 0.1.13 → 0.1.15

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 +1,2 @@
1
1
  export { Button } from './Button';
2
+ export { Window } from './Window';
@@ -2,3 +2,4 @@
2
2
  // return <Button />
3
3
  // }
4
4
  export { Button } from './Button';
5
+ export { Window } from './Window';
package/dist/Window.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- export interface WindowProps {
2
+ import './style/window.css';
3
+ export interface Props {
3
4
  trackMove?: (args?: any) => void;
4
5
  open: boolean;
5
6
  initialPosition?: {
@@ -13,4 +14,4 @@ export interface WindowProps {
13
14
  footer?: React.ReactNode;
14
15
  onClose?: () => void;
15
16
  }
16
- export default function Window({ trackMove, open, initialPosition, initialWidth, initialBodyPadding, header, body, footer, onClose, }: WindowProps): import("react/jsx-runtime").JSX.Element | null;
17
+ export declare const Window: React.FC<Props>;
package/dist/Window.js CHANGED
@@ -1,88 +1,8 @@
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
85
- export default function Window({ trackMove, open, initialPosition = { x: 600, y: 100 }, initialWidth = 400, initialBodyPadding = 20, header, body, footer, onClose, }) {
4
+ import './style/window.css';
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);
88
8
  const resizeHandleRef = useRef(null);
@@ -113,4 +33,4 @@ export default function Window({ trackMove, open, initialPosition = { x: 600, y:
113
33
  if (!open)
114
34
  return null;
115
35
  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 })] }));
116
- }
36
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ehscan-react-components",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "components",
5
5
  "main": "dist/Components.js",
6
6
  "types": "dist/Components.d.ts",