@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,{forwardRef as o,useMemo as i}from"react";import{Animated as t,Image as r,Pressable as l,StyleSheet as a,View as s}from"react-native";import{useControllableState as n}from"../../hooks/useControllableState.js";import{usePressAnimation as d}from"../../hooks/usePressAnimation.js";import{Gradient as c,useTheme as h}from"../../theme/index.js";import{smoothCorners as u}from"../../utils/corners.js";import{resolveHaptic as p,triggerHaptic as b}from"../../utils/hapticUtils.js";import{supportsBoxShadow as m,toBoxShadow as g}from"../../utils/shadows.js";import{squircleHostRadius as y}from"../../utils/squircle.js";import{AppIcon as f}from"../AppIcon/AppIcon.js";import{Skeleton as v,SkeletonText as w}from"../Skeleton/index.js";import{SquircleFill as R,useSquircle as x}from"../SquircleFill/SquircleFill.js";import{Text as S}from"../Text/index.js";import{jsx as k,jsxs as C,Fragment as j}from"react/jsx-runtime";const L={none:"none",sm:"sm",md:"lg",lg:"xl",xl:"2xl"},P=o((e,o)=>{const{children:f,variant:v="elevated",elevation:w="sm",radius:P="lg",padding:z="md",interactive:B=!1,bg:I,header:W,title:H,lead:A,action:F,headerActions:T,collapsible:D=!1,collapsed:O,defaultCollapsed:N=!1,onCollapsedChange:q,collapsedSummary:V,onRemove:E,removeLabel:$="Remove",separatorHeight:M=a.hairlineWidth,footer:U,imageSource:_,imageHeight:G=160,imageAspectRatio:J,imageOverlay:K,loading:Q=!1,gradient:X,onPress:Y,haptic:Z,accessibilityLabel:ee,accessibilityHint:oe,accessibilityRole:ie,style:te,containerStyle:re,headerStyle:le,bodyStyle:ae,footerStyle:se,borderRadius:ne,testID:de,onLayout:ce,...he}=e,ue=h(),pe=B||"function"==typeof Y,{scale:be,pressIn:me,pressOut:ge}=d({enabled:pe}),ye=i(()=>buildStyles(ue),[ue]),fe=Boolean(_),ve=ue.spacing[L[z]],we=i(()=>X?"string"==typeof X?ue.gradients[X]??null:X:null,[X,ue.gradients]),Re="flat"===v,xe=Re?0:ne??ue.radius[P],Se=resolveBackground(ue,I),[ke,Ce]=n({value:O,defaultValue:N,onChange:q}),je=D&&ke,Le=hasBuiltInHeaderContent(e),Pe=Boolean(W)||Le,ze=x(!fe&&!we&&!Re,xe,ce),Be=a.flatten([te,re])??{},Ie=Be.backgroundColor,We=Be.borderColor,He=Ie??Se??("filled"===v?ue.colors.background.secondary:ue.colors.background.elevated),Ae="outlined"===v?ue.colors.border.width:0,Fe=We??ue.colors.border.primary,Te="elevated"===v&&m()?g(ue.shadows[w]):void 0,De=ze.active&&"elevated"===v&&!Te,Oe=ze.active&&!De?{backgroundColor:"transparent",borderColor:"transparent"}:null,Ne=i(()=>{const e={borderRadius:De&&ze.size?y(ze.size.width,ze.size.height,xe):xe,...u,padding:fe?0:ve,overflow:ze.active?"visible":"hidden"};switch(v){case"flat":return{...e,backgroundColor:Se??ue.colors.background.elevated,borderBottomWidth:M,borderBottomColor:ue.colors.border.primary};case"outlined":return{...e,backgroundColor:ze.active?"transparent":Se??ue.colors.background.elevated,borderWidth:ue.colors.border.width,borderColor:ze.active?"transparent":ue.colors.border.primary};case"filled":return{...e,backgroundColor:ze.active?"transparent":Se??ue.colors.background.secondary};default:return{...e,backgroundColor:Se??ue.colors.background.elevated,...Te?{boxShadow:Te}:ue.shadows[w]}}},[ue,v,w,xe,fe,ve,ze.active,ze.size,Te,De,Se,M]),qe=i(()=>({..."number"==typeof J?{width:"100%",aspectRatio:J}:{width:"100%",height:G},borderTopLeftRadius:xe,borderTopRightRadius:xe,borderBottomLeftRadius:0,borderBottomRightRadius:0,...u}),[xe,J,G]),Ve="string"==typeof H?H:"",Ee=C(j,{children:[C(s,{style:ye.titleColumn,children:["string"==typeof H?k(S,{variant:"title",accessibilityRole:"header",children:H}):H,A?k(S,{variant:"bodySmall",style:ye.lead,children:A}):null,je&&V?k(S,{variant:"caption",style:ye.lead,children:V}):null]}),isCardTextAction(F)?k(CardTextActionButton,{action:F,haptic:Z}):F?k(s,{style:ye.actionNode,children:F}):null,T,D?k(CardIconAction,{icon:je?"chevron-down":"chevron-up",label:`${je?"Show":"Hide"} ${Ve}`.trim(),expanded:!je,onPress:()=>Ce(!je),haptic:Z}):null,E?k(CardIconAction,{icon:"trash",label:$,onPress:E,color:ue.colors.error,haptic:Z}):null]}),$e=C(j,{children:[Pe?k(s,{style:[ye.header,!W&&ye.headerRow,je&&ye.headerFolded,le],children:W??Ee}):null,je?null:k(s,{style:[Pe||U?ye.body:null,ae],children:f}),U&&!je?k(s,{style:[ye.footer,se],children:U}):null]}),Me=fe?C(j,{children:[C(s,{style:ye.imageWrapper,children:[k(r,{source:_,resizeMode:"cover",style:qe,accessibilityLabel:"",accessible:!1}),K?k(s,{pointerEvents:"box-none",style:ye.imageOverlay,children:K}):null]}),k(s,{style:{padding:ve},children:$e})]}):$e,Ue=we?C(j,{children:[k(c,{gradient:we,style:a.absoluteFill}),Me]}):ze.active&&ze.size?C(j,{children:[k(R,{width:ze.size.width,height:ze.size.height,radius:xe,fill:He,stroke:Ae?Fe:void 0,strokeWidth:Ae,outset:Ae}),Me]}):Me;let _e;if(pe){const handlePress=e=>{const o=p(Z,"selection");o&&b(o),Y?.(e)};_e=k(t.View,{style:[{transform:[{scale:be}]}],children:k(l,{ref:o,onPress:handlePress,onPressIn:me,onPressOut:ge,android_ripple:{color:ue.colors.surface.pressed,borderless:!1},accessibilityRole:ie??"button",accessibilityLabel:ee,accessibilityHint:oe,testID:de,onLayout:ze.onLayout,style:[Ne,te,re,Oe],...he,children:Ue})})}else _e=k(s,{ref:o,accessibilityLabel:ee,accessibilityHint:oe,accessibilityRole:ie,testID:de,onLayout:ze.onLayout,style:[Ne,te,re,Oe],children:Ue});return Q?k(CardSkeleton,{...e}):_e});P.displayName="Card";const CardSkeleton=({variant:e="elevated",elevation:o,radius:i="lg",padding:t="md",bg:r,header:l,footer:a,imageSource:n,imageHeight:d=160,imageAspectRatio:c,borderRadius:p,containerStyle:b,headerStyle:m,bodyStyle:g,footerStyle:y,style:f,...R})=>{const x=h(),S=L[t],j=x.spacing[S],P="flat"===e?0:p??x.radius[i],z=void 0!==l||hasBuiltInHeaderContent(R),B=resolveBackground(x,r)??x.colors.background.elevated,I="outlined"===e?1:0,W="outlined"===e?x.colors.border.primary:void 0;return C(s,{style:[{backgroundColor:B,borderRadius:P,...u,borderWidth:I,borderColor:W,overflow:"hidden"},b,f],accessibilityRole:"progressbar",accessibilityState:{busy:!0},children:[void 0!==n?k(v,{width:"100%",height:c?void 0:d,style:c?{aspectRatio:c,width:"100%"}:void 0}):null,z?k(s,{style:[{padding:j,paddingBottom:x.spacing.sm},m],children:k(v,{shape:"text",width:"60%",height:18})}):null,k(s,{style:[{padding:j},g],children:k(w,{lines:3,fontSize:14,lastLineWidth:"55%"})}),void 0!==a?k(s,{style:[{padding:j,paddingTop:x.spacing.sm,flexDirection:"row"},y],children:k(v,{width:88,height:32,shape:"rounded"})}):null]})};CardSkeleton.displayName="CardSkeleton",P.Skeleton=CardSkeleton;const hasBuiltInHeaderContent=e=>Boolean(e.title||e.lead||e.action||e.headerActions||e.collapsible||e.onRemove),isCardTextAction=o=>"object"==typeof o&&null!==o&&!e.isValidElement(o)&&"label"in o&&"onPress"in o,CardIconAction=({icon:e,label:o,onPress:i,expanded:t,color:r,haptic:a})=>{const s=h();return k(l,{accessibilityRole:"button",accessibilityLabel:o,accessibilityState:void 0===t?void 0:{expanded:t},onPress:()=>{const e=p(a,"selection");e&&b(e),i()},style:z,children:k(f,{name:e,size:20,color:r??s.colors.text.primary})})},CardTextActionButton=({action:e,haptic:o})=>{const i=h();return k(l,{accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,onPress:()=>{const i=p(o,"selection");i&&b(i),e.onPress()},style:B,children:k(S,{variant:"label",weight:"semibold",color:i.colors.primary,children:e.label})})},z={width:44,height:44,alignItems:"center",justifyContent:"center"},B={minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},resolveBackground=(e,o)=>{if(null==o)return;return e.colors.background[o]??o},buildStyles=e=>a.create({header:{marginBottom:e.spacing.md},headerRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm},headerFolded:{marginBottom:0},titleColumn:{flex:1},lead:{marginTop:e.spacing.xs},actionNode:{flexShrink:0},body:{flexShrink:1},footer:{marginTop:e.spacing.md},imageWrapper:{position:"relative"},imageOverlay:{...a.absoluteFill}});export{P as Card};export default P;
1
+ "use strict";import React,{forwardRef,useMemo}from"react";import{Animated,Image,Pressable,StyleSheet,View}from"react-native";import{useControllableState}from"../../hooks/useControllableState.js";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{Gradient,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{supportsBoxShadow,toBoxShadow}from"../../utils/shadows.js";import{squircleHostRadius}from"../../utils/squircle.js";import{AppIcon}from"../AppIcon/AppIcon.js";import{Skeleton,SkeletonText}from"../Skeleton/index.js";import{SquircleFill,useSquircle}from"../SquircleFill/SquircleFill.js";import{Text}from"../Text/index.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const paddingMap={none:"none",sm:"sm",md:"lg",lg:"xl",xl:"2xl"},Card=forwardRef((e,t)=>{const{children:o,variant:i="elevated",elevation:r="sm",radius:s="lg",padding:l="md",interactive:a=!1,bg:n,header:d,title:c,lead:u,action:h,headerActions:p,collapsible:m=!1,collapsed:g,defaultCollapsed:b=!1,onCollapsedChange:y,collapsedSummary:x,onRemove:S,removeLabel:f="Remove",separatorHeight:v=StyleSheet.hairlineWidth,footer:j,imageSource:C,imageHeight:_=160,imageAspectRatio:w,imageOverlay:k,loading:R=!1,gradient:A,onPress:T,haptic:B,accessibilityLabel:H,accessibilityHint:I,accessibilityRole:P,style:V,containerStyle:L,headerStyle:F,bodyStyle:z,footerStyle:q,borderRadius:M,testID:W,onLayout:D,...O}=e,N=useTheme(),E=a||"function"==typeof T,{scale:G,pressIn:$,pressOut:U}=usePressAnimation({enabled:E}),J=useMemo(()=>buildStyles(N),[N]),K=Boolean(C),Q=N.spacing[paddingMap[l]],X=useMemo(()=>A?"string"==typeof A?N.gradients[A]??null:A:null,[A,N.gradients]),Y="flat"===i,Z=Y?0:M??N.radius[s],ee=resolveBackground(N,n),[te,oe]=useControllableState({value:g,defaultValue:b,onChange:y}),ie=m&&te,re=hasBuiltInHeaderContent(e),se=Boolean(d)||re,le=useSquircle(!K&&!X&&!Y,Z,D),ae=StyleSheet.flatten([V,L])??{},ne=ae.backgroundColor,de=ae.borderColor,ce=ne??ee??("filled"===i?N.colors.background.secondary:N.colors.background.elevated),ue="outlined"===i?N.colors.border.width:0,he=de??N.colors.border.primary,pe="elevated"===i&&supportsBoxShadow()?toBoxShadow(N.shadows[r]):void 0,me=le.active&&"elevated"===i&&!pe,ge=le.active&&!me?{backgroundColor:"transparent",borderColor:"transparent"}:null,be=useMemo(()=>{const e={borderRadius:me&&le.size?squircleHostRadius(le.size.width,le.size.height,Z):Z,...smoothCorners,padding:K?0:Q,overflow:le.active?"visible":"hidden"};switch(i){case"flat":return{...e,backgroundColor:ee??N.colors.background.elevated,borderBottomWidth:v,borderBottomColor:N.colors.border.primary};case"outlined":return{...e,backgroundColor:le.active?"transparent":ee??N.colors.background.elevated,borderWidth:N.colors.border.width,borderColor:le.active?"transparent":N.colors.border.primary};case"filled":return{...e,backgroundColor:le.active?"transparent":ee??N.colors.background.secondary};default:return{...e,backgroundColor:ee??N.colors.background.elevated,...pe?{boxShadow:pe}:N.shadows[r]}}},[N,i,r,Z,K,Q,le.active,le.size,pe,me,ee,v]),ye=useMemo(()=>({..."number"==typeof w?{width:"100%",aspectRatio:w}:{width:"100%",height:_},borderTopLeftRadius:Z,borderTopRightRadius:Z,borderBottomLeftRadius:0,borderBottomRightRadius:0,...smoothCorners}),[Z,w,_]),xe="string"==typeof c?c:"",Se=_jsxs(_Fragment,{children:[_jsxs(View,{style:J.titleColumn,children:["string"==typeof c?_jsx(Text,{variant:"title",accessibilityRole:"header",children:c}):c,u?_jsx(Text,{variant:"bodySmall",style:J.lead,children:u}):null,ie&&x?_jsx(Text,{variant:"caption",style:J.lead,children:x}):null]}),isCardTextAction(h)?_jsx(CardTextActionButton,{action:h,haptic:B}):h?_jsx(View,{style:J.actionNode,children:h}):null,p,m?_jsx(CardIconAction,{icon:ie?"chevron-down":"chevron-up",label:`${ie?"Show":"Hide"} ${xe}`.trim(),expanded:!ie,onPress:()=>oe(!ie),haptic:B}):null,S?_jsx(CardIconAction,{icon:"trash",label:f,onPress:S,color:N.colors.error,haptic:B}):null]}),fe=_jsxs(_Fragment,{children:[se?_jsx(View,{style:[J.header,!d&&J.headerRow,ie&&J.headerFolded,F],children:d??Se}):null,ie?null:_jsx(View,{style:[se||j?J.body:null,z],children:o}),j&&!ie?_jsx(View,{style:[J.footer,q],children:j}):null]}),ve=K?_jsxs(_Fragment,{children:[_jsxs(View,{style:J.imageWrapper,children:[_jsx(Image,{source:C,resizeMode:"cover",style:ye,accessibilityLabel:"",accessible:!1}),k?_jsx(View,{pointerEvents:"box-none",style:J.imageOverlay,children:k}):null]}),_jsx(View,{style:{padding:Q},children:fe})]}):fe,je=X?_jsxs(_Fragment,{children:[_jsx(Gradient,{gradient:X,style:StyleSheet.absoluteFill}),ve]}):le.active&&le.size?_jsxs(_Fragment,{children:[_jsx(SquircleFill,{width:le.size.width,height:le.size.height,radius:Z,fill:ce,stroke:ue?he:void 0,strokeWidth:ue,outset:ue}),ve]}):ve;let Ce;if(E){const handlePress=e=>{const t=resolveHaptic(B,"selection");t&&triggerHaptic(t),T?.(e)};Ce=_jsx(Animated.View,{style:[{transform:[{scale:G}]}],children:_jsx(Pressable,{ref:t,onPress:handlePress,onPressIn:$,onPressOut:U,android_ripple:{color:N.colors.surface.pressed,borderless:!1},accessibilityRole:P??"button",accessibilityLabel:H,accessibilityHint:I,testID:W,onLayout:le.onLayout,style:[be,V,L,ge],...O,children:je})})}else Ce=_jsx(View,{ref:t,accessibilityLabel:H,accessibilityHint:I,accessibilityRole:P,testID:W,onLayout:le.onLayout,style:[be,V,L,ge],children:je});return R?_jsx(CardSkeleton,{...e}):Ce});Card.displayName="Card";const CardSkeleton=({variant:e="elevated",elevation:t,radius:o="lg",padding:i="md",bg:r,header:s,footer:l,imageSource:a,imageHeight:n=160,imageAspectRatio:d,borderRadius:c,containerStyle:u,headerStyle:h,bodyStyle:p,footerStyle:m,style:g,...b})=>{const y=useTheme(),x=paddingMap[i],S=y.spacing[x],f="flat"===e?0:c??y.radius[o],v=void 0!==s||hasBuiltInHeaderContent(b),j=resolveBackground(y,r)??y.colors.background.elevated,C="outlined"===e?1:0,_="outlined"===e?y.colors.border.primary:void 0;return _jsxs(View,{style:[{backgroundColor:j,borderRadius:f,...smoothCorners,borderWidth:C,borderColor:_,overflow:"hidden"},u,g],accessibilityRole:"progressbar",accessibilityState:{busy:!0},children:[void 0!==a?_jsx(Skeleton,{width:"100%",height:d?void 0:n,style:d?{aspectRatio:d,width:"100%"}:void 0}):null,v?_jsx(View,{style:[{padding:S,paddingBottom:y.spacing.sm},h],children:_jsx(Skeleton,{shape:"text",width:"60%",height:18})}):null,_jsx(View,{style:[{padding:S},p],children:_jsx(SkeletonText,{lines:3,fontSize:14,lastLineWidth:"55%"})}),void 0!==l?_jsx(View,{style:[{padding:S,paddingTop:y.spacing.sm,flexDirection:"row"},m],children:_jsx(Skeleton,{width:88,height:32,shape:"rounded"})}):null]})};CardSkeleton.displayName="CardSkeleton",Card.Skeleton=CardSkeleton;const hasBuiltInHeaderContent=e=>Boolean(e.title||e.lead||e.action||e.headerActions||e.collapsible||e.onRemove),isCardTextAction=e=>"object"==typeof e&&null!==e&&!React.isValidElement(e)&&"label"in e&&"onPress"in e,HIT_TARGET=44,CardIconAction=({icon:e,label:t,onPress:o,expanded:i,color:r,haptic:s})=>{const l=useTheme();return _jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:t,accessibilityState:void 0===i?void 0:{expanded:i},onPress:()=>{const e=resolveHaptic(s,"selection");e&&triggerHaptic(e),o()},style:iconActionStyle,children:_jsx(AppIcon,{name:e,size:20,color:r??l.colors.text.primary})})},CardTextActionButton=({action:e,haptic:t})=>{const o=useTheme();return _jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,onPress:()=>{const o=resolveHaptic(t,"selection");o&&triggerHaptic(o),e.onPress()},style:textActionStyle,children:_jsx(Text,{variant:"label",weight:"semibold",color:o.colors.primary,children:e.label})})},iconActionStyle={width:44,height:44,alignItems:"center",justifyContent:"center"},textActionStyle={minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},resolveBackground=(e,t)=>{if(null==t)return;return e.colors.background[t]??t},buildStyles=e=>StyleSheet.create({header:{marginBottom:e.spacing.md},headerRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.sm},headerFolded:{marginBottom:0},titleColumn:{flex:1},lead:{marginTop:e.spacing.xs},actionNode:{flexShrink:0},body:{flexShrink:1},footer:{marginTop:e.spacing.md},imageWrapper:{position:"relative"},imageOverlay:{...StyleSheet.absoluteFill}});export{Card};export default Card;
@@ -1 +1 @@
1
- export{Card,default}from"./Card.js";
1
+ "use strict";export{Card,default}from"./Card.js";
@@ -1 +1 @@
1
- import e,{forwardRef as t,useCallback as n,useEffect as r,useImperativeHandle as i,useMemo as o,useRef as a,useState as l}from"react";import{Animated as c,Dimensions as s,FlatList as d,Image as h,Pressable as u,ScrollView as m,StyleSheet as g,Text as y,View as p}from"react-native";import{createAnimatedValue as b,useTheme as f}from"../../theme/index.js";import{resolveHaptic as x,triggerHaptic as w}from"../../utils/index.js";import{smoothCorners as v}from"../../utils/corners.js";import{Skeleton as S}from"../Skeleton/index.js";import{jsx as I,jsxs as T}from"react/jsx-runtime";const z=t((e,t)=>{const{data:h,renderItem:u,keyExtractor:m,index:g,defaultIndex:y=0,onIndexChange:v,autoPlay:S=!1,autoPlayInterval:z=4e3,loop:R=!1,showPagination:j=!0,paginationStyle:C="dots",itemWidth:E="screen",spacing:A=0,containerStyle:W,accessibilityLabel:k,testID:H,showThumbnails:D=!1,haptic:M,renderThumbnail:$,loading:P=!1}=e,V=f(),L="number"==typeof g,N=R||S,[O,F]=l(()=>s.get("window").width),X="screen"===E?O:E,B=X+A,G=a(null),q=a(b(0)).current,J=clamp(L?g:y,0,Math.max(0,h.length-1)),[K,Q]=l(J),U=a(null),Y=a(null),Z=a(!1),_=a(K);_.current=K;const ee=n(e=>{const t=clamp(e,0,Math.max(0,h.length-1));Q(e=>e===t?e:(v?.(t),t))},[h.length,v]),te=n((e,t=!0)=>{if(0===h.length)return;const n=clamp(e,0,h.length-1);G.current?.scrollToOffset({offset:n*B,animated:t}),ee(n)},[h.length,B,ee]),ne=n(()=>{if(0===h.length)return;const e=_.current+1;e>=h.length?N&&te(0,!1):te(e,!0)},[h.length,N,te]),re=n(()=>{if(0===h.length)return;const e=_.current-1;e<0?N&&te(h.length-1,!1):te(e,!0)},[h.length,N,te]);i(t,()=>({scrollTo:te,next:ne,prev:re}),[te,ne,re]),r(()=>{L&&g!==K&&te(g,!0)},[g]);const ie=n(()=>{U.current&&(clearInterval(U.current),U.current=null)},[]),oe=n(()=>{!S||h.length<=1||(ie(),U.current=setInterval(()=>{if(Z.current)return;const e=_.current+1;e>=h.length?te(0,!1):te(e,!0)},z))},[S,z,h.length,te,ie]);r(()=>(oe(),()=>{ie(),Y.current&&clearTimeout(Y.current)}),[oe,ie]);const ae=j&&h.length>1&&"numbers"!==C,le=o(()=>c.event([{nativeEvent:{contentOffset:{x:q}}}],{useNativeDriver:!1}),[q]),ce=n(e=>{if(B<=0)return;const t=e.nativeEvent.contentOffset.x,n=Math.round(t/B);ee(n)},[B,ee]),se=n(()=>{Z.current=!0,ie(),Y.current&&(clearTimeout(Y.current),Y.current=null)},[ie]),de=n(()=>{Z.current=!1,S&&(Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{oe()},1e3))},[S,oe]),he=n(e=>{switch(e.nativeEvent.actionName){case"increment":ne();break;case"decrement":re()}},[ne,re]),ue=o(()=>buildStyles(V),[V]),me=n(({item:e,index:t})=>I(p,{style:{width:X,marginRight:t===h.length-1?0:A},accessibilityElementsHidden:t!==K,importantForAccessibility:t===K?"yes":"no-hide-descendants",children:u(e,t)}),[u,X,A,h.length,K]),ge=n((e,t)=>String(t),[]),ye=n((e,t)=>({length:B,offset:B*t,index:t}),[B]);return P?I(CarouselSkeleton,{...e,containerWidth:O}):T(p,{style:[ue.container,W],onLayout:e=>F(e.nativeEvent.layout.width),accessibilityRole:"adjustable",accessibilityLabel:k??"Carousel",accessibilityValue:{min:0,max:Math.max(0,h.length-1),now:K,text:`Slide ${K+1} of ${h.length}`},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:he,testID:H,children:[I(d,{ref:G,data:h,keyExtractor:m??ge,renderItem:me,horizontal:!0,pagingEnabled:"screen"===E&&0===A,snapToInterval:B,snapToAlignment:"start",decelerationRate:"fast",showsHorizontalScrollIndicator:!1,onScroll:ae?le:void 0,scrollEventThrottle:ae?16:void 0,onMomentumScrollEnd:ce,onScrollBeginDrag:se,onScrollEndDrag:de,getItemLayout:ye,initialScrollIndex:J,bounces:!1}),j&&h.length>1?I(Pagination,{count:h.length,currentIndex:K,scrollX:q,slideStride:B,variant:C,theme:V}):null,D&&h.length>0?I(ThumbnailStrip,{data:h,currentIndex:K,renderThumbnail:$,onSelect:e=>{const t=x(M,"selection");t&&w(t),te(e,!0)},theme:V}):null]})});z.displayName="Carousel";const CarouselSkeleton=({itemWidth:e="screen",showPagination:t=!0,paginationStyle:n="dots",containerStyle:r,containerWidth:i})=>{const o="screen"===e?i||320:e;return T(p,{style:[R.container,r],children:[I(S,{width:o,height:160,radius:"md"}),t?I(p,{style:[R.paginationRow,{marginTop:12}],children:Array.from({length:3}).map((e,t)=>I(S,"numbers"===n?{width:24,height:16,radius:"sm",style:{marginHorizontal:4}}:"bars"===n?{width:20,height:4,radius:2,style:{marginHorizontal:3}}:{shape:"circle",width:8,height:8,style:{marginHorizontal:4}},`sk-pg-${t}`))}):null]})};CarouselSkeleton.displayName="CarouselSkeleton";const R=g.create({container:{alignItems:"center"},paginationRow:{flexDirection:"row",justifyContent:"center"}}),j=z;j.Skeleton=CarouselSkeleton;const Pagination=({count:e,currentIndex:t,scrollX:n,slideStride:r,variant:i,theme:o})=>{if("numbers"===i)return I(p,{style:E.numbersWrap,children:I(y,{style:[E.numbersText,{color:o.colors.text.secondary,fontSize:o.typography.fontSize.sm,fontWeight:o.typography.fontWeight.medium}],accessibilityLabel:`Slide ${t+1} of ${e}`,children:`${t+1} / ${e}`})});const a=Array.from({length:e},(e,t)=>t),l="bars"===i,s=l?24:6,d=l?36:16,h=l?3:6;return I(p,{style:E.dotRow,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:a.map(e=>{const i=[(e-1)*r,e*r,(e+1)*r],a=n.interpolate({inputRange:i,outputRange:[s,d,s],extrapolate:"clamp"}),l=n.interpolate({inputRange:i,outputRange:[.5,1,.5],extrapolate:"clamp"});return I(c.View,{style:[{width:a,height:h,marginHorizontal:4,borderRadius:h/2,...v,backgroundColor:e===t?o.colors.primary:o.colors.border.primary,opacity:l}]},e)})})},ThumbnailStrip=({data:e,currentIndex:t,renderThumbnail:n,onSelect:r,theme:i})=>I(m,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:C.row,accessibilityRole:"tablist",children:e.map((e,o)=>I(ThumbnailItem,{item:e,index:o,isActive:o===t,renderThumbnail:n,onPress:()=>r(o),theme:i},o))}),ThumbnailItem=({item:e,index:t,isActive:n,renderThumbnail:i,onPress:l,theme:s})=>{const d=a(b(n?1.1:1)).current;r(()=>{const e=c.spring(d,{toValue:n?1.1:1,useNativeDriver:!0,friction:6,tension:80});return e.start(),()=>e.stop()},[n,d]);const m=o(()=>i?i(e,t):e&&"object"==typeof e&&"uri"in e&&"string"==typeof e.uri?I(h,{source:{uri:e.uri},style:C.image,resizeMode:"cover"}):I(p,{style:[C.placeholder,{backgroundColor:s.colors.background.secondary}],children:I(y,{style:{color:s.colors.text.secondary,fontSize:s.typography.fontSize.xs,fontWeight:s.typography.fontWeight.semibold},children:t+1})}),[e,t,i,s]);return I(u,{onPress:l,accessibilityRole:"tab",accessibilityState:{selected:n},accessibilityLabel:`Go to slide ${t+1}`,children:I(c.View,{style:[C.thumb,{borderColor:n?s.colors.primary:"transparent",transform:[{scale:d}]}],children:m})})},C=g.create({row:{flexDirection:"row",alignItems:"center",paddingHorizontal:8,paddingVertical:8},thumb:{width:40,height:40,marginHorizontal:4,borderRadius:6,...v,borderWidth:2,overflow:"hidden"},image:{width:"100%",height:"100%"},placeholder:{flex:1,alignItems:"center",justifyContent:"center"}}),clamp=(e,t,n)=>Math.min(Math.max(e,t),n),buildStyles=e=>g.create({container:{width:"100%"}}),E=g.create({dotRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12},numbersWrap:{alignItems:"center",justifyContent:"center",paddingVertical:12},numbersText:{textAlign:"center"}});export{j as Carousel};export default j;
1
+ "use strict";import React,{forwardRef,useCallback,useEffect,useImperativeHandle,useMemo,useRef,useState}from"react";import{Animated,Dimensions,FlatList,Image,Pressable,ScrollView,StyleSheet,Text,View}from"react-native";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/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 CarouselInner=forwardRef((e,t)=>{const{data:n,renderItem:r,keyExtractor:i,index:a,defaultIndex:l=0,onIndexChange:s,autoPlay:o=!1,autoPlayInterval:c=4e3,loop:u=!1,showPagination:m=!0,paginationStyle:d="dots",itemWidth:h="screen",spacing:g=0,containerStyle:y,accessibilityLabel:p,testID:b,showThumbnails:f=!1,haptic:x,renderThumbnail:S,loading:w=!1}=e,C=useTheme(),j="number"==typeof a,k=u||o,[v,I]=useState(()=>Dimensions.get("window").width),T="screen"===h?v:h,R=T+g,_=useRef(null),V=useRef(createAnimatedValue(0)).current,A=clamp(j?a:l,0,Math.max(0,n.length-1)),[E,H]=useState(A),z=useRef(null),M=useRef(null),D=useRef(!1),P=useRef(E);P.current=E;const W=useCallback(e=>{const t=clamp(e,0,Math.max(0,n.length-1));H(e=>e===t?e:(s?.(t),t))},[n.length,s]),L=useCallback((e,t=!0)=>{if(0===n.length)return;const r=clamp(e,0,n.length-1);_.current?.scrollToOffset({offset:r*R,animated:t}),W(r)},[n.length,R,W]),$=useCallback(()=>{if(0===n.length)return;const e=P.current+1;e>=n.length?k&&L(0,!1):L(e,!0)},[n.length,k,L]),N=useCallback(()=>{if(0===n.length)return;const e=P.current-1;e<0?k&&L(n.length-1,!1):L(e,!0)},[n.length,k,L]);useImperativeHandle(t,()=>({scrollTo:L,next:$,prev:N}),[L,$,N]),useEffect(()=>{j&&a!==E&&L(a,!0)},[a]);const F=useCallback(()=>{z.current&&(clearInterval(z.current),z.current=null)},[]),O=useCallback(()=>{!o||n.length<=1||(F(),z.current=setInterval(()=>{if(D.current)return;const e=P.current+1;e>=n.length?L(0,!1):L(e,!0)},c))},[o,c,n.length,L,F]);useEffect(()=>(O(),()=>{F(),M.current&&clearTimeout(M.current)}),[O,F]);const X=m&&n.length>1&&"numbers"!==d,B=useMemo(()=>Animated.event([{nativeEvent:{contentOffset:{x:V}}}],{useNativeDriver:!1}),[V]),G=useCallback(e=>{if(R<=0)return;const t=e.nativeEvent.contentOffset.x,n=Math.round(t/R);W(n)},[R,W]),q=useCallback(()=>{D.current=!0,F(),M.current&&(clearTimeout(M.current),M.current=null)},[F]),J=useCallback(()=>{D.current=!1,o&&(M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{O()},1e3))},[o,O]),K=useCallback(e=>{switch(e.nativeEvent.actionName){case"increment":$();break;case"decrement":N()}},[$,N]),Q=useMemo(()=>buildStyles(C),[C]),U=useCallback(({item:e,index:t})=>_jsx(View,{style:{width:T,marginRight:t===n.length-1?0:g},accessibilityElementsHidden:t!==E,importantForAccessibility:t===E?"yes":"no-hide-descendants",children:r(e,t)}),[r,T,g,n.length,E]),Y=useCallback((e,t)=>String(t),[]),Z=useCallback((e,t)=>({length:R,offset:R*t,index:t}),[R]);return w?_jsx(CarouselSkeleton,{...e,containerWidth:v}):_jsxs(View,{style:[Q.container,y],onLayout:e=>I(e.nativeEvent.layout.width),accessibilityRole:"adjustable",accessibilityLabel:p??"Carousel",accessibilityValue:{min:0,max:Math.max(0,n.length-1),now:E,text:`Slide ${E+1} of ${n.length}`},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:K,testID:b,children:[_jsx(FlatList,{ref:_,data:n,keyExtractor:i??Y,renderItem:U,horizontal:!0,pagingEnabled:"screen"===h&&0===g,snapToInterval:R,snapToAlignment:"start",decelerationRate:"fast",showsHorizontalScrollIndicator:!1,onScroll:X?B:void 0,scrollEventThrottle:X?16:void 0,onMomentumScrollEnd:G,onScrollBeginDrag:q,onScrollEndDrag:J,getItemLayout:Z,initialScrollIndex:A,bounces:!1}),m&&n.length>1?_jsx(Pagination,{count:n.length,currentIndex:E,scrollX:V,slideStride:R,variant:d,theme:C}):null,f&&n.length>0?_jsx(ThumbnailStrip,{data:n,currentIndex:E,renderThumbnail:S,onSelect:e=>{const t=resolveHaptic(x,"selection");t&&triggerHaptic(t),L(e,!0)},theme:C}):null]})});CarouselInner.displayName="Carousel";const CarouselSkeleton=({itemWidth:e="screen",showPagination:t=!0,paginationStyle:n="dots",containerStyle:r,containerWidth:i})=>{const a="screen"===e?i||320:e;return _jsxs(View,{style:[carouselSkeletonStyles.container,r],children:[_jsx(Skeleton,{width:a,height:160,radius:"md"}),t?_jsx(View,{style:[carouselSkeletonStyles.paginationRow,{marginTop:12}],children:Array.from({length:3}).map((e,t)=>_jsx(Skeleton,"numbers"===n?{width:24,height:16,radius:"sm",style:{marginHorizontal:4}}:"bars"===n?{width:20,height:4,radius:2,style:{marginHorizontal:3}}:{shape:"circle",width:8,height:8,style:{marginHorizontal:4}},`sk-pg-${t}`))}):null]})};CarouselSkeleton.displayName="CarouselSkeleton";const carouselSkeletonStyles=StyleSheet.create({container:{alignItems:"center"},paginationRow:{flexDirection:"row",justifyContent:"center"}}),Carousel=CarouselInner;Carousel.Skeleton=CarouselSkeleton;const Pagination=({count:e,currentIndex:t,scrollX:n,slideStride:r,variant:i,theme:a})=>{if("numbers"===i)return _jsx(View,{style:paginationStyles.numbersWrap,children:_jsx(Text,{style:[paginationStyles.numbersText,{color:a.colors.text.secondary,fontSize:a.typography.fontSize.sm,fontWeight:a.typography.fontWeight.medium}],accessibilityLabel:`Slide ${t+1} of ${e}`,children:`${t+1} / ${e}`})});const l=Array.from({length:e},(e,t)=>t),s="bars"===i,o=s?24:6,c=s?36:16,u=s?3:6;return _jsx(View,{style:paginationStyles.dotRow,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:l.map(e=>{const i=[(e-1)*r,e*r,(e+1)*r],l=n.interpolate({inputRange:i,outputRange:[o,c,o],extrapolate:"clamp"}),s=n.interpolate({inputRange:i,outputRange:[.5,1,.5],extrapolate:"clamp"});return _jsx(Animated.View,{style:[{width:l,height:u,marginHorizontal:4,borderRadius:u/2,...smoothCorners,backgroundColor:e===t?a.colors.primary:a.colors.border.primary,opacity:s}]},e)})})},ThumbnailStrip=({data:e,currentIndex:t,renderThumbnail:n,onSelect:r,theme:i})=>_jsx(ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:thumbStyles.row,accessibilityRole:"tablist",children:e.map((e,a)=>_jsx(ThumbnailItem,{item:e,index:a,isActive:a===t,renderThumbnail:n,onPress:()=>r(a),theme:i},a))}),ThumbnailItem=({item:e,index:t,isActive:n,renderThumbnail:r,onPress:i,theme:a})=>{const l=useRef(createAnimatedValue(n?1.1:1)).current;useEffect(()=>{const e=Animated.spring(l,{toValue:n?1.1:1,useNativeDriver:!0,friction:6,tension:80});return e.start(),()=>e.stop()},[n,l]);const s=useMemo(()=>r?r(e,t):e&&"object"==typeof e&&"uri"in e&&"string"==typeof e.uri?_jsx(Image,{source:{uri:e.uri},style:thumbStyles.image,resizeMode:"cover"}):_jsx(View,{style:[thumbStyles.placeholder,{backgroundColor:a.colors.background.secondary}],children:_jsx(Text,{style:{color:a.colors.text.secondary,fontSize:a.typography.fontSize.xs,fontWeight:a.typography.fontWeight.semibold},children:t+1})}),[e,t,r,a]);return _jsx(Pressable,{onPress:i,accessibilityRole:"tab",accessibilityState:{selected:n},accessibilityLabel:`Go to slide ${t+1}`,children:_jsx(Animated.View,{style:[thumbStyles.thumb,{borderColor:n?a.colors.primary:"transparent",transform:[{scale:l}]}],children:s})})},thumbStyles=StyleSheet.create({row:{flexDirection:"row",alignItems:"center",paddingHorizontal:8,paddingVertical:8},thumb:{width:40,height:40,marginHorizontal:4,borderRadius:6,...smoothCorners,borderWidth:2,overflow:"hidden"},image:{width:"100%",height:"100%"},placeholder:{flex:1,alignItems:"center",justifyContent:"center"}}),clamp=(e,t,n)=>Math.min(Math.max(e,t),n),buildStyles=e=>StyleSheet.create({container:{width:"100%"}}),paginationStyles=StyleSheet.create({dotRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:12},numbersWrap:{alignItems:"center",justifyContent:"center",paddingVertical:12},numbersText:{textAlign:"center"}});export{Carousel};export default Carousel;
@@ -1 +1 @@
1
- export{Carousel,default}from"./Carousel.js";
1
+ "use strict";export{Carousel,default}from"./Carousel.js";
@@ -1 +1 @@
1
- import{forwardRef as e,useEffect as r,useMemo as o,useRef as t}from"react";import{Animated as s,Pressable as i,StyleSheet as n,View as l}from"react-native";import a,{Path as c}from"react-native-svg";import{useControllableState as d}from"../../hooks/index.js";import{createAnimatedValue as p,useTheme as m}from"../../theme/index.js";import{smoothCorners as h}from"../../utils/corners.js";import{resolveHaptic as u,triggerHaptic as b}from"../../utils/hapticUtils.js";import{ChoiceText as y,hasChoiceDetail as f}from"../FieldBase/ChoiceText.js";import{fieldTextAsString as g,hasFieldText as x}from"../FieldBase/FieldBase.js";import{jsx as w,jsxs as k}from"react/jsx-runtime";const S={sm:16,md:20,lg:24},j=e((e,n)=>{const{checked:j,defaultChecked:C,onChange:L,indeterminate:v=!1,disabled:I=!1,label:R,description:B,error:D,help:M,labelLines:W,size:T="md",tone:F="primary",accessibilityLabel:P,haptic:V,style:z,boxStyle:E,indeterminateBarStyle:H,containerStyle:N,labelStyle:G,testID:O,...U}=e,[q,A]=d({value:j,defaultValue:C??!1,onChange:L}),J=m(),K=o(()=>buildStyles(J),[J]),Q=J.components.checkbox?.[T]?.boxSize??S[T],X=J.colors.border.width,Y=J.components.checkbox?.labelGap??10,Z=((e,r)=>{switch(r){case"success":return e.colors.success;case"warning":return e.colors.warning;case"error":return e.colors.error;default:return e.colors.primary}})(J,F),$=q||v,_=t(p($?1:0)).current;r(()=>{const e=s.spring(_,{toValue:$?1:0,damping:J.motion.spring.snappy.damping,stiffness:J.motion.spring.snappy.stiffness,mass:J.motion.spring.snappy.mass,useNativeDriver:!0});return e.start(),()=>e.stop()},[$,_,J.motion.spring.snappy]);const ee=_.interpolate({inputRange:[0,1],outputRange:[0,1]}),re=P??g(R),oe=I?J.colors.border.primary:$?Z:x(D)?J.colors.field.borderError:J.colors.border.primary,te=I?J.colors.surface.disabled:$?Z:"transparent",se=I?J.colors.text.disabled:((e,r)=>{switch(r){case"success":return e.colors.onSuccess;case"warning":return e.colors.onWarning;case"error":return e.colors.onError;default:return e.colors.onPrimary}})(J,F),ie=Math.round(.72*Q),ne=Math.round(.55*Q),le=Math.max(2,Math.round(.12*Q)),ae=k(i,{ref:n,onPress:e=>{if(I)return;const r=u(V,"selection");r&&b(r),A(!q),U.onPressOut?.(e)},disabled:I,accessibilityRole:"checkbox",accessibilityLabel:re,accessibilityHint:U.accessibilityHint??g(B),accessibilityState:{checked:v?"mixed":q,disabled:I},testID:O,hitSlop:6,...U,style:({pressed:e})=>[K.row,f(B,D)?K.rowTop:null,x(M)?K.rowShrink:null,{opacity:I?.55:e?.85:1},N,z],children:[w(l,{style:[K.box,{width:Q,height:Q,borderWidth:X,borderRadius:J.radius.xs,...h,borderColor:oe,backgroundColor:te},E],children:w(s.View,{style:[K.glyphWrap,{opacity:_,transform:[{scale:ee}]}],children:v?w(l,{style:[{width:ne,height:le,borderRadius:le/2,...h,backgroundColor:se},H]}):w(a,{width:ie,height:ie,viewBox:"0 0 24 24",children:w(c,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:se,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})})}),w(y,{label:R,description:B,error:D,disabled:I,labelLines:W||void 0,descriptionLines:W||void 0,style:{marginLeft:Y},labelStyle:G})]});return x(M)?k(l,{style:[K.helpRow,f(B,D)?K.rowTop:null],children:[ae,w(l,{style:[K.help,{marginLeft:J.spacing.xs}],children:M})]}):ae});j.displayName="Checkbox";const buildStyles=e=>n.create({row:{flexDirection:"row",alignItems:"center"},rowTop:{alignItems:"flex-start"},rowShrink:{flexShrink:1},helpRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0},box:{alignItems:"center",justifyContent:"center"},glyphWrap:{alignItems:"center",justifyContent:"center"}});export{j as Checkbox};export default j;
1
+ "use strict";import{forwardRef,useEffect,useMemo,useRef}from"react";import{Animated,Pressable,StyleSheet,View}from"react-native";import Svg,{Path}from"react-native-svg";import{useControllableState}from"../../hooks/index.js";import{createAnimatedValue,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{ChoiceText,hasChoiceDetail}from"../FieldBase/ChoiceText.js";import{fieldTextAsString,hasFieldText}from"../FieldBase/FieldBase.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const sizeMap={sm:16,md:20,lg:24},toneColor=(e,r)=>{switch(r){case"success":return e.colors.success;case"warning":return e.colors.warning;case"error":return e.colors.error;default:return e.colors.primary}},toneOnColor=(e,r)=>{switch(r){case"success":return e.colors.onSuccess;case"warning":return e.colors.onWarning;case"error":return e.colors.onError;default:return e.colors.onPrimary}},Checkbox=forwardRef((e,r)=>{const{checked:t,defaultChecked:s,onChange:o,indeterminate:i=!1,disabled:n=!1,label:a,description:l,error:c,help:d,labelLines:h,size:p="md",tone:m="primary",accessibilityLabel:u,haptic:x,style:b,boxStyle:f,indeterminateBarStyle:g,containerStyle:y,labelStyle:w,testID:C,...S}=e,[j,k]=useControllableState({value:t,defaultValue:s??!1,onChange:o}),T=useTheme(),v=useMemo(()=>buildStyles(T),[T]),R=T.components.checkbox?.[p]?.boxSize??sizeMap[p],_=T.colors.border.width,L=T.components.checkbox?.labelGap??10,V=toneColor(T,m),M=j||i,A=useRef(createAnimatedValue(M?1:0)).current;useEffect(()=>{const e=Animated.spring(A,{toValue:M?1:0,damping:T.motion.spring.snappy.damping,stiffness:T.motion.spring.snappy.stiffness,mass:T.motion.spring.snappy.mass,useNativeDriver:!0});return e.start(),()=>e.stop()},[M,A,T.motion.spring.snappy]);const D=A.interpolate({inputRange:[0,1],outputRange:[0,1]}),F=u??fieldTextAsString(a),I=n?T.colors.border.primary:M?V:hasFieldText(c)?T.colors.field.borderError:T.colors.border.primary,P=n?T.colors.surface.disabled:M?V:"transparent",H=n?T.colors.text.disabled:toneOnColor(T,m),B=Math.round(.72*R),W=Math.round(.55*R),z=Math.max(2,Math.round(.12*R)),E=_jsxs(Pressable,{ref:r,onPress:e=>{if(n)return;const r=resolveHaptic(x,"selection");r&&triggerHaptic(r),k(!j),S.onPressOut?.(e)},disabled:n,accessibilityRole:"checkbox",accessibilityLabel:F,accessibilityHint:S.accessibilityHint??fieldTextAsString(l),accessibilityState:{checked:i?"mixed":j,disabled:n},testID:C,hitSlop:6,...S,style:({pressed:e})=>[v.row,hasChoiceDetail(l,c)?v.rowTop:null,hasFieldText(d)?v.rowShrink:null,{opacity:n?.55:e?.85:1},y,b],children:[_jsx(View,{style:[v.box,{width:R,height:R,borderWidth:_,borderRadius:T.radius.xs,...smoothCorners,borderColor:I,backgroundColor:P},f],children:_jsx(Animated.View,{style:[v.glyphWrap,{opacity:A,transform:[{scale:D}]}],children:i?_jsx(View,{style:[{width:W,height:z,borderRadius:z/2,...smoothCorners,backgroundColor:H},g]}):_jsx(Svg,{width:B,height:B,viewBox:"0 0 24 24",children:_jsx(Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:H,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})})}),_jsx(ChoiceText,{label:a,description:l,error:c,disabled:n,labelLines:h||void 0,descriptionLines:h||void 0,style:{marginLeft:L},labelStyle:w})]});return hasFieldText(d)?_jsxs(View,{style:[v.helpRow,hasChoiceDetail(l,c)?v.rowTop:null],children:[E,_jsx(View,{style:[v.help,{marginLeft:T.spacing.xs}],children:d})]}):E});Checkbox.displayName="Checkbox";const buildStyles=e=>StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},rowTop:{alignItems:"flex-start"},rowShrink:{flexShrink:1},helpRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0},box:{alignItems:"center",justifyContent:"center"},glyphWrap:{alignItems:"center",justifyContent:"center"}});export{Checkbox};export default Checkbox;
@@ -1 +1 @@
1
- export{Checkbox,default}from"./Checkbox.js";
1
+ "use strict";export{Checkbox,default}from"./Checkbox.js";
@@ -1 +1 @@
1
- import e,{forwardRef as r,useMemo as o}from"react";import{Animated as s,Pressable as t,StyleSheet as i,Text as l,View as c}from"react-native";import{usePressAnimation as n}from"../../hooks/usePressAnimation.js";import{fontFor as a,useTheme as d}from"../../theme/index.js";import{tintOf as p}from"../../utils/color.js";import{smoothCorners as m}from"../../utils/corners.js";import{resolveHaptic as g,triggerHaptic as b}from"../../utils/hapticUtils.js";import{renderSlotIcon as u}from"../AppIcon/slotIcon.js";import{Skeleton as y}from"../Skeleton/index.js";import{jsx as f,jsxs as h}from"react/jsx-runtime";const S={sm:{paddingH:10,paddingV:4,fontSize:12,minHeight:26,closeSize:16,closeFont:12,gap:6,iconSize:14},md:{paddingH:12,paddingV:6,fontSize:13,minHeight:32,closeSize:18,closeFont:13,gap:8,iconSize:16}},z=r((e,r)=>{const{label:i,selected:y=!1,selectionMode:z="single",onPress:H,onClose:B,leftIcon:k,iconVariant:w,variant:I="filled",tone:j="neutral",size:O="md",disabled:C=!1,loading:M=!1,accessibilityLabel:V,haptic:F,style:L,textStyle:R,containerStyle:v,closeButtonStyle:P,closeIconStyle:D,testID:A}=e,N=d(),U=!!H&&!C,{scale:W,pressIn:$,pressOut:_}=n({enabled:U}),q=o(()=>((e,r)=>{switch(r){case"primary":return{base:e.colors.primaryMuted,on:e.colors.primary,border:e.colors.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"success":return{base:e.colors.background.tertiary,on:e.colors.success,border:e.colors.success,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"warning":return{base:e.colors.background.tertiary,on:e.colors.warning,border:e.colors.warning,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"error":return{base:e.colors.background.tertiary,on:e.colors.error,border:e.colors.error,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"info":return{base:e.colors.background.tertiary,on:e.colors.info,border:e.colors.info,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};default:return{base:e.colors.background.tertiary,on:e.colors.text.primary,border:e.colors.border.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary}}})(N,j),[N,j]),E=N.components.chip?.[O],G={paddingH:E?.paddingHorizontal??S[O].paddingH,paddingV:E?.paddingVertical??S[O].paddingV,fontSize:E?.fontSize??S[O].fontSize,minHeight:E?.minHeight??S[O].minHeight,closeSize:E?.closeSize??S[O].closeSize,closeFont:E?.closeFontSize??S[O].closeFont,gap:E?.gap??S[O].gap,iconSize:E?.iconSize??S[O].iconSize},J="filled"===I,K="soft"===I,Q=(()=>{if(K){const e=y?q.selectedOn:q.on;return p(e,y?.24:.14,y?q.selectedBg:q.base)}return y?J?q.selectedBg:"transparent":J?q.base:"transparent"})(),T=K?"transparent":y?q.selectedBorder:J?"transparent":q.border,X=C?N.colors.text.disabled:y?q.selectedOn:q.on,Y=J||K?0:N.colors.border.width,handlePress=()=>{if(!U)return;const e=g(F,"selection");e&&b(e),H?.()},Z=V??i,ee=h(c,{style:x.row,children:[k?f(c,{style:{marginRight:G.gap},children:u(k,{color:X,size:G.iconSize,disabled:C},w)}):null,f(l,{style:[x.label,{color:X,fontSize:G.fontSize,...a(N,"medium")},R],numberOfLines:1,children:i??" "}),B?f(t,{onPress:()=>{C||(!1!==F&&b("impactLight"),B?.())},disabled:C,accessibilityRole:"button",accessibilityLabel:`Remove ${i}`,accessibilityState:{disabled:C},hitSlop:6,style:({pressed:e})=>[x.close,{width:G.closeSize,height:G.closeSize,borderRadius:G.closeSize/2,...m,marginLeft:G.gap,backgroundColor:e?N.colors.surface.pressed:N.colors.surface.hovered},P],children:f(l,{style:[{color:X,fontSize:G.closeFont,...a(N,"bold"),lineHeight:G.closeFont+2},D],allowFontScaling:!1,children:"×"})}):null]}),re={paddingHorizontal:G.paddingH,paddingVertical:G.paddingV,minHeight:G.minHeight,borderRadius:N.radius.full,...m,backgroundColor:Q,borderWidth:Y,borderColor:T,opacity:C?.55:1};let oe;return oe=U?f(s.View,{style:{transform:[{scale:W}],alignSelf:"flex-start"},children:f(t,{ref:r,onPress:handlePress,onPressIn:$,onPressOut:_,disabled:!U,accessibilityRole:"multiple"===z?"checkbox":"button",accessibilityLabel:Z,accessibilityState:"multiple"===z?{checked:y,disabled:C}:{selected:y,disabled:C},android_ripple:{color:N.colors.surface.pressed,borderless:!1},testID:A,style:({pressed:e})=>[x.base,re,e&&"outlined"===I?{backgroundColor:N.colors.surface.pressed}:null,v,L],children:ee})}):f(c,{ref:r,style:[x.base,re,v,L],accessible:!0,accessibilityRole:"text",accessibilityLabel:Z,accessibilityState:{selected:y,disabled:C},testID:A,children:ee}),M?f(ChipSkeleton,{...e}):oe});z.displayName="Chip";const ChipSkeleton=({label:e,size:r="md",leftIcon:o,onClose:s,style:t,containerStyle:i})=>{const l=S[r],c=Math.max(40,Math.min(120,7*(e??"").length)),n=l.minHeight,a=n/2,d=c+2*l.paddingH+(void 0!==o?l.gap+14:0)+(void 0!==s?l.gap+l.closeSize:0);return f(y,{width:d,height:n,radius:a,style:[{alignSelf:"flex-start"},i,t]})};ChipSkeleton.displayName="ChipSkeleton",z.Skeleton=ChipSkeleton;const x=i.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},label:{textAlign:"center"},close:{alignItems:"center",justifyContent:"center"}});export{z as Chip};export default z;
1
+ "use strict";import React,{forwardRef,useMemo}from"react";import{Animated,Pressable,StyleSheet,Text,View}from"react-native";import{usePressAnimation}from"../../hooks/usePressAnimation.js";import{fontFor,useTheme}from"../../theme/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{Skeleton}from"../Skeleton/index.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const toneFor=(e,r)=>{switch(r){case"primary":return{base:e.colors.primaryMuted,on:e.colors.primary,border:e.colors.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"success":return{base:e.colors.background.tertiary,on:e.colors.success,border:e.colors.success,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"warning":return{base:e.colors.background.tertiary,on:e.colors.warning,border:e.colors.warning,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"error":return{base:e.colors.background.tertiary,on:e.colors.error,border:e.colors.error,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};case"info":return{base:e.colors.background.tertiary,on:e.colors.info,border:e.colors.info,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary};default:return{base:e.colors.background.tertiary,on:e.colors.text.primary,border:e.colors.border.primary,selectedBg:e.colors.primaryMuted,selectedOn:e.colors.primary,selectedBorder:e.colors.primary}}},SOFT_FILL_OPACITY=.14,SOFT_SELECTED_FILL_OPACITY=.24,sizeMap={sm:{paddingH:10,paddingV:4,fontSize:12,minHeight:26,closeSize:16,closeFont:12,gap:6,iconSize:14},md:{paddingH:12,paddingV:6,fontSize:13,minHeight:32,closeSize:18,closeFont:13,gap:8,iconSize:16}},Chip=forwardRef((e,r)=>{const{label:o,selected:s=!1,selectionMode:t="single",onPress:i,onClose:l,leftIcon:n,iconVariant:c,variant:a="filled",tone:d="neutral",size:p="md",disabled:m=!1,loading:g=!1,accessibilityLabel:b,haptic:u,style:y,textStyle:f,containerStyle:h,closeButtonStyle:S,closeIconStyle:z,testID:x}=e,C=useTheme(),j=!!i&&!m,{scale:H,pressIn:M,pressOut:k}=usePressAnimation({enabled:j}),w=useMemo(()=>toneFor(C,d),[C,d]),I=C.components.chip?.[p],_={paddingH:I?.paddingHorizontal??sizeMap[p].paddingH,paddingV:I?.paddingVertical??sizeMap[p].paddingV,fontSize:I?.fontSize??sizeMap[p].fontSize,minHeight:I?.minHeight??sizeMap[p].minHeight,closeSize:I?.closeSize??sizeMap[p].closeSize,closeFont:I?.closeFontSize??sizeMap[p].closeFont,gap:I?.gap??sizeMap[p].gap,iconSize:I?.iconSize??sizeMap[p].iconSize},F="filled"===a,O="soft"===a,B=(()=>{if(O){const e=s?w.selectedOn:w.on;return tintOf(e,s?.24:.14,s?w.selectedBg:w.base)}return s?F?w.selectedBg:"transparent":F?w.base:"transparent"})(),P=O?"transparent":s?w.selectedBorder:F?"transparent":w.border,V=m?C.colors.text.disabled:s?w.selectedOn:w.on,L=F||O?0:C.colors.border.width,handlePress=()=>{if(!j)return;const e=resolveHaptic(u,"selection");e&&triggerHaptic(e),i?.()},R=b??o,T=_jsxs(View,{style:styles.row,children:[n?_jsx(View,{style:{marginRight:_.gap},children:renderSlotIcon(n,{color:V,size:_.iconSize,disabled:m},c)}):null,_jsx(Text,{style:[styles.label,{color:V,fontSize:_.fontSize,...fontFor(C,"medium")},f],numberOfLines:1,children:o??" "}),l?_jsx(Pressable,{onPress:()=>{m||(!1!==u&&triggerHaptic("impactLight"),l?.())},disabled:m,accessibilityRole:"button",accessibilityLabel:`Remove ${o}`,accessibilityState:{disabled:m},hitSlop:6,style:({pressed:e})=>[styles.close,{width:_.closeSize,height:_.closeSize,borderRadius:_.closeSize/2,...smoothCorners,marginLeft:_.gap,backgroundColor:e?C.colors.surface.pressed:C.colors.surface.hovered},S],children:_jsx(Text,{style:[{color:V,fontSize:_.closeFont,...fontFor(C,"bold"),lineHeight:_.closeFont+2},z],allowFontScaling:!1,children:"×"})}):null]}),A={paddingHorizontal:_.paddingH,paddingVertical:_.paddingV,minHeight:_.minHeight,borderRadius:C.radius.full,...smoothCorners,backgroundColor:B,borderWidth:L,borderColor:P,opacity:m?.55:1};let v;return v=j?_jsx(Animated.View,{style:{transform:[{scale:H}],alignSelf:"flex-start"},children:_jsx(Pressable,{ref:r,onPress:handlePress,onPressIn:M,onPressOut:k,disabled:!j,accessibilityRole:"multiple"===t?"checkbox":"button",accessibilityLabel:R,accessibilityState:"multiple"===t?{checked:s,disabled:m}:{selected:s,disabled:m},android_ripple:{color:C.colors.surface.pressed,borderless:!1},testID:x,style:({pressed:e})=>[styles.base,A,e&&"outlined"===a?{backgroundColor:C.colors.surface.pressed}:null,h,y],children:T})}):_jsx(View,{ref:r,style:[styles.base,A,h,y],accessible:!0,accessibilityRole:"text",accessibilityLabel:R,accessibilityState:{selected:s,disabled:m},testID:x,children:T}),g?_jsx(ChipSkeleton,{...e}):v});Chip.displayName="Chip";const ChipSkeleton=({label:e,size:r="md",leftIcon:o,onClose:s,style:t,containerStyle:i})=>{const l=sizeMap[r],n=Math.max(40,Math.min(120,7*(e??"").length)),c=l.minHeight,a=c/2,d=n+2*l.paddingH+(void 0!==o?l.gap+14:0)+(void 0!==s?l.gap+l.closeSize:0);return _jsx(Skeleton,{width:d,height:c,radius:a,style:[{alignSelf:"flex-start"},i,t]})};ChipSkeleton.displayName="ChipSkeleton",Chip.Skeleton=ChipSkeleton;const styles=StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},label:{textAlign:"center"},close:{alignItems:"center",justifyContent:"center"}});export{Chip};export default Chip;
@@ -1 +1 @@
1
- export{Chip,default}from"./Chip.js";
1
+ "use strict";export{Chip,default}from"./Chip.js";
@@ -1 +1 @@
1
- import i,{forwardRef as e,useCallback as o,useMemo as r}from"react";import{Pressable as t,StyleSheet as n,Text as l,View as a}from"react-native";import{useControllableState as d}from"../../hooks/index.js";import{fontFor as c,useTheme as s}from"../../theme/index.js";import{resolveHaptic as p,triggerHaptic as u}from"../../utils/index.js";import{tintOf as m}from"../../utils/color.js";import{smoothCorners as g}from"../../utils/corners.js";import{renderSlotIcon as b}from"../AppIcon/slotIcon.js";import{RadioDot as h}from"../Radio/RadioDot.js";import{jsx as f,jsxs as y,Fragment as x}from"react/jsx-runtime";const z={sm:{paddingHorizontal:10,chipPaddingHorizontal:12,paddingVertical:6,fontSize:13,minHeight:32,iconSize:14},md:{paddingHorizontal:12,chipPaddingHorizontal:16,paddingVertical:8,fontSize:15,minHeight:40,iconSize:16},lg:{paddingHorizontal:16,chipPaddingHorizontal:20,paddingVertical:11,fontSize:16,minHeight:48,iconSize:18}},H=e((i,e)=>{const{options:n,getOptionLabel:H,getOptionValue:S,getOptionDisabled:O,getOptionDescription:j,getOptionIcon:D,getOptionColor:L,renderOption:V,variant:v="card",indicatorPosition:w="trailing",direction:C="row",gap:P,wrap:I=!1,fullWidth:R,disabled:k=!1,size:W="md",haptic:G,accessibilityLabel:F,style:A,optionStyle:T,testID:M}=i,N=s(),q=r(()=>buildStyles(N),[N]),B=z[W],E=o(i=>H?H(i):i.label??"",[H]),J=o(i=>S?S(i):i.value,[S]),K=o(i=>O?O(i):!0===i.disabled,[O]),Q=o(i=>j?j(i):i.description,[j]),U=o(i=>D?D(i):i.icon,[D]),X=o(i=>L?L(i):i.color,[L]),Y="multiple"===i.selectionMode,{min:Z,max:$}=i,[_,ii]=d({value:i.value,defaultValue:i.defaultValue??(Y?[]:void 0),onChange:i.onChange}),ei=Array.isArray(_)?_:[],oi=o(i=>{const e=J(i);if(Y){const i=ei.includes(e);if(i&&null!=Z&&ei.length<=Z)return;if(!i&&null!=$&&ei.length>=$)return;const o=p(G,"selection");return o&&u(o),void ii(i?ei.filter(i=>i!==e):[...ei,e])}const o=p(G,"selection");o&&u(o),ii(e)},[G,Y,Z,$,ei,ii,J]),ri=R??("card"===v&&"row"===C&&!I),ti=N.components.choiceGroup?.selectedFillOpacity??.12,ni=N.components.choiceGroup?.borderRadius??N.radius.md,surfaceFor=(i,e,o)=>e?{borderColor:N.colors.border.primary,backgroundColor:N.colors.surface.disabled}:{borderColor:i?o:N.colors.border.primary,backgroundColor:i?m(o,ti,N.colors.surface.selected):N.colors.background.primary},renderIcon=(i,e,o,r)=>{const t=U(i);if(null==t)return null;return b("string"==typeof t&&e?{name:t,variant:"bold"}:t,{color:o,size:B.iconSize,disabled:r})},renderChip=i=>{const{option:e,selected:o,disabled:r,color:t}=i,n=r?N.colors.text.disabled:o?t:N.colors.text.primary,d=renderIcon(e,o,n,r);return y(a,{style:[q.chip,{minHeight:B.minHeight,paddingHorizontal:B.chipPaddingHorizontal,paddingVertical:B.paddingVertical,borderRadius:N.radius.full,...g,borderWidth:N.colors.border.width,...surfaceFor(o,r,t),columnGap:N.spacing.xs}],children:[d?f(a,{children:d}):null,f(l,{style:[q.cardLabel,{color:n,fontSize:B.fontSize,...c(N,"medium")}],numberOfLines:1,children:E(e)})]})},renderDefaultCard=i=>{const{option:e,selected:o,disabled:r,color:t}=i,n=X(e),d=r?N.colors.text.disabled:n??N.colors.text.primary,s=Q(e),p=renderIcon(e,o,d,r),u=f(h,{selected:o,color:t,disabled:r,size:W});return y(a,{style:[q.card,{minHeight:B.minHeight,paddingHorizontal:B.paddingHorizontal,paddingVertical:B.paddingVertical,borderRadius:ni,...g,borderWidth:N.colors.border.width,...surfaceFor(o,r,t),columnGap:N.spacing.sm}],children:["leading"===w?u:null,p?f(a,{children:p}):null,y(a,{style:q.cardTextWrap,children:[f(l,{style:[q.cardLabel,{color:d,fontSize:B.fontSize,...c(N,"medium")}],numberOfLines:1,children:E(e)}),s?f(l,{style:[q.cardDescription,{color:N.colors.text.tertiary,fontSize:N.typography.fontSize.xs}],numberOfLines:2,children:s}):null]}),"trailing"===w?u:null]})};return f(a,{ref:e,accessibilityRole:Y?void 0:"radiogroup",accessibilityLabel:F,accessibilityState:{disabled:k},testID:M,style:[{flexDirection:C,gap:P??N.spacing.sm,flexWrap:I?"wrap":"nowrap"},A],children:n.map((i,e)=>{const o=J(i),r=Y?ei.includes(o):_===o,n=Y&&null!=$&&!r&&ei.length>=$,l=k||n||K(i),a=X(i)??N.colors.primary;return f(t,{onPress:()=>{l||oi(i)},disabled:l,accessibilityRole:Y?"checkbox":"radio",accessibilityLabel:E(i),accessibilityState:{checked:r,disabled:l},style:[ri?q.stretchOption:null,{opacity:l&&V?.55:1},T],children:({pressed:o})=>{const t={option:i,index:e,selected:r,pressed:o&&!l,disabled:l,color:a};return f(x,{children:V?V(t):"chip"===v?renderChip(t):renderDefaultCard(t)})}},String(o))})})});H.displayName="ChoiceGroup";const buildStyles=i=>n.create({stretchOption:{flex:1},card:{flexDirection:"row",alignItems:"center"},chip:{flexDirection:"row",alignItems:"center",justifyContent:"center"},cardTextWrap:{flex:1},cardLabel:{includeFontPadding:!1},cardDescription:{includeFontPadding:!1,marginTop:2}});export{H as ChoiceGroup};export default H;
1
+ "use strict";import React,{forwardRef,useCallback,useMemo}from"react";import{Pressable,StyleSheet,Text,View}from"react-native";import{useControllableState}from"../../hooks/index.js";import{fontFor,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{tintOf}from"../../utils/color.js";import{smoothCorners}from"../../utils/corners.js";import{renderSlotIcon}from"../AppIcon/slotIcon.js";import{RadioDot}from"../Radio/RadioDot.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const sizeTokens={sm:{paddingHorizontal:10,chipPaddingHorizontal:12,paddingVertical:6,fontSize:13,minHeight:32,iconSize:14},md:{paddingHorizontal:12,chipPaddingHorizontal:16,paddingVertical:8,fontSize:15,minHeight:40,iconSize:16},lg:{paddingHorizontal:16,chipPaddingHorizontal:20,paddingVertical:11,fontSize:16,minHeight:48,iconSize:18}},ChoiceGroup=forwardRef((e,i)=>{const{options:o,getOptionLabel:r,getOptionValue:t,getOptionDisabled:l,getOptionDescription:n,getOptionIcon:s,getOptionColor:a,renderOption:c,variant:d="card",indicatorPosition:p="trailing",direction:u="row",gap:m,wrap:g=!1,fullWidth:b,disabled:h=!1,size:f="md",haptic:x,accessibilityLabel:y,style:z,optionStyle:S,testID:C}=e,j=useTheme(),H=useMemo(()=>buildStyles(j),[j]),w=sizeTokens[f],V=useCallback(e=>r?r(e):e.label??"",[r]),k=useCallback(e=>t?t(e):e.value,[t]),_=useCallback(e=>l?l(e):!0===e.disabled,[l]),O=useCallback(e=>n?n(e):e.description,[n]),v=useCallback(e=>s?s(e):e.icon,[s]),D=useCallback(e=>a?a(e):e.color,[a]),R="multiple"===e.selectionMode,{min:T,max:L}=e,[P,F]=useControllableState({value:e.value,defaultValue:e.defaultValue??(R?[]:void 0),onChange:e.onChange}),G=Array.isArray(P)?P:[],I=useCallback(e=>{const i=k(e);if(R){const e=G.includes(i);if(e&&null!=T&&G.length<=T)return;if(!e&&null!=L&&G.length>=L)return;const o=resolveHaptic(x,"selection");return o&&triggerHaptic(o),void F(e?G.filter(e=>e!==i):[...G,i])}const o=resolveHaptic(x,"selection");o&&triggerHaptic(o),F(i)},[x,R,T,L,G,F,k]),W=b??("card"===d&&"row"===u&&!g),A=j.components.choiceGroup?.selectedFillOpacity??.12,M=j.components.choiceGroup?.borderRadius??j.radius.md,surfaceFor=(e,i,o)=>i?{borderColor:j.colors.border.primary,backgroundColor:j.colors.surface.disabled}:{borderColor:e?o:j.colors.border.primary,backgroundColor:e?tintOf(o,A,j.colors.surface.selected):j.colors.background.primary},renderIcon=(e,i,o,r)=>{const t=v(e);if(null==t)return null;return renderSlotIcon("string"==typeof t&&i?{name:t,variant:"bold"}:t,{color:o,size:w.iconSize,disabled:r})},renderChip=e=>{const{option:i,selected:o,disabled:r,color:t}=e,l=r?j.colors.text.disabled:o?t:j.colors.text.primary,n=renderIcon(i,o,l,r);return _jsxs(View,{style:[H.chip,{minHeight:w.minHeight,paddingHorizontal:w.chipPaddingHorizontal,paddingVertical:w.paddingVertical,borderRadius:j.radius.full,...smoothCorners,borderWidth:j.colors.border.width,...surfaceFor(o,r,t),columnGap:j.spacing.xs}],children:[n?_jsx(View,{children:n}):null,_jsx(Text,{style:[H.cardLabel,{color:l,fontSize:w.fontSize,...fontFor(j,"medium")}],numberOfLines:1,children:V(i)})]})},renderDefaultCard=e=>{const{option:i,selected:o,disabled:r,color:t}=e,l=D(i),n=r?j.colors.text.disabled:l??j.colors.text.primary,s=O(i),a=renderIcon(i,o,n,r),c=_jsx(RadioDot,{selected:o,color:t,disabled:r,size:f});return _jsxs(View,{style:[H.card,{minHeight:w.minHeight,paddingHorizontal:w.paddingHorizontal,paddingVertical:w.paddingVertical,borderRadius:M,...smoothCorners,borderWidth:j.colors.border.width,...surfaceFor(o,r,t),columnGap:j.spacing.sm}],children:["leading"===p?c:null,a?_jsx(View,{children:a}):null,_jsxs(View,{style:H.cardTextWrap,children:[_jsx(Text,{style:[H.cardLabel,{color:n,fontSize:w.fontSize,...fontFor(j,"medium")}],numberOfLines:1,children:V(i)}),s?_jsx(Text,{style:[H.cardDescription,{color:j.colors.text.tertiary,fontSize:j.typography.fontSize.xs}],numberOfLines:2,children:s}):null]}),"trailing"===p?c:null]})};return _jsx(View,{ref:i,accessibilityRole:R?void 0:"radiogroup",accessibilityLabel:y,accessibilityState:{disabled:h},testID:C,style:[{flexDirection:u,gap:m??j.spacing.sm,flexWrap:g?"wrap":"nowrap"},z],children:o.map((e,i)=>{const o=k(e),r=R?G.includes(o):P===o,t=R&&null!=L&&!r&&G.length>=L,l=h||t||_(e),n=D(e)??j.colors.primary;return _jsx(Pressable,{onPress:()=>{l||I(e)},disabled:l,accessibilityRole:R?"checkbox":"radio",accessibilityLabel:V(e),accessibilityState:{checked:r,disabled:l},style:[W?H.stretchOption:null,{opacity:l&&c?.55:1},S],children:({pressed:o})=>{const t={option:e,index:i,selected:r,pressed:o&&!l,disabled:l,color:n};return _jsx(_Fragment,{children:c?c(t):"chip"===d?renderChip(t):renderDefaultCard(t)})}},String(o))})})});ChoiceGroup.displayName="ChoiceGroup";const buildStyles=e=>StyleSheet.create({stretchOption:{flex:1},card:{flexDirection:"row",alignItems:"center"},chip:{flexDirection:"row",alignItems:"center",justifyContent:"center"},cardTextWrap:{flex:1},cardLabel:{includeFontPadding:!1},cardDescription:{includeFontPadding:!1,marginTop:2}});export{ChoiceGroup};export default ChoiceGroup;
@@ -1 +1 @@
1
- export{ChoiceGroup,default}from"./ChoiceGroup.js";
1
+ "use strict";export{ChoiceGroup,default}from"./ChoiceGroup.js";
@@ -1 +1 @@
1
- import r,{forwardRef as e,useCallback as t,useEffect as a,useImperativeHandle as s,useMemo as i,useState as o}from"react";import{StyleSheet as c,useWindowDimensions as h,View as n}from"react-native";import l,{cancelAnimation as p,Easing as d,runOnJS as y,useAnimatedStyle as m,useSharedValue as g,withRepeat as u,withTiming as w}from"react-native-reanimated";import F,{Path as f,Polygon as v}from"react-native-svg";import{useReducedMotion as x}from"../../hooks/index.js";import{useTheme as M}from"../../theme/index.js";import{jsx as S}from"react/jsx-runtime";const b=2*Math.PI,q=Math.PI/180,A={slow:1.6,normal:1,fast:.6};export const DEFAULT_PHYSICS={velocity:1,drag:1,fallSpeed:1,spread:0};const k={pop:["strip","strip","strip","square","circle","triangle","star","streamer"],rain:["strip","strip","strip","circle","square"],fireworks:["circle","circle","star","star","triangle","strip"]},rand=(r,e)=>r+Math.random()*(e-r),commonPiece=(r,e)=>{return{color:r.colors[e%r.colors.length]??r.colors[0],size:r.baseSize*rand(.6,1.4),shape:(t=r.shapes,t[Math.floor(Math.random()*t.length)]??t[0]),rotations:rand(1,5),rotateDir:Math.random()<.5?1:-1,flutterFreq:rand(2,5)};var t},popPiece=(r,e)=>{const t=r.physics.spread>0?r.physics.spread/2:100,a=(-90+rand(-t,t))*q,s=rand(1.8,4.2)*r.physics.velocity;return{...commonPiece(r,e),x0Frac:r.originXFrac,y0Frac:r.originYFrac,vxFrac:Math.cos(a)*s*.7,vyFrac:Math.sin(a)*s,drag:rand(5.5,7.5)*r.physics.drag,terminalFrac:rand(.22,.44)*r.physics.fallSpeed,delay:rand(0,.05),swayAmp:rand(4,16),swayFreq:rand(1,3)}},rainPiece=(r,e)=>({...commonPiece(r,e),x0Frac:Math.random(),y0Frac:-.05,vxFrac:rand(-.12,.12)*r.physics.velocity,vyFrac:rand(.05,.25)*r.physics.velocity,drag:rand(2.5,4)*r.physics.drag,terminalFrac:rand(.95,1.35)*r.physics.fallSpeed,delay:rand(0,.35),swayAmp:rand(10,30),swayFreq:rand(1,3)});export const buildPieces=(r,e,t)=>{if("fireworks"===e)return((r,e)=>{const t=Math.max(1,Math.round(r/4)),a=e.physics.spread>0?e.physics.spread/2:180,s=[];for(let i=0;i<4&&s.length<r;i+=1){const o=rand(.18,.82),c=rand(.18,.52),h=i/4*.5+rand(0,.06);for(let i=0;i<t&&s.length<r;i+=1){const r=rand(-a,a)*q,t=rand(1.4,3.4)*e.physics.velocity;s.push({...commonPiece(e,s.length),x0Frac:o,y0Frac:c,vxFrac:Math.cos(r)*t*.7,vyFrac:Math.sin(r)*t,drag:rand(6.5,8.5)*e.physics.drag,terminalFrac:rand(.18,.38)*e.physics.fallSpeed,delay:h,swayAmp:rand(3,12),swayFreq:rand(1,3)})}}return s})(r,t);const a="rain"===e?rainPiece:popPiece;return Array.from({length:r},(r,e)=>a(t,e))};const z={strip:{w:1,h:.45},square:{w:1,h:1},circle:{w:1,h:1},triangle:{w:1,h:1},star:{w:1.2,h:1.2},streamer:{w:3,h:1.2}},ShapeBody=({shape:r,color:e})=>"triangle"===r||"star"===r?S(F,{width:"100%",height:"100%",viewBox:"0 0 100 100",children:S(v,{points:"star"===r?"50,2 61,36 97,36 68,58 79,94 50,72 21,94 32,58 3,36 39,36":"50,4 96,96 4,96",fill:e})}):"streamer"===r?S(F,{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:S(f,{d:"M2,50 C20,6 44,94 62,50 S92,6 98,50",stroke:e,strokeWidth:22,strokeLinecap:"round",fill:"none"})}):null,ConfettiPiece=({piece:r,progress:e,width:t,height:a,fadeOut:s})=>{const i=m(()=>{const i=1-r.delay,o=i<=0?0:Math.min(1,Math.max(0,(e.value-r.delay)/i)),c=(1-Math.exp(-r.drag*o))/r.drag,h=r.x0Frac*t+r.vxFrac*t*c,n=r.y0Frac*a+r.terminalFrac*a*o+(r.vyFrac-r.terminalFrac)*a*c,l=Math.sin(o*r.swayFreq*b)*r.swayAmp,p=r.rotateDir*r.rotations*360*o,d=.35+.65*Math.abs(Math.cos(o*r.flutterFreq*b));return{opacity:s?Math.max(0,1-Math.max(0,o-.75)/.25):1,transform:[{translateX:h+l},{translateY:n},{rotate:`${p}deg`},{scaleY:d}]}}),o=z[r.shape],c="triangle"===r.shape||"star"===r.shape||"streamer"===r.shape;return S(l.View,{style:[{position:"absolute",width:r.size*o.w,height:r.size*o.h,borderRadius:"circle"===r.shape?r.size*o.h/2:1,backgroundColor:c?"transparent":r.color},i],children:S(ShapeBody,{shape:r.shape,color:r.color})})},C=e(({count:r=80,colors:e,preset:l="pop",shapes:m,speed:F="normal",physics:f,origin:v,duration:b=2800,fadeOut:q=!0,autoStart:z=!1,recycle:C=!1,size:D=10,onComplete:I,style:P,testID:Y},j)=>{const E=M(),L=x(),O=h(),[X,B]=o({width:O.width,height:O.height}),[H,R]=o(!1),[T,U]=o([]),_=i(()=>e??[E.colors.primary,E.colors.secondary,E.colors.success,E.colors.warning,E.colors.error,E.colors.info],[e,E.colors]),N=g(0),V=b*A[F],W=t(()=>{R(!1),I?.()},[I]),$=t(()=>{if(L)return void I?.();p(N),N.value=0,U(buildPieces(r,l,{colors:_,baseSize:D,originXFrac:v?v.x/Math.max(1,X.width):.5,originYFrac:v?v.y/Math.max(1,X.height):.5,physics:{...DEFAULT_PHYSICS,...f},shapes:m??k[l]})),R(!0);const e=w(1,{duration:V,easing:d.linear},r=>{r&&!C&&y(W)()});N.value=C?u(e,-1,!1):e},[L,N,V,C,W,I,r,_,l,m,f,D,v,X.width,X.height]),G=t(()=>{p(N),R(!1)},[N]);s(j,()=>({start:$,stop:G}),[$,G]),a(()=>(z&&$(),()=>p(N)),[]);const J=t(r=>{const{width:e,height:t}=r.nativeEvent.layout;e>0&&t>0&&B({width:e,height:t})},[]);return S(n,{style:[c.absoluteFill,P],pointerEvents:"none",onLayout:J,testID:Y,children:H?T.map((r,e)=>S(ConfettiPiece,{piece:r,progress:N,width:X.width,height:X.height,fadeOut:q},e)):null})});C.displayName="Confetti";export{C as Confetti};export default C;
1
+ "use strict";import React,{forwardRef,useCallback,useEffect,useImperativeHandle,useMemo,useState}from"react";import{StyleSheet,useWindowDimensions,View}from"react-native";import Animated,{cancelAnimation,Easing,runOnJS,useAnimatedStyle,useSharedValue,withRepeat,withTiming}from"react-native-reanimated";import Svg,{Path,Polygon}from"react-native-svg";import{useReducedMotion}from"../../hooks/index.js";import{useTheme}from"../../theme/index.js";import{jsx as _jsx}from"react/jsx-runtime";const TAU=2*Math.PI,DEG=Math.PI/180,SPEED_FACTOR={slow:1.6,normal:1,fast:.6};export const DEFAULT_PHYSICS={velocity:1,drag:1,fallSpeed:1,spread:0};const PRESET_SHAPES={pop:["strip","strip","strip","square","circle","triangle","star","streamer"],rain:["strip","strip","strip","circle","square"],fireworks:["circle","circle","star","star","triangle","strip"]},rand=(e,a)=>e+Math.random()*(a-e),pick=e=>e[Math.floor(Math.random()*e.length)]??e[0],commonPiece=(e,a)=>({color:e.colors[a%e.colors.length]??e.colors[0],size:e.baseSize*rand(.6,1.4),shape:pick(e.shapes),rotations:rand(1,5),rotateDir:Math.random()<.5?1:-1,flutterFreq:rand(2,5)}),popPiece=(e,a)=>{const r=e.physics.spread>0?e.physics.spread/2:100,t=(-90+rand(-r,r))*DEG,s=rand(1.8,4.2)*e.physics.velocity;return{...commonPiece(e,a),x0Frac:e.originXFrac,y0Frac:e.originYFrac,vxFrac:Math.cos(t)*s*.7,vyFrac:Math.sin(t)*s,drag:rand(5.5,7.5)*e.physics.drag,terminalFrac:rand(.22,.44)*e.physics.fallSpeed,delay:rand(0,.05),swayAmp:rand(4,16),swayFreq:rand(1,3)}},rainPiece=(e,a)=>({...commonPiece(e,a),x0Frac:Math.random(),y0Frac:-.05,vxFrac:rand(-.12,.12)*e.physics.velocity,vyFrac:rand(.05,.25)*e.physics.velocity,drag:rand(2.5,4)*e.physics.drag,terminalFrac:rand(.95,1.35)*e.physics.fallSpeed,delay:rand(0,.35),swayAmp:rand(10,30),swayFreq:rand(1,3)}),FIREWORK_BURSTS=4,buildFireworks=(e,a)=>{const r=Math.max(1,Math.round(e/4)),t=a.physics.spread>0?a.physics.spread/2:180,s=[];for(let i=0;i<4&&s.length<e;i+=1){const o=rand(.18,.82),n=rand(.18,.52),c=i/4*.5+rand(0,.06);for(let i=0;i<r&&s.length<e;i+=1){const e=rand(-t,t)*DEG,r=rand(1.4,3.4)*a.physics.velocity;s.push({...commonPiece(a,s.length),x0Frac:o,y0Frac:n,vxFrac:Math.cos(e)*r*.7,vyFrac:Math.sin(e)*r,drag:rand(6.5,8.5)*a.physics.drag,terminalFrac:rand(.18,.38)*a.physics.fallSpeed,delay:c,swayAmp:rand(3,12),swayFreq:rand(1,3)})}}return s};export const buildPieces=(e,a,r)=>{if("fireworks"===a)return buildFireworks(e,r);const t="rain"===a?rainPiece:popPiece;return Array.from({length:e},(e,a)=>t(r,a))};const SHAPE_BOX={strip:{w:1,h:.45},square:{w:1,h:1},circle:{w:1,h:1},triangle:{w:1,h:1},star:{w:1.2,h:1.2},streamer:{w:3,h:1.2}},TRIANGLE_POINTS="50,4 96,96 4,96",STAR_POINTS="50,2 61,36 97,36 68,58 79,94 50,72 21,94 32,58 3,36 39,36",STREAMER_PATH="M2,50 C20,6 44,94 62,50 S92,6 98,50",ShapeBody=({shape:e,color:a})=>"triangle"===e||"star"===e?_jsx(Svg,{width:"100%",height:"100%",viewBox:"0 0 100 100",children:_jsx(Polygon,{points:"star"===e?STAR_POINTS:TRIANGLE_POINTS,fill:a})}):"streamer"===e?_jsx(Svg,{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:_jsx(Path,{d:STREAMER_PATH,stroke:a,strokeWidth:22,strokeLinecap:"round",fill:"none"})}):null,ConfettiPiece=({piece:e,progress:a,width:r,height:t,fadeOut:s})=>{const i=useAnimatedStyle(()=>{const i=1-e.delay,o=i<=0?0:Math.min(1,Math.max(0,(a.value-e.delay)/i)),n=(1-Math.exp(-e.drag*o))/e.drag,c=e.x0Frac*r+e.vxFrac*r*n,l=e.y0Frac*t+e.terminalFrac*t*o+(e.vyFrac-e.terminalFrac)*t*n,h=Math.sin(o*e.swayFreq*TAU)*e.swayAmp,d=e.rotateDir*e.rotations*360*o,p=.35+.65*Math.abs(Math.cos(o*e.flutterFreq*TAU));return{opacity:s?Math.max(0,1-Math.max(0,o-.75)/.25):1,transform:[{translateX:c+h},{translateY:l},{rotate:`${d}deg`},{scaleY:p}]}}),o=SHAPE_BOX[e.shape],n="triangle"===e.shape||"star"===e.shape||"streamer"===e.shape;return _jsx(Animated.View,{style:[{position:"absolute",width:e.size*o.w,height:e.size*o.h,borderRadius:"circle"===e.shape?e.size*o.h/2:1,backgroundColor:n?"transparent":e.color},i],children:_jsx(ShapeBody,{shape:e.shape,color:e.color})})},Confetti=forwardRef(({count:e=80,colors:a,preset:r="pop",shapes:t,speed:s="normal",physics:i,origin:o,duration:n=2800,fadeOut:c=!0,autoStart:l=!1,recycle:h=!1,size:d=10,onComplete:p,style:m,testID:u},y)=>{const g=useTheme(),S=useReducedMotion(),w=useWindowDimensions(),[f,F]=useState({width:w.width,height:w.height}),[x,P]=useState(!1),[A,v]=useState([]),E=useMemo(()=>a??[g.colors.primary,g.colors.secondary,g.colors.success,g.colors.warning,g.colors.error,g.colors.info],[a,g.colors]),M=useSharedValue(0),T=n*SPEED_FACTOR[s],R=useCallback(()=>{P(!1),p?.()},[p]),_=useCallback(()=>{if(S)return void p?.();cancelAnimation(M),M.value=0,v(buildPieces(e,r,{colors:E,baseSize:d,originXFrac:o?o.x/Math.max(1,f.width):.5,originYFrac:o?o.y/Math.max(1,f.height):.5,physics:{...DEFAULT_PHYSICS,...i},shapes:t??PRESET_SHAPES[r]})),P(!0);const a=withTiming(1,{duration:T,easing:Easing.linear},e=>{"worklet";e&&!h&&runOnJS(R)()});M.value=h?withRepeat(a,-1,!1):a},[S,M,T,h,R,p,e,E,r,t,i,d,o,f.width,f.height]),C=useCallback(()=>{cancelAnimation(M),P(!1)},[M]);useImperativeHandle(y,()=>({start:_,stop:C}),[_,C]),useEffect(()=>(l&&_(),()=>cancelAnimation(M)),[]);const k=useCallback(e=>{const{width:a,height:r}=e.nativeEvent.layout;a>0&&r>0&&F({width:a,height:r})},[]);return _jsx(View,{style:[StyleSheet.absoluteFill,m],pointerEvents:"none",onLayout:k,testID:u,children:x?A.map((e,a)=>_jsx(ConfettiPiece,{piece:e,progress:M,width:f.width,height:f.height,fadeOut:c},a)):null})});Confetti.displayName="Confetti";export{Confetti};export default Confetti;
@@ -1 +1 @@
1
- export{Confetti}from"./Confetti.js";
1
+ "use strict";export{Confetti}from"./Confetti.js";
@@ -1 +1 @@
1
- import e,{useCallback as t,useEffect as r,useMemo as a,useRef as o,useState as n}from"react";import{AccessibilityInfo as i,Animated as s,Easing as l,Modal as c,Pressable as d,StyleSheet as g,Text as y,View as u}from"react-native";import{GestureDetector as m,GestureHandlerRootView as p}from"react-native-gesture-handler";import{useSafeAreaInsets as h}from"react-native-safe-area-context";import{useDragToDismiss as f}from"../../hooks/useDragToDismiss.js";import{createAnimatedValue as b,setNativeValue as v,useTheme as w}from"../../theme/index.js";import{resolveHaptic as x,triggerHaptic as D}from"../../utils/index.js";import{smoothCorners as C}from"../../utils/corners.js";import{defaultIcons as P}from"../AppIcon/defaultIcons.js";import{PickerTrigger as S}from"../PickerTrigger/index.js";import{ToastHost as k}from"../Toast/ToastProvider.js";import{jsx as R,jsxs as T,Fragment as I}from"react/jsx-runtime";const B=12,F=10,startOfDay=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),isSameDay=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),toIso=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,formatMonthYear=(e,t)=>new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(e),formatLongDate=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e),decadeStartFor=e=>Math.floor(e/F)*F,DatePicker=e=>{const{value:C,onChange:z,onClose:L,minDate:V,maxDate:$,disabledDates:M,mode:W="modal",locale:Y="en-IN",weekStartsOn:j=0,title:N="Select Date",confirmLabel:A="Confirm",cancelLabel:q="Cancel",style:H,containerStyle:O,headerLabelStyle:G,navButtonStyle:E,footerButtonStyle:X,haptic:J,testID:K,label:Q,placeholder:U,helperText:Z,error:_,required:ee,disabled:te,size:re,variant:ae,clearable:oe,onClear:ne,formatValue:ie,triggerStyle:se}=e,le=void 0!==e.visible,[ce,de]=n(!1),ge=le?e.visible:ce,ye=le?K:K?`${K}-calendar`:void 0,ue=w(),me=h(),pe=a(()=>buildStyles(ue),[ue]),[he,fe]=n(()=>startOfDay(new Date));r(()=>{ge&&fe(startOfDay(new Date))},[ge]);const be=C?startOfDay(C):he,[ve,we]=n(be),[xe,De]=n(C?startOfDay(C):null),[Ce,Pe]=n("days"),Se=o(b(0)).current,ke=o(b(0)).current,Re=o(b(0)).current,Te=o(0),Ie=o(b(0)).current,Be=o(b(1)).current,Fe=o(b(1)).current,ze=o(b(1)).current,Le=o(b(1)).current,Ve=o(b(1)).current;r(()=>{if(C){const e=startOfDay(C);De(e),we(e)}else De(null)},[C]),r(()=>{if("modal"===W&&ge){Se.setValue(0),v(ke,0),v(Re,0);const e=s.parallel([s.timing(Se,{toValue:1,duration:ue.motion.duration.normal,easing:l.out(l.cubic),useNativeDriver:!1}),s.spring(ke,{toValue:1,damping:ue.motion.spring.gentle.damping,stiffness:ue.motion.spring.gentle.stiffness,mass:ue.motion.spring.gentle.mass,useNativeDriver:!0})]);return e.start(),()=>e.stop()}},[ge,W,Se,ke,Re,ue.motion]);const $e=a(()=>{const e=new Set;return M?.forEach(t=>e.add(toIso(startOfDay(t)))),e},[M]),Me=a(()=>V?startOfDay(V):null,[V]),We=a(()=>$?startOfDay($):null,[$]),Ye=t(e=>!!(Me&&e.getTime()<Me.getTime())||(!!(We&&e.getTime()>We.getTime())||!!$e.has(toIso(e))),[Me,We,$e]),je=a(()=>((e,t)=>{const r=e.getFullYear(),a=e.getMonth(),o=(new Date(r,a,1).getDay()-t+7)%7,n=[];for(let e=0;e<42;e+=1){const t=new Date(r,a,1-o+e);n.push({date:t,inMonth:t.getMonth()===a,iso:toIso(t)})}return n})(ve,j),[ve,j]),Ne=a(()=>(e=>{const t=e-4;return Array.from({length:B},(e,r)=>t+r)})(ve.getFullYear()),[ve]),Ae=a(()=>(e=>{const t=decadeStartFor(e)-40;return Array.from({length:B},(e,r)=>t+r*F)})(ve.getFullYear()),[ve]),qe=a(()=>((e,t)=>{const r=new Intl.DateTimeFormat(e,{weekday:"short"}),a=[];for(let e=0;e<7;e+=1){const o=new Date(1970,0,4+(t+e)%7);a.push(r.format(o))}return a})(Y,j),[Y,j]),He=a(()=>{if("days"===Ce)return formatMonthYear(ve,Y);if("years"===Ce){return`${Ne[0]} - ${Ne[Ne.length-1]}`}return`${Ae[0]} - ${Ae[Ae.length-1]+9}`},[ve,Ae,Y,Ce,Ne]),Oe=t(e=>!!(Me&&e<Me.getFullYear())||!!(We&&e>We.getFullYear()),[Me,We]),Ge=t(e=>!!(Me&&e+F-1<Me.getFullYear())||!!(We&&e>We.getFullYear()),[Me,We]),Ee=t(e=>{!1!==J&&D("impactLight");const t=e>0?1:-1,r=ue.components.datePicker?.monthSlideDistance??32,a=ue.components.datePicker?.monthSlideOutDuration??ue.motion.duration.fast??140,o=ue.components.datePicker?.monthSlideInDuration??ue.motion.duration.fast??160;s.sequence([s.parallel([s.timing(Ie,{toValue:-t*r,duration:a,easing:l.out(l.quad),useNativeDriver:!0}),s.timing(Be,{toValue:0,duration:a,useNativeDriver:!0})]),s.timing(Ie,{toValue:t*r,duration:0,useNativeDriver:!0}),s.parallel([s.timing(Ie,{toValue:0,duration:o,easing:l.out(l.cubic),useNativeDriver:!0}),s.timing(Be,{toValue:1,duration:o,useNativeDriver:!0})])]).start();const n=((e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1))(ve,e);we(n),i.announceForAccessibility(formatMonthYear(n,Y))},[ve,J,Y,Be,Ie,ue.components.datePicker,ue.motion.duration.fast]),Xe=t(()=>{"days"!==Ce?(!1!==J&&D("impactLight"),we("years"===Ce?e=>new Date(e.getFullYear()-B,e.getMonth(),1):e=>new Date(e.getFullYear()-120,e.getMonth(),1))):Ee(-1)},[Ee,Ce,J]),Je=t(()=>{"days"!==Ce?(!1!==J&&D("impactLight"),we("years"===Ce?e=>new Date(e.getFullYear()+B,e.getMonth(),1):e=>new Date(e.getFullYear()+120,e.getMonth(),1))):Ee(1)},[Ee,Ce,J]),Ke=t(()=>{const e=ue.components.datePicker?.viewTransitionDuration??ue.motion.duration.normal??200;v(ze,0),v(Le,.9),s.parallel([s.timing(ze,{toValue:1,duration:e,easing:l.out(l.cubic),useNativeDriver:!0}),s.timing(Le,{toValue:1,duration:e,easing:l.out(l.cubic),useNativeDriver:!0})]).start()},[ze,Le,ue.components.datePicker,ue.motion.duration.normal]),Qe=t(()=>{const e=x(J,"selection");e&&D(e);const t=ue.components.datePicker?.headerPressDuration??80,r=ue.components.datePicker?.headerReleaseDuration??100;s.sequence([s.timing(Ve,{toValue:.96,duration:t,useNativeDriver:!0}),s.timing(Ve,{toValue:1,duration:r,useNativeDriver:!0})]).start(),Pe(e=>"days"===e?"years":"years"===e?"decades":"years"),Ke()},[Ke,Ve,J,ue.components.datePicker]),Ue=t(e=>{const t=x(J,"selection");t&&D(t),we(t=>new Date(e,t.getMonth(),1)),Pe("days"),Ke()},[Ke,J]),Ze=t(e=>{const t=x(J,"selection");t&&D(t),we(t=>new Date(e+4,t.getMonth(),1)),Pe("years"),Ke()},[Ke,J]),_e=t(e=>{if(Ye(e.date))return;const t=x(J,"selection");t&&D(t),De(e.date),e.inMonth||we(new Date(e.date.getFullYear(),e.date.getMonth(),1)),v(Fe,.7),s.spring(Fe,{toValue:1,damping:ue.motion.spring.bouncy.damping,stiffness:ue.motion.spring.bouncy.stiffness,mass:ue.motion.spring.bouncy.mass,useNativeDriver:!0}).start()},[Ye,Fe,ue.motion.spring.bouncy,J]),et=t(()=>{le||de(!1),L?.()},[le,L]),tt=t(()=>{"modal"===W?s.parallel([s.timing(Se,{toValue:0,duration:ue.motion.duration.fast,easing:l.bezier(...ue.motion.easing.accelerate),useNativeDriver:!1}),s.timing(ke,{toValue:0,duration:ue.motion.duration.fast,easing:l.bezier(...ue.motion.easing.accelerate),useNativeDriver:!0})]).start(()=>{et()}):et()},[Se,W,et,ke,ue.motion.duration.fast,ue.motion.easing.accelerate]),{handleGesture:rt}=f({drag:Re,travel:()=>Te.current||320,onDismiss:tt}),at=t(()=>{!1!==J&&D("selection"),tt()},[tt,J]),ot=t(()=>{xe&&(!1!==J&&D("notificationSuccess"),z?.(xe),tt())},[tt,z,xe,J]),nt=ke.interpolate({inputRange:[0,1],outputRange:[320,0]}),it=R(u,{style:pe.titleRow,children:R(y,{style:pe.title,accessibilityRole:"header",children:N})}),st=T(u,{style:[pe.card,H,O],accessibilityRole:"modal"===W?void 0:"none",accessible:!1,testID:ye,children:["modal"===W?R(m,{gesture:rt,children:T(u,{style:pe.grabArea,children:[R(u,{style:pe.handle}),it]})}):it,T(u,{style:pe.headerRow,children:[R(d,{onPress:Xe,style:({pressed:e})=>[pe.navBtn,e&&pe.navBtnPressed,E],accessibilityRole:"button",accessibilityLabel:"days"===Ce?"Previous month":"years"===Ce?"Previous years":"Previous decades",hitSlop:8,children:R(y,{style:pe.navText,children:"‹"})}),R(d,{onPress:Qe,style:[pe.headerLabelWrap,G],accessibilityRole:"button",accessibilityLabel:"days"===Ce?`${He}, switch to year selection`:"years"===Ce?`${He}, switch to decade selection`:`${He}, switch to year selection`,hitSlop:8,children:T(s.View,{style:[pe.headerLabelInner,{transform:[{scale:Ve}],opacity:"days"===Ce?Be:1}],children:[R(s.Text,{style:[pe.headerLabel,{transform:[{translateX:"days"===Ce?Ie:0}]}],accessibilityLiveRegion:"polite",children:He}),R(u,{style:pe.headerCaret,children:(ue.icons?.chevronDown??P.chevronDown)({size:ue.typography.fontSize.sm,color:ue.colors.text.secondary})})]})}),R(d,{onPress:Je,style:({pressed:e})=>[pe.navBtn,e&&pe.navBtnPressed,E],accessibilityRole:"button",accessibilityLabel:"days"===Ce?"Next month":"years"===Ce?"Next years":"Next decades",hitSlop:8,children:R(y,{style:pe.navText,children:"›"})})]}),"days"===Ce?T(I,{children:[R(u,{style:pe.weekdayRow,children:qe.map((e,t)=>R(u,{style:pe.weekdayCell,children:R(y,{style:pe.weekdayText,children:e})},`${e}-${t}`))}),R(s.View,{style:[pe.grid,{opacity:Be,transform:[{translateX:Ie}]}],children:Array.from({length:6}).map((e,t)=>R(u,{style:pe.gridRow,children:je.slice(7*t,7*t+7).map(e=>{const t=Ye(e.date),r=!!xe&&isSameDay(e.date,xe),a=isSameDay(e.date,he),o=r?ue.colors.primary:"transparent",n=a&&!r?ue.colors.primary:"transparent",i=r?ue.colors.onPrimary:e.inMonth?t?ue.colors.text.disabled:ue.colors.text.primary:ue.colors.text.tertiary,l=t?.3:e.inMonth?1:.4;return R(d,{disabled:t,onPress:()=>_e(e),accessibilityRole:"button",accessibilityLabel:formatLongDate(e.date,Y),accessibilityState:{selected:r,disabled:t},style:pe.dayCell,children:R(s.View,{style:[pe.dayInner,{backgroundColor:o,borderColor:n,borderWidth:a&&!r?1.5:0,opacity:l},r?{transform:[{scale:Fe}]}:null],children:R(y,{style:[pe.dayText,{color:i}],children:e.date.getDate()})})},e.iso)})},`r-${t}`))})]}):R(s.View,"years"===Ce?{style:[pe.yearGrid,{opacity:ze,transform:[{scale:Le}]}],children:Array.from({length:3}).map((e,t)=>R(u,{style:pe.gridRow,children:Ne.slice(4*t,4*t+4).map(e=>{const t=Oe(e),r=!!xe&&xe.getFullYear()===e,a=he.getFullYear()===e,o=r?ue.colors.primary:"transparent",n=a&&!r?ue.colors.primary:"transparent",i=r?ue.colors.onPrimary:t?ue.colors.text.disabled:ue.colors.text.primary,s=t?.3:1;return R(d,{disabled:t,onPress:()=>Ue(e),accessibilityRole:"button",accessibilityLabel:`Year ${e}`,accessibilityState:{selected:r,disabled:t},style:pe.yearCell,children:R(u,{style:[pe.yearInner,{backgroundColor:o,borderColor:n,borderWidth:a&&!r?1.5:0,opacity:s}],children:R(y,{style:[pe.yearText,{color:i}],children:e})})},`year-${e}`)})},`yr-${t}`))}:{style:[pe.yearGrid,{opacity:ze,transform:[{scale:Le}]}],children:Array.from({length:3}).map((e,t)=>R(u,{style:pe.gridRow,children:Ae.slice(4*t,4*t+4).map(e=>{const t=e+F-1,r=Ge(e),a=!!xe&&decadeStartFor(xe.getFullYear())===e,o=decadeStartFor(he.getFullYear())===e,n=a?ue.colors.primary:"transparent",i=o&&!a?ue.colors.primary:"transparent",s=a?ue.colors.onPrimary:r?ue.colors.text.disabled:ue.colors.text.primary,l=r?.3:1;return R(d,{disabled:r,onPress:()=>Ze(e),accessibilityRole:"button",accessibilityLabel:`Decade ${e} to ${t}`,accessibilityState:{selected:a,disabled:r},style:pe.yearCell,children:T(u,{style:[pe.yearInner,{backgroundColor:n,borderColor:i,borderWidth:o&&!a?1.5:0,opacity:l}],children:[R(y,{style:[pe.yearText,{color:s}],children:`${e}s`}),R(y,{style:[pe.decadeRangeText,{color:a?ue.colors.onPrimary:ue.colors.text.tertiary}],children:`${e}-${t}`})]})},`decade-${e}`)})},`dec-${t}`))}),T(u,{style:pe.footer,children:[R(d,{onPress:at,style:({pressed:e})=>[pe.footerBtn,pe.footerCancel,e&&pe.footerBtnPressed,X],accessibilityRole:"button",accessibilityLabel:q,children:R(y,{style:[pe.footerBtnText,{color:ue.colors.text.secondary}],children:q})}),R(d,{onPress:ot,disabled:!xe,style:({pressed:e})=>[pe.footerBtn,pe.footerConfirm,{backgroundColor:ue.colors.primary,opacity:xe?1:.5},e&&{backgroundColor:ue.colors.primaryHover},X],accessibilityRole:"button",accessibilityLabel:A,accessibilityState:{disabled:!xe},children:R(y,{style:[pe.footerBtnText,{color:ue.colors.onPrimary}],children:A})})]})]}),lt=C?(ie??(e=>e.toLocaleDateString()))(C):void 0,ct=!le;if("inline"===W)return ge||ct?ct?T(I,{children:[R(S,{label:Q,value:lt,placeholder:U,helperText:Z,error:_,required:ee,disabled:te,size:re,variant:ae,clearable:oe,onClear:ne,onPress:()=>de(!0),triggerStyle:se,testID:K}),ge?st:null]}):st:null;const dt=R(c,{visible:ge,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:tt,children:T(p,{collapsable:!1,style:[pe.backdrop,{backgroundColor:ue.colors.background.overlay}],children:[R(d,{style:g.absoluteFill,onPress:tt,accessibilityLabel:"Dismiss"}),R(s.View,{style:[pe.sheetWrap,{paddingBottom:Math.max(me.bottom,ue.spacing.lg),opacity:ke,transform:[{translateY:s.add(nt,Re)}]}],onLayout:e=>{Te.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:st}),R(k,{})]})});return ct?T(I,{children:[R(S,{label:Q,value:lt,placeholder:U,helperText:Z,error:_,required:ee,disabled:te,size:re,variant:ae,clearable:oe,onClear:ne,onPress:()=>de(!0),triggerStyle:se,testID:K}),dt]}):dt},buildStyles=e=>{const t=e.shadows.lg;return g.create({backdrop:{...g.absoluteFill},sheetWrap:{position:"absolute",left:0,right:0,bottom:0,paddingHorizontal:e.spacing.md,paddingBottom:e.spacing.lg},card:{backgroundColor:e.colors.background.elevated,borderRadius:e.radius.xl,...C,padding:e.spacing.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.spacing.lg,paddingTop:e.spacing.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.full,...C,backgroundColor:e.colors.border.secondary,marginBottom:e.spacing.sm},titleRow:{marginBottom:e.spacing.sm},title:{fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},headerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing.md},navBtn:{width:e.components.datePicker?.navButtonSize??36,height:e.components.datePicker?.navButtonSize??36,borderRadius:e.radius.full,...C,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary},navBtnPressed:{backgroundColor:e.colors.surface.pressed},navText:{fontSize:e.components.datePicker?.navTextFontSize??22,lineHeight:e.components.datePicker?.navTextLineHeight??24,color:e.colors.text.primary,fontWeight:e.typography.fontWeight.semibold},headerLabelWrap:{flex:1,alignItems:"center"},headerLabelInner:{flexDirection:"row",alignItems:"center",justifyContent:"center"},headerLabel:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},headerCaret:{marginLeft:e.spacing.xs,alignItems:"center",justifyContent:"center"},weekdayRow:{flexDirection:"row",marginBottom:e.spacing.xs},weekdayCell:{flex:1,alignItems:"center",paddingVertical:e.spacing.xs},weekdayText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,color:e.colors.text.tertiary,letterSpacing:e.typography.letterSpacing.wide},grid:{},gridRow:{flexDirection:"row"},dayCell:{flex:1,aspectRatio:1,alignItems:"center",justifyContent:"center",padding:e.components.datePicker?.dayCellPadding??2},dayInner:{width:"100%",height:"100%",borderRadius:e.components.datePicker?.dayInnerBorderRadius??e.radius.full,...C,alignItems:"center",justifyContent:"center"},dayText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium},yearGrid:{},yearCell:{flex:1,aspectRatio:1.6,alignItems:"center",justifyContent:"center",padding:e.components.datePicker?.yearCellPadding??4},yearInner:{width:"100%",height:"100%",borderRadius:e.components.datePicker?.yearInnerBorderRadius??e.radius.lg,...C,alignItems:"center",justifyContent:"center"},yearText:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold},decadeRangeText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,marginTop:e.components.datePicker?.decadeRangeMarginTop??2},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.spacing.lg,gap:e.spacing.sm},footerBtn:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,borderRadius:e.radius.md,...C,minHeight:e.components.datePicker?.footerButtonMinHeight??40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}})};export{DatePicker};export default DatePicker;
1
+ "use strict";import React,{useCallback,useEffect,useMemo,useRef,useState}from"react";import{AccessibilityInfo,Animated,Easing,Modal,Pressable,StyleSheet,Text,View}from"react-native";import{GestureDetector,GestureHandlerRootView}from"react-native-gesture-handler";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useDragToDismiss}from"../../hooks/useDragToDismiss.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{defaultIcons}from"../AppIcon/defaultIcons.js";import{PickerTrigger}from"../PickerTrigger/index.js";import{ToastHost}from"../Toast/ToastProvider.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const GRID_SIZE=12,DECADE_SPAN=10,startOfDay=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),isSameDay=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),toIso=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,addMonths=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),buildMonthMatrix=(e,t)=>{const a=e.getFullYear(),r=e.getMonth(),i=(new Date(a,r,1).getDay()-t+7)%7,o=[];for(let e=0;e<42;e+=1){const t=new Date(a,r,1-i+e);o.push({date:t,inMonth:t.getMonth()===r,iso:toIso(t)})}return o},weekdayLabels=(e,t)=>{const a=new Intl.DateTimeFormat(e,{weekday:"short"}),r=[];for(let e=0;e<7;e+=1){const i=new Date(1970,0,4+(t+e)%7);r.push(a.format(i))}return r},formatMonthYear=(e,t)=>new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(e),formatLongDate=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e),decadeStartFor=e=>10*Math.floor(e/10),buildYearCells=e=>{const t=e-4;return Array.from({length:12},(e,a)=>t+a)},buildDecadeCells=e=>{const t=decadeStartFor(e)-40;return Array.from({length:12},(e,a)=>t+10*a)},DatePicker=e=>{const{value:t,onChange:a,onClose:r,minDate:i,maxDate:o,disabledDates:s,mode:n="modal",locale:l="en-IN",weekStartsOn:c=0,title:d="Select Date",confirmLabel:u="Confirm",cancelLabel:g="Cancel",style:m,containerStyle:y,headerLabelStyle:p,navButtonStyle:h,footerButtonStyle:f,haptic:b,testID:x,label:D,placeholder:w,helperText:v,error:C,required:S,disabled:j,size:k,variant:P,clearable:T,onClear:V,formatValue:R,triggerStyle:_}=e,A=void 0!==e.visible,[I,M]=useState(!1),F=A?e.visible:I,L=A?x:x?`${x}-calendar`:void 0,B=useTheme(),Y=useSafeAreaInsets(),z=useMemo(()=>buildStyles(B),[B]),[H,N]=useState(()=>startOfDay(new Date));useEffect(()=>{F&&N(startOfDay(new Date))},[F]);const $=t?startOfDay(t):H,[W,E]=useState($),[O,G]=useState(t?startOfDay(t):null),[q,X]=useState("days"),Z=useRef(createAnimatedValue(0)).current,J=useRef(createAnimatedValue(0)).current,K=useRef(createAnimatedValue(0)).current,Q=useRef(0),U=useRef(createAnimatedValue(0)).current,ee=useRef(createAnimatedValue(1)).current,te=useRef(createAnimatedValue(1)).current,ae=useRef(createAnimatedValue(1)).current,re=useRef(createAnimatedValue(1)).current,ie=useRef(createAnimatedValue(1)).current;useEffect(()=>{if(t){const e=startOfDay(t);G(e),E(e)}else G(null)},[t]),useEffect(()=>{if("modal"===n&&F){Z.setValue(0),setNativeValue(J,0),setNativeValue(K,0);const e=Animated.parallel([Animated.timing(Z,{toValue:1,duration:B.motion.duration.normal,easing:Easing.out(Easing.cubic),useNativeDriver:!1}),Animated.spring(J,{toValue:1,damping:B.motion.spring.gentle.damping,stiffness:B.motion.spring.gentle.stiffness,mass:B.motion.spring.gentle.mass,useNativeDriver:!0})]);return e.start(),()=>e.stop()}},[F,n,Z,J,K,B.motion]);const oe=useMemo(()=>{const e=new Set;return s?.forEach(t=>e.add(toIso(startOfDay(t)))),e},[s]),se=useMemo(()=>i?startOfDay(i):null,[i]),ne=useMemo(()=>o?startOfDay(o):null,[o]),le=useCallback(e=>!!(se&&e.getTime()<se.getTime())||(!!(ne&&e.getTime()>ne.getTime())||!!oe.has(toIso(e))),[se,ne,oe]),ce=useMemo(()=>buildMonthMatrix(W,c),[W,c]),de=useMemo(()=>buildYearCells(W.getFullYear()),[W]),ue=useMemo(()=>buildDecadeCells(W.getFullYear()),[W]),ge=useMemo(()=>weekdayLabels(l,c),[l,c]),me=useMemo(()=>{if("days"===q)return formatMonthYear(W,l);if("years"===q){return`${de[0]} - ${de[de.length-1]}`}return`${ue[0]} - ${ue[ue.length-1]+9}`},[W,ue,l,q,de]),ye=useCallback(e=>!!(se&&e<se.getFullYear())||!!(ne&&e>ne.getFullYear()),[se,ne]),pe=useCallback(e=>!!(se&&e+10-1<se.getFullYear())||!!(ne&&e>ne.getFullYear()),[se,ne]),he=useCallback(e=>{!1!==b&&triggerHaptic("impactLight");const t=e>0?1:-1,a=B.components.datePicker?.monthSlideDistance??32,r=B.components.datePicker?.monthSlideOutDuration??B.motion.duration.fast??140,i=B.components.datePicker?.monthSlideInDuration??B.motion.duration.fast??160;Animated.sequence([Animated.parallel([Animated.timing(U,{toValue:-t*a,duration:r,easing:Easing.out(Easing.quad),useNativeDriver:!0}),Animated.timing(ee,{toValue:0,duration:r,useNativeDriver:!0})]),Animated.timing(U,{toValue:t*a,duration:0,useNativeDriver:!0}),Animated.parallel([Animated.timing(U,{toValue:0,duration:i,easing:Easing.out(Easing.cubic),useNativeDriver:!0}),Animated.timing(ee,{toValue:1,duration:i,useNativeDriver:!0})])]).start();const o=addMonths(W,e);E(o),AccessibilityInfo.announceForAccessibility(formatMonthYear(o,l))},[W,b,l,ee,U,B.components.datePicker,B.motion.duration.fast]),fe=useCallback(()=>{"days"!==q?(!1!==b&&triggerHaptic("impactLight"),E("years"===q?e=>new Date(e.getFullYear()-12,e.getMonth(),1):e=>new Date(e.getFullYear()-120,e.getMonth(),1))):he(-1)},[he,q,b]),be=useCallback(()=>{"days"!==q?(!1!==b&&triggerHaptic("impactLight"),E("years"===q?e=>new Date(e.getFullYear()+12,e.getMonth(),1):e=>new Date(e.getFullYear()+120,e.getMonth(),1))):he(1)},[he,q,b]),xe=useCallback(()=>{const e=B.components.datePicker?.viewTransitionDuration??B.motion.duration.normal??200;setNativeValue(ae,0),setNativeValue(re,.9),Animated.parallel([Animated.timing(ae,{toValue:1,duration:e,easing:Easing.out(Easing.cubic),useNativeDriver:!0}),Animated.timing(re,{toValue:1,duration:e,easing:Easing.out(Easing.cubic),useNativeDriver:!0})]).start()},[ae,re,B.components.datePicker,B.motion.duration.normal]),De=useCallback(()=>{const e=resolveHaptic(b,"selection");e&&triggerHaptic(e);const t=B.components.datePicker?.headerPressDuration??80,a=B.components.datePicker?.headerReleaseDuration??100;Animated.sequence([Animated.timing(ie,{toValue:.96,duration:t,useNativeDriver:!0}),Animated.timing(ie,{toValue:1,duration:a,useNativeDriver:!0})]).start(),X(e=>"days"===e?"years":"years"===e?"decades":"years"),xe()},[xe,ie,b,B.components.datePicker]),we=useCallback(e=>{const t=resolveHaptic(b,"selection");t&&triggerHaptic(t),E(t=>new Date(e,t.getMonth(),1)),X("days"),xe()},[xe,b]),ve=useCallback(e=>{const t=resolveHaptic(b,"selection");t&&triggerHaptic(t),E(t=>new Date(e+4,t.getMonth(),1)),X("years"),xe()},[xe,b]),Ce=useCallback(e=>{if(le(e.date))return;const t=resolveHaptic(b,"selection");t&&triggerHaptic(t),G(e.date),e.inMonth||E(new Date(e.date.getFullYear(),e.date.getMonth(),1)),setNativeValue(te,.7),Animated.spring(te,{toValue:1,damping:B.motion.spring.bouncy.damping,stiffness:B.motion.spring.bouncy.stiffness,mass:B.motion.spring.bouncy.mass,useNativeDriver:!0}).start()},[le,te,B.motion.spring.bouncy,b]),Se=useCallback(()=>{A||M(!1),r?.()},[A,r]),je=useCallback(()=>{"modal"===n?Animated.parallel([Animated.timing(Z,{toValue:0,duration:B.motion.duration.fast,easing:Easing.bezier(...B.motion.easing.accelerate),useNativeDriver:!1}),Animated.timing(J,{toValue:0,duration:B.motion.duration.fast,easing:Easing.bezier(...B.motion.easing.accelerate),useNativeDriver:!0})]).start(()=>{Se()}):Se()},[Z,n,Se,J,B.motion.duration.fast,B.motion.easing.accelerate]),{handleGesture:ke}=useDragToDismiss({drag:K,travel:()=>Q.current||320,onDismiss:je}),Pe=useCallback(()=>{!1!==b&&triggerHaptic("selection"),je()},[je,b]),Te=useCallback(()=>{O&&(!1!==b&&triggerHaptic("notificationSuccess"),a?.(O),je())},[je,a,O,b]),Ve=J.interpolate({inputRange:[0,1],outputRange:[320,0]}),Re=_jsx(View,{style:z.titleRow,children:_jsx(Text,{style:z.title,accessibilityRole:"header",children:d})}),_e=_jsxs(View,{style:[z.card,m,y],accessibilityRole:"modal"===n?void 0:"none",accessible:!1,testID:L,children:["modal"===n?_jsx(GestureDetector,{gesture:ke,children:_jsxs(View,{style:z.grabArea,children:[_jsx(View,{style:z.handle}),Re]})}):Re,_jsxs(View,{style:z.headerRow,children:[_jsx(Pressable,{onPress:fe,style:({pressed:e})=>[z.navBtn,e&&z.navBtnPressed,h],accessibilityRole:"button",accessibilityLabel:"days"===q?"Previous month":"years"===q?"Previous years":"Previous decades",hitSlop:8,children:_jsx(Text,{style:z.navText,children:"‹"})}),_jsx(Pressable,{onPress:De,style:[z.headerLabelWrap,p],accessibilityRole:"button",accessibilityLabel:"days"===q?`${me}, switch to year selection`:"years"===q?`${me}, switch to decade selection`:`${me}, switch to year selection`,hitSlop:8,children:_jsxs(Animated.View,{style:[z.headerLabelInner,{transform:[{scale:ie}],opacity:"days"===q?ee:1}],children:[_jsx(Animated.Text,{style:[z.headerLabel,{transform:[{translateX:"days"===q?U:0}]}],accessibilityLiveRegion:"polite",children:me}),_jsx(View,{style:z.headerCaret,children:(B.icons?.chevronDown??defaultIcons.chevronDown)({size:B.typography.fontSize.sm,color:B.colors.text.secondary})})]})}),_jsx(Pressable,{onPress:be,style:({pressed:e})=>[z.navBtn,e&&z.navBtnPressed,h],accessibilityRole:"button",accessibilityLabel:"days"===q?"Next month":"years"===q?"Next years":"Next decades",hitSlop:8,children:_jsx(Text,{style:z.navText,children:"›"})})]}),"days"===q?_jsxs(_Fragment,{children:[_jsx(View,{style:z.weekdayRow,children:ge.map((e,t)=>_jsx(View,{style:z.weekdayCell,children:_jsx(Text,{style:z.weekdayText,children:e})},`${e}-${t}`))}),_jsx(Animated.View,{style:[z.grid,{opacity:ee,transform:[{translateX:U}]}],children:Array.from({length:6}).map((e,t)=>_jsx(View,{style:z.gridRow,children:ce.slice(7*t,7*t+7).map(e=>{const t=le(e.date),a=!!O&&isSameDay(e.date,O),r=isSameDay(e.date,H),i=a?B.colors.primary:"transparent",o=r&&!a?B.colors.primary:"transparent",s=a?B.colors.onPrimary:e.inMonth?t?B.colors.text.disabled:B.colors.text.primary:B.colors.text.tertiary,n=t?.3:e.inMonth?1:.4;return _jsx(Pressable,{disabled:t,onPress:()=>Ce(e),accessibilityRole:"button",accessibilityLabel:formatLongDate(e.date,l),accessibilityState:{selected:a,disabled:t},style:z.dayCell,children:_jsx(Animated.View,{style:[z.dayInner,{backgroundColor:i,borderColor:o,borderWidth:r&&!a?1.5:0,opacity:n},a?{transform:[{scale:te}]}:null],children:_jsx(Text,{style:[z.dayText,{color:s}],children:e.date.getDate()})})},e.iso)})},`r-${t}`))})]}):_jsx(Animated.View,"years"===q?{style:[z.yearGrid,{opacity:ae,transform:[{scale:re}]}],children:Array.from({length:3}).map((e,t)=>_jsx(View,{style:z.gridRow,children:de.slice(4*t,4*t+4).map(e=>{const t=ye(e),a=!!O&&O.getFullYear()===e,r=H.getFullYear()===e,i=a?B.colors.primary:"transparent",o=r&&!a?B.colors.primary:"transparent",s=a?B.colors.onPrimary:t?B.colors.text.disabled:B.colors.text.primary,n=t?.3:1;return _jsx(Pressable,{disabled:t,onPress:()=>we(e),accessibilityRole:"button",accessibilityLabel:`Year ${e}`,accessibilityState:{selected:a,disabled:t},style:z.yearCell,children:_jsx(View,{style:[z.yearInner,{backgroundColor:i,borderColor:o,borderWidth:r&&!a?1.5:0,opacity:n}],children:_jsx(Text,{style:[z.yearText,{color:s}],children:e})})},`year-${e}`)})},`yr-${t}`))}:{style:[z.yearGrid,{opacity:ae,transform:[{scale:re}]}],children:Array.from({length:3}).map((e,t)=>_jsx(View,{style:z.gridRow,children:ue.slice(4*t,4*t+4).map(e=>{const t=e+10-1,a=pe(e),r=!!O&&decadeStartFor(O.getFullYear())===e,i=decadeStartFor(H.getFullYear())===e,o=r?B.colors.primary:"transparent",s=i&&!r?B.colors.primary:"transparent",n=r?B.colors.onPrimary:a?B.colors.text.disabled:B.colors.text.primary,l=a?.3:1;return _jsx(Pressable,{disabled:a,onPress:()=>ve(e),accessibilityRole:"button",accessibilityLabel:`Decade ${e} to ${t}`,accessibilityState:{selected:r,disabled:a},style:z.yearCell,children:_jsxs(View,{style:[z.yearInner,{backgroundColor:o,borderColor:s,borderWidth:i&&!r?1.5:0,opacity:l}],children:[_jsx(Text,{style:[z.yearText,{color:n}],children:`${e}s`}),_jsx(Text,{style:[z.decadeRangeText,{color:r?B.colors.onPrimary:B.colors.text.tertiary}],children:`${e}-${t}`})]})},`decade-${e}`)})},`dec-${t}`))}),_jsxs(View,{style:z.footer,children:[_jsx(Pressable,{onPress:Pe,style:({pressed:e})=>[z.footerBtn,z.footerCancel,e&&z.footerBtnPressed,f],accessibilityRole:"button",accessibilityLabel:g,children:_jsx(Text,{style:[z.footerBtnText,{color:B.colors.text.secondary}],children:g})}),_jsx(Pressable,{onPress:Te,disabled:!O,style:({pressed:e})=>[z.footerBtn,z.footerConfirm,{backgroundColor:B.colors.primary,opacity:O?1:.5},e&&{backgroundColor:B.colors.primaryHover},f],accessibilityRole:"button",accessibilityLabel:u,accessibilityState:{disabled:!O},children:_jsx(Text,{style:[z.footerBtnText,{color:B.colors.onPrimary}],children:u})})]})]}),Ae=t?(R??(e=>e.toLocaleDateString()))(t):void 0,Ie=!A;if("inline"===n)return F||Ie?Ie?_jsxs(_Fragment,{children:[_jsx(PickerTrigger,{label:D,value:Ae,placeholder:w,helperText:v,error:C,required:S,disabled:j,size:k,variant:P,clearable:T,onClear:V,onPress:()=>M(!0),triggerStyle:_,testID:x}),F?_e:null]}):_e:null;const Me=_jsx(Modal,{visible:F,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:je,children:_jsxs(GestureHandlerRootView,{collapsable:!1,style:[z.backdrop,{backgroundColor:B.colors.background.overlay}],children:[_jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:je,accessibilityLabel:"Dismiss"}),_jsx(Animated.View,{style:[z.sheetWrap,{paddingBottom:Math.max(Y.bottom,B.spacing.lg),opacity:J,transform:[{translateY:Animated.add(Ve,K)}]}],onLayout:e=>{Q.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:_e}),_jsx(ToastHost,{})]})});return Ie?_jsxs(_Fragment,{children:[_jsx(PickerTrigger,{label:D,value:Ae,placeholder:w,helperText:v,error:C,required:S,disabled:j,size:k,variant:P,clearable:T,onClear:V,onPress:()=>M(!0),triggerStyle:_,testID:x}),Me]}):Me},buildStyles=e=>{const t=e.shadows.lg;return StyleSheet.create({backdrop:{...StyleSheet.absoluteFill},sheetWrap:{position:"absolute",left:0,right:0,bottom:0,paddingHorizontal:e.spacing.md,paddingBottom:e.spacing.lg},card:{backgroundColor:e.colors.background.elevated,borderRadius:e.radius.xl,...smoothCorners,padding:e.spacing.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.spacing.lg,paddingTop:e.spacing.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.full,...smoothCorners,backgroundColor:e.colors.border.secondary,marginBottom:e.spacing.sm},titleRow:{marginBottom:e.spacing.sm},title:{fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},headerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing.md},navBtn:{width:e.components.datePicker?.navButtonSize??36,height:e.components.datePicker?.navButtonSize??36,borderRadius:e.radius.full,...smoothCorners,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary},navBtnPressed:{backgroundColor:e.colors.surface.pressed},navText:{fontSize:e.components.datePicker?.navTextFontSize??22,lineHeight:e.components.datePicker?.navTextLineHeight??24,color:e.colors.text.primary,fontWeight:e.typography.fontWeight.semibold},headerLabelWrap:{flex:1,alignItems:"center"},headerLabelInner:{flexDirection:"row",alignItems:"center",justifyContent:"center"},headerLabel:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},headerCaret:{marginLeft:e.spacing.xs,alignItems:"center",justifyContent:"center"},weekdayRow:{flexDirection:"row",marginBottom:e.spacing.xs},weekdayCell:{flex:1,alignItems:"center",paddingVertical:e.spacing.xs},weekdayText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,color:e.colors.text.tertiary,letterSpacing:e.typography.letterSpacing.wide},grid:{},gridRow:{flexDirection:"row"},dayCell:{flex:1,aspectRatio:1,alignItems:"center",justifyContent:"center",padding:e.components.datePicker?.dayCellPadding??2},dayInner:{width:"100%",height:"100%",borderRadius:e.components.datePicker?.dayInnerBorderRadius??e.radius.full,...smoothCorners,alignItems:"center",justifyContent:"center"},dayText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium},yearGrid:{},yearCell:{flex:1,aspectRatio:1.6,alignItems:"center",justifyContent:"center",padding:e.components.datePicker?.yearCellPadding??4},yearInner:{width:"100%",height:"100%",borderRadius:e.components.datePicker?.yearInnerBorderRadius??e.radius.lg,...smoothCorners,alignItems:"center",justifyContent:"center"},yearText:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold},decadeRangeText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,marginTop:e.components.datePicker?.decadeRangeMarginTop??2},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.spacing.lg,gap:e.spacing.sm},footerBtn:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,borderRadius:e.radius.md,...smoothCorners,minHeight:e.components.datePicker?.footerButtonMinHeight??40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}})};export{DatePicker};export default DatePicker;
@@ -1 +1 @@
1
- export{DatePicker,default}from"./DatePicker.js";
1
+ "use strict";export{DatePicker,default}from"./DatePicker.js";
@@ -1 +1 @@
1
- import{forwardRef as e,useCallback as t,useEffect as o,useMemo as n,useRef as r,useState as a}from"react";import{AccessibilityInfo as i,Animated as s,Easing as l,Modal as c,Pressable as d,StyleSheet as g,Text as u,View as m}from"react-native";import{GestureDetector as p,GestureHandlerRootView as h}from"react-native-gesture-handler";import{useSafeAreaInsets as y}from"react-native-safe-area-context";import{useDragToDismiss as f}from"../../hooks/useDragToDismiss.js";import{createAnimatedValue as b,setNativeValue as v,useTheme as w}from"../../theme/index.js";import{resolveHaptic as x,triggerHaptic as D}from"../../utils/index.js";import{smoothCorners as R}from"../../utils/corners.js";import{PickerTrigger as S}from"../PickerTrigger/index.js";import{ToastHost as T}from"../Toast/ToastProvider.js";import{jsx as k,jsxs as C,Fragment as B}from"react/jsx-runtime";const startOfDay=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),isSameDay=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),toIso=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,formatMonthYear=(e,t)=>new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(e),formatRangePart=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"short",day:"numeric",month:"short"}).format(e),formatLongDate=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e),P=e((e,P)=>{const{visible:z,value:L,onChange:I,onClose:W,label:M,placeholder:V,helperText:F,error:j,required:$,disabled:N,size:Y,variant:H,clearable:O,onClear:q,formatValue:A,triggerStyle:E,minDate:X,maxDate:G,disabledDates:J,locale:K="en-IN",weekStartsOn:Q=0,title:U="Select Date Range",confirmLabel:Z="Confirm",cancelLabel:_="Cancel",maxRange:ee,haptic:te,style:oe,containerStyle:ne,headerLabelStyle:re,navButtonStyle:ae,footerButtonStyle:ie,testID:se}=e,le=void 0!==z,[ce,de]=a(!1),ge=le?z:ce,ue=le?se:se?`${se}-calendar`:void 0,me=w(),pe=y(),he=n(()=>buildStyles(me),[me]),[ye,fe]=a(()=>startOfDay(new Date));o(()=>{ge&&fe(startOfDay(new Date))},[ge]);const be=L.start?startOfDay(L.start):ye,[ve,we]=a(be),[xe,De]=a(L.start?startOfDay(L.start):null),[Re,Se]=a(L.end?startOfDay(L.end):null),Te=r(b(0)).current,ke=r(b(0)).current,Ce=r(b(0)).current,Be=r(0),Pe=r(b(0)).current,ze=r(b(1)).current;o(()=>{if(L.start){const e=startOfDay(L.start);De(e),we(e)}else De(null);L.end?Se(startOfDay(L.end)):Se(null)},[L.start,L.end]),o(()=>{let e;return ge&&(Te.setValue(0),v(ke,0),v(Ce,0),e=s.parallel([s.timing(Te,{toValue:1,duration:me.motion.duration.normal,easing:l.out(l.cubic),useNativeDriver:!1}),s.spring(ke,{toValue:1,damping:me.motion.spring.gentle.damping,stiffness:me.motion.spring.gentle.stiffness,mass:me.motion.spring.gentle.mass,useNativeDriver:!0})]),e.start()),()=>e?.stop()},[ge,Te,ke,Ce,me.motion]);const Le=n(()=>{const e=new Set;return J?.forEach(t=>e.add(toIso(startOfDay(t)))),e},[J]),Ie=n(()=>X?startOfDay(X):null,[X]),We=n(()=>G?startOfDay(G):null,[G]),Me=t(e=>!!(Ie&&e.getTime()<Ie.getTime())||(!!(We&&e.getTime()>We.getTime())||!!Le.has(toIso(e))),[Ie,We,Le]),Ve=n(()=>((e,t)=>{const o=e.getFullYear(),n=e.getMonth(),r=(new Date(o,n,1).getDay()-t+7)%7,a=[];for(let e=0;e<42;e+=1){const t=new Date(o,n,1-r+e);a.push({date:t,inMonth:t.getMonth()===n,iso:toIso(t)})}return a})(ve,Q),[ve,Q]),Fe=n(()=>formatMonthYear(ve,K),[ve,K]),je=n(()=>((e,t)=>{const o=new Intl.DateTimeFormat(e,{weekday:"short"}),n=[];for(let e=0;e<7;e+=1){const r=new Date(1970,0,4+(t+e)%7);n.push(o.format(r))}return n})(K,Q),[K,Q]),$e=t(e=>{!1!==te&&D("impactLight");const t=e>0?1:-1,o=me.components.dateRangePicker?.monthSlideDistance??32,n=me.components.dateRangePicker?.monthSlideOutDuration??me.motion.duration.fast??140,r=me.components.dateRangePicker?.monthSlideInDuration??me.motion.duration.fast??160;s.sequence([s.parallel([s.timing(Pe,{toValue:-t*o,duration:n,easing:l.out(l.quad),useNativeDriver:!0}),s.timing(ze,{toValue:0,duration:n,useNativeDriver:!0})]),s.timing(Pe,{toValue:t*o,duration:0,useNativeDriver:!0}),s.parallel([s.timing(Pe,{toValue:0,duration:r,easing:l.out(l.cubic),useNativeDriver:!0}),s.timing(ze,{toValue:1,duration:r,useNativeDriver:!0})])]).start();const a=((e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1))(ve,e);we(a),i.announceForAccessibility(formatMonthYear(a,K))},[ve,te,K,ze,Pe,me.components.dateRangePicker,me.motion.duration.fast]),Ne=t(()=>$e(-1),[$e]),Ye=t(()=>$e(1),[$e]),He=t(e=>{if(Me(e.date))return;const t=x(te,"selection");t&&D(t);const o=e.date;if(!xe||xe&&Re)De(o),Se(null);else if(o.getTime()<xe.getTime())De(o),Se(null);else if(isSameDay(o,xe))Se(o);else{if(ee&&((e,t)=>{const o=startOfDay(t).getTime()-startOfDay(e).getTime();return Math.round(o/864e5)})(xe,o)+1>ee)return!1!==te&&D("notificationWarning"),De(o),void Se(null);Se(o)}e.inMonth||we(new Date(e.date.getFullYear(),e.date.getMonth(),1))},[Me,xe,Re,ee,te]),Oe=t(()=>{le?W?.():de(!1)},[le,W]),qe=t(()=>{s.parallel([s.timing(Te,{toValue:0,duration:me.motion.duration.fast,easing:l.bezier(...me.motion.easing.accelerate),useNativeDriver:!1}),s.timing(ke,{toValue:0,duration:me.motion.duration.fast,easing:l.bezier(...me.motion.easing.accelerate),useNativeDriver:!0})]).start(()=>{Oe()})},[Te,Oe,ke,me.motion.duration.fast,me.motion.easing.accelerate]),{handleGesture:Ae}=f({drag:Ce,travel:()=>Be.current||320,onDismiss:qe}),Ee=t(()=>{!1!==te&&D("selection"),qe()},[qe,te]),Xe=t(()=>{xe&&Re&&(!1!==te&&D("notificationSuccess"),I?.({start:xe,end:Re}),qe())},[qe,I,xe,Re,te]),Ge=ke.interpolate({inputRange:[0,1],outputRange:[320,0]}),Je=n(()=>xe&&Re?`${formatRangePart(xe,K)} — ${formatRangePart(Re,K)}`:xe?`${formatRangePart(xe,K)} — …`:"—",[xe,Re,K]),Ke=t(e=>{if(!xe||!Re)return!1;const t=startOfDay(e).getTime();return t>=xe.getTime()&&t<=Re.getTime()},[xe,Re]),Qe=!xe||!Re,Ue=C(m,{style:[he.card,oe,ne],ref:P,accessible:!1,testID:ue,children:[k(p,{gesture:Ae,children:C(m,{style:he.grabArea,children:[k(m,{style:he.handle}),C(m,{style:he.titleRow,children:[k(u,{style:he.title,accessibilityRole:"header",children:U}),k(u,{style:he.subtitle,accessibilityLiveRegion:"polite",children:Je})]})]})}),C(m,{style:he.headerRow,children:[k(d,{onPress:Ne,style:({pressed:e})=>[he.navBtn,e&&he.navBtnPressed,ae],accessibilityRole:"button",accessibilityLabel:"Previous month",hitSlop:8,children:k(u,{style:he.navText,children:"‹"})}),k(s.View,{style:[he.headerLabelWrap,{opacity:ze,transform:[{translateX:Pe}]},re],children:k(u,{style:he.headerLabel,accessibilityLiveRegion:"polite",children:Fe})}),k(d,{onPress:Ye,style:({pressed:e})=>[he.navBtn,e&&he.navBtnPressed,ae],accessibilityRole:"button",accessibilityLabel:"Next month",hitSlop:8,children:k(u,{style:he.navText,children:"›"})})]}),k(m,{style:he.weekdayRow,children:je.map((e,t)=>k(m,{style:he.weekdayCell,children:k(u,{style:he.weekdayText,children:e})},`${e}-${t}`))}),k(s.View,{style:[he.grid,{opacity:ze,transform:[{translateX:Pe}]}],children:Array.from({length:6}).map((e,t)=>k(m,{style:he.gridRow,children:Ve.slice(7*t,7*t+7).map(e=>{const t=Me(e.date),o=!!xe&&isSameDay(e.date,xe),n=!!Re&&isSameDay(e.date,Re),r=Ke(e.date),a=r&&!o&&!n,i=isSameDay(e.date,ye),s=me.colors.primary,l=me.colors.primaryMuted,c=o||n?me.colors.onPrimary:e.inMonth?t?me.colors.text.disabled:me.colors.text.primary:me.colors.text.tertiary,g=t?.3:e.inMonth?1:.4,p=r&&!!xe&&!!Re&&(n||a),h=r&&!!xe&&!!Re&&(o||a),y=o?", start of range":n?", end of range":a?", in selected range":"";return C(d,{disabled:t,onPress:()=>He(e),accessibilityRole:"button",accessibilityLabel:`${formatLongDate(e.date,K)}${y}`,accessibilityState:{selected:o||n,disabled:t,busy:a},style:he.dayCell,children:[p?k(m,{style:[he.barLeft,{backgroundColor:l}],pointerEvents:"none"}):null,h?k(m,{style:[he.barRight,{backgroundColor:l}],pointerEvents:"none"}):null,k(m,{style:[he.dayInner,{backgroundColor:o||n?s:a?l:"transparent",borderColor:!i||o||n?"transparent":s,borderWidth:!i||o||n?0:1.5,borderRadius:a?me.radius.none:me.radius.full,...R,opacity:g}],children:k(u,{style:[he.dayText,{color:c}],children:e.date.getDate()})})]},e.iso)})},`r-${t}`))}),C(m,{style:he.footer,children:[k(d,{onPress:Ee,style:({pressed:e})=>[he.footerBtn,he.footerCancel,e&&he.footerBtnPressed,ie],accessibilityRole:"button",accessibilityLabel:_,children:k(u,{style:[he.footerBtnText,{color:me.colors.text.secondary}],children:_})}),k(d,{onPress:Xe,disabled:Qe,style:({pressed:e})=>[he.footerBtn,he.footerConfirm,{backgroundColor:me.colors.primary,opacity:Qe?.5:1},e&&{backgroundColor:me.colors.primaryHover},ie],accessibilityRole:"button",accessibilityLabel:Z,accessibilityState:{disabled:Qe},children:k(u,{style:[he.footerBtnText,{color:me.colors.onPrimary}],children:Z})})]})]}),Ze=n(()=>{if(!L.start||!L.end)return"";const e={start:L.start,end:L.end};return A?A(e):`${e.start.toLocaleDateString()} – ${e.end.toLocaleDateString()}`},[L.start,L.end,A]);return C(B,{children:[le?null:k(S,{label:M,placeholder:V,helperText:F,error:j,required:$,disabled:N,size:Y,variant:H,clearable:O,onClear:q,value:Ze,onPress:()=>de(!0),triggerStyle:E,testID:se}),k(c,{visible:ge,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:qe,children:C(h,{collapsable:!1,style:[he.backdrop,{backgroundColor:me.colors.background.overlay}],children:[k(d,{style:g.absoluteFill,onPress:qe,accessibilityLabel:"Dismiss"}),k(s.View,{style:[he.sheetWrap,{paddingBottom:Math.max(pe.bottom,me.spacing.lg),opacity:ke,transform:[{translateY:s.add(Ge,Ce)}]}],onLayout:e=>{Be.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:Ue}),k(T,{})]})})]})});P.displayName="DateRangePicker";const buildStyles=e=>{const t=e.shadows.lg;return g.create({backdrop:{...g.absoluteFill},sheetWrap:{position:"absolute",left:0,right:0,bottom:0,paddingHorizontal:e.spacing.md,paddingBottom:e.spacing.lg},card:{backgroundColor:e.colors.background.elevated,borderRadius:e.radius.xl,...R,padding:e.spacing.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.spacing.lg,paddingTop:e.spacing.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.full,...R,backgroundColor:e.colors.border.secondary,marginBottom:e.spacing.sm},titleRow:{marginBottom:e.spacing.sm},title:{fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},subtitle:{marginTop:e.spacing.xxs,fontSize:e.typography.fontSize.sm,color:e.colors.text.secondary},headerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing.md},navBtn:{width:e.components.dateRangePicker?.navButtonSize??36,height:e.components.dateRangePicker?.navButtonSize??36,borderRadius:e.radius.full,...R,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary},navBtnPressed:{backgroundColor:e.colors.surface.pressed},navText:{fontSize:e.components.dateRangePicker?.navTextFontSize??22,lineHeight:e.components.dateRangePicker?.navTextLineHeight??24,color:e.colors.text.primary,fontWeight:e.typography.fontWeight.semibold},headerLabelWrap:{flex:1,alignItems:"center"},headerLabel:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},weekdayRow:{flexDirection:"row",marginBottom:e.spacing.xs},weekdayCell:{flex:1,alignItems:"center",paddingVertical:e.spacing.xs},weekdayText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,color:e.colors.text.tertiary,letterSpacing:e.typography.letterSpacing.wide},grid:{},gridRow:{flexDirection:"row"},dayCell:{flex:1,aspectRatio:1,alignItems:"center",justifyContent:"center",padding:0,position:"relative"},barLeft:{position:"absolute",left:0,right:"50%",top:"5%",bottom:"5%"},barRight:{position:"absolute",left:"50%",right:0,top:"5%",bottom:"5%"},dayInner:{width:"90%",height:"90%",alignItems:"center",justifyContent:"center"},dayText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.spacing.lg,gap:e.spacing.sm},footerBtn:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,borderRadius:e.radius.md,...R,minHeight:e.components.dateRangePicker?.footerButtonMinHeight??40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}})};export{P as DateRangePicker};export default P;
1
+ "use strict";import{forwardRef,useCallback,useEffect,useMemo,useRef,useState}from"react";import{AccessibilityInfo,Animated,Easing,Modal,Pressable,StyleSheet,Text,View}from"react-native";import{GestureDetector,GestureHandlerRootView}from"react-native-gesture-handler";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useDragToDismiss}from"../../hooks/useDragToDismiss.js";import{createAnimatedValue,setNativeValue,useTheme}from"../../theme/index.js";import{resolveHaptic,triggerHaptic}from"../../utils/index.js";import{smoothCorners}from"../../utils/corners.js";import{PickerTrigger}from"../PickerTrigger/index.js";import{ToastHost}from"../Toast/ToastProvider.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const DAY_MS=864e5,startOfDay=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),isSameDay=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),toIso=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,addMonths=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,1),daysBetween=(e,t)=>{const a=startOfDay(t).getTime()-startOfDay(e).getTime();return Math.round(a/DAY_MS)},buildMonthMatrix=(e,t)=>{const a=e.getFullYear(),r=e.getMonth(),o=(new Date(a,r,1).getDay()-t+7)%7,i=[];for(let e=0;e<42;e+=1){const t=new Date(a,r,1-o+e);i.push({date:t,inMonth:t.getMonth()===r,iso:toIso(t)})}return i},weekdayLabels=(e,t)=>{const a=new Intl.DateTimeFormat(e,{weekday:"short"}),r=[];for(let e=0;e<7;e+=1){const o=new Date(1970,0,4+(t+e)%7);r.push(a.format(o))}return r},formatMonthYear=(e,t)=>new Intl.DateTimeFormat(t,{month:"long",year:"numeric"}).format(e),formatRangePart=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"short",day:"numeric",month:"short"}).format(e),formatLongDate=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(e),DateRangePicker=forwardRef((e,t)=>{const{visible:a,value:r,onChange:o,onClose:i,label:n,placeholder:s,helperText:l,error:c,required:d,disabled:g,size:u,variant:m,clearable:y,onClear:f,formatValue:p,triggerStyle:h,minDate:b,maxDate:x,disabledDates:D,locale:w="en-IN",weekStartsOn:S=0,title:v="Select Date Range",confirmLabel:R="Confirm",cancelLabel:T="Cancel",maxRange:k,haptic:j,style:C,containerStyle:P,headerLabelStyle:_,navButtonStyle:V,footerButtonStyle:M,testID:A}=e,B=void 0!==a,[I,L]=useState(!1),z=B?a:I,O=B?A:A?`${A}-calendar`:void 0,H=useTheme(),F=useSafeAreaInsets(),W=useMemo(()=>buildStyles(H),[H]),[E,N]=useState(()=>startOfDay(new Date));useEffect(()=>{z&&N(startOfDay(new Date))},[z]);const $=r.start?startOfDay(r.start):E,[Y,q]=useState($),[G,X]=useState(r.start?startOfDay(r.start):null),[J,K]=useState(r.end?startOfDay(r.end):null),Q=useRef(createAnimatedValue(0)).current,U=useRef(createAnimatedValue(0)).current,Z=useRef(createAnimatedValue(0)).current,ee=useRef(0),te=useRef(createAnimatedValue(0)).current,ae=useRef(createAnimatedValue(1)).current;useEffect(()=>{if(r.start){const e=startOfDay(r.start);X(e),q(e)}else X(null);r.end?K(startOfDay(r.end)):K(null)},[r.start,r.end]),useEffect(()=>{let e;return z&&(Q.setValue(0),setNativeValue(U,0),setNativeValue(Z,0),e=Animated.parallel([Animated.timing(Q,{toValue:1,duration:H.motion.duration.normal,easing:Easing.out(Easing.cubic),useNativeDriver:!1}),Animated.spring(U,{toValue:1,damping:H.motion.spring.gentle.damping,stiffness:H.motion.spring.gentle.stiffness,mass:H.motion.spring.gentle.mass,useNativeDriver:!0})]),e.start()),()=>e?.stop()},[z,Q,U,Z,H.motion]);const re=useMemo(()=>{const e=new Set;return D?.forEach(t=>e.add(toIso(startOfDay(t)))),e},[D]),oe=useMemo(()=>b?startOfDay(b):null,[b]),ie=useMemo(()=>x?startOfDay(x):null,[x]),ne=useCallback(e=>!!(oe&&e.getTime()<oe.getTime())||(!!(ie&&e.getTime()>ie.getTime())||!!re.has(toIso(e))),[oe,ie,re]),se=useMemo(()=>buildMonthMatrix(Y,S),[Y,S]),le=useMemo(()=>formatMonthYear(Y,w),[Y,w]),ce=useMemo(()=>weekdayLabels(w,S),[w,S]),de=useCallback(e=>{!1!==j&&triggerHaptic("impactLight");const t=e>0?1:-1,a=H.components.dateRangePicker?.monthSlideDistance??32,r=H.components.dateRangePicker?.monthSlideOutDuration??H.motion.duration.fast??140,o=H.components.dateRangePicker?.monthSlideInDuration??H.motion.duration.fast??160;Animated.sequence([Animated.parallel([Animated.timing(te,{toValue:-t*a,duration:r,easing:Easing.out(Easing.quad),useNativeDriver:!0}),Animated.timing(ae,{toValue:0,duration:r,useNativeDriver:!0})]),Animated.timing(te,{toValue:t*a,duration:0,useNativeDriver:!0}),Animated.parallel([Animated.timing(te,{toValue:0,duration:o,easing:Easing.out(Easing.cubic),useNativeDriver:!0}),Animated.timing(ae,{toValue:1,duration:o,useNativeDriver:!0})])]).start();const i=addMonths(Y,e);q(i),AccessibilityInfo.announceForAccessibility(formatMonthYear(i,w))},[Y,j,w,ae,te,H.components.dateRangePicker,H.motion.duration.fast]),ge=useCallback(()=>de(-1),[de]),ue=useCallback(()=>de(1),[de]),me=useCallback(e=>{if(ne(e.date))return;const t=resolveHaptic(j,"selection");t&&triggerHaptic(t);const a=e.date;if(!G||G&&J)X(a),K(null);else if(a.getTime()<G.getTime())X(a),K(null);else if(isSameDay(a,G))K(a);else{if(k&&daysBetween(G,a)+1>k)return!1!==j&&triggerHaptic("notificationWarning"),X(a),void K(null);K(a)}e.inMonth||q(new Date(e.date.getFullYear(),e.date.getMonth(),1))},[ne,G,J,k,j]),ye=useCallback(()=>{B?i?.():L(!1)},[B,i]),fe=useCallback(()=>{Animated.parallel([Animated.timing(Q,{toValue:0,duration:H.motion.duration.fast,easing:Easing.bezier(...H.motion.easing.accelerate),useNativeDriver:!1}),Animated.timing(U,{toValue:0,duration:H.motion.duration.fast,easing:Easing.bezier(...H.motion.easing.accelerate),useNativeDriver:!0})]).start(()=>{ye()})},[Q,ye,U,H.motion.duration.fast,H.motion.easing.accelerate]),{handleGesture:pe}=useDragToDismiss({drag:Z,travel:()=>ee.current||320,onDismiss:fe}),he=useCallback(()=>{!1!==j&&triggerHaptic("selection"),fe()},[fe,j]),be=useCallback(()=>{G&&J&&(!1!==j&&triggerHaptic("notificationSuccess"),o?.({start:G,end:J}),fe())},[fe,o,G,J,j]),xe=U.interpolate({inputRange:[0,1],outputRange:[320,0]}),De=useMemo(()=>G&&J?`${formatRangePart(G,w)} — ${formatRangePart(J,w)}`:G?`${formatRangePart(G,w)} — …`:"—",[G,J,w]),we=useCallback(e=>{if(!G||!J)return!1;const t=startOfDay(e).getTime();return t>=G.getTime()&&t<=J.getTime()},[G,J]),Se=!G||!J,ve=_jsxs(View,{style:[W.card,C,P],ref:t,accessible:!1,testID:O,children:[_jsx(GestureDetector,{gesture:pe,children:_jsxs(View,{style:W.grabArea,children:[_jsx(View,{style:W.handle}),_jsxs(View,{style:W.titleRow,children:[_jsx(Text,{style:W.title,accessibilityRole:"header",children:v}),_jsx(Text,{style:W.subtitle,accessibilityLiveRegion:"polite",children:De})]})]})}),_jsxs(View,{style:W.headerRow,children:[_jsx(Pressable,{onPress:ge,style:({pressed:e})=>[W.navBtn,e&&W.navBtnPressed,V],accessibilityRole:"button",accessibilityLabel:"Previous month",hitSlop:8,children:_jsx(Text,{style:W.navText,children:"‹"})}),_jsx(Animated.View,{style:[W.headerLabelWrap,{opacity:ae,transform:[{translateX:te}]},_],children:_jsx(Text,{style:W.headerLabel,accessibilityLiveRegion:"polite",children:le})}),_jsx(Pressable,{onPress:ue,style:({pressed:e})=>[W.navBtn,e&&W.navBtnPressed,V],accessibilityRole:"button",accessibilityLabel:"Next month",hitSlop:8,children:_jsx(Text,{style:W.navText,children:"›"})})]}),_jsx(View,{style:W.weekdayRow,children:ce.map((e,t)=>_jsx(View,{style:W.weekdayCell,children:_jsx(Text,{style:W.weekdayText,children:e})},`${e}-${t}`))}),_jsx(Animated.View,{style:[W.grid,{opacity:ae,transform:[{translateX:te}]}],children:Array.from({length:6}).map((e,t)=>_jsx(View,{style:W.gridRow,children:se.slice(7*t,7*t+7).map(e=>{const t=ne(e.date),a=!!G&&isSameDay(e.date,G),r=!!J&&isSameDay(e.date,J),o=we(e.date),i=o&&!a&&!r,n=isSameDay(e.date,E),s=H.colors.primary,l=H.colors.primaryMuted,c=a||r?H.colors.onPrimary:e.inMonth?t?H.colors.text.disabled:H.colors.text.primary:H.colors.text.tertiary,d=t?.3:e.inMonth?1:.4,g=o&&!!G&&!!J&&(r||i),u=o&&!!G&&!!J&&(a||i),m=a?", start of range":r?", end of range":i?", in selected range":"";return _jsxs(Pressable,{disabled:t,onPress:()=>me(e),accessibilityRole:"button",accessibilityLabel:`${formatLongDate(e.date,w)}${m}`,accessibilityState:{selected:a||r,disabled:t,busy:i},style:W.dayCell,children:[g?_jsx(View,{style:[W.barLeft,{backgroundColor:l}],pointerEvents:"none"}):null,u?_jsx(View,{style:[W.barRight,{backgroundColor:l}],pointerEvents:"none"}):null,_jsx(View,{style:[W.dayInner,{backgroundColor:a||r?s:i?l:"transparent",borderColor:!n||a||r?"transparent":s,borderWidth:!n||a||r?0:1.5,borderRadius:i?H.radius.none:H.radius.full,...smoothCorners,opacity:d}],children:_jsx(Text,{style:[W.dayText,{color:c}],children:e.date.getDate()})})]},e.iso)})},`r-${t}`))}),_jsxs(View,{style:W.footer,children:[_jsx(Pressable,{onPress:he,style:({pressed:e})=>[W.footerBtn,W.footerCancel,e&&W.footerBtnPressed,M],accessibilityRole:"button",accessibilityLabel:T,children:_jsx(Text,{style:[W.footerBtnText,{color:H.colors.text.secondary}],children:T})}),_jsx(Pressable,{onPress:be,disabled:Se,style:({pressed:e})=>[W.footerBtn,W.footerConfirm,{backgroundColor:H.colors.primary,opacity:Se?.5:1},e&&{backgroundColor:H.colors.primaryHover},M],accessibilityRole:"button",accessibilityLabel:R,accessibilityState:{disabled:Se},children:_jsx(Text,{style:[W.footerBtnText,{color:H.colors.onPrimary}],children:R})})]})]}),Re=useMemo(()=>{if(!r.start||!r.end)return"";const e={start:r.start,end:r.end};return p?p(e):`${e.start.toLocaleDateString()} – ${e.end.toLocaleDateString()}`},[r.start,r.end,p]);return _jsxs(_Fragment,{children:[B?null:_jsx(PickerTrigger,{label:n,placeholder:s,helperText:l,error:c,required:d,disabled:g,size:u,variant:m,clearable:y,onClear:f,value:Re,onPress:()=>L(!0),triggerStyle:h,testID:A}),_jsx(Modal,{visible:z,transparent:!0,statusBarTranslucent:!0,navigationBarTranslucent:!0,animationType:"none",onRequestClose:fe,children:_jsxs(GestureHandlerRootView,{collapsable:!1,style:[W.backdrop,{backgroundColor:H.colors.background.overlay}],children:[_jsx(Pressable,{style:StyleSheet.absoluteFill,onPress:fe,accessibilityLabel:"Dismiss"}),_jsx(Animated.View,{style:[W.sheetWrap,{paddingBottom:Math.max(F.bottom,H.spacing.lg),opacity:U,transform:[{translateY:Animated.add(xe,Z)}]}],onLayout:e=>{ee.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:ve}),_jsx(ToastHost,{})]})})]})});DateRangePicker.displayName="DateRangePicker";const buildStyles=e=>{const t=e.shadows.lg;return StyleSheet.create({backdrop:{...StyleSheet.absoluteFill},sheetWrap:{position:"absolute",left:0,right:0,bottom:0,paddingHorizontal:e.spacing.md,paddingBottom:e.spacing.lg},card:{backgroundColor:e.colors.background.elevated,borderRadius:e.radius.xl,...smoothCorners,padding:e.spacing.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.spacing.lg,paddingTop:e.spacing.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.full,...smoothCorners,backgroundColor:e.colors.border.secondary,marginBottom:e.spacing.sm},titleRow:{marginBottom:e.spacing.sm},title:{fontSize:e.typography.fontSize.lg,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},subtitle:{marginTop:e.spacing.xxs,fontSize:e.typography.fontSize.sm,color:e.colors.text.secondary},headerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:e.spacing.md},navBtn:{width:e.components.dateRangePicker?.navButtonSize??36,height:e.components.dateRangePicker?.navButtonSize??36,borderRadius:e.radius.full,...smoothCorners,alignItems:"center",justifyContent:"center",backgroundColor:e.colors.background.secondary},navBtnPressed:{backgroundColor:e.colors.surface.pressed},navText:{fontSize:e.components.dateRangePicker?.navTextFontSize??22,lineHeight:e.components.dateRangePicker?.navTextLineHeight??24,color:e.colors.text.primary,fontWeight:e.typography.fontWeight.semibold},headerLabelWrap:{flex:1,alignItems:"center"},headerLabel:{fontSize:e.typography.fontSize.base,fontWeight:e.typography.fontWeight.semibold,color:e.colors.text.primary},weekdayRow:{flexDirection:"row",marginBottom:e.spacing.xs},weekdayCell:{flex:1,alignItems:"center",paddingVertical:e.spacing.xs},weekdayText:{fontSize:e.typography.fontSize.xs,fontWeight:e.typography.fontWeight.medium,color:e.colors.text.tertiary,letterSpacing:e.typography.letterSpacing.wide},grid:{},gridRow:{flexDirection:"row"},dayCell:{flex:1,aspectRatio:1,alignItems:"center",justifyContent:"center",padding:0,position:"relative"},barLeft:{position:"absolute",left:0,right:"50%",top:"5%",bottom:"5%"},barRight:{position:"absolute",left:"50%",right:0,top:"5%",bottom:"5%"},dayInner:{width:"90%",height:"90%",alignItems:"center",justifyContent:"center"},dayText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.medium},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.spacing.lg,gap:e.spacing.sm},footerBtn:{paddingHorizontal:e.spacing.lg,paddingVertical:e.spacing.sm,borderRadius:e.radius.md,...smoothCorners,minHeight:e.components.dateRangePicker?.footerButtonMinHeight??40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.typography.fontSize.sm,fontWeight:e.typography.fontWeight.semibold}})};export{DateRangePicker};export default DateRangePicker;
@@ -1 +1 @@
1
- export{DateRangePicker,default}from"./DateRangePicker.js";
1
+ "use strict";export{DateRangePicker,default}from"./DateRangePicker.js";
@@ -1 +1 @@
1
- import{forwardRef as e,useEffect as n,useState as t}from"react";import{Platform as r}from"react-native";import{Input as o}from"../Input/index.js";import{jsx as a}from"react/jsx-runtime";export function cleanDecimalText(e,{whole:n,signed:t,decimals:r,allowExponent:o}={}){const a=String(e??"");if(o)return a.replace(/[^\d.eE+-]/g,"");const l=Boolean(t)&&a.replace(/[^\d.-]/g,"").startsWith("-");let i=a.replace(n?/\D/g:/[^\d.]/g,"");const c=i.indexOf(".");if(-1!==c){const e=i.slice(c+1).replace(/\./g,"");i=i.slice(0,c+1)+(null==r?e:e.slice(0,r))}return(l?"-":"")+i}export function parseDecimalText(e){if(""===e||"-"===e||"."===e||"-."===e)return"";const n=Number(e);return Number.isFinite(n)?n:""}const textOf=e=>null==e||""===e?"":String(e);function keyboardFor({whole:e,signed:n,allowExponent:t}){return t?"ios"===r.OS?"numbers-and-punctuation":"default":n?"numeric":e?"number-pad":"decimal-pad"}const l=e((e,r)=>{const{symbol:l,value:i,onChange:c,onBlur:s,min:u,max:m,whole:d=!1,signed:p=!1,decimals:x,allowExponent:f=!1,numeric:g=!1,readOnly:b=!1,disabled:w=!1,...y}=e,[D,T]=t(textOf(i));n(()=>{g&&T(e=>parseDecimalText(e)===i?e:textOf(i))},[g,i]);const h=b||w,v={whole:d,signed:p,decimals:x,allowExponent:f};return a(o,{prefix:l,keyboardType:keyboardFor(v),autoCapitalize:"none",autoCorrect:!1,readOnly:b,disabled:w,...y,ref:r,value:g?D:textOf(i),onChangeText:h?void 0:e=>{const n=cleanDecimalText(e,v),t=f?""===n?"":Number(n):parseDecimalText(n);""!==t&&Number.isFinite(t)&&(null!=m&&t>m||null!=u&&t<u)||(g?(T(n),c?.(parseDecimalText(n))):c?.(n))},onBlur:h?void 0:s})});l.displayName="DecimalInput";export{l as DecimalInput};export default l;
1
+ "use strict";import{forwardRef,useEffect,useState}from"react";import{Platform}from"react-native";import{Input}from"../Input/index.js";import{jsx as _jsx}from"react/jsx-runtime";export function cleanDecimalText(e,{whole:t,signed:n,decimals:r,allowExponent:a}={}){const l=String(e??"");if(a)return l.replace(/[^\d.eE+-]/g,"");const o=Boolean(n)&&l.replace(/[^\d.-]/g,"").startsWith("-");let i=l.replace(t?/\D/g:/[^\d.]/g,"");const c=i.indexOf(".");if(-1!==c){const e=i.slice(c+1).replace(/\./g,"");i=i.slice(0,c+1)+(null==r?e:e.slice(0,r))}return(o?"-":"")+i}export function parseDecimalText(e){if(""===e||"-"===e||"."===e||"-."===e)return"";const t=Number(e);return Number.isFinite(t)?t:""}const textOf=e=>null==e||""===e?"":String(e);function keyboardFor({whole:e,signed:t,allowExponent:n}){return n?"ios"===Platform.OS?"numbers-and-punctuation":"default":t?"numeric":e?"number-pad":"decimal-pad"}const DecimalInput=forwardRef((e,t)=>{const{symbol:n,value:r,onChange:a,onBlur:l,min:o,max:i,whole:c=!1,signed:s=!1,decimals:u,allowExponent:m=!1,numeric:p=!1,readOnly:d=!1,disabled:f=!1,...x}=e,[g,b]=useState(textOf(r));useEffect(()=>{p&&b(e=>parseDecimalText(e)===r?e:textOf(r))},[p,r]);const D=d||f,w={whole:c,signed:s,decimals:u,allowExponent:m};return _jsx(Input,{prefix:n,keyboardType:keyboardFor(w),autoCapitalize:"none",autoCorrect:!1,readOnly:d,disabled:f,...x,ref:t,value:p?g:textOf(r),onChangeText:D?void 0:e=>{const t=cleanDecimalText(e,w),n=m?""===t?"":Number(t):parseDecimalText(t);""!==n&&Number.isFinite(n)&&(null!=i&&n>i||null!=o&&n<o)||(p?(b(t),a?.(parseDecimalText(t))):a?.(t))},onBlur:D?void 0:l})});DecimalInput.displayName="DecimalInput";export{DecimalInput};export default DecimalInput;
@@ -1 +1 @@
1
- export{cleanDecimalText,DecimalInput,default,parseDecimalText}from"./DecimalInput.js";
1
+ "use strict";export{cleanDecimalText,DecimalInput,default,parseDecimalText}from"./DecimalInput.js";
@@ -1 +1 @@
1
- import e,{useMemo as l}from"react";import{StyleSheet as r,Text as t,View as o}from"react-native";import{fontFor as i,useTheme as a}from"../../theme/index.js";import{resolveColor as s}from"../Text/Text.js";import{jsx as n,jsxs as d}from"react/jsx-runtime";const rowKey=(e,l)=>e.key??("string"==typeof e.label?`${e.label}-${l}`:`row-${l}`);export const Descriptions=({items:e,columns:r=1,size:m="md",bordered:c=!1,title:y,variant:p="list",style:u,testID:f})=>{const g=a(),b=l(()=>buildStyles(g),[g]),h="sm"===m?g.typography.fontSize.xs:g.typography.fontSize.sm,x="sm"===m?g.typography.fontSize.sm:g.typography.fontSize.base,S="sm"===m?g.spacing.xs:g.spacing.sm,v="summary"===p;return d(o,{style:[v?null:{gap:S},u],testID:f,children:[y?n(t,{style:[b.title,{fontSize:g.typography.fontSize.lg,color:g.colors.text.primary}],children:y}):null,e.map((e,l)=>{const a=null==(m=e.value)||""===m||Array.isArray(m)&&!m.length;var m;const y=2===r&&!e.full,p=a?g.colors.text.tertiary:s(g,e.tone??"primary"),u=i(g,e.strong?"semibold":"normal");return d(o,v?{style:[b.summaryRow,{paddingVertical:S,borderBottomColor:g.colors.border.secondary}],children:[n(t,{style:[b.summaryLabel,{fontSize:x,color:g.colors.text.secondary}],children:e.label}),"string"==typeof e.value||a?n(t,{style:[b.summaryValue,{fontSize:x,color:p},u],children:a?"-":e.value}):n(o,{children:e.value})]}:{style:[y?b.rowSide:b.rowStack,{paddingVertical:S},c&&l>0?b.bordered:null,c&&l>0?{borderTopColor:g.colors.border.secondary}:null],children:["string"==typeof e.label?n(t,{style:[b.label,{fontSize:h,color:g.colors.text.tertiary},y?b.labelSide:null],children:e.label}):n(o,{style:y?b.labelSide:null,children:e.label}),"string"==typeof e.value||a?n(t,{style:[b.value,{fontSize:x,color:p},e.strong?u:null,y?b.valueSide:null],children:a?"-":e.value}):n(o,{style:y?b.valueSide:null,children:e.value})]},rowKey(e,l))})]})};const buildStyles=e=>r.create({title:{...i(e,"semibold")},rowStack:{gap:2},rowSide:{flexDirection:"row",alignItems:"flex-start",gap:e.spacing.md},bordered:{borderTopWidth:r.hairlineWidth},label:{...i(e,"semibold")},labelSide:{flex:4},value:{...i(e,"normal")},valueSide:{flex:6},summaryRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.md,borderBottomWidth:r.hairlineWidth},summaryLabel:{flex:1,...i(e,"normal")},summaryValue:{textAlign:"right"}});export default Descriptions;
1
+ "use strict";import React,{useMemo}from"react";import{StyleSheet,Text,View}from"react-native";import{fontFor,useTheme}from"../../theme/index.js";import{resolveColor}from"../Text/Text.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const EMPTY_VALUE="-",rowKey=(e,t)=>e.key??("string"==typeof e.label?`${e.label}-${t}`:`row-${t}`),isEmptyValue=e=>null==e||""===e||Array.isArray(e)&&!e.length;export const Descriptions=({items:e,columns:t=1,size:l="md",bordered:r=!1,title:o,variant:s="list",style:i,testID:a})=>{const n=useTheme(),m=useMemo(()=>buildStyles(n),[n]),d="sm"===l?n.typography.fontSize.xs:n.typography.fontSize.sm,y="sm"===l?n.typography.fontSize.sm:n.typography.fontSize.base,c="sm"===l?n.spacing.xs:n.spacing.sm,u="summary"===s;return _jsxs(View,{style:[u?null:{gap:c},i],testID:a,children:[o?_jsx(Text,{style:[m.title,{fontSize:n.typography.fontSize.lg,color:n.colors.text.primary}],children:o}):null,e.map((e,l)=>{const o=isEmptyValue(e.value),s=2===t&&!e.full,i=o?n.colors.text.tertiary:resolveColor(n,e.tone??"primary"),a=fontFor(n,e.strong?"semibold":"normal");return _jsxs(View,u?{style:[m.summaryRow,{paddingVertical:c,borderBottomColor:n.colors.border.secondary}],children:[_jsx(Text,{style:[m.summaryLabel,{fontSize:y,color:n.colors.text.secondary}],children:e.label}),"string"==typeof e.value||o?_jsx(Text,{style:[m.summaryValue,{fontSize:y,color:i},a],children:o?"-":e.value}):_jsx(View,{children:e.value})]}:{style:[s?m.rowSide:m.rowStack,{paddingVertical:c},r&&l>0?m.bordered:null,r&&l>0?{borderTopColor:n.colors.border.secondary}:null],children:["string"==typeof e.label?_jsx(Text,{style:[m.label,{fontSize:d,color:n.colors.text.tertiary},s?m.labelSide:null],children:e.label}):_jsx(View,{style:s?m.labelSide:null,children:e.label}),"string"==typeof e.value||o?_jsx(Text,{style:[m.value,{fontSize:y,color:i},e.strong?a:null,s?m.valueSide:null],children:o?"-":e.value}):_jsx(View,{style:s?m.valueSide:null,children:e.value})]},rowKey(e,l))})]})};const buildStyles=e=>StyleSheet.create({title:{...fontFor(e,"semibold")},rowStack:{gap:2},rowSide:{flexDirection:"row",alignItems:"flex-start",gap:e.spacing.md},bordered:{borderTopWidth:StyleSheet.hairlineWidth},label:{...fontFor(e,"semibold")},labelSide:{flex:4},value:{...fontFor(e,"normal")},valueSide:{flex:6},summaryRow:{flexDirection:"row",alignItems:"center",gap:e.spacing.md,borderBottomWidth:StyleSheet.hairlineWidth},summaryLabel:{flex:1,...fontFor(e,"normal")},summaryValue:{textAlign:"right"}});export default Descriptions;
@@ -1 +1 @@
1
- export{Descriptions,default}from"./Descriptions.js";
1
+ "use strict";export{Descriptions,default}from"./Descriptions.js";
@@ -1 +1 @@
1
- import e,{useCallback as o,useMemo as r}from"react";import{ActivityIndicator as t,Pressable as n,StyleSheet as i,Text as l,View as s}from"react-native";import{fontFor as a,useTheme as c}from"../../theme/index.js";import{smoothCorners as d}from"../../utils/corners.js";import{resolveHaptic as m,triggerHaptic as u}from"../../utils/hapticUtils.js";import{MODAL_DISMISS_GRACE_MS as g,Modal as p}from"../Modal/Modal.js";import{jsx as b,jsxs as y}from"react/jsx-runtime";const Dialog=e=>{const{visible:i,onClose:h,title:f,message:x,children:C,icon:S,variant:B="default",actions:W,dismissOnAction:R=!0,accessibilityLabel:j,contentStyle:z,containerStyle:w,titleStyle:k,messageStyle:I,iconWrapperStyle:H,actionsRowStyle:L,actionButtonStyle:v,actionTextStyle:A,haptic:D,testID:M}=e,P=c(),E=r(()=>buildStyles(P),[P]),O=r(()=>tintForVariant(P,B),[P,B]),T=P.components.dialog,$=T?.iconWrapperSize??48,q=T?.iconWrapperBorderRadius??24,N=T?.actionButtonMinHeight??44,U=Boolean(W&&W.length>0),V=o(e=>{if(e.loading||e.disabled)return;const o=m(D,"selection");o&&u(o),R?(h(),setTimeout(e.onPress,g)):e.onPress()},[R,h,D]);return b(p,{visible:i,onRequestClose:h,haptic:D,presentation:"centered",accessibilityLabel:j??f,contentStyle:z,testID:M,children:y(s,{accessibilityRole:"alert",accessibilityLabel:j??f,style:[E.container,w],children:[S?b(s,{style:[E.iconWrapper,{width:$,height:$,borderRadius:q,...d,backgroundColor:O.muted,marginBottom:P.spacing.md},H],children:S}):null,f?b(l,{style:[E.title,{color:P.colors.text.primary,fontSize:P.typography.fontSize.xl,...a(P,"semibold"),marginBottom:x||null!=C?P.spacing.sm:P.spacing.md},k],accessibilityRole:"header",children:f}):null,x?b(l,{style:[E.message,{color:P.colors.text.secondary,fontSize:P.typography.fontSize.base,lineHeight:P.typography.fontSize.base*P.typography.lineHeight.normal,marginBottom:null!=C?P.spacing.md:U?P.spacing.lg:0},I],children:x}):null,null!=C?b(s,{style:{marginBottom:U?P.spacing.lg:0},children:C}):null,W&&W.length>0?b(s,{style:[E.actionsRow,L],children:W.map((e,o)=>{const r=e.tone??"primary",i=Boolean(e.disabled),s=actionStyleFor(P,r,B,i),c=o===W.length-1;return b(n,{onPress:()=>V(e),disabled:e.loading||i,accessibilityRole:"button",accessibilityLabel:e.label,accessibilityState:{busy:e.loading,disabled:Boolean(e.loading)||i},style:({pressed:o})=>[E.actionButton,{minHeight:N,backgroundColor:s.backgroundColor,borderColor:s.borderColor,borderWidth:s.borderWidth,borderRadius:P.radius.md,...d,paddingVertical:P.spacing.md-2,paddingHorizontal:P.spacing.lg,marginRight:c?0:P.spacing.sm,opacity:e.loading?.7:o&&!i?.85:1},v],children:e.loading?b(t,{size:"small",color:s.textColor}):b(l,{style:[{color:s.textColor,fontSize:P.typography.fontSize.base,...a(P,"semibold"),textAlign:"center"},A],numberOfLines:1,children:e.label})},`${e.label}-${o}`)})}):null]})})};Dialog.displayName="Dialog";const tintForVariant=(e,o)=>{const r=e.colors.background.secondary;switch(o){case"success":return{base:e.colors.success,on:e.colors.onSuccess,muted:r};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,muted:r};case"error":return{base:e.colors.error,on:e.colors.onError,muted:r};case"info":return{base:e.colors.info,on:e.colors.onInfo,muted:r};default:return{base:e.colors.primary,on:e.colors.onPrimary,muted:e.colors.primaryMuted}}},actionStyleFor=(e,o,r,t)=>{if(t)return{backgroundColor:"neutral"===o?"transparent":e.colors.surface.disabled,borderColor:"neutral"===o?e.colors.border.primary:"transparent",borderWidth:"neutral"===o?1:0,textColor:e.colors.text.disabled};switch(o){case"primary":{const o=tintForVariant(e,r);return{backgroundColor:o.base,borderColor:"transparent",borderWidth:0,textColor:o.on}}case"error":return{backgroundColor:e.colors.error,borderColor:"transparent",borderWidth:0,textColor:e.colors.onError};default:return{backgroundColor:"transparent",borderColor:e.colors.border.primary,borderWidth:1,textColor:e.colors.text.primary}}},buildStyles=e=>i.create({container:{alignItems:"stretch"},iconWrapper:{alignItems:"center",justifyContent:"center",alignSelf:"center"},title:{textAlign:"center"},message:{textAlign:"center"},actionsRow:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},actionButton:{flex:1,alignItems:"center",justifyContent:"center"}});export{Dialog};export default Dialog;
1
+ "use strict";import React,{useCallback,useMemo}from"react";import{ActivityIndicator,Pressable,StyleSheet,Text,View}from"react-native";import{fontFor,useTheme}from"../../theme/index.js";import{smoothCorners}from"../../utils/corners.js";import{resolveHaptic,triggerHaptic}from"../../utils/hapticUtils.js";import{MODAL_DISMISS_GRACE_MS,Modal}from"../Modal/Modal.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const Dialog=e=>{const{visible:o,onClose:t,title:r,message:n,children:i,icon:s,variant:l="default",actions:a,dismissOnAction:c=!0,accessibilityLabel:d,contentStyle:u,containerStyle:m,titleStyle:g,messageStyle:b,iconWrapperStyle:p,actionsRowStyle:y,actionButtonStyle:h,actionTextStyle:x,haptic:S,testID:f}=e,C=useTheme(),j=useMemo(()=>buildStyles(C),[C]),_=useMemo(()=>tintForVariant(C,l),[C,l]),M=C.components.dialog,w=M?.iconWrapperSize??48,R=M?.iconWrapperBorderRadius??24,I=M?.actionButtonMinHeight??44,B=Boolean(a&&a.length>0),D=useCallback(e=>{if(e.loading||e.disabled)return;const o=resolveHaptic(S,"selection");o&&triggerHaptic(o),c?(t(),setTimeout(e.onPress,MODAL_DISMISS_GRACE_MS)):e.onPress()},[c,t,S]);return _jsx(Modal,{visible:o,onRequestClose:t,haptic:S,presentation:"centered",accessibilityLabel:d??r,contentStyle:u,testID:f,children:_jsxs(View,{accessibilityRole:"alert",accessibilityLabel:d??r,style:[j.container,m],children:[s?_jsx(View,{style:[j.iconWrapper,{width:w,height:w,borderRadius:R,...smoothCorners,backgroundColor:_.muted,marginBottom:C.spacing.md},p],children:s}):null,r?_jsx(Text,{style:[j.title,{color:C.colors.text.primary,fontSize:C.typography.fontSize.xl,...fontFor(C,"semibold"),marginBottom:n||null!=i?C.spacing.sm:C.spacing.md},g],accessibilityRole:"header",children:r}):null,n?_jsx(Text,{style:[j.message,{color:C.colors.text.secondary,fontSize:C.typography.fontSize.base,lineHeight:C.typography.fontSize.base*C.typography.lineHeight.normal,marginBottom:null!=i?C.spacing.md:B?C.spacing.lg:0},b],children:n}):null,null!=i?_jsx(View,{style:{marginBottom:B?C.spacing.lg:0},children:i}):null,a&&a.length>0?_jsx(View,{style:[j.actionsRow,y],children:a.map((e,o)=>{const t=e.tone??"primary",r=Boolean(e.disabled),n=actionStyleFor(C,t,l,r),i=o===a.length-1;return _jsx(Pressable,{onPress:()=>D(e),disabled:e.loading||r,accessibilityRole:"button",accessibilityLabel:e.label,accessibilityState:{busy:e.loading,disabled:Boolean(e.loading)||r},style:({pressed:o})=>[j.actionButton,{minHeight:I,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:n.borderWidth,borderRadius:C.radius.md,...smoothCorners,paddingVertical:C.spacing.md-2,paddingHorizontal:C.spacing.lg,marginRight:i?0:C.spacing.sm,opacity:e.loading?.7:o&&!r?.85:1},h],children:e.loading?_jsx(ActivityIndicator,{size:"small",color:n.textColor}):_jsx(Text,{style:[{color:n.textColor,fontSize:C.typography.fontSize.base,...fontFor(C,"semibold"),textAlign:"center"},x],numberOfLines:1,children:e.label})},`${e.label}-${o}`)})}):null]})})};Dialog.displayName="Dialog";const tintForVariant=(e,o)=>{const t=e.colors.background.secondary;switch(o){case"success":return{base:e.colors.success,on:e.colors.onSuccess,muted:t};case"warning":return{base:e.colors.warning,on:e.colors.onWarning,muted:t};case"error":return{base:e.colors.error,on:e.colors.onError,muted:t};case"info":return{base:e.colors.info,on:e.colors.onInfo,muted:t};default:return{base:e.colors.primary,on:e.colors.onPrimary,muted:e.colors.primaryMuted}}},actionStyleFor=(e,o,t,r)=>{if(r)return{backgroundColor:"neutral"===o?"transparent":e.colors.surface.disabled,borderColor:"neutral"===o?e.colors.border.primary:"transparent",borderWidth:"neutral"===o?1:0,textColor:e.colors.text.disabled};switch(o){case"primary":{const o=tintForVariant(e,t);return{backgroundColor:o.base,borderColor:"transparent",borderWidth:0,textColor:o.on}}case"error":return{backgroundColor:e.colors.error,borderColor:"transparent",borderWidth:0,textColor:e.colors.onError};default:return{backgroundColor:"transparent",borderColor:e.colors.border.primary,borderWidth:1,textColor:e.colors.text.primary}}},buildStyles=e=>StyleSheet.create({container:{alignItems:"stretch"},iconWrapper:{alignItems:"center",justifyContent:"center",alignSelf:"center"},title:{textAlign:"center"},message:{textAlign:"center"},actionsRow:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},actionButton:{flex:1,alignItems:"center",justifyContent:"center"}});export{Dialog};export default Dialog;
@@ -1 +1 @@
1
- export{Dialog,default}from"./Dialog.js";
1
+ "use strict";export{Dialog,default}from"./Dialog.js";