@oxy.so/bloom 7.17.0 → 7.19.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 (236) hide show
  1. package/docs/adoption-matrix.mdx +12 -12
  2. package/docs/carousel.mdx +28 -2
  3. package/docs/checkbox.mdx +21 -0
  4. package/docs/dialog.mdx +16 -0
  5. package/docs/media-header.mdx +21 -0
  6. package/docs/popover.mdx +8 -0
  7. package/docs/radio.mdx +35 -0
  8. package/docs/search.mdx +19 -0
  9. package/lib/commonjs/bottom-sheet/BottomSheetBase.js +4 -3
  10. package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
  11. package/lib/commonjs/carousel/Carousel.js +52 -15
  12. package/lib/commonjs/carousel/Carousel.js.map +1 -1
  13. package/lib/commonjs/checkbox/Checkbox.js +15 -9
  14. package/lib/commonjs/checkbox/Checkbox.js.map +1 -1
  15. package/lib/commonjs/dialog/Dialog.js +11 -3
  16. package/lib/commonjs/dialog/Dialog.js.map +1 -1
  17. package/lib/commonjs/dialog/Dialog.web.js +15 -6
  18. package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
  19. package/lib/commonjs/dialog/DialogBottomSheet.js +3 -0
  20. package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
  21. package/lib/commonjs/dialog/DialogHeader.js +9 -1
  22. package/lib/commonjs/dialog/DialogHeader.js.map +1 -1
  23. package/lib/commonjs/dialog/SheetShell.js +3 -0
  24. package/lib/commonjs/dialog/SheetShell.js.map +1 -1
  25. package/lib/commonjs/floating/FloatingPanel.js +5 -3
  26. package/lib/commonjs/floating/FloatingPanel.js.map +1 -1
  27. package/lib/commonjs/hooks/use-choice-space-key.js +37 -0
  28. package/lib/commonjs/hooks/use-choice-space-key.js.map +1 -0
  29. package/lib/commonjs/media-header/FollowLabel.js +46 -0
  30. package/lib/commonjs/media-header/FollowLabel.js.map +1 -0
  31. package/lib/commonjs/media-header/MediaActionBar.js +19 -13
  32. package/lib/commonjs/media-header/MediaActionBar.js.map +1 -1
  33. package/lib/commonjs/popover/Popover.js +2 -0
  34. package/lib/commonjs/popover/Popover.js.map +1 -1
  35. package/lib/commonjs/popover/Popover.web.js +2 -0
  36. package/lib/commonjs/popover/Popover.web.js.map +1 -1
  37. package/lib/commonjs/radio/Radio.js +83 -34
  38. package/lib/commonjs/radio/Radio.js.map +1 -1
  39. package/lib/commonjs/radio/RadioCard.js +3 -0
  40. package/lib/commonjs/radio/RadioCard.js.map +1 -1
  41. package/lib/commonjs/radio/context.js +9 -0
  42. package/lib/commonjs/radio/context.js.map +1 -0
  43. package/lib/commonjs/radio/use-radio-group-item.js +29 -0
  44. package/lib/commonjs/radio/use-radio-group-item.js.map +1 -0
  45. package/lib/commonjs/search/Search.js +29 -23
  46. package/lib/commonjs/search/Search.js.map +1 -1
  47. package/lib/commonjs/surface/use-surface-material.web.js +4 -4
  48. package/lib/commonjs/surface/use-surface-material.web.js.map +1 -1
  49. package/lib/commonjs/text-field/TextField.js +6 -4
  50. package/lib/commonjs/text-field/TextField.js.map +1 -1
  51. package/lib/module/bottom-sheet/BottomSheetBase.js +4 -3
  52. package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
  53. package/lib/module/carousel/Carousel.js +52 -15
  54. package/lib/module/carousel/Carousel.js.map +1 -1
  55. package/lib/module/checkbox/Checkbox.js +15 -9
  56. package/lib/module/checkbox/Checkbox.js.map +1 -1
  57. package/lib/module/dialog/Dialog.js +11 -3
  58. package/lib/module/dialog/Dialog.js.map +1 -1
  59. package/lib/module/dialog/Dialog.web.js +15 -6
  60. package/lib/module/dialog/Dialog.web.js.map +1 -1
  61. package/lib/module/dialog/DialogBottomSheet.js +3 -0
  62. package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
  63. package/lib/module/dialog/DialogHeader.js +9 -1
  64. package/lib/module/dialog/DialogHeader.js.map +1 -1
  65. package/lib/module/dialog/SheetShell.js +3 -0
  66. package/lib/module/dialog/SheetShell.js.map +1 -1
  67. package/lib/module/floating/FloatingPanel.js +5 -3
  68. package/lib/module/floating/FloatingPanel.js.map +1 -1
  69. package/lib/module/hooks/use-choice-space-key.js +34 -0
  70. package/lib/module/hooks/use-choice-space-key.js.map +1 -0
  71. package/lib/module/media-header/FollowLabel.js +42 -0
  72. package/lib/module/media-header/FollowLabel.js.map +1 -0
  73. package/lib/module/media-header/MediaActionBar.js +19 -13
  74. package/lib/module/media-header/MediaActionBar.js.map +1 -1
  75. package/lib/module/popover/Popover.js +2 -0
  76. package/lib/module/popover/Popover.js.map +1 -1
  77. package/lib/module/popover/Popover.web.js +2 -0
  78. package/lib/module/popover/Popover.web.js.map +1 -1
  79. package/lib/module/radio/Radio.js +84 -35
  80. package/lib/module/radio/Radio.js.map +1 -1
  81. package/lib/module/radio/RadioCard.js +3 -0
  82. package/lib/module/radio/RadioCard.js.map +1 -1
  83. package/lib/module/radio/context.js +5 -0
  84. package/lib/module/radio/context.js.map +1 -0
  85. package/lib/module/radio/use-radio-group-item.js +26 -0
  86. package/lib/module/radio/use-radio-group-item.js.map +1 -0
  87. package/lib/module/search/Search.js +32 -26
  88. package/lib/module/search/Search.js.map +1 -1
  89. package/lib/module/surface/use-surface-material.web.js +4 -4
  90. package/lib/module/surface/use-surface-material.web.js.map +1 -1
  91. package/lib/module/text-field/TextField.js +6 -4
  92. package/lib/module/text-field/TextField.js.map +1 -1
  93. package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
  94. package/lib/typescript/commonjs/bottom-sheet/types.d.ts +2 -0
  95. package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
  96. package/lib/typescript/commonjs/carousel/Carousel.d.ts +1 -1
  97. package/lib/typescript/commonjs/carousel/Carousel.d.ts.map +1 -1
  98. package/lib/typescript/commonjs/carousel/types.d.ts +11 -2
  99. package/lib/typescript/commonjs/carousel/types.d.ts.map +1 -1
  100. package/lib/typescript/commonjs/checkbox/Checkbox.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/checkbox/types.d.ts +4 -0
  102. package/lib/typescript/commonjs/checkbox/types.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
  104. package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts +2 -2
  105. package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts.map +1 -1
  106. package/lib/typescript/commonjs/dialog/DialogHeader.d.ts +2 -0
  107. package/lib/typescript/commonjs/dialog/DialogHeader.d.ts.map +1 -1
  108. package/lib/typescript/commonjs/dialog/SheetShell.d.ts +2 -1
  109. package/lib/typescript/commonjs/dialog/SheetShell.d.ts.map +1 -1
  110. package/lib/typescript/commonjs/dialog/types.d.ts +2 -0
  111. package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
  112. package/lib/typescript/commonjs/floating/FloatingPanel.d.ts +1 -1
  113. package/lib/typescript/commonjs/floating/FloatingPanel.d.ts.map +1 -1
  114. package/lib/typescript/commonjs/floating/types.d.ts +1 -0
  115. package/lib/typescript/commonjs/floating/types.d.ts.map +1 -1
  116. package/lib/typescript/commonjs/hooks/use-choice-space-key.d.ts +14 -0
  117. package/lib/typescript/commonjs/hooks/use-choice-space-key.d.ts.map +1 -0
  118. package/lib/typescript/commonjs/media-header/FollowLabel.d.ts +11 -0
  119. package/lib/typescript/commonjs/media-header/FollowLabel.d.ts.map +1 -0
  120. package/lib/typescript/commonjs/media-header/MediaActionBar.d.ts +1 -1
  121. package/lib/typescript/commonjs/media-header/MediaActionBar.d.ts.map +1 -1
  122. package/lib/typescript/commonjs/media-header/types.d.ts +10 -0
  123. package/lib/typescript/commonjs/media-header/types.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/popover/Popover.d.ts +1 -1
  125. package/lib/typescript/commonjs/popover/Popover.d.ts.map +1 -1
  126. package/lib/typescript/commonjs/popover/Popover.web.d.ts +1 -1
  127. package/lib/typescript/commonjs/popover/Popover.web.d.ts.map +1 -1
  128. package/lib/typescript/commonjs/popover/types.d.ts +4 -1
  129. package/lib/typescript/commonjs/popover/types.d.ts.map +1 -1
  130. package/lib/typescript/commonjs/radio/Radio.d.ts +1 -1
  131. package/lib/typescript/commonjs/radio/Radio.d.ts.map +1 -1
  132. package/lib/typescript/commonjs/radio/RadioCard.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/radio/context.d.ts +9 -0
  134. package/lib/typescript/commonjs/radio/context.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/radio/types.d.ts +6 -0
  136. package/lib/typescript/commonjs/radio/types.d.ts.map +1 -1
  137. package/lib/typescript/commonjs/radio/use-radio-group-item.d.ts +3 -0
  138. package/lib/typescript/commonjs/radio/use-radio-group-item.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/search/Search.d.ts +2 -0
  140. package/lib/typescript/commonjs/search/Search.d.ts.map +1 -1
  141. package/lib/typescript/commonjs/search/types.d.ts +5 -0
  142. package/lib/typescript/commonjs/search/types.d.ts.map +1 -1
  143. package/lib/typescript/commonjs/surface/use-surface-material.web.d.ts +1 -1
  144. package/lib/typescript/commonjs/surface/use-surface-material.web.d.ts.map +1 -1
  145. package/lib/typescript/commonjs/text-field/TextField.d.ts +1 -1
  146. package/lib/typescript/commonjs/text-field/TextField.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/text-field/types.d.ts +3 -1
  148. package/lib/typescript/commonjs/text-field/types.d.ts.map +1 -1
  149. package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
  150. package/lib/typescript/module/bottom-sheet/types.d.ts +2 -0
  151. package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
  152. package/lib/typescript/module/carousel/Carousel.d.ts +1 -1
  153. package/lib/typescript/module/carousel/Carousel.d.ts.map +1 -1
  154. package/lib/typescript/module/carousel/types.d.ts +11 -2
  155. package/lib/typescript/module/carousel/types.d.ts.map +1 -1
  156. package/lib/typescript/module/checkbox/Checkbox.d.ts.map +1 -1
  157. package/lib/typescript/module/checkbox/types.d.ts +4 -0
  158. package/lib/typescript/module/checkbox/types.d.ts.map +1 -1
  159. package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
  160. package/lib/typescript/module/dialog/DialogBottomSheet.d.ts +2 -2
  161. package/lib/typescript/module/dialog/DialogBottomSheet.d.ts.map +1 -1
  162. package/lib/typescript/module/dialog/DialogHeader.d.ts +2 -0
  163. package/lib/typescript/module/dialog/DialogHeader.d.ts.map +1 -1
  164. package/lib/typescript/module/dialog/SheetShell.d.ts +2 -1
  165. package/lib/typescript/module/dialog/SheetShell.d.ts.map +1 -1
  166. package/lib/typescript/module/dialog/types.d.ts +2 -0
  167. package/lib/typescript/module/dialog/types.d.ts.map +1 -1
  168. package/lib/typescript/module/floating/FloatingPanel.d.ts +1 -1
  169. package/lib/typescript/module/floating/FloatingPanel.d.ts.map +1 -1
  170. package/lib/typescript/module/floating/types.d.ts +1 -0
  171. package/lib/typescript/module/floating/types.d.ts.map +1 -1
  172. package/lib/typescript/module/hooks/use-choice-space-key.d.ts +14 -0
  173. package/lib/typescript/module/hooks/use-choice-space-key.d.ts.map +1 -0
  174. package/lib/typescript/module/media-header/FollowLabel.d.ts +11 -0
  175. package/lib/typescript/module/media-header/FollowLabel.d.ts.map +1 -0
  176. package/lib/typescript/module/media-header/MediaActionBar.d.ts +1 -1
  177. package/lib/typescript/module/media-header/MediaActionBar.d.ts.map +1 -1
  178. package/lib/typescript/module/media-header/types.d.ts +10 -0
  179. package/lib/typescript/module/media-header/types.d.ts.map +1 -1
  180. package/lib/typescript/module/popover/Popover.d.ts +1 -1
  181. package/lib/typescript/module/popover/Popover.d.ts.map +1 -1
  182. package/lib/typescript/module/popover/Popover.web.d.ts +1 -1
  183. package/lib/typescript/module/popover/Popover.web.d.ts.map +1 -1
  184. package/lib/typescript/module/popover/types.d.ts +4 -1
  185. package/lib/typescript/module/popover/types.d.ts.map +1 -1
  186. package/lib/typescript/module/radio/Radio.d.ts +1 -1
  187. package/lib/typescript/module/radio/Radio.d.ts.map +1 -1
  188. package/lib/typescript/module/radio/RadioCard.d.ts.map +1 -1
  189. package/lib/typescript/module/radio/context.d.ts +9 -0
  190. package/lib/typescript/module/radio/context.d.ts.map +1 -0
  191. package/lib/typescript/module/radio/types.d.ts +6 -0
  192. package/lib/typescript/module/radio/types.d.ts.map +1 -1
  193. package/lib/typescript/module/radio/use-radio-group-item.d.ts +3 -0
  194. package/lib/typescript/module/radio/use-radio-group-item.d.ts.map +1 -0
  195. package/lib/typescript/module/search/Search.d.ts +2 -0
  196. package/lib/typescript/module/search/Search.d.ts.map +1 -1
  197. package/lib/typescript/module/search/types.d.ts +5 -0
  198. package/lib/typescript/module/search/types.d.ts.map +1 -1
  199. package/lib/typescript/module/surface/use-surface-material.web.d.ts +1 -1
  200. package/lib/typescript/module/surface/use-surface-material.web.d.ts.map +1 -1
  201. package/lib/typescript/module/text-field/TextField.d.ts +1 -1
  202. package/lib/typescript/module/text-field/TextField.d.ts.map +1 -1
  203. package/lib/typescript/module/text-field/types.d.ts +3 -1
  204. package/lib/typescript/module/text-field/types.d.ts.map +1 -1
  205. package/package.json +1 -1
  206. package/src/bottom-sheet/BottomSheetBase.tsx +4 -3
  207. package/src/bottom-sheet/types.ts +2 -0
  208. package/src/carousel/Carousel.tsx +46 -20
  209. package/src/carousel/types.ts +8 -2
  210. package/src/checkbox/Checkbox.tsx +13 -3
  211. package/src/checkbox/types.ts +4 -0
  212. package/src/dialog/Dialog.tsx +11 -3
  213. package/src/dialog/Dialog.web.tsx +15 -6
  214. package/src/dialog/DialogBottomSheet.tsx +4 -0
  215. package/src/dialog/DialogHeader.tsx +7 -1
  216. package/src/dialog/SheetShell.tsx +4 -0
  217. package/src/dialog/types.ts +2 -0
  218. package/src/floating/FloatingPanel.tsx +4 -3
  219. package/src/floating/types.ts +1 -0
  220. package/src/hooks/use-choice-space-key.ts +29 -0
  221. package/src/media-header/FollowLabel.tsx +23 -0
  222. package/src/media-header/MediaActionBar.tsx +11 -6
  223. package/src/media-header/types.ts +10 -0
  224. package/src/popover/Popover.tsx +2 -0
  225. package/src/popover/Popover.web.tsx +2 -0
  226. package/src/popover/types.ts +4 -1
  227. package/src/radio/Radio.tsx +77 -34
  228. package/src/radio/RadioCard.tsx +4 -0
  229. package/src/radio/context.ts +9 -0
  230. package/src/radio/types.ts +6 -0
  231. package/src/radio/use-radio-group-item.ts +20 -0
  232. package/src/search/Search.tsx +24 -31
  233. package/src/search/types.ts +5 -0
  234. package/src/surface/use-surface-material.web.ts +4 -4
  235. package/src/text-field/TextField.tsx +5 -4
  236. package/src/text-field/types.ts +3 -1
@@ -22,6 +22,7 @@ import { PlayButton } from '../media-controls/PlayButton';
22
22
  import { borderRadius, DISABLED_OPACITY } from '../styles/tokens';
23
23
  import type { WebCssStyle } from '../styles/web-view-style';
24
24
  import { Text } from '../typography';
25
+ import { FollowLabel } from './FollowLabel';
25
26
  import { useMediaHeaderPaint } from './parts';
26
27
  import { IS_WEB } from './shared';
27
28
  import { clamp01 } from '../styles/clamp';
@@ -293,6 +294,10 @@ function FollowButtonComponent({
293
294
  accessibilityLabel,
294
295
  accessibilityHint,
295
296
  color,
297
+ appearance = 'subtle',
298
+ material,
299
+ className,
300
+ labelClassName,
296
301
  tone = 'support',
297
302
  iconOnly = false,
298
303
  size: sizeProp,
@@ -326,28 +331,28 @@ function FollowButtonComponent({
326
331
  }, [disabled, following, loading, pressOffset, reducedMotion]);
327
332
  const idleLabelStyle = useAnimatedStyle(() => ({ opacity: 1 - progress.value, transform: [{ translateY: -8 * progress.value + pressOffset.value }] }), [progress, pressOffset]);
328
333
  const followedLabelStyle = useAnimatedStyle(() => ({ opacity: progress.value, transform: [{ translateY: 8 * (1 - progress.value) + pressOffset.value }] }), [progress, pressOffset]);
329
- const labelColor = color ?? resolveButtonPalette('subtle', theme, tone).rest.foreground;
334
+ const labelColor = color ?? resolveButtonPalette(appearance, theme, tone).rest.foreground;
330
335
  const visual = (
331
336
  <View pointerEvents="none" aria-hidden accessibilityElementsHidden importantForAccessibility="no-hide-descendants"
332
337
  style={{ height: 24, overflow: 'hidden', ...(iconOnly ? { width: 20 } : {}), justifyContent: 'center' }}>
333
338
  {!iconOnly && <View style={{ height: 0, overflow: 'hidden' }}>
334
- <Text variant="body-semibold" style={textStyle}>{label}</Text>
335
- <Text variant="body-semibold" style={textStyle}>{followingLabel}</Text>
339
+ <FollowLabel className={labelClassName} style={textStyle}>{label}</FollowLabel>
340
+ <FollowLabel className={labelClassName} style={textStyle}>{followingLabel}</FollowLabel>
336
341
  </View>}
337
342
  <Animated.View testID={testID ? `${testID}-idle-label` : undefined}
338
343
  style={[{ position: 'absolute', left: 0, right: 0, alignItems: 'center' }, idleLabelStyle]}>
339
344
  {iconOnly ? <RiUserAddLine width={20} height={20} fill={labelColor} />
340
- : <Text variant="body-semibold" style={[{ color: labelColor }, textStyle]} numberOfLines={1}>{label}</Text>}
345
+ : <FollowLabel className={labelClassName} style={[{ color: color ?? (labelClassName?.trim() ? undefined : labelColor) }, textStyle]} numberOfLines={1}>{label}</FollowLabel>}
341
346
  </Animated.View>
342
347
  <Animated.View testID={testID ? `${testID}-following-label` : undefined}
343
348
  style={[{ position: 'absolute', left: 0, right: 0, alignItems: 'center' }, followedLabelStyle]}>
344
349
  {iconOnly ? <RiUserFollowLine width={20} height={20} fill={labelColor} />
345
- : <Text variant="body-semibold" style={[{ color: labelColor }, textStyle]} numberOfLines={1}>{followingLabel}</Text>}
350
+ : <FollowLabel className={labelClassName} style={[{ color: color ?? (labelClassName?.trim() ? undefined : labelColor) }, textStyle]} numberOfLines={1}>{followingLabel}</FollowLabel>}
346
351
  </Animated.View>
347
352
  </View>
348
353
  );
349
354
  return (
350
- <Button appearance="subtle" tone={tone} size={size} iconOnly={iconOnly}
355
+ <Button appearance={appearance} material={material} className={className} tone={tone} size={size} iconOnly={iconOnly}
351
356
  pressed={following} stopPropagation accessibilityLabel={accessibilityLabel ?? label}
352
357
  accessibilityHint={accessibilityHint} disabled={disabled} loading={loading}
353
358
  onPressIn={previewLabel} onPressOut={restoreLabel}
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
3
3
 
4
4
  import type { BloomTone } from '../appearance';
5
+ import type { ButtonProps } from '../button/types';
5
6
  import type { BloomIconComponent } from '../icons/icon-component';
6
7
  import type { WebAriaProps } from '../styles/styled-primitives';
7
8
 
@@ -150,6 +151,15 @@ export interface DownloadButtonProps extends ToggleBase {
150
151
  }
151
152
 
152
153
  export interface FollowButtonProps extends ToggleBase {
154
+ /** Shared Button surface; defaults to subtle. */
155
+ appearance?: ButtonProps['appearance'];
156
+ /** Shared Button material; preserves the standard surface by default. */
157
+ material?: ButtonProps['material'];
158
+ /** Classes on the Button layout and surface owner. */
159
+ className?: string;
160
+ /** Typography classes on both animated labels and their measuring copies.
161
+ * Text mode only; explicit color/textStyle still take precedence. */
162
+ labelClassName?: string;
153
163
  /** Shared Button tone. Defaults to support (secondary). */
154
164
  tone?: BloomTone;
155
165
  /** Compact toggle with icons and the same accessible name. */
@@ -73,6 +73,7 @@ export function PopoverTrigger({
73
73
  }
74
74
 
75
75
  export function PopoverContent({
76
+ material,
76
77
  children,
77
78
  label: labelProp,
78
79
  className,
@@ -86,6 +87,7 @@ export function PopoverContent({
86
87
 
87
88
  return (
88
89
  <SheetShell
90
+ material={material}
89
91
  control={control}
90
92
  label={label}
91
93
  onClose={onSheetClose}
@@ -71,6 +71,7 @@ export function PopoverTrigger({
71
71
  }
72
72
 
73
73
  export function PopoverContent({
74
+ material,
74
75
  children,
75
76
  label: labelProp,
76
77
  side,
@@ -104,6 +105,7 @@ export function PopoverContent({
104
105
 
105
106
  return (
106
107
  <FloatingPanel
108
+ material={material}
107
109
  open={popover.open}
108
110
  anchor={anchor}
109
111
  role="dialog"
@@ -8,7 +8,10 @@ import type {
8
8
 
9
9
  export type PopoverProps = React.PropsWithChildren<OverlayOpenProps>;
10
10
  export type PopoverTriggerProps = OverlayTriggerProps;
11
- export type PopoverContentProps = OverlaySurfaceProps;
11
+ export type PopoverContentProps = OverlaySurfaceProps & {
12
+ /** Standard optical surface or plain fill. Default surface. */
13
+ material?: 'surface' | 'flat';
14
+ };
12
15
 
13
16
  /** Shared by the panel's layout parts. */
14
17
  interface PopoverPartProps {
@@ -1,7 +1,10 @@
1
+ import { useRadioGroupItem } from './use-radio-group-item';
2
+ import { RadioGroupContext } from './context';
3
+ import { useIsRtl } from '../hooks/use-is-rtl';
1
4
  import { useControllableState } from '../hooks/use-controllable-state';
2
5
  import { useBloomAppearance } from '../appearance';
3
6
  import { resolveBloomColors } from '../appearance/colors';
4
- import React, { memo, useCallback, useMemo } from 'react';
7
+ import React, { memo, useCallback, useMemo, useRef, type KeyboardEvent } from 'react';
5
8
  import { View, Platform, Pressable } from 'react-native';
6
9
 
7
10
  import { useTheme } from '../theme/use-theme';
@@ -94,6 +97,7 @@ const RadioComponent = function Radio<Value extends string = string>({
94
97
  checked: checkedProp,
95
98
  onValueChange,
96
99
  label,
100
+ labelContent,
97
101
  description,
98
102
  size: sizeProp,
99
103
  disabled = false,
@@ -123,7 +127,8 @@ const RadioComponent = function Radio<Value extends string = string>({
123
127
  useInteractiveWebCss(STYLE_ID, BLOOM_RADIO_CSS);
124
128
  const sizeConfig = SIZE_CONFIG[size];
125
129
  const { accent } = useMemo(() => resolveButtonRamps(theme), [theme]);
126
- const hasText = Boolean(label || description);
130
+ const hasLabel = labelContent != null || Boolean(label);
131
+ const hasText = hasLabel || Boolean(description);
127
132
 
128
133
  const handlePress = useCallback(() => {
129
134
  // Re-choosing the chosen option is a no-op. A radio, unlike a checkbox, has
@@ -144,8 +149,11 @@ const RadioComponent = function Radio<Value extends string = string>({
144
149
  ...ringOffset,
145
150
  };
146
151
 
152
+ const spaceKey = useRadioGroupItem(value, isDisabled, handlePress);
153
+
147
154
  return (
148
155
  <Pressable
156
+ {...spaceKey}
149
157
  {...(IS_WEB ? ({ dataSet: { bloomRadio: '' } } as Record<string, unknown>) : {})}
150
158
  style={[rowStyle, style]}
151
159
  onPress={handlePress}
@@ -176,7 +184,11 @@ const RadioComponent = function Radio<Value extends string = string>({
176
184
 
177
185
  {hasText && (
178
186
  <View style={{ flex: 1 }}>
179
- {label && (
187
+ {labelContent != null ? (
188
+ <View pointerEvents="none" aria-hidden accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
189
+ {labelContent}
190
+ </View>
191
+ ) : label && (
180
192
  <Text variant={sizeConfig.label} style={[{ color: theme.colors.text }, labelStyle]}>
181
193
  {label}
182
194
  </Text>
@@ -184,7 +196,7 @@ const RadioComponent = function Radio<Value extends string = string>({
184
196
  {description && (
185
197
  <Text
186
198
  variant={sizeConfig.description}
187
- style={{ color: theme.colors.textSecondary, marginTop: label ? DESCRIPTION_GAP : 0 }}
199
+ style={{ color: theme.colors.textSecondary, marginTop: hasLabel ? DESCRIPTION_GAP : 0 }}
188
200
  >
189
201
  {description}
190
202
  </Text>
@@ -217,6 +229,7 @@ const RadioGroupComponent = function RadioGroup<Value extends string = string>(p
217
229
  tone: toneProp,
218
230
  style,
219
231
  labelStyle,
232
+ optionStyle,
220
233
  variant = 'default',
221
234
  testID,
222
235
  } = props;
@@ -231,46 +244,76 @@ const RadioGroupComponent = function RadioGroup<Value extends string = string>(p
231
244
  const isDisabled = field.disabled;
232
245
  const { size: scopedSize, tone } = useBloomAppearance({size: sizeProp, tone: toneProp}, {size: 'md', tone: 'accent'});
233
246
  const size = scopedSize;
247
+ const rtl = useIsRtl();
248
+ const nodes = useRef(new Map<string, View>());
249
+ const enabledValues = options.filter(option => !isDisabled && !option.disabled).map(option => option.value);
250
+ const tabValue = value !== undefined && enabledValues.includes(value) ? value : enabledValues[0];
251
+ const register = useCallback((option: string, node: View | null) => {
252
+ if (node) nodes.current.set(option, node); else nodes.current.delete(option);
253
+ }, []);
254
+ const onKeyDown = (current: string, event: KeyboardEvent<HTMLElement>) => {
255
+ if (event.target !== event.currentTarget || event.altKey || event.ctrlKey || event.metaKey || !enabledValues.length) return;
256
+ const position = enabledValues.findIndex(option => option === current);
257
+ if (position < 0) return;
258
+ let target: Value | undefined;
259
+ if (event.key === 'Home') target = enabledValues[0];
260
+ else if (event.key === 'End') target = enabledValues[enabledValues.length - 1];
261
+ else {
262
+ const delta = event.key === 'ArrowDown' ? 1 : event.key === 'ArrowUp' ? -1
263
+ : event.key === 'ArrowRight' ? (rtl ? -1 : 1) : event.key === 'ArrowLeft' ? (rtl ? 1 : -1) : 0;
264
+ if (!delta) return;
265
+ target = enabledValues[(position + delta + enabledValues.length) % enabledValues.length];
266
+ }
267
+ if (target === undefined) return;
268
+ event.preventDefault(); event.stopPropagation();
269
+ const node: unknown = nodes.current.get(target);
270
+ if (typeof HTMLElement !== 'undefined' && node instanceof HTMLElement) node.focus({ preventScroll: true });
271
+ if (target !== value) onValueChange(target);
272
+ };
234
273
  return (
235
- <View
236
- style={[{ gap: space.sm }, style]}
237
- accessibilityRole="radiogroup"
238
- accessibilityLabel={field.accessibilityLabel}
239
- aria-label={field.accessibilityLabel}
240
- aria-describedby={field.describedBy}
241
- aria-invalid={field.invalid || undefined}
242
- testID={testID}
243
- >
244
- {options.map((option) =>
245
- variant === 'card' ? (
246
- <RadioCard
274
+ <RadioGroupContext.Provider value={{ tabValue, register, onKeyDown }}>
275
+ <View
276
+ style={[{ gap: space.sm }, style]}
277
+ accessibilityRole="radiogroup"
278
+ accessibilityLabel={field.accessibilityLabel}
279
+ aria-label={field.accessibilityLabel}
280
+ aria-describedby={field.describedBy}
281
+ aria-invalid={field.invalid || undefined}
282
+ testID={testID}
283
+ >
284
+ {options.map((option) =>
285
+ variant === 'card' ? (
286
+ <RadioCard
287
+ key={option.value}
288
+ value={option.value}
289
+ checked={option.value === value}
290
+ onValueChange={onValueChange}
291
+ title={option.label ?? option.value}
292
+ description={option.description}
293
+ disabled={isDisabled || option.disabled === true}
294
+ tone={tone}
295
+ style={optionStyle}
296
+ testID={option.testID}
297
+ />
298
+ ) : (
299
+ <Radio
247
300
  key={option.value}
248
301
  value={option.value}
249
302
  checked={option.value === value}
250
303
  onValueChange={onValueChange}
251
- title={option.label ?? option.value}
304
+ label={option.label}
252
305
  description={option.description}
306
+ size={size}
253
307
  disabled={isDisabled || option.disabled === true}
254
308
  tone={tone}
309
+ labelStyle={labelStyle}
310
+ style={optionStyle}
255
311
  testID={option.testID}
256
312
  />
257
- ) : (
258
- <Radio
259
- key={option.value}
260
- value={option.value}
261
- checked={option.value === value}
262
- onValueChange={onValueChange}
263
- label={option.label}
264
- description={option.description}
265
- size={size}
266
- disabled={isDisabled || option.disabled === true}
267
- tone={tone}
268
- labelStyle={labelStyle}
269
- testID={option.testID}
270
- />
271
- ),
272
- )}
273
- </View>
313
+ ),
314
+ )}
315
+ </View>
316
+ </RadioGroupContext.Provider>
274
317
  );
275
318
  };
276
319
 
@@ -1,3 +1,4 @@
1
+ import { useRadioGroupItem } from './use-radio-group-item';
1
2
  import { useFieldMembership } from '../field/membership';
2
3
  import { useRingOffsetStyle } from '../styles/surface-levels';
3
4
  import { useBloomAppearance } from '../appearance';
@@ -129,8 +130,11 @@ const RadioCardComponent = function RadioCard<Value extends string = string>({
129
130
  : null),
130
131
  };
131
132
 
133
+ const groupItem = useRadioGroupItem(value, disabled, handlePress);
134
+
132
135
  return (
133
136
  <Pressable
137
+ {...groupItem}
134
138
  {...webDataSet({ bloomRadioCard: '' })}
135
139
  style={[cardStyle, style]}
136
140
  onPress={handlePress}
@@ -0,0 +1,9 @@
1
+ import { createContext, type KeyboardEvent } from 'react';
2
+ import type { View } from 'react-native';
3
+
4
+ export interface RadioGroupContextValue {
5
+ tabValue: string | undefined;
6
+ register: (value: string, node: View | null) => void;
7
+ onKeyDown: (value: string, event: KeyboardEvent<HTMLElement>) => void;
8
+ }
9
+ export const RadioGroupContext = createContext<RadioGroupContextValue | null>(null);
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from 'react';
1
2
  import type { BloomSize } from '../appearance';
2
3
  import type { BloomTone } from '../appearance';
3
4
  import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
@@ -21,6 +22,9 @@ export interface RadioProps<Value extends string = string> {
21
22
  onValueChange?: (value: Value) => void;
22
23
  /** Optional label text. */
23
24
  label?: string;
25
+ /** Decorative label layout, rendered in a View instead of Text. Supply
26
+ * `label` or `accessibilityLabel` for its accessible name. Do not nest controls. */
27
+ labelContent?: ReactNode;
24
28
  /** Optional description shown below the label. */
25
29
  description?: string;
26
30
  /** Size preset. */
@@ -74,6 +78,8 @@ export interface RadioGroupProps<Value extends string = string> {
74
78
  tone?: BloomTone;
75
79
  style?: StyleProp<ViewStyle>;
76
80
  labelStyle?: StyleProp<TextStyle>;
81
+ /** Layout/style on each owned Radio or RadioCard row. */
82
+ optionStyle?: StyleProp<ViewStyle>;
77
83
  /**
78
84
  * `default` renders each option as a `Radio` row; `card` as a `RadioCard`
79
85
  * (title + description left, the dot right, the whole
@@ -0,0 +1,20 @@
1
+ import { useCallback, useContext, type KeyboardEvent } from 'react';
2
+ import { Platform, type View } from 'react-native';
3
+ import { useChoiceSpaceKey } from '../hooks/use-choice-space-key';
4
+ import { RadioGroupContext } from './context';
5
+
6
+ /** One host owns both Space activation and its group's roving keyboard focus. */
7
+ export function useRadioGroupItem(value: string, disabled: boolean, activate: () => void) {
8
+ const group = useContext(RadioGroupContext);
9
+ const space = useChoiceSpaceKey(disabled, activate);
10
+ const ref = useCallback((node: View | null) => group?.register(value, node), [group, value]);
11
+ if (Platform.OS !== 'web') return {};
12
+ return {
13
+ ...space,
14
+ ...(group ? { ref, tabIndex: !disabled && group.tabValue === value ? 0 : -1 } : {}),
15
+ onKeyDown(event: KeyboardEvent<HTMLElement>) {
16
+ space.onKeyDown?.(event);
17
+ if (!disabled && !event.defaultPrevented) group?.onKeyDown(value, event);
18
+ },
19
+ };
20
+ }
@@ -1,10 +1,12 @@
1
- import { forwardRef, useCallback, useMemo, useRef } from 'react';
2
- import { Platform, type TextInput, View } from 'react-native';
1
+ import { forwardRef, useCallback, useContext, useMemo, useRef } from 'react';
2
+ import { Platform, type TextInput } from 'react-native';
3
3
 
4
+ import { useFieldMembership } from '../field/membership';
5
+ import { TextFieldGroupContext } from '../text-field/TextField';
4
6
  import { mergeRefs } from '../hooks/merge-refs';
5
7
  import { FieldBox } from '../text-field/FieldBox';
6
8
  import type { SearchProps } from './types';
7
- import { useDirectionProps, useIsRtl } from '../hooks/use-is-rtl';
9
+ import { useDirectionProps } from '../hooks/use-is-rtl';
8
10
  import { useCommonMessages } from '../locale/common-messages';
9
11
  import { useMessages } from '../locale/messages';
10
12
  import { SEARCH_MESSAGES } from './messages';
@@ -18,10 +20,12 @@ import { RiSearchLine as MagnifyingGlassIcon } from '../icons/remix/RiSearchLine
18
20
  import { RiCloseLine as X } from '../icons/remix/RiCloseLine';
19
21
 
20
22
  export const Search = forwardRef<TextInput, SearchProps>(
21
- function Search({ value, label: labelProp, onClearText, onFocus, onPressIn, fieldClassName, fieldChromeClassName, containerClassName, containerStyle, ...rest }, ref) {
23
+ function Search({ value, label: labelProp, onClearText, onFocus, onPressIn, iconSize, clearButtonProps, disabled, style, fieldClassName, fieldChromeClassName, containerClassName, containerStyle, ...rest }, ref) {
22
24
  const theme = useTheme();
23
25
  const direction = useDirectionProps();
24
- const rtl = useIsRtl();
26
+ const field = useFieldMembership({ disabled });
27
+ const group = useContext(TextFieldGroupContext);
28
+ const isDisabled = field.disabled || group?.disabled === true;
25
29
  const common = useCommonMessages();
26
30
  const { messages } = useMessages(SEARCH_MESSAGES);
27
31
  const label = labelProp ?? common.search;
@@ -64,8 +68,8 @@ export const Search = forwardRef<TextInput, SearchProps>(
64
68
 
65
69
  return (
66
70
  <FieldBox {...direction} className={containerClassName} style={containerStyle} baseStyle={[a.w_full, a.relative]}>
67
- <TextField radius={borderRadius.full} className={fieldClassName} chromeClassName={fieldChromeClassName}>
68
- <TextFieldIcon icon={MagnifyingGlassIcon} />
71
+ <TextField disabled={isDisabled} radius={borderRadius.full} className={fieldClassName} chromeClassName={fieldChromeClassName}>
72
+ <TextFieldIcon icon={MagnifyingGlassIcon} size={iconSize} />
69
73
  <TextFieldInput
70
74
  inputRef={refs}
71
75
  label={label}
@@ -78,35 +82,24 @@ export const Search = forwardRef<TextInput, SearchProps>(
78
82
  autoCorrect={false}
79
83
  autoComplete="off"
80
84
  autoCapitalize="none"
81
- style={showClear ? (rtl ? { paddingLeft: 24 } : { paddingRight: 24 }) : undefined}
82
85
  {...rest}
86
+ disabled={isDisabled}
87
+ style={style}
83
88
  onPressIn={handlePressIn}
84
89
  onFocus={handleFocus}
85
90
  />
91
+ {showClear && <GlyphButton
92
+ size={28}
93
+ icon={X}
94
+ glyphSize={16}
95
+ {...clearButtonProps}
96
+ testID="searchTextInputClearBtn"
97
+ onPress={onClearText}
98
+ accessibilityLabel={messages.clearQuery}
99
+ disabled={isDisabled}
100
+ style={{ marginInlineStart: 8 }}
101
+ />}
86
102
  </TextField>
87
-
88
- {showClear && (
89
- <View
90
- style={[
91
- a.absolute,
92
- a.z_20,
93
- a.my_auto,
94
- a.justify_center,
95
- { top: 0, bottom: 0, insetInlineEnd: 0, paddingInlineEnd: 8 },
96
- ]}>
97
- {/* Neutral and transparent. `variant="ghost"` painted an accent
98
- wash inside the field, which read as a state the field was not
99
- in. */}
100
- <GlyphButton
101
- testID="searchTextInputClearBtn"
102
- onPress={onClearText}
103
- accessibilityLabel={messages.clearQuery}
104
- size={28}
105
- icon={X}
106
- glyphSize={16}
107
- />
108
- </View>
109
- )}
110
103
  </FieldBox>
111
104
  );
112
105
  },
@@ -1,8 +1,13 @@
1
1
  import type { StyleProp, ViewStyle } from 'react-native';
2
+ import type { GlyphButtonProps } from '../button/types';
2
3
  import type { TextFieldInputProps } from '../text-field/types';
3
4
 
4
5
  export type SearchProps = Omit<TextFieldInputProps, 'label'> & {
5
6
  label?: TextFieldInputProps['label'];
7
+ /** Leading icon edge in pixels. Default 20. */
8
+ iconSize?: number;
9
+ /** Clear glyph/target geometry. Search owns its name, callback and disabled state. */
10
+ clearButtonProps?: Pick<GlyphButtonProps, 'icon' | 'size' | 'glyphSize'>;
6
11
  /** Called when the user presses the clear button. */
7
12
  onClearText?: () => void;
8
13
  /** Field layout classes (height, width and padding). */
@@ -7,16 +7,16 @@ import { resolveSurfaceOptics, resolveSurfaceTint } from './shared';
7
7
  import { surfaceMaterialCss } from './web-material';
8
8
 
9
9
  /** Move a web host fill into the shared body and edge paint; preserve layout and shadow. */
10
- export function useSurfaceMaterial(selector: string, id: string, fill: string): WebCssStyle {
11
- useSurfaceRefraction(true);
10
+ export function useSurfaceMaterial(selector: string, id: string, fill: string, enabled = true): WebCssStyle {
11
+ useSurfaceRefraction(enabled);
12
12
  const css = useMemo(() => `${selector} { isolation: isolate; }\n${surfaceMaterialCss(selector, 'var(--bloom-surface-fill)')}`, [selector]);
13
13
  useInteractiveWebCss(id, css);
14
14
  const theme = useContext(BloomThemeContext)?.theme;
15
15
  const optics = resolveSurfaceOptics(theme?.isDark ?? false);
16
- return useMemo(() => ({
16
+ return useMemo(() => enabled ? ({
17
17
  backgroundColor: 'transparent',
18
18
  '--bloom-surface-fill': resolveSurfaceTint(fill),
19
19
  '--bloom-surface-rim': optics.rim,
20
20
  '--bloom-surface-sheen': optics.sheenCss,
21
- }), [optics, fill]);
21
+ }) : {}, [optics, fill, enabled]);
22
22
  }
@@ -474,7 +474,7 @@ export function TextFieldInput({
474
474
  // OVERRIDE it — so when the field has a text label the two must be the same
475
475
  // string rather than two spellings of it. On native there is no association
476
476
  // at all and this prop is the only name the control has.
477
- const accessibleName = field?.labelText ?? label;
477
+ const accessibleName = rest.accessibilityLabel ?? field?.labelText ?? label;
478
478
  const webDisabled = IS_WEB && fieldDisabled ? ({ disabled: true } as Record<string, unknown>) : undefined;
479
479
  const reveal = canReveal ? (
480
480
  <RevealButton
@@ -527,7 +527,7 @@ export function TextFieldInput({
527
527
  fontWeight: TEXT_FIELD_TEXT.fontWeight,
528
528
  color: fieldDisabled ? ctx.palette.textDisabled : ctx.palette.text,
529
529
  minWidth: 0,
530
- // Longhands, so a caller's `paddingRight` (Search's clear button) wins on
530
+ // Longhands, so caller-authored physical padding wins on
531
531
  // web too — `paddingHorizontal` becomes `padding-inline`, which outranks it.
532
532
  // Resolve against the field's layout direction, not the input's automatic
533
533
  // text direction (an English query may live inside an Arabic interface).
@@ -918,7 +918,7 @@ export function TextFieldHint({
918
918
  * disabled, red when it is invalid. The icon does not react to hover or
919
919
  * focus; the ring does.
920
920
  */
921
- export function TextFieldIcon({ icon: Comp, position = 'leading' }: TextFieldIconProps) {
921
+ export function TextFieldIcon({ icon: Comp, position = 'leading', size = 20 }: TextFieldIconProps) {
922
922
  const ctx = useTextFieldContext();
923
923
  const color = resolveIconColor(ctx.palette, {
924
924
  invalid: ctx.invalid,
@@ -934,7 +934,8 @@ export function TextFieldIcon({ icon: Comp, position = 'leading' }: TextFieldIco
934
934
  : { marginInlineStart: TEXT_FIELD_TRAILING_GAP },
935
935
  ]}>
936
936
  <Comp
937
- size="md"
937
+ width={size}
938
+ height={size}
938
939
  style={[
939
940
  {
940
941
  color,
@@ -105,8 +105,10 @@ export type TextFieldHintProps = React.PropsWithChildren<
105
105
  >;
106
106
 
107
107
  export interface TextFieldIconProps {
108
- /** A Bloom icon component, drawn at 20px. */
108
+ /** A Bloom icon component. */
109
109
  icon: React.ComponentType<SVGIconProps>;
110
+ /** Icon edge in pixels. Default 20. */
111
+ size?: number;
110
112
  /** `leading` (default) sits 2px before the input; `trailing` 8px after it. */
111
113
  position?: 'leading' | 'trailing';
112
114
  }