ferns-ui 2.0.0-beta.2 → 2.0.0-beta.4
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 +13 -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/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/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 +10 -10
- package/dist/index.js +10 -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 +5 -64
- 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 +14 -21
- package/src/DataTable.tsx +1 -2
- package/src/DateTimeField.tsx +22 -22
- package/src/EmailField.tsx +22 -42
- 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 +3 -4
- 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/index.tsx +11 -10
- package/src/table/Table.tsx +34 -36
- package/src/table/TableHeaderCell.tsx +2 -2
- package/src/useStoredState.ts +13 -11
package/src/index.tsx
CHANGED
|
@@ -34,6 +34,7 @@ export * from "./ImageBackground";
|
|
|
34
34
|
export * from "./InfoModalIcon";
|
|
35
35
|
export * from "./InfoTooltipButton";
|
|
36
36
|
export * from "./Link";
|
|
37
|
+
export * from "./MarkdownView";
|
|
37
38
|
export * from "./MediaQuery";
|
|
38
39
|
export * from "./MobileAddressAutoComplete";
|
|
39
40
|
export * from "./Modal";
|
|
@@ -59,11 +60,17 @@ export * from "./SignatureField";
|
|
|
59
60
|
export * from "./Slider";
|
|
60
61
|
export * from "./Spinner";
|
|
61
62
|
export * from "./SplitPage";
|
|
63
|
+
export * from "./TapToEdit";
|
|
64
|
+
export * from "./Text";
|
|
65
|
+
export * from "./TextArea";
|
|
66
|
+
export * from "./TextField";
|
|
67
|
+
export * from "./Theme";
|
|
68
|
+
export * from "./Toast";
|
|
69
|
+
export * from "./Tooltip";
|
|
62
70
|
export * from "./table/Table";
|
|
63
71
|
export * from "./table/Table";
|
|
64
72
|
export * from "./table/TableBadge";
|
|
65
73
|
export * from "./table/TableBoolean";
|
|
66
|
-
export * from "./table/tableContext";
|
|
67
74
|
export * from "./table/TableDate";
|
|
68
75
|
export * from "./table/TableHeader";
|
|
69
76
|
export * from "./table/TableHeaderCell";
|
|
@@ -72,18 +79,13 @@ export * from "./table/TableNumber";
|
|
|
72
79
|
export * from "./table/TableRow";
|
|
73
80
|
export * from "./table/TableText";
|
|
74
81
|
export * from "./table/TableTitle";
|
|
75
|
-
export * from "./
|
|
76
|
-
export * from "./Text";
|
|
77
|
-
export * from "./TextArea";
|
|
78
|
-
export * from "./TextField";
|
|
79
|
-
export * from "./Theme";
|
|
80
|
-
export * from "./Toast";
|
|
81
|
-
export * from "./Tooltip";
|
|
82
|
+
export * from "./table/tableContext";
|
|
82
83
|
export * from "./UnifiedAddressAutoComplete";
|
|
83
84
|
export * from "./Unifier";
|
|
84
|
-
export * from "./useStoredState";
|
|
85
85
|
export * from "./Utilities";
|
|
86
|
+
export * from "./useStoredState";
|
|
86
87
|
export * from "./WebAddressAutocomplete";
|
|
88
|
+
|
|
87
89
|
// export * from "./Layout";
|
|
88
90
|
// export * from "./Drawer";
|
|
89
91
|
// export * from "./Chart";
|
|
@@ -1370,4 +1372,3 @@ export interface Options {
|
|
|
1370
1372
|
*/
|
|
1371
1373
|
blurOnUnmount?: boolean;
|
|
1372
1374
|
}
|
|
1373
|
-
export {};
|
package/src/table/Table.tsx
CHANGED
|
@@ -68,44 +68,42 @@ export const Table = ({
|
|
|
68
68
|
sortColumn={sortColumn}
|
|
69
69
|
stickyHeader={stickyHeader}
|
|
70
70
|
>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
(child
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
)}
|
|
95
|
-
</ScrollView>
|
|
71
|
+
<Box
|
|
72
|
+
flex="grow"
|
|
73
|
+
maxWidth="100%"
|
|
74
|
+
style={{
|
|
75
|
+
position: "relative",
|
|
76
|
+
}}
|
|
77
|
+
width={width}
|
|
78
|
+
>
|
|
79
|
+
<ScrollView horizontal style={{width, maxWidth: "100%"}}>
|
|
80
|
+
{/* TODO: Replace table scrollview with flat list */}
|
|
81
|
+
<ScrollView
|
|
82
|
+
// nestedScrollEnabled
|
|
83
|
+
stickyHeaderIndices={stickyHeader ? [0] : undefined}
|
|
84
|
+
style={{width, maxWidth: "100%", flex: 1, maxHeight}}
|
|
85
|
+
>
|
|
86
|
+
{Children.map(
|
|
87
|
+
children,
|
|
88
|
+
(child, index) =>
|
|
89
|
+
Boolean(child) &&
|
|
90
|
+
React.cloneElement(child as ReactElement<TableRowProps>, {
|
|
91
|
+
color: index % 2 === 1 && alternateRowBackground ? "neutralLight" : "base",
|
|
92
|
+
})
|
|
93
|
+
)}
|
|
96
94
|
</ScrollView>
|
|
95
|
+
</ScrollView>
|
|
96
|
+
</Box>
|
|
97
|
+
{Boolean(shouldPaginate && totalPages !== undefined) && (
|
|
98
|
+
<Box alignItems="center" borderTop="default" direction="row" height={60} paddingX={8}>
|
|
99
|
+
<Pagination
|
|
100
|
+
page={propsPage ?? page}
|
|
101
|
+
setPage={propsSetPage ?? setPage}
|
|
102
|
+
totalPages={totalPages!}
|
|
103
|
+
/>
|
|
104
|
+
{Boolean(extraControls) && extraControls}
|
|
97
105
|
</Box>
|
|
98
|
-
|
|
99
|
-
<Box alignItems="center" borderTop="default" direction="row" height={60} paddingX={8}>
|
|
100
|
-
<Pagination
|
|
101
|
-
page={propsPage ?? page}
|
|
102
|
-
setPage={propsSetPage ?? setPage}
|
|
103
|
-
totalPages={totalPages!}
|
|
104
|
-
/>
|
|
105
|
-
{Boolean(extraControls) && extraControls}
|
|
106
|
-
</Box>
|
|
107
|
-
)}
|
|
108
|
-
</>
|
|
106
|
+
)}
|
|
109
107
|
</TableContextProvider>
|
|
110
108
|
);
|
|
111
109
|
};
|
|
@@ -6,8 +6,8 @@ import {View} from "react-native";
|
|
|
6
6
|
import {Box} from "../Box";
|
|
7
7
|
import {AlignItems, TableHeaderCellProps} from "../Common";
|
|
8
8
|
import {useTheme} from "../Theme";
|
|
9
|
-
import {useTableContext} from "./tableContext";
|
|
10
9
|
import {TableTitle} from "./TableTitle";
|
|
10
|
+
import {useTableContext} from "./tableContext";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Use TableHeaderCell to define a header cell in Table.
|
|
@@ -48,7 +48,7 @@ export const TableHeaderCell = ({
|
|
|
48
48
|
if (setSortColumn) {
|
|
49
49
|
setSortColumn(newSort ? {column: index, direction: newSort} : undefined);
|
|
50
50
|
}
|
|
51
|
-
onSortChange
|
|
51
|
+
onSortChange?.(newSort);
|
|
52
52
|
}, [index, onSortChange, setSortColumn, sort]);
|
|
53
53
|
|
|
54
54
|
if (sortable && !onSortChange) {
|
package/src/useStoredState.ts
CHANGED
|
@@ -22,17 +22,19 @@ export const useStoredState = <T>(
|
|
|
22
22
|
|
|
23
23
|
// Fetch data when the component mounts
|
|
24
24
|
useEffect(() => {
|
|
25
|
-
void fetchData()
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
void fetchData()
|
|
26
|
+
.then((value) => {
|
|
27
|
+
if (isMounted.current) {
|
|
28
|
+
setState(value);
|
|
29
|
+
setIsLoading(false);
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
.catch((error) => {
|
|
33
|
+
console.error("Error fetching data:", error);
|
|
34
|
+
if (isMounted.current) {
|
|
35
|
+
setIsLoading(false);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
36
38
|
|
|
37
39
|
return () => {
|
|
38
40
|
isMounted.current = false;
|