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