@oxyhq/bloom 0.11.0 → 0.12.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 (67) hide show
  1. package/lib/commonjs/fab/Fab.js +199 -0
  2. package/lib/commonjs/fab/Fab.js.map +1 -0
  3. package/lib/commonjs/fab/Fab.web.js +246 -0
  4. package/lib/commonjs/fab/Fab.web.js.map +1 -0
  5. package/lib/commonjs/fab/index.js +13 -0
  6. package/lib/commonjs/fab/index.js.map +1 -0
  7. package/lib/commonjs/fab/index.web.js +13 -0
  8. package/lib/commonjs/fab/index.web.js.map +1 -0
  9. package/lib/commonjs/fab/types.js +6 -0
  10. package/lib/commonjs/fab/types.js.map +1 -0
  11. package/lib/commonjs/index.js +8 -0
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/index.web.js +24 -16
  14. package/lib/commonjs/index.web.js.map +1 -1
  15. package/lib/module/fab/Fab.js +194 -0
  16. package/lib/module/fab/Fab.js.map +1 -0
  17. package/lib/module/fab/Fab.web.js +241 -0
  18. package/lib/module/fab/Fab.web.js.map +1 -0
  19. package/lib/module/fab/index.js +4 -0
  20. package/lib/module/fab/index.js.map +1 -0
  21. package/lib/module/fab/index.web.js +14 -0
  22. package/lib/module/fab/index.web.js.map +1 -0
  23. package/lib/module/fab/types.js +4 -0
  24. package/lib/module/fab/types.js.map +1 -0
  25. package/lib/module/index.js +1 -0
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/index.web.js +1 -0
  28. package/lib/module/index.web.js.map +1 -1
  29. package/lib/typescript/commonjs/fab/Fab.d.ts +5 -0
  30. package/lib/typescript/commonjs/fab/Fab.d.ts.map +1 -0
  31. package/lib/typescript/commonjs/fab/Fab.web.d.ts +5 -0
  32. package/lib/typescript/commonjs/fab/Fab.web.d.ts.map +1 -0
  33. package/lib/typescript/commonjs/fab/index.d.ts +3 -0
  34. package/lib/typescript/commonjs/fab/index.d.ts.map +1 -0
  35. package/lib/typescript/commonjs/fab/index.web.d.ts +3 -0
  36. package/lib/typescript/commonjs/fab/index.web.d.ts.map +1 -0
  37. package/lib/typescript/commonjs/fab/types.d.ts +99 -0
  38. package/lib/typescript/commonjs/fab/types.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/index.d.ts +2 -0
  40. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  41. package/lib/typescript/commonjs/index.web.d.ts +2 -0
  42. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  43. package/lib/typescript/module/fab/Fab.d.ts +5 -0
  44. package/lib/typescript/module/fab/Fab.d.ts.map +1 -0
  45. package/lib/typescript/module/fab/Fab.web.d.ts +5 -0
  46. package/lib/typescript/module/fab/Fab.web.d.ts.map +1 -0
  47. package/lib/typescript/module/fab/index.d.ts +3 -0
  48. package/lib/typescript/module/fab/index.d.ts.map +1 -0
  49. package/lib/typescript/module/fab/index.web.d.ts +3 -0
  50. package/lib/typescript/module/fab/index.web.d.ts.map +1 -0
  51. package/lib/typescript/module/fab/types.d.ts +99 -0
  52. package/lib/typescript/module/fab/types.d.ts.map +1 -0
  53. package/lib/typescript/module/index.d.ts +2 -0
  54. package/lib/typescript/module/index.d.ts.map +1 -1
  55. package/lib/typescript/module/index.web.d.ts +2 -0
  56. package/lib/typescript/module/index.web.d.ts.map +1 -1
  57. package/package.json +17 -1
  58. package/src/__tests__/Fab.test.tsx +76 -0
  59. package/src/__tests__/Fab.web.test.tsx +114 -0
  60. package/src/fab/Fab.stories.tsx +71 -0
  61. package/src/fab/Fab.tsx +189 -0
  62. package/src/fab/Fab.web.tsx +258 -0
  63. package/src/fab/index.ts +2 -0
  64. package/src/fab/index.web.ts +12 -0
  65. package/src/fab/types.ts +125 -0
  66. package/src/index.ts +2 -0
  67. package/src/index.web.ts +2 -0
@@ -0,0 +1,125 @@
1
+ import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
2
+
3
+ /**
4
+ * Visual style of the FAB.
5
+ *
6
+ * - `primary` — filled with the brand `primary` token + `primaryForeground`
7
+ * icon/label. The default; the high-emphasis floating action.
8
+ * - `secondary`— filled with the `card`/surface token + `text` foreground.
9
+ * A lower-emphasis FAB that still reads as elevated.
10
+ * - `surface` — alias of `secondary`, named for Material-style "surface" FABs.
11
+ */
12
+ export type FabVariant = 'primary' | 'secondary' | 'surface';
13
+
14
+ /**
15
+ * FAB sizes, matching Material-ish conventions but in Bloom's scale:
16
+ * - `small` — 40px (compact / dense layouts)
17
+ * - `medium` — 56px (the canonical FAB; the default)
18
+ * - `large` — 64px (high-prominence primary action)
19
+ *
20
+ * In the `extended` variant the height tracks the size but the FAB grows
21
+ * horizontally to fit its icon + label as a pill.
22
+ */
23
+ export type FabSize = 'small' | 'medium' | 'large';
24
+
25
+ /**
26
+ * Where the FAB anchors itself.
27
+ *
28
+ * - `bottom-right` (default) / `bottom-left` / `top-right` / `top-left` —
29
+ * the FAB pins itself to that corner of its CONTAINING block. On web this
30
+ * uses `position: sticky` so it tracks the bottom of the scrolling column
31
+ * (NOT the viewport edge), which is exactly what a constrained multi-column
32
+ * app layout needs. On native it uses `position: absolute` within the
33
+ * nearest positioned ancestor.
34
+ * - `static` — no positioning at all. The FAB is laid out inline and the
35
+ * consumer is fully responsible for placement (e.g. wrapping it in their
36
+ * own absolutely/sticky-positioned container). Use this when you need
37
+ * custom containment.
38
+ *
39
+ * CRITICAL: the positioned placements DO NOT use web `position: fixed` and are
40
+ * never anchored to the viewport. They stay inside the containing column so the
41
+ * FAB never escapes a constrained 3-column app layout and sits over a side rail.
42
+ */
43
+ export type FabPlacement =
44
+ | 'bottom-right'
45
+ | 'bottom-left'
46
+ | 'top-right'
47
+ | 'top-left'
48
+ | 'static';
49
+
50
+ export interface FabProps {
51
+ /** Press handler. */
52
+ onPress?: () => void;
53
+
54
+ /**
55
+ * The icon to render inside the FAB. Typically a Bloom icon element
56
+ * (`<Icons.Plus .../>`). For an icon-only FAB this is the whole content; for
57
+ * the extended variant it sits to the left of the `label`.
58
+ *
59
+ * `children` is accepted as an alias/override of `icon` for ergonomics — if
60
+ * both are given, `icon` wins and `children` is ignored.
61
+ */
62
+ icon?: React.ReactNode;
63
+ children?: React.ReactNode;
64
+
65
+ /**
66
+ * When provided, renders the EXTENDED FAB: a pill with the icon followed by
67
+ * this text label. Omit for the canonical circular icon FAB.
68
+ */
69
+ label?: string;
70
+
71
+ variant?: FabVariant;
72
+ size?: FabSize;
73
+
74
+ /**
75
+ * Corner of the containing block to anchor to. Defaults to `'bottom-right'`.
76
+ * See {@link FabPlacement}. The DEFAULT never escapes the containing column
77
+ * (web uses `position: sticky`, native uses `position: absolute`).
78
+ */
79
+ placement?: FabPlacement;
80
+
81
+ /**
82
+ * Distance (in px) from the anchored edges. Applies to whichever edges the
83
+ * `placement` pins to. Defaults to `16`.
84
+ */
85
+ offset?: number;
86
+
87
+ disabled?: boolean;
88
+
89
+ /** Required for icon-only FABs so screen readers announce the action. */
90
+ accessibilityLabel?: string;
91
+ accessibilityHint?: string;
92
+
93
+ /** Container style override (merged last). */
94
+ style?: StyleProp<ViewStyle>;
95
+ /** Extended-FAB label text style override. */
96
+ labelStyle?: StyleProp<TextStyle>;
97
+ /** NativeWind / DOM className passthrough. */
98
+ className?: string;
99
+ testID?: string;
100
+
101
+ /**
102
+ * Hard `zIndex` override. Defaults to a high value so the FAB floats above
103
+ * scrolling content.
104
+ */
105
+ zIndex?: number;
106
+
107
+ // -------------------------------------------------------------------------
108
+ // Web-only props
109
+ //
110
+ // No-ops in the native (`Pressable`) implementation — present on the shared
111
+ // type so a single `<Fab>` call site type-checks on both platforms. The web
112
+ // fork (`Fab.web.tsx`) renders a real DOM element and consumes them.
113
+ // -------------------------------------------------------------------------
114
+
115
+ /** Web click handler. Fires together with `onPress`. */
116
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
117
+ /** `aria-label` (web only). Falls back to `accessibilityLabel`. */
118
+ 'aria-label'?: string;
119
+ /** `title` tooltip attribute (web only). */
120
+ title?: string;
121
+ /** Inline DOM `id` (web only). */
122
+ id?: string;
123
+ /** HTML button `type` (web only). Defaults to `'button'`. */
124
+ type?: 'button' | 'submit' | 'reset';
125
+ }
package/src/index.ts CHANGED
@@ -38,6 +38,8 @@ export type {
38
38
  DialogProps,
39
39
  } from './dialog';
40
40
  export * from './button';
41
+ export { Fab } from './fab';
42
+ export type { FabProps, FabVariant, FabSize, FabPlacement } from './fab';
41
43
  export * from './grouped-buttons';
42
44
  export * from './divider';
43
45
  export * from './radio-indicator';
package/src/index.web.ts CHANGED
@@ -43,6 +43,8 @@ export type {
43
43
  DialogProps,
44
44
  } from './dialog/index.web';
45
45
  export * from './button/index.web';
46
+ export { Fab } from './fab/index.web';
47
+ export type { FabProps, FabVariant, FabSize, FabPlacement } from './fab/index.web';
46
48
  export * from './grouped-buttons';
47
49
  export * from './divider';
48
50
  export * from './radio-indicator';