atlas-design-system 1.13.0 → 1.15.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.
@@ -34,7 +34,7 @@ const Sheet_1 = __importDefault(require("../Sheet"));
34
34
  const Text_1 = __importDefault(require("../Text"));
35
35
  const Chevron_1 = __importDefault(require("../Chevron"));
36
36
  const MenuItemDescription_1 = require("../MenuItemDescription");
37
- const CheckboxOptionItem_1 = __importDefault(require("../CheckboxOptionItem"));
37
+ const CheckboxOptionItem_1 = require("../CheckboxOptionItem");
38
38
  const Button_1 = __importDefault(require("../Button"));
39
39
  function CheckboxOptionInput({ caption, label, options = [], onChange, renderOption, renderValues, containerStyle = {}, placeholder = "No Option selected", }) {
40
40
  const styles = useStyles().styles;
@@ -73,7 +73,7 @@ function CheckboxOptionInput({ caption, label, options = [], onChange, renderOpt
73
73
  </react_native_1.View>
74
74
  <Sheet_1.default header={label} open={sheetOpen} setOpen={setSheetOpen} footer={<Button_1.default text="Save" onPress={handleSave}/>}>
75
75
  {options.map((option) => {
76
- return renderOption ? (renderOption(option, handleOptionPress)) : (<CheckboxOptionItem_1.default option={Object.assign(Object.assign({}, option), { selected: !!values.find((v) => v === option.value) })} onPress={() => handleOptionPress(option)} key={option.label}/>);
76
+ return renderOption ? (renderOption(option, handleOptionPress)) : (<CheckboxOptionItem_1.CheckboxOptionItem option={Object.assign(Object.assign({}, option), { selected: !!values.find((v) => v === option.value) })} onPress={() => handleOptionPress(option)} key={option.label}/>);
77
77
  })}
78
78
  </Sheet_1.default>
79
79
  </>);
@@ -1,9 +1,8 @@
1
1
  import { Option } from "../SelectInput/types";
2
- type CheckboxOptionItemProps<T> = {
2
+ export type CheckboxOptionItemProps<T> = {
3
3
  option: Option<T>;
4
4
  disabled?: boolean;
5
5
  onPress?: (value: T) => void;
6
6
  renderItem?: (option: Option<T>) => React.ReactNode;
7
7
  };
8
8
  export default function CheckboxOptionItem<T>({ option, onPress, renderItem, disabled, }: CheckboxOptionItemProps<T>): import("react").JSX.Element;
9
- export {};
@@ -1,2 +1,2 @@
1
- export { default } from "./CheckboxOptionItem";
1
+ export { default as CheckboxOptionItem } from "./CheckboxOptionItem";
2
2
  export * from "./CheckboxOptionItem";
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.default = void 0;
20
+ exports.CheckboxOptionItem = void 0;
21
21
  var CheckboxOptionItem_1 = require("./CheckboxOptionItem");
22
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CheckboxOptionItem_1).default; } });
22
+ Object.defineProperty(exports, "CheckboxOptionItem", { enumerable: true, get: function () { return __importDefault(CheckboxOptionItem_1).default; } });
23
23
  __exportStar(require("./CheckboxOptionItem"), exports);
@@ -153,7 +153,7 @@ const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallb
153
153
  position: "absolute",
154
154
  },
155
155
  label: Object.assign({ color: !disabled
156
- ? t.colors.foreground
156
+ ? t.colors.foregroundHighContrast
157
157
  : t.colors.foregroundLowContrast }, t.typography.p1),
158
158
  iconRight: {},
159
159
  value: {
@@ -10,6 +10,8 @@ export type TextInputProps = {
10
10
  label: string;
11
11
  containerStyle?: StyleProp<ViewStyle>;
12
12
  error?: string;
13
+ multiline?: boolean;
14
+ numberOfLines?: number;
13
15
  } & Omit<RNTextInputProps, "onBlur">;
14
16
  export declare const TextInput: React.ForwardRefExoticComponent<{
15
17
  disabled?: boolean;
@@ -21,5 +23,7 @@ export declare const TextInput: React.ForwardRefExoticComponent<{
21
23
  label: string;
22
24
  containerStyle?: StyleProp<ViewStyle>;
23
25
  error?: string;
26
+ multiline?: boolean;
27
+ numberOfLines?: number;
24
28
  } & Omit<RNTextInputProps, "onBlur"> & React.RefAttributes<unknown>>;
25
29
  export default TextInput;
@@ -66,8 +66,8 @@ const getTextInputStyle = (disabled, error, style) => {
66
66
  return style.default;
67
67
  };
68
68
  exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
69
- var { caption, keyboardType, onChangeText, testId, value, label, onBlur, containerStyle, disabled = false, error } = _a, rest = __rest(_a, ["caption", "keyboardType", "onChangeText", "testId", "value", "label", "onBlur", "containerStyle", "disabled", "error"]);
70
- const { styles, theme } = useStyles(disabled, !!error);
69
+ var { caption, keyboardType, onChangeText, testId, value, label, onBlur, containerStyle, disabled = false, error, multiline, numberOfLines } = _a, rest = __rest(_a, ["caption", "keyboardType", "onChangeText", "testId", "value", "label", "onBlur", "containerStyle", "disabled", "error", "multiline", "numberOfLines"]);
70
+ const { styles, theme } = useStyles(disabled, !!error, !!multiline);
71
71
  const inputRef = (0, react_1.useRef)(null);
72
72
  (0, react_1.useImperativeHandle)(ref, () => ({
73
73
  focus: () => {
@@ -152,7 +152,7 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
152
152
  </react_native_reanimated_1.default.Text>
153
153
  </react_native_1.View>
154
154
  <react_native_reanimated_1.default.View style={animatedInputStyles}>
155
- {disabled ? (<Text_1.default style={styles.text}>{value}</Text_1.default>) : (<react_native_1.TextInput ref={inputRef} testID={testId} value={value} style={styles.textInput} numberOfLines={1} keyboardType={keyboardType} onChangeText={handleOnChangeText} maxLength={40} returnKeyType="done" onBlur={handleOnBlur} onFocus={onFocus} keyboardAppearance={theme.keyboardAppearance} {...rest}/>)}
155
+ {disabled ? (<Text_1.default style={styles.text}>{value}</Text_1.default>) : (<react_native_1.TextInput ref={inputRef} testID={testId} value={value} style={styles.textInput} numberOfLines={numberOfLines} multiline={multiline} keyboardType={keyboardType} onChangeText={handleOnChangeText} maxLength={40} returnKeyType="done" onBlur={handleOnBlur} onFocus={onFocus} keyboardAppearance={theme.keyboardAppearance} {...rest}/>)}
156
156
  </react_native_reanimated_1.default.View>
157
157
  </react_native_reanimated_1.default.View>
158
158
  </react_native_1.Pressable>
@@ -162,7 +162,7 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
162
162
  });
163
163
  exports.default = exports.TextInput;
164
164
  exports.TextInput.displayName = "TextInput";
165
- const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
165
+ const useStyles = (disabled, error, multiline) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
166
166
  container: {
167
167
  width: "100%",
168
168
  flexShrink: 0.5,
@@ -171,7 +171,7 @@ const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.u
171
171
  flexGrow: 2,
172
172
  flexShrink: 1,
173
173
  },
174
- textInput: Object.assign(Object.assign({ paddingHorizontal: theme.size.baseSize * 2 }, theme.typography.p1), getTextInputStyle(disabled, error, {
174
+ textInput: Object.assign(Object.assign({ paddingHorizontal: theme.size.baseSize * 2, height: multiline ? "95%" : "auto" }, theme.typography.p1), getTextInputStyle(disabled, error, {
175
175
  disabled: {
176
176
  color: theme.colors.foregroundLowContrast,
177
177
  },
@@ -196,7 +196,9 @@ const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.u
196
196
  itemContainer: {
197
197
  borderWidth: theme.borderWidth,
198
198
  backgroundColor: theme.colors.backgroundOnPrimary,
199
- height: theme.size.baseSize * 9,
199
+ height: multiline
200
+ ? theme.size.baseSize * 24
201
+ : theme.size.baseSize * 9,
200
202
  borderRadius: theme.borderRadius,
201
203
  minHeight: theme.size.baseSize * 8,
202
204
  flexDirection: "row",
@@ -211,10 +213,11 @@ const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.u
211
213
  },
212
214
  labelContainer: {
213
215
  left: theme.size.baseSize * 2,
216
+ top: multiline ? theme.size.baseSize * 1 : theme.size.baseSize * 2,
214
217
  position: "absolute",
215
218
  },
216
219
  label: getLabelStyle(disabled, error, {
217
- default: Object.assign({ color: theme.colors.foreground }, theme.typography.p1),
220
+ default: Object.assign({ color: theme.colors.foregroundHighContrast }, theme.typography.p1),
218
221
  disabled: Object.assign({ color: theme.colors.foregroundLowContrast }, theme.typography.p1),
219
222
  error: Object.assign({ color: theme.colors.foregroundNegative }, theme.typography.p1),
220
223
  }),
@@ -222,4 +225,4 @@ const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.u
222
225
  marginHorizontal: theme.size.baseSize * 4,
223
226
  marginBottom: theme.size.baseSize * 2,
224
227
  },
225
- }), [disabled, error]));
228
+ }), [disabled, error, multiline]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas-design-system",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
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",