mg-library 1.0.717 → 1.0.719

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.
Files changed (2) hide show
  1. package/components.js +34 -41
  2. package/package.json +1 -1
package/components.js CHANGED
@@ -106,7 +106,7 @@ export function MGButton({
106
106
  }).start();
107
107
  const effectiveDisabled = !!(isDisabled || disabled || isLoading);
108
108
  const isSolid = variant === "solid" || variant === "filled";
109
- const isGhost = variant === "ghost";
109
+ const isGhost = variant === "ghost";
110
110
  const gsVariant = variant === "ghost" ? "link" : variant;
111
111
  const textColor = isSolid ? "$white" : `$${action}700`;
112
112
  if (iconColor === undefined) iconColor = textColor;
@@ -170,61 +170,54 @@ export function MGButton({
170
170
  export function MGPopover(props) {
171
171
  const [visible, setVisible] = useState(false);
172
172
  const footer = (
173
- <View style={{ flexGrow: 1, flexDirection: 'row', justifyContent: 'space-around', marginTop: 20, marginBottom: 20 }}>
173
+ <Box flexDirection="row" justifyContent="space-around" mt="$5" mb="$5">
174
174
  <MGButton
175
- title={mgFunctionsLib.i18nString('yes', props.language)}
175
+ title={mgFunctionsLib.i18nString("yes", props.language)}
176
176
  action="primary"
177
177
  variant="solid"
178
178
  py="$4"
179
- style={{ flexGrow: 0.3 }}
180
179
  onPress={() => {
181
180
  setVisible(false);
182
- props.callback();
181
+ props.callback?.();
183
182
  }}
184
183
  />
185
184
  <MGButton
186
- title={mgFunctionsLib.i18nString('no', props.language)}
185
+ title={mgFunctionsLib.i18nString("no", props.language)}
187
186
  action="primary"
188
187
  variant="solid"
189
188
  py="$4"
190
- style={{ flexGrow: 0.3 }}
191
189
  onPress={() => setVisible(false)}
192
190
  />
193
- </View>
191
+ </Box>
192
+ );
193
+ return (
194
+ <Popover isOpen={visible} onOpenChange={setVisible}>
195
+ <PopoverTrigger>
196
+ {(triggerProps) => (
197
+ <Button {...triggerProps} action="primary" variant="solid" py="$4">
198
+ {props.icon ? (
199
+ <Icon as={MaterialCommunityIcons} name={props.icon} mr="$2" color="$white" />
200
+ ) : null}
201
+ <ButtonText>{props.title}</ButtonText>
202
+ </Button>
203
+ )}
204
+ </PopoverTrigger>
205
+ <PopoverBackdrop />
206
+ <PopoverContent w={300} bg="$white">
207
+ <PopoverArrow />
208
+ <PopoverCloseButton />
209
+ <PopoverBody>
210
+ <Box alignItems="center" justifyContent="center">
211
+ <Icon as={MaterialCommunityIcons} name="alert-outline" size={16} color="$primary500" mb="$3" />
212
+ <MGText textAlign="center">
213
+ {mgFunctionsLib.i18nString("confirm", props.language)}?
214
+ </MGText>
215
+ </Box>
216
+ </PopoverBody>
217
+ <PopoverFooter>{footer}</PopoverFooter>
218
+ </PopoverContent>
219
+ </Popover>
194
220
  );
195
- <Popover isOpen={visible} onClose={() => setVisible(false)}>
196
- <PopoverTrigger>
197
- <MGButton
198
- icon={props.icon}
199
- title={props.title}
200
- action="primary"
201
- variant="solid"
202
- py="$4"
203
- onPress={() => setVisible(true)}
204
- />
205
- </PopoverTrigger>
206
- <PopoverContent w={300} bg="$white">
207
- <PopoverArrow />
208
- <PopoverCloseButton />
209
- <PopoverBody>
210
- <Box alignItems="center" justifyContent="center">
211
- <Icon
212
- as={MaterialCommunityIcons}
213
- name="alert-outline"
214
- size={16}
215
- color="$primary500"
216
- mb="$3"
217
- />
218
- <MGText textAlign="center">
219
- {mgFunctionsLib.i18nString('confirm', props.language)}?
220
- </MGText>
221
- </Box>
222
- </PopoverBody>
223
- <PopoverFooter>
224
- {footer}
225
- </PopoverFooter>
226
- </PopoverContent>
227
- </Popover>
228
221
  }
229
222
 
230
223
  export function MGDivider({ style, ...props }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.717",
3
+ "version": "1.0.719",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "react-native": "index.js",