@sincpro/mobile-ui 3.0.1 → 3.2.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 (314) hide show
  1. package/dist/Actions/Actions.Button.d.ts +6 -6
  2. package/dist/Actions/Actions.Button.js +650 -180
  3. package/dist/Actions/Actions.Dock.d.ts +1 -1
  4. package/dist/Actions/Actions.Dock.js +297 -18
  5. package/dist/Actions/Actions.FAB.js +100 -12
  6. package/dist/Actions/Actions.FilterButton.d.ts +17 -0
  7. package/dist/Actions/Actions.FilterButton.js +263 -33
  8. package/dist/Actions/Actions.IconButton.d.ts +1 -0
  9. package/dist/Actions/Actions.IconButton.js +196 -33
  10. package/dist/Actions/index.js +13 -13
  11. package/dist/Dialog/Confirmation.context.js +82 -16
  12. package/dist/Dialog/Dialog.ActionSheet.js +200 -41
  13. package/dist/Dialog/Dialog.Confirmation.js +168 -31
  14. package/dist/Dialog/Dialog.EditValue.js +437 -62
  15. package/dist/Dialog/Dialog.Sheet.d.ts +7 -3
  16. package/dist/Dialog/Dialog.Sheet.js +267 -15
  17. package/dist/Dialog/OverlayHost.d.ts +24 -0
  18. package/dist/Dialog/OverlayHost.js +230 -0
  19. package/dist/Dialog/SheetSurface.d.ts +43 -0
  20. package/dist/Dialog/SheetSurface.js +495 -0
  21. package/dist/Dialog/dialog-actions.d.ts +17 -0
  22. package/dist/Dialog/dialog-actions.js +59 -0
  23. package/dist/Dialog/index.d.ts +4 -1
  24. package/dist/Dialog/index.js +8 -7
  25. package/dist/Dialog/overlay.store.d.ts +24 -0
  26. package/dist/Dialog/overlay.store.js +59 -0
  27. package/dist/Dialog/requestConfirmation.js +20 -10
  28. package/dist/Display/Display.Accordion.js +185 -13
  29. package/dist/Display/Display.AmountSummary.js +206 -15
  30. package/dist/Display/Display.Avatar.js +93 -31
  31. package/dist/Display/Display.AvatarGroup.js +132 -17
  32. package/dist/Display/Display.Badge.d.ts +18 -2
  33. package/dist/Display/Display.Badge.js +117 -49
  34. package/dist/Display/Display.Card.js +163 -26
  35. package/dist/Display/Display.Carousel.js +459 -105
  36. package/dist/Display/Display.Chip.d.ts +4 -1
  37. package/dist/Display/Display.Chip.js +165 -31
  38. package/dist/Display/Display.CircleButton.d.ts +1 -0
  39. package/dist/Display/Display.CircleButton.js +86 -27
  40. package/dist/Display/Display.CopyableText.js +289 -66
  41. package/dist/Display/Display.CountRecords.js +60 -3
  42. package/dist/Display/Display.DataTable.js +123 -13
  43. package/dist/Display/Display.Date.js +243 -33
  44. package/dist/Display/Display.Divider.d.ts +10 -10
  45. package/dist/Display/Display.Divider.js +67 -20
  46. package/dist/Display/Display.ExpoImage.js +97 -8
  47. package/dist/Display/Display.GradientSurface.d.ts +9 -4
  48. package/dist/Display/Display.GradientSurface.js +196 -46
  49. package/dist/Display/Display.Icon.js +129 -15
  50. package/dist/Display/Display.IconBadge.js +95 -25
  51. package/dist/Display/Display.Image.d.ts +7 -1
  52. package/dist/Display/Display.Image.js +344 -39
  53. package/dist/Display/Display.KeyValue.js +90 -5
  54. package/dist/Display/Display.ListGroup.js +181 -9
  55. package/dist/Display/Display.ListItem.js +324 -28
  56. package/dist/Display/Display.Logo.js +84 -29
  57. package/dist/Display/Display.MediaCard.js +125 -4
  58. package/dist/Display/Display.MediaEmbed.d.ts +0 -5
  59. package/dist/Display/Display.MediaEmbed.js +170 -26
  60. package/dist/Display/Display.MenuButton.d.ts +2 -2
  61. package/dist/Display/Display.MenuButton.js +380 -94
  62. package/dist/Display/Display.MenuCard.js +122 -18
  63. package/dist/Display/Display.MenuGrid.js +43 -3
  64. package/dist/Display/Display.Monetary.js +90 -5
  65. package/dist/Display/Display.Pattern.js +306 -47
  66. package/dist/Display/Display.PriceTag.js +117 -14
  67. package/dist/Display/Display.ProductCard.js +154 -4
  68. package/dist/Display/Display.Rating.js +92 -11
  69. package/dist/Display/Display.SearchHistory.js +132 -6
  70. package/dist/Display/Display.SectionHeader.d.ts +5 -1
  71. package/dist/Display/Display.SectionHeader.js +125 -12
  72. package/dist/Display/Display.Stat.js +62 -3
  73. package/dist/Display/Display.StatCard.js +131 -7
  74. package/dist/Display/Display.StatusBadge.d.ts +29 -0
  75. package/dist/Display/Display.StatusBadge.js +68 -0
  76. package/dist/Display/Display.StatusDot.js +93 -18
  77. package/dist/Display/Display.Story.js +285 -35
  78. package/dist/Display/Display.StoryTray.js +354 -34
  79. package/dist/Display/Display.StoryViewer.js +571 -72
  80. package/dist/Display/Display.SwipeableRow.js +148 -20
  81. package/dist/Display/Display.Tag.d.ts +4 -1
  82. package/dist/Display/Display.Tag.js +66 -4
  83. package/dist/Display/Display.Timeline.js +102 -13
  84. package/dist/Display/Display.Tooltip.js +122 -26
  85. package/dist/Display/chevron.d.ts +6 -0
  86. package/dist/Display/chevron.js +32 -0
  87. package/dist/Display/count-badge.d.ts +21 -0
  88. package/dist/Display/count-badge.js +124 -0
  89. package/dist/Display/group-title.d.ts +10 -0
  90. package/dist/Display/group-title.js +53 -0
  91. package/dist/Display/icon-font.d.ts +3 -0
  92. package/dist/Display/icon-font.ios.d.ts +3 -0
  93. package/dist/Display/icon-font.ios.js +4 -0
  94. package/dist/Display/icon-font.js +7 -0
  95. package/dist/Display/icon-glyphs.d.ts +2 -0
  96. package/dist/Display/icon-glyphs.js +87 -0
  97. package/dist/Display/icon-map.d.ts +15 -11
  98. package/dist/Display/icon-map.js +344 -84
  99. package/dist/Display/icon-registry.d.ts +21 -0
  100. package/dist/Display/icon-registry.js +21 -0
  101. package/dist/Display/index.d.ts +6 -1
  102. package/dist/Display/index.js +53 -48
  103. package/dist/Display/pill.d.ts +16 -0
  104. package/dist/Display/pill.js +47 -0
  105. package/dist/Feedback/ErrorBoundary.js +35 -23
  106. package/dist/Feedback/Feedback.Banner.js +202 -24
  107. package/dist/Feedback/Feedback.DomainSplashScreen.js +246 -70
  108. package/dist/Feedback/Feedback.Empty.js +54 -3
  109. package/dist/Feedback/Feedback.EmptyState.js +114 -5
  110. package/dist/Feedback/Feedback.Error.d.ts +1 -1
  111. package/dist/Feedback/Feedback.Error.js +130 -5
  112. package/dist/Feedback/Feedback.Loading.d.ts +1 -1
  113. package/dist/Feedback/Feedback.Loading.js +70 -3
  114. package/dist/Feedback/Feedback.PermissionCard.js +161 -5
  115. package/dist/Feedback/Feedback.Progress.js +199 -41
  116. package/dist/Feedback/Feedback.ProgressCircle.js +184 -12
  117. package/dist/Feedback/Feedback.Skeleton.js +149 -36
  118. package/dist/Feedback/Feedback.Spinner.js +407 -79
  119. package/dist/Feedback/Feedback.Splash.js +240 -33
  120. package/dist/Feedback/Feedback.State.d.ts +17 -0
  121. package/dist/Feedback/Feedback.State.js +104 -0
  122. package/dist/Feedback/Toast.context.js +883 -167
  123. package/dist/Feedback/index.d.ts +3 -0
  124. package/dist/Feedback/index.js +15 -13
  125. package/dist/Form/Form.Checkbox.js +212 -22
  126. package/dist/Form/Form.ControlledCheckbox.d.ts +1 -1
  127. package/dist/Form/Form.ControlledCheckbox.js +46 -4
  128. package/dist/Form/Form.ControlledDropdown.d.ts +1 -1
  129. package/dist/Form/Form.ControlledDropdown.js +62 -4
  130. package/dist/Form/Form.ControlledInput.d.ts +4 -3
  131. package/dist/Form/Form.ControlledInput.js +72 -4
  132. package/dist/Form/Form.ControlledMonetaryInput.d.ts +6 -3
  133. package/dist/Form/Form.ControlledMonetaryInput.js +50 -4
  134. package/dist/Form/Form.ControlledRadioButton.d.ts +2 -2
  135. package/dist/Form/Form.ControlledRadioButton.js +45 -4
  136. package/dist/Form/Form.DatePicker.js +507 -107
  137. package/dist/Form/Form.Dropdown.js +303 -52
  138. package/dist/Form/Form.ErrorSummary.js +236 -44
  139. package/dist/Form/Form.Field.d.ts +24 -0
  140. package/dist/Form/Form.Field.js +55 -0
  141. package/dist/Form/Form.FractionalQuantityInput.js +508 -96
  142. package/dist/Form/Form.Input.d.ts +17 -3
  143. package/dist/Form/Form.Input.js +497 -29
  144. package/dist/Form/Form.KeyboardForm.d.ts +22 -8
  145. package/dist/Form/Form.KeyboardForm.js +83 -8
  146. package/dist/Form/Form.KeyboardToolbarHost.d.ts +14 -0
  147. package/dist/Form/Form.KeyboardToolbarHost.js +223 -0
  148. package/dist/Form/Form.MonetaryInput.js +164 -17
  149. package/dist/Form/Form.PickerField.d.ts +31 -0
  150. package/dist/Form/Form.PickerField.js +539 -0
  151. package/dist/Form/Form.PinInput.js +150 -15
  152. package/dist/Form/Form.QuantitySelector.js +229 -25
  153. package/dist/Form/Form.RadioButton.d.ts +1 -0
  154. package/dist/Form/Form.RadioButton.js +26 -29
  155. package/dist/Form/Form.Select.d.ts +2 -1
  156. package/dist/Form/Form.Select.js +388 -60
  157. package/dist/Form/Form.Slider.js +133 -10
  158. package/dist/Form/Form.Switch.js +99 -4
  159. package/dist/Form/choice-row.d.ts +15 -0
  160. package/dist/Form/choice-row.js +236 -0
  161. package/dist/Form/index.d.ts +11 -6
  162. package/dist/Form/index.js +26 -27
  163. package/dist/Form/input-text.d.ts +7 -0
  164. package/dist/Form/input-text.js +18 -0
  165. package/dist/Navigation/Navigation.AppBar.d.ts +3 -4
  166. package/dist/Navigation/Navigation.AppBar.js +535 -99
  167. package/dist/Navigation/Navigation.BottomNav.js +363 -98
  168. package/dist/Navigation/Navigation.CollapsingHeader.d.ts +28 -13
  169. package/dist/Navigation/Navigation.CollapsingHeader.js +369 -36
  170. package/dist/Navigation/Navigation.FloatingBar.js +71 -11
  171. package/dist/Navigation/Navigation.Menu.js +309 -95
  172. package/dist/Navigation/Navigation.MenuSection.js +80 -11
  173. package/dist/Navigation/Navigation.RowItem.d.ts +4 -2
  174. package/dist/Navigation/Navigation.RowItem.js +93 -8
  175. package/dist/Navigation/Navigation.Search.js +241 -27
  176. package/dist/Navigation/Navigation.SearchBar.d.ts +7 -1
  177. package/dist/Navigation/Navigation.SearchBar.js +218 -29
  178. package/dist/Navigation/Navigation.SearchSuggestions.js +77 -3
  179. package/dist/Navigation/Navigation.SegmentedControl.js +152 -14
  180. package/dist/Navigation/Navigation.Steps.js +105 -11
  181. package/dist/Navigation/Navigation.Tabs.js +449 -41
  182. package/dist/Navigation/index.d.ts +9 -4
  183. package/dist/Navigation/index.js +13 -13
  184. package/dist/Typography/Typography.Heading.js +33 -3
  185. package/dist/Typography/Typography.SelectableText.js +95 -7
  186. package/dist/Typography/Typography.Text.d.ts +4 -2
  187. package/dist/Typography/Typography.Text.js +217 -7
  188. package/dist/Typography/index.js +3 -3
  189. package/dist/branding.js +29 -13
  190. package/dist/icons/AddItemIcon.js +76 -2
  191. package/dist/icons/ArrangeCircle.js +82 -2
  192. package/dist/icons/ArrowDownIcon.js +63 -3
  193. package/dist/icons/ArrowUpIcon.js +63 -3
  194. package/dist/icons/BoxIcon.js +64 -2
  195. package/dist/icons/BoxTimeIcon.js +63 -2
  196. package/dist/icons/CalendarIcon.js +145 -2
  197. package/dist/icons/CardIcon.js +80 -2
  198. package/dist/icons/CashierIcon.js +39 -2
  199. package/dist/icons/CreditIcon.js +76 -3
  200. package/dist/icons/DuoIcon.js +75 -2
  201. package/dist/icons/HomeIcon.js +39 -2
  202. package/dist/icons/HomeIconOutlined.js +53 -2
  203. package/dist/icons/LogoIcon.js +87 -2
  204. package/dist/icons/MoneyReceiveIcon.js +86 -2
  205. package/dist/icons/PinIcon.js +39 -2
  206. package/dist/icons/ProfileIcon.js +47 -2
  207. package/dist/icons/SettingsIcon.js +114 -2
  208. package/dist/icons/SinpeIcon.js +60 -2
  209. package/dist/icons/ToggleOffIcon.js +53 -2
  210. package/dist/icons/WalletMoneyIcon.js +81 -2
  211. package/dist/index.d.ts +1 -0
  212. package/dist/index.js +8 -2
  213. package/dist/layouts/AuthContainer.d.ts +4 -5
  214. package/dist/layouts/AuthContainer.js +231 -7
  215. package/dist/layouts/BottomInset.js +4 -1
  216. package/dist/layouts/Container.d.ts +2 -2
  217. package/dist/layouts/Container.js +45 -3
  218. package/dist/layouts/GradientContainer.js +37 -5
  219. package/dist/layouts/PlainLayout.js +19 -3
  220. package/dist/layouts/ScrollContainer.d.ts +14 -9
  221. package/dist/layouts/ScrollContainer.js +125 -4
  222. package/dist/layouts/edges.d.ts +2 -0
  223. package/dist/layouts/edges.js +1 -0
  224. package/dist/primitives/AspectRatio.js +75 -3
  225. package/dist/primitives/Box.js +45 -3
  226. package/dist/primitives/Pressable.js +95 -5
  227. package/dist/primitives/Row.js +84 -13
  228. package/dist/primitives/Spacer.js +42 -5
  229. package/dist/primitives/Stack.js +66 -7
  230. package/dist/primitives/index.js +1 -1
  231. package/dist/theme/active.d.ts +2 -0
  232. package/dist/theme/active.js +33 -18
  233. package/dist/theme/build.js +118 -87
  234. package/dist/theme/color.js +87 -87
  235. package/dist/theme/components/ThemedActivityIndicator.d.ts +2 -15
  236. package/dist/theme/components/ThemedActivityIndicator.js +35 -3
  237. package/dist/theme/components/index.js +1 -0
  238. package/dist/theme/contrast.js +32 -33
  239. package/dist/theme/css-vars.js +71 -75
  240. package/dist/theme/dark.js +116 -97
  241. package/dist/theme/default.js +116 -97
  242. package/dist/theme/define.js +16 -12
  243. package/dist/theme/index.d.ts +1 -0
  244. package/dist/theme/index.js +7 -6
  245. package/dist/theme/on-dark-surface.d.ts +12 -0
  246. package/dist/theme/on-dark-surface.js +13 -0
  247. package/dist/theme/theme.js +1 -0
  248. package/dist/theme/tw.js +3 -1
  249. package/dist/theme/types.js +0 -18
  250. package/dist/theme/typography.d.ts +1 -1
  251. package/dist/theme/typography.js +337 -303
  252. package/dist/theme/useTheme.d.ts +4 -0
  253. package/dist/theme/useTheme.js +7 -3
  254. package/dist/theme/useThemeVars.d.ts +9 -0
  255. package/dist/theme/useThemeVars.js +23 -0
  256. package/dist/theme/validate.js +175 -166
  257. package/dist/tokens/index.js +1 -1
  258. package/dist/tokens/motion.js +30 -13
  259. package/dist/utils/async.d.ts +14 -0
  260. package/dist/utils/async.js +22 -0
  261. package/dist/utils/criteria.js +66 -85
  262. package/dist/utils/date.d.ts +8 -2
  263. package/dist/utils/date.js +63 -50
  264. package/dist/utils/image.js +8 -8
  265. package/dist/utils/intl.d.ts +1 -0
  266. package/dist/utils/intl.js +13 -0
  267. package/dist/utils/keys.js +3 -5
  268. package/dist/utils/monetary.d.ts +1 -0
  269. package/dist/utils/monetary.js +28 -24
  270. package/dist/utils/progress.js +2 -3
  271. package/dist/utils/quantity.js +25 -26
  272. package/dist/utils/reorder.js +11 -20
  273. package/dist/utils/search.d.ts +4 -0
  274. package/dist/utils/search.js +12 -0
  275. package/dist/utils/serializer.js +38 -38
  276. package/dist/utils/useReducedMotion.js +32 -30
  277. package/dist/views/AppSplashView.js +117 -3
  278. package/dist/views/AuthFormView.d.ts +4 -5
  279. package/dist/views/AuthFormView.js +119 -11
  280. package/dist/views/FormViewV2.context.js +75 -23
  281. package/dist/views/FormViewV2.d.ts +4 -5
  282. package/dist/views/FormViewV2.js +658 -92
  283. package/dist/views/ListViewV2.context.js +91 -47
  284. package/dist/views/ListViewV2.d.ts +84 -43
  285. package/dist/views/ListViewV2.js +1350 -200
  286. package/dist/views/Wizard/Wizard.context.js +248 -84
  287. package/dist/views/Wizard/Wizard.js +260 -67
  288. package/dist/views/types/IListView.js +34 -31
  289. package/dist/widgets/CollectionOptions.js +557 -138
  290. package/dist/widgets/FilterBar.js +159 -7
  291. package/dist/widgets/FilterBuilder.js +375 -102
  292. package/dist/widgets/JSONViewer.js +275 -129
  293. package/dist/widgets/PromoBanner.js +336 -42
  294. package/dist/widgets/PromoModal.d.ts +2 -2
  295. package/dist/widgets/PromoModal.js +389 -62
  296. package/dist/widgets/QueryChoice.js +150 -8
  297. package/dist/widgets/QuickActions.js +120 -31
  298. package/dist/widgets/ReorderableList.js +399 -128
  299. package/dist/widgets/TimeZoneSelectorModal.js +458 -51
  300. package/dist/widgets/index.js +3 -3
  301. package/package.json +6 -1
  302. package/tailwind.preset.js +7 -5
  303. package/dist/Form/Form.InputField.d.ts +0 -10
  304. package/dist/Form/Form.InputField.js +0 -38
  305. package/dist/Form/Form.KeyboardToolbar.d.ts +0 -22
  306. package/dist/Form/Form.KeyboardToolbar.js +0 -66
  307. package/dist/Form/Form.PasswordInput.d.ts +0 -9
  308. package/dist/Form/Form.PasswordInput.js +0 -17
  309. package/dist/Form/Form.TextInput.d.ts +0 -8
  310. package/dist/Form/Form.TextInput.js +0 -8
  311. package/dist/primitives/BaseButton.d.ts +0 -150
  312. package/dist/primitives/BaseButton.js +0 -229
  313. package/dist/utils/useSheetTranslation.d.ts +0 -5
  314. package/dist/utils/useSheetTranslation.js +0 -23
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "nativewind/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { OverlayPortal } from "../Dialog/OverlayHost.js";
2
3
  import Icon from "../Display/Display.Icon.js";
3
4
  import Spinner from "./Feedback.Spinner.js";
4
5
  import Pressable from "../primitives/Pressable.js";
@@ -6,197 +7,912 @@ import { useTheme } from "../theme/index.js";
6
7
  import { cn, tv } from "../theme/tw.js";
7
8
  import { Typography } from "../Typography/index.js";
8
9
  import { useReducedMotion } from "../utils/useReducedMotion.js";
9
- import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
10
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
10
11
  import { View } from "react-native";
11
12
  import { GestureDetector, usePanGesture } from "react-native-gesture-handler";
12
- import Animated, { FadeInDown, FadeInUp, FadeOutDown, FadeOutUp, } from "react-native-reanimated";
13
+ import Animated, { FadeInDown, FadeInUp, FadeOutDown, FadeOutUp } from "react-native-reanimated";
13
14
  import { useSafeAreaInsets } from "react-native-safe-area-context";
14
- function ToastRoot({ children, accessibilityHint = "Usa Cerrar o desliza hacia arriba o abajo para cerrar", className, position = "top", style, testID, ...viewProps }) {
15
- const reducedMotion = useReducedMotion();
15
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "nativewind/jsx-runtime";
16
+ function ToastRoot(t0) {
17
+ const $ = _c(38);
18
+ let children;
19
+ let className;
20
+ let style;
21
+ let t1;
22
+ let t2;
23
+ let testID;
24
+ let viewProps;
25
+ if ($[0] !== t0) {
26
+ ({
27
+ children,
28
+ accessibilityHint: t1,
29
+ className,
30
+ position: t2,
31
+ style,
32
+ testID,
33
+ ...viewProps
34
+ } = t0);
35
+ $[0] = t0;
36
+ $[1] = children;
37
+ $[2] = className;
38
+ $[3] = style;
39
+ $[4] = t1;
40
+ $[5] = t2;
41
+ $[6] = testID;
42
+ $[7] = viewProps;
43
+ } else {
44
+ children = $[1];
45
+ className = $[2];
46
+ style = $[3];
47
+ t1 = $[4];
48
+ t2 = $[5];
49
+ testID = $[6];
50
+ viewProps = $[7];
51
+ }
52
+ const accessibilityHint = t1 === undefined ? "Usa Cerrar o desliza hacia arriba o abajo para cerrar" : t1;
53
+ const position = t2 === undefined ? "top" : t2;
54
+ const reducedMotion = useReducedMotion();
55
+ let T0;
56
+ let entering;
57
+ let exiting;
58
+ let t3;
59
+ let t4;
60
+ let t5;
61
+ let t6;
62
+ let t7;
63
+ if ($[8] !== accessibilityHint || $[9] !== className || $[10] !== position || $[11] !== viewProps) {
16
64
  const styles = toast();
17
- const entering = position === "top" ? FadeInDown : FadeInUp;
18
- const exiting = position === "top" ? FadeOutUp : FadeOutDown;
19
- return (_jsx(Animated.View, { ...viewProps, accessibilityHint: accessibilityHint, accessibilityLiveRegion: "polite", accessibilityRole: "alert", className: styles.root({ className }), entering: reducedMotion ? undefined : entering.duration(220), exiting: reducedMotion ? undefined : exiting.duration(180), style: style, testID: testID, children: children }));
65
+ entering = position === "top" ? FadeInDown : FadeInUp;
66
+ exiting = position === "top" ? FadeOutUp : FadeOutDown;
67
+ T0 = Animated.View;
68
+ t3 = viewProps;
69
+ t4 = accessibilityHint;
70
+ t5 = "polite";
71
+ t6 = "alert";
72
+ t7 = styles.root({
73
+ className
74
+ });
75
+ $[8] = accessibilityHint;
76
+ $[9] = className;
77
+ $[10] = position;
78
+ $[11] = viewProps;
79
+ $[12] = T0;
80
+ $[13] = entering;
81
+ $[14] = exiting;
82
+ $[15] = t3;
83
+ $[16] = t4;
84
+ $[17] = t5;
85
+ $[18] = t6;
86
+ $[19] = t7;
87
+ } else {
88
+ T0 = $[12];
89
+ entering = $[13];
90
+ exiting = $[14];
91
+ t3 = $[15];
92
+ t4 = $[16];
93
+ t5 = $[17];
94
+ t6 = $[18];
95
+ t7 = $[19];
96
+ }
97
+ let t8;
98
+ if ($[20] !== entering || $[21] !== reducedMotion) {
99
+ t8 = reducedMotion ? undefined : entering.duration(220);
100
+ $[20] = entering;
101
+ $[21] = reducedMotion;
102
+ $[22] = t8;
103
+ } else {
104
+ t8 = $[22];
105
+ }
106
+ let t9;
107
+ if ($[23] !== exiting || $[24] !== reducedMotion) {
108
+ t9 = reducedMotion ? undefined : exiting.duration(180);
109
+ $[23] = exiting;
110
+ $[24] = reducedMotion;
111
+ $[25] = t9;
112
+ } else {
113
+ t9 = $[25];
114
+ }
115
+ let t10;
116
+ if ($[26] !== T0 || $[27] !== children || $[28] !== style || $[29] !== t3 || $[30] !== t4 || $[31] !== t5 || $[32] !== t6 || $[33] !== t7 || $[34] !== t8 || $[35] !== t9 || $[36] !== testID) {
117
+ t10 = _jsx(T0, {
118
+ ...t3,
119
+ accessibilityHint: t4,
120
+ accessibilityLiveRegion: t5,
121
+ accessibilityRole: t6,
122
+ className: t7,
123
+ entering: t8,
124
+ exiting: t9,
125
+ style: style,
126
+ testID: testID,
127
+ children: children
128
+ });
129
+ $[26] = T0;
130
+ $[27] = children;
131
+ $[28] = style;
132
+ $[29] = t3;
133
+ $[30] = t4;
134
+ $[31] = t5;
135
+ $[32] = t6;
136
+ $[33] = t7;
137
+ $[34] = t8;
138
+ $[35] = t9;
139
+ $[36] = testID;
140
+ $[37] = t10;
141
+ } else {
142
+ t10 = $[37];
143
+ }
144
+ return t10;
20
145
  }
21
- function ToastIcon({ variant = "info", icon, color, size = 22 }) {
22
- const theme = useTheme();
23
- if (icon)
24
- return _jsx(_Fragment, { children: icon });
25
- if (variant === "loading") {
26
- return (_jsx(Spinner, { accessibilityLabel: "Cargando", color: color ?? theme.text.accent, size: "small" }));
146
+ function ToastIcon(t0) {
147
+ const $ = _c(13);
148
+ const {
149
+ variant: t1,
150
+ icon,
151
+ color,
152
+ size: t2
153
+ } = t0;
154
+ const variant = t1 === undefined ? "info" : t1;
155
+ const size = t2 === undefined ? 22 : t2;
156
+ const theme = useTheme();
157
+ if (icon) {
158
+ let t3;
159
+ if ($[0] !== icon) {
160
+ t3 = _jsx(_Fragment, {
161
+ children: icon
162
+ });
163
+ $[0] = icon;
164
+ $[1] = t3;
165
+ } else {
166
+ t3 = $[1];
167
+ }
168
+ return t3;
169
+ }
170
+ if (variant === "loading") {
171
+ const t3 = color ?? theme.text.accent;
172
+ let t4;
173
+ if ($[2] !== t3) {
174
+ t4 = _jsx(Spinner, {
175
+ accessibilityLabel: "Cargando",
176
+ color: t3,
177
+ size: "small"
178
+ });
179
+ $[2] = t3;
180
+ $[3] = t4;
181
+ } else {
182
+ t4 = $[3];
27
183
  }
28
- const colors = {
29
- info: theme.info,
30
- success: theme.success,
31
- warning: theme.warning,
32
- danger: theme.danger,
184
+ return t4;
185
+ }
186
+ let t3;
187
+ if ($[4] !== theme.danger || $[5] !== theme.info || $[6] !== theme.success || $[7] !== theme.warning) {
188
+ t3 = {
189
+ info: theme.info,
190
+ success: theme.success,
191
+ warning: theme.warning,
192
+ danger: theme.danger
33
193
  };
34
- return _jsx(Icon, { color: color ?? colors[variant], name: iconByVariant[variant], size: size });
194
+ $[4] = theme.danger;
195
+ $[5] = theme.info;
196
+ $[6] = theme.success;
197
+ $[7] = theme.warning;
198
+ $[8] = t3;
199
+ } else {
200
+ t3 = $[8];
201
+ }
202
+ const colors = t3;
203
+ const t4 = color ?? colors[variant];
204
+ const t5 = iconByVariant[variant];
205
+ let t6;
206
+ if ($[9] !== size || $[10] !== t4 || $[11] !== t5) {
207
+ t6 = _jsx(Icon, {
208
+ color: t4,
209
+ name: t5,
210
+ size: size
211
+ });
212
+ $[9] = size;
213
+ $[10] = t4;
214
+ $[11] = t5;
215
+ $[12] = t6;
216
+ } else {
217
+ t6 = $[12];
218
+ }
219
+ return t6;
35
220
  }
36
- function ToastContent({ children, className, style }) {
37
- return (_jsx(View, { className: cn("flex-1", className), style: style, children: children }));
221
+ function ToastContent(t0) {
222
+ const $ = _c(6);
223
+ const {
224
+ children,
225
+ className,
226
+ style
227
+ } = t0;
228
+ let t1;
229
+ if ($[0] !== className) {
230
+ t1 = cn("flex-1", className);
231
+ $[0] = className;
232
+ $[1] = t1;
233
+ } else {
234
+ t1 = $[1];
235
+ }
236
+ let t2;
237
+ if ($[2] !== children || $[3] !== style || $[4] !== t1) {
238
+ t2 = _jsx(View, {
239
+ className: t1,
240
+ style: style,
241
+ children: children
242
+ });
243
+ $[2] = children;
244
+ $[3] = style;
245
+ $[4] = t1;
246
+ $[5] = t2;
247
+ } else {
248
+ t2 = $[5];
249
+ }
250
+ return t2;
38
251
  }
39
- function ToastTitle({ children, className }) {
40
- return (_jsx(Typography.Text, { className: cn("text-sm font-semibold text-text-primary", className), children: children }));
252
+ function ToastTitle(t0) {
253
+ const $ = _c(5);
254
+ const {
255
+ children,
256
+ className
257
+ } = t0;
258
+ let t1;
259
+ if ($[0] !== className) {
260
+ t1 = cn("text-text-primary", className);
261
+ $[0] = className;
262
+ $[1] = t1;
263
+ } else {
264
+ t1 = $[1];
265
+ }
266
+ let t2;
267
+ if ($[2] !== children || $[3] !== t1) {
268
+ t2 = _jsx(Typography.Text, {
269
+ className: t1,
270
+ children: children
271
+ });
272
+ $[2] = children;
273
+ $[3] = t1;
274
+ $[4] = t2;
275
+ } else {
276
+ t2 = $[4];
277
+ }
278
+ return t2;
41
279
  }
42
- function ToastDescription({ children, className }) {
43
- return (_jsx(Typography.Text, { className: cn("text-sm text-text-secondary", className), children: children }));
280
+ function ToastDescription(t0) {
281
+ const $ = _c(5);
282
+ const {
283
+ children,
284
+ className
285
+ } = t0;
286
+ let t1;
287
+ if ($[0] !== className) {
288
+ t1 = cn("text-text-secondary", className);
289
+ $[0] = className;
290
+ $[1] = t1;
291
+ } else {
292
+ t1 = $[1];
293
+ }
294
+ let t2;
295
+ if ($[2] !== children || $[3] !== t1) {
296
+ t2 = _jsx(Typography.Text, {
297
+ className: t1,
298
+ children: children
299
+ });
300
+ $[2] = children;
301
+ $[3] = t1;
302
+ $[4] = t2;
303
+ } else {
304
+ t2 = $[4];
305
+ }
306
+ return t2;
44
307
  }
45
- function ToastActionButton({ label, onPress, className, style, ...props }) {
46
- return (_jsx(Pressable, { ...props, accessibilityLabel: label, accessibilityRole: "button", className: cn("min-h-12 justify-center px-2", className), onPress: onPress, style: [{ minHeight: 48, minWidth: 48 }, style], children: _jsx(Typography.Text, { className: "text-sm font-semibold text-text-accent", children: label }) }));
308
+ function ToastActionButton(t0) {
309
+ const $ = _c(20);
310
+ let className;
311
+ let label;
312
+ let onPress;
313
+ let props;
314
+ let style;
315
+ if ($[0] !== t0) {
316
+ ({
317
+ label,
318
+ onPress,
319
+ className,
320
+ style,
321
+ ...props
322
+ } = t0);
323
+ $[0] = t0;
324
+ $[1] = className;
325
+ $[2] = label;
326
+ $[3] = onPress;
327
+ $[4] = props;
328
+ $[5] = style;
329
+ } else {
330
+ className = $[1];
331
+ label = $[2];
332
+ onPress = $[3];
333
+ props = $[4];
334
+ style = $[5];
335
+ }
336
+ let t1;
337
+ if ($[6] !== className) {
338
+ t1 = cn("min-h-12 justify-center px-2", className);
339
+ $[6] = className;
340
+ $[7] = t1;
341
+ } else {
342
+ t1 = $[7];
343
+ }
344
+ let t2;
345
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
346
+ t2 = {
347
+ minHeight: 48,
348
+ minWidth: 48
349
+ };
350
+ $[8] = t2;
351
+ } else {
352
+ t2 = $[8];
353
+ }
354
+ let t3;
355
+ if ($[9] !== style) {
356
+ t3 = [t2, style];
357
+ $[9] = style;
358
+ $[10] = t3;
359
+ } else {
360
+ t3 = $[10];
361
+ }
362
+ let t4;
363
+ if ($[11] !== label) {
364
+ t4 = _jsx(Typography.Text, {
365
+ className: "text-text-accent",
366
+ children: label
367
+ });
368
+ $[11] = label;
369
+ $[12] = t4;
370
+ } else {
371
+ t4 = $[12];
372
+ }
373
+ let t5;
374
+ if ($[13] !== label || $[14] !== onPress || $[15] !== props || $[16] !== t1 || $[17] !== t3 || $[18] !== t4) {
375
+ t5 = _jsx(Pressable, {
376
+ ...props,
377
+ accessibilityLabel: label,
378
+ accessibilityRole: "button",
379
+ className: t1,
380
+ onPress: onPress,
381
+ style: t3,
382
+ children: t4
383
+ });
384
+ $[13] = label;
385
+ $[14] = onPress;
386
+ $[15] = props;
387
+ $[16] = t1;
388
+ $[17] = t3;
389
+ $[18] = t4;
390
+ $[19] = t5;
391
+ } else {
392
+ t5 = $[19];
393
+ }
394
+ return t5;
47
395
  }
48
- function ToastClose({ onPress, accessibilityLabel = "Cerrar", className, style, ...props }) {
49
- const theme = useTheme();
50
- return (_jsx(Pressable, { ...props, accessibilityLabel: accessibilityLabel, accessibilityRole: "button", className: cn("min-h-12 min-w-12 items-center justify-center", className), hitSlop: 8, onPress: onPress, style: [{ minHeight: 48, minWidth: 48 }, style], children: _jsx(Icon, { color: theme.text.tertiary, name: "close", size: 18 }) }));
396
+ function ToastClose(t0) {
397
+ const $ = _c(20);
398
+ let className;
399
+ let onPress;
400
+ let props;
401
+ let style;
402
+ let t1;
403
+ if ($[0] !== t0) {
404
+ ({
405
+ onPress,
406
+ accessibilityLabel: t1,
407
+ className,
408
+ style,
409
+ ...props
410
+ } = t0);
411
+ $[0] = t0;
412
+ $[1] = className;
413
+ $[2] = onPress;
414
+ $[3] = props;
415
+ $[4] = style;
416
+ $[5] = t1;
417
+ } else {
418
+ className = $[1];
419
+ onPress = $[2];
420
+ props = $[3];
421
+ style = $[4];
422
+ t1 = $[5];
423
+ }
424
+ const accessibilityLabel = t1 === undefined ? "Cerrar" : t1;
425
+ const theme = useTheme();
426
+ let t2;
427
+ if ($[6] !== className) {
428
+ t2 = cn("min-h-12 min-w-12 items-center justify-center", className);
429
+ $[6] = className;
430
+ $[7] = t2;
431
+ } else {
432
+ t2 = $[7];
433
+ }
434
+ let t3;
435
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
436
+ t3 = {
437
+ minHeight: 48,
438
+ minWidth: 48
439
+ };
440
+ $[8] = t3;
441
+ } else {
442
+ t3 = $[8];
443
+ }
444
+ let t4;
445
+ if ($[9] !== style) {
446
+ t4 = [t3, style];
447
+ $[9] = style;
448
+ $[10] = t4;
449
+ } else {
450
+ t4 = $[10];
451
+ }
452
+ let t5;
453
+ if ($[11] !== theme.text.tertiary) {
454
+ t5 = _jsx(Icon, {
455
+ color: theme.text.tertiary,
456
+ name: "close",
457
+ size: 18
458
+ });
459
+ $[11] = theme.text.tertiary;
460
+ $[12] = t5;
461
+ } else {
462
+ t5 = $[12];
463
+ }
464
+ let t6;
465
+ if ($[13] !== accessibilityLabel || $[14] !== onPress || $[15] !== props || $[16] !== t2 || $[17] !== t4 || $[18] !== t5) {
466
+ t6 = _jsx(Pressable, {
467
+ ...props,
468
+ accessibilityLabel: accessibilityLabel,
469
+ accessibilityRole: "button",
470
+ className: t2,
471
+ hitSlop: 8,
472
+ onPress: onPress,
473
+ style: t4,
474
+ children: t5
475
+ });
476
+ $[13] = accessibilityLabel;
477
+ $[14] = onPress;
478
+ $[15] = props;
479
+ $[16] = t2;
480
+ $[17] = t4;
481
+ $[18] = t5;
482
+ $[19] = t6;
483
+ } else {
484
+ t6 = $[19];
485
+ }
486
+ return t6;
51
487
  }
52
488
  export const Toast = {
53
- Root: ToastRoot,
54
- Icon: ToastIcon,
55
- Content: ToastContent,
56
- Title: ToastTitle,
57
- Description: ToastDescription,
58
- Action: ToastActionButton,
59
- Close: ToastClose,
489
+ Root: ToastRoot,
490
+ Icon: ToastIcon,
491
+ Content: ToastContent,
492
+ Title: ToastTitle,
493
+ Description: ToastDescription,
494
+ Action: ToastActionButton,
495
+ Close: ToastClose
60
496
  };
61
497
  const ToastContext = createContext(null);
62
498
  const DEFAULT_DURATION = 3500;
499
+
63
500
  // iOS-style card: rounded, hairline border + soft shadow, neutral surface. The variant is
64
501
  // conveyed by the colored icon (no left-accent stripe — it doesn't read well on iOS).
65
502
  const toast = tv({
66
- slots: {
67
- root: "flex-row items-center gap-3 rounded-2xl px-4 py-3 bg-bg-card border border-border-light shadow-lg",
68
- title: "text-sm font-semibold text-text-primary",
69
- message: "text-sm text-text-secondary",
70
- },
503
+ slots: {
504
+ root: "flex-row items-center gap-3 rounded-2xl px-4 py-3 bg-bg-card border border-border-light shadow-lg",
505
+ title: "text-sm font-semibold text-text-primary",
506
+ message: "text-sm text-text-secondary"
507
+ }
71
508
  });
72
509
  const iconByVariant = {
73
- info: "info",
74
- success: "success",
75
- warning: "warning",
76
- danger: "dismiss",
510
+ info: "info",
511
+ success: "success",
512
+ warning: "warning",
513
+ danger: "dismiss"
77
514
  };
78
- function ToastItem({ entry, onHide, onUpdate, position, }) {
79
- const variant = entry.variant ?? "info";
80
- const showClose = entry.dismissible ?? true;
81
- const dismiss = () => onHide(entry.id);
82
- const pan = usePanGesture({
83
- activeOffsetY: [-12, 12],
84
- failOffsetX: [-24, 24],
85
- onDeactivate: ({ canceled, translationY, velocityY }) => {
86
- if (!canceled && (Math.abs(translationY) >= 48 || Math.abs(velocityY) >= 800)) {
87
- dismiss();
88
- }
89
- },
90
- });
91
- return (_jsx(GestureDetector, { gesture: pan, children: _jsx(Toast.Root, { className: entry.className, onAccessibilityEscape: dismiss, position: position, children: entry.render ? (entry.render({
92
- dismiss,
93
- id: entry.id,
94
- update: (options) => onUpdate(entry.id, options),
95
- })) : (_jsxs(_Fragment, { children: [_jsx(Toast.Icon, { variant: variant }), _jsxs(Toast.Content, { children: [entry.title ? _jsx(Toast.Title, { children: entry.title }) : null, entry.message ? _jsx(Toast.Description, { children: entry.message }) : null] }), entry.action ? (_jsx(Toast.Action, { label: entry.action.label, onPress: () => {
96
- entry.action?.onPress();
97
- dismiss();
98
- } })) : null, showClose ? _jsx(Toast.Close, { onPress: dismiss }) : null] })) }) }));
99
- }
100
- export function ToastProvider({ children, position = "bottom", }) {
101
- const insets = useSafeAreaInsets();
102
- const [toasts, setToasts] = useState([]);
103
- const toastsRef = useRef([]);
104
- const counter = useRef(0);
105
- const timers = useRef({});
106
- const commitToasts = useCallback((next) => {
107
- toastsRef.current = next;
108
- setToasts(next);
109
- }, []);
110
- const clearTimer = useCallback((id) => {
111
- const timer = timers.current[id];
112
- if (timer !== undefined) {
113
- clearTimeout(timer);
114
- delete timers.current[id];
515
+ function ToastItem(t0) {
516
+ const $ = _c(21);
517
+ const {
518
+ entry,
519
+ onHide,
520
+ onUpdate,
521
+ position
522
+ } = t0;
523
+ const variant = entry.variant ?? "info";
524
+ const showClose = entry.dismissible ?? true;
525
+ let t1;
526
+ if ($[0] !== entry.id || $[1] !== onHide) {
527
+ t1 = () => onHide(entry.id);
528
+ $[0] = entry.id;
529
+ $[1] = onHide;
530
+ $[2] = t1;
531
+ } else {
532
+ t1 = $[2];
533
+ }
534
+ const dismiss = t1;
535
+ let t2;
536
+ let t3;
537
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
538
+ t2 = [-12, 12];
539
+ t3 = [-24, 24];
540
+ $[3] = t2;
541
+ $[4] = t3;
542
+ } else {
543
+ t2 = $[3];
544
+ t3 = $[4];
545
+ }
546
+ let t4;
547
+ if ($[5] !== dismiss) {
548
+ t4 = {
549
+ activeOffsetY: t2,
550
+ failOffsetX: t3,
551
+ onDeactivate: t5 => {
552
+ const {
553
+ canceled,
554
+ translationY,
555
+ velocityY
556
+ } = t5;
557
+ if (!canceled && (Math.abs(translationY) >= 48 || Math.abs(velocityY) >= 800)) {
558
+ dismiss();
115
559
  }
116
- }, []);
117
- const hide = useCallback((id) => {
118
- commitToasts(toastsRef.current.filter((t) => t.id !== id));
119
- clearTimer(id);
120
- }, [clearTimer, commitToasts]);
121
- const scheduleDismiss = useCallback((id, variant, duration) => {
122
- clearTimer(id);
123
- const resolved = duration ?? (variant === "loading" ? 0 : DEFAULT_DURATION);
124
- if (resolved > 0) {
125
- timers.current[id] = setTimeout(() => hide(id), resolved);
126
- }
127
- }, [clearTimer, hide]);
128
- const show = useCallback((options) => {
129
- let id = options.id;
130
- if (!id) {
131
- counter.current += 1;
132
- id = `toast-${counter.current}`;
560
+ }
561
+ };
562
+ $[5] = dismiss;
563
+ $[6] = t4;
564
+ } else {
565
+ t4 = $[6];
566
+ }
567
+ const pan = usePanGesture(t4);
568
+ let t5;
569
+ if ($[7] !== dismiss || $[8] !== entry || $[9] !== onUpdate || $[10] !== showClose || $[11] !== variant) {
570
+ t5 = entry.render ? entry.render({
571
+ dismiss,
572
+ id: entry.id,
573
+ update: options => onUpdate(entry.id, options)
574
+ }) : _jsxs(_Fragment, {
575
+ children: [_jsx(Toast.Icon, {
576
+ variant: variant
577
+ }), _jsxs(Toast.Content, {
578
+ children: [entry.title ? _jsx(Toast.Title, {
579
+ children: entry.title
580
+ }) : null, entry.message ? _jsx(Toast.Description, {
581
+ children: entry.message
582
+ }) : null]
583
+ }), entry.action ? _jsx(Toast.Action, {
584
+ label: entry.action.label,
585
+ onPress: () => {
586
+ entry.action?.onPress();
587
+ dismiss();
133
588
  }
134
- const toastId = id;
135
- const current = toastsRef.current;
136
- const currentEntry = current.find((entry) => entry.id === toastId);
137
- const nextEntry = {
138
- ...currentEntry,
139
- ...options,
140
- id: toastId,
141
- message: options.message ?? currentEntry?.message ?? "",
142
- };
143
- commitToasts(currentEntry
144
- ? current.map((entry) => (entry.id === toastId ? nextEntry : entry))
145
- : [...current, nextEntry]);
146
- scheduleDismiss(toastId, nextEntry.variant, nextEntry.duration);
147
- return toastId;
148
- }, [commitToasts, scheduleDismiss]);
149
- const update = useCallback((id, options) => {
150
- const current = toastsRef.current.find((entry) => entry.id === id);
151
- if (!current)
152
- return;
153
- const updated = { ...current, ...options, id };
154
- commitToasts(toastsRef.current.map((entry) => (entry.id === id ? updated : entry)));
155
- scheduleDismiss(id, updated.variant, updated.duration);
156
- }, [commitToasts, scheduleDismiss]);
157
- useEffect(() => () => {
158
- Object.values(timers.current).forEach(clearTimeout);
159
- timers.current = {};
160
- }, []);
161
- const value = useMemo(() => {
162
- const promise = (p, messages) => {
163
- const id = show({ message: messages.loading, variant: "loading", duration: 0 });
164
- return p.then((result) => {
165
- const msg = messages.success;
166
- update(id, {
167
- message: typeof msg === "function" ? msg(result) : msg,
168
- variant: "success",
169
- duration: DEFAULT_DURATION,
170
- });
171
- return result;
172
- }, (err) => {
173
- const msg = messages.error;
174
- update(id, {
175
- message: typeof msg === "function" ? msg(err) : msg,
176
- variant: "danger",
177
- duration: DEFAULT_DURATION,
178
- });
179
- throw err;
180
- });
181
- };
182
- return {
183
- show,
184
- update,
185
- hide,
186
- info: (message, options) => show({ ...options, message, variant: "info" }),
187
- success: (message, options) => show({ ...options, message, variant: "success" }),
188
- warning: (message, options) => show({ ...options, message, variant: "warning" }),
189
- danger: (message, options) => show({ ...options, message, variant: "danger" }),
190
- loading: (message, options) => show({ ...options, message, variant: "loading" }),
191
- promise,
192
- };
193
- }, [show, update, hide]);
194
- return (_jsxs(ToastContext.Provider, { value: value, children: [children, _jsx(View, { className: "absolute left-0 right-0 px-4 gap-2 z-toast", pointerEvents: "box-none", style: position === "top" ? { top: insets.top + 12 } : { bottom: insets.bottom + 12 }, children: toasts.map((entry) => (_jsx(ToastItem, { entry: entry, onHide: hide, onUpdate: update, position: position }, entry.id))) })] }));
589
+ }) : null, showClose ? _jsx(Toast.Close, {
590
+ onPress: dismiss
591
+ }) : null]
592
+ });
593
+ $[7] = dismiss;
594
+ $[8] = entry;
595
+ $[9] = onUpdate;
596
+ $[10] = showClose;
597
+ $[11] = variant;
598
+ $[12] = t5;
599
+ } else {
600
+ t5 = $[12];
601
+ }
602
+ let t6;
603
+ if ($[13] !== dismiss || $[14] !== entry.className || $[15] !== position || $[16] !== t5) {
604
+ t6 = _jsx(Toast.Root, {
605
+ className: entry.className,
606
+ onAccessibilityEscape: dismiss,
607
+ position: position,
608
+ children: t5
609
+ });
610
+ $[13] = dismiss;
611
+ $[14] = entry.className;
612
+ $[15] = position;
613
+ $[16] = t5;
614
+ $[17] = t6;
615
+ } else {
616
+ t6 = $[17];
617
+ }
618
+ let t7;
619
+ if ($[18] !== pan || $[19] !== t6) {
620
+ t7 = _jsx(GestureDetector, {
621
+ gesture: pan,
622
+ children: t6
623
+ });
624
+ $[18] = pan;
625
+ $[19] = t6;
626
+ $[20] = t7;
627
+ } else {
628
+ t7 = $[20];
629
+ }
630
+ return t7;
195
631
  }
196
- export function useToast() {
197
- const ctx = useContext(ToastContext);
198
- if (!ctx) {
199
- throw new Error("useToast debe usarse dentro de <ToastProvider>");
632
+ export function ToastProvider(t0) {
633
+ const $ = _c(28);
634
+ const {
635
+ children,
636
+ position: t1
637
+ } = t0;
638
+ const position = t1 === undefined ? "bottom" : t1;
639
+ const insets = useSafeAreaInsets();
640
+ let t2;
641
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
642
+ t2 = [];
643
+ $[0] = t2;
644
+ } else {
645
+ t2 = $[0];
646
+ }
647
+ const [toasts, setToasts] = useState(t2);
648
+ let t3;
649
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
650
+ t3 = [];
651
+ $[1] = t3;
652
+ } else {
653
+ t3 = $[1];
654
+ }
655
+ const toastsRef = useRef(t3);
656
+ const counter = useRef(0);
657
+ let t4;
658
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
659
+ t4 = {};
660
+ $[2] = t4;
661
+ } else {
662
+ t4 = $[2];
663
+ }
664
+ const timers = useRef(t4);
665
+ let t5;
666
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
667
+ t5 = next => {
668
+ toastsRef.current = next;
669
+ setToasts(next);
670
+ };
671
+ $[3] = t5;
672
+ } else {
673
+ t5 = $[3];
674
+ }
675
+ const commitToasts = t5;
676
+ let t6;
677
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
678
+ t6 = id => {
679
+ const timer = timers.current[id];
680
+ if (timer !== undefined) {
681
+ clearTimeout(timer);
682
+ delete timers.current[id];
683
+ }
684
+ };
685
+ $[4] = t6;
686
+ } else {
687
+ t6 = $[4];
688
+ }
689
+ const clearTimer = t6;
690
+ let t7;
691
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
692
+ t7 = id_0 => {
693
+ commitToasts(toastsRef.current.filter(t => t.id !== id_0));
694
+ clearTimer(id_0);
695
+ };
696
+ $[5] = t7;
697
+ } else {
698
+ t7 = $[5];
699
+ }
700
+ const hide = t7;
701
+ let t8;
702
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
703
+ t8 = (id_1, variant, duration) => {
704
+ clearTimer(id_1);
705
+ const resolved = duration ?? (variant === "loading" ? 0 : DEFAULT_DURATION);
706
+ if (resolved > 0) {
707
+ timers.current[id_1] = setTimeout(() => hide(id_1), resolved);
708
+ }
709
+ };
710
+ $[6] = t8;
711
+ } else {
712
+ t8 = $[6];
713
+ }
714
+ const scheduleDismiss = t8;
715
+ let t9;
716
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
717
+ t9 = options => {
718
+ let id_2 = options.id;
719
+ if (!id_2) {
720
+ counter.current = counter.current + 1;
721
+ id_2 = `toast-${counter.current}`;
722
+ }
723
+ const toastId = id_2;
724
+ const current = toastsRef.current;
725
+ const currentEntry = current.find(entry => entry.id === toastId);
726
+ const nextEntry = {
727
+ ...currentEntry,
728
+ ...options,
729
+ id: toastId,
730
+ message: options.message ?? currentEntry?.message ?? ""
731
+ };
732
+ commitToasts(currentEntry ? current.map(entry_0 => entry_0.id === toastId ? nextEntry : entry_0) : [...current, nextEntry]);
733
+ scheduleDismiss(toastId, nextEntry.variant, nextEntry.duration);
734
+ return toastId;
735
+ };
736
+ $[7] = t9;
737
+ } else {
738
+ t9 = $[7];
739
+ }
740
+ const show = t9;
741
+ let t10;
742
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
743
+ t10 = (id_3, options_0) => {
744
+ const current_0 = toastsRef.current.find(entry_1 => entry_1.id === id_3);
745
+ if (!current_0) {
746
+ return;
747
+ }
748
+ const updated = {
749
+ ...current_0,
750
+ ...options_0,
751
+ id: id_3
752
+ };
753
+ commitToasts(toastsRef.current.map(entry_2 => entry_2.id === id_3 ? updated : entry_2));
754
+ scheduleDismiss(id_3, updated.variant, updated.duration);
755
+ };
756
+ $[8] = t10;
757
+ } else {
758
+ t10 = $[8];
759
+ }
760
+ const update = t10;
761
+ let t11;
762
+ let t12;
763
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
764
+ t11 = () => () => {
765
+ Object.values(timers.current).forEach(clearTimeout);
766
+ timers.current = {};
767
+ };
768
+ t12 = [];
769
+ $[9] = t11;
770
+ $[10] = t12;
771
+ } else {
772
+ t11 = $[9];
773
+ t12 = $[10];
774
+ }
775
+ useEffect(t11, t12);
776
+ let t13;
777
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
778
+ t13 = (p, messages) => {
779
+ const id_4 = show({
780
+ message: messages.loading,
781
+ variant: "loading",
782
+ duration: 0
783
+ });
784
+ return p.then(result => {
785
+ const msg = messages.success;
786
+ update(id_4, {
787
+ message: typeof msg === "function" ? msg(result) : msg,
788
+ variant: "success",
789
+ duration: DEFAULT_DURATION
790
+ });
791
+ return result;
792
+ }, err => {
793
+ const msg_0 = messages.error;
794
+ update(id_4, {
795
+ message: typeof msg_0 === "function" ? msg_0(err) : msg_0,
796
+ variant: "danger",
797
+ duration: DEFAULT_DURATION
798
+ });
799
+ throw err;
800
+ });
801
+ };
802
+ $[11] = t13;
803
+ } else {
804
+ t13 = $[11];
805
+ }
806
+ const promise = t13;
807
+ let t14;
808
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
809
+ t14 = {
810
+ show,
811
+ update,
812
+ hide,
813
+ info: (message, options_1) => show({
814
+ ...options_1,
815
+ message,
816
+ variant: "info"
817
+ }),
818
+ success: (message_0, options_2) => show({
819
+ ...options_2,
820
+ message: message_0,
821
+ variant: "success"
822
+ }),
823
+ warning: (message_1, options_3) => show({
824
+ ...options_3,
825
+ message: message_1,
826
+ variant: "warning"
827
+ }),
828
+ danger: (message_2, options_4) => show({
829
+ ...options_4,
830
+ message: message_2,
831
+ variant: "danger"
832
+ }),
833
+ loading: (message_3, options_5) => show({
834
+ ...options_5,
835
+ message: message_3,
836
+ variant: "loading"
837
+ }),
838
+ promise
839
+ };
840
+ $[12] = t14;
841
+ } else {
842
+ t14 = $[12];
843
+ }
844
+ const value = t14;
845
+ let t15;
846
+ if ($[13] !== insets.bottom || $[14] !== insets.top || $[15] !== position) {
847
+ t15 = position === "top" ? {
848
+ top: insets.top + 12
849
+ } : {
850
+ bottom: insets.bottom + 12
851
+ };
852
+ $[13] = insets.bottom;
853
+ $[14] = insets.top;
854
+ $[15] = position;
855
+ $[16] = t15;
856
+ } else {
857
+ t15 = $[16];
858
+ }
859
+ let t16;
860
+ if ($[17] !== position || $[18] !== toasts) {
861
+ let t17;
862
+ if ($[20] !== position) {
863
+ t17 = entry_3 => _jsx(ToastItem, {
864
+ entry: entry_3,
865
+ onHide: hide,
866
+ onUpdate: update,
867
+ position: position
868
+ }, entry_3.id);
869
+ $[20] = position;
870
+ $[21] = t17;
871
+ } else {
872
+ t17 = $[21];
200
873
  }
201
- return ctx;
874
+ t16 = toasts.map(t17);
875
+ $[17] = position;
876
+ $[18] = toasts;
877
+ $[19] = t16;
878
+ } else {
879
+ t16 = $[19];
880
+ }
881
+ let t17;
882
+ if ($[22] !== t15 || $[23] !== t16) {
883
+ t17 = _jsx(OverlayPortal, {
884
+ layer: "toast",
885
+ children: _jsx(View, {
886
+ className: "absolute left-0 right-0 px-4 gap-2 z-toast",
887
+ pointerEvents: "box-none",
888
+ style: t15,
889
+ children: t16
890
+ })
891
+ });
892
+ $[22] = t15;
893
+ $[23] = t16;
894
+ $[24] = t17;
895
+ } else {
896
+ t17 = $[24];
897
+ }
898
+ let t18;
899
+ if ($[25] !== children || $[26] !== t17) {
900
+ t18 = _jsxs(ToastContext.Provider, {
901
+ value: value,
902
+ children: [children, t17]
903
+ });
904
+ $[25] = children;
905
+ $[26] = t17;
906
+ $[27] = t18;
907
+ } else {
908
+ t18 = $[27];
909
+ }
910
+ return t18;
911
+ }
912
+ export function useToast() {
913
+ const ctx = useContext(ToastContext);
914
+ if (!ctx) {
915
+ throw new Error("useToast debe usarse dentro de <ToastProvider>");
916
+ }
917
+ return ctx;
202
918
  }