@oxyhq/bloom 0.11.0 → 0.12.1

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 +202 -0
  2. package/lib/commonjs/fab/Fab.js.map +1 -0
  3. package/lib/commonjs/fab/Fab.web.js +260 -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 +197 -0
  16. package/lib/module/fab/Fab.js.map +1 -0
  17. package/lib/module/fab/Fab.web.js +255 -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 +103 -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 +103 -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 +127 -0
  60. package/src/fab/Fab.stories.tsx +71 -0
  61. package/src/fab/Fab.tsx +192 -0
  62. package/src/fab/Fab.web.tsx +272 -0
  63. package/src/fab/index.ts +2 -0
  64. package/src/fab/index.web.ts +12 -0
  65. package/src/fab/types.ts +129 -0
  66. package/src/index.ts +2 -0
  67. package/src/index.web.ts +2 -0
@@ -0,0 +1,129 @@
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, never the
30
+ * viewport. On native it uses `position: absolute` within the nearest
31
+ * positioned ancestor. On web a `bottom-*` placement combines
32
+ * `margin-top: auto` (pins to the bottom of a flex COLUMN even when the
33
+ * content is short / not scrolling) with `position: sticky; bottom` (keeps
34
+ * it visible while a tall column scrolls). The consumer column MUST be a
35
+ * flex column that fills the available height and the FAB MUST be its last
36
+ * child.
37
+ * - `static` — no positioning at all. The FAB is laid out inline and the
38
+ * consumer is fully responsible for placement (e.g. wrapping it in their
39
+ * own absolutely/sticky-positioned container). Use this when you need
40
+ * custom containment.
41
+ *
42
+ * CRITICAL: the positioned placements DO NOT use web `position: fixed` and are
43
+ * never anchored to the viewport. They stay inside the containing column so the
44
+ * FAB never escapes a constrained 3-column app layout and sits over a side rail,
45
+ * and never float mid-column when the content is short.
46
+ */
47
+ export type FabPlacement =
48
+ | 'bottom-right'
49
+ | 'bottom-left'
50
+ | 'top-right'
51
+ | 'top-left'
52
+ | 'static';
53
+
54
+ export interface FabProps {
55
+ /** Press handler. */
56
+ onPress?: () => void;
57
+
58
+ /**
59
+ * The icon to render inside the FAB. Typically a Bloom icon element
60
+ * (`<Icons.Plus .../>`). For an icon-only FAB this is the whole content; for
61
+ * the extended variant it sits to the left of the `label`.
62
+ *
63
+ * `children` is accepted as an alias/override of `icon` for ergonomics — if
64
+ * both are given, `icon` wins and `children` is ignored.
65
+ */
66
+ icon?: React.ReactNode;
67
+ children?: React.ReactNode;
68
+
69
+ /**
70
+ * When provided, renders the EXTENDED FAB: a pill with the icon followed by
71
+ * this text label. Omit for the canonical circular icon FAB.
72
+ */
73
+ label?: string;
74
+
75
+ variant?: FabVariant;
76
+ size?: FabSize;
77
+
78
+ /**
79
+ * Corner of the containing block to anchor to. Defaults to `'bottom-right'`.
80
+ * See {@link FabPlacement}. The DEFAULT never escapes the containing column
81
+ * (web uses `position: sticky`, native uses `position: absolute`).
82
+ */
83
+ placement?: FabPlacement;
84
+
85
+ /**
86
+ * Distance (in px) from the anchored edges. Applies to whichever edges the
87
+ * `placement` pins to. Defaults to `16`.
88
+ */
89
+ offset?: number;
90
+
91
+ disabled?: boolean;
92
+
93
+ /** Required for icon-only FABs so screen readers announce the action. */
94
+ accessibilityLabel?: string;
95
+ accessibilityHint?: string;
96
+
97
+ /** Container style override (merged last). */
98
+ style?: StyleProp<ViewStyle>;
99
+ /** Extended-FAB label text style override. */
100
+ labelStyle?: StyleProp<TextStyle>;
101
+ /** NativeWind / DOM className passthrough. */
102
+ className?: string;
103
+ testID?: string;
104
+
105
+ /**
106
+ * Hard `zIndex` override. Defaults to a high value so the FAB floats above
107
+ * scrolling content.
108
+ */
109
+ zIndex?: number;
110
+
111
+ // -------------------------------------------------------------------------
112
+ // Web-only props
113
+ //
114
+ // No-ops in the native (`Pressable`) implementation — present on the shared
115
+ // type so a single `<Fab>` call site type-checks on both platforms. The web
116
+ // fork (`Fab.web.tsx`) renders a real DOM element and consumes them.
117
+ // -------------------------------------------------------------------------
118
+
119
+ /** Web click handler. Fires together with `onPress`. */
120
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
121
+ /** `aria-label` (web only). Falls back to `accessibilityLabel`. */
122
+ 'aria-label'?: string;
123
+ /** `title` tooltip attribute (web only). */
124
+ title?: string;
125
+ /** Inline DOM `id` (web only). */
126
+ id?: string;
127
+ /** HTML button `type` (web only). Defaults to `'button'`. */
128
+ type?: 'button' | 'submit' | 'reset';
129
+ }
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';