@webority/mobile-ui 0.174.1 → 0.175.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 (272) hide show
  1. package/dist/canvas-kit/kit.js +10 -10
  2. package/dist/canvas-kit/manifest.json +1 -1
  3. package/dist/canvas-kit/release.json +5 -5
  4. package/lib/commonjs/components/Accordion/Accordion.js +1 -1
  5. package/lib/commonjs/components/AmountSlider/AmountSlider.js +1 -1
  6. package/lib/commonjs/components/AppBar/AppBar.js +1 -1
  7. package/lib/commonjs/components/AuthedImage/authedImageCache.js +1 -1
  8. package/lib/commonjs/components/Avatar/Avatar.js +1 -1
  9. package/lib/commonjs/components/Badge/Badge.js +1 -1
  10. package/lib/commonjs/components/Banner/Banner.js +1 -1
  11. package/lib/commonjs/components/BarChart/BarChart.js +1 -1
  12. package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +1 -1
  13. package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
  14. package/lib/commonjs/components/Box/Box.js +1 -1
  15. package/lib/commonjs/components/Button/Button.js +1 -1
  16. package/lib/commonjs/components/Calendar/Calendar.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/Checkbox/Checkbox.js +1 -1
  20. package/lib/commonjs/components/Chip/Chip.js +1 -1
  21. package/lib/commonjs/components/Composer/Composer.js +1 -1
  22. package/lib/commonjs/components/Confetti/Confetti.js +1 -1
  23. package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +1 -1
  24. package/lib/commonjs/components/DecimalInput/DecimalInput.js +1 -1
  25. package/lib/commonjs/components/Descriptions/Descriptions.js +1 -1
  26. package/lib/commonjs/components/Divider/Divider.js +1 -1
  27. package/lib/commonjs/components/Drawer/Drawer.js +1 -1
  28. package/lib/commonjs/components/EmptyState/EmptyState.js +1 -1
  29. package/lib/commonjs/components/FieldBase/ChoiceText.js +1 -1
  30. package/lib/commonjs/components/FieldBase/FieldBase.js +1 -1
  31. package/lib/commonjs/components/FieldBase/useFloatingLabel.js +1 -1
  32. package/lib/commonjs/components/FilePicker/FilePicker.js +1 -1
  33. package/lib/commonjs/components/FilterChipRow/FilterChipRow.js +1 -1
  34. package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +1 -1
  35. package/lib/commonjs/components/FormField/FormField.js +1 -1
  36. package/lib/commonjs/components/IconBadge/IconBadge.js +1 -1
  37. package/lib/commonjs/components/IconButton/IconButton.js +1 -1
  38. package/lib/commonjs/components/Input/Input.js +1 -1
  39. package/lib/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +1 -1
  40. package/lib/commonjs/components/ListItem/ListItem.js +1 -1
  41. package/lib/commonjs/components/Modal/Modal.js +1 -1
  42. package/lib/commonjs/components/NumberInput/NumberInput.js +1 -1
  43. package/lib/commonjs/components/OTPInput/OTPInput.js +1 -1
  44. package/lib/commonjs/components/OptionSheet/OptionSheet.js +1 -1
  45. package/lib/commonjs/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
  46. package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +1 -1
  47. package/lib/commonjs/components/ProfileCompletion/ProfileCompletion.js +1 -1
  48. package/lib/commonjs/components/ProgressBar/ProgressBar.js +1 -1
  49. package/lib/commonjs/components/ProgressRing/ProgressRing.js +1 -1
  50. package/lib/commonjs/components/Radio/Radio.js +1 -1
  51. package/lib/commonjs/components/Radio/RadioGroup.js +1 -1
  52. package/lib/commonjs/components/Rating/Rating.js +1 -1
  53. package/lib/commonjs/components/RichTextEditor/RichTextEditor.js +1 -1
  54. package/lib/commonjs/components/ScannerOverlay/ScannerOverlay.js +1 -1
  55. package/lib/commonjs/components/Screen/Screen.js +1 -1
  56. package/lib/commonjs/components/SearchBar/SearchBar.js +1 -1
  57. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +1 -1
  58. package/lib/commonjs/components/Select/Select.js +1 -1
  59. package/lib/commonjs/components/SignaturePad/SignaturePad.js +1 -1
  60. package/lib/commonjs/components/Skeleton/SkeletonClock.js +1 -1
  61. package/lib/commonjs/components/Skeleton/SkeletonProvider.js +1 -1
  62. package/lib/commonjs/components/SlideToConfirm/SlideToConfirm.js +1 -1
  63. package/lib/commonjs/components/Slider/Slider.js +1 -1
  64. package/lib/commonjs/components/SliderField/SliderField.js +1 -1
  65. package/lib/commonjs/components/Sparkline/Sparkline.js +1 -1
  66. package/lib/commonjs/components/Spinner/Spinner.js +1 -1
  67. package/lib/commonjs/components/SquircleView/SquircleView.js +1 -1
  68. package/lib/commonjs/components/StatTile/StatTile.js +1 -1
  69. package/lib/commonjs/components/StatusBadge/StatusBadge.js +1 -1
  70. package/lib/commonjs/components/Stepper/Stepper.js +1 -1
  71. package/lib/commonjs/components/Switch/Switch.js +1 -1
  72. package/lib/commonjs/components/Tabs/Tabs.js +1 -1
  73. package/lib/commonjs/components/TagInput/TagInput.js +1 -1
  74. package/lib/commonjs/components/Text/Text.js +1 -1
  75. package/lib/commonjs/components/Toast/ToastProvider.js +1 -1
  76. package/lib/commonjs/navigation/DiscardGuard.js +1 -1
  77. package/lib/commonjs/theme/ThemeContext.js +1 -1
  78. package/lib/commonjs/utils/shadows.js +1 -1
  79. package/lib/module/components/Accordion/Accordion.js +1 -1
  80. package/lib/module/components/AmountSlider/AmountSlider.js +1 -1
  81. package/lib/module/components/AppBar/AppBar.js +1 -1
  82. package/lib/module/components/AuthedImage/authedImageCache.js +1 -1
  83. package/lib/module/components/Avatar/Avatar.js +1 -1
  84. package/lib/module/components/Badge/Badge.js +1 -1
  85. package/lib/module/components/Banner/Banner.js +1 -1
  86. package/lib/module/components/BarChart/BarChart.js +1 -1
  87. package/lib/module/components/BottomNavigation/BottomNavigation.js +1 -1
  88. package/lib/module/components/BottomSheet/BottomSheet.js +1 -1
  89. package/lib/module/components/Box/Box.js +1 -1
  90. package/lib/module/components/Button/Button.js +1 -1
  91. package/lib/module/components/Calendar/Calendar.js +1 -1
  92. package/lib/module/components/Card/Card.js +1 -1
  93. package/lib/module/components/Carousel/Carousel.js +1 -1
  94. package/lib/module/components/Checkbox/Checkbox.js +1 -1
  95. package/lib/module/components/Chip/Chip.js +1 -1
  96. package/lib/module/components/Composer/Composer.js +1 -1
  97. package/lib/module/components/Confetti/Confetti.js +1 -1
  98. package/lib/module/components/DateRangePicker/DateRangePicker.js +1 -1
  99. package/lib/module/components/DecimalInput/DecimalInput.js +1 -1
  100. package/lib/module/components/Descriptions/Descriptions.js +1 -1
  101. package/lib/module/components/Divider/Divider.js +1 -1
  102. package/lib/module/components/Drawer/Drawer.js +1 -1
  103. package/lib/module/components/EmptyState/EmptyState.js +1 -1
  104. package/lib/module/components/FieldBase/ChoiceText.js +1 -1
  105. package/lib/module/components/FieldBase/FieldBase.js +1 -1
  106. package/lib/module/components/FieldBase/useFloatingLabel.js +1 -1
  107. package/lib/module/components/FilePicker/FilePicker.js +1 -1
  108. package/lib/module/components/FilterChipRow/FilterChipRow.js +1 -1
  109. package/lib/module/components/FloatingActionButton/FloatingActionButton.js +1 -1
  110. package/lib/module/components/FormField/FormField.js +1 -1
  111. package/lib/module/components/IconBadge/IconBadge.js +1 -1
  112. package/lib/module/components/IconButton/IconButton.js +1 -1
  113. package/lib/module/components/Input/Input.js +1 -1
  114. package/lib/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +1 -1
  115. package/lib/module/components/ListItem/ListItem.js +1 -1
  116. package/lib/module/components/Modal/Modal.js +1 -1
  117. package/lib/module/components/NumberInput/NumberInput.js +1 -1
  118. package/lib/module/components/OTPInput/OTPInput.js +1 -1
  119. package/lib/module/components/OptionSheet/OptionSheet.js +1 -1
  120. package/lib/module/components/PhoneNumberInput/PhoneNumberInput.js +1 -1
  121. package/lib/module/components/PickerTrigger/PickerTrigger.js +1 -1
  122. package/lib/module/components/ProfileCompletion/ProfileCompletion.js +1 -1
  123. package/lib/module/components/ProgressBar/ProgressBar.js +1 -1
  124. package/lib/module/components/ProgressRing/ProgressRing.js +1 -1
  125. package/lib/module/components/Radio/Radio.js +1 -1
  126. package/lib/module/components/Radio/RadioGroup.js +1 -1
  127. package/lib/module/components/Rating/Rating.js +1 -1
  128. package/lib/module/components/RichTextEditor/RichTextEditor.js +1 -1
  129. package/lib/module/components/ScannerOverlay/ScannerOverlay.js +1 -1
  130. package/lib/module/components/Screen/Screen.js +1 -1
  131. package/lib/module/components/SearchBar/SearchBar.js +1 -1
  132. package/lib/module/components/SegmentedControl/SegmentedControl.js +1 -1
  133. package/lib/module/components/Select/Select.js +1 -1
  134. package/lib/module/components/SignaturePad/SignaturePad.js +1 -1
  135. package/lib/module/components/Skeleton/SkeletonClock.js +1 -1
  136. package/lib/module/components/Skeleton/SkeletonProvider.js +1 -1
  137. package/lib/module/components/SlideToConfirm/SlideToConfirm.js +1 -1
  138. package/lib/module/components/Slider/Slider.js +1 -1
  139. package/lib/module/components/SliderField/SliderField.js +1 -1
  140. package/lib/module/components/Sparkline/Sparkline.js +1 -1
  141. package/lib/module/components/Spinner/Spinner.js +1 -1
  142. package/lib/module/components/SquircleView/SquircleView.js +1 -1
  143. package/lib/module/components/StatTile/StatTile.js +1 -1
  144. package/lib/module/components/StatusBadge/StatusBadge.js +1 -1
  145. package/lib/module/components/Stepper/Stepper.js +1 -1
  146. package/lib/module/components/Switch/Switch.js +1 -1
  147. package/lib/module/components/Tabs/Tabs.js +1 -1
  148. package/lib/module/components/TagInput/TagInput.js +1 -1
  149. package/lib/module/components/Text/Text.js +1 -1
  150. package/lib/module/components/Toast/ToastProvider.js +1 -1
  151. package/lib/module/navigation/DiscardGuard.js +1 -1
  152. package/lib/module/theme/ThemeContext.js +1 -1
  153. package/lib/module/utils/shadows.js +1 -1
  154. package/lib/typescript/commonjs/components/AmountSlider/AmountSlider.d.ts +3 -2
  155. package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +4 -1
  156. package/lib/typescript/commonjs/components/AuthedImage/authedImageCache.d.ts +3 -1
  157. package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +6 -1
  158. package/lib/typescript/commonjs/components/Badge/Badge.d.ts +5 -1
  159. package/lib/typescript/commonjs/components/Banner/Banner.d.ts +3 -1
  160. package/lib/typescript/commonjs/components/BarChart/BarChart.d.ts +4 -1
  161. package/lib/typescript/commonjs/components/BottomNavigation/BottomNavigation.d.ts +3 -1
  162. package/lib/typescript/commonjs/components/Box/Box.d.ts +6 -3
  163. package/lib/typescript/commonjs/components/Button/Button.d.ts +4 -2
  164. package/lib/typescript/commonjs/components/Calendar/Calendar.d.ts +4 -2
  165. package/lib/typescript/commonjs/components/Card/Card.d.ts +2 -1
  166. package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +4 -1
  167. package/lib/typescript/commonjs/components/Chip/Chip.d.ts +3 -1
  168. package/lib/typescript/commonjs/components/Composer/Composer.d.ts +3 -1
  169. package/lib/typescript/commonjs/components/Confetti/Confetti.d.ts +3 -1
  170. package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +4 -2
  171. package/lib/typescript/commonjs/components/DecimalInput/DecimalInput.d.ts +4 -2
  172. package/lib/typescript/commonjs/components/Divider/Divider.d.ts +3 -2
  173. package/lib/typescript/commonjs/components/Drawer/Drawer.d.ts +3 -1
  174. package/lib/typescript/commonjs/components/EmptyState/EmptyState.d.ts +2 -1
  175. package/lib/typescript/commonjs/components/FilePicker/FilePicker.d.ts +4 -1
  176. package/lib/typescript/commonjs/components/FilterChipRow/FilterChipRow.d.ts +4 -2
  177. package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +2 -1
  178. package/lib/typescript/commonjs/components/FormField/FormField.d.ts +3 -2
  179. package/lib/typescript/commonjs/components/IconBadge/IconBadge.d.ts +4 -2
  180. package/lib/typescript/commonjs/components/IconButton/IconButton.d.ts +4 -2
  181. package/lib/typescript/commonjs/components/Input/Input.d.ts +4 -1
  182. package/lib/typescript/commonjs/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +4 -1
  183. package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +2 -0
  184. package/lib/typescript/commonjs/components/Modal/Modal.d.ts +3 -1
  185. package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +4 -2
  186. package/lib/typescript/commonjs/components/OTPInput/OTPInput.d.ts +3 -2
  187. package/lib/typescript/commonjs/components/PhoneNumberInput/PhoneNumberInput.d.ts +4 -2
  188. package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +4 -4
  189. package/lib/typescript/commonjs/components/ProfileCompletion/ProfileCompletion.d.ts +4 -1
  190. package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +3 -2
  191. package/lib/typescript/commonjs/components/ProgressRing/ProgressRing.d.ts +2 -1
  192. package/lib/typescript/commonjs/components/Radio/Radio.d.ts +4 -2
  193. package/lib/typescript/commonjs/components/Rating/Rating.d.ts +5 -1
  194. package/lib/typescript/commonjs/components/RichTextEditor/RichTextEditor.d.ts +2 -1
  195. package/lib/typescript/commonjs/components/ScannerOverlay/ScannerOverlay.d.ts +2 -1
  196. package/lib/typescript/commonjs/components/SearchBar/SearchBar.d.ts +4 -2
  197. package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +3 -2
  198. package/lib/typescript/commonjs/components/SignaturePad/SignaturePad.d.ts +4 -1
  199. package/lib/typescript/commonjs/components/SlideToConfirm/SlideToConfirm.d.ts +3 -1
  200. package/lib/typescript/commonjs/components/Slider/Slider.d.ts +3 -1
  201. package/lib/typescript/commonjs/components/SliderField/SliderField.d.ts +3 -1
  202. package/lib/typescript/commonjs/components/Sparkline/Sparkline.d.ts +4 -2
  203. package/lib/typescript/commonjs/components/Spinner/Spinner.d.ts +2 -1
  204. package/lib/typescript/commonjs/components/SquircleView/SquircleView.d.ts +8 -3
  205. package/lib/typescript/commonjs/components/StatTile/StatTile.d.ts +3 -2
  206. package/lib/typescript/commonjs/components/StatusBadge/StatusBadge.d.ts +4 -1
  207. package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +3 -1
  208. package/lib/typescript/commonjs/components/Switch/Switch.d.ts +3 -2
  209. package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +3 -2
  210. package/lib/typescript/commonjs/components/TagInput/TagInput.d.ts +4 -2
  211. package/lib/typescript/commonjs/components/Text/Text.d.ts +4 -1
  212. package/lib/typescript/commonjs/navigation/DiscardGuard.d.ts +3 -1
  213. package/lib/typescript/module/components/AmountSlider/AmountSlider.d.ts +3 -2
  214. package/lib/typescript/module/components/AppBar/AppBar.d.ts +4 -1
  215. package/lib/typescript/module/components/AuthedImage/authedImageCache.d.ts +3 -1
  216. package/lib/typescript/module/components/Avatar/Avatar.d.ts +6 -1
  217. package/lib/typescript/module/components/Badge/Badge.d.ts +5 -1
  218. package/lib/typescript/module/components/Banner/Banner.d.ts +3 -1
  219. package/lib/typescript/module/components/BarChart/BarChart.d.ts +4 -1
  220. package/lib/typescript/module/components/BottomNavigation/BottomNavigation.d.ts +3 -1
  221. package/lib/typescript/module/components/Box/Box.d.ts +6 -3
  222. package/lib/typescript/module/components/Button/Button.d.ts +4 -2
  223. package/lib/typescript/module/components/Calendar/Calendar.d.ts +4 -2
  224. package/lib/typescript/module/components/Card/Card.d.ts +2 -1
  225. package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +4 -1
  226. package/lib/typescript/module/components/Chip/Chip.d.ts +3 -1
  227. package/lib/typescript/module/components/Composer/Composer.d.ts +3 -1
  228. package/lib/typescript/module/components/Confetti/Confetti.d.ts +3 -1
  229. package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +4 -2
  230. package/lib/typescript/module/components/DecimalInput/DecimalInput.d.ts +4 -2
  231. package/lib/typescript/module/components/Divider/Divider.d.ts +3 -2
  232. package/lib/typescript/module/components/Drawer/Drawer.d.ts +3 -1
  233. package/lib/typescript/module/components/EmptyState/EmptyState.d.ts +2 -1
  234. package/lib/typescript/module/components/FilePicker/FilePicker.d.ts +4 -1
  235. package/lib/typescript/module/components/FilterChipRow/FilterChipRow.d.ts +4 -2
  236. package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +2 -1
  237. package/lib/typescript/module/components/FormField/FormField.d.ts +3 -2
  238. package/lib/typescript/module/components/IconBadge/IconBadge.d.ts +4 -2
  239. package/lib/typescript/module/components/IconButton/IconButton.d.ts +4 -2
  240. package/lib/typescript/module/components/Input/Input.d.ts +4 -1
  241. package/lib/typescript/module/components/KeyboardAwareScrollView/KeyboardAwareScrollView.d.ts +4 -1
  242. package/lib/typescript/module/components/ListItem/ListItem.d.ts +2 -0
  243. package/lib/typescript/module/components/Modal/Modal.d.ts +3 -1
  244. package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +4 -2
  245. package/lib/typescript/module/components/OTPInput/OTPInput.d.ts +3 -2
  246. package/lib/typescript/module/components/PhoneNumberInput/PhoneNumberInput.d.ts +4 -2
  247. package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +4 -4
  248. package/lib/typescript/module/components/ProfileCompletion/ProfileCompletion.d.ts +4 -1
  249. package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +3 -2
  250. package/lib/typescript/module/components/ProgressRing/ProgressRing.d.ts +2 -1
  251. package/lib/typescript/module/components/Radio/Radio.d.ts +4 -2
  252. package/lib/typescript/module/components/Rating/Rating.d.ts +5 -1
  253. package/lib/typescript/module/components/RichTextEditor/RichTextEditor.d.ts +2 -1
  254. package/lib/typescript/module/components/ScannerOverlay/ScannerOverlay.d.ts +2 -1
  255. package/lib/typescript/module/components/SearchBar/SearchBar.d.ts +4 -2
  256. package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +3 -2
  257. package/lib/typescript/module/components/SignaturePad/SignaturePad.d.ts +4 -1
  258. package/lib/typescript/module/components/SlideToConfirm/SlideToConfirm.d.ts +3 -1
  259. package/lib/typescript/module/components/Slider/Slider.d.ts +3 -1
  260. package/lib/typescript/module/components/SliderField/SliderField.d.ts +3 -1
  261. package/lib/typescript/module/components/Sparkline/Sparkline.d.ts +4 -2
  262. package/lib/typescript/module/components/Spinner/Spinner.d.ts +2 -1
  263. package/lib/typescript/module/components/SquircleView/SquircleView.d.ts +8 -3
  264. package/lib/typescript/module/components/StatTile/StatTile.d.ts +3 -2
  265. package/lib/typescript/module/components/StatusBadge/StatusBadge.d.ts +4 -1
  266. package/lib/typescript/module/components/Stepper/Stepper.d.ts +3 -1
  267. package/lib/typescript/module/components/Switch/Switch.d.ts +3 -2
  268. package/lib/typescript/module/components/Tabs/Tabs.d.ts +3 -2
  269. package/lib/typescript/module/components/TagInput/TagInput.d.ts +4 -2
  270. package/lib/typescript/module/components/Text/Text.d.ts +4 -1
  271. package/lib/typescript/module/navigation/DiscardGuard.d.ts +3 -1
  272. package/package.json +7 -7
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useBottomSheet=exports.default=exports.BottomSheet=void 0;var cache,_react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_reactNativeWorklets=require("react-native-worklets"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../text/index.js"),_bottomSheetG=require("../../text/phone/bottomSheet.g.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_OverlayActions=require("../Dialog/OverlayActions.js"),_Modal=require("../Modal/Modal.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var a,r,o=Object.defineProperty,n={__proto__:null,default:e};if(Object(e)!==e)return n;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,n)}for(r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((a=o&&Object.getOwnPropertyDescriptor(e,r))&&(a.get||a.set)?o(n,r,a):n[r]=e[r]);return n}const DEFAULT_SNAP_POINTS=["content"],TABLET_MIN_SHORT_SIDE=600,DIALOG_MAX_WIDTH=560,BottomSheetContext=(0,_react.createContext)(null),useBottomSheet=()=>{const e=(0,_react.useContext)(BottomSheetContext);if(!e)throw new Error("[@webority/mobile-ui] BottomSheet: useBottomSheet must be used inside a <BottomSheet>.");return e};exports.useBottomSheet=useBottomSheet;const SPRING_CONFIG={damping:20,stiffness:240,mass:1},CLOSE_VELOCITY_THRESHOLD=1e3,DRAG_ACTIVATION_OFFSET=10,BottomSheet=e=>{const{snapPoints:t=DEFAULT_SNAP_POINTS,open:a,onClose:r,snapIndex:o,onSnapChange:n,onAnimate:s,onAfterClose:i,enablePanDownToClose:c=!0,enableBackdropPress:l=!0,onBeforeClose:u,title:d,labels:_,scrollable:h=!1,scrollRef:m,onScroll:v,onContentSizeChange:f,onScrollLayout:b,scrollEventThrottle:x,keyboardBehavior:S="shift",inline:p=!1,presentation:R="sheet",animateMount:N=!0,handleIndicatorStyle:y,sheetStyle:g,header:M,actions:j,actionsLayout:C="auto",footer:w,headerStyle:k,footerStyle:O,children:V,accessibilityLabel:I,accessibilityViewIsModal:A,testID:T}=e;(0,_assertValidValue.assertValidValue)("BottomSheet","presentation",e.presentation,["sheet","dialog","auto"]),(0,_assertValidValue.assertValidValue)("BottomSheet","keyboardBehavior",e.keyboardBehavior,["none","shift"]),(0,_assertValidValue.assertValidValue)("BottomSheet","actionsLayout",e.actionsLayout,_OverlayActions.ACTIONS_LAYOUTS);const E=(0,_index.useMobileUiText)("bottomSheet",_bottomSheetG.BOTTOM_SHEET_TEXT),B=(0,_react.useMemo)(()=>({...E,..._}),[E,_]),P=null!=M||null!=d,D=null!=j&&j.length>0,H=null!=w||D,G=p?"inline":"modal",L=(0,_index2.useTheme)(),q=(0,_usePresenceMotion.usePresenceMotion)(),W=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),[F,U]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window").height),[Y,K]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window").width),$=(0,_react.useCallback)(e=>{const{height:t,width:a}=e.nativeEvent.layout;t>0&&U(e=>e===t?e:t),a>0&&K(e=>e===a?e:a)},[]),z=(0,_reactNative.useWindowDimensions)(),X="dialog"===R||"auto"===R&&Math.min(z.width,z.height)>=600,J=Math.min(560,Y-2*L.space.xl),[Q,Z]=(0,_ModalSafeArea.useModalInsets)(),ee="modal"===G?Q.top:W.top,te="modal"===G?Q.bottom:W.bottom,ae=t.includes("content"),[re,oe]=useMeasuredHeight(),[ne,se]=useMeasuredHeight(),[ie,ce,le]=useMeasuredHeight(),[ue,de]=useMeasuredHeight(),he=X?L.space.md:re,me=ae?Math.min(he+(P?ne:0)+ie+(H?ue:0)+te,F-ee):0,ve=(0,_react.useCallback)((e,t)=>{ae&&le(t),f?.(e,t)},[ae,f,le]),fe=(0,_react.useMemo)(()=>resolveSnapPoints(t,F,me),[t,F,me]),be=F,xe=fe[fe.length-1]??0,Se=(0,_reactNativeReanimated.useSharedValue)(be),pe=(0,_reactNativeReanimated.useSharedValue)(be),Re=(0,_reactNativeReanimated.useSharedValue)(1),Ne=(0,_reactNativeReanimated.useSharedValue)(-1),[ye,ge]=(0,_react.useState)(-1),[Me,je]=(0,_react.useState)(!1),[Ce,we]=(0,_react.useState)(!1),ke=(0,_react.useRef)(!1),Oe=(0,_react.useRef)(i);Oe.current=i;const[Ve,Ie]=(0,_react.useState)(!1),Ae=(0,_react.useRef)(!N&&a),Te=(0,_react.useRef)(-1),Ee=(0,_react.useRef)(!1);Ee.current="modal"===G?Ce:Ve;const Be=(0,_react.useRef)(u);Be.current=u;const Pe=(0,_react.useRef)(r);Pe.current=r;const De=(0,_react.useRef)(!1),He=(0,_react.useRef)(!0),Ge=(0,_react.useRef)([]),Le=(0,_react.useCallback)(e=>{const t=Ge.current;Ge.current=[];for(const a of t)a(e)},[]);(0,_react.useEffect)(()=>(He.current=!0,()=>{He.current=!1,Le(!1)}),[Le]);const qe=(0,_react.useCallback)(e=>{if(e<0||e>=fe.length)return be;const t=fe[e];if(void 0===t)throw new Error("BottomSheet: an in-range snap index always has a resolved snap point");return X?(F-t)/2:F-t},[fe,F,be,X]),We=(0,_react.useCallback)(e=>{Te.current=e;ye!==e&&(ge(e),Ne.value=e,e>=0&&n?.(e))},[ye,Ne,n]),Fe=(0,_react.useCallback)(()=>{Ne.value<0&&(ke.current=!0,"modal"===G?(je(!1),"ios"!==_reactNative.Platform.OS&&we(!1)):Ie(!1))},[G,Ne]),Ue=(0,_react.useCallback)(()=>{ke.current&&we(!1)},[]);(0,_react.useEffect)(()=>{("modal"===G?!Ce:!Ve)&&ke.current&&(ke.current=!1,Oe.current?.(),Le(!0))},[G,Ce,Ve,Le]);const Ye=(0,_react.useCallback)((e,t,a)=>{s?.(t,a),Se.value=(0,_reactNativeReanimated.withSpring)(e,SPRING_CONFIG,e=>{"worklet";e&&(0,_reactNativeWorklets.scheduleOnRN)(Fe)})},[s,Se,Fe]),Ke=(0,_react.useRef)(null),$e=(0,_react.useCallback)(e=>{const t="number"==typeof e?clamp(e,0,fe.length-1):Math.max(ye,0),a=Ne.value,r=qe(t);return ke.current=!1,Le(!1),"modal"===G?(we(!0),je(!0)):Ie(!0),a<0&&Ae.current?(Se.value=r,Re.value=1,We(t),void s?.(a,t)):a<0&&q.reduced?(Se.value=r,Re.value=0,Re.value=(0,_reactNativeReanimated.withTiming)(1,{duration:q.duration("fast"),easing:_reactNativeReanimated.Easing.bezier(...L.motion.ease.decelerate),reduceMotion:_usePresenceMotion.PRESENCE_REDUCE_MOTION}),We(t),void s?.(a,t)):(a<0&&(Se.value=be,Re.value=1),We(t),void(a<0&&t>=0&&!Ee.current?Ke.current={fromIndex:a,target:t}:Ye(r,a,t)))},[Ye,be,ye,Ne,G,s,q,Re,fe.length,We,Le,L.motion.ease.decelerate,Se,qe]),ze=(0,_react.useCallback)(()=>new Promise(e=>{if(Te.current<0)return void(Ee.current?Ge.current.push(e):e(!0));Ge.current.push(e),Ae.current=!1,Ke.current=null;const t=Ne.value;We(-1),s?.(t,-1);const a=q.reduced?Re:Se,r=q.reduced?0:be;a.value=(0,_reactNativeReanimated.withTiming)(r,{duration:q.duration("fast"),easing:_reactNativeReanimated.Easing.bezier(...L.motion.ease.accelerate),reduceMotion:_usePresenceMotion.PRESENCE_REDUCE_MOTION},e=>{"worklet";e&&(0,_reactNativeWorklets.scheduleOnRN)(Fe)})}),[be,Ne,Fe,s,q,Re,We,Se,L.motion.ease.accelerate]),Xe=(0,_react.useCallback)((e,t,a)=>{const r=Be.current;if(!r)return void e();if(De.current)return void t?.();const o=r();"boolean"!=typeof o?(De.current=!0,a?.(),o.then(a=>{De.current=!1,a&&He.current&&Te.current>=0?e():t?.()},e=>{throw De.current=!1,e})):(o?e:t)?.()},[]),Je=(0,_react.useCallback)(()=>new Promise(e=>{Te.current<0?e(!0):Xe(()=>{Pe.current(),ze(),e(!0)},()=>e(!1))}),[ze,Xe]),Qe=(0,_react.useCallback)(()=>{Pe.current()},[]),Ze=(0,_react.useCallback)(()=>{l&&Je()},[l,Je]),et=(0,_react.useRef)(null),tt=(0,_react.useRef)($e);tt.current=$e;const at=(0,_react.useRef)(ze);at.current=ze,(0,_react.useEffect)(()=>{const e=et.current!==a;et.current=a,e?a?tt.current(o??0):at.current():a&&"number"==typeof o&&o!==Ne.value&&tt.current(o)},[a,o,Ne]);const rt=(0,_react.useRef)({hostHeight:F,contentSnap:me}),ot=(0,_react.useRef)(qe);ot.current=qe,(0,_react.useEffect)(()=>{const e=rt.current;if(e.hostHeight===F&&e.contentSnap===me)return;if(rt.current={hostHeight:F,contentSnap:me},e.hostHeight===F&&Ne.value<0)return;const t=ot.current(Ne.value);Se.value=Ae.current?t:(0,_reactNativeReanimated.withSpring)(t,SPRING_CONFIG)},[F,me,Ne,Se]);const nt="modal"===G?Ce:Ve;(0,_react.useEffect)(()=>{const e=Ke.current;null!==e&&nt&&(Ke.current=null,Te.current===e.target&&Ye(ot.current(e.target),e.fromIndex,e.target))},[nt,Ye]);const st=F-xe,it=(0,_react.useMemo)(()=>fe.map(e=>F-e),[fe,F]),ct=(0,_react.useCallback)(()=>{const e=Te.current;e<0||Ye(qe(e),e,e)},[Ye,qe]),lt=(0,_react.useCallback)((e,t)=>{const a=Ne.value;-1!==e?(We(e),Ye(t,a,e)):Xe(()=>{_reactNative.Keyboard.dismiss(),(0,_index3.triggerHaptic)("selection"),Pe.current(),ze()},ct,ct)},[Ye,ze,Ne,Xe,We,ct]),ut=(0,_react.useMemo)(()=>({testID:T?`${T}-content-gesture`:"bottom-sheet-content-gesture"}),[T]),dt=(0,_reactNativeGestureHandler.useNativeGesture)(ut),_t=(0,_react.useMemo)(()=>{const e=it,t=be,a=st,r=c;return{testID:T?`${T}-pan-gesture`:"bottom-sheet-pan-gesture",activeOffsetY:[-10,10],failOffsetX:[-15,15],onActivate:()=>{"worklet";pe.value=Se.value},onUpdate:e=>{"worklet";const t=pe.value+e.translationY;Se.value=t<a?a+.25*(t-a):t},onDeactivate:a=>{"worklet";const o=Se.value,n=a.velocityY,[s]=e;if(void 0===s)return void(0,_reactNativeWorklets.scheduleOnRN)(lt,-1,t);if(n>1e3)return r?void(0,_reactNativeWorklets.scheduleOnRN)(lt,-1,t):void(0,_reactNativeWorklets.scheduleOnRN)(lt,0,s);let i=0,c=s,l=1/0,u=0;for(const t of e){const e=Math.abs(o-t);e<l&&(l=e,c=t,i=u),u++}r&&o-s>80?(0,_reactNativeWorklets.scheduleOnRN)(lt,-1,t):(0,_reactNativeWorklets.scheduleOnRN)(lt,i,c)}}},[be,pe,c,lt,st,it,T,Se]),ht=(0,_reactNativeGestureHandler.usePanGesture)(_t),{height:mt,progress:vt}=(0,_reactNativeKeyboardController.useReanimatedKeyboardAnimation)(),ft="shift"===S,bt=(0,_reactNativeReanimated.useDerivedValue)(()=>ft?mt.value:0,[ft,mt]),xt=(0,_reactNativeReanimated.useSharedValue)(0);(0,_reactNativeReanimated.useAnimatedReaction)(()=>ft&&vt.value>=1?mt.value:0,e=>{xt.value=e},[ft,mt,vt,xt]);const St=fe[Math.max(ye,0)]??xe,pt=L.space.md,Rt=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=bt.value;if(X){const t=F+e-St-pt,a=e<0&&Se.value>t?t:Se.value;return{top:Se.value,transform:[{translateY:Math.max(a,ee)-Se.value}],opacity:Re.value}}const t=e<0?ee:st,a=Math.max(Se.value+e,t);return{top:Se.value,transform:[{translateY:a-Se.value}],opacity:Re.value}},[X,bt,F,St,pt,Se,ee,Re,st]),Nt=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=xt.value;if(X){const t=F+e-St-pt,a=e<0&&Se.value>t?t:Se.value,r=Math.max(a,ee),o=F+e-pt-r;return{height:o<0?0:Math.min(o,St)}}const t=e<0?ee:st,a=Se.value+e,r=Math.max(a,t),o=F+e-r;return{height:o<0?0:Math.min(o,xe)}},[xt,X,F,St,pt,Se,ee,st,xe]),yt=ye>=0,gt=(0,_react.useMemo)(()=>buildStyles(L),[L]),Mt=(0,_react.useCallback)(()=>{l&&Xe(()=>{(0,_index3.triggerHaptic)("selection"),Pe.current(),ze()})},[l,ze,Xe]),jt=(0,_react.useMemo)(()=>({testID:T?`${T}-backdrop-gesture`:"bottom-sheet-backdrop-gesture",maxDuration:250,onDeactivate:e=>{"worklet";e.canceled||(0,_reactNativeWorklets.scheduleOnRN)(Mt)}}),[Mt,T]),Ct=(0,_reactNativeGestureHandler.useTapGesture)(jt),wt=(0,_react.useMemo)(()=>({snapIndex:ye,snapPoints:fe,close:Qe,requestClose:Je}),[ye,fe,Qe,Je]);if("inline"===G&&!Ve)return null;if("modal"===G&&!Ce)return null;const kt=(0,_jsxRuntime.jsxs)(_reactNative.View,{collapsable:!1,style:["modal"===G?gt.backdropModal:gt.backdropInline,{backgroundColor:"modal"===G?(0,_color.transparentOf)(L.colors.scrim):L.colors.scrim}],onLayout:$,testID:T,accessibilityViewIsModal:A??yt,children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:Ct,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:_reactNative.StyleSheet.absoluteFill,accessibilityRole:"button",accessibilityLabel:B.close})}),(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{accessibilityRole:"alert",accessibilityLabel:I,accessibilityViewIsModal:A??yt,accessibilityActions:[{name:"escape",label:B.close}],onAccessibilityAction:e=>{"escape"===e.nativeEvent.actionName&&Ze()},onAccessibilityEscape:Ze,style:[gt.sheet,{height:xe,backgroundColor:L.colors.surface,borderTopLeftRadius:L.radius.xl,borderTopRightRadius:L.radius.xl,..._corners.smoothCorners,...L.shadow.modal},X?{height:St,left:(Y-J)/2,right:void 0,width:J,borderBottomLeftRadius:L.radius.xl,borderBottomRightRadius:L.radius.xl}:null,g,Rt],children:(0,_jsxRuntime.jsxs)(SheetBody,{style:[gt.body,Nt],settledKeyboardOffset:xt,children:[X?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:L.space.md}}):(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:ht,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:gt.handleRow,onLayout:ae?oe:void 0,accessible:!0,accessibilityLabel:B.dragHandle,accessibilityHint:B.dragHandleHintText,testID:T?`${T}-handle`:"bottom-sheet-handle",children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[gt.handle,{backgroundColor:L.colors.border},y]})})}),P&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[gt.header,k],onLayout:ae?se:void 0,children:[null!=d?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"title",accessibilityRole:"header",children:d}):null,M]}),h?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:dt,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{ref:m,testID:T?`${T}-scroll`:void 0,style:gt.scrollContent,onScroll:v,onContentSizeChange:ve,onLayout:b,scrollEventThrottle:x,keyboardShouldPersistTaps:"always",keyboardDismissMode:"none",children:V})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:ae?[gt.content,{overflow:"visible"}]:gt.content,children:ae?(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:ce,children:V}):V}),H&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[gt.footer,O],onLayout:ae?de:void 0,children:[D?(0,_jsxRuntime.jsx)(_reactNative.View,{style:gt.actions,children:(0,_jsxRuntime.jsx)(_OverlayActions.OverlayActions,{actions:j??[],layout:C})}):null,w]})]})})]}),Ot=(0,_jsxRuntime.jsx)(BottomSheetContext.Provider,{value:wt,children:kt});return"modal"===G?(0,_jsxRuntime.jsx)(_Modal.Modal,{open:Me,onClose:Ze,presentation:"fullScreen",bare:!0,backdropPressClose:!1,haptic:!1,animateMount:!1,onInsetsChange:Z,onDismissed:"ios"===_reactNative.Platform.OS?Ue:void 0,children:"android"===_reactNative.Platform.OS?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:gt.modalRoot,children:Ot}):Ot}):Ot};exports.BottomSheet=BottomSheet;const SheetBody=({style:e,settledKeyboardOffset:t,children:a})=>{const r=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)().bottom,o=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=r+t.value;return{paddingBottom:Math.max(e,0)}},[r,t]);return(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[e,o],children:a})};BottomSheet.displayName="BottomSheet";const useMeasuredHeight=()=>{const[e,t]=(0,_react.useState)(0),a=(0,_react.useCallback)(e=>{t(t=>t===e?t:e)},[]);return[e,(0,_react.useCallback)(e=>a(e.nativeEvent.layout.height),[a]),a]},resolveSnapPoints=(e,t,a)=>[...e.map(e=>{if("number"==typeof e)return e;if("content"===e)return a;const r=parseFloat(e);return Number.isNaN(r)?0:r/100*t})].sort((e,t)=>e-t),clamp=(e,t,a)=>Math.min(Math.max(e,t),a),buildStyles=e=>_reactNative.StyleSheet.create({backdropModal:{flex:1},backdropInline:{..._reactNative.StyleSheet.absoluteFill},sheet:{position:"absolute",left:0,right:0,overflow:"hidden"},body:{overflow:"hidden"},handleRow:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",paddingTop:e.space.md,paddingBottom:e.space.xl},header:{},actions:{padding:e.space.lg},footer:{backgroundColor:e.colors.surface},handle:{width:36,height:4,borderRadius:e.radius.pill,..._corners.smoothCorners},content:{flex:1,overflow:"hidden"},scrollContent:{flex:1},modalRoot:{flex:1}});var _default=exports.default=BottomSheet;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useBottomSheet=exports.default=exports.BottomSheet=void 0;var cache,_react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_reactNativeWorklets=require("react-native-worklets"),_usePresenceMotion=require("../../hooks/usePresenceMotion.js"),_index=require("../../text/index.js"),_bottomSheetG=require("../../text/phone/bottomSheet.g.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_OverlayActions=require("../Dialog/OverlayActions.js"),_Modal=require("../Modal/Modal.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var a,r,o=Object.defineProperty,n={__proto__:null,default:e};if(Object(e)!==e)return n;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,n)}for(r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((a=o&&Object.getOwnPropertyDescriptor(e,r))&&(a.get||a.set)?o(n,r,a):n[r]=e[r]);return n}const DEFAULT_SNAP_POINTS=["content"],TABLET_MIN_SHORT_SIDE=600,DIALOG_MAX_WIDTH=560,BottomSheetContext=(0,_react.createContext)(null),useBottomSheet=()=>{const e=(0,_react.useContext)(BottomSheetContext);if(!e)throw new Error("[@webority/mobile-ui] BottomSheet: useBottomSheet must be used inside a <BottomSheet>.");return e};exports.useBottomSheet=useBottomSheet;const SPRING_CONFIG={damping:20,stiffness:240,mass:1},CLOSE_VELOCITY_THRESHOLD=1e3,DRAG_ACTIVATION_OFFSET=10,BottomSheet=e=>{const{snapPoints:t=DEFAULT_SNAP_POINTS,open:a,onClose:r,snapIndex:o,onSnapChange:n,onAnimate:s,onAfterClose:i,enablePanDownToClose:c=!0,enableBackdropPress:l=!0,onBeforeClose:u,title:d,labels:_,scrollable:h=!1,scrollRef:m,onScroll:v,onContentSizeChange:f,onScrollLayout:b,scrollEventThrottle:x,keyboardBehavior:S="shift",inline:p=!1,presentation:R="sheet",animateMount:N=!0,handleIndicatorStyle:y,sheetStyle:g,header:M,actions:j,actionsLayout:C="auto",footer:w,headerStyle:k,footerStyle:O,children:V,accessibilityLabel:I,accessibilityViewIsModal:A,testID:T}=e;(0,_assertValidValue.assertValidValue)("BottomSheet","presentation",e.presentation,["sheet","dialog","auto"]),(0,_assertValidValue.assertValidValue)("BottomSheet","keyboardBehavior",e.keyboardBehavior,["none","shift"]),(0,_assertValidValue.assertValidValue)("BottomSheet","actionsLayout",e.actionsLayout,_OverlayActions.ACTIONS_LAYOUTS);const E=(0,_index.useMobileUiText)("bottomSheet",_bottomSheetG.BOTTOM_SHEET_TEXT),B=(0,_react.useMemo)(()=>({...E,..._}),[E,_]),P=null!=M||null!=d,D=null!=j&&j.length>0,H=null!=w||D,G=p?"inline":"modal",L=(0,_index2.useTheme)(),q=(0,_usePresenceMotion.usePresenceMotion)(),W=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),[F,U]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window").height),[Y,K]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window").width),$=(0,_react.useCallback)(e=>{const{height:t,width:a}=e.nativeEvent.layout;t>0&&U(e=>e===t?e:t),a>0&&K(e=>e===a?e:a)},[]),z=(0,_reactNative.useWindowDimensions)(),X="dialog"===R||"auto"===R&&Math.min(z.width,z.height)>=600,J=Math.min(560,Y-2*L.space.xl),[Q,Z]=(0,_ModalSafeArea.useModalInsets)(),ee="modal"===G?Q.top:W.top,te="modal"===G?Q.bottom:W.bottom,ae=t.includes("content"),[re,oe]=useMeasuredHeight(),[ne,se]=useMeasuredHeight(),[ie,ce,le]=useMeasuredHeight(),[ue,de]=useMeasuredHeight(),he=X?L.space.md:re,me=ae?Math.min(he+(P?ne:0)+ie+(H?ue:0)+te,F-ee):0,ve=(0,_react.useCallback)((e,t)=>{ae&&le(t),f?.(e,t)},[ae,f,le]),fe=(0,_react.useMemo)(()=>resolveSnapPoints(t,F,me),[t,F,me]),be=F,xe=fe[fe.length-1]??0,Se=(0,_reactNativeReanimated.useSharedValue)(be),pe=(0,_reactNativeReanimated.useSharedValue)(be),Re=(0,_reactNativeReanimated.useSharedValue)(1),Ne=(0,_reactNativeReanimated.useSharedValue)(-1),[ye,ge]=(0,_react.useState)(-1),[Me,je]=(0,_react.useState)(!1),[Ce,we]=(0,_react.useState)(!1),ke=(0,_react.useRef)(!1),Oe=(0,_react.useRef)(i);Oe.current=i;const[Ve,Ie]=(0,_react.useState)(!1),Ae=(0,_react.useRef)(!N&&a),Te=(0,_react.useRef)(-1),Ee=(0,_react.useRef)(!1);Ee.current="modal"===G?Ce:Ve;const Be=(0,_react.useRef)(u);Be.current=u;const Pe=(0,_react.useRef)(r);Pe.current=r;const De=(0,_react.useRef)(!1),He=(0,_react.useRef)(!0),Ge=(0,_react.useRef)([]),Le=(0,_react.useCallback)(e=>{const t=Ge.current;Ge.current=[];for(const a of t)a(e)},[]);(0,_react.useEffect)(()=>(He.current=!0,()=>{He.current=!1,Le(!1)}),[Le]);const qe=(0,_react.useCallback)(e=>{if(e<0||e>=fe.length)return be;const t=fe[e];if(void 0===t)throw new Error("BottomSheet: an in-range snap index always has a resolved snap point");return X?(F-t)/2:F-t},[fe,F,be,X]),We=(0,_react.useCallback)(e=>{Te.current=e;ye!==e&&(ge(e),Ne.value=e,e>=0&&n?.(e))},[ye,Ne,n]),Fe=(0,_react.useCallback)(()=>{Ne.value<0&&(ke.current=!0,"modal"===G?(je(!1),"ios"!==_reactNative.Platform.OS&&we(!1)):Ie(!1))},[G,Ne]),Ue=(0,_react.useCallback)(()=>{ke.current&&we(!1)},[]);(0,_react.useEffect)(()=>{("modal"===G?!Ce:!Ve)&&ke.current&&(ke.current=!1,Oe.current?.(),Le(!0))},[G,Ce,Ve,Le]);const Ye=(0,_react.useCallback)((e,t,a)=>{s?.(t,a),Se.value=(0,_reactNativeReanimated.withSpring)(e,SPRING_CONFIG,e=>{"worklet";e&&(0,_reactNativeWorklets.scheduleOnRN)(Fe)})},[s,Se,Fe]),Ke=(0,_react.useRef)(null),$e=(0,_react.useCallback)(e=>{const t="number"==typeof e?clamp(e,0,fe.length-1):Math.max(ye,0),a=Ne.value,r=qe(t);return ke.current=!1,Le(!1),"modal"===G?(we(!0),je(!0)):Ie(!0),a<0&&Ae.current?(Se.value=r,Re.value=1,We(t),void s?.(a,t)):a<0&&q.reduced?(Se.value=r,Re.value=0,Re.value=(0,_reactNativeReanimated.withTiming)(1,{duration:q.duration("fast"),easing:_reactNativeReanimated.Easing.bezier(...L.motion.ease.decelerate),reduceMotion:_usePresenceMotion.PRESENCE_REDUCE_MOTION}),We(t),void s?.(a,t)):(a<0&&(Se.value=be,Re.value=1),We(t),void(a<0&&t>=0&&!Ee.current?Ke.current={fromIndex:a,target:t}:Ye(r,a,t)))},[Ye,be,ye,Ne,G,s,q,Re,fe.length,We,Le,L.motion.ease.decelerate,Se,qe]),ze=(0,_react.useCallback)(()=>new Promise(e=>{if(Te.current<0)return void(Ee.current?Ge.current.push(e):e(!0));Ge.current.push(e),Ae.current=!1,Ke.current=null;const t=Ne.value;We(-1),s?.(t,-1);const a=q.reduced?Re:Se,r=q.reduced?0:be;a.value=(0,_reactNativeReanimated.withTiming)(r,{duration:q.duration("fast"),easing:_reactNativeReanimated.Easing.bezier(...L.motion.ease.accelerate),reduceMotion:_usePresenceMotion.PRESENCE_REDUCE_MOTION},e=>{"worklet";e&&(0,_reactNativeWorklets.scheduleOnRN)(Fe)})}),[be,Ne,Fe,s,q,Re,We,Se,L.motion.ease.accelerate]),Xe=(0,_react.useCallback)((e,t,a)=>{const r=Be.current;if(!r)return void e();if(De.current)return void t?.();const o=r();"boolean"!=typeof o?(De.current=!0,a?.(),o.then(a=>{De.current=!1,a&&He.current&&Te.current>=0?e():t?.()},e=>{throw De.current=!1,e})):(o?e:t)?.()},[]),Je=(0,_react.useCallback)(()=>new Promise(e=>{Te.current<0?e(!0):Xe(()=>{Pe.current(),ze(),e(!0)},()=>e(!1))}),[ze,Xe]),Qe=(0,_react.useCallback)(()=>{Pe.current()},[]),Ze=(0,_react.useCallback)(()=>{l&&Je()},[l,Je]),et=(0,_react.useRef)(null),tt=(0,_react.useRef)($e);tt.current=$e;const at=(0,_react.useRef)(ze);at.current=ze,(0,_react.useEffect)(()=>{const e=et.current!==a;et.current=a,e?a?tt.current(o??0):at.current():a&&"number"==typeof o&&o!==Ne.value&&tt.current(o)},[a,o,Ne]);const rt=(0,_react.useRef)({hostHeight:F,contentSnap:me}),ot=(0,_react.useRef)(qe);ot.current=qe,(0,_react.useEffect)(()=>{const e=rt.current;if(e.hostHeight===F&&e.contentSnap===me)return;if(rt.current={hostHeight:F,contentSnap:me},e.hostHeight===F&&Ne.value<0)return;const t=ot.current(Ne.value);Se.value=Ae.current?t:(0,_reactNativeReanimated.withSpring)(t,SPRING_CONFIG)},[F,me,Ne,Se]);const nt="modal"===G?Ce:Ve;(0,_react.useEffect)(()=>{const e=Ke.current;null!==e&&nt&&(Ke.current=null,Te.current===e.target&&Ye(ot.current(e.target),e.fromIndex,e.target))},[nt,Ye]);const st=F-xe,it=(0,_react.useMemo)(()=>fe.map(e=>F-e),[fe,F]),ct=(0,_react.useCallback)(()=>{const e=Te.current;e<0||Ye(qe(e),e,e)},[Ye,qe]),lt=(0,_react.useCallback)((e,t)=>{const a=Ne.value;-1!==e?(We(e),Ye(t,a,e)):Xe(()=>{_reactNative.Keyboard.dismiss(),(0,_index3.triggerHaptic)("selection"),Pe.current(),ze()},ct,ct)},[Ye,ze,Ne,Xe,We,ct]),ut=(0,_react.useMemo)(()=>({testID:T?`${T}-content-gesture`:"bottom-sheet-content-gesture"}),[T]),dt=(0,_reactNativeGestureHandler.useNativeGesture)(ut),_t=(0,_react.useMemo)(()=>{const e=it,t=be,a=st,r=c;return{testID:T?`${T}-pan-gesture`:"bottom-sheet-pan-gesture",activeOffsetY:[-10,10],failOffsetX:[-15,15],onActivate:()=>{"worklet";pe.value=Se.value},onUpdate:e=>{"worklet";const t=pe.value+e.translationY;Se.value=t<a?a+.25*(t-a):t},onDeactivate:a=>{"worklet";const o=Se.value,n=a.velocityY,[s]=e;if(void 0===s)return void(0,_reactNativeWorklets.scheduleOnRN)(lt,-1,t);if(n>1e3)return r?void(0,_reactNativeWorklets.scheduleOnRN)(lt,-1,t):void(0,_reactNativeWorklets.scheduleOnRN)(lt,0,s);let i=0,c=s,l=1/0,u=0;for(const t of e){const e=Math.abs(o-t);e<l&&(l=e,c=t,i=u),u++}r&&o-s>80?(0,_reactNativeWorklets.scheduleOnRN)(lt,-1,t):(0,_reactNativeWorklets.scheduleOnRN)(lt,i,c)}}},[be,pe,c,lt,st,it,T,Se]),ht=(0,_reactNativeGestureHandler.usePanGesture)(_t),{height:mt,progress:vt}=(0,_reactNativeKeyboardController.useReanimatedKeyboardAnimation)(),ft="shift"===S,bt=(0,_reactNativeReanimated.useDerivedValue)(()=>ft?mt.value:0,[ft,mt]),xt=(0,_reactNativeReanimated.useSharedValue)(0);(0,_reactNativeReanimated.useAnimatedReaction)(()=>ft&&vt.value>=1?mt.value:0,e=>{xt.value=e},[ft,mt,vt,xt]);const St=fe[Math.max(ye,0)]??xe,pt=L.space.md,Rt=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=bt.value;if(X){const t=F+e-St-pt,a=e<0&&Se.value>t?t:Se.value;return{top:Se.value,transform:[{translateY:Math.max(a,ee)-Se.value}],opacity:Re.value}}const t=e<0?ee:st,a=Math.max(Se.value+e,t);return{top:Se.value,transform:[{translateY:a-Se.value}],opacity:Re.value}},[X,bt,F,St,pt,Se,ee,Re,st]),Nt=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=xt.value;if(X){const t=F+e-St-pt,a=e<0&&Se.value>t?t:Se.value,r=Math.max(a,ee),o=F+e-pt-r;return{height:o<0?0:Math.min(o,St)}}const t=e<0?ee:st,a=Se.value+e,r=Math.max(a,t),o=F+e-r;return{height:o<0?0:Math.min(o,xe)}},[xt,X,F,St,pt,Se,ee,st,xe]),yt=ye>=0,gt=(0,_react.useMemo)(()=>buildStyles(L),[L]),Mt=(0,_react.useCallback)(()=>{l&&Xe(()=>{(0,_index3.triggerHaptic)("selection"),Pe.current(),ze()})},[l,ze,Xe]),jt=(0,_react.useMemo)(()=>({testID:T?`${T}-backdrop-gesture`:"bottom-sheet-backdrop-gesture",maxDuration:250,onDeactivate:e=>{"worklet";e.canceled||(0,_reactNativeWorklets.scheduleOnRN)(Mt)}}),[Mt,T]),Ct=(0,_reactNativeGestureHandler.useTapGesture)(jt),wt=(0,_react.useMemo)(()=>({snapIndex:ye,snapPoints:fe,close:Qe,requestClose:Je}),[ye,fe,Qe,Je]);if("inline"===G&&!Ve)return null;if("modal"===G&&!Ce)return null;const kt=(0,_jsxRuntime.jsxs)(_reactNative.View,{collapsable:!1,style:["modal"===G?gt.backdropModal:gt.backdropInline,{backgroundColor:"modal"===G?(0,_color.transparentOf)(L.colors.scrim):L.colors.scrim}],onLayout:$,testID:T,accessibilityViewIsModal:A??yt,children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:Ct,children:(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:_reactNative.StyleSheet.absoluteFill,accessibilityRole:"button",accessibilityLabel:B.close})}),(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{accessibilityRole:"alert",accessibilityLabel:I,accessibilityViewIsModal:A??yt,accessibilityActions:[{name:"escape",label:B.close}],onAccessibilityAction:e=>{"escape"===e.nativeEvent.actionName&&Ze()},onAccessibilityEscape:Ze,style:[gt.sheet,{height:xe,backgroundColor:L.colors.surface,borderTopLeftRadius:L.radius.xl,borderTopRightRadius:L.radius.xl,..._corners.smoothCorners,...L.shadow.modal},X?{height:St,left:(Y-J)/2,right:void 0,width:J,borderBottomLeftRadius:L.radius.xl,borderBottomRightRadius:L.radius.xl}:null,g,Rt],children:(0,_jsxRuntime.jsxs)(SheetBody,{style:[gt.body,Nt],settledKeyboardOffset:xt,children:[X?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:L.space.md}}):(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:ht,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:gt.handleRow,onLayout:ae?oe:void 0,accessible:!0,accessibilityLabel:B.dragHandle,accessibilityHint:B.dragHandleHintText,testID:T?`${T}-handle`:"bottom-sheet-handle",children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[gt.handle,{backgroundColor:L.colors.border},y]})})}),P&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[gt.header,k],onLayout:ae?se:void 0,children:[null!=d?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"title",accessibilityRole:"header",children:d}):null,M]}),h?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:dt,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{ref:m,testID:T?`${T}-scroll`:void 0,style:gt.scrollContent,onScroll:v,onContentSizeChange:ve,onLayout:b,scrollEventThrottle:x,keyboardShouldPersistTaps:"always",keyboardDismissMode:"none",children:V})}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:ae?[gt.content,{overflow:"visible"}]:gt.content,children:ae?(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:ce,children:V}):V}),H&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[gt.footer,O],onLayout:ae?de:void 0,children:[D?(0,_jsxRuntime.jsx)(_reactNative.View,{style:gt.actions,children:(0,_jsxRuntime.jsx)(_OverlayActions.OverlayActions,{actions:j??[],layout:C})}):null,w]})]})})]}),Ot=(0,_jsxRuntime.jsx)(BottomSheetContext,{value:wt,children:kt});return"modal"===G?(0,_jsxRuntime.jsx)(_Modal.Modal,{open:Me,onClose:Ze,presentation:"fullScreen",bare:!0,backdropPressClose:!1,haptic:!1,animateMount:!1,onInsetsChange:Z,onDismissed:"ios"===_reactNative.Platform.OS?Ue:void 0,children:"android"===_reactNative.Platform.OS?(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:gt.modalRoot,children:Ot}):Ot}):Ot};exports.BottomSheet=BottomSheet;const SheetBody=({style:e,settledKeyboardOffset:t,children:a})=>{const r=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)().bottom,o=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const e=r+t.value;return{paddingBottom:Math.max(e,0)}},[r,t]);return(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[e,o],children:a})};BottomSheet.displayName="BottomSheet";const useMeasuredHeight=()=>{const[e,t]=(0,_react.useState)(0),a=(0,_react.useCallback)(e=>{t(t=>t===e?t:e)},[]);return[e,(0,_react.useCallback)(e=>a(e.nativeEvent.layout.height),[a]),a]},resolveSnapPoints=(e,t,a)=>[...e.map(e=>{if("number"==typeof e)return e;if("content"===e)return a;const r=parseFloat(e);return Number.isNaN(r)?0:r/100*t})].sort((e,t)=>e-t),clamp=(e,t,a)=>Math.min(Math.max(e,t),a),buildStyles=e=>_reactNative.StyleSheet.create({backdropModal:{flex:1},backdropInline:{..._reactNative.StyleSheet.absoluteFill},sheet:{position:"absolute",left:0,right:0,overflow:"hidden"},body:{overflow:"hidden"},handleRow:{alignItems:"center",justifyContent:"center",alignSelf:"stretch",paddingTop:e.space.md,paddingBottom:e.space.xl},header:{},actions:{padding:e.space.lg},footer:{backgroundColor:e.colors.surface},handle:{width:36,height:4,borderRadius:e.radius.pill,..._corners.smoothCorners},content:{flex:1,overflow:"hidden"},scrollContent:{flex:1},modalRoot:{flex:1}});var _default=exports.default=BottomSheet;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveBoxStyle=exports.default=exports.Stack=exports.Spacer=exports.Row=exports.Box=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../theme/index.js"),_scale=require("../../theme/scale.js"),_corners=require("../../utils/corners.js"),_guards=require("../../utils/guards.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_jsxRuntime=require("react/jsx-runtime");const BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],space=(e,r)=>null==r?void 0:(0,_scale.spaceOf)(e,r),resolveBoxStyle=(e,r)=>({...null!=r.p?{padding:space(e,r.p)}:{},...null!=r.px?{paddingHorizontal:space(e,r.px)}:{},...null!=r.py?{paddingVertical:space(e,r.py)}:{},...null!=r.pt?{paddingTop:space(e,r.pt)}:{},...null!=r.pr?{paddingRight:space(e,r.pr)}:{},...null!=r.pb?{paddingBottom:space(e,r.pb)}:{},...null!=r.pl?{paddingLeft:space(e,r.pl)}:{},...null!=r.m?{margin:space(e,r.m)}:{},...null!=r.mx?{marginHorizontal:space(e,r.mx)}:{},...null!=r.my?{marginVertical:space(e,r.my)}:{},...null!=r.mt?{marginTop:space(e,r.mt)}:{},...null!=r.mr?{marginRight:space(e,r.mr)}:{},...null!=r.mb?{marginBottom:space(e,r.mb)}:{},...null!=r.ml?{marginLeft:space(e,r.ml)}:{},...null!=r.gap?{gap:space(e,r.gap)}:{},...null!=r.bg?{backgroundColor:(0,_guards.isOneOf)(BACKGROUND_TOKENS,r.bg)?e.colors[r.bg]:r.bg}:{},...null!=r.radius?{borderRadius:(0,_scale.radiusOf)(e,r.radius),borderCurve:_corners.smoothCorners.borderCurve}:{},...r.border?{borderWidth:e.size.border,borderColor:e.colors.border}:{},...null!=r.flex?{flex:r.flex}:{},...null!=r.align?{alignItems:r.align}:{},...null!=r.justify?{justifyContent:r.justify}:{},...null!=r.direction?{flexDirection:r.direction}:{},...r.wrap?{flexWrap:"wrap"}:{}});exports.resolveBoxStyle=resolveBoxStyle;const Box=exports.Box=(0,_react.forwardRef)((e,r)=>{const t=(0,_index.useTheme)(),{p:l,px:a,py:i,pt:s,pr:o,pb:n,pl:p,m:u,mx:c,my:d,mt:m,mr:x,mb:g,ml:b,gap:f,bg:y,radius:_,border:j,flex:S,align:h,justify:R,direction:v,wrap:w,style:B,children:q,...C}=e,N=resolveBoxStyle(t,{p:l,px:a,py:i,pt:s,pr:o,pb:n,pl:p,m:u,mx:c,my:d,mt:m,mr:x,mb:g,ml:b,gap:f,bg:y,radius:_,border:j,flex:S,align:h,justify:R,direction:v,wrap:w}),k="number"==typeof N.borderRadius?N.borderRadius:0,O="string"==typeof N.backgroundColor?N.backgroundColor:"transparent",z="string"==typeof N.borderColor?N.borderColor:void 0,D="number"==typeof N.borderWidth?N.borderWidth:0,F=(0,_SquircleFill.useSquircle)(null!=_&&(null!=y||Boolean(j)),k,C.onLayout),T=F.active?{...N,backgroundColor:"transparent",borderColor:"transparent"}:N;return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:r,...C,onLayout:F.onLayout,style:[T,B],children:[F.active&&F.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:F.size.width,height:F.size.height,radius:k,fill:O,stroke:z,strokeWidth:D}):null,q]})});Box.displayName="Box";const Stack=exports.Stack=(0,_react.forwardRef)(({gap:e="md",...r},t)=>(0,_jsxRuntime.jsx)(Box,{ref:t,direction:"column",gap:e,...r}));Stack.displayName="Stack";const Row=exports.Row=(0,_react.forwardRef)(({gap:e="sm",align:r="center",...t},l)=>(0,_jsxRuntime.jsx)(Box,{ref:l,direction:"row",gap:e,align:r,...t}));Row.displayName="Row";const Spacer=({size:e,style:r,testID:t})=>{const l=(0,_index.useTheme)();if(null!=e){const a=(0,_scale.spaceOf)(l,e);return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:t,style:[{width:a,height:a},r]})}return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:t,style:[{flex:1},r]})};exports.Spacer=Spacer,Spacer.displayName="Spacer";var _default=exports.default=Box;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Box=Box,exports.Row=Row,exports.Spacer=void 0,exports.Stack=Stack,exports.resolveBoxStyle=exports.default=void 0;var _reactNative=require("react-native"),_index=require("../../theme/index.js"),_scale=require("../../theme/scale.js"),_corners=require("../../utils/corners.js"),_guards=require("../../utils/guards.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_jsxRuntime=require("react/jsx-runtime");const BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],space=(e,r)=>null==r?void 0:(0,_scale.spaceOf)(e,r),resolveBoxStyle=(e,r)=>({...null!=r.p?{padding:space(e,r.p)}:{},...null!=r.px?{paddingHorizontal:space(e,r.px)}:{},...null!=r.py?{paddingVertical:space(e,r.py)}:{},...null!=r.pt?{paddingTop:space(e,r.pt)}:{},...null!=r.pr?{paddingRight:space(e,r.pr)}:{},...null!=r.pb?{paddingBottom:space(e,r.pb)}:{},...null!=r.pl?{paddingLeft:space(e,r.pl)}:{},...null!=r.m?{margin:space(e,r.m)}:{},...null!=r.mx?{marginHorizontal:space(e,r.mx)}:{},...null!=r.my?{marginVertical:space(e,r.my)}:{},...null!=r.mt?{marginTop:space(e,r.mt)}:{},...null!=r.mr?{marginRight:space(e,r.mr)}:{},...null!=r.mb?{marginBottom:space(e,r.mb)}:{},...null!=r.ml?{marginLeft:space(e,r.ml)}:{},...null!=r.gap?{gap:space(e,r.gap)}:{},...null!=r.bg?{backgroundColor:(0,_guards.isOneOf)(BACKGROUND_TOKENS,r.bg)?e.colors[r.bg]:r.bg}:{},...null!=r.radius?{borderRadius:(0,_scale.radiusOf)(e,r.radius),borderCurve:_corners.smoothCorners.borderCurve}:{},...r.border?{borderWidth:e.size.border,borderColor:e.colors.border}:{},...null!=r.flex?{flex:r.flex}:{},...null!=r.align?{alignItems:r.align}:{},...null!=r.justify?{justifyContent:r.justify}:{},...null!=r.direction?{flexDirection:r.direction}:{},...r.wrap?{flexWrap:"wrap"}:{}});function Box(e){const r=(0,_index.useTheme)(),{p:l,px:t,py:i,pt:s,pr:o,pb:a,pl:n,m:u,mx:p,my:c,mt:d,mr:m,mb:x,ml:g,gap:b,bg:f,radius:y,border:_,flex:j,align:h,justify:S,direction:v,wrap:R,style:B,children:w,ref:q,...C}=e,O=resolveBoxStyle(r,{p:l,px:t,py:i,pt:s,pr:o,pb:a,pl:n,m:u,mx:p,my:c,mt:d,mr:m,mb:x,ml:g,gap:b,bg:f,radius:y,border:_,flex:j,align:h,justify:S,direction:v,wrap:R}),k="number"==typeof O.borderRadius?O.borderRadius:0,N="string"==typeof O.backgroundColor?O.backgroundColor:"transparent",z="string"==typeof O.borderColor?O.borderColor:void 0,D="number"==typeof O.borderWidth?O.borderWidth:0,F=(0,_SquircleFill.useSquircle)(null!=y&&(null!=f||Boolean(_)),k,C.onLayout),T=F.active?{...O,backgroundColor:"transparent",borderColor:"transparent"}:O;return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:q,...C,onLayout:F.onLayout,style:[T,B],children:[F.active&&F.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:F.size.width,height:F.size.height,radius:k,fill:N,stroke:z,strokeWidth:D}):null,w]})}function Stack({gap:e="md",ref:r,...l}){return(0,_jsxRuntime.jsx)(Box,{ref:r,direction:"column",gap:e,...l})}function Row({gap:e="sm",align:r="center",ref:l,...t}){return(0,_jsxRuntime.jsx)(Box,{ref:l,direction:"row",gap:e,align:r,...t})}exports.resolveBoxStyle=resolveBoxStyle;const Spacer=({size:e,style:r,testID:l})=>{const t=(0,_index.useTheme)();if(null!=e){const i=(0,_scale.spaceOf)(t,e);return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:l,style:[{width:i,height:i},r]})}return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:l,style:[{flex:1},r]})};exports.Spacer=Spacer,Spacer.displayName="Spacer";var _default=exports.default=Box;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Button=exports.BUTTON_VARIANTS=exports.BUTTON_TONES=void 0,exports.buttonLabelInk=buttonLabelInk,exports.default=void 0,exports.isButtonTone=isButtonTone,exports.isButtonVariant=isButtonVariant;var _react=require("react"),_reactNative=require("react-native"),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_buttonG=require("../../text/phone/button.g.js"),_index2=require("../../theme/index.js"),_animatedValue=require("../../theme/animatedValue.js"),_ariaState=require("../../utils/ariaState.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Spinner/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const BUTTON_VARIANTS=exports.BUTTON_VARIANTS=["solid","soft","outline","ghost","link","glass"],BUTTON_TONES=exports.BUTTON_TONES=["primary","success","warning","danger","info","neutral"];function isButtonVariant(e){return BUTTON_VARIANTS.some(t=>t===e)}function isButtonTone(e){return BUTTON_TONES.some(t=>t===e)}const Button=exports.Button=(0,_react.forwardRef)((e,t)=>{const{label:r,variant:o,tone:s="primary",size:i,loading:n=!1,disabled:a=!1,fullWidth:l=!1,leftIcon:c,rightIcon:d,iconVariant:u,leftIconBadge:b=!1,haptic:g,rounded:_=!1,gradient:p,style:h,wrapperStyle:x,textStyle:m,pressAnimation:f,onPress:v,accessibilityLabel:y,accessibilityHint:T,accessibilityState:S,testID:j,onLayout:I,labels:C,...N}=e;(0,_assertValidValue.assertValidValue)("Button","variant",e.variant,["solid","soft","outline","ghost","link","glass"]),(0,_assertValidValue.assertValidValue)("Button","tone",e.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("Button","size",e.size,["xs","sm","md","lg","xl"]);const R=(0,_index2.useTheme)(),k=R.settings.components.button,V=o??k?.defaultVariant??"solid",w=i??k?.defaultSize??"md",F=(0,_index.useMobileUiText)("button",_buttonG.BUTTON_TEXT),O=(0,_react.useMemo)(()=>({...F,...C}),[F,C]),[B,q]=(0,_react.useState)(!1),L=(0,_react.useRef)(!1),A=n||B,P=!a&&!A,z={...S,disabled:!P,busy:A},U="link"===V,E=f??k?.defaultPressAnimation??(!U&&"scale"),W=(0,_usePressAnimation.usePressAnimation)({preset:E||"scale",enabled:!1!==E&&P}),D=(0,_useFlickGuard.useFlickGuard)(),H=(0,_react.useMemo)(()=>buildStyles(R),[R]),M=(0,_react.useMemo)(()=>(0,_index2.resolveButtonSize)(R,w),[R,w]),G=(0,_react.useMemo)(()=>toneFor(R,s),[R,s]),K=(0,_react.useMemo)(()=>variantFor(R,V,G,a),[R,V,G,a]),X=(0,_react.useMemo)(()=>!p||a||"solid"!==V?null:"string"==typeof p?R.settings.gradients[p]??null:p,[p,a,V,R.settings.gradients]),Y=_reactNative.StyleSheet.flatten(h)?.borderRadius,J=U?0:"number"==typeof Y?Y:_?R.radius.pill:M.radius,Q=(0,_SquircleFill.useSquircle)(!X&&"link"!==V,J,I),Z=(0,_react.useRef)((0,_animatedValue.createAnimatedValue)(0)).current,[$,ee]=(0,_react.useState)(0),[te,re]=(0,_react.useState)(null),oe=U?e=>ee(e.nativeEvent.layout.width):void 0,settlePending=()=>{L.current=!1,q(!1)},se=y??r,ie="outline"===V||"ghost"===V,ne=!ie&&!U,ae={color:K.textColor,size:M.icon,disabled:a},le=b&&!U&&Boolean(c),ce=R.space.xs,de=M["min-height"]-2*ce-2*K.borderWidth,ue={color:K.badgeInk,size:M["badge-icon"],disabled:a},be=A?(0,_jsxRuntime.jsx)(_index3.Spinner,{variant:"circular",size:"sm",color:le?K.badgeInk:K.textColor,accessibilityLabel:O.loading}):c?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(c,le?ue:ae,u)}):null,ge=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.contentRow,children:[le?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"button-icon-badge",style:[H.iconLeft,H.iconBadge,{width:de,height:de,borderRadius:de/2,backgroundColor:K.badgeFill}],children:be}):be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H.iconLeft,children:be}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{onLayout:oe,children:[(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",numberOfLines:1,style:[H.label,{color:K.textColor,fontSize:M.text,lineHeight:Math.round(M.text*R.leading.body)},m],children:r}),U?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",testID:"button-link-underline",style:[H.linkUnderline,{backgroundColor:K.textColor,transform:[{translateX:Z.interpolate({inputRange:[0,1],outputRange:[-$/2,0]})},{scaleX:Z.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}),d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H.iconRight,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(d,ae,u)}):null]}),pe=U?null===te?LINK_HIT_SLOP:Math.max(LINK_HIT_SLOP,touchSlopFor(te)):touchSlopFor(M["min-height"]),he={top:pe,bottom:pe,left:U?LINK_HIT_SLOP:0,right:U?LINK_HIT_SLOP:0};return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[W.style,l?H.fullWidth:null,x],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:t,onPress:e=>{if(!P||L.current||D.isFlick(e))return;W.press();const t=(0,_hapticUtils.resolveHaptic)(g,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t);const r=v?.(e);return r instanceof Promise?(L.current=!0,q(!0),r.then(settlePending,e=>{throw settlePending(),e})):void 0},onPressIn:e=>{D.onPressIn(e),W.pressIn(),U&&P&&(Z.stopAnimation(),Z.setValue(0),_reactNative.Animated.timing(Z,{toValue:1,duration:R.motion.duration.slower,easing:_reactNative.Easing.bezier(...R.motion.ease.decelerate),useNativeDriver:_nativeDriver.nativeDriver}).start())},onPressOut:()=>{W.pressOut()},disabled:!P,hitSlop:he,...(0,_hitSlop.hitSlopMarker)(he),accessibilityRole:"button",accessibilityLabel:se,accessibilityHint:T,accessibilityState:z,...(0,_ariaState.ariaFromState)(z),testID:j,onLayout:e=>{Q.onLayout(e),U&&re(e.nativeEvent.layout.height)},style:({pressed:e})=>[H.base,{paddingHorizontal:U?0:M["padding-x"],paddingVertical:U?0:le?ce:M["padding-y"],paddingLeft:le?ce:void 0,minHeight:U?void 0:M["min-height"],borderRadius:J,..._corners.smoothCorners,backgroundColor:X||Q.active?"transparent":K.backgroundColor,borderWidth:K.borderWidth,borderColor:Q.active?"transparent":K.borderColor,opacity:A?.55:1,overflow:Q.active||U?"visible":"hidden"},e&&ie&&!Q.active?{backgroundColor:R.colors["surface-pressed"]}:null,l?H.fullWidth:null,h],...N,"aria-disabled":!P,"aria-busy":A,children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Q.active&&Q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:Q.size.width,height:Q.size.height,radius:J,fill:e&&ie?R.colors["surface-pressed"]:K.backgroundColor,stroke:K.borderColor,strokeWidth:K.borderWidth}):null,X?(0,_jsxRuntime.jsx)(_index2.Gradient,{gradient:X,style:[_reactNative.StyleSheet.absoluteFill,{borderRadius:J,..._corners.smoothCorners}]}):null,e&&ne?Q.active&&Q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:Q.size.width,height:Q.size.height,radius:J,fill:K.pressedTint,testID:"button-pressed"}):(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[H.pressedOverlay,{borderRadius:J,backgroundColor:K.pressedTint,..._corners.smoothCorners}],testID:"button-pressed"}):null,ge]})})})});Button.displayName="Button";const SOFT_FILL_OPACITY=.14,toneFor=(e,t)=>{switch(t){case"primary":return{base:e.colors.primary,outline:e.colors.primary,on:e.colors["on-primary"],fg:e.colors["primary-text"],soft:(0,_color.tintOf)(e.colors.primary,.14,e.colors["primary-soft"])};case"success":return{base:e.colors.success,outline:e.colors.success,on:e.colors["on-success"],fg:e.colors["success-text"],soft:(0,_color.tintOf)(e.colors.success,.14,e.colors["bg-subtle"])};case"warning":return{base:e.colors.warning,outline:e.colors.warning,on:e.colors["on-warning"],fg:e.colors["warning-text"],soft:(0,_color.tintOf)(e.colors.warning,.14,e.colors["bg-subtle"])};case"danger":return{base:e.colors.danger,outline:e.colors.danger,on:e.colors["on-danger"],fg:e.colors["danger-text"],soft:(0,_color.tintOf)(e.colors.danger,.14,e.colors["bg-subtle"])};case"info":return{base:e.colors.info,outline:e.colors.info,on:e.colors["on-info"],fg:e.colors["info-text"],soft:(0,_color.tintOf)(e.colors.info,.14,e.colors["bg-subtle"])};case"neutral":return{base:e.colors["bg-muted"],outline:e.colors.border,on:e.colors["text-body"],fg:e.colors["text-body"],soft:e.colors["bg-subtle"]}}},BUTTON_BORDER_WIDTH=1,MIN_TOUCH_TARGET=44,LINK_HIT_SLOP=8,touchSlopFor=e=>Math.max(0,Math.ceil((44-e)/2)),variantFor=(e,t,r,o)=>{const s=o?e.colors["text-disabled"]:r.fg,i={badgeFill:e.colors["surface-disabled"],badgeInk:e.colors["text-disabled"]},n=o?i:{badgeFill:r.on,badgeInk:r.base},a=o?i:{badgeFill:r.base,badgeInk:r.on};switch(t){case"solid":return{backgroundColor:o?e.colors["surface-disabled"]:r.base,borderColor:"transparent",borderWidth:1,textColor:o?e.colors["text-disabled"]:r.on,pressedTint:e.colors["surface-pressed"],...n};case"soft":return{backgroundColor:o?e.colors["surface-disabled"]:r.soft,borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"outline":return{backgroundColor:"transparent",borderColor:o?e.colors.border:r.outline,borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"ghost":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"link":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:0,textColor:o?e.colors["text-disabled"]:e.colors.link,pressedTint:e.colors["surface-pressed"],...a};case"glass":return{backgroundColor:e.colors["glass-fill"],borderColor:e.colors["glass-border"],borderWidth:1,textColor:o?e.colors["text-disabled"]:e.colors["on-glass"],pressedTint:_color.ACCENT_PRESSED_TINT,badgeFill:e.colors["glass-badge"],badgeInk:o?e.colors["text-disabled"]:r.base};default:return{backgroundColor:r.base,borderColor:"transparent",borderWidth:1,textColor:r.on,pressedTint:e.colors["surface-pressed"],...n}}};function buttonLabelInk(e,t){return variantFor(t,e.variant??"solid",toneFor(t,e.tone??"primary"),e.disabled??!1).textColor}const buildStyles=e=>_reactNative.StyleSheet.create({pressedOverlay:{position:"absolute",top:0,right:0,bottom:0,left:0},base:{alignItems:"center",justifyContent:"center",flexDirection:"row",overflow:"hidden"},contentRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},linkUnderline:{height:1.5,marginTop:e.size.border},iconLeft:{marginRight:e.space.sm},iconBadge:{alignItems:"center",justifyContent:"center"},iconRight:{marginLeft:e.space.sm},fullWidth:{alignSelf:"stretch"}});var _default=exports.default=Button;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BUTTON_VARIANTS=exports.BUTTON_TONES=void 0,exports.Button=Button,exports.buttonLabelInk=buttonLabelInk,exports.default=void 0,exports.isButtonTone=isButtonTone,exports.isButtonVariant=isButtonVariant;var _react=require("react"),_reactNative=require("react-native"),_useFlickGuard=require("../../hooks/useFlickGuard.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_buttonG=require("../../text/phone/button.g.js"),_index2=require("../../theme/index.js"),_animatedValue=require("../../theme/animatedValue.js"),_ariaState=require("../../utils/ariaState.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Spinner/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const BUTTON_VARIANTS=exports.BUTTON_VARIANTS=["solid","soft","outline","ghost","link","glass"],BUTTON_TONES=exports.BUTTON_TONES=["primary","success","warning","danger","info","neutral"];function isButtonVariant(e){return BUTTON_VARIANTS.some(t=>t===e)}function isButtonTone(e){return BUTTON_TONES.some(t=>t===e)}function Button({ref:e,...t}){const{label:r,variant:o,tone:s="primary",size:i,loading:n=!1,disabled:a=!1,fullWidth:l=!1,leftIcon:c,rightIcon:d,iconVariant:u,leftIconBadge:b=!1,haptic:g,rounded:_=!1,gradient:p,style:h,wrapperStyle:x,textStyle:m,pressAnimation:f,onPress:v,accessibilityLabel:y,accessibilityHint:T,accessibilityState:S,testID:j,onLayout:I,labels:C,...N}=t;(0,_assertValidValue.assertValidValue)("Button","variant",t.variant,["solid","soft","outline","ghost","link","glass"]),(0,_assertValidValue.assertValidValue)("Button","tone",t.tone,["primary","success","warning","danger","info","neutral"]),(0,_assertValidValue.assertValidValue)("Button","size",t.size,["xs","sm","md","lg","xl"]);const R=(0,_index2.useTheme)(),k=R.settings.components.button,V=o??k?.defaultVariant??"solid",w=i??k?.defaultSize??"md",F=(0,_index.useMobileUiText)("button",_buttonG.BUTTON_TEXT),O=(0,_react.useMemo)(()=>({...F,...C}),[F,C]),[q,B]=(0,_react.useState)(!1),L=(0,_react.useRef)(!1),A=n||q,P=!a&&!A,z={...S,disabled:!P,busy:A},U="link"===V,E=f??k?.defaultPressAnimation??(!U&&"scale"),W=(0,_usePressAnimation.usePressAnimation)({preset:E||"scale",enabled:!1!==E&&P}),D=(0,_useFlickGuard.useFlickGuard)(),H=(0,_react.useMemo)(()=>buildStyles(R),[R]),M=(0,_react.useMemo)(()=>(0,_index2.resolveButtonSize)(R,w),[R,w]),G=(0,_react.useMemo)(()=>toneFor(R,s),[R,s]),K=(0,_react.useMemo)(()=>variantFor(R,V,G,a),[R,V,G,a]),X=(0,_react.useMemo)(()=>!p||a||"solid"!==V?null:"string"==typeof p?R.settings.gradients[p]??null:p,[p,a,V,R.settings.gradients]),Y=_reactNative.StyleSheet.flatten(h)?.borderRadius,J=U?0:"number"==typeof Y?Y:_?R.radius.pill:M.radius,Q=(0,_SquircleFill.useSquircle)(!X&&"link"!==V,J,I),Z=(0,_react.useRef)((0,_animatedValue.createAnimatedValue)(0)).current,[$,ee]=(0,_react.useState)(0),[te,re]=(0,_react.useState)(null),oe=U?e=>ee(e.nativeEvent.layout.width):void 0,settlePending=()=>{L.current=!1,B(!1)},se=y??r,ie="outline"===V||"ghost"===V,ne=!ie&&!U,ae={color:K.textColor,size:M.icon,disabled:a},le=b&&!U&&Boolean(c),ce=R.space.xs,de=M["min-height"]-2*ce-2*K.borderWidth,ue={color:K.badgeInk,size:M["badge-icon"],disabled:a},be=A?(0,_jsxRuntime.jsx)(_index3.Spinner,{variant:"circular",size:"sm",color:le?K.badgeInk:K.textColor,accessibilityLabel:O.loading}):c?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(c,le?ue:ae,u)}):null,ge=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:H.contentRow,children:[le?(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"button-icon-badge",style:[H.iconLeft,H.iconBadge,{width:de,height:de,borderRadius:de/2,backgroundColor:K.badgeFill}],children:be}):be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H.iconLeft,children:be}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{onLayout:oe,children:[(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",numberOfLines:1,style:[H.label,{color:K.textColor,fontSize:M.text,lineHeight:Math.round(M.text*R.leading.body)},m],children:r}),U?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"none",testID:"button-link-underline",style:[H.linkUnderline,{backgroundColor:K.textColor,transform:[{translateX:Z.interpolate({inputRange:[0,1],outputRange:[-$/2,0]})},{scaleX:Z.interpolate({inputRange:[0,1],outputRange:[0,1]})}]}]}):null]}),d?(0,_jsxRuntime.jsx)(_reactNative.View,{style:H.iconRight,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(d,ae,u)}):null]}),pe=U?null===te?LINK_HIT_SLOP:Math.max(LINK_HIT_SLOP,touchSlopFor(te)):touchSlopFor(M["min-height"]),he={top:pe,bottom:pe,left:U?LINK_HIT_SLOP:0,right:U?LINK_HIT_SLOP:0};return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[W.style,l?H.fullWidth:null,x],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:e,onPress:e=>{if(!P||L.current||D.isFlick(e))return;W.press();const t=(0,_hapticUtils.resolveHaptic)(g,"impactLight");t&&(0,_hapticUtils.triggerHaptic)(t);const r=v?.(e);return r instanceof Promise?(L.current=!0,B(!0),r.then(settlePending,e=>{throw settlePending(),e})):void 0},onPressIn:e=>{D.onPressIn(e),W.pressIn(),U&&P&&(Z.stopAnimation(),Z.setValue(0),_reactNative.Animated.timing(Z,{toValue:1,duration:R.motion.duration.slower,easing:_reactNative.Easing.bezier(...R.motion.ease.decelerate),useNativeDriver:_nativeDriver.nativeDriver}).start())},onPressOut:()=>{W.pressOut()},disabled:!P,hitSlop:he,...(0,_hitSlop.hitSlopMarker)(he),accessibilityRole:"button",accessibilityLabel:se,accessibilityHint:T,accessibilityState:z,...(0,_ariaState.ariaFromState)(z),testID:j,onLayout:e=>{Q.onLayout(e),U&&re(e.nativeEvent.layout.height)},style:({pressed:e})=>[H.base,{paddingHorizontal:U?0:M["padding-x"],paddingVertical:U?0:le?ce:M["padding-y"],paddingLeft:le?ce:void 0,minHeight:U?void 0:M["min-height"],borderRadius:J,..._corners.smoothCorners,backgroundColor:X||Q.active?"transparent":K.backgroundColor,borderWidth:K.borderWidth,borderColor:Q.active?"transparent":K.borderColor,opacity:A?.55:1,overflow:Q.active||U?"visible":"hidden"},e&&ie&&!Q.active?{backgroundColor:R.colors["surface-pressed"]}:null,l?H.fullWidth:null,h],...N,"aria-disabled":!P,"aria-busy":A,children:({pressed:e})=>(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Q.active&&Q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:Q.size.width,height:Q.size.height,radius:J,fill:e&&ie?R.colors["surface-pressed"]:K.backgroundColor,stroke:K.borderColor,strokeWidth:K.borderWidth}):null,X?(0,_jsxRuntime.jsx)(_index2.Gradient,{gradient:X,style:[_reactNative.StyleSheet.absoluteFill,{borderRadius:J,..._corners.smoothCorners}]}):null,e&&ne?Q.active&&Q.size?(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:Q.size.width,height:Q.size.height,radius:J,fill:K.pressedTint,testID:"button-pressed"}):(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:[H.pressedOverlay,{borderRadius:J,backgroundColor:K.pressedTint,..._corners.smoothCorners}],testID:"button-pressed"}):null,ge]})})})}const SOFT_FILL_OPACITY=.14,toneFor=(e,t)=>{switch(t){case"primary":return{base:e.colors.primary,outline:e.colors.primary,on:e.colors["on-primary"],fg:e.colors["primary-text"],soft:(0,_color.tintOf)(e.colors.primary,.14,e.colors["primary-soft"])};case"success":return{base:e.colors.success,outline:e.colors.success,on:e.colors["on-success"],fg:e.colors["success-text"],soft:(0,_color.tintOf)(e.colors.success,.14,e.colors["bg-subtle"])};case"warning":return{base:e.colors.warning,outline:e.colors.warning,on:e.colors["on-warning"],fg:e.colors["warning-text"],soft:(0,_color.tintOf)(e.colors.warning,.14,e.colors["bg-subtle"])};case"danger":return{base:e.colors.danger,outline:e.colors.danger,on:e.colors["on-danger"],fg:e.colors["danger-text"],soft:(0,_color.tintOf)(e.colors.danger,.14,e.colors["bg-subtle"])};case"info":return{base:e.colors.info,outline:e.colors.info,on:e.colors["on-info"],fg:e.colors["info-text"],soft:(0,_color.tintOf)(e.colors.info,.14,e.colors["bg-subtle"])};case"neutral":return{base:e.colors["bg-muted"],outline:e.colors.border,on:e.colors["text-body"],fg:e.colors["text-body"],soft:e.colors["bg-subtle"]}}},BUTTON_BORDER_WIDTH=1,MIN_TOUCH_TARGET=44,LINK_HIT_SLOP=8,touchSlopFor=e=>Math.max(0,Math.ceil((44-e)/2)),variantFor=(e,t,r,o)=>{const s=o?e.colors["text-disabled"]:r.fg,i={badgeFill:e.colors["surface-disabled"],badgeInk:e.colors["text-disabled"]},n=o?i:{badgeFill:r.on,badgeInk:r.base},a=o?i:{badgeFill:r.base,badgeInk:r.on};switch(t){case"solid":return{backgroundColor:o?e.colors["surface-disabled"]:r.base,borderColor:"transparent",borderWidth:1,textColor:o?e.colors["text-disabled"]:r.on,pressedTint:e.colors["surface-pressed"],...n};case"soft":return{backgroundColor:o?e.colors["surface-disabled"]:r.soft,borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"outline":return{backgroundColor:"transparent",borderColor:o?e.colors.border:r.outline,borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"ghost":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:1,textColor:s,pressedTint:e.colors["surface-pressed"],...a};case"link":return{backgroundColor:"transparent",borderColor:"transparent",borderWidth:0,textColor:o?e.colors["text-disabled"]:e.colors.link,pressedTint:e.colors["surface-pressed"],...a};case"glass":return{backgroundColor:e.colors["glass-fill"],borderColor:e.colors["glass-border"],borderWidth:1,textColor:o?e.colors["text-disabled"]:e.colors["on-glass"],pressedTint:_color.ACCENT_PRESSED_TINT,badgeFill:e.colors["glass-badge"],badgeInk:o?e.colors["text-disabled"]:r.base};default:return{backgroundColor:r.base,borderColor:"transparent",borderWidth:1,textColor:r.on,pressedTint:e.colors["surface-pressed"],...n}}};function buttonLabelInk(e,t){return variantFor(t,e.variant??"solid",toneFor(t,e.tone??"primary"),e.disabled??!1).textColor}const buildStyles=e=>_reactNative.StyleSheet.create({pressedOverlay:{position:"absolute",top:0,right:0,bottom:0,left:0},base:{alignItems:"center",justifyContent:"center",flexDirection:"row",overflow:"hidden"},contentRow:{flexDirection:"row",alignItems:"center",justifyContent:"center"},label:{textAlign:"center",includeFontPadding:!1,textAlignVertical:"center"},linkUnderline:{height:1.5,marginTop:e.size.border},iconLeft:{marginRight:e.space.sm},iconBadge:{alignItems:"center",justifyContent:"center"},iconRight:{marginLeft:e.space.sm},fullWidth:{alignSelf:"stretch"}});var _default=exports.default=Button;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Calendar=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../text/index.js"),_calendarG=require("../../text/phone/calendar.g.js"),_index3=require("../../theme/index.js"),_index4=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_index5=require("../Text/index.js"),_CalendarDay=require("./CalendarDay.js"),_calendarDates=require("./calendarDates.js"),_calendarStyles=require("./calendarStyles.js"),_jsxRuntime=require("react/jsx-runtime");const MAX_DOTS=3,DAY_TEXT_MAX_SCALE=1.5,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"primary":return e.colors.primary;case"neutral":return e.colors["text-muted"]}},Calendar=exports.Calendar=(0,_react.forwardRef)((e,t)=>{const{selectionMode:a="single",value:i,onChange:r,month:n,onMonthChange:s,minDate:l,maxDate:c,disabledDates:o,weekStartsOn:d=0,locale:u="en-IN",marks:_,cellSize:m,haptic:v,accessibilityLabel:x,onTitlePress:h,labels:y,style:g,headerLabelStyle:b,navButtonStyle:p,testID:D}=e;(0,_assertValidValue.assertValidValue)("Calendar","selectionMode",e.selectionMode,["single","range"]);const j=(0,_index2.useMobileUiText)("calendar",_calendarG.CALENDAR_TEXT),M=(0,_react.useMemo)(()=>({...j,...y}),[j,y]),f=M.marked,S=(0,_index3.useTheme)(),N=(0,_index.usePresenceMotion)(),R=(0,_react.useMemo)(()=>(0,_calendarStyles.buildCalendarStyles)(S),[S]),[T,w]=(0,_index.useControllableState)({value:n?(0,_calendarDates.startOfMonth)(n):void 0,defaultValue:(0,_calendarDates.startOfMonth)(i?.start??new Date),onChange:s}),C=12*T.getFullYear()+T.getMonth(),L=i?.start?(0,_calendarDates.startOfDay)(i.start):null,V="range"===a&&i?.end?(0,_calendarDates.startOfDay)(i.end):null,k=L?.getTime()??null,A=V?.getTime()??null,E=(0,_calendarDates.toIso)(new Date),q=l?(0,_calendarDates.startOfDay)(l).getTime():null,I=c?(0,_calendarDates.startOfDay)(c).getTime():null,O=(0,_react.useMemo)(()=>new Set((o??[]).map(e=>(0,_calendarDates.toIso)(e))),[o]),P=(0,_react.useCallback)(e=>null!==q&&e.getTime()<q||null!==I&&e.getTime()>I||O.has((0,_calendarDates.toIso)(e)),[q,I,O]),F=(0,_react.useMemo)(()=>{const e=new Map;for(const t of _??[]){const a=t.date;let i=e.get(a);i||(i={dots:[],spoken:[]},e.set(a,i)),i.dots.length<3&&i.dots.push({key:`${t.tone}-${i.dots.length}`,color:toneColor(S,t.tone)}),i.spoken.push(t.label??f)}return e},[_,S,f]),B=(0,_react.useMemo)(()=>(0,_calendarDates.buildMonthMatrix)(new Date(Math.floor(C/12),C%12,1),d),[C,d]),z=(0,_react.useMemo)(()=>(0,_calendarDates.weekdayLabels)(u,d),[u,d]),X=(0,_react.useMemo)(()=>new Intl.DateTimeFormat(u,{month:"long",year:"numeric"}),[u]),$=(0,_react.useMemo)(()=>new Intl.DateTimeFormat(u,{weekday:"short",day:"numeric",month:"long"}),[u]),H=X.format(T),Z=null===q||(0,_calendarDates.startOfMonth)(new Date(q)).getTime()<T.getTime(),G=null===I||(0,_calendarDates.startOfMonth)(new Date(I)).getTime()>T.getTime(),U=(0,_react.useRef)((0,_index3.createAnimatedValue)(0)).current,Y=(0,_react.useRef)((0,_index3.createAnimatedValue)(1)).current,W=(0,_react.useRef)(null);(0,_react.useEffect)(()=>()=>W.current?.stop(),[]);const J=(0,_react.useCallback)(e=>{!1!==v&&(0,_index4.triggerHaptic)("impactLight");const t=S.motion.duration.fast,a=S.motion.duration.fast,[i]=N.range(32*-e,0),[r]=N.range(32*e,0),n=N.reduced?N.duration("fast"):t,s=N.reduced?N.duration("fast"):a;W.current?.stop(),W.current=_reactNative.Animated.sequence([_reactNative.Animated.parallel([_reactNative.Animated.timing(U,{toValue:i,duration:t,easing:_reactNative.Easing.out(_reactNative.Easing.quad),useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(Y,{toValue:0,duration:n,useNativeDriver:_nativeDriver.nativeDriver})]),_reactNative.Animated.timing(U,{toValue:r,duration:0,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.parallel([_reactNative.Animated.timing(U,{toValue:0,duration:a,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(Y,{toValue:1,duration:s,useNativeDriver:_nativeDriver.nativeDriver})])]),W.current.start();const l=(0,_calendarDates.addMonths)(T,e);w(l),_reactNative.AccessibilityInfo.announceForAccessibility(X.format(l))},[v,T,Y,X,U,N,w,S]),K=(0,_react.useCallback)(()=>J(-1),[J]),Q=(0,_react.useCallback)(()=>J(1),[J]),pressDay=e=>{if(P(e.date))return;const t=(0,_index4.resolveHaptic)(v,"selection");t&&(0,_index4.triggerHaptic)(t);const i=e.date;"single"===a||!L||V||i.getTime()<L.getTime()?r({start:i}):r({start:L,end:i}),e.inMonth||w((0,_calendarDates.startOfMonth)(i))},ee=(0,_react.useRef)(pressDay);(0,_react.useLayoutEffect)(()=>{ee.current=pressDay});const te=(0,_react.useCallback)(e=>ee.current(e),[]),ae=void 0===m?void 0:Math.max(m,_calendarStyles.MIN_CELL_SIZE),ie=(0,_react.useMemo)(()=>void 0===ae?{flex:1}:{width:ae},[ae]),re=(0,_react.useMemo)(()=>void 0===ae?{flex:1,aspectRatio:1,minHeight:_calendarStyles.MIN_CELL_SIZE}:{width:ae,height:ae},[ae]),ne=Math.max(S.space.sm,(_calendarStyles.MIN_CELL_SIZE-_calendarStyles.NAV_BUTTON_SIZE)/2),se=Math.min(S.settings.maxFontSizeMultiplier??1.5,1.5),le=[];for(let e=0;e<_calendarDates.GRID_CELLS;e+=7)le.push(B.slice(e,e+7));const ce=(0,_jsxRuntime.jsx)(_index5.Text,{variant:"title",accessibilityRole:"header",accessibilityLabel:x?`${x}, ${H}`:void 0,style:R.headerLabel,children:H});return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:t,style:[R.root,g],testID:D,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:R.headerRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:K,disabled:!Z,style:({pressed:e})=>[R.navBtn,e&&R.navBtnPressed,!Z&&R.navBtnDisabled,p],accessibilityRole:"button",accessibilityLabel:M.previousMonth,accessibilityState:{disabled:!Z},"aria-disabled":!Z,hitSlop:ne,...(0,_hitSlop.hitSlopMarker)(ne),children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"title",style:R.navText,maxFontSizeMultiplier:se,children:"‹"})}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[R.headerLabelWrap,{opacity:Y,transform:[{translateX:U}]},b],children:h?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:h,accessibilityRole:"button",accessibilityLabel:x?`${x}, ${H}`:H,hitSlop:ne,...(0,_hitSlop.hitSlopMarker)(ne),children:ce}):ce}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Q,disabled:!G,style:({pressed:e})=>[R.navBtn,e&&R.navBtnPressed,!G&&R.navBtnDisabled,p],accessibilityRole:"button",accessibilityLabel:M.nextMonth,accessibilityState:{disabled:!G},"aria-disabled":!G,hitSlop:ne,...(0,_hitSlop.hitSlopMarker)(ne),children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"title",style:R.navText,maxFontSizeMultiplier:se,children:"›"})})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:R.weekdayRow,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:z.map(({weekday:e,label:t})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[R.weekdayCell,ie],children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"caption",style:R.weekdayText,maxFontSizeMultiplier:se,children:t})},e))}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{opacity:Y,transform:[{translateX:U}]},children:le.map(e=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:R.gridRow,children:e.map(e=>{const t=e.date.getTime(),i=null!==k&&t===k,r=null!==A&&t===A,n=null!==k&&null!==A&&t>=k&&t<=A,s=n&&!i&&!r,l=e.iso===E,c=F.get(e.iso),o=[$.format(e.date),...c?.spoken??[]];return l&&o.push(M.today),"range"===a&&(i&&r?o.push(M.startEndRangeLabel):i?o.push(M.startRangeLabel):r?o.push(M.endRangeLabel):s&&o.push(M.inRangeLabel)),(0,_jsxRuntime.jsx)(_CalendarDay.CalendarDay,{cell:e,accessibilityLabel:o.join(", "),disabled:P(e.date),edge:i||r,mid:s,barLeft:n&&(r||s)&&!(i&&r),barRight:n&&(i||s)&&!(i&&r),today:l,dots:c?.dots,cellStyle:re,styles:R,maxFontSizeMultiplier:se,onPressDay:te},e.iso)})},e.map(e=>e.iso).join(",")))})]})});Calendar.displayName="Calendar";var _default=exports.default=Calendar;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Calendar=Calendar,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../hooks/index.js"),_index2=require("../../text/index.js"),_calendarG=require("../../text/phone/calendar.g.js"),_index3=require("../../theme/index.js"),_index4=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_index5=require("../Text/index.js"),_CalendarDay=require("./CalendarDay.js"),_calendarDates=require("./calendarDates.js"),_calendarStyles=require("./calendarStyles.js"),_jsxRuntime=require("react/jsx-runtime");const MAX_DOTS=3,DAY_TEXT_MAX_SCALE=1.5,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"primary":return e.colors.primary;case"neutral":return e.colors["text-muted"]}};function Calendar({ref:e,...t}){const{selectionMode:a="single",value:i,onChange:r,month:n,onMonthChange:s,minDate:l,maxDate:c,disabledDates:o,weekStartsOn:d=0,locale:u="en-IN",marks:_,cellSize:m,haptic:v,accessibilityLabel:x,onTitlePress:h,labels:y,style:D,headerLabelStyle:g,navButtonStyle:b,testID:p}=t;(0,_assertValidValue.assertValidValue)("Calendar","selectionMode",t.selectionMode,["single","range"]);const M=(0,_index2.useMobileUiText)("calendar",_calendarG.CALENDAR_TEXT),j=(0,_react.useMemo)(()=>({...M,...y}),[M,y]),f=j.marked,S=(0,_index3.useTheme)(),T=(0,_index.usePresenceMotion)(),N=(0,_react.useMemo)(()=>(0,_calendarStyles.buildCalendarStyles)(S),[S]),[R,w]=(0,_index.useControllableState)({value:n?(0,_calendarDates.startOfMonth)(n):void 0,defaultValue:(0,_calendarDates.startOfMonth)(i?.start??new Date),onChange:s}),C=12*R.getFullYear()+R.getMonth(),A=i?.start?(0,_calendarDates.startOfDay)(i.start):null,L="range"===a&&i?.end?(0,_calendarDates.startOfDay)(i.end):null,E=A?.getTime()??null,V=L?.getTime()??null,k=(0,_calendarDates.toIso)(new Date),q=l?(0,_calendarDates.startOfDay)(l).getTime():null,I=c?(0,_calendarDates.startOfDay)(c).getTime():null,O=(0,_react.useMemo)(()=>new Set((o??[]).map(e=>(0,_calendarDates.toIso)(e))),[o]),P=(0,_react.useCallback)(e=>null!==q&&e.getTime()<q||null!==I&&e.getTime()>I||O.has((0,_calendarDates.toIso)(e)),[q,I,O]),X=(0,_react.useMemo)(()=>{const e=new Map;for(const t of _??[]){const a=t.date;let i=e.get(a);i||(i={dots:[],spoken:[]},e.set(a,i)),i.dots.length<MAX_DOTS&&i.dots.push({key:`${t.tone}-${i.dots.length}`,color:toneColor(S,t.tone)}),i.spoken.push(t.label??f)}return e},[_,S,f]),F=(0,_react.useMemo)(()=>(0,_calendarDates.buildMonthMatrix)(new Date(Math.floor(C/12),C%12,1),d),[C,d]),B=(0,_react.useMemo)(()=>(0,_calendarDates.weekdayLabels)(u,d),[u,d]),z=(0,_react.useMemo)(()=>new Intl.DateTimeFormat(u,{month:"long",year:"numeric"}),[u]),$=(0,_react.useMemo)(()=>new Intl.DateTimeFormat(u,{weekday:"short",day:"numeric",month:"long"}),[u]),H=z.format(R),Y=null===q||(0,_calendarDates.startOfMonth)(new Date(q)).getTime()<R.getTime(),Z=null===I||(0,_calendarDates.startOfMonth)(new Date(I)).getTime()>R.getTime(),G=(0,_react.useRef)((0,_index3.createAnimatedValue)(0)).current,U=(0,_react.useRef)((0,_index3.createAnimatedValue)(1)).current,W=(0,_react.useRef)(null);(0,_react.useEffect)(()=>()=>W.current?.stop(),[]);const J=(0,_react.useCallback)(e=>{!1!==v&&(0,_index4.triggerHaptic)("impactLight");const t=S.motion.duration.fast,a=S.motion.duration.fast,[i]=T.range(32*-e,0),[r]=T.range(32*e,0),n=T.reduced?T.duration("fast"):t,s=T.reduced?T.duration("fast"):a;W.current?.stop(),W.current=_reactNative.Animated.sequence([_reactNative.Animated.parallel([_reactNative.Animated.timing(G,{toValue:i,duration:t,easing:_reactNative.Easing.out(_reactNative.Easing.quad),useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(U,{toValue:0,duration:n,useNativeDriver:_nativeDriver.nativeDriver})]),_reactNative.Animated.timing(G,{toValue:r,duration:0,useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.parallel([_reactNative.Animated.timing(G,{toValue:0,duration:a,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:_nativeDriver.nativeDriver}),_reactNative.Animated.timing(U,{toValue:1,duration:s,useNativeDriver:_nativeDriver.nativeDriver})])]),W.current.start();const l=(0,_calendarDates.addMonths)(R,e);w(l),_reactNative.AccessibilityInfo.announceForAccessibility(z.format(l))},[v,R,U,z,G,T,w,S]),K=(0,_react.useCallback)(()=>J(-1),[J]),Q=(0,_react.useCallback)(()=>J(1),[J]),pressDay=e=>{if(P(e.date))return;const t=(0,_index4.resolveHaptic)(v,"selection");t&&(0,_index4.triggerHaptic)(t);const i=e.date;"single"===a||!A||L||i.getTime()<A.getTime()?r({start:i}):r({start:A,end:i}),e.inMonth||w((0,_calendarDates.startOfMonth)(i))},ee=(0,_react.useRef)(pressDay);(0,_react.useLayoutEffect)(()=>{ee.current=pressDay});const te=(0,_react.useCallback)(e=>ee.current(e),[]),ae=void 0===m?void 0:Math.max(m,_calendarStyles.MIN_CELL_SIZE),ie=(0,_react.useMemo)(()=>void 0===ae?{flex:1}:{width:ae},[ae]),re=(0,_react.useMemo)(()=>void 0===ae?{flex:1,aspectRatio:1,minHeight:_calendarStyles.MIN_CELL_SIZE}:{width:ae,height:ae},[ae]),ne=Math.max(S.space.sm,(_calendarStyles.MIN_CELL_SIZE-_calendarStyles.NAV_BUTTON_SIZE)/2),se=Math.min(S.settings.maxFontSizeMultiplier??DAY_TEXT_MAX_SCALE,DAY_TEXT_MAX_SCALE),le=[];for(let e=0;e<_calendarDates.GRID_CELLS;e+=7)le.push(F.slice(e,e+7));const ce=(0,_jsxRuntime.jsx)(_index5.Text,{variant:"title",accessibilityRole:"header",accessibilityLabel:x?`${x}, ${H}`:void 0,style:N.headerLabel,children:H});return(0,_jsxRuntime.jsxs)(_reactNative.View,{ref:e,style:[N.root,D],testID:p,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:N.headerRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:K,disabled:!Y,style:({pressed:e})=>[N.navBtn,e&&N.navBtnPressed,!Y&&N.navBtnDisabled,b],accessibilityRole:"button",accessibilityLabel:j.previousMonth,accessibilityState:{disabled:!Y},"aria-disabled":!Y,hitSlop:ne,...(0,_hitSlop.hitSlopMarker)(ne),children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"title",style:N.navText,maxFontSizeMultiplier:se,children:"‹"})}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[N.headerLabelWrap,{opacity:U,transform:[{translateX:G}]},g],children:h?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:h,accessibilityRole:"button",accessibilityLabel:x?`${x}, ${H}`:H,hitSlop:ne,...(0,_hitSlop.hitSlopMarker)(ne),children:ce}):ce}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:Q,disabled:!Z,style:({pressed:e})=>[N.navBtn,e&&N.navBtnPressed,!Z&&N.navBtnDisabled,b],accessibilityRole:"button",accessibilityLabel:j.nextMonth,accessibilityState:{disabled:!Z},"aria-disabled":!Z,hitSlop:ne,...(0,_hitSlop.hitSlopMarker)(ne),children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"title",style:N.navText,maxFontSizeMultiplier:se,children:"›"})})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:N.weekdayRow,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:B.map(({weekday:e,label:t})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:[N.weekdayCell,ie],children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"caption",style:N.weekdayText,maxFontSizeMultiplier:se,children:t})},e))}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:{opacity:U,transform:[{translateX:G}]},children:le.map(e=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:N.gridRow,children:e.map(e=>{const t=e.date.getTime(),i=null!==E&&t===E,r=null!==V&&t===V,n=null!==E&&null!==V&&t>=E&&t<=V,s=n&&!i&&!r,l=e.iso===k,c=X.get(e.iso),o=[$.format(e.date),...c?.spoken??[]];return l&&o.push(j.today),"range"===a&&(i&&r?o.push(j.startEndRangeLabel):i?o.push(j.startRangeLabel):r?o.push(j.endRangeLabel):s&&o.push(j.inRangeLabel)),(0,_jsxRuntime.jsx)(_CalendarDay.CalendarDay,{cell:e,accessibilityLabel:o.join(", "),disabled:P(e.date),edge:i||r,mid:s,barLeft:n&&(r||s)&&!(i&&r),barRight:n&&(i||s)&&!(i&&r),today:l,dots:c?.dots,cellStyle:re,styles:N,maxFontSizeMultiplier:se,onPressDay:te},e.iso)})},e.map(e=>e.iso).join(",")))})]})}var _default=exports.default=Calendar;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Card=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_useControllableState=require("../../hooks/useControllableState.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_cardG=require("../../text/phone/card.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_guards=require("../../utils/guards.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_mergeRefs=require("../../utils/mergeRefs.js"),_shadows=require("../../utils/shadows.js"),_squircle=require("../../utils/squircle.js"),_themeStyles=require("../../utils/themeStyles.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_useContextMenu=require("../Menu/useContextMenu.js"),_index3=require("../Skeleton/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,s,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(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((i=a&&Object.getOwnPropertyDescriptor(e,s))&&(i.get||i.set)?a(r,s,i):r[s]=e[s]);return r}const OUTER_LAYOUT_KEYS=new Set(["flex","flexGrow","flexShrink","flexBasis","alignSelf","width","height","minWidth","maxWidth","minHeight","maxHeight","position","top","right","bottom","left","start","end","zIndex"]),splitOuterLayout=e=>{const t={},i={};for(const[s,a]of Object.entries(_reactNative.StyleSheet.flatten(e)??{}))(OUTER_LAYOUT_KEYS.has(s)||s.startsWith("margin")?t:i)[s]=a;return{outer:t,inner:i}},flexStyleOf=e=>void 0===e?[]:[{flex:e}],BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],paddingMap={none:"none",sm:"sm",md:"lg",lg:"xl",xl:"2xl"},CardRoot=_react.default.memo((0,_react.forwardRef)((e,t)=>{const{children:i,variant:s,elevation:a="card",radius:r,padding:n,interactive:l=!1,pressAnimation:o="scale",bg:d,header:c,title:u,titleFont:x,lead:h,action:m,headerActions:_,collapsible:p=!1,collapsed:g,defaultCollapsed:b=!1,onCollapsedChange:j,collapsedSummary:y,onRemove:f,separatorHeight:v=_reactNative.StyleSheet.hairlineWidth,footer:R,imageSource:S,imageHeight:C=160,imageAspectRatio:w,imageOverlay:V,loading:A=!1,gradient:q,onPress:N,haptic:T,contextMenu:k,accessibilityLabel:F,accessibilityHint:O,accessibilityRole:P,flex:B,style:I,headerStyle:L,bodyStyle:M,footerStyle:H,testID:z,labels:W,onLayout:E,...U}=e;(0,_assertValidValue.assertValidValue)("Card","variant",e.variant,["elevated","outline","filled","flat"]),(0,_assertValidValue.assertValidValue)("Card","radius",e.radius,["sm","md","lg","xl","pill"]),(0,_assertValidValue.assertValidValue)("Card","padding",e.padding,["none","sm","md","lg","xl"]),(0,_assertValidValue.assertValidValue)("Card","titleFont",e.titleFont,["sans","serif"]),(0,_assertValidValue.assertValidValue)("Card","pressAnimation",e.pressAnimation,["scale","bounce","fade","sink","pulse","dim","false"]);const D=(0,_index2.useTheme)(),G=D.settings.components.card,K=s??G?.defaultVariant??"elevated",Y=r??G?.defaultRadius??"lg",X=n??G?.defaultPadding??"md",$=x??G?.defaultTitleFont??"sans",J=(0,_index.useMobileUiText)("card",_cardG.CARD_TEXT),Q=(0,_react.useMemo)(()=>({...J,...W}),[J,W]),Z=l||"function"==typeof N,ee=(0,_useContextMenu.useContextMenu)(k,{haptic:T||!1,testID:z,accessibilityActions:U.accessibilityActions,onAccessibilityAction:U.onAccessibilityAction}),te=(0,_react.useMemo)(()=>(0,_mergeRefs.mergeRefs)(t,ee.hostRef),[t,ee.hostRef]),ie=Z||ee.enabled,{style:se,pressIn:ae,pressOut:re}=(0,_usePressAnimation.usePressAnimation)({preset:o||"scale",enabled:ie&&!1!==o}),ne=stylesFor(D),le=Boolean(S),oe=D.space[paddingMap[X]],de=(0,_react.useMemo)(()=>q?"string"==typeof q?D.settings.gradients[q]??null:q:null,[q,D.settings.gradients]),ce="flat"===K,ue=ce?D.radius.none:D.radius[Y],xe=resolveBackground(D,d),[he,me]=(0,_useControllableState.useControllableState)({value:g,defaultValue:b,onChange:j}),pe=p&&he,ge=hasBuiltInHeaderContent(e),be=Boolean(c)||ge,je=(0,_SquircleFill.useSquircle)(!le&&!de&&!ce,ue,E),ye=_reactNative.StyleSheet.flatten(I)??{},fe="string"==typeof ye.backgroundColor?ye.backgroundColor:void 0,ve="string"==typeof ye.borderColor?ye.borderColor:void 0,Re=fe??xe??("filled"===K?D.colors["bg-subtle"]:D.colors.surface),Se="outline"===K?D.size.border:0,Ce=ve??D.colors.border,we="none"===a?void 0:D.shadow[a],Ve="elevated"===K&&(0,_shadows.supportsBoxShadow)()&&we?(0,_shadows.toBoxShadow)(we):void 0,Ae=je.active&&"elevated"===K&&!Ve,qe=je.active&&!Ae?{backgroundColor:"transparent",borderColor:"transparent"}:null,Ne=(0,_react.useMemo)(()=>{const e={borderRadius:Ae&&je.size?(0,_squircle.squircleHostRadius)(je.size.width,je.size.height,ue):ue,..._corners.smoothCorners,padding:le||je.active?D.space.none:oe,overflow:je.active?"visible":"hidden"};switch(K){case"flat":return{...e,backgroundColor:xe??D.colors.surface,borderBottomWidth:v,borderBottomColor:D.colors.border};case"outline":return{...e,backgroundColor:je.active?"transparent":xe??D.colors.surface,borderWidth:D.size.border,borderColor:je.active?"transparent":D.colors.border};case"filled":return{...e,backgroundColor:je.active?"transparent":xe??D.colors["bg-subtle"]};default:return{...e,backgroundColor:xe??D.colors.surface,...Ve?{boxShadow:Ve}:we}}},[D,K,we,ue,le,oe,je.active,je.size,Ve,Ae,xe,v]),Te=(0,_react.useMemo)(()=>({..."number"==typeof w?{width:"100%",aspectRatio:w}:{width:"100%",height:C},borderTopLeftRadius:ue,borderTopRightRadius:ue,borderBottomLeftRadius:D.radius.none,borderBottomRightRadius:D.radius.none,..._corners.smoothCorners}),[D,ue,w,C]),ke=u??"",Fe=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:ne.titleColumn,children:[u?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"title",accessibilityRole:"header",style:titleFaceFor(D,$),children:u}):null,h?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",style:ne.lead,children:h}):null,pe&&y?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",style:ne.lead,children:y}):null]}),isCardTextAction(m)?(0,_jsxRuntime.jsx)(CardTextActionButton,{action:m,haptic:T}):m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:ne.actionNode,children:m}):null,_,p?(0,_jsxRuntime.jsx)(CardIconAction,{icon:pe?"chevron-down":"chevron-up",label:`${pe?Q.show:Q.hide} ${ke}`.trim(),expanded:!pe,onPress:()=>me(!pe),haptic:T}):null,f?(0,_jsxRuntime.jsx)(CardIconAction,{icon:"trash",label:Q.remove,onPress:f,color:D.colors["danger-text"],haptic:T}):null]}),Oe=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.header,!c&&ne.headerRow,pe&&ne.headerFolded,L],children:c??Fe}):null,pe?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[be||R?ne.body:null,M],children:i}),R&&!pe?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.footer,H],children:R}):null]}),Pe=S?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:ne.imageWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:S,resizeMode:"cover",style:Te,accessibilityLabel:"",accessible:!1}),V?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"box-none",style:ne.imageOverlay,children:V}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{padding:oe},children:Oe})]}):Oe,Be=de?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index2.Gradient,{gradient:de,style:_reactNative.StyleSheet.absoluteFill}),Pe]}):je.active&&je.size?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:je.size.width,height:je.size.height,radius:ue,fill:Re,stroke:Se?Ce:void 0,strokeWidth:Se}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.squircleClip,{padding:oe,borderRadius:je.size?(0,_squircle.squircleHostRadius)(je.size.width,je.size.height,ue):ue}],children:Pe})]}):Pe,{outer:Ie,inner:Le}=splitOuterLayout(I);let Me;if(ie){const handlePress=e=>{Z&&(T&&(0,_hapticUtils.triggerHaptic)(T),N?.(e))};Me=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[se,...flexStyleOf(B),Ie],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:te,onPress:handlePress,onPressIn:ae,onPressOut:re,accessibilityRole:P??(Z?"button":void 0),accessibilityLabel:F,accessibilityHint:O,testID:z,onLayout:je.onLayout,style:[Ne,Le,qe,ne.pressFill],...U,...ee.hostProps,children:Be})})}else Me=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,accessibilityLabel:F,accessibilityHint:O,accessibilityRole:P,testID:z,onLayout:je.onLayout,style:[Ne,...flexStyleOf(B),I,qe],...U,children:Be});return A?(0,_jsxRuntime.jsx)(CardSkeleton,{...e}):ee.enabled?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Me,ee.renderSurface((0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ne,I,qe,ne.preview],children:Be}))]}):Me})),CardSkeleton=({variant:e,elevation:t,radius:i,padding:s,bg:a,header:r,footer:n,imageSource:l,imageHeight:o=160,imageAspectRatio:d,headerStyle:c,bodyStyle:u,footerStyle:x,flex:h,style:m,labels:_,...p})=>{const g=(0,_index2.useTheme)(),b=g.settings.components.card,j=e??b?.defaultVariant??"elevated",y=i??b?.defaultRadius??"lg",f=s??b?.defaultPadding??"md",v={...(0,_index.useMobileUiText)("card",_cardG.CARD_TEXT),..._},R=paddingMap[f],S=g.space[R],C="flat"===j?g.radius.none:g.radius[y],w=void 0!==r||hasBuiltInHeaderContent(p),V=resolveBackground(g,a)??g.colors.surface,A="outline"===j?1:0,q="outline"===j?g.colors.border:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{backgroundColor:V,borderRadius:C,..._corners.smoothCorners,borderWidth:A,borderColor:q,overflow:"hidden"},...flexStyleOf(h),m],accessibilityRole:"progressbar",accessibilityLabel:v.loading,accessibilityState:{busy:!0},"aria-busy":!0,children:[void 0!==l?(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:"100%",height:d?void 0:o,style:d?{aspectRatio:d,width:"100%"}:void 0}):null,w?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingBottom:g.space.sm},c],children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:"text",width:"60%",height:18})}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S},u],children:(0,_jsxRuntime.jsx)(_index3.SkeletonText,{lines:3,fontSize:g.text.base.size,lastLineWidth:"55%"})}),void 0!==n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingTop:g.space.sm,flexDirection:"row"},x],children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:88,height:32,shape:"rounded"})}):null]})};CardSkeleton.displayName="CardSkeleton";const Card=exports.Card=Object.assign(CardRoot,{Skeleton:CardSkeleton});Card.displayName="Card";const hasBuiltInHeaderContent=e=>Boolean(e.title||e.lead||e.action||e.headerActions||e.collapsible||e.onRemove),isCardTextAction=e=>"object"==typeof e&&null!==e&&!_react.default.isValidElement(e)&&"label"in e&&"onPress"in e,HIT_TARGET=44,CardIconAction=({icon:e,label:t,onPress:i,expanded:s,color:a,haptic:r})=>{const n=(0,_index2.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:t,accessibilityState:void 0===s?void 0:{expanded:s},"aria-expanded":s,onPress:()=>{r&&(0,_hapticUtils.triggerHaptic)(r),i()},style:iconActionStyle,children:(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:e,size:20,color:a??n.colors["text-body"]})})})},CardTextActionButton=({action:e,haptic:t})=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,onPress:()=>{t&&(0,_hapticUtils.triggerHaptic)(t),e.onPress()},style:textActionStyle,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",color:"brand",children:e.label})}),iconActionStyle={width:44,height:44,alignItems:"center",justifyContent:"center"},textActionStyle={minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},titleFaceFor=(e,t)=>"serif"===t?(0,_index2.fontFor)(e,"semibold","display"):{fontFamily:void 0,...(0,_index2.fontFor)(e,"semibold")},resolveBackground=(e,t)=>{if(null!=t)return(0,_guards.isOneOf)(BACKGROUND_TOKENS,t)?e.colors[t]:t},buildStyles=e=>_reactNative.StyleSheet.create({header:{marginBottom:e.space.md},headerRow:{flexDirection:"row",alignItems:"center",gap:e.space.sm},headerFolded:{marginBottom:e.space.none},titleColumn:{flex:1},lead:{marginTop:e.space.xs},actionNode:{flexShrink:0},body:{flexShrink:1},footer:{marginTop:e.space.md},imageWrapper:{position:"relative"},imageOverlay:{..._reactNative.StyleSheet.absoluteFill},squircleClip:{overflow:"hidden",..._corners.smoothCorners},pressFill:{flexGrow:1},preview:{margin:e.space.none,marginTop:e.space.none,marginBottom:e.space.none,marginLeft:e.space.none,marginRight:e.space.none,marginStart:e.space.none,marginEnd:e.space.none,marginHorizontal:e.space.none,marginVertical:e.space.none,position:"relative",top:0,left:0,width:"100%",height:"100%"}}),stylesFor=(0,_themeStyles.themeStyles)(buildStyles);var _default=exports.default=Card;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Card=void 0;var cache,_react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_useControllableState=require("../../hooks/useControllableState.js"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_cardG=require("../../text/phone/card.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_guards=require("../../utils/guards.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_mergeRefs=require("../../utils/mergeRefs.js"),_shadows=require("../../utils/shadows.js"),_squircle=require("../../utils/squircle.js"),_themeStyles=require("../../utils/themeStyles.js"),_AppIcon=require("../AppIcon/AppIcon.js"),_useContextMenu=require("../Menu/useContextMenu.js"),_index3=require("../Skeleton/index.js"),_SquircleFill=require("../SquircleFill/SquircleFill.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var i,s,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(s in e)"default"!==s&&{}.hasOwnProperty.call(e,s)&&((i=a&&Object.getOwnPropertyDescriptor(e,s))&&(i.get||i.set)?a(r,s,i):r[s]=e[s]);return r}const OUTER_LAYOUT_KEYS=new Set(["flex","flexGrow","flexShrink","flexBasis","alignSelf","width","height","minWidth","maxWidth","minHeight","maxHeight","position","top","right","bottom","left","start","end","zIndex"]),splitOuterLayout=e=>{const t={},i={};for(const[s,a]of Object.entries(_reactNative.StyleSheet.flatten(e)??{}))(OUTER_LAYOUT_KEYS.has(s)||s.startsWith("margin")?t:i)[s]=a;return{outer:t,inner:i}},flexStyleOf=e=>void 0===e?[]:[{flex:e}],BACKGROUND_TOKENS=["bg","bg-subtle","bg-muted","surface","scrim","surface-inverse","primary-wash"],paddingMap={none:"none",sm:"sm",md:"lg",lg:"xl",xl:"2xl"},CardRoot=_react.default.memo(function CardRoot({ref:e,...t}){const{children:i,variant:s,elevation:a="card",radius:r,padding:n,interactive:l=!1,pressAnimation:o="scale",bg:d,header:c,title:u,titleFont:x,lead:h,action:m,headerActions:_,collapsible:p=!1,collapsed:g,defaultCollapsed:b=!1,onCollapsedChange:j,collapsedSummary:y,onRemove:f,separatorHeight:v=_reactNative.StyleSheet.hairlineWidth,footer:R,imageSource:S,imageHeight:C=160,imageAspectRatio:w,imageOverlay:V,loading:A=!1,gradient:q,onPress:N,haptic:T,contextMenu:k,accessibilityLabel:F,accessibilityHint:O,accessibilityRole:P,flex:B,style:I,headerStyle:L,bodyStyle:M,footerStyle:H,testID:z,labels:W,onLayout:E,...U}=t;(0,_assertValidValue.assertValidValue)("Card","variant",t.variant,["elevated","outline","filled","flat"]),(0,_assertValidValue.assertValidValue)("Card","radius",t.radius,["sm","md","lg","xl","pill"]),(0,_assertValidValue.assertValidValue)("Card","padding",t.padding,["none","sm","md","lg","xl"]),(0,_assertValidValue.assertValidValue)("Card","titleFont",t.titleFont,["sans","serif"]),(0,_assertValidValue.assertValidValue)("Card","pressAnimation",t.pressAnimation,["scale","bounce","fade","sink","pulse","dim","false"]);const D=(0,_index2.useTheme)(),G=D.settings.components.card,K=s??G?.defaultVariant??"elevated",Y=r??G?.defaultRadius??"lg",X=n??G?.defaultPadding??"md",$=x??G?.defaultTitleFont??"sans",J=(0,_index.useMobileUiText)("card",_cardG.CARD_TEXT),Q=(0,_react.useMemo)(()=>({...J,...W}),[J,W]),Z=l||"function"==typeof N,ee=(0,_useContextMenu.useContextMenu)(k,{haptic:T||!1,testID:z,accessibilityActions:U.accessibilityActions,onAccessibilityAction:U.onAccessibilityAction}),te=(0,_react.useMemo)(()=>(0,_mergeRefs.mergeRefs)(e,ee.hostRef),[e,ee.hostRef]),ie=Z||ee.enabled,{style:se,pressIn:ae,pressOut:re}=(0,_usePressAnimation.usePressAnimation)({preset:o||"scale",enabled:ie&&!1!==o}),ne=stylesFor(D),le=Boolean(S),oe=D.space[paddingMap[X]],de=(0,_react.useMemo)(()=>q?"string"==typeof q?D.settings.gradients[q]??null:q:null,[q,D.settings.gradients]),ce="flat"===K,ue=ce?D.radius.none:D.radius[Y],xe=resolveBackground(D,d),[he,me]=(0,_useControllableState.useControllableState)({value:g,defaultValue:b,onChange:j}),pe=p&&he,ge=hasBuiltInHeaderContent(t),be=Boolean(c)||ge,je=(0,_SquircleFill.useSquircle)(!le&&!de&&!ce,ue,E),ye=_reactNative.StyleSheet.flatten(I)??{},fe="string"==typeof ye.backgroundColor?ye.backgroundColor:void 0,ve="string"==typeof ye.borderColor?ye.borderColor:void 0,Re=fe??xe??("filled"===K?D.colors["bg-subtle"]:D.colors.surface),Se="outline"===K?D.size.border:0,Ce=ve??D.colors.border,we="none"===a?void 0:D.shadow[a],Ve="elevated"===K&&(0,_shadows.supportsBoxShadow)()&&we?(0,_shadows.toBoxShadow)(we):void 0,Ae=je.active&&"elevated"===K&&!Ve,qe=je.active&&!Ae?{backgroundColor:"transparent",borderColor:"transparent"}:null,Ne=(0,_react.useMemo)(()=>{const e={borderRadius:Ae&&je.size?(0,_squircle.squircleHostRadius)(je.size.width,je.size.height,ue):ue,..._corners.smoothCorners,padding:le||je.active?D.space.none:oe,overflow:je.active?"visible":"hidden"};switch(K){case"flat":return{...e,backgroundColor:xe??D.colors.surface,borderBottomWidth:v,borderBottomColor:D.colors.border};case"outline":return{...e,backgroundColor:je.active?"transparent":xe??D.colors.surface,borderWidth:D.size.border,borderColor:je.active?"transparent":D.colors.border};case"filled":return{...e,backgroundColor:je.active?"transparent":xe??D.colors["bg-subtle"]};default:return{...e,backgroundColor:xe??D.colors.surface,...Ve?{boxShadow:Ve}:we}}},[D,K,we,ue,le,oe,je.active,je.size,Ve,Ae,xe,v]),Te=(0,_react.useMemo)(()=>({..."number"==typeof w?{width:"100%",aspectRatio:w}:{width:"100%",height:C},borderTopLeftRadius:ue,borderTopRightRadius:ue,borderBottomLeftRadius:D.radius.none,borderBottomRightRadius:D.radius.none,..._corners.smoothCorners}),[D,ue,w,C]),ke=u??"",Fe=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:ne.titleColumn,children:[u?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"title",accessibilityRole:"header",style:titleFaceFor(D,$),children:u}):null,h?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"bodySmall",style:ne.lead,children:h}):null,pe&&y?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",style:ne.lead,children:y}):null]}),isCardTextAction(m)?(0,_jsxRuntime.jsx)(CardTextActionButton,{action:m,haptic:T}):m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:ne.actionNode,children:m}):null,_,p?(0,_jsxRuntime.jsx)(CardIconAction,{icon:pe?"chevron-down":"chevron-up",label:`${pe?Q.show:Q.hide} ${ke}`.trim(),expanded:!pe,onPress:()=>me(!pe),haptic:T}):null,f?(0,_jsxRuntime.jsx)(CardIconAction,{icon:"trash",label:Q.remove,onPress:f,color:D.colors["danger-text"],haptic:T}):null]}),Oe=(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[be?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.header,!c&&ne.headerRow,pe&&ne.headerFolded,L],children:c??Fe}):null,pe?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[be||R?ne.body:null,M],children:i}),R&&!pe?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.footer,H],children:R}):null]}),Pe=S?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:ne.imageWrapper,children:[(0,_jsxRuntime.jsx)(_reactNative.Image,{source:S,resizeMode:"cover",style:Te,accessibilityLabel:"",accessible:!1}),V?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"box-none",style:ne.imageOverlay,children:V}):null]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{padding:oe},children:Oe})]}):Oe,Be=de?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_index2.Gradient,{gradient:de,style:_reactNative.StyleSheet.absoluteFill}),Pe]}):je.active&&je.size?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_SquircleFill.SquircleFill,{width:je.size.width,height:je.size.height,radius:ue,fill:Re,stroke:Se?Ce:void 0,strokeWidth:Se}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[ne.squircleClip,{padding:oe,borderRadius:je.size?(0,_squircle.squircleHostRadius)(je.size.width,je.size.height,ue):ue}],children:Pe})]}):Pe,{outer:Ie,inner:Le}=splitOuterLayout(I);let Me;if(ie){const handlePress=e=>{Z&&(T&&(0,_hapticUtils.triggerHaptic)(T),N?.(e))};Me=(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[se,...flexStyleOf(B),Ie],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:te,onPress:handlePress,onPressIn:ae,onPressOut:re,accessibilityRole:P??(Z?"button":void 0),accessibilityLabel:F,accessibilityHint:O,testID:z,onLayout:je.onLayout,style:[Ne,Le,qe,ne.pressFill],...U,...ee.hostProps,children:Be})})}else Me=(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,accessibilityLabel:F,accessibilityHint:O,accessibilityRole:P,testID:z,onLayout:je.onLayout,style:[Ne,...flexStyleOf(B),I,qe],...U,children:Be});return A?(0,_jsxRuntime.jsx)(CardSkeleton,{...t}):ee.enabled?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[Me,ee.renderSurface((0,_jsxRuntime.jsx)(_reactNative.View,{style:[Ne,I,qe,ne.preview],children:Be}))]}):Me}),CardSkeleton=({variant:e,elevation:t,radius:i,padding:s,bg:a,header:r,footer:n,imageSource:l,imageHeight:o=160,imageAspectRatio:d,headerStyle:c,bodyStyle:u,footerStyle:x,flex:h,style:m,labels:_,...p})=>{const g=(0,_index2.useTheme)(),b=g.settings.components.card,j=e??b?.defaultVariant??"elevated",y=i??b?.defaultRadius??"lg",f=s??b?.defaultPadding??"md",v={...(0,_index.useMobileUiText)("card",_cardG.CARD_TEXT),..._},R=paddingMap[f],S=g.space[R],C="flat"===j?g.radius.none:g.radius[y],w=void 0!==r||hasBuiltInHeaderContent(p),V=resolveBackground(g,a)??g.colors.surface,A="outline"===j?1:0,q="outline"===j?g.colors.border:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{backgroundColor:V,borderRadius:C,..._corners.smoothCorners,borderWidth:A,borderColor:q,overflow:"hidden"},...flexStyleOf(h),m],accessibilityRole:"progressbar",accessibilityLabel:v.loading,accessibilityState:{busy:!0},"aria-busy":!0,children:[void 0!==l?(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:"100%",height:d?void 0:o,style:d?{aspectRatio:d,width:"100%"}:void 0}):null,w?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingBottom:g.space.sm},c],children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{shape:"text",width:"60%",height:18})}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S},u],children:(0,_jsxRuntime.jsx)(_index3.SkeletonText,{lines:3,fontSize:g.text.base.size,lastLineWidth:"55%"})}),void 0!==n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{padding:S,paddingTop:g.space.sm,flexDirection:"row"},x],children:(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:88,height:32,shape:"rounded"})}):null]})};CardSkeleton.displayName="CardSkeleton";const Card=exports.Card=Object.assign(CardRoot,{Skeleton:CardSkeleton});Card.displayName="Card";const hasBuiltInHeaderContent=e=>Boolean(e.title||e.lead||e.action||e.headerActions||e.collapsible||e.onRemove),isCardTextAction=e=>"object"==typeof e&&null!==e&&!_react.default.isValidElement(e)&&"label"in e&&"onPress"in e,HIT_TARGET=44,CardIconAction=({icon:e,label:t,onPress:i,expanded:s,color:a,haptic:r})=>{const n=(0,_index2.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:t,accessibilityState:void 0===s?void 0:{expanded:s},"aria-expanded":s,onPress:()=>{r&&(0,_hapticUtils.triggerHaptic)(r),i()},style:iconActionStyle,children:(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_jsxRuntime.jsx)(_AppIcon.AppIcon,{name:e,size:20,color:a??n.colors["text-body"]})})})},CardTextActionButton=({action:e,haptic:t})=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:e.accessibilityLabel??e.label,onPress:()=>{t&&(0,_hapticUtils.triggerHaptic)(t),e.onPress()},style:textActionStyle,children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"semibold",color:"brand",children:e.label})}),iconActionStyle={width:44,height:44,alignItems:"center",justifyContent:"center"},textActionStyle={minWidth:44,minHeight:44,alignItems:"center",justifyContent:"center"},titleFaceFor=(e,t)=>"serif"===t?(0,_index2.fontFor)(e,"semibold","display"):{fontFamily:void 0,...(0,_index2.fontFor)(e,"semibold")},resolveBackground=(e,t)=>{if(null!=t)return(0,_guards.isOneOf)(BACKGROUND_TOKENS,t)?e.colors[t]:t},buildStyles=e=>_reactNative.StyleSheet.create({header:{marginBottom:e.space.md},headerRow:{flexDirection:"row",alignItems:"center",gap:e.space.sm},headerFolded:{marginBottom:e.space.none},titleColumn:{flex:1},lead:{marginTop:e.space.xs},actionNode:{flexShrink:0},body:{flexShrink:1},footer:{marginTop:e.space.md},imageWrapper:{position:"relative"},imageOverlay:{..._reactNative.StyleSheet.absoluteFill},squircleClip:{overflow:"hidden",..._corners.smoothCorners},pressFill:{flexGrow:1},preview:{margin:e.space.none,marginTop:e.space.none,marginBottom:e.space.none,marginLeft:e.space.none,marginRight:e.space.none,marginStart:e.space.none,marginEnd:e.space.none,marginHorizontal:e.space.none,marginVertical:e.space.none,position:"relative",top:0,left:0,width:"100%",height:"100%"}}),stylesFor=(0,_themeStyles.themeStyles)(buildStyles);var _default=exports.default=Card;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Carousel=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../text/index.js"),_carouselG=require("../../text/phone/carousel.g.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_index4=require("../Skeleton/index.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function CarouselRoot({ref:e,...t}){const{data:n,renderItem:r,keyExtractor:i,index:a,defaultIndex:s=0,onIndexChange:l,onScrollOffsetChange:c,autoPlay:o=!1,autoPlayInterval:u=4e3,loop:d=!1,showPagination:m=!0,paginationStyle:x="dots",itemWidth:h="screen",spacing:_=0,style:b,accessibilityLabel:g,testID:p,showThumbnails:y=!1,haptic:v,renderThumbnail:f,loading:j=!1,labels:S}=t;(0,_assertValidValue.assertValidValue)("Carousel","paginationStyle",t.paginationStyle,["dots","bars","numbers"]);const R=(0,_index.useMobileUiText)("carousel",_carouselG.CAROUSEL_TEXT),T=(0,_react.useMemo)(()=>({...R,...S}),[R,S]),w=(0,_index2.useTheme)(),C=d||o,[k,N]=(0,_react.useState)(()=>_reactNative.Dimensions.get("window").width),I="screen"===h?k:h,V=I+_,E=(0,_react.useRef)(null),A=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,D=clamp("number"==typeof a?a:s,0,Math.max(0,n.length-1)),[M,O]=(0,_react.useState)(D),P=(0,_react.useRef)(null),H=(0,_react.useRef)(null),q=(0,_react.useRef)(!1),z=(0,_react.useRef)(M);z.current=M;const L=(0,_react.useCallback)(e=>{const t=clamp(e,0,Math.max(0,n.length-1));O(e=>e===t?e:(l?.(t),t))},[n.length,l]),W=(0,_react.useCallback)((e,t=!0)=>{if(0===n.length)return;const r=clamp(e,0,n.length-1);E.current?.scrollToOffset({offset:r*V,animated:t}),L(r)},[n.length,V,L]),G=(0,_react.useRef)(W);G.current=W;const $=(0,_react.useCallback)(()=>{if(0===n.length)return;const e=z.current+1;e>=n.length?C&&W(0,!1):W(e,!0)},[n.length,C,W]),F=(0,_react.useCallback)(()=>{if(0===n.length)return;const e=z.current-1;e<0?C&&W(n.length-1,!1):W(e,!0)},[n.length,C,W]);(0,_react.useImperativeHandle)(e,()=>({scrollTo:W,next:$,prev:F}),[W,$,F]),(0,_react.useEffect)(()=>{"number"==typeof a&&a!==z.current&&G.current(a,!0)},[a]);const X=(0,_react.useCallback)(()=>{P.current&&(clearInterval(P.current),P.current=null)},[]),K=(0,_react.useCallback)(()=>{!o||n.length<=1||(X(),P.current=setInterval(()=>{if(q.current)return;const e=z.current+1;e>=n.length?W(0,!1):W(e,!0)},u))},[o,u,n.length,W,X]);(0,_react.useEffect)(()=>(K(),()=>{X(),H.current&&clearTimeout(H.current)}),[K,X]),(0,_react.useEffect)(()=>{const e=_reactNative.AppState.addEventListener("change",e=>{"active"!==e?(X(),H.current&&(clearTimeout(H.current),H.current=null)):K()});return()=>e.remove()},[K,X]);const U=m&&n.length>1&&"numbers"!==x||void 0!==c,B=(0,_react.useMemo)(()=>_reactNative.Animated.event([{nativeEvent:{contentOffset:{x:A}}}],{useNativeDriver:!1,listener:c?e=>c(e.nativeEvent.contentOffset.x):void 0}),[A,c]),J=(0,_react.useCallback)(e=>{if(V<=0)return;const t=e.nativeEvent.contentOffset.x,n=Math.round(t/V);L(n)},[V,L]),Q=(0,_react.useCallback)(()=>{q.current=!0,X(),H.current&&(clearTimeout(H.current),H.current=null)},[X]),Y=(0,_react.useCallback)(()=>{q.current=!1,o&&(H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{K()},1e3))},[o,K]),Z=(0,_react.useCallback)(e=>{switch(e.nativeEvent.actionName){case"increment":$();break;case"decrement":F()}},[$,F]),ee=(0,_react.useMemo)(()=>buildStyles(w),[w]),te=(0,_react.useCallback)(({item:e,index:t})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:I,marginRight:t===n.length-1?0:_},accessibilityElementsHidden:t!==M,importantForAccessibility:t===M?"yes":"no-hide-descendants",children:r(e,t)}),[r,I,_,n.length,M]),ne=(0,_react.useCallback)((e,t)=>String(t),[]),re=(0,_react.useCallback)((e,t)=>({length:V,offset:V*t,index:t}),[V]);return j?(0,_jsxRuntime.jsx)(CarouselSkeleton,{...t,containerWidth:k}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[ee.container,b],onLayout:e=>N(e.nativeEvent.layout.width),accessibilityRole:"adjustable",accessibilityLabel:g??T.carousel,accessibilityValue:{min:0,max:Math.max(0,n.length-1),now:M,text:(0,_index.fillText)(T.slideOf,{index:M+1,count:n.length})},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:Z,testID:p,children:[(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:E,testID:p?`${p}-list`:void 0,data:n,keyExtractor:i??ne,renderItem:te,horizontal:!0,pagingEnabled:"screen"===h&&0===_,snapToInterval:V,snapToAlignment:"start",decelerationRate:"fast",showsHorizontalScrollIndicator:!1,onScroll:U?B:void 0,scrollEventThrottle:U?16:void 0,onMomentumScrollEnd:J,onScrollBeginDrag:Q,onScrollEndDrag:Y,getItemLayout:re,initialScrollIndex:D,bounces:!1}),m&&n.length>1?(0,_jsxRuntime.jsx)(Pagination,{count:n.length,currentIndex:M,scrollX:A,slideStride:V,variant:x,theme:w,labels:T}):null,y&&n.length>0?(0,_jsxRuntime.jsx)(ThumbnailStrip,{data:n,currentIndex:M,renderThumbnail:f,labels:T,onSelect:e=>{const t=(0,_index3.resolveHaptic)(v,"selection");t&&(0,_index3.triggerHaptic)(t),W(e,!0)},theme:w}):null]})}CarouselRoot.displayName="Carousel";const CarouselSkeleton=({itemWidth:e="screen",showPagination:t=!0,paginationStyle:n="dots",style:r,containerWidth:i})=>{const a=(0,_index2.useTheme)(),s="screen"===e?i||320:e;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[carouselSkeletonStyles.container,r],children:[(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:s,height:160,radius:"md"}),t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[carouselSkeletonStyles.paginationRow,{marginTop:a.space.md}],children:SKELETON_PAGINATION_DOTS.map(e=>"numbers"===n?(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:24,height:16,radius:"sm",style:{marginHorizontal:a.space.xs}},e):"bars"===n?(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:20,height:4,radius:"pill",style:{marginHorizontal:a.space.xxs}},e):(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"circle",width:8,height:8,style:{marginHorizontal:a.space.xs}},e))}):null]})};CarouselSkeleton.displayName="CarouselSkeleton";const SKELETON_PAGINATION_DOTS=["first","second","third"],carouselSkeletonStyles=_reactNative.StyleSheet.create({container:{alignItems:"center"},paginationRow:{flexDirection:"row",justifyContent:"center"}}),Carousel=exports.Carousel=Object.assign(CarouselRoot,{Skeleton:CarouselSkeleton}),Pagination=({count:e,currentIndex:t,scrollX:n,slideStride:r,variant:i,theme:a,labels:s})=>{const l=(0,_react.useMemo)(()=>buildPaginationStyles(a),[a]);if("numbers"===i)return(0,_jsxRuntime.jsx)(_reactNative.View,{style:l.numbersWrap,children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"bodySmall",weight:"medium",color:"secondary",style:l.numbersText,accessibilityLabel:(0,_index.fillText)(s.slideOf,{index:t+1,count:e}),children:`${t+1} / ${e}`})});const c=Array.from({length:e},(e,t)=>t),o="bars"===i,u=o?24:6,d=o?36:16,m=o?3:6;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:l.dotRow,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:c.map(e=>{const i=[(e-1)*r,e*r,(e+1)*r],s=n.interpolate({inputRange:i,outputRange:[u,d,u],extrapolate:"clamp"}),l=n.interpolate({inputRange:i,outputRange:[.5,1,.5],extrapolate:"clamp"});return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[{width:s,height:m,marginHorizontal:a.space.xs,borderRadius:a.radius.pill,..._corners.smoothCorners,backgroundColor:e===t?a.colors.primary:a.colors.border,opacity:l}]},e)})})};function ThumbnailStrip({data:e,currentIndex:t,renderThumbnail:n,onSelect:r,theme:i,labels:a}){const s=(0,_react.useMemo)(()=>buildThumbStyles(i),[i]),l=(0,_react.useMemo)(()=>e.map((e,t)=>({key:`thumb-${t}`,item:e,index:t})),[e]);return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:s.row,accessibilityRole:"tablist",children:l.map(({key:e,item:l,index:c})=>(0,_jsxRuntime.jsx)(ThumbnailItem,{item:l,index:c,isActive:c===t,renderThumbnail:n,onPress:()=>r(c),theme:i,styles:s,labels:a},e))})}function ThumbnailItem({item:e,index:t,isActive:n,renderThumbnail:r,onPress:i,theme:a,styles:s,labels:l}){const c=(0,_react.useRef)((0,_index2.createAnimatedValue)(n?1.1:1)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.spring(c,{toValue:n?1.1:1,useNativeDriver:_nativeDriver.nativeDriver,friction:6,tension:80});return e.start(),()=>e.stop()},[n,c]);const o=(0,_react.useMemo)(()=>r?r(e,t):e&&"object"==typeof e&&"uri"in e&&"string"==typeof e.uri?(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:e.uri},style:s.image,resizeMode:"cover"}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[s.placeholder,{backgroundColor:a.colors["bg-subtle"]}],children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"caption",weight:"semibold",color:"secondary",children:t+1})}),[e,t,r,a,s]);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:i,accessibilityRole:"tab",accessibilityState:{selected:n},"aria-selected":n,accessibilityLabel:(0,_index.fillText)(l.goToSlide,{index:t+1}),children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[s.thumb,{borderColor:n?a.colors.primary:"transparent",transform:[{scale:c}]}],children:o})})}const buildThumbStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.sm,paddingVertical:e.space.sm},thumb:{width:40,height:40,marginHorizontal:e.space.xs,borderRadius:e.radius.sm,..._corners.smoothCorners,borderWidth:2,overflow:"hidden"},image:{width:"100%",height:"100%"},placeholder:{flex:1,alignItems:"center",justifyContent:"center"}}),clamp=(e,t,n)=>Math.min(Math.max(e,t),n),buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"}}),buildPaginationStyles=e=>_reactNative.StyleSheet.create({dotRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:e.space.md},numbersWrap:{alignItems:"center",justifyContent:"center",paddingVertical:e.space.md},numbersText:{textAlign:"center"}});var _default=exports.default=Carousel;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Carousel=void 0;var _react=require("react"),_reactNative=require("react-native"),_index=require("../../text/index.js"),_carouselG=require("../../text/phone/carousel.g.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_corners=require("../../utils/corners.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_index4=require("../Skeleton/index.js"),_index5=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");function CarouselRoot({ref:e,...t}){const{data:n,renderItem:r,keyExtractor:i,index:a,defaultIndex:s=0,onIndexChange:l,onScrollOffsetChange:c,autoPlay:o=!1,autoPlayInterval:u=4e3,loop:d=!1,showPagination:m=!0,paginationStyle:x="dots",itemWidth:h="screen",spacing:_=0,style:b,accessibilityLabel:g,testID:p,showThumbnails:y=!1,haptic:v,renderThumbnail:f,loading:j=!1,labels:S}=t;(0,_assertValidValue.assertValidValue)("Carousel","paginationStyle",t.paginationStyle,["dots","bars","numbers"]);const R=(0,_index.useMobileUiText)("carousel",_carouselG.CAROUSEL_TEXT),T=(0,_react.useMemo)(()=>({...R,...S}),[R,S]),w=(0,_index2.useTheme)(),C=d||o,{width:k}=(0,_reactNative.useWindowDimensions)(),[N,I]=(0,_react.useState)(null),V=N??k,E="screen"===h?V:h,A=E+_,D=(0,_react.useRef)(null),M=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,O=clamp("number"==typeof a?a:s,0,Math.max(0,n.length-1)),[P,H]=(0,_react.useState)(O),q=(0,_react.useRef)(null),z=(0,_react.useRef)(null),L=(0,_react.useRef)(!1),W=(0,_react.useRef)(P);W.current=P;const G=(0,_react.useCallback)(e=>{const t=clamp(e,0,Math.max(0,n.length-1));H(e=>e===t?e:(l?.(t),t))},[n.length,l]),$=(0,_react.useCallback)((e,t=!0)=>{if(0===n.length)return;const r=clamp(e,0,n.length-1);D.current?.scrollToOffset({offset:r*A,animated:t}),G(r)},[n.length,A,G]),F=(0,_react.useRef)($);F.current=$;const X=(0,_react.useCallback)(()=>{if(0===n.length)return;const e=W.current+1;e>=n.length?C&&$(0,!1):$(e,!0)},[n.length,C,$]),K=(0,_react.useCallback)(()=>{if(0===n.length)return;const e=W.current-1;e<0?C&&$(n.length-1,!1):$(e,!0)},[n.length,C,$]);(0,_react.useImperativeHandle)(e,()=>({scrollTo:$,next:X,prev:K}),[$,X,K]),(0,_react.useEffect)(()=>{"number"==typeof a&&a!==W.current&&F.current(a,!0)},[a]);const U=(0,_react.useCallback)(()=>{q.current&&(clearInterval(q.current),q.current=null)},[]),B=(0,_react.useCallback)(()=>{!o||n.length<=1||(U(),q.current=setInterval(()=>{if(L.current)return;const e=W.current+1;e>=n.length?$(0,!1):$(e,!0)},u))},[o,u,n.length,$,U]);(0,_react.useEffect)(()=>(B(),()=>{U(),z.current&&clearTimeout(z.current)}),[B,U]),(0,_react.useEffect)(()=>{const e=_reactNative.AppState.addEventListener("change",e=>{"active"!==e?(U(),z.current&&(clearTimeout(z.current),z.current=null)):B()});return()=>e.remove()},[B,U]);const J=m&&n.length>1&&"numbers"!==x||void 0!==c,Q=(0,_react.useMemo)(()=>_reactNative.Animated.event([{nativeEvent:{contentOffset:{x:M}}}],{useNativeDriver:!1,listener:c?e=>c(e.nativeEvent.contentOffset.x):void 0}),[M,c]),Y=(0,_react.useCallback)(e=>{if(A<=0)return;const t=e.nativeEvent.contentOffset.x,n=Math.round(t/A);G(n)},[A,G]),Z=(0,_react.useCallback)(()=>{L.current=!0,U(),z.current&&(clearTimeout(z.current),z.current=null)},[U]),ee=(0,_react.useCallback)(()=>{L.current=!1,o&&(z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{B()},1e3))},[o,B]),te=(0,_react.useCallback)(e=>{switch(e.nativeEvent.actionName){case"increment":X();break;case"decrement":K()}},[X,K]),ne=(0,_react.useMemo)(()=>buildStyles(w),[w]),re=(0,_react.useCallback)(({item:e,index:t})=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:E,marginRight:t===n.length-1?0:_},accessibilityElementsHidden:t!==P,importantForAccessibility:t===P?"yes":"no-hide-descendants",children:r(e,t)}),[r,E,_,n.length,P]),ie=(0,_react.useCallback)((e,t)=>String(t),[]),ae=(0,_react.useCallback)((e,t)=>({length:A,offset:A*t,index:t}),[A]);return j?(0,_jsxRuntime.jsx)(CarouselSkeleton,{...t,containerWidth:V}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[ne.container,b],onLayout:e=>I(e.nativeEvent.layout.width),accessibilityRole:"adjustable",accessibilityLabel:g??T.carousel,accessibilityValue:{min:0,max:Math.max(0,n.length-1),now:P,text:(0,_index.fillText)(T.slideOf,{index:P+1,count:n.length})},accessibilityActions:[{name:"increment"},{name:"decrement"}],onAccessibilityAction:te,testID:p,children:[(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:D,testID:p?`${p}-list`:void 0,data:n,keyExtractor:i??ie,renderItem:re,horizontal:!0,pagingEnabled:"screen"===h&&0===_,snapToInterval:A,snapToAlignment:"start",decelerationRate:"fast",showsHorizontalScrollIndicator:!1,onScroll:J?Q:void 0,scrollEventThrottle:J?16:void 0,onMomentumScrollEnd:Y,onScrollBeginDrag:Z,onScrollEndDrag:ee,getItemLayout:ae,initialScrollIndex:O,bounces:!1}),m&&n.length>1?(0,_jsxRuntime.jsx)(Pagination,{count:n.length,currentIndex:P,scrollX:M,slideStride:A,variant:x,theme:w,labels:T}):null,y&&n.length>0?(0,_jsxRuntime.jsx)(ThumbnailStrip,{data:n,currentIndex:P,renderThumbnail:f,labels:T,onSelect:e=>{const t=(0,_index3.resolveHaptic)(v,"selection");t&&(0,_index3.triggerHaptic)(t),$(e,!0)},theme:w}):null]})}CarouselRoot.displayName="Carousel";const CarouselSkeleton=({itemWidth:e="screen",showPagination:t=!0,paginationStyle:n="dots",style:r,containerWidth:i})=>{const a=(0,_index2.useTheme)(),s="screen"===e?i||320:e;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[carouselSkeletonStyles.container,r],children:[(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:s,height:160,radius:"md"}),t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[carouselSkeletonStyles.paginationRow,{marginTop:a.space.md}],children:SKELETON_PAGINATION_DOTS.map(e=>"numbers"===n?(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:24,height:16,radius:"sm",style:{marginHorizontal:a.space.xs}},e):"bars"===n?(0,_jsxRuntime.jsx)(_index4.Skeleton,{width:20,height:4,radius:"pill",style:{marginHorizontal:a.space.xxs}},e):(0,_jsxRuntime.jsx)(_index4.Skeleton,{shape:"circle",width:8,height:8,style:{marginHorizontal:a.space.xs}},e))}):null]})};CarouselSkeleton.displayName="CarouselSkeleton";const SKELETON_PAGINATION_DOTS=["first","second","third"],carouselSkeletonStyles=_reactNative.StyleSheet.create({container:{alignItems:"center"},paginationRow:{flexDirection:"row",justifyContent:"center"}}),Carousel=exports.Carousel=Object.assign(CarouselRoot,{Skeleton:CarouselSkeleton}),Pagination=({count:e,currentIndex:t,scrollX:n,slideStride:r,variant:i,theme:a,labels:s})=>{const l=(0,_react.useMemo)(()=>buildPaginationStyles(a),[a]);if("numbers"===i)return(0,_jsxRuntime.jsx)(_reactNative.View,{style:l.numbersWrap,children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"bodySmall",weight:"medium",color:"secondary",style:l.numbersText,accessibilityLabel:(0,_index.fillText)(s.slideOf,{index:t+1,count:e}),children:`${t+1} / ${e}`})});const c=Array.from({length:e},(e,t)=>t),o="bars"===i,u=o?24:6,d=o?36:16,m=o?3:6;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:l.dotRow,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:c.map(e=>{const i=[(e-1)*r,e*r,(e+1)*r],s=n.interpolate({inputRange:i,outputRange:[u,d,u],extrapolate:"clamp"}),l=n.interpolate({inputRange:i,outputRange:[.5,1,.5],extrapolate:"clamp"});return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[{width:s,height:m,marginHorizontal:a.space.xs,borderRadius:a.radius.pill,..._corners.smoothCorners,backgroundColor:e===t?a.colors.primary:a.colors.border,opacity:l}]},e)})})};function ThumbnailStrip({data:e,currentIndex:t,renderThumbnail:n,onSelect:r,theme:i,labels:a}){const s=(0,_react.useMemo)(()=>buildThumbStyles(i),[i]),l=(0,_react.useMemo)(()=>e.map((e,t)=>({key:`thumb-${t}`,item:e,index:t})),[e]);return(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:s.row,accessibilityRole:"tablist",children:l.map(({key:e,item:l,index:c})=>(0,_jsxRuntime.jsx)(ThumbnailItem,{item:l,index:c,isActive:c===t,renderThumbnail:n,onPress:()=>r(c),theme:i,styles:s,labels:a},e))})}function ThumbnailItem({item:e,index:t,isActive:n,renderThumbnail:r,onPress:i,theme:a,styles:s,labels:l}){const c=(0,_react.useRef)((0,_index2.createAnimatedValue)(n?1.1:1)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.spring(c,{toValue:n?1.1:1,useNativeDriver:_nativeDriver.nativeDriver,friction:6,tension:80});return e.start(),()=>e.stop()},[n,c]);const o=(0,_react.useMemo)(()=>r?r(e,t):e&&"object"==typeof e&&"uri"in e&&"string"==typeof e.uri?(0,_jsxRuntime.jsx)(_reactNative.Image,{source:{uri:e.uri},style:s.image,resizeMode:"cover"}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:[s.placeholder,{backgroundColor:a.colors["bg-subtle"]}],children:(0,_jsxRuntime.jsx)(_index5.Text,{variant:"caption",weight:"semibold",color:"secondary",children:t+1})}),[e,t,r,a,s]);return(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:i,accessibilityRole:"tab",accessibilityState:{selected:n},"aria-selected":n,accessibilityLabel:(0,_index.fillText)(l.goToSlide,{index:t+1}),children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[s.thumb,{borderColor:n?a.colors.primary:"transparent",transform:[{scale:c}]}],children:o})})}const buildThumbStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center",paddingHorizontal:e.space.sm,paddingVertical:e.space.sm},thumb:{width:40,height:40,marginHorizontal:e.space.xs,borderRadius:e.radius.sm,..._corners.smoothCorners,borderWidth:2,overflow:"hidden"},image:{width:"100%",height:"100%"},placeholder:{flex:1,alignItems:"center",justifyContent:"center"}}),clamp=(e,t,n)=>Math.min(Math.max(e,t),n),buildStyles=e=>_reactNative.StyleSheet.create({container:{width:"100%"}}),buildPaginationStyles=e=>_reactNative.StyleSheet.create({dotRow:{flexDirection:"row",alignItems:"center",justifyContent:"center",paddingVertical:e.space.md},numbersWrap:{alignItems:"center",justifyContent:"center",paddingVertical:e.space.md},numbersText:{textAlign:"center"}});var _default=exports.default=Carousel;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Checkbox=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"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_ChoiceText=require("../FieldBase/ChoiceText.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;var t,i,s=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(i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((t=s&&Object.getOwnPropertyDescriptor(e,i))&&(t.get||t.set)?s(a,i,t):a[i]=e[i]);return a}const CHECKBOX_SHAPES=["circle"],toneColor=(e,r)=>{switch(r){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.neutral;default:return e.colors.primary}},toneOnColor=(e,r)=>{switch(r){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"];case"neutral":return e.colors["on-neutral"];default:return e.colors["on-primary"]}},Checkbox=exports.Checkbox=(0,_react.forwardRef)((e,r)=>{const{checked:t,defaultChecked:i,onChange:s,indeterminate:a=!1,disabled:o=!1,label:n,helperText:l,description:c,error:d,help:u,size:h="md",tone:p="primary",shape:x,accessibilityLabel:_,haptic:b,style:f,boxStyle:m,indeterminateBarStyle:g,labelStyle:y,testID:v,hitSlop:C,...j}=e,[w,S]=(0,_index.useControllableState)({value:t,defaultValue:i??!1,onChange:s}),k=(0,_index2.useTheme)(),V=(0,_react.useMemo)(()=>buildStyles(k),[k]),{"box-size":R}=(0,_react.useMemo)(()=>(0,_index2.resolveCheckboxSize)(k,h),[k,h]),T=k.size.border,q=(0,_index2.spaceOf)(k,k.components.checkbox["label-gap"]),B=toneColor(k,p),N=C??6;(0,_assertValidValue.assertValidValue)("Checkbox","shape",x,CHECKBOX_SHAPES),(0,_assertValidValue.assertValidValue)("Checkbox","size",e.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("Checkbox","tone",e.tone,["primary","success","warning","danger","info","neutral"]);const F="circle"===x,D="string"==typeof d?d:void 0,M={description:c,helperText:l,error:D},O=w||a,P=(0,_react.useRef)((0,_index2.createAnimatedValue)(O?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.spring(P,{toValue:O?1:0,damping:k.motion.spring.snappy.damping,stiffness:k.motion.spring.snappy.stiffness,mass:k.motion.spring.snappy.mass,useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[O,P,k.motion.spring.snappy]);const A=P.interpolate({inputRange:[0,1],outputRange:[0,1]}),H=_??(0,_FieldBase.fieldTextAsString)(n),W=!0===d||(0,_FieldBase.hasFieldText)(d),I=O?B:o?k.colors.border:W?k.colors["field-border-error"]:k.colors.border,L=O?B:o?k.colors["surface-disabled"]:"transparent",z=o&&!O?k.colors["text-disabled"]:toneOnColor(k,p),E=Math.round(.72*R),U=Math.round(.55*R),K=Math.max(2,Math.round(.12*R)),X=(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:r,onPress:e=>{if(o)return;const r=(0,_hapticUtils.resolveHaptic)(b,"selection");r&&(0,_hapticUtils.triggerHaptic)(r),S(!w),j.onPressOut?.(e)},disabled:o,accessibilityRole:"checkbox",accessibilityLabel:H,accessibilityHint:j.accessibilityHint??(0,_FieldBase.fieldTextAsString)(l)??(0,_FieldBase.fieldTextAsString)(c),accessibilityState:{checked:a?"mixed":w,disabled:o},"aria-checked":a?"mixed":w,"aria-disabled":o,testID:v,hitSlop:N,...(0,_hitSlop.hitSlopMarker)(N),...j,style:({pressed:e})=>[V.row,(0,_ChoiceText.hasChoiceDetail)(M)?V.rowTop:null,(0,_FieldBase.hasFieldText)(u)?V.rowShrink:null,{opacity:o?.55:e?.85:1},f],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.box,{width:R,height:R,borderWidth:T,borderRadius:F?R/2:k.radius.sm,...F?{}:_corners.smoothCorners,borderColor:I,backgroundColor:L},m],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[V.glyphWrap,{opacity:P,transform:[{scale:A}]}],children:a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{width:U,height:K,borderRadius:k.radius.pill,..._corners.smoothCorners,backgroundColor:z},g]}):(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:E,height:E,viewBox:"0 0 24 24",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:z,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})})}),(0,_jsxRuntime.jsx)(_ChoiceText.ChoiceText,{label:n,helperText:l,description:c,error:D,disabled:o,style:{marginLeft:q},labelStyle:y})]});return(0,_FieldBase.hasFieldText)(u)?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[V.helpRow,(0,_ChoiceText.hasChoiceDetail)(M)?V.rowTop:null],children:[X,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.help,{marginLeft:k.space.xs}],children:u})]}):X});Checkbox.displayName="Checkbox";const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},rowTop:{alignItems:"flex-start"},rowShrink:{flexShrink:1},helpRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0},box:{alignItems:"center",justifyContent:"center"},glyphWrap:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=Checkbox;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Checkbox=Checkbox,exports.default=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"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_nativeDriver=require("../../utils/nativeDriver.js"),_ChoiceText=require("../FieldBase/ChoiceText.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;var t,i,s=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(i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((t=s&&Object.getOwnPropertyDescriptor(e,i))&&(t.get||t.set)?s(a,i,t):a[i]=e[i]);return a}const CHECKBOX_SHAPES=["circle"],toneColor=(e,r)=>{switch(r){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.neutral;default:return e.colors.primary}},toneOnColor=(e,r)=>{switch(r){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"];case"neutral":return e.colors["on-neutral"];default:return e.colors["on-primary"]}};function Checkbox({ref:e,...r}){const{checked:t,defaultChecked:i,onChange:s,indeterminate:a=!1,disabled:o=!1,label:n,helperText:l,description:c,error:d,help:u,size:h="md",tone:p="primary",shape:x,accessibilityLabel:_,haptic:f,style:b,boxStyle:g,indeterminateBarStyle:m,labelStyle:y,testID:v,hitSlop:j,...C}=r,[S,w]=(0,_index.useControllableState)({value:t,defaultValue:i??!1,onChange:s}),k=(0,_index2.useTheme)(),V=(0,_react.useMemo)(()=>buildStyles(k),[k]),{"box-size":R}=(0,_react.useMemo)(()=>(0,_index2.resolveCheckboxSize)(k,h),[k,h]),T=k.size.border,q=(0,_index2.spaceOf)(k,k.components.checkbox["label-gap"]),B=toneColor(k,p),F=j??6;(0,_assertValidValue.assertValidValue)("Checkbox","shape",x,CHECKBOX_SHAPES),(0,_assertValidValue.assertValidValue)("Checkbox","size",r.size,["sm","md","lg"]),(0,_assertValidValue.assertValidValue)("Checkbox","tone",r.tone,["primary","success","warning","danger","info","neutral"]);const N="circle"===x,D="string"==typeof d?d:void 0,M={description:c,helperText:l,error:D},O=S||a,P=(0,_react.useRef)((0,_index2.createAnimatedValue)(O?1:0)).current;(0,_react.useEffect)(()=>{const e=_reactNative.Animated.spring(P,{toValue:O?1:0,damping:k.motion.spring.snappy.damping,stiffness:k.motion.spring.snappy.stiffness,mass:k.motion.spring.snappy.mass,useNativeDriver:_nativeDriver.nativeDriver});return e.start(),()=>e.stop()},[O,P,k.motion.spring.snappy]);const A=P.interpolate({inputRange:[0,1],outputRange:[0,1]}),H=_??(0,_FieldBase.fieldTextAsString)(n),W=!0===d||(0,_FieldBase.hasFieldText)(d),I=O?B:o?k.colors.border:W?k.colors["field-border-error"]:k.colors.border,L=O?B:o?k.colors["surface-disabled"]:"transparent",z=o&&!O?k.colors["text-disabled"]:toneOnColor(k,p),E=Math.round(.72*R),U=Math.round(.55*R),K=Math.max(2,Math.round(.12*R)),X=(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{ref:e,onPress:e=>{if(o)return;const r=(0,_hapticUtils.resolveHaptic)(f,"selection");r&&(0,_hapticUtils.triggerHaptic)(r),w(!S),C.onPressOut?.(e)},disabled:o,accessibilityRole:"checkbox",accessibilityLabel:H,accessibilityHint:C.accessibilityHint??(0,_FieldBase.fieldTextAsString)(l)??(0,_FieldBase.fieldTextAsString)(c),accessibilityState:{checked:a?"mixed":S,disabled:o},"aria-checked":a?"mixed":S,"aria-disabled":o,testID:v,hitSlop:F,...(0,_hitSlop.hitSlopMarker)(F),...C,style:({pressed:e})=>[V.row,(0,_ChoiceText.hasChoiceDetail)(M)?V.rowTop:null,(0,_FieldBase.hasFieldText)(u)?V.rowShrink:null,{opacity:o?.55:e?.85:1},b],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.box,{width:R,height:R,borderWidth:T,borderRadius:N?R/2:k.radius.sm,...N?{}:_corners.smoothCorners,borderColor:I,backgroundColor:L},g],children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[V.glyphWrap,{opacity:P,transform:[{scale:A}]}],children:a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{width:U,height:K,borderRadius:k.radius.pill,..._corners.smoothCorners,backgroundColor:z},m]}):(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:E,height:E,viewBox:"0 0 24 24",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:z,strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})})}),(0,_jsxRuntime.jsx)(_ChoiceText.ChoiceText,{label:n,helperText:l,description:c,error:D,disabled:o,style:{marginLeft:q},labelStyle:y})]});return(0,_FieldBase.hasFieldText)(u)?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[V.helpRow,(0,_ChoiceText.hasChoiceDetail)(M)?V.rowTop:null],children:[X,(0,_jsxRuntime.jsx)(_reactNative.View,{style:[V.help,{marginLeft:k.space.xs}],children:u})]}):X}const buildStyles=e=>_reactNative.StyleSheet.create({row:{flexDirection:"row",alignItems:"center"},rowTop:{alignItems:"flex-start"},rowShrink:{flexShrink:1},helpRow:{flexDirection:"row",alignItems:"center"},help:{flexShrink:0},box:{alignItems:"center",justifyContent:"center"},glyphWrap:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=Checkbox;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Chip=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_chipG=require("../../text/phone/chip.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Skeleton/index.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const toneFor=(e,t)=>{switch(t){case"primary":return{base:e.colors["primary-soft"],on:e.colors.primary,ink:e.colors["primary-text"],border:e.colors.primary,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"success":return{base:e.colors["bg-muted"],on:e.colors.success,ink:e.colors["success-text"],border:e.colors.success,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"warning":return{base:e.colors["bg-muted"],on:e.colors.warning,ink:e.colors["warning-text"],border:e.colors.warning,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"danger":return{base:e.colors["bg-muted"],on:e.colors.danger,ink:e.colors["danger-text"],border:e.colors.danger,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"info":return{base:e.colors["bg-muted"],on:e.colors.info,ink:e.colors["info-text"],border:e.colors.info,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};default:return{base:e.colors["bg-muted"],on:e.colors["text-body"],ink:e.colors["text-body"],border:e.colors.border,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary}}},SOFT_FILL_OPACITY=.14,SOFT_SELECTED_FILL_OPACITY=.24,hasChipCount=e=>null!=e&&""!==e,ChipRoot=(0,_react.forwardRef)((e,t)=>{const{label:s,count:r,selected:i=!1,selectionMode:o="single",onPress:l,onRemove:a,leftIcon:n,iconVariant:c,variant:d="soft",tone:u="neutral",size:p="md",disabled:m=!1,loading:h=!1,accessibilityLabel:x,haptic:b,style:y,textStyle:_,countStyle:g,closeButtonStyle:f,closeIconStyle:S,labels:j,removeTestID:C,testID:v}=e;(0,_assertValidValue.assertValidValue)("Chip","variant",e.variant,["solid","soft","outline"]),(0,_assertValidValue.assertValidValue)("Chip","tone",e.tone,["primary","neutral","success","warning","danger","info"]),(0,_assertValidValue.assertValidValue)("Chip","size",e.size,["sm","md"]),(0,_assertValidValue.assertValidValue)("Chip","selectionMode",e.selectionMode,["single","multiple","radio"]);const k=(0,_index2.useTheme)(),I=(0,_index.useMobileUiText)("chip",_chipG.CHIP_TEXT),V=(0,_react.useMemo)(()=>({...I,...j}),[I,j]),R=!!l&&!m,w="radio"===o,z=!!l&&(!m||w),O=hasChipCount(r),{style:M,pressIn:T,pressOut:B}=(0,_usePressAnimation.usePressAnimation)({enabled:R}),q=(0,_react.useMemo)(()=>toneFor(k,u),[k,u]),P=(0,_react.useMemo)(()=>(0,_index2.resolveChipSize)(k,p),[k,p]),L=Math.max(0,Math.ceil((44-P["min-height"])/2)),A=w?{top:L,bottom:L}:void 0,N="solid"===d,H="soft"===d,D=(()=>{if(H){const e=i?q.selectedOn:q.on,t=i?.24:.14;return(0,_color.tintOf)(e,t,i?q.selectedBg:q.base)}return i?N?q.selectedBg:"transparent":N?q.base:"transparent"})(),F=H?"transparent":i?q.selectedBorder:N?"transparent":q.border,U=m?k.colors["text-disabled"]:i?H?k.colors["text-body"]:q.selectedInk:q.ink,E=N||H?0:k.size.border,handlePress=()=>{if(!R)return;const e=(0,_hapticUtils.resolveHaptic)(b,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),l?.()},G=x??(O?`${s}, ${r}`:s),Y=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.row,children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:P.gap},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(n,{color:U,size:P.icon,disabled:m},c)}):null,(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"medium",numberOfLines:1,style:[styles.label,{color:U,fontSize:P.text,lineHeight:Math.round(P.text*k.leading.body)},_],children:s??" "}),O?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",numberOfLines:1,style:[styles.count,{color:U,fontSize:Math.min(k.text.xs.size,P.text),marginLeft:k.space.xs},g],children:r}):null,a?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{m||(!1!==b&&(0,_hapticUtils.triggerHaptic)("impactLight"),a?.())},disabled:m,accessibilityRole:"button",accessibilityLabel:(0,_index.fillText)(V.removeText,{content:s}),accessibilityState:{disabled:m},"aria-disabled":m,testID:C,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),style:({pressed:e})=>[styles.close,{width:P["close-size"],height:P["close-size"],borderRadius:P["close-size"]/2,..._corners.smoothCorners,marginLeft:P.gap,backgroundColor:e?k.colors["surface-pressed"]:k.colors["surface-hover"]},f],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"bold",maxFontSizeMultiplier:1,style:[{color:U,fontSize:P["close-text"],lineHeight:P["close-text"]+2},S],children:"×"})}):null]}),$={paddingHorizontal:P["padding-x"],paddingVertical:P["padding-y"],minHeight:P["min-height"],borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden",backgroundColor:D,borderWidth:E,borderColor:F,opacity:m?.55:1};let W;return W=z?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[M,{alignSelf:"flex-start",borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden"}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:t,onPress:handlePress,onPressIn:T,onPressOut:B,disabled:!R,accessibilityRole:w?"radio":"multiple"===o?"checkbox":"button",accessibilityLabel:G,accessibilityState:w||"multiple"===o?{checked:i,disabled:m}:{selected:i,disabled:m},"aria-checked":w||"multiple"===o?i:void 0,"aria-selected":w||"multiple"===o?void 0:i,"aria-disabled":m,hitSlop:A,...A?(0,_hitSlop.hitSlopMarker)(A):{},android_ripple:{color:k.colors["surface-pressed"],borderless:!1},testID:v,style:({pressed:e})=>[styles.base,$,e&&"outline"===d?{backgroundColor:k.colors["surface-pressed"]}:null,y],children:Y})}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:t,style:[styles.base,$,y],accessible:!0,accessibilityRole:"text",accessibilityLabel:G,accessibilityState:{selected:i,disabled:m},"aria-selected":i,"aria-disabled":m,testID:v,children:Y}),h?(0,_jsxRuntime.jsx)(ChipSkeleton,{...e}):W}),ChipSkeleton=({label:e,count:t,size:s="md",leftIcon:r,onRemove:i,style:o})=>{const l=(0,_index2.useTheme)(),a=(0,_index2.resolveChipSize)(l,s),n=Math.max(40,Math.min(120,7*(e??"").length)),c=a["min-height"],d=c/2,u=n+2*a["padding-x"]+(hasChipCount(t)?a.gap/2+7*String(t).length:0)+(void 0!==r?a.gap+14:0)+(void 0!==i?a.gap+a["close-size"]:0);return(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:u,height:c,radius:d,style:[{alignSelf:"flex-start"},o]})};ChipSkeleton.displayName="ChipSkeleton";const Chip=exports.Chip=Object.assign(ChipRoot,{Skeleton:ChipSkeleton});Chip.displayName="Chip";const styles=_reactNative.StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},label:{flexShrink:1,textAlign:"center"},count:{flexShrink:0,fontVariant:["tabular-nums"]},close:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=Chip;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Chip=void 0;var _react=require("react"),_reactNative=require("react-native"),_usePressAnimation=require("../../hooks/usePressAnimation.js"),_index=require("../../text/index.js"),_chipG=require("../../text/phone/chip.g.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_color=require("../../utils/color.js"),_corners=require("../../utils/corners.js"),_hapticUtils=require("../../utils/hapticUtils.js"),_hitSlop=require("../../utils/hitSlop.js"),_slotIcon=require("../AppIcon/slotIcon.js"),_index3=require("../Skeleton/index.js"),_index4=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const toneFor=(e,t)=>{switch(t){case"primary":return{base:e.colors["primary-soft"],on:e.colors.primary,ink:e.colors["primary-text"],border:e.colors.primary,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"success":return{base:e.colors["bg-muted"],on:e.colors.success,ink:e.colors["success-text"],border:e.colors.success,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"warning":return{base:e.colors["bg-muted"],on:e.colors.warning,ink:e.colors["warning-text"],border:e.colors.warning,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"danger":return{base:e.colors["bg-muted"],on:e.colors.danger,ink:e.colors["danger-text"],border:e.colors.danger,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};case"info":return{base:e.colors["bg-muted"],on:e.colors.info,ink:e.colors["info-text"],border:e.colors.info,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary};default:return{base:e.colors["bg-muted"],on:e.colors["text-body"],ink:e.colors["text-body"],border:e.colors.border,selectedBg:e.colors["primary-soft"],selectedOn:e.colors.primary,selectedInk:e.colors["primary-text"],selectedBorder:e.colors.primary}}},SOFT_FILL_OPACITY=.14,SOFT_SELECTED_FILL_OPACITY=.24,hasChipCount=e=>null!=e&&""!==e;function ChipRoot({ref:e,...t}){const{label:s,count:r,selected:i=!1,selectionMode:o="single",onPress:l,onRemove:a,leftIcon:n,iconVariant:c,variant:d="soft",tone:u="neutral",size:p="md",disabled:m=!1,loading:h=!1,accessibilityLabel:x,haptic:b,style:y,textStyle:_,countStyle:g,closeButtonStyle:f,closeIconStyle:S,labels:j,removeTestID:C,testID:v}=t;(0,_assertValidValue.assertValidValue)("Chip","variant",t.variant,["solid","soft","outline"]),(0,_assertValidValue.assertValidValue)("Chip","tone",t.tone,["primary","neutral","success","warning","danger","info"]),(0,_assertValidValue.assertValidValue)("Chip","size",t.size,["sm","md"]),(0,_assertValidValue.assertValidValue)("Chip","selectionMode",t.selectionMode,["single","multiple","radio"]);const k=(0,_index2.useTheme)(),I=(0,_index.useMobileUiText)("chip",_chipG.CHIP_TEXT),V=(0,_react.useMemo)(()=>({...I,...j}),[I,j]),R=!!l&&!m,w="radio"===o,z=!!l&&(!m||w),O=hasChipCount(r),{style:M,pressIn:T,pressOut:B}=(0,_usePressAnimation.usePressAnimation)({enabled:R}),q=(0,_react.useMemo)(()=>toneFor(k,u),[k,u]),P=(0,_react.useMemo)(()=>(0,_index2.resolveChipSize)(k,p),[k,p]),L=Math.max(0,Math.ceil((44-P["min-height"])/2)),A=w?{top:L,bottom:L}:void 0,N="solid"===d,H="soft"===d,D=(()=>{if(H){const e=i?q.selectedOn:q.on,t=i?.24:.14;return(0,_color.tintOf)(e,t,i?q.selectedBg:q.base)}return i?N?q.selectedBg:"transparent":N?q.base:"transparent"})(),F=H?"transparent":i?q.selectedBorder:N?"transparent":q.border,U=m?k.colors["text-disabled"]:i?H?k.colors["text-body"]:q.selectedInk:q.ink,E=N||H?0:k.size.border,handlePress=()=>{if(!R)return;const e=(0,_hapticUtils.resolveHaptic)(b,"selection");e&&(0,_hapticUtils.triggerHaptic)(e),l?.()},G=x??(O?`${s}, ${r}`:s),Y=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.row,children:[n?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{marginRight:P.gap},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants","aria-hidden":!0,children:(0,_slotIcon.renderSlotIcon)(n,{color:U,size:P.icon,disabled:m},c)}):null,(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"medium",numberOfLines:1,style:[styles.label,{color:U,fontSize:P.text,lineHeight:Math.round(P.text*k.leading.body)},_],children:s??" "}),O?(0,_jsxRuntime.jsx)(_index4.Text,{variant:"caption",numberOfLines:1,style:[styles.count,{color:U,fontSize:Math.min(k.text.xs.size,P.text),marginLeft:k.space.xs},g],children:r}):null,a?(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>{m||(!1!==b&&(0,_hapticUtils.triggerHaptic)("impactLight"),a?.())},disabled:m,accessibilityRole:"button",accessibilityLabel:(0,_index.fillText)(V.removeText,{content:s}),accessibilityState:{disabled:m},"aria-disabled":m,testID:C,hitSlop:6,...(0,_hitSlop.hitSlopMarker)(6),style:({pressed:e})=>[styles.close,{width:P["close-size"],height:P["close-size"],borderRadius:P["close-size"]/2,..._corners.smoothCorners,marginLeft:P.gap,backgroundColor:e?k.colors["surface-pressed"]:k.colors["surface-hover"]},f],children:(0,_jsxRuntime.jsx)(_index4.Text,{variant:"label",weight:"bold",maxFontSizeMultiplier:1,style:[{color:U,fontSize:P["close-text"],lineHeight:P["close-text"]+2},S],children:"×"})}):null]}),$={paddingHorizontal:P["padding-x"],paddingVertical:P["padding-y"],minHeight:P["min-height"],borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden",backgroundColor:D,borderWidth:E,borderColor:F,opacity:m?.55:1};let W;return W=z?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[M,{alignSelf:"flex-start",borderRadius:k.radius.pill,..._corners.smoothCorners,overflow:"hidden"}],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{ref:e,onPress:handlePress,onPressIn:T,onPressOut:B,disabled:!R,accessibilityRole:w?"radio":"multiple"===o?"checkbox":"button",accessibilityLabel:G,accessibilityState:w||"multiple"===o?{checked:i,disabled:m}:{selected:i,disabled:m},"aria-checked":w||"multiple"===o?i:void 0,"aria-selected":w||"multiple"===o?void 0:i,"aria-disabled":m,hitSlop:A,...A?(0,_hitSlop.hitSlopMarker)(A):{},android_ripple:{color:k.colors["surface-pressed"],borderless:!1},testID:v,style:({pressed:e})=>[styles.base,$,e&&"outline"===d?{backgroundColor:k.colors["surface-pressed"]}:null,y],children:Y})}):(0,_jsxRuntime.jsx)(_reactNative.View,{ref:e,style:[styles.base,$,y],accessible:!0,accessibilityRole:"text",accessibilityLabel:G,accessibilityState:{selected:i,disabled:m},"aria-selected":i,"aria-disabled":m,testID:v,children:Y}),h?(0,_jsxRuntime.jsx)(ChipSkeleton,{...t}):W}const ChipSkeleton=({label:e,count:t,size:s="md",leftIcon:r,onRemove:i,style:o})=>{const l=(0,_index2.useTheme)(),a=(0,_index2.resolveChipSize)(l,s),n=Math.max(40,Math.min(120,7*(e??"").length)),c=a["min-height"],d=c/2,u=n+2*a["padding-x"]+(hasChipCount(t)?a.gap/2+7*String(t).length:0)+(void 0!==r?a.gap+14:0)+(void 0!==i?a.gap+a["close-size"]:0);return(0,_jsxRuntime.jsx)(_index3.Skeleton,{width:u,height:c,radius:d,style:[{alignSelf:"flex-start"},o]})};ChipSkeleton.displayName="ChipSkeleton";const Chip=exports.Chip=Object.assign(ChipRoot,{Skeleton:ChipSkeleton});Chip.displayName="Chip";const styles=_reactNative.StyleSheet.create({base:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",justifyContent:"center"},row:{flexDirection:"row",alignItems:"center"},label:{flexShrink:1,textAlign:"center"},count:{flexShrink:0,fontVariant:["tabular-nums"]},close:{alignItems:"center",justifyContent:"center"}});var _default=exports.default=Chip;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Composer=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useControllableState=require("../../hooks/useControllableState.js"),_useReducedMotion=require("../../hooks/useReducedMotion.js"),_index=require("../../text/index.js"),_composerG=require("../../text/phone/composer.g.js"),_index2=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_index3=require("../IconButton/index.js"),_jsxRuntime=require("react/jsx-runtime");const MIN_BOX=44,RING_MS=900,RING_WIDTH=1.5,Composer=exports.Composer=(0,_react.forwardRef)(({onSend:e,value:t,onChangeText:a,placeholder:o,accessibilityLabel:i,hint:r,labels:s,loading:n=!1,onStop:l,stopLabel:d,disabled:c=!1,canSend:u,ring:b=!1,sendReveal:_="always",sendIcon:p="send",maxLength:m,maxLines:x=5,leading:v,trailing:g,above:h,below:C,keyboardAware:y=!0,keyboardOffset:f,safeArea:N=!0,autoFocus:S,haptic:j,style:R,testID:w},I)=>{const q=(0,_index2.useTheme)(),M=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),A=(0,_react.useMemo)(()=>buildStyles(q),[q]),T=(0,_index.useMobileUiText)("composer",_composerG.COMPOSER_TEXT),k=(0,_react.useMemo)(()=>({...T,...s}),[T,s]),[D,V]=(0,_useControllableState.useControllableState)({value:t,defaultValue:"",onChange:a}),O=D.trim(),B=n&&void 0!==l,E=n||c||!(u??""!==O),F=N?M.bottom:0,H=f??F,L=(0,_FieldBase.resolveFieldTextStyle)(q,{disabled:c}),z=q.text.base.size,P=Math.round(z*q.leading.body),G=(44-P)/2,W=P*x+2*G,[K,$]=(0,_react.useState)(void 0),X=(0,_react.useCallback)(e=>{const t=e.nativeEvent.contentSize.height+2*G;$(Math.min(Math.max(t,44),W))},[G,W]),U=(0,_useReducedMotion.useReducedMotion)(),J=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;(0,_react.useEffect)(()=>{if(!b||U)return void J.setValue(b?1:0);const e=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(J,{toValue:1,duration:900,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:!1}),_reactNative.Animated.timing(J,{toValue:0,duration:900,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:!1})]));return e.start(),()=>e.stop()},[b,U,J]);const Q=b?{borderWidth:1.5,borderColor:J.interpolate({inputRange:[0,1],outputRange:[q.colors["border-subtle"],q.colors.primary]})}:null,Y="always"===_||n||""!==D||!0===u,Z=(0,_react.useCallback)(()=>{B?l?.():E||(V(""),e(O))},[B,l,E,V,e,O]),ee=(0,_react.useCallback)(e=>{(0,_mobileCore.reportIdleActivity)(),V(e)},[V]),te=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[A.bar,{paddingBottom:q.space.sm+F},R],testID:w,children:[h,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:A.row,children:[v,(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[A.box,c?A.boxDisabled:null,Q],testID:w?`${w}-box`:void 0,children:(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:I,value:D,onChangeText:ee,multiline:!0,maxLength:m,editable:!c,autoFocus:S,placeholder:o??k.message,placeholderTextColor:L.placeholderColor,selectionColor:q.colors["field-caret"],accessibilityLabel:i??o??k.message,accessibilityHint:r,accessibilityState:{disabled:c},"aria-disabled":c,onContentSizeChange:"web"===_reactNative.Platform.OS?X:void 0,style:[A.input,{color:L.color,...L.weightStyle,fontSize:z,lineHeight:P,paddingVertical:G,maxHeight:W,height:"web"===_reactNative.Platform.OS?K:void 0}],testID:w?`${w}-input`:void 0})}),g,Y?(0,_jsxRuntime.jsx)(_index3.IconButton,{icon:B?"stop":p,accessibilityLabel:B?d??k.stopLabel:k.send,variant:"solid",tone:"primary",disabled:B?c:E,loading:n&&!B,haptic:j,onPress:Z,testID:w?`${w}-send`:void 0}):null]}),C]});return y?(0,_jsxRuntime.jsx)(_reactNativeKeyboardController.KeyboardStickyView,{offset:{closed:0,opened:H},children:te}):te});Composer.displayName="Composer";const buildStyles=e=>_reactNative.StyleSheet.create({bar:{gap:e.space.xs,paddingHorizontal:e.space.md,paddingTop:e.space.sm,backgroundColor:e.colors.bg,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:e.colors["border-subtle"]},row:{flexDirection:"row",alignItems:"flex-end",gap:e.space.sm},box:{flex:1,minHeight:44,justifyContent:"center",backgroundColor:e.colors["field-bg"],borderRadius:e.radius.pill,..._corners.smoothCorners,paddingHorizontal:e.space.md},boxDisabled:{backgroundColor:e.colors["field-bg-disabled"]},input:{margin:e.space.none,paddingHorizontal:e.space.none,includeFontPadding:!1,textAlignVertical:"top"}});var _default=exports.default=Composer;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Composer=void 0;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_reactNativeKeyboardController=require("react-native-keyboard-controller"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_useControllableState=require("../../hooks/useControllableState.js"),_useReducedMotion=require("../../hooks/useReducedMotion.js"),_index=require("../../text/index.js"),_composerG=require("../../text/phone/composer.g.js"),_index2=require("../../theme/index.js"),_corners=require("../../utils/corners.js"),_FieldBase=require("../FieldBase/FieldBase.js"),_index3=require("../IconButton/index.js"),_jsxRuntime=require("react/jsx-runtime");const MIN_BOX=44,RING_MS=900,RING_WIDTH=1.5,Composer=({onSend:e,value:t,onChangeText:a,placeholder:i,accessibilityLabel:o,hint:r,labels:s,loading:n=!1,onStop:l,stopLabel:d,disabled:c=!1,canSend:u,ring:b=!1,sendReveal:_="always",sendIcon:p="send",maxLength:m,maxLines:x=5,leading:v,trailing:g,above:h,below:C,keyboardAware:y=!0,keyboardOffset:f,safeArea:S=!0,autoFocus:N,haptic:j,style:R,testID:w,ref:I})=>{const q=(0,_index2.useTheme)(),M=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),A=(0,_react.useMemo)(()=>buildStyles(q),[q]),T=(0,_index.useMobileUiText)("composer",_composerG.COMPOSER_TEXT),k=(0,_react.useMemo)(()=>({...T,...s}),[T,s]),[D,V]=(0,_useControllableState.useControllableState)({value:t,defaultValue:"",onChange:a}),O=D.trim(),B=n&&void 0!==l,E=n||c||!(u??""!==O),F=S?M.bottom:0,H=f??F,L=(0,_FieldBase.resolveFieldTextStyle)(q,{disabled:c}),z=q.text.base.size,P=Math.round(z*q.leading.body),G=(44-P)/2,W=P*x+2*G,[K,$]=(0,_react.useState)(void 0),X=(0,_react.useCallback)(e=>{const t=e.nativeEvent.contentSize.height+2*G;$(Math.min(Math.max(t,44),W))},[G,W]),U=(0,_useReducedMotion.useReducedMotion)(),J=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;(0,_react.useEffect)(()=>{if(!b||U)return void J.setValue(b?1:0);const e=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(J,{toValue:1,duration:900,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:!1}),_reactNative.Animated.timing(J,{toValue:0,duration:900,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:!1})]));return e.start(),()=>e.stop()},[b,U,J]);const Q=b?{borderWidth:1.5,borderColor:J.interpolate({inputRange:[0,1],outputRange:[q.colors["border-subtle"],q.colors.primary]})}:null,Y="always"===_||n||""!==D||!0===u,Z=(0,_react.useCallback)(()=>{B?l?.():E||(V(""),e(O))},[B,l,E,V,e,O]),ee=(0,_react.useCallback)(e=>{(0,_mobileCore.reportIdleActivity)(),V(e)},[V]),te=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[A.bar,{paddingBottom:q.space.sm+F},R],testID:w,children:[h,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:A.row,children:[v,(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[A.box,c?A.boxDisabled:null,Q],testID:w?`${w}-box`:void 0,children:(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:I,value:D,onChangeText:ee,multiline:!0,maxLength:m,editable:!c,autoFocus:N,placeholder:i??k.message,placeholderTextColor:L.placeholderColor,selectionColor:q.colors["field-caret"],accessibilityLabel:o??i??k.message,accessibilityHint:r,accessibilityState:{disabled:c},"aria-disabled":c,onContentSizeChange:"web"===_reactNative.Platform.OS?X:void 0,style:[A.input,{color:L.color,...L.weightStyle,fontSize:z,lineHeight:P,paddingVertical:G,maxHeight:W,height:"web"===_reactNative.Platform.OS?K:void 0}],testID:w?`${w}-input`:void 0})}),g,Y?(0,_jsxRuntime.jsx)(_index3.IconButton,{icon:B?"stop":p,accessibilityLabel:B?d??k.stopLabel:k.send,variant:"solid",tone:"primary",disabled:B?c:E,loading:n&&!B,haptic:j,onPress:Z,testID:w?`${w}-send`:void 0}):null]}),C]});return y?(0,_jsxRuntime.jsx)(_reactNativeKeyboardController.KeyboardStickyView,{offset:{closed:0,opened:H},children:te}):te};exports.Composer=Composer;const buildStyles=e=>_reactNative.StyleSheet.create({bar:{gap:e.space.xs,paddingHorizontal:e.space.md,paddingTop:e.space.sm,backgroundColor:e.colors.bg,borderTopWidth:_reactNative.StyleSheet.hairlineWidth,borderTopColor:e.colors["border-subtle"]},row:{flexDirection:"row",alignItems:"flex-end",gap:e.space.sm},box:{flex:1,minHeight:44,justifyContent:"center",backgroundColor:e.colors["field-bg"],borderRadius:e.radius.pill,..._corners.smoothCorners,paddingHorizontal:e.space.md},boxDisabled:{backgroundColor:e.colors["field-bg-disabled"]},input:{margin:e.space.none,paddingHorizontal:e.space.none,includeFontPadding:!1,textAlignVertical:"top"}});var _default=exports.default=Composer;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.buildPieces=exports.DEFAULT_PHYSICS=exports.Confetti=void 0;var cache,_react=require("react"),_reactNative=require("react-native"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_reactNativeWorklets=require("react-native-worklets"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,a){if(!a&&e&&e.__esModule)return e;var t,r,i=Object.defineProperty,s={__proto__:null,default:e};if(Object(e)!==e)return s;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,s)}for(r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((t=i&&Object.getOwnPropertyDescriptor(e,r))&&(t.get||t.set)?i(s,r,t):s[r]=e[r]);return s}const TAU=2*Math.PI,DEG=Math.PI/180,SPEED_FACTOR={slow:1.6,normal:1,fast:.6},DEFAULT_PHYSICS=exports.DEFAULT_PHYSICS={velocity:1,drag:1,fallSpeed:1,spread:0},PRESET_SHAPES={pop:["strip","strip","strip","square","circle","triangle","star","streamer"],rain:["strip","strip","strip","circle","square"],fireworks:["circle","circle","star","star","triangle","strip"]},rand=(e,a)=>e+Math.random()*(a-e),itemAt=(e,a,t)=>{const r=e[a];if(void 0===r)throw new Error(`Confetti needs at least one ${t}`);return r},pick=e=>itemAt(e,Math.floor(Math.random()*e.length),"shape"),randomSign=()=>Math.random()<.5?1:-1,commonPiece=(e,a)=>({color:itemAt(e.colors,a%e.colors.length,"colour"),size:e.baseSize*rand(.6,1.4),shape:pick(e.shapes),rotations:rand(1,5),rotateDir:randomSign(),flutterFreq:rand(2,5)}),popPiece=(e,a)=>{const t=e.physics.spread>0?e.physics.spread/2:100,r=(-90+rand(-t,t))*DEG,i=rand(1.8,4.2)*e.physics.velocity;return{...commonPiece(e,a),x0Frac:e.originXFrac,y0Frac:e.originYFrac,vxFrac:Math.cos(r)*i*.7,vyFrac:Math.sin(r)*i,drag:rand(5.5,7.5)*e.physics.drag,terminalFrac:rand(.22,.44)*e.physics.fallSpeed,delay:rand(0,.05),swayAmp:rand(4,16),swayFreq:rand(1,3)}},rainPiece=(e,a)=>({...commonPiece(e,a),x0Frac:Math.random(),y0Frac:-.05,vxFrac:rand(-.12,.12)*e.physics.velocity,vyFrac:rand(.05,.25)*e.physics.velocity,drag:rand(2.5,4)*e.physics.drag,terminalFrac:rand(.95,1.35)*e.physics.fallSpeed,delay:rand(0,.35),swayAmp:rand(10,30),swayFreq:rand(1,3)}),FIREWORK_BURSTS=4,buildFireworks=(e,a)=>{const t=Math.max(1,Math.round(e/4)),r=a.physics.spread>0?a.physics.spread/2:180,i=[];for(let s=0;s<4&&i.length<e;s+=1){const n=rand(.18,.82),c=rand(.18,.52),o=s/4*.5+rand(0,.06);for(let s=0;s<t&&i.length<e;s+=1){const e=rand(-r,r)*DEG,t=rand(1.4,3.4)*a.physics.velocity;i.push({...commonPiece(a,i.length),x0Frac:n,y0Frac:c,vxFrac:Math.cos(e)*t*.7,vyFrac:Math.sin(e)*t,drag:rand(6.5,8.5)*a.physics.drag,terminalFrac:rand(.18,.38)*a.physics.fallSpeed,delay:o,swayAmp:rand(3,12),swayFreq:rand(1,3)})}}return i},buildPieces=(e,a,t)=>{if("fireworks"===a)return buildFireworks(e,t);const r="rain"===a?rainPiece:popPiece;return Array.from({length:e},(e,a)=>r(t,a))};exports.buildPieces=buildPieces;const SHAPE_BOX={strip:{w:1,h:.45},square:{w:1,h:1},circle:{w:1,h:1},triangle:{w:1,h:1},star:{w:1.2,h:1.2},streamer:{w:3,h:1.2}},TRIANGLE_POINTS="50,4 96,96 4,96",STAR_POINTS="50,2 61,36 97,36 68,58 79,94 50,72 21,94 32,58 3,36 39,36",STREAMER_PATH="M2,50 C20,6 44,94 62,50 S92,6 98,50",ShapeBody=({shape:e,color:a})=>"triangle"===e||"star"===e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:"100%",height:"100%",viewBox:"0 0 100 100",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Polygon,{points:"star"===e?STAR_POINTS:TRIANGLE_POINTS,fill:a})}):"streamer"===e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:STREAMER_PATH,stroke:a,strokeWidth:22,strokeLinecap:"round",fill:"none"})}):null,ConfettiPiece=({piece:e,progress:a,width:t,height:r,fadeOut:i})=>{const s=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const s=1-e.delay,n=s<=0?0:Math.min(1,Math.max(0,(a.value-e.delay)/s)),c=(1-Math.exp(-e.drag*n))/e.drag,o=e.x0Frac*t+e.vxFrac*t*c,l=e.y0Frac*r+e.terminalFrac*r*n+(e.vyFrac-e.terminalFrac)*r*c,d=Math.sin(n*e.swayFreq*TAU)*e.swayAmp,h=e.rotateDir*e.rotations*360*n,p=.35+.65*Math.abs(Math.cos(n*e.flutterFreq*TAU));return{opacity:i?Math.max(0,1-Math.max(0,n-.75)/.25):1,transform:[{translateX:o+d},{translateY:l},{rotate:`${h}deg`},{scaleY:p}]}},[e,a,t,r,i]),n=SHAPE_BOX[e.shape],c="triangle"===e.shape||"star"===e.shape||"streamer"===e.shape;return(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[{position:"absolute",width:e.size*n.w,height:e.size*n.h,borderRadius:"circle"===e.shape?e.size*n.h/2:1,backgroundColor:c?"transparent":e.color},s],children:(0,_jsxRuntime.jsx)(ShapeBody,{shape:e.shape,color:e.color})})},Confetti=exports.Confetti=(0,_react.forwardRef)(({count:e=80,colors:a,preset:t="pop",shapes:r,speed:i="normal",physics:s,origin:n,duration:c=2800,fadeOut:o=!0,autoStart:l=!1,recycle:d=!1,size:h=10,onComplete:p,style:u,testID:_},m)=>{(0,_assertValidValue.assertValidValue)("Confetti","preset",t,["pop","rain","fireworks"]),(0,_assertValidValue.assertValidValue)("Confetti","speed",i,["slow","normal","fast"]);for(const e of r??[])(0,_assertValidValue.assertValidValue)("Confetti","shapes",e,["strip","square","circle","triangle","star","streamer"]);const v=(0,_index2.useTheme)(),y=(0,_index.useReducedMotion)(),f=(0,_reactNative.useWindowDimensions)(),[g,S]=(0,_react.useState)({width:f.width,height:f.height}),[x,w]=(0,_react.useState)(!1),[R,F]=(0,_react.useState)([]),P=(0,_react.useMemo)(()=>a??[v.colors.primary,v.colors.neutral,v.colors.success,v.colors.warning,v.colors.danger,v.colors.info],[a,v.colors]),A=(0,_reactNativeReanimated.useSharedValue)(0),E=c*SPEED_FACTOR[i],M=(0,_react.useCallback)(()=>{w(!1),p?.()},[p]),N=(0,_react.useCallback)(()=>{if(y)return void p?.();(0,_reactNativeReanimated.cancelAnimation)(A),A.value=0,F(buildPieces(e,t,{colors:P,baseSize:h,originXFrac:n?n.x/Math.max(1,g.width):.5,originYFrac:n?n.y/Math.max(1,g.height):.5,physics:{velocity:void 0===s?.velocity?DEFAULT_PHYSICS.velocity:s.velocity,drag:void 0===s?.drag?DEFAULT_PHYSICS.drag:s.drag,fallSpeed:void 0===s?.fallSpeed?DEFAULT_PHYSICS.fallSpeed:s.fallSpeed,spread:void 0===s?.spread?DEFAULT_PHYSICS.spread:s.spread},shapes:r??PRESET_SHAPES[t]})),w(!0);const a=(0,_reactNativeReanimated.withTiming)(1,{duration:E,easing:_reactNativeReanimated.Easing.linear},e=>{"worklet";e&&!d&&(0,_reactNativeWorklets.scheduleOnRN)(M)});A.value=d?(0,_reactNativeReanimated.withRepeat)(a,-1,!1):a},[y,A,E,d,M,p,e,P,t,r,s,h,n,g.width,g.height]),T=(0,_react.useCallback)(()=>{(0,_reactNativeReanimated.cancelAnimation)(A),w(!1)},[A]);(0,_react.useImperativeHandle)(m,()=>({start:N,stop:T}),[N,T]);const C=(0,_react.useRef)(l).current,j=(0,_react.useRef)(N).current;(0,_react.useEffect)(()=>(C&&j(),()=>(0,_reactNativeReanimated.cancelAnimation)(A)),[A,C,j]);const k=(0,_react.useCallback)(e=>{const{width:a,height:t}=e.nativeEvent.layout;a>0&&t>0&&S({width:a,height:t})},[]),b=(0,_react.useMemo)(()=>R.map((e,a)=>({key:`confetti-${a}`,piece:e})),[R]);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_reactNative.StyleSheet.absoluteFill,u],pointerEvents:"none",onLayout:k,testID:_,children:x?b.map(({key:e,piece:a})=>(0,_jsxRuntime.jsx)(ConfettiPiece,{piece:a,progress:A,width:g.width,height:g.height,fadeOut:o},e)):null})});Confetti.displayName="Confetti";var _default=exports.default=Confetti;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Confetti=Confetti,exports.default=exports.buildPieces=exports.DEFAULT_PHYSICS=void 0;var cache,_react=require("react"),_reactNative=require("react-native"),_reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated")),_reactNativeSvg=_interopRequireWildcard(require("react-native-svg")),_reactNativeWorklets=require("react-native-worklets"),_index=require("../../hooks/index.js"),_index2=require("../../theme/index.js"),_assertValidValue=require("../../utils/assertValidValue.js"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,a){if(!a&&e&&e.__esModule)return e;var t,r,i=Object.defineProperty,s={__proto__:null,default:e};if(Object(e)!==e)return s;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,s)}for(r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((t=i&&Object.getOwnPropertyDescriptor(e,r))&&(t.get||t.set)?i(s,r,t):s[r]=e[r]);return s}const TAU=2*Math.PI,DEG=Math.PI/180,SPEED_FACTOR={slow:1.6,normal:1,fast:.6},DEFAULT_PHYSICS=exports.DEFAULT_PHYSICS={velocity:1,drag:1,fallSpeed:1,spread:0},PRESET_SHAPES={pop:["strip","strip","strip","square","circle","triangle","star","streamer"],rain:["strip","strip","strip","circle","square"],fireworks:["circle","circle","star","star","triangle","strip"]},rand=(e,a)=>e+Math.random()*(a-e),itemAt=(e,a,t)=>{const r=e[a];if(void 0===r)throw new Error(`Confetti needs at least one ${t}`);return r},pick=e=>itemAt(e,Math.floor(Math.random()*e.length),"shape"),randomSign=()=>Math.random()<.5?1:-1,commonPiece=(e,a)=>({color:itemAt(e.colors,a%e.colors.length,"colour"),size:e.baseSize*rand(.6,1.4),shape:pick(e.shapes),rotations:rand(1,5),rotateDir:randomSign(),flutterFreq:rand(2,5)}),popPiece=(e,a)=>{const t=e.physics.spread>0?e.physics.spread/2:100,r=(-90+rand(-t,t))*DEG,i=rand(1.8,4.2)*e.physics.velocity;return{...commonPiece(e,a),x0Frac:e.originXFrac,y0Frac:e.originYFrac,vxFrac:Math.cos(r)*i*.7,vyFrac:Math.sin(r)*i,drag:rand(5.5,7.5)*e.physics.drag,terminalFrac:rand(.22,.44)*e.physics.fallSpeed,delay:rand(0,.05),swayAmp:rand(4,16),swayFreq:rand(1,3)}},rainPiece=(e,a)=>({...commonPiece(e,a),x0Frac:Math.random(),y0Frac:-.05,vxFrac:rand(-.12,.12)*e.physics.velocity,vyFrac:rand(.05,.25)*e.physics.velocity,drag:rand(2.5,4)*e.physics.drag,terminalFrac:rand(.95,1.35)*e.physics.fallSpeed,delay:rand(0,.35),swayAmp:rand(10,30),swayFreq:rand(1,3)}),FIREWORK_BURSTS=4,buildFireworks=(e,a)=>{const t=Math.max(1,Math.round(e/4)),r=a.physics.spread>0?a.physics.spread/2:180,i=[];for(let s=0;s<4&&i.length<e;s+=1){const n=rand(.18,.82),c=rand(.18,.52),o=s/4*.5+rand(0,.06);for(let s=0;s<t&&i.length<e;s+=1){const e=rand(-r,r)*DEG,t=rand(1.4,3.4)*a.physics.velocity;i.push({...commonPiece(a,i.length),x0Frac:n,y0Frac:c,vxFrac:Math.cos(e)*t*.7,vyFrac:Math.sin(e)*t,drag:rand(6.5,8.5)*a.physics.drag,terminalFrac:rand(.18,.38)*a.physics.fallSpeed,delay:o,swayAmp:rand(3,12),swayFreq:rand(1,3)})}}return i},buildPieces=(e,a,t)=>{if("fireworks"===a)return buildFireworks(e,t);const r="rain"===a?rainPiece:popPiece;return Array.from({length:e},(e,a)=>r(t,a))};exports.buildPieces=buildPieces;const SHAPE_BOX={strip:{w:1,h:.45},square:{w:1,h:1},circle:{w:1,h:1},triangle:{w:1,h:1},star:{w:1.2,h:1.2},streamer:{w:3,h:1.2}},TRIANGLE_POINTS="50,4 96,96 4,96",STAR_POINTS="50,2 61,36 97,36 68,58 79,94 50,72 21,94 32,58 3,36 39,36",STREAMER_PATH="M2,50 C20,6 44,94 62,50 S92,6 98,50",ShapeBody=({shape:e,color:a})=>"triangle"===e||"star"===e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:"100%",height:"100%",viewBox:"0 0 100 100",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Polygon,{points:"star"===e?STAR_POINTS:TRIANGLE_POINTS,fill:a})}):"streamer"===e?(0,_jsxRuntime.jsx)(_reactNativeSvg.default,{width:"100%",height:"100%",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:STREAMER_PATH,stroke:a,strokeWidth:22,strokeLinecap:"round",fill:"none"})}):null,ConfettiPiece=({piece:e,progress:a,width:t,height:r,fadeOut:i})=>{const s=(0,_reactNativeReanimated.useAnimatedStyle)(()=>{const s=1-e.delay,n=s<=0?0:Math.min(1,Math.max(0,(a.value-e.delay)/s)),c=(1-Math.exp(-e.drag*n))/e.drag,o=e.x0Frac*t+e.vxFrac*t*c,l=e.y0Frac*r+e.terminalFrac*r*n+(e.vyFrac-e.terminalFrac)*r*c,d=Math.sin(n*e.swayFreq*TAU)*e.swayAmp,h=e.rotateDir*e.rotations*360*n,p=.35+.65*Math.abs(Math.cos(n*e.flutterFreq*TAU));return{opacity:i?Math.max(0,1-Math.max(0,n-.75)/.25):1,transform:[{translateX:o+d},{translateY:l},{rotate:`${h}deg`},{scaleY:p}]}},[e,a,t,r,i]),n=SHAPE_BOX[e.shape],c="triangle"===e.shape||"star"===e.shape||"streamer"===e.shape;return(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[{position:"absolute",width:e.size*n.w,height:e.size*n.h,borderRadius:"circle"===e.shape?e.size*n.h/2:1,backgroundColor:c?"transparent":e.color},s],children:(0,_jsxRuntime.jsx)(ShapeBody,{shape:e.shape,color:e.color})})};function Confetti({ref:e,count:a=80,colors:t,preset:r="pop",shapes:i,speed:s="normal",physics:n,origin:c,duration:o=2800,fadeOut:l=!0,autoStart:d=!1,recycle:h=!1,size:p=10,onComplete:u,style:_,testID:m}){(0,_assertValidValue.assertValidValue)("Confetti","preset",r,["pop","rain","fireworks"]),(0,_assertValidValue.assertValidValue)("Confetti","speed",s,["slow","normal","fast"]);for(const e of i??[])(0,_assertValidValue.assertValidValue)("Confetti","shapes",e,["strip","square","circle","triangle","star","streamer"]);const v=(0,_index2.useTheme)(),y=(0,_index.useReducedMotion)(),f=(0,_reactNative.useWindowDimensions)(),[g,S]=(0,_react.useState)({width:f.width,height:f.height}),[x,w]=(0,_react.useState)(!1),[F,P]=(0,_react.useState)([]),R=(0,_react.useMemo)(()=>t??[v.colors.primary,v.colors.neutral,v.colors.success,v.colors.warning,v.colors.danger,v.colors.info],[t,v.colors]),A=(0,_reactNativeReanimated.useSharedValue)(0),E=o*SPEED_FACTOR[s],M=(0,_react.useCallback)(()=>{w(!1),u?.()},[u]),T=(0,_react.useCallback)(()=>{if(y)return void u?.();(0,_reactNativeReanimated.cancelAnimation)(A),A.value=0,P(buildPieces(a,r,{colors:R,baseSize:p,originXFrac:c?c.x/Math.max(1,g.width):.5,originYFrac:c?c.y/Math.max(1,g.height):.5,physics:{velocity:void 0===n?.velocity?DEFAULT_PHYSICS.velocity:n.velocity,drag:void 0===n?.drag?DEFAULT_PHYSICS.drag:n.drag,fallSpeed:void 0===n?.fallSpeed?DEFAULT_PHYSICS.fallSpeed:n.fallSpeed,spread:void 0===n?.spread?DEFAULT_PHYSICS.spread:n.spread},shapes:i??PRESET_SHAPES[r]})),w(!0);const e=(0,_reactNativeReanimated.withTiming)(1,{duration:E,easing:_reactNativeReanimated.Easing.linear},e=>{"worklet";e&&!h&&(0,_reactNativeWorklets.scheduleOnRN)(M)});A.value=h?(0,_reactNativeReanimated.withRepeat)(e,-1,!1):e},[y,A,E,h,M,u,a,R,r,i,n,p,c,g.width,g.height]),N=(0,_react.useCallback)(()=>{(0,_reactNativeReanimated.cancelAnimation)(A),w(!1)},[A]);(0,_react.useImperativeHandle)(e,()=>({start:T,stop:N}),[T,N]);const C=(0,_react.useRef)(d).current,j=(0,_react.useRef)(T).current;(0,_react.useEffect)(()=>(C&&j(),()=>(0,_reactNativeReanimated.cancelAnimation)(A)),[A,C,j]);const k=(0,_react.useCallback)(e=>{const{width:a,height:t}=e.nativeEvent.layout;a>0&&t>0&&S({width:a,height:t})},[]),b=(0,_react.useMemo)(()=>F.map((e,a)=>({key:`confetti-${a}`,piece:e})),[F]);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_reactNative.StyleSheet.absoluteFill,_],pointerEvents:"none",onLayout:k,testID:m,children:x?b.map(({key:e,piece:a})=>(0,_jsxRuntime.jsx)(ConfettiPiece,{piece:a,progress:A,width:g.width,height:g.height,fadeOut:l},e)):null})}var _default=exports.default=Confetti;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.DateRangePicker=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_useDragToDismiss=require("../../hooks/useDragToDismiss.js"),_index=require("../../text/index.js"),_dateRangePickerG=require("../../text/phone/dateRangePicker.g.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_index4=require("../Calendar/index.js"),_calendarDates=require("../Calendar/calendarDates.js"),_index5=require("../Modal/index.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_index6=require("../PickerTrigger/index.js"),_index7=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const formatRangePart=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"short",day:"numeric",month:"short"}).format(e),DateRangePicker=exports.DateRangePicker=(0,_react.forwardRef)((e,t)=>{const{open:a,value:r,onChange:s,onClose:i,label:n,help:o,placeholder:l,helperText:d,error:c,required:u,disabled:x,size:g,variant:m,clearable:_,onClear:h,leftIcon:b,trailing:f,triggerStyle:y,valueStyle:p,labelStyle:R,messageStyle:j,accessibilityLabel:v,triggerLabels:D,formatValue:S,minDate:w,maxDate:C,disabledDates:k,marks:T,locale:P="en-IN",weekStartsOn:M=0,title:q,labels:N,maxRange:B,haptic:I,style:z,sheetStyle:H,headerLabelStyle:O,navButtonStyle:V,footerButtonStyle:L,testID:A}=e,G={label:n,help:o,placeholder:l,helperText:d,error:c,required:u,disabled:x,size:g,variant:m,clearable:_,onClear:h,leftIcon:b,trailing:f,triggerStyle:y,valueStyle:p,labelStyle:R,messageStyle:j,accessibilityLabel:v,style:z},E=void 0!==a,[$,W]=(0,_react.useState)(!1),F=void 0!==a?a:$,K=E?A:A?`${A}-calendar`:void 0,U=(0,_index2.useTheme)(),[X,Y]=(0,_ModalSafeArea.useModalInsets)(),J=(0,_react.useMemo)(()=>buildStyles(U),[U]),Q=(0,_index.useMobileUiText)("dateRangePicker",_dateRangePickerG.DATE_RANGE_PICKER_TEXT),Z=(0,_react.useMemo)(()=>({...Q,...N}),[Q,N]),[ee,te]=(0,_react.useState)(()=>(0,_calendarDates.startOfMonth)(r.start??new Date)),[ae,re]=(0,_react.useState)(r.start?(0,_calendarDates.startOfDay)(r.start):null),[se,ie]=(0,_react.useState)(r.end?(0,_calendarDates.startOfDay)(r.end):null),ne=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,oe=(0,_react.useRef)(0);(0,_react.useEffect)(()=>{if(r.start){const e=(0,_calendarDates.startOfDay)(r.start);re(e),te((0,_calendarDates.startOfMonth)(e))}else re(null);r.end?ie((0,_calendarDates.startOfDay)(r.end)):ie(null)},[r.start,r.end]);const le=(0,_react.useCallback)(e=>{if(e.end&&B&&(0,_calendarDates.daysBetween)(e.start,e.end)+1>B)return!1!==I&&(0,_index3.triggerHaptic)("notificationWarning"),re(e.end),void ie(null);re(e.start),ie(e.end??null)},[B,I]),de=(0,_react.useCallback)(()=>{E?i?.():W(!1)},[E,i]),{handleGesture:ce,opacity:ue}=(0,_useDragToDismiss.useDragToDismiss)({drag:ne,travel:()=>oe.current||320,onDismiss:de,testID:A});(0,_react.useEffect)(()=>{F&&((0,_index2.setNativeValue)(ne,0),(0,_index2.setNativeValue)(ue,1))},[F,ne,ue]);const xe=(0,_react.useCallback)(()=>{!1!==I&&(0,_index3.triggerHaptic)("selection"),de()},[de,I]),ge=(0,_react.useCallback)(()=>{ae&&se&&(!1!==I&&(0,_index3.triggerHaptic)("notificationSuccess"),s?.({start:ae,end:se}),de())},[de,s,ae,se,I]),me=(0,_react.useMemo)(()=>ae&&se?`${formatRangePart(ae,P)} — ${formatRangePart(se,P)}`:ae?`${formatRangePart(ae,P)} — …`:"—",[ae,se,P]),he=!ae||!se,be=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[J.card,H],ref:t,accessible:!1,testID:K,children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:ce,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:J.grabArea,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:J.handle}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:J.titleRow,children:[(0,_jsxRuntime.jsx)(_index7.Text,{variant:"title",style:J.title,accessibilityRole:"header",children:q??Z.title}),(0,_jsxRuntime.jsx)(_index7.Text,{variant:"bodySmall",style:J.subtitle,accessibilityLiveRegion:"polite",children:me})]})]})}),(0,_jsxRuntime.jsx)(_index4.Calendar,{selectionMode:"range",value:ae?{start:ae,end:se??void 0}:null,onChange:le,month:ee,onMonthChange:te,minDate:w,maxDate:C,disabledDates:k,marks:T,weekStartsOn:M,locale:P,haptic:I,headerLabelStyle:O,navButtonStyle:V,testID:K?`${K}-grid`:void 0}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:J.footer,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:xe,style:({pressed:e})=>[J.footerBtn,J.footerCancel,e&&J.footerBtnPressed,L],accessibilityRole:"button",accessibilityLabel:Z.cancel,children:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"label",weight:"semibold",style:[J.footerBtnText,{color:U.colors["text-muted"]}],children:Z.cancel})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:ge,disabled:he,style:({pressed:e})=>[J.footerBtn,J.footerConfirm,{backgroundColor:U.colors.primary,opacity:he?.5:1},e&&{backgroundColor:U.colors["primary-hover"]},L],accessibilityRole:"button",accessibilityLabel:Z.confirm,accessibilityState:{disabled:he},"aria-disabled":he,children:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"label",weight:"semibold",style:[J.footerBtnText,{color:U.colors["on-primary"]}],children:Z.confirm})})]})]}),fe=(0,_react.useMemo)(()=>{if(!r.start||!r.end)return"";const e={start:r.start,end:r.end};return S?S(e):`${e.start.toLocaleDateString()} – ${e.end.toLocaleDateString()}`},[r.start,r.end,S]);return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[E?null:(0,_jsxRuntime.jsx)(_index6.PickerTrigger,{...G,labels:D,value:fe,onPress:()=>W(!0),testID:A}),(0,_jsxRuntime.jsx)(_index5.Modal,{open:F,onClose:de,presentation:"bottom",bare:!0,haptic:!1,labels:{close:Z.dismiss},onInsetsChange:Y,children:(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:J.gestureRoot,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[J.sheetWrap,{paddingBottom:Math.max(X.bottom,U.space.lg),opacity:ue,transform:[{translateY:ne}]}],onLayout:e=>{oe.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:be})})})]})});DateRangePicker.displayName="DateRangePicker";const buildStyles=e=>{const t=e.shadow.popover;return _reactNative.StyleSheet.create({gestureRoot:{width:"100%"},sheetWrap:{paddingHorizontal:e.space.md,paddingBottom:e.space.lg},card:{backgroundColor:e.colors.surface,borderRadius:e.radius.xl,..._corners.smoothCorners,padding:e.space.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.space.lg,paddingTop:e.space.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:e.colors["border-subtle"],marginBottom:e.space.sm},titleRow:{marginBottom:e.space.sm},title:{fontSize:e.text.lg.size,lineHeight:Math.round(e.text.lg.size*e.leading.body),fontWeight:e.weight.semibold,color:e.colors["text-body"]},subtitle:{marginTop:e.space.xxs,fontSize:e.text.sm.size,lineHeight:Math.round(e.text.sm.size*e.leading.body),color:e.colors["text-muted"]},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.space.lg,gap:e.space.sm},footerBtn:{paddingHorizontal:e.space.lg,paddingVertical:e.space.sm,borderRadius:e.radius.md,..._corners.smoothCorners,minHeight:40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.text.sm.size,lineHeight:Math.round(e.text.sm.size*e.leading.body),fontWeight:e.weight.semibold}})};var _default=exports.default=DateRangePicker;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DateRangePicker=DateRangePicker,exports.default=void 0;var _react=require("react"),_reactNative=require("react-native"),_reactNativeGestureHandler=require("react-native-gesture-handler"),_useDragToDismiss=require("../../hooks/useDragToDismiss.js"),_index=require("../../text/index.js"),_dateRangePickerG=require("../../text/phone/dateRangePicker.g.js"),_index2=require("../../theme/index.js"),_index3=require("../../utils/index.js"),_corners=require("../../utils/corners.js"),_index4=require("../Calendar/index.js"),_calendarDates=require("../Calendar/calendarDates.js"),_index5=require("../Modal/index.js"),_ModalSafeArea=require("../ModalSafeArea/ModalSafeArea.js"),_index6=require("../PickerTrigger/index.js"),_index7=require("../Text/index.js"),_jsxRuntime=require("react/jsx-runtime");const formatRangePart=(e,t)=>new Intl.DateTimeFormat(t,{weekday:"short",day:"numeric",month:"short"}).format(e);function DateRangePicker({ref:e,...t}){const{open:a,value:r,onChange:s,onClose:i,label:n,help:o,placeholder:l,helperText:d,error:c,required:u,disabled:x,size:g,variant:m,clearable:_,onClear:h,leftIcon:b,trailing:f,triggerStyle:y,valueStyle:p,labelStyle:j,messageStyle:R,accessibilityLabel:v,triggerLabels:D,formatValue:S,minDate:w,maxDate:C,disabledDates:T,marks:k,locale:P="en-IN",weekStartsOn:M=0,title:q,labels:N,maxRange:B,haptic:I,style:z,sheetStyle:H,headerLabelStyle:O,navButtonStyle:V,footerButtonStyle:L,testID:A}=t,G={label:n,help:o,placeholder:l,helperText:d,error:c,required:u,disabled:x,size:g,variant:m,clearable:_,onClear:h,leftIcon:b,trailing:f,triggerStyle:y,valueStyle:p,labelStyle:j,messageStyle:R,accessibilityLabel:v,style:z},E=void 0!==a,[$,W]=(0,_react.useState)(!1),F=void 0!==a?a:$,K=E?A:A?`${A}-calendar`:void 0,U=(0,_index2.useTheme)(),[X,Y]=(0,_ModalSafeArea.useModalInsets)(),J=(0,_react.useMemo)(()=>buildStyles(U),[U]),Q=(0,_index.useMobileUiText)("dateRangePicker",_dateRangePickerG.DATE_RANGE_PICKER_TEXT),Z=(0,_react.useMemo)(()=>({...Q,...N}),[Q,N]),[ee,te]=(0,_react.useState)(()=>(0,_calendarDates.startOfMonth)(r.start??new Date)),[ae,re]=(0,_react.useState)(r.start?(0,_calendarDates.startOfDay)(r.start):null),[se,ie]=(0,_react.useState)(r.end?(0,_calendarDates.startOfDay)(r.end):null),ne=(0,_react.useRef)((0,_index2.createAnimatedValue)(0)).current,oe=(0,_react.useRef)(0);(0,_react.useEffect)(()=>{if(r.start){const e=(0,_calendarDates.startOfDay)(r.start);re(e),te((0,_calendarDates.startOfMonth)(e))}else re(null);r.end?ie((0,_calendarDates.startOfDay)(r.end)):ie(null)},[r.start,r.end]);const le=(0,_react.useCallback)(e=>{if(e.end&&B&&(0,_calendarDates.daysBetween)(e.start,e.end)+1>B)return!1!==I&&(0,_index3.triggerHaptic)("notificationWarning"),re(e.end),void ie(null);re(e.start),ie(e.end??null)},[B,I]),de=(0,_react.useCallback)(()=>{E?i?.():W(!1)},[E,i]),{handleGesture:ce,opacity:ue}=(0,_useDragToDismiss.useDragToDismiss)({drag:ne,travel:()=>oe.current||320,onDismiss:de,testID:A});(0,_react.useEffect)(()=>{F&&((0,_index2.setNativeValue)(ne,0),(0,_index2.setNativeValue)(ue,1))},[F,ne,ue]);const xe=(0,_react.useCallback)(()=>{!1!==I&&(0,_index3.triggerHaptic)("selection"),de()},[de,I]),ge=(0,_react.useCallback)(()=>{ae&&se&&(!1!==I&&(0,_index3.triggerHaptic)("notificationSuccess"),s?.({start:ae,end:se}),de())},[de,s,ae,se,I]),me=(0,_react.useMemo)(()=>ae&&se?`${formatRangePart(ae,P)} — ${formatRangePart(se,P)}`:ae?`${formatRangePart(ae,P)} — …`:"—",[ae,se,P]),he=!ae||!se,be=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[J.card,H],ref:e,accessible:!1,testID:K,children:[(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector,{gesture:ce,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:J.grabArea,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:J.handle}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:J.titleRow,children:[(0,_jsxRuntime.jsx)(_index7.Text,{variant:"title",style:J.title,accessibilityRole:"header",children:q??Z.title}),(0,_jsxRuntime.jsx)(_index7.Text,{variant:"bodySmall",style:J.subtitle,accessibilityLiveRegion:"polite",children:me})]})]})}),(0,_jsxRuntime.jsx)(_index4.Calendar,{selectionMode:"range",value:ae?{start:ae,end:se??void 0}:null,onChange:le,month:ee,onMonthChange:te,minDate:w,maxDate:C,disabledDates:T,marks:k,weekStartsOn:M,locale:P,haptic:I,headerLabelStyle:O,navButtonStyle:V,testID:K?`${K}-grid`:void 0}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:J.footer,children:[(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:xe,style:({pressed:e})=>[J.footerBtn,J.footerCancel,e&&J.footerBtnPressed,L],accessibilityRole:"button",accessibilityLabel:Z.cancel,children:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"label",weight:"semibold",style:[J.footerBtnText,{color:U.colors["text-muted"]}],children:Z.cancel})}),(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:ge,disabled:he,style:({pressed:e})=>[J.footerBtn,J.footerConfirm,{backgroundColor:U.colors.primary,opacity:he?.5:1},e&&{backgroundColor:U.colors["primary-hover"]},L],accessibilityRole:"button",accessibilityLabel:Z.confirm,accessibilityState:{disabled:he},"aria-disabled":he,children:(0,_jsxRuntime.jsx)(_index7.Text,{variant:"label",weight:"semibold",style:[J.footerBtnText,{color:U.colors["on-primary"]}],children:Z.confirm})})]})]}),fe=(0,_react.useMemo)(()=>{if(!r.start||!r.end)return"";const e={start:r.start,end:r.end};return S?S(e):`${e.start.toLocaleDateString()} – ${e.end.toLocaleDateString()}`},[r.start,r.end,S]);return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[E?null:(0,_jsxRuntime.jsx)(_index6.PickerTrigger,{...G,labels:D,value:fe,onPress:()=>W(!0),testID:A}),(0,_jsxRuntime.jsx)(_index5.Modal,{open:F,onClose:de,presentation:"bottom",bare:!0,haptic:!1,labels:{close:Z.dismiss},onInsetsChange:Y,children:(0,_jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView,{style:J.gestureRoot,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[J.sheetWrap,{paddingBottom:Math.max(X.bottom,U.space.lg),opacity:ue,transform:[{translateY:ne}]}],onLayout:e=>{oe.current=e.nativeEvent.layout.height},accessibilityViewIsModal:!0,accessibilityRole:"none",children:be})})})]})}const buildStyles=e=>{const t=e.shadow.popover;return _reactNative.StyleSheet.create({gestureRoot:{width:"100%"},sheetWrap:{paddingHorizontal:e.space.md,paddingBottom:e.space.lg},card:{backgroundColor:e.colors.surface,borderRadius:e.radius.xl,..._corners.smoothCorners,padding:e.space.lg,shadowColor:t.shadowColor,shadowOffset:t.shadowOffset,shadowOpacity:t.shadowOpacity,shadowRadius:t.shadowRadius,elevation:t.elevation},grabArea:{marginTop:-e.space.lg,paddingTop:e.space.sm},handle:{alignSelf:"center",width:36,height:4,borderRadius:e.radius.pill,..._corners.smoothCorners,backgroundColor:e.colors["border-subtle"],marginBottom:e.space.sm},titleRow:{marginBottom:e.space.sm},title:{fontSize:e.text.lg.size,lineHeight:Math.round(e.text.lg.size*e.leading.body),fontWeight:e.weight.semibold,color:e.colors["text-body"]},subtitle:{marginTop:e.space.xxs,fontSize:e.text.sm.size,lineHeight:Math.round(e.text.sm.size*e.leading.body),color:e.colors["text-muted"]},footer:{flexDirection:"row",justifyContent:"flex-end",alignItems:"center",marginTop:e.space.lg,gap:e.space.sm},footerBtn:{paddingHorizontal:e.space.lg,paddingVertical:e.space.sm,borderRadius:e.radius.md,..._corners.smoothCorners,minHeight:40,alignItems:"center",justifyContent:"center"},footerCancel:{backgroundColor:"transparent"},footerConfirm:{},footerBtnPressed:{opacity:.85},footerBtnText:{fontSize:e.text.sm.size,lineHeight:Math.round(e.text.sm.size*e.leading.body),fontWeight:e.weight.semibold}})};var _default=exports.default=DateRangePicker;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DecimalInput=void 0,exports.cleanDecimalText=cleanDecimalText,exports.default=void 0,exports.isUnclearDecimalComma=isUnclearDecimalComma,exports.parseDecimalText=parseDecimalText,exports.pointDecimalText=pointDecimalText;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../text/index.js"),_decimalInputG=require("../../text/phone/decimalInput.g.js"),_index2=require("../Input/index.js"),_jsxRuntime=require("react/jsx-runtime");function cleanDecimalText(e,{whole:t,signed:a,decimals:i,allowExponent:r}={}){const n=String(e??"");if(r)return n.replace(/[^\d.eE+-]/g,"");const l=Boolean(a)&&n.replace(/[^\d.,-]/g,"").startsWith("-");let o=n.replace(t?/\D/g:/[^\d.,]/g,"");const c=o.search(/[.,]/);if(-1!==c){const e=o.slice(c+1).replace(/[.,]/g,"");o=o.slice(0,c+1)+(null==i?e:e.slice(0,i))}return(l?"-":"")+o}function isUnclearDecimalComma(e){return/,\d{3}$/.test(String(e??""))}function pointDecimalText(e){return isUnclearDecimalComma(e)?e:e.replace(",",".")}function parseDecimalText(e){if(isUnclearDecimalComma(e))return"";const t=pointDecimalText(e);if(""===t||"-"===t||"."===t||"-."===t)return"";const a=Number(t);return Number.isFinite(a)?a:""}const textOf=e=>null==e?"":String(e),toNull=e=>""===e?null:e;function keyboardFor({whole:e,signed:t,allowExponent:a}){return a?"ios"===_reactNative.Platform.OS?"numbers-and-punctuation":"default":t?"numeric":e?"number-pad":"decimal-pad"}const DecimalInput=exports.DecimalInput=(0,_react.forwardRef)((e,t)=>{const{symbol:a,value:i,onChange:r,onBlur:n,min:l,max:o,whole:c=!1,signed:u=!1,decimals:s,allowExponent:m=!1,labels:p,error:d,readOnly:x=!1,disabled:D=!1,...f}=e,_=(0,_index.useMobileUiText)("decimalInput",_decimalInputG.DECIMAL_INPUT_TEXT),T=(0,_react.useMemo)(()=>({..._,...p}),[_,p]),[b,g]=(0,_react.useState)(textOf(i));(0,_react.useEffect)(()=>{g(e=>toNull(parseDecimalText(e))===(i??null)?e:textOf(i))},[i]);const I=x||D,v={whole:c,signed:u,decimals:s,allowExponent:m},C=b;return(0,_jsxRuntime.jsx)(_index2.Input,{prefix:a,keyboardType:keyboardFor(v),autoCapitalize:"none",autoCorrect:!1,readOnly:x,disabled:D,...f,ref:t,error:d??(isUnclearDecimalComma(C)?T.unclearComma:void 0),value:C,onChangeText:I?void 0:e=>{(0,_mobileCore.reportIdleActivity)();const t=cleanDecimalText(e,v),a=m?""===t?"":Number(t):parseDecimalText(t);""!==a&&Number.isFinite(a)&&(null!=o&&a>o||null!=l&&a<l)||(g(t),r?.(toNull(parseDecimalText(t))))},onBlur:I?void 0:e=>{const t=pointDecimalText(C);t!==C&&g(t),n?.(e)}})});DecimalInput.displayName="DecimalInput";var _default=exports.default=DecimalInput;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DecimalInput=DecimalInput,exports.cleanDecimalText=cleanDecimalText,exports.default=void 0,exports.isUnclearDecimalComma=isUnclearDecimalComma,exports.parseDecimalText=parseDecimalText,exports.pointDecimalText=pointDecimalText;var _mobileCore=require("@webority/mobile-core"),_react=require("react"),_reactNative=require("react-native"),_index=require("../../text/index.js"),_decimalInputG=require("../../text/phone/decimalInput.g.js"),_index2=require("../Input/index.js"),_jsxRuntime=require("react/jsx-runtime");function cleanDecimalText(e,{whole:t,signed:i,decimals:r,allowExponent:a}={}){const n=String(e??"");if(a)return n.replace(/[^\d.eE+-]/g,"");const l=Boolean(i)&&n.replace(/[^\d.,-]/g,"").startsWith("-");let o=n.replace(t?/\D/g:/[^\d.,]/g,"");const c=o.search(/[.,]/);if(-1!==c){const e=o.slice(c+1).replace(/[.,]/g,"");o=o.slice(0,c+1)+(null==r?e:e.slice(0,r))}return(l?"-":"")+o}function isUnclearDecimalComma(e){return/,\d{3}$/.test(String(e??""))}function pointDecimalText(e){return isUnclearDecimalComma(e)?e:e.replace(",",".")}function parseDecimalText(e){if(isUnclearDecimalComma(e))return"";const t=pointDecimalText(e);if(""===t||"-"===t||"."===t||"-."===t)return"";const i=Number(t);return Number.isFinite(i)?i:""}const textOf=e=>null==e?"":String(e),toNull=e=>""===e?null:e;function keyboardFor({whole:e,signed:t,allowExponent:i}){return i?"ios"===_reactNative.Platform.OS?"numbers-and-punctuation":"default":t?"numeric":e?"number-pad":"decimal-pad"}function DecimalInput(e){const{ref:t,symbol:i,value:r,onChange:a,onBlur:n,min:l,max:o,whole:c=!1,signed:u=!1,decimals:s,allowExponent:m=!1,labels:p,error:x,readOnly:d=!1,disabled:D=!1,...f}=e,T=(0,_index.useMobileUiText)("decimalInput",_decimalInputG.DECIMAL_INPUT_TEXT),_=(0,_react.useMemo)(()=>({...T,...p}),[T,p]),[b,g]=(0,_react.useState)(textOf(r));(0,_react.useEffect)(()=>{g(e=>toNull(parseDecimalText(e))===(r??null)?e:textOf(r))},[r]);const C=d||D,v={whole:c,signed:u,decimals:s,allowExponent:m},I=b;return(0,_jsxRuntime.jsx)(_index2.Input,{prefix:i,keyboardType:keyboardFor(v),autoCapitalize:"none",autoCorrect:!1,readOnly:d,disabled:D,...f,ref:t,error:x??(isUnclearDecimalComma(I)?_.unclearComma:void 0),value:I,onChangeText:C?void 0:e=>{(0,_mobileCore.reportIdleActivity)();const t=cleanDecimalText(e,v),i=m?""===t?"":Number(t):parseDecimalText(t);""!==i&&Number.isFinite(i)&&(null!=o&&i>o||null!=l&&i<l)||(g(t),a?.(toNull(parseDecimalText(t))))},onBlur:C?void 0:e=>{const t=pointDecimalText(I);t!==I&&g(t),n?.(e)}})}var _default=exports.default=DecimalInput;