mg-library 1.0.736 → 1.0.738
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/components.js +16 -5
- package/package.json +1 -1
package/components.js
CHANGED
|
@@ -213,15 +213,26 @@ export function MGButton({
|
|
|
213
213
|
export function MGPopover(props) {
|
|
214
214
|
const { title, icon, language, callback } = props;
|
|
215
215
|
const [open, setOpen] = useState(false);
|
|
216
|
+
|
|
216
217
|
const handleConfirm = async () => {
|
|
217
218
|
try { await callback?.(); } finally { setOpen(false); }
|
|
218
219
|
};
|
|
220
|
+
|
|
219
221
|
return (
|
|
220
222
|
<Popover
|
|
221
223
|
isOpen={open}
|
|
222
|
-
|
|
224
|
+
onClose={() => setOpen(false)}
|
|
223
225
|
trigger={(triggerProps) => (
|
|
224
|
-
<Button
|
|
226
|
+
<Button
|
|
227
|
+
{...triggerProps}
|
|
228
|
+
action="primary"
|
|
229
|
+
variant="solid"
|
|
230
|
+
h={50}
|
|
231
|
+
onPress={(e) => {
|
|
232
|
+
triggerProps?.onPress?.(e);
|
|
233
|
+
setOpen(true);
|
|
234
|
+
}}
|
|
235
|
+
>
|
|
225
236
|
{icon ? <Icon as={MaterialCommunityIcons} name={icon} mr="$2" color="$white" /> : null}
|
|
226
237
|
<ButtonText>{title}</ButtonText>
|
|
227
238
|
</Button>
|
|
@@ -232,7 +243,7 @@ export function MGPopover(props) {
|
|
|
232
243
|
<PopoverArrow />
|
|
233
244
|
<PopoverBody>
|
|
234
245
|
<Box alignItems="center" justifyContent="center">
|
|
235
|
-
<Icon as={MaterialCommunityIcons} name="alert-outline" size=
|
|
246
|
+
<Icon as={MaterialCommunityIcons} name="alert-outline" size="lg" color="$primary500" mb="$3" />
|
|
236
247
|
<MGText textAlign="center">
|
|
237
248
|
{mgFunctionsLib.i18nString('confirm', language)}?
|
|
238
249
|
</MGText>
|
|
@@ -240,10 +251,10 @@ export function MGPopover(props) {
|
|
|
240
251
|
</PopoverBody>
|
|
241
252
|
<PopoverFooter>
|
|
242
253
|
<Box flex={1} flexDirection="row" justifyContent="space-around" mt="$5" mb="$5">
|
|
243
|
-
<Button action="primary" variant="solid" onPress={handleConfirm}>
|
|
254
|
+
<Button h={50} action="primary" variant="solid" onPress={handleConfirm}>
|
|
244
255
|
<ButtonText>{mgFunctionsLib.i18nString('yes', language)}</ButtonText>
|
|
245
256
|
</Button>
|
|
246
|
-
<Button action="primary" variant="outline" onPress={() => setOpen(false)}>
|
|
257
|
+
<Button h={50} action="primary" variant="outline" onPress={() => setOpen(false)}>
|
|
247
258
|
<ButtonText>{mgFunctionsLib.i18nString('no', language)}</ButtonText>
|
|
248
259
|
</Button>
|
|
249
260
|
</Box>
|