atlas-design-system 1.4.0 → 1.4.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.
Files changed (32) hide show
  1. package/dist/components/DateTimeInput/index.d.ts +2 -1
  2. package/dist/components/DateTimeInput/index.js +24 -8
  3. package/dist/components/FieldError/FieldError.d.ts +5 -0
  4. package/dist/components/FieldError/FieldError.js +22 -0
  5. package/dist/components/Forms/FormDateTimeInput/FormDateTimeInput.js +4 -2
  6. package/dist/components/Forms/FormSelectInput/FormSelectInput.d.ts +3 -0
  7. package/dist/components/Forms/FormSelectInput/FormSelectInput.js +24 -0
  8. package/dist/components/Forms/FormSelectInput/index.d.ts +1 -0
  9. package/dist/components/{NumericKeyboard → Forms/FormSelectInput}/index.js +1 -1
  10. package/dist/components/Forms/FormTextInput/FormTextInput.js +5 -2
  11. package/dist/components/Forms/index.d.ts +1 -0
  12. package/dist/components/Forms/index.js +1 -0
  13. package/dist/components/SelectInput/SelectInput.d.ts +3 -2
  14. package/dist/components/SelectInput/SelectInput.js +21 -14
  15. package/dist/components/SwitchToggle/index.d.ts +2 -1
  16. package/dist/components/SwitchToggle/index.js +39 -6
  17. package/dist/components/TextInput/TextInput.d.ts +2 -0
  18. package/dist/components/TextInput/TextInput.js +84 -42
  19. package/dist/constants/animations.d.ts +5 -0
  20. package/dist/constants/animations.js +9 -0
  21. package/dist/hooks/useInputFieldAnimatedBorder.d.ts +6 -0
  22. package/dist/hooks/useInputFieldAnimatedBorder.js +22 -0
  23. package/dist/hooks/usePrevious.d.ts +1 -0
  24. package/dist/hooks/usePrevious.js +16 -0
  25. package/dist/shared/styles/index.d.ts +2 -0
  26. package/dist/shared/styles/index.js +2 -0
  27. package/package.json +1 -1
  28. package/dist/components/NumericKeyboard/NumericKeyboard.d.ts +0 -11
  29. package/dist/components/NumericKeyboard/NumericKeyboard.js +0 -170
  30. package/dist/components/NumericKeyboard/index.d.ts +0 -1
  31. package/dist/hooks/useStylesCreator.d.ts +0 -2
  32. package/dist/hooks/useStylesCreator.js +0 -9
@@ -10,6 +10,7 @@ export type DateTimeInputProps = {
10
10
  testID?: string;
11
11
  containerStyle?: StyleProp<ViewStyle>;
12
12
  mode?: IOSNativeProps['mode'] | AndroidNativeProps['mode'];
13
+ error?: string;
13
14
  };
14
- export declare const DateTimeInput: ({ value, onChange, testID, containerStyle, label, caption, mode, disabled, onSave, }: DateTimeInputProps) => import("react").JSX.Element;
15
+ export declare const DateTimeInput: ({ value, onChange, testID, containerStyle, label, caption, mode, error, disabled, onSave, }: DateTimeInputProps) => import("react").JSX.Element;
15
16
  export default DateTimeInput;
@@ -38,6 +38,8 @@ const Text_1 = __importDefault(require("../Text"));
38
38
  const MenuItemDescription_1 = require("../MenuItemDescription");
39
39
  const hooks_1 = require("../../hooks");
40
40
  const Button_1 = __importDefault(require("../Button"));
41
+ const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
42
+ const FieldError_1 = require("../FieldError/FieldError");
41
43
  const getFormat = (mode) => {
42
44
  switch (mode) {
43
45
  case 'date': {
@@ -52,7 +54,7 @@ const getFormat = (mode) => {
52
54
  }
53
55
  }
54
56
  };
55
- const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption, mode = 'date', disabled = false, onSave, }) => {
57
+ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption, mode = 'date', error, disabled = false, onSave, }) => {
56
58
  const { styles, theme } = useStyles(disabled);
57
59
  const [dateSheetOpen, setDateSheetOpen] = (0, react_1.useState)(false);
58
60
  const [date, setDate] = (0, react_1.useState)(value);
@@ -63,17 +65,20 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
63
65
  setDate(value);
64
66
  }, [dateSheetOpen, value]);
65
67
  const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
68
+ const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
69
+ (0, react_1.useEffect)(() => {
70
+ if (error) {
71
+ setBorderColor(styles.itemContainerError.borderColor);
72
+ return;
73
+ }
74
+ setBorderColor(dateSheetOpen ? styles.itemContainerFocused.borderColor : styles.itemContainer.borderColor);
75
+ }, [error, dateSheetOpen]);
66
76
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
67
77
  return {
68
78
  transform: [{ translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [1, -8]) }],
69
79
  fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [14, 10]),
70
80
  };
71
81
  }, []);
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
82
  const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
78
83
  return {
79
84
  flex: 1,
@@ -83,7 +88,7 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
83
88
  return (<>
84
89
  <react_native_1.View testID={testID} style={[styles.container, containerStyle]}>
85
90
  <react_native_1.TouchableOpacity onPress={() => setDateSheetOpen(true)} disabled={disabled}>
86
- <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedContainerStyles]}>
91
+ <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedBorderStyle]}>
87
92
  <react_native_1.View pointerEvents="none" style={styles.labelContainer}>
88
93
  <react_native_reanimated_1.default.Text style={[styles.label, animatedLabelStyles]}>{label}</react_native_reanimated_1.default.Text>
89
94
  </react_native_1.View>
@@ -95,18 +100,21 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
95
100
  <Ionicons_1.default style={styles.iconRight} color={!disabled ? theme.colors.foreground : theme.colors.foregroundLowContrast} name={mode === 'time' ? 'time-outline' : 'calendar-outline'} size={20}/>
96
101
  </react_native_reanimated_1.default.View>
97
102
  </react_native_1.TouchableOpacity>
103
+ {!!error && <FieldError_1.FieldError error={error}/>}
98
104
  {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
99
105
  </react_native_1.View>
100
106
  <Sheet_1.default disableScroll header={label} open={dateSheetOpen} setOpen={setDateSheetOpen}>
101
107
  <datetimepicker_1.default value={date} mode={mode} themeVariant={theme.isDarkTheme ? 'dark' : 'light'} display="spinner" onChange={(_, newDate) => {
108
+ console.log({ newDate });
102
109
  if (!newDate) {
103
110
  return;
104
111
  }
105
112
  setDate(newDate);
106
113
  onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
107
114
  }}/>
108
- <Button_1.default disabled={value.getTime() === date.getTime()} text="Save" onPress={() => {
115
+ <Button_1.default text="Save" onPress={() => {
109
116
  onSave === null || onSave === void 0 ? void 0 : onSave(date);
117
+ setDateSheetOpen(false);
110
118
  }}/>
111
119
  </Sheet_1.default>
112
120
  </>);
@@ -125,6 +133,14 @@ const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallb
125
133
  flexDirection: 'row',
126
134
  justifyContent: 'space-between',
127
135
  alignItems: 'center',
136
+ borderColor: t.colors.backgroundPrimary,
137
+ borderWidth: t.borderWidth,
138
+ },
139
+ itemContainerError: {
140
+ borderColor: t.colors.foregroundNegative
141
+ },
142
+ itemContainerFocused: {
143
+ borderColor: t.colors.border,
128
144
  },
129
145
  itemLabel: {
130
146
  color: t.textPrimary,
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ error: string;
3
+ };
4
+ export declare const FieldError: ({ error }: Props) => import("react").JSX.Element;
5
+ export {};
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldError = void 0;
4
+ const react_1 = require("react");
5
+ const react_native_1 = require("react-native");
6
+ const hooks_1 = require("../../hooks");
7
+ const Text_1 = require("../Text");
8
+ const FieldError = ({ error }) => {
9
+ const styles = useStyles().styles;
10
+ return (<react_native_1.View style={styles.errorContainer}>
11
+ <Text_1.Text category="p2" status="error">
12
+ {error}
13
+ </Text_1.Text>
14
+ </react_native_1.View>);
15
+ };
16
+ exports.FieldError = FieldError;
17
+ const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)(t => react_native_1.StyleSheet.create({
18
+ errorContainer: {
19
+ paddingLeft: t.size.baseSize * 1,
20
+ marginTop: t.size.baseSize * 1,
21
+ },
22
+ }), []));
@@ -4,8 +4,10 @@ exports.FormDateTimeInput = void 0;
4
4
  const informed_1 = require("informed");
5
5
  const DateTimeInput_1 = require("../../DateTimeInput");
6
6
  const FormDateTimeInput = (props) => {
7
- const { render, userProps, fieldApi, informed } = (0, informed_1.useField)(Object.assign({ type: "date" }, props));
8
- return render(<DateTimeInput_1.DateTimeInput value={informed.value} onSave={fieldApi.setValue} {...userProps}/>);
7
+ const { render, userProps, fieldApi, informed, fieldState } = (0, informed_1.useField)(Object.assign({ type: "date" }, props));
8
+ return render(<DateTimeInput_1.DateTimeInput
9
+ //@ts-expect-error no types yet
10
+ error={fieldState.error} value={informed.value} onSave={fieldApi.setValue} {...userProps}/>);
9
11
  };
10
12
  exports.FormDateTimeInput = FormDateTimeInput;
11
13
  exports.default = exports.FormDateTimeInput;
@@ -0,0 +1,3 @@
1
+ import { FieldProps } from "informed";
2
+ import { SelectInputProps } from '../../SelectInput';
3
+ export declare function FormSelectInput<T>(props: FieldProps<SelectInputProps<T>>): JSX.Element;
@@ -0,0 +1,24 @@
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.FormSelectInput = FormSelectInput;
7
+ const informed_1 = require("informed");
8
+ const SelectInput_1 = __importDefault(require("../../SelectInput"));
9
+ const react_1 = require("react");
10
+ function FormSelectInput(props) {
11
+ const { render, userProps, fieldApi, informed, fieldState } = (0, informed_1.useField)(Object.assign({}, props));
12
+ const { value } = informed;
13
+ const { error } = fieldState;
14
+ const options = (0, react_1.useMemo)(() => {
15
+ return userProps.options.map((v) => {
16
+ return Object.assign(Object.assign({}, v), { selected: v.value === value });
17
+ });
18
+ }, [userProps.options, value]);
19
+ return render(<SelectInput_1.default onChange={(v) => {
20
+ fieldApi.setValue(v.value);
21
+ }}
22
+ //@ts-expect-error no types yet :(
23
+ error={error} {...userProps} options={options}/>);
24
+ }
@@ -0,0 +1 @@
1
+ export * from './FormSelectInput';
@@ -14,4 +14,4 @@ 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
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./NumericKeyboard"), exports);
17
+ __exportStar(require("./FormSelectInput"), exports);
@@ -8,9 +8,12 @@ const react_1 = __importDefault(require("react"));
8
8
  const informed_1 = require("informed");
9
9
  const TextInput_1 = require("../../TextInput");
10
10
  const FormTextInput = (props) => {
11
- const { render, userProps, fieldApi, informed } = (0, informed_1.useField)(Object.assign({ type: 'text' }, props));
11
+ const { render, userProps, fieldApi, informed, fieldState } = (0, informed_1.useField)(Object.assign({ type: 'text' }, props));
12
12
  const { value } = informed;
13
- return render(<TextInput_1.TextInput onChangeText={fieldApi.setValue} {...userProps} value={value}/>);
13
+ const { error } = fieldState;
14
+ return render(<TextInput_1.TextInput
15
+ //@ts-expect-error no types yet
16
+ error={error} onChangeText={fieldApi.setValue} {...userProps} value={value}/>);
14
17
  };
15
18
  exports.FormTextInput = FormTextInput;
16
19
  exports.default = exports.FormTextInput;
@@ -2,3 +2,4 @@ export * from './Form';
2
2
  export * from './FormSwitchToggle';
3
3
  export * from './FormTextInput';
4
4
  export * from './FormDateTimeInput';
5
+ export * from './FormSelectInput';
@@ -18,3 +18,4 @@ __exportStar(require("./Form"), exports);
18
18
  __exportStar(require("./FormSwitchToggle"), exports);
19
19
  __exportStar(require("./FormTextInput"), exports);
20
20
  __exportStar(require("./FormDateTimeInput"), exports);
21
+ __exportStar(require("./FormSelectInput"), exports);
@@ -1,10 +1,11 @@
1
1
  import React from "react";
2
2
  import { Option } from "./types";
3
- type Props<T> = {
3
+ export type SelectInputProps<T> = {
4
4
  caption?: string;
5
5
  label: string;
6
6
  options: Option<T>[];
7
7
  onChange: (newValue: Option<T>) => void;
8
+ error?: string;
8
9
  };
9
- export declare function SelectInput<T>({ caption, label, options, onChange, }: Props<T>): React.JSX.Element;
10
+ export declare function SelectInput<T>({ caption, label, options, onChange, error, }: SelectInputProps<T>): React.JSX.Element;
10
11
  export default SelectInput;
@@ -35,20 +35,26 @@ const Text_1 = __importDefault(require("../Text"));
35
35
  const Sheet_1 = __importDefault(require("../Sheet"));
36
36
  const MenuItemDescription_1 = require("../MenuItemDescription");
37
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();
38
+ const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
39
+ const animations_1 = require("../../constants/animations");
40
+ function SelectInput({ caption, label, options = [], onChange, error, }) {
41
+ const { styles } = useStyles();
41
42
  const values = (0, react_1.useMemo)(() => {
42
43
  return options.filter((v) => v.selected);
43
44
  }, options);
44
45
  const [sheetOpen, setSheetOpen] = (0, react_1.useState)(false);
45
46
  const animatedValue = (0, react_native_reanimated_1.useSharedValue)(values.length ? 1 : 0);
46
47
  const rotation = (0, react_native_reanimated_1.useSharedValue)(sheetOpen ? 1 : 0);
48
+ const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
47
49
  (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
- });
50
+ if (error) {
51
+ setBorderColor(styles.itemContainerError.borderColor);
52
+ return;
53
+ }
54
+ setBorderColor(sheetOpen ? styles.itemContainerFocused.borderColor : styles.itemContainer.borderColor);
55
+ }, [error, sheetOpen]);
56
+ (0, react_1.useEffect)(() => {
57
+ rotation.value = (0, react_native_reanimated_1.withTiming)(sheetOpen ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
52
58
  }, [sheetOpen]);
53
59
  (0, react_1.useEffect)(() => {
54
60
  animatedValue.value = values.length ? 1 : 0;
@@ -61,11 +67,6 @@ function SelectInput({ caption, label, options = [], onChange, }) {
61
67
  fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [14, 10]),
62
68
  };
63
69
  }, []);
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
70
  const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
70
71
  return {
71
72
  flex: 1,
@@ -85,7 +86,7 @@ function SelectInput({ caption, label, options = [], onChange, }) {
85
86
  };
86
87
  return (<>
87
88
  <react_native_1.TouchableOpacity onPress={() => setSheetOpen(true)}>
88
- <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedContainerStyles]}>
89
+ <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedBorderStyle]}>
89
90
  <react_native_1.View pointerEvents="none" style={styles.labelContainer}>
90
91
  <react_native_reanimated_1.default.Text style={[styles.label, animatedLabelStyles]}>
91
92
  {label}
@@ -132,7 +133,7 @@ const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((th
132
133
  },
133
134
  itemContainer: {
134
135
  borderWidth: theme.borderWidth,
135
- borderColor: theme.colors.borderSecondary,
136
+ borderColor: theme.colors.backgroundPrimary,
136
137
  backgroundColor: theme.colors.backgroundOnPrimary,
137
138
  marginBottom: theme.size.baseSize * 2,
138
139
  borderRadius: theme.borderRadius,
@@ -141,6 +142,12 @@ const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((th
141
142
  alignItems: "center",
142
143
  justifyContent: "space-between",
143
144
  },
145
+ itemContainerFocused: {
146
+ borderColor: theme.colors.border,
147
+ },
148
+ itemContainerError: {
149
+ borderColor: theme.colors.foregroundNegative,
150
+ },
144
151
  labelContainer: {
145
152
  left: theme.size.baseSize * 2,
146
153
  position: "absolute",
@@ -7,6 +7,7 @@ export type SwitchToggleProps = {
7
7
  testId?: string;
8
8
  onChange?: (value: boolean) => void;
9
9
  touchableStyle?: StyleProp<ViewStyle>;
10
+ error?: string;
10
11
  };
11
- export declare const SwitchToggle: ({ testId, onChange, value, caption, label, touchableStyle }: SwitchToggleProps) => React.JSX.Element;
12
+ export declare const SwitchToggle: ({ testId, onChange, value, caption, label, touchableStyle, error }: SwitchToggleProps) => React.JSX.Element;
12
13
  export default SwitchToggle;
@@ -1,21 +1,54 @@
1
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
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
29
  exports.SwitchToggle = void 0;
7
- const react_1 = __importDefault(require("react"));
30
+ const react_1 = __importStar(require("react"));
8
31
  const react_native_1 = require("react-native");
32
+ const react_native_reanimated_1 = __importDefault(require("react-native-reanimated"));
9
33
  const Text_1 = __importDefault(require("../Text"));
10
34
  const MenuItemDescription_1 = require("../MenuItemDescription");
11
35
  const index_1 = require("../../shared/styles/index");
12
- const SwitchToggle = ({ testId, onChange, value, caption, label, touchableStyle }) => {
13
- const styles = (0, index_1.useMenuItemStyles)().styles;
36
+ const FieldError_1 = require("../FieldError/FieldError");
37
+ const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
38
+ const SwitchToggle = ({ testId, onChange, value, caption, label, touchableStyle, error }) => {
39
+ const { styles, theme } = (0, index_1.useMenuItemStyles)();
40
+ const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
41
+ (0, react_1.useEffect)(() => {
42
+ setBorderColor(error ? theme.colors.foregroundNegative : styles.itemContainer.borderColor);
43
+ }, [error]);
14
44
  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}/>
45
+ <react_native_1.TouchableOpacity testID={testId} style={touchableStyle}>
46
+ <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedBorderStyle]}>
47
+ <Text_1.default numberOfLines={1}>{label}</Text_1.default>
48
+ <react_native_1.Switch testID={`${testId}_toggle`} onValueChange={onChange} value={value}/>
49
+ </react_native_reanimated_1.default.View>
18
50
  </react_native_1.TouchableOpacity>
51
+ {!!error && <FieldError_1.FieldError error={error}/>}
19
52
  {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
20
53
  </react_native_1.View>);
21
54
  };
@@ -9,6 +9,7 @@ export type TextInputProps = {
9
9
  value: string;
10
10
  label: string;
11
11
  containerStyle?: StyleProp<ViewStyle>;
12
+ error?: string;
12
13
  } & Omit<RNTextInputProps, "onBlur">;
13
14
  export declare const TextInput: React.ForwardRefExoticComponent<{
14
15
  disabled?: boolean;
@@ -19,5 +20,6 @@ export declare const TextInput: React.ForwardRefExoticComponent<{
19
20
  value: string;
20
21
  label: string;
21
22
  containerStyle?: StyleProp<ViewStyle>;
23
+ error?: string;
22
24
  } & Omit<RNTextInputProps, "onBlur"> & React.RefAttributes<unknown>>;
23
25
  export default TextInput;
@@ -44,9 +44,30 @@ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"
44
44
  const Text_1 = __importDefault(require("../Text"));
45
45
  const MenuItemDescription_1 = require("../MenuItemDescription");
46
46
  const hooks_1 = require("../../hooks");
47
+ const FieldError_1 = require("../FieldError/FieldError");
48
+ const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
49
+ const animations_1 = require("../../constants/animations");
50
+ const getLabelStyle = (disabled, error, style) => {
51
+ if (disabled) {
52
+ return style.disabled;
53
+ }
54
+ else if (error) {
55
+ return style.error;
56
+ }
57
+ return style.default;
58
+ };
59
+ const getTextInputStyle = (disabled, error, style) => {
60
+ if (disabled) {
61
+ return style.disabled;
62
+ }
63
+ else if (error) {
64
+ return style.error;
65
+ }
66
+ return style.default;
67
+ };
47
68
  exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
48
- var { caption, keyboardType, onChangeText, testId, value, label, onBlur, containerStyle, disabled = false } = _a, rest = __rest(_a, ["caption", "keyboardType", "onChangeText", "testId", "value", "label", "onBlur", "containerStyle", "disabled"]);
49
- const { styles, theme } = useStyles(disabled);
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);
50
71
  const inputRef = (0, react_1.useRef)(null);
51
72
  (0, react_1.useImperativeHandle)(ref, () => ({
52
73
  focus: () => {
@@ -59,7 +80,14 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
59
80
  },
60
81
  }));
61
82
  const animatedValue = (0, react_native_reanimated_1.useSharedValue)(value ? 1 : 0);
62
- const focusedValue = (0, react_native_reanimated_1.useSharedValue)(0);
83
+ const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
84
+ (0, react_1.useEffect)(() => {
85
+ var _a;
86
+ if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.isFocused()) {
87
+ return;
88
+ }
89
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
90
+ }, [value]);
63
91
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
64
92
  return {
65
93
  transform: [
@@ -74,37 +102,29 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
74
102
  transform: [{ translateY: animatedValue.value * 4 }],
75
103
  };
76
104
  });
77
- const animatedContainerStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
78
- return {
79
- borderColor: (0, react_native_reanimated_1.interpolateColor)(focusedValue.value, [0, 1], ["#ffffff00", theme.colors.border]),
80
- };
81
- });
105
+ (0, react_1.useEffect)(() => {
106
+ var _a;
107
+ if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.isFocused()) {
108
+ setBorderColor(error ? styles.itemContainerError.borderColor : styles.itemContainerFocused.borderColor);
109
+ }
110
+ else {
111
+ startBlurAnimation();
112
+ }
113
+ }, [error]);
82
114
  const handleOnChangeText = (text) => {
83
115
  if (text.length === 0) {
84
- animatedValue.value = (0, react_native_reanimated_1.withTiming)(0, {
85
- duration: 200,
86
- easing: react_native_reanimated_1.Easing.bezier(0.25, 0.1, 0.25, 1),
87
- });
116
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(0, animations_1.DEFAULT_TIMING_CONFIG);
88
117
  }
89
118
  onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);
90
119
  if (value || animatedValue.value === 1) {
91
120
  return;
92
121
  }
93
- animatedValue.value = (0, react_native_reanimated_1.withTiming)(1, {
94
- duration: 200,
95
- easing: react_native_reanimated_1.Easing.bezier(0.25, 0.1, 0.25, 1),
96
- });
122
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(1, animations_1.DEFAULT_TIMING_CONFIG);
97
123
  };
98
124
  const startBlurAnimation = () => {
99
- focusedValue.value = (0, react_native_reanimated_1.withTiming)(0, {
100
- duration: 200,
101
- easing: react_native_reanimated_1.Easing.bezier(0.25, 0.1, 0.25, 1),
102
- });
125
+ setBorderColor(error ? `${styles.itemContainerError.borderColor}40` : styles.itemContainer.borderColor);
103
126
  if (!value) {
104
- animatedValue.value = (0, react_native_reanimated_1.withTiming)(0, {
105
- duration: 200,
106
- easing: react_native_reanimated_1.Easing.bezier(0.25, 0.1, 0.25, 1),
107
- });
127
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(0, animations_1.DEFAULT_TIMING_CONFIG);
108
128
  }
109
129
  };
110
130
  const handleOnBlur = ({ nativeEvent }) => {
@@ -112,10 +132,7 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
112
132
  startBlurAnimation();
113
133
  };
114
134
  const onFocus = () => {
115
- focusedValue.value = (0, react_native_reanimated_1.withTiming)(1, {
116
- duration: 200,
117
- easing: react_native_reanimated_1.Easing.bezier(0.25, 0.1, 0.25, 1),
118
- });
135
+ setBorderColor(error ? styles.itemContainerError.borderColor : styles.itemContainerFocused.borderColor);
119
136
  };
120
137
  return (<react_native_1.View style={styles.container}>
121
138
  <react_native_1.Pressable onPress={() => {
@@ -124,7 +141,7 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
124
141
  }} style={styles.pressable} disabled={disabled}>
125
142
  <react_native_reanimated_1.default.View style={[
126
143
  styles.itemContainer,
127
- animatedContainerStyles,
144
+ animatedBorderStyle,
128
145
  containerStyle,
129
146
  ]}>
130
147
  <react_native_1.View pointerEvents="none" style={styles.labelContainer}>
@@ -133,16 +150,17 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
133
150
  </react_native_reanimated_1.default.Text>
134
151
  </react_native_1.View>
135
152
  <react_native_reanimated_1.default.View style={animatedInputStyles}>
136
- {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} placeholderTextColor={theme.placeholderTextColor} onChangeText={handleOnChangeText} maxLength={40} returnKeyType="done" onBlur={handleOnBlur} onFocus={onFocus} keyboardAppearance={theme.keyboardAppearance} {...rest}/>)}
153
+ {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}/>)}
137
154
  </react_native_reanimated_1.default.View>
138
155
  </react_native_reanimated_1.default.View>
139
156
  </react_native_1.Pressable>
157
+ {!!error && (<FieldError_1.FieldError error={error}/>)}
140
158
  {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
141
159
  </react_native_1.View>);
142
160
  });
143
161
  exports.default = exports.TextInput;
144
162
  exports.TextInput.displayName = "TextInput";
145
- const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
163
+ const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
146
164
  container: {
147
165
  width: "100%",
148
166
  flexShrink: 0.5,
@@ -151,30 +169,54 @@ const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallb
151
169
  flexGrow: 2,
152
170
  flexShrink: 1,
153
171
  },
154
- textInput: Object.assign(Object.assign({ paddingHorizontal: theme.size.baseSize * 2 }, theme.typography.p1), { color: theme.colors.foregroundLowContrast }),
155
- text: {
156
- marginTop: theme.size.baseSize,
157
- paddingHorizontal: theme.size.baseSize * 2,
158
- color: theme.colors.foregroundLowContrast,
159
- },
172
+ textInput: Object.assign(Object.assign({ paddingHorizontal: theme.size.baseSize * 2 }, theme.typography.p1), getTextInputStyle(disabled, error, {
173
+ disabled: {
174
+ color: theme.colors.foregroundLowContrast,
175
+ },
176
+ error: {
177
+ color: theme.colors.foregroundNegative,
178
+ },
179
+ default: {
180
+ color: theme.colors.foregroundLowContrast,
181
+ },
182
+ })),
183
+ text: Object.assign({ marginTop: theme.size.baseSize, paddingHorizontal: theme.size.baseSize * 2, color: theme.colors.foregroundLowContrast }, getTextInputStyle(disabled, error, {
184
+ disabled: {
185
+ color: theme.colors.foregroundLowContrast,
186
+ },
187
+ error: {
188
+ color: theme.colors.foregroundNegative,
189
+ },
190
+ default: {
191
+ color: theme.colors.foregroundLowContrast,
192
+ },
193
+ })),
160
194
  itemContainer: {
161
195
  borderWidth: theme.borderWidth,
162
- borderColor: theme.colors.borderSecondary,
163
196
  backgroundColor: theme.colors.backgroundOnPrimary,
164
197
  borderRadius: theme.borderRadius,
165
198
  minHeight: theme.size.baseSize * 8,
166
199
  flexDirection: "row",
167
200
  alignItems: "center",
201
+ borderColor: `${theme.colors.border}00`,
202
+ },
203
+ itemContainerFocused: {
204
+ borderColor: theme.colors.border,
205
+ },
206
+ itemContainerError: {
207
+ borderColor: theme.colors.foregroundNegative,
168
208
  },
169
209
  labelContainer: {
170
210
  left: theme.size.baseSize * 2,
171
211
  position: "absolute",
172
212
  },
173
- label: Object.assign({ color: !disabled
174
- ? theme.colors.foreground
175
- : theme.colors.foregroundLowContrast }, theme.typography.p1),
213
+ label: getLabelStyle(disabled, error, {
214
+ default: Object.assign({ color: theme.colors.foreground }, theme.typography.p1),
215
+ disabled: Object.assign({ color: theme.colors.foregroundLowContrast }, theme.typography.p1),
216
+ error: Object.assign({ color: theme.colors.foregroundNegative }, theme.typography.p1),
217
+ }),
176
218
  descriptionContainer: {
177
219
  marginHorizontal: theme.size.baseSize * 4,
178
220
  marginBottom: theme.size.baseSize * 2,
179
221
  },
180
- }), [disabled]));
222
+ }), [disabled, error]));
@@ -0,0 +1,5 @@
1
+ export declare const DEFAULT_EASING: import("react-native-reanimated").EasingFunction;
2
+ export declare const DEFAULT_TIMING_CONFIG: {
3
+ duration: number;
4
+ easing: import("react-native-reanimated").EasingFunction;
5
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_TIMING_CONFIG = exports.DEFAULT_EASING = void 0;
4
+ const react_native_reanimated_1 = require("react-native-reanimated");
5
+ exports.DEFAULT_EASING = react_native_reanimated_1.Easing.inOut(react_native_reanimated_1.Easing.quad);
6
+ exports.DEFAULT_TIMING_CONFIG = {
7
+ duration: 150,
8
+ easing: exports.DEFAULT_EASING,
9
+ };
@@ -0,0 +1,6 @@
1
+ export declare const useInputFieldAnimatedBorder: (initialColor: string) => {
2
+ animatedBorderStyle: {
3
+ borderColor: string;
4
+ };
5
+ setBorderColor: (color: string) => void;
6
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useInputFieldAnimatedBorder = void 0;
4
+ const react_native_reanimated_1 = require("react-native-reanimated");
5
+ const react_1 = require("react");
6
+ const animations_1 = require("../constants/animations");
7
+ const useInputFieldAnimatedBorder = (initialColor) => {
8
+ const inputBorderColor = (0, react_native_reanimated_1.useSharedValue)(initialColor); //starts hidden
9
+ const setBorderColor = (0, react_1.useCallback)((color) => {
10
+ inputBorderColor.value = (0, react_native_reanimated_1.withTiming)(color, animations_1.DEFAULT_TIMING_CONFIG);
11
+ }, []);
12
+ const borderStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
13
+ return {
14
+ borderColor: inputBorderColor.value,
15
+ };
16
+ }, []);
17
+ return {
18
+ animatedBorderStyle: borderStyle,
19
+ setBorderColor,
20
+ };
21
+ };
22
+ exports.useInputFieldAnimatedBorder = useInputFieldAnimatedBorder;
@@ -0,0 +1 @@
1
+ export declare function usePrevious<T>(value: T): T | null;
@@ -0,0 +1,16 @@
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.usePrevious = usePrevious;
7
+ const react_1 = __importDefault(require("react"));
8
+ function usePrevious(value) {
9
+ const [current, setCurrent] = react_1.default.useState(value);
10
+ const [previous, setPrevious] = react_1.default.useState(null);
11
+ if (value !== current) {
12
+ setPrevious(current);
13
+ setCurrent(value);
14
+ }
15
+ return previous;
16
+ }
@@ -12,6 +12,8 @@ export declare const useMenuItemStyles: () => {
12
12
  marginBottom: number;
13
13
  };
14
14
  itemContainer: {
15
+ borderWidth: number;
16
+ borderColor: string;
15
17
  backgroundColor: string;
16
18
  borderRadius: number;
17
19
  paddingHorizontal: number;
@@ -11,6 +11,8 @@ const useMenuItemStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallb
11
11
  marginBottom: theme.size.baseSize * 3,
12
12
  },
13
13
  itemContainer: {
14
+ borderWidth: theme.borderWidth,
15
+ borderColor: theme.colors.backgroundPrimary,
14
16
  backgroundColor: theme.menuItemContainerBackground,
15
17
  borderRadius: theme.borderRadius,
16
18
  paddingHorizontal: theme.size.baseSize * 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas-design-system",
3
- "version": "1.4.0",
3
+ "version": "1.4.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",
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- interface NumericKeyboardProps {
3
- mode?: "integer" | "float";
4
- setValue: React.Dispatch<React.SetStateAction<string>>;
5
- onHide?: () => void;
6
- height: number;
7
- open: boolean;
8
- setOpen: React.Dispatch<React.SetStateAction<boolean>>;
9
- }
10
- declare const NumericKeyboard: ({ setValue, onHide, open, setOpen, height, mode, }: NumericKeyboardProps) => React.JSX.Element;
11
- export default NumericKeyboard;
@@ -1,170 +0,0 @@
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 react_native_1 = require("react-native");
31
- const Ionicons_1 = __importDefault(require("react-native-vector-icons/Ionicons"));
32
- const react_native_safe_area_context_1 = require("react-native-safe-area-context");
33
- const Text_1 = require("../Text");
34
- const useThemedStyle_1 = require("../../hooks/useThemedStyle");
35
- const BottomSheet_1 = require("../BottomSheet/BottomSheet");
36
- const keypad = [
37
- [7, 8, 9],
38
- [4, 5, 6],
39
- [1, 2, 3],
40
- [null, 0, "."],
41
- ];
42
- const NumericKeyboard = ({ setValue, onHide, open, setOpen, height, mode = "float", }) => {
43
- const styles = useStyles().styles;
44
- const [firstTouch, setFirstTouch] = (0, react_1.useState)(true);
45
- const onPressKeypadButton = (value) => {
46
- if (!value) {
47
- return;
48
- }
49
- if (typeof value === "number") {
50
- if (firstTouch) {
51
- setValue(`${value}`);
52
- setFirstTouch(false);
53
- return;
54
- }
55
- setValue((prevState) => {
56
- const isZero = prevState === "0";
57
- return !isZero ? `${prevState}${value}` : `${value}`;
58
- });
59
- }
60
- else if (typeof value === "string") {
61
- setValue(() => {
62
- return `${value}`;
63
- });
64
- }
65
- };
66
- const onPressBackspace = () => {
67
- setValue((prevState) => {
68
- let string = String(prevState);
69
- if (string.length > 1) {
70
- return string.substr(0, string.length - 1);
71
- }
72
- else {
73
- return "0";
74
- }
75
- });
76
- };
77
- const handleOnPressKeyPadButton = (value) => {
78
- value !== null && onPressKeypadButton(value);
79
- };
80
- const handleOnHide = () => {
81
- setFirstTouch(true);
82
- setOpen(false);
83
- onHide === null || onHide === void 0 ? void 0 : onHide();
84
- };
85
- return (<BottomSheet_1.BottomSheet open={open} height={height} defaultMargins={true}>
86
- <react_native_1.View style={styles.keyboardContainer}>
87
- <react_native_1.View style={styles.keypadContainer}>
88
- {keypad.map((row, index) => (<react_native_1.View key={index.toString()} style={styles.keypadRow}>
89
- {row.map((column, colIndex) => {
90
- if (mode === "integer" && column === ".") {
91
- return (<react_native_1.View key={colIndex + "hidden"} style={styles.keypadCellHidden}/>);
92
- }
93
- return (<react_native_1.TouchableOpacity key={colIndex} onPress={() => {
94
- column !== null
95
- ? handleOnPressKeyPadButton(column)
96
- : handleOnHide();
97
- }} style={[
98
- styles.keypadCell,
99
- column === null && styles.keypadCellDisabled,
100
- ]}>
101
- {column !== null ? (<Text_1.Text contrast="low" category="h1" style={styles.keypadCellText}>
102
- {column}
103
- </Text_1.Text>) : (<Ionicons_1.default style={styles.keypadCellText} name="caret-down-outline" size={23}/>)}
104
- </react_native_1.TouchableOpacity>);
105
- })}
106
- </react_native_1.View>))}
107
- </react_native_1.View>
108
- <react_native_1.View style={styles.keyboardSideBar}>
109
- <react_native_1.TouchableOpacity onPress={onPressBackspace} style={styles.backspaceKey}>
110
- <Ionicons_1.default name="backspace-outline" size={28} color={styles.backspaceIcon.color}/>
111
- </react_native_1.TouchableOpacity>
112
- <react_native_1.View />
113
- </react_native_1.View>
114
- </react_native_1.View>
115
- </BottomSheet_1.BottomSheet>);
116
- };
117
- const useStyles = () => {
118
- const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
119
- return (0, useThemedStyle_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
120
- keypadContainer: {
121
- flex: 0.78,
122
- },
123
- keyboardSideBar: {
124
- flex: 0.22,
125
- },
126
- backspaceKey: {
127
- flex: 0.5,
128
- margin: 2,
129
- alignItems: "center",
130
- justifyContent: "center",
131
- borderRadius: theme.borderRadius,
132
- backgroundColor: theme.colors.foregroundNegative,
133
- },
134
- keypadCell: {
135
- flex: 1 / 3,
136
- margin: 2,
137
- justifyContent: "center",
138
- borderRadius: theme.borderRadius,
139
- backgroundColor: theme.colors.foreground,
140
- },
141
- keypadCellHidden: {
142
- flex: 1 / 3,
143
- margin: 2,
144
- justifyContent: "center",
145
- borderRadius: theme.borderRadius,
146
- backgroundColor: theme.colors.backgroundPrimary,
147
- },
148
- keypadCellDisabled: {
149
- backgroundColor: theme.colors.foregroundLowContrast,
150
- },
151
- keypadCellText: {
152
- textAlign: "center",
153
- },
154
- keypadRow: {
155
- flex: 1,
156
- flexDirection: "row",
157
- },
158
- keyboardContainer: {
159
- paddingBottom: insets.bottom,
160
- backgroundColor: theme.colors.backgroundPrimary,
161
- flexDirection: "row",
162
- flex: 1,
163
- paddingHorizontal: theme.size.baseSize * 2,
164
- },
165
- backspaceIcon: {
166
- color: theme.colors.foregroundHighContrast,
167
- },
168
- }), [insets]));
169
- };
170
- exports.default = NumericKeyboard;
@@ -1 +0,0 @@
1
- export * from './NumericKeyboard';
@@ -1,2 +0,0 @@
1
- import { StyleSheet } from "react-native";
2
- export declare function useStylesCreator<T>(styles: StyleSheet.NamedStyles<T>): StyleSheet.NamedStyles<T>;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useStylesCreator = useStylesCreator;
4
- const react_1 = require("react");
5
- const react_native_1 = require("react-native");
6
- const useThemedStyle_1 = require("./useThemedStyle");
7
- function useStylesCreator(styles) {
8
- return (0, useThemedStyle_1.useThemedStyle)((0, react_1.useCallback)(t => react_native_1.StyleSheet.create(styles), [styles])).styles;
9
- }