@sincpro/mobile-ui 3.0.1 → 3.1.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 (308) 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 +449 -61
  15. package/dist/Dialog/Dialog.Sheet.d.ts +7 -3
  16. package/dist/Dialog/Dialog.Sheet.js +231 -15
  17. package/dist/Dialog/OverlayHost.d.ts +23 -0
  18. package/dist/Dialog/OverlayHost.js +196 -0
  19. package/dist/Dialog/SheetSurface.d.ts +24 -0
  20. package/dist/Dialog/SheetSurface.js +441 -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 +141 -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 +5 -1
  98. package/dist/Display/icon-map.js +340 -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 +505 -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 +478 -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 +182 -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 +562 -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.js +132 -24
  154. package/dist/Form/Form.Select.js +487 -56
  155. package/dist/Form/Form.Slider.js +133 -10
  156. package/dist/Form/Form.Switch.js +99 -4
  157. package/dist/Form/index.d.ts +11 -6
  158. package/dist/Form/index.js +26 -27
  159. package/dist/Form/input-text.d.ts +7 -0
  160. package/dist/Form/input-text.js +18 -0
  161. package/dist/Navigation/Navigation.AppBar.d.ts +3 -4
  162. package/dist/Navigation/Navigation.AppBar.js +535 -99
  163. package/dist/Navigation/Navigation.BottomNav.js +363 -98
  164. package/dist/Navigation/Navigation.CollapsingHeader.d.ts +28 -13
  165. package/dist/Navigation/Navigation.CollapsingHeader.js +369 -36
  166. package/dist/Navigation/Navigation.FloatingBar.js +71 -11
  167. package/dist/Navigation/Navigation.Menu.js +309 -95
  168. package/dist/Navigation/Navigation.MenuSection.js +80 -11
  169. package/dist/Navigation/Navigation.RowItem.d.ts +4 -2
  170. package/dist/Navigation/Navigation.RowItem.js +93 -8
  171. package/dist/Navigation/Navigation.Search.js +241 -27
  172. package/dist/Navigation/Navigation.SearchBar.d.ts +7 -1
  173. package/dist/Navigation/Navigation.SearchBar.js +218 -29
  174. package/dist/Navigation/Navigation.SearchSuggestions.js +77 -3
  175. package/dist/Navigation/Navigation.SegmentedControl.js +152 -14
  176. package/dist/Navigation/Navigation.Steps.js +105 -11
  177. package/dist/Navigation/Navigation.Tabs.js +449 -41
  178. package/dist/Navigation/index.d.ts +9 -4
  179. package/dist/Navigation/index.js +13 -13
  180. package/dist/Typography/Typography.Heading.js +33 -3
  181. package/dist/Typography/Typography.SelectableText.js +95 -7
  182. package/dist/Typography/Typography.Text.d.ts +4 -2
  183. package/dist/Typography/Typography.Text.js +217 -7
  184. package/dist/Typography/index.js +3 -3
  185. package/dist/branding.js +29 -13
  186. package/dist/icons/AddItemIcon.js +76 -2
  187. package/dist/icons/ArrangeCircle.js +82 -2
  188. package/dist/icons/ArrowDownIcon.js +63 -3
  189. package/dist/icons/ArrowUpIcon.js +63 -3
  190. package/dist/icons/BoxIcon.js +64 -2
  191. package/dist/icons/BoxTimeIcon.js +63 -2
  192. package/dist/icons/CalendarIcon.js +145 -2
  193. package/dist/icons/CardIcon.js +80 -2
  194. package/dist/icons/CashierIcon.js +39 -2
  195. package/dist/icons/CreditIcon.js +76 -3
  196. package/dist/icons/DuoIcon.js +75 -2
  197. package/dist/icons/HomeIcon.js +39 -2
  198. package/dist/icons/HomeIconOutlined.js +53 -2
  199. package/dist/icons/LogoIcon.js +87 -2
  200. package/dist/icons/MoneyReceiveIcon.js +86 -2
  201. package/dist/icons/PinIcon.js +39 -2
  202. package/dist/icons/ProfileIcon.js +47 -2
  203. package/dist/icons/SettingsIcon.js +114 -2
  204. package/dist/icons/SinpeIcon.js +60 -2
  205. package/dist/icons/ToggleOffIcon.js +53 -2
  206. package/dist/icons/WalletMoneyIcon.js +81 -2
  207. package/dist/index.d.ts +1 -0
  208. package/dist/index.js +8 -2
  209. package/dist/layouts/AuthContainer.d.ts +4 -5
  210. package/dist/layouts/AuthContainer.js +231 -7
  211. package/dist/layouts/BottomInset.js +4 -1
  212. package/dist/layouts/Container.d.ts +2 -2
  213. package/dist/layouts/Container.js +45 -3
  214. package/dist/layouts/GradientContainer.js +37 -5
  215. package/dist/layouts/PlainLayout.js +19 -3
  216. package/dist/layouts/ScrollContainer.d.ts +14 -9
  217. package/dist/layouts/ScrollContainer.js +125 -4
  218. package/dist/layouts/edges.d.ts +2 -0
  219. package/dist/layouts/edges.js +1 -0
  220. package/dist/primitives/AspectRatio.js +75 -3
  221. package/dist/primitives/Box.js +45 -3
  222. package/dist/primitives/Pressable.js +95 -5
  223. package/dist/primitives/Row.js +84 -13
  224. package/dist/primitives/Spacer.js +42 -5
  225. package/dist/primitives/Stack.js +66 -7
  226. package/dist/primitives/index.js +1 -1
  227. package/dist/theme/active.js +20 -18
  228. package/dist/theme/build.js +118 -87
  229. package/dist/theme/color.js +87 -87
  230. package/dist/theme/components/ThemedActivityIndicator.d.ts +2 -15
  231. package/dist/theme/components/ThemedActivityIndicator.js +35 -3
  232. package/dist/theme/components/index.js +1 -0
  233. package/dist/theme/contrast.js +32 -33
  234. package/dist/theme/css-vars.js +71 -75
  235. package/dist/theme/dark.js +116 -97
  236. package/dist/theme/default.js +116 -97
  237. package/dist/theme/define.js +16 -12
  238. package/dist/theme/index.d.ts +1 -0
  239. package/dist/theme/index.js +7 -6
  240. package/dist/theme/on-dark-surface.d.ts +12 -0
  241. package/dist/theme/on-dark-surface.js +13 -0
  242. package/dist/theme/theme.js +1 -0
  243. package/dist/theme/tw.js +3 -1
  244. package/dist/theme/types.js +0 -18
  245. package/dist/theme/typography.d.ts +1 -1
  246. package/dist/theme/typography.js +337 -303
  247. package/dist/theme/useTheme.js +12 -3
  248. package/dist/theme/useThemeVars.d.ts +9 -0
  249. package/dist/theme/useThemeVars.js +23 -0
  250. package/dist/theme/validate.js +175 -166
  251. package/dist/tokens/index.js +1 -1
  252. package/dist/tokens/motion.js +30 -13
  253. package/dist/utils/async.d.ts +14 -0
  254. package/dist/utils/async.js +22 -0
  255. package/dist/utils/criteria.js +66 -85
  256. package/dist/utils/date.d.ts +8 -2
  257. package/dist/utils/date.js +63 -50
  258. package/dist/utils/image.js +8 -8
  259. package/dist/utils/intl.d.ts +1 -0
  260. package/dist/utils/intl.js +13 -0
  261. package/dist/utils/keys.js +3 -5
  262. package/dist/utils/monetary.d.ts +1 -0
  263. package/dist/utils/monetary.js +28 -24
  264. package/dist/utils/progress.js +2 -3
  265. package/dist/utils/quantity.js +25 -26
  266. package/dist/utils/reorder.js +11 -20
  267. package/dist/utils/search.d.ts +4 -0
  268. package/dist/utils/search.js +12 -0
  269. package/dist/utils/serializer.js +38 -38
  270. package/dist/utils/useReducedMotion.js +32 -30
  271. package/dist/views/AppSplashView.js +117 -3
  272. package/dist/views/AuthFormView.d.ts +4 -5
  273. package/dist/views/AuthFormView.js +119 -11
  274. package/dist/views/FormViewV2.context.js +75 -23
  275. package/dist/views/FormViewV2.d.ts +4 -5
  276. package/dist/views/FormViewV2.js +658 -92
  277. package/dist/views/ListViewV2.context.js +91 -47
  278. package/dist/views/ListViewV2.d.ts +84 -43
  279. package/dist/views/ListViewV2.js +1350 -200
  280. package/dist/views/Wizard/Wizard.context.js +248 -84
  281. package/dist/views/Wizard/Wizard.js +260 -67
  282. package/dist/views/types/IListView.js +34 -31
  283. package/dist/widgets/CollectionOptions.js +557 -138
  284. package/dist/widgets/FilterBar.js +159 -7
  285. package/dist/widgets/FilterBuilder.js +375 -102
  286. package/dist/widgets/JSONViewer.js +275 -129
  287. package/dist/widgets/PromoBanner.js +336 -42
  288. package/dist/widgets/PromoModal.d.ts +2 -2
  289. package/dist/widgets/PromoModal.js +389 -62
  290. package/dist/widgets/QueryChoice.js +150 -8
  291. package/dist/widgets/QuickActions.js +120 -31
  292. package/dist/widgets/ReorderableList.js +399 -128
  293. package/dist/widgets/TimeZoneSelectorModal.js +458 -51
  294. package/dist/widgets/index.js +3 -3
  295. package/package.json +6 -1
  296. package/tailwind.preset.js +7 -5
  297. package/dist/Form/Form.InputField.d.ts +0 -10
  298. package/dist/Form/Form.InputField.js +0 -38
  299. package/dist/Form/Form.KeyboardToolbar.d.ts +0 -22
  300. package/dist/Form/Form.KeyboardToolbar.js +0 -66
  301. package/dist/Form/Form.PasswordInput.d.ts +0 -9
  302. package/dist/Form/Form.PasswordInput.js +0 -17
  303. package/dist/Form/Form.TextInput.d.ts +0 -8
  304. package/dist/Form/Form.TextInput.js +0 -8
  305. package/dist/primitives/BaseButton.d.ts +0 -150
  306. package/dist/primitives/BaseButton.js +0 -229
  307. package/dist/utils/useSheetTranslation.d.ts +0 -5
  308. package/dist/utils/useSheetTranslation.js +0 -23
@@ -0,0 +1,441 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useTheme } from "../theme/index.js";
3
+ import { SCRIM } from "../theme/on-dark-surface.js";
4
+ import { useReducedMotion } from "../utils/useReducedMotion.js";
5
+ import { useEffect, useEffectEvent } from "react";
6
+ import { Pressable, StyleSheet, useWindowDimensions, View } from "react-native";
7
+ import { GestureDetector, usePanGesture } from "react-native-gesture-handler";
8
+ import { KeyboardToolbar, useReanimatedKeyboardAnimation } from "react-native-keyboard-controller";
9
+ import Animated, { Easing, interpolate, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
10
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
11
+ import { scheduleOnRN } from "react-native-worklets";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
13
+ const DURATION_MS = 260;
14
+ const CLOSE_VELOCITY = 900;
15
+ const MIN_CONTENT_ABOVE_KEYBOARD = 240;
16
+ export function resolveSnapPoint(point, windowHeight) {
17
+ if (typeof point === "number") return point;
18
+ const percent = Number.parseFloat(point);
19
+ return Number.isFinite(percent) ? windowHeight * percent / 100 : windowHeight * 0.6;
20
+ }
21
+ /**
22
+ * Bottom sheet drawn in the app window. While it exits it ignores touches,
23
+ * so a tap during the close animation never lands on a view that unmounts.
24
+ */
25
+ export function SheetSurface(t0) {
26
+ const $ = _c(89);
27
+ const {
28
+ visible,
29
+ snapPoints,
30
+ dismissible,
31
+ onRequestClose,
32
+ onExited,
33
+ header,
34
+ footer,
35
+ children,
36
+ testID
37
+ } = t0;
38
+ const theme = useTheme();
39
+ const insets = useSafeAreaInsets();
40
+ const {
41
+ height: windowHeight
42
+ } = useWindowDimensions();
43
+ const reducedMotion = useReducedMotion();
44
+ const keyboard = useReanimatedKeyboardAnimation();
45
+ const ceiling = windowHeight - insets.top - 8;
46
+ let panelHeight;
47
+ let t1;
48
+ if ($[0] !== ceiling || $[1] !== snapPoints || $[2] !== windowHeight) {
49
+ let t2;
50
+ if ($[5] !== ceiling || $[6] !== windowHeight) {
51
+ t2 = point => Math.min(resolveSnapPoint(point, windowHeight), ceiling);
52
+ $[5] = ceiling;
53
+ $[6] = windowHeight;
54
+ $[7] = t2;
55
+ } else {
56
+ t2 = $[7];
57
+ }
58
+ const snaps = snapPoints.map(t2).sort(_temp);
59
+ panelHeight = snaps[snaps.length - 1] ?? windowHeight * 0.6;
60
+ t1 = snaps.map(snap => panelHeight - snap).sort(_temp2);
61
+ $[0] = ceiling;
62
+ $[1] = snapPoints;
63
+ $[2] = windowHeight;
64
+ $[3] = panelHeight;
65
+ $[4] = t1;
66
+ } else {
67
+ panelHeight = $[3];
68
+ t1 = $[4];
69
+ }
70
+ const offsets = t1;
71
+ const restOffset = offsets[0] ?? 0;
72
+ const hiddenOffset = panelHeight + insets.bottom;
73
+ const duration = reducedMotion ? 0 : DURATION_MS;
74
+ const translateY = useSharedValue(hiddenOffset);
75
+ const dragStart = useSharedValue(0);
76
+ let t2;
77
+ if ($[8] !== onExited) {
78
+ t2 = () => onExited();
79
+ $[8] = onExited;
80
+ $[9] = t2;
81
+ } else {
82
+ t2 = $[9];
83
+ }
84
+ const exited = useEffectEvent(t2);
85
+ let t3;
86
+ if ($[10] !== duration || $[11] !== exited || $[12] !== hiddenOffset || $[13] !== restOffset || $[14] !== translateY || $[15] !== visible) {
87
+ t3 = () => {
88
+ if (visible) {
89
+ translateY.set(withTiming(restOffset, {
90
+ duration,
91
+ easing: Easing.out(Easing.cubic)
92
+ }));
93
+ return;
94
+ }
95
+ translateY.set(withTiming(hiddenOffset, {
96
+ duration,
97
+ easing: Easing.in(Easing.cubic)
98
+ }));
99
+ if (duration === 0) {
100
+ exited();
101
+ return;
102
+ }
103
+ const timer = setTimeout(() => exited(), duration);
104
+ return () => clearTimeout(timer);
105
+ };
106
+ $[10] = duration;
107
+ $[11] = exited;
108
+ $[12] = hiddenOffset;
109
+ $[13] = restOffset;
110
+ $[14] = translateY;
111
+ $[15] = visible;
112
+ $[16] = t3;
113
+ } else {
114
+ t3 = $[16];
115
+ }
116
+ let t4;
117
+ if ($[17] !== duration || $[18] !== hiddenOffset || $[19] !== restOffset || $[20] !== translateY || $[21] !== visible) {
118
+ t4 = [visible, restOffset, hiddenOffset, duration, translateY];
119
+ $[17] = duration;
120
+ $[18] = hiddenOffset;
121
+ $[19] = restOffset;
122
+ $[20] = translateY;
123
+ $[21] = visible;
124
+ $[22] = t4;
125
+ } else {
126
+ t4 = $[22];
127
+ }
128
+ useEffect(t3, t4);
129
+ let t5;
130
+ if ($[23] !== dismissible || $[24] !== onRequestClose || $[25] !== visible) {
131
+ t5 = () => {
132
+ if (visible && dismissible) {
133
+ onRequestClose();
134
+ }
135
+ };
136
+ $[23] = dismissible;
137
+ $[24] = onRequestClose;
138
+ $[25] = visible;
139
+ $[26] = t5;
140
+ } else {
141
+ t5 = $[26];
142
+ }
143
+ const requestClose = t5;
144
+ let t6;
145
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
146
+ t6 = [-8, 8];
147
+ $[27] = t6;
148
+ } else {
149
+ t6 = $[27];
150
+ }
151
+ let t7;
152
+ if ($[28] !== dragStart || $[29] !== translateY) {
153
+ t7 = () => {
154
+ "worklet";
155
+
156
+ dragStart.set(translateY.get());
157
+ };
158
+ $[28] = dragStart;
159
+ $[29] = translateY;
160
+ $[30] = t7;
161
+ } else {
162
+ t7 = $[30];
163
+ }
164
+ let t8;
165
+ if ($[31] !== dismissible || $[32] !== dragStart || $[33] !== hiddenOffset || $[34] !== restOffset || $[35] !== translateY) {
166
+ t8 = event => {
167
+ "worklet";
168
+
169
+ const lowest = dismissible ? hiddenOffset : restOffset + 40;
170
+ translateY.set(Math.min(Math.max(dragStart.get() + event.translationY, 0), lowest));
171
+ };
172
+ $[31] = dismissible;
173
+ $[32] = dragStart;
174
+ $[33] = hiddenOffset;
175
+ $[34] = restOffset;
176
+ $[35] = translateY;
177
+ $[36] = t8;
178
+ } else {
179
+ t8 = $[36];
180
+ }
181
+ let t9;
182
+ if ($[37] !== dismissible || $[38] !== offsets || $[39] !== onRequestClose || $[40] !== panelHeight || $[41] !== restOffset || $[42] !== translateY) {
183
+ t9 = event_0 => {
184
+ "worklet";
185
+
186
+ const position = translateY.get();
187
+ const pastRest = position - restOffset;
188
+ const closing = dismissible && (event_0.velocityY > CLOSE_VELOCITY || pastRest > (panelHeight - restOffset) * 0.35);
189
+ if (closing) {
190
+ scheduleOnRN(onRequestClose);
191
+ return;
192
+ }
193
+ let target = offsets[0] ?? 0;
194
+ for (const offset of offsets) {
195
+ if (Math.abs(offset - position) < Math.abs(target - position)) {
196
+ target = offset;
197
+ }
198
+ }
199
+ translateY.set(withTiming(target, {
200
+ duration: DURATION_MS
201
+ }));
202
+ };
203
+ $[37] = dismissible;
204
+ $[38] = offsets;
205
+ $[39] = onRequestClose;
206
+ $[40] = panelHeight;
207
+ $[41] = restOffset;
208
+ $[42] = translateY;
209
+ $[43] = t9;
210
+ } else {
211
+ t9 = $[43];
212
+ }
213
+ let t10;
214
+ if ($[44] !== t7 || $[45] !== t8 || $[46] !== t9) {
215
+ t10 = {
216
+ activeOffsetY: t6,
217
+ onActivate: t7,
218
+ onUpdate: t8,
219
+ onDeactivate: t9
220
+ };
221
+ $[44] = t7;
222
+ $[45] = t8;
223
+ $[46] = t9;
224
+ $[47] = t10;
225
+ } else {
226
+ t10 = $[47];
227
+ }
228
+ const pan = usePanGesture(t10);
229
+ const panelStyle = useAnimatedStyle(() => {
230
+ const lifted = Math.abs(keyboard.height.get());
231
+ const height = lifted > 0 ? Math.max(panelHeight, Math.min(ceiling, lifted + MIN_CONTENT_ABOVE_KEYBOARD)) : panelHeight;
232
+ return {
233
+ height,
234
+ paddingBottom: Math.max(insets.bottom, lifted),
235
+ transform: [{
236
+ translateY: translateY.get()
237
+ }]
238
+ };
239
+ });
240
+ const footerStyle = useAnimatedStyle(() => ({
241
+ transform: [{
242
+ translateY: -Math.min(translateY.get(), restOffset)
243
+ }]
244
+ }));
245
+ const backdropStyle = useAnimatedStyle(() => ({
246
+ opacity: interpolate(translateY.get(), [restOffset, hiddenOffset], [1, 0], "clamp")
247
+ }));
248
+ const t11 = visible ? "box-none" : "none";
249
+ let t12;
250
+ if ($[48] !== backdropStyle) {
251
+ t12 = [StyleSheet.absoluteFill, styles.backdrop, backdropStyle];
252
+ $[48] = backdropStyle;
253
+ $[49] = t12;
254
+ } else {
255
+ t12 = $[49];
256
+ }
257
+ const t13 = dismissible ? "Cerrar" : undefined;
258
+ const t14 = dismissible ? "button" : undefined;
259
+ const t15 = testID ? `${testID}-backdrop` : undefined;
260
+ let t16;
261
+ if ($[50] !== dismissible || $[51] !== requestClose || $[52] !== t13 || $[53] !== t14 || $[54] !== t15) {
262
+ t16 = _jsx(Pressable, {
263
+ accessibilityLabel: t13,
264
+ accessibilityRole: t14,
265
+ accessible: dismissible,
266
+ onPress: requestClose,
267
+ style: StyleSheet.absoluteFill,
268
+ testID: t15
269
+ });
270
+ $[50] = dismissible;
271
+ $[51] = requestClose;
272
+ $[52] = t13;
273
+ $[53] = t14;
274
+ $[54] = t15;
275
+ $[55] = t16;
276
+ } else {
277
+ t16 = $[55];
278
+ }
279
+ let t17;
280
+ if ($[56] !== t12 || $[57] !== t16) {
281
+ t17 = _jsx(Animated.View, {
282
+ style: t12,
283
+ children: t16
284
+ });
285
+ $[56] = t12;
286
+ $[57] = t16;
287
+ $[58] = t17;
288
+ } else {
289
+ t17 = $[58];
290
+ }
291
+ let t18;
292
+ if ($[59] !== theme.bg.card) {
293
+ t18 = {
294
+ backgroundColor: theme.bg.card
295
+ };
296
+ $[59] = theme.bg.card;
297
+ $[60] = t18;
298
+ } else {
299
+ t18 = $[60];
300
+ }
301
+ let t19;
302
+ if ($[61] !== panelStyle || $[62] !== t18) {
303
+ t19 = [styles.panel, t18, panelStyle];
304
+ $[61] = panelStyle;
305
+ $[62] = t18;
306
+ $[63] = t19;
307
+ } else {
308
+ t19 = $[63];
309
+ }
310
+ let t20;
311
+ if ($[64] !== theme.border.default) {
312
+ t20 = _jsx(View, {
313
+ style: [styles.handle, {
314
+ backgroundColor: theme.border.default
315
+ }]
316
+ });
317
+ $[64] = theme.border.default;
318
+ $[65] = t20;
319
+ } else {
320
+ t20 = $[65];
321
+ }
322
+ let t21;
323
+ if ($[66] !== header || $[67] !== t20) {
324
+ t21 = _jsxs(View, {
325
+ style: styles.handleArea,
326
+ children: [t20, header]
327
+ });
328
+ $[66] = header;
329
+ $[67] = t20;
330
+ $[68] = t21;
331
+ } else {
332
+ t21 = $[68];
333
+ }
334
+ let t22;
335
+ if ($[69] !== pan || $[70] !== t21) {
336
+ t22 = _jsx(GestureDetector, {
337
+ gesture: pan,
338
+ children: t21
339
+ });
340
+ $[69] = pan;
341
+ $[70] = t21;
342
+ $[71] = t22;
343
+ } else {
344
+ t22 = $[71];
345
+ }
346
+ let t23;
347
+ if ($[72] !== children) {
348
+ t23 = _jsx(KeyboardToolbar.Group, {
349
+ style: styles.content,
350
+ children: children
351
+ });
352
+ $[72] = children;
353
+ $[73] = t23;
354
+ } else {
355
+ t23 = $[73];
356
+ }
357
+ let t24;
358
+ if ($[74] !== footer || $[75] !== footerStyle || $[76] !== theme.bg.card) {
359
+ t24 = footer ? _jsx(Animated.View, {
360
+ style: [{
361
+ backgroundColor: theme.bg.card
362
+ }, footerStyle],
363
+ children: footer
364
+ }) : null;
365
+ $[74] = footer;
366
+ $[75] = footerStyle;
367
+ $[76] = theme.bg.card;
368
+ $[77] = t24;
369
+ } else {
370
+ t24 = $[77];
371
+ }
372
+ let t25;
373
+ if ($[78] !== requestClose || $[79] !== t19 || $[80] !== t22 || $[81] !== t23 || $[82] !== t24 || $[83] !== testID) {
374
+ t25 = _jsxs(Animated.View, {
375
+ accessibilityViewIsModal: true,
376
+ importantForAccessibility: "yes",
377
+ onAccessibilityEscape: requestClose,
378
+ style: t19,
379
+ testID: testID,
380
+ children: [t22, t23, t24]
381
+ });
382
+ $[78] = requestClose;
383
+ $[79] = t19;
384
+ $[80] = t22;
385
+ $[81] = t23;
386
+ $[82] = t24;
387
+ $[83] = testID;
388
+ $[84] = t25;
389
+ } else {
390
+ t25 = $[84];
391
+ }
392
+ let t26;
393
+ if ($[85] !== t11 || $[86] !== t17 || $[87] !== t25) {
394
+ t26 = _jsxs(View, {
395
+ pointerEvents: t11,
396
+ style: StyleSheet.absoluteFill,
397
+ children: [t17, t25]
398
+ });
399
+ $[85] = t11;
400
+ $[86] = t17;
401
+ $[87] = t25;
402
+ $[88] = t26;
403
+ } else {
404
+ t26 = $[88];
405
+ }
406
+ return t26;
407
+ }
408
+ function _temp2(a_0, b_0) {
409
+ return b_0 - a_0;
410
+ }
411
+ function _temp(a, b) {
412
+ return a - b;
413
+ }
414
+ const styles = StyleSheet.create({
415
+ backdrop: {
416
+ backgroundColor: SCRIM
417
+ },
418
+ panel: {
419
+ position: "absolute",
420
+ left: 0,
421
+ right: 0,
422
+ bottom: 0,
423
+ borderTopLeftRadius: 20,
424
+ borderTopRightRadius: 20,
425
+ overflow: "hidden"
426
+ },
427
+ content: {
428
+ flex: 1,
429
+ minHeight: 0
430
+ },
431
+ handleArea: {
432
+ paddingTop: 8
433
+ },
434
+ handle: {
435
+ alignSelf: "center",
436
+ width: 36,
437
+ height: 4,
438
+ borderRadius: 2,
439
+ marginBottom: 8
440
+ }
441
+ });
@@ -0,0 +1,17 @@
1
+ import { type ButtonProps } from "../Actions/Actions.Button.js";
2
+ export interface DialogAction {
3
+ title: string;
4
+ onPress: () => void;
5
+ disabled?: boolean;
6
+ loading?: boolean;
7
+ testID?: string;
8
+ }
9
+ /**
10
+ * The footer of every dialog in the DS, as the app dialogs already draw it: cancel (outline)
11
+ * and confirm side by side, half the width each.
12
+ */
13
+ export declare function DialogActions({ cancel, confirm, confirmVariant, }: {
14
+ cancel: DialogAction;
15
+ confirm?: DialogAction;
16
+ confirmVariant?: ButtonProps["variant"];
17
+ }): import("react").JSX.Element;
@@ -0,0 +1,59 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import Button from "../Actions/Actions.Button.js";
3
+ import { View } from "react-native";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
5
+ /**
6
+ * The footer of every dialog in the DS, as the app dialogs already draw it: cancel (outline)
7
+ * and confirm side by side, half the width each.
8
+ */
9
+ export function DialogActions(t0) {
10
+ const $ = _c(8);
11
+ const {
12
+ cancel,
13
+ confirm,
14
+ confirmVariant: t1
15
+ } = t0;
16
+ const confirmVariant = t1 === undefined ? "primary" : t1;
17
+ let t2;
18
+ if ($[0] !== cancel) {
19
+ t2 = _jsx(View, {
20
+ className: "flex-1",
21
+ children: _jsx(Button, {
22
+ ...cancel,
23
+ variant: "outline"
24
+ })
25
+ });
26
+ $[0] = cancel;
27
+ $[1] = t2;
28
+ } else {
29
+ t2 = $[1];
30
+ }
31
+ let t3;
32
+ if ($[2] !== confirm || $[3] !== confirmVariant) {
33
+ t3 = confirm ? _jsx(View, {
34
+ className: "flex-1",
35
+ children: _jsx(Button, {
36
+ ...confirm,
37
+ variant: confirmVariant
38
+ })
39
+ }) : null;
40
+ $[2] = confirm;
41
+ $[3] = confirmVariant;
42
+ $[4] = t3;
43
+ } else {
44
+ t3 = $[4];
45
+ }
46
+ let t4;
47
+ if ($[5] !== t2 || $[6] !== t3) {
48
+ t4 = _jsxs(View, {
49
+ className: "flex-row gap-3",
50
+ children: [t2, t3]
51
+ });
52
+ $[5] = t2;
53
+ $[6] = t3;
54
+ $[7] = t4;
55
+ } else {
56
+ t4 = $[7];
57
+ }
58
+ return t4;
59
+ }
@@ -3,6 +3,7 @@ import ActionSheet from "./Dialog.ActionSheet.js";
3
3
  import Confirmation from "./Dialog.Confirmation.js";
4
4
  import EditValue from "./Dialog.EditValue.js";
5
5
  import Sheet from "./Dialog.Sheet.js";
6
+ import { OverlayHost, OverlayPortal } from "./OverlayHost.js";
6
7
  import { requestConfirmation } from "./requestConfirmation.js";
7
8
  export declare const Dialog: {
8
9
  Confirmation: typeof Confirmation;
@@ -11,11 +12,13 @@ export declare const Dialog: {
11
12
  ActionSheet: typeof ActionSheet;
12
13
  requestConfirmation: typeof requestConfirmation;
13
14
  };
14
- export { ConfirmationProvider, requestConfirmation, Sheet, useConfirmationContext };
15
+ export { ConfirmationProvider, OverlayHost, OverlayPortal, requestConfirmation, Sheet, useConfirmationContext, };
15
16
  export type { ConfirmationOptions } from "./Confirmation.context.js";
16
17
  export type { ActionSheetAction, ActionSheetProps, } from "./Dialog.ActionSheet.js";
17
18
  export type { ConfirmationProps } from "./Dialog.Confirmation.js";
18
19
  export type { EditValueOption, EditValueProps, } from "./Dialog.EditValue.js";
19
20
  export type { SheetProps } from "./Dialog.Sheet.js";
21
+ export type { OverlayPortalProps } from "./OverlayHost.js";
20
22
  export type { NativeConfirmationOptions } from "./requestConfirmation.js";
23
+ export type { SnapPoint } from "./SheetSurface.js";
21
24
  export default Dialog;
@@ -1,15 +1,16 @@
1
- import { ConfirmationProvider, useConfirmationContext, } from "./Confirmation.context.js";
1
+ import { ConfirmationProvider, useConfirmationContext } from "./Confirmation.context.js";
2
2
  import ActionSheet from "./Dialog.ActionSheet.js";
3
3
  import Confirmation from "./Dialog.Confirmation.js";
4
4
  import EditValue from "./Dialog.EditValue.js";
5
5
  import Sheet from "./Dialog.Sheet.js";
6
+ import { OverlayHost, OverlayPortal } from "./OverlayHost.js";
6
7
  import { requestConfirmation } from "./requestConfirmation.js";
7
8
  export const Dialog = {
8
- Confirmation,
9
- Sheet,
10
- EditValue,
11
- ActionSheet,
12
- requestConfirmation,
9
+ Confirmation,
10
+ Sheet,
11
+ EditValue,
12
+ ActionSheet,
13
+ requestConfirmation
13
14
  };
14
- export { ConfirmationProvider, requestConfirmation, Sheet, useConfirmationContext };
15
+ export { ConfirmationProvider, OverlayHost, OverlayPortal, requestConfirmation, Sheet, useConfirmationContext };
15
16
  export default Dialog;
@@ -0,0 +1,24 @@
1
+ import type { ReactNode } from "react";
2
+ export type OverlayLayer = "sheet" | "toast";
3
+ export interface OverlayEntry {
4
+ key: string;
5
+ layer: OverlayLayer;
6
+ element: ReactNode;
7
+ /** Returns true when the overlay consumed the Android back press. */
8
+ onBack?: () => boolean;
9
+ }
10
+ /**
11
+ * One store for every overlay of the app. Components declare overlays where
12
+ * they live; the single OverlayHost draws them above the screen in the same
13
+ * native window, so touches, keyboard tracking and CSS variables keep working.
14
+ */
15
+ export declare const overlayStore: {
16
+ subscribe(listener: () => void): () => void;
17
+ entries(): OverlayEntry[];
18
+ hasHost(): boolean;
19
+ attachHost(): () => void;
20
+ upsert(entry: OverlayEntry): void;
21
+ remove(key: string): void;
22
+ /** Topmost overlay with a back handler decides. */
23
+ handleBack(): boolean;
24
+ };
@@ -0,0 +1,59 @@
1
+ const LAYER_ORDER = {
2
+ sheet: 0,
3
+ toast: 1
4
+ };
5
+ let entries = [];
6
+ let hosts = 0;
7
+ const listeners = new Set();
8
+ function emit() {
9
+ for (const listener of [...listeners]) listener();
10
+ }
11
+ function byLayer(a, b) {
12
+ return LAYER_ORDER[a.layer] - LAYER_ORDER[b.layer];
13
+ }
14
+
15
+ /**
16
+ * One store for every overlay of the app. Components declare overlays where
17
+ * they live; the single OverlayHost draws them above the screen in the same
18
+ * native window, so touches, keyboard tracking and CSS variables keep working.
19
+ */
20
+ export const overlayStore = {
21
+ subscribe(listener) {
22
+ listeners.add(listener);
23
+ return () => {
24
+ listeners.delete(listener);
25
+ };
26
+ },
27
+ entries() {
28
+ return entries;
29
+ },
30
+ hasHost() {
31
+ return hosts > 0;
32
+ },
33
+ attachHost() {
34
+ hosts += 1;
35
+ emit();
36
+ return () => {
37
+ hosts -= 1;
38
+ emit();
39
+ };
40
+ },
41
+ upsert(entry) {
42
+ const index = entries.findIndex(current => current.key === entry.key);
43
+ entries = index === -1 ? [...entries, entry].sort(byLayer) : entries.map((current, position) => position === index ? entry : current);
44
+ emit();
45
+ },
46
+ remove(key) {
47
+ if (!entries.some(entry => entry.key === key)) return;
48
+ entries = entries.filter(entry => entry.key !== key);
49
+ emit();
50
+ },
51
+ /** Topmost overlay with a back handler decides. */
52
+ handleBack() {
53
+ for (let index = entries.length - 1; index >= 0; index -= 1) {
54
+ const onBack = entries[index].onBack;
55
+ if (onBack) return onBack();
56
+ }
57
+ return false;
58
+ }
59
+ };
@@ -1,13 +1,23 @@
1
1
  import { Alert } from "react-native";
2
- export function requestConfirmation({ title = "Confirmación", message = "¿Estás seguro de que quieres continuar?", confirmText = "Confirmar", cancelText = "Cancelar", destructive = false, } = {}) {
3
- return new Promise((resolve) => {
4
- Alert.alert(title, message, [
5
- { text: cancelText, style: "cancel", onPress: () => resolve(false) },
6
- {
7
- text: confirmText,
8
- style: destructive ? "destructive" : "default",
9
- onPress: () => resolve(true),
10
- },
11
- ], { cancelable: true, onDismiss: () => resolve(false) });
2
+ export function requestConfirmation({
3
+ title = "Confirmación",
4
+ message = "¿Estás seguro de que quieres continuar?",
5
+ confirmText = "Confirmar",
6
+ cancelText = "Cancelar",
7
+ destructive = false
8
+ } = {}) {
9
+ return new Promise(resolve => {
10
+ Alert.alert(title, message, [{
11
+ text: cancelText,
12
+ style: "cancel",
13
+ onPress: () => resolve(false)
14
+ }, {
15
+ text: confirmText,
16
+ style: destructive ? "destructive" : "default",
17
+ onPress: () => resolve(true)
18
+ }], {
19
+ cancelable: true,
20
+ onDismiss: () => resolve(false)
12
21
  });
22
+ });
13
23
  }