mg-library 1.0.734 → 1.0.736
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 +58 -6
- package/package.json +1 -1
package/components.js
CHANGED
|
@@ -167,7 +167,7 @@ export function MGButton({
|
|
|
167
167
|
);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
export function MGPopover(props) {
|
|
170
|
+
/* export function MGPopover(props) {
|
|
171
171
|
const { title, icon, language, callback } = props;
|
|
172
172
|
const [open, setOpen] = useState(false);
|
|
173
173
|
const handleConfirm = async () => {
|
|
@@ -183,18 +183,70 @@ export function MGPopover(props) {
|
|
|
183
183
|
)}
|
|
184
184
|
>
|
|
185
185
|
<PopoverBackdrop />
|
|
186
|
-
<PopoverContent w={300} bg="$white"
|
|
186
|
+
<PopoverContent w={300} bg="$white" zIndex={9999} elevation={24}>
|
|
187
187
|
<PopoverArrow />
|
|
188
188
|
<PopoverCloseButton />
|
|
189
189
|
<PopoverBody>
|
|
190
190
|
<Box alignItems="center" justifyContent="center">
|
|
191
|
-
<
|
|
191
|
+
<Icon as={MaterialCommunityIcons} name="alert-outline" size={16} color="$primary500" mb="$3" />
|
|
192
|
+
<MGText textAlign="center">
|
|
193
|
+
{mgFunctionsLib.i18nString('confirm', language)}?
|
|
194
|
+
</MGText>
|
|
192
195
|
</Box>
|
|
193
196
|
</PopoverBody>
|
|
194
197
|
<PopoverFooter>
|
|
195
|
-
<
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
+
<Box style={{flex: 1}} flexDirection="row" justifyContent="space-around" mt="$5" mb="$5">
|
|
199
|
+
<Button action="primary" variant="solid" onPress={handleConfirm}>
|
|
200
|
+
<ButtonText>{mgFunctionsLib.i18nString('yes', language)}</ButtonText>
|
|
201
|
+
</Button>
|
|
202
|
+
<Button action="primary" variant="outline" onPress={() => setOpen(false)}>
|
|
203
|
+
<ButtonText>{mgFunctionsLib.i18nString('no', language)}</ButtonText>
|
|
204
|
+
</Button>
|
|
205
|
+
</Box>
|
|
206
|
+
</PopoverFooter>
|
|
207
|
+
</PopoverContent>
|
|
208
|
+
</Popover>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
export function MGPopover(props) {
|
|
214
|
+
const { title, icon, language, callback } = props;
|
|
215
|
+
const [open, setOpen] = useState(false);
|
|
216
|
+
const handleConfirm = async () => {
|
|
217
|
+
try { await callback?.(); } finally { setOpen(false); }
|
|
218
|
+
};
|
|
219
|
+
return (
|
|
220
|
+
<Popover
|
|
221
|
+
isOpen={open}
|
|
222
|
+
onOpenChange={setOpen}
|
|
223
|
+
trigger={(triggerProps) => (
|
|
224
|
+
<Button {...triggerProps} action="primary" variant="solid">
|
|
225
|
+
{icon ? <Icon as={MaterialCommunityIcons} name={icon} mr="$2" color="$white" /> : null}
|
|
226
|
+
<ButtonText>{title}</ButtonText>
|
|
227
|
+
</Button>
|
|
228
|
+
)}
|
|
229
|
+
>
|
|
230
|
+
<PopoverBackdrop />
|
|
231
|
+
<PopoverContent w={300} bg="$white" zIndex={9999} elevation={24}>
|
|
232
|
+
<PopoverArrow />
|
|
233
|
+
<PopoverBody>
|
|
234
|
+
<Box alignItems="center" justifyContent="center">
|
|
235
|
+
<Icon as={MaterialCommunityIcons} name="alert-outline" size={16} color="$primary500" mb="$3" />
|
|
236
|
+
<MGText textAlign="center">
|
|
237
|
+
{mgFunctionsLib.i18nString('confirm', language)}?
|
|
238
|
+
</MGText>
|
|
239
|
+
</Box>
|
|
240
|
+
</PopoverBody>
|
|
241
|
+
<PopoverFooter>
|
|
242
|
+
<Box flex={1} flexDirection="row" justifyContent="space-around" mt="$5" mb="$5">
|
|
243
|
+
<Button action="primary" variant="solid" onPress={handleConfirm}>
|
|
244
|
+
<ButtonText>{mgFunctionsLib.i18nString('yes', language)}</ButtonText>
|
|
245
|
+
</Button>
|
|
246
|
+
<Button action="primary" variant="outline" onPress={() => setOpen(false)}>
|
|
247
|
+
<ButtonText>{mgFunctionsLib.i18nString('no', language)}</ButtonText>
|
|
248
|
+
</Button>
|
|
249
|
+
</Box>
|
|
198
250
|
</PopoverFooter>
|
|
199
251
|
</PopoverContent>
|
|
200
252
|
</Popover>
|