@jobber/components-native 0.116.2 → 0.116.4

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 (86) hide show
  1. package/dist/package.json +6 -6
  2. package/dist/src/Checkbox/Checkbox.test.js +5 -1
  3. package/dist/src/ContentOverlay/hooks/useViewLayoutHeight.test.js +0 -24
  4. package/dist/src/Form/Form.js +3 -3
  5. package/dist/src/FormField/FormField.test.js +5 -1
  6. package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +1 -7
  7. package/dist/src/InputText/InputText.js +1 -5
  8. package/dist/src/InputText/InputText.test.js +5 -1
  9. package/dist/src/Select/Select.style.js +2 -23
  10. package/dist/src/Typography/Typography.js +2 -2
  11. package/dist/src/primitives/Select/SelectPrimitive.js +2 -6
  12. package/dist/src/utils/types.js +1 -0
  13. package/dist/tsconfig.build.tsbuildinfo +1 -1
  14. package/dist/tsconfig.json +4 -0
  15. package/dist/types/src/ActionItem/components/ActionItemContainer.style.d.ts +1 -1
  16. package/dist/types/src/Banner/Banner.style.d.ts +2 -2
  17. package/dist/types/src/Button/Button.style.d.ts +2 -2
  18. package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.style.d.ts +9 -4
  19. package/dist/types/src/ButtonGroup/ButtonGroup.style.d.ts +1 -1
  20. package/dist/types/src/Card/Card.style.d.ts +1 -1
  21. package/dist/types/src/Checkbox/Checkbox.style.d.ts +2 -2
  22. package/dist/types/src/Checkbox/CheckboxGroup.style.d.ts +1 -1
  23. package/dist/types/src/ContentOverlay/BottomSheetKeyboardAwareScrollView.d.ts +2 -7
  24. package/dist/types/src/ContentOverlay/ContentOverlay.style.d.ts +1 -1
  25. package/dist/types/src/Disclosure/Disclosure.style.d.ts +1 -1
  26. package/dist/types/src/Divider/DividerHorizontal.style.d.ts +1 -1
  27. package/dist/types/src/Divider/DividerVertical.style.d.ts +1 -1
  28. package/dist/types/src/ErrorMessageWrapper/ErrorMessageWrapper.style.d.ts +4 -4
  29. package/dist/types/src/ErrorMessageWrapper/context/types.d.ts +3 -2
  30. package/dist/types/src/Flex/Flex.styles.d.ts +4 -4
  31. package/dist/types/src/Form/Form.style.d.ts +1 -1
  32. package/dist/types/src/Form/components/FormActionBar/FormActionBar.style.d.ts +1 -1
  33. package/dist/types/src/Form/components/FormBody/FormBody.style.d.ts +1 -1
  34. package/dist/types/src/Form/components/FormMask/FormMask.style.d.ts +2 -2
  35. package/dist/types/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.style.d.ts +1 -1
  36. package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
  37. package/dist/types/src/FormatFile/components/FileView/FileView.style.d.ts +5 -5
  38. package/dist/types/src/FormatFile/components/MediaView/MediaView.style.d.ts +4 -4
  39. package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.style.d.ts +2 -2
  40. package/dist/types/src/Glimmer/Glimmer.shape.style.d.ts +3 -3
  41. package/dist/types/src/Glimmer/Glimmer.style.d.ts +4 -4
  42. package/dist/types/src/InputFieldWrapper/CommonInputStyles.style.d.ts +3 -3
  43. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +4 -106
  44. package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.style.d.ts +1 -1
  45. package/dist/types/src/InputPressable/InputPressable.d.ts +3 -3
  46. package/dist/types/src/InputPressable/InputPressable.style.d.ts +11 -21
  47. package/dist/types/src/InputSearch/InputSearch.style.d.ts +3 -3
  48. package/dist/types/src/InputText/InputText.d.ts +2 -2
  49. package/dist/types/src/InputText/context/InputAccessoriesProvider.style.d.ts +8 -17
  50. package/dist/types/src/InputTime/InputTime.style.d.ts +3 -3
  51. package/dist/types/src/ProgressBar/ProgressBar.size.style.d.ts +2 -2
  52. package/dist/types/src/ProgressBar/ProgressBar.style.d.ts +4 -4
  53. package/dist/types/src/ProgressIndicator/ProgressIndicator.size.style.d.ts +2 -2
  54. package/dist/types/src/ProgressIndicator/ProgressIndicator.style.d.ts +5 -5
  55. package/dist/types/src/Select/Select.style.d.ts +12 -29
  56. package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.style.d.ts +4 -4
  57. package/dist/types/src/Switch/Switch.styles.d.ts +1 -1
  58. package/dist/types/src/TextList/TextList.style.d.ts +1 -1
  59. package/dist/types/src/Toast/Toast.styles.d.ts +1 -1
  60. package/dist/types/src/Typography/Typography.style.d.ts +1 -3
  61. package/dist/types/src/utils/types.d.ts +3 -0
  62. package/package.json +6 -6
  63. package/src/Checkbox/Checkbox.test.tsx +5 -1
  64. package/src/ContentOverlay/BottomSheetKeyboardAwareScrollView.tsx +9 -1
  65. package/src/ContentOverlay/ContentOverlay.tsx +2 -1
  66. package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +3 -27
  67. package/src/ErrorMessageWrapper/ErrorMessageWrapper.tsx +2 -1
  68. package/src/ErrorMessageWrapper/context/ErrorMessageProvider.tsx +4 -3
  69. package/src/ErrorMessageWrapper/context/types.ts +3 -2
  70. package/src/Flex/Flex.styles.tsx +1 -1
  71. package/src/Form/Form.tsx +1 -1
  72. package/src/Form/components/FormActionBar/FormActionBar.tsx +2 -2
  73. package/src/Form/hooks/useFormViewRefs.ts +3 -3
  74. package/src/FormField/FormField.test.tsx +5 -1
  75. package/src/InputFieldWrapper/CommonInputStyles.style.ts +6 -5
  76. package/src/InputFieldWrapper/InputFieldWrapper.style.ts +32 -8
  77. package/src/InputPressable/InputPressable.style.ts +11 -1
  78. package/src/InputPressable/InputPressable.tsx +5 -3
  79. package/src/InputText/InputText.test.tsx +5 -1
  80. package/src/InputText/InputText.tsx +8 -8
  81. package/src/InputText/context/InputAccessoriesProvider.style.tsx +8 -2
  82. package/src/Select/Select.style.ts +31 -25
  83. package/src/Typography/Typography.style.ts +2 -1
  84. package/src/Typography/Typography.tsx +2 -2
  85. package/src/primitives/Select/SelectPrimitive.tsx +7 -6
  86. package/src/utils/types.ts +4 -0
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.116.2",
3
+ "version": "0.116.4",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -65,7 +65,7 @@
65
65
  "lodash": "^4.18.1",
66
66
  "react-hook-form": "^7.52.0",
67
67
  "react-intl": "^7.1.11",
68
- "react-native-keyboard-controller": "^1.20.7",
68
+ "react-native-keyboard-controller": "^1.22.5",
69
69
  "react-native-toast-message": "^2.1.6",
70
70
  "react-native-uuid": "^2.0.4",
71
71
  "ts-xor": "^1.1.0"
@@ -74,7 +74,7 @@
74
74
  "@babel/runtime": "^7.29.2",
75
75
  "@gorhom/bottom-sheet": "^5.2.8",
76
76
  "@jobber/design": "0.121.1",
77
- "@jobber/hooks": "2.21.1",
77
+ "@jobber/hooks": "2.21.2",
78
78
  "@react-native-community/datetimepicker": "^8.4.5",
79
79
  "@react-native/babel-preset": "^0.82.1",
80
80
  "@storybook/addon-a11y": "10.3.5",
@@ -94,7 +94,7 @@
94
94
  "react-dom": "19.1.1",
95
95
  "react-native": "^0.82.1",
96
96
  "react-native-gesture-handler": "^2.29.1",
97
- "react-native-keyboard-controller": "^1.12.0",
97
+ "react-native-keyboard-controller": "^1.22.5",
98
98
  "react-native-modal-datetime-picker": "^18.0.0",
99
99
  "react-native-reanimated": "4.2.3",
100
100
  "react-native-safe-area-context": "^5.4.0",
@@ -118,12 +118,12 @@
118
118
  "react-intl": "^6 || ^7",
119
119
  "react-native": ">=0.79.5",
120
120
  "react-native-gesture-handler": ">=2.22.0",
121
- "react-native-keyboard-controller": "^1.20.7",
121
+ "react-native-keyboard-controller": "^1.22.5",
122
122
  "react-native-modal-datetime-picker": " >=13.0.0",
123
123
  "react-native-reanimated": "^4.0.0",
124
124
  "react-native-safe-area-context": "^5.4.0",
125
125
  "react-native-screens": ">=4.18.0",
126
126
  "react-native-svg": ">=12.0.0"
127
127
  },
128
- "gitHead": "028f5c6483614c4409dbb96015b0d1b00cea1eb7"
128
+ "gitHead": "fbfc7ead780f19390f319ef0d5e604929668be3c"
129
129
  }
@@ -71,7 +71,11 @@ describe("Checkbox with FormProvider", () => {
71
71
  const formMethods = useForm();
72
72
  return (React.createElement(FormProvider, Object.assign({}, formMethods),
73
73
  React.createElement(Checkbox, { name: checkboxName, label: checkboxLabel, defaultChecked: defaultChecked, accessibilityLabel: accessibilityLabel }),
74
- React.createElement(Button, { onPress: formMethods.handleSubmit(values => mockOnSubmit(values)), title: saveButtonText, accessibilityLabel: saveButtonText })));
74
+ React.createElement(Button, { onPress: () => {
75
+ void formMethods.handleSubmit(values => {
76
+ mockOnSubmit(values);
77
+ })();
78
+ }, title: saveButtonText, accessibilityLabel: saveButtonText })));
75
79
  }
76
80
  beforeEach(() => {
77
81
  mockOnSubmit.mockClear();
@@ -27,30 +27,6 @@ describe("useViewLayoutHeight", () => {
27
27
  y: 0,
28
28
  },
29
29
  },
30
- currentTarget: 0,
31
- target: 0,
32
- bubbles: false,
33
- cancelable: false,
34
- defaultPrevented: false,
35
- eventPhase: 0,
36
- isTrusted: false,
37
- preventDefault: function () {
38
- throw new Error("Function not implemented.");
39
- },
40
- isDefaultPrevented: function () {
41
- throw new Error("Function not implemented.");
42
- },
43
- stopPropagation: function () {
44
- throw new Error("Function not implemented.");
45
- },
46
- isPropagationStopped: function () {
47
- throw new Error("Function not implemented.");
48
- },
49
- persist: function () {
50
- throw new Error("Function not implemented.");
51
- },
52
- timeStamp: 0,
53
- type: "",
54
30
  };
55
31
  const { result } = renderHook(() => useViewLayoutHeight());
56
32
  yield act(() => __awaiter(void 0, void 0, void 0, function* () {
@@ -51,7 +51,7 @@ export function Form(_a) {
51
51
  }
52
52
  // eslint-disable-next-line max-statements
53
53
  function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSubmitSuccess, bannerErrors, bannerMessages, initialValues, mode = "onTouched", reValidateMode = "onChange", formRef, saveButtonLabel, renderStickySection, localCacheKey, localCacheExclude, localCacheId, secondaryActions, saveButtonOffset, showStickySaveButton = false, disableKeyboardAwareScroll = false, renderFooter, UNSAFE_allowDiscardLocalCacheWhenOffline, }) {
54
- var _a;
54
+ var _a, _b;
55
55
  const { scrollViewRef, bottomViewRef, scrollToTop } = useFormViewRefs();
56
56
  const [saveButtonHeight, setSaveButtonHeight] = useState(0);
57
57
  const [messageBannerHeight, setMessageBannerHeight] = useState(0);
@@ -86,9 +86,9 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
86
86
  const calculatedKeyboardHeight = keyboardHeight - extraViewHeight;
87
87
  useScrollToError({
88
88
  formState: formMethods.formState,
89
- refNode: findNodeHandle(scrollViewRef.current),
89
+ refNode: (_a = findNodeHandle(scrollViewRef.current)) !== null && _a !== void 0 ? _a : null,
90
90
  setFocus: formMethods.setFocus,
91
- scrollTo: (_a = scrollViewRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo,
91
+ scrollTo: (_b = scrollViewRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo,
92
92
  });
93
93
  const handleOfflineSubmit = useOfflineHandler();
94
94
  const handleKeyboardShow = useCallback((event) => {
@@ -21,7 +21,11 @@ describe("when a component is wrapped in a FormField within a Form", () => {
21
21
  const formMethods = useForm();
22
22
  return (React.createElement(FormProvider, Object.assign({}, formMethods),
23
23
  children,
24
- React.createElement(Button, { onPress: formMethods.handleSubmit(values => mockOnSubmit(values)), title: saveButtonText, accessibilityLabel: saveButtonText })));
24
+ React.createElement(Button, { onPress: () => {
25
+ void formMethods.handleSubmit(values => {
26
+ mockOnSubmit(values);
27
+ })();
28
+ }, title: saveButtonText, accessibilityLabel: saveButtonText })));
25
29
  }
26
30
  describe("when the component's value is changed", () => {
27
31
  it("updates the form value for that component", () => __awaiter(void 0, void 0, void 0, function* () {
@@ -1,4 +1,3 @@
1
- import { StyleSheet } from "react-native";
2
1
  import { getCommonInputStyles } from "./CommonInputStyles.style";
3
2
  import { buildThemedStyles } from "../AtlantisThemeContext";
4
3
  import { getTypographyStyles } from "../Typography";
@@ -6,12 +5,7 @@ export const useStyles = buildThemedStyles(tokens => {
6
5
  const commonInputStyles = getCommonInputStyles(tokens);
7
6
  const typographyStyles = getTypographyStyles(tokens);
8
7
  return {
9
- container: StyleSheet.flatten([
10
- commonInputStyles.container,
11
- {
12
- flexDirection: "column",
13
- },
14
- ]),
8
+ container: Object.assign(Object.assign({}, commonInputStyles.container), { flexDirection: "column" }),
15
9
  field: {
16
10
  flexDirection: "row",
17
11
  alignItems: "center",
@@ -150,11 +150,7 @@ function InputTextInternal({ invalid, disabled, readonly = false, name, placehol
150
150
  const keyboardState = animatedKeyboardState.get();
151
151
  const currentlyFocusedInput = TextInput.State.currentlyFocusedInput();
152
152
  const currentFocusedInput = currentlyFocusedInput !== null
153
- ? findNodeHandle(
154
- // @ts-expect-error - TextInput.State.currentlyFocusedInput() returns NativeMethods
155
- // which is not directly assignable to findNodeHandle's expected type,
156
- // but it works at runtime. This is a known type limitation in React Native.
157
- currentlyFocusedInput)
153
+ ? findNodeHandle(currentlyFocusedInput)
158
154
  : null;
159
155
  // Only remove the target if it belongs to the current component
160
156
  // and if the currently focused input is not in the targets set
@@ -421,7 +421,11 @@ describe("InputText", () => {
421
421
  const formMethods = useForm();
422
422
  return (React.createElement(FormProvider, Object.assign({}, formMethods),
423
423
  React.createElement(InputText, { name: inputName, defaultValue: defaultValue, accessibilityLabel: inputAccessibilityLabel }),
424
- React.createElement(Button, { onPress: formMethods.handleSubmit(values => mockOnSubmit(values)), title: saveButtonText, accessibilityLabel: saveButtonText })));
424
+ React.createElement(Button, { onPress: () => {
425
+ void formMethods.handleSubmit(values => {
426
+ mockOnSubmit(values);
427
+ })();
428
+ }, title: saveButtonText, accessibilityLabel: saveButtonText })));
425
429
  }
426
430
  beforeEach(() => {
427
431
  mockOnSubmit.mockClear();
@@ -1,31 +1,10 @@
1
- import { StyleSheet } from "react-native";
2
1
  import { getCommonInputStyles } from "../InputFieldWrapper";
3
2
  import { buildThemedStyles } from "../AtlantisThemeContext";
4
3
  export const useStyles = buildThemedStyles(tokens => {
5
4
  const commonInputStyles = getCommonInputStyles(tokens);
6
5
  return {
7
- container: StyleSheet.flatten([
8
- commonInputStyles.container,
9
- {
10
- flexDirection: "column",
11
- justifyContent: "center",
12
- minHeight: tokens["space-largest"] + tokens["space-small"],
13
- marginVertical: 0,
14
- borderWidth: 0,
15
- backgroundColor: "transparent",
16
- },
17
- ]),
18
- input: StyleSheet.flatten([
19
- commonInputStyles.input,
20
- {
21
- flexDirection: "row",
22
- flexGrow: 0,
23
- paddingTop: tokens["space-smaller"],
24
- minHeight: 0,
25
- minWidth: "100%",
26
- paddingRight: tokens["space-small"],
27
- },
28
- ]),
6
+ container: Object.assign(Object.assign({}, commonInputStyles.container), { flexDirection: "column", justifyContent: "center", minHeight: tokens["space-largest"] + tokens["space-small"], marginVertical: 0, borderWidth: 0, backgroundColor: "transparent" }),
7
+ input: Object.assign(Object.assign({}, commonInputStyles.input), { flexDirection: "row", flexGrow: 0, paddingTop: tokens["space-smaller"], minHeight: 0, minWidth: "100%", paddingRight: tokens["space-small"] }),
29
8
  value: {
30
9
  flexGrow: 1,
31
10
  flexShrink: 1,
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { I18nManager, StyleSheet, Text } from "react-native";
2
+ import { I18nManager, Text } from "react-native";
3
3
  import { TypographyGestureDetector } from "./TypographyGestureDetector";
4
4
  import { useTypographyStyles } from "./Typography.style";
5
5
  import { capitalize } from "../utils/intl";
@@ -114,7 +114,7 @@ function getSizeAndHeightStyle(textSize, styles, lineHeightOverwrite) {
114
114
  const fontSize = styles[`${textSize}Size`];
115
115
  if (lineHeightOverwrite) {
116
116
  const lineHeight = styles[`${lineHeightOverwrite}LineHeight`];
117
- return StyleSheet.flatten([fontSize, lineHeight]);
117
+ return Object.assign(Object.assign({}, fontSize), lineHeight);
118
118
  }
119
119
  return fontSize;
120
120
  }
@@ -95,12 +95,8 @@ function SelectPrimitiveContent(_a) {
95
95
  // provider): `Content` renders at the portal host, which may sit outside one.
96
96
  const safeAreaInsets = (_b = React.useContext(SafeAreaInsetsContext)) !== null && _b !== void 0 ? _b : undefined;
97
97
  const { triggerPosition } = Primitive.useRootContext();
98
- return (React.createElement(Primitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, insets: insets !== null && insets !== void 0 ? insets : safeAreaInsets, style: StyleSheet.flatten([
99
- styles.content,
100
- isDarkTheme && styles.contentDarkElevated,
101
- triggerPosition ? { width: triggerPosition.width } : undefined,
102
- style,
103
- ]) }, props), children));
98
+ const contentStyle = Object.assign(Object.assign(Object.assign(Object.assign({}, styles.content), (isDarkTheme ? styles.contentDarkElevated : {})), (triggerPosition ? { width: triggerPosition.width } : {})), style);
99
+ return (React.createElement(Primitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, insets: insets !== null && insets !== void 0 ? insets : safeAreaInsets, style: contentStyle }, props), children));
104
100
  }
105
101
  /** Scroll container for the items (a no-op passthrough on native). */
106
102
  function SelectPrimitiveViewport(_a) {
@@ -0,0 +1 @@
1
+ export {};