@sincpro/mobile-ui 2.0.0 → 3.0.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 (204) hide show
  1. package/README.md +7 -2
  2. package/assets/brand-mesh.png +0 -0
  3. package/assets/fonts/FFL.txt +57 -0
  4. package/assets/fonts/Satoshi-Black.otf +0 -0
  5. package/assets/fonts/Satoshi-Bold.otf +0 -0
  6. package/assets/fonts/Satoshi-Medium.otf +0 -0
  7. package/assets/fonts/Satoshi-Regular.otf +0 -0
  8. package/dist/Actions/Actions.Button.d.ts +2 -1
  9. package/dist/Actions/Actions.Button.js +31 -37
  10. package/dist/Actions/Actions.Dock.d.ts +6 -6
  11. package/dist/Actions/Actions.Dock.js +14 -72
  12. package/dist/Actions/Actions.FAB.d.ts +2 -1
  13. package/dist/Actions/Actions.FilterButton.js +1 -1
  14. package/dist/Actions/Actions.IconButton.d.ts +3 -4
  15. package/dist/Actions/Actions.IconButton.js +2 -2
  16. package/dist/Dialog/Confirmation.context.d.ts +5 -14
  17. package/dist/Dialog/Confirmation.context.js +11 -51
  18. package/dist/Dialog/Dialog.ActionSheet.d.ts +8 -7
  19. package/dist/Dialog/Dialog.ActionSheet.js +45 -19
  20. package/dist/Dialog/Dialog.Confirmation.d.ts +14 -11
  21. package/dist/Dialog/Dialog.Confirmation.js +38 -14
  22. package/dist/Dialog/Dialog.EditValue.d.ts +21 -16
  23. package/dist/Dialog/Dialog.EditValue.js +73 -14
  24. package/dist/Dialog/Dialog.Sheet.d.ts +8 -24
  25. package/dist/Dialog/Dialog.Sheet.js +15 -60
  26. package/dist/Dialog/index.d.ts +14 -14
  27. package/dist/Dialog/index.js +5 -3
  28. package/dist/Dialog/requestConfirmation.d.ts +3 -0
  29. package/dist/Dialog/requestConfirmation.js +13 -0
  30. package/dist/Display/Display.Accordion.js +1 -1
  31. package/dist/Display/Display.Avatar.d.ts +6 -6
  32. package/dist/Display/Display.Avatar.js +2 -2
  33. package/dist/Display/Display.Badge.js +4 -4
  34. package/dist/Display/Display.Card.js +5 -2
  35. package/dist/Display/Display.Carousel.js +1 -1
  36. package/dist/Display/Display.CircleButton.d.ts +3 -8
  37. package/dist/Display/Display.CircleButton.js +2 -2
  38. package/dist/Display/Display.CopyableText.js +1 -5
  39. package/dist/Display/Display.Date.d.ts +3 -2
  40. package/dist/Display/Display.Date.js +3 -3
  41. package/dist/Display/Display.GradientSurface.d.ts +52 -9
  42. package/dist/Display/Display.GradientSurface.js +9 -14
  43. package/dist/Display/Display.Icon.d.ts +7 -11
  44. package/dist/Display/Display.Icon.js +15 -30
  45. package/dist/Display/Display.Image.d.ts +2 -1
  46. package/dist/Display/Display.Image.js +1 -1
  47. package/dist/Display/Display.KeyValue.js +1 -1
  48. package/dist/Display/Display.ListItem.js +1 -1
  49. package/dist/Display/Display.MenuButton.js +4 -4
  50. package/dist/Display/Display.MenuCard.d.ts +3 -8
  51. package/dist/Display/Display.MenuCard.js +2 -2
  52. package/dist/Display/Display.MenuGrid.d.ts +2 -7
  53. package/dist/Display/Display.MenuGrid.js +1 -1
  54. package/dist/Display/Display.Monetary.d.ts +2 -6
  55. package/dist/Display/Display.Monetary.js +2 -2
  56. package/dist/Display/Display.PriceTag.js +1 -1
  57. package/dist/Display/Display.Rating.js +1 -1
  58. package/dist/Display/Display.SearchHistory.d.ts +2 -1
  59. package/dist/Display/Display.SearchHistory.js +1 -1
  60. package/dist/Display/Display.StatCard.d.ts +2 -1
  61. package/dist/Display/Display.StatCard.js +1 -1
  62. package/dist/Display/Display.StoryViewer.js +10 -6
  63. package/dist/Display/Display.SwipeableRow.d.ts +2 -1
  64. package/dist/Display/Display.Timeline.js +1 -1
  65. package/dist/Display/icon-map.d.ts +344 -0
  66. package/dist/Display/icon-map.js +86 -0
  67. package/dist/Display/index.d.ts +2 -0
  68. package/dist/Display/index.js +1 -0
  69. package/dist/Feedback/Feedback.Banner.js +13 -12
  70. package/dist/Feedback/Feedback.Empty.js +1 -1
  71. package/dist/Feedback/Feedback.EmptyState.d.ts +2 -1
  72. package/dist/Feedback/Feedback.EmptyState.js +1 -1
  73. package/dist/Feedback/Feedback.Error.js +1 -1
  74. package/dist/Feedback/Feedback.PermissionCard.d.ts +2 -1
  75. package/dist/Feedback/Feedback.PermissionCard.js +2 -2
  76. package/dist/Feedback/Toast.context.js +3 -3
  77. package/dist/Form/Form.ControlledDropdown.d.ts +5 -11
  78. package/dist/Form/Form.ControlledDropdown.js +5 -2
  79. package/dist/Form/Form.DatePicker.d.ts +5 -9
  80. package/dist/Form/Form.DatePicker.js +116 -21
  81. package/dist/Form/Form.Dropdown.d.ts +11 -16
  82. package/dist/Form/Form.Dropdown.js +54 -90
  83. package/dist/Form/Form.FractionalQuantityInput.js +4 -11
  84. package/dist/Form/Form.Input.d.ts +3 -3
  85. package/dist/Form/Form.KeyboardForm.d.ts +2 -2
  86. package/dist/Form/Form.KeyboardForm.js +2 -2
  87. package/dist/Form/Form.KeyboardToolbar.d.ts +2 -1
  88. package/dist/Form/Form.KeyboardToolbar.js +3 -7
  89. package/dist/Form/Form.PasswordInput.js +1 -1
  90. package/dist/Form/Form.QuantitySelector.js +1 -1
  91. package/dist/Form/Form.Select.d.ts +12 -8
  92. package/dist/Form/Form.Select.js +64 -31
  93. package/dist/Form/Form.Slider.d.ts +4 -7
  94. package/dist/Form/Form.Slider.js +11 -10
  95. package/dist/Form/Form.Switch.js +2 -1
  96. package/dist/Form/index.d.ts +6 -14
  97. package/dist/Form/index.js +0 -11
  98. package/dist/Navigation/Navigation.AppBar.d.ts +2 -1
  99. package/dist/Navigation/Navigation.AppBar.js +2 -2
  100. package/dist/Navigation/Navigation.BottomNav.d.ts +4 -8
  101. package/dist/Navigation/Navigation.BottomNav.js +2 -2
  102. package/dist/Navigation/Navigation.CollapsingHeader.js +3 -2
  103. package/dist/Navigation/Navigation.Menu.d.ts +16 -11
  104. package/dist/Navigation/Navigation.Menu.js +97 -42
  105. package/dist/Navigation/Navigation.Search.js +2 -2
  106. package/dist/Navigation/Navigation.SearchBar.js +3 -4
  107. package/dist/Navigation/Navigation.SegmentedControl.d.ts +7 -25
  108. package/dist/Navigation/Navigation.SegmentedControl.js +18 -39
  109. package/dist/Navigation/Navigation.Steps.js +1 -1
  110. package/dist/Navigation/Navigation.Tabs.d.ts +2 -1
  111. package/dist/Navigation/index.d.ts +0 -6
  112. package/dist/Navigation/index.js +0 -8
  113. package/dist/Typography/Typography.SelectableText.js +3 -7
  114. package/dist/Typography/Typography.Text.d.ts +1 -6
  115. package/dist/Typography/Typography.Text.js +3 -6
  116. package/dist/index.d.ts +1 -4
  117. package/dist/index.js +1 -4
  118. package/dist/layouts/AuthContainer.d.ts +4 -2
  119. package/dist/layouts/AuthContainer.js +3 -4
  120. package/dist/layouts/Container.d.ts +0 -4
  121. package/dist/layouts/Container.js +3 -4
  122. package/dist/layouts/ScrollContainer.d.ts +7 -3
  123. package/dist/layouts/ScrollContainer.js +5 -4
  124. package/dist/primitives/BaseButton.d.ts +2 -1
  125. package/dist/theme/build.js +0 -4
  126. package/dist/theme/css-vars.js +0 -4
  127. package/dist/theme/dark.js +2 -6
  128. package/dist/theme/default.js +1 -5
  129. package/dist/theme/index.d.ts +1 -1
  130. package/dist/theme/index.js +1 -1
  131. package/dist/theme/types.d.ts +0 -11
  132. package/dist/theme/typography.d.ts +8 -7
  133. package/dist/theme/typography.js +25 -4
  134. package/dist/utils/timezone.d.ts +0 -5
  135. package/dist/views/AuthFormView.d.ts +3 -1
  136. package/dist/views/AuthFormView.js +2 -2
  137. package/dist/views/FormViewV2.d.ts +6 -13
  138. package/dist/views/FormViewV2.js +29 -25
  139. package/dist/views/ListViewV2.context.d.ts +5 -5
  140. package/dist/views/ListViewV2.d.ts +23 -18
  141. package/dist/views/ListViewV2.js +45 -48
  142. package/dist/views/types/IListView.d.ts +5 -4
  143. package/dist/views/types/IListView.js +18 -15
  144. package/dist/widgets/CollectionOptions.d.ts +2 -2
  145. package/dist/widgets/CollectionOptions.js +92 -65
  146. package/dist/widgets/FilterBar.js +1 -1
  147. package/dist/widgets/PromoModal.js +10 -4
  148. package/dist/widgets/QuickActions.d.ts +2 -7
  149. package/dist/widgets/QuickActions.js +1 -1
  150. package/dist/widgets/ReorderableList.js +3 -3
  151. package/dist/widgets/TimeZoneSelectorModal.d.ts +1 -6
  152. package/dist/widgets/TimeZoneSelectorModal.js +17 -12
  153. package/dist/widgets/index.d.ts +0 -11
  154. package/dist/widgets/index.js +0 -7
  155. package/package.json +36 -38
  156. package/tailwind.preset.js +0 -4
  157. package/dist/Dialog/BottomSheet/BottomSheet.Root.d.ts +0 -324
  158. package/dist/Dialog/BottomSheet/BottomSheet.Root.js +0 -373
  159. package/dist/Dialog/BottomSheet/index.d.ts +0 -1
  160. package/dist/Dialog/BottomSheet/index.js +0 -1
  161. package/dist/Dialog/Dialog.NativeSheet.d.ts +0 -10
  162. package/dist/Dialog/Dialog.NativeSheet.js +0 -21
  163. package/dist/Form/Form.Button.d.ts +0 -3
  164. package/dist/Form/Form.Button.js +0 -1
  165. package/dist/Form/Form.FAB.d.ts +0 -3
  166. package/dist/Form/Form.FAB.js +0 -1
  167. package/dist/Form/Form.FilterButton.d.ts +0 -3
  168. package/dist/Form/Form.FilterButton.js +0 -1
  169. package/dist/Form/Form.IconButton.d.ts +0 -3
  170. package/dist/Form/Form.IconButton.js +0 -1
  171. package/dist/Form/Form.SearchBar.d.ts +0 -13
  172. package/dist/Form/Form.SearchBar.js +0 -26
  173. package/dist/Navigation/Navigation.Header.d.ts +0 -16
  174. package/dist/Navigation/Navigation.Header.js +0 -17
  175. package/dist/Navigation/Navigation.HeaderToolbar.d.ts +0 -15
  176. package/dist/Navigation/Navigation.HeaderToolbar.js +0 -18
  177. package/dist/Navigation/Navigation.TabIcon.d.ts +0 -18
  178. package/dist/Navigation/Navigation.TabIcon.js +0 -12
  179. package/dist/Navigation/Navigation.TabItem.d.ts +0 -19
  180. package/dist/Navigation/Navigation.TabItem.js +0 -13
  181. package/dist/icons/OdooIcon.d.ts +0 -11
  182. package/dist/icons/OdooIcon.js +0 -11
  183. package/dist/icons/PrinterIcon.d.ts +0 -9
  184. package/dist/icons/PrinterIcon.js +0 -9
  185. package/dist/layouts/TabNavigatorLayout.d.ts +0 -26
  186. package/dist/layouts/TabNavigatorLayout.js +0 -60
  187. package/dist/utils/icon.d.ts +0 -1
  188. package/dist/utils/icon.js +0 -1
  189. package/dist/widgets/CircleButton.d.ts +0 -3
  190. package/dist/widgets/CircleButton.js +0 -1
  191. package/dist/widgets/GeoPermissionCard.d.ts +0 -13
  192. package/dist/widgets/GeoPermissionCard.js +0 -24
  193. package/dist/widgets/HomeHeader.d.ts +0 -15
  194. package/dist/widgets/HomeHeader.js +0 -13
  195. package/dist/widgets/MenuCard.d.ts +0 -3
  196. package/dist/widgets/MenuCard.js +0 -1
  197. package/dist/widgets/MenuGrid.d.ts +0 -5
  198. package/dist/widgets/MenuGrid.js +0 -1
  199. package/dist/widgets/MenuSection.d.ts +0 -3
  200. package/dist/widgets/MenuSection.js +0 -1
  201. package/dist/widgets/ScreenHeader.d.ts +0 -25
  202. package/dist/widgets/ScreenHeader.js +0 -32
  203. package/dist/widgets/TimeZoneSelector.d.ts +0 -12
  204. package/dist/widgets/TimeZoneSelector.js +0 -24
@@ -1,28 +1,54 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
2
+ import Sheet from "./Dialog.Sheet.js";
2
3
  import Icon from "../Display/Display.Icon.js";
3
4
  import Pressable from "../primitives/Pressable.js";
4
- import { themeToVars, useTheme } from "../theme/index.js";
5
+ import { useTheme } from "../theme/index.js";
5
6
  import { cn } from "../theme/tw.js";
6
7
  import { Typography } from "../Typography/index.js";
7
- import { useSheetTranslation } from "../utils/useSheetTranslation.js";
8
- import { vars } from "nativewind";
9
- import { Animated, Modal, ScrollView, View } from "react-native";
10
- import { useSafeAreaInsets } from "react-native-safe-area-context";
8
+ import { useRef, useState } from "react";
9
+ import { ActivityIndicator, View } from "react-native";
11
10
  function ActionSheet({ visible, onClose, actions, title, message, cancelLabel = "Cancelar", testID, }) {
12
11
  const theme = useTheme();
13
- const insets = useSafeAreaInsets();
14
- const { translateY } = useSheetTranslation(visible);
15
- return (_jsx(Modal, { animationType: "none", onRequestClose: onClose, presentationStyle: "overFullScreen", transparent: true, visible: visible, children: _jsxs(View, { className: "flex-1 justify-end", testID: testID, children: [_jsx(View, { accessibilityElementsHidden: true, className: "absolute inset-0 bg-black/50", importantForAccessibility: "no-hide-descendants", onResponderRelease: onClose, onStartShouldSetResponder: () => true }), _jsxs(Animated.View, { accessibilityViewIsModal: true, onAccessibilityEscape: onClose, style: [
16
- vars(themeToVars(theme)),
17
- {
18
- transform: [{ translateY }],
19
- maxHeight: "90%",
20
- paddingHorizontal: 12,
21
- paddingBottom: insets.bottom + 12,
22
- },
23
- ], children: [title || message ? (_jsxs(View, { className: "rounded-xl mb-2 px-4 py-3 items-center", style: { backgroundColor: theme.bg.card }, children: [title ? (_jsx(Typography.Text, { accessibilityRole: "header", className: "text-text-primary", semibold: true, children: title })) : null, message ? (_jsx(Typography.Text, { className: "text-text-secondary text-sm", variant: "bodySmall", children: message })) : null] })) : null, _jsx(ScrollView, { bounces: false, className: "rounded-xl overflow-hidden mb-2", style: { backgroundColor: theme.bg.card }, children: actions.map((action, index) => (_jsxs(Pressable, { accessibilityLabel: action.label, accessibilityRole: "button", accessibilityState: { disabled: action.disabled }, className: cn("flex-row items-center justify-center gap-2 px-4 py-4", index < actions.length - 1 && "border-b border-border-light"), disabled: action.disabled, onPress: () => {
24
- onClose();
25
- action.onPress();
26
- }, style: { minHeight: 48 }, children: [action.icon ? (_jsx(Icon, { color: action.destructive ? theme.danger : theme.icon.primary, name: action.icon, size: 20 })) : null, _jsx(Typography.Text, { className: cn(action.destructive ? "text-danger" : "text-text-primary"), semibold: true, children: action.label })] }, action.label))) }), _jsx(Pressable, { accessibilityLabel: cancelLabel, accessibilityRole: "button", className: "rounded-xl px-4 py-4 items-center", onPress: onClose, style: { backgroundColor: theme.bg.card, minHeight: 48 }, children: _jsx(Typography.Text, { className: "text-text-accent", semibold: true, children: cancelLabel }) })] })] }) }));
12
+ const saving = useRef(false);
13
+ const [pending, setPending] = useState();
14
+ const [error, setError] = useState();
15
+ const close = () => {
16
+ if (saving.current)
17
+ return;
18
+ setError(undefined);
19
+ onClose();
20
+ };
21
+ const choose = async (action, index) => {
22
+ if (action.disabled || saving.current)
23
+ return;
24
+ saving.current = true;
25
+ setPending(index);
26
+ setError(undefined);
27
+ try {
28
+ await action.onPress();
29
+ onClose();
30
+ }
31
+ catch (cause) {
32
+ setError(cause instanceof Error && cause.message.trim()
33
+ ? cause.message
34
+ : "No se pudo completar la acción. Vuelve a intentarlo.");
35
+ }
36
+ finally {
37
+ saving.current = false;
38
+ setPending(undefined);
39
+ }
40
+ };
41
+ return (_jsxs(Sheet, { dismissible: pending === undefined, footer: _jsx(Pressable, { accessibilityLabel: cancelLabel, accessibilityRole: "button", accessibilityState: { disabled: pending !== undefined }, disabled: pending !== undefined, onPress: close, style: { minHeight: 48, justifyContent: "center", alignItems: "center" }, children: _jsx(Typography.Text, { className: "text-text-accent", semibold: true, children: cancelLabel }) }), onClose: close, testID: testID, title: title, visible: visible, children: [message ? (_jsx(Typography.Text, { className: "pb-3 text-text-secondary", children: message })) : null, actions.map((action, index) => (_jsxs(Pressable, { accessibilityLabel: action.label, accessibilityRole: "button", accessibilityState: {
42
+ disabled: !!action.disabled || pending !== undefined,
43
+ busy: pending === index,
44
+ }, className: cn("flex-row items-center gap-3 py-3", index < actions.length - 1 && "border-b border-border-light"), disabled: action.disabled || pending !== undefined, onPress: () => void choose(action, index), style: { minHeight: 48 }, children: [action.icon ? (_jsx(Icon, { color: action.disabled
45
+ ? theme.icon.disabled
46
+ : action.destructive
47
+ ? theme.danger
48
+ : theme.icon.primary, name: action.icon, size: 20 })) : null, _jsx(Typography.Text, { className: cn("flex-1", action.disabled
49
+ ? "text-text-disabled"
50
+ : action.destructive
51
+ ? "text-danger"
52
+ : "text-text-primary"), semibold: true, children: action.label }), pending === index ? _jsx(ActivityIndicator, { color: theme.primary }) : null] }, `${action.label}-${index}`))), !actions.length ? (_jsx(Typography.Text, { children: "No hay acciones disponibles." })) : null, error ? (_jsx(View, { className: "pt-3", children: _jsx(Typography.Text, { accessibilityLiveRegion: "polite", accessibilityRole: "alert", className: "text-danger", selectable: true, children: error }) })) : null] }));
27
53
  }
28
54
  export default ActionSheet;
@@ -1,12 +1,15 @@
1
- import React from "react";
2
- export interface Props {
3
- auxTitle?: string;
4
- subtitle?: string;
5
- confirmButtonText?: string;
6
- cancelButtonText?: string;
1
+ import { type ReactNode } from "react";
2
+ export type ConfirmationProps = {
7
3
  visible: boolean;
8
- onCancel: () => void;
9
- onConfirm: () => void;
10
- }
11
- declare const ConfirmationDialog: React.FC<Props>;
12
- export default ConfirmationDialog;
4
+ onClose: () => void;
5
+ onConfirm: () => void | Promise<void>;
6
+ title?: string;
7
+ message?: string;
8
+ confirmText?: string;
9
+ cancelText?: string;
10
+ destructive?: boolean;
11
+ children?: ReactNode;
12
+ testID?: string;
13
+ };
14
+ declare function Confirmation({ visible, onClose, onConfirm, title, message, confirmText, cancelText, destructive, children, testID, }: ConfirmationProps): import("react").JSX.Element;
15
+ export default Confirmation;
@@ -1,15 +1,39 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
2
- import { BaseButton } from "../primitives/BaseButton.js";
3
- import { theme } from "../theme/index.js";
4
- import Typography from "../Typography/Typography.Text.js";
5
- import { useReducedMotion } from "../utils/useReducedMotion.js";
6
- import { Modal, TouchableWithoutFeedback, View } from "react-native";
7
- const ConfirmationDialog = ({ visible, onCancel, onConfirm, auxTitle = "Descartar cambios", subtitle = "¿Quieres descartar los cambios realizados?", confirmButtonText = "Descartar cambios", cancelButtonText = "Seguir editando", }) => {
8
- const reducedMotion = useReducedMotion();
9
- return (_jsx(Modal, { animationType: reducedMotion ? "none" : "fade", onRequestClose: onCancel, presentationStyle: "overFullScreen", transparent: true, visible: visible, children: _jsxs(View, { className: "flex-1 justify-center items-center p-6 bg-black/50", children: [_jsx(TouchableWithoutFeedback, { accessible: false, onPress: onCancel, children: _jsx(View, { className: "absolute inset-0" }) }), _jsxs(View, { accessibilityViewIsModal: true, className: "p-3 w-full max-w-xs mx-auto", onAccessibilityEscape: onCancel, style: {
10
- borderRadius: 16,
11
- backgroundColor: theme.bg.popover,
12
- ...theme.shadow.md,
13
- }, children: [_jsx(Typography, { accessibilityRole: "header", className: "mb-1.5 text-sm", variant: "body", children: _jsx(Typography, { semibold: true, variant: "body", children: auxTitle }) }), _jsx(Typography, { className: "mb-3 text-xs leading-tight", variant: "body", children: subtitle }), _jsxs(View, { className: "flex-row gap-2", children: [_jsx(BaseButton, { className: "flex-1", onPress: onCancel, size: "small", title: cancelButtonText, variant: "outlineBlack" }), _jsx(BaseButton, { className: "flex-1", onPress: onConfirm, size: "small", title: confirmButtonText, variant: "primary" })] })] })] }) }));
14
- };
15
- export default ConfirmationDialog;
2
+ import { Actions } from "../Actions/index.js";
3
+ import Sheet from "./Dialog.Sheet.js";
4
+ import { Typography } from "../Typography/index.js";
5
+ import { useRef, useState } from "react";
6
+ import { View } from "react-native";
7
+ function Confirmation({ visible, onClose, onConfirm, title = "Descartar cambios", message = "¿Quieres descartar los cambios realizados?", confirmText = "Descartar cambios", cancelText = "Seguir editando", destructive = true, children, testID, }) {
8
+ const saving = useRef(false);
9
+ const [pending, setPending] = useState(false);
10
+ const [error, setError] = useState();
11
+ const close = () => {
12
+ if (saving.current)
13
+ return;
14
+ setError(undefined);
15
+ onClose();
16
+ };
17
+ const confirm = async () => {
18
+ if (saving.current)
19
+ return;
20
+ saving.current = true;
21
+ setPending(true);
22
+ setError(undefined);
23
+ try {
24
+ await onConfirm();
25
+ onClose();
26
+ }
27
+ catch (cause) {
28
+ setError(cause instanceof Error && cause.message.trim()
29
+ ? cause.message
30
+ : "No se pudo completar la operación. Vuelve a intentarlo.");
31
+ }
32
+ finally {
33
+ saving.current = false;
34
+ setPending(false);
35
+ }
36
+ };
37
+ return (_jsxs(Sheet, { dismissible: !pending, footer: _jsxs(View, { className: "gap-2", children: [_jsx(Actions.Button, { disabled: pending, onPress: close, title: cancelText, variant: "outline" }), _jsx(Actions.Button, { disabled: pending, loading: pending, onPress: () => void confirm(), title: confirmText, variant: destructive ? "outlineDanger" : "primary" })] }), onClose: close, testID: testID, title: title, visible: visible, children: [_jsx(Typography.Text, { className: "text-text-secondary", selectable: true, children: message }), children, error ? (_jsx(Typography.Text, { accessibilityLiveRegion: "polite", accessibilityRole: "alert", className: "pt-3 text-danger", selectable: true, children: error })) : null] }));
38
+ }
39
+ export default Confirmation;
@@ -1,25 +1,30 @@
1
- import React from "react";
2
- export interface EditableValueModalChip {
3
- key?: string;
1
+ import { type ReactNode } from "react";
2
+ import { type TextInputProps } from "react-native";
3
+ export type EditValueOption = {
4
+ key: string;
4
5
  label: string;
5
- onPress: () => void;
6
- }
7
- export interface EditableValueModalProps {
6
+ value: string;
7
+ disabled?: boolean;
8
+ };
9
+ export type EditValueProps = {
8
10
  visible: boolean;
9
11
  title: string;
10
12
  value: string;
11
- onChangeValue: (text: string) => void;
12
- onConfirm: () => void;
13
- onCancel: () => void;
13
+ onChange?: (value: string) => void;
14
+ onConfirm: (value: string) => void | Promise<void>;
15
+ onClose: () => void;
14
16
  placeholder?: string;
15
- helperText?: string | React.ReactNode;
16
- chips?: EditableValueModalChip[];
17
- keyboardType?: "default" | "numeric" | "decimal-pad";
18
- rightAdornment?: React.ReactNode;
17
+ helperText?: ReactNode;
18
+ options?: readonly EditValueOption[];
19
+ keyboardType?: TextInputProps["keyboardType"];
20
+ rightAdornment?: ReactNode;
21
+ footerAdornment?: ReactNode;
19
22
  confirmLabel?: string;
20
23
  cancelLabel?: string;
21
24
  autoFocus?: boolean;
25
+ disabled?: boolean;
26
+ readOnly?: boolean;
22
27
  testID?: string;
23
- }
24
- declare function EditableValueModal({ visible, title, value, onChangeValue, onConfirm, onCancel, placeholder, helperText, chips, keyboardType, rightAdornment, confirmLabel, cancelLabel, autoFocus, testID, }: EditableValueModalProps): React.JSX.Element;
25
- export default EditableValueModal;
28
+ };
29
+ declare function EditValue(props: EditValueProps): import("react").JSX.Element;
30
+ export default EditValue;
@@ -1,18 +1,77 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
2
- import { theme } from "../theme/index.js";
2
+ import { FlashList } from "@shopify/flash-list";
3
+ import { Actions } from "../Actions/index.js";
4
+ import Sheet from "./Dialog.Sheet.js";
5
+ import Pressable from "../primitives/Pressable.js";
6
+ import { fontFamilies, useTheme } from "../theme/index.js";
3
7
  import { Typography } from "../Typography/index.js";
4
- import { useReducedMotion } from "../utils/useReducedMotion.js";
5
- import { useEffect, useRef } from "react";
6
- import { FlatList, Modal, TextInput, TouchableOpacity, View, } from "react-native";
7
- function EditableValueModal({ visible, title, value, onChangeValue, onConfirm, onCancel, placeholder, helperText, chips, keyboardType = "decimal-pad", rightAdornment, confirmLabel = "Aplicar", cancelLabel = "Cancelar", autoFocus = true, testID, }) {
8
- const inputRef = useRef(null);
9
- const reducedMotion = useReducedMotion();
10
- useEffect(() => {
11
- if (visible && autoFocus) {
12
- const t = setTimeout(() => inputRef.current?.focus(), 60);
13
- return () => clearTimeout(t);
8
+ import { useRef, useState } from "react";
9
+ import { Keyboard, TextInput, View } from "react-native";
10
+ function EditValueEditor({ title, value, onChange, onConfirm, onClose, placeholder, helperText, options = [], keyboardType = "decimal-pad", rightAdornment, footerAdornment, confirmLabel = "Aplicar", cancelLabel = "Cancelar", autoFocus = true, disabled = false, readOnly = false, onPendingChange, }) {
11
+ const theme = useTheme();
12
+ const saving = useRef(false);
13
+ const [localDraft, setLocalDraft] = useState(value);
14
+ const [pending, setPending] = useState(false);
15
+ const [error, setError] = useState();
16
+ const draft = onChange ? value : localDraft;
17
+ const blocked = disabled || readOnly || pending;
18
+ const updateDraft = (next) => {
19
+ if (blocked || saving.current)
20
+ return;
21
+ if (onChange)
22
+ onChange(next);
23
+ else
24
+ setLocalDraft(next);
25
+ setError(undefined);
26
+ };
27
+ const close = () => {
28
+ if (saving.current)
29
+ return;
30
+ Keyboard.dismiss();
31
+ onClose();
32
+ };
33
+ const save = async () => {
34
+ if (disabled || readOnly || saving.current)
35
+ return;
36
+ saving.current = true;
37
+ setPending(true);
38
+ onPendingChange(true);
39
+ setError(undefined);
40
+ try {
41
+ await onConfirm(draft);
42
+ Keyboard.dismiss();
43
+ onClose();
14
44
  }
15
- }, [visible, autoFocus]);
16
- return (_jsx(Modal, { animationType: reducedMotion ? "none" : "fade", onRequestClose: onCancel, presentationStyle: "overFullScreen", transparent: true, visible: visible, children: _jsx(View, { className: "flex-1 justify-center p-6 bg-black/40", children: _jsxs(View, { accessibilityViewIsModal: true, className: "p-4", onAccessibilityEscape: onCancel, style: { borderRadius: 16, backgroundColor: theme.bg.popover, ...theme.shadow.md }, testID: testID, children: [_jsx(Typography.Text, { className: "mb-3", semibold: true, variant: "h6", children: title }), _jsxs(View, { className: "flex-row items-center", children: [_jsx(TextInput, { accessibilityLabel: title, className: "flex-1 border border-input rounded-lg p-2.5 text-lg text-text-primary", keyboardType: keyboardType, onChangeText: onChangeValue, onSubmitEditing: onConfirm, placeholder: placeholder, placeholderTextColor: theme.text.tertiary, ref: inputRef, returnKeyType: "done", selectionColor: theme.primary, underlineColorAndroid: "transparent", value: value }), rightAdornment && _jsx(View, { className: "ml-2", children: rightAdornment })] }), helperText ? (_jsx(View, { className: "mt-2", children: typeof helperText === "string" ? (_jsx(Typography.Text, { className: "opacity-70", variant: "bodySmall", children: helperText })) : (helperText) })) : null, chips && chips.length > 0 && (_jsx(FlatList, { contentContainerClassName: "gap-2 py-3", data: chips, horizontal: true, keyExtractor: (c, i) => c.key || `${c.label}-${i}`, renderItem: ({ item }) => (_jsx(TouchableOpacity, { className: "px-3 py-1.5 bg-accent/10 rounded-2xl border border-accent/30", onPress: item.onPress, children: _jsx(Typography.Text, { semibold: true, variant: "bodySmall", children: item.label }) })) })), _jsxs(View, { className: "flex-row justify-end gap-3", children: [_jsx(TouchableOpacity, { className: "px-4 py-2.5 rounded-lg bg-bg-hover", onPress: onCancel, children: _jsx(Typography.Text, { semibold: true, variant: "body", children: cancelLabel }) }), _jsx(TouchableOpacity, { className: "px-4 py-2.5 rounded-lg bg-accent", onPress: onConfirm, children: _jsx(Typography.Text, { className: "text-text-inverse", semibold: true, variant: "body", children: confirmLabel }) })] })] }) }) }));
45
+ catch (cause) {
46
+ setError(cause instanceof Error && cause.message.trim()
47
+ ? cause.message
48
+ : "No se pudo guardar. Conservamos el valor para reintentar.");
49
+ }
50
+ finally {
51
+ saving.current = false;
52
+ setPending(false);
53
+ onPendingChange(false);
54
+ }
55
+ };
56
+ return (_jsxs(View, { style: { flex: 1, minHeight: 0 }, children: [_jsxs(View, { className: "flex-row items-center gap-2", children: [_jsx(TextInput, { accessibilityLabel: title, accessibilityState: { disabled: blocked }, autoFocus: autoFocus && !blocked, className: "flex-1 border border-input rounded-lg p-3 text-text-primary", editable: !blocked, keyboardType: keyboardType, onChangeText: updateDraft, onSubmitEditing: () => void save(), placeholder: placeholder, placeholderTextColor: theme.text.tertiary, readOnly: readOnly, returnKeyType: "done", selectionColor: theme.primary, style: { minHeight: 48, fontFamily: fontFamilies.regular, fontSize: 18 }, underlineColorAndroid: "transparent", value: draft }), rightAdornment] }), helperText ? (typeof helperText === "string" ? (_jsx(Typography.Text, { className: "pt-2 text-text-secondary", children: helperText })) : (helperText)) : null, _jsx(View, { style: { flex: 1, minHeight: 0 }, children: _jsx(FlashList, { contentContainerStyle: { paddingVertical: 12 }, data: options, keyboardShouldPersistTaps: "handled", keyExtractor: (option) => option.key, renderItem: ({ item }) => (_jsx(Pressable, { accessibilityLabel: item.label, accessibilityRole: "radio", accessibilityState: {
57
+ disabled: blocked || !!item.disabled,
58
+ selected: item.value === draft,
59
+ }, className: "border-b border-border-light py-3", disabled: blocked || item.disabled, onPress: () => {
60
+ if (!item.disabled)
61
+ updateDraft(item.value);
62
+ }, style: { minWidth: 48, minHeight: 48 }, children: _jsx(Typography.Text, { className: item.disabled ? "text-text-disabled" : "text-text-primary", semibold: item.value === draft, children: item.label }) })) }) }), error ? (_jsx(Typography.Text, { accessibilityLiveRegion: "polite", accessibilityRole: "alert", className: "pb-3 text-danger", selectable: true, children: error })) : null, _jsxs(View, { className: "gap-2 border-t border-border-light py-3", children: [footerAdornment ? (_jsx(View, { accessibilityElementsHidden: blocked, importantForAccessibility: blocked ? "no-hide-descendants" : "auto", pointerEvents: blocked ? "none" : "auto", children: footerAdornment })) : null, _jsx(Actions.Button, { disabled: pending, onPress: close, title: cancelLabel, variant: "secondary" }), _jsx(Actions.Button, { disabled: blocked, loading: pending, onPress: () => void save(), title: confirmLabel })] })] }));
63
+ }
64
+ function EditValue(props) {
65
+ const busy = useRef(false);
66
+ const [pending, setPending] = useState(false);
67
+ return (_jsx(Sheet, { dismissible: !pending, onClose: () => {
68
+ if (!busy.current) {
69
+ Keyboard.dismiss();
70
+ props.onClose();
71
+ }
72
+ }, scrollable: false, testID: props.testID, title: props.title, visible: props.visible, children: props.visible ? (_jsx(EditValueEditor, { ...props, onPendingChange: (next) => {
73
+ busy.current = next;
74
+ setPending(next);
75
+ } })) : null }));
17
76
  }
18
- export default EditableValueModal;
77
+ export default EditValue;
@@ -1,30 +1,14 @@
1
- import { type ReactNode } from "react";
2
- /**
3
- * @deprecated A provider is no longer required. `SheetProvider` is a no-op passthrough
4
- * kept to avoid breaking prior wiring. Remove it when you can.
5
- */
6
- export declare function SheetProvider({ children }: {
7
- children: ReactNode;
8
- }): import("react").JSX.Element;
9
- export interface SheetProps {
1
+ import type { ReactNode } from "react";
2
+ export type SheetProps = {
10
3
  visible: boolean;
11
4
  onClose: () => void;
5
+ title?: string;
12
6
  children: ReactNode;
13
7
  footer?: ReactNode;
14
- footerClassName?: string;
15
- title?: string;
16
- /** Max sheet height (fraction of the screen). Default 0.9. */
17
- maxHeightRatio?: number;
18
- /** Allow closing by tapping the dim backdrop. Default `false` (handle/button only). */
19
- dismissOnBackdrop?: boolean;
20
- /** Show a visible close button in the sheet header. */
21
- showCloseButton?: boolean;
8
+ snapPoints?: (string | number)[];
9
+ scrollable?: boolean;
10
+ dismissible?: boolean;
22
11
  testID?: string;
23
- }
24
- /**
25
- * Bottom sheet on RN's native `Modal`: bottom-anchored, dim backdrop, handle with
26
- * **swipe-down to close** (handle only). By default it does NOT close on backdrop tap
27
- * (`dismissOnBackdrop`). No provider or native deps. Import via subpath `Dialog/Sheet`.
28
- */
29
- declare function Sheet({ visible, onClose, children, footer, footerClassName, title, maxHeightRatio, dismissOnBackdrop, showCloseButton, testID, }: SheetProps): import("react").JSX.Element;
12
+ };
13
+ declare function Sheet({ visible, onClose, title, children, footer, snapPoints, scrollable, dismissible, testID, }: SheetProps): import("react").JSX.Element;
30
14
  export default Sheet;
@@ -1,67 +1,22 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
2
- /* eslint-disable react-hooks/refs */
3
- // This file uses the canonical RN patterns: useRef(new Animated.Value()).current and PanResponder
4
- // created inside useState. Those hooks rules warn — they're not bugs here. Documented at the
5
- // eslint config level (see eslint.config.js:30-33).
1
+ import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
2
+ import BottomSheet, { BottomSheetView } from "@expo/ui/community/bottom-sheet";
6
3
  import Pressable from "../primitives/Pressable.js";
7
4
  import { themeToVars, useTheme } from "../theme/index.js";
8
5
  import { Typography } from "../Typography/index.js";
9
- import { useSheetTranslation } from "../utils/useSheetTranslation.js";
10
6
  import { vars } from "nativewind";
11
- import { useRef, useState } from "react";
12
- import { Animated, Modal, PanResponder, ScrollView, View } from "react-native";
13
- import { useSafeAreaInsets } from "react-native-safe-area-context";
14
- /**
15
- * @deprecated A provider is no longer required. `SheetProvider` is a no-op passthrough
16
- * kept to avoid breaking prior wiring. Remove it when you can.
17
- */
18
- export function SheetProvider({ children }) {
19
- return _jsx(_Fragment, { children: children });
20
- }
21
- /**
22
- * Bottom sheet on RN's native `Modal`: bottom-anchored, dim backdrop, handle with
23
- * **swipe-down to close** (handle only). By default it does NOT close on backdrop tap
24
- * (`dismissOnBackdrop`). No provider or native deps. Import via subpath `Dialog/Sheet`.
25
- */
26
- function Sheet({ visible, onClose, children, footer, footerClassName, title, maxHeightRatio = 0.9, dismissOnBackdrop = false, showCloseButton = false, testID, }) {
7
+ import { ScrollView, View } from "react-native";
8
+ const SNAP_POINTS = ["60%", "90%"];
9
+ function Sheet({ visible, onClose, title, children, footer, snapPoints = SNAP_POINTS, scrollable = true, dismissible = true, testID, }) {
27
10
  const theme = useTheme();
28
- const insets = useSafeAreaInsets();
29
- const { translateY, reducedMotion } = useSheetTranslation(visible);
30
- const gesture = useRef({ onClose, reducedMotion });
31
- gesture.current = { onClose, reducedMotion };
32
- const [pan] = useState(() => PanResponder.create({
33
- onStartShouldSetPanResponder: () => true,
34
- onMoveShouldSetPanResponder: (_, g) => g.dy > 2,
35
- onPanResponderGrant: () => translateY.stopAnimation(),
36
- onPanResponderMove: (_, g) => {
37
- if (g.dy > 0)
38
- translateY.setValue(g.dy);
39
- },
40
- onPanResponderRelease: (_, g) => {
41
- if (g.dy > 100 || g.vy > 0.5) {
42
- translateY.stopAnimation();
43
- gesture.current.onClose();
44
- }
45
- else {
46
- if (gesture.current.reducedMotion)
47
- translateY.setValue(0);
48
- else
49
- Animated.spring(translateY, { toValue: 0, useNativeDriver: true }).start();
50
- }
51
- },
52
- }));
53
- return (_jsx(Modal, { animationType: "none", onRequestClose: onClose, presentationStyle: "overFullScreen", transparent: true, visible: visible, children: _jsxs(View, { className: "flex-1 justify-end", testID: testID, children: [_jsx(View, { className: "absolute inset-0 bg-black/50", onResponderRelease: dismissOnBackdrop ? onClose : undefined, onStartShouldSetResponder: () => dismissOnBackdrop }), _jsxs(Animated.View, { accessibilityViewIsModal: true, className: "rounded-t-3xl", importantForAccessibility: "yes", onAccessibilityEscape: onClose, style: [
54
- vars(themeToVars(theme)),
55
- {
56
- backgroundColor: theme.bg.card,
57
- paddingBottom: insets.bottom + 12,
58
- maxHeight: `${Math.round(maxHeightRatio * 100)}%`,
59
- transform: [{ translateY }],
60
- },
61
- ], children: [_jsx(View, { accessibilityElementsHidden: true, className: "items-center pt-3 pb-2", ...pan.panHandlers, children: _jsx(View, { className: "w-12 h-1.5 rounded-full bg-border-strong" }) }), title || showCloseButton ? (_jsxs(View, { className: "flex-row items-center px-4 pb-1", children: [title ? (_jsx(Typography.Text, { accessibilityRole: "header", className: "flex-1 text-text-primary", semibold: true, variant: "subtitle", children: title })) : null, showCloseButton ? (_jsx(Pressable, { accessibilityLabel: "Cerrar", accessibilityRole: "button", className: "items-center justify-center rounded-lg", hitSlop: 8, onPress: onClose, style: { minWidth: 48, minHeight: 48 }, children: _jsx(Typography.Text, { className: "text-text-accent", variant: "bodySmall", children: "Cerrar" }) })) : null] })) : null, _jsx(ScrollView, { contentContainerStyle: {
62
- paddingHorizontal: 16,
63
- paddingTop: 4,
64
- paddingBottom: footer ? 12 : 0,
65
- }, style: { flexShrink: 1 }, children: children }), footer ? (_jsx(View, { className: `border-t border-border-light px-4 pt-3 ${footerClassName ?? ""}`, children: footer })) : null] })] }) }));
11
+ const close = () => {
12
+ if (visible && dismissible)
13
+ onClose();
14
+ };
15
+ return (_jsx(BottomSheet, { backgroundStyle: { backgroundColor: theme.bg.card }, enablePanDownToClose: dismissible, index: visible ? 0 : -1, onClose: close, snapPoints: snapPoints, children: _jsx(BottomSheetView, { style: { flex: 1 }, children: _jsxs(View, { accessibilityViewIsModal: true, importantForAccessibility: "yes", onAccessibilityEscape: close, style: [vars(themeToVars(theme)), { flex: 1, minHeight: 0 }], testID: testID, children: [_jsxs(View, { className: "flex-row items-center gap-3 px-4 pb-2", children: [title ? (_jsx(Typography.Text, { accessibilityRole: "header", className: "flex-1 text-text-primary", semibold: true, variant: "subtitle", children: title })) : (_jsx(View, { className: "flex-1" })), _jsx(Pressable, { accessibilityLabel: "Cerrar", accessibilityRole: "button", accessibilityState: { disabled: !dismissible }, disabled: !dismissible, onPress: close, style: {
16
+ minHeight: 48,
17
+ minWidth: 48,
18
+ alignItems: "center",
19
+ justifyContent: "center",
20
+ }, children: _jsx(Typography.Text, { className: dismissible ? "text-text-accent" : "text-text-disabled", variant: "bodySmall", children: "Cerrar" }) })] }), scrollable ? (_jsx(ScrollView, { contentContainerStyle: { paddingHorizontal: 16, paddingBottom: 16 }, keyboardDismissMode: "on-drag", keyboardShouldPersistTaps: "handled", style: { flex: 1, minHeight: 0 }, children: children })) : (_jsx(View, { style: { flex: 1, minHeight: 0, paddingHorizontal: 16 }, children: children })), footer ? (_jsx(View, { className: "border-t border-border-light px-4 py-3", children: footer })) : null] }) }) }));
66
21
  }
67
22
  export default Sheet;
@@ -1,21 +1,21 @@
1
- import { BottomSheet } from "./BottomSheet/index.js";
2
1
  import { ConfirmationProvider, useConfirmationContext } from "./Confirmation.context.js";
3
2
  import ActionSheet from "./Dialog.ActionSheet.js";
4
- import EditValue, { type EditableValueModalChip, type EditableValueModalProps } from "./Dialog.EditValue.js";
3
+ import Confirmation from "./Dialog.Confirmation.js";
4
+ import EditValue from "./Dialog.EditValue.js";
5
+ import Sheet from "./Dialog.Sheet.js";
6
+ import { requestConfirmation } from "./requestConfirmation.js";
5
7
  export declare const Dialog: {
6
- Confirmation: import("react").FC<import("./Dialog.Confirmation.js").Props>;
7
- BottomSheet: {
8
- Root: ({ visible, onClose, size, dismissible, children }: import("./BottomSheet/BottomSheet.Root").RootProps) => import("react").JSX.Element;
9
- Handle: ({ children }: import("./BottomSheet/BottomSheet.Root").HandleProps) => import("react").JSX.Element;
10
- Header: ({ children }: import("./BottomSheet/BottomSheet.Root").HeaderProps) => import("react").JSX.Element;
11
- Title: ({ children, subtitle }: import("./BottomSheet/BottomSheet.Root").TitleProps) => import("react").JSX.Element;
12
- Content: ({ children, scrollable }: import("./BottomSheet/BottomSheet.Root").ContentProps) => import("react").JSX.Element;
13
- Actions: ({ children, layout }: import("./BottomSheet/BottomSheet.Root").ActionsProps) => import("react").JSX.Element;
14
- Footer: ({ children }: import("./BottomSheet/BottomSheet.Root").FooterProps) => import("react").JSX.Element;
15
- useBottomSheet: () => import("./BottomSheet/BottomSheet.Root").BottomSheetContextValue;
16
- };
8
+ Confirmation: typeof Confirmation;
9
+ Sheet: typeof Sheet;
17
10
  EditValue: typeof EditValue;
18
11
  ActionSheet: typeof ActionSheet;
12
+ requestConfirmation: typeof requestConfirmation;
19
13
  };
20
- export { BottomSheet, ConfirmationProvider, type EditableValueModalChip, type EditableValueModalProps, useConfirmationContext, };
14
+ export { ConfirmationProvider, requestConfirmation, Sheet, useConfirmationContext };
15
+ export type { ConfirmationOptions } from "./Confirmation.context.js";
16
+ export type { ActionSheetAction, ActionSheetProps, } from "./Dialog.ActionSheet.js";
17
+ export type { ConfirmationProps } from "./Dialog.Confirmation.js";
18
+ export type { EditValueOption, EditValueProps, } from "./Dialog.EditValue.js";
19
+ export type { SheetProps } from "./Dialog.Sheet.js";
20
+ export type { NativeConfirmationOptions } from "./requestConfirmation.js";
21
21
  export default Dialog;
@@ -1,13 +1,15 @@
1
- import { BottomSheet } from "./BottomSheet/index.js";
2
1
  import { ConfirmationProvider, useConfirmationContext, } from "./Confirmation.context.js";
3
2
  import ActionSheet from "./Dialog.ActionSheet.js";
4
3
  import Confirmation from "./Dialog.Confirmation.js";
5
4
  import EditValue from "./Dialog.EditValue.js";
5
+ import Sheet from "./Dialog.Sheet.js";
6
+ import { requestConfirmation } from "./requestConfirmation.js";
6
7
  export const Dialog = {
7
8
  Confirmation,
8
- BottomSheet,
9
+ Sheet,
9
10
  EditValue,
10
11
  ActionSheet,
12
+ requestConfirmation,
11
13
  };
12
- export { BottomSheet, ConfirmationProvider, useConfirmationContext, };
14
+ export { ConfirmationProvider, requestConfirmation, Sheet, useConfirmationContext };
13
15
  export default Dialog;
@@ -0,0 +1,3 @@
1
+ import type { ConfirmationProps } from "./Dialog.Confirmation.js";
2
+ export type NativeConfirmationOptions = Pick<ConfirmationProps, "title" | "message" | "confirmText" | "cancelText" | "destructive">;
3
+ export declare function requestConfirmation({ title, message, confirmText, cancelText, destructive, }?: NativeConfirmationOptions): Promise<boolean>;
@@ -0,0 +1,13 @@
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) });
12
+ });
13
+ }
@@ -16,7 +16,7 @@ function AccordionItem({ title, children, defaultOpen = false, className, testID
16
16
  LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
17
17
  setOpen((prev) => !prev);
18
18
  };
19
- return (_jsxs(View, { className: cn("border-b border-border-default", className), testID: testID, children: [_jsxs(Pressable, { accessibilityLabel: title, accessibilityRole: "button", accessibilityState: { expanded: open }, className: "flex-row items-center justify-between py-3", onPress: toggle, style: { minHeight: 48 }, children: [_jsx(Typography.Text, { className: "flex-1 text-text-primary", semibold: true, children: title }), _jsx(View, { style: { transform: [{ rotate: open ? "180deg" : "0deg" }] }, children: _jsx(Icon, { color: theme.icon.secondary, name: "chevron-down", size: 18 }) })] }), open ? _jsx(View, { className: "pb-3", children: children }) : null] }));
19
+ return (_jsxs(View, { className: cn("border-b border-border-default", className), testID: testID, children: [_jsxs(Pressable, { accessibilityLabel: title, accessibilityRole: "button", accessibilityState: { expanded: open }, className: "flex-row items-center justify-between py-3", onPress: toggle, style: { minHeight: 48 }, children: [_jsx(Typography.Text, { className: "flex-1 text-text-primary", semibold: true, children: title }), _jsx(View, { style: { transform: [{ rotate: open ? "180deg" : "0deg" }] }, children: _jsx(Icon, { color: theme.icon.secondary, name: "expand", size: 18 }) })] }), open ? _jsx(View, { className: "pb-3", children: children }) : null] }));
20
20
  }
21
21
  function AccordionRoot({ children, className }) {
22
22
  return _jsx(View, { className: cn("bg-bg-card rounded-lg", className), children: children });
@@ -11,8 +11,8 @@ declare const avatar: import("tailwind-variants").TVReturnType<{
11
11
  default: "bg-bg-hover";
12
12
  primary: "bg-primary/20";
13
13
  secondary: "bg-secondary/20";
14
- success: "bg-success-light";
15
- warning: "bg-warning-light";
14
+ success: "bg-container-success";
15
+ warning: "bg-container-warning";
16
16
  };
17
17
  }, undefined, "justify-center items-center rounded-full shadow-sm", {
18
18
  size: {
@@ -25,8 +25,8 @@ declare const avatar: import("tailwind-variants").TVReturnType<{
25
25
  default: "bg-bg-hover";
26
26
  primary: "bg-primary/20";
27
27
  secondary: "bg-secondary/20";
28
- success: "bg-success-light";
29
- warning: "bg-warning-light";
28
+ success: "bg-container-success";
29
+ warning: "bg-container-warning";
30
30
  };
31
31
  }, undefined, import("tailwind-variants").TVReturnTypeLike<{
32
32
  size: {
@@ -39,8 +39,8 @@ declare const avatar: import("tailwind-variants").TVReturnType<{
39
39
  default: "bg-bg-hover";
40
40
  primary: "bg-primary/20";
41
41
  secondary: "bg-secondary/20";
42
- success: "bg-success-light";
43
- warning: "bg-warning-light";
42
+ success: "bg-container-success";
43
+ warning: "bg-container-warning";
44
44
  };
45
45
  }, undefined>>;
46
46
  export interface AvatarProps extends Omit<VariantProps<typeof avatar>, "size"> {
@@ -15,8 +15,8 @@ const avatar = tv({
15
15
  default: "bg-bg-hover",
16
16
  primary: "bg-primary/20",
17
17
  secondary: "bg-secondary/20",
18
- success: "bg-success-light",
19
- warning: "bg-warning-light",
18
+ success: "bg-container-success",
19
+ warning: "bg-container-warning",
20
20
  },
21
21
  },
22
22
  defaultVariants: {
@@ -9,7 +9,7 @@ const badge = tv({
9
9
  variants: {
10
10
  variant: {
11
11
  info: {
12
- root: "bg-info-light",
12
+ root: "bg-container-info",
13
13
  text: "text-info",
14
14
  },
15
15
  infoDark: {
@@ -17,11 +17,11 @@ const badge = tv({
17
17
  text: "text-text-on-primary",
18
18
  },
19
19
  warning: {
20
- root: "bg-warning-light",
20
+ root: "bg-container-warning",
21
21
  text: "text-warning",
22
22
  },
23
23
  success: {
24
- root: "bg-success-light",
24
+ root: "bg-container-success",
25
25
  text: "text-success",
26
26
  },
27
27
  successDark: {
@@ -29,7 +29,7 @@ const badge = tv({
29
29
  text: "text-text-on-primary",
30
30
  },
31
31
  danger: {
32
- root: "bg-danger-light",
32
+ root: "bg-container-danger",
33
33
  text: "text-danger",
34
34
  },
35
35
  },
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
2
  import Pressable from "../primitives/Pressable.js";
3
- import { theme } from "../theme/index.js";
3
+ import { useTheme } from "../theme/index.js";
4
4
  import { cn, tv } from "../theme/tw.js";
5
5
  import { Typography } from "../Typography/index.js";
6
6
  import { View } from "react-native";
@@ -19,7 +19,10 @@ const card = tv({
19
19
  },
20
20
  });
21
21
  function Card({ padding = "md", elevation = "sm", onPress, className, children, testID, }) {
22
- const shadow = elevation === "none" ? undefined : theme.shadow[elevation];
22
+ const theme = useTheme();
23
+ const shadow = elevation === "none"
24
+ ? { borderCurve: "continuous" }
25
+ : { ...theme.shadow[elevation], borderCurve: "continuous" };
23
26
  if (onPress) {
24
27
  return (_jsx(Pressable, { className: card({ padding, className }), onPress: onPress, style: shadow, testID: testID, children: children }));
25
28
  }