@retray-dev/ui-kit 1.0.0 → 1.6.0

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/index.d.mts CHANGED
@@ -20,6 +20,8 @@ type ThemeColors = {
20
20
  border: string;
21
21
  input: string;
22
22
  ring: string;
23
+ success: string;
24
+ successForeground: string;
23
25
  };
24
26
  type Theme = {
25
27
  light?: Partial<ThemeColors>;
@@ -68,8 +70,12 @@ interface ButtonProps extends TouchableOpacityProps {
68
70
  /** Replaces the label with a spinner and forces `disabled`. */
69
71
  loading?: boolean;
70
72
  fullWidth?: boolean;
73
+ /** Icon rendered alongside the label. */
74
+ icon?: React.ReactNode;
75
+ /** Side the icon appears on. Defaults to `'left'`. */
76
+ iconPosition?: 'left' | 'right';
71
77
  }
72
- declare function Button({ label, variant, size, loading, fullWidth, disabled, style, onPress, ...props }: ButtonProps): React.JSX.Element;
78
+ declare function Button({ label, variant, size, loading, fullWidth, icon, iconPosition, disabled, style, onPress, ...props }: ButtonProps): React.JSX.Element;
73
79
 
74
80
  type TextVariant = 'h1' | 'h2' | 'h3' | 'body' | 'caption' | 'label';
75
81
  interface TextProps extends TextProps$1 {
@@ -80,10 +86,14 @@ declare function Text({ variant, color, style, children, ...props }: TextProps):
80
86
 
81
87
  interface InputProps extends TextInputProps {
82
88
  label?: string;
89
+ /** Red helper text below the input; also changes border to `destructive` color. Takes priority over `hint`. */
83
90
  error?: string;
91
+ /** Helper text shown below the input when there is no error. */
84
92
  hint?: string;
93
+ /** Style for the outer container `View`. Use `style` (from `TextInputProps`) to style the `TextInput` itself. */
94
+ containerStyle?: ViewStyle;
85
95
  }
86
- declare function Input({ label, error, hint, style, onFocus, onBlur, ...props }: InputProps): React.JSX.Element;
96
+ declare function Input({ label, error, hint, containerStyle, style, onFocus, onBlur, ...props }: InputProps): React.JSX.Element;
87
97
 
88
98
  type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline';
89
99
  interface BadgeProps {
@@ -147,7 +157,9 @@ declare function Skeleton({ width, height, borderRadius, style }: SkeletonProps)
147
157
 
148
158
  type AvatarSize = 'sm' | 'md' | 'lg' | 'xl';
149
159
  interface AvatarProps {
160
+ /** Remote image URI. Falls back to `fallback` initials on error or when omitted. */
150
161
  src?: string;
162
+ /** Up to 2 characters shown when the image is unavailable. Auto-uppercased. Defaults to `'?'`. */
151
163
  fallback?: string;
152
164
  size?: AvatarSize;
153
165
  style?: ViewStyle;
@@ -165,7 +177,9 @@ interface AlertProps {
165
177
  declare function Alert({ title, description, variant, icon, style }: AlertProps): React.JSX.Element;
166
178
 
167
179
  interface ProgressProps {
180
+ /** Current progress value. Clamped to `[0, max]`. Defaults to `0`. */
168
181
  value?: number;
182
+ /** Maximum value. Defaults to `100`. */
169
183
  max?: number;
170
184
  style?: ViewStyle;
171
185
  }
@@ -182,11 +196,16 @@ declare function EmptyState({ icon, title, description, action, style }: EmptySt
182
196
 
183
197
  interface TextareaProps extends TextInputProps {
184
198
  label?: string;
199
+ /** Red helper text below the textarea; also changes border to `destructive` color. Takes priority over `hint`. */
185
200
  error?: string;
201
+ /** Helper text shown below the textarea when there is no error. */
186
202
  hint?: string;
203
+ /** Number of visible text rows. Defaults to `4`. Controls `numberOfLines` and `minHeight`. */
187
204
  rows?: number;
205
+ /** Style for the outer container `View`. Use `style` (from `TextInputProps`) to style the `TextInput` itself. */
206
+ containerStyle?: ViewStyle;
188
207
  }
189
- declare function Textarea({ label, error, hint, rows, style, onFocus, onBlur, ...props }: TextareaProps): React.JSX.Element;
208
+ declare function Textarea({ label, error, hint, rows, containerStyle, style, onFocus, onBlur, ...props }: TextareaProps): React.JSX.Element;
190
209
 
191
210
  interface CheckboxProps {
192
211
  checked?: boolean;
@@ -195,7 +214,7 @@ interface CheckboxProps {
195
214
  disabled?: boolean;
196
215
  style?: ViewStyle;
197
216
  }
198
- declare function Checkbox({ checked, onCheckedChange, label, disabled, style }: CheckboxProps): React.JSX.Element;
217
+ declare function Checkbox({ checked, onCheckedChange, label, disabled, style, }: CheckboxProps): React.JSX.Element;
199
218
 
200
219
  interface SwitchProps {
201
220
  checked?: boolean;
@@ -237,6 +256,10 @@ interface TabItem {
237
256
  }
238
257
  interface TabsProps {
239
258
  tabs: TabItem[];
259
+ /**
260
+ * Controlled active tab value. When omitted the component manages state internally
261
+ * (uncontrolled), defaulting to the first tab.
262
+ */
240
263
  value?: string;
241
264
  onValueChange?: (value: string) => void;
242
265
  children?: React.ReactNode;
@@ -270,11 +293,15 @@ interface AccordionProps {
270
293
  declare function Accordion({ items, type, defaultValue, style }: AccordionProps): React.JSX.Element;
271
294
 
272
295
  interface SliderProps {
296
+ /** Current value. Controlled when provided; falls back to internal state otherwise. */
273
297
  value?: number;
274
298
  minimumValue?: number;
275
299
  maximumValue?: number;
300
+ /** Snap interval. `0` (default) means continuous (no snapping). */
276
301
  step?: number;
302
+ /** Called on every move while dragging. */
277
303
  onValueChange?: (value: number) => void;
304
+ /** Called once when the user releases the thumb. */
278
305
  onSlidingComplete?: (value: number) => void;
279
306
  disabled?: boolean;
280
307
  style?: ViewStyle;
@@ -287,7 +314,12 @@ interface SheetProps {
287
314
  title?: string;
288
315
  description?: string;
289
316
  children?: React.ReactNode;
317
+ /**
318
+ * Heights the sheet can snap to. Accepts percentage strings (`'50%'`) or
319
+ * absolute point values (`300`). Defaults to `['50%']`.
320
+ */
290
321
  snapPoints?: (string | number)[];
322
+ /** Style for the inner `BottomSheetView` content container. */
291
323
  style?: ViewStyle;
292
324
  }
293
325
  declare function Sheet({ open, onClose, title, description, children, snapPoints, style, }: SheetProps): React.JSX.Element;
@@ -301,8 +333,10 @@ interface SelectProps {
301
333
  options: SelectOption[];
302
334
  value?: string;
303
335
  onValueChange?: (value: string) => void;
336
+ /** Text shown when no option is selected. Defaults to `'Select an option'`. */
304
337
  placeholder?: string;
305
338
  label?: string;
339
+ /** Red helper text; also changes trigger border to `destructive` color. */
306
340
  error?: string;
307
341
  disabled?: boolean;
308
342
  style?: ViewStyle;
@@ -315,6 +349,7 @@ interface ToastItem {
315
349
  title?: string;
316
350
  description?: string;
317
351
  variant?: ToastVariant;
352
+ /** Auto-dismiss delay in milliseconds. Defaults to `3000`. */
318
353
  duration?: number;
319
354
  }
320
355
  interface ToastContextValue {
@@ -332,4 +367,23 @@ interface ToastProviderProps {
332
367
  }
333
368
  declare function ToastProvider({ children }: ToastProviderProps): React.JSX.Element;
334
369
 
335
- export { Accordion, type AccordionItem, type AccordionProps, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, type ColorScheme, EmptyState, type EmptyStateProps, Input, type InputProps, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RadioOption, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, useTheme, useToast };
370
+ interface CurrencyInputProps {
371
+ value?: string;
372
+ onChangeText?: (formatted: string) => void;
373
+ /** Called with the parsed numeric value (no separators, no prefix). */
374
+ onChangeValue?: (raw: number) => void;
375
+ /** Symbol prepended to the formatted value. Defaults to `'$'`. */
376
+ prefix?: string;
377
+ /** Character used to separate groups of three digits. Defaults to `'.'`. */
378
+ thousandsSeparator?: '.' | ',';
379
+ label?: string;
380
+ /** Red helper text; also changes input border to destructive color. */
381
+ error?: string;
382
+ hint?: string;
383
+ placeholder?: string;
384
+ editable?: boolean;
385
+ containerStyle?: ViewStyle;
386
+ }
387
+ declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, label, error, hint, placeholder, editable, containerStyle, }: CurrencyInputProps): React.JSX.Element;
388
+
389
+ export { Accordion, type AccordionItem, type AccordionProps, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, type ColorScheme, CurrencyInput, type CurrencyInputProps, EmptyState, type EmptyStateProps, Input, type InputProps, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RadioOption, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, useTheme, useToast };
package/dist/index.d.ts CHANGED
@@ -20,6 +20,8 @@ type ThemeColors = {
20
20
  border: string;
21
21
  input: string;
22
22
  ring: string;
23
+ success: string;
24
+ successForeground: string;
23
25
  };
24
26
  type Theme = {
25
27
  light?: Partial<ThemeColors>;
@@ -68,8 +70,12 @@ interface ButtonProps extends TouchableOpacityProps {
68
70
  /** Replaces the label with a spinner and forces `disabled`. */
69
71
  loading?: boolean;
70
72
  fullWidth?: boolean;
73
+ /** Icon rendered alongside the label. */
74
+ icon?: React.ReactNode;
75
+ /** Side the icon appears on. Defaults to `'left'`. */
76
+ iconPosition?: 'left' | 'right';
71
77
  }
72
- declare function Button({ label, variant, size, loading, fullWidth, disabled, style, onPress, ...props }: ButtonProps): React.JSX.Element;
78
+ declare function Button({ label, variant, size, loading, fullWidth, icon, iconPosition, disabled, style, onPress, ...props }: ButtonProps): React.JSX.Element;
73
79
 
74
80
  type TextVariant = 'h1' | 'h2' | 'h3' | 'body' | 'caption' | 'label';
75
81
  interface TextProps extends TextProps$1 {
@@ -80,10 +86,14 @@ declare function Text({ variant, color, style, children, ...props }: TextProps):
80
86
 
81
87
  interface InputProps extends TextInputProps {
82
88
  label?: string;
89
+ /** Red helper text below the input; also changes border to `destructive` color. Takes priority over `hint`. */
83
90
  error?: string;
91
+ /** Helper text shown below the input when there is no error. */
84
92
  hint?: string;
93
+ /** Style for the outer container `View`. Use `style` (from `TextInputProps`) to style the `TextInput` itself. */
94
+ containerStyle?: ViewStyle;
85
95
  }
86
- declare function Input({ label, error, hint, style, onFocus, onBlur, ...props }: InputProps): React.JSX.Element;
96
+ declare function Input({ label, error, hint, containerStyle, style, onFocus, onBlur, ...props }: InputProps): React.JSX.Element;
87
97
 
88
98
  type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline';
89
99
  interface BadgeProps {
@@ -147,7 +157,9 @@ declare function Skeleton({ width, height, borderRadius, style }: SkeletonProps)
147
157
 
148
158
  type AvatarSize = 'sm' | 'md' | 'lg' | 'xl';
149
159
  interface AvatarProps {
160
+ /** Remote image URI. Falls back to `fallback` initials on error or when omitted. */
150
161
  src?: string;
162
+ /** Up to 2 characters shown when the image is unavailable. Auto-uppercased. Defaults to `'?'`. */
151
163
  fallback?: string;
152
164
  size?: AvatarSize;
153
165
  style?: ViewStyle;
@@ -165,7 +177,9 @@ interface AlertProps {
165
177
  declare function Alert({ title, description, variant, icon, style }: AlertProps): React.JSX.Element;
166
178
 
167
179
  interface ProgressProps {
180
+ /** Current progress value. Clamped to `[0, max]`. Defaults to `0`. */
168
181
  value?: number;
182
+ /** Maximum value. Defaults to `100`. */
169
183
  max?: number;
170
184
  style?: ViewStyle;
171
185
  }
@@ -182,11 +196,16 @@ declare function EmptyState({ icon, title, description, action, style }: EmptySt
182
196
 
183
197
  interface TextareaProps extends TextInputProps {
184
198
  label?: string;
199
+ /** Red helper text below the textarea; also changes border to `destructive` color. Takes priority over `hint`. */
185
200
  error?: string;
201
+ /** Helper text shown below the textarea when there is no error. */
186
202
  hint?: string;
203
+ /** Number of visible text rows. Defaults to `4`. Controls `numberOfLines` and `minHeight`. */
187
204
  rows?: number;
205
+ /** Style for the outer container `View`. Use `style` (from `TextInputProps`) to style the `TextInput` itself. */
206
+ containerStyle?: ViewStyle;
188
207
  }
189
- declare function Textarea({ label, error, hint, rows, style, onFocus, onBlur, ...props }: TextareaProps): React.JSX.Element;
208
+ declare function Textarea({ label, error, hint, rows, containerStyle, style, onFocus, onBlur, ...props }: TextareaProps): React.JSX.Element;
190
209
 
191
210
  interface CheckboxProps {
192
211
  checked?: boolean;
@@ -195,7 +214,7 @@ interface CheckboxProps {
195
214
  disabled?: boolean;
196
215
  style?: ViewStyle;
197
216
  }
198
- declare function Checkbox({ checked, onCheckedChange, label, disabled, style }: CheckboxProps): React.JSX.Element;
217
+ declare function Checkbox({ checked, onCheckedChange, label, disabled, style, }: CheckboxProps): React.JSX.Element;
199
218
 
200
219
  interface SwitchProps {
201
220
  checked?: boolean;
@@ -237,6 +256,10 @@ interface TabItem {
237
256
  }
238
257
  interface TabsProps {
239
258
  tabs: TabItem[];
259
+ /**
260
+ * Controlled active tab value. When omitted the component manages state internally
261
+ * (uncontrolled), defaulting to the first tab.
262
+ */
240
263
  value?: string;
241
264
  onValueChange?: (value: string) => void;
242
265
  children?: React.ReactNode;
@@ -270,11 +293,15 @@ interface AccordionProps {
270
293
  declare function Accordion({ items, type, defaultValue, style }: AccordionProps): React.JSX.Element;
271
294
 
272
295
  interface SliderProps {
296
+ /** Current value. Controlled when provided; falls back to internal state otherwise. */
273
297
  value?: number;
274
298
  minimumValue?: number;
275
299
  maximumValue?: number;
300
+ /** Snap interval. `0` (default) means continuous (no snapping). */
276
301
  step?: number;
302
+ /** Called on every move while dragging. */
277
303
  onValueChange?: (value: number) => void;
304
+ /** Called once when the user releases the thumb. */
278
305
  onSlidingComplete?: (value: number) => void;
279
306
  disabled?: boolean;
280
307
  style?: ViewStyle;
@@ -287,7 +314,12 @@ interface SheetProps {
287
314
  title?: string;
288
315
  description?: string;
289
316
  children?: React.ReactNode;
317
+ /**
318
+ * Heights the sheet can snap to. Accepts percentage strings (`'50%'`) or
319
+ * absolute point values (`300`). Defaults to `['50%']`.
320
+ */
290
321
  snapPoints?: (string | number)[];
322
+ /** Style for the inner `BottomSheetView` content container. */
291
323
  style?: ViewStyle;
292
324
  }
293
325
  declare function Sheet({ open, onClose, title, description, children, snapPoints, style, }: SheetProps): React.JSX.Element;
@@ -301,8 +333,10 @@ interface SelectProps {
301
333
  options: SelectOption[];
302
334
  value?: string;
303
335
  onValueChange?: (value: string) => void;
336
+ /** Text shown when no option is selected. Defaults to `'Select an option'`. */
304
337
  placeholder?: string;
305
338
  label?: string;
339
+ /** Red helper text; also changes trigger border to `destructive` color. */
306
340
  error?: string;
307
341
  disabled?: boolean;
308
342
  style?: ViewStyle;
@@ -315,6 +349,7 @@ interface ToastItem {
315
349
  title?: string;
316
350
  description?: string;
317
351
  variant?: ToastVariant;
352
+ /** Auto-dismiss delay in milliseconds. Defaults to `3000`. */
318
353
  duration?: number;
319
354
  }
320
355
  interface ToastContextValue {
@@ -332,4 +367,23 @@ interface ToastProviderProps {
332
367
  }
333
368
  declare function ToastProvider({ children }: ToastProviderProps): React.JSX.Element;
334
369
 
335
- export { Accordion, type AccordionItem, type AccordionProps, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, type ColorScheme, EmptyState, type EmptyStateProps, Input, type InputProps, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RadioOption, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, useTheme, useToast };
370
+ interface CurrencyInputProps {
371
+ value?: string;
372
+ onChangeText?: (formatted: string) => void;
373
+ /** Called with the parsed numeric value (no separators, no prefix). */
374
+ onChangeValue?: (raw: number) => void;
375
+ /** Symbol prepended to the formatted value. Defaults to `'$'`. */
376
+ prefix?: string;
377
+ /** Character used to separate groups of three digits. Defaults to `'.'`. */
378
+ thousandsSeparator?: '.' | ',';
379
+ label?: string;
380
+ /** Red helper text; also changes input border to destructive color. */
381
+ error?: string;
382
+ hint?: string;
383
+ placeholder?: string;
384
+ editable?: boolean;
385
+ containerStyle?: ViewStyle;
386
+ }
387
+ declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, label, error, hint, placeholder, editable, containerStyle, }: CurrencyInputProps): React.JSX.Element;
388
+
389
+ export { Accordion, type AccordionItem, type AccordionProps, Alert, type AlertProps, type AlertVariant, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, type ColorScheme, CurrencyInput, type CurrencyInputProps, EmptyState, type EmptyStateProps, Input, type InputProps, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RadioOption, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, useTheme, useToast };