@oxyhq/bloom 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +54 -16
  2. package/lib/commonjs/dialog/Dialog.js +7 -7
  3. package/lib/commonjs/dialog/Dialog.js.map +1 -1
  4. package/lib/commonjs/dialog/Dialog.web.js +9 -5
  5. package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
  6. package/lib/commonjs/dialog/DialogBottomSheet.js +18 -7
  7. package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
  8. package/lib/commonjs/dialog/placement.js +12 -1
  9. package/lib/commonjs/dialog/placement.js.map +1 -1
  10. package/lib/commonjs/theme/index.js +7 -0
  11. package/lib/commonjs/theme/index.js.map +1 -1
  12. package/lib/commonjs/theme/use-navigation-theme.js +54 -0
  13. package/lib/commonjs/theme/use-navigation-theme.js.map +1 -0
  14. package/lib/module/dialog/Dialog.js +8 -8
  15. package/lib/module/dialog/Dialog.js.map +1 -1
  16. package/lib/module/dialog/Dialog.web.js +10 -6
  17. package/lib/module/dialog/Dialog.web.js.map +1 -1
  18. package/lib/module/dialog/DialogBottomSheet.js +19 -8
  19. package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
  20. package/lib/module/dialog/placement.js +11 -0
  21. package/lib/module/dialog/placement.js.map +1 -1
  22. package/lib/module/theme/index.js +1 -0
  23. package/lib/module/theme/index.js.map +1 -1
  24. package/lib/module/theme/use-navigation-theme.js +50 -0
  25. package/lib/module/theme/use-navigation-theme.js.map +1 -0
  26. package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
  27. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts +2 -2
  29. package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/dialog/placement.d.ts +10 -0
  31. package/lib/typescript/commonjs/dialog/placement.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/dialog/types.d.ts +12 -0
  33. package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
  34. package/lib/typescript/commonjs/theme/index.d.ts +2 -0
  35. package/lib/typescript/commonjs/theme/index.d.ts.map +1 -1
  36. package/lib/typescript/commonjs/theme/use-navigation-theme.d.ts +31 -0
  37. package/lib/typescript/commonjs/theme/use-navigation-theme.d.ts.map +1 -0
  38. package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
  39. package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
  40. package/lib/typescript/module/dialog/DialogBottomSheet.d.ts +2 -2
  41. package/lib/typescript/module/dialog/DialogBottomSheet.d.ts.map +1 -1
  42. package/lib/typescript/module/dialog/placement.d.ts +10 -0
  43. package/lib/typescript/module/dialog/placement.d.ts.map +1 -1
  44. package/lib/typescript/module/dialog/types.d.ts +12 -0
  45. package/lib/typescript/module/dialog/types.d.ts.map +1 -1
  46. package/lib/typescript/module/theme/index.d.ts +2 -0
  47. package/lib/typescript/module/theme/index.d.ts.map +1 -1
  48. package/lib/typescript/module/theme/use-navigation-theme.d.ts +31 -0
  49. package/lib/typescript/module/theme/use-navigation-theme.d.ts.map +1 -0
  50. package/package.json +1 -1
  51. package/src/__tests__/DialogBottomSheet.test.tsx +129 -0
  52. package/src/__tests__/public-api-contract.test.ts +42 -0
  53. package/src/dialog/Dialog.tsx +7 -5
  54. package/src/dialog/Dialog.web.tsx +10 -5
  55. package/src/dialog/DialogBottomSheet.tsx +22 -7
  56. package/src/dialog/placement.ts +11 -0
  57. package/src/dialog/types.ts +12 -0
  58. package/src/theme/index.ts +2 -0
  59. package/src/theme/use-navigation-theme.ts +59 -0
@@ -134,6 +134,18 @@ export type DialogProps = React.PropsWithChildren<{
134
134
  inset?: DialogInset;
135
135
  /** Whether to render the drag handle in bottom-sheet mode. Defaults to `true`. */
136
136
  showHandle?: boolean;
137
+ /**
138
+ * Inner padding (px) of the dialog content container, applied uniformly across
139
+ * every placement (centered panel, side-sheet body, bottom-sheet body).
140
+ * Defaults to `20`.
141
+ *
142
+ * The default chrome padding is correct for the declarative
143
+ * `title`/`description`/`actions` layout, but a host passing pure custom
144
+ * `children` that already own their insets can set `contentPadding={0}` to
145
+ * render flush content and manage padding itself. Omitting the prop keeps the
146
+ * 20px default on every surface.
147
+ */
148
+ contentPadding?: number;
137
149
  /** Whether tapping the backdrop dismisses the dialog. Defaults to `true`. */
138
150
  dismissOnBackdrop?: boolean;
139
151
  /**
@@ -7,6 +7,8 @@ export { BloomColorScope, useColorScopeStyle } from './color-scope';
7
7
  export type { BloomColorScopeProps } from './color-scope';
8
8
  export { buildTheme, STATUS_COLORS } from './build-theme';
9
9
  export { useTheme, useThemeColor, useBloomTheme } from './use-theme';
10
+ export { useNavigationTheme } from './use-navigation-theme';
11
+ export type { NavigationTheme, NavigationThemeFont } from './use-navigation-theme';
10
12
  export type { Theme, ThemeColors, ThemeMode } from './types';
11
13
  export type { AppColorName, AppColorPreset, PresetTokens } from './color-presets';
12
14
  export {
@@ -0,0 +1,59 @@
1
+ import { useMemo } from 'react';
2
+ import { useTheme } from './use-theme';
3
+
4
+ export interface NavigationThemeFont {
5
+ fontFamily: string;
6
+ fontWeight: '400' | '500' | '700' | '900';
7
+ }
8
+
9
+ export interface NavigationTheme {
10
+ dark: boolean;
11
+ colors: {
12
+ primary: string;
13
+ background: string;
14
+ card: string;
15
+ text: string;
16
+ border: string;
17
+ notification: string;
18
+ };
19
+ fonts: {
20
+ regular: NavigationThemeFont;
21
+ medium: NavigationThemeFont;
22
+ bold: NavigationThemeFont;
23
+ heavy: NavigationThemeFont;
24
+ };
25
+ }
26
+
27
+ const NAV_FONTS: NavigationTheme['fonts'] = {
28
+ regular: { fontFamily: 'System', fontWeight: '400' },
29
+ medium: { fontFamily: 'System', fontWeight: '500' },
30
+ bold: { fontFamily: 'System', fontWeight: '700' },
31
+ heavy: { fontFamily: 'System', fontWeight: '900' },
32
+ };
33
+
34
+ /**
35
+ * Projects Bloom's resolved theme into a react-navigation `Theme` POJO for
36
+ * expo-router's <ThemeProvider>. Keeps Bloom the single source of truth for
37
+ * navigator chrome (Stack headers, screen backgrounds, modal) so it tracks
38
+ * the active color preset. Returns a structural object — no react-navigation
39
+ * import — so Bloom stays decoupled. Replaces the per-app copies in
40
+ * test-app-expo / inbox / accounts.
41
+ */
42
+ export function useNavigationTheme(): NavigationTheme {
43
+ const { mode, colors } = useTheme();
44
+ return useMemo(
45
+ () => ({
46
+ dark: mode === 'dark',
47
+ colors: {
48
+ primary: colors.primary,
49
+ background: colors.background,
50
+ card: colors.card,
51
+ text: colors.text,
52
+ border: colors.border,
53
+ notification: colors.error,
54
+ },
55
+ fonts: NAV_FONTS,
56
+ }),
57
+ [mode, colors],
58
+ );
59
+ }