@daeryun/dr_components 0.9.69 → 0.9.71
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 +4 -6
- package/dist/components/Daeryuntalk/ChatConversation.tsx +3 -3
- package/dist/components/Daeryuntalk/HistoryView.jsx +3 -2
- package/dist/components/Daeryuntalk/HistoryView.tsx +2 -2
- package/dist/components/Daeryuntalk/HomeView.jsx +3 -5
- package/dist/components/Daeryuntalk/HomeView.tsx +3 -3
- package/dist/components/Daeryuntalk/_hooks/useHoverScrollbar.d.ts +2 -8
- package/dist/components/Daeryuntalk/_hooks/useHoverScrollbar.js +0 -60
- package/dist/components/Daeryuntalk/_hooks/useHoverScrollbar.ts +7 -66
- package/dist/components/Daeryuntalk/_hooks/useScrollShadow.d.ts +1 -1
- package/dist/components/Daeryuntalk/_hooks/useScrollShadow.ts +1 -1
- package/dist/components/Daeryuntalk/_lib/utils.js +1 -1
- package/dist/components/Daeryuntalk/_lib/utils.ts +1 -1
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/styles/globals.css +330 -330
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// useHoverScrollbar.ts
|
|
2
1
|
import { useRef, useState, useEffect, RefObject, CSSProperties } from 'react';
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -6,11 +5,14 @@ import { useRef, useState, useEffect, RefObject, CSSProperties } from 'react';
|
|
|
6
5
|
* - scrollbar-gutter: stable로 항상 스크롤바 공간 확보
|
|
7
6
|
* - 가로 밀림 현상 완전 방지
|
|
8
7
|
*/
|
|
9
|
-
type MaybeDivRef = RefObject<HTMLDivElement> | undefined;
|
|
8
|
+
type MaybeDivRef = RefObject<HTMLDivElement | null> | undefined;
|
|
10
9
|
|
|
11
|
-
export function useHoverScrollbar(refParam?: MaybeDivRef): {
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
export function useHoverScrollbar(refParam?: MaybeDivRef): {
|
|
11
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
12
|
+
style: CSSProperties;
|
|
13
|
+
} {
|
|
14
|
+
const localRef = useRef<HTMLDivElement | null>(null);
|
|
15
|
+
const ref = refParam || localRef;
|
|
14
16
|
|
|
15
17
|
const [hovered, setHovered] = useState(false);
|
|
16
18
|
const [hasScroll, setHasScroll] = useState(false);
|
|
@@ -63,64 +65,3 @@ export function useHoverScrollbar(refParam?: MaybeDivRef): { ref: RefObject<HTML
|
|
|
63
65
|
|
|
64
66
|
return { ref, style };
|
|
65
67
|
}
|
|
66
|
-
|
|
67
|
-
// useHoverScrollbar.ts
|
|
68
|
-
// import { useRef, useState, useEffect, RefObject, CSSProperties } from 'react';
|
|
69
|
-
//
|
|
70
|
-
// type MaybeRef = RefObject<HTMLElement> | undefined;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* useHoverScrollbar
|
|
74
|
-
* - 외부 ref를 주입(ref 파라미터)하거나, 없으면 내부 ref 생성
|
|
75
|
-
* - hover 중이고 스크롤이 있으면 overflow-y: auto, 아니면 hidden
|
|
76
|
-
* - 레이아웃 밀림 방지용 margin/padding 트릭 적용
|
|
77
|
-
*/
|
|
78
|
-
// export function useHoverScrollbar(refParam?: MaybeRef): {
|
|
79
|
-
// ref: RefObject<HTMLDivElement>;
|
|
80
|
-
// style: CSSProperties;
|
|
81
|
-
// } {
|
|
82
|
-
// // 1) 내부 ref 준비
|
|
83
|
-
// const localRef = useRef<HTMLDivElement>(null);
|
|
84
|
-
// // 2) 실제 사용할 ref는 외부에서 안 들어오면 localRef
|
|
85
|
-
// const ref = (refParam as RefObject<HTMLDivElement>) || localRef;
|
|
86
|
-
//
|
|
87
|
-
// const [hovered, setHovered] = useState(false);
|
|
88
|
-
// const [hasScroll, setHasScroll] = useState(false);
|
|
89
|
-
// const [scrollbarWidth, setScrollbarWidth] = useState(0);
|
|
90
|
-
//
|
|
91
|
-
// // 3) 요소에 스크롤이 있는지, scrollbarWidth 계산
|
|
92
|
-
// useEffect(() => {
|
|
93
|
-
// const el = ref.current;
|
|
94
|
-
// if (!el) return;
|
|
95
|
-
// const calc = () => {
|
|
96
|
-
// setHasScroll(el.scrollHeight > el.clientHeight);
|
|
97
|
-
// setScrollbarWidth(el.offsetWidth - el.clientWidth);
|
|
98
|
-
// };
|
|
99
|
-
// calc();
|
|
100
|
-
// window.addEventListener('resize', calc);
|
|
101
|
-
// return () => window.removeEventListener('resize', calc);
|
|
102
|
-
// }, [ref]);
|
|
103
|
-
//
|
|
104
|
-
// // 4) hover 상태 관리
|
|
105
|
-
// useEffect(() => {
|
|
106
|
-
// const el = ref.current;
|
|
107
|
-
// if (!el) return;
|
|
108
|
-
// const onEnter = () => setHovered(true);
|
|
109
|
-
// const onLeave = () => setHovered(false);
|
|
110
|
-
// el.addEventListener('mouseenter', onEnter);
|
|
111
|
-
// el.addEventListener('mouseleave', onLeave);
|
|
112
|
-
// return () => {
|
|
113
|
-
// el.removeEventListener('mouseenter', onEnter);
|
|
114
|
-
// el.removeEventListener('mouseleave', onLeave);
|
|
115
|
-
// };
|
|
116
|
-
// }, [ref]);
|
|
117
|
-
//
|
|
118
|
-
// // 5) 최종 style
|
|
119
|
-
// const style: CSSProperties = {
|
|
120
|
-
// overflowY: hovered && hasScroll ? 'auto' : 'hidden',
|
|
121
|
-
// marginRight: hovered && hasScroll ? `-${scrollbarWidth}px` : undefined,
|
|
122
|
-
// paddingRight: hovered && hasScroll ? `${scrollbarWidth}px` : undefined
|
|
123
|
-
// };
|
|
124
|
-
//
|
|
125
|
-
// return { ref, style };
|
|
126
|
-
// }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
export function useScrollShadow<T extends HTMLElement>() {
|
|
4
|
-
const containerRef = useRef<T
|
|
4
|
+
const containerRef = useRef<T>(null);
|
|
5
5
|
const [isScroll, setIsScroll] = useState(false);
|
|
6
6
|
const [isBottom, setIsBottom] = useState(false);
|
|
7
7
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
@@ -88,7 +88,7 @@ export const decodeDoubleEscapedHtml = (escaped) => {
|
|
|
88
88
|
return textArea.value;
|
|
89
89
|
};
|
|
90
90
|
export const consoleFn = (...args) => {
|
|
91
|
-
if (process.env.NODE_ENV === 'development') {
|
|
91
|
+
if (process.env.NODE_ENV === 'development' || process.env.DEVELOP_TEST === 'true') {
|
|
92
92
|
console.log(...args);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
@@ -113,7 +113,7 @@ export const decodeDoubleEscapedHtml = (escaped: string) => {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
export const consoleFn = (...args: any[]) => {
|
|
116
|
-
if (process.env.NODE_ENV === 'development') {
|
|
116
|
+
if (process.env.NODE_ENV === 'development' || process.env.DEVELOP_TEST==='true') {
|
|
117
117
|
console.log(...args);
|
|
118
118
|
}
|
|
119
119
|
};
|