ferns-ui 0.28.1 → 0.28.2
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/IconButton.js +5 -7
- package/dist/IconButton.js.map +1 -1
- package/package.json +1 -1
- package/src/IconButton.tsx +6 -8
package/dist/IconButton.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useState } from "react";
|
|
2
|
-
import { Platform, TouchableOpacity
|
|
2
|
+
import { Platform, TouchableOpacity } from "react-native";
|
|
3
3
|
import { iconSizeToNumber, } from "./Common";
|
|
4
4
|
import { Icon } from "./Icon";
|
|
5
5
|
import { Modal } from "./Modal";
|
|
@@ -9,15 +9,13 @@ import { Unifier } from "./Unifier";
|
|
|
9
9
|
// eslint-disable-next-line react/display-name
|
|
10
10
|
export const IconButton = forwardRef(({ prefix, icon, iconColor, onClick, size, bgColor = "transparent", withConfirmation = false, confirmationText = "Are you sure you want to continue?", confirmationHeading = "Confirm", tooltip, }, ref) => {
|
|
11
11
|
const [showConfirmation, setShowConfirmation] = useState(false);
|
|
12
|
-
|
|
12
|
+
const opacity = 1;
|
|
13
13
|
let color;
|
|
14
14
|
if (bgColor === "transparentDarkGray") {
|
|
15
|
-
|
|
16
|
-
color = Unifier.theme.darkGray;
|
|
15
|
+
color = "rgba(0, 0, 0, 0.5)";
|
|
17
16
|
}
|
|
18
17
|
else if (bgColor === "transparent" || !bgColor) {
|
|
19
|
-
|
|
20
|
-
color = Unifier.theme.white;
|
|
18
|
+
color = "rgba(0, 0, 0, 0.0)";
|
|
21
19
|
}
|
|
22
20
|
else {
|
|
23
21
|
color = Unifier.theme[bgColor];
|
|
@@ -32,7 +30,7 @@ export const IconButton = forwardRef(({ prefix, icon, iconColor, onClick, size,
|
|
|
32
30
|
React.createElement(Text, null, confirmationText)));
|
|
33
31
|
};
|
|
34
32
|
function renderIconButton() {
|
|
35
|
-
return (React.createElement(
|
|
33
|
+
return (React.createElement(React.Fragment, null,
|
|
36
34
|
React.createElement(TouchableOpacity, { ref: ref, hitSlop: { top: 10, left: 10, bottom: 10, right: 10 }, style: {
|
|
37
35
|
opacity,
|
|
38
36
|
backgroundColor: color,
|
package/dist/IconButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../src/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../src/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAExD,OAAO,EAML,gBAAgB,GAGjB,MAAM,UAAU,CAAC;AAClB,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;AAqBlC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,MAAM,EACN,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAO,GAAG,aAAa,EACvB,gBAAgB,GAAG,KAAK,EACxB,gBAAgB,GAAG,oCAAoC,EACvD,mBAAmB,GAAG,SAAS,EAC/B,OAAO,GACS,EAClB,GAAG,EACH,EAAE;IACF,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,C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AC,GAAG,GAAG;oBACnC,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,GAAG;oBACpC,OAAO,EAAE,MAAM;oBACf,cAAc,EAAE,QAAQ;oBACxB,UAAU,EAAE,QAAQ;iBACrB,EACD,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;oBACvB,IAAI,gBAAgB,IAAI,CAAC,gBAAgB,EAAE;wBACzC,mBAAmB,CAAC,IAAI,CAAC,CAAC;qBAC3B;yBAAM,IAAI,OAAO,EAAE;wBAClB,OAAO,EAAE,CAAC;qBACX;gBACH,CAAC;gBAED,oBAAC,IAAI,IAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI,CAC1D;YAClB,OAAO,CAAC,gBAAgB,CAAC,IAAI,kBAAkB,EAAE,CACjD,CACJ,CAAC;IACJ,CAAC;IAED,gHAAgH;IAChH,oCAAoC;IACpC,mEAAmE;IACnE,IAAI,OAAO,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACpC,OAAO,CACL,oBAAC,OAAO,IAAC,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAChE,gBAAgB,EAAE,CACX,CACX,CAAC;KACH;SAAM;QACL,OAAO,gBAAgB,EAAE,CAAC;KAC3B;AACH,CAAC,CACF,CAAC"}
|
package/package.json
CHANGED
package/src/IconButton.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, {forwardRef, useState} from "react";
|
|
2
|
-
import {Platform, TouchableOpacity
|
|
2
|
+
import {Platform, TouchableOpacity} from "react-native";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
ButtonColor,
|
|
@@ -55,14 +55,12 @@ export const IconButton = forwardRef(
|
|
|
55
55
|
) => {
|
|
56
56
|
const [showConfirmation, setShowConfirmation] = useState(false);
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
const opacity = 1;
|
|
59
59
|
let color: string;
|
|
60
60
|
if (bgColor === "transparentDarkGray") {
|
|
61
|
-
|
|
62
|
-
color = Unifier.theme.darkGray;
|
|
61
|
+
color = "rgba(0, 0, 0, 0.5)";
|
|
63
62
|
} else if (bgColor === "transparent" || !bgColor) {
|
|
64
|
-
|
|
65
|
-
color = Unifier.theme.white;
|
|
63
|
+
color = "rgba(0, 0, 0, 0.0)";
|
|
66
64
|
} else {
|
|
67
65
|
color = Unifier.theme[bgColor];
|
|
68
66
|
}
|
|
@@ -91,7 +89,7 @@ export const IconButton = forwardRef(
|
|
|
91
89
|
|
|
92
90
|
function renderIconButton(): React.ReactElement {
|
|
93
91
|
return (
|
|
94
|
-
|
|
92
|
+
<>
|
|
95
93
|
<TouchableOpacity
|
|
96
94
|
ref={ref as any}
|
|
97
95
|
hitSlop={{top: 10, left: 10, bottom: 10, right: 10}}
|
|
@@ -121,7 +119,7 @@ export const IconButton = forwardRef(
|
|
|
121
119
|
<Icon color={iconColor} name={icon} prefix={prefix || "fas"} size={size} />
|
|
122
120
|
</TouchableOpacity>
|
|
123
121
|
{Boolean(withConfirmation) && renderConfirmation()}
|
|
124
|
-
|
|
122
|
+
</>
|
|
125
123
|
);
|
|
126
124
|
}
|
|
127
125
|
|