ferns-ui 1.8.0 → 1.9.1
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/BooleanField.d.ts +2 -2
- package/dist/BooleanField.js.map +1 -1
- package/dist/Box.js +43 -1
- package/dist/Box.js.map +1 -1
- package/dist/Common.d.ts +35 -28
- package/dist/Common.js.map +1 -1
- package/dist/CustomSelectField.d.ts +2 -2
- package/dist/CustomSelectField.js.map +1 -1
- package/dist/DataTable.d.ts +2 -2
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeField.d.ts +2 -2
- package/dist/DateTimeField.js +48 -8
- package/dist/DateTimeField.js.map +1 -1
- package/dist/DateTimeField.test.js +5 -5
- package/dist/DateTimeField.test.js.map +1 -1
- package/dist/FernsProvider.d.ts +3 -3
- package/dist/FernsProvider.js.map +1 -1
- package/dist/Icon.d.ts +2 -2
- package/dist/Icon.js.map +1 -1
- package/dist/Pagination.d.ts +2 -2
- package/dist/Pagination.js.map +1 -1
- package/dist/SegmentedControl.d.ts +2 -2
- package/dist/SegmentedControl.js.map +1 -1
- package/dist/Signature.native.d.ts +2 -2
- package/dist/Signature.native.js.map +1 -1
- package/dist/Spinner.d.ts +2 -2
- package/dist/Spinner.js.map +1 -1
- package/dist/TapToEdit.d.ts +2 -2
- package/dist/TapToEdit.js +11 -1
- package/dist/TapToEdit.js.map +1 -1
- package/dist/TimezonePicker.d.ts +2 -2
- package/dist/TimezonePicker.js.map +1 -1
- package/package.json +12 -1
- package/src/BooleanField.tsx +3 -3
- package/src/Box.tsx +45 -1
- package/src/Common.ts +40 -27
- package/src/CustomSelectField.tsx +3 -3
- package/src/DataTable.tsx +10 -10
- package/src/DateTimeField.test.tsx +5 -5
- package/src/DateTimeField.tsx +57 -12
- package/src/FernsProvider.tsx +6 -6
- package/src/Icon.tsx +3 -3
- package/src/Pagination.tsx +15 -15
- package/src/SegmentedControl.tsx +2 -2
- package/src/Signature.native.tsx +2 -2
- package/src/Spinner.tsx +2 -2
- package/src/TapToEdit.tsx +26 -9
- package/src/TimezonePicker.tsx +2 -2
package/src/TapToEdit.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {FC, useEffect, useRef, useState} from "react";
|
|
2
2
|
import {Linking, View} from "react-native";
|
|
3
3
|
|
|
4
4
|
import {Box} from "./Box";
|
|
@@ -9,15 +9,15 @@ import {Icon} from "./Icon";
|
|
|
9
9
|
// import {useOpenAPISpec} from "./OpenAPIContext";
|
|
10
10
|
import {Text} from "./Text";
|
|
11
11
|
|
|
12
|
-
const TapToEditTitle
|
|
13
|
-
title,
|
|
14
|
-
helperText,
|
|
15
|
-
onlyShowHelperTextWhileEditing,
|
|
16
|
-
}: {
|
|
12
|
+
const TapToEditTitle: FC<{
|
|
17
13
|
onlyShowHelperTextWhileEditing?: boolean;
|
|
18
14
|
title: string;
|
|
19
15
|
helperText?: string;
|
|
20
|
-
}
|
|
16
|
+
}> = ({
|
|
17
|
+
title,
|
|
18
|
+
helperText,
|
|
19
|
+
onlyShowHelperTextWhileEditing,
|
|
20
|
+
}) => {
|
|
21
21
|
return (
|
|
22
22
|
<View style={{flex: 1, justifyContent: "center"}}>
|
|
23
23
|
<Text bold>{title}</Text>
|
|
@@ -68,7 +68,7 @@ export function formatAddress(address: AddressInterface, asString = false): stri
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
export const TapToEdit = ({
|
|
71
|
+
export const TapToEdit: FC<TapToEditProps> = ({
|
|
72
72
|
value,
|
|
73
73
|
setValue,
|
|
74
74
|
title,
|
|
@@ -81,8 +81,9 @@ export const TapToEdit = ({
|
|
|
81
81
|
confirmationTitle = "Confirm",
|
|
82
82
|
helperText: propsHelperText,
|
|
83
83
|
onlyShowHelperTextWhileEditing = true,
|
|
84
|
+
showClearButton = false,
|
|
84
85
|
...fieldProps
|
|
85
|
-
}
|
|
86
|
+
}) => {
|
|
86
87
|
const [editing, setEditing] = useState(false);
|
|
87
88
|
const [initialValue, setInitialValue] = useState();
|
|
88
89
|
const helperText: string | undefined = propsHelperText;
|
|
@@ -141,6 +142,22 @@ export const TapToEdit = ({
|
|
|
141
142
|
setEditing(false);
|
|
142
143
|
}}
|
|
143
144
|
/>
|
|
145
|
+
{(showClearButton || ["date", "datetime", "time"].includes(fieldProps?.type)) && (
|
|
146
|
+
<Button
|
|
147
|
+
text="Clear"
|
|
148
|
+
variant="muted"
|
|
149
|
+
onClick={(): void => {
|
|
150
|
+
if (setValue) {
|
|
151
|
+
setValue("");
|
|
152
|
+
setInitialValue("" as any);
|
|
153
|
+
}
|
|
154
|
+
if (onSave) {
|
|
155
|
+
onSave("");
|
|
156
|
+
}
|
|
157
|
+
setEditing(false);
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
)}
|
|
144
161
|
<View style={{marginLeft: 8}}>
|
|
145
162
|
<Button
|
|
146
163
|
confirmationText={confirmationText}
|
package/src/TimezonePicker.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {FC} from "react";
|
|
2
2
|
|
|
3
3
|
import {SelectFieldPropsBase} from "./Common";
|
|
4
4
|
import {getTimezoneOptions} from "./DateUtilities";
|
|
@@ -12,7 +12,7 @@ interface TimezonePickerProps extends Omit<SelectFieldPropsBase, "options"> {
|
|
|
12
12
|
shortTimezone?: boolean;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const TimezonePicker:
|
|
15
|
+
export const TimezonePicker: FC<TimezonePickerProps> = ({
|
|
16
16
|
timezone,
|
|
17
17
|
onChange,
|
|
18
18
|
location = "USA",
|