glacia-native 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/LICENSE +29 -4
  2. package/README.md +111 -17
  3. package/lib/module/Accordion.js +58 -0
  4. package/lib/module/ActionSheet.js +38 -0
  5. package/lib/module/Alert.js +23 -0
  6. package/lib/module/AlertDialog.js +47 -0
  7. package/lib/module/Avatar.js +48 -0
  8. package/lib/module/Badge.js +36 -0
  9. package/lib/module/Bars.js +13 -267
  10. package/lib/module/Button.js +57 -36
  11. package/lib/module/Card.js +32 -20
  12. package/lib/module/Checkbox.js +42 -0
  13. package/lib/module/Chip.js +80 -0
  14. package/lib/module/Collapsible.js +26 -0
  15. package/lib/module/ContextMenu.js +33 -0
  16. package/lib/module/Dialog.js +39 -124
  17. package/lib/module/DropdownMenu.js +33 -0
  18. package/lib/module/Field.js +22 -0
  19. package/lib/module/Glass.js +12 -5
  20. package/lib/module/Group.js +36 -0
  21. package/lib/module/IconButton.js +40 -0
  22. package/lib/module/Input.js +47 -40
  23. package/lib/module/Label.js +17 -0
  24. package/lib/module/MorphGroup.js +47 -0
  25. package/lib/module/Popover.js +29 -0
  26. package/lib/module/Progress.js +32 -0
  27. package/lib/module/RadioGroup.js +51 -0
  28. package/lib/module/Scrim.js +44 -0
  29. package/lib/module/SegmentedControl.js +74 -58
  30. package/lib/module/Select.js +51 -0
  31. package/lib/module/Separator.js +25 -0
  32. package/lib/module/Sheet.js +51 -0
  33. package/lib/module/Skeleton.js +48 -0
  34. package/lib/module/Slider.js +60 -40
  35. package/lib/module/Stepper.js +167 -0
  36. package/lib/module/Switch.js +45 -43
  37. package/lib/module/TabBar.js +62 -50
  38. package/lib/module/Tabs.js +3 -2
  39. package/lib/module/Textarea.js +18 -0
  40. package/lib/module/Toast.js +55 -0
  41. package/lib/module/Toggle.js +47 -0
  42. package/lib/module/ToggleGroup.js +56 -0
  43. package/lib/module/Toolbar.js +37 -0
  44. package/lib/module/Tooltip.js +31 -0
  45. package/lib/module/glass-provider.js +28 -0
  46. package/lib/module/glass-stack.js +61 -0
  47. package/lib/module/index.js +78 -109
  48. package/lib/module/internal/GlassBackdrop.js +36 -0
  49. package/lib/module/internal/GlassView.js +45 -13
  50. package/lib/module/internal/blur-community.js +20 -0
  51. package/lib/module/internal/blur-community.web.js +9 -0
  52. package/lib/module/internal/blur.js +75 -0
  53. package/lib/module/internal/fallback.js +110 -20
  54. package/lib/module/internal/glass-routing.js +154 -30
  55. package/lib/module/internal/glow.js +36 -0
  56. package/lib/module/internal/initials.js +12 -0
  57. package/lib/module/internal/lens.js +70 -0
  58. package/lib/module/internal/material.js +64 -0
  59. package/lib/module/internal/overlay.js +147 -0
  60. package/lib/module/internal/primitives.js +17 -0
  61. package/lib/module/internal/rim.js +35 -0
  62. package/lib/module/internal/tokens.js +34 -2
  63. package/lib/typescript/Accordion.d.ts +22 -0
  64. package/lib/typescript/ActionSheet.d.ts +24 -0
  65. package/lib/typescript/Alert.d.ts +15 -0
  66. package/lib/typescript/AlertDialog.d.ts +17 -0
  67. package/lib/typescript/Avatar.d.ts +22 -0
  68. package/lib/typescript/Badge.d.ts +12 -0
  69. package/lib/typescript/Bars.d.ts +3 -188
  70. package/lib/typescript/Button.d.ts +44 -10
  71. package/lib/typescript/Card.d.ts +30 -3
  72. package/lib/typescript/Checkbox.d.ts +14 -0
  73. package/lib/typescript/Chip.d.ts +19 -0
  74. package/lib/typescript/Collapsible.d.ts +17 -0
  75. package/lib/typescript/ContextMenu.d.ts +23 -0
  76. package/lib/typescript/Dialog.d.ts +8 -68
  77. package/lib/typescript/DropdownMenu.d.ts +23 -0
  78. package/lib/typescript/Field.d.ts +19 -0
  79. package/lib/typescript/Glass.d.ts +11 -2
  80. package/lib/typescript/Group.d.ts +35 -0
  81. package/lib/typescript/IconButton.d.ts +21 -0
  82. package/lib/typescript/Input.d.ts +17 -18
  83. package/lib/typescript/Label.d.ts +14 -0
  84. package/lib/typescript/MorphGroup.d.ts +46 -0
  85. package/lib/typescript/Popover.d.ts +17 -0
  86. package/lib/typescript/Progress.d.ts +13 -0
  87. package/lib/typescript/RadioGroup.d.ts +21 -0
  88. package/lib/typescript/Scrim.d.ts +33 -0
  89. package/lib/typescript/SegmentedControl.d.ts +24 -13
  90. package/lib/typescript/Select.d.ts +19 -0
  91. package/lib/typescript/Separator.d.ts +10 -0
  92. package/lib/typescript/Sheet.d.ts +45 -0
  93. package/lib/typescript/Skeleton.d.ts +10 -0
  94. package/lib/typescript/Slider.d.ts +15 -7
  95. package/lib/typescript/Stepper.d.ts +49 -0
  96. package/lib/typescript/Switch.d.ts +19 -12
  97. package/lib/typescript/TabBar.d.ts +18 -6
  98. package/lib/typescript/Textarea.d.ts +6 -0
  99. package/lib/typescript/Toast.d.ts +40 -0
  100. package/lib/typescript/Toggle.d.ts +21 -0
  101. package/lib/typescript/ToggleGroup.d.ts +22 -0
  102. package/lib/typescript/Toolbar.d.ts +35 -0
  103. package/lib/typescript/Tooltip.d.ts +16 -0
  104. package/lib/typescript/glass-provider.d.ts +34 -0
  105. package/lib/typescript/glass-stack.d.ts +54 -0
  106. package/lib/typescript/index.d.ts +39 -17
  107. package/lib/typescript/internal/GlassBackdrop.d.ts +33 -0
  108. package/lib/typescript/internal/GlassView.d.ts +31 -2
  109. package/lib/typescript/internal/blur-community.d.ts +2 -0
  110. package/lib/typescript/internal/blur-community.web.d.ts +2 -0
  111. package/lib/typescript/internal/blur.d.ts +24 -0
  112. package/lib/typescript/internal/fallback.d.ts +27 -2
  113. package/lib/typescript/internal/glass-routing.d.ts +83 -15
  114. package/lib/typescript/internal/glow.d.ts +11 -0
  115. package/lib/typescript/internal/initials.d.ts +2 -0
  116. package/lib/typescript/internal/lens.d.ts +47 -0
  117. package/lib/typescript/internal/material.d.ts +27 -0
  118. package/lib/typescript/internal/overlay.d.ts +74 -0
  119. package/lib/typescript/internal/primitives.d.ts +13 -0
  120. package/lib/typescript/internal/rim.d.ts +16 -0
  121. package/lib/typescript/internal/tokens.d.ts +36 -0
  122. package/package.json +15 -4
  123. package/src/Accordion.tsx +165 -0
  124. package/src/ActionSheet.tsx +149 -0
  125. package/src/Alert.tsx +85 -0
  126. package/src/AlertDialog.tsx +124 -0
  127. package/src/Avatar.tsx +102 -0
  128. package/src/Badge.tsx +80 -0
  129. package/src/Bars.tsx +10 -797
  130. package/src/Button.tsx +196 -60
  131. package/src/Card.tsx +106 -33
  132. package/src/Checkbox.tsx +98 -0
  133. package/src/Chip.tsx +149 -0
  134. package/src/Collapsible.tsx +66 -0
  135. package/src/ContextMenu.tsx +103 -0
  136. package/src/Dialog.tsx +86 -325
  137. package/src/DropdownMenu.tsx +103 -0
  138. package/src/Field.tsx +65 -0
  139. package/src/Glass.tsx +19 -5
  140. package/src/Group.tsx +98 -0
  141. package/src/IconButton.tsx +110 -0
  142. package/src/Input.tsx +143 -87
  143. package/src/Label.tsx +56 -0
  144. package/src/MorphGroup.tsx +134 -0
  145. package/src/Popover.tsx +81 -0
  146. package/src/Progress.tsx +83 -0
  147. package/src/RadioGroup.tsx +122 -0
  148. package/src/Scrim.tsx +94 -0
  149. package/src/SegmentedControl.tsx +147 -90
  150. package/src/Select.tsx +136 -0
  151. package/src/Separator.tsx +52 -0
  152. package/src/Sheet.tsx +139 -0
  153. package/src/Skeleton.tsx +77 -0
  154. package/src/Slider.tsx +100 -54
  155. package/src/Stepper.tsx +315 -0
  156. package/src/Switch.tsx +80 -58
  157. package/src/TabBar.tsx +118 -84
  158. package/src/Tabs.tsx +5 -0
  159. package/src/Textarea.tsx +34 -0
  160. package/src/Toast.tsx +131 -0
  161. package/src/Toggle.tsx +113 -0
  162. package/src/ToggleGroup.tsx +129 -0
  163. package/src/Toolbar.tsx +111 -0
  164. package/src/Tooltip.tsx +79 -0
  165. package/src/engine/CHANGELOG.md +430 -0
  166. package/src/engine/NOTICE +54 -0
  167. package/src/engine/README.md +975 -0
  168. package/src/engine/android/build.gradle +18 -0
  169. package/src/engine/android/src/main/AndroidManifest.xml +2 -0
  170. package/src/engine/android/src/main/java/expo/modules/liquidglass/ExpoLiquidGlassModule.kt +174 -0
  171. package/src/engine/android/src/main/java/expo/modules/liquidglass/GlassConstants.kt +7 -0
  172. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassContainerView.kt +16 -0
  173. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassProviderView.kt +165 -0
  174. package/src/engine/android/src/main/java/expo/modules/liquidglass/LiquidGlassView.kt +1731 -0
  175. package/src/engine/android/src/main/java/expo/modules/liquidglass/enums/GlassEnums.kt +171 -0
  176. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropGraph.kt +146 -0
  177. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/BackdropSource.kt +53 -0
  178. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ContinuousCorners.kt +188 -0
  179. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/CornerRadii.kt +62 -0
  180. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassAppearance.kt +352 -0
  181. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassDebug.kt +109 -0
  182. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassEnvironment.kt +139 -0
  183. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassHdr.kt +85 -0
  184. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassLuminanceProbe.kt +189 -0
  185. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassPressAnimator.kt +264 -0
  186. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassProgressiveBlur.kt +249 -0
  187. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderCache.kt +256 -0
  188. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassShaderSource.kt +845 -0
  189. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/GlassTier.kt +63 -0
  190. package/src/engine/android/src/main/java/expo/modules/liquidglass/glass/ProviderRegistry.kt +71 -0
  191. package/src/engine/android/src/main/java/expo/modules/liquidglass/records/GlassRecords.kt +288 -0
  192. package/src/engine/index.ts +24 -0
  193. package/src/engine/ios/Enums/GlassBlurDirection.swift +21 -0
  194. package/src/engine/ios/Enums/GlassVariant.swift +86 -0
  195. package/src/engine/ios/ExpoLiquidGlass.podspec +93 -0
  196. package/src/engine/ios/ExpoLiquidGlassModule.swift +77 -0
  197. package/src/engine/ios/Glass/BackdropCapturer.swift +811 -0
  198. package/src/engine/ios/Glass/ContinuousCorners.swift +165 -0
  199. package/src/engine/ios/Glass/GlassBackdrop.swift +176 -0
  200. package/src/engine/ios/Glass/GlassFramePhase.swift +126 -0
  201. package/src/engine/ios/Glass/GlassFrameScheduler.swift +261 -0
  202. package/src/engine/ios/Glass/GlassPressAnimator.swift +250 -0
  203. package/src/engine/ios/Glass/GlassRenderContext.swift +168 -0
  204. package/src/engine/ios/Glass/GlassRenderer.swift +186 -0
  205. package/src/engine/ios/Glass/GlassSurfaceView.swift +452 -0
  206. package/src/engine/ios/Glass/NonRenderableView.swift +54 -0
  207. package/src/engine/ios/Glass/StripCache.swift +545 -0
  208. package/src/engine/ios/Records/GlassCornerRadii.swift +79 -0
  209. package/src/engine/ios/Records/GlassMetalOptions.swift +180 -0
  210. package/src/engine/ios/Records/GlassRefractionCurve.swift +14 -0
  211. package/src/engine/ios/Shaders/LiquidGlass.metal +480 -0
  212. package/src/engine/ios/Shaders/bundle-marker.txt +6 -0
  213. package/src/engine/ios/Views/LiquidGlassContainerView.swift +99 -0
  214. package/src/engine/ios/Views/LiquidGlassView.swift +859 -0
  215. package/src/engine/package.json +70 -0
  216. package/src/engine/src/components/LiquidGlassButton/LiquidGlassButton.tsx +424 -0
  217. package/src/engine/src/components/LiquidGlassCard/LiquidGlassCard.tsx +98 -0
  218. package/src/engine/src/components/LiquidGlassChip/LiquidGlassChip.tsx +65 -0
  219. package/src/engine/src/components/LiquidGlassGroup/LiquidGlassGroup.tsx +350 -0
  220. package/src/engine/src/components/LiquidGlassIconButton/LiquidGlassIconButton.tsx +24 -0
  221. package/src/engine/src/components/LiquidGlassMorphGroup/LiquidGlassMorphGroup.tsx +434 -0
  222. package/src/engine/src/components/LiquidGlassScrim/LiquidGlassScrim.tsx +100 -0
  223. package/src/engine/src/components/LiquidGlassSegmentedControl/LiquidGlassSegmentedControl.tsx +213 -0
  224. package/src/engine/src/components/LiquidGlassSheet/LiquidGlassSheet.tsx +218 -0
  225. package/src/engine/src/components/LiquidGlassSlider/LiquidGlassSlider.tsx +327 -0
  226. package/src/engine/src/components/LiquidGlassStepper/LiquidGlassStepper.tsx +321 -0
  227. package/src/engine/src/components/LiquidGlassSwitch/LiquidGlassSwitch.tsx +296 -0
  228. package/src/engine/src/components/LiquidGlassTabBar/LiquidGlassTabBar.tsx +952 -0
  229. package/src/engine/src/components/LiquidGlassTextInput/LiquidGlassTextInput.tsx +151 -0
  230. package/src/engine/src/components/LiquidGlassToast/LiquidGlassToast.tsx +169 -0
  231. package/src/engine/src/components/LiquidGlassToolbar/LiquidGlassToolbar.tsx +124 -0
  232. package/src/engine/src/components/index.ts +16 -0
  233. package/src/engine/src/constants/index.ts +4 -0
  234. package/src/engine/src/constants/metal.constants.ts +327 -0
  235. package/src/engine/src/constants/metrics.constants.ts +325 -0
  236. package/src/engine/src/constants/springs.constants.ts +107 -0
  237. package/src/engine/src/constants/styles.constants.ts +12 -0
  238. package/src/engine/src/context/glass-group.context.ts +65 -0
  239. package/src/engine/src/context/index.ts +6 -0
  240. package/src/engine/src/core/components/LiquidGlassContainer/LiquidGlassContainer.tsx +32 -0
  241. package/src/engine/src/core/components/LiquidGlassContainer/index.ts +1 -0
  242. package/src/engine/src/core/components/LiquidGlassProvider/LiquidGlassProvider.tsx +66 -0
  243. package/src/engine/src/core/components/LiquidGlassProvider/index.ts +1 -0
  244. package/src/engine/src/core/components/LiquidGlassStack/LiquidGlassStack.tsx +184 -0
  245. package/src/engine/src/core/components/LiquidGlassStack/index.ts +1 -0
  246. package/src/engine/src/core/components/LiquidGlassView/LiquidGlassView.tsx +126 -0
  247. package/src/engine/src/core/components/LiquidGlassView/index.ts +1 -0
  248. package/src/engine/src/core/components/index.ts +4 -0
  249. package/src/engine/src/core/constants/glass.constants.ts +57 -0
  250. package/src/engine/src/core/constants/index.ts +20 -0
  251. package/src/engine/src/core/constants/native.constants.ts +16 -0
  252. package/src/engine/src/core/context/glass-stack.context.ts +30 -0
  253. package/src/engine/src/core/context/index.ts +4 -0
  254. package/src/engine/src/core/enum/index.ts +12 -0
  255. package/src/engine/src/core/index.ts +1 -0
  256. package/src/engine/src/core/interfaces/glass-hdr.interface.ts +15 -0
  257. package/src/engine/src/core/interfaces/glass-metal.interface.ts +248 -0
  258. package/src/engine/src/core/interfaces/glass-surface.interface.ts +9 -0
  259. package/src/engine/src/core/interfaces/index.ts +31 -0
  260. package/src/engine/src/core/interfaces/liquid-glass-container.interface.ts +6 -0
  261. package/src/engine/src/core/interfaces/liquid-glass-provider.interface.ts +14 -0
  262. package/src/engine/src/core/interfaces/liquid-glass-stack.interface.ts +21 -0
  263. package/src/engine/src/core/interfaces/liquid-glass-view.interface.ts +129 -0
  264. package/src/engine/src/core/interfaces/native-liquid-glass-view.interface.ts +19 -0
  265. package/src/engine/src/core/modules/ExpoLiquidGlassModule.ts +26 -0
  266. package/src/engine/src/core/modules/index.ts +2 -0
  267. package/src/engine/src/core/root/index.ts +51 -0
  268. package/src/engine/src/core/types/glass.types.ts +25 -0
  269. package/src/engine/src/core/types/index.ts +8 -0
  270. package/src/engine/src/core/utils/debug.utils.ts +17 -0
  271. package/src/engine/src/core/utils/dev-warn.utils.ts +17 -0
  272. package/src/engine/src/core/utils/hdr.utils.ts +37 -0
  273. package/src/engine/src/core/utils/index.ts +5 -0
  274. package/src/engine/src/core/utils/native-view.utils.ts +33 -0
  275. package/src/engine/src/core/utils/platform.utils.ts +34 -0
  276. package/src/engine/src/core/views/NativeGlassBackdropView.ts +24 -0
  277. package/src/engine/src/core/views/NativeLiquidGlassContainerView.ts +13 -0
  278. package/src/engine/src/core/views/NativeLiquidGlassContainerView.web.ts +10 -0
  279. package/src/engine/src/core/views/NativeLiquidGlassProviderView.ts +13 -0
  280. package/src/engine/src/core/views/NativeLiquidGlassProviderView.web.ts +10 -0
  281. package/src/engine/src/core/views/NativeLiquidGlassView.ts +19 -0
  282. package/src/engine/src/core/views/NativeLiquidGlassView.web.ts +14 -0
  283. package/src/engine/src/core/views/index.ts +4 -0
  284. package/src/engine/src/hooks/index.ts +18 -0
  285. package/src/engine/src/hooks/use-adaptive-glass.ts +91 -0
  286. package/src/engine/src/hooks/use-damped-drag.ts +332 -0
  287. package/src/engine/src/hooks/use-echo-filter.ts +55 -0
  288. package/src/engine/src/hooks/use-glass-group-member.ts +169 -0
  289. package/src/engine/src/hooks/use-gravity-highlight.ts +79 -0
  290. package/src/engine/src/hooks/use-press-progress.ts +44 -0
  291. package/src/engine/src/index.ts +120 -0
  292. package/src/engine/src/interfaces/index.ts +28 -0
  293. package/src/engine/src/interfaces/liquid-glass-button.interface.ts +94 -0
  294. package/src/engine/src/interfaces/liquid-glass-card.interface.ts +40 -0
  295. package/src/engine/src/interfaces/liquid-glass-chip.interface.ts +29 -0
  296. package/src/engine/src/interfaces/liquid-glass-group.interface.ts +32 -0
  297. package/src/engine/src/interfaces/liquid-glass-icon-button.interface.ts +19 -0
  298. package/src/engine/src/interfaces/liquid-glass-morph-group.interface.ts +59 -0
  299. package/src/engine/src/interfaces/liquid-glass-scrim.interface.ts +36 -0
  300. package/src/engine/src/interfaces/liquid-glass-segmented-control.interface.ts +32 -0
  301. package/src/engine/src/interfaces/liquid-glass-sheet.interface.ts +38 -0
  302. package/src/engine/src/interfaces/liquid-glass-slider.interface.ts +37 -0
  303. package/src/engine/src/interfaces/liquid-glass-stepper.interface.ts +35 -0
  304. package/src/engine/src/interfaces/liquid-glass-switch.interface.ts +27 -0
  305. package/src/engine/src/interfaces/liquid-glass-tab-bar.interface.ts +116 -0
  306. package/src/engine/src/interfaces/liquid-glass-text-input.interface.ts +42 -0
  307. package/src/engine/src/interfaces/liquid-glass-toast.interface.ts +36 -0
  308. package/src/engine/src/interfaces/liquid-glass-toolbar.interface.ts +33 -0
  309. package/src/engine/src/theme/glass-ui-theme.ts +100 -0
  310. package/src/engine/src/theme/index.ts +2 -0
  311. package/src/engine/src/utils/button-press.utils.ts +63 -0
  312. package/src/engine/src/utils/index.ts +3 -0
  313. package/src/engine/src/utils/metal.utils.ts +164 -0
  314. package/src/glass-provider.tsx +60 -0
  315. package/src/glass-stack.tsx +115 -0
  316. package/src/index.ts +48 -190
  317. package/src/internal/GlassBackdrop.tsx +60 -0
  318. package/src/internal/GlassView.tsx +70 -18
  319. package/src/internal/blur-community.ts +19 -0
  320. package/src/internal/blur-community.web.ts +7 -0
  321. package/src/internal/blur.ts +89 -0
  322. package/src/internal/fallback.tsx +158 -20
  323. package/src/internal/glass-routing.ts +211 -34
  324. package/src/internal/glow.tsx +62 -0
  325. package/src/internal/initials.ts +7 -0
  326. package/src/internal/lens.tsx +105 -0
  327. package/src/internal/material.ts +92 -0
  328. package/src/internal/overlay.tsx +258 -0
  329. package/src/internal/primitives.ts +26 -0
  330. package/src/internal/rim.tsx +79 -0
  331. package/src/internal/tokens.ts +34 -1
  332. package/lib/module/Carousel.js +0 -103
  333. package/lib/module/Display.js +0 -317
  334. package/lib/module/Feedback.js +0 -386
  335. package/lib/module/Form.js +0 -164
  336. package/lib/module/Forms2.js +0 -454
  337. package/lib/module/Message.js +0 -88
  338. package/lib/module/Overlays.js +0 -328
  339. package/lib/module/Pickers.js +0 -243
  340. package/lib/module/Table.js +0 -99
  341. package/lib/module/ai.js +0 -280
  342. package/lib/module/charts/AreaChart.js +0 -32
  343. package/lib/module/charts/BarChart.js +0 -67
  344. package/lib/module/charts/FunnelChart.js +0 -50
  345. package/lib/module/charts/HeatmapChart.js +0 -71
  346. package/lib/module/charts/LineChart.js +0 -81
  347. package/lib/module/charts/PlotChart.js +0 -52
  348. package/lib/module/charts/RadarChart.js +0 -78
  349. package/lib/module/charts/RingChart.js +0 -52
  350. package/lib/module/charts/ScatterChart.js +0 -95
  351. package/lib/module/charts/WaterfallChart.js +0 -85
  352. package/lib/module/charts/advanced.js +0 -313
  353. package/lib/module/charts/extra.js +0 -108
  354. package/lib/module/charts/index.js +0 -50
  355. package/lib/module/charts/scales.js +0 -140
  356. package/lib/typescript/Carousel.d.ts +0 -47
  357. package/lib/typescript/Display.d.ts +0 -178
  358. package/lib/typescript/Feedback.d.ts +0 -196
  359. package/lib/typescript/Form.d.ts +0 -97
  360. package/lib/typescript/Forms2.d.ts +0 -209
  361. package/lib/typescript/Message.d.ts +0 -71
  362. package/lib/typescript/Overlays.d.ts +0 -146
  363. package/lib/typescript/Pickers.d.ts +0 -105
  364. package/lib/typescript/Table.d.ts +0 -64
  365. package/lib/typescript/ai.d.ts +0 -166
  366. package/lib/typescript/charts/AreaChart.d.ts +0 -44
  367. package/lib/typescript/charts/BarChart.d.ts +0 -19
  368. package/lib/typescript/charts/FunnelChart.d.ts +0 -25
  369. package/lib/typescript/charts/HeatmapChart.d.ts +0 -23
  370. package/lib/typescript/charts/LineChart.d.ts +0 -30
  371. package/lib/typescript/charts/PlotChart.d.ts +0 -31
  372. package/lib/typescript/charts/RadarChart.d.ts +0 -27
  373. package/lib/typescript/charts/RingChart.d.ts +0 -28
  374. package/lib/typescript/charts/ScatterChart.d.ts +0 -34
  375. package/lib/typescript/charts/WaterfallChart.d.ts +0 -22
  376. package/lib/typescript/charts/advanced.d.ts +0 -107
  377. package/lib/typescript/charts/extra.d.ts +0 -63
  378. package/lib/typescript/charts/index.d.ts +0 -13
  379. package/lib/typescript/charts/scales.d.ts +0 -35
  380. package/src/Carousel.tsx +0 -233
  381. package/src/Display.tsx +0 -778
  382. package/src/Feedback.tsx +0 -969
  383. package/src/Form.tsx +0 -425
  384. package/src/Forms2.tsx +0 -1014
  385. package/src/Message.tsx +0 -219
  386. package/src/Overlays.tsx +0 -685
  387. package/src/Pickers.tsx +0 -590
  388. package/src/Table.tsx +0 -231
  389. package/src/ai.tsx +0 -707
  390. package/src/charts/AreaChart.tsx +0 -73
  391. package/src/charts/BarChart.tsx +0 -183
  392. package/src/charts/FunnelChart.tsx +0 -125
  393. package/src/charts/HeatmapChart.tsx +0 -155
  394. package/src/charts/LineChart.tsx +0 -247
  395. package/src/charts/PlotChart.tsx +0 -168
  396. package/src/charts/RadarChart.tsx +0 -208
  397. package/src/charts/RingChart.tsx +0 -133
  398. package/src/charts/ScatterChart.tsx +0 -223
  399. package/src/charts/WaterfallChart.tsx +0 -201
  400. package/src/charts/advanced.tsx +0 -676
  401. package/src/charts/extra.tsx +0 -242
  402. package/src/charts/index.ts +0 -86
  403. package/src/charts/scales.ts +0 -163
@@ -1,386 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Accordion = exports.ListSection = exports.List = exports.ListItem = exports.Banner = exports.ToastViewport = exports.Toast = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const Glass_1 = require("./Glass");
7
- const Display_1 = require("./Display");
8
- const tokens_1 = require("./internal/tokens");
9
- const primitives_1 = require("./internal/primitives");
10
- const motion_1 = require("./internal/motion");
11
- const haptics_1 = require("./internal/haptics");
12
- /**
13
- * A transient message on a glass pill.
14
- *
15
- * A toast is not a dialog: it never blocks the screen, so it renders in place
16
- * and lets touches through to what is underneath. It dismisses itself after
17
- * `duration` unless it is controlled or `duration` is 0.
18
- */
19
- exports.Toast = (0, react_1.forwardRef)(function Toast({ visible: visibleProp, defaultVisible = false, onDismiss, message, action, icon, duration = 4000, tone = "neutral", style, isDark: isDarkProp, testID, ...props }, ref) {
20
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
21
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
22
- const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
23
- const [internalVisible, setInternalVisible] = (0, react_1.useState)(defaultVisible);
24
- const visible = visibleProp !== undefined ? visibleProp : internalVisible;
25
- const dismiss = () => {
26
- if (visibleProp === undefined)
27
- setInternalVisible(false);
28
- onDismiss?.();
29
- };
30
- // The timer lives and dies with the toast. A ref keeps the latest dismiss
31
- // closure out of the effect's dependencies, so a parent re-render does not
32
- // restart the countdown.
33
- const dismissRef = (0, react_1.useRef)(dismiss);
34
- dismissRef.current = dismiss;
35
- (0, react_1.useEffect)(() => {
36
- if (!visible || duration <= 0)
37
- return;
38
- const timer = setTimeout(() => dismissRef.current(), duration);
39
- return () => clearTimeout(timer);
40
- }, [visible, duration]);
41
- const { value: enter, animated } = (0, motion_1.useSpring)(visible ? 1 : 0, "snappy");
42
- const rise = animated ? enter.interpolate({ inputRange: [0, 1], outputRange: [12, 0] }) : 0;
43
- const fade = animated ? enter.interpolate({ inputRange: [0, 1], outputRange: [0, 1] }) : 1;
44
- if (!visible)
45
- return null;
46
- const accent = tone === "neutral" ? theme.foreground : (0, tokens_1.toneColor)(theme, tone);
47
- return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, pointerEvents: "box-none", style: { alignItems: "center", ...style }, ...props, children: (0, jsx_runtime_1.jsx)(Entrance, { animated: animated, rise: rise, fade: fade, children: (0, jsx_runtime_1.jsxs)(Glass_1.Glass, { effect: "regular", isDark: isDark, style: {
48
- flexDirection: "row",
49
- alignItems: "center",
50
- gap: 10,
51
- paddingVertical: 10,
52
- paddingHorizontal: 14,
53
- borderRadius: tokens_1.radii.pill,
54
- maxWidth: 420,
55
- borderColor: tone === "neutral" ? theme.edge : accent,
56
- }, children: [icon ? (0, jsx_runtime_1.jsx)(View, { children: icon }) : null, (0, jsx_runtime_1.jsx)(RNText, { accessibilityRole: "alert", accessibilityLiveRegion: "polite", style: { fontSize: 14, color: theme.foreground, flexShrink: 1 }, children: message }), action && ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: action.label, onPress: action.onPress, style: { paddingHorizontal: 4 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 14, fontWeight: "600", color: theme.fill }, children: action.label }) }))] }) }) }));
57
- });
58
- /**
59
- * Applies the toast's entrance motion around the pill.
60
- *
61
- * A thin wrapper because animated styles must land on an Animated.View, while
62
- * the pill itself is a Glass — wrapping keeps both honest.
63
- */
64
- function Entrance({ animated, rise, fade, children, }) {
65
- const { Animated } = (0, primitives_1.primitives)();
66
- if (!animated)
67
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
68
- return ((0, jsx_runtime_1.jsx)(Animated.View, { style: { transform: [{ translateY: rise }], opacity: fade }, children: children }));
69
- }
70
- /**
71
- * A queue of toasts, stacked the way Sonner stacks them.
72
- *
73
- * Three at a time is the practical limit: beyond that the messages stop being
74
- * read and start covering the screen. Extras wait in the order they arrived, so
75
- * no message is lost and the newest is never hidden behind a backlog.
76
- *
77
- * Each toast is independently dismissible — its own timer, its own action, and
78
- * a swipe up. Swiping one up removes only that one.
79
- *
80
- * The single `Toast` keeps working unchanged: this is the host for when an app
81
- * has several messages at once, not a replacement. A caller that shows one
82
- * message continues to use `Toast` directly.
83
- */
84
- exports.ToastViewport = (0, react_1.forwardRef)(function ToastViewport({ toasts, onDismiss, max = 3, position = "bottom", style, isDark: isDarkProp, testID, ...props }, ref) {
85
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
86
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
87
- const { View, PanResponder } = (0, primitives_1.primitives)();
88
- // The visible window is the newest `max`, so a burst shows the latest
89
- // messages rather than a stale backlog. Earlier ones remain queued in the
90
- // caller's array and appear as the visible ones leave.
91
- //
92
- // A host is often rendered for the whole life of a screen and simply has no
93
- // messages yet, so an absent queue means empty rather than a crash.
94
- const visible = (toasts ?? []).slice(0, Math.max(0, max));
95
- return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, pointerEvents: "box-none", style: {
96
- position: "absolute",
97
- left: 0,
98
- right: 0,
99
- alignItems: "center",
100
- gap: 8,
101
- ...(position === "top" ? { top: 16 } : { bottom: 16 }),
102
- ...style,
103
- }, ...props, children: visible.map((toast) => ((0, jsx_runtime_1.jsx)(SwipeableToast, { toast: toast, isDark: isDark, onDismiss: () => onDismiss(toast.id), theme: theme }, toast.id))) }));
104
- });
105
- /**
106
- * One toast inside the viewport, with the swipe-up dismissal.
107
- *
108
- * Wrapping the existing Toast would have meant threading the gesture through
109
- * its props, so the viewport renders the same pill with the gesture attached —
110
- * the styling lives in one place (`Toast`), and this adds only the drag.
111
- */
112
- function SwipeableToast({ toast, isDark, onDismiss, theme, }) {
113
- const { View, Text: RNText, Pressable, PanResponder, Animated } = (0, primitives_1.primitives)();
114
- const [lift, setLift] = (0, react_1.useState)(0);
115
- const dismissRef = (0, react_1.useRef)(onDismiss);
116
- dismissRef.current = onDismiss;
117
- const duration = toast.duration ?? 4000;
118
- (0, react_1.useEffect)(() => {
119
- if (duration <= 0)
120
- return;
121
- const timer = setTimeout(() => dismissRef.current(), duration);
122
- return () => clearTimeout(timer);
123
- }, [duration]);
124
- const panResponder = (0, react_1.useMemo)(() => {
125
- if (!PanResponder?.create)
126
- return null;
127
- return PanResponder.create({
128
- onMoveShouldSetPanResponder: (_event, gesture) =>
129
- // Only an upward swipe removes a toast; downward drags are ignored.
130
- gesture.dy < -8 && Math.abs(gesture.dy) > Math.abs(gesture.dx),
131
- onPanResponderMove: (_event, gesture) => setLift(Math.min(0, gesture.dy)),
132
- onPanResponderRelease: (_event, gesture) => {
133
- // A quick flick or a long drag removes it; anything less springs back.
134
- if (gesture.dy < -40 || gesture.vy < -0.5) {
135
- dismissRef.current();
136
- }
137
- else {
138
- setLift(0);
139
- }
140
- },
141
- onPanResponderTerminate: () => setLift(0),
142
- });
143
- }, [PanResponder]);
144
- const tone = toast.tone ?? "neutral";
145
- const accent = tone === "neutral" ? theme.foreground : (0, tokens_1.toneColor)(theme, tone);
146
- const pill = ((0, jsx_runtime_1.jsxs)(Glass_1.Glass, { effect: "regular", isDark: isDark, style: {
147
- flexDirection: "row",
148
- alignItems: "center",
149
- gap: 10,
150
- paddingVertical: 10,
151
- paddingHorizontal: 14,
152
- borderRadius: tokens_1.radii.pill,
153
- maxWidth: 420,
154
- borderColor: tone === "neutral" ? theme.edge : accent,
155
- }, children: [toast.icon ? (0, jsx_runtime_1.jsx)(View, { children: toast.icon }) : null, (0, jsx_runtime_1.jsx)(RNText, { accessibilityRole: "alert", accessibilityLiveRegion: "polite", style: { fontSize: 14, color: theme.foreground, flexShrink: 1 }, children: toast.message }), toast.action ? ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: toast.action.label, onPress: () => {
156
- toast.action?.onPress();
157
- onDismiss();
158
- }, style: { paddingHorizontal: 4 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 14, fontWeight: "600", color: theme.fill }, children: toast.action.label }) })) : null] }));
159
- return ((0, jsx_runtime_1.jsx)(View, { style: { transform: [{ translateY: lift }], opacity: lift === 0 ? 1 : Math.max(0.4, 1 + lift / 120) }, ...(panResponder ? panResponder.panHandlers : {}), children: pill }));
160
- }
161
- /**
162
- * An inline alert.
163
- *
164
- * Unlike AlertDialog it is not modal and not an overlay: it sits in the layout
165
- * and pushes the content below it down. The surface is glass with the tone's
166
- * colour as its edge, so the tone reads at a glance without turning the whole
167
- * panel into a solid block of colour.
168
- */
169
- exports.Banner = (0, react_1.forwardRef)(function Banner({ title, message, tone = "info", icon, onDismiss, action, style, isDark: isDarkProp, testID, ...props }, ref) {
170
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
171
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
172
- const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
173
- const accent = (0, tokens_1.toneColor)(theme, tone);
174
- return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { ref: ref, effect: "regular", isDark: isDark, testID: testID, style: { borderRadius: tokens_1.radii.md, borderColor: accent, ...style }, ...props, children: (0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: "row", alignItems: "flex-start", gap: 10, padding: 12 }, children: [icon ? (0, jsx_runtime_1.jsx)(View, { style: { paddingTop: 1 }, children: icon }) : null, (0, jsx_runtime_1.jsxs)(View, { style: { flex: 1, gap: 2 }, children: [title && ((0, jsx_runtime_1.jsx)(RNText, { accessibilityRole: "heading", style: { fontSize: 14, fontWeight: "600", color: theme.foreground }, children: title })), (0, jsx_runtime_1.jsx)(RNText, { accessibilityRole: "alert", style: { fontSize: 13, color: theme.muted, lineHeight: 18 }, children: message }), action && ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: action.label, onPress: action.onPress, style: { alignSelf: "flex-start", paddingTop: 6 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 13, fontWeight: "600", color: accent }, children: action.label }) }))] }), onDismiss && ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: "Dismiss", onPress: onDismiss, hitSlop: 8, style: { padding: 2 }, children: (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 15, color: theme.muted }, children: "\u00D7" }) }))] }) }));
175
- });
176
- /**
177
- * Tracks which row of a List is open, so opening one closes the rest.
178
- *
179
- * A list with two open rows looks broken; iOS Mail and every kit that copied
180
- * it keep at most one. The List provides the registry and each swipeable row
181
- * registers its own close function.
182
- */
183
- const OpenRowContext = (0, react_1.createContext)(null);
184
- /**
185
- * One row of a List.
186
- *
187
- * The row is a Pressable when it has an `onPress`, and inert otherwise, which
188
- * is what the platform expects: a row that does nothing should not announce
189
- * itself as a button. The chevron is decoration and is hidden from screen
190
- * readers, since the row's own role already says it is tappable.
191
- */
192
- exports.ListItem = (0, react_1.forwardRef)(function ListItem({ leading, title, description, trailing, chevron, onPress, disabled = false, selected = false, swipeActions, leadingSwipeActions, swipeActionWidth = 78, swipeable = true, haptics = true, style, isDark: isDarkProp, testID, ...props }, ref) {
193
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
194
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
195
- const { View, Text: RNText, Pressable, PanResponder } = (0, primitives_1.primitives)();
196
- const rowGroup = (0, react_1.useContext)(OpenRowContext);
197
- const interactive = Boolean(onPress) && !disabled;
198
- const showChevron = interactive && chevron !== false && trailing === undefined;
199
- const trailActions = swipeActions?.filter(Boolean) ?? [];
200
- const leadActions = leadingSwipeActions?.filter(Boolean) ?? [];
201
- const canSwipe = swipeable && !disabled && (trailActions.length > 0 || leadActions.length > 0);
202
- // The row's own identity, so a List can close its siblings.
203
- const rowId = (0, react_1.useRef)(`row-${Math.random().toString(36).slice(2)}`);
204
- // 0 is closed; a positive offset reveals trailing actions, negative leading.
205
- const [offset, setOffset] = (0, react_1.useState)(0);
206
- const offsetRef = (0, react_1.useRef)(0);
207
- offsetRef.current = offset;
208
- // A gesture that moved is a swipe, not a tap: the press that follows the
209
- // release must not fire the row's onPress.
210
- const swipedRef = (0, react_1.useRef)(false);
211
- const trailingWidth = trailActions.length * swipeActionWidth;
212
- const leadingWidth = leadActions.length * swipeActionWidth;
213
- const close = () => setOffset(0);
214
- // When another row opens, this one closes.
215
- (0, react_1.useEffect)(() => {
216
- if (rowGroup && rowGroup.openId !== rowId.current && offsetRef.current !== 0) {
217
- setOffset(0);
218
- }
219
- }, [rowGroup?.openId]);
220
- const settle = (next) => {
221
- setOffset(next);
222
- if (rowGroup) {
223
- rowGroup.setOpenId(next !== 0 ? rowId.current : null);
224
- }
225
- if (next !== 0 && haptics && offsetRef.current === 0)
226
- (0, haptics_1.hapticSelection)();
227
- };
228
- const panResponder = (0, react_1.useMemo)(() => {
229
- if (!canSwipe || !PanResponder?.create)
230
- return null;
231
- return PanResponder.create({
232
- // A horizontal drag claims the gesture; a vertical one stays with the
233
- // surrounding scroll view.
234
- onMoveShouldSetPanResponder: (_event, gesture) => Math.abs(gesture.dx) > Math.abs(gesture.dy) && Math.abs(gesture.dx) > 8,
235
- onPanResponderGrant: () => {
236
- swipedRef.current = false;
237
- },
238
- onPanResponderMove: (_event, gesture) => {
239
- if (Math.abs(gesture.dx) > 4)
240
- swipedRef.current = true;
241
- const from = offsetRef.current;
242
- let next = from + gesture.dx;
243
- // Do not drag past what the actions actually occupy; a small
244
- // overshoot makes the edge feel elastic rather than hard.
245
- next = Math.min(next, trailingWidth + 24);
246
- next = Math.max(next, -(leadingWidth + 24));
247
- setOffset(next);
248
- },
249
- onPanResponderRelease: (_event, gesture) => {
250
- const released = offsetRef.current;
251
- // Beyond half an action, or with a decisive flick, it stays open;
252
- // otherwise it falls back closed.
253
- if (gesture.dx > 0 && trailActions.length > 0) {
254
- settle(released > trailingWidth / 2 || gesture.vx > 0.5 ? trailingWidth : 0);
255
- }
256
- else if (gesture.dx < 0 && leadActions.length > 0) {
257
- settle(released < -leadingWidth / 2 || gesture.vx < -0.5 ? -leadingWidth : 0);
258
- }
259
- else {
260
- settle(offsetRef.current > 0 ? Math.min(offsetRef.current, trailingWidth) : Math.max(offsetRef.current, -leadingWidth));
261
- }
262
- },
263
- onPanResponderTerminate: () => settle(0),
264
- onPanResponderTerminationRequest: () => false,
265
- });
266
- // The responder reads from refs, so it never acts on a stale offset.
267
- }, [canSwipe, PanResponder, trailingWidth, leadingWidth, trailActions.length, leadActions.length]);
268
- /**
269
- * Runs an action and closes the row.
270
- *
271
- * The action is dispatched first so its own feedback is not delayed by the
272
- * close, then the row resets — the reveal should not outlive the press.
273
- */
274
- const runAction = (action) => {
275
- action.onPress();
276
- settle(0);
277
- if (rowGroup)
278
- rowGroup.setOpenId(null);
279
- };
280
- const guardPress = (handler) => () => {
281
- // Swallow the press that ends a swipe.
282
- if (swipedRef.current) {
283
- swipedRef.current = false;
284
- return;
285
- }
286
- handler?.();
287
- };
288
- const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [leading ? (0, jsx_runtime_1.jsx)(View, { style: { marginRight: 12 }, children: leading }) : null, (0, jsx_runtime_1.jsxs)(View, { style: { flex: 1, gap: 2 }, children: [(0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: { fontSize: 16, color: theme.foreground, fontWeight: "400" }, children: title }), description ? ((0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 2, style: { fontSize: 13, color: theme.muted, lineHeight: 17 }, children: description })) : null] }), trailing ? (0, jsx_runtime_1.jsx)(View, { style: { marginLeft: 8 }, children: trailing }) : null, showChevron ? ((0, jsx_runtime_1.jsx)(RNText, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { marginLeft: 6, fontSize: 17, color: theme.muted }, children: "\u203A" })) : null] }));
289
- const rowStyle = {
290
- flexDirection: "row",
291
- alignItems: "center",
292
- minHeight: 48,
293
- paddingVertical: 10,
294
- paddingHorizontal: 14,
295
- backgroundColor: selected ? theme.glassActive : "transparent",
296
- opacity: disabled ? 0.38 : 1,
297
- ...style,
298
- };
299
- const rowInner = !interactive ? ((0, jsx_runtime_1.jsx)(View, { accessibilityRole: "text", accessibilityState: { disabled }, style: rowStyle, children: content })) : ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityLabel: description ? `${title}, ${description}` : title, accessibilityState: { selected, disabled }, disabled: disabled, onPress: guardPress(onPress), style: ({ pressed }) => ({ ...rowStyle, opacity: pressed ? 0.7 : rowStyle.opacity }), children: content }));
300
- if (!canSwipe) {
301
- return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, style: { overflow: "hidden" }, ...props, children: rowInner }));
302
- }
303
- /** The tinted tray behind the row: glass-tinted actions, flat not glass. */
304
- const tray = (actions, edge) => ((0, jsx_runtime_1.jsx)(View, { style: {
305
- position: "absolute",
306
- top: 0,
307
- bottom: 0,
308
- [edge]: 0,
309
- flexDirection: "row",
310
- }, children: actions.map((action, index) => ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "button", accessibilityLabel: action.label, onPress: () => runAction(action), style: {
311
- width: swipeActionWidth,
312
- alignItems: "center",
313
- justifyContent: "center",
314
- gap: 3,
315
- backgroundColor: action.color ?? theme.glassActive,
316
- }, children: [action.icon, (0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 12, color: theme.foreground }, numberOfLines: 1, children: action.label })] }, `${action.label}-${index}`))) }));
317
- return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, accessibilityRole: "none", style: { overflow: "hidden" }, ...props, children: [leadActions.length > 0 ? tray(leadActions, "right") : null, trailActions.length > 0 ? tray(trailActions, "left") : null, (0, jsx_runtime_1.jsx)(View, { style: {
318
- transform: [{ translateX: offset }],
319
- // The row rides over its tray while it is open, so the actions are
320
- // uncovered rather than shown alongside.
321
- backgroundColor: "transparent",
322
- }, ...(panResponder ? panResponder.panHandlers : {}), children: rowInner })] }));
323
- });
324
- /**
325
- * A grouped list of rows — the backbone of settings and profile screens.
326
- *
327
- * With `inset`, the rows sit on one glass panel with hairline separators, which
328
- * is the shape iOS settings screens use. The separators are drawn by the
329
- * caller's ListItem spacing rather than by nesting glass inside glass.
330
- */
331
- exports.List = (0, react_1.forwardRef)(function List({ children, inset = false, style, isDark: isDarkProp, testID, ...props }, ref) {
332
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
333
- const { View } = (0, primitives_1.primitives)();
334
- const rows = Array.isArray(children) ? children.filter(Boolean) : children == null ? [] : [children];
335
- // At most one swipeable row is open at a time, so a list never shows two
336
- // trays at once.
337
- const [openId, setOpenId] = (0, react_1.useState)(null);
338
- const group = (0, react_1.useMemo)(() => ({ openId, setOpenId }), [openId]);
339
- const body = ((0, jsx_runtime_1.jsx)(OpenRowContext.Provider, { value: group, children: (0, jsx_runtime_1.jsx)(View, { style: { gap: 2 }, children: rows.map((row, index) => ((0, jsx_runtime_1.jsxs)(View, { children: [index > 0 ? (0, jsx_runtime_1.jsx)(Display_1.Separator, { isDark: isDark, inset: inset ? 14 : 0 }) : null, row] }, index))) }) }));
340
- if (!inset) {
341
- return ((0, jsx_runtime_1.jsx)(View, { ref: ref, testID: testID, style: style, ...props, children: body }));
342
- }
343
- return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { ref: ref, effect: "regular", isDark: isDark, testID: testID, style: { borderRadius: tokens_1.radii.md, overflow: "hidden", ...style }, ...props, children: body }));
344
- });
345
- exports.ListSection = (0, react_1.forwardRef)(function ListSection({ header, children, style, isDark: isDarkProp, testID, ...props }, ref) {
346
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
347
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
348
- const { View, Text: RNText } = (0, primitives_1.primitives)();
349
- return ((0, jsx_runtime_1.jsxs)(View, { ref: ref, testID: testID, style: [{ gap: 6 }, style], ...props, children: [header ? ((0, jsx_runtime_1.jsx)(RNText, { accessibilityRole: "heading", style: {
350
- fontSize: 12,
351
- fontWeight: "600",
352
- letterSpacing: 0.4,
353
- textTransform: "uppercase",
354
- color: theme.muted,
355
- paddingHorizontal: 14,
356
- }, children: header })) : null, (0, jsx_runtime_1.jsx)(exports.List, { inset: true, isDark: isDark, children: children })] }));
357
- });
358
- /**
359
- * Expandable sections.
360
- *
361
- * The header is a Pressable reporting `expanded`; the panel is measured with
362
- * the height the content reports and animated on the springs token, so the
363
- * reveal is a real transition rather than an instant jump.
364
- */
365
- exports.Accordion = (0, react_1.forwardRef)(function Accordion({ sections, multiple = false, openSections: openProp, defaultOpenSections = [], onOpenSectionsChange, style, isDark: isDarkProp, testID, ...props }, ref) {
366
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
367
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
368
- const { View, Text: RNText, Pressable } = (0, primitives_1.primitives)();
369
- const [internalOpen, setInternalOpen] = (0, react_1.useState)(defaultOpenSections);
370
- const open = openProp !== undefined ? openProp : internalOpen;
371
- const toggle = (value) => {
372
- const isOpen = open.includes(value);
373
- let next;
374
- if (isOpen)
375
- next = open.filter((item) => item !== value);
376
- else
377
- next = multiple ? [...open, value] : [value];
378
- if (openProp === undefined)
379
- setInternalOpen(next);
380
- onOpenSectionsChange?.(next);
381
- };
382
- return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { ref: ref, effect: "regular", isDark: isDark, testID: testID, style: { borderRadius: tokens_1.radii.md, overflow: "hidden", ...style }, ...props, children: sections.map((section, index) => {
383
- const expanded = open.includes(section.value);
384
- return ((0, jsx_runtime_1.jsxs)(View, { children: [index > 0 ? (0, jsx_runtime_1.jsx)(Display_1.Separator, { isDark: isDark }) : null, (0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "button", accessibilityLabel: section.title, accessibilityState: { expanded }, onPress: () => toggle(section.value), style: { paddingVertical: 12, paddingHorizontal: 14, flexDirection: "row", alignItems: "center" }, children: [(0, jsx_runtime_1.jsxs)(View, { style: { flex: 1, gap: 2 }, children: [(0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 15, fontWeight: "500", color: theme.foreground }, children: section.title }), section.description ? ((0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 13, color: theme.muted }, children: section.description })) : null] }), (0, jsx_runtime_1.jsx)(RNText, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { fontSize: 13, color: theme.muted, marginLeft: 8 }, children: expanded ? "\u2303" : "\u2304" })] }), expanded ? ((0, jsx_runtime_1.jsx)(View, { style: { paddingHorizontal: 14, paddingBottom: 12 }, children: section.content })) : null] }, section.value));
385
- }) }));
386
- });
@@ -1,164 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Label = void 0;
4
- exports.Field = Field;
5
- exports.Checkbox = Checkbox;
6
- exports.RadioGroup = RadioGroup;
7
- exports.Select = Select;
8
- const jsx_runtime_1 = require("react/jsx-runtime");
9
- const react_1 = require("react");
10
- const tokens_1 = require("./internal/tokens");
11
- const primitives_1 = require("./internal/primitives");
12
- const motion_1 = require("./internal/motion");
13
- /** The text above a control. */
14
- exports.Label = (0, react_1.forwardRef)(function Label({ children, required = false, disabled = false, nativeID, isDark: isDarkProp, style }, ref) {
15
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
16
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
17
- const { Text } = (0, primitives_1.primitives)();
18
- return ((0, jsx_runtime_1.jsxs)(Text, { ref: ref, nativeID: nativeID, accessibilityRole: "text", style: {
19
- fontSize: 13,
20
- fontWeight: "600",
21
- color: disabled ? theme.muted : theme.foreground,
22
- opacity: disabled ? 0.6 : 1,
23
- ...style,
24
- }, children: [children, required && (0, jsx_runtime_1.jsx)(Text, { style: { color: theme.destructive }, children: " *" })] }));
25
- });
26
- /**
27
- * Label, control and message stacked in the order assistive tech announces
28
- * them, so a caller never has to place these three by hand.
29
- */
30
- function Field({ label, description, error, required = false, disabled = false, isDark: isDarkProp, children, style, }) {
31
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
32
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
33
- const { View, Text } = (0, primitives_1.primitives)();
34
- const message = error ?? description;
35
- return ((0, jsx_runtime_1.jsxs)(View, { style: { gap: 6, ...style }, children: [label && ((0, jsx_runtime_1.jsx)(exports.Label, { required: required, disabled: disabled, isDark: isDark, children: label })), children, message && ((0, jsx_runtime_1.jsx)(Text, { accessibilityRole: error ? "alert" : "text", style: {
36
- fontSize: 11,
37
- color: error ? theme.destructive : theme.muted,
38
- }, children: message }))] }));
39
- }
40
- /** A tick box for a single boolean, with an optional label and description. */
41
- function Checkbox({ checked: checkedProp, defaultChecked = false, onCheckedChange, label, description, indeterminate = false, disabled = false, isDark: isDarkProp, style, testID, }) {
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
- // Controlled when `checked` is given, otherwise the box owns its state.
46
- const [internalChecked, setInternalChecked] = (0, react_1.useState)(defaultChecked);
47
- const checked = checkedProp !== undefined ? checkedProp : internalChecked;
48
- const toggle = () => {
49
- if (disabled)
50
- return;
51
- const next = !checked;
52
- if (checkedProp === undefined)
53
- setInternalChecked(next);
54
- onCheckedChange?.(next);
55
- };
56
- const filled = checked || indeterminate;
57
- return ((0, jsx_runtime_1.jsxs)(Pressable, { testID: testID, accessibilityRole: "checkbox", accessibilityState: { checked, disabled }, accessibilityLabel: label, disabled: disabled, onPress: toggle, style: {
58
- flexDirection: "row",
59
- alignItems: "flex-start",
60
- gap: 10,
61
- opacity: disabled ? 0.45 : 1,
62
- ...style,
63
- }, children: [(0, jsx_runtime_1.jsx)(View, { style: {
64
- width: 20,
65
- height: 20,
66
- borderRadius: 6,
67
- borderWidth: filled ? 0 : 1.5,
68
- borderColor: theme.edge,
69
- backgroundColor: filled ? theme.fill : "transparent",
70
- alignItems: "center",
71
- justifyContent: "center",
72
- marginTop: 1,
73
- }, children: indeterminate ? ((0, jsx_runtime_1.jsx)(View, { style: { width: 10, height: 2, borderRadius: 1, backgroundColor: "#fff" } })) : checked ? (
74
- // A glyph rather than an icon dependency: one text node, no package.
75
- (0, jsx_runtime_1.jsx)(Text, { style: { color: "#fff", fontSize: 12, fontWeight: "700", lineHeight: 14 }, children: "\u2713" })) : null }), (label || description) && ((0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [label && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 14, color: theme.foreground, fontWeight: "500" }, children: label })), description && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted, marginTop: 2 }, children: description }))] }))] }));
76
- }
77
- /** One choice from a small, always-visible set. */
78
- function RadioGroup({ value: valueProp, defaultValue, onValueChange, options, horizontal = false, disabled = false, isDark: isDarkProp, style, testID, }) {
79
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
80
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
81
- const { View, Text, Pressable } = (0, primitives_1.primitives)();
82
- // Controlled when `value` is given, otherwise the group owns its selection.
83
- const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue);
84
- const value = valueProp !== undefined ? valueProp : internalValue;
85
- const select = (next, isDisabled) => {
86
- if (isDisabled)
87
- return;
88
- if (valueProp === undefined)
89
- setInternalValue(next);
90
- onValueChange?.(next);
91
- };
92
- return ((0, jsx_runtime_1.jsx)(View, { testID: testID, accessibilityRole: "radiogroup", style: {
93
- gap: horizontal ? 14 : 10,
94
- flexDirection: horizontal ? "row" : "column",
95
- ...style,
96
- }, children: options.map((option) => {
97
- const isSelected = option.value === value;
98
- const isDisabled = disabled || option.disabled;
99
- return ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "radio", accessibilityState: { checked: isSelected, disabled: isDisabled }, accessibilityLabel: option.label, disabled: isDisabled, onPress: () => select(option.value, isDisabled), style: {
100
- flexDirection: "row",
101
- alignItems: "flex-start",
102
- gap: 9,
103
- opacity: isDisabled ? 0.45 : 1,
104
- }, children: [(0, jsx_runtime_1.jsx)(View, { style: {
105
- width: 20,
106
- height: 20,
107
- borderRadius: 10,
108
- borderWidth: isSelected ? 6 : 1.5,
109
- borderColor: isSelected ? theme.fill : theme.edge,
110
- marginTop: 1,
111
- } }), (0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 14, color: theme.foreground }, children: option.label }), option.description && ((0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: theme.muted, marginTop: 2 }, children: option.description }))] })] }, option.value));
112
- }) }));
113
- }
114
- /**
115
- * A dropdown of mutually exclusive options.
116
- *
117
- * Native has no built-in picker that looks the same on iOS and Android, so the
118
- * list opens inline: predictable across platforms and reachable without a
119
- * modal. A long list scrolls naturally with the page.
120
- */
121
- function Select({ value: valueProp, defaultValue, onValueChange, options, placeholder = "Select an option", disabled = false, isDark: isDarkProp, style, testID, }) {
122
- const isDark = (0, motion_1.useIsDark)(isDarkProp);
123
- const theme = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
124
- const { View, Text, Pressable } = (0, primitives_1.primitives)();
125
- const [open, setOpen] = (0, react_1.useState)(false);
126
- // Controlled when `value` is given, otherwise the select owns its choice.
127
- const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue);
128
- const value = valueProp !== undefined ? valueProp : internalValue;
129
- const choose = (next) => {
130
- if (valueProp === undefined)
131
- setInternalValue(next);
132
- onValueChange?.(next);
133
- };
134
- const selected = options.find((option) => option.value === value);
135
- return ((0, jsx_runtime_1.jsxs)(View, { style: style, children: [(0, jsx_runtime_1.jsxs)(Pressable, { testID: testID, accessibilityRole: "button", accessibilityState: { expanded: open, disabled }, accessibilityLabel: selected?.label ?? placeholder, disabled: disabled, onPress: () => setOpen(!open), style: {
136
- minHeight: 42,
137
- flexDirection: "row",
138
- alignItems: "center",
139
- justifyContent: "space-between",
140
- paddingHorizontal: 12,
141
- borderRadius: tokens_1.radii.md,
142
- borderWidth: 1,
143
- borderColor: theme.edge,
144
- backgroundColor: theme.glass,
145
- opacity: disabled ? 0.5 : 1,
146
- }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 15, color: selected ? theme.foreground : theme.muted }, children: selected?.label ?? placeholder }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 10, color: theme.muted }, children: open ? "▲" : "▼" })] }), open && ((0, jsx_runtime_1.jsx)(View, { style: {
147
- marginTop: 6,
148
- borderRadius: tokens_1.radii.md,
149
- borderWidth: 1,
150
- borderColor: theme.edge,
151
- backgroundColor: theme.glass,
152
- overflow: "hidden",
153
- }, children: options.map((option) => {
154
- const isSelected = option.value === value;
155
- return ((0, jsx_runtime_1.jsx)(Pressable, { accessibilityRole: "button", accessibilityState: { selected: isSelected }, accessibilityLabel: option.label, onPress: () => {
156
- choose(option.value);
157
- setOpen(false);
158
- }, style: {
159
- paddingVertical: 10,
160
- paddingHorizontal: 12,
161
- backgroundColor: isSelected ? theme.glassActive : "transparent",
162
- }, children: (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 14, color: theme.foreground }, children: option.label }) }, option.value));
163
- }) }))] }));
164
- }