@korsolutions/ui 0.0.41 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/components/button/variants/default.js +0 -1
- package/dist/module/components/button/variants/default.js.map +1 -1
- package/dist/module/components/button/variants/secondary.js +2 -3
- package/dist/module/components/button/variants/secondary.js.map +1 -1
- package/dist/module/components/toast/toast-manager.js +7 -4
- package/dist/module/components/toast/toast-manager.js.map +1 -1
- package/dist/module/hooks/use-relative-position.js.map +1 -1
- package/dist/module/index.js +14 -5
- package/dist/module/index.js.map +1 -1
- package/dist/module/primitives/autocomplete/autocomplete-content.js +9 -5
- package/dist/module/primitives/autocomplete/autocomplete-content.js.map +1 -1
- package/dist/module/primitives/autocomplete/autocomplete-input.js +1 -7
- package/dist/module/primitives/autocomplete/autocomplete-input.js.map +1 -1
- package/dist/module/primitives/autocomplete/autocomplete-option.js +15 -7
- package/dist/module/primitives/autocomplete/autocomplete-option.js.map +1 -1
- package/dist/module/primitives/autocomplete/autocomplete-overlay.js +10 -6
- package/dist/module/primitives/autocomplete/autocomplete-overlay.js.map +1 -1
- package/dist/module/primitives/autocomplete/autocomplete-portal.js +2 -10
- package/dist/module/primitives/autocomplete/autocomplete-portal.js.map +1 -1
- package/dist/module/primitives/autocomplete/autocomplete-root.js +10 -10
- package/dist/module/primitives/autocomplete/autocomplete-root.js.map +1 -1
- package/dist/module/primitives/autocomplete/context.js.map +1 -1
- package/dist/module/primitives/avatar/avatar-fallback.js +2 -3
- package/dist/module/primitives/avatar/avatar-fallback.js.map +1 -1
- package/dist/module/primitives/calendar/calendar-day.js +0 -1
- package/dist/module/primitives/calendar/calendar-day.js.map +1 -1
- package/dist/module/primitives/popover/popover-content.js +4 -1
- package/dist/module/primitives/popover/popover-content.js.map +1 -1
- package/dist/module/safe-area/context.js +13 -0
- package/dist/module/safe-area/context.js.map +1 -0
- package/dist/module/safe-area/index.js +5 -0
- package/dist/module/safe-area/index.js.map +1 -0
- package/dist/module/safe-area/provider.js +26 -0
- package/dist/module/safe-area/provider.js.map +1 -0
- package/dist/module/safe-area/types.js +2 -0
- package/dist/module/safe-area/types.js.map +1 -0
- package/dist/module/themes/adapters/react-navigation.js +3 -2
- package/dist/module/themes/adapters/react-navigation.js.map +1 -1
- package/dist/module/themes/default/colors.js +28 -28
- package/dist/module/themes/default/colors.js.map +1 -1
- package/dist/module/themes/provider.js +13 -11
- package/dist/module/themes/provider.js.map +1 -1
- package/dist/module/themes/utils.js +21 -0
- package/dist/module/themes/utils.js.map +1 -0
- package/dist/typescript/src/components/button/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/toast/toast-manager.d.ts.map +1 -1
- package/dist/typescript/src/hooks/use-relative-position.d.ts +2 -2
- package/dist/typescript/src/hooks/use-relative-position.d.ts.map +1 -1
- package/dist/typescript/src/index.d.ts +7 -1
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/primitives/autocomplete/autocomplete-content.d.ts.map +1 -1
- package/dist/typescript/src/primitives/autocomplete/autocomplete-input.d.ts.map +1 -1
- package/dist/typescript/src/primitives/autocomplete/autocomplete-option.d.ts.map +1 -1
- package/dist/typescript/src/primitives/autocomplete/autocomplete-overlay.d.ts +0 -1
- package/dist/typescript/src/primitives/autocomplete/autocomplete-overlay.d.ts.map +1 -1
- package/dist/typescript/src/primitives/autocomplete/autocomplete-portal.d.ts +1 -1
- package/dist/typescript/src/primitives/autocomplete/autocomplete-portal.d.ts.map +1 -1
- package/dist/typescript/src/primitives/autocomplete/autocomplete-root.d.ts +0 -5
- package/dist/typescript/src/primitives/autocomplete/autocomplete-root.d.ts.map +1 -1
- package/dist/typescript/src/primitives/autocomplete/context.d.ts +5 -6
- package/dist/typescript/src/primitives/autocomplete/context.d.ts.map +1 -1
- package/dist/typescript/src/primitives/avatar/avatar-fallback.d.ts +0 -1
- package/dist/typescript/src/primitives/avatar/avatar-fallback.d.ts.map +1 -1
- package/dist/typescript/src/primitives/calendar/calendar-day.d.ts.map +1 -1
- package/dist/typescript/src/primitives/popover/popover-content.d.ts.map +1 -1
- package/dist/typescript/src/safe-area/context.d.ts +5 -0
- package/dist/typescript/src/safe-area/context.d.ts.map +1 -0
- package/dist/typescript/src/safe-area/index.d.ts +4 -0
- package/dist/typescript/src/safe-area/index.d.ts.map +1 -0
- package/dist/typescript/src/safe-area/provider.d.ts +7 -0
- package/dist/typescript/src/safe-area/provider.d.ts.map +1 -0
- package/dist/typescript/src/safe-area/types.d.ts +10 -0
- package/dist/typescript/src/safe-area/types.d.ts.map +1 -0
- package/dist/typescript/src/themes/adapters/react-navigation.d.ts.map +1 -1
- package/dist/typescript/src/themes/provider.d.ts +5 -4
- package/dist/typescript/src/themes/provider.d.ts.map +1 -1
- package/dist/typescript/src/themes/types.d.ts +0 -1
- package/dist/typescript/src/themes/types.d.ts.map +1 -1
- package/dist/typescript/src/themes/utils.d.ts +3 -0
- package/dist/typescript/src/themes/utils.d.ts.map +1 -0
- package/nodemon.json +14 -0
- package/package.json +3 -1
- package/src/components/button/variants/default.tsx +1 -2
- package/src/components/button/variants/secondary.tsx +3 -4
- package/src/components/toast/toast-manager.tsx +5 -4
- package/src/hooks/use-relative-position.ts +4 -4
- package/src/index.tsx +16 -9
- package/src/primitives/autocomplete/autocomplete-content.tsx +12 -3
- package/src/primitives/autocomplete/autocomplete-input.tsx +1 -7
- package/src/primitives/autocomplete/autocomplete-option.tsx +16 -8
- package/src/primitives/autocomplete/autocomplete-overlay.tsx +16 -8
- package/src/primitives/autocomplete/autocomplete-portal.tsx +2 -12
- package/src/primitives/autocomplete/autocomplete-root.tsx +10 -16
- package/src/primitives/autocomplete/context.ts +4 -5
- package/src/primitives/avatar/avatar-fallback.tsx +2 -4
- package/src/primitives/calendar/calendar-day.tsx +1 -2
- package/src/primitives/popover/popover-content.tsx +3 -0
- package/src/safe-area/context.ts +14 -0
- package/src/safe-area/index.ts +3 -0
- package/src/safe-area/provider.tsx +28 -0
- package/src/safe-area/types.ts +10 -0
- package/src/themes/adapters/react-navigation.ts +4 -3
- package/src/themes/default/colors.ts +28 -28
- package/src/themes/provider.tsx +17 -15
- package/src/themes/types.ts +0 -1
- package/src/themes/utils.ts +14 -0
- package/dist/module/themes/themes.js +0 -7
- package/dist/module/themes/themes.js.map +0 -1
- package/dist/typescript/src/themes/themes.d.ts +0 -3
- package/dist/typescript/src/themes/themes.d.ts.map +0 -1
- package/src/themes/themes.ts +0 -6
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import type { Colors } from "../types";
|
|
2
2
|
|
|
3
3
|
export const lightColors: Colors = {
|
|
4
|
-
background: "hsla(
|
|
5
|
-
foreground: "hsla(
|
|
4
|
+
background: "hsla(224, 0%, 100%, 1)",
|
|
5
|
+
foreground: "hsla(224, 0%, 4%, 1)",
|
|
6
6
|
|
|
7
|
-
primary: "hsla(
|
|
8
|
-
primaryForeground: "hsla(
|
|
7
|
+
primary: "hsla(224, 0%, 9%, 1)",
|
|
8
|
+
primaryForeground: "hsla(224, 0%, 98%, 1)",
|
|
9
9
|
|
|
10
|
-
secondary: "hsla(
|
|
11
|
-
secondaryForeground: "hsla(
|
|
10
|
+
secondary: "hsla(224, 0%, 96%, 1)",
|
|
11
|
+
secondaryForeground: "hsla(224, 0%, 9%, 1)",
|
|
12
12
|
|
|
13
|
-
muted: "hsla(
|
|
14
|
-
mutedForeground: "hsla(
|
|
13
|
+
muted: "hsla(224, 0%, 96%, 1)",
|
|
14
|
+
mutedForeground: "hsla(224, 0%, 45%, 1)",
|
|
15
15
|
|
|
16
|
-
border: "hsla(
|
|
17
|
-
surface: "hsla(
|
|
16
|
+
border: "hsla(224, 0%, 90%, 1)",
|
|
17
|
+
surface: "hsla(224, 0%, 100%, 1)",
|
|
18
18
|
|
|
19
|
-
danger: "hsla(
|
|
20
|
-
success: "hsla(
|
|
21
|
-
warning: "hsla(
|
|
22
|
-
info: "hsla(
|
|
19
|
+
danger: "hsla(352, 100%, 41%, 1)",
|
|
20
|
+
success: "hsla(227, 70%, 40%, 1)",
|
|
21
|
+
warning: "hsla(212, 100%, 79%, 1)",
|
|
22
|
+
info: "hsla(221, 86%, 54%, 1)",
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export const darkColors: Colors = {
|
|
26
|
-
background: "hsla(
|
|
27
|
-
foreground: "hsla(
|
|
26
|
+
background: "hsla(224, 0%, 4%, 1)",
|
|
27
|
+
foreground: "hsla(224, 0%, 98%, 1)",
|
|
28
28
|
|
|
29
|
-
primary: "hsla(
|
|
30
|
-
primaryForeground: "hsla(
|
|
29
|
+
primary: "hsla(224, 0%, 90%, 1)",
|
|
30
|
+
primaryForeground: "hsla(224, 0%, 9%, 1)",
|
|
31
31
|
|
|
32
|
-
secondary: "hsla(
|
|
33
|
-
secondaryForeground: "hsla(
|
|
32
|
+
secondary: "hsla(224, 0%, 15%, 1)",
|
|
33
|
+
secondaryForeground: "hsla(224, 0%, 98%, 1)",
|
|
34
34
|
|
|
35
|
-
muted: "hsla(
|
|
36
|
-
mutedForeground: "hsla(
|
|
35
|
+
muted: "hsla(224, 0%, 15%, 1)",
|
|
36
|
+
mutedForeground: "hsla(224, 0%, 63%, 1)",
|
|
37
37
|
|
|
38
|
-
border: "hsla(
|
|
39
|
-
surface: "hsla(
|
|
38
|
+
border: "hsla(224, 0%, 16%, 1)",
|
|
39
|
+
surface: "hsla(224, 0%, 9%, 1)",
|
|
40
40
|
|
|
41
|
-
danger: "hsla(
|
|
42
|
-
success: "hsla(
|
|
43
|
-
warning: "hsla(
|
|
44
|
-
info: "hsla(
|
|
41
|
+
danger: "hsla(359, 100%, 70%, 1)",
|
|
42
|
+
success: "hsla(227, 70%, 40%, 1)",
|
|
43
|
+
warning: "hsla(212, 100%, 79%, 1)",
|
|
44
|
+
info: "hsla(221, 86%, 54%, 1)",
|
|
45
45
|
};
|
package/src/themes/provider.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createContext, type PropsWithChildren, useContext, useEffect, useState } from "react";
|
|
2
2
|
import { useColorScheme } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
import type { Colors, ColorScheme, FontFamily, FontSize, LetterSpacing, Radius,
|
|
3
|
+
import { defaultThemeAssets } from "./default";
|
|
4
|
+
import type { Colors, ColorScheme, FontFamily, FontSize, LetterSpacing, Radius, ThemeAssets } from "./types";
|
|
5
|
+
import { mergeThemeAssets } from "./utils";
|
|
5
6
|
|
|
6
7
|
interface ThemeContext {
|
|
7
8
|
colors: Colors;
|
|
@@ -11,20 +12,23 @@ interface ThemeContext {
|
|
|
11
12
|
letterSpacing: LetterSpacing;
|
|
12
13
|
fontSize: FontSize;
|
|
13
14
|
setColorScheme: (scheme: ColorScheme) => void;
|
|
14
|
-
setTheme: (themeName: ThemeName) => void;
|
|
15
|
-
themeName: ThemeName;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
const ThemeContext = createContext<ThemeContext | null>(null);
|
|
19
18
|
|
|
20
|
-
export
|
|
21
|
-
|
|
19
|
+
export interface ThemeProviderProps extends PropsWithChildren {
|
|
20
|
+
theme?: Partial<ThemeAssets>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const ThemeProvider = (props: ThemeProviderProps) => {
|
|
24
|
+
const { children, theme } = props;
|
|
22
25
|
|
|
23
26
|
const systemColorScheme = useColorScheme();
|
|
24
27
|
const [colorScheme, setColorScheme] = useState<ColorScheme>(systemColorScheme === "dark" ? "dark" : "light");
|
|
25
28
|
|
|
26
|
-
const
|
|
27
|
-
|
|
29
|
+
const themeAssets = theme ? mergeThemeAssets(defaultThemeAssets, theme) : defaultThemeAssets;
|
|
30
|
+
|
|
31
|
+
const colors = themeAssets.colors[colorScheme];
|
|
28
32
|
|
|
29
33
|
useEffect(() => {
|
|
30
34
|
if (systemColorScheme) {
|
|
@@ -35,18 +39,16 @@ export const ThemeProvider = (props: PropsWithChildren) => {
|
|
|
35
39
|
return (
|
|
36
40
|
<ThemeContext.Provider
|
|
37
41
|
value={{
|
|
38
|
-
themeName,
|
|
39
|
-
setTheme,
|
|
40
42
|
colorScheme,
|
|
41
43
|
setColorScheme,
|
|
42
44
|
colors,
|
|
43
|
-
radius:
|
|
44
|
-
fontFamily:
|
|
45
|
-
letterSpacing:
|
|
46
|
-
fontSize:
|
|
45
|
+
radius: themeAssets.radius,
|
|
46
|
+
fontFamily: themeAssets.fontFamily,
|
|
47
|
+
letterSpacing: themeAssets.letterSpacing,
|
|
48
|
+
fontSize: themeAssets.fontSize,
|
|
47
49
|
}}
|
|
48
50
|
>
|
|
49
|
-
{
|
|
51
|
+
{children}
|
|
50
52
|
</ThemeContext.Provider>
|
|
51
53
|
);
|
|
52
54
|
};
|
package/src/themes/types.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ThemeAssets } from "./types";
|
|
2
|
+
|
|
3
|
+
export function mergeThemeAssets(base: ThemeAssets, override: Partial<ThemeAssets>): ThemeAssets {
|
|
4
|
+
return {
|
|
5
|
+
colors: {
|
|
6
|
+
light: { ...base.colors.light, ...override.colors?.light },
|
|
7
|
+
dark: { ...base.colors.dark, ...override.colors?.dark },
|
|
8
|
+
},
|
|
9
|
+
radius: override.radius ?? base.radius,
|
|
10
|
+
fontFamily: override.fontFamily ?? base.fontFamily,
|
|
11
|
+
letterSpacing: override.letterSpacing ?? base.letterSpacing,
|
|
12
|
+
fontSize: override.fontSize ?? base.fontSize,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["defaultThemeAssets","themes","default"],"sourceRoot":"../../../src","sources":["themes/themes.ts"],"mappings":";;AAAA,SAASA,kBAAkB;AAG3B,OAAO,MAAMC,MAAsC,GAAG;EACpDC,OAAO,EAAEF;AACX,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../../../src/themes/themes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,WAAW,CAEjD,CAAC"}
|