publ-echo-test 0.0.176 → 0.0.178

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,8 +1,13 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useRef } from 'react';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
3
  var OutsideClickHandler = function (_a) {
4
4
  var children = _a.children, onOutsideClick = _a.onOutsideClick;
5
5
  var wrapperRef = useRef(null);
6
+ var _b = useState({
7
+ transform: '',
8
+ width: '0',
9
+ height: '0'
10
+ }), childDimensions = _b[0], setChildDimensions = _b[1];
6
11
  useEffect(function () {
7
12
  var handleClickOutside = function (e) {
8
13
  var target = e.target;
@@ -10,7 +15,7 @@ var OutsideClickHandler = function (_a) {
10
15
  return;
11
16
  }
12
17
  if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
13
- onOutsideClick(); // div 외부를 클릭했을 때 실행
18
+ onOutsideClick();
14
19
  }
15
20
  };
16
21
  document.addEventListener('dblclick', handleClickOutside);
@@ -18,6 +23,64 @@ var OutsideClickHandler = function (_a) {
18
23
  document.removeEventListener('dblclick', handleClickOutside);
19
24
  };
20
25
  }, [onOutsideClick]);
21
- return _jsx("div", { ref: wrapperRef, className: 'outside-click-wrapper', children: children });
26
+ // Find and set child dimensions when component mounts or children change
27
+ useEffect(function () {
28
+ if (wrapperRef.current && wrapperRef.current.children.length > 0) {
29
+ var childElement = wrapperRef.current.children[0];
30
+ // Get computed style of the child element
31
+ var computedStyle = window.getComputedStyle(childElement);
32
+ setChildDimensions({
33
+ transform: computedStyle.transform,
34
+ width: computedStyle.width,
35
+ height: computedStyle.height
36
+ });
37
+ }
38
+ }, [children, wrapperRef.current]);
39
+ // Parse dimensions to numbers for calculations
40
+ var width = parseFloat(childDimensions.width) || 0;
41
+ var height = parseFloat(childDimensions.height) || 0;
42
+ var borderThickness = 3; // 3px border thickness
43
+ var shadowOffset = 3; // Match the child's shadow (0 0 0 3px #027aff)
44
+ return (_jsxs(_Fragment, { children: [_jsx("div", { ref: wrapperRef, className: 'outside-click-wrapper', children: children }), width > 0 && height > 0 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "border-top", style: {
45
+ position: 'absolute',
46
+ transform: childDimensions.transform,
47
+ width: "".concat(width + (shadowOffset * 2), "px"),
48
+ height: "".concat(borderThickness, "px"),
49
+ backgroundColor: '#027aff',
50
+ marginLeft: "-".concat(shadowOffset, "px"),
51
+ marginTop: "-".concat(shadowOffset, "px"),
52
+ pointerEvents: 'none',
53
+ zIndex: 999
54
+ } }), _jsx("div", { className: "border-right", style: {
55
+ position: 'absolute',
56
+ transform: childDimensions.transform,
57
+ width: "".concat(borderThickness, "px"),
58
+ height: "".concat(height + (shadowOffset * 2), "px"),
59
+ backgroundColor: '#027aff',
60
+ marginLeft: "".concat(width + shadowOffset - borderThickness, "px"),
61
+ marginTop: "-".concat(shadowOffset, "px"),
62
+ pointerEvents: 'none',
63
+ zIndex: 999
64
+ } }), _jsx("div", { className: "border-bottom", style: {
65
+ position: 'absolute',
66
+ transform: childDimensions.transform,
67
+ width: "".concat(width + (shadowOffset * 2), "px"),
68
+ height: "".concat(borderThickness, "px"),
69
+ backgroundColor: '#027aff',
70
+ marginLeft: "-".concat(shadowOffset, "px"),
71
+ marginTop: "".concat(height + shadowOffset - borderThickness, "px"),
72
+ pointerEvents: 'none',
73
+ zIndex: 99999
74
+ } }), _jsx("div", { className: "border-left", style: {
75
+ position: 'absolute',
76
+ transform: childDimensions.transform,
77
+ width: "".concat(borderThickness, "px"),
78
+ height: "".concat(height + (shadowOffset * 2), "px"),
79
+ backgroundColor: '#027aff',
80
+ marginLeft: "-".concat(shadowOffset, "px"),
81
+ marginTop: "-".concat(shadowOffset, "px"),
82
+ pointerEvents: 'none',
83
+ zIndex: 99999
84
+ } })] }))] }));
22
85
  };
23
86
  export default OutsideClickHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.176",
3
+ "version": "0.0.178",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",