@retray-dev/ui-kit 3.0.0 → 4.0.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 +14 -9
- package/README.md +4 -4
- package/dist/index.d.mts +6 -11
- package/dist/index.d.ts +6 -11
- package/dist/index.js +9 -7
- package/dist/index.mjs +9 -7
- package/package.json +1 -1
- package/src/components/AlertBanner/AlertBanner.tsx +1 -1
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +1 -1
- package/src/components/CurrencyInput/CurrencyInput.tsx +7 -4
- package/src/components/Input/Input.tsx +4 -1
- package/src/components/Sheet/Sheet.tsx +1 -7
package/COMPONENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @retray-dev/ui-kit — Component Reference (
|
|
1
|
+
# @retray-dev/ui-kit — Component Reference (v4.0.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
|
|
|
@@ -713,8 +713,8 @@ All sub-components (`CardHeader`, `CardTitle`, `CardDescription`, `CardContent`,
|
|
|
713
713
|
|
|
714
714
|
| Prop | Type | Default | Notes |
|
|
715
715
|
|------|------|---------|-------|
|
|
716
|
-
| title | `string` |
|
|
717
|
-
| description | `string` | — |
|
|
716
|
+
| title | `string` | required | Bold heading |
|
|
717
|
+
| description | `string` | — | Optional detail text below the title |
|
|
718
718
|
| variant | `'default' \| 'destructive' \| 'success'` | `'default'` | Controls border/text color |
|
|
719
719
|
| icon | `ReactNode` | — | Icon placed to the left of the text content. Defaults to a variant-appropriate symbol (`ℹ`, `⚠`, `✓`) |
|
|
720
720
|
| iconName | `string` | — | Icon name from `@expo/vector-icons`. Takes precedence over `icon` (but still falls back to the variant default when neither is set) |
|
|
@@ -1009,7 +1009,7 @@ const [tab, setTab] = useState('profile')
|
|
|
1009
1009
|
### Sheet
|
|
1010
1010
|
|
|
1011
1011
|
**Import:** `import { Sheet, BottomSheetModalProvider } from '@retray-dev/ui-kit'`
|
|
1012
|
-
**When to use:** Bottom sheet
|
|
1012
|
+
**When to use:** Bottom sheet that automatically sizes to its content. No snap points needed — just put children inside and it fits. Powered by `@gorhom/bottom-sheet` with `enableDynamicSizing`.
|
|
1013
1013
|
|
|
1014
1014
|
**Required setup** — add to your app root (see Setup section above):
|
|
1015
1015
|
```tsx
|
|
@@ -1038,7 +1038,6 @@ Add `react-native-worklets/plugin` (not `react-native-reanimated/plugin`) to you
|
|
|
1038
1038
|
|------|------|---------|-------|
|
|
1039
1039
|
| open | `boolean` | required | `true` presents the sheet, `false` dismisses it |
|
|
1040
1040
|
| onClose | `() => void` | required | Called on swipe-dismiss or backdrop press |
|
|
1041
|
-
| snapPoints | `(string \| number)[]` | `['50%']` | Snap positions, e.g. `['40%', '80%']` |
|
|
1042
1041
|
| title | `string` | — | — |
|
|
1043
1042
|
| description | `string` | — | — |
|
|
1044
1043
|
| children | `ReactNode` | — | — |
|
|
@@ -1046,11 +1045,16 @@ Add `react-native-worklets/plugin` (not `react-native-reanimated/plugin`) to you
|
|
|
1046
1045
|
|
|
1047
1046
|
**Example:**
|
|
1048
1047
|
```tsx
|
|
1049
|
-
<Sheet open={open} onClose={() => setOpen(false)} title="Filters"
|
|
1048
|
+
<Sheet open={open} onClose={() => setOpen(false)} title="Filters">
|
|
1050
1049
|
<RadioGroup options={sortOptions} value={sort} onValueChange={setSort} />
|
|
1051
1050
|
</Sheet>
|
|
1052
1051
|
```
|
|
1053
1052
|
|
|
1053
|
+
**Notes:**
|
|
1054
|
+
- Height is calculated automatically from content via `enableDynamicSizing` (gorhom v5 feature). No `snapPoints` prop.
|
|
1055
|
+
- Swipe down to dismiss (`enablePanDownToClose`). Backdrop press also dismisses.
|
|
1056
|
+
- `impactAsync(Light)` haptic fires on open.
|
|
1057
|
+
|
|
1054
1058
|
---
|
|
1055
1059
|
|
|
1056
1060
|
### Toast / useToast
|
|
@@ -1272,9 +1276,10 @@ const [categories, setCategories] = useState<number[]>([1, 3])
|
|
|
1272
1276
|
| onCancel | `() => void` | required | Called when cancel is tapped or backdrop is pressed |
|
|
1273
1277
|
|
|
1274
1278
|
**Notes:**
|
|
1275
|
-
-
|
|
1276
|
-
-
|
|
1277
|
-
-
|
|
1279
|
+
- Powered by `@gorhom/bottom-sheet` with `enableDynamicSizing` — height auto-fits content, no snap points.
|
|
1280
|
+
- Swipe down or tap backdrop to cancel (calls `onCancel`).
|
|
1281
|
+
- Cancel and confirm buttons are full-width stacked vertically.
|
|
1282
|
+
- Requires `BottomSheetModalProvider` at app root (same as `Sheet`).
|
|
1278
1283
|
|
|
1279
1284
|
**Example:**
|
|
1280
1285
|
```tsx
|
package/README.md
CHANGED
|
@@ -87,9 +87,9 @@ export default function App() {
|
|
|
87
87
|
| Provider | Required by |
|
|
88
88
|
| -------------------------- | ------------------------------------------ |
|
|
89
89
|
| `SafeAreaProvider` | `ToastProvider` (uses `useSafeAreaInsets`) |
|
|
90
|
-
| `GestureHandlerRootView` | `Sheet` (
|
|
90
|
+
| `GestureHandlerRootView` | `Sheet`, `ConfirmDialog` (`@gorhom/bottom-sheet`) |
|
|
91
91
|
| `ThemeProvider` | All components |
|
|
92
|
-
| `BottomSheetModalProvider` | `Sheet`
|
|
92
|
+
| `BottomSheetModalProvider` | `Sheet`, `ConfirmDialog` |
|
|
93
93
|
| `ToastProvider` | `useToast` hook |
|
|
94
94
|
|
|
95
95
|
## Theme
|
|
@@ -160,8 +160,8 @@ import {
|
|
|
160
160
|
const { toast } = useToast()
|
|
161
161
|
toast({ title: 'Saved', variant: 'success' })
|
|
162
162
|
|
|
163
|
-
// Sheet (bottom sheet)
|
|
164
|
-
<Sheet open={open} onClose={() => setOpen(false)} title="Options"
|
|
163
|
+
// Sheet (bottom sheet — auto-sizes to content)
|
|
164
|
+
<Sheet open={open} onClose={() => setOpen(false)} title="Options">
|
|
165
165
|
<Text>Sheet content</Text>
|
|
166
166
|
</Sheet>
|
|
167
167
|
|
package/dist/index.d.mts
CHANGED
|
@@ -150,8 +150,10 @@ interface InputProps extends TextInputProps {
|
|
|
150
150
|
type?: 'text' | 'password';
|
|
151
151
|
/** Style for the outer container \`View\`. Use \`style\` (from \`TextInputProps\`) to style the \`TextInput\` itself. */
|
|
152
152
|
containerStyle?: ViewStyle;
|
|
153
|
+
/** Style for the inner border wrapper (overrides padding, etc). */
|
|
154
|
+
inputWrapperStyle?: ViewStyle;
|
|
153
155
|
}
|
|
154
|
-
declare function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type, containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps): React.JSX.Element;
|
|
156
|
+
declare function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type, containerStyle, inputWrapperStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps): React.JSX.Element;
|
|
155
157
|
|
|
156
158
|
type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'successOutline' | 'destructiveOutline';
|
|
157
159
|
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
@@ -245,7 +247,7 @@ declare function Avatar({ src, fallback, size, style }: AvatarProps): React.JSX.
|
|
|
245
247
|
|
|
246
248
|
type AlertBannerVariant = 'default' | 'destructive' | 'success';
|
|
247
249
|
interface AlertBannerProps {
|
|
248
|
-
title
|
|
250
|
+
title: string;
|
|
249
251
|
description?: string;
|
|
250
252
|
variant?: AlertBannerVariant;
|
|
251
253
|
icon?: React.ReactNode;
|
|
@@ -425,15 +427,10 @@ interface SheetProps {
|
|
|
425
427
|
title?: string;
|
|
426
428
|
description?: string;
|
|
427
429
|
children?: React.ReactNode;
|
|
428
|
-
/**
|
|
429
|
-
* Heights the sheet can snap to. Accepts percentage strings (`'50%'`) or
|
|
430
|
-
* absolute point values (`300`). Defaults to `['50%']`.
|
|
431
|
-
*/
|
|
432
|
-
snapPoints?: (string | number)[];
|
|
433
430
|
/** Style for the inner `BottomSheetView` content container. */
|
|
434
431
|
style?: ViewStyle;
|
|
435
432
|
}
|
|
436
|
-
declare function Sheet({ open, onClose, title, description, children,
|
|
433
|
+
declare function Sheet({ open, onClose, title, description, children, style, }: SheetProps): React.JSX.Element;
|
|
437
434
|
|
|
438
435
|
interface SelectOption {
|
|
439
436
|
label: string;
|
|
@@ -501,12 +498,10 @@ interface CurrencyInputProps {
|
|
|
501
498
|
hint?: string;
|
|
502
499
|
placeholder?: string;
|
|
503
500
|
editable?: boolean;
|
|
504
|
-
/** Icon or element rendered at the left edge inside the input field. */
|
|
505
|
-
prefixIcon?: React.ReactNode;
|
|
506
501
|
containerStyle?: ViewStyle;
|
|
507
502
|
style?: TextStyle;
|
|
508
503
|
}
|
|
509
|
-
declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, size, label, error, hint, placeholder, editable,
|
|
504
|
+
declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, size, label, error, hint, placeholder, editable, containerStyle, style, }: CurrencyInputProps): React.JSX.Element;
|
|
510
505
|
|
|
511
506
|
interface CurrencyDisplayProps {
|
|
512
507
|
value: number | string;
|
package/dist/index.d.ts
CHANGED
|
@@ -150,8 +150,10 @@ interface InputProps extends TextInputProps {
|
|
|
150
150
|
type?: 'text' | 'password';
|
|
151
151
|
/** Style for the outer container \`View\`. Use \`style\` (from \`TextInputProps\`) to style the \`TextInput\` itself. */
|
|
152
152
|
containerStyle?: ViewStyle;
|
|
153
|
+
/** Style for the inner border wrapper (overrides padding, etc). */
|
|
154
|
+
inputWrapperStyle?: ViewStyle;
|
|
153
155
|
}
|
|
154
|
-
declare function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type, containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps): React.JSX.Element;
|
|
156
|
+
declare function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type, containerStyle, inputWrapperStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps): React.JSX.Element;
|
|
155
157
|
|
|
156
158
|
type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'successOutline' | 'destructiveOutline';
|
|
157
159
|
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
@@ -245,7 +247,7 @@ declare function Avatar({ src, fallback, size, style }: AvatarProps): React.JSX.
|
|
|
245
247
|
|
|
246
248
|
type AlertBannerVariant = 'default' | 'destructive' | 'success';
|
|
247
249
|
interface AlertBannerProps {
|
|
248
|
-
title
|
|
250
|
+
title: string;
|
|
249
251
|
description?: string;
|
|
250
252
|
variant?: AlertBannerVariant;
|
|
251
253
|
icon?: React.ReactNode;
|
|
@@ -425,15 +427,10 @@ interface SheetProps {
|
|
|
425
427
|
title?: string;
|
|
426
428
|
description?: string;
|
|
427
429
|
children?: React.ReactNode;
|
|
428
|
-
/**
|
|
429
|
-
* Heights the sheet can snap to. Accepts percentage strings (`'50%'`) or
|
|
430
|
-
* absolute point values (`300`). Defaults to `['50%']`.
|
|
431
|
-
*/
|
|
432
|
-
snapPoints?: (string | number)[];
|
|
433
430
|
/** Style for the inner `BottomSheetView` content container. */
|
|
434
431
|
style?: ViewStyle;
|
|
435
432
|
}
|
|
436
|
-
declare function Sheet({ open, onClose, title, description, children,
|
|
433
|
+
declare function Sheet({ open, onClose, title, description, children, style, }: SheetProps): React.JSX.Element;
|
|
437
434
|
|
|
438
435
|
interface SelectOption {
|
|
439
436
|
label: string;
|
|
@@ -501,12 +498,10 @@ interface CurrencyInputProps {
|
|
|
501
498
|
hint?: string;
|
|
502
499
|
placeholder?: string;
|
|
503
500
|
editable?: boolean;
|
|
504
|
-
/** Icon or element rendered at the left edge inside the input field. */
|
|
505
|
-
prefixIcon?: React.ReactNode;
|
|
506
501
|
containerStyle?: ViewStyle;
|
|
507
502
|
style?: TextStyle;
|
|
508
503
|
}
|
|
509
|
-
declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, size, label, error, hint, placeholder, editable,
|
|
504
|
+
declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, size, label, error, hint, placeholder, editable, containerStyle, style, }: CurrencyInputProps): React.JSX.Element;
|
|
510
505
|
|
|
511
506
|
interface CurrencyDisplayProps {
|
|
512
507
|
value: number | string;
|
package/dist/index.js
CHANGED
|
@@ -393,7 +393,7 @@ function Text2({ variant = "body", color, style, children, ...props }) {
|
|
|
393
393
|
);
|
|
394
394
|
}
|
|
395
395
|
var webInputResetStyle = reactNative.Platform.OS === "web" ? { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent", boxShadow: "none" } : {};
|
|
396
|
-
function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type = "text", containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }) {
|
|
396
|
+
function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type = "text", containerStyle, inputWrapperStyle, style, onFocus, onBlur, secureTextEntry, ...props }) {
|
|
397
397
|
const { colors } = useTheme();
|
|
398
398
|
const [focused, setFocused] = React25.useState(false);
|
|
399
399
|
const [showPassword, setShowPassword] = React25.useState(false);
|
|
@@ -409,7 +409,8 @@ function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, p
|
|
|
409
409
|
{
|
|
410
410
|
borderColor: error ? colors.destructive : focused ? colors.ring ?? colors.primary : colors.border,
|
|
411
411
|
backgroundColor: colors.background
|
|
412
|
-
}
|
|
412
|
+
},
|
|
413
|
+
inputWrapperStyle
|
|
413
414
|
]
|
|
414
415
|
},
|
|
415
416
|
effectivePrefix ? typeof effectivePrefix === "string" ? /* @__PURE__ */ React25__default.default.createElement(reactNative.Text, { style: [styles3.prefixText, { color: colors.mutedForeground }, prefixStyle], allowFontScaling: true }, effectivePrefix) : /* @__PURE__ */ React25__default.default.createElement(reactNative.View, { style: styles3.prefixContainer }, effectivePrefix) : null,
|
|
@@ -1756,7 +1757,6 @@ function Sheet({
|
|
|
1756
1757
|
title,
|
|
1757
1758
|
description,
|
|
1758
1759
|
children,
|
|
1759
|
-
snapPoints = ["50%"],
|
|
1760
1760
|
style
|
|
1761
1761
|
}) {
|
|
1762
1762
|
const { colors } = useTheme();
|
|
@@ -1782,7 +1782,7 @@ function Sheet({
|
|
|
1782
1782
|
bottomSheet.BottomSheetModal,
|
|
1783
1783
|
{
|
|
1784
1784
|
ref,
|
|
1785
|
-
|
|
1785
|
+
enableDynamicSizing: true,
|
|
1786
1786
|
onDismiss: onClose,
|
|
1787
1787
|
backdropComponent: renderBackdrop,
|
|
1788
1788
|
backgroundStyle: [styles21.background, { backgroundColor: colors.card }],
|
|
@@ -2199,10 +2199,10 @@ function CurrencyInput({
|
|
|
2199
2199
|
hint,
|
|
2200
2200
|
placeholder,
|
|
2201
2201
|
editable,
|
|
2202
|
-
prefixIcon,
|
|
2203
2202
|
containerStyle,
|
|
2204
2203
|
style
|
|
2205
2204
|
}) {
|
|
2205
|
+
const { colors } = useTheme();
|
|
2206
2206
|
const handleChange = (text) => {
|
|
2207
2207
|
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
2208
2208
|
const formatted = formatCurrency(withoutPrefix, thousandsSeparator);
|
|
@@ -2213,6 +2213,7 @@ function CurrencyInput({
|
|
|
2213
2213
|
onChangeValue?.(isNaN(raw) ? 0 : raw);
|
|
2214
2214
|
};
|
|
2215
2215
|
const inputStyle = size === "large" ? { fontFamily: "Poppins-Regular", fontSize: ms(36) } : { fontFamily: "Poppins-Regular" };
|
|
2216
|
+
const dollarIcon = renderIcon("dollar-sign", size === "large" ? 24 : 16, colors.mutedForeground);
|
|
2216
2217
|
const displayValue = value && prefix && value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
2217
2218
|
return /* @__PURE__ */ React25__default.default.createElement(
|
|
2218
2219
|
Input,
|
|
@@ -2225,8 +2226,9 @@ function CurrencyInput({
|
|
|
2225
2226
|
hint,
|
|
2226
2227
|
placeholder: placeholder ?? "0",
|
|
2227
2228
|
editable,
|
|
2228
|
-
prefix:
|
|
2229
|
+
prefix: dollarIcon,
|
|
2229
2230
|
containerStyle,
|
|
2231
|
+
inputWrapperStyle: size === "large" ? { paddingVertical: 10 } : void 0,
|
|
2230
2232
|
style: [inputStyle, style]
|
|
2231
2233
|
}
|
|
2232
2234
|
);
|
|
@@ -2575,7 +2577,7 @@ function ConfirmDialog({
|
|
|
2575
2577
|
bottomSheet.BottomSheetModal,
|
|
2576
2578
|
{
|
|
2577
2579
|
ref,
|
|
2578
|
-
|
|
2580
|
+
enableDynamicSizing: true,
|
|
2579
2581
|
onDismiss: onCancel,
|
|
2580
2582
|
backdropComponent: renderBackdrop,
|
|
2581
2583
|
backgroundStyle: [styles27.background, { backgroundColor: colors.card }],
|
package/dist/index.mjs
CHANGED
|
@@ -380,7 +380,7 @@ function Text2({ variant = "body", color, style, children, ...props }) {
|
|
|
380
380
|
);
|
|
381
381
|
}
|
|
382
382
|
var webInputResetStyle = Platform.OS === "web" ? { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent", boxShadow: "none" } : {};
|
|
383
|
-
function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type = "text", containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }) {
|
|
383
|
+
function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type = "text", containerStyle, inputWrapperStyle, style, onFocus, onBlur, secureTextEntry, ...props }) {
|
|
384
384
|
const { colors } = useTheme();
|
|
385
385
|
const [focused, setFocused] = useState(false);
|
|
386
386
|
const [showPassword, setShowPassword] = useState(false);
|
|
@@ -396,7 +396,8 @@ function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, p
|
|
|
396
396
|
{
|
|
397
397
|
borderColor: error ? colors.destructive : focused ? colors.ring ?? colors.primary : colors.border,
|
|
398
398
|
backgroundColor: colors.background
|
|
399
|
-
}
|
|
399
|
+
},
|
|
400
|
+
inputWrapperStyle
|
|
400
401
|
]
|
|
401
402
|
},
|
|
402
403
|
effectivePrefix ? typeof effectivePrefix === "string" ? /* @__PURE__ */ React25.createElement(Text, { style: [styles3.prefixText, { color: colors.mutedForeground }, prefixStyle], allowFontScaling: true }, effectivePrefix) : /* @__PURE__ */ React25.createElement(View, { style: styles3.prefixContainer }, effectivePrefix) : null,
|
|
@@ -1743,7 +1744,6 @@ function Sheet({
|
|
|
1743
1744
|
title,
|
|
1744
1745
|
description,
|
|
1745
1746
|
children,
|
|
1746
|
-
snapPoints = ["50%"],
|
|
1747
1747
|
style
|
|
1748
1748
|
}) {
|
|
1749
1749
|
const { colors } = useTheme();
|
|
@@ -1769,7 +1769,7 @@ function Sheet({
|
|
|
1769
1769
|
BottomSheetModal,
|
|
1770
1770
|
{
|
|
1771
1771
|
ref,
|
|
1772
|
-
|
|
1772
|
+
enableDynamicSizing: true,
|
|
1773
1773
|
onDismiss: onClose,
|
|
1774
1774
|
backdropComponent: renderBackdrop,
|
|
1775
1775
|
backgroundStyle: [styles21.background, { backgroundColor: colors.card }],
|
|
@@ -2186,10 +2186,10 @@ function CurrencyInput({
|
|
|
2186
2186
|
hint,
|
|
2187
2187
|
placeholder,
|
|
2188
2188
|
editable,
|
|
2189
|
-
prefixIcon,
|
|
2190
2189
|
containerStyle,
|
|
2191
2190
|
style
|
|
2192
2191
|
}) {
|
|
2192
|
+
const { colors } = useTheme();
|
|
2193
2193
|
const handleChange = (text) => {
|
|
2194
2194
|
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
2195
2195
|
const formatted = formatCurrency(withoutPrefix, thousandsSeparator);
|
|
@@ -2200,6 +2200,7 @@ function CurrencyInput({
|
|
|
2200
2200
|
onChangeValue?.(isNaN(raw) ? 0 : raw);
|
|
2201
2201
|
};
|
|
2202
2202
|
const inputStyle = size === "large" ? { fontFamily: "Poppins-Regular", fontSize: ms(36) } : { fontFamily: "Poppins-Regular" };
|
|
2203
|
+
const dollarIcon = renderIcon("dollar-sign", size === "large" ? 24 : 16, colors.mutedForeground);
|
|
2203
2204
|
const displayValue = value && prefix && value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
2204
2205
|
return /* @__PURE__ */ React25.createElement(
|
|
2205
2206
|
Input,
|
|
@@ -2212,8 +2213,9 @@ function CurrencyInput({
|
|
|
2212
2213
|
hint,
|
|
2213
2214
|
placeholder: placeholder ?? "0",
|
|
2214
2215
|
editable,
|
|
2215
|
-
prefix:
|
|
2216
|
+
prefix: dollarIcon,
|
|
2216
2217
|
containerStyle,
|
|
2218
|
+
inputWrapperStyle: size === "large" ? { paddingVertical: 10 } : void 0,
|
|
2217
2219
|
style: [inputStyle, style]
|
|
2218
2220
|
}
|
|
2219
2221
|
);
|
|
@@ -2562,7 +2564,7 @@ function ConfirmDialog({
|
|
|
2562
2564
|
BottomSheetModal,
|
|
2563
2565
|
{
|
|
2564
2566
|
ref,
|
|
2565
|
-
|
|
2567
|
+
enableDynamicSizing: true,
|
|
2566
2568
|
onDismiss: onCancel,
|
|
2567
2569
|
backdropComponent: renderBackdrop,
|
|
2568
2570
|
backgroundStyle: [styles27.background, { backgroundColor: colors.card }],
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import { renderIcon } from '../../utils/icons'
|
|
|
8
8
|
export type AlertBannerVariant = 'default' | 'destructive' | 'success'
|
|
9
9
|
|
|
10
10
|
export interface AlertBannerProps {
|
|
11
|
-
title
|
|
11
|
+
title: string
|
|
12
12
|
description?: string
|
|
13
13
|
variant?: AlertBannerVariant
|
|
14
14
|
icon?: React.ReactNode
|
|
@@ -57,7 +57,7 @@ export function ConfirmDialog({
|
|
|
57
57
|
return (
|
|
58
58
|
<BottomSheetModal
|
|
59
59
|
ref={ref}
|
|
60
|
-
|
|
60
|
+
enableDynamicSizing
|
|
61
61
|
onDismiss={onCancel}
|
|
62
62
|
backdropComponent={renderBackdrop}
|
|
63
63
|
backgroundStyle={[styles.background, { backgroundColor: colors.card }]}
|
|
@@ -2,6 +2,8 @@ import React from 'react'
|
|
|
2
2
|
import { ViewStyle, TextStyle } from 'react-native'
|
|
3
3
|
import { Input } from '../Input'
|
|
4
4
|
import { ms } from '../../utils/scaling'
|
|
5
|
+
import { renderIcon } from '../../utils/icons'
|
|
6
|
+
import { useTheme } from '../../theme'
|
|
5
7
|
|
|
6
8
|
export interface CurrencyInputProps {
|
|
7
9
|
value?: string
|
|
@@ -20,8 +22,6 @@ export interface CurrencyInputProps {
|
|
|
20
22
|
hint?: string
|
|
21
23
|
placeholder?: string
|
|
22
24
|
editable?: boolean
|
|
23
|
-
/** Icon or element rendered at the left edge inside the input field. */
|
|
24
|
-
prefixIcon?: React.ReactNode
|
|
25
25
|
containerStyle?: ViewStyle
|
|
26
26
|
style?: TextStyle
|
|
27
27
|
}
|
|
@@ -44,10 +44,10 @@ export function CurrencyInput({
|
|
|
44
44
|
hint,
|
|
45
45
|
placeholder,
|
|
46
46
|
editable,
|
|
47
|
-
prefixIcon,
|
|
48
47
|
containerStyle,
|
|
49
48
|
style,
|
|
50
49
|
}: CurrencyInputProps) {
|
|
50
|
+
const { colors } = useTheme()
|
|
51
51
|
const handleChange = (text: string) => {
|
|
52
52
|
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text
|
|
53
53
|
const formatted = formatCurrency(withoutPrefix, thousandsSeparator)
|
|
@@ -60,6 +60,8 @@ export function CurrencyInput({
|
|
|
60
60
|
|
|
61
61
|
const inputStyle: TextStyle = size === 'large' ? { fontFamily: 'Poppins-Regular', fontSize: ms(36) } : { fontFamily: 'Poppins-Regular' }
|
|
62
62
|
|
|
63
|
+
const dollarIcon = renderIcon('dollar-sign', size === 'large' ? 24 : 16, colors.mutedForeground)
|
|
64
|
+
|
|
63
65
|
// Remove prefix from display value if present
|
|
64
66
|
const displayValue = value && prefix && value.startsWith(prefix) ? value.slice(prefix.length) : value
|
|
65
67
|
|
|
@@ -73,8 +75,9 @@ export function CurrencyInput({
|
|
|
73
75
|
hint={hint}
|
|
74
76
|
placeholder={placeholder ?? '0'}
|
|
75
77
|
editable={editable}
|
|
76
|
-
prefix={
|
|
78
|
+
prefix={dollarIcon}
|
|
77
79
|
containerStyle={containerStyle}
|
|
80
|
+
inputWrapperStyle={size === 'large' ? { paddingVertical: 10 } : undefined}
|
|
78
81
|
style={[inputStyle, style]}
|
|
79
82
|
/>
|
|
80
83
|
)
|
|
@@ -42,9 +42,11 @@ export interface InputProps extends TextInputProps {
|
|
|
42
42
|
type?: 'text' | 'password'
|
|
43
43
|
/** Style for the outer container \`View\`. Use \`style\` (from \`TextInputProps\`) to style the \`TextInput\` itself. */
|
|
44
44
|
containerStyle?: ViewStyle
|
|
45
|
+
/** Style for the inner border wrapper (overrides padding, etc). */
|
|
46
|
+
inputWrapperStyle?: ViewStyle
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
export function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type = 'text', containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps) {
|
|
49
|
+
export function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type = 'text', containerStyle, inputWrapperStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps) {
|
|
48
50
|
const { colors } = useTheme()
|
|
49
51
|
const [focused, setFocused] = useState(false)
|
|
50
52
|
const [showPassword, setShowPassword] = useState(false)
|
|
@@ -79,6 +81,7 @@ export function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixS
|
|
|
79
81
|
: colors.border,
|
|
80
82
|
backgroundColor: colors.background,
|
|
81
83
|
},
|
|
84
|
+
inputWrapperStyle,
|
|
82
85
|
]}
|
|
83
86
|
>
|
|
84
87
|
{effectivePrefix ? (
|
|
@@ -19,11 +19,6 @@ export interface SheetProps {
|
|
|
19
19
|
title?: string
|
|
20
20
|
description?: string
|
|
21
21
|
children?: React.ReactNode
|
|
22
|
-
/**
|
|
23
|
-
* Heights the sheet can snap to. Accepts percentage strings (`'50%'`) or
|
|
24
|
-
* absolute point values (`300`). Defaults to `['50%']`.
|
|
25
|
-
*/
|
|
26
|
-
snapPoints?: (string | number)[]
|
|
27
22
|
/** Style for the inner `BottomSheetView` content container. */
|
|
28
23
|
style?: ViewStyle
|
|
29
24
|
}
|
|
@@ -34,7 +29,6 @@ export function Sheet({
|
|
|
34
29
|
title,
|
|
35
30
|
description,
|
|
36
31
|
children,
|
|
37
|
-
snapPoints = ['50%'],
|
|
38
32
|
style,
|
|
39
33
|
}: SheetProps) {
|
|
40
34
|
const { colors } = useTheme()
|
|
@@ -61,7 +55,7 @@ export function Sheet({
|
|
|
61
55
|
return (
|
|
62
56
|
<BottomSheetModal
|
|
63
57
|
ref={ref}
|
|
64
|
-
|
|
58
|
+
enableDynamicSizing
|
|
65
59
|
onDismiss={onClose}
|
|
66
60
|
backdropComponent={renderBackdrop}
|
|
67
61
|
backgroundStyle={[styles.background, { backgroundColor: colors.card }]}
|