atlas-design-system 1.18.0 → 1.18.2

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 CHANGED
@@ -4,45 +4,71 @@ Designed for Atlas Workout app and EzBudget budget app.
4
4
 
5
5
  <img width=300 alt="screenshot" src="https://github.com/juancstlm/AtlasDesignSystem/blob/master/example/assets/images/iPhone-example.png?raw=true"></img>
6
6
 
7
- ## Usage
7
+ ## Installation
8
8
 
9
- Ensure your app has the `peerDependencies` installed
9
+ Atlas Design System relies on a few peer dependencies that need to be present in your project. Install everything at once with **npm**:
10
10
 
11
- ```javascript
12
- //...
13
- //1. Import the ThemeContext and a theme. You can make your own or use the provided light theme ATLAS_LIGHT
14
- import { ThemeContext, ATLAS_LIGHT } from "atlas-design-system";
11
+ ```bash
12
+ npm install atlas-design-system @react-native-community/datetimepicker informed moment react-native-reanimated react-native-safe-area-context react-native-vector-icons
13
+ ```
14
+
15
+ —or with **Yarn**:
16
+
17
+ ```bash
18
+ yarn add atlas-design-system @react-native-community/datetimepicker informed moment react-native-reanimated react-native-safe-area-context react-native-vector-icons
19
+ ```
20
+
21
+ After the packages are installed, make sure to install the iOS pods:
22
+
23
+ ```bash
24
+ npx pod-install ios
25
+ ```
15
26
 
16
- export default function MyThemedApp(){
27
+ Using **Expo**? You can rely on `expo install` to ensure the correct versions:
17
28
 
18
- return (
19
- // 2. Wrap your app with the ThemeContext.Provider and provide your theme
20
- <ThemeContext.Provider value={ATLAS_LIGHT}>
21
- <MyApp>
22
- </ThemeContext.Provider>
23
- );
29
+ ```bash
30
+ expo install atlas-design-system @react-native-community/datetimepicker react-native-reanimated react-native-safe-area-context react-native-vector-icons
31
+ ```
32
+
33
+ > **Note**
34
+ > • React Native ≥ 0.64 is required.
35
+ > • Follow the React-Native-Reanimated [installation guide](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/) and enable the Babel plugin if you haven't already.
36
+
37
+ ## Usage
38
+
39
+ ```tsx
40
+ // 1. Import the ThemeContext and a theme. You can make your own or use the provided light theme ATLAS_LIGHT
41
+ import { ThemeContext, ATLAS_LIGHT } from "atlas-design-system";
42
+
43
+ export default function MyThemedApp() {
44
+ return (
45
+ // 2. Wrap your app with the ThemeContext.Provider and provide your theme
46
+ <ThemeContext.Provider value={ATLAS_LIGHT}>
47
+ <MyApp />
48
+ </ThemeContext.Provider>
49
+ );
24
50
  }
25
51
  ```
26
52
 
27
- ```javascript
53
+ ```tsx
28
54
  import { Text } from "atlas-design-system";
29
55
  import { View } from "react-native";
30
56
 
31
57
  // 3. Use the components
32
58
  export default function MyApp() {
33
- return (
34
- <View>
35
- <Text category="h1" >Welcome to My App</Text>
36
- </View>
37
- )
59
+ return (
60
+ <View>
61
+ <Text category="h1">Welcome to My App</Text>
62
+ </View>
63
+ );
38
64
  }
39
65
  ```
40
66
 
41
- # Running exmple app
42
- The example app is provided as a way to test and develop on the design system. It is also used as a gallery to view all the components and features of the desgin system.
67
+ ## Running the example app
68
+ The example app is provided as a way to test and develop the design system. It also serves as a gallery showcasing all the components and features.
43
69
 
44
- To run the example app run the following command
45
- ```bash
46
- cd /example && yarn && yarn ios
47
- ```
70
+ To run the example app, execute:
48
71
 
72
+ ```bash
73
+ cd example && yarn && yarn ios
74
+ ```
@@ -0,0 +1,18 @@
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
+ error?: string;
15
+ display?: IOSNativeProps["display"] | AndroidNativeProps["display"];
16
+ };
17
+ declare const DateTimeInput: ({ value, onChange, testID, containerStyle, label, caption, mode, error, disabled, onSave, }: DateTimeInputProps) => React.JSX.Element;
18
+ export default DateTimeInput;
@@ -0,0 +1,191 @@
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
+ const react_1 = __importStar(require("react"));
30
+ const datetimepicker_1 = __importDefault(require("@react-native-community/datetimepicker"));
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 moment_1 = __importDefault(require("moment"));
35
+ const Sheet_1 = __importDefault(require("../Sheet"));
36
+ const Text_1 = __importDefault(require("../Text"));
37
+ const MenuItemDescription_1 = require("../MenuItemDescription");
38
+ const hooks_1 = require("../../hooks");
39
+ const Button_1 = __importDefault(require("../Button"));
40
+ const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
41
+ const FieldError_1 = require("../FieldError/FieldError");
42
+ const animations_1 = require("../../constants/animations");
43
+ const constants_1 = require("../../constants");
44
+ const useInputFieldFontSizeInterpolationOutputRange_1 = require("../../hooks/useInputFieldFontSizeInterpolationOutputRange");
45
+ const getFormat = (mode) => {
46
+ switch (mode) {
47
+ case "date": {
48
+ return "MMM D, YYYY";
49
+ }
50
+ case "time": {
51
+ return "h:mm A";
52
+ }
53
+ case "datetime":
54
+ default: {
55
+ return "MMM D, YYYY h:mm A";
56
+ }
57
+ }
58
+ };
59
+ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption, mode = "date", error, disabled = false, onSave, }) => {
60
+ const { styles, theme } = useStyles(disabled);
61
+ const [dateSheetOpen, setDateSheetOpen] = (0, react_1.useState)(false);
62
+ const [date, setDate] = (0, react_1.useState)(value);
63
+ const isInitialMount = (0, react_1.useRef)(true);
64
+ (0, react_1.useEffect)(() => {
65
+ if (dateSheetOpen) {
66
+ return;
67
+ }
68
+ setDate(value);
69
+ }, [dateSheetOpen, value]);
70
+ const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
71
+ const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
72
+ (0, react_1.useEffect)(() => {
73
+ if (isInitialMount.current) {
74
+ // skip animation on initial mount we already have the value
75
+ isInitialMount.current = false;
76
+ animatedValue.value = value ? 1 : 0;
77
+ return;
78
+ }
79
+ else {
80
+ // After initial mount, animate the value changes
81
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
82
+ }
83
+ }, [value]);
84
+ (0, react_1.useEffect)(() => {
85
+ if (error) {
86
+ setBorderColor(styles.itemContainerError.borderColor);
87
+ return;
88
+ }
89
+ setBorderColor(dateSheetOpen
90
+ ? styles.itemContainerFocused.borderColor
91
+ : styles.itemContainer.borderColor);
92
+ }, [error, dateSheetOpen]);
93
+ const labelFontSizeInterpolationOutputRange = (0, useInputFieldFontSizeInterpolationOutputRange_1.useInputFieldFontSizeInterpolationOutputRange)();
94
+ const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
95
+ return {
96
+ transform: [
97
+ {
98
+ translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE),
99
+ },
100
+ ],
101
+ fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, labelFontSizeInterpolationOutputRange),
102
+ };
103
+ }, [labelFontSizeInterpolationOutputRange]);
104
+ const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
105
+ return {
106
+ flex: 1,
107
+ transform: [
108
+ {
109
+ translateY: animatedValue.value * animations_1.ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER,
110
+ },
111
+ ],
112
+ };
113
+ });
114
+ return (<>
115
+ <react_native_1.View testID={testID} style={[styles.container, containerStyle]}>
116
+ <react_native_1.TouchableOpacity onPress={() => setDateSheetOpen(true)} disabled={disabled}>
117
+ <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedBorderStyle]}>
118
+ <react_native_1.View pointerEvents="none" style={styles.labelContainer}>
119
+ <react_native_reanimated_1.default.Text style={[styles.label, animatedLabelStyles]}>
120
+ {label}
121
+ </react_native_reanimated_1.default.Text>
122
+ </react_native_1.View>
123
+ <react_native_reanimated_1.default.View style={animatedValueStyle}>
124
+ <Text_1.default contrast="low" style={styles.value}>
125
+ {(0, moment_1.default)(value).format(getFormat(mode)).toString()}
126
+ </Text_1.default>
127
+ </react_native_reanimated_1.default.View>
128
+ <Ionicons_1.default color={!disabled
129
+ ? theme.colors.foreground
130
+ : theme.colors.foregroundLowContrast} name={mode === "time" ? "time-outline" : "calendar-outline"} size={20}/>
131
+ </react_native_reanimated_1.default.View>
132
+ </react_native_1.TouchableOpacity>
133
+ {!!error && <FieldError_1.FieldError error={error}/>}
134
+ {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
135
+ </react_native_1.View>
136
+ <Sheet_1.default disableScroll header={label} open={dateSheetOpen} setOpen={setDateSheetOpen} footerPadding={70} footer={<Button_1.default text="Save" onPress={() => {
137
+ onSave === null || onSave === void 0 ? void 0 : onSave(date);
138
+ setDateSheetOpen(false);
139
+ }}/>}>
140
+ <react_native_1.View style={styles.pickerContainer}>
141
+ <datetimepicker_1.default value={date} style={styles.datePicker} mode={mode} themeVariant={theme.isDarkTheme ? "dark" : "light"} display="spinner" onChange={(_, newDate) => {
142
+ if (!newDate) {
143
+ return;
144
+ }
145
+ setDate(newDate);
146
+ onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
147
+ }}/>
148
+ </react_native_1.View>
149
+ </Sheet_1.default>
150
+ </>);
151
+ };
152
+ exports.default = DateTimeInput;
153
+ const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((t) => react_native_1.StyleSheet.create({
154
+ container: {},
155
+ pickerContainer: {
156
+ justifyContent: "center",
157
+ alignItems: "center",
158
+ height: t.size.baseSize * 40,
159
+ },
160
+ datePicker: {
161
+ flex: 1,
162
+ },
163
+ itemContainer: {
164
+ backgroundColor: t.colors.backgroundOnPrimary,
165
+ borderRadius: t.borderRadius,
166
+ paddingHorizontal: t.size.baseSize * 2,
167
+ minHeight: t.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
168
+ flexDirection: "row",
169
+ justifyContent: "space-between",
170
+ alignItems: "center",
171
+ borderColor: t.colors.backgroundOnPrimary,
172
+ borderWidth: t.borderWidth,
173
+ height: t.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
174
+ },
175
+ itemContainerError: {
176
+ borderColor: t.colors.foregroundNegative,
177
+ },
178
+ itemContainerFocused: {
179
+ borderColor: t.colors.border,
180
+ },
181
+ labelContainer: {
182
+ left: t.size.baseSize * 2,
183
+ position: "absolute",
184
+ },
185
+ label: Object.assign({ color: !disabled
186
+ ? t.colors.foregroundHighContrast
187
+ : t.colors.foregroundLowContrast }, t.typography.p1),
188
+ value: {
189
+ paddingHorizontal: t.size.baseSize * 0,
190
+ },
191
+ }), [disabled]));
@@ -1,18 +1,2 @@
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
- error?: string;
15
- display?: IOSNativeProps["display"] | AndroidNativeProps["display"];
16
- };
17
- export declare const DateTimeInput: ({ value, onChange, testID, containerStyle, label, caption, mode, error, disabled, onSave, }: DateTimeInputProps) => React.JSX.Element;
18
- export default DateTimeInput;
1
+ export * from "./DateTimeInput";
2
+ export { default as DateTimeInput } from "./DateTimeInput";
@@ -10,163 +10,14 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
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;
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);
24
15
  };
25
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
18
  };
28
19
  Object.defineProperty(exports, "__esModule", { value: true });
29
20
  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
- const Ionicons_1 = __importDefault(require("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 useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
42
- const FieldError_1 = require("../FieldError/FieldError");
43
- const animations_1 = require("../../constants/animations");
44
- const constants_1 = require("../../constants");
45
- const useInputFieldFontSizeInterpolationOutputRange_1 = require("../../hooks/useInputFieldFontSizeInterpolationOutputRange");
46
- const getFormat = (mode) => {
47
- switch (mode) {
48
- case "date": {
49
- return "MMM D, YYYY";
50
- }
51
- case "time": {
52
- return "h:mm A";
53
- }
54
- case "datetime":
55
- default: {
56
- return "MMM D, YYYY h:mm A";
57
- }
58
- }
59
- };
60
- const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption, mode = "date", error, disabled = false, onSave, }) => {
61
- const { styles, theme } = useStyles(disabled);
62
- const [dateSheetOpen, setDateSheetOpen] = (0, react_1.useState)(false);
63
- const [date, setDate] = (0, react_1.useState)(value);
64
- (0, react_1.useEffect)(() => {
65
- if (dateSheetOpen) {
66
- return;
67
- }
68
- setDate(value);
69
- }, [dateSheetOpen, value]);
70
- const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
71
- const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
72
- (0, react_1.useEffect)(() => {
73
- if (error) {
74
- setBorderColor(styles.itemContainerError.borderColor);
75
- return;
76
- }
77
- setBorderColor(dateSheetOpen
78
- ? styles.itemContainerFocused.borderColor
79
- : styles.itemContainer.borderColor);
80
- }, [error, dateSheetOpen]);
81
- const labelFontSizeInterpolationOutputRange = (0, useInputFieldFontSizeInterpolationOutputRange_1.useInputFieldFontSizeInterpolationOutputRange)();
82
- const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
83
- return {
84
- transform: [
85
- {
86
- translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE),
87
- },
88
- ],
89
- fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, labelFontSizeInterpolationOutputRange),
90
- };
91
- }, [labelFontSizeInterpolationOutputRange]);
92
- const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
93
- return {
94
- flex: 1,
95
- transform: [
96
- {
97
- translateY: animatedValue.value * animations_1.ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER,
98
- },
99
- ],
100
- };
101
- });
102
- return (<>
103
- <react_native_1.View testID={testID} style={[styles.container, containerStyle]}>
104
- <react_native_1.TouchableOpacity onPress={() => setDateSheetOpen(true)} disabled={disabled}>
105
- <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedBorderStyle]}>
106
- <react_native_1.View pointerEvents="none" style={styles.labelContainer}>
107
- <react_native_reanimated_1.default.Text style={[styles.label, animatedLabelStyles]}>
108
- {label}
109
- </react_native_reanimated_1.default.Text>
110
- </react_native_1.View>
111
- <react_native_reanimated_1.default.View style={animatedValueStyle}>
112
- <Text_1.default contrast="low" style={styles.value}>
113
- {(0, moment_1.default)(value).format(getFormat(mode)).toString()}
114
- </Text_1.default>
115
- </react_native_reanimated_1.default.View>
116
- <Ionicons_1.default style={styles.iconRight} color={!disabled
117
- ? theme.colors.foreground
118
- : theme.colors.foregroundLowContrast} name={mode === "time" ? "time-outline" : "calendar-outline"} size={20}/>
119
- </react_native_reanimated_1.default.View>
120
- </react_native_1.TouchableOpacity>
121
- {!!error && <FieldError_1.FieldError error={error}/>}
122
- {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
123
- </react_native_1.View>
124
- <Sheet_1.default disableScroll header={label} open={dateSheetOpen} setOpen={setDateSheetOpen}>
125
- <datetimepicker_1.default value={date} mode={mode} themeVariant={theme.isDarkTheme ? "dark" : "light"} display="spinner" onChange={(_, newDate) => {
126
- if (!newDate) {
127
- return;
128
- }
129
- setDate(newDate);
130
- onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
131
- }}/>
132
- <Button_1.default text="Save" onPress={() => {
133
- onSave === null || onSave === void 0 ? void 0 : onSave(date);
134
- setDateSheetOpen(false);
135
- }}/>
136
- </Sheet_1.default>
137
- </>);
138
- };
139
- exports.DateTimeInput = DateTimeInput;
140
- exports.default = exports.DateTimeInput;
141
- const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((t) => react_native_1.StyleSheet.create({
142
- container: {},
143
- itemContainer: {
144
- backgroundColor: t.colors.backgroundOnPrimary,
145
- borderRadius: t.borderRadius,
146
- paddingHorizontal: t.size.baseSize * 2,
147
- minHeight: t.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
148
- flexDirection: "row",
149
- justifyContent: "space-between",
150
- alignItems: "center",
151
- borderColor: t.colors.backgroundOnPrimary,
152
- borderWidth: t.borderWidth,
153
- height: t.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
154
- },
155
- itemContainerError: {
156
- borderColor: t.colors.foregroundNegative,
157
- },
158
- itemContainerFocused: {
159
- borderColor: t.colors.border,
160
- },
161
- labelContainer: {
162
- left: t.size.baseSize * 2,
163
- position: "absolute",
164
- },
165
- label: Object.assign({ color: !disabled
166
- ? t.colors.foregroundHighContrast
167
- : t.colors.foregroundLowContrast }, t.typography.p1),
168
- iconRight: {},
169
- value: {
170
- paddingHorizontal: t.size.baseSize * 0,
171
- },
172
- }), [disabled]));
21
+ __exportStar(require("./DateTimeInput"), exports);
22
+ var DateTimeInput_1 = require("./DateTimeInput");
23
+ Object.defineProperty(exports, "DateTimeInput", { enumerable: true, get: function () { return __importDefault(DateTimeInput_1).default; } });
@@ -1,15 +1,14 @@
1
1
  import React from "react";
2
- import { ViewStyle, ReturnKeyType, StyleProp } from "react-native";
3
- type Props = {
2
+ import { ViewStyle, ReturnKeyType, StyleProp, TextInputProps } from "react-native";
3
+ type SearchProps = {
4
4
  searchQuery: string;
5
5
  onChangeText: (text: string) => void;
6
6
  rightComponent?: React.ReactNode;
7
7
  onPressFilter?: () => void;
8
8
  placeholder?: string;
9
9
  label: string;
10
- autoFocus?: boolean;
11
10
  containerStyle?: StyleProp<ViewStyle>;
12
11
  returnKeyType?: ReturnKeyType;
13
- };
14
- export declare const Search: ({ searchQuery, onChangeText, placeholder, autoFocus, containerStyle, returnKeyType, label, }: Props) => React.JSX.Element;
12
+ } & Omit<TextInputProps, "returnKeyType" | "onFocus" | "onBlur" | "onChangeText">;
13
+ declare const Search: ({ searchQuery, onChangeText, placeholder, containerStyle, returnKeyType, label, ...rest }: SearchProps) => React.JSX.Element;
15
14
  export default Search;
@@ -22,15 +22,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
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
+ };
25
36
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Search = void 0;
27
37
  const react_1 = __importStar(require("react"));
28
38
  const react_native_1 = require("react-native");
29
39
  const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
30
40
  const components_1 = require("../../components");
31
41
  const hooks_1 = require("../../hooks");
32
42
  const CANCEL_BUTTON_WIDTH = 62;
33
- const Search = ({ searchQuery, onChangeText, placeholder, autoFocus, containerStyle = {}, returnKeyType, label, }) => {
43
+ const Search = (_a) => {
44
+ var { searchQuery, onChangeText, placeholder, containerStyle = {}, returnKeyType, label } = _a, rest = __rest(_a, ["searchQuery", "onChangeText", "placeholder", "containerStyle", "returnKeyType", "label"]);
34
45
  const { styles } = useStyles();
35
46
  const inputRef = (0, react_1.useRef)(null);
36
47
  const [minWidth, setMinWidth] = (0, react_1.useState)(0);
@@ -53,7 +64,7 @@ const Search = ({ searchQuery, onChangeText, placeholder, autoFocus, containerSt
53
64
  }), [focused, minWidth]);
54
65
  const onPressCancel = (0, react_1.useCallback)(() => {
55
66
  var _a;
56
- onChangeText('');
67
+ onChangeText("");
57
68
  // @ts-expect-error not yet typed
58
69
  (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
59
70
  }, [inputRef]);
@@ -62,7 +73,7 @@ const Search = ({ searchQuery, onChangeText, placeholder, autoFocus, containerSt
62
73
  };
63
74
  return (<react_native_1.View style={[styles.searchBarContainer, containerStyle]} onLayout={onLayout}>
64
75
  <react_native_reanimated_1.default.View style={[animatedSearchInput, styles.animatedContainer]}>
65
- <components_1.TextInput ref={inputRef} autoCapitalize="words" value={searchQuery} onFocus={onFocus} onBlur={onBlur} autoFocus={autoFocus} returnKeyType={returnKeyType !== null && returnKeyType !== void 0 ? returnKeyType : "search"} label={label || placeholder || "Enter search term"} onChangeText={onChangeText}/>
76
+ <components_1.TextInput ref={inputRef} value={searchQuery} onFocus={onFocus} onBlur={onBlur} returnKeyType={returnKeyType !== null && returnKeyType !== void 0 ? returnKeyType : "search"} label={label || placeholder || "Enter search term"} onChangeText={onChangeText} {...rest}/>
66
77
  </react_native_reanimated_1.default.View>
67
78
  <react_native_reanimated_1.default.View style={animatedCancelButtonStyle}>
68
79
  <react_native_1.TouchableOpacity style={styles.cancelButton} onPress={onPressCancel}>
@@ -71,8 +82,7 @@ const Search = ({ searchQuery, onChangeText, placeholder, autoFocus, containerSt
71
82
  </react_native_reanimated_1.default.View>
72
83
  </react_native_1.View>);
73
84
  };
74
- exports.Search = Search;
75
- exports.default = exports.Search;
85
+ exports.default = Search;
76
86
  const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
77
87
  searchBarContainer: {
78
88
  flexDirection: "row",
@@ -1 +1,2 @@
1
- export * from './Search';
1
+ export * from "./Search";
2
+ export { default as Search } from "./Search";
@@ -13,5 +13,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
16
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.Search = void 0;
17
21
  __exportStar(require("./Search"), exports);
22
+ var Search_1 = require("./Search");
23
+ Object.defineProperty(exports, "Search", { enumerable: true, get: function () { return __importDefault(Search_1).default; } });
@@ -10,6 +10,7 @@ type Props = {
10
10
  transparent?: boolean;
11
11
  disableScroll?: boolean;
12
12
  footer?: React.ReactNode;
13
+ footerPadding?: number;
13
14
  };
14
- export declare const Sheet: ({ open, setOpen, children, containerStyle, defaultMargins, header, transparent, disableScroll, footer, }: Props) => React.JSX.Element | null;
15
+ export declare const Sheet: ({ open, setOpen, children, containerStyle, defaultMargins, header, transparent, disableScroll, footer, footerPadding, }: Props) => React.JSX.Element | null;
15
16
  export default Sheet;
@@ -34,9 +34,9 @@ const react_native_safe_area_context_1 = require("react-native-safe-area-context
34
34
  const useThemedStyle_1 = require("../../hooks/useThemedStyle");
35
35
  const Text_1 = __importDefault(require("../Text"));
36
36
  const BACKGROUND_OPACITY = 0.6;
37
- const Sheet = ({ open, setOpen, children, containerStyle, defaultMargins = true, header, transparent = false, disableScroll = false, footer, }) => {
38
- const [footerHeight, setFooterHeight] = (0, react_1.useState)(0);
39
- const styles = useStyles(defaultMargins, footerHeight).styles;
37
+ const Sheet = ({ open, setOpen, children, containerStyle, defaultMargins = true, header, transparent = false, disableScroll = false, footer, footerPadding = 0, }) => {
38
+ const [footerHeight, setFooterHeight] = (0, react_1.useState)(footerPadding);
39
+ const styles = useStyles(defaultMargins, footerPadding ? footerPadding : footerHeight).styles;
40
40
  const [visible, setVisible] = (0, react_1.useState)(open);
41
41
  const opacity = (0, react_native_reanimated_1.useSharedValue)(0);
42
42
  (0, react_1.useEffect)(() => {
@@ -74,14 +74,22 @@ const Sheet = ({ open, setOpen, children, containerStyle, defaultMargins = true,
74
74
  {!!header && (<react_native_1.View style={styles.headerContainer}>
75
75
  <Text_1.default>{header}</Text_1.default>
76
76
  </react_native_1.View>)}
77
- <react_native_1.ScrollView scrollEnabled={!disableScroll} contentContainerStyle={[
78
- styles.contentContainer,
79
- !!footer && styles.containerWithFooter,
80
- ]}>
81
- {children}
82
- </react_native_1.ScrollView>
77
+ {!disableScroll && (<react_native_1.ScrollView scrollEnabled={!disableScroll} contentContainerStyle={[
78
+ styles.contentContainer,
79
+ !!footer && styles.containerWithFooter,
80
+ ]}>
81
+ {children}
82
+ </react_native_1.ScrollView>)}
83
+ {disableScroll && (<react_native_1.View style={[
84
+ styles.contentContainer,
85
+ !!footer && styles.containerWithFooter,
86
+ ]}>
87
+ {children}
88
+ </react_native_1.View>)}
83
89
  {!!footer && (<react_native_1.View onLayout={(e) => {
84
- setFooterHeight(e.nativeEvent.layout.height);
90
+ if (footerPadding === 0) {
91
+ setFooterHeight(e.nativeEvent.layout.height);
92
+ }
85
93
  }} style={styles.footer}>
86
94
  {footer}
87
95
  </react_native_1.View>)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas-design-system",
3
- "version": "1.18.0",
3
+ "version": "1.18.2",
4
4
  "description": "A react native design system for the Atlas workout app",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,7 +21,8 @@
21
21
  "minor": "npm version minor",
22
22
  "watch": "tsc --watch",
23
23
  "publish:dryrun": "npm publish --dry-run",
24
- "publish:real": "yarn build && npm publish"
24
+ "publish:real": "yarn build && yarn publish",
25
+ "postinstall": "npx pod-install"
25
26
  },
26
27
  "keywords": [
27
28
  "react-native",