@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,74 +1,402 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
2
- import { Host, Picker } from "@expo/ui";
3
- import { Actions } from "../Actions/index.js";
1
+ import { c as _c } from "react/compiler-runtime";
4
2
  import Sheet from "../Dialog/Dialog.Sheet.js";
5
3
  import Icon from "../Display/Display.Icon.js";
4
+ import { ChoiceRow } from "./choice-row.js";
6
5
  import Pressable from "../primitives/Pressable.js";
7
- import { relativeLuminance, useTheme } from "../theme/index.js";
6
+ import { useTheme } from "../theme/index.js";
8
7
  import { cn } from "../theme/tw.js";
9
8
  import { Typography } from "../Typography/index.js";
9
+ import { attempt, errorMessage } from "../utils/async.js";
10
10
  import { useRef, useState } from "react";
11
- import { ActivityIndicator, Platform, View } from "react-native";
12
- function SelectOptions({ options, value, blocked, onSelect, }) {
13
- const theme = useTheme();
14
- if (!options.length) {
15
- return _jsx(Typography.Text, { children: "No hay opciones disponibles." });
11
+ import { ActivityIndicator, View } from "react-native";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
13
+ function SelectOptions(t0) {
14
+ const $ = _c(12);
15
+ const {
16
+ options,
17
+ value,
18
+ blocked,
19
+ onSelect
20
+ } = t0;
21
+ if (!options.length) {
22
+ let t1;
23
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24
+ t1 = _jsx(Typography.Text, {
25
+ children: "No hay opciones disponibles."
26
+ });
27
+ $[0] = t1;
28
+ } else {
29
+ t1 = $[0];
16
30
  }
17
- return (_jsx(View, { className: "gap-2", children: options.map((option, index) => {
18
- const selected = option.value === value;
19
- return (_jsxs(Pressable, { accessibilityLabel: option.label, accessibilityRole: "radio", accessibilityState: { disabled: blocked, selected }, className: cn("flex-row items-center gap-3 rounded-lg border px-3", selected ? "border-primary bg-primary/10" : "border-border-default"), disabled: blocked, onPress: () => onSelect(option.value), style: { minHeight: 48 }, children: [_jsx(Typography.Text, { className: "flex-1 text-text-primary", children: option.label }), selected ? _jsx(Icon, { color: theme.primary, name: "check", size: 18 }) : null] }, `${index}:${String(option.value)}`));
20
- }) }));
31
+ return t1;
32
+ }
33
+ let t1;
34
+ if ($[1] !== blocked || $[2] !== onSelect || $[3] !== options || $[4] !== value) {
35
+ let t2;
36
+ if ($[6] !== blocked || $[7] !== onSelect || $[8] !== value) {
37
+ t2 = (option, index) => _jsx(ChoiceRow, {
38
+ disabled: blocked,
39
+ label: option.label,
40
+ onPress: () => onSelect(option.value),
41
+ selected: option.value === value
42
+ }, `${index}:${String(option.value)}`);
43
+ $[6] = blocked;
44
+ $[7] = onSelect;
45
+ $[8] = value;
46
+ $[9] = t2;
47
+ } else {
48
+ t2 = $[9];
49
+ }
50
+ t1 = options.map(t2);
51
+ $[1] = blocked;
52
+ $[2] = onSelect;
53
+ $[3] = options;
54
+ $[4] = value;
55
+ $[5] = t1;
56
+ } else {
57
+ t1 = $[5];
58
+ }
59
+ let t2;
60
+ if ($[10] !== t1) {
61
+ t2 = _jsx(View, {
62
+ className: "gap-2",
63
+ children: t1
64
+ });
65
+ $[10] = t1;
66
+ $[11] = t2;
67
+ } else {
68
+ t2 = $[11];
69
+ }
70
+ return t2;
21
71
  }
22
- function Select({ options, value, onChange, onBlur, label, placeholder = "Seleccionar…", title, confirmLabel = "Aplicar", disabled = false, readOnly = false, loading = false, error, className, testID, }) {
23
- const theme = useTheme();
24
- const appearance = relativeLuminance(theme.bg.card) < 0.179 ? "dark" : "light";
25
- const saving = useRef(false);
26
- const [open, setOpen] = useState(false);
27
- const [draftValue, setDraftValue] = useState(null);
28
- const [pending, setPending] = useState(false);
29
- const [failure, setFailure] = useState();
30
- const selected = options.find((option) => option.value === value);
31
- const draftIndex = options.findIndex((option) => option.value === draftValue);
32
- const blocked = disabled || readOnly || loading || pending;
33
- const android = Platform.OS === "android";
34
- const close = () => {
35
- if (saving.current)
36
- return;
72
+ function Select(t0) {
73
+ const $ = _c(71);
74
+ const {
75
+ options,
76
+ value,
77
+ onChange,
78
+ onBlur,
79
+ label,
80
+ placeholder: t1,
81
+ title,
82
+ disabled: t2,
83
+ readOnly: t3,
84
+ loading: t4,
85
+ error,
86
+ className,
87
+ testID
88
+ } = t0;
89
+ const placeholder = t1 === undefined ? "Seleccionar\u2026" : t1;
90
+ const disabled = t2 === undefined ? false : t2;
91
+ const readOnly = t3 === undefined ? false : t3;
92
+ const loading = t4 === undefined ? false : t4;
93
+ const theme = useTheme();
94
+ const saving = useRef(false);
95
+ const [open, setOpen] = useState(false);
96
+ const [draftValue, setDraftValue] = useState(null);
97
+ const [pending, setPending] = useState(false);
98
+ const [failure, setFailure] = useState();
99
+ let t5;
100
+ if ($[0] !== options || $[1] !== value) {
101
+ let t6;
102
+ if ($[3] !== value) {
103
+ t6 = option => option.value === value;
104
+ $[3] = value;
105
+ $[4] = t6;
106
+ } else {
107
+ t6 = $[4];
108
+ }
109
+ t5 = options.find(t6);
110
+ $[0] = options;
111
+ $[1] = value;
112
+ $[2] = t5;
113
+ } else {
114
+ t5 = $[2];
115
+ }
116
+ const selected = t5;
117
+ let t6;
118
+ if ($[5] !== draftValue) {
119
+ t6 = option_0 => option_0.value === draftValue;
120
+ $[5] = draftValue;
121
+ $[6] = t6;
122
+ } else {
123
+ t6 = $[6];
124
+ }
125
+ const draftIndex = options.findIndex(t6);
126
+ const blocked = disabled || readOnly || loading || pending;
127
+ let t7;
128
+ if ($[7] !== onBlur) {
129
+ t7 = () => {
130
+ if (saving.current) {
131
+ return;
132
+ }
133
+ setOpen(false);
134
+ onBlur?.();
135
+ };
136
+ $[7] = onBlur;
137
+ $[8] = t7;
138
+ } else {
139
+ t7 = $[8];
140
+ }
141
+ const close = t7;
142
+ let t8;
143
+ if ($[9] !== blocked || $[10] !== onBlur || $[11] !== onChange) {
144
+ t8 = async next => {
145
+ if (next === null || blocked || saving.current) {
146
+ return;
147
+ }
148
+ saving.current = true;
149
+ setPending(true);
150
+ setFailure(undefined);
151
+ const result = await attempt(async () => {
152
+ await onChange(next);
37
153
  setOpen(false);
38
154
  onBlur?.();
155
+ });
156
+ saving.current = false;
157
+ setPending(false);
158
+ if (!result.ok) {
159
+ setFailure(errorMessage(result.error, "No se pudo aplicar la selecci\xF3n. Vuelve a intentarlo."));
160
+ }
161
+ };
162
+ $[9] = blocked;
163
+ $[10] = onBlur;
164
+ $[11] = onChange;
165
+ $[12] = t8;
166
+ } else {
167
+ t8 = $[12];
168
+ }
169
+ const commit = t8;
170
+ let t9;
171
+ if ($[13] !== className) {
172
+ t9 = cn("gap-1", className);
173
+ $[13] = className;
174
+ $[14] = t9;
175
+ } else {
176
+ t9 = $[14];
177
+ }
178
+ let t10;
179
+ if ($[15] !== label) {
180
+ t10 = label ? _jsx(Typography.Text, {
181
+ className: "text-text-primary",
182
+ semibold: true,
183
+ variant: "bodySmall",
184
+ children: label
185
+ }) : null;
186
+ $[15] = label;
187
+ $[16] = t10;
188
+ } else {
189
+ t10 = $[16];
190
+ }
191
+ const t11 = label ? `${label}: ${selected?.label ?? placeholder}` : selected?.label ?? placeholder;
192
+ const t12 = loading || pending;
193
+ let t13;
194
+ if ($[17] !== blocked || $[18] !== open || $[19] !== t12) {
195
+ t13 = {
196
+ disabled: blocked,
197
+ expanded: open,
198
+ busy: t12
199
+ };
200
+ $[17] = blocked;
201
+ $[18] = open;
202
+ $[19] = t12;
203
+ $[20] = t13;
204
+ } else {
205
+ t13 = $[20];
206
+ }
207
+ let t14;
208
+ if ($[21] !== selected?.value) {
209
+ t14 = () => {
210
+ setDraftValue(selected?.value ?? null);
211
+ setFailure(undefined);
212
+ setOpen(true);
213
+ };
214
+ $[21] = selected?.value;
215
+ $[22] = t14;
216
+ } else {
217
+ t14 = $[22];
218
+ }
219
+ let t15;
220
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
221
+ t15 = {
222
+ minHeight: 48,
223
+ minWidth: 48
39
224
  };
40
- const commit = async (next) => {
41
- if (next === null || blocked || saving.current)
42
- return;
43
- saving.current = true;
44
- setPending(true);
45
- setFailure(undefined);
46
- try {
47
- await onChange(next);
48
- setOpen(false);
49
- onBlur?.();
50
- }
51
- catch (cause) {
52
- setFailure(cause instanceof Error && cause.message.trim()
53
- ? cause.message
54
- : "No se pudo aplicar la selección. Vuelve a intentarlo.");
55
- }
56
- finally {
57
- saving.current = false;
58
- setPending(false);
59
- }
225
+ $[23] = t15;
226
+ } else {
227
+ t15 = $[23];
228
+ }
229
+ const t16 = selected ? "text-text-primary" : "text-text-tertiary";
230
+ let t17;
231
+ if ($[24] !== t16) {
232
+ t17 = cn("flex-1", t16);
233
+ $[24] = t16;
234
+ $[25] = t17;
235
+ } else {
236
+ t17 = $[25];
237
+ }
238
+ let t18;
239
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
240
+ t18 = {
241
+ paddingVertical: 12
60
242
  };
61
- return (_jsxs(View, { className: cn("gap-1", className), testID: testID, children: [label ? (_jsx(Typography.Text, { className: "text-text-primary", semibold: true, variant: "bodySmall", children: label })) : null, _jsxs(Pressable, { accessibilityHint: "Abre el selector de opciones", accessibilityLabel: label
62
- ? `${label}: ${selected?.label ?? placeholder}`
63
- : (selected?.label ?? placeholder), accessibilityRole: "button", accessibilityState: { disabled: blocked, expanded: open, busy: loading || pending }, className: "flex-row items-center gap-3 rounded-lg border border-input bg-bg-card px-3", disabled: blocked, onPress: () => {
64
- setDraftValue(selected?.value ?? null);
65
- setFailure(undefined);
66
- setOpen(true);
67
- }, style: { minHeight: 48, minWidth: 48 }, children: [_jsx(Typography.Text, { className: cn("flex-1", selected ? "text-text-primary" : "text-text-tertiary"), style: { paddingVertical: 12 }, children: selected?.label ?? placeholder }), loading || pending ? (_jsx(ActivityIndicator, { color: theme.primary })) : (_jsx(Icon, { color: theme.icon.secondary, name: "expand", size: 18 }))] }), error ? (_jsx(Typography.Text, { accessibilityLiveRegion: "polite", className: "text-danger", children: error })) : null, _jsxs(Sheet, { dismissible: !pending, footer: android ? undefined : (_jsx(Actions.Button, { disabled: blocked || draftIndex < 0, loading: pending, onPress: () => void commit(draftValue), title: confirmLabel })), onClose: close, title: title ?? label ?? "Seleccionar", visible: open, children: [open && android ? (_jsx(SelectOptions, { blocked: blocked, onSelect: (next) => void commit(next), options: options, value: value })) : null, open && !android ? (_jsx(Host, { colorScheme: appearance, matchContents: { vertical: true }, seedColor: theme.primary, style: { minHeight: 48 }, children: _jsxs(Picker, { appearance: "wheel", enabled: !blocked && options.length > 0, onValueChange: (index) => {
68
- if (blocked || saving.current)
69
- return;
70
- setDraftValue(options.find((_, itemIndex) => String(itemIndex) === index)?.value ?? null);
71
- setFailure(undefined);
72
- }, selectedValue: draftIndex < 0 ? "" : String(draftIndex), testID: testID ? `${testID}-picker` : undefined, children: [_jsx(Picker.Item, { label: placeholder, value: "" }), options.map((option, index) => (_jsx(Picker.Item, { label: option.label, value: String(index) }, String(index))))] }) })) : null, open && !android && !options.length ? (_jsx(Typography.Text, { children: "No hay opciones disponibles." })) : null, draftValue !== null && draftIndex < 0 ? (_jsx(Typography.Text, { accessibilityRole: "alert", className: "text-danger", children: "La opci\u00F3n ya no est\u00E1 disponible. Selecciona otra." })) : null, failure ? (_jsx(Typography.Text, { accessibilityLiveRegion: "polite", accessibilityRole: "alert", className: "pt-3 text-danger", selectable: true, children: failure })) : null] })] }));
243
+ $[26] = t18;
244
+ } else {
245
+ t18 = $[26];
246
+ }
247
+ const t19 = selected?.label ?? placeholder;
248
+ let t20;
249
+ if ($[27] !== t17 || $[28] !== t19) {
250
+ t20 = _jsx(Typography.Text, {
251
+ className: t17,
252
+ style: t18,
253
+ children: t19
254
+ });
255
+ $[27] = t17;
256
+ $[28] = t19;
257
+ $[29] = t20;
258
+ } else {
259
+ t20 = $[29];
260
+ }
261
+ let t21;
262
+ if ($[30] !== loading || $[31] !== pending || $[32] !== theme.icon || $[33] !== theme.primary) {
263
+ t21 = loading || pending ? _jsx(ActivityIndicator, {
264
+ color: theme.primary
265
+ }) : _jsx(Icon, {
266
+ color: theme.icon.secondary,
267
+ name: "expand",
268
+ size: 18
269
+ });
270
+ $[30] = loading;
271
+ $[31] = pending;
272
+ $[32] = theme.icon;
273
+ $[33] = theme.primary;
274
+ $[34] = t21;
275
+ } else {
276
+ t21 = $[34];
277
+ }
278
+ let t22;
279
+ if ($[35] !== blocked || $[36] !== t11 || $[37] !== t13 || $[38] !== t14 || $[39] !== t20 || $[40] !== t21) {
280
+ t22 = _jsxs(Pressable, {
281
+ accessibilityHint: "Abre el selector de opciones",
282
+ accessibilityLabel: t11,
283
+ accessibilityRole: "button",
284
+ accessibilityState: t13,
285
+ className: "flex-row items-center gap-3 rounded-lg border border-input bg-bg-card px-3",
286
+ disabled: blocked,
287
+ onPress: t14,
288
+ style: t15,
289
+ children: [t20, t21]
290
+ });
291
+ $[35] = blocked;
292
+ $[36] = t11;
293
+ $[37] = t13;
294
+ $[38] = t14;
295
+ $[39] = t20;
296
+ $[40] = t21;
297
+ $[41] = t22;
298
+ } else {
299
+ t22 = $[41];
300
+ }
301
+ let t23;
302
+ if ($[42] !== error) {
303
+ t23 = error ? _jsx(Typography.Text, {
304
+ accessibilityLiveRegion: "polite",
305
+ className: "text-danger",
306
+ children: error
307
+ }) : null;
308
+ $[42] = error;
309
+ $[43] = t23;
310
+ } else {
311
+ t23 = $[43];
312
+ }
313
+ const t24 = !pending;
314
+ const t25 = title ?? label ?? "Seleccionar";
315
+ let t26;
316
+ if ($[44] !== blocked || $[45] !== commit || $[46] !== draftValue || $[47] !== open || $[48] !== options || $[49] !== value) {
317
+ t26 = open ? _jsx(SelectOptions, {
318
+ blocked: blocked,
319
+ onSelect: next_0 => {
320
+ setDraftValue(next_0);
321
+ commit(next_0);
322
+ },
323
+ options: options,
324
+ value: draftValue ?? value
325
+ }) : null;
326
+ $[44] = blocked;
327
+ $[45] = commit;
328
+ $[46] = draftValue;
329
+ $[47] = open;
330
+ $[48] = options;
331
+ $[49] = value;
332
+ $[50] = t26;
333
+ } else {
334
+ t26 = $[50];
335
+ }
336
+ let t27;
337
+ if ($[51] !== draftIndex || $[52] !== draftValue) {
338
+ t27 = draftValue !== null && draftIndex < 0 ? _jsx(Typography.Text, {
339
+ accessibilityRole: "alert",
340
+ className: "text-danger",
341
+ children: "La opci\xF3n ya no est\xE1 disponible. Selecciona otra."
342
+ }) : null;
343
+ $[51] = draftIndex;
344
+ $[52] = draftValue;
345
+ $[53] = t27;
346
+ } else {
347
+ t27 = $[53];
348
+ }
349
+ let t28;
350
+ if ($[54] !== failure) {
351
+ t28 = failure ? _jsx(Typography.Text, {
352
+ accessibilityLiveRegion: "polite",
353
+ accessibilityRole: "alert",
354
+ className: "pt-3 text-danger",
355
+ selectable: true,
356
+ children: failure
357
+ }) : null;
358
+ $[54] = failure;
359
+ $[55] = t28;
360
+ } else {
361
+ t28 = $[55];
362
+ }
363
+ let t29;
364
+ if ($[56] !== close || $[57] !== open || $[58] !== t24 || $[59] !== t25 || $[60] !== t26 || $[61] !== t27 || $[62] !== t28) {
365
+ t29 = _jsxs(Sheet, {
366
+ dismissible: t24,
367
+ onClose: close,
368
+ title: t25,
369
+ visible: open,
370
+ children: [t26, t27, t28]
371
+ });
372
+ $[56] = close;
373
+ $[57] = open;
374
+ $[58] = t24;
375
+ $[59] = t25;
376
+ $[60] = t26;
377
+ $[61] = t27;
378
+ $[62] = t28;
379
+ $[63] = t29;
380
+ } else {
381
+ t29 = $[63];
382
+ }
383
+ let t30;
384
+ if ($[64] !== t10 || $[65] !== t22 || $[66] !== t23 || $[67] !== t29 || $[68] !== t9 || $[69] !== testID) {
385
+ t30 = _jsxs(View, {
386
+ className: t9,
387
+ testID: testID,
388
+ children: [t10, t22, t23, t29]
389
+ });
390
+ $[64] = t10;
391
+ $[65] = t22;
392
+ $[66] = t23;
393
+ $[67] = t29;
394
+ $[68] = t9;
395
+ $[69] = testID;
396
+ $[70] = t30;
397
+ } else {
398
+ t30 = $[70];
399
+ }
400
+ return t30;
73
401
  }
74
402
  export default Select;
@@ -1,17 +1,140 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import NativeSlider from "@expo/ui/community/slider";
3
3
  import { useTheme } from "../theme/index.js";
4
4
  import { cn } from "../theme/tw.js";
5
5
  import { Typography } from "../Typography/index.js";
6
6
  import { View } from "react-native";
7
- function Slider({ value, onChange, min = 0, max = 100, step = 1, label, formatValue, disabled = false, readOnly = false, accessibilityLabel, accessibilityHint, className, testID, }) {
8
- const theme = useTheme();
9
- const blocked = disabled || readOnly;
10
- return (_jsxs(View, { className: cn("gap-1", className), testID: testID, children: [label || formatValue ? (_jsxs(View, { className: "flex-row items-center justify-between", children: [label ? (_jsx(Typography.Text, { className: "font-medium text-text-primary", variant: "bodySmall", children: label })) : null, formatValue ? (_jsx(Typography.Text, { className: "text-text-secondary", variant: "bodySmall", children: formatValue(value) })) : null] })) : null, _jsx(NativeSlider, { accessibilityHint: accessibilityHint, accessibilityLabel: accessibilityLabel ?? label ?? "Valor", disabled: blocked, maximumTrackTintColor: theme.container.primary, maximumValue: max, minimumTrackTintColor: theme.primary, minimumValue: min, onValueChange: (next) => {
11
- if (blocked)
12
- return;
13
- const snapped = step > 0 ? min + Math.round((next - min) / step) * step : next;
14
- onChange(Math.min(max, Math.max(min, snapped)));
15
- }, step: step, style: { minHeight: 48 }, testID: testID ? `${testID}-slider` : undefined, thumbTintColor: theme.primary, value: value })] }));
7
+ import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
8
+ function Slider(t0) {
9
+ const $ = _c(30);
10
+ const {
11
+ value,
12
+ onChange,
13
+ min: t1,
14
+ max: t2,
15
+ step: t3,
16
+ label,
17
+ formatValue,
18
+ disabled: t4,
19
+ readOnly: t5,
20
+ accessibilityLabel,
21
+ accessibilityHint,
22
+ className,
23
+ testID
24
+ } = t0;
25
+ const min = t1 === undefined ? 0 : t1;
26
+ const max = t2 === undefined ? 100 : t2;
27
+ const step = t3 === undefined ? 1 : t3;
28
+ const disabled = t4 === undefined ? false : t4;
29
+ const readOnly = t5 === undefined ? false : t5;
30
+ const theme = useTheme();
31
+ const blocked = disabled || readOnly;
32
+ let t6;
33
+ if ($[0] !== className) {
34
+ t6 = cn("gap-1", className);
35
+ $[0] = className;
36
+ $[1] = t6;
37
+ } else {
38
+ t6 = $[1];
39
+ }
40
+ let t7;
41
+ if ($[2] !== formatValue || $[3] !== label || $[4] !== value) {
42
+ t7 = label || formatValue ? _jsxs(View, {
43
+ className: "flex-row items-center justify-between",
44
+ children: [label ? _jsx(Typography.Text, {
45
+ className: "text-text-primary",
46
+ semibold: true,
47
+ variant: "bodySmall",
48
+ children: label
49
+ }) : null, formatValue ? _jsx(Typography.Text, {
50
+ className: "text-text-secondary",
51
+ variant: "bodySmall",
52
+ children: formatValue(value)
53
+ }) : null]
54
+ }) : null;
55
+ $[2] = formatValue;
56
+ $[3] = label;
57
+ $[4] = value;
58
+ $[5] = t7;
59
+ } else {
60
+ t7 = $[5];
61
+ }
62
+ const t8 = accessibilityLabel ?? label ?? "Valor";
63
+ let t9;
64
+ if ($[6] !== blocked || $[7] !== max || $[8] !== min || $[9] !== onChange || $[10] !== step) {
65
+ t9 = next => {
66
+ if (blocked) {
67
+ return;
68
+ }
69
+ const snapped = step > 0 ? min + Math.round((next - min) / step) * step : next;
70
+ onChange(Math.min(max, Math.max(min, snapped)));
71
+ };
72
+ $[6] = blocked;
73
+ $[7] = max;
74
+ $[8] = min;
75
+ $[9] = onChange;
76
+ $[10] = step;
77
+ $[11] = t9;
78
+ } else {
79
+ t9 = $[11];
80
+ }
81
+ let t10;
82
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
83
+ t10 = {
84
+ minHeight: 48
85
+ };
86
+ $[12] = t10;
87
+ } else {
88
+ t10 = $[12];
89
+ }
90
+ const t11 = testID ? `${testID}-slider` : undefined;
91
+ let t12;
92
+ if ($[13] !== accessibilityHint || $[14] !== blocked || $[15] !== max || $[16] !== min || $[17] !== step || $[18] !== t11 || $[19] !== t8 || $[20] !== t9 || $[21] !== theme.container.primary || $[22] !== theme.primary || $[23] !== value) {
93
+ t12 = _jsx(NativeSlider, {
94
+ accessibilityHint: accessibilityHint,
95
+ accessibilityLabel: t8,
96
+ disabled: blocked,
97
+ maximumTrackTintColor: theme.container.primary,
98
+ maximumValue: max,
99
+ minimumTrackTintColor: theme.primary,
100
+ minimumValue: min,
101
+ onValueChange: t9,
102
+ step: step,
103
+ style: t10,
104
+ testID: t11,
105
+ thumbTintColor: theme.primary,
106
+ value: value
107
+ });
108
+ $[13] = accessibilityHint;
109
+ $[14] = blocked;
110
+ $[15] = max;
111
+ $[16] = min;
112
+ $[17] = step;
113
+ $[18] = t11;
114
+ $[19] = t8;
115
+ $[20] = t9;
116
+ $[21] = theme.container.primary;
117
+ $[22] = theme.primary;
118
+ $[23] = value;
119
+ $[24] = t12;
120
+ } else {
121
+ t12 = $[24];
122
+ }
123
+ let t13;
124
+ if ($[25] !== t12 || $[26] !== t6 || $[27] !== t7 || $[28] !== testID) {
125
+ t13 = _jsxs(View, {
126
+ className: t6,
127
+ testID: testID,
128
+ children: [t7, t12]
129
+ });
130
+ $[25] = t12;
131
+ $[26] = t6;
132
+ $[27] = t7;
133
+ $[28] = testID;
134
+ $[29] = t13;
135
+ } else {
136
+ t13 = $[29];
137
+ }
138
+ return t13;
16
139
  }
17
140
  export default Slider;