@designbasekorea/ui-native 0.1.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 +152 -0
- package/dist/components/Alert/Alert.d.ts +29 -0
- package/dist/components/Alert/Alert.d.ts.map +1 -0
- package/dist/components/Alert/Alert.js +44 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/Alert/index.d.ts +3 -0
- package/dist/components/Alert/index.d.ts.map +1 -0
- package/dist/components/Alert/index.js +2 -0
- package/dist/components/Alert/index.js.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +28 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.js +73 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +3 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Avatar/index.js.map +1 -0
- package/dist/components/Badge/Badge.d.ts +28 -0
- package/dist/components/Badge/Badge.d.ts.map +1 -0
- package/dist/components/Badge/Badge.js +52 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Badge/index.d.ts.map +1 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Badge/index.js.map +1 -0
- package/dist/components/BottomNavigation/BottomNavigation.d.ts +30 -0
- package/dist/components/BottomNavigation/BottomNavigation.d.ts.map +1 -0
- package/dist/components/BottomNavigation/BottomNavigation.js +48 -0
- package/dist/components/BottomNavigation/BottomNavigation.js.map +1 -0
- package/dist/components/BottomNavigation/index.d.ts +3 -0
- package/dist/components/BottomNavigation/index.d.ts.map +1 -0
- package/dist/components/BottomNavigation/index.js +2 -0
- package/dist/components/BottomNavigation/index.js.map +1 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts +26 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheet.js +75 -0
- package/dist/components/BottomSheet/BottomSheet.js.map +1 -0
- package/dist/components/BottomSheet/index.d.ts +3 -0
- package/dist/components/BottomSheet/index.d.ts.map +1 -0
- package/dist/components/BottomSheet/index.js +2 -0
- package/dist/components/BottomSheet/index.js.map +1 -0
- package/dist/components/Button/Button.d.ts +53 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +129 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Card/Card.d.ts +36 -0
- package/dist/components/Card/Card.d.ts.map +1 -0
- package/dist/components/Card/Card.js +61 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/Card/index.d.ts.map +1 -0
- package/dist/components/Card/index.js +2 -0
- package/dist/components/Card/index.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +26 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.js +57 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Checkbox/index.js.map +1 -0
- package/dist/components/Chip/Chip.d.ts +29 -0
- package/dist/components/Chip/Chip.d.ts.map +1 -0
- package/dist/components/Chip/Chip.js +54 -0
- package/dist/components/Chip/Chip.js.map +1 -0
- package/dist/components/Chip/index.d.ts +3 -0
- package/dist/components/Chip/index.d.ts.map +1 -0
- package/dist/components/Chip/index.js +2 -0
- package/dist/components/Chip/index.js.map +1 -0
- package/dist/components/Divider/Divider.d.ts +22 -0
- package/dist/components/Divider/Divider.d.ts.map +1 -0
- package/dist/components/Divider/Divider.js +16 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/index.d.ts +3 -0
- package/dist/components/Divider/index.d.ts.map +1 -0
- package/dist/components/Divider/index.js +2 -0
- package/dist/components/Divider/index.js.map +1 -0
- package/dist/components/Input/Input.d.ts +33 -0
- package/dist/components/Input/Input.d.ts.map +1 -0
- package/dist/components/Input/Input.js +98 -0
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/Input/index.d.ts +3 -0
- package/dist/components/Input/index.d.ts.map +1 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Input/index.js.map +1 -0
- package/dist/components/Modal/Modal.d.ts +28 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -0
- package/dist/components/Modal/Modal.js +46 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/Modal/index.d.ts.map +1 -0
- package/dist/components/Modal/index.js +2 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Navbar/Navbar.d.ts +50 -0
- package/dist/components/Navbar/Navbar.d.ts.map +1 -0
- package/dist/components/Navbar/Navbar.js +125 -0
- package/dist/components/Navbar/Navbar.js.map +1 -0
- package/dist/components/Navbar/index.d.ts +3 -0
- package/dist/components/Navbar/index.d.ts.map +1 -0
- package/dist/components/Navbar/index.js +2 -0
- package/dist/components/Navbar/index.js.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +27 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.js +55 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/ProgressBar/index.d.ts +3 -0
- package/dist/components/ProgressBar/index.d.ts.map +1 -0
- package/dist/components/ProgressBar/index.js +2 -0
- package/dist/components/ProgressBar/index.js.map +1 -0
- package/dist/components/Radio/Radio.d.ts +30 -0
- package/dist/components/Radio/Radio.d.ts.map +1 -0
- package/dist/components/Radio/Radio.js +56 -0
- package/dist/components/Radio/Radio.js.map +1 -0
- package/dist/components/Radio/index.d.ts +3 -0
- package/dist/components/Radio/index.d.ts.map +1 -0
- package/dist/components/Radio/index.js +2 -0
- package/dist/components/Radio/index.js.map +1 -0
- package/dist/components/SearchBar/SearchBar.d.ts +29 -0
- package/dist/components/SearchBar/SearchBar.d.ts.map +1 -0
- package/dist/components/SearchBar/SearchBar.js +64 -0
- package/dist/components/SearchBar/SearchBar.js.map +1 -0
- package/dist/components/SearchBar/index.d.ts +3 -0
- package/dist/components/SearchBar/index.d.ts.map +1 -0
- package/dist/components/SearchBar/index.js +2 -0
- package/dist/components/SearchBar/index.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +22 -0
- package/dist/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton/Skeleton.js +46 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Skeleton/index.d.ts +3 -0
- package/dist/components/Skeleton/index.d.ts.map +1 -0
- package/dist/components/Skeleton/index.js +2 -0
- package/dist/components/Skeleton/index.js.map +1 -0
- package/dist/components/Spinner/Spinner.d.ts +23 -0
- package/dist/components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.js +19 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/index.d.ts +3 -0
- package/dist/components/Spinner/index.d.ts.map +1 -0
- package/dist/components/Spinner/index.js +2 -0
- package/dist/components/Spinner/index.js.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +30 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +73 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/index.d.ts +3 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tabs/index.js.map +1 -0
- package/dist/components/Toast/Toast.d.ts +30 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -0
- package/dist/components/Toast/Toast.js +84 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/index.d.ts +3 -0
- package/dist/components/Toast/index.d.ts.map +1 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Toast/index.js.map +1 -0
- package/dist/components/Toggle/Toggle.d.ts +26 -0
- package/dist/components/Toggle/Toggle.d.ts.map +1 -0
- package/dist/components/Toggle/Toggle.js +75 -0
- package/dist/components/Toggle/Toggle.js.map +1 -0
- package/dist/components/Toggle/index.d.ts +3 -0
- package/dist/components/Toggle/index.d.ts.map +1 -0
- package/dist/components/Toggle/index.js +2 -0
- package/dist/components/Toggle/index.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +35 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +45 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/tokens.d.ts +55 -0
- package/dist/theme/tokens.d.ts.map +1 -0
- package/dist/theme/tokens.js +172 -0
- package/dist/theme/tokens.js.map +1 -0
- package/dist/theme/useTheme.d.ts +25 -0
- package/dist/theme/useTheme.d.ts.map +1 -0
- package/dist/theme/useTheme.js +33 -0
- package/dist/theme/useTheme.js.map +1 -0
- package/package.json +58 -0
- package/src/components/Alert/Alert.tsx +105 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/Avatar/Avatar.tsx +122 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Badge/Badge.tsx +100 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/BottomNavigation/BottomNavigation.tsx +104 -0
- package/src/components/BottomNavigation/index.ts +2 -0
- package/src/components/BottomSheet/BottomSheet.tsx +127 -0
- package/src/components/BottomSheet/index.ts +2 -0
- package/src/components/Button/Button.tsx +255 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Card/Card.tsx +147 -0
- package/src/components/Card/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.tsx +95 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Chip/Chip.tsx +108 -0
- package/src/components/Chip/index.ts +2 -0
- package/src/components/Divider/Divider.tsx +41 -0
- package/src/components/Divider/index.ts +2 -0
- package/src/components/Input/Input.tsx +199 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/Modal/Modal.tsx +117 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Navbar/Navbar.tsx +278 -0
- package/src/components/Navbar/index.ts +2 -0
- package/src/components/ProgressBar/ProgressBar.tsx +99 -0
- package/src/components/ProgressBar/index.ts +2 -0
- package/src/components/Radio/Radio.tsx +103 -0
- package/src/components/Radio/index.ts +2 -0
- package/src/components/SearchBar/SearchBar.tsx +115 -0
- package/src/components/SearchBar/index.ts +2 -0
- package/src/components/Skeleton/Skeleton.tsx +74 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/Spinner/Spinner.tsx +58 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Tabs/Tabs.tsx +124 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/Toast/Toast.tsx +128 -0
- package/src/components/Toast/index.ts +2 -0
- package/src/components/Toggle/Toggle.tsx +109 -0
- package/src/components/Toggle/index.ts +2 -0
- package/src/index.ts +87 -0
- package/src/theme/ThemeProvider.tsx +96 -0
- package/src/theme/index.ts +5 -0
- package/src/theme/tokens.ts +225 -0
- package/src/theme/useTheme.ts +37 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ThemeProvider 컴포넌트
|
|
3
|
+
*
|
|
4
|
+
* 목적: React Context 기반 테마 제공 (웹의 CSS 변수 + data-theme 대체)
|
|
5
|
+
* 기능: Light/Dark 테마, 시스템 다크모드 자동 감지, 토큰 자동 연결
|
|
6
|
+
* 사용법: <ThemeProvider theme="auto"><App /></ThemeProvider>
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type { DesignbaseThemeTokens } from './tokens';
|
|
10
|
+
export type ThemeMode = 'light' | 'dark' | 'auto';
|
|
11
|
+
export interface ThemeContextValue {
|
|
12
|
+
/** 파싱된 테마 토큰 (semantic, aliases, foundation 구조) */
|
|
13
|
+
theme: DesignbaseThemeTokens;
|
|
14
|
+
/** 원본 토큰 트리에서 점(.) 경로로 값 가져오기 */
|
|
15
|
+
token: (path: string) => any;
|
|
16
|
+
/** 현재 테마 모드 */
|
|
17
|
+
mode: ThemeMode;
|
|
18
|
+
/** 실제 적용된 테마 (auto 해석 후) */
|
|
19
|
+
resolvedMode: 'light' | 'dark';
|
|
20
|
+
/** 테마 모드 변경 */
|
|
21
|
+
setMode: (mode: ThemeMode) => void;
|
|
22
|
+
/** 라이트/다크 토글 */
|
|
23
|
+
toggleTheme: () => void;
|
|
24
|
+
/** 다크모드 여부 */
|
|
25
|
+
isDark: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const ThemeContext: React.Context<ThemeContextValue | undefined>;
|
|
28
|
+
export interface ThemeProviderProps {
|
|
29
|
+
/** 초기 테마 모드 ('light' | 'dark' | 'auto') */
|
|
30
|
+
theme?: ThemeMode;
|
|
31
|
+
/** 자식 컴포넌트 */
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
35
|
+
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAwD,MAAM,OAAO,CAAC;AAG7E,OAAO,KAAK,EAAE,qBAAqB,EAAgB,MAAM,UAAU,CAAC;AAEpE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAC9B,mDAAmD;IACnD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,iCAAiC;IACjC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAC;IAC7B,eAAe;IACf,IAAI,EAAE,SAAS,CAAC;IAChB,4BAA4B;IAC5B,YAAY,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/B,eAAe;IACf,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACnC,gBAAgB;IAChB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,cAAc;IACd,MAAM,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,8CAA0D,CAAC;AAEpF,MAAM,WAAW,kBAAkB;IAC/B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,cAAc;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoDtD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ThemeProvider 컴포넌트
|
|
4
|
+
*
|
|
5
|
+
* 목적: React Context 기반 테마 제공 (웹의 CSS 변수 + data-theme 대체)
|
|
6
|
+
* 기능: Light/Dark 테마, 시스템 다크모드 자동 감지, 토큰 자동 연결
|
|
7
|
+
* 사용법: <ThemeProvider theme="auto"><App /></ThemeProvider>
|
|
8
|
+
*/
|
|
9
|
+
import { createContext, useMemo, useState, useCallback } from 'react';
|
|
10
|
+
import { useColorScheme } from 'react-native';
|
|
11
|
+
import { lightTheme, darkTheme, getTokenValue } from './tokens';
|
|
12
|
+
export const ThemeContext = createContext(undefined);
|
|
13
|
+
export const ThemeProvider = ({ theme: initialMode = 'auto', children, }) => {
|
|
14
|
+
const systemColorScheme = useColorScheme();
|
|
15
|
+
const [mode, setMode] = useState(initialMode);
|
|
16
|
+
const resolvedMode = useMemo(() => {
|
|
17
|
+
if (mode === 'auto') {
|
|
18
|
+
return systemColorScheme === 'dark' ? 'dark' : 'light';
|
|
19
|
+
}
|
|
20
|
+
return mode;
|
|
21
|
+
}, [mode, systemColorScheme]);
|
|
22
|
+
const currentTheme = useMemo(() => (resolvedMode === 'dark' ? darkTheme : lightTheme), [resolvedMode]);
|
|
23
|
+
const toggleTheme = useCallback(() => {
|
|
24
|
+
setMode((prev) => {
|
|
25
|
+
if (prev === 'auto') {
|
|
26
|
+
return systemColorScheme === 'dark' ? 'light' : 'dark';
|
|
27
|
+
}
|
|
28
|
+
return prev === 'light' ? 'dark' : 'light';
|
|
29
|
+
});
|
|
30
|
+
}, [systemColorScheme]);
|
|
31
|
+
/** 점(.) 경로로 원본 토큰 값을 가져오는 헬퍼 */
|
|
32
|
+
const token = useCallback((path) => getTokenValue(currentTheme.raw, path), [currentTheme]);
|
|
33
|
+
const value = useMemo(() => ({
|
|
34
|
+
theme: currentTheme,
|
|
35
|
+
token,
|
|
36
|
+
mode,
|
|
37
|
+
resolvedMode,
|
|
38
|
+
setMode,
|
|
39
|
+
toggleTheme,
|
|
40
|
+
isDark: resolvedMode === 'dark',
|
|
41
|
+
}), [currentTheme, token, mode, resolvedMode, toggleTheme]);
|
|
42
|
+
return (_jsx(ThemeContext.Provider, { value: value, children: children }));
|
|
43
|
+
};
|
|
44
|
+
ThemeProvider.displayName = 'ThemeProvider';
|
|
45
|
+
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,OAAc,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAA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AC,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,gCAAgC;IAChC,MAAM,KAAK,GAAG,WAAW,CACrB,CAAC,IAAY,EAAE,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,EACvD,CAAC,YAAY,CAAC,CACjB,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CACjB,GAAG,EAAE,CAAC,CAAC;QACH,KAAK,EAAE,YAAY;QACnB,KAAK;QACL,IAAI;QACJ,YAAY;QACZ,OAAO;QACP,WAAW;QACX,MAAM,EAAE,YAAY,KAAK,MAAM;KAClC,CAAC,EACF,CAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,CAAC,CACzD,CAAC;IAEF,OAAO,CACH,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC9B,QAAQ,GACW,CAC3B,CAAC;AACN,CAAC,CAAC;AAEF,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ThemeProvider } from './ThemeProvider';
|
|
2
|
+
export type { ThemeProviderProps, ThemeMode, ThemeContextValue } from './ThemeProvider';
|
|
3
|
+
export { useTheme } from './useTheme';
|
|
4
|
+
export { lightTheme, darkTheme, getTokenValue } from './tokens';
|
|
5
|
+
export type { DesignbaseThemeTokens, NativeTokens } from './tokens';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Designbase Native 디자인 토큰
|
|
3
|
+
*
|
|
4
|
+
* 목적: @designbasekorea/tokens 패키지에서 빌드된 JSON을 RN에 맞게 구조화
|
|
5
|
+
* 파이프라인: tokens/JSON → Style Dictionary → dist/native/*.json → 이 파일에서 import
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ 이 파일은 자동생성된 JSON 기반입니다.
|
|
8
|
+
* 토큰 값을 변경하려면 packages/tokens/tokens/ 의 JSON을 수정한 뒤
|
|
9
|
+
* `cd packages/tokens && npm run build:native` 를 실행하세요.
|
|
10
|
+
*/
|
|
11
|
+
/** 중첩 구조의 RN 토큰 (Style Dictionary nested JSON 출력과 동일) */
|
|
12
|
+
export type NativeTokens = Record<string, any>;
|
|
13
|
+
export interface DesignbaseThemeTokens {
|
|
14
|
+
/** 원본 토큰 트리 (자동빌드된 전체) */
|
|
15
|
+
raw: NativeTokens;
|
|
16
|
+
/** 색상 (semantic 레벨) */
|
|
17
|
+
color: {
|
|
18
|
+
semantic: NativeTokens;
|
|
19
|
+
aliases: NativeTokens;
|
|
20
|
+
foundation: NativeTokens;
|
|
21
|
+
};
|
|
22
|
+
/** 간격 (semantic 레벨) */
|
|
23
|
+
spacing: {
|
|
24
|
+
semantic: NativeTokens;
|
|
25
|
+
aliases: NativeTokens;
|
|
26
|
+
foundation: NativeTokens;
|
|
27
|
+
};
|
|
28
|
+
/** 보더 (semantic 레벨) */
|
|
29
|
+
border: {
|
|
30
|
+
semantic: NativeTokens;
|
|
31
|
+
aliases: NativeTokens;
|
|
32
|
+
foundation: NativeTokens;
|
|
33
|
+
};
|
|
34
|
+
/** 그림자 */
|
|
35
|
+
shadow: NativeTokens;
|
|
36
|
+
/** 사이즈 (semantic 레벨) */
|
|
37
|
+
size: {
|
|
38
|
+
semantic: NativeTokens;
|
|
39
|
+
aliases: NativeTokens;
|
|
40
|
+
foundation: NativeTokens;
|
|
41
|
+
};
|
|
42
|
+
/** 타이포그래피 */
|
|
43
|
+
typography: NativeTokens;
|
|
44
|
+
/** 투명도 */
|
|
45
|
+
opacity: NativeTokens;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 빌드된 JSON에서 특정 경로의 값을 안전하게 가져오기
|
|
49
|
+
*/
|
|
50
|
+
export declare function getTokenValue(tokens: NativeTokens, path: string): any;
|
|
51
|
+
/** Light 테마 토큰 (빌드된 JSON 우선, 없으면 폴백) */
|
|
52
|
+
export declare const lightTheme: DesignbaseThemeTokens;
|
|
53
|
+
/** Dark 테마 토큰 (빌드된 JSON 우선, 없으면 폴백) */
|
|
54
|
+
export declare const darkTheme: DesignbaseThemeTokens;
|
|
55
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IAClC,0BAA0B;IAC1B,GAAG,EAAE,YAAY,CAAC;IAClB,uBAAuB;IACvB,KAAK,EAAE;QACH,QAAQ,EAAE,YAAY,CAAC;QACvB,OAAO,EAAE,YAAY,CAAC;QACtB,UAAU,EAAE,YAAY,CAAC;KAC5B,CAAC;IACF,uBAAuB;IACvB,OAAO,EAAE;QACL,QAAQ,EAAE,YAAY,CAAC;QACvB,OAAO,EAAE,YAAY,CAAC;QACtB,UAAU,EAAE,YAAY,CAAC;KAC5B,CAAC;IACF,uBAAuB;IACvB,MAAM,EAAE;QACJ,QAAQ,EAAE,YAAY,CAAC;QACvB,OAAO,EAAE,YAAY,CAAC;QACtB,UAAU,EAAE,YAAY,CAAC;KAC5B,CAAC;IACF,UAAU;IACV,MAAM,EAAE,YAAY,CAAC;IACrB,wBAAwB;IACxB,IAAI,EAAE;QACF,QAAQ,EAAE,YAAY,CAAC;QACvB,OAAO,EAAE,YAAY,CAAC;QACtB,UAAU,EAAE,YAAY,CAAC;KAC5B,CAAC;IACF,aAAa;IACb,UAAU,EAAE,YAAY,CAAC;IACzB,UAAU;IACV,OAAO,EAAE,YAAY,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAErE;AA4JD,wCAAwC;AACxC,eAAO,MAAM,UAAU,EAAE,qBAExB,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,SAAS,EAAE,qBAEvB,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Designbase Native 디자인 토큰
|
|
3
|
+
*
|
|
4
|
+
* 목적: @designbasekorea/tokens 패키지에서 빌드된 JSON을 RN에 맞게 구조화
|
|
5
|
+
* 파이프라인: tokens/JSON → Style Dictionary → dist/native/*.json → 이 파일에서 import
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ 이 파일은 자동생성된 JSON 기반입니다.
|
|
8
|
+
* 토큰 값을 변경하려면 packages/tokens/tokens/ 의 JSON을 수정한 뒤
|
|
9
|
+
* `cd packages/tokens && npm run build:native` 를 실행하세요.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* 빌드된 JSON에서 특정 경로의 값을 안전하게 가져오기
|
|
13
|
+
*/
|
|
14
|
+
export function getTokenValue(tokens, path) {
|
|
15
|
+
return path.split('.').reduce((obj, key) => obj?.[key], tokens);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 빌드된 JSON 트리를 DesignbaseThemeTokens로 파싱
|
|
19
|
+
*/
|
|
20
|
+
function parseTokenTree(raw) {
|
|
21
|
+
return {
|
|
22
|
+
raw,
|
|
23
|
+
color: {
|
|
24
|
+
semantic: raw?.color?.semantic ?? {},
|
|
25
|
+
aliases: raw?.color?.aliases ?? {},
|
|
26
|
+
foundation: raw?.color?.foundation ?? {},
|
|
27
|
+
},
|
|
28
|
+
spacing: {
|
|
29
|
+
semantic: raw?.spacing?.semantic ?? {},
|
|
30
|
+
aliases: raw?.spacing?.aliases ?? {},
|
|
31
|
+
foundation: raw?.spacing?.foundation ?? {},
|
|
32
|
+
},
|
|
33
|
+
border: {
|
|
34
|
+
semantic: raw?.border?.semantic ?? {},
|
|
35
|
+
aliases: raw?.border?.aliases ?? {},
|
|
36
|
+
foundation: raw?.border?.foundation ?? {},
|
|
37
|
+
},
|
|
38
|
+
shadow: raw?.shadow ?? {},
|
|
39
|
+
size: {
|
|
40
|
+
semantic: raw?.size?.semantic ?? {},
|
|
41
|
+
aliases: raw?.size?.aliases ?? {},
|
|
42
|
+
foundation: raw?.size?.foundation ?? {},
|
|
43
|
+
},
|
|
44
|
+
typography: raw?.typography ?? {},
|
|
45
|
+
opacity: raw?.opacity ?? {},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// ─── 폴백용 하드코딩 (빌드 전 개발용) ───
|
|
49
|
+
const FALLBACK_LIGHT = {
|
|
50
|
+
color: {
|
|
51
|
+
foundation: {
|
|
52
|
+
blue: { 600: '#0683FF', 700: '#006FFF', 800: '#0855C5', 900: '#0D4B9B' },
|
|
53
|
+
neutral: {
|
|
54
|
+
0: '#FFFFFF', white: '#FFFFFF', 50: '#F8FAFC', 100: '#F2F8FC',
|
|
55
|
+
200: '#E8EEF2', 300: '#BBC5CC', 400: '#A4ADB2', 500: '#8C9499',
|
|
56
|
+
600: '#757B80', 700: '#5E6366', 800: '#464A4D', 900: '#2F3133',
|
|
57
|
+
1000: '#17191A', 1100: '#000000',
|
|
58
|
+
},
|
|
59
|
+
red: { 50: '#FEF2F2', 100: '#FEE2E2', 500: '#EF4444', 600: '#DC2626' },
|
|
60
|
+
green: { 50: '#F0FDF5', 600: '#16A34A' },
|
|
61
|
+
yellow: { 50: '#FFFFE7', 600: '#D1B400' },
|
|
62
|
+
},
|
|
63
|
+
aliases: {
|
|
64
|
+
brand: { primary: '#006FFF' },
|
|
65
|
+
text: {
|
|
66
|
+
primary: '#17191A', secondary: '#464A4D', tertiary: '#757B80',
|
|
67
|
+
disabled: '#A4ADB2', link: '#006FFF', 'inverse-primary': '#FFFFFF',
|
|
68
|
+
},
|
|
69
|
+
surface: {
|
|
70
|
+
base: '#FFFFFF', 'layer-1': '#F2F8FC', 'layer-2': '#E8EEF2',
|
|
71
|
+
'layer-3': '#BBC5CC', muted: '#E8EEF2',
|
|
72
|
+
},
|
|
73
|
+
border: { base: '#E8EEF2', 'layer-1': '#BBC5CC', muted: '#F2F8FC' },
|
|
74
|
+
feedback: {
|
|
75
|
+
success: { fg: '#16A34A', bg: '#F0FDF5' },
|
|
76
|
+
warning: { fg: '#D1B400', bg: '#FFFFE7' },
|
|
77
|
+
error: { fg: '#DC2626', bg: '#FEF2F2' },
|
|
78
|
+
info: { fg: '#0683FF', bg: '#EDF9FF' },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
semantic: {
|
|
82
|
+
button: {
|
|
83
|
+
primary: {
|
|
84
|
+
'bg-default': '#006FFF', 'bg-hover': '#0855C5', 'bg-active': '#0D4B9B',
|
|
85
|
+
'text-default': '#FFFFFF', 'border-default': '#006FFF',
|
|
86
|
+
},
|
|
87
|
+
secondary: {
|
|
88
|
+
'bg-default': '#F2F8FC', 'bg-hover': '#E8EEF2',
|
|
89
|
+
'text-default': '#006FFF', 'border-default': '#E8EEF2',
|
|
90
|
+
},
|
|
91
|
+
tertiary: {
|
|
92
|
+
'bg-default': '#FFFFFF', 'bg-hover': '#F2F8FC',
|
|
93
|
+
'text-default': '#17191A', 'border-default': '#E8EEF2',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
field: {
|
|
97
|
+
input: {
|
|
98
|
+
'bg-default': '#FFFFFF', 'bg-disabled': '#E8EEF2',
|
|
99
|
+
'border-default': '#E8EEF2', 'border-focus': '#006FFF',
|
|
100
|
+
'border-error': '#DC2626', 'text-default': '#17191A',
|
|
101
|
+
'text-disabled': '#A4ADB2', placeholder: '#757B80',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
spacing: {
|
|
107
|
+
foundation: { 0: 0, '05': 2, 1: 4, 2: 8, 3: 12, 4: 16, 5: 20, 6: 24, 8: 32, 10: 40, 12: 48 },
|
|
108
|
+
aliases: {
|
|
109
|
+
scale: { xxs: 2, xs: 4, s: 8, m: 12, l: 20, xl: 32, '2xl': 40 },
|
|
110
|
+
padding: { xxs: 2, xs: 4, s: 8, m: 12, l: 20, xl: 32, '2xl': 40 },
|
|
111
|
+
gap: { xxs: 2, xs: 4, s: 8, m: 12, l: 20, xl: 32, '2xl': 40 },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
border: {
|
|
115
|
+
foundation: {
|
|
116
|
+
radius: { 0: 0, 1: 2, 2: 4, 3: 6, 4: 8, 5: 12, 6: 16, 7: 24, full: 9999 },
|
|
117
|
+
width: { 0: 0, 1: 0.5, 2: 1, 3: 2, 4: 4 },
|
|
118
|
+
},
|
|
119
|
+
semantic: {
|
|
120
|
+
radius: {
|
|
121
|
+
s: 4, m: 8, l: 12, xl: 16, '2xl': 24, full: 9999,
|
|
122
|
+
button: { s: 4, m: 8, l: 12, pill: 9999 },
|
|
123
|
+
input: { s: 4, m: 8, l: 12 },
|
|
124
|
+
card: { s: 4, m: 8, l: 12 },
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
shadow: {
|
|
129
|
+
foundation: {
|
|
130
|
+
s: { shadowColor: 'rgba(0, 0, 0, 0.05)', shadowOffsetX: 0, shadowOffsetY: 1, shadowOpacity: 1, shadowRadius: 2, elevation: 1 },
|
|
131
|
+
m: { shadowColor: 'rgba(0, 0, 0, 0.1)', shadowOffsetX: 0, shadowOffsetY: 4, shadowOpacity: 1, shadowRadius: 6, elevation: 3 },
|
|
132
|
+
l: { shadowColor: 'rgba(0, 0, 0, 0.1)', shadowOffsetX: 0, shadowOffsetY: 10, shadowOpacity: 1, shadowRadius: 15, elevation: 8 },
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
size: {
|
|
136
|
+
semantic: {
|
|
137
|
+
button: { s: 24, m: 32, l: 40 },
|
|
138
|
+
input: { s: 24, m: 32, l: 40 },
|
|
139
|
+
icon: { xs: 12, s: 16, m: 20, l: 24, xl: 32 },
|
|
140
|
+
avatar: { xs: 16, s: 20, m: 24, l: 32, xl: 40, '2xl': 48 },
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
typography: {
|
|
144
|
+
foundation: {
|
|
145
|
+
fontSize: { xs: 12, s: 14, base: 16, l: 18, xl: 20, '2xl': 24, '3xl': 30, '4xl': 36 },
|
|
146
|
+
fontWeight: { light: '300', normal: '400', medium: '500', semibold: '600', bold: '700' },
|
|
147
|
+
lineHeight: { tight: 1.25, snug: 1.375, normal: 1.5, relaxed: 1.625 },
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
opacity: {
|
|
151
|
+
foundation: { 0: 0, 5: 0.05, 10: 0.1, 25: 0.25, 40: 0.4, 50: 0.5, 75: 0.75, 100: 1 },
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
// ─── 토큰 로드 (빌드된 JSON > 폴백) ───
|
|
155
|
+
let builtLightTokens = null;
|
|
156
|
+
let builtDarkTokens = null;
|
|
157
|
+
try {
|
|
158
|
+
// @ts-ignore — JSON 파일, 빌드 전에는 없을 수 있음
|
|
159
|
+
builtLightTokens = require('@designbasekorea/tokens/native/light');
|
|
160
|
+
}
|
|
161
|
+
catch { /* 폴백 사용 */ }
|
|
162
|
+
try {
|
|
163
|
+
// @ts-ignore
|
|
164
|
+
builtDarkTokens = require('@designbasekorea/tokens/native/dark');
|
|
165
|
+
}
|
|
166
|
+
catch { /* 폴백 사용 */ }
|
|
167
|
+
/** Light 테마 토큰 (빌드된 JSON 우선, 없으면 폴백) */
|
|
168
|
+
export const lightTheme = parseTokenTree(builtLightTokens ?? FALLBACK_LIGHT);
|
|
169
|
+
/** Dark 테마 토큰 (빌드된 JSON 우선, 없으면 폴백) */
|
|
170
|
+
export const darkTheme = parseTokenTree(builtDarkTokens ?? FALLBACK_LIGHT // dark 폴백도 light 사용 (빌드 후 정상)
|
|
171
|
+
);
|
|
172
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA8CH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAoB,EAAE,IAAY;IAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,GAAiB;IACrC,OAAO;QACH,GAAG;QACH,KAAK,EAAE;YACH,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,IAAI,EAAE;YACpC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,IAAI,EAAE;YAClC,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CACrC,CAAC;AAEF,uCAAuC;AACvC,MAAM,CAAC,MAAM,SAAS,GAA0B,cAAc,CAC1D,eAAe,IAAI,cAAc,CAAC,8BAA8B;CACnE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useTheme 훅
|
|
3
|
+
*
|
|
4
|
+
* 목적: ThemeProvider에서 제공하는 테마 토큰에 쉽게 접근
|
|
5
|
+
* 사용법: const { theme, token, isDark, toggleTheme } = useTheme();
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const { theme, token, isDark, toggleTheme } = useTheme();
|
|
10
|
+
*
|
|
11
|
+
* // 구조적 접근
|
|
12
|
+
* <View style={{ backgroundColor: theme.color.aliases.surface.base }}>
|
|
13
|
+
* <Text style={{ color: theme.color.aliases.text.primary }}>
|
|
14
|
+
* {isDark ? '다크 모드' : '라이트 모드'}
|
|
15
|
+
* </Text>
|
|
16
|
+
* </View>
|
|
17
|
+
*
|
|
18
|
+
* // 점(.) 경로 접근
|
|
19
|
+
* const bg = token('color.aliases.surface.base');
|
|
20
|
+
* const brandColor = token('color.aliases.brand.primary');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import type { ThemeContextValue } from './ThemeProvider';
|
|
24
|
+
export declare function useTheme(): ThemeContextValue;
|
|
25
|
+
//# sourceMappingURL=useTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/theme/useTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,wBAAgB,QAAQ,IAAI,iBAAiB,CAS5C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useTheme 훅
|
|
3
|
+
*
|
|
4
|
+
* 목적: ThemeProvider에서 제공하는 테마 토큰에 쉽게 접근
|
|
5
|
+
* 사용법: const { theme, token, isDark, toggleTheme } = useTheme();
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const { theme, token, isDark, toggleTheme } = useTheme();
|
|
10
|
+
*
|
|
11
|
+
* // 구조적 접근
|
|
12
|
+
* <View style={{ backgroundColor: theme.color.aliases.surface.base }}>
|
|
13
|
+
* <Text style={{ color: theme.color.aliases.text.primary }}>
|
|
14
|
+
* {isDark ? '다크 모드' : '라이트 모드'}
|
|
15
|
+
* </Text>
|
|
16
|
+
* </View>
|
|
17
|
+
*
|
|
18
|
+
* // 점(.) 경로 접근
|
|
19
|
+
* const bg = token('color.aliases.surface.base');
|
|
20
|
+
* const brandColor = token('color.aliases.brand.primary');
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { useContext } from 'react';
|
|
24
|
+
import { ThemeContext } from './ThemeProvider';
|
|
25
|
+
export function useTheme() {
|
|
26
|
+
const context = useContext(ThemeContext);
|
|
27
|
+
if (!context) {
|
|
28
|
+
throw new Error('useTheme must be used within a <ThemeProvider>. ' +
|
|
29
|
+
'Wrap your app with <ThemeProvider> first.');
|
|
30
|
+
}
|
|
31
|
+
return context;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=useTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../../src/theme/useTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,UAAU,QAAQ;IACpB,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACX,kDAAkD;YAClD,2CAA2C,CAC9C,CAAC;IACN,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@designbasekorea/ui-native",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Designbase React Native UI 컴포넌트 라이브러리 - 앱 개발에 최적화된 네이티브 컴포넌트",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"react-native": "src/index.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"react-native": "./src/index.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.js",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"src"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "rimraf dist && tsc",
|
|
25
|
+
"prepublishOnly": "npm run build",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
28
|
+
"clean": "rimraf dist"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@designbasekorea/icons": "^0.3.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": ">=18.0.0",
|
|
35
|
+
"react-native": ">=0.72.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/react": "^19.2.7",
|
|
39
|
+
"@types/react-native": "^0.73.0",
|
|
40
|
+
"typescript": "^5.2.2",
|
|
41
|
+
"rimraf": "^5.0.1"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/designbasekorea/Designbase-Library.git",
|
|
49
|
+
"directory": "packages/ui-native"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"react-native",
|
|
53
|
+
"ui",
|
|
54
|
+
"components",
|
|
55
|
+
"designbase",
|
|
56
|
+
"mobile"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alert 컴포넌트 (React Native)
|
|
3
|
+
*
|
|
4
|
+
* 스타일링 토큰 경로:
|
|
5
|
+
* - 색상: theme.color.aliases.feedback.{success|warning|error|info}.{fg|bg}
|
|
6
|
+
* - 텍스트: theme.color.aliases.text.{primary|tertiary}
|
|
7
|
+
* - 라운드: theme.border.semantic.radius.m
|
|
8
|
+
* - 패딩: theme.spacing.aliases.padding.m
|
|
9
|
+
* - 폰트: theme.typography.foundation.fontSize.{xs|s}
|
|
10
|
+
*
|
|
11
|
+
* 원본: packages/ui/src/components/Alert/Alert.tsx
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { View, Text, Pressable, StyleSheet, type ViewStyle } from 'react-native';
|
|
16
|
+
import { useTheme } from '../../theme/useTheme';
|
|
17
|
+
|
|
18
|
+
export type AlertVariant = 'success' | 'warning' | 'error' | 'info';
|
|
19
|
+
|
|
20
|
+
export interface AlertProps {
|
|
21
|
+
variant?: AlertVariant;
|
|
22
|
+
title?: string;
|
|
23
|
+
message: string;
|
|
24
|
+
icon?: React.ReactNode;
|
|
25
|
+
closable?: boolean;
|
|
26
|
+
onClose?: () => void;
|
|
27
|
+
actionLabel?: string;
|
|
28
|
+
onAction?: () => void;
|
|
29
|
+
style?: ViewStyle;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const VARIANT_ICONS: Record<AlertVariant, string> = {
|
|
33
|
+
success: '✓', warning: '⚠', error: '✕', info: 'ℹ',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Alert: React.FC<AlertProps> = ({
|
|
37
|
+
variant = 'info', title, message, icon, closable = false,
|
|
38
|
+
onClose, actionLabel, onAction, style,
|
|
39
|
+
}) => {
|
|
40
|
+
const { theme } = useTheme();
|
|
41
|
+
|
|
42
|
+
// ─── 토큰에서 가져오기 ───
|
|
43
|
+
const feedback = theme.color.aliases?.feedback ?? {};
|
|
44
|
+
const text = theme.color.aliases?.text ?? {};
|
|
45
|
+
const padding = theme.spacing.aliases?.padding ?? {};
|
|
46
|
+
const fontSize = theme.typography.foundation?.fontSize ?? {};
|
|
47
|
+
const borderRadius = theme.border.semantic?.radius?.m ?? 8;
|
|
48
|
+
const gap = theme.spacing.aliases?.gap ?? {};
|
|
49
|
+
|
|
50
|
+
const variantMap: Record<AlertVariant, 'success' | 'warning' | 'error' | 'info'> = {
|
|
51
|
+
success: 'success', warning: 'warning', error: 'error', info: 'info',
|
|
52
|
+
};
|
|
53
|
+
const feedbackKey = variantMap[variant];
|
|
54
|
+
const bgColor = feedback[feedbackKey]?.bg ?? '#EDF9FF';
|
|
55
|
+
const fgColor = feedback[feedbackKey]?.fg ?? '#0683FF';
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<View style={[
|
|
59
|
+
styles.container,
|
|
60
|
+
{
|
|
61
|
+
backgroundColor: bgColor, borderRadius,
|
|
62
|
+
borderLeftWidth: 4, borderLeftColor: fgColor,
|
|
63
|
+
padding: padding.m ?? 12,
|
|
64
|
+
},
|
|
65
|
+
style,
|
|
66
|
+
]} accessibilityRole="alert">
|
|
67
|
+
<View style={[styles.content, { gap: gap.m ?? 12 }]}>
|
|
68
|
+
<View style={styles.iconContainer}>
|
|
69
|
+
{icon || <Text style={[styles.defaultIcon, { color: fgColor }]}>{VARIANT_ICONS[variant]}</Text>}
|
|
70
|
+
</View>
|
|
71
|
+
|
|
72
|
+
<View style={[styles.textContainer, { gap: gap.xxs ?? 2 }]}>
|
|
73
|
+
{title && <Text style={[styles.title, { color: fgColor, fontSize: fontSize.s ?? 14 }]}>{title}</Text>}
|
|
74
|
+
<Text style={[styles.message, { color: text.primary ?? '#17191A', fontSize: fontSize.s ?? 14 }]}>{message}</Text>
|
|
75
|
+
{actionLabel && onAction && (
|
|
76
|
+
<Pressable onPress={onAction} style={{ marginTop: padding.xxs ?? 2 }}>
|
|
77
|
+
<Text style={{ color: fgColor, fontSize: fontSize.xs ?? 12, fontWeight: '600' }}>{actionLabel}</Text>
|
|
78
|
+
</Pressable>
|
|
79
|
+
)}
|
|
80
|
+
</View>
|
|
81
|
+
|
|
82
|
+
{closable && (
|
|
83
|
+
<Pressable onPress={onClose} hitSlop={8} accessibilityRole="button" accessibilityLabel="닫기" style={styles.closeButton}>
|
|
84
|
+
<Text style={{ fontSize: fontSize.s ?? 14, color: text.tertiary ?? '#757B80' }}>✕</Text>
|
|
85
|
+
</Pressable>
|
|
86
|
+
)}
|
|
87
|
+
</View>
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
Alert.displayName = 'Alert';
|
|
93
|
+
|
|
94
|
+
const styles = StyleSheet.create({
|
|
95
|
+
container: { width: '100%' },
|
|
96
|
+
content: { flexDirection: 'row', alignItems: 'flex-start' },
|
|
97
|
+
iconContainer: { marginTop: 2 },
|
|
98
|
+
defaultIcon: { fontSize: 16, fontWeight: '700' },
|
|
99
|
+
textContainer: { flex: 1 },
|
|
100
|
+
title: { fontWeight: '600' },
|
|
101
|
+
message: { lineHeight: 20 },
|
|
102
|
+
closeButton: { padding: 2 },
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export default Alert;
|