atlas-design-system 1.17.5 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DateTimeInput/index.js +12 -5
- package/dist/components/NavigationListRow/index.js +5 -6
- package/dist/components/Search/Search.d.ts +2 -2
- package/dist/components/Search/Search.js +16 -16
- package/dist/components/SelectInput/SelectInput.js +12 -5
- package/dist/components/TextInput/TextInput.js +15 -6
- package/dist/components/TextInput/index.d.ts +2 -2
- package/dist/components/TextInput/index.js +2 -2
- package/dist/constants/animations.d.ts +1 -0
- package/dist/constants/animations.js +3 -2
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +4 -0
- package/dist/hooks/useInputFieldFontSizeInterpolationOutputRange.d.ts +1 -0
- package/dist/hooks/useInputFieldFontSizeInterpolationOutputRange.js +11 -0
- package/dist/shared/styles/index.d.ts +0 -1
- package/dist/shared/styles/index.js +4 -4
- package/dist/utils/animation.d.ts +22 -0
- package/dist/utils/animation.js +28 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/package.json +1 -1
|
@@ -41,6 +41,8 @@ const Button_1 = __importDefault(require("../Button"));
|
|
|
41
41
|
const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
|
|
42
42
|
const FieldError_1 = require("../FieldError/FieldError");
|
|
43
43
|
const animations_1 = require("../../constants/animations");
|
|
44
|
+
const constants_1 = require("../../constants");
|
|
45
|
+
const useInputFieldFontSizeInterpolationOutputRange_1 = require("../../hooks/useInputFieldFontSizeInterpolationOutputRange");
|
|
44
46
|
const getFormat = (mode) => {
|
|
45
47
|
switch (mode) {
|
|
46
48
|
case "date": {
|
|
@@ -76,6 +78,7 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
|
|
|
76
78
|
? styles.itemContainerFocused.borderColor
|
|
77
79
|
: styles.itemContainer.borderColor);
|
|
78
80
|
}, [error, dateSheetOpen]);
|
|
81
|
+
const labelFontSizeInterpolationOutputRange = (0, useInputFieldFontSizeInterpolationOutputRange_1.useInputFieldFontSizeInterpolationOutputRange)();
|
|
79
82
|
const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
80
83
|
return {
|
|
81
84
|
transform: [
|
|
@@ -83,13 +86,17 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
|
|
|
83
86
|
translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE),
|
|
84
87
|
},
|
|
85
88
|
],
|
|
86
|
-
fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value,
|
|
89
|
+
fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, labelFontSizeInterpolationOutputRange),
|
|
87
90
|
};
|
|
88
|
-
}, []);
|
|
91
|
+
}, [labelFontSizeInterpolationOutputRange]);
|
|
89
92
|
const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
90
93
|
return {
|
|
91
94
|
flex: 1,
|
|
92
|
-
transform: [
|
|
95
|
+
transform: [
|
|
96
|
+
{
|
|
97
|
+
translateY: animatedValue.value * animations_1.ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
93
100
|
};
|
|
94
101
|
});
|
|
95
102
|
return (<>
|
|
@@ -137,13 +144,13 @@ const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallb
|
|
|
137
144
|
backgroundColor: t.colors.backgroundOnPrimary,
|
|
138
145
|
borderRadius: t.borderRadius,
|
|
139
146
|
paddingHorizontal: t.size.baseSize * 2,
|
|
140
|
-
minHeight: t.size.baseSize *
|
|
147
|
+
minHeight: t.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
141
148
|
flexDirection: "row",
|
|
142
149
|
justifyContent: "space-between",
|
|
143
150
|
alignItems: "center",
|
|
144
151
|
borderColor: t.colors.backgroundOnPrimary,
|
|
145
152
|
borderWidth: t.borderWidth,
|
|
146
|
-
height: t.size.baseSize *
|
|
153
|
+
height: t.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
147
154
|
},
|
|
148
155
|
itemContainerError: {
|
|
149
156
|
borderColor: t.colors.foregroundNegative,
|
|
@@ -45,18 +45,17 @@ const NavigationListRow = ({ label, caption, onPress, disabled, defaultPadding =
|
|
|
45
45
|
exports.NavigationListRow = NavigationListRow;
|
|
46
46
|
exports.default = exports.NavigationListRow;
|
|
47
47
|
const useStyles = (defaultPadding) => (0, useThemedStyle_1.useThemedStyle)((0, react_1.useCallback)((t) => react_native_1.StyleSheet.create({
|
|
48
|
-
content: {
|
|
49
|
-
flexGrow: 1,
|
|
50
|
-
},
|
|
51
48
|
container: {
|
|
52
|
-
width: "100%",
|
|
53
49
|
flexDirection: "row",
|
|
50
|
+
justifyContent: "flex-start",
|
|
51
|
+
columnGap: t.size.baseSize * 0,
|
|
54
52
|
paddingVertical: t.size.baseSize * 2,
|
|
55
53
|
paddingHorizontal: defaultPadding ? t.size.baseSize * 4 : 0,
|
|
56
54
|
},
|
|
55
|
+
content: {
|
|
56
|
+
flex: 1,
|
|
57
|
+
},
|
|
57
58
|
chevronRight: {
|
|
58
|
-
height: "100%",
|
|
59
|
-
flexGrow: 0,
|
|
60
59
|
color: t.colors.foregroundHighContrast,
|
|
61
60
|
},
|
|
62
61
|
}), [defaultPadding]));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { ViewStyle, ReturnKeyType, StyleProp } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ViewStyle, ReturnKeyType, StyleProp } from "react-native";
|
|
3
3
|
type Props = {
|
|
4
4
|
searchQuery: string;
|
|
5
5
|
onChangeText: (text: string) => void;
|
|
@@ -22,16 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.Search = void 0;
|
|
30
27
|
const react_1 = __importStar(require("react"));
|
|
31
28
|
const react_native_1 = require("react-native");
|
|
32
29
|
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
33
|
-
const
|
|
34
|
-
const Text_1 = __importDefault(require("../Text"));
|
|
30
|
+
const components_1 = require("../../components");
|
|
35
31
|
const hooks_1 = require("../../hooks");
|
|
36
32
|
const CANCEL_BUTTON_WIDTH = 62;
|
|
37
33
|
const Search = ({ searchQuery, onChangeText, placeholder, autoFocus, containerStyle = {}, returnKeyType, label, }) => {
|
|
@@ -40,10 +36,14 @@ const Search = ({ searchQuery, onChangeText, placeholder, autoFocus, containerSt
|
|
|
40
36
|
const [minWidth, setMinWidth] = (0, react_1.useState)(0);
|
|
41
37
|
const focused = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
42
38
|
const onFocus = () => {
|
|
43
|
-
focused.value = (0, react_native_reanimated_1.withTiming)(1, {
|
|
39
|
+
focused.value = (0, react_native_reanimated_1.withTiming)(1, {
|
|
40
|
+
easing: react_native_reanimated_1.Easing.bezier(0.25, 0.1, 0.25, 1),
|
|
41
|
+
});
|
|
44
42
|
};
|
|
45
43
|
const onBlur = () => {
|
|
46
|
-
focused.value = (0, react_native_reanimated_1.withTiming)(0, {
|
|
44
|
+
focused.value = (0, react_native_reanimated_1.withTiming)(0, {
|
|
45
|
+
easing: react_native_reanimated_1.Easing.bezier(0.25, 0.1, 0.25, 1),
|
|
46
|
+
});
|
|
47
47
|
};
|
|
48
48
|
const animatedCancelButtonStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
49
49
|
opacity: focused.value,
|
|
@@ -62,32 +62,32 @@ const Search = ({ searchQuery, onChangeText, placeholder, autoFocus, containerSt
|
|
|
62
62
|
};
|
|
63
63
|
return (<react_native_1.View style={[styles.searchBarContainer, containerStyle]} onLayout={onLayout}>
|
|
64
64
|
<react_native_reanimated_1.default.View style={[animatedSearchInput, styles.animatedContainer]}>
|
|
65
|
-
<
|
|
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}/>
|
|
66
66
|
</react_native_reanimated_1.default.View>
|
|
67
67
|
<react_native_reanimated_1.default.View style={animatedCancelButtonStyle}>
|
|
68
68
|
<react_native_1.TouchableOpacity style={styles.cancelButton} onPress={onPressCancel}>
|
|
69
|
-
<
|
|
69
|
+
<components_1.Text style={styles.cancelButtonText}>Cancel</components_1.Text>
|
|
70
70
|
</react_native_1.TouchableOpacity>
|
|
71
71
|
</react_native_reanimated_1.default.View>
|
|
72
72
|
</react_native_1.View>);
|
|
73
73
|
};
|
|
74
74
|
exports.Search = Search;
|
|
75
75
|
exports.default = exports.Search;
|
|
76
|
-
const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)(theme => react_native_1.StyleSheet.create({
|
|
76
|
+
const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
|
|
77
77
|
searchBarContainer: {
|
|
78
|
-
flexDirection:
|
|
79
|
-
width:
|
|
78
|
+
flexDirection: "row",
|
|
79
|
+
width: "100%",
|
|
80
80
|
},
|
|
81
81
|
animatedContainer: {
|
|
82
|
-
width:
|
|
83
|
-
justifyContent:
|
|
82
|
+
width: "100%",
|
|
83
|
+
justifyContent: "center",
|
|
84
84
|
},
|
|
85
85
|
cancelButton: {
|
|
86
86
|
flex: 1,
|
|
87
87
|
maxWidth: CANCEL_BUTTON_WIDTH,
|
|
88
88
|
minWidth: CANCEL_BUTTON_WIDTH,
|
|
89
|
-
justifyContent:
|
|
90
|
-
alignItems:
|
|
89
|
+
justifyContent: "center",
|
|
90
|
+
alignItems: "center",
|
|
91
91
|
},
|
|
92
92
|
cancelButtonText: {
|
|
93
93
|
color: theme.colors.primary,
|
|
@@ -37,6 +37,8 @@ const hooks_1 = require("../../hooks");
|
|
|
37
37
|
const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
|
|
38
38
|
const Chevron_1 = __importDefault(require("../Chevron"));
|
|
39
39
|
const animations_1 = require("../../constants/animations");
|
|
40
|
+
const useInputFieldFontSizeInterpolationOutputRange_1 = require("../../hooks/useInputFieldFontSizeInterpolationOutputRange");
|
|
41
|
+
const constants_1 = require("../../constants");
|
|
40
42
|
const SelectionItem_1 = __importDefault(require("./components/SelectionItem"));
|
|
41
43
|
function SelectInput({ caption, label, options = [], onChange, error, renderOption, containerStyle, }) {
|
|
42
44
|
const styles = useStyles().styles;
|
|
@@ -73,6 +75,7 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
|
|
|
73
75
|
animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
|
|
74
76
|
}
|
|
75
77
|
}, [value]);
|
|
78
|
+
const labelFontSizeInterpolationOutputRange = (0, useInputFieldFontSizeInterpolationOutputRange_1.useInputFieldFontSizeInterpolationOutputRange)();
|
|
76
79
|
const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
77
80
|
return {
|
|
78
81
|
transform: [
|
|
@@ -80,13 +83,17 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
|
|
|
80
83
|
translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE, react_native_reanimated_1.Extrapolation.CLAMP),
|
|
81
84
|
},
|
|
82
85
|
],
|
|
83
|
-
fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value,
|
|
86
|
+
fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, labelFontSizeInterpolationOutputRange, react_native_reanimated_1.Extrapolation.CLAMP),
|
|
84
87
|
};
|
|
85
|
-
}, []);
|
|
88
|
+
}, [labelFontSizeInterpolationOutputRange]);
|
|
86
89
|
const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
87
90
|
return {
|
|
88
91
|
flex: 1,
|
|
89
|
-
transform: [
|
|
92
|
+
transform: [
|
|
93
|
+
{
|
|
94
|
+
translateY: animatedValue.value * animations_1.ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
90
97
|
};
|
|
91
98
|
}, [animatedValue]);
|
|
92
99
|
const handleOptionPress = (0, react_1.useCallback)((option) => {
|
|
@@ -127,11 +134,11 @@ const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((th
|
|
|
127
134
|
borderColor: theme.colors.backgroundOnPrimary,
|
|
128
135
|
backgroundColor: theme.colors.backgroundOnPrimary,
|
|
129
136
|
borderRadius: theme.borderRadius,
|
|
130
|
-
minHeight: theme.size.baseSize *
|
|
137
|
+
minHeight: theme.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
131
138
|
flexDirection: "row",
|
|
132
139
|
alignItems: "center",
|
|
133
140
|
justifyContent: "space-between",
|
|
134
|
-
height: theme.size.baseSize *
|
|
141
|
+
height: theme.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
135
142
|
},
|
|
136
143
|
itemContainerFocused: {
|
|
137
144
|
borderColor: theme.colors.border,
|
|
@@ -47,6 +47,8 @@ const hooks_1 = require("../../hooks");
|
|
|
47
47
|
const FieldError_1 = require("../FieldError/FieldError");
|
|
48
48
|
const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
|
|
49
49
|
const animations_1 = require("../../constants/animations");
|
|
50
|
+
const useInputFieldFontSizeInterpolationOutputRange_1 = require("../../hooks/useInputFieldFontSizeInterpolationOutputRange");
|
|
51
|
+
const constants_1 = require("../../constants");
|
|
50
52
|
const getLabelStyle = (disabled, error, style) => {
|
|
51
53
|
if (disabled) {
|
|
52
54
|
return style.disabled;
|
|
@@ -95,6 +97,7 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
95
97
|
animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, animations_1.DEFAULT_TIMING_CONFIG);
|
|
96
98
|
}
|
|
97
99
|
}, [value]);
|
|
100
|
+
const labelFontSizeInterpolationOutputRange = (0, useInputFieldFontSizeInterpolationOutputRange_1.useInputFieldFontSizeInterpolationOutputRange)();
|
|
98
101
|
const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
99
102
|
return {
|
|
100
103
|
transform: [
|
|
@@ -102,13 +105,17 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
102
105
|
translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE),
|
|
103
106
|
},
|
|
104
107
|
],
|
|
105
|
-
fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value,
|
|
108
|
+
fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, labelFontSizeInterpolationOutputRange),
|
|
106
109
|
};
|
|
107
|
-
}, []);
|
|
110
|
+
}, [labelFontSizeInterpolationOutputRange]);
|
|
108
111
|
const animatedInputStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
109
112
|
return {
|
|
110
113
|
flex: 1,
|
|
111
|
-
transform: [
|
|
114
|
+
transform: [
|
|
115
|
+
{
|
|
116
|
+
translateY: animatedValue.value * animations_1.ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
112
119
|
};
|
|
113
120
|
});
|
|
114
121
|
(0, react_1.useEffect)(() => {
|
|
@@ -206,8 +213,8 @@ const useStyles = (disabled, error, multiline) => (0, hooks_1.useThemedStyle)((0
|
|
|
206
213
|
borderWidth: theme.borderWidth,
|
|
207
214
|
backgroundColor: theme.colors.backgroundOnPrimary,
|
|
208
215
|
height: multiline
|
|
209
|
-
? theme.size.baseSize *
|
|
210
|
-
: theme.size.baseSize *
|
|
216
|
+
? theme.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER * 2.5
|
|
217
|
+
: theme.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
211
218
|
borderRadius: theme.borderRadius,
|
|
212
219
|
minHeight: theme.size.baseSize * 8,
|
|
213
220
|
flexDirection: "row",
|
|
@@ -222,7 +229,9 @@ const useStyles = (disabled, error, multiline) => (0, hooks_1.useThemedStyle)((0
|
|
|
222
229
|
},
|
|
223
230
|
labelContainer: {
|
|
224
231
|
left: theme.size.baseSize * 2,
|
|
225
|
-
top: multiline
|
|
232
|
+
top: multiline
|
|
233
|
+
? theme.size.baseSize * 1
|
|
234
|
+
: theme.size.baseSize * 2.5,
|
|
226
235
|
position: "absolute",
|
|
227
236
|
},
|
|
228
237
|
label: getLabelStyle(disabled, error, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
2
|
-
export * from
|
|
1
|
+
export { default as TextInput } from "./TextInput";
|
|
2
|
+
export * from "./TextInput";
|
|
@@ -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.
|
|
20
|
+
exports.TextInput = void 0;
|
|
21
21
|
var TextInput_1 = require("./TextInput");
|
|
22
|
-
Object.defineProperty(exports, "
|
|
22
|
+
Object.defineProperty(exports, "TextInput", { enumerable: true, get: function () { return __importDefault(TextInput_1).default; } });
|
|
23
23
|
__exportStar(require("./TextInput"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LABEL_INTERPOLATION_OUTPUT_RANGE = exports.LABEL_INTERPOLATION_RANGE = exports.DEFAULT_TIMING_CONFIG = exports.DEFAULT_EASING = void 0;
|
|
3
|
+
exports.ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER = exports.LABEL_INTERPOLATION_OUTPUT_RANGE = exports.LABEL_INTERPOLATION_RANGE = exports.DEFAULT_TIMING_CONFIG = exports.DEFAULT_EASING = void 0;
|
|
4
4
|
const react_native_reanimated_1 = require("react-native-reanimated");
|
|
5
5
|
exports.DEFAULT_EASING = react_native_reanimated_1.Easing.inOut(react_native_reanimated_1.Easing.quad);
|
|
6
6
|
exports.DEFAULT_TIMING_CONFIG = {
|
|
@@ -8,4 +8,5 @@ exports.DEFAULT_TIMING_CONFIG = {
|
|
|
8
8
|
easing: exports.DEFAULT_EASING,
|
|
9
9
|
};
|
|
10
10
|
exports.LABEL_INTERPOLATION_RANGE = [0, 1];
|
|
11
|
-
exports.LABEL_INTERPOLATION_OUTPUT_RANGE = [1, -
|
|
11
|
+
exports.LABEL_INTERPOLATION_OUTPUT_RANGE = [1, -10];
|
|
12
|
+
exports.ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER = 7;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FIELD_HEIGHT_MULTIPLIER = 10;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useInputFieldFontSizeInterpolationOutputRange: () => number[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInputFieldFontSizeInterpolationOutputRange = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const useTheme_1 = require("./useTheme");
|
|
7
|
+
const useInputFieldFontSizeInterpolationOutputRange = () => {
|
|
8
|
+
const theme = (0, useTheme_1.useTheme)();
|
|
9
|
+
return (0, react_1.useMemo)(() => (0, utils_1.getInputLabelFontSizeInterpolationOutputRange)(theme), [theme]);
|
|
10
|
+
};
|
|
11
|
+
exports.useInputFieldFontSizeInterpolationOutputRange = useInputFieldFontSizeInterpolationOutputRange;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMenuItemStyles =
|
|
3
|
+
exports.useMenuItemStyles = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
6
|
const hooks_1 = require("../../hooks");
|
|
7
|
-
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
8
|
const useMenuItemStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
|
|
9
9
|
textInput: Object.assign({}, theme.typography.h3),
|
|
10
10
|
container: {},
|
|
@@ -14,11 +14,11 @@ const useMenuItemStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallb
|
|
|
14
14
|
backgroundColor: theme.colors.backgroundOnPrimary,
|
|
15
15
|
borderRadius: theme.borderRadius,
|
|
16
16
|
paddingHorizontal: theme.size.baseSize * 2,
|
|
17
|
-
minHeight:
|
|
17
|
+
minHeight: theme.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
18
18
|
flexDirection: "row",
|
|
19
19
|
justifyContent: "space-between",
|
|
20
20
|
alignItems: "center",
|
|
21
|
-
height: theme.size.baseSize *
|
|
21
|
+
height: theme.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
22
22
|
},
|
|
23
23
|
itemLabel: {
|
|
24
24
|
color: theme.colors.foregroundHighContrast,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AtlasTheme } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Gets the font size interpolation output range for animated input labels.
|
|
4
|
+
*
|
|
5
|
+
* This function returns an array of font sizes used to animate text input labels
|
|
6
|
+
* between two states - typically from a larger size when the input is empty/unfocused
|
|
7
|
+
* to a smaller size when the input has content or is focused.
|
|
8
|
+
*
|
|
9
|
+
* @param theme - The Atlas theme object containing typography definitions
|
|
10
|
+
* @returns A tuple containing [largerFontSize, smallerFontSize] for label animation
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const theme = useTheme();
|
|
15
|
+
* const [startSize, endSize] = getInputLabelFontSizeInterpolationOutputRange(theme);
|
|
16
|
+
* // Use with react-native-reanimated interpolate function
|
|
17
|
+
* const animatedStyle = useAnimatedStyle(() => ({
|
|
18
|
+
* fontSize: interpolate(animationValue, [0, 1], [startSize, endSize])
|
|
19
|
+
* }));
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const getInputLabelFontSizeInterpolationOutputRange: (theme: AtlasTheme) => number[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInputLabelFontSizeInterpolationOutputRange = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Gets the font size interpolation output range for animated input labels.
|
|
6
|
+
*
|
|
7
|
+
* This function returns an array of font sizes used to animate text input labels
|
|
8
|
+
* between two states - typically from a larger size when the input is empty/unfocused
|
|
9
|
+
* to a smaller size when the input has content or is focused.
|
|
10
|
+
*
|
|
11
|
+
* @param theme - The Atlas theme object containing typography definitions
|
|
12
|
+
* @returns A tuple containing [largerFontSize, smallerFontSize] for label animation
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const theme = useTheme();
|
|
17
|
+
* const [startSize, endSize] = getInputLabelFontSizeInterpolationOutputRange(theme);
|
|
18
|
+
* // Use with react-native-reanimated interpolate function
|
|
19
|
+
* const animatedStyle = useAnimatedStyle(() => ({
|
|
20
|
+
* fontSize: interpolate(animationValue, [0, 1], [startSize, endSize])
|
|
21
|
+
* }));
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
const getInputLabelFontSizeInterpolationOutputRange = (theme) => {
|
|
25
|
+
const { typography } = theme;
|
|
26
|
+
return [typography.p1.fontSize, typography.p2.fontSize];
|
|
27
|
+
};
|
|
28
|
+
exports.getInputLabelFontSizeInterpolationOutputRange = getInputLabelFontSizeInterpolationOutputRange;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./animation";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./animation"), exports);
|