atlas-design-system 1.2.0 → 1.3.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.
Files changed (152) hide show
  1. package/README.md +6 -0
  2. package/dist/components/Button/Button.d.ts +18 -0
  3. package/dist/components/Button/Button.js +73 -0
  4. package/dist/components/Button/index.js +23 -0
  5. package/dist/components/Button/styles/ButtonStyle.d.ts +38 -0
  6. package/dist/components/Button/styles/ButtonStyle.js +42 -0
  7. package/dist/components/DateTimeInput/index.d.ts +16 -0
  8. package/dist/components/DateTimeInput/index.js +146 -0
  9. package/dist/components/DragHandle/index.d.ts +7 -0
  10. package/dist/components/DragHandle/index.js +55 -0
  11. package/dist/components/MenuItemDescription/MenuItemDescription.d.ts +5 -0
  12. package/dist/components/MenuItemDescription/MenuItemDescription.js +48 -0
  13. package/dist/components/MenuItemDescription/index.js +17 -0
  14. package/dist/components/NavigationListRow/index.d.ts +9 -0
  15. package/dist/components/NavigationListRow/index.js +64 -0
  16. package/dist/components/SelectInput/SelectInput.d.ts +10 -0
  17. package/dist/components/SelectInput/SelectInput.js +157 -0
  18. package/dist/components/SelectInput/index.d.ts +2 -0
  19. package/dist/components/SelectInput/index.js +23 -0
  20. package/{src/components/SelectInput/types.ts → dist/components/SelectInput/types.d.ts} +1 -1
  21. package/dist/components/SelectInput/types.js +2 -0
  22. package/dist/components/Sheet/index.d.ts +14 -0
  23. package/dist/components/Sheet/index.js +135 -0
  24. package/dist/components/SwitchToggle/index.d.ts +12 -0
  25. package/dist/components/SwitchToggle/index.js +23 -0
  26. package/dist/components/Text/Text.d.ts +13 -0
  27. package/dist/components/Text/Text.js +92 -0
  28. package/{src/components/Text/index.tsx → dist/components/Text/index.d.ts} +1 -1
  29. package/dist/components/Text/index.js +23 -0
  30. package/dist/components/TextInput/TextInput.d.ts +23 -0
  31. package/dist/components/TextInput/TextInput.js +177 -0
  32. package/dist/components/TextInput/index.js +23 -0
  33. package/dist/components/TitleBar/TitleBar.d.ts +13 -0
  34. package/dist/components/TitleBar/TitleBar.js +127 -0
  35. package/dist/components/TitleBar/index.js +23 -0
  36. package/{src/components/index.ts → dist/components/index.d.ts} +1 -1
  37. package/dist/components/index.js +27 -0
  38. package/dist/context/index.d.ts +2 -0
  39. package/dist/context/index.js +6 -0
  40. package/dist/hooks/index.d.ts +2 -0
  41. package/dist/hooks/index.js +18 -0
  42. package/dist/hooks/useTheme.d.ts +2 -0
  43. package/dist/hooks/useTheme.js +8 -0
  44. package/dist/hooks/useThemedStyle.d.ts +7 -0
  45. package/dist/hooks/useThemedStyle.js +17 -0
  46. package/dist/index.d.ts +5 -0
  47. package/dist/index.js +21 -0
  48. package/dist/shared/styles/index.d.ts +27 -0
  49. package/dist/shared/styles/index.js +26 -0
  50. package/dist/themes/AtlasLightTheme.d.ts +2 -0
  51. package/dist/themes/AtlasLightTheme.js +89 -0
  52. package/dist/themes/index.d.ts +1 -0
  53. package/dist/themes/index.js +17 -0
  54. package/dist/types/index.d.ts +3 -0
  55. package/dist/types/index.js +19 -0
  56. package/dist/types/theme.d.ts +42 -0
  57. package/dist/types/theme.js +2 -0
  58. package/{src/types/typography.ts → dist/types/typography.d.ts} +5 -8
  59. package/dist/types/typography.js +2 -0
  60. package/package.json +13 -4
  61. package/.eslintrc.js +0 -33
  62. package/example/README.md +0 -50
  63. package/example/app/_layout.tsx +0 -32
  64. package/example/app/buttonGallery.tsx +0 -49
  65. package/example/app/dateTimeInputGallery.tsx +0 -28
  66. package/example/app/index.tsx +0 -58
  67. package/example/app/selectInputGallery.tsx +0 -45
  68. package/example/app/sheetGallery.tsx +0 -36
  69. package/example/app/switchToggleInputGallery.tsx +0 -28
  70. package/example/app/textGallery.tsx +0 -68
  71. package/example/app/textInputGallery.tsx +0 -28
  72. package/example/app.json +0 -37
  73. package/example/assets/fonts/SpaceMono-Regular.ttf +0 -0
  74. package/example/assets/images/adaptive-icon.png +0 -0
  75. package/example/assets/images/favicon.png +0 -0
  76. package/example/assets/images/icon.png +0 -0
  77. package/example/assets/images/partial-react-logo.png +0 -0
  78. package/example/assets/images/react-logo.png +0 -0
  79. package/example/assets/images/react-logo@2x.png +0 -0
  80. package/example/assets/images/react-logo@3x.png +0 -0
  81. package/example/assets/images/splash.png +0 -0
  82. package/example/babel.config.js +0 -6
  83. package/example/components/Collapsible.tsx +0 -41
  84. package/example/components/ExternalLink.tsx +0 -24
  85. package/example/components/ParallaxScrollView.tsx +0 -76
  86. package/example/components/ThemedText.tsx +0 -60
  87. package/example/components/ThemedView.tsx +0 -14
  88. package/example/components/__tests__/ThemedText-test.tsx +0 -10
  89. package/example/components/__tests__/__snapshots__/ThemedText-test.tsx.snap +0 -24
  90. package/example/components/navigation/TabBarIcon.js +0 -24
  91. package/example/components/navigation/TabBarIcon.tsx +0 -9
  92. package/example/constants/Colors.ts +0 -26
  93. package/example/hooks/useColorScheme.ts +0 -1
  94. package/example/hooks/useThemeColor.ts +0 -22
  95. package/example/ios/.xcode.env +0 -11
  96. package/example/ios/Podfile +0 -58
  97. package/example/ios/Podfile.lock +0 -1603
  98. package/example/ios/Podfile.properties.json +0 -4
  99. package/example/ios/example/AppDelegate.h +0 -7
  100. package/example/ios/example/AppDelegate.mm +0 -62
  101. package/example/ios/example/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
  102. package/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +0 -14
  103. package/example/ios/example/Images.xcassets/Contents.json +0 -6
  104. package/example/ios/example/Images.xcassets/SplashScreen.imageset/Contents.json +0 -21
  105. package/example/ios/example/Images.xcassets/SplashScreen.imageset/image.png +0 -0
  106. package/example/ios/example/Images.xcassets/SplashScreenBackground.imageset/Contents.json +0 -21
  107. package/example/ios/example/Images.xcassets/SplashScreenBackground.imageset/image.png +0 -0
  108. package/example/ios/example/Info.plist +0 -81
  109. package/example/ios/example/PrivacyInfo.xcprivacy +0 -48
  110. package/example/ios/example/SplashScreen.storyboard +0 -51
  111. package/example/ios/example/Supporting/Expo.plist +0 -12
  112. package/example/ios/example/example-Bridging-Header.h +0 -3
  113. package/example/ios/example/example.entitlements +0 -5
  114. package/example/ios/example/main.m +0 -10
  115. package/example/ios/example/noop-file.swift +0 -4
  116. package/example/ios/example.xcodeproj/project.pbxproj +0 -555
  117. package/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme +0 -88
  118. package/example/ios/example.xcworkspace/contents.xcworkspacedata +0 -10
  119. package/example/metro.config.js +0 -34
  120. package/example/package.json +0 -53
  121. package/example/react-native.config.js +0 -9
  122. package/example/scripts/reset-project.js +0 -73
  123. package/example/tsconfig.json +0 -17
  124. package/example/yarn.lock +0 -8571
  125. package/src/components/Button/Button.tsx +0 -110
  126. package/src/components/Button/styles/ButtonStyle.ts +0 -47
  127. package/src/components/DateTimeInput/index.tsx +0 -172
  128. package/src/components/DragHandle/index.tsx +0 -49
  129. package/src/components/MenuItemDescription/MenuItemDescription.tsx +0 -34
  130. package/src/components/NavigationListRow/index.tsx +0 -68
  131. package/src/components/SelectInput/SelectInput.tsx +0 -191
  132. package/src/components/SelectInput/index.ts +0 -2
  133. package/src/components/Sheet/index.tsx +0 -189
  134. package/src/components/SwitchToggle/index.tsx +0 -31
  135. package/src/components/Text/Text.tsx +0 -74
  136. package/src/components/TextInput/TextInput.tsx +0 -241
  137. package/src/components/TitleBar/TitleBar.tsx +0 -150
  138. package/src/context/index.ts +0 -6
  139. package/src/hooks/index.ts +0 -2
  140. package/src/hooks/useTheme.ts +0 -7
  141. package/src/hooks/useThemedStyle.ts +0 -18
  142. package/src/index.ts +0 -5
  143. package/src/shared/styles/index.ts +0 -33
  144. package/src/themes/AtlasLightTheme.ts +0 -90
  145. package/src/themes/index.ts +0 -1
  146. package/src/types/index.ts +0 -3
  147. package/src/types/theme.ts +0 -45
  148. package/tsconfig.json +0 -111
  149. /package/{src/components/Button/index.ts → dist/components/Button/index.d.ts} +0 -0
  150. /package/{src/components/MenuItemDescription/index.ts → dist/components/MenuItemDescription/index.d.ts} +0 -0
  151. /package/{src/components/TextInput/index.tsx → dist/components/TextInput/index.d.ts} +0 -0
  152. /package/{src/components/TitleBar/index.ts → dist/components/TitleBar/index.d.ts} +0 -0
@@ -0,0 +1,157 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.SelectInput = SelectInput;
30
+ const react_1 = __importStar(require("react"));
31
+ const react_native_1 = require("react-native");
32
+ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
33
+ const Ionicons_1 = __importDefault(require("react-native-vector-icons/Ionicons"));
34
+ const Text_1 = __importDefault(require("../Text"));
35
+ const Sheet_1 = __importDefault(require("../Sheet"));
36
+ const MenuItemDescription_1 = require("../MenuItemDescription");
37
+ const hooks_1 = require("../../hooks");
38
+ function SelectInput({ caption, label, options = [], onChange, }) {
39
+ // Rest of the component stays the same.
40
+ const { styles, theme } = useStyles();
41
+ const values = (0, react_1.useMemo)(() => {
42
+ return options.filter((v) => v.selected);
43
+ }, options);
44
+ const [sheetOpen, setSheetOpen] = (0, react_1.useState)(false);
45
+ const animatedValue = (0, react_native_reanimated_1.useSharedValue)(values.length ? 1 : 0);
46
+ const rotation = (0, react_native_reanimated_1.useSharedValue)(sheetOpen ? 1 : 0);
47
+ (0, react_1.useEffect)(() => {
48
+ rotation.value = (0, react_native_reanimated_1.withTiming)(sheetOpen ? 1 : 0, {
49
+ duration: 200,
50
+ easing: react_native_reanimated_1.Easing.bezier(0.5, 0, 0, 0.75),
51
+ });
52
+ }, [sheetOpen]);
53
+ (0, react_1.useEffect)(() => {
54
+ animatedValue.value = values.length ? 1 : 0;
55
+ }, [values.length]);
56
+ const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
57
+ return {
58
+ transform: [
59
+ { translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [1, -8]) },
60
+ ],
61
+ fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [14, 10]),
62
+ };
63
+ }, []);
64
+ const animatedContainerStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
65
+ return {
66
+ borderColor: (0, react_native_reanimated_1.interpolateColor)(animatedValue.value, [0, 1], ["#ffffff00", theme.colors.border]),
67
+ };
68
+ }, [animatedValue]);
69
+ const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
70
+ return {
71
+ flex: 1,
72
+ transform: [{ translateY: animatedValue.value * 6 }],
73
+ };
74
+ }, [animatedValue]);
75
+ const animatedChevronStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
76
+ return {
77
+ transform: [
78
+ { rotateX: `${(0, react_native_reanimated_1.interpolate)(rotation.value, [0, 1], [0, 180])}deg` },
79
+ ],
80
+ };
81
+ }, [rotation]);
82
+ const handleOptionPress = (option) => {
83
+ onChange(option);
84
+ setSheetOpen(false);
85
+ };
86
+ return (<>
87
+ <react_native_1.TouchableOpacity onPress={() => setSheetOpen(true)}>
88
+ <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedContainerStyles]}>
89
+ <react_native_1.View pointerEvents="none" style={styles.labelContainer}>
90
+ <react_native_reanimated_1.default.Text style={[styles.label, animatedLabelStyles]}>
91
+ {label}
92
+ </react_native_reanimated_1.default.Text>
93
+ </react_native_1.View>
94
+ <react_native_reanimated_1.default.View style={animatedValueStyle}>
95
+ {!!values.length && (<Text_1.default contrast="low" style={styles.value}>
96
+ {values[0].label}
97
+ </Text_1.default>)}
98
+ </react_native_reanimated_1.default.View>
99
+ <react_native_reanimated_1.default.View style={animatedChevronStyle}>
100
+ <Ionicons_1.default style={styles.chevron} name="chevron-down-outline" size={20}/>
101
+ </react_native_reanimated_1.default.View>
102
+ </react_native_reanimated_1.default.View>
103
+ </react_native_1.TouchableOpacity>
104
+ {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
105
+ <Sheet_1.default open={sheetOpen} setOpen={setSheetOpen} header={label}>
106
+ {options.map((option, i) => (<react_native_1.TouchableOpacity style={[
107
+ styles.selectionItem,
108
+ option.selected && styles.selectedSelectionItem,
109
+ ]} key={i} onPress={() => handleOptionPress(option)}>
110
+ <Text_1.default contrast={option.selected ? "high" : "low"}>
111
+ {option.label}
112
+ </Text_1.default>
113
+ </react_native_1.TouchableOpacity>))}
114
+ </Sheet_1.default>
115
+ </>);
116
+ }
117
+ const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
118
+ chevron: {
119
+ paddingRight: theme.size.baseSize * 2,
120
+ color: theme.colors.foreground,
121
+ },
122
+ selectedSelectionItem: {
123
+ borderColor: theme.colors.primary,
124
+ },
125
+ selectionItem: {
126
+ alignItems: "center",
127
+ borderWidth: theme.borderWidth,
128
+ borderColor: theme.colors.border,
129
+ marginBottom: theme.size.baseSize * 2,
130
+ padding: theme.size.baseSize * 2,
131
+ borderRadius: theme.borderRadius,
132
+ },
133
+ itemContainer: {
134
+ borderWidth: theme.borderWidth,
135
+ borderColor: theme.colors.borderSecondary,
136
+ backgroundColor: theme.colors.backgroundOnPrimary,
137
+ marginBottom: theme.size.baseSize * 2,
138
+ borderRadius: theme.borderRadius,
139
+ minHeight: theme.size.baseSize * 8,
140
+ flexDirection: "row",
141
+ alignItems: "center",
142
+ justifyContent: "space-between",
143
+ },
144
+ labelContainer: {
145
+ left: theme.size.baseSize * 2,
146
+ position: "absolute",
147
+ },
148
+ label: Object.assign({ color: theme.text }, theme.typography.p1),
149
+ descriptionContainer: {
150
+ marginHorizontal: theme.size.baseSize * 4,
151
+ marginBottom: theme.size.baseSize * 2,
152
+ },
153
+ value: {
154
+ paddingHorizontal: theme.size.baseSize * 2,
155
+ },
156
+ }), []));
157
+ exports.default = SelectInput;
@@ -0,0 +1,2 @@
1
+ export { default } from './SelectInput';
2
+ export * from './SelectInput';
@@ -0,0 +1,23 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.default = void 0;
21
+ var SelectInput_1 = require("./SelectInput");
22
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(SelectInput_1).default; } });
23
+ __exportStar(require("./SelectInput"), exports);
@@ -2,4 +2,4 @@ export type Option<T> = {
2
2
  value: T;
3
3
  label: string;
4
4
  selected: boolean;
5
- };
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import React, { Dispatch, SetStateAction } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ type Props = {
4
+ open: boolean;
5
+ setOpen: Dispatch<SetStateAction<boolean>>;
6
+ children?: React.ReactNode;
7
+ containerStyle?: StyleProp<ViewStyle>;
8
+ defaultMargins?: boolean;
9
+ header?: string;
10
+ transparent?: boolean;
11
+ disableScroll?: boolean;
12
+ };
13
+ export declare const Sheet: ({ open, setOpen, children, containerStyle, defaultMargins, header, transparent, disableScroll }: Props) => React.JSX.Element | null;
14
+ export default Sheet;
@@ -0,0 +1,135 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Sheet = void 0;
30
+ const react_1 = __importStar(require("react"));
31
+ const react_native_1 = require("react-native");
32
+ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
33
+ const react_native_safe_area_context_1 = require("react-native-safe-area-context");
34
+ const useThemedStyle_1 = require("../../hooks/useThemedStyle");
35
+ const Text_1 = __importDefault(require("../Text"));
36
+ const BACKGROUND_OPACITY = 0.6;
37
+ const Sheet = ({ open, setOpen, children, containerStyle, defaultMargins = true, header, transparent = false, disableScroll = false }) => {
38
+ const styles = useStyles(defaultMargins).styles;
39
+ const [visible, setVisible] = (0, react_1.useState)(open);
40
+ const opacity = (0, react_native_reanimated_1.useSharedValue)(0);
41
+ (0, react_1.useEffect)(() => {
42
+ if (!open) {
43
+ setVisible(false);
44
+ return;
45
+ }
46
+ setVisible(true);
47
+ }, [open]);
48
+ (0, react_1.useEffect)(() => {
49
+ if (!visible) {
50
+ opacity.value = (0, react_native_reanimated_1.withTiming)(0, {
51
+ duration: 200,
52
+ easing: react_native_reanimated_1.Easing.bezier(0.5, 0, 0, 0.75),
53
+ }, () => {
54
+ (0, react_native_reanimated_1.runOnJS)(setOpen)(false);
55
+ });
56
+ return;
57
+ }
58
+ opacity.value = (0, react_native_reanimated_1.withTiming)(BACKGROUND_OPACITY, {
59
+ duration: 250,
60
+ easing: react_native_reanimated_1.Easing.bezier(0.5, 0, 0, 0.75),
61
+ });
62
+ }, [visible]);
63
+ const animatedModalBackgroundStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
64
+ opacity: opacity.value,
65
+ }));
66
+ const content = (<>
67
+ {!transparent && (<react_native_1.Pressable style={styles.modalPressable} onPress={() => {
68
+ setVisible(false);
69
+ }}>
70
+ <react_native_reanimated_1.default.View style={[styles.modalBackground, animatedModalBackgroundStyles]}/>
71
+ </react_native_1.Pressable>)}
72
+ {visible && (<react_native_reanimated_1.default.View entering={react_native_reanimated_1.SlideInDown} exiting={react_native_reanimated_1.SlideOutDown} style={[styles.sheet, containerStyle]}>
73
+ {!!header && (<react_native_1.View style={styles.headerContainer}>
74
+ <Text_1.default>{header}</Text_1.default>
75
+ </react_native_1.View>)}
76
+ <react_native_1.ScrollView scrollEnabled={!disableScroll} contentContainerStyle={styles.contentContainer}>
77
+ {children}
78
+ </react_native_1.ScrollView>
79
+ </react_native_reanimated_1.default.View>)}
80
+ </>);
81
+ // // Don't render anything if it's not visible
82
+ if (!visible && !open) {
83
+ return null;
84
+ }
85
+ return (<react_native_1.Modal transparent visible>
86
+ <react_native_1.View style={styles.wrapper}>{content}</react_native_1.View>
87
+ </react_native_1.Modal>);
88
+ };
89
+ exports.Sheet = Sheet;
90
+ exports.default = exports.Sheet;
91
+ const useStyles = (defaultMargins) => {
92
+ const { bottom: bottomInset } = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
93
+ return (0, useThemedStyle_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
94
+ wrapper: {
95
+ flex: 1,
96
+ justifyContent: "flex-end",
97
+ },
98
+ headerContainer: {
99
+ paddingVertical: theme.size.baseSize * 3,
100
+ justifyContent: "center",
101
+ alignItems: "center",
102
+ borderBottomWidth: theme.borderWidth / 2,
103
+ borderColor: theme.colors.border,
104
+ },
105
+ modalPressable: {
106
+ position: "absolute",
107
+ top: 0,
108
+ bottom: 0,
109
+ right: 0,
110
+ left: 0,
111
+ },
112
+ modalBackground: {
113
+ backgroundColor: "#000000",
114
+ position: "absolute",
115
+ top: 0,
116
+ bottom: 0,
117
+ right: 0,
118
+ left: 0,
119
+ },
120
+ sheet: {
121
+ alignSelf: "center",
122
+ display: "flex",
123
+ width: "100%",
124
+ maxWidth: 600,
125
+ maxHeight: "80%",
126
+ backgroundColor: theme.colors.backgroundPrimary,
127
+ },
128
+ contentContainer: {
129
+ padding: defaultMargins ? theme.size.baseSize * 4 : 0,
130
+ paddingBottom: defaultMargins
131
+ ? theme.size.baseSize * 4 + bottomInset
132
+ : bottomInset,
133
+ },
134
+ }), [bottomInset]));
135
+ };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ export type SwitchToggleProps = {
4
+ label: string;
5
+ value?: boolean;
6
+ caption?: string;
7
+ testId?: string;
8
+ onChange?: (value: boolean) => void;
9
+ touchableStyle?: StyleProp<ViewStyle>;
10
+ };
11
+ export declare const SwitchToggle: ({ testId, onChange, value, caption, label, touchableStyle }: SwitchToggleProps) => React.JSX.Element;
12
+ export default SwitchToggle;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SwitchToggle = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const react_native_1 = require("react-native");
9
+ const Text_1 = __importDefault(require("../Text"));
10
+ const MenuItemDescription_1 = require("../MenuItemDescription");
11
+ const index_1 = require("../../shared/styles/index");
12
+ const SwitchToggle = ({ testId, onChange, value, caption, label, touchableStyle }) => {
13
+ const styles = (0, index_1.useMenuItemStyles)().styles;
14
+ return (<react_native_1.View style={styles.container}>
15
+ <react_native_1.TouchableOpacity testID={testId} style={[styles.itemContainer, touchableStyle]}>
16
+ <Text_1.default numberOfLines={1}>{label}</Text_1.default>
17
+ <react_native_1.Switch testID={`${testId}_toggle`} onValueChange={onChange} value={value}/>
18
+ </react_native_1.TouchableOpacity>
19
+ {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
20
+ </react_native_1.View>);
21
+ };
22
+ exports.SwitchToggle = SwitchToggle;
23
+ exports.default = exports.SwitchToggle;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { StyleProp, TextProps as RNTextProps, TextStyle } from 'react-native';
3
+ import { TypographyVariants } from '../../types/typography';
4
+ type TextContrast = 'high' | 'medium' | 'low';
5
+ type TextStatus = 'error' | 'informative' | 'warning' | 'success';
6
+ export interface TextProps extends RNTextProps {
7
+ status?: TextStatus;
8
+ category?: TypographyVariants;
9
+ contrast?: TextContrast;
10
+ style?: StyleProp<TextStyle>;
11
+ }
12
+ export declare const Text: ({ category, contrast, style, status, ...rest }: TextProps) => React.JSX.Element;
13
+ export default Text;
@@ -0,0 +1,92 @@
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 (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Text = void 0;
38
+ const react_1 = __importStar(require("react"));
39
+ const react_native_1 = require("react-native");
40
+ const hooks_1 = require("../../hooks");
41
+ const getFontStyle = ({ fontFamily, fontSize, fontWeight, lineHeight }) => {
42
+ return {
43
+ fontFamily,
44
+ fontSize,
45
+ fontWeight,
46
+ lineHeight,
47
+ };
48
+ };
49
+ const Text = (_a) => {
50
+ var { category = 'p1', contrast, style, status } = _a, rest = __rest(_a, ["category", "contrast", "style", "status"]);
51
+ const styles = useStyles(category, contrast, status).styles;
52
+ return <react_native_1.Text style={[styles.fontStyle, styles.colorStyle, style]} {...rest}/>;
53
+ };
54
+ exports.Text = Text;
55
+ exports.default = exports.Text;
56
+ const useStyles = (category, contrast = 'high', status) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)(theme => {
57
+ let color = theme.colors.foregroundHighContrast;
58
+ if (contrast) {
59
+ if (contrast === 'medium') {
60
+ color = theme.colors.foreground;
61
+ }
62
+ else if (contrast === 'low') {
63
+ color = theme.colors.foregroundLowContrast;
64
+ }
65
+ }
66
+ if (status) {
67
+ if (status) {
68
+ switch (status) {
69
+ case 'error':
70
+ color = theme.colors.secondaryNegative;
71
+ break;
72
+ case 'informative':
73
+ color = theme.colors.primary;
74
+ break;
75
+ case 'warning':
76
+ color = theme.colors.secondaryWarning;
77
+ break;
78
+ case 'success':
79
+ color = theme.colors.secondaryPositive;
80
+ break;
81
+ default:
82
+ break;
83
+ }
84
+ }
85
+ }
86
+ return react_native_1.StyleSheet.create({
87
+ colorStyle: {
88
+ color,
89
+ },
90
+ fontStyle: getFontStyle(theme.typography[category]),
91
+ });
92
+ }, [category, contrast, status]));
@@ -1,2 +1,2 @@
1
1
  export { default } from './Text';
2
- export * from './Text';
2
+ export * from './Text';
@@ -0,0 +1,23 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.default = void 0;
21
+ var Text_1 = require("./Text");
22
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Text_1).default; } });
23
+ __exportStar(require("./Text"), exports);
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import { KeyboardTypeOptions, TextInputProps as RNTextInputProps, StyleProp, ViewStyle } from "react-native";
3
+ export type TextInputProps = {
4
+ disabled?: boolean;
5
+ testId?: string;
6
+ caption?: string;
7
+ keyboardType?: KeyboardTypeOptions;
8
+ onBlur?: (text: string) => void;
9
+ value: string;
10
+ label: string;
11
+ containerStyle?: StyleProp<ViewStyle>;
12
+ } & Omit<RNTextInputProps, "onBlur">;
13
+ export declare const TextInput: React.ForwardRefExoticComponent<{
14
+ disabled?: boolean;
15
+ testId?: string;
16
+ caption?: string;
17
+ keyboardType?: KeyboardTypeOptions;
18
+ onBlur?: (text: string) => void;
19
+ value: string;
20
+ label: string;
21
+ containerStyle?: StyleProp<ViewStyle>;
22
+ } & Omit<RNTextInputProps, "onBlur"> & React.RefAttributes<unknown>>;
23
+ export default TextInput;