ferns-ui 0.26.3 → 0.27.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/Button.d.ts +6 -2
- package/dist/Button.js +48 -39
- package/dist/Button.js.map +1 -1
- package/package.json +1 -1
- package/src/Button.tsx +89 -71
package/dist/Button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ButtonColor, Color, IconName, IconPrefix } from "./Common";
|
|
2
|
+
import { ButtonColor, Color, IconName, IconPrefix, TooltipDirection } from "./Common";
|
|
3
3
|
export interface ButtonProps {
|
|
4
4
|
children?: React.ReactElement;
|
|
5
5
|
text: string;
|
|
@@ -18,5 +18,9 @@ export interface ButtonProps {
|
|
|
18
18
|
confirmationHeading?: string;
|
|
19
19
|
shape?: "rounded" | "pill";
|
|
20
20
|
testID?: string;
|
|
21
|
+
tooltip?: {
|
|
22
|
+
text: string;
|
|
23
|
+
idealDirection?: TooltipDirection;
|
|
24
|
+
};
|
|
21
25
|
}
|
|
22
|
-
export declare function Button({ disabled, type, loading: propsLoading, children, text, inline, icon, iconPrefix, size, onClick, color, withConfirmation, confirmationText, confirmationHeading, shape, testID, }: ButtonProps): JSX.Element;
|
|
26
|
+
export declare function Button({ disabled, type, loading: propsLoading, children, text, inline, icon, iconPrefix, size, onClick, color, withConfirmation, confirmationText, confirmationHeading, shape, testID, tooltip, }: ButtonProps): JSX.Element;
|
package/dist/Button.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import debounce from "lodash/debounce";
|
|
2
2
|
import React, { useState } from "react";
|
|
3
|
-
import { ActivityIndicator, TouchableOpacity } from "react-native";
|
|
3
|
+
import { ActivityIndicator, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import { Box } from "./Box";
|
|
5
5
|
import { Icon } from "./Icon";
|
|
6
6
|
import { Modal } from "./Modal";
|
|
7
7
|
import { Text } from "./Text";
|
|
8
|
+
import { Tooltip } from "./Tooltip";
|
|
8
9
|
import { Unifier } from "./Unifier";
|
|
9
10
|
const buttonTextColor = {
|
|
10
11
|
blue: "white",
|
|
@@ -25,7 +26,7 @@ const HEIGHTS = {
|
|
|
25
26
|
md: 40,
|
|
26
27
|
lg: 48,
|
|
27
28
|
};
|
|
28
|
-
export function Button({ disabled = false, type = "solid", loading: propsLoading, children, text, inline = false, icon, iconPrefix, size = "md", onClick, color = "gray", withConfirmation = false, confirmationText = "Are you sure you want to continue?", confirmationHeading = "Confirm", shape = "rounded", testID, }) {
|
|
29
|
+
export function Button({ disabled = false, type = "solid", loading: propsLoading, children, text, inline = false, icon, iconPrefix, size = "md", onClick, color = "gray", withConfirmation = false, confirmationText = "Are you sure you want to continue?", confirmationHeading = "Confirm", shape = "rounded", testID, tooltip, }) {
|
|
29
30
|
const [loading, setLoading] = useState(propsLoading);
|
|
30
31
|
const [showConfirmation, setShowConfirmation] = useState(false);
|
|
31
32
|
const getBackgroundColor = (backgroundColor) => {
|
|
@@ -67,45 +68,53 @@ export function Button({ disabled = false, type = "solid", loading: propsLoading
|
|
|
67
68
|
} },
|
|
68
69
|
React.createElement(Text, null, confirmationText)));
|
|
69
70
|
};
|
|
70
|
-
|
|
71
|
-
React.createElement(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
71
|
+
const renderButton = () => {
|
|
72
|
+
return (React.createElement(View, null,
|
|
73
|
+
React.createElement(TouchableOpacity, { disabled: disabled || loading, style: {
|
|
74
|
+
alignSelf: inline === true ? undefined : "stretch",
|
|
75
|
+
height: HEIGHTS[size || "md"],
|
|
76
|
+
backgroundColor: getBackgroundColor(color),
|
|
77
|
+
// width: inline === true ? undefined : "100%",
|
|
78
|
+
flexShrink: inline ? 1 : 0,
|
|
79
|
+
// flexGrow: inline ? 0 : 1,
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
borderRadius: shape === "pill" ? 999 : 5,
|
|
83
|
+
borderColor: getBorderColor(color),
|
|
84
|
+
borderWidth: type === "outline" ? 2 : 0,
|
|
85
|
+
opacity: disabled ? 0.4 : 1,
|
|
86
|
+
flexDirection: "row",
|
|
87
|
+
paddingHorizontal: 8 * 2,
|
|
88
|
+
}, testID: testID, onPress: debounce(async () => {
|
|
89
|
+
Unifier.utils.haptic();
|
|
90
|
+
setLoading(true);
|
|
91
|
+
try {
|
|
92
|
+
if (withConfirmation && !showConfirmation) {
|
|
93
|
+
setShowConfirmation(true);
|
|
94
|
+
}
|
|
95
|
+
else if (onClick) {
|
|
96
|
+
await onClick();
|
|
97
|
+
}
|
|
92
98
|
}
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
catch (e) {
|
|
100
|
+
setLoading(false);
|
|
101
|
+
throw e;
|
|
95
102
|
}
|
|
96
|
-
}
|
|
97
|
-
catch (e) {
|
|
98
103
|
setLoading(false);
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
React.createElement(
|
|
105
|
-
|
|
106
|
-
Boolean(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
}, 500, { leading: true }) },
|
|
105
|
+
icon !== undefined && (React.createElement(Box, { paddingX: 2 },
|
|
106
|
+
React.createElement(Icon, { color: getTextColor(color), name: icon, prefix: iconPrefix || "far", size: size }))),
|
|
107
|
+
Boolean(children) && children,
|
|
108
|
+
Boolean(text) && (React.createElement(Text, { color: getTextColor(color), font: "button", inline: inline, size: size, skipLinking: true, weight: "bold" }, text)),
|
|
109
|
+
Boolean(loading) && (React.createElement(Box, { marginLeft: 2 },
|
|
110
|
+
React.createElement(ActivityIndicator, { color: getTextColor(color), size: "small" })))),
|
|
111
|
+
Boolean(withConfirmation) && renderConfirmation()));
|
|
112
|
+
};
|
|
113
|
+
if (tooltip) {
|
|
114
|
+
return (React.createElement(Tooltip, { idealDirection: tooltip.idealDirection, text: tooltip.text }, renderButton()));
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
return renderButton();
|
|
118
|
+
}
|
|
110
119
|
}
|
|
111
120
|
//# sourceMappingURL=Button.js.map
|
package/dist/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,EAAE,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AACtC,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,EAAE,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AACtC,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAEvE,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AA4BlC,MAAM,eAAe,GAAkD;IACrE,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,UAAU;IACrB,GAAG,EAAE,OAAO;IACZ,WAA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AAC,KAAc,CAAC,EACnC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,UAAU,IAAI,KAAK,EAC3B,IAAI,EAAE,IAAI,GACV,CACE,CACP;gBACA,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ;gBAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,CAChB,oBAAC,IAAI,IACH,KAAK,EAAE,YAAY,CAAC,KAAc,CAAC,EACnC,IAAI,EAAC,QAAQ,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,WAAW,QACX,MAAM,EAAC,MAAM,IAEZ,IAAI,CACA,CACR;gBACA,OAAO,CAAC,OAAO,CAAC,IAAI,CACnB,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;oBAChB,oBAAC,iBAAiB,IAAC,KAAK,EAAE,YAAY,CAAC,KAAc,CAAC,EAAE,IAAI,EAAC,OAAO,GAAG,CACnE,CACP,CACgB;YAClB,OAAO,CAAC,gBAAgB,CAAC,IAAI,kBAAkB,EAAE,CAC7C,CACR,CAAC;IACJ,CAAC,CAAC;IAEF,IAAI,OAAO,EAAE;QACX,OAAO,CACL,oBAAC,OAAO,IAAC,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAChE,YAAY,EAAE,CACP,CACX,CAAC;KACH;SAAM;QACL,OAAO,YAAY,EAAE,CAAC;KACvB;AACH,CAAC"}
|
package/package.json
CHANGED
package/src/Button.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import debounce from "lodash/debounce";
|
|
2
2
|
import React, {useState} from "react";
|
|
3
|
-
import {ActivityIndicator, TouchableOpacity} from "react-native";
|
|
3
|
+
import {ActivityIndicator, TouchableOpacity, View} from "react-native";
|
|
4
4
|
|
|
5
5
|
import {Box} from "./Box";
|
|
6
|
-
import {ButtonColor, Color, IconName, IconPrefix, UnifiedTheme} from "./Common";
|
|
6
|
+
import {ButtonColor, Color, IconName, IconPrefix, TooltipDirection, UnifiedTheme} from "./Common";
|
|
7
7
|
import {Icon} from "./Icon";
|
|
8
8
|
import {Modal} from "./Modal";
|
|
9
9
|
import {Text} from "./Text";
|
|
10
|
+
import {Tooltip} from "./Tooltip";
|
|
10
11
|
import {Unifier} from "./Unifier";
|
|
11
12
|
|
|
12
13
|
export interface ButtonProps {
|
|
@@ -29,6 +30,10 @@ export interface ButtonProps {
|
|
|
29
30
|
confirmationHeading?: string;
|
|
30
31
|
shape?: "rounded" | "pill";
|
|
31
32
|
testID?: string;
|
|
33
|
+
tooltip?: {
|
|
34
|
+
text: string;
|
|
35
|
+
idealDirection?: TooltipDirection;
|
|
36
|
+
};
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
const buttonTextColor: {[buttonColor: string]: "white" | "darkGray"} = {
|
|
@@ -69,6 +74,7 @@ export function Button({
|
|
|
69
74
|
confirmationHeading = "Confirm",
|
|
70
75
|
shape = "rounded",
|
|
71
76
|
testID,
|
|
77
|
+
tooltip,
|
|
72
78
|
}: ButtonProps) {
|
|
73
79
|
const [loading, setLoading] = useState(propsLoading);
|
|
74
80
|
const [showConfirmation, setShowConfirmation] = useState(false);
|
|
@@ -125,77 +131,89 @@ export function Button({
|
|
|
125
131
|
);
|
|
126
132
|
};
|
|
127
133
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
134
|
+
const renderButton = () => {
|
|
135
|
+
return (
|
|
136
|
+
<View>
|
|
137
|
+
<TouchableOpacity
|
|
138
|
+
disabled={disabled || loading}
|
|
139
|
+
style={{
|
|
140
|
+
alignSelf: inline === true ? undefined : "stretch",
|
|
141
|
+
height: HEIGHTS[size || "md"],
|
|
142
|
+
backgroundColor: getBackgroundColor(color),
|
|
143
|
+
// width: inline === true ? undefined : "100%",
|
|
144
|
+
flexShrink: inline ? 1 : 0,
|
|
145
|
+
// flexGrow: inline ? 0 : 1,
|
|
146
|
+
alignItems: "center",
|
|
147
|
+
justifyContent: "center",
|
|
148
|
+
borderRadius: shape === "pill" ? 999 : 5,
|
|
149
|
+
borderColor: getBorderColor(color),
|
|
150
|
+
borderWidth: type === "outline" ? 2 : 0,
|
|
151
|
+
opacity: disabled ? 0.4 : 1,
|
|
152
|
+
flexDirection: "row",
|
|
153
|
+
paddingHorizontal: 8 * 2,
|
|
154
|
+
}}
|
|
155
|
+
testID={testID}
|
|
156
|
+
onPress={debounce(
|
|
157
|
+
async () => {
|
|
158
|
+
Unifier.utils.haptic();
|
|
159
|
+
setLoading(true);
|
|
160
|
+
try {
|
|
161
|
+
if (withConfirmation && !showConfirmation) {
|
|
162
|
+
setShowConfirmation(true);
|
|
163
|
+
} else if (onClick) {
|
|
164
|
+
await onClick();
|
|
165
|
+
}
|
|
166
|
+
} catch (e) {
|
|
167
|
+
setLoading(false);
|
|
168
|
+
throw e;
|
|
158
169
|
}
|
|
159
|
-
} catch (e) {
|
|
160
170
|
setLoading(false);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
},
|
|
172
|
+
500,
|
|
173
|
+
{leading: true}
|
|
174
|
+
)}
|
|
175
|
+
>
|
|
176
|
+
{icon !== undefined && (
|
|
177
|
+
<Box paddingX={2}>
|
|
178
|
+
<Icon
|
|
179
|
+
color={getTextColor(color as Color)}
|
|
180
|
+
name={icon}
|
|
181
|
+
prefix={iconPrefix || "far"}
|
|
182
|
+
size={size}
|
|
183
|
+
/>
|
|
184
|
+
</Box>
|
|
185
|
+
)}
|
|
186
|
+
{Boolean(children) && children}
|
|
187
|
+
{Boolean(text) && (
|
|
188
|
+
<Text
|
|
172
189
|
color={getTextColor(color as Color)}
|
|
173
|
-
|
|
174
|
-
|
|
190
|
+
font="button"
|
|
191
|
+
inline={inline}
|
|
175
192
|
size={size}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
)}
|
|
197
|
-
</
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
193
|
+
skipLinking
|
|
194
|
+
weight="bold"
|
|
195
|
+
>
|
|
196
|
+
{text}
|
|
197
|
+
</Text>
|
|
198
|
+
)}
|
|
199
|
+
{Boolean(loading) && (
|
|
200
|
+
<Box marginLeft={2}>
|
|
201
|
+
<ActivityIndicator color={getTextColor(color as Color)} size="small" />
|
|
202
|
+
</Box>
|
|
203
|
+
)}
|
|
204
|
+
</TouchableOpacity>
|
|
205
|
+
{Boolean(withConfirmation) && renderConfirmation()}
|
|
206
|
+
</View>
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
if (tooltip) {
|
|
211
|
+
return (
|
|
212
|
+
<Tooltip idealDirection={tooltip.idealDirection} text={tooltip.text}>
|
|
213
|
+
{renderButton()}
|
|
214
|
+
</Tooltip>
|
|
215
|
+
);
|
|
216
|
+
} else {
|
|
217
|
+
return renderButton();
|
|
218
|
+
}
|
|
201
219
|
}
|