ferns-ui 0.12.2 → 0.13.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/TapToEdit.js +7 -7
- package/dist/TapToEdit.js.map +1 -1
- package/package.json +4 -2
- package/src/TapToEdit.tsx +6 -7
package/dist/TapToEdit.js
CHANGED
|
@@ -20,7 +20,7 @@ export const TapToEdit = (props) => {
|
|
|
20
20
|
const [value, setValue] = useState(props.initialValue);
|
|
21
21
|
const { title, editable = true, rowBoxProps, transform, fieldComponent } = props, fieldProps = __rest(props, ["title", "editable", "rowBoxProps", "transform", "fieldComponent"]);
|
|
22
22
|
if (editing) {
|
|
23
|
-
return (React.createElement(Box, { direction: "column"
|
|
23
|
+
return (React.createElement(Box, { direction: "column" },
|
|
24
24
|
fieldComponent ? (fieldComponent(setValue)) : (React.createElement(Field, Object.assign({ handleChange: (_, val) => setValue(val), label: props.title }, fieldProps))),
|
|
25
25
|
React.createElement(Box, { direction: "row" },
|
|
26
26
|
React.createElement(Button, { color: "blue", inline: true, text: "Save", onClick: async () => {
|
|
@@ -38,10 +38,10 @@ export const TapToEdit = (props) => {
|
|
|
38
38
|
} })))));
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
let displayValue =
|
|
42
|
-
// If transform is present, that takes priority
|
|
41
|
+
let displayValue = props.initialValue;
|
|
42
|
+
// If a transform props is present, that takes priority
|
|
43
43
|
if (transform) {
|
|
44
|
-
displayValue = transform(
|
|
44
|
+
displayValue = transform(props.initialValue);
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
47
|
// If no transform, try and display the value reasonably.
|
|
@@ -67,13 +67,13 @@ export const TapToEdit = (props) => {
|
|
|
67
67
|
displayValue = value.join(", ");
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
return (React.createElement(Box, Object.assign({ direction: "row", justifyContent: "between",
|
|
70
|
+
return (React.createElement(Box, Object.assign({ direction: "row", justifyContent: "between", paddingX: 3, paddingY: 2, width: "100%" }, rowBoxProps),
|
|
71
71
|
React.createElement(Box, null,
|
|
72
72
|
React.createElement(Text, { weight: "bold" },
|
|
73
73
|
title,
|
|
74
74
|
":")),
|
|
75
|
-
React.createElement(Box, { direction: "row"
|
|
76
|
-
React.createElement(Box,
|
|
75
|
+
React.createElement(Box, { direction: "row" },
|
|
76
|
+
React.createElement(Box, null,
|
|
77
77
|
React.createElement(Text, { overflow: "breakWord" }, displayValue)),
|
|
78
78
|
editable && (React.createElement(Box, { marginLeft: 2, onClick: () => setEditing(true) },
|
|
79
79
|
React.createElement(Icon, { color: "darkGray", name: "edit", size: "lg" }))))));
|
package/dist/TapToEdit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TapToEdit.js","sourceRoot":"","sources":["../src/TapToEdit.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAe,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAa,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAc5B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAgB,EAAE;IAC/D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAEvD,MAAM,EAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,KAAmB,KAAK,EAAnB,UAAU,UAAI,KAAK,EAAvF,mEAA+E,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
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"scripts": {
|
|
@@ -182,6 +182,7 @@
|
|
|
182
182
|
"react": "^18.2.0",
|
|
183
183
|
"react-app-polyfill": "^3.0.0",
|
|
184
184
|
"react-dev-utils": "^12.0.1",
|
|
185
|
+
"react-datetime-picker": "^4.0.1",
|
|
185
186
|
"react-dom": "18.2.0",
|
|
186
187
|
"react-native": "0.69.4",
|
|
187
188
|
"react-native-calendars": "^1.1288.2",
|
|
@@ -192,6 +193,7 @@
|
|
|
192
193
|
"react-native-portalize": "^1.0.7",
|
|
193
194
|
"react-native-svg": "^13.0.0",
|
|
194
195
|
"react-router": "^6.3.0",
|
|
195
|
-
"react-router-dom": "^6.3.0"
|
|
196
|
+
"react-router-dom": "^6.3.0",
|
|
197
|
+
"react-time-picker": "^5.0.0"
|
|
196
198
|
}
|
|
197
199
|
}
|
package/src/TapToEdit.tsx
CHANGED
|
@@ -26,7 +26,7 @@ export const TapToEdit = (props: TapToEditProps): ReactElement => {
|
|
|
26
26
|
const {title, editable = true, rowBoxProps, transform, fieldComponent, ...fieldProps} = props;
|
|
27
27
|
if (editing) {
|
|
28
28
|
return (
|
|
29
|
-
<Box direction="column"
|
|
29
|
+
<Box direction="column">
|
|
30
30
|
{fieldComponent ? (
|
|
31
31
|
fieldComponent(setValue as any)
|
|
32
32
|
) : (
|
|
@@ -64,10 +64,10 @@ export const TapToEdit = (props: TapToEditProps): ReactElement => {
|
|
|
64
64
|
</Box>
|
|
65
65
|
);
|
|
66
66
|
} else {
|
|
67
|
-
let displayValue =
|
|
68
|
-
// If transform is present, that takes priority
|
|
67
|
+
let displayValue = props.initialValue;
|
|
68
|
+
// If a transform props is present, that takes priority
|
|
69
69
|
if (transform) {
|
|
70
|
-
displayValue = transform(
|
|
70
|
+
displayValue = transform(props.initialValue);
|
|
71
71
|
} else {
|
|
72
72
|
// If no transform, try and display the value reasonably.
|
|
73
73
|
if (fieldProps?.type === "boolean") {
|
|
@@ -93,7 +93,6 @@ export const TapToEdit = (props: TapToEditProps): ReactElement => {
|
|
|
93
93
|
<Box
|
|
94
94
|
direction="row"
|
|
95
95
|
justifyContent="between"
|
|
96
|
-
maxWidth="100%"
|
|
97
96
|
paddingX={3}
|
|
98
97
|
paddingY={2}
|
|
99
98
|
width="100%"
|
|
@@ -102,8 +101,8 @@ export const TapToEdit = (props: TapToEditProps): ReactElement => {
|
|
|
102
101
|
<Box>
|
|
103
102
|
<Text weight="bold">{title}:</Text>
|
|
104
103
|
</Box>
|
|
105
|
-
<Box direction="row"
|
|
106
|
-
<Box
|
|
104
|
+
<Box direction="row">
|
|
105
|
+
<Box>
|
|
107
106
|
<Text overflow="breakWord">{displayValue}</Text>
|
|
108
107
|
</Box>
|
|
109
108
|
{editable && (
|