@jobber/components-native 0.89.5-JOB-140604-cab60b8.43 → 0.89.5-JOB-140604-8777ec5.52

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 (229) hide show
  1. package/dist/package.json +7 -7
  2. package/dist/src/ActionItem/ActionItemGroup.js +1 -1
  3. package/dist/src/AutoLink/components/Link/Link.js +1 -1
  4. package/dist/src/BottomSheet/BottomSheet.js +4 -2
  5. package/dist/src/BottomSheet/hooks/useBottomSheetBackHandler.js +26 -0
  6. package/dist/src/Chip/Chip.js +12 -1
  7. package/dist/src/Chip/Chip.style.js +1 -1
  8. package/dist/src/ContentOverlay/ContentOverlay.js +3 -5
  9. package/dist/src/ErrorMessageWrapper/context/ErrorMessageProvider.js +1 -1
  10. package/dist/src/Form/Form.js +2 -1
  11. package/dist/src/Form/components/FormMessageBanner/FormMessageBanner.js +1 -1
  12. package/dist/src/Form/hooks/useInternalForm.js +6 -3
  13. package/dist/src/FormatFile/components/MediaView/MediaView.js +22 -5
  14. package/dist/src/InputDate/InputDate.js +2 -2
  15. package/dist/src/InputFieldWrapper/InputFieldWrapper.js +14 -12
  16. package/dist/src/InputFieldWrapper/components/Prefix/Prefix.js +5 -2
  17. package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +5 -2
  18. package/dist/src/InputPressable/InputPressable.js +20 -8
  19. package/dist/src/InputPressable/InputPressable.style.js +3 -0
  20. package/dist/src/InputText/InputText.js +22 -11
  21. package/dist/src/InputText/InputText.style.js +4 -0
  22. package/dist/src/InputTime/InputTime.js +2 -2
  23. package/dist/src/Menu/Menu.js +2 -2
  24. package/dist/src/Select/components/SelectPressable/SelectPressable.js +1 -1
  25. package/dist/src/utils/meta/meta.json +0 -1
  26. package/dist/tsconfig.build.tsbuildinfo +1 -1
  27. package/dist/types/src/ActionItem/ActionItem.d.ts +2 -1
  28. package/dist/types/src/ActionItem/ActionItemGroup.d.ts +2 -1
  29. package/dist/types/src/ActionItem/components/ActionItemContainer.d.ts +2 -1
  30. package/dist/types/src/ActionLabel/ActionLabel.d.ts +1 -1
  31. package/dist/types/src/ActivityIndicator/ActivityIndicator.d.ts +2 -1
  32. package/dist/types/src/AutoLink/AutoLink.d.ts +2 -1
  33. package/dist/types/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.d.ts +2 -1
  34. package/dist/types/src/AutoLink/components/Link/Link.d.ts +2 -1
  35. package/dist/types/src/Banner/Banner.d.ts +2 -1
  36. package/dist/types/src/Banner/components/BannerIcon/BannerIcon.d.ts +2 -1
  37. package/dist/types/src/BottomSheet/BottomSheet.d.ts +4 -9
  38. package/dist/types/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +2 -1
  39. package/dist/types/src/BottomSheet/hooks/useBottomSheetBackHandler.d.ts +8 -0
  40. package/dist/types/src/Button/Button.d.ts +2 -1
  41. package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.d.ts +1 -1
  42. package/dist/types/src/ButtonGroup/ButtonGroup.d.ts +2 -1
  43. package/dist/types/src/ButtonGroup/ButtonGroupAction.d.ts +4 -3
  44. package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +3 -2
  45. package/dist/types/src/Card/Card.d.ts +2 -1
  46. package/dist/types/src/Card/components/InternalCardHeader.d.ts +2 -1
  47. package/dist/types/src/Checkbox/Checkbox.d.ts +2 -1
  48. package/dist/types/src/Checkbox/CheckboxGroup.d.ts +2 -1
  49. package/dist/types/src/Chip/Chip.d.ts +2 -1
  50. package/dist/types/src/Content/Content.d.ts +2 -1
  51. package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +1 -1
  52. package/dist/types/src/Disclosure/Disclosure.d.ts +1 -1
  53. package/dist/types/src/Divider/Divider.d.ts +2 -1
  54. package/dist/types/src/EmptyState/EmptyState.d.ts +2 -1
  55. package/dist/types/src/ErrorMessageWrapper/ErrorMessageWrapper.d.ts +2 -1
  56. package/dist/types/src/ErrorMessageWrapper/context/ErrorMessageProvider.d.ts +2 -1
  57. package/dist/types/src/ErrorMessageWrapper/context/types.d.ts +1 -1
  58. package/dist/types/src/Flex/Flex.d.ts +2 -1
  59. package/dist/types/src/Form/Form.d.ts +2 -1
  60. package/dist/types/src/Form/components/FormActionBar/FormActionBar.d.ts +3 -2
  61. package/dist/types/src/Form/components/FormBody/FormBody.d.ts +3 -2
  62. package/dist/types/src/Form/components/FormCache/FormCache.d.ts +2 -1
  63. package/dist/types/src/Form/components/FormErrorBanner/FormErrorBanner.d.ts +2 -1
  64. package/dist/types/src/Form/components/FormMask/FormMask.d.ts +2 -1
  65. package/dist/types/src/Form/components/FormMessage/FormMessage.d.ts +2 -1
  66. package/dist/types/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.d.ts +2 -1
  67. package/dist/types/src/Form/components/FormMessageBanner/FormMessageBanner.d.ts +2 -1
  68. package/dist/types/src/Form/components/FormSaveButton/FormSaveButton.d.ts +2 -1
  69. package/dist/types/src/Form/context/AtlantisFormContext.d.ts +1 -1
  70. package/dist/types/src/Form/context/types.d.ts +2 -2
  71. package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
  72. package/dist/types/src/Form/hooks/useInternalForm.d.ts +5 -5
  73. package/dist/types/src/Form/types.d.ts +10 -4
  74. package/dist/types/src/FormField/FormField.d.ts +1 -1
  75. package/dist/types/src/FormatFile/FormatFile.d.ts +2 -1
  76. package/dist/types/src/FormatFile/components/ErrorIcon/ErrorIcon.d.ts +2 -1
  77. package/dist/types/src/FormatFile/components/FileView/FileView.d.ts +2 -1
  78. package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +3 -2
  79. package/dist/types/src/FormatFile/components/MediaView/MediaView.d.ts +2 -1
  80. package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.d.ts +2 -1
  81. package/dist/types/src/Heading/Heading.d.ts +1 -1
  82. package/dist/types/src/Icon/Icon.d.ts +2 -1
  83. package/dist/types/src/IconButton/IconButton.d.ts +1 -1
  84. package/dist/types/src/InputCurrency/InputCurrency.d.ts +2 -1
  85. package/dist/types/src/InputDate/InputDate.d.ts +4 -2
  86. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.d.ts +9 -2
  87. package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.d.ts +2 -1
  88. package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +4 -4
  89. package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +4 -4
  90. package/dist/types/src/InputPressable/InputPressable.d.ts +9 -1
  91. package/dist/types/src/InputPressable/InputPressable.style.d.ts +3 -0
  92. package/dist/types/src/InputSearch/InputSearch.d.ts +1 -1
  93. package/dist/types/src/InputSearch/components/FilterButton.d.ts +2 -1
  94. package/dist/types/src/InputText/InputText.d.ts +8 -0
  95. package/dist/types/src/InputText/InputText.style.d.ts +4 -0
  96. package/dist/types/src/InputText/context/InputAccessoriesProvider.d.ts +2 -1
  97. package/dist/types/src/InputTime/InputTime.d.ts +4 -2
  98. package/dist/types/src/Menu/Menu.d.ts +2 -1
  99. package/dist/types/src/Menu/components/MenuOption/MenuOption.d.ts +2 -1
  100. package/dist/types/src/Menu/components/Overlay/Overlay.d.ts +2 -1
  101. package/dist/types/src/Menu/types.d.ts +6 -1
  102. package/dist/types/src/ProgressBar/ProgressBar.d.ts +2 -1
  103. package/dist/types/src/ProgressBar/ProgressBarInner.d.ts +2 -1
  104. package/dist/types/src/Select/Select.d.ts +3 -2
  105. package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.d.ts +2 -1
  106. package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.d.ts +2 -1
  107. package/dist/types/src/Select/components/SelectInternalPicker/SelectInternalPicker.d.ts +2 -1
  108. package/dist/types/src/Select/components/SelectPressable/SelectPressable.d.ts +2 -1
  109. package/dist/types/src/StatusLabel/StatusLabel.d.ts +2 -1
  110. package/dist/types/src/Switch/Switch.d.ts +2 -1
  111. package/dist/types/src/Switch/components/BaseSwitch/BaseSwitch.d.ts +2 -1
  112. package/dist/types/src/Text/Text.d.ts +1 -1
  113. package/dist/types/src/TextList/TextList.d.ts +2 -1
  114. package/dist/types/src/ThumbnailList/ThumbnailList.d.ts +2 -1
  115. package/dist/types/src/Toast/Toast.d.ts +2 -1
  116. package/dist/types/src/Typography/Typography.d.ts +1 -1
  117. package/dist/types/src/Typography/TypographyGestureDetector.d.ts +2 -1
  118. package/dist/types/src/utils/test/MockSafeAreaProvider.d.ts +1 -1
  119. package/package.json +7 -7
  120. package/src/ActionItem/ActionItem.tsx +1 -1
  121. package/src/ActionItem/ActionItemGroup.tsx +1 -3
  122. package/src/ActionItem/components/ActionItemContainer.tsx +1 -1
  123. package/src/ActionLabel/ActionLabel.tsx +1 -1
  124. package/src/ActivityIndicator/ActivityIndicator.tsx +1 -3
  125. package/src/AutoLink/AutoLink.tsx +1 -1
  126. package/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.tsx +1 -1
  127. package/src/AutoLink/components/Link/Link.tsx +1 -5
  128. package/src/Banner/Banner.tsx +2 -2
  129. package/src/Banner/components/BannerIcon/BannerIcon.tsx +1 -1
  130. package/src/BottomSheet/BottomSheet.stories.tsx +0 -1
  131. package/src/BottomSheet/BottomSheet.tsx +9 -10
  132. package/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.tsx +1 -1
  133. package/src/BottomSheet/hooks/useBottomSheetBackHandler.test.ts +90 -0
  134. package/src/BottomSheet/hooks/useBottomSheetBackHandler.ts +41 -0
  135. package/src/Button/Button.tsx +1 -1
  136. package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +1 -1
  137. package/src/ButtonGroup/ButtonGroup.tsx +1 -1
  138. package/src/ButtonGroup/ButtonGroupAction.tsx +4 -4
  139. package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +2 -2
  140. package/src/Card/Card.tsx +1 -1
  141. package/src/Card/components/InternalCardHeader.tsx +1 -1
  142. package/src/Checkbox/Checkbox.tsx +2 -2
  143. package/src/Checkbox/CheckboxGroup.test.tsx +1 -1
  144. package/src/Checkbox/CheckboxGroup.tsx +2 -2
  145. package/src/Chip/Chip.style.ts +1 -1
  146. package/src/Chip/Chip.tsx +20 -2
  147. package/src/Content/Content.tsx +1 -1
  148. package/src/ContentOverlay/ContentOverlay.tsx +3 -4
  149. package/src/Disclosure/Disclosure.tsx +1 -1
  150. package/src/Divider/Divider.tsx +1 -1
  151. package/src/EmptyState/EmptyState.tsx +1 -1
  152. package/src/ErrorMessageWrapper/ErrorMessageWrapper.tsx +1 -1
  153. package/src/ErrorMessageWrapper/context/ErrorMessageProvider.tsx +3 -5
  154. package/src/ErrorMessageWrapper/context/types.ts +1 -1
  155. package/src/Flex/Flex.tsx +2 -2
  156. package/src/Form/Form.test.tsx +145 -2
  157. package/src/Form/Form.tsx +3 -1
  158. package/src/Form/components/FormActionBar/FormActionBar.tsx +3 -3
  159. package/src/Form/components/FormBody/FormBody.tsx +3 -3
  160. package/src/Form/components/FormCache/FormCache.tsx +1 -1
  161. package/src/Form/components/FormErrorBanner/FormErrorBanner.tsx +1 -1
  162. package/src/Form/components/FormMask/FormMask.tsx +1 -1
  163. package/src/Form/components/FormMessage/FormMessage.tsx +1 -1
  164. package/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.tsx +1 -1
  165. package/src/Form/components/FormMessageBanner/FormMessageBanner.tsx +1 -3
  166. package/src/Form/components/FormSaveButton/FormSaveButton.tsx +1 -1
  167. package/src/Form/context/types.ts +2 -2
  168. package/src/Form/hooks/useFormViewRefs.ts +4 -5
  169. package/src/Form/hooks/useInternalForm.ts +12 -5
  170. package/src/Form/types.ts +11 -4
  171. package/src/FormField/FormField.tsx +1 -1
  172. package/src/FormatFile/FormatFile.tsx +3 -3
  173. package/src/FormatFile/components/ErrorIcon/ErrorIcon.tsx +1 -1
  174. package/src/FormatFile/components/FileView/FileView.tsx +1 -1
  175. package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +2 -2
  176. package/src/FormatFile/components/MediaView/MediaView.test.tsx +283 -0
  177. package/src/FormatFile/components/MediaView/MediaView.tsx +28 -7
  178. package/src/FormatFile/components/ProgressBar/ProgressBar.tsx +1 -1
  179. package/src/Heading/Heading.tsx +1 -1
  180. package/src/Icon/Icon.tsx +1 -1
  181. package/src/IconButton/IconButton.tsx +1 -1
  182. package/src/InputCurrency/InputCurrency.tsx +1 -1
  183. package/src/InputDate/InputDate.tsx +7 -3
  184. package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +48 -1
  185. package/src/InputFieldWrapper/InputFieldWrapper.tsx +39 -29
  186. package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +1 -1
  187. package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +3 -5
  188. package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +8 -6
  189. package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +2 -4
  190. package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +8 -6
  191. package/src/InputPassword/InputPassword.tsx +1 -1
  192. package/src/InputPressable/InputPressable.style.ts +4 -0
  193. package/src/InputPressable/InputPressable.test.tsx +75 -1
  194. package/src/InputPressable/InputPressable.tsx +34 -8
  195. package/src/InputSearch/InputSearch.tsx +1 -0
  196. package/src/InputSearch/components/FilterButton.tsx +1 -1
  197. package/src/InputText/InputText.style.ts +5 -0
  198. package/src/InputText/InputText.test.tsx +75 -0
  199. package/src/InputText/InputText.tsx +32 -12
  200. package/src/InputText/context/InputAccessoriesProvider.tsx +1 -1
  201. package/src/InputTime/InputTime.tsx +7 -3
  202. package/src/Menu/Menu.tsx +3 -3
  203. package/src/Menu/components/MenuOption/MenuOption.tsx +1 -1
  204. package/src/Menu/components/Overlay/Overlay.tsx +1 -1
  205. package/src/Menu/types.ts +7 -1
  206. package/src/ProgressBar/ProgressBar.tsx +1 -1
  207. package/src/ProgressBar/ProgressBarInner.tsx +1 -1
  208. package/src/Select/Select.tsx +2 -2
  209. package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.tsx +1 -1
  210. package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.tsx +1 -1
  211. package/src/Select/components/SelectInternalPicker/SelectInternalPicker.tsx +1 -1
  212. package/src/Select/components/SelectPressable/SelectPressable.tsx +1 -4
  213. package/src/StatusLabel/StatusLabel.tsx +1 -1
  214. package/src/Switch/Switch.tsx +1 -1
  215. package/src/Switch/components/BaseSwitch/BaseSwitch.tsx +1 -1
  216. package/src/Text/Text.tsx +1 -1
  217. package/src/TextList/TextList.tsx +1 -1
  218. package/src/ThumbnailList/ThumbnailList.tsx +1 -1
  219. package/src/Toast/Toast.tsx +2 -2
  220. package/src/Typography/Typography.tsx +1 -1
  221. package/src/Typography/TypographyGestureDetector.tsx +1 -3
  222. package/src/utils/meta/meta.json +0 -1
  223. package/src/utils/test/MockSafeAreaProvider.tsx +1 -1
  224. package/dist/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.js +0 -45
  225. package/dist/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.styles.js +0 -8
  226. package/dist/types/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.d.ts +0 -9
  227. package/dist/types/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.styles.d.ts +0 -5
  228. package/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.styles.ts +0 -9
  229. package/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.tsx +0 -89
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.89.5-JOB-140604-cab60b8.43+cab60b8c4",
3
+ "version": "0.89.5-JOB-140604-8777ec5.52+8777ec587",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -55,7 +55,7 @@
55
55
  "devDependencies": {
56
56
  "@gorhom/bottom-sheet": "^5.2.6",
57
57
  "@react-native-community/datetimepicker": "^8.4.5",
58
- "@react-native/babel-preset": "^0.81.1",
58
+ "@react-native/babel-preset": "^0.82.1",
59
59
  "@storybook/addon-a11y": "^9.1.2",
60
60
  "@storybook/react": "^9.1.2",
61
61
  "@storybook/react-native-web-vite": "^9.1.2",
@@ -67,14 +67,14 @@
67
67
  "@types/react-test-renderer": "19.1.0",
68
68
  "date-fns": "^2.30.0",
69
69
  "date-fns-tz": "^2.0.0",
70
- "react-native": "^0.81.4",
71
- "react-native-gesture-handler": "^2.28.0",
70
+ "react-native": "^0.82.1",
71
+ "react-native-gesture-handler": "^2.29.1",
72
72
  "react-native-modal-datetime-picker": "^18.0.0",
73
73
  "react-native-reanimated": "^3.7.1",
74
74
  "react-native-safe-area-context": "^5.4.0",
75
75
  "react-native-svg": "^15.1.0",
76
76
  "react-native-web": "^0.20.0",
77
- "react-test-renderer": "19.1.0",
77
+ "react-test-renderer": "^19.1.1",
78
78
  "storybook": "^9.1.2"
79
79
  },
80
80
  "peerDependencies": {
@@ -84,7 +84,7 @@
84
84
  "@react-native-community/datetimepicker": ">=6.7.0",
85
85
  "date-fns": "^2.30.0",
86
86
  "date-fns-tz": "^2.0.0",
87
- "react": "^18 || ^19.1.0",
87
+ "react": "^19",
88
88
  "react-intl": "^6 || ^7",
89
89
  "react-native": ">=0.79.5",
90
90
  "react-native-gesture-handler": ">=2.22.0",
@@ -96,5 +96,5 @@
96
96
  "react-native-safe-area-context": "^5.4.0",
97
97
  "react-native-svg": ">=12.0.0"
98
98
  },
99
- "gitHead": "cab60b8c45dc2b1cd9271c7db3b984c65563e7f6"
99
+ "gitHead": "8777ec5874ee31d4d513ca4ddc477228a383efb6"
100
100
  }
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { View } from "react-native";
3
3
  import { useStyles } from "./ActionItem.style";
4
4
  import { Divider } from "../Divider";
5
- export function ActionItemGroup({ children, }) {
5
+ export function ActionItemGroup({ children }) {
6
6
  return React.createElement(View, null, renderChildren(children));
7
7
  }
8
8
  function renderChildren(children) {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { Text as RNText } from "react-native";
3
3
  import { Text } from "../../../Text";
4
- export function Link({ children, onPress, onLongPress, }) {
4
+ export function Link({ children, onPress, onLongPress }) {
5
5
  return (React.createElement(RNText, { onPress: onPress, onLongPress: onLongPress },
6
6
  React.createElement(Text, { variation: "interactive" }, children)));
7
7
  }
@@ -4,7 +4,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
4
4
  import RNBottomSheet, { BottomSheetBackdrop, BottomSheetFooter, BottomSheetView, } from "@gorhom/bottom-sheet";
5
5
  import { useStyles } from "./BottomSheet.style";
6
6
  import { BottomSheetOption } from "./components/BottomSheetOption";
7
- import { BottomSheetInputText } from "./components/BottomSheetInputText/BottomSheetInputText";
7
+ import { useBottomSheetBackHandler } from "./hooks/useBottomSheetBackHandler";
8
8
  import { Divider } from "../Divider";
9
9
  import { Heading } from "../Heading";
10
10
  import { useIsScreenReaderEnabled } from "../hooks";
@@ -17,6 +17,7 @@ export function BottomSheet({ children, showCancel, loading = false, heading, on
17
17
  const insets = useSafeAreaInsets();
18
18
  const previousIndexRef = useRef(-1);
19
19
  const bottomSheetRef = useRef(null);
20
+ const { handleSheetPositionChange } = useBottomSheetBackHandler(bottomSheetRef);
20
21
  useImperativeHandle(ref, () => ({
21
22
  open: () => {
22
23
  var _a;
@@ -28,6 +29,8 @@ export function BottomSheet({ children, showCancel, loading = false, heading, on
28
29
  },
29
30
  }));
30
31
  const handleChange = (index) => {
32
+ // Handle Android back button
33
+ handleSheetPositionChange(index);
31
34
  const previousIndex = previousIndexRef.current;
32
35
  if (previousIndex === -1 && index >= 0) {
33
36
  // Transitioned from closed to open
@@ -69,4 +72,3 @@ function Backdrop(bottomSheetBackdropProps) {
69
72
  const styles = useStyles();
70
73
  return (React.createElement(BottomSheetBackdrop, Object.assign({}, bottomSheetBackdropProps, { appearsOnIndex: 0, disappearsOnIndex: -1, style: styles.backdrop, opacity: 1 })));
71
74
  }
72
- BottomSheet.InputText = BottomSheetInputText;
@@ -0,0 +1,26 @@
1
+ import { useCallback, useRef } from "react";
2
+ import { BackHandler } from "react-native";
3
+ /**
4
+ * Hook that closes the bottom sheet on the hardware back button press if it is visible
5
+ * @param bottomSheetRef ref to the bottom sheet component
6
+ */
7
+ export function useBottomSheetBackHandler(bottomSheetRef) {
8
+ const backHandlerSubscriptionRef = useRef(null);
9
+ const handleSheetPositionChange = useCallback((index) => {
10
+ var _a;
11
+ const isBottomSheetVisible = index >= 0;
12
+ if (isBottomSheetVisible && !backHandlerSubscriptionRef.current) {
13
+ // Setup the back handler if the bottom sheet is right in front of the user
14
+ backHandlerSubscriptionRef.current = BackHandler.addEventListener("hardwareBackPress", () => {
15
+ var _a;
16
+ (_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
17
+ return true;
18
+ });
19
+ }
20
+ else if (!isBottomSheetVisible) {
21
+ (_a = backHandlerSubscriptionRef.current) === null || _a === void 0 ? void 0 : _a.remove();
22
+ backHandlerSubscriptionRef.current = null;
23
+ }
24
+ }, [bottomSheetRef]);
25
+ return { handleSheetPositionChange };
26
+ }
@@ -19,6 +19,7 @@ export function Chip({ icon, label, onPress, isDismissible, isActive, inactiveBa
19
19
  : tokens["color-interactive--background"],
20
20
  },
21
21
  isActive && { backgroundColor: accentColor },
22
+ getBorderStyle(inactiveBackgroundColor, tokens),
22
23
  ];
23
24
  const dismiss = (isActive || inactiveBackgroundColor === "surface") &&
24
25
  styles.activeDismissIcon;
@@ -27,7 +28,7 @@ export function Chip({ icon, label, onPress, isDismissible, isActive, inactiveBa
27
28
  iconCustomColor: iconColor,
28
29
  dismissColor: dismiss,
29
30
  };
30
- }, [accent, isActive, inactiveBackgroundColor]);
31
+ }, [accent, isActive, inactiveBackgroundColor, getBorderStyle, styles]);
31
32
  const accessibilityState = useMemo(() => {
32
33
  const checkableRoles = ["radio", "switch", "togglebutton", "checkbox"];
33
34
  if (checkableRoles.includes(accessibilityRole)) {
@@ -43,3 +44,13 @@ export function Chip({ icon, label, onPress, isDismissible, isActive, inactiveBa
43
44
  isDismissible && (React.createElement(View, { style: [styles.dismissIcon, dismissColor] },
44
45
  React.createElement(Icon, { name: "remove", size: "small" })))));
45
46
  }
47
+ function getBorderStyle(inactiveBackgroundColor, tokens) {
48
+ let borderColor = "transparent";
49
+ if (inactiveBackgroundColor === "surface") {
50
+ borderColor = tokens["color-border"];
51
+ }
52
+ return {
53
+ borderColor,
54
+ borderWidth: tokens["border-base"],
55
+ };
56
+ }
@@ -10,7 +10,7 @@ export const useStyles = buildThemedStyles(tokens => {
10
10
  justifyContent: "center",
11
11
  marginHorizontal: tokens["space-smaller"],
12
12
  marginTop: tokens["space-small"],
13
- paddingHorizontal: tokens["space-small"],
13
+ paddingHorizontal: tokens["space-base"],
14
14
  },
15
15
  iconLeft: {
16
16
  marginHorizontal: tokens["space-smallest"],
@@ -26,8 +26,8 @@ function ContentOverlayInternal({ children, title, accessibilityLabel, fullScree
26
26
  const isFullScreenOrTopPosition = fullScreen || (!adjustToContentHeight && position === "top");
27
27
  const shouldShowDismiss = showDismiss || isScreenReaderEnabled || isFullScreenOrTopPosition;
28
28
  const [showHeaderShadow, setShowHeaderShadow] = useState(false);
29
- const overlayHeader = useRef();
30
- const internalRef = useRef();
29
+ const overlayHeader = useRef(null);
30
+ const internalRef = useRef(null);
31
31
  const [modalizeMethods, setModalizeMethods] = useState();
32
32
  const callbackInternalRef = useCallback((instance) => {
33
33
  if (instance && !internalRef.current) {
@@ -124,9 +124,7 @@ function ContentOverlayInternal({ children, title, accessibilityLabel, fullScree
124
124
  : styles.titleWithoutDismiss,
125
125
  ] },
126
126
  React.createElement(Heading, { level: "subtitle", variation: loading ? "subdued" : "heading", align: "start" }, title)),
127
- shouldShowDismiss && (React.createElement(View, { style: styles.dismissButton,
128
- // @ts-expect-error tsc-ci
129
- ref: overlayHeader, accessibilityLabel: accessibilityLabel || closeOverlayA11YLabel, accessible: true },
127
+ shouldShowDismiss && (React.createElement(View, { style: styles.dismissButton, ref: overlayHeader, accessibilityLabel: accessibilityLabel || closeOverlayA11YLabel, accessible: true },
130
128
  React.createElement(IconButton, { name: "cross", customColor: loading ? tokens["color-disabled"] : tokens["color-heading"], onPress: () => onCloseController(), accessibilityLabel: closeOverlayA11YLabel, testID: "ATL-Overlay-CloseButton" }))))));
131
129
  }
132
130
  function renderChildren() {
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from "react";
2
2
  import { AccessibilityInfo, findNodeHandle } from "react-native";
3
3
  import { ErrorMessageContext } from "./ErrorMessageContext";
4
- export function ErrorMessageProvider({ children, }) {
4
+ export function ErrorMessageProvider({ children }) {
5
5
  const [elements, setElements] = useState({});
6
6
  return (React.createElement(ErrorMessageContext.Provider, { value: {
7
7
  elements,
@@ -49,7 +49,7 @@ export function Form(_a) {
49
49
  React.createElement(ErrorMessageProvider, null, child)));
50
50
  }
51
51
  // eslint-disable-next-line max-statements
52
- function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSubmitSuccess, bannerErrors, bannerMessages, initialValues, mode = "onTouched", reValidateMode = "onChange", formRef, saveButtonLabel, renderStickySection, localCacheKey, localCacheExclude, localCacheId, secondaryActions, saveButtonOffset, showStickySaveButton = false, renderFooter, }) {
52
+ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSubmitSuccess, bannerErrors, bannerMessages, initialValues, mode = "onTouched", reValidateMode = "onChange", formRef, saveButtonLabel, renderStickySection, localCacheKey, localCacheExclude, localCacheId, secondaryActions, saveButtonOffset, showStickySaveButton = false, renderFooter, UNSAFE_allowDiscardLocalCacheWhenOffline, }) {
53
53
  var _a;
54
54
  const { scrollViewRef, bottomViewRef, scrollToTop } = useFormViewRefs();
55
55
  const [saveButtonHeight, setSaveButtonHeight] = useState(0);
@@ -65,6 +65,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
65
65
  scrollViewRef,
66
66
  saveButtonHeight,
67
67
  messageBannerHeight,
68
+ UNSAFE_allowDiscardLocalCacheWhenOffline,
68
69
  });
69
70
  const { windowHeight, headerHeight } = useScreenInformation();
70
71
  const [keyboardHeight, setKeyboardHeight] = useState(0);
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { FormBannerMessageType } from "../../types";
3
3
  import { Banner } from "../../../Banner";
4
- export function FormMessageBanner({ bannerMessages, }) {
4
+ export function FormMessageBanner({ bannerMessages }) {
5
5
  return (React.createElement(React.Fragment, null, bannerMessages === null || bannerMessages === void 0 ? void 0 : bannerMessages.map((message, index) => (React.createElement(Banner, { key: index, text: message.message, type: getBannerType(message.messageType) })))));
6
6
  }
7
7
  function getBannerType(messageType) {
@@ -1,7 +1,7 @@
1
1
  import { useForm } from "react-hook-form";
2
2
  import { useAtlantisContext } from "../../AtlantisContext";
3
3
  import { useAtlantisFormContext } from "../context/AtlantisFormContext";
4
- export function useInternalForm({ mode, reValidateMode, initialValues, formRef, localCacheKey, localCacheId, scrollViewRef, saveButtonHeight, messageBannerHeight, }) {
4
+ export function useInternalForm({ mode, reValidateMode, initialValues, formRef, localCacheKey, localCacheId, scrollViewRef, saveButtonHeight, messageBannerHeight, UNSAFE_allowDiscardLocalCacheWhenOffline = false, }) {
5
5
  const { useConfirmBeforeBack, useInternalFormLocalCache } = useAtlantisFormContext();
6
6
  const { isOnline } = useAtlantisContext();
7
7
  const formMethods = useForm({
@@ -20,11 +20,14 @@ export function useInternalForm({ mode, reValidateMode, initialValues, formRef,
20
20
  messageBannerHeight,
21
21
  scrollViewRef });
22
22
  }
23
+ const shouldRemoveCacheOnBack = UNSAFE_allowDiscardLocalCacheWhenOffline
24
+ ? true
25
+ : isOnline;
23
26
  const removeListenerRef = useConfirmBeforeBack({
24
27
  alwaysPreventBack: isSubmitting,
25
28
  shouldShowAlert: isDirty,
26
- onAcceptEvent: isOnline ? removeLocalCache : undefined,
27
- showLostProgressMessage: isOnline || !clientSideSaveOn ? true : false,
29
+ onAcceptEvent: shouldRemoveCacheOnBack ? removeLocalCache : undefined,
30
+ showLostProgressMessage: shouldRemoveCacheOnBack || !clientSideSaveOn ? true : false,
28
31
  });
29
32
  return {
30
33
  setLocalCache,
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import React, { useEffect, useRef, useState } from "react";
2
2
  import { ImageBackground, View } from "react-native";
3
3
  import { useStyles } from "./MediaView.style";
4
4
  import { StatusCode } from "../../types";
@@ -14,20 +14,37 @@ export function MediaView({ accessibilityLabel, showOverlay, showError, file, st
14
14
  const { useCreateThumbnail } = useAtlantisFormatFileContext();
15
15
  const { thumbnail, error } = useCreateThumbnail(file);
16
16
  const [isLoading, setIsLoading] = useState(false);
17
+ /**
18
+ * Tracks whether onLoadEnd has fired to prevent race conditions.
19
+ * ImageBackground can fire onLoadEnd before onLoadStart when loading cached images,
20
+ * which would cause isLoading to get stuck at true, showing an infinite spinner.
21
+ */
22
+ const hasLoadedRef = useRef(false);
17
23
  const a11yLabel = computeA11yLabel({
18
24
  accessibilityLabel,
19
25
  showOverlay,
20
26
  showError,
21
27
  t,
22
28
  });
23
- const hasError = showError || error;
24
- const uri = thumbnail || file.thumbnailUrl || file.source;
25
- const styles = useStyles();
29
+ const hasError = showError || error, uri = thumbnail || file.thumbnailUrl || file.source, styles = useStyles();
30
+ const handleLoadStart = () => {
31
+ if (!hasLoadedRef.current) {
32
+ setIsLoading(true);
33
+ }
34
+ };
35
+ const handleLoadEnd = () => {
36
+ hasLoadedRef.current = true;
37
+ setIsLoading(false);
38
+ };
39
+ useEffect(() => {
40
+ hasLoadedRef.current = false;
41
+ setIsLoading(false);
42
+ }, [uri]);
26
43
  return (React.createElement(View, { accessible: true, accessibilityLabel: a11yLabel },
27
44
  React.createElement(ImageBackground, { style: [
28
45
  styles.imageBackground,
29
46
  styleInGrid ? styles.imageBackgroundGrid : styles.imageBackgroundFlat,
30
- ], resizeMode: styleInGrid ? "cover" : "contain", source: { uri }, testID: "test-image", onLoadStart: () => setIsLoading(true), onLoadEnd: () => setIsLoading(false) },
47
+ ], resizeMode: styleInGrid ? "cover" : "contain", source: { uri }, testID: "test-image", onLoadStart: handleLoadStart, onLoadEnd: handleLoadEnd },
31
48
  React.createElement(Overlay, { isLoading: isLoading, showOverlay: showOverlay, hasError: hasError, file: file, onUploadComplete: onUploadComplete, styles: styles }))));
32
49
  }
33
50
  function Overlay({ isLoading, showOverlay, hasError, file, onUploadComplete, styles, }) {
@@ -27,7 +27,7 @@ export function InputDate(props) {
27
27
  }
28
28
  return React.createElement(InternalInputDate, Object.assign({}, props));
29
29
  }
30
- function InternalInputDate({ clearable = "always", disabled, emptyValueLabel, invalid, maxDate, minDate, placeholder, value, name, onChange, accessibilityLabel, accessibilityHint, }) {
30
+ function InternalInputDate({ clearable = "always", disabled, emptyValueLabel, invalid, maxDate, minDate, placeholder, value, showMiniLabel = true, name, onChange, accessibilityLabel, accessibilityHint, }) {
31
31
  const [showPicker, setShowPicker] = useState(false);
32
32
  const { t, locale, formatDate } = useAtlantisI18n();
33
33
  const date = useMemo(() => {
@@ -44,7 +44,7 @@ function InternalInputDate({ clearable = "always", disabled, emptyValueLabel, in
44
44
  const canClearDate = formattedDate === emptyValueLabel ? "never" : clearable;
45
45
  const placeholderLabel = placeholder !== null && placeholder !== void 0 ? placeholder : t("date");
46
46
  return (React.createElement(React.Fragment, null,
47
- React.createElement(InputPressable, { focused: showPicker, clearable: canClearDate, disabled: disabled, invalid: invalid, placeholder: placeholderLabel, prefix: { icon: "calendar" }, value: formattedDate, onClear: handleClear, onPress: showDatePicker, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint }),
47
+ React.createElement(InputPressable, { showMiniLabel: showMiniLabel, focused: showPicker, clearable: canClearDate, disabled: disabled, invalid: invalid, placeholder: placeholderLabel, prefix: { icon: "calendar" }, value: formattedDate, onClear: handleClear, onPress: showDatePicker, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint }),
48
48
  React.createElement(DateTimePicker, { testID: "inputDate-datePicker", date: date || undefined, display: display, isVisible: showPicker, maximumDate: maxDate, minimumDate: minDate, mode: "date", confirmTextIOS: t("confirm"), cancelTextIOS: t("cancel"), locale: locale, onCancel: handleCancel, onConfirm: handleConfirm })));
49
49
  function showDatePicker() {
50
50
  Keyboard.dismiss();
@@ -11,7 +11,7 @@ import { Text } from "../Text";
11
11
  import { ActivityIndicator } from "../ActivityIndicator";
12
12
  export const INPUT_FIELD_WRAPPER_GLIMMERS_TEST_ID = "ATL-InputFieldWrapper-Glimmers";
13
13
  export const INPUT_FIELD_WRAPPER_SPINNER_TEST_ID = "ATL-InputFieldWrapper-Spinner";
14
- export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveText, prefix, suffix, hasMiniLabel = false, hasValue = false, error, focused = false, children, onClear, showClearAction = false, styleOverride, toolbar, toolbarVisibility = "while-editing", loading = false, loadingType = "spinner", }) {
14
+ export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveText, prefix, suffix, placeholderMode = "normal", hasValue = false, error, focused = false, children, onClear, showClearAction = false, styleOverride, toolbar, toolbarVisibility = "while-editing", loading = false, loadingType = "spinner", }) {
15
15
  fieldAffixRequiredPropsCheck([prefix, suffix]);
16
16
  const handleClear = onClear !== null && onClear !== void 0 ? onClear : noopClear;
17
17
  warnIfClearActionWithNoOnClear(onClear, showClearAction);
@@ -20,6 +20,8 @@ export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveTex
20
20
  const showLoadingSpinner = loading && loadingType === "spinner";
21
21
  const showLoadingGlimmer = loading && loadingType === "glimmer";
22
22
  const styles = useStyles();
23
+ const placeholderVisible = placeholderMode !== "hidden";
24
+ const miniLabelActive = placeholderMode === "mini";
23
25
  return (React.createElement(ErrorMessageWrapper, { message: getMessage({ invalid, error }) },
24
26
  React.createElement(View, { testID: "ATL-InputFieldWrapper", style: [
25
27
  styles.container,
@@ -29,18 +31,18 @@ export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveTex
29
31
  styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.container,
30
32
  ] },
31
33
  React.createElement(View, { style: styles.field },
32
- (prefix === null || prefix === void 0 ? void 0 : prefix.icon) && (React.createElement(PrefixIcon, { disabled: disabled, focused: focused, hasMiniLabel: hasMiniLabel, inputInvalid: inputInvalid, icon: prefix.icon })),
34
+ (prefix === null || prefix === void 0 ? void 0 : prefix.icon) && (React.createElement(PrefixIcon, { disabled: disabled, focused: focused, inputInvalid: inputInvalid, icon: prefix.icon })),
33
35
  React.createElement(View, { style: [styles.inputContainer] },
34
- React.createElement(View, { style: [
36
+ placeholderVisible && (React.createElement(View, { style: [
35
37
  !!placeholder && styles.label,
36
- hasMiniLabel && styles.miniLabel,
38
+ miniLabelActive && styles.miniLabel,
37
39
  disabled && styles.disabled,
38
- hasMiniLabel &&
40
+ miniLabelActive &&
39
41
  showClearAction &&
40
42
  styles.miniLabelShowClearAction,
41
43
  ], pointerEvents: "none" },
42
- React.createElement(Placeholder, { placeholder: placeholder, labelVariation: getLabelVariation(error, invalid, disabled), hasMiniLabel: hasMiniLabel, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.placeholderText })),
43
- (prefix === null || prefix === void 0 ? void 0 : prefix.label) && hasValue && (React.createElement(PrefixLabel, { disabled: disabled, focused: focused, hasMiniLabel: hasMiniLabel, inputInvalid: inputInvalid, label: prefix.label, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.prefixLabel })),
44
+ React.createElement(Placeholder, { placeholder: placeholder, labelVariation: getLabelVariation(error, invalid, disabled), miniLabelActive: miniLabelActive, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.placeholderText }))),
45
+ (prefix === null || prefix === void 0 ? void 0 : prefix.label) && hasValue && (React.createElement(PrefixLabel, { disabled: disabled, focused: focused, miniLabelActive: miniLabelActive, inputInvalid: inputInvalid, label: prefix.label, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.prefixLabel })),
44
46
  children,
45
47
  showLoadingGlimmer && (React.createElement(View, { testID: INPUT_FIELD_WRAPPER_GLIMMERS_TEST_ID, style: [
46
48
  styles.loadingGlimmers,
@@ -54,10 +56,10 @@ export function InputFieldWrapper({ invalid, disabled, placeholder, assistiveTex
54
56
  (suffix === null || suffix === void 0 ? void 0 : suffix.icon) ||
55
57
  showLoadingSpinner) && (React.createElement(View, { style: styles.inputEndContainer },
56
58
  showClearAction && (React.createElement(ClearAction, { hasMarginRight: !!(suffix === null || suffix === void 0 ? void 0 : suffix.icon) || !!(suffix === null || suffix === void 0 ? void 0 : suffix.label), onPress: handleClear })),
57
- (suffix === null || suffix === void 0 ? void 0 : suffix.label) && hasValue && (React.createElement(SuffixLabel, { disabled: disabled, focused: focused, hasMiniLabel: hasMiniLabel, inputInvalid: inputInvalid, label: suffix.label, hasLeftMargin: !showClearAction, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.suffixLabel })),
59
+ (suffix === null || suffix === void 0 ? void 0 : suffix.label) && hasValue && (React.createElement(SuffixLabel, { disabled: disabled, focused: focused, miniLabelActive: miniLabelActive, inputInvalid: inputInvalid, label: suffix.label, hasLeftMargin: !showClearAction, styleOverride: styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.suffixLabel })),
58
60
  showLoadingSpinner && (React.createElement(View, { style: styles.loadingSpinner },
59
61
  React.createElement(ActivityIndicator, { testID: INPUT_FIELD_WRAPPER_SPINNER_TEST_ID }))),
60
- (suffix === null || suffix === void 0 ? void 0 : suffix.icon) && (React.createElement(SuffixIcon, { disabled: disabled, focused: focused, hasMiniLabel: hasMiniLabel, hasLeftMargin: !!(!showClearAction || (suffix === null || suffix === void 0 ? void 0 : suffix.label)), inputInvalid: inputInvalid, icon: suffix.icon, onPress: suffix.onPress })))))),
62
+ (suffix === null || suffix === void 0 ? void 0 : suffix.icon) && (React.createElement(SuffixIcon, { disabled: disabled, focused: focused, hasLeftMargin: !!(!showClearAction || (suffix === null || suffix === void 0 ? void 0 : suffix.label)), inputInvalid: inputInvalid, icon: suffix.icon, onPress: suffix.onPress })))))),
61
63
  isToolbarVisible && React.createElement(View, { style: styles.toolbar }, toolbar)),
62
64
  assistiveText && !error && !invalid && (React.createElement(Text, { level: "textSupporting", variation: disabled ? "disabled" : focused ? "interactive" : "subdued" }, assistiveText))));
63
65
  }
@@ -93,12 +95,12 @@ function getMessage({ invalid, error, }) {
93
95
  messages.push(invalid);
94
96
  return messages.join("\n");
95
97
  }
96
- function Placeholder({ placeholder, styleOverride, labelVariation, hasMiniLabel, }) {
98
+ function Placeholder({ placeholder, styleOverride, labelVariation, miniLabelActive, }) {
97
99
  const typographyStyles = useTypographyStyles();
98
- return (React.createElement(React.Fragment, null, !styleOverride ? (React.createElement(Text, { hideFromScreenReader: true, maxLines: "single", variation: labelVariation, level: hasMiniLabel ? "textSupporting" : "text" }, placeholder)) : (React.createElement(RNText, { accessibilityRole: "none", accessible: false, importantForAccessibility: "no-hide-descendants", numberOfLines: 1, style: [
100
+ return (React.createElement(React.Fragment, null, !styleOverride ? (React.createElement(Text, { hideFromScreenReader: true, maxLines: "single", variation: labelVariation, level: miniLabelActive ? "textSupporting" : "text" }, placeholder)) : (React.createElement(RNText, { accessibilityRole: "none", accessible: false, importantForAccessibility: "no-hide-descendants", numberOfLines: 1, style: [
99
101
  typographyStyles[labelVariation],
100
102
  typographyStyles.baseRegularRegular,
101
- hasMiniLabel
103
+ miniLabelActive
102
104
  ? typographyStyles.smallSize
103
105
  : typographyStyles.defaultSize,
104
106
  styleOverride,
@@ -7,7 +7,7 @@ import { useTypographyStyles } from "../../../Typography";
7
7
  import { useStyles } from "../../InputFieldWrapper.style";
8
8
  export const prefixLabelTestId = "ATL-InputFieldWrapper-PrefixLabel";
9
9
  export const prefixIconTestId = "ATL-InputFieldWrapper-PrefixIcon";
10
- export function PrefixLabel({ focused, disabled, hasMiniLabel, inputInvalid, label, styleOverride, }) {
10
+ export function PrefixLabel({ focused, disabled, miniLabelActive, inputInvalid, label, styleOverride, }) {
11
11
  const styles = useStyles();
12
12
  const typographyStyles = useTypographyStyles();
13
13
  return (React.createElement(View, { style: [
@@ -15,7 +15,10 @@ export function PrefixLabel({ focused, disabled, hasMiniLabel, inputInvalid, lab
15
15
  focused && styles.inputFocused,
16
16
  inputInvalid && styles.inputInvalid,
17
17
  ], testID: prefixLabelTestId },
18
- React.createElement(View, { style: [styles.prefixLabel, hasMiniLabel && styles.fieldAffixMiniLabel] }, !styleOverride ? (React.createElement(Text, { variation: disabled ? "disabled" : "base" }, label)) : (React.createElement(RNText, { allowFontScaling: true, style: [
18
+ React.createElement(View, { style: [
19
+ styles.prefixLabel,
20
+ miniLabelActive && styles.fieldAffixMiniLabel,
21
+ ] }, !styleOverride ? (React.createElement(Text, { variation: disabled ? "disabled" : "base" }, label)) : (React.createElement(RNText, { allowFontScaling: true, style: [
19
22
  typographyStyles.baseRegularRegular,
20
23
  typographyStyles.base,
21
24
  typographyStyles.defaultSize,
@@ -7,7 +7,7 @@ import { useAtlantisTheme } from "../../../AtlantisThemeContext";
7
7
  import { useStyles } from "../../InputFieldWrapper.style";
8
8
  export const suffixLabelTestId = "ATL-InputFieldWrapper-SuffixLabel";
9
9
  export const suffixIconTestId = "ATL-InputFieldWrapper-SuffixIcon";
10
- export function SuffixLabel({ focused, disabled, hasMiniLabel, inputInvalid, label, hasLeftMargin = true, styleOverride, }) {
10
+ export function SuffixLabel({ focused, disabled, miniLabelActive, inputInvalid, label, hasLeftMargin = true, styleOverride, }) {
11
11
  const styles = useStyles();
12
12
  const typographyStyles = useTypographyStyles();
13
13
  return (React.createElement(View, { testID: suffixLabelTestId, style: [
@@ -16,7 +16,10 @@ export function SuffixLabel({ focused, disabled, hasMiniLabel, inputInvalid, lab
16
16
  inputInvalid && styles.inputInvalid,
17
17
  hasLeftMargin && styles.suffixLabelMargin,
18
18
  ] },
19
- React.createElement(View, { style: [styles.suffixLabel, hasMiniLabel && styles.fieldAffixMiniLabel] }, !styleOverride ? (React.createElement(Text, { variation: disabled ? "disabled" : "base" }, label)) : (React.createElement(RNText, { allowFontScaling: true, style: [
19
+ React.createElement(View, { style: [
20
+ styles.suffixLabel,
21
+ miniLabelActive && styles.fieldAffixMiniLabel,
22
+ ] }, !styleOverride ? (React.createElement(Text, { variation: disabled ? "disabled" : "base" }, label)) : (React.createElement(RNText, { allowFontScaling: true, style: [
20
23
  typographyStyles.baseRegularRegular,
21
24
  typographyStyles.base,
22
25
  typographyStyles.defaultSize,
@@ -1,15 +1,12 @@
1
- import React, { forwardRef, useEffect, useState } from "react";
1
+ import React, { forwardRef } from "react";
2
2
  import { Text as NativeText, Pressable } from "react-native";
3
3
  import { useShowClear } from "@jobber/hooks";
4
4
  import { useStyles } from "./InputPressable.style";
5
5
  import { InputFieldWrapper, useCommonInputStyles } from "../InputFieldWrapper";
6
6
  export const InputPressable = forwardRef(InputPressableInternal);
7
- export function InputPressableInternal({ value, placeholder, disabled, invalid, error, onPress, accessibilityLabel, accessibilityHint, prefix, suffix, clearable = "never", onClear, focused, }, ref) {
7
+ export function InputPressableInternal({ value, placeholder, disabled, invalid, error, showMiniLabel = true, onPress, accessibilityLabel, accessibilityHint, prefix, suffix, clearable = "never", onClear, focused, }, ref) {
8
8
  const hasValue = !!value;
9
- const [hasMiniLabel, setHasMiniLabel] = useState(Boolean(value));
10
- useEffect(() => {
11
- setHasMiniLabel(Boolean(value));
12
- }, [value]);
9
+ const placeholderMode = getPlaceholderMode(showMiniLabel, value);
13
10
  const showClear = useShowClear({
14
11
  clearable,
15
12
  multiline: false,
@@ -19,13 +16,28 @@ export function InputPressableInternal({ value, placeholder, disabled, invalid,
19
16
  });
20
17
  const styles = useStyles();
21
18
  const commonInputStyles = useCommonInputStyles();
22
- return (React.createElement(InputFieldWrapper, { prefix: prefix, suffix: suffix, hasValue: hasValue, hasMiniLabel: hasMiniLabel, focused: focused, error: error, invalid: invalid, placeholder: placeholder, disabled: disabled, showClearAction: showClear, onClear: onClear },
19
+ return (React.createElement(InputFieldWrapper, { prefix: prefix, suffix: suffix, hasValue: hasValue, placeholderMode: placeholderMode, focused: focused, error: error, invalid: invalid, placeholder: placeholder, disabled: disabled, showClearAction: showClear, onClear: onClear },
23
20
  React.createElement(Pressable, { style: styles.pressable, onPress: onPress, disabled: disabled, accessibilityLabel: accessibilityLabel || placeholder, accessibilityHint: accessibilityHint, accessibilityValue: { text: value } },
24
21
  React.createElement(NativeText, { style: [
25
22
  commonInputStyles.input,
26
23
  styles.inputPressableStyles,
27
- !hasMiniLabel && commonInputStyles.inputEmpty,
24
+ placeholderMode === "normal" && commonInputStyles.inputEmpty,
25
+ placeholderMode === "hidden" && styles.withoutMiniLabel,
28
26
  disabled && commonInputStyles.inputDisabled,
29
27
  (Boolean(invalid) || error) && styles.inputInvalid,
30
28
  ], testID: "inputPressableText", ref: ref, accessibilityRole: "none", accessible: false, importantForAccessibility: "no-hide-descendants" }, value))));
31
29
  }
30
+ function getPlaceholderMode(isMiniLabelAllowed, internalValue) {
31
+ const hasValue = Boolean(internalValue);
32
+ if (hasValue) {
33
+ if (isMiniLabelAllowed) {
34
+ return "mini";
35
+ }
36
+ else {
37
+ return "hidden";
38
+ }
39
+ }
40
+ else {
41
+ return "normal";
42
+ }
43
+ }
@@ -21,5 +21,8 @@ export const useStyles = buildThemedStyles(tokens => {
21
21
  inputInvalid: {
22
22
  borderColor: tokens["color-critical"],
23
23
  },
24
+ withoutMiniLabel: {
25
+ paddingTop: tokens["space-base"] + tokens["space-smallest"],
26
+ },
24
27
  };
25
28
  });
@@ -9,7 +9,7 @@ import { InputFieldWrapper } from "../InputFieldWrapper";
9
9
  import { useCommonInputStyles } from "../InputFieldWrapper/CommonInputStyles.style";
10
10
  export const InputText = forwardRef(InputTextInternal);
11
11
  // eslint-disable-next-line max-statements
12
- function InputTextInternal({ invalid, disabled, readonly = false, name, placeholder, assistiveText, keyboard, value: controlledValue, defaultValue, autoFocus, autoComplete = "off", spellCheck, textContentType = "none", validations, onChangeText, onSubmitEditing, onFocus, accessibilityLabel, accessibilityHint, autoCorrect, autoCapitalize, onBlur, multiline = false, prefix, suffix, transform = {}, clearable = multiline ? "never" : "while-editing", testID, secureTextEntry, styleOverride, toolbar, toolbarVisibility, loading, loadingType, }, ref) {
12
+ function InputTextInternal({ invalid, disabled, readonly = false, name, placeholder, assistiveText, showMiniLabel = true, keyboard, value: controlledValue, defaultValue, autoFocus, autoComplete = "off", spellCheck, textContentType = "none", validations, onChangeText, onSubmitEditing, onFocus, accessibilityLabel, accessibilityHint, autoCorrect, autoCapitalize, onBlur, multiline = false, prefix, suffix, transform = {}, clearable = multiline ? "never" : "while-editing", testID, secureTextEntry, styleOverride, toolbar, toolbarVisibility, loading, loadingType, }, ref) {
13
13
  var _a;
14
14
  const isAndroid = Platform.OS === "android";
15
15
  const isIOS = Platform.OS === "ios";
@@ -22,7 +22,8 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
22
22
  const internalValue = controlledValue !== null && controlledValue !== void 0 ? controlledValue : (_a = field.value) === null || _a === void 0 ? void 0 : _a.toString();
23
23
  const hasValue = internalValue !== "" && internalValue !== undefined;
24
24
  const [focused, setFocused] = useState(false);
25
- const { hasMiniLabel } = useMiniLabel(internalValue);
25
+ const placeholderMode = getPlaceholderMode(showMiniLabel, internalValue);
26
+ const miniLabelActive = placeholderMode === "mini";
26
27
  const textInputRef = useTextInputRef({ ref, onClear: handleClear });
27
28
  const showClear = useShowClear({
28
29
  clearable,
@@ -74,15 +75,18 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
74
75
  }
75
76
  const styles = useStyles();
76
77
  const commonInputStyles = useCommonInputStyles();
77
- return (React.createElement(InputFieldWrapper, { prefix: prefix, suffix: suffix, hasValue: hasValue, hasMiniLabel: hasMiniLabel, assistiveText: assistiveText, focused: focused, error: error, invalid: invalid, placeholder: placeholder, disabled: disabled, onClear: handleClear, showClearAction: showClear, styleOverride: styleOverride, toolbar: toolbar, toolbarVisibility: toolbarVisibility, loading: loading, loadingType: loadingType },
78
+ return (React.createElement(InputFieldWrapper, { prefix: prefix, suffix: suffix, hasValue: hasValue, placeholderMode: placeholderMode, assistiveText: assistiveText, focused: focused, error: error, invalid: invalid, placeholder: placeholder, disabled: disabled, onClear: handleClear, showClearAction: showClear, styleOverride: styleOverride, toolbar: toolbar, toolbarVisibility: toolbarVisibility, loading: loading, loadingType: loadingType },
78
79
  React.createElement(TextInput, Object.assign({ inputAccessoryViewID: inputAccessoryID || undefined, testID: testID, autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, spellCheck: spellCheck, style: [
79
80
  commonInputStyles.input,
80
81
  styles.inputPaddingTop,
81
- !hasMiniLabel && commonInputStyles.inputEmpty,
82
+ !miniLabelActive && commonInputStyles.inputEmpty,
82
83
  disabled && commonInputStyles.inputDisabled,
83
84
  multiline && styles.multiLineInput,
84
85
  multiline && Platform.OS === "ios" && styles.multilineInputiOS,
85
- multiline && hasMiniLabel && styles.multiLineInputWithMini,
86
+ multiline && miniLabelActive && styles.multiLineInputWithMini,
87
+ multiline &&
88
+ placeholderMode === "hidden" &&
89
+ styles.multilineWithoutMiniLabel,
86
90
  styleOverride === null || styleOverride === void 0 ? void 0 : styleOverride.inputText,
87
91
  loading && loadingType === "glimmer" && { color: "transparent" },
88
92
  ], readOnly: readonly, editable: !disabled, keyboardType: keyboard, value: inputTransform(internalValue), autoFocus: autoFocus, autoComplete: autoComplete, multiline: multiline, scrollEnabled: false, textContentType: textContentType, onChangeText: handleChangeText, onSubmitEditing: handleOnSubmitEditing, returnKeyType: returnKeyType, blurOnSubmit: shouldBlurOnSubmit, accessibilityLabel: accessibilityLabel || placeholder, accessibilityHint: accessibilityHint, accessibilityState: { busy: loading }, secureTextEntry: secureTextEntry }, androidA11yProps, { onFocus: event => {
@@ -149,10 +153,17 @@ function useTextInputRef({ ref, onClear }) {
149
153
  }), [onClear]);
150
154
  return textInputRef;
151
155
  }
152
- function useMiniLabel(internalValue) {
153
- const [hasMiniLabel, setHasMiniLabel] = useState(Boolean(internalValue));
154
- useEffect(() => {
155
- setHasMiniLabel(Boolean(internalValue));
156
- }, [internalValue]);
157
- return { hasMiniLabel };
156
+ function getPlaceholderMode(isMiniLabelAllowed, internalValue) {
157
+ const hasValue = Boolean(internalValue);
158
+ if (hasValue) {
159
+ if (isMiniLabelAllowed) {
160
+ return "mini";
161
+ }
162
+ else {
163
+ return "hidden";
164
+ }
165
+ }
166
+ else {
167
+ return "normal";
168
+ }
158
169
  }
@@ -20,5 +20,9 @@ export const useStyles = buildThemedStyles(tokens => {
20
20
  multilineInputiOS: {
21
21
  paddingTop: (typographyStyles.defaultSize.fontSize || 0) + tokens["space-smallest"],
22
22
  },
23
+ multilineWithoutMiniLabel: {
24
+ paddingTop: tokens["space-base"] + tokens["space-smallest"],
25
+ paddingBottom: tokens["space-base"] + tokens["space-smallest"],
26
+ },
23
27
  };
24
28
  });
@@ -28,7 +28,7 @@ export function InputTime(props) {
28
28
  }
29
29
  return React.createElement(InternalInputTime, Object.assign({}, props));
30
30
  }
31
- function InternalInputTime({ clearable = "always", disabled, emptyValueLabel, invalid, placeholder, value, name, type = "scheduling", onChange, showIcon = true, }) {
31
+ function InternalInputTime({ clearable = "always", disabled, emptyValueLabel, invalid, placeholder, value, name, type = "scheduling", showMiniLabel = true, onChange, showIcon = true, }) {
32
32
  const [showPicker, setShowPicker] = useState(false);
33
33
  const { t, formatTime } = useAtlantisI18n();
34
34
  const { timeZone, timeFormat } = useAtlantisContext();
@@ -42,7 +42,7 @@ function InternalInputTime({ clearable = "always", disabled, emptyValueLabel, in
42
42
  }, [dateTime, emptyValueLabel]);
43
43
  const canClearTime = formattedTime === emptyValueLabel ? "never" : clearable;
44
44
  return (React.createElement(View, { style: styles.container },
45
- React.createElement(InputPressable, { clearable: canClearTime, disabled: disabled, invalid: invalid, focused: showPicker, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t("time"), prefix: showIcon ? { icon: "timer" } : undefined, value: formattedTime, onClear: handleClear, onPress: showDatePicker }),
45
+ React.createElement(InputPressable, { showMiniLabel: showMiniLabel, clearable: canClearTime, disabled: disabled, invalid: invalid, focused: showPicker, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t("time"), prefix: showIcon ? { icon: "timer" } : undefined, value: formattedTime, onClear: handleClear, onPress: showDatePicker }),
46
46
  React.createElement(DateTimePicker, { testID: "inputTime-Picker", minuteInterval: getMinuteInterval(type), date: getInitialPickerDate(dateTime), timeZoneOffsetInMinutes: getTimeZoneOffsetInMinutes(timeZone, dateTime), isVisible: showPicker, mode: "time", onCancel: handleCancel, onConfirm: handleConfirm, is24Hour: is24Hour, locale: is24Hour ? LOCALE_24_HOURS : LOCALE_12_HOURS })));
47
47
  function showDatePicker() {
48
48
  Keyboard.dismiss();
@@ -14,8 +14,8 @@ import { useAtlantisTheme } from "../AtlantisThemeContext";
14
14
  export function Menu({ menuOptions, customActivator }) {
15
15
  const [open, setOpen] = useState(false);
16
16
  const [menuPosition, setMenuPosition] = useState();
17
- const activatorLayout = useRef();
18
- const menuButtonRef = useRef();
17
+ const activatorLayout = useRef(null);
18
+ const menuButtonRef = useRef(null);
19
19
  const screenInfo = useScreenInformation();
20
20
  const { t } = useAtlantisI18n();
21
21
  const styles = useStyles();