@sincpro/mobile-ui 0.5.0 → 0.7.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.
- package/dist/Actions/Actions.Button.d.ts +151 -0
- package/dist/Actions/Actions.Button.js +217 -0
- package/dist/Actions/Actions.FAB.d.ts +10 -0
- package/dist/Actions/Actions.FAB.js +17 -0
- package/dist/Actions/Actions.FilterButton.d.ts +10 -0
- package/dist/Actions/Actions.FilterButton.js +28 -0
- package/dist/Actions/Actions.IconButton.d.ts +67 -0
- package/dist/Actions/Actions.IconButton.js +38 -0
- package/dist/Actions/index.d.ts +22 -0
- package/dist/Actions/index.js +17 -0
- package/dist/Dialog/BottomSheet/BottomSheet.Root.js +1 -0
- package/dist/Dialog/Confirmation.context.js +1 -6
- package/dist/Dialog/Dialog.Sheet.js +6 -4
- package/dist/Display/Display.CircleButton.d.ts +15 -0
- package/dist/Display/Display.CircleButton.js +39 -0
- package/dist/Display/Display.MenuButton.d.ts +51 -8
- package/dist/Display/Display.MenuButton.js +79 -13
- package/dist/Display/Display.MenuCard.d.ts +15 -0
- package/dist/Display/Display.MenuCard.js +24 -0
- package/dist/Display/Display.MenuGrid.d.ts +19 -0
- package/dist/Display/Display.MenuGrid.js +7 -0
- package/dist/Display/Display.SwipeableRow.js +2 -1
- package/dist/Display/Display.Tooltip.d.ts +1 -1
- package/dist/Display/Display.Tooltip.js +16 -5
- package/dist/Display/index.d.ts +9 -0
- package/dist/Display/index.js +6 -0
- package/dist/Feedback/Feedback.Empty.js +2 -2
- package/dist/Feedback/Feedback.Error.js +2 -2
- package/dist/Feedback/Feedback.Loading.d.ts +3 -7
- package/dist/Feedback/Feedback.Loading.js +2 -8
- package/dist/Feedback/Feedback.Progress.js +2 -2
- package/dist/Feedback/Feedback.Skeleton.js +2 -2
- package/dist/Feedback/Feedback.Spinner.d.ts +3 -0
- package/dist/Feedback/Feedback.Spinner.js +52 -2
- package/dist/Feedback/Feedback.Splash.js +1 -0
- package/dist/Feedback/index.d.ts +0 -2
- package/dist/Feedback/index.js +0 -2
- package/dist/Form/Form.Button.d.ts +3 -151
- package/dist/Form/Form.Button.js +1 -283
- package/dist/Form/Form.FAB.d.ts +3 -10
- package/dist/Form/Form.FAB.js +1 -17
- package/dist/Form/Form.FilterButton.d.ts +3 -12
- package/dist/Form/Form.FilterButton.js +1 -34
- package/dist/Form/Form.IconButton.d.ts +3 -67
- package/dist/Form/Form.IconButton.js +1 -64
- package/dist/Form/Form.PasswordInput.js +4 -2
- package/dist/Navigation/Navigation.AppBar.d.ts +56 -1
- package/dist/Navigation/Navigation.AppBar.js +43 -12
- package/dist/Navigation/Navigation.BottomNav.js +2 -1
- package/dist/Navigation/Navigation.Header.js +3 -2
- package/dist/Navigation/Navigation.Menu.js +6 -3
- package/dist/Navigation/Navigation.MenuSection.d.ts +19 -0
- package/dist/Navigation/Navigation.MenuSection.js +25 -0
- package/dist/Navigation/Navigation.SegmentedControl.d.ts +15 -1
- package/dist/Navigation/Navigation.SegmentedControl.js +22 -4
- package/dist/Navigation/Navigation.TabIcon.js +1 -2
- package/dist/Navigation/Navigation.TabItem.js +2 -2
- package/dist/Navigation/Navigation.Tabs.d.ts +8 -3
- package/dist/Navigation/Navigation.Tabs.js +19 -6
- package/dist/Navigation/index.d.ts +7 -6
- package/dist/Navigation/index.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/layouts/AuthContainer.d.ts +4 -1
- package/dist/layouts/AuthContainer.js +7 -5
- package/dist/layouts/BottomInset.d.ts +16 -0
- package/dist/layouts/BottomInset.js +17 -0
- package/dist/layouts/TabNavigatorLayout.js +2 -2
- package/dist/primitives/BaseButton.js +3 -3
- package/dist/theme/default.js +1 -1
- package/dist/views/AppSplashView.d.ts +18 -0
- package/dist/views/AppSplashView.js +9 -0
- package/dist/views/AuthFormView.d.ts +3 -1
- package/dist/views/AuthFormView.js +2 -2
- package/dist/views/FormViewV2.d.ts +18 -6
- package/dist/views/FormViewV2.js +14 -11
- package/dist/views/ListViewV2.d.ts +12 -1
- package/dist/views/ListViewV2.js +16 -10
- package/dist/widgets/CircleButton.d.ts +3 -19
- package/dist/widgets/CircleButton.js +1 -41
- package/dist/widgets/JSONViewer.js +7 -7
- package/dist/widgets/MenuCard.d.ts +3 -13
- package/dist/widgets/MenuCard.js +1 -8
- package/dist/widgets/MenuGrid.d.ts +5 -17
- package/dist/widgets/MenuGrid.js +1 -6
- package/dist/widgets/MenuSection.d.ts +3 -0
- package/dist/widgets/MenuSection.js +1 -0
- package/dist/widgets/PromoBanner.d.ts +38 -0
- package/dist/widgets/PromoBanner.js +61 -0
- package/dist/widgets/PromoModal.d.ts +41 -0
- package/dist/widgets/PromoModal.js +75 -0
- package/dist/widgets/QuickActions.d.ts +26 -0
- package/dist/widgets/QuickActions.js +41 -0
- package/dist/widgets/index.d.ts +11 -1
- package/dist/widgets/index.js +4 -0
- package/package.json +2 -1
package/dist/Feedback/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Banner from "../Feedback/Feedback.Banner";
|
|
2
|
-
import DomainSplashScreen from "../Feedback/Feedback.DomainSplashScreen";
|
|
3
2
|
import Empty from "../Feedback/Feedback.Empty";
|
|
4
3
|
import EmptyState from "../Feedback/Feedback.EmptyState";
|
|
5
4
|
import Error from "../Feedback/Feedback.Error";
|
|
@@ -23,6 +22,5 @@ export declare const Feedback: {
|
|
|
23
22
|
EmptyState: typeof EmptyState;
|
|
24
23
|
Error: typeof Error;
|
|
25
24
|
SplashScreen: typeof SplashScreen;
|
|
26
|
-
DomainSplashScreen: typeof DomainSplashScreen;
|
|
27
25
|
};
|
|
28
26
|
export default Feedback;
|
package/dist/Feedback/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Banner from "../Feedback/Feedback.Banner";
|
|
2
|
-
import DomainSplashScreen from "../Feedback/Feedback.DomainSplashScreen";
|
|
3
2
|
import Empty from "../Feedback/Feedback.Empty";
|
|
4
3
|
import EmptyState from "../Feedback/Feedback.EmptyState";
|
|
5
4
|
import Error from "../Feedback/Feedback.Error";
|
|
@@ -24,6 +23,5 @@ export const Feedback = {
|
|
|
24
23
|
EmptyState,
|
|
25
24
|
Error,
|
|
26
25
|
SplashScreen,
|
|
27
|
-
DomainSplashScreen,
|
|
28
26
|
};
|
|
29
27
|
export default Feedback;
|
|
@@ -1,151 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
variant: {
|
|
5
|
-
primary: string;
|
|
6
|
-
accent: string;
|
|
7
|
-
cta: string;
|
|
8
|
-
secondary: string;
|
|
9
|
-
outline: string;
|
|
10
|
-
outlineDanger: string;
|
|
11
|
-
outlineBlack: string;
|
|
12
|
-
flat: string;
|
|
13
|
-
link: string;
|
|
14
|
-
transparent: string;
|
|
15
|
-
};
|
|
16
|
-
size: {
|
|
17
|
-
small: string;
|
|
18
|
-
medium: string;
|
|
19
|
-
large: string;
|
|
20
|
-
};
|
|
21
|
-
disabled: {
|
|
22
|
-
true: string;
|
|
23
|
-
};
|
|
24
|
-
}, undefined, "rounded-[13px] items-center justify-center flex-row min-h-[44px]", {
|
|
25
|
-
variant: {
|
|
26
|
-
primary: string;
|
|
27
|
-
accent: string;
|
|
28
|
-
cta: string;
|
|
29
|
-
secondary: string;
|
|
30
|
-
outline: string;
|
|
31
|
-
outlineDanger: string;
|
|
32
|
-
outlineBlack: string;
|
|
33
|
-
flat: string;
|
|
34
|
-
link: string;
|
|
35
|
-
transparent: string;
|
|
36
|
-
};
|
|
37
|
-
size: {
|
|
38
|
-
small: string;
|
|
39
|
-
medium: string;
|
|
40
|
-
large: string;
|
|
41
|
-
};
|
|
42
|
-
disabled: {
|
|
43
|
-
true: string;
|
|
44
|
-
};
|
|
45
|
-
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
46
|
-
variant: {
|
|
47
|
-
primary: string;
|
|
48
|
-
accent: string;
|
|
49
|
-
cta: string;
|
|
50
|
-
secondary: string;
|
|
51
|
-
outline: string;
|
|
52
|
-
outlineDanger: string;
|
|
53
|
-
outlineBlack: string;
|
|
54
|
-
flat: string;
|
|
55
|
-
link: string;
|
|
56
|
-
transparent: string;
|
|
57
|
-
};
|
|
58
|
-
size: {
|
|
59
|
-
small: string;
|
|
60
|
-
medium: string;
|
|
61
|
-
large: string;
|
|
62
|
-
};
|
|
63
|
-
disabled: {
|
|
64
|
-
true: string;
|
|
65
|
-
};
|
|
66
|
-
}, undefined, "rounded-[13px] items-center justify-center flex-row min-h-[44px]", unknown, unknown, undefined>>;
|
|
67
|
-
declare const buttonIcon: import("tailwind-variants").TVReturnType<{
|
|
68
|
-
variant: {
|
|
69
|
-
primary: string;
|
|
70
|
-
accent: string;
|
|
71
|
-
cta: string;
|
|
72
|
-
secondary: string;
|
|
73
|
-
outline: string;
|
|
74
|
-
outlineDanger: string;
|
|
75
|
-
outlineBlack: string;
|
|
76
|
-
flat: string;
|
|
77
|
-
link: string;
|
|
78
|
-
transparent: string;
|
|
79
|
-
};
|
|
80
|
-
size: {
|
|
81
|
-
small: string;
|
|
82
|
-
medium: string;
|
|
83
|
-
large: string;
|
|
84
|
-
};
|
|
85
|
-
disabled: {
|
|
86
|
-
true: string;
|
|
87
|
-
};
|
|
88
|
-
}, undefined, "rounded-[13px] items-center justify-center aspect-square", {
|
|
89
|
-
variant: {
|
|
90
|
-
primary: string;
|
|
91
|
-
accent: string;
|
|
92
|
-
cta: string;
|
|
93
|
-
secondary: string;
|
|
94
|
-
outline: string;
|
|
95
|
-
outlineDanger: string;
|
|
96
|
-
outlineBlack: string;
|
|
97
|
-
flat: string;
|
|
98
|
-
link: string;
|
|
99
|
-
transparent: string;
|
|
100
|
-
};
|
|
101
|
-
size: {
|
|
102
|
-
small: string;
|
|
103
|
-
medium: string;
|
|
104
|
-
large: string;
|
|
105
|
-
};
|
|
106
|
-
disabled: {
|
|
107
|
-
true: string;
|
|
108
|
-
};
|
|
109
|
-
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
110
|
-
variant: {
|
|
111
|
-
primary: string;
|
|
112
|
-
accent: string;
|
|
113
|
-
cta: string;
|
|
114
|
-
secondary: string;
|
|
115
|
-
outline: string;
|
|
116
|
-
outlineDanger: string;
|
|
117
|
-
outlineBlack: string;
|
|
118
|
-
flat: string;
|
|
119
|
-
link: string;
|
|
120
|
-
transparent: string;
|
|
121
|
-
};
|
|
122
|
-
size: {
|
|
123
|
-
small: string;
|
|
124
|
-
medium: string;
|
|
125
|
-
large: string;
|
|
126
|
-
};
|
|
127
|
-
disabled: {
|
|
128
|
-
true: string;
|
|
129
|
-
};
|
|
130
|
-
}, undefined, "rounded-[13px] items-center justify-center aspect-square", unknown, unknown, undefined>>;
|
|
131
|
-
export interface ButtonProps extends VariantProps<typeof button> {
|
|
132
|
-
title: string;
|
|
133
|
-
onPress?: () => void;
|
|
134
|
-
confirm?: string;
|
|
135
|
-
loading?: boolean;
|
|
136
|
-
disabled?: boolean;
|
|
137
|
-
className?: string;
|
|
138
|
-
icon?: React.ReactNode;
|
|
139
|
-
}
|
|
140
|
-
export interface ButtonIconProps extends VariantProps<typeof buttonIcon> {
|
|
141
|
-
icon: string;
|
|
142
|
-
onPress?: () => void;
|
|
143
|
-
confirm?: string;
|
|
144
|
-
loading?: boolean;
|
|
145
|
-
disabled?: boolean;
|
|
146
|
-
className?: string;
|
|
147
|
-
}
|
|
148
|
-
declare const ButtonWithIcon: React.FC<ButtonProps> & {
|
|
149
|
-
Icon: React.FC<ButtonIconProps>;
|
|
150
|
-
};
|
|
151
|
-
export default ButtonWithIcon;
|
|
1
|
+
/** @deprecated Use `Actions.Button` from `@sincpro/mobile-ui/Actions` instead. */
|
|
2
|
+
export type { ButtonIconProps, ButtonProps } from "../Actions/Actions.Button";
|
|
3
|
+
export { default as ButtonWithIcon, default, } from "../Actions/Actions.Button";
|
package/dist/Form/Form.Button.js
CHANGED
|
@@ -1,283 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { useConfirmationContext } from "../Dialog/Confirmation.context";
|
|
3
|
-
import { Display } from "../Display";
|
|
4
|
-
import { theme } from "../theme";
|
|
5
|
-
import { tv } from "../theme/tw";
|
|
6
|
-
import { Typography } from "../Typography";
|
|
7
|
-
import { LinearGradient } from "expo-linear-gradient";
|
|
8
|
-
import { useCallback } from "react";
|
|
9
|
-
import { ActivityIndicator, TouchableOpacity, View } from "react-native";
|
|
10
|
-
import { runOnJS } from "react-native-reanimated";
|
|
11
|
-
// ============================================================================
|
|
12
|
-
// STYLE VARIANTS
|
|
13
|
-
// ============================================================================
|
|
14
|
-
const button = tv({
|
|
15
|
-
base: "rounded-[13px] items-center justify-center flex-row min-h-[44px]",
|
|
16
|
-
variants: {
|
|
17
|
-
variant: {
|
|
18
|
-
primary: "shadow-sm",
|
|
19
|
-
accent: "shadow-sm",
|
|
20
|
-
cta: "shadow-sm",
|
|
21
|
-
secondary: "bg-bg-muted",
|
|
22
|
-
outline: "bg-transparent border border-primary",
|
|
23
|
-
outlineDanger: "bg-transparent border border-danger",
|
|
24
|
-
outlineBlack: "bg-transparent border border-border-strong",
|
|
25
|
-
flat: "bg-text-primary/10",
|
|
26
|
-
link: "bg-transparent min-h-0",
|
|
27
|
-
transparent: "bg-transparent border border-border-light",
|
|
28
|
-
},
|
|
29
|
-
size: {
|
|
30
|
-
small: "py-1.5 px-3 min-h-[36px]",
|
|
31
|
-
medium: "py-2.5 px-4 min-h-[44px]",
|
|
32
|
-
large: "py-3 px-5 min-h-[48px]",
|
|
33
|
-
},
|
|
34
|
-
disabled: {
|
|
35
|
-
true: "opacity-70",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
defaultVariants: {
|
|
39
|
-
variant: "primary",
|
|
40
|
-
size: "medium",
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
const buttonIcon = tv({
|
|
44
|
-
base: "rounded-[13px] items-center justify-center aspect-square",
|
|
45
|
-
variants: {
|
|
46
|
-
variant: {
|
|
47
|
-
primary: "shadow-sm",
|
|
48
|
-
accent: "shadow-sm",
|
|
49
|
-
cta: "shadow-sm",
|
|
50
|
-
secondary: "bg-bg-muted",
|
|
51
|
-
outline: "bg-transparent border border-primary",
|
|
52
|
-
outlineDanger: "bg-transparent border border-danger",
|
|
53
|
-
outlineBlack: "bg-transparent border border-border-strong",
|
|
54
|
-
flat: "bg-text-primary/10",
|
|
55
|
-
link: "bg-transparent",
|
|
56
|
-
transparent: "bg-transparent border border-border-light",
|
|
57
|
-
},
|
|
58
|
-
size: {
|
|
59
|
-
small: "w-9 h-9",
|
|
60
|
-
medium: "w-11 h-11",
|
|
61
|
-
large: "w-[52px] h-[52px]",
|
|
62
|
-
},
|
|
63
|
-
disabled: {
|
|
64
|
-
true: "opacity-70",
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
defaultVariants: {
|
|
68
|
-
variant: "primary",
|
|
69
|
-
size: "medium",
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
const textColor = tv({
|
|
73
|
-
variants: {
|
|
74
|
-
variant: {
|
|
75
|
-
primary: "text-white",
|
|
76
|
-
accent: "text-text-on-accent",
|
|
77
|
-
cta: "text-text-on-accent",
|
|
78
|
-
secondary: "text-text-primary",
|
|
79
|
-
outline: "text-primary",
|
|
80
|
-
outlineDanger: "text-danger",
|
|
81
|
-
outlineBlack: "text-text-primary",
|
|
82
|
-
flat: "text-text-primary",
|
|
83
|
-
link: "text-primary",
|
|
84
|
-
transparent: "text-white",
|
|
85
|
-
},
|
|
86
|
-
disabled: {
|
|
87
|
-
true: "opacity-50",
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
compoundVariants: [
|
|
91
|
-
{
|
|
92
|
-
variant: "primary",
|
|
93
|
-
disabled: true,
|
|
94
|
-
className: "text-white/70",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
variant: "accent",
|
|
98
|
-
disabled: true,
|
|
99
|
-
className: "text-text-on-accent",
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
variant: "cta",
|
|
103
|
-
disabled: true,
|
|
104
|
-
className: "text-text-on-accent",
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
variant: "transparent",
|
|
108
|
-
disabled: true,
|
|
109
|
-
className: "text-white/70",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
variant: ["secondary", "outline", "link"],
|
|
113
|
-
disabled: true,
|
|
114
|
-
className: "text-text-secondary",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
variant: "outlineDanger",
|
|
118
|
-
disabled: true,
|
|
119
|
-
className: "text-danger/50",
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
variant: "outlineBlack",
|
|
123
|
-
disabled: true,
|
|
124
|
-
className: "text-text-primary/50",
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
variant: "flat",
|
|
128
|
-
disabled: true,
|
|
129
|
-
className: "text-text-primary/50",
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
defaultVariants: {
|
|
133
|
-
variant: "primary",
|
|
134
|
-
disabled: false,
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
// ============================================================================
|
|
138
|
-
// COLOR & SIZE MAPS (Dynamic with theme)
|
|
139
|
-
// ============================================================================
|
|
140
|
-
function getLoadingColorDynamic(variant) {
|
|
141
|
-
const map = {
|
|
142
|
-
primary: theme.text.inverse,
|
|
143
|
-
accent: theme.text.inverse,
|
|
144
|
-
cta: theme.text.inverse,
|
|
145
|
-
secondary: theme.text.primary,
|
|
146
|
-
outline: theme.primary,
|
|
147
|
-
outlineDanger: theme.danger,
|
|
148
|
-
outlineBlack: theme.text.primary,
|
|
149
|
-
flat: theme.text.primary,
|
|
150
|
-
link: theme.primary,
|
|
151
|
-
transparent: theme.text.inverse,
|
|
152
|
-
};
|
|
153
|
-
return map[variant] ?? theme.text.inverse;
|
|
154
|
-
}
|
|
155
|
-
function getIconColorDynamic(variant, disabled) {
|
|
156
|
-
if (disabled) {
|
|
157
|
-
const disabledMap = {
|
|
158
|
-
primary: theme.icon.inverse + "70",
|
|
159
|
-
accent: theme.text.onAccent + "70",
|
|
160
|
-
cta: theme.text.onAccent + "70",
|
|
161
|
-
secondary: theme.text.disabled,
|
|
162
|
-
outline: theme.icon.disabled,
|
|
163
|
-
outlineDanger: theme.danger + "7f",
|
|
164
|
-
outlineBlack: theme.text.primary + "7f",
|
|
165
|
-
flat: theme.text.primary + "7f",
|
|
166
|
-
link: theme.icon.disabled,
|
|
167
|
-
transparent: theme.icon.inverse + "70",
|
|
168
|
-
};
|
|
169
|
-
return disabledMap[variant] ?? theme.icon.disabled;
|
|
170
|
-
}
|
|
171
|
-
const enabledMap = {
|
|
172
|
-
primary: theme.icon.inverse,
|
|
173
|
-
accent: theme.text.onAccent,
|
|
174
|
-
cta: theme.text.onAccent,
|
|
175
|
-
secondary: theme.text.primary,
|
|
176
|
-
outline: theme.primary,
|
|
177
|
-
outlineDanger: theme.danger,
|
|
178
|
-
outlineBlack: theme.text.primary,
|
|
179
|
-
flat: theme.text.primary,
|
|
180
|
-
link: theme.primary,
|
|
181
|
-
transparent: theme.icon.inverse,
|
|
182
|
-
};
|
|
183
|
-
return enabledMap[variant] ?? theme.icon.inverse;
|
|
184
|
-
}
|
|
185
|
-
const iconSizeMap = {
|
|
186
|
-
small: 16,
|
|
187
|
-
medium: 20,
|
|
188
|
-
large: 28,
|
|
189
|
-
};
|
|
190
|
-
const textVariantMap = {
|
|
191
|
-
small: "buttonSmall",
|
|
192
|
-
medium: "button",
|
|
193
|
-
large: "buttonLarge",
|
|
194
|
-
};
|
|
195
|
-
// ============================================================================
|
|
196
|
-
// HELPER FUNCTIONS
|
|
197
|
-
// ============================================================================
|
|
198
|
-
function getLoadingColor(variant) {
|
|
199
|
-
return getLoadingColorDynamic(variant);
|
|
200
|
-
}
|
|
201
|
-
function getIconColor(variant, disabled) {
|
|
202
|
-
return getIconColorDynamic(variant, disabled);
|
|
203
|
-
}
|
|
204
|
-
function getIconSize(size) {
|
|
205
|
-
return iconSizeMap[size] ?? 20;
|
|
206
|
-
}
|
|
207
|
-
function getTextVariant(size) {
|
|
208
|
-
return textVariantMap[size] ?? "button";
|
|
209
|
-
}
|
|
210
|
-
const Button = ({ title, onPress, confirm, variant = "primary", size = "medium", loading = false, disabled = false, className, icon, }) => {
|
|
211
|
-
const { show, hide } = useConfirmationContext();
|
|
212
|
-
const textColorClass = textColor({
|
|
213
|
-
variant: variant ?? "primary",
|
|
214
|
-
disabled,
|
|
215
|
-
});
|
|
216
|
-
const loadingColorValue = getLoadingColor(variant ?? "primary");
|
|
217
|
-
const textVariantValue = getTextVariant(size ?? "medium");
|
|
218
|
-
const handlePress = useCallback(() => {
|
|
219
|
-
if (confirm && onPress) {
|
|
220
|
-
show({
|
|
221
|
-
title: "Confirmar acción",
|
|
222
|
-
message: confirm,
|
|
223
|
-
confirmText: "Confirmar",
|
|
224
|
-
cancelText: "Cancelar",
|
|
225
|
-
onConfirm: () => {
|
|
226
|
-
hide();
|
|
227
|
-
runOnJS(onPress)();
|
|
228
|
-
},
|
|
229
|
-
onCancel: () => hide(),
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
else if (onPress) {
|
|
233
|
-
runOnJS(onPress)();
|
|
234
|
-
}
|
|
235
|
-
}, [onPress, confirm, show, hide]);
|
|
236
|
-
if (variant === "link") {
|
|
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 })) }));
|
|
238
|
-
}
|
|
239
|
-
if (variant === "primary" || variant === "accent" || variant === "cta") {
|
|
240
|
-
const gradientColors = variant === "primary" ? theme.gradient.primary : theme.gradient.accent;
|
|
241
|
-
return (_jsx(LinearGradient, { colors: gradientColors, end: { x: 1, y: 1 }, start: { x: 0, y: 0 }, style: {
|
|
242
|
-
borderRadius: 13,
|
|
243
|
-
opacity: disabled ? 0.7 : 1,
|
|
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 })] })) }) }) }));
|
|
245
|
-
}
|
|
246
|
-
return (_jsx(TouchableOpacity, { activeOpacity: 0.8, className: button({ variant, size, disabled, className }), disabled: disabled || loading, onPress: handlePress, 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 })] })) }));
|
|
247
|
-
};
|
|
248
|
-
const ButtonIcon = ({ icon, onPress, confirm, variant = "primary", size = "medium", loading = false, disabled = false, className, }) => {
|
|
249
|
-
const { show, hide } = useConfirmationContext();
|
|
250
|
-
const iconColorValue = getIconColor(variant ?? "primary", disabled);
|
|
251
|
-
const iconSizeValue = getIconSize(size ?? "medium");
|
|
252
|
-
const loadingColorValue = getLoadingColor(variant ?? "primary");
|
|
253
|
-
const handlePress = useCallback(() => {
|
|
254
|
-
if (confirm && onPress) {
|
|
255
|
-
show({
|
|
256
|
-
title: "Confirmar acción",
|
|
257
|
-
message: confirm,
|
|
258
|
-
confirmText: "Confirmar",
|
|
259
|
-
cancelText: "Cancelar",
|
|
260
|
-
onConfirm: () => {
|
|
261
|
-
hide();
|
|
262
|
-
runOnJS(onPress)();
|
|
263
|
-
},
|
|
264
|
-
onCancel: () => hide(),
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
else if (onPress) {
|
|
268
|
-
runOnJS(onPress)();
|
|
269
|
-
}
|
|
270
|
-
}, [onPress, confirm, show, hide]);
|
|
271
|
-
if (variant === "primary") {
|
|
272
|
-
return (_jsx(LinearGradient, { colors: theme.gradient.primary, end: { x: 1, y: 1 }, start: { x: 0, y: 0 }, style: {
|
|
273
|
-
borderRadius: 13,
|
|
274
|
-
opacity: disabled ? 0.7 : 1,
|
|
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 })) }) }) }));
|
|
276
|
-
}
|
|
277
|
-
return (_jsx(TouchableOpacity, { activeOpacity: 0.8, className: buttonIcon({ variant, size, disabled, className }), disabled: disabled || loading, onPress: handlePress, children: loading ? (_jsx(ActivityIndicator, { color: loadingColorValue, size: "small" })) : (_jsx(Display.Icon, { color: iconColorValue, name: icon, size: iconSizeValue })) }));
|
|
278
|
-
};
|
|
279
|
-
// ============================================================================
|
|
280
|
-
// COMPOUND COMPONENT
|
|
281
|
-
// ============================================================================
|
|
282
|
-
const ButtonWithIcon = Object.assign(Button, { Icon: ButtonIcon });
|
|
283
|
-
export default ButtonWithIcon;
|
|
1
|
+
export { default as ButtonWithIcon, default, } from "../Actions/Actions.Button";
|
package/dist/Form/Form.FAB.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
label?: string;
|
|
5
|
-
position?: "bottom-right" | "bottom-left";
|
|
6
|
-
className?: string;
|
|
7
|
-
testID?: string;
|
|
8
|
-
}
|
|
9
|
-
declare function FAB({ icon, onPress, label, position, className, testID, }: FABProps): import("react").JSX.Element;
|
|
10
|
-
export default FAB;
|
|
1
|
+
/** @deprecated Use `Actions.FAB` from `@sincpro/mobile-ui/Actions` instead. */
|
|
2
|
+
export type { FABProps } from "../Actions/Actions.FAB";
|
|
3
|
+
export { default } from "../Actions/Actions.FAB";
|
package/dist/Form/Form.FAB.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Icon from "../Display/Display.Icon";
|
|
3
|
-
import Pressable from "../primitives/Pressable";
|
|
4
|
-
import { theme } from "../theme";
|
|
5
|
-
import { cn } from "../theme/tw";
|
|
6
|
-
import { Typography } from "../Typography";
|
|
7
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
8
|
-
function FAB({ icon, onPress, label, position = "bottom-right", className, testID, }) {
|
|
9
|
-
const insets = useSafeAreaInsets();
|
|
10
|
-
return (_jsxs(Pressable, { accessibilityLabel: label ?? "Acción", accessibilityRole: "button", className: cn("absolute flex-row items-center justify-center rounded-full bg-primary", label ? "h-14 px-5 gap-2" : "w-14 h-14", className), onPress: onPress, style: {
|
|
11
|
-
bottom: insets.bottom + 16,
|
|
12
|
-
right: position === "bottom-right" ? 16 : undefined,
|
|
13
|
-
left: position === "bottom-left" ? 16 : undefined,
|
|
14
|
-
...theme.shadow.lg,
|
|
15
|
-
}, testID: testID, children: [_jsx(Icon, { color: theme.icon.inverse, name: icon, size: 24 }), label ? (_jsx(Typography.Text, { className: "text-text-on-primary font-semibold", children: label })) : null] }));
|
|
16
|
-
}
|
|
17
|
-
export default FAB;
|
|
1
|
+
export { default } from "../Actions/Actions.FAB";
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
active: boolean;
|
|
5
|
-
onPress: () => void;
|
|
6
|
-
}
|
|
7
|
-
export declare const FilterButton: FC<FilterButtonProps>;
|
|
8
|
-
interface FilterButtonGroupProps {
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
}
|
|
11
|
-
export declare function FilterButtonGroup({ children }: FilterButtonGroupProps): import("react").JSX.Element;
|
|
12
|
-
export {};
|
|
1
|
+
/** @deprecated Use `Actions.FilterButton` from `@sincpro/mobile-ui/Actions` instead. */
|
|
2
|
+
export type { FilterButtonProps } from "../Actions/Actions.FilterButton";
|
|
3
|
+
export { FilterButton, FilterButtonGroup, } from "../Actions/Actions.FilterButton";
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { tv } from "../theme/tw";
|
|
3
|
-
import { Typography } from "../Typography";
|
|
4
|
-
import { TouchableOpacity, View } from "react-native";
|
|
5
|
-
const filterButton = tv({
|
|
6
|
-
base: "rounded-lg items-center justify-center py-2 px-3 min-h-[36px]",
|
|
7
|
-
variants: {
|
|
8
|
-
active: {
|
|
9
|
-
true: "bg-primary border-0",
|
|
10
|
-
false: "bg-transparent border border-brand-primary",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
defaultVariants: {
|
|
14
|
-
active: false,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
const filterText = tv({
|
|
18
|
-
base: "font-bold",
|
|
19
|
-
variants: {
|
|
20
|
-
active: {
|
|
21
|
-
true: "text-white",
|
|
22
|
-
false: "text-primary",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
defaultVariants: {
|
|
26
|
-
active: false,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
export const FilterButton = ({ title, active, onPress }) => {
|
|
30
|
-
return (_jsx(TouchableOpacity, { activeOpacity: 0.8, className: filterButton({ active }), onPress: onPress, children: _jsx(Typography.Text, { className: filterText({ active }), variant: "buttonSmall", children: title }) }));
|
|
31
|
-
};
|
|
32
|
-
export function FilterButtonGroup({ children }) {
|
|
33
|
-
return _jsx(View, { className: "flex-row gap-2 p-3", children: children });
|
|
34
|
-
}
|
|
1
|
+
export { FilterButton, FilterButtonGroup, } from "../Actions/Actions.FilterButton";
|
|
@@ -1,67 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
variant: {
|
|
5
|
-
primary: string;
|
|
6
|
-
secondary: string;
|
|
7
|
-
tertiary: string;
|
|
8
|
-
ghost: string;
|
|
9
|
-
};
|
|
10
|
-
size: {
|
|
11
|
-
small: string;
|
|
12
|
-
medium: string;
|
|
13
|
-
large: string;
|
|
14
|
-
};
|
|
15
|
-
rounded: {
|
|
16
|
-
true: string;
|
|
17
|
-
};
|
|
18
|
-
disabled: {
|
|
19
|
-
true: string;
|
|
20
|
-
};
|
|
21
|
-
}, undefined, "rounded-lg items-center justify-center", {
|
|
22
|
-
variant: {
|
|
23
|
-
primary: string;
|
|
24
|
-
secondary: string;
|
|
25
|
-
tertiary: string;
|
|
26
|
-
ghost: string;
|
|
27
|
-
};
|
|
28
|
-
size: {
|
|
29
|
-
small: string;
|
|
30
|
-
medium: string;
|
|
31
|
-
large: string;
|
|
32
|
-
};
|
|
33
|
-
rounded: {
|
|
34
|
-
true: string;
|
|
35
|
-
};
|
|
36
|
-
disabled: {
|
|
37
|
-
true: string;
|
|
38
|
-
};
|
|
39
|
-
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
40
|
-
variant: {
|
|
41
|
-
primary: string;
|
|
42
|
-
secondary: string;
|
|
43
|
-
tertiary: string;
|
|
44
|
-
ghost: string;
|
|
45
|
-
};
|
|
46
|
-
size: {
|
|
47
|
-
small: string;
|
|
48
|
-
medium: string;
|
|
49
|
-
large: string;
|
|
50
|
-
};
|
|
51
|
-
rounded: {
|
|
52
|
-
true: string;
|
|
53
|
-
};
|
|
54
|
-
disabled: {
|
|
55
|
-
true: string;
|
|
56
|
-
};
|
|
57
|
-
}, undefined, "rounded-lg items-center justify-center", unknown, unknown, undefined>>;
|
|
58
|
-
interface IconButtonProps extends VariantProps<typeof iconButton> {
|
|
59
|
-
icon?: string;
|
|
60
|
-
type?: IconType;
|
|
61
|
-
onPress: () => void;
|
|
62
|
-
loading?: boolean;
|
|
63
|
-
iconColor?: string;
|
|
64
|
-
className?: string;
|
|
65
|
-
}
|
|
66
|
-
declare function IconButton({ icon, type, onPress, variant, size, loading, disabled, rounded, iconColor, className, }: IconButtonProps): import("react").JSX.Element;
|
|
67
|
-
export default IconButton;
|
|
1
|
+
/** @deprecated Use `Actions.IconButton` from `@sincpro/mobile-ui/Actions` instead. */
|
|
2
|
+
export type { IconButtonProps } from "../Actions/Actions.IconButton";
|
|
3
|
+
export { default } from "../Actions/Actions.IconButton";
|