@daeryun/dr_components 0.9.61 → 0.9.62
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/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatConversation.jsx +8 -8
- package/dist/components/Daeryuntalk/ChatConversation.tsx +9 -5
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +2 -3
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +2 -3
- package/dist/components/Daeryuntalk/ChatWidget.jsx +0 -2
- package/dist/components/Daeryuntalk/ChatWidget.tsx +0 -2
- package/dist/components/Daeryuntalk/HistoryView.jsx +4 -2
- package/dist/components/Daeryuntalk/HistoryView.tsx +6 -3
- package/dist/components/Daeryuntalk/HomeView.jsx +80 -61
- package/dist/components/Daeryuntalk/HomeView.tsx +94 -74
- package/dist/components/Daeryuntalk/_hooks/useHoverScrollbar.d.ts +18 -0
- package/dist/components/Daeryuntalk/_hooks/useHoverScrollbar.js +110 -0
- package/dist/components/Daeryuntalk/_hooks/useHoverScrollbar.ts +129 -0
- package/dist/styles/daeryuntalk.css +21 -0
- package/dist/styles/globals.css +12 -13
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// useHoverScrollbar.ts
|
|
2
|
+
import { useRef, useState, useEffect, RefObject, CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
type MaybeRef = RefObject<HTMLElement> | undefined;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* useHoverScrollbar (scrollbar-gutter 완전 해결)
|
|
8
|
+
* - scrollbar-gutter: stable로 항상 스크롤바 공간 확보
|
|
9
|
+
* - 가로 밀림 현상 완전 방지
|
|
10
|
+
*/
|
|
11
|
+
export function useHoverScrollbar(refParam?: MaybeRef): {
|
|
12
|
+
ref: RefObject<HTMLDivElement>;
|
|
13
|
+
style: CSSProperties;
|
|
14
|
+
} {
|
|
15
|
+
const localRef = useRef<HTMLDivElement>(null);
|
|
16
|
+
const ref = (refParam as RefObject<HTMLDivElement>) || localRef;
|
|
17
|
+
|
|
18
|
+
const [hovered, setHovered] = useState(false);
|
|
19
|
+
const [hasScroll, setHasScroll] = useState(false);
|
|
20
|
+
|
|
21
|
+
// 스크롤 여부 체크
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const el = ref.current;
|
|
24
|
+
if (!el) return;
|
|
25
|
+
|
|
26
|
+
const checkScroll = () => {
|
|
27
|
+
setHasScroll(el.scrollHeight > el.clientHeight);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
checkScroll();
|
|
31
|
+
|
|
32
|
+
// ResizeObserver로 더 정확한 감지
|
|
33
|
+
const resizeObserver = new ResizeObserver(checkScroll);
|
|
34
|
+
resizeObserver.observe(el);
|
|
35
|
+
|
|
36
|
+
window.addEventListener('resize', checkScroll);
|
|
37
|
+
|
|
38
|
+
return () => {
|
|
39
|
+
resizeObserver.disconnect();
|
|
40
|
+
window.removeEventListener('resize', checkScroll);
|
|
41
|
+
};
|
|
42
|
+
}, [ref]);
|
|
43
|
+
|
|
44
|
+
// 호버 상태 관리
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const el = ref.current;
|
|
47
|
+
if (!el) return;
|
|
48
|
+
|
|
49
|
+
const onEnter = () => setHovered(true);
|
|
50
|
+
const onLeave = () => setHovered(false);
|
|
51
|
+
|
|
52
|
+
el.addEventListener('mouseenter', onEnter);
|
|
53
|
+
el.addEventListener('mouseleave', onLeave);
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
el.removeEventListener('mouseenter', onEnter);
|
|
57
|
+
el.removeEventListener('mouseleave', onLeave);
|
|
58
|
+
};
|
|
59
|
+
}, [ref]);
|
|
60
|
+
|
|
61
|
+
const style: CSSProperties = {
|
|
62
|
+
overflowY: hovered && hasScroll ? 'auto' : 'hidden',
|
|
63
|
+
// 항상 스크롤바 공간을 확보 (최신 브라우저)
|
|
64
|
+
scrollbarGutter: 'stable' //15px
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return { ref, style };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// useHoverScrollbar.ts
|
|
71
|
+
// import { useRef, useState, useEffect, RefObject, CSSProperties } from 'react';
|
|
72
|
+
//
|
|
73
|
+
// type MaybeRef = RefObject<HTMLElement> | undefined;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* useHoverScrollbar
|
|
77
|
+
* - 외부 ref를 주입(ref 파라미터)하거나, 없으면 내부 ref 생성
|
|
78
|
+
* - hover 중이고 스크롤이 있으면 overflow-y: auto, 아니면 hidden
|
|
79
|
+
* - 레이아웃 밀림 방지용 margin/padding 트릭 적용
|
|
80
|
+
*/
|
|
81
|
+
// export function useHoverScrollbar(refParam?: MaybeRef): {
|
|
82
|
+
// ref: RefObject<HTMLDivElement>;
|
|
83
|
+
// style: CSSProperties;
|
|
84
|
+
// } {
|
|
85
|
+
// // 1) 내부 ref 준비
|
|
86
|
+
// const localRef = useRef<HTMLDivElement>(null);
|
|
87
|
+
// // 2) 실제 사용할 ref는 외부에서 안 들어오면 localRef
|
|
88
|
+
// const ref = (refParam as RefObject<HTMLDivElement>) || localRef;
|
|
89
|
+
//
|
|
90
|
+
// const [hovered, setHovered] = useState(false);
|
|
91
|
+
// const [hasScroll, setHasScroll] = useState(false);
|
|
92
|
+
// const [scrollbarWidth, setScrollbarWidth] = useState(0);
|
|
93
|
+
//
|
|
94
|
+
// // 3) 요소에 스크롤이 있는지, scrollbarWidth 계산
|
|
95
|
+
// useEffect(() => {
|
|
96
|
+
// const el = ref.current;
|
|
97
|
+
// if (!el) return;
|
|
98
|
+
// const calc = () => {
|
|
99
|
+
// setHasScroll(el.scrollHeight > el.clientHeight);
|
|
100
|
+
// setScrollbarWidth(el.offsetWidth - el.clientWidth);
|
|
101
|
+
// };
|
|
102
|
+
// calc();
|
|
103
|
+
// window.addEventListener('resize', calc);
|
|
104
|
+
// return () => window.removeEventListener('resize', calc);
|
|
105
|
+
// }, [ref]);
|
|
106
|
+
//
|
|
107
|
+
// // 4) hover 상태 관리
|
|
108
|
+
// useEffect(() => {
|
|
109
|
+
// const el = ref.current;
|
|
110
|
+
// if (!el) return;
|
|
111
|
+
// const onEnter = () => setHovered(true);
|
|
112
|
+
// const onLeave = () => setHovered(false);
|
|
113
|
+
// el.addEventListener('mouseenter', onEnter);
|
|
114
|
+
// el.addEventListener('mouseleave', onLeave);
|
|
115
|
+
// return () => {
|
|
116
|
+
// el.removeEventListener('mouseenter', onEnter);
|
|
117
|
+
// el.removeEventListener('mouseleave', onLeave);
|
|
118
|
+
// };
|
|
119
|
+
// }, [ref]);
|
|
120
|
+
//
|
|
121
|
+
// // 5) 최종 style
|
|
122
|
+
// const style: CSSProperties = {
|
|
123
|
+
// overflowY: hovered && hasScroll ? 'auto' : 'hidden',
|
|
124
|
+
// marginRight: hovered && hasScroll ? `-${scrollbarWidth}px` : undefined,
|
|
125
|
+
// paddingRight: hovered && hasScroll ? `${scrollbarWidth}px` : undefined
|
|
126
|
+
// };
|
|
127
|
+
//
|
|
128
|
+
// return { ref, style };
|
|
129
|
+
// }
|
|
@@ -11,6 +11,27 @@
|
|
|
11
11
|
scrollbar-width: none; /* Firefox */
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
.my-scroll-container {
|
|
15
|
+
overflow-y: overlay;
|
|
16
|
+
overflow-x: hidden;
|
|
17
|
+
scrollbar-width: thin;
|
|
18
|
+
scrollbar-color: rgba(0,0,0,0.3) transparent;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.my-scroll-container::-webkit-scrollbar {
|
|
22
|
+
width: 4px;
|
|
23
|
+
}
|
|
24
|
+
.my-scroll-container::-webkit-scrollbar-track {
|
|
25
|
+
background: transparent;
|
|
26
|
+
}
|
|
27
|
+
.my-scroll-container::-webkit-scrollbar-thumb {
|
|
28
|
+
background-color: rgba(0,0,0,0.3);
|
|
29
|
+
border-radius: 2px;
|
|
30
|
+
}
|
|
31
|
+
.my-scroll-container::-webkit-scrollbar-thumb:hover {
|
|
32
|
+
background-color: rgba(0,0,0,0.5);
|
|
33
|
+
}
|
|
34
|
+
|
|
14
35
|
.tiptap p.is-editor-empty:first-child::before {
|
|
15
36
|
color: #adb5bd;
|
|
16
37
|
content: attr(data-placeholder);
|
package/dist/styles/globals.css
CHANGED
|
@@ -2616,10 +2616,6 @@ video {
|
|
|
2616
2616
|
max-height: 160px;
|
|
2617
2617
|
}
|
|
2618
2618
|
|
|
2619
|
-
.max-h-\[210px\] {
|
|
2620
|
-
max-height: 210px;
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2623
2619
|
.max-h-\[290px\] {
|
|
2624
2620
|
max-height: 290px;
|
|
2625
2621
|
}
|
|
@@ -5658,11 +5654,6 @@ video {
|
|
|
5658
5654
|
object-fit: fill;
|
|
5659
5655
|
}
|
|
5660
5656
|
|
|
5661
|
-
.object-center {
|
|
5662
|
-
-o-object-position: center;
|
|
5663
|
-
object-position: center;
|
|
5664
|
-
}
|
|
5665
|
-
|
|
5666
5657
|
.object-right {
|
|
5667
5658
|
-o-object-position: right;
|
|
5668
5659
|
object-position: right;
|
|
@@ -6223,10 +6214,6 @@ video {
|
|
|
6223
6214
|
padding-bottom: 30px;
|
|
6224
6215
|
}
|
|
6225
6216
|
|
|
6226
|
-
.pb-\[34px\] {
|
|
6227
|
-
padding-bottom: 34px;
|
|
6228
|
-
}
|
|
6229
|
-
|
|
6230
6217
|
.pb-\[35px\] {
|
|
6231
6218
|
padding-bottom: 35px;
|
|
6232
6219
|
}
|
|
@@ -6267,6 +6254,10 @@ video {
|
|
|
6267
6254
|
padding-bottom: 80px;
|
|
6268
6255
|
}
|
|
6269
6256
|
|
|
6257
|
+
.pb-\[84px\] {
|
|
6258
|
+
padding-bottom: 84px;
|
|
6259
|
+
}
|
|
6260
|
+
|
|
6270
6261
|
.pb-\[8px\] {
|
|
6271
6262
|
padding-bottom: 8px;
|
|
6272
6263
|
}
|
|
@@ -6367,6 +6358,10 @@ video {
|
|
|
6367
6358
|
padding-right: 40px;
|
|
6368
6359
|
}
|
|
6369
6360
|
|
|
6361
|
+
.pr-\[5px\] {
|
|
6362
|
+
padding-right: 5px;
|
|
6363
|
+
}
|
|
6364
|
+
|
|
6370
6365
|
.pr-\[72px\] {
|
|
6371
6366
|
padding-right: 72px;
|
|
6372
6367
|
}
|
|
@@ -15588,6 +15583,10 @@ body {
|
|
|
15588
15583
|
padding-bottom: 100px;
|
|
15589
15584
|
}
|
|
15590
15585
|
|
|
15586
|
+
.xs\:pb-\[34px\] {
|
|
15587
|
+
padding-bottom: 34px;
|
|
15588
|
+
}
|
|
15589
|
+
|
|
15591
15590
|
.xs\:pl-\[11px\] {
|
|
15592
15591
|
padding-left: 11px;
|
|
15593
15592
|
}
|