@vvedantb/native-ui 0.21.1 → 0.22.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.
@@ -0,0 +1,142 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Text, View } from "react-native";
3
+ import { IconMinus, IconPlus } from "@tabler/icons-react-native";
4
+ import { cn } from "./cn";
5
+ import { textStyle, typeStyle } from "./controlStyles";
6
+ import { IconButton } from "./IconButton";
7
+ import { useLargerText } from "./theme";
8
+ import { useScheme } from "./useScheme";
9
+ export function Stepper(t0) {
10
+ const $ = _c(40);
11
+ const {
12
+ value,
13
+ onChange,
14
+ min: t1,
15
+ max,
16
+ step: t2,
17
+ decrementLabel,
18
+ incrementLabel,
19
+ valueLabel,
20
+ testID
21
+ } = t0;
22
+ const min = t1 === undefined ? 1 : t1;
23
+ const step = t2 === undefined ? 1 : t2;
24
+ const scheme = useScheme();
25
+ const largerText = useLargerText();
26
+ let t3;
27
+ if ($[0] !== max || $[1] !== min) {
28
+ t3 = next => {
29
+ const floored = Math.max(min, next);
30
+ return max === undefined ? floored : Math.min(max, floored);
31
+ };
32
+ $[0] = max;
33
+ $[1] = min;
34
+ $[2] = t3;
35
+ } else {
36
+ t3 = $[2];
37
+ }
38
+ const clamp = t3;
39
+ const atMin = value <= min;
40
+ const atMax = max !== undefined && value >= max;
41
+ const t4 = testID === undefined ? undefined : `${testID}-less`;
42
+ let t5;
43
+ if ($[3] !== clamp || $[4] !== onChange || $[5] !== step || $[6] !== value) {
44
+ t5 = () => onChange(clamp(value - step));
45
+ $[3] = clamp;
46
+ $[4] = onChange;
47
+ $[5] = step;
48
+ $[6] = value;
49
+ $[7] = t5;
50
+ } else {
51
+ t5 = $[7];
52
+ }
53
+ let t6;
54
+ if ($[8] !== atMin || $[9] !== decrementLabel || $[10] !== t4 || $[11] !== t5) {
55
+ t6 = <IconButton testID={t4} icon={IconMinus} label={decrementLabel} size="lg" disabled={atMin} onPress={t5} />;
56
+ $[8] = atMin;
57
+ $[9] = decrementLabel;
58
+ $[10] = t4;
59
+ $[11] = t5;
60
+ $[12] = t6;
61
+ } else {
62
+ t6 = $[12];
63
+ }
64
+ const t7 = largerText ? "text-3xl" : "text-2xl";
65
+ let t8;
66
+ if ($[13] !== t7) {
67
+ t8 = cn("min-w-8 text-center font-instrument-sans-semibold", t7);
68
+ $[13] = t7;
69
+ $[14] = t8;
70
+ } else {
71
+ t8 = $[14];
72
+ }
73
+ let t9;
74
+ if ($[15] !== scheme) {
75
+ t9 = textStyle("foreground", scheme);
76
+ $[15] = scheme;
77
+ $[16] = t9;
78
+ } else {
79
+ t9 = $[16];
80
+ }
81
+ let t10;
82
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
83
+ t10 = typeStyle("semibold");
84
+ $[17] = t10;
85
+ } else {
86
+ t10 = $[17];
87
+ }
88
+ let t11;
89
+ if ($[18] !== t9) {
90
+ t11 = [t9, t10];
91
+ $[18] = t9;
92
+ $[19] = t11;
93
+ } else {
94
+ t11 = $[19];
95
+ }
96
+ let t12;
97
+ if ($[20] !== t11 || $[21] !== t8 || $[22] !== value || $[23] !== valueLabel) {
98
+ t12 = <Text accessibilityLabel={valueLabel} className={t8} style={t11}>{value}</Text>;
99
+ $[20] = t11;
100
+ $[21] = t8;
101
+ $[22] = value;
102
+ $[23] = valueLabel;
103
+ $[24] = t12;
104
+ } else {
105
+ t12 = $[24];
106
+ }
107
+ const t13 = testID === undefined ? undefined : `${testID}-more`;
108
+ let t14;
109
+ if ($[25] !== clamp || $[26] !== onChange || $[27] !== step || $[28] !== value) {
110
+ t14 = () => onChange(clamp(value + step));
111
+ $[25] = clamp;
112
+ $[26] = onChange;
113
+ $[27] = step;
114
+ $[28] = value;
115
+ $[29] = t14;
116
+ } else {
117
+ t14 = $[29];
118
+ }
119
+ let t15;
120
+ if ($[30] !== atMax || $[31] !== incrementLabel || $[32] !== t13 || $[33] !== t14) {
121
+ t15 = <IconButton testID={t13} icon={IconPlus} label={incrementLabel} size="lg" disabled={atMax} onPress={t14} />;
122
+ $[30] = atMax;
123
+ $[31] = incrementLabel;
124
+ $[32] = t13;
125
+ $[33] = t14;
126
+ $[34] = t15;
127
+ } else {
128
+ t15 = $[34];
129
+ }
130
+ let t16;
131
+ if ($[35] !== t12 || $[36] !== t15 || $[37] !== t6 || $[38] !== testID) {
132
+ t16 = <View testID={testID} className="flex-row items-center gap-1">{t6}{t12}{t15}</View>;
133
+ $[35] = t12;
134
+ $[36] = t15;
135
+ $[37] = t6;
136
+ $[38] = testID;
137
+ $[39] = t16;
138
+ } else {
139
+ t16 = $[39];
140
+ }
141
+ return t16;
142
+ }
@@ -21,6 +21,7 @@ export { SectionLabel } from "../SectionLabel";
21
21
  export { SheetRow } from "../SheetRow";
22
22
  export { PageIndicator } from "../PageIndicator";
23
23
  export { IconButton } from "../IconButton";
24
+ export { Stepper } from "../Stepper";
24
25
  export { CaptureButton } from "../CaptureButton";
25
26
  export { Separator } from "../Separator";
26
27
  export { KeyboardAvoidingView } from "../primitives/keyboard-parts";
@@ -7,7 +7,7 @@ import { c as _c } from "react/compiler-runtime";
7
7
  import { useState } from "react";
8
8
  import { ScrollView, Text, View } from "react-native";
9
9
  import { IconCopy, IconDots, IconInbox, IconPencil, IconPhoto, IconRefresh, IconTrash, IconX } from "@tabler/icons-react-native";
10
- import { APP_ICONS, APP_NAMES, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AmbientBackground, AppMark, AppWordmark, BulkActionBar, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, Avatar, AvatarFallback, Badge, Button, CaptureButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CenteredSpinner, Checkbox, ColorSwatches, ConfirmDialog, DateTimeField, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, EmptyState, FromProjectV, GoogleMark, IconButton, Input, Label, LabeledSwitchRow, ListRow, MoreFromProjectV, NEUTRAL_900, NativeUiProvider, PageHeader, PageIndicator, PageTitle, PricingModal, Progress, SearchInput, SectionLabel, Select, Separator, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetRow, SheetTitle, SheetTrigger, Skeleton, Spinner, StackPageHeader, StatGrid, StatusDot, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, Toaster, UpgradeToProCard, initials, palette, toast, tokens, useNativeUi } from "../index";
10
+ import { APP_ICONS, APP_NAMES, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AmbientBackground, AppMark, AppWordmark, BulkActionBar, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, Avatar, AvatarFallback, Badge, Button, CaptureButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CenteredSpinner, Checkbox, ColorSwatches, ConfirmDialog, DateTimeField, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, EmptyState, FromProjectV, GoogleMark, IconButton, Input, Label, LabeledSwitchRow, ListRow, MoreFromProjectV, NEUTRAL_900, NativeUiProvider, PageHeader, PageIndicator, PageTitle, PricingModal, Progress, SearchInput, SectionLabel, Select, Separator, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetRow, SheetTitle, SheetTrigger, Skeleton, Spinner, StackPageHeader, StatGrid, StatusDot, Stepper, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, Toaster, UpgradeToProCard, initials, palette, toast, tokens, useNativeUi } from "../index";
11
11
  import { typeStyle } from "../controlStyles";
12
12
  import { useScheme } from "../useScheme";
13
13
  import { ChainOfThought, ChainOfThoughtContent, ChainOfThoughtHeader, ChainOfThoughtSearchResult, ChainOfThoughtSearchResults, ChainOfThoughtStep, ConversationEmptyState, Suggestion, Suggestions } from "../ai";
@@ -153,7 +153,7 @@ export function ParityGallery() {
153
153
  return t1;
154
154
  }
155
155
  function GalleryScreen() {
156
- const $ = _c(191);
156
+ const $ = _c(201);
157
157
  const [checked, setChecked] = useState("indeterminate");
158
158
  const [switchOn, setSwitchOn] = useState(true);
159
159
  const [colour, setColour] = useState(undefined);
@@ -170,6 +170,7 @@ function GalleryScreen() {
170
170
  const [page, setPage] = useState(0);
171
171
  const [menuSort, setMenuSort] = useState("newest");
172
172
  const [picked, setPicked] = useState(2);
173
+ const [dose, setDose] = useState(1);
173
174
  const scheme = useScheme();
174
175
  let t0;
175
176
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -1073,95 +1074,131 @@ function GalleryScreen() {
1073
1074
  }
1074
1075
  let t128;
1075
1076
  if ($[167] === Symbol.for("react.memo_cache_sentinel")) {
1076
- t128 = <AiChatSamples />;
1077
+ t128 = <GalleryText>Tablets</GalleryText>;
1077
1078
  $[167] = t128;
1078
1079
  } else {
1079
1080
  t128 = $[167];
1080
1081
  }
1081
- let t129;
1082
- if ($[168] === Symbol.for("react.memo_cache_sentinel")) {
1083
- t129 = <ChainOfThoughtHeader />;
1084
- $[168] = t129;
1085
- } else {
1086
- t129 = $[168];
1087
- }
1082
+ const t129 = `${dose} tablets`;
1088
1083
  let t130;
1089
- if ($[169] === Symbol.for("react.memo_cache_sentinel")) {
1090
- t130 = <ChainOfThoughtStep label="Read the question" />;
1091
- $[169] = t130;
1092
- } else {
1093
- t130 = $[169];
1094
- }
1095
- let t131;
1096
- if ($[170] === Symbol.for("react.memo_cache_sentinel")) {
1097
- t131 = <ChainOfThought defaultOpen={true}>{t129}<ChainOfThoughtContent>{t130}<ChainOfThoughtStep label="Search for sync options" status="active"><ChainOfThoughtSearchResults><ChainOfThoughtSearchResult>example.com</ChainOfThoughtSearchResult><ChainOfThoughtSearchResult>example.org</ChainOfThoughtSearchResult></ChainOfThoughtSearchResults></ChainOfThoughtStep><ChainOfThoughtStep label="Write the answer" status="pending" /></ChainOfThoughtContent></ChainOfThought>;
1098
- $[170] = t131;
1084
+ if ($[168] !== dose || $[169] !== t129) {
1085
+ t130 = <View className="flex-row items-center justify-between rounded-lg bg-surface px-4 py-3">{t128}<Stepper testID="stepper-dose" value={dose} onChange={setDose} min={1} max={6} decrementLabel="Take one fewer" incrementLabel="Take one more" valueLabel={t129} /></View>;
1086
+ $[168] = dose;
1087
+ $[169] = t129;
1088
+ $[170] = t130;
1099
1089
  } else {
1100
- t131 = $[170];
1090
+ t130 = $[170];
1101
1091
  }
1092
+ const t131 = `Dose: ${dose}`;
1102
1093
  let t132;
1103
- if ($[171] === Symbol.for("react.memo_cache_sentinel")) {
1104
- t132 = <Section title="AI chat">{t128}{t131}<Suggestions><Suggestion suggestion="Summarise this thread" onPress={_temp40} /><Suggestion suggestion="Draft a reply" onPress={_temp41} /></Suggestions><ConversationEmptyState className="flex-none" /></Section>;
1105
- $[171] = t132;
1094
+ if ($[171] !== t131) {
1095
+ t132 = <GalleryText testID="stepper-dose-value">{t131}</GalleryText>;
1096
+ $[171] = t131;
1097
+ $[172] = t132;
1106
1098
  } else {
1107
- t132 = $[171];
1099
+ t132 = $[172];
1108
1100
  }
1109
1101
  let t133;
1110
- if ($[172] !== t100 || $[173] !== t117 || $[174] !== t118 || $[175] !== t19 || $[176] !== t33 || $[177] !== t44 || $[178] !== t68 || $[179] !== t91 || $[180] !== t94 || $[181] !== t98) {
1111
- t133 = <ScrollView keyboardShouldPersistTaps="handled" contentContainerClassName="gap-8 px-4 pt-4" contentContainerStyle={t0}>{t3}{t7}{t19}{t20}{t21}{t33}{t36}{t44}{t49}{t51}{t68}{t91}{t93}{t94}{t98}{t100}{t104}{t117}{t118}{t120}{t121}{t127}{t132}</ScrollView>;
1112
- $[172] = t100;
1113
- $[173] = t117;
1114
- $[174] = t118;
1115
- $[175] = t19;
1116
- $[176] = t33;
1117
- $[177] = t44;
1118
- $[178] = t68;
1119
- $[179] = t91;
1120
- $[180] = t94;
1121
- $[181] = t98;
1122
- $[182] = t133;
1123
- } else {
1124
- t133 = $[182];
1102
+ if ($[173] !== t130 || $[174] !== t132) {
1103
+ t133 = <Section title="Stepper">{t130}{t132}</Section>;
1104
+ $[173] = t130;
1105
+ $[174] = t132;
1106
+ $[175] = t133;
1107
+ } else {
1108
+ t133 = $[175];
1125
1109
  }
1126
1110
  let t134;
1127
- if ($[183] === Symbol.for("react.memo_cache_sentinel")) {
1128
- t134 = () => setPricingOpen(false);
1129
- $[183] = t134;
1111
+ if ($[176] === Symbol.for("react.memo_cache_sentinel")) {
1112
+ t134 = <AiChatSamples />;
1113
+ $[176] = t134;
1130
1114
  } else {
1131
- t134 = $[183];
1115
+ t134 = $[176];
1132
1116
  }
1133
1117
  let t135;
1134
- if ($[184] === Symbol.for("react.memo_cache_sentinel")) {
1135
- t135 = ["vibot", "verve", "velth", "vmem", "vhub"];
1136
- $[184] = t135;
1118
+ if ($[177] === Symbol.for("react.memo_cache_sentinel")) {
1119
+ t135 = <ChainOfThoughtHeader />;
1120
+ $[177] = t135;
1137
1121
  } else {
1138
- t135 = $[184];
1122
+ t135 = $[177];
1139
1123
  }
1140
1124
  let t136;
1141
- if ($[185] !== pricingOpen) {
1142
- t136 = <PricingModal open={pricingOpen} onClose={t134} title="Upgrade to V Pro" apps={t135} currentApp="vibot" headline="One plan. Every V app." plans={PLANS} finePrint="Placeholder prices for the gallery." onCheckout={_temp42} />;
1143
- $[185] = pricingOpen;
1144
- $[186] = t136;
1125
+ if ($[178] === Symbol.for("react.memo_cache_sentinel")) {
1126
+ t136 = <ChainOfThoughtStep label="Read the question" />;
1127
+ $[178] = t136;
1145
1128
  } else {
1146
- t136 = $[186];
1129
+ t136 = $[178];
1147
1130
  }
1148
1131
  let t137;
1149
- if ($[187] === Symbol.for("react.memo_cache_sentinel")) {
1150
- t137 = <Toaster />;
1151
- $[187] = t137;
1132
+ if ($[179] === Symbol.for("react.memo_cache_sentinel")) {
1133
+ t137 = <ChainOfThought defaultOpen={true}>{t135}<ChainOfThoughtContent>{t136}<ChainOfThoughtStep label="Search for sync options" status="active"><ChainOfThoughtSearchResults><ChainOfThoughtSearchResult>example.com</ChainOfThoughtSearchResult><ChainOfThoughtSearchResult>example.org</ChainOfThoughtSearchResult></ChainOfThoughtSearchResults></ChainOfThoughtStep><ChainOfThoughtStep label="Write the answer" status="pending" /></ChainOfThoughtContent></ChainOfThought>;
1134
+ $[179] = t137;
1152
1135
  } else {
1153
- t137 = $[187];
1136
+ t137 = $[179];
1154
1137
  }
1155
1138
  let t138;
1156
- if ($[188] !== t133 || $[189] !== t136) {
1157
- t138 = <View className="flex-1">{t133}{t136}{t137}</View>;
1158
- $[188] = t133;
1159
- $[189] = t136;
1160
- $[190] = t138;
1161
- } else {
1162
- t138 = $[190];
1163
- }
1164
- return t138;
1139
+ if ($[180] === Symbol.for("react.memo_cache_sentinel")) {
1140
+ t138 = <Section title="AI chat">{t134}{t137}<Suggestions><Suggestion suggestion="Summarise this thread" onPress={_temp40} /><Suggestion suggestion="Draft a reply" onPress={_temp41} /></Suggestions><ConversationEmptyState className="flex-none" /></Section>;
1141
+ $[180] = t138;
1142
+ } else {
1143
+ t138 = $[180];
1144
+ }
1145
+ let t139;
1146
+ if ($[181] !== t100 || $[182] !== t117 || $[183] !== t118 || $[184] !== t133 || $[185] !== t19 || $[186] !== t33 || $[187] !== t44 || $[188] !== t68 || $[189] !== t91 || $[190] !== t94 || $[191] !== t98) {
1147
+ t139 = <ScrollView keyboardShouldPersistTaps="handled" contentContainerClassName="gap-8 px-4 pt-4" contentContainerStyle={t0}>{t3}{t7}{t19}{t20}{t21}{t33}{t36}{t44}{t49}{t51}{t68}{t91}{t93}{t94}{t98}{t100}{t104}{t117}{t118}{t120}{t121}{t127}{t133}{t138}</ScrollView>;
1148
+ $[181] = t100;
1149
+ $[182] = t117;
1150
+ $[183] = t118;
1151
+ $[184] = t133;
1152
+ $[185] = t19;
1153
+ $[186] = t33;
1154
+ $[187] = t44;
1155
+ $[188] = t68;
1156
+ $[189] = t91;
1157
+ $[190] = t94;
1158
+ $[191] = t98;
1159
+ $[192] = t139;
1160
+ } else {
1161
+ t139 = $[192];
1162
+ }
1163
+ let t140;
1164
+ if ($[193] === Symbol.for("react.memo_cache_sentinel")) {
1165
+ t140 = () => setPricingOpen(false);
1166
+ $[193] = t140;
1167
+ } else {
1168
+ t140 = $[193];
1169
+ }
1170
+ let t141;
1171
+ if ($[194] === Symbol.for("react.memo_cache_sentinel")) {
1172
+ t141 = ["vibot", "verve", "velth", "vmem", "vhub"];
1173
+ $[194] = t141;
1174
+ } else {
1175
+ t141 = $[194];
1176
+ }
1177
+ let t142;
1178
+ if ($[195] !== pricingOpen) {
1179
+ t142 = <PricingModal open={pricingOpen} onClose={t140} title="Upgrade to V Pro" apps={t141} currentApp="vibot" headline="One plan. Every V app." plans={PLANS} finePrint="Placeholder prices for the gallery." onCheckout={_temp42} />;
1180
+ $[195] = pricingOpen;
1181
+ $[196] = t142;
1182
+ } else {
1183
+ t142 = $[196];
1184
+ }
1185
+ let t143;
1186
+ if ($[197] === Symbol.for("react.memo_cache_sentinel")) {
1187
+ t143 = <Toaster />;
1188
+ $[197] = t143;
1189
+ } else {
1190
+ t143 = $[197];
1191
+ }
1192
+ let t144;
1193
+ if ($[198] !== t139 || $[199] !== t142) {
1194
+ t144 = <View className="flex-1">{t139}{t142}{t143}</View>;
1195
+ $[198] = t139;
1196
+ $[199] = t142;
1197
+ $[200] = t144;
1198
+ } else {
1199
+ t144 = $[200];
1200
+ }
1201
+ return t144;
1165
1202
  }
1166
1203
  function _temp42(plan, period) {
1167
1204
  return toast(`${plan.name} (${period})`);
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ export { SectionLabel } from "./SectionLabel";
29
29
  export { SheetRow } from "./SheetRow";
30
30
  export { PageIndicator } from "./PageIndicator";
31
31
  export { IconButton } from "./IconButton";
32
+ export { Stepper } from "./Stepper";
32
33
  export { CaptureButton } from "./CaptureButton";
33
34
  export { Separator } from "./Separator";
34
35
  export { Progress } from "./Progress";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/native-ui",
3
- "version": "0.21.1",
3
+ "version": "0.22.0",
4
4
  "license": "MIT",
5
5
  "description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts, the family app marks, a NativeWind preset, the Expo web root and Clerk + Convex auth screens.",
6
6
  "type": "module",
@@ -0,0 +1,67 @@
1
+ import { Text, View } from "react-native";
2
+ import { IconMinus, IconPlus } from "@tabler/icons-react-native";
3
+ import { cn } from "./cn";
4
+ import { textStyle, typeStyle } from "./controlStyles";
5
+ import { IconButton } from "./IconButton";
6
+ import { useLargerText } from "./theme";
7
+ import { useScheme } from "./useScheme";
8
+
9
+ export type StepperProps = {
10
+ value: number;
11
+ onChange: (value: number) => void;
12
+ min?: number;
13
+ max?: number;
14
+ step?: number;
15
+ decrementLabel: string;
16
+ incrementLabel: string;
17
+ valueLabel?: string;
18
+ testID?: string;
19
+ };
20
+
21
+ export function Stepper({
22
+ value,
23
+ onChange,
24
+ min = 1,
25
+ max,
26
+ step = 1,
27
+ decrementLabel,
28
+ incrementLabel,
29
+ valueLabel,
30
+ testID,
31
+ }: StepperProps) {
32
+ const scheme = useScheme();
33
+ const largerText = useLargerText();
34
+ const clamp = (next: number) => {
35
+ const floored = Math.max(min, next);
36
+ return max === undefined ? floored : Math.min(max, floored);
37
+ };
38
+ const atMin = value <= min;
39
+ const atMax = max !== undefined && value >= max;
40
+ return (
41
+ <View testID={testID} className="flex-row items-center gap-1">
42
+ <IconButton
43
+ testID={testID === undefined ? undefined : `${testID}-less`}
44
+ icon={IconMinus}
45
+ label={decrementLabel}
46
+ size="lg"
47
+ disabled={atMin}
48
+ onPress={() => onChange(clamp(value - step))}
49
+ />
50
+ <Text
51
+ accessibilityLabel={valueLabel}
52
+ className={cn("min-w-8 text-center font-instrument-sans-semibold", largerText ? "text-3xl" : "text-2xl")}
53
+ style={[textStyle("foreground", scheme), typeStyle("semibold")]}
54
+ >
55
+ {value}
56
+ </Text>
57
+ <IconButton
58
+ testID={testID === undefined ? undefined : `${testID}-more`}
59
+ icon={IconPlus}
60
+ label={incrementLabel}
61
+ size="lg"
62
+ disabled={atMax}
63
+ onPress={() => onChange(clamp(value + step))}
64
+ />
65
+ </View>
66
+ );
67
+ }
@@ -39,6 +39,8 @@ export { PageIndicator } from "../PageIndicator";
39
39
  export type { PageIndicatorProps } from "../PageIndicator";
40
40
  export { IconButton } from "../IconButton";
41
41
  export type { IconButtonProps, IconButtonSize, IconButtonVariant } from "../IconButton";
42
+ export { Stepper } from "../Stepper";
43
+ export type { StepperProps } from "../Stepper";
42
44
  export { CaptureButton } from "../CaptureButton";
43
45
  export type { CaptureButtonProps } from "../CaptureButton";
44
46
  export { Separator } from "../Separator";
@@ -96,6 +96,7 @@ import {
96
96
  StackPageHeader,
97
97
  StatGrid,
98
98
  StatusDot,
99
+ Stepper,
99
100
  Switch,
100
101
  Tabs,
101
102
  TabsContent,
@@ -238,6 +239,7 @@ function GalleryScreen() {
238
239
  const [page, setPage] = useState(0);
239
240
  const [menuSort, setMenuSort] = useState<"newest" | "oldest">("newest");
240
241
  const [picked, setPicked] = useState(2);
242
+ const [dose, setDose] = useState(1);
241
243
  const scheme = useScheme();
242
244
 
243
245
  return (
@@ -770,6 +772,24 @@ function GalleryScreen() {
770
772
  </View>
771
773
  </Section>
772
774
 
775
+ <Section title="Stepper">
776
+ {/* Minus is disabled at `min` (1 here), plus at `max` (6). */}
777
+ <View className="flex-row items-center justify-between rounded-lg bg-surface px-4 py-3">
778
+ <GalleryText>Tablets</GalleryText>
779
+ <Stepper
780
+ testID="stepper-dose"
781
+ value={dose}
782
+ onChange={setDose}
783
+ min={1}
784
+ max={6}
785
+ decrementLabel="Take one fewer"
786
+ incrementLabel="Take one more"
787
+ valueLabel={`${dose} tablets`}
788
+ />
789
+ </View>
790
+ <GalleryText testID="stepper-dose-value">{`Dose: ${dose}`}</GalleryText>
791
+ </Section>
792
+
773
793
  {/* The full chat screen, with the composer and keyboard, is `AiChatGallery` (`@vvedantb/native-ui/ai-gallery`). */}
774
794
  <Section title="AI chat">
775
795
  <AiChatSamples />
package/src/index.ts CHANGED
@@ -76,6 +76,8 @@ export { PageIndicator } from "./PageIndicator";
76
76
  export type { PageIndicatorProps } from "./PageIndicator";
77
77
  export { IconButton } from "./IconButton";
78
78
  export type { IconButtonProps, IconButtonSize, IconButtonVariant } from "./IconButton";
79
+ export { Stepper } from "./Stepper";
80
+ export type { StepperProps } from "./Stepper";
79
81
  export { CaptureButton } from "./CaptureButton";
80
82
  export type { CaptureButtonProps } from "./CaptureButton";
81
83
  export { Separator } from "./Separator";