@korsolutions/ui 0.0.26 → 0.0.28
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/components/index.mjs +6 -3
- package/dist/index.d.mts +12 -1
- package/dist/index.mjs +3 -3
- package/dist/primitives/index.mjs +1 -1
- package/dist/{primitives-CB1VBoeH.mjs → primitives-8eataXpJ.mjs} +1 -1
- package/dist/{toast-manager-Bn8NB8Ie.mjs → toast-manager-q0YV3t3j.mjs} +51 -3
- package/package.json +1 -1
- package/src/components/popover/variants/default.tsx +1 -0
- package/src/index.tsx +3 -1
- package/src/primitives/popover/popover-trigger.tsx +1 -1
- package/src/themes/adapters/index.ts +1 -0
- package/src/themes/adapters/react-navigation.ts +52 -0
- package/src/themes/index.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as useThemedStyles, r as ToastComponent, t as ToastAPI } from "../toast-manager-
|
|
2
|
-
import { a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-
|
|
1
|
+
import { i as useThemedStyles, r as ToastComponent, t as ToastAPI } from "../toast-manager-q0YV3t3j.mjs";
|
|
2
|
+
import { a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-8eataXpJ.mjs";
|
|
3
3
|
import "../use-relative-position-BTKEyT1F.mjs";
|
|
4
4
|
import { t as useNumericMask } from "../use-numeric-mask-BQlz1Pus.mjs";
|
|
5
5
|
import React, { forwardRef, useEffect, useState } from "react";
|
|
@@ -777,7 +777,10 @@ function DropdownMenu(props) {
|
|
|
777
777
|
//#region src/components/popover/variants/default.tsx
|
|
778
778
|
const usePopoverVariantDefault = () => {
|
|
779
779
|
return useThemedStyles(({ colors, radius }) => ({
|
|
780
|
-
overlay: {
|
|
780
|
+
overlay: {
|
|
781
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
782
|
+
zIndex: 999
|
|
783
|
+
},
|
|
781
784
|
content: {
|
|
782
785
|
backgroundColor: colors.surface,
|
|
783
786
|
borderRadius: radius,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { n as PortalHostProps } from "./portal.constants-ClRV24_C.mjs";
|
|
2
2
|
import * as react4 from "react";
|
|
3
|
+
import { Theme } from "@react-navigation/native";
|
|
3
4
|
|
|
4
5
|
//#region src/themes/types.d.ts
|
|
5
6
|
type ThemeName = "default";
|
|
@@ -25,6 +26,13 @@ type Radius = number;
|
|
|
25
26
|
type FontFamily = string;
|
|
26
27
|
type LetterSpacing = number;
|
|
27
28
|
type FontSize = number;
|
|
29
|
+
interface ThemeAssets {
|
|
30
|
+
colors: Record<ColorScheme, Colors>;
|
|
31
|
+
radius: Radius;
|
|
32
|
+
fontFamily: FontFamily;
|
|
33
|
+
letterSpacing: LetterSpacing;
|
|
34
|
+
fontSize: FontSize;
|
|
35
|
+
}
|
|
28
36
|
//#endregion
|
|
29
37
|
//#region src/themes/provider.d.ts
|
|
30
38
|
interface ThemeContext {
|
|
@@ -41,6 +49,9 @@ interface ThemeContext {
|
|
|
41
49
|
declare const ThemeContext: react4.Context<ThemeContext | null>;
|
|
42
50
|
declare const useTheme: () => ThemeContext;
|
|
43
51
|
//#endregion
|
|
52
|
+
//#region src/themes/adapters/react-navigation.d.ts
|
|
53
|
+
declare function useReactNavigationTheme(): Theme;
|
|
54
|
+
//#endregion
|
|
44
55
|
//#region src/index.d.ts
|
|
45
56
|
interface ProviderProps {
|
|
46
57
|
children: React.ReactNode;
|
|
@@ -51,4 +62,4 @@ declare const UniversalUIProvider: ({
|
|
|
51
62
|
portalContainer
|
|
52
63
|
}: ProviderProps) => react4.JSX.Element;
|
|
53
64
|
//#endregion
|
|
54
|
-
export { ProviderProps, UniversalUIProvider, useTheme };
|
|
65
|
+
export { ColorScheme, Colors, FontFamily, FontSize, LetterSpacing, ProviderProps, Radius, ThemeAssets, ThemeName, UniversalUIProvider, useReactNavigationTheme, useTheme };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { g as PortalHost } from "./primitives-
|
|
1
|
+
import { a as useReactNavigationTheme, n as ToastContainer, o as ThemeProvider, s as useTheme } from "./toast-manager-q0YV3t3j.mjs";
|
|
2
|
+
import { g as PortalHost } from "./primitives-8eataXpJ.mjs";
|
|
3
3
|
import "./use-relative-position-BTKEyT1F.mjs";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
@@ -13,4 +13,4 @@ const UniversalUIProvider = ({ children, portalContainer }) => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
|
-
export { UniversalUIProvider, useTheme };
|
|
16
|
+
export { UniversalUIProvider, useReactNavigationTheme, useTheme };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as DEFAULT_PORTAL_HOST, a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, g as PortalHost, h as Portal, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, s as ToastPrimitive, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-
|
|
1
|
+
import { _ as DEFAULT_PORTAL_HOST, a as TextareaPrimitive, c as AvatarPrimitive, d as SelectPrimitive, f as ButtonPrimitive, g as PortalHost, h as Portal, i as DropdownMenuPrimitive, l as EmptyPrimitive, m as FieldPrimitive, n as PopoverPrimitive, o as BadgePrimitive, p as InputPrimitive, r as usePopover, s as ToastPrimitive, t as CalendarPrimitive, u as CardPrimitive } from "../primitives-8eataXpJ.mjs";
|
|
2
2
|
import "../use-relative-position-BTKEyT1F.mjs";
|
|
3
3
|
|
|
4
4
|
export { AvatarPrimitive, BadgePrimitive, ButtonPrimitive, CalendarPrimitive, CardPrimitive, DEFAULT_PORTAL_HOST, DropdownMenuPrimitive, EmptyPrimitive, FieldPrimitive, InputPrimitive, PopoverPrimitive, Portal, PortalHost, SelectPrimitive, TextareaPrimitive, ToastPrimitive, usePopover };
|
|
@@ -1002,7 +1002,7 @@ const PopoverTrigger = forwardRef((props, ref) => {
|
|
|
1002
1002
|
const popover = usePopover();
|
|
1003
1003
|
const triggerRef = useRef(null);
|
|
1004
1004
|
const onTriggerPress = async () => {
|
|
1005
|
-
triggerRef.current?.
|
|
1005
|
+
triggerRef.current?.measureInWindow((pageX, pageY, width, height) => {
|
|
1006
1006
|
popover.setTriggerPosition({
|
|
1007
1007
|
height,
|
|
1008
1008
|
width,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as Portal, s as ToastPrimitive } from "./primitives-
|
|
1
|
+
import { h as Portal, s as ToastPrimitive } from "./primitives-8eataXpJ.mjs";
|
|
2
2
|
import React, { createContext, useContext, useEffect, useState, useSyncExternalStore } from "react";
|
|
3
|
-
import { StyleSheet, View, useColorScheme } from "react-native";
|
|
3
|
+
import { Platform, StyleSheet, View, useColorScheme } from "react-native";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/themes/default/colors.ts
|
|
@@ -87,6 +87,54 @@ const useTheme = () => {
|
|
|
87
87
|
return context;
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/themes/adapters/react-navigation.ts
|
|
92
|
+
function useReactNavigationTheme() {
|
|
93
|
+
const theme = useTheme();
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (Platform.OS !== "web") return;
|
|
96
|
+
const styles = document.createElement("style");
|
|
97
|
+
styles.innerHTML = `
|
|
98
|
+
:root {
|
|
99
|
+
--expo-router-modal-border: 1px solid ${theme.colors.border};
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
document.head.appendChild(styles);
|
|
103
|
+
return () => {
|
|
104
|
+
document.head.removeChild(styles);
|
|
105
|
+
};
|
|
106
|
+
}, [theme.colors.border]);
|
|
107
|
+
return {
|
|
108
|
+
dark: theme.colorScheme === "dark",
|
|
109
|
+
colors: {
|
|
110
|
+
background: theme.colors.background,
|
|
111
|
+
border: theme.colors.border,
|
|
112
|
+
primary: theme.colors.primary,
|
|
113
|
+
card: theme.colors.surface,
|
|
114
|
+
text: theme.colors.foreground,
|
|
115
|
+
notification: theme.colors.danger
|
|
116
|
+
},
|
|
117
|
+
fonts: {
|
|
118
|
+
heavy: {
|
|
119
|
+
fontFamily: theme.fontFamily,
|
|
120
|
+
fontWeight: "800"
|
|
121
|
+
},
|
|
122
|
+
bold: {
|
|
123
|
+
fontFamily: theme.fontFamily,
|
|
124
|
+
fontWeight: "700"
|
|
125
|
+
},
|
|
126
|
+
medium: {
|
|
127
|
+
fontFamily: theme.fontFamily,
|
|
128
|
+
fontWeight: "500"
|
|
129
|
+
},
|
|
130
|
+
regular: {
|
|
131
|
+
fontFamily: theme.fontFamily,
|
|
132
|
+
fontWeight: "400"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
90
138
|
//#endregion
|
|
91
139
|
//#region src/utils/use-themed-styles.ts
|
|
92
140
|
const useThemedStyles = (callback) => {
|
|
@@ -270,4 +318,4 @@ const s = StyleSheet.create({ wrapper: {
|
|
|
270
318
|
} });
|
|
271
319
|
|
|
272
320
|
//#endregion
|
|
273
|
-
export {
|
|
321
|
+
export { useReactNavigationTheme as a, useThemedStyles as i, ToastContainer as n, ThemeProvider as o, ToastComponent as r, useTheme as s, ToastAPI as t };
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -16,7 +16,7 @@ export const PopoverTrigger = forwardRef<PopoverTriggerRef, PopoverTriggerProps>
|
|
|
16
16
|
const triggerRef = useRef<View>(null);
|
|
17
17
|
|
|
18
18
|
const onTriggerPress = async () => {
|
|
19
|
-
triggerRef.current?.
|
|
19
|
+
triggerRef.current?.measureInWindow((pageX, pageY, width, height) => {
|
|
20
20
|
popover.setTriggerPosition({
|
|
21
21
|
height,
|
|
22
22
|
width,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./react-navigation";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { Theme } from "@react-navigation/native";
|
|
3
|
+
import { useTheme } from "../provider";
|
|
4
|
+
import { Platform } from "react-native";
|
|
5
|
+
|
|
6
|
+
export function useReactNavigationTheme(): Theme {
|
|
7
|
+
const theme = useTheme();
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (Platform.OS !== "web") return;
|
|
11
|
+
const styles = document.createElement("style");
|
|
12
|
+
styles.innerHTML = `
|
|
13
|
+
:root {
|
|
14
|
+
--expo-router-modal-border: 1px solid ${theme.colors.border};
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
document.head.appendChild(styles);
|
|
18
|
+
return () => {
|
|
19
|
+
document.head.removeChild(styles);
|
|
20
|
+
};
|
|
21
|
+
}, [theme.colors.border]);
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
dark: theme.colorScheme === "dark",
|
|
25
|
+
colors: {
|
|
26
|
+
background: theme.colors.background,
|
|
27
|
+
border: theme.colors.border,
|
|
28
|
+
primary: theme.colors.primary,
|
|
29
|
+
card: theme.colors.surface,
|
|
30
|
+
text: theme.colors.foreground,
|
|
31
|
+
notification: theme.colors.danger,
|
|
32
|
+
},
|
|
33
|
+
fonts: {
|
|
34
|
+
heavy: {
|
|
35
|
+
fontFamily: theme.fontFamily,
|
|
36
|
+
fontWeight: "800",
|
|
37
|
+
},
|
|
38
|
+
bold: {
|
|
39
|
+
fontFamily: theme.fontFamily,
|
|
40
|
+
fontWeight: "700",
|
|
41
|
+
},
|
|
42
|
+
medium: {
|
|
43
|
+
fontFamily: theme.fontFamily,
|
|
44
|
+
fontWeight: "500",
|
|
45
|
+
},
|
|
46
|
+
regular: {
|
|
47
|
+
fontFamily: theme.fontFamily,
|
|
48
|
+
fontWeight: "400",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
package/src/themes/index.ts
CHANGED