@marktiderman/genesis-ui-native 2.4.0 → 2.4.1

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.
@@ -3,7 +3,7 @@ import { useGenesisModules } from './chunk-EFXCJ5AN.js';
3
3
  import { useThemeMode, useThemeRoles } from './chunk-Z3AQYVUA.js';
4
4
  import { cn } from './chunk-OHZD7KRO.js';
5
5
  import { __require } from './chunk-DGUM43GV.js';
6
- import { View, Text, Platform, AccessibilityInfo, Animated, Pressable, ScrollView, Modal, StatusBar, Dimensions, TextInput, PanResponder, Image } from 'react-native';
6
+ import { View, Text, Platform, AccessibilityInfo, Animated, Pressable, ScrollView, Dimensions, Modal, KeyboardAvoidingView, StatusBar, TextInput, PanResponder, Image } from 'react-native';
7
7
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
8
  import { createContext, useState, useEffect, useCallback, useMemo, useRef, useContext, Children, cloneElement, isValidElement } from 'react';
9
9
  import { SafeAreaProvider, useSafeAreaInsets, SafeAreaInsetsContext } from 'react-native-safe-area-context';
@@ -380,6 +380,7 @@ function LibrarySheet({
380
380
  snapPoints = ["50%", "90%"],
381
381
  initialSnapIndex = 0,
382
382
  disableBackdropDismiss = false,
383
+ fitContent = false,
383
384
  testID,
384
385
  children
385
386
  }) {
@@ -417,9 +418,10 @@ function LibrarySheet({
417
418
  BottomSheetModal,
418
419
  {
419
420
  ref: sheet,
420
- snapPoints,
421
- index: initialSnapIndex,
422
- enableDynamicSizing: false,
421
+ snapPoints: fitContent ? void 0 : snapPoints,
422
+ index: fitContent ? 0 : initialSnapIndex,
423
+ enableDynamicSizing: fitContent,
424
+ ...fitContent ? { maxDynamicContentSize: Math.round(Dimensions.get("window").height * 0.9) } : {},
423
425
  onDismiss,
424
426
  enablePanDownToClose: !disableBackdropDismiss,
425
427
  backdropComponent: backdrop,
@@ -443,7 +445,7 @@ function useReduceMotionAnswer() {
443
445
  }, []);
444
446
  return reduced;
445
447
  }
446
- function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID, children }) {
448
+ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, fitContent = false, testID, children }) {
447
449
  const reducedMotion = useReduceMotionAnswer();
448
450
  const roles = useThemeRoles();
449
451
  const requestClose = () => {
@@ -452,7 +454,8 @@ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID
452
454
  const visible = open && reducedMotion !== null;
453
455
  const animationType = reducedMotion ? "none" : "slide";
454
456
  const id = testID ?? "native-sheet";
455
- if (Platform.OS === "ios") {
457
+ const ios = Platform.OS === "ios";
458
+ if (ios && !fitContent) {
456
459
  return /* @__PURE__ */ jsx(
457
460
  Modal,
458
461
  {
@@ -483,7 +486,7 @@ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID
483
486
  statusBarTranslucent: true,
484
487
  navigationBarTranslucent: true,
485
488
  onRequestClose: requestClose,
486
- children: /* @__PURE__ */ jsx(SafeAreaProvider, { children: /* @__PURE__ */ jsxs(View, { style: { flex: 1, justifyContent: "flex-end" }, children: [
489
+ children: /* @__PURE__ */ jsx(SafeAreaProvider, { children: /* @__PURE__ */ jsxs(KeyboardPanel, { ios, children: [
487
490
  /* @__PURE__ */ jsx(
488
491
  Pressable,
489
492
  {
@@ -500,6 +503,7 @@ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID
500
503
  SheetBody,
501
504
  {
502
505
  testID: id,
506
+ onAccessibilityEscape: disableBackdropDismiss ? void 0 : requestClose,
503
507
  style: {
504
508
  maxHeight: "90%",
505
509
  borderTopLeftRadius: 28,
@@ -522,6 +526,10 @@ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, testID
522
526
  }
523
527
  );
524
528
  }
529
+ function KeyboardPanel({ ios, children }) {
530
+ const insets = useSafeAreaInsets();
531
+ return /* @__PURE__ */ jsx(KeyboardAvoidingView, { behavior: ios ? "padding" : void 0, keyboardVerticalOffset: ios ? -insets.bottom : 0, style: { flex: 1, justifyContent: "flex-end" }, children });
532
+ }
525
533
  function SheetBody({
526
534
  testID,
527
535
  style,
@@ -2633,5 +2641,5 @@ function NativeImage({
2633
2641
  }
2634
2642
 
2635
2643
  export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeSearchBar, NativeSegmentedControl, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTimePicker, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast };
2636
- //# sourceMappingURL=chunk-7VSW3XWJ.js.map
2637
- //# sourceMappingURL=chunk-7VSW3XWJ.js.map
2644
+ //# sourceMappingURL=chunk-RARJGZA3.js.map
2645
+ //# sourceMappingURL=chunk-RARJGZA3.js.map