@butternutbox/pawprint-native 0.17.0 → 0.19.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.
- package/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +25 -0
- package/dist/index.cjs +141 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +141 -84
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/Drawer/Drawer.tsx +84 -4
- package/src/components/molecules/Drawer/DrawerBody.tsx +27 -24
- package/src/components/molecules/Drawer/DrawerBodyMaxContext.ts +21 -0
- package/src/components/molecules/Drawer/DrawerContent.tsx +98 -92
- package/src/components/molecules/Drawer/DrawerContext.ts +9 -0
- package/src/components/molecules/Drawer/DrawerFooter.tsx +17 -3
- package/src/components/molecules/Drawer/DrawerHeader.tsx +25 -3
- package/src/components/molecules/Drawer/DrawerMeasureContext.ts +9 -6
- package/src/components/molecules/Drawer/DrawerOverlay.tsx +4 -1
- package/src/components/molecules/Drawer/DrawerOverlayContext.ts +21 -0
- package/src/components/molecules/Drawer/index.ts +2 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
[34mCJS[39m Build start
|
|
8
8
|
[34mESM[39m Build start
|
|
9
9
|
[34mDTS[39m Build start
|
|
10
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
11
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m1.
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
14
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m1.
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
10
|
+
[32mESM[39m [1mdist/index.js [22m[32m512.83 KB[39m
|
|
11
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m1.05 MB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 7603ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m542.73 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m1.05 MB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 7608ms
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 21751ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m100.86 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m100.86 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @butternutbox/pawprint-native
|
|
2
2
|
|
|
3
|
+
## 0.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dc0abdf: Drawer: apply the bottom safe-area inset to a footer-less body
|
|
8
|
+
|
|
9
|
+
When a `Drawer` has no `Drawer.Footer`, the body is the last element in the
|
|
10
|
+
panel, so it must clear the bottom safe area (iOS home indicator / Android
|
|
11
|
+
navigation bar) itself — as `Drawer.Footer` already does when present.
|
|
12
|
+
`DrawerBody` now sets its bottom padding to `max(spacing.2xl, insets.bottom)`
|
|
13
|
+
in the no-footer case, so short insets keep the usual spacing while a taller
|
|
14
|
+
inset (e.g. the Android nav bar) is no longer clipped. Footered drawers are
|
|
15
|
+
unchanged.
|
|
16
|
+
|
|
17
|
+
## 0.18.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- 322e972: Drawer: robust self-sizing, backdrop toggle, and an app-overlay slot
|
|
22
|
+
- **Self-sizing panel (fix):** the panel now wraps its content naturally (capped at 90% of the window) and the body `ScrollView` self-sizes to its content up to a chrome-aware `maxHeight` (`90%·window − measured header/footer`). This replaces the previous explicit-panel-height + content-measurement feedback loop, fixing the clipped footer/action button on tall content and the leftover gap above the footer when content shrinks.
|
|
23
|
+
- **`backdrop` prop (new):** `Drawer.Root` accepts `backdrop` (default `true`). Set `backdrop={false}` for a backdrop-less, pass-through drawer — it renders inline (no native `Modal`), omits the overlay, and lets touches outside the panel reach the content behind it (e.g. a calendar stays interactive while the sheet is open).
|
|
24
|
+
- **`Drawer.OverlayProvider` (new):** provides an app-level component rendered on top of every modal drawer, inside the drawer's native `Modal`, so app-root overlays (e.g. toast notifications) surface above the drawer instead of behind its OS window. Opt-in (defaults to nothing rendered).
|
|
25
|
+
|
|
26
|
+
All changes are backward compatible — existing drawers need no changes.
|
|
27
|
+
|
|
3
28
|
## 0.17.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -5638,6 +5638,7 @@ Animated5.displayName = "Animated";
|
|
|
5638
5638
|
var DrawerContext = React66__default.default.createContext({
|
|
5639
5639
|
isOpen: false,
|
|
5640
5640
|
modalVisible: false,
|
|
5641
|
+
backdrop: true,
|
|
5641
5642
|
openDrawer: () => {
|
|
5642
5643
|
},
|
|
5643
5644
|
closeDrawer: () => {
|
|
@@ -5646,10 +5647,12 @@ var DrawerContext = React66__default.default.createContext({
|
|
|
5646
5647
|
}
|
|
5647
5648
|
});
|
|
5648
5649
|
var useDrawerContext = () => React66__default.default.useContext(DrawerContext);
|
|
5650
|
+
var DrawerOverlayContext = React66.createContext(null);
|
|
5651
|
+
var useDrawerOverlay = () => React66.useContext(DrawerOverlayContext);
|
|
5649
5652
|
var FADE_DURATION = 220;
|
|
5650
5653
|
var DrawerOverlay = React66__default.default.forwardRef(({ accessible = false }, _ref) => {
|
|
5651
5654
|
const theme2 = react.useTheme();
|
|
5652
|
-
const { isOpen, closeDrawer } = useDrawerContext();
|
|
5655
|
+
const { isOpen, closeDrawer, backdrop } = useDrawerContext();
|
|
5653
5656
|
const opacity = React66.useRef(new reactNative.Animated.Value(0)).current;
|
|
5654
5657
|
React66.useEffect(() => {
|
|
5655
5658
|
reactNative.Animated.timing(opacity, {
|
|
@@ -5658,6 +5661,7 @@ var DrawerOverlay = React66__default.default.forwardRef(({ accessible = false },
|
|
|
5658
5661
|
useNativeDriver: true
|
|
5659
5662
|
}).start();
|
|
5660
5663
|
}, [isOpen, opacity]);
|
|
5664
|
+
if (!backdrop) return null;
|
|
5661
5665
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5662
5666
|
reactNative.Pressable,
|
|
5663
5667
|
{
|
|
@@ -5685,6 +5689,8 @@ var DrawerDragContext = React66__default.default.createContext(null);
|
|
|
5685
5689
|
var useDrawerDragContext = () => React66__default.default.useContext(DrawerDragContext);
|
|
5686
5690
|
var DrawerMeasureContext = React66.createContext(null);
|
|
5687
5691
|
var useDrawerMeasureContext = () => React66.useContext(DrawerMeasureContext);
|
|
5692
|
+
var DrawerBodyMaxContext = React66.createContext(null);
|
|
5693
|
+
var useDrawerBodyMax = () => React66.useContext(DrawerBodyMaxContext);
|
|
5688
5694
|
var DrawerFooterContext = React66__default.default.createContext(false);
|
|
5689
5695
|
var useDrawerFooterContext = () => React66__default.default.useContext(DrawerFooterContext);
|
|
5690
5696
|
var DrawerHeaderContext = React66__default.default.createContext(null);
|
|
@@ -5698,17 +5704,17 @@ var StyledPanel2 = styled51__default.default(reactNative.View)(
|
|
|
5698
5704
|
panelBorderRadius,
|
|
5699
5705
|
panelBgColor,
|
|
5700
5706
|
panelMaxWidth,
|
|
5707
|
+
panelMaxHeight,
|
|
5701
5708
|
panelBorderWidth,
|
|
5702
5709
|
panelBorderColor,
|
|
5703
5710
|
panelShadowColor,
|
|
5704
5711
|
panelShadowOffsetY,
|
|
5705
|
-
panelShadowBlur
|
|
5706
|
-
|
|
5707
|
-
}) => __spreadProps(__spreadValues({
|
|
5712
|
+
panelShadowBlur
|
|
5713
|
+
}) => ({
|
|
5708
5714
|
width: "100%",
|
|
5709
5715
|
maxWidth: panelMaxWidth,
|
|
5710
|
-
|
|
5711
|
-
|
|
5716
|
+
maxHeight: panelMaxHeight,
|
|
5717
|
+
alignSelf: "center",
|
|
5712
5718
|
borderTopLeftRadius: panelBorderRadius,
|
|
5713
5719
|
borderTopRightRadius: panelBorderRadius,
|
|
5714
5720
|
borderTopWidth: panelBorderWidth,
|
|
@@ -5734,7 +5740,8 @@ var DrawerContent = React66__default.default.forwardRef(
|
|
|
5734
5740
|
const { isOpen, closeDrawer, onExitComplete } = useDrawerContext();
|
|
5735
5741
|
const { height: windowHeight } = reactNative.useWindowDimensions();
|
|
5736
5742
|
const maxHeight = windowHeight * 0.9;
|
|
5737
|
-
const
|
|
5743
|
+
const topBorder = parseTokenValue23(dimensions3.borderWidth.sm);
|
|
5744
|
+
const noFooterBodyPadding = parseTokenValue23(dimensions3.spacing["2xl"]);
|
|
5738
5745
|
const closeDrawerRef = React66.useRef(closeDrawer);
|
|
5739
5746
|
React66.useEffect(() => {
|
|
5740
5747
|
closeDrawerRef.current = closeDrawer;
|
|
@@ -5745,10 +5752,12 @@ var DrawerContent = React66__default.default.forwardRef(
|
|
|
5745
5752
|
const entryRanRef = React66.useRef(false);
|
|
5746
5753
|
const isOpenRef = React66.useRef(isOpen);
|
|
5747
5754
|
const activeAnim = React66.useRef(null);
|
|
5748
|
-
const [
|
|
5749
|
-
const
|
|
5750
|
-
const
|
|
5751
|
-
const
|
|
5755
|
+
const [bodyMax, setBodyMax] = React66.useState(null);
|
|
5756
|
+
const bodyMaxRef = React66.useRef(null);
|
|
5757
|
+
const headerHeightRef = React66.useRef(0);
|
|
5758
|
+
const footerHeightRef = React66.useRef(0);
|
|
5759
|
+
const hasHeaderRef = React66.useRef(false);
|
|
5760
|
+
const hasFooterRef = React66.useRef(false);
|
|
5752
5761
|
React66.useEffect(() => {
|
|
5753
5762
|
const id = translateY.addListener(({ value }) => {
|
|
5754
5763
|
translateYValue.current = value;
|
|
@@ -5756,8 +5765,7 @@ var DrawerContent = React66__default.default.forwardRef(
|
|
|
5756
5765
|
return () => translateY.removeListener(id);
|
|
5757
5766
|
}, [translateY]);
|
|
5758
5767
|
React66.useEffect(() => {
|
|
5759
|
-
if (panelHeightRef.current >
|
|
5760
|
-
setPanelHeight(maxHeight);
|
|
5768
|
+
if (panelHeightRef.current > maxHeight) {
|
|
5761
5769
|
panelHeightRef.current = maxHeight;
|
|
5762
5770
|
}
|
|
5763
5771
|
}, [maxHeight]);
|
|
@@ -5807,59 +5815,56 @@ var DrawerContent = React66__default.default.forwardRef(
|
|
|
5807
5815
|
runExit();
|
|
5808
5816
|
}
|
|
5809
5817
|
}, [isOpen, runEntry, runExit]);
|
|
5810
|
-
const
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
const
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5818
|
+
const measureChrome = React66.useCallback(() => {
|
|
5819
|
+
if (hasHeaderRef.current && headerHeightRef.current <= 0) return 0;
|
|
5820
|
+
if (hasFooterRef.current && footerHeightRef.current <= 0) return 0;
|
|
5821
|
+
const header = hasHeaderRef.current ? headerHeightRef.current : 0;
|
|
5822
|
+
const footer = hasFooterRef.current ? footerHeightRef.current : 0;
|
|
5823
|
+
const bodyBottomPad = hasFooterRef.current ? 0 : noFooterBodyPadding;
|
|
5824
|
+
return header + footer + topBorder + bodyBottomPad;
|
|
5825
|
+
}, [noFooterBodyPadding, topBorder]);
|
|
5826
|
+
const applyBodyMax = React66.useCallback(() => {
|
|
5827
|
+
var _a3;
|
|
5828
|
+
const chrome = measureChrome();
|
|
5829
|
+
if (chrome <= 0) return;
|
|
5830
|
+
const availableBody = Math.max(0, maxHeight - chrome);
|
|
5831
|
+
if (Math.abs(availableBody - ((_a3 = bodyMaxRef.current) != null ? _a3 : -1)) > 1) {
|
|
5832
|
+
bodyMaxRef.current = availableBody;
|
|
5833
|
+
setBodyMax(availableBody);
|
|
5821
5834
|
}
|
|
5822
|
-
}, [
|
|
5823
|
-
const
|
|
5824
|
-
if (chromeRef.current > 0) return;
|
|
5825
|
-
const natural = firstNaturalRef.current;
|
|
5826
|
-
const content = bodyContentRef.current;
|
|
5827
|
-
if (natural <= 0 || content <= 0) return;
|
|
5828
|
-
chromeRef.current = natural - Math.min(content, bodyMaxHeight);
|
|
5829
|
-
}, [bodyMaxHeight]);
|
|
5830
|
-
const setBodyContentHeight = React66.useCallback(
|
|
5835
|
+
}, [measureChrome, maxHeight]);
|
|
5836
|
+
const setHeaderHeight = React66.useCallback(
|
|
5831
5837
|
(height) => {
|
|
5832
|
-
if (height <= 0)
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5838
|
+
if (height <= 0 || Math.abs(height - headerHeightRef.current) < 1)
|
|
5839
|
+
return;
|
|
5840
|
+
headerHeightRef.current = height;
|
|
5841
|
+
applyBodyMax();
|
|
5836
5842
|
},
|
|
5837
|
-
[
|
|
5843
|
+
[applyBodyMax]
|
|
5844
|
+
);
|
|
5845
|
+
const setFooterHeight = React66.useCallback(
|
|
5846
|
+
(height) => {
|
|
5847
|
+
if (height <= 0 || Math.abs(height - footerHeightRef.current) < 1)
|
|
5848
|
+
return;
|
|
5849
|
+
footerHeightRef.current = height;
|
|
5850
|
+
applyBodyMax();
|
|
5851
|
+
},
|
|
5852
|
+
[applyBodyMax]
|
|
5838
5853
|
);
|
|
5839
5854
|
const measureContextValue = React66.useMemo(
|
|
5840
|
-
() => ({
|
|
5841
|
-
[
|
|
5855
|
+
() => ({ setHeaderHeight, setFooterHeight }),
|
|
5856
|
+
[setHeaderHeight, setFooterHeight]
|
|
5842
5857
|
);
|
|
5843
5858
|
const onLayout = React66.useCallback(
|
|
5844
5859
|
({ nativeEvent }) => {
|
|
5845
|
-
const
|
|
5846
|
-
const capped = Math.min(h, maxHeight);
|
|
5860
|
+
const capped = Math.min(nativeEvent.layout.height, maxHeight);
|
|
5847
5861
|
if (capped <= 0) return;
|
|
5848
|
-
|
|
5849
|
-
if (
|
|
5850
|
-
firstNaturalRef.current = h;
|
|
5851
|
-
lockChrome();
|
|
5852
|
-
}
|
|
5853
|
-
if (capped !== panelHeightRef.current) {
|
|
5854
|
-
panelHeightRef.current = capped;
|
|
5855
|
-
setPanelHeight(capped);
|
|
5856
|
-
}
|
|
5857
|
-
if (isOpenRef.current) {
|
|
5862
|
+
panelHeightRef.current = capped;
|
|
5863
|
+
if (!entryRanRef.current && isOpenRef.current) {
|
|
5858
5864
|
runEntry();
|
|
5859
5865
|
}
|
|
5860
|
-
applyRefit();
|
|
5861
5866
|
},
|
|
5862
|
-
[runEntry, maxHeight
|
|
5867
|
+
[runEntry, maxHeight]
|
|
5863
5868
|
);
|
|
5864
5869
|
const panResponder = React66.useRef(
|
|
5865
5870
|
reactNative.PanResponder.create({
|
|
@@ -5925,6 +5930,8 @@ var DrawerContent = React66__default.default.forwardRef(
|
|
|
5925
5930
|
const headerChild = React66__default.default.Children.toArray(children).find(
|
|
5926
5931
|
(child) => React66__default.default.isValidElement(child) && child.type.displayName === "Drawer.Header"
|
|
5927
5932
|
);
|
|
5933
|
+
hasHeaderRef.current = headerChild != null;
|
|
5934
|
+
hasFooterRef.current = hasFooter;
|
|
5928
5935
|
const headerContextValue = headerChild != null ? {
|
|
5929
5936
|
variant: (_a2 = headerChild.props.variant) != null ? _a2 : "titleAndText"
|
|
5930
5937
|
} : null;
|
|
@@ -5933,7 +5940,6 @@ var DrawerContent = React66__default.default.forwardRef(
|
|
|
5933
5940
|
{
|
|
5934
5941
|
style: [
|
|
5935
5942
|
styles.animatedWrapper,
|
|
5936
|
-
panelHeight > 0 ? { height: panelHeight } : void 0,
|
|
5937
5943
|
{ transform: [{ translateY }] }
|
|
5938
5944
|
],
|
|
5939
5945
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5944,7 +5950,7 @@ var DrawerContent = React66__default.default.forwardRef(
|
|
|
5944
5950
|
panelBorderRadius: parseTokenValue23(drawer.borderRadius.top),
|
|
5945
5951
|
panelBgColor: colour.background.container.default,
|
|
5946
5952
|
panelMaxWidth: parseTokenValue23(drawer.size.maxWidth),
|
|
5947
|
-
|
|
5953
|
+
panelMaxHeight: maxHeight,
|
|
5948
5954
|
panelBorderWidth: parseTokenValue23(dimensions3.borderWidth.sm),
|
|
5949
5955
|
panelBorderColor: colour.border.default,
|
|
5950
5956
|
panelShadowColor: modal.shadow.color,
|
|
@@ -5954,7 +5960,7 @@ var DrawerContent = React66__default.default.forwardRef(
|
|
|
5954
5960
|
accessibilityRole: "none",
|
|
5955
5961
|
accessibilityViewIsModal: true
|
|
5956
5962
|
}, props), {
|
|
5957
|
-
children
|
|
5963
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DrawerBodyMaxContext.Provider, { value: bodyMax, children })
|
|
5958
5964
|
})
|
|
5959
5965
|
)
|
|
5960
5966
|
}
|
|
@@ -6138,12 +6144,20 @@ function splitChildren(children) {
|
|
|
6138
6144
|
}
|
|
6139
6145
|
var DrawerHeader = React66__default.default.forwardRef(
|
|
6140
6146
|
(_a, ref) => {
|
|
6141
|
-
var _b = _a, { variant = "titleAndText", imageSource, children } = _b, props = __objRest(_b, ["variant", "imageSource", "children"]);
|
|
6147
|
+
var _b = _a, { variant = "titleAndText", imageSource, children, onLayout } = _b, props = __objRest(_b, ["variant", "imageSource", "children", "onLayout"]);
|
|
6142
6148
|
var _a2, _b2, _c, _d, _e, _f;
|
|
6143
6149
|
const theme2 = react.useTheme();
|
|
6144
6150
|
const { drawer, grabber } = theme2.tokens.components;
|
|
6145
6151
|
const { colour, dimensions: dimensions3 } = theme2.tokens.semantics;
|
|
6146
6152
|
const dragContext = useDrawerDragContext();
|
|
6153
|
+
const measureContext = useDrawerMeasureContext();
|
|
6154
|
+
const handleLayout = React66.useCallback(
|
|
6155
|
+
(event) => {
|
|
6156
|
+
measureContext == null ? void 0 : measureContext.setHeaderHeight(event.nativeEvent.layout.height);
|
|
6157
|
+
onLayout == null ? void 0 : onLayout(event);
|
|
6158
|
+
},
|
|
6159
|
+
[measureContext, onLayout]
|
|
6160
|
+
);
|
|
6147
6161
|
const contextValue = React66.useMemo(() => ({ variant }), [variant]);
|
|
6148
6162
|
const { closeChild, otherChildren } = splitChildren(children);
|
|
6149
6163
|
const headerSpacing = drawer.spacing.drawerHeader[variant === "image" ? "Image" : variant];
|
|
@@ -6195,7 +6209,8 @@ var DrawerHeader = React66__default.default.forwardRef(
|
|
|
6195
6209
|
headerGap: parseTokenValue26(headerSpacing.gap),
|
|
6196
6210
|
headerBorderBottomWidth: variant === "titleAndText" ? parseTokenValue26(dimensions3.borderWidth.sm) : void 0,
|
|
6197
6211
|
headerBorderColor: variant === "titleAndText" ? colour.border.default : void 0,
|
|
6198
|
-
headerBgColor: variant === "fullBleed" ? drawer.drawerHeader.colour.background.fullBleed : void 0
|
|
6212
|
+
headerBgColor: variant === "fullBleed" ? drawer.drawerHeader.colour.background.fullBleed : void 0,
|
|
6213
|
+
onLayout: handleLayout
|
|
6199
6214
|
}, props), {
|
|
6200
6215
|
children: [
|
|
6201
6216
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6260,52 +6275,49 @@ var StyledScrollView = styled51__default.default(reactNative.ScrollView)(
|
|
|
6260
6275
|
({
|
|
6261
6276
|
bodyPaddingHorizontal,
|
|
6262
6277
|
bodyPaddingRight,
|
|
6263
|
-
bodyGap,
|
|
6264
6278
|
bodyMaxHeight,
|
|
6265
6279
|
bodyPaddingBottom
|
|
6266
6280
|
}) => ({
|
|
6267
|
-
flex: 1
|
|
6281
|
+
// No `flex: 1`: the ScrollView self-sizes to its content (up to
|
|
6282
|
+
// `maxHeight`), so the panel wraps tight around short content and scrolls
|
|
6283
|
+
// only when content exceeds the chrome-aware cap.
|
|
6284
|
+
flexGrow: 0,
|
|
6285
|
+
flexShrink: 1,
|
|
6268
6286
|
paddingLeft: bodyPaddingHorizontal,
|
|
6269
6287
|
paddingRight: bodyPaddingRight,
|
|
6270
|
-
gap: bodyGap,
|
|
6271
6288
|
maxHeight: bodyMaxHeight,
|
|
6272
6289
|
paddingBottom: bodyPaddingBottom
|
|
6273
6290
|
})
|
|
6274
6291
|
);
|
|
6275
6292
|
var DrawerBody = React66__default.default.forwardRef(
|
|
6276
6293
|
(_a, ref) => {
|
|
6277
|
-
var _b = _a, { children, contentContainerStyle
|
|
6294
|
+
var _b = _a, { children, contentContainerStyle } = _b, props = __objRest(_b, ["children", "contentContainerStyle"]);
|
|
6278
6295
|
const theme2 = react.useTheme();
|
|
6279
6296
|
const { spacing } = theme2.tokens.components.drawer;
|
|
6280
6297
|
const { buttons } = theme2.tokens.components;
|
|
6281
6298
|
const { content } = spacing;
|
|
6282
6299
|
const headerContext = useDrawerHeaderContext();
|
|
6283
6300
|
const footerContext = useDrawerFooterContext();
|
|
6284
|
-
const
|
|
6301
|
+
const providedMaxHeight = useDrawerBodyMax();
|
|
6285
6302
|
const { height: windowHeight } = reactNative.useWindowDimensions();
|
|
6286
|
-
const
|
|
6287
|
-
(width, height) => {
|
|
6288
|
-
measureContext == null ? void 0 : measureContext.setBodyContentHeight(height);
|
|
6289
|
-
onContentSizeChange == null ? void 0 : onContentSizeChange(width, height);
|
|
6290
|
-
},
|
|
6291
|
-
[measureContext, onContentSizeChange]
|
|
6292
|
-
);
|
|
6303
|
+
const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
6293
6304
|
const gap = parseTokenValue27(content.slot.gap);
|
|
6294
6305
|
const horizontalPadding = parseTokenValue27(content.slot.horizontalPadding);
|
|
6295
6306
|
const topPadding = parseTokenValue27(content.slot.verticalPadding);
|
|
6296
|
-
const bodyMaxHeight = windowHeight - 300;
|
|
6307
|
+
const bodyMaxHeight = providedMaxHeight != null ? providedMaxHeight : windowHeight - 300;
|
|
6297
6308
|
const paddingRight = headerContext === null ? parseTokenValue27(spacing.close.right.md) + parseTokenValue27(buttons.size.sm.height) : horizontalPadding;
|
|
6298
|
-
const bodyPaddingBottom = !footerContext ?
|
|
6309
|
+
const bodyPaddingBottom = !footerContext ? Math.max(
|
|
6310
|
+
parseTokenValue27(theme2.tokens.semantics.dimensions.spacing["2xl"]),
|
|
6311
|
+
insets.bottom
|
|
6312
|
+
) : 0;
|
|
6299
6313
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6300
6314
|
StyledScrollView,
|
|
6301
6315
|
__spreadProps(__spreadValues({
|
|
6302
6316
|
ref,
|
|
6303
6317
|
bodyPaddingHorizontal: horizontalPadding,
|
|
6304
6318
|
bodyPaddingRight: paddingRight,
|
|
6305
|
-
bodyGap: gap,
|
|
6306
6319
|
bodyMaxHeight,
|
|
6307
6320
|
bodyPaddingBottom,
|
|
6308
|
-
onContentSizeChange: handleContentSizeChange,
|
|
6309
6321
|
contentContainerStyle: [
|
|
6310
6322
|
{
|
|
6311
6323
|
gap,
|
|
@@ -6330,10 +6342,18 @@ var StyledFooter = styled51__default.default(reactNative.View)(({ footerPaddingT
|
|
|
6330
6342
|
}));
|
|
6331
6343
|
var DrawerFooter = React66__default.default.forwardRef(
|
|
6332
6344
|
(_a, ref) => {
|
|
6333
|
-
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
6345
|
+
var _b = _a, { children, onLayout } = _b, props = __objRest(_b, ["children", "onLayout"]);
|
|
6334
6346
|
const theme2 = react.useTheme();
|
|
6335
6347
|
const { spacing } = theme2.tokens.components.drawer;
|
|
6336
6348
|
const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
6349
|
+
const measureContext = useDrawerMeasureContext();
|
|
6350
|
+
const handleLayout = React66.useCallback(
|
|
6351
|
+
(event) => {
|
|
6352
|
+
measureContext == null ? void 0 : measureContext.setFooterHeight(event.nativeEvent.layout.height);
|
|
6353
|
+
onLayout == null ? void 0 : onLayout(event);
|
|
6354
|
+
},
|
|
6355
|
+
[measureContext, onLayout]
|
|
6356
|
+
);
|
|
6337
6357
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6338
6358
|
StyledFooter,
|
|
6339
6359
|
__spreadProps(__spreadValues({
|
|
@@ -6342,7 +6362,8 @@ var DrawerFooter = React66__default.default.forwardRef(
|
|
|
6342
6362
|
footerPaddingHorizontal: parseTokenValue28(
|
|
6343
6363
|
spacing.footer.horizontalPadding
|
|
6344
6364
|
),
|
|
6345
|
-
footerPaddingBottom: parseTokenValue28(spacing.bottomPadding) + insets.bottom
|
|
6365
|
+
footerPaddingBottom: parseTokenValue28(spacing.bottomPadding) + insets.bottom,
|
|
6366
|
+
onLayout: handleLayout
|
|
6346
6367
|
}, props), {
|
|
6347
6368
|
children
|
|
6348
6369
|
})
|
|
@@ -6356,12 +6377,18 @@ var DrawerRoot = React66__default.default.forwardRef(
|
|
|
6356
6377
|
open: controlledOpen,
|
|
6357
6378
|
defaultOpen = false,
|
|
6358
6379
|
onOpenChange,
|
|
6359
|
-
|
|
6380
|
+
backdrop = true,
|
|
6381
|
+
children,
|
|
6382
|
+
style,
|
|
6383
|
+
pointerEvents
|
|
6360
6384
|
} = _b, rest = __objRest(_b, [
|
|
6361
6385
|
"open",
|
|
6362
6386
|
"defaultOpen",
|
|
6363
6387
|
"onOpenChange",
|
|
6364
|
-
"
|
|
6388
|
+
"backdrop",
|
|
6389
|
+
"children",
|
|
6390
|
+
"style",
|
|
6391
|
+
"pointerEvents"
|
|
6365
6392
|
]);
|
|
6366
6393
|
const isControlled = React66.useRef(controlledOpen !== void 0);
|
|
6367
6394
|
const [internalOpen, setInternalOpen] = React66.useState(defaultOpen);
|
|
@@ -6384,10 +6411,26 @@ var DrawerRoot = React66__default.default.forwardRef(
|
|
|
6384
6411
|
setModalVisible(false);
|
|
6385
6412
|
}, []);
|
|
6386
6413
|
const ctx = React66.useMemo(
|
|
6387
|
-
() => ({
|
|
6388
|
-
|
|
6414
|
+
() => ({
|
|
6415
|
+
isOpen,
|
|
6416
|
+
modalVisible,
|
|
6417
|
+
backdrop,
|
|
6418
|
+
openDrawer,
|
|
6419
|
+
closeDrawer,
|
|
6420
|
+
onExitComplete
|
|
6421
|
+
}),
|
|
6422
|
+
[isOpen, modalVisible, backdrop, openDrawer, closeDrawer, onExitComplete]
|
|
6389
6423
|
);
|
|
6390
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DrawerContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6424
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DrawerContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6425
|
+
reactNative.View,
|
|
6426
|
+
__spreadProps(__spreadValues({
|
|
6427
|
+
ref,
|
|
6428
|
+
style: backdrop ? style : [reactNative.StyleSheet.absoluteFill, style],
|
|
6429
|
+
pointerEvents: backdrop ? pointerEvents : pointerEvents != null ? pointerEvents : "box-none"
|
|
6430
|
+
}, rest), {
|
|
6431
|
+
children
|
|
6432
|
+
})
|
|
6433
|
+
) });
|
|
6391
6434
|
}
|
|
6392
6435
|
);
|
|
6393
6436
|
DrawerRoot.displayName = "Drawer";
|
|
@@ -6399,8 +6442,15 @@ var DrawerTrigger = React66__default.default.forwardRef(
|
|
|
6399
6442
|
);
|
|
6400
6443
|
DrawerTrigger.displayName = "Drawer.Trigger";
|
|
6401
6444
|
var DrawerPortal = ({ children, topContent }) => {
|
|
6402
|
-
const { modalVisible, closeDrawer } = React66__default.default.useContext(DrawerContext);
|
|
6445
|
+
const { modalVisible, closeDrawer, backdrop } = React66__default.default.useContext(DrawerContext);
|
|
6446
|
+
const OverlayComponent = useDrawerOverlay();
|
|
6403
6447
|
if (!modalVisible) return null;
|
|
6448
|
+
if (!backdrop) {
|
|
6449
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6450
|
+
children,
|
|
6451
|
+
topContent
|
|
6452
|
+
] });
|
|
6453
|
+
}
|
|
6404
6454
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6405
6455
|
reactNative.Modal,
|
|
6406
6456
|
{
|
|
@@ -6411,16 +6461,23 @@ var DrawerPortal = ({ children, topContent }) => {
|
|
|
6411
6461
|
onRequestClose: closeDrawer,
|
|
6412
6462
|
children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.modalContainer, children: [
|
|
6413
6463
|
children,
|
|
6414
|
-
topContent
|
|
6464
|
+
topContent,
|
|
6465
|
+
OverlayComponent ? /* @__PURE__ */ jsxRuntime.jsx(OverlayComponent, {}) : null
|
|
6415
6466
|
] })
|
|
6416
6467
|
}
|
|
6417
6468
|
);
|
|
6418
6469
|
};
|
|
6419
6470
|
DrawerPortal.displayName = "Drawer.Portal";
|
|
6471
|
+
var DrawerOverlayProvider = ({
|
|
6472
|
+
component,
|
|
6473
|
+
children
|
|
6474
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(DrawerOverlayContext.Provider, { value: component, children });
|
|
6475
|
+
DrawerOverlayProvider.displayName = "Drawer.OverlayProvider";
|
|
6420
6476
|
var Drawer = Object.assign(DrawerRoot, {
|
|
6421
6477
|
Root: DrawerRoot,
|
|
6422
6478
|
Trigger: DrawerTrigger,
|
|
6423
6479
|
Portal: DrawerPortal,
|
|
6480
|
+
OverlayProvider: DrawerOverlayProvider,
|
|
6424
6481
|
Overlay: DrawerOverlay,
|
|
6425
6482
|
Content: DrawerContent,
|
|
6426
6483
|
Grabber: DrawerGrabber,
|