achery-ui 0.15.0 → 0.17.0

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.
@@ -5432,11 +5432,12 @@ var SegmentedControl = ({
5432
5432
  };
5433
5433
  var ScreenNav = ({
5434
5434
  onBack,
5435
- backLabel = "cancel",
5435
+ backLabel = "Back",
5436
5436
  title,
5437
5437
  onAction,
5438
5438
  actionLabel,
5439
- actionDisabled = false
5439
+ actionDisabled = false,
5440
+ compact = false
5440
5441
  }) => {
5441
5442
  const { tokens: tokens$1 } = useTheme();
5442
5443
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5447,7 +5448,7 @@ var ScreenNav = ({
5447
5448
  alignItems: "center",
5448
5449
  justifyContent: "space-between",
5449
5450
  paddingHorizontal: tokens.spacing.sp4,
5450
- paddingTop: 56,
5451
+ paddingTop: compact ? tokens.spacing.sp3 : 56,
5451
5452
  paddingBottom: tokens.spacing.sp3,
5452
5453
  backgroundColor: tokens$1.surface,
5453
5454
  borderBottomWidth: 1,
@@ -5477,7 +5478,13 @@ var ScreenNav = ({
5477
5478
  /* @__PURE__ */ jsxRuntime.jsx(
5478
5479
  reactNative.Text,
5479
5480
  {
5481
+ numberOfLines: 1,
5480
5482
  style: {
5483
+ // Flex + single line so a long title truncates instead of pushing the
5484
+ // trailing action button off-screen.
5485
+ flex: 1,
5486
+ textAlign: "center",
5487
+ marginHorizontal: tokens.spacing.sp3,
5481
5488
  color: tokens$1.fgMute,
5482
5489
  fontSize: 11,
5483
5490
  fontWeight: tokens.fontWeights.semibold.toString(),
@@ -5636,12 +5643,29 @@ var BottomSheet = ({
5636
5643
  showClose = false,
5637
5644
  children,
5638
5645
  maxContentHeight,
5646
+ avoidKeyboard = true,
5639
5647
  style
5640
5648
  }) => {
5641
5649
  const { tokens: tokens$1 } = useTheme();
5642
5650
  const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
5651
+ const { height: windowHeight } = reactNative.useWindowDimensions();
5643
5652
  const slideAnim = react.useRef(new reactNative.Animated.Value(0)).current;
5644
5653
  const scrimAnim = react.useRef(new reactNative.Animated.Value(0)).current;
5654
+ const [keyboardOffset, setKeyboardOffset] = react.useState(0);
5655
+ react.useEffect(() => {
5656
+ if (!avoidKeyboard) return;
5657
+ const showEvt = reactNative.Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
5658
+ const hideEvt = reactNative.Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
5659
+ const show = reactNative.Keyboard.addListener(
5660
+ showEvt,
5661
+ (e) => setKeyboardOffset(Math.max(0, e.endCoordinates.height - insets.bottom))
5662
+ );
5663
+ const hide = reactNative.Keyboard.addListener(hideEvt, () => setKeyboardOffset(0));
5664
+ return () => {
5665
+ show.remove();
5666
+ hide.remove();
5667
+ };
5668
+ }, [avoidKeyboard, insets.bottom]);
5645
5669
  react.useEffect(() => {
5646
5670
  if (open) {
5647
5671
  reactNative.Animated.parallel([
@@ -5719,6 +5743,8 @@ var BottomSheet = ({
5719
5743
  // Clear the home indicator so the last row is never cut off / hard
5720
5744
  // to tap on devices with a bottom safe area.
5721
5745
  paddingBottom: Math.max(insets.bottom, tokens.spacing.sp4),
5746
+ // Lift above the keyboard when a field inside is focused.
5747
+ marginBottom: keyboardOffset,
5722
5748
  transform: [{ translateY }]
5723
5749
  },
5724
5750
  style
@@ -5776,15 +5802,20 @@ var BottomSheet = ({
5776
5802
  ]
5777
5803
  }
5778
5804
  ),
5779
- maxContentHeight != null ? /* @__PURE__ */ jsxRuntime.jsx(
5780
- reactNative.ScrollView,
5781
- {
5782
- style: { maxHeight: maxContentHeight },
5783
- showsVerticalScrollIndicator: false,
5784
- bounces: false,
5785
- children
5786
- }
5787
- ) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { children })
5805
+ (() => {
5806
+ const keyboardCap = keyboardOffset > 0 ? Math.max(160, windowHeight - keyboardOffset - insets.bottom - 140) : void 0;
5807
+ const effectiveMax = maxContentHeight != null && keyboardCap != null ? Math.min(maxContentHeight, keyboardCap) : maxContentHeight ?? keyboardCap;
5808
+ return effectiveMax != null ? /* @__PURE__ */ jsxRuntime.jsx(
5809
+ reactNative.ScrollView,
5810
+ {
5811
+ style: { maxHeight: effectiveMax },
5812
+ showsVerticalScrollIndicator: false,
5813
+ bounces: false,
5814
+ keyboardShouldPersistTaps: "handled",
5815
+ children
5816
+ }
5817
+ ) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { children });
5818
+ })()
5788
5819
  ]
5789
5820
  }
5790
5821
  )