@jobber/components-native 0.9.0 → 0.11.0

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 (66) hide show
  1. package/dist/src/Button/Button.js +78 -0
  2. package/dist/src/Button/Button.style.js +92 -0
  3. package/dist/src/Button/components/InternalButtonLoading/InternalButtonLoading.js +36 -0
  4. package/dist/src/Button/components/InternalButtonLoading/InternalButtonLoading.style.js +4 -0
  5. package/dist/src/Button/components/InternalButtonLoading/index.js +1 -0
  6. package/dist/src/Button/index.js +1 -0
  7. package/dist/src/Button/types.js +1 -0
  8. package/dist/src/InputFieldWrapper/CommonInputStyles.style.js +33 -0
  9. package/dist/src/InputFieldWrapper/InputFieldWrapper.js +88 -0
  10. package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +79 -0
  11. package/dist/src/InputFieldWrapper/components/ClearAction/ClearAction.js +12 -0
  12. package/dist/src/InputFieldWrapper/components/ClearAction/ClearAction.style.js +25 -0
  13. package/dist/src/InputFieldWrapper/components/ClearAction/index.js +2 -0
  14. package/dist/src/InputFieldWrapper/components/ClearAction/messages.js +8 -0
  15. package/dist/src/InputFieldWrapper/components/Prefix/Prefix.js +34 -0
  16. package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +35 -0
  17. package/dist/src/InputFieldWrapper/hooks/useShowClear.js +15 -0
  18. package/dist/src/InputFieldWrapper/index.js +3 -0
  19. package/dist/src/index.js +2 -0
  20. package/dist/tsconfig.tsbuildinfo +1 -1
  21. package/dist/types/src/Button/Button.d.ts +71 -0
  22. package/dist/types/src/Button/Button.style.d.ts +86 -0
  23. package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.d.ts +11 -0
  24. package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.style.d.ts +4 -0
  25. package/dist/types/src/Button/components/InternalButtonLoading/index.d.ts +1 -0
  26. package/dist/types/src/Button/index.d.ts +2 -0
  27. package/dist/types/src/Button/types.d.ts +3 -0
  28. package/dist/types/src/InputFieldWrapper/CommonInputStyles.style.d.ts +30 -0
  29. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.d.ts +63 -0
  30. package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +82 -0
  31. package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.d.ts +10 -0
  32. package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.style.d.ts +22 -0
  33. package/dist/types/src/InputFieldWrapper/components/ClearAction/index.d.ts +2 -0
  34. package/dist/types/src/InputFieldWrapper/components/ClearAction/messages.d.ts +7 -0
  35. package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +23 -0
  36. package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +25 -0
  37. package/dist/types/src/InputFieldWrapper/hooks/useShowClear.d.ts +10 -0
  38. package/dist/types/src/InputFieldWrapper/index.d.ts +4 -0
  39. package/dist/types/src/index.d.ts +2 -0
  40. package/package.json +5 -2
  41. package/src/Button/Button.style.ts +116 -0
  42. package/src/Button/Button.test.tsx +298 -0
  43. package/src/Button/Button.tsx +223 -0
  44. package/src/Button/components/InternalButtonLoading/InternalButtonLoading.style.ts +5 -0
  45. package/src/Button/components/InternalButtonLoading/InternalButtonLoading.test.tsx +39 -0
  46. package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +77 -0
  47. package/src/Button/components/InternalButtonLoading/index.ts +1 -0
  48. package/src/Button/index.ts +2 -0
  49. package/src/Button/types.ts +3 -0
  50. package/src/InputFieldWrapper/CommonInputStyles.style.ts +37 -0
  51. package/src/InputFieldWrapper/InputFieldWrapper.style.ts +93 -0
  52. package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +243 -0
  53. package/src/InputFieldWrapper/InputFieldWrapper.tsx +317 -0
  54. package/src/InputFieldWrapper/components/ClearAction/ClearAction.style.ts +27 -0
  55. package/src/InputFieldWrapper/components/ClearAction/ClearAction.test.tsx +15 -0
  56. package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +32 -0
  57. package/src/InputFieldWrapper/components/ClearAction/index.ts +2 -0
  58. package/src/InputFieldWrapper/components/ClearAction/messages.ts +9 -0
  59. package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +221 -0
  60. package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +104 -0
  61. package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +101 -0
  62. package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +113 -0
  63. package/src/InputFieldWrapper/hooks/useShowClear.test.ts +158 -0
  64. package/src/InputFieldWrapper/hooks/useShowClear.ts +31 -0
  65. package/src/InputFieldWrapper/index.ts +4 -0
  66. package/src/index.ts +2 -0
@@ -0,0 +1,71 @@
1
+ /// <reference types="react" />
2
+ import { IconNames } from "@jobber/design";
3
+ import { XOR } from "ts-xor";
4
+ import { ButtonSize, ButtonType, ButtonVariation } from "./types";
5
+ interface CommonButtonProps {
6
+ /**
7
+ * Press handler
8
+ */
9
+ readonly onPress?: () => void;
10
+ /**
11
+ * Themes the button to the type of action it performs
12
+ */
13
+ readonly variation?: ButtonVariation;
14
+ /**
15
+ * Sets the visual hierarchy
16
+ */
17
+ readonly type?: ButtonType;
18
+ /**
19
+ * Defines the size of the button
20
+ *
21
+ * @default "base"
22
+ */
23
+ readonly size?: ButtonSize;
24
+ /**
25
+ * Will make the button scale to take up all the available height
26
+ */
27
+ readonly fullHeight?: boolean;
28
+ /**
29
+ * Will make the button scale to take up all of the available width
30
+ */
31
+ readonly fullWidth?: boolean;
32
+ /**
33
+ * Makes the button un-clickable
34
+ */
35
+ readonly disabled?: boolean;
36
+ /**
37
+ * Accessibility hint to help users understand what will happen when they press the button
38
+ */
39
+ readonly accessibilityHint?: string;
40
+ /**
41
+ * Changes the button interface to imply loading and prevents the press callback
42
+ *
43
+ * @default false
44
+ */
45
+ readonly loading?: boolean;
46
+ /**
47
+ * Adds an leading icon beside the label.
48
+ */
49
+ readonly icon?: IconNames;
50
+ /**
51
+ * Accessibility label for the component. This is required for components that
52
+ * have an `icon` but not a `label`.
53
+ *
54
+ * If the string is the same as the `label` prop, you don't need to add an
55
+ * `accessibilityLabel`. **Don't use this for testing purposes.**
56
+ */
57
+ readonly accessibilityLabel?: string;
58
+ }
59
+ interface LabelButton extends CommonButtonProps {
60
+ /**
61
+ * Text to be displayed on the button
62
+ */
63
+ readonly label: string;
64
+ }
65
+ interface IconButton extends CommonButtonProps {
66
+ readonly icon: IconNames;
67
+ readonly accessibilityLabel: string;
68
+ }
69
+ export type ButtonProps = XOR<LabelButton, IconButton>;
70
+ export declare function Button({ label, onPress, variation, type, fullHeight, fullWidth, disabled, loading, size, accessibilityLabel, accessibilityHint, icon, }: ButtonProps): JSX.Element;
71
+ export {};
@@ -0,0 +1,86 @@
1
+ export declare const baseButtonHeight: number;
2
+ export declare const smallButtonHeight: number;
3
+ export declare const styles: {
4
+ fullHeight: {
5
+ flexGrow: number;
6
+ flexShrink: number;
7
+ };
8
+ fullWidth: {
9
+ alignSelf: "stretch";
10
+ };
11
+ touchable: {
12
+ borderRadius: number;
13
+ };
14
+ button: {
15
+ justifyContent: "center";
16
+ alignItems: "center";
17
+ alignSelf: "stretch";
18
+ flexDirection: "row";
19
+ overflow: "hidden";
20
+ margin: number;
21
+ borderRadius: number;
22
+ borderWidth: number;
23
+ paddingVertical: number;
24
+ };
25
+ base: {
26
+ minHeight: number;
27
+ paddingHorizontal: number;
28
+ };
29
+ small: {
30
+ minHeight: number;
31
+ paddingHorizontal: number;
32
+ };
33
+ reducedPaddingForFullWidth: {
34
+ paddingHorizontal: number;
35
+ };
36
+ iconPaddingOffset: {
37
+ paddingRight: number;
38
+ };
39
+ content: {
40
+ paddingLeft: number;
41
+ height: string;
42
+ };
43
+ contentWithLabel: {
44
+ paddingLeft: number;
45
+ };
46
+ iconStyle: {
47
+ position: "absolute";
48
+ top: string;
49
+ left: number;
50
+ transform: {
51
+ translateY: number;
52
+ }[];
53
+ };
54
+ labelStyle: {
55
+ flexGrow: number;
56
+ justifyContent: "center";
57
+ };
58
+ work: {
59
+ backgroundColor: string;
60
+ borderColor: string;
61
+ };
62
+ learning: {
63
+ backgroundColor: string;
64
+ borderColor: string;
65
+ };
66
+ destructive: {
67
+ backgroundColor: string;
68
+ borderColor: string;
69
+ };
70
+ cancel: {
71
+ backgroundColor: string;
72
+ borderColor: string;
73
+ };
74
+ primary: {};
75
+ secondary: {
76
+ backgroundColor: string;
77
+ };
78
+ tertiary: {
79
+ backgroundColor: string;
80
+ borderColor: string;
81
+ };
82
+ disabled: {
83
+ borderColor: string;
84
+ backgroundColor: string;
85
+ };
86
+ };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { ButtonType, ButtonVariation } from "../../types";
3
+ interface InternalButtonLoadingProps {
4
+ readonly variation: ButtonVariation;
5
+ readonly type: ButtonType;
6
+ }
7
+ declare function InternalButtonLoadingInternal({ variation, type, }: InternalButtonLoadingProps): JSX.Element;
8
+ export declare const darkPattern = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAgMAAACf9p+rAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4AUWWMWAAAAAMUExURQAAAEdwTAAAAAAAAKDh18UAAAAEdFJOUxkADQwimkzpAAAAtUlEQVRIx+3NqxHDQBRDUc0YuxyXokxgSkmT7sdgP++3YoYrqAsOYDto+7gfpwtfHy4Xfj7cLvw3sYlNbOINAoI4IIgTgrggiBuCIAThQyB8CIQLkXAhEi5EwoVIWEiEhURYSISFRMyQiRkyMUMmZsjECIUYoRAjFGKEQvRQiR4q0UMleqhECwuihQXRwoJoYUEQgiAEQQiCEAQhCEIQhCAIQRCCIARBCIIQBCEIQhCEIAhB8AEuzZ5wHe17xgAAAABJRU5ErkJggg==";
9
+ export declare const lightPattern = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgAgMAAACf9p+rAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4AUWWMWAAAAAJUExURf///0dwTP///0SistEAAAADdFJOU0AAILGCadYAAAC0SURBVEjH7c2pFcNAFENRHTMX4pKUE5hS0oT7NZjlbyNmOIJ64AK2g7aP+3G68PXhcuHnw+3CfxOb2MQm3iAgiAOCOCGIC4K4IQhCED4EwodAuBAJFyLhQiRciISFRFhIhIVEWEjEDJmYIRMzZGKGTIxQiBEKMUIhRihED5XooRI9VKKHSrSwIFpYEC0siBYWBCEIQhCEIAhBEIIgBEEIghAEIQhCEIQgCEEQgiAEQQiCEAQfva6WeBniVLgAAAAASUVORK5CYII=";
10
+ export declare const InternalButtonLoading: React.MemoExoticComponent<typeof InternalButtonLoadingInternal>;
11
+ export {};
@@ -0,0 +1,4 @@
1
+ import { StyleSheet } from "react-native";
2
+ export declare const styles: {
3
+ image: StyleSheet.AbsoluteFillStyle;
4
+ };
@@ -0,0 +1 @@
1
+ export { InternalButtonLoading } from "./InternalButtonLoading";
@@ -0,0 +1,2 @@
1
+ export { Button } from "./Button";
2
+ export type { ButtonVariation, ButtonType } from "./types";
@@ -0,0 +1,3 @@
1
+ export type ButtonVariation = "work" | "cancel" | "destructive" | "learning";
2
+ export type ButtonType = "primary" | "secondary" | "tertiary";
3
+ export type ButtonSize = "small" | "base";
@@ -0,0 +1,30 @@
1
+ export declare const commonInputStyles: {
2
+ input: {
3
+ width: string;
4
+ flexShrink: number;
5
+ flexGrow: number;
6
+ color: string;
7
+ fontFamily: string | undefined;
8
+ fontSize: number | undefined;
9
+ letterSpacing: number | undefined;
10
+ minHeight: number;
11
+ padding: number;
12
+ };
13
+ inputEmpty: {
14
+ paddingTop: number;
15
+ };
16
+ inputDisabled: {
17
+ color: import("react-native").ColorValue | undefined;
18
+ };
19
+ container: {
20
+ marginVertical: number;
21
+ backgroundColor: string;
22
+ minHeight: number;
23
+ flexDirection: "row";
24
+ justifyContent: "space-between";
25
+ width: string;
26
+ borderColor: string;
27
+ borderStyle: "solid";
28
+ borderBottomWidth: number;
29
+ };
30
+ };
@@ -0,0 +1,63 @@
1
+ import React from "react";
2
+ import { StyleProp, TextStyle, ViewStyle } from "react-native";
3
+ import { FieldError } from "react-hook-form";
4
+ import { IconNames } from "@jobber/design";
5
+ export type Clearable = "never" | "while-editing" | "always";
6
+ export interface InputFieldStyleOverride {
7
+ prefixLabel?: StyleProp<TextStyle>;
8
+ suffixLabel?: StyleProp<TextStyle>;
9
+ container?: StyleProp<ViewStyle>;
10
+ placeholderText?: StyleProp<TextStyle>;
11
+ }
12
+ export interface InputFieldWrapperProps {
13
+ /**
14
+ * Highlights the field red and shows message below (if string) to indicate an error
15
+ */
16
+ readonly invalid?: boolean | string;
17
+ /**
18
+ * Disable the input
19
+ */
20
+ readonly disabled?: boolean;
21
+ /**
22
+ * Hint text that goes above the value once the field is filled out
23
+ */
24
+ readonly placeholder?: string;
25
+ /**
26
+ * Text that goes below the input to help the user understand the input
27
+ */
28
+ readonly assistiveText?: string;
29
+ readonly hasMiniLabel?: boolean;
30
+ readonly hasValue?: boolean;
31
+ /**
32
+ * Symbol to display before the text input
33
+ */
34
+ readonly prefix?: {
35
+ icon?: IconNames;
36
+ label?: string;
37
+ };
38
+ /**
39
+ * Symbol to display after the text input
40
+ */
41
+ readonly suffix?: {
42
+ icon?: IconNames;
43
+ label?: string;
44
+ onPress?: () => void;
45
+ };
46
+ readonly error?: FieldError;
47
+ readonly focused?: boolean;
48
+ readonly children: React.ReactNode;
49
+ /**
50
+ * Adds the ClearAction that will call the onClear handler when pressed
51
+ */
52
+ readonly showClearAction?: boolean;
53
+ /**
54
+ * Callback called when the user clicks the ClearAction button. Should clear the value passed.
55
+ * To disallow clearing set the clearable prop to never
56
+ */
57
+ readonly onClear?: () => void;
58
+ /**
59
+ * Custom styling to override default style of the input field
60
+ */
61
+ readonly styleOverride?: InputFieldStyleOverride;
62
+ }
63
+ export declare function InputFieldWrapper({ invalid, disabled, placeholder, assistiveText, prefix, suffix, hasMiniLabel, hasValue, error, focused, children, onClear, showClearAction, styleOverride, }: InputFieldWrapperProps): JSX.Element;
@@ -0,0 +1,82 @@
1
+ export declare const styles: {
2
+ container: {
3
+ marginVertical: number;
4
+ backgroundColor: string;
5
+ minHeight: number;
6
+ flexDirection: "row";
7
+ justifyContent: "space-between";
8
+ width: string;
9
+ borderColor: string;
10
+ borderStyle: "solid";
11
+ borderBottomWidth: number;
12
+ };
13
+ inputContainer: {
14
+ flexDirection: "row";
15
+ flex: number;
16
+ justifyContent: "flex-start";
17
+ };
18
+ inputFocused: {
19
+ borderColor: string;
20
+ };
21
+ inputInvalid: {
22
+ borderColor: string;
23
+ };
24
+ label: {
25
+ position: "absolute";
26
+ top: number | undefined;
27
+ right: number;
28
+ bottom: number;
29
+ left: number;
30
+ };
31
+ miniLabel: {
32
+ top: number;
33
+ paddingTop: number;
34
+ backgroundColor: string;
35
+ maxHeight: number;
36
+ zIndex: number;
37
+ };
38
+ miniLabelShowClearAction: {
39
+ backgroundColor: string;
40
+ };
41
+ disabled: {
42
+ backgroundColor: string;
43
+ borderTopLeftRadius: number;
44
+ borderTopRightRadius: number;
45
+ };
46
+ fieldAffix: {
47
+ flexDirection: "row";
48
+ };
49
+ fieldAffixMiniLabel: {
50
+ paddingTop: number;
51
+ top: number;
52
+ right: number;
53
+ bottom: number;
54
+ left: number;
55
+ };
56
+ prefixIcon: {
57
+ justifyContent: "center";
58
+ paddingRight: number;
59
+ };
60
+ prefixLabel: {
61
+ justifyContent: "center";
62
+ paddingTop: number;
63
+ paddingRight: number;
64
+ };
65
+ suffixIcon: {
66
+ justifyContent: "center";
67
+ };
68
+ suffixLabel: {
69
+ justifyContent: "center";
70
+ paddingTop: number;
71
+ };
72
+ suffixIconMargin: {
73
+ marginLeft: number;
74
+ };
75
+ suffixLabelMargin: {
76
+ marginLeft: number;
77
+ };
78
+ inputEndContainer: {
79
+ flexDirection: "row";
80
+ zIndex: number;
81
+ };
82
+ };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ interface ClearActionProps {
3
+ /**
4
+ * Press handler
5
+ */
6
+ readonly onPress: () => void;
7
+ readonly hasMarginRight?: boolean;
8
+ }
9
+ export declare function ClearAction({ onPress, hasMarginRight, }: ClearActionProps): JSX.Element;
10
+ export {};
@@ -0,0 +1,22 @@
1
+ export declare const styles: {
2
+ container: {
3
+ width: number;
4
+ height: string;
5
+ flexDirection: "row";
6
+ justifyContent: "center";
7
+ alignItems: "center";
8
+ alignSelf: "center";
9
+ };
10
+ circle: {
11
+ backgroundColor: string;
12
+ borderRadius: number;
13
+ width: number;
14
+ height: number;
15
+ flexDirection: "row";
16
+ justifyContent: "center";
17
+ alignItems: "center";
18
+ };
19
+ addedMargin: {
20
+ marginRight: number;
21
+ };
22
+ };
@@ -0,0 +1,2 @@
1
+ export { ClearAction } from "./ClearAction";
2
+ export { messages } from "./messages";
@@ -0,0 +1,7 @@
1
+ export declare const messages: {
2
+ clearTextLabel: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ };
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, TextStyle, ViewStyle } from "react-native";
3
+ import { IconNames } from "@jobber/design";
4
+ export interface PrefixLabelProps {
5
+ focused: boolean;
6
+ disabled?: boolean;
7
+ hasMiniLabel: boolean;
8
+ inputInvalid: boolean;
9
+ label: string;
10
+ styleOverride?: StyleProp<TextStyle>;
11
+ }
12
+ export declare const prefixLabelTestId = "ATL-InputFieldWrapper-PrefixLabel";
13
+ export declare const prefixIconTestId = "ATL-InputFieldWrapper-PrefixIcon";
14
+ export declare function PrefixLabel({ focused, disabled, hasMiniLabel, inputInvalid, label, styleOverride, }: PrefixLabelProps): JSX.Element;
15
+ export interface PrefixIconProps {
16
+ focused: boolean;
17
+ disabled?: boolean;
18
+ hasMiniLabel: boolean;
19
+ inputInvalid?: boolean;
20
+ icon: IconNames;
21
+ styleOverride?: StyleProp<ViewStyle>;
22
+ }
23
+ export declare function PrefixIcon({ focused, disabled, inputInvalid, icon, }: PrefixIconProps): JSX.Element;
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, TextStyle } from "react-native";
3
+ import { IconNames } from "@jobber/design";
4
+ export interface SuffixLabelProps {
5
+ focused: boolean;
6
+ disabled?: boolean;
7
+ hasMiniLabel: boolean;
8
+ inputInvalid?: boolean;
9
+ label: string;
10
+ hasLeftMargin?: boolean;
11
+ styleOverride?: StyleProp<TextStyle>;
12
+ }
13
+ export declare const suffixLabelTestId = "ATL-InputFieldWrapper-SuffixLabel";
14
+ export declare const suffixIconTestId = "ATL-InputFieldWrapper-SuffixIcon";
15
+ export declare function SuffixLabel({ focused, disabled, hasMiniLabel, inputInvalid, label, hasLeftMargin, styleOverride, }: SuffixLabelProps): JSX.Element;
16
+ export interface SuffixIconProps {
17
+ focused: boolean;
18
+ disabled?: boolean;
19
+ hasMiniLabel: boolean;
20
+ inputInvalid?: boolean;
21
+ icon: IconNames;
22
+ hasLeftMargin?: boolean;
23
+ onPress?: () => void;
24
+ }
25
+ export declare function SuffixIcon({ focused, disabled, inputInvalid, icon, hasLeftMargin, onPress, }: SuffixIconProps): JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { Clearable } from "../InputFieldWrapper";
2
+ interface UseShowClearParameters {
3
+ clearable: Clearable;
4
+ multiline: boolean;
5
+ focused: boolean;
6
+ hasValue: boolean;
7
+ disabled?: boolean;
8
+ }
9
+ export declare function useShowClear({ clearable, multiline, focused, hasValue, disabled, }: UseShowClearParameters): boolean | undefined;
10
+ export {};
@@ -0,0 +1,4 @@
1
+ export { commonInputStyles } from "./CommonInputStyles.style";
2
+ export { InputFieldWrapper } from "./InputFieldWrapper";
3
+ export type { InputFieldWrapperProps, Clearable } from "./InputFieldWrapper";
4
+ export { useShowClear } from "./hooks/useShowClear";
@@ -9,3 +9,5 @@ export * from "./ActivityIndicator";
9
9
  export * from "./Card";
10
10
  export * from "./StatusLabel";
11
11
  export * from "./AtlantisContext";
12
+ export * from "./Button";
13
+ export * from "./InputFieldWrapper";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/src/index.js",
@@ -22,8 +22,11 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@jobber/design": "^0.39.0",
25
+ "react-hook-form": "^7.30.0",
26
+ "react-intl": "^6.4.2",
25
27
  "react-native-gesture-handler": "^2.5.0",
26
28
  "react-native-localize": "^2.2.6",
29
+ "react-native-reanimated": "^2.17.0",
27
30
  "react-native-svg": "^13.9.0",
28
31
  "react-native-uuid": "^1.4.9",
29
32
  "ts-xor": "^1.1.0"
@@ -44,5 +47,5 @@
44
47
  "react": "^18",
45
48
  "react-native": ">=0.69.2"
46
49
  },
47
- "gitHead": "f884bf403f42a1c85f7bf840a6317ae1642653e1"
50
+ "gitHead": "91380d5821e334f130fcf7a02290b25548fa05e2"
48
51
  }
@@ -0,0 +1,116 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { tokens } from "../utils/design";
3
+
4
+ const iconTranslateY = tokens["space-large"] / 2;
5
+ const buttonRadius = tokens["radius-large"];
6
+ export const baseButtonHeight = tokens["space-base"] * 3.5;
7
+ export const smallButtonHeight = tokens["space-base"] * 2.25;
8
+
9
+ export const styles = StyleSheet.create({
10
+ fullHeight: {
11
+ flexGrow: 1,
12
+ flexShrink: 0,
13
+ },
14
+
15
+ fullWidth: {
16
+ alignSelf: "stretch",
17
+ },
18
+
19
+ touchable: {
20
+ borderRadius: buttonRadius,
21
+ },
22
+
23
+ button: {
24
+ justifyContent: "center",
25
+ alignItems: "center",
26
+ alignSelf: "stretch",
27
+ flexDirection: "row",
28
+ overflow: "hidden",
29
+ margin: 0,
30
+ borderRadius: buttonRadius,
31
+ borderWidth: tokens["border-base"],
32
+ paddingVertical: tokens["space-small"],
33
+ },
34
+
35
+ base: {
36
+ minHeight: baseButtonHeight,
37
+ paddingHorizontal: tokens["space-base"],
38
+ },
39
+
40
+ small: {
41
+ minHeight: smallButtonHeight,
42
+ paddingHorizontal: tokens["space-small"] + tokens["space-smaller"],
43
+ },
44
+
45
+ reducedPaddingForFullWidth: {
46
+ paddingHorizontal: tokens["space-smaller"],
47
+ },
48
+
49
+ iconPaddingOffset: {
50
+ paddingRight: tokens["space-smaller"],
51
+ },
52
+
53
+ content: {
54
+ paddingLeft: tokens["space-large"],
55
+ height: "100%",
56
+ },
57
+
58
+ contentWithLabel: {
59
+ paddingLeft: tokens["space-large"] + tokens["space-small"],
60
+ },
61
+
62
+ iconStyle: {
63
+ position: "absolute",
64
+ top: "50%",
65
+ left: 0,
66
+ transform: [{ translateY: -iconTranslateY }],
67
+ },
68
+
69
+ labelStyle: {
70
+ flexGrow: 1,
71
+ justifyContent: "center",
72
+ },
73
+
74
+ /* Variations */
75
+
76
+ work: {
77
+ backgroundColor: tokens["color-interactive"],
78
+ borderColor: tokens["color-interactive"],
79
+ },
80
+
81
+ learning: {
82
+ backgroundColor: tokens["color-informative"],
83
+ borderColor: tokens["color-informative"],
84
+ },
85
+
86
+ destructive: {
87
+ backgroundColor: tokens["color-destructive"],
88
+ borderColor: tokens["color-destructive"],
89
+ },
90
+
91
+ /* Cancel is special because, by default, it's styled as a secondary button */
92
+ cancel: {
93
+ backgroundColor: tokens["color-surface"],
94
+ borderColor: tokens["color-interactive--subtle"],
95
+ },
96
+
97
+ /* Types */
98
+
99
+ primary: {},
100
+
101
+ secondary: {
102
+ backgroundColor: tokens["color-surface"],
103
+ },
104
+
105
+ tertiary: {
106
+ backgroundColor: tokens["color-surface"],
107
+ borderColor: tokens["color-surface"],
108
+ },
109
+
110
+ /* Disabled */
111
+
112
+ disabled: {
113
+ borderColor: tokens["color-disabled--secondary"],
114
+ backgroundColor: tokens["color-disabled--secondary"],
115
+ },
116
+ });