@rehagro/ui 0.1.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,488 @@
1
+ import { createContext, forwardRef, useState, useCallback, useContext, useMemo } from 'react';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { Pressable, ActivityIndicator, View, Text, TextInput as TextInput$1, Image } from 'react-native';
4
+
5
+ // src/provider/RehagroNativeProvider.tsx
6
+
7
+ // src/provider/theme.native.ts
8
+ var DEFAULT_NATIVE_THEME = {
9
+ primary: "#16a34a",
10
+ primaryHover: "#15803d",
11
+ secondary: "#6b7280",
12
+ secondaryHover: "#4b5563",
13
+ danger: "#dc2626",
14
+ dangerHover: "#b91c1c",
15
+ warning: "#d97706",
16
+ success: "#16a34a",
17
+ text: "#111827",
18
+ textMuted: "#6b7280",
19
+ surface: "#ffffff",
20
+ background: "#f9fafb",
21
+ border: "#d1d5db",
22
+ radiusXxs: 4,
23
+ radiusXs: 8,
24
+ radiusSm: 12,
25
+ radiusMd: 16,
26
+ radiusLg: 24,
27
+ radiusXl: 32,
28
+ borderWidthSm: 1,
29
+ borderWidthMd: 2,
30
+ borderWidthLg: 3,
31
+ inputHeightSm: 36,
32
+ inputHeightMd: 44,
33
+ inputHeightLg: 52
34
+ };
35
+
36
+ // src/provider/RehagroNativeContext.ts
37
+ var RehagroNativeContext = createContext(DEFAULT_NATIVE_THEME);
38
+ function useRehagroTheme() {
39
+ return useContext(RehagroNativeContext);
40
+ }
41
+ function RehagroNativeProvider({ theme, children }) {
42
+ const resolvedTheme = useMemo(
43
+ () => ({ ...DEFAULT_NATIVE_THEME, ...theme }),
44
+ [theme]
45
+ );
46
+ return /* @__PURE__ */ jsx(RehagroNativeContext.Provider, { value: resolvedTheme, children });
47
+ }
48
+ var Button = forwardRef(function Button2({
49
+ variant = "solid",
50
+ size = "md",
51
+ radius = "sm",
52
+ loading = false,
53
+ disabled,
54
+ leftIcon,
55
+ rightIcon,
56
+ children,
57
+ style,
58
+ accessibilityLabel,
59
+ ...rest
60
+ }, ref) {
61
+ const theme = useRehagroTheme();
62
+ const isDisabled = disabled || loading;
63
+ const sizeStyleMap = {
64
+ sm: { paddingHorizontal: 12, paddingVertical: 6 },
65
+ md: { paddingHorizontal: 16, paddingVertical: 8 },
66
+ lg: { paddingHorizontal: 20, paddingVertical: 10 }
67
+ };
68
+ const fontSizeMap = {
69
+ sm: 14,
70
+ md: 14,
71
+ lg: 16
72
+ };
73
+ const radiusStyleMap = {
74
+ none: 0,
75
+ xxs: 2,
76
+ xs: 4,
77
+ sm: 8,
78
+ md: 12,
79
+ lg: 16,
80
+ xl: 24,
81
+ full: 9999
82
+ };
83
+ const baseStyle = {
84
+ flexDirection: "row",
85
+ alignItems: "center",
86
+ justifyContent: "center",
87
+ gap: 8,
88
+ borderWidth: 1,
89
+ opacity: isDisabled ? 0.5 : 1,
90
+ borderRadius: radiusStyleMap[radius],
91
+ ...sizeStyleMap[size]
92
+ };
93
+ const variantStyle = (pressed) => {
94
+ if (variant === "solid") {
95
+ return {
96
+ backgroundColor: pressed ? theme.primaryHover : theme.primary,
97
+ borderColor: pressed ? theme.primaryHover : theme.primary
98
+ };
99
+ }
100
+ if (variant === "outline") {
101
+ return {
102
+ borderColor: theme.primary,
103
+ backgroundColor: pressed ? theme.primary : "transparent"
104
+ };
105
+ }
106
+ return { borderColor: "transparent", backgroundColor: "transparent" };
107
+ };
108
+ const textColor = (pressed) => {
109
+ if (variant === "solid") return theme.surface;
110
+ if (variant === "outline") return pressed ? theme.surface : theme.primary;
111
+ return theme.primary;
112
+ };
113
+ return /* @__PURE__ */ jsx(
114
+ Pressable,
115
+ {
116
+ ref,
117
+ disabled: isDisabled,
118
+ accessibilityRole: "button",
119
+ accessibilityState: { disabled: !!isDisabled, busy: loading },
120
+ accessibilityLabel: accessibilityLabel ?? (typeof children === "string" ? children : void 0),
121
+ style: ({ pressed }) => [baseStyle, variantStyle(pressed), style],
122
+ ...rest,
123
+ children: ({ pressed }) => /* @__PURE__ */ jsxs(Fragment, { children: [
124
+ loading && /* @__PURE__ */ jsx(
125
+ ActivityIndicator,
126
+ {
127
+ size: "small",
128
+ color: variant === "solid" ? theme.surface : theme.primary
129
+ }
130
+ ),
131
+ !loading && leftIcon && /* @__PURE__ */ jsx(View, { accessibilityElementsHidden: true, children: leftIcon }),
132
+ typeof children === "string" ? /* @__PURE__ */ jsx(
133
+ Text,
134
+ {
135
+ style: { color: textColor(pressed), fontSize: fontSizeMap[size], fontWeight: "500" },
136
+ children
137
+ }
138
+ ) : children,
139
+ !loading && rightIcon && /* @__PURE__ */ jsx(View, { accessibilityElementsHidden: true, children: rightIcon })
140
+ ] })
141
+ }
142
+ );
143
+ });
144
+ var IconButton = forwardRef(function IconButton2({
145
+ variant = "ghost",
146
+ size = "md",
147
+ radius = "full",
148
+ color = "primary",
149
+ loading = false,
150
+ disabled,
151
+ children,
152
+ style,
153
+ accessibilityLabel,
154
+ ...rest
155
+ }, ref) {
156
+ const theme = useRehagroTheme();
157
+ const isDisabled = disabled || loading;
158
+ const sizePxMap = {
159
+ sm: 32,
160
+ md: 40,
161
+ lg: 48
162
+ };
163
+ const radiusPxMap = {
164
+ none: 0,
165
+ xxs: 2,
166
+ xs: 4,
167
+ sm: 8,
168
+ md: 12,
169
+ lg: 16,
170
+ xl: 24,
171
+ full: 9999
172
+ };
173
+ const colorTokens = {
174
+ primary: { main: theme.primary, hover: theme.primaryHover },
175
+ secondary: { main: theme.secondary, hover: theme.secondaryHover },
176
+ danger: { main: theme.danger, hover: theme.dangerHover },
177
+ warning: { main: theme.warning, hover: theme.warning },
178
+ success: { main: theme.success, hover: theme.success }
179
+ };
180
+ const { main, hover } = colorTokens[color];
181
+ const boxSize = sizePxMap[size];
182
+ const baseStyle = {
183
+ width: boxSize,
184
+ height: boxSize,
185
+ borderRadius: radiusPxMap[radius],
186
+ alignItems: "center",
187
+ justifyContent: "center",
188
+ borderWidth: 1,
189
+ opacity: isDisabled ? 0.5 : 1
190
+ };
191
+ const variantStyle = (pressed) => {
192
+ if (variant === "solid") {
193
+ return { backgroundColor: pressed ? hover : main, borderColor: pressed ? hover : main };
194
+ }
195
+ if (variant === "outline") {
196
+ return { borderColor: main, backgroundColor: pressed ? main : "transparent" };
197
+ }
198
+ return { borderColor: "transparent", backgroundColor: pressed ? `${main}1a` : "transparent" };
199
+ };
200
+ const iconColor = (pressed) => {
201
+ if (variant === "solid") return theme.surface;
202
+ if (variant === "outline") return pressed ? theme.surface : main;
203
+ return main;
204
+ };
205
+ return /* @__PURE__ */ jsx(
206
+ Pressable,
207
+ {
208
+ ref,
209
+ disabled: isDisabled,
210
+ accessibilityRole: "button",
211
+ accessibilityState: { disabled: !!isDisabled, busy: loading },
212
+ accessibilityLabel,
213
+ style: ({ pressed }) => [baseStyle, variantStyle(pressed), style],
214
+ ...rest,
215
+ children: ({ pressed }) => loading ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: variant === "solid" ? theme.surface : main }) : /* @__PURE__ */ jsx(View, { style: { tintColor: iconColor(pressed) }, children })
216
+ }
217
+ );
218
+ });
219
+ var TextInput = forwardRef(function TextInput2({
220
+ label,
221
+ subtitle,
222
+ status = "default",
223
+ size = "md",
224
+ radius = "xs",
225
+ leftIcon,
226
+ rightIcon,
227
+ helperText,
228
+ editable = true,
229
+ wrapperStyle,
230
+ style,
231
+ accessibilityLabel,
232
+ ...rest
233
+ }, ref) {
234
+ const theme = useRehagroTheme();
235
+ const [focused, setFocused] = useState(false);
236
+ const isDisabled = editable === false;
237
+ const heightMap = {
238
+ sm: theme.inputHeightSm,
239
+ md: theme.inputHeightMd,
240
+ lg: theme.inputHeightLg
241
+ };
242
+ const paddingMap = {
243
+ sm: 12,
244
+ md: 14,
245
+ lg: 16
246
+ };
247
+ const fontSizeMap = {
248
+ sm: 14,
249
+ md: 14,
250
+ lg: 16
251
+ };
252
+ const radiusMap = {
253
+ none: 0,
254
+ xxs: theme.radiusXxs,
255
+ xs: theme.radiusXs,
256
+ sm: theme.radiusSm,
257
+ md: theme.radiusMd,
258
+ lg: theme.radiusLg,
259
+ xl: theme.radiusXl,
260
+ full: 9999
261
+ };
262
+ const borderColor = status === "error" ? theme.danger : focused ? theme.primary : theme.border;
263
+ const containerStyle = {
264
+ height: heightMap[size],
265
+ paddingHorizontal: paddingMap[size],
266
+ borderRadius: radiusMap[radius],
267
+ borderWidth: theme.borderWidthSm,
268
+ borderColor,
269
+ backgroundColor: isDisabled ? theme.background : theme.surface,
270
+ flexDirection: "row",
271
+ alignItems: "center",
272
+ gap: 8,
273
+ opacity: isDisabled ? 0.5 : 1
274
+ };
275
+ const inputId = accessibilityLabel ?? label;
276
+ return /* @__PURE__ */ jsxs(View, { style: [{ gap: 4 }, wrapperStyle], children: [
277
+ label && /* @__PURE__ */ jsxs(View, { style: { flexDirection: "row", alignItems: "baseline", gap: 4 }, children: [
278
+ /* @__PURE__ */ jsx(Text, { style: { fontSize: 14, fontWeight: "500", color: theme.text }, children: label }),
279
+ subtitle && /* @__PURE__ */ jsx(Text, { style: { fontSize: 14, color: theme.textMuted }, children: subtitle })
280
+ ] }),
281
+ /* @__PURE__ */ jsxs(View, { style: [containerStyle, style], children: [
282
+ leftIcon && /* @__PURE__ */ jsx(View, { accessibilityElementsHidden: true, style: { width: fontSizeMap[size], height: fontSizeMap[size] }, children: leftIcon }),
283
+ /* @__PURE__ */ jsx(
284
+ TextInput$1,
285
+ {
286
+ ref,
287
+ editable,
288
+ accessibilityLabel: inputId,
289
+ accessibilityState: { disabled: isDisabled },
290
+ "aria-invalid": status === "error",
291
+ onFocus: (e) => {
292
+ setFocused(true);
293
+ rest.onFocus?.(e);
294
+ },
295
+ onBlur: (e) => {
296
+ setFocused(false);
297
+ rest.onBlur?.(e);
298
+ },
299
+ style: {
300
+ flex: 1,
301
+ fontSize: fontSizeMap[size],
302
+ color: theme.text
303
+ },
304
+ placeholderTextColor: theme.textMuted,
305
+ ...rest
306
+ }
307
+ ),
308
+ rightIcon && /* @__PURE__ */ jsx(View, { accessibilityElementsHidden: true, style: { width: fontSizeMap[size], height: fontSizeMap[size] }, children: rightIcon })
309
+ ] }),
310
+ helperText && /* @__PURE__ */ jsx(
311
+ Text,
312
+ {
313
+ style: {
314
+ fontSize: 12,
315
+ color: status === "error" ? theme.danger : theme.textMuted
316
+ },
317
+ children: helperText
318
+ }
319
+ )
320
+ ] });
321
+ });
322
+ var CheckIcon = ({ size, color }) => /* @__PURE__ */ jsx(
323
+ View,
324
+ {
325
+ style: {
326
+ width: size,
327
+ height: size,
328
+ alignItems: "center",
329
+ justifyContent: "center"
330
+ },
331
+ children: /* @__PURE__ */ jsx(
332
+ View,
333
+ {
334
+ style: {
335
+ position: "absolute",
336
+ width: size * 0.55,
337
+ height: size * 0.3,
338
+ borderLeftWidth: 2,
339
+ borderBottomWidth: 2,
340
+ borderColor: color,
341
+ transform: [{ rotate: "-45deg" }, { translateY: -size * 0.05 }]
342
+ }
343
+ }
344
+ )
345
+ }
346
+ );
347
+ var MinusIcon = ({ size, color }) => /* @__PURE__ */ jsx(
348
+ View,
349
+ {
350
+ style: {
351
+ width: size * 0.7,
352
+ height: 2,
353
+ backgroundColor: color
354
+ }
355
+ }
356
+ );
357
+ var Checkbox = forwardRef(function Checkbox2({
358
+ size = "md",
359
+ label,
360
+ checked: controlledChecked,
361
+ defaultChecked = false,
362
+ indeterminate = false,
363
+ disabled,
364
+ onChange,
365
+ style,
366
+ accessibilityLabel,
367
+ ...rest
368
+ }, ref) {
369
+ const theme = useRehagroTheme();
370
+ const isControlled = controlledChecked !== void 0;
371
+ const [internalChecked, setInternalChecked] = useState(defaultChecked);
372
+ const isChecked = isControlled ? controlledChecked : internalChecked;
373
+ const isActive = isChecked || indeterminate;
374
+ const handlePress = useCallback(() => {
375
+ if (disabled) return;
376
+ const next = !isChecked;
377
+ if (!isControlled) setInternalChecked(next);
378
+ onChange?.(next);
379
+ }, [disabled, isChecked, isControlled, onChange]);
380
+ const boxSizeMap = {
381
+ sm: 16,
382
+ md: 20,
383
+ lg: 24
384
+ };
385
+ const iconSizeMap = {
386
+ sm: 10,
387
+ md: 12,
388
+ lg: 14
389
+ };
390
+ const fontSizeMap = {
391
+ sm: 14,
392
+ md: 14,
393
+ lg: 16
394
+ };
395
+ const boxSize = boxSizeMap[size];
396
+ const iconSize = iconSizeMap[size];
397
+ const boxStyle = {
398
+ width: boxSize,
399
+ height: boxSize,
400
+ borderRadius: theme.radiusXxs,
401
+ borderWidth: theme.borderWidthSm,
402
+ borderColor: isActive ? theme.primary : theme.border,
403
+ backgroundColor: isActive ? theme.primary : theme.surface,
404
+ alignItems: "center",
405
+ justifyContent: "center"
406
+ };
407
+ return /* @__PURE__ */ jsxs(
408
+ Pressable,
409
+ {
410
+ ref,
411
+ onPress: handlePress,
412
+ disabled,
413
+ accessibilityRole: "checkbox",
414
+ accessibilityState: { checked: indeterminate ? "mixed" : isChecked, disabled: !!disabled },
415
+ accessibilityLabel: accessibilityLabel ?? label,
416
+ style: [{ flexDirection: "row", alignItems: "center", gap: 8, opacity: disabled ? 0.5 : 1 }, style],
417
+ ...rest,
418
+ children: [
419
+ /* @__PURE__ */ jsx(View, { style: boxStyle, children: indeterminate ? /* @__PURE__ */ jsx(MinusIcon, { size: iconSize, color: theme.surface }) : isChecked ? /* @__PURE__ */ jsx(CheckIcon, { size: iconSize, color: theme.surface }) : null }),
420
+ label && /* @__PURE__ */ jsx(Text, { style: { fontSize: fontSizeMap[size], color: theme.text }, children: label })
421
+ ]
422
+ }
423
+ );
424
+ });
425
+ var Avatar = forwardRef(function Avatar2({ src, alt = "", initials, size = "md", variant = "circle", style, ...rest }, ref) {
426
+ const theme = useRehagroTheme();
427
+ const [imgError, setImgError] = useState(false);
428
+ const showImage = !!src && !imgError;
429
+ const fallbackLabel = initials ? initials.slice(0, 2).toUpperCase() : alt ? alt.split(" ").slice(0, 2).map((w) => w[0]).join("").toUpperCase() : "?";
430
+ const sizePxMap = {
431
+ sm: 32,
432
+ md: 40,
433
+ lg: 48,
434
+ xl: 64
435
+ };
436
+ const fontSizeMap = {
437
+ sm: 12,
438
+ md: 14,
439
+ lg: 18,
440
+ xl: 20
441
+ };
442
+ const boxSize = sizePxMap[size];
443
+ const borderRadius = variant === "circle" ? boxSize / 2 : theme.radiusSm;
444
+ const containerStyle = {
445
+ width: boxSize,
446
+ height: boxSize,
447
+ borderRadius,
448
+ backgroundColor: theme.primary,
449
+ alignItems: "center",
450
+ justifyContent: "center",
451
+ overflow: "hidden"
452
+ };
453
+ return /* @__PURE__ */ jsx(
454
+ View,
455
+ {
456
+ ref,
457
+ accessible: true,
458
+ accessibilityRole: "image",
459
+ accessibilityLabel: alt || initials || fallbackLabel,
460
+ style: [containerStyle, style],
461
+ ...rest,
462
+ children: showImage ? /* @__PURE__ */ jsx(
463
+ Image,
464
+ {
465
+ source: { uri: src },
466
+ style: { width: boxSize, height: boxSize, borderRadius },
467
+ onError: () => setImgError(true),
468
+ accessibilityLabel: alt
469
+ }
470
+ ) : /* @__PURE__ */ jsx(
471
+ Text,
472
+ {
473
+ style: {
474
+ fontSize: fontSizeMap[size],
475
+ fontWeight: "500",
476
+ color: theme.surface
477
+ },
478
+ accessibilityElementsHidden: true,
479
+ children: fallbackLabel
480
+ }
481
+ )
482
+ }
483
+ );
484
+ });
485
+
486
+ export { Avatar, Button, Checkbox, IconButton, RehagroNativeProvider, TextInput, useRehagroTheme };
487
+ //# sourceMappingURL=native.mjs.map
488
+ //# sourceMappingURL=native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/provider/theme.native.ts","../src/provider/RehagroNativeContext.ts","../src/provider/RehagroNativeProvider.tsx","../src/components/Button/Button.native.tsx","../src/components/IconButton/IconButton.native.tsx","../src/components/TextInput/TextInput.native.tsx","../src/components/Checkbox/Checkbox.native.tsx","../src/components/Avatar/Avatar.native.tsx"],"names":["Button","jsx","forwardRef","IconButton","Pressable","ActivityIndicator","View","TextInput","jsxs","Text","RNT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,MAAM,WAAA,CAAY,IAAI,CAAA;AAAA,UAC/B,kBAAA,EAAoB;AAAA;AAAA,0BAGtBA,GAAAA;AAAA,QAACQ,IAAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO;AAAA,YACL,QAAA,EAAU,YAAY,IAAI,CAAA;AAAA,YAC1B,UAAA,EAAY,KAAA;AAAA,YACZ,OAAO,KAAA,CAAM;AAAA,WACf;AAAA,UACA,2BAAA,EAA2B,IAAA;AAAA,UAE1B,QAAA,EAAA;AAAA;AAAA;AACH;AAAA,GAEJ;AAEJ,CAAC","file":"native.mjs","sourcesContent":["import type { RehagroTheme } from \"./theme\";\n\n/** React Native theme — reuses the same token names as the web theme.\n * Color values are plain CSS hex strings (e.g. \"#16a34a\").\n * Spacing/radius/border values are numbers (device-independent pixels).\n */\nexport type RehagroNativeTheme = {\n // Brand colors\n primary?: string;\n primaryHover?: string;\n secondary?: string;\n secondaryHover?: string;\n danger?: string;\n dangerHover?: string;\n warning?: string;\n success?: string;\n\n // Semantic colors\n text?: string;\n textMuted?: string;\n surface?: string;\n background?: string;\n border?: string;\n\n // Border radius (numbers = dp)\n radiusXxs?: number;\n radiusXs?: number;\n radiusSm?: number;\n radiusMd?: number;\n radiusLg?: number;\n radiusXl?: number;\n\n // Border width\n borderWidthSm?: number;\n borderWidthMd?: number;\n borderWidthLg?: number;\n\n // Input sizes\n inputHeightSm?: number;\n inputHeightMd?: number;\n inputHeightLg?: number;\n};\n\nexport type RehagroNativeProviderProps = {\n /** Theme overrides — any token not provided keeps the default value */\n theme?: RehagroNativeTheme;\n children: React.ReactNode;\n};\n\nexport const DEFAULT_NATIVE_THEME: Required<RehagroNativeTheme> = {\n primary: \"#16a34a\",\n primaryHover: \"#15803d\",\n secondary: \"#6b7280\",\n secondaryHover: \"#4b5563\",\n danger: \"#dc2626\",\n dangerHover: \"#b91c1c\",\n warning: \"#d97706\",\n success: \"#16a34a\",\n\n text: \"#111827\",\n textMuted: \"#6b7280\",\n surface: \"#ffffff\",\n background: \"#f9fafb\",\n border: \"#d1d5db\",\n\n radiusXxs: 4,\n radiusXs: 8,\n radiusSm: 12,\n radiusMd: 16,\n radiusLg: 24,\n radiusXl: 32,\n\n borderWidthSm: 1,\n borderWidthMd: 2,\n borderWidthLg: 3,\n\n inputHeightSm: 36,\n inputHeightMd: 44,\n inputHeightLg: 52,\n};\n\n// Ensures RehagroNativeTheme color keys stay in sync with RehagroTheme\ntype _ColorKeysMatch = Pick<\n RehagroTheme,\n \"primary\" | \"primaryHover\" | \"secondary\" | \"secondaryHover\" | \"danger\" | \"dangerHover\" | \"warning\" | \"success\" | \"text\" | \"textMuted\" | \"surface\" | \"background\" | \"border\"\n>;\ntype _NativeColorKeys = Pick<\n RehagroNativeTheme,\n \"primary\" | \"primaryHover\" | \"secondary\" | \"secondaryHover\" | \"danger\" | \"dangerHover\" | \"warning\" | \"success\" | \"text\" | \"textMuted\" | \"surface\" | \"background\" | \"border\"\n>;\n// This line will error at compile time if the color keys diverge:\ntype _ColorKeysCheck = _ColorKeysMatch extends _NativeColorKeys ? true : never;\n","import { createContext, useContext } from \"react\";\nimport type { RehagroNativeTheme } from \"./theme.native\";\nimport { DEFAULT_NATIVE_THEME } from \"./theme.native\";\n\nexport const RehagroNativeContext = createContext<Required<RehagroNativeTheme>>(DEFAULT_NATIVE_THEME);\n\nexport function useRehagroTheme(): Required<RehagroNativeTheme> {\n return useContext(RehagroNativeContext);\n}\n","import React, { useMemo } from \"react\";\nimport { RehagroNativeContext } from \"./RehagroNativeContext\";\nimport { DEFAULT_NATIVE_THEME } from \"./theme.native\";\nimport type { RehagroNativeProviderProps, RehagroNativeTheme } from \"./theme.native\";\n\nexport function RehagroNativeProvider({ theme, children }: RehagroNativeProviderProps) {\n const resolvedTheme = useMemo<Required<RehagroNativeTheme>>(\n () => ({ ...DEFAULT_NATIVE_THEME, ...theme }),\n [theme],\n );\n\n return (\n <RehagroNativeContext.Provider value={resolvedTheme}>\n {children}\n </RehagroNativeContext.Provider>\n );\n}\n","import React, { forwardRef } from \"react\";\nimport {\n ActivityIndicator,\n Pressable,\n Text,\n View,\n type PressableProps,\n type StyleProp,\n type ViewStyle,\n} from \"react-native\";\nimport { useRehagroTheme } from \"../../provider/RehagroNativeContext\";\n\nexport type ButtonVariant = \"solid\" | \"outline\" | \"ghost\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\nexport type ButtonRadius = \"none\" | \"xxs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\nexport type ButtonProps = Omit<PressableProps, \"style\"> & {\n /** Visual style variant */\n variant?: ButtonVariant;\n /** Button size */\n size?: ButtonSize;\n /** Border radius */\n radius?: ButtonRadius;\n /** Shows loading state and disables interaction */\n loading?: boolean;\n /** Icon rendered to the left of children (hidden when loading) */\n leftIcon?: React.ReactNode;\n /** Icon rendered to the right of children (hidden when loading) */\n rightIcon?: React.ReactNode;\n /** Label text */\n children?: React.ReactNode;\n /** Custom style for the outer Pressable */\n style?: StyleProp<ViewStyle>;\n};\n\nexport const Button = forwardRef<View, ButtonProps>(function Button(\n {\n variant = \"solid\",\n size = \"md\",\n radius = \"sm\",\n loading = false,\n disabled,\n leftIcon,\n rightIcon,\n children,\n style,\n accessibilityLabel,\n ...rest\n },\n ref,\n) {\n const theme = useRehagroTheme();\n const isDisabled = disabled || loading;\n\n const sizeStyleMap: Record<ButtonSize, ViewStyle> = {\n sm: { paddingHorizontal: 12, paddingVertical: 6 },\n md: { paddingHorizontal: 16, paddingVertical: 8 },\n lg: { paddingHorizontal: 20, paddingVertical: 10 },\n };\n\n const fontSizeMap: Record<ButtonSize, number> = {\n sm: 14,\n md: 14,\n lg: 16,\n };\n\n const radiusStyleMap: Record<ButtonRadius, number> = {\n none: 0,\n xxs: 2,\n xs: 4,\n sm: 8,\n md: 12,\n lg: 16,\n xl: 24,\n full: 9999,\n };\n\n const baseStyle: ViewStyle = {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 8,\n borderWidth: 1,\n opacity: isDisabled ? 0.5 : 1,\n borderRadius: radiusStyleMap[radius],\n ...sizeStyleMap[size],\n };\n\n const variantStyle = (pressed: boolean): ViewStyle => {\n if (variant === \"solid\") {\n return {\n backgroundColor: pressed ? theme.primaryHover : theme.primary,\n borderColor: pressed ? theme.primaryHover : theme.primary,\n };\n }\n if (variant === \"outline\") {\n return {\n borderColor: theme.primary,\n backgroundColor: pressed ? theme.primary : \"transparent\",\n };\n }\n return { borderColor: \"transparent\", backgroundColor: \"transparent\" };\n };\n\n const textColor = (pressed: boolean): string => {\n if (variant === \"solid\") return theme.surface;\n if (variant === \"outline\") return pressed ? theme.surface : theme.primary;\n return theme.primary;\n };\n\n return (\n <Pressable\n ref={ref}\n disabled={isDisabled}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled: !!isDisabled, busy: loading }}\n accessibilityLabel={\n accessibilityLabel ?? (typeof children === \"string\" ? children : undefined)\n }\n style={({ pressed }) => [baseStyle, variantStyle(pressed), style]}\n {...rest}\n >\n {({ pressed }) => (\n <>\n {loading && (\n <ActivityIndicator\n size=\"small\"\n color={variant === \"solid\" ? theme.surface : theme.primary}\n />\n )}\n {!loading && leftIcon && <View accessibilityElementsHidden>{leftIcon}</View>}\n {typeof children === \"string\" ? (\n <Text\n style={{ color: textColor(pressed), fontSize: fontSizeMap[size], fontWeight: \"500\" }}\n >\n {children}\n </Text>\n ) : (\n children\n )}\n {!loading && rightIcon && <View accessibilityElementsHidden>{rightIcon}</View>}\n </>\n )}\n </Pressable>\n );\n});\n","import React, { forwardRef } from \"react\";\nimport {\n ActivityIndicator,\n Pressable,\n View,\n type PressableProps,\n type StyleProp,\n type ViewStyle,\n} from \"react-native\";\nimport { useRehagroTheme } from \"../../provider/RehagroNativeContext\";\n\nexport type IconButtonVariant = \"solid\" | \"outline\" | \"ghost\";\nexport type IconButtonSize = \"sm\" | \"md\" | \"lg\";\nexport type IconButtonRadius = \"none\" | \"xxs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\nexport type IconButtonColor = \"primary\" | \"danger\" | \"warning\" | \"success\" | \"secondary\";\n\nexport type IconButtonProps = Omit<PressableProps, \"style\"> & {\n /** Visual style variant */\n variant?: IconButtonVariant;\n /** Button size */\n size?: IconButtonSize;\n /** Border radius */\n radius?: IconButtonRadius;\n /** Color scheme */\n color?: IconButtonColor;\n /** Shows loading state and disables interaction */\n loading?: boolean;\n /** Icon content */\n children?: React.ReactNode;\n /** Custom style for the outer Pressable */\n style?: StyleProp<ViewStyle>;\n};\n\nexport const IconButton = forwardRef<View, IconButtonProps>(function IconButton(\n {\n variant = \"ghost\",\n size = \"md\",\n radius = \"full\",\n color = \"primary\",\n loading = false,\n disabled,\n children,\n style,\n accessibilityLabel,\n ...rest\n },\n ref,\n) {\n const theme = useRehagroTheme();\n const isDisabled = disabled || loading;\n\n const sizePxMap: Record<IconButtonSize, number> = {\n sm: 32,\n md: 40,\n lg: 48,\n };\n\n const radiusPxMap: Record<IconButtonRadius, number> = {\n none: 0,\n xxs: 2,\n xs: 4,\n sm: 8,\n md: 12,\n lg: 16,\n xl: 24,\n full: 9999,\n };\n\n const colorTokens: Record<IconButtonColor, { main: string; hover: string }> = {\n primary: { main: theme.primary, hover: theme.primaryHover },\n secondary: { main: theme.secondary, hover: theme.secondaryHover },\n danger: { main: theme.danger, hover: theme.dangerHover },\n warning: { main: theme.warning, hover: theme.warning },\n success: { main: theme.success, hover: theme.success },\n };\n\n const { main, hover } = colorTokens[color];\n const boxSize = sizePxMap[size];\n\n const baseStyle: ViewStyle = {\n width: boxSize,\n height: boxSize,\n borderRadius: radiusPxMap[radius],\n alignItems: \"center\",\n justifyContent: \"center\",\n borderWidth: 1,\n opacity: isDisabled ? 0.5 : 1,\n };\n\n const variantStyle = (pressed: boolean): ViewStyle => {\n if (variant === \"solid\") {\n return { backgroundColor: pressed ? hover : main, borderColor: pressed ? hover : main };\n }\n if (variant === \"outline\") {\n return { borderColor: main, backgroundColor: pressed ? main : \"transparent\" };\n }\n return { borderColor: \"transparent\", backgroundColor: pressed ? `${main}1a` : \"transparent\" };\n };\n\n const iconColor = (pressed: boolean): string => {\n if (variant === \"solid\") return theme.surface;\n if (variant === \"outline\") return pressed ? theme.surface : main;\n return main;\n };\n\n return (\n <Pressable\n ref={ref}\n disabled={isDisabled}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled: !!isDisabled, busy: loading }}\n accessibilityLabel={accessibilityLabel}\n style={({ pressed }) => [baseStyle, variantStyle(pressed), style]}\n {...rest}\n >\n {({ pressed }) =>\n loading ? (\n <ActivityIndicator size=\"small\" color={variant === \"solid\" ? theme.surface : main} />\n ) : (\n <View style={{ tintColor: iconColor(pressed) } as ViewStyle}>\n {children}\n </View>\n )\n }\n </Pressable>\n );\n});\n","import React, { forwardRef, useState } from \"react\";\nimport {\n TextInput as RNTextInput,\n Text,\n View,\n type TextInputProps as RNTextInputProps,\n type StyleProp,\n type ViewStyle,\n} from \"react-native\";\nimport { useRehagroTheme } from \"../../provider/RehagroNativeContext\";\n\nexport type TextInputStatus = \"default\" | \"error\";\nexport type TextInputSize = \"sm\" | \"md\" | \"lg\";\nexport type TextInputRadius = \"none\" | \"xxs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n\nexport type TextInputProps = Omit<RNTextInputProps, \"style\"> & {\n /** Label text displayed above the input */\n label?: string;\n /** Subtitle displayed next to the label */\n subtitle?: string;\n /** Validation status */\n status?: TextInputStatus;\n /** Input size */\n size?: TextInputSize;\n /** Border radius */\n radius?: TextInputRadius;\n /** Icon rendered to the left of the input */\n leftIcon?: React.ReactNode;\n /** Icon rendered to the right of the input */\n rightIcon?: React.ReactNode;\n /** Helper/error message displayed below the input */\n helperText?: React.ReactNode;\n /** Custom style for the outermost wrapper */\n wrapperStyle?: StyleProp<ViewStyle>;\n /** Custom style for the input container */\n style?: StyleProp<ViewStyle>;\n};\n\nexport const TextInput = forwardRef<RNTextInput, TextInputProps>(function TextInput(\n {\n label,\n subtitle,\n status = \"default\",\n size = \"md\",\n radius = \"xs\",\n leftIcon,\n rightIcon,\n helperText,\n editable = true,\n wrapperStyle,\n style,\n accessibilityLabel,\n ...rest\n },\n ref,\n) {\n const theme = useRehagroTheme();\n const [focused, setFocused] = useState(false);\n\n const isDisabled = editable === false;\n\n const heightMap: Record<TextInputSize, number> = {\n sm: theme.inputHeightSm,\n md: theme.inputHeightMd,\n lg: theme.inputHeightLg,\n };\n\n const paddingMap: Record<TextInputSize, number> = {\n sm: 12,\n md: 14,\n lg: 16,\n };\n\n const fontSizeMap: Record<TextInputSize, number> = {\n sm: 14,\n md: 14,\n lg: 16,\n };\n\n const radiusMap: Record<TextInputRadius, number> = {\n none: 0,\n xxs: theme.radiusXxs,\n xs: theme.radiusXs,\n sm: theme.radiusSm,\n md: theme.radiusMd,\n lg: theme.radiusLg,\n xl: theme.radiusXl,\n full: 9999,\n };\n\n const borderColor =\n status === \"error\"\n ? theme.danger\n : focused\n ? theme.primary\n : theme.border;\n\n const containerStyle: ViewStyle = {\n height: heightMap[size],\n paddingHorizontal: paddingMap[size],\n borderRadius: radiusMap[radius],\n borderWidth: theme.borderWidthSm,\n borderColor,\n backgroundColor: isDisabled ? theme.background : theme.surface,\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: 8,\n opacity: isDisabled ? 0.5 : 1,\n };\n\n const inputId = accessibilityLabel ?? label;\n\n return (\n <View style={[{ gap: 4 }, wrapperStyle]}>\n {/* Label + Subtitle */}\n {label && (\n <View style={{ flexDirection: \"row\", alignItems: \"baseline\", gap: 4 }}>\n <Text style={{ fontSize: 14, fontWeight: \"500\", color: theme.text }}>\n {label}\n </Text>\n {subtitle && (\n <Text style={{ fontSize: 14, color: theme.textMuted }}>{subtitle}</Text>\n )}\n </View>\n )}\n\n {/* Input container */}\n <View style={[containerStyle, style]}>\n {leftIcon && (\n <View accessibilityElementsHidden style={{ width: fontSizeMap[size], height: fontSizeMap[size] }}>\n {leftIcon}\n </View>\n )}\n\n <RNTextInput\n ref={ref}\n editable={editable}\n accessibilityLabel={inputId}\n accessibilityState={{ disabled: isDisabled }}\n aria-invalid={status === \"error\"}\n onFocus={(e) => {\n setFocused(true);\n rest.onFocus?.(e);\n }}\n onBlur={(e) => {\n setFocused(false);\n rest.onBlur?.(e);\n }}\n style={{\n flex: 1,\n fontSize: fontSizeMap[size],\n color: theme.text,\n }}\n placeholderTextColor={theme.textMuted}\n {...rest}\n />\n\n {rightIcon && (\n <View accessibilityElementsHidden style={{ width: fontSizeMap[size], height: fontSizeMap[size] }}>\n {rightIcon}\n </View>\n )}\n </View>\n\n {/* Helper text */}\n {helperText && (\n <Text\n style={{\n fontSize: 12,\n color: status === \"error\" ? theme.danger : theme.textMuted,\n }}\n >\n {helperText}\n </Text>\n )}\n </View>\n );\n});\n","import React, { forwardRef, useCallback, useState } from \"react\";\nimport {\n Pressable,\n Text,\n View,\n type PressableProps,\n type StyleProp,\n type ViewStyle,\n} from \"react-native\";\nimport { useRehagroTheme } from \"../../provider/RehagroNativeContext\";\n\nexport type CheckboxSize = \"sm\" | \"md\" | \"lg\";\n\nexport type CheckboxProps = Omit<PressableProps, \"style\" | \"onPress\"> & {\n /** Checkbox size */\n size?: CheckboxSize;\n /** Label text displayed next to the checkbox */\n label?: string;\n /** Controlled checked state */\n checked?: boolean;\n /** Default checked state (uncontrolled) */\n defaultChecked?: boolean;\n /** Indeterminate state (partially checked) */\n indeterminate?: boolean;\n /** Callback fired when the value changes */\n onChange?: (checked: boolean) => void;\n /** Custom style for the outer wrapper */\n style?: StyleProp<ViewStyle>;\n};\n\nconst CheckIcon = ({ size, color }: { size: number; color: string }) => (\n <View\n style={{\n width: size,\n height: size,\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n {/* Simple checkmark drawn with two Views rotated — no SVG dep needed */}\n <View\n style={{\n position: \"absolute\",\n width: size * 0.55,\n height: size * 0.3,\n borderLeftWidth: 2,\n borderBottomWidth: 2,\n borderColor: color,\n transform: [{ rotate: \"-45deg\" }, { translateY: -size * 0.05 }],\n }}\n />\n </View>\n);\n\nconst MinusIcon = ({ size, color }: { size: number; color: string }) => (\n <View\n style={{\n width: size * 0.7,\n height: 2,\n backgroundColor: color,\n }}\n />\n);\n\nexport const Checkbox = forwardRef<View, CheckboxProps>(function Checkbox(\n {\n size = \"md\",\n label,\n checked: controlledChecked,\n defaultChecked = false,\n indeterminate = false,\n disabled,\n onChange,\n style,\n accessibilityLabel,\n ...rest\n },\n ref,\n) {\n const theme = useRehagroTheme();\n const isControlled = controlledChecked !== undefined;\n const [internalChecked, setInternalChecked] = useState(defaultChecked);\n\n const isChecked = isControlled ? controlledChecked : internalChecked;\n const isActive = isChecked || indeterminate;\n\n const handlePress = useCallback(() => {\n if (disabled) return;\n const next = !isChecked;\n if (!isControlled) setInternalChecked(next);\n onChange?.(next);\n }, [disabled, isChecked, isControlled, onChange]);\n\n const boxSizeMap: Record<CheckboxSize, number> = {\n sm: 16,\n md: 20,\n lg: 24,\n };\n\n const iconSizeMap: Record<CheckboxSize, number> = {\n sm: 10,\n md: 12,\n lg: 14,\n };\n\n const fontSizeMap: Record<CheckboxSize, number> = {\n sm: 14,\n md: 14,\n lg: 16,\n };\n\n const boxSize = boxSizeMap[size];\n const iconSize = iconSizeMap[size];\n\n const boxStyle: ViewStyle = {\n width: boxSize,\n height: boxSize,\n borderRadius: theme.radiusXxs,\n borderWidth: theme.borderWidthSm,\n borderColor: isActive ? theme.primary : theme.border,\n backgroundColor: isActive ? theme.primary : theme.surface,\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n\n return (\n <Pressable\n ref={ref}\n onPress={handlePress}\n disabled={disabled}\n accessibilityRole=\"checkbox\"\n accessibilityState={{ checked: indeterminate ? \"mixed\" : isChecked, disabled: !!disabled }}\n accessibilityLabel={accessibilityLabel ?? label}\n style={[{ flexDirection: \"row\", alignItems: \"center\", gap: 8, opacity: disabled ? 0.5 : 1 }, style]}\n {...rest}\n >\n <View style={boxStyle}>\n {indeterminate ? (\n <MinusIcon size={iconSize} color={theme.surface} />\n ) : isChecked ? (\n <CheckIcon size={iconSize} color={theme.surface} />\n ) : null}\n </View>\n\n {label && (\n <Text style={{ fontSize: fontSizeMap[size], color: theme.text }}>\n {label}\n </Text>\n )}\n </Pressable>\n );\n});\n","import React, { forwardRef, useState } from \"react\";\nimport { Image, Text, View, type StyleProp, type ViewStyle, type ViewProps } from \"react-native\";\nimport { useRehagroTheme } from \"../../provider/RehagroNativeContext\";\n\nexport type AvatarSize = \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type AvatarVariant = \"circle\" | \"square\";\n\nexport type AvatarProps = Omit<ViewProps, \"style\"> & {\n /** Image source URL */\n src?: string;\n /** Alt text (used as accessibility label and initials fallback) */\n alt?: string;\n /** Fallback initials shown when image is unavailable */\n initials?: string;\n /** Avatar size */\n size?: AvatarSize;\n /** Shape variant */\n variant?: AvatarVariant;\n /** Custom style for the outer wrapper */\n style?: StyleProp<ViewStyle>;\n};\n\nexport const Avatar = forwardRef<View, AvatarProps>(function Avatar(\n { src, alt = \"\", initials, size = \"md\", variant = \"circle\", style, ...rest },\n ref,\n) {\n const theme = useRehagroTheme();\n const [imgError, setImgError] = useState(false);\n const showImage = !!src && !imgError;\n\n const fallbackLabel = initials\n ? initials.slice(0, 2).toUpperCase()\n : alt\n ? alt\n .split(\" \")\n .slice(0, 2)\n .map((w) => w[0])\n .join(\"\")\n .toUpperCase()\n : \"?\";\n\n const sizePxMap: Record<AvatarSize, number> = {\n sm: 32,\n md: 40,\n lg: 48,\n xl: 64,\n };\n\n const fontSizeMap: Record<AvatarSize, number> = {\n sm: 12,\n md: 14,\n lg: 18,\n xl: 20,\n };\n\n const boxSize = sizePxMap[size];\n const borderRadius = variant === \"circle\" ? boxSize / 2 : theme.radiusSm;\n\n const containerStyle: ViewStyle = {\n width: boxSize,\n height: boxSize,\n borderRadius,\n backgroundColor: theme.primary,\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n };\n\n return (\n <View\n ref={ref}\n accessible\n accessibilityRole=\"image\"\n accessibilityLabel={alt || initials || fallbackLabel}\n style={[containerStyle, style]}\n {...rest}\n >\n {showImage ? (\n <Image\n source={{ uri: src }}\n style={{ width: boxSize, height: boxSize, borderRadius }}\n onError={() => setImgError(true)}\n accessibilityLabel={alt}\n />\n ) : (\n <Text\n style={{\n fontSize: fontSizeMap[size],\n fontWeight: \"500\",\n color: theme.surface,\n }}\n accessibilityElementsHidden\n >\n {fallbackLabel}\n </Text>\n )}\n </View>\n );\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rehagro/ui",
3
- "version": "0.1.4",
3
+ "version": "1.0.0",
4
4
  "author": "Rehagro's Development Team",
5
5
  "description": "Rehagro Design System - React component library",
6
6
  "main": "./dist/index.cjs",
@@ -12,6 +12,11 @@
12
12
  "import": "./dist/index.js",
13
13
  "require": "./dist/index.cjs"
14
14
  },
15
+ "./native": {
16
+ "types": "./dist/native.d.ts",
17
+ "import": "./dist/native.js",
18
+ "require": "./dist/native.cjs"
19
+ },
15
20
  "./styles.css": "./dist/styles.css"
16
21
  },
17
22
  "files": [
@@ -22,34 +27,43 @@
22
27
  ],
23
28
  "peerDependencies": {
24
29
  "react": ">=18",
25
- "react-dom": ">=18"
30
+ "react-dom": ">=18",
31
+ "react-native": ">=0.73"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "react-dom": {
35
+ "optional": true
36
+ },
37
+ "react-native": {
38
+ "optional": true
39
+ }
26
40
  },
27
41
  "devDependencies": {
28
- "@storybook/react": "^10.2.13",
42
+ "@storybook/addon-docs": "^10.2.13",
29
43
  "@storybook/react-vite": "^10.2.13",
30
44
  "@testing-library/jest-dom": "^6.6.0",
31
45
  "@testing-library/react": "^16.1.0",
46
+ "@testing-library/user-event": "^14.5.0",
32
47
  "@types/react": "^18.3.0",
33
48
  "@types/react-dom": "^18.3.0",
34
- "@testing-library/user-event": "^14.5.0",
35
49
  "@typescript-eslint/eslint-plugin": "^8.0.0",
36
50
  "@typescript-eslint/parser": "^8.0.0",
37
51
  "autoprefixer": "^10.4.0",
38
52
  "eslint": "^8.57.0",
39
53
  "eslint-config-prettier": "^9.1.0",
40
54
  "eslint-plugin-react-hooks": "^5.0.0",
55
+ "eslint-plugin-storybook": "10.2.13",
41
56
  "jsdom": "^25.0.0",
42
57
  "postcss": "^8.4.0",
43
58
  "prettier": "^3.4.0",
44
59
  "react": "^18.3.0",
45
60
  "react-dom": "^18.3.0",
61
+ "react-native": "^0.76.0",
46
62
  "storybook": "^10.2.13",
47
63
  "tailwindcss": "^3.4.0",
48
64
  "tsup": "^8.3.0",
49
65
  "typescript": "^5.6.0",
50
- "vitest": "^2.1.0",
51
- "eslint-plugin-storybook": "10.2.13",
52
- "@storybook/addon-docs": "^10.2.13"
66
+ "vitest": "^2.1.0"
53
67
  },
54
68
  "scripts": {
55
69
  "build": "tsup && node scripts/add-use-client.mjs && tailwindcss -i src/styles/styles.css -o dist/styles.css --minify",