@metamask/design-system-react-native 0.20.0 → 0.22.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 (243) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/dist/components/AvatarIcon/AvatarIcon.cjs +2 -1
  3. package/dist/components/AvatarIcon/AvatarIcon.cjs.map +1 -1
  4. package/dist/components/AvatarIcon/AvatarIcon.constants.cjs +16 -16
  5. package/dist/components/AvatarIcon/AvatarIcon.constants.cjs.map +1 -1
  6. package/dist/components/AvatarIcon/AvatarIcon.constants.d.cts +1 -1
  7. package/dist/components/AvatarIcon/AvatarIcon.constants.d.cts.map +1 -1
  8. package/dist/components/AvatarIcon/AvatarIcon.constants.d.mts +1 -1
  9. package/dist/components/AvatarIcon/AvatarIcon.constants.d.mts.map +1 -1
  10. package/dist/components/AvatarIcon/AvatarIcon.constants.mjs +1 -1
  11. package/dist/components/AvatarIcon/AvatarIcon.constants.mjs.map +1 -1
  12. package/dist/components/AvatarIcon/AvatarIcon.d.cts.map +1 -1
  13. package/dist/components/AvatarIcon/AvatarIcon.d.mts.map +1 -1
  14. package/dist/components/AvatarIcon/AvatarIcon.mjs +2 -1
  15. package/dist/components/AvatarIcon/AvatarIcon.mjs.map +1 -1
  16. package/dist/components/AvatarIcon/AvatarIcon.types.cjs.map +1 -1
  17. package/dist/components/AvatarIcon/AvatarIcon.types.d.cts +3 -13
  18. package/dist/components/AvatarIcon/AvatarIcon.types.d.cts.map +1 -1
  19. package/dist/components/AvatarIcon/AvatarIcon.types.d.mts +3 -13
  20. package/dist/components/AvatarIcon/AvatarIcon.types.d.mts.map +1 -1
  21. package/dist/components/AvatarIcon/AvatarIcon.types.mjs.map +1 -1
  22. package/dist/components/AvatarIcon/index.cjs +4 -4
  23. package/dist/components/AvatarIcon/index.cjs.map +1 -1
  24. package/dist/components/AvatarIcon/index.d.cts +1 -1
  25. package/dist/components/AvatarIcon/index.d.cts.map +1 -1
  26. package/dist/components/AvatarIcon/index.d.mts +1 -1
  27. package/dist/components/AvatarIcon/index.d.mts.map +1 -1
  28. package/dist/components/AvatarIcon/index.mjs +1 -1
  29. package/dist/components/AvatarIcon/index.mjs.map +1 -1
  30. package/dist/components/BadgeIcon/BadgeIcon.cjs +2 -1
  31. package/dist/components/BadgeIcon/BadgeIcon.cjs.map +1 -1
  32. package/dist/components/BadgeIcon/BadgeIcon.d.cts.map +1 -1
  33. package/dist/components/BadgeIcon/BadgeIcon.d.mts.map +1 -1
  34. package/dist/components/BadgeIcon/BadgeIcon.mjs +2 -1
  35. package/dist/components/BadgeIcon/BadgeIcon.mjs.map +1 -1
  36. package/dist/components/BadgeIcon/BadgeIcon.types.cjs.map +1 -1
  37. package/dist/components/BadgeIcon/BadgeIcon.types.d.cts +5 -7
  38. package/dist/components/BadgeIcon/BadgeIcon.types.d.cts.map +1 -1
  39. package/dist/components/BadgeIcon/BadgeIcon.types.d.mts +5 -7
  40. package/dist/components/BadgeIcon/BadgeIcon.types.d.mts.map +1 -1
  41. package/dist/components/BadgeIcon/BadgeIcon.types.mjs.map +1 -1
  42. package/dist/components/BannerBase/BannerBase.cjs +2 -3
  43. package/dist/components/BannerBase/BannerBase.cjs.map +1 -1
  44. package/dist/components/BannerBase/BannerBase.d.cts.map +1 -1
  45. package/dist/components/BannerBase/BannerBase.d.mts.map +1 -1
  46. package/dist/components/BannerBase/BannerBase.mjs +1 -2
  47. package/dist/components/BannerBase/BannerBase.mjs.map +1 -1
  48. package/dist/components/Button/Button.cjs +6 -6
  49. package/dist/components/Button/Button.cjs.map +1 -1
  50. package/dist/components/Button/Button.d.cts.map +1 -1
  51. package/dist/components/Button/Button.d.mts.map +1 -1
  52. package/dist/components/Button/Button.mjs +1 -1
  53. package/dist/components/Button/Button.mjs.map +1 -1
  54. package/dist/components/Button/Button.types.cjs.map +1 -1
  55. package/dist/components/Button/Button.types.d.cts +2 -7
  56. package/dist/components/Button/Button.types.d.cts.map +1 -1
  57. package/dist/components/Button/Button.types.d.mts +2 -7
  58. package/dist/components/Button/Button.types.d.mts.map +1 -1
  59. package/dist/components/Button/Button.types.mjs.map +1 -1
  60. package/dist/components/Button/index.cjs +3 -3
  61. package/dist/components/Button/index.cjs.map +1 -1
  62. package/dist/components/Button/index.d.cts +1 -1
  63. package/dist/components/Button/index.d.cts.map +1 -1
  64. package/dist/components/Button/index.d.mts +1 -1
  65. package/dist/components/Button/index.d.mts.map +1 -1
  66. package/dist/components/Button/index.mjs +1 -1
  67. package/dist/components/Button/index.mjs.map +1 -1
  68. package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.cjs +2 -0
  69. package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.cjs.map +1 -1
  70. package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.cts.map +1 -1
  71. package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.mts.map +1 -1
  72. package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.mjs +2 -0
  73. package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.mjs.map +1 -1
  74. package/dist/components/Button/variants/ButtonPrimary/index.cjs +1 -3
  75. package/dist/components/Button/variants/ButtonPrimary/index.cjs.map +1 -1
  76. package/dist/components/Button/variants/ButtonPrimary/index.d.cts +0 -1
  77. package/dist/components/Button/variants/ButtonPrimary/index.d.cts.map +1 -1
  78. package/dist/components/Button/variants/ButtonPrimary/index.d.mts +0 -1
  79. package/dist/components/Button/variants/ButtonPrimary/index.d.mts.map +1 -1
  80. package/dist/components/Button/variants/ButtonPrimary/index.mjs +0 -1
  81. package/dist/components/Button/variants/ButtonPrimary/index.mjs.map +1 -1
  82. package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.cjs +2 -0
  83. package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.cjs.map +1 -1
  84. package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.cts.map +1 -1
  85. package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.mts.map +1 -1
  86. package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.mjs +2 -0
  87. package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.mjs.map +1 -1
  88. package/dist/components/Button/variants/ButtonSecondary/index.cjs +1 -3
  89. package/dist/components/Button/variants/ButtonSecondary/index.cjs.map +1 -1
  90. package/dist/components/Button/variants/ButtonSecondary/index.d.cts +0 -1
  91. package/dist/components/Button/variants/ButtonSecondary/index.d.cts.map +1 -1
  92. package/dist/components/Button/variants/ButtonSecondary/index.d.mts +0 -1
  93. package/dist/components/Button/variants/ButtonSecondary/index.d.mts.map +1 -1
  94. package/dist/components/Button/variants/ButtonSecondary/index.mjs +0 -1
  95. package/dist/components/Button/variants/ButtonSecondary/index.mjs.map +1 -1
  96. package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.cjs +2 -0
  97. package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.cjs.map +1 -1
  98. package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.cts.map +1 -1
  99. package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.mts.map +1 -1
  100. package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.mjs +2 -0
  101. package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.mjs.map +1 -1
  102. package/dist/components/Button/variants/ButtonTertiary/index.cjs +1 -3
  103. package/dist/components/Button/variants/ButtonTertiary/index.cjs.map +1 -1
  104. package/dist/components/Button/variants/ButtonTertiary/index.d.cts +0 -1
  105. package/dist/components/Button/variants/ButtonTertiary/index.d.cts.map +1 -1
  106. package/dist/components/Button/variants/ButtonTertiary/index.d.mts +0 -1
  107. package/dist/components/Button/variants/ButtonTertiary/index.d.mts.map +1 -1
  108. package/dist/components/Button/variants/ButtonTertiary/index.mjs +0 -1
  109. package/dist/components/Button/variants/ButtonTertiary/index.mjs.map +1 -1
  110. package/dist/components/ButtonBase/ButtonBase.cjs +2 -2
  111. package/dist/components/ButtonBase/ButtonBase.cjs.map +1 -1
  112. package/dist/components/ButtonBase/ButtonBase.constants.cjs +4 -4
  113. package/dist/components/ButtonBase/ButtonBase.constants.cjs.map +1 -1
  114. package/dist/components/ButtonBase/ButtonBase.constants.d.cts +1 -1
  115. package/dist/components/ButtonBase/ButtonBase.constants.d.cts.map +1 -1
  116. package/dist/components/ButtonBase/ButtonBase.constants.d.mts +1 -1
  117. package/dist/components/ButtonBase/ButtonBase.constants.d.mts.map +1 -1
  118. package/dist/components/ButtonBase/ButtonBase.constants.mjs +1 -1
  119. package/dist/components/ButtonBase/ButtonBase.constants.mjs.map +1 -1
  120. package/dist/components/ButtonBase/ButtonBase.d.cts.map +1 -1
  121. package/dist/components/ButtonBase/ButtonBase.d.mts.map +1 -1
  122. package/dist/components/ButtonBase/ButtonBase.mjs +1 -1
  123. package/dist/components/ButtonBase/ButtonBase.mjs.map +1 -1
  124. package/dist/components/ButtonBase/ButtonBase.types.cjs.map +1 -1
  125. package/dist/components/ButtonBase/ButtonBase.types.d.cts +3 -32
  126. package/dist/components/ButtonBase/ButtonBase.types.d.cts.map +1 -1
  127. package/dist/components/ButtonBase/ButtonBase.types.d.mts +3 -32
  128. package/dist/components/ButtonBase/ButtonBase.types.d.mts.map +1 -1
  129. package/dist/components/ButtonBase/ButtonBase.types.mjs.map +1 -1
  130. package/dist/components/ButtonBase/index.cjs +2 -2
  131. package/dist/components/ButtonBase/index.cjs.map +1 -1
  132. package/dist/components/ButtonBase/index.d.cts +1 -1
  133. package/dist/components/ButtonBase/index.d.cts.map +1 -1
  134. package/dist/components/ButtonBase/index.d.mts +1 -1
  135. package/dist/components/ButtonBase/index.d.mts.map +1 -1
  136. package/dist/components/ButtonBase/index.mjs +1 -1
  137. package/dist/components/ButtonBase/index.mjs.map +1 -1
  138. package/dist/components/ButtonHero/index.cjs +2 -2
  139. package/dist/components/ButtonHero/index.cjs.map +1 -1
  140. package/dist/components/ButtonHero/index.d.cts +1 -1
  141. package/dist/components/ButtonHero/index.d.cts.map +1 -1
  142. package/dist/components/ButtonHero/index.d.mts +1 -1
  143. package/dist/components/ButtonHero/index.d.mts.map +1 -1
  144. package/dist/components/ButtonHero/index.mjs +1 -1
  145. package/dist/components/ButtonHero/index.mjs.map +1 -1
  146. package/dist/components/ButtonIcon/ButtonIcon.cjs +6 -6
  147. package/dist/components/ButtonIcon/ButtonIcon.cjs.map +1 -1
  148. package/dist/components/ButtonIcon/ButtonIcon.constants.cjs +7 -8
  149. package/dist/components/ButtonIcon/ButtonIcon.constants.cjs.map +1 -1
  150. package/dist/components/ButtonIcon/ButtonIcon.constants.d.cts +1 -2
  151. package/dist/components/ButtonIcon/ButtonIcon.constants.d.cts.map +1 -1
  152. package/dist/components/ButtonIcon/ButtonIcon.constants.d.mts +1 -2
  153. package/dist/components/ButtonIcon/ButtonIcon.constants.d.mts.map +1 -1
  154. package/dist/components/ButtonIcon/ButtonIcon.constants.mjs +1 -2
  155. package/dist/components/ButtonIcon/ButtonIcon.constants.mjs.map +1 -1
  156. package/dist/components/ButtonIcon/ButtonIcon.d.cts.map +1 -1
  157. package/dist/components/ButtonIcon/ButtonIcon.d.mts.map +1 -1
  158. package/dist/components/ButtonIcon/ButtonIcon.mjs +1 -1
  159. package/dist/components/ButtonIcon/ButtonIcon.mjs.map +1 -1
  160. package/dist/components/ButtonIcon/ButtonIcon.types.cjs.map +1 -1
  161. package/dist/components/ButtonIcon/ButtonIcon.types.d.cts +3 -26
  162. package/dist/components/ButtonIcon/ButtonIcon.types.d.cts.map +1 -1
  163. package/dist/components/ButtonIcon/ButtonIcon.types.d.mts +3 -26
  164. package/dist/components/ButtonIcon/ButtonIcon.types.d.mts.map +1 -1
  165. package/dist/components/ButtonIcon/ButtonIcon.types.mjs.map +1 -1
  166. package/dist/components/ButtonIcon/index.cjs +3 -3
  167. package/dist/components/ButtonIcon/index.cjs.map +1 -1
  168. package/dist/components/ButtonIcon/index.d.cts +1 -1
  169. package/dist/components/ButtonIcon/index.d.cts.map +1 -1
  170. package/dist/components/ButtonIcon/index.d.mts +1 -1
  171. package/dist/components/ButtonIcon/index.d.mts.map +1 -1
  172. package/dist/components/ButtonIcon/index.mjs +1 -1
  173. package/dist/components/ButtonIcon/index.mjs.map +1 -1
  174. package/dist/components/Icon/Icon.assets.cjs +2 -0
  175. package/dist/components/Icon/Icon.assets.cjs.map +1 -1
  176. package/dist/components/Icon/Icon.assets.d.cts.map +1 -1
  177. package/dist/components/Icon/Icon.assets.d.mts.map +1 -1
  178. package/dist/components/Icon/Icon.assets.mjs +2 -0
  179. package/dist/components/Icon/Icon.assets.mjs.map +1 -1
  180. package/dist/components/Icon/assets/telegram.svg +3 -0
  181. package/dist/components/Input/Input.cjs +2 -2
  182. package/dist/components/Input/Input.cjs.map +1 -1
  183. package/dist/components/Input/Input.d.cts +1 -1
  184. package/dist/components/Input/Input.d.mts +1 -1
  185. package/dist/components/Input/Input.mjs +2 -2
  186. package/dist/components/Input/Input.mjs.map +1 -1
  187. package/dist/components/Input/Input.types.cjs.map +1 -1
  188. package/dist/components/Input/Input.types.d.cts +1 -1
  189. package/dist/components/Input/Input.types.d.mts +1 -1
  190. package/dist/components/Input/Input.types.mjs.map +1 -1
  191. package/dist/components/KeyValueColumn/KeyValueColumn.cjs +2 -2
  192. package/dist/components/KeyValueColumn/KeyValueColumn.cjs.map +1 -1
  193. package/dist/components/KeyValueColumn/KeyValueColumn.d.cts.map +1 -1
  194. package/dist/components/KeyValueColumn/KeyValueColumn.d.mts.map +1 -1
  195. package/dist/components/KeyValueColumn/KeyValueColumn.mjs +2 -2
  196. package/dist/components/KeyValueColumn/KeyValueColumn.mjs.map +1 -1
  197. package/dist/components/KeyValueRow/KeyValueRow.cjs +2 -2
  198. package/dist/components/KeyValueRow/KeyValueRow.cjs.map +1 -1
  199. package/dist/components/KeyValueRow/KeyValueRow.d.cts.map +1 -1
  200. package/dist/components/KeyValueRow/KeyValueRow.d.mts.map +1 -1
  201. package/dist/components/KeyValueRow/KeyValueRow.mjs +2 -2
  202. package/dist/components/KeyValueRow/KeyValueRow.mjs.map +1 -1
  203. package/dist/components/TabEmptyState/TabEmptyState.cjs +1 -1
  204. package/dist/components/TabEmptyState/TabEmptyState.cjs.map +1 -1
  205. package/dist/components/TabEmptyState/TabEmptyState.d.cts.map +1 -1
  206. package/dist/components/TabEmptyState/TabEmptyState.d.mts.map +1 -1
  207. package/dist/components/TabEmptyState/TabEmptyState.mjs +1 -1
  208. package/dist/components/TabEmptyState/TabEmptyState.mjs.map +1 -1
  209. package/dist/components/TextField/TextField.cjs +10 -30
  210. package/dist/components/TextField/TextField.cjs.map +1 -1
  211. package/dist/components/TextField/TextField.d.cts +159 -7
  212. package/dist/components/TextField/TextField.d.cts.map +1 -1
  213. package/dist/components/TextField/TextField.d.mts +159 -7
  214. package/dist/components/TextField/TextField.d.mts.map +1 -1
  215. package/dist/components/TextField/TextField.mjs +12 -32
  216. package/dist/components/TextField/TextField.mjs.map +1 -1
  217. package/dist/components/TextField/TextField.types.cjs.map +1 -1
  218. package/dist/components/TextField/TextField.types.d.cts +41 -16
  219. package/dist/components/TextField/TextField.types.d.cts.map +1 -1
  220. package/dist/components/TextField/TextField.types.d.mts +41 -16
  221. package/dist/components/TextField/TextField.types.d.mts.map +1 -1
  222. package/dist/components/TextField/TextField.types.mjs.map +1 -1
  223. package/dist/components/TextFieldSearch/TextFieldSearch.cjs.map +1 -1
  224. package/dist/components/TextFieldSearch/TextFieldSearch.d.cts +160 -8
  225. package/dist/components/TextFieldSearch/TextFieldSearch.d.cts.map +1 -1
  226. package/dist/components/TextFieldSearch/TextFieldSearch.d.mts +160 -8
  227. package/dist/components/TextFieldSearch/TextFieldSearch.d.mts.map +1 -1
  228. package/dist/components/TextFieldSearch/TextFieldSearch.mjs.map +1 -1
  229. package/dist/components/Toast/Toast.types.cjs.map +1 -1
  230. package/dist/components/Toast/Toast.types.d.cts +1 -2
  231. package/dist/components/Toast/Toast.types.d.cts.map +1 -1
  232. package/dist/components/Toast/Toast.types.d.mts +1 -2
  233. package/dist/components/Toast/Toast.types.d.mts.map +1 -1
  234. package/dist/components/Toast/Toast.types.mjs.map +1 -1
  235. package/dist/types/index.cjs +3 -71
  236. package/dist/types/index.cjs.map +1 -1
  237. package/dist/types/index.d.cts +0 -66
  238. package/dist/types/index.d.cts.map +1 -1
  239. package/dist/types/index.d.mts +0 -66
  240. package/dist/types/index.d.mts.map +1 -1
  241. package/dist/types/index.mjs +0 -72
  242. package/dist/types/index.mjs.map +1 -1
  243. package/package.json +2 -2
@@ -1,11 +1,163 @@
1
1
  /// <reference types="react" />
2
- import { TextInput } from "react-native/index.js";
3
- export declare const TextField: import("react").ForwardRefExoticComponent<Omit<import("../Input/index.mjs").InputProps, "style" | "textVariant" | "isStateStylesDisabled"> & {
4
- startAccessory?: import("react").ReactNode;
5
- endAccessory?: import("react").ReactNode;
6
- isError?: boolean | undefined;
7
- inputElement?: import("react").ReactNode;
2
+ import { View } from "react-native/index.js";
3
+ export declare const TextField: import("react").ForwardRefExoticComponent<import("@metamask/design-system-shared").TextFieldPropsShared & {
4
+ onFocus?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
5
+ onBlur?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
6
+ inputProps?: {
7
+ children?: import("react").ReactNode;
8
+ hitSlop?: number | import("react-native").Insets | null | undefined;
9
+ id?: string | undefined;
10
+ needsOffscreenAlphaCompositing?: boolean | undefined;
11
+ onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
12
+ pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
13
+ removeClippedSubviews?: boolean | undefined;
14
+ testID?: string | undefined;
15
+ nativeID?: string | undefined;
16
+ collapsable?: boolean | undefined;
17
+ collapsableChildren?: boolean | undefined;
18
+ renderToHardwareTextureAndroid?: boolean | undefined;
19
+ focusable?: boolean | undefined;
20
+ tabIndex?: 0 | -1 | undefined;
21
+ shouldRasterizeIOS?: boolean | undefined;
22
+ isTVSelectable?: boolean | undefined;
23
+ hasTVPreferredFocus?: boolean | undefined;
24
+ tvParallaxShiftDistanceX?: number | undefined;
25
+ tvParallaxShiftDistanceY?: number | undefined;
26
+ tvParallaxTiltAngle?: number | undefined;
27
+ tvParallaxMagnification?: number | undefined;
28
+ onStartShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
29
+ onMoveShouldSetResponder?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
30
+ onResponderEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
31
+ onResponderGrant?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
32
+ onResponderReject?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
33
+ onResponderMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
34
+ onResponderRelease?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
35
+ onResponderStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
36
+ onResponderTerminationRequest?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
37
+ onResponderTerminate?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
38
+ onStartShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
39
+ onMoveShouldSetResponderCapture?: ((event: import("react-native").GestureResponderEvent) => boolean) | undefined;
40
+ onTouchStart?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
41
+ onTouchMove?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
42
+ onTouchEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
43
+ onTouchCancel?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
44
+ onTouchEndCapture?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
45
+ onPointerEnter?: ((event: import("react-native").PointerEvent) => void) | undefined;
46
+ onPointerEnterCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
47
+ onPointerLeave?: ((event: import("react-native").PointerEvent) => void) | undefined;
48
+ onPointerLeaveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
49
+ onPointerMove?: ((event: import("react-native").PointerEvent) => void) | undefined;
50
+ onPointerMoveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
51
+ onPointerCancel?: ((event: import("react-native").PointerEvent) => void) | undefined;
52
+ onPointerCancelCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
53
+ onPointerDown?: ((event: import("react-native").PointerEvent) => void) | undefined;
54
+ onPointerDownCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
55
+ onPointerUp?: ((event: import("react-native").PointerEvent) => void) | undefined;
56
+ onPointerUpCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
57
+ accessible?: boolean | undefined;
58
+ accessibilityActions?: readonly Readonly<{
59
+ name: string;
60
+ label?: string | undefined;
61
+ }>[] | undefined;
62
+ accessibilityLabel?: string | undefined;
63
+ 'aria-label'?: string | undefined;
64
+ accessibilityRole?: import("react-native").AccessibilityRole | undefined;
65
+ accessibilityState?: import("react-native").AccessibilityState | undefined;
66
+ 'aria-busy'?: boolean | undefined;
67
+ 'aria-checked'?: boolean | "mixed" | undefined;
68
+ 'aria-disabled'?: boolean | undefined;
69
+ 'aria-expanded'?: boolean | undefined;
70
+ 'aria-selected'?: boolean | undefined;
71
+ accessibilityHint?: string | undefined;
72
+ accessibilityValue?: import("react-native").AccessibilityValue | undefined;
73
+ 'aria-valuemax'?: number | undefined;
74
+ 'aria-valuemin'?: number | undefined;
75
+ 'aria-valuenow'?: number | undefined;
76
+ 'aria-valuetext'?: string | undefined;
77
+ onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
78
+ importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
79
+ 'aria-hidden'?: boolean | undefined;
80
+ 'aria-modal'?: boolean | undefined;
81
+ role?: import("react-native").Role | undefined;
82
+ accessibilityLabelledBy?: string | string[] | undefined;
83
+ 'aria-labelledby'?: string | undefined;
84
+ accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
85
+ 'aria-live'?: "polite" | "assertive" | "off" | undefined;
86
+ accessibilityElementsHidden?: boolean | undefined;
87
+ accessibilityViewIsModal?: boolean | undefined;
88
+ onAccessibilityEscape?: (() => void) | undefined;
89
+ onAccessibilityTap?: (() => void) | undefined;
90
+ onMagicTap?: (() => void) | undefined;
91
+ accessibilityIgnoresInvertColors?: boolean | undefined;
92
+ accessibilityLanguage?: string | undefined;
93
+ accessibilityShowsLargeContentViewer?: boolean | undefined;
94
+ accessibilityLargeContentTitle?: string | undefined;
95
+ twClassName?: string | undefined;
96
+ onPress?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
97
+ onPressIn?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
98
+ onPressOut?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
99
+ allowFontScaling?: boolean | undefined;
100
+ numberOfLines?: number | undefined;
101
+ maxFontSizeMultiplier?: number | null | undefined;
102
+ lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
103
+ selectionColor?: import("react-native").ColorValue | undefined;
104
+ textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
105
+ rejectResponderTermination?: boolean | null | undefined;
106
+ onChange?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputChangeEventData>) => void) | undefined;
107
+ autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
108
+ autoComplete?: "off" | "name" | "email" | "additional-name" | "address-line1" | "address-line2" | "birthdate-day" | "birthdate-full" | "birthdate-month" | "birthdate-year" | "cc-csc" | "cc-exp" | "cc-exp-day" | "cc-exp-month" | "cc-exp-year" | "cc-number" | "cc-name" | "cc-given-name" | "cc-middle-name" | "cc-family-name" | "cc-type" | "country" | "current-password" | "family-name" | "gender" | "given-name" | "honorific-prefix" | "honorific-suffix" | "name-family" | "name-given" | "name-middle" | "name-middle-initial" | "name-prefix" | "name-suffix" | "new-password" | "nickname" | "one-time-code" | "organization" | "organization-title" | "password" | "password-new" | "postal-address" | "postal-address-country" | "postal-address-extended" | "postal-address-extended-postal-code" | "postal-address-locality" | "postal-address-region" | "postal-code" | "street-address" | "sms-otp" | "tel" | "tel-country-code" | "tel-national" | "tel-device" | "url" | "username" | "username-new" | undefined;
109
+ autoCorrect?: boolean | undefined;
110
+ blurOnSubmit?: boolean | undefined;
111
+ submitBehavior?: import("react-native").SubmitBehavior | undefined;
112
+ caretHidden?: boolean | undefined;
113
+ contextMenuHidden?: boolean | undefined;
114
+ keyboardType?: import("react-native").KeyboardTypeOptions | undefined;
115
+ inputMode?: import("react-native").InputModeOptions | undefined;
116
+ maxLength?: number | undefined;
117
+ multiline?: boolean | undefined;
118
+ onContentSizeChange?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputContentSizeChangeEventData>) => void) | undefined;
119
+ onEndEditing?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputEndEditingEventData>) => void) | undefined;
120
+ onSelectionChange?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputSelectionChangeEventData>) => void) | undefined;
121
+ onSubmitEditing?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputSubmitEditingEventData>) => void) | undefined;
122
+ onScroll?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputScrollEventData>) => void) | undefined;
123
+ onKeyPress?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputKeyPressEventData>) => void) | undefined;
124
+ readOnly?: boolean | undefined;
125
+ returnKeyType?: import("react-native").ReturnKeyTypeOptions | undefined;
126
+ enterKeyHint?: import("react-native").EnterKeyHintTypeOptions | undefined;
127
+ secureTextEntry?: boolean | undefined;
128
+ selectTextOnFocus?: boolean | undefined;
129
+ selection?: {
130
+ start: number;
131
+ end?: number | undefined;
132
+ } | undefined;
133
+ textAlign?: "center" | "left" | "right" | undefined;
134
+ inputAccessoryViewID?: string | undefined;
135
+ clearButtonMode?: "never" | "while-editing" | "unless-editing" | "always" | undefined;
136
+ clearTextOnFocus?: boolean | undefined;
137
+ dataDetectorTypes?: import("react-native").DataDetectorTypes | import("react-native").DataDetectorTypes[] | undefined;
138
+ enablesReturnKeyAutomatically?: boolean | undefined;
139
+ keyboardAppearance?: "default" | "light" | "dark" | undefined;
140
+ passwordRules?: string | null | undefined;
141
+ selectionState?: import("react-native").DocumentSelectionState | undefined;
142
+ spellCheck?: boolean | undefined;
143
+ textContentType?: "none" | "name" | "nickname" | "password" | "username" | "URL" | "addressCity" | "addressCityAndState" | "addressState" | "countryName" | "creditCardNumber" | "creditCardExpiration" | "creditCardExpirationMonth" | "creditCardExpirationYear" | "creditCardSecurityCode" | "creditCardType" | "creditCardName" | "creditCardGivenName" | "creditCardMiddleName" | "creditCardFamilyName" | "emailAddress" | "familyName" | "fullStreetAddress" | "givenName" | "jobTitle" | "location" | "middleName" | "namePrefix" | "nameSuffix" | "organizationName" | "postalCode" | "streetAddressLine1" | "streetAddressLine2" | "sublocality" | "telephoneNumber" | "newPassword" | "oneTimeCode" | "birthdate" | "birthdateDay" | "birthdateMonth" | "birthdateYear" | undefined;
144
+ scrollEnabled?: boolean | undefined;
145
+ smartInsertDelete?: boolean | undefined;
146
+ cursorColor?: import("react-native").ColorValue | null | undefined;
147
+ selectionHandleColor?: import("react-native").ColorValue | null | undefined;
148
+ importantForAutofill?: "auto" | "yes" | "no" | "noExcludeDescendants" | "yesExcludeDescendants" | undefined;
149
+ disableFullscreenUI?: boolean | undefined;
150
+ inlineImageLeft?: string | undefined;
151
+ inlineImagePadding?: number | undefined;
152
+ returnKeyLabel?: string | undefined;
153
+ underlineColorAndroid?: import("react-native").ColorValue | undefined;
154
+ textAlignVertical?: "auto" | "center" | "top" | "bottom" | undefined;
155
+ showSoftInputOnFocus?: boolean | undefined;
156
+ verticalAlign?: "auto" | "middle" | "top" | "bottom" | undefined;
157
+ } | undefined;
158
+ inputRef?: import("react").Ref<import("react-native").TextInput> | undefined;
8
159
  twClassName?: string | undefined;
9
160
  style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
10
- } & import("react").RefAttributes<TextInput>>;
161
+ testID?: string | undefined;
162
+ } & Omit<import("../Box/index.mjs").BoxProps, "children" | "style" | "testID" | "accessible" | "twClassName" | "onBlur" | "onFocus" | keyof import("@metamask/design-system-shared").TextFieldPropsShared | "inputProps" | "inputRef"> & import("react").RefAttributes<View>>;
11
163
  //# sourceMappingURL=TextField.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.d.mts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAa,SAAS,EAAQ,8BAAqB;AAuB1D,eAAO,MAAM,SAAS;;;;;;;6CA6GrB,CAAC"}
1
+ {"version":3,"file":"TextField.d.mts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,IAAI,EAAE,8BAAqB;AAQpC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAwGrB,CAAC"}
@@ -1,27 +1,13 @@
1
1
  import { TextVariant } from "@metamask/design-system-shared";
2
2
  import { useTailwind } from "@metamask/design-system-twrnc-preset";
3
- import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
4
- import { Pressable, TextInput, View } from "react-native/index.js";
3
+ import { forwardRef, useCallback, useState } from "react";
4
+ import { View } from "react-native/index.js";
5
+ import { Box } from "../Box/index.mjs";
5
6
  import { Input } from "../Input/index.mjs";
6
- function getContainerBorderColorClass(isDisabled, isFocused, isError) {
7
- if (isDisabled) {
8
- return 'border-muted';
9
- }
10
- if (isError) {
11
- return 'border-error-default';
12
- }
13
- if (isFocused) {
14
- return 'border-default';
15
- }
16
- return 'border-muted';
17
- }
18
- export const TextField = forwardRef(({ style, startAccessory, endAccessory, isError = false, inputElement, isDisabled = false, autoFocus = false, twClassName, onBlur, onFocus, testID, ...props }, ref) => {
7
+ export const TextField = forwardRef(({ value, onChangeText, placeholder, isReadOnly, onBlur, onFocus, autoFocus = false, inputProps, inputRef, isDisabled = false, isError = false, inputElement, startAccessory, endAccessory, style, twClassName, testID, ...props }, ref) => {
19
8
  const [isFocused, setIsFocused] = useState(autoFocus);
20
- const inputRef = useRef(null);
21
9
  const tw = useTailwind();
22
- useImperativeHandle(ref, () => inputRef.current, []);
23
- const borderColorClass = getContainerBorderColorClass(isDisabled, isFocused, isError);
24
- const containerStyle = useMemo(() => tw.style('flex-row', 'items-center', 'gap-3', 'rounded-lg', 'h-12', 'border', borderColorClass, 'px-4', 'bg-muted', isDisabled && 'opacity-50', twClassName), [borderColorClass, isDisabled, twClassName, tw]);
10
+ const { twClassName: inputTwClassNameFromProps, ...inputRestWithoutTwClassName } = inputProps ?? {};
25
11
  const onBlurHandler = useCallback((e) => {
26
12
  if (!isDisabled) {
27
13
  setIsFocused(false);
@@ -34,20 +20,14 @@ export const TextField = forwardRef(({ style, startAccessory, endAccessory, isEr
34
20
  onFocus?.(e);
35
21
  }
36
22
  }, [isDisabled, onFocus]);
37
- const onPressHandler = useCallback(() => {
38
- if (!isDisabled && inputRef.current) {
39
- inputRef.current.focus();
40
- }
41
- }, [isDisabled]);
42
- return (<Pressable testID={testID} style={[containerStyle, style]} onPress={onPressHandler} accessible={false}>
23
+ return (<Box ref={ref} {...props} testID={testID} accessible={false} style={[
24
+ tw.style('flex-row', 'items-center', 'gap-3', 'rounded-lg', 'h-12', 'border', 'px-4', 'bg-muted', isDisabled && 'border-muted', !isDisabled && isError && 'border-error-default', !isDisabled && !isError && isFocused && 'border-default', !isDisabled && !isError && !isFocused && 'border-muted', isDisabled && 'opacity-50', twClassName),
25
+ style,
26
+ ]}>
43
27
  {startAccessory}
44
- <View style={tw.style('min-h-0 flex-1 justify-center')}>
45
- {inputElement ?? (<Input {...props} ref={inputRef} textVariant={TextVariant.BodyMd} isDisabled={isDisabled} autoFocus={autoFocus} onBlur={onBlurHandler} onFocus={onFocusHandler} isStateStylesDisabled
46
- // Row is `h-12` (48px) with `border` on the Pressable (1px top + bottom). Inner TextInput
47
- // uses 46px height so the field matches a 48px-tall control without vertical overflow.
48
- twClassName="h-[46px] bg-transparent border-0" numberOfLines={1} multiline={false}/>)}
49
- </View>
28
+ {inputElement || (<Input {...inputRestWithoutTwClassName} ref={inputRef} value={value} onChangeText={onChangeText} placeholder={placeholder} isReadOnly={isReadOnly} textVariant={TextVariant.BodyMd} isDisabled={isDisabled} autoFocus={autoFocus} onBlur={onBlurHandler} onFocus={onFocusHandler} isStateStylesDisabled twClassName={`min-h-0 flex-1 justify-center h-[46px] bg-transparent border-0${inputTwClassNameFromProps ? ` ${inputTwClassNameFromProps}` : ''}`} numberOfLines={1} multiline={false}/>)}
50
29
  {endAccessory}
51
- </Pressable>);
30
+ </Box>);
52
31
  });
32
+ TextField.displayName = 'TextField';
53
33
  //# sourceMappingURL=TextField.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.mjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uCAAuC;AAC7D,OAAO,EAAE,WAAW,EAAE,6CAA6C;AACnE,OAAO,EACL,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,EACT,cAAc;AACf,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,8BAAqB;AAE1D,OAAO,EAAE,KAAK,EAAE,2BAAiB;AAIjC,SAAS,4BAA4B,CACnC,UAAmB,EACnB,SAAkB,EAClB,OAAgB;IAEhB,IAAI,UAAU,EAAE;QACd,OAAO,cAAc,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C,KAAK,CAAC,EACjB,CACH,CACH;QAAA,EAAE,IAAI,CACN;QAAA,CAAC,YAAY,CACf;MAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { TextVariant } from '@metamask/design-system-shared';\nimport { useTailwind } from '@metamask/design-system-twrnc-preset';\nimport {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Pressable, TextInput, View } from 'react-native';\n\nimport { Input } from '../Input';\n\nimport type { TextFieldProps } from './TextField.types';\n\nfunction getContainerBorderColorClass(\n isDisabled: boolean,\n isFocused: boolean,\n isError: boolean,\n): string {\n if (isDisabled) {\n return 'border-muted';\n }\n if (isError) {\n return 'border-error-default';\n }\n if (isFocused) {\n return 'border-default';\n }\n return 'border-muted';\n}\n\nexport const TextField = forwardRef<TextInput, TextFieldProps>(\n (\n {\n style,\n startAccessory,\n endAccessory,\n isError = false,\n inputElement,\n isDisabled = false,\n autoFocus = false,\n twClassName,\n onBlur,\n onFocus,\n testID,\n ...props\n },\n ref,\n ) => {\n const [isFocused, setIsFocused] = useState(autoFocus);\n const inputRef = useRef<TextInput>(null);\n const tw = useTailwind();\n\n useImperativeHandle<TextInput | null, TextInput | null>(\n ref,\n () => inputRef.current,\n [],\n );\n\n const borderColorClass = getContainerBorderColorClass(\n isDisabled,\n isFocused,\n isError,\n );\n\n const containerStyle = useMemo(\n () =>\n tw.style(\n 'flex-row',\n 'items-center',\n 'gap-3',\n 'rounded-lg',\n 'h-12',\n 'border',\n borderColorClass,\n 'px-4',\n 'bg-muted',\n isDisabled && 'opacity-50',\n twClassName,\n ),\n [borderColorClass, isDisabled, twClassName, tw],\n );\n\n const onBlurHandler = useCallback(\n (e: Parameters<NonNullable<TextFieldProps['onBlur']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(false);\n onBlur?.(e);\n }\n },\n [isDisabled, onBlur],\n );\n\n const onFocusHandler = useCallback(\n (e: Parameters<NonNullable<TextFieldProps['onFocus']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(true);\n onFocus?.(e);\n }\n },\n [isDisabled, onFocus],\n );\n\n const onPressHandler = useCallback(() => {\n if (!isDisabled && inputRef.current) {\n inputRef.current.focus();\n }\n }, [isDisabled]);\n\n return (\n <Pressable\n testID={testID}\n style={[containerStyle, style]}\n onPress={onPressHandler}\n accessible={false}\n >\n {startAccessory}\n <View style={tw.style('min-h-0 flex-1 justify-center')}>\n {inputElement ?? (\n <Input\n {...props}\n ref={inputRef}\n textVariant={TextVariant.BodyMd}\n isDisabled={isDisabled}\n autoFocus={autoFocus}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n isStateStylesDisabled\n // Row is `h-12` (48px) with `border` on the Pressable (1px top + bottom). Inner TextInput\n // uses 46px height so the field matches a 48px-tall control without vertical overflow.\n twClassName=\"h-[46px] bg-transparent border-0\"\n numberOfLines={1}\n multiline={false}\n />\n )}\n </View>\n {endAccessory}\n </Pressable>\n );\n },\n);\n"]}
1
+ {"version":3,"file":"TextField.mjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uCAAuC;AAC7D,OAAO,EAAE,WAAW,EAAE,6CAA6C;AACnE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc;AAC1D,OAAO,EAAE,IAAI,EAAE,8BAAqB;AAEpC,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,KAAK,EAAE,2BAAiB;AAKjC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CACjC,CACE,EACE,KAAK,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,MAAM,EACN,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,UAAU,EACV,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,KAAK,EACf,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,KAAK,EACL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EACvD,UAAU,IAAI,YAAY,EAC1B,WAAW,CACZ;YACD,KAAK;SACN,CAAC,CAEF;QAAA,CAAC,cAAc,CACf;QAAA,CAAC,YAAY,IAAI,CACf,CAAC,KAAK,CACJ,IAAI,2BAA2B,CAAC,CAChC,GAAG,CAAC,CAAC,QAAQ,CAAC,CACd,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,WAAW,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAChC,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,MAAM,CAAC,CAAC,aAAa,CAAC,CACtB,OAAO,CAAC,CAAC,cAAc,CAAC,CACxB,qBAAqB,CACrB,WAAW,CAAC,CAAC,iEACX,yBAAyB,CAAC,CAAC,CAAC,IAAI,yBAAyB,EAAE,CAAC,CAAC,CAAC,EAChE,EAAE,CAAC,CACH,aAAa,CAAC,CAAC,CAAC,CAAC,CACjB,SAAS,CAAC,CAAC,KAAK,CAAC,EACjB,CACH,CACD;QAAA,CAAC,YAAY,CACf;MAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC","sourcesContent":["import { TextVariant } from '@metamask/design-system-shared';\nimport { useTailwind } from '@metamask/design-system-twrnc-preset';\nimport { forwardRef, useCallback, useState } from 'react';\nimport { View } from 'react-native';\n\nimport { Box } from '../Box';\nimport { Input } from '../Input';\nimport type { InputProps } from '../Input/Input.types';\n\nimport type { TextFieldProps } from './TextField.types';\n\nexport const TextField = forwardRef<View, TextFieldProps>(\n (\n {\n value,\n onChangeText,\n placeholder,\n isReadOnly,\n onBlur,\n onFocus,\n autoFocus = false,\n inputProps,\n inputRef,\n isDisabled = false,\n isError = false,\n inputElement,\n startAccessory,\n endAccessory,\n style,\n twClassName,\n testID,\n ...props\n },\n ref,\n ) => {\n const [isFocused, setIsFocused] = useState(autoFocus);\n const tw = useTailwind();\n\n const {\n twClassName: inputTwClassNameFromProps,\n ...inputRestWithoutTwClassName\n } = inputProps ?? {};\n\n const onBlurHandler = useCallback(\n (e: Parameters<NonNullable<InputProps['onBlur']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(false);\n onBlur?.(e);\n }\n },\n [isDisabled, onBlur],\n );\n\n const onFocusHandler = useCallback(\n (e: Parameters<NonNullable<InputProps['onFocus']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(true);\n onFocus?.(e);\n }\n },\n [isDisabled, onFocus],\n );\n\n return (\n <Box\n ref={ref}\n {...props}\n testID={testID}\n accessible={false}\n style={[\n tw.style(\n 'flex-row',\n 'items-center',\n 'gap-3',\n 'rounded-lg',\n 'h-12',\n 'border',\n 'px-4',\n 'bg-muted',\n isDisabled && 'border-muted',\n !isDisabled && isError && 'border-error-default',\n !isDisabled && !isError && isFocused && 'border-default',\n !isDisabled && !isError && !isFocused && 'border-muted',\n isDisabled && 'opacity-50',\n twClassName,\n ),\n style,\n ]}\n >\n {startAccessory}\n {inputElement || (\n <Input\n {...inputRestWithoutTwClassName}\n ref={inputRef}\n value={value}\n onChangeText={onChangeText}\n placeholder={placeholder}\n isReadOnly={isReadOnly}\n textVariant={TextVariant.BodyMd}\n isDisabled={isDisabled}\n autoFocus={autoFocus}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n isStateStylesDisabled\n twClassName={`min-h-0 flex-1 justify-center h-[46px] bg-transparent border-0${\n inputTwClassNameFromProps ? ` ${inputTwClassNameFromProps}` : ''\n }`}\n numberOfLines={1}\n multiline={false}\n />\n )}\n {endAccessory}\n </Box>\n );\n },\n);\n\nTextField.displayName = 'TextField';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.types.cjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport type { InputProps } from '../Input/Input.types';\n\n/**\n * TextField component props.\n */\nexport type TextFieldProps = Omit<\n InputProps,\n 'textVariant' | 'isStateStylesDisabled' | 'style'\n> & {\n /**\n * Optional content to display before the Input.\n */\n startAccessory?: ReactNode;\n /**\n * Optional content to display after the Input.\n */\n endAccessory?: ReactNode;\n /**\n * Optional boolean to show the error state.\n *\n * @default false\n */\n isError?: boolean;\n /**\n * Optional prop to replace the default Input with a custom element.\n */\n inputElement?: ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n /**\n * Optional prop to customize the container style.\n */\n style?: StyleProp<ViewStyle>;\n};\n"]}
1
+ {"version":3,"file":"TextField.types.cjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TextFieldPropsShared } from '@metamask/design-system-shared';\nimport type { Ref } from 'react';\nimport type { StyleProp, TextInput, ViewStyle } from 'react-native';\n\nimport type { BoxProps } from '../Box/Box.types';\nimport type { InputProps } from '../Input/Input.types';\n\n/**\n * Additional props merged onto the inner `Input` (`../Input/Input.tsx`).\n *\n * TextField owns `value`, `onChangeText`, `placeholder`, `isReadOnly`, `onFocus`,\n * `onBlur`, `isDisabled`, `autoFocus`, typography, and inner layout (merged with\n * any `twClassName` you pass here). `placeholderTextColor` is omitted (Input sets\n * it from theme).\n */\ntype TextFieldInputProps = Omit<\n InputProps,\n | 'autoFocus'\n | 'isDisabled'\n | 'isReadOnly'\n | 'isStateStylesDisabled'\n | 'onBlur'\n | 'onChangeText'\n | 'onFocus'\n | 'placeholder'\n | 'placeholderTextColor'\n | 'style'\n | 'textVariant'\n | 'value'\n>;\n\n/**\n * React Native `TextField` props between `TextFieldPropsShared` and the root\n * `Box`: typed focus/blur handlers, `inputProps`, container styling, and\n * `testID`.\n */\nexport type TextFieldBaseProps = TextFieldPropsShared & {\n /**\n * Called when the inner input receives focus (composed with TextField border state).\n */\n onFocus?: InputProps['onFocus'];\n /**\n * Called when the inner input loses focus (composed with TextField border state).\n */\n onBlur?: InputProps['onBlur'];\n /**\n * Additional props for the inner `Input`. Do not pass `placeholder`, `isReadOnly`, `onFocus`, or `onBlur` here;\n * use the TextField-level props above. For accessibility, prefer `accessibilityLabel` and `accessibilityHint` on\n * `inputProps` (for example hint text can note that a field is required). `placeholderTextColor` is omitted from the\n * type; the inner `Input` sets it from the theme.\n */\n inputProps?: TextFieldInputProps;\n /**\n * Ref to the inner `TextInput`. The component `ref` targets the root `Box` (`View`).\n */\n inputRef?: Ref<TextInput>;\n /**\n * Optional twrnc classes for the root `Box`.\n */\n twClassName?: string;\n /**\n * Optional style for the root `Box`.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional test id for the root `Box`.\n */\n testID?: string;\n};\n\ntype TextFieldReservedBoxKeys =\n | keyof TextFieldBaseProps\n | 'accessible'\n | 'children'\n | 'style';\n\n/**\n * TextField props: `TextFieldBaseProps` plus remaining `BoxProps` at the top\n * level, excluding keys reserved by TextField.\n */\nexport type TextFieldProps = TextFieldBaseProps &\n Omit<BoxProps, TextFieldReservedBoxKeys>;\n"]}
@@ -1,35 +1,60 @@
1
- import type { ReactNode } from "react";
2
- import type { StyleProp, ViewStyle } from "react-native/index.js";
1
+ import type { TextFieldPropsShared } from "@metamask/design-system-shared";
2
+ import type { Ref } from "react";
3
+ import type { StyleProp, TextInput, ViewStyle } from "react-native/index.js";
4
+ import type { BoxProps } from "../Box/Box.types.cjs";
3
5
  import type { InputProps } from "../Input/Input.types.cjs";
4
6
  /**
5
- * TextField component props.
7
+ * Additional props merged onto the inner `Input` (`../Input/Input.tsx`).
8
+ *
9
+ * TextField owns `value`, `onChangeText`, `placeholder`, `isReadOnly`, `onFocus`,
10
+ * `onBlur`, `isDisabled`, `autoFocus`, typography, and inner layout (merged with
11
+ * any `twClassName` you pass here). `placeholderTextColor` is omitted (Input sets
12
+ * it from theme).
6
13
  */
7
- export type TextFieldProps = Omit<InputProps, 'textVariant' | 'isStateStylesDisabled' | 'style'> & {
14
+ type TextFieldInputProps = Omit<InputProps, 'autoFocus' | 'isDisabled' | 'isReadOnly' | 'isStateStylesDisabled' | 'onBlur' | 'onChangeText' | 'onFocus' | 'placeholder' | 'placeholderTextColor' | 'style' | 'textVariant' | 'value'>;
15
+ /**
16
+ * React Native `TextField` props between `TextFieldPropsShared` and the root
17
+ * `Box`: typed focus/blur handlers, `inputProps`, container styling, and
18
+ * `testID`.
19
+ */
20
+ export type TextFieldBaseProps = TextFieldPropsShared & {
8
21
  /**
9
- * Optional content to display before the Input.
22
+ * Called when the inner input receives focus (composed with TextField border state).
10
23
  */
11
- startAccessory?: ReactNode;
24
+ onFocus?: InputProps['onFocus'];
12
25
  /**
13
- * Optional content to display after the Input.
26
+ * Called when the inner input loses focus (composed with TextField border state).
14
27
  */
15
- endAccessory?: ReactNode;
28
+ onBlur?: InputProps['onBlur'];
16
29
  /**
17
- * Optional boolean to show the error state.
18
- *
19
- * @default false
30
+ * Additional props for the inner `Input`. Do not pass `placeholder`, `isReadOnly`, `onFocus`, or `onBlur` here;
31
+ * use the TextField-level props above. For accessibility, prefer `accessibilityLabel` and `accessibilityHint` on
32
+ * `inputProps` (for example hint text can note that a field is required). `placeholderTextColor` is omitted from the
33
+ * type; the inner `Input` sets it from the theme.
20
34
  */
21
- isError?: boolean;
35
+ inputProps?: TextFieldInputProps;
22
36
  /**
23
- * Optional prop to replace the default Input with a custom element.
37
+ * Ref to the inner `TextInput`. The component `ref` targets the root `Box` (`View`).
24
38
  */
25
- inputElement?: ReactNode;
39
+ inputRef?: Ref<TextInput>;
26
40
  /**
27
- * Optional prop to add twrnc overriding classNames.
41
+ * Optional twrnc classes for the root `Box`.
28
42
  */
29
43
  twClassName?: string;
30
44
  /**
31
- * Optional prop to customize the container style.
45
+ * Optional style for the root `Box`.
32
46
  */
33
47
  style?: StyleProp<ViewStyle>;
48
+ /**
49
+ * Optional test id for the root `Box`.
50
+ */
51
+ testID?: string;
34
52
  };
53
+ type TextFieldReservedBoxKeys = keyof TextFieldBaseProps | 'accessible' | 'children' | 'style';
54
+ /**
55
+ * TextField props: `TextFieldBaseProps` plus remaining `BoxProps` at the top
56
+ * level, excluding keys reserved by TextField.
57
+ */
58
+ export type TextFieldProps = TextFieldBaseProps & Omit<BoxProps, TextFieldReservedBoxKeys>;
59
+ export {};
35
60
  //# sourceMappingURL=TextField.types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.types.d.cts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,8BAAqB;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,iCAA6B;AAEvD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,UAAU,EACV,aAAa,GAAG,uBAAuB,GAAG,OAAO,CAClD,GAAG;IACF;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC"}
1
+ {"version":3,"file":"TextField.types.d.cts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,uCAAuC;AAC3E,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,8BAAqB;AAEpE,OAAO,KAAK,EAAE,QAAQ,EAAE,6BAAyB;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,iCAA6B;AAEvD;;;;;;;GAOG;AACH,KAAK,mBAAmB,GAAG,IAAI,CAC7B,UAAU,EACR,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,uBAAuB,GACvB,QAAQ,GACR,cAAc,GACd,SAAS,GACT,aAAa,GACb,sBAAsB,GACtB,OAAO,GACP,aAAa,GACb,OAAO,CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,GAAG;IACtD;;OAEG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,wBAAwB,GACzB,MAAM,kBAAkB,GACxB,YAAY,GACZ,UAAU,GACV,OAAO,CAAC;AAEZ;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAC7C,IAAI,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC"}
@@ -1,35 +1,60 @@
1
- import type { ReactNode } from "react";
2
- import type { StyleProp, ViewStyle } from "react-native/index.js";
1
+ import type { TextFieldPropsShared } from "@metamask/design-system-shared";
2
+ import type { Ref } from "react";
3
+ import type { StyleProp, TextInput, ViewStyle } from "react-native/index.js";
4
+ import type { BoxProps } from "../Box/Box.types.mjs";
3
5
  import type { InputProps } from "../Input/Input.types.mjs";
4
6
  /**
5
- * TextField component props.
7
+ * Additional props merged onto the inner `Input` (`../Input/Input.tsx`).
8
+ *
9
+ * TextField owns `value`, `onChangeText`, `placeholder`, `isReadOnly`, `onFocus`,
10
+ * `onBlur`, `isDisabled`, `autoFocus`, typography, and inner layout (merged with
11
+ * any `twClassName` you pass here). `placeholderTextColor` is omitted (Input sets
12
+ * it from theme).
6
13
  */
7
- export type TextFieldProps = Omit<InputProps, 'textVariant' | 'isStateStylesDisabled' | 'style'> & {
14
+ type TextFieldInputProps = Omit<InputProps, 'autoFocus' | 'isDisabled' | 'isReadOnly' | 'isStateStylesDisabled' | 'onBlur' | 'onChangeText' | 'onFocus' | 'placeholder' | 'placeholderTextColor' | 'style' | 'textVariant' | 'value'>;
15
+ /**
16
+ * React Native `TextField` props between `TextFieldPropsShared` and the root
17
+ * `Box`: typed focus/blur handlers, `inputProps`, container styling, and
18
+ * `testID`.
19
+ */
20
+ export type TextFieldBaseProps = TextFieldPropsShared & {
8
21
  /**
9
- * Optional content to display before the Input.
22
+ * Called when the inner input receives focus (composed with TextField border state).
10
23
  */
11
- startAccessory?: ReactNode;
24
+ onFocus?: InputProps['onFocus'];
12
25
  /**
13
- * Optional content to display after the Input.
26
+ * Called when the inner input loses focus (composed with TextField border state).
14
27
  */
15
- endAccessory?: ReactNode;
28
+ onBlur?: InputProps['onBlur'];
16
29
  /**
17
- * Optional boolean to show the error state.
18
- *
19
- * @default false
30
+ * Additional props for the inner `Input`. Do not pass `placeholder`, `isReadOnly`, `onFocus`, or `onBlur` here;
31
+ * use the TextField-level props above. For accessibility, prefer `accessibilityLabel` and `accessibilityHint` on
32
+ * `inputProps` (for example hint text can note that a field is required). `placeholderTextColor` is omitted from the
33
+ * type; the inner `Input` sets it from the theme.
20
34
  */
21
- isError?: boolean;
35
+ inputProps?: TextFieldInputProps;
22
36
  /**
23
- * Optional prop to replace the default Input with a custom element.
37
+ * Ref to the inner `TextInput`. The component `ref` targets the root `Box` (`View`).
24
38
  */
25
- inputElement?: ReactNode;
39
+ inputRef?: Ref<TextInput>;
26
40
  /**
27
- * Optional prop to add twrnc overriding classNames.
41
+ * Optional twrnc classes for the root `Box`.
28
42
  */
29
43
  twClassName?: string;
30
44
  /**
31
- * Optional prop to customize the container style.
45
+ * Optional style for the root `Box`.
32
46
  */
33
47
  style?: StyleProp<ViewStyle>;
48
+ /**
49
+ * Optional test id for the root `Box`.
50
+ */
51
+ testID?: string;
34
52
  };
53
+ type TextFieldReservedBoxKeys = keyof TextFieldBaseProps | 'accessible' | 'children' | 'style';
54
+ /**
55
+ * TextField props: `TextFieldBaseProps` plus remaining `BoxProps` at the top
56
+ * level, excluding keys reserved by TextField.
57
+ */
58
+ export type TextFieldProps = TextFieldBaseProps & Omit<BoxProps, TextFieldReservedBoxKeys>;
59
+ export {};
35
60
  //# sourceMappingURL=TextField.types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.types.d.mts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,8BAAqB;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,iCAA6B;AAEvD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,UAAU,EACV,aAAa,GAAG,uBAAuB,GAAG,OAAO,CAClD,GAAG;IACF;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC"}
1
+ {"version":3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+1 @@
1
- {"version":3,"file":"TextField.types.mjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport type { InputProps } from '../Input/Input.types';\n\n/**\n * TextField component props.\n */\nexport type TextFieldProps = Omit<\n InputProps,\n 'textVariant' | 'isStateStylesDisabled' | 'style'\n> & {\n /**\n * Optional content to display before the Input.\n */\n startAccessory?: ReactNode;\n /**\n * Optional content to display after the Input.\n */\n endAccessory?: ReactNode;\n /**\n * Optional boolean to show the error state.\n *\n * @default false\n */\n isError?: boolean;\n /**\n * Optional prop to replace the default Input with a custom element.\n */\n inputElement?: ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n /**\n * Optional prop to customize the container style.\n */\n style?: StyleProp<ViewStyle>;\n};\n"]}
1
+ {"version":3,"file":"TextField.types.mjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TextFieldPropsShared } from '@metamask/design-system-shared';\nimport type { Ref } from 'react';\nimport type { StyleProp, TextInput, ViewStyle } from 'react-native';\n\nimport type { BoxProps } from '../Box/Box.types';\nimport type { InputProps } from '../Input/Input.types';\n\n/**\n * Additional props merged onto the inner `Input` (`../Input/Input.tsx`).\n *\n * TextField owns `value`, `onChangeText`, `placeholder`, `isReadOnly`, `onFocus`,\n * `onBlur`, `isDisabled`, `autoFocus`, typography, and inner layout (merged with\n * any `twClassName` you pass here). `placeholderTextColor` is omitted (Input sets\n * it from theme).\n */\ntype TextFieldInputProps = Omit<\n InputProps,\n | 'autoFocus'\n | 'isDisabled'\n | 'isReadOnly'\n | 'isStateStylesDisabled'\n | 'onBlur'\n | 'onChangeText'\n | 'onFocus'\n | 'placeholder'\n | 'placeholderTextColor'\n | 'style'\n | 'textVariant'\n | 'value'\n>;\n\n/**\n * React Native `TextField` props between `TextFieldPropsShared` and the root\n * `Box`: typed focus/blur handlers, `inputProps`, container styling, and\n * `testID`.\n */\nexport type TextFieldBaseProps = TextFieldPropsShared & {\n /**\n * Called when the inner input receives focus (composed with TextField border state).\n */\n onFocus?: InputProps['onFocus'];\n /**\n * Called when the inner input loses focus (composed with TextField border state).\n */\n onBlur?: InputProps['onBlur'];\n /**\n * Additional props for the inner `Input`. Do not pass `placeholder`, `isReadOnly`, `onFocus`, or `onBlur` here;\n * use the TextField-level props above. For accessibility, prefer `accessibilityLabel` and `accessibilityHint` on\n * `inputProps` (for example hint text can note that a field is required). `placeholderTextColor` is omitted from the\n * type; the inner `Input` sets it from the theme.\n */\n inputProps?: TextFieldInputProps;\n /**\n * Ref to the inner `TextInput`. The component `ref` targets the root `Box` (`View`).\n */\n inputRef?: Ref<TextInput>;\n /**\n * Optional twrnc classes for the root `Box`.\n */\n twClassName?: string;\n /**\n * Optional style for the root `Box`.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional test id for the root `Box`.\n */\n testID?: string;\n};\n\ntype TextFieldReservedBoxKeys =\n | keyof TextFieldBaseProps\n | 'accessible'\n | 'children'\n | 'style';\n\n/**\n * TextField props: `TextFieldBaseProps` plus remaining `BoxProps` at the top\n * level, excluding keys reserved by TextField.\n */\nexport type TextFieldProps = TextFieldBaseProps &\n Omit<BoxProps, TextFieldReservedBoxKeys>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TextFieldSearch.cjs","sourceRoot":"","sources":["../../../src/components/TextFieldSearch/TextFieldSearch.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qFAAmE;AACnE,+CAAuD;AAGvD,wDAA2D;AAC3D,4CAA8D;AAC9D,sDAAyC;AAI5B,QAAA,eAAe,GAAG,IAAA,kBAAU,EACvC,CACE,EACE,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,cAAc,EACd,YAAY,EACZ,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,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,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["import { useTailwind } from '@metamask/design-system-twrnc-preset';\nimport React, { forwardRef, useCallback } from 'react';\nimport type { TextInput } from 'react-native';\n\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { Icon, IconColor, IconName, IconSize } from '../Icon';\nimport { TextField } from '../TextField';\n\nimport type { TextFieldSearchProps } from './TextFieldSearch.types';\n\nexport const TextFieldSearch = forwardRef<TextInput, TextFieldSearchProps>(\n (\n {\n onPressClearButton,\n clearButtonProps,\n value,\n style,\n startAccessory,\n endAccessory,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const containerStyle = tw.style('rounded-full');\n\n const searchIcon = (\n <Icon\n name={IconName.Search}\n size={IconSize.Md}\n color={IconColor.IconAlternative}\n />\n );\n\n const clearButtonHandler = useCallback(() => {\n onPressClearButton();\n }, [onPressClearButton]);\n\n const clearButton = (\n <ButtonIcon\n size={ButtonIconSize.Md}\n iconName={IconName.CircleX}\n iconProps={{ color: IconColor.IconAlternative }}\n onPress={clearButtonHandler}\n {...clearButtonProps}\n />\n );\n\n return (\n <TextField\n ref={ref}\n {...props}\n value={value}\n startAccessory={\n startAccessory !== undefined ? startAccessory : searchIcon\n }\n endAccessory={\n endAccessory !== undefined\n ? endAccessory\n : Boolean(value) && clearButton\n }\n testID=\"textfieldsearch\"\n style={[containerStyle, style]}\n />\n );\n },\n);\n\nTextFieldSearch.displayName = 'TextFieldSearch';\n"]}
1
+ {"version":3,"file":"TextFieldSearch.cjs","sourceRoot":"","sources":["../../../src/components/TextFieldSearch/TextFieldSearch.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qFAAmE;AACnE,+CAAuD;AAGvD,wDAA2D;AAC3D,4CAA8D;AAC9D,sDAAyC;AAI5B,QAAA,eAAe,GAAG,IAAA,kBAAU,EACvC,CACE,EACE,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,cA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AAC,CAAC,EAC/B,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,uBAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["import { useTailwind } from '@metamask/design-system-twrnc-preset';\nimport React, { forwardRef, useCallback } from 'react';\nimport type { View } from 'react-native';\n\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { Icon, IconColor, IconName, IconSize } from '../Icon';\nimport { TextField } from '../TextField';\n\nimport type { TextFieldSearchProps } from './TextFieldSearch.types';\n\nexport const TextFieldSearch = forwardRef<View, TextFieldSearchProps>(\n (\n {\n onPressClearButton,\n clearButtonProps,\n value,\n style,\n startAccessory,\n endAccessory,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const containerStyle = tw.style('rounded-full');\n\n const searchIcon = (\n <Icon\n name={IconName.Search}\n size={IconSize.Md}\n color={IconColor.IconAlternative}\n />\n );\n\n const clearButtonHandler = useCallback(() => {\n onPressClearButton();\n }, [onPressClearButton]);\n\n const clearButton = (\n <ButtonIcon\n size={ButtonIconSize.Md}\n iconName={IconName.CircleX}\n iconProps={{ color: IconColor.IconAlternative }}\n onPress={clearButtonHandler}\n {...clearButtonProps}\n />\n );\n\n return (\n <TextField\n ref={ref}\n {...props}\n value={value}\n startAccessory={\n startAccessory !== undefined ? startAccessory : searchIcon\n }\n endAccessory={\n endAccessory !== undefined\n ? endAccessory\n : Boolean(value) && clearButton\n }\n testID=\"textfieldsearch\"\n style={[containerStyle, style]}\n />\n );\n },\n);\n\nTextFieldSearch.displayName = 'TextFieldSearch';\n"]}