@jobber/components-native 0.116.2 → 0.116.3

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 +5 -5
  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 +5 -5
  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
@@ -1,4 +1,4 @@
1
- import type { Ref, SyntheticEvent } from "react";
1
+ import type { ComponentRef, Ref, SyntheticEvent } from "react";
2
2
  import React, {
3
3
  forwardRef,
4
4
  useEffect,
@@ -244,7 +244,10 @@ interface InputTextStyleOverride extends InputFieldStyleOverride {
244
244
  inputText?: StyleProp<TextStyle>;
245
245
  }
246
246
 
247
- export type InputTextRef = Pick<TextInput, "clear" | "focus" | "blur">;
247
+ export type InputTextRef = Pick<
248
+ ComponentRef<typeof TextInput>,
249
+ "clear" | "focus" | "blur"
250
+ >;
248
251
  export const InputText = forwardRef(InputTextInternal);
249
252
 
250
253
  // eslint-disable-next-line max-statements
@@ -468,7 +471,7 @@ function InputTextInternal(
468
471
  field.onBlur();
469
472
  trimWhitespace(inputTransform(field.value), updateFormAndState);
470
473
  }}
471
- ref={(instance: TextInput) => {
474
+ ref={(instance: ComponentRef<typeof TextInput> | null) => {
472
475
  // RHF wants us to do it this way
473
476
  // https://react-hook-form.com/faqs#Howtosharerefusage
474
477
  textInputRef.current = instance;
@@ -508,10 +511,7 @@ function InputTextInternal(
508
511
  const currentFocusedInput =
509
512
  currentlyFocusedInput !== null
510
513
  ? findNodeHandle(
511
- // @ts-expect-error - TextInput.State.currentlyFocusedInput() returns NativeMethods
512
- // which is not directly assignable to findNodeHandle's expected type,
513
- // but it works at runtime. This is a known type limitation in React Native.
514
- currentlyFocusedInput,
514
+ currentlyFocusedInput as ComponentRef<typeof TextInput>,
515
515
  )
516
516
  : null;
517
517
 
@@ -576,7 +576,7 @@ interface UseTextInputRefProps {
576
576
  }
577
577
 
578
578
  function useTextInputRef({ ref, onClear }: UseTextInputRefProps) {
579
- const textInputRef = useRef<TextInput | null>(null);
579
+ const textInputRef = useRef<ComponentRef<typeof TextInput> | null>(null);
580
580
 
581
581
  useImperativeHandle(
582
582
  ref,
@@ -1,9 +1,15 @@
1
- import { PlatformColor } from "react-native";
1
+ import { PlatformColor, type ViewStyle } from "react-native";
2
2
  import { buildThemedStyles } from "../../AtlantisThemeContext";
3
3
 
4
4
  const BAR_HEIGHT = 44;
5
5
 
6
- export const useStyles = buildThemedStyles(tokens => {
6
+ interface Styles {
7
+ container: ViewStyle;
8
+ lightTheme: ViewStyle;
9
+ darkTheme: ViewStyle;
10
+ }
11
+
12
+ export const useStyles: () => Styles = buildThemedStyles(tokens => {
7
13
  return {
8
14
  container: {
9
15
  flexDirection: "row",
@@ -1,34 +1,40 @@
1
- import { StyleSheet } from "react-native";
1
+ import type { TextStyle, ViewStyle } from "react-native";
2
2
  import { getCommonInputStyles } from "../InputFieldWrapper";
3
3
  import { buildThemedStyles } from "../AtlantisThemeContext";
4
4
 
5
- export const useStyles = buildThemedStyles(tokens => {
5
+ interface Styles {
6
+ container: ViewStyle;
7
+ input: ViewStyle;
8
+ value: ViewStyle;
9
+ icon: ViewStyle;
10
+ invalid: TextStyle;
11
+ errorMessageWrapperIcon: ViewStyle;
12
+ messageWrapper: ViewStyle;
13
+ }
14
+
15
+ export const useStyles: () => Styles = buildThemedStyles(tokens => {
6
16
  const commonInputStyles = getCommonInputStyles(tokens);
7
17
 
8
18
  return {
9
- container: StyleSheet.flatten([
10
- commonInputStyles.container,
11
- {
12
- flexDirection: "column",
13
- justifyContent: "center",
14
- minHeight: tokens["space-largest"] + tokens["space-small"],
15
- marginVertical: 0,
16
- borderWidth: 0,
17
- backgroundColor: "transparent",
18
- },
19
- ]),
20
-
21
- input: StyleSheet.flatten([
22
- commonInputStyles.input,
23
- {
24
- flexDirection: "row",
25
- flexGrow: 0,
26
- paddingTop: tokens["space-smaller"],
27
- minHeight: 0,
28
- minWidth: "100%",
29
- paddingRight: tokens["space-small"],
30
- },
31
- ]),
19
+ container: {
20
+ ...commonInputStyles.container,
21
+ flexDirection: "column",
22
+ justifyContent: "center",
23
+ minHeight: tokens["space-largest"] + tokens["space-small"],
24
+ marginVertical: 0,
25
+ borderWidth: 0,
26
+ backgroundColor: "transparent",
27
+ },
28
+
29
+ input: {
30
+ ...commonInputStyles.input,
31
+ flexDirection: "row",
32
+ flexGrow: 0,
33
+ paddingTop: tokens["space-smaller"],
34
+ minHeight: 0,
35
+ minWidth: "100%",
36
+ paddingRight: tokens["space-small"],
37
+ },
32
38
 
33
39
  value: {
34
40
  flexGrow: 1,
@@ -625,4 +625,5 @@ export const typographyStyles: Record<string, TextStyle> = StyleSheet.create(
625
625
  getTypographyStyles(staticTokens),
626
626
  );
627
627
 
628
- export const useTypographyStyles = buildThemedStyles(getTypographyStyles);
628
+ export const useTypographyStyles: () => ReturnType<typeof getTypographyStyles> =
629
+ buildThemedStyles(getTypographyStyles);
@@ -6,7 +6,7 @@ import type {
6
6
  TextStyle,
7
7
  ViewStyle,
8
8
  } from "react-native";
9
- import { I18nManager, StyleSheet, Text } from "react-native";
9
+ import { I18nManager, Text } from "react-native";
10
10
  import { TypographyGestureDetector } from "./TypographyGestureDetector";
11
11
  import { useTypographyStyles } from "./Typography.style";
12
12
  import { capitalize } from "../utils/intl";
@@ -332,7 +332,7 @@ function getSizeAndHeightStyle(
332
332
  if (lineHeightOverwrite) {
333
333
  const lineHeight = styles[`${lineHeightOverwrite}LineHeight`];
334
334
 
335
- return StyleSheet.flatten([fontSize, lineHeight]);
335
+ return { ...fontSize, ...lineHeight };
336
336
  }
337
337
 
338
338
  return fontSize;
@@ -163,18 +163,19 @@ function SelectPrimitiveContent({
163
163
  // provider): `Content` renders at the portal host, which may sit outside one.
164
164
  const safeAreaInsets = React.useContext(SafeAreaInsetsContext) ?? undefined;
165
165
  const { triggerPosition } = Primitive.useRootContext();
166
+ const contentStyle: SelectPrimitiveContentProps["style"] = {
167
+ ...styles.content,
168
+ ...(isDarkTheme ? styles.contentDarkElevated : {}),
169
+ ...(triggerPosition ? { width: triggerPosition.width } : {}),
170
+ ...style,
171
+ };
166
172
 
167
173
  return (
168
174
  <Primitive.Content
169
175
  ref={ref}
170
176
  sideOffset={sideOffset}
171
177
  insets={insets ?? safeAreaInsets}
172
- style={StyleSheet.flatten([
173
- styles.content,
174
- isDarkTheme && styles.contentDarkElevated,
175
- triggerPosition ? { width: triggerPosition.width } : undefined,
176
- style,
177
- ])}
178
+ style={contentStyle}
178
179
  {...props}
179
180
  >
180
181
  {children}
@@ -0,0 +1,4 @@
1
+ import type { ComponentRef } from "react";
2
+ import type { View } from "react-native";
3
+
4
+ export type ViewRef = ComponentRef<typeof View>;