@webority/mobile-ui 0.148.0 → 0.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (485) hide show
  1. package/dist/canvas-kit/kit.js +13 -56553
  2. package/dist/canvas-kit/manifest.json +20 -41
  3. package/dist/canvas-kit/release.json +6 -6
  4. package/lib/commonjs/components/Accordion/Accordion.js +1 -1
  5. package/lib/commonjs/components/AppIcon/AppIcon.js +1 -1
  6. package/lib/commonjs/components/AppIcon/glyphs.g.js +1 -1
  7. package/lib/commonjs/components/AsyncBlock/AsyncBlock.js +1 -1
  8. package/lib/commonjs/components/AuthedImage/AuthedImage.js +1 -1
  9. package/lib/commonjs/components/AuthedImage/authedImageCache.js +1 -1
  10. package/lib/commonjs/components/Avatar/Avatar.js +1 -1
  11. package/lib/commonjs/components/Badge/Badge.js +1 -1
  12. package/lib/commonjs/components/Banner/Banner.js +1 -1
  13. package/lib/commonjs/components/BarChart/BarChart.js +1 -1
  14. package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
  15. package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
  16. package/lib/commonjs/components/Box/Box.js +1 -1
  17. package/lib/commonjs/components/Card/Card.js +1 -1
  18. package/lib/commonjs/components/Carousel/Carousel.js +1 -1
  19. package/lib/commonjs/components/Chip/Chip.js +1 -1
  20. package/lib/commonjs/components/ChoiceGroup/ChoiceGroup.js +1 -1
  21. package/lib/commonjs/components/Confetti/Confetti.js +1 -1
  22. package/lib/commonjs/components/DatePicker/DatePicker.js +1 -1
  23. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +1 -1
  24. package/lib/commonjs/components/Descriptions/Descriptions.js +1 -1
  25. package/lib/commonjs/components/Dialog/Dialog.js +1 -1
  26. package/lib/commonjs/components/Drawer/Drawer.js +1 -1
  27. package/lib/commonjs/components/FieldBase/useFloatingLabel.js +1 -1
  28. package/lib/commonjs/components/FileViewer/fileSource.js +1 -1
  29. package/lib/commonjs/components/FileViewer/useFileViewerZoom.js +1 -1
  30. package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +1 -1
  31. package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
  32. package/lib/commonjs/components/InlineSelect/InlineSelect.js +1 -1
  33. package/lib/commonjs/components/Input/Input.js +1 -1
  34. package/lib/commonjs/components/ListItem/ListItem.js +1 -1
  35. package/lib/commonjs/components/Markdown/Markdown.js +1 -1
  36. package/lib/commonjs/components/Menu/MenuSurface.js +1 -1
  37. package/lib/commonjs/components/Menu/focusHost.js +1 -1
  38. package/lib/commonjs/components/OptionSheet/OptionSheet.js +1 -1
  39. package/lib/commonjs/components/OptionSheet/optionAccessors.js +1 -0
  40. package/lib/commonjs/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
  41. package/lib/commonjs/components/ProgressRing/ProgressRing.js +1 -1
  42. package/lib/commonjs/components/Radio/RadioGroup.js +1 -1
  43. package/lib/commonjs/components/Rating/Rating.js +1 -1
  44. package/lib/commonjs/components/Repeater/Repeater.js +1 -1
  45. package/lib/commonjs/components/Screen/Screen.js +1 -1
  46. package/lib/commonjs/components/SearchBar/useRecentSearches.js +1 -1
  47. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
  48. package/lib/commonjs/components/Select/Select.js +1 -1
  49. package/lib/commonjs/components/SignaturePad/SignaturePad.js +1 -1
  50. package/lib/commonjs/components/Skeleton/SkeletonContent.js +1 -1
  51. package/lib/commonjs/components/Skeleton/SkeletonList.js +1 -1
  52. package/lib/commonjs/components/SlideToConfirm/SlideToConfirm.js +1 -1
  53. package/lib/commonjs/components/Slider/Slider.js +1 -1
  54. package/lib/commonjs/components/SliderField/SliderField.js +1 -1
  55. package/lib/commonjs/components/SortableList/SortableList.js +1 -1
  56. package/lib/commonjs/components/Sparkline/Sparkline.js +1 -1
  57. package/lib/commonjs/components/SquircleFill/SquircleFill.js +1 -1
  58. package/lib/commonjs/components/StatTile/StatTile.js +1 -1
  59. package/lib/commonjs/components/StatusBadge/StatusBadge.js +1 -1
  60. package/lib/commonjs/components/StatusBadge/statusMap.js +1 -1
  61. package/lib/commonjs/components/Stepper/Stepper.js +1 -1
  62. package/lib/commonjs/components/Swipeable/Swipeable.js +1 -1
  63. package/lib/commonjs/components/Text/Text.js +1 -1
  64. package/lib/commonjs/components/TimePicker/TimePicker.js +1 -1
  65. package/lib/commonjs/components/WheelPicker/Wheel.js +1 -1
  66. package/lib/commonjs/components/WheelPicker/WheelPicker.js +1 -1
  67. package/lib/commonjs/components/ZoomableImage/ZoomableImage.js +1 -1
  68. package/lib/commonjs/form/HookFormField.js +1 -1
  69. package/lib/commonjs/form/path.js +1 -1
  70. package/lib/commonjs/hooks/useControllableState.js +1 -1
  71. package/lib/commonjs/hooks/useDragToDismiss.js +1 -1
  72. package/lib/commonjs/navigation/NavigationScreen.js +1 -1
  73. package/lib/commonjs/specs/NativePdfRasterizer.js +1 -1
  74. package/lib/commonjs/theme/ThemeContext.js +1 -1
  75. package/lib/commonjs/theme/animatedValue.js +1 -1
  76. package/lib/commonjs/theme/componentSizes.js +1 -1
  77. package/lib/commonjs/theme/merge.js +1 -1
  78. package/lib/commonjs/theme/scale.js +1 -1
  79. package/lib/commonjs/utils/complete.js +1 -0
  80. package/lib/commonjs/utils/guards.js +1 -0
  81. package/lib/commonjs/utils/hapticUtils.js +1 -1
  82. package/lib/module/components/Accordion/Accordion.js +1 -1
  83. package/lib/module/components/AppIcon/AppIcon.js +1 -1
  84. package/lib/module/components/AppIcon/glyphs.g.js +1 -1
  85. package/lib/module/components/AsyncBlock/AsyncBlock.js +1 -1
  86. package/lib/module/components/AuthedImage/AuthedImage.js +1 -1
  87. package/lib/module/components/AuthedImage/authedImageCache.js +1 -1
  88. package/lib/module/components/Avatar/Avatar.js +1 -1
  89. package/lib/module/components/Badge/Badge.js +1 -1
  90. package/lib/module/components/Banner/Banner.js +1 -1
  91. package/lib/module/components/BarChart/BarChart.js +1 -1
  92. package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
  93. package/lib/module/components/BottomSheet/BottomSheet.js +1 -1
  94. package/lib/module/components/Box/Box.js +1 -1
  95. package/lib/module/components/Card/Card.js +1 -1
  96. package/lib/module/components/Carousel/Carousel.js +1 -1
  97. package/lib/module/components/Chip/Chip.js +1 -1
  98. package/lib/module/components/ChoiceGroup/ChoiceGroup.js +1 -1
  99. package/lib/module/components/Confetti/Confetti.js +1 -1
  100. package/lib/module/components/DatePicker/DatePicker.js +1 -1
  101. package/lib/module/components/DateRangePicker/DateRangePicker.js +1 -1
  102. package/lib/module/components/Descriptions/Descriptions.js +1 -1
  103. package/lib/module/components/Dialog/Dialog.js +1 -1
  104. package/lib/module/components/Drawer/Drawer.js +1 -1
  105. package/lib/module/components/FieldBase/useFloatingLabel.js +1 -1
  106. package/lib/module/components/FileViewer/fileSource.js +1 -1
  107. package/lib/module/components/FileViewer/useFileViewerZoom.js +1 -1
  108. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +1 -1
  109. package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
  110. package/lib/module/components/InlineSelect/InlineSelect.js +1 -1
  111. package/lib/module/components/Input/Input.js +1 -1
  112. package/lib/module/components/ListItem/ListItem.js +1 -1
  113. package/lib/module/components/Markdown/Markdown.js +1 -1
  114. package/lib/module/components/Menu/MenuSurface.js +1 -1
  115. package/lib/module/components/Menu/focusHost.js +1 -1
  116. package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
  117. package/lib/module/components/OptionSheet/optionAccessors.js +1 -0
  118. package/lib/module/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
  119. package/lib/module/components/ProgressRing/ProgressRing.js +1 -1
  120. package/lib/module/components/Radio/RadioGroup.js +1 -1
  121. package/lib/module/components/Rating/Rating.js +1 -1
  122. package/lib/module/components/Repeater/Repeater.js +1 -1
  123. package/lib/module/components/Screen/Screen.js +1 -1
  124. package/lib/module/components/SearchBar/useRecentSearches.js +1 -1
  125. package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
  126. package/lib/module/components/Select/Select.js +1 -1
  127. package/lib/module/components/SignaturePad/SignaturePad.js +1 -1
  128. package/lib/module/components/Skeleton/SkeletonContent.js +1 -1
  129. package/lib/module/components/Skeleton/SkeletonList.js +1 -1
  130. package/lib/module/components/SlideToConfirm/SlideToConfirm.js +1 -1
  131. package/lib/module/components/Slider/Slider.js +1 -1
  132. package/lib/module/components/SliderField/SliderField.js +1 -1
  133. package/lib/module/components/SortableList/SortableList.js +1 -1
  134. package/lib/module/components/Sparkline/Sparkline.js +1 -1
  135. package/lib/module/components/SquircleFill/SquircleFill.js +1 -1
  136. package/lib/module/components/StatTile/StatTile.js +1 -1
  137. package/lib/module/components/StatusBadge/StatusBadge.js +1 -1
  138. package/lib/module/components/StatusBadge/statusMap.js +1 -1
  139. package/lib/module/components/Stepper/Stepper.js +1 -1
  140. package/lib/module/components/Swipeable/Swipeable.js +1 -1
  141. package/lib/module/components/Text/Text.js +1 -1
  142. package/lib/module/components/TimePicker/TimePicker.js +1 -1
  143. package/lib/module/components/WheelPicker/Wheel.js +1 -1
  144. package/lib/module/components/WheelPicker/WheelPicker.js +1 -1
  145. package/lib/module/components/ZoomableImage/ZoomableImage.js +1 -1
  146. package/lib/module/form/HookFormField.js +1 -1
  147. package/lib/module/form/path.js +1 -1
  148. package/lib/module/hooks/useControllableState.js +1 -1
  149. package/lib/module/hooks/useDragToDismiss.js +1 -1
  150. package/lib/module/navigation/NavigationScreen.js +1 -1
  151. package/lib/module/specs/NativePdfRasterizer.js +1 -1
  152. package/lib/module/theme/ThemeContext.js +1 -1
  153. package/lib/module/theme/animatedValue.js +1 -1
  154. package/lib/module/theme/componentSizes.js +1 -1
  155. package/lib/module/theme/merge.js +1 -1
  156. package/lib/module/theme/scale.js +1 -1
  157. package/lib/module/utils/complete.js +1 -0
  158. package/lib/module/utils/guards.js +1 -0
  159. package/lib/module/utils/hapticUtils.js +1 -1
  160. package/lib/typescript/commonjs/canvasKit/index.d.ts +12 -12
  161. package/lib/typescript/commonjs/canvasKit/meta.d.ts +5 -7
  162. package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +22 -22
  163. package/lib/typescript/commonjs/components/AmountSlider/AmountSlider.d.ts +23 -23
  164. package/lib/typescript/commonjs/components/AnimatePresence/AnimatePresence.d.ts +5 -5
  165. package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +39 -39
  166. package/lib/typescript/commonjs/components/AppIcon/AppIcon.d.ts +7 -7
  167. package/lib/typescript/commonjs/components/AppIcon/defaultIcons.d.ts +2 -1
  168. package/lib/typescript/commonjs/components/AppIcon/glyphs.g.d.ts +233 -233
  169. package/lib/typescript/commonjs/components/AppIcon/slotIcon.d.ts +1 -1
  170. package/lib/typescript/commonjs/components/AppLockOverlay/AppLockOverlay.d.ts +5 -5
  171. package/lib/typescript/commonjs/components/AsyncBlock/AsyncBlock.d.ts +22 -40
  172. package/lib/typescript/commonjs/components/AuthedImage/AuthedImage.d.ts +15 -15
  173. package/lib/typescript/commonjs/components/AuthedImage/authedImageCache.d.ts +2 -2
  174. package/lib/typescript/commonjs/components/Autocomplete/Autocomplete.d.ts +24 -24
  175. package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +36 -36
  176. package/lib/typescript/commonjs/components/Badge/Badge.d.ts +18 -18
  177. package/lib/typescript/commonjs/components/Banner/Banner.d.ts +25 -25
  178. package/lib/typescript/commonjs/components/BarChart/BarChart.d.ts +21 -21
  179. package/lib/typescript/commonjs/components/BottomNavigation/BottomNavigation.d.ts +36 -36
  180. package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +33 -33
  181. package/lib/typescript/commonjs/components/Box/Box.d.ts +27 -27
  182. package/lib/typescript/commonjs/components/Button/Button.d.ts +22 -22
  183. package/lib/typescript/commonjs/components/Calendar/Calendar.d.ts +20 -20
  184. package/lib/typescript/commonjs/components/Calendar/CalendarDay.d.ts +4 -2
  185. package/lib/typescript/commonjs/components/Card/Card.d.ts +41 -41
  186. package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +21 -21
  187. package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +21 -21
  188. package/lib/typescript/commonjs/components/Chip/Chip.d.ts +23 -23
  189. package/lib/typescript/commonjs/components/ChoiceGroup/ChoiceGroup.d.ts +51 -46
  190. package/lib/typescript/commonjs/components/Composer/Composer.d.ts +27 -27
  191. package/lib/typescript/commonjs/components/Confetti/Confetti.d.ts +22 -21
  192. package/lib/typescript/commonjs/components/Confirm/confirm.d.ts +4 -4
  193. package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +20 -20
  194. package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +22 -22
  195. package/lib/typescript/commonjs/components/DateSeparator/DateSeparator.d.ts +9 -9
  196. package/lib/typescript/commonjs/components/DecimalInput/DecimalInput.d.ts +14 -14
  197. package/lib/typescript/commonjs/components/Descriptions/Descriptions.d.ts +13 -13
  198. package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +24 -24
  199. package/lib/typescript/commonjs/components/Dialog/OverlayActions.d.ts +5 -5
  200. package/lib/typescript/commonjs/components/Divider/Divider.d.ts +9 -9
  201. package/lib/typescript/commonjs/components/Drawer/Drawer.d.ts +15 -15
  202. package/lib/typescript/commonjs/components/EmptyState/EmptyState.d.ts +13 -13
  203. package/lib/typescript/commonjs/components/ErrorBoundary/ErrorBoundary.d.ts +8 -8
  204. package/lib/typescript/commonjs/components/FieldBase/Chevron.d.ts +2 -2
  205. package/lib/typescript/commonjs/components/FieldBase/ChoiceText.d.ts +10 -10
  206. package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +54 -54
  207. package/lib/typescript/commonjs/components/FieldBase/useFloatingLabel.d.ts +8 -8
  208. package/lib/typescript/commonjs/components/FilePicker/FilePicker.d.ts +35 -35
  209. package/lib/typescript/commonjs/components/FileViewer/FileViewer.d.ts +10 -10
  210. package/lib/typescript/commonjs/components/FileViewer/fileSource.d.ts +3 -3
  211. package/lib/typescript/commonjs/components/FileViewer/useFileViewerZoom.d.ts +3 -3
  212. package/lib/typescript/commonjs/components/FilterChipRow/FilterChipRow.d.ts +12 -12
  213. package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +35 -35
  214. package/lib/typescript/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +11 -11
  215. package/lib/typescript/commonjs/components/FormField/FormField.d.ts +15 -15
  216. package/lib/typescript/commonjs/components/IconBadge/IconBadge.d.ts +11 -11
  217. package/lib/typescript/commonjs/components/IconButton/IconButton.d.ts +14 -14
  218. package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +14 -14
  219. package/lib/typescript/commonjs/components/InlineSelect/InlineSelect.d.ts +36 -31
  220. package/lib/typescript/commonjs/components/Input/Input.d.ts +47 -47
  221. package/lib/typescript/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +7 -7
  222. package/lib/typescript/commonjs/components/KeyboardToolbar/KeyboardToolbar.d.ts +8 -8
  223. package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +44 -44
  224. package/lib/typescript/commonjs/components/ListSection/ListSection.d.ts +6 -6
  225. package/lib/typescript/commonjs/components/LoaderOverlay/LoaderOverlay.d.ts +17 -11
  226. package/lib/typescript/commonjs/components/Markdown/Markdown.d.ts +15 -15
  227. package/lib/typescript/commonjs/components/Menu/Menu.d.ts +17 -12
  228. package/lib/typescript/commonjs/components/Menu/MenuSurface.d.ts +8 -8
  229. package/lib/typescript/commonjs/components/Menu/menuModel.d.ts +11 -11
  230. package/lib/typescript/commonjs/components/Menu/useContextMenu.d.ts +13 -13
  231. package/lib/typescript/commonjs/components/Menu/webOnly.d.ts +3 -3
  232. package/lib/typescript/commonjs/components/MessageBubble/MessageBubble.d.ts +20 -20
  233. package/lib/typescript/commonjs/components/MessageList/MessageList.d.ts +14 -14
  234. package/lib/typescript/commonjs/components/Modal/Modal.d.ts +19 -19
  235. package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +27 -27
  236. package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +20 -20
  237. package/lib/typescript/commonjs/components/OTPInput/OTPResendRow.d.ts +9 -9
  238. package/lib/typescript/commonjs/components/OnboardingPager/OnboardingPager.d.ts +5 -5
  239. package/lib/typescript/commonjs/components/OptionSheet/OptionSheet.d.ts +33 -33
  240. package/lib/typescript/commonjs/components/OptionSheet/optionAccessors.d.ts +8 -0
  241. package/lib/typescript/commonjs/components/PagedListFooter/PagedListFooter.d.ts +2 -2
  242. package/lib/typescript/commonjs/components/PermissionPrompt/PermissionPrompt.d.ts +6 -6
  243. package/lib/typescript/commonjs/components/PermissionPrompt/usePermissionPrompt.d.ts +1 -1
  244. package/lib/typescript/commonjs/components/PhoneNumberInput/PhoneNumberInput.d.ts +43 -43
  245. package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +23 -23
  246. package/lib/typescript/commonjs/components/ProfileCompletion/ProfileCompletion.d.ts +23 -23
  247. package/lib/typescript/commonjs/components/ProfilePicker/ProfilePicker.d.ts +30 -30
  248. package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +21 -21
  249. package/lib/typescript/commonjs/components/ProgressRing/ProgressRing.d.ts +13 -13
  250. package/lib/typescript/commonjs/components/Radio/Radio.d.ts +18 -18
  251. package/lib/typescript/commonjs/components/Radio/RadioDot.d.ts +5 -5
  252. package/lib/typescript/commonjs/components/Radio/RadioGroup.d.ts +8 -8
  253. package/lib/typescript/commonjs/components/Rating/Rating.d.ts +15 -15
  254. package/lib/typescript/commonjs/components/Repeater/Repeater.d.ts +10 -10
  255. package/lib/typescript/commonjs/components/RichTextEditor/RichTextEditor.d.ts +15 -15
  256. package/lib/typescript/commonjs/components/ScannerOverlay/ScannerOverlay.d.ts +13 -13
  257. package/lib/typescript/commonjs/components/Screen/Screen.d.ts +43 -44
  258. package/lib/typescript/commonjs/components/Screen/index.d.ts +1 -1
  259. package/lib/typescript/commonjs/components/SearchBar/SearchBar.d.ts +31 -31
  260. package/lib/typescript/commonjs/components/SearchBar/SearchPanel.d.ts +6 -6
  261. package/lib/typescript/commonjs/components/SearchBar/useRecentSearches.d.ts +1 -1
  262. package/lib/typescript/commonjs/components/SectionHeader/SectionHeader.d.ts +10 -10
  263. package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +25 -24
  264. package/lib/typescript/commonjs/components/Select/Select.d.ts +50 -45
  265. package/lib/typescript/commonjs/components/SignaturePad/SignaturePad.d.ts +20 -20
  266. package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +13 -13
  267. package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +9 -9
  268. package/lib/typescript/commonjs/components/Skeleton/SkeletonList.d.ts +30 -8
  269. package/lib/typescript/commonjs/components/Skeleton/SkeletonProvider.d.ts +9 -9
  270. package/lib/typescript/commonjs/components/SlideToConfirm/SlideToConfirm.d.ts +14 -14
  271. package/lib/typescript/commonjs/components/Slider/Slider.d.ts +30 -30
  272. package/lib/typescript/commonjs/components/Slider/valueText.d.ts +9 -9
  273. package/lib/typescript/commonjs/components/SliderField/SliderField.d.ts +41 -41
  274. package/lib/typescript/commonjs/components/SortableList/SortableList.d.ts +5 -5
  275. package/lib/typescript/commonjs/components/Sparkline/Sparkline.d.ts +13 -13
  276. package/lib/typescript/commonjs/components/Sparkline/geometry.d.ts +3 -1
  277. package/lib/typescript/commonjs/components/Spinner/Spinner.d.ts +10 -10
  278. package/lib/typescript/commonjs/components/SquircleFill/SquircleFill.d.ts +3 -3
  279. package/lib/typescript/commonjs/components/SquircleImage/SquircleImage.d.ts +5 -12
  280. package/lib/typescript/commonjs/components/StatTile/StatTile.d.ts +14 -14
  281. package/lib/typescript/commonjs/components/StatusBadge/StatusBadge.d.ts +13 -13
  282. package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +21 -21
  283. package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +16 -16
  284. package/lib/typescript/commonjs/components/Switch/Switch.d.ts +19 -19
  285. package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +20 -20
  286. package/lib/typescript/commonjs/components/TagInput/TagInput.d.ts +19 -19
  287. package/lib/typescript/commonjs/components/Text/Text.d.ts +10 -10
  288. package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +14 -14
  289. package/lib/typescript/commonjs/components/Timeline/Timeline.d.ts +12 -12
  290. package/lib/typescript/commonjs/components/Toast/Toast.d.ts +17 -17
  291. package/lib/typescript/commonjs/components/Toast/ToastProvider.d.ts +8 -8
  292. package/lib/typescript/commonjs/components/Tooltip/RichTooltipBody.d.ts +4 -4
  293. package/lib/typescript/commonjs/components/Tooltip/Tooltip.d.ts +24 -19
  294. package/lib/typescript/commonjs/components/Tour/Tour.d.ts +7 -7
  295. package/lib/typescript/commonjs/components/TypingIndicator/TypingIndicator.d.ts +6 -6
  296. package/lib/typescript/commonjs/components/WheelPicker/Wheel.d.ts +6 -6
  297. package/lib/typescript/commonjs/components/WheelPicker/WheelPicker.d.ts +20 -20
  298. package/lib/typescript/commonjs/components/ZoomableImage/ZoomableImage.d.ts +8 -8
  299. package/lib/typescript/commonjs/form/HookFormField.d.ts +5 -18
  300. package/lib/typescript/commonjs/form/path.d.ts +4 -2
  301. package/lib/typescript/commonjs/form/useFormCompletion.d.ts +1 -1
  302. package/lib/typescript/commonjs/hooks/useControllableState.d.ts +2 -2
  303. package/lib/typescript/commonjs/hooks/useDragToDismiss.d.ts +8 -8
  304. package/lib/typescript/commonjs/hooks/useFieldErrorScroll.d.ts +1 -1
  305. package/lib/typescript/commonjs/hooks/usePressAnimation.d.ts +4 -4
  306. package/lib/typescript/commonjs/hooks/useRefreshControl.d.ts +8 -8
  307. package/lib/typescript/commonjs/hooks/useResendCountdown.d.ts +1 -1
  308. package/lib/typescript/commonjs/hooks/useScrollDirection.d.ts +1 -1
  309. package/lib/typescript/commonjs/navigation/DiscardGuard.d.ts +2 -2
  310. package/lib/typescript/commonjs/navigation/NavigationScreen.d.ts +3 -3
  311. package/lib/typescript/commonjs/network/NetworkStatusBanner.d.ts +7 -7
  312. package/lib/typescript/commonjs/theme/Gradient.d.ts +2 -2
  313. package/lib/typescript/commonjs/theme/ThemeContext.d.ts +5 -5
  314. package/lib/typescript/commonjs/theme/componentSizes.d.ts +15 -38
  315. package/lib/typescript/commonjs/theme/types.d.ts +84 -84
  316. package/lib/typescript/commonjs/utils/announce.d.ts +1 -1
  317. package/lib/typescript/commonjs/utils/complete.d.ts +5 -0
  318. package/lib/typescript/commonjs/utils/feedback.d.ts +3 -1
  319. package/lib/typescript/commonjs/utils/guards.d.ts +9 -0
  320. package/lib/typescript/commonjs/utils/placement.d.ts +3 -3
  321. package/lib/typescript/commonjs/utils/squircle.d.ts +2 -2
  322. package/lib/typescript/module/canvasKit/index.d.ts +12 -12
  323. package/lib/typescript/module/canvasKit/meta.d.ts +5 -7
  324. package/lib/typescript/module/components/Accordion/Accordion.d.ts +22 -22
  325. package/lib/typescript/module/components/AmountSlider/AmountSlider.d.ts +23 -23
  326. package/lib/typescript/module/components/AnimatePresence/AnimatePresence.d.ts +5 -5
  327. package/lib/typescript/module/components/AppBar/AppBar.d.ts +39 -39
  328. package/lib/typescript/module/components/AppIcon/AppIcon.d.ts +7 -7
  329. package/lib/typescript/module/components/AppIcon/defaultIcons.d.ts +2 -1
  330. package/lib/typescript/module/components/AppIcon/glyphs.g.d.ts +233 -233
  331. package/lib/typescript/module/components/AppIcon/slotIcon.d.ts +1 -1
  332. package/lib/typescript/module/components/AppLockOverlay/AppLockOverlay.d.ts +5 -5
  333. package/lib/typescript/module/components/AsyncBlock/AsyncBlock.d.ts +22 -40
  334. package/lib/typescript/module/components/AuthedImage/AuthedImage.d.ts +15 -15
  335. package/lib/typescript/module/components/AuthedImage/authedImageCache.d.ts +2 -2
  336. package/lib/typescript/module/components/Autocomplete/Autocomplete.d.ts +24 -24
  337. package/lib/typescript/module/components/Avatar/Avatar.d.ts +36 -36
  338. package/lib/typescript/module/components/Badge/Badge.d.ts +18 -18
  339. package/lib/typescript/module/components/Banner/Banner.d.ts +25 -25
  340. package/lib/typescript/module/components/BarChart/BarChart.d.ts +21 -21
  341. package/lib/typescript/module/components/BottomNavigation/BottomNavigation.d.ts +36 -36
  342. package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +33 -33
  343. package/lib/typescript/module/components/Box/Box.d.ts +27 -27
  344. package/lib/typescript/module/components/Button/Button.d.ts +22 -22
  345. package/lib/typescript/module/components/Calendar/Calendar.d.ts +20 -20
  346. package/lib/typescript/module/components/Calendar/CalendarDay.d.ts +4 -2
  347. package/lib/typescript/module/components/Card/Card.d.ts +41 -41
  348. package/lib/typescript/module/components/Carousel/Carousel.d.ts +21 -21
  349. package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +21 -21
  350. package/lib/typescript/module/components/Chip/Chip.d.ts +23 -23
  351. package/lib/typescript/module/components/ChoiceGroup/ChoiceGroup.d.ts +51 -46
  352. package/lib/typescript/module/components/Composer/Composer.d.ts +27 -27
  353. package/lib/typescript/module/components/Confetti/Confetti.d.ts +22 -21
  354. package/lib/typescript/module/components/Confirm/confirm.d.ts +4 -4
  355. package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +20 -20
  356. package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +22 -22
  357. package/lib/typescript/module/components/DateSeparator/DateSeparator.d.ts +9 -9
  358. package/lib/typescript/module/components/DecimalInput/DecimalInput.d.ts +14 -14
  359. package/lib/typescript/module/components/Descriptions/Descriptions.d.ts +13 -13
  360. package/lib/typescript/module/components/Dialog/Dialog.d.ts +24 -24
  361. package/lib/typescript/module/components/Dialog/OverlayActions.d.ts +5 -5
  362. package/lib/typescript/module/components/Divider/Divider.d.ts +9 -9
  363. package/lib/typescript/module/components/Drawer/Drawer.d.ts +15 -15
  364. package/lib/typescript/module/components/EmptyState/EmptyState.d.ts +13 -13
  365. package/lib/typescript/module/components/ErrorBoundary/ErrorBoundary.d.ts +8 -8
  366. package/lib/typescript/module/components/FieldBase/Chevron.d.ts +2 -2
  367. package/lib/typescript/module/components/FieldBase/ChoiceText.d.ts +10 -10
  368. package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +54 -54
  369. package/lib/typescript/module/components/FieldBase/useFloatingLabel.d.ts +8 -8
  370. package/lib/typescript/module/components/FilePicker/FilePicker.d.ts +35 -35
  371. package/lib/typescript/module/components/FileViewer/FileViewer.d.ts +10 -10
  372. package/lib/typescript/module/components/FileViewer/fileSource.d.ts +3 -3
  373. package/lib/typescript/module/components/FileViewer/useFileViewerZoom.d.ts +3 -3
  374. package/lib/typescript/module/components/FilterChipRow/FilterChipRow.d.ts +12 -12
  375. package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +35 -35
  376. package/lib/typescript/module/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +11 -11
  377. package/lib/typescript/module/components/FormField/FormField.d.ts +15 -15
  378. package/lib/typescript/module/components/IconBadge/IconBadge.d.ts +11 -11
  379. package/lib/typescript/module/components/IconButton/IconButton.d.ts +14 -14
  380. package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +14 -14
  381. package/lib/typescript/module/components/InlineSelect/InlineSelect.d.ts +36 -31
  382. package/lib/typescript/module/components/Input/Input.d.ts +47 -47
  383. package/lib/typescript/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +7 -7
  384. package/lib/typescript/module/components/KeyboardToolbar/KeyboardToolbar.d.ts +8 -8
  385. package/lib/typescript/module/components/ListItem/ListItem.d.ts +44 -44
  386. package/lib/typescript/module/components/ListSection/ListSection.d.ts +6 -6
  387. package/lib/typescript/module/components/LoaderOverlay/LoaderOverlay.d.ts +17 -11
  388. package/lib/typescript/module/components/Markdown/Markdown.d.ts +15 -15
  389. package/lib/typescript/module/components/Menu/Menu.d.ts +17 -12
  390. package/lib/typescript/module/components/Menu/MenuSurface.d.ts +8 -8
  391. package/lib/typescript/module/components/Menu/menuModel.d.ts +11 -11
  392. package/lib/typescript/module/components/Menu/useContextMenu.d.ts +13 -13
  393. package/lib/typescript/module/components/Menu/webOnly.d.ts +3 -3
  394. package/lib/typescript/module/components/MessageBubble/MessageBubble.d.ts +20 -20
  395. package/lib/typescript/module/components/MessageList/MessageList.d.ts +14 -14
  396. package/lib/typescript/module/components/Modal/Modal.d.ts +19 -19
  397. package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +27 -27
  398. package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +20 -20
  399. package/lib/typescript/module/components/OTPInput/OTPResendRow.d.ts +9 -9
  400. package/lib/typescript/module/components/OnboardingPager/OnboardingPager.d.ts +5 -5
  401. package/lib/typescript/module/components/OptionSheet/OptionSheet.d.ts +33 -33
  402. package/lib/typescript/module/components/OptionSheet/optionAccessors.d.ts +8 -0
  403. package/lib/typescript/module/components/PagedListFooter/PagedListFooter.d.ts +2 -2
  404. package/lib/typescript/module/components/PermissionPrompt/PermissionPrompt.d.ts +6 -6
  405. package/lib/typescript/module/components/PermissionPrompt/usePermissionPrompt.d.ts +1 -1
  406. package/lib/typescript/module/components/PhoneNumberInput/PhoneNumberInput.d.ts +43 -43
  407. package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +23 -23
  408. package/lib/typescript/module/components/ProfileCompletion/ProfileCompletion.d.ts +23 -23
  409. package/lib/typescript/module/components/ProfilePicker/ProfilePicker.d.ts +30 -30
  410. package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +21 -21
  411. package/lib/typescript/module/components/ProgressRing/ProgressRing.d.ts +13 -13
  412. package/lib/typescript/module/components/Radio/Radio.d.ts +18 -18
  413. package/lib/typescript/module/components/Radio/RadioDot.d.ts +5 -5
  414. package/lib/typescript/module/components/Radio/RadioGroup.d.ts +8 -8
  415. package/lib/typescript/module/components/Rating/Rating.d.ts +15 -15
  416. package/lib/typescript/module/components/Repeater/Repeater.d.ts +10 -10
  417. package/lib/typescript/module/components/RichTextEditor/RichTextEditor.d.ts +15 -15
  418. package/lib/typescript/module/components/ScannerOverlay/ScannerOverlay.d.ts +13 -13
  419. package/lib/typescript/module/components/Screen/Screen.d.ts +43 -44
  420. package/lib/typescript/module/components/Screen/index.d.ts +1 -1
  421. package/lib/typescript/module/components/SearchBar/SearchBar.d.ts +31 -31
  422. package/lib/typescript/module/components/SearchBar/SearchPanel.d.ts +6 -6
  423. package/lib/typescript/module/components/SearchBar/useRecentSearches.d.ts +1 -1
  424. package/lib/typescript/module/components/SectionHeader/SectionHeader.d.ts +10 -10
  425. package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +25 -24
  426. package/lib/typescript/module/components/Select/Select.d.ts +50 -45
  427. package/lib/typescript/module/components/SignaturePad/SignaturePad.d.ts +20 -20
  428. package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +13 -13
  429. package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +9 -9
  430. package/lib/typescript/module/components/Skeleton/SkeletonList.d.ts +30 -8
  431. package/lib/typescript/module/components/Skeleton/SkeletonProvider.d.ts +9 -9
  432. package/lib/typescript/module/components/SlideToConfirm/SlideToConfirm.d.ts +14 -14
  433. package/lib/typescript/module/components/Slider/Slider.d.ts +30 -30
  434. package/lib/typescript/module/components/Slider/valueText.d.ts +9 -9
  435. package/lib/typescript/module/components/SliderField/SliderField.d.ts +41 -41
  436. package/lib/typescript/module/components/SortableList/SortableList.d.ts +5 -5
  437. package/lib/typescript/module/components/Sparkline/Sparkline.d.ts +13 -13
  438. package/lib/typescript/module/components/Sparkline/geometry.d.ts +3 -1
  439. package/lib/typescript/module/components/Spinner/Spinner.d.ts +10 -10
  440. package/lib/typescript/module/components/SquircleFill/SquircleFill.d.ts +3 -3
  441. package/lib/typescript/module/components/SquircleImage/SquircleImage.d.ts +5 -12
  442. package/lib/typescript/module/components/StatTile/StatTile.d.ts +14 -14
  443. package/lib/typescript/module/components/StatusBadge/StatusBadge.d.ts +13 -13
  444. package/lib/typescript/module/components/Stepper/Stepper.d.ts +21 -21
  445. package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +16 -16
  446. package/lib/typescript/module/components/Switch/Switch.d.ts +19 -19
  447. package/lib/typescript/module/components/Tabs/Tabs.d.ts +20 -20
  448. package/lib/typescript/module/components/TagInput/TagInput.d.ts +19 -19
  449. package/lib/typescript/module/components/Text/Text.d.ts +10 -10
  450. package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +14 -14
  451. package/lib/typescript/module/components/Timeline/Timeline.d.ts +12 -12
  452. package/lib/typescript/module/components/Toast/Toast.d.ts +17 -17
  453. package/lib/typescript/module/components/Toast/ToastProvider.d.ts +8 -8
  454. package/lib/typescript/module/components/Tooltip/RichTooltipBody.d.ts +4 -4
  455. package/lib/typescript/module/components/Tooltip/Tooltip.d.ts +24 -19
  456. package/lib/typescript/module/components/Tour/Tour.d.ts +7 -7
  457. package/lib/typescript/module/components/TypingIndicator/TypingIndicator.d.ts +6 -6
  458. package/lib/typescript/module/components/WheelPicker/Wheel.d.ts +6 -6
  459. package/lib/typescript/module/components/WheelPicker/WheelPicker.d.ts +20 -20
  460. package/lib/typescript/module/components/ZoomableImage/ZoomableImage.d.ts +8 -8
  461. package/lib/typescript/module/form/HookFormField.d.ts +5 -18
  462. package/lib/typescript/module/form/path.d.ts +4 -2
  463. package/lib/typescript/module/form/useFormCompletion.d.ts +1 -1
  464. package/lib/typescript/module/hooks/useControllableState.d.ts +2 -2
  465. package/lib/typescript/module/hooks/useDragToDismiss.d.ts +8 -8
  466. package/lib/typescript/module/hooks/useFieldErrorScroll.d.ts +1 -1
  467. package/lib/typescript/module/hooks/usePressAnimation.d.ts +4 -4
  468. package/lib/typescript/module/hooks/useRefreshControl.d.ts +8 -8
  469. package/lib/typescript/module/hooks/useResendCountdown.d.ts +1 -1
  470. package/lib/typescript/module/hooks/useScrollDirection.d.ts +1 -1
  471. package/lib/typescript/module/navigation/DiscardGuard.d.ts +2 -2
  472. package/lib/typescript/module/navigation/NavigationScreen.d.ts +3 -3
  473. package/lib/typescript/module/network/NetworkStatusBanner.d.ts +7 -7
  474. package/lib/typescript/module/theme/Gradient.d.ts +2 -2
  475. package/lib/typescript/module/theme/ThemeContext.d.ts +5 -5
  476. package/lib/typescript/module/theme/componentSizes.d.ts +15 -38
  477. package/lib/typescript/module/theme/types.d.ts +84 -84
  478. package/lib/typescript/module/utils/announce.d.ts +1 -1
  479. package/lib/typescript/module/utils/complete.d.ts +5 -0
  480. package/lib/typescript/module/utils/feedback.d.ts +3 -1
  481. package/lib/typescript/module/utils/guards.d.ts +9 -0
  482. package/lib/typescript/module/utils/placement.d.ts +3 -3
  483. package/lib/typescript/module/utils/squircle.d.ts +2 -2
  484. package/package.json +11 -11
  485. package/src/specs/NativePdfRasterizer.ts +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.FloatingActionButtonGroup=exports.FloatingActionButton=exports.DEFAULT_FLOATING_ACTION_BUTTON_GROUP_LABELS=void 0;var cache,_mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,n,a=Object.defineProperty,r={__proto__:null,default:e};if(Object(e)!==e)return r;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,r)}for(n in e)"default"!==n&&{}.hasOwnProperty.call(e,n)&&((i=a&&Object.getOwnPropertyDescriptor(e,n))&&(i.get||i.set)?a(r,n,i):r[n]=e[n]);return r}const FAB_SIZES=["sm","md","lg"],FAB_TONES=["primary","success","warning","danger","info","neutral"],FAB_POSITIONS=["bottomRight","bottomLeft","bottomCenter"],toneBackground=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors["bg-muted"];default:return e.colors.primary}},pressedTintFor=(e,t)=>"neutral"===t?e.colors["surface-pressed"]:_color.ACCENT_PRESSED_TINT,toneForeground=(e,t)=>{if("neutral"===t)return e.colors["text-body"];switch(t){case"success":return e.colors["on-success"];case"warning":return e.colors["on-warning"];case"danger":return e.colors["on-danger"];case"info":return e.colors["on-info"];default:return e.colors["on-primary"]}},FloatingActionButton=exports.FloatingActionButton=(0,_react.forwardRef)((e,t)=>{const{icon:i,onPress:n,label:a,collapsed:r=!1,size:o="md",tone:s="primary",position:c,bottomOffset:l,disabled:u=!1,loading:d=!1,hideOnScroll:m=!1,isScrolling:_=!1,accessibilityLabel:p,accessibilityHint:b,haptic:g,style:f,containerStyle:v,labelStyle:h,testID:x}=e;(0,_assertValidValue.assertValidValue)("FloatingActionButton","size",e.size,FAB_SIZES),(0,_assertValidValue.assertValidValue)("FloatingActionButton","tone",e.tone,FAB_TONES),(0,_assertValidValue.assertValidValue)("FloatingActionButton","position",e.position,FAB_POSITIONS);const y=!u&&!d,A=(0,_index.useTheme)(),R=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),N=(0,_react.useMemo)(()=>(0,_index.resolveFloatingActionButtonSize)(A,o),[A,o]),S=(0,_react.useMemo)(()=>buildStyles(A),[A]),{scale:j,opacity:w,pressIn:I,pressOut:E}=(0,_usePressAnimation.usePressAnimation)({enabled:y}),F=(0,_usePresenceMotion.usePresenceMotion)(),V=A.space[A.components["floating-action-button"]["edge-offset"]],C=A.space[A.components["floating-action-button"]["bottom-offset"]],B=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current,P=F.duration("default");(0,_react.useEffect)(()=>{if(!m)return void(0,_index.setNativeValue)(B,1);const e=_reactNative.Animated.timing(B,{toValue:_?0:1,duration:P,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[m,_,B,P,A.motion.ease["in-out"]]);const T=N.diameter+(l??C)+R.bottom+V,O=B.interpolate({inputRange:[0,1],outputRange:F.range(T,0)}),D=(0,_react.useMemo)(()=>_reactNative.Animated.multiply(B,w),[B,w]),L="string"==typeof a&&a.length>0,k=L&&r,M=F.reduced,z=A.space.sm,G=N["label-padding-x"],U=A.motion.duration.fast,q=A.motion.ease["in-out"],$=(0,_reactNativeReanimated.useSharedValue)(k?1:0),[H,W]=(0,_react.useState)(null);(0,_react.useEffect)(()=>{const e=k?1:0;return $.value=M?e:(0,_reactNativeReanimated.withTiming)(e,{duration:U,easing:_reactNativeReanimated.Easing.bezier(...q)}),()=>(0,_reactNativeReanimated.cancelAnimation)($)},[k,M,$,U,q]);const Y=(0,_react.useCallback)(e=>{const t=Math.ceil(e);W(e=>e===t?e:t)},[]),Z=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({paddingHorizontal:G*(1-$.value)}),[G,$]),Q=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=Math.max(0,1-2*$.value);return null===H?$.value>=1?{opacity:e,width:0}:{opacity:e}:{opacity:e,width:(H+z)*(1-$.value)}},[$,H,z]),X=u?A.colors["surface-disabled"]:toneBackground(A,s),J=u?A.colors["text-disabled"]:toneForeground(A,s),K="lg"===o?"md":"sm",ee=d?(0,_jsxRuntime.jsx)(_index2.Spinner,{variant:"circular",size:K,color:J}):(0,_slotIcon.renderSlotIcon)(i,{color:J,size:N.icon,disabled:u}),te=(0,_react.useMemo)(()=>{if(!c)return null;const e=(l??C)+R.bottom;switch(c){case"bottomLeft":return{position:"absolute",bottom:e,left:V};case"bottomCenter":return{position:"absolute",bottom:e,alignSelf:"center"};default:return{position:"absolute",bottom:e,right:V}}},[c,l,R.bottom,C,V]);return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[te,{transform:[{translateY:O},{scale:j}],opacity:D},v,f],pointerEvents:m&&_?"none":"auto",children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:t,onPress:e=>{if(!y)return;const t=(0,_hapticUtils.resolveHaptic)(g,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t),n()},onPressIn:I,onPressOut:E,disabled:!y,accessibilityRole:"button",accessibilityLabel:p,accessibilityHint:b,accessibilityState:{disabled:!y,busy:d},"aria-disabled":!y,"aria-busy":d,testID:x,style:[S.base,L?{height:N.diameter,minWidth:N.diameter,borderRadius:N.diameter/2,..._corners.smoothCorners}:{width:N.diameter,height:N.diameter,borderRadius:N.diameter/2,..._corners.smoothCorners},A.shadow.popover,{backgroundColor:X,opacity:u||d?.55:1}],children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[e&&y?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",testID:"fab-pressed",style:[S.pressedTint,{backgroundColor:pressedTintFor(A,s),borderRadius:N.diameter/2,..._corners.smoothCorners}]}):null,L?(0,_jsxRuntime.jsxs)(_reactNativeReanimated.default.View,{style:[S.extendedRow,Z],children:[ee,(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[S.labelClip,Q],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{onLayout:e=>Y(e.nativeEvent.layout.width),style:[S.label,{color:J,fontSize:N.text,fontWeight:A.weight.semibold,marginLeft:z},h],numberOfLines:1,children:a})})]}):ee]})})})});FloatingActionButton.displayName="FloatingActionButton";const buildStyles=e=>_reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",overflow:"hidden"},pressedTint:{position:"absolute",top:0,right:0,bottom:0,left:0},extendedRow:{flexDirection:"row",alignItems:"center"},labelClip:{flexDirection:"row",overflow:"hidden"},label:{includeFontPadding:!1,flexShrink:0}}),FAB_GROUP_MIN_ACTIONS=2,FAB_GROUP_MAX_ACTIONS=6,FAB_GROUP_RANGE="2 to 6",describeActionProblem=e=>e.length<2?`was given ${e.length} action(s); a menu holds 2 to 6.`:e.length>6?`was given ${e.length} actions; a menu holds 2 to 6, so only the first 6 are drawn.`:e.some(e=>"string"!=typeof e.label||""===e.label.trim())?"has an action without a visible `label`; every menu action needs one.":"",DEFAULT_FLOATING_ACTION_BUTTON_GROUP_LABELS=exports.DEFAULT_FLOATING_ACTION_BUTTON_GROUP_LABELS={quickActions:"Quick actions",expanded:(e,t)=>`${e}, expanded, ${t} ${1===t?"action":"actions"}`,collapsed:e=>`${e}, collapsed`},FloatingActionButtonGroup=e=>{const{primaryIcon:t,primaryActiveIcon:i,actions:n,expanded:a,defaultExpanded:r=!1,onExpandedChange:o,labels:s,position:c="bottomRight",bottomOffset:l,size:u="md",accessibilityLabel:d,haptic:m,hideOnScroll:_=!1,isScrolling:p=!1,containerStyle:b,secondaryActionStyle:g,labelPillStyle:f,labelStyle:v,testID:h}=e;(0,_assertValidValue.assertValidValue)("FloatingActionButtonGroup","size",e.size,FAB_SIZES),(0,_assertValidValue.assertValidValue)("FloatingActionButtonGroup","position",e.position,FAB_POSITIONS);const x=(0,_react.useMemo)(()=>({...DEFAULT_FLOATING_ACTION_BUTTON_GROUP_LABELS,...s}),[s]),y=d??x.quickActions,A=(0,_index.useTheme)(),R=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),N=(0,_react.useMemo)(()=>(0,_index.resolveFloatingActionButtonSize)(A,u),[A,u]),S=(0,_react.useMemo)(()=>buildGroupStyles(A),[A]),j=(0,_usePresenceMotion.usePresenceMotion)(),w=j.duration("default"),I=A.space[A.components["floating-action-button"]["edge-offset"]],E=A.space[A.components["floating-action-button"]["bottom-offset"]],F=A.space[A.components["floating-action-button"]["secondary-gap"]],V=A.components["floating-action-button"]["stagger-ms"],C=(0,_react.useMemo)(()=>n.slice(0,6),[n]),B=C.length,P=(0,_react.useMemo)(()=>C.map((e,t)=>({action:e,index:t})).reverse(),[C]);n.forEach(e=>{(0,_assertValidValue.assertValidValue)("FloatingActionButtonGroup","actions[].tone",e.tone,FAB_TONES)});const T=__DEV__?describeActionProblem(n):"";(0,_react.useEffect)(()=>{__DEV__&&T&&_mobileCore.Logger.warn(`[@webority/mobile-ui] FloatingActionButtonGroup ${T}`)},[T]);const O="boolean"==typeof a,[D,L]=(0,_react.useState)(r),k=O?a:D,M=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current;(0,_react.useEffect)(()=>{if(!_)return void(0,_index.setNativeValue)(M,1);const e=_reactNative.Animated.timing(M,{toValue:p?0:1,duration:w,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[_,p,M,w,A.motion.ease["in-out"]]);const z=_&&p;(0,_react.useEffect)(()=>{z&&k&&(O||L(!1),o?.(!1))},[z,k,O,o]);const G=N.diameter+(l??E)+R.bottom+I,U=M.interpolate({inputRange:[0,1],outputRange:j.range(G,0)}),q=M,$=(0,_react.useRef)((0,_index.createAnimatedValue)(k?1:0)).current,H=(0,_react.useRef)([]),[W,Y]=(0,_react.useState)(0);(0,_react.useEffect)(()=>{const e=H.current;if(e.length!==B){if(e.length<B){const t=e.slice();for(let i=e.length;i<B;i+=1)t.push(new _reactNative.Animated.Value(k?1:0));H.current=t}else H.current=e.slice(0,B);Y(e=>e+1)}},[B]),(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing($,{toValue:k?1:0,duration:w,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver});e.start();const t=H.current.map(e=>_reactNative.Animated.timing(e,{toValue:k?1:0,duration:w,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver})),i=k?t:[...t].reverse(),n=_reactNative.Animated.stagger(V,i);return n.start(),()=>{e.stop(),n.stop()}},[k,$,w,A.motion.ease["in-out"],B,W,V]);const Z=(0,_react.useCallback)(e=>{const t=(0,_hapticUtils.resolveHaptic)(m,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t),O||L(e),o?.(e)},[O,o,m]),Q=(0,_react.useRef)(null),X=(0,_react.useRef)(k),J=(0,_react.useRef)(!1);(0,_react.useEffect)(()=>{if(X.current===k)return;X.current=k;const e=J.current;if(J.current=!1,z||e)return;const t=Q.current;t&&("web"===_reactNative.Platform.OS?t.focus?.():_reactNative.AccessibilityInfo.sendAccessibilityEvent(t,"focus")),(0,_announce.announce)(k?x.expanded(y,B):x.collapsed(y))},[k,z,y,B,x]);const K=(0,_react.useCallback)(()=>{Z(!k)},[k,Z]),ee=(0,_react.useCallback)(e=>{!1!==m&&(0,_hapticUtils.triggerHaptic)("selection"),J.current=!0,e.onPress(),O||L(!1),o?.(!1)},[O,o,m]),te=(0,_react.useCallback)(()=>{k&&Z(!1)},[k,Z]);(0,_react.useEffect)(()=>{if(!k)return;const e=_reactNative.BackHandler.addEventListener("hardwareBackPress",()=>(Z(!1),!0));return()=>e.remove()},[k,Z]),(0,_react.useEffect)(()=>{if(!k||"web"!==_reactNative.Platform.OS)return;const onKeyDown=e=>{"Escape"===e.key&&Z(!1)};return window.addEventListener("keydown",onKeyDown),()=>window.removeEventListener("keydown",onKeyDown)},[k,Z]);const ie=(0,_react.useMemo)(()=>{const e=(l??E)+R.bottom;switch(c){case"bottomLeft":return{position:"absolute",bottom:e,left:I,alignItems:"flex-start"};case"bottomCenter":return{position:"absolute",bottom:e,alignSelf:"center",alignItems:"center"};default:return{position:"absolute",bottom:e,right:I,alignItems:"flex-end"}}},[c,l,R.bottom,E,I]),slotOffset=e=>-(N.diameter+F)*(e+1),ne=(0,_react.useMemo)(()=>{switch(c){case"bottomLeft":return{left:0,right:0,justifyContent:"flex-start"};case"bottomCenter":return{left:0,right:0,justifyContent:"center"};default:return{left:0,right:0,justifyContent:"flex-end"}}},[c]),ae=.78*N.diameter,re=(0,_react.useMemo)(()=>{const e=ae+A.space.sm;switch(c){case"bottomLeft":return{left:e,alignItems:"flex-start"};case"bottomCenter":return{right:N.diameter/2+ae/2+A.space.sm,alignItems:"flex-end"};default:return{right:e,alignItems:"flex-end"}}},[c,ae,N.diameter,A.space.sm]),oe=$.interpolate({inputRange:[0,1],outputRange:[0,.4]}),se=$.interpolate(j.reduced?{inputRange:[0,.5,.5001,1],outputRange:["0deg","0deg","45deg","45deg"]}:{inputRange:[0,1],outputRange:["0deg","45deg"]});return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[k?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:k?"auto":"none",style:[_reactNative.StyleSheet.absoluteFill,{backgroundColor:A.colors.scrim,opacity:oe}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_reactNative.StyleSheet.absoluteFill,onPress:te,accessibilityElementsHidden:!0,importantForAccessibility:"no",testID:h?`${h}-backdrop`:void 0})}):null,(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{pointerEvents:z?"none":"box-none",style:[ie,{transform:[{translateY:U}],opacity:q},b],accessibilityRole:"menu",testID:h,children:[P.map(({action:e,index:t})=>{const i=H.current[t];if(!i)return null;const n=i.interpolate({inputRange:[0,1],outputRange:j.range(0,slotOffset(t))}),a=i.interpolate({inputRange:[0,1],outputRange:j.range(.6,1)}),r=toneBackground(A,e.tone??"primary"),o=toneForeground(A,e.tone??"primary"),s=e.label?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[S.labelSlot,re],testID:h?`${h}-label-${e.key}`:void 0,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[S.labelPill,A.shadow.card,{backgroundColor:A.colors.surface,paddingHorizontal:A.space.sm,paddingVertical:A.space.xs,borderRadius:A.radius.sm,..._corners.smoothCorners},f],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{color:A.colors["text-body"],fontSize:A.text.sm.size,fontWeight:A.weight.medium},v],numberOfLines:1,children:e.label})})}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{pointerEvents:k?"auto":"none",accessibilityElementsHidden:!k,importantForAccessibility:k?"auto":"no-hide-descendants","aria-hidden":!k,style:[S.secondaryRow,ne,{position:"absolute",bottom:0,opacity:i,transform:[{translateY:n},{scale:a}]}],children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>ee(e),focusable:k,accessibilityRole:"menuitem",accessibilityLabel:e.accessibilityLabel,style:[S.fabBase,A.shadow.elevated,{width:ae,height:ae,borderRadius:ae/2,..._corners.smoothCorners,backgroundColor:r},g],testID:h?`${h}-action-${e.key}`:void 0,children:({pressed:t})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[t?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",testID:"fab-pressed",style:[S.pressedTint,{backgroundColor:pressedTintFor(A,e.tone??"primary"),borderRadius:ae/2,..._corners.smoothCorners}]}):null,(0,_slotIcon.renderSlotIcon)(e.icon,{color:o,size:N.icon,disabled:!1})]})}),s]},e.key)}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:Q,onPress:K,accessibilityRole:"button",accessibilityLabel:y,accessibilityState:{expanded:k},"aria-expanded":k,style:[S.fabBase,A.shadow.popover,{width:N.diameter,height:N.diameter,borderRadius:N.diameter/2,..._corners.smoothCorners,backgroundColor:A.colors.primary}],testID:h?`${h}-primary`:void 0,children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[e?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",testID:"fab-pressed",style:[S.pressedTint,{backgroundColor:_color.ACCENT_PRESSED_TINT,borderRadius:N.diameter/2,..._corners.smoothCorners}]}):null,(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:i?void 0:{transform:[{rotate:se}]},children:(0,_slotIcon.renderSlotIcon)(k&&i?i:t,{color:A.colors["on-primary"],size:N.icon,disabled:!1})})]})})]})]})};exports.FloatingActionButtonGroup=FloatingActionButtonGroup;const buildGroupStyles=e=>_reactNative.StyleSheet.create({fabBase:{flexDirection:"row",alignItems:"center",justifyContent:"center",overflow:"hidden"},pressedTint:{position:"absolute",top:0,right:0,bottom:0,left:0},secondaryRow:{flexDirection:"row",alignItems:"center"},labelSlot:{position:"absolute",top:0,bottom:0,justifyContent:"center"},labelPill:{alignSelf:"auto"}});var _default=exports.default=FloatingActionButton;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.FloatingActionButtonGroup=exports.FloatingActionButton=exports.DEFAULT_FLOATING_ACTION_BUTTON_GROUP_LABELS=void 0;var cache,_mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_announce=require("../../utils/announce.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Spinner/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,n,o=Object.defineProperty,a={__proto__:null,default:e};if(Object(e)!==e)return a;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,a)}for(n in e)"default"!==n&&{}.hasOwnProperty.call(e,n)&&((i=o&&Object.getOwnPropertyDescriptor(e,n))&&(i.get||i.set)?o(a,n,i):a[n]=e[n]);return a}const FAB_SIZES=["sm","md","lg"],FAB_TONES=["primary","success","warning","danger","info","neutral"],FAB_POSITIONS=["bottomRight","bottomLeft","bottomCenter"],toneBackground=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors["bg-muted"];default:return e.colors.primary}},pressedTintFor=(e,t)=>"neutral"===t?e.colors["surface-pressed"]:_color.ACCENT_PRESSED_TINT,toneForeground=(e,t)=>{if("neutral"===t)return e.colors["text-body"];switch(t){case"success":return e.colors["on-success"];case"warning":return e.colors["on-warning"];case"danger":return e.colors["on-danger"];case"info":return e.colors["on-info"];default:return e.colors["on-primary"]}},FloatingActionButton=exports.FloatingActionButton=(0,_react.forwardRef)((e,t)=>{const{icon:i,onPress:n,label:o,collapsed:a=!1,size:r="md",tone:s="primary",position:c,bottomOffset:l,disabled:u=!1,loading:d=!1,hideOnScroll:m=!1,isScrolling:_=!1,accessibilityLabel:p,accessibilityHint:b,haptic:f,style:g,containerStyle:v,labelStyle:h,testID:x}=e;(0,_assertValidValue.assertValidValue)("FloatingActionButton","size",e.size,FAB_SIZES),(0,_assertValidValue.assertValidValue)("FloatingActionButton","tone",e.tone,FAB_TONES),(0,_assertValidValue.assertValidValue)("FloatingActionButton","position",e.position,FAB_POSITIONS);const y=!u&&!d,A=(0,_index.useTheme)(),R=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),N=(0,_react.useMemo)(()=>(0,_index.resolveFloatingActionButtonSize)(A,r),[A,r]),S=(0,_react.useMemo)(()=>buildStyles(A),[A]),{scale:j,opacity:w,pressIn:I,pressOut:E}=(0,_usePressAnimation.usePressAnimation)({enabled:y}),F=(0,_usePresenceMotion.usePresenceMotion)(),V=A.space[A.components["floating-action-button"]["edge-offset"]],C=A.space[A.components["floating-action-button"]["bottom-offset"]],B=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current,P=F.duration("default");(0,_react.useEffect)(()=>{if(!m)return void(0,_index.setNativeValue)(B,1);const e=_reactNative.Animated.timing(B,{toValue:_?0:1,duration:P,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[m,_,B,P,A.motion.ease["in-out"]]);const T=N.diameter+(l??C)+R.bottom+V,O=B.interpolate({inputRange:[0,1],outputRange:F.range(T,0)}),D=(0,_react.useMemo)(()=>_reactNative.Animated.multiply(B,w),[B,w]),L="string"==typeof o&&o.length>0,k=L&&a,M=F.reduced,z=A.space.sm,G=N["label-padding-x"],U=A.motion.duration.fast,q=A.motion.ease["in-out"],$=(0,_reactNativeReanimated.useSharedValue)(k?1:0),[H,W]=(0,_react.useState)(null);(0,_react.useEffect)(()=>{const e=k?1:0;return $.value=M?e:(0,_reactNativeReanimated.withTiming)(e,{duration:U,easing:_reactNativeReanimated.Easing.bezier(...q)}),()=>(0,_reactNativeReanimated.cancelAnimation)($)},[k,M,$,U,q]);const Y=(0,_react.useCallback)(e=>{const t=Math.ceil(e);W(e=>e===t?e:t)},[]),Z=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({paddingHorizontal:G*(1-$.value)}),[G,$]),Q=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=Math.max(0,1-2*$.value);return null===H?$.value>=1?{opacity:e,width:0}:{opacity:e}:{opacity:e,width:(H+z)*(1-$.value)}},[$,H,z]),X=u?A.colors["surface-disabled"]:toneBackground(A,s),J=u?A.colors["text-disabled"]:toneForeground(A,s),K="lg"===r?"md":"sm",ee=d?(0,_jsxRuntime.jsx)(_index2.Spinner,{variant:"circular",size:K,color:J}):(0,_slotIcon.renderSlotIcon)(i,{color:J,size:N.icon,disabled:u}),te=(0,_react.useMemo)(()=>{if(!c)return null;const e=(l??C)+R.bottom;switch(c){case"bottomLeft":return{position:"absolute",bottom:e,left:V};case"bottomCenter":return{position:"absolute",bottom:e,alignSelf:"center"};default:return{position:"absolute",bottom:e,right:V}}},[c,l,R.bottom,C,V]);return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[te,{transform:[{translateY:O},{scale:j}],opacity:D},v,g],pointerEvents:m&&_?"none":"auto",children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:t,onPress:e=>{if(!y)return;const t=(0,_hapticUtils.resolveHaptic)(f,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t),n()},onPressIn:I,onPressOut:E,disabled:!y,accessibilityRole:"button",accessibilityLabel:p,accessibilityHint:b,accessibilityState:{disabled:!y,busy:d},"aria-disabled":!y,"aria-busy":d,testID:x,style:[S.base,L?{height:N.diameter,minWidth:N.diameter,borderRadius:N.diameter/2,..._corners.smoothCorners}:{width:N.diameter,height:N.diameter,borderRadius:N.diameter/2,..._corners.smoothCorners},A.shadow.popover,{backgroundColor:X,opacity:u||d?.55:1}],children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[e&&y?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",testID:"fab-pressed",style:[S.pressedTint,{backgroundColor:pressedTintFor(A,s),borderRadius:N.diameter/2,..._corners.smoothCorners}]}):null,L?(0,_jsxRuntime.jsxs)(_reactNativeReanimated.default.View,{style:[S.extendedRow,Z],children:[ee,(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[S.labelClip,Q],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{onLayout:e=>Y(e.nativeEvent.layout.width),style:[S.label,{color:J,fontSize:N.text,fontWeight:A.weight.semibold,marginLeft:z},h],numberOfLines:1,children:o})})]}):ee]})})})});FloatingActionButton.displayName="FloatingActionButton";const buildStyles=e=>_reactNative.StyleSheet.create({base:{flexDirection:"row",alignItems:"center",justifyContent:"center",overflow:"hidden"},pressedTint:{position:"absolute",top:0,right:0,bottom:0,left:0},extendedRow:{flexDirection:"row",alignItems:"center"},labelClip:{flexDirection:"row",overflow:"hidden"},label:{includeFontPadding:!1,flexShrink:0}}),FAB_GROUP_MIN_ACTIONS=2,FAB_GROUP_MAX_ACTIONS=6,FAB_GROUP_RANGE="2 to 6",describeActionProblem=e=>e.length<2?`was given ${e.length} action(s); a menu holds 2 to 6.`:e.length>6?`was given ${e.length} actions; a menu holds 2 to 6, so only the first 6 are drawn.`:e.some(e=>"string"!=typeof e.label||""===e.label.trim())?"has an action without a visible `label`; every menu action needs one.":"",DEFAULT_FLOATING_ACTION_BUTTON_GROUP_LABELS=exports.DEFAULT_FLOATING_ACTION_BUTTON_GROUP_LABELS={quickActions:"Quick actions",expanded:(e,t)=>`${e}, expanded, ${t} ${1===t?"action":"actions"}`,collapsed:e=>`${e}, collapsed`},FloatingActionButtonGroup=e=>{const{primaryIcon:t,primaryActiveIcon:i,actions:n,expanded:o,defaultExpanded:a=!1,onExpandedChange:r,labels:s,position:c="bottomRight",bottomOffset:l,size:u="md",accessibilityLabel:d,haptic:m,hideOnScroll:_=!1,isScrolling:p=!1,containerStyle:b,secondaryActionStyle:f,labelPillStyle:g,labelStyle:v,testID:h}=e;(0,_assertValidValue.assertValidValue)("FloatingActionButtonGroup","size",e.size,FAB_SIZES),(0,_assertValidValue.assertValidValue)("FloatingActionButtonGroup","position",e.position,FAB_POSITIONS);const x=(0,_react.useMemo)(()=>({...DEFAULT_FLOATING_ACTION_BUTTON_GROUP_LABELS,...s}),[s]),y=d??x.quickActions,A=(0,_index.useTheme)(),R=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),N=(0,_react.useMemo)(()=>(0,_index.resolveFloatingActionButtonSize)(A,u),[A,u]),S=(0,_react.useMemo)(()=>buildGroupStyles(A),[A]),j=(0,_usePresenceMotion.usePresenceMotion)(),w=j.duration("default"),I=A.space[A.components["floating-action-button"]["edge-offset"]],E=A.space[A.components["floating-action-button"]["bottom-offset"]],F=A.space[A.components["floating-action-button"]["secondary-gap"]],V=A.components["floating-action-button"]["stagger-ms"],C=(0,_react.useMemo)(()=>n.slice(0,6),[n]),B=C.length,P=(0,_react.useMemo)(()=>C.map((e,t)=>({action:e,index:t})).reverse(),[C]);n.forEach(e=>{(0,_assertValidValue.assertValidValue)("FloatingActionButtonGroup","actions[].tone",e.tone,FAB_TONES)});const T=__DEV__?describeActionProblem(n):"";(0,_react.useEffect)(()=>{__DEV__&&T&&_mobileCore.Logger.warn(`[@webority/mobile-ui] FloatingActionButtonGroup ${T}`)},[T]);const O="boolean"==typeof o,[D,L]=(0,_react.useState)(a),k="boolean"==typeof o?o:D,M=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current;(0,_react.useEffect)(()=>{if(!_)return void(0,_index.setNativeValue)(M,1);const e=_reactNative.Animated.timing(M,{toValue:p?0:1,duration:w,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[_,p,M,w,A.motion.ease["in-out"]]);const z=_&&p;(0,_react.useEffect)(()=>{z&&k&&(O||L(!1),r?.(!1))},[z,k,O,r]);const G=N.diameter+(l??E)+R.bottom+I,U=M.interpolate({inputRange:[0,1],outputRange:j.range(G,0)}),q=M,$=(0,_react.useRef)((0,_index.createAnimatedValue)(k?1:0)).current,H=(0,_react.useRef)([]),[W,Y]=(0,_react.useState)(0);(0,_react.useEffect)(()=>{const e=H.current;if(e.length!==B){if(e.length<B){const t=e.slice();for(let i=e.length;i<B;i+=1)t.push(new _reactNative.Animated.Value(k?1:0));H.current=t}else H.current=e.slice(0,B);Y(e=>e+1)}},[B]),(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing($,{toValue:k?1:0,duration:w,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver});e.start();const t=H.current.map(e=>_reactNative.Animated.timing(e,{toValue:k?1:0,duration:w,easing:_reactNative.Easing.bezier(...A.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver})),i=k?t:[...t].reverse(),n=_reactNative.Animated.stagger(V,i);return n.start(),()=>{e.stop(),n.stop()}},[k,$,w,A.motion.ease["in-out"],B,W,V]);const Z=(0,_react.useCallback)(e=>{const t=(0,_hapticUtils.resolveHaptic)(m,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t),O||L(e),r?.(e)},[O,r,m]),Q=(0,_react.useRef)(null),X=(0,_react.useRef)(k),J=(0,_react.useRef)(!1);(0,_react.useEffect)(()=>{if(X.current===k)return;X.current=k;const e=J.current;if(J.current=!1,z||e)return;const t=Q.current;t&&("web"===_reactNative.Platform.OS?"focus"in t&&"function"==typeof t.focus&&t.focus():_reactNative.AccessibilityInfo.sendAccessibilityEvent(t,"focus")),(0,_announce.announce)(k?x.expanded(y,B):x.collapsed(y))},[k,z,y,B,x]);const K=(0,_react.useCallback)(()=>{Z(!k)},[k,Z]),ee=(0,_react.useCallback)(e=>{!1!==m&&(0,_hapticUtils.triggerHaptic)("selection"),J.current=!0,e.onPress(),O||L(!1),r?.(!1)},[O,r,m]),te=(0,_react.useCallback)(()=>{k&&Z(!1)},[k,Z]);(0,_react.useEffect)(()=>{if(!k)return;const e=_reactNative.BackHandler.addEventListener("hardwareBackPress",()=>(Z(!1),!0));return()=>e.remove()},[k,Z]),(0,_react.useEffect)(()=>{if(!k||"web"!==_reactNative.Platform.OS)return;const onKeyDown=e=>{"Escape"===e.key&&Z(!1)};return window.addEventListener("keydown",onKeyDown),()=>window.removeEventListener("keydown",onKeyDown)},[k,Z]);const ie=(0,_react.useMemo)(()=>{const e=(l??E)+R.bottom;switch(c){case"bottomLeft":return{position:"absolute",bottom:e,left:I,alignItems:"flex-start"};case"bottomCenter":return{position:"absolute",bottom:e,alignSelf:"center",alignItems:"center"};default:return{position:"absolute",bottom:e,right:I,alignItems:"flex-end"}}},[c,l,R.bottom,E,I]),slotOffset=e=>-(N.diameter+F)*(e+1),ne=(0,_react.useMemo)(()=>{switch(c){case"bottomLeft":return{left:0,right:0,justifyContent:"flex-start"};case"bottomCenter":return{left:0,right:0,justifyContent:"center"};default:return{left:0,right:0,justifyContent:"flex-end"}}},[c]),oe=.78*N.diameter,ae=(0,_react.useMemo)(()=>{const e=oe+A.space.sm;switch(c){case"bottomLeft":return{left:e,alignItems:"flex-start"};case"bottomCenter":return{right:N.diameter/2+oe/2+A.space.sm,alignItems:"flex-end"};default:return{right:e,alignItems:"flex-end"}}},[c,oe,N.diameter,A.space.sm]),re=$.interpolate({inputRange:[0,1],outputRange:[0,.4]}),se=$.interpolate(j.reduced?{inputRange:[0,.5,.5001,1],outputRange:["0deg","0deg","45deg","45deg"]}:{inputRange:[0,1],outputRange:["0deg","45deg"]});return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[k?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:k?"auto":"none",style:[_reactNative.StyleSheet.absoluteFill,{backgroundColor:A.colors.scrim,opacity:re}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_reactNative.StyleSheet.absoluteFill,onPress:te,accessibilityElementsHidden:!0,importantForAccessibility:"no",testID:h?`${h}-backdrop`:void 0})}):null,(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{pointerEvents:z?"none":"box-none",style:[ie,{transform:[{translateY:U}],opacity:q},b],accessibilityRole:"menu",testID:h,children:[P.map(({action:e,index:t})=>{const i=H.current[t];if(!i)return null;const n=i.interpolate({inputRange:[0,1],outputRange:j.range(0,slotOffset(t))}),o=i.interpolate({inputRange:[0,1],outputRange:j.range(.6,1)}),a=toneBackground(A,e.tone??"primary"),r=toneForeground(A,e.tone??"primary"),s=e.label?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[S.labelSlot,ae],testID:h?`${h}-label-${e.key}`:void 0,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[S.labelPill,A.shadow.card,{backgroundColor:A.colors.surface,paddingHorizontal:A.space.sm,paddingVertical:A.space.xs,borderRadius:A.radius.sm,..._corners.smoothCorners},g],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{color:A.colors["text-body"],fontSize:A.text.sm.size,fontWeight:A.weight.medium},v],numberOfLines:1,children:e.label})})}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{pointerEvents:k?"auto":"none",accessibilityElementsHidden:!k,importantForAccessibility:k?"auto":"no-hide-descendants","aria-hidden":!k,style:[S.secondaryRow,ne,{position:"absolute",bottom:0,opacity:i,transform:[{translateY:n},{scale:o}]}],children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>ee(e),focusable:k,accessibilityRole:"menuitem",accessibilityLabel:e.accessibilityLabel,style:[S.fabBase,A.shadow.elevated,{width:oe,height:oe,borderRadius:oe/2,..._corners.smoothCorners,backgroundColor:a},f],testID:h?`${h}-action-${e.key}`:void 0,children:({pressed:t})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[t?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",testID:"fab-pressed",style:[S.pressedTint,{backgroundColor:pressedTintFor(A,e.tone??"primary"),borderRadius:oe/2,..._corners.smoothCorners}]}):null,(0,_slotIcon.renderSlotIcon)(e.icon,{color:r,size:N.icon,disabled:!1})]})}),s]},e.key)}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:Q,onPress:K,accessibilityRole:"button",accessibilityLabel:y,accessibilityState:{expanded:k},"aria-expanded":k,style:[S.fabBase,A.shadow.popover,{width:N.diameter,height:N.diameter,borderRadius:N.diameter/2,..._corners.smoothCorners,backgroundColor:A.colors.primary}],testID:h?`${h}-primary`:void 0,children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[e?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",testID:"fab-pressed",style:[S.pressedTint,{backgroundColor:_color.ACCENT_PRESSED_TINT,borderRadius:N.diameter/2,..._corners.smoothCorners}]}):null,(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:i?void 0:{transform:[{rotate:se}]},children:(0,_slotIcon.renderSlotIcon)(k&&i?i:t,{color:A.colors["on-primary"],size:N.icon,disabled:!1})})]})})]})]})};exports.FloatingActionButtonGroup=FloatingActionButtonGroup;const buildGroupStyles=e=>_reactNative.StyleSheet.create({fabBase:{flexDirection:"row",alignItems:"center",justifyContent:"center",overflow:"hidden"},pressedTint:{position:"absolute",top:0,right:0,bottom:0,left:0},secondaryRow:{flexDirection:"row",alignItems:"center"},labelSlot:{position:"absolute",top:0,bottom:0,justifyContent:"center"},labelPill:{alignSelf:"auto"}});var _default=exports.default=FloatingActionButton;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ImageGallery=exports.DEFAULT_IMAGE_GALLERY_LABELS=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index3=require("../Carousel/index.js"),_Modal=require("../Modal/Modal.js"),_index4=require("../Skeleton/index.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,a){if(!a&&e&&e.__esModule)return e;var t,i,l=Object.defineProperty,r={__proto__:null,default:e};if(Object(e)!==e)return r;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,r)}for(i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((t=l&&Object.getOwnPropertyDescriptor(e,i))&&(t.get||t.set)?l(r,i,t):r[i]=e[i]);return r}const DEFAULT_IMAGE_GALLERY_LABELS=exports.DEFAULT_IMAGE_GALLERY_LABELS={gallery:"Image gallery",imageOf:(e,a)=>`Image ${e} of ${a}`,openFullscreen:"Tap to open fullscreen",closeGallery:"Close gallery"},MAX_SCALE_FALLBACK=4,MIN_SCALE_FALLBACK=1,DOUBLE_TAP_SCALE_FALLBACK=2,SPRING_CONFIG={damping:18,stiffness:220,mass:1},ImageGallery=({images:e,initialIndex:a=0,showThumbnails:t=!0,showCounter:i=!0,enableLightbox:l=!0,enablePinchZoom:r=!0,onIndexChange:n,haptic:s,loading:o=!1,accessibilityLabel:c,containerStyle:u,testID:d,labels:m})=>{const _=(0,_index.useTheme)(),h=(0,_react.useMemo)(()=>buildStyles(_),[_]),g=(0,_react.useMemo)(()=>({...DEFAULT_IMAGE_GALLERY_LABELS,...m}),[m]),[x,v]=(0,_react.useState)(clamp(a,0,Math.max(0,e.length-1))),[p,b]=(0,_react.useState)(!1),R=(0,_react.useCallback)(e=>{v(e),n?.(e)},[n]),S=(0,_react.useCallback)(()=>{if(!l)return;const e=(0,_index2.resolveHaptic)(s,"selection");e&&(0,_index2.triggerHaptic)(e),b(!0)},[l,s]),y=(0,_react.useCallback)(()=>{const e=(0,_index2.resolveHaptic)(s,"selection");e&&(0,_index2.triggerHaptic)(e),b(!1)},[s]),I=(0,_react.useCallback)((a,t)=>{const i=a.alt??g.imageOf(t+1,e.length);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:S,accessibilityRole:"image",accessibilityLabel:i,accessibilityHint:l?g.openFullscreen:void 0,style:h.imageWrap,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:a.source,style:h.image,resizeMode:"cover"})})},[l,e.length,S,h,g]),N=(0,_react.useCallback)(e=>(0,_jsxRuntime.jsx)(_reactNative.Image,{source:e.source,style:h.thumbnailImage,resizeMode:"cover"}),[h]),j=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[h.container,u],testID:d,accessibilityLabel:c??g.gallery,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:h.carouselWrap,accessibilityElementsHidden:p,importantForAccessibility:p?"no-hide-descendants":"auto",children:[(0,_jsxRuntime.jsx)(_index3.Carousel,{data:e,defaultIndex:a,onIndexChange:R,renderItem:I,showPagination:!1,showThumbnails:t,renderThumbnail:N,haptic:s}),i&&e.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:h.counterPill,pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:"semibold",style:{color:_.colors["on-scrim"]},accessibilityLabel:g.imageOf(x+1,e.length),children:`${x+1} / ${e.length}`})}):null]}),l?(0,_jsxRuntime.jsx)(Lightbox,{open:p,images:e,initialIndex:x,enablePinchZoom:r,showCounter:i,onClose:y,onIndexChange:R,haptic:s,labels:g}):null]});return o?(0,_jsxRuntime.jsx)(ImageGallerySkeleton,{images:e,showThumbnails:t,showCounter:i,containerStyle:u,testID:d}):j};exports.ImageGallery=ImageGallery,ImageGallery.displayName="ImageGallery";const ImageGallerySkeleton=({images:e,showThumbnails:a=!0,showCounter:t=!0,containerStyle:i,testID:l})=>{const r=(0,_index.useTheme)(),n=Math.min(e?.length||4,6);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{width:"100%"},i],testID:l,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:"relative"},children:[(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:"100%",height:280,radius:"lg"}),t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:"absolute",top:12,right:12},children:(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:44,height:22,radius:"pill"})}):null]}),a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",marginTop:r.space.md},children:Array.from({length:n}).map((e,a)=>(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:64,height:64,radius:"md",style:{marginRight:r.space.sm}},`sk-thumb-${a}`))}):null]})};ImageGallerySkeleton.displayName="ImageGallerySkeleton",ImageGallery.Skeleton=ImageGallerySkeleton;const Lightbox=({open:e,images:a,initialIndex:t,enablePinchZoom:i,showCounter:l,onClose:r,onIndexChange:n,haptic:s,labels:o})=>{const c=(0,_index.useTheme)(),u=(0,_react.useMemo)(()=>buildLightboxStyles(c),[c]),d=(0,_react.useRef)(null),[m,_]=(0,_react.useState)(t),h=(0,_react.useCallback)(e=>{if(e!==m){const a=(0,_index2.resolveHaptic)(s,"selection");a&&(0,_index2.triggerHaptic)(a),_(e),n(e)}},[m,n,s]),g=(0,_react.useCallback)((e,t)=>(0,_jsxRuntime.jsx)(ZoomableImage,{image:e,index:t,total:a.length,active:t===m,enabled:i,maxScale:4,minScale:1,doubleTapScale:2,haptic:s,imageLabel:o.imageOf}),[m,i,a.length,s,o]),x=a[m]?.caption;return(0,_jsxRuntime.jsx)(_Modal.Modal,{open:e,onClose:r,presentation:"fullScreen",backdropPressClose:!1,animateMount:!1,contentStyle:{backgroundColor:"transparent"},children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:u.backdrop,children:[(0,_jsxRuntime.jsx)(_index3.Carousel,{ref:d,data:a,defaultIndex:t,onIndexChange:h,renderItem:g,showPagination:!1,haptic:s}),l&&a.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:u.counterPill,pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:"semibold",style:{color:c.colors["on-scrim"]},accessibilityLabel:o.imageOf(m+1,a.length),children:`${m+1} / ${a.length}`})}):null,(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:r,accessibilityRole:"button",accessibilityLabel:o.closeGallery,style:u.closeButton,hitSlop:12,...(0,_hitSlop.hitSlopMarker)(12),children:(c.settings.icons.close??_defaultIcons.defaultIcons.close)({size:24,color:c.colors["on-scrim"]})}),x?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:u.captionWrap,entering:void 0,accessibilityElementsHidden:!1,children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"body",align:"center",numberOfLines:3,style:u.captionText,children:x})}):null]})})},ZoomableImage=({image:e,index:a,total:t,active:i,enabled:l,maxScale:r,minScale:n,doubleTapScale:s,haptic:o,imageLabel:c})=>{const u=_reactNative.Dimensions.get("window"),d=(0,_reactNativeReanimated.useSharedValue)(1),m=(0,_reactNativeReanimated.useSharedValue)(1),_=(0,_reactNativeReanimated.useSharedValue)(0),h=(0,_reactNativeReanimated.useSharedValue)(0),g=(0,_reactNativeReanimated.useSharedValue)(0),x=(0,_reactNativeReanimated.useSharedValue)(0),v=(0,_react.useCallback)(()=>{d.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),m.value=1,_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),h.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),g.value=0,x.value=0},[d,m,_,h,g,x]);_react.default.useEffect(()=>{i||(d.value=(0,_reactNativeReanimated.withTiming)(1,{duration:150}),_.value=(0,_reactNativeReanimated.withTiming)(0,{duration:150}),h.value=(0,_reactNativeReanimated.withTiming)(0,{duration:150}),m.value=1,g.value=0,x.value=0)},[i,d,_,h,m,g,x]);const p=(0,_react.useCallback)(()=>{!1!==o&&(0,_index2.triggerHaptic)("impactLight")},[o]),b=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pinch().enabled(l).onStart(()=>{"worklet";m.value=d.value}).onUpdate(e=>{"worklet";const a=m.value*e.scale;d.value=a<n?n+.3*(a-n):a>r?r+.2*(a-r):a}).onEnd(()=>{"worklet";return d.value<n?(d.value=(0,_reactNativeReanimated.withSpring)(n,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),h.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),m.value=n,g.value=0,void(x.value=0)):d.value>r?(d.value=(0,_reactNativeReanimated.withSpring)(r,SPRING_CONFIG),void(m.value=r)):void(m.value=d.value)}),[l,d,m,_,h,g,x,n,r]),R=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Pan().minPointers(1).maxPointers(1).onStart(()=>{"worklet";g.value=_.value,x.value=h.value}).onUpdate(e=>{"worklet";d.value<=1||(_.value=g.value+e.translationX,h.value=x.value+e.translationY)}).onEnd(()=>{"worklet";g.value=_.value,x.value=h.value}),[d,_,h,g,x]),S=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Tap().numberOfTaps(2).onEnd(()=>{"worklet";(0,_reactNativeReanimated.runOnJS)(p)(),d.value>1?(d.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),h.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),m.value=1,g.value=0,x.value=0):(d.value=(0,_reactNativeReanimated.withSpring)(s,SPRING_CONFIG),m.value=s)}),[d,m,_,h,g,x,p,s]),y=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Race(b,R,S),[b,R,S]),I=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:_.value},{translateY:h.value},{scale:d.value}]}),[_,h,d]);_react.default.useEffect(()=>{i||v()},[i,v]);const N=e.alt??c(a+1,t);return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:y,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[lightboxImageStyles.container,{width:u.width}],children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.Image,{source:e.source,resizeMode:"contain",style:[lightboxImageStyles.image,I],accessibilityLabel:N,accessible:!0})})})},clamp=(e,a,t)=>Math.min(Math.max(e,a),t),buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},carouselWrap:{width:"100%",position:"relative"},imageWrap:{width:"100%",aspectRatio:16/9,backgroundColor:e.colors["bg-subtle"],overflow:"hidden",borderRadius:e.radius.md,..._corners.smoothCorners},image:{width:"100%",height:"100%"},thumbnailImage:{width:"100%",height:"100%"},counterPill:{position:"absolute",top:12,alignSelf:"center",paddingHorizontal:e.space.md,paddingVertical:e.space.xs,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:"rgba(0,0,0,0.55)"}}),buildLightboxStyles=e=>_reactNative.StyleSheet.create({backdrop:{flex:1,backgroundColor:"#000",justifyContent:"center"},counterPill:{position:"absolute",top:48,alignSelf:"center",paddingHorizontal:e.space.md,paddingVertical:e.space.xs,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:"rgba(0,0,0,0.6)"},closeButton:{position:"absolute",top:44,right:16,width:40,height:40,borderRadius:e.radius.pill,..._corners.smoothCorners,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.5)"},captionWrap:{position:"absolute",left:0,right:0,bottom:32,paddingHorizontal:e.space.xl},captionText:{color:e.colors["on-scrim"],lineHeight:21}}),lightboxImageStyles=_reactNative.StyleSheet.create({container:{flex:1,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"}});var _default=exports.default=ImageGallery;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ImageGallery=exports.DEFAULT_IMAGE_GALLERY_LABELS=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index3=require("../Carousel/index.js"),_Modal=require("../Modal/Modal.js"),_index4=require("../Skeleton/index.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,a){if(!a&&e&&e.__esModule)return e;var t,i,l=Object.defineProperty,r={__proto__:null,default:e};if(Object(e)!==e)return r;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,r)}for(i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((t=l&&Object.getOwnPropertyDescriptor(e,i))&&(t.get||t.set)?l(r,i,t):r[i]=e[i]);return r}const DEFAULT_IMAGE_GALLERY_LABELS=exports.DEFAULT_IMAGE_GALLERY_LABELS={gallery:"Image gallery",imageOf:(e,a)=>`Image ${e} of ${a}`,openFullscreen:"Tap to open fullscreen",closeGallery:"Close gallery"},MAX_SCALE_FALLBACK=4,MIN_SCALE_FALLBACK=1,DOUBLE_TAP_SCALE_FALLBACK=2,SPRING_CONFIG={damping:18,stiffness:220,mass:1},ImageGallery=({images:e,initialIndex:a=0,showThumbnails:t=!0,showCounter:i=!0,enableLightbox:l=!0,enablePinchZoom:r=!0,onIndexChange:n,haptic:s,loading:o=!1,accessibilityLabel:c,containerStyle:u,testID:d,labels:m})=>{const _=(0,_index.useTheme)(),h=(0,_react.useMemo)(()=>buildStyles(_),[_]),g=(0,_react.useMemo)(()=>({...DEFAULT_IMAGE_GALLERY_LABELS,...m}),[m]),[v,x]=(0,_react.useState)(clamp(a,0,Math.max(0,e.length-1))),[p,b]=(0,_react.useState)(!1),R=(0,_react.useCallback)(e=>{x(e),n?.(e)},[n]),y=(0,_react.useCallback)(()=>{if(!l)return;const e=(0,_index2.resolveHaptic)(s,"selection");e&&(0,_index2.triggerHaptic)(e),b(!0)},[l,s]),S=(0,_react.useCallback)(()=>{const e=(0,_index2.resolveHaptic)(s,"selection");e&&(0,_index2.triggerHaptic)(e),b(!1)},[s]),I=(0,_react.useCallback)((a,t)=>{const i=a.alt??g.imageOf(t+1,e.length);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:y,accessibilityRole:"image",accessibilityLabel:i,accessibilityHint:l?g.openFullscreen:void 0,style:h.imageWrap,children:(0,_jsxRuntime.jsx)(_reactNative.Image,{source:a.source,style:h.image,resizeMode:"cover"})})},[l,e.length,y,h,g]),N=(0,_react.useCallback)(e=>(0,_jsxRuntime.jsx)(_reactNative.Image,{source:e.source,style:h.thumbnailImage,resizeMode:"cover"}),[h]),j=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[h.container,u],testID:d,accessibilityLabel:c??g.gallery,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:h.carouselWrap,accessibilityElementsHidden:p,importantForAccessibility:p?"no-hide-descendants":"auto",children:[(0,_jsxRuntime.jsx)(_index3.Carousel,{data:e,defaultIndex:a,onIndexChange:R,renderItem:I,showPagination:!1,showThumbnails:t,renderThumbnail:N,haptic:s}),i&&e.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:h.counterPill,pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:"semibold",style:{color:_.colors["on-scrim"]},accessibilityLabel:g.imageOf(v+1,e.length),children:`${v+1} / ${e.length}`})}):null]}),l?(0,_jsxRuntime.jsx)(Lightbox,{open:p,images:e,initialIndex:v,enablePinchZoom:r,showCounter:i,onClose:S,onIndexChange:R,haptic:s,labels:g}):null]});return o?(0,_jsxRuntime.jsx)(ImageGallerySkeleton,{images:e,showThumbnails:t,showCounter:i,containerStyle:u,testID:d}):j};exports.ImageGallery=ImageGallery,ImageGallery.displayName="ImageGallery";const ImageGallerySkeleton=({images:e,showThumbnails:a=!0,showCounter:t=!0,containerStyle:i,testID:l})=>{const r=(0,_index.useTheme)(),n=Math.min(e?.length||4,6);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{width:"100%"},i],testID:l,accessibilityRole:"progressbar",accessibilityState:{busy:!0},"aria-busy":!0,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:"relative"},children:[(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:"100%",height:280,radius:"lg"}),t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:"absolute",top:12,right:12},children:(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:44,height:22,radius:"pill"})}):null]}),a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",marginTop:r.space.md},children:Array.from({length:n}).map((e,a)=>(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:64,height:64,radius:"md",style:{marginRight:r.space.sm}},`sk-thumb-${a}`))}):null]})};ImageGallerySkeleton.displayName="ImageGallerySkeleton",ImageGallery.Skeleton=ImageGallerySkeleton;const Lightbox=({open:e,images:a,initialIndex:t,enablePinchZoom:i,showCounter:l,onClose:r,onIndexChange:n,haptic:s,labels:o})=>{const c=(0,_index.useTheme)(),u=(0,_react.useMemo)(()=>buildLightboxStyles(c),[c]),d=(0,_react.useRef)(null),[m,_]=(0,_react.useState)(t),h=(0,_react.useCallback)(e=>{if(e!==m){const a=(0,_index2.resolveHaptic)(s,"selection");a&&(0,_index2.triggerHaptic)(a),_(e),n(e)}},[m,n,s]),g=(0,_react.useCallback)((e,t)=>(0,_jsxRuntime.jsx)(ZoomableImage,{image:e,index:t,total:a.length,active:t===m,enabled:i,maxScale:4,minScale:1,doubleTapScale:2,haptic:s,imageLabel:o.imageOf}),[m,i,a.length,s,o]),v=a[m]?.caption;return(0,_jsxRuntime.jsx)(_Modal.Modal,{open:e,onClose:r,presentation:"fullScreen",backdropPressClose:!1,animateMount:!1,contentStyle:{backgroundColor:"transparent"},children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:u.backdrop,children:[(0,_jsxRuntime.jsx)(_index3.Carousel,{ref:d,data:a,defaultIndex:t,onIndexChange:h,renderItem:g,showPagination:!1,haptic:s}),l&&a.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:u.counterPill,pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"label",weight:"semibold",style:{color:c.colors["on-scrim"]},accessibilityLabel:o.imageOf(m+1,a.length),children:`${m+1} / ${a.length}`})}):null,(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:r,accessibilityRole:"button",accessibilityLabel:o.closeGallery,style:u.closeButton,hitSlop:12,...(0,_hitSlop.hitSlopMarker)(12),children:(c.settings.icons.close??_defaultIcons.defaultIcons.close)({size:24,color:c.colors["on-scrim"]})}),v?(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:u.captionWrap,accessibilityElementsHidden:!1,children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"body",align:"center",numberOfLines:3,style:u.captionText,children:v})}):null]})})},ZoomableImage=({image:e,index:a,total:t,active:i,enabled:l,maxScale:r,minScale:n,doubleTapScale:s,haptic:o,imageLabel:c})=>{const u=_reactNative.Dimensions.get("window"),d=(0,_reactNativeReanimated.useSharedValue)(1),m=(0,_reactNativeReanimated.useSharedValue)(1),_=(0,_reactNativeReanimated.useSharedValue)(0),h=(0,_reactNativeReanimated.useSharedValue)(0),g=(0,_reactNativeReanimated.useSharedValue)(0),v=(0,_reactNativeReanimated.useSharedValue)(0),x=(0,_react.useCallback)(()=>{d.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),m.value=1,_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),h.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),g.value=0,v.value=0},[d,m,_,h,g,v]);_react.default.useEffect(()=>{i||(d.value=(0,_reactNativeReanimated.withTiming)(1,{duration:150}),_.value=(0,_reactNativeReanimated.withTiming)(0,{duration:150}),h.value=(0,_reactNativeReanimated.withTiming)(0,{duration:150}),m.value=1,g.value=0,v.value=0)},[i,d,_,h,m,g,v]);const p=(0,_react.useCallback)(()=>{!1!==o&&(0,_index2.triggerHaptic)("impactLight")},[o]),b=(0,_react.useMemo)(()=>({enabled:l,onActivate:()=>{"worklet";m.value=d.value},onUpdate:e=>{"worklet";const a=m.value*e.scale;d.value=a<n?n+.3*(a-n):a>r?r+.2*(a-r):a},onDeactivate:()=>{"worklet";return d.value<n?(d.value=(0,_reactNativeReanimated.withSpring)(n,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),h.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),m.value=n,g.value=0,void(v.value=0)):d.value>r?(d.value=(0,_reactNativeReanimated.withSpring)(r,SPRING_CONFIG),void(m.value=r)):void(m.value=d.value)}}),[l,d,m,_,h,g,v,n,r]),R=(0,_reactNativeGestureHandler.usePinchGesture)(b),y=(0,_react.useMemo)(()=>({minPointers:1,maxPointers:1,onActivate:()=>{"worklet";g.value=_.value,v.value=h.value},onUpdate:e=>{"worklet";d.value<=1||(_.value=g.value+e.translationX,h.value=v.value+e.translationY)},onDeactivate:()=>{"worklet";g.value=_.value,v.value=h.value}}),[d,_,h,g,v]),S=(0,_reactNativeGestureHandler.usePanGesture)(y),I=(0,_react.useMemo)(()=>({numberOfTaps:2,onDeactivate:()=>{"worklet";(0,_reactNativeReanimated.runOnJS)(p)(),d.value>1?(d.value=(0,_reactNativeReanimated.withSpring)(1,SPRING_CONFIG),_.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),h.value=(0,_reactNativeReanimated.withSpring)(0,SPRING_CONFIG),m.value=1,g.value=0,v.value=0):(d.value=(0,_reactNativeReanimated.withSpring)(s,SPRING_CONFIG),m.value=s)}}),[d,m,_,h,g,v,p,s]),N=(0,_reactNativeGestureHandler.useTapGesture)(I),j=(0,_reactNativeGestureHandler.useCompetingGestures)(R,S,N),w=(0,_reactNativeReanimated.useAnimatedStyle)(()=>({transform:[{translateX:_.value},{translateY:h.value},{scale:d.value}]}),[_,h,d]);_react.default.useEffect(()=>{i||x()},[i,x]);const C=e.alt??c(a+1,t);return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:j,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[lightboxImageStyles.container,{width:u.width}],children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.Image,{source:e.source,resizeMode:"contain",style:[lightboxImageStyles.image,w],accessibilityLabel:C,accessible:!0})})})},clamp=(e,a,t)=>Math.min(Math.max(e,a),t),buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},carouselWrap:{width:"100%",position:"relative"},imageWrap:{width:"100%",aspectRatio:16/9,backgroundColor:e.colors["bg-subtle"],overflow:"hidden",borderRadius:e.radius.md,..._corners.smoothCorners},image:{width:"100%",height:"100%"},thumbnailImage:{width:"100%",height:"100%"},counterPill:{position:"absolute",top:12,alignSelf:"center",paddingHorizontal:e.space.md,paddingVertical:e.space.xs,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:"rgba(0,0,0,0.55)"}}),buildLightboxStyles=e=>_reactNative.StyleSheet.create({backdrop:{flex:1,backgroundColor:"#000",justifyContent:"center"},counterPill:{position:"absolute",top:48,alignSelf:"center",paddingHorizontal:e.space.md,paddingVertical:e.space.xs,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:"rgba(0,0,0,0.6)"},closeButton:{position:"absolute",top:44,right:16,width:40,height:40,borderRadius:e.radius.pill,..._corners.smoothCorners,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.5)"},captionWrap:{position:"absolute",left:0,right:0,bottom:32,paddingHorizontal:e.space.xl},captionText:{color:e.colors["on-scrim"],lineHeight:21}}),lightboxImageStyles=_reactNative.StyleSheet.create({container:{flex:1,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"}});var _default=exports.default=ImageGallery;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.InlineSelect=exports.DEFAULT_INLINE_SELECT_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_hitSlop=require("../../utils/hitSlop.js"),_Chevron=require("../FieldBase/Chevron.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INLINE_SELECT_LABELS=exports.DEFAULT_INLINE_SELECT_LABELS={select:"Select",options:"Options",noSelection:"No selection",selected:e=>`Selected: ${e}`},InlineSelect=exports.InlineSelect=(0,_react.forwardRef)((e,t)=>{const{options:i,getOptionLabel:l,getOptionValue:s,isOptionDisabled:a,getOptionDescription:n,getOptionIcon:r,value:o,onChange:c,placeholder:d,labels:u,label:p,title:_,searchable:x=!1,haptic:S,disabled:b=!1,size:h="md",color:m,chevronColor:L,chevronSize:g,textStyle:j,style:y,optionStyle:v,selectedOptionStyle:O,optionTextStyle:I,selectedOptionTextStyle:C,accessibilityLabel:E,testID:f}=e,T=(0,_index.useTheme)(),N=Object.keys(T.components.field);(0,_assertValidValue.assertValidValue)("InlineSelect","size",e.size,N);const F=(0,_react.useMemo)(()=>buildStyles(T),[T]),D=N.includes(h)?h:"md",R=(0,_index.resolveFieldSize)(T,D),V=(0,_react.useMemo)(()=>({...DEFAULT_INLINE_SELECT_LABELS,...u}),[u]),k=(0,_react.useCallback)(e=>l?l(e):e.label??"",[l]),q=(0,_react.useCallback)(e=>s?s(e):e.value,[s]),B=(0,_react.useCallback)(e=>a?a(e):!0===e.disabled,[a]),z=(0,_react.useCallback)(e=>n?n(e):e.description,[n]),A=(0,_react.useCallback)(e=>r?r(e):e.icon,[r]),[M,H]=(0,_react.useState)(!1),P=(0,_react.useMemo)(()=>{if(null!=o)return i.find(e=>q(e)===o)},[i,o,q]),U=(0,_react.useCallback)(()=>{if(b)return;const e=(0,_index2.resolveHaptic)(S,"selection");e&&(0,_index2.triggerHaptic)(e),H(!0)},[b,S]),w=(0,_react.useCallback)(()=>{H(!1)},[]),$=(0,_react.useCallback)(e=>{if(B(e))return;const t=(0,_index2.resolveHaptic)(S,"selection");t&&(0,_index2.triggerHaptic)(t),c(q(e)),w()},[B,q,c,w,S]),G=b?T.colors["text-disabled"]:m??T.colors.primary,J=void 0!==P?k(P):d??V.select,K=void 0!==P?V.selected(k(P)):d??V.noSelection,Q=E??`${p??_??V.select}. ${K}`,W=(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:t,onPress:U,disabled:b,hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:Q,accessibilityState:{disabled:b,expanded:M},"aria-disabled":b,"aria-expanded":M,testID:f,style:({pressed:e})=>[F.trigger,{columnGap:T.space.xs,opacity:e&&!b?.6:1},y],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[F.triggerText,{color:G,fontSize:R.text,...(0,_index.fontFor)(T,"medium")},j],numberOfLines:1,children:J}),(0,_jsxRuntime.jsx)(_Chevron.Chevron,{color:L??G,size:g??R.icon,open:M})]});return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:F.labelled,children:[(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:D,children:p}),W]}):W,(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:M,onClose:w,haptic:S,title:_,accessibilityLabel:p??_??d??V.options,options:i,getOptionLabel:k,getOptionValue:q,isOptionDisabled:B,getOptionDescription:z,getOptionIcon:A,value:o,onChange:(e,t)=>$(t),searchable:x,optionStyle:v,selectedOptionStyle:O,optionTextStyle:I,selectedOptionTextStyle:C})]})});InlineSelect.displayName="InlineSelect";const buildStyles=e=>_reactNative.StyleSheet.create({labelled:{alignItems:"flex-start"},trigger:{flexDirection:"row",alignItems:"center"},triggerText:{includeFontPadding:!1}});var _default=exports.default=InlineSelect;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_INLINE_SELECT_LABELS=void 0,exports.InlineSelect=InlineSelect,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_index2=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_guards=require("../../utils/guards.js"),_hitSlop=require("../../utils/hitSlop.js"),_Chevron=require("../FieldBase/Chevron.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INLINE_SELECT_LABELS=exports.DEFAULT_INLINE_SELECT_LABELS={select:"Select",options:"Options",noSelection:"No selection",selected:e=>`Selected: ${e}`},isSelectOption=e=>(0,_guards.isRecord)(e)&&("string"==typeof e.value||"number"==typeof e.value);function InlineSelect(e){const{ref:t,options:i,getOptionLabel:l,getOptionValue:s,isOptionDisabled:n,getOptionDescription:a,getOptionIcon:r,value:o,onChange:c,placeholder:d,labels:u,label:p,title:_,searchable:S=!1,haptic:x,disabled:b=!1,size:h="md",color:g,chevronColor:v,chevronSize:O,textStyle:m,style:y,optionStyle:j,selectedOptionStyle:L,optionTextStyle:I,selectedOptionTextStyle:f,accessibilityLabel:E,testID:C}=e,T=(0,_index.useTheme)(),N=Object.keys(T.components.field);(0,_assertValidValue.assertValidValue)("InlineSelect","size",e.size,N);const F=(0,_react.useMemo)(()=>buildStyles(T),[T]),V=N.includes(h)?h:"md",q=(0,_index.resolveFieldSize)(T,V),D=(0,_react.useMemo)(()=>({...DEFAULT_INLINE_SELECT_LABELS,...u}),[u]),R=(0,_react.useCallback)(e=>l?l(e):isSelectOption(e)?e.label??"":"",[l]),k=(0,_react.useCallback)(e=>{if(s)return s(e);if(isSelectOption(e))return e.value;throw new Error("InlineSelect option has no value; pass getOptionValue.")},[s]),B=(0,_react.useCallback)(e=>n?n(e):isSelectOption(e)&&!0===e.disabled,[n]),z=(0,_react.useCallback)(e=>a?a(e):isSelectOption(e)?e.description:void 0,[a]),A=(0,_react.useCallback)(e=>r?r(e):isSelectOption(e)?e.icon:void 0,[r]),[M,w]=(0,_react.useState)(!1),H=(0,_react.useMemo)(()=>{if(null!=o)return i.find(e=>k(e)===o)},[i,o,k]),P=(0,_react.useCallback)(()=>{if(b)return;const e=(0,_index2.resolveHaptic)(x,"selection");e&&(0,_index2.triggerHaptic)(e),w(!0)},[b,x]),U=(0,_react.useCallback)(()=>{w(!1)},[]),$=(0,_react.useCallback)(e=>{if(B(e))return;const t=(0,_index2.resolveHaptic)(x,"selection");t&&(0,_index2.triggerHaptic)(t),c(k(e)),U()},[B,k,c,U,x]),G=b?T.colors["text-disabled"]:g??T.colors.primary,J=void 0!==H?R(H):d??D.select,K=void 0!==H?D.selected(R(H)):d??D.noSelection,Q=E??`${p??_??D.select}. ${K}`,W=(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:t,onPress:P,disabled:b,hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:Q,accessibilityState:{disabled:b,expanded:M},"aria-disabled":b,"aria-expanded":M,testID:C,style:({pressed:e})=>[F.trigger,{columnGap:T.space.xs,opacity:e&&!b?.6:1},y],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[F.triggerText,{color:G,fontSize:q.text,...(0,_index.fontFor)(T,"medium")},m],numberOfLines:1,children:J}),(0,_jsxRuntime.jsx)(_Chevron.Chevron,{color:v??G,size:O??q.icon,open:M})]});return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:F.labelled,children:[(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:V,children:p}),W]}):W,(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:M,onClose:U,haptic:x,title:_,accessibilityLabel:p??_??d??D.options,options:i,getOptionLabel:R,getOptionValue:k,isOptionDisabled:B,getOptionDescription:z,getOptionIcon:A,value:o,onChange:(e,t)=>$(t),searchable:S,optionStyle:j,selectedOptionStyle:L,optionTextStyle:I,selectedOptionTextStyle:f})]})}InlineSelect.displayName="InlineSelect";const buildStyles=e=>_reactNative.StyleSheet.create({labelled:{alignItems:"flex-start"},trigger:{flexDirection:"row",alignItems:"center"},triggerText:{includeFontPadding:!1}});var _default=exports.default=InlineSelect;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Input=exports.DEFAULT_INPUT_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Button/index.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INPUT_LABELS=exports.DEFAULT_INPUT_LABELS={showPassword:"Show password",hidePassword:"Hide password"},Input=exports.Input=(0,_react.forwardRef)((e,t)=>{const{label:i,help:n,placeholder:a,value:r,onChangeText:s,error:l,helperText:o,type:d="input",secureTextEntry:c=!1,showPasswordToggle:u=!1,disabled:x=!1,multiline:p=!1,leftIcon:_,rightIcon:f,unit:g,unitStyle:m,prefix:v,prefixStyle:h,readOnly:y=!1,action:j,actionStyle:b,size:S="md",variant:I,labelMode:R,required:w=!1,maxLength:N,showCounter:T=!0,textAlign:V,format:F,parse:D,style:A,containerStyle:L,inputStyle:B,labelStyle:P,messageStyle:k,radius:z,onFocus:q,onBlur:C,accessibilityLabel:E,labels:H,testID:M,editable:O,...U}=e;(0,_assertValidValue.assertValidValue)("Input","variant",I,["outline","filled","underline"]),(0,_assertValidValue.assertValidValue)("Input","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("Input","labelMode",R,["float","top"]),(0,_assertValidValue.assertValidValue)("Input","type",e.type,["input","password","textarea"]);const G=(0,_react.useMemo)(()=>({...DEFAULT_INPUT_LABELS,...H}),[H]),W=(0,_index2.useTheme)(),$=(0,_react.useMemo)(()=>buildStyles(W),[W]),X=(0,_index2.resolveFieldSize)(W,S),J=W.components.input[S]["multiline-min-height"],K=Math.round(X.text*W.leading.body),Q=I??W.settings.components.input?.defaultVariant??W.settings.components.field?.defaultVariant??"outline",Y=R??W.settings.components.input?.defaultLabelMode??"top",[Z,ee]=(0,_react.useState)(!1),[te,ie]=(0,_react.useState)(!1),ne="password"===d||u||c,ae="password"===d||u,re="textarea"===d||p,se=re?Math.round(.1*X.text):0,le="string"==typeof r&&r.length>0,oe=(0,_FieldBase.hasFieldText)(l),de=!0===l||oe,ce=(0,_FieldBase.hasFieldText)(o),ue=oe||!de&&ce,xe=(0,_FieldBase.hasFieldText)(i),pe=(0,_FieldBase.hasFieldText)(v),fe=!x&&!1!==O,ge=Z||le||pe,me=(0,_react.useRef)(null),ve=(0,_react.useMemo)(()=>(0,_index3.mergeRefs)(me,t),[t]),he=(0,_react.useCallback)(()=>{fe&&me.current?.focus()},[fe]),ye=xe&&"float"===Y,je=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,be=(0,_react.useRef)((0,_index2.createAnimatedValue)(ue?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(be,{toValue:ue?1:0,duration:W.motion.duration.fast,easing:_reactNative.Easing.bezier(...W.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[ue,be,W.motion.duration.fast,W.motion.ease["in-out"]]);const Se=(0,_index.useReducedMotion)(),Ie=W.settings.components.input?.shakeOnError??!1,Re=(0,_react.useRef)(de);(0,_react.useEffect)(()=>{if(!Ie)return void(Re.current=de);let e;return de&&!Re.current&&(Se||((0,_index2.setNativeValue)(je,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(je,{toValue:0,duration:100,useNativeDriver:_nativeDriver.nativeDriver})]),e.start()),(0,_index3.triggerHaptic)("notificationError")),Re.current=de,()=>e?.stop()},[de,je,Ie,Se]);const we=(0,_react.useCallback)(e=>{ee(!0),q?.(e)},[q]),Ne=(0,_react.useCallback)(e=>{ee(!1),C?.(e)},[C]),Te=(0,_react.useCallback)(()=>{(0,_index3.triggerHaptic)("selection"),ie(e=>!e)},[]),Ve=W.colors["field-caret"],Fe=W.settings.components.input?.tintLabelOnFocus??!1,De=Z&&Fe?W.colors["field-border-focus"]:W.colors["field-label"],Ae=je.interpolate({inputRange:[-1,0,1],outputRange:[-6,0,6]}),Le=Boolean(f)||Boolean(g)||ae,Be="underline"===Q,Pe=_?X.icon+W.space.md+1+W.space.md:0,ke=(0,_useFloatingLabel.useFloatingLabel)({label:i,enabled:ye,floated:ge,required:w,variant:Q,sizeTokens:X,leadingOffset:Pe,trailingOffset:Le?X.icon+W.space.sm:0,textAlign:"center"===V||"right"===V?V:"left",paddingLeft:Be?W.space.none:X["padding-x"],lineHeight:re?K:void 0,restNudge:se,floatTrim:re?2:0,color:De,style:P}),ze=(0,_FieldBase.resolveFieldTextStyle)(W,{disabled:x}),qe=ze.color,Ce=ze.placeholderColor,Ee=w&&!xe&&!le&&"string"==typeof a&&a.length>0,He=de?l:o,Me=T&&"number"==typeof N&&"string"==typeof r?`${r.length} / ${N}`:null,Oe=de?W.colors["field-message"]:W.colors["text-muted"],Ue=(0,_textInk.useTextInk)(k,X["message-text"],Oe),Ge=E??(0,_FieldBase.fieldTextAsString)(i)??a,We=x?W.colors["field-icon-disabled"]:Z?W.colors["field-icon-focus"]:W.colors["field-icon"],$e={focused:Z,disabled:x,error:de,color:We,size:X.icon},renderSlot=e=>(0,_slotIcon.renderSlotIcon)(e,$e),Xe=(()=>{if(ae){const e=(te?W.settings.icons.eyeOff:W.settings.icons.eye)??(te?_defaultIcons.defaultIcons.eyeOff:_defaultIcons.defaultIcons.eye);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Te,disabled:!fe,hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:te?G.hidePassword:G.showPassword,children:e({size:X.icon,color:We})})}const e=g?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.unit,{fontSize:X.text,color:Ce},m],children:g}):null,t=f?(0,_slotIcon.slotIconView)(f,renderSlot(f)):null;return e&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.trailingRow,children:[e,t]}):e??t})(),Je=_?(0,_slotIcon.slotIconView)(_,renderSlot(_)):null,Ke=_reactNative.StyleSheet.flatten(h),Qe=Ke?.fontSize??X.text,Ye=Ke?.color??Ce,Ze=(0,_react.useMemo)(()=>({fontSize:Qe,color:Ye}),[Qe,Ye]),et=pe?"string"==typeof v||"number"==typeof v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,marginRight:W.space.xs,lineHeight:re?K:void 0,paddingTop:re?se:void 0},h],children:v}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[$.prefixNode,{marginRight:W.space.xs,minHeight:re?K:void 0,justifyContent:"center",paddingTop:re?se:void 0}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,lineHeight:re?K:void 0},h],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ze,children:v})})}):null,tt=j?(0,_jsxRuntime.jsx)(_index4.Button,{variant:j.variant??"outline",tone:j.tone??"primary",size:S,label:j.label,leftIcon:j.icon,loading:j.loading,disabled:x||j.disabled,onPress:j.onPress,pressAnimation:!1,testID:j.testID,style:[$.action,{minHeight:X["min-height"],alignSelf:re?"flex-start":"stretch"},b]}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.container,{transform:[{translateX:Ae}]},A],children:[xe&&!ye?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:S,required:w,help:n,color:De,style:P,children:i}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.fieldRow,{columnGap:W.space.sm,alignItems:re?"flex-start":"stretch"}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.fieldWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:S,variant:Q,focused:Z,disabled:x,error:de,filled:le,minHeight:re?J:void 0,radius:z,leading:Je,leadingDivider:null!=_,paddingLeft:Be?W.space.none:void 0,trailing:Xe,slotAlign:re?"top":"center",slotLineHeight:re?K:void 0,topNotch:ke.topNotch,onPress:he,pressFeedback:!1,style:L,children:[et,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:ve,style:[$.input,{color:qe,fontSize:X.text,...ze.weightStyle,paddingLeft:Be?W.space.none:void 0,minHeight:re?J-2*X["padding-y"]:void 0,lineHeight:re?K:void 0,paddingTop:re?se:void 0,textAlignVertical:re?"top":"center"},B],textAlign:V,placeholder:ye&&!ge||Ee?void 0:a,placeholderTextColor:Ce,value:F&&null!=r?F(r):r,onChangeText:e=>{s&&s(D?D(e):e)},onFocus:we,onBlur:Ne,editable:fe,readOnly:y,secureTextEntry:ne&&!te,multiline:re,autoCapitalize:ne?"none":void 0,autoCorrect:!ne&&void 0,maxLength:N,selectionColor:Ve,accessibilityLabel:Ge,accessibilityState:{disabled:x},"aria-disabled":x,testID:M,...U}),Ee?(0,_jsxRuntime.jsx)(_FieldBase.RequiredPlaceholder,{text:a,color:Ce,fontSize:X.text,weightStyle:ze.weightStyle,align:re?"top":"center",paddingTop:re?se:void 0,textAlign:V}):null]})]}),ke.node]}),tt]}),ue||Me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.footerRow,{marginTop:X["message-gap"]}],children:[ue?(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.messageRow,{columnGap:W.space.xs,opacity:be}],accessibilityLiveRegion:de?"polite":"none",children:[de?(0,_jsxRuntime.jsx)(_FieldBase.FieldErrorGlyph,{size:X["message-text"],color:Oe}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.messageText,{color:Oe,fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")},k],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ue,children:He})})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:$.footerSpacer}),Me?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.counterText,{color:W.colors["text-subtle"],fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")}],children:Me}):null]}):null]})});Input.displayName="Input";const buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},fieldRow:{flexDirection:"row"},fieldWrapper:{position:"relative",overflow:"visible",flex:1},action:{flexShrink:0},input:{padding:e.space.none,margin:e.space.none,includeFontPadding:!1},prefix:{flexShrink:0,includeFontPadding:!1},prefixNode:{flexShrink:0},inputWrap:{flex:1,alignSelf:"stretch",justifyContent:"center"},unit:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center",columnGap:e.space.sm},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:e.space.sm},footerSpacer:{flex:1},messageRow:{flex:1,flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1},counterText:{flexShrink:0,includeFontPadding:!1}});var _default=exports.default=Input;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Input=exports.DEFAULT_INPUT_LABELS=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index4=require("../Button/index.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_textInk=require("../Text/textInk.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_INPUT_LABELS=exports.DEFAULT_INPUT_LABELS={showPassword:"Show password",hidePassword:"Hide password"},Input=exports.Input=(0,_react.forwardRef)((e,t)=>{const{label:i,help:n,placeholder:a,value:r,onChangeText:s,error:l,helperText:o,type:d="input",secureTextEntry:c=!1,showPasswordToggle:u=!1,disabled:x=!1,multiline:p=!1,leftIcon:_,rightIcon:f,unit:g,unitStyle:m,prefix:v,prefixStyle:h,readOnly:y=!1,action:j,actionStyle:b,size:S="md",variant:I,labelMode:R,required:w=!1,maxLength:N,showCounter:T=!0,textAlign:V,format:F,parse:D,style:A,containerStyle:L,inputStyle:B,labelStyle:P,messageStyle:k,radius:z,onFocus:q,onBlur:C,accessibilityLabel:E,labels:H,testID:M,editable:O,...U}=e;(0,_assertValidValue.assertValidValue)("Input","variant",I,["outline","filled","underline"]),(0,_assertValidValue.assertValidValue)("Input","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("Input","labelMode",R,["float","top"]),(0,_assertValidValue.assertValidValue)("Input","type",e.type,["input","password","textarea"]);const G=(0,_react.useMemo)(()=>({...DEFAULT_INPUT_LABELS,...H}),[H]),W=(0,_index2.useTheme)(),$=(0,_react.useMemo)(()=>buildStyles(W),[W]),X=(0,_index2.resolveFieldSize)(W,S),J=W.components.input[S]["multiline-min-height"],K=Math.round(X.text*W.leading.body),Q=I??W.settings.components.input?.defaultVariant??W.settings.components.field?.defaultVariant??"outline",Y=R??W.settings.components.input?.defaultLabelMode??"top",[Z,ee]=(0,_react.useState)(!1),[te,ie]=(0,_react.useState)(!1),ne="password"===d||u||c,ae="password"===d||u,re="textarea"===d||p,se=re?Math.round(.1*X.text):0,le="string"==typeof r&&r.length>0,oe=(0,_FieldBase.hasFieldText)(l),de=!0===l||oe,ce=(0,_FieldBase.hasFieldText)(o),ue=oe||!de&&ce,xe=(0,_FieldBase.hasFieldText)(i),pe=(0,_FieldBase.hasFieldText)(v),fe=!x&&!1!==O,ge=Z||le||pe,me=(0,_react.useRef)(null),ve=(0,_react.useMemo)(()=>(0,_index3.mergeRefs)(me,t),[t]),he=(0,_react.useCallback)(()=>{fe&&me.current?.focus()},[fe]),ye=xe&&"float"===Y,je=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,be=(0,_react.useRef)((0,_index2.createAnimatedValue)(ue?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.timing(be,{toValue:ue?1:0,duration:W.motion.duration.fast,easing:_reactNative.Easing.bezier(...W.motion.ease["in-out"]),useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[ue,be,W.motion.duration.fast,W.motion.ease["in-out"]]);const Se=(0,_index.useReducedMotion)(),Ie=W.settings.components.input?.shakeOnError??!1,Re=(0,_react.useRef)(de);(0,_react.useEffect)(()=>{if(!Ie)return void(Re.current=de);let e;return de&&!Re.current&&(Se||((0,_index2.setNativeValue)(je,0),e=_reactNative.Animated.sequence([_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(je,{toValue:1,duration:50,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(je,{toValue:-1,duration:50,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(je,{toValue:0,duration:100,useNativeDriver:_nativeDriver.nativeDriver})]),e.start()),(0,_index3.triggerHaptic)("notificationError")),Re.current=de,()=>e?.stop()},[de,je,Ie,Se]);const we=(0,_react.useCallback)(e=>{ee(!0),q?.(e)},[q]),Ne=(0,_react.useCallback)(e=>{ee(!1),C?.(e)},[C]),Te=(0,_react.useCallback)(()=>{(0,_index3.triggerHaptic)("selection"),ie(e=>!e)},[]),Ve=W.colors["field-caret"],Fe=W.settings.components.input?.tintLabelOnFocus??!1,De=Z&&Fe?W.colors["field-border-focus"]:W.colors["field-label"],Ae=je.interpolate({inputRange:[-1,0,1],outputRange:[-6,0,6]}),Le=Boolean(f)||Boolean(g)||ae,Be="underline"===Q,Pe=_?X.icon+W.space.md+1+W.space.md:0,ke=(0,_useFloatingLabel.useFloatingLabel)({label:i,enabled:ye,floated:ge,required:w,variant:Q,sizeTokens:X,leadingOffset:Pe,trailingOffset:Le?X.icon+W.space.sm:0,textAlign:"center"===V||"right"===V?V:"left",paddingLeft:Be?W.space.none:X["padding-x"],lineHeight:re?K:void 0,restNudge:se,floatTrim:re?2:0,color:De,style:P}),ze=(0,_FieldBase.resolveFieldTextStyle)(W,{disabled:x}),qe=ze.color,Ce=ze.placeholderColor,Ee=w&&!xe&&!le&&"string"==typeof a&&a.length>0,He=de?l:o,Me=T&&"number"==typeof N&&"string"==typeof r?`${r.length} / ${N}`:null,Oe=de?W.colors["field-message"]:W.colors["text-muted"],Ue=(0,_textInk.useTextInk)(k,X["message-text"],Oe),Ge=E??(0,_FieldBase.fieldTextAsString)(i)??a,We=x?W.colors["field-icon-disabled"]:Z?W.colors["field-icon-focus"]:W.colors["field-icon"],$e={focused:Z,disabled:x,error:de,color:We,size:X.icon},renderSlot=e=>(0,_slotIcon.renderSlotIcon)(e,$e),Xe=(()=>{if(ae){const e=(te?W.settings.icons.eyeOff:W.settings.icons.eye)??(te?_defaultIcons.defaultIcons.eyeOff:_defaultIcons.defaultIcons.eye);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Te,disabled:!fe,hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:te?G.hidePassword:G.showPassword,children:e({size:X.icon,color:We})})}const e=g?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.unit,{fontSize:X.text,color:Ce},m],children:g}):null,t=f?(0,_slotIcon.slotIconView)(f,renderSlot(f)):null;return e&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.trailingRow,children:[e,t]}):e??t})(),Je=_?(0,_slotIcon.slotIconView)(_,renderSlot(_)):null,Ke=_reactNative.StyleSheet.flatten(h),Qe=Ke?.fontSize??X.text,Ye=Ke?.color??Ce,Ze=(0,_react.useMemo)(()=>({fontSize:Qe,color:Ye}),[Qe,Ye]),et=pe?"string"==typeof v||"number"==typeof v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,marginRight:W.space.xs,lineHeight:re?K:void 0,paddingTop:re?se:void 0},h],children:v}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[$.prefixNode,{marginRight:W.space.xs,minHeight:re?K:void 0,justifyContent:"center",paddingTop:re?se:void 0}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.prefix,{fontSize:X.text,color:Ce,lineHeight:re?K:void 0},h],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ze,children:v})})}):null,tt=j?(0,_jsxRuntime.jsx)(_index4.Button,{variant:j.variant??"outline",tone:j.tone??"primary",size:S,label:j.label,leftIcon:j.icon,loading:j.loading,disabled:x||j.disabled,onPress:j.onPress,pressAnimation:!1,testID:j.testID,style:[$.action,{minHeight:X["min-height"],alignSelf:re?"flex-start":"stretch"},b]}):null;return(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.container,{transform:[{translateX:Ae}]},A],children:[xe&&!ye?(0,_jsxRuntime.jsx)(_FieldBase.FieldLabel,{size:S,required:w,help:n,color:De,style:P,children:i}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.fieldRow,{columnGap:W.space.sm,alignItems:re?"flex-start":"stretch"}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.fieldWrapper,children:[(0,_jsxRuntime.jsxs)(_FieldBase.FieldBase,{size:S,variant:Q,focused:Z,disabled:x,error:de,filled:le,minHeight:re?J:void 0,radius:z,leading:Je,leadingDivider:null!=_,paddingLeft:Be?W.space.none:void 0,trailing:Xe,slotAlign:re?"top":"center",slotLineHeight:re?K:void 0,topNotch:ke.topNotch,onPress:he,pressFeedback:!1,style:L,children:[et,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:$.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:ve,style:[$.input,{color:qe,fontSize:X.text,...ze.weightStyle,paddingLeft:Be?W.space.none:void 0,minHeight:re?J-2*X["padding-y"]:void 0,lineHeight:re?K:void 0,paddingTop:re?se:void 0,textAlignVertical:re?"top":"center"},B],textAlign:V,placeholder:ye&&!ge||Ee?void 0:a,placeholderTextColor:Ce,value:F&&null!=r?F(r):r,onChangeText:e=>{s&&s(D?D(e):e)},onFocus:we,onBlur:Ne,editable:fe,readOnly:y,secureTextEntry:ne&&!te,multiline:re,autoCapitalize:ne?"none":void 0,autoCorrect:!ne&&void 0,maxLength:N,selectionColor:Ve,accessibilityLabel:Ge,accessibilityState:{disabled:x},"aria-disabled":x,testID:M,...U}),Ee&&"string"==typeof a?(0,_jsxRuntime.jsx)(_FieldBase.RequiredPlaceholder,{text:a,color:Ce,fontSize:X.text,weightStyle:ze.weightStyle,align:re?"top":"center",paddingTop:re?se:void 0,textAlign:V}):null]})]}),ke.node]}),tt]}),ue||Me?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[$.footerRow,{marginTop:X["message-gap"]}],children:[ue?(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[$.messageRow,{columnGap:W.space.xs,opacity:be}],accessibilityLiveRegion:de?"polite":"none",children:[de?(0,_jsxRuntime.jsx)(_FieldBase.FieldErrorGlyph,{size:X["message-text"],color:Oe}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.messageText,{color:Oe,fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")},k],children:(0,_jsxRuntime.jsx)(_textInk.TextInkContext.Provider,{value:Ue,children:He})})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:$.footerSpacer}),Me?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[$.counterText,{color:W.colors["text-subtle"],fontSize:X["message-text"],...(0,_index2.fontFor)(W,"normal")}],children:Me}):null]}):null]})});Input.displayName="Input";const buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"},fieldRow:{flexDirection:"row"},fieldWrapper:{position:"relative",overflow:"visible",flex:1},action:{flexShrink:0},input:{padding:e.space.none,margin:e.space.none,includeFontPadding:!1},prefix:{flexShrink:0,includeFontPadding:!1},prefixNode:{flexShrink:0},inputWrap:{flex:1,alignSelf:"stretch",justifyContent:"center"},unit:{includeFontPadding:!1},trailingRow:{flexDirection:"row",alignItems:"center",columnGap:e.space.sm},footerRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",columnGap:e.space.sm},footerSpacer:{flex:1},messageRow:{flex:1,flexDirection:"row",alignItems:"center"},messageText:{flexShrink:1,includeFontPadding:!1},counterText:{flexShrink:0,includeFontPadding:!1}});var _default=exports.default=Input;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ListItem=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_mergeRefs=require("../../utils/mergeRefs.js"),_themeStyles=require("../../utils/themeStyles.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index2=require("../Button/index.js"),_index3=require("../IconBadge/index.js"),_useContextMenu=require("../Menu/useContextMenu.js"),_webOnly=require("../Menu/webOnly.js"),_index4=require("../Skeleton/index.js"),_index5=require("../Swipeable/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,s,n=Object.defineProperty,r={__proto__:null,default:e};if(Object(e)!==e)return r;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,r)}for(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((i=n&&Object.getOwnPropertyDescriptor(e,s))&&(i.get||i.set)?n(r,s,i):r[s]=e[s]);return r}const Chevron=({color:e})=>{const t=(0,_index.useTheme)();return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:(t.settings.icons.chevronRight??_defaultIcons.defaultIcons.chevronRight)({size:20,color:e})})},BADGE_SIZE={sm:"sm",md:"md",lg:"lg"},RIGHT_BELOW_FONT_SCALE=1.2,MENU_ROW_MIN_HEIGHT=48,WEB_CHECKABLE_ROLE=(0,_webOnly.webOnly)({role:"menuitemcheckbox"}),SelectionBox=({checked:e,disabled:t})=>{const i=(0,_index.useTheme)(),s=(0,_index.resolveCheckboxSize)(i,"md")["box-size"],n=Math.round(.72*s);return(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{width:s,height:s,alignItems:"center",justifyContent:"center",borderWidth:i.size.border,borderRadius:i.radius.sm,..._corners.smoothCorners,borderColor:e?i.colors.primary:i.colors.border,backgroundColor:e?i.colors.primary:t?i.colors["surface-disabled"]:"transparent"},children:e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:n,height:n,viewBox:"0 0 24 24",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:i.colors["on-primary"],strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}):null})},isActionList=e=>Array.isArray(e)&&e.length>0&&e.every(e=>null!=e&&"object"==typeof e&&!_react.default.isValidElement(e)&&"label"in e),renderActions=e=>isActionList(e)?e.map(e=>(0,_jsxRuntime.jsx)(_index2.Button,{size:"sm",variant:e.variant??"outline",tone:e.tone,leftIcon:e.icon,disabled:e.disabled,testID:e.testID,label:e.label,onPress:e.onPress},e.label)):e,ListItem=exports.ListItem=_react.default.memo((0,_react.forwardRef)((e,t)=>{const{title:i,loading:s=!1,subtitle:n,description:r,children:l,titleLines:a,subtitleLines:o=1,leading:c,icon:d,iconTone:u="primary",trailing:m,rightPlacement:x="auto",selectable:_=!1,checked:h=!1,onCheckedChange:p,actions:j,onPress:b,onFocus:g,haptic:y,selected:f=!1,expanded:v,disabled:R=!1,size:S="md",variant:w="list",divider:I=!1,chevron:L=!1,leftActions:k,rightActions:V,contextMenu:N,accessibilityLabel:C,accessibilityHint:A,style:q,containerStyle:B,titleStyle:P,subtitleStyle:z,descriptionStyle:O,leftSlotStyle:E,rightSlotStyle:M,testID:T}=e;(0,_assertValidValue.assertValidValue)("ListItem","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("ListItem","iconTone",e.iconTone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("ListItem","rightPlacement",e.rightPlacement,["auto","side","below"]),(0,_assertValidValue.assertValidValue)("ListItem","variant",e.variant,["list","menu"]);const D="menu"===w,W=a??(D?2:1),F=D?e.checked:void 0,H=(0,_index.useTheme)(),G=(0,_react.useMemo)(()=>(0,_index.resolveListItemSize)(H,S),[H,S]),U=stylesFor(H),{fontScale:K}=(0,_reactNative.useWindowDimensions)(),Z=!!m&&("below"===x||"auto"===x&&K>1.2),J=(0,_useContextMenu.useContextMenu)(R?void 0:N,{haptic:y||!1,testID:T}),Q=(0,_react.useMemo)(()=>(0,_mergeRefs.mergeRefs)(t,J.hostRef),[t,J.hostRef]),X=_||!!b,Y=X||J.enabled,$=Y&&!R,{style:ee,pressIn:te,pressOut:ie}=(0,_usePressAnimation.usePressAnimation)({enabled:$&&!D}),se=(0,_useFlickGuard.useFlickGuard)(),ne=C??("string"==typeof i?i:void 0),isText=e=>"string"==typeof e||"number"==typeof e,re=c??(void 0===d?null:(0,_jsxRuntime.jsx)(_index3.IconBadge,{icon:d,tone:u,size:BADGE_SIZE[S]})),le=_?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:U.selectionLead,children:[(0,_jsxRuntime.jsx)(SelectionBox,{checked:h,disabled:R}),re?(0,_jsxRuntime.jsx)(_reactNative.View,{style:U.selectionLeadContent,children:re}):null]}):re,ae=null!=j&&!1!==j&&!(Array.isArray(j)&&0===j.length),oe=I&&!ae,ce=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[U.row,{paddingVertical:D?H.space.sm:G["padding-y"],minHeight:D?48:G["min-height"],backgroundColor:f?H.colors["surface-selected"]:"transparent"},oe?U.divider:null,R&&!D?U.disabled:null,B],children:[le?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[U.leftSlot,E],children:le}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:U.middle,children:[null==i||isText(i)?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[U.title,{fontSize:D?H.text.base.size:G["title-text"],...(0,_index.fontFor)(H,D?"normal":"medium"),color:R?H.colors["text-disabled"]:H.colors["text-body"]},P],numberOfLines:W,children:i??" "}):i,null==n||""===n?null:isText(n)?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[U.subtitle,{fontSize:D?H.text.xs.size:G["subtitle-text"],color:R?H.colors["text-disabled"]:H.colors["text-muted"]},D?U.menuSubtitle:null,z],numberOfLines:o,children:n}):n,null==r||""===r?null:isText(r)?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[U.description,{fontSize:G["subtitle-text"],color:R?H.colors["text-disabled"]:H.colors["text-subtle"]},O],numberOfLines:2,children:r}):r,null!=l&&!1!==l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:U.body,children:l}):null,Z?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[U.rightBelow,M],children:m}):null]}),m&&!Z||L?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[U.rightSlot,Z?null:M],children:[Z?null:m,L?(0,_jsxRuntime.jsx)(_reactNative.View,{style:m&&!Z?U.chevronWithRight:null,children:(0,_jsxRuntime.jsx)(Chevron,{color:R?H.colors["text-disabled"]:H.colors["text-subtle"]})}):null]}):null]}),de=Y?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:Q,onPress:e=>{$&&X&&!se.isFlick(e)&&(y&&(0,_hapticUtils.triggerHaptic)(y),_?p?.(!h):b?.(e))},onPressIn:e=>{se.onPressIn(e),te()},onPressOut:ie,disabled:!$,onFocus:g,accessibilityRole:_?"checkbox":D?"menuitem":b?"button":void 0,accessibilityLabel:ne,accessibilityHint:A,accessibilityState:_?{checked:h,disabled:!$,expanded:v}:{selected:f,disabled:!$,expanded:v,...void 0!==F?{checked:F}:null},"aria-disabled":!$,"aria-expanded":v,..._?{"aria-checked":h}:void 0!==F?{"aria-checked":F}:{"aria-selected":f},...void 0!==F?WEB_CHECKABLE_ROLE:null,testID:T,android_ripple:{color:H.colors["surface-pressed"],borderless:!1},style:({pressed:e})=>[q,e?U.pressed:null],...J.hostProps,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:ee,children:ce})}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,accessibilityRole:"none",accessibilityLabel:ne,accessibilityHint:A,accessibilityState:{selected:f,disabled:R},"aria-selected":f,"aria-disabled":R,testID:T,style:q,children:ce}),ue=k&&k.length>0||V&&V.length>0,me=ae?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[f?{backgroundColor:H.colors["surface-selected"]}:null,I?U.divider:null],children:[de,(0,_jsxRuntime.jsx)(_reactNative.View,{style:U.actions,children:renderActions(j)})]}):de,xe=ue?(0,_jsxRuntime.jsx)(_index5.Swipeable,{leftActions:k,rightActions:V,accessibilityLabel:ne,children:me}):me;return s?(0,_jsxRuntime.jsx)(ListItemSkeleton,{...e}):J.enabled?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[xe,J.renderSurface((0,_jsxRuntime.jsx)(_reactNative.View,{style:U.preview,children:ce}))]}):xe}));ListItem.displayName="ListItem";const ListItemSkeleton=({subtitle:e,description:t,leading:i,icon:s,trailing:n,chevron:r,size:l="md",variant:a="list",containerStyle:o,style:c})=>{const d=(0,_index.useTheme)(),u=(0,_index.resolveListItemSize)(d,l),m=Math.round(1.15*u["title-text"]),x=Math.round(1.15*u["subtitle-text"]),_="menu"===a;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{flexDirection:"row",alignItems:"center",paddingHorizontal:d.space.md,paddingVertical:_?d.space.sm:u["padding-y"],minHeight:_?48:u["min-height"]},o,c],children:[void 0!==i||void 0!==s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:d.space.sm},children:(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"circle",width:40,height:40})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},children:[(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"text",width:"70%",height:m,style:{marginBottom:d.space.xs}}),void 0!==e?(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"text",width:"50%",height:x,style:void 0!==t?{marginBottom:d.space.xs}:void 0}):null,void 0!==t?(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"text",width:"85%",height:x}):null]}),void 0!==n||r?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginLeft:d.space.sm},children:(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:20,height:20,radius:"sm"})}):null]})};ListItemSkeleton.displayName="ListItemSkeleton",ListItem.Skeleton=ListItemSkeleton;const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.md},divider:{borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:e.colors.border},pressed:{backgroundColor:e.colors["surface-pressed"]},disabled:{opacity:.55},leftSlot:{marginRight:e.space.md,alignItems:"center",justifyContent:"center"},middle:{flex:1,flexDirection:"column",justifyContent:"center"},selectionLead:{flexDirection:"row",alignItems:"center"},selectionLeadContent:{marginLeft:e.space.sm},body:{marginTop:e.space.xs},rightBelow:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",marginTop:e.space.xs},rightSlot:{marginLeft:e.space.md,alignItems:"center",justifyContent:"center",flexDirection:"row"},actions:{flexDirection:"row",flexWrap:"wrap",gap:e.space.sm,paddingHorizontal:e.space.md,paddingBottom:e.space.md},chevronWithRight:{marginLeft:e.space.xs},preview:{flex:1,backgroundColor:e.colors.surface,borderRadius:e.radius.md,..._corners.smoothCorners,overflow:"hidden"},title:{letterSpacing:e["letter-spacing"].normal},subtitle:{marginTop:e.space.xxs,...(0,_index.fontFor)(e,"normal")},menuSubtitle:{marginTop:0},description:{marginTop:e.space.xxs,...(0,_index.fontFor)(e,"normal")}}),stylesFor=(0,_themeStyles.themeStyles)(buildStyles);var _default=exports.default=ListItem;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ListItem=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_mergeRefs=require("../../utils/mergeRefs.js"),_themeStyles=require("../../utils/themeStyles.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index2=require("../Button/index.js"),_index3=require("../IconBadge/index.js"),_useContextMenu=require("../Menu/useContextMenu.js"),_webOnly=require("../Menu/webOnly.js"),_index4=require("../Skeleton/index.js"),_index5=require("../Swipeable/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,s,n=Object.defineProperty,r={__proto__:null,default:e};if(Object(e)!==e)return r;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,r)}for(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((i=n&&Object.getOwnPropertyDescriptor(e,s))&&(i.get||i.set)?n(r,s,i):r[s]=e[s]);return r}const Chevron=({color:e})=>{const t=(0,_index.useTheme)();return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:(t.settings.icons.chevronRight??_defaultIcons.defaultIcons.chevronRight)({size:20,color:e})})},BADGE_SIZE={sm:"sm",md:"md",lg:"lg"},RIGHT_BELOW_FONT_SCALE=1.2,MENU_ROW_MIN_HEIGHT=48,WEB_CHECKABLE_ROLE=(0,_webOnly.webOnly)({role:"menuitemcheckbox"}),SelectionBox=({checked:e,disabled:t})=>{const i=(0,_index.useTheme)(),s=(0,_index.resolveCheckboxSize)(i,"md")["box-size"],n=Math.round(.72*s);return(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{width:s,height:s,alignItems:"center",justifyContent:"center",borderWidth:i.size.border,borderRadius:i.radius.sm,..._corners.smoothCorners,borderColor:e?i.colors.primary:i.colors.border,backgroundColor:e?i.colors.primary:t?i.colors["surface-disabled"]:"transparent"},children:e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:n,height:n,viewBox:"0 0 24 24",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:i.colors["on-primary"],strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}):null})},isActionList=e=>Array.isArray(e)&&e.length>0&&e.every(e=>null!=e&&"object"==typeof e&&!_react.default.isValidElement(e)&&"label"in e),renderActions=e=>isActionList(e)?e.map(e=>(0,_jsxRuntime.jsx)(_index2.Button,{size:"sm",variant:e.variant??"outline",tone:e.tone,leftIcon:e.icon,disabled:e.disabled,testID:e.testID,label:e.label,onPress:e.onPress},e.label)):e,ListItemRoot=_react.default.memo((0,_react.forwardRef)((e,t)=>{const{title:i,loading:s=!1,subtitle:n,description:r,children:l,titleLines:a,subtitleLines:o=1,leading:c,icon:d,iconTone:u="primary",trailing:m,rightPlacement:x="auto",selectable:_=!1,checked:h=!1,onCheckedChange:p,actions:j,onPress:b,onFocus:g,haptic:y,selected:f=!1,expanded:v,disabled:R=!1,size:S="md",variant:w="list",divider:I=!1,chevron:L=!1,leftActions:k,rightActions:V,contextMenu:N,accessibilityLabel:C,accessibilityHint:A,style:q,containerStyle:B,titleStyle:O,subtitleStyle:P,descriptionStyle:z,leftSlotStyle:E,rightSlotStyle:M,testID:T}=e;(0,_assertValidValue.assertValidValue)("ListItem","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("ListItem","iconTone",e.iconTone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("ListItem","rightPlacement",e.rightPlacement,["auto","side","below"]),(0,_assertValidValue.assertValidValue)("ListItem","variant",e.variant,["list","menu"]);const D="menu"===w,W=a??(D?2:1),F=D?e.checked:void 0,H=(0,_index.useTheme)(),G=(0,_react.useMemo)(()=>(0,_index.resolveListItemSize)(H,S),[H,S]),U=stylesFor(H),{fontScale:K}=(0,_reactNative.useWindowDimensions)(),Z=!!m&&("below"===x||"auto"===x&&K>1.2),J=(0,_useContextMenu.useContextMenu)(R?void 0:N,{haptic:y||!1,testID:T}),Q=(0,_react.useMemo)(()=>(0,_mergeRefs.mergeRefs)(t,J.hostRef),[t,J.hostRef]),X=_||!!b,Y=X||J.enabled,$=Y&&!R,{style:ee,pressIn:te,pressOut:ie}=(0,_usePressAnimation.usePressAnimation)({enabled:$&&!D}),se=(0,_useFlickGuard.useFlickGuard)(),ne=C??("string"==typeof i?i:void 0),isText=e=>"string"==typeof e||"number"==typeof e,re=c??(void 0===d?null:(0,_jsxRuntime.jsx)(_index3.IconBadge,{icon:d,tone:u,size:BADGE_SIZE[S]})),le=_?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:U.selectionLead,children:[(0,_jsxRuntime.jsx)(SelectionBox,{checked:h,disabled:R}),re?(0,_jsxRuntime.jsx)(_reactNative.View,{style:U.selectionLeadContent,children:re}):null]}):re,ae=null!=j&&!1!==j&&!(Array.isArray(j)&&0===j.length),oe=I&&!ae,ce=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[U.row,{paddingVertical:D?H.space.sm:G["padding-y"],minHeight:D?48:G["min-height"],backgroundColor:f?H.colors["surface-selected"]:"transparent"},oe?U.divider:null,R&&!D?U.disabled:null,B],children:[le?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[U.leftSlot,E],children:le}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:U.middle,children:[null==i||isText(i)?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[U.title,{fontSize:D?H.text.base.size:G["title-text"],...(0,_index.fontFor)(H,D?"normal":"medium"),color:R?H.colors["text-disabled"]:H.colors["text-body"]},O],numberOfLines:W,children:i??" "}):i,null==n||""===n?null:isText(n)?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[U.subtitle,{fontSize:D?H.text.xs.size:G["subtitle-text"],color:R?H.colors["text-disabled"]:H.colors["text-muted"]},D?U.menuSubtitle:null,P],numberOfLines:o,children:n}):n,null==r||""===r?null:isText(r)?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[U.description,{fontSize:G["subtitle-text"],color:R?H.colors["text-disabled"]:H.colors["text-subtle"]},z],numberOfLines:2,children:r}):r,null!=l&&!1!==l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:U.body,children:l}):null,Z?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[U.rightBelow,M],children:m}):null]}),m&&!Z||L?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[U.rightSlot,Z?null:M],children:[Z?null:m,L?(0,_jsxRuntime.jsx)(_reactNative.View,{style:m&&!Z?U.chevronWithRight:null,children:(0,_jsxRuntime.jsx)(Chevron,{color:R?H.colors["text-disabled"]:H.colors["text-subtle"]})}):null]}):null]}),de=Y?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:Q,onPress:e=>{$&&X&&!se.isFlick(e)&&(y&&(0,_hapticUtils.triggerHaptic)(y),_?p?.(!h):b?.(e))},onPressIn:e=>{se.onPressIn(e),te()},onPressOut:ie,disabled:!$,onFocus:g,accessibilityRole:_?"checkbox":D?"menuitem":b?"button":void 0,accessibilityLabel:ne,accessibilityHint:A,accessibilityState:_?{checked:h,disabled:!$,expanded:v}:{selected:f,disabled:!$,expanded:v,...void 0!==F?{checked:F}:null},"aria-disabled":!$,"aria-expanded":v,..._?{"aria-checked":h}:void 0!==F?{"aria-checked":F}:{"aria-selected":f},...void 0!==F?WEB_CHECKABLE_ROLE:null,testID:T,android_ripple:{color:H.colors["surface-pressed"],borderless:!1},style:({pressed:e})=>[q,e?U.pressed:null],...J.hostProps,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:ee,children:ce})}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,accessibilityRole:"none",accessibilityLabel:ne,accessibilityHint:A,accessibilityState:{selected:f,disabled:R},"aria-selected":f,"aria-disabled":R,testID:T,style:q,children:ce}),ue=k&&k.length>0||V&&V.length>0,me=ae?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[f?{backgroundColor:H.colors["surface-selected"]}:null,I?U.divider:null],children:[de,(0,_jsxRuntime.jsx)(_reactNative.View,{style:U.actions,children:renderActions(j)})]}):de,xe=ue?(0,_jsxRuntime.jsx)(_index5.Swipeable,{leftActions:k,rightActions:V,accessibilityLabel:ne,children:me}):me;return s?(0,_jsxRuntime.jsx)(ListItemSkeleton,{...e}):J.enabled?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[xe,J.renderSurface((0,_jsxRuntime.jsx)(_reactNative.View,{style:U.preview,children:ce}))]}):xe})),ListItemSkeleton=({subtitle:e,description:t,leading:i,icon:s,trailing:n,chevron:r,size:l="md",variant:a="list",containerStyle:o,style:c})=>{const d=(0,_index.useTheme)(),u=(0,_index.resolveListItemSize)(d,l),m=Math.round(1.15*u["title-text"]),x=Math.round(1.15*u["subtitle-text"]),_="menu"===a;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{flexDirection:"row",alignItems:"center",paddingHorizontal:d.space.md,paddingVertical:_?d.space.sm:u["padding-y"],minHeight:_?48:u["min-height"]},o,c],children:[void 0!==i||void 0!==s?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:d.space.sm},children:(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"circle",width:40,height:40})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},children:[(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"text",width:"70%",height:m,style:{marginBottom:d.space.xs}}),void 0!==e?(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"text",width:"50%",height:x,style:void 0!==t?{marginBottom:d.space.xs}:void 0}):null,void 0!==t?(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"text",width:"85%",height:x}):null]}),void 0!==n||r?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginLeft:d.space.sm},children:(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:20,height:20,radius:"sm"})}):null]})};ListItemSkeleton.displayName="ListItemSkeleton";const ListItem=exports.ListItem=Object.assign(ListItemRoot,{Skeleton:ListItemSkeleton});ListItem.displayName="ListItem";const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.md},divider:{borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:e.colors.border},pressed:{backgroundColor:e.colors["surface-pressed"]},disabled:{opacity:.55},leftSlot:{marginRight:e.space.md,alignItems:"center",justifyContent:"center"},middle:{flex:1,flexDirection:"column",justifyContent:"center"},selectionLead:{flexDirection:"row",alignItems:"center"},selectionLeadContent:{marginLeft:e.space.sm},body:{marginTop:e.space.xs},rightBelow:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",marginTop:e.space.xs},rightSlot:{marginLeft:e.space.md,alignItems:"center",justifyContent:"center",flexDirection:"row"},actions:{flexDirection:"row",flexWrap:"wrap",gap:e.space.sm,paddingHorizontal:e.space.md,paddingBottom:e.space.md},chevronWithRight:{marginLeft:e.space.xs},preview:{flex:1,backgroundColor:e.colors.surface,borderRadius:e.radius.md,..._corners.smoothCorners,overflow:"hidden"},title:{letterSpacing:e["letter-spacing"].normal},subtitle:{marginTop:e.space.xxs,...(0,_index.fontFor)(e,"normal")},menuSubtitle:{marginTop:0},description:{marginTop:e.space.xxs,...(0,_index.fontFor)(e,"normal")}}),stylesFor=(0,_themeStyles.themeStyles)(buildStyles);var _default=exports.default=ListItem;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Markdown=Markdown;var _markdownCore=require("@webority/markdown-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_index2=require("../Skeleton/index.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const MONO=_reactNative.Platform.select({ios:"Menlo",android:"monospace",default:"monospace"}),HEADING_SCALE={1:"3xl",2:"2xl",3:"xl",4:"lg",5:"base",6:"sm"},createStyles=e=>_reactNative.StyleSheet.create({block:{marginBottom:e.space.sm},listRow:{flexDirection:"row",marginBottom:e.space.xs},marker:{width:e.space.lg},listText:{flex:1},quote:{borderLeftWidth:3,borderLeftColor:e.colors["border-subtle"],paddingLeft:e.space.sm,marginBottom:e.space.sm},quoteText:{color:e.colors["text-muted"],fontStyle:"italic"},code:{backgroundColor:e.colors["bg-subtle"],borderRadius:e.radius.sm,..._corners.smoothCorners,padding:e.space.sm,marginBottom:e.space.sm},codeText:{fontFamily:MONO},inlineCode:{fontFamily:MONO,backgroundColor:e.colors["bg-subtle"],color:e.colors["text-body"]},link:{color:e.colors.link,textDecorationLine:"underline"},citation:{color:e.colors.primary,fontWeight:e.weight.semibold},strong:{fontWeight:e.weight.bold},em:{fontStyle:"italic"},strike:{textDecorationLine:"line-through"},table:{borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:e.colors.border},row:{flexDirection:"row"},headerRow:{backgroundColor:e.colors["bg-subtle"]},cell:{minWidth:96,maxWidth:220,padding:e.space.xs,borderRightWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:e.colors.border},rule:{height:_reactNative.StyleSheet.hairlineWidth,backgroundColor:e.colors.border,marginVertical:e.space.md}}),withPositionKeys=e=>e.map((e,t)=>({key:t,value:e})),openHref=(e,t)=>{t?t(e):_reactNative.Linking.openURL(e).catch(()=>{})};function Inline({tokens:e,ctx:t}){const{styles:i}=t;return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:e.map(e=>{switch(e.type){case"text":return t.figureText?(0,_jsxRuntime.jsx)(_reactNative.Text,{children:t.figureText(e.text).map((e,i)=>renderFigureRun(e,i,t.theme))},e.key):(0,_jsxRuntime.jsx)(_reactNative.Text,{children:e.text},e.key);case"code":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.inlineCode,children:e.text},e.key);case"strong":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.strong,children:(0,_jsxRuntime.jsx)(Inline,{tokens:e.children,ctx:t})},e.key);case"em":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.em,children:(0,_jsxRuntime.jsx)(Inline,{tokens:e.children,ctx:t})},e.key);case"strike":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.strike,children:(0,_jsxRuntime.jsx)(Inline,{tokens:e.children,ctx:t})},e.key);case"image":return(0,_jsxRuntime.jsxs)(_reactNative.Text,{children:["[",(0,_jsxRuntime.jsx)(Inline,{tokens:e.children,ctx:t}),"]"]},e.key);case"link":return renderLink(e.key,e.href,e.children,t);case"citation":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.citation,accessibilityRole:t.onOpenCitation?"button":void 0,accessibilityLabel:e.text,onPress:t.onOpenCitation?()=>t.onOpenCitation?.(e.text):void 0,children:e.text},e.key);default:return null}})})}function renderLink(e,t,i,n){const{styles:s,links:r,resolveLink:o,onAppLinkPress:a,onLinkPress:l,onPageLinkPress:c}=n,x=(0,_jsxRuntime.jsx)(Inline,{tokens:i,ctx:n}),d=(0,_markdownCore.linkTarget)(t,r,o);return null===d?(0,_jsxRuntime.jsx)(_reactNative.Text,{children:x},e):"page"===d.kind?c?(0,_jsxRuntime.jsx)(_reactNative.Text,{accessibilityRole:"link",style:s.link,onPress:()=>c(d.href),children:x},e):(0,_jsxRuntime.jsx)(_reactNative.Text,{children:x},e):"app"===d.kind?a?(0,_jsxRuntime.jsx)(_reactNative.Text,{accessibilityRole:"link",style:s.link,onPress:()=>a(d.target),children:x},e):(0,_jsxRuntime.jsx)(_reactNative.Text,{children:x},e):(0,_jsxRuntime.jsx)(_reactNative.Text,{accessibilityRole:"link",style:s.link,onPress:()=>openHref(d.href,l),children:x},e)}function renderFigureRun(e,t,i){if("text"===e.kind)return e.text;const n=i.text.base.size,s="sub"===e.kind?Math.round(.4*n):-Math.round(.45*n),r=Math.round(.75*n);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{transform:[{translateY:s}]},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{fontSize:r,lineHeight:r,includeFontPadding:!1,color:i.colors["text-body"]},children:e.text})},t)}function RenderBlock({block:e,ctx:t}){const{theme:i,styles:n,textStyle:s,headings:r,selectable:o}=t;switch(e.type){case"heading":return(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:"outline"===r?"semibold":"bold",size:"outline"===r?HEADING_SCALE[e.level]:void 0,accessibilityRole:"header",selectable:o,style:[n.block,s],children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(e.text,{isCitation:t.isCitation}),ctx:t})});case"paragraph":return(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",selectable:o,style:[n.block,s],children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(e.lines.join("\n"),{isCitation:t.isCitation}),ctx:t})});case"list":return(0,_jsxRuntime.jsx)(_reactNative.View,{children:withPositionKeys(e.items).map(({key:e,value:r})=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[n.listRow,{marginLeft:r.depth*i.space.md}],children:[(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",style:[n.marker,s],children:r.ordered?`${r.number}.`:"•"}),(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",selectable:o,style:[n.listText,s],children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(r.text,{isCitation:t.isCitation}),ctx:t})})]},e))});case"table":return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:n.block,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:n.table,children:withPositionKeys([e.header,...e.rows]).map(({key:i,value:r})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[n.row,0===i&&n.headerRow],children:withPositionKeys(e.header).map(({key:e})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:n.cell,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",weight:0===i?"semibold":void 0,selectable:o,style:s,children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(r[e]??"",{isCitation:t.isCitation}),ctx:t})})},e))},i))})});case"code":return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,style:n.code,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",size:"sm",selectable:!0,style:n.codeText,children:e.text})});case"quote":return(0,_jsxRuntime.jsx)(_reactNative.View,{style:n.quote,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",selectable:o,style:[n.quoteText,s],children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(e.lines.join("\n"),{isCitation:t.isCitation}),ctx:t})})});case"rule":return(0,_jsxRuntime.jsx)(_reactNative.View,{style:n.rule});default:return null}}const MarkdownSkeleton=({style:e,testID:t})=>{const i=(0,_index.useTheme)();return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:e,testID:t,children:[(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"70%",height:20,style:{marginBottom:i.space.sm}}),(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"100%",height:14,style:{marginBottom:i.space.xs}}),(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"92%",height:14,style:{marginBottom:i.space.xs}}),(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"60%",height:14})]})};function Markdown({children:e,links:t="web",headings:i="outline",figureText:n,resolveLink:s,isCitation:r,onOpenCitation:o,onAppLinkPress:a,onLinkPress:l,onPageLinkPress:c,loading:x=!1,style:d,textStyle:u,selectable:m=!1,testID:h}){const _=(0,_index.useTheme)(),j=(0,_react.useMemo)(()=>createStyles(_),[_]),k=(0,_react.useMemo)(()=>(0,_markdownCore.parseMarkdown)(e??""),[e]);if(x)return(0,_jsxRuntime.jsx)(MarkdownSkeleton,{style:d,testID:h});if(0===k.length)return null;const y={theme:_,styles:j,links:t,headings:i,textStyle:u,selectable:m,figureText:n,resolveLink:s,isCitation:r,onOpenCitation:o,onAppLinkPress:a,onLinkPress:l,onPageLinkPress:c};return(0,_jsxRuntime.jsx)(_reactNative.View,{style:d,testID:h,children:k.map(e=>(0,_jsxRuntime.jsx)(RenderBlock,{block:e,ctx:y},e.key))})}Markdown.displayName="Markdown";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Markdown=Markdown;var _markdownCore=require("@webority/markdown-core"),_mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_index2=require("../Skeleton/index.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const MONO=_reactNative.Platform.select({ios:"Menlo",android:"monospace",default:"monospace"}),HEADING_SCALE={1:"3xl",2:"2xl",3:"xl",4:"lg",5:"base",6:"sm"},createStyles=e=>_reactNative.StyleSheet.create({block:{marginBottom:e.space.sm},listRow:{flexDirection:"row",marginBottom:e.space.xs},marker:{width:e.space.lg},listText:{flex:1},quote:{borderLeftWidth:3,borderLeftColor:e.colors["border-subtle"],paddingLeft:e.space.sm,marginBottom:e.space.sm},quoteText:{color:e.colors["text-muted"],fontStyle:"italic"},code:{backgroundColor:e.colors["bg-subtle"],borderRadius:e.radius.sm,..._corners.smoothCorners,padding:e.space.sm,marginBottom:e.space.sm},codeText:{fontFamily:MONO},inlineCode:{fontFamily:MONO,backgroundColor:e.colors["bg-subtle"],color:e.colors["text-body"]},link:{color:e.colors.link,textDecorationLine:"underline"},citation:{color:e.colors.primary,fontWeight:e.weight.semibold},strong:{fontWeight:e.weight.bold},em:{fontStyle:"italic"},strike:{textDecorationLine:"line-through"},table:{borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:e.colors.border},row:{flexDirection:"row"},headerRow:{backgroundColor:e.colors["bg-subtle"]},cell:{minWidth:96,maxWidth:220,padding:e.space.xs,borderRightWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:e.colors.border},rule:{height:_reactNative.StyleSheet.hairlineWidth,backgroundColor:e.colors.border,marginVertical:e.space.md}}),withPositionKeys=e=>e.map((e,t)=>({key:t,value:e})),openHref=(e,t)=>{t?t(e):_reactNative.Linking.openURL(e).catch(e=>{_mobileCore.Logger.recordError(e,{op:"markdown.openLink"})})};function Inline({tokens:e,ctx:t}){const{styles:i}=t;return(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:e.map(e=>{switch(e.type){case"text":return t.figureText?(0,_jsxRuntime.jsx)(_reactNative.Text,{children:t.figureText(e.text).map((e,i)=>renderFigureRun(e,i,t.theme))},e.key):(0,_jsxRuntime.jsx)(_reactNative.Text,{children:e.text},e.key);case"code":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.inlineCode,children:e.text},e.key);case"strong":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.strong,children:(0,_jsxRuntime.jsx)(Inline,{tokens:e.children,ctx:t})},e.key);case"em":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.em,children:(0,_jsxRuntime.jsx)(Inline,{tokens:e.children,ctx:t})},e.key);case"strike":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.strike,children:(0,_jsxRuntime.jsx)(Inline,{tokens:e.children,ctx:t})},e.key);case"image":return(0,_jsxRuntime.jsxs)(_reactNative.Text,{children:["[",(0,_jsxRuntime.jsx)(Inline,{tokens:e.children,ctx:t}),"]"]},e.key);case"link":return renderLink(e.key,e.href,e.children,t);case"citation":return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:i.citation,accessibilityRole:t.onOpenCitation?"button":void 0,accessibilityLabel:e.text,onPress:t.onOpenCitation?()=>t.onOpenCitation?.(e.text):void 0,children:e.text},e.key);default:return null}})})}function renderLink(e,t,i,n){const{styles:r,links:s,resolveLink:o,onAppLinkPress:l,onLinkPress:a,onPageLinkPress:c}=n,x=(0,_jsxRuntime.jsx)(Inline,{tokens:i,ctx:n}),d=(0,_markdownCore.linkTarget)(t,s,o);return null===d?(0,_jsxRuntime.jsx)(_reactNative.Text,{children:x},e):"page"===d.kind?c?(0,_jsxRuntime.jsx)(_reactNative.Text,{accessibilityRole:"link",style:r.link,onPress:()=>c(d.href),children:x},e):(0,_jsxRuntime.jsx)(_reactNative.Text,{children:x},e):"app"===d.kind?l?(0,_jsxRuntime.jsx)(_reactNative.Text,{accessibilityRole:"link",style:r.link,onPress:()=>l(d.target),children:x},e):(0,_jsxRuntime.jsx)(_reactNative.Text,{children:x},e):(0,_jsxRuntime.jsx)(_reactNative.Text,{accessibilityRole:"link",style:r.link,onPress:()=>openHref(d.href,a),children:x},e)}function renderFigureRun(e,t,i){if("text"===e.kind)return e.text;const n=i.text.base.size,r="sub"===e.kind?Math.round(.4*n):-Math.round(.45*n),s=Math.round(.75*n);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{transform:[{translateY:r}]},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{fontSize:s,lineHeight:s,includeFontPadding:!1,color:i.colors["text-body"]},children:e.text})},t)}function RenderBlock({block:e,ctx:t}){const{theme:i,styles:n,textStyle:r,headings:s,selectable:o}=t,l={isCitation:t.isCitation};switch(e.type){case"heading":return(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:"outline"===s?"semibold":"bold",size:"outline"===s?HEADING_SCALE[e.level]:void 0,accessibilityRole:"header",selectable:o,style:[n.block,r],children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(e.text,l),ctx:t})});case"paragraph":return(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",selectable:o,style:[n.block,r],children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(e.lines.join("\n"),l),ctx:t})});case"list":return(0,_jsxRuntime.jsx)(_reactNative.View,{children:withPositionKeys(e.items).map(({key:e,value:s})=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[n.listRow,{marginLeft:s.depth*i.space.md}],children:[(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",style:[n.marker,r],children:s.ordered?`${s.number}.`:"•"}),(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",selectable:o,style:[n.listText,r],children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(s.text,l),ctx:t})})]},e))});case"table":return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:n.block,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:n.table,children:withPositionKeys([e.header,...e.rows]).map(({key:i,value:s})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[n.row,0===i&&n.headerRow],children:withPositionKeys(e.header).map(({key:e})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:n.cell,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",weight:0===i?"semibold":void 0,selectable:o,style:r,children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(s[e]??"",l),ctx:t})})},e))},i))})});case"code":return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,style:n.code,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",size:"sm",selectable:!0,style:n.codeText,children:e.text})});case"quote":return(0,_jsxRuntime.jsx)(_reactNative.View,{style:n.quote,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",selectable:o,style:[n.quoteText,r],children:(0,_jsxRuntime.jsx)(Inline,{tokens:(0,_markdownCore.parseInline)(e.lines.join("\n"),l),ctx:t})})});case"rule":return(0,_jsxRuntime.jsx)(_reactNative.View,{style:n.rule});default:return null}}const MarkdownSkeleton=({style:e,testID:t})=>{const i=(0,_index.useTheme)();return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:e,testID:t,children:[(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"70%",height:20,style:{marginBottom:i.space.sm}}),(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"100%",height:14,style:{marginBottom:i.space.xs}}),(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"92%",height:14,style:{marginBottom:i.space.xs}}),(0,_jsxRuntime.jsx)(_index2.Skeleton,{shape:"text",width:"60%",height:14})]})};function Markdown({children:e,links:t="web",headings:i="outline",figureText:n,resolveLink:r,isCitation:s,onOpenCitation:o,onAppLinkPress:l,onLinkPress:a,onPageLinkPress:c,loading:x=!1,style:d,textStyle:u,selectable:m=!1,testID:h}){const _=(0,_index.useTheme)(),j=(0,_react.useMemo)(()=>createStyles(_),[_]),k=(0,_react.useMemo)(()=>(0,_markdownCore.parseMarkdown)(e??""),[e]);if(x)return(0,_jsxRuntime.jsx)(MarkdownSkeleton,{style:d,testID:h});if(0===k.length)return null;const y={theme:_,styles:j,links:t,headings:i,textStyle:u,selectable:m,figureText:n,resolveLink:r,isCitation:s,onOpenCitation:o,onAppLinkPress:l,onLinkPress:a,onPageLinkPress:c};return(0,_jsxRuntime.jsx)(_reactNative.View,{style:d,testID:h,children:k.map(e=>(0,_jsxRuntime.jsx)(RenderBlock,{block:e,ctx:y},e.key))})}Markdown.displayName="Markdown";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MenuSurface=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_placement=require("../../utils/placement.js"),_responsive=require("../../utils/responsive.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Box/index.js"),_index3=require("../Divider/index.js"),_index4=require("../ListItem/index.js"),_index5=require("../Modal/index.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_index6=require("../OptionSheet/index.js"),_index7=require("../Text/index.js"),_focusHost=require("./focusHost.js"),_menuModel=require("./menuModel.js"),_webOnly=require("./webOnly.js"),_jsxRuntime=require("react/jsx-runtime");const MENU_MIN_WIDTH=180,MENU_MAX_WIDTH=280,TOP_ACTION_MIN_HEIGHT=64,ICON_SIZE=20,PREVIEW_LIFT=1.02,BACK_KEY="__menu-back",TOP_PREFIX="__menu-top:",MenuSurface=e=>{const{open:t,anchor:i,items:n,title:s,topActions:r,placement:o,presentation:a,unavailable:c,context:l=!1,preview:u,onClose:d,restoreFocusTo:_,haptic:m,accessibilityLabel:p,labels:x,testID:h}=e,b=(0,_index.useTheme)(),f=(0,_react.useMemo)(()=>buildStyles(b),[b]),v=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),[j,y]=(0,_ModalSafeArea.useModalInsets)(),g=(0,_react.useMemo)(()=>({...v,top:j.top,bottom:j.bottom}),[v,j]),R=(0,_reactNative.useWindowDimensions)(),w=(0,_usePresenceMotion.usePresenceMotion)(),I=w.duration("fast"),A=(0,_react.useMemo)(()=>(0,_menuModel.visibleGroups)(n,c),[n,c]),M=(0,_react.useMemo)(()=>(0,_menuModel.visibleTopActions)(r,c),[r,c]),k="sheet"===a||"auto"===a&&R.width<_responsive.Breakpoints.lg&&(0,_menuModel.wantsSheet)(A,M),[S,N]=(0,_react.useState)(null),[D,E]=(0,_react.useState)(null),C=(0,_react.useRef)(d);C.current=d;const O=(0,_react.useRef)(_);O.current=_;const L=(0,_react.useRef)(null),T=(0,_react.useRef)(!1),q=(0,_react.useRef)(!1),P=(0,_react.useRef)(new Map),H=(0,_react.useRef)(null),V=(0,_react.useCallback)(()=>{if(!T.current)return;T.current=!1;const e=L.current;L.current=null,e?e():(0,_focusHost.focusHost)(O.current?.())},[]);(0,_react.useEffect)(()=>{if(t)return q.current=!0,T.current=!1,L.current=null,(0,_placement.claimAnchoredSurface)(()=>C.current());q.current&&(q.current=!1,T.current=!0,N(null),E(null))},[t]);const B=(0,_react.useCallback)(e=>{if(e.disabled)return;const t=(0,_hapticUtils.resolveHaptic)(m,"selection");t&&(0,_hapticUtils.triggerHaptic)(t),e.key!==BACK_KEY?e.submenu?N(e):(L.current=e.onPress??null,C.current()):N(null)},[m]),F=(0,_react.useMemo)(()=>({width:R.width,height:R.height,insets:g}),[R.width,R.height,g]),K=(0,_react.useMemo)(()=>{if(!i||!D)return null;const e=i.x+i.width/2>F.width/2?"end":"start";return(0,_placement.computePlacement)(i,D,F,o,{align:e})},[i,D,F,o]);let $=F.height-g.top-g.bottom-2*_placement.PLACEMENT_MARGIN;if(i&&K){const e=(0,_placement.placementRoom)(i,F);$="top"===K.placement?e.above:e.below}const z=Math.min(280,F.width-g.left-g.right-2*_placement.PLACEMENT_MARGIN),U=t&&null!==K,W=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,Y=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current;(0,_react.useEffect)(()=>{if(!U)return(0,_index.setNativeValue)(W,0),void(0,_index.setNativeValue)(Y,1);const e=[_reactNative.Animated.timing(W,{toValue:1,duration:I,easing:_reactNative.Easing.bezier(...b.motion.ease.decelerate),useNativeDriver:_nativeDriver.nativeDriver})];l&&!w.reduced&&e.push(_reactNative.Animated.spring(Y,{toValue:1.02,damping:b.motion.spring.snappy.damping,stiffness:b.motion.spring.snappy.stiffness,mass:b.motion.spring.snappy.mass,useNativeDriver:_nativeDriver.nativeDriver}));const t=_reactNative.Animated.parallel(e);return t.start(),()=>t.stop()},[U,l,w.reduced,W,Y,b.motion,I]);const G=(0,_react.useCallback)(e=>{const{width:t,height:i}=e.nativeEvent.layout;E(e=>e&&e.width===t&&e.height===i?e:{width:t,height:i})},[]),X=l&&"top"===K?.placement,Z=S?.submenu?[S.submenu]:A,J=X?[...Z].reverse().map(e=>[...e].reverse()):Z,Q=[];if(S)Q.push({key:BACK_KEY,label:S.label});else for(const e of M)Q.push({key:`${TOP_PREFIX}${e.key}`,label:e.label,item:e});for(const e of J)for(const t of e)Q.push({key:t.key,label:t.label,item:t});const ee=Q[0]?.key;(0,_react.useEffect)(()=>{if(!U||k||!ee)return;const e=setTimeout(()=>(0,_focusHost.focusHost)(P.current.get(ee)),_focusHost.FOCUS_DELAY_MS);return()=>clearTimeout(e)},[U,k,ee]);const setItemRef=e=>t=>{t?P.current.set(e,t):P.current.delete(e)},te=(0,_webOnly.webOnly)({onKeyDown:e=>{const t=e.key??e.nativeEvent?.key??"",i=Q.length,n=Q.findIndex(e=>e.key===H.current),s=Q[n];let r=-1;if("ArrowDown"===t)r=(n+1)%i;else if("ArrowUp"===t)r=n<=0?i-1:n-1;else if("Home"===t)r=0;else if("End"===t)r=i-1;else{if("ArrowLeft"===t&&S)return e.preventDefault?.(),void N(null);if("ArrowRight"===t&&s?.item?.submenu)return e.preventDefault?.(),void B(s.item);if(1===t.length&&""!==t.trim()){const e=t.toLowerCase();for(let t=1;t<=i;t+=1){const s=(n+t)%i,o=Q[s];if(void 0===o)throw new Error("MenuSurface key navigation stepped outside its items.");if(o.label.toLowerCase().startsWith(e)){r=s;break}}}}r>=0&&(e.preventDefault?.(),(e=>{const t=Q[e];t&&(0,_focusHost.focusHost)(P.current.get(t.key))})(r))}});if(k){const e=S?.submenu?[{key:BACK_KEY,label:x.back,icon:"chevron-left"},...S.submenu]:[...M,...A.flat()],i=[...new Set(e.filter(e=>e.checked).map(e=>e.key))];return(0,_jsxRuntime.jsx)(_index6.OptionSheet,{open:t,onClose:d,onAfterClose:V,title:S?.label??s,options:e,getOptionLabel:e=>e.label,getOptionValue:e=>e.key,isOptionDisabled:e=>Boolean(e.disabled),destructiveOf:e=>Boolean(e.destructive),getOptionDescription:e=>e.description,getOptionIcon:e=>{const t=e;return(0,_slotIcon.renderSlotIcon)(t.icon,{color:t.destructive?b.colors["danger-text"]:b.colors["text-muted"],size:20,disabled:Boolean(t.disabled)})},value:i,onChange:(e,t)=>B(t),accessibilityLabel:p??s,testID:h?`${h}-sheet`:void 0})}const inkFor=e=>e.disabled?b.colors["text-disabled"]:e.destructive?b.colors["danger-text"]:b.colors["text-body"],inkRoleFor=e=>e.disabled?"disabled":e.destructive?"danger":"primary",ie=S?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index4.ListItem,{ref:setItemRef(BACK_KEY),variant:"menu",onPress:()=>N(null),onFocus:()=>{H.current=BACK_KEY},accessibilityLabel:`${x.back}, ${S.label}`,leading:(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.icon,children:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-left",size:20,color:b.colors["text-muted"]})}),title:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",weight:"semibold",numberOfLines:1,children:S.label})}),(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[s?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"secondary",accessibilityRole:"header",numberOfLines:2,style:f.title,children:s}):null,M.length>0?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.topRow,children:M.map(e=>{const t=`${TOP_PREFIX}${e.key}`,i=Boolean(e.disabled),n=inkFor(e);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:setItemRef(t),onPress:()=>B(e),onFocus:()=>{H.current=t},disabled:i,accessibilityRole:"menuitem",accessibilityLabel:e.accessibilityLabel??e.label,accessibilityState:{disabled:i},"aria-disabled":i,testID:e.testID,style:({pressed:e})=>[f.topAction,e?f.pressed:null],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(e.icon,{color:n,size:20,disabled:i})}),(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:inkRoleFor(e),numberOfLines:1,children:e.label})]},t)})}),(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"})]}):null]});return(0,_jsxRuntime.jsxs)(_index5.Modal,{open:t,onClose:d,presentation:"fullScreen",bare:!0,backdropOpacity:l?void 0:0,haptic:!1,labels:{close:x.close},onInsetsChange:y,onDismissed:V,testID:h?`${h}-modal`:void 0,children:[l&&u&&i?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:[f.preview,{left:i.x,top:i.y,width:i.width,height:i.height,transform:[{scale:Y}]}],children:u}):null,(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{accessibilityRole:"menu",accessibilityLabel:S?.label??p??s,onLayout:G,testID:h?`${h}-menu`:void 0,...te,style:[f.anchored,{left:K?.x??0,top:K?.y??0,maxWidth:z,opacity:U?W:0}],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.surface,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[f.clip,{maxHeight:$}],children:[ie,(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:f.scroll,bounces:!1,keyboardShouldPersistTaps:"handled",children:J.map((e,t)=>{const i=e.some(e=>null!=e.icon),[n]=e;if(void 0===n)throw new Error("MenuSurface has a group with no items to draw.");return(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[t>0?(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"}):null,e.map(e=>((e,t)=>{const i=Boolean(e.disabled),n=inkFor(e),s=e.detail||e.checked||e.submenu?(0,_jsxRuntime.jsxs)(_index2.Row,{gap:"md",children:[e.detail?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"tertiary",children:e.detail}):null,e.checked?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"check",size:20,color:b.colors.primary}):null,e.submenu?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-right",size:20,color:b.colors["text-subtle"]}):null]}):void 0;return(0,_jsxRuntime.jsx)(_index4.ListItem,{ref:setItemRef(e.key),variant:"menu",onPress:()=>B(e),onFocus:()=>{H.current=e.key},disabled:i,checked:e.checked,accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,rightPlacement:"side",leading:t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.icon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(e.icon,{color:n,size:20,disabled:i})}):void 0,title:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",color:inkRoleFor(e),numberOfLines:2,children:e.label}),subtitle:e.description?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"secondary",numberOfLines:2,children:e.description}):void 0,trailing:s},e.key)})(e,i))]},n.key)})})]})})})]})};exports.MenuSurface=MenuSurface;const buildStyles=e=>_reactNative.StyleSheet.create({preview:{position:"absolute"},anchored:{position:"absolute",minWidth:180},surface:{backgroundColor:e.colors.surface,borderRadius:e.radius.md,..._corners.smoothCorners,...e.shadow.popover},clip:{borderRadius:e.radius.md,..._corners.smoothCorners,overflow:"hidden"},scroll:{flexGrow:0,flexShrink:1},title:{paddingHorizontal:e.space.md,paddingTop:e.space.sm,paddingBottom:e.space.xs},pressed:{backgroundColor:e.colors["surface-pressed"]},icon:{width:20,alignItems:"center"},topRow:{flexDirection:"row",padding:e.space.xs,gap:e.space.xs},topAction:{flexGrow:1,flexBasis:0,alignItems:"center",justifyContent:"center",gap:e.space.xs,minHeight:64,borderRadius:e.radius.sm,..._corners.smoothCorners}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MenuSurface=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_placement=require("../../utils/placement.js"),_responsive=require("../../utils/responsive.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index2=require("../Box/index.js"),_index3=require("../Divider/index.js"),_index4=require("../ListItem/index.js"),_index5=require("../Modal/index.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_index6=require("../OptionSheet/index.js"),_index7=require("../Text/index.js"),_focusHost=require("./focusHost.js"),_menuModel=require("./menuModel.js"),_webOnly=require("./webOnly.js"),_jsxRuntime=require("react/jsx-runtime");const MENU_MIN_WIDTH=180,MENU_MAX_WIDTH=280,TOP_ACTION_MIN_HEIGHT=64,ICON_SIZE=20,PREVIEW_LIFT=1.02,BACK_KEY="__menu-back",TOP_PREFIX="__menu-top:",MenuSurface=e=>{const{open:t,anchor:i,items:n,title:s,topActions:r,placement:o,presentation:a,unavailable:c,context:l=!1,preview:u,onClose:d,restoreFocusTo:_,haptic:m,accessibilityLabel:p,labels:x,testID:h}=e,b=(0,_index.useTheme)(),f=(0,_react.useMemo)(()=>buildStyles(b),[b]),v=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),[j,y]=(0,_ModalSafeArea.useModalInsets)(),g=(0,_react.useMemo)(()=>({...v,top:j.top,bottom:j.bottom}),[v,j]),R=(0,_reactNative.useWindowDimensions)(),w=(0,_usePresenceMotion.usePresenceMotion)(),I=w.duration("fast"),A=(0,_react.useMemo)(()=>(0,_menuModel.visibleGroups)(n,c),[n,c]),M=(0,_react.useMemo)(()=>(0,_menuModel.visibleTopActions)(r,c),[r,c]),k="sheet"===a||"auto"===a&&R.width<_responsive.Breakpoints.lg&&(0,_menuModel.wantsSheet)(A,M),[S,N]=(0,_react.useState)(null),[D,E]=(0,_react.useState)(null),C=(0,_react.useRef)(d);C.current=d;const O=(0,_react.useRef)(_);O.current=_;const L=(0,_react.useRef)(null),T=(0,_react.useRef)(!1),q=(0,_react.useRef)(!1),P=(0,_react.useRef)(new Map),H=(0,_react.useRef)(null),V=(0,_react.useCallback)(()=>{if(!T.current)return;T.current=!1;const e=L.current;L.current=null,e?e():(0,_focusHost.focusHost)(O.current?.())},[]);(0,_react.useEffect)(()=>{if(t)return q.current=!0,T.current=!1,L.current=null,(0,_placement.claimAnchoredSurface)(()=>C.current());q.current&&(q.current=!1,T.current=!0,N(null),E(null))},[t]);const B=(0,_react.useCallback)(e=>{if(e.disabled)return;const t=(0,_hapticUtils.resolveHaptic)(m,"selection");t&&(0,_hapticUtils.triggerHaptic)(t),e.key!==BACK_KEY?e.submenu?N(e):(L.current=e.onPress??null,C.current()):N(null)},[m]),F=(0,_react.useMemo)(()=>({width:R.width,height:R.height,insets:g}),[R.width,R.height,g]),K=(0,_react.useMemo)(()=>{if(!i||!D)return null;const e=i.x+i.width/2>F.width/2?"end":"start";return(0,_placement.computePlacement)(i,D,F,o,{align:e})},[i,D,F,o]);let $=F.height-g.top-g.bottom-2*_placement.PLACEMENT_MARGIN;if(i&&K){const e=(0,_placement.placementRoom)(i,F);$="top"===K.placement?e.above:e.below}const z=Math.min(280,F.width-g.left-g.right-2*_placement.PLACEMENT_MARGIN),U=t&&null!==K,W=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,Y=(0,_react.useRef)((0,_index.createAnimatedValue)(1)).current;(0,_react.useEffect)(()=>{if(!U)return(0,_index.setNativeValue)(W,0),void(0,_index.setNativeValue)(Y,1);const e=[_reactNative.Animated.timing(W,{toValue:1,duration:I,easing:_reactNative.Easing.bezier(...b.motion.ease.decelerate),useNativeDriver:_nativeDriver.nativeDriver})];l&&!w.reduced&&e.push(_reactNative.Animated.spring(Y,{toValue:1.02,damping:b.motion.spring.snappy.damping,stiffness:b.motion.spring.snappy.stiffness,mass:b.motion.spring.snappy.mass,useNativeDriver:_nativeDriver.nativeDriver}));const t=_reactNative.Animated.parallel(e);return t.start(),()=>t.stop()},[U,l,w.reduced,W,Y,b.motion,I]);const G=(0,_react.useCallback)(e=>{const{width:t,height:i}=e.nativeEvent.layout;E(e=>e&&e.width===t&&e.height===i?e:{width:t,height:i})},[]),X=l&&"top"===K?.placement,Z=S?.submenu?[S.submenu]:A,J=X?[...Z].reverse().map(e=>[...e].reverse()):Z,Q=[];if(S)Q.push({key:BACK_KEY,label:S.label});else for(const e of M)Q.push({key:`${TOP_PREFIX}${e.key}`,label:e.label,item:e});for(const e of J)for(const t of e)Q.push({key:t.key,label:t.label,item:t});const ee=Q[0]?.key;(0,_react.useEffect)(()=>{if(!U||k||!ee)return;const e=setTimeout(()=>(0,_focusHost.focusHost)(P.current.get(ee)),_focusHost.FOCUS_DELAY_MS);return()=>clearTimeout(e)},[U,k,ee]);const setItemRef=e=>t=>{t?P.current.set(e,t):P.current.delete(e)},te=(0,_webOnly.webOnly)({onKeyDown:e=>{const t=e.key??e.nativeEvent?.key??"",i=Q.length,n=Q.findIndex(e=>e.key===H.current),s=Q[n];let r=-1;if("ArrowDown"===t)r=(n+1)%i;else if("ArrowUp"===t)r=n<=0?i-1:n-1;else if("Home"===t)r=0;else if("End"===t)r=i-1;else{if("ArrowLeft"===t&&S)return e.preventDefault?.(),void N(null);if("ArrowRight"===t&&s?.item?.submenu)return e.preventDefault?.(),void B(s.item);if(1===t.length&&""!==t.trim()){const e=t.toLowerCase();for(let t=1;t<=i;t+=1){const s=(n+t)%i,o=Q[s];if(void 0===o)throw new Error("MenuSurface key navigation stepped outside its items.");if(o.label.toLowerCase().startsWith(e)){r=s;break}}}}r>=0&&(e.preventDefault?.(),(e=>{const t=Q[e];t&&(0,_focusHost.focusHost)(P.current.get(t.key))})(r))}});if(k){const e=S?.submenu?[{key:BACK_KEY,label:x.back,icon:"chevron-left"},...S.submenu]:[...M,...A.flat()],i=[...new Set(e.filter(e=>e.checked).map(e=>e.key))];return(0,_jsxRuntime.jsx)(_index6.OptionSheet,{open:t,onClose:d,onAfterClose:V,title:S?.label??s,options:e,getOptionLabel:e=>e.label,getOptionValue:e=>e.key,isOptionDisabled:e=>Boolean(e.disabled),destructiveOf:e=>Boolean(e.destructive),getOptionDescription:e=>e.description,getOptionIcon:e=>(0,_slotIcon.renderSlotIcon)(e.icon,{color:e.destructive?b.colors["danger-text"]:b.colors["text-muted"],size:20,disabled:Boolean(e.disabled)}),value:i,onChange:(e,t)=>B(t),accessibilityLabel:p??s,testID:h?`${h}-sheet`:void 0})}const inkFor=e=>e.disabled?b.colors["text-disabled"]:e.destructive?b.colors["danger-text"]:b.colors["text-body"],inkRoleFor=e=>e.disabled?"disabled":e.destructive?"danger":"primary",ie=S?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index4.ListItem,{ref:setItemRef(BACK_KEY),variant:"menu",onPress:()=>N(null),onFocus:()=>{H.current=BACK_KEY},accessibilityLabel:`${x.back}, ${S.label}`,leading:(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.icon,children:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-left",size:20,color:b.colors["text-muted"]})}),title:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",weight:"semibold",numberOfLines:1,children:S.label})}),(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[s?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"secondary",accessibilityRole:"header",numberOfLines:2,style:f.title,children:s}):null,M.length>0?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.topRow,children:M.map(e=>{const t=`${TOP_PREFIX}${e.key}`,i=Boolean(e.disabled),n=inkFor(e);return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:setItemRef(t),onPress:()=>B(e),onFocus:()=>{H.current=t},disabled:i,accessibilityRole:"menuitem",accessibilityLabel:e.accessibilityLabel??e.label,accessibilityState:{disabled:i},"aria-disabled":i,testID:e.testID,style:({pressed:e})=>[f.topAction,e?f.pressed:null],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(e.icon,{color:n,size:20,disabled:i})}),(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:inkRoleFor(e),numberOfLines:1,children:e.label})]},t)})}),(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"})]}):null]});return(0,_jsxRuntime.jsxs)(_index5.Modal,{open:t,onClose:d,presentation:"fullScreen",bare:!0,backdropOpacity:l?void 0:0,haptic:!1,labels:{close:x.close},onInsetsChange:y,onDismissed:V,testID:h?`${h}-modal`:void 0,children:[l&&u&&i?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:[f.preview,{left:i.x,top:i.y,width:i.width,height:i.height,transform:[{scale:Y}]}],children:u}):null,(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{accessibilityRole:"menu",accessibilityLabel:S?.label??p??s,onLayout:G,testID:h?`${h}-menu`:void 0,...te,style:[f.anchored,{left:K?.x??0,top:K?.y??0,maxWidth:z,opacity:U?W:0}],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.surface,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[f.clip,{maxHeight:$}],children:[ie,(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:f.scroll,bounces:!1,keyboardShouldPersistTaps:"handled",children:J.map((e,t)=>{const i=e.some(e=>null!=e.icon),[n]=e;if(void 0===n)throw new Error("MenuSurface has a group with no items to draw.");return(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[t>0?(0,_jsxRuntime.jsx)(_index3.Divider,{spacing:"none"}):null,e.map(e=>((e,t)=>{const i=Boolean(e.disabled),n=inkFor(e),s=e.detail||e.checked||e.submenu?(0,_jsxRuntime.jsxs)(_index2.Row,{gap:"md",children:[e.detail?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"tertiary",children:e.detail}):null,e.checked?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"check",size:20,color:b.colors.primary}):null,e.submenu?(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:"chevron-right",size:20,color:b.colors["text-subtle"]}):null]}):void 0;return(0,_jsxRuntime.jsx)(_index4.ListItem,{ref:setItemRef(e.key),variant:"menu",onPress:()=>B(e),onFocus:()=>{H.current=e.key},disabled:i,checked:e.checked,accessibilityLabel:e.accessibilityLabel??e.label,testID:e.testID,rightPlacement:"side",leading:t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:f.icon,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(e.icon,{color:n,size:20,disabled:i})}):void 0,title:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"body",color:inkRoleFor(e),numberOfLines:2,children:e.label}),subtitle:e.description?(0,_jsxRuntime.jsx)(_index7.Text,{variant:"caption",color:"secondary",numberOfLines:2,children:e.description}):void 0,trailing:s},e.key)})(e,i))]},n.key)})})]})})})]})};exports.MenuSurface=MenuSurface;const buildStyles=e=>_reactNative.StyleSheet.create({preview:{position:"absolute"},anchored:{position:"absolute",minWidth:180},surface:{backgroundColor:e.colors.surface,borderRadius:e.radius.md,..._corners.smoothCorners,...e.shadow.popover},clip:{borderRadius:e.radius.md,..._corners.smoothCorners,overflow:"hidden"},scroll:{flexGrow:0,flexShrink:1},title:{paddingHorizontal:e.space.md,paddingTop:e.space.sm,paddingBottom:e.space.xs},pressed:{backgroundColor:e.colors["surface-pressed"]},icon:{width:20,alignItems:"center"},topRow:{flexDirection:"row",padding:e.space.xs,gap:e.space.xs},topAction:{flexGrow:1,flexBasis:0,alignItems:"center",justifyContent:"center",gap:e.space.xs,minHeight:64,borderRadius:e.radius.sm,..._corners.smoothCorners}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.focusHost=exports.FOCUS_DELAY_MS=void 0;var _reactNative=require("react-native");const FOCUS_DELAY_MS=exports.FOCUS_DELAY_MS=150,isHost=e=>null!=e&&"function"==typeof e.measureInWindow,focusHost=e=>{"web"!==_reactNative.Platform.OS?isHost(e)&&_reactNative.AccessibilityInfo.sendAccessibilityEvent(e,"focus"):e?.focus?.()};exports.focusHost=focusHost;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.focusHost=exports.FOCUS_DELAY_MS=void 0;var _reactNative=require("react-native"),_guards=require("../../utils/guards.js");const FOCUS_DELAY_MS=exports.FOCUS_DELAY_MS=150,isHost=s=>(0,_guards.isRecord)(s)&&"function"==typeof s.measureInWindow,focusHost=s=>{"web"!==_reactNative.Platform.OS?isHost(s)&&_reactNative.AccessibilityInfo.sendAccessibilityEvent(s,"focus"):(0,_guards.isRecord)(s)&&"function"==typeof s.focus&&s.focus()};exports.focusHost=focusHost;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_OPTION_SHEET_LABELS=void 0,exports.OptionSheet=OptionSheet,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useDragToDismiss=require("../../hooks/useDragToDismiss.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index2=require("../Modal/index.js"),_index3=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const SEARCH_ICON_SIZE=18,DEFAULT_OPTION_SHEET_LABELS=exports.DEFAULT_OPTION_SHEET_LABELS=Object.freeze({searchPlaceholder:"Search…",empty:"No options",done:"Done",closePicker:"Close picker",fallbackName:"Options",searchOptions:"Search options",clearSearch:"Clear search",jumpToLetter:"Jump to letter",jumpTo:e=>`Jump to ${e}`}),selectOptionLabel=e=>e.label,selectOptionValue=e=>e.value,selectOptionDescription=e=>e.description,selectOptionDisabled=e=>!0===e.disabled,selectOptionIcon=e=>e.icon,hostStyle=_reactNative.StyleSheet.create({host:{padding:0,paddingTop:0,paddingHorizontal:0,paddingBottom:0,backgroundColor:"transparent",borderTopLeftRadius:0,borderTopRightRadius:0,shadowOpacity:0,elevation:0}}).host;function OptionSheetPanel(e){const{onClose:t,title:i,options:r,sections:s,renderSectionHeader:o,renderOption:a,alphabetIndex:n=!1,labels:l,getOptionLabel:c,getOptionValue:d,getOptionDescription:u,isOptionDisabled:p,getOptionIcon:h,destructiveOf:m,value:x,onChange:_,multi:b=!1,searchable:g=!1,searchSelectionColor:y,accessibilityLabel:j,optionStyle:f,selectedOptionStyle:S,optionTextStyle:R,selectedOptionTextStyle:v,testID:T}=e,w=c??selectOptionLabel,C=d??selectOptionValue,N=u??selectOptionDescription,L=p??selectOptionDisabled,O=h??selectOptionIcon,I=(0,_index.useTheme)(),k=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),D=(0,_react.useMemo)(()=>buildStyles(I),[I]),[H,V]=(0,_react.useState)(""),P=_reactNative.Dimensions.get("window").height,E=Math.round(.7*P),M=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,{handleGesture:A,opacity:B}=(0,_useDragToDismiss.useDragToDismiss)({drag:M,travel:E,onDismiss:t}),z=(0,_react.useMemo)(()=>_reactNativeGestureHandler.Gesture.Native(),[]),F=(0,_reactNativeKeyboardController.useKeyboardState)(e=>e.height),W=Math.max(0,Math.round(F)),q=Math.max(k.top,_reactNative.StatusBar.currentHeight??0)+I.space.sm,G=W>0,U=G?Math.max(0,Math.min(E,P-W-q)):E,$=(0,_react.useMemo)(()=>{const e=g?H.trim().toLowerCase():"",matches=t=>0===e.length||w(t).toLowerCase().includes(e)||(N(t)??"").toLowerCase().includes(e);if(!s)return r.filter(matches).map(e=>({kind:"option",option:e}));const t=[];return s.forEach((e,i)=>{const r=e.options.filter(matches);if(0!==r.length){t.push({kind:"header",title:e.title});for(const e of r)t.push({kind:"option",option:e,section:i})}}),t},[g,H,r,s,w,N]),K=(0,_react.useCallback)(()=>{t()},[t]),J=(0,_react.useRef)(null),Y=(0,_react.useMemo)(()=>{const e=new Map;if(!n)return e;let t=0;if(s)for(const[e,i]of $.entries())"header"===i.kind&&(t=e+1);for(const[i,r]of $.entries()){if(i<t||"option"!==r.kind)continue;const s=w(r.option).trim().charAt(0).toUpperCase(),o=/^[A-Z]$/.test(s)?s:"#";e.has(o)||e.set(o,i)}return e},[n,$,s,w]),Z=n&&Y.size>0&&0===H.trim().length,Q=(0,_react.useMemo)(()=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ",...Y.has("#")?["#"]:[]],[Y]),X=(0,_react.useCallback)(e=>{const t=Y.get(e);void 0!==t&&J.current?.scrollToIndex({index:t,animated:!0,viewPosition:0})},[Y]),ee=(0,_react.useRef)(null),te=(0,_react.useCallback)(()=>{null!==ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),ie=(0,_react.useCallback)(e=>{J.current?.scrollToOffset({offset:e.averageItemLength*e.index,animated:!1}),te(),ee.current=setTimeout(()=>{ee.current=null,J.current?.scrollToIndex({index:e.index,animated:!0,viewPosition:0})},50)},[te]);(0,_react.useEffect)(()=>te,[te]);return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:D.gestureRoot,children:(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{testID:T,accessibilityViewIsModal:!0,accessibilityLabel:j??i??l.fallbackName,style:[D.sheet,{maxHeight:U,marginBottom:W,paddingBottom:G?I.space.lg:k.bottom+I.space.lg,backgroundColor:I.colors.surface,borderTopLeftRadius:I.radius.xl,borderTopRightRadius:I.radius.xl,..._corners.smoothCorners,opacity:B,transform:[{translateY:M}],...I.shadow.modal}],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:A,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.sheetHandleRow,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.sheetHandle,{backgroundColor:I.colors.border}]})}),i?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"title",style:[D.sheetTitle,{paddingHorizontal:I.space.lg,marginBottom:I.space.sm}],children:i}):null]})}),g?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.searchWrap,{marginHorizontal:I.space.lg,marginBottom:I.space.sm}],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[D.searchBox,{backgroundColor:I.colors["bg-subtle"],borderColor:I.colors.border,borderRadius:I.radius.md,..._corners.smoothCorners,paddingHorizontal:I.space.md,gap:I.space.sm}],children:[(I.settings.icons.search??_defaultIcons.defaultIcons.search)({size:18,color:I.colors["text-subtle"]}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{value:H,onChangeText:V,placeholder:l.searchPlaceholder,placeholderTextColor:I.colors["text-subtle"],selectionColor:y??I.colors["focus-ring"],accessibilityLabel:l.searchOptions,style:[D.searchInput,{color:I.colors["text-body"],fontSize:I.text.base.size,paddingVertical:I.space.sm}]}),H.length>0?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>V(""),hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:l.clearSearch,children:(I.settings.icons.close??_defaultIcons.defaultIcons.close)({size:18,color:I.colors["text-muted"]})}):null]})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[D.listWrap,Z?D.listRow:null],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:z,children:(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:J,data:$,keyExtractor:e=>"header"===e.kind?`h:${e.title}`:`o:${e.section??""}:${String(C(e.option))}`,renderItem:({item:e,index:t})=>{if("header"===e.kind)return(0,_jsxRuntime.jsx)(_reactNative.View,{accessible:!0,accessibilityRole:"header",style:[D.sectionHeader,{paddingHorizontal:I.space.lg,paddingTop:I.space.md}],children:o?o(e.title):(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",weight:"semibold",color:"tertiary",style:D.sectionTitle,children:e.title.toUpperCase()})});const i=e.option,r=w(i),s=C(i),n=N(i),l=O(i),c=(d=s,Array.isArray(x)?x.some(e=>String(e)===String(d)):null!=x&&String(x)===String(d));var d;const u=L(i),p=m?.(i)??!1;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>_(s,i),disabled:u,android_ripple:{color:I.colors["surface-pressed"],borderless:!1},accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{selected:c,disabled:u},"aria-selected":c,"aria-disabled":u,style:({pressed:e})=>[D.optionRow,{backgroundColor:c?I.colors["surface-selected"]:e?I.colors["surface-pressed"]:"transparent",opacity:u?.5:1,paddingHorizontal:I.space.lg,paddingVertical:I.space.md},f,c?S:null],children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.optionTextWrap,children:a({option:i,selected:c,disabled:u,index:t})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.optionIcon,children:l}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:D.optionTextWrap,children:[(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:c?"semibold":"medium",color:p?"danger":c?"brand":void 0,style:[D.optionLabel,R,c?v:null],children:r}),n?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",color:"tertiary",numberOfLines:2,style:D.optionDescription,children:n}):null]})]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.checkbox,{borderColor:c?I.colors.primary:I.colors.border,backgroundColor:c?I.colors.primary:"transparent"}],children:c?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.checkboxTick}):null}):c?"icon"===I.settings.components["option-sheet"]?.selectedMarker?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.singleSelectedIcon,children:(I.settings.icons.selectedTick??_defaultIcons.defaultIcons.selectedTick)({size:20,color:I.colors.primary})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.singleSelectedDot,{backgroundColor:I.colors.primary}]}):null]})},onScrollToIndexFailed:ie,overScrollMode:"never",bounces:!1,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:!Z,style:Z?D.listBesideRail:null,ListEmptyComponent:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",color:"tertiary",align:"center",style:{paddingVertical:I.space.xl},children:l.empty})})}),Z?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.rail,{paddingRight:I.space.xs}],accessibilityRole:"list",accessibilityLabel:l.jumpToLetter,testID:"option-sheet-alphabet",children:Q.map(e=>{const t=Y.has(e);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>X(e),disabled:!t,hitSlop:{left:8,right:8},...(0,_hitSlop.hitSlopMarker)({left:8,right:8}),accessibilityRole:"button",accessibilityLabel:l.jumpTo(e),accessibilityState:{disabled:!t},"aria-disabled":!t,style:D.railLetter,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",weight:"semibold",color:t?"brand":"tertiary",style:[D.railLetterText,{opacity:t?1:.45}],children:e})},e)})}):null]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.sheetFooter,{borderTopColor:I.colors["border-subtle"],paddingHorizontal:I.space.lg,paddingVertical:I.space.md}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:K,accessibilityRole:"button",accessibilityLabel:l.done,style:({pressed:e})=>[D.doneButton,{backgroundColor:e?I.colors["primary-pressed"]:I.colors.primary,borderRadius:I.radius.md,..._corners.smoothCorners,paddingVertical:I.space.sm,paddingHorizontal:I.space.lg}],children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:"semibold",style:{color:I.colors["on-primary"]},children:l.done})})}):null]})})}function OptionSheet(e){const{open:t,onOpenChange:i,onAfterClose:r,labels:s,onClose:o,haptic:a,...n}=e,l=(0,_react.useMemo)(()=>({...DEFAULT_OPTION_SHEET_LABELS,...s}),[s]),c=(0,_react.useRef)(i);c.current=i;const d=(0,_react.useRef)(!1);return(0,_react.useEffect)(()=>{d.current!==t&&(d.current=t,c.current?.(t))},[t]),(0,_jsxRuntime.jsx)(_index2.Modal,{open:t,onClose:o,presentation:"bottom",onDismissed:r,haptic:a,contentStyle:hostStyle,labels:{close:l.closePicker},accessibilityLabel:n.accessibilityLabel??n.title??l.fallbackName,children:(0,_jsxRuntime.jsx)(OptionSheetPanel,{...n,onClose:o,labels:l})})}OptionSheet.displayName="OptionSheet";const buildStyles=e=>_reactNative.StyleSheet.create({gestureRoot:{width:"100%"},sheet:{paddingBottom:e.space.lg,overflow:"hidden"},sheetHandleRow:{alignItems:"center",paddingTop:e.space.sm,paddingBottom:e.space.sm},sheetHandle:{width:36,height:4,borderRadius:e.radius.pill,..._corners.smoothCorners},sheetTitle:{includeFontPadding:!1},searchWrap:{width:"auto"},searchBox:{flexDirection:"row",alignItems:"center",borderWidth:1},searchInput:{flex:1,includeFontPadding:!1},optionRow:{flexDirection:"row",alignItems:"center"},sectionHeader:{paddingBottom:e.space.xs},listWrap:{flexShrink:1},listRow:{flexDirection:"row"},listBesideRail:{flex:1},rail:{justifyContent:"space-between",alignItems:"center",alignSelf:"stretch",paddingVertical:e.space.xs},railLetter:{paddingHorizontal:e.space.xs,minHeight:14,justifyContent:"center"},railLetterText:{includeFontPadding:!1,lineHeight:14},sectionTitle:{includeFontPadding:!1,letterSpacing:.6},optionIcon:{marginRight:e.space.md},optionTextWrap:{flex:1},optionLabel:{includeFontPadding:!1},optionDescription:{includeFontPadding:!1,marginTop:e.space.xxs},checkbox:{width:22,height:22,borderRadius:e.radius.sm,..._corners.smoothCorners,borderWidth:2,alignItems:"center",justifyContent:"center",marginLeft:e.space.md},checkboxTick:{width:10,height:6,borderLeftWidth:2,borderBottomWidth:2,borderColor:e.colors["on-primary"],transform:[{rotate:"-45deg"},{translateY:-1}]},singleSelectedDot:{width:8,height:8,borderRadius:e.radius.pill,..._corners.smoothCorners,marginLeft:e.space.md},singleSelectedIcon:{marginLeft:e.space.md},sheetFooter:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,alignItems:"flex-end"},doneButton:{alignSelf:"flex-end"}});var _default=exports.default=OptionSheet;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_OPTION_SHEET_LABELS=void 0,exports.OptionSheet=OptionSheet,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useDragToDismiss=require("../../hooks/useDragToDismiss.js"),_index=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_hitSlop=require("../../utils/hitSlop.js"),_defaultIcons=require("../AppIcon/defaultIcons.js"),_index2=require("../Modal/index.js"),_index3=require("../Text/index.js"),_optionAccessors=require("./optionAccessors.js"),_jsxRuntime=require("react/jsx-runtime");const SEARCH_ICON_SIZE=18,DEFAULT_OPTION_SHEET_LABELS=exports.DEFAULT_OPTION_SHEET_LABELS=Object.freeze({searchPlaceholder:"Search…",empty:"No options",done:"Done",closePicker:"Close picker",fallbackName:"Options",searchOptions:"Search options",clearSearch:"Clear search",jumpToLetter:"Jump to letter",jumpTo:e=>`Jump to ${e}`}),hostStyle=_reactNative.StyleSheet.create({host:{padding:0,paddingTop:0,paddingHorizontal:0,paddingBottom:0,backgroundColor:"transparent",borderTopLeftRadius:0,borderTopRightRadius:0,shadowOpacity:0,elevation:0}}).host;function OptionSheetPanel(e){const{onClose:t,title:i,options:r,sections:s,renderSectionHeader:o,renderOption:a,alphabetIndex:n=!1,labels:l,getOptionLabel:c,getOptionValue:d,getOptionDescription:u,isOptionDisabled:p,getOptionIcon:h,destructiveOf:m,value:x,onChange:_,multi:b=!1,searchable:g=!1,searchSelectionColor:y,accessibilityLabel:j,optionStyle:f,selectedOptionStyle:S,optionTextStyle:R,selectedOptionTextStyle:v,testID:T}=e,w=c??_optionAccessors.selectOptionLabel,C=d??_optionAccessors.selectOptionValue,N=u??_optionAccessors.selectOptionDescription,L=p??_optionAccessors.selectOptionDisabled,I=h??_optionAccessors.selectOptionIcon,k=(0,_index.useTheme)(),O=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),D=(0,_react.useMemo)(()=>buildStyles(k),[k]),[H,V]=(0,_react.useState)(""),P=_reactNative.Dimensions.get("window").height,A=Math.round(.7*P),E=(0,_react.useRef)((0,_index.createAnimatedValue)(0)).current,{handleGesture:B,opacity:M}=(0,_useDragToDismiss.useDragToDismiss)({drag:E,travel:A,onDismiss:t}),z=(0,_reactNativeGestureHandler.useNativeGesture)(),F=(0,_reactNativeKeyboardController.useKeyboardState)(e=>e.height),q=Math.max(0,Math.round(F)),W=Math.max(O.top,_reactNative.StatusBar.currentHeight??0)+k.space.sm,G=q>0,U=G?Math.max(0,Math.min(A,P-q-W)):A,$=(0,_react.useMemo)(()=>{const e=g?H.trim().toLowerCase():"",matches=t=>0===e.length||w(t).toLowerCase().includes(e)||(N(t)??"").toLowerCase().includes(e);if(!s)return r.filter(matches).map(e=>({kind:"option",option:e}));const t=[];return s.forEach((e,i)=>{const r=e.options.filter(matches);if(0!==r.length){t.push({kind:"header",title:e.title});for(const e of r)t.push({kind:"option",option:e,section:i})}}),t},[g,H,r,s,w,N]),K=(0,_react.useCallback)(()=>{t()},[t]),J=(0,_react.useRef)(null),Y=(0,_react.useMemo)(()=>{const e=new Map;if(!n)return e;let t=0;if(s)for(const[e,i]of $.entries())"header"===i.kind&&(t=e+1);for(const[i,r]of $.entries()){if(i<t||"option"!==r.kind)continue;const s=w(r.option).trim().charAt(0).toUpperCase(),o=/^[A-Z]$/.test(s)?s:"#";e.has(o)||e.set(o,i)}return e},[n,$,s,w]),Z=n&&Y.size>0&&0===H.trim().length,Q=(0,_react.useMemo)(()=>[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ",...Y.has("#")?["#"]:[]],[Y]),X=(0,_react.useCallback)(e=>{const t=Y.get(e);void 0!==t&&J.current?.scrollToIndex({index:t,animated:!0,viewPosition:0})},[Y]),ee=(0,_react.useRef)(null),te=(0,_react.useCallback)(()=>{null!==ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),ie=(0,_react.useCallback)(e=>{J.current?.scrollToOffset({offset:e.averageItemLength*e.index,animated:!1}),te(),ee.current=setTimeout(()=>{ee.current=null,J.current?.scrollToIndex({index:e.index,animated:!0,viewPosition:0})},50)},[te]);(0,_react.useEffect)(()=>te,[te]);return(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:D.gestureRoot,children:(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{testID:T,accessibilityViewIsModal:!0,accessibilityLabel:j??i??l.fallbackName,style:[D.sheet,{maxHeight:U,marginBottom:q,paddingBottom:G?k.space.lg:O.bottom+k.space.lg,backgroundColor:k.colors.surface,borderTopLeftRadius:k.radius.xl,borderTopRightRadius:k.radius.xl,..._corners.smoothCorners,opacity:M,transform:[{translateY:E}],...k.shadow.modal}],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:B,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.sheetHandleRow,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.sheetHandle,{backgroundColor:k.colors.border}]})}),i?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"title",style:[D.sheetTitle,{paddingHorizontal:k.space.lg,marginBottom:k.space.sm}],children:i}):null]})}),g?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.searchWrap,{marginHorizontal:k.space.lg,marginBottom:k.space.sm}],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[D.searchBox,{backgroundColor:k.colors["bg-subtle"],borderColor:k.colors.border,borderRadius:k.radius.md,..._corners.smoothCorners,paddingHorizontal:k.space.md,gap:k.space.sm}],children:[(k.settings.icons.search??_defaultIcons.defaultIcons.search)({size:18,color:k.colors["text-subtle"]}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{value:H,onChangeText:V,placeholder:l.searchPlaceholder,placeholderTextColor:k.colors["text-subtle"],selectionColor:y??k.colors["focus-ring"],accessibilityLabel:l.searchOptions,style:[D.searchInput,{color:k.colors["text-body"],fontSize:k.text.base.size,paddingVertical:k.space.sm}]}),H.length>0?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>V(""),hitSlop:8,...(0,_hitSlop.hitSlopMarker)(8),accessibilityRole:"button",accessibilityLabel:l.clearSearch,children:(k.settings.icons.close??_defaultIcons.defaultIcons.close)({size:18,color:k.colors["text-muted"]})}):null]})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[D.listWrap,Z?D.listRow:null],children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:z,children:(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:J,data:$,keyExtractor:e=>"header"===e.kind?`h:${e.title}`:`o:${e.section??""}:${String(C(e.option))}`,renderItem:({item:e,index:t})=>{if("header"===e.kind)return(0,_jsxRuntime.jsx)(_reactNative.View,{accessible:!0,accessibilityRole:"header",style:[D.sectionHeader,{paddingHorizontal:k.space.lg,paddingTop:k.space.md}],children:o?o(e.title):(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",weight:"semibold",color:"tertiary",style:D.sectionTitle,children:e.title.toUpperCase()})});const i=e.option,r=w(i),s=C(i),n=N(i),l=I(i),c=(d=s,Array.isArray(x)?x.some(e=>String(e)===String(d)):null!=x&&String(x)===String(d));var d;const u=L(i),p=m?.(i)??!1;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>_(s,i),disabled:u,android_ripple:{color:k.colors["surface-pressed"],borderless:!1},accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{selected:c,disabled:u},"aria-selected":c,"aria-disabled":u,style:({pressed:e})=>[D.optionRow,{backgroundColor:c?k.colors["surface-selected"]:e?k.colors["surface-pressed"]:"transparent",opacity:u?.5:1,paddingHorizontal:k.space.lg,paddingVertical:k.space.md},f,c?S:null],children:[a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.optionTextWrap,children:a({option:i,selected:c,disabled:u,index:t})}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[l?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.optionIcon,children:l}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:D.optionTextWrap,children:[(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:c?"semibold":"medium",color:p?"danger":c?"brand":void 0,style:[D.optionLabel,R,c?v:null],children:r}),n?(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",color:"tertiary",numberOfLines:2,style:D.optionDescription,children:n}):null]})]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.checkbox,{borderColor:c?k.colors.primary:k.colors.border,backgroundColor:c?k.colors.primary:"transparent"}],children:c?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.checkboxTick}):null}):c?"icon"===k.settings.components["option-sheet"]?.selectedMarker?(0,_jsxRuntime.jsx)(_reactNative.View,{style:D.singleSelectedIcon,children:(k.settings.icons.selectedTick??_defaultIcons.defaultIcons.selectedTick)({size:20,color:k.colors.primary})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.singleSelectedDot,{backgroundColor:k.colors.primary}]}):null]})},onScrollToIndexFailed:ie,overScrollMode:"never",bounces:!1,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:!Z,style:Z?D.listBesideRail:null,ListEmptyComponent:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"bodySmall",color:"tertiary",align:"center",style:{paddingVertical:k.space.xl},children:l.empty})})}),Z?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.rail,{paddingRight:k.space.xs}],accessibilityRole:"list",accessibilityLabel:l.jumpToLetter,testID:"option-sheet-alphabet",children:Q.map(e=>{const t=Y.has(e);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>X(e),disabled:!t,hitSlop:{left:8,right:8},...(0,_hitSlop.hitSlopMarker)({left:8,right:8}),accessibilityRole:"button",accessibilityLabel:l.jumpTo(e),accessibilityState:{disabled:!t},"aria-disabled":!t,style:D.railLetter,children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"caption",weight:"semibold",color:t?"brand":"tertiary",style:[D.railLetterText,{opacity:t?1:.45}],children:e})},e)})}):null]}),b?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[D.sheetFooter,{borderTopColor:k.colors["border-subtle"],paddingHorizontal:k.space.lg,paddingVertical:k.space.md}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:K,accessibilityRole:"button",accessibilityLabel:l.done,style:({pressed:e})=>[D.doneButton,{backgroundColor:e?k.colors["primary-pressed"]:k.colors.primary,borderRadius:k.radius.md,..._corners.smoothCorners,paddingVertical:k.space.sm,paddingHorizontal:k.space.lg}],children:(0,_jsxRuntime.jsx)(_index3.Text,{variant:"body",weight:"semibold",style:{color:k.colors["on-primary"]},children:l.done})})}):null]})})}function OptionSheet(e){const{open:t,onOpenChange:i,onAfterClose:r,labels:s,onClose:o,haptic:a,...n}=e,l=(0,_react.useMemo)(()=>({...DEFAULT_OPTION_SHEET_LABELS,...s}),[s]),c=(0,_react.useRef)(i);c.current=i;const d=(0,_react.useRef)(!1);return(0,_react.useEffect)(()=>{d.current!==t&&(d.current=t,c.current?.(t))},[t]),(0,_jsxRuntime.jsx)(_index2.Modal,{open:t,onClose:o,presentation:"bottom",onDismissed:r,haptic:a,contentStyle:hostStyle,labels:{close:l.closePicker},accessibilityLabel:n.accessibilityLabel??n.title??l.fallbackName,children:(0,_jsxRuntime.jsx)(OptionSheetPanel,{...n,onClose:o,labels:l})})}OptionSheet.displayName="OptionSheet";const buildStyles=e=>_reactNative.StyleSheet.create({gestureRoot:{width:"100%"},sheet:{paddingBottom:e.space.lg,overflow:"hidden"},sheetHandleRow:{alignItems:"center",paddingTop:e.space.sm,paddingBottom:e.space.sm},sheetHandle:{width:36,height:4,borderRadius:e.radius.pill,..._corners.smoothCorners},sheetTitle:{includeFontPadding:!1},searchWrap:{width:"auto"},searchBox:{flexDirection:"row",alignItems:"center",borderWidth:1},searchInput:{flex:1,includeFontPadding:!1},optionRow:{flexDirection:"row",alignItems:"center"},sectionHeader:{paddingBottom:e.space.xs},listWrap:{flexShrink:1},listRow:{flexDirection:"row"},listBesideRail:{flex:1},rail:{justifyContent:"space-between",alignItems:"center",alignSelf:"stretch",paddingVertical:e.space.xs},railLetter:{paddingHorizontal:e.space.xs,minHeight:14,justifyContent:"center"},railLetterText:{includeFontPadding:!1,lineHeight:14},sectionTitle:{includeFontPadding:!1,letterSpacing:.6},optionIcon:{marginRight:e.space.md},optionTextWrap:{flex:1},optionLabel:{includeFontPadding:!1},optionDescription:{includeFontPadding:!1,marginTop:e.space.xxs},checkbox:{width:22,height:22,borderRadius:e.radius.sm,..._corners.smoothCorners,borderWidth:2,alignItems:"center",justifyContent:"center",marginLeft:e.space.md},checkboxTick:{width:10,height:6,borderLeftWidth:2,borderBottomWidth:2,borderColor:e.colors["on-primary"],transform:[{rotate:"-45deg"},{translateY:-1}]},singleSelectedDot:{width:8,height:8,borderRadius:e.radius.pill,..._corners.smoothCorners,marginLeft:e.space.md},singleSelectedIcon:{marginLeft:e.space.md},sheetFooter:{borderTopWidth:_reactNative.StyleSheet.hairlineWidth,alignItems:"flex-end"},doneButton:{alignSelf:"flex-end"}});var _default=exports.default=OptionSheet;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.selectOptionValue=exports.selectOptionLabel=exports.selectOptionIcon=exports.selectOptionDisabled=exports.selectOptionDescription=void 0;var _react=require("react"),_guards=require("../../utils/guards.js");const isReactNode=e=>null==e||"string"==typeof e||"number"==typeof e||"boolean"==typeof e||Array.isArray(e)||(0,_react.isValidElement)(e),selectOptionLabel=e=>(0,_guards.isRecord)(e)&&"string"==typeof e.label?e.label:"";exports.selectOptionLabel=selectOptionLabel;const selectOptionValue=e=>{if((0,_guards.isRecord)(e)&&("string"==typeof e.value||"number"==typeof e.value))return e.value;throw new Error("Option has no string or number value; pass getOptionValue.")};exports.selectOptionValue=selectOptionValue;const selectOptionDescription=e=>(0,_guards.isRecord)(e)&&"string"==typeof e.description?e.description:void 0;exports.selectOptionDescription=selectOptionDescription;const selectOptionDisabled=e=>(0,_guards.isRecord)(e)&&!0===e.disabled;exports.selectOptionDisabled=selectOptionDisabled;const selectOptionIcon=e=>(0,_guards.isRecord)(e)&&isReactNode(e.icon)?e.icon:void 0;exports.selectOptionIcon=selectOptionIcon;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.parseE164=exports.formatE164=exports.default=exports.PhoneNumberInput=exports.DEFAULT_PHONE_NUMBER_INPUT_LABELS=exports.DEFAULT_CALLING_CODES=exports.ALL_CALLING_CODES=void 0;var _mobileCore=require("@webority/mobile-core"),_countries=require("@webority/mobile-core/phone/countries"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_hitSlop=require("../../utils/hitSlop.js"),_index4=require("../FieldBase/index.js"),_Chevron=require("../FieldBase/Chevron.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_PHONE_NUMBER_INPUT_LABELS=exports.DEFAULT_PHONE_NUMBER_INPUT_LABELS=Object.freeze({placeholder:"Phone number",popular:"Popular",allCountries:"All countries",countrySheetTitle:"Country code",countrySearchPlaceholder:"Search…",invalid:"Enter a valid number",invalidMobile:"Enter a valid mobile number",countryButton:e=>`Country code, currently +${e}`}),DEFAULT_CALLING_CODES=exports.DEFAULT_CALLING_CODES=[{iso:"AU",code:"61",label:"Australia"},{iso:"CA",code:"1",label:"Canada"},{iso:"IN",code:"91",label:"India"},{iso:"SA",code:"966",label:"Saudi Arabia"},{iso:"SG",code:"65",label:"Singapore"},{iso:"AE",code:"971",label:"United Arab Emirates"},{iso:"GB",code:"44",label:"United Kingdom"},{iso:"US",code:"1",label:"United States"}],ALL_CALLING_CODES=exports.ALL_CALLING_CODES=(0,_mobileCore.getPhoneCountries)().map(e=>({iso:e.iso,code:e.callingCode,label:_countries.PHONE_COUNTRY_NAMES[e.iso]??e.iso})).sort((e,t)=>e.label.localeCompare(t.label)),digitsOnly=e=>e.replace(/[^0-9]/g,""),formatE164=e=>`+${e.callingCode}${e.nationalNumber}`;exports.formatE164=formatE164;const parseE164=(e,t,i)=>{const o=e.replace(/[^0-9]/g,"");if(!o)return null;const n=(0,_mobileCore.splitPhoneNumber)(`+${o}`);let r=n?.callingCode,l=n?.nationalNumber??"";if(!r){const e=Array.from(new Set(t.map(e=>e.code))).sort((e,t)=>t.length-e.length);if(r=e.find(e=>o.startsWith(e)),!r)return null;l=o.slice(r.length)}const a=t.filter(e=>e.code===r),s=a.find(e=>e.iso===i)?.iso??a.find(e=>e.iso===n?.country)?.iso??n?.country??a[0]?.iso??"";return{callingCode:r,nationalNumber:l,iso:s}};exports.parseE164=parseE164;const planOf=e=>(0,_mobileCore.isSupportedCountry)(e)?e:null,PhoneNumberInput=exports.PhoneNumberInput=(0,_react.forwardRef)((e,t)=>{const{value:i,defaultValue:o,onChange:n,e164:r,onChangeE164:l,returnKeyType:a,submitBehavior:s,onSubmitEditing:u,blurOnSubmit:c,onComplete:d,onValidityChange:b,countries:p=ALL_CALLING_CODES,popularCountries:_,hiddenCountries:m,showFlag:h=!0,renderFlag:f,renderCountry:g,showAlphabetIndex:x,defaultCountry:N,validation:C="any",maxLength:y,formatAsYouType:v=!0,countryLocked:S=!1,label:E,labelMode:L="top",labelStyle:I,placeholder:T,helperText:j,error:P,invalidMessage:A,required:F,disabled:O=!1,size:V="md",variant:R,radius:M,labels:U,haptic:D,accessibilityLabel:B,countryAccessibilityLabel:q,onFocus:w,onBlur:z,style:k,testID:$}=e;(0,_assertValidValue.assertValidValue)("PhoneNumberInput","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("PhoneNumberInput","variant",e.variant,["outline","filled","underline"]),(0,_assertValidValue.assertValidValue)("PhoneNumberInput","labelMode",e.labelMode,["top","float"]),(0,_assertValidValue.assertValidValue)("PhoneNumberInput","validation",!1===e.validation?void 0:e.validation,["any","mobile"]);const G=(0,_index2.useTheme)(),H=(0,_react.useMemo)(()=>buildStyles(G),[G]),W=(0,_react.useRef)(null),Y=(0,_react.useMemo)(()=>U?{...DEFAULT_PHONE_NUMBER_INPUT_LABELS,...U}:DEFAULT_PHONE_NUMBER_INPUT_LABELS,[U]),K=T??Y.placeholder,Z=(0,_react.useMemo)(()=>/-([A-Za-z]{2})(?:-|$)/.exec((0,_mobileCore.getFormatterConfig)().locale)?.[1]?.toUpperCase(),[]),J=(0,_react.useMemo)(()=>m?.length?p.filter(e=>!m.includes(e.iso)):p,[p,m]),Q=(0,_react.useMemo)(()=>{if(!_?.length)return;const e=_.map(e=>J.find(t=>t.iso===e)).filter(e=>void 0!==e);return e.length?[{title:Y.popular,options:e},{title:Y.allCountries,options:J}]:void 0},[_,Y.popular,Y.allCountries,J]),X=(0,_react.useCallback)((e,t,i)=>{if(!e)return null;if(f)return f(e);if(!h)return null;const o=(0,_mobileCore.countryFlagEmoji)(e.iso);return o?(0,_jsxRuntime.jsx)(_index5.Text,{variant:"body",style:[H.flag,{fontSize:t}],testID:i,children:o}):null},[f,h,H.flag]),ee=(0,_react.useCallback)(e=>{const t=planOf(e),i=t?(0,_mobileCore.maxNationalNumberLength)(t,!1===C?"any":C):Number.POSITIVE_INFINITY;return y?Math.min(i,y):i},[y,C]),te=(0,_react.useCallback)((e,t)=>e.slice(0,ee(t)),[ee]),ie=(0,_react.useCallback)((e,t)=>{const i=planOf(t)??void 0,o=(0,_mobileCore.splitPhoneNumber)(e,i);if(!o)return null;const n=o.country??t,r=p.find(e=>e.iso===n);return{callingCode:r?.code??o.callingCode,nationalNumber:te(o.nationalNumber,n),iso:r?.iso??n}},[p,te]),oe=(0,_react.useMemo)(()=>{const e=J.find(e=>e.iso===(N??Z))??J[0]??p[0],t={callingCode:e?.code??"",nationalNumber:"",iso:e?.iso??""};return"string"==typeof o?ie(o,t.iso)??t:o??t},[p,J,N,Z,o,ie]),ne=(0,_react.useCallback)(e=>{if(!1===C)return e.nationalNumber.length>0;const t=planOf(e.iso);return t?(0,_mobileCore.isValidNationalNumber)(e.nationalNumber,t,C):e.nationalNumber.length>0},[C]),[re,le]=(0,_react.useState)(oe.iso),ae=(0,_react.useMemo)(()=>{if(void 0===r)return;const e=r?parseE164(r,p,re):null;if(e)return{...e,nationalNumber:te(e.nationalNumber,e.iso)};const t=p.find(e=>e.iso===re);return{callingCode:t?.code??oe.callingCode,nationalNumber:"",iso:re}},[r,p,re,oe.callingCode,te]),se=(0,_react.useCallback)(e=>{le(e.iso),n?.(e),l?.(e.nationalNumber?formatE164(e):"",{country:p.find(t=>t.iso===e.iso),national:e.nationalNumber,valid:ne(e)})},[n,l,p,ne]),[ue,ce]=(0,_index.useControllableState)({value:i??ae,defaultValue:oe,onChange:se}),[de,be]=(0,_react.useState)(!1),pe=(0,_react.useCallback)(()=>{O||W.current?.focus()},[O]),[me,he]=(0,_react.useState)(!1),[fe,ge]=(0,_react.useState)(!1),[xe,Ne]=(0,_react.useState)(!1),Ce=(0,_react.useRef)(!1);(0,_react.useEffect)(()=>{xe||(Ce.current=!1)},[xe]);const ye=(0,_index2.resolveFieldSize)(G,V),ve=(0,_index4.resolveFieldTextStyle)(G,{disabled:O}),Se=R??G.settings.components.field?.defaultVariant??"outline",Ee="underline"===Se,Le=G.space.md,[Ie,Te]=(0,_react.useState)(0),je=Ie+Le+1+Le,Pe=ue.nationalNumber.length>0,Ae=F&&!E&&!Pe&&K.length>0,Fe=de||Pe,Oe=Boolean(E)&&"float"===L&&Ie>0,Ve=(0,_useFloatingLabel.useFloatingLabel)({label:E,enabled:Oe,floated:Fe,required:F,variant:Se,sizeTokens:ye,leadingOffset:je,paddingLeft:Ee?G.space.none:ye["padding-x"],color:G.colors["field-label"],style:I}),Re=(0,_react.useMemo)(()=>p.find(e=>e.iso===ue.iso),[p,ue.iso]),Me=planOf(ue.iso),Ue=v&&Me?(0,_mobileCore.formatPhoneAsTyped)(ue.nationalNumber,Me):ue.nationalNumber,De=ee(ue.iso),Be=0===ue.nationalNumber.length||me||!Number.isFinite(De)?void 0:Ue.length+Math.max(0,De-ue.nationalNumber.length),qe=ne(ue);(0,_react.useEffect)(()=>{Pe||ge(!1)},[Pe]);const we=Me?(0,_mobileCore.maxNationalNumberLength)(Me,!1===C?"any":C):Number.POSITIVE_INFINITY,ze=ue.nationalNumber.length>=we,ke=!1!==C&&!1!==A&&Pe&&!qe&&(fe||ze),$e="mobile"===C?Y.invalidMobile:Y.invalid,Ge=(0,_index4.hasFieldText)(P)?P:ke?A||$e:void 0,He=!0===P||(0,_index4.hasFieldText)(Ge),We=(0,_react.useRef)(qe),Ye=(0,_react.useRef)(ue);Ye.current=ue,(0,_react.useEffect)(()=>{We.current!==qe&&(We.current=qe,b?.(qe),qe&&d?.(formatE164(Ye.current)))},[qe,d,b]);const Ke=(0,_react.useCallback)(e=>{if(e.includes("+")){const t=ie(e,ue.iso);if(t&&!S&&J.some(e=>e.iso===t.iso))return void ce(t);if(t&&t.iso===ue.iso)return void ce(t)}ce({...ue,nationalNumber:te(digitsOnly(e),ue.iso)})},[J,S,ue,ie,te,ce]),Ze=(0,_react.useCallback)(e=>{ce({callingCode:e.code,iso:e.iso,nationalNumber:te(ue.nationalNumber,e.iso)}),Ne(!1);const t=(0,_index3.resolveHaptic)(D,"selection");t&&(0,_index3.triggerHaptic)(t)},[ue,D,te,ce]);(0,_react.useImperativeHandle)(t,()=>({focus:()=>W.current?.focus(),blur:()=>W.current?.blur(),clear:()=>ce({...Ye.current,nationalNumber:""}),isFocused:()=>W.current?.isFocused()??!1,getValue:()=>Ye.current,getE164:()=>formatE164(Ye.current),getFormatted:()=>{const e=Ye.current,t=planOf(e.iso);return t?(0,_mobileCore.formatPhoneAsTyped)(e.nationalNumber,t):e.nationalNumber},isValid:()=>ne(Ye.current),getCountry:()=>p.find(e=>e.iso===Ye.current.iso)}),[p,ne,ce]);const Je=O||S,Qe=(0,_jsxRuntime.jsx)(_index4.FieldBase,{size:V,variant:Se,radius:M,topNotch:Ve.topNotch,focused:de,disabled:O,error:He,filled:Pe,onPress:pe,pressFeedback:!1,leadingDivider:!0,paddingLeft:Ee?G.space.none:void 0,leading:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>{Je||(Ce.current=!0,Ne(!0))},disabled:Je,accessibilityRole:"button",accessibilityLabel:q??Y.countryButton(ue.callingCode),accessibilityState:{disabled:Je},"aria-disabled":Je,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),onLayout:e=>{const{width:t}=e.nativeEvent.layout;Te(e=>e===t?e:t)},style:H.codeTrigger,testID:$?`${$}-code`:void 0,children:[X(Re,ye.text,$?`${$}-flag`:void 0),(0,_jsxRuntime.jsx)(_index5.Text,{variant:"body",style:[H.codeText,{color:ve.color,fontSize:ye.text}],children:`+${ue.callingCode}`}),S?null:(0,_jsxRuntime.jsx)(_Chevron.Chevron,{color:O?G.colors["field-icon-disabled"]:G.colors["field-icon"],size:ye.icon,open:xe})]}),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:W,value:Ue,maxLength:Be,onChangeText:Ke,returnKeyType:a,submitBehavior:s,onSubmitEditing:u,blurOnSubmit:c,onSelectionChange:e=>{const{start:t,end:i}=e.nativeEvent.selection;he(t!==i)},onFocus:()=>{be(!0),w?.()},onBlur:()=>{be(!1),Pe&&!Ce.current&&ge(!0),z?.()},editable:!O,placeholder:Oe&&!Fe||Ae?void 0:K,placeholderTextColor:ve.placeholderColor,accessibilityLabel:B??E??K,selectionColor:G.colors["field-caret"],keyboardType:"phone-pad",textContentType:"telephoneNumber",autoComplete:"tel",style:[H.input,{color:ve.color,fontSize:ye.text,...ve.weightStyle,paddingLeft:Ee?G.space.none:void 0}],testID:$?`${$}-input`:void 0}),Ae?(0,_jsxRuntime.jsx)(_index4.RequiredPlaceholder,{text:K,color:ve.placeholderColor,fontSize:ye.text,weightStyle:ve.weightStyle}):null]})});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:k,testID:$,children:[E&&"top"===L?(0,_jsxRuntime.jsx)(_index4.FieldLabel,{size:V,required:F,children:E}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.fieldWrapper,children:[Qe,Ve.node]}),(0,_jsxRuntime.jsx)(_index4.FieldMessage,{size:V,error:He,text:He?Ge:j}),(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:xe,haptic:D,onClose:()=>Ne(!1),title:Y.countrySheetTitle,options:J,sections:Q,getOptionLabel:e=>`${e.label} (+${e.code})`,getOptionValue:e=>e.iso,getOptionIcon:e=>X(e,G.text.lg.size),renderOption:g?({option:e,selected:t})=>g(e,{selected:t}):void 0,value:Re?.iso,onChange:(e,t)=>Ze(t),searchable:J.length>8,labels:{searchPlaceholder:Y.countrySearchPlaceholder},alphabetIndex:x??J.length>20})]})});PhoneNumberInput.displayName="PhoneNumberInput";const buildStyles=e=>_reactNative.StyleSheet.create({fieldWrapper:{position:"relative",overflow:"visible"},codeTrigger:{flexDirection:"row",alignItems:"center",gap:e.space.xxs},flag:{includeFontPadding:!1,marginRight:e.space.xs},codeText:{...(0,_index2.fontFor)(e,"semibold"),fontWeight:"600",includeFontPadding:!1,writingDirection:"ltr"},input:{padding:e.space.none,margin:e.space.none,includeFontPadding:!1,writingDirection:"ltr"},inputWrap:{flex:1,alignSelf:"stretch",justifyContent:"center"}});var _default=exports.default=PhoneNumberInput;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.parseE164=exports.formatE164=exports.default=exports.PhoneNumberInput=exports.DEFAULT_PHONE_NUMBER_INPUT_LABELS=exports.DEFAULT_CALLING_CODES=exports.ALL_CALLING_CODES=void 0;var _mobileCore=require("@webority/mobile-core"),_countries=require("@webority/mobile-core/phone/countries"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_hitSlop=require("../../utils/hitSlop.js"),_index4=require("../FieldBase/index.js"),_Chevron=require("../FieldBase/Chevron.js"),_useFloatingLabel=require("../FieldBase/useFloatingLabel.js"),_OptionSheet=require("../OptionSheet/OptionSheet.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_PHONE_NUMBER_INPUT_LABELS=exports.DEFAULT_PHONE_NUMBER_INPUT_LABELS=Object.freeze({placeholder:"Phone number",popular:"Popular",allCountries:"All countries",countrySheetTitle:"Country code",countrySearchPlaceholder:"Search…",invalid:"Enter a valid number",invalidMobile:"Enter a valid mobile number",countryButton:e=>`Country code, currently +${e}`}),DEFAULT_CALLING_CODES=exports.DEFAULT_CALLING_CODES=[{iso:"AU",code:"61",label:"Australia"},{iso:"CA",code:"1",label:"Canada"},{iso:"IN",code:"91",label:"India"},{iso:"SA",code:"966",label:"Saudi Arabia"},{iso:"SG",code:"65",label:"Singapore"},{iso:"AE",code:"971",label:"United Arab Emirates"},{iso:"GB",code:"44",label:"United Kingdom"},{iso:"US",code:"1",label:"United States"}],ALL_CALLING_CODES=exports.ALL_CALLING_CODES=(0,_mobileCore.getPhoneCountries)().map(e=>({iso:e.iso,code:e.callingCode,label:_countries.PHONE_COUNTRY_NAMES[e.iso]??e.iso})).sort((e,t)=>e.label.localeCompare(t.label)),digitsOnly=e=>e.replace(/[^0-9]/g,""),formatE164=e=>`+${e.callingCode}${e.nationalNumber}`;exports.formatE164=formatE164;const parseE164=(e,t,i)=>{const o=e.replace(/[^0-9]/g,"");if(!o)return null;const n=(0,_mobileCore.splitPhoneNumber)(`+${o}`);let r=n?.callingCode,l=n?.nationalNumber??"";if(!r){const e=Array.from(new Set(t.map(e=>e.code))).sort((e,t)=>t.length-e.length);if(r=e.find(e=>o.startsWith(e)),!r)return null;l=o.slice(r.length)}const a=t.filter(e=>e.code===r),s=a.find(e=>e.iso===i)?.iso??a.find(e=>e.iso===n?.country)?.iso??n?.country??a[0]?.iso??"";return{callingCode:r,nationalNumber:l,iso:s}};exports.parseE164=parseE164;const planOf=e=>(0,_mobileCore.isSupportedCountry)(e)?e:null,assertDefaultCountryVisible=(e,t)=>{if(void 0!==e&&!t.some(t=>t.iso===e))throw new RangeError(`PhoneNumberInput: defaultCountry "${e}" is not among the visible countries. Add it to countries, or remove it from hiddenCountries.`)},PhoneNumberInput=exports.PhoneNumberInput=(0,_react.forwardRef)((e,t)=>{const{value:i,defaultValue:o,onChange:n,e164:r,onChangeE164:l,returnKeyType:a,submitBehavior:s,onSubmitEditing:u,blurOnSubmit:c,onComplete:d,onValidityChange:b,countries:p=ALL_CALLING_CODES,popularCountries:_,hiddenCountries:m,showFlag:h=!0,renderFlag:f,renderCountry:g,showAlphabetIndex:x,defaultCountry:C,validation:N="any",maxLength:y,formatAsYouType:v=!0,countryLocked:S=!1,label:E,labelMode:L="top",labelStyle:I,placeholder:T,helperText:j,error:P,invalidMessage:A,required:F,disabled:O=!1,size:V="md",variant:R,radius:D,labels:M,haptic:U,accessibilityLabel:B,countryAccessibilityLabel:q,onFocus:w,onBlur:z,style:k,testID:$}=e;(0,_assertValidValue.assertValidValue)("PhoneNumberInput","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("PhoneNumberInput","variant",e.variant,["outline","filled","underline"]),(0,_assertValidValue.assertValidValue)("PhoneNumberInput","labelMode",e.labelMode,["top","float"]),(0,_assertValidValue.assertValidValue)("PhoneNumberInput","validation",!1===e.validation?void 0:e.validation,["any","mobile"]);const G=(0,_index2.useTheme)(),H=(0,_react.useMemo)(()=>buildStyles(G),[G]),W=(0,_react.useRef)(null),Y=(0,_react.useMemo)(()=>M?{...DEFAULT_PHONE_NUMBER_INPUT_LABELS,...M}:DEFAULT_PHONE_NUMBER_INPUT_LABELS,[M]),K=T??Y.placeholder,Z=(0,_react.useMemo)(()=>/-([A-Za-z]{2})(?:-|$)/.exec((0,_mobileCore.getFormatterConfig)().locale)?.[1]?.toUpperCase(),[]),J=(0,_react.useMemo)(()=>m?.length?p.filter(e=>!m.includes(e.iso)):p,[p,m]),Q=(0,_react.useMemo)(()=>{if(!_?.length)return;const e=_.map(e=>J.find(t=>t.iso===e)).filter(e=>void 0!==e);return e.length?[{title:Y.popular,options:e},{title:Y.allCountries,options:J}]:void 0},[_,Y.popular,Y.allCountries,J]),X=(0,_react.useCallback)((e,t,i)=>{if(!e)return null;if(f)return f(e);if(!h)return null;const o=(0,_mobileCore.countryFlagEmoji)(e.iso);return o?(0,_jsxRuntime.jsx)(_index5.Text,{variant:"body",style:[H.flag,{fontSize:t}],testID:i,children:o}):null},[f,h,H.flag]),ee=(0,_react.useCallback)(e=>{const t=planOf(e),i=t?(0,_mobileCore.maxNationalNumberLength)(t,!1===N?"any":N):Number.POSITIVE_INFINITY;return y?Math.min(i,y):i},[y,N]),te=(0,_react.useCallback)((e,t)=>e.slice(0,ee(t)),[ee]),ie=(0,_react.useCallback)((e,t)=>{const i=planOf(t)??void 0,o=(0,_mobileCore.splitPhoneNumber)(e,i);if(!o)return null;const n=o.country??t,r=p.find(e=>e.iso===n);return{callingCode:r?.code??o.callingCode,nationalNumber:te(o.nationalNumber,n),iso:r?.iso??n}},[p,te]);(0,_react.useState)(()=>assertDefaultCountryVisible(C,J));const oe=(0,_react.useMemo)(()=>{const e=J.find(e=>e.iso===(C??Z))??J[0]??p[0],t={callingCode:e?.code??"",nationalNumber:"",iso:e?.iso??""};return"string"==typeof o?ie(o,t.iso)??t:o??t},[p,J,C,Z,o,ie]),ne=(0,_react.useCallback)(e=>{if(!1===N)return e.nationalNumber.length>0;const t=planOf(e.iso);return t?(0,_mobileCore.isValidNationalNumber)(e.nationalNumber,t,N):e.nationalNumber.length>0},[N]),[re,le]=(0,_react.useState)(oe.iso),ae=(0,_react.useMemo)(()=>{if(void 0===r)return;const e=r?parseE164(r,p,re):null;if(e)return{...e,nationalNumber:te(e.nationalNumber,e.iso)};const t=p.find(e=>e.iso===re);return{callingCode:t?.code??oe.callingCode,nationalNumber:"",iso:re}},[r,p,re,oe.callingCode,te]),se=(0,_react.useCallback)(e=>{le(e.iso),n?.(e),l?.(e.nationalNumber?formatE164(e):"",{country:p.find(t=>t.iso===e.iso),national:e.nationalNumber,valid:ne(e)})},[n,l,p,ne]),[ue,ce]=(0,_index.useControllableState)({value:i??ae,defaultValue:oe,onChange:se}),[de,be]=(0,_react.useState)(!1),pe=(0,_react.useCallback)(()=>{O||W.current?.focus()},[O]),[me,he]=(0,_react.useState)(!1),[fe,ge]=(0,_react.useState)(!1),[xe,Ce]=(0,_react.useState)(!1),Ne=(0,_react.useRef)(!1);(0,_react.useEffect)(()=>{xe||(Ne.current=!1)},[xe]);const ye=(0,_index2.resolveFieldSize)(G,V),ve=(0,_index4.resolveFieldTextStyle)(G,{disabled:O}),Se=R??G.settings.components.field?.defaultVariant??"outline",Ee="underline"===Se,Le=G.space.md,[Ie,Te]=(0,_react.useState)(0),je=Ie+Le+1+Le,Pe=ue.nationalNumber.length>0,Ae=F&&!E&&!Pe&&K.length>0,Fe=de||Pe,Oe=Boolean(E)&&"float"===L&&Ie>0,Ve=(0,_useFloatingLabel.useFloatingLabel)({label:E,enabled:Oe,floated:Fe,required:F,variant:Se,sizeTokens:ye,leadingOffset:je,paddingLeft:Ee?G.space.none:ye["padding-x"],color:G.colors["field-label"],style:I}),Re=(0,_react.useMemo)(()=>p.find(e=>e.iso===ue.iso),[p,ue.iso]),De=planOf(ue.iso),Me=v&&De?(0,_mobileCore.formatPhoneAsTyped)(ue.nationalNumber,De):ue.nationalNumber,Ue=ee(ue.iso),Be=0===ue.nationalNumber.length||me||!Number.isFinite(Ue)?void 0:Me.length+Math.max(0,Ue-ue.nationalNumber.length),qe=ne(ue);(0,_react.useEffect)(()=>{Pe||ge(!1)},[Pe]);const we=De?(0,_mobileCore.maxNationalNumberLength)(De,!1===N?"any":N):Number.POSITIVE_INFINITY,ze=ue.nationalNumber.length>=we,ke=!1!==N&&!1!==A&&Pe&&!qe&&(fe||ze),$e="mobile"===N?Y.invalidMobile:Y.invalid,Ge=(0,_index4.hasFieldText)(P)?P:ke?A||$e:void 0,He=!0===P||(0,_index4.hasFieldText)(Ge),We=(0,_react.useRef)(qe),Ye=(0,_react.useRef)(ue);Ye.current=ue,(0,_react.useEffect)(()=>{We.current!==qe&&(We.current=qe,b?.(qe),qe&&d?.(formatE164(Ye.current)))},[qe,d,b]);const Ke=(0,_react.useCallback)(e=>{if(e.includes("+")){const t=ie(e,ue.iso);if(t&&!S&&J.some(e=>e.iso===t.iso))return void ce(t);if(t&&t.iso===ue.iso)return void ce(t)}ce({...ue,nationalNumber:te(digitsOnly(e),ue.iso)})},[J,S,ue,ie,te,ce]),Ze=(0,_react.useCallback)(e=>{ce({callingCode:e.code,iso:e.iso,nationalNumber:te(ue.nationalNumber,e.iso)}),Ce(!1);const t=(0,_index3.resolveHaptic)(U,"selection");t&&(0,_index3.triggerHaptic)(t)},[ue,U,te,ce]);(0,_react.useImperativeHandle)(t,()=>({focus:()=>W.current?.focus(),blur:()=>W.current?.blur(),clear:()=>ce({...Ye.current,nationalNumber:""}),isFocused:()=>W.current?.isFocused()??!1,getValue:()=>Ye.current,getE164:()=>formatE164(Ye.current),getFormatted:()=>{const e=Ye.current,t=planOf(e.iso);return t?(0,_mobileCore.formatPhoneAsTyped)(e.nationalNumber,t):e.nationalNumber},isValid:()=>ne(Ye.current),getCountry:()=>p.find(e=>e.iso===Ye.current.iso)}),[p,ne,ce]);const Je=O||S,Qe=(0,_jsxRuntime.jsx)(_index4.FieldBase,{size:V,variant:Se,radius:D,topNotch:Ve.topNotch,focused:de,disabled:O,error:He,filled:Pe,onPress:pe,pressFeedback:!1,leadingDivider:!0,paddingLeft:Ee?G.space.none:void 0,leading:(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>{Je||(Ne.current=!0,Ce(!0))},disabled:Je,accessibilityRole:"button",accessibilityLabel:q??Y.countryButton(ue.callingCode),accessibilityState:{disabled:Je},"aria-disabled":Je,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),onLayout:e=>{const{width:t}=e.nativeEvent.layout;Te(e=>e===t?e:t)},style:H.codeTrigger,testID:$?`${$}-code`:void 0,children:[X(Re,ye.text,$?`${$}-flag`:void 0),(0,_jsxRuntime.jsx)(_index5.Text,{variant:"body",style:[H.codeText,{color:ve.color,fontSize:ye.text}],children:`+${ue.callingCode}`}),S?null:(0,_jsxRuntime.jsx)(_Chevron.Chevron,{color:O?G.colors["field-icon-disabled"]:G.colors["field-icon"],size:ye.icon,open:xe})]}),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.inputWrap,children:[(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:W,value:Me,maxLength:Be,onChangeText:Ke,returnKeyType:a,submitBehavior:s,onSubmitEditing:u,blurOnSubmit:c,onSelectionChange:e=>{const{start:t,end:i}=e.nativeEvent.selection;he(t!==i)},onFocus:()=>{be(!0),w?.()},onBlur:()=>{be(!1),Pe&&!Ne.current&&ge(!0),z?.()},editable:!O,placeholder:Oe&&!Fe||Ae?void 0:K,placeholderTextColor:ve.placeholderColor,accessibilityLabel:B??E??K,selectionColor:G.colors["field-caret"],keyboardType:"phone-pad",textContentType:"telephoneNumber",autoComplete:"tel",style:[H.input,{color:ve.color,fontSize:ye.text,...ve.weightStyle,paddingLeft:Ee?G.space.none:void 0}],testID:$?`${$}-input`:void 0}),Ae?(0,_jsxRuntime.jsx)(_index4.RequiredPlaceholder,{text:K,color:ve.placeholderColor,fontSize:ye.text,weightStyle:ve.weightStyle}):null]})});return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:k,testID:$,children:[E&&"top"===L?(0,_jsxRuntime.jsx)(_index4.FieldLabel,{size:V,required:F,children:E}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.fieldWrapper,children:[Qe,Ve.node]}),(0,_jsxRuntime.jsx)(_index4.FieldMessage,{size:V,error:He,text:He?Ge:j}),(0,_jsxRuntime.jsx)(_OptionSheet.OptionSheet,{open:xe,haptic:U,onClose:()=>Ce(!1),title:Y.countrySheetTitle,options:J,sections:Q,getOptionLabel:e=>`${e.label} (+${e.code})`,getOptionValue:e=>e.iso,getOptionIcon:e=>X(e,G.text.lg.size),renderOption:g?({option:e,selected:t})=>g(e,{selected:t}):void 0,value:Re?.iso,onChange:(e,t)=>Ze(t),searchable:J.length>8,labels:{searchPlaceholder:Y.countrySearchPlaceholder},alphabetIndex:x??J.length>20})]})});PhoneNumberInput.displayName="PhoneNumberInput";const buildStyles=e=>_reactNative.StyleSheet.create({fieldWrapper:{position:"relative",overflow:"visible"},codeTrigger:{flexDirection:"row",alignItems:"center",gap:e.space.xxs},flag:{includeFontPadding:!1,marginRight:e.space.xs},codeText:{...(0,_index2.fontFor)(e,"semibold"),fontWeight:"600",includeFontPadding:!1,writingDirection:"ltr"},input:{padding:e.space.none,margin:e.space.none,includeFontPadding:!1,writingDirection:"ltr"},inputWrap:{flex:1,alignSelf:"stretch",justifyContent:"center"}});var _default=exports.default=PhoneNumberInput;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ProgressRing=void 0;var cache,_react=require("react"),_reactNative=require("react-native"),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var r,s,a=Object.defineProperty,i={__proto__:null,default:e};if(Object(e)!==e)return i;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,i)}for(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((r=a&&Object.getOwnPropertyDescriptor(e,s))&&(r.get||r.set)?a(i,s,r):i[s]=e[s]);return i}const AnimatedCircle=_reactNative.Animated.createAnimatedComponent(_reactNativeSvg.Circle),toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors["text-muted"];default:return e.colors.primary}},clampProgress=e=>"number"!=typeof e||Number.isNaN(e)?0:Math.min(1,Math.max(0,e)),DEFAULT_STROKE_WIDTH=4,DEFAULT_DURATION=600,DEFAULT_COLOR_STOPS=[1/3,2/3],STOP_EDGE=1e-4,ProgressRing=exports.ProgressRing=(0,_react.forwardRef)((e,t)=>{const{progress:r,size:s=48,strokeWidth:a,tone:i="primary",trackColor:n,ringColor:o,colorByProgress:c=!1,animated:l=!0,rounded:u=!0,children:d,accessibilityLabel:g,style:_,testID:p}=e;(0,_assertValidValue.assertValidValue)("ProgressRing","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const m=(0,_index2.useTheme)(),f=(0,_index.useReducedMotion)(),h=clampProgress(r),x=a??4,v=n??m.colors["surface-disabled"],[R,y]=DEFAULT_COLOR_STOPS,b=Math.max(0,(s-x)/2),j=2*Math.PI*b,P=(0,_react.useRef)((0,_index2.createAnimatedValue)(h)).current;(0,_react.useEffect)(()=>{if(!l||f)return void P.setValue(h);const e=_reactNative.Animated.timing(P,{toValue:h,duration:600,easing:_reactNative.Easing.bezier(...m.motion.ease["in-out"]),useNativeDriver:!1});return e.start(),()=>e.stop()},[l,h,P,f,m.motion.ease["in-out"]]);const w=P.interpolate({inputRange:[0,1],outputRange:[j,0]}),N=P.interpolate({inputRange:[0,.001,1],outputRange:[0,1,1]}),O=(0,_react.useMemo)(()=>P.interpolate({inputRange:[0,R-1e-4,R,y-1e-4,y,1],outputRange:[m.colors.danger,m.colors.danger,m.colors.warning,m.colors.warning,m.colors.success,m.colors.success]}),[P,m.colors.danger,m.colors.warning,m.colors.success]),D=o??(c?O:toneColor(m,i)),S=(0,_react.useMemo)(()=>buildStyles(),[]),V=s/2;return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,accessible:null==d,accessibilityRole:"progressbar",accessibilityLabel:g,accessibilityValue:{min:0,max:100,now:Math.round(100*h)},testID:p,style:[S.root,{width:s,height:s},_],children:[(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Circle,{cx:V,cy:V,r:b,stroke:v,strokeWidth:x,fill:"none"}),(0,_jsxRuntime.jsx)(AnimatedCircle,{cx:V,cy:V,r:b,stroke:D,strokeWidth:x,strokeLinecap:u?"round":"butt",strokeDasharray:`${j} ${j}`,strokeDashoffset:w,strokeOpacity:N,fill:"none",transform:`rotate(-90 ${V} ${V})`,testID:p?`${p}-fill`:void 0})]}),null!=d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:S.content,pointerEvents:"box-none",children:d}):null]})});ProgressRing.displayName="ProgressRing";const buildStyles=()=>_reactNative.StyleSheet.create({root:{alignItems:"center",justifyContent:"center"},content:{position:"absolute",top:0,right:0,bottom:0,left:0,alignItems:"center",justifyContent:"center"}});var _default=exports.default=ProgressRing;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.ProgressRing=void 0;var cache,_react=require("react"),_reactNative=require("react-native"),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var r,s,a=Object.defineProperty,i={__proto__:null,default:e};if(Object(e)!==e)return i;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,i)}for(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((r=a&&Object.getOwnPropertyDescriptor(e,s))&&(r.get||r.set)?a(i,s,r):i[s]=e[s]);return i}const AnimatedCircle=_reactNative.Animated.createAnimatedComponent(_reactNativeSvg.Circle),toneColor=(e,t)=>{switch(t){case"success":return e.colors.success;case"warning":return e.colors.warning;case"danger":return e.colors.danger;case"info":return e.colors.info;case"neutral":return e.colors["text-muted"];default:return e.colors.primary}},clampProgress=e=>"number"!=typeof e||Number.isNaN(e)?0:Math.min(1,Math.max(0,e)),DEFAULT_STROKE_WIDTH=4,DEFAULT_DURATION=600,DEFAULT_COLOR_STOPS=[1/3,2/3],STOP_EDGE=1e-4,ProgressRing=exports.ProgressRing=(0,_react.forwardRef)((e,t)=>{const{progress:r,size:s=48,strokeWidth:a,tone:i="primary",trackColor:n,ringColor:o,colorByProgress:c=!1,animated:l=!0,rounded:u=!0,children:d,accessibilityLabel:g,style:_,testID:p}=e;(0,_assertValidValue.assertValidValue)("ProgressRing","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const m=(0,_index2.useTheme)(),f=(0,_index.useReducedMotion)(),h=clampProgress(r),x=a??4,R=n??m.colors["surface-disabled"],[v,y]=DEFAULT_COLOR_STOPS,b=Math.max(0,(s-x)/2),j=2*Math.PI*b,P=(0,_react.useRef)((0,_index2.createAnimatedValue)(h)).current;(0,_react.useEffect)(()=>{if(!l||f)return void P.setValue(h);const e=_reactNative.Animated.timing(P,{toValue:h,duration:600,easing:_reactNative.Easing.bezier(...m.motion.ease["in-out"]),useNativeDriver:!1});return e.start(),()=>e.stop()},[l,h,P,f,m.motion.ease["in-out"]]);const w=P.interpolate({inputRange:[0,1],outputRange:[j,0]}),N=P.interpolate({inputRange:[0,.001,1],outputRange:[0,1,1]}),O=(0,_react.useMemo)(()=>P.interpolate({inputRange:[0,v-1e-4,v,y-1e-4,y,1],outputRange:[m.colors.danger,m.colors.danger,m.colors.warning,m.colors.warning,m.colors.success,m.colors.success]}),[P,m.colors.danger,m.colors.warning,m.colors.success]),D=o??(c?O:toneColor(m,i)),S=(0,_react.useMemo)(()=>buildStyles(),[]),V=s/2;return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,accessible:null==d,accessibilityRole:"progressbar",accessibilityLabel:g,accessibilityValue:{min:0,max:100,now:Math.round(100*h)},testID:p,style:[S.root,{width:s,height:s},_],children:[(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{width:s,height:s,viewBox:`0 0 ${s} ${s}`,children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Circle,{cx:V,cy:V,r:b,stroke:R,strokeWidth:x,fill:"none"}),(0,_jsxRuntime.jsx)(AnimatedCircle,{cx:V,cy:V,r:b,stroke:D,strokeWidth:x,strokeLinecap:u?"round":"butt",strokeDasharray:`${j} ${j}`,strokeDashoffset:w,strokeOpacity:N,fill:"none",transform:`rotate(-90 ${V} ${V})`,...p?{testID:`${p}-fill`}:{}})]}),null!=d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:S.content,pointerEvents:"box-none",children:d}):null]})});ProgressRing.displayName="ProgressRing";const buildStyles=()=>_reactNative.StyleSheet.create({root:{alignItems:"center",justifyContent:"center"},content:{position:"absolute",top:0,right:0,bottom:0,left:0,alignItems:"center",justifyContent:"center"}});var _default=exports.default=ProgressRing;