@retray-dev/ui-kit 1.8.0 → 2.5.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.
Files changed (34) hide show
  1. package/COMPONENTS.md +150 -43
  2. package/dist/index.d.mts +80 -44
  3. package/dist/index.d.ts +80 -44
  4. package/dist/index.js +627 -457
  5. package/dist/index.mjs +626 -457
  6. package/package.json +8 -2
  7. package/src/components/Accordion/Accordion.tsx +4 -6
  8. package/src/components/Alert/Alert.tsx +3 -3
  9. package/src/components/AlertBanner/AlertBanner.tsx +85 -0
  10. package/src/components/{Alert → AlertBanner}/index.ts +2 -2
  11. package/src/components/Avatar/Avatar.tsx +1 -0
  12. package/src/components/Badge/Badge.tsx +45 -9
  13. package/src/components/Button/Button.tsx +5 -5
  14. package/src/components/Card/Card.tsx +90 -18
  15. package/src/components/Checkbox/Checkbox.tsx +4 -4
  16. package/src/components/Chip/Chip.tsx +36 -5
  17. package/src/components/CurrencyInput/CurrencyInput.tsx +9 -1
  18. package/src/components/EmptyState/EmptyState.tsx +2 -1
  19. package/src/components/Input/Input.tsx +107 -26
  20. package/src/components/ListItem/ListItem.tsx +157 -21
  21. package/src/components/MonthPicker/MonthPicker.tsx +3 -6
  22. package/src/components/RadioGroup/RadioGroup.tsx +2 -2
  23. package/src/components/Select/Select.tsx +200 -132
  24. package/src/components/Slider/Slider.tsx +64 -100
  25. package/src/components/Switch/Switch.tsx +22 -20
  26. package/src/components/Textarea/Textarea.tsx +16 -7
  27. package/src/components/Toast/Toast.tsx +23 -18
  28. package/src/components/Toggle/Toggle.tsx +36 -49
  29. package/src/index.ts +3 -2
  30. package/src/theme/ThemeProvider.tsx +11 -8
  31. package/src/theme/colors.ts +19 -18
  32. package/src/theme/types.ts +2 -0
  33. package/src/components/CurrencyInputLarge/CurrencyInputLarge.tsx +0 -66
  34. package/src/components/CurrencyInputLarge/index.ts +0 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { TouchableOpacityProps, TextProps as TextProps$1, TextInputProps, ViewStyle, TextStyle, ActivityIndicatorProps } from 'react-native';
2
+ import { TouchableOpacityProps, TextProps as TextProps$1, TextInputProps, TextStyle, ViewStyle, ActivityIndicatorProps } from 'react-native';
3
3
  export { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
4
4
 
5
5
  type ThemeColors = {
@@ -36,11 +36,10 @@ type ThemeContextValue = {
36
36
  interface ThemeProviderProps {
37
37
  children: React.ReactNode;
38
38
  /**
39
- * Override individual color tokens per scheme. Only provide the tokens you want
40
- * to change the rest fall back to the defaults.
41
- * @example
42
- * { light: { primary: '#6366f1', primaryForeground: '#fff' },
43
- * dark: { primary: '#818cf8', primaryForeground: '#fff' } }
39
+ * Optional full-palette overrides per scheme. Supply a partial or full `ThemeColors` object
40
+ * for `light` and/or `dark` to override the defaults.
41
+ * @example
42
+ * { light: { primary: '#6366f1', card: '#fff' }, dark: { primary: '#818cf8' } }
44
43
  */
45
44
  theme?: Theme;
46
45
  /**
@@ -94,21 +93,42 @@ interface InputProps extends TextInputProps {
94
93
  error?: string;
95
94
  /** Helper text shown below the input when there is no error. */
96
95
  hint?: string;
97
- /** Style for the outer container `View`. Use `style` (from `TextInputProps`) to style the `TextInput` itself. */
96
+ /** Text or component rendered before the input text. */
97
+ prefix?: React.ReactNode;
98
+ /** Text or component rendered after the input text. */
99
+ suffix?: React.ReactNode;
100
+ /** Style applied to prefix text if prefix is a string. */
101
+ prefixStyle?: TextStyle;
102
+ /** Style applied to suffix text if suffix is a string. */
103
+ suffixStyle?: TextStyle;
104
+ /** Input type. When set to \`'password'\`, shows a toggle button to reveal/hide text. */
105
+ type?: 'text' | 'password';
106
+ /** Style for the outer container \`View\`. Use \`style\` (from \`TextInputProps\`) to style the \`TextInput\` itself. */
98
107
  containerStyle?: ViewStyle;
99
108
  }
100
- declare function Input({ label, error, hint, containerStyle, style, onFocus, onBlur, ...props }: InputProps): React.JSX.Element;
109
+ declare function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, type, containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps): React.JSX.Element;
101
110
 
102
111
  type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline';
112
+ type BadgeSize = 'sm' | 'md' | 'lg';
103
113
  interface BadgeProps {
104
- label: string;
114
+ label?: string;
115
+ /** Alternative to \`label\` — allows JSX children. */
116
+ children?: React.ReactNode;
105
117
  variant?: BadgeVariant;
118
+ size?: BadgeSize;
119
+ /** Icon rendered before the label/children. */
120
+ icon?: React.ReactNode;
106
121
  style?: ViewStyle;
107
122
  }
108
- declare function Badge({ label, variant, style }: BadgeProps): React.JSX.Element;
123
+ declare function Badge({ label, children, variant, size, icon, style }: BadgeProps): React.JSX.Element;
109
124
 
125
+ type CardVariant = 'elevated' | 'outlined' | 'filled';
110
126
  interface CardProps {
111
127
  children: React.ReactNode;
128
+ /** Visual style variant. `'elevated'` (default) has shadow, `'outlined'` has border only, `'filled'` uses accent background. */
129
+ variant?: CardVariant;
130
+ /** Makes the card tappable. Adds press animation and haptic feedback. */
131
+ onPress?: () => void;
112
132
  style?: ViewStyle;
113
133
  }
114
134
  interface CardHeaderProps {
@@ -131,7 +151,7 @@ interface CardFooterProps {
131
151
  children: React.ReactNode;
132
152
  style?: ViewStyle;
133
153
  }
134
- declare function Card({ children, style }: CardProps): React.JSX.Element;
154
+ declare function Card({ children, variant, onPress, style }: CardProps): React.JSX.Element;
135
155
  declare function CardHeader({ children, style }: CardHeaderProps): React.JSX.Element;
136
156
  declare function CardTitle({ children, style }: CardTitleProps): React.JSX.Element;
137
157
  declare function CardDescription({ children, style }: CardDescriptionProps): React.JSX.Element;
@@ -303,20 +323,20 @@ interface AccordionProps {
303
323
  declare function Accordion({ items, type, defaultValue, style }: AccordionProps): React.JSX.Element;
304
324
 
305
325
  interface SliderProps {
306
- /** Current value. Controlled when provided; falls back to internal state otherwise. */
307
326
  value?: number;
308
327
  minimumValue?: number;
309
328
  maximumValue?: number;
310
- /** Snap interval. `0` (default) means continuous (no snapping). */
311
329
  step?: number;
312
- /** Called on every move while dragging. */
313
330
  onValueChange?: (value: number) => void;
314
- /** Called once when the user releases the thumb. */
315
331
  onSlidingComplete?: (value: number) => void;
332
+ label?: string;
333
+ showValue?: boolean;
334
+ formatValue?: (value: number) => string;
335
+ accessibilityLabel?: string;
316
336
  disabled?: boolean;
317
337
  style?: ViewStyle;
318
338
  }
319
- declare function Slider({ value, minimumValue, maximumValue, step, onValueChange, onSlidingComplete, disabled, style, }: SliderProps): React.JSX.Element;
339
+ declare function Slider({ value, minimumValue, maximumValue, step, onValueChange, onSlidingComplete, label, showValue, formatValue, accessibilityLabel, disabled, style, }: SliderProps): React.JSX.Element;
320
340
 
321
341
  interface SheetProps {
322
342
  open: boolean;
@@ -343,10 +363,8 @@ interface SelectProps {
343
363
  options: SelectOption[];
344
364
  value?: string;
345
365
  onValueChange?: (value: string) => void;
346
- /** Text shown when no option is selected. Defaults to `'Select an option'`. */
347
366
  placeholder?: string;
348
367
  label?: string;
349
- /** Red helper text; also changes trigger border to `destructive` color. */
350
368
  error?: string;
351
369
  disabled?: boolean;
352
370
  style?: ViewStyle;
@@ -387,6 +405,8 @@ interface CurrencyInputProps {
387
405
  prefix?: string;
388
406
  /** Character used to separate groups of three digits. Defaults to `'.'`. */
389
407
  thousandsSeparator?: '.' | ',';
408
+ /** Font size variant. `'large'` renders at 36pt, `'default'` at 17pt. */
409
+ size?: 'default' | 'large';
390
410
  label?: string;
391
411
  /** Red helper text; also changes input border to destructive color. */
392
412
  error?: string;
@@ -394,8 +414,9 @@ interface CurrencyInputProps {
394
414
  placeholder?: string;
395
415
  editable?: boolean;
396
416
  containerStyle?: ViewStyle;
417
+ style?: TextStyle;
397
418
  }
398
- declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, label, error, hint, placeholder, editable, containerStyle, }: CurrencyInputProps): React.JSX.Element;
419
+ declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, size, label, error, hint, placeholder, editable, containerStyle, style, }: CurrencyInputProps): React.JSX.Element;
399
420
 
400
421
  interface CurrencyDisplayProps {
401
422
  value: number | string;
@@ -409,35 +430,48 @@ interface CurrencyDisplayProps {
409
430
  }
410
431
  declare function CurrencyDisplay({ value, prefix, showDecimals, textColor, style }: CurrencyDisplayProps): React.JSX.Element;
411
432
 
412
- interface CurrencyInputLargeProps {
413
- value?: string;
414
- onChangeText?: (formatted: string) => void;
415
- /** Called with the parsed numeric value (no separators, no prefix). */
416
- onChangeValue?: (raw: number) => void;
417
- /** Symbol prepended to the formatted value. Defaults to `'$'`. */
418
- prefix?: string;
419
- /** Character used to separate groups of three digits. Defaults to `'.'`. */
420
- thousandsSeparator?: '.' | ',';
421
- label?: string;
422
- /** Red helper text; also changes input border to destructive color. */
423
- error?: string;
424
- hint?: string;
425
- placeholder?: string;
426
- editable?: boolean;
427
- containerStyle?: ViewStyle;
428
- }
429
- declare function CurrencyInputLarge({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, label, error, hint, placeholder, editable, containerStyle, }: CurrencyInputLargeProps): React.JSX.Element;
430
-
433
+ type ListItemVariant = 'plain' | 'card';
431
434
  interface ListItemProps {
435
+ /**
436
+ * Arbitrary content rendered on the left (avatar, icon, image, etc.).
437
+ * Rendered inside a 44×44 aligned container.
438
+ */
439
+ leftRender?: React.ReactNode;
440
+ /**
441
+ * Arbitrary content rendered on the right (badge, price, chevron, switch, etc.).
442
+ * Replaces the old `trailing` prop (still accepted as an alias).
443
+ */
444
+ rightRender?: React.ReactNode | string;
445
+ /** @deprecated Use `rightRender` instead. */
446
+ trailing?: React.ReactNode | string;
447
+ /** @deprecated Use `leftRender` instead. */
432
448
  icon?: React.ReactNode;
433
449
  title: string;
450
+ /** Secondary line below the title. */
434
451
  subtitle?: string;
435
- trailing?: string | React.ReactNode;
452
+ /** Tertiary / caption line below the subtitle. */
453
+ caption?: string;
454
+ /**
455
+ * - `plain` (default): no background, no border — designed to sit inside a parent surface (Card, list wrapper, etc.)
456
+ * - `card`: standalone surface with background, border and shadow.
457
+ */
458
+ variant?: ListItemVariant;
459
+ /** Show a right-pointing chevron on the far right. Ignored when `rightRender` / `trailing` is set. */
460
+ showChevron?: boolean;
461
+ /** Visual separator line at the bottom of the item. Useful when rendering multiple plain items in a list. */
462
+ showSeparator?: boolean;
436
463
  onPress?: () => void;
437
464
  disabled?: boolean;
465
+ /** Style applied to the outer container. */
438
466
  style?: ViewStyle;
467
+ /** Style applied to the title Text. */
468
+ titleStyle?: TextStyle;
469
+ /** Style applied to the subtitle Text. */
470
+ subtitleStyle?: TextStyle;
471
+ /** Style applied to the caption Text. */
472
+ captionStyle?: TextStyle;
439
473
  }
440
- declare function ListItem({ icon, title, subtitle, trailing, onPress, disabled, style }: ListItemProps): React.JSX.Element;
474
+ declare function ListItem({ leftRender, rightRender, trailing, icon, title, subtitle, caption, variant, showChevron, showSeparator, onPress, disabled, style, titleStyle, subtitleStyle, captionStyle, }: ListItemProps): React.JSX.Element;
441
475
 
442
476
  interface ChipProps {
443
477
  label: string;
@@ -451,12 +485,14 @@ interface ChipOption {
451
485
  }
452
486
  interface ChipGroupProps {
453
487
  options: ChipOption[];
454
- value?: string | number;
455
- onValueChange?: (value: string | number) => void;
488
+ value?: string | number | (string | number)[];
489
+ onValueChange?: (value: string | number | (string | number)[]) => void;
490
+ /** When true, allows selecting multiple chips. `value` and `onValueChange` will use arrays. */
491
+ multiSelect?: boolean;
456
492
  style?: ViewStyle;
457
493
  }
458
494
  declare function Chip({ label, selected, onPress, style }: ChipProps): React.JSX.Element;
459
- declare function ChipGroup({ options, value, onValueChange, style }: ChipGroupProps): React.JSX.Element;
495
+ declare function ChipGroup({ options, value, onValueChange, multiSelect, style }: ChipGroupProps): React.JSX.Element;
460
496
 
461
497
  interface ConfirmDialogProps {
462
498
  visible: boolean;
@@ -489,4 +525,4 @@ interface MonthPickerProps {
489
525
  }
490
526
  declare function MonthPicker({ value, onChange, style }: MonthPickerProps): React.JSX.Element;
491
527
 
492
- export { Accordion, type AccordionItem, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerVariant, 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, Chip, ChipGroup, type ChipGroupProps, type ChipOption, type ChipProps, type ColorScheme, ConfirmDialog, type ConfirmDialogProps, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInputLarge, type CurrencyInputLargeProps, type CurrencyInputProps, EmptyState, type EmptyStateProps, Input, type InputProps, LabelValue, type LabelValueProps, ListItem, type ListItemProps, MonthPicker, type MonthPickerProps, type MonthPickerValue, 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 };
528
+ export { Accordion, type AccordionItem, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerVariant, 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, Chip, ChipGroup, type ChipGroupProps, type ChipOption, type ChipProps, type ColorScheme, ConfirmDialog, type ConfirmDialogProps, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInput as CurrencyInputLarge, type CurrencyInputProps, EmptyState, type EmptyStateProps, Input, type InputProps, LabelValue, type LabelValueProps, ListItem, type ListItemProps, MonthPicker, type MonthPickerProps, type MonthPickerValue, 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 };