@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.
- package/docs/adoption-matrix.mdx +12 -12
- package/docs/carousel.mdx +28 -2
- package/docs/checkbox.mdx +21 -0
- package/docs/dialog.mdx +16 -0
- package/docs/media-header.mdx +21 -0
- package/docs/popover.mdx +8 -0
- package/docs/radio.mdx +35 -0
- package/docs/search.mdx +19 -0
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +4 -3
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/commonjs/carousel/Carousel.js +52 -15
- package/lib/commonjs/carousel/Carousel.js.map +1 -1
- package/lib/commonjs/checkbox/Checkbox.js +15 -9
- package/lib/commonjs/checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.js +11 -3
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +15 -6
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js +3 -0
- package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/commonjs/dialog/DialogHeader.js +9 -1
- package/lib/commonjs/dialog/DialogHeader.js.map +1 -1
- package/lib/commonjs/dialog/SheetShell.js +3 -0
- package/lib/commonjs/dialog/SheetShell.js.map +1 -1
- package/lib/commonjs/floating/FloatingPanel.js +5 -3
- package/lib/commonjs/floating/FloatingPanel.js.map +1 -1
- package/lib/commonjs/hooks/use-choice-space-key.js +37 -0
- package/lib/commonjs/hooks/use-choice-space-key.js.map +1 -0
- package/lib/commonjs/media-header/FollowLabel.js +46 -0
- package/lib/commonjs/media-header/FollowLabel.js.map +1 -0
- package/lib/commonjs/media-header/MediaActionBar.js +19 -13
- package/lib/commonjs/media-header/MediaActionBar.js.map +1 -1
- package/lib/commonjs/popover/Popover.js +2 -0
- package/lib/commonjs/popover/Popover.js.map +1 -1
- package/lib/commonjs/popover/Popover.web.js +2 -0
- package/lib/commonjs/popover/Popover.web.js.map +1 -1
- package/lib/commonjs/radio/Radio.js +83 -34
- package/lib/commonjs/radio/Radio.js.map +1 -1
- package/lib/commonjs/radio/RadioCard.js +3 -0
- package/lib/commonjs/radio/RadioCard.js.map +1 -1
- package/lib/commonjs/radio/context.js +9 -0
- package/lib/commonjs/radio/context.js.map +1 -0
- package/lib/commonjs/radio/use-radio-group-item.js +29 -0
- package/lib/commonjs/radio/use-radio-group-item.js.map +1 -0
- package/lib/commonjs/search/Search.js +29 -23
- package/lib/commonjs/search/Search.js.map +1 -1
- package/lib/commonjs/surface/use-surface-material.web.js +4 -4
- package/lib/commonjs/surface/use-surface-material.web.js.map +1 -1
- package/lib/commonjs/text-field/TextField.js +6 -4
- package/lib/commonjs/text-field/TextField.js.map +1 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js +4 -3
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -1
- package/lib/module/carousel/Carousel.js +52 -15
- package/lib/module/carousel/Carousel.js.map +1 -1
- package/lib/module/checkbox/Checkbox.js +15 -9
- package/lib/module/checkbox/Checkbox.js.map +1 -1
- package/lib/module/dialog/Dialog.js +11 -3
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +15 -6
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/DialogBottomSheet.js +3 -0
- package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/module/dialog/DialogHeader.js +9 -1
- package/lib/module/dialog/DialogHeader.js.map +1 -1
- package/lib/module/dialog/SheetShell.js +3 -0
- package/lib/module/dialog/SheetShell.js.map +1 -1
- package/lib/module/floating/FloatingPanel.js +5 -3
- package/lib/module/floating/FloatingPanel.js.map +1 -1
- package/lib/module/hooks/use-choice-space-key.js +34 -0
- package/lib/module/hooks/use-choice-space-key.js.map +1 -0
- package/lib/module/media-header/FollowLabel.js +42 -0
- package/lib/module/media-header/FollowLabel.js.map +1 -0
- package/lib/module/media-header/MediaActionBar.js +19 -13
- package/lib/module/media-header/MediaActionBar.js.map +1 -1
- package/lib/module/popover/Popover.js +2 -0
- package/lib/module/popover/Popover.js.map +1 -1
- package/lib/module/popover/Popover.web.js +2 -0
- package/lib/module/popover/Popover.web.js.map +1 -1
- package/lib/module/radio/Radio.js +84 -35
- package/lib/module/radio/Radio.js.map +1 -1
- package/lib/module/radio/RadioCard.js +3 -0
- package/lib/module/radio/RadioCard.js.map +1 -1
- package/lib/module/radio/context.js +5 -0
- package/lib/module/radio/context.js.map +1 -0
- package/lib/module/radio/use-radio-group-item.js +26 -0
- package/lib/module/radio/use-radio-group-item.js.map +1 -0
- package/lib/module/search/Search.js +32 -26
- package/lib/module/search/Search.js.map +1 -1
- package/lib/module/surface/use-surface-material.web.js +4 -4
- package/lib/module/surface/use-surface-material.web.js.map +1 -1
- package/lib/module/text-field/TextField.js +6 -4
- package/lib/module/text-field/TextField.js.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts +2 -0
- package/lib/typescript/commonjs/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/carousel/Carousel.d.ts +1 -1
- package/lib/typescript/commonjs/carousel/Carousel.d.ts.map +1 -1
- package/lib/typescript/commonjs/carousel/types.d.ts +11 -2
- package/lib/typescript/commonjs/carousel/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/commonjs/checkbox/types.d.ts +4 -0
- package/lib/typescript/commonjs/checkbox/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts +2 -2
- package/lib/typescript/commonjs/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogHeader.d.ts +2 -0
- package/lib/typescript/commonjs/dialog/DialogHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/SheetShell.d.ts +2 -1
- package/lib/typescript/commonjs/dialog/SheetShell.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/types.d.ts +2 -0
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/floating/FloatingPanel.d.ts +1 -1
- package/lib/typescript/commonjs/floating/FloatingPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/floating/types.d.ts +1 -0
- package/lib/typescript/commonjs/floating/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/use-choice-space-key.d.ts +14 -0
- package/lib/typescript/commonjs/hooks/use-choice-space-key.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-header/FollowLabel.d.ts +11 -0
- package/lib/typescript/commonjs/media-header/FollowLabel.d.ts.map +1 -0
- package/lib/typescript/commonjs/media-header/MediaActionBar.d.ts +1 -1
- package/lib/typescript/commonjs/media-header/MediaActionBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/media-header/types.d.ts +10 -0
- package/lib/typescript/commonjs/media-header/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/popover/Popover.d.ts +1 -1
- package/lib/typescript/commonjs/popover/Popover.d.ts.map +1 -1
- package/lib/typescript/commonjs/popover/Popover.web.d.ts +1 -1
- package/lib/typescript/commonjs/popover/Popover.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/popover/types.d.ts +4 -1
- package/lib/typescript/commonjs/popover/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/Radio.d.ts +1 -1
- package/lib/typescript/commonjs/radio/Radio.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/RadioCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/context.d.ts +9 -0
- package/lib/typescript/commonjs/radio/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/radio/types.d.ts +6 -0
- package/lib/typescript/commonjs/radio/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/radio/use-radio-group-item.d.ts +3 -0
- package/lib/typescript/commonjs/radio/use-radio-group-item.d.ts.map +1 -0
- package/lib/typescript/commonjs/search/Search.d.ts +2 -0
- package/lib/typescript/commonjs/search/Search.d.ts.map +1 -1
- package/lib/typescript/commonjs/search/types.d.ts +5 -0
- package/lib/typescript/commonjs/search/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/surface/use-surface-material.web.d.ts +1 -1
- package/lib/typescript/commonjs/surface/use-surface-material.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/text-field/TextField.d.ts +1 -1
- package/lib/typescript/commonjs/text-field/TextField.d.ts.map +1 -1
- package/lib/typescript/commonjs/text-field/types.d.ts +3 -1
- package/lib/typescript/commonjs/text-field/types.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/types.d.ts +2 -0
- package/lib/typescript/module/bottom-sheet/types.d.ts.map +1 -1
- package/lib/typescript/module/carousel/Carousel.d.ts +1 -1
- package/lib/typescript/module/carousel/Carousel.d.ts.map +1 -1
- package/lib/typescript/module/carousel/types.d.ts +11 -2
- package/lib/typescript/module/carousel/types.d.ts.map +1 -1
- package/lib/typescript/module/checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/module/checkbox/types.d.ts +4 -0
- package/lib/typescript/module/checkbox/types.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts +2 -2
- package/lib/typescript/module/dialog/DialogBottomSheet.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogHeader.d.ts +2 -0
- package/lib/typescript/module/dialog/DialogHeader.d.ts.map +1 -1
- package/lib/typescript/module/dialog/SheetShell.d.ts +2 -1
- package/lib/typescript/module/dialog/SheetShell.d.ts.map +1 -1
- package/lib/typescript/module/dialog/types.d.ts +2 -0
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/floating/FloatingPanel.d.ts +1 -1
- package/lib/typescript/module/floating/FloatingPanel.d.ts.map +1 -1
- package/lib/typescript/module/floating/types.d.ts +1 -0
- package/lib/typescript/module/floating/types.d.ts.map +1 -1
- package/lib/typescript/module/hooks/use-choice-space-key.d.ts +14 -0
- package/lib/typescript/module/hooks/use-choice-space-key.d.ts.map +1 -0
- package/lib/typescript/module/media-header/FollowLabel.d.ts +11 -0
- package/lib/typescript/module/media-header/FollowLabel.d.ts.map +1 -0
- package/lib/typescript/module/media-header/MediaActionBar.d.ts +1 -1
- package/lib/typescript/module/media-header/MediaActionBar.d.ts.map +1 -1
- package/lib/typescript/module/media-header/types.d.ts +10 -0
- package/lib/typescript/module/media-header/types.d.ts.map +1 -1
- package/lib/typescript/module/popover/Popover.d.ts +1 -1
- package/lib/typescript/module/popover/Popover.d.ts.map +1 -1
- package/lib/typescript/module/popover/Popover.web.d.ts +1 -1
- package/lib/typescript/module/popover/Popover.web.d.ts.map +1 -1
- package/lib/typescript/module/popover/types.d.ts +4 -1
- package/lib/typescript/module/popover/types.d.ts.map +1 -1
- package/lib/typescript/module/radio/Radio.d.ts +1 -1
- package/lib/typescript/module/radio/Radio.d.ts.map +1 -1
- package/lib/typescript/module/radio/RadioCard.d.ts.map +1 -1
- package/lib/typescript/module/radio/context.d.ts +9 -0
- package/lib/typescript/module/radio/context.d.ts.map +1 -0
- package/lib/typescript/module/radio/types.d.ts +6 -0
- package/lib/typescript/module/radio/types.d.ts.map +1 -1
- package/lib/typescript/module/radio/use-radio-group-item.d.ts +3 -0
- package/lib/typescript/module/radio/use-radio-group-item.d.ts.map +1 -0
- package/lib/typescript/module/search/Search.d.ts +2 -0
- package/lib/typescript/module/search/Search.d.ts.map +1 -1
- package/lib/typescript/module/search/types.d.ts +5 -0
- package/lib/typescript/module/search/types.d.ts.map +1 -1
- package/lib/typescript/module/surface/use-surface-material.web.d.ts +1 -1
- package/lib/typescript/module/surface/use-surface-material.web.d.ts.map +1 -1
- package/lib/typescript/module/text-field/TextField.d.ts +1 -1
- package/lib/typescript/module/text-field/TextField.d.ts.map +1 -1
- package/lib/typescript/module/text-field/types.d.ts +3 -1
- package/lib/typescript/module/text-field/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bottom-sheet/BottomSheetBase.tsx +4 -3
- package/src/bottom-sheet/types.ts +2 -0
- package/src/carousel/Carousel.tsx +46 -20
- package/src/carousel/types.ts +8 -2
- package/src/checkbox/Checkbox.tsx +13 -3
- package/src/checkbox/types.ts +4 -0
- package/src/dialog/Dialog.tsx +11 -3
- package/src/dialog/Dialog.web.tsx +15 -6
- package/src/dialog/DialogBottomSheet.tsx +4 -0
- package/src/dialog/DialogHeader.tsx +7 -1
- package/src/dialog/SheetShell.tsx +4 -0
- package/src/dialog/types.ts +2 -0
- package/src/floating/FloatingPanel.tsx +4 -3
- package/src/floating/types.ts +1 -0
- package/src/hooks/use-choice-space-key.ts +29 -0
- package/src/media-header/FollowLabel.tsx +23 -0
- package/src/media-header/MediaActionBar.tsx +11 -6
- package/src/media-header/types.ts +10 -0
- package/src/popover/Popover.tsx +2 -0
- package/src/popover/Popover.web.tsx +2 -0
- package/src/popover/types.ts +4 -1
- package/src/radio/Radio.tsx +77 -34
- package/src/radio/RadioCard.tsx +4 -0
- package/src/radio/context.ts +9 -0
- package/src/radio/types.ts +6 -0
- package/src/radio/use-radio-group-item.ts +20 -0
- package/src/search/Search.tsx +24 -31
- package/src/search/types.ts +5 -0
- package/src/surface/use-surface-material.web.ts +4 -4
- package/src/text-field/TextField.tsx +5 -4
- 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(
|
|
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
|
-
<
|
|
335
|
-
<
|
|
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
|
-
: <
|
|
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
|
-
: <
|
|
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=
|
|
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. */
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -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"
|
package/src/popover/types.ts
CHANGED
|
@@ -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 {
|
package/src/radio/Radio.tsx
CHANGED
|
@@ -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
|
|
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
|
-
{
|
|
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:
|
|
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
|
-
<
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
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
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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
|
|
package/src/radio/RadioCard.tsx
CHANGED
|
@@ -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);
|
package/src/radio/types.ts
CHANGED
|
@@ -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
|
+
}
|
package/src/search/Search.tsx
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { forwardRef, useCallback, useMemo, useRef } from 'react';
|
|
2
|
-
import { Platform, type TextInput
|
|
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
|
|
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
|
|
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
|
},
|
package/src/search/types.ts
CHANGED
|
@@ -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(
|
|
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
|
|
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
|
|
937
|
+
width={size}
|
|
938
|
+
height={size}
|
|
938
939
|
style={[
|
|
939
940
|
{
|
|
940
941
|
color,
|
package/src/text-field/types.ts
CHANGED
|
@@ -105,8 +105,10 @@ export type TextFieldHintProps = React.PropsWithChildren<
|
|
|
105
105
|
>;
|
|
106
106
|
|
|
107
107
|
export interface TextFieldIconProps {
|
|
108
|
-
/** A Bloom icon component
|
|
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
|
}
|