@rehagro/ui 1.0.2 → 1.0.4
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/colors.types-7nLOoy6r.d.mts +4 -0
- package/dist/colors.types-7nLOoy6r.d.ts +4 -0
- package/dist/index.d.mts +15 -11
- package/dist/index.d.ts +15 -11
- package/dist/index.js +102 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +102 -23
- package/dist/index.mjs.map +1 -1
- package/dist/native.d.mts +50 -4
- package/dist/native.d.ts +50 -4
- package/dist/native.js +169 -12
- package/dist/native.js.map +1 -1
- package/dist/native.mjs +169 -13
- package/dist/native.mjs.map +1 -1
- package/dist/styles.css +2 -2
- package/package.json +1 -1
package/dist/native.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1 from 'react';
|
|
3
3
|
import { PressableProps, StyleProp, ViewStyle, View, TextInputProps as TextInputProps$1, TextInput as TextInput$1, ViewProps, TextProps as TextProps$1, TextStyle, Text as Text$1 } from 'react-native';
|
|
4
|
+
import { B as ButtonColor, P as PresetColor } from './colors.types-7nLOoy6r.mjs';
|
|
4
5
|
|
|
5
6
|
/** React Native theme — reuses the same token names as the web theme.
|
|
6
7
|
* Color values are plain CSS hex strings (e.g. "#16a34a").
|
|
@@ -15,6 +16,8 @@ type RehagroNativeTheme = {
|
|
|
15
16
|
dangerHover?: string;
|
|
16
17
|
warning?: string;
|
|
17
18
|
success?: string;
|
|
19
|
+
info?: string;
|
|
20
|
+
infoHover?: string;
|
|
18
21
|
text?: string;
|
|
19
22
|
textMuted?: string;
|
|
20
23
|
surface?: string;
|
|
@@ -53,6 +56,8 @@ type ButtonProps = Omit<PressableProps, "style"> & {
|
|
|
53
56
|
size?: ButtonSize;
|
|
54
57
|
/** Border radius */
|
|
55
58
|
radius?: ButtonRadius;
|
|
59
|
+
/** Color scheme — preset name or any CSS color (e.g., "#c3c3c3", "red", "rgb(...)") */
|
|
60
|
+
color?: ButtonColor;
|
|
56
61
|
/** Shows loading state and disables interaction */
|
|
57
62
|
loading?: boolean;
|
|
58
63
|
/** Icon rendered to the left of children (hidden when loading) */
|
|
@@ -71,6 +76,8 @@ declare const Button: React$1.ForwardRefExoticComponent<Omit<PressableProps, "st
|
|
|
71
76
|
size?: ButtonSize;
|
|
72
77
|
/** Border radius */
|
|
73
78
|
radius?: ButtonRadius;
|
|
79
|
+
/** Color scheme — preset name or any CSS color (e.g., "#c3c3c3", "red", "rgb(...)") */
|
|
80
|
+
color?: ButtonColor;
|
|
74
81
|
/** Shows loading state and disables interaction */
|
|
75
82
|
loading?: boolean;
|
|
76
83
|
/** Icon rendered to the left of children (hidden when loading) */
|
|
@@ -86,7 +93,7 @@ declare const Button: React$1.ForwardRefExoticComponent<Omit<PressableProps, "st
|
|
|
86
93
|
type IconButtonVariant = "solid" | "outline" | "ghost";
|
|
87
94
|
type IconButtonSize = "sm" | "md" | "lg";
|
|
88
95
|
type IconButtonRadius = "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
|
|
89
|
-
type IconButtonColor =
|
|
96
|
+
type IconButtonColor = ButtonColor;
|
|
90
97
|
type IconButtonProps = Omit<PressableProps, "style"> & {
|
|
91
98
|
/** Visual style variant */
|
|
92
99
|
variant?: IconButtonVariant;
|
|
@@ -94,7 +101,7 @@ type IconButtonProps = Omit<PressableProps, "style"> & {
|
|
|
94
101
|
size?: IconButtonSize;
|
|
95
102
|
/** Border radius */
|
|
96
103
|
radius?: IconButtonRadius;
|
|
97
|
-
/** Color scheme */
|
|
104
|
+
/** Color scheme — preset name or any CSS color (e.g., "#c3c3c3", "red", "rgb(...)") */
|
|
98
105
|
color?: IconButtonColor;
|
|
99
106
|
/** Shows loading state and disables interaction */
|
|
100
107
|
loading?: boolean;
|
|
@@ -110,7 +117,7 @@ declare const IconButton: React$1.ForwardRefExoticComponent<Omit<PressableProps,
|
|
|
110
117
|
size?: IconButtonSize;
|
|
111
118
|
/** Border radius */
|
|
112
119
|
radius?: IconButtonRadius;
|
|
113
|
-
/** Color scheme */
|
|
120
|
+
/** Color scheme — preset name or any CSS color (e.g., "#c3c3c3", "red", "rgb(...)") */
|
|
114
121
|
color?: IconButtonColor;
|
|
115
122
|
/** Shows loading state and disables interaction */
|
|
116
123
|
loading?: boolean;
|
|
@@ -283,4 +290,43 @@ declare const Text: React$1.ForwardRefExoticComponent<Omit<TextProps$1, "style">
|
|
|
283
290
|
style?: StyleProp<TextStyle>;
|
|
284
291
|
} & React$1.RefAttributes<Text$1>>;
|
|
285
292
|
|
|
286
|
-
|
|
293
|
+
type TagColor = PresetColor | (string & {});
|
|
294
|
+
type TagSize = "sm" | "md" | "lg";
|
|
295
|
+
type TagProps = Omit<PressableProps, "style"> & {
|
|
296
|
+
/** Tag color — preset name or any CSS color (e.g., "#c3c3c3", "red") */
|
|
297
|
+
color?: TagColor;
|
|
298
|
+
/** Tag size */
|
|
299
|
+
size?: TagSize;
|
|
300
|
+
/** Active (selected) state */
|
|
301
|
+
active?: boolean;
|
|
302
|
+
/** Disabled state */
|
|
303
|
+
disabled?: boolean;
|
|
304
|
+
/** Tag label text */
|
|
305
|
+
title: string;
|
|
306
|
+
/** Optional icon rendered on the left side */
|
|
307
|
+
leftIcon?: React$1.ReactNode;
|
|
308
|
+
/** Optional icon rendered on the right side */
|
|
309
|
+
rightIcon?: React$1.ReactNode;
|
|
310
|
+
/** Custom style for the outer container */
|
|
311
|
+
style?: StyleProp<ViewStyle>;
|
|
312
|
+
};
|
|
313
|
+
declare const Tag: React$1.ForwardRefExoticComponent<Omit<PressableProps, "style"> & {
|
|
314
|
+
/** Tag color — preset name or any CSS color (e.g., "#c3c3c3", "red") */
|
|
315
|
+
color?: TagColor;
|
|
316
|
+
/** Tag size */
|
|
317
|
+
size?: TagSize;
|
|
318
|
+
/** Active (selected) state */
|
|
319
|
+
active?: boolean;
|
|
320
|
+
/** Disabled state */
|
|
321
|
+
disabled?: boolean;
|
|
322
|
+
/** Tag label text */
|
|
323
|
+
title: string;
|
|
324
|
+
/** Optional icon rendered on the left side */
|
|
325
|
+
leftIcon?: React$1.ReactNode;
|
|
326
|
+
/** Optional icon rendered on the right side */
|
|
327
|
+
rightIcon?: React$1.ReactNode;
|
|
328
|
+
/** Custom style for the outer container */
|
|
329
|
+
style?: StyleProp<ViewStyle>;
|
|
330
|
+
} & React$1.RefAttributes<View>>;
|
|
331
|
+
|
|
332
|
+
export { ActivityIndicator, type ActivityIndicatorColor, type ActivityIndicatorProps, type ActivityIndicatorSize, Avatar, type AvatarProps, type AvatarSize, type AvatarVariant, Button, ButtonColor, type ButtonProps, type ButtonRadius, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, IconButton, type IconButtonColor, type IconButtonProps, type IconButtonRadius, type IconButtonSize, type IconButtonVariant, RehagroNativeProvider, type RehagroNativeProviderProps, type RehagroNativeTheme, Tag, type TagColor, type TagProps, type TagSize, Text, type TextColor, TextInput, type TextInputProps, type TextInputRadius, type TextInputSize, type TextInputStatus, type TextProps, type TextVariant, useRehagroTheme };
|
package/dist/native.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1 from 'react';
|
|
3
3
|
import { PressableProps, StyleProp, ViewStyle, View, TextInputProps as TextInputProps$1, TextInput as TextInput$1, ViewProps, TextProps as TextProps$1, TextStyle, Text as Text$1 } from 'react-native';
|
|
4
|
+
import { B as ButtonColor, P as PresetColor } from './colors.types-7nLOoy6r.js';
|
|
4
5
|
|
|
5
6
|
/** React Native theme — reuses the same token names as the web theme.
|
|
6
7
|
* Color values are plain CSS hex strings (e.g. "#16a34a").
|
|
@@ -15,6 +16,8 @@ type RehagroNativeTheme = {
|
|
|
15
16
|
dangerHover?: string;
|
|
16
17
|
warning?: string;
|
|
17
18
|
success?: string;
|
|
19
|
+
info?: string;
|
|
20
|
+
infoHover?: string;
|
|
18
21
|
text?: string;
|
|
19
22
|
textMuted?: string;
|
|
20
23
|
surface?: string;
|
|
@@ -53,6 +56,8 @@ type ButtonProps = Omit<PressableProps, "style"> & {
|
|
|
53
56
|
size?: ButtonSize;
|
|
54
57
|
/** Border radius */
|
|
55
58
|
radius?: ButtonRadius;
|
|
59
|
+
/** Color scheme — preset name or any CSS color (e.g., "#c3c3c3", "red", "rgb(...)") */
|
|
60
|
+
color?: ButtonColor;
|
|
56
61
|
/** Shows loading state and disables interaction */
|
|
57
62
|
loading?: boolean;
|
|
58
63
|
/** Icon rendered to the left of children (hidden when loading) */
|
|
@@ -71,6 +76,8 @@ declare const Button: React$1.ForwardRefExoticComponent<Omit<PressableProps, "st
|
|
|
71
76
|
size?: ButtonSize;
|
|
72
77
|
/** Border radius */
|
|
73
78
|
radius?: ButtonRadius;
|
|
79
|
+
/** Color scheme — preset name or any CSS color (e.g., "#c3c3c3", "red", "rgb(...)") */
|
|
80
|
+
color?: ButtonColor;
|
|
74
81
|
/** Shows loading state and disables interaction */
|
|
75
82
|
loading?: boolean;
|
|
76
83
|
/** Icon rendered to the left of children (hidden when loading) */
|
|
@@ -86,7 +93,7 @@ declare const Button: React$1.ForwardRefExoticComponent<Omit<PressableProps, "st
|
|
|
86
93
|
type IconButtonVariant = "solid" | "outline" | "ghost";
|
|
87
94
|
type IconButtonSize = "sm" | "md" | "lg";
|
|
88
95
|
type IconButtonRadius = "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "full";
|
|
89
|
-
type IconButtonColor =
|
|
96
|
+
type IconButtonColor = ButtonColor;
|
|
90
97
|
type IconButtonProps = Omit<PressableProps, "style"> & {
|
|
91
98
|
/** Visual style variant */
|
|
92
99
|
variant?: IconButtonVariant;
|
|
@@ -94,7 +101,7 @@ type IconButtonProps = Omit<PressableProps, "style"> & {
|
|
|
94
101
|
size?: IconButtonSize;
|
|
95
102
|
/** Border radius */
|
|
96
103
|
radius?: IconButtonRadius;
|
|
97
|
-
/** Color scheme */
|
|
104
|
+
/** Color scheme — preset name or any CSS color (e.g., "#c3c3c3", "red", "rgb(...)") */
|
|
98
105
|
color?: IconButtonColor;
|
|
99
106
|
/** Shows loading state and disables interaction */
|
|
100
107
|
loading?: boolean;
|
|
@@ -110,7 +117,7 @@ declare const IconButton: React$1.ForwardRefExoticComponent<Omit<PressableProps,
|
|
|
110
117
|
size?: IconButtonSize;
|
|
111
118
|
/** Border radius */
|
|
112
119
|
radius?: IconButtonRadius;
|
|
113
|
-
/** Color scheme */
|
|
120
|
+
/** Color scheme — preset name or any CSS color (e.g., "#c3c3c3", "red", "rgb(...)") */
|
|
114
121
|
color?: IconButtonColor;
|
|
115
122
|
/** Shows loading state and disables interaction */
|
|
116
123
|
loading?: boolean;
|
|
@@ -283,4 +290,43 @@ declare const Text: React$1.ForwardRefExoticComponent<Omit<TextProps$1, "style">
|
|
|
283
290
|
style?: StyleProp<TextStyle>;
|
|
284
291
|
} & React$1.RefAttributes<Text$1>>;
|
|
285
292
|
|
|
286
|
-
|
|
293
|
+
type TagColor = PresetColor | (string & {});
|
|
294
|
+
type TagSize = "sm" | "md" | "lg";
|
|
295
|
+
type TagProps = Omit<PressableProps, "style"> & {
|
|
296
|
+
/** Tag color — preset name or any CSS color (e.g., "#c3c3c3", "red") */
|
|
297
|
+
color?: TagColor;
|
|
298
|
+
/** Tag size */
|
|
299
|
+
size?: TagSize;
|
|
300
|
+
/** Active (selected) state */
|
|
301
|
+
active?: boolean;
|
|
302
|
+
/** Disabled state */
|
|
303
|
+
disabled?: boolean;
|
|
304
|
+
/** Tag label text */
|
|
305
|
+
title: string;
|
|
306
|
+
/** Optional icon rendered on the left side */
|
|
307
|
+
leftIcon?: React$1.ReactNode;
|
|
308
|
+
/** Optional icon rendered on the right side */
|
|
309
|
+
rightIcon?: React$1.ReactNode;
|
|
310
|
+
/** Custom style for the outer container */
|
|
311
|
+
style?: StyleProp<ViewStyle>;
|
|
312
|
+
};
|
|
313
|
+
declare const Tag: React$1.ForwardRefExoticComponent<Omit<PressableProps, "style"> & {
|
|
314
|
+
/** Tag color — preset name or any CSS color (e.g., "#c3c3c3", "red") */
|
|
315
|
+
color?: TagColor;
|
|
316
|
+
/** Tag size */
|
|
317
|
+
size?: TagSize;
|
|
318
|
+
/** Active (selected) state */
|
|
319
|
+
active?: boolean;
|
|
320
|
+
/** Disabled state */
|
|
321
|
+
disabled?: boolean;
|
|
322
|
+
/** Tag label text */
|
|
323
|
+
title: string;
|
|
324
|
+
/** Optional icon rendered on the left side */
|
|
325
|
+
leftIcon?: React$1.ReactNode;
|
|
326
|
+
/** Optional icon rendered on the right side */
|
|
327
|
+
rightIcon?: React$1.ReactNode;
|
|
328
|
+
/** Custom style for the outer container */
|
|
329
|
+
style?: StyleProp<ViewStyle>;
|
|
330
|
+
} & React$1.RefAttributes<View>>;
|
|
331
|
+
|
|
332
|
+
export { ActivityIndicator, type ActivityIndicatorColor, type ActivityIndicatorProps, type ActivityIndicatorSize, Avatar, type AvatarProps, type AvatarSize, type AvatarVariant, Button, ButtonColor, type ButtonProps, type ButtonRadius, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, IconButton, type IconButtonColor, type IconButtonProps, type IconButtonRadius, type IconButtonSize, type IconButtonVariant, RehagroNativeProvider, type RehagroNativeProviderProps, type RehagroNativeTheme, Tag, type TagColor, type TagProps, type TagSize, Text, type TextColor, TextInput, type TextInputProps, type TextInputRadius, type TextInputSize, type TextInputStatus, type TextProps, type TextVariant, useRehagroTheme };
|
package/dist/native.js
CHANGED
|
@@ -16,6 +16,8 @@ var DEFAULT_NATIVE_THEME = {
|
|
|
16
16
|
dangerHover: "#b91c1c",
|
|
17
17
|
warning: "#d97706",
|
|
18
18
|
success: "#16a34a",
|
|
19
|
+
info: "#0284c7",
|
|
20
|
+
infoHover: "#0369a1",
|
|
19
21
|
text: "#111827",
|
|
20
22
|
textMuted: "#6b7280",
|
|
21
23
|
surface: "#ffffff",
|
|
@@ -47,10 +49,20 @@ function RehagroNativeProvider({ theme, children }) {
|
|
|
47
49
|
);
|
|
48
50
|
return /* @__PURE__ */ jsxRuntime.jsx(RehagroNativeContext.Provider, { value: resolvedTheme, children });
|
|
49
51
|
}
|
|
52
|
+
var PRESET_COLORS = /* @__PURE__ */ new Set([
|
|
53
|
+
"primary",
|
|
54
|
+
"secondary",
|
|
55
|
+
"danger",
|
|
56
|
+
"warning",
|
|
57
|
+
"success",
|
|
58
|
+
"info"
|
|
59
|
+
]);
|
|
60
|
+
var isPresetColor = (c) => PRESET_COLORS.has(c);
|
|
50
61
|
var Button = react.forwardRef(function Button2({
|
|
51
62
|
variant = "solid",
|
|
52
63
|
size = "md",
|
|
53
64
|
radius = "sm",
|
|
65
|
+
color = "primary",
|
|
54
66
|
loading = false,
|
|
55
67
|
disabled,
|
|
56
68
|
leftIcon,
|
|
@@ -62,6 +74,25 @@ var Button = react.forwardRef(function Button2({
|
|
|
62
74
|
}, ref) {
|
|
63
75
|
const theme = useRehagroTheme();
|
|
64
76
|
const isDisabled = disabled || loading;
|
|
77
|
+
const preset = isPresetColor(color);
|
|
78
|
+
const presetBase = {
|
|
79
|
+
primary: theme.primary,
|
|
80
|
+
secondary: theme.secondary,
|
|
81
|
+
danger: theme.danger,
|
|
82
|
+
warning: theme.warning,
|
|
83
|
+
success: theme.success,
|
|
84
|
+
info: theme.info
|
|
85
|
+
};
|
|
86
|
+
const presetHover = {
|
|
87
|
+
primary: theme.primaryHover,
|
|
88
|
+
secondary: theme.secondaryHover,
|
|
89
|
+
danger: theme.dangerHover,
|
|
90
|
+
warning: theme.warning,
|
|
91
|
+
success: theme.success,
|
|
92
|
+
info: theme.infoHover
|
|
93
|
+
};
|
|
94
|
+
const colorBase = preset ? presetBase[color] : color;
|
|
95
|
+
const colorHover = preset ? presetHover[color] : color;
|
|
65
96
|
const sizeStyleMap = {
|
|
66
97
|
sm: { paddingHorizontal: 12, paddingVertical: 6 },
|
|
67
98
|
md: { paddingHorizontal: 16, paddingVertical: 8 },
|
|
@@ -95,22 +126,22 @@ var Button = react.forwardRef(function Button2({
|
|
|
95
126
|
const variantStyle = (pressed) => {
|
|
96
127
|
if (variant === "solid") {
|
|
97
128
|
return {
|
|
98
|
-
backgroundColor: pressed ?
|
|
99
|
-
borderColor: pressed ?
|
|
129
|
+
backgroundColor: pressed ? colorHover : colorBase,
|
|
130
|
+
borderColor: pressed ? colorHover : colorBase
|
|
100
131
|
};
|
|
101
132
|
}
|
|
102
133
|
if (variant === "outline") {
|
|
103
134
|
return {
|
|
104
|
-
borderColor:
|
|
105
|
-
backgroundColor: pressed ?
|
|
135
|
+
borderColor: colorBase,
|
|
136
|
+
backgroundColor: pressed ? colorBase : "transparent"
|
|
106
137
|
};
|
|
107
138
|
}
|
|
108
139
|
return { borderColor: "transparent", backgroundColor: "transparent" };
|
|
109
140
|
};
|
|
110
141
|
const textColor = (pressed) => {
|
|
111
142
|
if (variant === "solid") return theme.surface;
|
|
112
|
-
if (variant === "outline") return pressed ? theme.surface :
|
|
113
|
-
return
|
|
143
|
+
if (variant === "outline") return pressed ? theme.surface : colorBase;
|
|
144
|
+
return colorBase;
|
|
114
145
|
};
|
|
115
146
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
116
147
|
reactNative.Pressable,
|
|
@@ -127,7 +158,7 @@ var Button = react.forwardRef(function Button2({
|
|
|
127
158
|
reactNative.ActivityIndicator,
|
|
128
159
|
{
|
|
129
160
|
size: "small",
|
|
130
|
-
color: variant === "solid" ? theme.surface :
|
|
161
|
+
color: variant === "solid" ? theme.surface : colorBase
|
|
131
162
|
}
|
|
132
163
|
),
|
|
133
164
|
!loading && leftIcon && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityElementsHidden: true, children: leftIcon }),
|
|
@@ -143,6 +174,15 @@ var Button = react.forwardRef(function Button2({
|
|
|
143
174
|
}
|
|
144
175
|
);
|
|
145
176
|
});
|
|
177
|
+
var PRESET_COLORS2 = /* @__PURE__ */ new Set([
|
|
178
|
+
"primary",
|
|
179
|
+
"secondary",
|
|
180
|
+
"danger",
|
|
181
|
+
"warning",
|
|
182
|
+
"success",
|
|
183
|
+
"info"
|
|
184
|
+
]);
|
|
185
|
+
var isPresetColor2 = (c) => PRESET_COLORS2.has(c);
|
|
146
186
|
var IconButton = react.forwardRef(function IconButton2({
|
|
147
187
|
variant = "ghost",
|
|
148
188
|
size = "md",
|
|
@@ -172,14 +212,17 @@ var IconButton = react.forwardRef(function IconButton2({
|
|
|
172
212
|
xl: 24,
|
|
173
213
|
full: 9999
|
|
174
214
|
};
|
|
175
|
-
const
|
|
215
|
+
const presetTokens = {
|
|
176
216
|
primary: { main: theme.primary, hover: theme.primaryHover },
|
|
177
217
|
secondary: { main: theme.secondary, hover: theme.secondaryHover },
|
|
178
218
|
danger: { main: theme.danger, hover: theme.dangerHover },
|
|
179
219
|
warning: { main: theme.warning, hover: theme.warning },
|
|
180
|
-
success: { main: theme.success, hover: theme.success }
|
|
220
|
+
success: { main: theme.success, hover: theme.success },
|
|
221
|
+
info: { main: theme.info, hover: theme.infoHover }
|
|
181
222
|
};
|
|
182
|
-
const
|
|
223
|
+
const preset = isPresetColor2(color);
|
|
224
|
+
const main = preset ? presetTokens[color].main : color;
|
|
225
|
+
const hover = preset ? presetTokens[color].hover : color;
|
|
183
226
|
const boxSize = sizePxMap[size];
|
|
184
227
|
const baseStyle = {
|
|
185
228
|
width: boxSize,
|
|
@@ -261,7 +304,8 @@ var TextInput = react.forwardRef(function TextInput2({
|
|
|
261
304
|
xl: theme.radiusXl,
|
|
262
305
|
full: 9999
|
|
263
306
|
};
|
|
264
|
-
const
|
|
307
|
+
const hasError = status === "error" || !!helperText;
|
|
308
|
+
const borderColor = hasError ? theme.danger : focused ? theme.primary : theme.border;
|
|
265
309
|
const containerStyle = {
|
|
266
310
|
height: heightMap[size],
|
|
267
311
|
paddingHorizontal: paddingMap[size],
|
|
@@ -314,7 +358,7 @@ var TextInput = react.forwardRef(function TextInput2({
|
|
|
314
358
|
{
|
|
315
359
|
style: {
|
|
316
360
|
fontSize: 12,
|
|
317
|
-
color:
|
|
361
|
+
color: hasError ? theme.danger : theme.textMuted
|
|
318
362
|
},
|
|
319
363
|
children: helperText
|
|
320
364
|
}
|
|
@@ -551,6 +595,118 @@ var Text5 = react.forwardRef(function Text6({ variant = "body", color = "default
|
|
|
551
595
|
};
|
|
552
596
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { ref, style: [resolvedStyle, style], ...rest, children });
|
|
553
597
|
});
|
|
598
|
+
var PRESET_COLORS3 = /* @__PURE__ */ new Set([
|
|
599
|
+
"primary",
|
|
600
|
+
"secondary",
|
|
601
|
+
"danger",
|
|
602
|
+
"warning",
|
|
603
|
+
"success",
|
|
604
|
+
"info"
|
|
605
|
+
]);
|
|
606
|
+
var isPresetColor3 = (c) => PRESET_COLORS3.has(c);
|
|
607
|
+
function hexAlpha(hex, alpha) {
|
|
608
|
+
return `${hex}${alpha}`;
|
|
609
|
+
}
|
|
610
|
+
var Tag = react.forwardRef(function Tag2({
|
|
611
|
+
color = "primary",
|
|
612
|
+
size = "md",
|
|
613
|
+
active = false,
|
|
614
|
+
disabled = false,
|
|
615
|
+
title,
|
|
616
|
+
leftIcon,
|
|
617
|
+
rightIcon,
|
|
618
|
+
style,
|
|
619
|
+
accessibilityLabel,
|
|
620
|
+
...rest
|
|
621
|
+
}, ref) {
|
|
622
|
+
const theme = useRehagroTheme();
|
|
623
|
+
const clickable = !!rest.onPress && !disabled;
|
|
624
|
+
const presetTokens = {
|
|
625
|
+
primary: { main: theme.primary, hover: theme.primaryHover },
|
|
626
|
+
secondary: { main: theme.secondary, hover: theme.secondaryHover },
|
|
627
|
+
danger: { main: theme.danger, hover: theme.dangerHover },
|
|
628
|
+
warning: { main: theme.warning, hover: theme.warning },
|
|
629
|
+
success: { main: theme.success, hover: theme.success },
|
|
630
|
+
info: { main: theme.info, hover: theme.infoHover }
|
|
631
|
+
};
|
|
632
|
+
const preset = isPresetColor3(color);
|
|
633
|
+
const mainColor = preset ? presetTokens[color].main : color;
|
|
634
|
+
const hoverColor = preset ? presetTokens[color].hover : color;
|
|
635
|
+
const sizeStyleMap = {
|
|
636
|
+
sm: { paddingHorizontal: 8, paddingVertical: 2, gap: 4 },
|
|
637
|
+
md: { paddingHorizontal: 10, paddingVertical: 4, gap: 6 },
|
|
638
|
+
lg: { paddingHorizontal: 12, paddingVertical: 6, gap: 6 }
|
|
639
|
+
};
|
|
640
|
+
const fontSizeMap = {
|
|
641
|
+
sm: 11,
|
|
642
|
+
md: 12,
|
|
643
|
+
lg: 13
|
|
644
|
+
};
|
|
645
|
+
const baseStyle = {
|
|
646
|
+
flexDirection: "row",
|
|
647
|
+
alignItems: "center",
|
|
648
|
+
alignSelf: "flex-start",
|
|
649
|
+
borderRadius: 9999,
|
|
650
|
+
borderWidth: 1,
|
|
651
|
+
opacity: disabled ? 0.5 : 1,
|
|
652
|
+
...sizeStyleMap[size]
|
|
653
|
+
};
|
|
654
|
+
function containerStyle(pressed) {
|
|
655
|
+
const resolvedColor = pressed && clickable ? hoverColor : mainColor;
|
|
656
|
+
if (active) {
|
|
657
|
+
return {
|
|
658
|
+
backgroundColor: resolvedColor,
|
|
659
|
+
borderColor: resolvedColor
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
const bg = pressed && clickable ? hexAlpha(mainColor, "33") : hexAlpha(mainColor, "1a");
|
|
663
|
+
const border = hexAlpha(mainColor, "4d");
|
|
664
|
+
return { backgroundColor: bg, borderColor: border };
|
|
665
|
+
}
|
|
666
|
+
function resolvedTextColor(pressed) {
|
|
667
|
+
if (active) return theme.surface;
|
|
668
|
+
return pressed && clickable ? hoverColor : mainColor;
|
|
669
|
+
}
|
|
670
|
+
const textStyle = (pressed) => ({
|
|
671
|
+
color: resolvedTextColor(pressed),
|
|
672
|
+
fontSize: fontSizeMap[size],
|
|
673
|
+
fontWeight: "500"
|
|
674
|
+
});
|
|
675
|
+
if (!clickable) {
|
|
676
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
677
|
+
reactNative.View,
|
|
678
|
+
{
|
|
679
|
+
ref,
|
|
680
|
+
accessibilityRole: "text",
|
|
681
|
+
accessibilityLabel: accessibilityLabel ?? title,
|
|
682
|
+
accessibilityState: { disabled },
|
|
683
|
+
style: [baseStyle, containerStyle(false), style],
|
|
684
|
+
children: [
|
|
685
|
+
leftIcon && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityElementsHidden: true, children: leftIcon }),
|
|
686
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle(false), children: title }),
|
|
687
|
+
rightIcon && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityElementsHidden: true, children: rightIcon })
|
|
688
|
+
]
|
|
689
|
+
}
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
693
|
+
reactNative.Pressable,
|
|
694
|
+
{
|
|
695
|
+
ref,
|
|
696
|
+
disabled,
|
|
697
|
+
accessibilityRole: "button",
|
|
698
|
+
accessibilityState: { disabled, selected: active },
|
|
699
|
+
accessibilityLabel: accessibilityLabel ?? title,
|
|
700
|
+
style: ({ pressed }) => [baseStyle, containerStyle(pressed), style],
|
|
701
|
+
...rest,
|
|
702
|
+
children: ({ pressed }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
703
|
+
leftIcon && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityElementsHidden: true, children: leftIcon }),
|
|
704
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle(pressed), children: title }),
|
|
705
|
+
rightIcon && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityElementsHidden: true, children: rightIcon })
|
|
706
|
+
] })
|
|
707
|
+
}
|
|
708
|
+
);
|
|
709
|
+
});
|
|
554
710
|
|
|
555
711
|
exports.ActivityIndicator = ActivityIndicator3;
|
|
556
712
|
exports.Avatar = Avatar;
|
|
@@ -558,6 +714,7 @@ exports.Button = Button;
|
|
|
558
714
|
exports.Checkbox = Checkbox;
|
|
559
715
|
exports.IconButton = IconButton;
|
|
560
716
|
exports.RehagroNativeProvider = RehagroNativeProvider;
|
|
717
|
+
exports.Tag = Tag;
|
|
561
718
|
exports.Text = Text5;
|
|
562
719
|
exports.TextInput = TextInput;
|
|
563
720
|
exports.useRehagroTheme = useRehagroTheme;
|