@oxy.so/bloom 7.19.2 → 7.21.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/docs/adoption-matrix.mdx +10 -9
- package/docs/bottom-sheet.mdx +15 -0
- package/docs/dialog.mdx +51 -0
- package/docs/overlay.mdx +18 -0
- package/docs/rating.mdx +2 -0
- package/docs/stat-bar.mdx +10 -0
- package/docs/viewport.mdx +47 -0
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +27 -10
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.js +21 -8
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +37 -18
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js +4 -0
- package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/commonjs/dialog/placement.js +8 -1
- package/lib/commonjs/dialog/placement.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +12 -0
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/motion/surface-transition.js +18 -0
- package/lib/commonjs/motion/surface-transition.js.map +1 -0
- package/lib/commonjs/motion/use-surface-transition.js +24 -0
- package/lib/commonjs/motion/use-surface-transition.js.map +1 -0
- package/lib/commonjs/overlay/Overlay.js +11 -11
- package/lib/commonjs/overlay/Overlay.js.map +1 -1
- package/lib/commonjs/overlay/backdrop-paint.js +34 -0
- package/lib/commonjs/overlay/backdrop-paint.js.map +1 -0
- package/lib/commonjs/rating/RatingBar.js +2 -0
- package/lib/commonjs/rating/RatingBar.js.map +1 -1
- package/lib/commonjs/rating/RatingBar.web.js +2 -0
- package/lib/commonjs/rating/RatingBar.web.js.map +1 -1
- package/lib/commonjs/stat-bar/Meter.js +7 -4
- package/lib/commonjs/stat-bar/Meter.js.map +1 -1
- package/lib/commonjs/stat-bar/Meter.web.js +11 -4
- package/lib/commonjs/stat-bar/Meter.web.js.map +1 -1
- package/lib/commonjs/stat-bar/use-meter-reveal-policy.js +29 -0
- package/lib/commonjs/stat-bar/use-meter-reveal-policy.js.map +1 -0
- package/lib/commonjs/stat-bar/use-meter-reveal.js +39 -0
- package/lib/commonjs/stat-bar/use-meter-reveal.js.map +1 -0
- package/lib/commonjs/stat-bar/use-meter-reveal.web.js +38 -0
- package/lib/commonjs/stat-bar/use-meter-reveal.web.js.map +1 -0
- package/lib/commonjs/viewport/ViewportProvider.js +28 -0
- package/lib/commonjs/viewport/ViewportProvider.js.map +1 -0
- package/lib/commonjs/viewport/context.js +9 -0
- package/lib/commonjs/viewport/context.js.map +1 -0
- package/lib/commonjs/viewport/geometry.js +31 -0
- package/lib/commonjs/viewport/geometry.js.map +1 -0
- package/lib/commonjs/viewport/index.js +27 -0
- package/lib/commonjs/viewport/index.js.map +1 -0
- package/lib/commonjs/viewport/index.web.js +27 -0
- package/lib/commonjs/viewport/index.web.js.map +1 -0
- package/lib/commonjs/viewport/types.js +6 -0
- package/lib/commonjs/viewport/types.js.map +1 -0
- package/lib/commonjs/viewport/use-in-view.js +106 -0
- package/lib/commonjs/viewport/use-in-view.js.map +1 -0
- package/lib/commonjs/viewport/use-in-view.web.js +49 -0
- package/lib/commonjs/viewport/use-in-view.web.js.map +1 -0
- package/lib/commonjs/viewport/use-viewport-binding.js +55 -0
- package/lib/commonjs/viewport/use-viewport-binding.js.map +1 -0
- package/lib/module/bottom-sheet/BottomSheetBase.js +27 -10
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/dialog/Dialog.js +22 -9
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +38 -19
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/DialogBottomSheet.js +4 -0
- package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/module/dialog/placement.js +7 -1
- package/lib/module/dialog/placement.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/motion/surface-transition.js +14 -0
- package/lib/module/motion/surface-transition.js.map +1 -0
- package/lib/module/motion/use-surface-transition.js +20 -0
- package/lib/module/motion/use-surface-transition.js.map +1 -0
- package/lib/module/overlay/Overlay.js +11 -11
- package/lib/module/overlay/Overlay.js.map +1 -1
- package/lib/module/overlay/backdrop-paint.js +29 -0
- package/lib/module/overlay/backdrop-paint.js.map +1 -0
- package/lib/module/rating/RatingBar.js +2 -0
- package/lib/module/rating/RatingBar.js.map +1 -1
- package/lib/module/rating/RatingBar.web.js +2 -0
- package/lib/module/rating/RatingBar.web.js.map +1 -1
- package/lib/module/stat-bar/Meter.js +9 -4
- package/lib/module/stat-bar/Meter.js.map +1 -1
- package/lib/module/stat-bar/Meter.web.js +11 -4
- package/lib/module/stat-bar/Meter.web.js.map +1 -1
- package/lib/module/stat-bar/use-meter-reveal-policy.js +25 -0
- package/lib/module/stat-bar/use-meter-reveal-policy.js.map +1 -0
- package/lib/module/stat-bar/use-meter-reveal.js +35 -0
- package/lib/module/stat-bar/use-meter-reveal.js.map +1 -0
- package/lib/module/stat-bar/use-meter-reveal.web.js +34 -0
- package/lib/module/stat-bar/use-meter-reveal.web.js.map +1 -0
- package/lib/module/viewport/ViewportProvider.js +23 -0
- package/lib/module/viewport/ViewportProvider.js.map +1 -0
- package/lib/module/viewport/context.js +5 -0
- package/lib/module/viewport/context.js.map +1 -0
- package/lib/module/viewport/geometry.js +25 -0
- package/lib/module/viewport/geometry.js.map +1 -0
- package/lib/module/viewport/index.js +6 -0
- package/lib/module/viewport/index.js.map +1 -0
- package/lib/module/viewport/index.web.js +11 -0
- package/lib/module/viewport/index.web.js.map +1 -0
- package/lib/module/viewport/types.js +4 -0
- package/lib/module/viewport/types.js.map +1 -0
- package/lib/module/viewport/use-in-view.js +102 -0
- package/lib/module/viewport/use-in-view.js.map +1 -0
- package/lib/module/viewport/use-in-view.web.js +45 -0
- package/lib/module/viewport/use-in-view.web.js.map +1 -0
- package/lib/module/viewport/use-viewport-binding.js +51 -0
- package/lib/module/viewport/use-viewport-binding.js.map +1 -0
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts +6 -0
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts +2 -2
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/placement.d.ts +3 -1
- package/lib/typescript/commonjs/dialog/placement.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/types.d.ts +8 -0
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +1 -0
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/motion/index.d.ts +1 -1
- package/lib/typescript/commonjs/motion/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/motion/index.web.d.ts +1 -1
- package/lib/typescript/commonjs/motion/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/motion/surface-transition.d.ts +8 -0
- package/lib/typescript/commonjs/motion/surface-transition.d.ts.map +1 -0
- package/lib/typescript/commonjs/motion/types.d.ts +7 -0
- package/lib/typescript/commonjs/motion/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/motion/use-surface-transition.d.ts +9 -0
- package/lib/typescript/commonjs/motion/use-surface-transition.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/Overlay.d.ts.map +1 -1
- package/lib/typescript/commonjs/overlay/backdrop-paint.d.ts +7 -0
- package/lib/typescript/commonjs/overlay/backdrop-paint.d.ts.map +1 -0
- package/lib/typescript/commonjs/overlay/index.d.ts +1 -1
- package/lib/typescript/commonjs/overlay/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/overlay/types.d.ts +23 -9
- package/lib/typescript/commonjs/overlay/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/rating/RatingBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/rating/types.d.ts +3 -0
- package/lib/typescript/commonjs/rating/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/stat-bar/Meter.d.ts.map +1 -1
- package/lib/typescript/commonjs/stat-bar/Meter.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/stat-bar/index.d.ts +1 -0
- package/lib/typescript/commonjs/stat-bar/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/stat-bar/index.web.d.ts +1 -0
- package/lib/typescript/commonjs/stat-bar/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/stat-bar/types.d.ts +14 -0
- package/lib/typescript/commonjs/stat-bar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/stat-bar/use-meter-reveal-policy.d.ts +10 -0
- package/lib/typescript/commonjs/stat-bar/use-meter-reveal-policy.d.ts.map +1 -0
- package/lib/typescript/commonjs/stat-bar/use-meter-reveal.d.ts +5 -0
- package/lib/typescript/commonjs/stat-bar/use-meter-reveal.d.ts.map +1 -0
- package/lib/typescript/commonjs/stat-bar/use-meter-reveal.web.d.ts +9 -0
- package/lib/typescript/commonjs/stat-bar/use-meter-reveal.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/viewport/ViewportProvider.d.ts +4 -0
- package/lib/typescript/commonjs/viewport/ViewportProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/viewport/context.d.ts +8 -0
- package/lib/typescript/commonjs/viewport/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/viewport/geometry.d.ts +10 -0
- package/lib/typescript/commonjs/viewport/geometry.d.ts.map +1 -0
- package/lib/typescript/commonjs/viewport/index.d.ts +5 -0
- package/lib/typescript/commonjs/viewport/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/viewport/index.web.d.ts +5 -0
- package/lib/typescript/commonjs/viewport/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/viewport/types.d.ts +25 -0
- package/lib/typescript/commonjs/viewport/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/viewport/use-in-view.d.ts +11 -0
- package/lib/typescript/commonjs/viewport/use-in-view.d.ts.map +1 -0
- package/lib/typescript/commonjs/viewport/use-in-view.web.d.ts +10 -0
- package/lib/typescript/commonjs/viewport/use-in-view.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/viewport/use-viewport-binding.d.ts +9 -0
- package/lib/typescript/commonjs/viewport/use-viewport-binding.d.ts.map +1 -0
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/types.d.ts +6 -0
- package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts +2 -2
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/lib/typescript/module/dialog/placement.d.ts +3 -1
- package/lib/typescript/module/dialog/placement.d.ts.map +1 -1
- package/lib/typescript/module/dialog/types.d.ts +8 -0
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +1 -0
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/motion/index.d.ts +1 -1
- package/lib/typescript/module/motion/index.d.ts.map +1 -1
- package/lib/typescript/module/motion/index.web.d.ts +1 -1
- package/lib/typescript/module/motion/index.web.d.ts.map +1 -1
- package/lib/typescript/module/motion/surface-transition.d.ts +8 -0
- package/lib/typescript/module/motion/surface-transition.d.ts.map +1 -0
- package/lib/typescript/module/motion/types.d.ts +7 -0
- package/lib/typescript/module/motion/types.d.ts.map +1 -1
- package/lib/typescript/module/motion/use-surface-transition.d.ts +9 -0
- package/lib/typescript/module/motion/use-surface-transition.d.ts.map +1 -0
- package/lib/typescript/module/overlay/Overlay.d.ts.map +1 -1
- package/lib/typescript/module/overlay/backdrop-paint.d.ts +7 -0
- package/lib/typescript/module/overlay/backdrop-paint.d.ts.map +1 -0
- package/lib/typescript/module/overlay/index.d.ts +1 -1
- package/lib/typescript/module/overlay/index.d.ts.map +1 -1
- package/lib/typescript/module/overlay/types.d.ts +23 -9
- package/lib/typescript/module/overlay/types.d.ts.map +1 -1
- package/lib/typescript/module/rating/RatingBar.d.ts.map +1 -1
- package/lib/typescript/module/rating/types.d.ts +3 -0
- package/lib/typescript/module/rating/types.d.ts.map +1 -1
- package/lib/typescript/module/stat-bar/Meter.d.ts.map +1 -1
- package/lib/typescript/module/stat-bar/Meter.web.d.ts.map +1 -1
- package/lib/typescript/module/stat-bar/index.d.ts +1 -0
- package/lib/typescript/module/stat-bar/index.d.ts.map +1 -1
- package/lib/typescript/module/stat-bar/index.web.d.ts +1 -0
- package/lib/typescript/module/stat-bar/index.web.d.ts.map +1 -1
- package/lib/typescript/module/stat-bar/types.d.ts +14 -0
- package/lib/typescript/module/stat-bar/types.d.ts.map +1 -1
- package/lib/typescript/module/stat-bar/use-meter-reveal-policy.d.ts +10 -0
- package/lib/typescript/module/stat-bar/use-meter-reveal-policy.d.ts.map +1 -0
- package/lib/typescript/module/stat-bar/use-meter-reveal.d.ts +5 -0
- package/lib/typescript/module/stat-bar/use-meter-reveal.d.ts.map +1 -0
- package/lib/typescript/module/stat-bar/use-meter-reveal.web.d.ts +9 -0
- package/lib/typescript/module/stat-bar/use-meter-reveal.web.d.ts.map +1 -0
- package/lib/typescript/module/viewport/ViewportProvider.d.ts +4 -0
- package/lib/typescript/module/viewport/ViewportProvider.d.ts.map +1 -0
- package/lib/typescript/module/viewport/context.d.ts +8 -0
- package/lib/typescript/module/viewport/context.d.ts.map +1 -0
- package/lib/typescript/module/viewport/geometry.d.ts +10 -0
- package/lib/typescript/module/viewport/geometry.d.ts.map +1 -0
- package/lib/typescript/module/viewport/index.d.ts +5 -0
- package/lib/typescript/module/viewport/index.d.ts.map +1 -0
- package/lib/typescript/module/viewport/index.web.d.ts +5 -0
- package/lib/typescript/module/viewport/index.web.d.ts.map +1 -0
- package/lib/typescript/module/viewport/types.d.ts +25 -0
- package/lib/typescript/module/viewport/types.d.ts.map +1 -0
- package/lib/typescript/module/viewport/use-in-view.d.ts +11 -0
- package/lib/typescript/module/viewport/use-in-view.d.ts.map +1 -0
- package/lib/typescript/module/viewport/use-in-view.web.d.ts +10 -0
- package/lib/typescript/module/viewport/use-in-view.web.d.ts.map +1 -0
- package/lib/typescript/module/viewport/use-viewport-binding.d.ts +9 -0
- package/lib/typescript/module/viewport/use-viewport-binding.d.ts.map +1 -0
- package/package.json +23 -1
- package/src/bottom-sheet/BottomSheetBase.tsx +18 -8
- package/src/bottom-sheet/types.ts +6 -0
- package/src/dialog/Dialog.tsx +24 -8
- package/src/dialog/Dialog.web.tsx +40 -16
- package/src/dialog/DialogBottomSheet.tsx +6 -0
- package/src/dialog/placement.ts +9 -1
- package/src/dialog/types.ts +8 -0
- package/src/index.ts +2 -0
- package/src/index.web.ts +2 -0
- package/src/motion/index.ts +1 -1
- package/src/motion/index.web.ts +1 -1
- package/src/motion/surface-transition.ts +15 -0
- package/src/motion/types.ts +8 -0
- package/src/motion/use-surface-transition.ts +14 -0
- package/src/overlay/Overlay.tsx +12 -8
- package/src/overlay/backdrop-paint.ts +25 -0
- package/src/overlay/index.ts +1 -1
- package/src/overlay/types.ts +22 -9
- package/src/rating/RatingBar.tsx +2 -1
- package/src/rating/RatingBar.web.tsx +2 -2
- package/src/rating/types.ts +3 -0
- package/src/stat-bar/Meter.tsx +7 -3
- package/src/stat-bar/Meter.web.tsx +7 -4
- package/src/stat-bar/index.ts +2 -0
- package/src/stat-bar/index.web.ts +2 -0
- package/src/stat-bar/types.ts +15 -0
- package/src/stat-bar/use-meter-reveal-policy.ts +19 -0
- package/src/stat-bar/use-meter-reveal.ts +21 -0
- package/src/stat-bar/use-meter-reveal.web.ts +24 -0
- package/src/viewport/ViewportProvider.tsx +11 -0
- package/src/viewport/context.ts +9 -0
- package/src/viewport/geometry.ts +18 -0
- package/src/viewport/index.ts +4 -0
- package/src/viewport/index.web.ts +9 -0
- package/src/viewport/types.ts +23 -0
- package/src/viewport/use-in-view.ts +69 -0
- package/src/viewport/use-in-view.web.ts +33 -0
- package/src/viewport/use-viewport-binding.ts +34 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InViewOptions } from './types';
|
|
2
|
+
/** The browser owns ancestor clipping, scrolling and resize observation. */
|
|
3
|
+
export declare function useInView({ threshold: requestedThreshold, once }?: InViewOptions): {
|
|
4
|
+
inView: boolean;
|
|
5
|
+
targetProps: {
|
|
6
|
+
ref: (value: unknown) => void;
|
|
7
|
+
onLayout: () => void;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=use-in-view.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-in-view.web.d.ts","sourceRoot":"","sources":["../../../../src/viewport/use-in-view.web.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,IAAY,EAAE,GAAE,aAAkB;;;qBAK3D,OAAO;;;EAsBxC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ViewportBindingOptions } from './types';
|
|
2
|
+
/** Compose with restoration/metrics callbacks; no React renders on scroll. */
|
|
3
|
+
export declare function useViewportBinding({ viewportRef, onScroll, onLayout, onContentSizeChange }: ViewportBindingOptions): {
|
|
4
|
+
onScroll: (event: import("react-native").NativeSyntheticEvent<import("react-native").NativeScrollEvent>) => void;
|
|
5
|
+
onLayout: (event: import("react-native").LayoutChangeEvent) => void;
|
|
6
|
+
onContentSizeChange: (contentWidth: number, contentHeight: number) => void;
|
|
7
|
+
scrollEventThrottle: number;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=use-viewport-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-viewport-binding.d.ts","sourceRoot":"","sources":["../../../../src/viewport/use-viewport-binding.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,EAAE,sBAAsB;;;;;EA2BlH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/bloom",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.21.0",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
@@ -371,6 +371,25 @@
|
|
|
371
371
|
"default": "./lib/commonjs/layout/index.js"
|
|
372
372
|
}
|
|
373
373
|
},
|
|
374
|
+
"./viewport": {
|
|
375
|
+
"react-native": {
|
|
376
|
+
"types": "./lib/typescript/module/viewport/index.d.ts",
|
|
377
|
+
"default": "./src/viewport/index.ts"
|
|
378
|
+
},
|
|
379
|
+
"browser": {
|
|
380
|
+
"types": "./lib/typescript/module/viewport/index.web.d.ts",
|
|
381
|
+
"import": "./lib/module/viewport/index.web.js",
|
|
382
|
+
"require": "./lib/commonjs/viewport/index.web.js"
|
|
383
|
+
},
|
|
384
|
+
"import": {
|
|
385
|
+
"types": "./lib/typescript/module/viewport/index.d.ts",
|
|
386
|
+
"default": "./lib/module/viewport/index.js"
|
|
387
|
+
},
|
|
388
|
+
"require": {
|
|
389
|
+
"types": "./lib/typescript/commonjs/viewport/index.d.ts",
|
|
390
|
+
"default": "./lib/commonjs/viewport/index.js"
|
|
391
|
+
}
|
|
392
|
+
},
|
|
374
393
|
"./fab": {
|
|
375
394
|
"react-native": {
|
|
376
395
|
"types": "./lib/typescript/module/fab/index.d.ts",
|
|
@@ -3725,6 +3744,9 @@
|
|
|
3725
3744
|
"layout": [
|
|
3726
3745
|
"./lib/typescript/module/layout/index.d.ts"
|
|
3727
3746
|
],
|
|
3747
|
+
"viewport": [
|
|
3748
|
+
"./lib/typescript/module/viewport/index.d.ts"
|
|
3749
|
+
],
|
|
3728
3750
|
"fab": [
|
|
3729
3751
|
"./lib/typescript/module/fab/index.d.ts"
|
|
3730
3752
|
],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useSurfaceTransition } from '../motion/use-surface-transition';
|
|
1
2
|
import { MOTION_RECIPES } from '../motion/recipes';
|
|
2
3
|
import { surfaceStyle } from '../shapes/surface-style';
|
|
3
4
|
import { SURFACE_SHAPES } from '../design-tokens/shapes';
|
|
@@ -56,6 +57,8 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
56
57
|
backgroundComponent,
|
|
57
58
|
backgroundFill,
|
|
58
59
|
backdropComponent,
|
|
60
|
+
backdrop,
|
|
61
|
+
transition,
|
|
59
62
|
style,
|
|
60
63
|
enableHandlePanningGesture = true,
|
|
61
64
|
onDismissAttempt,
|
|
@@ -72,6 +75,9 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
72
75
|
onLayout,
|
|
73
76
|
} = props;
|
|
74
77
|
|
|
78
|
+
const motion = useSurfaceTransition(transition);
|
|
79
|
+
const timed = transition !== undefined;
|
|
80
|
+
const timedConfig = useMemo(() => ({ ...MOTION_RECIPES.present, duration: motion.duration ?? 250, easing: motion.easing }), [motion.duration, motion.easing]);
|
|
75
81
|
const insets = useSafeAreaInsets();
|
|
76
82
|
const theme = useTheme();
|
|
77
83
|
const { colors } = theme;
|
|
@@ -192,19 +198,19 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
192
198
|
// it eventually fires, because its captured generation is stale.
|
|
193
199
|
closeGenerationRef.current += 1;
|
|
194
200
|
closeGeneration.value = closeGenerationRef.current;
|
|
195
|
-
opacity.value = withTiming(1, { ...MOTION_RECIPES.present, duration: 250 });
|
|
196
|
-
translateY.value = withSpring(0, SPRING_CONFIG);
|
|
201
|
+
opacity.value = withTiming(1, timed ? timedConfig : { ...MOTION_RECIPES.present, duration: motion.duration ?? 250 });
|
|
202
|
+
translateY.value = motion.reducedMotion ? 0 : timed ? withTiming(0, timedConfig) : withSpring(0, SPRING_CONFIG);
|
|
197
203
|
} else if (rendered) {
|
|
198
204
|
// Capture the generation for THIS close cycle so the animation
|
|
199
205
|
// callback (running on the UI thread, scheduled back to JS) and
|
|
200
206
|
// the fallback timer agree on which cycle they belong to.
|
|
201
207
|
const generation = closeGenerationRef.current;
|
|
202
|
-
opacity.value = withTiming(0, { ...MOTION_RECIPES.dismiss, duration: 250 }, (finished) => {
|
|
208
|
+
opacity.value = withTiming(0, timed ? timedConfig : { ...MOTION_RECIPES.dismiss, duration: motion.duration ?? 250 }, (finished) => {
|
|
203
209
|
if (finished) {
|
|
204
210
|
runOnJS(finishClose)(generation);
|
|
205
211
|
}
|
|
206
212
|
});
|
|
207
|
-
translateY.value = withSpring(screenHeight, { ...SPRING_CONFIG, stiffness: 250 });
|
|
213
|
+
translateY.value = motion.reducedMotion ? screenHeight : timed ? withTiming(screenHeight, timedConfig) : withSpring(screenHeight, { ...SPRING_CONFIG, stiffness: 250 });
|
|
208
214
|
|
|
209
215
|
// Fallback timer to ensure close completes (especially on web
|
|
210
216
|
// where reanimated callbacks occasionally drop on tab blur).
|
|
@@ -214,9 +220,9 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
214
220
|
closeTimeoutRef.current = setTimeout(() => {
|
|
215
221
|
finishClose(generation);
|
|
216
222
|
closeTimeoutRef.current = null;
|
|
217
|
-
}, 300);
|
|
223
|
+
}, motion.reducedMotion ? 0 : timed ? timedConfig.duration + 50 : 300);
|
|
218
224
|
}
|
|
219
|
-
}, [visible, rendered, finishClose, screenHeight, closeGeneration, opacity, translateY]);
|
|
225
|
+
}, [visible, rendered, finishClose, screenHeight, closeGeneration, opacity, translateY, timed, timedConfig, motion.duration, motion.reducedMotion]);
|
|
220
226
|
|
|
221
227
|
// On unmount: ensure pending close callbacks (e.g. consumer's `onDismiss`)
|
|
222
228
|
// still fire if the BS is yanked mid-animation by a parent re-render while a
|
|
@@ -260,11 +266,14 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
260
266
|
translateY.value = withSpring(0, { ...SPRING_CONFIG, velocity });
|
|
261
267
|
return;
|
|
262
268
|
}
|
|
269
|
+
// The timed presentation shares the imperative close lifecycle, so a live
|
|
270
|
+
// reduced-motion change can also settle a gesture-initiated dismissal.
|
|
271
|
+
if (timed || motion.reducedMotion) { setVisible(false); return; }
|
|
263
272
|
translateY.value = withSpring(screenHeightSV.value, { ...SPRING_CONFIG, velocity });
|
|
264
273
|
opacity.value = withTiming(0, { ...MOTION_RECIPES.dismiss, duration: 250 }, (finished) => {
|
|
265
274
|
if (finished) runOnJS(finishClose)(generation);
|
|
266
275
|
});
|
|
267
|
-
}, [onDismissAttempt, translateY, screenHeightSV, opacity, finishClose]);
|
|
276
|
+
}, [onDismissAttempt, translateY, screenHeightSV, opacity, finishClose, timed, timedConfig, motion.duration, motion.reducedMotion]);
|
|
268
277
|
|
|
269
278
|
const present = useCallback(() => {
|
|
270
279
|
setRendered(true);
|
|
@@ -709,6 +718,7 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
709
718
|
// `backdropOpacity`, so the shared component's own dim is
|
|
710
719
|
// switched off here to keep a single source of dimming.
|
|
711
720
|
<Backdrop
|
|
721
|
+
{...backdrop}
|
|
712
722
|
onPress={handleBackdropPress}
|
|
713
723
|
// `progress` is the FADE (0 → 1, folding the drag);
|
|
714
724
|
// how dark the backdrop gets is `backdropOpacity`,
|
|
@@ -717,7 +727,7 @@ export const BottomSheetBase = forwardRef((props: BottomSheetBaseProps, ref: Rea
|
|
|
717
727
|
// `progress` rather than an animated style because an
|
|
718
728
|
// opacity on the root would sit above the blur layer
|
|
719
729
|
// and neutralise it.
|
|
720
|
-
dimOpacity={backdropOpacity}
|
|
730
|
+
dimOpacity={backdrop?.dimOpacity ?? backdropOpacity}
|
|
721
731
|
progress={backdropProgress}
|
|
722
732
|
style={styles.backdrop}
|
|
723
733
|
/>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { BackdropAppearance } from '../overlay/types';
|
|
2
|
+
import type { SurfaceTransition } from '../motion/types';
|
|
1
3
|
import type React from 'react';
|
|
2
4
|
import { View, Platform, type LayoutChangeEvent, type ViewStyle, type StyleProp } from 'react-native';
|
|
3
5
|
import Animated, { type AnimatedStyle, type SharedValue } from 'react-native-reanimated';
|
|
@@ -14,6 +16,10 @@ export interface BottomSheetRef {
|
|
|
14
16
|
export interface BottomSheetProps {
|
|
15
17
|
/** Standard optical surface, or the unmodified backing fill. Default surface. */
|
|
16
18
|
material?: 'surface' | 'flat';
|
|
19
|
+
/** Backdrop paint; the surface continues to own dismissal and layering. */
|
|
20
|
+
backdrop?: BackdropAppearance;
|
|
21
|
+
/** Opt-in timing for panel and backdrop. Live reduced motion settles immediately. */
|
|
22
|
+
transition?: SurfaceTransition;
|
|
17
23
|
children: React.ReactNode;
|
|
18
24
|
/** Accessible name for the modal sheet panel on web. */
|
|
19
25
|
accessibilityLabel?: string;
|
package/src/dialog/Dialog.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useSurfaceTransition } from '../motion/use-surface-transition';
|
|
1
2
|
import { MOTION_RECIPES } from '../motion/recipes';
|
|
2
3
|
import { surfaceStyle } from '../shapes/surface-style';
|
|
3
4
|
import { SURFACE_SHAPES } from '../design-tokens/shapes';
|
|
@@ -47,7 +48,7 @@ import {
|
|
|
47
48
|
DEFAULT_DIALOG_CONTENT_PADDING,
|
|
48
49
|
DEFAULT_SIDE_WIDTH,
|
|
49
50
|
DIALOG_SHEET_BACKDROP_TESTID,
|
|
50
|
-
|
|
51
|
+
resolveSideSheetWidth,
|
|
51
52
|
useResolvedPlacement,
|
|
52
53
|
physicalDialogSide,
|
|
53
54
|
type DialogSidePlacement,
|
|
@@ -113,6 +114,8 @@ export function Dialog({
|
|
|
113
114
|
*/
|
|
114
115
|
function CenteredOrSideDialog({
|
|
115
116
|
material: surfaceMaterial = 'surface',
|
|
117
|
+
backdrop,
|
|
118
|
+
transition,
|
|
116
119
|
control,
|
|
117
120
|
open: controlledOpen,
|
|
118
121
|
startOpen,
|
|
@@ -128,6 +131,7 @@ function CenteredOrSideDialog({
|
|
|
128
131
|
morph,
|
|
129
132
|
placement,
|
|
130
133
|
width = DEFAULT_SIDE_WIDTH,
|
|
134
|
+
minSideGutter,
|
|
131
135
|
inset,
|
|
132
136
|
dismissOnBackdrop = true,
|
|
133
137
|
contentPadding = DEFAULT_DIALOG_CONTENT_PADDING,
|
|
@@ -303,6 +307,8 @@ function CenteredOrSideDialog({
|
|
|
303
307
|
return (
|
|
304
308
|
<Context.Provider value={context}>
|
|
305
309
|
<SideSheet
|
|
310
|
+
backdrop={backdrop}
|
|
311
|
+
transition={transition}
|
|
306
312
|
material={surfaceMaterial}
|
|
307
313
|
presentation={presentation}
|
|
308
314
|
exitDuration={exitDuration}
|
|
@@ -310,6 +316,7 @@ function CenteredOrSideDialog({
|
|
|
310
316
|
open={sideOpen}
|
|
311
317
|
onDismiss={handleDismiss}
|
|
312
318
|
side={placement}
|
|
319
|
+
minSideGutter={minSideGutter}
|
|
313
320
|
width={width}
|
|
314
321
|
inset={inset}
|
|
315
322
|
dismissOnBackdrop={dismissOnBackdrop}
|
|
@@ -337,6 +344,8 @@ function CenteredOrSideDialog({
|
|
|
337
344
|
|
|
338
345
|
return (
|
|
339
346
|
<BottomSheet
|
|
347
|
+
backdrop={backdrop}
|
|
348
|
+
transition={transition}
|
|
340
349
|
material={surfaceMaterial}
|
|
341
350
|
backgroundFill={surfaceMaterial === 'flat' ? String(StyleSheet.flatten([style, panelStyle])?.backgroundColor ?? theme.colors.background) : undefined}
|
|
342
351
|
ref={ref}
|
|
@@ -408,6 +417,8 @@ function CenteredOrSideDialog({
|
|
|
408
417
|
*/
|
|
409
418
|
function SideSheet({
|
|
410
419
|
material: surfaceMaterial = 'surface',
|
|
420
|
+
backdrop,
|
|
421
|
+
transition,
|
|
411
422
|
scrollable,
|
|
412
423
|
presentation,
|
|
413
424
|
exitDuration,
|
|
@@ -415,6 +426,7 @@ function SideSheet({
|
|
|
415
426
|
onDismiss,
|
|
416
427
|
side,
|
|
417
428
|
width,
|
|
429
|
+
minSideGutter,
|
|
418
430
|
inset,
|
|
419
431
|
dismissOnBackdrop,
|
|
420
432
|
contentPadding,
|
|
@@ -435,6 +447,8 @@ function SideSheet({
|
|
|
435
447
|
children,
|
|
436
448
|
}: {
|
|
437
449
|
material?: DialogProps['material'];
|
|
450
|
+
backdrop?: DialogProps['backdrop'];
|
|
451
|
+
transition?: DialogProps['transition'];
|
|
438
452
|
scrollable: boolean;
|
|
439
453
|
presentation?: DialogProps['presentation'];
|
|
440
454
|
exitDuration?: number;
|
|
@@ -442,6 +456,7 @@ function SideSheet({
|
|
|
442
456
|
onDismiss: () => void;
|
|
443
457
|
side: DialogSidePlacement;
|
|
444
458
|
width: number;
|
|
459
|
+
minSideGutter?: number;
|
|
445
460
|
inset?: DialogInset;
|
|
446
461
|
dismissOnBackdrop: boolean;
|
|
447
462
|
contentPadding: number;
|
|
@@ -461,6 +476,7 @@ function SideSheet({
|
|
|
461
476
|
style?: StyleProp<ViewStyle>;
|
|
462
477
|
children: React.ReactNode;
|
|
463
478
|
}) {
|
|
479
|
+
const motion = useSurfaceTransition(transition);
|
|
464
480
|
const dialogMessages = useMessages(DIALOG_MESSAGES).messages;
|
|
465
481
|
const theme = useTheme();
|
|
466
482
|
const { width: viewportWidth } = useWindowDimensions();
|
|
@@ -484,9 +500,8 @@ function SideSheet({
|
|
|
484
500
|
const oppositeInset = edge === 'left' ? insetRight : insetLeft;
|
|
485
501
|
|
|
486
502
|
const sideWidth = useMemo(() => {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
}, [viewportWidth, anchorInset, oppositeInset, width]);
|
|
503
|
+
return resolveSideSheetWidth(viewportWidth, width, anchorInset, oppositeInset, minSideGutter);
|
|
504
|
+
}, [viewportWidth, anchorInset, oppositeInset, width, minSideGutter]);
|
|
490
505
|
|
|
491
506
|
// Travel distance for the hidden state: the panel's measured width, with the
|
|
492
507
|
// geometry target as the pre-measurement fallback.
|
|
@@ -502,7 +517,7 @@ function SideSheet({
|
|
|
502
517
|
|
|
503
518
|
useEffect(() => {
|
|
504
519
|
cancelAnimation(progress);
|
|
505
|
-
const timing = { ...MOTION_RECIPES[open ? 'present' : 'dismiss'], duration: presentation === 'custom' ? exitDuration ?? 0 : ANIMATION_DURATION, easing: Easing.out(Easing.cubic) };
|
|
520
|
+
const timing = { ...MOTION_RECIPES[open ? 'present' : 'dismiss'], duration: presentation === 'custom' ? exitDuration ?? 0 : motion.duration ?? ANIMATION_DURATION, easing: transition ? motion.easing : Easing.out(Easing.cubic) };
|
|
506
521
|
if (open) {
|
|
507
522
|
setMounted(true);
|
|
508
523
|
progress.value = withTiming(1, timing);
|
|
@@ -512,7 +527,7 @@ function SideSheet({
|
|
|
512
527
|
progress.value = withTiming(0, timing, (finished) => {
|
|
513
528
|
if (finished) runOnJS(finishClose)();
|
|
514
529
|
});
|
|
515
|
-
}, [open, mounted, progress, finishClose, presentation, exitDuration]);
|
|
530
|
+
}, [open, mounted, progress, finishClose, presentation, exitDuration, motion.duration, motion.easing, !!transition]);
|
|
516
531
|
|
|
517
532
|
const handleBackdropPress = useCallback(() => {
|
|
518
533
|
if (dismissOnBackdrop) onHeaderDismiss();
|
|
@@ -573,13 +588,14 @@ function SideSheet({
|
|
|
573
588
|
modal
|
|
574
589
|
>
|
|
575
590
|
<Backdrop
|
|
591
|
+
{...backdrop}
|
|
576
592
|
testID={testID ? `${testID}-backdrop` : DIALOG_SHEET_BACKDROP_TESTID}
|
|
577
593
|
accessibilityLabel={label ? dialogMessages.dismissNamed(label) : dialogMessages.dismissDialog}
|
|
578
594
|
onPress={handleBackdropPress}
|
|
579
595
|
disabled={!dismissOnBackdrop}
|
|
580
596
|
progress={progress}
|
|
581
|
-
dimOpacity={presentation === 'custom' ? 0 :
|
|
582
|
-
blurIntensity={presentation === 'custom' ? 0 :
|
|
597
|
+
dimOpacity={presentation === 'custom' ? 0 : backdrop?.dimOpacity}
|
|
598
|
+
blurIntensity={presentation === 'custom' ? 0 : backdrop?.blurIntensity}
|
|
583
599
|
style={sideStyles.backdrop}
|
|
584
600
|
/>
|
|
585
601
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useSurfaceTransition } from '../motion/use-surface-transition';
|
|
1
2
|
import { MOTION_RECIPES } from '../motion/recipes';
|
|
2
3
|
import { surfaceStyle } from '../shapes/surface-style';
|
|
3
4
|
import { SURFACE_SHAPES } from '../design-tokens/shapes';
|
|
@@ -66,7 +67,7 @@ import {
|
|
|
66
67
|
DEFAULT_SIDE_WIDTH,
|
|
67
68
|
DIALOG_SHEET_BACKDROP_TESTID,
|
|
68
69
|
EASE_OUT,
|
|
69
|
-
|
|
70
|
+
resolveSideSheetWidth,
|
|
70
71
|
useResolvedPlacement,
|
|
71
72
|
physicalDialogSide,
|
|
72
73
|
type DialogSidePlacement,
|
|
@@ -176,6 +177,8 @@ export function Dialog({ placement, ...rest }: DialogProps) {
|
|
|
176
177
|
*/
|
|
177
178
|
function CenterOrSideDialog({
|
|
178
179
|
material: surfaceMaterial = 'surface',
|
|
180
|
+
backdrop,
|
|
181
|
+
transition,
|
|
179
182
|
control,
|
|
180
183
|
open: controlledOpen,
|
|
181
184
|
startOpen,
|
|
@@ -189,6 +192,7 @@ function CenterOrSideDialog({
|
|
|
189
192
|
header,
|
|
190
193
|
placement,
|
|
191
194
|
width = DEFAULT_SIDE_WIDTH,
|
|
195
|
+
minSideGutter,
|
|
192
196
|
maxWidth = DEFAULT_CENTER_MAX_WIDTH,
|
|
193
197
|
inset,
|
|
194
198
|
dismissOnBackdrop = true,
|
|
@@ -212,6 +216,7 @@ function CenterOrSideDialog({
|
|
|
212
216
|
const dialogMessages = useMessages(DIALOG_MESSAGES).messages;
|
|
213
217
|
// Controlled mode is opt-in: when `open` is a boolean the host owns the
|
|
214
218
|
// visible state; otherwise the legacy imperative `control` path drives it.
|
|
219
|
+
const motion = useSurfaceTransition(transition);
|
|
215
220
|
const isControlled = controlledOpen !== undefined;
|
|
216
221
|
const resolvedPlacement = placement;
|
|
217
222
|
|
|
@@ -270,7 +275,7 @@ function CenterOrSideDialog({
|
|
|
270
275
|
}, [isControlled, controlledOpen]);
|
|
271
276
|
|
|
272
277
|
const exitDuration =
|
|
273
|
-
presentation === 'custom' ? customExitDuration ?? 0 : resolvedPlacement === 'center' ? FADE_OUT_DURATION : ANIMATION_DURATION;
|
|
278
|
+
presentation === 'custom' ? customExitDuration ?? 0 : motion.duration ?? (resolvedPlacement === 'center' ? FADE_OUT_DURATION : ANIMATION_DURATION);
|
|
274
279
|
|
|
275
280
|
useEffect(() => {
|
|
276
281
|
if (!isClosing) return;
|
|
@@ -315,9 +320,9 @@ function CenterOrSideDialog({
|
|
|
315
320
|
return;
|
|
316
321
|
}
|
|
317
322
|
backdropFade.value = isClosing
|
|
318
|
-
? withTiming(0, { ...MOTION_RECIPES.dismiss, duration: FADE_OUT_DURATION, easing: Easing.in(Easing.ease) })
|
|
319
|
-
: withTiming(1, { ...MOTION_RECIPES.present, duration: BACKDROP_FADE_IN_DURATION, easing: Easing.out(Easing.ease) });
|
|
320
|
-
}, [backdropFade, isOpen, isClosing]);
|
|
323
|
+
? withTiming(0, { ...MOTION_RECIPES.dismiss, duration: motion.duration ?? FADE_OUT_DURATION, easing: transition ? motion.easing : Easing.in(Easing.ease) })
|
|
324
|
+
: withTiming(1, { ...MOTION_RECIPES.present, duration: motion.duration ?? BACKDROP_FADE_IN_DURATION, easing: transition ? motion.easing : Easing.out(Easing.ease) });
|
|
325
|
+
}, [backdropFade, isOpen, isClosing, motion.duration, motion.easing, !!transition]);
|
|
321
326
|
|
|
322
327
|
useImperativeHandle(
|
|
323
328
|
control?.ref,
|
|
@@ -365,8 +370,9 @@ function CenterOrSideDialog({
|
|
|
365
370
|
// opacity animation on the blur's ancestor composites the group in
|
|
366
371
|
// isolation and leaves `backdrop-filter` nothing to sample.
|
|
367
372
|
progress={backdropFade}
|
|
368
|
-
|
|
369
|
-
|
|
373
|
+
{...backdrop}
|
|
374
|
+
dimOpacity={presentation === 'custom' ? 0 : backdrop?.dimOpacity}
|
|
375
|
+
blurIntensity={presentation === 'custom' ? 0 : backdrop?.blurIntensity}
|
|
370
376
|
style={[{
|
|
371
377
|
position: WEB_POSITION_FIXED,
|
|
372
378
|
alignItems: 'center',
|
|
@@ -375,6 +381,7 @@ function CenterOrSideDialog({
|
|
|
375
381
|
}, containerStyle]}
|
|
376
382
|
>
|
|
377
383
|
<DialogPanel
|
|
384
|
+
transition={transition}
|
|
378
385
|
material={surfaceMaterial}
|
|
379
386
|
presentation={presentation}
|
|
380
387
|
panelRef={panelRef}
|
|
@@ -408,6 +415,8 @@ function CenterOrSideDialog({
|
|
|
408
415
|
<ClosingContext.Provider value={isClosing}>
|
|
409
416
|
<RemoveScrollBar />
|
|
410
417
|
<SheetSurface
|
|
418
|
+
backdrop={backdrop}
|
|
419
|
+
transition={transition}
|
|
411
420
|
material={surfaceMaterial}
|
|
412
421
|
panelRef={panelRef}
|
|
413
422
|
testID={testID}
|
|
@@ -419,6 +428,7 @@ function CenterOrSideDialog({
|
|
|
419
428
|
scrollable={scrollable}
|
|
420
429
|
placement={resolvedPlacement}
|
|
421
430
|
shown={!isClosing}
|
|
431
|
+
minSideGutter={minSideGutter}
|
|
422
432
|
width={width}
|
|
423
433
|
inset={inset}
|
|
424
434
|
dismissOnBackdrop={dismissOnBackdrop}
|
|
@@ -440,6 +450,7 @@ function CenterOrSideDialog({
|
|
|
440
450
|
|
|
441
451
|
function DialogPanel({
|
|
442
452
|
material: surfaceMaterial = 'surface',
|
|
453
|
+
transition,
|
|
443
454
|
presentation,
|
|
444
455
|
panelRef,
|
|
445
456
|
testID,
|
|
@@ -458,6 +469,7 @@ function DialogPanel({
|
|
|
458
469
|
children,
|
|
459
470
|
}: {
|
|
460
471
|
material?: DialogProps['material'];
|
|
472
|
+
transition?: DialogProps['transition'];
|
|
461
473
|
presentation?: DialogProps['presentation'];
|
|
462
474
|
panelRef: React.RefObject<View | null>;
|
|
463
475
|
testID?: string;
|
|
@@ -475,6 +487,10 @@ function DialogPanel({
|
|
|
475
487
|
isClosing: boolean;
|
|
476
488
|
children?: React.ReactNode;
|
|
477
489
|
}) {
|
|
490
|
+
const motion = useSurfaceTransition(transition);
|
|
491
|
+
const panelMotion: WebCssStyle | undefined = motion.duration === undefined ? undefined : {
|
|
492
|
+
animation: `${isClosing ? 'bloomDialogZoomFadeOut' : 'bloomDialogZoomFadeIn'} ${motion.cssEasing} ${motion.duration}ms${isClosing ? ' forwards' : ''}`,
|
|
493
|
+
};
|
|
478
494
|
const theme = useTheme();
|
|
479
495
|
const { close } = useDialogContext();
|
|
480
496
|
const titleId = useId();
|
|
@@ -558,6 +574,7 @@ function DialogPanel({
|
|
|
558
574
|
zIndex: Z_INDEX.raised,
|
|
559
575
|
},
|
|
560
576
|
presentation === 'custom' ? undefined : isClosing ? ZOOM_FADE_OUT : ZOOM_FADE_IN,
|
|
577
|
+
presentation === 'custom' ? undefined : panelMotion,
|
|
561
578
|
// Drives `height` (and `maxWidth`) only while a morph is in flight; at
|
|
562
579
|
// rest it resolves to `height: 'auto'` — the natural sizing above. Placed
|
|
563
580
|
// before `style` so a consumer's explicit size still wins.
|
|
@@ -641,6 +658,8 @@ function DialogPanel({
|
|
|
641
658
|
*/
|
|
642
659
|
function SheetSurface({
|
|
643
660
|
material: surfaceMaterial = 'surface',
|
|
661
|
+
backdrop,
|
|
662
|
+
transition,
|
|
644
663
|
panelRef,
|
|
645
664
|
testID,
|
|
646
665
|
label,
|
|
@@ -652,6 +671,7 @@ function SheetSurface({
|
|
|
652
671
|
placement,
|
|
653
672
|
shown,
|
|
654
673
|
width,
|
|
674
|
+
minSideGutter,
|
|
655
675
|
inset,
|
|
656
676
|
dismissOnBackdrop,
|
|
657
677
|
contentPadding,
|
|
@@ -664,6 +684,8 @@ function SheetSurface({
|
|
|
664
684
|
children,
|
|
665
685
|
}: {
|
|
666
686
|
material?: DialogProps['material'];
|
|
687
|
+
backdrop?: DialogProps['backdrop'];
|
|
688
|
+
transition?: DialogProps['transition'];
|
|
667
689
|
panelRef: React.RefObject<View | null>;
|
|
668
690
|
testID?: string;
|
|
669
691
|
label?: string;
|
|
@@ -675,6 +697,7 @@ function SheetSurface({
|
|
|
675
697
|
placement: DialogSidePlacement;
|
|
676
698
|
shown: boolean;
|
|
677
699
|
width: number;
|
|
700
|
+
minSideGutter?: number;
|
|
678
701
|
inset?: DialogInset;
|
|
679
702
|
dismissOnBackdrop: boolean;
|
|
680
703
|
contentPadding: number;
|
|
@@ -686,6 +709,7 @@ function SheetSurface({
|
|
|
686
709
|
style?: StyleProp<ViewStyle>;
|
|
687
710
|
children?: React.ReactNode;
|
|
688
711
|
}) {
|
|
712
|
+
const motion = useSurfaceTransition(transition);
|
|
689
713
|
const dialogMessages = useMessages(DIALOG_MESSAGES).messages;
|
|
690
714
|
const theme = useTheme();
|
|
691
715
|
const titleId = useId();
|
|
@@ -714,19 +738,19 @@ function SheetSurface({
|
|
|
714
738
|
const panelTransition = useMemo<WebCssStyle>(
|
|
715
739
|
() => ({
|
|
716
740
|
transitionProperty: 'transform, opacity',
|
|
717
|
-
transitionDuration: `${ANIMATION_DURATION}ms`,
|
|
718
|
-
transitionTimingFunction: EASE_OUT,
|
|
741
|
+
transitionDuration: `${motion.duration ?? ANIMATION_DURATION}ms`,
|
|
742
|
+
transitionTimingFunction: transition ? motion.cssEasing : EASE_OUT,
|
|
719
743
|
}),
|
|
720
|
-
[],
|
|
744
|
+
[motion.duration, motion.cssEasing, !!transition],
|
|
721
745
|
);
|
|
722
746
|
|
|
723
747
|
const backdropTransition = useMemo<WebCssStyle>(
|
|
724
748
|
() => ({
|
|
725
749
|
transitionProperty: 'opacity',
|
|
726
|
-
transitionDuration: `${ANIMATION_DURATION}ms`,
|
|
727
|
-
transitionTimingFunction: EASE_OUT,
|
|
750
|
+
transitionDuration: `${motion.duration ?? ANIMATION_DURATION}ms`,
|
|
751
|
+
transitionTimingFunction: transition ? motion.cssEasing : EASE_OUT,
|
|
728
752
|
}),
|
|
729
|
-
[],
|
|
753
|
+
[motion.duration, motion.cssEasing, !!transition],
|
|
730
754
|
);
|
|
731
755
|
|
|
732
756
|
const panelGeometry = useMemo<ViewStyle>(() => {
|
|
@@ -740,8 +764,7 @@ function SheetSurface({
|
|
|
740
764
|
const edge = physicalDialogSide(placement, rtl);
|
|
741
765
|
const anchorInset = edge === 'left' ? insetLeft : insetRight;
|
|
742
766
|
const oppositeInset = edge === 'left' ? insetRight : insetLeft;
|
|
743
|
-
const
|
|
744
|
-
const cappedWidth = Math.max(0, Math.min(width, available));
|
|
767
|
+
const cappedWidth = resolveSideSheetWidth(viewportWidth, width, anchorInset, oppositeInset, minSideGutter);
|
|
745
768
|
const hiddenSign = edge === 'left' ? '-100%' : '100%';
|
|
746
769
|
|
|
747
770
|
return {
|
|
@@ -753,7 +776,7 @@ function SheetSurface({
|
|
|
753
776
|
transform: [{ translateX: visible ? 0 : hiddenSign }],
|
|
754
777
|
opacity: visible ? 1 : 0,
|
|
755
778
|
};
|
|
756
|
-
}, [visible, placement, rtl, width, inset, viewportWidth]);
|
|
779
|
+
}, [visible, placement, rtl, width, inset, viewportWidth, minSideGutter]);
|
|
757
780
|
|
|
758
781
|
const handleBackdropPress = useCallback(() => {
|
|
759
782
|
if (dismissOnBackdrop) onDismiss();
|
|
@@ -773,6 +796,7 @@ function SheetSurface({
|
|
|
773
796
|
<OverlayRoot style={[sheetStyles.root, containerStyle]} className={containerClassName} modal>
|
|
774
797
|
<ModalKeyboard panelRef={panelRef} closing={!shown} dismissible={dismissOnBackdrop} dismiss={onDismiss} />
|
|
775
798
|
<Backdrop
|
|
799
|
+
{...backdrop}
|
|
776
800
|
testID={testID ? `${testID}-backdrop` : DIALOG_SHEET_BACKDROP_TESTID}
|
|
777
801
|
accessibilityLabel={label ? dialogMessages.dismissNamed(label) : dialogMessages.dismissDialog}
|
|
778
802
|
onPress={handleBackdropPress}
|
|
@@ -59,6 +59,8 @@ import type { DialogControlProps, DialogProps } from './types';
|
|
|
59
59
|
* - `title` / `description` / `actions` / `children` → declarative body
|
|
60
60
|
*/
|
|
61
61
|
export function DialogBottomSheet({
|
|
62
|
+
backdrop,
|
|
63
|
+
transition,
|
|
62
64
|
control,
|
|
63
65
|
open: controlledOpen,
|
|
64
66
|
startOpen,
|
|
@@ -255,6 +257,8 @@ export function DialogBottomSheet({
|
|
|
255
257
|
|
|
256
258
|
return (
|
|
257
259
|
<BottomSheet
|
|
260
|
+
backdrop={backdrop}
|
|
261
|
+
transition={transition}
|
|
258
262
|
material={surfaceMaterial}
|
|
259
263
|
accessibilityLabel={label ?? header?.title}
|
|
260
264
|
aria-labelledby={!header && title ? titleId : undefined}
|
|
@@ -386,6 +390,8 @@ const FILL_BOUNDED = { flex: 1, minHeight: 0 } as const;
|
|
|
386
390
|
*/
|
|
387
391
|
export type DialogBottomSheetProps = Pick<
|
|
388
392
|
DialogProps,
|
|
393
|
+
| 'backdrop'
|
|
394
|
+
| 'transition'
|
|
389
395
|
| 'control'
|
|
390
396
|
| 'open'
|
|
391
397
|
| 'startOpen'
|
package/src/dialog/placement.ts
CHANGED
|
@@ -110,10 +110,18 @@ export const HANDLE_RADIUS = 3;
|
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* Minimum gutter kept between a wide side-sheet and the opposite viewport edge
|
|
113
|
-
* when capping its width
|
|
113
|
+
* when capping its width by default. Callers can opt into a zero gutter.
|
|
114
114
|
*/
|
|
115
115
|
export const SIDE_SHEET_MIN_GUTTER = 24;
|
|
116
116
|
|
|
117
|
+
/** Shared native/web width cap; the gutter is separate from edge insets. */
|
|
118
|
+
export function resolveSideSheetWidth(viewportWidth: number, width: number, anchorInset: number,
|
|
119
|
+
oppositeInset: number, minSideGutter = SIDE_SHEET_MIN_GUTTER): number {
|
|
120
|
+
const gutter = Number.isFinite(minSideGutter) ? Math.max(0, minSideGutter) : SIDE_SHEET_MIN_GUTTER;
|
|
121
|
+
return Math.max(0, Math.min(width, viewportWidth - anchorInset - oppositeInset - gutter));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
117
125
|
/**
|
|
118
126
|
* Resolve a (possibly responsive) `placement` to a concrete `DialogPlacement`
|
|
119
127
|
* for the current viewport width.
|
package/src/dialog/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { BackdropAppearance } from '../overlay/types';
|
|
2
|
+
import type { SurfaceTransition } from '../motion/types';
|
|
1
3
|
import type { ReactNode } from 'react';
|
|
2
4
|
import type { ButtonIconComponent } from '../button/types';
|
|
3
5
|
import type { GestureResponderEvent, StyleProp, ViewStyle } from 'react-native';
|
|
@@ -233,6 +235,10 @@ export type DialogAction = {
|
|
|
233
235
|
export type DialogProps = React.PropsWithChildren<{
|
|
234
236
|
/** Standard optical surface, or a plain fill without refraction/sheen. Default surface. */
|
|
235
237
|
material?: 'surface' | 'flat';
|
|
238
|
+
/** Backdrop paint; the surface continues to own dismissal and layering. */
|
|
239
|
+
backdrop?: BackdropAppearance;
|
|
240
|
+
/** Opt-in timing for panel and backdrop. Live reduced motion settles immediately. */
|
|
241
|
+
transition?: SurfaceTransition;
|
|
236
242
|
/** Content owns paint and motion; shared overlay, focus and dismissal remain. */
|
|
237
243
|
presentation?: 'default' | 'custom';
|
|
238
244
|
/** Custom presentation exit lifetime, in milliseconds. */
|
|
@@ -272,6 +278,8 @@ export type DialogProps = React.PropsWithChildren<{
|
|
|
272
278
|
placement?: ResponsiveDialogPlacement;
|
|
273
279
|
/** Side-sheet width (px) on wide screens. Defaults to `460`. */
|
|
274
280
|
width?: number;
|
|
281
|
+
/** Minimum space beyond a side sheet and its insets. Defaults to 24; zero permits full viewport width. */
|
|
282
|
+
minSideGutter?: number;
|
|
275
283
|
/** Centered-card max width (px). Defaults to `480`. */
|
|
276
284
|
maxWidth?: number;
|
|
277
285
|
/** Bottom-sheet max height as a fraction of the viewport height. Defaults to `0.9`. */
|
package/src/index.ts
CHANGED
package/src/index.web.ts
CHANGED
package/src/motion/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ScaleAndFadeIn, ScaleAndFadeOut, ShrinkAndPop } from './motion';
|
|
2
2
|
export { ScreenTransition } from './ScreenTransition';
|
|
3
|
-
export type { ScreenTransitionProps, ScreenTransitionDirection } from './types';
|
|
3
|
+
export type { ScreenTransitionProps, ScreenTransitionDirection, SurfaceTransition } from './types';
|
|
4
4
|
export { MOTION_RECIPES, animateMotion } from './recipes';
|
|
5
5
|
export type { MotionIntent } from './recipes';
|
package/src/motion/index.web.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
export { ScaleAndFadeIn, ScaleAndFadeOut, ShrinkAndPop } from './motion.web';
|
|
7
7
|
export { ScreenTransition } from './ScreenTransition';
|
|
8
|
-
export type { ScreenTransitionProps, ScreenTransitionDirection } from './types';
|
|
8
|
+
export type { ScreenTransitionProps, ScreenTransitionDirection, SurfaceTransition } from './types';
|
|
9
9
|
export { MOTION_RECIPES, animateMotion } from './recipes';
|
|
10
10
|
export type { MotionIntent } from './recipes';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SurfaceTransition } from './types';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_EASING = [0.25, 0.1, 0.25, 1] as const;
|
|
4
|
+
/** Keeps identical CSS/Reanimated timing; invalid values preserve safe defaults. */
|
|
5
|
+
export function resolveSurfaceTransition(transition: SurfaceTransition | undefined) {
|
|
6
|
+
const candidate = transition?.easing;
|
|
7
|
+
const easing = candidate?.length === 4 && candidate.every(Number.isFinite)
|
|
8
|
+
&& candidate[0] >= 0 && candidate[0] <= 1 && candidate[2] >= 0 && candidate[2] <= 1
|
|
9
|
+
? candidate : DEFAULT_EASING;
|
|
10
|
+
return {
|
|
11
|
+
duration: Number.isFinite(transition?.duration) ? Math.max(0, transition!.duration) : 300,
|
|
12
|
+
easing,
|
|
13
|
+
cssEasing: `cubic-bezier(${easing.join(', ')})`,
|
|
14
|
+
};
|
|
15
|
+
}
|