@sudobility/building_blocks_rn 0.0.7 → 0.0.9

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,6 +1,9 @@
1
1
  import type { ComponentType, ReactNode } from 'react';
2
2
  import type { i18n as I18nInstance } from 'i18next';
3
3
  import { Theme } from '../types';
4
+ /**
5
+ * Props for the SudobilityAppRN base app wrapper.
6
+ */
4
7
  export interface SudobilityAppRNProps {
5
8
  children: ReactNode;
6
9
  /** Pre-configured i18n instance */
@@ -26,4 +29,29 @@ export interface SudobilityAppRNProps {
26
29
  /** Storage key prefix for persisted settings */
27
30
  storageKeyPrefix?: string;
28
31
  }
32
+ /**
33
+ * Base app wrapper that composes providers in a specific order (outermost to innermost):
34
+ *
35
+ * 1. SafeAreaProvider (always present)
36
+ * 2. I18nextProvider (if `i18n` provided)
37
+ * 3. ThemeProvider (or custom `ThemeProviderComponent`)
38
+ * 4. QueryClientProvider (if provided)
39
+ * 5. ToastProvider (or custom `ToastProviderComponent`)
40
+ * 6. AppProviders (custom additional providers)
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * import { SudobilityAppRN } from '@sudobility/building_blocks_rn';
45
+ *
46
+ * function App() {
47
+ * return (
48
+ * <SudobilityAppRN i18n={i18n} initialTheme={Theme.SYSTEM}>
49
+ * <NavigationContainer>
50
+ * <RootNavigator />
51
+ * </NavigationContainer>
52
+ * </SudobilityAppRN>
53
+ * );
54
+ * }
55
+ * ```
56
+ */
29
57
  export declare function SudobilityAppRN({ children, i18n, ThemeProviderComponent, ToastProviderComponent, QueryClientProvider, AppProviders, initialTheme, storageKeyPrefix, }: SudobilityAppRNProps): import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,31 @@ import { SafeAreaProvider } from 'react-native-safe-area-context';
3
3
  import { I18nextProvider } from 'react-i18next';
4
4
  import { ThemeProvider } from '../theme/ThemeContext';
5
5
  import { ToastProvider } from '../components/toast/ToastProvider';
6
+ /**
7
+ * Base app wrapper that composes providers in a specific order (outermost to innermost):
8
+ *
9
+ * 1. SafeAreaProvider (always present)
10
+ * 2. I18nextProvider (if `i18n` provided)
11
+ * 3. ThemeProvider (or custom `ThemeProviderComponent`)
12
+ * 4. QueryClientProvider (if provided)
13
+ * 5. ToastProvider (or custom `ToastProviderComponent`)
14
+ * 6. AppProviders (custom additional providers)
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * import { SudobilityAppRN } from '@sudobility/building_blocks_rn';
19
+ *
20
+ * function App() {
21
+ * return (
22
+ * <SudobilityAppRN i18n={i18n} initialTheme={Theme.SYSTEM}>
23
+ * <NavigationContainer>
24
+ * <RootNavigator />
25
+ * </NavigationContainer>
26
+ * </SudobilityAppRN>
27
+ * );
28
+ * }
29
+ * ```
30
+ */
6
31
  export function SudobilityAppRN({ children, i18n, ThemeProviderComponent, ToastProviderComponent, QueryClientProvider, AppProviders, initialTheme, storageKeyPrefix, }) {
7
32
  let content = _jsx(_Fragment, { children: children });
8
33
  // Wrap with additional providers (innermost)
@@ -1,11 +1,36 @@
1
+ /**
2
+ * Responsive dimension and breakpoint information.
3
+ */
1
4
  export interface ResponsiveInfo {
5
+ /** Current window width in logical pixels */
2
6
  width: number;
7
+ /** Current window height in logical pixels */
3
8
  height: number;
9
+ /** true when width < 380 (small phones) */
4
10
  isSmall: boolean;
11
+ /** true when width is 380-768 (standard phones) */
5
12
  isMedium: boolean;
13
+ /** true when width > 768 (tablets and larger) */
6
14
  isLarge: boolean;
7
15
  }
8
16
  /**
9
17
  * Hook for responsive breakpoint detection.
18
+ *
19
+ * Uses `useWindowDimensions` to reactively track screen size
20
+ * and provides boolean flags for common breakpoint ranges.
21
+ *
22
+ * @returns Responsive dimension info with breakpoint booleans
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * function MyComponent() {
27
+ * const { isLarge, isSmall } = useResponsive();
28
+ * return (
29
+ * <View style={{ padding: isLarge ? 24 : isSmall ? 8 : 16 }}>
30
+ * <Text>Responsive content</Text>
31
+ * </View>
32
+ * );
33
+ * }
34
+ * ```
10
35
  */
11
36
  export declare function useResponsive(): ResponsiveInfo;
@@ -1,6 +1,29 @@
1
+ /**
2
+ * @fileoverview Responsive breakpoint detection hook for React Native.
3
+ *
4
+ * Provides window dimension info and boolean breakpoint flags
5
+ * for adapting layouts to different screen sizes.
6
+ */
1
7
  import { useWindowDimensions } from 'react-native';
2
8
  /**
3
9
  * Hook for responsive breakpoint detection.
10
+ *
11
+ * Uses `useWindowDimensions` to reactively track screen size
12
+ * and provides boolean flags for common breakpoint ranges.
13
+ *
14
+ * @returns Responsive dimension info with breakpoint booleans
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * function MyComponent() {
19
+ * const { isLarge, isSmall } = useResponsive();
20
+ * return (
21
+ * <View style={{ padding: isLarge ? 24 : isSmall ? 8 : 16 }}>
22
+ * <Text>Responsive content</Text>
23
+ * </View>
24
+ * );
25
+ * }
26
+ * ```
4
27
  */
5
28
  export function useResponsive() {
6
29
  const { width, height } = useWindowDimensions();
@@ -6,6 +6,13 @@ type NamedStyles<T> = {
6
6
  /**
7
7
  * Create a hook that generates themed styles.
8
8
  *
9
+ * Returns a custom hook that, when called inside a component, produces
10
+ * a memoized `StyleSheet` object derived from the current theme colors.
11
+ * Styles recompute only when the theme changes (light/dark switch).
12
+ *
13
+ * @param factory - Function that receives `ThemeColors` and returns a style object
14
+ * @returns A React hook that returns the themed StyleSheet
15
+ *
9
16
  * @example
10
17
  * ```tsx
11
18
  * const useStyles = createThemedStyles((colors) => ({
@@ -1,9 +1,22 @@
1
+ /**
2
+ * @fileoverview Themed style utilities for React Native.
3
+ *
4
+ * Provides `createThemedStyles()`, the standard pattern for creating
5
+ * theme-reactive StyleSheet objects used by every component in this package.
6
+ */
1
7
  import { useMemo } from 'react';
2
8
  import { StyleSheet } from 'react-native';
3
9
  import { useTheme } from '../theme/ThemeContext';
4
10
  /**
5
11
  * Create a hook that generates themed styles.
6
12
  *
13
+ * Returns a custom hook that, when called inside a component, produces
14
+ * a memoized `StyleSheet` object derived from the current theme colors.
15
+ * Styles recompute only when the theme changes (light/dark switch).
16
+ *
17
+ * @param factory - Function that receives `ThemeColors` and returns a style object
18
+ * @returns A React hook that returns the themed StyleSheet
19
+ *
7
20
  * @example
8
21
  * ```tsx
9
22
  * const useStyles = createThemedStyles((colors) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/building_blocks_rn",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Higher-level shared UI building blocks for Sudobility React Native apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -85,7 +85,7 @@
85
85
  "i18next": "^25.8.0",
86
86
  "react-i18next": "^16.5.3",
87
87
  "@tanstack/react-query": "^5.90.19",
88
- "@sudobility/types": "^1.9.52"
88
+ "@sudobility/types": "^1.9.54"
89
89
  },
90
90
  "publishConfig": {
91
91
  "access": "public"