@jaemincheun/ui 0.0.0-stage → 1.0.0-next.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/README.md +10 -2
- package/dist/index.d.mts +65 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +253 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +223 -0
- package/dist/index.mjs.map +1 -0
- package/manifest.json +45 -0
- package/package.json +104 -4
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@jaemincheun/ui` v2: the React Native design system for arami and starlog, built on NativeWind 4 and Tailwind 3.4.
|
|
4
|
+
|
|
5
|
+
Apps import only organisms and templates, plus `ThemeProvider` and `useTheme`. See `docs/specs/2026-11-24-INF-1982-design-system-v2/plan.md` for the scope and `decisions.md` for the reasons.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
npm run storybook:web
|
|
10
|
+
npm test
|
|
11
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type ThemeName = "coral" | "macaron";
|
|
5
|
+
type ThemeMode = "light" | "dark";
|
|
6
|
+
|
|
7
|
+
/** `system` follows the device appearance. */
|
|
8
|
+
type ThemeModePreference = ThemeMode | "system";
|
|
9
|
+
interface ThemeContextValue {
|
|
10
|
+
/** Active theme name. */
|
|
11
|
+
theme: ThemeName;
|
|
12
|
+
/** Mode the provider was given (`system`, `light` or `dark`). */
|
|
13
|
+
mode: ThemeModePreference;
|
|
14
|
+
/** Mode actually applied after resolving `system`. */
|
|
15
|
+
resolvedMode: ThemeMode;
|
|
16
|
+
}
|
|
17
|
+
interface ThemeProviderProps {
|
|
18
|
+
/** Bundled theme to apply. */
|
|
19
|
+
theme: ThemeName;
|
|
20
|
+
/** Light, dark, or follow the device. Defaults to `system`. */
|
|
21
|
+
mode?: ThemeModePreference;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Applies a bundled theme to everything below it by setting the token CSS
|
|
26
|
+
* variables with NativeWind `vars()` (D6, D14). Wrap the app root once.
|
|
27
|
+
*/
|
|
28
|
+
declare function ThemeProvider({ theme, mode, children, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
29
|
+
/** Reads the active theme. Must be called below a `ThemeProvider`. */
|
|
30
|
+
declare function useTheme(): ThemeContextValue;
|
|
31
|
+
|
|
32
|
+
interface AppBarAction {
|
|
33
|
+
/** Visible text, e.g. "Settings". */
|
|
34
|
+
label: string;
|
|
35
|
+
onPress: () => void;
|
|
36
|
+
testID?: string;
|
|
37
|
+
}
|
|
38
|
+
interface AppBarProps {
|
|
39
|
+
/** Screen title, shown bold on the left. */
|
|
40
|
+
title: string;
|
|
41
|
+
/** Shows a back action left of the title when set. */
|
|
42
|
+
onBack?: () => void;
|
|
43
|
+
/** Text of the back action. Defaults to "Back". */
|
|
44
|
+
backLabel?: string;
|
|
45
|
+
/** One text action on the right. */
|
|
46
|
+
action?: AppBarAction;
|
|
47
|
+
testID?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Top bar of a screen: optional back action, title, and one text action. */
|
|
50
|
+
declare function AppBar({ title, onBack, backLabel, action, testID, }: AppBarProps): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
interface AppShellProps {
|
|
53
|
+
/** Header slot, usually an AppBar. Stays fixed above the content. */
|
|
54
|
+
header?: ReactNode;
|
|
55
|
+
/** Screen content. Fills the remaining height. */
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
testID?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Screen frame: safe-area aware, themed background, and a content column capped
|
|
61
|
+
* at 720px and centered on wide screens (web, tablets).
|
|
62
|
+
*/
|
|
63
|
+
declare function AppShell({ header, children, testID }: AppShellProps): react_jsx_runtime.JSX.Element;
|
|
64
|
+
|
|
65
|
+
export { AppBar, type AppBarAction, type AppBarProps, AppShell, type AppShellProps, type ThemeContextValue, type ThemeMode, type ThemeModePreference, type ThemeName, ThemeProvider, type ThemeProviderProps, useTheme };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type ThemeName = "coral" | "macaron";
|
|
5
|
+
type ThemeMode = "light" | "dark";
|
|
6
|
+
|
|
7
|
+
/** `system` follows the device appearance. */
|
|
8
|
+
type ThemeModePreference = ThemeMode | "system";
|
|
9
|
+
interface ThemeContextValue {
|
|
10
|
+
/** Active theme name. */
|
|
11
|
+
theme: ThemeName;
|
|
12
|
+
/** Mode the provider was given (`system`, `light` or `dark`). */
|
|
13
|
+
mode: ThemeModePreference;
|
|
14
|
+
/** Mode actually applied after resolving `system`. */
|
|
15
|
+
resolvedMode: ThemeMode;
|
|
16
|
+
}
|
|
17
|
+
interface ThemeProviderProps {
|
|
18
|
+
/** Bundled theme to apply. */
|
|
19
|
+
theme: ThemeName;
|
|
20
|
+
/** Light, dark, or follow the device. Defaults to `system`. */
|
|
21
|
+
mode?: ThemeModePreference;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Applies a bundled theme to everything below it by setting the token CSS
|
|
26
|
+
* variables with NativeWind `vars()` (D6, D14). Wrap the app root once.
|
|
27
|
+
*/
|
|
28
|
+
declare function ThemeProvider({ theme, mode, children, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
29
|
+
/** Reads the active theme. Must be called below a `ThemeProvider`. */
|
|
30
|
+
declare function useTheme(): ThemeContextValue;
|
|
31
|
+
|
|
32
|
+
interface AppBarAction {
|
|
33
|
+
/** Visible text, e.g. "Settings". */
|
|
34
|
+
label: string;
|
|
35
|
+
onPress: () => void;
|
|
36
|
+
testID?: string;
|
|
37
|
+
}
|
|
38
|
+
interface AppBarProps {
|
|
39
|
+
/** Screen title, shown bold on the left. */
|
|
40
|
+
title: string;
|
|
41
|
+
/** Shows a back action left of the title when set. */
|
|
42
|
+
onBack?: () => void;
|
|
43
|
+
/** Text of the back action. Defaults to "Back". */
|
|
44
|
+
backLabel?: string;
|
|
45
|
+
/** One text action on the right. */
|
|
46
|
+
action?: AppBarAction;
|
|
47
|
+
testID?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Top bar of a screen: optional back action, title, and one text action. */
|
|
50
|
+
declare function AppBar({ title, onBack, backLabel, action, testID, }: AppBarProps): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
interface AppShellProps {
|
|
53
|
+
/** Header slot, usually an AppBar. Stays fixed above the content. */
|
|
54
|
+
header?: ReactNode;
|
|
55
|
+
/** Screen content. Fills the remaining height. */
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
testID?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Screen frame: safe-area aware, themed background, and a content column capped
|
|
61
|
+
* at 720px and centered on wide screens (web, tablets).
|
|
62
|
+
*/
|
|
63
|
+
declare function AppShell({ header, children, testID }: AppShellProps): react_jsx_runtime.JSX.Element;
|
|
64
|
+
|
|
65
|
+
export { AppBar, type AppBarAction, type AppBarProps, AppShell, type AppShellProps, type ThemeContextValue, type ThemeMode, type ThemeModePreference, type ThemeName, ThemeProvider, type ThemeProviderProps, useTheme };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
AppBar: () => AppBar,
|
|
24
|
+
AppShell: () => AppShell,
|
|
25
|
+
ThemeProvider: () => ThemeProvider,
|
|
26
|
+
useTheme: () => useTheme
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(src_exports);
|
|
29
|
+
|
|
30
|
+
// src/theme/ThemeProvider.tsx
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_react_native = require("react-native");
|
|
33
|
+
var import_nativewind = require("nativewind");
|
|
34
|
+
|
|
35
|
+
// src/theme/tokens.generated.ts
|
|
36
|
+
var baseVars = {
|
|
37
|
+
"--radius-sm": "4px",
|
|
38
|
+
"--radius-md": "8px",
|
|
39
|
+
"--radius-lg": "12px",
|
|
40
|
+
"--radius-xl": "16px",
|
|
41
|
+
"--radius-full": "9999px",
|
|
42
|
+
"--font-sans": "Pretendard-Regular",
|
|
43
|
+
"--font-sans-medium": "Pretendard-Medium",
|
|
44
|
+
"--font-sans-semibold": "Pretendard-SemiBold",
|
|
45
|
+
"--font-display": "Pretendard-Bold"
|
|
46
|
+
};
|
|
47
|
+
var themeVars = {
|
|
48
|
+
"coral": {
|
|
49
|
+
"light": {
|
|
50
|
+
"--background": "0 0% 100%",
|
|
51
|
+
"--foreground": "0 0% 15%",
|
|
52
|
+
"--card": "0 0% 98%",
|
|
53
|
+
"--card-foreground": "0 0% 15%",
|
|
54
|
+
"--popover": "0 0% 98%",
|
|
55
|
+
"--popover-foreground": "0 0% 15%",
|
|
56
|
+
"--primary": "358 100% 67%",
|
|
57
|
+
"--primary-foreground": "0 0% 100%",
|
|
58
|
+
"--secondary": "0 0% 96%",
|
|
59
|
+
"--secondary-foreground": "0 0% 15%",
|
|
60
|
+
"--muted": "0 0% 42%",
|
|
61
|
+
"--muted-foreground": "0 0% 42%",
|
|
62
|
+
"--accent": "358 100% 67%",
|
|
63
|
+
"--accent-foreground": "0 0% 100%",
|
|
64
|
+
"--destructive": "0 84% 60%",
|
|
65
|
+
"--destructive-foreground": "0 0% 100%",
|
|
66
|
+
"--border": "0 0% 90%",
|
|
67
|
+
"--input": "0 0% 90%",
|
|
68
|
+
"--ring": "358 100% 67%",
|
|
69
|
+
"--gold": "43 100% 50%",
|
|
70
|
+
"--gold-dark": "43 100% 45%"
|
|
71
|
+
},
|
|
72
|
+
"dark": {
|
|
73
|
+
"--background": "222 47% 11%",
|
|
74
|
+
"--foreground": "210 40% 98%",
|
|
75
|
+
"--card": "224 47% 13%",
|
|
76
|
+
"--card-foreground": "210 40% 98%",
|
|
77
|
+
"--popover": "224 47% 13%",
|
|
78
|
+
"--popover-foreground": "210 40% 98%",
|
|
79
|
+
"--primary": "358 100% 67%",
|
|
80
|
+
"--primary-foreground": "0 0% 100%",
|
|
81
|
+
"--secondary": "217 33% 17%",
|
|
82
|
+
"--secondary-foreground": "210 40% 98%",
|
|
83
|
+
"--muted": "215 20% 35%",
|
|
84
|
+
"--muted-foreground": "215 20% 55%",
|
|
85
|
+
"--accent": "358 100% 67%",
|
|
86
|
+
"--accent-foreground": "0 0% 100%",
|
|
87
|
+
"--destructive": "0 63% 50%",
|
|
88
|
+
"--destructive-foreground": "0 0% 100%",
|
|
89
|
+
"--border": "217 33% 20%",
|
|
90
|
+
"--input": "217 33% 20%",
|
|
91
|
+
"--ring": "358 100% 67%",
|
|
92
|
+
"--gold": "43 100% 50%",
|
|
93
|
+
"--gold-dark": "43 100% 55%"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"macaron": {
|
|
97
|
+
"light": {
|
|
98
|
+
"--background": "0 0% 100%",
|
|
99
|
+
"--foreground": "0 0% 15%",
|
|
100
|
+
"--card": "0 0% 98%",
|
|
101
|
+
"--card-foreground": "0 0% 15%",
|
|
102
|
+
"--popover": "0 0% 98%",
|
|
103
|
+
"--popover-foreground": "0 0% 15%",
|
|
104
|
+
"--primary": "358 100% 67%",
|
|
105
|
+
"--primary-foreground": "0 0% 100%",
|
|
106
|
+
"--secondary": "0 0% 96%",
|
|
107
|
+
"--secondary-foreground": "0 0% 15%",
|
|
108
|
+
"--muted": "0 0% 42%",
|
|
109
|
+
"--muted-foreground": "0 0% 42%",
|
|
110
|
+
"--accent": "358 100% 67%",
|
|
111
|
+
"--accent-foreground": "0 0% 100%",
|
|
112
|
+
"--destructive": "0 84% 60%",
|
|
113
|
+
"--destructive-foreground": "0 0% 100%",
|
|
114
|
+
"--border": "0 0% 90%",
|
|
115
|
+
"--input": "0 0% 90%",
|
|
116
|
+
"--ring": "358 100% 67%",
|
|
117
|
+
"--gold": "43 100% 50%",
|
|
118
|
+
"--gold-dark": "43 100% 45%"
|
|
119
|
+
},
|
|
120
|
+
"dark": {
|
|
121
|
+
"--background": "0 0% 7%",
|
|
122
|
+
"--foreground": "0 0% 93%",
|
|
123
|
+
"--card": "0 0% 11%",
|
|
124
|
+
"--card-foreground": "0 0% 93%",
|
|
125
|
+
"--popover": "0 0% 11%",
|
|
126
|
+
"--popover-foreground": "0 0% 93%",
|
|
127
|
+
"--primary": "358 100% 67%",
|
|
128
|
+
"--primary-foreground": "0 0% 100%",
|
|
129
|
+
"--secondary": "0 0% 15%",
|
|
130
|
+
"--secondary-foreground": "0 0% 93%",
|
|
131
|
+
"--muted": "0 0% 62%",
|
|
132
|
+
"--muted-foreground": "0 0% 62%",
|
|
133
|
+
"--accent": "358 100% 67%",
|
|
134
|
+
"--accent-foreground": "0 0% 100%",
|
|
135
|
+
"--destructive": "0 72% 58%",
|
|
136
|
+
"--destructive-foreground": "0 0% 100%",
|
|
137
|
+
"--border": "0 0% 20%",
|
|
138
|
+
"--input": "0 0% 24%",
|
|
139
|
+
"--ring": "358 100% 67%",
|
|
140
|
+
"--gold": "43 100% 50%",
|
|
141
|
+
"--gold-dark": "43 100% 45%"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// src/theme/ThemeProvider.tsx
|
|
147
|
+
var import_jsx_runtime = require("nativewind/jsx-runtime");
|
|
148
|
+
var ThemeContext = (0, import_react.createContext)(null);
|
|
149
|
+
function ThemeProvider({
|
|
150
|
+
theme,
|
|
151
|
+
mode = "system",
|
|
152
|
+
children
|
|
153
|
+
}) {
|
|
154
|
+
const system = (0, import_react_native.useColorScheme)();
|
|
155
|
+
const resolvedMode = mode === "system" ? system === "dark" ? "dark" : "light" : mode;
|
|
156
|
+
const value = (0, import_react.useMemo)(
|
|
157
|
+
() => ({ theme, mode, resolvedMode }),
|
|
158
|
+
[theme, mode, resolvedMode]
|
|
159
|
+
);
|
|
160
|
+
const style = (0, import_react.useMemo)(
|
|
161
|
+
() => [
|
|
162
|
+
{ flex: 1 },
|
|
163
|
+
(0, import_nativewind.vars)({ ...baseVars, ...themeVars[theme][resolvedMode] })
|
|
164
|
+
],
|
|
165
|
+
[theme, resolvedMode]
|
|
166
|
+
);
|
|
167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, { style, children }) });
|
|
168
|
+
}
|
|
169
|
+
function useTheme() {
|
|
170
|
+
const ctx = (0, import_react.useContext)(ThemeContext);
|
|
171
|
+
if (!ctx) throw new Error("useTheme must be used within a ThemeProvider");
|
|
172
|
+
return ctx;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// src/organisms/app-bar/AppBar.tsx
|
|
176
|
+
var import_react_native2 = require("react-native");
|
|
177
|
+
var import_jsx_runtime2 = require("nativewind/jsx-runtime");
|
|
178
|
+
function AppBar({
|
|
179
|
+
title,
|
|
180
|
+
onBack,
|
|
181
|
+
backLabel = "Back",
|
|
182
|
+
action,
|
|
183
|
+
testID
|
|
184
|
+
}) {
|
|
185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
186
|
+
import_react_native2.View,
|
|
187
|
+
{
|
|
188
|
+
testID,
|
|
189
|
+
className: "flex-row items-center justify-between border-b border-[hsl(var(--border))] bg-[hsl(var(--background))] px-4 py-3",
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native2.View, { className: "flex-1 flex-row items-center gap-2", children: [
|
|
192
|
+
onBack ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
193
|
+
import_react_native2.Pressable,
|
|
194
|
+
{
|
|
195
|
+
testID: testID ? `${testID}-back` : void 0,
|
|
196
|
+
accessibilityRole: "button",
|
|
197
|
+
accessibilityLabel: backLabel,
|
|
198
|
+
onPress: onBack,
|
|
199
|
+
hitSlop: 8,
|
|
200
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { className: "font-[family-name:var(--font-sans)] text-sm text-[hsl(var(--foreground))]", children: `\u2190 ${backLabel}` })
|
|
201
|
+
}
|
|
202
|
+
) : null,
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
204
|
+
import_react_native2.Text,
|
|
205
|
+
{
|
|
206
|
+
accessibilityRole: "header",
|
|
207
|
+
numberOfLines: 1,
|
|
208
|
+
className: "shrink font-[family-name:var(--font-display)] text-xl text-[hsl(var(--foreground))]",
|
|
209
|
+
children: title
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
] }),
|
|
213
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
214
|
+
import_react_native2.Pressable,
|
|
215
|
+
{
|
|
216
|
+
testID: action.testID,
|
|
217
|
+
accessibilityRole: "button",
|
|
218
|
+
onPress: action.onPress,
|
|
219
|
+
hitSlop: 8,
|
|
220
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { className: "font-[family-name:var(--font-sans)] text-sm text-[hsl(var(--muted-foreground))]", children: action.label })
|
|
221
|
+
}
|
|
222
|
+
) : null
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// src/templates/app-shell/AppShell.tsx
|
|
229
|
+
var import_react_native3 = require("react-native");
|
|
230
|
+
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
231
|
+
var import_jsx_runtime3 = require("nativewind/jsx-runtime");
|
|
232
|
+
function AppShell({ header, children, testID }) {
|
|
233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
234
|
+
import_react_native_safe_area_context.SafeAreaView,
|
|
235
|
+
{
|
|
236
|
+
testID,
|
|
237
|
+
edges: ["top", "bottom"],
|
|
238
|
+
className: "flex-1 bg-[hsl(var(--background))]",
|
|
239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native3.View, { className: "w-full max-w-[720px] flex-1 self-center", children: [
|
|
240
|
+
header,
|
|
241
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { className: "flex-1", children })
|
|
242
|
+
] })
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
247
|
+
0 && (module.exports = {
|
|
248
|
+
AppBar,
|
|
249
|
+
AppShell,
|
|
250
|
+
ThemeProvider,
|
|
251
|
+
useTheme
|
|
252
|
+
});
|
|
253
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/theme/ThemeProvider.tsx","../src/theme/tokens.generated.ts","../src/organisms/app-bar/AppBar.tsx","../src/templates/app-shell/AppShell.tsx"],"sourcesContent":["// Public API of @jaemincheun/ui.\n// Only organisms, templates, ThemeProvider and useTheme are exported (D5).\n// Atoms and molecules are internal and must never be re-exported here.\nexport * from \"./theme\";\nexport * from \"./organisms\";\nexport * from \"./templates\";\n","import { createContext, useContext, useMemo, type ReactNode } from \"react\";\nimport { View, useColorScheme } from \"react-native\";\nimport { vars } from \"nativewind\";\nimport {\n baseVars,\n themeVars,\n type ThemeMode,\n type ThemeName,\n} from \"./tokens.generated\";\n\nexport type { ThemeMode, ThemeName };\n\n/** `system` follows the device appearance. */\nexport type ThemeModePreference = ThemeMode | \"system\";\n\nexport interface ThemeContextValue {\n /** Active theme name. */\n theme: ThemeName;\n /** Mode the provider was given (`system`, `light` or `dark`). */\n mode: ThemeModePreference;\n /** Mode actually applied after resolving `system`. */\n resolvedMode: ThemeMode;\n}\n\nconst ThemeContext = createContext<ThemeContextValue | null>(null);\n\nexport interface ThemeProviderProps {\n /** Bundled theme to apply. */\n theme: ThemeName;\n /** Light, dark, or follow the device. Defaults to `system`. */\n mode?: ThemeModePreference;\n children: ReactNode;\n}\n\n/**\n * Applies a bundled theme to everything below it by setting the token CSS\n * variables with NativeWind `vars()` (D6, D14). Wrap the app root once.\n */\nexport function ThemeProvider({\n theme,\n mode = \"system\",\n children,\n}: ThemeProviderProps) {\n const system = useColorScheme();\n const resolvedMode: ThemeMode =\n mode === \"system\" ? (system === \"dark\" ? \"dark\" : \"light\") : mode;\n\n const value = useMemo(\n () => ({ theme, mode, resolvedMode }),\n [theme, mode, resolvedMode],\n );\n const style = useMemo(\n () => [\n { flex: 1 },\n vars({ ...baseVars, ...themeVars[theme][resolvedMode] }),\n ],\n [theme, resolvedMode],\n );\n\n return (\n <ThemeContext.Provider value={value}>\n <View style={style}>{children}</View>\n </ThemeContext.Provider>\n );\n}\n\n/** Reads the active theme. Must be called below a `ThemeProvider`. */\nexport function useTheme(): ThemeContextValue {\n const ctx = useContext(ThemeContext);\n if (!ctx) throw new Error(\"useTheme must be used within a ThemeProvider\");\n return ctx;\n}\n","// Generated by scripts/tokens-build.ts from tokens/themes.json. DO NOT EDIT.\n// Run `npm run tokens:build` after changing the token file.\n\nexport type ThemeName = \"coral\" | \"macaron\";\nexport type ThemeMode = \"light\" | \"dark\";\n\nexport const baseVars = {\n \"--radius-sm\": \"4px\",\n \"--radius-md\": \"8px\",\n \"--radius-lg\": \"12px\",\n \"--radius-xl\": \"16px\",\n \"--radius-full\": \"9999px\",\n \"--font-sans\": \"Pretendard-Regular\",\n \"--font-sans-medium\": \"Pretendard-Medium\",\n \"--font-sans-semibold\": \"Pretendard-SemiBold\",\n \"--font-display\": \"Pretendard-Bold\"\n} as const;\n\nexport const themeVars: Record<ThemeName, Record<ThemeMode, Record<string, string>>> = {\n \"coral\": {\n \"light\": {\n \"--background\": \"0 0% 100%\",\n \"--foreground\": \"0 0% 15%\",\n \"--card\": \"0 0% 98%\",\n \"--card-foreground\": \"0 0% 15%\",\n \"--popover\": \"0 0% 98%\",\n \"--popover-foreground\": \"0 0% 15%\",\n \"--primary\": \"358 100% 67%\",\n \"--primary-foreground\": \"0 0% 100%\",\n \"--secondary\": \"0 0% 96%\",\n \"--secondary-foreground\": \"0 0% 15%\",\n \"--muted\": \"0 0% 42%\",\n \"--muted-foreground\": \"0 0% 42%\",\n \"--accent\": \"358 100% 67%\",\n \"--accent-foreground\": \"0 0% 100%\",\n \"--destructive\": \"0 84% 60%\",\n \"--destructive-foreground\": \"0 0% 100%\",\n \"--border\": \"0 0% 90%\",\n \"--input\": \"0 0% 90%\",\n \"--ring\": \"358 100% 67%\",\n \"--gold\": \"43 100% 50%\",\n \"--gold-dark\": \"43 100% 45%\"\n },\n \"dark\": {\n \"--background\": \"222 47% 11%\",\n \"--foreground\": \"210 40% 98%\",\n \"--card\": \"224 47% 13%\",\n \"--card-foreground\": \"210 40% 98%\",\n \"--popover\": \"224 47% 13%\",\n \"--popover-foreground\": \"210 40% 98%\",\n \"--primary\": \"358 100% 67%\",\n \"--primary-foreground\": \"0 0% 100%\",\n \"--secondary\": \"217 33% 17%\",\n \"--secondary-foreground\": \"210 40% 98%\",\n \"--muted\": \"215 20% 35%\",\n \"--muted-foreground\": \"215 20% 55%\",\n \"--accent\": \"358 100% 67%\",\n \"--accent-foreground\": \"0 0% 100%\",\n \"--destructive\": \"0 63% 50%\",\n \"--destructive-foreground\": \"0 0% 100%\",\n \"--border\": \"217 33% 20%\",\n \"--input\": \"217 33% 20%\",\n \"--ring\": \"358 100% 67%\",\n \"--gold\": \"43 100% 50%\",\n \"--gold-dark\": \"43 100% 55%\"\n }\n },\n \"macaron\": {\n \"light\": {\n \"--background\": \"0 0% 100%\",\n \"--foreground\": \"0 0% 15%\",\n \"--card\": \"0 0% 98%\",\n \"--card-foreground\": \"0 0% 15%\",\n \"--popover\": \"0 0% 98%\",\n \"--popover-foreground\": \"0 0% 15%\",\n \"--primary\": \"358 100% 67%\",\n \"--primary-foreground\": \"0 0% 100%\",\n \"--secondary\": \"0 0% 96%\",\n \"--secondary-foreground\": \"0 0% 15%\",\n \"--muted\": \"0 0% 42%\",\n \"--muted-foreground\": \"0 0% 42%\",\n \"--accent\": \"358 100% 67%\",\n \"--accent-foreground\": \"0 0% 100%\",\n \"--destructive\": \"0 84% 60%\",\n \"--destructive-foreground\": \"0 0% 100%\",\n \"--border\": \"0 0% 90%\",\n \"--input\": \"0 0% 90%\",\n \"--ring\": \"358 100% 67%\",\n \"--gold\": \"43 100% 50%\",\n \"--gold-dark\": \"43 100% 45%\"\n },\n \"dark\": {\n \"--background\": \"0 0% 7%\",\n \"--foreground\": \"0 0% 93%\",\n \"--card\": \"0 0% 11%\",\n \"--card-foreground\": \"0 0% 93%\",\n \"--popover\": \"0 0% 11%\",\n \"--popover-foreground\": \"0 0% 93%\",\n \"--primary\": \"358 100% 67%\",\n \"--primary-foreground\": \"0 0% 100%\",\n \"--secondary\": \"0 0% 15%\",\n \"--secondary-foreground\": \"0 0% 93%\",\n \"--muted\": \"0 0% 62%\",\n \"--muted-foreground\": \"0 0% 62%\",\n \"--accent\": \"358 100% 67%\",\n \"--accent-foreground\": \"0 0% 100%\",\n \"--destructive\": \"0 72% 58%\",\n \"--destructive-foreground\": \"0 0% 100%\",\n \"--border\": \"0 0% 20%\",\n \"--input\": \"0 0% 24%\",\n \"--ring\": \"358 100% 67%\",\n \"--gold\": \"43 100% 50%\",\n \"--gold-dark\": \"43 100% 45%\"\n }\n }\n};\n","import { Pressable, Text, View } from \"react-native\";\n\nexport interface AppBarAction {\n /** Visible text, e.g. \"Settings\". */\n label: string;\n onPress: () => void;\n testID?: string;\n}\n\nexport interface AppBarProps {\n /** Screen title, shown bold on the left. */\n title: string;\n /** Shows a back action left of the title when set. */\n onBack?: () => void;\n /** Text of the back action. Defaults to \"Back\". */\n backLabel?: string;\n /** One text action on the right. */\n action?: AppBarAction;\n testID?: string;\n}\n\n/** Top bar of a screen: optional back action, title, and one text action. */\nexport function AppBar({\n title,\n onBack,\n backLabel = \"Back\",\n action,\n testID,\n}: AppBarProps) {\n return (\n <View\n testID={testID}\n className=\"flex-row items-center justify-between border-b border-[hsl(var(--border))] bg-[hsl(var(--background))] px-4 py-3\"\n >\n <View className=\"flex-1 flex-row items-center gap-2\">\n {onBack ? (\n <Pressable\n testID={testID ? `${testID}-back` : undefined}\n accessibilityRole=\"button\"\n accessibilityLabel={backLabel}\n onPress={onBack}\n hitSlop={8}\n >\n <Text className=\"font-[family-name:var(--font-sans)] text-sm text-[hsl(var(--foreground))]\">\n {`← ${backLabel}`}\n </Text>\n </Pressable>\n ) : null}\n <Text\n accessibilityRole=\"header\"\n numberOfLines={1}\n className=\"shrink font-[family-name:var(--font-display)] text-xl text-[hsl(var(--foreground))]\"\n >\n {title}\n </Text>\n </View>\n {action ? (\n <Pressable\n testID={action.testID}\n accessibilityRole=\"button\"\n onPress={action.onPress}\n hitSlop={8}\n >\n <Text className=\"font-[family-name:var(--font-sans)] text-sm text-[hsl(var(--muted-foreground))]\">\n {action.label}\n </Text>\n </Pressable>\n ) : null}\n </View>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { View } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\n\nexport interface AppShellProps {\n /** Header slot, usually an AppBar. Stays fixed above the content. */\n header?: ReactNode;\n /** Screen content. Fills the remaining height. */\n children: ReactNode;\n testID?: string;\n}\n\n/**\n * Screen frame: safe-area aware, themed background, and a content column capped\n * at 720px and centered on wide screens (web, tablets).\n */\nexport function AppShell({ header, children, testID }: AppShellProps) {\n return (\n <SafeAreaView\n testID={testID}\n edges={[\"top\", \"bottom\"]}\n className=\"flex-1 bg-[hsl(var(--background))]\"\n >\n <View className=\"w-full max-w-[720px] flex-1 self-center\">\n {header}\n <View className=\"flex-1\">{children}</View>\n </View>\n </SafeAreaView>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAmE;AACnE,0BAAqC;AACrC,wBAAqB;;;ACId,IAAM,WAAW;AAAA,EACtB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,kBAAkB;AACpB;AAEO,IAAM,YAA0E;AAAA,EACrF,SAAS;AAAA,IACP,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,qBAAqB;AAAA,MACrB,aAAa;AAAA,MACb,wBAAwB;AAAA,MACxB,aAAa;AAAA,MACb,wBAAwB;AAAA,MACxB,e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A,MAEV;AAAA,sDAAC,6BAAK,WAAU,sCACb;AAAA,mBACC;AAAA,YAAC;AAAA;AAAA,cACC,QAAQ,SAAS,GAAG,MAAM,UAAU;AAAA,cACpC,mBAAkB;AAAA,cAClB,oBAAoB;AAAA,cACpB,SAAS;AAAA,cACT,SAAS;AAAA,cAET,uDAAC,6BAAK,WAAU,6EACb,oBAAK,SAAS,IACjB;AAAA;AAAA,UACF,IACE;AAAA,UACJ;AAAA,YAAC;AAAA;AAAA,cACC,mBAAkB;AAAA,cAClB,eAAe;AAAA,cACf,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,WACF;AAAA,QACC,SACC;AAAA,UAAC;AAAA;AAAA,YACC,QAAQ,OAAO;AAAA,YACf,mBAAkB;AAAA,YAClB,SAAS,OAAO;AAAA,YAChB,SAAS;AAAA,YAET,uDAAC,6BAAK,WAAU,mFACb,iBAAO,OACV;AAAA;AAAA,QACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;;;ACrEA,IAAAC,uBAAqB;AACrB,4CAA6B;AAqBvB,IAAAC,sBAAA;AAPC,SAAS,SAAS,EAAE,QAAQ,UAAU,OAAO,GAAkB;AACpE,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO,CAAC,OAAO,QAAQ;AAAA,MACvB,WAAU;AAAA,MAEV,wDAAC,6BAAK,WAAU,2CACb;AAAA;AAAA,QACD,6CAAC,6BAAK,WAAU,UAAU,UAAS;AAAA,SACrC;AAAA;AAAA,EACF;AAEJ;","names":["import_react_native","import_jsx_runtime","import_react_native","import_jsx_runtime"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// src/theme/ThemeProvider.tsx
|
|
2
|
+
import { createContext, useContext, useMemo } from "react";
|
|
3
|
+
import { View, useColorScheme } from "react-native";
|
|
4
|
+
import { vars } from "nativewind";
|
|
5
|
+
|
|
6
|
+
// src/theme/tokens.generated.ts
|
|
7
|
+
var baseVars = {
|
|
8
|
+
"--radius-sm": "4px",
|
|
9
|
+
"--radius-md": "8px",
|
|
10
|
+
"--radius-lg": "12px",
|
|
11
|
+
"--radius-xl": "16px",
|
|
12
|
+
"--radius-full": "9999px",
|
|
13
|
+
"--font-sans": "Pretendard-Regular",
|
|
14
|
+
"--font-sans-medium": "Pretendard-Medium",
|
|
15
|
+
"--font-sans-semibold": "Pretendard-SemiBold",
|
|
16
|
+
"--font-display": "Pretendard-Bold"
|
|
17
|
+
};
|
|
18
|
+
var themeVars = {
|
|
19
|
+
"coral": {
|
|
20
|
+
"light": {
|
|
21
|
+
"--background": "0 0% 100%",
|
|
22
|
+
"--foreground": "0 0% 15%",
|
|
23
|
+
"--card": "0 0% 98%",
|
|
24
|
+
"--card-foreground": "0 0% 15%",
|
|
25
|
+
"--popover": "0 0% 98%",
|
|
26
|
+
"--popover-foreground": "0 0% 15%",
|
|
27
|
+
"--primary": "358 100% 67%",
|
|
28
|
+
"--primary-foreground": "0 0% 100%",
|
|
29
|
+
"--secondary": "0 0% 96%",
|
|
30
|
+
"--secondary-foreground": "0 0% 15%",
|
|
31
|
+
"--muted": "0 0% 42%",
|
|
32
|
+
"--muted-foreground": "0 0% 42%",
|
|
33
|
+
"--accent": "358 100% 67%",
|
|
34
|
+
"--accent-foreground": "0 0% 100%",
|
|
35
|
+
"--destructive": "0 84% 60%",
|
|
36
|
+
"--destructive-foreground": "0 0% 100%",
|
|
37
|
+
"--border": "0 0% 90%",
|
|
38
|
+
"--input": "0 0% 90%",
|
|
39
|
+
"--ring": "358 100% 67%",
|
|
40
|
+
"--gold": "43 100% 50%",
|
|
41
|
+
"--gold-dark": "43 100% 45%"
|
|
42
|
+
},
|
|
43
|
+
"dark": {
|
|
44
|
+
"--background": "222 47% 11%",
|
|
45
|
+
"--foreground": "210 40% 98%",
|
|
46
|
+
"--card": "224 47% 13%",
|
|
47
|
+
"--card-foreground": "210 40% 98%",
|
|
48
|
+
"--popover": "224 47% 13%",
|
|
49
|
+
"--popover-foreground": "210 40% 98%",
|
|
50
|
+
"--primary": "358 100% 67%",
|
|
51
|
+
"--primary-foreground": "0 0% 100%",
|
|
52
|
+
"--secondary": "217 33% 17%",
|
|
53
|
+
"--secondary-foreground": "210 40% 98%",
|
|
54
|
+
"--muted": "215 20% 35%",
|
|
55
|
+
"--muted-foreground": "215 20% 55%",
|
|
56
|
+
"--accent": "358 100% 67%",
|
|
57
|
+
"--accent-foreground": "0 0% 100%",
|
|
58
|
+
"--destructive": "0 63% 50%",
|
|
59
|
+
"--destructive-foreground": "0 0% 100%",
|
|
60
|
+
"--border": "217 33% 20%",
|
|
61
|
+
"--input": "217 33% 20%",
|
|
62
|
+
"--ring": "358 100% 67%",
|
|
63
|
+
"--gold": "43 100% 50%",
|
|
64
|
+
"--gold-dark": "43 100% 55%"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"macaron": {
|
|
68
|
+
"light": {
|
|
69
|
+
"--background": "0 0% 100%",
|
|
70
|
+
"--foreground": "0 0% 15%",
|
|
71
|
+
"--card": "0 0% 98%",
|
|
72
|
+
"--card-foreground": "0 0% 15%",
|
|
73
|
+
"--popover": "0 0% 98%",
|
|
74
|
+
"--popover-foreground": "0 0% 15%",
|
|
75
|
+
"--primary": "358 100% 67%",
|
|
76
|
+
"--primary-foreground": "0 0% 100%",
|
|
77
|
+
"--secondary": "0 0% 96%",
|
|
78
|
+
"--secondary-foreground": "0 0% 15%",
|
|
79
|
+
"--muted": "0 0% 42%",
|
|
80
|
+
"--muted-foreground": "0 0% 42%",
|
|
81
|
+
"--accent": "358 100% 67%",
|
|
82
|
+
"--accent-foreground": "0 0% 100%",
|
|
83
|
+
"--destructive": "0 84% 60%",
|
|
84
|
+
"--destructive-foreground": "0 0% 100%",
|
|
85
|
+
"--border": "0 0% 90%",
|
|
86
|
+
"--input": "0 0% 90%",
|
|
87
|
+
"--ring": "358 100% 67%",
|
|
88
|
+
"--gold": "43 100% 50%",
|
|
89
|
+
"--gold-dark": "43 100% 45%"
|
|
90
|
+
},
|
|
91
|
+
"dark": {
|
|
92
|
+
"--background": "0 0% 7%",
|
|
93
|
+
"--foreground": "0 0% 93%",
|
|
94
|
+
"--card": "0 0% 11%",
|
|
95
|
+
"--card-foreground": "0 0% 93%",
|
|
96
|
+
"--popover": "0 0% 11%",
|
|
97
|
+
"--popover-foreground": "0 0% 93%",
|
|
98
|
+
"--primary": "358 100% 67%",
|
|
99
|
+
"--primary-foreground": "0 0% 100%",
|
|
100
|
+
"--secondary": "0 0% 15%",
|
|
101
|
+
"--secondary-foreground": "0 0% 93%",
|
|
102
|
+
"--muted": "0 0% 62%",
|
|
103
|
+
"--muted-foreground": "0 0% 62%",
|
|
104
|
+
"--accent": "358 100% 67%",
|
|
105
|
+
"--accent-foreground": "0 0% 100%",
|
|
106
|
+
"--destructive": "0 72% 58%",
|
|
107
|
+
"--destructive-foreground": "0 0% 100%",
|
|
108
|
+
"--border": "0 0% 20%",
|
|
109
|
+
"--input": "0 0% 24%",
|
|
110
|
+
"--ring": "358 100% 67%",
|
|
111
|
+
"--gold": "43 100% 50%",
|
|
112
|
+
"--gold-dark": "43 100% 45%"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/theme/ThemeProvider.tsx
|
|
118
|
+
import { jsx } from "nativewind/jsx-runtime";
|
|
119
|
+
var ThemeContext = createContext(null);
|
|
120
|
+
function ThemeProvider({
|
|
121
|
+
theme,
|
|
122
|
+
mode = "system",
|
|
123
|
+
children
|
|
124
|
+
}) {
|
|
125
|
+
const system = useColorScheme();
|
|
126
|
+
const resolvedMode = mode === "system" ? system === "dark" ? "dark" : "light" : mode;
|
|
127
|
+
const value = useMemo(
|
|
128
|
+
() => ({ theme, mode, resolvedMode }),
|
|
129
|
+
[theme, mode, resolvedMode]
|
|
130
|
+
);
|
|
131
|
+
const style = useMemo(
|
|
132
|
+
() => [
|
|
133
|
+
{ flex: 1 },
|
|
134
|
+
vars({ ...baseVars, ...themeVars[theme][resolvedMode] })
|
|
135
|
+
],
|
|
136
|
+
[theme, resolvedMode]
|
|
137
|
+
);
|
|
138
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children: /* @__PURE__ */ jsx(View, { style, children }) });
|
|
139
|
+
}
|
|
140
|
+
function useTheme() {
|
|
141
|
+
const ctx = useContext(ThemeContext);
|
|
142
|
+
if (!ctx) throw new Error("useTheme must be used within a ThemeProvider");
|
|
143
|
+
return ctx;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/organisms/app-bar/AppBar.tsx
|
|
147
|
+
import { Pressable, Text, View as View2 } from "react-native";
|
|
148
|
+
import { jsx as jsx2, jsxs } from "nativewind/jsx-runtime";
|
|
149
|
+
function AppBar({
|
|
150
|
+
title,
|
|
151
|
+
onBack,
|
|
152
|
+
backLabel = "Back",
|
|
153
|
+
action,
|
|
154
|
+
testID
|
|
155
|
+
}) {
|
|
156
|
+
return /* @__PURE__ */ jsxs(
|
|
157
|
+
View2,
|
|
158
|
+
{
|
|
159
|
+
testID,
|
|
160
|
+
className: "flex-row items-center justify-between border-b border-[hsl(var(--border))] bg-[hsl(var(--background))] px-4 py-3",
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsxs(View2, { className: "flex-1 flex-row items-center gap-2", children: [
|
|
163
|
+
onBack ? /* @__PURE__ */ jsx2(
|
|
164
|
+
Pressable,
|
|
165
|
+
{
|
|
166
|
+
testID: testID ? `${testID}-back` : void 0,
|
|
167
|
+
accessibilityRole: "button",
|
|
168
|
+
accessibilityLabel: backLabel,
|
|
169
|
+
onPress: onBack,
|
|
170
|
+
hitSlop: 8,
|
|
171
|
+
children: /* @__PURE__ */ jsx2(Text, { className: "font-[family-name:var(--font-sans)] text-sm text-[hsl(var(--foreground))]", children: `\u2190 ${backLabel}` })
|
|
172
|
+
}
|
|
173
|
+
) : null,
|
|
174
|
+
/* @__PURE__ */ jsx2(
|
|
175
|
+
Text,
|
|
176
|
+
{
|
|
177
|
+
accessibilityRole: "header",
|
|
178
|
+
numberOfLines: 1,
|
|
179
|
+
className: "shrink font-[family-name:var(--font-display)] text-xl text-[hsl(var(--foreground))]",
|
|
180
|
+
children: title
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
] }),
|
|
184
|
+
action ? /* @__PURE__ */ jsx2(
|
|
185
|
+
Pressable,
|
|
186
|
+
{
|
|
187
|
+
testID: action.testID,
|
|
188
|
+
accessibilityRole: "button",
|
|
189
|
+
onPress: action.onPress,
|
|
190
|
+
hitSlop: 8,
|
|
191
|
+
children: /* @__PURE__ */ jsx2(Text, { className: "font-[family-name:var(--font-sans)] text-sm text-[hsl(var(--muted-foreground))]", children: action.label })
|
|
192
|
+
}
|
|
193
|
+
) : null
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/templates/app-shell/AppShell.tsx
|
|
200
|
+
import { View as View3 } from "react-native";
|
|
201
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
202
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "nativewind/jsx-runtime";
|
|
203
|
+
function AppShell({ header, children, testID }) {
|
|
204
|
+
return /* @__PURE__ */ jsx3(
|
|
205
|
+
SafeAreaView,
|
|
206
|
+
{
|
|
207
|
+
testID,
|
|
208
|
+
edges: ["top", "bottom"],
|
|
209
|
+
className: "flex-1 bg-[hsl(var(--background))]",
|
|
210
|
+
children: /* @__PURE__ */ jsxs2(View3, { className: "w-full max-w-[720px] flex-1 self-center", children: [
|
|
211
|
+
header,
|
|
212
|
+
/* @__PURE__ */ jsx3(View3, { className: "flex-1", children })
|
|
213
|
+
] })
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
export {
|
|
218
|
+
AppBar,
|
|
219
|
+
AppShell,
|
|
220
|
+
ThemeProvider,
|
|
221
|
+
useTheme
|
|
222
|
+
};
|
|
223
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/theme/ThemeProvider.tsx","../src/theme/tokens.generated.ts","../src/organisms/app-bar/AppBar.tsx","../src/templates/app-shell/AppShell.tsx"],"sourcesContent":["import { createContext, useContext, useMemo, type ReactNode } from \"react\";\nimport { View, useColorScheme } from \"react-native\";\nimport { vars } from \"nativewind\";\nimport {\n baseVars,\n themeVars,\n type ThemeMode,\n type ThemeName,\n} from \"./tokens.generated\";\n\nexport type { ThemeMode, ThemeName };\n\n/** `system` follows the device appearance. */\nexport type ThemeModePreference = ThemeMode | \"system\";\n\nexport interface ThemeContextValue {\n /** Active theme name. */\n theme: ThemeName;\n /** Mode the provider was given (`system`, `light` or `dark`). */\n mode: ThemeModePreference;\n /** Mode actually applied after resolving `system`. */\n resolvedMode: ThemeMode;\n}\n\nconst ThemeContext = createContext<ThemeContextValue | null>(null);\n\nexport interface ThemeProviderProps {\n /** Bundled theme to apply. */\n theme: ThemeName;\n /** Light, dark, or follow the device. Defaults to `system`. */\n mode?: ThemeModePreference;\n children: ReactNode;\n}\n\n/**\n * Applies a bundled theme to everything below it by setting the token CSS\n * variables with NativeWind `vars()` (D6, D14). Wrap the app root once.\n */\nexport function ThemeProvider({\n theme,\n mode = \"system\",\n children,\n}: ThemeProviderProps) {\n const system = useColorScheme();\n const resolvedMode: ThemeMode =\n mode === \"system\" ? (system === \"dark\" ? \"dark\" : \"light\") : mode;\n\n const value = useMemo(\n () => ({ theme, mode, resolvedMode }),\n [theme, mode, resolvedMode],\n );\n const style = useMemo(\n () => [\n { flex: 1 },\n vars({ ...baseVars, ...themeVars[theme][resolvedMode] }),\n ],\n [theme, resolvedMode],\n );\n\n return (\n <ThemeContext.Provider value={value}>\n <View style={style}>{children}</View>\n </ThemeContext.Provider>\n );\n}\n\n/** Reads the active theme. Must be called below a `ThemeProvider`. */\nexport function useTheme(): ThemeContextValue {\n const ctx = useContext(ThemeContext);\n if (!ctx) throw new Error(\"useTheme must be used within a ThemeProvider\");\n return ctx;\n}\n","// Generated by scripts/tokens-build.ts from tokens/themes.json. DO NOT EDIT.\n// Run `npm run tokens:build` after changing the token file.\n\nexport type ThemeName = \"coral\" | \"macaron\";\nexport type ThemeMode = \"light\" | \"dark\";\n\nexport const baseVars = {\n \"--radius-sm\": \"4px\",\n \"--radius-md\": \"8px\",\n \"--radius-lg\": \"12px\",\n \"--radius-xl\": \"16px\",\n \"--radius-full\": \"9999px\",\n \"--font-sans\": \"Pretendard-Regular\",\n \"--font-sans-medium\": \"Pretendard-Medium\",\n \"--font-sans-semibold\": \"Pretendard-SemiBold\",\n \"--font-display\": \"Pretendard-Bold\"\n} as const;\n\nexport const themeVars: Record<ThemeName, Record<ThemeMode, Record<string, string>>> = {\n \"coral\": {\n \"light\": {\n \"--background\": \"0 0% 100%\",\n \"--foreground\": \"0 0% 15%\",\n \"--card\": \"0 0% 98%\",\n \"--card-foreground\": \"0 0% 15%\",\n \"--popover\": \"0 0% 98%\",\n \"--popover-foreground\": \"0 0% 15%\",\n \"--primary\": \"358 100% 67%\",\n \"--primary-foreground\": \"0 0% 100%\",\n \"--secondary\": \"0 0% 96%\",\n \"--secondary-foreground\": \"0 0% 15%\",\n \"--muted\": \"0 0% 42%\",\n \"--muted-foreground\": \"0 0% 42%\",\n \"--accent\": \"358 100% 67%\",\n \"--accent-foreground\": \"0 0% 100%\",\n \"--destructive\": \"0 84% 60%\",\n \"--destructive-foreground\": \"0 0% 100%\",\n \"--border\": \"0 0% 90%\",\n \"--input\": \"0 0% 90%\",\n \"--ring\": \"358 100% 67%\",\n \"--gold\": \"43 100% 50%\",\n \"--gold-dark\": \"43 100% 45%\"\n },\n \"dark\": {\n \"--background\": \"222 47% 11%\",\n \"--foreground\": \"210 40% 98%\",\n \"--card\": \"224 47% 13%\",\n \"--card-foreground\": \"210 40% 98%\",\n \"--popover\": \"224 47% 13%\",\n \"--popover-foreground\": \"210 40% 98%\",\n \"--primary\": \"358 100% 67%\",\n \"--primary-foreground\": \"0 0% 100%\",\n \"--secondary\": \"217 33% 17%\",\n \"--secondary-foreground\": \"210 40% 98%\",\n \"--muted\": \"215 20% 35%\",\n \"--muted-foreground\": \"215 20% 55%\",\n \"--accent\": \"358 100% 67%\",\n \"--accent-foreground\": \"0 0% 100%\",\n \"--destructive\": \"0 63% 50%\",\n \"--destructive-foreground\": \"0 0% 100%\",\n \"--border\": \"217 33% 20%\",\n \"--input\": \"217 33% 20%\",\n \"--ring\": \"358 100% 67%\",\n \"--gold\": \"43 100% 50%\",\n \"--gold-dark\": \"43 100% 55%\"\n }\n },\n \"macaron\": {\n \"light\": {\n \"--background\": \"0 0% 100%\",\n \"--foreground\": \"0 0% 15%\",\n \"--card\": \"0 0% 98%\",\n \"--card-foreground\": \"0 0% 15%\",\n \"--popover\": \"0 0% 98%\",\n \"--popover-foreground\": \"0 0% 15%\",\n \"--primary\": \"358 100% 67%\",\n \"--primary-foreground\": \"0 0% 100%\",\n \"--secondary\": \"0 0% 96%\",\n \"--secondary-foreground\": \"0 0% 15%\",\n \"--muted\": \"0 0% 42%\",\n \"--muted-foreground\": \"0 0% 42%\",\n \"--accent\": \"358 100% 67%\",\n \"--accent-foreground\": \"0 0% 100%\",\n \"--destructive\": \"0 84% 60%\",\n \"--destructive-foreground\": \"0 0% 100%\",\n \"--border\": \"0 0% 90%\",\n \"--input\": \"0 0% 90%\",\n \"--ring\": \"358 100% 67%\",\n \"--gold\": \"43 100% 50%\",\n \"--gold-dark\": \"43 100% 45%\"\n },\n \"dark\": {\n \"--background\": \"0 0% 7%\",\n \"--foreground\": \"0 0% 93%\",\n \"--card\": \"0 0% 11%\",\n \"--card-foreground\": \"0 0% 93%\",\n \"--popover\": \"0 0% 11%\",\n \"--popover-foreground\": \"0 0% 93%\",\n \"--primary\": \"358 100% 67%\",\n \"--primary-foreground\": \"0 0% 100%\",\n \"--secondary\": \"0 0% 15%\",\n \"--secondary-foreground\": \"0 0% 93%\",\n \"--muted\": \"0 0% 62%\",\n \"--muted-foreground\": \"0 0% 62%\",\n \"--accent\": \"358 100% 67%\",\n \"--accent-foreground\": \"0 0% 100%\",\n \"--destructive\": \"0 72% 58%\",\n \"--destructive-foreground\": \"0 0% 100%\",\n \"--border\": \"0 0% 20%\",\n \"--input\": \"0 0% 24%\",\n \"--ring\": \"358 100% 67%\",\n \"--gold\": \"43 100% 50%\",\n \"--gold-dark\": \"43 100% 45%\"\n }\n }\n};\n","import { Pressable, Text, View } from \"react-native\";\n\nexport interface AppBarAction {\n /** Visible text, e.g. \"Settings\". */\n label: string;\n onPress: () => void;\n testID?: string;\n}\n\nexport interface AppBarProps {\n /** Screen title, shown bold on the left. */\n title: string;\n /** Shows a back action left of the title when set. */\n onBack?: () => void;\n /** Text of the back action. Defaults to \"Back\". */\n backLabel?: string;\n /** One text action on the right. */\n action?: AppBarAction;\n testID?: string;\n}\n\n/** Top bar of a screen: optional back action, title, and one text action. */\nexport function AppBar({\n title,\n onBack,\n backLabel = \"Back\",\n action,\n testID,\n}: AppBarProps) {\n return (\n <View\n testID={testID}\n className=\"flex-row items-center justify-between border-b border-[hsl(var(--border))] bg-[hsl(var(--background))] px-4 py-3\"\n >\n <View className=\"flex-1 flex-row items-center gap-2\">\n {onBack ? (\n <Pressable\n testID={testID ? `${testID}-back` : undefined}\n accessibilityRole=\"button\"\n accessibilityLabel={backLabel}\n onPress={onBack}\n hitSlop={8}\n >\n <Text className=\"font-[family-name:var(--font-sans)] text-sm text-[hsl(var(--foreground))]\">\n {`← ${backLabel}`}\n </Text>\n </Pressable>\n ) : null}\n <Text\n accessibilityRole=\"header\"\n numberOfLines={1}\n className=\"shrink font-[family-name:var(--font-display)] text-xl text-[hsl(var(--foreground))]\"\n >\n {title}\n </Text>\n </View>\n {action ? (\n <Pressable\n testID={action.testID}\n accessibilityRole=\"button\"\n onPress={action.onPress}\n hitSlop={8}\n >\n <Text className=\"font-[family-name:var(--font-sans)] text-sm text-[hsl(var(--muted-foreground))]\">\n {action.label}\n </Text>\n </Pressable>\n ) : null}\n </View>\n );\n}\n","import type { ReactNode } from \"react\";\nimport { View } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\n\nexport interface AppShellProps {\n /** Header slot, usually an AppBar. Stays fixed above the content. */\n header?: ReactNode;\n /** Screen content. Fills the remaining height. */\n children: ReactNode;\n testID?: string;\n}\n\n/**\n * Screen frame: safe-area aware, themed background, and a content column capped\n * at 720px and centered on wide screens (web, tablets).\n */\nexport function AppShell({ header, children, testID }: AppShellProps) {\n return (\n <SafeAreaView\n testID={testID}\n edges={[\"top\", \"bottom\"]}\n className=\"flex-1 bg-[hsl(var(--background))]\"\n >\n <View className=\"w-full max-w-[720px] flex-1 self-center\">\n {header}\n <View className=\"flex-1\">{children}</View>\n </View>\n </SafeAreaView>\n );\n}\n"],"mappings":";AAAA,SAAS,eAAe,YAAY,eAA+B;AACnE,SAAS,MAAM,sBAAsB;AACrC,SAAS,YAAY;;;ACId,IAAM,WAAW;AAAA,EACtB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,kBAAkB;AACpB;AAEO,IAAM,YAA0E;AAAA,EACrF,SAAS;AAAA,IACP,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,qBAAqB;AAAA,MACrB,aAAa;AAAA,MACb,wBAAwB;AAAA,MACxB,aAAa;AAAA,MACb,wBAAwB;AAAA,MACxB,eAAe;AAAA,MACf,0BAA0B;AAAA,MAC1B,WAAW;AAAA,MACX,sBAAsB;AAAA,MACtB,YAAY;AAAA,MACZ,uBAAuB;AAAA,MACvB,iBAAiB;AAAA,MACjB,4BAA4B;AAAA,MAC5B,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,UAAU;AAAA,MACV,UAAU;AAAA,MACV,eAAe;AAAA,IACjB;AA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QAAK,WAAU,6EACb,oBAAK,SAAS,IACjB;AAAA;AAAA,UACF,IACE;AAAA,UACJ,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC,mBAAkB;AAAA,cAClB,eAAe;AAAA,cACf,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,WACF;AAAA,QACC,SACC,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,QAAQ,OAAO;AAAA,YACf,mBAAkB;AAAA,YAClB,SAAS,OAAO;AAAA,YAChB,SAAS;AAAA,YAET,0BAAAA,KAAC,QAAK,WAAU,mFACb,iBAAO,OACV;AAAA;AAAA,QACF,IACE;AAAA;AAAA;AAAA,EACN;AAEJ;;;ACrEA,SAAS,QAAAC,aAAY;AACrB,SAAS,oBAAoB;AAqBvB,SAEE,OAAAC,MAFF,QAAAC,aAAA;AAPC,SAAS,SAAS,EAAE,QAAQ,UAAU,OAAO,GAAkB;AACpE,SACE,gBAAAD;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO,CAAC,OAAO,QAAQ;AAAA,MACvB,WAAU;AAAA,MAEV,0BAAAC,MAACF,OAAA,EAAK,WAAU,2CACb;AAAA;AAAA,QACD,gBAAAC,KAACD,OAAA,EAAK,WAAU,UAAU,UAAS;AAAA,SACrC;AAAA;AAAA,EACF;AAEJ;","names":["View","jsx","View","jsx","jsxs"]}
|
package/manifest.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$description": "Generated by scripts/build-manifest.ts. Every public organism and template in @jaemincheun/ui. Apps build screens only from these (D8).",
|
|
3
|
+
"figmaFile": "https://www.figma.com/design/k0qh1vW73xp2JmZpaIYY6A",
|
|
4
|
+
"themes": [
|
|
5
|
+
"coral",
|
|
6
|
+
"macaron"
|
|
7
|
+
],
|
|
8
|
+
"components": [
|
|
9
|
+
{
|
|
10
|
+
"name": "AppBar",
|
|
11
|
+
"layer": "organism",
|
|
12
|
+
"description": "Top bar of a screen: optional back action, a bold title and one text action.",
|
|
13
|
+
"useWhen": [
|
|
14
|
+
"A screen needs a title at the top",
|
|
15
|
+
"A pushed screen needs a back action (pass onBack)",
|
|
16
|
+
"The screen links to one secondary place, such as Settings (pass action)"
|
|
17
|
+
],
|
|
18
|
+
"figmaNodeId": "16:11",
|
|
19
|
+
"storyId": "organisms-appbar--default",
|
|
20
|
+
"figmaUrl": "https://www.figma.com/design/k0qh1vW73xp2JmZpaIYY6A?node-id=16-11"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "AppShell",
|
|
24
|
+
"layer": "template",
|
|
25
|
+
"description": "Screen frame: safe-area aware, themed background, content column capped at 720px and centered on wide screens.",
|
|
26
|
+
"useWhen": [
|
|
27
|
+
"Every top-level screen, as the outermost component",
|
|
28
|
+
"A screen needs a fixed header above scrolling content"
|
|
29
|
+
],
|
|
30
|
+
"slots": [
|
|
31
|
+
{
|
|
32
|
+
"name": "header",
|
|
33
|
+
"description": "Fixed top area, usually an AppBar."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "children",
|
|
37
|
+
"description": "Screen content; fills the remaining height."
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"figmaNodeId": "16:12",
|
|
41
|
+
"storyId": "templates-appshell--default",
|
|
42
|
+
"figmaUrl": "https://www.figma.com/design/k0qh1vW73xp2JmZpaIYY6A?node-id=16-12"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,106 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaemincheun/ui",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-next.1",
|
|
4
|
+
"description": "Design system for arami and starlog: organisms and templates on NativeWind",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/cheunjm/ui.git"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"manifest.json"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"registry": "https://registry.npmjs.org",
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsx scripts/build-manifest.ts && tsup",
|
|
29
|
+
"prepare": "npm run build",
|
|
30
|
+
"format": "prettier --write \"**/*.{ts,tsx,md,json}\"",
|
|
31
|
+
"format:check": "prettier --check \"**/*.{ts,tsx,md,json}\"",
|
|
32
|
+
"lint": "eslint src/ scripts/ .storybook/",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"test": "jest",
|
|
35
|
+
"test:watch": "jest --watch",
|
|
36
|
+
"test:coverage": "jest --coverage",
|
|
37
|
+
"storybook:web": "set -a; . ./scripts/ports.env; set +a; storybook dev -p ${STORYBOOK_PORT:-6007} -c .storybook --disable-telemetry",
|
|
38
|
+
"storybook:build": "storybook build -c .storybook --disable-telemetry",
|
|
39
|
+
"tokens:fetch": "tsx scripts/tokens-fetch.ts --input",
|
|
40
|
+
"tokens:build": "tsx scripts/tokens-build.ts",
|
|
41
|
+
"tokens:check": "tsx scripts/tokens-build.ts --check",
|
|
42
|
+
"tokens:sync": "bash scripts/tokens-sync.sh",
|
|
43
|
+
"tokens:check-contrast": "tsx scripts/check-contrast.ts",
|
|
44
|
+
"manifest:build": "tsx scripts/build-manifest.ts",
|
|
45
|
+
"manifest:check": "tsx scripts/build-manifest.ts --check",
|
|
46
|
+
"exports:check": "tsx scripts/check-exports.ts",
|
|
47
|
+
"test:stories": "vitest run"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"nativewind": ">=4.1.0 <5",
|
|
51
|
+
"react": ">=19.0.0",
|
|
52
|
+
"react-native": ">=0.86.0",
|
|
53
|
+
"react-native-reanimated": ">=4.0.0",
|
|
54
|
+
"react-native-safe-area-context": ">=5.0.0",
|
|
55
|
+
"tailwindcss": ">=3.4.0 <4"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@babel/core": "^7.25.0",
|
|
59
|
+
"@changesets/changelog-github": "^1.0.1",
|
|
60
|
+
"@changesets/cli": "^3.0.3",
|
|
61
|
+
"@eslint/js": "^9.39.4",
|
|
62
|
+
"@react-native/jest-preset": "^0.86.3",
|
|
63
|
+
"@storybook/addon-a11y": "^10.3.4",
|
|
64
|
+
"@storybook/addon-designs": "^11.1.3",
|
|
65
|
+
"@storybook/addon-docs": "^10.3.4",
|
|
66
|
+
"@storybook/addon-links": "^10.3.4",
|
|
67
|
+
"@storybook/addon-vitest": "^10.3.4",
|
|
68
|
+
"@storybook/react": "^10.3.4",
|
|
69
|
+
"@storybook/react-vite": "^10.3.4",
|
|
70
|
+
"@testing-library/react-native": "^13.0.0",
|
|
71
|
+
"@types/jest": "^30.0.0",
|
|
72
|
+
"@types/react": "~19.2.10",
|
|
73
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
74
|
+
"@vitest/browser": "^4.1.12",
|
|
75
|
+
"@vitest/browser-playwright": "^4.1.12",
|
|
76
|
+
"autoprefixer": "^10.7.0",
|
|
77
|
+
"eslint": "^9.39.4",
|
|
78
|
+
"eslint-plugin-react": "^7.37.5",
|
|
79
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
80
|
+
"eslint-plugin-storybook": "10.3.4",
|
|
81
|
+
"expo": "~57.0.25",
|
|
82
|
+
"jest": "^29.7.0",
|
|
83
|
+
"jest-expo": "~57.0.0",
|
|
84
|
+
"nativewind": "^4.2.7",
|
|
85
|
+
"playwright": "^1.65.1",
|
|
86
|
+
"postcss": "^8.5.33",
|
|
87
|
+
"prettier": "^3.8.1",
|
|
88
|
+
"react": "19.2.3",
|
|
89
|
+
"react-dom": "19.2.3",
|
|
90
|
+
"react-native": "0.86.3",
|
|
91
|
+
"react-native-reanimated": "^4.5.1",
|
|
92
|
+
"react-native-safe-area-context": "~5.7.0",
|
|
93
|
+
"react-native-web": "~0.21.0",
|
|
94
|
+
"react-native-worklets": "^0.10.4",
|
|
95
|
+
"storybook": "^10.3.4",
|
|
96
|
+
"storybook-deeper-sort": "^2.0.6",
|
|
97
|
+
"tailwindcss": "^3.4.17",
|
|
98
|
+
"tsup": "^8.3.5",
|
|
99
|
+
"tsx": "^4.19.0",
|
|
100
|
+
"typescript": "~5.9.2",
|
|
101
|
+
"typescript-eslint": "^8.57.2",
|
|
102
|
+
"vite": "^6.4.1",
|
|
103
|
+
"vitest": "^4.1.12"
|
|
104
|
+
},
|
|
105
|
+
"module": "./dist/index.mjs"
|
|
106
|
+
}
|