@spelyco/react-native 1.0.0-alpha.1 → 1.0.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.
Files changed (76) hide show
  1. package/README.md +102 -36
  2. package/dist/bootUnistyles.d.ts +2 -0
  3. package/dist/bootUnistyles.d.ts.map +1 -0
  4. package/dist/components/ActionIcon/ActionIcon.d.ts +37 -0
  5. package/dist/components/ActionIcon/ActionIcon.d.ts.map +1 -0
  6. package/dist/components/Box/Box.d.ts +20 -0
  7. package/dist/components/Box/Box.d.ts.map +1 -0
  8. package/dist/components/Box/index.d.ts +2 -0
  9. package/dist/components/Box/index.d.ts.map +1 -0
  10. package/dist/components/Button/Button.d.ts +1 -1
  11. package/dist/components/Button/Button.d.ts.map +1 -1
  12. package/dist/components/Text/Text.d.ts +12 -0
  13. package/dist/components/Text/Text.d.ts.map +1 -0
  14. package/dist/components/Text/index.d.ts +2 -0
  15. package/dist/components/Text/index.d.ts.map +1 -0
  16. package/dist/components/index.d.ts +3 -1
  17. package/dist/components/index.d.ts.map +1 -1
  18. package/dist/hooks/index.d.ts +3 -0
  19. package/dist/hooks/index.d.ts.map +1 -0
  20. package/dist/hooks/useSpelycoColorScheme.d.ts +14 -0
  21. package/dist/hooks/useSpelycoColorScheme.d.ts.map +1 -0
  22. package/dist/index.d.ts +5 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/provider/SpelycoProvider.d.ts +11 -0
  25. package/dist/provider/SpelycoProvider.d.ts.map +1 -0
  26. package/dist/provider/index.d.ts +4 -0
  27. package/dist/provider/index.d.ts.map +1 -0
  28. package/dist/provider/toNavigationTheme.d.ts +20 -0
  29. package/dist/provider/toNavigationTheme.d.ts.map +1 -0
  30. package/dist/provider/toUnistylesTheme.d.ts +24 -0
  31. package/dist/provider/toUnistylesTheme.d.ts.map +1 -0
  32. package/dist/store/colorScheme.d.ts +31 -0
  33. package/dist/store/colorScheme.d.ts.map +1 -0
  34. package/dist/store/index.d.ts +2 -0
  35. package/dist/store/index.d.ts.map +1 -0
  36. package/dist/types.d.ts +5 -4
  37. package/dist/types.d.ts.map +1 -1
  38. package/package.json +11 -8
  39. package/src/bootUnistyles.ts +27 -0
  40. package/src/components/ActionIcon/ActionIcon.test.ts +59 -0
  41. package/src/components/ActionIcon/ActionIcon.tsx +54 -0
  42. package/src/components/Box/Box.test.ts +42 -0
  43. package/src/components/Box/Box.tsx +48 -0
  44. package/src/components/Box/index.ts +1 -0
  45. package/src/components/Button/Button.test.ts +22 -19
  46. package/src/components/Button/Button.tsx +36 -31
  47. package/src/components/Text/Text.test.ts +59 -0
  48. package/src/components/Text/Text.tsx +61 -0
  49. package/src/components/Text/index.ts +1 -0
  50. package/src/components/index.ts +3 -1
  51. package/src/hooks/index.ts +2 -0
  52. package/src/hooks/useSpelycoColorScheme.ts +33 -0
  53. package/src/index.ts +13 -12
  54. package/src/provider/SpelycoProvider.tsx +102 -0
  55. package/src/provider/index.ts +3 -0
  56. package/src/provider/toNavigationTheme.ts +41 -0
  57. package/src/provider/toUnistylesTheme.ts +58 -0
  58. package/src/store/colorScheme.test.ts +105 -0
  59. package/src/store/colorScheme.ts +63 -0
  60. package/src/store/index.ts +5 -0
  61. package/src/types.ts +5 -4
  62. package/dist/configure.d.ts +0 -2
  63. package/dist/configure.d.ts.map +0 -1
  64. package/dist/themes/dark.d.ts +0 -3
  65. package/dist/themes/dark.d.ts.map +0 -1
  66. package/dist/themes/index.d.ts +0 -12
  67. package/dist/themes/index.d.ts.map +0 -1
  68. package/dist/themes/light.d.ts +0 -29
  69. package/dist/themes/light.d.ts.map +0 -1
  70. package/dist/unistyles.d.ts +0 -8
  71. package/dist/unistyles.d.ts.map +0 -1
  72. package/src/configure.ts +0 -3
  73. package/src/themes/dark.ts +0 -29
  74. package/src/themes/index.ts +0 -13
  75. package/src/themes/light.ts +0 -55
  76. package/src/unistyles.ts +0 -27
@@ -0,0 +1,41 @@
1
+ import { DefaultTheme, type Theme } from "@react-navigation/native";
2
+ import type { SpelycoComputedColorScheme, SpelycoTheme } from "@spelyco/react-lib";
3
+
4
+ /**
5
+ * Adapts a `SpelycoTheme` into a `@react-navigation/native` `Theme` so the
6
+ * drawer chrome, screen background, headers, dividers and route transitions
7
+ * pick up Spelyco's palette automatically.
8
+ *
9
+ * Colour mapping (10-shade tuples):
10
+ * primary → resolved primary hex (from `theme.primary`)
11
+ * background → neutral[0] / neutral[9]
12
+ * card → neutral[1] / neutral[8] (headers, tab/drawer surface)
13
+ * text → neutral[9] / neutral[0]
14
+ * border → neutral[2] / neutral[7]
15
+ * notification→ red[6] / red[4] (badge/alert colour)
16
+ *
17
+ * Fonts pass through React Navigation's defaults — Phase 1 will wire them to
18
+ * `theme.fontFamily`/`fontFamilyMono` once a typography contract lands.
19
+ */
20
+ export function toNavigationTheme(theme: SpelycoTheme, scheme: SpelycoComputedColorScheme): Theme {
21
+ const primaryShade =
22
+ typeof theme.primaryShade === "number" ? theme.primaryShade : theme.primaryShade[scheme];
23
+ const primary = theme.colors[theme.primaryColor]?.[primaryShade] ?? DefaultTheme.colors.primary;
24
+
25
+ const neutral = theme.colors.neutral;
26
+ const red = theme.colors.red;
27
+ const isDark = scheme === "dark";
28
+
29
+ return {
30
+ dark: isDark,
31
+ colors: {
32
+ primary,
33
+ background: neutral?.[isDark ? 9 : 0] ?? DefaultTheme.colors.background,
34
+ card: neutral?.[isDark ? 8 : 1] ?? DefaultTheme.colors.card,
35
+ text: neutral?.[isDark ? 0 : 9] ?? DefaultTheme.colors.text,
36
+ border: neutral?.[isDark ? 7 : 2] ?? DefaultTheme.colors.border,
37
+ notification: red?.[isDark ? 4 : 6] ?? DefaultTheme.colors.notification,
38
+ },
39
+ fonts: DefaultTheme.fonts,
40
+ };
41
+ }
@@ -0,0 +1,58 @@
1
+ import type {
2
+ SpelycoColors,
3
+ SpelycoComputedColorScheme,
4
+ SpelycoFontSizes,
5
+ SpelycoLineHeights,
6
+ SpelycoRadius,
7
+ SpelycoShadows,
8
+ SpelycoSpacing,
9
+ SpelycoTheme,
10
+ } from "@spelyco/react-lib";
11
+
12
+ /**
13
+ * The shape consumed by Unistyles' `StyleSheet.configure({ themes })`. Each
14
+ * scheme gets its own copy with `colorScheme` and a precomputed `primary`
15
+ * color so component styles can do `theme.primary` without recomputing shades.
16
+ */
17
+ export interface SpelycoUnistylesTheme {
18
+ colorScheme: SpelycoComputedColorScheme;
19
+ colors: SpelycoColors;
20
+ spacing: SpelycoSpacing;
21
+ radius: SpelycoRadius;
22
+ fontSizes: SpelycoFontSizes;
23
+ lineHeights: SpelycoLineHeights;
24
+ shadows: SpelycoShadows;
25
+ primaryColor: string;
26
+ /** Shade index resolved for this color scheme. */
27
+ primaryShade: number;
28
+ /** `colors[primaryColor][primaryShade]` — the actual hex used by components. */
29
+ primary: string;
30
+ fontFamily: string;
31
+ fontFamilyMono: string;
32
+ }
33
+
34
+ export function toUnistylesTheme(
35
+ theme: SpelycoTheme,
36
+ scheme: SpelycoComputedColorScheme
37
+ ): SpelycoUnistylesTheme {
38
+ const primaryShade =
39
+ typeof theme.primaryShade === "number" ? theme.primaryShade : theme.primaryShade[scheme];
40
+
41
+ const primaryTuple = theme.colors[theme.primaryColor];
42
+ const primary = primaryTuple?.[primaryShade] ?? primaryTuple?.[6] ?? "#000000";
43
+
44
+ return {
45
+ colorScheme: scheme,
46
+ colors: theme.colors,
47
+ spacing: theme.spacing,
48
+ radius: theme.radius,
49
+ fontSizes: theme.fontSizes,
50
+ lineHeights: theme.lineHeights,
51
+ shadows: theme.shadows,
52
+ primaryColor: theme.primaryColor,
53
+ primaryShade,
54
+ primary,
55
+ fontFamily: theme.fontFamily,
56
+ fontFamilyMono: theme.fontFamilyMono,
57
+ };
58
+ }
@@ -0,0 +1,105 @@
1
+ import { beforeEach, describe, expect, it, vi } from "vitest";
2
+
3
+ const appearanceListeners: Array<
4
+ (event: { colorScheme: "light" | "dark" | null }) => void
5
+ > = [];
6
+
7
+ vi.mock("react-native", () => ({
8
+ Appearance: {
9
+ getColorScheme: () => "light",
10
+ addChangeListener: (
11
+ cb: (event: { colorScheme: "light" | "dark" | null }) => void,
12
+ ) => {
13
+ appearanceListeners.push(cb);
14
+ return {
15
+ remove: () => {
16
+ const i = appearanceListeners.indexOf(cb);
17
+ if (i >= 0) appearanceListeners.splice(i, 1);
18
+ },
19
+ };
20
+ },
21
+ },
22
+ }));
23
+
24
+ vi.mock("@react-native-async-storage/async-storage", () => {
25
+ const store = new Map<string, string>();
26
+ return {
27
+ default: {
28
+ getItem: vi.fn(async (key: string) => store.get(key) ?? null),
29
+ setItem: vi.fn(async (key: string, value: string) => {
30
+ store.set(key, value);
31
+ }),
32
+ removeItem: vi.fn(async (key: string) => {
33
+ store.delete(key);
34
+ }),
35
+ },
36
+ };
37
+ });
38
+
39
+ const {
40
+ useColorSchemeStore,
41
+ setupColorSchemeListener,
42
+ teardownColorSchemeListener,
43
+ } = await import("./colorScheme");
44
+
45
+ const resetStore = () => {
46
+ useColorSchemeStore.setState({
47
+ colorScheme: "auto",
48
+ systemColorScheme: "light",
49
+ });
50
+ teardownColorSchemeListener();
51
+ };
52
+
53
+ describe("colorScheme store", () => {
54
+ beforeEach(() => {
55
+ resetStore();
56
+ });
57
+
58
+ it("starts with 'auto' and resolves system scheme to 'light' by default", () => {
59
+ const state = useColorSchemeStore.getState();
60
+ expect(state.colorScheme).toBe("auto");
61
+ expect(state.systemColorScheme).toBe("light");
62
+ });
63
+
64
+ it("setColorScheme updates the user preference", () => {
65
+ useColorSchemeStore.getState().setColorScheme("dark");
66
+ expect(useColorSchemeStore.getState().colorScheme).toBe("dark");
67
+ });
68
+
69
+ it("toggleColorScheme flips dark <-> light explicitly", () => {
70
+ useColorSchemeStore.getState().setColorScheme("dark");
71
+ useColorSchemeStore.getState().toggleColorScheme();
72
+ expect(useColorSchemeStore.getState().colorScheme).toBe("light");
73
+ useColorSchemeStore.getState().toggleColorScheme();
74
+ expect(useColorSchemeStore.getState().colorScheme).toBe("dark");
75
+ });
76
+
77
+ it("toggleColorScheme from 'auto' uses systemColorScheme as the basis", () => {
78
+ useColorSchemeStore.setState({
79
+ colorScheme: "auto",
80
+ systemColorScheme: "light",
81
+ });
82
+ useColorSchemeStore.getState().toggleColorScheme();
83
+ expect(useColorSchemeStore.getState().colorScheme).toBe("dark");
84
+ });
85
+
86
+ it("clearColorScheme resets back to 'auto'", () => {
87
+ useColorSchemeStore.getState().setColorScheme("dark");
88
+ useColorSchemeStore.getState().clearColorScheme();
89
+ expect(useColorSchemeStore.getState().colorScheme).toBe("auto");
90
+ });
91
+
92
+ it("setupColorSchemeListener is idempotent", () => {
93
+ setupColorSchemeListener();
94
+ setupColorSchemeListener();
95
+ expect(appearanceListeners.length).toBe(1);
96
+ });
97
+
98
+ it("system change events update systemColorScheme", () => {
99
+ setupColorSchemeListener();
100
+ appearanceListeners[0]?.({ colorScheme: "dark" });
101
+ expect(useColorSchemeStore.getState().systemColorScheme).toBe("dark");
102
+ appearanceListeners[0]?.({ colorScheme: null });
103
+ expect(useColorSchemeStore.getState().systemColorScheme).toBe("light");
104
+ });
105
+ });
@@ -0,0 +1,63 @@
1
+ import AsyncStorage from "@react-native-async-storage/async-storage";
2
+ import type { SpelycoColorScheme, SpelycoComputedColorScheme } from "@spelyco/react-lib";
3
+ import { Appearance } from "react-native";
4
+ import { create } from "zustand";
5
+ import { createJSONStorage, persist } from "zustand/middleware";
6
+
7
+ interface ColorSchemeState {
8
+ /** User preference: 'light' | 'dark' | 'auto'. Persisted. */
9
+ colorScheme: SpelycoColorScheme;
10
+ /** Current OS color scheme. Tracked via Appearance, not persisted. */
11
+ systemColorScheme: SpelycoComputedColorScheme;
12
+ setColorScheme: (scheme: SpelycoColorScheme) => void;
13
+ toggleColorScheme: () => void;
14
+ clearColorScheme: () => void;
15
+ }
16
+
17
+ const STORAGE_KEY = "@spelyco/color-scheme";
18
+
19
+ const resolveSystemScheme = (): SpelycoComputedColorScheme => {
20
+ const scheme = Appearance.getColorScheme();
21
+ return scheme === "dark" ? "dark" : "light";
22
+ };
23
+
24
+ export const useColorSchemeStore = create<ColorSchemeState>()(
25
+ persist(
26
+ (set, get) => ({
27
+ colorScheme: "auto",
28
+ systemColorScheme: resolveSystemScheme(),
29
+ setColorScheme: (scheme) => set({ colorScheme: scheme }),
30
+ toggleColorScheme: () => {
31
+ const { colorScheme, systemColorScheme } = get();
32
+ const current = colorScheme === "auto" ? systemColorScheme : colorScheme;
33
+ set({ colorScheme: current === "light" ? "dark" : "light" });
34
+ },
35
+ clearColorScheme: () => set({ colorScheme: "auto" }),
36
+ }),
37
+ {
38
+ name: STORAGE_KEY,
39
+ storage: createJSONStorage(() => AsyncStorage),
40
+ partialize: (state) => ({ colorScheme: state.colorScheme }),
41
+ }
42
+ )
43
+ );
44
+
45
+ let listenerSubscription: { remove: () => void } | null = null;
46
+
47
+ /**
48
+ * Subscribes the store to OS color scheme changes. Idempotent — calling more
49
+ * than once is a no-op. Should be invoked once from `SpelycoProvider`.
50
+ */
51
+ export const setupColorSchemeListener = () => {
52
+ if (listenerSubscription) return;
53
+ listenerSubscription = Appearance.addChangeListener(({ colorScheme }) => {
54
+ useColorSchemeStore.setState({
55
+ systemColorScheme: colorScheme === "dark" ? "dark" : "light",
56
+ });
57
+ });
58
+ };
59
+
60
+ export const teardownColorSchemeListener = () => {
61
+ listenerSubscription?.remove();
62
+ listenerSubscription = null;
63
+ };
@@ -0,0 +1,5 @@
1
+ export {
2
+ setupColorSchemeListener,
3
+ teardownColorSchemeListener,
4
+ useColorSchemeStore,
5
+ } from "./colorScheme";
package/src/types.ts CHANGED
@@ -1,9 +1,10 @@
1
- import type { AppBreakpoints, AppTheme } from "./themes";
1
+ import type { SpelycoBreakpoints } from "@spelyco/react-lib";
2
+ import type { SpelycoUnistylesTheme } from "./provider/toUnistylesTheme";
2
3
 
3
4
  declare module "react-native-unistyles" {
4
5
  export interface UnistylesThemes {
5
- light: AppTheme;
6
- dark: AppTheme;
6
+ light: SpelycoUnistylesTheme;
7
+ dark: SpelycoUnistylesTheme;
7
8
  }
8
- export interface UnistylesBreakpoints extends AppBreakpoints {}
9
+ export interface UnistylesBreakpoints extends SpelycoBreakpoints {}
9
10
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=configure.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import type { AppTheme } from "./light";
2
- export declare const darkTheme: AppTheme;
3
- //# sourceMappingURL=dark.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dark.d.ts","sourceRoot":"","sources":["../../src/themes/dark.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,SAAS,EAAE,QA0BvB,CAAC"}
@@ -1,12 +0,0 @@
1
- export { darkTheme } from "./dark";
2
- export type { AppTheme } from "./light";
3
- export { lightTheme } from "./light";
4
- export declare const breakpoints: {
5
- readonly xs: 0;
6
- readonly sm: 360;
7
- readonly md: 768;
8
- readonly lg: 1024;
9
- readonly xl: 1280;
10
- };
11
- export type AppBreakpoints = typeof breakpoints;
12
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/themes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,WAAW,CAAC"}
@@ -1,29 +0,0 @@
1
- export interface AppTheme {
2
- colors: {
3
- primary: string;
4
- onPrimary: string;
5
- secondary: string;
6
- onSecondary: string;
7
- ghost: string;
8
- onGhost: string;
9
- background: string;
10
- text: string;
11
- border: string;
12
- disabled: string;
13
- };
14
- spacing: {
15
- xs: number;
16
- sm: number;
17
- md: number;
18
- lg: number;
19
- xl: number;
20
- };
21
- radii: {
22
- sm: number;
23
- md: number;
24
- lg: number;
25
- pill: number;
26
- };
27
- }
28
- export declare const lightTheme: AppTheme;
29
- //# sourceMappingURL=light.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../src/themes/light.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,eAAO,MAAM,UAAU,EAAE,QA0BxB,CAAC"}
@@ -1,8 +0,0 @@
1
- import "./types";
2
- export type UnistylesInitialTheme = "light" | "dark";
3
- export interface ConfigureUnistylesOptions {
4
- initialTheme?: UnistylesInitialTheme;
5
- adaptiveThemes?: boolean;
6
- }
7
- export declare const configureUnistyles: ({ initialTheme, adaptiveThemes, }?: ConfigureUnistylesOptions) => void;
8
- //# sourceMappingURL=unistyles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unistyles.d.ts","sourceRoot":"","sources":["../src/unistyles.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,CAAC;AAEjB,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,yBAAyB;IACxC,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAOD,eAAO,MAAM,kBAAkB,GAAI,oCAGhC,yBAA8B,SAMhC,CAAC"}
package/src/configure.ts DELETED
@@ -1,3 +0,0 @@
1
- import { configureUnistyles } from "./unistyles";
2
-
3
- configureUnistyles();
@@ -1,29 +0,0 @@
1
- import type { AppTheme } from "./light";
2
-
3
- export const darkTheme: AppTheme = {
4
- colors: {
5
- primary: "#818cf8",
6
- onPrimary: "#0b1020",
7
- secondary: "#1f2937",
8
- onSecondary: "#f9fafb",
9
- ghost: "transparent",
10
- onGhost: "#f9fafb",
11
- background: "#0b1020",
12
- text: "#f9fafb",
13
- border: "#374151",
14
- disabled: "#4b5563",
15
- },
16
- spacing: {
17
- xs: 4,
18
- sm: 8,
19
- md: 12,
20
- lg: 16,
21
- xl: 24,
22
- },
23
- radii: {
24
- sm: 4,
25
- md: 8,
26
- lg: 12,
27
- pill: 999,
28
- },
29
- };
@@ -1,13 +0,0 @@
1
- export { darkTheme } from "./dark";
2
- export type { AppTheme } from "./light";
3
- export { lightTheme } from "./light";
4
-
5
- export const breakpoints = {
6
- xs: 0,
7
- sm: 360,
8
- md: 768,
9
- lg: 1024,
10
- xl: 1280,
11
- } as const;
12
-
13
- export type AppBreakpoints = typeof breakpoints;
@@ -1,55 +0,0 @@
1
- export interface AppTheme {
2
- colors: {
3
- primary: string;
4
- onPrimary: string;
5
- secondary: string;
6
- onSecondary: string;
7
- ghost: string;
8
- onGhost: string;
9
- background: string;
10
- text: string;
11
- border: string;
12
- disabled: string;
13
- };
14
- spacing: {
15
- xs: number;
16
- sm: number;
17
- md: number;
18
- lg: number;
19
- xl: number;
20
- };
21
- radii: {
22
- sm: number;
23
- md: number;
24
- lg: number;
25
- pill: number;
26
- };
27
- }
28
-
29
- export const lightTheme: AppTheme = {
30
- colors: {
31
- primary: "#6366f1",
32
- onPrimary: "#ffffff",
33
- secondary: "#e5e7eb",
34
- onSecondary: "#111827",
35
- ghost: "transparent",
36
- onGhost: "#111827",
37
- background: "#ffffff",
38
- text: "#111827",
39
- border: "#d1d5db",
40
- disabled: "#9ca3af",
41
- },
42
- spacing: {
43
- xs: 4,
44
- sm: 8,
45
- md: 12,
46
- lg: 16,
47
- xl: 24,
48
- },
49
- radii: {
50
- sm: 4,
51
- md: 8,
52
- lg: 12,
53
- pill: 999,
54
- },
55
- };
package/src/unistyles.ts DELETED
@@ -1,27 +0,0 @@
1
- import { StyleSheet } from "react-native-unistyles";
2
- import { breakpoints, darkTheme, lightTheme } from "./themes";
3
-
4
- import "./types";
5
-
6
- export type UnistylesInitialTheme = "light" | "dark";
7
-
8
- export interface ConfigureUnistylesOptions {
9
- initialTheme?: UnistylesInitialTheme;
10
- adaptiveThemes?: boolean;
11
- }
12
-
13
- const themes = {
14
- light: lightTheme,
15
- dark: darkTheme,
16
- };
17
-
18
- export const configureUnistyles = ({
19
- initialTheme = "light",
20
- adaptiveThemes = true,
21
- }: ConfigureUnistylesOptions = {}) => {
22
- StyleSheet.configure({
23
- themes,
24
- breakpoints,
25
- settings: adaptiveThemes ? { adaptiveThemes: true } : { initialTheme },
26
- });
27
- };