@oxyhq/bloom 0.13.0 → 0.14.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/lib/commonjs/index.js +15 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +21 -6
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.js +300 -0
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.js.map +1 -0
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.native.js +226 -0
- package/lib/commonjs/responsive-sheet/ResponsiveSheet.native.js.map +1 -0
- package/lib/commonjs/responsive-sheet/const.js +60 -0
- package/lib/commonjs/responsive-sheet/const.js.map +1 -0
- package/lib/commonjs/responsive-sheet/index.js +19 -0
- package/lib/commonjs/responsive-sheet/index.js.map +1 -0
- package/lib/commonjs/responsive-sheet/index.web.js +19 -0
- package/lib/commonjs/responsive-sheet/index.web.js.map +1 -0
- package/lib/commonjs/responsive-sheet/types.js +6 -0
- package/lib/commonjs/responsive-sheet/types.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +2 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/responsive-sheet/ResponsiveSheet.js +293 -0
- package/lib/module/responsive-sheet/ResponsiveSheet.js.map +1 -0
- package/lib/module/responsive-sheet/ResponsiveSheet.native.js +219 -0
- package/lib/module/responsive-sheet/ResponsiveSheet.native.js.map +1 -0
- package/lib/module/responsive-sheet/const.js +56 -0
- package/lib/module/responsive-sheet/const.js.map +1 -0
- package/lib/module/responsive-sheet/index.js +4 -0
- package/lib/module/responsive-sheet/index.js.map +1 -0
- package/lib/module/responsive-sheet/index.web.js +14 -0
- package/lib/module/responsive-sheet/index.web.js.map +1 -0
- package/lib/module/responsive-sheet/types.js +4 -0
- package/lib/module/responsive-sheet/types.js.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +2 -0
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts +26 -0
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.native.d.ts +20 -0
- package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/responsive-sheet/const.d.ts +43 -0
- package/lib/typescript/commonjs/responsive-sheet/const.d.ts.map +1 -0
- package/lib/typescript/commonjs/responsive-sheet/index.d.ts +3 -0
- package/lib/typescript/commonjs/responsive-sheet/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts +3 -0
- package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/responsive-sheet/types.d.ts +55 -0
- package/lib/typescript/commonjs/responsive-sheet/types.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +2 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +2 -0
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts +26 -0
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts.map +1 -0
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.native.d.ts +20 -0
- package/lib/typescript/module/responsive-sheet/ResponsiveSheet.native.d.ts.map +1 -0
- package/lib/typescript/module/responsive-sheet/const.d.ts +43 -0
- package/lib/typescript/module/responsive-sheet/const.d.ts.map +1 -0
- package/lib/typescript/module/responsive-sheet/index.d.ts +3 -0
- package/lib/typescript/module/responsive-sheet/index.d.ts.map +1 -0
- package/lib/typescript/module/responsive-sheet/index.web.d.ts +3 -0
- package/lib/typescript/module/responsive-sheet/index.web.d.ts.map +1 -0
- package/lib/typescript/module/responsive-sheet/types.d.ts +55 -0
- package/lib/typescript/module/responsive-sheet/types.d.ts.map +1 -0
- package/package.json +18 -1
- package/src/__tests__/ResponsiveSheet.test.tsx +104 -0
- package/src/index.ts +8 -0
- package/src/index.web.ts +8 -0
- package/src/responsive-sheet/ResponsiveSheet.native.tsx +257 -0
- package/src/responsive-sheet/ResponsiveSheet.stories.tsx +54 -0
- package/src/responsive-sheet/ResponsiveSheet.tsx +327 -0
- package/src/responsive-sheet/const.ts +53 -0
- package/src/responsive-sheet/index.ts +6 -0
- package/src/responsive-sheet/index.web.ts +16 -0
- package/src/responsive-sheet/types.ts +57 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared default constants for `ResponsiveSheet`.
|
|
3
|
+
*
|
|
4
|
+
* Platform-agnostic — imported by both the default/web CSS implementation
|
|
5
|
+
* (`ResponsiveSheet.tsx`) and the native reanimated implementation
|
|
6
|
+
* (`ResponsiveSheet.native.tsx`) so the two variants stay in lockstep.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** Below this viewport width the sheet renders as a bottom-sheet. */
|
|
10
|
+
export const DEFAULT_BREAKPOINT = 768;
|
|
11
|
+
|
|
12
|
+
/** Side-sheet width (px) on wide screens. Capped to fit the viewport. */
|
|
13
|
+
export const DEFAULT_WIDTH = 460;
|
|
14
|
+
|
|
15
|
+
/** Bottom-sheet maximum height as a fraction of the viewport height. */
|
|
16
|
+
export const DEFAULT_MAX_HEIGHT_RATIO = 0.9;
|
|
17
|
+
|
|
18
|
+
/** Anchored edge of the side-sheet on wide screens. */
|
|
19
|
+
export const DEFAULT_SIDE = 'left' as const;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Open/close transition duration (ms). ~280–300ms ease-out reads as smooth
|
|
23
|
+
* without feeling sluggish; shared by the CSS transition and the native
|
|
24
|
+
* reanimated timing so both platforms match.
|
|
25
|
+
*/
|
|
26
|
+
export const ANIMATION_DURATION = 280;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Standard CSS approximation of reanimated's `Easing.out(Easing.cubic)` so the
|
|
30
|
+
* web transition curve matches the native one.
|
|
31
|
+
*/
|
|
32
|
+
export const EASE_OUT = 'cubic-bezier(0.33, 1, 0.68, 1)';
|
|
33
|
+
|
|
34
|
+
/** Corner radius for the side-sheet panel and the top of the bottom-sheet. */
|
|
35
|
+
export const PANEL_RADIUS = 20;
|
|
36
|
+
|
|
37
|
+
/** Backdrop dim opacity once fully shown (matches `bg-black/40`). */
|
|
38
|
+
export const BACKDROP_OPACITY = 0.4;
|
|
39
|
+
|
|
40
|
+
/** Drag-handle pill geometry for the bottom-sheet. */
|
|
41
|
+
export const HANDLE_WIDTH = 36;
|
|
42
|
+
export const HANDLE_HEIGHT = 5;
|
|
43
|
+
export const HANDLE_RADIUS = 3;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Minimum gutter kept between a wide side-sheet and the opposite viewport edge
|
|
47
|
+
* when capping its width, so the panel never spans the full screen on a narrow
|
|
48
|
+
* desktop window that is still above the breakpoint.
|
|
49
|
+
*/
|
|
50
|
+
export const SIDE_SHEET_MIN_GUTTER = 24;
|
|
51
|
+
|
|
52
|
+
/** A11y label fallback when the host does not provide one. */
|
|
53
|
+
export const DEFAULT_LABEL = 'Sheet';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Web variant of the `./responsive-sheet` barrel.
|
|
2
|
+
//
|
|
3
|
+
// The default barrel (`./index.ts`) re-exports from `./ResponsiveSheet`, which
|
|
4
|
+
// is itself the reanimated-free web/CSS implementation — Metro additionally
|
|
5
|
+
// resolves `./ResponsiveSheet.native` for native targets. Web bundlers select
|
|
6
|
+
// THIS file via the `"browser"` export condition in `package.json`'s
|
|
7
|
+
// `exports['./responsive-sheet']`, pointing them explicitly at the CSS
|
|
8
|
+
// implementation so a non-Metro bundler never follows the `.native` sibling
|
|
9
|
+
// (which statically imports `react-native-reanimated`, a native-only module).
|
|
10
|
+
// Types are platform-agnostic, so they come straight from `./types`.
|
|
11
|
+
export { ResponsiveSheet, RESPONSIVE_SHEET_BACKDROP_TESTID } from './ResponsiveSheet';
|
|
12
|
+
export type {
|
|
13
|
+
ResponsiveSheetProps,
|
|
14
|
+
ResponsiveSheetSide,
|
|
15
|
+
ResponsiveSheetInset,
|
|
16
|
+
} from './types';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/** Edge a wide-screen side-sheet anchors to. */
|
|
5
|
+
export type ResponsiveSheetSide = 'left' | 'right';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Inset (px) of the wide-screen side-sheet from its container edges. Lets a
|
|
9
|
+
* host place the sheet "inside its own shell" — e.g. offset from the top by a
|
|
10
|
+
* header, or from the left by a nav rail — with margins on every side.
|
|
11
|
+
*/
|
|
12
|
+
export interface ResponsiveSheetInset {
|
|
13
|
+
top?: number;
|
|
14
|
+
bottom?: number;
|
|
15
|
+
left?: number;
|
|
16
|
+
right?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A responsive overlay sheet: an anchored side-sheet on wide screens and a
|
|
21
|
+
* bottom-sheet (with drag handle) on small screens, switching by viewport
|
|
22
|
+
* width. It is a plain controlled component — the host drives `open`/`onClose`
|
|
23
|
+
* from its own state. It renders in place (no portal) so the host can scope it
|
|
24
|
+
* inside a themed/positioned subtree.
|
|
25
|
+
*/
|
|
26
|
+
export interface ResponsiveSheetProps {
|
|
27
|
+
/** Whether the sheet is open. Controlled by the host. */
|
|
28
|
+
open: boolean;
|
|
29
|
+
/** Fired when the sheet requests to close (backdrop tap, Escape on web). */
|
|
30
|
+
onClose: () => void;
|
|
31
|
+
/** Anchor edge on wide screens. Defaults to `'left'`. */
|
|
32
|
+
side?: ResponsiveSheetSide;
|
|
33
|
+
/** Viewport width (px) below which the sheet renders as a bottom-sheet. Defaults to `768`. */
|
|
34
|
+
breakpoint?: number;
|
|
35
|
+
/** Side-sheet width (px) on wide screens. Capped to fit. Defaults to `460`. */
|
|
36
|
+
width?: number;
|
|
37
|
+
/** Bottom-sheet max height as a fraction of the viewport height. Defaults to `0.9`. */
|
|
38
|
+
maxHeightRatio?: number;
|
|
39
|
+
/** Side-sheet inset (px) from the container edges. Defaults to `0` on all sides. */
|
|
40
|
+
inset?: ResponsiveSheetInset;
|
|
41
|
+
/** Whether to render the drag handle in bottom-sheet mode. Defaults to `true`. */
|
|
42
|
+
showHandle?: boolean;
|
|
43
|
+
/** Whether tapping the backdrop closes the sheet. Defaults to `true`. */
|
|
44
|
+
dismissOnBackdrop?: boolean;
|
|
45
|
+
/** Style for the panel surface (e.g. brand color). Composed after defaults. */
|
|
46
|
+
panelStyle?: StyleProp<ViewStyle>;
|
|
47
|
+
/** NativeWind classes for the panel surface. */
|
|
48
|
+
panelClassName?: string;
|
|
49
|
+
/** Style for the root overlay (theme-var scope, rail offset, etc.). */
|
|
50
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
51
|
+
/** NativeWind classes for the root overlay (e.g. `"md:left-[4.75rem]"`). */
|
|
52
|
+
containerClassName?: string;
|
|
53
|
+
/** Accessibility label for the sheet panel and the backdrop dismiss button. */
|
|
54
|
+
label?: string;
|
|
55
|
+
/** Sheet content. */
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
}
|