@retray-dev/ui-kit 3.1.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 +12 -7
- package/README.md +4 -4
- package/dist/index.d.mts +1 -6
- package/dist/index.d.ts +1 -6
- package/dist/index.js +2 -3
- package/dist/index.mjs +2 -3
- package/package.json +1 -1
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +1 -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
|
|
|
@@ -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
|
@@ -427,15 +427,10 @@ interface SheetProps {
|
|
|
427
427
|
title?: string;
|
|
428
428
|
description?: string;
|
|
429
429
|
children?: React.ReactNode;
|
|
430
|
-
/**
|
|
431
|
-
* Heights the sheet can snap to. Accepts percentage strings (`'50%'`) or
|
|
432
|
-
* absolute point values (`300`). Defaults to `['50%']`.
|
|
433
|
-
*/
|
|
434
|
-
snapPoints?: (string | number)[];
|
|
435
430
|
/** Style for the inner `BottomSheetView` content container. */
|
|
436
431
|
style?: ViewStyle;
|
|
437
432
|
}
|
|
438
|
-
declare function Sheet({ open, onClose, title, description, children,
|
|
433
|
+
declare function Sheet({ open, onClose, title, description, children, style, }: SheetProps): React.JSX.Element;
|
|
439
434
|
|
|
440
435
|
interface SelectOption {
|
|
441
436
|
label: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -427,15 +427,10 @@ interface SheetProps {
|
|
|
427
427
|
title?: string;
|
|
428
428
|
description?: string;
|
|
429
429
|
children?: React.ReactNode;
|
|
430
|
-
/**
|
|
431
|
-
* Heights the sheet can snap to. Accepts percentage strings (`'50%'`) or
|
|
432
|
-
* absolute point values (`300`). Defaults to `['50%']`.
|
|
433
|
-
*/
|
|
434
|
-
snapPoints?: (string | number)[];
|
|
435
430
|
/** Style for the inner `BottomSheetView` content container. */
|
|
436
431
|
style?: ViewStyle;
|
|
437
432
|
}
|
|
438
|
-
declare function Sheet({ open, onClose, title, description, children,
|
|
433
|
+
declare function Sheet({ open, onClose, title, description, children, style, }: SheetProps): React.JSX.Element;
|
|
439
434
|
|
|
440
435
|
interface SelectOption {
|
|
441
436
|
label: string;
|
package/dist/index.js
CHANGED
|
@@ -1757,7 +1757,6 @@ function Sheet({
|
|
|
1757
1757
|
title,
|
|
1758
1758
|
description,
|
|
1759
1759
|
children,
|
|
1760
|
-
snapPoints = ["50%"],
|
|
1761
1760
|
style
|
|
1762
1761
|
}) {
|
|
1763
1762
|
const { colors } = useTheme();
|
|
@@ -1783,7 +1782,7 @@ function Sheet({
|
|
|
1783
1782
|
bottomSheet.BottomSheetModal,
|
|
1784
1783
|
{
|
|
1785
1784
|
ref,
|
|
1786
|
-
|
|
1785
|
+
enableDynamicSizing: true,
|
|
1787
1786
|
onDismiss: onClose,
|
|
1788
1787
|
backdropComponent: renderBackdrop,
|
|
1789
1788
|
backgroundStyle: [styles21.background, { backgroundColor: colors.card }],
|
|
@@ -2578,7 +2577,7 @@ function ConfirmDialog({
|
|
|
2578
2577
|
bottomSheet.BottomSheetModal,
|
|
2579
2578
|
{
|
|
2580
2579
|
ref,
|
|
2581
|
-
|
|
2580
|
+
enableDynamicSizing: true,
|
|
2582
2581
|
onDismiss: onCancel,
|
|
2583
2582
|
backdropComponent: renderBackdrop,
|
|
2584
2583
|
backgroundStyle: [styles27.background, { backgroundColor: colors.card }],
|
package/dist/index.mjs
CHANGED
|
@@ -1744,7 +1744,6 @@ function Sheet({
|
|
|
1744
1744
|
title,
|
|
1745
1745
|
description,
|
|
1746
1746
|
children,
|
|
1747
|
-
snapPoints = ["50%"],
|
|
1748
1747
|
style
|
|
1749
1748
|
}) {
|
|
1750
1749
|
const { colors } = useTheme();
|
|
@@ -1770,7 +1769,7 @@ function Sheet({
|
|
|
1770
1769
|
BottomSheetModal,
|
|
1771
1770
|
{
|
|
1772
1771
|
ref,
|
|
1773
|
-
|
|
1772
|
+
enableDynamicSizing: true,
|
|
1774
1773
|
onDismiss: onClose,
|
|
1775
1774
|
backdropComponent: renderBackdrop,
|
|
1776
1775
|
backgroundStyle: [styles21.background, { backgroundColor: colors.card }],
|
|
@@ -2565,7 +2564,7 @@ function ConfirmDialog({
|
|
|
2565
2564
|
BottomSheetModal,
|
|
2566
2565
|
{
|
|
2567
2566
|
ref,
|
|
2568
|
-
|
|
2567
|
+
enableDynamicSizing: true,
|
|
2569
2568
|
onDismiss: onCancel,
|
|
2570
2569
|
backdropComponent: renderBackdrop,
|
|
2571
2570
|
backgroundStyle: [styles27.background, { backgroundColor: colors.card }],
|
package/package.json
CHANGED
|
@@ -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 }]}
|
|
@@ -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 }]}
|