@jobber/components-native 0.46.4 → 0.46.6-update-hov.20

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 (39) hide show
  1. package/dist/package.json +4 -4
  2. package/dist/src/Button/Button.js +8 -2
  3. package/dist/src/ButtonGroup/ButtonGroup.js +2 -2
  4. package/dist/src/Form/components/FormSaveButton/FormSaveButton.js +8 -9
  5. package/dist/src/InputEmail/InputEmail.js +9 -0
  6. package/dist/src/InputEmail/index.js +1 -0
  7. package/dist/src/Select/Select.js +8 -2
  8. package/dist/src/index.js +1 -0
  9. package/dist/tsconfig.tsbuildinfo +1 -1
  10. package/dist/types/src/Button/Button.d.ts +5 -1
  11. package/dist/types/src/InputEmail/InputEmail.d.ts +5 -0
  12. package/dist/types/src/InputEmail/index.d.ts +1 -0
  13. package/dist/types/src/Select/Select.d.ts +5 -1
  14. package/dist/types/src/index.d.ts +1 -0
  15. package/package.json +4 -4
  16. package/src/AtlantisContext/AtlantisContext.test.tsx +1 -3
  17. package/src/Button/Button.tsx +20 -1
  18. package/src/Button/components/InternalButtonLoading/InternalButtonLoading.test.tsx +1 -3
  19. package/src/ButtonGroup/ButtonGroup.tsx +3 -0
  20. package/src/Checkbox/CheckboxGroup.test.tsx +3 -5
  21. package/src/Divider/Divider.test.tsx +1 -3
  22. package/src/Form/components/FormErrorBanner/FormErrorBanner.test.tsx +3 -4
  23. package/src/Form/components/FormSaveButton/FormSaveButton.tsx +29 -30
  24. package/src/Heading/__snapshots__/Heading.test.tsx.snap +1 -1
  25. package/src/InputEmail/InputEmail.test.tsx +25 -0
  26. package/src/InputEmail/InputEmail.tsx +25 -0
  27. package/src/InputEmail/index.ts +1 -0
  28. package/src/InputSearch/InputSearch.test.tsx +1 -7
  29. package/src/InputTime/InputTime.test.tsx +2 -7
  30. package/src/ProgressBar/__snapshots__/ProgressBar.test.tsx.snap +2 -2
  31. package/src/Select/Select.test.tsx +141 -173
  32. package/src/Select/Select.tsx +18 -1
  33. package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.test.tsx +2 -2
  34. package/src/Select/components/SelectInternalPicker/SelectInternalPicker.test.tsx +1 -2
  35. package/src/StatusLabel/__snapshots__/StatusLabel.test.tsx.snap +7 -7
  36. package/src/Switch/components/BaseSwitch/__snapshots__/BaseSwitch.test.tsx.snap +12 -12
  37. package/src/Text/__snapshots__/Text.test.tsx.snap +1 -1
  38. package/src/ThumbnailList/__snapshots__/ThumbnailList.test.tsx.snap +2 -2
  39. package/src/index.ts +1 -0
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.46.4",
3
+ "version": "0.46.6-update-hov.20+0990ce83",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -36,8 +36,8 @@
36
36
  "build:clean": "rm -rf ./dist"
37
37
  },
38
38
  "dependencies": {
39
- "@jobber/design": "^0.44.4",
40
- "@jobber/hooks": "^2.3.0",
39
+ "@jobber/design": "^0.47.0",
40
+ "@jobber/hooks": "^2.7.0",
41
41
  "@react-native-clipboard/clipboard": "^1.11.2",
42
42
  "@react-native-picker/picker": "^2.4.10",
43
43
  "autolinker": "^4.0.0",
@@ -84,5 +84,5 @@
84
84
  "react-native-reanimated": "^2.17.0",
85
85
  "react-native-safe-area-context": "^4.5.2"
86
86
  },
87
- "gitHead": "616c498cc1bfeedcc752700c6bcbc64f4f914350"
87
+ "gitHead": "0990ce83de1510164baf3e04368ef1c5b42cb21e"
88
88
  }
@@ -5,7 +5,7 @@ import { InternalButtonLoading } from "./components/InternalButtonLoading";
5
5
  import { ActionLabel } from "../ActionLabel";
6
6
  import { Icon } from "../Icon";
7
7
  import { tokens } from "../utils/design";
8
- export function Button({ label, onPress, variation = "work", type = "primary", fullHeight = false, fullWidth = true, disabled = false, loading = false, size = "base", accessibilityLabel, accessibilityHint, icon, }) {
8
+ export function Button({ label, onPress, variation = "work", type = "primary", fullHeight = false, fullWidth = true, disabled = false, loading = false, size = "base", accessibilityLabel, accessibilityHint, icon, testID, }) {
9
9
  const buttonStyle = [
10
10
  styles.button,
11
11
  styles[variation],
@@ -19,7 +19,7 @@ export function Button({ label, onPress, variation = "work", type = "primary", f
19
19
  // an InputText that was focused, it required two presses to activate the
20
20
  // Pressable. Using a TouchableHighlight made things register correctly
21
21
  // in a single press
22
- return (React.createElement(TouchableHighlight, { onPress: onPress, testID: accessibilityLabel || label, accessibilityLabel: accessibilityLabel || label, accessibilityHint: accessibilityHint, accessibilityRole: "button", accessibilityState: { disabled, busy: loading }, disabled: disabled || loading, underlayColor: tokens["color-greyBlue--dark"], activeOpacity: tokens["opacity-pressed"], style: [
22
+ return (React.createElement(TouchableHighlight, { onPress: onPress, testID: buildTestID(testID, label, accessibilityLabel), accessibilityLabel: accessibilityLabel || label, accessibilityHint: accessibilityHint, accessibilityRole: "button", accessibilityState: { disabled, busy: loading }, disabled: disabled || loading, underlayColor: tokens["color-greyBlue--dark"], activeOpacity: tokens["opacity-pressed"], style: [
23
23
  styles.touchable,
24
24
  fullWidth && styles.fullWidth,
25
25
  fullHeight && styles.fullHeight,
@@ -75,3 +75,9 @@ function getContentStyles(label, icon) {
75
75
  !!label && styles.contentWithLabel,
76
76
  ];
77
77
  }
78
+ function buildTestID(testID, label, accessibilityLabel) {
79
+ if (testID) {
80
+ return `ATL-${testID}-Button`;
81
+ }
82
+ return accessibilityLabel || label;
83
+ }
@@ -14,10 +14,10 @@ export function ButtonGroup({ children, showCancelInBottomSheet, bottomSheetHead
14
14
  return (React.createElement(View, { style: styles.buttonGroup },
15
15
  primaryActions.map((action, index) => {
16
16
  const { label, onPress, buttonType, buttonVariation, icon, customButton, loading, } = action.props;
17
- return (React.createElement(View, { style: styles.button, key: index }, customButton || (React.createElement(Button, { label: label, accessibilityLabel: label, onPress: allowTapWhenOffline ? onPress : handlePress(onPress), type: buttonType, variation: buttonVariation, fullHeight: true, icon: icon, loading: loading }))));
17
+ return (React.createElement(View, { style: styles.button, key: index }, customButton || (React.createElement(Button, { label: label, accessibilityLabel: label, onPress: allowTapWhenOffline ? onPress : handlePress(onPress), type: buttonType, variation: buttonVariation, fullHeight: true, icon: icon, loading: loading, testID: `ButtonGroup-Primary-Action-${index}` }))));
18
18
  }),
19
19
  secondaryActions.length > 0 && (React.createElement(View, { style: styles.moreButton },
20
- React.createElement(Button, { icon: "more", accessibilityLabel: t("more"), onPress: handlePress(openBottomSheet), fullHeight: true }))),
20
+ React.createElement(Button, { icon: "more", accessibilityLabel: t("more"), onPress: handlePress(openBottomSheet), fullHeight: true, testID: "ButtonGroup-Secondary-Action" }))),
21
21
  React.createElement(SecondaryActionSheet, { heading: bottomSheetHeading, showCancel: showCancelInBottomSheet, secondaryActionsRef: secondaryActionsRef, actions: secondaryActions.map(secondaryAction => secondaryAction.props), onOpenBottomSheet: onOpenBottomSheet, onCloseBottomSheet: onCloseBottomSheet })));
22
22
  function openBottomSheet() {
23
23
  var _a;
@@ -15,15 +15,14 @@ export function FormSaveButton({ primaryAction, loading, label, secondaryActions
15
15
  const { t } = useAtlantisI18n();
16
16
  const formContext = useFormContext();
17
17
  const buttonActions = useButtonGroupAction(secondaryActions);
18
- return (React.createElement(React.Fragment, null,
19
- React.createElement(ButtonGroup, { onOpenBottomSheet: onOpenBottomSheet, onCloseBottomSheet: onCloseBottomSheet, allowTapWhenOffline: true }, buttonActions.map((action, index) => {
20
- if (index === 0) {
21
- return (React.createElement(ButtonGroup.PrimaryAction, { key: index, onPress: primaryAction, label: label !== null && label !== void 0 ? label : t("save"), loading: loading }));
22
- }
23
- else {
24
- return (React.createElement(ButtonGroup.SecondaryAction, { key: index, label: action.label, icon: action.icon, onPress: action.onPress, destructive: action.destructive }));
25
- }
26
- }))));
18
+ return (React.createElement(ButtonGroup, { onOpenBottomSheet: onOpenBottomSheet, onCloseBottomSheet: onCloseBottomSheet, allowTapWhenOffline: true }, buttonActions.map((action, index) => {
19
+ if (index === 0) {
20
+ return (React.createElement(ButtonGroup.PrimaryAction, { key: index, onPress: primaryAction, label: label !== null && label !== void 0 ? label : t("save"), loading: loading }));
21
+ }
22
+ else {
23
+ return (React.createElement(ButtonGroup.SecondaryAction, { key: index, label: action.label, icon: action.icon, onPress: action.onPress, destructive: action.destructive }));
24
+ }
25
+ })));
27
26
  function useButtonGroupAction(array) {
28
27
  const buttonGroupActionProps = array
29
28
  ? array.map(arr => {
@@ -0,0 +1,9 @@
1
+ import React, { forwardRef } from "react";
2
+ import { InputText } from "../InputText";
3
+ export const InputEmail = forwardRef(InputEmailInternal);
4
+ function InputEmailInternal(props, ref) {
5
+ return (React.createElement(InputText, Object.assign({}, props, { ref: ref, autoCapitalize: "none", autoCorrect: false, keyboard: "email-address", validations: Object.assign({ pattern: {
6
+ value: /[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])?/,
7
+ message: "Enter a valid email address (email@example.com)",
8
+ } }, props.validations) })));
9
+ }
@@ -0,0 +1 @@
1
+ export { InputEmail } from "./InputEmail";
@@ -7,7 +7,7 @@ import { Icon } from "../Icon";
7
7
  import { Text } from "../Text";
8
8
  import { useFormController } from "../hooks";
9
9
  import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
10
- export function Select({ value, defaultValue, onChange, children, placeholder, label, assistiveText, disabled, invalid, validations, accessibilityLabel, name, }) {
10
+ export function Select({ value, defaultValue, onChange, children, placeholder, label, assistiveText, disabled, invalid, validations, accessibilityLabel, name, testID, }) {
11
11
  const { field, error } = useFormController({
12
12
  name,
13
13
  validations,
@@ -24,7 +24,7 @@ export function Select({ value, defaultValue, onChange, children, placeholder, l
24
24
  return (React.createElement(InputFieldWrapper, { error: error, invalid: invalid || !!error, hasValue: hasValue, styleOverride: {
25
25
  container: { borderBottomWidth: undefined },
26
26
  } },
27
- React.createElement(View, { testID: "ATL-Select", accessible: true, accessibilityLabel: getA11yLabel(), accessibilityValue: { text: getValue() }, accessibilityHint: t("Select.a11yHint"), accessibilityRole: "button", accessibilityState: { disabled: disabled } },
27
+ React.createElement(View, { testID: getTestID(testID), accessible: true, accessibilityLabel: getA11yLabel(), accessibilityValue: { text: getValue() }, accessibilityHint: t("Select.a11yHint"), accessibilityRole: "button", accessibilityState: { disabled: disabled } },
28
28
  React.createElement(SelectInternalPicker, { disabled: disabled, options: getOptions(), onChange: handleChange },
29
29
  React.createElement(View, { style: [styles.container, (invalid || !!error) && styles.invalid] },
30
30
  label && (React.createElement(Text, { level: "textSupporting", variation: textVariation, hideFromScreenReader: true }, label)),
@@ -73,6 +73,12 @@ function getTextVariation({ invalid, disabled, }) {
73
73
  return "disabled";
74
74
  return "subdued";
75
75
  }
76
+ function getTestID(testID) {
77
+ if (testID) {
78
+ return `ATL-${testID}-Select`;
79
+ }
80
+ return "ATL-Select";
81
+ }
76
82
  export function Option({ children }) {
77
83
  return React.createElement(React.Fragment, null, children);
78
84
  }
package/dist/src/index.js CHANGED
@@ -26,6 +26,7 @@ export * from "./IconButton";
26
26
  export * from "./InputFieldWrapper";
27
27
  export * from "./InputCurrency";
28
28
  export * from "./InputDate";
29
+ export * from "./InputEmail";
29
30
  export * from "./InputNumber";
30
31
  export * from "./InputPassword";
31
32
  export * from "./InputPressable";