@vvedantb/native-ui 0.17.2 → 0.18.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.
Files changed (220) hide show
  1. package/dist/AlertDialog.jsx +123 -0
  2. package/dist/AmbientBackground.jsx +73 -0
  3. package/dist/ArtifactList.jsx +59 -0
  4. package/dist/Avatar.jsx +285 -0
  5. package/dist/Badge.jsx +154 -0
  6. package/dist/BottomSheetContainer.jsx +208 -0
  7. package/dist/BulkActionBar.jsx +717 -0
  8. package/dist/Button.jsx +344 -0
  9. package/dist/CaptureButton.jsx +104 -0
  10. package/dist/Card.jsx +371 -0
  11. package/dist/Checkbox.jsx +177 -0
  12. package/dist/Chip.jsx +79 -0
  13. package/dist/ColorSwatches.jsx +159 -0
  14. package/dist/ConfirmDialog.jsx +157 -0
  15. package/dist/DateTimeField.jsx +204 -0
  16. package/dist/Dialog.jsx +614 -0
  17. package/dist/DividedList.jsx +120 -0
  18. package/dist/DropdownMenu.jsx +849 -0
  19. package/dist/EmptyState.jsx +434 -0
  20. package/dist/ExpoWebRoot.jsx +134 -0
  21. package/dist/FloatingFAB.jsx +95 -0
  22. package/dist/FloatingSurface.jsx +226 -0
  23. package/dist/FloatingTabBar.jsx +403 -0
  24. package/dist/HeaderIconButton.jsx +53 -0
  25. package/dist/IconButton.jsx +157 -0
  26. package/dist/Input.jsx +96 -0
  27. package/dist/Label.jsx +96 -0
  28. package/dist/LabeledSwitchRow.jsx +170 -0
  29. package/dist/LiquidGlass.jsx +2 -0
  30. package/dist/ListRow.jsx +281 -0
  31. package/dist/LoadingState.jsx +205 -0
  32. package/dist/PageIndicator.jsx +128 -0
  33. package/dist/PageTitle.jsx +205 -0
  34. package/dist/Pager.jsx +105 -0
  35. package/dist/PasswordInput.jsx +120 -0
  36. package/dist/PillTabs.jsx +300 -0
  37. package/dist/PinnedBotTile.jsx +212 -0
  38. package/dist/Progress.jsx +147 -0
  39. package/dist/SafeAreaContainer.jsx +38 -0
  40. package/dist/ScreenContainer.jsx +117 -0
  41. package/dist/SearchInput.jsx +150 -0
  42. package/dist/SectionLabel.jsx +128 -0
  43. package/dist/Select.jsx +223 -0
  44. package/dist/Separator.jsx +95 -0
  45. package/dist/Sheet.jsx +343 -0
  46. package/dist/SheetRow.jsx +198 -0
  47. package/dist/Skeleton.jsx +311 -0
  48. package/dist/Spinner.jsx +195 -0
  49. package/dist/StackPageHeader.jsx +160 -0
  50. package/dist/StatGrid.jsx +74 -0
  51. package/dist/StatusDot.jsx +129 -0
  52. package/dist/SurfaceRow.jsx +143 -0
  53. package/dist/SwipeableRow.jsx +50 -0
  54. package/dist/Switch.jsx +130 -0
  55. package/dist/Tabs.jsx +385 -0
  56. package/dist/Textarea.jsx +103 -0
  57. package/dist/ThemeToggle.jsx +78 -0
  58. package/dist/Toast.jsx +396 -0
  59. package/dist/ai/activity-step-detail.jsx +179 -0
  60. package/dist/ai/activity-step-label.js +816 -0
  61. package/dist/ai/activity-step-types.js +14 -0
  62. package/dist/ai/activity-step.jsx +98 -0
  63. package/dist/ai/activity-tasks-utils.js +172 -0
  64. package/dist/ai/activity-timeline.js +47 -0
  65. package/dist/ai/attachments.jsx +258 -0
  66. package/dist/ai/card-button.jsx +188 -0
  67. package/dist/ai/chain-of-thought.jsx +459 -0
  68. package/dist/ai/chat-jump-rail.jsx +57 -0
  69. package/dist/ai/chat-text.js +44 -0
  70. package/dist/ai/chat-thread.jsx +135 -0
  71. package/dist/ai/choice-question.jsx +925 -0
  72. package/dist/ai/code-block.jsx +574 -0
  73. package/dist/ai/collapsible.jsx +275 -0
  74. package/dist/ai/conversation.jsx +723 -0
  75. package/dist/ai/file-chip.jsx +198 -0
  76. package/dist/ai/icon-button.jsx +179 -0
  77. package/dist/ai/index.js +37 -0
  78. package/dist/ai/message-action-sheet.jsx +408 -0
  79. package/dist/ai/message-quote.jsx +241 -0
  80. package/dist/ai/message.jsx +739 -0
  81. package/dist/ai/prompt-input-menu.jsx +365 -0
  82. package/dist/ai/prompt-input.jsx +626 -0
  83. package/dist/ai/reasoning.jsx +446 -0
  84. package/dist/ai/reply-quote-chip.jsx +278 -0
  85. package/dist/ai/response-text.jsx +130 -0
  86. package/dist/ai/shimmer.jsx +149 -0
  87. package/dist/ai/sources.jsx +260 -0
  88. package/dist/ai/subagent-cards.jsx +645 -0
  89. package/dist/ai/suggestion.jsx +186 -0
  90. package/dist/ai/tool-approval-card.jsx +359 -0
  91. package/dist/ai/trace.jsx +728 -0
  92. package/dist/ai/unified-diff.jsx +280 -0
  93. package/dist/ai/use-streaming-disclosure.js +70 -0
  94. package/dist/auth/AuthProviders.jsx +27 -0
  95. package/dist/auth/AuthScreen.jsx +292 -0
  96. package/dist/auth/GoogleSignInButton.jsx +188 -0
  97. package/dist/auth/SecondFactorScreen.jsx +133 -0
  98. package/dist/auth/SignInScreen.jsx +482 -0
  99. package/dist/auth/authErrors.js +131 -0
  100. package/dist/auth/index.js +11 -0
  101. package/dist/auth/totp.js +378 -0
  102. package/dist/blur.js +36 -0
  103. package/dist/brand/AppIcons.jsx +118 -0
  104. package/dist/brand/AppMark.jsx +128 -0
  105. package/dist/brand/AppWordmark.jsx +138 -0
  106. package/dist/brand/GoogleMark.jsx +71 -0
  107. package/dist/brand/ProviderIcon.jsx +192 -0
  108. package/dist/brand/familyApps.js +33 -0
  109. package/dist/brand/index.js +11 -0
  110. package/dist/brand/svg.js +252 -0
  111. package/dist/brand/vProAppBenefits.js +19 -0
  112. package/dist/cn.js +5 -0
  113. package/dist/colors.js +15 -0
  114. package/dist/configureTheme.js +72 -0
  115. package/dist/controlStyles.js +520 -0
  116. package/dist/definiteSize.js +12 -0
  117. package/dist/dialogLayout.js +18 -0
  118. package/dist/entries/ai.js +4 -0
  119. package/dist/entries/ambient.js +3 -0
  120. package/dist/entries/auth.js +5 -0
  121. package/dist/entries/bottom-sheet.js +2 -0
  122. package/dist/entries/brand.js +2 -0
  123. package/dist/entries/button.js +2 -0
  124. package/dist/entries/date-time.js +3 -0
  125. package/dist/entries/expo-router.js +4 -0
  126. package/dist/entries/expo-web-root.js +3 -0
  127. package/dist/entries/floating.js +7 -0
  128. package/dist/entries/gesture-handler.js +4 -0
  129. package/dist/entries/keyboard-controller.js +4 -0
  130. package/dist/entries/layout.js +16 -0
  131. package/dist/entries/markdown.js +4 -0
  132. package/dist/entries/marketing.js +3 -0
  133. package/dist/entries/page-title.js +7 -0
  134. package/dist/entries/password-input.js +3 -0
  135. package/dist/entries/primitives.js +57 -0
  136. package/dist/entries/search-input.js +3 -0
  137. package/dist/entries/tab-bar.js +4 -0
  138. package/dist/entries/theme.js +7 -0
  139. package/dist/entries/toast.js +5 -0
  140. package/dist/entries/video.js +3 -0
  141. package/dist/entries/webview.js +4 -0
  142. package/dist/examples/AiChatGallery.jsx +509 -0
  143. package/dist/examples/ParityGallery.jsx +1307 -0
  144. package/dist/floating.js +62 -0
  145. package/dist/glassBlur.jsx +145 -0
  146. package/dist/gradient.js +17 -0
  147. package/dist/haptics.js +44 -0
  148. package/dist/highlight.js +382 -0
  149. package/dist/index.js +85 -0
  150. package/dist/initials.js +4 -0
  151. package/dist/loadingGrid.js +81 -0
  152. package/dist/markdown/Markdown.jsx +515 -0
  153. package/dist/markdown/MarkdownTable.jsx +443 -0
  154. package/dist/markdown/tableText.js +68 -0
  155. package/dist/marketing/PricingModal.jsx +608 -0
  156. package/dist/marketing/UpgradeToProCard.jsx +164 -0
  157. package/dist/marketing/pricing.js +34 -0
  158. package/dist/media/ImageGallery.jsx +580 -0
  159. package/dist/media/MediaCard.jsx +162 -0
  160. package/dist/media/imageGrid.js +54 -0
  161. package/dist/motion.js +33 -0
  162. package/dist/pagerSwipe.js +104 -0
  163. package/dist/palette.js +104 -0
  164. package/dist/primitives/button.jsx +127 -0
  165. package/dist/primitives/card.jsx +249 -0
  166. package/dist/primitives/icon.jsx +37 -0
  167. package/dist/primitives/input.jsx +56 -0
  168. package/dist/primitives/keyboard-controller.jsx +207 -0
  169. package/dist/primitives/keyboard-parts.jsx +75 -0
  170. package/dist/primitives/native-only-animated-view.jsx +68 -0
  171. package/dist/primitives/overlay.jsx +391 -0
  172. package/dist/primitives/pager-gesture.jsx +131 -0
  173. package/dist/primitives/select-host.jsx +103 -0
  174. package/dist/primitives/select.jsx +555 -0
  175. package/dist/primitives/sheet-drag.jsx +420 -0
  176. package/dist/primitives/sheet-gesture.jsx +219 -0
  177. package/dist/primitives/swipe-row-gesture.jsx +341 -0
  178. package/dist/primitives/switch.jsx +105 -0
  179. package/dist/primitives/text.jsx +145 -0
  180. package/dist/primitives/toast-drag-gesture.jsx +94 -0
  181. package/dist/primitives/use-controllable-state.js +40 -0
  182. package/dist/primitives/web-click-guard.js +69 -0
  183. package/dist/push.js +166 -0
  184. package/dist/relativeTime.js +70 -0
  185. package/dist/router/RouterStackPageHeader.jsx +53 -0
  186. package/dist/selectA11y.js +32 -0
  187. package/dist/settings/MoreFromProjectV.jsx +168 -0
  188. package/dist/settings/SettingsEmptyState.jsx +102 -0
  189. package/dist/settings/SettingsField.jsx +49 -0
  190. package/dist/settings/SettingsSection.jsx +101 -0
  191. package/dist/settings/SettingsStack.jsx +17 -0
  192. package/dist/settings/SettingsToggleRow.jsx +163 -0
  193. package/dist/settings/projectVMobileApps.js +126 -0
  194. package/dist/settings/relaxedSizeStyle.js +11 -0
  195. package/dist/sheetDrag.js +76 -0
  196. package/dist/svgA11y.js +46 -0
  197. package/dist/swipeRow.js +161 -0
  198. package/dist/tabBarRoutes.js +41 -0
  199. package/dist/tabIndicator.js +139 -0
  200. package/dist/tailwind-preset.cjs +255 -0
  201. package/dist/tailwind-preset.d.cts +55 -0
  202. package/dist/theme.jsx +62 -0
  203. package/dist/toastChrome.js +110 -0
  204. package/dist/toastDrag.js +51 -0
  205. package/dist/toastStore.js +54 -0
  206. package/dist/tokens.js +70 -0
  207. package/dist/typography.js +40 -0
  208. package/dist/useReduceMotion.js +32 -0
  209. package/dist/useReduceTransparency.js +27 -0
  210. package/dist/useScheme.js +15 -0
  211. package/dist/video/InlineVideo.jsx +115 -0
  212. package/dist/webview/HtmlView.jsx +169 -0
  213. package/dist/webview/HtmlView.web.jsx +63 -0
  214. package/dist/webview/htmlView.js +43 -0
  215. package/package.json +70 -33
  216. package/src/DropdownMenu.tsx +28 -16
  217. package/src/FloatingTabBar.tsx +78 -41
  218. package/src/ai/conversation.tsx +12 -8
  219. package/src/glassBlur.tsx +47 -22
  220. package/src/primitives/swipe-row-gesture.tsx +11 -2
@@ -0,0 +1,74 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Text, View } from "react-native";
3
+ import { cn } from "./cn";
4
+ import { cardStyle, sizeStyle, textStyle, typeStyle } from "./controlStyles";
5
+ import { useLargerText } from "./theme";
6
+ import { useScheme } from "./useScheme";
7
+ /** `items` in rows of `columns`. The last row is padded with `null`, so every tile has the same width. */
8
+ export function statGridRows(items, columns) {
9
+ const rows = [];
10
+ for (let start = 0; start < items.length; start += columns) {
11
+ const row = items.slice(start, start + columns);
12
+ while (row.length < columns) row.push(null);
13
+ rows.push(row);
14
+ }
15
+ return rows;
16
+ }
17
+
18
+ /**
19
+ * Label and value tiles in rows of 2 or 3, each the flat web card
20
+ * (`cardStyle`: `surfaceCard` fill, radius 16, no shadow) with the web
21
+ * `Surface` padding (`p-4`). The label is muted `text-sm`; the value is
22
+ * semibold `text-xl` in the foreground, with tabular figures. VoiceOver and
23
+ * TalkBack read each tile as one element: "Steps, 8,432".
24
+ */
25
+ export function StatGrid(t0) {
26
+ const $ = _c(13);
27
+ const {
28
+ items,
29
+ columns: t1,
30
+ testID
31
+ } = t0;
32
+ const columns = t1 === undefined ? 2 : t1;
33
+ const scheme = useScheme();
34
+ const largerText = useLargerText();
35
+ if (items.length === 0) {
36
+ return null;
37
+ }
38
+ const labelSize = largerText ? "text-base" : "text-sm";
39
+ const valueSize = largerText ? "text-2xl" : "text-xl";
40
+ let t2;
41
+ if ($[0] !== columns || $[1] !== items || $[2] !== labelSize || $[3] !== scheme || $[4] !== valueSize) {
42
+ let t3;
43
+ if ($[6] !== labelSize || $[7] !== scheme || $[8] !== valueSize) {
44
+ t3 = (row, rowIndex) => <View key={rowIndex} className="flex-row gap-3">{row.map((item, index) => item ? <View key={index} testID={item.testID} accessible={true} accessibilityLabel={`${item.label}, ${item.value}`} className="min-w-0 flex-1 gap-1 p-4" style={cardStyle(scheme)}><Text className={cn("font-instrument-sans", labelSize)} style={[textStyle("muted", scheme), sizeStyle(labelSize)]}>{item.label}</Text><Text className={cn("font-instrument-sans-semibold", valueSize)} style={[textStyle("foreground", scheme), sizeStyle(valueSize, "tight"), typeStyle("semibold"), {
45
+ fontVariant: ["tabular-nums"]
46
+ }]}>{item.value}</Text></View> : <View key={index} className="flex-1" />)}</View>;
47
+ $[6] = labelSize;
48
+ $[7] = scheme;
49
+ $[8] = valueSize;
50
+ $[9] = t3;
51
+ } else {
52
+ t3 = $[9];
53
+ }
54
+ t2 = statGridRows(items, columns).map(t3);
55
+ $[0] = columns;
56
+ $[1] = items;
57
+ $[2] = labelSize;
58
+ $[3] = scheme;
59
+ $[4] = valueSize;
60
+ $[5] = t2;
61
+ } else {
62
+ t2 = $[5];
63
+ }
64
+ let t3;
65
+ if ($[10] !== t2 || $[11] !== testID) {
66
+ t3 = <View testID={testID} className="gap-3">{t2}</View>;
67
+ $[10] = t2;
68
+ $[11] = testID;
69
+ $[12] = t3;
70
+ } else {
71
+ t3 = $[12];
72
+ }
73
+ return t3;
74
+ }
@@ -0,0 +1,129 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { View } from "react-native";
3
+ import { cn } from "./cn";
4
+ import { palette, withAlpha } from "./palette";
5
+ import { tokens } from "./tokens";
6
+ import { useScheme } from "./useScheme";
7
+
8
+ /**
9
+ * The web `StatusTone`s, and `info` (native only, from 0.5.0): neutral news
10
+ * such as "synced" or "new", in blue.
11
+ */
12
+
13
+ /**
14
+ * The `info` blue: Tailwind `blue-500` in light and the lighter `blue-400` in
15
+ * dark. Local to the dot: `tokens.css` has no `--info`, so it is not a
16
+ * `palette` key.
17
+ */
18
+ const INFO = {
19
+ light: "#3b82f6",
20
+ dark: "#60a5fa"
21
+ };
22
+ function toneColor(tone, scheme) {
23
+ switch (tone) {
24
+ case "progress":
25
+ return palette.warning[scheme];
26
+ case "business-review":
27
+ return palette.primary[scheme];
28
+ case "code-review":
29
+ return withAlpha(palette.primary[scheme], 0.7);
30
+ case "done":
31
+ case "active":
32
+ return palette.success[scheme];
33
+ case "cancelled":
34
+ return withAlpha(tokens.color.muted[scheme], 0.4);
35
+ case "critical":
36
+ return palette.danger[scheme];
37
+ case "info":
38
+ return INFO[scheme];
39
+ default:
40
+ return withAlpha(tokens.color.muted[scheme], 0.6);
41
+ }
42
+ }
43
+
44
+ /** Small coloured dot that carries a status, so the label beside it stays neutral text. Hidden from assistive tech. */
45
+ export function StatusDot(t0) {
46
+ const $ = _c(22);
47
+ let className;
48
+ let props;
49
+ let style;
50
+ let t1;
51
+ let tone;
52
+ if ($[0] !== t0) {
53
+ ({
54
+ tone,
55
+ size: t1,
56
+ className,
57
+ style,
58
+ ...props
59
+ } = t0);
60
+ $[0] = t0;
61
+ $[1] = className;
62
+ $[2] = props;
63
+ $[3] = style;
64
+ $[4] = t1;
65
+ $[5] = tone;
66
+ } else {
67
+ className = $[1];
68
+ props = $[2];
69
+ style = $[3];
70
+ t1 = $[4];
71
+ tone = $[5];
72
+ }
73
+ const size = t1 === undefined ? "sm" : t1;
74
+ const scheme = useScheme();
75
+ const diameter = size === "md" ? 8 : 6;
76
+ let t2;
77
+ if ($[6] !== className) {
78
+ t2 = cn("shrink-0", className);
79
+ $[6] = className;
80
+ $[7] = t2;
81
+ } else {
82
+ t2 = $[7];
83
+ }
84
+ const t3 = diameter / 2;
85
+ let t4;
86
+ if ($[8] !== scheme || $[9] !== tone) {
87
+ t4 = toneColor(tone, scheme);
88
+ $[8] = scheme;
89
+ $[9] = tone;
90
+ $[10] = t4;
91
+ } else {
92
+ t4 = $[10];
93
+ }
94
+ let t5;
95
+ if ($[11] !== diameter || $[12] !== t3 || $[13] !== t4) {
96
+ t5 = {
97
+ width: diameter,
98
+ height: diameter,
99
+ borderRadius: t3,
100
+ backgroundColor: t4
101
+ };
102
+ $[11] = diameter;
103
+ $[12] = t3;
104
+ $[13] = t4;
105
+ $[14] = t5;
106
+ } else {
107
+ t5 = $[14];
108
+ }
109
+ let t6;
110
+ if ($[15] !== style || $[16] !== t5) {
111
+ t6 = [t5, style];
112
+ $[15] = style;
113
+ $[16] = t5;
114
+ $[17] = t6;
115
+ } else {
116
+ t6 = $[17];
117
+ }
118
+ let t7;
119
+ if ($[18] !== props || $[19] !== t2 || $[20] !== t6) {
120
+ t7 = <View accessibilityElementsHidden={true} importantForAccessibility="no-hide-descendants" className={t2} style={t6} {...props} />;
121
+ $[18] = props;
122
+ $[19] = t2;
123
+ $[20] = t6;
124
+ $[21] = t7;
125
+ } else {
126
+ t7 = $[21];
127
+ }
128
+ return t7;
129
+ }
@@ -0,0 +1,143 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Pressable, View } from "react-native";
3
+ import { impactHaptic } from "./haptics";
4
+ import { tokens } from "./tokens";
5
+ import { useScheme } from "./useScheme";
6
+
7
+ /** The web `ListRow` metrics: a 4 wide stripe 8 in from top and bottom, the surface radius. */
8
+ export const SURFACE_ROW = {
9
+ accentWidth: 4,
10
+ accentInset: 8,
11
+ radius: tokens.radius.lg
12
+ };
13
+ /**
14
+ * The shell of a status list row, as the web `ListRow`: a card surface with
15
+ * the surface radius, a 4 wide status stripe on the leading edge (inset 8 top
16
+ * and bottom, rounded on its outer side) and the body over it. The whole row
17
+ * is one button that fades while pressed, so put no other control in it; a
18
+ * long press (`onLongPress`) can open its menu.
19
+ */
20
+ export function SurfaceRow(t0) {
21
+ const $ = _c(30);
22
+ const {
23
+ children,
24
+ accentColor,
25
+ backgroundColor,
26
+ borderColor,
27
+ accessibilityLabel,
28
+ accessibilityHint,
29
+ onPress,
30
+ onLongPress,
31
+ longPressLabel: t1,
32
+ className,
33
+ testID
34
+ } = t0;
35
+ const longPressLabel = t1 === undefined ? "More actions" : t1;
36
+ const scheme = useScheme();
37
+ const t2 = backgroundColor ?? tokens.color.surface[scheme];
38
+ const t3 = borderColor ? 1 : 0;
39
+ let t4;
40
+ if ($[0] !== borderColor || $[1] !== t2 || $[2] !== t3) {
41
+ t4 = {
42
+ backgroundColor: t2,
43
+ borderRadius: SURFACE_ROW.radius,
44
+ borderWidth: t3,
45
+ borderColor
46
+ };
47
+ $[0] = borderColor;
48
+ $[1] = t2;
49
+ $[2] = t3;
50
+ $[3] = t4;
51
+ } else {
52
+ t4 = $[3];
53
+ }
54
+ const style = t4;
55
+ let t5;
56
+ if ($[4] !== accentColor || $[5] !== testID) {
57
+ t5 = accentColor ? <View testID={testID ? `${testID}-accent` : undefined} className="absolute left-0" style={{
58
+ top: SURFACE_ROW.accentInset,
59
+ bottom: SURFACE_ROW.accentInset,
60
+ width: SURFACE_ROW.accentWidth,
61
+ backgroundColor: accentColor,
62
+ borderTopRightRadius: SURFACE_ROW.accentWidth,
63
+ borderBottomRightRadius: SURFACE_ROW.accentWidth
64
+ }} /> : null;
65
+ $[4] = accentColor;
66
+ $[5] = testID;
67
+ $[6] = t5;
68
+ } else {
69
+ t5 = $[6];
70
+ }
71
+ const t6 = className ?? "p-2.5 pl-3";
72
+ let t7;
73
+ if ($[7] !== children || $[8] !== t6) {
74
+ t7 = <View className={t6}>{children}</View>;
75
+ $[7] = children;
76
+ $[8] = t6;
77
+ $[9] = t7;
78
+ } else {
79
+ t7 = $[9];
80
+ }
81
+ let t8;
82
+ if ($[10] !== t5 || $[11] !== t7) {
83
+ t8 = <>{t5}{t7}</>;
84
+ $[10] = t5;
85
+ $[11] = t7;
86
+ $[12] = t8;
87
+ } else {
88
+ t8 = $[12];
89
+ }
90
+ const body = t8;
91
+ let t9;
92
+ if ($[13] !== onLongPress) {
93
+ t9 = onLongPress ? () => {
94
+ impactHaptic("light");
95
+ onLongPress();
96
+ } : undefined;
97
+ $[13] = onLongPress;
98
+ $[14] = t9;
99
+ } else {
100
+ t9 = $[14];
101
+ }
102
+ let t10;
103
+ if ($[15] !== longPressLabel || $[16] !== onLongPress) {
104
+ t10 = onLongPress ? [{
105
+ name: "longpress",
106
+ label: longPressLabel
107
+ }] : undefined;
108
+ $[15] = longPressLabel;
109
+ $[16] = onLongPress;
110
+ $[17] = t10;
111
+ } else {
112
+ t10 = $[17];
113
+ }
114
+ let t11;
115
+ if ($[18] !== onLongPress) {
116
+ t11 = event => {
117
+ if (event.nativeEvent.actionName === "longpress") {
118
+ onLongPress?.();
119
+ }
120
+ };
121
+ $[18] = onLongPress;
122
+ $[19] = t11;
123
+ } else {
124
+ t11 = $[19];
125
+ }
126
+ let t12;
127
+ if ($[20] !== accessibilityHint || $[21] !== accessibilityLabel || $[22] !== body || $[23] !== onPress || $[24] !== style || $[25] !== t10 || $[26] !== t11 || $[27] !== t9 || $[28] !== testID) {
128
+ t12 = <Pressable testID={testID} accessibilityRole="button" accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint} onPress={onPress} onLongPress={t9} accessibilityActions={t10} onAccessibilityAction={t11} className="overflow-hidden active:opacity-80" style={style}>{body}</Pressable>;
129
+ $[20] = accessibilityHint;
130
+ $[21] = accessibilityLabel;
131
+ $[22] = body;
132
+ $[23] = onPress;
133
+ $[24] = style;
134
+ $[25] = t10;
135
+ $[26] = t11;
136
+ $[27] = t9;
137
+ $[28] = testID;
138
+ $[29] = t12;
139
+ } else {
140
+ t12 = $[29];
141
+ }
142
+ return t12;
143
+ }
@@ -0,0 +1,50 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { createContext, useContext } from "react";
3
+ /**
4
+ * The Gesture Handler row, from `@vvedantb/native-ui/gesture-handler`
5
+ * (`GestureHandlerProvider`). A context, so only that entry imports
6
+ * `react-native-gesture-handler`.
7
+ */
8
+ export const SwipeRowGestureContext = createContext(null);
9
+
10
+ /**
11
+ * A list row that a horizontal swipe moves aside, to reveal its actions
12
+ * behind it, as the iOS and Android mail apps. The row follows the finger
13
+ * 1:1 and springs on at the finger's speed when it lifts: past half its
14
+ * buttons it stays open; a full swipe (half the row, with a light haptic as
15
+ * it arms) runs the first action, and an action that `exits` slides the row
16
+ * out. Toward a side with no actions it gives a little, with resistance. A
17
+ * vertical drag scrolls the list first. One row is open at a time: another
18
+ * row opening, a tap on any row, or `closeSwipeRows` (pass it to the list's
19
+ * `onScrollBeginDrag`) closes it. With Reduce Motion on it still follows the
20
+ * finger, and the release settles at once.
21
+ *
22
+ * The swipe needs `GestureHandlerProvider`; without it the row is drawn as
23
+ * is, with no swipe. Either way, spread `swipeActionsAccessibility(actions)`
24
+ * on the row's main pressable, so screen reader users get the same actions.
25
+ */
26
+ export function SwipeableRow(props) {
27
+ const $ = _c(5);
28
+ const GestureRow = useContext(SwipeRowGestureContext);
29
+ if (!GestureRow) {
30
+ let t0;
31
+ if ($[0] !== props.children) {
32
+ t0 = <>{props.children}</>;
33
+ $[0] = props.children;
34
+ $[1] = t0;
35
+ } else {
36
+ t0 = $[1];
37
+ }
38
+ return t0;
39
+ }
40
+ let t0;
41
+ if ($[2] !== GestureRow || $[3] !== props) {
42
+ t0 = <GestureRow {...props} />;
43
+ $[2] = GestureRow;
44
+ $[3] = props;
45
+ $[4] = t0;
46
+ } else {
47
+ t0 = $[4];
48
+ }
49
+ return t0;
50
+ }
@@ -0,0 +1,130 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import * as React from "react";
3
+ import { Switch as PrimitiveSwitch } from "./primitives/switch";
4
+ import { cn } from "./cn";
5
+ import { switchColors, switchSize, touchSlop } from "./controlStyles";
6
+ import { useLargerText } from "./theme";
7
+ import { useScheme } from "./useScheme";
8
+ const Switch = React.forwardRef((t0, ref) => {
9
+ const $ = _c(34);
10
+ let checked;
11
+ let offColor;
12
+ let onCheckedChange;
13
+ let onColor;
14
+ let onValueChange;
15
+ let props;
16
+ let sizeName;
17
+ let value;
18
+ if ($[0] !== t0) {
19
+ ({
20
+ value,
21
+ checked,
22
+ onValueChange,
23
+ onCheckedChange,
24
+ onColor,
25
+ offColor,
26
+ size: sizeName,
27
+ ...props
28
+ } = t0);
29
+ $[0] = t0;
30
+ $[1] = checked;
31
+ $[2] = offColor;
32
+ $[3] = onCheckedChange;
33
+ $[4] = onColor;
34
+ $[5] = onValueChange;
35
+ $[6] = props;
36
+ $[7] = sizeName;
37
+ $[8] = value;
38
+ } else {
39
+ checked = $[1];
40
+ offColor = $[2];
41
+ onCheckedChange = $[3];
42
+ onColor = $[4];
43
+ onValueChange = $[5];
44
+ props = $[6];
45
+ sizeName = $[7];
46
+ value = $[8];
47
+ }
48
+ const resolvedValue = checked ?? value ?? false;
49
+ const t1 = useScheme();
50
+ let t2;
51
+ if ($[9] !== resolvedValue || $[10] !== t1) {
52
+ t2 = switchColors(resolvedValue, t1);
53
+ $[9] = resolvedValue;
54
+ $[10] = t1;
55
+ $[11] = t2;
56
+ } else {
57
+ t2 = $[11];
58
+ }
59
+ const colors = t2;
60
+ const trackColor = resolvedValue ? onColor : offColor;
61
+ const size = switchSize(useLargerText(), sizeName);
62
+ let t3;
63
+ if ($[12] !== onCheckedChange || $[13] !== onValueChange) {
64
+ t3 = nextValue => {
65
+ onCheckedChange?.(nextValue);
66
+ onValueChange?.(nextValue);
67
+ };
68
+ $[12] = onCheckedChange;
69
+ $[13] = onValueChange;
70
+ $[14] = t3;
71
+ } else {
72
+ t3 = $[14];
73
+ }
74
+ const handleCheckedChange = t3;
75
+ const T0 = PrimitiveSwitch;
76
+ const t4 = touchSlop(size.width, size.height);
77
+ const t5 = "switch";
78
+ const t6 = cn(size.track, "justify-center");
79
+ let t7;
80
+ if ($[15] !== colors.track || $[16] !== trackColor) {
81
+ t7 = trackColor ? {
82
+ backgroundColor: trackColor,
83
+ borderColor: trackColor
84
+ } : colors.track;
85
+ $[15] = colors.track;
86
+ $[16] = trackColor;
87
+ $[17] = t7;
88
+ } else {
89
+ t7 = $[17];
90
+ }
91
+ const t8 = colors.thumb;
92
+ const t9 = cn(size.thumb, resolvedValue ? size.on : size.off);
93
+ const t10 = props.accessibilityState;
94
+ const t11 = Boolean(props.disabled);
95
+ let t12;
96
+ if ($[18] !== props.accessibilityState || $[19] !== resolvedValue || $[20] !== t11) {
97
+ t12 = {
98
+ ...t10,
99
+ checked: resolvedValue,
100
+ disabled: t11
101
+ };
102
+ $[18] = props.accessibilityState;
103
+ $[19] = resolvedValue;
104
+ $[20] = t11;
105
+ $[21] = t12;
106
+ } else {
107
+ t12 = $[21];
108
+ }
109
+ let t13;
110
+ if ($[22] !== T0 || $[23] !== colors.thumb || $[24] !== handleCheckedChange || $[25] !== props || $[26] !== ref || $[27] !== resolvedValue || $[28] !== t12 || $[29] !== t4 || $[30] !== t6 || $[31] !== t7 || $[32] !== t9) {
111
+ t13 = <T0 ref={ref} checked={resolvedValue} onCheckedChange={handleCheckedChange} hitSlop={t4} accessibilityRole={t5} className={t6} trackStyle={t7} thumbStyle={t8} thumbClassName={t9} {...props} accessibilityState={t12} />;
112
+ $[22] = T0;
113
+ $[23] = colors.thumb;
114
+ $[24] = handleCheckedChange;
115
+ $[25] = props;
116
+ $[26] = ref;
117
+ $[27] = resolvedValue;
118
+ $[28] = t12;
119
+ $[29] = t4;
120
+ $[30] = t6;
121
+ $[31] = t7;
122
+ $[32] = t9;
123
+ $[33] = t13;
124
+ } else {
125
+ t13 = $[33];
126
+ }
127
+ return t13;
128
+ });
129
+ Switch.displayName = "Switch";
130
+ export { Switch };