rn-feav-ui 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/components/AlertDialog/index.d.ts +11 -0
  2. package/dist/components/AlertDialog/index.js +54 -0
  3. package/dist/components/AspectRatio/index.d.ts +7 -0
  4. package/dist/components/AspectRatio/index.js +43 -0
  5. package/dist/components/Badge/index.d.ts +9 -2
  6. package/dist/components/Badge/index.js +24 -9
  7. package/dist/components/Breadcrumb/index.d.ts +11 -0
  8. package/dist/components/Breadcrumb/index.js +60 -0
  9. package/dist/components/Button/index.d.ts +10 -3
  10. package/dist/components/Button/index.js +63 -42
  11. package/dist/components/Calendar/index.d.ts +7 -0
  12. package/dist/components/Calendar/index.js +105 -0
  13. package/dist/components/Card/index.d.ts +7 -3
  14. package/dist/components/Card/index.js +16 -9
  15. package/dist/components/Carousel/index.d.ts +7 -0
  16. package/dist/components/Carousel/index.js +47 -0
  17. package/dist/components/Chart/index.d.ts +12 -0
  18. package/dist/components/Chart/index.js +75 -0
  19. package/dist/components/Checkbox/index.d.ts +9 -1
  20. package/dist/components/Checkbox/index.js +13 -9
  21. package/dist/components/Collapsible/index.d.ts +15 -0
  22. package/dist/components/Collapsible/index.js +73 -0
  23. package/dist/components/Combobox/index.d.ts +13 -0
  24. package/dist/components/Combobox/index.js +107 -0
  25. package/dist/components/Command/index.d.ts +16 -0
  26. package/dist/components/Command/index.js +87 -0
  27. package/dist/components/ContextMenu/index.d.ts +6 -0
  28. package/dist/components/ContextMenu/index.js +45 -0
  29. package/dist/components/DataTable/index.d.ts +16 -0
  30. package/dist/components/DataTable/index.js +72 -0
  31. package/dist/components/DatePicker/index.d.ts +9 -0
  32. package/dist/components/DatePicker/index.js +83 -0
  33. package/dist/components/Drawer/index.d.ts +9 -0
  34. package/dist/components/Drawer/index.js +70 -0
  35. package/dist/components/DropdownMenu/index.d.ts +15 -0
  36. package/dist/components/DropdownMenu/index.js +80 -0
  37. package/dist/components/Empty/index.d.ts +7 -0
  38. package/dist/components/Empty/index.js +63 -0
  39. package/dist/components/Field/index.d.ts +9 -0
  40. package/dist/components/Field/index.js +54 -0
  41. package/dist/components/Input/index.d.ts +5 -6
  42. package/dist/components/Input/index.js +26 -3
  43. package/dist/components/InputGroup/index.d.ts +6 -0
  44. package/dist/components/InputGroup/index.js +59 -0
  45. package/dist/components/InputOTP/index.d.ts +8 -0
  46. package/dist/components/InputOTP/index.js +79 -0
  47. package/dist/components/Kbd/index.d.ts +6 -0
  48. package/dist/components/Kbd/index.js +62 -0
  49. package/dist/components/Label/index.d.ts +8 -1
  50. package/dist/components/Label/index.js +8 -2
  51. package/dist/components/Menubar/index.d.ts +11 -0
  52. package/dist/components/Menubar/index.js +69 -0
  53. package/dist/components/NativeSelect/index.d.ts +21 -0
  54. package/dist/components/NativeSelect/index.js +76 -0
  55. package/dist/components/NavigationMenu/index.d.ts +13 -0
  56. package/dist/components/NavigationMenu/index.js +81 -0
  57. package/dist/components/Pagination/index.d.ts +9 -0
  58. package/dist/components/Pagination/index.js +101 -0
  59. package/dist/components/Popover/index.d.ts +9 -0
  60. package/dist/components/Popover/index.js +69 -0
  61. package/dist/components/RadioGroup/index.d.ts +13 -0
  62. package/dist/components/RadioGroup/index.js +66 -0
  63. package/dist/components/Resizable/index.d.ts +8 -0
  64. package/dist/components/Resizable/index.js +45 -0
  65. package/dist/components/ScrollArea/index.d.ts +6 -0
  66. package/dist/components/ScrollArea/index.js +65 -0
  67. package/dist/components/Sheet/index.d.ts +8 -0
  68. package/dist/components/Sheet/index.js +65 -0
  69. package/dist/components/Sidebar/index.d.ts +17 -0
  70. package/dist/components/Sidebar/index.js +81 -0
  71. package/dist/components/Slider/index.d.ts +10 -0
  72. package/dist/components/Slider/index.js +104 -0
  73. package/dist/components/Sonner/index.d.ts +16 -0
  74. package/dist/components/Sonner/index.js +97 -0
  75. package/dist/components/Spinner/index.d.ts +6 -0
  76. package/dist/components/Spinner/index.js +46 -0
  77. package/dist/components/Switch/index.d.ts +9 -2
  78. package/dist/components/Switch/index.js +10 -4
  79. package/dist/components/Table/index.d.ts +20 -0
  80. package/dist/components/Table/index.js +91 -0
  81. package/dist/components/Textarea/index.d.ts +5 -5
  82. package/dist/components/Textarea/index.js +26 -3
  83. package/dist/components/Toggle/index.d.ts +9 -0
  84. package/dist/components/Toggle/index.js +68 -0
  85. package/dist/components/ToggleGroup/index.d.ts +13 -0
  86. package/dist/components/ToggleGroup/index.js +68 -0
  87. package/dist/components/Tooltip/index.d.ts +9 -0
  88. package/dist/components/Tooltip/index.js +77 -0
  89. package/dist/components/Typography/index.d.ts +8 -1
  90. package/dist/components/Typography/index.js +2 -2
  91. package/dist/components/index.d.ts +36 -0
  92. package/dist/components/index.js +36 -0
  93. package/dist/examples/Showcase.js +197 -58
  94. package/dist/index.d.ts +2 -0
  95. package/dist/index.js +5 -0
  96. package/package.json +1 -1
  97. package/readme.md +615 -29
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ export declare const AlertDialogFEA: ({ open, onOpenChange, title, description, cancelText, actionText, destructive, onAction, }: {
3
+ open: boolean;
4
+ onOpenChange: (next: boolean) => void;
5
+ title: string;
6
+ description?: string;
7
+ cancelText?: string;
8
+ actionText?: string;
9
+ destructive?: boolean;
10
+ onAction?: () => void;
11
+ }) => React.JSX.Element;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AlertDialogFEA = void 0;
37
+ var React = __importStar(require("react"));
38
+ var Dialog_1 = require("../Dialog");
39
+ var Button_1 = require("../Button");
40
+ var Typography_1 = require("../Typography");
41
+ var AlertDialogFEA = function (_a) {
42
+ var open = _a.open, onOpenChange = _a.onOpenChange, title = _a.title, description = _a.description, _b = _a.cancelText, cancelText = _b === void 0 ? "Cancel" : _b, _c = _a.actionText, actionText = _c === void 0 ? "Continue" : _c, _d = _a.destructive, destructive = _d === void 0 ? false : _d, onAction = _a.onAction;
43
+ return (React.createElement(Dialog_1.DialogFEA, { open: open, onOpenChange: onOpenChange },
44
+ React.createElement(Dialog_1.DialogHeaderFEA, null,
45
+ React.createElement(Typography_1.TypographyFEA, { variant: "h3" }, title),
46
+ description ? React.createElement(Typography_1.TypographyFEA, { variant: "muted" }, description) : null),
47
+ React.createElement(Dialog_1.DialogFooterFEA, null,
48
+ React.createElement(Button_1.ButtonFEA, { title: cancelText, variant: "ghost", onPress: function () { return onOpenChange(false); } }),
49
+ React.createElement(Button_1.ButtonFEA, { title: actionText, onPress: function () {
50
+ onAction === null || onAction === void 0 ? void 0 : onAction();
51
+ onOpenChange(false);
52
+ }, variant: destructive ? "soft" : "primary" }))));
53
+ };
54
+ exports.AlertDialogFEA = AlertDialogFEA;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ export declare const AspectRatioFEA: ({ ratio, children, style, }: {
4
+ ratio?: number;
5
+ children: React.ReactNode;
6
+ style?: StyleProp<ViewStyle>;
7
+ }) => React.JSX.Element;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AspectRatioFEA = void 0;
37
+ var React = __importStar(require("react"));
38
+ var react_native_1 = require("react-native");
39
+ var AspectRatioFEA = function (_a) {
40
+ var _b = _a.ratio, ratio = _b === void 0 ? 1 : _b, children = _a.children, style = _a.style;
41
+ return React.createElement(react_native_1.View, { style: [{ width: "100%", aspectRatio: ratio }, style] }, children);
42
+ };
43
+ exports.AspectRatioFEA = AspectRatioFEA;
@@ -1,8 +1,15 @@
1
1
  import * as React from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
2
+ import { StyleProp, TextStyle, ViewStyle } from "react-native";
3
3
  type BadgeProps = {
4
4
  label: string;
5
+ /** Optional leading icon or dot. */
6
+ leftIcon?: React.ReactNode;
5
7
  style?: StyleProp<ViewStyle>;
8
+ textStyle?: StyleProp<TextStyle>;
9
+ testID?: string;
10
+ accessibilityLabel?: string;
11
+ /** If set, badge is tappable. */
12
+ onPress?: () => void;
6
13
  };
7
- export declare const BadgeFEA: ({ label, style }: BadgeProps) => React.JSX.Element;
14
+ export declare const BadgeFEA: ({ label, leftIcon, style, textStyle, testID, accessibilityLabel, onPress, }: BadgeProps) => React.JSX.Element;
8
15
  export {};
@@ -38,23 +38,38 @@ var ThemeFEAVUiProvider_1 = require("../../theme/ThemeFEAVUiProvider");
38
38
  var React = __importStar(require("react"));
39
39
  var react_native_1 = require("react-native");
40
40
  var BadgeFEA = function (_a) {
41
- var label = _a.label, _b = _a.style, style = _b === void 0 ? {} : _b;
41
+ var label = _a.label, leftIcon = _a.leftIcon, _b = _a.style, style = _b === void 0 ? {} : _b, textStyle = _a.textStyle, testID = _a.testID, accessibilityLabel = _a.accessibilityLabel, onPress = _a.onPress;
42
42
  var theme = (0, ThemeFEAVUiProvider_1.useTheme)().theme;
43
- return (React.createElement(react_native_1.View, { style: [
44
- styles.badge,
45
- {
46
- backgroundColor: theme.colors.secondary,
47
- borderColor: theme.colors.border,
48
- },
49
- style,
50
- ] },
43
+ var body = (React.createElement(React.Fragment, null,
44
+ leftIcon,
51
45
  React.createElement(react_native_1.Text, { style: [
52
46
  styles.label,
53
47
  { color: theme.colors.secondaryForeground },
48
+ textStyle,
54
49
  ] }, label)));
50
+ var shellStyle = [
51
+ styles.badge,
52
+ {
53
+ backgroundColor: theme.colors.secondary,
54
+ borderColor: theme.colors.border,
55
+ },
56
+ style,
57
+ ];
58
+ if (onPress) {
59
+ return (React.createElement(react_native_1.Pressable, { testID: testID, accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : label, accessibilityRole: "button", onPress: onPress, style: function (_a) {
60
+ var pressed = _a.pressed;
61
+ return [shellStyle, styles.row, pressed && { opacity: 0.85 }];
62
+ } }, body));
63
+ }
64
+ return (React.createElement(react_native_1.View, { testID: testID, accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : label, style: [shellStyle, styles.row] }, body));
55
65
  };
56
66
  exports.BadgeFEA = BadgeFEA;
57
67
  var styles = react_native_1.StyleSheet.create({
68
+ row: {
69
+ flexDirection: "row",
70
+ alignItems: "center",
71
+ gap: 6,
72
+ },
58
73
  badge: {
59
74
  paddingHorizontal: 10,
60
75
  paddingVertical: 4,
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ export type BreadcrumbItemFEA = {
4
+ label: string;
5
+ onPress?: () => void;
6
+ };
7
+ export declare const BreadcrumbFEA: ({ items, separator, style, }: {
8
+ items: BreadcrumbItemFEA[];
9
+ separator?: string;
10
+ style?: StyleProp<ViewStyle>;
11
+ }) => React.JSX.Element;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BreadcrumbFEA = void 0;
37
+ var React = __importStar(require("react"));
38
+ var react_native_1 = require("react-native");
39
+ var ThemeFEAVUiProvider_1 = require("../../theme/ThemeFEAVUiProvider");
40
+ var BreadcrumbFEA = function (_a) {
41
+ var items = _a.items, _b = _a.separator, separator = _b === void 0 ? "/" : _b, style = _a.style;
42
+ var theme = (0, ThemeFEAVUiProvider_1.useTheme)().theme;
43
+ return (React.createElement(react_native_1.View, { style: [styles.row, style] }, items.map(function (it, idx) {
44
+ var last = idx === items.length - 1;
45
+ var content = (React.createElement(react_native_1.Text, { style: {
46
+ color: last ? theme.colors.foreground : theme.colors.mutedForeground,
47
+ fontWeight: last ? "600" : "500",
48
+ } }, it.label));
49
+ return (React.createElement(React.Fragment, { key: "".concat(it.label, "-").concat(idx) },
50
+ it.onPress && !last ? (React.createElement(react_native_1.Pressable, { onPress: it.onPress }, content)) : (content),
51
+ !last ? React.createElement(react_native_1.Text, { style: { color: theme.colors.mutedForeground } },
52
+ " ",
53
+ separator,
54
+ " ") : null));
55
+ })));
56
+ };
57
+ exports.BreadcrumbFEA = BreadcrumbFEA;
58
+ var styles = react_native_1.StyleSheet.create({
59
+ row: { flexDirection: "row", alignItems: "center", flexWrap: "wrap" },
60
+ });
@@ -1,14 +1,21 @@
1
1
  import * as React from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
2
+ import { StyleProp, TextStyle, TouchableOpacityProps, ViewStyle } from "react-native";
3
3
  type ButtonVariant = "primary" | "glass" | "soft" | "outline" | "ghost";
4
4
  type ButtonSize = "default" | "sm" | "lg";
5
+ type TouchablePassthrough = Pick<TouchableOpacityProps, "testID" | "accessibilityLabel" | "accessibilityHint" | "accessibilityRole" | "accessibilityState" | "hitSlop" | "delayLongPress" | "activeOpacity">;
5
6
  type ButtonProps = {
6
7
  title: string;
7
8
  variant?: ButtonVariant;
8
9
  size?: ButtonSize;
9
10
  onPress: () => void;
10
11
  disabled?: boolean;
12
+ loading?: boolean;
13
+ leftIcon?: React.ReactNode;
14
+ rightIcon?: React.ReactNode;
15
+ /** Stretch to parent width (common for forms). */
16
+ fullWidth?: boolean;
11
17
  style?: StyleProp<ViewStyle>;
12
- };
13
- export declare const ButtonFEA: ({ title, variant, size, onPress, disabled, style, }: ButtonProps) => React.JSX.Element;
18
+ textStyle?: StyleProp<TextStyle>;
19
+ } & TouchablePassthrough;
20
+ export declare const ButtonFEA: ({ title, variant, size, onPress, disabled, loading, leftIcon, rightIcon, fullWidth, style, textStyle, testID, accessibilityLabel, accessibilityHint, accessibilityRole, accessibilityState, hitSlop, delayLongPress, activeOpacity, }: ButtonProps) => React.JSX.Element;
14
21
  export {};
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -39,85 +50,95 @@ var ThemeFEAVUiProvider_1 = require("../../theme/ThemeFEAVUiProvider");
39
50
  var react_native_1 = require("react-native");
40
51
  var GlassCard_1 = require("../GlassCard");
41
52
  var ButtonFEA = function (_a) {
42
- var title = _a.title, _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "default" : _c, onPress = _a.onPress, _d = _a.disabled, disabled = _d === void 0 ? false : _d, style = _a.style;
53
+ var title = _a.title, _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "default" : _c, onPress = _a.onPress, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.loading, loading = _e === void 0 ? false : _e, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, _f = _a.fullWidth, fullWidth = _f === void 0 ? false : _f, style = _a.style, textStyle = _a.textStyle, testID = _a.testID, accessibilityLabel = _a.accessibilityLabel, accessibilityHint = _a.accessibilityHint, _g = _a.accessibilityRole, accessibilityRole = _g === void 0 ? "button" : _g, accessibilityState = _a.accessibilityState, hitSlop = _a.hitSlop, delayLongPress = _a.delayLongPress, activeOpacity = _a.activeOpacity;
43
54
  var theme = (0, ThemeFEAVUiProvider_1.useTheme)().theme;
44
55
  var sizeStyle = size === "sm"
45
56
  ? styles.sizeSm
46
57
  : size === "lg"
47
58
  ? styles.sizeLg
48
59
  : styles.sizeDefault;
60
+ var inactive = disabled || loading;
61
+ var touchableProps = {
62
+ testID: testID,
63
+ accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : title,
64
+ accessibilityHint: accessibilityHint,
65
+ accessibilityRole: accessibilityRole,
66
+ accessibilityState: __assign({ disabled: inactive }, accessibilityState),
67
+ hitSlop: hitSlop,
68
+ delayLongPress: delayLongPress,
69
+ activeOpacity: activeOpacity !== null && activeOpacity !== void 0 ? activeOpacity : (variant === "glass" ? 0.85 : 0.9),
70
+ onPress: onPress,
71
+ disabled: inactive,
72
+ };
73
+ var widthStyle = fullWidth ? { alignSelf: "stretch", width: "100%" } : undefined;
74
+ var renderLabel = function (color, opacity) { return (React.createElement(react_native_1.View, { style: styles.contentRow },
75
+ loading ? (React.createElement(react_native_1.ActivityIndicator, { size: "small", color: color })) : (leftIcon),
76
+ React.createElement(react_native_1.Text, { style: [styles.text, { color: color, opacity: opacity }, textStyle] }, title),
77
+ !loading ? rightIcon : null)); };
49
78
  if (variant === "glass") {
50
- return (React.createElement(GlassCard_1.GlassCardFEA, { style: [styles.glassCard, style] },
51
- React.createElement(react_native_1.TouchableOpacity, { onPress: onPress, activeOpacity: 0.85, style: [styles.baseButton, sizeStyle], disabled: disabled },
52
- React.createElement(react_native_1.Text, { style: [
53
- styles.text,
54
- { color: theme.colors.foreground, opacity: disabled ? 0.5 : 1 },
55
- ] }, title))));
79
+ return (React.createElement(GlassCard_1.GlassCardFEA, { style: [styles.glassCard, widthStyle, style] },
80
+ React.createElement(react_native_1.TouchableOpacity, __assign({}, touchableProps, { style: [styles.baseButton, sizeStyle] }), renderLabel(theme.colors.foreground, inactive ? 0.5 : 1))));
56
81
  }
57
82
  if (variant === "soft") {
58
- return (React.createElement(react_native_1.TouchableOpacity, { onPress: onPress, activeOpacity: 0.9, disabled: disabled, style: [
83
+ return (React.createElement(react_native_1.TouchableOpacity, __assign({}, touchableProps, { style: [
59
84
  styles.baseButton,
60
85
  sizeStyle,
61
86
  styles.softButton,
62
87
  { backgroundColor: theme.colors.secondary, borderColor: theme.colors.border },
63
- disabled && styles.disabled,
88
+ inactive && styles.disabled,
89
+ widthStyle,
64
90
  style,
65
- ] },
66
- React.createElement(react_native_1.Text, { style: [
67
- styles.text,
68
- { color: theme.colors.secondaryForeground, opacity: disabled ? 0.6 : 1 },
69
- ] }, title)));
91
+ ] }), renderLabel(theme.colors.secondaryForeground, inactive ? 0.6 : 1)));
70
92
  }
71
93
  if (variant === "outline") {
72
- return (React.createElement(react_native_1.TouchableOpacity, { onPress: onPress, activeOpacity: 0.9, disabled: disabled, style: [
94
+ return (React.createElement(react_native_1.TouchableOpacity, __assign({}, touchableProps, { style: [
73
95
  styles.baseButton,
74
96
  sizeStyle,
75
97
  styles.outlineButton,
76
98
  {
77
99
  borderColor: theme.colors.border,
78
100
  },
79
- disabled && styles.disabled,
101
+ inactive && styles.disabled,
102
+ widthStyle,
80
103
  style,
81
- ] },
82
- React.createElement(react_native_1.Text, { style: [
83
- styles.text,
84
- {
85
- color: theme.colors.foreground,
86
- opacity: disabled ? 0.6 : 1,
87
- },
88
- ] }, title)));
104
+ ] }), renderLabel(theme.colors.foreground, inactive ? 0.6 : 1)));
89
105
  }
90
106
  if (variant === "ghost") {
91
- return (React.createElement(react_native_1.TouchableOpacity, { onPress: onPress, activeOpacity: 0.9, disabled: disabled, style: [
107
+ return (React.createElement(react_native_1.TouchableOpacity, __assign({}, touchableProps, { style: [
92
108
  styles.baseButton,
93
109
  sizeStyle,
94
110
  styles.ghostButton,
95
- disabled && styles.disabledGhost,
111
+ inactive && styles.disabledGhost,
112
+ widthStyle,
96
113
  style,
97
- ] },
98
- React.createElement(react_native_1.Text, { style: [
99
- styles.text,
100
- {
101
- color: theme.colors.foreground,
102
- opacity: disabled ? 0.5 : 1,
103
- },
104
- ] }, title)));
114
+ ] }), renderLabel(theme.colors.foreground, inactive ? 0.5 : 1)));
105
115
  }
106
- return (React.createElement(react_native_1.TouchableOpacity, { onPress: onPress, activeOpacity: 0.9, disabled: disabled, style: [
116
+ return (React.createElement(react_native_1.TouchableOpacity, __assign({}, touchableProps, { style: [
107
117
  styles.baseButton,
108
118
  sizeStyle,
109
119
  { backgroundColor: theme.colors.primary },
110
- disabled && { opacity: 0.7 },
120
+ inactive && { opacity: 0.7 },
121
+ widthStyle,
111
122
  style,
112
- ] },
113
- React.createElement(react_native_1.Text, { style: [
114
- styles.text,
115
- { color: theme.colors.primaryForeground },
116
- disabled && { opacity: 0.8 },
117
- ] }, title)));
123
+ ] }),
124
+ React.createElement(react_native_1.View, { style: styles.contentRow },
125
+ loading ? (React.createElement(react_native_1.ActivityIndicator, { size: "small", color: theme.colors.primaryForeground })) : (leftIcon),
126
+ React.createElement(react_native_1.Text, { style: [
127
+ styles.text,
128
+ { color: theme.colors.primaryForeground },
129
+ inactive && { opacity: 0.8 },
130
+ textStyle,
131
+ ] }, title),
132
+ !loading ? rightIcon : null)));
118
133
  };
119
134
  exports.ButtonFEA = ButtonFEA;
120
135
  var styles = react_native_1.StyleSheet.create({
136
+ contentRow: {
137
+ flexDirection: "row",
138
+ alignItems: "center",
139
+ justifyContent: "center",
140
+ gap: 8,
141
+ },
121
142
  baseButton: {
122
143
  borderRadius: 999,
123
144
  justifyContent: "center",
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ export declare const CalendarFEA: ({ value, onChange, style, }: {
4
+ value?: Date;
5
+ onChange?: (next: Date) => void;
6
+ style?: StyleProp<ViewStyle>;
7
+ }) => React.JSX.Element;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.CalendarFEA = void 0;
37
+ var React = __importStar(require("react"));
38
+ var react_native_1 = require("react-native");
39
+ var ThemeFEAVUiProvider_1 = require("../../theme/ThemeFEAVUiProvider");
40
+ var Button_1 = require("../Button");
41
+ var startOfMonth = function (d) { return new Date(d.getFullYear(), d.getMonth(), 1); };
42
+ var endOfMonth = function (d) { return new Date(d.getFullYear(), d.getMonth() + 1, 0); };
43
+ var addMonths = function (d, delta) { return new Date(d.getFullYear(), d.getMonth() + delta, 1); };
44
+ var sameDay = function (a, b) {
45
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
46
+ };
47
+ var CalendarFEA = function (_a) {
48
+ var value = _a.value, onChange = _a.onChange, style = _a.style;
49
+ var theme = (0, ThemeFEAVUiProvider_1.useTheme)().theme;
50
+ var _b = React.useState(function () { return value !== null && value !== void 0 ? value : new Date(); }), cursor = _b[0], setCursor = _b[1];
51
+ var selected = value;
52
+ var first = startOfMonth(cursor);
53
+ var last = endOfMonth(cursor);
54
+ var startWeekday = (first.getDay() + 6) % 7; // Monday=0
55
+ var daysInMonth = last.getDate();
56
+ var cells = [];
57
+ for (var i = 0; i < startWeekday; i++)
58
+ cells.push({});
59
+ for (var d = 1; d <= daysInMonth; d++)
60
+ cells.push({ day: d });
61
+ while (cells.length % 7 !== 0)
62
+ cells.push({});
63
+ var monthLabel = "".concat(cursor.getFullYear(), "-").concat(String(cursor.getMonth() + 1).padStart(2, "0"));
64
+ return (React.createElement(react_native_1.View, { style: [styles.wrap, { borderColor: theme.colors.border, backgroundColor: theme.colors.card }, style] },
65
+ React.createElement(react_native_1.View, { style: styles.header },
66
+ React.createElement(Button_1.ButtonFEA, { title: "\u2039", variant: "ghost", onPress: function () { return setCursor(function (d) { return addMonths(d, -1); }); } }),
67
+ React.createElement(react_native_1.Text, { style: { color: theme.colors.foreground, fontWeight: "700" } }, monthLabel),
68
+ React.createElement(Button_1.ButtonFEA, { title: "\u203A", variant: "ghost", onPress: function () { return setCursor(function (d) { return addMonths(d, 1); }); } })),
69
+ React.createElement(react_native_1.View, { style: styles.weekRow }, ["M", "T", "W", "T", "F", "S", "S"].map(function (w) { return (React.createElement(react_native_1.Text, { key: w, style: [styles.weekday, { color: theme.colors.mutedForeground }] }, w)); })),
70
+ React.createElement(react_native_1.View, { style: styles.grid }, cells.map(function (c, idx) {
71
+ if (!c.day)
72
+ return React.createElement(react_native_1.View, { key: idx, style: styles.cell });
73
+ var date = new Date(cursor.getFullYear(), cursor.getMonth(), c.day);
74
+ var isSelected = selected ? sameDay(selected, date) : false;
75
+ return (React.createElement(react_native_1.Pressable, { key: idx, onPress: function () { return onChange === null || onChange === void 0 ? void 0 : onChange(date); }, style: function (_a) {
76
+ var pressed = _a.pressed;
77
+ return [
78
+ styles.cell,
79
+ styles.dayCell,
80
+ {
81
+ backgroundColor: isSelected
82
+ ? theme.colors.primary
83
+ : pressed
84
+ ? theme.colors.muted
85
+ : "transparent",
86
+ borderColor: isSelected ? theme.colors.primary : "transparent",
87
+ },
88
+ ];
89
+ } },
90
+ React.createElement(react_native_1.Text, { style: {
91
+ color: isSelected ? theme.colors.primaryForeground : theme.colors.foreground,
92
+ fontWeight: isSelected ? "700" : "600",
93
+ } }, c.day)));
94
+ }))));
95
+ };
96
+ exports.CalendarFEA = CalendarFEA;
97
+ var styles = react_native_1.StyleSheet.create({
98
+ wrap: { borderWidth: 1, borderRadius: 12, padding: 12 },
99
+ header: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", marginBottom: 10 },
100
+ weekRow: { flexDirection: "row", marginBottom: 6 },
101
+ weekday: { flex: 1, textAlign: "center", fontSize: 12, fontWeight: "700" },
102
+ grid: { flexDirection: "row", flexWrap: "wrap" },
103
+ cell: { width: "".concat(100 / 7, "%"), aspectRatio: 1, alignItems: "center", justifyContent: "center" },
104
+ dayCell: { borderRadius: 10, borderWidth: 1 },
105
+ });
@@ -1,8 +1,12 @@
1
1
  import * as React from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
2
+ import { StyleProp, ViewProps, ViewStyle } from "react-native";
3
3
  type CardProps = {
4
4
  children: React.ReactNode;
5
5
  style?: StyleProp<ViewStyle>;
6
- };
7
- export declare const CardFEA: ({ children, style }: CardProps) => React.JSX.Element;
6
+ /** When set, the card is pressable (e.g. list row). */
7
+ onPress?: () => void;
8
+ /** Passed to the root `View` or `Pressable`. */
9
+ testID?: string;
10
+ } & Pick<ViewProps, "accessibilityLabel" | "accessibilityRole" | "accessibilityHint">;
11
+ export declare const CardFEA: ({ children, style, onPress, testID, accessibilityLabel, accessibilityRole, accessibilityHint, }: CardProps) => React.JSX.Element;
8
12
  export {};
@@ -38,16 +38,23 @@ var React = __importStar(require("react"));
38
38
  var react_native_1 = require("react-native");
39
39
  var ThemeFEAVUiProvider_1 = require("../../theme/ThemeFEAVUiProvider");
40
40
  var CardFEA = function (_a) {
41
- var children = _a.children, style = _a.style;
41
+ var children = _a.children, style = _a.style, onPress = _a.onPress, testID = _a.testID, accessibilityLabel = _a.accessibilityLabel, accessibilityRole = _a.accessibilityRole, accessibilityHint = _a.accessibilityHint;
42
42
  var theme = (0, ThemeFEAVUiProvider_1.useTheme)().theme;
43
- return (React.createElement(react_native_1.View, { style: [
44
- styles.card,
45
- {
46
- backgroundColor: theme.colors.card,
47
- borderColor: theme.colors.border,
48
- },
49
- style,
50
- ] }, children));
43
+ var cardStyle = [
44
+ styles.card,
45
+ {
46
+ backgroundColor: theme.colors.card,
47
+ borderColor: theme.colors.border,
48
+ },
49
+ style,
50
+ ];
51
+ if (onPress) {
52
+ return (React.createElement(react_native_1.Pressable, { onPress: onPress, testID: testID, accessibilityLabel: accessibilityLabel, accessibilityRole: accessibilityRole !== null && accessibilityRole !== void 0 ? accessibilityRole : "button", accessibilityHint: accessibilityHint, style: function (_a) {
53
+ var pressed = _a.pressed;
54
+ return [cardStyle, pressed && { opacity: 0.92 }];
55
+ } }, children));
56
+ }
57
+ return (React.createElement(react_native_1.View, { testID: testID, accessibilityLabel: accessibilityLabel, accessibilityRole: accessibilityRole, accessibilityHint: accessibilityHint, style: cardStyle }, children));
51
58
  };
52
59
  exports.CardFEA = CardFEA;
53
60
  var styles = react_native_1.StyleSheet.create({
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ export declare const CarouselFEA: ({ children, style, pageWidth, }: {
4
+ children: React.ReactNode[];
5
+ style?: StyleProp<ViewStyle>;
6
+ pageWidth?: number;
7
+ }) => React.JSX.Element;