@retray-dev/ui-kit 1.6.0 → 1.7.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/COMPONENTS.md CHANGED
@@ -1,4 +1,4 @@
1
- # @retray-dev/ui-kit — Component Reference (v1.6.0)
1
+ # @retray-dev/ui-kit — Component Reference (v1.7.0)
2
2
 
3
3
  This file is the AI reference for this package. It is shipped inside the npm package so consuming projects can import it into their `CLAUDE.md` with:
4
4
 
@@ -216,6 +216,7 @@ All 20 tokens are available via `useTheme().colors`.
216
216
  const [display, setDisplay] = useState('')
217
217
  const [amount, setAmount] = useState(0)
218
218
 
219
+ // Default: dot as thousands separator → "$1.234.567"
219
220
  <CurrencyInput
220
221
  label="Amount"
221
222
  value={display}
@@ -224,10 +225,10 @@ const [amount, setAmount] = useState(0)
224
225
  hint={`Parsed: ${amount}`}
225
226
  />
226
227
 
227
- // European format (dot as thousands separator)
228
+ // Comma as thousands separator → "$1,234,567"
228
229
  <CurrencyInput
229
- prefix=""
230
- thousandsSeparator="."
230
+ prefix="$"
231
+ thousandsSeparator=","
231
232
  value={display}
232
233
  onChangeText={setDisplay}
233
234
  onChangeValue={setAmount}
@@ -386,6 +387,95 @@ const [amount, setAmount] = useState(0)
386
387
 
387
388
  All sub-components accept a `style` prop for overrides.
388
389
 
390
+ **Example:**
391
+ ```tsx
392
+ <Card>
393
+ <CardHeader>
394
+ <CardTitle>Account</CardTitle>
395
+ <CardDescription>Manage your profile settings</CardDescription>
396
+ </CardHeader>
397
+ <CardContent>
398
+ <Input label="Name" />
399
+ </CardContent>
400
+ <CardFooter>
401
+ <Button label="Save" fullWidth />
402
+ </CardFooter>
403
+
404
+ ---
405
+
406
+ ### CurrencyDisplay
407
+
408
+ **Import:** `import { CurrencyDisplay } from '@retray-dev/ui-kit'`
409
+ **When to use:** Prominent display of monetary values (account balances, totals). Large, attention-grabbing typographic treatment with dot-separated thousands and optional comma-decimal.
410
+
411
+ | Prop | Type | Default | Notes |
412
+ |------|------|---------|-------|
413
+ | value | `number \| string` | required | Numeric value to display |
414
+ | prefix | `string` | `'$'` | Symbol prepended to the formatted value |
415
+ | showDecimals | `boolean` | `false` | When `true`, shows two decimal places separated by a comma (e.g. `$25.000,00`) |
416
+ | style | `ViewStyle` | — | Style override for outer container |
417
+
418
+ **Example:**
419
+ ```tsx
420
+ <CurrencyDisplay value={25000} />
421
+ // → $25.000
422
+
423
+ <CurrencyDisplay value={25000000.5} showDecimals />
424
+ // → $25.000.000,50
425
+
426
+ <CurrencyDisplay value={1500} prefix="€" />
427
+ // → €1.500
428
+ ```
429
+
430
+ **Notes:**
431
+ - Uses dot (`.`) as thousands separator and comma (`,`) as decimal separator — Latin American / European format.
432
+ - Intended as a display-only component (not editable).
433
+ - `allowFontScaling={true}` is set on the inner `Text`.
434
+
435
+ ---
436
+
437
+ ### CurrencyInputLarge
438
+
439
+ **Import:** `import { CurrencyInputLarge } from '@retray-dev/ui-kit'`
440
+ **When to use:** Large, form-style monetary input for prominent entry screens (payments, transfers). Same formatting behavior as `CurrencyInput` but with 36px font size.
441
+
442
+ | Prop | Type | Default | Notes |
443
+ |------|------|---------|-------|
444
+ | value | `string` | — | Controlled display value (includes prefix, e.g. `'$1.234'`) |
445
+ | onChangeText | `(formatted: string) => void` | — | Called with the formatted display string |
446
+ | onChangeValue | `(raw: number) => void` | — | Called with the parsed number (no separators, no prefix) |
447
+ | label | `string` | — | Label above the input |
448
+ | prefix | `string` | `'$'` | Currency prefix |
449
+ | thousandsSeparator | `'.' \| ','` | `'.'` | Separator used to format groups of three digits |
450
+ | error | `string` | — | Error text below; turns border red |
451
+ | hint | `string` | — | Helper text below (hidden when `error` is set) |
452
+ | placeholder | `string` | `'$0'` | Defaults to `prefix + '0'` |
453
+ | editable | `boolean` | — | Pass `false` to disable editing |
454
+ | containerStyle | `ViewStyle` | — | Style for the outer container |
455
+
456
+ **Example:**
457
+ ```tsx
458
+ const [display, setDisplay] = useState('')
459
+ const [amount, setAmount] = useState(0)
460
+
461
+ <CurrencyInputLarge
462
+ label="Amount"
463
+ value={display}
464
+ onChangeText={setDisplay}
465
+ onChangeValue={setAmount}
466
+ />
467
+ // Typing "25000" produces "$25.000"
468
+ ```
469
+
470
+ ---
471
+
472
+ ### Card
473
+
474
+ **Import:** `import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@retray-dev/ui-kit'`
475
+ **When to use:** Grouped content with a surface background, border, and shadow.
476
+
477
+ All sub-components accept a `style` prop for overrides.
478
+
389
479
  **Example:**
390
480
  ```tsx
391
481
  <Card>
@@ -487,7 +577,7 @@ const [accepted, setAccepted] = useState(false)
487
577
  | disabled | `boolean` | — | Reduces opacity to 0.45 |
488
578
  | style | `ViewStyle` | — | — |
489
579
 
490
- **Dimensions:** Track 56×32pt, Thumb 24×24pt with 4pt offset from edges.
580
+ **Dimensions:** Track 56×32pt, Thumb 24×24pt with 4pt offset from edges (`top: 4, left: 4`). Thumb uses `position: 'absolute'` inside the track.
491
581
 
492
582
  **Animation:** Thumb translates via spring (bounciness: 4); track color transitions via opacity timing (150ms).
493
583
 
@@ -510,11 +600,22 @@ const [accepted, setAccepted] = useState(false)
510
600
  | variant | `'default' \| 'outline'` | `'default'` | `outline` adds a border when unpressed |
511
601
  | size | `'sm' \| 'md' \| 'lg'` | `'md'` | sm=minH 40pt, md=minH 44pt, lg=minH 48pt |
512
602
  | label | `string` | — | Text label |
513
- | icon | `ReactNode` | — | Icon — can be combined with `label` |
603
+ | icon | `ReactNode \| ((pressed: boolean) => ReactNode)` | — | Icon shown when not pressed — can be combined with `label` |
604
+ | activeIcon | `ReactNode \| ((pressed: boolean) => ReactNode)` | — | Icon shown when pressed. If omitted, a default `✓` check mark is shown |
605
+
606
+ **Animation:** `borderColor` and `backgroundColor` animate via `Animated.timing` (150ms, `Easing.out`) on press state change. `borderWidth` stays fixed at 2pt to prevent layout jumps.
514
607
 
515
608
  **Example:**
516
609
  ```tsx
517
610
  <Toggle pressed={bold} onPressedChange={setBold} label="Bold" variant="outline" />
611
+
612
+ // With custom active icon
613
+ <Toggle
614
+ pressed={favorited}
615
+ onPressedChange={setFavorited}
616
+ icon={<HeartIcon size={18} />}
617
+ activeIcon={<HeartIcon size={18} color={colors.primary} />}
618
+ />
518
619
  ```
519
620
 
520
621
  ---
@@ -748,6 +849,7 @@ function MyComponent() {
748
849
  | description | `string` | — | Detail text |
749
850
  | variant | `'default' \| 'destructive' \| 'success'` | `'default'` | `default`: dark background. `destructive`: red. `success`: green |
750
851
  | duration | `number` (ms) | `3000` | Auto-dismiss after this delay |
852
+ | icon | `ReactNode` | — | Custom icon node. Defaults to a variant-appropriate symbol (`✓`, `✖`, `ℹ`) at 22px |
751
853
 
752
854
  **`dismiss(id)`:** Dismiss a toast programmatically. The `id` is returned by the `toast()` call — store it if you need programmatic dismissal.
753
855
 
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A personal React Native / Expo UI component library with a built-in design system, dark mode support, haptic feedback, and smooth animations.
4
4
 
5
- - 24 components across 5 categories
5
+ - 26 components across 5 categories
6
6
  - Light/dark theme with 18 color tokens and full customization
7
7
  - Apple HIG–compliant touch targets and haptic feedback
8
8
  - Animated interactions: spring press, sliding tabs, accordion easing, animated progress
@@ -99,9 +99,9 @@ const { colors, colorScheme } = useTheme()
99
99
 
100
100
  | Category | Components |
101
101
  | ----------- | ----------------------------------------------------------------------------------------------- |
102
- | Display | `Text`, `Badge`, `Avatar`, `Separator`, `Spinner`, `Skeleton`, `Progress` |
102
+ | Display | `Text`, `Badge`, `Avatar`, `Separator`, `Spinner`, `Skeleton`, `Progress`, `CurrencyDisplay` |
103
103
  | Surfaces | `Card`, `Alert`, `EmptyState` |
104
- | Form | `Button`, `Input`, `CurrencyInput`, `Textarea`, `Checkbox`, `Switch`, `Toggle`, `RadioGroup`, `Select`, `Slider` |
104
+ | Form | `Button`, `Input`, `CurrencyInput`, `CurrencyInputLarge`, `Textarea`, `Checkbox`, `Switch`, `Toggle`, `RadioGroup`, `Select`, `Slider` |
105
105
  | Composition | `Tabs`, `Accordion` |
106
106
  | Overlays | `Sheet` |
107
107
  | Feedback | `Toast` / `ToastProvider` / `useToast` |
package/dist/index.d.mts CHANGED
@@ -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
  }
@@ -232,9 +236,12 @@ interface ToggleProps extends TouchableOpacityProps {
232
236
  variant?: ToggleVariant;
233
237
  size?: ToggleSize;
234
238
  label?: string;
235
- icon?: React.ReactNode;
239
+ /** Icon to show when not pressed */
240
+ icon?: React.ReactNode | ((pressed: boolean) => React.ReactNode);
241
+ /** Icon to show when pressed/active. If omitted, a default check mark is used. */
242
+ activeIcon?: React.ReactNode | ((pressed: boolean) => React.ReactNode);
236
243
  }
237
- declare function Toggle({ pressed, onPressedChange, variant, size, label, icon, disabled, style, ...props }: ToggleProps): React.JSX.Element;
244
+ declare function Toggle({ pressed, onPressedChange, variant, size, label, icon, activeIcon, disabled, style, ...props }: ToggleProps): React.JSX.Element;
238
245
 
239
246
  interface RadioOption {
240
247
  label: string;
@@ -253,6 +260,7 @@ declare function RadioGroup({ options, value, onValueChange, orientation, style,
253
260
  interface TabItem {
254
261
  label: string;
255
262
  value: string;
263
+ icon?: React.ReactNode;
256
264
  }
257
265
  interface TabsProps {
258
266
  tabs: TabItem[];
@@ -349,6 +357,7 @@ interface ToastItem {
349
357
  title?: string;
350
358
  description?: string;
351
359
  variant?: ToastVariant;
360
+ icon?: React.ReactNode;
352
361
  /** Auto-dismiss delay in milliseconds. Defaults to `3000`. */
353
362
  duration?: number;
354
363
  }
@@ -386,4 +395,33 @@ interface CurrencyInputProps {
386
395
  }
387
396
  declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, label, error, hint, placeholder, editable, containerStyle, }: CurrencyInputProps): React.JSX.Element;
388
397
 
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 };
398
+ interface CurrencyDisplayProps {
399
+ value: number | string;
400
+ /** Symbol prepended to the formatted value. Defaults to `'$'`. */
401
+ prefix?: string;
402
+ /** When true, shows two decimal places separated by a comma (e.g. `$25.000,00`). Defaults to `false`. */
403
+ showDecimals?: boolean;
404
+ style?: ViewStyle;
405
+ }
406
+ declare function CurrencyDisplay({ value, prefix, showDecimals, style }: CurrencyDisplayProps): React.JSX.Element;
407
+
408
+ interface CurrencyInputLargeProps {
409
+ value?: string;
410
+ onChangeText?: (formatted: string) => void;
411
+ /** Called with the parsed numeric value (no separators, no prefix). */
412
+ onChangeValue?: (raw: number) => void;
413
+ /** Symbol prepended to the formatted value. Defaults to `'$'`. */
414
+ prefix?: string;
415
+ /** Character used to separate groups of three digits. Defaults to `'.'`. */
416
+ thousandsSeparator?: '.' | ',';
417
+ label?: string;
418
+ /** Red helper text; also changes input border to destructive color. */
419
+ error?: string;
420
+ hint?: string;
421
+ placeholder?: string;
422
+ editable?: boolean;
423
+ containerStyle?: ViewStyle;
424
+ }
425
+ declare function CurrencyInputLarge({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, label, error, hint, placeholder, editable, containerStyle, }: CurrencyInputLargeProps): React.JSX.Element;
426
+
427
+ 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, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInputLarge, type CurrencyInputLargeProps, 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
@@ -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
  }
@@ -232,9 +236,12 @@ interface ToggleProps extends TouchableOpacityProps {
232
236
  variant?: ToggleVariant;
233
237
  size?: ToggleSize;
234
238
  label?: string;
235
- icon?: React.ReactNode;
239
+ /** Icon to show when not pressed */
240
+ icon?: React.ReactNode | ((pressed: boolean) => React.ReactNode);
241
+ /** Icon to show when pressed/active. If omitted, a default check mark is used. */
242
+ activeIcon?: React.ReactNode | ((pressed: boolean) => React.ReactNode);
236
243
  }
237
- declare function Toggle({ pressed, onPressedChange, variant, size, label, icon, disabled, style, ...props }: ToggleProps): React.JSX.Element;
244
+ declare function Toggle({ pressed, onPressedChange, variant, size, label, icon, activeIcon, disabled, style, ...props }: ToggleProps): React.JSX.Element;
238
245
 
239
246
  interface RadioOption {
240
247
  label: string;
@@ -253,6 +260,7 @@ declare function RadioGroup({ options, value, onValueChange, orientation, style,
253
260
  interface TabItem {
254
261
  label: string;
255
262
  value: string;
263
+ icon?: React.ReactNode;
256
264
  }
257
265
  interface TabsProps {
258
266
  tabs: TabItem[];
@@ -349,6 +357,7 @@ interface ToastItem {
349
357
  title?: string;
350
358
  description?: string;
351
359
  variant?: ToastVariant;
360
+ icon?: React.ReactNode;
352
361
  /** Auto-dismiss delay in milliseconds. Defaults to `3000`. */
353
362
  duration?: number;
354
363
  }
@@ -386,4 +395,33 @@ interface CurrencyInputProps {
386
395
  }
387
396
  declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, label, error, hint, placeholder, editable, containerStyle, }: CurrencyInputProps): React.JSX.Element;
388
397
 
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 };
398
+ interface CurrencyDisplayProps {
399
+ value: number | string;
400
+ /** Symbol prepended to the formatted value. Defaults to `'$'`. */
401
+ prefix?: string;
402
+ /** When true, shows two decimal places separated by a comma (e.g. `$25.000,00`). Defaults to `false`. */
403
+ showDecimals?: boolean;
404
+ style?: ViewStyle;
405
+ }
406
+ declare function CurrencyDisplay({ value, prefix, showDecimals, style }: CurrencyDisplayProps): React.JSX.Element;
407
+
408
+ interface CurrencyInputLargeProps {
409
+ value?: string;
410
+ onChangeText?: (formatted: string) => void;
411
+ /** Called with the parsed numeric value (no separators, no prefix). */
412
+ onChangeValue?: (raw: number) => void;
413
+ /** Symbol prepended to the formatted value. Defaults to `'$'`. */
414
+ prefix?: string;
415
+ /** Character used to separate groups of three digits. Defaults to `'.'`. */
416
+ thousandsSeparator?: '.' | ',';
417
+ label?: string;
418
+ /** Red helper text; also changes input border to destructive color. */
419
+ error?: string;
420
+ hint?: string;
421
+ placeholder?: string;
422
+ editable?: boolean;
423
+ containerStyle?: ViewStyle;
424
+ }
425
+ declare function CurrencyInputLarge({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, label, error, hint, placeholder, editable, containerStyle, }: CurrencyInputLargeProps): React.JSX.Element;
426
+
427
+ 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, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInputLarge, type CurrencyInputLargeProps, 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 };