@retray-dev/ui-kit 1.6.0 → 1.8.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 (39) hide show
  1. package/COMPONENTS.md +264 -15
  2. package/README.md +7 -6
  3. package/dist/index.d.mts +114 -11
  4. package/dist/index.d.ts +114 -11
  5. package/dist/index.js +660 -134
  6. package/dist/index.mjs +656 -138
  7. package/package.json +8 -8
  8. package/src/components/Accordion/Accordion.tsx +4 -4
  9. package/src/components/Alert/Alert.tsx +32 -8
  10. package/src/components/Alert/index.ts +2 -2
  11. package/src/components/Avatar/Avatar.tsx +8 -8
  12. package/src/components/Badge/Badge.tsx +4 -4
  13. package/src/components/Button/Button.tsx +21 -14
  14. package/src/components/Card/Card.tsx +9 -9
  15. package/src/components/Checkbox/Checkbox.tsx +8 -8
  16. package/src/components/Chip/Chip.tsx +142 -0
  17. package/src/components/Chip/index.ts +2 -0
  18. package/src/components/ConfirmDialog/ConfirmDialog.tsx +87 -0
  19. package/src/components/ConfirmDialog/index.ts +2 -0
  20. package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +48 -0
  21. package/src/components/CurrencyDisplay/index.ts +1 -0
  22. package/src/components/CurrencyInputLarge/CurrencyInputLarge.tsx +66 -0
  23. package/src/components/CurrencyInputLarge/index.ts +1 -0
  24. package/src/components/EmptyState/EmptyState.tsx +40 -6
  25. package/src/components/Input/Input.tsx +8 -8
  26. package/src/components/LabelValue/LabelValue.tsx +47 -0
  27. package/src/components/LabelValue/index.ts +2 -0
  28. package/src/components/ListItem/ListItem.tsx +121 -0
  29. package/src/components/ListItem/index.ts +2 -0
  30. package/src/components/MonthPicker/MonthPicker.tsx +92 -0
  31. package/src/components/MonthPicker/index.ts +2 -0
  32. package/src/components/Select/Select.tsx +19 -19
  33. package/src/components/Switch/Switch.tsx +12 -7
  34. package/src/components/Tabs/Tabs.tsx +34 -15
  35. package/src/components/Text/Text.tsx +6 -6
  36. package/src/components/Textarea/Textarea.tsx +9 -9
  37. package/src/components/Toast/Toast.tsx +25 -7
  38. package/src/components/Toggle/Toggle.tsx +93 -24
  39. package/src/index.ts +7 -0
package/dist/index.d.ts CHANGED
@@ -55,7 +55,7 @@ declare function useTheme(): ThemeContextValue;
55
55
  declare const defaultLight: ThemeColors;
56
56
  declare const defaultDark: ThemeColors;
57
57
 
58
- type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost';
58
+ type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive';
59
59
  type ButtonSize = 'sm' | 'md' | 'lg';
60
60
  interface ButtonProps extends TouchableOpacityProps {
61
61
  label: string;
@@ -70,8 +70,12 @@ interface ButtonProps extends TouchableOpacityProps {
70
70
  /** Replaces the label with a spinner and forces `disabled`. */
71
71
  loading?: boolean;
72
72
  fullWidth?: boolean;
73
- /** Icon rendered alongside the label. */
74
- icon?: React.ReactNode;
73
+ /** Icon rendered alongside the label. Can be a ReactNode or a render function `(props) => ReactNode`. */
74
+ icon?: React.ReactNode | ((props: {
75
+ label: string;
76
+ size: ButtonSize;
77
+ variant: ButtonVariant;
78
+ }) => React.ReactNode);
75
79
  /** Side the icon appears on. Defaults to `'left'`. */
76
80
  iconPosition?: 'left' | 'right';
77
81
  }
@@ -166,15 +170,15 @@ interface AvatarProps {
166
170
  }
167
171
  declare function Avatar({ src, fallback, size, style }: AvatarProps): React.JSX.Element;
168
172
 
169
- type AlertVariant = 'default' | 'destructive';
170
- interface AlertProps {
173
+ type AlertBannerVariant = 'default' | 'destructive' | 'success';
174
+ interface AlertBannerProps {
171
175
  title?: string;
172
176
  description?: string;
173
- variant?: AlertVariant;
177
+ variant?: AlertBannerVariant;
174
178
  icon?: React.ReactNode;
175
179
  style?: ViewStyle;
176
180
  }
177
- declare function Alert({ title, description, variant, icon, style }: AlertProps): React.JSX.Element;
181
+ declare function AlertBanner({ title, description, variant, icon, style }: AlertBannerProps): React.JSX.Element;
178
182
 
179
183
  interface ProgressProps {
180
184
  /** Current progress value. Clamped to `[0, max]`. Defaults to `0`. */
@@ -190,9 +194,11 @@ interface EmptyStateProps {
190
194
  title: string;
191
195
  description?: string;
192
196
  action?: React.ReactNode;
197
+ /** `compact` hides description/action and uses tighter spacing and a smaller icon. */
198
+ size?: 'default' | 'compact';
193
199
  style?: ViewStyle;
194
200
  }
195
- declare function EmptyState({ icon, title, description, action, style }: EmptyStateProps): React.JSX.Element;
201
+ declare function EmptyState({ icon, title, description, action, size, style }: EmptyStateProps): React.JSX.Element;
196
202
 
197
203
  interface TextareaProps extends TextInputProps {
198
204
  label?: string;
@@ -232,9 +238,12 @@ interface ToggleProps extends TouchableOpacityProps {
232
238
  variant?: ToggleVariant;
233
239
  size?: ToggleSize;
234
240
  label?: string;
235
- icon?: React.ReactNode;
241
+ /** Icon to show when not pressed */
242
+ icon?: React.ReactNode | ((pressed: boolean) => React.ReactNode);
243
+ /** Icon to show when pressed/active. If omitted, a default check mark is used. */
244
+ activeIcon?: React.ReactNode | ((pressed: boolean) => React.ReactNode);
236
245
  }
237
- declare function Toggle({ pressed, onPressedChange, variant, size, label, icon, disabled, style, ...props }: ToggleProps): React.JSX.Element;
246
+ declare function Toggle({ pressed, onPressedChange, variant, size, label, icon, activeIcon, disabled, style, ...props }: ToggleProps): React.JSX.Element;
238
247
 
239
248
  interface RadioOption {
240
249
  label: string;
@@ -253,6 +262,7 @@ declare function RadioGroup({ options, value, onValueChange, orientation, style,
253
262
  interface TabItem {
254
263
  label: string;
255
264
  value: string;
265
+ icon?: React.ReactNode;
256
266
  }
257
267
  interface TabsProps {
258
268
  tabs: TabItem[];
@@ -349,6 +359,7 @@ interface ToastItem {
349
359
  title?: string;
350
360
  description?: string;
351
361
  variant?: ToastVariant;
362
+ icon?: React.ReactNode;
352
363
  /** Auto-dismiss delay in milliseconds. Defaults to `3000`. */
353
364
  duration?: number;
354
365
  }
@@ -386,4 +397,96 @@ interface CurrencyInputProps {
386
397
  }
387
398
  declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, label, error, hint, placeholder, editable, containerStyle, }: CurrencyInputProps): React.JSX.Element;
388
399
 
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 };
400
+ interface CurrencyDisplayProps {
401
+ value: number | string;
402
+ /** Symbol prepended to the formatted value. Defaults to `'$'`. */
403
+ prefix?: string;
404
+ /** When true, shows two decimal places separated by a comma (e.g. `$25.000,00`). Defaults to `false`. */
405
+ showDecimals?: boolean;
406
+ /** Override the color of the formatted text. Defaults to the `foreground` theme token. */
407
+ textColor?: string;
408
+ style?: ViewStyle;
409
+ }
410
+ declare function CurrencyDisplay({ value, prefix, showDecimals, textColor, style }: CurrencyDisplayProps): React.JSX.Element;
411
+
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
+
431
+ interface ListItemProps {
432
+ icon?: React.ReactNode;
433
+ title: string;
434
+ subtitle?: string;
435
+ trailing?: string | React.ReactNode;
436
+ onPress?: () => void;
437
+ disabled?: boolean;
438
+ style?: ViewStyle;
439
+ }
440
+ declare function ListItem({ icon, title, subtitle, trailing, onPress, disabled, style }: ListItemProps): React.JSX.Element;
441
+
442
+ interface ChipProps {
443
+ label: string;
444
+ selected?: boolean;
445
+ onPress?: () => void;
446
+ style?: ViewStyle;
447
+ }
448
+ interface ChipOption {
449
+ label: string;
450
+ value: string | number;
451
+ }
452
+ interface ChipGroupProps {
453
+ options: ChipOption[];
454
+ value?: string | number;
455
+ onValueChange?: (value: string | number) => void;
456
+ style?: ViewStyle;
457
+ }
458
+ declare function Chip({ label, selected, onPress, style }: ChipProps): React.JSX.Element;
459
+ declare function ChipGroup({ options, value, onValueChange, style }: ChipGroupProps): React.JSX.Element;
460
+
461
+ interface ConfirmDialogProps {
462
+ visible: boolean;
463
+ title: string;
464
+ description?: string;
465
+ confirmLabel?: string;
466
+ cancelLabel?: string;
467
+ confirmVariant?: 'primary' | 'destructive';
468
+ onConfirm: () => void;
469
+ onCancel: () => void;
470
+ }
471
+ declare function ConfirmDialog({ visible, title, description, confirmLabel, cancelLabel, confirmVariant, onConfirm, onCancel, }: ConfirmDialogProps): React.JSX.Element;
472
+
473
+ interface LabelValueProps {
474
+ label: string;
475
+ value: string | React.ReactNode;
476
+ style?: ViewStyle;
477
+ }
478
+ declare function LabelValue({ label, value, style }: LabelValueProps): React.JSX.Element;
479
+
480
+ interface MonthPickerValue {
481
+ /** Month number 1–12 */
482
+ month: number;
483
+ year: number;
484
+ }
485
+ interface MonthPickerProps {
486
+ value: MonthPickerValue;
487
+ onChange: (value: MonthPickerValue) => void;
488
+ style?: ViewStyle;
489
+ }
490
+ declare function MonthPicker({ value, onChange, style }: MonthPickerProps): React.JSX.Element;
491
+
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 };