glacia-native 0.5.1 → 0.6.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 (403) hide show
  1. package/LICENSE +29 -4
  2. package/README.md +111 -17
  3. package/lib/module/Accordion.js +58 -0
  4. package/lib/module/ActionSheet.js +38 -0
  5. package/lib/module/Alert.js +23 -0
  6. package/lib/module/AlertDialog.js +47 -0
  7. package/lib/module/Avatar.js +48 -0
  8. package/lib/module/Badge.js +36 -0
  9. package/lib/module/Bars.js +13 -267
  10. package/lib/module/Button.js +57 -36
  11. package/lib/module/Card.js +32 -20
  12. package/lib/module/Checkbox.js +42 -0
  13. package/lib/module/Chip.js +80 -0
  14. package/lib/module/Collapsible.js +26 -0
  15. package/lib/module/ContextMenu.js +33 -0
  16. package/lib/module/Dialog.js +39 -124
  17. package/lib/module/DropdownMenu.js +33 -0
  18. package/lib/module/Field.js +22 -0
  19. package/lib/module/Glass.js +12 -5
  20. package/lib/module/Group.js +36 -0
  21. package/lib/module/IconButton.js +40 -0
  22. package/lib/module/Input.js +47 -40
  23. package/lib/module/Label.js +17 -0
  24. package/lib/module/MorphGroup.js +47 -0
  25. package/lib/module/Popover.js +29 -0
  26. package/lib/module/Progress.js +32 -0
  27. package/lib/module/RadioGroup.js +51 -0
  28. package/lib/module/Scrim.js +44 -0
  29. package/lib/module/SegmentedControl.js +74 -58
  30. package/lib/module/Select.js +51 -0
  31. package/lib/module/Separator.js +25 -0
  32. package/lib/module/Sheet.js +51 -0
  33. package/lib/module/Skeleton.js +48 -0
  34. package/lib/module/Slider.js +60 -40
  35. package/lib/module/Stepper.js +167 -0
  36. package/lib/module/Switch.js +45 -43
  37. package/lib/module/TabBar.js +62 -50
  38. package/lib/module/Tabs.js +3 -2
  39. package/lib/module/Textarea.js +18 -0
  40. package/lib/module/Toast.js +55 -0
  41. package/lib/module/Toggle.js +47 -0
  42. package/lib/module/ToggleGroup.js +56 -0
  43. package/lib/module/Toolbar.js +37 -0
  44. package/lib/module/Tooltip.js +31 -0
  45. package/lib/module/glass-provider.js +28 -0
  46. package/lib/module/glass-stack.js +61 -0
  47. package/lib/module/index.js +78 -109
  48. package/lib/module/internal/GlassBackdrop.js +36 -0
  49. package/lib/module/internal/GlassView.js +45 -13
  50. package/lib/module/internal/blur-community.js +20 -0
  51. package/lib/module/internal/blur-community.web.js +9 -0
  52. package/lib/module/internal/blur.js +75 -0
  53. package/lib/module/internal/fallback.js +110 -20
  54. package/lib/module/internal/glass-routing.js +154 -30
  55. package/lib/module/internal/glow.js +36 -0
  56. package/lib/module/internal/initials.js +12 -0
  57. package/lib/module/internal/lens.js +70 -0
  58. package/lib/module/internal/material.js +64 -0
  59. package/lib/module/internal/overlay.js +147 -0
  60. package/lib/module/internal/primitives.js +17 -0
  61. package/lib/module/internal/rim.js +35 -0
  62. package/lib/module/internal/tokens.js +34 -2
  63. package/lib/typescript/Accordion.d.ts +22 -0
  64. package/lib/typescript/ActionSheet.d.ts +24 -0
  65. package/lib/typescript/Alert.d.ts +15 -0
  66. package/lib/typescript/AlertDialog.d.ts +17 -0
  67. package/lib/typescript/Avatar.d.ts +22 -0
  68. package/lib/typescript/Badge.d.ts +12 -0
  69. package/lib/typescript/Bars.d.ts +3 -188
  70. package/lib/typescript/Button.d.ts +44 -10
  71. package/lib/typescript/Card.d.ts +30 -3
  72. package/lib/typescript/Checkbox.d.ts +14 -0
  73. package/lib/typescript/Chip.d.ts +19 -0
  74. package/lib/typescript/Collapsible.d.ts +17 -0
  75. package/lib/typescript/ContextMenu.d.ts +23 -0
  76. package/lib/typescript/Dialog.d.ts +8 -68
  77. package/lib/typescript/DropdownMenu.d.ts +23 -0
  78. package/lib/typescript/Field.d.ts +19 -0
  79. package/lib/typescript/Glass.d.ts +11 -2
  80. package/lib/typescript/Group.d.ts +35 -0
  81. package/lib/typescript/IconButton.d.ts +21 -0
  82. package/lib/typescript/Input.d.ts +17 -18
  83. package/lib/typescript/Label.d.ts +14 -0
  84. package/lib/typescript/MorphGroup.d.ts +46 -0
  85. package/lib/typescript/Popover.d.ts +17 -0
  86. package/lib/typescript/Progress.d.ts +13 -0
  87. package/lib/typescript/RadioGroup.d.ts +21 -0
  88. package/lib/typescript/Scrim.d.ts +33 -0
  89. package/lib/typescript/SegmentedControl.d.ts +24 -13
  90. package/lib/typescript/Select.d.ts +19 -0
  91. package/lib/typescript/Separator.d.ts +10 -0
  92. package/lib/typescript/Sheet.d.ts +45 -0
  93. package/lib/typescript/Skeleton.d.ts +10 -0
  94. package/lib/typescript/Slider.d.ts +15 -7
  95. package/lib/typescript/Stepper.d.ts +49 -0
  96. package/lib/typescript/Switch.d.ts +19 -12
  97. package/lib/typescript/TabBar.d.ts +18 -6
  98. package/lib/typescript/Textarea.d.ts +6 -0
  99. package/lib/typescript/Toast.d.ts +40 -0
  100. package/lib/typescript/Toggle.d.ts +21 -0
  101. package/lib/typescript/ToggleGroup.d.ts +22 -0
  102. package/lib/typescript/Toolbar.d.ts +35 -0
  103. package/lib/typescript/Tooltip.d.ts +16 -0
  104. package/lib/typescript/glass-provider.d.ts +34 -0
  105. package/lib/typescript/glass-stack.d.ts +54 -0
  106. package/lib/typescript/index.d.ts +39 -17
  107. package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
  108. package/lib/typescript/internal/GlassView.d.ts +31 -2
  109. package/lib/typescript/internal/blur-community.d.ts +2 -0
  110. package/lib/typescript/internal/blur-community.web.d.ts +2 -0
  111. package/lib/typescript/internal/blur.d.ts +24 -0
  112. package/lib/typescript/internal/fallback.d.ts +27 -2
  113. package/lib/typescript/internal/glass-routing.d.ts +83 -15
  114. package/lib/typescript/internal/glow.d.ts +11 -0
  115. package/lib/typescript/internal/initials.d.ts +2 -0
  116. package/lib/typescript/internal/lens.d.ts +47 -0
  117. package/lib/typescript/internal/material.d.ts +27 -0
  118. package/lib/typescript/internal/overlay.d.ts +74 -0
  119. package/lib/typescript/internal/primitives.d.ts +13 -0
  120. package/lib/typescript/internal/rim.d.ts +16 -0
  121. package/lib/typescript/internal/tokens.d.ts +36 -0
  122. package/package.json +15 -4
  123. package/src/Accordion.tsx +165 -0
  124. package/src/ActionSheet.tsx +149 -0
  125. package/src/Alert.tsx +85 -0
  126. package/src/AlertDialog.tsx +124 -0
  127. package/src/Avatar.tsx +102 -0
  128. package/src/Badge.tsx +80 -0
  129. package/src/Bars.tsx +10 -797
  130. package/src/Button.tsx +196 -60
  131. package/src/Card.tsx +106 -33
  132. package/src/Checkbox.tsx +98 -0
  133. package/src/Chip.tsx +149 -0
  134. package/src/Collapsible.tsx +66 -0
  135. package/src/ContextMenu.tsx +103 -0
  136. package/src/Dialog.tsx +86 -325
  137. package/src/DropdownMenu.tsx +103 -0
  138. package/src/Field.tsx +65 -0
  139. package/src/Glass.tsx +19 -5
  140. package/src/Group.tsx +98 -0
  141. package/src/IconButton.tsx +110 -0
  142. package/src/Input.tsx +143 -87
  143. package/src/Label.tsx +56 -0
  144. package/src/MorphGroup.tsx +134 -0
  145. package/src/Popover.tsx +81 -0
  146. package/src/Progress.tsx +83 -0
  147. package/src/RadioGroup.tsx +122 -0
  148. package/src/Scrim.tsx +94 -0
  149. package/src/SegmentedControl.tsx +147 -90
  150. package/src/Select.tsx +136 -0
  151. package/src/Separator.tsx +52 -0
  152. package/src/Sheet.tsx +139 -0
  153. package/src/Skeleton.tsx +77 -0
  154. package/src/Slider.tsx +100 -54
  155. package/src/Stepper.tsx +315 -0
  156. package/src/Switch.tsx +80 -58
  157. package/src/TabBar.tsx +118 -84
  158. package/src/Tabs.tsx +5 -0
  159. package/src/Textarea.tsx +34 -0
  160. package/src/Toast.tsx +131 -0
  161. package/src/Toggle.tsx +113 -0
  162. package/src/ToggleGroup.tsx +129 -0
  163. package/src/Toolbar.tsx +111 -0
  164. package/src/Tooltip.tsx +79 -0
  165. package/src/engine/CHANGELOG.md +430 -0
  166. package/src/engine/NOTICE +54 -0
  167. package/src/engine/README.md +975 -0
  168. package/src/engine/android/build.gradle +18 -0
  169. package/src/engine/android/src/main/AndroidManifest.xml +2 -0
  170. package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
  171. package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
  172. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
  173. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
  174. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
  175. package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
  176. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
  177. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
  178. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
  179. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
  180. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
  181. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
  182. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
  183. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
  184. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
  185. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
  186. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
  187. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
  188. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
  189. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
  190. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
  191. package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
  192. package/src/engine/index.ts +24 -0
  193. package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
  194. package/src/engine/ios/Enums/GlassVariant.swift +86 -0
  195. package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
  196. package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
  197. package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
  198. package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
  199. package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
  200. package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
  201. package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
  202. package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
  203. package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
  204. package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
  205. package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
  206. package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
  207. package/src/engine/ios/Glass/StripCache.swift +545 -0
  208. package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
  209. package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
  210. package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
  211. package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
  212. package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
  213. package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
  214. package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
  215. package/src/engine/package.json +70 -0
  216. package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
  217. package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
  218. package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
  219. package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
  220. package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
  221. package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
  222. package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
  223. package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
  224. package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
  225. package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
  226. package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
  227. package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
  228. package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
  229. package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
  230. package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
  231. package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
  232. package/src/engine/src/components/index.ts +16 -0
  233. package/src/engine/src/constants/index.ts +4 -0
  234. package/src/engine/src/constants/metal.constants.ts +327 -0
  235. package/src/engine/src/constants/metrics.constants.ts +325 -0
  236. package/src/engine/src/constants/springs.constants.ts +107 -0
  237. package/src/engine/src/constants/styles.constants.ts +12 -0
  238. package/src/engine/src/context/glass-group.context.ts +65 -0
  239. package/src/engine/src/context/index.ts +6 -0
  240. package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
  241. package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
  242. package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
  243. package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
  244. package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
  245. package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
  246. package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
  247. package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
  248. package/src/engine/src/core/components/index.ts +4 -0
  249. package/src/engine/src/core/constants/glass.constants.ts +57 -0
  250. package/src/engine/src/core/constants/index.ts +20 -0
  251. package/src/engine/src/core/constants/native.constants.ts +16 -0
  252. package/src/engine/src/core/context/glass-stack.context.ts +30 -0
  253. package/src/engine/src/core/context/index.ts +4 -0
  254. package/src/engine/src/core/enum/index.ts +12 -0
  255. package/src/engine/src/core/index.ts +1 -0
  256. package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
  257. package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
  258. package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
  259. package/src/engine/src/core/interfaces/index.ts +31 -0
  260. package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
  261. package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
  262. package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
  263. package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
  264. package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
  265. package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
  266. package/src/engine/src/core/modules/index.ts +2 -0
  267. package/src/engine/src/core/root/index.ts +51 -0
  268. package/src/engine/src/core/types/glass.types.ts +25 -0
  269. package/src/engine/src/core/types/index.ts +8 -0
  270. package/src/engine/src/core/utils/debug.utils.ts +17 -0
  271. package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
  272. package/src/engine/src/core/utils/hdr.utils.ts +37 -0
  273. package/src/engine/src/core/utils/index.ts +5 -0
  274. package/src/engine/src/core/utils/native-view.utils.ts +33 -0
  275. package/src/engine/src/core/utils/platform.utils.ts +34 -0
  276. package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
  277. package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
  278. package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
  279. package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
  280. package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
  281. package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
  282. package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
  283. package/src/engine/src/core/views/index.ts +4 -0
  284. package/src/engine/src/hooks/index.ts +18 -0
  285. package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
  286. package/src/engine/src/hooks/use-damped-drag.ts +332 -0
  287. package/src/engine/src/hooks/use-echo-filter.ts +55 -0
  288. package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
  289. package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
  290. package/src/engine/src/hooks/use-press-progress.ts +44 -0
  291. package/src/engine/src/index.ts +120 -0
  292. package/src/engine/src/interfaces/index.ts +28 -0
  293. package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
  294. package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
  295. package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
  296. package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
  297. package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
  298. package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
  299. package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
  300. package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
  301. package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
  302. package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
  303. package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
  304. package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
  305. package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
  306. package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
  307. package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
  308. package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
  309. package/src/engine/src/theme/glass-ui-theme.ts +100 -0
  310. package/src/engine/src/theme/index.ts +2 -0
  311. package/src/engine/src/utils/button-press.utils.ts +63 -0
  312. package/src/engine/src/utils/index.ts +3 -0
  313. package/src/engine/src/utils/metal.utils.ts +164 -0
  314. package/src/glass-provider.tsx +60 -0
  315. package/src/glass-stack.tsx +115 -0
  316. package/src/index.ts +48 -190
  317. package/src/internal/GlassBackdrop.tsx +60 -0
  318. package/src/internal/GlassView.tsx +70 -18
  319. package/src/internal/blur-community.ts +19 -0
  320. package/src/internal/blur-community.web.ts +7 -0
  321. package/src/internal/blur.ts +89 -0
  322. package/src/internal/fallback.tsx +158 -20
  323. package/src/internal/glass-routing.ts +211 -34
  324. package/src/internal/glow.tsx +62 -0
  325. package/src/internal/initials.ts +7 -0
  326. package/src/internal/lens.tsx +105 -0
  327. package/src/internal/material.ts +92 -0
  328. package/src/internal/overlay.tsx +258 -0
  329. package/src/internal/primitives.ts +26 -0
  330. package/src/internal/rim.tsx +79 -0
  331. package/src/internal/tokens.ts +34 -1
  332. package/lib/module/Carousel.js +0 -103
  333. package/lib/module/Display.js +0 -317
  334. package/lib/module/Feedback.js +0 -386
  335. package/lib/module/Form.js +0 -164
  336. package/lib/module/Forms2.js +0 -454
  337. package/lib/module/Message.js +0 -88
  338. package/lib/module/Overlays.js +0 -328
  339. package/lib/module/Pickers.js +0 -243
  340. package/lib/module/Table.js +0 -99
  341. package/lib/module/ai.js +0 -280
  342. package/lib/module/charts/AreaChart.js +0 -32
  343. package/lib/module/charts/BarChart.js +0 -67
  344. package/lib/module/charts/FunnelChart.js +0 -50
  345. package/lib/module/charts/HeatmapChart.js +0 -71
  346. package/lib/module/charts/LineChart.js +0 -81
  347. package/lib/module/charts/PlotChart.js +0 -52
  348. package/lib/module/charts/RadarChart.js +0 -78
  349. package/lib/module/charts/RingChart.js +0 -52
  350. package/lib/module/charts/ScatterChart.js +0 -95
  351. package/lib/module/charts/WaterfallChart.js +0 -85
  352. package/lib/module/charts/advanced.js +0 -313
  353. package/lib/module/charts/extra.js +0 -108
  354. package/lib/module/charts/index.js +0 -50
  355. package/lib/module/charts/scales.js +0 -140
  356. package/lib/typescript/Carousel.d.ts +0 -47
  357. package/lib/typescript/Display.d.ts +0 -178
  358. package/lib/typescript/Feedback.d.ts +0 -196
  359. package/lib/typescript/Form.d.ts +0 -97
  360. package/lib/typescript/Forms2.d.ts +0 -209
  361. package/lib/typescript/Message.d.ts +0 -71
  362. package/lib/typescript/Overlays.d.ts +0 -146
  363. package/lib/typescript/Pickers.d.ts +0 -105
  364. package/lib/typescript/Table.d.ts +0 -64
  365. package/lib/typescript/ai.d.ts +0 -166
  366. package/lib/typescript/charts/AreaChart.d.ts +0 -44
  367. package/lib/typescript/charts/BarChart.d.ts +0 -19
  368. package/lib/typescript/charts/FunnelChart.d.ts +0 -25
  369. package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
  370. package/lib/typescript/charts/LineChart.d.ts +0 -30
  371. package/lib/typescript/charts/PlotChart.d.ts +0 -31
  372. package/lib/typescript/charts/RadarChart.d.ts +0 -27
  373. package/lib/typescript/charts/RingChart.d.ts +0 -28
  374. package/lib/typescript/charts/ScatterChart.d.ts +0 -34
  375. package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
  376. package/lib/typescript/charts/advanced.d.ts +0 -107
  377. package/lib/typescript/charts/extra.d.ts +0 -63
  378. package/lib/typescript/charts/index.d.ts +0 -13
  379. package/lib/typescript/charts/scales.d.ts +0 -35
  380. package/src/Carousel.tsx +0 -233
  381. package/src/Display.tsx +0 -778
  382. package/src/Feedback.tsx +0 -969
  383. package/src/Form.tsx +0 -425
  384. package/src/Forms2.tsx +0 -1014
  385. package/src/Message.tsx +0 -219
  386. package/src/Overlays.tsx +0 -685
  387. package/src/Pickers.tsx +0 -590
  388. package/src/Table.tsx +0 -231
  389. package/src/ai.tsx +0 -707
  390. package/src/charts/AreaChart.tsx +0 -73
  391. package/src/charts/BarChart.tsx +0 -183
  392. package/src/charts/FunnelChart.tsx +0 -125
  393. package/src/charts/HeatmapChart.tsx +0 -155
  394. package/src/charts/LineChart.tsx +0 -247
  395. package/src/charts/PlotChart.tsx +0 -168
  396. package/src/charts/RadarChart.tsx +0 -208
  397. package/src/charts/RingChart.tsx +0 -133
  398. package/src/charts/ScatterChart.tsx +0 -223
  399. package/src/charts/WaterfallChart.tsx +0 -201
  400. package/src/charts/advanced.tsx +0 -676
  401. package/src/charts/extra.tsx +0 -242
  402. package/src/charts/index.ts +0 -86
  403. package/src/charts/scales.ts +0 -163
@@ -0,0 +1,81 @@
1
+ // Wave 2 — Popover.
2
+ //
3
+ // The donor's popover: an anchored panel with its own open state, dismissed by
4
+ // an outside press or Android's back gesture, never stealing a rendering pass
5
+ // from the screen behind it. Dressed on the family's overlay surface.
6
+
7
+ import { useState, type ReactNode } from "react";
8
+ import type { StyleProp, ViewStyle } from "react-native";
9
+
10
+ import { primitives } from "./internal/primitives";
11
+ import { useIsDark } from "./internal/motion";
12
+ import { OverlayPanel, useTriggerAnchor } from "./internal/overlay";
13
+
14
+ export interface PopoverProps {
15
+ /** The control that opens the panel. */
16
+ trigger: ReactNode;
17
+ children: ReactNode;
18
+ open?: boolean;
19
+ defaultOpen?: boolean;
20
+ onOpenChange?: (open: boolean) => void;
21
+ /** Panel width, dp. Defaults to 260. */
22
+ width?: number;
23
+ accessibilityLabel?: string;
24
+ isDark?: boolean;
25
+ style?: StyleProp<ViewStyle>;
26
+ testID?: string;
27
+ }
28
+
29
+ export function Popover({
30
+ trigger,
31
+ children,
32
+ open: openProp,
33
+ defaultOpen = false,
34
+ onOpenChange,
35
+ width = 260,
36
+ accessibilityLabel = "Popover",
37
+ isDark: isDarkProp,
38
+ style,
39
+ testID,
40
+ }: PopoverProps) {
41
+ const isDark = useIsDark(isDarkProp);
42
+ const { View, Pressable } = primitives();
43
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
44
+ const { ref, anchor, capture } = useTriggerAnchor();
45
+
46
+ const open = openProp !== undefined ? openProp : internalOpen;
47
+ const setOpen = (next: boolean) => {
48
+ if (openProp === undefined) setInternalOpen(next);
49
+ onOpenChange?.(next);
50
+ };
51
+
52
+ return (
53
+ <View style={{ alignSelf: "flex-start" }}>
54
+ <Pressable
55
+ ref={ref}
56
+ accessibilityRole="button"
57
+ accessibilityLabel={accessibilityLabel}
58
+ accessibilityState={{ expanded: open }}
59
+ onPress={() => {
60
+ void capture();
61
+ setOpen(!open);
62
+ }}
63
+ >
64
+ {trigger}
65
+ </Pressable>
66
+ <OverlayPanel
67
+ open={open}
68
+ onClose={() => setOpen(false)}
69
+ anchor={anchor}
70
+ width={width}
71
+ isDark={isDark}
72
+ testID={testID}
73
+ accessibilityLabel={accessibilityLabel}
74
+ role="dialog"
75
+ panelStyle={style}
76
+ >
77
+ <View style={{ padding: 14 }}>{children}</View>
78
+ </OverlayPanel>
79
+ </View>
80
+ );
81
+ }
@@ -0,0 +1,83 @@
1
+ // Wave 2 — Progress.
2
+ //
3
+ // The donor's semantics: `role="progressbar"` with the value, minimum and
4
+ // maximum exposed, indeterminate when there is no value. The track is one of the
5
+ // family's glass surfaces, and it floors like every other surface.
6
+
7
+ import type { StyleProp, ViewStyle } from "react-native";
8
+
9
+ import { Glass } from "./Glass";
10
+ import { colors, radii, typeScale } from "./internal/tokens";
11
+ import { primitives } from "./internal/primitives";
12
+ import { useIsDark } from "./internal/motion";
13
+
14
+ export type ProgressVariant = "bar" | "linear" | "track" | "ring" | "indeterminate";
15
+
16
+ export interface ProgressProps {
17
+ /** 0–100. Omit for an indeterminate bar. */
18
+ value: number;
19
+ variant?: ProgressVariant;
20
+ tint?: string;
21
+ accessibilityLabel?: string;
22
+ style?: StyleProp<ViewStyle>;
23
+ isDark?: boolean;
24
+ testID?: string;
25
+ }
26
+
27
+ export function Progress({
28
+ value,
29
+ variant = "linear",
30
+ tint,
31
+ accessibilityLabel = "Progress",
32
+ style,
33
+ isDark: isDarkProp,
34
+ testID,
35
+ }: ProgressProps) {
36
+ const isDark = useIsDark(isDarkProp);
37
+ const theme = isDark ? colors.dark : colors.light;
38
+ const { View, Text: RNText } = primitives();
39
+ const indeterminate = variant === "indeterminate";
40
+ const labelled = variant === "track" || variant === "ring";
41
+ const percent = Math.min(100, Math.max(0, Number.isFinite(value) ? value : 0));
42
+
43
+ return (
44
+ <View
45
+ testID={testID}
46
+ accessible
47
+ accessibilityRole="progressbar"
48
+ accessibilityLabel={accessibilityLabel}
49
+ accessibilityValue={indeterminate ? undefined : { min: 0, max: 100, now: Math.round(percent) }}
50
+ >
51
+ <Glass
52
+ effect="regular"
53
+ surface="control"
54
+ isDark={isDark}
55
+ style={flattenStyle([
56
+ { height: 8, borderRadius: radii.pill, overflow: "hidden", justifyContent: "center" },
57
+ style,
58
+ ])}
59
+ >
60
+ <View
61
+ style={{
62
+ height: "100%",
63
+ width: indeterminate ? "40%" : `${percent}%`,
64
+ borderRadius: radii.pill,
65
+ backgroundColor: tint ?? theme.fill,
66
+ }}
67
+ />
68
+ </Glass>
69
+ {labelled ? (
70
+ <RNText style={{ ...typeScale.caption, color: theme.muted, marginTop: 4 }}>
71
+ {Math.round(percent)}%
72
+ </RNText>
73
+ ) : null}
74
+ </View>
75
+ );
76
+ }
77
+
78
+ /** Flattens a style prop into one object, so a plain view surface can take it. */
79
+ function flattenStyle(style: any): any {
80
+ if (style == null) return undefined;
81
+ const list = Array.isArray(style) ? style : [style];
82
+ return Object.assign({}, ...list.filter(Boolean));
83
+ }
@@ -0,0 +1,122 @@
1
+ // Wave 2 — RadioGroup.
2
+ //
3
+ // The donor's radio semantics: the group is a `radiogroup`, every option is a
4
+ // `radio` with `selected`, disabled options are skipped, and the value can be
5
+ // controlled or internal. Dressed in the Wave 1 family's rows and type steps.
6
+
7
+ import { useState } from "react";
8
+ import type { StyleProp, ViewStyle } from "react-native";
9
+
10
+ import { colors, radii, typeScale } from "./internal/tokens";
11
+ import { primitives } from "./internal/primitives";
12
+ import { useIsDark } from "./internal/motion";
13
+ import { hapticSelection } from "./internal/haptics";
14
+
15
+ export interface RadioOption {
16
+ value: string;
17
+ label: string;
18
+ description?: string;
19
+ disabled?: boolean;
20
+ }
21
+
22
+ export interface RadioGroupProps {
23
+ value?: string;
24
+ defaultValue?: string;
25
+ onValueChange?: (value: string) => void;
26
+ options: RadioOption[];
27
+ horizontal?: boolean;
28
+ disabled?: boolean;
29
+ /** Announced as the group's name. */
30
+ accessibilityLabel?: string;
31
+ isDark?: boolean;
32
+ style?: StyleProp<ViewStyle>;
33
+ testID?: string;
34
+ }
35
+
36
+ export function RadioGroup({
37
+ value: valueProp,
38
+ defaultValue,
39
+ onValueChange,
40
+ options,
41
+ horizontal = false,
42
+ disabled = false,
43
+ accessibilityLabel = "Options",
44
+ isDark: isDarkProp,
45
+ style,
46
+ testID,
47
+ }: RadioGroupProps) {
48
+ const isDark = useIsDark(isDarkProp);
49
+ const theme = isDark ? colors.dark : colors.light;
50
+ const { View, Pressable, Text: RNText } = primitives();
51
+
52
+ const [internal, setInternal] = useState(defaultValue);
53
+ const value = valueProp !== undefined ? valueProp : internal;
54
+
55
+ const choose = (next: string) => {
56
+ if (valueProp === undefined) setInternal(next);
57
+ hapticSelection();
58
+ onValueChange?.(next);
59
+ };
60
+
61
+ return (
62
+ <View
63
+ testID={testID}
64
+ accessibilityRole="radiogroup"
65
+ accessibilityLabel={accessibilityLabel}
66
+ style={[{ gap: 6, flexDirection: horizontal ? "row" : "column", flexWrap: "wrap" }, style]}
67
+ >
68
+ {options.map((option) => {
69
+ const selected = value === option.value;
70
+ const off = disabled || option.disabled;
71
+ return (
72
+ <Pressable
73
+ key={option.value}
74
+ accessibilityRole="radio"
75
+ accessibilityLabel={option.label}
76
+ accessibilityState={{ checked: selected, disabled: off }}
77
+ disabled={off}
78
+ onPress={() => choose(option.value)}
79
+ style={{
80
+ flexDirection: "row",
81
+ alignItems: "center",
82
+ gap: 10,
83
+ paddingVertical: 8,
84
+ opacity: off ? 0.38 : 1,
85
+ }}
86
+ >
87
+ <View
88
+ style={{
89
+ width: 22,
90
+ height: 22,
91
+ borderRadius: radii.pill,
92
+ borderWidth: 1.5,
93
+ borderColor: selected ? theme.fill : theme.separator,
94
+ alignItems: "center",
95
+ justifyContent: "center",
96
+ }}
97
+ >
98
+ {selected ? (
99
+ <View
100
+ style={{
101
+ width: 12,
102
+ height: 12,
103
+ borderRadius: radii.pill,
104
+ backgroundColor: theme.fill,
105
+ }}
106
+ />
107
+ ) : null}
108
+ </View>
109
+ <View style={{ flex: 1 }}>
110
+ <RNText style={{ ...typeScale.body, color: theme.foreground }}>{option.label}</RNText>
111
+ {option.description ? (
112
+ <RNText style={{ ...typeScale.caption, color: theme.muted }}>
113
+ {option.description}
114
+ </RNText>
115
+ ) : null}
116
+ </View>
117
+ </Pressable>
118
+ );
119
+ })}
120
+ </View>
121
+ );
122
+ }
package/src/Scrim.tsx ADDED
@@ -0,0 +1,94 @@
1
+ import { forwardRef } from "react";
2
+ import type { ReactNode } from "react";
3
+ import type { StyleProp, ViewStyle } from "react-native";
4
+
5
+ import { loadEngineControl } from "./internal/glass-routing";
6
+ import { glassCapabilities } from "./internal/GlassView";
7
+ import { Glass } from "./Glass";
8
+ import { colors, radii } from "./internal/tokens";
9
+ import { primitives } from "./internal/primitives";
10
+ import { useIsDark } from "./internal/motion";
11
+
12
+ export interface ScrimProps {
13
+ /** Which screen edge the scrim hugs — and therefore which way the blur ramps. Default `"bottom"`. */
14
+ edge?: "top" | "bottom" | "left" | "right";
15
+ /** Thickness of the scrim along its axis, dp. Default 160. */
16
+ size?: number;
17
+ /** Blur radius at the outer edge, dp. Default 24. */
18
+ radius?: number;
19
+ /**
20
+ * Fraction of the scrim over which the ramp completes, measured from the
21
+ * content side. Past it the blur holds at full `radius`. Default 0.7.
22
+ */
23
+ reach?: number;
24
+ /** Optional wash over the blur — e.g. the bar surface colour at low alpha. */
25
+ tint?: string;
26
+ /** Android: which provider(s) to read. Same semantics as the glass view. */
27
+ providerId?: string;
28
+ /** Extra positioning/size overrides, applied after the edge placement. */
29
+ style?: StyleProp<ViewStyle>;
30
+ /** Content over the scrim — a tab bar, a toolbar. Laid out edge-aligned, untouched. */
31
+ children?: ReactNode;
32
+ }
33
+
34
+ /**
35
+ * A scroll-edge scrim — ported from the engine's `LiquidGlassScrim`, the design
36
+ * Binyam approved on real devices this week (edge-hugging blur ramp).
37
+ *
38
+ * With a glass renderer available the engine's own control mounts, carrying the
39
+ * approved ramp. Without one — Expo Go, below every tier, or Reduce Transparency —
40
+ * the fallback floor renders the same scrim with a solid wash, so content is
41
+ * never lost behind an invisible scrim.
42
+ */
43
+ export const Scrim = forwardRef<any, ScrimProps>(function Scrim(
44
+ {
45
+ edge = "bottom",
46
+ size = 160,
47
+ radius = 24,
48
+ reach = 0.7,
49
+ tint,
50
+ providerId,
51
+ style,
52
+ children,
53
+ ...props
54
+ },
55
+ ref,
56
+ ) {
57
+ const isDark = useIsDark();
58
+ const themeColors = isDark ? colors.dark : colors.light;
59
+ const { View } = primitives();
60
+ const capabilities = glassCapabilities();
61
+ const EngineScrim = loadEngineControl("Scrim");
62
+
63
+ if (EngineScrim && capabilities.supported) {
64
+ const EngineScrimComponent = EngineScrim;
65
+ return (
66
+ <EngineScrimComponent
67
+ edge={edge}
68
+ size={size}
69
+ radius={radius}
70
+ reach={reach}
71
+ tint={tint}
72
+ providerId={providerId}
73
+ style={style}
74
+ >
75
+ {children}
76
+ </EngineScrimComponent>
77
+ );
78
+ }
79
+
80
+ // Fallback floor: solid scrim at the content edge, full geometry.
81
+ const scrimStyle: ViewStyle = {
82
+ position: "absolute",
83
+ ...(edge === "top"
84
+ ? { top: 0, left: 0, right: 0, height: size }
85
+ : edge === "bottom"
86
+ ? { bottom: 0, left: 0, right: 0, height: size }
87
+ : edge === "left"
88
+ ? { left: 0, top: 0, bottom: 0, width: size }
89
+ : { right: 0, top: 0, bottom: 0, width: size }),
90
+ backgroundColor: tint ?? themeColors.scrim,
91
+ ...(style as ViewStyle),
92
+ };
93
+ return <View ref={ref} style={scrimStyle} {...(props as any)}>{children}</View>;
94
+ });
@@ -1,157 +1,214 @@
1
- import { forwardRef, useState } from "react";
2
- import type { StyleProp, ViewStyle } from "react-native";
1
+ import { forwardRef } from "react";
2
+ import type { StyleProp, TextStyle, ViewStyle } from "react-native";
3
3
 
4
+ import { loadEngineControl } from "./internal/glass-routing";
5
+ import { glassCapabilities } from "./internal/GlassView";
4
6
  import { Glass } from "./Glass";
5
7
  import { colors, radii } from "./internal/tokens";
6
8
  import { primitives } from "./internal/primitives";
7
9
  import { useIsDark, useSpring } from "./internal/motion";
8
10
  import { hapticSelection } from "./internal/haptics";
11
+ import { LensRim, lensShadow } from "./internal/lens";
9
12
 
10
13
  export interface SegmentedControlProps {
11
- values: string[];
12
- selectedIndex?: number;
13
- defaultIndex?: number;
14
- onValueChange?: (value: string, index: number) => void;
15
- /** One selection tick when the segment changes. `false` opts out. */
16
- haptics?: boolean;
17
- style?: StyleProp<ViewStyle>;
14
+ /** Segment labels, equal-width. */
15
+ segments: string[];
16
+ selectedIndex: number;
17
+ /** Fires when the user picks another segment. */
18
+ onChange: (index: number) => void;
19
+ /** Control height; the corner radius follows it. Defaults to 40. */
20
+ height?: number;
21
+ /** Track wash. */
22
+ tint?: string;
23
+ /** Thumb wash. */
24
+ thumbTint?: string;
25
+ thumbMetal?: unknown;
26
+ accessibilityLabel?: string;
18
27
  isDark?: boolean;
19
- /** Passed through to the control so it is testable. */
28
+ /** Passed to the control so it is testable. */
20
29
  testID?: string;
30
+ style?: StyleProp<ViewStyle>;
31
+ textStyle?: StyleProp<TextStyle>;
21
32
  }
22
33
 
23
- const SEGMENT_HEIGHT = 30;
24
-
25
34
  /**
26
- * A row of mutually exclusive segments on one glass container.
35
+ * A segmented control — ported from the engine's `LiquidGlassSegmentedControl`,
36
+ * the design Binyam approved on real devices this week (40dp track, 3dp-inset
37
+ * thumb).
27
38
  *
28
- * The selected segment is marked by a pill that slides on the springs token.
29
- * The pill's colours come from the theme tokens, so it reads correctly in both
30
- * light and dark instead of assuming a white-on-light palette.
39
+ * With a glass renderer available the engine's own control mounts, carrying the
40
+ * approved geometry and thumb behaviour. Without one — Expo Go, below every
41
+ * tier, or Reduce Transparency — the fallback floor renders the same row of
42
+ * segments with solid selected states, so the control is never invisible.
31
43
  */
32
44
  export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function SegmentedControl(
33
45
  {
34
- values,
35
- selectedIndex: selectedProp,
36
- defaultIndex = 0,
37
- onValueChange,
38
- haptics = true,
39
- style,
46
+ segments,
47
+ selectedIndex,
48
+ onChange,
49
+ height = 40,
50
+ tint,
51
+ thumbTint,
52
+ thumbMetal,
53
+ accessibilityLabel,
40
54
  isDark: isDarkProp,
41
55
  testID,
56
+ style,
57
+ textStyle,
42
58
  ...props
43
59
  },
44
60
  ref,
45
61
  ) {
46
62
  const isDark = useIsDark(isDarkProp);
47
63
  const themeColors = isDark ? colors.dark : colors.light;
48
- const { View, Text, Pressable, Animated } = primitives();
64
+ const { View, Pressable, Text: RNText, Animated } = primitives();
65
+ const capabilities = glassCapabilities();
66
+ const EngineSegmentedControl = loadEngineControl("SegmentedControl");
49
67
 
50
- const [internalIndex, setInternalIndex] = useState(defaultIndex);
51
- const activeIndex = selectedProp !== undefined ? selectedProp : internalIndex;
52
- const safeIndex = Math.min(Math.max(activeIndex, 0), Math.max(values.length - 1, 0));
68
+ const selected = Math.min(Math.max(selectedIndex, 0), Math.max(segments.length - 1, 0));
53
69
 
54
70
  // The pill slides between equal-width segments, so a ratio is enough: 0 is
55
71
  // the first segment, values.length - 1 the last.
56
- const { value: slide, animated } = useSpring(safeIndex, "snappy");
57
-
58
- const handleSelect = (index: number) => {
59
- // Only a change ticks: re-pressing the current segment is not a selection.
60
- if (haptics && index !== safeIndex) hapticSelection();
61
- if (selectedProp === undefined) setInternalIndex(index);
62
- const val = values[index];
63
- if (val !== undefined) onValueChange?.(val, index);
64
- };
65
-
66
- const count = Math.max(values.length, 1);
72
+ const count = Math.max(segments.length, 1);
67
73
  const pillWidth = `${100 / count}%`;
68
-
69
- const containerStyle: ViewStyle = {
70
- position: "relative",
71
- flexDirection: "row",
72
- alignItems: "center",
73
- alignSelf: "flex-start",
74
- padding: 2,
75
- borderRadius: radii.md,
76
- backgroundColor: "rgba(118, 118, 128, 0.12)",
77
- ...(style as ViewStyle),
78
- };
74
+ const { value: slide, animated } = useSpring(selected, "snappy");
79
75
 
80
76
  const pillTranslate = animated
81
77
  ? slide.interpolate({
82
78
  inputRange: [0, Math.max(count - 1, 1)],
83
- // One segment's worth per step, measured against the pill's own width.
84
79
  outputRange: ["0%", `${((count - 1) * 100) / count}%`],
85
80
  })
86
- : `${(safeIndex * 100) / count}%`;
81
+ : `${(selected * 100) / count}%`;
82
+
83
+ if (EngineSegmentedControl && capabilities.supported) {
84
+ const EngineSegmentedControlComponent = EngineSegmentedControl;
85
+ return (
86
+ <EngineSegmentedControlComponent
87
+ segments={segments}
88
+ selectedIndex={selected}
89
+ onChange={(index: number) => {
90
+ hapticSelection();
91
+ onChange(index);
92
+ }}
93
+ height={height}
94
+ tint={tint}
95
+ thumbTint={thumbTint}
96
+ thumbMetal={thumbMetal}
97
+ style={style}
98
+ textStyle={textStyle}
99
+ />
100
+ );
101
+ }
87
102
 
88
- return (
89
- <Glass ref={ref} effect="regular" isDark={isDark} style={containerStyle} testID={testID} {...props}>
90
- {/* The sliding pill: one View behind the labels, coloured by the theme. */}
103
+ // Fallback floor: the sliding lens pill on a solid track, full selection
104
+ // behaviour, so the selected segment reads exactly as it does in glass.
105
+ const fallback = (
106
+ <Glass
107
+ effect="regular"
108
+ surface="rail"
109
+ pressed={false}
110
+ isDark={isDark}
111
+ style={{
112
+ position: "relative",
113
+ flexDirection: "row",
114
+ alignItems: "center",
115
+ alignSelf: "flex-start",
116
+ padding: 3,
117
+ borderRadius: radii.pill,
118
+ backgroundColor: themeColors.fieldWash,
119
+ ...(style as ViewStyle),
120
+ }}
121
+ testID={testID}
122
+ {...props}
123
+ >
91
124
  {animated ? (
92
125
  <Animated.View
93
126
  style={{
94
127
  position: "absolute",
95
- top: 2,
96
- left: 2,
128
+ top: 3,
129
+ left: 3,
97
130
  width: pillWidth,
98
- height: SEGMENT_HEIGHT,
99
- borderRadius: radii.sm,
131
+ height: height - 6,
132
+ borderRadius: (height - 6) / 2,
100
133
  backgroundColor: themeColors.glassActive,
101
134
  borderWidth: 0.5,
102
135
  borderColor: themeColors.edge,
136
+ // The thumb is a lens: lifted off the rail, with its own rim.
137
+ ...lensShadow(isDark),
103
138
  transform: [{ translateX: pillTranslate }],
104
139
  }}
105
140
  pointerEvents="none"
106
- />
141
+ >
142
+ <LensRim radius={(height - 6) / 2} isDark={isDark} />
143
+ </Animated.View>
107
144
  ) : (
108
145
  <View
109
146
  style={{
110
147
  position: "absolute",
111
- top: 2,
112
- left: `${2 + (safeIndex * 100) / count}%`,
148
+ top: 3,
149
+ left: `${3 + (selected * 100) / count}%`,
113
150
  width: pillWidth,
114
- height: SEGMENT_HEIGHT,
115
- borderRadius: radii.sm,
151
+ height: height - 6,
152
+ borderRadius: (height - 6) / 2,
116
153
  backgroundColor: themeColors.glassActive,
117
154
  borderWidth: 0.5,
118
155
  borderColor: themeColors.edge,
156
+ ...lensShadow(isDark),
119
157
  }}
120
158
  pointerEvents="none"
121
- />
159
+ >
160
+ <LensRim radius={(height - 6) / 2} isDark={isDark} />
161
+ </View>
122
162
  )}
123
-
124
- {values.map((label, idx) => {
125
- const isSelected = idx === safeIndex;
163
+ {segments.map((segment, index) => {
164
+ const isSelected = index === selected;
165
+ const cell = (height - 6) / Math.max(segments.length, 1);
126
166
  return (
127
- <Pressable
128
- key={label}
129
- accessibilityRole="tab"
130
- accessibilityLabel={label}
131
- accessibilityState={{ selected: isSelected }}
132
- onPress={() => handleSelect(idx)}
133
- style={{
134
- flex: 1,
135
- height: SEGMENT_HEIGHT,
136
- alignItems: "center",
137
- justifyContent: "center",
138
- paddingHorizontal: 16,
139
- borderRadius: radii.sm,
140
- }}
141
- >
142
- <Text
143
- numberOfLines={1}
144
- style={{
145
- fontSize: 13,
146
- fontWeight: isSelected ? "600" : "500",
147
- color: isSelected ? themeColors.foreground : themeColors.muted,
167
+ <View key={segment} style={{ width: cell, height: height - 6, position: "relative" }}>
168
+ {isSelected ? (
169
+ <View
170
+ style={{
171
+ position: "absolute",
172
+ top: 0,
173
+ left: 0,
174
+ width: cell,
175
+ height: height - 6,
176
+ borderRadius: (height - 6) / 2,
177
+ backgroundColor: themeColors.glassActive,
178
+ }}
179
+ />
180
+ ) : null}
181
+ <Pressable
182
+ testID={testID ? `${testID}-segment-${index}` : undefined}
183
+ accessibilityRole="tab"
184
+ accessibilityLabel={`${accessibilityLabel ?? "Segment"} ${segment}`}
185
+ accessibilityState={{ selected: isSelected, disabled: false }}
186
+ disabled={false}
187
+ onPress={() => {
188
+ if (index === selected) return;
189
+ hapticSelection();
190
+ onChange(index);
148
191
  }}
192
+ style={{ width: "100%", height, alignItems: "center", justifyContent: "center" }}
149
193
  >
150
- {label}
151
- </Text>
152
- </Pressable>
194
+ <RNText
195
+ style={[
196
+ {
197
+ fontSize: 14,
198
+ fontWeight: isSelected ? "600" : "500",
199
+ color: isSelected ? themeColors.onTint : themeColors.muted,
200
+ },
201
+ textStyle,
202
+ ]}
203
+ >
204
+ {segment}
205
+ </RNText>
206
+ </Pressable>
207
+ </View>
153
208
  );
154
209
  })}
155
210
  </Glass>
156
211
  );
212
+
213
+ return fallback;
157
214
  });