@retray-dev/ui-kit 1.8.0 → 2.3.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 +80 -23
- package/dist/index.d.mts +46 -42
- package/dist/index.d.ts +46 -42
- package/dist/index.js +442 -333
- package/dist/index.mjs +441 -333
- package/package.json +6 -2
- package/src/components/Alert/Alert.tsx +3 -3
- package/src/components/AlertBanner/AlertBanner.tsx +83 -0
- package/src/components/{Alert → AlertBanner}/index.ts +2 -2
- package/src/components/Avatar/Avatar.tsx +1 -0
- package/src/components/Badge/Badge.tsx +44 -8
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Card/Card.tsx +86 -9
- package/src/components/Chip/Chip.tsx +36 -5
- package/src/components/CurrencyInput/CurrencyInput.tsx +9 -1
- package/src/components/EmptyState/EmptyState.tsx +2 -1
- package/src/components/Input/Input.tsx +102 -21
- package/src/components/MonthPicker/MonthPicker.tsx +2 -2
- package/src/components/Select/Select.tsx +189 -125
- package/src/components/Slider/Slider.tsx +64 -100
- package/src/components/Switch/Switch.tsx +22 -20
- package/src/components/Textarea/Textarea.tsx +12 -2
- package/src/components/Toggle/Toggle.tsx +13 -6
- package/src/index.ts +3 -2
- package/src/theme/ThemeProvider.tsx +11 -8
- package/src/theme/colors.ts +19 -18
- package/src/theme/types.ts +2 -0
- package/src/components/CurrencyInputLarge/CurrencyInputLarge.tsx +0 -66
- package/src/components/CurrencyInputLarge/index.ts +0 -1
package/COMPONENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @retray-dev/ui-kit — Component Reference (
|
|
1
|
+
# @retray-dev/ui-kit — Component Reference (v2.1.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
|
|
|
@@ -74,7 +74,7 @@ function MyComponent() {
|
|
|
74
74
|
|
|
75
75
|
## Theme Tokens
|
|
76
76
|
|
|
77
|
-
All 20 tokens are available via `useTheme().colors
|
|
77
|
+
All 20 tokens are available via `useTheme().colors` and are applied exactly as provided — there is no automatic color derivation or forced contrast applied by the library. Consumers may pass partial overrides for `light` and/or `dark` and the values are used as-is.
|
|
78
78
|
|
|
79
79
|
The `ThemeColors` type (and `Theme`, `ColorScheme`) are exported directly from the package:
|
|
80
80
|
```ts
|
|
@@ -85,23 +85,23 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
85
85
|
|-------|-------|------|---------------|
|
|
86
86
|
| `background` | `#ffffff` | `#171717` | Screen / page background |
|
|
87
87
|
| `foreground` | `#171717` | `#fafafa` | Primary text color |
|
|
88
|
-
| `card` | `#ffffff` | `#
|
|
88
|
+
| `card` | `#ffffff` | `#222222` | Card / surface background |
|
|
89
89
|
| `cardForeground` | `#171717` | `#fafafa` | Text on cards |
|
|
90
90
|
| `primary` | `#1a1a1a` | `#fafafa` | Primary action (buttons, selected states) |
|
|
91
|
-
| `primaryForeground` | `#
|
|
92
|
-
| `secondary` | `#
|
|
93
|
-
| `secondaryForeground` | `#
|
|
94
|
-
| `muted` | `#
|
|
95
|
-
| `mutedForeground` | `#
|
|
96
|
-
| `accent` | `#
|
|
97
|
-
| `accentForeground` | `#
|
|
91
|
+
| `primaryForeground` | `#ffffff` | `#1a1a1a` | Text/icon on primary background |
|
|
92
|
+
| `secondary` | `#f1f1f1` | `#323232` | Secondary surfaces |
|
|
93
|
+
| `secondaryForeground` | `#171717` | `#fafafa` | Text on secondary |
|
|
94
|
+
| `muted` | `#f1f1f1` | `#323232` | Muted backgrounds, skeleton fills, track fills |
|
|
95
|
+
| `mutedForeground` | `#a2a2a2` | `#888888` | Placeholder text, helper text, captions |
|
|
96
|
+
| `accent` | `#e4e4e4` | `#323232` | Hover / pressed state fills |
|
|
97
|
+
| `accentForeground` | `#171717` | `#fafafa` | Text on accent |
|
|
98
98
|
| `destructive` | `#ef4444` | `#dc2626` | Error / danger / delete actions |
|
|
99
|
-
| `destructiveForeground` | `#
|
|
99
|
+
| `destructiveForeground` | `#1a1a1a` | `#1a1a1a` | Text on destructive |
|
|
100
100
|
| `border` | `#e5e5e5` | `#2a2a2a` | Borders and dividers |
|
|
101
101
|
| `input` | `#e5e5e5` | `#2a2a2a` | Input field border color |
|
|
102
|
-
| `ring` | `#
|
|
102
|
+
| `ring` | `#1a1a1a` | `#fafafa` | Optional focus ring token (components may use `primary` by default) |
|
|
103
103
|
| `success` | `#16a34a` | `#22c55e` | Success state (Toast success variant) |
|
|
104
|
-
| `successForeground` | `#
|
|
104
|
+
| `successForeground` | `#1a1a1a` | `#1a1a1a` | Text on success background |
|
|
105
105
|
|
|
106
106
|
---
|
|
107
107
|
|
|
@@ -151,7 +151,7 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
151
151
|
| size | `'sm' \| 'md' \| 'lg'` | `'md'` | — |
|
|
152
152
|
| loading | `boolean` | `false` | Replaces label with a spinner and forces disabled state |
|
|
153
153
|
| fullWidth | `boolean` | `false` | Stretches to container width (`alignSelf: 'stretch'`) |
|
|
154
|
-
| disabled | `boolean` | — | Reduces opacity to 0.
|
|
154
|
+
| disabled | `boolean` | — | Reduces opacity to 0.5 |
|
|
155
155
|
| icon | `React.ReactNode` | — | Icon rendered alongside the label |
|
|
156
156
|
| iconPosition | `'left' \| 'right'` | `'left'` | Side the icon appears on |
|
|
157
157
|
|
|
@@ -186,14 +186,19 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
186
186
|
| label | `string` | — | Label above the input |
|
|
187
187
|
| error | `string` | — | Shows error text below; turns border red (`destructive` token) |
|
|
188
188
|
| hint | `string` | — | Helper text below (hidden when `error` is set) |
|
|
189
|
+
| prefix | `string \| ReactNode` | — | Content rendered before the input field (e.g., `"$"` or an icon) |
|
|
190
|
+
| suffix | `string \| ReactNode` | — | Content rendered after the input field (e.g., `"kg"` or a button) |
|
|
191
|
+
| type | `'text' \| 'password'` | `'text'` | When `'password'`, shows a visibility toggle button in the suffix slot |
|
|
189
192
|
|
|
190
193
|
**Border colors:** `destructive` when `error` is set, `ring` when focused, `border` otherwise.
|
|
191
194
|
|
|
192
195
|
**Example:**
|
|
193
196
|
```tsx
|
|
194
197
|
<Input label="Email" placeholder="you@example.com" keyboardType="email-address" />
|
|
195
|
-
<Input label="Password"
|
|
198
|
+
<Input label="Password" type="password" error="Incorrect password" />
|
|
196
199
|
<Input label="Username" hint="Must be at least 4 characters" />
|
|
200
|
+
<Input label="Amount" prefix="$" placeholder="0.00" keyboardType="numeric" />
|
|
201
|
+
<Input label="Weight" suffix="kg" placeholder="0" />
|
|
197
202
|
```
|
|
198
203
|
|
|
199
204
|
---
|
|
@@ -210,6 +215,7 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
210
215
|
| onChangeValue | `(raw: number) => void` | — | Called with the parsed number (no separators, no prefix) |
|
|
211
216
|
| prefix | `string` | `'$'` | Symbol prepended to the formatted value |
|
|
212
217
|
| thousandsSeparator | `'.' \| ','` | `'.'` | Character used to separate groups of three digits |
|
|
218
|
+
| size | `'default' \| 'large'` | `'default'` | `'large'` uses 36px font size (previously `CurrencyInputLarge`) |
|
|
213
219
|
| label | `string` | — | Label above the input |
|
|
214
220
|
| error | `string` | — | Error text below; turns border red |
|
|
215
221
|
| hint | `string` | — | Helper text below (hidden when `error` is set) |
|
|
@@ -270,16 +276,20 @@ const [amount, setAmount] = useState(0)
|
|
|
270
276
|
|
|
271
277
|
| Prop | Type | Default | Notes |
|
|
272
278
|
|------|------|---------|-------|
|
|
273
|
-
| label | `string` |
|
|
279
|
+
| label | `string` | — | Badge text — can be omitted if using `children` |
|
|
280
|
+
| children | `ReactNode` | — | Alternative to `label` for custom content |
|
|
274
281
|
| variant | `'default' \| 'secondary' \| 'destructive' \| 'outline'` | `'default'` | — |
|
|
282
|
+
| size | `'sm' \| 'md' \| 'lg'` | `'md'` | Controls padding and font size |
|
|
283
|
+
| icon | `ReactNode` | — | Icon rendered before the label/children |
|
|
275
284
|
| style | `ViewStyle` | — | — |
|
|
276
285
|
|
|
277
286
|
**Example:**
|
|
278
287
|
```tsx
|
|
279
288
|
<Badge label="New" />
|
|
280
289
|
<Badge label="Error" variant="destructive" />
|
|
281
|
-
<Badge label="Draft" variant="secondary" />
|
|
290
|
+
<Badge label="Draft" variant="secondary" size="sm" />
|
|
282
291
|
<Badge label="Beta" variant="outline" />
|
|
292
|
+
<Badge icon={<CheckIcon size={12} />} size="sm">Verified</Badge>
|
|
283
293
|
```
|
|
284
294
|
|
|
285
295
|
---
|
|
@@ -458,11 +468,20 @@ const [amount, setAmount] = useState(0)
|
|
|
458
468
|
**Import:** `import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@retray-dev/ui-kit'`
|
|
459
469
|
**When to use:** Grouped content with a surface background, border, and shadow.
|
|
460
470
|
|
|
461
|
-
|
|
471
|
+
**`Card` Props:**
|
|
472
|
+
|
|
473
|
+
| Prop | Type | Default | Notes |
|
|
474
|
+
|------|------|---------|-------|
|
|
475
|
+
| variant | `'elevated' \| 'outlined' \| 'filled'` | `'elevated'` | `elevated`: shadow + border; `outlined`: border only; `filled`: background fill, no border |
|
|
476
|
+
| onPress | `() => void` | — | Makes the card pressable with scale animation + haptics |
|
|
477
|
+
| children | `ReactNode` | — | — |
|
|
478
|
+
| style | `ViewStyle` | — | — |
|
|
479
|
+
|
|
480
|
+
All sub-components (`CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter`) accept a `style` prop for overrides.
|
|
462
481
|
|
|
463
482
|
**Example:**
|
|
464
483
|
```tsx
|
|
465
|
-
<Card>
|
|
484
|
+
<Card variant="elevated">
|
|
466
485
|
<CardHeader>
|
|
467
486
|
<CardTitle>Account</CardTitle>
|
|
468
487
|
<CardDescription>Manage your profile settings</CardDescription>
|
|
@@ -474,6 +493,13 @@ All sub-components accept a `style` prop for overrides.
|
|
|
474
493
|
<Button label="Save" fullWidth />
|
|
475
494
|
</CardFooter>
|
|
476
495
|
</Card>
|
|
496
|
+
|
|
497
|
+
// Pressable card
|
|
498
|
+
<Card variant="outlined" onPress={() => navigate('detail')}>
|
|
499
|
+
<CardContent>
|
|
500
|
+
<Text>Tap me</Text>
|
|
501
|
+
</CardContent>
|
|
502
|
+
</Card>
|
|
477
503
|
```
|
|
478
504
|
|
|
479
505
|
**Notes:**
|
|
@@ -481,6 +507,7 @@ All sub-components accept a `style` prop for overrides.
|
|
|
481
507
|
- `CardFooter` has `paddingTop: 0` so it connects naturally to `CardContent`
|
|
482
508
|
- `CardTitle`: 18px / 600 weight, `cardForeground` color
|
|
483
509
|
- `CardDescription`: 14px, `mutedForeground` color
|
|
510
|
+
- Press animation scales to 0.98 via `Animated.spring` when `onPress` is provided
|
|
484
511
|
|
|
485
512
|
---
|
|
486
513
|
|
|
@@ -638,7 +665,7 @@ const [accepted, setAccepted] = useState(false)
|
|
|
638
665
|
### Select
|
|
639
666
|
|
|
640
667
|
**Import:** `import { Select } from '@retray-dev/ui-kit'`
|
|
641
|
-
**When to use:** Dropdown picker.
|
|
668
|
+
**When to use:** Dropdown picker. Uses the native system picker UI on each platform — wheel modal on iOS (confirm with "Done"), spinner dialog on Android, native `<select>` on web (full keyboard support). Requires `@react-native-picker/picker` installed in the consuming app.
|
|
642
669
|
|
|
643
670
|
| Prop | Type | Default | Notes |
|
|
644
671
|
|------|------|---------|-------|
|
|
@@ -678,13 +705,27 @@ const [accepted, setAccepted] = useState(false)
|
|
|
678
705
|
| onValueChange | `(value: number) => void` | — | Fires while dragging |
|
|
679
706
|
| onSlidingComplete | `(value: number) => void` | — | Fires on finger release |
|
|
680
707
|
| disabled | `boolean` | — | — |
|
|
708
|
+
| label | `string` | — | Label text displayed above the slider |
|
|
709
|
+
| showValue | `boolean` | `false` | When `true`, displays the current value at the top right |
|
|
710
|
+
| formatValue | `(value: number) => string` | — | Custom formatter for the displayed value |
|
|
711
|
+
| accessibilityLabel | `string` | — | Accessibility label for screen readers |
|
|
681
712
|
| style | `ViewStyle` | — | — |
|
|
682
713
|
|
|
683
|
-
**
|
|
714
|
+
**Notes:** Uses `@react-native-community/slider` natively — theming applied via `minimumTrackTintColor` (primary), `maximumTrackTintColor` (muted), `thumbTintColor` (primary). Requires `@react-native-community/slider` installed in the consuming app.
|
|
684
715
|
|
|
685
716
|
**Example:**
|
|
686
717
|
```tsx
|
|
687
718
|
<Slider value={volume} minimumValue={0} maximumValue={100} step={1} onValueChange={setVolume} />
|
|
719
|
+
<Slider
|
|
720
|
+
label="Volume"
|
|
721
|
+
showValue
|
|
722
|
+
value={volume}
|
|
723
|
+
minimumValue={0}
|
|
724
|
+
maximumValue={100}
|
|
725
|
+
step={5}
|
|
726
|
+
formatValue={(v) => `${v}%`}
|
|
727
|
+
onValueChange={setVolume}
|
|
728
|
+
/>
|
|
688
729
|
```
|
|
689
730
|
|
|
690
731
|
---
|
|
@@ -905,14 +946,16 @@ function MyComponent() {
|
|
|
905
946
|
| Prop | Type | Default | Notes |
|
|
906
947
|
|------|------|---------|-------|
|
|
907
948
|
| options | `ChipOption[]` | required | Each: `{ label: string, value: string \| number }` |
|
|
908
|
-
| value | `string \| number` | — | Currently selected value |
|
|
909
|
-
| onValueChange | `(value: string \| number) => void` | — | — |
|
|
949
|
+
| value | `string \| number \| (string \| number)[]` | — | Currently selected value (single mode) or array of selected values (multi mode) |
|
|
950
|
+
| onValueChange | `(value: string \| number \| (string \| number)[]) => void` | — | — |
|
|
951
|
+
| multiSelect | `boolean` | `false` | When `true`, allows multiple chips to be selected simultaneously |
|
|
910
952
|
| style | `ViewStyle` | — | Applied to the wrapping row |
|
|
911
953
|
|
|
912
954
|
**Animation:** Background, text, and border colors animate via `Animated.timing` (150ms) between unselected (`secondary`/`border`/`foreground`) and selected (`primary`/`primary`/`primaryForeground`) states.
|
|
913
955
|
|
|
914
956
|
**Example:**
|
|
915
957
|
```tsx
|
|
958
|
+
// Single select
|
|
916
959
|
const [pct, setPct] = useState(50)
|
|
917
960
|
|
|
918
961
|
<ChipGroup
|
|
@@ -924,6 +967,20 @@ const [pct, setPct] = useState(50)
|
|
|
924
967
|
value={pct}
|
|
925
968
|
onValueChange={setPct}
|
|
926
969
|
/>
|
|
970
|
+
|
|
971
|
+
// Multi select
|
|
972
|
+
const [categories, setCategories] = useState<number[]>([1, 3])
|
|
973
|
+
|
|
974
|
+
<ChipGroup
|
|
975
|
+
multiSelect
|
|
976
|
+
options={[
|
|
977
|
+
{ label: 'Food', value: 1 },
|
|
978
|
+
{ label: 'Transport', value: 2 },
|
|
979
|
+
{ label: 'Entertainment', value: 3 },
|
|
980
|
+
]}
|
|
981
|
+
value={categories}
|
|
982
|
+
onValueChange={setCategories}
|
|
983
|
+
/>
|
|
927
984
|
```
|
|
928
985
|
|
|
929
986
|
---
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TouchableOpacityProps, TextProps as TextProps$1, TextInputProps,
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
/**
|
|
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
|
|
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,25 +430,6 @@ 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
|
-
|
|
431
433
|
interface ListItemProps {
|
|
432
434
|
icon?: React.ReactNode;
|
|
433
435
|
title: string;
|
|
@@ -451,12 +453,14 @@ interface ChipOption {
|
|
|
451
453
|
}
|
|
452
454
|
interface ChipGroupProps {
|
|
453
455
|
options: ChipOption[];
|
|
454
|
-
value?: string | number;
|
|
455
|
-
onValueChange?: (value: string | number) => void;
|
|
456
|
+
value?: string | number | (string | number)[];
|
|
457
|
+
onValueChange?: (value: string | number | (string | number)[]) => void;
|
|
458
|
+
/** When true, allows selecting multiple chips. `value` and `onValueChange` will use arrays. */
|
|
459
|
+
multiSelect?: boolean;
|
|
456
460
|
style?: ViewStyle;
|
|
457
461
|
}
|
|
458
462
|
declare function Chip({ label, selected, onPress, style }: ChipProps): React.JSX.Element;
|
|
459
|
-
declare function ChipGroup({ options, value, onValueChange, style }: ChipGroupProps): React.JSX.Element;
|
|
463
|
+
declare function ChipGroup({ options, value, onValueChange, multiSelect, style }: ChipGroupProps): React.JSX.Element;
|
|
460
464
|
|
|
461
465
|
interface ConfirmDialogProps {
|
|
462
466
|
visible: boolean;
|
|
@@ -489,4 +493,4 @@ interface MonthPickerProps {
|
|
|
489
493
|
}
|
|
490
494
|
declare function MonthPicker({ value, onChange, style }: MonthPickerProps): React.JSX.Element;
|
|
491
495
|
|
|
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,
|
|
496
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TouchableOpacityProps, TextProps as TextProps$1, TextInputProps,
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
/**
|
|
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
|
|
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,25 +430,6 @@ 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
|
-
|
|
431
433
|
interface ListItemProps {
|
|
432
434
|
icon?: React.ReactNode;
|
|
433
435
|
title: string;
|
|
@@ -451,12 +453,14 @@ interface ChipOption {
|
|
|
451
453
|
}
|
|
452
454
|
interface ChipGroupProps {
|
|
453
455
|
options: ChipOption[];
|
|
454
|
-
value?: string | number;
|
|
455
|
-
onValueChange?: (value: string | number) => void;
|
|
456
|
+
value?: string | number | (string | number)[];
|
|
457
|
+
onValueChange?: (value: string | number | (string | number)[]) => void;
|
|
458
|
+
/** When true, allows selecting multiple chips. `value` and `onValueChange` will use arrays. */
|
|
459
|
+
multiSelect?: boolean;
|
|
456
460
|
style?: ViewStyle;
|
|
457
461
|
}
|
|
458
462
|
declare function Chip({ label, selected, onPress, style }: ChipProps): React.JSX.Element;
|
|
459
|
-
declare function ChipGroup({ options, value, onValueChange, style }: ChipGroupProps): React.JSX.Element;
|
|
463
|
+
declare function ChipGroup({ options, value, onValueChange, multiSelect, style }: ChipGroupProps): React.JSX.Element;
|
|
460
464
|
|
|
461
465
|
interface ConfirmDialogProps {
|
|
462
466
|
visible: boolean;
|
|
@@ -489,4 +493,4 @@ interface MonthPickerProps {
|
|
|
489
493
|
}
|
|
490
494
|
declare function MonthPicker({ value, onChange, style }: MonthPickerProps): React.JSX.Element;
|
|
491
495
|
|
|
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,
|
|
496
|
+
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 };
|