@butternutbox/pawprint-native 0.17.0 → 0.18.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 +11 -0
- package/dist/index.cjs +136 -83
- 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 +136 -83
- 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 +16 -23
- 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
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
10
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m542.62 KB[39m
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m1.05 MB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 6588ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m512.75 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m1.05 MB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 6590ms
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 21038ms
|
|
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,16 @@
|
|
|
1
1
|
# @butternutbox/pawprint-native
|
|
2
2
|
|
|
3
|
+
## 0.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 322e972: Drawer: robust self-sizing, backdrop toggle, and an app-overlay slot
|
|
8
|
+
- **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.
|
|
9
|
+
- **`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).
|
|
10
|
+
- **`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).
|
|
11
|
+
|
|
12
|
+
All changes are backward compatible — existing drawers need no changes.
|
|
13
|
+
|
|
3
14
|
## 0.17.0
|
|
4
15
|
|
|
5
16
|
### 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
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5835
|
+
}, [measureChrome, maxHeight]);
|
|
5836
|
+
const setHeaderHeight = React66.useCallback(
|
|
5837
|
+
(height) => {
|
|
5838
|
+
if (height <= 0 || Math.abs(height - headerHeightRef.current) < 1)
|
|
5839
|
+
return;
|
|
5840
|
+
headerHeightRef.current = height;
|
|
5841
|
+
applyBodyMax();
|
|
5842
|
+
},
|
|
5843
|
+
[applyBodyMax]
|
|
5844
|
+
);
|
|
5845
|
+
const setFooterHeight = React66.useCallback(
|
|
5831
5846
|
(height) => {
|
|
5832
|
-
if (height <= 0)
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5847
|
+
if (height <= 0 || Math.abs(height - footerHeightRef.current) < 1)
|
|
5848
|
+
return;
|
|
5849
|
+
footerHeightRef.current = height;
|
|
5850
|
+
applyBodyMax();
|
|
5836
5851
|
},
|
|
5837
|
-
[
|
|
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,40 +6275,35 @@ 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 handleContentSizeChange = React66.useCallback(
|
|
6287
|
-
(width, height) => {
|
|
6288
|
-
measureContext == null ? void 0 : measureContext.setBodyContentHeight(height);
|
|
6289
|
-
onContentSizeChange == null ? void 0 : onContentSizeChange(width, height);
|
|
6290
|
-
},
|
|
6291
|
-
[measureContext, onContentSizeChange]
|
|
6292
|
-
);
|
|
6293
6303
|
const gap = parseTokenValue27(content.slot.gap);
|
|
6294
6304
|
const horizontalPadding = parseTokenValue27(content.slot.horizontalPadding);
|
|
6295
6305
|
const topPadding = parseTokenValue27(content.slot.verticalPadding);
|
|
6296
|
-
const bodyMaxHeight = windowHeight - 300;
|
|
6306
|
+
const bodyMaxHeight = providedMaxHeight != null ? providedMaxHeight : windowHeight - 300;
|
|
6297
6307
|
const paddingRight = headerContext === null ? parseTokenValue27(spacing.close.right.md) + parseTokenValue27(buttons.size.sm.height) : horizontalPadding;
|
|
6298
6308
|
const bodyPaddingBottom = !footerContext ? parseTokenValue27(theme2.tokens.semantics.dimensions.spacing["2xl"]) : 0;
|
|
6299
6309
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6302,10 +6312,8 @@ var DrawerBody = React66__default.default.forwardRef(
|
|
|
6302
6312
|
ref,
|
|
6303
6313
|
bodyPaddingHorizontal: horizontalPadding,
|
|
6304
6314
|
bodyPaddingRight: paddingRight,
|
|
6305
|
-
bodyGap: gap,
|
|
6306
6315
|
bodyMaxHeight,
|
|
6307
6316
|
bodyPaddingBottom,
|
|
6308
|
-
onContentSizeChange: handleContentSizeChange,
|
|
6309
6317
|
contentContainerStyle: [
|
|
6310
6318
|
{
|
|
6311
6319
|
gap,
|
|
@@ -6330,10 +6338,18 @@ var StyledFooter = styled51__default.default(reactNative.View)(({ footerPaddingT
|
|
|
6330
6338
|
}));
|
|
6331
6339
|
var DrawerFooter = React66__default.default.forwardRef(
|
|
6332
6340
|
(_a, ref) => {
|
|
6333
|
-
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
6341
|
+
var _b = _a, { children, onLayout } = _b, props = __objRest(_b, ["children", "onLayout"]);
|
|
6334
6342
|
const theme2 = react.useTheme();
|
|
6335
6343
|
const { spacing } = theme2.tokens.components.drawer;
|
|
6336
6344
|
const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
6345
|
+
const measureContext = useDrawerMeasureContext();
|
|
6346
|
+
const handleLayout = React66.useCallback(
|
|
6347
|
+
(event) => {
|
|
6348
|
+
measureContext == null ? void 0 : measureContext.setFooterHeight(event.nativeEvent.layout.height);
|
|
6349
|
+
onLayout == null ? void 0 : onLayout(event);
|
|
6350
|
+
},
|
|
6351
|
+
[measureContext, onLayout]
|
|
6352
|
+
);
|
|
6337
6353
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6338
6354
|
StyledFooter,
|
|
6339
6355
|
__spreadProps(__spreadValues({
|
|
@@ -6342,7 +6358,8 @@ var DrawerFooter = React66__default.default.forwardRef(
|
|
|
6342
6358
|
footerPaddingHorizontal: parseTokenValue28(
|
|
6343
6359
|
spacing.footer.horizontalPadding
|
|
6344
6360
|
),
|
|
6345
|
-
footerPaddingBottom: parseTokenValue28(spacing.bottomPadding) + insets.bottom
|
|
6361
|
+
footerPaddingBottom: parseTokenValue28(spacing.bottomPadding) + insets.bottom,
|
|
6362
|
+
onLayout: handleLayout
|
|
6346
6363
|
}, props), {
|
|
6347
6364
|
children
|
|
6348
6365
|
})
|
|
@@ -6356,12 +6373,18 @@ var DrawerRoot = React66__default.default.forwardRef(
|
|
|
6356
6373
|
open: controlledOpen,
|
|
6357
6374
|
defaultOpen = false,
|
|
6358
6375
|
onOpenChange,
|
|
6359
|
-
|
|
6376
|
+
backdrop = true,
|
|
6377
|
+
children,
|
|
6378
|
+
style,
|
|
6379
|
+
pointerEvents
|
|
6360
6380
|
} = _b, rest = __objRest(_b, [
|
|
6361
6381
|
"open",
|
|
6362
6382
|
"defaultOpen",
|
|
6363
6383
|
"onOpenChange",
|
|
6364
|
-
"
|
|
6384
|
+
"backdrop",
|
|
6385
|
+
"children",
|
|
6386
|
+
"style",
|
|
6387
|
+
"pointerEvents"
|
|
6365
6388
|
]);
|
|
6366
6389
|
const isControlled = React66.useRef(controlledOpen !== void 0);
|
|
6367
6390
|
const [internalOpen, setInternalOpen] = React66.useState(defaultOpen);
|
|
@@ -6384,10 +6407,26 @@ var DrawerRoot = React66__default.default.forwardRef(
|
|
|
6384
6407
|
setModalVisible(false);
|
|
6385
6408
|
}, []);
|
|
6386
6409
|
const ctx = React66.useMemo(
|
|
6387
|
-
() => ({
|
|
6388
|
-
|
|
6410
|
+
() => ({
|
|
6411
|
+
isOpen,
|
|
6412
|
+
modalVisible,
|
|
6413
|
+
backdrop,
|
|
6414
|
+
openDrawer,
|
|
6415
|
+
closeDrawer,
|
|
6416
|
+
onExitComplete
|
|
6417
|
+
}),
|
|
6418
|
+
[isOpen, modalVisible, backdrop, openDrawer, closeDrawer, onExitComplete]
|
|
6389
6419
|
);
|
|
6390
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DrawerContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6420
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DrawerContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6421
|
+
reactNative.View,
|
|
6422
|
+
__spreadProps(__spreadValues({
|
|
6423
|
+
ref,
|
|
6424
|
+
style: backdrop ? style : [reactNative.StyleSheet.absoluteFill, style],
|
|
6425
|
+
pointerEvents: backdrop ? pointerEvents : pointerEvents != null ? pointerEvents : "box-none"
|
|
6426
|
+
}, rest), {
|
|
6427
|
+
children
|
|
6428
|
+
})
|
|
6429
|
+
) });
|
|
6391
6430
|
}
|
|
6392
6431
|
);
|
|
6393
6432
|
DrawerRoot.displayName = "Drawer";
|
|
@@ -6399,8 +6438,15 @@ var DrawerTrigger = React66__default.default.forwardRef(
|
|
|
6399
6438
|
);
|
|
6400
6439
|
DrawerTrigger.displayName = "Drawer.Trigger";
|
|
6401
6440
|
var DrawerPortal = ({ children, topContent }) => {
|
|
6402
|
-
const { modalVisible, closeDrawer } = React66__default.default.useContext(DrawerContext);
|
|
6441
|
+
const { modalVisible, closeDrawer, backdrop } = React66__default.default.useContext(DrawerContext);
|
|
6442
|
+
const OverlayComponent = useDrawerOverlay();
|
|
6403
6443
|
if (!modalVisible) return null;
|
|
6444
|
+
if (!backdrop) {
|
|
6445
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6446
|
+
children,
|
|
6447
|
+
topContent
|
|
6448
|
+
] });
|
|
6449
|
+
}
|
|
6404
6450
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6405
6451
|
reactNative.Modal,
|
|
6406
6452
|
{
|
|
@@ -6411,16 +6457,23 @@ var DrawerPortal = ({ children, topContent }) => {
|
|
|
6411
6457
|
onRequestClose: closeDrawer,
|
|
6412
6458
|
children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.modalContainer, children: [
|
|
6413
6459
|
children,
|
|
6414
|
-
topContent
|
|
6460
|
+
topContent,
|
|
6461
|
+
OverlayComponent ? /* @__PURE__ */ jsxRuntime.jsx(OverlayComponent, {}) : null
|
|
6415
6462
|
] })
|
|
6416
6463
|
}
|
|
6417
6464
|
);
|
|
6418
6465
|
};
|
|
6419
6466
|
DrawerPortal.displayName = "Drawer.Portal";
|
|
6467
|
+
var DrawerOverlayProvider = ({
|
|
6468
|
+
component,
|
|
6469
|
+
children
|
|
6470
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(DrawerOverlayContext.Provider, { value: component, children });
|
|
6471
|
+
DrawerOverlayProvider.displayName = "Drawer.OverlayProvider";
|
|
6420
6472
|
var Drawer = Object.assign(DrawerRoot, {
|
|
6421
6473
|
Root: DrawerRoot,
|
|
6422
6474
|
Trigger: DrawerTrigger,
|
|
6423
6475
|
Portal: DrawerPortal,
|
|
6476
|
+
OverlayProvider: DrawerOverlayProvider,
|
|
6424
6477
|
Overlay: DrawerOverlay,
|
|
6425
6478
|
Content: DrawerContent,
|
|
6426
6479
|
Grabber: DrawerGrabber,
|