ferns-ui 0.41.1 → 0.41.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 +1 -0
- package/dist/Avatar.js.map +1 -1
- package/dist/Badge.d.ts +1 -1
- package/dist/Badge.js +2 -2
- package/dist/Badge.js.map +1 -1
- package/dist/Body.d.ts +1 -1
- package/dist/Body.js +2 -2
- package/dist/Body.js.map +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +4 -4
- package/dist/Button.js.map +1 -1
- package/dist/Card.d.ts +1 -1
- package/dist/Card.js +2 -2
- package/dist/Card.js.map +1 -1
- package/dist/CheckBox.d.ts +1 -1
- package/dist/CheckBox.js +2 -2
- package/dist/CheckBox.js.map +1 -1
- package/dist/CustomSelect.js +1 -0
- package/dist/CustomSelect.js.map +1 -1
- package/dist/DateTimeActionSheet.d.ts +1 -1
- package/dist/DateTimeActionSheet.js +8 -7
- package/dist/DateTimeActionSheet.js.map +1 -1
- package/dist/FernsProvider.d.ts +2 -2
- package/dist/FernsProvider.js +2 -2
- package/dist/FernsProvider.js.map +1 -1
- package/dist/Hyperlink.d.ts +1 -1
- package/dist/Hyperlink.js +3 -3
- package/dist/Hyperlink.js.map +1 -1
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.js +2 -2
- package/dist/Icon.js.map +1 -1
- package/dist/InfoTooltipButton.d.ts +1 -1
- package/dist/InfoTooltipButton.js +2 -2
- package/dist/InfoTooltipButton.js.map +1 -1
- package/dist/Link.d.ts +1 -1
- package/dist/Link.js +2 -2
- package/dist/Link.js.map +1 -1
- package/dist/Mask.d.ts +1 -1
- package/dist/Mask.js +2 -2
- package/dist/Mask.js.map +1 -1
- package/dist/MobileAddressAutoComplete.js +1 -0
- package/dist/MobileAddressAutoComplete.js.map +1 -1
- package/dist/ModalSheet.js +1 -0
- package/dist/ModalSheet.js.map +1 -1
- package/dist/OpenAPIContext.d.ts +1 -1
- package/dist/OpenAPIContext.js +4 -3
- package/dist/OpenAPIContext.js.map +1 -1
- package/dist/PickerSelect.js +1 -0
- package/dist/PickerSelect.js.map +1 -1
- package/dist/Pill.d.ts +1 -1
- package/dist/Pill.js +2 -2
- package/dist/Pill.js.map +1 -1
- package/dist/Pog.d.ts +1 -1
- package/dist/Pog.js +2 -2
- package/dist/Pog.js.map +1 -1
- package/dist/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar.js +2 -2
- package/dist/ProgressBar.js.map +1 -1
- package/dist/SelectList.d.ts +1 -1
- package/dist/SelectList.js +2 -2
- package/dist/SelectList.js.map +1 -1
- package/dist/Signature.d.ts +1 -1
- package/dist/Signature.js +2 -2
- package/dist/Signature.js.map +1 -1
- package/dist/Signature.native.js +1 -1
- package/dist/Signature.native.js.map +1 -1
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +2 -2
- package/dist/Spinner.js.map +1 -1
- package/dist/SplitPage.js +1 -0
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.js +1 -0
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/Switch.d.ts +1 -1
- package/dist/Switch.js +2 -2
- package/dist/Switch.js.map +1 -1
- package/dist/Table.d.ts +2 -2
- package/dist/Table.js +2 -2
- package/dist/Table.js.map +1 -1
- package/dist/TableHeader.d.ts +1 -1
- package/dist/TableHeader.js +2 -2
- package/dist/TableHeader.js.map +1 -1
- package/dist/TableHeaderCell.d.ts +1 -1
- package/dist/TableHeaderCell.js +2 -2
- package/dist/TableHeaderCell.js.map +1 -1
- package/dist/TableRow.d.ts +1 -1
- package/dist/TableRow.js +2 -2
- package/dist/TableRow.js.map +1 -1
- package/dist/TapToEdit.js +1 -1
- package/dist/TapToEdit.js.map +1 -1
- package/dist/Text.d.ts +1 -1
- package/dist/Text.js +2 -2
- package/dist/Text.js.map +1 -1
- package/dist/TextArea.d.ts +1 -1
- package/dist/TextArea.js +2 -2
- package/dist/TextArea.js.map +1 -1
- package/dist/TextField.d.ts +1 -1
- package/dist/TextField.js +2 -2
- package/dist/TextField.js.map +1 -1
- package/dist/Toast.d.ts +1 -1
- package/dist/Toast.js +2 -2
- package/dist/Toast.js.map +1 -1
- package/dist/Tooltip.js +1 -0
- package/dist/Tooltip.js.map +1 -1
- package/dist/Unifier.js +5 -5
- package/dist/Unifier.js.map +1 -1
- package/dist/WebAddressAutocomplete.js +1 -0
- package/dist/WebAddressAutocomplete.js.map +1 -1
- package/dist/WithLabel.d.ts +1 -1
- package/dist/WithLabel.js +2 -2
- package/dist/WithLabel.js.map +1 -1
- package/dist/tableContext.d.ts +1 -1
- package/dist/tableContext.js +2 -2
- package/dist/tableContext.js.map +1 -1
- package/package.json +7 -22
- package/src/Avatar.tsx +1 -0
- package/src/Badge.tsx +3 -3
- package/src/Body.tsx +3 -3
- package/src/Button.tsx +5 -5
- package/src/Card.tsx +2 -2
- package/src/CheckBox.tsx +3 -3
- package/src/CustomSelect.tsx +1 -0
- package/src/DateTimeActionSheet.tsx +10 -9
- package/src/FernsProvider.tsx +2 -2
- package/src/Hyperlink.tsx +3 -3
- package/src/Icon.tsx +2 -2
- package/src/InfoTooltipButton.tsx +2 -2
- package/src/Link.tsx +2 -2
- package/src/Mask.tsx +2 -2
- package/src/MobileAddressAutoComplete.tsx +1 -0
- package/src/ModalSheet.tsx +1 -0
- package/src/OpenAPIContext.tsx +4 -3
- package/src/PickerSelect.tsx +1 -0
- package/src/Pill.tsx +2 -2
- package/src/Pog.tsx +2 -2
- package/src/ProgressBar.tsx +2 -2
- package/src/SelectList.tsx +3 -3
- package/src/Signature.native.tsx +1 -0
- package/src/Signature.tsx +2 -2
- package/src/Spinner.tsx +2 -2
- package/src/SplitPage.native.tsx +1 -0
- package/src/SplitPage.tsx +1 -0
- package/src/Switch.tsx +7 -2
- package/src/Table.tsx +3 -3
- package/src/TableHeader.tsx +3 -3
- package/src/TableHeaderCell.tsx +3 -3
- package/src/TableRow.tsx +3 -3
- package/src/TapToEdit.tsx +1 -1
- package/src/Text.tsx +3 -3
- package/src/TextArea.tsx +2 -2
- package/src/TextField.tsx +3 -3
- package/src/Toast.tsx +2 -2
- package/src/Tooltip.tsx +1 -0
- package/src/Unifier.ts +5 -5
- package/src/WebAddressAutocomplete.tsx +1 -0
- package/src/WithLabel.tsx +3 -3
- package/src/tableContext.tsx +3 -3
package/src/CustomSelect.tsx
CHANGED
|
@@ -23,6 +23,7 @@ export const CustomSelect = ({
|
|
|
23
23
|
return ![...options, {value: ""}].map((i) => i.value).includes(customValue);
|
|
24
24
|
}, [options, customValue]);
|
|
25
25
|
|
|
26
|
+
// If the value is set to custom, show the custom input
|
|
26
27
|
useEffect(() => {
|
|
27
28
|
setShowCustomInput(isValueCustom);
|
|
28
29
|
if (!showCustomInput) {
|
|
@@ -22,7 +22,7 @@ const hours = range(1, 13).map((n) => String(n));
|
|
|
22
22
|
const minutes = range(0, 60).map((n) => String(n).padStart(2, "0"));
|
|
23
23
|
const minutesOptions = [...minutes, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const TimeInput = ({
|
|
26
26
|
type,
|
|
27
27
|
value,
|
|
28
28
|
onChange,
|
|
@@ -30,7 +30,7 @@ function TimeInput({
|
|
|
30
30
|
type: "hour" | "minute";
|
|
31
31
|
value: number;
|
|
32
32
|
onChange: (value: number) => void;
|
|
33
|
-
}): React.ReactElement {
|
|
33
|
+
}): React.ReactElement => {
|
|
34
34
|
const {theme} = useContext(ThemeContext);
|
|
35
35
|
|
|
36
36
|
const defaultText = type === "minute" ? String(value).padStart(2, "0") : String(value);
|
|
@@ -98,15 +98,15 @@ function TimeInput({
|
|
|
98
98
|
/>
|
|
99
99
|
</View>
|
|
100
100
|
);
|
|
101
|
-
}
|
|
101
|
+
};
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
const CalendarHeader = ({
|
|
104
104
|
addMonth,
|
|
105
105
|
month,
|
|
106
106
|
}: {
|
|
107
107
|
addMonth: (num: number) => void;
|
|
108
108
|
month: Date[];
|
|
109
|
-
}): React.ReactElement {
|
|
109
|
+
}): React.ReactElement => {
|
|
110
110
|
const displayDate = dayjs(month[0]).format("MMM YYYY");
|
|
111
111
|
return (
|
|
112
112
|
<Box alignItems="center" direction="row" height={40} justifyContent="between" width="100%">
|
|
@@ -153,7 +153,7 @@ function CalendarHeader({
|
|
|
153
153
|
/>
|
|
154
154
|
</Box>
|
|
155
155
|
);
|
|
156
|
-
}
|
|
156
|
+
};
|
|
157
157
|
|
|
158
158
|
// For mobile, renders all components in an action sheet. For web, renders all components in a
|
|
159
159
|
// modal. For mobile: If mode is "time", renders a spinner picker for time picker on both platforms.
|
|
@@ -161,14 +161,14 @@ function CalendarHeader({
|
|
|
161
161
|
// renders a spinner picker for time picker and our custom calendar on both platforms. For web,
|
|
162
162
|
// renders a simplistic text box for time picker and a calendar for date picker in a modal In the
|
|
163
163
|
// future, web time picker should be a typeahead dropdown like Google calendar.
|
|
164
|
-
export
|
|
164
|
+
export const DateTimeActionSheet = ({
|
|
165
165
|
// actionSheetRef,
|
|
166
166
|
mode,
|
|
167
167
|
value,
|
|
168
168
|
onChange,
|
|
169
169
|
visible,
|
|
170
170
|
onDismiss,
|
|
171
|
-
}: DateTimeActionSheetProps) {
|
|
171
|
+
}: DateTimeActionSheetProps) => {
|
|
172
172
|
const {theme} = useContext(ThemeContext);
|
|
173
173
|
|
|
174
174
|
// Accept ISO 8601, HH:mm, or hh:mm A formats. We may want only HH:mm or hh:mm A for mode=time
|
|
@@ -193,6 +193,7 @@ export function DateTimeActionSheet({
|
|
|
193
193
|
const [amPm, setAmPm] = useState<"am" | "pm">(dayjs(m).format("a") === "am" ? "am" : "pm");
|
|
194
194
|
const [date, setDate] = useState<string>(dayjs(m).toISOString());
|
|
195
195
|
|
|
196
|
+
// If the value changes in the props, update the state for the date and time.
|
|
196
197
|
useEffect(() => {
|
|
197
198
|
let datetime;
|
|
198
199
|
if (value) {
|
|
@@ -398,4 +399,4 @@ export function DateTimeActionSheet({
|
|
|
398
399
|
{renderContent()}
|
|
399
400
|
</Modal>
|
|
400
401
|
);
|
|
401
|
-
}
|
|
402
|
+
};
|
package/src/FernsProvider.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {ToastProvider} from "react-native-toast-notifications";
|
|
|
5
5
|
import {ThemeProvider} from "./Theme";
|
|
6
6
|
import {Toast} from "./Toast";
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export const FernsProvider = ({children}: {children: React.ReactNode}): React.ReactElement => {
|
|
9
9
|
return (
|
|
10
10
|
<ThemeProvider>
|
|
11
11
|
<ToastProvider
|
|
@@ -21,4 +21,4 @@ export function FernsProvider({children}: {children: React.ReactNode}): React.Re
|
|
|
21
21
|
</ToastProvider>
|
|
22
22
|
</ThemeProvider>
|
|
23
23
|
);
|
|
24
|
-
}
|
|
24
|
+
};
|
package/src/Hyperlink.tsx
CHANGED
|
@@ -104,7 +104,7 @@ class HyperlinkComponent extends React.Component<HyperlinkProps> {
|
|
|
104
104
|
component.props.children.substring(_lastIndex, component.props.children.length)
|
|
105
105
|
);
|
|
106
106
|
return React.cloneElement(component, componentProps, elements);
|
|
107
|
-
} catch (
|
|
107
|
+
} catch (error) {
|
|
108
108
|
return component;
|
|
109
109
|
}
|
|
110
110
|
};
|
|
@@ -155,7 +155,7 @@ class HyperlinkComponent extends React.Component<HyperlinkProps> {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
export
|
|
158
|
+
export const Hyperlink = (props: HyperlinkProps) => {
|
|
159
159
|
const handleLink = (url: string) => {
|
|
160
160
|
const urlObject = mdurl.parse(url);
|
|
161
161
|
urlObject.protocol = urlObject.protocol.toLowerCase();
|
|
@@ -169,4 +169,4 @@ export function Hyperlink(props: HyperlinkProps) {
|
|
|
169
169
|
const onPress = handleLink || props.onPress;
|
|
170
170
|
if (props.linkDefault) return <HyperlinkComponent {...props} onPress={onPress} />;
|
|
171
171
|
return <HyperlinkComponent {...props} />;
|
|
172
|
-
}
|
|
172
|
+
};
|
package/src/Icon.tsx
CHANGED
|
@@ -10,7 +10,7 @@ export function initIcons() {
|
|
|
10
10
|
|
|
11
11
|
// TODO: Update <Icon /> to be closer to Expo's Vector Icon, letting multiple icon packs be used,
|
|
12
12
|
// etc.
|
|
13
|
-
export
|
|
13
|
+
export const Icon = ({color, size, name, prefix, testID}: IconProps): React.ReactElement => {
|
|
14
14
|
const {theme} = useContext(ThemeContext);
|
|
15
15
|
const iconColor = theme[color || "primary"];
|
|
16
16
|
const iconSize = iconSizeToNumber(size);
|
|
@@ -24,4 +24,4 @@ export function Icon({color, size, name, prefix, testID}: IconProps): React.Reac
|
|
|
24
24
|
testID={testID}
|
|
25
25
|
/>
|
|
26
26
|
);
|
|
27
|
-
}
|
|
27
|
+
};
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import {InfoTooltipButtonProps} from "./Common";
|
|
4
4
|
import {IconButton} from "./IconButton";
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export const InfoTooltipButton = ({text, size}: InfoTooltipButtonProps): React.ReactElement => {
|
|
7
7
|
return (
|
|
8
8
|
<IconButton
|
|
9
9
|
accessibilityLabel="info"
|
|
@@ -15,4 +15,4 @@ export function InfoTooltipButton({text, size}: InfoTooltipButtonProps): React.R
|
|
|
15
15
|
onClick={() => {}}
|
|
16
16
|
/>
|
|
17
17
|
);
|
|
18
|
-
}
|
|
18
|
+
};
|
package/src/Link.tsx
CHANGED
|
@@ -4,10 +4,10 @@ import {Linking} from "react-native";
|
|
|
4
4
|
import {LinkProps} from "./Common";
|
|
5
5
|
import {Text} from "./Text";
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export const Link = (props: LinkProps): React.ReactElement => {
|
|
8
8
|
return (
|
|
9
9
|
<Text {...props} color={props.color || "blue"} onPress={() => Linking.openURL(props.href)}>
|
|
10
10
|
{props.children}
|
|
11
11
|
</Text>
|
|
12
12
|
);
|
|
13
|
-
}
|
|
13
|
+
};
|
package/src/Mask.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import {View} from "react-native";
|
|
|
3
3
|
|
|
4
4
|
import {MaskProps, ReactChildren} from "./Common";
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export const Mask = (props: MaskProps): ReactChildren => {
|
|
7
7
|
if (props.shape === "rounded") {
|
|
8
8
|
return <View style={{overflow: "hidden", borderRadius: 12}}>{props.children}</View>;
|
|
9
9
|
} else if (props.shape === "circle") {
|
|
@@ -18,4 +18,4 @@ export function Mask(props: MaskProps): ReactChildren {
|
|
|
18
18
|
} else {
|
|
19
19
|
return props.children || null;
|
|
20
20
|
}
|
|
21
|
-
}
|
|
21
|
+
};
|
|
@@ -26,6 +26,7 @@ export const MobileAddressAutocomplete = ({
|
|
|
26
26
|
const ref = useRef<GooglePlacesAutocompleteRef | null>(null);
|
|
27
27
|
const [isFocused, setIsFocused] = useState(false);
|
|
28
28
|
|
|
29
|
+
// Load the Google Maps script and initialize the autocomplete.
|
|
29
30
|
useEffect(() => {
|
|
30
31
|
if (!googleMapsApiKey) return;
|
|
31
32
|
if (ref?.current) {
|
package/src/ModalSheet.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import {Portal} from "react-native-portalize";
|
|
|
7
7
|
export const useCombinedRefs = (...refs: any) => {
|
|
8
8
|
const targetRef = useRef();
|
|
9
9
|
|
|
10
|
+
// Iterate through the refs array, and set the ref.current value to the targetRef
|
|
10
11
|
useEffect(() => {
|
|
11
12
|
refs.forEach((ref: any) => {
|
|
12
13
|
if (!ref) {
|
package/src/OpenAPIContext.tsx
CHANGED
|
@@ -37,7 +37,7 @@ interface OpenAPIProviderProps {
|
|
|
37
37
|
specUrl?: string;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export
|
|
40
|
+
export const OpenAPIProvider = ({children, specUrl}: OpenAPIProviderProps): React.ReactElement => {
|
|
41
41
|
const [spec, setSpec] = useState<OpenAPISpec | null>(null);
|
|
42
42
|
|
|
43
43
|
const getModelFields = (modelName: string): ModelFields | null => {
|
|
@@ -71,6 +71,7 @@ export function OpenAPIProvider({children, specUrl}: OpenAPIProviderProps): Reac
|
|
|
71
71
|
return field;
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
+
// Fetch the OpenAPI spec from the provided URL.
|
|
74
75
|
useEffect((): void => {
|
|
75
76
|
if (!specUrl) {
|
|
76
77
|
return;
|
|
@@ -81,7 +82,7 @@ export function OpenAPIProvider({children, specUrl}: OpenAPIProviderProps): Reac
|
|
|
81
82
|
const data = (await response.json()) as OpenAPISpec;
|
|
82
83
|
setSpec(data);
|
|
83
84
|
})
|
|
84
|
-
.catch((
|
|
85
|
+
.catch((error: any) => console.error(`Error fetching OpenAPI spec: ${error}`));
|
|
85
86
|
}, [specUrl]);
|
|
86
87
|
|
|
87
88
|
return (
|
|
@@ -89,7 +90,7 @@ export function OpenAPIProvider({children, specUrl}: OpenAPIProviderProps): Reac
|
|
|
89
90
|
{children}
|
|
90
91
|
</OpenAPIContext.Provider>
|
|
91
92
|
);
|
|
92
|
-
}
|
|
93
|
+
};
|
|
93
94
|
|
|
94
95
|
export const useOpenAPISpec = () => {
|
|
95
96
|
const context = useContext(OpenAPIContext);
|
package/src/PickerSelect.tsx
CHANGED
package/src/Pill.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {Box} from "./Box";
|
|
|
4
4
|
import {PillProps} from "./Common";
|
|
5
5
|
import {Text} from "./Text";
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export const Pill = ({onClick, enabled, color = "white", text}: PillProps): React.ReactElement => {
|
|
8
8
|
return (
|
|
9
9
|
<Box
|
|
10
10
|
border={color}
|
|
@@ -19,4 +19,4 @@ export function Pill({onClick, enabled, color = "white", text}: PillProps): Reac
|
|
|
19
19
|
</Text>
|
|
20
20
|
</Box>
|
|
21
21
|
);
|
|
22
|
-
}
|
|
22
|
+
};
|
package/src/Pog.tsx
CHANGED
|
@@ -23,7 +23,7 @@ const defaultIconButtonIconColors = {
|
|
|
23
23
|
white: "gray",
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
export
|
|
26
|
+
export const Pog = (props: PogProps) => {
|
|
27
27
|
const {
|
|
28
28
|
bgColor = "transparent",
|
|
29
29
|
iconColor,
|
|
@@ -72,4 +72,4 @@ export function Pog(props: PogProps) {
|
|
|
72
72
|
</Box>
|
|
73
73
|
</div>
|
|
74
74
|
);
|
|
75
|
-
}
|
|
75
|
+
};
|
package/src/ProgressBar.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {View} from "react-native";
|
|
|
4
4
|
import {ProgressBarProps} from "./Common";
|
|
5
5
|
import {ThemeContext} from "./Theme";
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export const ProgressBar = ({color, completed}: ProgressBarProps): React.ReactElement => {
|
|
8
8
|
const {theme} = useContext(ThemeContext);
|
|
9
9
|
|
|
10
10
|
return (
|
|
@@ -44,4 +44,4 @@ export function ProgressBar({color, completed}: ProgressBarProps): React.ReactEl
|
|
|
44
44
|
/>
|
|
45
45
|
</View>
|
|
46
46
|
);
|
|
47
|
-
}
|
|
47
|
+
};
|
package/src/SelectList.tsx
CHANGED
|
@@ -21,7 +21,7 @@ export interface SelectListProps extends FieldWithLabelsProps {
|
|
|
21
21
|
style?: StyleProp<RNPickerSelectProps["style"]>;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export
|
|
24
|
+
export const SelectList = ({
|
|
25
25
|
options,
|
|
26
26
|
value,
|
|
27
27
|
onChange,
|
|
@@ -30,7 +30,7 @@ export function SelectList({
|
|
|
30
30
|
style,
|
|
31
31
|
placeholder,
|
|
32
32
|
disabled,
|
|
33
|
-
}: SelectListProps) {
|
|
33
|
+
}: SelectListProps) => {
|
|
34
34
|
const {theme} = useContext(ThemeContext);
|
|
35
35
|
|
|
36
36
|
const withLabelProps = {label, labelColor};
|
|
@@ -87,4 +87,4 @@ export function SelectList({
|
|
|
87
87
|
/>
|
|
88
88
|
</WithLabel>
|
|
89
89
|
);
|
|
90
|
-
}
|
|
90
|
+
};
|
package/src/Signature.native.tsx
CHANGED
package/src/Signature.tsx
CHANGED
|
@@ -10,7 +10,7 @@ export interface SignatureProps {
|
|
|
10
10
|
onEnd?: () => void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export const Signature = ({onChange}: SignatureProps): ReactElement | null => {
|
|
14
14
|
const ref = useRef<SignatureCanvas>(null);
|
|
15
15
|
|
|
16
16
|
const onClear = () => {
|
|
@@ -33,4 +33,4 @@ export function Signature({onChange}: SignatureProps): ReactElement | null {
|
|
|
33
33
|
</Box>
|
|
34
34
|
</Box>
|
|
35
35
|
);
|
|
36
|
-
}
|
|
36
|
+
};
|
package/src/Spinner.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import {ActivityIndicator} from "react-native";
|
|
|
3
3
|
|
|
4
4
|
import {SpinnerProps} from "./Common";
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export const Spinner = ({size, color}: SpinnerProps): ReactElement | null => {
|
|
7
7
|
const [show, setShow] = useState(false);
|
|
8
8
|
|
|
9
9
|
// The delay is for perceived performance. You don't want to show a spinner when you're doing a
|
|
@@ -18,4 +18,4 @@ export function Spinner({size, color}: SpinnerProps): ReactElement | null {
|
|
|
18
18
|
}
|
|
19
19
|
const spinnerSize: "small" | "large" = size === "sm" ? "small" : "large";
|
|
20
20
|
return <ActivityIndicator color={color ?? "darkGray"} size={spinnerSize} />;
|
|
21
|
-
}
|
|
21
|
+
};
|
package/src/SplitPage.native.tsx
CHANGED
package/src/SplitPage.tsx
CHANGED
package/src/Switch.tsx
CHANGED
|
@@ -4,10 +4,15 @@ import {Switch as NativeSwitch} from "react-native";
|
|
|
4
4
|
import {SwitchProps} from "./Common";
|
|
5
5
|
import {WithLabel} from "./WithLabel";
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export const Switch = ({
|
|
8
|
+
disabled,
|
|
9
|
+
switched,
|
|
10
|
+
onChange,
|
|
11
|
+
...rest
|
|
12
|
+
}: SwitchProps): React.ReactElement => {
|
|
8
13
|
return (
|
|
9
14
|
<WithLabel labelAlignItems="center" labelInline labelJustifyContent="between" {...rest}>
|
|
10
15
|
<NativeSwitch disabled={disabled} value={switched} onValueChange={onChange} />
|
|
11
16
|
</WithLabel>
|
|
12
17
|
);
|
|
13
|
-
}
|
|
18
|
+
};
|
package/src/Table.tsx
CHANGED
|
@@ -5,14 +5,14 @@ import {TableProps} from "./Common";
|
|
|
5
5
|
import {ScrollView} from "./ScrollView";
|
|
6
6
|
import {ColumnSortInterface, TableContextProvider} from "./tableContext";
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export const Table = ({
|
|
9
9
|
children,
|
|
10
10
|
columns,
|
|
11
11
|
borderStyle,
|
|
12
12
|
alternateRowBackground = true,
|
|
13
13
|
maxHeight,
|
|
14
14
|
stickyHeader = true,
|
|
15
|
-
}: TableProps): React.ReactElement {
|
|
15
|
+
}: TableProps): React.ReactElement => {
|
|
16
16
|
const arrayChildren = Children.toArray(children);
|
|
17
17
|
const [sortColumn, setSortColumn] = React.useState<ColumnSortInterface | undefined>(undefined);
|
|
18
18
|
|
|
@@ -60,4 +60,4 @@ export function Table({
|
|
|
60
60
|
</ScrollView>
|
|
61
61
|
</TableContextProvider>
|
|
62
62
|
);
|
|
63
|
-
}
|
|
63
|
+
};
|
package/src/TableHeader.tsx
CHANGED
|
@@ -7,14 +7,14 @@ import {TableRow} from "./TableRow";
|
|
|
7
7
|
/**
|
|
8
8
|
* Use TableHeader to group the header content in Table.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export const TableHeader = ({
|
|
11
11
|
children,
|
|
12
12
|
display = "tableHeaderGroup",
|
|
13
13
|
color,
|
|
14
|
-
}: TableHeaderProps): React.ReactElement {
|
|
14
|
+
}: TableHeaderProps): React.ReactElement => {
|
|
15
15
|
return (
|
|
16
16
|
<Box color={color ?? "white"} display={display === "visuallyHidden" ? "none" : "flex"}>
|
|
17
17
|
<TableRow headerRow>{children}</TableRow>
|
|
18
18
|
</Box>
|
|
19
19
|
);
|
|
20
|
-
}
|
|
20
|
+
};
|
package/src/TableHeaderCell.tsx
CHANGED
|
@@ -8,12 +8,12 @@ import {useTableContext} from "./tableContext";
|
|
|
8
8
|
/**
|
|
9
9
|
* Use TableHeaderCell to define a header cell in Table.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export const TableHeaderCell = ({
|
|
12
12
|
children,
|
|
13
13
|
index,
|
|
14
14
|
sortable,
|
|
15
15
|
onSortChange,
|
|
16
|
-
}: TableHeaderCellProps): ReactElement {
|
|
16
|
+
}: TableHeaderCellProps): ReactElement => {
|
|
17
17
|
const {columns, setSortColumn, sortColumn} = useTableContext();
|
|
18
18
|
const width = columns[index];
|
|
19
19
|
if (!width) {
|
|
@@ -69,4 +69,4 @@ export function TableHeaderCell({
|
|
|
69
69
|
</Box>
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
};
|
package/src/TableRow.tsx
CHANGED
|
@@ -8,13 +8,13 @@ import {useTableContext} from "./tableContext";
|
|
|
8
8
|
/**
|
|
9
9
|
* Use TableRow to define a row in Table.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export const TableRow = ({
|
|
12
12
|
children,
|
|
13
13
|
headerRow = false,
|
|
14
14
|
expanded,
|
|
15
15
|
drawerContents,
|
|
16
16
|
color = "white",
|
|
17
|
-
}: TableRowProps): React.ReactElement {
|
|
17
|
+
}: TableRowProps): React.ReactElement => {
|
|
18
18
|
const [isExpanded, setIsExpanded] = React.useState(expanded || false);
|
|
19
19
|
const {columns, hasDrawerContents} = useTableContext();
|
|
20
20
|
const rowRef = useRef<typeof Box>(null);
|
|
@@ -61,4 +61,4 @@ export function TableRow({
|
|
|
61
61
|
)}
|
|
62
62
|
</Box>
|
|
63
63
|
);
|
|
64
|
-
}
|
|
64
|
+
};
|
package/src/TapToEdit.tsx
CHANGED
|
@@ -160,7 +160,7 @@ export const TapToEdit = ({
|
|
|
160
160
|
try {
|
|
161
161
|
const url = new URL(value);
|
|
162
162
|
displayValue = url?.hostname ?? value;
|
|
163
|
-
} catch (
|
|
163
|
+
} catch (error) {
|
|
164
164
|
// Don't print an error message for empty values.
|
|
165
165
|
if (value) {
|
|
166
166
|
console.debug(`Invalid URL: ${value}`);
|
package/src/Text.tsx
CHANGED
|
@@ -12,7 +12,7 @@ const fontSizes = {
|
|
|
12
12
|
lg: 16,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export
|
|
15
|
+
export const Text = ({
|
|
16
16
|
align = "left",
|
|
17
17
|
children,
|
|
18
18
|
color,
|
|
@@ -28,7 +28,7 @@ export function Text({
|
|
|
28
28
|
skipLinking,
|
|
29
29
|
testID,
|
|
30
30
|
weight = "normal",
|
|
31
|
-
}: TextProps): React.ReactElement {
|
|
31
|
+
}: TextProps): React.ReactElement => {
|
|
32
32
|
const {theme} = useContext(ThemeContext);
|
|
33
33
|
|
|
34
34
|
function propsToStyle(): any {
|
|
@@ -115,4 +115,4 @@ export function Text({
|
|
|
115
115
|
</Hyperlink>
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
}
|
|
118
|
+
};
|
package/src/TextArea.tsx
CHANGED
|
@@ -3,6 +3,6 @@ import React from "react";
|
|
|
3
3
|
import {TextAreaProps} from "./Common";
|
|
4
4
|
import {TextField} from "./TextField";
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export const TextArea = ({height, ...rest}: TextAreaProps): React.ReactElement => {
|
|
7
7
|
return <TextField {...rest} height={height ?? 100} multiline />;
|
|
8
|
-
}
|
|
8
|
+
};
|
package/src/TextField.tsx
CHANGED
|
@@ -59,7 +59,7 @@ const textContentMap: {
|
|
|
59
59
|
username: "username",
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
export
|
|
62
|
+
export const TextField = ({
|
|
63
63
|
blurOnSubmit = true,
|
|
64
64
|
value,
|
|
65
65
|
height: propsHeight,
|
|
@@ -86,7 +86,7 @@ export function TextField({
|
|
|
86
86
|
onEnter,
|
|
87
87
|
onSubmitEditing,
|
|
88
88
|
testID,
|
|
89
|
-
}: TextFieldProps): ReactElement {
|
|
89
|
+
}: TextFieldProps): ReactElement => {
|
|
90
90
|
const {theme} = useContext(ThemeContext);
|
|
91
91
|
|
|
92
92
|
const dateActionSheetRef: React.RefObject<any> = React.createRef();
|
|
@@ -404,4 +404,4 @@ export function TextField({
|
|
|
404
404
|
)}
|
|
405
405
|
</>
|
|
406
406
|
);
|
|
407
|
-
}
|
|
407
|
+
};
|
package/src/Toast.tsx
CHANGED
|
@@ -34,7 +34,7 @@ export function useToast(): any {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export
|
|
37
|
+
export const Toast = ({message, data}: ToastProps): React.ReactElement => {
|
|
38
38
|
// margin 8 on either side, times the standard 4px we multiply by.
|
|
39
39
|
const width = Math.min(Dimensions.get("window").width - 16 * 4, 712);
|
|
40
40
|
const {variant, buttonText, buttonOnClick, persistent, onDismiss} = data ?? {};
|
|
@@ -89,4 +89,4 @@ export function Toast({message, data}: ToastProps): React.ReactElement {
|
|
|
89
89
|
)}
|
|
90
90
|
</Box>
|
|
91
91
|
);
|
|
92
|
-
}
|
|
92
|
+
};
|
package/src/Tooltip.tsx
CHANGED
|
@@ -138,6 +138,7 @@ export const Tooltip = (props: TooltipProps) => {
|
|
|
138
138
|
|
|
139
139
|
const isWeb = Platform.OS === "web";
|
|
140
140
|
|
|
141
|
+
// If the tooltip is visible, and the user clicks outside of the tooltip, hide it.
|
|
141
142
|
React.useEffect(() => {
|
|
142
143
|
return () => {
|
|
143
144
|
if (showTooltipTimer.current) {
|
package/src/Unifier.ts
CHANGED
|
@@ -151,8 +151,8 @@ class UnifierClass {
|
|
|
151
151
|
} else {
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
|
-
} catch (
|
|
155
|
-
console.error(`[storage] Error reading ${key}`,
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.error(`[storage] Error reading ${key}`, error);
|
|
156
156
|
return defaultValue || null;
|
|
157
157
|
}
|
|
158
158
|
},
|
|
@@ -160,9 +160,9 @@ class UnifierClass {
|
|
|
160
160
|
try {
|
|
161
161
|
const jsonValue = JSON.stringify(item);
|
|
162
162
|
await AsyncStorage.setItem(key, jsonValue);
|
|
163
|
-
} catch (
|
|
164
|
-
console.error(`[storage] Error storing ${key}`, item,
|
|
165
|
-
throw new Error(
|
|
163
|
+
} catch (error) {
|
|
164
|
+
console.error(`[storage] Error storing ${key}`, item, error);
|
|
165
|
+
throw new Error(error as any);
|
|
166
166
|
}
|
|
167
167
|
},
|
|
168
168
|
};
|
|
@@ -34,6 +34,7 @@ export const WebAddressAutocomplete = ({
|
|
|
34
34
|
const [scriptLoaded, setScriptLoaded] = useState(true);
|
|
35
35
|
const autocompleteInputRef = useRef(null);
|
|
36
36
|
|
|
37
|
+
// Load the Google Maps script and initialize the autocomplete.
|
|
37
38
|
useEffect(() => {
|
|
38
39
|
const callbackName = "initAutocomplete";
|
|
39
40
|
if (!googleMapsApiKey) {
|
package/src/WithLabel.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {Box} from "./Box";
|
|
|
4
4
|
import {WithLabelProps} from "./Common";
|
|
5
5
|
import {Text} from "./Text";
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export const WithLabel = ({
|
|
8
8
|
label,
|
|
9
9
|
labelInline,
|
|
10
10
|
labelJustifyContent,
|
|
@@ -14,7 +14,7 @@ export function WithLabel({
|
|
|
14
14
|
labelColor,
|
|
15
15
|
show,
|
|
16
16
|
children,
|
|
17
|
-
}: WithLabelProps): React.ReactElement | null {
|
|
17
|
+
}: WithLabelProps): React.ReactElement | null => {
|
|
18
18
|
if (!children) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
@@ -42,4 +42,4 @@ export function WithLabel({
|
|
|
42
42
|
)}
|
|
43
43
|
</Box>
|
|
44
44
|
);
|
|
45
|
-
}
|
|
45
|
+
};
|
package/src/tableContext.tsx
CHANGED
|
@@ -31,7 +31,7 @@ const TableContext: Context<TableContextType> = createContext<TableContextType>(
|
|
|
31
31
|
|
|
32
32
|
export const {Provider} = TableContext;
|
|
33
33
|
|
|
34
|
-
export
|
|
34
|
+
export const TableContextProvider = ({
|
|
35
35
|
children,
|
|
36
36
|
columns,
|
|
37
37
|
hasDrawerContents,
|
|
@@ -40,7 +40,7 @@ export function TableContextProvider({
|
|
|
40
40
|
stickyHeader,
|
|
41
41
|
borderStyle,
|
|
42
42
|
alternateRowBackground,
|
|
43
|
-
}: Props): React.ReactElement<typeof Provider> {
|
|
43
|
+
}: Props): React.ReactElement<typeof Provider> => {
|
|
44
44
|
return (
|
|
45
45
|
<Provider
|
|
46
46
|
value={{
|
|
@@ -56,7 +56,7 @@ export function TableContextProvider({
|
|
|
56
56
|
{children}
|
|
57
57
|
</Provider>
|
|
58
58
|
);
|
|
59
|
-
}
|
|
59
|
+
};
|
|
60
60
|
|
|
61
61
|
export function useTableContext(): TableContextType {
|
|
62
62
|
const {
|