atlas-design-system 1.17.4 → 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 +16 -6
- 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 +13 -6
- package/dist/components/TextInput/TextInput.js +18 -7
- package/dist/components/TextInput/index.d.ts +2 -2
- package/dist/components/TextInput/index.js +2 -2
- package/dist/constants/animations.d.ts +3 -0
- package/dist/constants/animations.js +4 -1
- 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
|
@@ -40,6 +40,9 @@ const hooks_1 = require("../../hooks");
|
|
|
40
40
|
const Button_1 = __importDefault(require("../Button"));
|
|
41
41
|
const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
|
|
42
42
|
const FieldError_1 = require("../FieldError/FieldError");
|
|
43
|
+
const animations_1 = require("../../constants/animations");
|
|
44
|
+
const constants_1 = require("../../constants");
|
|
45
|
+
const useInputFieldFontSizeInterpolationOutputRange_1 = require("../../hooks/useInputFieldFontSizeInterpolationOutputRange");
|
|
43
46
|
const getFormat = (mode) => {
|
|
44
47
|
switch (mode) {
|
|
45
48
|
case "date": {
|
|
@@ -75,18 +78,25 @@ const DateTimeInput = ({ value, onChange, testID, containerStyle, label, caption
|
|
|
75
78
|
? styles.itemContainerFocused.borderColor
|
|
76
79
|
: styles.itemContainer.borderColor);
|
|
77
80
|
}, [error, dateSheetOpen]);
|
|
81
|
+
const labelFontSizeInterpolationOutputRange = (0, useInputFieldFontSizeInterpolationOutputRange_1.useInputFieldFontSizeInterpolationOutputRange)();
|
|
78
82
|
const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
79
83
|
return {
|
|
80
84
|
transform: [
|
|
81
|
-
{
|
|
85
|
+
{
|
|
86
|
+
translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE),
|
|
87
|
+
},
|
|
82
88
|
],
|
|
83
|
-
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),
|
|
84
90
|
};
|
|
85
|
-
}, []);
|
|
91
|
+
}, [labelFontSizeInterpolationOutputRange]);
|
|
86
92
|
const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
87
93
|
return {
|
|
88
94
|
flex: 1,
|
|
89
|
-
transform: [
|
|
95
|
+
transform: [
|
|
96
|
+
{
|
|
97
|
+
translateY: animatedValue.value * animations_1.ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
90
100
|
};
|
|
91
101
|
});
|
|
92
102
|
return (<>
|
|
@@ -134,13 +144,13 @@ const useStyles = (disabled) => (0, hooks_1.useThemedStyle)((0, react_1.useCallb
|
|
|
134
144
|
backgroundColor: t.colors.backgroundOnPrimary,
|
|
135
145
|
borderRadius: t.borderRadius,
|
|
136
146
|
paddingHorizontal: t.size.baseSize * 2,
|
|
137
|
-
minHeight: t.size.baseSize *
|
|
147
|
+
minHeight: t.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
138
148
|
flexDirection: "row",
|
|
139
149
|
justifyContent: "space-between",
|
|
140
150
|
alignItems: "center",
|
|
141
151
|
borderColor: t.colors.backgroundOnPrimary,
|
|
142
152
|
borderWidth: t.borderWidth,
|
|
143
|
-
height: t.size.baseSize *
|
|
153
|
+
height: t.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
144
154
|
},
|
|
145
155
|
itemContainerError: {
|
|
146
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,20 +75,25 @@ 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: [
|
|
79
82
|
{
|
|
80
|
-
translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value,
|
|
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,18 +97,25 @@ 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: [
|
|
101
|
-
{
|
|
104
|
+
{
|
|
105
|
+
translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, animations_1.LABEL_INTERPOLATION_RANGE, animations_1.LABEL_INTERPOLATION_OUTPUT_RANGE),
|
|
106
|
+
},
|
|
102
107
|
],
|
|
103
|
-
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),
|
|
104
109
|
};
|
|
105
|
-
}, []);
|
|
110
|
+
}, [labelFontSizeInterpolationOutputRange]);
|
|
106
111
|
const animatedInputStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
107
112
|
return {
|
|
108
113
|
flex: 1,
|
|
109
|
-
transform: [
|
|
114
|
+
transform: [
|
|
115
|
+
{
|
|
116
|
+
translateY: animatedValue.value * animations_1.ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
110
119
|
};
|
|
111
120
|
});
|
|
112
121
|
(0, react_1.useEffect)(() => {
|
|
@@ -204,8 +213,8 @@ const useStyles = (disabled, error, multiline) => (0, hooks_1.useThemedStyle)((0
|
|
|
204
213
|
borderWidth: theme.borderWidth,
|
|
205
214
|
backgroundColor: theme.colors.backgroundOnPrimary,
|
|
206
215
|
height: multiline
|
|
207
|
-
? theme.size.baseSize *
|
|
208
|
-
: theme.size.baseSize *
|
|
216
|
+
? theme.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER * 2.5
|
|
217
|
+
: theme.size.baseSize * constants_1.FIELD_HEIGHT_MULTIPLIER,
|
|
209
218
|
borderRadius: theme.borderRadius,
|
|
210
219
|
minHeight: theme.size.baseSize * 8,
|
|
211
220
|
flexDirection: "row",
|
|
@@ -220,7 +229,9 @@ const useStyles = (disabled, error, multiline) => (0, hooks_1.useThemedStyle)((0
|
|
|
220
229
|
},
|
|
221
230
|
labelContainer: {
|
|
222
231
|
left: theme.size.baseSize * 2,
|
|
223
|
-
top: multiline
|
|
232
|
+
top: multiline
|
|
233
|
+
? theme.size.baseSize * 1
|
|
234
|
+
: theme.size.baseSize * 2.5,
|
|
224
235
|
position: "absolute",
|
|
225
236
|
},
|
|
226
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);
|
|
@@ -3,3 +3,6 @@ export declare const DEFAULT_TIMING_CONFIG: {
|
|
|
3
3
|
duration: number;
|
|
4
4
|
easing: import("react-native-reanimated").EasingFunction;
|
|
5
5
|
};
|
|
6
|
+
export declare const LABEL_INTERPOLATION_RANGE: number[];
|
|
7
|
+
export declare const LABEL_INTERPOLATION_OUTPUT_RANGE: number[];
|
|
8
|
+
export declare const ANIMATED_VALUE_TRANSLATE_Y_MULTIPLIER = 7;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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 = {
|
|
7
7
|
duration: 150,
|
|
8
8
|
easing: exports.DEFAULT_EASING,
|
|
9
9
|
};
|
|
10
|
+
exports.LABEL_INTERPOLATION_RANGE = [0, 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);
|