@daeryun/dr_components 0.9.68 → 0.9.70

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.
@@ -19,6 +19,7 @@ import ChatConversationHeader from './ChatConversationItem/ChatConversationHeade
19
19
  import ChatLoading from './ChatItem/ChatLoading';
20
20
  import { useWindowSize } from './_hooks/useWindowSize';
21
21
  import TypingComp from './ChatItem/TypingComp';
22
+ import { useHoverScrollbar } from './_hooks/useHoverScrollbar';
22
23
  const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose, isHash }) => {
23
24
  var _a, _b;
24
25
  const { getNextMessageList, isNextPage, inquiryStatus, messages, isLoading, inquiryMainData, messageObject, workFlowBack, workFlowStack, chatInquiryNumber, isTyping } = useDaeryuntalk();
@@ -37,7 +38,7 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
37
38
  // 이후
38
39
  const messagesContainerRef = useRef(null);
39
40
  const messagesEndRef = useRef(null);
40
- // const { style: hoverStyle } = useHoverScrollbar(messagesContainerRef);
41
+ const { style: hoverStyle } = useHoverScrollbar(messagesContainerRef);
41
42
  useEffect(() => {
42
43
  var _a;
43
44
  if (!mobileBottomRef.current || !pcBottomRef.current)
@@ -219,14 +220,11 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
219
220
  {/* 여기서 isMpblie일때 위에 2개 헤더부분이랑 아래 메시지 입력이랑 높이를 빼서 넣어야한ㄷ */}
220
221
  <div ref={messagesContainerRef} className={`
221
222
  ${isMobile ? `${isLoading ? ' pb-[50px]' : ''} mx-[20px] overflow-y-auto ` : 'flex- ml-[20px] mr-[5px] xs:pb-[100px] '} overlay-scrollbar overflow-auto pt-[20px]
222
- `} style={{
223
- height: isMobile
223
+ `} style={Object.assign({ height: isMobile
224
224
  ? `calc(100vh - ${bottomHeight}px - ${((_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0}px)`
225
225
  : bottomHeight && headerRef.current
226
226
  ? `calc(100% - ${bottomHeight}px - ${(_b = headerRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight}px)`
227
- : '100%' // fallback
228
- // ...(!isMobile ? hoverStyle : {})
229
- }}>
227
+ : '100%' }, (!isMobile ? hoverStyle : {}))}>
230
228
  {messages.length === 0 ? (<div className="dr_talk_body_medium2 flex h-full flex-col items-center justify-center text-center text-drTalkGrayscale1">
231
229
  <p>문의하실 내용을 입력해 주세요.</p>
232
230
  <p className="mt-2 text-sm">24시간 운영하고 있습니다.</p>
@@ -65,7 +65,7 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
65
65
  const messagesContainerRef = useRef<HTMLDivElement>(null);
66
66
  const messagesEndRef = useRef<HTMLDivElement>(null);
67
67
 
68
- // const { style: hoverStyle } = useHoverScrollbar(messagesContainerRef);
68
+ const { style: hoverStyle } = useHoverScrollbar(messagesContainerRef);
69
69
 
70
70
  useEffect(() => {
71
71
  if (!mobileBottomRef.current || !pcBottomRef.current) return;
@@ -307,8 +307,8 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
307
307
  ? `calc(100vh - ${bottomHeight}px - ${headerRef.current?.offsetHeight || 0}px)`
308
308
  : bottomHeight && headerRef.current
309
309
  ? `calc(100% - ${bottomHeight}px - ${headerRef.current?.offsetHeight}px)`
310
- : '100%' // fallback
311
- // ...(!isMobile ? hoverStyle : {})
310
+ : '100%', // fallback
311
+ ...(!isMobile ? hoverStyle : {})
312
312
  }}
313
313
  >
314
314
  {messages.length === 0 ? (
@@ -8,9 +8,10 @@ import { useScrollShadow } from './_hooks/useScrollShadow';
8
8
  import ShadowBox from './_ui/ShadowBox';
9
9
  import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
10
10
  import { formatTimestamp } from './_lib/utils';
11
+ import { useHoverScrollbar } from './_hooks/useHoverScrollbar';
11
12
  const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthenticated, historyLit, goGetHistoryList, isMobile, onClose, isHash, handleGoRequestPhone, handleGoHistoryPhoneAuth }) => {
12
13
  const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
13
- // const { style: hoverStyle } = useHoverScrollbar(containerRef);
14
+ const { style: hoverStyle } = useHoverScrollbar(containerRef);
14
15
  useEffect(() => {
15
16
  checkScroll();
16
17
  }, [historyLit]);
@@ -38,7 +39,7 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
38
39
  {!isAuthenticated ? (<AuthForm goGetHistoryList={goGetHistoryList} handleGoRequestPhone={handleGoRequestPhone} handleGoHistoryPhoneAuth={handleGoHistoryPhoneAuth}/>) : (<>
39
40
  {/* 스크롤 가능한 컨텐츠 영역 */}
40
41
  <div className="relative w-full flex-1 overflow-hidden">
41
- <div ref={containerRef} className={`${isMobile ? 'overflow-y-auto px-[20px] ' : ' pl-[20px] pr-[5px] '} h-full pb-[20px] pt-[24px] `}>
42
+ <div ref={containerRef} className={`${isMobile ? 'overflow-y-auto px-[20px] ' : ' pl-[20px] pr-[5px] '} h-full pb-[20px] pt-[24px] `} style={Object.assign({}, (!isMobile ? hoverStyle : {}))}>
42
43
  {hasHistories ? (historyLit === null || historyLit === void 0 ? void 0 : historyLit.map((history, index) => (<div key={`${history.chat_inquiry_number}-${index}`} className={`cursor-pointer border-b border-drTalkGrayscale4 px-[12px] py-[18px] hover:bg-gray-50`} onClick={() => onChatHistoryClick(history.chat_inquiry_number)}>
43
44
  <div className="flex items-center justify-between">
44
45
  <div className={`flex flex-row items-center gap-[10px]`}>
@@ -39,7 +39,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({
39
39
  handleGoHistoryPhoneAuth
40
40
  }) => {
41
41
  const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow<HTMLDivElement>();
42
- // const { style: hoverStyle } = useHoverScrollbar(containerRef);
42
+ const { style: hoverStyle } = useHoverScrollbar(containerRef);
43
43
 
44
44
  useEffect(() => {
45
45
  checkScroll();
@@ -90,7 +90,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({
90
90
  <div
91
91
  ref={containerRef}
92
92
  className={`${isMobile ? 'overflow-y-auto px-[20px] ' : ' pl-[20px] pr-[5px] '} h-full pb-[20px] pt-[24px] `}
93
- // style={{ ...(!isMobile ? hoverStyle : {}) }}
93
+ style={{ ...(!isMobile ? hoverStyle : {}) }}
94
94
  >
95
95
  {hasHistories ? (
96
96
  historyLit?.map((history, index) => (
@@ -10,6 +10,7 @@ import DaeryuntalkIntro from '../../asset/images/daeryuntalk/daeryuntalk_home_bg
10
10
  import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
11
11
  import { useScrollShadow } from './_hooks/useScrollShadow';
12
12
  import Button3 from './_ui/buttons/Button3';
13
+ import { useHoverScrollbar } from './_hooks/useHoverScrollbar';
13
14
  import { useWindowSize } from './_hooks/useWindowSize';
14
15
  const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClose, isHash }) => {
15
16
  const { containerRef, isScroll, isBottom, checkScroll, isScrolling } = useScrollShadow();
@@ -17,7 +18,7 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
17
18
  const [contentHeight, setContentHeight] = useState(210);
18
19
  const currentHeightRef = useRef(210);
19
20
  const prevWrapperHeightRef = useRef(null);
20
- // const { style: hoverStyle } = useHoverScrollbar(containerRef);
21
+ const { style: hoverStyle } = useHoverScrollbar(containerRef);
21
22
  const browserSize = useWindowSize();
22
23
  useEffect(() => {
23
24
  const updateContentHeight = () => {
@@ -135,10 +136,7 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
135
136
  <section className={` flex h-full flex-col rounded-[12px] bg-white px-[16px] py-[24px] sm:h-fit ${isMobile ? 'w-full' : ' justify-between xs:justify-start '}`} style={{ boxShadow: '0px 4px 10px 0px #00000026' }}>
136
137
  {/* 해당 컴포넌트의 최상위 부모와 브라우저 상단과 닿았을 때 우선적으로 해당 부분의 높이가 먼저 줄어들게 하고 싶다*/}
137
138
  <div className="relative">
138
- <div ref={containerRef} className={`flex min-h-[80px] flex-col ${isMobile ? 'overflow-y-auto ' : ''} overlay-scrollbar`} style={{
139
- maxHeight: `${contentHeight}px`
140
- // ...(!isMobile ? hoverStyle : {})
141
- }}>
139
+ <div ref={containerRef} className={`flex min-h-[80px] flex-col ${isMobile ? 'overflow-y-auto ' : ''} overlay-scrollbar`} style={Object.assign({ maxHeight: `${contentHeight}px` }, (!isMobile ? hoverStyle : {}))}>
142
140
  <div className="flex items-center gap-[10px]">
143
141
  {(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_logo_image_url) ? (<Image src={inquiryMainData.channel_logo_image_url} alt="로고" width={32} height={32}/>) : (<DaeryunLogoIcon width={24} height={24} className="mr-2"/>)}
144
142
  <h2 className="dr_talk_title_small text-drTalkBlack">
@@ -32,7 +32,7 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
32
32
  const [contentHeight, setContentHeight] = useState<number>(210);
33
33
  const currentHeightRef = useRef(210);
34
34
  const prevWrapperHeightRef = useRef<number | null>(null);
35
- // const { style: hoverStyle } = useHoverScrollbar(containerRef);
35
+ const { style: hoverStyle } = useHoverScrollbar(containerRef);
36
36
  const browserSize = useWindowSize();
37
37
 
38
38
  useEffect(() => {
@@ -185,8 +185,8 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
185
185
  ref={containerRef}
186
186
  className={`flex min-h-[80px] flex-col ${isMobile ? 'overflow-y-auto ' : ''} overlay-scrollbar`}
187
187
  style={{
188
- maxHeight: `${contentHeight}px`
189
- // ...(!isMobile ? hoverStyle : {})
188
+ maxHeight: `${contentHeight}px`,
189
+ ...(!isMobile ? hoverStyle : {})
190
190
  }}
191
191
  >
192
192
  <div className="flex items-center gap-[10px]">
@@ -4,15 +4,9 @@ import { RefObject, CSSProperties } from 'react';
4
4
  * - scrollbar-gutter: stable로 항상 스크롤바 공간 확보
5
5
  * - 가로 밀림 현상 완전 방지
6
6
  */
7
- type MaybeDivRef = RefObject<HTMLDivElement> | undefined;
7
+ type MaybeDivRef = RefObject<HTMLDivElement | null> | undefined;
8
8
  export declare function useHoverScrollbar(refParam?: MaybeDivRef): {
9
- ref: RefObject<HTMLDivElement>;
9
+ ref: RefObject<HTMLDivElement | null>;
10
10
  style: CSSProperties;
11
11
  };
12
12
  export {};
13
- /**
14
- * useHoverScrollbar
15
- * - 외부 ref를 주입(ref 파라미터)하거나, 없으면 내부 ref 생성
16
- * - hover 중이고 스크롤이 있으면 overflow-y: auto, 아니면 hidden
17
- * - 레이아웃 밀림 방지용 margin/padding 트릭 적용
18
- */
@@ -1,4 +1,3 @@
1
- // useHoverScrollbar.ts
2
1
  import { useRef, useState, useEffect } from 'react';
3
2
  export function useHoverScrollbar(refParam) {
4
3
  const localRef = useRef(null);
@@ -44,62 +43,3 @@ export function useHoverScrollbar(refParam) {
44
43
  };
45
44
  return { ref, style };
46
45
  }
47
- // useHoverScrollbar.ts
48
- // import { useRef, useState, useEffect, RefObject, CSSProperties } from 'react';
49
- //
50
- // type MaybeRef = RefObject<HTMLElement> | undefined;
51
- /**
52
- * useHoverScrollbar
53
- * - 외부 ref를 주입(ref 파라미터)하거나, 없으면 내부 ref 생성
54
- * - hover 중이고 스크롤이 있으면 overflow-y: auto, 아니면 hidden
55
- * - 레이아웃 밀림 방지용 margin/padding 트릭 적용
56
- */
57
- // export function useHoverScrollbar(refParam?: MaybeRef): {
58
- // ref: RefObject<HTMLDivElement>;
59
- // style: CSSProperties;
60
- // } {
61
- // // 1) 내부 ref 준비
62
- // const localRef = useRef<HTMLDivElement>(null);
63
- // // 2) 실제 사용할 ref는 외부에서 안 들어오면 localRef
64
- // const ref = (refParam as RefObject<HTMLDivElement>) || localRef;
65
- //
66
- // const [hovered, setHovered] = useState(false);
67
- // const [hasScroll, setHasScroll] = useState(false);
68
- // const [scrollbarWidth, setScrollbarWidth] = useState(0);
69
- //
70
- // // 3) 요소에 스크롤이 있는지, scrollbarWidth 계산
71
- // useEffect(() => {
72
- // const el = ref.current;
73
- // if (!el) return;
74
- // const calc = () => {
75
- // setHasScroll(el.scrollHeight > el.clientHeight);
76
- // setScrollbarWidth(el.offsetWidth - el.clientWidth);
77
- // };
78
- // calc();
79
- // window.addEventListener('resize', calc);
80
- // return () => window.removeEventListener('resize', calc);
81
- // }, [ref]);
82
- //
83
- // // 4) hover 상태 관리
84
- // useEffect(() => {
85
- // const el = ref.current;
86
- // if (!el) return;
87
- // const onEnter = () => setHovered(true);
88
- // const onLeave = () => setHovered(false);
89
- // el.addEventListener('mouseenter', onEnter);
90
- // el.addEventListener('mouseleave', onLeave);
91
- // return () => {
92
- // el.removeEventListener('mouseenter', onEnter);
93
- // el.removeEventListener('mouseleave', onLeave);
94
- // };
95
- // }, [ref]);
96
- //
97
- // // 5) 최종 style
98
- // const style: CSSProperties = {
99
- // overflowY: hovered && hasScroll ? 'auto' : 'hidden',
100
- // marginRight: hovered && hasScroll ? `-${scrollbarWidth}px` : undefined,
101
- // paddingRight: hovered && hasScroll ? `${scrollbarWidth}px` : undefined
102
- // };
103
- //
104
- // return { ref, style };
105
- // }
@@ -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): { ref: RefObject<HTMLDivElement>; style: CSSProperties } {
12
- const localRef = useRef<HTMLDivElement>(null);
13
- const ref = (refParam as RefObject<HTMLDivElement>) || localRef;
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,5 +1,5 @@
1
1
  export declare function useScrollShadow<T extends HTMLElement>(): {
2
- containerRef: import("react").MutableRefObject<T | null>;
2
+ containerRef: import("react").RefObject<T>;
3
3
  isScroll: boolean;
4
4
  isBottom: boolean;
5
5
  isScrolling: boolean;
@@ -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 | null>(null);
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);
@@ -41,7 +41,7 @@ export const Lawyer = ({ lawyerData }) => {
41
41
  </div>
42
42
  <span className={'flex flex-1 flex-col justify-between gap-[5px]'}>
43
43
  <span className={'relative flex w-full flex-col gap-[5px]'}>
44
- <meta itemProp="name" content={`${i.lawyer_name} 변호사`}/>
44
+ <meta itemProp="name" content={`${i.lawyer_name} ${i.lawyer_position}`}/>
45
45
  <p className={'text-[23px] font-bold leading-none tracking-[-0.46px] text-[#434343]'}>
46
46
  {i.lawyer_name}
47
47
  </p>
@@ -91,7 +91,7 @@ export const Lawyer = ({ lawyerData }: { lawyerData: any[] }) => {
91
91
  </div>
92
92
  <span className={'flex flex-1 flex-col justify-between gap-[5px]'}>
93
93
  <span className={'relative flex w-full flex-col gap-[5px]'}>
94
- <meta itemProp="name" content={`${i.lawyer_name} 변호사`} />
94
+ <meta itemProp="name" content={`${i.lawyer_name} ${i.lawyer_position}`} />
95
95
  <p className={'text-[23px] font-bold leading-none tracking-[-0.46px] text-[#434343]'}>
96
96
  {i.lawyer_name}
97
97
  </p>