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
@@ -1,30 +0,0 @@
1
- export interface NativeLineSeries {
2
- name: string;
3
- values: number[];
4
- color?: string;
5
- }
6
- export interface NativeLineChartProps {
7
- labels: string[];
8
- series: NativeLineSeries[];
9
- width?: number;
10
- height?: number;
11
- /** Fill beneath each line. */
12
- area?: boolean;
13
- smooth?: boolean;
14
- showDots?: boolean;
15
- isDark?: boolean;
16
- palette?: readonly string[];
17
- style?: StyleProps;
18
- /** Called with the index of the touched point. */
19
- onPointPress?: (index: number) => void;
20
- }
21
- type StyleProps = any;
22
- /**
23
- * A line chart drawn with react-native-svg.
24
- *
25
- * Uses the same scale maths as the web LineChart, so the same series produces
26
- * the same axis values on both platforms. Touching a column selects that
27
- * point, which is the touch equivalent of hovering on the web.
28
- */
29
- export declare function NativeLineChart({ labels, series, width, height, area, smooth, showDots, isDark: isDarkProp, palette, style, onPointPress, }: NativeLineChartProps): import("react").JSX.Element;
30
- export {};
@@ -1,31 +0,0 @@
1
- export interface NativePlotPoint {
2
- x: number;
3
- y: number;
4
- label?: string;
5
- }
6
- export interface NativePlotRenderArgs {
7
- x: (value: number) => number;
8
- y: (value: number) => number;
9
- points: NativePlotPoint[];
10
- width: number;
11
- height: number;
12
- }
13
- export interface NativePlotChartProps {
14
- points: NativePlotPoint[];
15
- /** Draws the marks. Receives real pixel scales, not a fabricated viewBox. */
16
- renderMark?: (args: NativePlotRenderArgs) => any;
17
- width?: number;
18
- height?: number;
19
- xLabel?: string;
20
- yLabel?: string;
21
- isDark?: boolean;
22
- style?: any;
23
- }
24
- /**
25
- * A numeric plot you supply the marks for.
26
- *
27
- * The axes, ticks and padding are handled here and the caller receives real
28
- * pixel scales. That keeps stroke widths and text sizes honest regardless of
29
- * the chart's width, instead of a scaled viewBox that would distort them.
30
- */
31
- export declare function NativePlotChart({ points, renderMark, width, height, xLabel, yLabel, isDark: isDarkProp, style, }: NativePlotChartProps): import("react").JSX.Element;
@@ -1,27 +0,0 @@
1
- export interface NativeRadarSeries {
2
- name: string;
3
- /** One value per axis, in the same order as `axes`. */
4
- values: number[];
5
- color?: string;
6
- }
7
- export interface NativeRadarChartProps {
8
- axes: string[];
9
- series: NativeRadarSeries[];
10
- size?: number;
11
- /** Number of concentric rings behind the data. */
12
- rings?: number;
13
- /** Fixed maximum; defaults to the largest value across series. */
14
- max?: number;
15
- isDark?: boolean;
16
- palette?: readonly string[];
17
- style?: any;
18
- onAxisPress?: (index: number) => void;
19
- }
20
- /**
21
- * Several axes around a circle, one closed shape per series.
22
- *
23
- * Reading many dimensions off a phone is hard, so every axis label is also a
24
- * touch target: tapping one lists that axis's values for all series instead of
25
- * relying on a hover tooltip.
26
- */
27
- export declare function NativeRadarChart({ axes, series, size, rings, max, isDark: isDarkProp, palette, style, onAxisPress, }: NativeRadarChartProps): import("react").JSX.Element;
@@ -1,28 +0,0 @@
1
- export interface NativeRingSlice {
2
- label: string;
3
- value: number;
4
- color?: string;
5
- }
6
- export interface NativeRingChartProps {
7
- data: NativeRingSlice[];
8
- size?: number;
9
- /**
10
- * Ring thickness. Larger leaves a bigger hole.
11
- * A pie is the same shape with no hole: pass `size` to fill it.
12
- */
13
- thickness?: number;
14
- isDark?: boolean;
15
- palette?: readonly string[];
16
- /** Show the slice list beneath the ring. */
17
- showLegend?: boolean;
18
- style?: any;
19
- onSlicePress?: (index: number) => void;
20
- }
21
- /**
22
- * Proportional slices as a ring, drawn with react-native-svg.
23
- *
24
- * Shares the arc maths with the web RingChart, so slices land in the same
25
- * places on both platforms. A legend is on by default: on a phone there is no
26
- * hover, so colour alone cannot identify a slice.
27
- */
28
- export declare function NativeRingChart({ data, size, thickness, isDark: isDarkProp, palette, showLegend, style, onSlicePress, }: NativeRingChartProps): import("react").JSX.Element;
@@ -1,34 +0,0 @@
1
- export interface NativeScatterPoint {
2
- x: number;
3
- y: number;
4
- label?: string;
5
- /** Bubble radius driver; ignored when `bubble` is not set. */
6
- size?: number;
7
- }
8
- export interface NativeScatterSeries {
9
- name: string;
10
- points: NativeScatterPoint[];
11
- color?: string;
12
- }
13
- export interface NativeScatterChartProps {
14
- series: NativeScatterSeries[];
15
- width?: number;
16
- height?: number;
17
- /** Fixed dot radius. */
18
- radius?: number;
19
- /** Size each mark by its `size` value instead of a fixed radius. */
20
- bubble?: boolean;
21
- isDark?: boolean;
22
- palette?: readonly string[];
23
- style?: any;
24
- onPointPress?: (seriesIndex: number, pointIndex: number) => void;
25
- }
26
- /**
27
- * Two numeric axes, drawn with react-native-svg.
28
- *
29
- * BubbleChart is this component with `bubble` set, so the two share their
30
- * axes, padding and touch behaviour instead of drifting apart.
31
- */
32
- export declare function NativeScatterChart({ series, width, height, radius, bubble, isDark: isDarkProp, palette, style, onPointPress, }: NativeScatterChartProps): import("react").JSX.Element;
33
- /** Scatter marks sized by a third value. */
34
- export declare function NativeBubbleChart(props: Omit<NativeScatterChartProps, "bubble" | "radius">): import("react").JSX.Element;
@@ -1,22 +0,0 @@
1
- export interface NativeWaterfallStep {
2
- label: string;
3
- /** Signed change. A step with `isTotal` set is drawn as an absolute bar. */
4
- value: number;
5
- isTotal?: boolean;
6
- }
7
- export interface NativeWaterfallChartProps {
8
- steps: NativeWaterfallStep[];
9
- width?: number;
10
- height?: number;
11
- isDark?: boolean;
12
- style?: any;
13
- onStepPress?: (index: number) => void;
14
- }
15
- /**
16
- * How a running total moves step by step.
17
- *
18
- * Each bar starts where the previous one ended, so the reader sees the bridge
19
- * from opening to closing balance rather than a set of unrelated changes.
20
- * Increases and decreases are coloured differently, and totals span the axis.
21
- */
22
- export declare function NativeWaterfallChart({ steps, width, height, isDark: isDarkProp, style, onStepPress, }: NativeWaterfallChartProps): import("react").JSX.Element;
@@ -1,107 +0,0 @@
1
- export interface NativeCandle {
2
- label: string;
3
- open: number;
4
- high: number;
5
- low: number;
6
- close: number;
7
- }
8
- export interface NativeCandlestickChartProps {
9
- candles: NativeCandle[];
10
- width?: number;
11
- height?: number;
12
- isDark?: boolean;
13
- style?: any;
14
- onCandlePress?: (index: number) => void;
15
- }
16
- /**
17
- * Open, high, low and close for each period.
18
- *
19
- * A filled body means the period closed up and a hollow body means it closed
20
- * down, which is the convention traders read without a legend. Each candle is
21
- * tappable to reveal the four prices, replacing the web hover tooltip.
22
- */
23
- export declare function NativeCandlestickChart({ candles, width, height, isDark: isDarkProp, style, onCandlePress, }: NativeCandlestickChartProps): import("react").JSX.Element;
24
- export interface NativeTreemapItem {
25
- label: string;
26
- value: number;
27
- color?: string;
28
- }
29
- export interface NativeTreemapChartProps {
30
- items: NativeTreemapItem[];
31
- width?: number;
32
- height?: number;
33
- isDark?: boolean;
34
- palette?: readonly string[];
35
- style?: any;
36
- onItemPress?: (index: number) => void;
37
- }
38
- /** Proportional rectangles for part-to-whole comparison. */
39
- export declare function NativeTreemapChart({ items, width, height, isDark: isDarkProp, palette, style, onItemPress, }: NativeTreemapChartProps): import("react").JSX.Element;
40
- export interface NativeSankeyNode {
41
- id: string;
42
- label: string;
43
- }
44
- export interface NativeSankeyLink {
45
- from: string;
46
- to: string;
47
- value: number;
48
- }
49
- export interface NativeSankeyChartProps {
50
- nodes: NativeSankeyNode[];
51
- links: NativeSankeyLink[];
52
- width?: number;
53
- height?: number;
54
- isDark?: boolean;
55
- palette?: readonly string[];
56
- style?: any;
57
- }
58
- /**
59
- * Flow between stages, drawn as stacked columns joined by bands.
60
- *
61
- * Columns are assigned by longest path from a source, so a node always sits
62
- * after everything feeding it. Rendering uses Views rather than SVG because the
63
- * bands are axis-aligned rectangles.
64
- */
65
- export declare function NativeSankeyChart({ nodes, links, width, height, isDark: isDarkProp, palette, style, }: NativeSankeyChartProps): import("react").JSX.Element;
66
- export interface NativeBumpSeries {
67
- name: string;
68
- /** Rank per period; 1 is best. */
69
- ranks: number[];
70
- color?: string;
71
- }
72
- export interface NativeBumpChartProps {
73
- labels: string[];
74
- series: NativeBumpSeries[];
75
- width?: number;
76
- height?: number;
77
- isDark?: boolean;
78
- palette?: readonly string[];
79
- style?: any;
80
- onPointPress?: (seriesIndex: number, periodIndex: number) => void;
81
- }
82
- /** Rank changes over time, where the vertical position is the rank itself. */
83
- export declare function NativeBumpChart({ labels, series, width, height, isDark: isDarkProp, palette, style, onPointPress, }: NativeBumpChartProps): import("react").JSX.Element;
84
- export interface NativeHexPoint {
85
- x: number;
86
- y: number;
87
- /** Drives the bin's colour. */
88
- value: number;
89
- label?: string;
90
- }
91
- export interface NativeHexChartProps {
92
- points: NativeHexPoint[];
93
- /** Bin radius in points. */
94
- radius?: number;
95
- width?: number;
96
- height?: number;
97
- isDark?: boolean;
98
- style?: any;
99
- onBinPress?: (index: number) => void;
100
- }
101
- /**
102
- * Points aggregated into hexagonal bins whose colour is the mean value.
103
- *
104
- * Binning keeps thousands of points legible: reading one mark's exact position
105
- * matters less than seeing where density is concentrated.
106
- */
107
- export declare function NativeHexChart({ points, radius, width, height, isDark: isDarkProp, style, onBinPress, }: NativeHexChartProps): import("react").JSX.Element;
@@ -1,63 +0,0 @@
1
- import { type NativeLineSeries } from "./LineChart";
2
- export interface NativePolarSegment {
3
- label: string;
4
- value: number;
5
- color?: string;
6
- }
7
- export interface NativePolarAreaChartProps {
8
- segments: NativePolarSegment[];
9
- size?: number;
10
- /** Value mapped to the full radius. Defaults to the largest segment. */
11
- max?: number;
12
- isDark?: boolean;
13
- palette?: readonly string[];
14
- style?: any;
15
- onSegmentPress?: (index: number) => void;
16
- }
17
- /**
18
- * Equal-angle wedges whose radius encodes value.
19
- *
20
- * Unlike a pie chart, every wedge uses the same angle, so the reader compares
21
- * one dimension (radius) rather than area. Each wedge is separately tappable
22
- * because a phone has no hover.
23
- */
24
- export declare function NativePolarAreaChart({ segments, size, max, isDark: isDarkProp, palette, style, onSegmentPress, }: NativePolarAreaChartProps): import("react").JSX.Element;
25
- export interface NativePyramidLevel {
26
- label: string;
27
- value: number;
28
- color?: string;
29
- }
30
- export interface NativePyramidChartProps {
31
- levels: NativePyramidLevel[];
32
- /** Height of each level band. */
33
- levelHeight?: number;
34
- width?: number;
35
- isDark?: boolean;
36
- palette?: readonly string[];
37
- style?: any;
38
- onLevelPress?: (index: number) => void;
39
- }
40
- /**
41
- * Stacked bands that narrow toward the top.
42
- *
43
- * Bands are Views rather than SVG: each is a centred rectangle whose width is
44
- * the band's share of the widest level, which native layout computes exactly.
45
- */
46
- export declare function NativePyramidChart({ levels, levelHeight, width, isDark: isDarkProp, palette, style, onLevelPress, }: NativePyramidChartProps): import("react").JSX.Element;
47
- export interface NativeLiveLineChartProps {
48
- labels: string[];
49
- series: NativeLineSeries[];
50
- width?: number;
51
- height?: number;
52
- isDark?: boolean;
53
- palette?: readonly string[];
54
- style?: any;
55
- }
56
- /**
57
- * A line chart that keeps only the most recent window of points.
58
- *
59
- * The caller pushes new values; this trims to `labels.length` so the window
60
- * slides instead of growing without bound. Pausing is the caller's decision —
61
- * a chart that stops itself would hide data the user expects to see arrive.
62
- */
63
- export declare function NativeLiveLineChart(props: NativeLiveLineChartProps): import("react").JSX.Element;
@@ -1,13 +0,0 @@
1
- export { NativeLineChart, type NativeLineChartProps, type NativeLineSeries } from "./LineChart";
2
- export { NativeBarChart, type NativeBarChartProps, type NativeBarSeries } from "./BarChart";
3
- export { NativeRingChart, type NativeRingChartProps, type NativeRingSlice } from "./RingChart";
4
- export { NativeAreaChart, NativeMirrorAreaChart, type NativeAreaChartProps, type NativeMirrorAreaChartProps, type NativeMirrorAreaSeries, } from "./AreaChart";
5
- export { NativeScatterChart, NativeBubbleChart, type NativeScatterChartProps, type NativeScatterSeries, type NativeScatterPoint, } from "./ScatterChart";
6
- export { NativeFunnelChart, type NativeFunnelChartProps, type NativeFunnelStage, } from "./FunnelChart";
7
- export { NativeHeatmapChart, type NativeHeatmapChartProps } from "./HeatmapChart";
8
- export { NativeRadarChart, type NativeRadarChartProps, type NativeRadarSeries, } from "./RadarChart";
9
- export { NativeWaterfallChart, type NativeWaterfallChartProps, type NativeWaterfallStep, } from "./WaterfallChart";
10
- export { linearScale, niceDomain, ticks, bandScale, smoothPath, arcPath, formatValue, seriesColor, SERIES_COLORS, type Scale, } from "./scales";
11
- export { NativePolarAreaChart, NativePyramidChart, NativeLiveLineChart, type NativePolarAreaChartProps, type NativePolarSegment, type NativePyramidChartProps, type NativePyramidLevel, type NativeLiveLineChartProps, } from "./extra";
12
- export { NativeCandlestickChart, NativeTreemapChart, NativeSankeyChart, NativeBumpChart, NativeHexChart, type NativeCandlestickChartProps, type NativeCandle, type NativeTreemapChartProps, type NativeTreemapItem, type NativeSankeyChartProps, type NativeSankeyNode, type NativeSankeyLink, type NativeBumpChartProps, type NativeBumpSeries, type NativeHexChartProps, type NativeHexPoint, } from "./advanced";
13
- export { NativePlotChart, type NativePlotChartProps, type NativePlotPoint, type NativePlotRenderArgs, } from "./PlotChart";
@@ -1,35 +0,0 @@
1
- /** Maps a value into pixel space along one axis. */
2
- export interface Scale {
3
- (value: number): number;
4
- invert(pixel: number): number;
5
- domain: [number, number];
6
- range: [number, number];
7
- }
8
- export declare function linearScale(domain: [number, number], range: [number, number], options?: {
9
- nice?: boolean;
10
- ticks?: number;
11
- }): Scale;
12
- /** Rounds a domain outward to values that read cleanly on an axis. */
13
- export declare function niceDomain(min: number, max: number, tickCount?: number): [number, number];
14
- export declare function ticks(domain: [number, number], count?: number): number[];
15
- /** Evenly divided bands; returns the centre and width of each. */
16
- export declare function bandScale(count: number, range: [number, number], padding?: number): {
17
- bandWidth: number;
18
- width: number;
19
- start: (i: number) => number;
20
- center: (i: number) => number;
21
- };
22
- /** Compact number formatting, matching the web charts. */
23
- export declare function formatValue(value: number, options?: {
24
- compact?: boolean;
25
- decimals?: number;
26
- }): string;
27
- /** Points along a smooth (monotone) path, as SVG path segments. */
28
- export declare function smoothPath(points: {
29
- x: number;
30
- y: number;
31
- }[]): string;
32
- /** A pie/donut arc, with an optional inner radius. */
33
- export declare function arcPath(cx: number, cy: number, outer: number, inner: number, startAngle: number, endAngle: number): string;
34
- export declare const SERIES_COLORS: readonly ["#0088ff", "#34c759", "#ff9f0a", "#ff375f", "#bf5af2", "#64d2ff", "#ffd60a"];
35
- export declare const seriesColor: (index: number, palette?: readonly string[]) => string;
package/src/Carousel.tsx DELETED
@@ -1,233 +0,0 @@
1
- import { forwardRef, useRef, useState, type ReactNode } from "react";
2
- import type { StyleProp, ViewStyle } from "react-native";
3
-
4
- import { colors } from "./internal/tokens";
5
- import { primitives } from "./internal/primitives";
6
- import { useIsDark, useSpring } from "./internal/motion";
7
-
8
- // ---------------------------------------------------------------------------
9
- // Carousel
10
-
11
- export interface CarouselProps {
12
- /** One node per page. */
13
- slides: ReactNode[];
14
- /** Controlled page. Omit and the carousel tracks itself. */
15
- index?: number;
16
- defaultIndex?: number;
17
- /** Fires when a swipe settles on a new page. */
18
- onIndexChange?: (index: number) => void;
19
- /** Gap between pages, so neighbours peek at the edges. */
20
- gap?: number;
21
- style?: StyleProp<ViewStyle>;
22
- isDark?: boolean;
23
- testID?: string;
24
- }
25
-
26
- /**
27
- * A horizontally paging swiper.
28
- *
29
- * It rides the resolver's ScrollView with `pagingEnabled`, so the paging feel is
30
- * the platform's own and the pages are plain content the caller supplies. The
31
- * active page is derived from the scroll offset, which is also what reports
32
- * `onIndexChange`.
33
- */
34
- export const Carousel = forwardRef<any, CarouselProps>(function Carousel(
35
- {
36
- slides,
37
- index: indexProp,
38
- defaultIndex = 0,
39
- onIndexChange,
40
- gap = 0,
41
- style,
42
- isDark: isDarkProp,
43
- testID,
44
- ...props
45
- },
46
- ref,
47
- ) {
48
- const isDark = useIsDark(isDarkProp);
49
- const { getScrollView } = primitives();
50
- const ScrollView = getScrollView();
51
- const { View } = primitives();
52
-
53
- const [internalIndex, setInternalIndex] = useState(defaultIndex);
54
- const index = indexProp !== undefined ? indexProp : internalIndex;
55
-
56
- const viewportWidth = useRef(0);
57
- const scrollRef = useRef<any>(null);
58
-
59
- // Derives the page from the offset rather than trusting a counter, so a
60
- // fast swipe that skips pages still reports the page it landed on.
61
- const handleScroll = (event: any) => {
62
- const { contentOffset, layoutMeasurement } = event?.nativeEvent ?? {};
63
- const width = layoutMeasurement?.width || viewportWidth.current;
64
- if (!width || !contentOffset) return;
65
- const next = Math.round(contentOffset.x / width);
66
- const clamped = Math.min(Math.max(next, 0), Math.max(slides.length - 1, 0));
67
- if (clamped !== index) {
68
- if (indexProp === undefined) setInternalIndex(clamped);
69
- onIndexChange?.(clamped);
70
- }
71
- };
72
-
73
- const pages = slides.map((slide, i) => (
74
- <View key={i} style={{ width: viewportWidth.current || "100%", paddingRight: gap }}>
75
- {slide}
76
- </View>
77
- ));
78
-
79
- // Off-device there is no ScrollView; the pages still render in a row so the
80
- // component mounts, and the tests drive `handleScroll` through onScroll.
81
- if (!ScrollView) {
82
- return (
83
- <View ref={ref} testID={testID} style={[{ flexDirection: "row", overflow: "hidden" }, style as ViewStyle]} {...props}>
84
- {pages}
85
- </View>
86
- );
87
- }
88
-
89
- return (
90
- <View
91
- ref={ref}
92
- testID={testID}
93
- onLayout={(event: any) => {
94
- viewportWidth.current = event?.nativeEvent?.layout?.width ?? 0;
95
- }}
96
- style={style as ViewStyle}
97
- {...props}
98
- >
99
- <ScrollView
100
- ref={scrollRef}
101
- horizontal
102
- pagingEnabled={gap === 0}
103
- showsHorizontalScrollIndicator={false}
104
- onScroll={handleScroll}
105
- scrollEventThrottle={16}
106
- accessibilityRole="adjustable"
107
- accessibilityLabel="Carousel"
108
- accessibilityValue={{ min: 0, max: Math.max(slides.length - 1, 0), now: index }}
109
- accessibilityActions={[{ name: "increment" }, { name: "decrement" }]}
110
- onAccessibilityAction={(event: any) => {
111
- const step = event?.nativeEvent?.actionName === "increment" ? 1 : -1;
112
- const next = Math.min(Math.max(index + step, 0), Math.max(slides.length - 1, 0));
113
- if (next === index) return;
114
- if (indexProp === undefined) setInternalIndex(next);
115
- onIndexChange?.(next);
116
- }}
117
- >
118
- {pages}
119
- </ScrollView>
120
- </View>
121
- );
122
- });
123
-
124
- // ---------------------------------------------------------------------------
125
- // PageControl
126
-
127
- export interface PageControlProps {
128
- count: number;
129
- /** Controlled active page. Omit and the control keeps its own. */
130
- activeIndex?: number;
131
- defaultActiveIndex?: number;
132
- /** Called when a dot is tapped. */
133
- onChange?: (index: number) => void;
134
- /** Tint the active dot; defaults to the theme accent. */
135
- tint?: string;
136
- /** Hide the dots when there is only one page. */
137
- hidesForSinglePage?: boolean;
138
- style?: StyleProp<ViewStyle>;
139
- isDark?: boolean;
140
- testID?: string;
141
- }
142
-
143
- const DOT = 7;
144
- const ACTIVE_DOT = 18;
145
-
146
- /**
147
- * The page dots.
148
- *
149
- * The active dot elongates and the others stay narrow, which is how iOS reads
150
- * "you are here". The width change runs on the springs token through Animated.
151
- */
152
- export const PageControl = forwardRef<any, PageControlProps>(function PageControl(
153
- {
154
- count,
155
- activeIndex: activeProp,
156
- defaultActiveIndex = 0,
157
- onChange,
158
- tint,
159
- hidesForSinglePage = false,
160
- style,
161
- isDark: isDarkProp,
162
- testID,
163
- ...props
164
- },
165
- ref,
166
- ) {
167
- const isDark = useIsDark(isDarkProp);
168
- const theme = isDark ? colors.dark : colors.light;
169
- const { View, Pressable } = primitives();
170
-
171
- const [internalIndex, setInternalIndex] = useState(defaultActiveIndex);
172
- const active = activeProp !== undefined ? activeProp : internalIndex;
173
-
174
- if (hidesForSinglePage && count <= 1) return null;
175
-
176
- // The accent tints the active dot; the resting dots sit on `glassActive` so
177
- // selection reads the same way it does in SegmentedControl and TabBar.
178
- const accent = tint ?? theme.fill;
179
- const resting = theme.glassActive;
180
-
181
- return (
182
- <View
183
- ref={ref}
184
- testID={testID}
185
- accessibilityRole="tablist"
186
- style={[{ flexDirection: "row", alignItems: "center", gap: 6, alignSelf: "center" }, style as ViewStyle]}
187
- {...props}
188
- >
189
- {Array.from({ length: Math.max(count, 0) }, (_, index) => {
190
- const isActive = index === active;
191
- return (
192
- <Pressable
193
- key={index}
194
- accessibilityRole="tab"
195
- accessibilityLabel={`Page ${index + 1} of ${count}`}
196
- accessibilityState={{ selected: isActive }}
197
- onPress={() => {
198
- if (activeProp === undefined) setInternalIndex(index);
199
- onChange?.(index);
200
- }}
201
- hitSlop={8}
202
- >
203
- <Dot active={isActive} accent={accent} muted={resting} />
204
- </Pressable>
205
- );
206
- })}
207
- </View>
208
- );
209
- });
210
-
211
- /** One dot, whose width springs between the resting and active lengths. */
212
- function Dot({ active, accent, muted }: { active: boolean; accent: string; muted: string }) {
213
- const { Animated, View } = primitives();
214
- const { value: progress, animated } = useSpring(active ? 1 : 0, "snappy");
215
-
216
- const width = animated
217
- ? progress.interpolate({ inputRange: [0, 1], outputRange: [DOT, ACTIVE_DOT] })
218
- : active
219
- ? ACTIVE_DOT
220
- : DOT;
221
-
222
- const style: ViewStyle = {
223
- height: DOT,
224
- borderRadius: DOT / 2,
225
- backgroundColor: active ? accent : muted,
226
- };
227
-
228
- return animated ? (
229
- <Animated.View style={{ ...style, width }} />
230
- ) : (
231
- <View style={{ ...style, width: width as number }} />
232
- );
233
- }