@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.
Files changed (112) hide show
  1. package/dist/module/components/button/variants/default.js +0 -1
  2. package/dist/module/components/button/variants/default.js.map +1 -1
  3. package/dist/module/components/button/variants/secondary.js +2 -3
  4. package/dist/module/components/button/variants/secondary.js.map +1 -1
  5. package/dist/module/components/toast/toast-manager.js +7 -4
  6. package/dist/module/components/toast/toast-manager.js.map +1 -1
  7. package/dist/module/hooks/use-relative-position.js.map +1 -1
  8. package/dist/module/index.js +14 -5
  9. package/dist/module/index.js.map +1 -1
  10. package/dist/module/primitives/autocomplete/autocomplete-content.js +9 -5
  11. package/dist/module/primitives/autocomplete/autocomplete-content.js.map +1 -1
  12. package/dist/module/primitives/autocomplete/autocomplete-input.js +1 -7
  13. package/dist/module/primitives/autocomplete/autocomplete-input.js.map +1 -1
  14. package/dist/module/primitives/autocomplete/autocomplete-option.js +15 -7
  15. package/dist/module/primitives/autocomplete/autocomplete-option.js.map +1 -1
  16. package/dist/module/primitives/autocomplete/autocomplete-overlay.js +10 -6
  17. package/dist/module/primitives/autocomplete/autocomplete-overlay.js.map +1 -1
  18. package/dist/module/primitives/autocomplete/autocomplete-portal.js +2 -10
  19. package/dist/module/primitives/autocomplete/autocomplete-portal.js.map +1 -1
  20. package/dist/module/primitives/autocomplete/autocomplete-root.js +10 -10
  21. package/dist/module/primitives/autocomplete/autocomplete-root.js.map +1 -1
  22. package/dist/module/primitives/autocomplete/context.js.map +1 -1
  23. package/dist/module/primitives/avatar/avatar-fallback.js +2 -3
  24. package/dist/module/primitives/avatar/avatar-fallback.js.map +1 -1
  25. package/dist/module/primitives/calendar/calendar-day.js +0 -1
  26. package/dist/module/primitives/calendar/calendar-day.js.map +1 -1
  27. package/dist/module/primitives/popover/popover-content.js +4 -1
  28. package/dist/module/primitives/popover/popover-content.js.map +1 -1
  29. package/dist/module/safe-area/context.js +13 -0
  30. package/dist/module/safe-area/context.js.map +1 -0
  31. package/dist/module/safe-area/index.js +5 -0
  32. package/dist/module/safe-area/index.js.map +1 -0
  33. package/dist/module/safe-area/provider.js +26 -0
  34. package/dist/module/safe-area/provider.js.map +1 -0
  35. package/dist/module/safe-area/types.js +2 -0
  36. package/dist/module/safe-area/types.js.map +1 -0
  37. package/dist/module/themes/adapters/react-navigation.js +3 -2
  38. package/dist/module/themes/adapters/react-navigation.js.map +1 -1
  39. package/dist/module/themes/default/colors.js +28 -28
  40. package/dist/module/themes/default/colors.js.map +1 -1
  41. package/dist/module/themes/provider.js +13 -11
  42. package/dist/module/themes/provider.js.map +1 -1
  43. package/dist/module/themes/utils.js +21 -0
  44. package/dist/module/themes/utils.js.map +1 -0
  45. package/dist/typescript/src/components/button/variants/default.d.ts.map +1 -1
  46. package/dist/typescript/src/components/button/variants/secondary.d.ts.map +1 -1
  47. package/dist/typescript/src/components/toast/toast-manager.d.ts.map +1 -1
  48. package/dist/typescript/src/hooks/use-relative-position.d.ts +2 -2
  49. package/dist/typescript/src/hooks/use-relative-position.d.ts.map +1 -1
  50. package/dist/typescript/src/index.d.ts +7 -1
  51. package/dist/typescript/src/index.d.ts.map +1 -1
  52. package/dist/typescript/src/primitives/autocomplete/autocomplete-content.d.ts.map +1 -1
  53. package/dist/typescript/src/primitives/autocomplete/autocomplete-input.d.ts.map +1 -1
  54. package/dist/typescript/src/primitives/autocomplete/autocomplete-option.d.ts.map +1 -1
  55. package/dist/typescript/src/primitives/autocomplete/autocomplete-overlay.d.ts +0 -1
  56. package/dist/typescript/src/primitives/autocomplete/autocomplete-overlay.d.ts.map +1 -1
  57. package/dist/typescript/src/primitives/autocomplete/autocomplete-portal.d.ts +1 -1
  58. package/dist/typescript/src/primitives/autocomplete/autocomplete-portal.d.ts.map +1 -1
  59. package/dist/typescript/src/primitives/autocomplete/autocomplete-root.d.ts +0 -5
  60. package/dist/typescript/src/primitives/autocomplete/autocomplete-root.d.ts.map +1 -1
  61. package/dist/typescript/src/primitives/autocomplete/context.d.ts +5 -6
  62. package/dist/typescript/src/primitives/autocomplete/context.d.ts.map +1 -1
  63. package/dist/typescript/src/primitives/avatar/avatar-fallback.d.ts +0 -1
  64. package/dist/typescript/src/primitives/avatar/avatar-fallback.d.ts.map +1 -1
  65. package/dist/typescript/src/primitives/calendar/calendar-day.d.ts.map +1 -1
  66. package/dist/typescript/src/primitives/popover/popover-content.d.ts.map +1 -1
  67. package/dist/typescript/src/safe-area/context.d.ts +5 -0
  68. package/dist/typescript/src/safe-area/context.d.ts.map +1 -0
  69. package/dist/typescript/src/safe-area/index.d.ts +4 -0
  70. package/dist/typescript/src/safe-area/index.d.ts.map +1 -0
  71. package/dist/typescript/src/safe-area/provider.d.ts +7 -0
  72. package/dist/typescript/src/safe-area/provider.d.ts.map +1 -0
  73. package/dist/typescript/src/safe-area/types.d.ts +10 -0
  74. package/dist/typescript/src/safe-area/types.d.ts.map +1 -0
  75. package/dist/typescript/src/themes/adapters/react-navigation.d.ts.map +1 -1
  76. package/dist/typescript/src/themes/provider.d.ts +5 -4
  77. package/dist/typescript/src/themes/provider.d.ts.map +1 -1
  78. package/dist/typescript/src/themes/types.d.ts +0 -1
  79. package/dist/typescript/src/themes/types.d.ts.map +1 -1
  80. package/dist/typescript/src/themes/utils.d.ts +3 -0
  81. package/dist/typescript/src/themes/utils.d.ts.map +1 -0
  82. package/nodemon.json +14 -0
  83. package/package.json +3 -1
  84. package/src/components/button/variants/default.tsx +1 -2
  85. package/src/components/button/variants/secondary.tsx +3 -4
  86. package/src/components/toast/toast-manager.tsx +5 -4
  87. package/src/hooks/use-relative-position.ts +4 -4
  88. package/src/index.tsx +16 -9
  89. package/src/primitives/autocomplete/autocomplete-content.tsx +12 -3
  90. package/src/primitives/autocomplete/autocomplete-input.tsx +1 -7
  91. package/src/primitives/autocomplete/autocomplete-option.tsx +16 -8
  92. package/src/primitives/autocomplete/autocomplete-overlay.tsx +16 -8
  93. package/src/primitives/autocomplete/autocomplete-portal.tsx +2 -12
  94. package/src/primitives/autocomplete/autocomplete-root.tsx +10 -16
  95. package/src/primitives/autocomplete/context.ts +4 -5
  96. package/src/primitives/avatar/avatar-fallback.tsx +2 -4
  97. package/src/primitives/calendar/calendar-day.tsx +1 -2
  98. package/src/primitives/popover/popover-content.tsx +3 -0
  99. package/src/safe-area/context.ts +14 -0
  100. package/src/safe-area/index.ts +3 -0
  101. package/src/safe-area/provider.tsx +28 -0
  102. package/src/safe-area/types.ts +10 -0
  103. package/src/themes/adapters/react-navigation.ts +4 -3
  104. package/src/themes/default/colors.ts +28 -28
  105. package/src/themes/provider.tsx +17 -15
  106. package/src/themes/types.ts +0 -1
  107. package/src/themes/utils.ts +14 -0
  108. package/dist/module/themes/themes.js +0 -7
  109. package/dist/module/themes/themes.js.map +0 -1
  110. package/dist/typescript/src/themes/themes.d.ts +0 -3
  111. package/dist/typescript/src/themes/themes.d.ts.map +0 -1
  112. 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(223.81, 100%, 100%, 1)",
5
- foreground: "hsla(223.81, 0%, 3.94%, 1)",
4
+ background: "hsla(224, 0%, 100%, 1)",
5
+ foreground: "hsla(224, 0%, 4%, 1)",
6
6
 
7
- primary: "hsla(223.81, 0%, 9.05%, 1)",
8
- primaryForeground: "hsla(223.81, 0%, 98.03%, 1)",
7
+ primary: "hsla(224, 0%, 9%, 1)",
8
+ primaryForeground: "hsla(224, 0%, 98%, 1)",
9
9
 
10
- secondary: "hsla(223.81, 0%, 96.06%, 1)",
11
- secondaryForeground: "hsla(223.81, 0%, 9.05%, 1)",
10
+ secondary: "hsla(224, 0%, 96%, 1)",
11
+ secondaryForeground: "hsla(224, 0%, 9%, 1)",
12
12
 
13
- muted: "hsla(223.81, 0%, 96.06%, 1)",
14
- mutedForeground: "hsla(223.81, 0%, 45.15%, 1)",
13
+ muted: "hsla(224, 0%, 96%, 1)",
14
+ mutedForeground: "hsla(224, 0%, 45%, 1)",
15
15
 
16
- border: "hsla(223.81, 0%, 89.82%, 1)",
17
- surface: "hsla(223.81, 100%, 100%, 1)",
16
+ border: "hsla(224, 0%, 90%, 1)",
17
+ surface: "hsla(224, 0%, 100%, 1)",
18
18
 
19
- danger: "hsla(0, 84.2%, 60.2%, 1)",
20
- success: "hsla(173, 58%, 39%, 1)",
21
- warning: "hsla(43, 74%, 66%, 1)",
22
- info: "hsla(197, 37%, 24%, 1)",
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(223.81, 0%, 3.94%, 1)",
27
- foreground: "hsla(223.81, 0%, 98.03%, 1)",
26
+ background: "hsla(224, 0%, 4%, 1)",
27
+ foreground: "hsla(224, 0%, 98%, 1)",
28
28
 
29
- primary: "hsla(223.81, 0%, 89.82%, 1)",
30
- primaryForeground: "hsla(223.81, 0%, 9.05%, 1)",
29
+ primary: "hsla(224, 0%, 90%, 1)",
30
+ primaryForeground: "hsla(224, 0%, 9%, 1)",
31
31
 
32
- secondary: "hsla(223.81, 0%, 14.94%, 1)",
33
- secondaryForeground: "hsla(223.81, 0%, 98.03%, 1)",
32
+ secondary: "hsla(224, 0%, 15%, 1)",
33
+ secondaryForeground: "hsla(224, 0%, 98%, 1)",
34
34
 
35
- muted: "hsla(223.81, 0%, 14.94%, 1)",
36
- mutedForeground: "hsla(223.81, 0%, 63.02%, 1)",
35
+ muted: "hsla(224, 0%, 15%, 1)",
36
+ mutedForeground: "hsla(224, 0%, 63%, 1)",
37
37
 
38
- border: "hsla(223.81, 0%, 15.51%, 1)",
39
- surface: "hsla(223.81, 0%, 9.05%, 1)",
38
+ border: "hsla(224, 0%, 16%, 1)",
39
+ surface: "hsla(224, 0%, 9%, 1)",
40
40
 
41
- danger: "hsla(0, 62.8%, 30.6%, 1)",
42
- success: "hsla(160, 60%, 45%, 1)",
43
- warning: "hsla(30, 80%, 55%, 1)",
44
- info: "hsla(220, 70%, 50%, 1)",
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
  };
@@ -1,7 +1,8 @@
1
1
  import { createContext, type PropsWithChildren, useContext, useEffect, useState } from "react";
2
2
  import { useColorScheme } from "react-native";
3
- import { themes } from "./themes";
4
- import type { Colors, ColorScheme, FontFamily, FontSize, LetterSpacing, Radius, ThemeName } from "./types";
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 const ThemeProvider = (props: PropsWithChildren) => {
21
- const [themeName, setTheme] = useState<ThemeName>("default");
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 themesAssets = themes[themeName];
27
- const colors = themesAssets.colors[colorScheme];
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: themesAssets.radius,
44
- fontFamily: themesAssets.fontFamily,
45
- letterSpacing: themesAssets.letterSpacing,
46
- fontSize: themesAssets.fontSize,
45
+ radius: themeAssets.radius,
46
+ fontFamily: themeAssets.fontFamily,
47
+ letterSpacing: themeAssets.letterSpacing,
48
+ fontSize: themeAssets.fontSize,
47
49
  }}
48
50
  >
49
- {props.children}
51
+ {children}
50
52
  </ThemeContext.Provider>
51
53
  );
52
54
  };
@@ -1,4 +1,3 @@
1
- export type ThemeName = "default";
2
1
  export type ColorScheme = "light" | "dark";
3
2
 
4
3
  type Color = `hsla(${number}, ${number}%, ${number}%, ${number})`;
@@ -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,7 +0,0 @@
1
- "use strict";
2
-
3
- import { defaultThemeAssets } from "./default/index.js";
4
- export const themes = {
5
- default: defaultThemeAssets
6
- };
7
- //# sourceMappingURL=themes.js.map
@@ -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,3 +0,0 @@
1
- import type { ThemeAssets, ThemeName } from "./types";
2
- export declare const themes: Record<ThemeName, ThemeAssets>;
3
- //# sourceMappingURL=themes.d.ts.map
@@ -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"}
@@ -1,6 +0,0 @@
1
- import { defaultThemeAssets } from "./default";
2
- import type { ThemeAssets, ThemeName } from "./types";
3
-
4
- export const themes: Record<ThemeName, ThemeAssets> = {
5
- default: defaultThemeAssets,
6
- };