@oxy.so/bloom 1.0.6 → 1.0.7

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 (58) hide show
  1. package/docs/theme.mdx +19 -0
  2. package/docs/user-hover-card.mdx +59 -10
  3. package/lib/commonjs/avatar-group/AvatarGroup.web.js +4 -1
  4. package/lib/commonjs/avatar-group/AvatarGroup.web.js.map +1 -1
  5. package/lib/commonjs/theme/BloomThemeProvider.js +2 -0
  6. package/lib/commonjs/theme/BloomThemeProvider.js.map +1 -1
  7. package/lib/commonjs/theme/apply-dark-class.js +37 -0
  8. package/lib/commonjs/theme/apply-dark-class.js.map +1 -1
  9. package/lib/commonjs/user-hover-card/UserHoverCard.js +33 -12
  10. package/lib/commonjs/user-hover-card/UserHoverCard.js.map +1 -1
  11. package/lib/commonjs/user-hover-card/constants.js +45 -0
  12. package/lib/commonjs/user-hover-card/constants.js.map +1 -0
  13. package/lib/commonjs/user-hover-card/index.js +19 -0
  14. package/lib/commonjs/user-hover-card/index.js.map +1 -1
  15. package/lib/module/avatar-group/AvatarGroup.web.js +5 -2
  16. package/lib/module/avatar-group/AvatarGroup.web.js.map +1 -1
  17. package/lib/module/theme/BloomThemeProvider.js +3 -1
  18. package/lib/module/theme/BloomThemeProvider.js.map +1 -1
  19. package/lib/module/theme/apply-dark-class.js +36 -0
  20. package/lib/module/theme/apply-dark-class.js.map +1 -1
  21. package/lib/module/user-hover-card/UserHoverCard.js +33 -12
  22. package/lib/module/user-hover-card/UserHoverCard.js.map +1 -1
  23. package/lib/module/user-hover-card/constants.js +42 -0
  24. package/lib/module/user-hover-card/constants.js.map +1 -0
  25. package/lib/module/user-hover-card/index.js +1 -0
  26. package/lib/module/user-hover-card/index.js.map +1 -1
  27. package/lib/typescript/commonjs/avatar-group/AvatarGroup.web.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/icons/shared.d.ts +4 -4
  29. package/lib/typescript/commonjs/theme/BloomThemeProvider.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/theme/apply-dark-class.d.ts +8 -0
  31. package/lib/typescript/commonjs/theme/apply-dark-class.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/user-hover-card/UserHoverCard.d.ts.map +1 -1
  33. package/lib/typescript/commonjs/user-hover-card/constants.d.ts +35 -0
  34. package/lib/typescript/commonjs/user-hover-card/constants.d.ts.map +1 -0
  35. package/lib/typescript/commonjs/user-hover-card/index.d.ts +1 -0
  36. package/lib/typescript/commonjs/user-hover-card/index.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/user-hover-card/types.d.ts +35 -6
  38. package/lib/typescript/commonjs/user-hover-card/types.d.ts.map +1 -1
  39. package/lib/typescript/module/avatar-group/AvatarGroup.web.d.ts.map +1 -1
  40. package/lib/typescript/module/icons/shared.d.ts +4 -4
  41. package/lib/typescript/module/theme/BloomThemeProvider.d.ts.map +1 -1
  42. package/lib/typescript/module/theme/apply-dark-class.d.ts +8 -0
  43. package/lib/typescript/module/theme/apply-dark-class.d.ts.map +1 -1
  44. package/lib/typescript/module/user-hover-card/UserHoverCard.d.ts.map +1 -1
  45. package/lib/typescript/module/user-hover-card/constants.d.ts +35 -0
  46. package/lib/typescript/module/user-hover-card/constants.d.ts.map +1 -0
  47. package/lib/typescript/module/user-hover-card/index.d.ts +1 -0
  48. package/lib/typescript/module/user-hover-card/index.d.ts.map +1 -1
  49. package/lib/typescript/module/user-hover-card/types.d.ts +35 -6
  50. package/lib/typescript/module/user-hover-card/types.d.ts.map +1 -1
  51. package/package.json +1 -1
  52. package/src/avatar-group/AvatarGroup.web.tsx +5 -2
  53. package/src/theme/BloomThemeProvider.tsx +3 -1
  54. package/src/theme/apply-dark-class.ts +38 -0
  55. package/src/user-hover-card/UserHoverCard.tsx +40 -16
  56. package/src/user-hover-card/constants.ts +40 -0
  57. package/src/user-hover-card/index.ts +5 -0
  58. package/src/user-hover-card/types.ts +35 -6
@@ -1,3 +1,4 @@
1
1
  export { UserHoverCard } from './UserHoverCard';
2
+ export { USER_HOVER_CARD_CONTENT_WIDTH, USER_HOVER_CARD_INSET, USER_HOVER_CARD_WIDTH, } from './constants';
2
3
  export type { UserHoverCardProps, UserHoverCardStat } from './types';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/user-hover-card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/user-hover-card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
@@ -38,6 +38,34 @@ export interface UserHoverCardProps {
38
38
  * Bloom does NOT implement follow logic; it only renders the card.
39
39
  */
40
40
  action?: ReactNode;
41
+ /**
42
+ * Marker slot in the handle row, rendered after `@username` — an account-kind
43
+ * or federation marker, the kind of quiet glyph that says what this account
44
+ * IS. Renders even when `username` is absent, because it describes the
45
+ * account rather than the handle. A long handle truncates to make room; the
46
+ * marker never shrinks.
47
+ *
48
+ * UNLIKE {@link UserHoverCardProps.footer}, this slot is INSIDE the identity
49
+ * area, because that is where it has to be to sit beside the handle. What that
50
+ * costs, measured rather than assumed:
51
+ *
52
+ * - The card's accessible name is unaffected. The identity area carries an
53
+ * explicit `accessibilityLabel`, and an explicit label wins over contents in
54
+ * the ARIA name computation — read back from Chrome's own accessibility tree
55
+ * with a badge nested inside: the button's name was exactly its label.
56
+ * - The badge's press does NOT leak into `onPressProfile`, on either platform.
57
+ * react-native-web implements React Native's responder system, so a nested
58
+ * pressable wins there the same way it does natively. No `stopPropagation`
59
+ * is needed, and a doc that told you to add one would be describing a
60
+ * different ancestor: a RAW DOM handler (`onPointerUp` on a plain `View`)
61
+ * does receive the bubbled event.
62
+ * - **Prefer an INERT marker.** When `onPressProfile` is set the identity area
63
+ * is a real `<button>`, so a pressable badge nests a button inside a button
64
+ * — invalid HTML, which Chrome tolerates and other user agents need not. A
65
+ * marker is usually a statement rather than a control anyway; make it
66
+ * pressable only where the answer it opens is worth that.
67
+ */
68
+ badge?: ReactNode;
41
69
  /**
42
70
  * Trailing content region, rendered after the stats row and spanning the full
43
71
  * inner width — the slot for whatever this app knows about a person that Bloom
@@ -45,13 +73,14 @@ export interface UserHoverCardProps {
45
73
  * line). Bloom adds the vertical rhythm and nothing else: no label, no divider,
46
74
  * no clip.
47
75
  *
48
- * It is a SIBLING of the identity area, never a child, so its own pressables
49
- * keep their presses instead of feeding {@link UserHoverCardProps.onPressProfile}
50
- * — and a screen reader reads it as content, not as part of the identity
51
- * button's name.
76
+ * It is a SIBLING of the identity area, never a child. Nested, a press
77
+ * anywhere on it — on a chart, on a line of text, on anything that is not
78
+ * itself pressable — would open the profile through
79
+ * {@link UserHoverCardProps.onPressProfile}.
52
80
  *
53
- * The card is 280px wide with `space.lg` padding, so content has ~248px of
54
- * inner width; the card does not clip, so anything wider paints outside it.
81
+ * Size content against {@link USER_HOVER_CARD_CONTENT_WIDTH}, which is
82
+ * exported for exactly that. The card does not clip, so anything wider paints
83
+ * outside it.
55
84
  */
56
85
  footer?: ReactNode;
57
86
  /** Container style override. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/user-hover-card/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,gCAAgC;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/user-hover-card/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,gCAAgC;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/bloom",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
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",
@@ -10,7 +10,7 @@ import { OverlayRoot } from '../overlay';
10
10
  // `Dialog.web.tsx` and `BottomSheet.web.tsx` already name it this way.
11
11
  import { Portal } from '../portal/index.web';
12
12
  import { WEB_POSITION_FIXED } from '../styles/web-view-style';
13
- import { UserHoverCard } from '../user-hover-card';
13
+ import { USER_HOVER_CARD_WIDTH, UserHoverCard } from '../user-hover-card';
14
14
  import {
15
15
  AvatarGroupBase,
16
16
  getItemName,
@@ -22,7 +22,10 @@ import type { AvatarGroupItem, AvatarGroupProps } from './types';
22
22
  const CLOSE_DELAY_MS = 120;
23
23
  /** Gap between the anchored avatar and the floating card. */
24
24
  const CARD_GAP = 8;
25
- const CARD_WIDTH = 280;
25
+ // The card's own width, never a second copy of it: this file CENTRES the card
26
+ // on its anchor, so a private constant would mis-place it the first time
27
+ // either number moved, and nothing would error.
28
+ const CARD_WIDTH = USER_HOVER_CARD_WIDTH;
26
29
 
27
30
  interface HoverState {
28
31
  item: AvatarGroupItem;
@@ -26,7 +26,7 @@ import { FontLoader } from '../fonts/FontLoader';
26
26
 
27
27
  import { useAmbientThemeState } from './ambient-store';
28
28
 
29
- import { applyDarkClass, applyVarsToDocument } from './apply-dark-class';
29
+ import { applyDarkClass, applyDocumentTheme, applyVarsToDocument } from './apply-dark-class';
30
30
  import { buildTheme } from './build-theme';
31
31
  import { buildThemeFromSeed } from './build-theme-from-seed';
32
32
  import { buildSeedScopeVars } from './color-scope/seed-scope';
@@ -433,6 +433,8 @@ export function BloomThemeProvider({
433
433
  setColorSchemeSafe(effectiveMode);
434
434
  applyDarkClass(resolved);
435
435
  applyVarsToDocument(themeVars);
436
+ const background = themeVars['--background'];
437
+ if (background) applyDocumentTheme(resolved, background);
436
438
  }, [effectiveMode, resolved, themeVars]);
437
439
 
438
440
  // Native only: publish the same vars into react-native-css's GLOBAL root
@@ -9,6 +9,44 @@ export function applyDarkClass(resolved: 'light' | 'dark') {
9
9
  }
10
10
  }
11
11
 
12
+ /**
13
+ * Theme the browser's document canvas as well as the app's React surfaces.
14
+ * The root background covers exposed viewport/overscroll areas; color-scheme
15
+ * lets browser-owned controls follow the resolved mode. theme-color is a hint
16
+ * for mobile browser chrome, whose final appearance remains browser-controlled.
17
+ * Called only by the app-wide provider, never by color/seed scopes.
18
+ */
19
+ export function applyDocumentTheme(resolved: 'light' | 'dark', background: string) {
20
+ if (Platform.OS !== 'web' || typeof document === 'undefined') return;
21
+
22
+ for (const element of [document.documentElement, document.body]) {
23
+ if (!element) continue;
24
+ // The canonical token is the document paint source. The concrete colour is
25
+ // still passed separately for metadata, which cannot consume CSS variables.
26
+ element.style.backgroundColor = 'var(--background)';
27
+ element.style.colorScheme = resolved;
28
+ }
29
+
30
+ // Authored entries are useful before hydration, but become competing runtime
31
+ // owners afterwards. Adopt one entry and remove every fallback once Bloom's
32
+ // root provider has resolved the actual app preference.
33
+ const head = document.head;
34
+ if (!head) return;
35
+ let meta = head.querySelector<HTMLMetaElement>('meta[data-bloom-theme-color]');
36
+ if (!meta) {
37
+ meta = head.querySelector<HTMLMetaElement>('meta[name="theme-color"]') ??
38
+ document.createElement('meta');
39
+ meta.setAttribute('data-bloom-theme-color', '');
40
+ meta.name = 'theme-color';
41
+ }
42
+ meta.content = background;
43
+ meta.removeAttribute('media');
44
+ if (!meta.isConnected) head.append(meta);
45
+ for (const candidate of Array.from(head.querySelectorAll('meta[name="theme-color"]'))) {
46
+ if (candidate !== meta) candidate.remove();
47
+ }
48
+ }
49
+
12
50
  /**
13
51
  * Apply a color preset's CSS custom properties to the document root.
14
52
  * No-op on native — only affects web (early-returns on `Platform.OS !== 'web'`).
@@ -12,6 +12,7 @@ import { Card } from '../card';
12
12
  import { VerifiedCheck } from '../icons/VerifiedCheck';
13
13
  import { useTheme } from '../theme/use-theme';
14
14
  import { fontSize, space } from '../styles/tokens';
15
+ import { USER_HOVER_CARD_INSET, USER_HOVER_CARD_WIDTH } from './constants';
15
16
  import type { UserHoverCardProps } from './types';
16
17
 
17
18
  const AVATAR_SIZE = 48;
@@ -27,6 +28,7 @@ const UserHoverCardComponent: React.FC<UserHoverCardProps> = ({
27
28
  verified = false,
28
29
  onPressProfile,
29
30
  action,
31
+ badge,
30
32
  footer,
31
33
  style,
32
34
  testID,
@@ -34,12 +36,14 @@ const UserHoverCardComponent: React.FC<UserHoverCardProps> = ({
34
36
  const theme = useTheme();
35
37
 
36
38
  // Layout only — the chrome (card background, hairline border, `shadow-m`, the
37
- // `radius-16` rung) is `Card`'s. `overflow: 'visible'` restores the RN default
38
- // that `Card` overrides: this card clips nothing, and leaving it hidden would
39
- // change what an Android elevation draws under a rounded, clipped view.
39
+ // `radius-16` rung) is `Card`'s. Both reasons `docs/card.mdx` gives for opting
40
+ // out of its clip apply here: this card carries an Android elevation, AND its
41
+ // two consumer slots may hold something that deliberately overflows (a
42
+ // tooltip, a popover). Clipping would silently truncate slot content instead;
43
+ // the width is published so it does not have to come to that.
40
44
  const layoutStyle: ViewStyle = {
41
- padding: space.lg,
42
- width: 280,
45
+ padding: USER_HOVER_CARD_INSET,
46
+ width: USER_HOVER_CARD_WIDTH,
43
47
  overflow: 'visible',
44
48
  };
45
49
 
@@ -64,13 +68,20 @@ const UserHoverCardComponent: React.FC<UserHoverCardProps> = ({
64
68
  />
65
69
  )}
66
70
  </View>
67
- {username ? (
68
- <Text
69
- numberOfLines={1}
70
- style={[styles.username, { color: theme.colors.textSecondary }]}
71
- >
72
- @{username}
73
- </Text>
71
+ {username || badge != null ? (
72
+ <View style={styles.handleRow}>
73
+ {username ? (
74
+ <Text
75
+ numberOfLines={1}
76
+ style={[styles.username, { color: theme.colors.textSecondary }]}
77
+ >
78
+ @{username}
79
+ </Text>
80
+ ) : null}
81
+ {/* The badge is a fact about the ACCOUNT, not about the handle, so
82
+ it renders even for a user with no handle to sit beside. */}
83
+ {badge != null ? <View style={styles.badge}>{badge}</View> : null}
84
+ </View>
74
85
  ) : null}
75
86
  </View>
76
87
  </View>
@@ -132,9 +143,11 @@ const UserHoverCardComponent: React.FC<UserHoverCardProps> = ({
132
143
  ) : null}
133
144
 
134
145
  {/* The consumer's own content. It is a SIBLING of the identity
135
- `Pressable`, not a child, so a button inside it keeps its own press
136
- instead of firing `onPressProfile`, and assistive technology reads it
137
- as content rather than folding it into the identity button's name. */}
146
+ `Pressable`, not a child: nested, a press on anything in it that is not
147
+ itself pressable would open the profile, and on web it would sit inside
148
+ a real `<button>`, where interactive content is invalid HTML. (The
149
+ card's accessible NAME is not at stake either way — the identity area
150
+ has an explicit label, which wins over contents.) */}
138
151
  {footer != null ? <View style={styles.footer}>{footer}</View> : null}
139
152
  </Card>
140
153
  );
@@ -173,9 +186,20 @@ const styles = StyleSheet.create({
173
186
  verifiedBadge: {
174
187
  flexShrink: 0,
175
188
  },
189
+ handleRow: {
190
+ flexDirection: 'row',
191
+ alignItems: 'center',
192
+ gap: space.xs,
193
+ marginTop: space._2xs,
194
+ },
176
195
  username: {
177
196
  fontSize: fontSize.sm,
178
- marginTop: space._2xs,
197
+ // The handle yields to the badge rather than pushing it out of the card: a
198
+ // long handle truncates (`numberOfLines={1}`), a marker cannot.
199
+ flexShrink: 1,
200
+ },
201
+ badge: {
202
+ flexShrink: 0,
179
203
  },
180
204
  action: {
181
205
  flexShrink: 0,
@@ -0,0 +1,40 @@
1
+ import { space } from '../styles/tokens';
2
+
3
+ /**
4
+ * The card's geometry, in one place, because two of these numbers are now a
5
+ * CONTRACT rather than an implementation detail: the card has two consumer
6
+ * slots, and a consumer cannot size content for a width it has to discover by
7
+ * overflowing.
8
+ *
9
+ * The card does not clip (see `UserHoverCard`), so content wider than
10
+ * {@link USER_HOVER_CARD_CONTENT_WIDTH} paints OUTSIDE the card's border rather
11
+ * than being cut off — the louder failure of the two, and still a failure.
12
+ */
13
+
14
+ /**
15
+ * Usable inner width, and the number a consumer sizes slot content against.
16
+ *
17
+ * This is the DECIDED number; the card's width is derived from it. That is the
18
+ * inversion the slots forced: the family's width was an unexplained `280` from
19
+ * the day it shipped (0.9.0), and the inner width that fell out of it — 248 —
20
+ * missed the first real slot content by ONE pixel. A contribution graph of 18
21
+ * columns at `cellSize={11} gap={3}` is 249px, and 18 columns is what 119 days
22
+ * spans once the leading partial week is counted.
23
+ *
24
+ * 256 is a step up on the 8px grid the spacing scale follows, it is 16× the
25
+ * inset, and it clears that measured requirement with room rather than exactly
26
+ * — a number chosen to be sized against, not nudged to fit one consumer.
27
+ */
28
+ export const USER_HOVER_CARD_CONTENT_WIDTH = 256;
29
+
30
+ /** Padding on all four sides. */
31
+ export const USER_HOVER_CARD_INSET = space.lg;
32
+
33
+ /**
34
+ * Total card width — derived, never the other way round. Anything positioning
35
+ * the card (see `AvatarGroup`'s web hover card) reads this rather than keeping
36
+ * its own copy: two spellings of one number centre the card off its anchor the
37
+ * first time either moves.
38
+ */
39
+ export const USER_HOVER_CARD_WIDTH =
40
+ USER_HOVER_CARD_CONTENT_WIDTH + USER_HOVER_CARD_INSET * 2;
@@ -1,2 +1,7 @@
1
1
  export { UserHoverCard } from './UserHoverCard';
2
+ export {
3
+ USER_HOVER_CARD_CONTENT_WIDTH,
4
+ USER_HOVER_CARD_INSET,
5
+ USER_HOVER_CARD_WIDTH,
6
+ } from './constants';
2
7
  export type { UserHoverCardProps, UserHoverCardStat } from './types';
@@ -40,6 +40,34 @@ export interface UserHoverCardProps {
40
40
  * Bloom does NOT implement follow logic; it only renders the card.
41
41
  */
42
42
  action?: ReactNode;
43
+ /**
44
+ * Marker slot in the handle row, rendered after `@username` — an account-kind
45
+ * or federation marker, the kind of quiet glyph that says what this account
46
+ * IS. Renders even when `username` is absent, because it describes the
47
+ * account rather than the handle. A long handle truncates to make room; the
48
+ * marker never shrinks.
49
+ *
50
+ * UNLIKE {@link UserHoverCardProps.footer}, this slot is INSIDE the identity
51
+ * area, because that is where it has to be to sit beside the handle. What that
52
+ * costs, measured rather than assumed:
53
+ *
54
+ * - The card's accessible name is unaffected. The identity area carries an
55
+ * explicit `accessibilityLabel`, and an explicit label wins over contents in
56
+ * the ARIA name computation — read back from Chrome's own accessibility tree
57
+ * with a badge nested inside: the button's name was exactly its label.
58
+ * - The badge's press does NOT leak into `onPressProfile`, on either platform.
59
+ * react-native-web implements React Native's responder system, so a nested
60
+ * pressable wins there the same way it does natively. No `stopPropagation`
61
+ * is needed, and a doc that told you to add one would be describing a
62
+ * different ancestor: a RAW DOM handler (`onPointerUp` on a plain `View`)
63
+ * does receive the bubbled event.
64
+ * - **Prefer an INERT marker.** When `onPressProfile` is set the identity area
65
+ * is a real `<button>`, so a pressable badge nests a button inside a button
66
+ * — invalid HTML, which Chrome tolerates and other user agents need not. A
67
+ * marker is usually a statement rather than a control anyway; make it
68
+ * pressable only where the answer it opens is worth that.
69
+ */
70
+ badge?: ReactNode;
43
71
  /**
44
72
  * Trailing content region, rendered after the stats row and spanning the full
45
73
  * inner width — the slot for whatever this app knows about a person that Bloom
@@ -47,13 +75,14 @@ export interface UserHoverCardProps {
47
75
  * line). Bloom adds the vertical rhythm and nothing else: no label, no divider,
48
76
  * no clip.
49
77
  *
50
- * It is a SIBLING of the identity area, never a child, so its own pressables
51
- * keep their presses instead of feeding {@link UserHoverCardProps.onPressProfile}
52
- * — and a screen reader reads it as content, not as part of the identity
53
- * button's name.
78
+ * It is a SIBLING of the identity area, never a child. Nested, a press
79
+ * anywhere on it — on a chart, on a line of text, on anything that is not
80
+ * itself pressable — would open the profile through
81
+ * {@link UserHoverCardProps.onPressProfile}.
54
82
  *
55
- * The card is 280px wide with `space.lg` padding, so content has ~248px of
56
- * inner width; the card does not clip, so anything wider paints outside it.
83
+ * Size content against {@link USER_HOVER_CARD_CONTENT_WIDTH}, which is
84
+ * exported for exactly that. The card does not clip, so anything wider paints
85
+ * outside it.
57
86
  */
58
87
  footer?: ReactNode;
59
88
  /** Container style override. */