@korsolutions/ui 0.0.15 → 0.0.16

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-DugKbl7Y.mjs";
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-Dyo-iQyH.mjs";
2
2
  import React from "react";
3
3
  import { ImageSource, TextProps, TextStyle } from "react-native";
4
4
 
@@ -1,6 +1,6 @@
1
- import { n as useTheme } from "../themes-DXcjBdO2.mjs";
2
- import "../portal-DoPaAohb.mjs";
3
- import { a as ButtonPrimitive, i as SelectPrimitive, n as EmptyPrimitive, o as InputPrimitive, r as CardPrimitive, s as FieldPrimitive, t as AvatarPrimitive } from "../primitives-DQMWXbuX.mjs";
1
+ import { n as useTheme } from "../themes-pgmHo7MU.mjs";
2
+ import "../portal-jF1KeGnu.mjs";
3
+ import { a as ButtonPrimitive, i as SelectPrimitive, n as EmptyPrimitive, o as InputPrimitive, r as CardPrimitive, s as FieldPrimitive, t as AvatarPrimitive } from "../primitives-BKUnaQrI.mjs";
4
4
  import React, { useState } from "react";
5
5
  import { Linking, Text } from "react-native";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -0,0 +1,17 @@
1
+ //#region src/hooks/useScreenSize.d.ts
2
+ type ScreenSize = "mobile" | "tablet" | "desktop";
3
+ interface Response {
4
+ readonly size: ScreenSize;
5
+ readonly width: number;
6
+ readonly height: number;
7
+ readonly isMobile: boolean;
8
+ readonly isTablet: boolean;
9
+ readonly isDesktop: boolean;
10
+ select<T>(specifics: ({ [size in ScreenSize]?: T } & {
11
+ default: T;
12
+ }) | { [platform in ScreenSize]: T }): T;
13
+ select<T>(specifics: { [size in ScreenSize]?: T }): T | undefined;
14
+ }
15
+ declare function useScreenSize(): Response;
16
+ //#endregion
17
+ export { ScreenSize, useScreenSize };
@@ -0,0 +1,26 @@
1
+ import { useWindowDimensions } from "react-native";
2
+
3
+ //#region src/hooks/useScreenSize.ts
4
+ function useScreenSize() {
5
+ const windowDimensions = useWindowDimensions();
6
+ const size = windowDimensions.width < 768 ? "mobile" : windowDimensions.width < 1024 ? "tablet" : "desktop";
7
+ return {
8
+ size,
9
+ width: windowDimensions.width,
10
+ height: windowDimensions.height,
11
+ isMobile: size === "mobile",
12
+ isTablet: size === "tablet",
13
+ isDesktop: size === "desktop",
14
+ select: (specifics) => {
15
+ const { mobile, tablet, desktop } = specifics;
16
+ if (size === "mobile" && mobile !== void 0) return mobile;
17
+ if (size === "tablet" && tablet !== void 0) return tablet;
18
+ if (size === "desktop" && desktop !== void 0) return desktop;
19
+ if (!("default" in specifics)) throw new Error(`Utils.$screenSize.select: No value specified for current screen size: ${size}`);
20
+ return specifics.default;
21
+ }
22
+ };
23
+ }
24
+
25
+ //#endregion
26
+ export { useScreenSize };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { n as useTheme, t as ThemeProvider } from "./themes-DXcjBdO2.mjs";
2
- import { n as PortalHost } from "./portal-DoPaAohb.mjs";
1
+ import { n as useTheme, t as ThemeProvider } from "./themes-pgmHo7MU.mjs";
2
+ import { n as PortalHost } from "./portal-jF1KeGnu.mjs";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
 
5
5
  //#region src/index.tsx
@@ -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-DugKbl7Y.mjs";
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-Dyo-iQyH.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 };
@@ -1,4 +1,4 @@
1
- import "../portal-DoPaAohb.mjs";
2
- import { a as ButtonPrimitive, i as SelectPrimitive, n as EmptyPrimitive, o as InputPrimitive, r as CardPrimitive, s as FieldPrimitive, t as AvatarPrimitive } from "../primitives-DQMWXbuX.mjs";
1
+ import "../portal-jF1KeGnu.mjs";
2
+ import { a as ButtonPrimitive, i as SelectPrimitive, n as EmptyPrimitive, o as InputPrimitive, r as CardPrimitive, s as FieldPrimitive, t as AvatarPrimitive } from "../primitives-BKUnaQrI.mjs";
3
3
 
4
4
  export { AvatarPrimitive, ButtonPrimitive, CardPrimitive, EmptyPrimitive, FieldPrimitive, InputPrimitive, SelectPrimitive };
@@ -1,4 +1,4 @@
1
- import { t as Portal } from "./portal-DoPaAohb.mjs";
1
+ import { t as Portal } from "./portal-jF1KeGnu.mjs";
2
2
  import React, { createContext, useContext, useEffect, useState } from "react";
3
3
  import { ActivityIndicator, Image, Pressable, StyleSheet, Text, TextInput, View } from "react-native";
4
4
  import { jsx } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@korsolutions/ui",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
package/tsdown.config.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineConfig } from "tsdown";
2
2
 
3
3
  export default defineConfig({
4
- entry: ["./src/index.tsx", "./src/primitives/index.ts", "./src/components/index.ts"],
4
+ entry: ["./src/index.tsx", "./src/primitives/index.ts", "./src/components/index.ts", "./src/hooks/index.ts"],
5
5
  onSuccess() {
6
6
  console.info("🙏 Build succeeded!");
7
7
  },