ferns-ui 0.41.1 → 0.42.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/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/Common.d.ts +18 -0
- 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 +8 -2
- package/dist/Toast.js +30 -8
- 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/Utilities.d.ts +3 -1
- package/dist/Utilities.js +12 -0
- package/dist/Utilities.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/Common.ts +17 -0
- 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 +35 -18
- package/src/Tooltip.tsx +1 -0
- package/src/Unifier.ts +5 -5
- package/src/Utilities.tsx +13 -1
- package/src/WebAddressAutocomplete.tsx +1 -0
- package/src/WithLabel.tsx +3 -3
- package/src/tableContext.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ferns-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"scripts": {
|
|
@@ -38,31 +38,16 @@
|
|
|
38
38
|
"useTabs": false
|
|
39
39
|
},
|
|
40
40
|
"eslintConfig": {
|
|
41
|
+
"extends": [
|
|
42
|
+
"plugin:ferns/recommended"
|
|
43
|
+
],
|
|
41
44
|
"parser": "@typescript-eslint/parser",
|
|
42
45
|
"parserOptions": {
|
|
43
46
|
"project": "./tsconfig.json",
|
|
44
|
-
"tsconfigRootDir": "./"
|
|
45
|
-
"ecmaFeatures": {
|
|
46
|
-
"jsx": true
|
|
47
|
-
},
|
|
48
|
-
"ecmaVersion": 2018,
|
|
49
|
-
"sourceType": "module"
|
|
50
|
-
},
|
|
51
|
-
"settings": {
|
|
52
|
-
"react": {
|
|
53
|
-
"version": "17.0.2"
|
|
54
|
-
}
|
|
47
|
+
"tsconfigRootDir": "./"
|
|
55
48
|
},
|
|
56
|
-
"plugins": [
|
|
57
|
-
"prettier",
|
|
58
|
-
"lodash"
|
|
59
|
-
],
|
|
60
|
-
"extends": [
|
|
61
|
-
"ferns",
|
|
62
|
-
"plugin:comment-length/recommended"
|
|
63
|
-
],
|
|
64
49
|
"rules": {
|
|
65
|
-
"
|
|
50
|
+
"@typescript-eslint/explicit-function-return-type": "off"
|
|
66
51
|
}
|
|
67
52
|
},
|
|
68
53
|
"jest": {
|
|
@@ -130,9 +115,9 @@
|
|
|
130
115
|
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
|
131
116
|
"@typescript-eslint/parser": "^6.13.2",
|
|
132
117
|
"eslint": "^8.55.0",
|
|
133
|
-
"eslint-config-ferns": "^0.5.1",
|
|
134
118
|
"eslint-config-prettier": "^9.1.0",
|
|
135
119
|
"eslint-plugin-comment-length": "^1.7.2",
|
|
120
|
+
"eslint-plugin-ferns": "^0.3.0",
|
|
136
121
|
"eslint-plugin-import": "^2.29.0",
|
|
137
122
|
"eslint-plugin-lodash": "^7.1.0",
|
|
138
123
|
"eslint-plugin-prettier": "^5.0.1",
|
package/src/Avatar.tsx
CHANGED
package/src/Badge.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {BadgeProps} from "./Common";
|
|
|
5
5
|
import {Icon} from "./Icon";
|
|
6
6
|
import {Text} from "./Text";
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export const Badge = ({
|
|
9
9
|
title,
|
|
10
10
|
position = "middle",
|
|
11
11
|
type = "info",
|
|
@@ -15,7 +15,7 @@ export function Badge({
|
|
|
15
15
|
fontColor = "white",
|
|
16
16
|
fontWeight = "bold",
|
|
17
17
|
rounding = "pill",
|
|
18
|
-
}: BadgeProps): React.ReactElement {
|
|
18
|
+
}: BadgeProps): React.ReactElement => {
|
|
19
19
|
if (color && type !== "custom") {
|
|
20
20
|
console.warn('Badge color only supported when `type` is set to "custom".');
|
|
21
21
|
}
|
|
@@ -63,4 +63,4 @@ export function Badge({
|
|
|
63
63
|
{renderLabel()}
|
|
64
64
|
</Box>
|
|
65
65
|
);
|
|
66
|
-
}
|
|
66
|
+
};
|
package/src/Body.tsx
CHANGED
|
@@ -5,14 +5,14 @@ import {Box} from "./Box";
|
|
|
5
5
|
import {BodyProps} from "./Common";
|
|
6
6
|
import {ThemeContext} from "./Theme";
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export const Body = ({
|
|
9
9
|
scroll,
|
|
10
10
|
loading,
|
|
11
11
|
padding,
|
|
12
12
|
height,
|
|
13
13
|
avoidKeyboard,
|
|
14
14
|
children,
|
|
15
|
-
}: BodyProps): React.ReactElement {
|
|
15
|
+
}: BodyProps): React.ReactElement => {
|
|
16
16
|
const {theme} = useContext(ThemeContext);
|
|
17
17
|
|
|
18
18
|
const renderBody = () => {
|
|
@@ -31,4 +31,4 @@ export function Body({
|
|
|
31
31
|
} else {
|
|
32
32
|
return <KeyboardAvoidingView behavior="position">{renderBody()}</KeyboardAvoidingView>;
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
};
|
package/src/Button.tsx
CHANGED
|
@@ -33,7 +33,7 @@ const HEIGHTS = {
|
|
|
33
33
|
lg: 48,
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export
|
|
36
|
+
export const Button = ({
|
|
37
37
|
alignSelf,
|
|
38
38
|
disabled = false,
|
|
39
39
|
type = "solid",
|
|
@@ -52,7 +52,7 @@ export function Button({
|
|
|
52
52
|
shape = "rounded",
|
|
53
53
|
testID,
|
|
54
54
|
tooltip,
|
|
55
|
-
}: ButtonProps) {
|
|
55
|
+
}: ButtonProps) => {
|
|
56
56
|
const [loading, setLoading] = useState(propsLoading);
|
|
57
57
|
const [showConfirmation, setShowConfirmation] = useState(false);
|
|
58
58
|
const {theme} = useContext(ThemeContext);
|
|
@@ -141,9 +141,9 @@ export function Button({
|
|
|
141
141
|
} else if (onClick) {
|
|
142
142
|
await onClick();
|
|
143
143
|
}
|
|
144
|
-
} catch (
|
|
144
|
+
} catch (error) {
|
|
145
145
|
setLoading(false);
|
|
146
|
-
throw
|
|
146
|
+
throw error;
|
|
147
147
|
}
|
|
148
148
|
setLoading(false);
|
|
149
149
|
},
|
|
@@ -195,4 +195,4 @@ export function Button({
|
|
|
195
195
|
} else {
|
|
196
196
|
return renderButton();
|
|
197
197
|
}
|
|
198
|
-
}
|
|
198
|
+
};
|
package/src/Card.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import {Box} from "./Box";
|
|
4
4
|
import {BoxProps} from "./Common";
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export const Card = ({children, color = "white", padding = 4, width, ...rest}: BoxProps) => {
|
|
7
7
|
return (
|
|
8
8
|
<Box
|
|
9
9
|
color={color}
|
|
@@ -18,4 +18,4 @@ export function Card({children, color = "white", padding = 4, width, ...rest}: B
|
|
|
18
18
|
{children}
|
|
19
19
|
</Box>
|
|
20
20
|
);
|
|
21
|
-
}
|
|
21
|
+
};
|
package/src/CheckBox.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {BoxColor, CheckBoxProps} from "./Common";
|
|
|
5
5
|
import {Icon} from "./Icon";
|
|
6
6
|
import {Text} from "./Text";
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export const CheckBox = ({
|
|
9
9
|
color,
|
|
10
10
|
checked,
|
|
11
11
|
size,
|
|
@@ -18,7 +18,7 @@ export function CheckBox({
|
|
|
18
18
|
onClick,
|
|
19
19
|
indeterminate,
|
|
20
20
|
testID,
|
|
21
|
-
}: CheckBoxProps): React.ReactElement {
|
|
21
|
+
}: CheckBoxProps): React.ReactElement => {
|
|
22
22
|
if (checked && indeterminate) {
|
|
23
23
|
console.error("CheckBox cannot be checked and indeterminate at the same time");
|
|
24
24
|
}
|
|
@@ -117,4 +117,4 @@ export function CheckBox({
|
|
|
117
117
|
</Box>
|
|
118
118
|
</Box>
|
|
119
119
|
);
|
|
120
|
-
}
|
|
120
|
+
};
|
package/src/Common.ts
CHANGED
|
@@ -3046,3 +3046,20 @@ export interface TapToEditProps extends Omit<FieldProps, "onChange" | "value"> {
|
|
|
3046
3046
|
openApiField?: string;
|
|
3047
3047
|
showDescriptionAsTooltip?: boolean;
|
|
3048
3048
|
}
|
|
3049
|
+
|
|
3050
|
+
export interface APIError {
|
|
3051
|
+
status: number;
|
|
3052
|
+
data: {
|
|
3053
|
+
title: string;
|
|
3054
|
+
detail?: string;
|
|
3055
|
+
id?: string;
|
|
3056
|
+
links?: string;
|
|
3057
|
+
about?: string;
|
|
3058
|
+
status?: number;
|
|
3059
|
+
code?: string;
|
|
3060
|
+
source?: string;
|
|
3061
|
+
pointer?: string;
|
|
3062
|
+
parameter?: string;
|
|
3063
|
+
meta?: {[id: string]: any};
|
|
3064
|
+
};
|
|
3065
|
+
}
|
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
|
+
};
|