@korsolutions/ui 0.0.13 → 0.0.15
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as FieldStyles, C as SelectStyles, F as InputPrimitiveBaseProps, L as InputStyles, M as ButtonStyles, c as EmptyStyles, m as CardStyles, r as AvatarStyles, x as SelectRootBaseProps } from "../index-
|
|
1
|
+
import { B as FieldStyles, C as SelectStyles, F as InputPrimitiveBaseProps, L as InputStyles, M as ButtonStyles, c as EmptyStyles, m as CardStyles, r as AvatarStyles, x as SelectRootBaseProps } from "../index-DugKbl7Y.mjs";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ImageSource, TextProps, TextStyle } from "react-native";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react2 from "react";
|
|
2
2
|
import React$1 from "react";
|
|
3
3
|
import { ImageSource, ImageStyle, StyleProp, TextInputProps, TextProps, TextStyle, ViewStyle } from "react-native";
|
|
4
4
|
|
|
@@ -65,7 +65,7 @@ interface InputPrimitiveProps extends InputPrimitiveBaseProps {
|
|
|
65
65
|
render?: (props: InputPrimitiveProps) => React.ReactNode;
|
|
66
66
|
styles?: InputStyles;
|
|
67
67
|
}
|
|
68
|
-
declare function InputPrimitive(props: InputPrimitiveProps):
|
|
68
|
+
declare function InputPrimitive(props: InputPrimitiveProps): react2.JSX.Element;
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/primitives/button/button-label.d.ts
|
|
71
71
|
interface ButtonPrimitiveLabelProps {
|
|
@@ -152,7 +152,7 @@ interface SelectOptionProps {
|
|
|
152
152
|
render?: (props: SelectOptionProps) => React.ReactElement;
|
|
153
153
|
style?: StyleProp<TextStyle>;
|
|
154
154
|
}
|
|
155
|
-
declare function SelectOption(props: SelectOptionProps):
|
|
155
|
+
declare function SelectOption(props: SelectOptionProps): react2.JSX.Element;
|
|
156
156
|
//#endregion
|
|
157
157
|
//#region src/primitives/select/types.d.ts
|
|
158
158
|
type SelectState = "default" | "disabled";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react0 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/themes/types.d.ts
|
|
4
4
|
type ThemeName = "default";
|
|
@@ -37,7 +37,7 @@ interface ThemeContext {
|
|
|
37
37
|
setTheme: (themeName: ThemeName) => void;
|
|
38
38
|
themeName: ThemeName;
|
|
39
39
|
}
|
|
40
|
-
declare const ThemeContext:
|
|
40
|
+
declare const ThemeContext: react0.Context<ThemeContext | null>;
|
|
41
41
|
declare const useTheme: () => ThemeContext;
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/index.d.ts
|
|
@@ -45,6 +45,6 @@ declare const UniversalUIProvider: ({
|
|
|
45
45
|
children
|
|
46
46
|
}: {
|
|
47
47
|
children: React.ReactNode;
|
|
48
|
-
}) =>
|
|
48
|
+
}) => react0.JSX.Element;
|
|
49
49
|
//#endregion
|
|
50
50
|
export { UniversalUIProvider, useTheme };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as ButtonPrimitiveRootProps, B as FieldStyles, C as SelectStyles, D as SelectValueProps, E as SelectOverlayProps, F as InputPrimitiveBaseProps, H as FieldDescriptionProps, I as InputPrimitiveProps, L as InputStyles, M as ButtonStyles, N as ButtonPrimitiveLabelProps, O as SelectTriggerProps, P as InputPrimitive, R as FieldPrimitive, S as SelectRootProps, T as SelectContentProps, U as FieldLabelProps, V as FieldErrorProps, _ as CardTitleProps, a as AvatarFallbackProps, b as SelectPortalProps, c as EmptyStyles, d as EmptyDescriptionProps, f as CardPrimitive, g as CardBodyProps, h as CardFooterProps, i as AvatarImageProps, j as ButtonState, k as ButtonPrimitive, l as EmptyTitleProps, m as CardStyles, n as AvatarRootProps, o as EmptyPrimitive, p as CardRootProps, r as AvatarStyles, s as EmptyRootProps, t as AvatarPrimitive, u as EmptyMediaProps, v as CardHeaderProps, w as SelectOptionProps, x as SelectRootBaseProps, y as SelectPrimitive, z as FieldPrimitiveRootProps } from "../index-
|
|
1
|
+
import { A as ButtonPrimitiveRootProps, B as FieldStyles, C as SelectStyles, D as SelectValueProps, E as SelectOverlayProps, F as InputPrimitiveBaseProps, H as FieldDescriptionProps, I as InputPrimitiveProps, L as InputStyles, M as ButtonStyles, N as ButtonPrimitiveLabelProps, O as SelectTriggerProps, P as InputPrimitive, R as FieldPrimitive, S as SelectRootProps, T as SelectContentProps, U as FieldLabelProps, V as FieldErrorProps, _ as CardTitleProps, a as AvatarFallbackProps, b as SelectPortalProps, c as EmptyStyles, d as EmptyDescriptionProps, f as CardPrimitive, g as CardBodyProps, h as CardFooterProps, i as AvatarImageProps, j as ButtonState, k as ButtonPrimitive, l as EmptyTitleProps, m as CardStyles, n as AvatarRootProps, o as EmptyPrimitive, p as CardRootProps, r as AvatarStyles, s as EmptyRootProps, t as AvatarPrimitive, u as EmptyMediaProps, v as CardHeaderProps, w as SelectOptionProps, x as SelectRootBaseProps, y as SelectPrimitive, z as FieldPrimitiveRootProps } from "../index-DugKbl7Y.mjs";
|
|
2
2
|
export { AvatarFallbackProps, AvatarImageProps, AvatarPrimitive, AvatarRootProps, AvatarStyles, ButtonPrimitive, ButtonPrimitiveLabelProps, ButtonPrimitiveRootProps, ButtonState, ButtonStyles, CardBodyProps, CardFooterProps, CardHeaderProps, CardPrimitive, CardRootProps, CardStyles, CardTitleProps, EmptyDescriptionProps, EmptyMediaProps, EmptyPrimitive, EmptyRootProps, EmptyStyles, EmptyTitleProps, FieldDescriptionProps, FieldErrorProps, FieldLabelProps, FieldPrimitive, FieldPrimitiveRootProps, FieldStyles, InputPrimitive, InputPrimitiveBaseProps, InputPrimitiveProps, InputStyles, SelectContentProps, SelectOptionProps, SelectOverlayProps, SelectPortalProps, SelectPrimitive, SelectRootBaseProps, SelectRootProps, SelectStyles, SelectTriggerProps, SelectValueProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@korsolutions/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,10 +20,16 @@
|
|
|
20
20
|
"default": "./dist/components/index.mjs",
|
|
21
21
|
"types": "./dist/components/index.d.mts",
|
|
22
22
|
"dev-source": "./src/components/index.ts"
|
|
23
|
+
},
|
|
24
|
+
"./hooks": {
|
|
25
|
+
"default": "./dist/hooks/index.mjs",
|
|
26
|
+
"types": "./dist/hooks/index.d.mts",
|
|
27
|
+
"dev-source": "./src/hooks/index.ts"
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
30
|
"scripts": {
|
|
26
31
|
"build": "tsdown",
|
|
32
|
+
"prepublish": "tsdown",
|
|
27
33
|
"publish": "npm publish --access public",
|
|
28
34
|
"ts-check": "tsc --noEmit"
|
|
29
35
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useScreenSize";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useWindowDimensions } from "react-native";
|
|
2
|
+
|
|
3
|
+
export type ScreenSize = "mobile" | "tablet" | "desktop";
|
|
4
|
+
|
|
5
|
+
interface Response {
|
|
6
|
+
readonly size: ScreenSize;
|
|
7
|
+
readonly width: number;
|
|
8
|
+
readonly height: number;
|
|
9
|
+
readonly isMobile: boolean;
|
|
10
|
+
readonly isTablet: boolean;
|
|
11
|
+
readonly isDesktop: boolean;
|
|
12
|
+
|
|
13
|
+
select<T>(specifics: ({ [size in ScreenSize]?: T } & { default: T }) | { [platform in ScreenSize]: T }): T;
|
|
14
|
+
select<T>(specifics: { [size in ScreenSize]?: T }): T | undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function useScreenSize(): Response {
|
|
18
|
+
const windowDimensions = useWindowDimensions();
|
|
19
|
+
|
|
20
|
+
const size: ScreenSize = windowDimensions.width < 768 ? "mobile" : windowDimensions.width < 1024 ? "tablet" : "desktop";
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
size,
|
|
24
|
+
width: windowDimensions.width,
|
|
25
|
+
height: windowDimensions.height,
|
|
26
|
+
isMobile: size === "mobile",
|
|
27
|
+
isTablet: size === "tablet",
|
|
28
|
+
isDesktop: size === "desktop",
|
|
29
|
+
select: (specifics) => {
|
|
30
|
+
const { mobile, tablet, desktop } = specifics;
|
|
31
|
+
|
|
32
|
+
if (size === "mobile" && mobile !== undefined) return mobile;
|
|
33
|
+
if (size === "tablet" && tablet !== undefined) return tablet;
|
|
34
|
+
if (size === "desktop" && desktop !== undefined) return desktop;
|
|
35
|
+
if (!("default" in specifics)) {
|
|
36
|
+
throw new Error(`Utils.$screenSize.select: No value specified for current screen size: ${size}`);
|
|
37
|
+
}
|
|
38
|
+
return specifics.default;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|