@sudobility/components-rn 1.0.21 → 1.0.22

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,8 +1,13 @@
1
1
  import { ClassValue } from 'clsx';
2
2
  /**
3
3
  * Merges class names for React Native with NativeWind.
4
- * Unlike web version, we don't need tailwind-merge since NativeWind
5
- * processes Tailwind classes at build time.
4
+ *
5
+ * Unlike the web version (`@sudobility/components`), this does NOT use
6
+ * `tailwind-merge` since NativeWind processes Tailwind classes at build
7
+ * time and handles conflict resolution internally.
8
+ *
9
+ * @param inputs - Class values to merge (strings, arrays, objects, etc.)
10
+ * @returns A single merged class name string
6
11
  */
7
12
  export declare function cn(...inputs: ClassValue[]): string;
8
13
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
@@ -1,5 +1,11 @@
1
1
  import { default as React } from 'react';
2
2
  import { ViewProps } from 'react-native';
3
+ /**
4
+ * Props for the Alert component.
5
+ *
6
+ * Supports semantic variants (info, success, warning, attention, error)
7
+ * with design system styling, optional custom icons, and compound content.
8
+ */
3
9
  export interface AlertProps extends ViewProps {
4
10
  variant?: 'info' | 'success' | 'warning' | 'attention' | 'error';
5
11
  title?: string;
@@ -7,10 +13,12 @@ export interface AlertProps extends ViewProps {
7
13
  icon?: React.ReactNode;
8
14
  children?: React.ReactNode;
9
15
  }
16
+ /** Alert title sub-component with bold font styling. */
10
17
  export declare const AlertTitle: React.FC<{
11
18
  children: React.ReactNode;
12
19
  className?: string;
13
20
  }>;
21
+ /** Alert description sub-component with smaller text styling. */
14
22
  export declare const AlertDescription: React.FC<{
15
23
  children: React.ReactNode;
16
24
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/ui/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI1D,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAWD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAEA,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAEA,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA8BtC,CAAC"}
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/ui/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI1D;;;;;GAKG;AACH,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAWD,wDAAwD;AACxD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAEA,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAEA,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA8BtC,CAAC"}
@@ -11,15 +11,30 @@ export interface ButtonBaseProps {
11
11
  children: ReactNode;
12
12
  }
13
13
  /**
14
- * Map size abbreviations to design system variant keys
14
+ * Map size abbreviations to design system variant keys.
15
+ *
16
+ * @param size - The abbreviated size key ('sm', 'lg', or 'default')
17
+ * @returns The full design system variant key ('small', 'large', or 'default')
15
18
  */
16
19
  export declare const mapSizeToVariantKey: (size: string | undefined) => string;
17
20
  /**
18
- * Get button variant class from design system
21
+ * Get button variant class string from the design system.
22
+ *
23
+ * Handles gradient variants, web3 variants (wallet/connect/disconnect),
24
+ * and standard variants with size modifiers.
25
+ *
26
+ * @param variantName - The button variant name (e.g., 'primary', 'gradient', 'wallet')
27
+ * @param sizeName - Optional size abbreviation ('sm' or 'lg')
28
+ * @param v - The design system variants object
29
+ * @returns A Tailwind class string from the design system
19
30
  */
20
31
  export declare const getButtonVariantClass: (variantName: string, sizeName: string | undefined, v: any) => string;
21
32
  /**
22
- * Shared button state logic
33
+ * Shared button state logic for determining disabled and spinner visibility.
34
+ *
35
+ * @param loading - Whether the button is in a loading state
36
+ * @param disabled - Whether the button is explicitly disabled
37
+ * @returns An object with `isDisabled` and `showSpinner` booleans
23
38
  */
24
39
  export declare const useButtonState: (loading: boolean | undefined, disabled: boolean | undefined) => {
25
40
  isDisabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Button.shared.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EACJ,SAAS,GACT,SAAS,GACT,WAAW,GACX,SAAS,GACT,OAAO,GACP,aAAa,GACb,qBAAqB,GACrB,SAAS,GACT,MAAM,GACN,UAAU,GACV,oBAAoB,GACpB,kBAAkB,GAClB,QAAQ,GACR,SAAS,GACT,YAAY,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IACxC,SAAS,CAAC,EACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,GACT,KAAK,GACL,SAAS,GACT,aAAa,GACb,YAAY,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAQ9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,EACnB,UAAU,MAAM,GAAG,SAAS,EAC5B,GAAG,GAAG,KACL,MAYF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,OAAO,GAAG,SAAS,EAC5B,UAAU,OAAO,GAAG,SAAS;;;CAI7B,CAAC"}
1
+ {"version":3,"file":"Button.shared.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EACJ,SAAS,GACT,SAAS,GACT,WAAW,GACX,SAAS,GACT,OAAO,GACP,aAAa,GACb,qBAAqB,GACrB,SAAS,GACT,MAAM,GACN,UAAU,GACV,oBAAoB,GACpB,kBAAkB,GAClB,QAAQ,GACR,SAAS,GACT,YAAY,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IACxC,SAAS,CAAC,EACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,GACT,KAAK,GACL,SAAS,GACT,aAAa,GACb,YAAY,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAQ9D,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,EACnB,UAAU,MAAM,GAAG,SAAS,EAC5B,GAAG,GAAG,KACL,MAYF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,OAAO,GAAG,SAAS,EAC5B,UAAU,OAAO,GAAG,SAAS;;;CAI7B,CAAC"}
@@ -1,5 +1,12 @@
1
1
  import { default as React } from 'react';
2
2
  import { ViewProps } from 'react-native';
3
+ /**
4
+ * Props for the Card component.
5
+ *
6
+ * Supports multiple visual variants (bordered, elevated, info, success, etc.),
7
+ * configurable padding, optional icon display, and a close button for
8
+ * info-type variants.
9
+ */
3
10
  export interface CardProps extends ViewProps {
4
11
  variant?: 'default' | 'bordered' | 'elevated' | 'info' | 'success' | 'warning' | 'error' | 'callout';
5
12
  padding?: 'none' | 'sm' | 'md' | 'lg';
@@ -10,13 +17,38 @@ export interface CardProps extends ViewProps {
10
17
  /** For info variants: show close button */
11
18
  onClose?: () => void;
12
19
  }
20
+ /**
21
+ * Card component for React Native.
22
+ *
23
+ * A versatile container with variant-based styling from the design system.
24
+ * Info-type variants (info, success, warning, error) support an optional
25
+ * icon and close button.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <Card variant="elevated" padding="md">
30
+ * <CardHeader title="Title" description="Subtitle" />
31
+ * <CardContent><Text>Body</Text></CardContent>
32
+ * <CardFooter><Button>Action</Button></CardFooter>
33
+ * </Card>
34
+ * ```
35
+ */
13
36
  export declare const Card: React.FC<CardProps>;
37
+ /** Props for the CardHeader sub-component. */
14
38
  interface CardHeaderProps extends ViewProps {
39
+ /** Card title rendered as a heading. */
15
40
  title?: string;
41
+ /** Card description rendered below the title. */
16
42
  description?: string;
17
43
  }
44
+ /**
45
+ * Card header sub-component with optional title and description.
46
+ * Uses design system text variants for consistent typography.
47
+ */
18
48
  export declare const CardHeader: React.FC<CardHeaderProps>;
49
+ /** Card body content area. */
19
50
  export declare const CardContent: React.FC<ViewProps>;
51
+ /** Card footer area, rendered as a horizontal row with top padding. */
20
52
  export declare const CardFooter: React.FC<ViewProps>;
21
53
  export {};
22
54
  //# sourceMappingURL=Card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/ui/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,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,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACtC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAYD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAmDpC,CAAC;AAEF,8CAA8C;AAC9C,UAAU,eAAgB,SAAQ,SAAS;IACzC,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgBhD,CAAC;AAEF,8BAA8B;AAC9B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAU3C,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAU1C,CAAC"}
@@ -1,10 +1,18 @@
1
1
  import { default as React } from 'react';
2
2
  import { ViewProps } from 'react-native';
3
+ /**
4
+ * Props for the Spinner loading indicator component.
5
+ */
3
6
  export interface SpinnerProps extends ViewProps {
7
+ /** Size of the activity indicator. */
4
8
  size?: 'small' | 'default' | 'large' | 'extraLarge';
9
+ /** Color variant for the spinner. */
5
10
  variant?: 'default' | 'white' | 'success' | 'warning' | 'error';
11
+ /** Accessibility label for screen readers. */
6
12
  accessibilityLabel?: string;
13
+ /** Text shown below the spinner when showText is true. */
7
14
  loadingText?: string;
15
+ /** Whether to display loading text below the spinner. */
8
16
  showText?: boolean;
9
17
  }
10
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../src/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
1
1
  import { default as React } from 'react';
2
+ /** Data structure representing a single toast notification. */
2
3
  export interface ToastMessage {
3
4
  id: string;
4
5
  title?: string;
@@ -16,11 +17,21 @@ export interface ToastProps {
16
17
  /** Remove toast handler */
17
18
  onRemove: (id: string) => void;
18
19
  }
20
+ /** Context value provided by ToastProvider for managing toast notifications. */
19
21
  export interface ToastContextValue {
20
22
  toasts: ToastMessage[];
21
23
  addToast: (toast: Omit<ToastMessage, 'id'>) => void;
22
24
  removeToast: (id: string) => void;
23
25
  }
26
+ /**
27
+ * Hook to access the toast notification system.
28
+ *
29
+ * Must be used within a ToastProvider. Returns functions to add and remove
30
+ * toast notifications, plus the current list of active toasts.
31
+ *
32
+ * @returns The toast context value with addToast, removeToast, and toasts
33
+ * @throws Error if used outside of a ToastProvider
34
+ */
24
35
  export declare const useToast: () => ToastContextValue;
25
36
  /**
26
37
  * Toast Component
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/ui/Toast/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,IAAI,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB,oBAAoB;IACpB,KAAK,EAAE,YAAY,CAAC;IACpB,2BAA2B;IAC3B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,YAAY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E,IAAI,CAAC,KAAK,IAAI,CAAC;IACpD,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAID;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,yBAMpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAoFtC,CAAC;AAwBF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CA+BjE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/components-rn",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "React Native UI components and design system - Ported from @sudobility/components",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,8 +48,8 @@
48
48
  ],
49
49
  "author": "Sudobility",
50
50
  "peerDependencies": {
51
- "@sudobility/design": "^1.1.19",
52
- "@sudobility/types": "^1.9.53",
51
+ "@sudobility/design": "^1.1.20",
52
+ "@sudobility/types": "^1.9.54",
53
53
  "nativewind": ">=4.0.0",
54
54
  "react": "^18.0.0 || ^19.0.0",
55
55
  "react-native": ">=0.72.0",
@@ -62,8 +62,8 @@
62
62
  },
63
63
  "devDependencies": {
64
64
  "@eslint/js": "^9.15.0",
65
- "@sudobility/design": "^1.1.19",
66
- "@sudobility/types": "^1.9.53",
65
+ "@sudobility/design": "^1.1.20",
66
+ "@sudobility/types": "^1.9.54",
67
67
  "@testing-library/jest-native": "^5.4.3",
68
68
  "@testing-library/react-native": "^13.3.3",
69
69
  "@types/jest": "^29.5.0",
package/src/lib/utils.ts CHANGED
@@ -2,8 +2,13 @@ import { type ClassValue, clsx } from 'clsx';
2
2
 
3
3
  /**
4
4
  * Merges class names for React Native with NativeWind.
5
- * Unlike web version, we don't need tailwind-merge since NativeWind
6
- * processes Tailwind classes at build time.
5
+ *
6
+ * Unlike the web version (`@sudobility/components`), this does NOT use
7
+ * `tailwind-merge` since NativeWind processes Tailwind classes at build
8
+ * time and handles conflict resolution internally.
9
+ *
10
+ * @param inputs - Class values to merge (strings, arrays, objects, etc.)
11
+ * @returns A single merged class name string
7
12
  */
8
13
  export function cn(...inputs: ClassValue[]): string {
9
14
  return clsx(inputs);
@@ -3,6 +3,12 @@ import { View, Text, type ViewProps } from 'react-native';
3
3
  import { cn } from '../../lib/utils';
4
4
  import { variants as v } from '@sudobility/design';
5
5
 
6
+ /**
7
+ * Props for the Alert component.
8
+ *
9
+ * Supports semantic variants (info, success, warning, attention, error)
10
+ * with design system styling, optional custom icons, and compound content.
11
+ */
6
12
  export interface AlertProps extends ViewProps {
7
13
  variant?: 'info' | 'success' | 'warning' | 'attention' | 'error';
8
14
  title?: string;
@@ -20,6 +26,7 @@ const defaultIcons: Record<string, string> = {
20
26
  error: '✕',
21
27
  };
22
28
 
29
+ /** Alert title sub-component with bold font styling. */
23
30
  export const AlertTitle: React.FC<{
24
31
  children: React.ReactNode;
25
32
  className?: string;
@@ -27,6 +34,7 @@ export const AlertTitle: React.FC<{
27
34
  <Text className={cn('font-medium mb-1', className)}>{children}</Text>
28
35
  );
29
36
 
37
+ /** Alert description sub-component with smaller text styling. */
30
38
  export const AlertDescription: React.FC<{
31
39
  children: React.ReactNode;
32
40
  className?: string;
@@ -38,7 +38,10 @@ export interface ButtonBaseProps {
38
38
  }
39
39
 
40
40
  /**
41
- * Map size abbreviations to design system variant keys
41
+ * Map size abbreviations to design system variant keys.
42
+ *
43
+ * @param size - The abbreviated size key ('sm', 'lg', or 'default')
44
+ * @returns The full design system variant key ('small', 'large', or 'default')
42
45
  */
43
46
  export const mapSizeToVariantKey = (size: string | undefined): string => {
44
47
  if (!size) return 'default';
@@ -51,7 +54,15 @@ export const mapSizeToVariantKey = (size: string | undefined): string => {
51
54
  };
52
55
 
53
56
  /**
54
- * Get button variant class from design system
57
+ * Get button variant class string from the design system.
58
+ *
59
+ * Handles gradient variants, web3 variants (wallet/connect/disconnect),
60
+ * and standard variants with size modifiers.
61
+ *
62
+ * @param variantName - The button variant name (e.g., 'primary', 'gradient', 'wallet')
63
+ * @param sizeName - Optional size abbreviation ('sm' or 'lg')
64
+ * @param v - The design system variants object
65
+ * @returns A Tailwind class string from the design system
55
66
  */
56
67
  export const getButtonVariantClass = (
57
68
  variantName: string,
@@ -72,7 +83,11 @@ export const getButtonVariantClass = (
72
83
  };
73
84
 
74
85
  /**
75
- * Shared button state logic
86
+ * Shared button state logic for determining disabled and spinner visibility.
87
+ *
88
+ * @param loading - Whether the button is in a loading state
89
+ * @param disabled - Whether the button is explicitly disabled
90
+ * @returns An object with `isDisabled` and `showSpinner` booleans
76
91
  */
77
92
  export const useButtonState = (
78
93
  loading: boolean | undefined,
@@ -3,6 +3,13 @@ import { View, Text, Pressable, type ViewProps } from 'react-native';
3
3
  import { cn } from '../../lib/utils';
4
4
  import { textVariants, getCardVariantColors } from '@sudobility/design';
5
5
 
6
+ /**
7
+ * Props for the Card component.
8
+ *
9
+ * Supports multiple visual variants (bordered, elevated, info, success, etc.),
10
+ * configurable padding, optional icon display, and a close button for
11
+ * info-type variants.
12
+ */
6
13
  export interface CardProps extends ViewProps {
7
14
  variant?:
8
15
  | 'default'
@@ -32,6 +39,22 @@ const paddingStyles = {
32
39
  lg: 'p-8',
33
40
  };
34
41
 
42
+ /**
43
+ * Card component for React Native.
44
+ *
45
+ * A versatile container with variant-based styling from the design system.
46
+ * Info-type variants (info, success, warning, error) support an optional
47
+ * icon and close button.
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * <Card variant="elevated" padding="md">
52
+ * <CardHeader title="Title" description="Subtitle" />
53
+ * <CardContent><Text>Body</Text></CardContent>
54
+ * <CardFooter><Button>Action</Button></CardFooter>
55
+ * </Card>
56
+ * ```
57
+ */
35
58
  export const Card: React.FC<CardProps> = ({
36
59
  variant = 'elevated',
37
60
  padding = 'md',
@@ -85,11 +108,18 @@ export const Card: React.FC<CardProps> = ({
85
108
  );
86
109
  };
87
110
 
111
+ /** Props for the CardHeader sub-component. */
88
112
  interface CardHeaderProps extends ViewProps {
113
+ /** Card title rendered as a heading. */
89
114
  title?: string;
115
+ /** Card description rendered below the title. */
90
116
  description?: string;
91
117
  }
92
118
 
119
+ /**
120
+ * Card header sub-component with optional title and description.
121
+ * Uses design system text variants for consistent typography.
122
+ */
93
123
  export const CardHeader: React.FC<CardHeaderProps> = ({
94
124
  title,
95
125
  description,
@@ -108,6 +138,7 @@ export const CardHeader: React.FC<CardHeaderProps> = ({
108
138
  );
109
139
  };
110
140
 
141
+ /** Card body content area. */
111
142
  export const CardContent: React.FC<ViewProps> = ({
112
143
  className,
113
144
  children,
@@ -120,6 +151,7 @@ export const CardContent: React.FC<ViewProps> = ({
120
151
  );
121
152
  };
122
153
 
154
+ /** Card footer area, rendered as a horizontal row with top padding. */
123
155
  export const CardFooter: React.FC<ViewProps> = ({
124
156
  className,
125
157
  children,
@@ -2,11 +2,19 @@ import React from 'react';
2
2
  import { View, ActivityIndicator, Text, type ViewProps } from 'react-native';
3
3
  import { cn } from '../../lib/utils';
4
4
 
5
+ /**
6
+ * Props for the Spinner loading indicator component.
7
+ */
5
8
  export interface SpinnerProps extends ViewProps {
9
+ /** Size of the activity indicator. */
6
10
  size?: 'small' | 'default' | 'large' | 'extraLarge';
11
+ /** Color variant for the spinner. */
7
12
  variant?: 'default' | 'white' | 'success' | 'warning' | 'error';
13
+ /** Accessibility label for screen readers. */
8
14
  accessibilityLabel?: string;
15
+ /** Text shown below the spinner when showText is true. */
9
16
  loadingText?: string;
17
+ /** Whether to display loading text below the spinner. */
10
18
  showText?: boolean;
11
19
  }
12
20
 
@@ -9,6 +9,7 @@ import React, {
9
9
  import { View, Text, Pressable, Animated, SafeAreaView } from 'react-native';
10
10
  import { cn } from '../../lib/utils';
11
11
 
12
+ /** Data structure representing a single toast notification. */
12
13
  export interface ToastMessage {
13
14
  id: string;
14
15
  title?: string;
@@ -28,6 +29,7 @@ export interface ToastProps {
28
29
  onRemove: (id: string) => void;
29
30
  }
30
31
 
32
+ /** Context value provided by ToastProvider for managing toast notifications. */
31
33
  export interface ToastContextValue {
32
34
  toasts: ToastMessage[];
33
35
  addToast: (toast: Omit<ToastMessage, 'id'>) => void;
@@ -36,6 +38,15 @@ export interface ToastContextValue {
36
38
 
37
39
  const ToastContext = createContext<ToastContextValue | undefined>(undefined);
38
40
 
41
+ /**
42
+ * Hook to access the toast notification system.
43
+ *
44
+ * Must be used within a ToastProvider. Returns functions to add and remove
45
+ * toast notifications, plus the current list of active toasts.
46
+ *
47
+ * @returns The toast context value with addToast, removeToast, and toasts
48
+ * @throws Error if used outside of a ToastProvider
49
+ */
39
50
  export const useToast = () => {
40
51
  const context = useContext(ToastContext);
41
52
  if (!context) {