atlas-design-system 1.18.0 → 1.18.1

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
+ ```
@@ -61,6 +61,7 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
61
61
  const { styles, theme } = useStyles(disabled);
62
62
  const [dateSheetOpen, setDateSheetOpen] = (0, react_1.useState)(false);
63
63
  const [date, setDate] = (0, react_1.useState)(value);
64
+ const isInitialMount = (0, react_1.useRef)(true);
64
65
  (0, react_1.useEffect)(() => {
65
66
  if (dateSheetOpen) {
66
67
  return;
@@ -69,6 +70,18 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
69
70
  }, [dateSheetOpen, value]);
70
71
  const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
71
72
  const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
73
+ (0, react_1.useEffect)(() => {
74
+ if (isInitialMount.current) {
75
+ // skip animation on initial mount we already have the value
76
+ isInitialMount.current = false;
77
+ animatedValue.value = value ? 1 : 0;
78
+ return;
79
+ }
80
+ else {
81
+ // After initial mount, animate the value changes
82
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
83
+ }
84
+ }, [value]);
72
85
  (0, react_1.useEffect)(() => {
73
86
  if (error) {
74
87
  setBorderColor(styles.itemContainerError.borderColor);
@@ -113,7 +126,7 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
113
126
  {(0, moment_1.default)(value).format(getFormat(mode)).toString()}
114
127
  </Text_1.default>
115
128
  </react_native_reanimated_1.default.View>
116
- <Ionicons_1.default style={styles.iconRight} color={!disabled
129
+ <Ionicons_1.default color={!disabled
117
130
  ? theme.colors.foreground
118
131
  : theme.colors.foregroundLowContrast} name={mode === "time" ? "time-outline" : "calendar-outline"} size={20}/>
119
132
  </react_native_reanimated_1.default.View>
@@ -121,18 +134,17 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
121
134
  {!!error && <FieldError_1.FieldError error={error}/>}
122
135
  {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
123
136
  </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) => {
137
+ <Sheet_1.default disableScroll header={label} open={dateSheetOpen} setOpen={setDateSheetOpen} footer={<Button_1.default text="Save" onPress={() => {
138
+ onSave === null || onSave === void 0 ? void 0 : onSave(date);
139
+ setDateSheetOpen(false);
140
+ }}/>}>
141
+ <datetimepicker_1.default value={date} style={styles.datePicker} mode={mode} themeVariant={theme.isDarkTheme ? "dark" : "light"} display="spinner" onChange={(_, newDate) => {
126
142
  if (!newDate) {
127
143
  return;
128
144
  }
129
145
  setDate(newDate);
130
146
  onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
131
147
  }}/>
132
- <Button_1.default text="Save" onPress={() => {
133
- onSave === null || onSave === void 0 ? void 0 : onSave(date);
134
- setDateSheetOpen(false);
135
- }}/>
136
148
  </Sheet_1.default>
137
149
  </>);
138
150
  };
@@ -140,6 +152,9 @@ exports.DateTimeInput = DateTimeInput;
140
152
  exports.default = exports.DateTimeInput;
141
153
  const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((t) => react_native_1.StyleSheet.create({
142
154
  container: {},
155
+ datePicker: {
156
+ height: t.size.baseSize * 60,
157
+ },
143
158
  itemContainer: {
144
159
  backgroundColor: t.colors.backgroundOnPrimary,
145
160
  borderRadius: t.borderRadius,
@@ -165,7 +180,6 @@ const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallb
165
180
  label: Object.assign({ color: !disabled
166
181
  ? t.colors.foregroundHighContrast
167
182
  : t.colors.foregroundLowContrast }, t.typography.p1),
168
- iconRight: {},
169
183
  value: {
170
184
  paddingHorizontal: t.size.baseSize * 0,
171
185
  },
@@ -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; } });
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.1",
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",