ferns-ui 2.0.0-beta.2 → 2.0.0-beta.5
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/Accordion.js +7 -2
- package/dist/Accordion.js.map +1 -1
- package/dist/ActionSheet.js +14 -11
- package/dist/ActionSheet.js.map +1 -1
- package/dist/AddressField.js +1 -1
- package/dist/AddressField.js.map +1 -1
- package/dist/Badge.js +1 -1
- package/dist/Badge.js.map +1 -1
- package/dist/Banner.js +1 -1
- package/dist/Banner.js.map +1 -1
- package/dist/Box.js +3 -3
- package/dist/Box.js.map +1 -1
- package/dist/Button.js +0 -1
- package/dist/Button.js.map +1 -1
- package/dist/CheckBox.js.map +1 -1
- package/dist/Common.d.ts +14 -9
- package/dist/Common.js.map +1 -1
- package/dist/DataTable.js +1 -2
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeField.js +22 -22
- package/dist/DateTimeField.js.map +1 -1
- package/dist/EmailField.js +17 -37
- package/dist/EmailField.js.map +1 -1
- package/dist/EmojiSelector.d.ts +114 -0
- package/dist/EmojiSelector.js +332 -0
- package/dist/EmojiSelector.js.map +1 -0
- package/dist/FernsProvider.js +1 -1
- package/dist/FernsProvider.js.map +1 -1
- package/dist/Heading.js +3 -1
- package/dist/Heading.js.map +1 -1
- package/dist/Hyperlink.js +1 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/IconButton.js +1 -1
- package/dist/IconButton.js.map +1 -1
- package/dist/Image.js.map +1 -1
- package/dist/MarkdownView.d.ts +5 -0
- package/dist/MarkdownView.js +44 -0
- package/dist/MarkdownView.js.map +1 -0
- package/dist/MobileAddressAutoComplete.js +1 -1
- package/dist/MobileAddressAutoComplete.js.map +1 -1
- package/dist/Modal.d.ts +1 -1
- package/dist/Modal.js +35 -15
- package/dist/Modal.js.map +1 -1
- package/dist/NumberField.js +10 -4
- package/dist/NumberField.js.map +1 -1
- package/dist/NumberPickerActionSheet.d.ts +1 -3
- package/dist/NumberPickerActionSheet.js +0 -3
- package/dist/NumberPickerActionSheet.js.map +1 -1
- package/dist/Page.js +1 -1
- package/dist/Page.js.map +1 -1
- package/dist/Pagination.js +2 -2
- package/dist/Pagination.js.map +1 -1
- package/dist/Permissions.d.ts +1 -1
- package/dist/Permissions.js +2 -2
- package/dist/Permissions.js.map +1 -1
- package/dist/PickerSelect.js +1 -1
- package/dist/PickerSelect.js.map +1 -1
- package/dist/SectionDivider.js +1 -1
- package/dist/SectionDivider.js.map +1 -1
- package/dist/SegmentedControl.js.map +1 -1
- package/dist/Signature.native.js +2 -2
- package/dist/Signature.native.js.map +1 -1
- package/dist/SignatureField.js +2 -2
- package/dist/SignatureField.js.map +1 -1
- package/dist/Slider.js +3 -3
- package/dist/Slider.js.map +1 -1
- package/dist/SplitPage.js +7 -7
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.js +4 -6
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/TapToEdit.js +3 -3
- package/dist/TapToEdit.js.map +1 -1
- package/dist/Text.js +1 -1
- package/dist/Text.js.map +1 -1
- package/dist/TextField.js +9 -2
- package/dist/TextField.js.map +1 -1
- package/dist/TextFieldNumberActionSheet.d.ts +2 -4
- package/dist/TextFieldNumberActionSheet.js +1 -4
- package/dist/TextFieldNumberActionSheet.js.map +1 -1
- package/dist/Tooltip.js +37 -19
- package/dist/Tooltip.js.map +1 -1
- package/dist/Unifier.d.ts +0 -1
- package/dist/Unifier.js.map +1 -1
- package/dist/Utilities.d.ts +1 -1
- package/dist/Utilities.js +2 -3
- package/dist/Utilities.js.map +1 -1
- package/dist/WebAddressAutocomplete.js +2 -1
- package/dist/WebAddressAutocomplete.js.map +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/table/Table.js +14 -15
- package/dist/table/Table.js.map +1 -1
- package/dist/table/TableHeaderCell.js +2 -2
- package/dist/table/TableHeaderCell.js.map +1 -1
- package/dist/useStoredState.js +4 -2
- package/dist/useStoredState.js.map +1 -1
- package/package.json +7 -65
- package/src/Accordion.tsx +7 -1
- package/src/ActionSheet.tsx +26 -22
- package/src/AddressField.tsx +1 -1
- package/src/Badge.tsx +1 -1
- package/src/Banner.tsx +1 -1
- package/src/Box.test.tsx +71 -70
- package/src/Box.tsx +21 -9
- package/src/Button.tsx +0 -1
- package/src/CheckBox.tsx +7 -1
- package/src/Common.ts +15 -21
- package/src/DataTable.tsx +1 -2
- package/src/DateTimeField.tsx +22 -22
- package/src/EmailField.tsx +22 -42
- package/src/EmojiSelector.test.tsx +61 -0
- package/src/EmojiSelector.tsx +510 -0
- package/src/FernsProvider.tsx +1 -4
- package/src/Heading.tsx +3 -1
- package/src/Hyperlink.tsx +1 -1
- package/src/IconButton.tsx +2 -2
- package/src/Image.tsx +1 -0
- package/src/MarkdownView.tsx +67 -0
- package/src/MobileAddressAutoComplete.tsx +1 -1
- package/src/Modal.tsx +58 -21
- package/src/NumberField.tsx +10 -4
- package/src/NumberPickerActionSheet.tsx +1 -5
- package/src/Page.tsx +1 -1
- package/src/Pagination.tsx +2 -11
- package/src/Permissions.ts +2 -2
- package/src/PickerSelect.tsx +1 -1
- package/src/SectionDivider.tsx +1 -1
- package/src/SegmentedControl.tsx +3 -1
- package/src/Signature.native.tsx +2 -2
- package/src/SignatureField.tsx +2 -2
- package/src/Slider.tsx +10 -17
- package/src/SplitPage.native.tsx +2 -4
- package/src/SplitPage.tsx +4 -4
- package/src/TapToEdit.tsx +3 -7
- package/src/Text.tsx +1 -1
- package/src/TextArea.test.tsx +27 -43
- package/src/TextField.test.tsx +64 -5
- package/src/TextField.tsx +10 -1
- package/src/TextFieldNumberActionSheet.tsx +3 -7
- package/src/Tooltip.tsx +41 -19
- package/src/Unifier.ts +1 -3
- package/src/Utilities.tsx +3 -4
- package/src/WebAddressAutocomplete.tsx +1 -1
- package/src/__snapshots__/EmojiSelector.test.tsx.snap +604 -0
- package/src/index.tsx +12 -10
- package/src/table/Table.tsx +34 -36
- package/src/table/TableHeaderCell.tsx +2 -2
- package/src/useStoredState.ts +13 -11
package/src/Modal.tsx
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React, {FC, useEffect, useRef} from "react";
|
|
2
|
-
import {Dimensions, DimensionValue, Modal as RNModal,
|
|
2
|
+
import {Dimensions, DimensionValue, Pressable, Modal as RNModal, View} from "react-native";
|
|
3
3
|
import ActionSheet, {ActionSheetRef} from "react-native-actions-sheet";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
PanGestureHandlerStateChangeEvent,
|
|
7
|
-
State,
|
|
8
|
-
} from "react-native-gesture-handler";
|
|
4
|
+
import {Gesture, GestureDetector} from "react-native-gesture-handler";
|
|
5
|
+
import {runOnJS} from "react-native-reanimated";
|
|
9
6
|
|
|
10
7
|
import {Button} from "./Button";
|
|
11
|
-
import {ModalProps} from "./Common";
|
|
8
|
+
import type {ModalProps} from "./Common";
|
|
12
9
|
import {Heading} from "./Heading";
|
|
13
10
|
import {Icon} from "./Icon";
|
|
14
11
|
import {isMobileDevice} from "./MediaQuery";
|
|
@@ -129,7 +126,13 @@ const ModalContent: FC<{
|
|
|
129
126
|
</View>
|
|
130
127
|
)}
|
|
131
128
|
{children && (
|
|
132
|
-
<View
|
|
129
|
+
<View
|
|
130
|
+
style={{
|
|
131
|
+
marginTop: text ? 0 : 12,
|
|
132
|
+
width: "100%",
|
|
133
|
+
flex: isMobile ? undefined : 1,
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
133
136
|
{children}
|
|
134
137
|
</View>
|
|
135
138
|
)}
|
|
@@ -163,6 +166,7 @@ const ModalContent: FC<{
|
|
|
163
166
|
|
|
164
167
|
export const Modal: FC<ModalProps> = ({
|
|
165
168
|
children,
|
|
169
|
+
persistOnBackgroundClick = false,
|
|
166
170
|
primaryButtonDisabled = false,
|
|
167
171
|
primaryButtonText,
|
|
168
172
|
secondaryButtonText,
|
|
@@ -184,23 +188,28 @@ export const Modal: FC<ModalProps> = ({
|
|
|
184
188
|
}
|
|
185
189
|
};
|
|
186
190
|
|
|
187
|
-
const handlePrimaryButtonClick = (
|
|
191
|
+
const handlePrimaryButtonClick = (
|
|
192
|
+
value?: Parameters<NonNullable<ModalProps["primaryButtonOnClick"]>>[0]
|
|
193
|
+
) => {
|
|
188
194
|
if (visible && primaryButtonOnClick) {
|
|
189
195
|
return primaryButtonOnClick(value);
|
|
190
196
|
}
|
|
191
197
|
};
|
|
192
198
|
|
|
193
|
-
const handleSecondaryButtonClick = (
|
|
199
|
+
const handleSecondaryButtonClick = (
|
|
200
|
+
value?: Parameters<NonNullable<ModalProps["secondaryButtonOnClick"]>>[0]
|
|
201
|
+
) => {
|
|
194
202
|
if (visible && secondaryButtonOnClick) {
|
|
195
203
|
return secondaryButtonOnClick(value);
|
|
196
204
|
}
|
|
197
205
|
};
|
|
198
206
|
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
201
|
-
handleDismiss
|
|
207
|
+
const dragToClose = Gesture.Pan().onEnd((event) => {
|
|
208
|
+
if (event.translationY > 20) {
|
|
209
|
+
// Gesture callbacks run on the UI thread, runOnJS is required to safely invoke handleDismiss on the JS thread
|
|
210
|
+
runOnJS(handleDismiss)();
|
|
202
211
|
}
|
|
203
|
-
};
|
|
212
|
+
});
|
|
204
213
|
|
|
205
214
|
// Open the action sheet ref when the visible prop changes.
|
|
206
215
|
useEffect(() => {
|
|
@@ -213,6 +222,7 @@ export const Modal: FC<ModalProps> = ({
|
|
|
213
222
|
const sizePx = getModalSize(size);
|
|
214
223
|
|
|
215
224
|
const modalContentProps = {
|
|
225
|
+
persistOnBackgroundClick,
|
|
216
226
|
title,
|
|
217
227
|
subtitle,
|
|
218
228
|
text,
|
|
@@ -229,13 +239,22 @@ export const Modal: FC<ModalProps> = ({
|
|
|
229
239
|
|
|
230
240
|
if (isMobile) {
|
|
231
241
|
return (
|
|
232
|
-
<ActionSheet
|
|
233
|
-
|
|
234
|
-
|
|
242
|
+
<ActionSheet
|
|
243
|
+
ref={actionSheetRef}
|
|
244
|
+
closeOnTouchBackdrop={!persistOnBackgroundClick}
|
|
245
|
+
// Disable ActionSheet's built-in gestures to avoid conflicts with scrolling
|
|
246
|
+
gestureEnabled={false}
|
|
247
|
+
onClose={handleDismiss}
|
|
248
|
+
>
|
|
249
|
+
<View>
|
|
250
|
+
{/* Attach our own swipe-to-dismiss gesture to the top handle */}
|
|
251
|
+
<GestureDetector gesture={dragToClose}>
|
|
235
252
|
<View
|
|
236
253
|
accessibilityHint="Pull down to close the modal"
|
|
237
254
|
aria-label="Pull down bar"
|
|
238
255
|
aria-role="adjustable"
|
|
256
|
+
// add hitSlop to make the bar easier to hit since it's small
|
|
257
|
+
hitSlop={{top: 20, bottom: 20, left: 50, right: 50}}
|
|
239
258
|
style={{
|
|
240
259
|
justifyContent: "center",
|
|
241
260
|
alignItems: "center",
|
|
@@ -248,15 +267,33 @@ export const Modal: FC<ModalProps> = ({
|
|
|
248
267
|
marginTop: 10,
|
|
249
268
|
}}
|
|
250
269
|
/>
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
270
|
+
</GestureDetector>
|
|
271
|
+
|
|
272
|
+
<ModalContent {...modalContentProps}>{children}</ModalContent>
|
|
273
|
+
</View>
|
|
254
274
|
</ActionSheet>
|
|
255
275
|
);
|
|
256
276
|
} else {
|
|
257
277
|
return (
|
|
258
278
|
<RNModal animationType="slide" transparent visible={visible} onRequestClose={handleDismiss}>
|
|
259
|
-
<
|
|
279
|
+
<Pressable
|
|
280
|
+
style={{
|
|
281
|
+
flex: 1,
|
|
282
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
283
|
+
justifyContent: "center",
|
|
284
|
+
alignItems: "center",
|
|
285
|
+
}}
|
|
286
|
+
onPress={persistOnBackgroundClick ? undefined : handleDismiss}
|
|
287
|
+
>
|
|
288
|
+
<Pressable
|
|
289
|
+
style={{cursor: "auto"}}
|
|
290
|
+
onPress={(e) => {
|
|
291
|
+
persistOnBackgroundClick ? null : e.stopPropagation();
|
|
292
|
+
}}
|
|
293
|
+
>
|
|
294
|
+
<ModalContent {...modalContentProps}>{children}</ModalContent>
|
|
295
|
+
</Pressable>
|
|
296
|
+
</Pressable>
|
|
260
297
|
</RNModal>
|
|
261
298
|
);
|
|
262
299
|
}
|
package/src/NumberField.tsx
CHANGED
|
@@ -24,8 +24,8 @@ export const NumberField: FC<NumberFieldProps> = ({
|
|
|
24
24
|
if (!v) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
const num = type === "number" ? parseInt(v) : parseFloat(v);
|
|
28
|
-
if (isNaN(num) || (type === "number" && v.match(/[^0-9]/) !== null)) {
|
|
27
|
+
const num = type === "number" ? parseInt(v, 10) : parseFloat(v);
|
|
28
|
+
if (Number.isNaN(num) || (type === "number" && v.match(/[^0-9]/) !== null)) {
|
|
29
29
|
return "Value must be an integer";
|
|
30
30
|
} else if (
|
|
31
31
|
(type === "decimal" && v.match(/[^0-9.]+/) !== null) ||
|
|
@@ -47,13 +47,19 @@ export const NumberField: FC<NumberFieldProps> = ({
|
|
|
47
47
|
// Only return the value if it is a valid number
|
|
48
48
|
const localOnChange = useCallback(
|
|
49
49
|
(v: string) => {
|
|
50
|
-
|
|
50
|
+
if (type === "decimal" && v === ".") {
|
|
51
|
+
// if type is decimal and dot is the first character add 0 before it
|
|
52
|
+
setValue("0.");
|
|
53
|
+
rest.onChange("0.");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
51
56
|
const err = getError(v);
|
|
52
57
|
if (!err) {
|
|
58
|
+
setValue(v);
|
|
53
59
|
rest.onChange(v);
|
|
54
60
|
}
|
|
55
61
|
},
|
|
56
|
-
[getError, rest]
|
|
62
|
+
[getError, rest, type]
|
|
57
63
|
);
|
|
58
64
|
|
|
59
65
|
return <TextField {...rest} errorText={error} value={value} onChange={localOnChange} />;
|
|
@@ -9,16 +9,12 @@ import {NumberPickerActionSheetProps} from "./Common";
|
|
|
9
9
|
|
|
10
10
|
const PICKER_HEIGHT = 104;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
type NumberPickerActionSheetState = {};
|
|
13
13
|
|
|
14
14
|
export class NumberPickerActionSheet extends React.Component<
|
|
15
15
|
NumberPickerActionSheetProps,
|
|
16
16
|
NumberPickerActionSheetState
|
|
17
17
|
> {
|
|
18
|
-
constructor(props: NumberPickerActionSheetProps) {
|
|
19
|
-
super(props);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
18
|
render() {
|
|
23
19
|
return (
|
|
24
20
|
<ActionSheet ref={this.props.actionSheetRef} bounceOnOpen gestureEnabled>
|
package/src/Page.tsx
CHANGED
|
@@ -47,7 +47,7 @@ export class Page extends React.Component<PageProps, {}> {
|
|
|
47
47
|
<Button
|
|
48
48
|
text={this.props.rightButton}
|
|
49
49
|
variant="muted"
|
|
50
|
-
onClick={() => this.props.rightButtonOnClick
|
|
50
|
+
onClick={() => this.props.rightButtonOnClick?.()}
|
|
51
51
|
/>
|
|
52
52
|
</Box>
|
|
53
53
|
)}
|
package/src/Pagination.tsx
CHANGED
|
@@ -11,12 +11,7 @@ const PaginationButton: FC<{
|
|
|
11
11
|
onClick: () => void;
|
|
12
12
|
totalPages?: number;
|
|
13
13
|
page?: number;
|
|
14
|
-
}> = ({
|
|
15
|
-
type,
|
|
16
|
-
onClick,
|
|
17
|
-
totalPages = 1,
|
|
18
|
-
page = 1,
|
|
19
|
-
}) => {
|
|
14
|
+
}> = ({type, onClick, totalPages = 1, page = 1}) => {
|
|
20
15
|
let icon: IconName;
|
|
21
16
|
let disabled = false;
|
|
22
17
|
|
|
@@ -56,11 +51,7 @@ const PaginationNumber: FC<{
|
|
|
56
51
|
number: number | "more";
|
|
57
52
|
current: boolean;
|
|
58
53
|
onClick: () => void;
|
|
59
|
-
}> = ({
|
|
60
|
-
number,
|
|
61
|
-
current,
|
|
62
|
-
onClick,
|
|
63
|
-
}) => {
|
|
54
|
+
}> = ({number, current, onClick}) => {
|
|
64
55
|
// Shortcut to make rendering the number buttons easier.
|
|
65
56
|
if (number === "more") {
|
|
66
57
|
return <PaginationButton type="more" onClick={() => {}} />;
|
package/src/Permissions.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// import Permissions from "react-native-permissions";
|
|
5
5
|
import {PermissionKind, PermissionStatus} from "./Common";
|
|
6
6
|
|
|
7
|
-
export async function requestPermissions(
|
|
8
|
-
return new Promise(
|
|
7
|
+
export async function requestPermissions(_kind: PermissionKind): Promise<PermissionStatus> {
|
|
8
|
+
return new Promise((_resolve, _reject) => {
|
|
9
9
|
return "denied";
|
|
10
10
|
});
|
|
11
11
|
// const userPropertyKey = `PermissionsFor${capitalize(kind)}`;
|
package/src/PickerSelect.tsx
CHANGED
|
@@ -201,7 +201,7 @@ export function RNPickerSelect({
|
|
|
201
201
|
Keyboard.dismiss();
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
setAnimationType(modalProps
|
|
204
|
+
setAnimationType(modalProps?.animationType ? modalProps?.animationType : "slide");
|
|
205
205
|
|
|
206
206
|
triggerOpenCloseCallbacks();
|
|
207
207
|
|
package/src/SectionDivider.tsx
CHANGED
package/src/SegmentedControl.tsx
CHANGED
|
@@ -24,7 +24,9 @@ export const SegmentedControl: FC<SegmentedControlProps> = ({
|
|
|
24
24
|
}, []);
|
|
25
25
|
|
|
26
26
|
const handleNext = useCallback(() => {
|
|
27
|
-
setStartIndex((prev) =>
|
|
27
|
+
setStartIndex((prev) =>
|
|
28
|
+
Math.min(items.length - (maxItems ?? items.length), prev + (maxItems ?? 4))
|
|
29
|
+
);
|
|
28
30
|
}, [items.length, maxItems]);
|
|
29
31
|
|
|
30
32
|
const visibleItems = maxItems ? items.slice(startIndex, startIndex + maxItems) : items;
|
package/src/Signature.native.tsx
CHANGED
|
@@ -21,14 +21,14 @@ export const Signature: FC<Props> = ({onChange, onStart, onEnd}: Props) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const onBegin = () => {
|
|
24
|
-
onStart
|
|
24
|
+
onStart?.();
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
// Called after end of stroke. Kind of goofy if you ask me,
|
|
28
28
|
// but you need this in order to trigger the 'onOK' callback that gives us the actual image.
|
|
29
29
|
const handleEnd = () => {
|
|
30
30
|
ref.current?.readSignature();
|
|
31
|
-
onEnd
|
|
31
|
+
onEnd?.();
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
return (
|
package/src/SignatureField.tsx
CHANGED
package/src/Slider.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import SliderComponent from "@react-native-community/slider";
|
|
2
2
|
import React, {FC} from "react";
|
|
3
|
-
import {View} from "react-native";
|
|
4
3
|
|
|
5
4
|
import {Box} from "./Box";
|
|
6
5
|
import {IconName, SliderProps, ValueMappingItem} from "./Common";
|
|
@@ -16,11 +15,11 @@ const getCurrentMapping = (map: ValueMappingItem[], value: number) => {
|
|
|
16
15
|
if (!map || map.length === 0) {
|
|
17
16
|
return null;
|
|
18
17
|
}
|
|
19
|
-
|
|
18
|
+
|
|
20
19
|
// Find the option with the closest value
|
|
21
20
|
let closestOption = map[0];
|
|
22
21
|
let closestDistance = Math.abs(value - closestOption.value);
|
|
23
|
-
|
|
22
|
+
|
|
24
23
|
for (const option of map) {
|
|
25
24
|
const distance = Math.abs(value - option.value);
|
|
26
25
|
if (distance < closestDistance) {
|
|
@@ -28,7 +27,7 @@ const getCurrentMapping = (map: ValueMappingItem[], value: number) => {
|
|
|
28
27
|
closestOption = option;
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
|
|
30
|
+
|
|
32
31
|
return closestOption;
|
|
33
32
|
};
|
|
34
33
|
|
|
@@ -49,9 +48,9 @@ const getCenterContent = (
|
|
|
49
48
|
</Text>
|
|
50
49
|
);
|
|
51
50
|
}
|
|
52
|
-
|
|
51
|
+
|
|
53
52
|
const currentOption = getCurrentMapping(valueMapping, value);
|
|
54
|
-
|
|
53
|
+
|
|
55
54
|
if (useIcons) {
|
|
56
55
|
return (
|
|
57
56
|
<Icon
|
|
@@ -61,7 +60,7 @@ const getCenterContent = (
|
|
|
61
60
|
/>
|
|
62
61
|
);
|
|
63
62
|
}
|
|
64
|
-
|
|
63
|
+
|
|
65
64
|
return (
|
|
66
65
|
<Text align="center" color={disabled ? "secondaryLight" : "primary"} size="2xl">
|
|
67
66
|
{currentOption?.label}
|
|
@@ -72,7 +71,7 @@ const getCenterContent = (
|
|
|
72
71
|
const getSliderContent = (
|
|
73
72
|
slider: React.ReactElement,
|
|
74
73
|
inlineLabels: boolean,
|
|
75
|
-
labels?: SliderProps[
|
|
74
|
+
labels?: SliderProps["labels"]
|
|
76
75
|
): React.ReactElement => {
|
|
77
76
|
if (inlineLabels && labels?.min && labels?.max) {
|
|
78
77
|
return (
|
|
@@ -154,9 +153,9 @@ export const Slider: FC<SliderProps> = ({
|
|
|
154
153
|
thumbStyle: {
|
|
155
154
|
width: 48,
|
|
156
155
|
height: 48,
|
|
157
|
-
backgroundColor:
|
|
156
|
+
backgroundColor: "white",
|
|
158
157
|
borderRadius: 24,
|
|
159
|
-
shadowColor:
|
|
158
|
+
shadowColor: "#000",
|
|
160
159
|
shadowOffset: {
|
|
161
160
|
width: 0,
|
|
162
161
|
height: 2,
|
|
@@ -189,11 +188,7 @@ export const Slider: FC<SliderProps> = ({
|
|
|
189
188
|
<Box>
|
|
190
189
|
{Boolean(title) && <FieldTitle text={title!} />}
|
|
191
190
|
<Box direction="column" gap={showSelection ? 2 : 0}>
|
|
192
|
-
{showSelection &&
|
|
193
|
-
<Box alignItems="center">
|
|
194
|
-
{centerContent}
|
|
195
|
-
</Box>
|
|
196
|
-
)}
|
|
191
|
+
{showSelection && <Box alignItems="center">{centerContent}</Box>}
|
|
197
192
|
{sliderContent}
|
|
198
193
|
</Box>
|
|
199
194
|
{Boolean(helperText && !errorText) && <FieldHelperText text={helperText!} />}
|
|
@@ -201,5 +196,3 @@ export const Slider: FC<SliderProps> = ({
|
|
|
201
196
|
</Box>
|
|
202
197
|
);
|
|
203
198
|
};
|
|
204
|
-
|
|
205
|
-
|
package/src/SplitPage.native.tsx
CHANGED
|
@@ -9,7 +9,6 @@ import {SplitPageProps} from "./Common";
|
|
|
9
9
|
import {FlatList} from "./FlatList";
|
|
10
10
|
import {IconButton} from "./IconButton";
|
|
11
11
|
import {Spinner} from "./Spinner";
|
|
12
|
-
import {useTheme} from "./Theme";
|
|
13
12
|
import {Unifier} from "./Unifier";
|
|
14
13
|
|
|
15
14
|
export const SplitPage = ({
|
|
@@ -26,7 +25,6 @@ export const SplitPage = ({
|
|
|
26
25
|
bottomNavBarHeight,
|
|
27
26
|
showItemList,
|
|
28
27
|
}: SplitPageProps) => {
|
|
29
|
-
const {theme} = useTheme();
|
|
30
28
|
const [selectedId, setSelectedId] = useState<number | undefined>(undefined);
|
|
31
29
|
|
|
32
30
|
// flattenChildren is necessary to pull children from a React Fragment. Without this,
|
|
@@ -92,7 +90,7 @@ export const SplitPage = ({
|
|
|
92
90
|
paddingBottom: bottomNavBarHeight,
|
|
93
91
|
}}
|
|
94
92
|
>
|
|
95
|
-
{renderListViewHeader
|
|
93
|
+
{renderListViewHeader?.()}
|
|
96
94
|
<FlatList
|
|
97
95
|
data={listViewData}
|
|
98
96
|
extraData={listViewExtraData}
|
|
@@ -117,7 +115,7 @@ export const SplitPage = ({
|
|
|
117
115
|
onClick={() => onItemDeselect()}
|
|
118
116
|
/>
|
|
119
117
|
</Box>
|
|
120
|
-
{renderContent
|
|
118
|
+
{renderContent?.(selectedId)}
|
|
121
119
|
</Box>
|
|
122
120
|
);
|
|
123
121
|
};
|
package/src/SplitPage.tsx
CHANGED
|
@@ -95,7 +95,7 @@ export const SplitPage = ({
|
|
|
95
95
|
flexDirection: "column",
|
|
96
96
|
}}
|
|
97
97
|
>
|
|
98
|
-
{renderListViewHeader
|
|
98
|
+
{renderListViewHeader?.()}
|
|
99
99
|
<FlatList
|
|
100
100
|
data={listViewData}
|
|
101
101
|
extraData={listViewExtraData}
|
|
@@ -109,7 +109,7 @@ export const SplitPage = ({
|
|
|
109
109
|
const renderListContent = () => {
|
|
110
110
|
return (
|
|
111
111
|
<Box flex="grow" padding={2}>
|
|
112
|
-
{renderContent
|
|
112
|
+
{renderContent?.(selectedId)}
|
|
113
113
|
</Box>
|
|
114
114
|
);
|
|
115
115
|
};
|
|
@@ -205,7 +205,7 @@ export const SplitPage = ({
|
|
|
205
205
|
flexDirection: "column",
|
|
206
206
|
}}
|
|
207
207
|
>
|
|
208
|
-
{renderListViewHeader
|
|
208
|
+
{renderListViewHeader?.()}
|
|
209
209
|
<FlatList
|
|
210
210
|
data={listViewData}
|
|
211
211
|
extraData={listViewExtraData}
|
|
@@ -234,7 +234,7 @@ export const SplitPage = ({
|
|
|
234
234
|
/>
|
|
235
235
|
</Box>
|
|
236
236
|
)}
|
|
237
|
-
{renderContent
|
|
237
|
+
{renderContent?.(selectedId)}
|
|
238
238
|
</Box>
|
|
239
239
|
);
|
|
240
240
|
};
|
package/src/TapToEdit.tsx
CHANGED
|
@@ -13,11 +13,7 @@ const TapToEditTitle: FC<{
|
|
|
13
13
|
onlyShowHelperTextWhileEditing?: boolean;
|
|
14
14
|
title: string;
|
|
15
15
|
helperText?: string;
|
|
16
|
-
}> = ({
|
|
17
|
-
title,
|
|
18
|
-
helperText,
|
|
19
|
-
onlyShowHelperTextWhileEditing,
|
|
20
|
-
}) => {
|
|
16
|
+
}> = ({title, helperText, onlyShowHelperTextWhileEditing}) => {
|
|
21
17
|
return (
|
|
22
18
|
<View style={{flex: 1, justifyContent: "center"}}>
|
|
23
19
|
<Text bold>{title}</Text>
|
|
@@ -117,7 +113,7 @@ export const TapToEdit: FC<TapToEditProps> = ({
|
|
|
117
113
|
</View>
|
|
118
114
|
<View style={{gap: 16}}>
|
|
119
115
|
<Field
|
|
120
|
-
grow={fieldProps?.type === "textarea" ? fieldProps.grow ?? true : undefined}
|
|
116
|
+
grow={fieldProps?.type === "textarea" ? (fieldProps.grow ?? true) : undefined}
|
|
121
117
|
helperText={helperText}
|
|
122
118
|
inputRef={
|
|
123
119
|
["text", "textarea", "url", "email", "number"].includes(fieldProps?.type)
|
|
@@ -210,7 +206,7 @@ export const TapToEdit: FC<TapToEditProps> = ({
|
|
|
210
206
|
try {
|
|
211
207
|
const url = new URL(value);
|
|
212
208
|
displayValue = url?.hostname ?? value;
|
|
213
|
-
} catch (
|
|
209
|
+
} catch (_error) {
|
|
214
210
|
// Don't print an error message for empty values.
|
|
215
211
|
if (value) {
|
|
216
212
|
console.debug(`Invalid URL: $value`);
|
package/src/Text.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useFonts,
|
|
9
9
|
} from "@expo-google-fonts/nunito";
|
|
10
10
|
import React from "react";
|
|
11
|
-
import {
|
|
11
|
+
import {Text as NativeText, Platform, TextStyle} from "react-native";
|
|
12
12
|
|
|
13
13
|
import {TextProps} from "./Common";
|
|
14
14
|
import {Hyperlink} from "./Hyperlink";
|