@korsolutions/ui 0.0.41 → 0.0.42

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 (63) hide show
  1. package/dist/module/components/button/variants/secondary.js +2 -2
  2. package/dist/module/components/button/variants/secondary.js.map +1 -1
  3. package/dist/module/components/toast/toast-manager.js +7 -4
  4. package/dist/module/components/toast/toast-manager.js.map +1 -1
  5. package/dist/module/index.js +14 -5
  6. package/dist/module/index.js.map +1 -1
  7. package/dist/module/primitives/avatar/avatar-fallback.js +2 -3
  8. package/dist/module/primitives/avatar/avatar-fallback.js.map +1 -1
  9. package/dist/module/safe-area/context.js +13 -0
  10. package/dist/module/safe-area/context.js.map +1 -0
  11. package/dist/module/safe-area/index.js +5 -0
  12. package/dist/module/safe-area/index.js.map +1 -0
  13. package/dist/module/safe-area/provider.js +26 -0
  14. package/dist/module/safe-area/provider.js.map +1 -0
  15. package/dist/module/safe-area/types.js +2 -0
  16. package/dist/module/safe-area/types.js.map +1 -0
  17. package/dist/module/themes/adapters/react-navigation.js +3 -2
  18. package/dist/module/themes/adapters/react-navigation.js.map +1 -1
  19. package/dist/module/themes/default/colors.js +28 -28
  20. package/dist/module/themes/default/colors.js.map +1 -1
  21. package/dist/module/themes/provider.js +13 -11
  22. package/dist/module/themes/provider.js.map +1 -1
  23. package/dist/module/themes/utils.js +21 -0
  24. package/dist/module/themes/utils.js.map +1 -0
  25. package/dist/typescript/src/components/toast/toast-manager.d.ts.map +1 -1
  26. package/dist/typescript/src/index.d.ts +7 -1
  27. package/dist/typescript/src/index.d.ts.map +1 -1
  28. package/dist/typescript/src/primitives/avatar/avatar-fallback.d.ts +0 -1
  29. package/dist/typescript/src/primitives/avatar/avatar-fallback.d.ts.map +1 -1
  30. package/dist/typescript/src/safe-area/context.d.ts +5 -0
  31. package/dist/typescript/src/safe-area/context.d.ts.map +1 -0
  32. package/dist/typescript/src/safe-area/index.d.ts +4 -0
  33. package/dist/typescript/src/safe-area/index.d.ts.map +1 -0
  34. package/dist/typescript/src/safe-area/provider.d.ts +7 -0
  35. package/dist/typescript/src/safe-area/provider.d.ts.map +1 -0
  36. package/dist/typescript/src/safe-area/types.d.ts +10 -0
  37. package/dist/typescript/src/safe-area/types.d.ts.map +1 -0
  38. package/dist/typescript/src/themes/adapters/react-navigation.d.ts.map +1 -1
  39. package/dist/typescript/src/themes/provider.d.ts +5 -4
  40. package/dist/typescript/src/themes/provider.d.ts.map +1 -1
  41. package/dist/typescript/src/themes/types.d.ts +0 -1
  42. package/dist/typescript/src/themes/types.d.ts.map +1 -1
  43. package/dist/typescript/src/themes/utils.d.ts +3 -0
  44. package/dist/typescript/src/themes/utils.d.ts.map +1 -0
  45. package/package.json +1 -1
  46. package/src/components/button/variants/secondary.tsx +3 -3
  47. package/src/components/toast/toast-manager.tsx +5 -4
  48. package/src/index.tsx +16 -9
  49. package/src/primitives/avatar/avatar-fallback.tsx +2 -4
  50. package/src/safe-area/context.ts +14 -0
  51. package/src/safe-area/index.ts +3 -0
  52. package/src/safe-area/provider.tsx +28 -0
  53. package/src/safe-area/types.ts +10 -0
  54. package/src/themes/adapters/react-navigation.ts +4 -3
  55. package/src/themes/default/colors.ts +28 -28
  56. package/src/themes/provider.tsx +17 -15
  57. package/src/themes/types.ts +0 -1
  58. package/src/themes/utils.ts +14 -0
  59. package/dist/module/themes/themes.js +0 -7
  60. package/dist/module/themes/themes.js.map +0 -1
  61. package/dist/typescript/src/themes/themes.d.ts +0 -3
  62. package/dist/typescript/src/themes/themes.d.ts.map +0 -1
  63. package/src/themes/themes.ts +0 -6
@@ -34,7 +34,7 @@ export const useButtonVariantSecondary = () => {
34
34
  },
35
35
  label: {
36
36
  default: {
37
- color: colors.foreground,
37
+ color: colors.secondaryForeground,
38
38
  fontSize,
39
39
  fontWeight: "bold",
40
40
  fontFamily
@@ -48,7 +48,7 @@ export const useButtonVariantSecondary = () => {
48
48
  },
49
49
  spinner: {
50
50
  default: {
51
- color: colors.primaryForeground
51
+ color: colors.secondaryForeground
52
52
  },
53
53
  disabled: {
54
54
  color: colors.mutedForeground
@@ -1 +1 @@
1
- {"version":3,"names":["hslaSetRelativeLightness","useThemedStyles","useButtonVariantSecondary","colors","radius","fontFamily","fontSize","root","default","flexDirection","paddingVertical","paddingHorizontal","borderRadius","gap","alignItems","justifyContent","borderWidth","borderColor","border","backgroundColor","secondary","disabled","opacity","loading","hovered","label","color","foreground","fontWeight","mutedForeground","spinner","primaryForeground"],"sourceRoot":"../../../../../src","sources":["components/button/variants/secondary.tsx"],"mappings":";;AACA,SAASA,wBAAwB;AACjC,SAASC,eAAe;AAExB,OAAO,MAAMC,yBAAyB,GAAGA,CAAA,KAAoB;EAC3D,OAAOD,eAAe,CACpB,CAAC;IAAEE,MAAM;IAAEC,MAAM;IAAEC,UAAU;IAAEC;EAAS,CAAC,MAAoB;IAC3DC,IAAI,EAAE;MACJC,OAAO,EAAE;QACPC,aAAa,EAAE,KAAK;QACpBC,eAAe,EAAE,EAAE;QACnBC,iBAAiB,EAAE,EAAE;QACrBC,YAAY,EAAER,MAAM;QACpBS,GAAG,EAAE,CAAC;QACNC,UAAU,EAAE,QAAQ;QACpBC,cAAc,EAAE,QAAQ;QACxBC,WAAW,EAAE,CAAC;QACdC,WAAW,EAAEd,MAAM,CAACe,MAAM;QAC1BC,eAAe,EAAEhB,MAAM,CAACiB;MAC1B,CAAC;MACDC,QAAQ,EAAE;QACRC,OAAO,EAAE;MACX,CAAC;MACDC,OAAO,EAAE;QACPD,OAAO,EAAE;MACX,CAAC;MACDE,OAAO,EAAE;QACPL,eAAe,EAAEnB,wBAAwB,CAACG,MAAM,CAACiB,SAAS,EAAE,CAAC,CAAC;MAChE;IACF,CAAC;IACDK,KAAK,EAAE;MACLjB,OAAO,EAAE;QACPkB,KAAK,EAAEvB,MAAM,CAACwB,UAAU;QACxBrB,QAAQ;QACRsB,UAAU,EAAE,MAAM;QAClBvB;MACF,CAAC;MACDgB,QAAQ,EAAE;QACRK,KAAK,EAAEvB,MAAM,CAAC0B;MAChB,CAAC;MACDN,OAAO,EAAE;QACPG,KAAK,EAAEvB,MAAM,CAAC0B;MAChB;IACF,CAAC;IACDC,OAAO,EAAE;MACPtB,OAAO,EAAE;QACPkB,KAAK,EAAEvB,MAAM,CAAC4B;MAChB,CAAC;MACDV,QAAQ,EAAE;QACRK,KAAK,EAAEvB,MAAM,CAAC0B;MAChB,CAAC;MACDN,OAAO,EAAE;QACPG,KAAK,EAAEvB,MAAM,CAAC0B;MAChB;IACF;EACF,CAAC,CACH,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["hslaSetRelativeLightness","useThemedStyles","useButtonVariantSecondary","colors","radius","fontFamily","fontSize","root","default","flexDirection","paddingVertical","paddingHorizontal","borderRadius","gap","alignItems","justifyContent","borderWidth","borderColor","border","backgroundColor","secondary","disabled","opacity","loading","hovered","label","color","secondaryForeground","fontWeight","mutedForeground","spinner"],"sourceRoot":"../../../../../src","sources":["components/button/variants/secondary.tsx"],"mappings":";;AACA,SAASA,wBAAwB;AACjC,SAASC,eAAe;AAExB,OAAO,MAAMC,yBAAyB,GAAGA,CAAA,KAAoB;EAC3D,OAAOD,eAAe,CACpB,CAAC;IAAEE,MAAM;IAAEC,MAAM;IAAEC,UAAU;IAAEC;EAAS,CAAC,MAAoB;IAC3DC,IAAI,EAAE;MACJC,OAAO,EAAE;QACPC,aAAa,EAAE,KAAK;QACpBC,eAAe,EAAE,EAAE;QACnBC,iBAAiB,EAAE,EAAE;QACrBC,YAAY,EAAER,MAAM;QACpBS,GAAG,EAAE,CAAC;QACNC,UAAU,EAAE,QAAQ;QACpBC,cAAc,EAAE,QAAQ;QACxBC,WAAW,EAAE,CAAC;QACdC,WAAW,EAAEd,MAAM,CAACe,MAAM;QAC1BC,eAAe,EAAEhB,MAAM,CAACiB;MAC1B,CAAC;MACDC,QAAQ,EAAE;QACRC,OAAO,EAAE;MACX,CAAC;MACDC,OAAO,EAAE;QACPD,OAAO,EAAE;MACX,CAAC;MACDE,OAAO,EAAE;QACPL,eAAe,EAAEnB,wBAAwB,CAACG,MAAM,CAACiB,SAAS,EAAE,CAAC,CAAC;MAChE;IACF,CAAC;IACDK,KAAK,EAAE;MACLjB,OAAO,EAAE;QACPkB,KAAK,EAAEvB,MAAM,CAACwB,mBAAmB;QACjCrB,QAAQ;QACRsB,UAAU,EAAE,MAAM;QAClBvB;MACF,CAAC;MACDgB,QAAQ,EAAE;QACRK,KAAK,EAAEvB,MAAM,CAAC0B;MAChB,CAAC;MACDN,OAAO,EAAE;QACPG,KAAK,EAAEvB,MAAM,CAAC0B;MAChB;IACF,CAAC;IACDC,OAAO,EAAE;MACPtB,OAAO,EAAE;QACPkB,KAAK,EAAEvB,MAAM,CAACwB;MAChB,CAAC;MACDN,QAAQ,EAAE;QACRK,KAAK,EAAEvB,MAAM,CAAC0B;MAChB,CAAC;MACDN,OAAO,EAAE;QACPG,KAAK,EAAEvB,MAAM,CAAC0B;MAChB;IACF;EACF,CAAC,CACH,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ import { Portal } from "../../primitives/portal/index.js";
4
+ import { useSafeAreaInsets } from "../../safe-area/index.js";
3
5
  import React, { useSyncExternalStore } from "react";
4
- import { View, StyleSheet } from "react-native";
6
+ import { StyleSheet, View } from "react-native";
5
7
  import { ToastComponent } from "./toast.js";
6
- import { Portal } from "../../primitives/portal/index.js";
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
8
9
  export const TOAST_PORTAL_NAME = "toast-portal";
9
10
  const store = {
@@ -53,11 +54,14 @@ export const ToastAPI = {
53
54
  };
54
55
  export function ToastContainer() {
55
56
  const toasts = useSyncExternalStore(subscribe, getSnapshot);
57
+ const insets = useSafeAreaInsets();
56
58
  if (!toasts.length) return null;
57
59
  return /*#__PURE__*/_jsx(Portal, {
58
60
  name: TOAST_PORTAL_NAME,
59
61
  children: /*#__PURE__*/_jsx(View, {
60
- style: s.wrapper,
62
+ style: [s.wrapper, {
63
+ top: insets.top + 24
64
+ }],
61
65
  children: toasts.map(toast => /*#__PURE__*/_jsx(ToastComponent, {
62
66
  title: toast.title,
63
67
  description: toast.description,
@@ -71,7 +75,6 @@ const s = StyleSheet.create({
71
75
  width: "100%",
72
76
  alignItems: "center",
73
77
  position: "absolute",
74
- top: 24,
75
78
  gap: 8
76
79
  }
77
80
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","useSyncExternalStore","View","StyleSheet","ToastComponent","Portal","jsx","_jsx","TOAST_PORTAL_NAME","store","toasts","listeners","Set","emit","cb","getSnapshot","subscribe","add","delete","addToast","config","existingToast","find","t","id","toast","duration","setTimeout","removeToast","filter","ToastAPI","show","dismiss","ToastContainer","length","name","children","style","s","wrapper","map","title","description","variant","create","width","alignItems","position","top","gap"],"sourceRoot":"../../../../src","sources":["components/toast/toast-manager.tsx"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"names":["Portal","useSafeAreaInsets","React","useSyncExternalStore","StyleSheet","View","ToastComponent","jsx","_jsx","TOAST_PORTAL_NAME","store","toasts","listeners","Set","emit","cb","getSnapshot","subscribe","add","delete","addToast","config","existingToast","find","t","id","toast","duration","setTimeout","removeToast","filter","ToastAPI","show","dismiss","ToastContainer","insets","length","name","children","style","s","wrapper","top","map","title","description","variant","create","width","alignItems","position","gap"],"sourceRoot":"../../../../src","sources":["components/toast/toast-manager.tsx"],"mappings":"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","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ import { SafeAreaProvider } from "./safe-area/index.js";
3
4
  import { ThemeProvider } from "./themes/index.js";
4
5
  import { AsyncAlertDialogManager } from "./components/alert-dialog/async-alert-dialog.js";
5
6
  import { ToastContainer } from "./components/toast/toast-manager.js";
@@ -7,15 +8,23 @@ import { PortalHost } from "./primitives/portal/index.js";
7
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
9
  export const UniversalUIProvider = ({
9
10
  children,
10
- portalContainer
11
+ portalContainer,
12
+ theme,
13
+ safeAreaInsets
11
14
  }) => {
12
- return /*#__PURE__*/_jsxs(ThemeProvider, {
13
- children: [/*#__PURE__*/_jsx(ToastContainer, {}), children, /*#__PURE__*/_jsx(PortalHost, {
14
- container: portalContainer
15
- }), /*#__PURE__*/_jsx(AsyncAlertDialogManager, {})]
15
+ return /*#__PURE__*/_jsx(SafeAreaProvider, {
16
+ insets: safeAreaInsets,
17
+ children: /*#__PURE__*/_jsxs(ThemeProvider, {
18
+ theme: theme,
19
+ children: [/*#__PURE__*/_jsx(ToastContainer, {}), children, /*#__PURE__*/_jsx(PortalHost, {
20
+ container: portalContainer
21
+ }), /*#__PURE__*/_jsx(AsyncAlertDialogManager, {})]
22
+ })
16
23
  });
17
24
  };
18
25
  export * from "./themes/adapters/index.js";
26
+ export * from "./themes/default/index.js";
19
27
  export { useTheme } from "./themes/provider.js";
20
28
  export * from "./themes/types.js";
29
+ export * from "./safe-area/index.js";
21
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ThemeProvider","AsyncAlertDialogManager","ToastContainer","PortalHost","jsx","_jsx","jsxs","_jsxs","UniversalUIProvider","children","portalContainer","container","useTheme"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa;AACtB,SAASC,uBAAuB;AAChC,SAASC,cAAc;AACvB,SAASC,UAAU;AAA8B,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AASjD,OAAO,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAA+B,CAAC,KAAK;EACnF,oBACEH,KAAA,CAACP,aAAa;IAAAS,QAAA,gBACZJ,IAAA,CAACH,cAAc,IAAE,CAAC,EACjBO,QAAQ,eACTJ,IAAA,CAACF,UAAU;MAACQ,SAAS,EAAED;IAAgB,CAAE,CAAC,eAC1CL,IAAA,CAACJ,uBAAuB,IAAE,CAAC;EAAA,CACd,CAAC;AAEpB,CAAC;AAED;AACA,SAASW,QAAQ;AACjB","ignoreList":[]}
1
+ {"version":3,"names":["SafeAreaProvider","ThemeProvider","AsyncAlertDialogManager","ToastContainer","PortalHost","jsx","_jsx","jsxs","_jsxs","UniversalUIProvider","children","portalContainer","theme","safeAreaInsets","insets","container","useTheme"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,gBAAgB;AACzB,SAASC,aAAa;AACtB,SAASC,uBAAuB;AAChC,SAASC,cAAc;AACvB,SAASC,UAAU;AAA8B,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUjD,OAAO,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,eAAe;EAAEC,KAAK;EAAEC;AAA8B,CAAC,KAAK;EAC1G,oBACEP,IAAA,CAACN,gBAAgB;IAACc,MAAM,EAAED,cAAe;IAAAH,QAAA,eACvCF,KAAA,CAACP,aAAa;MAACW,KAAK,EAAEA,KAAM;MAAAF,QAAA,gBAC1BJ,IAAA,CAACH,cAAc,IAAE,CAAC,EACjBO,QAAQ,eACTJ,IAAA,CAACF,UAAU;QAACW,SAAS,EAAEJ;MAAgB,CAAE,CAAC,eAC1CL,IAAA,CAACJ,uBAAuB,IAAE,CAAC;IAAA,CACd;EAAC,CACA,CAAC;AAEvB,CAAC;AAED;AACA;AACA,SAASc,QAAQ;AACjB;AAEA","ignoreList":[]}
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  import React from "react";
4
- import { View } from "react-native";
4
+ import { Text } from "react-native";
5
5
  import { useAvatar } from "./context.js";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  export function AvatarFallback(props) {
8
8
  const avatar = useAvatar();
9
9
  const composedStyles = [avatar.styles?.fallback, props.style];
10
- const Component = props.render ?? View;
11
- return /*#__PURE__*/_jsx(Component, {
10
+ return /*#__PURE__*/_jsx(Text, {
12
11
  ...props,
13
12
  style: composedStyles
14
13
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","useAvatar","jsx","_jsx","AvatarFallback","props","avatar","composedStyles","styles","fallback","style","Component","render"],"sourceRoot":"../../../../src","sources":["primitives/avatar/avatar-fallback.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAyCC,IAAI,QAAQ,cAAc;AACnE,SAASC,SAAS;AAAoB,SAAAC,GAAA,IAAAC,IAAA;AAQtC,OAAO,SAASC,cAAcA,CAACC,KAA0B,EAAE;EACzD,MAAMC,MAAM,GAAGL,SAAS,CAAC,CAAC;EAC1B,MAAMM,cAAc,GAAG,CAACD,MAAM,CAACE,MAAM,EAAEC,QAAQ,EAAEJ,KAAK,CAACK,KAAK,CAAC;EAC7D,MAAMC,SAAS,GAAGN,KAAK,CAACO,MAAM,IAAIZ,IAAI;EACtC,oBAAOG,IAAA,CAACQ,SAAS;IAAA,GAAKN,KAAK;IAAEK,KAAK,EAAEH;EAAe,CAAE,CAAC;AACxD","ignoreList":[]}
1
+ {"version":3,"names":["React","Text","useAvatar","jsx","_jsx","AvatarFallback","props","avatar","composedStyles","styles","fallback","style"],"sourceRoot":"../../../../src","sources":["primitives/avatar/avatar-fallback.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAwC,cAAc;AACnE,SAASC,SAAS;AAAoB,SAAAC,GAAA,IAAAC,IAAA;AAOtC,OAAO,SAASC,cAAcA,CAACC,KAA0B,EAAE;EACzD,MAAMC,MAAM,GAAGL,SAAS,CAAC,CAAC;EAC1B,MAAMM,cAAc,GAAG,CAACD,MAAM,CAACE,MAAM,EAAEC,QAAQ,EAAEJ,KAAK,CAACK,KAAK,CAAC;EAC7D,oBAAOP,IAAA,CAACH,IAAI;IAAA,GAAKK,KAAK;IAAEK,KAAK,EAAEH;EAAe,CAAE,CAAC;AACnD","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ import { createContext, useContext } from "react";
4
+ const SafeAreaContext = /*#__PURE__*/createContext(null);
5
+ export const useSafeAreaInsets = () => {
6
+ const context = useContext(SafeAreaContext);
7
+ if (!context) {
8
+ throw new Error("useSafeAreaInsets must be used within SafeAreaProvider");
9
+ }
10
+ return context.insets;
11
+ };
12
+ export { SafeAreaContext };
13
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContext","useContext","SafeAreaContext","useSafeAreaInsets","context","Error","insets"],"sourceRoot":"../../../src","sources":["safe-area/context.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAGjD,MAAMC,eAAe,gBAAGF,aAAa,CAA8B,IAAI,CAAC;AAExE,OAAO,MAAMG,iBAAiB,GAAGA,CAAA,KAAM;EACrC,MAAMC,OAAO,GAAGH,UAAU,CAACC,eAAe,CAAC;EAC3C,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;EAC3E;EACA,OAAOD,OAAO,CAACE,MAAM;AACvB,CAAC;AAED,SAASJ,eAAe","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export { SafeAreaProvider } from "./provider.js";
4
+ export { useSafeAreaInsets } from "./context.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SafeAreaProvider","useSafeAreaInsets"],"sourceRoot":"../../../src","sources":["safe-area/index.ts"],"mappings":";;AAAA,SAASA,gBAAgB;AACzB,SAASC,iBAAiB","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ import { SafeAreaContext } from "./context.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export const SafeAreaProvider = ({
6
+ children,
7
+ insets
8
+ }) => {
9
+ const defaultInsets = {
10
+ top: 0,
11
+ bottom: 0,
12
+ left: 0,
13
+ right: 0
14
+ };
15
+ const calculatedInsets = {
16
+ ...defaultInsets,
17
+ ...insets
18
+ };
19
+ return /*#__PURE__*/_jsx(SafeAreaContext.Provider, {
20
+ value: {
21
+ insets: calculatedInsets
22
+ },
23
+ children: children
24
+ });
25
+ };
26
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SafeAreaContext","jsx","_jsx","SafeAreaProvider","children","insets","defaultInsets","top","bottom","left","right","calculatedInsets","Provider","value"],"sourceRoot":"../../../src","sources":["safe-area/provider.tsx"],"mappings":";;AACA,SAASA,eAAe;AAAoB,SAAAC,GAAA,IAAAC,IAAA;AAO5C,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAA8B,CAAC,KAAK;EAC/E,MAAMC,aAA6B,GAAG;IACpCC,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT,CAAC;EAED,MAAMC,gBAAgC,GAAG;IAAE,GAAGL,aAAa;IAAE,GAAGD;EAAO,CAAC;EAExE,oBACEH,IAAA,CAACF,eAAe,CAACY,QAAQ;IACvBC,KAAK,EAAE;MACLR,MAAM,EAAEM;IACV,CAAE;IAAAP,QAAA,EAEDA;EAAQ,CACe,CAAC;AAE/B,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["safe-area/types.ts"],"mappings":"","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import { useEffect } from "react";
4
- import { useTheme } from "../provider.js";
5
4
  import { Platform } from "react-native";
5
+ import { useTheme } from "../provider.js";
6
6
  export function useReactNavigationTheme() {
7
7
  const theme = useTheme();
8
8
  useEffect(() => {
@@ -12,13 +12,14 @@ export function useReactNavigationTheme() {
12
12
  styles.innerHTML = `
13
13
  :root {
14
14
  --expo-router-modal-border: 1px solid ${theme.colors.border};
15
+ --expo-router-modal-border-radius: ${theme.radius}px;
15
16
  }
16
17
  `;
17
18
  document.head.appendChild(styles);
18
19
  return () => {
19
20
  document.head.removeChild(styles);
20
21
  };
21
- }, [theme.colors.border]);
22
+ }, [theme.colors.border, theme.radius]);
22
23
  return {
23
24
  dark: theme.colorScheme === "dark",
24
25
  colors: {
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useTheme","Platform","useReactNavigationTheme","theme","OS","styles","document","createElement","id","innerHTML","colors","border","head","appendChild","removeChild","dark","colorScheme","background","primary","card","surface","text","foreground","notification","danger","fonts","heavy","fontFamily","fontWeight","bold","medium","regular"],"sourceRoot":"../../../../src","sources":["themes/adapters/react-navigation.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,QAAQ;AACjB,SAASC,QAAQ,QAAQ,cAAc;AAEvC,OAAO,SAASC,uBAAuBA,CAAA,EAAU;EAC/C,MAAMC,KAAK,GAAGH,QAAQ,CAAC,CAAC;EAExBD,SAAS,CAAC,MAAM;IACd,IAAIE,QAAQ,CAACG,EAAE,KAAK,KAAK,EAAE;IAC3B,MAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;IAC9CF,MAAM,CAACG,EAAE,GAAG,wCAAwC;IACpDH,MAAM,CAACI,SAAS,GAAG;AACvB;AACA,gDAAgDN,KAAK,CAACO,MAAM,CAACC,MAAM;AACnE;AACA,KAAK;IACDL,QAAQ,CAACM,IAAI,CAACC,WAAW,CAACR,MAAM,CAAC;IACjC,OAAO,MAAM;MACXC,QAAQ,CAACM,IAAI,CAACE,WAAW,CAACT,MAAM,CAAC;IACnC,CAAC;EACH,CAAC,EAAE,CAACF,KAAK,CAACO,MAAM,CAACC,MAAM,CAAC,CAAC;EAEzB,OAAO;IACLI,IAAI,EAAEZ,KAAK,CAACa,WAAW,KAAK,MAAM;IAClCN,MAAM,EAAE;MACNO,UAAU,EAAEd,KAAK,CAACO,MAAM,CAACO,UAAU;MACnCN,MAAM,EAAER,KAAK,CAACO,MAAM,CAACC,MAAM;MAC3BO,OAAO,EAAEf,KAAK,CAACO,MAAM,CAACQ,OAAO;MAC7BC,IAAI,EAAEhB,KAAK,CAACO,MAAM,CAACU,OAAO;MAC1BC,IAAI,EAAElB,KAAK,CAACO,MAAM,CAACY,UAAU;MAC7BC,YAAY,EAAEpB,KAAK,CAACO,MAAM,CAACc;IAC7B,CAAC;IACDC,KAAK,EAAE;MACLC,KAAK,EAAE;QACLC,UAAU,EAAExB,KAAK,CAACwB,UAAU;QAC5BC,UAAU,EAAE;MACd,CAAC;MACDC,IAAI,EAAE;QACJF,UAAU,EAAExB,KAAK,CAACwB,UAAU;QAC5BC,UAAU,EAAE;MACd,CAAC;MACDE,MAAM,EAAE;QACNH,UAAU,EAAExB,KAAK,CAACwB,UAAU;QAC5BC,UAAU,EAAE;MACd,CAAC;MACDG,OAAO,EAAE;QACPJ,UAAU,EAAExB,KAAK,CAACwB,UAAU;QAC5BC,UAAU,EAAE;MACd;IACF;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","Platform","useTheme","useReactNavigationTheme","theme","OS","styles","document","createElement","id","innerHTML","colors","border","radius","head","appendChild","removeChild","dark","colorScheme","background","primary","card","surface","text","foreground","notification","danger","fonts","heavy","fontFamily","fontWeight","bold","medium","regular"],"sourceRoot":"../../../../src","sources":["themes/adapters/react-navigation.ts"],"mappings":";;AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,QAAQ;AAEjB,OAAO,SAASC,uBAAuBA,CAAA,EAAU;EAC/C,MAAMC,KAAK,GAAGF,QAAQ,CAAC,CAAC;EAExBF,SAAS,CAAC,MAAM;IACd,IAAIC,QAAQ,CAACI,EAAE,KAAK,KAAK,EAAE;IAC3B,MAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;IAC9CF,MAAM,CAACG,EAAE,GAAG,wCAAwC;IACpDH,MAAM,CAACI,SAAS,GAAG;AACvB;AACA,gDAAgDN,KAAK,CAACO,MAAM,CAACC,MAAM;AACnE,6CAA6CR,KAAK,CAACS,MAAM;AACzD;AACA,KAAK;IACDN,QAAQ,CAACO,IAAI,CAACC,WAAW,CAACT,MAAM,CAAC;IACjC,OAAO,MAAM;MACXC,QAAQ,CAACO,IAAI,CAACE,WAAW,CAACV,MAAM,CAAC;IACnC,CAAC;EACH,CAAC,EAAE,CAACF,KAAK,CAACO,MAAM,CAACC,MAAM,EAAER,KAAK,CAACS,MAAM,CAAC,CAAC;EAEvC,OAAO;IACLI,IAAI,EAAEb,KAAK,CAACc,WAAW,KAAK,MAAM;IAClCP,MAAM,EAAE;MACNQ,UAAU,EAAEf,KAAK,CAACO,MAAM,CAACQ,UAAU;MACnCP,MAAM,EAAER,KAAK,CAACO,MAAM,CAACC,MAAM;MAC3BQ,OAAO,EAAEhB,KAAK,CAACO,MAAM,CAACS,OAAO;MAC7BC,IAAI,EAAEjB,KAAK,CAACO,MAAM,CAACW,OAAO;MAC1BC,IAAI,EAAEnB,KAAK,CAACO,MAAM,CAACa,UAAU;MAC7BC,YAAY,EAAErB,KAAK,CAACO,MAAM,CAACe;IAC7B,CAAC;IACDC,KAAK,EAAE;MACLC,KAAK,EAAE;QACLC,UAAU,EAAEzB,KAAK,CAACyB,UAAU;QAC5BC,UAAU,EAAE;MACd,CAAC;MACDC,IAAI,EAAE;QACJF,UAAU,EAAEzB,KAAK,CAACyB,UAAU;QAC5BC,UAAU,EAAE;MACd,CAAC;MACDE,MAAM,EAAE;QACNH,UAAU,EAAEzB,KAAK,CAACyB,UAAU;QAC5BC,UAAU,EAAE;MACd,CAAC;MACDG,OAAO,EAAE;QACPJ,UAAU,EAAEzB,KAAK,CAACyB,UAAU;QAC5BC,UAAU,EAAE;MACd;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,35 +1,35 @@
1
1
  "use strict";
2
2
 
3
3
  export const lightColors = {
4
- background: "hsla(223.81, 100%, 100%, 1)",
5
- foreground: "hsla(223.81, 0%, 3.94%, 1)",
6
- primary: "hsla(223.81, 0%, 9.05%, 1)",
7
- primaryForeground: "hsla(223.81, 0%, 98.03%, 1)",
8
- secondary: "hsla(223.81, 0%, 96.06%, 1)",
9
- secondaryForeground: "hsla(223.81, 0%, 9.05%, 1)",
10
- muted: "hsla(223.81, 0%, 96.06%, 1)",
11
- mutedForeground: "hsla(223.81, 0%, 45.15%, 1)",
12
- border: "hsla(223.81, 0%, 89.82%, 1)",
13
- surface: "hsla(223.81, 100%, 100%, 1)",
14
- danger: "hsla(0, 84.2%, 60.2%, 1)",
15
- success: "hsla(173, 58%, 39%, 1)",
16
- warning: "hsla(43, 74%, 66%, 1)",
17
- info: "hsla(197, 37%, 24%, 1)"
4
+ background: "hsla(224, 0%, 100%, 1)",
5
+ foreground: "hsla(224, 0%, 4%, 1)",
6
+ primary: "hsla(224, 0%, 9%, 1)",
7
+ primaryForeground: "hsla(224, 0%, 98%, 1)",
8
+ secondary: "hsla(224, 0%, 96%, 1)",
9
+ secondaryForeground: "hsla(224, 0%, 9%, 1)",
10
+ muted: "hsla(224, 0%, 96%, 1)",
11
+ mutedForeground: "hsla(224, 0%, 45%, 1)",
12
+ border: "hsla(224, 0%, 90%, 1)",
13
+ surface: "hsla(224, 0%, 100%, 1)",
14
+ danger: "hsla(352, 100%, 41%, 1)",
15
+ success: "hsla(227, 70%, 40%, 1)",
16
+ warning: "hsla(212, 100%, 79%, 1)",
17
+ info: "hsla(221, 86%, 54%, 1)"
18
18
  };
19
19
  export const darkColors = {
20
- background: "hsla(223.81, 0%, 3.94%, 1)",
21
- foreground: "hsla(223.81, 0%, 98.03%, 1)",
22
- primary: "hsla(223.81, 0%, 89.82%, 1)",
23
- primaryForeground: "hsla(223.81, 0%, 9.05%, 1)",
24
- secondary: "hsla(223.81, 0%, 14.94%, 1)",
25
- secondaryForeground: "hsla(223.81, 0%, 98.03%, 1)",
26
- muted: "hsla(223.81, 0%, 14.94%, 1)",
27
- mutedForeground: "hsla(223.81, 0%, 63.02%, 1)",
28
- border: "hsla(223.81, 0%, 15.51%, 1)",
29
- surface: "hsla(223.81, 0%, 9.05%, 1)",
30
- danger: "hsla(0, 62.8%, 30.6%, 1)",
31
- success: "hsla(160, 60%, 45%, 1)",
32
- warning: "hsla(30, 80%, 55%, 1)",
33
- info: "hsla(220, 70%, 50%, 1)"
20
+ background: "hsla(224, 0%, 4%, 1)",
21
+ foreground: "hsla(224, 0%, 98%, 1)",
22
+ primary: "hsla(224, 0%, 90%, 1)",
23
+ primaryForeground: "hsla(224, 0%, 9%, 1)",
24
+ secondary: "hsla(224, 0%, 15%, 1)",
25
+ secondaryForeground: "hsla(224, 0%, 98%, 1)",
26
+ muted: "hsla(224, 0%, 15%, 1)",
27
+ mutedForeground: "hsla(224, 0%, 63%, 1)",
28
+ border: "hsla(224, 0%, 16%, 1)",
29
+ surface: "hsla(224, 0%, 9%, 1)",
30
+ danger: "hsla(359, 100%, 70%, 1)",
31
+ success: "hsla(227, 70%, 40%, 1)",
32
+ warning: "hsla(212, 100%, 79%, 1)",
33
+ info: "hsla(221, 86%, 54%, 1)"
34
34
  };
35
35
  //# sourceMappingURL=colors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["lightColors","background","foreground","primary","primaryForeground","secondary","secondaryForeground","muted","mutedForeground","border","surface","danger","success","warning","info","darkColors"],"sourceRoot":"../../../../src","sources":["themes/default/colors.ts"],"mappings":";;AAEA,OAAO,MAAMA,WAAmB,GAAG;EACjCC,UAAU,EAAE,6BAA6B;EACzCC,UAAU,EAAE,4BAA4B;EAExCC,OAAO,EAAE,4BAA4B;EACrCC,iBAAiB,EAAE,6BAA6B;EAEhDC,SAAS,EAAE,6BAA6B;EACxCC,mBAAmB,EAAE,4BAA4B;EAEjDC,KAAK,EAAE,6BAA6B;EACpCC,eAAe,EAAE,6BAA6B;EAE9CC,MAAM,EAAE,6BAA6B;EACrCC,OAAO,EAAE,6BAA6B;EAEtCC,MAAM,EAAE,0BAA0B;EAClCC,OAAO,EAAE,wBAAwB;EACjCC,OAAO,EAAE,uBAAuB;EAChCC,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMC,UAAkB,GAAG;EAChCd,UAAU,EAAE,4BAA4B;EACxCC,UAAU,EAAE,6BAA6B;EAEzCC,OAAO,EAAE,6BAA6B;EACtCC,iBAAiB,EAAE,4BAA4B;EAE/CC,SAAS,EAAE,6BAA6B;EACxCC,mBAAmB,EAAE,6BAA6B;EAElDC,KAAK,EAAE,6BAA6B;EACpCC,eAAe,EAAE,6BAA6B;EAE9CC,MAAM,EAAE,6BAA6B;EACrCC,OAAO,EAAE,4BAA4B;EAErCC,MAAM,EAAE,0BAA0B;EAClCC,OAAO,EAAE,wBAAwB;EACjCC,OAAO,EAAE,uBAAuB;EAChCC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["lightColors","background","foreground","primary","primaryForeground","secondary","secondaryForeground","muted","mutedForeground","border","surface","danger","success","warning","info","darkColors"],"sourceRoot":"../../../../src","sources":["themes/default/colors.ts"],"mappings":";;AAEA,OAAO,MAAMA,WAAmB,GAAG;EACjCC,UAAU,EAAE,wBAAwB;EACpCC,UAAU,EAAE,sBAAsB;EAElCC,OAAO,EAAE,sBAAsB;EAC/BC,iBAAiB,EAAE,uBAAuB;EAE1CC,SAAS,EAAE,uBAAuB;EAClCC,mBAAmB,EAAE,sBAAsB;EAE3CC,KAAK,EAAE,uBAAuB;EAC9BC,eAAe,EAAE,uBAAuB;EAExCC,MAAM,EAAE,uBAAuB;EAC/BC,OAAO,EAAE,wBAAwB;EAEjCC,MAAM,EAAE,yBAAyB;EACjCC,OAAO,EAAE,wBAAwB;EACjCC,OAAO,EAAE,yBAAyB;EAClCC,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMC,UAAkB,GAAG;EAChCd,UAAU,EAAE,sBAAsB;EAClCC,UAAU,EAAE,uBAAuB;EAEnCC,OAAO,EAAE,uBAAuB;EAChCC,iBAAiB,EAAE,sBAAsB;EAEzCC,SAAS,EAAE,uBAAuB;EAClCC,mBAAmB,EAAE,uBAAuB;EAE5CC,KAAK,EAAE,uBAAuB;EAC9BC,eAAe,EAAE,uBAAuB;EAExCC,MAAM,EAAE,uBAAuB;EAC/BC,OAAO,EAAE,sBAAsB;EAE/BC,MAAM,EAAE,yBAAyB;EACjCC,OAAO,EAAE,wBAAwB;EACjCC,OAAO,EAAE,yBAAyB;EAClCC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}
@@ -2,15 +2,19 @@
2
2
 
3
3
  import { createContext, useContext, useEffect, useState } from "react";
4
4
  import { useColorScheme } from "react-native";
5
- import { themes } from "./themes.js";
5
+ import { defaultThemeAssets } from "./default/index.js";
6
+ import { mergeThemeAssets } from "./utils.js";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  const ThemeContext = /*#__PURE__*/createContext(null);
8
9
  export const ThemeProvider = props => {
9
- const [themeName, setTheme] = useState("default");
10
+ const {
11
+ children,
12
+ theme
13
+ } = props;
10
14
  const systemColorScheme = useColorScheme();
11
15
  const [colorScheme, setColorScheme] = useState(systemColorScheme === "dark" ? "dark" : "light");
12
- const themesAssets = themes[themeName];
13
- const colors = themesAssets.colors[colorScheme];
16
+ const themeAssets = theme ? mergeThemeAssets(defaultThemeAssets, theme) : defaultThemeAssets;
17
+ const colors = themeAssets.colors[colorScheme];
14
18
  useEffect(() => {
15
19
  if (systemColorScheme) {
16
20
  setColorScheme(systemColorScheme === "dark" ? "dark" : "light");
@@ -18,17 +22,15 @@ export const ThemeProvider = props => {
18
22
  }, [systemColorScheme]);
19
23
  return /*#__PURE__*/_jsx(ThemeContext.Provider, {
20
24
  value: {
21
- themeName,
22
- setTheme,
23
25
  colorScheme,
24
26
  setColorScheme,
25
27
  colors,
26
- radius: themesAssets.radius,
27
- fontFamily: themesAssets.fontFamily,
28
- letterSpacing: themesAssets.letterSpacing,
29
- fontSize: themesAssets.fontSize
28
+ radius: themeAssets.radius,
29
+ fontFamily: themeAssets.fontFamily,
30
+ letterSpacing: themeAssets.letterSpacing,
31
+ fontSize: themeAssets.fontSize
30
32
  },
31
- children: props.children
33
+ children: children
32
34
  });
33
35
  };
34
36
  export const useTheme = () => {
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContext","useEffect","useState","useColorScheme","themes","jsx","_jsx","ThemeContext","ThemeProvider","props","themeName","setTheme","systemColorScheme","colorScheme","setColorScheme","themesAssets","colors","Provider","value","radius","fontFamily","letterSpacing","fontSize","children","useTheme","context","Error"],"sourceRoot":"../../../src","sources":["themes/provider.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAA0BC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC9F,SAASC,cAAc,QAAQ,cAAc;AAC7C,SAASC,MAAM;AAAmB,SAAAC,GAAA,IAAAC,IAAA;AAelC,MAAMC,YAAY,gBAAGR,aAAa,CAAsB,IAAI,CAAC;AAE7D,OAAO,MAAMS,aAAa,GAAIC,KAAwB,IAAK;EACzD,MAAM,CAACC,SAAS,EAAEC,QAAQ,CAAC,GAAGT,QAAQ,CAAY,SAAS,CAAC;EAE5D,MAAMU,iBAAiB,GAAGT,cAAc,CAAC,CAAC;EAC1C,MAAM,CAACU,WAAW,EAAEC,cAAc,CAAC,GAAGZ,QAAQ,CAAcU,iBAAiB,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;EAE5G,MAAMG,YAAY,GAAGX,MAAM,CAACM,SAAS,CAAC;EACtC,MAAMM,MAAM,GAAGD,YAAY,CAACC,MAAM,CAACH,WAAW,CAAC;EAE/CZ,SAAS,CAAC,MAAM;IACd,IAAIW,iBAAiB,EAAE;MACrBE,cAAc,CAACF,iBAAiB,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjE;EACF,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,oBACEN,IAAA,CAACC,YAAY,CAACU,QAAQ;IACpBC,KAAK,EAAE;MACLR,SAAS;MACTC,QAAQ;MACRE,WAAW;MACXC,cAAc;MACdE,MAAM;MACNG,MAAM,EAAEJ,YAAY,CAACI,MAAM;MAC3BC,UAAU,EAAEL,YAAY,CAACK,UAAU;MACnCC,aAAa,EAAEN,YAAY,CAACM,aAAa;MACzCC,QAAQ,EAAEP,YAAY,CAACO;IACzB,CAAE;IAAAC,QAAA,EAEDd,KAAK,CAACc;EAAQ,CACM,CAAC;AAE5B,CAAC;AAED,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAM;EAC5B,MAAMC,OAAO,GAAGzB,UAAU,CAACO,YAAY,CAAC;EACxC,IAAI,CAACkB,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;EACjE;EACA,OAAOD,OAAO;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useContext","useEffect","useState","useColorScheme","defaultThemeAssets","mergeThemeAssets","jsx","_jsx","ThemeContext","ThemeProvider","props","children","theme","systemColorScheme","colorScheme","setColorScheme","themeAssets","colors","Provider","value","radius","fontFamily","letterSpacing","fontSize","useTheme","context","Error"],"sourceRoot":"../../../src","sources":["themes/provider.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAA0BC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC9F,SAASC,cAAc,QAAQ,cAAc;AAC7C,SAASC,kBAAkB;AAE3B,SAASC,gBAAgB;AAAkB,SAAAC,GAAA,IAAAC,IAAA;AAY3C,MAAMC,YAAY,gBAAGT,aAAa,CAAsB,IAAI,CAAC;AAM7D,OAAO,MAAMU,aAAa,GAAIC,KAAyB,IAAK;EAC1D,MAAM;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAGF,KAAK;EAEjC,MAAMG,iBAAiB,GAAGV,cAAc,CAAC,CAAC;EAC1C,MAAM,CAACW,WAAW,EAAEC,cAAc,CAAC,GAAGb,QAAQ,CAAcW,iBAAiB,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;EAE5G,MAAMG,WAAW,GAAGJ,KAAK,GAAGP,gBAAgB,CAACD,kBAAkB,EAAEQ,KAAK,CAAC,GAAGR,kBAAkB;EAE5F,MAAMa,MAAM,GAAGD,WAAW,CAACC,MAAM,CAACH,WAAW,CAAC;EAE9Cb,SAAS,CAAC,MAAM;IACd,IAAIY,iBAAiB,EAAE;MACrBE,cAAc,CAACF,iBAAiB,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjE;EACF,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,oBACEN,IAAA,CAACC,YAAY,CAACU,QAAQ;IACpBC,KAAK,EAAE;MACLL,WAAW;MACXC,cAAc;MACdE,MAAM;MACNG,MAAM,EAAEJ,WAAW,CAACI,MAAM;MAC1BC,UAAU,EAAEL,WAAW,CAACK,UAAU;MAClCC,aAAa,EAAEN,WAAW,CAACM,aAAa;MACxCC,QAAQ,EAAEP,WAAW,CAACO;IACxB,CAAE;IAAAZ,QAAA,EAEDA;EAAQ,CACY,CAAC;AAE5B,CAAC;AAED,OAAO,MAAMa,QAAQ,GAAGA,CAAA,KAAM;EAC5B,MAAMC,OAAO,GAAGzB,UAAU,CAACQ,YAAY,CAAC;EACxC,IAAI,CAACiB,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;EACjE;EACA,OAAOD,OAAO;AAChB,CAAC","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ export function mergeThemeAssets(base, override) {
4
+ return {
5
+ colors: {
6
+ light: {
7
+ ...base.colors.light,
8
+ ...override.colors?.light
9
+ },
10
+ dark: {
11
+ ...base.colors.dark,
12
+ ...override.colors?.dark
13
+ }
14
+ },
15
+ radius: override.radius ?? base.radius,
16
+ fontFamily: override.fontFamily ?? base.fontFamily,
17
+ letterSpacing: override.letterSpacing ?? base.letterSpacing,
18
+ fontSize: override.fontSize ?? base.fontSize
19
+ };
20
+ }
21
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["mergeThemeAssets","base","override","colors","light","dark","radius","fontFamily","letterSpacing","fontSize"],"sourceRoot":"../../../src","sources":["themes/utils.ts"],"mappings":";;AAEA,OAAO,SAASA,gBAAgBA,CAACC,IAAiB,EAAEC,QAA8B,EAAe;EAC/F,OAAO;IACLC,MAAM,EAAE;MACNC,KAAK,EAAE;QAAE,GAAGH,IAAI,CAACE,MAAM,CAACC,KAAK;QAAE,GAAGF,QAAQ,CAACC,MAAM,EAAEC;MAAM,CAAC;MAC1DC,IAAI,EAAE;QAAE,GAAGJ,IAAI,CAACE,MAAM,CAACE,IAAI;QAAE,GAAGH,QAAQ,CAACC,MAAM,EAAEE;MAAK;IACxD,CAAC;IACDC,MAAM,EAAEJ,QAAQ,CAACI,MAAM,IAAIL,IAAI,CAACK,MAAM;IACtCC,UAAU,EAAEL,QAAQ,CAACK,UAAU,IAAIN,IAAI,CAACM,UAAU;IAClDC,aAAa,EAAEN,QAAQ,CAACM,aAAa,IAAIP,IAAI,CAACO,aAAa;IAC3DC,QAAQ,EAAEP,QAAQ,CAACO,QAAQ,IAAIR,IAAI,CAACQ;EACtC,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"toast-manager.d.ts","sourceRoot":"","sources":["../../../../../src/components/toast/toast-manager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA2BD,iBAAS,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAuB7C;AAED,iBAAS,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAGrC;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAC;AAEF,wBAAgB,cAAc,6BAc7B"}
1
+ {"version":3,"file":"toast-manager.d.ts","sourceRoot":"","sources":["../../../../../src/components/toast/toast-manager.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA2BD,iBAAS,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAuB7C;AAED,iBAAS,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAGrC;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAC;AAEF,wBAAgB,cAAc,6BAe7B"}
@@ -1,10 +1,16 @@
1
+ import { type SafeAreaInsets } from "./safe-area";
2
+ import { type ThemeProviderProps } from "./themes";
1
3
  import { type PortalHostProps } from "./primitives/portal/portal.constants";
2
4
  export interface ProviderProps {
3
5
  children: React.ReactNode;
4
6
  portalContainer?: PortalHostProps["container"];
7
+ theme?: ThemeProviderProps["theme"];
8
+ safeAreaInsets?: SafeAreaInsets;
5
9
  }
6
- export declare const UniversalUIProvider: ({ children, portalContainer }: ProviderProps) => import("react").JSX.Element;
10
+ export declare const UniversalUIProvider: ({ children, portalContainer, theme, safeAreaInsets }: ProviderProps) => import("react").JSX.Element;
7
11
  export * from "./themes/adapters";
12
+ export * from "./themes/default";
8
13
  export { useTheme } from "./themes/provider";
9
14
  export * from "./themes/types";
15
+ export * from "./safe-area";
10
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAE5E,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,eAAe,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;CAChD;AAED,eAAO,MAAM,mBAAmB,GAAI,+BAA+B,aAAa,gCAS/E,CAAC;AAEF,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIlE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAE5E,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IAC/C,KAAK,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,eAAO,MAAM,mBAAmB,GAAI,sDAAsD,aAAa,gCAWtG,CAAC;AAEF,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,aAAa,CAAC"}
@@ -2,7 +2,6 @@ import React from "react";
2
2
  import { type StyleProp, type TextStyle } from "react-native";
3
3
  export interface AvatarFallbackProps {
4
4
  children: string;
5
- render?: (props: AvatarFallbackProps) => React.ReactNode;
6
5
  style?: StyleProp<TextStyle>;
7
6
  }
8
7
  export declare function AvatarFallback(props: AvatarFallbackProps): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"avatar-fallback.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/avatar/avatar-fallback.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAQ,MAAM,cAAc,CAAC;AAGpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,KAAK,CAAC,SAAS,CAAC;IACzD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAKxD"}
1
+ {"version":3,"file":"avatar-fallback.d.ts","sourceRoot":"","sources":["../../../../../src/primitives/avatar/avatar-fallback.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAIxD"}
@@ -0,0 +1,5 @@
1
+ import type { SafeAreaContextValue } from "./types";
2
+ declare const SafeAreaContext: import("react").Context<SafeAreaContextValue | null>;
3
+ export declare const useSafeAreaInsets: () => import("./types").SafeAreaInsets;
4
+ export { SafeAreaContext };
5
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/safe-area/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,QAAA,MAAM,eAAe,sDAAmD,CAAC;AAEzE,eAAO,MAAM,iBAAiB,wCAM7B,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { SafeAreaProvider } from "./provider";
2
+ export { useSafeAreaInsets } from "./context";
3
+ export type { SafeAreaInsets, SafeAreaContextValue } from "./types";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/safe-area/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type PropsWithChildren } from "react";
2
+ import type { SafeAreaInsets } from "./types";
3
+ export interface SafeAreaProviderProps extends PropsWithChildren {
4
+ insets?: SafeAreaInsets;
5
+ }
6
+ export declare const SafeAreaProvider: ({ children, insets }: SafeAreaProviderProps) => import("react").JSX.Element;
7
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/safe-area/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB,GAAI,sBAAsB,qBAAqB,gCAmB3E,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface SafeAreaInsets {
2
+ top: number;
3
+ bottom: number;
4
+ left: number;
5
+ right: number;
6
+ }
7
+ export interface SafeAreaContextValue {
8
+ insets: SafeAreaInsets;
9
+ }
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/safe-area/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,cAAc,CAAC;CACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"react-navigation.d.ts","sourceRoot":"","sources":["../../../../../src/themes/adapters/react-navigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAItD,wBAAgB,uBAAuB,IAAI,KAAK,CA+C/C"}
1
+ {"version":3,"file":"react-navigation.d.ts","sourceRoot":"","sources":["../../../../../src/themes/adapters/react-navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAKtD,wBAAgB,uBAAuB,IAAI,KAAK,CAgD/C"}
@@ -1,5 +1,5 @@
1
1
  import { type PropsWithChildren } from "react";
2
- import type { Colors, ColorScheme, FontFamily, FontSize, LetterSpacing, Radius, ThemeName } from "./types";
2
+ import type { Colors, ColorScheme, FontFamily, FontSize, LetterSpacing, Radius, ThemeAssets } from "./types";
3
3
  interface ThemeContext {
4
4
  colors: Colors;
5
5
  radius: Radius;
@@ -8,11 +8,12 @@ interface ThemeContext {
8
8
  letterSpacing: LetterSpacing;
9
9
  fontSize: FontSize;
10
10
  setColorScheme: (scheme: ColorScheme) => void;
11
- setTheme: (themeName: ThemeName) => void;
12
- themeName: ThemeName;
13
11
  }
14
12
  declare const ThemeContext: import("react").Context<ThemeContext | null>;
15
- export declare const ThemeProvider: (props: PropsWithChildren) => import("react").JSX.Element;
13
+ export interface ThemeProviderProps extends PropsWithChildren {
14
+ theme?: Partial<ThemeAssets>;
15
+ }
16
+ export declare const ThemeProvider: (props: ThemeProviderProps) => import("react").JSX.Element;
16
17
  export declare const useTheme: () => ThemeContext;
17
18
  export {};
18
19
  //# sourceMappingURL=provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/themes/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAmC,MAAM,OAAO,CAAC;AAG/F,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3G,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,QAAA,MAAM,YAAY,8CAA2C,CAAC;AAE9D,eAAO,MAAM,aAAa,GAAI,OAAO,iBAAiB,gCAgCrD,CAAC;AAEF,eAAO,MAAM,QAAQ,oBAMpB,CAAC"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/themes/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAmC,MAAM,OAAO,CAAC;AAG/F,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG7G,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC/C;AAED,QAAA,MAAM,YAAY,8CAA2C,CAAC;AAE9D,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,gCA+BtD,CAAC;AAEF,eAAO,MAAM,QAAQ,oBAMpB,CAAC"}
@@ -1,4 +1,3 @@
1
- export type ThemeName = "default";
2
1
  export type ColorScheme = "light" | "dark";
3
2
  type Color = `hsla(${number}, ${number}%, ${number}%, ${number})`;
4
3
  export interface Colors {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/themes/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC;AAClC,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,KAAK,KAAK,GAAG,QAAQ,MAAM,KAAK,MAAM,MAAM,MAAM,MAAM,MAAM,GAAG,CAAC;AAElE,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,KAAK,CAAC;IAClB,UAAU,EAAE,KAAK,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC;IACf,iBAAiB,EAAE,KAAK,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC;IACjB,mBAAmB,EAAE,KAAK,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,eAAe,EAAE,KAAK,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;CACb;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;CACpB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/themes/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,KAAK,KAAK,GAAG,QAAQ,MAAM,KAAK,MAAM,MAAM,MAAM,MAAM,MAAM,GAAG,CAAC;AAElE,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,KAAK,CAAC;IAClB,UAAU,EAAE,KAAK,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC;IACf,iBAAiB,EAAE,KAAK,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC;IACjB,mBAAmB,EAAE,KAAK,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,eAAe,EAAE,KAAK,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;CACb;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ import type { ThemeAssets } from "./types";
2
+ export declare function mergeThemeAssets(base: ThemeAssets, override: Partial<ThemeAssets>): ThemeAssets;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/themes/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAW/F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@korsolutions/ui",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,7 +30,7 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
30
30
  },
31
31
  label: {
32
32
  default: {
33
- color: colors.foreground,
33
+ color: colors.secondaryForeground,
34
34
  fontSize,
35
35
  fontWeight: "bold",
36
36
  fontFamily,
@@ -44,7 +44,7 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
44
44
  },
45
45
  spinner: {
46
46
  default: {
47
- color: colors.primaryForeground,
47
+ color: colors.secondaryForeground,
48
48
  },
49
49
  disabled: {
50
50
  color: colors.mutedForeground,
@@ -53,6 +53,6 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
53
53
  color: colors.mutedForeground,
54
54
  },
55
55
  },
56
- })
56
+ }),
57
57
  );
58
58
  };
@@ -1,8 +1,9 @@
1
+ import { Portal } from "@/primitives/portal";
2
+ import { useSafeAreaInsets } from "@/safe-area";
1
3
  import React, { useSyncExternalStore } from "react";
2
- import { View, StyleSheet } from "react-native";
4
+ import { StyleSheet, View } from "react-native";
3
5
  import { ToastComponent } from "./toast";
4
6
  import { ToastVariants } from "./variants";
5
- import { Portal } from "@/primitives/portal";
6
7
 
7
8
  export const TOAST_PORTAL_NAME = "toast-portal";
8
9
 
@@ -76,12 +77,13 @@ export const ToastAPI = {
76
77
 
77
78
  export function ToastContainer() {
78
79
  const toasts = useSyncExternalStore(subscribe, getSnapshot);
80
+ const insets = useSafeAreaInsets();
79
81
 
80
82
  if (!toasts.length) return null;
81
83
 
82
84
  return (
83
85
  <Portal name={TOAST_PORTAL_NAME}>
84
- <View style={s.wrapper}>
86
+ <View style={[s.wrapper, { top: insets.top + 24 }]}>
85
87
  {toasts.map((toast) => (
86
88
  <ToastComponent key={toast.id} title={toast.title} description={toast.description} variant={toast.variant} />
87
89
  ))}
@@ -95,7 +97,6 @@ const s = StyleSheet.create({
95
97
  width: "100%",
96
98
  alignItems: "center",
97
99
  position: "absolute",
98
- top: 24,
99
100
  gap: 8,
100
101
  },
101
102
  });
package/src/index.tsx CHANGED
@@ -1,4 +1,5 @@
1
- import { ThemeProvider } from "@/themes";
1
+ import { SafeAreaProvider, type SafeAreaInsets } from "@/safe-area";
2
+ import { ThemeProvider, type ThemeProviderProps } from "@/themes";
2
3
  import { AsyncAlertDialogManager } from "./components/alert-dialog/async-alert-dialog";
3
4
  import { ToastContainer } from "./components/toast/toast-manager";
4
5
  import { PortalHost } from "./primitives/portal";
@@ -6,21 +7,27 @@ import { type PortalHostProps } from "./primitives/portal/portal.constants";
6
7
 
7
8
  export interface ProviderProps {
8
9
  children: React.ReactNode;
9
-
10
10
  portalContainer?: PortalHostProps["container"];
11
+ theme?: ThemeProviderProps["theme"];
12
+ safeAreaInsets?: SafeAreaInsets;
11
13
  }
12
14
 
13
- export const UniversalUIProvider = ({ children, portalContainer }: ProviderProps) => {
15
+ export const UniversalUIProvider = ({ children, portalContainer, theme, safeAreaInsets }: ProviderProps) => {
14
16
  return (
15
- <ThemeProvider>
16
- <ToastContainer />
17
- {children}
18
- <PortalHost container={portalContainer} />
19
- <AsyncAlertDialogManager />
20
- </ThemeProvider>
17
+ <SafeAreaProvider insets={safeAreaInsets}>
18
+ <ThemeProvider theme={theme}>
19
+ <ToastContainer />
20
+ {children}
21
+ <PortalHost container={portalContainer} />
22
+ <AsyncAlertDialogManager />
23
+ </ThemeProvider>
24
+ </SafeAreaProvider>
21
25
  );
22
26
  };
23
27
 
24
28
  export * from "./themes/adapters";
29
+ export * from "./themes/default";
25
30
  export { useTheme } from "./themes/provider";
26
31
  export * from "./themes/types";
32
+
33
+ export * from "./safe-area";
@@ -1,16 +1,14 @@
1
1
  import React from "react";
2
- import { type StyleProp, type TextStyle, View } from "react-native";
2
+ import { Text, type StyleProp, type TextStyle } from "react-native";
3
3
  import { useAvatar } from "./context";
4
4
 
5
5
  export interface AvatarFallbackProps {
6
6
  children: string;
7
- render?: (props: AvatarFallbackProps) => React.ReactNode;
8
7
  style?: StyleProp<TextStyle>;
9
8
  }
10
9
 
11
10
  export function AvatarFallback(props: AvatarFallbackProps) {
12
11
  const avatar = useAvatar();
13
12
  const composedStyles = [avatar.styles?.fallback, props.style];
14
- const Component = props.render ?? View;
15
- return <Component {...props} style={composedStyles} />;
13
+ return <Text {...props} style={composedStyles} />;
16
14
  }
@@ -0,0 +1,14 @@
1
+ import { createContext, useContext } from "react";
2
+ import type { SafeAreaContextValue } from "./types";
3
+
4
+ const SafeAreaContext = createContext<SafeAreaContextValue | null>(null);
5
+
6
+ export const useSafeAreaInsets = () => {
7
+ const context = useContext(SafeAreaContext);
8
+ if (!context) {
9
+ throw new Error("useSafeAreaInsets must be used within SafeAreaProvider");
10
+ }
11
+ return context.insets;
12
+ };
13
+
14
+ export { SafeAreaContext };
@@ -0,0 +1,3 @@
1
+ export { SafeAreaProvider } from "./provider";
2
+ export { useSafeAreaInsets } from "./context";
3
+ export type { SafeAreaInsets, SafeAreaContextValue } from "./types";
@@ -0,0 +1,28 @@
1
+ import { type PropsWithChildren } from "react";
2
+ import { SafeAreaContext } from "./context";
3
+ import type { SafeAreaInsets } from "./types";
4
+
5
+ export interface SafeAreaProviderProps extends PropsWithChildren {
6
+ insets?: SafeAreaInsets;
7
+ }
8
+
9
+ export const SafeAreaProvider = ({ children, insets }: SafeAreaProviderProps) => {
10
+ const defaultInsets: SafeAreaInsets = {
11
+ top: 0,
12
+ bottom: 0,
13
+ left: 0,
14
+ right: 0,
15
+ };
16
+
17
+ const calculatedInsets: SafeAreaInsets = { ...defaultInsets, ...insets };
18
+
19
+ return (
20
+ <SafeAreaContext.Provider
21
+ value={{
22
+ insets: calculatedInsets,
23
+ }}
24
+ >
25
+ {children}
26
+ </SafeAreaContext.Provider>
27
+ );
28
+ };
@@ -0,0 +1,10 @@
1
+ export interface SafeAreaInsets {
2
+ top: number;
3
+ bottom: number;
4
+ left: number;
5
+ right: number;
6
+ }
7
+
8
+ export interface SafeAreaContextValue {
9
+ insets: SafeAreaInsets;
10
+ }
@@ -1,7 +1,7 @@
1
- import { useEffect } from "react";
2
1
  import type { Theme } from "@react-navigation/native";
3
- import { useTheme } from "../provider";
2
+ import { useEffect } from "react";
4
3
  import { Platform } from "react-native";
4
+ import { useTheme } from "../provider";
5
5
 
6
6
  export function useReactNavigationTheme(): Theme {
7
7
  const theme = useTheme();
@@ -13,13 +13,14 @@ export function useReactNavigationTheme(): Theme {
13
13
  styles.innerHTML = `
14
14
  :root {
15
15
  --expo-router-modal-border: 1px solid ${theme.colors.border};
16
+ --expo-router-modal-border-radius: ${theme.radius}px;
16
17
  }
17
18
  `;
18
19
  document.head.appendChild(styles);
19
20
  return () => {
20
21
  document.head.removeChild(styles);
21
22
  };
22
- }, [theme.colors.border]);
23
+ }, [theme.colors.border, theme.radius]);
23
24
 
24
25
  return {
25
26
  dark: theme.colorScheme === "dark",
@@ -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
- };