@onehat/ui 0.3.71 → 0.3.73
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/package.json
CHANGED
|
@@ -4,12 +4,14 @@ import {
|
|
|
4
4
|
Pressable,
|
|
5
5
|
Text,
|
|
6
6
|
} from 'native-base';
|
|
7
|
+
import IconButton from './IconButton.js';
|
|
7
8
|
import UiGlobals from '../../UiGlobals.js';
|
|
8
9
|
|
|
9
10
|
export default function SquareButton(props) {
|
|
10
11
|
const {
|
|
11
12
|
text,
|
|
12
13
|
isActive = false,
|
|
14
|
+
showText = true,
|
|
13
15
|
activeColor,
|
|
14
16
|
invertColorWhenActive = false,
|
|
15
17
|
disableInteractions = false,
|
|
@@ -17,7 +19,9 @@ export default function SquareButton(props) {
|
|
|
17
19
|
...propsToPass
|
|
18
20
|
} = props,
|
|
19
21
|
styles = UiGlobals.styles,
|
|
22
|
+
bg = isActive ? activeColor || '#56a6f8' : '#fff',
|
|
20
23
|
color = invertColorWhenActive && isActive ? '#fff' : '#000';
|
|
24
|
+
|
|
21
25
|
const propsIcon = props._icon || {};
|
|
22
26
|
let icon = props.icon;
|
|
23
27
|
if (!icon) {
|
|
@@ -26,14 +30,6 @@ export default function SquareButton(props) {
|
|
|
26
30
|
if (!text) {
|
|
27
31
|
throw Error('text missing');
|
|
28
32
|
}
|
|
29
|
-
|
|
30
|
-
if (React.isValidElement(icon)) {
|
|
31
|
-
if (!_.isEmpty(propsIcon)) {
|
|
32
|
-
icon = React.cloneElement(icon, {...propsIcon});
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
icon = <Icon as={icon} {...propsIcon} />;
|
|
36
|
-
}
|
|
37
33
|
|
|
38
34
|
const
|
|
39
35
|
hoverProps = {},
|
|
@@ -42,7 +38,29 @@ export default function SquareButton(props) {
|
|
|
42
38
|
hoverProps.bg = styles.ICON_BUTTON_BG_HOVER;
|
|
43
39
|
pressedProps.bg = styles.ICON_BUTTON_BG_PRESSED;
|
|
44
40
|
}
|
|
45
|
-
|
|
41
|
+
|
|
42
|
+
if (!showText) {
|
|
43
|
+
return <IconButton
|
|
44
|
+
icon={icon}
|
|
45
|
+
borderRadius="md"
|
|
46
|
+
p={2}
|
|
47
|
+
_icon={{
|
|
48
|
+
size: '20px',
|
|
49
|
+
color,
|
|
50
|
+
}}
|
|
51
|
+
{...propsToPass}
|
|
52
|
+
bg={bg}
|
|
53
|
+
/>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (React.isValidElement(icon)) {
|
|
57
|
+
if (!_.isEmpty(propsIcon)) {
|
|
58
|
+
icon = React.cloneElement(icon, {...propsIcon});
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
icon = <Icon as={icon} {...propsIcon} />;
|
|
62
|
+
}
|
|
63
|
+
|
|
46
64
|
return <Pressable
|
|
47
65
|
borderRadius="md"
|
|
48
66
|
flexDirection="column"
|
|
@@ -50,7 +68,7 @@ export default function SquareButton(props) {
|
|
|
50
68
|
alignItems="center"
|
|
51
69
|
p={2}
|
|
52
70
|
{...propsToPass}
|
|
53
|
-
bg={
|
|
71
|
+
bg={bg}
|
|
54
72
|
// _hover={hoverProps}
|
|
55
73
|
// _pressed={pressedProps}
|
|
56
74
|
>
|
|
@@ -761,7 +761,7 @@ function Form(props) {
|
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
|
|
764
|
-
return <Column {...sizeProps} onLayout={onLayoutDecorated} ref={formRef}>
|
|
764
|
+
return <Column {...sizeProps} pb={10} onLayout={onLayoutDecorated} ref={formRef}>
|
|
765
765
|
{!!containerWidth && <>
|
|
766
766
|
{editorType === EDITOR_TYPE__INLINE &&
|
|
767
767
|
<ScrollView
|
|
@@ -6,10 +6,27 @@ import {
|
|
|
6
6
|
import TriangleExclamation from '../Icons/TriangleExclamation.js';
|
|
7
7
|
|
|
8
8
|
export default function ErrorMsg(props) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const {
|
|
10
|
+
textMessage = 'Error',
|
|
11
|
+
textColor = 'red.500',
|
|
12
|
+
} = props;
|
|
13
|
+
|
|
14
|
+
return <Modal {...props} _backdrop={{ bg: "#000" }}>
|
|
15
|
+
<Modal.Content>
|
|
16
|
+
<Modal.Body
|
|
17
|
+
borderTopWidth={0}
|
|
18
|
+
bg="#fff"
|
|
19
|
+
p={3}
|
|
20
|
+
justifyContent="center"
|
|
21
|
+
alignItems="center"
|
|
22
|
+
borderRadius={5}
|
|
23
|
+
flexDirection="row"
|
|
24
|
+
>
|
|
25
|
+
<Row justifyContent="center" alignItems="center" my={2} w="100%">
|
|
26
|
+
<Icon as={TriangleExclamation} color="red.500" size="sm" mr={1} />
|
|
27
|
+
<Text color={textColor}>{textMessage}</Text>
|
|
28
|
+
</Row>
|
|
29
|
+
</Modal.Body>
|
|
30
|
+
</Modal.Content>
|
|
31
|
+
</Modal>;
|
|
15
32
|
}
|