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.
- package/README.md +6 -0
- package/dist/components/Button/Button.d.ts +18 -0
- package/dist/components/Button/Button.js +73 -0
- package/dist/components/Button/index.js +23 -0
- package/dist/components/Button/styles/ButtonStyle.d.ts +38 -0
- package/dist/components/Button/styles/ButtonStyle.js +42 -0
- package/dist/components/DateTimeInput/index.d.ts +16 -0
- package/dist/components/DateTimeInput/index.js +146 -0
- package/dist/components/DragHandle/index.d.ts +7 -0
- package/dist/components/DragHandle/index.js +55 -0
- package/dist/components/MenuItemDescription/MenuItemDescription.d.ts +5 -0
- package/dist/components/MenuItemDescription/MenuItemDescription.js +48 -0
- package/dist/components/MenuItemDescription/index.js +17 -0
- package/dist/components/NavigationListRow/index.d.ts +9 -0
- package/dist/components/NavigationListRow/index.js +64 -0
- package/dist/components/SelectInput/SelectInput.d.ts +10 -0
- package/dist/components/SelectInput/SelectInput.js +157 -0
- package/dist/components/SelectInput/index.d.ts +2 -0
- package/dist/components/SelectInput/index.js +23 -0
- package/{src/components/SelectInput/types.ts → dist/components/SelectInput/types.d.ts} +1 -1
- package/dist/components/SelectInput/types.js +2 -0
- package/dist/components/Sheet/index.d.ts +14 -0
- package/dist/components/Sheet/index.js +135 -0
- package/dist/components/SwitchToggle/index.d.ts +12 -0
- package/dist/components/SwitchToggle/index.js +23 -0
- package/dist/components/Text/Text.d.ts +13 -0
- package/dist/components/Text/Text.js +92 -0
- package/{src/components/Text/index.tsx → dist/components/Text/index.d.ts} +1 -1
- package/dist/components/Text/index.js +23 -0
- package/dist/components/TextInput/TextInput.d.ts +23 -0
- package/dist/components/TextInput/TextInput.js +177 -0
- package/dist/components/TextInput/index.js +23 -0
- package/dist/components/TitleBar/TitleBar.d.ts +13 -0
- package/dist/components/TitleBar/TitleBar.js +127 -0
- package/dist/components/TitleBar/index.js +23 -0
- package/{src/components/index.ts → dist/components/index.d.ts} +1 -1
- package/dist/components/index.js +27 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +6 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +18 -0
- package/dist/hooks/useTheme.d.ts +2 -0
- package/dist/hooks/useTheme.js +8 -0
- package/dist/hooks/useThemedStyle.d.ts +7 -0
- package/dist/hooks/useThemedStyle.js +17 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -0
- package/dist/shared/styles/index.d.ts +27 -0
- package/dist/shared/styles/index.js +26 -0
- package/dist/themes/AtlasLightTheme.d.ts +2 -0
- package/dist/themes/AtlasLightTheme.js +89 -0
- package/dist/themes/index.d.ts +1 -0
- package/dist/themes/index.js +17 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +19 -0
- package/dist/types/theme.d.ts +42 -0
- package/dist/types/theme.js +2 -0
- package/{src/types/typography.ts → dist/types/typography.d.ts} +5 -8
- package/dist/types/typography.js +2 -0
- package/package.json +13 -4
- package/.eslintrc.js +0 -33
- package/example/README.md +0 -50
- package/example/app/_layout.tsx +0 -32
- package/example/app/buttonGallery.tsx +0 -49
- package/example/app/dateTimeInputGallery.tsx +0 -28
- package/example/app/index.tsx +0 -58
- package/example/app/selectInputGallery.tsx +0 -45
- package/example/app/sheetGallery.tsx +0 -36
- package/example/app/switchToggleInputGallery.tsx +0 -28
- package/example/app/textGallery.tsx +0 -68
- package/example/app/textInputGallery.tsx +0 -28
- package/example/app.json +0 -37
- package/example/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/example/assets/images/adaptive-icon.png +0 -0
- package/example/assets/images/favicon.png +0 -0
- package/example/assets/images/icon.png +0 -0
- package/example/assets/images/partial-react-logo.png +0 -0
- package/example/assets/images/react-logo.png +0 -0
- package/example/assets/images/react-logo@2x.png +0 -0
- package/example/assets/images/react-logo@3x.png +0 -0
- package/example/assets/images/splash.png +0 -0
- package/example/babel.config.js +0 -6
- package/example/components/Collapsible.tsx +0 -41
- package/example/components/ExternalLink.tsx +0 -24
- package/example/components/ParallaxScrollView.tsx +0 -76
- package/example/components/ThemedText.tsx +0 -60
- package/example/components/ThemedView.tsx +0 -14
- package/example/components/__tests__/ThemedText-test.tsx +0 -10
- package/example/components/__tests__/__snapshots__/ThemedText-test.tsx.snap +0 -24
- package/example/components/navigation/TabBarIcon.js +0 -24
- package/example/components/navigation/TabBarIcon.tsx +0 -9
- package/example/constants/Colors.ts +0 -26
- package/example/hooks/useColorScheme.ts +0 -1
- package/example/hooks/useThemeColor.ts +0 -22
- package/example/ios/.xcode.env +0 -11
- package/example/ios/Podfile +0 -58
- package/example/ios/Podfile.lock +0 -1603
- package/example/ios/Podfile.properties.json +0 -4
- package/example/ios/example/AppDelegate.h +0 -7
- package/example/ios/example/AppDelegate.mm +0 -62
- package/example/ios/example/Images.xcassets/AppIcon.appiconset/App-Icon-1024x1024@1x.png +0 -0
- package/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +0 -14
- package/example/ios/example/Images.xcassets/Contents.json +0 -6
- package/example/ios/example/Images.xcassets/SplashScreen.imageset/Contents.json +0 -21
- package/example/ios/example/Images.xcassets/SplashScreen.imageset/image.png +0 -0
- package/example/ios/example/Images.xcassets/SplashScreenBackground.imageset/Contents.json +0 -21
- package/example/ios/example/Images.xcassets/SplashScreenBackground.imageset/image.png +0 -0
- package/example/ios/example/Info.plist +0 -81
- package/example/ios/example/PrivacyInfo.xcprivacy +0 -48
- package/example/ios/example/SplashScreen.storyboard +0 -51
- package/example/ios/example/Supporting/Expo.plist +0 -12
- package/example/ios/example/example-Bridging-Header.h +0 -3
- package/example/ios/example/example.entitlements +0 -5
- package/example/ios/example/main.m +0 -10
- package/example/ios/example/noop-file.swift +0 -4
- package/example/ios/example.xcodeproj/project.pbxproj +0 -555
- package/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme +0 -88
- package/example/ios/example.xcworkspace/contents.xcworkspacedata +0 -10
- package/example/metro.config.js +0 -34
- package/example/package.json +0 -53
- package/example/react-native.config.js +0 -9
- package/example/scripts/reset-project.js +0 -73
- package/example/tsconfig.json +0 -17
- package/example/yarn.lock +0 -8571
- package/src/components/Button/Button.tsx +0 -110
- package/src/components/Button/styles/ButtonStyle.ts +0 -47
- package/src/components/DateTimeInput/index.tsx +0 -172
- package/src/components/DragHandle/index.tsx +0 -49
- package/src/components/MenuItemDescription/MenuItemDescription.tsx +0 -34
- package/src/components/NavigationListRow/index.tsx +0 -68
- package/src/components/SelectInput/SelectInput.tsx +0 -191
- package/src/components/SelectInput/index.ts +0 -2
- package/src/components/Sheet/index.tsx +0 -189
- package/src/components/SwitchToggle/index.tsx +0 -31
- package/src/components/Text/Text.tsx +0 -74
- package/src/components/TextInput/TextInput.tsx +0 -241
- package/src/components/TitleBar/TitleBar.tsx +0 -150
- package/src/context/index.ts +0 -6
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useTheme.ts +0 -7
- package/src/hooks/useThemedStyle.ts +0 -18
- package/src/index.ts +0 -5
- package/src/shared/styles/index.ts +0 -33
- package/src/themes/AtlasLightTheme.ts +0 -90
- package/src/themes/index.ts +0 -1
- package/src/types/index.ts +0 -3
- package/src/types/theme.ts +0 -45
- package/tsconfig.json +0 -111
- /package/{src/components/Button/index.ts → dist/components/Button/index.d.ts} +0 -0
- /package/{src/components/MenuItemDescription/index.ts → dist/components/MenuItemDescription/index.d.ts} +0 -0
- /package/{src/components/TextInput/index.tsx → dist/components/TextInput/index.d.ts} +0 -0
- /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,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);
|
|
@@ -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;
|