@webority/mobile-ui 0.1.0 → 0.2.1

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 (405) hide show
  1. package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
  2. package/lib/commonjs/components/Button/Button.js +1 -1
  3. package/lib/commonjs/components/Confetti/Confetti.js +1 -1
  4. package/lib/commonjs/components/Drawer/Drawer.js +1 -1
  5. package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
  6. package/lib/commonjs/components/SlideToConfirm/SlideToConfirm.js +1 -1
  7. package/lib/commonjs/components/Slider/Slider.js +1 -1
  8. package/lib/commonjs/components/Swipeable/Swipeable.js +1 -1
  9. package/lib/commonjs/components/ZoomableImage/ZoomableImage.js +1 -1
  10. package/lib/module/components/Accordion/Accordion.js +1 -1
  11. package/lib/module/components/Accordion/index.js +1 -1
  12. package/lib/module/components/AmountSlider/AmountSlider.js +1 -1
  13. package/lib/module/components/AmountSlider/index.js +1 -1
  14. package/lib/module/components/AnimatePresence/AnimatePresence.js +1 -1
  15. package/lib/module/components/AnimatePresence/index.js +1 -1
  16. package/lib/module/components/AppBar/AppBar.js +1 -1
  17. package/lib/module/components/AppBar/index.js +1 -1
  18. package/lib/module/components/AppIcon/AppIcon.js +1 -1
  19. package/lib/module/components/AppIcon/catalog/bold/a.g.js +1 -1
  20. package/lib/module/components/AppIcon/catalog/bold/b.g.js +1 -1
  21. package/lib/module/components/AppIcon/catalog/bold/c.g.js +1 -1
  22. package/lib/module/components/AppIcon/catalog/bold/d.g.js +1 -1
  23. package/lib/module/components/AppIcon/catalog/bold/e.g.js +1 -1
  24. package/lib/module/components/AppIcon/catalog/bold/f.g.js +1 -1
  25. package/lib/module/components/AppIcon/catalog/bold/g.g.js +1 -1
  26. package/lib/module/components/AppIcon/catalog/bold/h.g.js +1 -1
  27. package/lib/module/components/AppIcon/catalog/bold/i.g.js +1 -1
  28. package/lib/module/components/AppIcon/catalog/bold/j.g.js +1 -1
  29. package/lib/module/components/AppIcon/catalog/bold/k.g.js +1 -1
  30. package/lib/module/components/AppIcon/catalog/bold/l.g.js +1 -1
  31. package/lib/module/components/AppIcon/catalog/bold/m.g.js +1 -1
  32. package/lib/module/components/AppIcon/catalog/bold/n.g.js +1 -1
  33. package/lib/module/components/AppIcon/catalog/bold/o.g.js +1 -1
  34. package/lib/module/components/AppIcon/catalog/bold/p.g.js +1 -1
  35. package/lib/module/components/AppIcon/catalog/bold/q.g.js +1 -1
  36. package/lib/module/components/AppIcon/catalog/bold/r.g.js +1 -1
  37. package/lib/module/components/AppIcon/catalog/bold/s.g.js +1 -1
  38. package/lib/module/components/AppIcon/catalog/bold/t.g.js +1 -1
  39. package/lib/module/components/AppIcon/catalog/bold/u.g.js +1 -1
  40. package/lib/module/components/AppIcon/catalog/bold/v.g.js +1 -1
  41. package/lib/module/components/AppIcon/catalog/bold/w.g.js +1 -1
  42. package/lib/module/components/AppIcon/catalog/bold/x.g.js +1 -1
  43. package/lib/module/components/AppIcon/catalog/bold/y.g.js +1 -1
  44. package/lib/module/components/AppIcon/catalog/bold/z.g.js +1 -1
  45. package/lib/module/components/AppIcon/catalog/broken/a.g.js +1 -1
  46. package/lib/module/components/AppIcon/catalog/broken/b.g.js +1 -1
  47. package/lib/module/components/AppIcon/catalog/broken/c.g.js +1 -1
  48. package/lib/module/components/AppIcon/catalog/broken/d.g.js +1 -1
  49. package/lib/module/components/AppIcon/catalog/broken/e.g.js +1 -1
  50. package/lib/module/components/AppIcon/catalog/broken/f.g.js +1 -1
  51. package/lib/module/components/AppIcon/catalog/broken/g.g.js +1 -1
  52. package/lib/module/components/AppIcon/catalog/broken/h.g.js +1 -1
  53. package/lib/module/components/AppIcon/catalog/broken/i.g.js +1 -1
  54. package/lib/module/components/AppIcon/catalog/broken/j.g.js +1 -1
  55. package/lib/module/components/AppIcon/catalog/broken/k.g.js +1 -1
  56. package/lib/module/components/AppIcon/catalog/broken/l.g.js +1 -1
  57. package/lib/module/components/AppIcon/catalog/broken/m.g.js +1 -1
  58. package/lib/module/components/AppIcon/catalog/broken/n.g.js +1 -1
  59. package/lib/module/components/AppIcon/catalog/broken/o.g.js +1 -1
  60. package/lib/module/components/AppIcon/catalog/broken/p.g.js +1 -1
  61. package/lib/module/components/AppIcon/catalog/broken/q.g.js +1 -1
  62. package/lib/module/components/AppIcon/catalog/broken/r.g.js +1 -1
  63. package/lib/module/components/AppIcon/catalog/broken/s.g.js +1 -1
  64. package/lib/module/components/AppIcon/catalog/broken/t.g.js +1 -1
  65. package/lib/module/components/AppIcon/catalog/broken/u.g.js +1 -1
  66. package/lib/module/components/AppIcon/catalog/broken/v.g.js +1 -1
  67. package/lib/module/components/AppIcon/catalog/broken/w.g.js +1 -1
  68. package/lib/module/components/AppIcon/catalog/broken/x.g.js +1 -1
  69. package/lib/module/components/AppIcon/catalog/broken/y.g.js +1 -1
  70. package/lib/module/components/AppIcon/catalog/broken/z.g.js +1 -1
  71. package/lib/module/components/AppIcon/catalog/bulk/a.g.js +1 -1
  72. package/lib/module/components/AppIcon/catalog/bulk/b.g.js +1 -1
  73. package/lib/module/components/AppIcon/catalog/bulk/c.g.js +1 -1
  74. package/lib/module/components/AppIcon/catalog/bulk/d.g.js +1 -1
  75. package/lib/module/components/AppIcon/catalog/bulk/e.g.js +1 -1
  76. package/lib/module/components/AppIcon/catalog/bulk/f.g.js +1 -1
  77. package/lib/module/components/AppIcon/catalog/bulk/g.g.js +1 -1
  78. package/lib/module/components/AppIcon/catalog/bulk/h.g.js +1 -1
  79. package/lib/module/components/AppIcon/catalog/bulk/i.g.js +1 -1
  80. package/lib/module/components/AppIcon/catalog/bulk/j.g.js +1 -1
  81. package/lib/module/components/AppIcon/catalog/bulk/k.g.js +1 -1
  82. package/lib/module/components/AppIcon/catalog/bulk/l.g.js +1 -1
  83. package/lib/module/components/AppIcon/catalog/bulk/m.g.js +1 -1
  84. package/lib/module/components/AppIcon/catalog/bulk/n.g.js +1 -1
  85. package/lib/module/components/AppIcon/catalog/bulk/o.g.js +1 -1
  86. package/lib/module/components/AppIcon/catalog/bulk/p.g.js +1 -1
  87. package/lib/module/components/AppIcon/catalog/bulk/q.g.js +1 -1
  88. package/lib/module/components/AppIcon/catalog/bulk/r.g.js +1 -1
  89. package/lib/module/components/AppIcon/catalog/bulk/s.g.js +1 -1
  90. package/lib/module/components/AppIcon/catalog/bulk/t.g.js +1 -1
  91. package/lib/module/components/AppIcon/catalog/bulk/u.g.js +1 -1
  92. package/lib/module/components/AppIcon/catalog/bulk/v.g.js +1 -1
  93. package/lib/module/components/AppIcon/catalog/bulk/w.g.js +1 -1
  94. package/lib/module/components/AppIcon/catalog/bulk/x.g.js +1 -1
  95. package/lib/module/components/AppIcon/catalog/bulk/y.g.js +1 -1
  96. package/lib/module/components/AppIcon/catalog/bulk/z.g.js +1 -1
  97. package/lib/module/components/AppIcon/catalog/linear/a.g.js +1 -1
  98. package/lib/module/components/AppIcon/catalog/linear/b.g.js +1 -1
  99. package/lib/module/components/AppIcon/catalog/linear/c.g.js +1 -1
  100. package/lib/module/components/AppIcon/catalog/linear/d.g.js +1 -1
  101. package/lib/module/components/AppIcon/catalog/linear/e.g.js +1 -1
  102. package/lib/module/components/AppIcon/catalog/linear/f.g.js +1 -1
  103. package/lib/module/components/AppIcon/catalog/linear/g.g.js +1 -1
  104. package/lib/module/components/AppIcon/catalog/linear/h.g.js +1 -1
  105. package/lib/module/components/AppIcon/catalog/linear/i.g.js +1 -1
  106. package/lib/module/components/AppIcon/catalog/linear/j.g.js +1 -1
  107. package/lib/module/components/AppIcon/catalog/linear/k.g.js +1 -1
  108. package/lib/module/components/AppIcon/catalog/linear/l.g.js +1 -1
  109. package/lib/module/components/AppIcon/catalog/linear/m.g.js +1 -1
  110. package/lib/module/components/AppIcon/catalog/linear/n.g.js +1 -1
  111. package/lib/module/components/AppIcon/catalog/linear/o.g.js +1 -1
  112. package/lib/module/components/AppIcon/catalog/linear/p.g.js +1 -1
  113. package/lib/module/components/AppIcon/catalog/linear/q.g.js +1 -1
  114. package/lib/module/components/AppIcon/catalog/linear/r.g.js +1 -1
  115. package/lib/module/components/AppIcon/catalog/linear/s.g.js +1 -1
  116. package/lib/module/components/AppIcon/catalog/linear/t.g.js +1 -1
  117. package/lib/module/components/AppIcon/catalog/linear/u.g.js +1 -1
  118. package/lib/module/components/AppIcon/catalog/linear/v.g.js +1 -1
  119. package/lib/module/components/AppIcon/catalog/linear/w.g.js +1 -1
  120. package/lib/module/components/AppIcon/catalog/linear/x.g.js +1 -1
  121. package/lib/module/components/AppIcon/catalog/linear/y.g.js +1 -1
  122. package/lib/module/components/AppIcon/catalog/linear/z.g.js +1 -1
  123. package/lib/module/components/AppIcon/catalog/outline/a.g.js +1 -1
  124. package/lib/module/components/AppIcon/catalog/outline/b.g.js +1 -1
  125. package/lib/module/components/AppIcon/catalog/outline/c.g.js +1 -1
  126. package/lib/module/components/AppIcon/catalog/outline/d.g.js +1 -1
  127. package/lib/module/components/AppIcon/catalog/outline/e.g.js +1 -1
  128. package/lib/module/components/AppIcon/catalog/outline/f.g.js +1 -1
  129. package/lib/module/components/AppIcon/catalog/outline/g.g.js +1 -1
  130. package/lib/module/components/AppIcon/catalog/outline/h.g.js +1 -1
  131. package/lib/module/components/AppIcon/catalog/outline/i.g.js +1 -1
  132. package/lib/module/components/AppIcon/catalog/outline/j.g.js +1 -1
  133. package/lib/module/components/AppIcon/catalog/outline/k.g.js +1 -1
  134. package/lib/module/components/AppIcon/catalog/outline/l.g.js +1 -1
  135. package/lib/module/components/AppIcon/catalog/outline/m.g.js +1 -1
  136. package/lib/module/components/AppIcon/catalog/outline/n.g.js +1 -1
  137. package/lib/module/components/AppIcon/catalog/outline/o.g.js +1 -1
  138. package/lib/module/components/AppIcon/catalog/outline/p.g.js +1 -1
  139. package/lib/module/components/AppIcon/catalog/outline/q.g.js +1 -1
  140. package/lib/module/components/AppIcon/catalog/outline/r.g.js +1 -1
  141. package/lib/module/components/AppIcon/catalog/outline/s.g.js +1 -1
  142. package/lib/module/components/AppIcon/catalog/outline/t.g.js +1 -1
  143. package/lib/module/components/AppIcon/catalog/outline/u.g.js +1 -1
  144. package/lib/module/components/AppIcon/catalog/outline/v.g.js +1 -1
  145. package/lib/module/components/AppIcon/catalog/outline/w.g.js +1 -1
  146. package/lib/module/components/AppIcon/catalog/outline/x.g.js +1 -1
  147. package/lib/module/components/AppIcon/catalog/outline/y.g.js +1 -1
  148. package/lib/module/components/AppIcon/catalog/outline/z.g.js +1 -1
  149. package/lib/module/components/AppIcon/catalog/twotone/a.g.js +1 -1
  150. package/lib/module/components/AppIcon/catalog/twotone/b.g.js +1 -1
  151. package/lib/module/components/AppIcon/catalog/twotone/c.g.js +1 -1
  152. package/lib/module/components/AppIcon/catalog/twotone/d.g.js +1 -1
  153. package/lib/module/components/AppIcon/catalog/twotone/e.g.js +1 -1
  154. package/lib/module/components/AppIcon/catalog/twotone/f.g.js +1 -1
  155. package/lib/module/components/AppIcon/catalog/twotone/g.g.js +1 -1
  156. package/lib/module/components/AppIcon/catalog/twotone/h.g.js +1 -1
  157. package/lib/module/components/AppIcon/catalog/twotone/i.g.js +1 -1
  158. package/lib/module/components/AppIcon/catalog/twotone/j.g.js +1 -1
  159. package/lib/module/components/AppIcon/catalog/twotone/k.g.js +1 -1
  160. package/lib/module/components/AppIcon/catalog/twotone/l.g.js +1 -1
  161. package/lib/module/components/AppIcon/catalog/twotone/m.g.js +1 -1
  162. package/lib/module/components/AppIcon/catalog/twotone/n.g.js +1 -1
  163. package/lib/module/components/AppIcon/catalog/twotone/o.g.js +1 -1
  164. package/lib/module/components/AppIcon/catalog/twotone/p.g.js +1 -1
  165. package/lib/module/components/AppIcon/catalog/twotone/q.g.js +1 -1
  166. package/lib/module/components/AppIcon/catalog/twotone/r.g.js +1 -1
  167. package/lib/module/components/AppIcon/catalog/twotone/s.g.js +1 -1
  168. package/lib/module/components/AppIcon/catalog/twotone/t.g.js +1 -1
  169. package/lib/module/components/AppIcon/catalog/twotone/u.g.js +1 -1
  170. package/lib/module/components/AppIcon/catalog/twotone/v.g.js +1 -1
  171. package/lib/module/components/AppIcon/catalog/twotone/w.g.js +1 -1
  172. package/lib/module/components/AppIcon/catalog/twotone/x.g.js +1 -1
  173. package/lib/module/components/AppIcon/catalog/twotone/y.g.js +1 -1
  174. package/lib/module/components/AppIcon/catalog/twotone/z.g.js +1 -1
  175. package/lib/module/components/AppIcon/catalog.g.js +1 -1
  176. package/lib/module/components/AppIcon/defaultIcons.js +1 -1
  177. package/lib/module/components/AppIcon/glyphs.g.js +1 -1
  178. package/lib/module/components/AppIcon/index.js +1 -1
  179. package/lib/module/components/AppIcon/slotIcon.js +1 -1
  180. package/lib/module/components/AppIcon/variants.g.js +1 -1
  181. package/lib/module/components/AsyncBlock/AsyncBlock.js +1 -1
  182. package/lib/module/components/AsyncBlock/index.js +1 -1
  183. package/lib/module/components/AuthedImage/AuthedImage.js +1 -1
  184. package/lib/module/components/AuthedImage/authedImageCache.js +1 -1
  185. package/lib/module/components/AuthedImage/index.js +1 -1
  186. package/lib/module/components/Autocomplete/Autocomplete.js +1 -1
  187. package/lib/module/components/Autocomplete/index.js +1 -1
  188. package/lib/module/components/Avatar/Avatar.js +1 -1
  189. package/lib/module/components/Avatar/index.js +1 -1
  190. package/lib/module/components/Badge/Badge.js +1 -1
  191. package/lib/module/components/Badge/index.js +1 -1
  192. package/lib/module/components/Banner/Banner.js +1 -1
  193. package/lib/module/components/Banner/index.js +1 -1
  194. package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
  195. package/lib/module/components/BottomNavigation/index.js +1 -1
  196. package/lib/module/components/BottomSheet/BottomSheet.js +1 -1
  197. package/lib/module/components/BottomSheet/index.js +1 -1
  198. package/lib/module/components/Box/Box.js +1 -1
  199. package/lib/module/components/Box/index.js +1 -1
  200. package/lib/module/components/Button/Button.js +1 -1
  201. package/lib/module/components/Button/index.js +1 -1
  202. package/lib/module/components/Card/Card.js +1 -1
  203. package/lib/module/components/Card/index.js +1 -1
  204. package/lib/module/components/Carousel/Carousel.js +1 -1
  205. package/lib/module/components/Carousel/index.js +1 -1
  206. package/lib/module/components/Checkbox/Checkbox.js +1 -1
  207. package/lib/module/components/Checkbox/index.js +1 -1
  208. package/lib/module/components/Chip/Chip.js +1 -1
  209. package/lib/module/components/Chip/index.js +1 -1
  210. package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
  211. package/lib/module/components/ChoiceGroup/index.js +1 -1
  212. package/lib/module/components/Confetti/Confetti.js +1 -1
  213. package/lib/module/components/Confetti/index.js +1 -1
  214. package/lib/module/components/DatePicker/DatePicker.js +1 -1
  215. package/lib/module/components/DatePicker/index.js +1 -1
  216. package/lib/module/components/DateRangePicker/DateRangePicker.js +1 -1
  217. package/lib/module/components/DateRangePicker/index.js +1 -1
  218. package/lib/module/components/DecimalInput/DecimalInput.js +1 -1
  219. package/lib/module/components/DecimalInput/index.js +1 -1
  220. package/lib/module/components/Descriptions/Descriptions.js +1 -1
  221. package/lib/module/components/Descriptions/index.js +1 -1
  222. package/lib/module/components/Dialog/Dialog.js +1 -1
  223. package/lib/module/components/Dialog/index.js +1 -1
  224. package/lib/module/components/Divider/Divider.js +1 -1
  225. package/lib/module/components/Divider/index.js +1 -1
  226. package/lib/module/components/Drawer/Drawer.js +1 -1
  227. package/lib/module/components/Drawer/index.js +1 -1
  228. package/lib/module/components/EmptyState/EmptyState.js +1 -1
  229. package/lib/module/components/EmptyState/index.js +1 -1
  230. package/lib/module/components/ErrorBoundary/ErrorBoundary.js +1 -1
  231. package/lib/module/components/ErrorBoundary/index.js +1 -1
  232. package/lib/module/components/ErrorBoundary/useErrorHandler.js +1 -1
  233. package/lib/module/components/ErrorBoundary/withErrorBoundary.js +1 -1
  234. package/lib/module/components/FieldBase/Chevron.js +1 -1
  235. package/lib/module/components/FieldBase/ChoiceText.js +1 -1
  236. package/lib/module/components/FieldBase/FieldBase.js +1 -1
  237. package/lib/module/components/FieldBase/index.js +1 -1
  238. package/lib/module/components/FieldBase/useFloatingLabel.js +1 -1
  239. package/lib/module/components/FilePicker/FilePicker.js +1 -1
  240. package/lib/module/components/FilePicker/index.js +1 -1
  241. package/lib/module/components/FileViewer/FileViewer.js +1 -1
  242. package/lib/module/components/FileViewer/index.js +1 -1
  243. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +1 -1
  244. package/lib/module/components/FloatingActionButton/index.js +1 -1
  245. package/lib/module/components/ForceUpdateDialog/ForceUpdateDialog.js +1 -1
  246. package/lib/module/components/ForceUpdateDialog/index.js +1 -1
  247. package/lib/module/components/FormField/FormField.js +1 -1
  248. package/lib/module/components/FormField/index.js +1 -1
  249. package/lib/module/components/IconBadge/IconBadge.js +1 -1
  250. package/lib/module/components/IconBadge/index.js +1 -1
  251. package/lib/module/components/IconButton/IconButton.js +1 -1
  252. package/lib/module/components/IconButton/index.js +1 -1
  253. package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
  254. package/lib/module/components/ImageGallery/index.js +1 -1
  255. package/lib/module/components/InlineSelect/InlineSelect.js +1 -1
  256. package/lib/module/components/InlineSelect/index.js +1 -1
  257. package/lib/module/components/Input/Input.js +1 -1
  258. package/lib/module/components/Input/index.js +1 -1
  259. package/lib/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +1 -1
  260. package/lib/module/components/KeyboardAwareScrollView/index.js +1 -1
  261. package/lib/module/components/KeyboardToolbar/KeyboardToolbar.js +1 -1
  262. package/lib/module/components/KeyboardToolbar/index.js +1 -1
  263. package/lib/module/components/ListItem/ListItem.js +1 -1
  264. package/lib/module/components/ListItem/index.js +1 -1
  265. package/lib/module/components/LoaderOverlay/LoaderOverlay.js +1 -1
  266. package/lib/module/components/LoaderOverlay/index.js +1 -1
  267. package/lib/module/components/Markdown/Markdown.js +1 -1
  268. package/lib/module/components/Markdown/index.js +1 -1
  269. package/lib/module/components/Markdown/parse.js +1 -1
  270. package/lib/module/components/Modal/Modal.js +1 -1
  271. package/lib/module/components/Modal/index.js +1 -1
  272. package/lib/module/components/Notation/Notation.js +1 -1
  273. package/lib/module/components/Notation/index.js +1 -1
  274. package/lib/module/components/NumberInput/NumberInput.js +1 -1
  275. package/lib/module/components/NumberInput/index.js +1 -1
  276. package/lib/module/components/OTPInput/OTPInput.js +1 -1
  277. package/lib/module/components/OTPInput/index.js +1 -1
  278. package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
  279. package/lib/module/components/OptionSheet/index.js +1 -1
  280. package/lib/module/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
  281. package/lib/module/components/PhoneNumberInput/index.js +1 -1
  282. package/lib/module/components/PickerTrigger/PickerTrigger.js +1 -1
  283. package/lib/module/components/PickerTrigger/index.js +1 -1
  284. package/lib/module/components/ProfileCompletion/ProfileCompletion.js +1 -1
  285. package/lib/module/components/ProfileCompletion/index.js +1 -1
  286. package/lib/module/components/ProfilePicker/ProfilePicker.js +1 -1
  287. package/lib/module/components/ProfilePicker/index.js +1 -1
  288. package/lib/module/components/ProgressBar/ProgressBar.js +1 -1
  289. package/lib/module/components/ProgressBar/index.js +1 -1
  290. package/lib/module/components/ProgressRing/ProgressRing.js +1 -1
  291. package/lib/module/components/ProgressRing/index.js +1 -1
  292. package/lib/module/components/Radio/Radio.js +1 -1
  293. package/lib/module/components/Radio/RadioDot.js +1 -1
  294. package/lib/module/components/Radio/RadioGroup.js +1 -1
  295. package/lib/module/components/Radio/index.js +1 -1
  296. package/lib/module/components/Rating/Rating.js +1 -1
  297. package/lib/module/components/Rating/index.js +1 -1
  298. package/lib/module/components/Repeater/Repeater.js +1 -1
  299. package/lib/module/components/Repeater/index.js +1 -1
  300. package/lib/module/components/RichTextEditor/RichTextEditor.js +1 -1
  301. package/lib/module/components/RichTextEditor/index.js +1 -1
  302. package/lib/module/components/RichTextEditor/markdownActions.js +1 -1
  303. package/lib/module/components/SearchBar/SearchBar.js +1 -1
  304. package/lib/module/components/SearchBar/index.js +1 -1
  305. package/lib/module/components/SectionHeader/SectionHeader.js +1 -1
  306. package/lib/module/components/SectionHeader/index.js +1 -1
  307. package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
  308. package/lib/module/components/SegmentedControl/index.js +1 -1
  309. package/lib/module/components/Select/Select.js +1 -1
  310. package/lib/module/components/Select/index.js +1 -1
  311. package/lib/module/components/Skeleton/Skeleton.js +1 -1
  312. package/lib/module/components/Skeleton/SkeletonClock.js +1 -1
  313. package/lib/module/components/Skeleton/SkeletonContent.js +1 -1
  314. package/lib/module/components/Skeleton/SkeletonList.js +1 -1
  315. package/lib/module/components/Skeleton/SkeletonProvider.js +1 -1
  316. package/lib/module/components/Skeleton/SkeletonSkip.js +1 -1
  317. package/lib/module/components/Skeleton/index.js +1 -1
  318. package/lib/module/components/SlideToConfirm/SlideToConfirm.js +1 -1
  319. package/lib/module/components/SlideToConfirm/index.js +1 -1
  320. package/lib/module/components/Slider/Slider.js +1 -1
  321. package/lib/module/components/Slider/index.js +1 -1
  322. package/lib/module/components/Slider/valueText.js +1 -1
  323. package/lib/module/components/SliderField/SliderField.js +1 -1
  324. package/lib/module/components/SliderField/index.js +1 -1
  325. package/lib/module/components/Spinner/Spinner.js +1 -1
  326. package/lib/module/components/Spinner/index.js +1 -1
  327. package/lib/module/components/SquircleFill/SquircleFill.js +1 -1
  328. package/lib/module/components/StatTile/StatTile.js +1 -1
  329. package/lib/module/components/StatTile/index.js +1 -1
  330. package/lib/module/components/StatusBadge/StatusBadge.js +1 -1
  331. package/lib/module/components/StatusBadge/index.js +1 -1
  332. package/lib/module/components/Stepper/Stepper.js +1 -1
  333. package/lib/module/components/Stepper/index.js +1 -1
  334. package/lib/module/components/Swipeable/Swipeable.js +1 -1
  335. package/lib/module/components/Swipeable/index.js +1 -1
  336. package/lib/module/components/Switch/Switch.js +1 -1
  337. package/lib/module/components/Switch/index.js +1 -1
  338. package/lib/module/components/Tabs/Tabs.js +1 -1
  339. package/lib/module/components/Tabs/index.js +1 -1
  340. package/lib/module/components/TagInput/TagInput.js +1 -1
  341. package/lib/module/components/TagInput/index.js +1 -1
  342. package/lib/module/components/Text/Text.js +1 -1
  343. package/lib/module/components/Text/index.js +1 -1
  344. package/lib/module/components/TimePicker/TimePicker.js +1 -1
  345. package/lib/module/components/TimePicker/index.js +1 -1
  346. package/lib/module/components/Timeline/Timeline.js +1 -1
  347. package/lib/module/components/Timeline/index.js +1 -1
  348. package/lib/module/components/Toast/Toast.js +1 -1
  349. package/lib/module/components/Toast/ToastProvider.js +1 -1
  350. package/lib/module/components/Toast/index.js +1 -1
  351. package/lib/module/components/Tooltip/Tooltip.js +1 -1
  352. package/lib/module/components/Tooltip/index.js +1 -1
  353. package/lib/module/components/Tour/Tour.js +1 -1
  354. package/lib/module/components/Tour/index.js +1 -1
  355. package/lib/module/components/ZoomableImage/ZoomableImage.js +1 -1
  356. package/lib/module/components/ZoomableImage/index.js +1 -1
  357. package/lib/module/components/index.js +1 -1
  358. package/lib/module/form/FormContext.js +1 -1
  359. package/lib/module/form/HookFormField.js +1 -1
  360. package/lib/module/form/equal.js +1 -1
  361. package/lib/module/form/index.js +1 -1
  362. package/lib/module/form/path.js +1 -1
  363. package/lib/module/form/rules.js +1 -1
  364. package/lib/module/form/types.js +1 -0
  365. package/lib/module/form/useField.js +1 -1
  366. package/lib/module/form/useForm.js +1 -1
  367. package/lib/module/form/useFormCompletion.js +1 -1
  368. package/lib/module/form/useHookFormField.js +1 -1
  369. package/lib/module/hooks/index.js +1 -1
  370. package/lib/module/hooks/useControllableState.js +1 -1
  371. package/lib/module/hooks/useDebounce.js +1 -1
  372. package/lib/module/hooks/useDragToDismiss.js +1 -1
  373. package/lib/module/hooks/useFlickGuard.js +1 -1
  374. package/lib/module/hooks/usePressAnimation.js +1 -1
  375. package/lib/module/hooks/useReducedMotion.js +1 -1
  376. package/lib/module/hooks/useToggle.js +1 -1
  377. package/lib/module/index.js +1 -1
  378. package/lib/module/initUI.js +1 -1
  379. package/lib/module/network/NetworkStatusBanner.js +1 -1
  380. package/lib/module/network/index.js +1 -1
  381. package/lib/module/specs/NativePdfRasterizer.js +1 -1
  382. package/lib/module/theme/Gradient.js +1 -1
  383. package/lib/module/theme/ThemeContext.js +1 -1
  384. package/lib/module/theme/animatedValue.js +1 -1
  385. package/lib/module/theme/index.js +1 -1
  386. package/lib/module/theme/merge.js +1 -1
  387. package/lib/module/theme/textStyle.js +1 -1
  388. package/lib/module/theme/tokens.js +1 -1
  389. package/lib/module/theme/types.js +1 -1
  390. package/lib/module/utils/color.js +1 -1
  391. package/lib/module/utils/corners.js +1 -1
  392. package/lib/module/utils/dimensions.js +1 -1
  393. package/lib/module/utils/feedback.js +1 -1
  394. package/lib/module/utils/hapticUtils.js +1 -1
  395. package/lib/module/utils/hashString.js +1 -1
  396. package/lib/module/utils/index.js +1 -1
  397. package/lib/module/utils/mergeRefs.js +1 -1
  398. package/lib/module/utils/responsive.js +1 -1
  399. package/lib/module/utils/shadows.js +1 -1
  400. package/lib/module/utils/spacing.js +1 -1
  401. package/lib/module/utils/squircle.js +1 -1
  402. package/lib/module/utils/warnUnknownProps.js +1 -1
  403. package/lib/typescript/commonjs/components/Button/Button.d.ts +5 -0
  404. package/lib/typescript/module/components/Button/Button.d.ts +5 -0
  405. package/package.json +2 -2
@@ -1 +1 @@
1
- import e from"react";import{View as t}from"react-native";import{useTheme as r}from"../../theme/index.js";import{AppIcon as i}from"../AppIcon/index.js";import{EmptyState as o}from"../EmptyState/index.js";import{Spinner as n}from"../Spinner/index.js";import{jsx as s,jsxs as l,Fragment as c}from"react/jsx-runtime";export const AsyncBlock=({loading:e=!1,error:a,errorVariant:d="default",empty:m=!1,onRetry:p,skeleton:y,emptyTitle:f="Nothing here yet",emptyDescription:h,emptyIcon:x,errorTitle:g="That didn't load",offlineTitle:u="You're offline",retryLabel:I="Try again",children:j,style:D,testID:k})=>{const T=r();if(e)return s(t,{style:D,testID:k,children:y??s(t,{style:{paddingVertical:T.spacing["2xl"],alignItems:"center"},children:s(n,{})})});if(a){const e="offline"===d,r="string"==typeof a?a:e?"Check your connection, then try again.":void 0;return l(t,{style:D,testID:k,children:[s(o,{icon:e?s(i,{name:"cloud-cross",size:"xl",color:T.colors.text.tertiary,testID:"async-block-offline-icon"}):void 0,title:e?u:g,description:r,action:p?{label:I,onPress:p}:void 0}),"string"==typeof a?null:a]})}return m?s(t,{style:D,testID:k,children:s(o,{icon:x,title:f,description:h})}):s(c,{children:j})};export default AsyncBlock;
1
+ "use strict";import React from"react";import{View}from"react-native";import{useTheme}from"../../theme/index.js";import{AppIcon}from"../AppIcon/index.js";import{EmptyState}from"../EmptyState/index.js";import{Spinner}from"../Spinner/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const OFFLINE_HINT="Check your connection, then try again.";export const AsyncBlock=({loading:e=!1,error:t,errorVariant:r="default",empty:i=!1,onRetry:n,skeleton:o,emptyTitle:s="Nothing here yet",emptyDescription:c,emptyIcon:l,errorTitle:a="That didn't load",offlineTitle:p="You're offline",retryLabel:m="Try again",children:y,style:d,testID:x})=>{const f=useTheme();if(e)return _jsx(View,{style:d,testID:x,children:o??_jsx(View,{style:{paddingVertical:f.spacing["2xl"],alignItems:"center"},children:_jsx(Spinner,{})})});if(t){const e="offline"===r,i="string"==typeof t?t:e?OFFLINE_HINT:void 0;return _jsxs(View,{style:d,testID:x,children:[_jsx(EmptyState,{icon:e?_jsx(AppIcon,{name:"cloud-cross",size:"xl",color:f.colors.text.tertiary,testID:"async-block-offline-icon"}):void 0,title:e?p:a,description:i,action:n?{label:m,onPress:n}:void 0}),"string"==typeof t?null:t]})}return i?_jsx(View,{style:d,testID:x,children:_jsx(EmptyState,{icon:l,title:s,description:c})}):_jsx(_Fragment,{children:y})};export default AsyncBlock;
@@ -1 +1 @@
1
- export{AsyncBlock,default}from"./AsyncBlock.js";
1
+ "use strict";export{AsyncBlock,default}from"./AsyncBlock.js";
@@ -1 +1 @@
1
- import{Image as e}from"expo-image";import{useEffect as t,useMemo as r,useRef as o,useState as i}from"react";import{StyleSheet as a,Text as n,View as s}from"react-native";import{useTheme as l}from"../../theme/index.js";import{smoothCorners as c}from"../../utils/corners.js";import{Spinner as d}from"../Spinner/index.js";import{acquireFetch as u,DEFAULT_TTL_MS as y,deriveCacheKey as m,isFresh as f,isPermanentRefusal as h,readEntry as b,releaseFetch as g,removeEntry as p,touchEntry as v}from"./authedImageCache.js";import{jsx as L}from"react/jsx-runtime";const I={cover:"cover",contain:"contain",stretch:"fill",center:"scale-down",repeat:"cover"},AuthedImage=a=>{const{uri:c,headers:E,client:k,authenticated:w=!0,ttlMs:x=y,placeholder:S,fallback:j,onLoadStart:D,onLoadEnd:U,onError:C,cacheKey:R,testID:F,accessibilityLabel:z,style:N,resizeMode:P,fadeDuration:W,contentFit:$,transition:A,cachePolicy:J="memory",...M}=a,O=l(),T=r(()=>buildStyles(O),[O]),[K,q]=i({status:"loading"}),B=o({onLoadStart:D,onLoadEnd:U,onError:C});B.current={onLoadStart:D,onLoadEnd:U,onError:C};const G=JSON.stringify(E??{});return t(()=>{let e=!1,t=null;const finish=t=>{e||(q(t),B.current.onLoadEnd?.())};return(async()=>{if(!c){const t=new Error("[@webority/mobile-ui] AuthedImage was given an empty `uri`. Pass the image URL, or render nothing while the URL is still unknown.");return void(e||(q({status:"error"}),B.current.onError?.(t)))}q({status:"loading"}),B.current.onLoadStart?.();const r=m(c,R),o=await b(r);if(e)return;if(o&&f(o.meta,x))return v(r),void finish({status:"ready",fileUri:o.fileUri});const i=u(r,{uri:c,headers:JSON.parse(G),authenticated:w,client:k});t={key:r,entry:i};try{const e=await i.promise;finish({status:"ready",fileUri:e.fileUri})}catch(t){if(e)return;if(o&&!h(t))return void finish({status:"ready",fileUri:o.fileUri});if(o&&(await p(r),e))return;q({status:"error"}),B.current.onError?.((a=t)instanceof Error?a:new Error(String(a))),B.current.onLoadEnd?.()}var a})(),()=>{e=!0,t&&g(t.key,t.entry)}},[c,R,x,w,k,G]),"loading"===K.status?L(s,void 0!==S?{style:N,testID:F,children:S}:{style:[T.placeholder,N],testID:F,children:L(s,{style:T.stateFill,testID:F?`${F}-placeholder`:void 0,pointerEvents:"none",children:L(d,{size:"sm",accessibilityLabel:z??"Loading image"})})}):"error"===K.status?L(s,void 0!==j?{style:N,testID:F,children:j}:{style:[T.fallback,N],testID:F,children:L(s,{accessible:!0,accessibilityRole:"image",accessibilityLabel:z?`${z}, image unavailable`:"Image unavailable",testID:F?`${F}-fallback`:void 0,style:T.stateFill,children:L(n,{style:T.fallbackText,children:"!"})})}):L(e,{...M,accessible:!0,accessibilityRole:"image",accessibilityLabel:z,testID:F,style:N,contentFit:$??(P?I[P]:void 0),transition:A??W,cachePolicy:J,source:{uri:K.fileUri}})};AuthedImage.displayName="AuthedImage";const buildStyles=e=>a.create({placeholder:{alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary,borderRadius:e.radius.md,...c},fallback:{alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary,borderRadius:e.radius.md,...c,borderWidth:e.colors.border.width,borderColor:e.colors.border.secondary,padding:e.spacing.sm},stateFill:{alignItems:"center",flex:1,justifyContent:"center"},fallbackText:{color:e.colors.text.tertiary,fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.bold}});export{AuthedImage};export default AuthedImage;
1
+ "use strict";import{Image}from"expo-image";import{useEffect,useMemo,useRef,useState}from"react";import{StyleSheet,Text,View}from"react-native";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{Spinner}from"../Spinner/index.js";import{acquireFetch,DEFAULT_TTL_MS,deriveCacheKey,isFresh,isPermanentRefusal,readEntry,releaseFetch,removeEntry,touchEntry}from"./authedImageCache.js";import{jsx as _jsx}from"react/jsx-runtime";const CONTENT_FIT={cover:"cover",contain:"contain",stretch:"fill",center:"scale-down",repeat:"cover"},toError=e=>e instanceof Error?e:new Error(String(e)),AuthedImage=e=>{const{uri:t,headers:r,client:o,authenticated:i=!0,ttlMs:a=DEFAULT_TTL_MS,placeholder:s,fallback:n,onLoadStart:c,onLoadEnd:l,onError:d,cacheKey:u,testID:m,accessibilityLabel:h,style:y,resizeMode:f,fadeDuration:g,contentFit:b,transition:p,cachePolicy:E="memory",...I}=e,S=useTheme(),x=useMemo(()=>buildStyles(S),[S]),[v,L]=useState({status:"loading"}),T=useRef({onLoadStart:c,onLoadEnd:l,onError:d});T.current={onLoadStart:c,onLoadEnd:l,onError:d};const j=JSON.stringify(r??{});return useEffect(()=>{let e=!1,r=null;const finish=t=>{e||(L(t),T.current.onLoadEnd?.())};return(async()=>{if(!t){const t=new Error("[@webority/mobile-ui] AuthedImage was given an empty `uri`. Pass the image URL, or render nothing while the URL is still unknown.");return void(e||(L({status:"error"}),T.current.onError?.(t)))}L({status:"loading"}),T.current.onLoadStart?.();const s=deriveCacheKey(t,u),n=await readEntry(s);if(e)return;if(n&&isFresh(n.meta,a))return touchEntry(s),void finish({status:"ready",fileUri:n.fileUri});const c=acquireFetch(s,{uri:t,headers:JSON.parse(j),authenticated:i,client:o});r={key:s,entry:c};try{const e=await c.promise;finish({status:"ready",fileUri:e.fileUri})}catch(t){if(e)return;if(n&&!isPermanentRefusal(t))return void finish({status:"ready",fileUri:n.fileUri});if(n&&(await removeEntry(s),e))return;L({status:"error"}),T.current.onError?.(toError(t)),T.current.onLoadEnd?.()}})(),()=>{e=!0,r&&releaseFetch(r.key,r.entry)}},[t,u,a,i,o,j]),"loading"===v.status?_jsx(View,void 0!==s?{style:y,testID:m,children:s}:{style:[x.placeholder,y],testID:m,children:_jsx(View,{style:x.stateFill,testID:m?`${m}-placeholder`:void 0,pointerEvents:"none",children:_jsx(Spinner,{size:"sm",accessibilityLabel:h??"Loading image"})})}):"error"===v.status?_jsx(View,void 0!==n?{style:y,testID:m,children:n}:{style:[x.fallback,y],testID:m,children:_jsx(View,{accessible:!0,accessibilityRole:"image",accessibilityLabel:h?`${h}, image unavailable`:"Image unavailable",testID:m?`${m}-fallback`:void 0,style:x.stateFill,children:_jsx(Text,{style:x.fallbackText,children:"!"})})}):_jsx(Image,{...I,accessible:!0,accessibilityRole:"image",accessibilityLabel:h,testID:m,style:y,contentFit:b??(f?CONTENT_FIT[f]:void 0),transition:p??g,cachePolicy:E,source:{uri:v.fileUri}})};AuthedImage.displayName="AuthedImage";const buildStyles=e=>StyleSheet.create({placeholder:{alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary,borderRadius:e.radius.md,...smoothCorners},fallback:{alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary,borderRadius:e.radius.md,...smoothCorners,borderWidth:e.colors.border.width,borderColor:e.colors.border.secondary,padding:e.spacing.sm},stateFill:{alignItems:"center",flex:1,justifyContent:"center"},fallbackText:{color:e.colors.text.tertiary,fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.bold}});export{AuthedImage};export default AuthedImage;
@@ -1 +1 @@
1
- import{ACCESS_TOKEN_KEY as e,getToken as t,isStorageAvailable as s,Logger as r,publicClient as a,Storage as o}from"@webority/mobile-core";import{Directory as n,File as i,Paths as c}from"expo-file-system";import{hashString as l}from"../../utils/hashString.js";const u="@webority/authed-image/v2/index",d="authed-images";export const DEFAULT_TTL_MS=6048e5;let h=52428800;export const setAuthedImageCacheLimit=e=>{if(!Number.isFinite(e)||e<=0)throw new Error(`[@webority/mobile-ui] setAuthedImageCacheLimit() needs a positive number of bytes, received ${String(e)}. Pass e.g. 50 * 1024 * 1024 for 50 MB.`);h=e};export const getAuthedImageCacheLimit=()=>h;export const deriveCacheKey=(e,t)=>l(t??e);const imageFile=e=>new i(c.cache,d,e),toMeta=({fetchedAt:e,bytes:t,contentType:s,lastAccessedAt:r})=>({fetchedAt:e,bytes:t,contentType:s,lastAccessedAt:r});let f=null,m=null;const persistIndex=async e=>{if(!s())return;const t={};for(const[s,r]of e)t[s]={...r,persistedAccessAt:r.lastAccessedAt};if(await o.setItem(u,JSON.stringify(t)))for(const t of e.values())t.persistedAccessAt=t.lastAccessedAt},readStoredIndex=async()=>{const e=new Map;if(!s())return e;const t=await o.getItem(u);if(!t)return await(async()=>{const e=(await o.getAllKeys()).filter(e=>e.startsWith("@webority/authed-image/v1/"));e.length>0&&await o.multiRemove(e)})(),e;try{for(const[s,r]of Object.entries(JSON.parse(t)))e.set(s,r)}catch{}return e},loadIndex=()=>f?Promise.resolve(f):(m||(m=readStoredIndex().then(e=>((e=>{try{const t=new n(c.cache,d);if(!t.exists)return;const s=new Set([...e.values()].map(e=>imageFile(e.fileName).uri));for(const e of t.list())s.has(e.uri)||e.delete()}catch(e){r.warn("[AuthedImage] could not tidy the image cache folder",e)}})(e),f=e,e)).finally(()=>{m=null})),m),deleteFile=e=>{try{const t=imageFile(e);t.exists&&t.delete()}catch(e){r.warn("[AuthedImage] could not delete a cached image file",e)}};export const readEntry=async e=>{const t=await loadIndex(),s=t.get(e);if(!s)return null;const r=imageFile(s.fileName);return r.exists?{fileUri:r.uri,meta:toMeta(s)}:(t.delete(e),await persistIndex(t),null)};export const removeEntry=async e=>{const t=await loadIndex(),s=t.get(e);s&&(t.delete(e),deleteFile(s.fileName),await persistIndex(t))};export class AuthedImageHttpError extends Error{constructor(e,t){super(e),this.name="AuthedImageHttpError",this.status=t}}export const isPermanentRefusal=e=>e instanceof AuthedImageHttpError&&e.status>=400&&e.status<500&&408!==e.status&&429!==e.status;export const isFresh=(e,t,s=Date.now())=>s-e.fetchedAt<t;export const touchEntry=async e=>{const t=await loadIndex(),s=t.get(e);s&&(s.lastAccessedAt=Date.now(),s.lastAccessedAt-s.persistedAccessAt>=36e5&&await persistIndex(t))};export const clearAuthedImageCache=async()=>{(await loadIndex()).clear();const e=new n(c.cache,d);e.exists&&e.delete(),s()&&await o.removeItem(u)};export const authedImageCacheStats=async()=>{const e=await loadIndex();let t=0;for(const s of e.values())t+=s.bytes;return{entries:e.size,bytes:t}};const fetchAndStore=async(s,o,n)=>{const i={Accept:"image/*",...o.headers};if(!o.client&&o.authenticated){const s=await t(e);s?.token&&(i.Authorization=`Bearer ${s.token}`)}const c=o.client??a;let l;try{l=await c.get(o.uri,{headers:i,responseType:"arraybuffer",signal:n})}catch(e){const t=e?.response?.status;if("number"!=typeof t)throw e;throw new AuthedImageHttpError(`[@webority/mobile-ui] AuthedImage could not load "${o.uri}": the server answered ${t}. Check the URL and whether the request needs to be signed in (pass the signed-in client as \`client\`, or authenticated={false} for public media).`,t)}const u=new Uint8Array(l.data??new ArrayBuffer(0)),d=((e,t)=>{if(!e||"object"!=typeof e)return;const s=e.get,r="function"==typeof s?s.call(e,t):e[t];return"string"==typeof r?r:void 0})(l.headers,"content-type"),f=(d?d.split(";")[0].trim():"")||"image/jpeg",m=await loadIndex(),w=Date.now(),y=`${s}-${w.toString(36)}`,p=imageFile(y);try{p.create({intermediates:!0,overwrite:!0}),p.write(u)}catch(e){throw new Error(`[@webority/mobile-ui] AuthedImage fetched "${o.uri}" but could not write it to the app's cache folder: ${e instanceof Error?e.message:String(e)}. The device may be out of storage.`)}const g={fetchedAt:w,bytes:u.byteLength,contentType:f,lastAccessedAt:w,fileName:y,persistedAccessAt:w},A=m.get(s);m.set(s,g),A&&A.fileName!==y&&deleteFile(A.fileName);const b=(e=>{let t=0;for(const s of e.values())t+=s.bytes;if(t<=h)return 0;const s=[...e].sort(([,e],[,t])=>e.lastAccessedAt-t.lastAccessedAt);let r=0;for(const[a,o]of s){if(t<=h)break;e.delete(a),deleteFile(o.fileName),t-=o.bytes,r+=1}return r})(m);return await persistIndex(m),b>0&&r.info(`[AuthedImage] evicted ${b} cached image(s) over the byte ceiling`),{fileUri:p.uri,meta:toMeta(g)}},w=new Map;export const acquireFetch=(e,t)=>{const s=w.get(e);if(s)return s.waiters+=1,s;const r=new AbortController,a={controller:r,waiters:1,promise:Promise.resolve()};return a.promise=fetchAndStore(e,t,r.signal).finally(()=>{w.get(e)===a&&w.delete(e)}),w.set(e,a),a};export const releaseFetch=(e,t)=>{t.waiters-=1,t.waiters>0||(w.get(e)===t&&w.delete(e),t.controller.abort())};
1
+ "use strict";import{ACCESS_TOKEN_KEY,getToken,isStorageAvailable,Logger,publicClient,Storage}from"@webority/mobile-core";import{Directory,File,Paths}from"expo-file-system";import{hashString}from"../../utils/hashString.js";const INDEX_KEY="@webority/authed-image/v2/index",LEGACY_PREFIX="@webority/authed-image/v1/",FOLDER="authed-images",DEFAULT_BYTE_CEILING=52428800,TOUCH_PERSIST_MS=36e5;export const DEFAULT_TTL_MS=6048e5;let byteCeiling=52428800;export const setAuthedImageCacheLimit=e=>{if(!Number.isFinite(e)||e<=0)throw new Error(`[@webority/mobile-ui] setAuthedImageCacheLimit() needs a positive number of bytes, received ${String(e)}. Pass e.g. 50 * 1024 * 1024 for 50 MB.`);byteCeiling=e};export const getAuthedImageCacheLimit=()=>byteCeiling;export const deriveCacheKey=(e,t)=>hashString(t??e);const imageFile=e=>new File(Paths.cache,FOLDER,e),toMeta=({fetchedAt:e,bytes:t,contentType:r,lastAccessedAt:s})=>({fetchedAt:e,bytes:t,contentType:r,lastAccessedAt:s});let index=null,indexLoad=null;const persistIndex=async e=>{if(!isStorageAvailable())return;const t={};for(const[r,s]of e)t[r]={...s,persistedAccessAt:s.lastAccessedAt};if(await Storage.setItem(INDEX_KEY,JSON.stringify(t)))for(const t of e.values())t.persistedAccessAt=t.lastAccessedAt},removeLegacyEntries=async()=>{const e=(await Storage.getAllKeys()).filter(e=>e.startsWith(LEGACY_PREFIX));e.length>0&&await Storage.multiRemove(e)},removeOrphanFiles=e=>{try{const t=new Directory(Paths.cache,FOLDER);if(!t.exists)return;const r=new Set([...e.values()].map(e=>imageFile(e.fileName).uri));for(const e of t.list())r.has(e.uri)||e.delete()}catch(e){Logger.warn("[AuthedImage] could not tidy the image cache folder",e)}},readStoredIndex=async()=>{const e=new Map;if(!isStorageAvailable())return e;const t=await Storage.getItem(INDEX_KEY);if(!t)return await removeLegacyEntries(),e;try{for(const[r,s]of Object.entries(JSON.parse(t)))e.set(r,s)}catch{}return e},loadIndex=()=>index?Promise.resolve(index):(indexLoad||(indexLoad=readStoredIndex().then(e=>(removeOrphanFiles(e),index=e,e)).finally(()=>{indexLoad=null})),indexLoad),deleteFile=e=>{try{const t=imageFile(e);t.exists&&t.delete()}catch(e){Logger.warn("[AuthedImage] could not delete a cached image file",e)}};export const readEntry=async e=>{const t=await loadIndex(),r=t.get(e);if(!r)return null;const s=imageFile(r.fileName);return s.exists?{fileUri:s.uri,meta:toMeta(r)}:(t.delete(e),await persistIndex(t),null)};export const removeEntry=async e=>{const t=await loadIndex(),r=t.get(e);r&&(t.delete(e),deleteFile(r.fileName),await persistIndex(t))};export class AuthedImageHttpError extends Error{constructor(e,t){super(e),this.name="AuthedImageHttpError",this.status=t}}export const isPermanentRefusal=e=>e instanceof AuthedImageHttpError&&e.status>=400&&e.status<500&&408!==e.status&&429!==e.status;export const isFresh=(e,t,r=Date.now())=>r-e.fetchedAt<t;export const touchEntry=async e=>{const t=await loadIndex(),r=t.get(e);r&&(r.lastAccessedAt=Date.now(),r.lastAccessedAt-r.persistedAccessAt>=36e5&&await persistIndex(t))};const evictIfNeeded=e=>{let t=0;for(const r of e.values())t+=r.bytes;if(t<=byteCeiling)return 0;const r=[...e].sort(([,e],[,t])=>e.lastAccessedAt-t.lastAccessedAt);let s=0;for(const[i,a]of r){if(t<=byteCeiling)break;e.delete(i),deleteFile(a.fileName),t-=a.bytes,s+=1}return s};export const clearAuthedImageCache=async()=>{(await loadIndex()).clear();const e=new Directory(Paths.cache,FOLDER);e.exists&&e.delete(),isStorageAvailable()&&await Storage.removeItem(INDEX_KEY)};export const authedImageCacheStats=async()=>{const e=await loadIndex();let t=0;for(const r of e.values())t+=r.bytes;return{entries:e.size,bytes:t}};const responseHeader=(e,t)=>{if(!e||"object"!=typeof e)return;const r=e.get,s="function"==typeof r?r.call(e,t):e[t];return"string"==typeof s?s:void 0},fetchAndStore=async(e,t,r)=>{const s={Accept:"image/*",...t.headers};if(!t.client&&t.authenticated){const e=await getToken(ACCESS_TOKEN_KEY);e?.token&&(s.Authorization=`Bearer ${e.token}`)}const i=t.client??publicClient;let a;try{a=await i.get(t.uri,{headers:s,responseType:"arraybuffer",signal:r})}catch(e){const r=e?.response?.status;if("number"!=typeof r)throw e;throw new AuthedImageHttpError(`[@webority/mobile-ui] AuthedImage could not load "${t.uri}": the server answered ${r}. Check the URL and whether the request needs to be signed in (pass the signed-in client as \`client\`, or authenticated={false} for public media).`,r)}const o=new Uint8Array(a.data??new ArrayBuffer(0)),n=responseHeader(a.headers,"content-type"),c=(n?n.split(";")[0].trim():"")||"image/jpeg",l=await loadIndex(),d=Date.now(),h=`${e}-${d.toString(36)}`,g=imageFile(h);try{g.create({intermediates:!0,overwrite:!0}),g.write(o)}catch(e){throw new Error(`[@webority/mobile-ui] AuthedImage fetched "${t.uri}" but could not write it to the app's cache folder: ${e instanceof Error?e.message:String(e)}. The device may be out of storage.`)}const u={fetchedAt:d,bytes:o.byteLength,contentType:c,lastAccessedAt:d,fileName:h,persistedAccessAt:d},m=l.get(e);l.set(e,u),m&&m.fileName!==h&&deleteFile(m.fileName);const f=evictIfNeeded(l);return await persistIndex(l),f>0&&Logger.info(`[AuthedImage] evicted ${f} cached image(s) over the byte ceiling`),{fileUri:g.uri,meta:toMeta(u)}},inFlight=new Map;export const acquireFetch=(e,t)=>{const r=inFlight.get(e);if(r)return r.waiters+=1,r;const s=new AbortController,i={controller:s,waiters:1,promise:Promise.resolve()};return i.promise=fetchAndStore(e,t,s.signal).finally(()=>{inFlight.get(e)===i&&inFlight.delete(e)}),inFlight.set(e,i),i};export const releaseFetch=(e,t)=>{t.waiters-=1,t.waiters>0||(inFlight.get(e)===t&&inFlight.delete(e),t.controller.abort())};
@@ -1 +1 @@
1
- export{AuthedImage,default}from"./AuthedImage.js";export{authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./authedImageCache.js";
1
+ "use strict";export{AuthedImage,default}from"./AuthedImage.js";export{authedImageCacheStats,clearAuthedImageCache,getAuthedImageCacheLimit,setAuthedImageCacheLimit}from"./authedImageCache.js";
@@ -1 +1 @@
1
- import e,{useCallback as t,useMemo as o,useRef as r,useState as i}from"react";import{Keyboard as n,Pressable as l,ScrollView as s,StyleSheet as a,Text as c,View as d}from"react-native";import{useControllableState as p}from"../../hooks/index.js";import{useTheme as u}from"../../theme/index.js";import{resolveHaptic as m,triggerHaptic as g}from"../../utils/index.js";import{smoothCorners as h}from"../../utils/corners.js";import{Input as y}from"../Input/index.js";import{Spinner as f}from"../Spinner/index.js";import{jsx as x,jsxs as b}from"react/jsx-runtime";function Autocomplete(a){const{options:T,value:S,defaultValue:z,onChangeText:v,onSelect:C,getOptionLabel:j,getOptionKey:w,filter:A,minChars:I=1,maxResults:L=8,emptyText:k="No matches",loading:P=!1,filterMode:R="client",loadingText:F="Searching…",placeholder:D,label:H,error:O,helperText:V,disabled:E=!1,size:N="md",variant:W,haptic:$,style:B,listStyle:K,optionTextStyle:M,testID:_}=a,q=u(),G=o(()=>buildStyles(q),[q]),[J,Q]=p({value:S,defaultValue:z??"",onChange:v}),[U,X]=i(!1),[Y,Z]=i(0),ee=r(null),te=t(e=>j?j(e):(e=>"string"==typeof e?e:String(e))(e),[j]),oe=o(()=>{if("none"===R)return T.slice(0,L);const e=J.trim();if(e.length<I)return[];const t=e.toLowerCase(),o=A?t=>A(t,e):e=>te(e).toLowerCase().includes(t);return T.filter(o).slice(0,L)},[T,J,I,L,A,te,R]),re=U&&(P||J.trim().length>=I),ie=t(e=>{const t=m($,"selection");t&&g(t),ee.current&&clearTimeout(ee.current),Q(te(e)),X(!1),n.dismiss(),C(e)},[$,Q,te,C]);e.useEffect(()=>()=>{ee.current&&clearTimeout(ee.current)},[]);const ne=t(e=>{Z(e.nativeEvent.layout.height)},[]);return b(d,{style:[G.container,B],testID:_,children:[x(d,{onLayout:ne,children:x(y,{value:J,onChangeText:Q,onFocus:()=>{ee.current&&clearTimeout(ee.current),X(!0)},onBlur:()=>{ee.current=setTimeout(()=>X(!1),120)},placeholder:D,label:H,error:O,helperText:V,editable:!E,accessibilityState:{disabled:E},size:N,variant:W,autoCorrect:!1,autoCapitalize:"none"})}),re?x(d,{style:[G.list,{top:Y,backgroundColor:q.colors.background.elevated,borderColor:q.colors.border.primary,borderRadius:q.radius.md,...h,...q.shadows.lg},K],children:P?b(d,{style:G.loadingRow,children:[x(f,{size:"sm"}),x(c,{style:[G.loadingText,{color:q.colors.text.secondary,fontSize:q.typography.fontSize.sm}],children:F})]}):0===oe.length?x(c,{style:[G.empty,{color:q.colors.text.tertiary,fontSize:q.typography.fontSize.sm}],children:k}):x(s,{keyboardShouldPersistTaps:"handled",style:G.scroll,children:oe.map((e,t)=>x(l,{onPress:()=>ie(e),android_ripple:{color:q.colors.surface.pressed},style:({pressed:e})=>[G.option,{paddingHorizontal:q.spacing.md,paddingVertical:q.spacing.sm,backgroundColor:e?q.colors.surface.pressed:"transparent"}],accessibilityRole:"button",accessibilityLabel:te(e),accessibilityState:{selected:te(e)===J},children:x(c,{style:[G.optionText,{color:q.colors.text.primary,fontSize:q.typography.fontSize.base},M],numberOfLines:1,children:te(e)})},w?w(e):`${te(e)}-${t}`))})}):null]})}Autocomplete.displayName="Autocomplete";const buildStyles=e=>a.create({container:{width:"100%",position:"relative",zIndex:10},list:{position:"absolute",left:0,right:0,borderWidth:a.hairlineWidth,overflow:"hidden",zIndex:20,maxHeight:240},scroll:{maxHeight:240},option:{width:"100%"},optionText:{includeFontPadding:!1},empty:{padding:e.spacing.md,textAlign:"center",includeFontPadding:!1},loadingRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm,padding:e.spacing.md},loadingText:{includeFontPadding:!1}});export{Autocomplete};export default Autocomplete;
1
+ "use strict";import React,{useCallback,useMemo,useRef,useState}from"react";import{Keyboard,Pressable,ScrollView,StyleSheet,Text,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{Input}from"../Input/index.js";import{Spinner}from"../Spinner/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const defaultGetLabel=e=>"string"==typeof e?e:String(e);function Autocomplete(e){const{options:t,value:o,defaultValue:r,onChangeText:i,onSelect:s,getOptionLabel:l,getOptionKey:n,filter:a,minChars:c=1,maxResults:d=8,emptyText:u="No matches",loading:p=!1,filterMode:m="client",loadingText:h="Searching…",placeholder:x,label:g,error:y,helperText:b,disabled:f=!1,size:S="md",variant:j,haptic:T,style:C,listStyle:w,optionTextStyle:_,testID:v}=e,z=useTheme(),V=useMemo(()=>buildStyles(z),[z]),[k,R]=useControllableState({value:o,defaultValue:r??"",onChange:i}),[I,L]=useState(!1),[H,P]=useState(0),A=useRef(null),F=useCallback(e=>l?l(e):defaultGetLabel(e),[l]),M=useMemo(()=>{if("none"===m)return t.slice(0,d);const e=k.trim();if(e.length<c)return[];const o=e.toLowerCase(),r=a?t=>a(t,e):e=>F(e).toLowerCase().includes(o);return t.filter(r).slice(0,d)},[t,k,c,d,a,F,m]),D=I&&(p||k.trim().length>=c),K=useCallback(e=>{const t=resolveHaptic(T,"selection");t&&triggerHaptic(t),A.current&&clearTimeout(A.current),R(F(e)),L(!1),Keyboard.dismiss(),s(e)},[T,R,F,s]);React.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]);const O=useCallback(e=>{P(e.nativeEvent.layout.height)},[]);return _jsxs(View,{style:[V.container,C],testID:v,children:[_jsx(View,{onLayout:O,children:_jsx(Input,{value:k,onChangeText:R,onFocus:()=>{A.current&&clearTimeout(A.current),L(!0)},onBlur:()=>{A.current=setTimeout(()=>L(!1),120)},placeholder:x,label:g,error:y,helperText:b,editable:!f,accessibilityState:{disabled:f},size:S,variant:j,autoCorrect:!1,autoCapitalize:"none"})}),D?_jsx(View,{style:[V.list,{top:H,backgroundColor:z.colors.background.elevated,borderColor:z.colors.border.primary,borderRadius:z.radius.md,...smoothCorners,...z.shadows.lg},w],children:p?_jsxs(View,{style:V.loadingRow,children:[_jsx(Spinner,{size:"sm"}),_jsx(Text,{style:[V.loadingText,{color:z.colors.text.secondary,fontSize:z.typography.fontSize.sm}],children:h})]}):0===M.length?_jsx(Text,{style:[V.empty,{color:z.colors.text.tertiary,fontSize:z.typography.fontSize.sm}],children:u}):_jsx(ScrollView,{keyboardShouldPersistTaps:"handled",style:V.scroll,children:M.map((e,t)=>_jsx(Pressable,{onPress:()=>K(e),android_ripple:{color:z.colors.surface.pressed},style:({pressed:e})=>[V.option,{paddingHorizontal:z.spacing.md,paddingVertical:z.spacing.sm,backgroundColor:e?z.colors.surface.pressed:"transparent"}],accessibilityRole:"button",accessibilityLabel:F(e),accessibilityState:{selected:F(e)===k},children:_jsx(Text,{style:[V.optionText,{color:z.colors.text.primary,fontSize:z.typography.fontSize.base},_],numberOfLines:1,children:F(e)})},n?n(e):`${F(e)}-${t}`))})}):null]})}Autocomplete.displayName="Autocomplete";const buildStyles=e=>StyleSheet.create({container:{width:"100%",position:"relative",zIndex:10},list:{position:"absolute",left:0,right:0,borderWidth:StyleSheet.hairlineWidth,overflow:"hidden",zIndex:20,maxHeight:240},scroll:{maxHeight:240},option:{width:"100%"},optionText:{includeFontPadding:!1},empty:{padding:e.spacing.md,textAlign:"center",includeFontPadding:!1},loadingRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm,padding:e.spacing.md},loadingText:{includeFontPadding:!1}});export{Autocomplete};export default Autocomplete;
@@ -1 +1 @@
1
- export{Autocomplete}from"./Autocomplete.js";
1
+ "use strict";export{Autocomplete}from"./Autocomplete.js";
@@ -1 +1 @@
1
- import{Image as r}from"expo-image";import e,{Children as o,cloneElement as t,forwardRef as i,isValidElement as n,useEffect as a,useMemo as s,useRef as c,useState as l}from"react";import{Animated as d,Easing as u,StyleSheet as g,Text as h,View as b}from"react-native";import{createAnimatedValue as m,useTheme as p}from"../../theme/index.js";import{tintOf as y}from"../../utils/color.js";import{smoothCorners as f}from"../../utils/corners.js";import{AppIcon as v}from"../AppIcon/index.js";import{Skeleton as C}from"../Skeleton/index.js";import{jsx as w,jsxs as x}from"react/jsx-runtime";export const avatarToneColors=(r,e)=>{const soft=(r,e)=>y(r,.14,e);switch(e){case"primary":return{background:soft(r.colors.primary,r.colors.primaryMuted),color:r.colors.primary};case"secondary":return{background:r.colors.secondary,color:r.colors.onSecondary};case"success":return{background:soft(r.colors.success,r.colors.background.secondary),color:r.colors.success};case"warning":return{background:soft(r.colors.warning,r.colors.background.secondary),color:r.colors.warning};case"error":return{background:soft(r.colors.error,r.colors.background.secondary),color:r.colors.error};case"info":return{background:soft(r.colors.info,r.colors.background.secondary),color:r.colors.info};default:return{background:r.colors.background.tertiary,color:r.colors.text.primary}}};const k={xs:24,sm:32,md:48,lg:64,xl:80},resolveSize=r=>"number"==typeof r?r:k[r],resolveRadius=(r,e)=>{switch(r){case"circle":return e/2;case"rounded":return Math.max(6,Math.round(.22*e));default:return 0}},statusColor=(r,e)=>{switch(e){case"online":case"verified":return r.colors.success;case"busy":return r.colors.error;case"away":case"pending":return r.colors.warning;default:return r.colors.text.tertiary}},R=i((e,o)=>{const{source:t,ImageComponent:i,name:n,size:a="md",shape:c="circle",status:d=null,statusPosition:u="bottomRight",tone:g,backgroundColor:m,color:y,fontSize:C,loading:k=!1,accessibilityLabel:R,style:M,textStyle:W,testID:j}=e,S=p(),z=S.components.avatar,[L,A]=l(!1),$=s(()=>resolveSize(a),[a]),D=s(()=>resolveRadius(c,$),[c,$]),B=z?.borderWidth??0,T=z?.borderColor??S.colors.border.primary,E=z?.statusBorderWidth??2,F=z?.statusBorderColor??S.colors.background.elevated,P=s(()=>(r=>{if(!r)return"";const e=r.trim().split(/\s+/u).filter(Boolean);return 0===e.length?"":1===e.length?e[0].charAt(0).toUpperCase():(e[0].charAt(0)+e[1].charAt(0)).toUpperCase()})(n),[n]),G=s(()=>g?avatarToneColors(S,g):null,[S,g]),N=s(()=>m||(G?.background??((r,e)=>{if(!r)return e[0];let o=0;for(let e=0;e<r.length;e+=1)o=(o<<5)-o+r.charCodeAt(e),o|=0;return e[Math.abs(o)%e.length]})(n??"",S.colors.avatarPalette)),[m,G,n,S.colors.avatarPalette]),V=y??G?.color??S.colors.onPrimary,O=!!t&&!L,U=z?.fontSizeRatio??.4,q=C??z?.fontSize??Math.max(10,Math.round($*U)),H=Math.max(8,Math.round(.25*$)),J=(r=>"verified"===r||"pending"===r)(d),K=z?.ringWidth??1.5,Q=$-2*(J?K+(z?.ringGap??K):0),X=J?resolveRadius(c,Q):D,Y=J?statusColor(S,d):"transparent",Z=Math.max(12,Math.round(.32*$)),_=Math.max(10,Z-4),rr=O?S.colors.background.tertiary:N,er=j??"avatar",or=n?`${n}'s avatar`:"Avatar",tr=R??("verified"===d?`${or}, verified`:"pending"===d?`${or}, pending verification`:or),ir=x(b,{ref:o,style:[I.root,{width:$,height:$,borderRadius:D,...f,borderWidth:J?0:B,borderColor:T,backgroundColor:J?"transparent":rr},M],accessible:!0,accessibilityRole:"image",accessibilityLabel:tr,testID:j,children:[J?w(b,{style:[I.ring,{borderRadius:D,...f,borderWidth:K,borderColor:Y}],accessible:!1,pointerEvents:"none",testID:`${er}-ring`}):null,w(b,{style:[I.picture,{width:Q,height:Q,borderRadius:X,...f,borderWidth:J?B:0,borderColor:T,backgroundColor:J?rr:"transparent"}],children:O?(()=>{const e={width:Q,height:Q,borderRadius:X,...f},onError=()=>A(!0);return i?w(i,{source:t,onError:onError,style:e,contentFit:"cover",resizeMode:"cover",accessibilityIgnoresInvertColors:!0}):w(r,{source:t,onError:onError,style:e,contentFit:"cover",accessibilityIgnoresInvertColors:!0})})():w(h,{style:[I.initials,{color:V,fontSize:q,fontWeight:S.typography.fontWeight[z?.fontWeight??"semibold"]},W],numberOfLines:1,allowFontScaling:!1,children:P??" "})}),"verified"===d?w(b,{style:[I.status,"topRight"===u?I.badgeTopRight:I.badgeBottomRight,{width:Z,height:Z,borderRadius:Z/2,...f,backgroundColor:F}],accessible:!1,pointerEvents:"none",testID:`${er}-badge`,children:w(v,{name:"verify",variant:"bold",size:_,color:Y})}):null,d&&!J?w(b,{style:[I.status,"topRight"===u?I.statusTopRight:I.statusBottomRight,{width:H,height:H,borderRadius:H/2,...f,backgroundColor:statusColor(S,d),borderWidth:E,borderColor:F}],accessible:!1,pointerEvents:"none"}):null]});return k?w(AvatarSkeleton,{...e}):ir});R.displayName="Avatar";const AvatarSkeleton=({size:r="md",shape:e="circle",style:o})=>{const t=resolveSize(r);return w(C,{shape:"circle"===e?"circle":"rounded"===e?"rounded":"rect",width:t,height:t,style:o})};AvatarSkeleton.displayName="AvatarSkeleton",R.Skeleton=AvatarSkeleton;const I=g.create({root:{alignItems:"center",justifyContent:"center",overflow:"visible",position:"relative"},initials:{textAlign:"center"},ring:{position:"absolute",top:0,right:0,bottom:0,left:0},picture:{alignItems:"center",justifyContent:"center",overflow:"hidden"},status:{position:"absolute"},badgeTopRight:{top:-2,right:-2,alignItems:"center",justifyContent:"center"},badgeBottomRight:{bottom:-2,right:-2,alignItems:"center",justifyContent:"center"},statusTopRight:{top:0,right:0},statusBottomRight:{bottom:0,right:0}}),M={tight:-16,normal:-12,loose:-8},AvatarGroupItem=({delay:r,marginLeft:e,borderColor:o,borderWidth:t,children:i})=>{const n=c(m(0)).current;return a(()=>{const e=d.timing(n,{toValue:1,duration:220,delay:r,easing:u.out(u.cubic),useNativeDriver:!0});return e.start(),()=>e.stop()},[r,n]),w(d.View,{style:[W.item,{marginLeft:e,borderColor:o,borderWidth:t,opacity:n}],children:i})},AvatarGroup=r=>{const{children:e,max:i=4,size:a="md",spacing:c="normal",overflowVariant:l="count",accessibilityLabel:d,style:u,testID:g}=r,m=p(),y=s(()=>o.toArray(e).filter(r=>n(r)),[e]),v=y.length,C=y.slice(0,i),k=Math.max(0,v-i),R=k>0,I=M[c],j=m.colors.background.elevated,S=d??`Group of ${v} ${1===v?"person":"people"}`,z=s(()=>resolveSize(a),[a]),L=Math.max(10,Math.round(.34*z));return x(b,{style:[W.row,u],accessible:!0,accessibilityLabel:S,accessibilityRole:"summary",testID:g,children:[C.map((r,e)=>{const o=r.key??`avatar-${e}`;return w(AvatarGroupItem,{delay:50*e,marginLeft:0===e?0:I,borderColor:j,borderWidth:1.5,children:t(r,{size:a})},o)}),R?w(AvatarGroupItem,{delay:50*C.length,marginLeft:0===C.length?0:I,borderColor:j,borderWidth:1.5,children:w(b,{style:[W.overflow,{width:z,height:z,borderRadius:z/2,...f,backgroundColor:m.colors.surface.disabled}],accessible:!0,accessibilityRole:"text",accessibilityLabel:"count"===l?`${k} more`:"More avatars",children:w(h,{style:{color:m.colors.text.secondary,fontSize:L,fontWeight:m.typography.fontWeight.semibold},numberOfLines:1,allowFontScaling:!1,children:"count"===l?`+${k}`:"+"})})},"avatar-overflow"):null]})},W=g.create({row:{flexDirection:"row",alignItems:"center"},item:{borderRadius:9999,...f},overflow:{alignItems:"center",justifyContent:"center"}}),j=R;j.Group=AvatarGroup;export{R as Avatar,AvatarGroup};export default j;
1
+ "use strict";import{Image}from"expo-image";import React,{Children,cloneElement,forwardRef,isValidElement,useEffect,useMemo,useRef,useState}from"react";import{Animated,Easing,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{AppIcon}from"../AppIcon/index.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const SOFT_FILL_OPACITY=.14;export const avatarToneColors=(e,r)=>{const soft=(e,r)=>tintOf(e,.14,r);switch(r){case"primary":return{background:soft(e.colors.primary,e.colors.primaryMuted),color:e.colors.primary};case"secondary":return{background:e.colors.secondary,color:e.colors.onSecondary};case"success":return{background:soft(e.colors.success,e.colors.background.secondary),color:e.colors.success};case"warning":return{background:soft(e.colors.warning,e.colors.background.secondary),color:e.colors.warning};case"error":return{background:soft(e.colors.error,e.colors.background.secondary),color:e.colors.error};case"info":return{background:soft(e.colors.info,e.colors.background.secondary),color:e.colors.info};default:return{background:e.colors.background.tertiary,color:e.colors.text.primary}}};const sizeMap={xs:24,sm:32,md:48,lg:64,xl:80},resolveSize=e=>"number"==typeof e?e:sizeMap[e],resolveRadius=(e,r)=>{switch(e){case"circle":return r/2;case"rounded":return Math.max(6,Math.round(.22*r));default:return 0}},initialsFromName=e=>{if(!e)return"";const r=e.trim().split(/\s+/u).filter(Boolean);return 0===r.length?"":1===r.length?r[0].charAt(0).toUpperCase():(r[0].charAt(0)+r[1].charAt(0)).toUpperCase()},hashColor=(e,r)=>{if(!e)return r[0];let t=0;for(let r=0;r<e.length;r+=1)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r[Math.abs(t)%r.length]},RING_WIDTH=1.5,isRingStatus=e=>"verified"===e||"pending"===e,statusColor=(e,r)=>{switch(r){case"online":case"verified":return e.colors.success;case"busy":return e.colors.error;case"away":case"pending":return e.colors.warning;default:return e.colors.text.tertiary}},Avatar=forwardRef((e,r)=>{const{source:t,ImageComponent:o,name:s,size:a="md",shape:i="circle",status:n=null,statusPosition:l="bottomRight",tone:c,backgroundColor:d,color:u,fontSize:h,loading:m=!1,accessibilityLabel:g,style:b,textStyle:p,testID:y}=e,f=useTheme(),v=f.components.avatar,[x,C]=useState(!1),S=useMemo(()=>resolveSize(a),[a]),A=useMemo(()=>resolveRadius(i,S),[i,S]),w=v?.borderWidth??0,R=v?.borderColor??f.colors.border.primary,j=v?.statusBorderWidth??2,k=v?.statusBorderColor??f.colors.background.elevated,I=useMemo(()=>initialsFromName(s),[s]),M=useMemo(()=>c?avatarToneColors(f,c):null,[f,c]),_=useMemo(()=>d||(M?.background??hashColor(s??"",f.colors.avatarPalette)),[d,M,s,f.colors.avatarPalette]),T=u??M?.color??f.colors.onPrimary,W=!!t&&!x,E=v?.fontSizeRatio??.4,z=h??v?.fontSize??Math.max(10,Math.round(S*E)),G=Math.max(8,Math.round(.25*S)),V=isRingStatus(n),L=v?.ringWidth??1.5,F=S-2*(V?L+(v?.ringGap??L):0),N=V?resolveRadius(i,F):A,D=V?statusColor(f,n):"transparent",$=Math.max(12,Math.round(.32*S)),O=Math.max(10,$-4),B=W?f.colors.background.tertiary:_,P=y??"avatar",U=s?`${s}'s avatar`:"Avatar",H=g??("verified"===n?`${U}, verified`:"pending"===n?`${U}, pending verification`:U),Y=_jsxs(View,{ref:r,style:[styles.root,{width:S,height:S,borderRadius:A,...smoothCorners,borderWidth:V?0:w,borderColor:R,backgroundColor:V?"transparent":B},b],accessible:!0,accessibilityRole:"image",accessibilityLabel:H,testID:y,children:[V?_jsx(View,{style:[styles.ring,{borderRadius:A,...smoothCorners,borderWidth:L,borderColor:D}],accessible:!1,pointerEvents:"none",testID:`${P}-ring`}):null,_jsx(View,{style:[styles.picture,{width:F,height:F,borderRadius:N,...smoothCorners,borderWidth:V?w:0,borderColor:R,backgroundColor:V?B:"transparent"}],children:W?(()=>{const e={width:F,height:F,borderRadius:N,...smoothCorners},onError=()=>C(!0);return o?_jsx(o,{source:t,onError:onError,style:e,contentFit:"cover",resizeMode:"cover",accessibilityIgnoresInvertColors:!0}):_jsx(Image,{source:t,onError:onError,style:e,contentFit:"cover",accessibilityIgnoresInvertColors:!0})})():_jsx(Text,{style:[styles.initials,{color:T,fontSize:z,fontWeight:f.typography.fontWeight[v?.fontWeight??"semibold"]},p],numberOfLines:1,allowFontScaling:!1,children:I??" "})}),"verified"===n?_jsx(View,{style:[styles.status,"topRight"===l?styles.badgeTopRight:styles.badgeBottomRight,{width:$,height:$,borderRadius:$/2,...smoothCorners,backgroundColor:k}],accessible:!1,pointerEvents:"none",testID:`${P}-badge`,children:_jsx(AppIcon,{name:"verify",variant:"bold",size:O,color:D})}):null,n&&!V?_jsx(View,{style:[styles.status,"topRight"===l?styles.statusTopRight:styles.statusBottomRight,{width:G,height:G,borderRadius:G/2,...smoothCorners,backgroundColor:statusColor(f,n),borderWidth:j,borderColor:k}],accessible:!1,pointerEvents:"none"}):null]});return m?_jsx(AvatarSkeleton,{...e}):Y});Avatar.displayName="Avatar";const AvatarSkeleton=({size:e="md",shape:r="circle",style:t})=>{const o=resolveSize(e);return _jsx(Skeleton,{shape:"circle"===r?"circle":"rounded"===r?"rounded":"rect",width:o,height:o,style:t})};AvatarSkeleton.displayName="AvatarSkeleton",Avatar.Skeleton=AvatarSkeleton;const styles=StyleSheet.create({root:{alignItems:"center",justifyContent:"center",overflow:"visible",position:"relative"},initials:{textAlign:"center"},ring:{position:"absolute",top:0,right:0,bottom:0,left:0},picture:{alignItems:"center",justifyContent:"center",overflow:"hidden"},status:{position:"absolute"},badgeTopRight:{top:-2,right:-2,alignItems:"center",justifyContent:"center"},badgeBottomRight:{bottom:-2,right:-2,alignItems:"center",justifyContent:"center"},statusTopRight:{top:0,right:0},statusBottomRight:{bottom:0,right:0}}),SPACING_OFFSET={tight:-16,normal:-12,loose:-8},STAGGER_MS=50,ENTRANCE_DURATION_MS=220,AvatarGroupItem=({delay:e,marginLeft:r,borderColor:t,borderWidth:o,children:s})=>{const a=useRef(createAnimatedValue(0)).current;return useEffect(()=>{const r=Animated.timing(a,{toValue:1,duration:220,delay:e,easing:Easing.out(Easing.cubic),useNativeDriver:!0});return r.start(),()=>r.stop()},[e,a]),_jsx(Animated.View,{style:[groupStyles.item,{marginLeft:r,borderColor:t,borderWidth:o,opacity:a}],children:s})},AvatarGroup=e=>{const{children:r,max:t=4,size:o="md",spacing:s="normal",overflowVariant:a="count",accessibilityLabel:i,style:n,testID:l}=e,c=useTheme(),d=useMemo(()=>Children.toArray(r).filter(e=>isValidElement(e)),[r]),u=d.length,h=d.slice(0,t),m=Math.max(0,u-t),g=m>0,b=SPACING_OFFSET[s],p=c.colors.background.elevated,y=i??`Group of ${u} ${1===u?"person":"people"}`,f=useMemo(()=>resolveSize(o),[o]),v=Math.max(10,Math.round(.34*f));return _jsxs(View,{style:[groupStyles.row,n],accessible:!0,accessibilityLabel:y,accessibilityRole:"summary",testID:l,children:[h.map((e,r)=>{const t=e.key??`avatar-${r}`;return _jsx(AvatarGroupItem,{delay:50*r,marginLeft:0===r?0:b,borderColor:p,borderWidth:1.5,children:cloneElement(e,{size:o})},t)}),g?_jsx(AvatarGroupItem,{delay:50*h.length,marginLeft:0===h.length?0:b,borderColor:p,borderWidth:1.5,children:_jsx(View,{style:[groupStyles.overflow,{width:f,height:f,borderRadius:f/2,...smoothCorners,backgroundColor:c.colors.surface.disabled}],accessible:!0,accessibilityRole:"text",accessibilityLabel:"count"===a?`${m} more`:"More avatars",children:_jsx(Text,{style:{color:c.colors.text.secondary,fontSize:v,fontWeight:c.typography.fontWeight.semibold},numberOfLines:1,allowFontScaling:!1,children:"count"===a?`+${m}`:"+"})})},"avatar-overflow"):null]})},groupStyles=StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},item:{borderRadius:9999,...smoothCorners},overflow:{alignItems:"center",justifyContent:"center"}}),AvatarWithGroup=Avatar;AvatarWithGroup.Group=AvatarGroup;export{Avatar,AvatarGroup};export default AvatarWithGroup;
@@ -1 +1 @@
1
- export{Avatar,AvatarGroup,avatarToneColors,default}from"./Avatar.js";
1
+ "use strict";export{Avatar,AvatarGroup,avatarToneColors,default}from"./Avatar.js";
@@ -1 +1 @@
1
- import t,{forwardRef as e,useEffect as i,useMemo as o,useRef as r}from"react";import{Animated as n,Easing as a,StyleSheet as s,Text as d,View as l}from"react-native";import{createAnimatedValue as c,fontFor as h,setNativeValue as g,useTheme as u}from"../../theme/index.js";import{smoothCorners as m}from"../../utils/corners.js";import{Skeleton as p}from"../Skeleton/index.js";import{jsx as f,jsxs as b}from"react/jsx-runtime";const y={sm:{fontSize:10,minWidth:16,height:16,paddingH:5,dot:8},md:{fontSize:11,minWidth:20,height:20,paddingH:6,dot:10}},anchorPosition=(t,e)=>{const i=-e;switch(t){case"topLeft":return{top:i,left:i};case"bottomRight":return{bottom:i,right:i};case"bottomLeft":return{bottom:i,left:i};default:return{top:i,right:i}}},x=e((t,e)=>{const{value:s,max:p=99,variant:x="standard",tone:z="error",size:w="sm",invisible:v=!1,loading:k=!1,children:W,anchor:H="topRight",pulse:j=!1,accessibilityLabel:L,style:D,badgeStyle:R,textStyle:I,testID:N}=t,C=u(),F=o(()=>((t,e)=>{switch(e){case"primary":return{background:t.colors.primary,text:t.colors.onPrimary};case"success":return{background:t.colors.success,text:t.colors.onSuccess};case"warning":return{background:t.colors.warning,text:t.colors.onWarning};case"info":return{background:t.colors.info,text:t.colors.onInfo};case"neutral":return{background:t.colors.background.tertiary,text:t.colors.text.primary};default:return{background:t.colors.error,text:t.colors.onError}}})(C,z),[C,z]),V=C.components.badge?.[w],B={fontSize:V?.fontSize??y[w].fontSize,minWidth:V?.minWidth??y[w].minWidth,height:V?.height??y[w].height,paddingH:V?.paddingHorizontal??y[w].paddingH,dot:V?.dotSize??y[w].dot},M=C.components.badge?.borderWidth??1.5,O=C.components.badge?.anchorOffset??4,P="dot"===x?null:((t,e)=>{if(null==t)return null;if("number"==typeof t)return t<=0?null:t>e?`${e}+`:String(t);const i=String(t);return 0===i.length?null:i})(s,p),$=!v&&("dot"===x||null!==P),q=r(c(1)).current;i(()=>{if(!j||!$)return void g(q,1);const t=n.loop(n.sequence([n.timing(q,{toValue:1.15,duration:C.motion.duration.slow,easing:a.bezier(...C.motion.easing.standard),useNativeDriver:!0}),n.timing(q,{toValue:1,duration:C.motion.duration.slow,easing:a.bezier(...C.motion.easing.standard),useNativeDriver:!0})]));return t.start(),()=>{t.stop()}},[j,$,q,C]);const A="dot"===x,E=A?"image":"text",G=L??(A?"Notification indicator":P?`${P} unread`:void 0),J=$?f(n.View,{style:[S.badge,A?{width:B.dot,height:B.dot,borderRadius:B.dot/2,...m,paddingHorizontal:0}:{minWidth:B.minWidth,minHeight:B.height,borderRadius:C.radius.full,...m,paddingHorizontal:B.paddingH},{backgroundColor:F.background,transform:[{scale:q}]},W?{position:"absolute",borderWidth:M,borderColor:C.colors.background.elevated,...anchorPosition(H,O)}:null,R],accessible:!0,accessibilityRole:E,accessibilityLabel:G,children:A||null===P?null:f(d,{style:[S.text,{color:F.text,fontSize:B.fontSize,...h(C,"bold")},I],numberOfLines:1,maxFontSizeMultiplier:C.maxFontSizeMultiplier,children:P??" "})}):null,K=W?b(l,{ref:e,style:[S.wrapper,D],testID:N,children:[W,J]}):f(l,{ref:e,style:D,testID:N,children:J});return k?f(BadgeSkeleton,{...t}):K});x.displayName="Badge";const BadgeSkeleton=({variant:t="standard",size:e="md",children:i,anchor:o,style:r,badgeStyle:n})=>{const a=y[e];if("dot"===t)return f(p,{shape:"circle",width:a.dot,height:a.dot,style:[n,r]});const s=a.height/2;if(void 0!==i){const t="topLeft"===o?{top:-a.height/2,left:-a.height/2}:"bottomRight"===o?{bottom:-a.height/2,right:-a.height/2}:"bottomLeft"===o?{bottom:-a.height/2,left:-a.height/2}:{top:-a.height/2,right:-a.height/2};return b(l,{style:[S.wrapper,r],children:[i,f(l,{style:[{position:"absolute"},t],children:f(p,{width:a.minWidth+a.paddingH,height:a.height,radius:s,style:n})})]})}return f(p,{width:a.minWidth+a.paddingH,height:a.height,radius:s,style:[n,r]})};BadgeSkeleton.displayName="BadgeSkeleton",x.Skeleton=BadgeSkeleton;const S=s.create({wrapper:{position:"relative",alignSelf:"flex-start"},badge:{alignItems:"center",justifyContent:"center",flexDirection:"row"},text:{textAlign:"center",includeFontPadding:!1}});export{x as Badge};export default x;
1
+ "use strict";import React,{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Easing,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,setNativeValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const toneFor=(e,t)=>{switch(t){case"primary":return{background:e.colors.primary,text:e.colors.onPrimary};case"success":return{background:e.colors.success,text:e.colors.onSuccess};case"warning":return{background:e.colors.warning,text:e.colors.onWarning};case"info":return{background:e.colors.info,text:e.colors.onInfo};case"neutral":return{background:e.colors.background.tertiary,text:e.colors.text.primary};default:return{background:e.colors.error,text:e.colors.onError}}},sizeMap={sm:{fontSize:10,minWidth:16,height:16,paddingH:5,dot:8},md:{fontSize:11,minWidth:20,height:20,paddingH:6,dot:10}},anchorPosition=(e,t)=>{const o=-t;switch(e){case"topLeft":return{top:o,left:o};case"bottomRight":return{bottom:o,right:o};case"bottomLeft":return{bottom:o,left:o};default:return{top:o,right:o}}},formatValue=(e,t)=>{if(null==e)return null;if("number"==typeof e)return e<=0?null:e>t?`${t}+`:String(e);const o=String(e);return 0===o.length?null:o},Badge=forwardRef((e,t)=>{const{value:o,max:i=99,variant:r="standard",tone:n="error",size:s="sm",invisible:a=!1,loading:d=!1,children:l,anchor:c="topRight",pulse:h=!1,accessibilityLabel:u,style:g,badgeStyle:m,textStyle:f,testID:p}=e,b=useTheme(),x=useMemo(()=>toneFor(b,n),[b,n]),y=b.components.badge?.[s],S={fontSize:y?.fontSize??sizeMap[s].fontSize,minWidth:y?.minWidth??sizeMap[s].minWidth,height:y?.height??sizeMap[s].height,paddingH:y?.paddingHorizontal??sizeMap[s].paddingH,dot:y?.dotSize??sizeMap[s].dot},z=b.components.badge?.borderWidth??1.5,w=b.components.badge?.anchorOffset??4,k="dot"===r?null:formatValue(o,i),j=!a&&("dot"===r||null!==k),v=useRef(createAnimatedValue(1)).current;useEffect(()=>{if(!h||!j)return void setNativeValue(v,1);const e=Animated.loop(Animated.sequence([Animated.timing(v,{toValue:1.15,duration:b.motion.duration.slow,easing:Easing.bezier(...b.motion.easing.standard),useNativeDriver:!0}),Animated.timing(v,{toValue:1,duration:b.motion.duration.slow,easing:Easing.bezier(...b.motion.easing.standard),useNativeDriver:!0})]));return e.start(),()=>{e.stop()}},[h,j,v,b]);const V="dot"===r,W=V?"image":"text",_=u??(V?"Notification indicator":k?`${k} unread`:void 0),B=j?_jsx(Animated.View,{style:[styles.badge,V?{width:S.dot,height:S.dot,borderRadius:S.dot/2,...smoothCorners,paddingHorizontal:0}:{minWidth:S.minWidth,minHeight:S.height,borderRadius:b.radius.full,...smoothCorners,paddingHorizontal:S.paddingH},{backgroundColor:x.background,transform:[{scale:v}]},l?{position:"absolute",borderWidth:z,borderColor:b.colors.background.elevated,...anchorPosition(c,w)}:null,m],accessible:!0,accessibilityRole:W,accessibilityLabel:_,children:V||null===k?null:_jsx(Text,{style:[styles.text,{color:x.text,fontSize:S.fontSize,...fontFor(b,"bold")},f],numberOfLines:1,maxFontSizeMultiplier:b.maxFontSizeMultiplier,children:k??" "})}):null,H=l?_jsxs(View,{ref:t,style:[styles.wrapper,g],testID:p,children:[l,B]}):_jsx(View,{ref:t,style:g,testID:p,children:B});return d?_jsx(BadgeSkeleton,{...e}):H});Badge.displayName="Badge";const BadgeSkeleton=({variant:e="standard",size:t="md",children:o,anchor:i,style:r,badgeStyle:n})=>{const s=sizeMap[t];if("dot"===e)return _jsx(Skeleton,{shape:"circle",width:s.dot,height:s.dot,style:[n,r]});const a=s.height/2;if(void 0!==o){const e="topLeft"===i?{top:-s.height/2,left:-s.height/2}:"bottomRight"===i?{bottom:-s.height/2,right:-s.height/2}:"bottomLeft"===i?{bottom:-s.height/2,left:-s.height/2}:{top:-s.height/2,right:-s.height/2};return _jsxs(View,{style:[styles.wrapper,r],children:[o,_jsx(View,{style:[{position:"absolute"},e],children:_jsx(Skeleton,{width:s.minWidth+s.paddingH,height:s.height,radius:a,style:n})})]})}return _jsx(Skeleton,{width:s.minWidth+s.paddingH,height:s.height,radius:a,style:[n,r]})};BadgeSkeleton.displayName="BadgeSkeleton",Badge.Skeleton=BadgeSkeleton;const styles=StyleSheet.create({wrapper:{position:"relative",alignSelf:"flex-start"},badge:{alignItems:"center",justifyContent:"center",flexDirection:"row"},text:{textAlign:"center",includeFontPadding:!1}});export{Badge};export default Badge;
@@ -1 +1 @@
1
- export{Badge,default}from"./Badge.js";
1
+ "use strict";export{Badge,default}from"./Badge.js";
@@ -1 +1 @@
1
- import e,{forwardRef as n,useEffect as o,useMemo as t,useRef as r,useState as i}from"react";import{Animated as s,Pressable as a,StyleSheet as l,Text as c,View as d}from"react-native";import{createAnimatedValue as p,fontFor as g,useTheme as m}from"../../theme/index.js";import{smoothCorners as u}from"../../utils/corners.js";import{resolveHaptic as y,triggerHaptic as h}from"../../utils/hapticUtils.js";import{Skeleton as b,SkeletonText as f}from"../Skeleton/index.js";import{jsx as x,jsxs as S}from"react/jsx-runtime";const B=n((e,n)=>{const{title:l,message:b,variant:f="info",icon:B,actions:C,dismissible:R=!1,onDismiss:w,haptic:v,visible:z=!0,animateMount:k=!0,loading:L=!1,accessibilityRole:D="alert",accessibilityLabel:j,style:W,containerStyle:H,iconCircleStyle:G,tintBarStyle:P,closeButtonStyle:I,actionButtonStyle:V,testID:N}=e,M=m(),T=t(()=>buildStyles(M),[M]),$=t(()=>tintFor(M,f),[M,f]),E=r(p(k&&z?-20:0)).current,F=r(p(k&&z?0:z?1:0)).current,[O,U]=i(z),Y=r(!0);if(o(()=>{if(Y.current&&(Y.current=!1,!k))return;let e;return z?(U(!0),e=s.parallel([s.timing(E,{toValue:0,duration:M.motion.duration.normal,useNativeDriver:!0}),s.timing(F,{toValue:1,duration:M.motion.duration.normal,useNativeDriver:!0})]),e.start()):O&&(e=s.parallel([s.timing(E,{toValue:-20,duration:M.motion.duration.fast,useNativeDriver:!0}),s.timing(F,{toValue:0,duration:M.motion.duration.fast,useNativeDriver:!0})]),e.start(()=>{U(!1)})),()=>e?.stop()},[z]),!O)return null;const q=l??" ",A="string"==typeof b?b??" ":"",J="alert"===D?"error"===f?"assertive":"polite":"none",K=S(s.View,{ref:n,accessibilityRole:D,accessibilityLiveRegion:J,accessibilityLabel:j,testID:N,style:[T.container,{backgroundColor:M.colors.background.secondary,borderRadius:M.radius.md,...u,padding:M.spacing.md,opacity:F,transform:[{translateY:E}]},W,H],children:[x(d,{style:[T.tintBar,{backgroundColor:$.bar},P]}),S(d,{style:T.row,children:[!1===B?null:x(d,B?{style:T.iconWrap,children:B}:{style:[T.iconCircle,{backgroundColor:$.bar+"22"},G],children:x(c,{style:[T.iconGlyph,{color:$.glyphColor}],accessible:!1,children:$.glyph})}),S(d,{style:T.textBlock,children:[l||L?x(c,{style:{color:M.colors.text.primary,fontSize:M.typography.fontSize.base,...g(M,"semibold"),lineHeight:20},numberOfLines:2,children:q}):null,"string"==typeof b||L?x(c,{style:{color:M.colors.text.secondary,fontSize:M.typography.fontSize.sm,...g(M,"normal"),lineHeight:18,marginTop:l?2:0},children:A||" "}):x(d,{style:{marginTop:l?2:0},children:b})]}),R?x(a,{accessibilityRole:"button",accessibilityLabel:"Dismiss banner",onPress:()=>{const e=y(v,"selection");e&&h(e),w?.()},hitSlop:8,style:({pressed:e})=>[T.closeBtn,{backgroundColor:e?M.colors.surface.pressed:"transparent"},I],children:x(c,{style:{color:M.colors.text.secondary,fontSize:M.components.banner?.closeGlyphFontSize??18,fontWeight:M.typography.fontWeight.bold,lineHeight:18},accessible:!1,children:"×"})}):null]}),C&&C.length>0?x(d,{style:T.actionsRow,children:C.map((e,n)=>{const o=e.tone??"primary",t=e.variant??"ghost",r="danger"===o?M.colors.error:"neutral"===o?M.colors.text.secondary:$.glyphColor,i="danger"===o?M.colors.onError:"neutral"===o?M.colors.text.inverse:$.on,s="solid"===t;return x(a,{accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{const n=y(v,"selection");n&&h(n),e.onPress()},style:({pressed:n})=>[T.actionBtn,"md"===e.size&&T.actionBtnMd,"outline"===t&&{borderWidth:1,borderColor:r},{backgroundColor:s?r:n?M.colors.surface.pressed:"transparent",opacity:s&&n?.85:1},V],children:x(c,{style:{color:s?i:r,fontSize:M.typography.fontSize.sm,...g(M,"semibold")},numberOfLines:1,children:e.label})},`${e.label}-${n}`)})}):null]});return L?x(BannerSkeleton,{...e}):K});B.displayName="Banner";const BannerSkeleton=({title:e,actions:n,icon:o,containerStyle:t,style:r})=>{const i=m(),s=!1!==o;return S(d,{style:[{flexDirection:"row",alignItems:"flex-start",backgroundColor:i.colors.background.elevated,borderRadius:i.radius.md,...u,padding:i.spacing.md,borderWidth:1,borderColor:i.colors.border.primary},t,r],accessibilityRole:"progressbar",accessibilityState:{busy:!0},children:[s?x(d,{style:{marginRight:i.spacing.sm},children:x(b,{shape:"circle",width:32,height:32})}):null,S(d,{style:{flex:1},children:[void 0!==e?x(b,{shape:"text",width:"55%",height:16,style:{marginBottom:i.spacing.xs}}):null,x(f,{lines:2,fontSize:13,lastLineWidth:"70%"}),n&&n.length>0?x(d,{style:{flexDirection:"row",marginTop:i.spacing.sm},children:n.map((e,n)=>x(b,{width:72,height:28,shape:"rounded",style:{marginRight:i.spacing.sm}},`sk-banner-action-${n}`))}):null]})]})};BannerSkeleton.displayName="BannerSkeleton",B.Skeleton=BannerSkeleton;const tintFor=(e,n)=>{switch(n){case"success":return{bar:e.colors.success,glyphColor:e.colors.success,on:e.colors.onSuccess,glyph:"✓"};case"warning":return{bar:e.colors.warning,glyphColor:e.colors.warning,on:e.colors.onWarning,glyph:"⚠"};case"error":return{bar:e.colors.error,glyphColor:e.colors.error,on:e.colors.onError,glyph:"✗"};case"neutral":return{bar:e.colors.text.tertiary,glyphColor:e.colors.text.secondary,on:e.colors.text.inverse,glyph:"i"};default:return{bar:e.colors.primary,glyphColor:e.colors.primary,on:e.colors.onPrimary,glyph:"i"}}},buildStyles=e=>{const n=e.components.banner?.iconCircleSize??28,o=e.components.banner?.closeButtonSize??28;return l.create({container:{overflow:"hidden",paddingLeft:e.components.banner?.containerPaddingLeft??e.spacing.md},tintBar:{position:"absolute",left:0,top:0,bottom:0,width:e.components.banner?.tintBarWidth??4},row:{flexDirection:"row",alignItems:"flex-start"},iconWrap:{marginRight:e.components.banner?.iconGap??e.spacing.sm},iconCircle:{width:n,height:n,borderRadius:e.components.banner?.iconCircleRadius??n/2,...u,alignItems:"center",justifyContent:"center",marginRight:e.components.banner?.iconGap??e.spacing.sm},iconGlyph:{fontSize:e.components.banner?.iconGlyphFontSize??15,fontWeight:"700",lineHeight:e.components.banner?.iconGlyphLineHeight??17},textBlock:{flex:1,paddingRight:e.components.banner?.textBlockPaddingRight??e.spacing.xs},closeBtn:{width:o,height:o,borderRadius:e.components.banner?.closeButtonRadius??o/2,...u,alignItems:"center",justifyContent:"center",marginLeft:e.components.banner?.closeButtonMarginLeft??e.spacing.xxs??4},actionsRow:{flexDirection:"row",justifyContent:"flex-end",marginTop:e.components.banner?.actionsRowMarginTop??e.spacing.xs,gap:e.components.banner?.actionsRowGap??4},actionBtn:{paddingHorizontal:e.components.banner?.actionButtonPaddingHorizontal??e.spacing.sm,paddingVertical:e.components.banner?.actionButtonPaddingVertical??6,borderRadius:e.components.banner?.actionButtonRadius??e.radius.sm,...u,alignItems:"center",justifyContent:"center"},actionBtnMd:{minHeight:44,paddingHorizontal:e.spacing.md}})};export{B as Banner};export default B;
1
+ "use strict";import React,{forwardRef,useEffect,useMemo,useRef,useState}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{Skeleton,SkeletonText}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const Banner=forwardRef((e,t)=>{const{title:n,message:o,variant:r="info",icon:i,actions:s,dismissible:a=!1,onDismiss:l,haptic:c,visible:d=!0,animateMount:p=!0,loading:m=!1,accessibilityRole:u="alert",accessibilityLabel:g,style:h,containerStyle:y,iconCircleStyle:b,tintBarStyle:f,closeButtonStyle:x,actionButtonStyle:S,testID:j}=e,w=useTheme(),B=useMemo(()=>buildStyles(w),[w]),R=useMemo(()=>tintFor(w,r),[w,r]),C=useRef(createAnimatedValue(p&&d?-20:0)).current,k=useRef(createAnimatedValue(p&&d?0:d?1:0)).current,[_,v]=useState(d),V=useRef(!0);if(useEffect(()=>{if(V.current&&(V.current=!1,!p))return;let e;return d?(v(!0),e=Animated.parallel([Animated.timing(C,{toValue:0,duration:w.motion.duration.normal,useNativeDriver:!0}),Animated.timing(k,{toValue:1,duration:w.motion.duration.normal,useNativeDriver:!0})]),e.start()):_&&(e=Animated.parallel([Animated.timing(C,{toValue:-20,duration:w.motion.duration.fast,useNativeDriver:!0}),Animated.timing(k,{toValue:0,duration:w.motion.duration.fast,useNativeDriver:!0})]),e.start(()=>{v(!1)})),()=>e?.stop()},[d]),!_)return null;const z=n??" ",T="string"==typeof o?o??" ":"",H="alert"===u?"error"===r?"assertive":"polite":"none",L=_jsxs(Animated.View,{ref:t,accessibilityRole:u,accessibilityLiveRegion:H,accessibilityLabel:g,testID:j,style:[B.container,{backgroundColor:w.colors.background.secondary,borderRadius:w.radius.md,...smoothCorners,padding:w.spacing.md,opacity:k,transform:[{translateY:C}]},h,y],children:[_jsx(View,{style:[B.tintBar,{backgroundColor:R.bar},f]}),_jsxs(View,{style:B.row,children:[!1===i?null:_jsx(View,i?{style:B.iconWrap,children:i}:{style:[B.iconCircle,{backgroundColor:R.bar+"22"},b],children:_jsx(Text,{style:[B.iconGlyph,{color:R.glyphColor}],accessible:!1,children:R.glyph})}),_jsxs(View,{style:B.textBlock,children:[n||m?_jsx(Text,{style:{color:w.colors.text.primary,fontSize:w.typography.fontSize.base,...fontFor(w,"semibold"),lineHeight:20},numberOfLines:2,children:z}):null,"string"==typeof o||m?_jsx(Text,{style:{color:w.colors.text.secondary,fontSize:w.typography.fontSize.sm,...fontFor(w,"normal"),lineHeight:18,marginTop:n?2:0},children:T||" "}):_jsx(View,{style:{marginTop:n?2:0},children:o})]}),a?_jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:"Dismiss banner",onPress:()=>{const e=resolveHaptic(c,"selection");e&&triggerHaptic(e),l?.()},hitSlop:8,style:({pressed:e})=>[B.closeBtn,{backgroundColor:e?w.colors.surface.pressed:"transparent"},x],children:_jsx(Text,{style:{color:w.colors.text.secondary,fontSize:w.components.banner?.closeGlyphFontSize??18,fontWeight:w.typography.fontWeight.bold,lineHeight:18},accessible:!1,children:"×"})}):null]}),s&&s.length>0?_jsx(View,{style:B.actionsRow,children:s.map((e,t)=>{const n=e.tone??"primary",o=e.variant??"ghost",r="danger"===n?w.colors.error:"neutral"===n?w.colors.text.secondary:R.glyphColor,i="danger"===n?w.colors.onError:"neutral"===n?w.colors.text.inverse:R.on,s="solid"===o;return _jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{const t=resolveHaptic(c,"selection");t&&triggerHaptic(t),e.onPress()},style:({pressed:t})=>[B.actionBtn,"md"===e.size&&B.actionBtnMd,"outline"===o&&{borderWidth:1,borderColor:r},{backgroundColor:s?r:t?w.colors.surface.pressed:"transparent",opacity:s&&t?.85:1},S],children:_jsx(Text,{style:{color:s?i:r,fontSize:w.typography.fontSize.sm,...fontFor(w,"semibold")},numberOfLines:1,children:e.label})},`${e.label}-${t}`)})}):null]});return m?_jsx(BannerSkeleton,{...e}):L});Banner.displayName="Banner";const BannerSkeleton=({title:e,actions:t,icon:n,containerStyle:o,style:r})=>{const i=useTheme(),s=!1!==n;return _jsxs(View,{style:[{flexDirection:"row",alignItems:"flex-start",backgroundColor:i.colors.background.elevated,borderRadius:i.radius.md,...smoothCorners,padding:i.spacing.md,borderWidth:1,borderColor:i.colors.border.primary},o,r],accessibilityRole:"progressbar",accessibilityState:{busy:!0},children:[s?_jsx(View,{style:{marginRight:i.spacing.sm},children:_jsx(Skeleton,{shape:"circle",width:32,height:32})}):null,_jsxs(View,{style:{flex:1},children:[void 0!==e?_jsx(Skeleton,{shape:"text",width:"55%",height:16,style:{marginBottom:i.spacing.xs}}):null,_jsx(SkeletonText,{lines:2,fontSize:13,lastLineWidth:"70%"}),t&&t.length>0?_jsx(View,{style:{flexDirection:"row",marginTop:i.spacing.sm},children:t.map((e,t)=>_jsx(Skeleton,{width:72,height:28,shape:"rounded",style:{marginRight:i.spacing.sm}},`sk-banner-action-${t}`))}):null]})]})};BannerSkeleton.displayName="BannerSkeleton",Banner.Skeleton=BannerSkeleton;const tintFor=(e,t)=>{switch(t){case"success":return{bar:e.colors.success,glyphColor:e.colors.success,on:e.colors.onSuccess,glyph:"✓"};case"warning":return{bar:e.colors.warning,glyphColor:e.colors.warning,on:e.colors.onWarning,glyph:"⚠"};case"error":return{bar:e.colors.error,glyphColor:e.colors.error,on:e.colors.onError,glyph:"✗"};case"neutral":return{bar:e.colors.text.tertiary,glyphColor:e.colors.text.secondary,on:e.colors.text.inverse,glyph:"i"};default:return{bar:e.colors.primary,glyphColor:e.colors.primary,on:e.colors.onPrimary,glyph:"i"}}},buildStyles=e=>{const t=e.components.banner?.iconCircleSize??28,n=e.components.banner?.closeButtonSize??28;return StyleSheet.create({container:{overflow:"hidden",paddingLeft:e.components.banner?.containerPaddingLeft??e.spacing.md},tintBar:{position:"absolute",left:0,top:0,bottom:0,width:e.components.banner?.tintBarWidth??4},row:{flexDirection:"row",alignItems:"flex-start"},iconWrap:{marginRight:e.components.banner?.iconGap??e.spacing.sm},iconCircle:{width:t,height:t,borderRadius:e.components.banner?.iconCircleRadius??t/2,...smoothCorners,alignItems:"center",justifyContent:"center",marginRight:e.components.banner?.iconGap??e.spacing.sm},iconGlyph:{fontSize:e.components.banner?.iconGlyphFontSize??15,fontWeight:"700",lineHeight:e.components.banner?.iconGlyphLineHeight??17},textBlock:{flex:1,paddingRight:e.components.banner?.textBlockPaddingRight??e.spacing.xs},closeBtn:{width:n,height:n,borderRadius:e.components.banner?.closeButtonRadius??n/2,...smoothCorners,alignItems:"center",justifyContent:"center",marginLeft:e.components.banner?.closeButtonMarginLeft??e.spacing.xxs??4},actionsRow:{flexDirection:"row",justifyContent:"flex-end",marginTop:e.components.banner?.actionsRowMarginTop??e.spacing.xs,gap:e.components.banner?.actionsRowGap??4},actionBtn:{paddingHorizontal:e.components.banner?.actionButtonPaddingHorizontal??e.spacing.sm,paddingVertical:e.components.banner?.actionButtonPaddingVertical??6,borderRadius:e.components.banner?.actionButtonRadius??e.radius.sm,...smoothCorners,alignItems:"center",justifyContent:"center"},actionBtnMd:{minHeight:44,paddingHorizontal:e.spacing.md}})};export{Banner};export default Banner;
@@ -1 +1 @@
1
- export{Banner,default}from"./Banner.js";
1
+ "use strict";export{Banner,default}from"./Banner.js";
@@ -1 +1 @@
1
- import t,{forwardRef as e,useEffect as i,useMemo as n,useRef as o}from"react";import{Animated as r,Pressable as a,StyleSheet as l,Text as s,View as d}from"react-native";import{useSafeAreaInsets as c}from"react-native-safe-area-context";import{createAnimatedValue as u,useTheme as p}from"../../theme/index.js";import{triggerHaptic as h}from"../../utils/index.js";import{smoothCorners as g}from"../../utils/corners.js";import{supportsBoxShadow as b,toBoxShadow as m}from"../../utils/shadows.js";import{renderSlotIcon as y}from"../AppIcon/index.js";import{jsx as f,jsxs as x,Fragment as v}from"react/jsx-runtime";const w=e((e,w)=>{const{tabs:k,centerAction:R,activeTab:z,onChange:C,haptic:S="selection",showLabels:M=!0,variant:V="pill",indicatorPosition:H="bottom",radius:D,indicatorRadius:I="auto",elevation:W,iconSize:P,marginHorizontal:j,marginVertical:T,paddingHorizontal:B,paddingVertical:L,border:E,style:$,indicatorStyle:N,labelStyle:F,testID:_}=e,A=p(),X=c(),O=n(()=>buildStyles(A),[A]),q=A.components.bottomNavigation,G=P??q?.iconSize??18,J=q?.pillHeight??G+4+8,K=q?.pillMaxWidth??64,Q=q?.pillInset??16,U=q?.floatingMargin??16,Y=q?.floatingRadius??28,Z=q?.bubbleSize??48,tt=q?.bubbleLift??14,et="tile"===V,it="floating"===V||et,nt="bubble"===V,ot="expand"===V,rt="solid"===V,at="pill"===V||it||rt,lt=Math.max(0,k.findIndex(t=>t.key===z)),[st,dt]=t.useState(0),[ct,ut]=t.useState(0),pt=R?Math.ceil(k.length/2):k.length,ht=k.length+(R?1:0),[gt,bt]=t.useState({width:0,height:0}),mt=R?.size??48,yt=void 0!==R?.gap,ft=Math.max(0,R?.gap??0),xt=yt?(gt.width||mt)+2*ft:0,vt=yt?k.length>0?Math.max(0,st-xt)/k.length:0:ht>0?st/ht:0,wt=yt?xt:vt,kt=o(u(lt)).current,Rt=o({}),zt=o({});k.forEach(t=>{Rt.current[t.key]||(Rt.current[t.key]=new r.Value(1)),zt.current[t.key]||(zt.current[t.key]=u(t.key===z?1:0))});const Ct=vt>0?et?Math.min(vt-4,96):Math.min(vt-Q,K):0,St=vt>0?(vt-Ct)/2:0,Mt=vt>0?(vt-Z)/2:0,hasLabel=t=>M&&!1!==t.showLabel&&t.label.trim().length>0,Vt=k[lt],Ht=Vt&&!hasLabel(Vt)&&ct>0?ct/2:6+(G+4)/2,Dt=Ht-tt-Z/2,It=Math.max(0,ct-4),Wt=et?2:Ht-J/2,Pt=o(lt);i(()=>{if(Pt.current===lt)return;Pt.current=lt;const t=r.spring(kt,{toValue:lt,tension:120,friction:14,useNativeDriver:!0});return t.start(),()=>t.stop()},[lt,kt]);const jt=Math.max(1,k.length-1),Tt=n(()=>{const t=[],e=[];for(let i=0;i<=jt;i++)t.push(i),e.push(i<pt?i*vt:i*vt+wt);return kt.interpolate({inputRange:t,outputRange:e})},[kt,jt,pt,vt,wt]),Bt=k.map(t=>t.key).join(" "),Lt=nt||ot;i(()=>{const t=Bt.split(" ").flatMap(t=>{const e=t===z?1:0,i=zt.current[t];return i?Lt?[r.spring(i,{toValue:e,tension:140,friction:13,useNativeDriver:!1})]:(i.setValue(e),[]):[]});if(0===t.length)return;const e=r.parallel(t);return e.start(),()=>e.stop()},[z,Bt,Lt]);const popIcon=t=>{r.sequence([r.timing(t,{toValue:1.15,duration:120,useNativeDriver:!0}),r.spring(t,{toValue:1,tension:200,friction:8,useNativeDriver:!0})]).start()},Et=o(new r.Value(1)).current,{colors:$t}=A,Nt=rt?$t.primary:$t.background.elevated,Ft=rt?$t.onPrimary:$t.primary,_t=rt?$t.onPrimary:et?$t.text.primary:$t.text.tertiary,At=rt?$t.onPrimary:$t.primaryMuted,Xt=rt?$t.primary:nt?$t.onPrimary:Ft,Ot=j??U,qt=T??(it?U:0),Gt=qt>0,Jt=L??(it?6:nt?8:6),Kt=B??(it?8:4),Qt=Gt?Jt:Math.max(Jt,X.bottom),Ut=Gt?Math.max(qt,X.bottom):0,Yt="full"===D,Zt=it?ct+2*Jt+2*l.hairlineWidth:ct+Jt+Qt,te=Yt?ct>0?Zt/2:A.radius.full:D??q?.borderRadius??(et?A.radius.full:it?Y:0),ee=void 0!==D||void 0!==q?.borderRadius,activeBgRadius=(t,e)=>"number"==typeof I?Math.max(0,Math.min(I,t/2)):"auto"===I&&ee?Math.min(te,t/2):e,ie="underline"===V?Math.max(Kt,Yt&&0===ct?0:te):Kt,ne=W??"none",oe=A.shadows[ne],re="none"===ne?null:b()?{boxShadow:m(oe)}:oe,ae=E?l.hairlineWidth:0,le=rt?$t.primary:$t.border.primary,se=R?.lift??0,de=Jt+ae,ce=R&&ct>0?Math.max(0,(gt.height||mt)/2+se-ct/2-de):0,ue=R?f(d,{style:[O.centerCell,yt?{flex:0,marginHorizontal:ft}:null],pointerEvents:"box-none",children:f(a,{onPress:()=>{if(!R)return;const t=R.haptic??S;!1!==t&&h(t),popIcon(Et),R.onPress()},onLayout:t=>{const{width:e,height:i}=t.nativeEvent.layout;bt(t=>t.width===e&&t.height===i?t:{width:e,height:i})},accessibilityRole:"button",accessibilityLabel:R.label,hitSlop:{top:6,bottom:6,left:6,right:6},style:({pressed:t})=>[{top:-se},t?{opacity:.85}:null],testID:R.testID??(_?`${_}-center`:void 0),children:R.content?f(r.View,{style:{transform:[{scale:Et}]},children:R.content}):f(d,{style:[O.centerCircle,{width:mt,height:mt,borderRadius:mt/2,...g,backgroundColor:R.color??$t.primary}],children:f(r.View,{style:{transform:[{scale:Et}]},children:y(R.icon??"add",{color:R.iconColor??$t.onPrimary,size:R.iconSize??24,disabled:!1})})})})},"__webority_center_action__"):null,pe=x(d,{style:O.tabRow,onLayout:t=>{const{width:e,height:i}=t.nativeEvent.layout;dt(e),ut(i)},children:[at&&Ct>0&&(!et||It>0)?f(r.View,{pointerEvents:"none",style:[O.pill,{width:Ct,height:et?It:J,left:St,top:Wt,backgroundColor:At,borderRadius:et?activeBgRadius(It,It/2):activeBgRadius(J,A.radius.full),...g,transform:[{translateX:Tt}]},N]}):null,nt&&vt>0?f(r.View,{pointerEvents:"none",style:[O.bubble,A.shadows.md,{width:Z,height:Z,borderRadius:Z/2,...g,left:Mt,top:Dt,backgroundColor:$t.primary,borderColor:$t.background.elevated,transform:[{translateX:Tt}]},N]}):null,(he=k.map(t=>{const e=t.key===z,i=e?Ft:_t,n=e?Xt:_t,o="string"==typeof t.icon?{name:t.icon,variant:"bold"}:t.icon,l=e?t.activeIcon??o:t.icon,c=Rt.current[t.key],u=zt.current[t.key],p=null==(b=t.badge??null)||!1===b?null:!0===b||"·"===b?{text:"",isDot:!0}:"number"==typeof b?b<=0?null:{text:b>99?"99+":String(b),isDot:!1}:"string"==typeof b?0===b.length?null:{text:b,isDot:!1}:null;var b;const m=(t=>null==t||!1===t?"":"number"==typeof t?t>0?`, ${t} unread`:"":!0===t||"·"===t?", new updates":"string"==typeof t&&t.length>0?`, ${t}`:"")(t.badge??null),w=rt&&!e?.7:1,k=nt&&e||rt?$t.primary:$t.background.elevated,R=hasLabel(t),M=R&&(!ot||e),V=x(r.View,{style:[O.iconWrap,{width:G+4,height:G+4,opacity:w,transform:[{scale:c}]}],children:[y(l,{color:n,size:G,focused:e,disabled:!1}),p?f(d,{style:[p.isDot?O.badgeDot:O.badgePill,{backgroundColor:$t.error,borderColor:k}],children:p.isDot?null:f(s,{style:[O.badgeText,{color:$t.onError}],numberOfLines:1,children:p.text})}):null]}),H=nt?f(r.View,{style:{top:u.interpolate({inputRange:[0,1],outputRange:[0,-tt]})},children:V}):V,D=M?f(r.Text,{numberOfLines:1,style:[O.label,ot?O.labelInline:null,{color:i,opacity:ot?u:w,fontWeight:e?A.typography.fontWeight.semibold:A.typography.fontWeight.normal},F],children:t.label}):null,I=f(a,{onPress:()=>(t=>{t.key!==z&&!1!==S&&h(S);const e=Rt.current[t.key];e&&popIcon(e),C(t.key)})(t),accessibilityRole:"tab",accessibilityState:{selected:e},accessibilityLabel:`${t.label}${m}`,accessibilityHint:`Switches to ${t.label}`,hitSlop:{top:6,bottom:6,left:6,right:6},style:({pressed:t})=>[O.tab,et?O.tabTile:null,t?{opacity:.85}:null],testID:_?`${_}-tab-${t.key}`:void 0,children:ot?x(d,{style:[O.expandPill,{height:J,paddingHorizontal:e&&R?A.spacing.md:Math.max(0,(J-(G+4))/2)}],children:[f(d,{pointerEvents:"none",style:[O.expandFill,{borderRadius:activeBgRadius(J,J/2),...g,backgroundColor:e?$t.primaryMuted:"transparent"},e?N:null]}),H,D]}):x(v,{children:[H,D]})},t.key);return ot?f(r.View,{style:{flex:u.interpolate({inputRange:[0,1],outputRange:[1,R?1.5:1]})},children:I},t.key):I}),ue?[...he.slice(0,pt),ue,...he.slice(pt)]:he),"underline"===V&&vt>0?f(r.View,{pointerEvents:"none",style:[O.underline,"top"===H?O.underlineTop:O.underlineBottom,"top"===H?{top:-Jt}:{bottom:-Jt},{width:vt,height:q?.underlineHeight??3,backgroundColor:$t.primary,transform:[{translateX:Tt}]},N]}):null]});var he;return f(d,{ref:w,testID:_,accessibilityRole:"tablist",style:[O.outer,{paddingHorizontal:Ot,paddingTop:Math.max(qt,ce),paddingBottom:Ut},$],children:f(d,{style:[it?O.floatingBar:O.dockedBar,re,{backgroundColor:Nt,borderColor:le,borderRadius:te,...g},it?{borderWidth:ae,paddingHorizontal:Kt,paddingVertical:Jt}:{borderTopWidth:ae,borderBottomWidth:ae,borderLeftWidth:ae,borderRightWidth:ae,paddingHorizontal:ie,paddingTop:Jt,paddingBottom:Qt}],children:pe})})});w.displayName="BottomNavigation";const buildStyles=t=>l.create({outer:{backgroundColor:"transparent"},dockedBar:{paddingHorizontal:4},floatingBar:{paddingVertical:6,paddingHorizontal:8},tabRow:{flexDirection:"row",alignItems:"stretch",position:"relative"},tab:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center",paddingVertical:6,gap:4},tabTile:{paddingVertical:8,gap:2},centerCell:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center"},centerCircle:{alignItems:"center",justifyContent:"center"},iconWrap:{alignItems:"center",justifyContent:"center",position:"relative"},label:{fontSize:t.typography.fontSize.xs,lineHeight:t.typography.fontSize.xs*t.typography.lineHeight.tight,textAlign:"center",includeFontPadding:!1},labelInline:{fontSize:t.typography.fontSize.sm,lineHeight:t.typography.fontSize.sm*t.typography.lineHeight.tight,flexShrink:1,includeFontPadding:!1},expandPill:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:t.spacing.xs},expandFill:{position:"absolute",top:0,right:0,bottom:0,left:0,overflow:"hidden"},pill:{position:"absolute",left:0},bubble:{position:"absolute",left:0,borderWidth:3},underline:{position:"absolute",left:0,height:3},underlineBottom:{borderTopLeftRadius:2,borderTopRightRadius:2,...g},underlineTop:{borderBottomLeftRadius:2,borderBottomRightRadius:2,...g},badgePill:{position:"absolute",top:-4,right:-8,minWidth:18,height:18,borderRadius:9,...g,paddingHorizontal:4,paddingVertical:2,alignItems:"center",justifyContent:"center",borderWidth:1.5},badgeDot:{position:"absolute",top:-2,right:-2,width:10,height:10,borderRadius:5,...g,borderWidth:1.5},badgeText:{fontSize:10,fontWeight:"700",lineHeight:12,textAlign:"center",includeFontPadding:!1}});export{w as BottomNavigation};export default w;
1
+ "use strict";import React,{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{supportsBoxShadow,toBoxShadow}from"../../utils/shadows.js";import{renderSlotIcon}from"../AppIcon/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const DEFAULT_ICON_SIZE=18,ICON_WRAP_AIR=4,PILL_AIR=8,DEFAULT_PILL_MAX_WIDTH=64,TILE_MAX_WIDTH=96,DEFAULT_PILL_INSET=16,DEFAULT_UNDERLINE_HEIGHT=3,DEFAULT_FLOATING_MARGIN=16,DEFAULT_FLOATING_RADIUS=28,DEFAULT_BUBBLE_SIZE=48,DEFAULT_BUBBLE_LIFT=14,DEFAULT_CENTER_SIZE=48,DEFAULT_CENTER_ICON_SIZE=24,CENTER_KEY="__webority_center_action__",TAB_PADDING_VERTICAL=6,BAR_PADDING_HORIZONTAL=4,BAR_PADDING_TOP=6,BAR_PADDING_TOP_BUBBLE=8,FLOATING_BAR_PADDING_VERTICAL=6,FLOATING_BAR_PADDING_HORIZONTAL=8,EXPANDED_FLEX=1.5,SOLID_INACTIVE_OPACITY=.7,TILE_INSET=2,TILE_LABEL_GAP=2,formatBadge=e=>null==e||!1===e?null:!0===e||"·"===e?{text:"",isDot:!0}:"number"==typeof e?e<=0?null:{text:e>99?"99+":String(e),isDot:!1}:"string"==typeof e?0===e.length?null:{text:e,isDot:!1}:null,badgeAccessibilitySuffix=e=>null==e||!1===e?"":"number"==typeof e?e>0?`, ${e} unread`:"":!0===e||"·"===e?", new updates":"string"==typeof e&&e.length>0?`, ${e}`:"",BottomNavigation=forwardRef((e,t)=>{const{tabs:i,centerAction:o,activeTab:n,onChange:r,haptic:a="selection",showLabels:l=!0,variant:s="pill",indicatorPosition:d="bottom",radius:c,indicatorRadius:u="auto",elevation:h,iconSize:p,marginHorizontal:g,marginVertical:m,paddingHorizontal:b,paddingVertical:y,border:f,style:x,indicatorStyle:_,labelStyle:A,testID:I}=e,R=useTheme(),E=useSafeAreaInsets(),T=useMemo(()=>buildStyles(R),[R]),S=R.components.bottomNavigation,w=p??S?.iconSize??18,L=S?.pillHeight??w+4+8,D=S?.pillMaxWidth??64,C=S?.pillInset??16,v=S?.floatingMargin??16,j=S?.floatingRadius??28,B=S?.bubbleSize??48,N=S?.bubbleLift??14,V="tile"===s,P="floating"===s||V,k="bubble"===s,H="expand"===s,M="solid"===s,z="pill"===s||P||M,F=Math.max(0,i.findIndex(e=>e.key===n)),[W,O]=React.useState(0),[U,G]=React.useState(0),$=o?Math.ceil(i.length/2):i.length,X=i.length+(o?1:0),[Z,Y]=React.useState({width:0,height:0}),K=o?.size??48,q=void 0!==o?.gap,J=Math.max(0,o?.gap??0),Q=q?(Z.width||K)+2*J:0,ee=q?i.length>0?Math.max(0,W-Q)/i.length:0:X>0?W/X:0,te=q?Q:ee,ie=useRef(createAnimatedValue(F)).current,oe=useRef({}),ne=useRef({});i.forEach(e=>{oe.current[e.key]||(oe.current[e.key]=new Animated.Value(1)),ne.current[e.key]||(ne.current[e.key]=createAnimatedValue(e.key===n?1:0))});const re=ee>0?V?Math.min(ee-4,96):Math.min(ee-C,D):0,ae=ee>0?(ee-re)/2:0,le=ee>0?(ee-B)/2:0,hasLabel=e=>l&&!1!==e.showLabel&&e.label.trim().length>0,se=i[F],de=se&&!hasLabel(se)&&U>0?U/2:6+(w+4)/2,ce=de-N-B/2,ue=Math.max(0,U-4),he=V?2:de-L/2,pe=useRef(F);useEffect(()=>{if(pe.current===F)return;pe.current=F;const e=Animated.spring(ie,{toValue:F,tension:120,friction:14,useNativeDriver:!0});return e.start(),()=>e.stop()},[F,ie]);const ge=Math.max(1,i.length-1),me=useMemo(()=>{const e=[],t=[];for(let i=0;i<=ge;i++)e.push(i),t.push(i<$?i*ee:i*ee+te);return ie.interpolate({inputRange:e,outputRange:t})},[ie,ge,$,ee,te]),be=i.map(e=>e.key).join(" "),ye=k||H;useEffect(()=>{const e=be.split(" ").flatMap(e=>{const t=e===n?1:0,i=ne.current[e];return i?ye?[Animated.spring(i,{toValue:t,tension:140,friction:13,useNativeDriver:!1})]:(i.setValue(t),[]):[]});if(0===e.length)return;const t=Animated.parallel(e);return t.start(),()=>t.stop()},[n,be,ye]);const popIcon=e=>{Animated.sequence([Animated.timing(e,{toValue:1.15,duration:120,useNativeDriver:!0}),Animated.spring(e,{toValue:1,tension:200,friction:8,useNativeDriver:!0})]).start()},fe=useRef(new Animated.Value(1)).current,{colors:xe}=R,_e=M?xe.primary:xe.background.elevated,Ae=M?xe.onPrimary:xe.primary,Ie=M?xe.onPrimary:V?xe.text.primary:xe.text.tertiary,Re=M?xe.onPrimary:xe.primaryMuted,Ee=M?xe.primary:k?xe.onPrimary:Ae,Te=g??v,Se=m??(P?v:0),we=Se>0,Le=y??(P?6:k?8:6),De=b??(P?8:4),Ce=we?Le:Math.max(Le,E.bottom),ve=we?Math.max(Se,E.bottom):0,je="full"===c,Be=P?U+2*Le+2*StyleSheet.hairlineWidth:U+Le+Ce,Ne=je?U>0?Be/2:R.radius.full:c??S?.borderRadius??(V?R.radius.full:P?j:0),Ve=void 0!==c||void 0!==S?.borderRadius,activeBgRadius=(e,t)=>"number"==typeof u?Math.max(0,Math.min(u,e/2)):"auto"===u&&Ve?Math.min(Ne,e/2):t,Pe="underline"===s?Math.max(De,je&&0===U?0:Ne):De,ke=h??"none",He=R.shadows[ke],Me="none"===ke?null:supportsBoxShadow()?{boxShadow:toBoxShadow(He)}:He,ze=f?StyleSheet.hairlineWidth:0,Fe=M?xe.primary:xe.border.primary,We=o?.lift??0,Oe=Le+ze,Ue=o&&U>0?Math.max(0,(Z.height||K)/2+We-U/2-Oe):0,Ge=o?_jsx(View,{style:[T.centerCell,q?{flex:0,marginHorizontal:J}:null],pointerEvents:"box-none",children:_jsx(Pressable,{onPress:()=>{if(!o)return;const e=o.haptic??a;!1!==e&&triggerHaptic(e),popIcon(fe),o.onPress()},onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;Y(e=>e.width===t&&e.height===i?e:{width:t,height:i})},accessibilityRole:"button",accessibilityLabel:o.label,hitSlop:{top:6,bottom:6,left:6,right:6},style:({pressed:e})=>[{top:-We},e?{opacity:.85}:null],testID:o.testID??(I?`${I}-center`:void 0),children:o.content?_jsx(Animated.View,{style:{transform:[{scale:fe}]},children:o.content}):_jsx(View,{style:[T.centerCircle,{width:K,height:K,borderRadius:K/2,...smoothCorners,backgroundColor:o.color??xe.primary}],children:_jsx(Animated.View,{style:{transform:[{scale:fe}]},children:renderSlotIcon(o.icon??"add",{color:o.iconColor??xe.onPrimary,size:o.iconSize??24,disabled:!1})})})})},CENTER_KEY):null,$e=_jsxs(View,{style:T.tabRow,onLayout:e=>{const{width:t,height:i}=e.nativeEvent.layout;O(t),G(i)},children:[z&&re>0&&(!V||ue>0)?_jsx(Animated.View,{pointerEvents:"none",style:[T.pill,{width:re,height:V?ue:L,left:ae,top:he,backgroundColor:Re,borderRadius:V?activeBgRadius(ue,ue/2):activeBgRadius(L,R.radius.full),...smoothCorners,transform:[{translateX:me}]},_]}):null,k&&ee>0?_jsx(Animated.View,{pointerEvents:"none",style:[T.bubble,R.shadows.md,{width:B,height:B,borderRadius:B/2,...smoothCorners,left:le,top:ce,backgroundColor:xe.primary,borderColor:xe.background.elevated,transform:[{translateX:me}]},_]}):null,(Xe=i.map(e=>{const t=e.key===n,i=t?Ae:Ie,o=t?Ee:Ie,l="string"==typeof e.icon?{name:e.icon,variant:"bold"}:e.icon,s=t?e.activeIcon??l:e.icon,d=oe.current[e.key],c=ne.current[e.key],u=formatBadge(e.badge??null),h=badgeAccessibilitySuffix(e.badge??null),p=M&&!t?.7:1,g=k&&t||M?xe.primary:xe.background.elevated,m=hasLabel(e),b=m&&(!H||t),y=_jsxs(Animated.View,{style:[T.iconWrap,{width:w+4,height:w+4,opacity:p,transform:[{scale:d}]}],children:[renderSlotIcon(s,{color:o,size:w,focused:t,disabled:!1}),u?_jsx(View,{style:[u.isDot?T.badgeDot:T.badgePill,{backgroundColor:xe.error,borderColor:g}],children:u.isDot?null:_jsx(Text,{style:[T.badgeText,{color:xe.onError}],numberOfLines:1,children:u.text})}):null]}),f=k?_jsx(Animated.View,{style:{top:c.interpolate({inputRange:[0,1],outputRange:[0,-N]})},children:y}):y,x=b?_jsx(Animated.Text,{numberOfLines:1,style:[T.label,H?T.labelInline:null,{color:i,opacity:H?c:p,fontWeight:t?R.typography.fontWeight.semibold:R.typography.fontWeight.normal},A],children:e.label}):null,E=_jsx(Pressable,{onPress:()=>(e=>{e.key!==n&&!1!==a&&triggerHaptic(a);const t=oe.current[e.key];t&&popIcon(t),r(e.key)})(e),accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`${e.label}${h}`,accessibilityHint:`Switches to ${e.label}`,hitSlop:{top:6,bottom:6,left:6,right:6},style:({pressed:e})=>[T.tab,V?T.tabTile:null,e?{opacity:.85}:null],testID:I?`${I}-tab-${e.key}`:void 0,children:H?_jsxs(View,{style:[T.expandPill,{height:L,paddingHorizontal:t&&m?R.spacing.md:Math.max(0,(L-(w+4))/2)}],children:[_jsx(View,{pointerEvents:"none",style:[T.expandFill,{borderRadius:activeBgRadius(L,L/2),...smoothCorners,backgroundColor:t?xe.primaryMuted:"transparent"},t?_:null]}),f,x]}):_jsxs(_Fragment,{children:[f,x]})},e.key);return H?_jsx(Animated.View,{style:{flex:c.interpolate({inputRange:[0,1],outputRange:[1,m?1.5:1]})},children:E},e.key):E}),Ge?[...Xe.slice(0,$),Ge,...Xe.slice($)]:Xe),"underline"===s&&ee>0?_jsx(Animated.View,{pointerEvents:"none",style:[T.underline,"top"===d?T.underlineTop:T.underlineBottom,"top"===d?{top:-Le}:{bottom:-Le},{width:ee,height:S?.underlineHeight??3,backgroundColor:xe.primary,transform:[{translateX:me}]},_]}):null]});var Xe;return _jsx(View,{ref:t,testID:I,accessibilityRole:"tablist",style:[T.outer,{paddingHorizontal:Te,paddingTop:Math.max(Se,Ue),paddingBottom:ve},x],children:_jsx(View,{style:[P?T.floatingBar:T.dockedBar,Me,{backgroundColor:_e,borderColor:Fe,borderRadius:Ne,...smoothCorners},P?{borderWidth:ze,paddingHorizontal:De,paddingVertical:Le}:{borderTopWidth:ze,borderBottomWidth:ze,borderLeftWidth:ze,borderRightWidth:ze,paddingHorizontal:Pe,paddingTop:Le,paddingBottom:Ce}],children:$e})})});BottomNavigation.displayName="BottomNavigation";const buildStyles=e=>StyleSheet.create({outer:{backgroundColor:"transparent"},dockedBar:{paddingHorizontal:4},floatingBar:{paddingVertical:6,paddingHorizontal:8},tabRow:{flexDirection:"row",alignItems:"stretch",position:"relative"},tab:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center",paddingVertical:6,gap:4},tabTile:{paddingVertical:8,gap:2},centerCell:{flex:1,minHeight:44,alignItems:"center",justifyContent:"center"},centerCircle:{alignItems:"center",justifyContent:"center"},iconWrap:{alignItems:"center",justifyContent:"center",position:"relative"},label:{fontSize:e.typography.fontSize.xs,lineHeight:e.typography.fontSize.xs*e.typography.lineHeight.tight,textAlign:"center",includeFontPadding:!1},labelInline:{fontSize:e.typography.fontSize.sm,lineHeight:e.typography.fontSize.sm*e.typography.lineHeight.tight,flexShrink:1,includeFontPadding:!1},expandPill:{flexDirection:"row",alignItems:"center",justifyContent:"center",gap:e.spacing.xs},expandFill:{position:"absolute",top:0,right:0,bottom:0,left:0,overflow:"hidden"},pill:{position:"absolute",left:0},bubble:{position:"absolute",left:0,borderWidth:3},underline:{position:"absolute",left:0,height:3},underlineBottom:{borderTopLeftRadius:2,borderTopRightRadius:2,...smoothCorners},underlineTop:{borderBottomLeftRadius:2,borderBottomRightRadius:2,...smoothCorners},badgePill:{position:"absolute",top:-4,right:-8,minWidth:18,height:18,borderRadius:9,...smoothCorners,paddingHorizontal:4,paddingVertical:2,alignItems:"center",justifyContent:"center",borderWidth:1.5},badgeDot:{position:"absolute",top:-2,right:-2,width:10,height:10,borderRadius:5,...smoothCorners,borderWidth:1.5},badgeText:{fontSize:10,fontWeight:"700",lineHeight:12,textAlign:"center",includeFontPadding:!1}});export{BottomNavigation};export default BottomNavigation;
@@ -1 +1 @@
1
- export{BottomNavigation,default}from"./BottomNavigation.js";
1
+ "use strict";export{BottomNavigation,default}from"./BottomNavigation.js";
@@ -1 +1 @@
1
- import e,{createContext as t,forwardRef as o,useCallback as n,useContext as r,useEffect as a,useImperativeHandle as i,useMemo as l,useRef as s,useState as c}from"react";import{Dimensions as d,Modal as u,Platform as h,ScrollView as m,StyleSheet as p,useWindowDimensions as b,View as g}from"react-native";import{Gesture as f,GestureDetector as v,GestureHandlerRootView as y}from"react-native-gesture-handler";import{useReanimatedKeyboardAnimation as w}from"react-native-keyboard-controller";import x,{Easing as S,runOnJS as k,useAnimatedStyle as C,useDerivedValue as R,useSharedValue as T,withSpring as I,withTiming as L}from"react-native-reanimated";import{SafeAreaProvider as M,useSafeAreaInsets as B}from"react-native-safe-area-context";import{useTheme as D}from"../../theme/index.js";import{triggerHaptic as j}from"../../utils/index.js";import{smoothCorners as O}from"../../utils/corners.js";import{ToastHost as P}from"../Toast/ToastProvider.js";import{jsx as E,jsxs as V}from"react/jsx-runtime";const z=t(null);export const useBottomSheet=()=>{const e=r(z);if(!e)throw new Error("useBottomSheet must be used inside a <BottomSheet>.");return e};const H={damping:20,stiffness:240,mass:1},N=o((e,t)=>{const{snapPoints:o,index:r,onChange:N,onAnimate:$,onAfterClose:F,enablePanDownToClose:Y=!0,enableBackdropPress:A=!0,scrollable:q=!1,scrollRef:U,onScroll:X,onContentSizeChange:G,onScrollLayout:J,scrollEventThrottle:K,keyboardBehavior:Q="shift",mode:W="modal",presentation:Z="sheet",handleIndicatorStyle:_,containerStyle:ee,header:te,footer:oe,headerStyle:ne,footerStyle:re,children:ae,accessibilityLabel:ie,accessibilityViewIsModal:le,testID:se}=e,ce=D(),de=B(),[ue,he]=c(()=>d.get("window").height),[me,pe]=c(()=>d.get("window").width),be=n(e=>{const{height:t,width:o}=e.nativeEvent.layout;t>0&&he(e=>e===t?e:t),o>0&&pe(e=>e===o?e:o)},[]),ge=b(),fe="dialog"===Z||"auto"===Z&&Math.min(ge.width,ge.height)>=600,ve=Math.min(560,me-2*ce.spacing.xl),[ye,we]=c({top:de.top,bottom:de.bottom}),xe="modal"===W?ye.top:de.top,Se="modal"===W?ye.bottom:de.bottom,ke=o.includes("content"),[Ce,Re]=useMeasuredHeight(),[Te,Ie]=useMeasuredHeight(),[Le,Me,Be]=useMeasuredHeight(),[De,je]=useMeasuredHeight(),Oe=fe?ce.spacing.md:Ce,Pe=ke?Math.min(Oe+(null!=te?Te:0)+Le+(null!=oe?De:0)+Se,ue-xe):0,Ee=n((e,t)=>{ke&&Be(t),G?.(e,t)},[ke,G,Be]),Ve=l(()=>resolveSnapPoints(o,ue,Pe),[o,ue,Pe]),ze=ue,He=Ve[Ve.length-1]??0,Ne=T(ze),$e=T(ze),Fe=T(-1),[Ye,Ae]=c(-1),qe=s(!1),[Ue,Xe]=c(!1),[Ge,Je]=c(!1),Ke=s(!1),Qe=s(F);Qe.current=F;const[We,Ze]=c(!1),_e=n(e=>{if(e<0||e>=Ve.length)return ze;const t=Ve[e];return fe?(ue-t)/2:ue-t},[Ve,ue,ze,fe]),et=n(e=>{Ye!==e&&(Ae(e),Fe.value=e,N?.(e))},[Ye,Fe,N]),tt=n(()=>{qe.current=!1,Fe.value<0&&(Ke.current=!0,"modal"===W?(Xe(!1),"ios"!==h.OS&&Je(!1)):Ze(!1))},[W,Fe]),ot=n(()=>{Ke.current&&Je(!1)},[]);a(()=>{("modal"===W?!Ge:!We)&&Ke.current&&(Ke.current=!1,Qe.current?.())},[W,Ge,We]);const nt=n((e,t,o)=>{qe.current=!0,$?.(t,o),Ne.value=I(e,H,e=>{e&&k(tt)()})},[$,Ne,tt]),rt=n(e=>{const t="number"==typeof e?clamp(e,0,Ve.length-1):Ye>=0?Ye:0,o=Fe.value,n=_e(t);Ke.current=!1,"modal"===W?(Je(!0),Xe(!0)):Ze(!0),o<0&&(Ne.value=ze),et(t),nt(n,o,t)},[nt,ze,Ye,Fe,W,Ve.length,et,Ne,_e]),at=n(()=>{if(0===Ve.length)return;const e=Fe.value,t=_e(0);et(0),nt(t,e,0)},[nt,Fe,Ve.length,et,_e]),it=n(()=>{const e=Fe.value;et(-1),qe.current=!0,$?.(e,-1),Ne.value=L(ze,{duration:ce.motion.duration.fast,easing:S.bezier(...ce.motion.easing.accelerate)},e=>{e&&k(tt)()})},[ze,Fe,tt,$,et,Ne,ce.motion.duration.fast,ce.motion.easing.accelerate]);i(t,()=>({expand:rt,collapse:at,close:it}),[rt,at,it]),a(()=>{"number"==typeof r&&r!==Ye&&(-1===r?it():rt(r))},[r]);const lt=s({hostHeight:ue,contentSnap:Pe});a(()=>{const e=lt.current;e.hostHeight===ue&&e.contentSnap===Pe||(lt.current={hostHeight:ue,contentSnap:Pe},e.hostHeight===ue&&Fe.value<0||(Ne.value=I(_e(Fe.value),H)))},[ue,Pe]);const st=ue-He,ct=l(()=>Ve.map(e=>ue-e),[Ve,ue]),dt=n((e,t)=>{const o=Fe.value;if(-1===e)return j("selection"),et(-1),qe.current=!0,$?.(o,-1),void(Ne.value=L(ze,{duration:ce.motion.duration.fast,easing:S.bezier(...ce.motion.easing.accelerate)},e=>{e&&k(tt)()}));et(e),nt(t,o,e)},[nt,ze,Fe,tt,$,et,Ne,ce.motion.duration.fast,ce.motion.easing.accelerate]),ut=l(()=>f.Native().withTestId(se?`${se}-content-gesture`:"bottom-sheet-content-gesture"),[se]),ht=l(()=>{const e=ct,t=ze,o=st,n=Y;return f.Pan().withTestId(se?`${se}-pan-gesture`:"bottom-sheet-pan-gesture").activeOffsetY([-10,10]).failOffsetX([-15,15]).onStart(()=>{$e.value=Ne.value}).onUpdate(e=>{const t=$e.value+e.translationY;Ne.value=t<o?o+.25*(t-o):t}).onEnd(o=>{const r=Ne.value;if(o.velocityY>1e3)return n?void k(dt)(-1,t):void k(dt)(0,e[0]);let a=0,i=Math.abs(r-e[0]);for(let t=1;t<e.length;t++){const o=Math.abs(r-e[t]);o<i&&(i=o,a=t)}const l=e[0];n&&r-l>80?k(dt)(-1,t):k(dt)(a,e[a])})},[ze,$e,Y,dt,st,ct,se,Ne]),{height:mt}=w(),pt="shift"===Q,bt=R(()=>pt?mt.value:0),gt=Ve[Ye>=0?Ye:0]??He,ft=ce.spacing.md,vt=C(()=>{if(fe){const e=bt.value,t=ue+e-gt-ft,o=e<0&&Ne.value>t?t:Ne.value;return{top:o<xe?xe:o}}const e=Ne.value+bt.value,t=bt.value<0?xe:st;return{top:e<t?t:e}}),yt=C(()=>{const e=bt.value;if(fe){const t=ue+e-gt-ft,o=e<0&&Ne.value>t?t:Ne.value,n=ue+e-ft-(o<xe?xe:o);return{height:n<0?0:n>gt?gt:n}}const t=e<0?xe:st,o=Ne.value+e,n=ue+e-(o<t?t:o);return{height:n<0?0:n>He?He:n}}),wt=Ye>=0,xt=l(()=>buildStyles(ce),[ce]),St=n(()=>{A&&(j("selection"),it())},[A,it]),kt=l(()=>f.Tap().withTestId(se?`${se}-backdrop-gesture`:"bottom-sheet-backdrop-gesture").maxDuration(250).onEnd((e,t)=>{t&&k(St)()}),[St,se]),Ct=l(()=>({snapIndex:Ye,snapPoints:Ve,expand:rt,collapse:at,close:it}),[Ye,Ve,rt,at,it]);if("inline"===W&&!We)return null;if("modal"===W&&!Ge)return null;const Rt=V(g,{collapsable:!1,style:["modal"===W?xt.backdropModal:xt.backdropInline,{backgroundColor:ce.colors.background.overlay}],onLayout:be,testID:se,accessibilityViewIsModal:le??wt,children:[E(v,{gesture:kt,children:E(x.View,{style:p.absoluteFill,accessibilityRole:"button",accessibilityLabel:"Close bottom sheet"})}),E(x.View,{accessibilityRole:"alert",accessibilityLabel:ie,accessibilityViewIsModal:le??wt,style:[xt.sheet,{height:He,backgroundColor:ce.colors.background.elevated,borderTopLeftRadius:ce.radius["2xl"],borderTopRightRadius:ce.radius["2xl"],...O,...ce.shadows.xl},fe?{height:gt,left:(me-ve)/2,right:void 0,width:ve,borderBottomLeftRadius:ce.radius["2xl"],borderBottomRightRadius:ce.radius["2xl"]}:null,ee,vt],children:V(SheetBody,{style:[xt.body,yt],keyboardOffset:bt,children:[fe?E(g,{style:{height:ce.spacing.md}}):E(v,{gesture:ht,children:E(g,{style:xt.handleRow,onLayout:ke?Re:void 0,accessible:!0,accessibilityLabel:"Drag handle",accessibilityHint:"Drag up or down to resize the sheet, or swipe down to close it",testID:se?`${se}-handle`:"bottom-sheet-handle",children:E(g,{style:[xt.handle,{backgroundColor:ce.components.bottomSheet?.handleColor??ce.colors.border.primary},_]})})}),null!=te&&E(g,{style:[xt.header,ne],onLayout:ke?Ie:void 0,children:te}),q?E(v,{gesture:ut,children:E(m,{ref:U,style:xt.content,onScroll:X,onContentSizeChange:Ee,onLayout:J,scrollEventThrottle:K,keyboardShouldPersistTaps:"always",keyboardDismissMode:"none",children:ae})}):E(g,{style:xt.content,children:ke?E(g,{onLayout:Me,children:ae}):ae}),null!=oe&&E(g,{style:[xt.footer,re],onLayout:ke?je:void 0,children:oe})]})})]}),Tt=E(z.Provider,{value:Ct,children:Rt});return"modal"===W?E(u,{transparent:!0,visible:Ue,onRequestClose:it,onDismiss:"ios"===h.OS?ot:void 0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",supportedOrientations:["portrait","landscape"],children:V(M,{style:xt.modalRoot,children:[E(InsetsProbe,{onChange:we}),"android"===h.OS?E(y,{style:xt.modalRoot,children:Tt}):Tt,E(P,{})]})}):Tt}),InsetsProbe=({onChange:e})=>{const{top:t,bottom:o}=B();return a(()=>{e(e=>e.top===t&&e.bottom===o?e:{top:t,bottom:o})},[t,o,e]),null},SheetBody=({style:e,keyboardOffset:t,children:o})=>{const n=B().bottom,r=C(()=>{const e=n+t.value;return{paddingBottom:e>0?e:0}});return E(x.View,{style:[e,r],children:o})};N.displayName="BottomSheet";const useMeasuredHeight=()=>{const[e,t]=c(0),o=n(e=>{t(t=>t===e?t:e)},[]);return[e,n(e=>o(e.nativeEvent.layout.height),[o]),o]},resolveSnapPoints=(e,t,o)=>[...e.map(e=>{if("number"==typeof e)return e;if("content"===e)return o;const n=parseFloat(e);return Number.isNaN(n)?0:n/100*t})].sort((e,t)=>e-t),clamp=(e,t,o)=>Math.min(Math.max(e,t),o),buildStyles=e=>p.create({backdropModal:{flex:1},backdropInline:{...p.absoluteFill},sheet:{position:"absolute",left:0,right:0,overflow:"hidden"},body:{overflow:"hidden"},handleRow:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",paddingTop:12,paddingBottom:24},header:{},footer:{},handle:{width:36,height:4,borderRadius:2,...O},content:{flex:1,overflow:"hidden"},modalRoot:{flex:1}});export{N as BottomSheet};export default N;
1
+ "use strict";import React,{createContext,forwardRef,useCallback,useContext,useEffect,useImperativeHandle,useMemo,useRef,useState}from"react";import{Dimensions,Modal,Platform,ScrollView,StyleSheet,useWindowDimensions,View}from"react-native";import{Gesture,GestureDetector,GestureHandlerRootView}from"react-native-gesture-handler";import{useReanimatedKeyboardAnimation}from"react-native-keyboard-controller";import Animated,{Easing,runOnJS,useAnimatedStyle,useDerivedValue,useSharedValue,withSpring,withTiming}from"react-native-reanimated";import{SafeAreaProvider,useSafeAreaInsets}from"react-native-safe-area-context";import{useTheme}from"../../theme/index.js";import{triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{ToastHost}from"../Toast/ToastProvider.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const TABLET_MIN_SHORT_SIDE=600,DIALOG_MAX_WIDTH=560,BottomSheetContext=createContext(null);export const useBottomSheet=()=>{const e=useContext(BottomSheetContext);if(!e)throw new Error("useBottomSheet must be used inside a <BottomSheet>.");return e};const SPRING_CONFIG={damping:20,stiffness:240,mass:1},CLOSE_VELOCITY_THRESHOLD=1e3,DRAG_ACTIVATION_OFFSET=10,BottomSheet=forwardRef((e,t)=>{const{snapPoints:o,index:s,onChange:n,onAnimate:a,onAfterClose:r,enablePanDownToClose:i=!0,enableBackdropPress:l=!0,scrollable:u=!1,scrollRef:c,onScroll:d,onContentSizeChange:h,onScrollLayout:m,scrollEventThrottle:b,keyboardBehavior:f="shift",mode:S="modal",presentation:g="sheet",handleIndicatorStyle:p,containerStyle:v,header:y,footer:w,headerStyle:x,footerStyle:C,children:k,accessibilityLabel:_,accessibilityViewIsModal:I,testID:R}=e,j=useTheme(),T=useSafeAreaInsets(),[M,O]=useState(()=>Dimensions.get("window").height),[V,D]=useState(()=>Dimensions.get("window").width),A=useCallback(e=>{const{height:t,width:o}=e.nativeEvent.layout;t>0&&O(e=>e===t?e:t),o>0&&D(e=>e===o?e:o)},[]),H=useWindowDimensions(),B="dialog"===g||"auto"===g&&Math.min(H.width,H.height)>=600,E=Math.min(560,V-2*j.spacing.xl),[P,G]=useState({top:T.top,bottom:T.bottom}),L="modal"===S?P.top:T.top,N="modal"===S?P.bottom:T.bottom,J=o.includes("content"),[F,z]=useMeasuredHeight(),[Y,$]=useMeasuredHeight(),[W,K,X]=useMeasuredHeight(),[q,U]=useMeasuredHeight(),Q=B?j.spacing.md:F,Z=J?Math.min(Q+(null!=y?Y:0)+W+(null!=w?q:0)+N,M-L):0,ee=useCallback((e,t)=>{J&&X(t),h?.(e,t)},[J,h,X]),te=useMemo(()=>resolveSnapPoints(o,M,Z),[o,M,Z]),oe=M,se=te[te.length-1]??0,ne=useSharedValue(oe),ae=useSharedValue(oe),re=useSharedValue(-1),[ie,le]=useState(-1),ue=useRef(!1),[ce,de]=useState(!1),[he,me]=useState(!1),be=useRef(!1),fe=useRef(r);fe.current=r;const[Se,ge]=useState(!1),pe=useCallback(e=>{if(e<0||e>=te.length)return oe;const t=te[e];return B?(M-t)/2:M-t},[te,M,oe,B]),ve=useCallback(e=>{ie!==e&&(le(e),re.value=e,n?.(e))},[ie,re,n]),ye=useCallback(()=>{ue.current=!1,re.value<0&&(be.current=!0,"modal"===S?(de(!1),"ios"!==Platform.OS&&me(!1)):ge(!1))},[S,re]),we=useCallback(()=>{be.current&&me(!1)},[]);useEffect(()=>{("modal"===S?!he:!Se)&&be.current&&(be.current=!1,fe.current?.())},[S,he,Se]);const xe=useCallback((e,t,o)=>{ue.current=!0,a?.(t,o),ne.value=withSpring(e,SPRING_CONFIG,e=>{"worklet";e&&runOnJS(ye)()})},[a,ne,ye]),Ce=useCallback(e=>{const t="number"==typeof e?clamp(e,0,te.length-1):ie>=0?ie:0,o=re.value,s=pe(t);be.current=!1,"modal"===S?(me(!0),de(!0)):ge(!0),o<0&&(ne.value=oe),ve(t),xe(s,o,t)},[xe,oe,ie,re,S,te.length,ve,ne,pe]),ke=useCallback(()=>{if(0===te.length)return;const e=re.value,t=pe(0);ve(0),xe(t,e,0)},[xe,re,te.length,ve,pe]),_e=useCallback(()=>{const e=re.value;ve(-1),ue.current=!0,a?.(e,-1),ne.value=withTiming(oe,{duration:j.motion.duration.fast,easing:Easing.bezier(...j.motion.easing.accelerate)},e=>{"worklet";e&&runOnJS(ye)()})},[oe,re,ye,a,ve,ne,j.motion.duration.fast,j.motion.easing.accelerate]);useImperativeHandle(t,()=>({expand:Ce,collapse:ke,close:_e}),[Ce,ke,_e]),useEffect(()=>{"number"==typeof s&&s!==ie&&(-1===s?_e():Ce(s))},[s]);const Ie=useRef({hostHeight:M,contentSnap:Z});useEffect(()=>{const e=Ie.current;e.hostHeight===M&&e.contentSnap===Z||(Ie.current={hostHeight:M,contentSnap:Z},e.hostHeight===M&&re.value<0||(ne.value=withSpring(pe(re.value),SPRING_CONFIG)))},[M,Z]);const Re=M-se,je=useMemo(()=>te.map(e=>M-e),[te,M]),Te=useCallback((e,t)=>{const o=re.value;if(-1===e)return triggerHaptic("selection"),ve(-1),ue.current=!0,a?.(o,-1),void(ne.value=withTiming(oe,{duration:j.motion.duration.fast,easing:Easing.bezier(...j.motion.easing.accelerate)},e=>{"worklet";e&&runOnJS(ye)()}));ve(e),xe(t,o,e)},[xe,oe,re,ye,a,ve,ne,j.motion.duration.fast,j.motion.easing.accelerate]),Me=useMemo(()=>Gesture.Native().withTestId(R?`${R}-content-gesture`:"bottom-sheet-content-gesture"),[R]),Oe=useMemo(()=>{const e=je,t=oe,o=Re,s=i;return Gesture.Pan().withTestId(R?`${R}-pan-gesture`:"bottom-sheet-pan-gesture").activeOffsetY([-10,10]).failOffsetX([-15,15]).onStart(()=>{"worklet";ae.value=ne.value}).onUpdate(e=>{"worklet";const t=ae.value+e.translationY;ne.value=t<o?o+.25*(t-o):t}).onEnd(o=>{"worklet";const n=ne.value;if(o.velocityY>1e3)return s?void runOnJS(Te)(-1,t):void runOnJS(Te)(0,e[0]);let a=0,r=Math.abs(n-e[0]);for(let t=1;t<e.length;t++){const o=Math.abs(n-e[t]);o<r&&(r=o,a=t)}const i=e[0];s&&n-i>80?runOnJS(Te)(-1,t):runOnJS(Te)(a,e[a])})},[oe,ae,i,Te,Re,je,R,ne]),{height:Ve}=useReanimatedKeyboardAnimation(),De="shift"===f,Ae=useDerivedValue(()=>De?Ve.value:0),He=te[ie>=0?ie:0]??se,Be=j.spacing.md,Ee=useAnimatedStyle(()=>{if(B){const e=Ae.value,t=M+e-He-Be,o=e<0&&ne.value>t?t:ne.value;return{top:o<L?L:o}}const e=ne.value+Ae.value,t=Ae.value<0?L:Re;return{top:e<t?t:e}}),Pe=useAnimatedStyle(()=>{const e=Ae.value;if(B){const t=M+e-He-Be,o=e<0&&ne.value>t?t:ne.value,s=M+e-Be-(o<L?L:o);return{height:s<0?0:s>He?He:s}}const t=e<0?L:Re,o=ne.value+e,s=M+e-(o<t?t:o);return{height:s<0?0:s>se?se:s}}),Ge=ie>=0,Le=useMemo(()=>buildStyles(j),[j]),Ne=useCallback(()=>{l&&(triggerHaptic("selection"),_e())},[l,_e]),Je=useMemo(()=>Gesture.Tap().withTestId(R?`${R}-backdrop-gesture`:"bottom-sheet-backdrop-gesture").maxDuration(250).onEnd((e,t)=>{"worklet";t&&runOnJS(Ne)()}),[Ne,R]),Fe=useMemo(()=>({snapIndex:ie,snapPoints:te,expand:Ce,collapse:ke,close:_e}),[ie,te,Ce,ke,_e]);if("inline"===S&&!Se)return null;if("modal"===S&&!he)return null;const ze=_jsxs(View,{collapsable:!1,style:["modal"===S?Le.backdropModal:Le.backdropInline,{backgroundColor:j.colors.background.overlay}],onLayout:A,testID:R,accessibilityViewIsModal:I??Ge,children:[_jsx(GestureDetector,{gesture:Je,children:_jsx(Animated.View,{style:StyleSheet.absoluteFill,accessibilityRole:"button",accessibilityLabel:"Close bottom sheet"})}),_jsx(Animated.View,{accessibilityRole:"alert",accessibilityLabel:_,accessibilityViewIsModal:I??Ge,style:[Le.sheet,{height:se,backgroundColor:j.colors.background.elevated,borderTopLeftRadius:j.radius["2xl"],borderTopRightRadius:j.radius["2xl"],...smoothCorners,...j.shadows.xl},B?{height:He,left:(V-E)/2,right:void 0,width:E,borderBottomLeftRadius:j.radius["2xl"],borderBottomRightRadius:j.radius["2xl"]}:null,v,Ee],children:_jsxs(SheetBody,{style:[Le.body,Pe],keyboardOffset:Ae,children:[B?_jsx(View,{style:{height:j.spacing.md}}):_jsx(GestureDetector,{gesture:Oe,children:_jsx(View,{style:Le.handleRow,onLayout:J?z:void 0,accessible:!0,accessibilityLabel:"Drag handle",accessibilityHint:"Drag up or down to resize the sheet, or swipe down to close it",testID:R?`${R}-handle`:"bottom-sheet-handle",children:_jsx(View,{style:[Le.handle,{backgroundColor:j.components.bottomSheet?.handleColor??j.colors.border.primary},p]})})}),null!=y&&_jsx(View,{style:[Le.header,x],onLayout:J?$:void 0,children:y}),u?_jsx(GestureDetector,{gesture:Me,children:_jsx(ScrollView,{ref:c,style:Le.content,onScroll:d,onContentSizeChange:ee,onLayout:m,scrollEventThrottle:b,keyboardShouldPersistTaps:"always",keyboardDismissMode:"none",children:k})}):_jsx(View,{style:Le.content,children:J?_jsx(View,{onLayout:K,children:k}):k}),null!=w&&_jsx(View,{style:[Le.footer,C],onLayout:J?U:void 0,children:w})]})})]}),Ye=_jsx(BottomSheetContext.Provider,{value:Fe,children:ze});return"modal"===S?_jsx(Modal,{transparent:!0,visible:ce,onRequestClose:_e,onDismiss:"ios"===Platform.OS?we:void 0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",supportedOrientations:["portrait","landscape"],children:_jsxs(SafeAreaProvider,{style:Le.modalRoot,children:[_jsx(InsetsProbe,{onChange:G}),"android"===Platform.OS?_jsx(GestureHandlerRootView,{style:Le.modalRoot,children:Ye}):Ye,_jsx(ToastHost,{})]})}):Ye}),InsetsProbe=({onChange:e})=>{const{top:t,bottom:o}=useSafeAreaInsets();return useEffect(()=>{e(e=>e.top===t&&e.bottom===o?e:{top:t,bottom:o})},[t,o,e]),null},SheetBody=({style:e,keyboardOffset:t,children:o})=>{const s=useSafeAreaInsets().bottom,n=useAnimatedStyle(()=>{const e=s+t.value;return{paddingBottom:e>0?e:0}});return _jsx(Animated.View,{style:[e,n],children:o})};BottomSheet.displayName="BottomSheet";const useMeasuredHeight=()=>{const[e,t]=useState(0),o=useCallback(e=>{t(t=>t===e?t:e)},[]);return[e,useCallback(e=>o(e.nativeEvent.layout.height),[o]),o]},resolveSnapPoints=(e,t,o)=>[...e.map(e=>{if("number"==typeof e)return e;if("content"===e)return o;const s=parseFloat(e);return Number.isNaN(s)?0:s/100*t})].sort((e,t)=>e-t),clamp=(e,t,o)=>Math.min(Math.max(e,t),o),buildStyles=e=>StyleSheet.create({backdropModal:{flex:1},backdropInline:{...StyleSheet.absoluteFill},sheet:{position:"absolute",left:0,right:0,overflow:"hidden"},body:{overflow:"hidden"},handleRow:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",paddingTop:12,paddingBottom:24},header:{},footer:{},handle:{width:36,height:4,borderRadius:2,...smoothCorners},content:{flex:1,overflow:"hidden"},modalRoot:{flex:1}});export{BottomSheet};export default BottomSheet;
@@ -1 +1 @@
1
- export{BottomSheet,default,useBottomSheet}from"./BottomSheet.js";
1
+ "use strict";export{BottomSheet,default,useBottomSheet}from"./BottomSheet.js";
@@ -1 +1 @@
1
- import r,{forwardRef as l}from"react";import{View as t}from"react-native";import{useTheme as o}from"../../theme/index.js";import{smoothCorners as e}from"../../utils/corners.js";import{SquircleFill as i,useSquircle as n}from"../SquircleFill/SquircleFill.js";import{jsx as a,jsxs as p}from"react/jsx-runtime";const space=(r,l)=>null==l?void 0:r.spacing[l];export const resolveBoxStyle=(r,l)=>{const t={};if(null!=l.p&&(t.padding=space(r,l.p)),null!=l.px&&(t.paddingHorizontal=space(r,l.px)),null!=l.py&&(t.paddingVertical=space(r,l.py)),null!=l.pt&&(t.paddingTop=space(r,l.pt)),null!=l.pr&&(t.paddingRight=space(r,l.pr)),null!=l.pb&&(t.paddingBottom=space(r,l.pb)),null!=l.pl&&(t.paddingLeft=space(r,l.pl)),null!=l.m&&(t.margin=space(r,l.m)),null!=l.mx&&(t.marginHorizontal=space(r,l.mx)),null!=l.my&&(t.marginVertical=space(r,l.my)),null!=l.mt&&(t.marginTop=space(r,l.mt)),null!=l.mr&&(t.marginRight=space(r,l.mr)),null!=l.mb&&(t.marginBottom=space(r,l.mb)),null!=l.ml&&(t.marginLeft=space(r,l.ml)),null!=l.gap&&(t.gap=space(r,l.gap)),null!=l.bg){const o=r.colors.background;t.backgroundColor=o[l.bg]??l.bg}return null!=l.radius&&(t.borderRadius=r.radius[l.radius],t.borderCurve=e.borderCurve),l.border&&(t.borderWidth=r.colors.border.width,t.borderColor=r.colors.border.primary),null!=l.flex&&(t.flex=l.flex),null!=l.align&&(t.alignItems=l.align),null!=l.justify&&(t.justifyContent=l.justify),null!=l.direction&&(t.flexDirection=l.direction),l.wrap&&(t.flexWrap="wrap"),t};const d=l((r,l)=>{const e=o(),{p:d,px:s,py:m,pt:u,pr:g,pb:c,pl:b,m:f,mx:y,my:x,mt:h,mr:j,mb:w,ml:C,gap:v,bg:k,radius:z,border:B,flex:R,align:S,justify:L,direction:W,wrap:D,style:I,children:N,...q}=r,F=resolveBoxStyle(e,{p:d,px:s,py:m,pt:u,pr:g,pb:c,pl:b,m:f,mx:y,my:x,mt:h,mr:j,mb:w,ml:C,gap:v,bg:k,radius:z,border:B,flex:R,align:S,justify:L,direction:W,wrap:D}),H=n(null!=z&&(null!=k||Boolean(B)),F.borderRadius,q.onLayout),T=H.active?{...F,backgroundColor:"transparent",borderColor:"transparent"}:F;return p(t,{ref:l,...q,onLayout:H.onLayout,style:[T,I],children:[H.active&&H.size?a(i,{width:H.size.width,height:H.size.height,radius:F.borderRadius,fill:F.backgroundColor??"transparent",stroke:F.borderColor,strokeWidth:F.borderWidth??0,outset:F.borderWidth??0}):null,N]})});d.displayName="Box";const s=l(({gap:r="md",...l},t)=>a(d,{ref:t,direction:"column",gap:r,...l}));s.displayName="Stack";const m=l(({gap:r="sm",align:l="center",...t},o)=>a(d,{ref:o,direction:"row",gap:r,align:l,...t}));m.displayName="Row";const Spacer=({size:r,style:l,testID:e})=>{const i=o();if(null!=r){const o=i.spacing[r];return a(t,{testID:e,style:[{width:o,height:o},l]})}return a(t,{testID:e,style:[{flex:1},l]})};Spacer.displayName="Spacer";export{d as Box,m as Row,Spacer,s as Stack};export default d;
1
+ "use strict";import React,{forwardRef}from"react";import{View}from"react-native";import{useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const space=(r,e)=>null==e?void 0:r.spacing[e];export const resolveBoxStyle=(r,e)=>{const l={};if(null!=e.p&&(l.padding=space(r,e.p)),null!=e.px&&(l.paddingHorizontal=space(r,e.px)),null!=e.py&&(l.paddingVertical=space(r,e.py)),null!=e.pt&&(l.paddingTop=space(r,e.pt)),null!=e.pr&&(l.paddingRight=space(r,e.pr)),null!=e.pb&&(l.paddingBottom=space(r,e.pb)),null!=e.pl&&(l.paddingLeft=space(r,e.pl)),null!=e.m&&(l.margin=space(r,e.m)),null!=e.mx&&(l.marginHorizontal=space(r,e.mx)),null!=e.my&&(l.marginVertical=space(r,e.my)),null!=e.mt&&(l.marginTop=space(r,e.mt)),null!=e.mr&&(l.marginRight=space(r,e.mr)),null!=e.mb&&(l.marginBottom=space(r,e.mb)),null!=e.ml&&(l.marginLeft=space(r,e.ml)),null!=e.gap&&(l.gap=space(r,e.gap)),null!=e.bg){const o=r.colors.background;l.backgroundColor=o[e.bg]??e.bg}return null!=e.radius&&(l.borderRadius=r.radius[e.radius],l.borderCurve=smoothCorners.borderCurve),e.border&&(l.borderWidth=r.colors.border.width,l.borderColor=r.colors.border.primary),null!=e.flex&&(l.flex=e.flex),null!=e.align&&(l.alignItems=e.align),null!=e.justify&&(l.justifyContent=e.justify),null!=e.direction&&(l.flexDirection=e.direction),e.wrap&&(l.flexWrap="wrap"),l};const Box=forwardRef((r,e)=>{const l=useTheme(),{p:o,px:t,py:a,pt:i,pr:s,pb:n,pl:p,m:c,mx:d,my:u,mt:m,mr:g,mb:x,ml:f,gap:b,bg:y,radius:h,border:w,flex:j,align:S,justify:R,direction:B,wrap:C,style:k,children:v,..._}=r,q=resolveBoxStyle(l,{p:o,px:t,py:a,pt:i,pr:s,pb:n,pl:p,m:c,mx:d,my:u,mt:m,mr:g,mb:x,ml:f,gap:b,bg:y,radius:h,border:w,flex:j,align:S,justify:R,direction:B,wrap:C}),z=useSquircle(null!=h&&(null!=y||Boolean(w)),q.borderRadius,_.onLayout),V=z.active?{...q,backgroundColor:"transparent",borderColor:"transparent"}:q;return _jsxs(View,{ref:e,..._,onLayout:z.onLayout,style:[V,k],children:[z.active&&z.size?_jsx(SquircleFill,{width:z.size.width,height:z.size.height,radius:q.borderRadius,fill:q.backgroundColor??"transparent",stroke:q.borderColor,strokeWidth:q.borderWidth??0,outset:q.borderWidth??0}):null,v]})});Box.displayName="Box";const Stack=forwardRef(({gap:r="md",...e},l)=>_jsx(Box,{ref:l,direction:"column",gap:r,...e}));Stack.displayName="Stack";const Row=forwardRef(({gap:r="sm",align:e="center",...l},o)=>_jsx(Box,{ref:o,direction:"row",gap:r,align:e,...l}));Row.displayName="Row";const Spacer=({size:r,style:e,testID:l})=>{const o=useTheme();if(null!=r){const t=o.spacing[r];return _jsx(View,{testID:l,style:[{width:t,height:t},e]})}return _jsx(View,{testID:l,style:[{flex:1},e]})};Spacer.displayName="Spacer";export{Box,Row,Spacer,Stack};export default Box;
@@ -1 +1 @@
1
- export{Box,Row,resolveBoxStyle,Spacer,Stack}from"./Box.js";
1
+ "use strict";export{Box,Row,resolveBoxStyle,Spacer,Stack}from"./Box.js";
@@ -1 +1 @@
1
- import e,{forwardRef as o,useMemo as r,useRef as t,useState as s}from"react";import{Animated as i,Easing as n,Pressable as l,StyleSheet as a,Text as d,View as c}from"react-native";import{useFlickGuard as u}from"../../hooks/useFlickGuard.js";import{usePressAnimation as b}from"../../hooks/usePressAnimation.js";import{fontFor as g,Gradient as p,useTheme as f}from"../../theme/index.js";import{createAnimatedValue as h}from"../../theme/animatedValue.js";import{ACCENT_PRESSED_TINT as m,tintOf as y}from"../../utils/color.js";import{smoothCorners as C}from"../../utils/corners.js";import{triggerHaptic as k}from"../../utils/hapticUtils.js";import{renderSlotIcon as x}from"../AppIcon/slotIcon.js";import{Spinner as z}from"../Spinner/index.js";import{SquircleFill as S,useSquircle as v}from"../SquircleFill/SquircleFill.js";import{jsx as I,jsxs as w,Fragment as R}from"react/jsx-runtime";const W=o((e,o)=>{const{title:m,children:y,variant:W="solid",tone:j="primary",size:F="md",loading:T=!1,disabled:D=!1,fullWidth:P=!1,leftIcon:A,rightIcon:B,iconVariant:O,leftIconBadge:E=!1,haptic:U="selection",rounded:q=!1,gradient:N,style:X,textStyle:G,pressAnimation:M,onPress:J,accessibilityLabel:K,accessibilityHint:Q,testID:Y,onLayout:Z,...$}=e,_=f(),ee=!D&&!T,oe="link"===W,re=M??(!oe&&"scale"),te=b({preset:re||"scale",enabled:!1!==re&&ee}),se=u(),ie=r(()=>buildStyles(_),[_]),ne={...H[F],..._.components.button?.[F]??{}},le=r(()=>toneFor(_,j),[_,j]),ae=r(()=>variantFor(_,W,le,D),[_,W,le,D]),de=r(()=>!N||D||"solid"!==W?null:"string"==typeof N?_.gradients[N]??null:N,[N,D,W,_.gradients]),ce=a.flatten(X)?.borderRadius,ue=oe?0:"number"==typeof ce?ce:q?_.radius.full:ne.borderRadius,be=v(!de&&"link"!==W,ue,Z),ge=t(h(0)).current,[pe,fe]=s(0),he=oe?e=>fe(e.nativeEvent.layout.width):void 0,me=K??m,ye="outline"===W||"ghost"===W,Ce=!ye&&!oe,ke={color:ae.textColor,size:ne.iconSize,disabled:D},xe=E&&!oe&&Boolean(A),ze=ne.minHeight-2*L-2*ae.borderWidth,Se={color:ae.badgeInk,size:ne.badgeIconSize??ne.iconSize,disabled:D},ve=I(c,{style:ie.contentRow,children:T?I(z,{variant:"circular",size:"sm",color:ae.textColor,accessibilityLabel:"Loading"}):w(R,{children:[xe?I(c,{testID:"button-icon-badge",style:[ie.iconLeft,ie.iconBadge,{width:ze,height:ze,borderRadius:ze/2,backgroundColor:ae.badgeFill}],children:x(A,Se,O)}):A?I(c,{style:ie.iconLeft,children:x(A,ke,O)}):null,m?w(c,{onLayout:he,children:[I(d,{style:[ie.label,{color:ae.textColor,fontSize:ne.fontSize,...g(_,"semibold")},G],numberOfLines:1,children:m}),oe?I(i.View,{pointerEvents:"none",testID:"button-link-underline",style:[ie.linkUnderline,{backgroundColor:ae.textColor,transform:[{translateX:ge.interpolate({inputRange:[0,1],outputRange:[-pe/2,0]})},{scaleX:ge.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}):y,B?I(c,{style:ie.iconRight,children:x(B,ke,O)}):null]})});return I(i.View,{style:[te.style,P?ie.fullWidth:null],children:I(l,{ref:o,onPress:e=>{ee&&!se.isFlick(e)&&(te.press(),!1!==U&&k(U),J?.(e))},onPressIn:e=>{se.onPressIn(e),te.pressIn(),oe&&ee&&(ge.stopAnimation(),ge.setValue(0),i.timing(ge,{toValue:1,duration:_.motion.duration.slower,easing:n.bezier(..._.motion.easing.decelerate),useNativeDriver:!0}).start())},onPressOut:()=>{te.pressOut()},disabled:!ee,hitSlop:oe?V:void 0,accessibilityRole:"button",accessibilityLabel:me,accessibilityHint:Q,accessibilityState:{disabled:!ee,busy:T},testID:Y,onLayout:be.onLayout,style:({pressed:e})=>[ie.base,{paddingHorizontal:oe?0:ne.paddingHorizontal,paddingVertical:oe?0:xe?L:ne.paddingVertical,paddingLeft:xe?L:void 0,minHeight:oe?void 0:ne.minHeight,borderRadius:ue,...C,backgroundColor:de||be.active?"transparent":ae.backgroundColor,borderWidth:ae.borderWidth,borderColor:be.active?"transparent":ae.borderColor,opacity:T?.55:1,overflow:be.active||oe?"visible":"hidden"},e&&ye&&!be.active?{backgroundColor:_.colors.surface.pressed}:null,P?ie.fullWidth:null,X],...$,children:({pressed:e})=>w(R,{children:[be.active&&be.size?I(S,{width:be.size.width,height:be.size.height,radius:ue,fill:e&&ye?_.colors.surface.pressed:ae.backgroundColor,stroke:ae.borderColor,strokeWidth:ae.borderWidth,outset:ae.borderWidth}):null,de?I(p,{gradient:de,style:[a.absoluteFill,{borderRadius:ue,...C}]}):null,e&&Ce?be.active&&be.size?I(S,{width:be.size.width,height:be.size.height,radius:ue,fill:ae.pressedTint,outset:ae.borderWidth,testID:"button-pressed"}):I(c,{pointerEvents:"none",style:[ie.pressedOverlay,{borderRadius:ue,backgroundColor:ae.pressedTint,...C}],testID:"button-pressed"}):null,ve]})})})});W.displayName="Button";const H={xs:{paddingHorizontal:10,paddingVertical:4,minHeight:28,fontSize:12,borderRadius:8,iconSize:14,badgeIconSize:11},sm:{paddingHorizontal:12,paddingVertical:6,minHeight:34,fontSize:14,borderRadius:10,iconSize:16},md:{paddingHorizontal:16,paddingVertical:9,minHeight:42,fontSize:16,borderRadius:12,iconSize:18},lg:{paddingHorizontal:20,paddingVertical:12,minHeight:50,fontSize:18,borderRadius:14,iconSize:20},xl:{paddingHorizontal:24,paddingVertical:14,minHeight:58,fontSize:20,borderRadius:16,iconSize:22}},j=.14,toneFor=(e,o)=>{switch(o){case"primary":return{base:e.colors.primary,on:e.colors.onPrimary,fg:e.colors.primary,soft:y(e.colors.primary,j,e.colors.primaryMuted)};case"secondary":return{base:e.colors.secondary,on:e.colors.onSecondary,fg:e.colors.onSecondary,soft:e.colors.secondary};case"success":return{base:e.colors.success,on:e.colors.onSuccess,fg:e.colors.success,soft:y(e.colors.success,j,e.colors.background.secondary)};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,fg:e.colors.warning,soft:y(e.colors.warning,j,e.colors.background.secondary)};case"error":return{base:e.colors.error,on:e.colors.onError,fg:e.colors.error,soft:y(e.colors.error,j,e.colors.background.secondary)};default:return{base:e.colors.background.tertiary,on:e.colors.text.primary,fg:e.colors.text.primary,soft:e.colors.background.secondary}}},L=4,V={top:8,bottom:8,left:8,right:8},variantFor=(e,o,r,t)=>{const s=t?e.colors.text.disabled:r.fg,i={badgeFill:e.colors.surface.disabled,badgeInk:e.colors.text.disabled},n=t?i:{badgeFill:r.on,badgeInk:r.base},l=t?i:{badgeFill:r.base,badgeInk:r.on};switch(o){case"solid":return{backgroundColor:t?e.colors.surface.disabled:r.base,borderColor:"transparent",borderWidth:1,textColor:t?e.colors.text.disabled:r.on,pressedTint:e.colors.surface.pressed,...n};case"soft":return{backgroundColor:t?e.colors.surface.disabled:r.soft,borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors.surface.pressed,...l};case"outline":return{backgroundColor:"transparent",borderColor:t?e.colors.border.primary:r.base,borderWidth:1,textColor:s,pressedTint:e.colors.surface.pressed,...l};case"ghost":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors.surface.pressed,...l};case"link":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:0,textColor:t?e.colors.text.disabled:e.colors.text.link,pressedTint:e.colors.surface.pressed,...l};case"glass":return{backgroundColor:e.colors.glass.fill,borderColor:e.colors.glass.border,borderWidth:1,textColor:t?e.colors.text.disabled:e.colors.glass.on,pressedTint:m,badgeFill:e.colors.glass.badge,badgeInk:t?e.colors.text.disabled:r.base};default:return{backgroundColor:r.base,borderColor:"transparent",borderWidth:1,textColor:r.on,pressedTint:e.colors.surface.pressed,...n}}},buildStyles=e=>a.create({pressedOverlay:{position:"absolute",top:0,right:0,bottom:0,left:0},base:{alignItems:"center",justifyContent:"center",flexDirection:"row",overflow:"hidden"},contentRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},linkUnderline:{height:1.5,marginTop:1},iconLeft:{marginRight:8},iconBadge:{alignItems:"center",justifyContent:"center"},iconRight:{marginLeft:8},fullWidth:{alignSelf:"stretch"}});export{W as Button};export default W;
1
+ "use strict";import React,{forwardRef,useMemo,useRef,useState}from"react";import{Animated,Easing,Pressable,StyleSheet,Text,View}from"react-native";import{useFlickGuard}from"../../hooks/useFlickGuard.js";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,Gradient,useTheme}from"../../theme/index.js";import{createAnimatedValue}from"../../theme/animatedValue.js";import{ACCENT_PRESSED_TINT,tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{triggerHaptic}from"../../utils/hapticUtils.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Spinner}from"../Spinner/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const Button=forwardRef((e,r)=>{const{title:o,children:t,variant:s="solid",tone:i="primary",size:n="md",loading:l=!1,disabled:a=!1,fullWidth:d=!1,leftIcon:c,rightIcon:u,iconVariant:b,leftIconBadge:g=!1,haptic:p="selection",rounded:m=!1,gradient:f,style:h,textStyle:y,pressAnimation:S,onPress:x,accessibilityLabel:C,accessibilityHint:I,testID:_,onLayout:k,...w}=e;if(__DEV__&&hasTextChild(t))throw new Error('[@webority/mobile-ui] Button was given its label as text children. Pass it as `title` (<Button title="Save" />): text children draw a blank button with no accessible name.');const z=useTheme(),j=!a&&!l,T="link"===s,R=S??(!T&&"scale"),v=usePressAnimation({preset:R||"scale",enabled:!1!==R&&j}),F=useFlickGuard(),V=useMemo(()=>buildStyles(z),[z]),E={...sizeMap[n],...z.components.button?.[n]??{}},A=useMemo(()=>toneFor(z,i),[z,i]),H=useMemo(()=>variantFor(z,s,A,a),[z,s,A,a]),L=useMemo(()=>!f||a||"solid"!==s?null:"string"==typeof f?z.gradients[f]??null:f,[f,a,s,z.gradients]),W=StyleSheet.flatten(h)?.borderRadius,D=T?0:"number"==typeof W?W:m?z.radius.full:E.borderRadius,P=useSquircle(!L&&"link"!==s,D,k),B=useRef(createAnimatedValue(0)).current,[O,N]=useState(0),G=T?e=>N(e.nativeEvent.layout.width):void 0,M=C??o,q="outline"===s||"ghost"===s,U=!q&&!T,K={color:H.textColor,size:E.iconSize,disabled:a},X=g&&!T&&Boolean(c),Y=E.minHeight-2*BADGE_INSET-2*H.borderWidth,J={color:H.badgeInk,size:E.badgeIconSize??E.iconSize,disabled:a},Q=_jsx(View,{style:V.contentRow,children:l?_jsx(Spinner,{variant:"circular",size:"sm",color:H.textColor,accessibilityLabel:"Loading"}):_jsxs(_Fragment,{children:[X?_jsx(View,{testID:"button-icon-badge",style:[V.iconLeft,V.iconBadge,{width:Y,height:Y,borderRadius:Y/2,backgroundColor:H.badgeFill}],children:renderSlotIcon(c,J,b)}):c?_jsx(View,{style:V.iconLeft,children:renderSlotIcon(c,K,b)}):null,o?_jsxs(View,{onLayout:G,children:[_jsx(Text,{style:[V.label,{color:H.textColor,fontSize:E.fontSize,...fontFor(z,"semibold")},y],numberOfLines:1,children:o}),T?_jsx(Animated.View,{pointerEvents:"none",testID:"button-link-underline",style:[V.linkUnderline,{backgroundColor:H.textColor,transform:[{translateX:B.interpolate({inputRange:[0,1],outputRange:[-O/2,0]})},{scaleX:B.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}):t,u?_jsx(View,{style:V.iconRight,children:renderSlotIcon(u,K,b)}):null]})});return _jsx(Animated.View,{style:[v.style,d?V.fullWidth:null],children:_jsx(Pressable,{ref:r,onPress:e=>{j&&!F.isFlick(e)&&(v.press(),!1!==p&&triggerHaptic(p),x?.(e))},onPressIn:e=>{F.onPressIn(e),v.pressIn(),T&&j&&(B.stopAnimation(),B.setValue(0),Animated.timing(B,{toValue:1,duration:z.motion.duration.slower,easing:Easing.bezier(...z.motion.easing.decelerate),useNativeDriver:!0}).start())},onPressOut:()=>{v.pressOut()},disabled:!j,hitSlop:T?LINK_HIT_SLOP:void 0,accessibilityRole:"button",accessibilityLabel:M,accessibilityHint:I,accessibilityState:{disabled:!j,busy:l},testID:_,onLayout:P.onLayout,style:({pressed:e})=>[V.base,{paddingHorizontal:T?0:E.paddingHorizontal,paddingVertical:T?0:X?BADGE_INSET:E.paddingVertical,paddingLeft:X?BADGE_INSET:void 0,minHeight:T?void 0:E.minHeight,borderRadius:D,...smoothCorners,backgroundColor:L||P.active?"transparent":H.backgroundColor,borderWidth:H.borderWidth,borderColor:P.active?"transparent":H.borderColor,opacity:l?.55:1,overflow:P.active||T?"visible":"hidden"},e&&q&&!P.active?{backgroundColor:z.colors.surface.pressed}:null,d?V.fullWidth:null,h],...w,children:({pressed:e})=>_jsxs(_Fragment,{children:[P.active&&P.size?_jsx(SquircleFill,{width:P.size.width,height:P.size.height,radius:D,fill:e&&q?z.colors.surface.pressed:H.backgroundColor,stroke:H.borderColor,strokeWidth:H.borderWidth,outset:H.borderWidth}):null,L?_jsx(Gradient,{gradient:L,style:[StyleSheet.absoluteFill,{borderRadius:D,...smoothCorners}]}):null,e&&U?P.active&&P.size?_jsx(SquircleFill,{width:P.size.width,height:P.size.height,radius:D,fill:H.pressedTint,outset:H.borderWidth,testID:"button-pressed"}):_jsx(View,{pointerEvents:"none",style:[V.pressedOverlay,{borderRadius:D,backgroundColor:H.pressedTint,...smoothCorners}],testID:"button-pressed"}):null,Q]})})})});Button.displayName="Button";const hasTextChild=e=>React.Children.toArray(e).some(e=>"string"==typeof e||"number"==typeof e),sizeMap={xs:{paddingHorizontal:10,paddingVertical:4,minHeight:28,fontSize:12,borderRadius:8,iconSize:14,badgeIconSize:11},sm:{paddingHorizontal:12,paddingVertical:6,minHeight:34,fontSize:14,borderRadius:10,iconSize:16},md:{paddingHorizontal:16,paddingVertical:9,minHeight:42,fontSize:16,borderRadius:12,iconSize:18},lg:{paddingHorizontal:20,paddingVertical:12,minHeight:50,fontSize:18,borderRadius:14,iconSize:20},xl:{paddingHorizontal:24,paddingVertical:14,minHeight:58,fontSize:20,borderRadius:16,iconSize:22}},SOFT_FILL_OPACITY=.14,toneFor=(e,r)=>{switch(r){case"primary":return{base:e.colors.primary,on:e.colors.onPrimary,fg:e.colors.primary,soft:tintOf(e.colors.primary,.14,e.colors.primaryMuted)};case"secondary":return{base:e.colors.secondary,on:e.colors.onSecondary,fg:e.colors.onSecondary,soft:e.colors.secondary};case"success":return{base:e.colors.success,on:e.colors.onSuccess,fg:e.colors.success,soft:tintOf(e.colors.success,.14,e.colors.background.secondary)};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,fg:e.colors.warning,soft:tintOf(e.colors.warning,.14,e.colors.background.secondary)};case"error":return{base:e.colors.error,on:e.colors.onError,fg:e.colors.error,soft:tintOf(e.colors.error,.14,e.colors.background.secondary)};default:return{base:e.colors.background.tertiary,on:e.colors.text.primary,fg:e.colors.text.primary,soft:e.colors.background.secondary}}},BADGE_INSET=4,BUTTON_BORDER_WIDTH=1,LINK_HIT_SLOP={top:8,bottom:8,left:8,right:8},variantFor=(e,r,o,t)=>{const s=t?e.colors.text.disabled:o.fg,i={badgeFill:e.colors.surface.disabled,badgeInk:e.colors.text.disabled},n=t?i:{badgeFill:o.on,badgeInk:o.base},l=t?i:{badgeFill:o.base,badgeInk:o.on};switch(r){case"solid":return{backgroundColor:t?e.colors.surface.disabled:o.base,borderColor:"transparent",borderWidth:1,textColor:t?e.colors.text.disabled:o.on,pressedTint:e.colors.surface.pressed,...n};case"soft":return{backgroundColor:t?e.colors.surface.disabled:o.soft,borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors.surface.pressed,...l};case"outline":return{backgroundColor:"transparent",borderColor:t?e.colors.border.primary:o.base,borderWidth:1,textColor:s,pressedTint:e.colors.surface.pressed,...l};case"ghost":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors.surface.pressed,...l};case"link":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:0,textColor:t?e.colors.text.disabled:e.colors.text.link,pressedTint:e.colors.surface.pressed,...l};case"glass":return{backgroundColor:e.colors.glass.fill,borderColor:e.colors.glass.border,borderWidth:1,textColor:t?e.colors.text.disabled:e.colors.glass.on,pressedTint:ACCENT_PRESSED_TINT,badgeFill:e.colors.glass.badge,badgeInk:t?e.colors.text.disabled:o.base};default:return{backgroundColor:o.base,borderColor:"transparent",borderWidth:1,textColor:o.on,pressedTint:e.colors.surface.pressed,...n}}},buildStyles=e=>StyleSheet.create({pressedOverlay:{position:"absolute",top:0,right:0,bottom:0,left:0},base:{alignItems:"center",justifyContent:"center",flexDirection:"row",overflow:"hidden"},contentRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},linkUnderline:{height:1.5,marginTop:1},iconLeft:{marginRight:8},iconBadge:{alignItems:"center",justifyContent:"center"},iconRight:{marginLeft:8},fullWidth:{alignSelf:"stretch"}});export{Button};export default Button;
@@ -1 +1 @@
1
- export{Button,default}from"./Button.js";
1
+ "use strict";export{Button,default}from"./Button.js";