ferns-ui 0.32.2 → 0.33.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/ActionSheet.d.ts +6 -6
- package/dist/ActionSheet.js +2 -2
- package/dist/ActionSheet.js.map +1 -1
- package/dist/Banner.d.ts +1 -1
- package/dist/BlurBox.d.ts +1 -1
- package/dist/BlurBox.native.d.ts +2 -2
- package/dist/Body.d.ts +2 -2
- package/dist/Box.d.ts +1 -1
- package/dist/Box.js +2 -2
- package/dist/Box.js.map +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +2 -2
- package/dist/Button.js.map +1 -1
- package/dist/Card.d.ts +1 -1
- package/dist/Common.d.ts +3 -0
- package/dist/Common.js.map +1 -1
- package/dist/DateTimeActionSheet.d.ts +1 -1
- package/dist/DecimalRangeActionSheet.d.ts +1 -1
- package/dist/ErrorBoundary.d.ts +1 -1
- package/dist/ErrorPage.d.ts +1 -1
- package/dist/Field.d.ts +2 -2
- package/dist/Field.js +1 -1
- package/dist/Field.js.map +1 -1
- package/dist/FieldWithLabels.d.ts +2 -2
- package/dist/Form.d.ts +6 -6
- package/dist/HeaderButtons.d.ts +7 -7
- package/dist/Heading.d.ts +1 -1
- package/dist/HeightActionSheet.d.ts +1 -1
- package/dist/Hyperlink.d.ts +1 -1
- package/dist/IconButton.js +2 -2
- package/dist/IconButton.js.map +1 -1
- package/dist/Image.d.ts +1 -1
- package/dist/ImageBackground.d.ts +1 -1
- package/dist/Link.d.ts +1 -1
- package/dist/Meta.d.ts +1 -1
- package/dist/NumberPickerActionSheet.d.ts +1 -1
- package/dist/Page.d.ts +2 -2
- package/dist/PickerSelect.d.ts +4 -4
- package/dist/PickerSelect.js +5 -5
- package/dist/PickerSelect.js.map +1 -1
- package/dist/Pill.d.ts +1 -1
- package/dist/Pog.d.ts +2 -2
- package/dist/ProgressBar.d.ts +1 -1
- package/dist/SegmentedControl.d.ts +2 -2
- package/dist/SelectList.d.ts +2 -2
- package/dist/SplitPage.d.ts +2 -2
- package/dist/SplitPage.js +1 -1
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.d.ts +2 -2
- package/dist/Switch.d.ts +1 -1
- package/dist/Table.d.ts +2 -1
- package/dist/Table.js.map +1 -1
- package/dist/TapToEdit.d.ts +1 -1
- package/dist/TapToEdit.js +11 -4
- package/dist/TapToEdit.js.map +1 -1
- package/dist/TextArea.d.ts +1 -1
- package/dist/TextFieldNumberActionSheet.d.ts +1 -1
- package/package.json +31 -30
- package/src/ActionSheet.tsx +2 -2
- package/src/Box.tsx +3 -3
- package/src/Button.tsx +3 -3
- package/src/Common.ts +3 -0
- package/src/Field.tsx +1 -1
- package/src/IconButton.tsx +3 -3
- package/src/PickerSelect.tsx +8 -7
- package/src/SplitPage.tsx +1 -1
- package/src/Table.tsx +4 -3
- package/src/TapToEdit.tsx +26 -5
package/src/IconButton.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, {forwardRef, useState} from "react";
|
|
2
|
-
import {Platform,
|
|
2
|
+
import {Platform, Pressable} from "react-native";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
ButtonColor,
|
|
@@ -90,7 +90,7 @@ export const IconButton = forwardRef(
|
|
|
90
90
|
function renderIconButton(): React.ReactElement {
|
|
91
91
|
return (
|
|
92
92
|
<>
|
|
93
|
-
<
|
|
93
|
+
<Pressable
|
|
94
94
|
ref={ref as any}
|
|
95
95
|
hitSlop={{top: 10, left: 10, bottom: 10, right: 10}}
|
|
96
96
|
style={{
|
|
@@ -117,7 +117,7 @@ export const IconButton = forwardRef(
|
|
|
117
117
|
}}
|
|
118
118
|
>
|
|
119
119
|
<Icon color={iconColor} name={icon} prefix={prefix || "fas"} size={size} />
|
|
120
|
-
</
|
|
120
|
+
</Pressable>
|
|
121
121
|
{Boolean(withConfirmation) && renderConfirmation()}
|
|
122
122
|
</>
|
|
123
123
|
);
|
package/src/PickerSelect.tsx
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
Keyboard,
|
|
31
31
|
Modal,
|
|
32
32
|
Platform,
|
|
33
|
+
Pressable,
|
|
33
34
|
StyleSheet,
|
|
34
35
|
Text,
|
|
35
36
|
TextInput,
|
|
@@ -191,7 +192,7 @@ export function RNPickerSelect({
|
|
|
191
192
|
}, [items, placeholder]);
|
|
192
193
|
|
|
193
194
|
const getSelectedItem = useCallback(
|
|
194
|
-
(key, val) => {
|
|
195
|
+
(key: any, val: any) => {
|
|
195
196
|
let idx = options.findIndex((item: any) => {
|
|
196
197
|
if (item.key && key) {
|
|
197
198
|
return isEqual(item.key, key);
|
|
@@ -326,7 +327,7 @@ export function RNPickerSelect({
|
|
|
326
327
|
/>
|
|
327
328
|
</TouchableOpacity>
|
|
328
329
|
</View>
|
|
329
|
-
<
|
|
330
|
+
<Pressable
|
|
330
331
|
hitSlop={{top: 4, right: 4, bottom: 4, left: 4}}
|
|
331
332
|
testID="done_button"
|
|
332
333
|
onPress={() => {
|
|
@@ -353,7 +354,7 @@ export function RNPickerSelect({
|
|
|
353
354
|
{doneText}
|
|
354
355
|
</Text>
|
|
355
356
|
</View>
|
|
356
|
-
</
|
|
357
|
+
</Pressable>
|
|
357
358
|
</View>
|
|
358
359
|
);
|
|
359
360
|
};
|
|
@@ -406,7 +407,7 @@ export function RNPickerSelect({
|
|
|
406
407
|
const renderIOS = () => {
|
|
407
408
|
return (
|
|
408
409
|
<View style={[defaultStyles.viewContainer, style.viewContainer]}>
|
|
409
|
-
<
|
|
410
|
+
<Pressable
|
|
410
411
|
activeOpacity={1}
|
|
411
412
|
style={{
|
|
412
413
|
flexDirection: "row",
|
|
@@ -422,7 +423,7 @@ export function RNPickerSelect({
|
|
|
422
423
|
{...touchableWrapperProps}
|
|
423
424
|
>
|
|
424
425
|
{renderTextInputOrChildren()}
|
|
425
|
-
</
|
|
426
|
+
</Pressable>
|
|
426
427
|
<Modal
|
|
427
428
|
animationType={animationType}
|
|
428
429
|
supportedOrientations={["portrait", "landscape"]}
|
|
@@ -432,7 +433,7 @@ export function RNPickerSelect({
|
|
|
432
433
|
onOrientationChange={onOrientationChange}
|
|
433
434
|
{...modalProps}
|
|
434
435
|
>
|
|
435
|
-
<
|
|
436
|
+
<Pressable
|
|
436
437
|
style={[defaultStyles.modalViewTop, style.modalViewTop]}
|
|
437
438
|
testID="ios_modal_top"
|
|
438
439
|
onPress={() => {
|
|
@@ -462,7 +463,7 @@ export function RNPickerSelect({
|
|
|
462
463
|
};
|
|
463
464
|
|
|
464
465
|
const renderAndroidHeadless = () => {
|
|
465
|
-
const Component: any = fixAndroidTouchableBug ? View :
|
|
466
|
+
const Component: any = fixAndroidTouchableBug ? View : Pressable;
|
|
466
467
|
return (
|
|
467
468
|
<Component
|
|
468
469
|
activeOpacity={1}
|
package/src/SplitPage.tsx
CHANGED
package/src/Table.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, {Children, ReactElement} from "react";
|
|
2
|
+
import {DimensionValue} from "react-native/Libraries/StyleSheet/StyleSheetTypes";
|
|
2
3
|
|
|
3
4
|
import {ScrollView} from "./ScrollView";
|
|
4
5
|
import {ColumnSortInterface, TableContextProvider} from "./tableContext";
|
|
@@ -19,7 +20,7 @@ interface TableProps {
|
|
|
19
20
|
/**
|
|
20
21
|
* Use numbers for pixels: `maxHeight={100}` and strings for percentages: `maxHeight="100%"`.
|
|
21
22
|
*/
|
|
22
|
-
maxHeight?:
|
|
23
|
+
maxHeight?: DimensionValue;
|
|
23
24
|
/**
|
|
24
25
|
* If true, the header will stick to the top of the table when scrolling. Defaults to true.
|
|
25
26
|
*/
|
|
@@ -47,11 +48,11 @@ export function Table({
|
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
// Calculate the total width of the table. If the table has only number widths, calculate a width. Otherwise use 100%.
|
|
50
|
-
let width:
|
|
51
|
+
let width: DimensionValue;
|
|
51
52
|
if (columns.every((column) => typeof column === "number")) {
|
|
52
53
|
width = columns.reduce((acc, curr) => {
|
|
53
54
|
return (acc as number) + (curr as number);
|
|
54
|
-
}, 0);
|
|
55
|
+
}, 0) as number;
|
|
55
56
|
if (hasDrawerContents) {
|
|
56
57
|
width = (width as number) + 30;
|
|
57
58
|
}
|
package/src/TapToEdit.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import {Field, FieldProps} from "./Field";
|
|
|
8
8
|
import {Icon} from "./Icon";
|
|
9
9
|
import {Text} from "./Text";
|
|
10
10
|
|
|
11
|
-
export function formatAddress(address: any): string {
|
|
11
|
+
export function formatAddress(address: any, asString = false): string {
|
|
12
12
|
let city = "";
|
|
13
13
|
if (address?.city) {
|
|
14
14
|
city = address?.state || address.zipcode ? `${address.city}, ` : `${address.city}`;
|
|
@@ -25,10 +25,16 @@ export function formatAddress(address: any): string {
|
|
|
25
25
|
const addressLineTwo = address?.address2 ?? "";
|
|
26
26
|
const addressLineThree = `${city}${state}${zip}`;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
addressLineOne
|
|
31
|
-
|
|
28
|
+
if (!asString) {
|
|
29
|
+
// Only add new lines if lines before and after are not empty to avoid awkward whitespace
|
|
30
|
+
return `${addressLineOne}${
|
|
31
|
+
addressLineOne && (addressLineTwo || addressLineThree) ? `\n` : ""
|
|
32
|
+
}${addressLineTwo}${addressLineTwo && addressLineThree ? `\n` : ""}${addressLineThree}`;
|
|
33
|
+
} else {
|
|
34
|
+
return `${addressLineOne}${
|
|
35
|
+
addressLineOne && (addressLineTwo || addressLineThree) ? `, ` : ""
|
|
36
|
+
}${addressLineTwo}${addressLineTwo && addressLineThree ? `, ` : ""}${addressLineThree}`;
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
export interface TapToEditProps extends Omit<FieldProps, "onChange" | "value"> {
|
|
@@ -181,6 +187,21 @@ export const TapToEdit = ({
|
|
|
181
187
|
>
|
|
182
188
|
<Box>
|
|
183
189
|
<Text weight="bold">{title}:</Text>
|
|
190
|
+
{fieldProps?.type === "address" && (
|
|
191
|
+
<Box
|
|
192
|
+
onClick={
|
|
193
|
+
() =>
|
|
194
|
+
Linking.openURL(
|
|
195
|
+
`https://www.google.com/maps/search/?q=${formatAddress(value, true)}`
|
|
196
|
+
)
|
|
197
|
+
// eslint-disable-next-line react/jsx-curly-newline
|
|
198
|
+
}
|
|
199
|
+
>
|
|
200
|
+
<Text color="blue" underline={fieldProps?.type === "address"}>
|
|
201
|
+
Google Maps
|
|
202
|
+
</Text>
|
|
203
|
+
</Box>
|
|
204
|
+
)}
|
|
184
205
|
</Box>
|
|
185
206
|
<Box direction="row">
|
|
186
207
|
<Box onClick={fieldProps?.type === "url" ? openLink : undefined}>
|