@blastlabs/utils 1.11.0
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/README.md +267 -0
- package/dist/components/dev/ApiLogger.d.ts +136 -0
- package/dist/components/dev/ApiLogger.d.ts.map +1 -0
- package/dist/components/dev/ApiLogger.js +408 -0
- package/dist/components/dev/DevPanel.d.ts +32 -0
- package/dist/components/dev/DevPanel.d.ts.map +1 -0
- package/dist/components/dev/DevPanel.js +196 -0
- package/dist/components/dev/FormDevTools/FormDevTools.d.ts +136 -0
- package/dist/components/dev/FormDevTools/FormDevTools.d.ts.map +1 -0
- package/dist/components/dev/FormDevTools/FormDevTools.js +442 -0
- package/dist/components/dev/FormDevTools/index.d.ts +3 -0
- package/dist/components/dev/FormDevTools/index.d.ts.map +1 -0
- package/dist/components/dev/FormDevTools/index.js +1 -0
- package/dist/components/dev/FormDevTools/styles.d.ts +45 -0
- package/dist/components/dev/FormDevTools/styles.d.ts.map +1 -0
- package/dist/components/dev/FormDevTools/styles.js +197 -0
- package/dist/components/dev/IdSelector.d.ts +50 -0
- package/dist/components/dev/IdSelector.d.ts.map +1 -0
- package/dist/components/dev/IdSelector.js +129 -0
- package/dist/components/dev/WindowSizeDisplay.d.ts +44 -0
- package/dist/components/dev/WindowSizeDisplay.d.ts.map +1 -0
- package/dist/components/dev/WindowSizeDisplay.js +74 -0
- package/dist/components/dev/ZIndexDebugger.d.ts +32 -0
- package/dist/components/dev/ZIndexDebugger.d.ts.map +1 -0
- package/dist/components/dev/ZIndexDebugger.js +184 -0
- package/dist/components/dev/index.d.ts +15 -0
- package/dist/components/dev/index.d.ts.map +1 -0
- package/dist/components/dev/index.js +12 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +7 -0
- package/dist/date/index.d.ts +64 -0
- package/dist/date/index.d.ts.map +1 -0
- package/dist/date/index.js +92 -0
- package/dist/date/index.test.d.ts +2 -0
- package/dist/date/index.test.d.ts.map +1 -0
- package/dist/date/index.test.js +166 -0
- package/dist/form/__tests__/formatter.test.d.ts +2 -0
- package/dist/form/__tests__/formatter.test.d.ts.map +1 -0
- package/dist/form/__tests__/formatter.test.js +74 -0
- package/dist/form/__tests__/helpers.test.d.ts +2 -0
- package/dist/form/__tests__/helpers.test.d.ts.map +1 -0
- package/dist/form/__tests__/helpers.test.js +42 -0
- package/dist/form/__tests__/validation.test.d.ts +2 -0
- package/dist/form/__tests__/validation.test.d.ts.map +1 -0
- package/dist/form/__tests__/validation.test.js +67 -0
- package/dist/form/formatter.d.ts +34 -0
- package/dist/form/formatter.d.ts.map +1 -0
- package/dist/form/formatter.js +76 -0
- package/dist/form/helpers.d.ts +16 -0
- package/dist/form/helpers.d.ts.map +1 -0
- package/dist/form/helpers.js +34 -0
- package/dist/form/index.d.ts +9 -0
- package/dist/form/index.d.ts.map +1 -0
- package/dist/form/index.js +11 -0
- package/dist/form/validation.d.ts +33 -0
- package/dist/form/validation.d.ts.map +1 -0
- package/dist/form/validation.js +56 -0
- package/dist/hooks/index.d.ts +19 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +23 -0
- package/dist/hooks/useClickOutside.d.ts +49 -0
- package/dist/hooks/useClickOutside.d.ts.map +1 -0
- package/dist/hooks/useClickOutside.js +94 -0
- package/dist/hooks/useCopyToClipboard.d.ts +67 -0
- package/dist/hooks/useCopyToClipboard.d.ts.map +1 -0
- package/dist/hooks/useCopyToClipboard.js +79 -0
- package/dist/hooks/useDebounce.d.ts +47 -0
- package/dist/hooks/useDebounce.d.ts.map +1 -0
- package/dist/hooks/useDebounce.js +60 -0
- package/dist/hooks/useEventListener.d.ts +79 -0
- package/dist/hooks/useEventListener.d.ts.map +1 -0
- package/dist/hooks/useEventListener.js +33 -0
- package/dist/hooks/useIntersectionObserver.d.ts +109 -0
- package/dist/hooks/useIntersectionObserver.d.ts.map +1 -0
- package/dist/hooks/useIntersectionObserver.js +128 -0
- package/dist/hooks/useLocalStorage.d.ts +19 -0
- package/dist/hooks/useLocalStorage.d.ts.map +1 -0
- package/dist/hooks/useLocalStorage.js +91 -0
- package/dist/hooks/useMediaQuery.d.ts +56 -0
- package/dist/hooks/useMediaQuery.d.ts.map +1 -0
- package/dist/hooks/useMediaQuery.js +104 -0
- package/dist/hooks/usePrevious.d.ts +58 -0
- package/dist/hooks/usePrevious.d.ts.map +1 -0
- package/dist/hooks/usePrevious.js +67 -0
- package/dist/hooks/useSessionStorage.d.ts +19 -0
- package/dist/hooks/useSessionStorage.d.ts.map +1 -0
- package/dist/hooks/useSessionStorage.js +85 -0
- package/dist/hooks/useThrottle.d.ts +57 -0
- package/dist/hooks/useThrottle.d.ts.map +1 -0
- package/dist/hooks/useThrottle.js +80 -0
- package/dist/hooks/useToggle.d.ts +49 -0
- package/dist/hooks/useToggle.d.ts.map +1 -0
- package/dist/hooks/useToggle.js +56 -0
- package/dist/hooks/useWindowSize.d.ts +58 -0
- package/dist/hooks/useWindowSize.d.ts.map +1 -0
- package/dist/hooks/useWindowSize.js +79 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/mock/form.d.ts +41 -0
- package/dist/mock/form.d.ts.map +1 -0
- package/dist/mock/form.js +195 -0
- package/dist/mock/generators.d.ts +112 -0
- package/dist/mock/generators.d.ts.map +1 -0
- package/dist/mock/generators.js +195 -0
- package/dist/mock/index.d.ts +8 -0
- package/dist/mock/index.d.ts.map +1 -0
- package/dist/mock/index.js +9 -0
- package/dist/number/format.d.ts +116 -0
- package/dist/number/format.d.ts.map +1 -0
- package/dist/number/format.js +165 -0
- package/dist/number/index.d.ts +7 -0
- package/dist/number/index.d.ts.map +1 -0
- package/dist/number/index.js +7 -0
- package/dist/string/__tests__/case.test.d.ts +2 -0
- package/dist/string/__tests__/case.test.d.ts.map +1 -0
- package/dist/string/__tests__/case.test.js +61 -0
- package/dist/string/__tests__/manipulation.test.d.ts +2 -0
- package/dist/string/__tests__/manipulation.test.d.ts.map +1 -0
- package/dist/string/__tests__/manipulation.test.js +109 -0
- package/dist/string/__tests__/validation.test.d.ts +2 -0
- package/dist/string/__tests__/validation.test.d.ts.map +1 -0
- package/dist/string/__tests__/validation.test.js +101 -0
- package/dist/string/case.d.ts +42 -0
- package/dist/string/case.d.ts.map +1 -0
- package/dist/string/case.js +71 -0
- package/dist/string/index.d.ts +9 -0
- package/dist/string/index.d.ts.map +1 -0
- package/dist/string/index.js +11 -0
- package/dist/string/manipulation.d.ts +61 -0
- package/dist/string/manipulation.d.ts.map +1 -0
- package/dist/string/manipulation.js +106 -0
- package/dist/string/validation.d.ts +79 -0
- package/dist/string/validation.d.ts.map +1 -0
- package/dist/string/validation.js +115 -0
- package/package.json +86 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
export const getPositionStyles = () => ({
|
|
2
|
+
'top-left': { top: 16, left: 16 },
|
|
3
|
+
'top-right': { top: 16, right: 16 },
|
|
4
|
+
'bottom-left': { bottom: 16, left: 16 },
|
|
5
|
+
'bottom-right': { bottom: 16, right: 16 },
|
|
6
|
+
});
|
|
7
|
+
export const getContainerStyle = (position) => {
|
|
8
|
+
const positionStyles = getPositionStyles();
|
|
9
|
+
return {
|
|
10
|
+
position: 'fixed',
|
|
11
|
+
...positionStyles[position],
|
|
12
|
+
zIndex: 99999,
|
|
13
|
+
fontFamily: 'system-ui, -apple-system, sans-serif',
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export const getToggleButtonStyle = (isValid) => ({
|
|
17
|
+
width: '48px',
|
|
18
|
+
height: '48px',
|
|
19
|
+
borderRadius: '50%',
|
|
20
|
+
backgroundColor: isValid === false ? '#ef4444' : '#8b5cf6',
|
|
21
|
+
color: 'white',
|
|
22
|
+
border: 'none',
|
|
23
|
+
cursor: 'pointer',
|
|
24
|
+
fontSize: '20px',
|
|
25
|
+
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
transition: 'background-color 0.2s',
|
|
30
|
+
});
|
|
31
|
+
export const getPanelStyle = (position, panelPosition, panelSize, isDragging) => {
|
|
32
|
+
const maxHeight = typeof window !== 'undefined' ? window.innerHeight * 0.85 : 600;
|
|
33
|
+
return {
|
|
34
|
+
position: 'fixed',
|
|
35
|
+
top: panelPosition.y || (position.includes('top') ? 60 : undefined),
|
|
36
|
+
bottom: !panelPosition.y && position.includes('bottom') ? 60 : undefined,
|
|
37
|
+
left: panelPosition.x || (position.includes('left') ? 0 : undefined),
|
|
38
|
+
right: !panelPosition.x && position.includes('right') ? 0 : undefined,
|
|
39
|
+
backgroundColor: 'white',
|
|
40
|
+
borderRadius: '12px',
|
|
41
|
+
boxShadow: '0 10px 25px rgba(0, 0, 0, 0.15)',
|
|
42
|
+
border: '1px solid #e5e7eb',
|
|
43
|
+
width: `${panelSize.width}px`,
|
|
44
|
+
height: `${Math.min(panelSize.height, maxHeight)}px`,
|
|
45
|
+
maxHeight: `${maxHeight}px`,
|
|
46
|
+
overflow: 'hidden',
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'column',
|
|
49
|
+
cursor: isDragging ? 'grabbing' : 'default',
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export const headerStyle = {
|
|
53
|
+
padding: '12px 16px',
|
|
54
|
+
borderBottom: '1px solid #e5e7eb',
|
|
55
|
+
display: 'flex',
|
|
56
|
+
justifyContent: 'space-between',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
backgroundColor: '#f9fafb',
|
|
59
|
+
cursor: 'grab',
|
|
60
|
+
userSelect: 'none',
|
|
61
|
+
};
|
|
62
|
+
export const headerTitleStyle = {
|
|
63
|
+
fontWeight: 'bold',
|
|
64
|
+
fontSize: '14px',
|
|
65
|
+
color: '#111827',
|
|
66
|
+
};
|
|
67
|
+
export const getStatusBadgeStyle = (isValid) => ({
|
|
68
|
+
display: 'inline-flex',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
gap: '4px',
|
|
71
|
+
padding: '4px 8px',
|
|
72
|
+
backgroundColor: isValid ? '#dcfce7' : '#fee2e2',
|
|
73
|
+
color: isValid ? '#166534' : '#991b1b',
|
|
74
|
+
borderRadius: '6px',
|
|
75
|
+
fontSize: '11px',
|
|
76
|
+
fontWeight: 600,
|
|
77
|
+
});
|
|
78
|
+
export const getCopyButtonStyle = (isCopied) => ({
|
|
79
|
+
padding: '4px 12px',
|
|
80
|
+
backgroundColor: isCopied ? '#10b981' : '#3b82f6',
|
|
81
|
+
color: 'white',
|
|
82
|
+
border: 'none',
|
|
83
|
+
borderRadius: '6px',
|
|
84
|
+
cursor: 'pointer',
|
|
85
|
+
fontSize: '11px',
|
|
86
|
+
fontWeight: 600,
|
|
87
|
+
transition: 'background-color 0.2s',
|
|
88
|
+
});
|
|
89
|
+
export const tabContainerStyle = {
|
|
90
|
+
display: 'flex',
|
|
91
|
+
borderBottom: '1px solid #e5e7eb',
|
|
92
|
+
backgroundColor: '#f9fafb',
|
|
93
|
+
overflowX: 'auto',
|
|
94
|
+
};
|
|
95
|
+
export const getTabStyle = (isActive) => ({
|
|
96
|
+
flex: '0 0 auto',
|
|
97
|
+
padding: '10px 16px',
|
|
98
|
+
border: 'none',
|
|
99
|
+
backgroundColor: isActive ? 'white' : 'transparent',
|
|
100
|
+
color: isActive ? '#8b5cf6' : '#6b7280',
|
|
101
|
+
cursor: 'pointer',
|
|
102
|
+
fontSize: '13px',
|
|
103
|
+
fontWeight: isActive ? 600 : 400,
|
|
104
|
+
borderBottom: isActive ? '2px solid #8b5cf6' : '2px solid transparent',
|
|
105
|
+
transition: 'all 0.15s',
|
|
106
|
+
whiteSpace: 'nowrap',
|
|
107
|
+
});
|
|
108
|
+
export const contentStyle = {
|
|
109
|
+
flex: 1,
|
|
110
|
+
minHeight: 0, // flexbox에서 스크롤이 제대로 작동하도록 필수
|
|
111
|
+
overflowY: 'auto',
|
|
112
|
+
overflowX: 'hidden',
|
|
113
|
+
padding: '16px',
|
|
114
|
+
};
|
|
115
|
+
export const sectionTitleStyle = {
|
|
116
|
+
fontSize: '12px',
|
|
117
|
+
fontWeight: 'bold',
|
|
118
|
+
color: '#6b7280',
|
|
119
|
+
marginBottom: '8px',
|
|
120
|
+
textTransform: 'uppercase',
|
|
121
|
+
letterSpacing: '0.5px',
|
|
122
|
+
};
|
|
123
|
+
export const codeBlockStyle = {
|
|
124
|
+
backgroundColor: '#f3f4f6',
|
|
125
|
+
borderRadius: '6px',
|
|
126
|
+
padding: '12px',
|
|
127
|
+
fontSize: '12px',
|
|
128
|
+
fontFamily: 'monospace',
|
|
129
|
+
overflow: 'auto',
|
|
130
|
+
maxHeight: '300px',
|
|
131
|
+
marginBottom: '16px',
|
|
132
|
+
color: '#111827', // 검은색 텍스트
|
|
133
|
+
textAlign: 'left', // 왼쪽 정렬
|
|
134
|
+
whiteSpace: 'pre', // 공백과 줄바꿈 유지
|
|
135
|
+
};
|
|
136
|
+
export const errorItemStyle = {
|
|
137
|
+
padding: '8px 12px',
|
|
138
|
+
backgroundColor: '#fef2f2',
|
|
139
|
+
border: '1px solid #fecaca',
|
|
140
|
+
borderRadius: '6px',
|
|
141
|
+
marginBottom: '8px',
|
|
142
|
+
};
|
|
143
|
+
export const errorLabelStyle = {
|
|
144
|
+
fontSize: '12px',
|
|
145
|
+
fontWeight: 600,
|
|
146
|
+
color: '#991b1b',
|
|
147
|
+
marginBottom: '4px',
|
|
148
|
+
};
|
|
149
|
+
export const errorMessageStyle = {
|
|
150
|
+
fontSize: '11px',
|
|
151
|
+
color: '#7f1d1d',
|
|
152
|
+
};
|
|
153
|
+
export const statsContainerStyle = {
|
|
154
|
+
display: 'grid',
|
|
155
|
+
gridTemplateColumns: '1fr 1fr',
|
|
156
|
+
gap: '12px',
|
|
157
|
+
marginBottom: '16px',
|
|
158
|
+
};
|
|
159
|
+
export const statCardStyle = {
|
|
160
|
+
padding: '12px',
|
|
161
|
+
backgroundColor: '#f9fafb',
|
|
162
|
+
borderRadius: '8px',
|
|
163
|
+
border: '1px solid #e5e7eb',
|
|
164
|
+
};
|
|
165
|
+
export const statLabelStyle = {
|
|
166
|
+
fontSize: '11px',
|
|
167
|
+
color: '#6b7280',
|
|
168
|
+
marginBottom: '4px',
|
|
169
|
+
textTransform: 'uppercase',
|
|
170
|
+
letterSpacing: '0.5px',
|
|
171
|
+
};
|
|
172
|
+
export const statValueStyle = {
|
|
173
|
+
fontSize: '18px',
|
|
174
|
+
fontWeight: 'bold',
|
|
175
|
+
color: '#111827',
|
|
176
|
+
};
|
|
177
|
+
export const resizeHandleStyle = {
|
|
178
|
+
position: 'absolute',
|
|
179
|
+
bottom: 0,
|
|
180
|
+
right: 0,
|
|
181
|
+
width: '20px',
|
|
182
|
+
height: '20px',
|
|
183
|
+
cursor: 'nwse-resize',
|
|
184
|
+
backgroundColor: 'transparent',
|
|
185
|
+
zIndex: 1,
|
|
186
|
+
};
|
|
187
|
+
export const resizeHandleIndicatorStyle = {
|
|
188
|
+
position: 'absolute',
|
|
189
|
+
bottom: 0,
|
|
190
|
+
right: 0,
|
|
191
|
+
width: '12px',
|
|
192
|
+
height: '12px',
|
|
193
|
+
cursor: 'nwse-resize',
|
|
194
|
+
borderRight: '3px solid #9ca3af',
|
|
195
|
+
borderBottom: '3px solid #9ca3af',
|
|
196
|
+
borderRadius: '0 0 12px 0',
|
|
197
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type LoginInfo = {
|
|
3
|
+
id: string;
|
|
4
|
+
pw: string;
|
|
5
|
+
memo: string;
|
|
6
|
+
};
|
|
7
|
+
type Props = {
|
|
8
|
+
onLogin: (email: string, password: string) => Promise<void>;
|
|
9
|
+
infos: LoginInfo[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 개발용 로그인 shortcut 컴포넌트
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Vite 프로젝트
|
|
17
|
+
* import { IdSelector } from 'goodchuck-utils/components/dev';
|
|
18
|
+
*
|
|
19
|
+
* function LoginPage() {
|
|
20
|
+
* const handleLogin = async (email: string, password: string) => {
|
|
21
|
+
* await loginAPI(email, password);
|
|
22
|
+
* };
|
|
23
|
+
*
|
|
24
|
+
* const devAccounts = [
|
|
25
|
+
* { id: 'admin@test.com', pw: 'admin123', memo: '관리자' },
|
|
26
|
+
* { id: 'user@test.com', pw: 'user123', memo: '일반 사용자' },
|
|
27
|
+
* ];
|
|
28
|
+
*
|
|
29
|
+
* return (
|
|
30
|
+
* <div>
|
|
31
|
+
* <LoginForm />
|
|
32
|
+
* {import.meta.env.DEV && (
|
|
33
|
+
* <IdSelector onLogin={handleLogin} infos={devAccounts} />
|
|
34
|
+
* )}
|
|
35
|
+
* </div>
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Create React App 프로젝트
|
|
43
|
+
* {process.env.NODE_ENV === 'development' && (
|
|
44
|
+
* <IdSelector onLogin={handleLogin} infos={devAccounts} />
|
|
45
|
+
* )}
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export default function IdSelector({ onLogin, infos }: Props): React.JSX.Element;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=IdSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdSelector.d.ts","sourceRoot":"","sources":["../../../src/components/dev/IdSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AAEvD,KAAK,SAAS,GAAG;IACf,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,qBAuH3D"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 개발용 로그인 shortcut 컴포넌트
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* // Vite 프로젝트
|
|
8
|
+
* import { IdSelector } from 'goodchuck-utils/components/dev';
|
|
9
|
+
*
|
|
10
|
+
* function LoginPage() {
|
|
11
|
+
* const handleLogin = async (email: string, password: string) => {
|
|
12
|
+
* await loginAPI(email, password);
|
|
13
|
+
* };
|
|
14
|
+
*
|
|
15
|
+
* const devAccounts = [
|
|
16
|
+
* { id: 'admin@test.com', pw: 'admin123', memo: '관리자' },
|
|
17
|
+
* { id: 'user@test.com', pw: 'user123', memo: '일반 사용자' },
|
|
18
|
+
* ];
|
|
19
|
+
*
|
|
20
|
+
* return (
|
|
21
|
+
* <div>
|
|
22
|
+
* <LoginForm />
|
|
23
|
+
* {import.meta.env.DEV && (
|
|
24
|
+
* <IdSelector onLogin={handleLogin} infos={devAccounts} />
|
|
25
|
+
* )}
|
|
26
|
+
* </div>
|
|
27
|
+
* );
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Create React App 프로젝트
|
|
34
|
+
* {process.env.NODE_ENV === 'development' && (
|
|
35
|
+
* <IdSelector onLogin={handleLogin} infos={devAccounts} />
|
|
36
|
+
* )}
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export default function IdSelector({ onLogin, infos }) {
|
|
40
|
+
const [loading, setLoading] = useState(null);
|
|
41
|
+
const [hoveredIndex, setHoveredIndex] = useState(null);
|
|
42
|
+
const [hoveredButton, setHoveredButton] = useState(null);
|
|
43
|
+
const handleQuickLogin = async (info, index) => {
|
|
44
|
+
setLoading(index);
|
|
45
|
+
try {
|
|
46
|
+
await onLogin(info.id, info.pw);
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
setLoading(null);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const containerStyle = {
|
|
53
|
+
position: 'fixed',
|
|
54
|
+
top: '50%',
|
|
55
|
+
right: '16px',
|
|
56
|
+
transform: 'translateY(-50%)',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
flexDirection: 'column',
|
|
59
|
+
gap: '12px',
|
|
60
|
+
padding: '16px',
|
|
61
|
+
backgroundColor: '#ffffff',
|
|
62
|
+
borderRadius: '12px',
|
|
63
|
+
boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
|
|
64
|
+
border: '1px solid #e5e7eb',
|
|
65
|
+
minWidth: '280px',
|
|
66
|
+
zIndex: 9999,
|
|
67
|
+
};
|
|
68
|
+
const headerStyle = {
|
|
69
|
+
color: '#111827',
|
|
70
|
+
fontSize: '14px',
|
|
71
|
+
fontWeight: 'bold',
|
|
72
|
+
paddingBottom: '8px',
|
|
73
|
+
borderBottom: '1px solid #e5e7eb',
|
|
74
|
+
};
|
|
75
|
+
const getCardStyle = (index) => ({
|
|
76
|
+
display: 'flex',
|
|
77
|
+
flexDirection: 'column',
|
|
78
|
+
gap: '8px',
|
|
79
|
+
padding: '12px',
|
|
80
|
+
backgroundColor: '#f9fafb',
|
|
81
|
+
borderRadius: '8px',
|
|
82
|
+
border: hoveredIndex === index ? '1px solid #60a5fa' : '1px solid #e5e7eb',
|
|
83
|
+
transition: 'all 0.2s',
|
|
84
|
+
});
|
|
85
|
+
const getButtonStyle = (index) => ({
|
|
86
|
+
width: '100%',
|
|
87
|
+
padding: '8px 16px',
|
|
88
|
+
backgroundColor: loading === index ? '#9ca3af' : hoveredButton === index ? '#2563eb' : '#3b82f6',
|
|
89
|
+
color: 'white',
|
|
90
|
+
fontWeight: 600,
|
|
91
|
+
borderRadius: '8px',
|
|
92
|
+
border: 'none',
|
|
93
|
+
cursor: loading === index ? 'not-allowed' : 'pointer',
|
|
94
|
+
transition: 'background-color 0.2s',
|
|
95
|
+
});
|
|
96
|
+
const infoContainerStyle = {
|
|
97
|
+
display: 'flex',
|
|
98
|
+
flexDirection: 'column',
|
|
99
|
+
gap: '4px',
|
|
100
|
+
fontSize: '12px',
|
|
101
|
+
color: '#6b7280',
|
|
102
|
+
paddingLeft: '4px',
|
|
103
|
+
paddingRight: '4px',
|
|
104
|
+
};
|
|
105
|
+
const infoRowStyle = {
|
|
106
|
+
display: 'flex',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
gap: '8px',
|
|
109
|
+
};
|
|
110
|
+
const labelStyle = {
|
|
111
|
+
fontWeight: 600,
|
|
112
|
+
minWidth: '24px',
|
|
113
|
+
};
|
|
114
|
+
const valueStyle = {
|
|
115
|
+
fontFamily: 'monospace',
|
|
116
|
+
color: '#374151',
|
|
117
|
+
};
|
|
118
|
+
return (React.createElement("div", { style: containerStyle },
|
|
119
|
+
React.createElement("div", { style: headerStyle }, "\uD83D\uDE80 \uAC1C\uBC1C\uC6A9 \uBE60\uB978 \uB85C\uADF8\uC778"),
|
|
120
|
+
infos.map((info, index) => (React.createElement("div", { key: index, style: getCardStyle(index), onMouseEnter: () => setHoveredIndex(index), onMouseLeave: () => setHoveredIndex(null) },
|
|
121
|
+
React.createElement("button", { onClick: () => handleQuickLogin(info, index), disabled: loading === index, style: getButtonStyle(index), onMouseEnter: () => setHoveredButton(index), onMouseLeave: () => setHoveredButton(null) }, loading === index ? '로그인 중...' : info.memo),
|
|
122
|
+
React.createElement("div", { style: infoContainerStyle },
|
|
123
|
+
React.createElement("div", { style: infoRowStyle },
|
|
124
|
+
React.createElement("span", { style: labelStyle }, "ID"),
|
|
125
|
+
React.createElement("span", { style: valueStyle }, info.id)),
|
|
126
|
+
React.createElement("div", { style: infoRowStyle },
|
|
127
|
+
React.createElement("span", { style: labelStyle }, "PW"),
|
|
128
|
+
React.createElement("span", { style: valueStyle }, info.pw))))))));
|
|
129
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
3
|
+
type Props = {
|
|
4
|
+
/** 표시 위치 (기본값: 'bottom-right') */
|
|
5
|
+
position?: Position;
|
|
6
|
+
/** 커스텀 스타일 */
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 현재 윈도우 크기를 화면에 표시하는 개발용 컴포넌트
|
|
11
|
+
* 반응형 디버깅에 유용합니다.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // Vite 프로젝트
|
|
16
|
+
* import { WindowSizeDisplay } from 'goodchuck-utils/components/dev';
|
|
17
|
+
*
|
|
18
|
+
* function App() {
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* {import.meta.env.DEV && <WindowSizeDisplay />}
|
|
22
|
+
* </div>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // Create React App 프로젝트
|
|
30
|
+
* {process.env.NODE_ENV === 'development' && <WindowSizeDisplay />}
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // 커스텀 스타일 및 위치
|
|
36
|
+
* <WindowSizeDisplay
|
|
37
|
+
* position="top-left"
|
|
38
|
+
* style={{ backgroundColor: 'red', color: 'white' }}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export default function WindowSizeDisplay({ position, style }: Props): React.JSX.Element;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=WindowSizeDisplay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowSizeDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/dev/WindowSizeDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG7C,KAAK,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;AAE1E,KAAK,KAAK,GAAG;IACX,kCAAkC;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,cAAc;IACd,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,QAAyB,EAAE,KAAK,EAAE,EAAE,KAAK,qBAmCpF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useWindowSize } from '../../hooks/useWindowSize';
|
|
3
|
+
const positionStyles = {
|
|
4
|
+
'top-left': { top: 16, left: 16 },
|
|
5
|
+
'top-right': { top: 16, right: 16 },
|
|
6
|
+
'bottom-left': { bottom: 16, left: 16 },
|
|
7
|
+
'bottom-right': { bottom: 16, right: 16 },
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 현재 윈도우 크기를 화면에 표시하는 개발용 컴포넌트
|
|
11
|
+
* 반응형 디버깅에 유용합니다.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // Vite 프로젝트
|
|
16
|
+
* import { WindowSizeDisplay } from 'goodchuck-utils/components/dev';
|
|
17
|
+
*
|
|
18
|
+
* function App() {
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* {import.meta.env.DEV && <WindowSizeDisplay />}
|
|
22
|
+
* </div>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // Create React App 프로젝트
|
|
30
|
+
* {process.env.NODE_ENV === 'development' && <WindowSizeDisplay />}
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // 커스텀 스타일 및 위치
|
|
36
|
+
* <WindowSizeDisplay
|
|
37
|
+
* position="top-left"
|
|
38
|
+
* style={{ backgroundColor: 'red', color: 'white' }}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export default function WindowSizeDisplay({ position = 'bottom-right', style }) {
|
|
43
|
+
const { width, height } = useWindowSize();
|
|
44
|
+
const containerStyle = {
|
|
45
|
+
position: 'fixed',
|
|
46
|
+
...positionStyles[position],
|
|
47
|
+
padding: '8px 12px',
|
|
48
|
+
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
49
|
+
color: 'white',
|
|
50
|
+
fontSize: '14px',
|
|
51
|
+
fontFamily: 'monospace',
|
|
52
|
+
borderRadius: '8px',
|
|
53
|
+
boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1)',
|
|
54
|
+
zIndex: 9999,
|
|
55
|
+
backdropFilter: 'blur(4px)',
|
|
56
|
+
...style,
|
|
57
|
+
};
|
|
58
|
+
const innerStyle = {
|
|
59
|
+
display: 'flex',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
gap: '8px',
|
|
62
|
+
};
|
|
63
|
+
return (React.createElement("div", { style: containerStyle },
|
|
64
|
+
React.createElement("div", { style: innerStyle },
|
|
65
|
+
React.createElement("span", { style: { color: '#60a5fa' } }, "W:"),
|
|
66
|
+
React.createElement("span", { style: { fontWeight: 'bold' } },
|
|
67
|
+
width,
|
|
68
|
+
"px"),
|
|
69
|
+
React.createElement("span", { style: { color: '#9ca3af' } }, "\u00D7"),
|
|
70
|
+
React.createElement("span", { style: { color: '#4ade80' } }, "H:"),
|
|
71
|
+
React.createElement("span", { style: { fontWeight: 'bold' } },
|
|
72
|
+
height,
|
|
73
|
+
"px"))));
|
|
74
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/** 표시 위치 (기본값: 'bottom-left') */
|
|
4
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* z-index 값을 시각화하는 개발용 컴포넌트
|
|
8
|
+
* 페이지의 모든 요소의 z-index를 하이라이트하고 목록으로 표시합니다.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* // Vite 프로젝트
|
|
13
|
+
* import { ZIndexDebugger } from 'goodchuck-utils/components/dev';
|
|
14
|
+
*
|
|
15
|
+
* function App() {
|
|
16
|
+
* return (
|
|
17
|
+
* <div>
|
|
18
|
+
* {import.meta.env.DEV && <ZIndexDebugger />}
|
|
19
|
+
* </div>
|
|
20
|
+
* );
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // Create React App 프로젝트
|
|
27
|
+
* {process.env.NODE_ENV === 'development' && <ZIndexDebugger position="top-right" />}
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export default function ZIndexDebugger({ position }: Props): React.JSX.Element;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=ZIndexDebugger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZIndexDebugger.d.ts","sourceRoot":"","sources":["../../../src/components/dev/ZIndexDebugger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,KAAK,KAAK,GAAG;IACX,iCAAiC;IACjC,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;CACtE,CAAC;AAUF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,QAAwB,EAAE,EAAE,KAAK,qBAsNzE"}
|