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,471 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Combobox = exports.ColorPicker = exports.DEFAULT_PALETTE = exports.ButtonGroup = exports.InputOTP = exports.ToggleGroup = exports.Toggle = exports.Stepper = void 0;
4
- exports.hexToRgb = hexToRgb;
5
- exports.hueGradientColors = hueGradientColors;
6
- exports.rgbToHex = rgbToHex;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
9
- const Glass_1 = require("./Glass");
10
- const tokens_1 = require("./internal/tokens");
11
- const primitives_1 = require("./internal/primitives");
12
- const motion_1 = require("./internal/motion");
13
- const lens_1 = require("./internal/lens");
14
- /**
15
- * Minus / value / plus.
16
- *
17
- * The same interaction contract Slider established: `adjustable` with
18
- * increment and decrement accessibility actions, and clamping at min and max
19
- * rather than wrapping or drifting past the range.
20
- */
21
- exports.Stepper = (0, react_1.forwardRef)(function Stepper({ value: valueProp, defaultValue = 0, onValueChange, min = 0, max = 100, step = 1, disabled = false, accessibilityLabel, formatValue, style, isDark: isDarkProp, testID, ...props }, ref) {
22
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
23
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
24
- const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
25
- const [internal, setInternal] = (0, react_1.useState)(defaultValue);
26
- const value = valueProp !== undefined ? valueProp : internal;
27
- const apply = (next) => {
28
- const clamped = Math.min(Math.max(next, min), max);
29
- if (clamped === value)
30
- return;
31
- if (valueProp === undefined)
32
- setInternal(clamped);
33
- onValueChange?.(clamped);
34
- };
35
- const atMin = value <= min;
36
- const atMax = value >= max;
37
- const stepButton = (label, sign, action, blocked) => ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { disabled: disabled || blocked }, disabled: disabled || blocked, onPress: action, style: { width: 46, height: 34, alignItems: "center", justifyContent: "center", opacity: disabled || blocked ? 0.38 : 1 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 17, fontWeight: "500", color: theme.foreground, lineHeight: 20 }, children: sign }) }));
38
- return ((0, jsx_runtime_1.jsxs)(Glass_1.Glass, { ref: ref, effect: "regular", surface: "control", isDark: isDark, testID: testID, accessibilityRole: "adjustable", accessibilityLabel: accessibilityLabel, accessibilityValue: { min, max, now: value }, accessibilityActions: [{ name: "increment" }, { name: "decrement" }], onAccessibilityAction: (event) => {
39
- const delta = event?.nativeEvent?.actionName === "increment" ? step : -step;
40
- apply(value + delta);
41
- }, style: {
42
- flexDirection: "row",
43
- alignItems: "center",
44
- alignSelf: "flex-start",
45
- height: 34,
46
- borderRadius: tokens_1.radii.pill,
47
- paddingHorizontal: 2,
48
- opacity: disabled ? 0.38 : 1,
49
- ...style,
50
- }, ...props, children: [stepButton(`Decrease ${accessibilityLabel}`, "\u2212", () => apply(value - step), atMin), (0, jsx_runtime_1.jsx)(View, { style: { minWidth: 44, alignItems: "center", justifyContent: "center" }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 16, fontWeight: "600", color: theme.foreground }, numberOfLines: 1, children: formatValue ? formatValue(value) : String(value) }) }), stepButton(`Increase ${accessibilityLabel}`, "+", () => apply(value + step), atMax)] }));
51
- });
52
- const toggleSizes = { sm: 30, md: 34, lg: 44 };
53
- /**
54
- * A button that stays pressed.
55
- *
56
- * Distinct from Switch: this is a button with an on-state (bold, favourite,
57
- * pinned), not a setting. It reports `selected`, which is what web's Toggle
58
- * announces.
59
- */
60
- exports.Toggle = (0, react_1.forwardRef)(function Toggle({ pressed: pressedProp, defaultPressed = false, onPressedChange, selected, icon, children, variant = "glass", size = "md", disabled = false, accessibilityLabel, style, isDark: isDarkProp, testID, ...props }, ref) {
61
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
62
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
63
- const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
64
- // `selected` is accepted as an alias so the controlled prop matches web.
65
- const controlled = pressedProp !== undefined ? pressedProp : selected;
66
- const [internal, setInternal] = (0, react_1.useState)(defaultPressed);
67
- const isPressed = controlled !== undefined ? controlled : internal;
68
- const [held, setHeld] = (0, react_1.useState)(false);
69
- const dimension = toggleSizes[size];
70
- const handlePress = () => {
71
- const next = !isPressed;
72
- if (controlled === undefined)
73
- setInternal(next);
74
- onPressedChange?.(next);
75
- };
76
- return ((0, jsx_runtime_1.jsx)(Pressable, { ref: ref, testID: testID, accessibilityRole: "button", accessibilityLabel: accessibilityLabel ?? (typeof children === "string" ? children : undefined), accessibilityState: { selected: isPressed, disabled }, disabled: disabled, onPress: handlePress, onPressIn: () => setHeld(true), onPressOut: () => setHeld(false), style: ({ pressed }) => ({ alignSelf: "flex-start", opacity: disabled ? 0.38 : pressed ? 0.8 : 1 }), ...props, children: (0, jsx_runtime_1.jsxs)(Glass_1.Glass, { effect: variant === "ghost" ? "none" : "regular", surface: "control", pressed: held, interactive: !disabled && variant !== "ghost", isDark: isDark, tintColor: isPressed && variant !== "ghost" ? theme.glassActive : undefined, style: {
77
- height: dimension,
78
- borderRadius: tokens_1.radii.pill,
79
- paddingHorizontal: icon && !children ? 0 : 12,
80
- width: icon && !children ? dimension : undefined,
81
- flexDirection: "row",
82
- alignItems: "center",
83
- justifyContent: "center",
84
- gap: 6,
85
- backgroundColor: variant === "ghost" ? "transparent" : undefined,
86
- ...style,
87
- }, children: [icon ? (0, jsx_runtime_1.jsx)(View, { children: icon }) : null, typeof children === "string" ? ((0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: {
88
- fontSize: size === "sm" ? 12 : size === "lg" ? 15 : 14,
89
- fontWeight: isPressed ? "600" : "500",
90
- color: isPressed ? theme.foreground : theme.muted,
91
- }, children: children })) : (children)] }) }));
92
- });
93
- /**
94
- * A row of toggles acting as one choice.
95
- *
96
- * Built from the same pieces as SegmentedControl — one glass container, toggles
97
- * inside it, `glassActive` marking the active ones — but each item carries the
98
- * button styling of Toggle.
99
- */
100
- exports.ToggleGroup = (0, react_1.forwardRef)(function ToggleGroup({ items, multiple = false, value: valueProp, defaultValue, onValueChange, size = "md", disabled = false, accessibilityLabel = "Toggle group", style, isDark: isDarkProp, testID, ...props }, ref) {
101
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
102
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
103
- const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
104
- const initial = defaultValue ?? (multiple ? [] : "");
105
- const [internal, setInternal] = (0, react_1.useState)(initial);
106
- const selection = valueProp !== undefined ? valueProp : internal;
107
- const isOn = (value) => Array.isArray(selection) ? selection.includes(value) : selection === value;
108
- const toggle = (value) => {
109
- let next;
110
- if (multiple) {
111
- const current = Array.isArray(selection) ? selection : [];
112
- next = current.includes(value) ? current.filter((v) => v !== value) : [...current, value];
113
- }
114
- else {
115
- // Single mode: the same item pressed again clears it, as Toggle does.
116
- next = selection === value ? "" : value;
117
- }
118
- if (valueProp === undefined)
119
- setInternal(next);
120
- onValueChange?.(next);
121
- };
122
- const height = size === "sm" ? 30 : size === "lg" ? 42 : 36;
123
- return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { ref: ref, effect: "regular", surface: "control", isDark: isDark, testID: testID, accessibilityRole: "radiogroup", accessibilityLabel: accessibilityLabel, style: {
124
- flexDirection: "row",
125
- alignItems: "center",
126
- alignSelf: "flex-start",
127
- padding: 3,
128
- gap: 3,
129
- borderRadius: tokens_1.radii.pill,
130
- // The web makes the group's own surface near-solid for legibility; the
131
- // selected item is the glass lens on top of it.
132
- backgroundColor: theme.surface,
133
- shadowOpacity: 0.08,
134
- shadowRadius: 8,
135
- shadowOffset: { width: 0, height: 2 },
136
- ...style,
137
- }, ...props, children: items.map((item) => {
138
- const on = isOn(item.value);
139
- return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: item.label, accessibilityState: { selected: on, disabled }, disabled: disabled, onPress: () => toggle(item.value), style: { opacity: disabled ? 0.38 : 1 }, children: (0, jsx_runtime_1.jsxs)(View, { style: {
140
- height: height - 6,
141
- paddingHorizontal: 14,
142
- borderRadius: tokens_1.radii.pill,
143
- flexDirection: "row",
144
- alignItems: "center",
145
- justifyContent: "center",
146
- gap: 6,
147
- backgroundColor: "transparent",
148
- }, children: [on ? (0, jsx_runtime_1.jsx)(lens_1.SelectedLens, { radius: tokens_1.radii.pill, isDark: isDark, style: lens_1.lensFill }) : null, item.icon ? (0, jsx_runtime_1.jsx)(View, { children: item.icon }) : null, (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: { fontSize: 13, fontWeight: on ? "600" : "500", color: on ? theme.foreground : theme.muted }, children: item.label })] }) }, item.value));
149
- }) }));
150
- });
151
- /**
152
- * A verification-code row.
153
- *
154
- * One real text field drives the boxes. Keeping a single field — rather than N
155
- * inputs — is what makes paste and autofill fill every box in one go, and it is
156
- * what keeps the caret and keyboard behaviour sane across platforms.
157
- */
158
- exports.InputOTP = (0, react_1.forwardRef)(function InputOTP({ value: valueProp, defaultValue = "", onChange, onComplete, length = 6, disabled = false, accessibilityLabel = "Verification code", style, isDark: isDarkProp, testID, ...props }, ref) {
159
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
160
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
161
- const { View, Text: RNText, TextInput } = (0, primitives_1.primitives)();
162
- const [internal, setInternal] = (0, react_1.useState)(defaultValue);
163
- const value = valueProp !== undefined ? valueProp : internal;
164
- // The code is digits only, and never longer than the boxes available.
165
- const normalise = (raw) => raw.replace(/[^0-9]/g, "").slice(0, length);
166
- const handleChange = (raw) => {
167
- const next = normalise(raw);
168
- if (valueProp === undefined)
169
- setInternal(next);
170
- onChange?.(next);
171
- if (next.length === length)
172
- onComplete?.(next);
173
- };
174
- const focusedIndex = Math.min(value.length, length - 1);
175
- return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, style: [{ flexDirection: "row", alignItems: "center", gap: 8, alignSelf: "flex-start" }, style], ...props, children: [Array.from({ length }, (_, index) => {
176
- const char = value[index] ?? "";
177
- const isActive = index === focusedIndex && !disabled;
178
- return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { effect: "regular", surface: "field", isDark: isDark, tintColor: isActive ? theme.glassActive : undefined, style: {
179
- width: 44,
180
- height: 52,
181
- borderRadius: tokens_1.radii.md,
182
- alignItems: "center",
183
- justifyContent: "center",
184
- borderColor: isActive ? theme.fill : theme.edge,
185
- opacity: disabled ? 0.38 : 1,
186
- }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 22, fontWeight: "600", color: theme.foreground }, children: char }) }, index));
187
- }), (0, jsx_runtime_1.jsx)(TextInput, { accessibilityRole: "text", accessibilityLabel: accessibilityLabel, accessibilityValue: { text: value }, value: value, onChangeText: handleChange, editable: !disabled, keyboardType: "number-pad", maxLength: length, textContentType: "oneTimeCode", autoComplete: "one-time-code", style: {
188
- position: "absolute",
189
- left: 0,
190
- right: 0,
191
- top: 0,
192
- bottom: 0,
193
- // Invisible but present: the boxes are the visible representation.
194
- opacity: 0.02,
195
- color: "transparent",
196
- } })] }));
197
- });
198
- /**
199
- * A connected row of buttons.
200
- *
201
- * Stateless by design: it reports presses and holds no selection, which is what
202
- * separates it from SegmentedControl (a stateful choice) and ToggleGroup.
203
- */
204
- exports.ButtonGroup = (0, react_1.forwardRef)(function ButtonGroup({ items, size = "md", variant = "attached", onItemPress, accessibilityLabel, style, isDark: isDarkProp, testID, ...props }, ref) {
205
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
206
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
207
- const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
208
- const height = size === "sm" ? 32 : size === "lg" ? 46 : 40;
209
- return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "group", accessibilityLabel: accessibilityLabel, style: {
210
- flexDirection: "row",
211
- alignSelf: "flex-start",
212
- gap: variant === "segmented" ? 6 : 0,
213
- ...style,
214
- }, ...props, children: items.map((item, index) => {
215
- const first = index === 0;
216
- const last = index === items.length - 1;
217
- // Attached buttons share edges: only the outer corners are rounded,
218
- // and the inner edges stay square so the group reads as one control.
219
- const pill = variant === "segmented" ? tokens_1.radii.pill : 0;
220
- return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: item.label, accessibilityState: { disabled: item.disabled }, disabled: item.disabled, onPress: () => {
221
- item.onPress();
222
- onItemPress?.(item, index);
223
- }, style: ({ pressed }) => ({
224
- opacity: item.disabled ? 0.38 : pressed ? 0.85 : 1,
225
- }), children: (0, jsx_runtime_1.jsx)(Glass_1.Glass, { effect: "regular", surface: "control", interactive: !item.disabled, isDark: isDark, style: {
226
- height,
227
- paddingHorizontal: 18,
228
- justifyContent: "center",
229
- alignItems: "center",
230
- borderRadius: variant === "segmented" ? pill : undefined,
231
- borderTopLeftRadius: variant === "segmented" ? pill : first ? tokens_1.radii.md : 0,
232
- borderBottomLeftRadius: variant === "segmented" ? pill : first ? tokens_1.radii.md : 0,
233
- borderTopRightRadius: variant === "segmented" ? pill : last ? tokens_1.radii.md : 0,
234
- borderBottomRightRadius: variant === "segmented" ? pill : last ? tokens_1.radii.md : 0,
235
- }, children: (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: { fontSize: size === "sm" ? 13 : 14, fontWeight: "500", color: theme.foreground }, children: item.label }) }) }, `${item.label}-${index}`));
236
- }) }));
237
- });
238
- /**
239
- * A colour picker built from Glacia's own parts — no native widget.
240
- *
241
- * The palette is a grid of swatches from the caller's colours; the custom row
242
- * is a hue track drawn as an SVG gradient (the resolver's shapes, so it works
243
- * wherever the charts work) driven by the same Slider mechanics as the rest of
244
- * the library: a drag along the track picks a hue, and a second track saturates
245
- * it. The value is a hex string.
246
- *
247
- * The default palette is a small set of iOS-conventional colours, in case a
248
- * caller wants a picker with no colour knowledge of its own.
249
- */
250
- exports.DEFAULT_PALETTE = tokens_1.palette.default;
251
- /** Parses a hex colour into its red, green and blue channels. */
252
- function hexToRgb(hex) {
253
- const match = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
254
- if (!match)
255
- return null;
256
- const raw = match[1];
257
- return {
258
- r: parseInt(raw.slice(0, 2), 16),
259
- g: parseInt(raw.slice(2, 4), 16),
260
- b: parseInt(raw.slice(4, 6), 16),
261
- };
262
- }
263
- /** Builds a hue gradient's colours, sweeping red → orange → … → red. */
264
- function hueGradientColors() {
265
- const stops = 12;
266
- return Array.from({ length: stops }, (_u, i) => {
267
- const angle = (i / stops) * 360;
268
- const c = hslToRgb(angle, 1, 0.5);
269
- return `#${c.r.toString(16).padStart(2, "0")}${c.g.toString(16).padStart(2, "0")}${c.b.toString(16).padStart(2, "0")}`;
270
- });
271
- }
272
- /** Converts an HSL triple (h 0–360, s/l 0–1) to an RGB hex string. */
273
- function hslToRgb(h, s, l) {
274
- const c = (1 - Math.abs(2 * l - 1)) * s;
275
- const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
276
- const m = l - c / 2;
277
- let r = 0, g = 0, b = 0;
278
- if (h < 60) {
279
- r = c;
280
- g = x;
281
- }
282
- else if (h < 120) {
283
- r = x;
284
- g = c;
285
- }
286
- else if (h < 180) {
287
- g = c;
288
- b = x;
289
- }
290
- else if (h < 240) {
291
- g = x;
292
- b = c;
293
- }
294
- else if (h < 300) {
295
- r = x;
296
- b = c;
297
- }
298
- else {
299
- r = c;
300
- b = x;
301
- }
302
- return {
303
- r: Math.round((r + m) * 255),
304
- g: Math.round((g + m) * 255),
305
- b: Math.round((b + m) * 255),
306
- };
307
- }
308
- /** Converts an RGB triple to a hex string. */
309
- function rgbToHex(r, g, b) {
310
- const clamp = (n) => Math.max(0, Math.min(255, Math.round(n)));
311
- return `#${clamp(r).toString(16).padStart(2, "0")}${clamp(g).toString(16).padStart(2, "0")}${clamp(b).toString(16).padStart(2, "0")}`;
312
- }
313
- exports.ColorPicker = (0, react_1.forwardRef)(function ColorPicker({ colors: palette, value, defaultValue, onChange, size = "md", columns = 6, allowCustom = true, disabled = false, accessibilityLabel = "Color", style, isDark: isDarkProp, testID, ...props }, ref) {
314
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
315
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
316
- const { View, Pressable, Text: RNText, PanResponder, Svg, Rect, Defs, LinearGradient, Stop } = (0, primitives_1.primitives)();
317
- const swatches = palette && palette.length > 0 ? palette : exports.DEFAULT_PALETTE;
318
- const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue ?? swatches[0] ?? tokens_1.palette.fallback);
319
- const activeColor = value !== undefined ? value : internalValue;
320
- const setColor = (next) => {
321
- if (disabled)
322
- return;
323
- if (value === undefined)
324
- setInternalValue(next);
325
- onChange?.(next);
326
- };
327
- // The custom row's two tracks: hue on the top, saturation on the bottom.
328
- // Both are driven by PanResponder like the library's Slider — a press or a
329
- // drag along a track reports the colour at that position.
330
- const trackRef = (0, react_1.useRef)(0);
331
- const swatchSize = tokens_1.controlSizes.swatch[size];
332
- const hueColor = (h) => {
333
- const c = hslToRgb(h, 1, 0.5);
334
- return rgbToHex(c.r, c.g, c.b);
335
- };
336
- const colorAtFraction = (fraction, hue) => {
337
- const sat = Math.max(0, Math.min(1, fraction));
338
- const c = hslToRgb(hue, sat, 0.5);
339
- return rgbToHex(c.r, c.g, c.b);
340
- };
341
- const hue = hexToRgb(activeColor) ? hueOf(activeColor) : 0;
342
- const hueResponder = makeTrackResponder((fraction) => {
343
- setColor(hueColor(fraction * 360));
344
- }, PanResponder, trackRef);
345
- const satResponder = makeTrackResponder((fraction) => {
346
- setColor(colorAtFraction(fraction, hue));
347
- }, PanResponder, trackRef);
348
- const hueGradient = hueGradientColors();
349
- return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, accessibilityRole: "adjustable", accessibilityLabel: accessibilityLabel, accessibilityValue: { text: activeColor }, style: { gap: 12, opacity: disabled ? 0.38 : 1, ...style }, ...props, children: [(0, jsx_runtime_1.jsx)(View, { style: { flexDirection: "row", flexWrap: "wrap", gap: 8 }, children: swatches.map((swatch, index) => {
350
- const selected = swatch.toLowerCase() === activeColor.toLowerCase();
351
- return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: `${swatch} color`, accessibilityState: { selected }, disabled: disabled, onPress: () => setColor(swatch), style: {
352
- width: swatchSize,
353
- height: swatchSize,
354
- borderRadius: swatchSize / 2,
355
- backgroundColor: swatch,
356
- borderWidth: selected ? 2 : 0.5,
357
- borderColor: selected ? theme.fill : theme.separator,
358
- } }, `${swatch}-${index}`));
359
- }) }), allowCustom ? ((0, jsx_runtime_1.jsxs)(View, { style: { gap: 8 }, children: [(0, jsx_runtime_1.jsx)(View, { style: { height: tokens_1.controlSizes.picker.track, borderRadius: tokens_1.radii.md, overflow: "hidden" }, ...(hueResponder ? hueResponder.panHandlers : {}), children: (0, jsx_runtime_1.jsxs)(Svg, { width: "100%", height: "100%", children: [(0, jsx_runtime_1.jsx)(Defs, { children: (0, jsx_runtime_1.jsx)(LinearGradient, { id: "hueGradient", x1: "0", y1: "0", x2: "1", y2: "0", children: hueGradient.map((color, i) => ((0, jsx_runtime_1.jsx)(Stop, { offset: i / (hueGradient.length - 1), stopColor: color }, i))) }) }), (0, jsx_runtime_1.jsx)(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: "url(#hueGradient)" })] }) }), (0, jsx_runtime_1.jsx)(View, { style: { height: tokens_1.controlSizes.picker.track, borderRadius: tokens_1.radii.md, overflow: "hidden" }, ...(satResponder ? satResponder.panHandlers : {}), children: (0, jsx_runtime_1.jsxs)(Svg, { width: "100%", height: "100%", children: [(0, jsx_runtime_1.jsx)(Defs, { children: (0, jsx_runtime_1.jsxs)(LinearGradient, { id: "satGradient", x1: "0", y1: "0", x2: "1", y2: "0", children: [(0, jsx_runtime_1.jsx)(Stop, { offset: "0", stopColor: theme.neutralTop }), (0, jsx_runtime_1.jsx)(Stop, { offset: "1", stopColor: hueColor(hue) })] }) }), (0, jsx_runtime_1.jsx)(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: "url(#satGradient)" })] }) }), (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 12, color: theme.muted }, children: activeColor })] })) : null] }));
360
- });
361
- /** The hue (0–360) of a hex colour. */
362
- function hueOf(hex) {
363
- const rgb = hexToRgb(hex);
364
- if (!rgb)
365
- return 0;
366
- const { r, g, b } = rgb;
367
- const max = Math.max(r, g, b) / 255;
368
- const min = Math.min(r, g, b) / 255;
369
- const delta = max - min;
370
- if (delta === 0)
371
- return 0;
372
- let h = 0;
373
- if (max === r / 255)
374
- h = ((g / 255 - b / 255) / delta) % 6;
375
- else if (max === g / 255)
376
- h = (b / 255 - r / 255) / delta + 2;
377
- else
378
- h = (r / 255 - g / 255) / delta + 4;
379
- const degrees = h * 60;
380
- return degrees < 0 ? degrees + 360 : degrees;
381
- }
382
- /** Builds a PanResponder that reports the fraction (0–1) across a track. */
383
- function makeTrackResponder(onFraction, PanResponder, trackRef) {
384
- if (!PanResponder?.create)
385
- return null;
386
- return PanResponder.create({
387
- onStartShouldSetPanResponder: () => true,
388
- onMoveShouldSetPanResponder: () => true,
389
- onPanResponderGrant: (event) => {
390
- const fraction = fractionAt(event, 100);
391
- if (fraction !== null)
392
- onFraction(fraction);
393
- },
394
- onPanResponderMove: (event) => {
395
- const fraction = fractionAt(event, 100);
396
- if (fraction !== null)
397
- onFraction(fraction);
398
- },
399
- onPanResponderTerminationRequest: () => false,
400
- });
401
- }
402
- /** The fraction of the track under a touch, from the touch's X. */
403
- function fractionAt(event, fallbackWidth) {
404
- const x = event?.nativeEvent?.locationX;
405
- const width = event?.nativeEvent?.layoutMeasurement?.width ?? fallbackWidth;
406
- if (typeof x !== "number" || typeof width !== "number" || width <= 0)
407
- return null;
408
- return Math.max(0, Math.min(1, x / width));
409
- }
410
- /**
411
- * A type-to-search select.
412
- *
413
- * The Input patterns (real TextInput, themed placeholder, `value`/`defaultValue`)
414
- * open a Menu-style glass dropdown whose list filters as the user types — every
415
- * keystroke re-filters the options, so the visible set genuinely shrinks, never
416
- * a list that stays put and pretends to search.
417
- *
418
- * The filter is a case-insensitive substring match on label and description. An
419
- * empty result shows an explicit empty row, so the user sees a search that found
420
- * nothing rather than a list that silently went blank. The dropdown stays open
421
- * until an option is picked or the field loses focus.
422
- */
423
- exports.Combobox = (0, react_1.forwardRef)(function Combobox({ options, value, defaultValue, onChange, label, placeholder = "Search…", disabled = false, onEmpty, style, isDark: isDarkProp, testID, ...props }, ref) {
424
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
425
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
426
- const { View, TextInput, Text: RNText, Pressable } = (0, primitives_1.primitives)();
427
- const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue ?? "");
428
- const [query, setQuery] = (0, react_1.useState)("");
429
- const selected = value !== undefined ? value : internalValue;
430
- const selectedLabel = (options ?? []).find((option) => option.value === selected)?.label ?? "";
431
- const setValue = (next) => {
432
- if (disabled)
433
- return;
434
- if (value === undefined)
435
- setInternalValue(next);
436
- onChange?.(next);
437
- };
438
- // Filter as the user types.
439
- // An option list that has not loaded yet is empty, not a crash: a combobox
440
- // is frequently rendered before its options arrive.
441
- const available = options ?? [];
442
- const needle = query.trim().toLowerCase();
443
- const matches = needle.length === 0
444
- ? available
445
- : available.filter((option) => option.label.toLowerCase().includes(needle) ||
446
- (option.description ?? "").toLowerCase().includes(needle));
447
- return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, style: { ...style }, children: [(0, jsx_runtime_1.jsx)(Glass_1.Glass, { surface: "field", isDark: isDark, style: {
448
- minHeight: 34,
449
- paddingHorizontal: 14,
450
- justifyContent: "center",
451
- opacity: disabled ? 0.5 : 1,
452
- }, children: (0, jsx_runtime_1.jsx)(TextInput, { value: query, onChangeText: (text) => setQuery(text), placeholder: placeholder, accessibilityLabel: label ?? placeholder, accessibilityState: { disabled }, editable: !disabled, style: {
453
- paddingVertical: 8,
454
- fontSize: 15,
455
- color: theme.foreground,
456
- } }) }), query.length > 0 ? ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { surface: "overlay", isDark: isDark, style: {
457
- marginTop: 6,
458
- borderRadius: tokens_1.radii.md,
459
- // The web dropdown floats on its own shadow rather than sitting
460
- // flush on the page.
461
- shadowOpacity: 0.4,
462
- shadowRadius: 32,
463
- shadowOffset: { width: 0, height: 12 },
464
- }, children: matches.length === 0 ? ((0, jsx_runtime_1.jsx)(View, { style: { paddingHorizontal: 12, paddingVertical: 10 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 14, color: theme.muted }, children: "No matches" }) })) : (matches.map((option, index) => {
465
- const isSelected = option.value === selected;
466
- return ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "button", accessibilityLabel: option.label, accessibilityState: { selected: isSelected }, onPress: () => {
467
- setValue(option.value);
468
- setQuery("");
469
- }, style: { flexDirection: "row", alignItems: "center", paddingHorizontal: 12, paddingVertical: 10, backgroundColor: "transparent" }, children: [isSelected ? ((0, jsx_runtime_1.jsx)(lens_1.SelectedLens, { radius: 8, isDark: isDark, style: lens_1.lensFill })) : null, (0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 15, color: theme.foreground }, children: option.label }), option.description ? ((0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 12, color: theme.muted }, numberOfLines: 1, children: option.description })) : null] })] }, `${option.value}-${index}`));
470
- })) })) : null] }));
471
- });
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Message = exports.MessageAttachment = exports.MessageBubble = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const Display_1 = require("./Display");
7
- const Glass_1 = require("./Glass");
8
- const tokens_1 = require("./internal/tokens");
9
- const primitives_1 = require("./internal/primitives");
10
- const motion_1 = require("./internal/motion");
11
- /**
12
- * One message's bubble.
13
- *
14
- * The bubble is a glass surface like the rest of the library (panel profile),
15
- * so it carries the same blurred backdrop, lit rim and shadow as a card. The
16
- * outgoing direction is tinted with `glassActive` — the theme's selected
17
- * tint — and the incoming one uses the plain glass token, which is what keeps
18
- * the two directions distinguishable without a second material.
19
- */
20
- exports.MessageBubble = (0, react_1.forwardRef)(function MessageBubble({ outgoing = false, children, style, isDark: isDarkProp, testID, ...props }, ref) {
21
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
22
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
23
- const { View } = (0, primitives_1.primitives)();
24
- return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { ref: ref, testID: testID, surface: "panel", isDark: isDark, tintColor: outgoing ? theme.glassActive : undefined, style: {
25
- alignSelf: outgoing ? "flex-end" : "flex-start",
26
- maxWidth: "82%",
27
- paddingHorizontal: 14,
28
- paddingVertical: 10,
29
- borderRadius: tokens_1.radii.lg,
30
- ...style,
31
- }, ...props, children: children }));
32
- });
33
- /**
34
- * A file chip for a message.
35
- *
36
- * A flat, bordered chip rather than a glass one, for the same reason the
37
- * bubbles are flat: it sits inside a bubble or beside one, and glass inside
38
- * glass is never allowed. The size is a caller-formatted string — byte
39
- * formatting belongs to the app's locale, not to a component library.
40
- */
41
- exports.MessageAttachment = (0, react_1.forwardRef)(function MessageAttachment({ name, size, icon, onPress, disabled = false, style, isDark: isDarkProp, testID, ...props }, ref) {
42
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
43
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
44
- const { View, Text, Pressable } = (0, primitives_1.primitives)();
45
- const body = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon ? (0, jsx_runtime_1.jsx)(View, { style: { marginRight: 8 }, children: icon }) : null, (0, jsx_runtime_1.jsxs)(View, { style: { flexShrink: 1 }, children: [(0, jsx_runtime_1.jsx)(Text, { numberOfLines: 1, style: { fontSize: 14, color: theme.foreground }, children: name }), size ? ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted }, children: size })) : null] })] }));
46
- const chipStyle = {
47
- flexDirection: "row",
48
- alignItems: "center",
49
- paddingHorizontal: 12,
50
- paddingVertical: 8,
51
- borderRadius: tokens_1.radii.md,
52
- backgroundColor: theme.wash,
53
- borderWidth: 0.5,
54
- borderColor: theme.separator,
55
- opacity: disabled ? 0.38 : 1,
56
- ...style,
57
- };
58
- if (!onPress) {
59
- return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, accessibilityRole: "text", accessibilityLabel: size ? `${name}, ${size}` : name, style: chipStyle, ...props, children: body }));
60
- }
61
- return ((0, jsx_runtime_1.jsx)(Pressable, { ref: ref, testID: testID, accessibilityRole: "button", accessibilityLabel: size ? `${name}, ${size}` : name, accessibilityState: { disabled }, disabled: disabled, onPress: onPress, style: chipStyle, ...props, children: body }));
62
- });
63
- /**
64
- * A whole message: who sent it, when, and what they said.
65
- *
66
- * The row every chat screen builds by hand — an avatar, a name and time line,
67
- * and the content under it. Grouping it means the alignment, spacing and
68
- * accessibility grouping are decided once: the row is announced as a single
69
- * message (name, time, content) rather than as three unrelated pieces of text.
70
- */
71
- exports.Message = (0, react_1.forwardRef)(function Message({ name, time, avatar = false, outgoing = false, children, style, isDark: isDarkProp, testID, ...props }, ref) {
72
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
73
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
74
- const { View, Text } = (0, primitives_1.primitives)();
75
- const meta = [name, time].filter(Boolean).join(", ");
76
- return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, accessibilityRole: "text", accessibilityLabel: meta || undefined, style: {
77
- flexDirection: outgoing ? "row-reverse" : "row",
78
- alignItems: "flex-end",
79
- gap: 8,
80
- paddingHorizontal: 4,
81
- paddingVertical: 4,
82
- ...style,
83
- }, ...props, children: [avatar ? ((0, jsx_runtime_1.jsx)(Display_1.Avatar, { name: name ?? "", size: "sm", isDark: isDark })) : null, (0, jsx_runtime_1.jsxs)(View, { style: { flexShrink: 1, alignItems: outgoing ? "flex-end" : "flex-start", gap: 2 }, children: [name || time ? ((0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", alignItems: "center", gap: 6 }, children: [name ? ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, fontWeight: "600", color: theme.foreground }, children: name })) : null, time ? (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted }, children: time }) : null] })) : null, children] })] }));
84
- });