@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
@@ -0,0 +1,495 @@
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 { createContext, useContext, useEffect, useEffectEvent, useRef, useState } 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
+ const RestingOffsetContext = createContext(0);
17
+
18
+ /** The part of the sheet panel below the screen at rest (0 outside a sheet). */
19
+ export function useSheetRestingOffset() {
20
+ return useContext(RestingOffsetContext);
21
+ }
22
+ export function resolveSnapPoint(point, windowHeight) {
23
+ if (typeof point === "number") return point;
24
+ const percent = Number.parseFloat(point);
25
+ return Number.isFinite(percent) ? windowHeight * percent / 100 : windowHeight * 0.6;
26
+ }
27
+
28
+ /**
29
+ * Panel geometry for a host of `height` whose top `topInset` points are covered (status
30
+ * bar, notch). The panel is as tall as the highest snap point and never reaches into the
31
+ * inset; it rests pushed down `restOffset` so only the lowest snap point shows.
32
+ */
33
+ export function sheetGeometry(snapPoints, height, topInset) {
34
+ const ceiling = height - topInset - 8;
35
+ const snaps = snapPoints.map(point => Math.min(resolveSnapPoint(point, height), ceiling)).sort((a, b) => a - b);
36
+ const panelHeight = snaps[snaps.length - 1] ?? height * 0.6;
37
+ const offsets = snaps.map(snap => panelHeight - snap).sort((a, b) => b - a);
38
+ return {
39
+ ceiling,
40
+ panelHeight,
41
+ offsets,
42
+ restOffset: offsets[0] ?? 0
43
+ };
44
+ }
45
+
46
+ /**
47
+ * How much of the panel sits below the screen while it rests at its lowest snap point.
48
+ * Scroll content needs this much extra room at its end, or its last rows stay off screen
49
+ * until the sheet is dragged up.
50
+ */
51
+ export function restingOffset(snapPoints, height, topInset) {
52
+ return sheetGeometry(snapPoints, height, topInset).restOffset;
53
+ }
54
+ /**
55
+ * Bottom sheet drawn in the app window. While it exits it ignores touches,
56
+ * so a tap during the close animation never lands on a view that unmounts.
57
+ */
58
+ export function SheetSurface(t0) {
59
+ const $ = _c(88);
60
+ const {
61
+ visible,
62
+ snapPoints,
63
+ dismissible,
64
+ onRequestClose,
65
+ onExited,
66
+ header,
67
+ footer,
68
+ children,
69
+ testID
70
+ } = t0;
71
+ const theme = useTheme();
72
+ const insets = useSafeAreaInsets();
73
+ const {
74
+ height: windowHeight
75
+ } = useWindowDimensions();
76
+ const reducedMotion = useReducedMotion();
77
+ const keyboard = useReanimatedKeyboardAnimation();
78
+ const frame = useRef(null);
79
+ const [host, setHost] = useState(null);
80
+ const available = host?.height ?? windowHeight;
81
+ const topInset = Math.max(0, insets.top - (host?.top ?? 0));
82
+ let t1;
83
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
84
+ t1 = () => frame.current?.measureInWindow((_x, top, _width, height) => {
85
+ if (height > 0) {
86
+ setHost({
87
+ top,
88
+ height
89
+ });
90
+ }
91
+ });
92
+ $[0] = t1;
93
+ } else {
94
+ t1 = $[0];
95
+ }
96
+ const measureHost = t1;
97
+ let t2;
98
+ if ($[1] !== available || $[2] !== snapPoints || $[3] !== topInset) {
99
+ t2 = sheetGeometry(snapPoints, available, topInset);
100
+ $[1] = available;
101
+ $[2] = snapPoints;
102
+ $[3] = topInset;
103
+ $[4] = t2;
104
+ } else {
105
+ t2 = $[4];
106
+ }
107
+ const {
108
+ ceiling,
109
+ panelHeight,
110
+ offsets,
111
+ restOffset
112
+ } = t2;
113
+ const hiddenOffset = panelHeight + insets.bottom;
114
+ const duration = reducedMotion ? 0 : DURATION_MS;
115
+ const translateY = useSharedValue(hiddenOffset);
116
+ const dragStart = useSharedValue(0);
117
+ let t3;
118
+ if ($[5] !== onExited) {
119
+ t3 = () => onExited();
120
+ $[5] = onExited;
121
+ $[6] = t3;
122
+ } else {
123
+ t3 = $[6];
124
+ }
125
+ const exited = useEffectEvent(t3);
126
+ let t4;
127
+ if ($[7] !== duration || $[8] !== exited || $[9] !== hiddenOffset || $[10] !== restOffset || $[11] !== translateY || $[12] !== visible) {
128
+ t4 = () => {
129
+ if (visible) {
130
+ translateY.set(withTiming(restOffset, {
131
+ duration,
132
+ easing: Easing.out(Easing.cubic)
133
+ }));
134
+ return;
135
+ }
136
+ translateY.set(withTiming(hiddenOffset, {
137
+ duration,
138
+ easing: Easing.in(Easing.cubic)
139
+ }));
140
+ if (duration === 0) {
141
+ exited();
142
+ return;
143
+ }
144
+ const timer = setTimeout(() => exited(), duration);
145
+ return () => clearTimeout(timer);
146
+ };
147
+ $[7] = duration;
148
+ $[8] = exited;
149
+ $[9] = hiddenOffset;
150
+ $[10] = restOffset;
151
+ $[11] = translateY;
152
+ $[12] = visible;
153
+ $[13] = t4;
154
+ } else {
155
+ t4 = $[13];
156
+ }
157
+ let t5;
158
+ if ($[14] !== duration || $[15] !== hiddenOffset || $[16] !== restOffset || $[17] !== translateY || $[18] !== visible) {
159
+ t5 = [visible, restOffset, hiddenOffset, duration, translateY];
160
+ $[14] = duration;
161
+ $[15] = hiddenOffset;
162
+ $[16] = restOffset;
163
+ $[17] = translateY;
164
+ $[18] = visible;
165
+ $[19] = t5;
166
+ } else {
167
+ t5 = $[19];
168
+ }
169
+ useEffect(t4, t5);
170
+ let t6;
171
+ if ($[20] !== dismissible || $[21] !== onRequestClose || $[22] !== visible) {
172
+ t6 = () => {
173
+ if (visible && dismissible) {
174
+ onRequestClose();
175
+ }
176
+ };
177
+ $[20] = dismissible;
178
+ $[21] = onRequestClose;
179
+ $[22] = visible;
180
+ $[23] = t6;
181
+ } else {
182
+ t6 = $[23];
183
+ }
184
+ const requestClose = t6;
185
+ let t7;
186
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
187
+ t7 = [-8, 8];
188
+ $[24] = t7;
189
+ } else {
190
+ t7 = $[24];
191
+ }
192
+ let t8;
193
+ if ($[25] !== dragStart || $[26] !== translateY) {
194
+ t8 = () => {
195
+ "worklet";
196
+
197
+ dragStart.set(translateY.get());
198
+ };
199
+ $[25] = dragStart;
200
+ $[26] = translateY;
201
+ $[27] = t8;
202
+ } else {
203
+ t8 = $[27];
204
+ }
205
+ let t9;
206
+ if ($[28] !== dismissible || $[29] !== dragStart || $[30] !== hiddenOffset || $[31] !== restOffset || $[32] !== translateY) {
207
+ t9 = event => {
208
+ "worklet";
209
+
210
+ const lowest = dismissible ? hiddenOffset : restOffset + 40;
211
+ translateY.set(Math.min(Math.max(dragStart.get() + event.translationY, 0), lowest));
212
+ };
213
+ $[28] = dismissible;
214
+ $[29] = dragStart;
215
+ $[30] = hiddenOffset;
216
+ $[31] = restOffset;
217
+ $[32] = translateY;
218
+ $[33] = t9;
219
+ } else {
220
+ t9 = $[33];
221
+ }
222
+ let t10;
223
+ if ($[34] !== dismissible || $[35] !== offsets || $[36] !== onRequestClose || $[37] !== panelHeight || $[38] !== restOffset || $[39] !== translateY) {
224
+ t10 = event_0 => {
225
+ "worklet";
226
+
227
+ const position = translateY.get();
228
+ const pastRest = position - restOffset;
229
+ const closing = dismissible && (event_0.velocityY > CLOSE_VELOCITY || pastRest > (panelHeight - restOffset) * 0.35);
230
+ if (closing) {
231
+ scheduleOnRN(onRequestClose);
232
+ return;
233
+ }
234
+ let target = offsets[0] ?? 0;
235
+ for (const offset of offsets) {
236
+ if (Math.abs(offset - position) < Math.abs(target - position)) {
237
+ target = offset;
238
+ }
239
+ }
240
+ translateY.set(withTiming(target, {
241
+ duration: DURATION_MS
242
+ }));
243
+ };
244
+ $[34] = dismissible;
245
+ $[35] = offsets;
246
+ $[36] = onRequestClose;
247
+ $[37] = panelHeight;
248
+ $[38] = restOffset;
249
+ $[39] = translateY;
250
+ $[40] = t10;
251
+ } else {
252
+ t10 = $[40];
253
+ }
254
+ let t11;
255
+ if ($[41] !== t10 || $[42] !== t8 || $[43] !== t9) {
256
+ t11 = {
257
+ activeOffsetY: t7,
258
+ onActivate: t8,
259
+ onUpdate: t9,
260
+ onDeactivate: t10
261
+ };
262
+ $[41] = t10;
263
+ $[42] = t8;
264
+ $[43] = t9;
265
+ $[44] = t11;
266
+ } else {
267
+ t11 = $[44];
268
+ }
269
+ const pan = usePanGesture(t11);
270
+ const panelStyle = useAnimatedStyle(() => {
271
+ const lifted = Math.abs(keyboard.height.get());
272
+ const height_0 = lifted > 0 ? Math.max(panelHeight, Math.min(ceiling, lifted + MIN_CONTENT_ABOVE_KEYBOARD)) : panelHeight;
273
+ return {
274
+ height: height_0,
275
+ paddingBottom: Math.max(insets.bottom, lifted),
276
+ transform: [{
277
+ translateY: translateY.get()
278
+ }]
279
+ };
280
+ });
281
+ const footerStyle = useAnimatedStyle(() => ({
282
+ transform: [{
283
+ translateY: -Math.min(translateY.get(), restOffset)
284
+ }]
285
+ }));
286
+ const backdropStyle = useAnimatedStyle(() => ({
287
+ opacity: interpolate(translateY.get(), [restOffset, hiddenOffset], [1, 0], "clamp")
288
+ }));
289
+ const t12 = visible ? "box-none" : "none";
290
+ let t13;
291
+ if ($[45] !== backdropStyle) {
292
+ t13 = [StyleSheet.absoluteFill, styles.backdrop, backdropStyle];
293
+ $[45] = backdropStyle;
294
+ $[46] = t13;
295
+ } else {
296
+ t13 = $[46];
297
+ }
298
+ const t14 = dismissible ? "Cerrar" : undefined;
299
+ const t15 = dismissible ? "button" : undefined;
300
+ const t16 = testID ? `${testID}-backdrop` : undefined;
301
+ let t17;
302
+ if ($[47] !== dismissible || $[48] !== requestClose || $[49] !== t14 || $[50] !== t15 || $[51] !== t16) {
303
+ t17 = _jsx(Pressable, {
304
+ accessibilityLabel: t14,
305
+ accessibilityRole: t15,
306
+ accessible: dismissible,
307
+ onPress: requestClose,
308
+ style: StyleSheet.absoluteFill,
309
+ testID: t16
310
+ });
311
+ $[47] = dismissible;
312
+ $[48] = requestClose;
313
+ $[49] = t14;
314
+ $[50] = t15;
315
+ $[51] = t16;
316
+ $[52] = t17;
317
+ } else {
318
+ t17 = $[52];
319
+ }
320
+ let t18;
321
+ if ($[53] !== t13 || $[54] !== t17) {
322
+ t18 = _jsx(Animated.View, {
323
+ style: t13,
324
+ children: t17
325
+ });
326
+ $[53] = t13;
327
+ $[54] = t17;
328
+ $[55] = t18;
329
+ } else {
330
+ t18 = $[55];
331
+ }
332
+ let t19;
333
+ if ($[56] !== theme.bg.card) {
334
+ t19 = {
335
+ backgroundColor: theme.bg.card
336
+ };
337
+ $[56] = theme.bg.card;
338
+ $[57] = t19;
339
+ } else {
340
+ t19 = $[57];
341
+ }
342
+ let t20;
343
+ if ($[58] !== panelStyle || $[59] !== t19) {
344
+ t20 = [styles.panel, t19, panelStyle];
345
+ $[58] = panelStyle;
346
+ $[59] = t19;
347
+ $[60] = t20;
348
+ } else {
349
+ t20 = $[60];
350
+ }
351
+ let t21;
352
+ if ($[61] !== theme.border.default) {
353
+ t21 = _jsx(View, {
354
+ style: [styles.handle, {
355
+ backgroundColor: theme.border.default
356
+ }]
357
+ });
358
+ $[61] = theme.border.default;
359
+ $[62] = t21;
360
+ } else {
361
+ t21 = $[62];
362
+ }
363
+ let t22;
364
+ if ($[63] !== header || $[64] !== t21) {
365
+ t22 = _jsxs(View, {
366
+ style: styles.handleArea,
367
+ children: [t21, header]
368
+ });
369
+ $[63] = header;
370
+ $[64] = t21;
371
+ $[65] = t22;
372
+ } else {
373
+ t22 = $[65];
374
+ }
375
+ let t23;
376
+ if ($[66] !== pan || $[67] !== t22) {
377
+ t23 = _jsx(GestureDetector, {
378
+ gesture: pan,
379
+ children: t22
380
+ });
381
+ $[66] = pan;
382
+ $[67] = t22;
383
+ $[68] = t23;
384
+ } else {
385
+ t23 = $[68];
386
+ }
387
+ let t24;
388
+ if ($[69] !== children || $[70] !== restOffset) {
389
+ t24 = _jsx(KeyboardToolbar.Group, {
390
+ style: styles.content,
391
+ children: _jsx(RestingOffsetContext, {
392
+ value: restOffset,
393
+ children: children
394
+ })
395
+ });
396
+ $[69] = children;
397
+ $[70] = restOffset;
398
+ $[71] = t24;
399
+ } else {
400
+ t24 = $[71];
401
+ }
402
+ let t25;
403
+ if ($[72] !== available || $[73] !== footer || $[74] !== footerStyle || $[75] !== theme.bg.card) {
404
+ t25 = footer ? _jsxs(Animated.View, {
405
+ style: [{
406
+ backgroundColor: theme.bg.card
407
+ }, footerStyle],
408
+ children: [footer, _jsx(View, {
409
+ pointerEvents: "none",
410
+ style: [styles.footerSkirt, {
411
+ backgroundColor: theme.bg.card,
412
+ height: available
413
+ }]
414
+ })]
415
+ }) : null;
416
+ $[72] = available;
417
+ $[73] = footer;
418
+ $[74] = footerStyle;
419
+ $[75] = theme.bg.card;
420
+ $[76] = t25;
421
+ } else {
422
+ t25 = $[76];
423
+ }
424
+ let t26;
425
+ if ($[77] !== requestClose || $[78] !== t20 || $[79] !== t23 || $[80] !== t24 || $[81] !== t25 || $[82] !== testID) {
426
+ t26 = _jsxs(Animated.View, {
427
+ accessibilityViewIsModal: true,
428
+ importantForAccessibility: "yes",
429
+ onAccessibilityEscape: requestClose,
430
+ style: t20,
431
+ testID: testID,
432
+ children: [t23, t24, t25]
433
+ });
434
+ $[77] = requestClose;
435
+ $[78] = t20;
436
+ $[79] = t23;
437
+ $[80] = t24;
438
+ $[81] = t25;
439
+ $[82] = testID;
440
+ $[83] = t26;
441
+ } else {
442
+ t26 = $[83];
443
+ }
444
+ let t27;
445
+ if ($[84] !== t12 || $[85] !== t18 || $[86] !== t26) {
446
+ t27 = _jsxs(View, {
447
+ onLayout: measureHost,
448
+ pointerEvents: t12,
449
+ ref: frame,
450
+ style: StyleSheet.absoluteFill,
451
+ children: [t18, t26]
452
+ });
453
+ $[84] = t12;
454
+ $[85] = t18;
455
+ $[86] = t26;
456
+ $[87] = t27;
457
+ } else {
458
+ t27 = $[87];
459
+ }
460
+ return t27;
461
+ }
462
+ const styles = StyleSheet.create({
463
+ backdrop: {
464
+ backgroundColor: SCRIM
465
+ },
466
+ panel: {
467
+ position: "absolute",
468
+ left: 0,
469
+ right: 0,
470
+ bottom: 0,
471
+ borderTopLeftRadius: 20,
472
+ borderTopRightRadius: 20,
473
+ overflow: "hidden"
474
+ },
475
+ content: {
476
+ flex: 1,
477
+ minHeight: 0
478
+ },
479
+ footerSkirt: {
480
+ position: "absolute",
481
+ left: 0,
482
+ right: 0,
483
+ top: "100%"
484
+ },
485
+ handleArea: {
486
+ paddingTop: 8
487
+ },
488
+ handle: {
489
+ alignSelf: "center",
490
+ width: 36,
491
+ height: 4,
492
+ borderRadius: 2,
493
+ marginBottom: 8
494
+ }
495
+ });
@@ -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
+ };