atlas-design-system 1.2.1 → 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/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 +6 -2
- package/.eslintrc.js +0 -33
- package/example/README.md +0 -50
- package/example/app/_layout.tsx +0 -33
- package/example/app/buttonGallery.tsx +0 -49
- package/example/app/dateTimeInputGallery.tsx +0 -28
- package/example/app/index.tsx +0 -64
- package/example/app/navigationListRowGallery.tsx +0 -33
- 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 -1597
- 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/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,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export declare enum ButtonType {
|
|
4
|
+
Primary = 0,
|
|
5
|
+
Destructive = 1
|
|
6
|
+
}
|
|
7
|
+
export interface ButtonProps {
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
type?: ButtonType;
|
|
10
|
+
onPress?: () => void;
|
|
11
|
+
text: string;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
testID?: string;
|
|
14
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
15
|
+
appearance?: "primary" | "secondary" | "destructive";
|
|
16
|
+
}
|
|
17
|
+
export declare const Button: ({ testID, disabled, onPress, text, loading, containerStyle, appearance, type, }: ButtonProps) => React.JSX.Element;
|
|
18
|
+
export default Button;
|
|
@@ -0,0 +1,73 @@
|
|
|
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.Button = exports.ButtonType = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const react_native_1 = require("react-native");
|
|
32
|
+
const ButtonStyle_1 = require("./styles/ButtonStyle");
|
|
33
|
+
const Text_1 = __importDefault(require("../Text"));
|
|
34
|
+
var ButtonType;
|
|
35
|
+
(function (ButtonType) {
|
|
36
|
+
ButtonType[ButtonType["Primary"] = 0] = "Primary";
|
|
37
|
+
ButtonType[ButtonType["Destructive"] = 1] = "Destructive";
|
|
38
|
+
})(ButtonType || (exports.ButtonType = ButtonType = {}));
|
|
39
|
+
const getButtonStyle = (styles, appearance, disabled) => {
|
|
40
|
+
const style = [styles.primary];
|
|
41
|
+
if (appearance === "secondary") {
|
|
42
|
+
style.push(styles.secondary);
|
|
43
|
+
}
|
|
44
|
+
if (appearance === "destructive") {
|
|
45
|
+
style.push(styles.destructive);
|
|
46
|
+
}
|
|
47
|
+
if (disabled) {
|
|
48
|
+
style.push(styles.disabled);
|
|
49
|
+
}
|
|
50
|
+
return style;
|
|
51
|
+
};
|
|
52
|
+
const Button = ({ testID, disabled = false, onPress, text, loading, containerStyle = {}, appearance = "primary", type, }) => {
|
|
53
|
+
const { styles, theme } = (0, ButtonStyle_1.useButtonStyles)();
|
|
54
|
+
const buttonStyle = (0, react_1.useMemo)(() => {
|
|
55
|
+
let _apperance = appearance;
|
|
56
|
+
if (type) {
|
|
57
|
+
_apperance = type === ButtonType.Destructive ? "destructive" : "primary";
|
|
58
|
+
}
|
|
59
|
+
return getButtonStyle({
|
|
60
|
+
disabled: styles.disabled,
|
|
61
|
+
primary: styles.default,
|
|
62
|
+
destructive: styles.destructiveContainer,
|
|
63
|
+
secondary: styles.secondary,
|
|
64
|
+
}, _apperance, disabled);
|
|
65
|
+
}, [styles, appearance, disabled, type]);
|
|
66
|
+
return (<react_native_1.TouchableOpacity testID={testID} style={[buttonStyle, disabled && styles.disabled, containerStyle]} onPress={onPress} disabled={disabled || loading}>
|
|
67
|
+
{loading ? (<react_native_1.ActivityIndicator size="small" color={theme.colors.foregroundOnPrimary}/>) : (<Text_1.default category="h3" style={[styles.defaultText, disabled && styles.disabledText]}>
|
|
68
|
+
{text}
|
|
69
|
+
</Text_1.default>)}
|
|
70
|
+
</react_native_1.TouchableOpacity>);
|
|
71
|
+
};
|
|
72
|
+
exports.Button = Button;
|
|
73
|
+
exports.default = exports.Button;
|
|
@@ -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 Button_1 = require("./Button");
|
|
22
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Button_1).default; } });
|
|
23
|
+
__exportStar(require("./Button"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const useButtonStyles: () => {
|
|
2
|
+
theme: import("../../..").AtlasTheme;
|
|
3
|
+
styles: {
|
|
4
|
+
default: {
|
|
5
|
+
borderRadius: number;
|
|
6
|
+
justifyContent: "center";
|
|
7
|
+
backgroundColor: string;
|
|
8
|
+
paddingHorizontal: number;
|
|
9
|
+
paddingVertical: number;
|
|
10
|
+
textAlign: "center";
|
|
11
|
+
};
|
|
12
|
+
secondary: {
|
|
13
|
+
backgroundColor: string;
|
|
14
|
+
};
|
|
15
|
+
destructiveContainer: {
|
|
16
|
+
borderRadius: number;
|
|
17
|
+
justifyContent: "center";
|
|
18
|
+
paddingHorizontal: number;
|
|
19
|
+
paddingVertical: number;
|
|
20
|
+
textAlign: "center";
|
|
21
|
+
backgroundColor: string;
|
|
22
|
+
};
|
|
23
|
+
destructiveText: {
|
|
24
|
+
textAlign: "center";
|
|
25
|
+
color: string;
|
|
26
|
+
};
|
|
27
|
+
defaultText: {
|
|
28
|
+
textAlign: "center";
|
|
29
|
+
color: string;
|
|
30
|
+
};
|
|
31
|
+
disabled: {
|
|
32
|
+
backgroundColor: string;
|
|
33
|
+
};
|
|
34
|
+
disabledText: {
|
|
35
|
+
color: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useButtonStyles = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const hooks_1 = require("../../../hooks");
|
|
7
|
+
const useButtonStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)(theme => react_native_1.StyleSheet.create({
|
|
8
|
+
default: {
|
|
9
|
+
borderRadius: theme.borderRadius,
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
backgroundColor: theme.colors.primary,
|
|
12
|
+
paddingHorizontal: theme.size.baseSize * 4,
|
|
13
|
+
paddingVertical: theme.size.baseSize * 2,
|
|
14
|
+
textAlign: 'center',
|
|
15
|
+
},
|
|
16
|
+
secondary: {
|
|
17
|
+
backgroundColor: theme.colors.foregroundLowContrast,
|
|
18
|
+
},
|
|
19
|
+
destructiveContainer: {
|
|
20
|
+
borderRadius: theme.borderRadius,
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
paddingHorizontal: theme.size.baseSize * 4,
|
|
23
|
+
paddingVertical: theme.size.baseSize * 2,
|
|
24
|
+
textAlign: 'center',
|
|
25
|
+
backgroundColor: theme.colors.secondaryNegative,
|
|
26
|
+
},
|
|
27
|
+
destructiveText: {
|
|
28
|
+
textAlign: 'center',
|
|
29
|
+
color: theme.colors.backgroundPrimary,
|
|
30
|
+
},
|
|
31
|
+
defaultText: {
|
|
32
|
+
textAlign: 'center',
|
|
33
|
+
color: theme.colors.foregroundOnPrimary,
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
backgroundColor: theme.colors.primaryLowContrast,
|
|
37
|
+
},
|
|
38
|
+
disabledText: {
|
|
39
|
+
color: theme.colors.foregroundOnPrimary,
|
|
40
|
+
},
|
|
41
|
+
}), []));
|
|
42
|
+
exports.useButtonStyles = useButtonStyles;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IOSNativeProps, AndroidNativeProps } from '@react-native-community/datetimepicker';
|
|
3
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
export type DateTimeInputProps = {
|
|
5
|
+
label: string;
|
|
6
|
+
caption?: string;
|
|
7
|
+
value: Date;
|
|
8
|
+
onChange?: (date: Date) => void;
|
|
9
|
+
onSave?: (date: Date) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
testID?: string;
|
|
12
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
13
|
+
mode?: IOSNativeProps['mode'] | AndroidNativeProps['mode'];
|
|
14
|
+
};
|
|
15
|
+
export declare const DateTimeInput: ({ value, onChange, testID, containerStyle, label, caption, mode, disabled, onSave, }: DateTimeInputProps) => React.JSX.Element;
|
|
16
|
+
export default DateTimeInput;
|
|
@@ -0,0 +1,146 @@
|
|
|
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.DateTimeInput = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const datetimepicker_1 = __importDefault(require("@react-native-community/datetimepicker"));
|
|
32
|
+
const react_native_1 = require("react-native");
|
|
33
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
34
|
+
// import IonIcons from 'react-native-vector-icons/Ionicons';
|
|
35
|
+
const moment_1 = __importDefault(require("moment"));
|
|
36
|
+
const Sheet_1 = __importDefault(require("../Sheet"));
|
|
37
|
+
const Text_1 = __importDefault(require("../Text"));
|
|
38
|
+
const MenuItemDescription_1 = require("../MenuItemDescription");
|
|
39
|
+
const hooks_1 = require("../../hooks");
|
|
40
|
+
const Button_1 = __importDefault(require("../Button"));
|
|
41
|
+
const getFormat = (mode) => {
|
|
42
|
+
switch (mode) {
|
|
43
|
+
case 'date': {
|
|
44
|
+
return 'MMM D, YYYY';
|
|
45
|
+
}
|
|
46
|
+
case 'time': {
|
|
47
|
+
return 'h:mm A';
|
|
48
|
+
}
|
|
49
|
+
case 'datetime':
|
|
50
|
+
default: {
|
|
51
|
+
return 'MMM D, YYYY h:mm A';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption, mode = 'date', disabled = false, onSave, }) => {
|
|
56
|
+
const { styles, theme } = useStyles(disabled);
|
|
57
|
+
const [dateSheetOpen, setDateSheetOpen] = (0, react_1.useState)(false);
|
|
58
|
+
const [date, setDate] = (0, react_1.useState)(value);
|
|
59
|
+
(0, react_1.useEffect)(() => {
|
|
60
|
+
if (dateSheetOpen) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
setDate(value);
|
|
64
|
+
}, [dateSheetOpen, value]);
|
|
65
|
+
const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
|
|
66
|
+
const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
67
|
+
return {
|
|
68
|
+
transform: [{ translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [1, -8]) }],
|
|
69
|
+
fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [14, 10]),
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
72
|
+
const animatedContainerStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
73
|
+
return {
|
|
74
|
+
borderColor: (0, react_native_reanimated_1.interpolateColor)(animatedValue.value, [0, 1], ['#ffffff00', theme.colors.border]),
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
78
|
+
return {
|
|
79
|
+
flex: 1,
|
|
80
|
+
transform: [{ translateY: animatedValue.value * 6 }],
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
return (<>
|
|
84
|
+
<react_native_1.View testID={testID} style={[styles.container, containerStyle]}>
|
|
85
|
+
<react_native_1.TouchableOpacity onPress={() => setDateSheetOpen(true)} disabled={disabled}>
|
|
86
|
+
<react_native_reanimated_1.default.View style={[styles.itemContainer, animatedContainerStyles]}>
|
|
87
|
+
<react_native_1.View pointerEvents="none" style={styles.labelContainer}>
|
|
88
|
+
<react_native_reanimated_1.default.Text style={[styles.label, animatedLabelStyles]}>{label}</react_native_reanimated_1.default.Text>
|
|
89
|
+
</react_native_1.View>
|
|
90
|
+
<react_native_reanimated_1.default.View style={animatedValueStyle}>
|
|
91
|
+
<Text_1.default contrast="low" style={styles.value}>
|
|
92
|
+
{(0, moment_1.default)(value).format(getFormat(mode)).toString()}
|
|
93
|
+
</Text_1.default>
|
|
94
|
+
</react_native_reanimated_1.default.View>
|
|
95
|
+
{/*<IonIcons
|
|
96
|
+
style={styles.iconRight}
|
|
97
|
+
color={!disabled ? theme.colors.foreground : theme.colors.foregroundLowContrast}
|
|
98
|
+
name={mode === 'time' ? 'time-outline' : 'calendar-outline'}
|
|
99
|
+
size={20}
|
|
100
|
+
/>*/}
|
|
101
|
+
</react_native_reanimated_1.default.View>
|
|
102
|
+
</react_native_1.TouchableOpacity>
|
|
103
|
+
{!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
|
|
104
|
+
</react_native_1.View>
|
|
105
|
+
<Sheet_1.default disableScroll header={label} open={dateSheetOpen} setOpen={setDateSheetOpen}>
|
|
106
|
+
<datetimepicker_1.default value={date} mode={mode} themeVariant={theme.isDarkTheme ? 'dark' : 'light'} display="spinner" onChange={(_, newDate) => {
|
|
107
|
+
if (!newDate) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
setDate(newDate);
|
|
111
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
|
|
112
|
+
}}/>
|
|
113
|
+
<Button_1.default disabled={value.getTime() === date.getTime()} text="Save" onPress={() => {
|
|
114
|
+
onSave === null || onSave === void 0 ? void 0 : onSave(date);
|
|
115
|
+
}}/>
|
|
116
|
+
</Sheet_1.default>
|
|
117
|
+
</>);
|
|
118
|
+
};
|
|
119
|
+
exports.DateTimeInput = DateTimeInput;
|
|
120
|
+
exports.default = exports.DateTimeInput;
|
|
121
|
+
const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)(t => react_native_1.StyleSheet.create({
|
|
122
|
+
container: {
|
|
123
|
+
marginBottom: t.size.baseSize * 3,
|
|
124
|
+
},
|
|
125
|
+
itemContainer: {
|
|
126
|
+
backgroundColor: t.colors.backgroundOnPrimary,
|
|
127
|
+
borderRadius: t.borderRadius,
|
|
128
|
+
paddingHorizontal: t.size.baseSize * 2,
|
|
129
|
+
minHeight: t.size.baseSize * 8,
|
|
130
|
+
flexDirection: 'row',
|
|
131
|
+
justifyContent: 'space-between',
|
|
132
|
+
alignItems: 'center',
|
|
133
|
+
},
|
|
134
|
+
itemLabel: {
|
|
135
|
+
color: t.textPrimary,
|
|
136
|
+
},
|
|
137
|
+
labelContainer: {
|
|
138
|
+
left: t.size.baseSize * 2,
|
|
139
|
+
position: 'absolute',
|
|
140
|
+
},
|
|
141
|
+
label: Object.assign({ color: !disabled ? t.colors.foreground : t.colors.foregroundLowContrast }, t.typography.p1),
|
|
142
|
+
iconRight: {},
|
|
143
|
+
value: {
|
|
144
|
+
paddingHorizontal: t.size.baseSize * 0,
|
|
145
|
+
},
|
|
146
|
+
}), [disabled]));
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.DragHandle = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const react_native_1 = require("react-native");
|
|
29
|
+
const hooks_1 = require("../../hooks");
|
|
30
|
+
const SIZE_MAP = {
|
|
31
|
+
small: 5,
|
|
32
|
+
medium: 10,
|
|
33
|
+
large: 20,
|
|
34
|
+
};
|
|
35
|
+
const DragHandle = ({ size = "medium" }) => {
|
|
36
|
+
const styles = useStyles(size).styles;
|
|
37
|
+
return (<react_native_1.View style={styles.container}>
|
|
38
|
+
<react_native_1.View style={styles.handle}></react_native_1.View>
|
|
39
|
+
</react_native_1.View>);
|
|
40
|
+
};
|
|
41
|
+
exports.DragHandle = DragHandle;
|
|
42
|
+
exports.default = exports.DragHandle;
|
|
43
|
+
const useStyles = (size) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((t) => react_native_1.StyleSheet.create({
|
|
44
|
+
container: {
|
|
45
|
+
width: "100%",
|
|
46
|
+
paddingVertical: t.size.baseSize * 2,
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
},
|
|
49
|
+
handle: {
|
|
50
|
+
width: t.size.baseSize * (SIZE_MAP[size] || t.size.baseSize),
|
|
51
|
+
height: t.size.baseSize,
|
|
52
|
+
borderRadius: t.borderRadius,
|
|
53
|
+
backgroundColor: t.colors.backgroundOnPrimary,
|
|
54
|
+
},
|
|
55
|
+
}), [size]));
|
|
@@ -0,0 +1,48 @@
|
|
|
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.MenuItemDescription = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const react_native_1 = require("react-native");
|
|
32
|
+
const Text_1 = __importDefault(require("../Text"));
|
|
33
|
+
const hooks_1 = require("../../hooks");
|
|
34
|
+
const MenuItemDescription = ({ description }) => {
|
|
35
|
+
const styles = useStyles().styles;
|
|
36
|
+
return (<react_native_1.View style={styles.descriptionContainer}>
|
|
37
|
+
<Text_1.default category="p2" contrast="low">
|
|
38
|
+
{description}
|
|
39
|
+
</Text_1.default>
|
|
40
|
+
</react_native_1.View>);
|
|
41
|
+
};
|
|
42
|
+
exports.MenuItemDescription = MenuItemDescription;
|
|
43
|
+
const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)(theme => react_native_1.StyleSheet.create({
|
|
44
|
+
descriptionContainer: {
|
|
45
|
+
marginHorizontal: theme.size.baseSize * 2,
|
|
46
|
+
marginTop: theme.size.baseSize,
|
|
47
|
+
},
|
|
48
|
+
}), []));
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MenuItemDescription"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type NavigationListRowProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
caption?: string;
|
|
5
|
+
onPress?: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const NavigationListRow: ({ label, caption, onPress, disabled, }: NavigationListRowProps) => React.JSX.Element;
|
|
9
|
+
export default NavigationListRow;
|
|
@@ -0,0 +1,64 @@
|
|
|
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.NavigationListRow = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const react_native_1 = require("react-native");
|
|
32
|
+
const Ionicons_1 = __importDefault(require("react-native-vector-icons/Ionicons"));
|
|
33
|
+
const Text_1 = __importDefault(require("../Text"));
|
|
34
|
+
const useThemedStyle_1 = require("../../hooks/useThemedStyle");
|
|
35
|
+
const NavigationListRow = ({ label, caption, onPress, disabled, }) => {
|
|
36
|
+
const styles = useStyles().styles;
|
|
37
|
+
return (<react_native_1.TouchableOpacity disabled={disabled} style={styles.container} onPress={onPress}>
|
|
38
|
+
<react_native_1.View style={styles.content}>
|
|
39
|
+
<Text_1.default category="h3">{label}</Text_1.default>
|
|
40
|
+
{caption && <Text_1.default contrast="low">{caption}</Text_1.default>}
|
|
41
|
+
</react_native_1.View>
|
|
42
|
+
<Ionicons_1.default style={styles.chevronRight} size={18} name="chevron-forward-outline"/>
|
|
43
|
+
</react_native_1.TouchableOpacity>);
|
|
44
|
+
};
|
|
45
|
+
exports.NavigationListRow = NavigationListRow;
|
|
46
|
+
exports.default = exports.NavigationListRow;
|
|
47
|
+
const useStyles = () => (0, useThemedStyle_1.useThemedStyle)((0, react_1.useCallback)((t) => react_native_1.StyleSheet.create({
|
|
48
|
+
content: {
|
|
49
|
+
flexGrow: 1,
|
|
50
|
+
},
|
|
51
|
+
container: {
|
|
52
|
+
width: "100%",
|
|
53
|
+
flexDirection: "row",
|
|
54
|
+
paddingVertical: t.size.baseSize * 2,
|
|
55
|
+
paddingHorizontal: t.size.baseSize * 4,
|
|
56
|
+
},
|
|
57
|
+
chevronRight: {
|
|
58
|
+
height: "100%",
|
|
59
|
+
flexGrow: 0,
|
|
60
|
+
},
|
|
61
|
+
chevronRightTint: {
|
|
62
|
+
color: t.colors.foregroundLowContrast,
|
|
63
|
+
},
|
|
64
|
+
}), []));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Option } from "./types";
|
|
3
|
+
type Props<T> = {
|
|
4
|
+
caption?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
options: Option<T>[];
|
|
7
|
+
onChange: (newValue: Option<T>) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function SelectInput<T>({ caption, label, options, onChange, }: Props<T>): React.JSX.Element;
|
|
10
|
+
export default SelectInput;
|