cpk-ui 0.1.10 → 0.1.11
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.
|
@@ -49,7 +49,7 @@ function AlertDialog({ style }, ref) {
|
|
|
49
49
|
setOptions(null);
|
|
50
50
|
},
|
|
51
51
|
}));
|
|
52
|
-
const { backdropOpacity = 0.2, title, body, styles, actions, closeOnTouchOutside = true, } = options ?? {};
|
|
52
|
+
const { backdropOpacity = 0.2, title, body, styles, actions, closeOnTouchOutside = true, showCloseButton = true, } = options ?? {};
|
|
53
53
|
const AlertDialogContent = (_jsx(Container, { style: css `
|
|
54
54
|
background-color: ${themeType === 'light'
|
|
55
55
|
? `rgba(0,0,0,${backdropOpacity})`
|
|
@@ -60,7 +60,7 @@ function AlertDialog({ style }, ref) {
|
|
|
60
60
|
shadowColor: theme.text.basic,
|
|
61
61
|
},
|
|
62
62
|
styles?.container,
|
|
63
|
-
]), children: [_jsxs(TitleRow, { style: styles?.titleContainer, children: [typeof title === 'string' ? (_jsx(Typography.Heading3, { style: styles?.title, children: title })) : (title), _jsx(Button, { onPress: () => setVisible(false), borderRadius: 24, text: _jsx(Icon, { color: theme.text.basic, name: "X", size: 18 }), type: "text" })] }), _jsx(BodyRow, { style: styles?.bodyContainer, children: typeof body === 'string' ? (_jsx(Typography.Body3, { style: styles?.body, children: body })) : (body) }), actions ? (_jsx(ActionRow, { style: styles?.actionContainer, children: actions.map((action, index) => cloneElement(action, {
|
|
63
|
+
]), children: [_jsxs(TitleRow, { style: styles?.titleContainer, children: [typeof title === 'string' ? (_jsx(Typography.Heading3, { style: styles?.title, children: title })) : (title), showCloseButton ? (_jsx(Button, { onPress: () => setVisible(false), borderRadius: 24, text: _jsx(Icon, { color: theme.text.basic, name: "X", size: 18 }), type: "text" })) : null] }), _jsx(BodyRow, { style: styles?.bodyContainer, children: typeof body === 'string' ? (_jsx(Typography.Body3, { style: styles?.body, children: body })) : (body) }), actions ? (_jsx(ActionRow, { style: styles?.actionContainer, children: actions.map((action, index) => cloneElement(action, {
|
|
64
64
|
key: `action-${index}`,
|
|
65
65
|
style: {
|
|
66
66
|
flex: 1,
|
|
@@ -70,6 +70,7 @@ export type AlertDialogOptions = {
|
|
|
70
70
|
backdropOpacity?: number;
|
|
71
71
|
closeOnTouchOutside?: boolean;
|
|
72
72
|
actions?: JSX.Element[];
|
|
73
|
+
showCloseButton?: boolean;
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
export type AlertDialogContext = {
|
|
@@ -105,6 +106,7 @@ function AlertDialog(
|
|
|
105
106
|
styles,
|
|
106
107
|
actions,
|
|
107
108
|
closeOnTouchOutside = true,
|
|
109
|
+
showCloseButton = true,
|
|
108
110
|
} = options ?? {};
|
|
109
111
|
|
|
110
112
|
const AlertDialogContent = (
|
|
@@ -132,12 +134,14 @@ function AlertDialog(
|
|
|
132
134
|
) : (
|
|
133
135
|
title
|
|
134
136
|
)}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
{showCloseButton ? (
|
|
138
|
+
<Button
|
|
139
|
+
onPress={() => setVisible(false)}
|
|
140
|
+
borderRadius={24}
|
|
141
|
+
text={<Icon color={theme.text.basic} name="X" size={18} />}
|
|
142
|
+
type="text"
|
|
143
|
+
/>
|
|
144
|
+
) : null}
|
|
141
145
|
</TitleRow>
|
|
142
146
|
<BodyRow style={styles?.bodyContainer}>
|
|
143
147
|
{typeof body === 'string' ? (
|