ferns-ui 0.37.0 → 0.37.2
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/Avatar.js +5 -6
- package/dist/Avatar.js.map +1 -1
- package/dist/Badge.js +4 -3
- package/dist/Badge.js.map +1 -1
- package/dist/Body.d.ts +10 -5
- package/dist/Body.js +14 -15
- package/dist/Body.js.map +1 -1
- package/dist/Box.js +9 -7
- package/dist/Box.js.map +1 -1
- package/dist/Button.js +5 -3
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +7 -19
- package/dist/Common.js.map +1 -1
- package/dist/DateTimeActionSheet.js +9 -7
- package/dist/DateTimeActionSheet.js.map +1 -1
- package/dist/DateTimeField.android.js +5 -4
- package/dist/DateTimeField.android.js.map +1 -1
- package/dist/DateTimeField.ios.js +6 -5
- package/dist/DateTimeField.ios.js.map +1 -1
- package/dist/FernsProvider.js +4 -2
- package/dist/FernsProvider.js.map +1 -1
- package/dist/Heading.d.ts +1 -9
- package/dist/Heading.js +22 -43
- package/dist/Heading.js.map +1 -1
- package/dist/Icon.js +4 -3
- package/dist/Icon.js.map +1 -1
- package/dist/IconButton.d.ts +1 -1
- package/dist/IconButton.js +4 -2
- package/dist/IconButton.js.map +1 -1
- package/dist/Modal.js +2 -1
- package/dist/Modal.js.map +1 -1
- package/dist/Page.js +1 -3
- package/dist/Page.js.map +1 -1
- package/dist/ProgressBar.d.ts +5 -7
- package/dist/ProgressBar.js +30 -36
- package/dist/ProgressBar.js.map +1 -1
- package/dist/SelectList.js +6 -5
- package/dist/SelectList.js.map +1 -1
- package/dist/Spinner.d.ts +5 -1
- package/dist/Spinner.js +1 -1
- package/dist/Spinner.js.map +1 -1
- package/dist/SplitPage.js +4 -3
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.js +4 -2
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/Text.js +6 -5
- package/dist/Text.js.map +1 -1
- package/dist/TextField.js +11 -10
- package/dist/TextField.js.map +1 -1
- package/dist/Theme.d.ts +12 -0
- package/dist/Theme.js +108 -0
- package/dist/Theme.js.map +1 -0
- package/dist/Tooltip.js +4 -2
- package/dist/Tooltip.js.map +1 -1
- package/dist/Unifier.d.ts +1 -6
- package/dist/Unifier.js +0 -134
- package/dist/Unifier.js.map +1 -1
- package/dist/Utilities.d.ts +1 -0
- package/dist/Utilities.js +4 -0
- package/dist/Utilities.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Avatar.tsx +6 -6
- package/src/Badge.tsx +5 -3
- package/src/Body.tsx +32 -21
- package/src/Box.tsx +10 -8
- package/src/Button.tsx +5 -3
- package/src/Common.ts +11 -22
- package/src/DateTimeActionSheet.tsx +11 -7
- package/src/DateTimeField.android.tsx +5 -4
- package/src/DateTimeField.ios.tsx +6 -5
- package/src/FernsProvider.tsx +14 -11
- package/src/Heading.tsx +27 -44
- package/src/Icon.tsx +4 -3
- package/src/IconButton.tsx +12 -3
- package/src/Modal.tsx +2 -1
- package/src/Page.tsx +1 -5
- package/src/ProgressBar.tsx +41 -44
- package/src/SelectList.tsx +7 -5
- package/src/Spinner.tsx +7 -2
- package/src/SplitPage.native.tsx +4 -2
- package/src/SplitPage.tsx +4 -3
- package/src/Text.tsx +7 -5
- package/src/TextField.tsx +13 -11
- package/src/Theme.tsx +189 -0
- package/src/Tooltip.tsx +4 -2
- package/src/Unifier.ts +0 -196
- package/src/Utilities.tsx +5 -0
- package/src/index.tsx +1 -0
package/dist/Utilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../src/Utilities.tsx"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,qDAAqD;AACrD,OAAO,GAAG,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../src/Utilities.tsx"],"names":[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AS,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,4BAA4B;AAC5B,4BAA4B;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AAExB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;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vB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,4BAA4B;AAC5B,4BAA4B;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AAExB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,2BAA2B;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
package/package.json
CHANGED
package/src/Avatar.tsx
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import {ImageResult, manipulateAsync, SaveFormat} from "expo-image-manipulator";
|
|
3
3
|
import {launchImageLibraryAsync, MediaTypeOptions} from "expo-image-picker";
|
|
4
|
-
import React, {useEffect, useState} from "react";
|
|
4
|
+
import React, {useContext, useEffect, useState} from "react";
|
|
5
5
|
import {Image, ImageResizeMode, Platform, Text, View} from "react-native";
|
|
6
6
|
|
|
7
7
|
import {Box} from "./Box";
|
|
8
8
|
import {AllColors, IconName, UnsignedUpTo12} from "./Common";
|
|
9
9
|
import {Icon} from "./Icon";
|
|
10
10
|
import {isMobileDevice} from "./MediaQuery";
|
|
11
|
+
import {ThemeContext} from "./Theme";
|
|
11
12
|
import {Tooltip} from "./Tooltip";
|
|
12
|
-
import {Unifier} from "./Unifier";
|
|
13
13
|
|
|
14
14
|
const sizes = {
|
|
15
15
|
xs: 24,
|
|
@@ -116,6 +116,8 @@ interface AvatarProps {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
119
|
+
const {theme} = useContext(ThemeContext);
|
|
120
|
+
|
|
119
121
|
const [isImageLoaded, setIsImageLoaded] = useState(true);
|
|
120
122
|
const [hovered, setHovered] = useState(false);
|
|
121
123
|
const [src, setSrc] = useState(props.src ?? undefined);
|
|
@@ -279,12 +281,10 @@ export const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
|
279
281
|
display: "flex",
|
|
280
282
|
alignItems: "center",
|
|
281
283
|
justifyContent: "center",
|
|
282
|
-
backgroundColor: props.backgroundColor
|
|
283
|
-
? Unifier.theme[props.backgroundColor]
|
|
284
|
-
: Unifier.theme.gray,
|
|
284
|
+
backgroundColor: props.backgroundColor ? theme[props.backgroundColor] : theme.gray,
|
|
285
285
|
}}
|
|
286
286
|
>
|
|
287
|
-
<Text style={{fontSize, color: props.textColor ??
|
|
287
|
+
<Text style={{fontSize, color: props.textColor ?? theme.darkGray}}>
|
|
288
288
|
{computedInitials}
|
|
289
289
|
</Text>
|
|
290
290
|
</View>
|
package/src/Badge.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {useContext} from "react";
|
|
2
2
|
import {Text, View} from "react-native";
|
|
3
3
|
|
|
4
4
|
import {AllColors} from "./Common";
|
|
5
|
-
import {
|
|
5
|
+
import {ThemeContext} from "./Theme";
|
|
6
6
|
|
|
7
7
|
interface BadgeProps {
|
|
8
8
|
// The text to display inside the badge.
|
|
@@ -29,6 +29,8 @@ export function Badge({
|
|
|
29
29
|
type = "info",
|
|
30
30
|
color,
|
|
31
31
|
}: BadgeProps): React.ReactElement {
|
|
32
|
+
const {theme} = useContext(ThemeContext);
|
|
33
|
+
|
|
32
34
|
if (color && type !== "custom") {
|
|
33
35
|
console.warn('Badge color only supported when `type` is set to "custom".');
|
|
34
36
|
}
|
|
@@ -37,7 +39,7 @@ export function Badge({
|
|
|
37
39
|
return (
|
|
38
40
|
<View
|
|
39
41
|
style={{
|
|
40
|
-
backgroundColor:
|
|
42
|
+
backgroundColor: theme[badgeColor],
|
|
41
43
|
borderRadius: 2,
|
|
42
44
|
height: 14,
|
|
43
45
|
paddingTop: 2,
|
package/src/Body.tsx
CHANGED
|
@@ -1,32 +1,43 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {ReactNode, useContext} from "react";
|
|
2
2
|
import {ActivityIndicator, KeyboardAvoidingView} from "react-native";
|
|
3
3
|
|
|
4
4
|
import {Box} from "./Box";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import {UnsignedUpTo12} from "./Common";
|
|
6
|
+
import {ThemeContext} from "./Theme";
|
|
7
7
|
|
|
8
|
-
export
|
|
9
|
-
|
|
8
|
+
export interface BodyProps {
|
|
9
|
+
scroll?: boolean;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
padding?: UnsignedUpTo12;
|
|
12
|
+
height?: number | string;
|
|
13
|
+
avoidKeyboard?: boolean; // default true
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function Body({
|
|
18
|
+
scroll,
|
|
19
|
+
loading,
|
|
20
|
+
padding,
|
|
21
|
+
height,
|
|
22
|
+
avoidKeyboard,
|
|
23
|
+
children,
|
|
24
|
+
}: BodyProps): React.ReactElement {
|
|
25
|
+
const {theme} = useContext(ThemeContext);
|
|
26
|
+
|
|
27
|
+
const renderBody = () => {
|
|
10
28
|
return (
|
|
11
|
-
<Box avoidKeyboard height="100%" scroll={
|
|
12
|
-
<Box
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
>
|
|
16
|
-
{this.props.loading === true && (
|
|
17
|
-
<ActivityIndicator color={Unifier.theme.darkGray} size="large" />
|
|
18
|
-
)}
|
|
19
|
-
{this.props.children}
|
|
29
|
+
<Box avoidKeyboard height="100%" scroll={scroll}>
|
|
30
|
+
<Box height={height || "100%"} padding={padding !== undefined ? padding : 5}>
|
|
31
|
+
{loading === true && <ActivityIndicator color={theme.darkGray} size="large" />}
|
|
32
|
+
{children}
|
|
20
33
|
</Box>
|
|
21
34
|
</Box>
|
|
22
35
|
);
|
|
23
|
-
}
|
|
36
|
+
};
|
|
24
37
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return <KeyboardAvoidingView behavior="position">{this.renderBody()}</KeyboardAvoidingView>;
|
|
30
|
-
}
|
|
38
|
+
if (avoidKeyboard === false) {
|
|
39
|
+
return renderBody();
|
|
40
|
+
} else {
|
|
41
|
+
return <KeyboardAvoidingView behavior="position">{renderBody()}</KeyboardAvoidingView>;
|
|
31
42
|
}
|
|
32
43
|
}
|
package/src/Box.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
|
-
import React, {useImperativeHandle} from "react";
|
|
2
|
+
import React, {useContext, useImperativeHandle} from "react";
|
|
3
3
|
import {
|
|
4
4
|
KeyboardAvoidingView,
|
|
5
5
|
Platform,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
View,
|
|
10
10
|
} from "react-native";
|
|
11
11
|
|
|
12
|
-
import {UnifiedTheme} from ".";
|
|
12
|
+
import {ThemeContext, UnifiedTheme} from ".";
|
|
13
13
|
import {AlignContent, AlignItems, AlignSelf, BoxProps, JustifyContent, SPACING} from "./Common";
|
|
14
14
|
import {mediaQueryLargerThan} from "./MediaQuery";
|
|
15
15
|
import {Unifier} from "./Unifier";
|
|
@@ -46,6 +46,8 @@ const BORDER_WIDTH = 1;
|
|
|
46
46
|
|
|
47
47
|
// eslint-disable-next-line react/display-name
|
|
48
48
|
export const Box = React.forwardRef((props: BoxProps, ref) => {
|
|
49
|
+
const {theme} = useContext(ThemeContext);
|
|
50
|
+
|
|
49
51
|
useImperativeHandle(ref, () => ({
|
|
50
52
|
scrollToEnd: () => {
|
|
51
53
|
if (scrollRef && scrollRef.current) {
|
|
@@ -77,7 +79,7 @@ export const Box = React.forwardRef((props: BoxProps, ref) => {
|
|
|
77
79
|
alignItems: (value: AlignItems) => ({alignItems: ALIGN_ITEMS[value]}),
|
|
78
80
|
alignContent: (value: AlignContent) => ({alignContent: ALIGN_CONTENT[value]}),
|
|
79
81
|
alignSelf: (value: AlignSelf) => ({alignSelf: ALIGN_SELF[value]}),
|
|
80
|
-
color: (value: keyof UnifiedTheme) => ({backgroundColor:
|
|
82
|
+
color: (value: keyof UnifiedTheme) => ({backgroundColor: theme[value]}),
|
|
81
83
|
direction: (value: any) => ({flexDirection: value, display: "flex"}),
|
|
82
84
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
83
85
|
smDirection: (value: any) =>
|
|
@@ -177,31 +179,31 @@ export const Box = React.forwardRef((props: BoxProps, ref) => {
|
|
|
177
179
|
if (!value) {
|
|
178
180
|
return {};
|
|
179
181
|
}
|
|
180
|
-
return {borderColor:
|
|
182
|
+
return {borderColor: theme[value], borderWidth: BORDER_WIDTH};
|
|
181
183
|
},
|
|
182
184
|
borderBottom: (value: keyof UnifiedTheme) => {
|
|
183
185
|
if (!value) {
|
|
184
186
|
return {};
|
|
185
187
|
}
|
|
186
|
-
return {borderBottomColor:
|
|
188
|
+
return {borderBottomColor: theme[value], borderBottomWidth: BORDER_WIDTH};
|
|
187
189
|
},
|
|
188
190
|
borderTop: (value: keyof UnifiedTheme) => {
|
|
189
191
|
if (!value) {
|
|
190
192
|
return {};
|
|
191
193
|
}
|
|
192
|
-
return {borderTopColor:
|
|
194
|
+
return {borderTopColor: theme[value], borderTopWidth: BORDER_WIDTH};
|
|
193
195
|
},
|
|
194
196
|
borderRight: (value: keyof UnifiedTheme) => {
|
|
195
197
|
if (!value) {
|
|
196
198
|
return {};
|
|
197
199
|
}
|
|
198
|
-
return {borderRightColor:
|
|
200
|
+
return {borderRightColor: theme[value], borderRightWidth: BORDER_WIDTH};
|
|
199
201
|
},
|
|
200
202
|
borderLeft: (value: keyof UnifiedTheme) => {
|
|
201
203
|
if (!value) {
|
|
202
204
|
return {};
|
|
203
205
|
}
|
|
204
|
-
return {borderLeftColor:
|
|
206
|
+
return {borderLeftColor: theme[value], borderLeftWidth: BORDER_WIDTH};
|
|
205
207
|
},
|
|
206
208
|
};
|
|
207
209
|
|
package/src/Button.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import debounce from "lodash/debounce";
|
|
2
|
-
import React, {useState} from "react";
|
|
2
|
+
import React, {useContext, useState} from "react";
|
|
3
3
|
import {ActivityIndicator, Pressable, View} from "react-native";
|
|
4
4
|
|
|
5
5
|
import {Box} from "./Box";
|
|
@@ -7,6 +7,7 @@ import {ButtonColor, Color, IconName, IconPrefix, TooltipDirection, UnifiedTheme
|
|
|
7
7
|
import {Icon} from "./Icon";
|
|
8
8
|
import {Modal} from "./Modal";
|
|
9
9
|
import {Text} from "./Text";
|
|
10
|
+
import {ThemeContext} from "./Theme";
|
|
10
11
|
import {Tooltip} from "./Tooltip";
|
|
11
12
|
import {Unifier} from "./Unifier";
|
|
12
13
|
|
|
@@ -78,12 +79,13 @@ export function Button({
|
|
|
78
79
|
}: ButtonProps) {
|
|
79
80
|
const [loading, setLoading] = useState(propsLoading);
|
|
80
81
|
const [showConfirmation, setShowConfirmation] = useState(false);
|
|
82
|
+
const {theme} = useContext(ThemeContext);
|
|
81
83
|
|
|
82
84
|
const getBackgroundColor = (backgroundColor: string): string => {
|
|
83
85
|
if (type === "ghost" || type === "outline") {
|
|
84
86
|
return "transparent";
|
|
85
87
|
} else {
|
|
86
|
-
return
|
|
88
|
+
return theme[backgroundColor as keyof UnifiedTheme];
|
|
87
89
|
}
|
|
88
90
|
};
|
|
89
91
|
|
|
@@ -99,7 +101,7 @@ export function Button({
|
|
|
99
101
|
|
|
100
102
|
const getBorderColor = (borderColor: string): string => {
|
|
101
103
|
if (type === "outline") {
|
|
102
|
-
return
|
|
104
|
+
return theme[getTextColor(borderColor as Color)];
|
|
103
105
|
} else {
|
|
104
106
|
return "transparent";
|
|
105
107
|
}
|
package/src/Common.ts
CHANGED
|
@@ -120,6 +120,14 @@ export interface UnifiedTheme {
|
|
|
120
120
|
tertiaryDark: string;
|
|
121
121
|
tertiaryDarker: string;
|
|
122
122
|
|
|
123
|
+
// Support for light and dark mode.
|
|
124
|
+
background: string;
|
|
125
|
+
backgroundSecondary: string;
|
|
126
|
+
textPrimary: string;
|
|
127
|
+
textSecondary: string;
|
|
128
|
+
textDisabled: string;
|
|
129
|
+
divider: string;
|
|
130
|
+
|
|
123
131
|
neutral900: string;
|
|
124
132
|
neutral800: string;
|
|
125
133
|
neutral700: string;
|
|
@@ -202,7 +210,9 @@ export type ThemeColor =
|
|
|
202
210
|
| "accentLight"
|
|
203
211
|
| "accent"
|
|
204
212
|
| "accentDark"
|
|
205
|
-
| "accentDarker"
|
|
213
|
+
| "accentDarker"
|
|
214
|
+
| "background"
|
|
215
|
+
| "backgroundSecondary";
|
|
206
216
|
export type NeutralColor =
|
|
207
217
|
| "neutral900"
|
|
208
218
|
| "neutral800"
|
|
@@ -2092,11 +2102,6 @@ export interface SwitchProps extends FieldWithLabelsProps {
|
|
|
2092
2102
|
label?: string;
|
|
2093
2103
|
}
|
|
2094
2104
|
|
|
2095
|
-
export interface SpinnerProps {
|
|
2096
|
-
size?: "sm" | "md";
|
|
2097
|
-
color?: Color;
|
|
2098
|
-
}
|
|
2099
|
-
|
|
2100
2105
|
export interface MaskProps {
|
|
2101
2106
|
children?: ReactChildren;
|
|
2102
2107
|
shape?: "circle" | "rounded" | "square";
|
|
@@ -2188,17 +2193,6 @@ export interface CheckBoxProps {
|
|
|
2188
2193
|
labelColor?: AllColors;
|
|
2189
2194
|
}
|
|
2190
2195
|
|
|
2191
|
-
export interface BodyProps {
|
|
2192
|
-
scroll?: boolean;
|
|
2193
|
-
loading?: boolean;
|
|
2194
|
-
useBox?: boolean; // defaults false
|
|
2195
|
-
style?: any;
|
|
2196
|
-
padding?: UnsignedUpTo12;
|
|
2197
|
-
height?: number | string;
|
|
2198
|
-
avoidKeyboard?: boolean; // default true
|
|
2199
|
-
children?: ReactNode;
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
2196
|
export interface ChatPaneProps {
|
|
2203
2197
|
messagesView: any;
|
|
2204
2198
|
textFormView: any;
|
|
@@ -2723,11 +2717,6 @@ export interface NavConfig {
|
|
|
2723
2717
|
provider?: any;
|
|
2724
2718
|
}
|
|
2725
2719
|
|
|
2726
|
-
export interface ProgressBarProps {
|
|
2727
|
-
color: Color;
|
|
2728
|
-
completed: number;
|
|
2729
|
-
}
|
|
2730
|
-
|
|
2731
2720
|
export interface AddressInterface {
|
|
2732
2721
|
address1: string;
|
|
2733
2722
|
address2?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Picker} from "@react-native-picker/picker";
|
|
2
2
|
import range from "lodash/range";
|
|
3
|
-
import React, {useEffect, useState} from "react";
|
|
3
|
+
import React, {useContext, useEffect, useState} from "react";
|
|
4
4
|
import {Platform, StyleProp, TextInput, TextStyle, View} from "react-native";
|
|
5
5
|
import {Calendar} from "react-native-calendars";
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ import {IconButton} from "./IconButton";
|
|
|
12
12
|
import {isMobileDevice} from "./MediaQuery";
|
|
13
13
|
import {Modal} from "./Modal";
|
|
14
14
|
import {SelectList} from "./SelectList";
|
|
15
|
-
import {
|
|
15
|
+
import {ThemeContext} from "./Theme";
|
|
16
16
|
|
|
17
17
|
const TIME_PICKER_HEIGHT = 104;
|
|
18
18
|
const INPUT_HEIGHT = 40;
|
|
@@ -31,6 +31,8 @@ function TimeInput({
|
|
|
31
31
|
value: number;
|
|
32
32
|
onChange: (value: number) => void;
|
|
33
33
|
}): React.ReactElement {
|
|
34
|
+
const {theme} = useContext(ThemeContext);
|
|
35
|
+
|
|
34
36
|
const defaultText = type === "minute" ? String(value).padStart(2, "0") : String(value);
|
|
35
37
|
const [text, setText] = useState(defaultText);
|
|
36
38
|
const [focused, setFocused] = useState(false);
|
|
@@ -50,8 +52,8 @@ function TimeInput({
|
|
|
50
52
|
paddingLeft: 0,
|
|
51
53
|
height: INPUT_HEIGHT,
|
|
52
54
|
width: "100%",
|
|
53
|
-
color:
|
|
54
|
-
fontFamily:
|
|
55
|
+
color: theme.darkGray,
|
|
56
|
+
fontFamily: theme.primaryFont,
|
|
55
57
|
};
|
|
56
58
|
|
|
57
59
|
return (
|
|
@@ -65,10 +67,10 @@ function TimeInput({
|
|
|
65
67
|
// Add padding so the border doesn't mess up layouts
|
|
66
68
|
paddingHorizontal: focused ? 10 : 14,
|
|
67
69
|
paddingVertical: focused ? 0 : 4,
|
|
68
|
-
borderColor: error ?
|
|
70
|
+
borderColor: error ? theme.red : theme.blue,
|
|
69
71
|
borderWidth: focused ? 5 : 1,
|
|
70
72
|
borderRadius: 5,
|
|
71
|
-
backgroundColor:
|
|
73
|
+
backgroundColor: theme.white,
|
|
72
74
|
}}
|
|
73
75
|
>
|
|
74
76
|
<TextInput
|
|
@@ -179,6 +181,8 @@ export function DateTimeActionSheet({
|
|
|
179
181
|
visible,
|
|
180
182
|
onDismiss,
|
|
181
183
|
}: DateTimeActionSheetProps) {
|
|
184
|
+
const {theme} = useContext(ThemeContext);
|
|
185
|
+
|
|
182
186
|
// Accept ISO 8601, HH:mm, or hh:mm A formats. We may want only HH:mm or hh:mm A for mode=time
|
|
183
187
|
let m;
|
|
184
188
|
if (value) {
|
|
@@ -352,7 +356,7 @@ export function DateTimeActionSheet({
|
|
|
352
356
|
if (date) {
|
|
353
357
|
markedDates[dayjs(date).format("YYYY-MM-DD")] = {
|
|
354
358
|
selected: true,
|
|
355
|
-
selectedColor:
|
|
359
|
+
selectedColor: theme.primary,
|
|
356
360
|
};
|
|
357
361
|
}
|
|
358
362
|
return (
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import DateTimePicker from "@react-native-community/datetimepicker";
|
|
2
|
-
import React, {ReactElement, useMemo, useState} from "react";
|
|
2
|
+
import React, {ReactElement, useContext, useMemo, useState} from "react";
|
|
3
3
|
import {TextInput} from "react-native";
|
|
4
4
|
|
|
5
5
|
import {DateTimeFieldProps} from "./Common";
|
|
6
6
|
import dayjs from "./dayjsExtended";
|
|
7
|
-
import {
|
|
7
|
+
import {ThemeContext} from "./Theme";
|
|
8
8
|
import {WithLabel} from "./WithLabel";
|
|
9
9
|
|
|
10
10
|
export const DateTimeField = ({
|
|
@@ -21,6 +21,7 @@ export const DateTimeField = ({
|
|
|
21
21
|
// const [tempDate, setTempDate] = useState<Date>();
|
|
22
22
|
const [pickerMode, setPickerMode] = useState(mode);
|
|
23
23
|
const [showPicker, setShowPicker] = useState(false);
|
|
24
|
+
const {theme} = useContext(ThemeContext);
|
|
24
25
|
|
|
25
26
|
const showCalendarFirst = mode === "datetime" || mode === "date";
|
|
26
27
|
|
|
@@ -69,8 +70,8 @@ export const DateTimeField = ({
|
|
|
69
70
|
paddingLeft: 10,
|
|
70
71
|
height: 40,
|
|
71
72
|
width: "100%",
|
|
72
|
-
color:
|
|
73
|
-
fontFamily:
|
|
73
|
+
color: theme.darkGray,
|
|
74
|
+
fontFamily: theme.primaryFont,
|
|
74
75
|
borderWidth: 1,
|
|
75
76
|
}}
|
|
76
77
|
value={dayjs(value).format(defaultFormat)}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import DateTimePicker from "@react-native-community/datetimepicker";
|
|
2
|
-
import React, {ReactElement, useMemo, useState} from "react";
|
|
2
|
+
import React, {ReactElement, useContext, useMemo, useState} from "react";
|
|
3
3
|
import {TextInput} from "react-native";
|
|
4
4
|
|
|
5
5
|
import {DateTimeFieldProps} from "./Common";
|
|
6
6
|
import dayjs from "./dayjsExtended";
|
|
7
|
-
import {
|
|
7
|
+
import {ThemeContext} from "./Theme";
|
|
8
8
|
import {WithLabel} from "./WithLabel";
|
|
9
9
|
|
|
10
10
|
export const DateTimeField = ({
|
|
@@ -18,6 +18,7 @@ export const DateTimeField = ({
|
|
|
18
18
|
label,
|
|
19
19
|
}: DateTimeFieldProps): ReactElement => {
|
|
20
20
|
const [showPicker, setShowPicker] = useState(false);
|
|
21
|
+
const {theme} = useContext(ThemeContext);
|
|
21
22
|
|
|
22
23
|
const defaultFormat = useMemo(() => {
|
|
23
24
|
if (dateFormat) {
|
|
@@ -51,8 +52,8 @@ export const DateTimeField = ({
|
|
|
51
52
|
paddingLeft: 10,
|
|
52
53
|
height: 40,
|
|
53
54
|
width: "100%",
|
|
54
|
-
color:
|
|
55
|
-
fontFamily:
|
|
55
|
+
color: theme.darkGray,
|
|
56
|
+
fontFamily: theme.primaryFont,
|
|
56
57
|
borderWidth: 1,
|
|
57
58
|
}}
|
|
58
59
|
value={dayjs(value).format(defaultFormat)}
|
|
@@ -63,7 +64,7 @@ export const DateTimeField = ({
|
|
|
63
64
|
|
|
64
65
|
{showPicker && (
|
|
65
66
|
<DateTimePicker
|
|
66
|
-
accentColor={
|
|
67
|
+
accentColor={theme.primary}
|
|
67
68
|
display={pickerType}
|
|
68
69
|
mode={mode}
|
|
69
70
|
style={{alignSelf: "flex-start"}}
|
package/src/FernsProvider.tsx
CHANGED
|
@@ -2,20 +2,23 @@ import React from "react";
|
|
|
2
2
|
import {Host} from "react-native-portalize";
|
|
3
3
|
import {ToastProvider} from "react-native-toast-notifications";
|
|
4
4
|
|
|
5
|
+
import {ThemeProvider} from "./Theme";
|
|
5
6
|
import {Toast} from "./Toast";
|
|
6
7
|
|
|
7
8
|
export function FernsProvider({children}: {children: React.ReactNode}): React.ReactElement {
|
|
8
9
|
return (
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
<ThemeProvider>
|
|
11
|
+
<ToastProvider
|
|
12
|
+
animationDuration={250}
|
|
13
|
+
animationType="slide-in"
|
|
14
|
+
duration={50000}
|
|
15
|
+
offset={50}
|
|
16
|
+
placement="bottom"
|
|
17
|
+
renderToast={(toastOptions) => <Toast {...(toastOptions as any)} />}
|
|
18
|
+
swipeEnabled
|
|
19
|
+
>
|
|
20
|
+
<Host>{children}</Host>
|
|
21
|
+
</ToastProvider>
|
|
22
|
+
</ThemeProvider>
|
|
20
23
|
);
|
|
21
24
|
}
|
package/src/Heading.tsx
CHANGED
|
@@ -1,53 +1,36 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {Text as NativeText} from "react-native";
|
|
1
|
+
import React, {useContext} from "react";
|
|
2
|
+
import {StyleProp, Text as NativeText, TextStyle} from "react-native";
|
|
3
3
|
|
|
4
4
|
import {HeadingProps} from "./Common";
|
|
5
|
-
import {
|
|
5
|
+
import {ThemeContext} from "./Theme";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
7
|
+
const fontSizes = {
|
|
8
|
+
sm: 20,
|
|
9
|
+
md: 28,
|
|
10
|
+
lg: 36,
|
|
11
|
+
};
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export const Heading = ({align, children, color, size}: HeadingProps): React.ReactElement => {
|
|
14
|
+
const {theme} = useContext(ThemeContext);
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
// if (this.props.bold) {
|
|
19
|
-
// font += "Bold";
|
|
20
|
-
// }
|
|
21
|
-
style.fontFamily = Unifier.theme.titleFont;
|
|
16
|
+
const style: StyleProp<TextStyle> = {};
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
if (this.props.align) {
|
|
25
|
-
style.textAlign = this.props.align;
|
|
26
|
-
}
|
|
27
|
-
if (this.props.color) {
|
|
28
|
-
style.color = Unifier.theme[this.props.color];
|
|
29
|
-
} else {
|
|
30
|
-
style.color = Unifier.theme.darkGray;
|
|
31
|
-
}
|
|
32
|
-
// TODO: might be useful for wrapping/truncating
|
|
33
|
-
// if (this.props.numberOfLines !== 1 && !this.props.inline) {
|
|
34
|
-
// style.flexWrap = "wrap";
|
|
35
|
-
// }
|
|
18
|
+
style.fontFamily = theme.titleFont;
|
|
36
19
|
|
|
37
|
-
|
|
20
|
+
style.fontSize = fontSizes[size || "md"];
|
|
21
|
+
if (align) {
|
|
22
|
+
style.textAlign = align;
|
|
38
23
|
}
|
|
24
|
+
style.color = theme[color ?? "darkGray"];
|
|
25
|
+
// TODO: might be useful for wrapping/truncating
|
|
26
|
+
// if (numberOfLines !== 1 && !inline) {
|
|
27
|
+
// style.flexWrap = "wrap";
|
|
28
|
+
// }
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<NativeText numberOfLines={lines} style={this.propsToStyle()}>
|
|
49
|
-
{this.props.children}
|
|
50
|
-
</NativeText>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
30
|
+
const lines = 0;
|
|
31
|
+
return (
|
|
32
|
+
<NativeText numberOfLines={lines} style={style}>
|
|
33
|
+
{children}
|
|
34
|
+
</NativeText>
|
|
35
|
+
);
|
|
36
|
+
};
|
package/src/Icon.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {FontAwesome5} from "@expo/vector-icons";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, {useContext} from "react";
|
|
3
3
|
|
|
4
4
|
import {IconProps, iconSizeToNumber} from "./Common";
|
|
5
|
-
import {
|
|
5
|
+
import {ThemeContext} from "./Theme";
|
|
6
6
|
|
|
7
7
|
export function initIcons() {
|
|
8
8
|
console.debug("Initializing icons");
|
|
@@ -10,7 +10,8 @@ export function initIcons() {
|
|
|
10
10
|
|
|
11
11
|
// TODO: Update <Icon /> to be closer to Expo's Vector Icon, letting multiple icon packs be used, etc.
|
|
12
12
|
export function Icon({color, size, name, prefix}: IconProps): React.ReactElement {
|
|
13
|
-
const
|
|
13
|
+
const {theme} = useContext(ThemeContext);
|
|
14
|
+
const iconColor = theme[color || "primary"];
|
|
14
15
|
const iconSize = iconSizeToNumber(size);
|
|
15
16
|
return (
|
|
16
17
|
<FontAwesome5
|