@sincpro/mobile-ui 0.2.1 → 0.3.1
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.
- package/README.md +75 -20
- package/dist/Dialog/BottomSheet/BottomSheet.Root.d.ts +13 -9
- package/dist/Dialog/BottomSheet/BottomSheet.Root.js +6 -2
- package/dist/Dialog/Confirmation.context.d.ts +1 -1
- package/dist/Dialog/Dialog.ActionSheet.d.ts +17 -0
- package/dist/Dialog/Dialog.ActionSheet.js +16 -0
- package/dist/Dialog/Dialog.Confirmation.js +5 -1
- package/dist/Dialog/Dialog.EditValue.d.ts +1 -1
- package/dist/Dialog/Dialog.EditValue.js +1 -1
- package/dist/Dialog/Dialog.Sheet.d.ts +26 -0
- package/dist/Dialog/Dialog.Sheet.js +55 -0
- package/dist/Dialog/index.d.ts +9 -7
- package/dist/Dialog/index.js +2 -0
- package/dist/Display/Display.Accordion.d.ts +18 -0
- package/dist/Display/Display.Accordion.js +22 -0
- package/dist/Display/Display.AvatarGroup.d.ts +12 -0
- package/dist/Display/Display.AvatarGroup.js +23 -0
- package/dist/Display/Display.Badge.d.ts +1 -1
- package/dist/Display/Display.Card.d.ts +46 -0
- package/dist/Display/Display.Card.js +36 -0
- package/dist/Display/Display.Carousel.d.ts +13 -0
- package/dist/Display/Display.Carousel.js +19 -0
- package/dist/Display/Display.Chip.d.ts +105 -0
- package/dist/Display/Display.Chip.js +45 -0
- package/dist/Display/Display.CopyableText.d.ts +1 -1
- package/dist/Display/Display.CountRecords.d.ts +1 -1
- package/dist/Display/Display.DataTable.d.ts +19 -0
- package/dist/Display/Display.DataTable.js +22 -0
- package/dist/Display/Display.Date.d.ts +15 -2
- package/dist/Display/Display.Date.js +34 -4
- package/dist/Display/Display.Divider.d.ts +1 -1
- package/dist/Display/Display.GradientSurface.d.ts +116 -0
- package/dist/Display/Display.GradientSurface.js +62 -0
- package/dist/Display/Display.IconBadge.d.ts +13 -0
- package/dist/Display/Display.IconBadge.js +30 -0
- package/dist/Display/Display.Image.d.ts +15 -0
- package/dist/Display/Display.Image.js +17 -0
- package/dist/Display/Display.KeyValue.d.ts +10 -0
- package/dist/Display/Display.KeyValue.js +9 -0
- package/dist/Display/Display.ListItem.d.ts +17 -0
- package/dist/Display/Display.ListItem.js +18 -0
- package/dist/Display/Display.Logo.js +3 -1
- package/dist/Display/Display.MediaCard.d.ts +17 -0
- package/dist/Display/Display.MediaCard.js +12 -0
- package/dist/Display/Display.MediaEmbed.d.ts +19 -0
- package/dist/Display/Display.MediaEmbed.js +39 -0
- package/dist/Display/Display.MenuButton.d.ts +1 -1
- package/dist/Display/Display.Monetary.d.ts +1 -1
- package/dist/Display/Display.Monetary.js +1 -1
- package/dist/Display/Display.Pattern.d.ts +26 -0
- package/dist/Display/Display.Pattern.js +27 -0
- package/dist/Display/Display.PriceTag.d.ts +10 -0
- package/dist/Display/Display.PriceTag.js +23 -0
- package/dist/Display/Display.ProductCard.d.ts +17 -0
- package/dist/Display/Display.ProductCard.js +13 -0
- package/dist/Display/Display.Rating.d.ts +11 -0
- package/dist/Display/Display.Rating.js +16 -0
- package/dist/Display/Display.SearchHistory.d.ts +12 -0
- package/dist/Display/Display.SearchHistory.js +13 -0
- package/dist/Display/Display.SectionHeader.d.ts +13 -0
- package/dist/Display/Display.SectionHeader.js +9 -0
- package/dist/Display/Display.Stat.d.ts +10 -0
- package/dist/Display/Display.Stat.js +9 -0
- package/dist/Display/Display.StatCard.d.ts +14 -0
- package/dist/Display/Display.StatCard.js +13 -0
- package/dist/Display/Display.StatusDot.d.ts +11 -0
- package/dist/Display/Display.StatusDot.js +28 -0
- package/dist/Display/Display.Story.d.ts +15 -0
- package/dist/Display/Display.Story.js +43 -0
- package/dist/Display/Display.StoryTray.d.ts +26 -0
- package/dist/Display/Display.StoryTray.js +43 -0
- package/dist/Display/Display.StoryViewer.d.ts +26 -0
- package/dist/Display/Display.StoryViewer.js +79 -0
- package/dist/Display/Display.SwipeableRow.d.ts +15 -0
- package/dist/Display/Display.SwipeableRow.js +28 -0
- package/dist/Display/Display.Tag.d.ts +11 -0
- package/dist/Display/Display.Tag.js +9 -0
- package/dist/Display/Display.Timeline.d.ts +13 -0
- package/dist/Display/Display.Timeline.js +19 -0
- package/dist/Display/Display.Tooltip.d.ts +10 -0
- package/dist/Display/Display.Tooltip.js +24 -0
- package/dist/Display/index.d.ts +70 -0
- package/dist/Display/index.js +58 -0
- package/dist/Feedback/ErrorBoundary.d.ts +1 -1
- package/dist/Feedback/Feedback.Banner.d.ts +82 -0
- package/dist/Feedback/Feedback.Banner.js +35 -0
- package/dist/Feedback/Feedback.DomainSplashScreen.d.ts +2 -1
- package/dist/Feedback/Feedback.DomainSplashScreen.js +3 -2
- package/dist/Feedback/Feedback.Empty.d.ts +1 -1
- package/dist/Feedback/Feedback.EmptyState.d.ts +15 -0
- package/dist/Feedback/Feedback.EmptyState.js +11 -0
- package/dist/Feedback/Feedback.Error.d.ts +1 -1
- package/dist/Feedback/Feedback.Loading.d.ts +8 -1
- package/dist/Feedback/Feedback.Loading.js +7 -1
- package/dist/Feedback/Feedback.PermissionCard.d.ts +15 -0
- package/dist/Feedback/Feedback.PermissionCard.js +11 -0
- package/dist/Feedback/Feedback.Progress.d.ts +9 -0
- package/dist/Feedback/Feedback.Progress.js +35 -0
- package/dist/Feedback/Feedback.ProgressCircle.d.ts +12 -0
- package/dist/Feedback/Feedback.ProgressCircle.js +15 -0
- package/dist/Feedback/Feedback.Skeleton.d.ts +11 -0
- package/dist/Feedback/Feedback.Skeleton.js +29 -0
- package/dist/Feedback/Feedback.Spinner.js +2 -1
- package/dist/Feedback/Feedback.Splash.d.ts +7 -1
- package/dist/Feedback/Feedback.Splash.js +11 -2
- package/dist/Feedback/Toast.context.d.ts +42 -0
- package/dist/Feedback/Toast.context.js +121 -0
- package/dist/Feedback/index.d.ts +15 -0
- package/dist/Feedback/index.js +15 -0
- package/dist/Form/Form.Button.d.ts +10 -4
- package/dist/Form/Form.Button.js +27 -16
- package/dist/Form/Form.Checkbox.d.ts +1 -1
- package/dist/Form/Form.Checkbox.js +1 -1
- package/dist/Form/Form.ControlledCheckbox.d.ts +1 -1
- package/dist/Form/Form.ControlledInput.d.ts +1 -1
- package/dist/Form/Form.ControlledMonetaryInput.d.ts +1 -1
- package/dist/Form/Form.ControlledRadioButton.d.ts +1 -1
- package/dist/Form/Form.DatePicker.d.ts +20 -0
- package/dist/Form/Form.DatePicker.js +38 -0
- package/dist/Form/Form.Dropdown.d.ts +1 -1
- package/dist/Form/Form.FAB.d.ts +10 -0
- package/dist/Form/Form.FAB.js +17 -0
- package/dist/Form/Form.FilterButton.d.ts +1 -1
- package/dist/Form/Form.FractionalQuantityInput.d.ts +1 -1
- package/dist/Form/Form.IconButton.d.ts +1 -1
- package/dist/Form/Form.Input.d.ts +2 -1
- package/dist/Form/Form.Input.js +1 -1
- package/dist/Form/Form.InputField.js +1 -1
- package/dist/Form/Form.MonetaryInput.d.ts +1 -1
- package/dist/Form/Form.PinInput.d.ts +12 -0
- package/dist/Form/Form.PinInput.js +23 -0
- package/dist/Form/Form.QuantitySelector.d.ts +2 -1
- package/dist/Form/Form.QuantitySelector.js +1 -1
- package/dist/Form/Form.RadioButton.d.ts +1 -1
- package/dist/Form/Form.SearchBar.d.ts +6 -1
- package/dist/Form/Form.SearchBar.js +4 -0
- package/dist/Form/Form.Select.d.ts +17 -0
- package/dist/Form/Form.Select.js +26 -0
- package/dist/Form/Form.Slider.d.ts +20 -0
- package/dist/Form/Form.Slider.js +16 -0
- package/dist/Form/Form.Switch.d.ts +10 -0
- package/dist/Form/Form.Switch.js +9 -0
- package/dist/Form/index.d.ts +12 -0
- package/dist/Form/index.js +12 -0
- package/dist/Navigation/Navigation.AppBar.d.ts +57 -0
- package/dist/Navigation/Navigation.AppBar.js +72 -0
- package/dist/Navigation/Navigation.BottomNav.d.ts +57 -0
- package/dist/Navigation/Navigation.BottomNav.js +108 -0
- package/dist/Navigation/Navigation.CollapsingHeader.d.ts +34 -0
- package/dist/Navigation/Navigation.CollapsingHeader.js +47 -0
- package/dist/Navigation/Navigation.FloatingBar.d.ts +15 -0
- package/dist/Navigation/Navigation.FloatingBar.js +21 -0
- package/dist/Navigation/Navigation.Header.d.ts +6 -2
- package/dist/Navigation/Navigation.Header.js +4 -0
- package/dist/Navigation/Navigation.HeaderToolbar.d.ts +1 -1
- package/dist/Navigation/Navigation.Menu.d.ts +21 -0
- package/dist/Navigation/Navigation.Menu.js +42 -0
- package/dist/Navigation/Navigation.RowItem.d.ts +1 -1
- package/dist/Navigation/Navigation.SearchBar.d.ts +18 -0
- package/dist/Navigation/Navigation.SearchBar.js +28 -0
- package/dist/Navigation/Navigation.SegmentedControl.d.ts +14 -0
- package/dist/Navigation/Navigation.SegmentedControl.js +13 -0
- package/dist/Navigation/Navigation.Steps.d.ts +8 -0
- package/dist/Navigation/Navigation.Steps.js +17 -0
- package/dist/Navigation/Navigation.TabIcon.d.ts +5 -1
- package/dist/Navigation/Navigation.TabIcon.js +4 -0
- package/dist/Navigation/Navigation.TabItem.d.ts +5 -0
- package/dist/Navigation/Navigation.TabItem.js +5 -0
- package/dist/Navigation/Navigation.Tabs.d.ts +28 -0
- package/dist/Navigation/Navigation.Tabs.js +45 -0
- package/dist/Navigation/index.d.ts +32 -1
- package/dist/Navigation/index.js +18 -0
- package/dist/Typography/Typography.Text.d.ts +3 -2
- package/dist/Typography/Typography.Text.js +16 -6
- package/dist/branding.d.ts +6 -0
- package/dist/branding.js +7 -0
- package/dist/icons/ArrowDownIcon.d.ts +2 -1
- package/dist/icons/ArrowUpIcon.d.ts +2 -1
- package/dist/icons/CreditIcon.d.ts +1 -1
- package/dist/icons/OdooIcon.d.ts +6 -1
- package/dist/icons/OdooIcon.js +5 -0
- package/dist/icons/PrinterIcon.d.ts +5 -0
- package/dist/icons/PrinterIcon.js +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/layouts/AuthContainer.d.ts +1 -1
- package/dist/layouts/AuthContainer.js +2 -2
- package/dist/layouts/Container.d.ts +1 -0
- package/dist/layouts/Container.js +2 -3
- package/dist/layouts/GradientContainer.d.ts +1 -1
- package/dist/layouts/PlainLayout.d.ts +1 -1
- package/dist/layouts/ScrollContainer.d.ts +2 -2
- package/dist/layouts/ScrollContainer.js +1 -1
- package/dist/layouts/TabNavigatorLayout.d.ts +2 -2
- package/dist/layouts/TabNavigatorLayout.js +4 -0
- package/dist/primitives/AspectRatio.d.ts +10 -0
- package/dist/primitives/AspectRatio.js +8 -0
- package/dist/primitives/Box.d.ts +1 -1
- package/dist/primitives/Pressable.d.ts +10 -0
- package/dist/primitives/Pressable.js +9 -0
- package/dist/primitives/Row.d.ts +1 -1
- package/dist/primitives/Spacer.d.ts +8 -0
- package/dist/primitives/Spacer.js +9 -0
- package/dist/primitives/Stack.d.ts +1 -1
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.js +3 -0
- package/dist/theme/active.d.ts +2 -0
- package/dist/theme/active.js +13 -0
- package/dist/theme/components/ThemedActivityIndicator.d.ts +1 -1
- package/dist/theme/components/index.d.ts +1 -1
- package/dist/theme/components/index.js +1 -1
- package/dist/theme/dark.d.ts +7 -0
- package/dist/theme/dark.js +85 -0
- package/dist/theme/default.js +1 -0
- package/dist/theme/define.d.ts +5 -5
- package/dist/theme/define.js +5 -5
- package/dist/theme/index.d.ts +4 -1
- package/dist/theme/index.js +4 -1
- package/dist/theme/theme.d.ts +1 -1
- package/dist/theme/theme.js +1 -1
- package/dist/theme/types.d.ts +15 -14
- package/dist/theme/types.js +2 -2
- package/dist/theme/typography.d.ts +117 -60
- package/dist/theme/typography.js +115 -29
- package/dist/theme/useTheme.d.ts +3 -1
- package/dist/theme/useTheme.js +6 -1
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.js +2 -0
- package/dist/tokens/motion.d.ts +71 -0
- package/dist/tokens/motion.js +25 -0
- package/dist/utils/date.d.ts +33 -33
- package/dist/utils/date.js +39 -39
- package/dist/utils/timezone.d.ts +5 -0
- package/dist/views/AuthFormView.d.ts +1 -1
- package/dist/views/FormViewV2.context.d.ts +1 -1
- package/dist/views/FormViewV2.d.ts +12 -11
- package/dist/views/FormViewV2.js +8 -4
- package/dist/views/ListViewV2.context.d.ts +6 -2
- package/dist/views/ListViewV2.context.js +3 -1
- package/dist/views/ListViewV2.d.ts +26 -21
- package/dist/views/ListViewV2.js +18 -20
- package/dist/views/Wizard/Wizard.context.d.ts +1 -1
- package/dist/widgets/CircleButton.d.ts +6 -2
- package/dist/widgets/CircleButton.js +4 -0
- package/dist/widgets/GeoPermissionCard.d.ts +6 -1
- package/dist/widgets/GeoPermissionCard.js +8 -3
- package/dist/widgets/HomeHeader.d.ts +4 -0
- package/dist/widgets/HomeHeader.js +4 -0
- package/dist/widgets/JSONViewer.d.ts +2 -1
- package/dist/widgets/JSONViewer.js +9 -12
- package/dist/widgets/MenuCard.d.ts +1 -1
- package/dist/widgets/ScreenHeader.d.ts +5 -1
- package/dist/widgets/ScreenHeader.js +4 -0
- package/dist/widgets/TimeZoneSelector.d.ts +6 -1
- package/dist/widgets/TimeZoneSelector.js +6 -1
- package/dist/widgets/TimeZoneSelectorModal.d.ts +6 -1
- package/dist/widgets/TimeZoneSelectorModal.js +8 -3
- package/package.json +41 -23
- package/tailwind.preset.js +14 -0
- package/dist/notifications/index.d.ts +0 -1
- package/dist/notifications/index.js +0 -1
- package/dist/providers/index.d.ts +0 -1
- package/dist/providers/index.js +0 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface PermissionCardProps {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
granted?: boolean;
|
|
5
|
+
icon?: string;
|
|
6
|
+
grantedLabel?: string;
|
|
7
|
+
deniedLabel?: string;
|
|
8
|
+
actionLabel?: string;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
onRequest?: () => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
testID?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function PermissionCard({ title, description, granted, icon, grantedLabel, deniedLabel, actionLabel, loading, onRequest, className, testID, }: PermissionCardProps): import("react").JSX.Element;
|
|
15
|
+
export default PermissionCard;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
+
import Icon from "../Display/Display.Icon";
|
|
3
|
+
import { BaseButton } from "../primitives/BaseButton";
|
|
4
|
+
import { theme } from "../theme";
|
|
5
|
+
import { cn } from "../theme/tw";
|
|
6
|
+
import { Typography } from "../Typography";
|
|
7
|
+
import { View } from "react-native";
|
|
8
|
+
function PermissionCard({ title, description, granted = false, icon = "lock-closed", grantedLabel = "Permiso activo", deniedLabel = "Permiso inactivo", actionLabel = "Permitir", loading = false, onRequest, className, testID, }) {
|
|
9
|
+
return (_jsx(View, { className: cn("bg-bg-card rounded-xl p-4 border border-border-light", className), style: theme.shadow.sm, testID: testID, children: _jsxs(View, { className: "flex-row items-start gap-3", children: [_jsx(Icon, { color: granted ? theme.success : theme.danger, name: granted ? "checkmark-circle" : icon, size: 32 }), _jsxs(View, { className: "flex-1 gap-1", children: [_jsx(Typography.Text, { className: "text-text-primary", semibold: true, variant: "body", children: title }), description ? (_jsx(Typography.Text, { className: "text-text-secondary", variant: "bodySmall", children: description })) : null, _jsx(Typography.Text, { style: { color: granted ? theme.success : theme.danger }, variant: "bodySmall", children: granted ? grantedLabel : deniedLabel }), !granted && onRequest ? (_jsx(View, { className: "mt-2 self-start", children: _jsx(BaseButton, { loading: loading, onPress: onRequest, size: "small", title: actionLabel }) })) : null] })] }) }));
|
|
10
|
+
}
|
|
11
|
+
export default PermissionCard;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ProgressProps {
|
|
2
|
+
value?: number;
|
|
3
|
+
indeterminate?: boolean;
|
|
4
|
+
height?: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
testID?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function Progress({ value, indeterminate, height, className, testID, }: ProgressProps): import("react").JSX.Element;
|
|
9
|
+
export default Progress;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { cn } from "../theme/tw";
|
|
3
|
+
import { motion } from "../tokens/motion";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { Animated, Easing, View } from "react-native";
|
|
6
|
+
function clamp(n) {
|
|
7
|
+
return Math.max(0, Math.min(1, n));
|
|
8
|
+
}
|
|
9
|
+
function Progress({ value = 0, indeterminate = false, height = 6, className, testID, }) {
|
|
10
|
+
const translate = useRef(new Animated.Value(0)).current;
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!indeterminate)
|
|
13
|
+
return;
|
|
14
|
+
const loop = Animated.loop(Animated.timing(translate, {
|
|
15
|
+
toValue: 1,
|
|
16
|
+
duration: motion.duration.slower,
|
|
17
|
+
easing: Easing.inOut(Easing.ease),
|
|
18
|
+
useNativeDriver: true,
|
|
19
|
+
}));
|
|
20
|
+
loop.start();
|
|
21
|
+
return () => loop.stop();
|
|
22
|
+
}, [indeterminate, translate]);
|
|
23
|
+
return (_jsx(View, { accessibilityRole: "progressbar", accessibilityValue: indeterminate ? undefined : { now: Math.round(clamp(value) * 100), min: 0, max: 100 }, className: cn("w-full overflow-hidden rounded-full bg-bg-muted", className), style: { height }, testID: testID, children: indeterminate ? (_jsx(Animated.View, { className: "h-full rounded-full bg-primary", style: {
|
|
24
|
+
width: "40%",
|
|
25
|
+
transform: [
|
|
26
|
+
{
|
|
27
|
+
translateX: translate.interpolate({
|
|
28
|
+
inputRange: [0, 1],
|
|
29
|
+
outputRange: ["-40%", "250%"],
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
} })) : (_jsx(View, { className: "h-full rounded-full bg-primary", style: { width: `${clamp(value) * 100}%` } })) }));
|
|
34
|
+
}
|
|
35
|
+
export default Progress;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface ProgressCircleProps {
|
|
3
|
+
value?: number;
|
|
4
|
+
size?: number;
|
|
5
|
+
strokeWidth?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
trackColor?: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
testID?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function ProgressCircle({ value, size, strokeWidth, color, trackColor, children, testID, }: ProgressCircleProps): import("react").JSX.Element;
|
|
12
|
+
export default ProgressCircle;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
+
import { theme } from "../theme";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import Svg, { Circle } from "react-native-svg";
|
|
5
|
+
function clamp(n) {
|
|
6
|
+
return Math.max(0, Math.min(1, n));
|
|
7
|
+
}
|
|
8
|
+
function ProgressCircle({ value = 0, size = 64, strokeWidth = 6, color, trackColor, children, testID, }) {
|
|
9
|
+
const radius = (size - strokeWidth) / 2;
|
|
10
|
+
const circumference = 2 * Math.PI * radius;
|
|
11
|
+
const offset = circumference * (1 - clamp(value));
|
|
12
|
+
const center = size / 2;
|
|
13
|
+
return (_jsxs(View, { accessibilityRole: "progressbar", accessibilityValue: { now: Math.round(clamp(value) * 100), min: 0, max: 100 }, style: { width: size, height: size, alignItems: "center", justifyContent: "center" }, testID: testID, children: [_jsxs(Svg, { height: size, style: { position: "absolute" }, width: size, children: [_jsx(Circle, { cx: center, cy: center, fill: "none", r: radius, stroke: trackColor ?? theme.bg.muted, strokeWidth: strokeWidth }), _jsx(Circle, { cx: center, cy: center, fill: "none", r: radius, stroke: color ?? theme.primary, strokeDasharray: `${circumference} ${circumference}`, strokeDashoffset: offset, strokeLinecap: "round", strokeWidth: strokeWidth, transform: `rotate(-90 ${center} ${center})` })] }), children] }));
|
|
14
|
+
}
|
|
15
|
+
export default ProgressCircle;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type DimensionValue, type ViewStyle } from "react-native";
|
|
2
|
+
export interface SkeletonProps {
|
|
3
|
+
width?: DimensionValue;
|
|
4
|
+
height?: DimensionValue;
|
|
5
|
+
radius?: number;
|
|
6
|
+
circle?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: ViewStyle;
|
|
9
|
+
}
|
|
10
|
+
declare function Skeleton({ width, height, radius, circle, className, style, }: SkeletonProps): import("react").JSX.Element;
|
|
11
|
+
export default Skeleton;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { cn } from "../theme/tw";
|
|
3
|
+
import { motion } from "../tokens/motion";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { Animated, Easing } from "react-native";
|
|
6
|
+
function Skeleton({ width = "100%", height = 16, radius = 8, circle = false, className, style, }) {
|
|
7
|
+
const opacity = useRef(new Animated.Value(0.5)).current;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const pulse = Animated.loop(Animated.sequence([
|
|
10
|
+
Animated.timing(opacity, {
|
|
11
|
+
toValue: 1,
|
|
12
|
+
duration: motion.duration.slow,
|
|
13
|
+
easing: Easing.inOut(Easing.ease),
|
|
14
|
+
useNativeDriver: true,
|
|
15
|
+
}),
|
|
16
|
+
Animated.timing(opacity, {
|
|
17
|
+
toValue: 0.5,
|
|
18
|
+
duration: motion.duration.slow,
|
|
19
|
+
easing: Easing.inOut(Easing.ease),
|
|
20
|
+
useNativeDriver: true,
|
|
21
|
+
}),
|
|
22
|
+
]));
|
|
23
|
+
pulse.start();
|
|
24
|
+
return () => pulse.stop();
|
|
25
|
+
}, [opacity]);
|
|
26
|
+
const resolvedRadius = circle && typeof height === "number" ? height / 2 : radius;
|
|
27
|
+
return (_jsx(Animated.View, { accessibilityElementsHidden: true, className: cn("bg-bg-muted", className), importantForAccessibility: "no-hide-descendants", style: [{ width, height, borderRadius: resolvedRadius }, style, { opacity }] }));
|
|
28
|
+
}
|
|
29
|
+
export default Skeleton;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
+
import { theme } from "../theme";
|
|
2
3
|
import { cn } from "../theme/tw";
|
|
3
4
|
import { Typography } from "../Typography";
|
|
4
5
|
import { ActivityIndicator, View } from "react-native";
|
|
5
|
-
const Spinner = ({ size = "large", color =
|
|
6
|
+
const Spinner = ({ size = "large", color = theme.primary, text, style, className, }) => {
|
|
6
7
|
return (_jsxs(View, { className: cn("items-center justify-center", className), style: style, children: [_jsx(ActivityIndicator, { color: color, size: size }), text && (_jsx(Typography.Text, { className: "mt-2.5 text-base", variant: "body", children: text }))] }));
|
|
7
8
|
};
|
|
8
9
|
export default Spinner;
|
|
@@ -5,7 +5,13 @@ interface SplashScreenProps {
|
|
|
5
5
|
logo?: ImageSourcePropType;
|
|
6
6
|
minDuration?: number;
|
|
7
7
|
message?: string;
|
|
8
|
+
/** `default` keeps the legacy look; `hero` is the modern dark gradient + dotted texture. */
|
|
9
|
+
variant?: "default" | "hero";
|
|
10
|
+
/** Brand name shown under the logo on `hero`. */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** Small caption under the title on `hero` (e.g. "gestión · v2.0"). */
|
|
13
|
+
subtitle?: string;
|
|
8
14
|
children?: ReactNode;
|
|
9
15
|
}
|
|
10
|
-
declare function Splash({ isReady, logo, minDuration, message, children, }: SplashScreenProps): string | number | bigint | boolean | import("react
|
|
16
|
+
declare function Splash({ isReady, logo, minDuration, message, variant, title, subtitle, children, }: SplashScreenProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
11
17
|
export default Splash;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
+
import GradientSurface from "../Display/Display.GradientSurface";
|
|
3
|
+
import Pattern from "../Display/Display.Pattern";
|
|
2
4
|
import Loading from "../Feedback/Feedback.Loading";
|
|
3
5
|
import GradientContainer from "../layouts/GradientContainer";
|
|
6
|
+
import { Typography } from "../Typography";
|
|
4
7
|
import { useEffect, useRef, useState } from "react";
|
|
5
|
-
import { Image, View } from "react-native";
|
|
8
|
+
import { ActivityIndicator, Image, View } from "react-native";
|
|
6
9
|
function renderLogo(logo) {
|
|
7
10
|
if (!logo) {
|
|
8
11
|
return null;
|
|
9
12
|
}
|
|
10
13
|
return _jsx(Image, { className: "w-[250px] h-[200px] mb-12", resizeMode: "contain", source: logo });
|
|
11
14
|
}
|
|
12
|
-
function
|
|
15
|
+
function HeroSplash({ logo, message, title, subtitle, }) {
|
|
16
|
+
return (_jsxs(GradientSurface, { className: "flex-1 items-center justify-center", preset: "night-green", radius: "none", children: [_jsx(Pattern, { color: "#22E584", kind: "dots", opacity: 0.16, size: 26 }), _jsxs(View, { className: "items-center", children: [logo ? (_jsx(Image, { className: "w-28 h-28 mb-7", resizeMode: "contain", source: logo, style: { shadowColor: "#22E584", shadowOpacity: 0.7, shadowRadius: 28 } })) : null, title ? (_jsx(Typography.Text, { bold: true, style: { color: "#FFFFFF", fontSize: 28, letterSpacing: 1 }, children: title })) : null, subtitle ? (_jsx(Typography.Text, { style: { color: "rgba(255,255,255,0.6)", fontSize: 13, marginTop: 6 }, children: subtitle })) : null, _jsx(View, { className: "mt-10", children: _jsx(ActivityIndicator, { accessibilityLabel: message, color: "#22E584", size: "small" }) })] })] }));
|
|
17
|
+
}
|
|
18
|
+
function Splash({ isReady, logo, minDuration = 800, message = "Inicializando...", variant = "default", title, subtitle, children, }) {
|
|
13
19
|
const [showContent, setShowContent] = useState(false);
|
|
14
20
|
const minDurationTimeoutRef = useRef(null);
|
|
15
21
|
useEffect(() => {
|
|
@@ -30,6 +36,9 @@ function Splash({ isReady, logo, minDuration = 800, message = "Inicializando..."
|
|
|
30
36
|
};
|
|
31
37
|
}, [isReady, minDuration]);
|
|
32
38
|
if (!showContent) {
|
|
39
|
+
if (variant === "hero") {
|
|
40
|
+
return _jsx(HeroSplash, { logo: logo, message: message, subtitle: subtitle, title: title });
|
|
41
|
+
}
|
|
33
42
|
return (_jsx(GradientContainer, { className: "flex-1", children: _jsxs(View, { className: "flex-1 justify-center items-center", children: [renderLogo(logo), _jsx(Loading, { message: message, size: "large" })] }) }));
|
|
34
43
|
}
|
|
35
44
|
return children;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type ToastVariant = "info" | "success" | "warning" | "danger" | "loading";
|
|
3
|
+
export interface ToastAction {
|
|
4
|
+
label: string;
|
|
5
|
+
onPress: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ToastOptions {
|
|
8
|
+
message: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
variant?: ToastVariant;
|
|
11
|
+
duration?: number;
|
|
12
|
+
action?: ToastAction;
|
|
13
|
+
/** Stable id: calling show()/info()/… again with the same id updates the existing toast
|
|
14
|
+
* (and resets its timer) instead of stacking a duplicate. */
|
|
15
|
+
id?: string;
|
|
16
|
+
/** Render a close (✕) button. Defaults to true for persistent toasts (duration 0 / loading),
|
|
17
|
+
* false for auto-dismissing ones. */
|
|
18
|
+
dismissible?: boolean;
|
|
19
|
+
}
|
|
20
|
+
type MessageOrFn<T> = string | ((value: T) => string);
|
|
21
|
+
export interface ToastPromiseMessages<T> {
|
|
22
|
+
loading: string;
|
|
23
|
+
success: MessageOrFn<T>;
|
|
24
|
+
error: MessageOrFn<unknown>;
|
|
25
|
+
}
|
|
26
|
+
export interface ToastContextValue {
|
|
27
|
+
show: (options: ToastOptions) => string;
|
|
28
|
+
update: (id: string, options: Partial<ToastOptions>) => void;
|
|
29
|
+
hide: (id: string) => void;
|
|
30
|
+
info: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
|
|
31
|
+
success: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
|
|
32
|
+
warning: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
|
|
33
|
+
danger: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
|
|
34
|
+
loading: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
|
|
35
|
+
promise: <T>(promise: Promise<T>, messages: ToastPromiseMessages<T>) => Promise<T>;
|
|
36
|
+
}
|
|
37
|
+
export declare function ToastProvider({ children, position, }: {
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
position?: "top" | "bottom";
|
|
40
|
+
}): import("react").JSX.Element;
|
|
41
|
+
export declare function useToast(): ToastContextValue;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "nativewind/jsx-runtime";
|
|
2
|
+
import Icon from "../Display/Display.Icon";
|
|
3
|
+
import Pressable from "../primitives/Pressable";
|
|
4
|
+
import { theme } from "../theme";
|
|
5
|
+
import { tv } from "../theme/tw";
|
|
6
|
+
import { Typography } from "../Typography";
|
|
7
|
+
import { createContext, useCallback, useContext, useMemo, useRef, useState, } from "react";
|
|
8
|
+
import { ActivityIndicator, View } from "react-native";
|
|
9
|
+
import Animated, { FadeInDown, FadeInUp, FadeOutDown, FadeOutUp, } from "react-native-reanimated";
|
|
10
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
11
|
+
const ToastContext = createContext(null);
|
|
12
|
+
const DEFAULT_DURATION = 3500;
|
|
13
|
+
// iOS-style card: rounded, hairline border + soft shadow, neutral surface. The variant is
|
|
14
|
+
// conveyed by the colored icon (no left-accent stripe — it doesn't read well on iOS).
|
|
15
|
+
const toast = tv({
|
|
16
|
+
slots: {
|
|
17
|
+
root: "flex-row items-center gap-3 rounded-2xl px-4 py-3 bg-bg-card border border-border-light shadow-lg",
|
|
18
|
+
title: "text-sm font-semibold text-text-primary",
|
|
19
|
+
message: "text-sm text-text-secondary",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const iconByVariant = {
|
|
23
|
+
info: { name: "information-circle", color: theme.info },
|
|
24
|
+
success: { name: "checkmark-circle", color: theme.success },
|
|
25
|
+
warning: { name: "warning", color: theme.warning },
|
|
26
|
+
danger: { name: "close-circle", color: theme.danger },
|
|
27
|
+
};
|
|
28
|
+
function ToastItem({ entry, onHide, position, }) {
|
|
29
|
+
const variant = entry.variant ?? "info";
|
|
30
|
+
const styles = toast();
|
|
31
|
+
const entering = position === "top" ? FadeInDown : FadeInUp;
|
|
32
|
+
const exiting = position === "top" ? FadeOutUp : FadeOutDown;
|
|
33
|
+
const resolvedDuration = entry.duration ?? (variant === "loading" ? 0 : DEFAULT_DURATION);
|
|
34
|
+
const showClose = entry.dismissible ?? resolvedDuration === 0;
|
|
35
|
+
return (_jsxs(Animated.View, { accessibilityLiveRegion: "polite", accessible: true, className: styles.root(), entering: entering.duration(220), exiting: exiting.duration(180), children: [variant === "loading" ? (_jsx(ActivityIndicator, { color: theme.primary, size: "small" })) : (_jsx(Icon, { color: iconByVariant[variant].color, name: iconByVariant[variant].name, size: 22 })), _jsxs(View, { className: "flex-1", children: [entry.title ? (_jsx(Typography.Text, { className: styles.title(), children: entry.title })) : null, _jsx(Typography.Text, { className: styles.message(), children: entry.message })] }), entry.action ? (_jsx(Pressable, { accessibilityLabel: entry.action.label, onPress: () => {
|
|
36
|
+
entry.action?.onPress();
|
|
37
|
+
onHide(entry.id);
|
|
38
|
+
}, children: _jsx(Typography.Text, { className: "text-primary text-sm font-semibold", children: entry.action.label }) })) : null, showClose ? (_jsx(Pressable, { accessibilityLabel: "Cerrar", hitSlop: 8, onPress: () => onHide(entry.id), children: _jsx(Icon, { color: theme.text.tertiary, name: "close", size: 18 }) })) : null] }));
|
|
39
|
+
}
|
|
40
|
+
export function ToastProvider({ children, position = "bottom", }) {
|
|
41
|
+
const insets = useSafeAreaInsets();
|
|
42
|
+
const [toasts, setToasts] = useState([]);
|
|
43
|
+
const counter = useRef(0);
|
|
44
|
+
const timers = useRef({});
|
|
45
|
+
const clearTimer = useCallback((id) => {
|
|
46
|
+
const timer = timers.current[id];
|
|
47
|
+
if (timer) {
|
|
48
|
+
clearTimeout(timer);
|
|
49
|
+
delete timers.current[id];
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
const hide = useCallback((id) => {
|
|
53
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
54
|
+
clearTimer(id);
|
|
55
|
+
}, [clearTimer]);
|
|
56
|
+
const scheduleDismiss = useCallback((id, variant, duration) => {
|
|
57
|
+
clearTimer(id);
|
|
58
|
+
const resolved = duration ?? (variant === "loading" ? 0 : DEFAULT_DURATION);
|
|
59
|
+
if (resolved > 0) {
|
|
60
|
+
timers.current[id] = setTimeout(() => hide(id), resolved);
|
|
61
|
+
}
|
|
62
|
+
}, [clearTimer, hide]);
|
|
63
|
+
const show = useCallback((options) => {
|
|
64
|
+
let id = options.id;
|
|
65
|
+
if (!id) {
|
|
66
|
+
counter.current += 1;
|
|
67
|
+
id = `toast-${counter.current}`;
|
|
68
|
+
}
|
|
69
|
+
const toastId = id;
|
|
70
|
+
setToasts((prev) => prev.some((t) => t.id === toastId)
|
|
71
|
+
? prev.map((t) => (t.id === toastId ? { ...t, ...options, id: toastId } : t))
|
|
72
|
+
: [...prev, { ...options, id: toastId }]);
|
|
73
|
+
scheduleDismiss(toastId, options.variant, options.duration);
|
|
74
|
+
return toastId;
|
|
75
|
+
}, [scheduleDismiss]);
|
|
76
|
+
const update = useCallback((id, options) => {
|
|
77
|
+
setToasts((prev) => prev.map((t) => (t.id === id ? { ...t, ...options } : t)));
|
|
78
|
+
scheduleDismiss(id, options.variant, options.duration);
|
|
79
|
+
}, [scheduleDismiss]);
|
|
80
|
+
const value = useMemo(() => {
|
|
81
|
+
const promise = (p, messages) => {
|
|
82
|
+
const id = show({ message: messages.loading, variant: "loading", duration: 0 });
|
|
83
|
+
return p.then((result) => {
|
|
84
|
+
const msg = messages.success;
|
|
85
|
+
update(id, {
|
|
86
|
+
message: typeof msg === "function" ? msg(result) : msg,
|
|
87
|
+
variant: "success",
|
|
88
|
+
duration: DEFAULT_DURATION,
|
|
89
|
+
});
|
|
90
|
+
return result;
|
|
91
|
+
}, (err) => {
|
|
92
|
+
const msg = messages.error;
|
|
93
|
+
update(id, {
|
|
94
|
+
message: typeof msg === "function" ? msg(err) : msg,
|
|
95
|
+
variant: "danger",
|
|
96
|
+
duration: DEFAULT_DURATION,
|
|
97
|
+
});
|
|
98
|
+
throw err;
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
show,
|
|
103
|
+
update,
|
|
104
|
+
hide,
|
|
105
|
+
info: (message, options) => show({ ...options, message, variant: "info" }),
|
|
106
|
+
success: (message, options) => show({ ...options, message, variant: "success" }),
|
|
107
|
+
warning: (message, options) => show({ ...options, message, variant: "warning" }),
|
|
108
|
+
danger: (message, options) => show({ ...options, message, variant: "danger" }),
|
|
109
|
+
loading: (message, options) => show({ ...options, message, variant: "loading" }),
|
|
110
|
+
promise,
|
|
111
|
+
};
|
|
112
|
+
}, [show, update, hide]);
|
|
113
|
+
return (_jsxs(ToastContext.Provider, { value: value, children: [children, _jsx(View, { className: "absolute left-0 right-0 px-4 gap-2 z-toast", pointerEvents: "box-none", style: position === "top" ? { top: insets.top + 12 } : { bottom: insets.bottom + 12 }, children: toasts.map((entry) => (_jsx(ToastItem, { entry: entry, onHide: hide, position: position }, entry.id))) })] }));
|
|
114
|
+
}
|
|
115
|
+
export function useToast() {
|
|
116
|
+
const ctx = useContext(ToastContext);
|
|
117
|
+
if (!ctx) {
|
|
118
|
+
throw new Error("useToast debe usarse dentro de <ToastProvider>");
|
|
119
|
+
}
|
|
120
|
+
return ctx;
|
|
121
|
+
}
|
package/dist/Feedback/index.d.ts
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
|
+
import Banner from "../Feedback/Feedback.Banner";
|
|
1
2
|
import DomainSplashScreen from "../Feedback/Feedback.DomainSplashScreen";
|
|
2
3
|
import Empty from "../Feedback/Feedback.Empty";
|
|
4
|
+
import EmptyState from "../Feedback/Feedback.EmptyState";
|
|
3
5
|
import Error from "../Feedback/Feedback.Error";
|
|
4
6
|
import Loading from "../Feedback/Feedback.Loading";
|
|
7
|
+
import PermissionCard from "../Feedback/Feedback.PermissionCard";
|
|
8
|
+
import Progress from "../Feedback/Feedback.Progress";
|
|
9
|
+
import ProgressCircle from "../Feedback/Feedback.ProgressCircle";
|
|
10
|
+
import Skeleton from "../Feedback/Feedback.Skeleton";
|
|
11
|
+
import SplashScreen from "../Feedback/Feedback.Splash";
|
|
5
12
|
export { ErrorBoundary } from "../Feedback/ErrorBoundary";
|
|
13
|
+
export { type ToastAction, type ToastContextValue, type ToastOptions, type ToastPromiseMessages, ToastProvider, type ToastVariant, useToast, } from "../Feedback/Toast.context";
|
|
6
14
|
export declare const Feedback: {
|
|
7
15
|
Loading: typeof Loading;
|
|
8
16
|
Spinner: import("react").FC<import("../Feedback/Feedback.Spinner").SpinnerProps>;
|
|
17
|
+
Skeleton: typeof Skeleton;
|
|
18
|
+
Progress: typeof Progress;
|
|
19
|
+
ProgressCircle: typeof ProgressCircle;
|
|
20
|
+
Banner: typeof Banner;
|
|
21
|
+
PermissionCard: typeof PermissionCard;
|
|
9
22
|
Empty: typeof Empty;
|
|
23
|
+
EmptyState: typeof EmptyState;
|
|
10
24
|
Error: typeof Error;
|
|
25
|
+
SplashScreen: typeof SplashScreen;
|
|
11
26
|
DomainSplashScreen: typeof DomainSplashScreen;
|
|
12
27
|
};
|
|
13
28
|
export default Feedback;
|
package/dist/Feedback/index.js
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
|
+
import Banner from "../Feedback/Feedback.Banner";
|
|
1
2
|
import DomainSplashScreen from "../Feedback/Feedback.DomainSplashScreen";
|
|
2
3
|
import Empty from "../Feedback/Feedback.Empty";
|
|
4
|
+
import EmptyState from "../Feedback/Feedback.EmptyState";
|
|
3
5
|
import Error from "../Feedback/Feedback.Error";
|
|
4
6
|
import Loading from "../Feedback/Feedback.Loading";
|
|
7
|
+
import PermissionCard from "../Feedback/Feedback.PermissionCard";
|
|
8
|
+
import Progress from "../Feedback/Feedback.Progress";
|
|
9
|
+
import ProgressCircle from "../Feedback/Feedback.ProgressCircle";
|
|
10
|
+
import Skeleton from "../Feedback/Feedback.Skeleton";
|
|
5
11
|
import Spinner from "../Feedback/Feedback.Spinner";
|
|
12
|
+
import SplashScreen from "../Feedback/Feedback.Splash";
|
|
6
13
|
export { ErrorBoundary } from "../Feedback/ErrorBoundary";
|
|
14
|
+
export { ToastProvider, useToast, } from "../Feedback/Toast.context";
|
|
7
15
|
export const Feedback = {
|
|
8
16
|
Loading,
|
|
9
17
|
Spinner,
|
|
18
|
+
Skeleton,
|
|
19
|
+
Progress,
|
|
20
|
+
ProgressCircle,
|
|
21
|
+
Banner,
|
|
22
|
+
PermissionCard,
|
|
10
23
|
Empty,
|
|
24
|
+
EmptyState,
|
|
11
25
|
Error,
|
|
26
|
+
SplashScreen,
|
|
12
27
|
DomainSplashScreen,
|
|
13
28
|
};
|
|
14
29
|
export default Feedback;
|
|
@@ -4,6 +4,7 @@ declare const button: import("tailwind-variants").TVReturnType<{
|
|
|
4
4
|
variant: {
|
|
5
5
|
primary: string;
|
|
6
6
|
accent: string;
|
|
7
|
+
cta: string;
|
|
7
8
|
secondary: string;
|
|
8
9
|
outline: string;
|
|
9
10
|
outlineDanger: string;
|
|
@@ -20,10 +21,11 @@ declare const button: import("tailwind-variants").TVReturnType<{
|
|
|
20
21
|
disabled: {
|
|
21
22
|
true: string;
|
|
22
23
|
};
|
|
23
|
-
}, undefined, "rounded-
|
|
24
|
+
}, undefined, "rounded-[13px] items-center justify-center flex-row min-h-[44px]", {
|
|
24
25
|
variant: {
|
|
25
26
|
primary: string;
|
|
26
27
|
accent: string;
|
|
28
|
+
cta: string;
|
|
27
29
|
secondary: string;
|
|
28
30
|
outline: string;
|
|
29
31
|
outlineDanger: string;
|
|
@@ -44,6 +46,7 @@ declare const button: import("tailwind-variants").TVReturnType<{
|
|
|
44
46
|
variant: {
|
|
45
47
|
primary: string;
|
|
46
48
|
accent: string;
|
|
49
|
+
cta: string;
|
|
47
50
|
secondary: string;
|
|
48
51
|
outline: string;
|
|
49
52
|
outlineDanger: string;
|
|
@@ -60,11 +63,12 @@ declare const button: import("tailwind-variants").TVReturnType<{
|
|
|
60
63
|
disabled: {
|
|
61
64
|
true: string;
|
|
62
65
|
};
|
|
63
|
-
}, undefined, "rounded-
|
|
66
|
+
}, undefined, "rounded-[13px] items-center justify-center flex-row min-h-[44px]", unknown, unknown, undefined>>;
|
|
64
67
|
declare const buttonIcon: import("tailwind-variants").TVReturnType<{
|
|
65
68
|
variant: {
|
|
66
69
|
primary: string;
|
|
67
70
|
accent: string;
|
|
71
|
+
cta: string;
|
|
68
72
|
secondary: string;
|
|
69
73
|
outline: string;
|
|
70
74
|
outlineDanger: string;
|
|
@@ -81,10 +85,11 @@ declare const buttonIcon: import("tailwind-variants").TVReturnType<{
|
|
|
81
85
|
disabled: {
|
|
82
86
|
true: string;
|
|
83
87
|
};
|
|
84
|
-
}, undefined, "rounded-
|
|
88
|
+
}, undefined, "rounded-[13px] items-center justify-center aspect-square", {
|
|
85
89
|
variant: {
|
|
86
90
|
primary: string;
|
|
87
91
|
accent: string;
|
|
92
|
+
cta: string;
|
|
88
93
|
secondary: string;
|
|
89
94
|
outline: string;
|
|
90
95
|
outlineDanger: string;
|
|
@@ -105,6 +110,7 @@ declare const buttonIcon: import("tailwind-variants").TVReturnType<{
|
|
|
105
110
|
variant: {
|
|
106
111
|
primary: string;
|
|
107
112
|
accent: string;
|
|
113
|
+
cta: string;
|
|
108
114
|
secondary: string;
|
|
109
115
|
outline: string;
|
|
110
116
|
outlineDanger: string;
|
|
@@ -121,7 +127,7 @@ declare const buttonIcon: import("tailwind-variants").TVReturnType<{
|
|
|
121
127
|
disabled: {
|
|
122
128
|
true: string;
|
|
123
129
|
};
|
|
124
|
-
}, undefined, "rounded-
|
|
130
|
+
}, undefined, "rounded-[13px] items-center justify-center aspect-square", unknown, unknown, undefined>>;
|
|
125
131
|
export interface ButtonProps extends VariantProps<typeof button> {
|
|
126
132
|
title: string;
|
|
127
133
|
onPress?: () => void;
|
package/dist/Form/Form.Button.js
CHANGED
|
@@ -12,12 +12,13 @@ import { runOnJS } from "react-native-reanimated";
|
|
|
12
12
|
// STYLE VARIANTS
|
|
13
13
|
// ============================================================================
|
|
14
14
|
const button = tv({
|
|
15
|
-
base: "rounded-
|
|
15
|
+
base: "rounded-[13px] items-center justify-center flex-row min-h-[44px]",
|
|
16
16
|
variants: {
|
|
17
17
|
variant: {
|
|
18
18
|
primary: "shadow-sm",
|
|
19
19
|
accent: "shadow-sm",
|
|
20
|
-
|
|
20
|
+
cta: "shadow-sm",
|
|
21
|
+
secondary: "bg-bg-muted",
|
|
21
22
|
outline: "bg-transparent border border-primary",
|
|
22
23
|
outlineDanger: "bg-transparent border border-danger",
|
|
23
24
|
outlineBlack: "bg-transparent border border-border-strong",
|
|
@@ -40,12 +41,13 @@ const button = tv({
|
|
|
40
41
|
},
|
|
41
42
|
});
|
|
42
43
|
const buttonIcon = tv({
|
|
43
|
-
base: "rounded-
|
|
44
|
+
base: "rounded-[13px] items-center justify-center aspect-square",
|
|
44
45
|
variants: {
|
|
45
46
|
variant: {
|
|
46
47
|
primary: "shadow-sm",
|
|
47
48
|
accent: "shadow-sm",
|
|
48
|
-
|
|
49
|
+
cta: "shadow-sm",
|
|
50
|
+
secondary: "bg-bg-muted",
|
|
49
51
|
outline: "bg-transparent border border-primary",
|
|
50
52
|
outlineDanger: "bg-transparent border border-danger",
|
|
51
53
|
outlineBlack: "bg-transparent border border-border-strong",
|
|
@@ -71,8 +73,9 @@ const textColor = tv({
|
|
|
71
73
|
variants: {
|
|
72
74
|
variant: {
|
|
73
75
|
primary: "text-white",
|
|
74
|
-
accent: "text-
|
|
75
|
-
|
|
76
|
+
accent: "text-text-on-accent",
|
|
77
|
+
cta: "text-text-on-accent",
|
|
78
|
+
secondary: "text-text-primary",
|
|
76
79
|
outline: "text-primary",
|
|
77
80
|
outlineDanger: "text-danger",
|
|
78
81
|
outlineBlack: "text-text-primary",
|
|
@@ -93,7 +96,12 @@ const textColor = tv({
|
|
|
93
96
|
{
|
|
94
97
|
variant: "accent",
|
|
95
98
|
disabled: true,
|
|
96
|
-
className: "text-
|
|
99
|
+
className: "text-text-on-accent",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
variant: "cta",
|
|
103
|
+
disabled: true,
|
|
104
|
+
className: "text-text-on-accent",
|
|
97
105
|
},
|
|
98
106
|
{
|
|
99
107
|
variant: "transparent",
|
|
@@ -133,7 +141,8 @@ function getLoadingColorDynamic(variant) {
|
|
|
133
141
|
const map = {
|
|
134
142
|
primary: theme.text.inverse,
|
|
135
143
|
accent: theme.text.inverse,
|
|
136
|
-
|
|
144
|
+
cta: theme.text.inverse,
|
|
145
|
+
secondary: theme.text.primary,
|
|
137
146
|
outline: theme.primary,
|
|
138
147
|
outlineDanger: theme.danger,
|
|
139
148
|
outlineBlack: theme.text.primary,
|
|
@@ -147,8 +156,9 @@ function getIconColorDynamic(variant, disabled) {
|
|
|
147
156
|
if (disabled) {
|
|
148
157
|
const disabledMap = {
|
|
149
158
|
primary: theme.icon.inverse + "70",
|
|
150
|
-
accent: theme.
|
|
151
|
-
|
|
159
|
+
accent: theme.text.onAccent + "70",
|
|
160
|
+
cta: theme.text.onAccent + "70",
|
|
161
|
+
secondary: theme.text.disabled,
|
|
152
162
|
outline: theme.icon.disabled,
|
|
153
163
|
outlineDanger: theme.danger + "7f",
|
|
154
164
|
outlineBlack: theme.text.primary + "7f",
|
|
@@ -160,8 +170,9 @@ function getIconColorDynamic(variant, disabled) {
|
|
|
160
170
|
}
|
|
161
171
|
const enabledMap = {
|
|
162
172
|
primary: theme.icon.inverse,
|
|
163
|
-
accent: theme.
|
|
164
|
-
|
|
173
|
+
accent: theme.text.onAccent,
|
|
174
|
+
cta: theme.text.onAccent,
|
|
175
|
+
secondary: theme.text.primary,
|
|
165
176
|
outline: theme.primary,
|
|
166
177
|
outlineDanger: theme.danger,
|
|
167
178
|
outlineBlack: theme.text.primary,
|
|
@@ -225,10 +236,10 @@ const Button = ({ title, onPress, confirm, variant = "primary", size = "medium",
|
|
|
225
236
|
if (variant === "link") {
|
|
226
237
|
return (_jsx(TouchableOpacity, { activeOpacity: 0.7, className: className, disabled: disabled || loading, onPress: handlePress, children: loading ? (_jsx(ActivityIndicator, { color: loadingColorValue, size: "small" })) : (_jsx(Typography.Text, { className: textColorClass, variant: textVariantValue, children: title })) }));
|
|
227
238
|
}
|
|
228
|
-
if (variant === "primary" || variant === "accent") {
|
|
239
|
+
if (variant === "primary" || variant === "accent" || variant === "cta") {
|
|
229
240
|
const gradientColors = variant === "primary" ? theme.gradient.primary : theme.gradient.accent;
|
|
230
241
|
return (_jsx(LinearGradient, { colors: gradientColors, end: { x: 1, y: 1 }, start: { x: 0, y: 0 }, style: {
|
|
231
|
-
borderRadius:
|
|
242
|
+
borderRadius: 13,
|
|
232
243
|
opacity: disabled ? 0.7 : 1,
|
|
233
244
|
}, children: _jsx(TouchableOpacity, { activeOpacity: 0.8, disabled: disabled || loading, onPress: handlePress, children: _jsx(View, { className: button({ size, disabled }), style: { backgroundColor: "transparent" }, children: loading ? (_jsx(ActivityIndicator, { color: loadingColorValue, size: "small" })) : (_jsxs(_Fragment, { children: [icon ? _jsx(View, { className: "mr-2", children: icon }) : null, _jsx(Typography.Text, { allowFontScaling: false, bold: true, className: textColorClass, ellipsizeMode: "tail", numberOfLines: 1, variant: textVariantValue, children: title })] })) }) }) }));
|
|
234
245
|
}
|
|
@@ -258,8 +269,8 @@ const ButtonIcon = ({ icon, onPress, confirm, variant = "primary", size = "mediu
|
|
|
258
269
|
}
|
|
259
270
|
}, [onPress, confirm, show, hide]);
|
|
260
271
|
if (variant === "primary") {
|
|
261
|
-
return (_jsx(LinearGradient, { colors:
|
|
262
|
-
borderRadius:
|
|
272
|
+
return (_jsx(LinearGradient, { colors: theme.gradient.primary, end: { x: 1, y: 1 }, start: { x: 0, y: 0 }, style: {
|
|
273
|
+
borderRadius: 13,
|
|
263
274
|
opacity: disabled ? 0.7 : 1,
|
|
264
275
|
}, children: _jsx(TouchableOpacity, { activeOpacity: 0.8, disabled: disabled || loading, onPress: handlePress, children: _jsx(View, { className: buttonIcon({ size, disabled }), style: { backgroundColor: "transparent" }, children: loading ? (_jsx(ActivityIndicator, { color: loadingColorValue, size: "small" })) : (_jsx(Display.Icon, { color: iconColorValue, name: icon, size: iconSizeValue })) }) }) }));
|
|
265
276
|
}
|
|
@@ -9,5 +9,5 @@ interface RowCheckBoxProps {
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
12
|
-
declare function RowCheckBox({ mainText, subText, rightText, rightComponent, leftComponent, isChecked, onCheck, disabled, className, }: RowCheckBoxProps): import("react
|
|
12
|
+
declare function RowCheckBox({ mainText, subText, rightText, rightComponent, leftComponent, isChecked, onCheck, disabled, className, }: RowCheckBoxProps): import("react").JSX.Element;
|
|
13
13
|
export default RowCheckBox;
|
|
@@ -25,6 +25,6 @@ function RowCheckBox({ mainText, subText, rightText, rightComponent, leftCompone
|
|
|
25
25
|
}
|
|
26
26
|
return null;
|
|
27
27
|
};
|
|
28
|
-
return (_jsxs(Pressable, { className: cn("flex-row justify-between items-center", disabled && "opacity-50", className), disabled: disabled, onPress: handlePress, children: [_jsx(View, { children: renderLeftComponent() }), _jsxs(View, { className: "flex-row items-center", children: [renderRightComponent(), _jsx(Checkbox, { className: "ml-2", color: theme.
|
|
28
|
+
return (_jsxs(Pressable, { className: cn("flex-row justify-between items-center", disabled && "opacity-50", className), disabled: disabled, onPress: handlePress, children: [_jsx(View, { children: renderLeftComponent() }), _jsxs(View, { className: "flex-row items-center", children: [renderRightComponent(), _jsx(Checkbox, { className: "ml-2", color: theme.accent, disabled: disabled, pointerEvents: "none", value: isChecked })] })] }));
|
|
29
29
|
}
|
|
30
30
|
export default RowCheckBox;
|