@jobber/components-native 0.84.4-JOB-134681-8086ad4.25 → 0.84.4-JOB-138679-b1552ab.68

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 (278) hide show
  1. package/dist/package.json +23 -14
  2. package/dist/src/ActionItem/ActionItemGroup.js +1 -1
  3. package/dist/src/AutoLink/components/Link/Link.js +1 -1
  4. package/dist/src/Banner/Banner.js +2 -0
  5. package/dist/src/Banner/components/BannerIcon/BannerIcon.style.js +3 -0
  6. package/dist/src/BottomSheet/BottomSheet.js +2 -2
  7. package/dist/src/Button/components/InternalButtonLoading/InternalButtonLoading.js +0 -1
  8. package/dist/src/ButtonGroup/ButtonGroup.js +1 -1
  9. package/dist/src/ContentOverlay/ContentOverlay.js +5 -7
  10. package/dist/src/ContentOverlay/UNSAFE_WrappedModalize.js +23 -0
  11. package/dist/src/ErrorMessageWrapper/context/ErrorMessageProvider.js +1 -1
  12. package/dist/src/Form/Form.js +5 -2
  13. package/dist/src/Form/components/FormCache/FormCache.js +1 -0
  14. package/dist/src/Form/components/FormMessageBanner/FormMessageBanner.js +1 -1
  15. package/dist/src/Form/context/AtlantisFormContext.js +1 -0
  16. package/dist/src/Form/hooks/useInternalForm.js +6 -3
  17. package/dist/src/FormatFile/components/MediaView/MediaView.js +22 -5
  18. package/dist/src/FormatFile/utils/createUseCreateThumbnail.js +1 -1
  19. package/dist/src/InputCurrency/InputCurrency.js +42 -30
  20. package/dist/src/InputDate/InputDate.js +2 -2
  21. package/dist/src/InputEmail/InputEmail.js +12 -4
  22. package/dist/src/InputFieldWrapper/InputFieldWrapper.js +14 -12
  23. package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +1 -1
  24. package/dist/src/InputFieldWrapper/components/Prefix/Prefix.js +5 -2
  25. package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +5 -2
  26. package/dist/src/InputNumber/InputNumber.js +10 -4
  27. package/dist/src/InputPressable/InputPressable.js +20 -8
  28. package/dist/src/InputPressable/InputPressable.style.js +3 -0
  29. package/dist/src/InputSearch/InputSearch.js +1 -1
  30. package/dist/src/InputText/InputText.js +22 -11
  31. package/dist/src/InputText/InputText.style.js +4 -0
  32. package/dist/src/InputTime/InputTime.js +2 -2
  33. package/dist/src/Menu/Menu.js +2 -2
  34. package/dist/src/Select/Select.style.js +1 -0
  35. package/dist/src/Select/components/SelectPressable/SelectPressable.js +1 -1
  36. package/dist/src/Switch/components/BaseSwitch/BaseSwitch.js +7 -1
  37. package/dist/src/Typography/Typography.js +16 -5
  38. package/dist/src/hooks/useAtlantisI18n/locales/en.json +1 -0
  39. package/dist/src/hooks/useAtlantisI18n/locales/es.json +1 -0
  40. package/dist/src/hooks/useFormController.js +5 -14
  41. package/dist/tsconfig.build.json +7 -0
  42. package/dist/tsconfig.build.tsbuildinfo +1 -0
  43. package/dist/tsconfig.json +4 -6
  44. package/dist/types/src/ActionItem/ActionItem.d.ts +2 -1
  45. package/dist/types/src/ActionItem/ActionItemGroup.d.ts +2 -1
  46. package/dist/types/src/ActionItem/components/ActionItemContainer.d.ts +2 -1
  47. package/dist/types/src/ActionLabel/ActionLabel.d.ts +4 -3
  48. package/dist/types/src/ActivityIndicator/ActivityIndicator.d.ts +2 -1
  49. package/dist/types/src/AutoLink/AutoLink.d.ts +2 -1
  50. package/dist/types/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.d.ts +2 -1
  51. package/dist/types/src/AutoLink/components/Link/Link.d.ts +2 -1
  52. package/dist/types/src/Banner/Banner.d.ts +2 -1
  53. package/dist/types/src/Banner/components/BannerIcon/BannerIcon.d.ts +2 -1
  54. package/dist/types/src/Banner/components/BannerIcon/BannerIcon.style.d.ts +3 -0
  55. package/dist/types/src/Banner/types.d.ts +1 -1
  56. package/dist/types/src/BottomSheet/BottomSheet.d.ts +1 -1
  57. package/dist/types/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +2 -1
  58. package/dist/types/src/Button/Button.d.ts +2 -1
  59. package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.d.ts +1 -1
  60. package/dist/types/src/ButtonGroup/ButtonGroup.d.ts +2 -1
  61. package/dist/types/src/ButtonGroup/ButtonGroupAction.d.ts +4 -3
  62. package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +3 -2
  63. package/dist/types/src/Card/Card.d.ts +2 -1
  64. package/dist/types/src/Card/components/InternalCardHeader.d.ts +2 -1
  65. package/dist/types/src/Checkbox/Checkbox.d.ts +2 -1
  66. package/dist/types/src/Checkbox/CheckboxGroup.d.ts +2 -1
  67. package/dist/types/src/Chip/Chip.d.ts +2 -1
  68. package/dist/types/src/Content/Content.d.ts +2 -1
  69. package/dist/types/src/ContentOverlay/ContentOverlay.d.ts +1 -1
  70. package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +3 -0
  71. package/dist/types/src/Disclosure/Disclosure.d.ts +1 -1
  72. package/dist/types/src/Divider/Divider.d.ts +2 -1
  73. package/dist/types/src/EmptyState/EmptyState.d.ts +2 -1
  74. package/dist/types/src/ErrorMessageWrapper/ErrorMessageWrapper.d.ts +2 -1
  75. package/dist/types/src/ErrorMessageWrapper/context/ErrorMessageProvider.d.ts +2 -1
  76. package/dist/types/src/ErrorMessageWrapper/context/types.d.ts +1 -1
  77. package/dist/types/src/Flex/Flex.d.ts +2 -1
  78. package/dist/types/src/Form/Form.d.ts +2 -1
  79. package/dist/types/src/Form/components/FormActionBar/FormActionBar.d.ts +3 -2
  80. package/dist/types/src/Form/components/FormBody/FormBody.d.ts +3 -2
  81. package/dist/types/src/Form/components/FormCache/FormCache.d.ts +4 -3
  82. package/dist/types/src/Form/components/FormErrorBanner/FormErrorBanner.d.ts +2 -1
  83. package/dist/types/src/Form/components/FormMask/FormMask.d.ts +2 -1
  84. package/dist/types/src/Form/components/FormMessage/FormMessage.d.ts +2 -1
  85. package/dist/types/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.d.ts +2 -1
  86. package/dist/types/src/Form/components/FormMessageBanner/FormMessageBanner.d.ts +2 -1
  87. package/dist/types/src/Form/components/FormSaveButton/FormSaveButton.d.ts +2 -1
  88. package/dist/types/src/Form/context/AtlantisFormContext.d.ts +2 -1
  89. package/dist/types/src/Form/context/types.d.ts +3 -2
  90. package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
  91. package/dist/types/src/Form/hooks/useInternalForm.d.ts +5 -5
  92. package/dist/types/src/Form/types.d.ts +13 -7
  93. package/dist/types/src/FormField/FormField.d.ts +1 -1
  94. package/dist/types/src/FormatFile/FormatFile.d.ts +2 -1
  95. package/dist/types/src/FormatFile/components/ErrorIcon/ErrorIcon.d.ts +2 -1
  96. package/dist/types/src/FormatFile/components/FileView/FileView.d.ts +2 -1
  97. package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +3 -2
  98. package/dist/types/src/FormatFile/components/MediaView/MediaView.d.ts +2 -1
  99. package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.d.ts +2 -1
  100. package/dist/types/src/Heading/Heading.d.ts +4 -3
  101. package/dist/types/src/Icon/Icon.d.ts +2 -1
  102. package/dist/types/src/IconButton/IconButton.d.ts +1 -1
  103. package/dist/types/src/InputCurrency/InputCurrency.d.ts +2 -1
  104. package/dist/types/src/InputDate/InputDate.d.ts +4 -2
  105. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.d.ts +9 -2
  106. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +1 -1
  107. package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.d.ts +2 -1
  108. package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +4 -4
  109. package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +4 -4
  110. package/dist/types/src/InputPressable/InputPressable.d.ts +9 -1
  111. package/dist/types/src/InputPressable/InputPressable.style.d.ts +3 -0
  112. package/dist/types/src/InputSearch/InputSearch.d.ts +1 -1
  113. package/dist/types/src/InputSearch/components/FilterButton.d.ts +2 -1
  114. package/dist/types/src/InputText/InputText.d.ts +10 -2
  115. package/dist/types/src/InputText/InputText.style.d.ts +4 -0
  116. package/dist/types/src/InputText/context/InputAccessoriesProvider.d.ts +2 -1
  117. package/dist/types/src/InputTime/InputTime.d.ts +4 -2
  118. package/dist/types/src/Menu/Menu.d.ts +2 -1
  119. package/dist/types/src/Menu/components/MenuOption/MenuOption.d.ts +2 -1
  120. package/dist/types/src/Menu/components/Overlay/Overlay.d.ts +2 -1
  121. package/dist/types/src/Menu/types.d.ts +6 -1
  122. package/dist/types/src/ProgressBar/ProgressBar.d.ts +2 -1
  123. package/dist/types/src/ProgressBar/ProgressBarInner.d.ts +2 -1
  124. package/dist/types/src/Select/Select.d.ts +3 -2
  125. package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.d.ts +2 -1
  126. package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.d.ts +2 -1
  127. package/dist/types/src/Select/components/SelectInternalPicker/SelectInternalPicker.d.ts +2 -1
  128. package/dist/types/src/Select/components/SelectPressable/SelectPressable.d.ts +2 -1
  129. package/dist/types/src/StatusLabel/StatusLabel.d.ts +2 -1
  130. package/dist/types/src/Switch/Switch.d.ts +2 -1
  131. package/dist/types/src/Switch/components/BaseSwitch/BaseSwitch.d.ts +2 -1
  132. package/dist/types/src/Text/Text.d.ts +4 -3
  133. package/dist/types/src/TextList/TextList.d.ts +2 -1
  134. package/dist/types/src/ThumbnailList/ThumbnailList.d.ts +2 -1
  135. package/dist/types/src/Toast/Toast.d.ts +2 -1
  136. package/dist/types/src/Typography/Typography.d.ts +3 -3
  137. package/dist/types/src/Typography/TypographyGestureDetector.d.ts +2 -1
  138. package/dist/types/src/utils/test/MockSafeAreaProvider.d.ts +1 -1
  139. package/package.json +23 -14
  140. package/src/ActionItem/ActionItem.tsx +1 -1
  141. package/src/ActionItem/ActionItemGroup.tsx +1 -3
  142. package/src/ActionItem/components/ActionItemContainer.tsx +1 -1
  143. package/src/ActionLabel/ActionLabel.test.tsx +12 -0
  144. package/src/ActionLabel/ActionLabel.tsx +3 -3
  145. package/src/ActionLabel/__snapshots__/ActionLabel.test.tsx.snap +66 -0
  146. package/src/ActivityIndicator/ActivityIndicator.tsx +1 -3
  147. package/src/AtlantisContext/AtlantisContext.test.tsx +1 -1
  148. package/src/AtlantisThemeContext/AtlantisThemeContext.test.tsx +5 -5
  149. package/src/AutoLink/AutoLink.test.tsx +2 -4
  150. package/src/AutoLink/AutoLink.tsx +1 -1
  151. package/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.tsx +1 -1
  152. package/src/AutoLink/components/Link/Link.tsx +1 -5
  153. package/src/Banner/Banner.test.tsx +12 -0
  154. package/src/Banner/Banner.tsx +4 -2
  155. package/src/Banner/components/BannerIcon/BannerIcon.style.ts +3 -0
  156. package/src/Banner/components/BannerIcon/BannerIcon.tsx +1 -1
  157. package/src/Banner/types.ts +1 -1
  158. package/src/BottomSheet/BottomSheet.test.tsx +17 -17
  159. package/src/BottomSheet/BottomSheet.tsx +4 -3
  160. package/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.tsx +1 -1
  161. package/src/Button/Button.tsx +1 -1
  162. package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +1 -2
  163. package/src/ButtonGroup/ButtonGroup.test.tsx +13 -11
  164. package/src/ButtonGroup/ButtonGroup.tsx +2 -2
  165. package/src/ButtonGroup/ButtonGroupAction.tsx +4 -4
  166. package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +2 -2
  167. package/src/Card/Card.tsx +1 -1
  168. package/src/Card/components/InternalCardHeader.tsx +1 -1
  169. package/src/Checkbox/Checkbox.tsx +2 -2
  170. package/src/Checkbox/CheckboxGroup.test.tsx +3 -7
  171. package/src/Checkbox/CheckboxGroup.tsx +2 -2
  172. package/src/Chip/Chip.tsx +1 -1
  173. package/src/Content/Content.tsx +1 -1
  174. package/src/ContentOverlay/ContentOverlay.test.tsx +34 -27
  175. package/src/ContentOverlay/ContentOverlay.tsx +7 -7
  176. package/src/ContentOverlay/UNSAFE_WrappedModalize.tsx +41 -0
  177. package/src/ContentOverlay/hooks/useKeyboardVisibility.test.ts +7 -7
  178. package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +1 -1
  179. package/src/Disclosure/Disclosure.tsx +1 -1
  180. package/src/Divider/Divider.tsx +1 -1
  181. package/src/EmptyState/EmptyState.test.tsx +29 -42
  182. package/src/EmptyState/EmptyState.tsx +1 -1
  183. package/src/ErrorMessageWrapper/ErrorMessageWrapper.tsx +1 -1
  184. package/src/ErrorMessageWrapper/context/ErrorMessageProvider.tsx +3 -5
  185. package/src/ErrorMessageWrapper/context/types.ts +1 -1
  186. package/src/Flex/Flex.tsx +2 -2
  187. package/src/Form/Form.test.tsx +145 -2
  188. package/src/Form/Form.tsx +8 -1
  189. package/src/Form/components/FormActionBar/FormActionBar.tsx +3 -3
  190. package/src/Form/components/FormBody/FormBody.tsx +3 -3
  191. package/src/Form/components/FormCache/FormCache.tsx +5 -4
  192. package/src/Form/components/FormErrorBanner/FormErrorBanner.tsx +1 -1
  193. package/src/Form/components/FormMask/FormMask.tsx +1 -1
  194. package/src/Form/components/FormMessage/FormMessage.test.tsx +40 -27
  195. package/src/Form/components/FormMessage/FormMessage.tsx +1 -1
  196. package/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.tsx +1 -1
  197. package/src/Form/components/FormMessageBanner/FormMessageBanner.tsx +1 -3
  198. package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +2 -2
  199. package/src/Form/components/FormSaveButton/FormSaveButton.tsx +1 -1
  200. package/src/Form/context/AtlantisFormContext.test.tsx +1 -1
  201. package/src/Form/context/AtlantisFormContext.tsx +1 -0
  202. package/src/Form/context/types.ts +3 -2
  203. package/src/Form/hooks/useFormViewRefs.ts +4 -5
  204. package/src/Form/hooks/useInternalForm.ts +12 -4
  205. package/src/Form/hooks/useScrollToError/useScrollToError.test.tsx +2 -1
  206. package/src/Form/types.ts +14 -8
  207. package/src/FormField/FormField.tsx +1 -1
  208. package/src/FormatFile/FormatFile.test.tsx +21 -21
  209. package/src/FormatFile/FormatFile.tsx +3 -3
  210. package/src/FormatFile/components/ErrorIcon/ErrorIcon.tsx +1 -1
  211. package/src/FormatFile/components/FileView/FileView.tsx +1 -1
  212. package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.test.tsx +14 -14
  213. package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +2 -2
  214. package/src/FormatFile/components/MediaView/MediaView.test.tsx +283 -0
  215. package/src/FormatFile/components/MediaView/MediaView.tsx +28 -7
  216. package/src/FormatFile/components/ProgressBar/ProgressBar.tsx +1 -1
  217. package/src/FormatFile/utils/createUseCreateThumbnail.ts +1 -1
  218. package/src/Glimmer/Glimmer.test.tsx +2 -2
  219. package/src/Heading/Heading.test.tsx +13 -0
  220. package/src/Heading/Heading.tsx +3 -3
  221. package/src/Heading/__snapshots__/Heading.test.tsx.snap +65 -0
  222. package/src/Icon/Icon.tsx +1 -1
  223. package/src/Icon/__snapshots__/Icon.test.tsx.snap +7 -0
  224. package/src/IconButton/IconButton.tsx +1 -1
  225. package/src/InputCurrency/InputCurrency.tsx +72 -58
  226. package/src/InputDate/InputDate.tsx +7 -3
  227. package/src/InputEmail/InputEmail.tsx +15 -8
  228. package/src/InputFieldWrapper/InputFieldWrapper.style.ts +1 -1
  229. package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +48 -1
  230. package/src/InputFieldWrapper/InputFieldWrapper.tsx +39 -29
  231. package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +1 -1
  232. package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +8 -16
  233. package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +8 -6
  234. package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +2 -4
  235. package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +8 -6
  236. package/src/InputNumber/InputNumber.tsx +11 -7
  237. package/src/InputPassword/InputPassword.tsx +1 -1
  238. package/src/InputPressable/InputPressable.style.ts +4 -0
  239. package/src/InputPressable/InputPressable.test.tsx +75 -1
  240. package/src/InputPressable/InputPressable.tsx +34 -8
  241. package/src/InputSearch/InputSearch.tsx +2 -1
  242. package/src/InputSearch/components/FilterButton.tsx +1 -1
  243. package/src/InputText/InputText.style.ts +5 -0
  244. package/src/InputText/InputText.test.tsx +75 -0
  245. package/src/InputText/InputText.tsx +34 -17
  246. package/src/InputText/context/InputAccessoriesProvider.tsx +1 -1
  247. package/src/InputTime/InputTime.tsx +7 -3
  248. package/src/Menu/Menu.tsx +3 -3
  249. package/src/Menu/components/MenuOption/MenuOption.tsx +1 -1
  250. package/src/Menu/components/Overlay/Overlay.tsx +1 -1
  251. package/src/Menu/types.ts +7 -1
  252. package/src/ProgressBar/ProgressBar.tsx +1 -1
  253. package/src/ProgressBar/ProgressBarInner.tsx +1 -1
  254. package/src/Select/Select.style.ts +1 -0
  255. package/src/Select/Select.tsx +2 -2
  256. package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.tsx +1 -1
  257. package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.tsx +1 -1
  258. package/src/Select/components/SelectInternalPicker/SelectInternalPicker.tsx +1 -1
  259. package/src/Select/components/SelectPressable/SelectPressable.tsx +1 -4
  260. package/src/StatusLabel/StatusLabel.tsx +1 -1
  261. package/src/Switch/Switch.tsx +1 -1
  262. package/src/Switch/components/BaseSwitch/BaseSwitch.tsx +8 -2
  263. package/src/Text/Text.test.tsx +10 -0
  264. package/src/Text/Text.tsx +3 -3
  265. package/src/Text/__snapshots__/Text.test.tsx.snap +66 -0
  266. package/src/TextList/TextList.tsx +1 -1
  267. package/src/ThumbnailList/ThumbnailList.test.tsx +5 -5
  268. package/src/ThumbnailList/ThumbnailList.tsx +1 -1
  269. package/src/Toast/Toast.tsx +2 -2
  270. package/src/Typography/Typography.test.tsx +61 -0
  271. package/src/Typography/Typography.tsx +25 -9
  272. package/src/Typography/TypographyGestureDetector.tsx +1 -3
  273. package/src/Typography/__snapshots__/Typography.test.tsx.snap +222 -0
  274. package/src/hooks/useAtlantisI18n/locales/en.json +1 -0
  275. package/src/hooks/useAtlantisI18n/locales/es.json +1 -0
  276. package/src/hooks/useFormController.ts +6 -13
  277. package/src/utils/test/MockSafeAreaProvider.tsx +1 -1
  278. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -8,9 +8,11 @@ import type { InputFieldWrapperProps } from "../InputFieldWrapper";
8
8
  import { FormField } from "../FormField";
9
9
  import { InputPressable } from "../InputPressable";
10
10
  import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
11
+ import type { InputPressableProps } from "../InputPressable/InputPressable";
11
12
 
12
13
  interface BaseInputDateProps
13
- extends Pick<InputFieldWrapperProps, "invalid" | "disabled" | "placeholder"> {
14
+ extends Pick<InputFieldWrapperProps, "invalid" | "disabled" | "placeholder">,
15
+ Pick<InputPressableProps, "showMiniLabel"> {
14
16
  /**
15
17
  * Defaulted to "always" so user can clear the dates whenever there's a value.
16
18
  */
@@ -109,7 +111,7 @@ const display = Platform.OS === "ios" ? "inline" : "default";
109
111
  /**
110
112
  * Allow users to select a date using the device date picker.
111
113
  */
112
- export function InputDate(props: InputDateProps): JSX.Element {
114
+ export function InputDate(props: InputDateProps) {
113
115
  if (props.name) {
114
116
  return (
115
117
  <FormField<Date>
@@ -145,11 +147,12 @@ function InternalInputDate({
145
147
  minDate,
146
148
  placeholder,
147
149
  value,
150
+ showMiniLabel = true,
148
151
  name,
149
152
  onChange,
150
153
  accessibilityLabel,
151
154
  accessibilityHint,
152
- }: InputDateProps): JSX.Element {
155
+ }: InputDateProps) {
153
156
  const [showPicker, setShowPicker] = useState(false);
154
157
  const { t, locale, formatDate } = useAtlantisI18n();
155
158
 
@@ -174,6 +177,7 @@ function InternalInputDate({
174
177
  return (
175
178
  <>
176
179
  <InputPressable
180
+ showMiniLabel={showMiniLabel}
177
181
  focused={showPicker}
178
182
  clearable={canClearDate}
179
183
  disabled={disabled}
@@ -2,11 +2,25 @@ import type { Ref } from "react";
2
2
  import React, { forwardRef } from "react";
3
3
  import type { InputTextProps, InputTextRef } from "../InputText";
4
4
  import { InputText } from "../InputText";
5
+ import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
5
6
 
6
7
  export const InputEmail = forwardRef(InputEmailInternal);
7
8
  type InputEmailProps = Omit<InputTextProps, "keyboard">;
8
9
 
9
10
  function InputEmailInternal(props: InputEmailProps, ref: Ref<InputTextRef>) {
11
+ const { t } = useAtlantisI18n();
12
+
13
+ const defaultValidations = {
14
+ pattern: {
15
+ value:
16
+ /[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/,
17
+ message: t("InputEmail.enterEmail"),
18
+ },
19
+ } as const;
20
+ const mergedValidations = props.validations
21
+ ? Object.assign({}, defaultValidations, props.validations)
22
+ : defaultValidations;
23
+
10
24
  return (
11
25
  <InputText
12
26
  {...props}
@@ -14,14 +28,7 @@ function InputEmailInternal(props: InputEmailProps, ref: Ref<InputTextRef>) {
14
28
  autoCapitalize="none"
15
29
  autoCorrect={false}
16
30
  keyboard={"email-address"}
17
- validations={{
18
- pattern: {
19
- value:
20
- /[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/,
21
- message: "Enter a valid email address (email@example.com)",
22
- },
23
- ...props.validations,
24
- }}
31
+ validations={mergedValidations}
25
32
  />
26
33
  );
27
34
  }
@@ -43,6 +43,7 @@ export const useStyles = buildThemedStyles(tokens => {
43
43
  right: 0,
44
44
  bottom: 0,
45
45
  left: 0,
46
+ zIndex: 1,
46
47
  },
47
48
 
48
49
  miniLabel: {
@@ -53,7 +54,6 @@ export const useStyles = buildThemedStyles(tokens => {
53
54
  maxHeight:
54
55
  (typographyStyles.defaultSize.lineHeight || 0) +
55
56
  tokens["space-smaller"],
56
- zIndex: 1,
57
57
  },
58
58
  // Prevents the miniLabel from cutting off the ClearAction button
59
59
  miniLabelShowClearAction: {
@@ -1,6 +1,11 @@
1
1
  import React from "react";
2
2
  import type { RenderAPI } from "@testing-library/react-native";
3
- import { fireEvent, render, renderHook } from "@testing-library/react-native";
3
+ import {
4
+ fireEvent,
5
+ render,
6
+ renderHook,
7
+ screen,
8
+ } from "@testing-library/react-native";
4
9
  import type { ViewStyle } from "react-native";
5
10
  import { Text } from "react-native";
6
11
  import type { InputFieldWrapperProps } from ".";
@@ -311,4 +316,46 @@ describe("InputFieldWrapper", () => {
311
316
  expect(queryByTestId(INPUT_FIELD_WRAPPER_SPINNER_TEST_ID)).toBeNull();
312
317
  });
313
318
  });
319
+
320
+ describe("placeholderMode", () => {
321
+ it("renders the placeholder in its normal position", () => {
322
+ renderInputFieldWrapper({
323
+ placeholder: "placeholder",
324
+ placeholderMode: "normal",
325
+ });
326
+ const placeholder = screen.getByText("placeholder", {
327
+ includeHiddenElements: true,
328
+ });
329
+ expect(placeholder).toBeDefined();
330
+ expect(placeholder.props.style).toContainEqual(
331
+ typographyStyles.defaultSize,
332
+ );
333
+ });
334
+
335
+ it("renders the placeholder in its mini label position", () => {
336
+ renderInputFieldWrapper({
337
+ placeholder: "placeholder",
338
+ placeholderMode: "mini",
339
+ });
340
+ const placeholder = screen.getByText("placeholder", {
341
+ includeHiddenElements: true,
342
+ });
343
+ expect(placeholder).toBeDefined();
344
+ expect(placeholder.props.style).toContainEqual(
345
+ typographyStyles.smallSize,
346
+ );
347
+ });
348
+
349
+ it("does not render the placeholder", () => {
350
+ renderInputFieldWrapper({
351
+ placeholder: "placeholder",
352
+ placeholderMode: "hidden",
353
+ });
354
+ expect(
355
+ screen.queryByText("placeholder", {
356
+ includeHiddenElements: true,
357
+ }),
358
+ ).toBeNull();
359
+ });
360
+ });
314
361
  });
@@ -43,7 +43,14 @@ export interface InputFieldWrapperProps {
43
43
  */
44
44
  readonly assistiveText?: string;
45
45
 
46
- readonly hasMiniLabel?: boolean;
46
+ /**
47
+ * Controls how the placeholder text is displayed.
48
+ * - normal: the placeholder text will be displayed in the normal placeholder position
49
+ * - mini: the placeholder text will float above the input value
50
+ * - hidden: the placeholder text will not be displayed
51
+ * @default "normal"
52
+ */
53
+ readonly placeholderMode?: "normal" | "mini" | "hidden";
47
54
 
48
55
  readonly hasValue?: boolean;
49
56
 
@@ -119,7 +126,7 @@ export function InputFieldWrapper({
119
126
  assistiveText,
120
127
  prefix,
121
128
  suffix,
122
- hasMiniLabel = false,
129
+ placeholderMode = "normal",
123
130
  hasValue = false,
124
131
  error,
125
132
  focused = false,
@@ -131,7 +138,7 @@ export function InputFieldWrapper({
131
138
  toolbarVisibility = "while-editing",
132
139
  loading = false,
133
140
  loadingType = "spinner",
134
- }: InputFieldWrapperProps): JSX.Element {
141
+ }: InputFieldWrapperProps) {
135
142
  fieldAffixRequiredPropsCheck([prefix, suffix]);
136
143
  const handleClear = onClear ?? noopClear;
137
144
  warnIfClearActionWithNoOnClear(onClear, showClearAction);
@@ -143,6 +150,9 @@ export function InputFieldWrapper({
143
150
  const showLoadingGlimmer = loading && loadingType === "glimmer";
144
151
  const styles = useStyles();
145
152
 
153
+ const placeholderVisible = placeholderMode !== "hidden";
154
+ const miniLabelActive = placeholderMode === "mini";
155
+
146
156
  return (
147
157
  <ErrorMessageWrapper message={getMessage({ invalid, error })}>
148
158
  <View
@@ -160,35 +170,36 @@ export function InputFieldWrapper({
160
170
  <PrefixIcon
161
171
  disabled={disabled}
162
172
  focused={focused}
163
- hasMiniLabel={hasMiniLabel}
164
173
  inputInvalid={inputInvalid}
165
174
  icon={prefix.icon}
166
175
  />
167
176
  )}
168
177
  <View style={[styles.inputContainer]}>
169
- <View
170
- style={[
171
- !!placeholder && styles.label,
172
- hasMiniLabel && styles.miniLabel,
173
- disabled && styles.disabled,
174
- hasMiniLabel &&
175
- showClearAction &&
176
- styles.miniLabelShowClearAction,
177
- ]}
178
- pointerEvents="none"
179
- >
180
- <Placeholder
181
- placeholder={placeholder}
182
- labelVariation={getLabelVariation(error, invalid, disabled)}
183
- hasMiniLabel={hasMiniLabel}
184
- styleOverride={styleOverride?.placeholderText}
185
- />
186
- </View>
178
+ {placeholderVisible && (
179
+ <View
180
+ style={[
181
+ !!placeholder && styles.label,
182
+ miniLabelActive && styles.miniLabel,
183
+ disabled && styles.disabled,
184
+ miniLabelActive &&
185
+ showClearAction &&
186
+ styles.miniLabelShowClearAction,
187
+ ]}
188
+ pointerEvents="none"
189
+ >
190
+ <Placeholder
191
+ placeholder={placeholder}
192
+ labelVariation={getLabelVariation(error, invalid, disabled)}
193
+ miniLabelActive={miniLabelActive}
194
+ styleOverride={styleOverride?.placeholderText}
195
+ />
196
+ </View>
197
+ )}
187
198
  {prefix?.label && hasValue && (
188
199
  <PrefixLabel
189
200
  disabled={disabled}
190
201
  focused={focused}
191
- hasMiniLabel={hasMiniLabel}
202
+ miniLabelActive={miniLabelActive}
192
203
  inputInvalid={inputInvalid}
193
204
  label={prefix.label}
194
205
  styleOverride={styleOverride?.prefixLabel}
@@ -225,7 +236,7 @@ export function InputFieldWrapper({
225
236
  <SuffixLabel
226
237
  disabled={disabled}
227
238
  focused={focused}
228
- hasMiniLabel={hasMiniLabel}
239
+ miniLabelActive={miniLabelActive}
229
240
  inputInvalid={inputInvalid}
230
241
  label={suffix.label}
231
242
  hasLeftMargin={!showClearAction}
@@ -245,7 +256,6 @@ export function InputFieldWrapper({
245
256
  <SuffixIcon
246
257
  disabled={disabled}
247
258
  focused={focused}
248
- hasMiniLabel={hasMiniLabel}
249
259
  hasLeftMargin={!!(!showClearAction || suffix?.label)}
250
260
  inputInvalid={inputInvalid}
251
261
  icon={suffix.icon}
@@ -332,12 +342,12 @@ function Placeholder({
332
342
  placeholder,
333
343
  styleOverride,
334
344
  labelVariation,
335
- hasMiniLabel,
345
+ miniLabelActive,
336
346
  }: {
337
347
  readonly placeholder?: string;
338
348
  readonly styleOverride: StyleProp<TextStyle>;
339
349
  readonly labelVariation: TextVariation;
340
- readonly hasMiniLabel: boolean;
350
+ readonly miniLabelActive: boolean;
341
351
  }) {
342
352
  const typographyStyles = useTypographyStyles();
343
353
 
@@ -348,7 +358,7 @@ function Placeholder({
348
358
  hideFromScreenReader={true}
349
359
  maxLines="single"
350
360
  variation={labelVariation}
351
- level={hasMiniLabel ? "textSupporting" : "text"}
361
+ level={miniLabelActive ? "textSupporting" : "text"}
352
362
  >
353
363
  {placeholder}
354
364
  </Text>
@@ -361,7 +371,7 @@ function Placeholder({
361
371
  style={[
362
372
  typographyStyles[labelVariation],
363
373
  typographyStyles.baseRegularRegular,
364
- hasMiniLabel
374
+ miniLabelActive
365
375
  ? typographyStyles.smallSize
366
376
  : typographyStyles.defaultSize,
367
377
  styleOverride,
@@ -15,7 +15,7 @@ interface ClearActionProps {
15
15
  export function ClearAction({
16
16
  onPress,
17
17
  hasMarginRight = false,
18
- }: ClearActionProps): JSX.Element {
18
+ }: ClearActionProps) {
19
19
  const { t } = useAtlantisI18n();
20
20
  const styles = useStyles();
21
21
 
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
- import { render, renderHook } from "@testing-library/react-native";
2
+ import { render, renderHook, screen } from "@testing-library/react-native";
3
3
  import type { TextStyle } from "react-native";
4
4
  import type { ReactTestInstance } from "react-test-renderer";
5
+ import { Path } from "react-native-svg";
5
6
  import type { PrefixIconProps, PrefixLabelProps } from "./Prefix";
6
7
  import {
7
8
  PrefixIcon,
@@ -12,9 +13,6 @@ import {
12
13
  import { useTypographyStyles } from "../../../Typography";
13
14
  import { useStyles } from "../../InputFieldWrapper.style";
14
15
  import { tokens } from "../../../utils/design";
15
- import * as IconComponent from "../../../Icon/Icon";
16
-
17
- const iconSpy = jest.spyOn(IconComponent, "Icon");
18
16
 
19
17
  const mockLabel = "$";
20
18
 
@@ -32,7 +30,7 @@ beforeAll(() => {
32
30
  function setupLabel({
33
31
  disabled = false,
34
32
  focused = false,
35
- hasMiniLabel = false,
33
+ miniLabelActive = false,
36
34
  inputInvalid = false,
37
35
  label = mockLabel,
38
36
  styleOverride,
@@ -41,7 +39,7 @@ function setupLabel({
41
39
  <PrefixLabel
42
40
  disabled={disabled}
43
41
  focused={focused}
44
- hasMiniLabel={hasMiniLabel}
42
+ miniLabelActive={miniLabelActive}
45
43
  inputInvalid={inputInvalid}
46
44
  label={label}
47
45
  styleOverride={styleOverride}
@@ -52,7 +50,6 @@ function setupLabel({
52
50
  function setupIcon({
53
51
  disabled = false,
54
52
  focused = false,
55
- hasMiniLabel = false,
56
53
  inputInvalid = false,
57
54
  icon = "invoice",
58
55
  }: Partial<PrefixIconProps>) {
@@ -60,7 +57,6 @@ function setupIcon({
60
57
  <PrefixIcon
61
58
  disabled={disabled}
62
59
  focused={focused}
63
- hasMiniLabel={hasMiniLabel}
64
60
  inputInvalid={inputInvalid}
65
61
  icon={icon}
66
62
  />,
@@ -152,7 +148,7 @@ describe("Prefix", () => {
152
148
 
153
149
  it("updates the position of the label when a value is entered", () => {
154
150
  const tree = setupLabel({
155
- hasMiniLabel: true,
151
+ miniLabelActive: true,
156
152
  });
157
153
  const prefixLabel = tree.getByTestId(prefixLabelTestId);
158
154
  const labelWrapper = prefixLabel.children[0] as ReactTestInstance;
@@ -180,13 +176,9 @@ describe("Prefix", () => {
180
176
  setupIcon({
181
177
  disabled: true,
182
178
  });
183
- expect(iconSpy).toHaveBeenCalledWith(
184
- {
185
- customColor: tokens["color-disabled"],
186
- name: "invoice",
187
- },
188
- {},
189
- );
179
+ const icon = screen.getByTestId("invoice");
180
+ const path = icon.findByType(Path);
181
+ expect(path.props.fill).toEqual(tokens["color-disabled"]);
190
182
  });
191
183
  });
192
184
 
@@ -11,7 +11,7 @@ import { useStyles } from "../../InputFieldWrapper.style";
11
11
  export interface PrefixLabelProps {
12
12
  readonly focused: boolean;
13
13
  readonly disabled?: boolean;
14
- readonly hasMiniLabel: boolean;
14
+ readonly miniLabelActive: boolean;
15
15
  readonly inputInvalid: boolean;
16
16
  readonly label: string;
17
17
  readonly styleOverride?: StyleProp<TextStyle>;
@@ -23,11 +23,11 @@ export const prefixIconTestId = "ATL-InputFieldWrapper-PrefixIcon";
23
23
  export function PrefixLabel({
24
24
  focused,
25
25
  disabled,
26
- hasMiniLabel,
26
+ miniLabelActive,
27
27
  inputInvalid,
28
28
  label,
29
29
  styleOverride,
30
- }: PrefixLabelProps): JSX.Element {
30
+ }: PrefixLabelProps) {
31
31
  const styles = useStyles();
32
32
  const typographyStyles = useTypographyStyles();
33
33
 
@@ -41,7 +41,10 @@ export function PrefixLabel({
41
41
  testID={prefixLabelTestId}
42
42
  >
43
43
  <View
44
- style={[styles.prefixLabel, hasMiniLabel && styles.fieldAffixMiniLabel]}
44
+ style={[
45
+ styles.prefixLabel,
46
+ miniLabelActive && styles.fieldAffixMiniLabel,
47
+ ]}
45
48
  >
46
49
  {!styleOverride ? (
47
50
  <Text variation={disabled ? "disabled" : "base"}>{label}</Text>
@@ -67,7 +70,6 @@ export function PrefixLabel({
67
70
  export interface PrefixIconProps {
68
71
  readonly focused: boolean;
69
72
  readonly disabled?: boolean;
70
- readonly hasMiniLabel: boolean;
71
73
  readonly inputInvalid?: boolean;
72
74
  readonly icon: IconNames;
73
75
  readonly styleOverride?: StyleProp<ViewStyle>;
@@ -78,7 +80,7 @@ export function PrefixIcon({
78
80
  disabled,
79
81
  inputInvalid,
80
82
  icon,
81
- }: PrefixIconProps): JSX.Element {
83
+ }: PrefixIconProps) {
82
84
  const styles = useStyles();
83
85
  const { tokens } = useAtlantisTheme();
84
86
 
@@ -10,7 +10,7 @@ const mockLabel = "$";
10
10
  function setupLabel({
11
11
  disabled = false,
12
12
  focused = false,
13
- hasMiniLabel = false,
13
+ miniLabelActive = false,
14
14
  inputInvalid = false,
15
15
  label = mockLabel,
16
16
  styleOverride,
@@ -19,7 +19,7 @@ function setupLabel({
19
19
  <SuffixLabel
20
20
  disabled={disabled}
21
21
  focused={focused}
22
- hasMiniLabel={hasMiniLabel}
22
+ miniLabelActive={miniLabelActive}
23
23
  inputInvalid={inputInvalid}
24
24
  label={label}
25
25
  styleOverride={styleOverride}
@@ -30,7 +30,6 @@ function setupLabel({
30
30
  function setupIcon({
31
31
  disabled = false,
32
32
  focused = false,
33
- hasMiniLabel = false,
34
33
  inputInvalid = false,
35
34
  icon = "invoice",
36
35
  }: Partial<SuffixIconProps>) {
@@ -38,7 +37,6 @@ function setupIcon({
38
37
  <SuffixIcon
39
38
  disabled={disabled}
40
39
  focused={focused}
41
- hasMiniLabel={hasMiniLabel}
42
40
  inputInvalid={inputInvalid}
43
41
  icon={icon}
44
42
  />,
@@ -11,7 +11,7 @@ import { useStyles } from "../../InputFieldWrapper.style";
11
11
  export interface SuffixLabelProps {
12
12
  readonly focused: boolean;
13
13
  readonly disabled?: boolean;
14
- readonly hasMiniLabel: boolean;
14
+ readonly miniLabelActive: boolean;
15
15
  readonly inputInvalid?: boolean;
16
16
  readonly label: string;
17
17
  readonly hasLeftMargin?: boolean;
@@ -24,12 +24,12 @@ export const suffixIconTestId = "ATL-InputFieldWrapper-SuffixIcon";
24
24
  export function SuffixLabel({
25
25
  focused,
26
26
  disabled,
27
- hasMiniLabel,
27
+ miniLabelActive,
28
28
  inputInvalid,
29
29
  label,
30
30
  hasLeftMargin = true,
31
31
  styleOverride,
32
- }: SuffixLabelProps): JSX.Element {
32
+ }: SuffixLabelProps) {
33
33
  const styles = useStyles();
34
34
  const typographyStyles = useTypographyStyles();
35
35
 
@@ -44,7 +44,10 @@ export function SuffixLabel({
44
44
  ]}
45
45
  >
46
46
  <View
47
- style={[styles.suffixLabel, hasMiniLabel && styles.fieldAffixMiniLabel]}
47
+ style={[
48
+ styles.suffixLabel,
49
+ miniLabelActive && styles.fieldAffixMiniLabel,
50
+ ]}
48
51
  >
49
52
  {!styleOverride ? (
50
53
  <Text variation={disabled ? "disabled" : "base"}>{label}</Text>
@@ -70,7 +73,6 @@ export function SuffixLabel({
70
73
  export interface SuffixIconProps {
71
74
  readonly focused: boolean;
72
75
  readonly disabled?: boolean;
73
- readonly hasMiniLabel: boolean;
74
76
  readonly inputInvalid?: boolean;
75
77
  readonly icon: IconNames;
76
78
  readonly hasLeftMargin?: boolean;
@@ -84,7 +86,7 @@ export function SuffixIcon({
84
86
  icon,
85
87
  hasLeftMargin = false,
86
88
  onPress,
87
- }: SuffixIconProps): JSX.Element {
89
+ }: SuffixIconProps) {
88
90
  const styles = useStyles();
89
91
  const { tokens } = useAtlantisTheme();
90
92
 
@@ -46,6 +46,16 @@ function InputNumberInternal(props: InputNumberProps, ref: Ref<InputTextRef>) {
46
46
  const { inputTransform: convertToString, outputTransform: convertToNumber } =
47
47
  useNumberTransform(props.value);
48
48
 
49
+ const defaultValidations = {
50
+ pattern: {
51
+ value: NUMBER_VALIDATION_REGEX,
52
+ message: t("errors.notANumber"),
53
+ },
54
+ } as const;
55
+ const mergedValidations = props.validations
56
+ ? Object.assign({}, defaultValidations, props.validations)
57
+ : defaultValidations;
58
+
49
59
  return (
50
60
  <InputText
51
61
  {...props}
@@ -58,13 +68,7 @@ function InputNumberInternal(props: InputNumberProps, ref: Ref<InputTextRef>) {
58
68
  value={props.value?.toString()}
59
69
  defaultValue={props.defaultValue?.toString()}
60
70
  onChangeText={handleChange}
61
- validations={{
62
- pattern: {
63
- value: NUMBER_VALIDATION_REGEX,
64
- message: t("errors.notANumber"),
65
- },
66
- ...props.validations,
67
- }}
71
+ validations={mergedValidations}
68
72
  />
69
73
  );
70
74
  }
@@ -23,7 +23,7 @@ export interface InputPasswordProps
23
23
  function InputPasswordInternal(
24
24
  { usePrivacyEye = true, ...props }: InputPasswordProps,
25
25
  ref: Ref<InputTextRef>,
26
- ): JSX.Element {
26
+ ) {
27
27
  const { t } = useAtlantisI18n();
28
28
  const [passwordHidden, setPasswordHidden] = useState(true);
29
29
  const [privacyEye, setPrivacyEye] = useState<IconNames>("eye");
@@ -28,5 +28,9 @@ export const useStyles = buildThemedStyles(tokens => {
28
28
  inputInvalid: {
29
29
  borderColor: tokens["color-critical"],
30
30
  },
31
+
32
+ withoutMiniLabel: {
33
+ paddingTop: tokens["space-base"] + tokens["space-smallest"],
34
+ },
31
35
  };
32
36
  });
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { fireEvent, render } from "@testing-library/react-native";
2
+ import { fireEvent, render, screen } from "@testing-library/react-native";
3
3
  import { InputPressable } from ".";
4
4
  import type { InputFieldWrapperProps } from "../InputFieldWrapper";
5
5
 
@@ -120,6 +120,80 @@ describe("InputPressable", () => {
120
120
  expect(getByText(value, { includeHiddenElements: true })).toBeDefined();
121
121
  });
122
122
  });
123
+
124
+ describe("showMiniLabel", () => {
125
+ it("defaults to true", () => {
126
+ const props = { placeholder: "placeholder", value: "value" };
127
+ render(<InputPressable {...props} />);
128
+ expect(
129
+ screen.getByText("placeholder", { includeHiddenElements: true }),
130
+ ).toBeDefined();
131
+ expect(MockInputFieldWrapper).toHaveBeenCalledWith(
132
+ expect.objectContaining({
133
+ placeholderMode: "mini",
134
+ }),
135
+ );
136
+ });
137
+
138
+ describe("when true", () => {
139
+ it("renders the placeholder in its normal position when the input has no value", () => {
140
+ const props = { showMiniLabel: true, placeholder: "placeholder" };
141
+ render(<InputPressable {...props} />);
142
+ expect(
143
+ screen.getByText("placeholder", { includeHiddenElements: true }),
144
+ ).toBeDefined();
145
+ expect(MockInputFieldWrapper).toHaveBeenCalledWith(
146
+ expect.objectContaining({
147
+ placeholderMode: "normal",
148
+ }),
149
+ );
150
+ });
151
+
152
+ it("renders the placeholder as a mini label when the input has a value", () => {
153
+ const props = {
154
+ showMiniLabel: true,
155
+ placeholder: "placeholder",
156
+ value: "value",
157
+ };
158
+ render(<InputPressable {...props} />);
159
+ expect(
160
+ screen.getByText("placeholder", { includeHiddenElements: true }),
161
+ ).toBeDefined();
162
+ expect(MockInputFieldWrapper).toHaveBeenCalledWith(
163
+ expect.objectContaining({
164
+ placeholderMode: "mini",
165
+ }),
166
+ );
167
+ });
168
+ });
169
+
170
+ describe("when false", () => {
171
+ it("renders the placeholder in its normal position when the input has no value", () => {
172
+ const props = { showMiniLabel: false, placeholder: "placeholder" };
173
+ render(<InputPressable {...props} />);
174
+ expect(
175
+ screen.getByText("placeholder", { includeHiddenElements: true }),
176
+ ).toBeDefined();
177
+ expect(MockInputFieldWrapper).toHaveBeenCalledWith(
178
+ expect.objectContaining({
179
+ placeholderMode: "normal",
180
+ }),
181
+ );
182
+ });
183
+
184
+ it("does not render the placeholder when the input has a value", () => {
185
+ const props = {
186
+ showMiniLabel: false,
187
+ placeholder: "placeholder",
188
+ value: "value",
189
+ };
190
+ render(<InputPressable {...props} />);
191
+ expect(
192
+ screen.queryByText("placeholder", { includeHiddenElements: true }),
193
+ ).toBeNull();
194
+ });
195
+ });
196
+ });
123
197
  });
124
198
 
125
199
  describe("accessibilityLabel", () => {