@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,117 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { RefreshControl, ScrollView, View } from "react-native";
3
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
4
+ import { useAccentColor, useLargerText } from "./theme";
5
+ import { tabBarReserve } from "./floating";
6
+ export function ScreenContainer(t0) {
7
+ const $ = _c(31);
8
+ let children;
9
+ let footer;
10
+ let onRefresh;
11
+ let props;
12
+ let refreshControl;
13
+ let t1;
14
+ let t2;
15
+ if ($[0] !== t0) {
16
+ ({
17
+ children,
18
+ reserveTabBar: t1,
19
+ footer,
20
+ refreshing: t2,
21
+ onRefresh,
22
+ refreshControl,
23
+ ...props
24
+ } = t0);
25
+ $[0] = t0;
26
+ $[1] = children;
27
+ $[2] = footer;
28
+ $[3] = onRefresh;
29
+ $[4] = props;
30
+ $[5] = refreshControl;
31
+ $[6] = t1;
32
+ $[7] = t2;
33
+ } else {
34
+ children = $[1];
35
+ footer = $[2];
36
+ onRefresh = $[3];
37
+ props = $[4];
38
+ refreshControl = $[5];
39
+ t1 = $[6];
40
+ t2 = $[7];
41
+ }
42
+ const reserveTabBar = t1 === undefined ? false : t1;
43
+ const refreshing = t2 === undefined ? false : t2;
44
+ const insets = useSafeAreaInsets();
45
+ const largerText = useLargerText();
46
+ const accent = useAccentColor();
47
+ let t3;
48
+ if ($[8] !== insets || $[9] !== largerText || $[10] !== reserveTabBar) {
49
+ t3 = reserveTabBar ? tabBarReserve(largerText, insets.bottom) : 40;
50
+ $[8] = insets;
51
+ $[9] = largerText;
52
+ $[10] = reserveTabBar;
53
+ $[11] = t3;
54
+ } else {
55
+ t3 = $[11];
56
+ }
57
+ const bottomPad = t3;
58
+ let t4;
59
+ if ($[12] !== accent || $[13] !== onRefresh || $[14] !== refreshControl || $[15] !== refreshing) {
60
+ t4 = refreshControl ?? (onRefresh ? <RefreshControl refreshing={refreshing} onRefresh={() => void onRefresh()} tintColor={accent} colors={[accent]} /> : undefined);
61
+ $[12] = accent;
62
+ $[13] = onRefresh;
63
+ $[14] = refreshControl;
64
+ $[15] = refreshing;
65
+ $[16] = t4;
66
+ } else {
67
+ t4 = $[16];
68
+ }
69
+ const control = t4;
70
+ let t5;
71
+ if ($[17] !== bottomPad) {
72
+ t5 = {
73
+ paddingBottom: bottomPad
74
+ };
75
+ $[17] = bottomPad;
76
+ $[18] = t5;
77
+ } else {
78
+ t5 = $[18];
79
+ }
80
+ let t6;
81
+ if ($[19] !== children) {
82
+ t6 = <View className="flex-col gap-4 p-4">{children}</View>;
83
+ $[19] = children;
84
+ $[20] = t6;
85
+ } else {
86
+ t6 = $[20];
87
+ }
88
+ let t7;
89
+ if ($[21] !== footer) {
90
+ t7 = footer ? <View className="pt-4">{footer}</View> : null;
91
+ $[21] = footer;
92
+ $[22] = t7;
93
+ } else {
94
+ t7 = $[22];
95
+ }
96
+ let t8;
97
+ if ($[23] !== control || $[24] !== t5 || $[25] !== t6 || $[26] !== t7) {
98
+ t8 = <ScrollView showsVerticalScrollIndicator={false} className="flex-1" contentContainerStyle={t5} refreshControl={control}>{t6}{t7}</ScrollView>;
99
+ $[23] = control;
100
+ $[24] = t5;
101
+ $[25] = t6;
102
+ $[26] = t7;
103
+ $[27] = t8;
104
+ } else {
105
+ t8 = $[27];
106
+ }
107
+ let t9;
108
+ if ($[28] !== props || $[29] !== t8) {
109
+ t9 = <View className="flex-1 bg-transparent" {...props}>{t8}</View>;
110
+ $[28] = props;
111
+ $[29] = t8;
112
+ $[30] = t9;
113
+ } else {
114
+ t9 = $[30];
115
+ }
116
+ return t9;
117
+ }
@@ -0,0 +1,150 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import * as React from "react";
3
+ import { Pressable, useWindowDimensions, View } from "react-native";
4
+ import { IconSearch, IconX } from "@tabler/icons-react-native";
5
+ import { Input as PrimitiveInput } from "./primitives/input";
6
+ import { cn } from "./cn";
7
+ import { fieldStyle, fieldTextStyle, scaledFieldHeight, searchInputSize, sizeStyle, touchSlop, typeStyle } from "./controlStyles";
8
+ import { palette } from "./palette";
9
+ import { tokens } from "./tokens";
10
+ import { useLargerText } from "./theme";
11
+ import { useScheme } from "./useScheme";
12
+ /** The web change rule: `onChange`, then `onClear` whenever the value becomes empty. */
13
+ export function searchChange(onChange, onClear) {
14
+ return next => {
15
+ onChange(next);
16
+ if (onClear && next.length === 0) onClear();
17
+ };
18
+ }
19
+
20
+ /**
21
+ * Search field, the web `SearchInput`: a 16 search icon at the start and,
22
+ * while there is text, a clear button (a 14 cross labelled "Clear search") at
23
+ * the end. Controlled with `value` and `onChange(text)`, as on the web. The
24
+ * field has the `Input` look (`fieldStyle`) at the web sizes from
25
+ * `searchInputSize`. The clear button is painted at the web 24 and reaches 44
26
+ * with its hit slop (`touchSlop`). It clears at once and leaves focus where it
27
+ * was, as the default web clear does after its dissolve. It is hidden when the
28
+ * field is not editable. Inside a `ScrollView`, set
29
+ * `keyboardShouldPersistTaps="handled"` so the first tap clears while the
30
+ * keyboard is up. The web `shortcut` hint and `toolbar` variant are not ported.
31
+ */
32
+ const SearchInput = React.forwardRef((t0, ref) => {
33
+ const $ = _c(33);
34
+ let className;
35
+ let onChange;
36
+ let onClear;
37
+ let placeholder;
38
+ let placeholderTextColor;
39
+ let props;
40
+ let style;
41
+ let t1;
42
+ let t2;
43
+ let t3;
44
+ let value;
45
+ let wrapperClassName;
46
+ if ($[0] !== t0) {
47
+ ({
48
+ value,
49
+ onChange,
50
+ label: t1,
51
+ placeholder,
52
+ size: t2,
53
+ onClear,
54
+ clearLabel: t3,
55
+ className,
56
+ wrapperClassName,
57
+ placeholderTextColor,
58
+ style,
59
+ ...props
60
+ } = t0);
61
+ $[0] = t0;
62
+ $[1] = className;
63
+ $[2] = onChange;
64
+ $[3] = onClear;
65
+ $[4] = placeholder;
66
+ $[5] = placeholderTextColor;
67
+ $[6] = props;
68
+ $[7] = style;
69
+ $[8] = t1;
70
+ $[9] = t2;
71
+ $[10] = t3;
72
+ $[11] = value;
73
+ $[12] = wrapperClassName;
74
+ } else {
75
+ className = $[1];
76
+ onChange = $[2];
77
+ onClear = $[3];
78
+ placeholder = $[4];
79
+ placeholderTextColor = $[5];
80
+ props = $[6];
81
+ style = $[7];
82
+ t1 = $[8];
83
+ t2 = $[9];
84
+ t3 = $[10];
85
+ value = $[11];
86
+ wrapperClassName = $[12];
87
+ }
88
+ const label = t1 === undefined ? "Search" : t1;
89
+ const size = t2 === undefined ? "sm" : t2;
90
+ const clearLabel = t3 === undefined ? "Clear search" : t3;
91
+ const largerText = useLargerText();
92
+ const scheme = useScheme();
93
+ const {
94
+ fontScale
95
+ } = useWindowDimensions();
96
+ let t4;
97
+ if ($[13] !== className || $[14] !== clearLabel || $[15] !== fontScale || $[16] !== label || $[17] !== largerText || $[18] !== onChange || $[19] !== onClear || $[20] !== placeholder || $[21] !== placeholderTextColor || $[22] !== props || $[23] !== ref || $[24] !== scheme || $[25] !== size || $[26] !== style || $[27] !== value || $[28] !== wrapperClassName) {
98
+ const metrics = searchInputSize(size, largerText);
99
+ let t5;
100
+ if ($[30] !== onChange || $[31] !== onClear) {
101
+ t5 = searchChange(onChange, onClear);
102
+ $[30] = onChange;
103
+ $[31] = onClear;
104
+ $[32] = t5;
105
+ } else {
106
+ t5 = $[32];
107
+ }
108
+ const change = t5;
109
+ const filled = value.length > 0;
110
+ const muted = tokens.color.muted[scheme];
111
+ t4 = <View className={wrapperClassName}><PrimitiveInput ref={ref} value={value} onChangeText={change} accessibilityLabel={label} placeholder={placeholder ?? label} placeholderTextColor={placeholderTextColor ?? palette.fieldPlaceholder[scheme]} returnKeyType="search" className={cn("border font-instrument-sans", metrics.text, largerText && "font-instrument-sans-medium", className)} style={[fieldStyle(scheme), fieldTextStyle(scheme), {
112
+ minHeight: metrics.minHeight,
113
+ height: scaledFieldHeight(metrics.height, fontScale),
114
+ paddingTop: metrics.paddingY,
115
+ paddingBottom: metrics.paddingY,
116
+ paddingLeft: metrics.paddingLeft,
117
+ paddingRight: filled ? metrics.filledPaddingRight : metrics.paddingRight,
118
+ fontSize: sizeStyle(metrics.text).fontSize
119
+ }, largerText ? typeStyle("medium") : null, style]} {...props} /><View pointerEvents="none" className="absolute bottom-0 top-0 justify-center" style={{
120
+ left: metrics.iconLeft
121
+ }}><IconSearch size={metrics.icon} color={muted} /></View>{filled && props.editable !== false ? <View pointerEvents="box-none" className="absolute bottom-0 top-0 justify-center" style={{
122
+ right: metrics.clearRight
123
+ }}><Pressable testID="search-input-clear" accessibilityRole="button" accessibilityLabel={clearLabel} hitSlop={touchSlop(metrics.clear)} onPress={() => change("")} className="items-center justify-center rounded-md active:opacity-70" style={{
124
+ width: metrics.clear,
125
+ height: metrics.clear
126
+ }}><IconX size={metrics.clearIcon} color={muted} strokeWidth={1.75} /></Pressable></View> : null}</View>;
127
+ $[13] = className;
128
+ $[14] = clearLabel;
129
+ $[15] = fontScale;
130
+ $[16] = label;
131
+ $[17] = largerText;
132
+ $[18] = onChange;
133
+ $[19] = onClear;
134
+ $[20] = placeholder;
135
+ $[21] = placeholderTextColor;
136
+ $[22] = props;
137
+ $[23] = ref;
138
+ $[24] = scheme;
139
+ $[25] = size;
140
+ $[26] = style;
141
+ $[27] = value;
142
+ $[28] = wrapperClassName;
143
+ $[29] = t4;
144
+ } else {
145
+ t4 = $[29];
146
+ }
147
+ return t4;
148
+ });
149
+ SearchInput.displayName = "SearchInput";
150
+ export { SearchInput };
@@ -0,0 +1,128 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Text } from "react-native";
3
+ import { cn } from "./cn";
4
+ import { sizeStyle, textStyle, typeStyle } from "./controlStyles";
5
+ import { useLargerText } from "./theme";
6
+ import { useScheme } from "./useScheme";
7
+ /** Letter spacing in em: slightly open, or the web `tracking-widest` (0.1em) in capitals. */
8
+ const TRACKING = {
9
+ regular: 0.02,
10
+ uppercase: 0.1
11
+ };
12
+
13
+ /**
14
+ * The quiet label above a group of rows ("Today", "Library"), in the spirit of
15
+ * the web `sidebarSectionLabelClass`: `text-xs` medium (12 / 500), muted, with
16
+ * slightly open letter spacing. The web label is muted at 55% (2.1:1 on the
17
+ * light page); this one is the full muted colour (4.4:1). A header for
18
+ * VoiceOver and TalkBack. No side padding: pass `className="px-4"` to line it
19
+ * up with `ListRow` text. `SettingsSection` titles are the larger heading.
20
+ */
21
+ export function SectionLabel(t0) {
22
+ const $ = _c(27);
23
+ let className;
24
+ let props;
25
+ let style;
26
+ let t1;
27
+ if ($[0] !== t0) {
28
+ ({
29
+ className,
30
+ uppercase: t1,
31
+ style,
32
+ ...props
33
+ } = t0);
34
+ $[0] = t0;
35
+ $[1] = className;
36
+ $[2] = props;
37
+ $[3] = style;
38
+ $[4] = t1;
39
+ } else {
40
+ className = $[1];
41
+ props = $[2];
42
+ style = $[3];
43
+ t1 = $[4];
44
+ }
45
+ const uppercase = t1 === undefined ? false : t1;
46
+ const scheme = useScheme();
47
+ const largerText = useLargerText();
48
+ const size = largerText ? "text-base" : "text-xs";
49
+ let t2;
50
+ if ($[5] !== size) {
51
+ t2 = sizeStyle(size);
52
+ $[5] = size;
53
+ $[6] = t2;
54
+ } else {
55
+ t2 = $[6];
56
+ }
57
+ const {
58
+ fontSize
59
+ } = t2;
60
+ let t3;
61
+ if ($[7] !== className || $[8] !== size) {
62
+ t3 = cn("font-instrument-sans-medium", size, className);
63
+ $[7] = className;
64
+ $[8] = size;
65
+ $[9] = t3;
66
+ } else {
67
+ t3 = $[9];
68
+ }
69
+ let t4;
70
+ if ($[10] !== scheme) {
71
+ t4 = textStyle("muted", scheme);
72
+ $[10] = scheme;
73
+ $[11] = t4;
74
+ } else {
75
+ t4 = $[11];
76
+ }
77
+ let t5;
78
+ if ($[12] !== size) {
79
+ t5 = sizeStyle(size);
80
+ $[12] = size;
81
+ $[13] = t5;
82
+ } else {
83
+ t5 = $[13];
84
+ }
85
+ let t6;
86
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
87
+ t6 = typeStyle("medium");
88
+ $[14] = t6;
89
+ } else {
90
+ t6 = $[14];
91
+ }
92
+ const t7 = fontSize * TRACKING[uppercase ? "uppercase" : "regular"];
93
+ const t8 = uppercase ? "uppercase" : "none";
94
+ let t9;
95
+ if ($[15] !== t7 || $[16] !== t8) {
96
+ t9 = {
97
+ letterSpacing: t7,
98
+ textTransform: t8
99
+ };
100
+ $[15] = t7;
101
+ $[16] = t8;
102
+ $[17] = t9;
103
+ } else {
104
+ t9 = $[17];
105
+ }
106
+ let t10;
107
+ if ($[18] !== style || $[19] !== t4 || $[20] !== t5 || $[21] !== t9) {
108
+ t10 = [t4, t5, t6, t9, style];
109
+ $[18] = style;
110
+ $[19] = t4;
111
+ $[20] = t5;
112
+ $[21] = t9;
113
+ $[22] = t10;
114
+ } else {
115
+ t10 = $[22];
116
+ }
117
+ let t11;
118
+ if ($[23] !== props || $[24] !== t10 || $[25] !== t3) {
119
+ t11 = <Text accessibilityRole="header" className={t3} style={t10} {...props} />;
120
+ $[23] = props;
121
+ $[24] = t10;
122
+ $[25] = t3;
123
+ $[26] = t11;
124
+ } else {
125
+ t11 = $[26];
126
+ }
127
+ return t11;
128
+ }
@@ -0,0 +1,223 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import * as React from "react";
3
+ import { Platform } from "react-native";
4
+ import { NativeSelectScrollView, Select as PrimitiveSelect, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "./primitives/select";
5
+ import { cn } from "./cn";
6
+ import { MIN_TOUCH_TARGET, fieldStyle, fieldTextStyle, touchSlop, typeStyle } from "./controlStyles";
7
+ import { palette } from "./palette";
8
+ import { selectItemA11yProps } from "./selectA11y";
9
+ import { useLargerText } from "./theme";
10
+ import { useScheme } from "./useScheme";
11
+ const NULL_SENTINEL = "__null__";
12
+ function toPrimitiveValue(value, options) {
13
+ if (value === undefined || value === "") {
14
+ return undefined;
15
+ }
16
+ const expectedValue = value === null ? NULL_SENTINEL : String(value);
17
+ const option = options.find(item => String(item.value ?? NULL_SENTINEL) === expectedValue);
18
+ if (!option) return undefined;
19
+ return {
20
+ label: option.label,
21
+ value: String(option.value ?? NULL_SENTINEL)
22
+ };
23
+ }
24
+ function Select(t0) {
25
+ const $ = _c(54);
26
+ const {
27
+ value,
28
+ onValueChange,
29
+ options,
30
+ placeholder,
31
+ disabled,
32
+ className,
33
+ triggerClassName,
34
+ contentClassName,
35
+ testID,
36
+ accessibilityLabel
37
+ } = t0;
38
+ const largerText = useLargerText();
39
+ const scheme = useScheme();
40
+ let t1;
41
+ if ($[0] !== options || $[1] !== value) {
42
+ t1 = toPrimitiveValue(value, options);
43
+ $[0] = options;
44
+ $[1] = value;
45
+ $[2] = t1;
46
+ } else {
47
+ t1 = $[2];
48
+ }
49
+ const primitiveValue = t1;
50
+ let t2;
51
+ if ($[3] !== onValueChange || $[4] !== options) {
52
+ t2 = nextOption => {
53
+ if (!nextOption) {
54
+ return;
55
+ }
56
+ const selectedValue = nextOption.value === NULL_SENTINEL ? null : nextOption.value;
57
+ const match = options.find(option => String(option.value ?? NULL_SENTINEL) === String(selectedValue));
58
+ if (match) {
59
+ onValueChange(match.value);
60
+ }
61
+ };
62
+ $[3] = onValueChange;
63
+ $[4] = options;
64
+ $[5] = t2;
65
+ } else {
66
+ t2 = $[5];
67
+ }
68
+ const t3 = Boolean(disabled);
69
+ let t4;
70
+ if ($[6] !== t3) {
71
+ t4 = {
72
+ disabled: t3
73
+ };
74
+ $[6] = t3;
75
+ $[7] = t4;
76
+ } else {
77
+ t4 = $[7];
78
+ }
79
+ const t5 = largerText ? 64 : 44;
80
+ let t6;
81
+ if ($[8] !== t5) {
82
+ t6 = touchSlop(MIN_TOUCH_TARGET, t5);
83
+ $[8] = t5;
84
+ $[9] = t6;
85
+ } else {
86
+ t6 = $[9];
87
+ }
88
+ const t7 = largerText && "min-h-16 px-4";
89
+ let t8;
90
+ if ($[10] !== className || $[11] !== t7 || $[12] !== triggerClassName) {
91
+ t8 = cn("h-auto min-h-11 w-full border px-3.5 py-0 shadow-none", t7, triggerClassName, className);
92
+ $[10] = className;
93
+ $[11] = t7;
94
+ $[12] = triggerClassName;
95
+ $[13] = t8;
96
+ } else {
97
+ t8 = $[13];
98
+ }
99
+ let t9;
100
+ if ($[14] !== scheme) {
101
+ t9 = fieldStyle(scheme);
102
+ $[14] = scheme;
103
+ $[15] = t9;
104
+ } else {
105
+ t9 = $[15];
106
+ }
107
+ const t10 = placeholder ?? "Select option";
108
+ const t11 = largerText ? "font-instrument-sans-medium text-xl" : "font-instrument-sans text-base";
109
+ let t12;
110
+ if ($[16] !== primitiveValue || $[17] !== scheme) {
111
+ t12 = primitiveValue ? fieldTextStyle(scheme) : {
112
+ color: palette.fieldPlaceholder[scheme]
113
+ };
114
+ $[16] = primitiveValue;
115
+ $[17] = scheme;
116
+ $[18] = t12;
117
+ } else {
118
+ t12 = $[18];
119
+ }
120
+ let t13;
121
+ if ($[19] !== largerText) {
122
+ t13 = largerText ? typeStyle("medium") : null;
123
+ $[19] = largerText;
124
+ $[20] = t13;
125
+ } else {
126
+ t13 = $[20];
127
+ }
128
+ let t14;
129
+ if ($[21] !== t12 || $[22] !== t13) {
130
+ t14 = [t12, t13];
131
+ $[21] = t12;
132
+ $[22] = t13;
133
+ $[23] = t14;
134
+ } else {
135
+ t14 = $[23];
136
+ }
137
+ let t15;
138
+ if ($[24] !== t10 || $[25] !== t11 || $[26] !== t14) {
139
+ t15 = <SelectValue placeholder={t10} className={t11} style={t14} />;
140
+ $[24] = t10;
141
+ $[25] = t11;
142
+ $[26] = t14;
143
+ $[27] = t15;
144
+ } else {
145
+ t15 = $[27];
146
+ }
147
+ let t16;
148
+ if ($[28] !== accessibilityLabel || $[29] !== t15 || $[30] !== t4 || $[31] !== t6 || $[32] !== t8 || $[33] !== t9 || $[34] !== testID) {
149
+ t16 = <SelectTrigger testID={testID} accessibilityRole="combobox" accessibilityLabel={accessibilityLabel} accessibilityState={t4} hitSlop={t6} className={t8} style={t9}>{t15}</SelectTrigger>;
150
+ $[28] = accessibilityLabel;
151
+ $[29] = t15;
152
+ $[30] = t4;
153
+ $[31] = t6;
154
+ $[32] = t8;
155
+ $[33] = t9;
156
+ $[34] = testID;
157
+ $[35] = t16;
158
+ } else {
159
+ t16 = $[35];
160
+ }
161
+ let t17;
162
+ if ($[36] !== contentClassName) {
163
+ t17 = cn("w-full", contentClassName);
164
+ $[36] = contentClassName;
165
+ $[37] = t17;
166
+ } else {
167
+ t17 = $[37];
168
+ }
169
+ let t18;
170
+ if ($[38] !== options || $[39] !== testID) {
171
+ let t19;
172
+ if ($[41] !== testID) {
173
+ t19 = option_0 => {
174
+ const optionId = testID ? `${testID}-${String(option_0.value ?? "null")}` : undefined;
175
+ return <SelectItem key={`${String(option_0.value)}-${option_0.label}`} {...selectItemA11yProps({
176
+ label: option_0.label,
177
+ testID: optionId
178
+ }, Platform.OS)} label={option_0.label} value={String(option_0.value ?? NULL_SENTINEL)} />;
179
+ };
180
+ $[41] = testID;
181
+ $[42] = t19;
182
+ } else {
183
+ t19 = $[42];
184
+ }
185
+ t18 = options.map(t19);
186
+ $[38] = options;
187
+ $[39] = testID;
188
+ $[40] = t18;
189
+ } else {
190
+ t18 = $[40];
191
+ }
192
+ let t19;
193
+ if ($[43] !== t18) {
194
+ t19 = <NativeSelectScrollView><SelectGroup>{t18}</SelectGroup></NativeSelectScrollView>;
195
+ $[43] = t18;
196
+ $[44] = t19;
197
+ } else {
198
+ t19 = $[44];
199
+ }
200
+ let t20;
201
+ if ($[45] !== t17 || $[46] !== t19) {
202
+ t20 = <SelectContent className={t17}>{t19}</SelectContent>;
203
+ $[45] = t17;
204
+ $[46] = t19;
205
+ $[47] = t20;
206
+ } else {
207
+ t20 = $[47];
208
+ }
209
+ let t21;
210
+ if ($[48] !== disabled || $[49] !== primitiveValue || $[50] !== t16 || $[51] !== t2 || $[52] !== t20) {
211
+ t21 = <PrimitiveSelect value={primitiveValue} onValueChange={t2} disabled={disabled}>{t16}{t20}</PrimitiveSelect>;
212
+ $[48] = disabled;
213
+ $[49] = primitiveValue;
214
+ $[50] = t16;
215
+ $[51] = t2;
216
+ $[52] = t20;
217
+ $[53] = t21;
218
+ } else {
219
+ t21 = $[53];
220
+ }
221
+ return t21;
222
+ }
223
+ export { Select };
@@ -0,0 +1,95 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { StyleSheet, View } from "react-native";
3
+ import { cn } from "./cn";
4
+ import { tokens } from "./tokens";
5
+ import { useScheme } from "./useScheme";
6
+ /** Hairline in `tokens.color.separator`. Vertical separators stretch to the row height. */
7
+ export function Separator(t0) {
8
+ const $ = _c(22);
9
+ let className;
10
+ let props;
11
+ let style;
12
+ let t1;
13
+ let t2;
14
+ if ($[0] !== t0) {
15
+ ({
16
+ orientation: t1,
17
+ decorative: t2,
18
+ className,
19
+ style,
20
+ ...props
21
+ } = t0);
22
+ $[0] = t0;
23
+ $[1] = className;
24
+ $[2] = props;
25
+ $[3] = style;
26
+ $[4] = t1;
27
+ $[5] = t2;
28
+ } else {
29
+ className = $[1];
30
+ props = $[2];
31
+ style = $[3];
32
+ t1 = $[4];
33
+ t2 = $[5];
34
+ }
35
+ const orientation = t1 === undefined ? "horizontal" : t1;
36
+ const decorative = t2 === undefined ? true : t2;
37
+ const scheme = useScheme();
38
+ const t3 = decorative ? "no-hide-descendants" : "auto";
39
+ let t4;
40
+ if ($[6] !== className) {
41
+ t4 = cn("shrink-0", className);
42
+ $[6] = className;
43
+ $[7] = t4;
44
+ } else {
45
+ t4 = $[7];
46
+ }
47
+ let t5;
48
+ if ($[8] !== orientation) {
49
+ t5 = orientation === "horizontal" ? {
50
+ height: StyleSheet.hairlineWidth,
51
+ width: "100%"
52
+ } : {
53
+ width: StyleSheet.hairlineWidth,
54
+ alignSelf: "stretch"
55
+ };
56
+ $[8] = orientation;
57
+ $[9] = t5;
58
+ } else {
59
+ t5 = $[9];
60
+ }
61
+ const t6 = tokens.color.separator[scheme];
62
+ let t7;
63
+ if ($[10] !== t6) {
64
+ t7 = {
65
+ backgroundColor: t6
66
+ };
67
+ $[10] = t6;
68
+ $[11] = t7;
69
+ } else {
70
+ t7 = $[11];
71
+ }
72
+ let t8;
73
+ if ($[12] !== style || $[13] !== t5 || $[14] !== t7) {
74
+ t8 = [t5, t7, style];
75
+ $[12] = style;
76
+ $[13] = t5;
77
+ $[14] = t7;
78
+ $[15] = t8;
79
+ } else {
80
+ t8 = $[15];
81
+ }
82
+ let t9;
83
+ if ($[16] !== decorative || $[17] !== props || $[18] !== t3 || $[19] !== t4 || $[20] !== t8) {
84
+ t9 = <View accessibilityElementsHidden={decorative} importantForAccessibility={t3} className={t4} style={t8} {...props} />;
85
+ $[16] = decorative;
86
+ $[17] = props;
87
+ $[18] = t3;
88
+ $[19] = t4;
89
+ $[20] = t8;
90
+ $[21] = t9;
91
+ } else {
92
+ t9 = $[21];
93
+ }
94
+ return t9;
95
+ }