@mrmeg/expo-ui 0.7.2 → 0.8.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/LLM_USAGE.md +21 -11
- package/README.md +8 -10
- package/dist/components/Accordion.d.ts +4 -4
- package/dist/components/AnimatedView.d.ts +1 -1
- package/dist/components/Badge.d.ts +1 -1
- package/dist/components/BottomSheet.d.ts +96 -20
- package/dist/components/BottomSheet.js +203 -444
- package/dist/components/Button.d.ts +3 -3
- package/dist/components/Button.js +17 -1
- package/dist/components/Card.d.ts +6 -6
- package/dist/components/Checkbox.d.ts +2 -1
- package/dist/components/Collapsible.d.ts +4 -3
- package/dist/components/Dialog.d.ts +10 -10
- package/dist/components/Dialog.js +16 -8
- package/dist/components/DismissKeyboard.d.ts +1 -1
- package/dist/components/Drawer.d.ts +7 -7
- package/dist/components/DropdownMenu.d.ts +10 -10
- package/dist/components/EmptyState.d.ts +1 -1
- package/dist/components/ErrorBoundary.d.ts +1 -1
- package/dist/components/Icon.d.ts +1 -1
- package/dist/components/InputOTP.d.ts +2 -1
- package/dist/components/Label.d.ts +1 -1
- package/dist/components/MaxWidthContainer.d.ts +1 -1
- package/dist/components/Notification.d.ts +4 -10
- package/dist/components/Notification.js +12 -13
- package/dist/components/Popover.d.ts +4 -4
- package/dist/components/Progress.d.ts +2 -1
- package/dist/components/RadioGroup.d.ts +3 -2
- package/dist/components/SegmentedControl.d.ts +53 -0
- package/dist/components/SegmentedControl.js +25 -0
- package/dist/components/Select.d.ts +7 -7
- package/dist/components/Separator.d.ts +2 -1
- package/dist/components/Skeleton.d.ts +5 -4
- package/dist/components/Slider.d.ts +24 -3
- package/dist/components/Slider.js +26 -147
- package/dist/components/StatusBar.d.ts +1 -1
- package/dist/components/StyledText.d.ts +12 -12
- package/dist/components/Switch.d.ts +2 -1
- package/dist/components/Tabs.d.ts +5 -5
- package/dist/components/Tabs.js +10 -2
- package/dist/components/TextInput.d.ts +1 -1
- package/dist/components/TextInput.js +129 -2
- package/dist/components/Toggle.d.ts +3 -2
- package/dist/components/ToggleGroup.d.ts +4 -3
- package/dist/components/Tooltip.d.ts +3 -3
- package/dist/components/UIProvider.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/state/globalUIStore.d.ts +9 -1
- package/dist/state/globalUIStore.js +9 -1
- package/dist/state/index.d.ts +1 -0
- package/dist/state/index.js +1 -0
- package/dist/state/notify.d.ts +50 -0
- package/dist/state/notify.js +31 -0
- package/dist/state/themeColorScope.d.ts +1 -1
- package/llms-full.md +34 -3
- package/package.json +3 -2
- package/dist/components/BottomSheetKeyboard.d.ts +0 -7
- package/dist/components/BottomSheetKeyboard.js +0 -39
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback, useRef } from "react";
|
|
3
|
+
import { SegmentedControl as NativeSegmentedControl } from "@expo/ui/community/segmented-control";
|
|
4
|
+
import { useTheme } from "../hooks/useTheme.js";
|
|
5
|
+
import { hapticLight } from "../lib/haptics.js";
|
|
6
|
+
function SegmentedControl({ values, value: controlledValue, defaultValue, onValueChange, disabled = false, tintColor, appearance, style, }) {
|
|
7
|
+
const { theme } = useTheme();
|
|
8
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
9
|
+
const isControlled = controlledValue !== undefined;
|
|
10
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
11
|
+
const selectedIndex = Math.max(0, values.indexOf(value ?? values[0]));
|
|
12
|
+
const lastIndex = useRef(selectedIndex);
|
|
13
|
+
const handleValueChange = useCallback((next) => {
|
|
14
|
+
const nextIndex = values.indexOf(next);
|
|
15
|
+
if (nextIndex !== lastIndex.current) {
|
|
16
|
+
lastIndex.current = nextIndex;
|
|
17
|
+
hapticLight();
|
|
18
|
+
}
|
|
19
|
+
if (!isControlled)
|
|
20
|
+
setInternalValue(next);
|
|
21
|
+
onValueChange?.(next);
|
|
22
|
+
}, [isControlled, onValueChange, values]);
|
|
23
|
+
return (_jsx(NativeSegmentedControl, { values: values, selectedIndex: selectedIndex, enabled: !disabled, onValueChange: handleValueChange, tintColor: tintColor ?? theme.colors.accent, appearance: appearance ?? (theme.dark ? "dark" : "light"), style: style }));
|
|
24
|
+
}
|
|
25
|
+
export { SegmentedControl };
|
|
@@ -14,7 +14,7 @@ type SelectTriggerProps = SelectPrimitive.TriggerProps & {
|
|
|
14
14
|
size?: SelectSize;
|
|
15
15
|
error?: boolean;
|
|
16
16
|
};
|
|
17
|
-
declare function SelectTrigger({ size, error, children, style: styleOverride, disabled, ...props }: SelectTriggerProps):
|
|
17
|
+
declare function SelectTrigger({ size, error, children, style: styleOverride, disabled, ...props }: SelectTriggerProps): React.JSX.Element;
|
|
18
18
|
/**
|
|
19
19
|
* SelectValue Component
|
|
20
20
|
* Displays the selected value text or placeholder
|
|
@@ -22,7 +22,7 @@ declare function SelectTrigger({ size, error, children, style: styleOverride, di
|
|
|
22
22
|
type SelectValueProps = SelectPrimitive.ValueProps & {
|
|
23
23
|
size?: SelectSize;
|
|
24
24
|
};
|
|
25
|
-
declare function SelectValue({ size, placeholder, style: styleOverride, ...props }: SelectValueProps):
|
|
25
|
+
declare function SelectValue({ size, placeholder, style: styleOverride, ...props }: SelectValueProps): React.JSX.Element;
|
|
26
26
|
/**
|
|
27
27
|
* SelectContent Component
|
|
28
28
|
* Dropdown overlay following the DropdownMenu.Content pattern
|
|
@@ -31,32 +31,32 @@ declare function SelectValue({ size, placeholder, style: styleOverride, ...props
|
|
|
31
31
|
type SelectContentProps = SelectPrimitive.ContentProps & {
|
|
32
32
|
portalHost?: string;
|
|
33
33
|
};
|
|
34
|
-
declare function SelectContent({ side, align, sideOffset, portalHost, style: styleOverride, ...props }: SelectContentProps):
|
|
34
|
+
declare function SelectContent({ side, align, sideOffset, portalHost, style: styleOverride, ...props }: SelectContentProps): React.JSX.Element;
|
|
35
35
|
/**
|
|
36
36
|
* SelectItem Component
|
|
37
37
|
* Individual option in the select dropdown
|
|
38
38
|
* Shows a check icon on the left when selected
|
|
39
39
|
*/
|
|
40
40
|
type SelectItemProps = SelectPrimitive.ItemProps;
|
|
41
|
-
declare function SelectItem({ children, style: styleOverride, ...props }: SelectItemProps):
|
|
41
|
+
declare function SelectItem({ children, style: styleOverride, ...props }: SelectItemProps): React.JSX.Element;
|
|
42
42
|
/**
|
|
43
43
|
* SelectGroup Component
|
|
44
44
|
* Groups related select items together
|
|
45
45
|
*/
|
|
46
46
|
type SelectGroupProps = SelectPrimitive.GroupProps;
|
|
47
|
-
declare function SelectGroup({ style: styleOverride, ...props }: SelectGroupProps):
|
|
47
|
+
declare function SelectGroup({ style: styleOverride, ...props }: SelectGroupProps): React.JSX.Element;
|
|
48
48
|
/**
|
|
49
49
|
* SelectLabel Component
|
|
50
50
|
* Label for a group of select items
|
|
51
51
|
*/
|
|
52
52
|
type SelectLabelProps = SelectPrimitive.LabelProps;
|
|
53
|
-
declare function SelectLabel({ style: styleOverride, ...props }: SelectLabelProps):
|
|
53
|
+
declare function SelectLabel({ style: styleOverride, ...props }: SelectLabelProps): React.JSX.Element;
|
|
54
54
|
/**
|
|
55
55
|
* SelectSeparator Component
|
|
56
56
|
* Visual divider between select item groups
|
|
57
57
|
*/
|
|
58
58
|
type SelectSeparatorProps = SelectPrimitive.SeparatorProps;
|
|
59
|
-
declare function SelectSeparator({ style: styleOverride, ...props }: SelectSeparatorProps):
|
|
59
|
+
declare function SelectSeparator({ style: styleOverride, ...props }: SelectSeparatorProps): React.JSX.Element;
|
|
60
60
|
/**
|
|
61
61
|
* Select Component with Sub-components
|
|
62
62
|
* Properly typed interface for dot notation access (e.g., Select.Trigger)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { StyleProp, ViewStyle } from "react-native";
|
|
2
3
|
import * as SeparatorPrimitive from "@rn-primitives/separator";
|
|
3
4
|
/**
|
|
@@ -79,5 +80,5 @@ export interface SeparatorProps extends Omit<SeparatorPrimitive.RootProps, "styl
|
|
|
79
80
|
* <Separator style={{ opacity: 0.5 }} />
|
|
80
81
|
* ```
|
|
81
82
|
*/
|
|
82
|
-
declare function Separator({ orientation, decorative, size, variant, style: styleOverride, margin, ...props }: SeparatorProps):
|
|
83
|
+
declare function Separator({ orientation, decorative, size, variant, style: styleOverride, margin, ...props }: SeparatorProps): React.JSX.Element;
|
|
83
84
|
export { Separator };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { StyleProp, ViewStyle } from "react-native";
|
|
2
3
|
export interface SkeletonProps {
|
|
3
4
|
/** Width of the skeleton element */
|
|
@@ -23,7 +24,7 @@ export interface SkeletonProps {
|
|
|
23
24
|
* <Skeleton width={40} height={40} circle />
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
|
-
export declare function Skeleton({ width, height, borderRadius, circle, style, }: SkeletonProps):
|
|
27
|
+
export declare function Skeleton({ width, height, borderRadius, circle, style, }: SkeletonProps): React.JSX.Element;
|
|
27
28
|
export interface SkeletonTextProps {
|
|
28
29
|
/** Number of text lines to render */
|
|
29
30
|
lines?: number;
|
|
@@ -38,7 +39,7 @@ export interface SkeletonTextProps {
|
|
|
38
39
|
* SkeletonText renders N horizontal bars simulating text.
|
|
39
40
|
* The last line is rendered at 60% width for a natural look.
|
|
40
41
|
*/
|
|
41
|
-
export declare function SkeletonText({ lines, lineHeight, gap, style, }: SkeletonTextProps):
|
|
42
|
+
export declare function SkeletonText({ lines, lineHeight, gap, style, }: SkeletonTextProps): React.JSX.Element;
|
|
42
43
|
export interface SkeletonAvatarProps {
|
|
43
44
|
/** Diameter of the circular avatar placeholder */
|
|
44
45
|
size?: number;
|
|
@@ -48,7 +49,7 @@ export interface SkeletonAvatarProps {
|
|
|
48
49
|
/**
|
|
49
50
|
* SkeletonAvatar is a circular skeleton shorthand.
|
|
50
51
|
*/
|
|
51
|
-
export declare function SkeletonAvatar({ size, style }: SkeletonAvatarProps):
|
|
52
|
+
export declare function SkeletonAvatar({ size, style }: SkeletonAvatarProps): React.JSX.Element;
|
|
52
53
|
export interface SkeletonCardProps {
|
|
53
54
|
/** Whether to show an image placeholder area */
|
|
54
55
|
showImage?: boolean;
|
|
@@ -65,4 +66,4 @@ export interface SkeletonCardProps {
|
|
|
65
66
|
* SkeletonCard composes an image placeholder, optional avatar row,
|
|
66
67
|
* and text lines in a Card-styled wrapper.
|
|
67
68
|
*/
|
|
68
|
-
export declare function SkeletonCard({ showImage, imageHeight, showAvatar, textLines, style, }: SkeletonCardProps):
|
|
69
|
+
export declare function SkeletonCard({ showImage, imageHeight, showAvatar, textLines, style, }: SkeletonCardProps): React.JSX.Element;
|
|
@@ -1,4 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
/**
|
|
4
|
+
* Slider — a themed range input backed by the platform's native slider via
|
|
5
|
+
* `@expo/ui/community/slider`:
|
|
6
|
+
*
|
|
7
|
+
* - iOS: SwiftUI `Slider`
|
|
8
|
+
* - Android: Material 3 `Slider`
|
|
9
|
+
* - Web: native `<input type="range">` (themed via `accentColor`)
|
|
10
|
+
*
|
|
11
|
+
* The public `SliderProps` surface (value / onValueChange / min / max / step /
|
|
12
|
+
* disabled / showValue / size / style) is preserved, and the active track is
|
|
13
|
+
* themed with the design system's accent color on every platform. Thumb and
|
|
14
|
+
* inactive-track tints additionally apply on Android (iOS/web draw the system
|
|
15
|
+
* thumb). Haptic feedback fires on each step change, matching the prior
|
|
16
|
+
* hand-rolled slider.
|
|
17
|
+
*
|
|
18
|
+
* Platform-owned behaviors (props accepted for ergonomics, but the platform
|
|
19
|
+
* decides):
|
|
20
|
+
* - `size` is accepted for call-site compatibility but has no effect — the
|
|
21
|
+
* platform owns the track/thumb dimensions.
|
|
22
|
+
*/
|
|
2
23
|
export type SliderSize = "sm" | "md";
|
|
3
24
|
export interface SliderProps {
|
|
4
25
|
/** Current value */
|
|
@@ -11,14 +32,14 @@ export interface SliderProps {
|
|
|
11
32
|
max?: number;
|
|
12
33
|
/** Step increment @default 1 */
|
|
13
34
|
step?: number;
|
|
14
|
-
/** Size variant @default "md" */
|
|
35
|
+
/** Size variant. Accepted for compatibility; the platform owns sizing. @default "md" */
|
|
15
36
|
size?: SliderSize;
|
|
16
37
|
/** Disable interaction @default false */
|
|
17
38
|
disabled?: boolean;
|
|
18
|
-
/** Show value label above
|
|
39
|
+
/** Show the current value as a label above the track @default false */
|
|
19
40
|
showValue?: boolean;
|
|
20
41
|
/** Style override for outer container */
|
|
21
42
|
style?: StyleProp<ViewStyle>;
|
|
22
43
|
}
|
|
23
|
-
declare function Slider({ value, onValueChange, min, max, step, size, disabled, showValue, style: styleOverride, }: SliderProps):
|
|
44
|
+
declare function Slider({ value, onValueChange, min, max, step, size: _size, disabled, showValue, style: styleOverride, }: SliderProps): React.JSX.Element;
|
|
24
45
|
export { Slider };
|
|
@@ -2,165 +2,44 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { palette } from "../constants/colors.js";
|
|
3
3
|
import { useTheme } from "../hooks/useTheme.js";
|
|
4
4
|
import { hapticLight } from "../lib/haptics.js";
|
|
5
|
-
import { useCallback,
|
|
6
|
-
import {
|
|
5
|
+
import { useCallback, useRef } from "react";
|
|
6
|
+
import { View } from "react-native";
|
|
7
|
+
import { Slider as NativeSlider } from "@expo/ui/community/slider";
|
|
7
8
|
import { StyledText } from "./StyledText.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
function clampAndSnap(raw, min, max, step) {
|
|
13
|
-
const clamped = Math.min(Math.max(raw, min), max);
|
|
14
|
-
const stepped = Math.round((clamped - min) / step) * step + min;
|
|
15
|
-
// Avoid floating-point drift
|
|
16
|
-
return Math.round(stepped * 1e6) / 1e6;
|
|
17
|
-
}
|
|
18
|
-
function getValueRatio(value, min, max) {
|
|
19
|
-
const range = max - min || 1;
|
|
20
|
-
return Math.min(Math.max((value - min) / range, 0), 1);
|
|
21
|
-
}
|
|
22
|
-
function Slider({ value = 0, onValueChange, min = 0, max = 100, step = 1, size = "md", disabled = false, showValue = false, style: styleOverride, }) {
|
|
23
|
-
const { theme, getShadowStyle, withAlpha } = useTheme();
|
|
24
|
-
const dims = SIZES[size];
|
|
9
|
+
function Slider({ value = 0, onValueChange, min = 0, max = 100, step = 1,
|
|
10
|
+
// Accepted for call-site compatibility; the platform owns track/thumb sizing.
|
|
11
|
+
size: _size = "md", disabled = false, showValue = false, style: styleOverride, }) {
|
|
12
|
+
const { theme, withAlpha } = useTheme();
|
|
25
13
|
const inactiveTrackColor = theme.dark ? withAlpha(palette.white, 0.1) : theme.colors.muted;
|
|
26
14
|
const activeTrackColor = disabled
|
|
27
15
|
? theme.dark
|
|
28
16
|
? withAlpha(palette.white, 0.28)
|
|
29
17
|
: theme.colors.mutedForeground
|
|
30
18
|
: theme.colors.accent;
|
|
31
|
-
const
|
|
32
|
-
const thumbBorderColor = disabled
|
|
19
|
+
const thumbTintColor = disabled
|
|
33
20
|
? theme.dark
|
|
34
21
|
? withAlpha(palette.white, 0.32)
|
|
35
22
|
: theme.colors.mutedForeground
|
|
36
23
|
: theme.colors.accent;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const x = Math.min(Math.max(rawX, 0), width);
|
|
44
|
-
thumbX.stopAnimation();
|
|
45
|
-
thumbX.setValue(x);
|
|
46
|
-
const ratio = width > 0 ? x / width : 0;
|
|
47
|
-
const raw = min + ratio * (max - min);
|
|
48
|
-
const snapped = clampAndSnap(raw, min, max, step);
|
|
49
|
-
if (snapped !== lastSnappedValue.current) {
|
|
50
|
-
lastSnappedValue.current = snapped;
|
|
24
|
+
// Fire a light haptic whenever the slider crosses a step boundary, matching
|
|
25
|
+
// the prior hand-rolled behavior. Native emits already-stepped values.
|
|
26
|
+
const lastValue = useRef(value);
|
|
27
|
+
const handleValueChange = useCallback((next) => {
|
|
28
|
+
if (next !== lastValue.current) {
|
|
29
|
+
lastValue.current = next;
|
|
51
30
|
hapticLight();
|
|
52
31
|
}
|
|
53
|
-
onValueChange?.(
|
|
54
|
-
}, [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const ratio = getValueRatio(value, min, max);
|
|
66
|
-
const width = trackWidthRef.current;
|
|
67
|
-
if (width > 0) {
|
|
68
|
-
Animated.timing(thumbX, {
|
|
69
|
-
toValue: ratio * width,
|
|
70
|
-
duration: 80,
|
|
71
|
-
useNativeDriver: true,
|
|
72
|
-
}).start();
|
|
73
|
-
}
|
|
74
|
-
lastSnappedValue.current = value;
|
|
75
|
-
}, [max, min, thumbX, value]);
|
|
76
|
-
const onTrackLayout = useCallback((e) => {
|
|
77
|
-
const w = e.nativeEvent.layout.width;
|
|
78
|
-
trackWidthRef.current = w;
|
|
79
|
-
setTrackWidth(w);
|
|
80
|
-
// Set initial thumb position without animation
|
|
81
|
-
const ratio = getValueRatio(value, min, max);
|
|
82
|
-
thumbX.stopAnimation();
|
|
83
|
-
thumbX.setValue(ratio * w);
|
|
84
|
-
}, [max, min, thumbX, value]);
|
|
85
|
-
const safeTrackWidth = Math.max(trackWidth, 1);
|
|
86
|
-
const fillScale = thumbX.interpolate({
|
|
87
|
-
inputRange: [0, safeTrackWidth],
|
|
88
|
-
outputRange: [0, 1],
|
|
89
|
-
extrapolate: "clamp",
|
|
90
|
-
});
|
|
91
|
-
const thumbTranslateX = thumbX.interpolate({
|
|
92
|
-
inputRange: [0, safeTrackWidth],
|
|
93
|
-
outputRange: [-dims.thumb / 2, safeTrackWidth - dims.thumb / 2],
|
|
94
|
-
extrapolate: "clamp",
|
|
95
|
-
});
|
|
96
|
-
const labelTranslateX = thumbX.interpolate({
|
|
97
|
-
inputRange: [0, safeTrackWidth],
|
|
98
|
-
outputRange: [-14, safeTrackWidth - 14],
|
|
99
|
-
extrapolate: "clamp",
|
|
100
|
-
});
|
|
101
|
-
const flattenedStyle = styleOverride ? StyleSheet.flatten(styleOverride) : undefined;
|
|
102
|
-
// Accessibility action handler
|
|
103
|
-
const handleAccessibilityAction = useCallback((event) => {
|
|
104
|
-
const action = event.nativeEvent.actionName;
|
|
105
|
-
let next = value;
|
|
106
|
-
if (action === "increment") {
|
|
107
|
-
next = Math.min(value + step, max);
|
|
108
|
-
}
|
|
109
|
-
else if (action === "decrement") {
|
|
110
|
-
next = Math.max(value - step, min);
|
|
111
|
-
}
|
|
112
|
-
if (next !== value) {
|
|
113
|
-
onValueChange?.(next);
|
|
114
|
-
}
|
|
115
|
-
}, [value, step, min, max, onValueChange]);
|
|
116
|
-
return (_jsxs(View, { style: [{ opacity: disabled ? 0.5 : 1 }, flattenedStyle], accessibilityRole: "adjustable", accessibilityValue: { min, max, now: value }, accessibilityActions: [
|
|
117
|
-
{ name: "increment", label: "Increment" },
|
|
118
|
-
{ name: "decrement", label: "Decrement" },
|
|
119
|
-
], onAccessibilityAction: handleAccessibilityAction, children: [showValue && (_jsx(Animated.View, { style: [
|
|
120
|
-
{
|
|
121
|
-
position: "absolute",
|
|
122
|
-
top: -20,
|
|
123
|
-
width: 28,
|
|
124
|
-
alignItems: "center",
|
|
125
|
-
},
|
|
126
|
-
{ transform: [{ translateX: labelTranslateX }] },
|
|
127
|
-
{ pointerEvents: "none" },
|
|
128
|
-
], children: _jsx(StyledText, { selectable: false, style: {
|
|
129
|
-
fontSize: 12,
|
|
130
|
-
color: theme.colors.textDim,
|
|
131
|
-
userSelect: "none",
|
|
132
|
-
}, children: value }) })), _jsxs(View, { style: {
|
|
133
|
-
height: dims.thumb,
|
|
134
|
-
justifyContent: "center",
|
|
135
|
-
...(Platform.OS === "web" && { cursor: disabled ? "default" : "pointer" }),
|
|
136
|
-
}, onLayout: onTrackLayout, ...panResponder.panHandlers, children: [_jsx(View, { style: {
|
|
137
|
-
height: dims.track,
|
|
138
|
-
borderRadius: dims.track / 2,
|
|
139
|
-
backgroundColor: inactiveTrackColor,
|
|
140
|
-
overflow: "hidden",
|
|
141
|
-
}, children: _jsx(Animated.View, { style: [
|
|
142
|
-
{
|
|
143
|
-
width: "100%",
|
|
144
|
-
height: dims.track,
|
|
145
|
-
borderRadius: dims.track / 2,
|
|
146
|
-
backgroundColor: activeTrackColor,
|
|
147
|
-
transformOrigin: "left",
|
|
148
|
-
},
|
|
149
|
-
{ transform: [{ scaleX: fillScale }] },
|
|
150
|
-
] }) }), _jsx(Animated.View, { style: [
|
|
151
|
-
{
|
|
152
|
-
position: "absolute",
|
|
153
|
-
top: 0,
|
|
154
|
-
left: 0,
|
|
155
|
-
width: dims.thumb,
|
|
156
|
-
height: dims.thumb,
|
|
157
|
-
borderRadius: dims.thumb / 2,
|
|
158
|
-
backgroundColor: thumbBackgroundColor,
|
|
159
|
-
borderWidth: 1,
|
|
160
|
-
borderColor: thumbBorderColor,
|
|
161
|
-
...getShadowStyle("subtle"),
|
|
162
|
-
},
|
|
163
|
-
{ transform: [{ translateX: thumbTranslateX }] },
|
|
164
|
-
] })] })] }));
|
|
32
|
+
onValueChange?.(next);
|
|
33
|
+
}, [onValueChange]);
|
|
34
|
+
return (_jsxs(View, { style: [{ opacity: disabled ? 0.5 : 1, alignSelf: "stretch" }, styleOverride], children: [showValue && (_jsx(StyledText, { selectable: false, style: {
|
|
35
|
+
fontSize: 12,
|
|
36
|
+
color: theme.colors.textDim,
|
|
37
|
+
marginBottom: 4,
|
|
38
|
+
userSelect: "none",
|
|
39
|
+
}, children: value })), _jsx(NativeSlider, { value: value, minimumValue: min, maximumValue: max, step: step, disabled: disabled, onValueChange: handleValueChange, style: { width: "100%" },
|
|
40
|
+
// Active track — honored on iOS, Android, and web (`accentColor`).
|
|
41
|
+
minimumTrackTintColor: activeTrackColor,
|
|
42
|
+
// Inactive track + thumb — honored on Android; system-drawn elsewhere.
|
|
43
|
+
maximumTrackTintColor: inactiveTrackColor, thumbTintColor: thumbTintColor })] }));
|
|
165
44
|
}
|
|
166
45
|
export { Slider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const StatusBar: () => import("react
|
|
1
|
+
export declare const StatusBar: () => import("react").JSX.Element;
|
|
@@ -69,53 +69,53 @@ export type TextProps = RNTextProps & {
|
|
|
69
69
|
* chrome such as button labels, tabs, badges, and field labels
|
|
70
70
|
* - numberOfLines and ellipsizeMode support from RN TextProps
|
|
71
71
|
*/
|
|
72
|
-
export declare function StyledText(props: TextProps): import("react
|
|
72
|
+
export declare function StyledText(props: TextProps): import("react").JSX.Element;
|
|
73
73
|
/**
|
|
74
74
|
* Serif Text Component
|
|
75
75
|
* Uses serif font family (DM Serif Display)
|
|
76
76
|
*/
|
|
77
|
-
export declare function SerifText(props: TextProps): import("react
|
|
77
|
+
export declare function SerifText(props: TextProps): import("react").JSX.Element;
|
|
78
78
|
/**
|
|
79
79
|
* Sans-Serif Text Component
|
|
80
80
|
* Uses sans-serif font family (DM Sans)
|
|
81
81
|
*/
|
|
82
|
-
export declare function SansSerifText(props: TextProps): import("react
|
|
82
|
+
export declare function SansSerifText(props: TextProps): import("react").JSX.Element;
|
|
83
83
|
/**
|
|
84
84
|
* Serif Bold Text Component
|
|
85
85
|
* Uses serif font family — DM Serif Display only has regular weight
|
|
86
86
|
*/
|
|
87
|
-
export declare function SerifBoldText(props: TextProps): import("react
|
|
87
|
+
export declare function SerifBoldText(props: TextProps): import("react").JSX.Element;
|
|
88
88
|
/**
|
|
89
89
|
* Sans-Serif Bold Text Component
|
|
90
90
|
* Uses sans-serif font family with semibold weight (DM Sans 600)
|
|
91
91
|
*/
|
|
92
|
-
export declare function SansSerifBoldText(props: TextProps): import("react
|
|
92
|
+
export declare function SansSerifBoldText(props: TextProps): import("react").JSX.Element;
|
|
93
93
|
/**
|
|
94
94
|
* Display Text Component
|
|
95
95
|
* Uses DM Serif Display at display size — for hero text and splash screens
|
|
96
96
|
*/
|
|
97
|
-
export declare function DisplayText(props: TextProps): import("react
|
|
97
|
+
export declare function DisplayText(props: TextProps): import("react").JSX.Element;
|
|
98
98
|
/**
|
|
99
99
|
* Title Text - Large semibold text for page titles
|
|
100
100
|
*/
|
|
101
|
-
export declare function TitleText(props: TextProps): import("react
|
|
101
|
+
export declare function TitleText(props: TextProps): import("react").JSX.Element;
|
|
102
102
|
/**
|
|
103
103
|
* Heading Text - Section heading text
|
|
104
104
|
*/
|
|
105
|
-
export declare function HeadingText(props: TextProps): import("react
|
|
105
|
+
export declare function HeadingText(props: TextProps): import("react").JSX.Element;
|
|
106
106
|
/**
|
|
107
107
|
* Subheading Text - Subsection heading text
|
|
108
108
|
*/
|
|
109
|
-
export declare function SubheadingText(props: TextProps): import("react
|
|
109
|
+
export declare function SubheadingText(props: TextProps): import("react").JSX.Element;
|
|
110
110
|
/**
|
|
111
111
|
* Body Text - Default text for paragraphs and content
|
|
112
112
|
*/
|
|
113
|
-
export declare function BodyText(props: TextProps): import("react
|
|
113
|
+
export declare function BodyText(props: TextProps): import("react").JSX.Element;
|
|
114
114
|
/**
|
|
115
115
|
* Caption Text - Small text for captions and secondary content
|
|
116
116
|
*/
|
|
117
|
-
export declare function CaptionText(props: TextProps): import("react
|
|
117
|
+
export declare function CaptionText(props: TextProps): import("react").JSX.Element;
|
|
118
118
|
/**
|
|
119
119
|
* Label Text - Medium weight text for form labels
|
|
120
120
|
*/
|
|
121
|
-
export declare function LabelText(props: TextProps): import("react
|
|
121
|
+
export declare function LabelText(props: TextProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as SwitchPrimitives from "@rn-primitives/switch";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import { StyleProp, ViewStyle } from "react-native";
|
|
3
4
|
/**
|
|
4
5
|
* Switch variant styles
|
|
@@ -40,5 +41,5 @@ interface SwitchProps extends Omit<SwitchPrimitives.RootProps, "style"> {
|
|
|
40
41
|
*/
|
|
41
42
|
style?: StyleProp<ViewStyle>;
|
|
42
43
|
}
|
|
43
|
-
declare function Switch({ variant, labelOn, labelOff, size, thumbSize, loading, style: styleOverride, ...props }: SwitchProps):
|
|
44
|
+
declare function Switch({ variant, labelOn, labelOff, size, thumbSize, loading, style: styleOverride, ...props }: SwitchProps): React.JSX.Element;
|
|
44
45
|
export { Switch };
|
|
@@ -9,16 +9,16 @@ export interface TabsProps extends TabsPrimitive.RootProps {
|
|
|
9
9
|
variant?: TabsVariant;
|
|
10
10
|
size?: TabsSize;
|
|
11
11
|
}
|
|
12
|
-
declare function TabsRoot({ variant, size, children, ...props }: TabsProps):
|
|
12
|
+
declare function TabsRoot({ variant, size, children, ...props }: TabsProps): React.JSX.Element;
|
|
13
13
|
export interface TabsListProps extends TabsPrimitive.ListProps {
|
|
14
14
|
style?: StyleProp<ViewStyle>;
|
|
15
15
|
}
|
|
16
|
-
declare function TabsList({ style, children, ...props }: TabsListProps):
|
|
16
|
+
declare function TabsList({ style, children, ...props }: TabsListProps): React.JSX.Element;
|
|
17
17
|
export interface TabsTriggerProps extends TabsPrimitive.TriggerProps {
|
|
18
18
|
icon?: IconName;
|
|
19
19
|
style?: StyleProp<ViewStyle>;
|
|
20
20
|
}
|
|
21
|
-
declare function TabsTriggerInner({ icon, style, children, value, ...props }: TabsTriggerProps):
|
|
21
|
+
declare function TabsTriggerInner({ icon, style, children, value, ...props }: TabsTriggerProps): React.JSX.Element;
|
|
22
22
|
/**
|
|
23
23
|
* TabsTrigger.Text
|
|
24
24
|
* Label text for a TabsTrigger. Reads the tab size from context and applies the
|
|
@@ -32,11 +32,11 @@ declare function TabsTriggerInner({ icon, style, children, value, ...props }: Ta
|
|
|
32
32
|
* </Tabs.Trigger>
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
declare function TabsTriggerText({ style, ...props }: React.ComponentProps<typeof StyledText>):
|
|
35
|
+
declare function TabsTriggerText({ style, numberOfLines, ...props }: React.ComponentProps<typeof StyledText>): React.JSX.Element;
|
|
36
36
|
export interface TabsContentProps extends TabsPrimitive.ContentProps {
|
|
37
37
|
style?: StyleProp<ViewStyle>;
|
|
38
38
|
}
|
|
39
|
-
declare function TabsContent({ style, children, ...props }: TabsContentProps):
|
|
39
|
+
declare function TabsContent({ style, children, ...props }: TabsContentProps): React.JSX.Element;
|
|
40
40
|
declare const TabsTriggerCompound: typeof TabsTriggerInner & {
|
|
41
41
|
Text: typeof TabsTriggerText;
|
|
42
42
|
};
|
package/dist/components/Tabs.js
CHANGED
|
@@ -79,6 +79,10 @@ function TabsTriggerInner({ icon, style, children, value, ...props }) {
|
|
|
79
79
|
: theme.colors.mutedForeground;
|
|
80
80
|
const triggerBaseStyle = {
|
|
81
81
|
flex: 1,
|
|
82
|
+
// Allow the trigger to shrink below its content's intrinsic width so long
|
|
83
|
+
// labels are constrained to the trigger's flex share (and can ellipsize)
|
|
84
|
+
// instead of overflowing and clipping at the screen edge.
|
|
85
|
+
minWidth: 0,
|
|
82
86
|
height: Platform.OS === "web" ? sizeConfig.height : spacing.touchTarget,
|
|
83
87
|
paddingHorizontal: sizeConfig.paddingHorizontal,
|
|
84
88
|
flexDirection: "row",
|
|
@@ -119,10 +123,10 @@ const TabsTrigger = TabsTriggerInner;
|
|
|
119
123
|
* </Tabs.Trigger>
|
|
120
124
|
* ```
|
|
121
125
|
*/
|
|
122
|
-
function TabsTriggerText({ style, ...props }) {
|
|
126
|
+
function TabsTriggerText({ style, numberOfLines = 1, ...props }) {
|
|
123
127
|
const { size } = useTabsContext();
|
|
124
128
|
const { fontSize } = SIZE_CONFIGS[size];
|
|
125
|
-
return _jsx(StyledText, { selectable: false, style: [{ fontSize }, style], ...props });
|
|
129
|
+
return (_jsx(StyledText, { selectable: false, numberOfLines: numberOfLines, style: [{ fontSize, flexShrink: 1 }, style], ...props }));
|
|
126
130
|
}
|
|
127
131
|
function TabsContent({ style, children, ...props }) {
|
|
128
132
|
return (_jsx(TabsPrimitive.Content, { style: StyleSheet.flatten([{ marginTop: spacing.md }, style]), ...props, children: children }));
|
|
@@ -136,6 +140,10 @@ const triggerContentStyles = StyleSheet.create({
|
|
|
136
140
|
alignItems: "center",
|
|
137
141
|
justifyContent: "center",
|
|
138
142
|
gap: spacing.xs,
|
|
143
|
+
// Shrink with the trigger (paired with the trigger's minWidth:0) so a long
|
|
144
|
+
// label ellipsizes rather than forcing the trigger wider than its share.
|
|
145
|
+
flexShrink: 1,
|
|
146
|
+
minWidth: 0,
|
|
139
147
|
},
|
|
140
148
|
});
|
|
141
149
|
// ============================================================================
|
|
@@ -120,5 +120,5 @@ interface TextInputCustomProps extends TextInputProps {
|
|
|
120
120
|
* />
|
|
121
121
|
* ```
|
|
122
122
|
*/
|
|
123
|
-
export declare function TextInput(
|
|
123
|
+
export declare function TextInput(props: TextInputCustomProps): import("react").JSX.Element;
|
|
124
124
|
export {};
|