@oxy.so/bloom 7.16.1 → 7.18.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 (151) hide show
  1. package/docs/adoption-matrix.mdx +9 -9
  2. package/docs/carousel.mdx +22 -0
  3. package/docs/checkbox.mdx +21 -0
  4. package/docs/media-header.mdx +21 -0
  5. package/docs/overlay.mdx +9 -0
  6. package/docs/radio.mdx +20 -0
  7. package/docs/search.mdx +18 -1
  8. package/docs/text-field.mdx +15 -0
  9. package/lib/commonjs/accordion/Accordion.web.js +1 -0
  10. package/lib/commonjs/accordion/Accordion.web.js.map +1 -1
  11. package/lib/commonjs/carousel/Carousel.js +50 -20
  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/hooks/use-choice-space-key.js +37 -0
  16. package/lib/commonjs/hooks/use-choice-space-key.js.map +1 -0
  17. package/lib/commonjs/media-header/FollowLabel.js +46 -0
  18. package/lib/commonjs/media-header/FollowLabel.js.map +1 -0
  19. package/lib/commonjs/media-header/MediaActionBar.js +19 -13
  20. package/lib/commonjs/media-header/MediaActionBar.js.map +1 -1
  21. package/lib/commonjs/overlay/ModalKeyboard.js +4 -6
  22. package/lib/commonjs/overlay/ModalKeyboard.js.map +1 -1
  23. package/lib/commonjs/overlay/modal-keyboard.js +44 -0
  24. package/lib/commonjs/overlay/modal-keyboard.js.map +1 -1
  25. package/lib/commonjs/radio/Radio.js +14 -3
  26. package/lib/commonjs/radio/Radio.js.map +1 -1
  27. package/lib/commonjs/search/Search.js +11 -2
  28. package/lib/commonjs/search/Search.js.map +1 -1
  29. package/lib/commonjs/search/types.js +6 -0
  30. package/lib/commonjs/search/types.js.map +1 -0
  31. package/lib/commonjs/text-field/FieldBox.js +83 -0
  32. package/lib/commonjs/text-field/FieldBox.js.map +1 -0
  33. package/lib/commonjs/text-field/TextField.js +17 -7
  34. package/lib/commonjs/text-field/TextField.js.map +1 -1
  35. package/lib/module/accordion/Accordion.web.js +1 -0
  36. package/lib/module/accordion/Accordion.web.js.map +1 -1
  37. package/lib/module/carousel/Carousel.js +50 -20
  38. package/lib/module/carousel/Carousel.js.map +1 -1
  39. package/lib/module/checkbox/Checkbox.js +15 -9
  40. package/lib/module/checkbox/Checkbox.js.map +1 -1
  41. package/lib/module/hooks/use-choice-space-key.js +34 -0
  42. package/lib/module/hooks/use-choice-space-key.js.map +1 -0
  43. package/lib/module/media-header/FollowLabel.js +42 -0
  44. package/lib/module/media-header/FollowLabel.js.map +1 -0
  45. package/lib/module/media-header/MediaActionBar.js +19 -13
  46. package/lib/module/media-header/MediaActionBar.js.map +1 -1
  47. package/lib/module/overlay/ModalKeyboard.js +5 -7
  48. package/lib/module/overlay/ModalKeyboard.js.map +1 -1
  49. package/lib/module/overlay/modal-keyboard.js +43 -0
  50. package/lib/module/overlay/modal-keyboard.js.map +1 -1
  51. package/lib/module/radio/Radio.js +14 -3
  52. package/lib/module/radio/Radio.js.map +1 -1
  53. package/lib/module/search/Search.js +11 -2
  54. package/lib/module/search/Search.js.map +1 -1
  55. package/lib/module/search/types.js +4 -0
  56. package/lib/module/search/types.js.map +1 -0
  57. package/lib/module/text-field/FieldBox.js +79 -0
  58. package/lib/module/text-field/FieldBox.js.map +1 -0
  59. package/lib/module/text-field/TextField.js +17 -7
  60. package/lib/module/text-field/TextField.js.map +1 -1
  61. package/lib/typescript/commonjs/carousel/Carousel.d.ts +1 -1
  62. package/lib/typescript/commonjs/carousel/Carousel.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/carousel/index.d.ts +1 -1
  64. package/lib/typescript/commonjs/carousel/index.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/carousel/types.d.ts +7 -0
  66. package/lib/typescript/commonjs/carousel/types.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/checkbox/Checkbox.d.ts.map +1 -1
  68. package/lib/typescript/commonjs/checkbox/types.d.ts +4 -0
  69. package/lib/typescript/commonjs/checkbox/types.d.ts.map +1 -1
  70. package/lib/typescript/commonjs/hooks/use-choice-space-key.d.ts +14 -0
  71. package/lib/typescript/commonjs/hooks/use-choice-space-key.d.ts.map +1 -0
  72. package/lib/typescript/commonjs/media-header/FollowLabel.d.ts +11 -0
  73. package/lib/typescript/commonjs/media-header/FollowLabel.d.ts.map +1 -0
  74. package/lib/typescript/commonjs/media-header/MediaActionBar.d.ts +1 -1
  75. package/lib/typescript/commonjs/media-header/MediaActionBar.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/media-header/types.d.ts +10 -0
  77. package/lib/typescript/commonjs/media-header/types.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/overlay/modal-keyboard.d.ts +2 -0
  79. package/lib/typescript/commonjs/overlay/modal-keyboard.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/radio/Radio.d.ts +1 -1
  81. package/lib/typescript/commonjs/radio/Radio.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/radio/types.d.ts +4 -0
  83. package/lib/typescript/commonjs/radio/types.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/search/Search.d.ts +6 -6
  85. package/lib/typescript/commonjs/search/Search.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/search/index.d.ts +1 -0
  87. package/lib/typescript/commonjs/search/index.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/search/types.d.ts +15 -0
  89. package/lib/typescript/commonjs/search/types.d.ts.map +1 -0
  90. package/lib/typescript/commonjs/text-field/FieldBox.d.ts +19 -0
  91. package/lib/typescript/commonjs/text-field/FieldBox.d.ts.map +1 -0
  92. package/lib/typescript/commonjs/text-field/TextField.d.ts +1 -1
  93. package/lib/typescript/commonjs/text-field/TextField.d.ts.map +1 -1
  94. package/lib/typescript/commonjs/text-field/types.d.ts +4 -0
  95. package/lib/typescript/commonjs/text-field/types.d.ts.map +1 -1
  96. package/lib/typescript/module/carousel/Carousel.d.ts +1 -1
  97. package/lib/typescript/module/carousel/Carousel.d.ts.map +1 -1
  98. package/lib/typescript/module/carousel/index.d.ts +1 -1
  99. package/lib/typescript/module/carousel/index.d.ts.map +1 -1
  100. package/lib/typescript/module/carousel/types.d.ts +7 -0
  101. package/lib/typescript/module/carousel/types.d.ts.map +1 -1
  102. package/lib/typescript/module/checkbox/Checkbox.d.ts.map +1 -1
  103. package/lib/typescript/module/checkbox/types.d.ts +4 -0
  104. package/lib/typescript/module/checkbox/types.d.ts.map +1 -1
  105. package/lib/typescript/module/hooks/use-choice-space-key.d.ts +14 -0
  106. package/lib/typescript/module/hooks/use-choice-space-key.d.ts.map +1 -0
  107. package/lib/typescript/module/media-header/FollowLabel.d.ts +11 -0
  108. package/lib/typescript/module/media-header/FollowLabel.d.ts.map +1 -0
  109. package/lib/typescript/module/media-header/MediaActionBar.d.ts +1 -1
  110. package/lib/typescript/module/media-header/MediaActionBar.d.ts.map +1 -1
  111. package/lib/typescript/module/media-header/types.d.ts +10 -0
  112. package/lib/typescript/module/media-header/types.d.ts.map +1 -1
  113. package/lib/typescript/module/overlay/modal-keyboard.d.ts +2 -0
  114. package/lib/typescript/module/overlay/modal-keyboard.d.ts.map +1 -1
  115. package/lib/typescript/module/radio/Radio.d.ts +1 -1
  116. package/lib/typescript/module/radio/Radio.d.ts.map +1 -1
  117. package/lib/typescript/module/radio/types.d.ts +4 -0
  118. package/lib/typescript/module/radio/types.d.ts.map +1 -1
  119. package/lib/typescript/module/search/Search.d.ts +6 -6
  120. package/lib/typescript/module/search/Search.d.ts.map +1 -1
  121. package/lib/typescript/module/search/index.d.ts +1 -0
  122. package/lib/typescript/module/search/index.d.ts.map +1 -1
  123. package/lib/typescript/module/search/types.d.ts +15 -0
  124. package/lib/typescript/module/search/types.d.ts.map +1 -0
  125. package/lib/typescript/module/text-field/FieldBox.d.ts +19 -0
  126. package/lib/typescript/module/text-field/FieldBox.d.ts.map +1 -0
  127. package/lib/typescript/module/text-field/TextField.d.ts +1 -1
  128. package/lib/typescript/module/text-field/TextField.d.ts.map +1 -1
  129. package/lib/typescript/module/text-field/types.d.ts +4 -0
  130. package/lib/typescript/module/text-field/types.d.ts.map +1 -1
  131. package/package.json +1 -1
  132. package/src/accordion/Accordion.web.tsx +1 -1
  133. package/src/carousel/Carousel.tsx +37 -12
  134. package/src/carousel/index.ts +1 -1
  135. package/src/carousel/types.ts +9 -0
  136. package/src/checkbox/Checkbox.tsx +13 -3
  137. package/src/checkbox/types.ts +4 -0
  138. package/src/hooks/use-choice-space-key.ts +29 -0
  139. package/src/media-header/FollowLabel.tsx +23 -0
  140. package/src/media-header/MediaActionBar.tsx +11 -6
  141. package/src/media-header/types.ts +10 -0
  142. package/src/overlay/ModalKeyboard.tsx +5 -5
  143. package/src/overlay/modal-keyboard.ts +30 -0
  144. package/src/radio/Radio.tsx +13 -3
  145. package/src/radio/types.ts +4 -0
  146. package/src/search/Search.tsx +7 -13
  147. package/src/search/index.ts +2 -0
  148. package/src/search/types.ts +15 -0
  149. package/src/text-field/FieldBox.tsx +51 -0
  150. package/src/text-field/TextField.tsx +15 -7
  151. package/src/text-field/types.ts +4 -0
@@ -1,3 +1,4 @@
1
+ import { useChoiceSpaceKey } from '../hooks/use-choice-space-key';
1
2
  import { useControllableState } from '../hooks/use-controllable-state';
2
3
  import { useBloomAppearance } from '../appearance';
3
4
  import { resolveBloomColors } from '../appearance/colors';
@@ -94,6 +95,7 @@ const RadioComponent = function Radio<Value extends string = string>({
94
95
  checked: checkedProp,
95
96
  onValueChange,
96
97
  label,
98
+ labelContent,
97
99
  description,
98
100
  size: sizeProp,
99
101
  disabled = false,
@@ -123,7 +125,8 @@ const RadioComponent = function Radio<Value extends string = string>({
123
125
  useInteractiveWebCss(STYLE_ID, BLOOM_RADIO_CSS);
124
126
  const sizeConfig = SIZE_CONFIG[size];
125
127
  const { accent } = useMemo(() => resolveButtonRamps(theme), [theme]);
126
- const hasText = Boolean(label || description);
128
+ const hasLabel = labelContent != null || Boolean(label);
129
+ const hasText = hasLabel || Boolean(description);
127
130
 
128
131
  const handlePress = useCallback(() => {
129
132
  // Re-choosing the chosen option is a no-op. A radio, unlike a checkbox, has
@@ -144,8 +147,11 @@ const RadioComponent = function Radio<Value extends string = string>({
144
147
  ...ringOffset,
145
148
  };
146
149
 
150
+ const spaceKey = useChoiceSpaceKey(isDisabled, handlePress);
151
+
147
152
  return (
148
153
  <Pressable
154
+ {...spaceKey}
149
155
  {...(IS_WEB ? ({ dataSet: { bloomRadio: '' } } as Record<string, unknown>) : {})}
150
156
  style={[rowStyle, style]}
151
157
  onPress={handlePress}
@@ -176,7 +182,11 @@ const RadioComponent = function Radio<Value extends string = string>({
176
182
 
177
183
  {hasText && (
178
184
  <View style={{ flex: 1 }}>
179
- {label && (
185
+ {labelContent != null ? (
186
+ <View pointerEvents="none" aria-hidden accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
187
+ {labelContent}
188
+ </View>
189
+ ) : label && (
180
190
  <Text variant={sizeConfig.label} style={[{ color: theme.colors.text }, labelStyle]}>
181
191
  {label}
182
192
  </Text>
@@ -184,7 +194,7 @@ const RadioComponent = function Radio<Value extends string = string>({
184
194
  {description && (
185
195
  <Text
186
196
  variant={sizeConfig.description}
187
- style={{ color: theme.colors.textSecondary, marginTop: label ? DESCRIPTION_GAP : 0 }}
197
+ style={{ color: theme.colors.textSecondary, marginTop: hasLabel ? DESCRIPTION_GAP : 0 }}
188
198
  >
189
199
  {description}
190
200
  </Text>
@@ -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. */
@@ -2,6 +2,8 @@ import { forwardRef, useCallback, useMemo, useRef } from 'react';
2
2
  import { Platform, type TextInput, View } from 'react-native';
3
3
 
4
4
  import { mergeRefs } from '../hooks/merge-refs';
5
+ import { FieldBox } from '../text-field/FieldBox';
6
+ import type { SearchProps } from './types';
5
7
  import { useDirectionProps, useIsRtl } from '../hooks/use-is-rtl';
6
8
  import { useCommonMessages } from '../locale/common-messages';
7
9
  import { useMessages } from '../locale/messages';
@@ -11,20 +13,12 @@ import { useTheme } from '../theme/use-theme';
11
13
  import { atoms as a } from '../styles';
12
14
  import { borderRadius } from '../styles/tokens';
13
15
  import { GlyphButton } from '../button';
14
- import { TextField, TextFieldIcon, TextFieldInput, type TextFieldInputProps } from '../text-field';
16
+ import { TextField, TextFieldIcon, TextFieldInput } from '../text-field';
15
17
  import { RiSearchLine as MagnifyingGlassIcon } from '../icons/remix/RiSearchLine';
16
18
  import { RiCloseLine as X } from '../icons/remix/RiCloseLine';
17
19
 
18
- type SearchProps = Omit<TextFieldInputProps, 'label'> & {
19
- label?: TextFieldInputProps['label'];
20
- /**
21
- * Called when the user presses the clear (X) button.
22
- */
23
- onClearText?: () => void;
24
- };
25
-
26
20
  export const Search = forwardRef<TextInput, SearchProps>(
27
- function Search({ value, label: labelProp, onClearText, onFocus, onPressIn, ...rest }, ref) {
21
+ function Search({ value, label: labelProp, onClearText, onFocus, onPressIn, fieldClassName, fieldChromeClassName, containerClassName, containerStyle, ...rest }, ref) {
28
22
  const theme = useTheme();
29
23
  const direction = useDirectionProps();
30
24
  const rtl = useIsRtl();
@@ -69,8 +63,8 @@ export const Search = forwardRef<TextInput, SearchProps>(
69
63
  );
70
64
 
71
65
  return (
72
- <View {...direction} style={[a.w_full, a.relative]}>
73
- <TextField radius={borderRadius.full}>
66
+ <FieldBox {...direction} className={containerClassName} style={containerStyle} baseStyle={[a.w_full, a.relative]}>
67
+ <TextField radius={borderRadius.full} className={fieldClassName} chromeClassName={fieldChromeClassName}>
74
68
  <TextFieldIcon icon={MagnifyingGlassIcon} />
75
69
  <TextFieldInput
76
70
  inputRef={refs}
@@ -113,7 +107,7 @@ export const Search = forwardRef<TextInput, SearchProps>(
113
107
  />
114
108
  </View>
115
109
  )}
116
- </View>
110
+ </FieldBox>
117
111
  );
118
112
  },
119
113
  );
@@ -1,3 +1,5 @@
1
1
  export {
2
2
  Search,
3
3
  } from './Search';
4
+
5
+ export type { SearchProps } from './types';
@@ -0,0 +1,15 @@
1
+ import type { StyleProp, ViewStyle } from 'react-native';
2
+ import type { TextFieldInputProps } from '../text-field/types';
3
+
4
+ export type SearchProps = Omit<TextFieldInputProps, 'label'> & {
5
+ label?: TextFieldInputProps['label'];
6
+ /** Called when the user presses the clear button. */
7
+ onClearText?: () => void;
8
+ /** Field layout classes (height, width and padding). */
9
+ fieldClassName?: string;
10
+ /** Inset surface classes (background, border/ring and radius). */
11
+ fieldChromeClassName?: string;
12
+ /** Classes on the outer layout box, including the clear control. */
13
+ containerClassName?: string;
14
+ containerStyle?: StyleProp<ViewStyle>;
15
+ };
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { Platform, View, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { styled } from 'react-native-css';
4
+ import { useInteractiveWebCss } from '../styles/interactive-web-css';
5
+ import { resolveNativeWebStyle } from '../styles/resolve-native-web-style';
6
+
7
+ // The field owns two distinct boxes: layout and a non-layout inset ring. Keep
8
+ // their defaults below caller classes without moving the ring into box sizing.
9
+ const properties = ['width', 'minWidth', 'flex', 'flexDirection', 'alignItems', 'position',
10
+ 'paddingLeft', 'paddingRight', 'paddingInlineStart', 'paddingInlineEnd', 'borderRadius',
11
+ 'borderWidth', 'borderColor', 'backgroundColor', 'zIndex', 'top', 'right', 'bottom', 'left',
12
+ 'transitionProperty', 'transitionDuration', 'transitionTimingFunction'] as const;
13
+ const cssName = (name: string) => name.replace(/[A-Z]/g, c => `-${c.toLowerCase()}`);
14
+ const fallbacks: Record<string, string> = { borderWidth:'0px', minWidth:'0px', flex:'0 0 auto', flexDirection:'column' };
15
+ const CSS = `@layer base { [data-bloom-field-box] { display:flex; box-sizing:border-box; border-style:solid; border-width:0; min-width:0; ${properties.map(name => `${cssName(name)}:var(--bloom-field-${cssName(name)},${fallbacks[name] ?? 'initial'});`).join('')} } }`;
16
+ interface FieldBoxProps {
17
+ children?: React.ReactNode;
18
+ className?: string;
19
+ style?: StyleProp<ViewStyle>;
20
+ baseStyle?: StyleProp<ViewStyle>;
21
+ stateStyle?: StyleProp<ViewStyle>;
22
+ dir?: 'rtl';
23
+ pointerEvents?: 'none' | 'auto';
24
+ onClick?: () => void;
25
+ onMouseOver?: () => void;
26
+ onMouseOut?: () => void;
27
+ testID?: string;
28
+ }
29
+ function FieldBoxComponent({ children, className, style, baseStyle, stateStyle, dir, pointerEvents, onClick,
30
+ onMouseOver, onMouseOut, testID }: FieldBoxProps) {
31
+ useInteractiveWebCss('bloom-field-box', CSS);
32
+ if (Platform.OS !== 'web') return <View pointerEvents={pointerEvents} testID={testID}
33
+ style={[baseStyle, style, stateStyle]}>{children}</View>;
34
+ const defaults = resolveNativeWebStyle(baseStyle);
35
+ const variables: Record<string, unknown> = {};
36
+ for (const name of properties) {
37
+ const value = defaults[name as keyof React.CSSProperties];
38
+ if (value === undefined || value === null) { variables[`--bloom-field-${cssName(name)}`] = 'initial'; continue; }
39
+ const unit = typeof value === 'number' && !['flex', 'zIndex'].includes(name) ? 'px' : '';
40
+ variables[`--bloom-field-${cssName(name)}`] = `${value}${unit}`;
41
+ }
42
+ return <div data-bloom-field-box="" data-testid={testID} className={className} dir={dir ?? 'ltr'}
43
+ onClick={onClick} onMouseOver={onMouseOver} onMouseOut={onMouseOut}
44
+ style={{ ...variables, ...resolveNativeWebStyle(style), ...resolveNativeWebStyle(stateStyle), pointerEvents }}>
45
+ {/* RNW resolves logical styles from its own direction context. This
46
+ context carrier has no CSS box; the div remains the sole layout host. */}
47
+ <View {...{ dir: dir ?? 'ltr' }} style={{ display: 'contents' }}>{children}</View>
48
+ </div>;
49
+ }
50
+ const NativeFieldBox = styled(FieldBoxComponent, { className: 'style' });
51
+ export const FieldBox = Platform.OS === 'web' ? FieldBoxComponent : NativeFieldBox;
@@ -1,4 +1,5 @@
1
1
  import { useBloomAppearance } from '../appearance';
2
+ import { FieldBox } from './FieldBox';
2
3
  import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
3
4
  import {
4
5
  type AccessibilityProps,
@@ -88,6 +89,7 @@ interface TextFieldContextValue {
88
89
  addonFocused: boolean;
89
90
  /** Inside an `InputGroup`: the group paints the shell, so the field draws none. */
90
91
  bare: boolean;
92
+ chromeClassName?: string;
91
93
  }
92
94
 
93
95
  /**
@@ -167,6 +169,8 @@ export function TextField({
167
169
  size: sizeProp,
168
170
  radius = TEXT_FIELD_RADIUS,
169
171
  leadingAddon,
172
+ className,
173
+ chromeClassName,
170
174
  style,
171
175
  }: TextFieldProps) {
172
176
  const theme = useTheme();
@@ -223,15 +227,18 @@ export function TextField({
223
227
  palette,
224
228
  radius,
225
229
  bare,
230
+ chromeClassName,
226
231
  }),
227
- [inputRef, hovered, onHoverIn, onHoverOut, focused, onFocus, onBlur, addonFocused, invalid, resolvedDisabled, size, palette, radius, bare],
232
+ [inputRef, hovered, onHoverIn, onHoverOut, focused, onFocus, onBlur, addonFocused, invalid, resolvedDisabled, size, palette, radius, bare, chromeClassName],
228
233
  );
229
234
 
230
235
  return (
231
236
  <Context.Provider value={context}>
232
- <View
237
+ <FieldBox
233
238
  {...direction}
234
- style={[
239
+ className={className}
240
+ style={style}
241
+ baseStyle={[
235
242
  a.flex_row,
236
243
  a.align_center,
237
244
  a.relative,
@@ -243,7 +250,6 @@ export function TextField({
243
250
  ? TEXT_FIELD_ADDON_PADDING[size]
244
251
  : { paddingHorizontal: TEXT_FIELD_GEOMETRY[size].paddingHorizontal },
245
252
  ],
246
- style,
247
253
  ]}
248
254
  {...(IS_WEB
249
255
  ? ({
@@ -256,7 +262,7 @@ export function TextField({
256
262
  <LeadingAddon onFocusChange={setAddonFocused}>{leadingAddon}</LeadingAddon>
257
263
  ) : null}
258
264
  {children}
259
- </View>
265
+ </FieldBox>
260
266
  </Context.Provider>
261
267
  );
262
268
  }
@@ -328,9 +334,11 @@ function Chrome({ invalid }: { invalid: boolean }) {
328
334
  disabled: ctx.disabled,
329
335
  });
330
336
  return (
331
- <View
337
+ <FieldBox
332
338
  pointerEvents="none"
333
- style={[
339
+ className={ctx.chromeClassName}
340
+ stateStyle={ctx.disabled || invalid ? paint : ctx.focused || ctx.addonFocused ? { borderColor: paint.borderColor } : undefined}
341
+ baseStyle={[
334
342
  a.z_10,
335
343
  a.absolute,
336
344
  a.inset_0,
@@ -8,6 +8,10 @@ export type { TextFieldSize } from './shared';
8
8
 
9
9
  export type TextFieldProps = React.PropsWithChildren<
10
10
  {
11
+ /** Classes on the layout host: width, height and padding. */
12
+ className?: string;
13
+ /** Classes on the inset surface: background, border/ring and radius. State paint remains authoritative. */
14
+ chromeClassName?: string;
11
15
  invalid?: boolean;
12
16
  isInvalid?: boolean;
13
17
  /**