glacia-native 0.5.2 → 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 (381) hide show
  1. package/README.md +84 -17
  2. package/lib/module/Accordion.js +58 -0
  3. package/lib/module/ActionSheet.js +38 -0
  4. package/lib/module/Alert.js +23 -0
  5. package/lib/module/AlertDialog.js +47 -0
  6. package/lib/module/Avatar.js +48 -0
  7. package/lib/module/Badge.js +36 -0
  8. package/lib/module/Bars.js +13 -268
  9. package/lib/module/Button.js +57 -39
  10. package/lib/module/Card.js +31 -19
  11. package/lib/module/Checkbox.js +42 -0
  12. package/lib/module/Chip.js +80 -0
  13. package/lib/module/Collapsible.js +26 -0
  14. package/lib/module/ContextMenu.js +33 -0
  15. package/lib/module/Dialog.js +39 -123
  16. package/lib/module/DropdownMenu.js +33 -0
  17. package/lib/module/Field.js +22 -0
  18. package/lib/module/Glass.js +10 -3
  19. package/lib/module/Group.js +36 -0
  20. package/lib/module/IconButton.js +40 -0
  21. package/lib/module/Input.js +43 -38
  22. package/lib/module/Label.js +17 -0
  23. package/lib/module/MorphGroup.js +47 -0
  24. package/lib/module/Popover.js +29 -0
  25. package/lib/module/Progress.js +32 -0
  26. package/lib/module/RadioGroup.js +51 -0
  27. package/lib/module/Scrim.js +44 -0
  28. package/lib/module/SegmentedControl.js +70 -63
  29. package/lib/module/Select.js +51 -0
  30. package/lib/module/Separator.js +25 -0
  31. package/lib/module/Sheet.js +51 -0
  32. package/lib/module/Skeleton.js +48 -0
  33. package/lib/module/Slider.js +45 -34
  34. package/lib/module/Stepper.js +167 -0
  35. package/lib/module/Switch.js +45 -55
  36. package/lib/module/TabBar.js +50 -44
  37. package/lib/module/Textarea.js +18 -0
  38. package/lib/module/Toast.js +55 -0
  39. package/lib/module/Toggle.js +47 -0
  40. package/lib/module/ToggleGroup.js +56 -0
  41. package/lib/module/Toolbar.js +37 -0
  42. package/lib/module/Tooltip.js +31 -0
  43. package/lib/module/glass-provider.js +28 -0
  44. package/lib/module/glass-stack.js +61 -0
  45. package/lib/module/index.js +78 -109
  46. package/lib/module/internal/GlassBackdrop.js +36 -0
  47. package/lib/module/internal/GlassView.js +43 -11
  48. package/lib/module/internal/blur-community.js +20 -0
  49. package/lib/module/internal/blur-community.web.js +9 -0
  50. package/lib/module/internal/blur.js +6 -9
  51. package/lib/module/internal/glass-routing.js +154 -30
  52. package/lib/module/internal/initials.js +12 -0
  53. package/lib/module/internal/overlay.js +147 -0
  54. package/lib/module/internal/primitives.js +16 -0
  55. package/lib/typescript/Accordion.d.ts +22 -0
  56. package/lib/typescript/ActionSheet.d.ts +24 -0
  57. package/lib/typescript/Alert.d.ts +15 -0
  58. package/lib/typescript/AlertDialog.d.ts +17 -0
  59. package/lib/typescript/Avatar.d.ts +22 -0
  60. package/lib/typescript/Badge.d.ts +12 -0
  61. package/lib/typescript/Bars.d.ts +3 -188
  62. package/lib/typescript/Button.d.ts +44 -10
  63. package/lib/typescript/Card.d.ts +30 -3
  64. package/lib/typescript/Checkbox.d.ts +14 -0
  65. package/lib/typescript/Chip.d.ts +19 -0
  66. package/lib/typescript/Collapsible.d.ts +17 -0
  67. package/lib/typescript/ContextMenu.d.ts +23 -0
  68. package/lib/typescript/Dialog.d.ts +8 -68
  69. package/lib/typescript/DropdownMenu.d.ts +23 -0
  70. package/lib/typescript/Field.d.ts +19 -0
  71. package/lib/typescript/Glass.d.ts +11 -2
  72. package/lib/typescript/Group.d.ts +35 -0
  73. package/lib/typescript/IconButton.d.ts +21 -0
  74. package/lib/typescript/Input.d.ts +17 -18
  75. package/lib/typescript/Label.d.ts +14 -0
  76. package/lib/typescript/MorphGroup.d.ts +46 -0
  77. package/lib/typescript/Popover.d.ts +17 -0
  78. package/lib/typescript/Progress.d.ts +13 -0
  79. package/lib/typescript/RadioGroup.d.ts +21 -0
  80. package/lib/typescript/Scrim.d.ts +33 -0
  81. package/lib/typescript/SegmentedControl.d.ts +24 -13
  82. package/lib/typescript/Select.d.ts +19 -0
  83. package/lib/typescript/Separator.d.ts +10 -0
  84. package/lib/typescript/Sheet.d.ts +45 -0
  85. package/lib/typescript/Skeleton.d.ts +10 -0
  86. package/lib/typescript/Slider.d.ts +15 -7
  87. package/lib/typescript/Stepper.d.ts +49 -0
  88. package/lib/typescript/Switch.d.ts +19 -12
  89. package/lib/typescript/TabBar.d.ts +18 -6
  90. package/lib/typescript/Textarea.d.ts +6 -0
  91. package/lib/typescript/Toast.d.ts +40 -0
  92. package/lib/typescript/Toggle.d.ts +21 -0
  93. package/lib/typescript/ToggleGroup.d.ts +22 -0
  94. package/lib/typescript/Toolbar.d.ts +35 -0
  95. package/lib/typescript/Tooltip.d.ts +16 -0
  96. package/lib/typescript/glass-provider.d.ts +34 -0
  97. package/lib/typescript/glass-stack.d.ts +54 -0
  98. package/lib/typescript/index.d.ts +38 -17
  99. package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
  100. package/lib/typescript/internal/GlassView.d.ts +18 -2
  101. package/lib/typescript/internal/blur-community.d.ts +2 -0
  102. package/lib/typescript/internal/blur-community.web.d.ts +2 -0
  103. package/lib/typescript/internal/glass-routing.d.ts +83 -15
  104. package/lib/typescript/internal/initials.d.ts +2 -0
  105. package/lib/typescript/internal/overlay.d.ts +74 -0
  106. package/lib/typescript/internal/primitives.d.ts +11 -0
  107. package/package.json +4 -2
  108. package/src/Accordion.tsx +165 -0
  109. package/src/ActionSheet.tsx +149 -0
  110. package/src/Alert.tsx +85 -0
  111. package/src/AlertDialog.tsx +124 -0
  112. package/src/Avatar.tsx +102 -0
  113. package/src/Badge.tsx +80 -0
  114. package/src/Bars.tsx +10 -807
  115. package/src/Button.tsx +196 -67
  116. package/src/Card.tsx +105 -32
  117. package/src/Checkbox.tsx +98 -0
  118. package/src/Chip.tsx +149 -0
  119. package/src/Collapsible.tsx +66 -0
  120. package/src/ContextMenu.tsx +103 -0
  121. package/src/Dialog.tsx +85 -335
  122. package/src/DropdownMenu.tsx +103 -0
  123. package/src/Field.tsx +65 -0
  124. package/src/Glass.tsx +15 -5
  125. package/src/Group.tsx +98 -0
  126. package/src/IconButton.tsx +110 -0
  127. package/src/Input.tsx +139 -87
  128. package/src/Label.tsx +56 -0
  129. package/src/MorphGroup.tsx +134 -0
  130. package/src/Popover.tsx +81 -0
  131. package/src/Progress.tsx +83 -0
  132. package/src/RadioGroup.tsx +122 -0
  133. package/src/Scrim.tsx +94 -0
  134. package/src/SegmentedControl.tsx +132 -99
  135. package/src/Select.tsx +136 -0
  136. package/src/Separator.tsx +52 -0
  137. package/src/Sheet.tsx +139 -0
  138. package/src/Skeleton.tsx +77 -0
  139. package/src/Slider.tsx +84 -47
  140. package/src/Stepper.tsx +315 -0
  141. package/src/Switch.tsx +81 -73
  142. package/src/TabBar.tsx +106 -93
  143. package/src/Textarea.tsx +34 -0
  144. package/src/Toast.tsx +131 -0
  145. package/src/Toggle.tsx +113 -0
  146. package/src/ToggleGroup.tsx +129 -0
  147. package/src/Toolbar.tsx +111 -0
  148. package/src/Tooltip.tsx +79 -0
  149. package/src/engine/CHANGELOG.md +430 -0
  150. package/src/engine/NOTICE +54 -0
  151. package/src/engine/README.md +975 -0
  152. package/src/engine/android/build.gradle +18 -0
  153. package/src/engine/android/src/main/AndroidManifest.xml +2 -0
  154. package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
  155. package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
  156. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
  157. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
  158. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
  159. package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
  160. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
  161. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
  162. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
  163. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
  164. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
  165. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
  166. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
  167. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
  168. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
  169. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
  170. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
  171. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
  172. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
  173. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
  174. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
  175. package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
  176. package/src/engine/index.ts +24 -0
  177. package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
  178. package/src/engine/ios/Enums/GlassVariant.swift +86 -0
  179. package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
  180. package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
  181. package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
  182. package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
  183. package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
  184. package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
  185. package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
  186. package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
  187. package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
  188. package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
  189. package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
  190. package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
  191. package/src/engine/ios/Glass/StripCache.swift +545 -0
  192. package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
  193. package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
  194. package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
  195. package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
  196. package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
  197. package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
  198. package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
  199. package/src/engine/package.json +70 -0
  200. package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
  201. package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
  202. package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
  203. package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
  204. package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
  205. package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
  206. package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
  207. package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
  208. package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
  209. package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
  210. package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
  211. package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
  212. package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
  213. package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
  214. package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
  215. package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
  216. package/src/engine/src/components/index.ts +16 -0
  217. package/src/engine/src/constants/index.ts +4 -0
  218. package/src/engine/src/constants/metal.constants.ts +327 -0
  219. package/src/engine/src/constants/metrics.constants.ts +325 -0
  220. package/src/engine/src/constants/springs.constants.ts +107 -0
  221. package/src/engine/src/constants/styles.constants.ts +12 -0
  222. package/src/engine/src/context/glass-group.context.ts +65 -0
  223. package/src/engine/src/context/index.ts +6 -0
  224. package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
  225. package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
  226. package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
  227. package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
  228. package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
  229. package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
  230. package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
  231. package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
  232. package/src/engine/src/core/components/index.ts +4 -0
  233. package/src/engine/src/core/constants/glass.constants.ts +57 -0
  234. package/src/engine/src/core/constants/index.ts +20 -0
  235. package/src/engine/src/core/constants/native.constants.ts +16 -0
  236. package/src/engine/src/core/context/glass-stack.context.ts +30 -0
  237. package/src/engine/src/core/context/index.ts +4 -0
  238. package/src/engine/src/core/enum/index.ts +12 -0
  239. package/src/engine/src/core/index.ts +1 -0
  240. package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
  241. package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
  242. package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
  243. package/src/engine/src/core/interfaces/index.ts +31 -0
  244. package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
  245. package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
  246. package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
  247. package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
  248. package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
  249. package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
  250. package/src/engine/src/core/modules/index.ts +2 -0
  251. package/src/engine/src/core/root/index.ts +51 -0
  252. package/src/engine/src/core/types/glass.types.ts +25 -0
  253. package/src/engine/src/core/types/index.ts +8 -0
  254. package/src/engine/src/core/utils/debug.utils.ts +17 -0
  255. package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
  256. package/src/engine/src/core/utils/hdr.utils.ts +37 -0
  257. package/src/engine/src/core/utils/index.ts +5 -0
  258. package/src/engine/src/core/utils/native-view.utils.ts +33 -0
  259. package/src/engine/src/core/utils/platform.utils.ts +34 -0
  260. package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
  261. package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
  262. package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
  263. package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
  264. package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
  265. package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
  266. package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
  267. package/src/engine/src/core/views/index.ts +4 -0
  268. package/src/engine/src/hooks/index.ts +18 -0
  269. package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
  270. package/src/engine/src/hooks/use-damped-drag.ts +332 -0
  271. package/src/engine/src/hooks/use-echo-filter.ts +55 -0
  272. package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
  273. package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
  274. package/src/engine/src/hooks/use-press-progress.ts +44 -0
  275. package/src/engine/src/index.ts +120 -0
  276. package/src/engine/src/interfaces/index.ts +28 -0
  277. package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
  278. package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
  279. package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
  280. package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
  281. package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
  282. package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
  283. package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
  284. package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
  285. package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
  286. package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
  287. package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
  288. package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
  289. package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
  290. package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
  291. package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
  292. package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
  293. package/src/engine/src/theme/glass-ui-theme.ts +100 -0
  294. package/src/engine/src/theme/index.ts +2 -0
  295. package/src/engine/src/utils/button-press.utils.ts +63 -0
  296. package/src/engine/src/utils/index.ts +3 -0
  297. package/src/engine/src/utils/metal.utils.ts +164 -0
  298. package/src/glass-provider.tsx +60 -0
  299. package/src/glass-stack.tsx +115 -0
  300. package/src/index.ts +47 -190
  301. package/src/internal/GlassBackdrop.tsx +60 -0
  302. package/src/internal/GlassView.tsx +53 -18
  303. package/src/internal/blur-community.ts +19 -0
  304. package/src/internal/blur-community.web.ts +7 -0
  305. package/src/internal/blur.ts +7 -8
  306. package/src/internal/glass-routing.ts +211 -34
  307. package/src/internal/initials.ts +7 -0
  308. package/src/internal/overlay.tsx +258 -0
  309. package/src/internal/primitives.ts +23 -0
  310. package/lib/module/Carousel.js +0 -103
  311. package/lib/module/Display.js +0 -318
  312. package/lib/module/Feedback.js +0 -395
  313. package/lib/module/Form.js +0 -160
  314. package/lib/module/Forms2.js +0 -471
  315. package/lib/module/Message.js +0 -84
  316. package/lib/module/Overlays.js +0 -344
  317. package/lib/module/Pickers.js +0 -243
  318. package/lib/module/Table.js +0 -100
  319. package/lib/module/ai.js +0 -283
  320. package/lib/module/charts/AreaChart.js +0 -32
  321. package/lib/module/charts/BarChart.js +0 -75
  322. package/lib/module/charts/FunnelChart.js +0 -50
  323. package/lib/module/charts/HeatmapChart.js +0 -71
  324. package/lib/module/charts/LineChart.js +0 -81
  325. package/lib/module/charts/PlotChart.js +0 -52
  326. package/lib/module/charts/RadarChart.js +0 -78
  327. package/lib/module/charts/RingChart.js +0 -52
  328. package/lib/module/charts/ScatterChart.js +0 -95
  329. package/lib/module/charts/WaterfallChart.js +0 -85
  330. package/lib/module/charts/advanced.js +0 -313
  331. package/lib/module/charts/extra.js +0 -108
  332. package/lib/module/charts/index.js +0 -50
  333. package/lib/module/charts/scales.js +0 -140
  334. package/lib/typescript/Carousel.d.ts +0 -47
  335. package/lib/typescript/Display.d.ts +0 -178
  336. package/lib/typescript/Feedback.d.ts +0 -196
  337. package/lib/typescript/Form.d.ts +0 -97
  338. package/lib/typescript/Forms2.d.ts +0 -209
  339. package/lib/typescript/Message.d.ts +0 -67
  340. package/lib/typescript/Overlays.d.ts +0 -146
  341. package/lib/typescript/Pickers.d.ts +0 -105
  342. package/lib/typescript/Table.d.ts +0 -64
  343. package/lib/typescript/ai.d.ts +0 -166
  344. package/lib/typescript/charts/AreaChart.d.ts +0 -44
  345. package/lib/typescript/charts/BarChart.d.ts +0 -19
  346. package/lib/typescript/charts/FunnelChart.d.ts +0 -25
  347. package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
  348. package/lib/typescript/charts/LineChart.d.ts +0 -30
  349. package/lib/typescript/charts/PlotChart.d.ts +0 -31
  350. package/lib/typescript/charts/RadarChart.d.ts +0 -27
  351. package/lib/typescript/charts/RingChart.d.ts +0 -28
  352. package/lib/typescript/charts/ScatterChart.d.ts +0 -34
  353. package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
  354. package/lib/typescript/charts/advanced.d.ts +0 -107
  355. package/lib/typescript/charts/extra.d.ts +0 -63
  356. package/lib/typescript/charts/index.d.ts +0 -13
  357. package/lib/typescript/charts/scales.d.ts +0 -35
  358. package/src/Carousel.tsx +0 -233
  359. package/src/Display.tsx +0 -781
  360. package/src/Feedback.tsx +0 -992
  361. package/src/Form.tsx +0 -445
  362. package/src/Forms2.tsx +0 -1055
  363. package/src/Message.tsx +0 -218
  364. package/src/Overlays.tsx +0 -704
  365. package/src/Pickers.tsx +0 -595
  366. package/src/Table.tsx +0 -232
  367. package/src/ai.tsx +0 -715
  368. package/src/charts/AreaChart.tsx +0 -73
  369. package/src/charts/BarChart.tsx +0 -221
  370. package/src/charts/FunnelChart.tsx +0 -125
  371. package/src/charts/HeatmapChart.tsx +0 -155
  372. package/src/charts/LineChart.tsx +0 -247
  373. package/src/charts/PlotChart.tsx +0 -168
  374. package/src/charts/RadarChart.tsx +0 -208
  375. package/src/charts/RingChart.tsx +0 -133
  376. package/src/charts/ScatterChart.tsx +0 -223
  377. package/src/charts/WaterfallChart.tsx +0 -201
  378. package/src/charts/advanced.tsx +0 -676
  379. package/src/charts/extra.tsx +0 -242
  380. package/src/charts/index.ts +0 -86
  381. package/src/charts/scales.ts +0 -163
@@ -1,313 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NativeCandlestickChart = NativeCandlestickChart;
4
- exports.NativeTreemapChart = NativeTreemapChart;
5
- exports.NativeSankeyChart = NativeSankeyChart;
6
- exports.NativeBumpChart = NativeBumpChart;
7
- exports.NativeHexChart = NativeHexChart;
8
- const jsx_runtime_1 = require("react/jsx-runtime");
9
- const react_1 = require("react");
10
- const tokens_1 = require("../internal/tokens");
11
- const motion_1 = require("../internal/motion");
12
- const primitives_1 = require("../internal/primitives");
13
- const scales_1 = require("./scales");
14
- const PADDING = { top: 12, right: 8, bottom: 24, left: 42 };
15
- /**
16
- * Open, high, low and close for each period.
17
- *
18
- * A filled body means the period closed up and a hollow body means it closed
19
- * down, which is the convention traders read without a legend. Each candle is
20
- * tappable to reveal the four prices, replacing the web hover tooltip.
21
- */
22
- function NativeCandlestickChart({ candles, width = 320, height = 200, isDark: isDarkProp, style, onCandlePress, }) {
23
- const [active, setActive] = (0, react_1.useState)(null);
24
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
25
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
26
- const { View, Text, Svg, G, Line, Rect, SvgText } = (0, primitives_1.primitives)();
27
- const up = "#34c759";
28
- const down = "#ff3b30";
29
- const plot = {
30
- x: PADDING.left,
31
- y: PADDING.top,
32
- width: Math.max(0, width - PADDING.left - PADDING.right),
33
- height: Math.max(0, height - PADDING.top - PADDING.bottom),
34
- };
35
- const right = plot.x + plot.width;
36
- const bottom = plot.y + plot.height;
37
- const domain = (0, react_1.useMemo)(() => {
38
- const highs = candles.map((c) => c.high).filter(Number.isFinite);
39
- const lows = candles.map((c) => c.low).filter(Number.isFinite);
40
- if (!highs.length || !lows.length)
41
- return (0, scales_1.niceDomain)(0, 1, 4);
42
- return (0, scales_1.niceDomain)(Math.min(...lows), Math.max(...highs), 4);
43
- }, [candles.map((c) => `${c.high},${c.low}`).join("|")]);
44
- const y = (0, scales_1.linearScale)(domain, [bottom, plot.y], { nice: false });
45
- if (candles.length === 0) {
46
- return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, height, alignItems: "center", justifyContent: "center" }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No candles to display" }) }));
47
- }
48
- const step = plot.width / candles.length;
49
- const bodyWidth = Math.min(14, step * 0.6);
50
- const yTicks = (0, scales_1.ticks)(domain, 4);
51
- return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsxs)(Svg, { width: width, height: height, children: [yTicks.map((tick, i) => ((0, jsx_runtime_1.jsx)(Line, { x1: plot.x, x2: right, y1: y(tick), y2: y(tick), stroke: theme.axis, strokeOpacity: 0.22, strokeWidth: 1 }, `grid-${i}`))), candles.map((candle, index) => {
52
- const rising = candle.close >= candle.open;
53
- const color = rising ? up : down;
54
- const cx = plot.x + step * index + step / 2;
55
- const bodyTop = y(Math.max(candle.open, candle.close));
56
- const bodyBottom = y(Math.min(candle.open, candle.close));
57
- const isActive = active === index;
58
- return ((0, jsx_runtime_1.jsxs)(G, { onPress: () => {
59
- setActive((current) => (current === index ? null : index));
60
- onCandlePress?.(index);
61
- }, children: [(0, jsx_runtime_1.jsx)(Line, { x1: cx, x2: cx, y1: y(candle.high), y2: y(candle.low), stroke: color, strokeWidth: 1 }), (0, jsx_runtime_1.jsx)(Rect, { x: cx - bodyWidth / 2, y: bodyTop, width: bodyWidth, height: Math.max(1, bodyBottom - bodyTop), rx: 1, fill: rising ? color : "transparent", stroke: color, strokeWidth: 1, fillOpacity: isActive ? 1 : 0.9 })] }, candle.label));
62
- }), yTicks.map((tick, i) => ((0, jsx_runtime_1.jsx)(SvgText, { x: plot.x - 6, y: y(tick) + 3, fill: theme.muted, fontSize: 9, textAnchor: "end", children: (0, scales_1.formatValue)(tick, { compact: true }) }, `y-${i}`)))] }), active !== null && candles[active] && ((0, jsx_runtime_1.jsxs)(Text, { style: { fontSize: 10, color: theme.muted, marginTop: 4 }, children: [candles[active].label, " \u00B7 O ", (0, scales_1.formatValue)(candles[active].open), " \u00B7 H", " ", (0, scales_1.formatValue)(candles[active].high), " \u00B7 L ", (0, scales_1.formatValue)(candles[active].low), " \u00B7 C", " ", (0, scales_1.formatValue)(candles[active].close)] }))] }));
63
- }
64
- /**
65
- * Squarified treemap: rectangles sized by value, packed to stay close to square.
66
- *
67
- * A naive slice-and-dice layout produces slivers that cannot hold a label. This
68
- * alternates the split direction and lays each row out along the shorter side,
69
- * so tiles keep a usable aspect ratio.
70
- */
71
- function squarify(values, box, output) {
72
- if (values.length === 0)
73
- return;
74
- if (values.length === 1) {
75
- output.push({ ...box });
76
- return;
77
- }
78
- const total = values.reduce((sum, value) => sum + value, 0);
79
- if (total <= 0) {
80
- // Equal shares when the values carry no weight.
81
- output.push({ ...box });
82
- return;
83
- }
84
- // Split the larger side so both halves stay as square as possible.
85
- let split = 1;
86
- let accumulated = values[0] ?? 0;
87
- let best = Math.abs(accumulated / total - 0.5);
88
- for (let i = 2; i < values.length; i++) {
89
- accumulated += values[i - 1] ?? 0;
90
- const ratio = accumulated / total;
91
- const distance = Math.abs(ratio - 0.5);
92
- if (distance < best) {
93
- best = distance;
94
- split = i;
95
- }
96
- }
97
- const firstShare = values.slice(0, split).reduce((sum, value) => sum + value, 0) / total;
98
- if (box.w >= box.h) {
99
- const w = box.w * firstShare;
100
- squarify(values.slice(0, split), { x: box.x, y: box.y, w, h: box.h }, output);
101
- squarify(values.slice(split), { x: box.x + w, y: box.y, w: box.w - w, h: box.h }, output);
102
- }
103
- else {
104
- const h = box.h * firstShare;
105
- squarify(values.slice(0, split), { x: box.x, y: box.y, w: box.w, h }, output);
106
- squarify(values.slice(split), { x: box.x, y: box.y + h, w: box.w, h: box.h - h }, output);
107
- }
108
- }
109
- /** Proportional rectangles for part-to-whole comparison. */
110
- function NativeTreemapChart({ items, width = 320, height = 200, isDark: isDarkProp, palette, style, onItemPress, }) {
111
- const [active, setActive] = (0, react_1.useState)(null);
112
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
113
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
114
- const { View, Text, Pressable } = (0, primitives_1.primitives)();
115
- if (items.length === 0) {
116
- return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, alignItems: "center", paddingVertical: 20 }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No items to display" }) }));
117
- }
118
- // Larger first keeps the layout stable and the important tiles big.
119
- const ordered = items
120
- .map((item, index) => ({ item, index }))
121
- .sort((a, b) => b.item.value - a.item.value);
122
- const boxes = [];
123
- squarify(ordered.map((entry) => entry.item.value), { x: 0, y: 0, w: width, h: height }, boxes);
124
- return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, height }, style], children: boxes.map((box, i) => {
125
- const entry = ordered[i];
126
- const color = entry.item.color ?? (0, scales_1.seriesColor)(i, palette);
127
- const showLabel = box.w > 46 && box.h > 22;
128
- return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${entry.item.label}: ${(0, scales_1.formatValue)(entry.item.value)}`, onPress: () => {
129
- setActive((current) => (current === entry.index ? null : entry.index));
130
- onItemPress?.(entry.index);
131
- }, style: {
132
- position: "absolute",
133
- left: box.x,
134
- top: box.y,
135
- width: box.w,
136
- height: box.h,
137
- padding: 3,
138
- }, children: (0, jsx_runtime_1.jsx)(View, { style: {
139
- flex: 1,
140
- borderRadius: 4,
141
- backgroundColor: color,
142
- opacity: active === null || active === entry.index ? 0.9 : 0.45,
143
- padding: 4,
144
- justifyContent: "flex-start",
145
- overflow: "hidden",
146
- }, children: showLabel && ((0, jsx_runtime_1.jsx)(Text, { numberOfLines: 1, style: { fontSize: 9, fontWeight: "600", color: "#fff" }, children: entry.item.label })) }) }, entry.item.label));
147
- }) }));
148
- }
149
- /**
150
- * Flow between stages, drawn as stacked columns joined by bands.
151
- *
152
- * Columns are assigned by longest path from a source, so a node always sits
153
- * after everything feeding it. Rendering uses Views rather than SVG because the
154
- * bands are axis-aligned rectangles.
155
- */
156
- function NativeSankeyChart({ nodes, links, width = 320, height = 200, isDark: isDarkProp, palette, style, }) {
157
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
158
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
159
- const { View, Text } = (0, primitives_1.primitives)();
160
- if (nodes.length === 0 || links.length === 0) {
161
- return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, alignItems: "center", paddingVertical: 20 }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No flows to display" }) }));
162
- }
163
- // Longest-path column assignment; cycles fall back to the current depth.
164
- const depth = new Map();
165
- for (const node of nodes)
166
- depth.set(node.id, 0);
167
- for (let pass = 0; pass < nodes.length; pass++) {
168
- let changed = false;
169
- for (const link of links) {
170
- const from = depth.get(link.from) ?? 0;
171
- const current = depth.get(link.to) ?? 0;
172
- if (from + 1 > current) {
173
- depth.set(link.to, from + 1);
174
- changed = true;
175
- }
176
- }
177
- if (!changed)
178
- break;
179
- }
180
- const columns = new Map();
181
- for (const node of nodes) {
182
- const level = depth.get(node.id) ?? 0;
183
- const list = columns.get(level) ?? [];
184
- list.push(node);
185
- columns.set(level, list);
186
- }
187
- const levels = [...columns.keys()].sort((a, b) => a - b);
188
- const columnWidth = 10;
189
- const gap = levels.length > 1 ? (width - columnWidth * levels.length) / (levels.length - 1) : 0;
190
- return ((0, jsx_runtime_1.jsxs)(View, { style: [{ width, height }, style], children: [nodes.map((node) => {
191
- const level = depth.get(node.id) ?? 0;
192
- const columnIndex = levels.indexOf(level);
193
- const siblings = columns.get(level) ?? [node];
194
- const position = siblings.indexOf(node);
195
- const slot = height / siblings.length;
196
- return ((0, jsx_runtime_1.jsx)(View, { style: {
197
- position: "absolute",
198
- left: columnIndex * (columnWidth + gap),
199
- top: position * slot,
200
- width: columnWidth,
201
- height: Math.max(4, slot - 4),
202
- borderRadius: 2,
203
- backgroundColor: (0, scales_1.seriesColor)(columnIndex, palette),
204
- } }, node.id));
205
- }), levels.map((level, i) => ((0, jsx_runtime_1.jsx)(Text, { style: {
206
- position: "absolute",
207
- left: Math.min(width - 40, i * (columnWidth + gap) - 6),
208
- bottom: -16,
209
- fontSize: 9,
210
- color: theme.muted,
211
- width: 52,
212
- textAlign: "center",
213
- }, children: i === 0 ? "Start" : i === levels.length - 1 ? "End" : `Stage ${i}` }, level)))] }));
214
- }
215
- /** Rank changes over time, where the vertical position is the rank itself. */
216
- function NativeBumpChart({ labels, series, width = 320, height = 200, isDark: isDarkProp, palette, style, onPointPress, }) {
217
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
218
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
219
- const { View, Text, Pressable, Svg, G, Line, Circle, SvgText } = (0, primitives_1.primitives)();
220
- const periods = labels.length;
221
- if (periods === 0 || series.length === 0) {
222
- return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, alignItems: "center", paddingVertical: 20 }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No rankings to display" }) }));
223
- }
224
- const allRanks = series.flatMap((entry) => entry.ranks).filter(Number.isFinite);
225
- const worst = allRanks.length ? Math.max(...allRanks) : 1;
226
- const best = allRanks.length ? Math.min(...allRanks) : 1;
227
- const padding = { top: 10, right: 10, bottom: 22, left: 10 };
228
- const plotWidth = Math.max(0, width - padding.left - padding.right);
229
- const plotHeight = Math.max(0, height - padding.top - padding.bottom);
230
- // Rank 1 sits at the top, so the axis is inverted.
231
- const y = (rank) => {
232
- if (worst === best)
233
- return padding.top + plotHeight / 2;
234
- return padding.top + ((rank - best) / (worst - best)) * plotHeight;
235
- };
236
- const x = (period) => padding.left + (periods === 1 ? plotWidth / 2 : (period / (periods - 1)) * plotWidth);
237
- return ((0, jsx_runtime_1.jsx)(View, { style: style, children: (0, jsx_runtime_1.jsxs)(Svg, { width: width, height: height, children: [series.map((entry, si) => {
238
- const color = entry.color ?? (0, scales_1.seriesColor)(si, palette);
239
- return ((0, jsx_runtime_1.jsxs)(G, { children: [entry.ranks.slice(0, -1).map((rank, pi) => {
240
- const next = entry.ranks[pi + 1];
241
- if (next == null)
242
- return null;
243
- return ((0, jsx_runtime_1.jsx)(Line, { x1: x(pi), y1: y(rank), x2: x(pi + 1), y2: y(next), stroke: color, strokeWidth: 2 }, pi));
244
- }), entry.ranks.map((rank, pi) => ((0, jsx_runtime_1.jsx)(Circle, { cx: x(pi), cy: y(rank), r: 4, fill: color, onPress: () => onPointPress?.(si, pi) }, pi)))] }, entry.name));
245
- }), labels.map((label, pi) => ((0, jsx_runtime_1.jsx)(SvgText, { x: x(pi), y: height - 6, fill: theme.muted, fontSize: 9, textAnchor: "middle", children: label }, label)))] }) }));
246
- }
247
- /**
248
- * Points aggregated into hexagonal bins whose colour is the mean value.
249
- *
250
- * Binning keeps thousands of points legible: reading one mark's exact position
251
- * matters less than seeing where density is concentrated.
252
- */
253
- function NativeHexChart({ points, radius = 9, width = 320, height = 200, isDark: isDarkProp, style, onBinPress, }) {
254
- const [active, setActive] = (0, react_1.useState)(null);
255
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
256
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
257
- const { View, Text, Pressable, Svg, G, Path } = (0, primitives_1.primitives)();
258
- if (points.length === 0) {
259
- return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, alignItems: "center", paddingVertical: 20 }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No points to display" }) }));
260
- }
261
- const xs = points.map((point) => point.x);
262
- const ys = points.map((point) => point.y);
263
- const minX = Math.min(...xs);
264
- const maxX = Math.max(...xs) || 1;
265
- const minY = Math.min(...ys);
266
- const maxY = Math.max(...ys) || 1;
267
- const hexWidth = Math.sqrt(3) * radius;
268
- const columns = Math.max(1, Math.floor(width / hexWidth));
269
- const rowHeight = 1.5 * radius;
270
- const rows = Math.max(1, Math.floor(height / rowHeight));
271
- // Bin by nearest grid cell centre.
272
- const bins = new Map();
273
- for (const point of points) {
274
- const col = Math.min(columns - 1, Math.max(0, Math.floor(((point.x - minX) / (maxX - minX || 1)) * columns)));
275
- const row = Math.min(rows - 1, Math.max(0, Math.floor(((point.y - minY) / (maxY - minY || 1)) * rows)));
276
- const key = `${col}:${row}`;
277
- const existing = bins.get(key);
278
- const cx = col * hexWidth + hexWidth / 2 + (row % 2 ? hexWidth / 2 : 0);
279
- const cy = row * rowHeight + rowHeight / 2;
280
- if (existing) {
281
- existing.sum += point.value;
282
- existing.count += 1;
283
- }
284
- else {
285
- bins.set(key, { sum: point.value, count: 1, cx, cy });
286
- }
287
- }
288
- const means = [...bins.values()].map((bin) => bin.sum / bin.count);
289
- const lowest = Math.min(...means);
290
- const highest = Math.max(...means);
291
- const span = highest - lowest;
292
- const hexPath = (cx, cy) => {
293
- const points_ = [];
294
- for (let i = 0; i < 6; i++) {
295
- const angle = (Math.PI / 3) * i - Math.PI / 2;
296
- points_.push(`${cx + radius * Math.cos(angle)},${cy + radius * Math.sin(angle)}`);
297
- }
298
- return "M " + points_.join(" L ") + " Z";
299
- };
300
- return ((0, jsx_runtime_1.jsx)(View, { style: style, children: (0, jsx_runtime_1.jsx)(Svg, { width: width, height: height, children: [...bins.values()].map((bin, index) => {
301
- const mean = bin.sum / bin.count;
302
- const t = span === 0 ? 0.5 : (mean - lowest) / span;
303
- // Blue ramp from low to high density.
304
- const red = Math.round(210 - t * 130);
305
- const green = Math.round(225 - t * 90);
306
- const blue = Math.round(250 - t * 15);
307
- const color = `rgb(${red}, ${green}, ${blue})`;
308
- return ((0, jsx_runtime_1.jsx)(G, { children: (0, jsx_runtime_1.jsx)(Path, { d: hexPath(bin.cx, bin.cy), fill: color, fillOpacity: active === null || active === index ? 1 : 0.4, stroke: theme.edge, strokeWidth: 0.5, onPress: () => {
309
- setActive((current) => (current === index ? null : index));
310
- onBinPress?.(index);
311
- } }) }, index));
312
- }) }) }));
313
- }
@@ -1,108 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NativePolarAreaChart = NativePolarAreaChart;
4
- exports.NativePyramidChart = NativePyramidChart;
5
- exports.NativeLiveLineChart = NativeLiveLineChart;
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_1 = require("react");
8
- const tokens_1 = require("../internal/tokens");
9
- const motion_1 = require("../internal/motion");
10
- const primitives_1 = require("../internal/primitives");
11
- const LineChart_1 = require("./LineChart");
12
- const scales_1 = require("./scales");
13
- const TAU = Math.PI * 2;
14
- /** Point on a circle at `angle` radians, measured from 12 o'clock. */
15
- function polar(angle, radius, cx, cy) {
16
- return { x: cx + Math.sin(angle) * radius, y: cy - Math.cos(angle) * radius };
17
- }
18
- /**
19
- * Equal-angle wedges whose radius encodes value.
20
- *
21
- * Unlike a pie chart, every wedge uses the same angle, so the reader compares
22
- * one dimension (radius) rather than area. Each wedge is separately tappable
23
- * because a phone has no hover.
24
- */
25
- function NativePolarAreaChart({ segments, size = 240, max, isDark: isDarkProp, palette, style, onSegmentPress, }) {
26
- const [active, setActive] = (0, react_1.useState)(null);
27
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
28
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
29
- const { View, Text, Pressable, Svg, G, Path, Circle } = (0, primitives_1.primitives)();
30
- if (segments.length === 0) {
31
- return ((0, jsx_runtime_1.jsx)(View, { style: [{ width: size, alignItems: "center", paddingVertical: 20 }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No segments to display" }) }));
32
- }
33
- const centre = size / 2;
34
- const outer = centre - 8;
35
- const highest = Math.max(...segments.map((segment) => segment.value));
36
- const scaleMax = max ?? (highest || 1);
37
- const step = TAU / segments.length;
38
- return ((0, jsx_runtime_1.jsxs)(View, { style: [{ width: size }, style], children: [(0, jsx_runtime_1.jsxs)(Svg, { width: size, height: size, children: [segments.map((segment, index) => {
39
- const ratio = Math.max(0.04, Math.min(1, segment.value / scaleMax));
40
- const radius = outer * ratio;
41
- const start = index * step - step / 2;
42
- const end = start + step;
43
- const from = polar(start, radius, centre, centre);
44
- const to = polar(end, radius, centre, centre);
45
- const color = segment.color ?? (0, scales_1.seriesColor)(index, palette);
46
- // Large-arc is always 0 here: a wedge never exceeds half the circle.
47
- const path = [
48
- `M ${centre} ${centre}`,
49
- `L ${from.x} ${from.y}`,
50
- `A ${radius} ${radius} 0 0 1 ${to.x} ${to.y}`,
51
- "Z",
52
- ].join(" ");
53
- return ((0, jsx_runtime_1.jsx)(Path, { d: path, fill: color, fillOpacity: active === null || active === index ? 0.85 : 0.4, stroke: theme.edge, strokeWidth: 1, onPress: () => {
54
- setActive((current) => (current === index ? null : index));
55
- onSegmentPress?.(index);
56
- } }, segment.label));
57
- }), (0, jsx_runtime_1.jsx)(Circle, { cx: centre, cy: centre, r: outer * 0.18, fill: theme.glass })] }), (0, jsx_runtime_1.jsx)(View, { style: { flexDirection: "row", flexWrap: "wrap", gap: 8, marginTop: 8 }, children: segments.map((segment, index) => ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${segment.label}: ${(0, scales_1.formatValue)(segment.value)}`, onPress: () => {
58
- setActive((current) => (current === index ? null : index));
59
- onSegmentPress?.(index);
60
- }, style: { flexDirection: "row", alignItems: "center", gap: 4 }, children: [(0, jsx_runtime_1.jsx)(View, { style: {
61
- width: 8,
62
- height: 8,
63
- borderRadius: 4,
64
- backgroundColor: segment.color ?? (0, scales_1.seriesColor)(index, palette),
65
- } }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 10, color: theme.muted }, children: segment.label })] }, segment.label))) })] }));
66
- }
67
- /**
68
- * Stacked bands that narrow toward the top.
69
- *
70
- * Bands are Views rather than SVG: each is a centred rectangle whose width is
71
- * the band's share of the widest level, which native layout computes exactly.
72
- */
73
- function NativePyramidChart({ levels, levelHeight = 34, width = 320, isDark: isDarkProp, palette, style, onLevelPress, }) {
74
- const [active, setActive] = (0, react_1.useState)(null);
75
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
76
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
77
- const { View, Text, Pressable } = (0, primitives_1.primitives)();
78
- if (levels.length === 0) {
79
- return ((0, jsx_runtime_1.jsx)(View, { style: [{ width, alignItems: "center", paddingVertical: 20 }, style], children: (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.muted, fontSize: 12 }, children: "No levels to display" }) }));
80
- }
81
- const widest = Math.max(...levels.map((level) => level.value)) || 1;
82
- return ((0, jsx_runtime_1.jsx)(View, { style: [{ width }, style], children: levels.map((level, index) => {
83
- const share = Math.max(0.06, level.value / widest);
84
- const color = level.color ?? (0, scales_1.seriesColor)(index, palette);
85
- return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${level.label}: ${(0, scales_1.formatValue)(level.value)}`, onPress: () => {
86
- setActive((current) => (current === index ? null : index));
87
- onLevelPress?.(index);
88
- }, style: { alignItems: "center", marginBottom: 2 }, children: (0, jsx_runtime_1.jsx)(View, { style: {
89
- width: `${share * 100}%`,
90
- height: levelHeight,
91
- borderRadius: 4,
92
- backgroundColor: color,
93
- opacity: active === null || active === index ? 1 : 0.45,
94
- alignItems: "center",
95
- justifyContent: "center",
96
- }, children: (0, jsx_runtime_1.jsxs)(Text, { style: { fontSize: 10, fontWeight: "600", color: "#fff" }, numberOfLines: 1, children: [level.label, " \u00B7 ", (0, scales_1.formatValue)(level.value, { compact: true })] }) }) }, level.label));
97
- }) }));
98
- }
99
- /**
100
- * A line chart that keeps only the most recent window of points.
101
- *
102
- * The caller pushes new values; this trims to `labels.length` so the window
103
- * slides instead of growing without bound. Pausing is the caller's decision —
104
- * a chart that stops itself would hide data the user expects to see arrive.
105
- */
106
- function NativeLiveLineChart(props) {
107
- return (0, jsx_runtime_1.jsx)(LineChart_1.NativeLineChart, { ...props, smooth: false, showDots: false });
108
- }
@@ -1,50 +0,0 @@
1
- "use strict";
2
- // Native charts, drawn with react-native-svg.
3
- //
4
- // These share their scale maths and colour ramp with the web package, so the
5
- // same series produces the same axis values on both platforms. Touch replaces
6
- // hover: tapping a bar, point or slice selects it.
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.NativePlotChart = exports.NativeHexChart = exports.NativeBumpChart = exports.NativeSankeyChart = exports.NativeTreemapChart = exports.NativeCandlestickChart = exports.NativeLiveLineChart = exports.NativePyramidChart = exports.NativePolarAreaChart = exports.SERIES_COLORS = exports.seriesColor = exports.formatValue = exports.arcPath = exports.smoothPath = exports.bandScale = exports.ticks = exports.niceDomain = exports.linearScale = exports.NativeWaterfallChart = exports.NativeRadarChart = exports.NativeHeatmapChart = exports.NativeFunnelChart = exports.NativeBubbleChart = exports.NativeScatterChart = exports.NativeMirrorAreaChart = exports.NativeAreaChart = exports.NativeRingChart = exports.NativeBarChart = exports.NativeLineChart = void 0;
9
- var LineChart_1 = require("./LineChart");
10
- Object.defineProperty(exports, "NativeLineChart", { enumerable: true, get: function () { return LineChart_1.NativeLineChart; } });
11
- var BarChart_1 = require("./BarChart");
12
- Object.defineProperty(exports, "NativeBarChart", { enumerable: true, get: function () { return BarChart_1.NativeBarChart; } });
13
- var RingChart_1 = require("./RingChart");
14
- Object.defineProperty(exports, "NativeRingChart", { enumerable: true, get: function () { return RingChart_1.NativeRingChart; } });
15
- var AreaChart_1 = require("./AreaChart");
16
- Object.defineProperty(exports, "NativeAreaChart", { enumerable: true, get: function () { return AreaChart_1.NativeAreaChart; } });
17
- Object.defineProperty(exports, "NativeMirrorAreaChart", { enumerable: true, get: function () { return AreaChart_1.NativeMirrorAreaChart; } });
18
- var ScatterChart_1 = require("./ScatterChart");
19
- Object.defineProperty(exports, "NativeScatterChart", { enumerable: true, get: function () { return ScatterChart_1.NativeScatterChart; } });
20
- Object.defineProperty(exports, "NativeBubbleChart", { enumerable: true, get: function () { return ScatterChart_1.NativeBubbleChart; } });
21
- var FunnelChart_1 = require("./FunnelChart");
22
- Object.defineProperty(exports, "NativeFunnelChart", { enumerable: true, get: function () { return FunnelChart_1.NativeFunnelChart; } });
23
- var HeatmapChart_1 = require("./HeatmapChart");
24
- Object.defineProperty(exports, "NativeHeatmapChart", { enumerable: true, get: function () { return HeatmapChart_1.NativeHeatmapChart; } });
25
- var RadarChart_1 = require("./RadarChart");
26
- Object.defineProperty(exports, "NativeRadarChart", { enumerable: true, get: function () { return RadarChart_1.NativeRadarChart; } });
27
- var WaterfallChart_1 = require("./WaterfallChart");
28
- Object.defineProperty(exports, "NativeWaterfallChart", { enumerable: true, get: function () { return WaterfallChart_1.NativeWaterfallChart; } });
29
- var scales_1 = require("./scales");
30
- Object.defineProperty(exports, "linearScale", { enumerable: true, get: function () { return scales_1.linearScale; } });
31
- Object.defineProperty(exports, "niceDomain", { enumerable: true, get: function () { return scales_1.niceDomain; } });
32
- Object.defineProperty(exports, "ticks", { enumerable: true, get: function () { return scales_1.ticks; } });
33
- Object.defineProperty(exports, "bandScale", { enumerable: true, get: function () { return scales_1.bandScale; } });
34
- Object.defineProperty(exports, "smoothPath", { enumerable: true, get: function () { return scales_1.smoothPath; } });
35
- Object.defineProperty(exports, "arcPath", { enumerable: true, get: function () { return scales_1.arcPath; } });
36
- Object.defineProperty(exports, "formatValue", { enumerable: true, get: function () { return scales_1.formatValue; } });
37
- Object.defineProperty(exports, "seriesColor", { enumerable: true, get: function () { return scales_1.seriesColor; } });
38
- Object.defineProperty(exports, "SERIES_COLORS", { enumerable: true, get: function () { return scales_1.SERIES_COLORS; } });
39
- var extra_1 = require("./extra");
40
- Object.defineProperty(exports, "NativePolarAreaChart", { enumerable: true, get: function () { return extra_1.NativePolarAreaChart; } });
41
- Object.defineProperty(exports, "NativePyramidChart", { enumerable: true, get: function () { return extra_1.NativePyramidChart; } });
42
- Object.defineProperty(exports, "NativeLiveLineChart", { enumerable: true, get: function () { return extra_1.NativeLiveLineChart; } });
43
- var advanced_1 = require("./advanced");
44
- Object.defineProperty(exports, "NativeCandlestickChart", { enumerable: true, get: function () { return advanced_1.NativeCandlestickChart; } });
45
- Object.defineProperty(exports, "NativeTreemapChart", { enumerable: true, get: function () { return advanced_1.NativeTreemapChart; } });
46
- Object.defineProperty(exports, "NativeSankeyChart", { enumerable: true, get: function () { return advanced_1.NativeSankeyChart; } });
47
- Object.defineProperty(exports, "NativeBumpChart", { enumerable: true, get: function () { return advanced_1.NativeBumpChart; } });
48
- Object.defineProperty(exports, "NativeHexChart", { enumerable: true, get: function () { return advanced_1.NativeHexChart; } });
49
- var PlotChart_1 = require("./PlotChart");
50
- Object.defineProperty(exports, "NativePlotChart", { enumerable: true, get: function () { return PlotChart_1.NativePlotChart; } });
@@ -1,140 +0,0 @@
1
- "use strict";
2
- // Native chart scales.
3
- //
4
- // This mirrors the web package's chart maths so a series drawn on a phone and
5
- // the same series drawn in a browser land on the same axis values. It is
6
- // deliberately duplicated rather than imported from `glacia`: glacia-native is
7
- // a standalone package with no dependency on the web build.
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.seriesColor = exports.SERIES_COLORS = void 0;
10
- exports.linearScale = linearScale;
11
- exports.niceDomain = niceDomain;
12
- exports.ticks = ticks;
13
- exports.bandScale = bandScale;
14
- exports.formatValue = formatValue;
15
- exports.smoothPath = smoothPath;
16
- exports.arcPath = arcPath;
17
- function linearScale(domain, range, options = {}) {
18
- let [d0, d1] = domain;
19
- if (d0 === d1) {
20
- d0 = d0 === 0 ? 0 : d0 * 0.9;
21
- d1 = d1 === 0 ? 1 : d1 * 1.1;
22
- }
23
- const base = options.nice === false ? [d0, d1] : niceDomain(d0, d1, options.ticks ?? 5);
24
- const [a, b] = base;
25
- const [r0, r1] = range;
26
- const span = b - a || 1;
27
- const scale = ((value) => r0 + ((value - a) / span) * (r1 - r0));
28
- scale.invert = (pixel) => a + ((pixel - r0) / (r1 - r0)) * span;
29
- scale.domain = [a, b];
30
- scale.range = range;
31
- return scale;
32
- }
33
- /** Rounds a domain outward to values that read cleanly on an axis. */
34
- function niceDomain(min, max, tickCount = 5) {
35
- if (min === max)
36
- return [min === 0 ? 0 : min * 0.9, max === 0 ? 1 : max * 1.1];
37
- const span = max - min;
38
- const step = Math.pow(10, Math.floor(Math.log10(span / tickCount)));
39
- const error = span / tickCount / step;
40
- const factor = error >= 7.5 ? 10 : error >= 3.5 ? 5 : error >= 1.5 ? 2 : 1;
41
- const niceStep = step * factor;
42
- return [Math.floor(min / niceStep) * niceStep, Math.ceil(max / niceStep) * niceStep];
43
- }
44
- function ticks(domain, count = 4) {
45
- const [d0, d1] = domain;
46
- if (d0 === d1)
47
- return [d0];
48
- return Array.from({ length: count + 1 }, (_, i) => d0 + ((d1 - d0) * i) / count);
49
- }
50
- /** Evenly divided bands; returns the centre and width of each. */
51
- function bandScale(count, range, padding = 0.2) {
52
- const [r0, r1] = range;
53
- const step = (r1 - r0) / Math.max(1, count);
54
- const width = step * (1 - padding);
55
- return {
56
- bandWidth: step,
57
- width,
58
- start: (i) => r0 + i * step + (step - width) / 2,
59
- center: (i) => r0 + i * step + step / 2,
60
- };
61
- }
62
- /** Compact number formatting, matching the web charts. */
63
- function formatValue(value, options = {}) {
64
- if (Number.isNaN(value))
65
- return "—";
66
- if (options.compact) {
67
- const abs = Math.abs(value);
68
- if (abs >= 1_000_000_000)
69
- return trim(value / 1_000_000_000) + "B";
70
- if (abs >= 1_000_000)
71
- return trim(value / 1_000_000) + "M";
72
- if (abs >= 1_000)
73
- return trim(value / 1_000) + "k";
74
- }
75
- const fixed = options.decimals ?? (Number.isInteger(value) ? 0 : 2);
76
- return value
77
- .toFixed(fixed)
78
- .replace(/(\.\d*?)0+$/, "$1")
79
- .replace(/\.$/, "");
80
- }
81
- function trim(value) {
82
- return (Math.round(value * 10) / 10).toString();
83
- }
84
- /** Points along a smooth (monotone) path, as SVG path segments. */
85
- function smoothPath(points) {
86
- if (points.length === 0)
87
- return "";
88
- if (points.length === 1)
89
- return `M ${points[0].x} ${points[0].y}`;
90
- if (points.length === 2)
91
- return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;
92
- let d = `M ${points[0].x} ${points[0].y}`;
93
- for (let i = 0; i < points.length - 1; i++) {
94
- const p0 = points[i - 1] ?? points[i];
95
- const p1 = points[i];
96
- const p2 = points[i + 1];
97
- const p3 = points[i + 2] ?? p2;
98
- const t = 0.2;
99
- const c1x = p1.x + (p2.x - p0.x) * t;
100
- const c1y = p1.y + (p2.y - p0.y) * t;
101
- const c2x = p2.x - (p3.x - p1.x) * t;
102
- const c2y = p2.y - (p3.y - p1.y) * t;
103
- // Clamp so the curve cannot overshoot the segment's own y-range.
104
- const lo = Math.min(p1.y, p2.y);
105
- const hi = Math.max(p1.y, p2.y);
106
- d += ` C ${c1x} ${Math.min(hi, Math.max(lo, c1y))} ${c2x} ${Math.min(hi, Math.max(lo, c2y))} ${p2.x} ${p2.y}`;
107
- }
108
- return d;
109
- }
110
- /** A pie/donut arc, with an optional inner radius. */
111
- function arcPath(cx, cy, outer, inner, startAngle, endAngle) {
112
- const sweep = endAngle - startAngle;
113
- if (sweep >= Math.PI * 2 - 1e-6) {
114
- const mid = startAngle + Math.PI;
115
- return (arcPath(cx, cy, outer, inner, startAngle, mid) +
116
- " " +
117
- arcPath(cx, cy, outer, inner, mid, endAngle - 1e-6));
118
- }
119
- const p = (r, a) => [cx + r * Math.cos(a), cy + r * Math.sin(a)];
120
- const large = sweep > Math.PI ? 1 : 0;
121
- const [x1, y1] = p(outer, startAngle);
122
- const [x2, y2] = p(outer, endAngle);
123
- if (inner <= 0) {
124
- return `M ${cx} ${cy} L ${x1} ${y1} A ${outer} ${outer} 0 ${large} 1 ${x2} ${y2} Z`;
125
- }
126
- const [x3, y3] = p(inner, endAngle);
127
- const [x4, y4] = p(inner, startAngle);
128
- return `M ${x1} ${y1} A ${outer} ${outer} 0 ${large} 1 ${x2} ${y2} L ${x3} ${y3} A ${inner} ${inner} 0 ${large} 0 ${x4} ${y4} Z`;
129
- }
130
- exports.SERIES_COLORS = [
131
- "#0088ff",
132
- "#34c759",
133
- "#ff9f0a",
134
- "#ff375f",
135
- "#bf5af2",
136
- "#64d2ff",
137
- "#ffd60a",
138
- ];
139
- const seriesColor = (index, palette) => (palette ?? exports.SERIES_COLORS)[index % (palette ?? exports.SERIES_COLORS).length];
140
- exports.seriesColor = seriesColor;
@@ -1,47 +0,0 @@
1
- import { type ReactNode } from "react";
2
- import type { StyleProp, ViewStyle } from "react-native";
3
- export interface CarouselProps {
4
- /** One node per page. */
5
- slides: ReactNode[];
6
- /** Controlled page. Omit and the carousel tracks itself. */
7
- index?: number;
8
- defaultIndex?: number;
9
- /** Fires when a swipe settles on a new page. */
10
- onIndexChange?: (index: number) => void;
11
- /** Gap between pages, so neighbours peek at the edges. */
12
- gap?: number;
13
- style?: StyleProp<ViewStyle>;
14
- isDark?: boolean;
15
- testID?: string;
16
- }
17
- /**
18
- * A horizontally paging swiper.
19
- *
20
- * It rides the resolver's ScrollView with `pagingEnabled`, so the paging feel is
21
- * the platform's own and the pages are plain content the caller supplies. The
22
- * active page is derived from the scroll offset, which is also what reports
23
- * `onIndexChange`.
24
- */
25
- export declare const Carousel: import("react").ForwardRefExoticComponent<CarouselProps & import("react").RefAttributes<any>>;
26
- export interface PageControlProps {
27
- count: number;
28
- /** Controlled active page. Omit and the control keeps its own. */
29
- activeIndex?: number;
30
- defaultActiveIndex?: number;
31
- /** Called when a dot is tapped. */
32
- onChange?: (index: number) => void;
33
- /** Tint the active dot; defaults to the theme accent. */
34
- tint?: string;
35
- /** Hide the dots when there is only one page. */
36
- hidesForSinglePage?: boolean;
37
- style?: StyleProp<ViewStyle>;
38
- isDark?: boolean;
39
- testID?: string;
40
- }
41
- /**
42
- * The page dots.
43
- *
44
- * The active dot elongates and the others stay narrow, which is how iOS reads
45
- * "you are here". The width change runs on the springs token through Animated.
46
- */
47
- export declare const PageControl: import("react").ForwardRefExoticComponent<PageControlProps & import("react").RefAttributes<any>>;