@sonhoseong/mfa-lib 1.0.0 → 1.1.1
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/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/navigation/StickyNav.d.ts +24 -0
- package/dist/components/navigation/StickyNav.d.ts.map +1 -0
- package/dist/components/navigation/StickyNav.js +121 -0
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/index.d.ts.map +1 -0
- package/dist/components/navigation/index.js +1 -0
- package/dist/hooks/use-modal.d.ts +5 -5
- package/dist/hooks/use-modal.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC;AAG1B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC;AAG1B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,cAAc,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface NavSection {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface StickyNavProps {
|
|
8
|
+
sections: NavSection[];
|
|
9
|
+
/** 스크롤 트리거 위치 (0-1, 기본 0.2) */
|
|
10
|
+
triggerPoint?: number;
|
|
11
|
+
/** 스크롤 오프셋 (기본 80) */
|
|
12
|
+
scrollOffset?: number;
|
|
13
|
+
/** 상단 고정 위치 (기본 20) */
|
|
14
|
+
topPosition?: number;
|
|
15
|
+
/** 로고 클릭 시 콜백 */
|
|
16
|
+
onLogoClick?: () => void;
|
|
17
|
+
/** 로고 표시 여부 */
|
|
18
|
+
showLogo?: boolean;
|
|
19
|
+
/** 커스텀 클래스 */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const StickyNav: React.FC<StickyNavProps>;
|
|
23
|
+
export default StickyNav;
|
|
24
|
+
//# sourceMappingURL=StickyNav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyNav.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/StickyNav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB;IACjB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAoK9C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
export const StickyNav = ({ sections, triggerPoint = 0.2, scrollOffset = 80, topPosition = 20, onLogoClick, showLogo = true, className = '' }) => {
|
|
4
|
+
const [activeSection, setActiveSection] = useState('');
|
|
5
|
+
const [hoveredSection, setHoveredSection] = useState(null);
|
|
6
|
+
// Scroll spy
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const handleScroll = () => {
|
|
9
|
+
const viewportHeight = window.innerHeight;
|
|
10
|
+
const trigger = viewportHeight * triggerPoint;
|
|
11
|
+
for (const section of sections) {
|
|
12
|
+
const element = document.getElementById(section.id);
|
|
13
|
+
if (element) {
|
|
14
|
+
const rect = element.getBoundingClientRect();
|
|
15
|
+
if (rect.top <= trigger && rect.bottom > trigger) {
|
|
16
|
+
setActiveSection(section.id);
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
window.addEventListener('scroll', handleScroll, { passive: true });
|
|
23
|
+
handleScroll();
|
|
24
|
+
return () => window.removeEventListener('scroll', handleScroll);
|
|
25
|
+
}, [sections, triggerPoint]);
|
|
26
|
+
const scrollToSection = useCallback((id) => {
|
|
27
|
+
const element = document.getElementById(id);
|
|
28
|
+
if (element) {
|
|
29
|
+
const elementPosition = element.getBoundingClientRect().top;
|
|
30
|
+
const offsetPosition = elementPosition + window.pageYOffset - scrollOffset;
|
|
31
|
+
window.scrollTo({ top: offsetPosition, behavior: 'smooth' });
|
|
32
|
+
}
|
|
33
|
+
}, [scrollOffset]);
|
|
34
|
+
const handleLogoClick = useCallback(() => {
|
|
35
|
+
if (onLogoClick) {
|
|
36
|
+
onLogoClick();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
40
|
+
}
|
|
41
|
+
}, [onLogoClick]);
|
|
42
|
+
const styles = {
|
|
43
|
+
wrapper: {
|
|
44
|
+
position: 'sticky',
|
|
45
|
+
top: topPosition,
|
|
46
|
+
zIndex: 1000,
|
|
47
|
+
display: 'flex',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
padding: '0 24px',
|
|
50
|
+
marginBottom: '40px',
|
|
51
|
+
},
|
|
52
|
+
nav: {
|
|
53
|
+
display: 'flex',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
gap: '4px',
|
|
56
|
+
padding: '6px',
|
|
57
|
+
background: 'rgba(255, 255, 255, 0.85)',
|
|
58
|
+
backdropFilter: 'blur(12px)',
|
|
59
|
+
WebkitBackdropFilter: 'blur(12px)',
|
|
60
|
+
borderRadius: '50px',
|
|
61
|
+
boxShadow: '0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04)',
|
|
62
|
+
border: '1px solid rgba(0, 0, 0, 0.06)',
|
|
63
|
+
},
|
|
64
|
+
logoButton: {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
gap: '5px',
|
|
68
|
+
padding: '8px 12px',
|
|
69
|
+
background: 'none',
|
|
70
|
+
border: 'none',
|
|
71
|
+
cursor: 'pointer',
|
|
72
|
+
borderRadius: '50px',
|
|
73
|
+
transition: 'background 0.2s',
|
|
74
|
+
},
|
|
75
|
+
dot: {
|
|
76
|
+
width: '10px',
|
|
77
|
+
height: '10px',
|
|
78
|
+
borderRadius: '50%',
|
|
79
|
+
transition: 'transform 0.2s',
|
|
80
|
+
},
|
|
81
|
+
pillList: {
|
|
82
|
+
display: 'flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
gap: '2px',
|
|
85
|
+
listStyle: 'none',
|
|
86
|
+
margin: 0,
|
|
87
|
+
padding: 0,
|
|
88
|
+
},
|
|
89
|
+
pill: {
|
|
90
|
+
padding: '10px 18px',
|
|
91
|
+
fontSize: '14px',
|
|
92
|
+
fontWeight: 500,
|
|
93
|
+
color: '#64748b',
|
|
94
|
+
background: 'transparent',
|
|
95
|
+
border: 'none',
|
|
96
|
+
borderRadius: '50px',
|
|
97
|
+
cursor: 'pointer',
|
|
98
|
+
whiteSpace: 'nowrap',
|
|
99
|
+
transition: 'all 0.2s ease',
|
|
100
|
+
},
|
|
101
|
+
pillHover: {
|
|
102
|
+
color: '#1E3A5F',
|
|
103
|
+
background: 'rgba(30, 58, 95, 0.08)',
|
|
104
|
+
},
|
|
105
|
+
pillActive: {
|
|
106
|
+
color: '#ffffff',
|
|
107
|
+
background: '#1E3A5F',
|
|
108
|
+
boxShadow: '0 2px 8px rgba(30, 58, 95, 0.25)',
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
return (_jsx("div", { style: styles.wrapper, className: `sticky-nav-wrapper ${className}`, children: _jsxs("nav", { style: styles.nav, className: "sticky-nav", children: [showLogo && (_jsxs("button", { style: styles.logoButton, onClick: handleLogoClick, className: "nav-logo-dots", "aria-label": "\uB9E8 \uC704\uB85C", children: [_jsx("span", { style: { ...styles.dot, background: '#3B82F6' }, className: "dot blue" }), _jsx("span", { style: { ...styles.dot, background: '#22C55E' }, className: "dot green" }), _jsx("span", { style: { ...styles.dot, background: '#F59E0B' }, className: "dot yellow" })] })), _jsx("ul", { style: styles.pillList, className: "nav-pills", children: sections.map((section) => {
|
|
112
|
+
const isActive = activeSection === section.id;
|
|
113
|
+
const isHovered = hoveredSection === section.id && !isActive;
|
|
114
|
+
return (_jsx("li", { children: _jsxs("button", { style: {
|
|
115
|
+
...styles.pill,
|
|
116
|
+
...(isHovered ? styles.pillHover : {}),
|
|
117
|
+
...(isActive ? styles.pillActive : {}),
|
|
118
|
+
}, className: `nav-pill ${isActive ? 'active' : ''}`, onClick: () => scrollToSection(section.id), onMouseEnter: () => setHoveredSection(section.id), onMouseLeave: () => setHoveredSection(null), children: [section.icon && _jsx("span", { style: { marginRight: '6px' }, children: section.icon }), section.label] }) }, section.id));
|
|
119
|
+
}) })] }) }));
|
|
120
|
+
};
|
|
121
|
+
export default StickyNav;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './StickyNav';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Modal Hooks - KOMCA 패턴
|
|
3
3
|
* Alert, Confirm 모달 관리
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface SimpleModalOptions {
|
|
6
6
|
title?: string;
|
|
7
7
|
message: string;
|
|
8
8
|
confirmText?: string;
|
|
@@ -10,14 +10,14 @@ export interface ModalHookOptions {
|
|
|
10
10
|
}
|
|
11
11
|
export interface AlertModalResult {
|
|
12
12
|
isOpen: boolean;
|
|
13
|
-
options:
|
|
14
|
-
show: (options:
|
|
13
|
+
options: SimpleModalOptions | null;
|
|
14
|
+
show: (options: SimpleModalOptions | string) => Promise<void>;
|
|
15
15
|
close: () => void;
|
|
16
16
|
}
|
|
17
17
|
export interface ConfirmModalResult {
|
|
18
18
|
isOpen: boolean;
|
|
19
|
-
options:
|
|
20
|
-
show: (options:
|
|
19
|
+
options: SimpleModalOptions | null;
|
|
20
|
+
show: (options: SimpleModalOptions | string) => Promise<boolean>;
|
|
21
21
|
close: (confirmed: boolean) => void;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-modal.d.ts","sourceRoot":"","sources":["../../src/hooks/use-modal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"use-modal.d.ts","sourceRoot":"","sources":["../../src/hooks/use-modal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAGD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,KAAK,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,gBAAgB,CA4BhD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,kBAAkB,CA4BpD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,cACH,MAAM,UAAU,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAOpE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,cACL,MAAM,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC,CAOvE"}
|