@jobber/components-native 0.56.2 → 0.57.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.
- package/dist/package.json +4 -4
- package/dist/src/Button/Button.js +2 -2
- package/dist/src/Button/Button.style.js +2 -2
- package/dist/src/Card/Card.js +7 -8
- package/dist/src/InputCurrency/InputCurrency.js +16 -17
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +1 -1
- package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +6 -6
- package/dist/types/src/Checkbox/CheckboxGroup.d.ts +2 -2
- package/dist/types/src/Form/components/FormBody/FormBody.d.ts +3 -3
- package/dist/types/src/Form/components/FormCache/FormCache.d.ts +4 -4
- package/dist/types/src/Form/components/FormMessageBanner/FormMessageBanner.d.ts +1 -1
- package/dist/types/src/FormField/FormField.d.ts +2 -2
- package/dist/types/src/FormatFile/FormatFile.d.ts +6 -6
- package/dist/types/src/FormatFile/components/FileView/FileView.d.ts +6 -6
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +4 -4
- package/dist/types/src/FormatFile/components/MediaView/MediaView.d.ts +6 -6
- package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.d.ts +3 -3
- package/dist/types/src/InputCurrency/InputCurrency.d.ts +3 -3
- package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +12 -12
- package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +14 -14
- package/dist/types/src/InputPassword/InputPassword.d.ts +1 -1
- package/dist/types/src/InputText/context/InputAccessoriesProvider.d.ts +1 -1
- package/dist/types/src/Toast/Toast.d.ts +1 -1
- package/dist/types/src/utils/test/MockSafeAreaProvider.d.ts +3 -3
- package/jestSetup.js +2 -0
- package/package.json +4 -4
- package/src/ActionItem/ActionItem.tsx +2 -0
- package/src/ActionItem/ActionItemGroup.tsx +1 -0
- package/src/AutoLink/hooks/useCreateLinkedText.ts +1 -0
- package/src/AutoLink/hooks/useTokenGenerator.ts +1 -0
- package/src/BottomSheet/BottomSheet.tsx +3 -3
- package/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.tsx +3 -1
- package/src/Button/Button.style.ts +2 -2
- package/src/Button/Button.test.tsx +2 -2
- package/src/Button/Button.tsx +2 -2
- package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +1 -0
- package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +7 -6
- package/src/Card/Card.tsx +31 -32
- package/src/Card/components/InternalCardHeader.tsx +1 -0
- package/src/Checkbox/CheckboxGroup.tsx +12 -2
- package/src/Chip/Chip.tsx +2 -0
- package/src/Content/Content.test.tsx +1 -0
- package/src/Content/Content.tsx +1 -0
- package/src/ContentOverlay/ContentOverlay.test.tsx +1 -0
- package/src/Divider/Divider.tsx +1 -0
- package/src/EmptyState/EmptyState.tsx +2 -2
- package/src/Flex/Flex.styles.tsx +1 -0
- package/src/Flex/Flex.test.tsx +2 -0
- package/src/Form/Form.test.tsx +19 -14
- package/src/Form/components/FormBody/FormBody.tsx +4 -3
- package/src/Form/components/FormCache/FormCache.tsx +5 -4
- package/src/Form/components/FormMessage/FormMessage.tsx +1 -0
- package/src/Form/components/FormMessageBanner/FormMessageBanner.tsx +1 -1
- package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +5 -5
- package/src/Form/context/AtlantisFormContext.tsx +1 -0
- package/src/Form/hooks/useFormViewRefs.ts +1 -0
- package/src/Form/hooks/useOfflineHandler.ts +1 -0
- package/src/Form/hooks/useScrollToError/useScrollToError.ts +2 -0
- package/src/FormField/FormField.test.tsx +6 -8
- package/src/FormField/FormField.tsx +2 -2
- package/src/FormatFile/FormatFile.tsx +15 -14
- package/src/FormatFile/components/FileView/FileView.tsx +9 -6
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +4 -4
- package/src/FormatFile/components/MediaView/MediaView.tsx +15 -14
- package/src/FormatFile/components/ProgressBar/ProgressBar.tsx +3 -3
- package/src/FormatFile/utils/createUseCreateThumbnail.ts +1 -0
- package/src/Icon/Icon.tsx +1 -0
- package/src/InputCurrency/InputCurrency.tsx +40 -38
- package/src/InputCurrency/utils.ts +9 -0
- package/src/InputDate/InputDate.test.tsx +1 -0
- package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +1 -0
- package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +12 -12
- package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +14 -14
- package/src/InputNumber/InputNumber.tsx +8 -0
- package/src/InputPassword/InputPassword.test.tsx +1 -0
- package/src/InputPassword/InputPassword.tsx +2 -1
- package/src/InputPressable/InputPressable.test.tsx +1 -0
- package/src/InputSearch/InputSearch.tsx +1 -0
- package/src/InputText/context/InputAccessoriesProvider.test.tsx +6 -1
- package/src/InputText/context/InputAccessoriesProvider.tsx +1 -1
- package/src/InputTime/utils/index.ts +1 -0
- package/src/Menu/components/MenuOption/MenuOption.tsx +1 -0
- package/src/Menu/utils.ts +1 -0
- package/src/ProgressBar/ProgressBarInner.tsx +1 -0
- package/src/Select/components/SelectInternalPicker/SelectInternalPicker.tsx +1 -0
- package/src/Select/components/SelectInternalPicker/utils.ts +1 -0
- package/src/StatusLabel/StatusLabel.tsx +1 -1
- package/src/Switch/components/BaseSwitch/BaseSwitch.tsx +1 -0
- package/src/Text/Text.tsx +1 -0
- package/src/Toast/Toast.tsx +2 -1
- package/src/Typography/Typography.tsx +5 -0
- package/src/hooks/useAtlantisI18n/utils/dateFormatter.ts +1 -0
- package/src/hooks/useFormController.ts +2 -0
- package/src/utils/intl/capitalize.ts +1 -0
- package/src/utils/test/MockSafeAreaProvider.tsx +3 -3
|
@@ -8,6 +8,6 @@ export interface BottomSheetOptionProps {
|
|
|
8
8
|
readonly textAlign?: TextAlign;
|
|
9
9
|
readonly destructive?: boolean;
|
|
10
10
|
readonly textTransform?: "none" | "capitalize";
|
|
11
|
-
onPress: () => void;
|
|
11
|
+
readonly onPress: () => void;
|
|
12
12
|
}
|
|
13
13
|
export declare function BottomSheetOption({ text, icon, iconColor, textAlign, destructive, textTransform, onPress, }: BottomSheetOptionProps): JSX.Element;
|
package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { RefObject } from "react";
|
|
|
2
2
|
import { ButtonGroupSecondaryActionProps } from "../../types";
|
|
3
3
|
import { BottomSheetRef } from "../../../BottomSheet/BottomSheet";
|
|
4
4
|
interface SecondaryActionSheetProps {
|
|
5
|
-
actions: ButtonGroupSecondaryActionProps[];
|
|
6
|
-
secondaryActionsRef: RefObject<BottomSheetRef>;
|
|
7
|
-
showCancel?: boolean;
|
|
8
|
-
heading?: string;
|
|
9
|
-
onOpenBottomSheet?: () => void;
|
|
10
|
-
onCloseBottomSheet?: () => void;
|
|
5
|
+
readonly actions: ButtonGroupSecondaryActionProps[];
|
|
6
|
+
readonly secondaryActionsRef: RefObject<BottomSheetRef>;
|
|
7
|
+
readonly showCancel?: boolean;
|
|
8
|
+
readonly heading?: string;
|
|
9
|
+
readonly onOpenBottomSheet?: () => void;
|
|
10
|
+
readonly onCloseBottomSheet?: () => void;
|
|
11
11
|
}
|
|
12
12
|
export declare function SecondaryActionSheet({ actions, secondaryActionsRef, heading, showCancel, onOpenBottomSheet, onCloseBottomSheet, }: SecondaryActionSheetProps): JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -6,8 +6,8 @@ interface CommonCheckboxGroupProps extends Omit<CheckboxProps, "onChange"> {
|
|
|
6
6
|
/**
|
|
7
7
|
* Checkbox items
|
|
8
8
|
*/
|
|
9
|
-
children: CheckboxElement[];
|
|
10
|
-
state?: CheckboxGroupState;
|
|
9
|
+
readonly children: CheckboxElement[];
|
|
10
|
+
readonly state?: CheckboxGroupState;
|
|
11
11
|
onChange?(groupChecks: CheckboxGroupState): void;
|
|
12
12
|
}
|
|
13
13
|
interface ControlledCheckboxGroupProps extends CommonCheckboxGroupProps {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormActionBarProps } from "../FormActionBar";
|
|
3
3
|
interface FormBodyProps extends FormActionBarProps {
|
|
4
|
-
children: JSX.Element;
|
|
5
|
-
shouldRenderActionBar?: boolean;
|
|
6
|
-
saveButtonOffset?: number;
|
|
4
|
+
readonly children: JSX.Element;
|
|
5
|
+
readonly shouldRenderActionBar?: boolean;
|
|
6
|
+
readonly saveButtonOffset?: number;
|
|
7
7
|
}
|
|
8
8
|
export declare function FormBody({ isFormSubmitting, submit, keyboardHeight, children, saveButtonLabel, renderStickySection, shouldRenderActionBar, secondaryActions, setSecondaryActionLoading, setSaveButtonHeight, saveButtonOffset, }: FormBodyProps): JSX.Element;
|
|
9
9
|
export declare function useBottomPadding(): number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FieldValues } from "react-hook-form";
|
|
3
3
|
interface FormCacheProps<T extends FieldValues> {
|
|
4
|
-
localCacheId?: string | string[];
|
|
5
|
-
localCacheKey?: string;
|
|
6
|
-
localCacheExclude?: string[];
|
|
7
|
-
setLocalCache: (data: T) => void;
|
|
4
|
+
readonly localCacheId?: string | string[];
|
|
5
|
+
readonly localCacheKey?: string;
|
|
6
|
+
readonly localCacheExclude?: string[];
|
|
7
|
+
readonly setLocalCache: (data: T) => void;
|
|
8
8
|
}
|
|
9
9
|
export declare function FormCache<T extends FieldValues>({ localCacheExclude, localCacheKey, setLocalCache, }: FormCacheProps<T>): JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormBannerMessage } from "../../types";
|
|
3
3
|
interface FormMessageBannerProps {
|
|
4
|
-
bannerMessages?: FormBannerMessage[];
|
|
4
|
+
readonly bannerMessages?: FormBannerMessage[];
|
|
5
5
|
}
|
|
6
6
|
export declare function FormMessageBanner({ bannerMessages, }: FormMessageBannerProps): JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -4,7 +4,7 @@ interface FormFieldProps<T> {
|
|
|
4
4
|
/**
|
|
5
5
|
* Name of the field.
|
|
6
6
|
*/
|
|
7
|
-
name: string;
|
|
7
|
+
readonly name: string;
|
|
8
8
|
/**
|
|
9
9
|
* The initial value of the form field.
|
|
10
10
|
*/
|
|
@@ -12,7 +12,7 @@ interface FormFieldProps<T> {
|
|
|
12
12
|
/**
|
|
13
13
|
* Children to render.
|
|
14
14
|
*/
|
|
15
|
-
children: (field: ControllerRenderProps<FieldValues, string>, error?: FieldError) => React.ReactNode;
|
|
15
|
+
readonly children: (field: ControllerRenderProps<FieldValues, string>, error?: FieldError) => React.ReactNode;
|
|
16
16
|
/**
|
|
17
17
|
* Rules for returning an error when validations are violated.
|
|
18
18
|
* WARNING: This component needs to be nested inside a FormProvider
|
|
@@ -5,7 +5,7 @@ export interface FormatFileProps<T> {
|
|
|
5
5
|
/**
|
|
6
6
|
* File upload details object. Can be a File or a FileUpload
|
|
7
7
|
*/
|
|
8
|
-
file: T;
|
|
8
|
+
readonly file: T;
|
|
9
9
|
/**
|
|
10
10
|
* Accessibility label
|
|
11
11
|
*/
|
|
@@ -17,23 +17,23 @@ export interface FormatFileProps<T> {
|
|
|
17
17
|
/**
|
|
18
18
|
* A function which handles the onTap event.
|
|
19
19
|
*/
|
|
20
|
-
onTap?: (file: T) => void;
|
|
20
|
+
readonly onTap?: (file: T) => void;
|
|
21
21
|
/**
|
|
22
22
|
* A function to be called on "Remove" Bottom Sheet Option press
|
|
23
23
|
*/
|
|
24
|
-
onRemove?: () => void;
|
|
24
|
+
readonly onRemove?: () => void;
|
|
25
25
|
/**
|
|
26
26
|
* Handler for the "Preview" Bottom Sheet Option press
|
|
27
27
|
*/
|
|
28
|
-
onPreviewPress?: (formattedFile: FormattedFile) => void;
|
|
28
|
+
readonly onPreviewPress?: (formattedFile: FormattedFile) => void;
|
|
29
29
|
/**
|
|
30
30
|
* A file type to show at Bottom Sheet options
|
|
31
31
|
*/
|
|
32
|
-
bottomSheetOptionsSuffix?: BottomSheetOptionsSuffix;
|
|
32
|
+
readonly bottomSheetOptionsSuffix?: BottomSheetOptionsSuffix;
|
|
33
33
|
/**
|
|
34
34
|
* Uses a grid layout when multi-file upload is supported
|
|
35
35
|
*/
|
|
36
|
-
styleInGrid?: boolean;
|
|
36
|
+
readonly styleInGrid?: boolean;
|
|
37
37
|
/**
|
|
38
38
|
* A reference to the element in the rendered output
|
|
39
39
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormattedFile } from "../../types";
|
|
3
3
|
interface FileViewProps {
|
|
4
|
-
accessibilityLabel?: string;
|
|
5
|
-
showOverlay: boolean;
|
|
6
|
-
showError: boolean;
|
|
7
|
-
file: FormattedFile;
|
|
8
|
-
styleInGrid: boolean;
|
|
9
|
-
onUploadComplete: () => void;
|
|
4
|
+
readonly accessibilityLabel?: string;
|
|
5
|
+
readonly showOverlay: boolean;
|
|
6
|
+
readonly showError: boolean;
|
|
7
|
+
readonly file: FormattedFile;
|
|
8
|
+
readonly styleInGrid: boolean;
|
|
9
|
+
readonly onUploadComplete: () => void;
|
|
10
10
|
}
|
|
11
11
|
export declare function FileView({ accessibilityLabel, styleInGrid, file, showOverlay, showError, onUploadComplete, }: FileViewProps): JSX.Element;
|
|
12
12
|
export {};
|
package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { RefObject } from "react";
|
|
|
2
2
|
import { BottomSheetRef } from "../../../BottomSheet/BottomSheet";
|
|
3
3
|
export type BottomSheetOptionsSuffix = "receipt" | "image" | "file" | "video";
|
|
4
4
|
interface FormatFileBottomSheetProps {
|
|
5
|
-
bottomSheetRef: RefObject<BottomSheetRef>;
|
|
6
|
-
onPreviewPress?: () => void;
|
|
7
|
-
onRemovePress?: () => void;
|
|
8
|
-
bottomSheetOptionsSuffix?: BottomSheetOptionsSuffix;
|
|
5
|
+
readonly bottomSheetRef: RefObject<BottomSheetRef>;
|
|
6
|
+
readonly onPreviewPress?: () => void;
|
|
7
|
+
readonly onRemovePress?: () => void;
|
|
8
|
+
readonly bottomSheetOptionsSuffix?: BottomSheetOptionsSuffix;
|
|
9
9
|
}
|
|
10
10
|
export declare const FormatFileBottomSheet: ({ bottomSheetRef, onPreviewPress, onRemovePress, bottomSheetOptionsSuffix, }: FormatFileBottomSheetProps) => JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormattedFile } from "../../types";
|
|
3
3
|
interface MediaViewProps {
|
|
4
|
-
accessibilityLabel?: string;
|
|
5
|
-
showOverlay: boolean;
|
|
6
|
-
showError: boolean;
|
|
7
|
-
file: FormattedFile;
|
|
8
|
-
styleInGrid: boolean;
|
|
9
|
-
onUploadComplete: () => void;
|
|
4
|
+
readonly accessibilityLabel?: string;
|
|
5
|
+
readonly showOverlay: boolean;
|
|
6
|
+
readonly showError: boolean;
|
|
7
|
+
readonly file: FormattedFile;
|
|
8
|
+
readonly styleInGrid: boolean;
|
|
9
|
+
readonly onUploadComplete: () => void;
|
|
10
10
|
}
|
|
11
11
|
export declare function MediaView({ accessibilityLabel, showOverlay, showError, file, styleInGrid, onUploadComplete, }: MediaViewProps): JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -5,15 +5,15 @@ interface ProgressBarProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* Upload progress value from 0 to 1
|
|
7
7
|
*/
|
|
8
|
-
progress: number;
|
|
8
|
+
readonly progress: number;
|
|
9
9
|
/**
|
|
10
10
|
* Upload status
|
|
11
11
|
*/
|
|
12
|
-
status: StatusCode;
|
|
12
|
+
readonly status: StatusCode;
|
|
13
13
|
/**
|
|
14
14
|
* Function to be called when the progress is finished
|
|
15
15
|
*/
|
|
16
|
-
onComplete?: () => void;
|
|
16
|
+
readonly onComplete?: () => void;
|
|
17
17
|
}
|
|
18
18
|
export declare const ProgressBar: ({ progress, status, onComplete, }: ProgressBarProps) => JSX.Element;
|
|
19
19
|
export {};
|
|
@@ -24,9 +24,9 @@ export interface InputCurrencyProps extends Omit<InputTextProps, "keyboard" | "o
|
|
|
24
24
|
*/
|
|
25
25
|
readonly maxLength?: number;
|
|
26
26
|
onChange?(newValue?: number | string | undefined): void;
|
|
27
|
-
value?: number;
|
|
28
|
-
defaultValue?: number;
|
|
29
|
-
keyboard?: "decimal-pad" | "numbers-and-punctuation";
|
|
27
|
+
readonly value?: number;
|
|
28
|
+
readonly defaultValue?: number;
|
|
29
|
+
readonly keyboard?: "decimal-pad" | "numbers-and-punctuation";
|
|
30
30
|
}
|
|
31
31
|
export declare const getInternalValue: (props: InputCurrencyProps, field: ControllerRenderProps<FieldValues, string>, formatNumber: (value: number, opts?: FormatNumberOptions | undefined) => string) => string;
|
|
32
32
|
export declare function InputCurrency(props: InputCurrencyProps): JSX.Element;
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
3
3
|
import { IconNames } from "@jobber/design";
|
|
4
4
|
export interface PrefixLabelProps {
|
|
5
|
-
focused: boolean;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
hasMiniLabel: boolean;
|
|
8
|
-
inputInvalid: boolean;
|
|
9
|
-
label: string;
|
|
10
|
-
styleOverride?: StyleProp<TextStyle>;
|
|
5
|
+
readonly focused: boolean;
|
|
6
|
+
readonly disabled?: boolean;
|
|
7
|
+
readonly hasMiniLabel: boolean;
|
|
8
|
+
readonly inputInvalid: boolean;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly styleOverride?: StyleProp<TextStyle>;
|
|
11
11
|
}
|
|
12
12
|
export declare const prefixLabelTestId = "ATL-InputFieldWrapper-PrefixLabel";
|
|
13
13
|
export declare const prefixIconTestId = "ATL-InputFieldWrapper-PrefixIcon";
|
|
14
14
|
export declare function PrefixLabel({ focused, disabled, hasMiniLabel, inputInvalid, label, styleOverride, }: PrefixLabelProps): JSX.Element;
|
|
15
15
|
export interface PrefixIconProps {
|
|
16
|
-
focused: boolean;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
hasMiniLabel: boolean;
|
|
19
|
-
inputInvalid?: boolean;
|
|
20
|
-
icon: IconNames;
|
|
21
|
-
styleOverride?: StyleProp<ViewStyle>;
|
|
16
|
+
readonly focused: boolean;
|
|
17
|
+
readonly disabled?: boolean;
|
|
18
|
+
readonly hasMiniLabel: boolean;
|
|
19
|
+
readonly inputInvalid?: boolean;
|
|
20
|
+
readonly icon: IconNames;
|
|
21
|
+
readonly styleOverride?: StyleProp<ViewStyle>;
|
|
22
22
|
}
|
|
23
23
|
export declare function PrefixIcon({ focused, disabled, inputInvalid, icon, }: PrefixIconProps): JSX.Element;
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
import { StyleProp, TextStyle } from "react-native";
|
|
3
3
|
import { IconNames } from "@jobber/design";
|
|
4
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>;
|
|
5
|
+
readonly focused: boolean;
|
|
6
|
+
readonly disabled?: boolean;
|
|
7
|
+
readonly hasMiniLabel: boolean;
|
|
8
|
+
readonly inputInvalid?: boolean;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly hasLeftMargin?: boolean;
|
|
11
|
+
readonly styleOverride?: StyleProp<TextStyle>;
|
|
12
12
|
}
|
|
13
13
|
export declare const suffixLabelTestId = "ATL-InputFieldWrapper-SuffixLabel";
|
|
14
14
|
export declare const suffixIconTestId = "ATL-InputFieldWrapper-SuffixIcon";
|
|
15
15
|
export declare function SuffixLabel({ focused, disabled, hasMiniLabel, inputInvalid, label, hasLeftMargin, styleOverride, }: SuffixLabelProps): JSX.Element;
|
|
16
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;
|
|
17
|
+
readonly focused: boolean;
|
|
18
|
+
readonly disabled?: boolean;
|
|
19
|
+
readonly hasMiniLabel: boolean;
|
|
20
|
+
readonly inputInvalid?: boolean;
|
|
21
|
+
readonly icon: IconNames;
|
|
22
|
+
readonly hasLeftMargin?: boolean;
|
|
23
|
+
readonly onPress?: () => void;
|
|
24
24
|
}
|
|
25
25
|
export declare function SuffixIcon({ focused, disabled, inputInvalid, icon, hasLeftMargin, onPress, }: SuffixIconProps): JSX.Element;
|
|
@@ -6,7 +6,7 @@ export interface JobberToastProps {
|
|
|
6
6
|
* Has effect only when the position is "bottom".
|
|
7
7
|
* @default 40
|
|
8
8
|
*/
|
|
9
|
-
bottomOffset?: number;
|
|
9
|
+
readonly bottomOffset?: number;
|
|
10
10
|
}
|
|
11
11
|
export declare function JobberToast({ bottomOffset }: JobberToastProps): JSX.Element;
|
|
12
12
|
export interface ShowToastParams {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { EdgeInsets, Rect } from "react-native-safe-area-context";
|
|
3
3
|
interface MockSafeAreaProviderProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
frame?: Rect;
|
|
6
|
-
insets?: EdgeInsets;
|
|
4
|
+
readonly children: React.ReactNode;
|
|
5
|
+
readonly frame?: Rect;
|
|
6
|
+
readonly insets?: EdgeInsets;
|
|
7
7
|
}
|
|
8
8
|
export declare function MockSafeAreaProvider({ frame, insets, children, }: MockSafeAreaProviderProps): JSX.Element;
|
|
9
9
|
export {};
|
package/jestSetup.js
CHANGED
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
jest.mock("./dist/src/hooks", () => {
|
|
4
4
|
const actualHooks = jest.requireActual("./dist/src/hooks");
|
|
5
|
+
|
|
5
6
|
return { ...actualHooks, useIsScreenReaderEnabled: () => false };
|
|
6
7
|
});
|
|
7
8
|
|
|
@@ -18,6 +19,7 @@ jest.mock("./dist/src/Button/components/InternalButtonLoading", () => {
|
|
|
18
19
|
jest.mock("react-native-reanimated", () => {
|
|
19
20
|
const reanimated = require("react-native-reanimated/mock");
|
|
20
21
|
const timing = () => ({ start: () => undefined });
|
|
22
|
+
|
|
21
23
|
return {
|
|
22
24
|
...reanimated,
|
|
23
25
|
default: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.57.0",
|
|
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.55.
|
|
40
|
-
"@jobber/hooks": "^2.9.
|
|
39
|
+
"@jobber/design": "^0.55.1",
|
|
40
|
+
"@jobber/hooks": "^2.9.1",
|
|
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": "
|
|
87
|
+
"gitHead": "0efee497cd920eccd458d96cbb17e9cc67e3cc6b"
|
|
88
88
|
}
|
|
@@ -116,6 +116,7 @@ function getActionIconColour(
|
|
|
116
116
|
if (actionIconColour === "subtle") {
|
|
117
117
|
return "interactiveSubtle";
|
|
118
118
|
}
|
|
119
|
+
|
|
119
120
|
return actionIconColour;
|
|
120
121
|
}
|
|
121
122
|
|
|
@@ -127,5 +128,6 @@ function getActionIcon(icon: ActionIconNames): IconNames {
|
|
|
127
128
|
} else if (icon === "editpencil") {
|
|
128
129
|
return "edit";
|
|
129
130
|
}
|
|
131
|
+
|
|
130
132
|
return icon;
|
|
131
133
|
}
|
|
@@ -4,6 +4,7 @@ import { v1 } from "react-native-uuid";
|
|
|
4
4
|
export function useTokenGenerator(): [() => string, RegExp] {
|
|
5
5
|
let counter = 0;
|
|
6
6
|
const [identifier] = useState(v1());
|
|
7
|
+
|
|
7
8
|
return [
|
|
8
9
|
() => `@__ELEMENT-${identifier}-${counter++}__@`,
|
|
9
10
|
new RegExp(`(@__ELEMENT-${identifier}-\\d+__@)`, "g"),
|
|
@@ -101,7 +101,7 @@ function BottomSheetInternal(
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function Header({ heading }: { heading: string }) {
|
|
104
|
+
function Header({ heading }: { readonly heading: string }) {
|
|
105
105
|
return (
|
|
106
106
|
<View style={styles.header}>
|
|
107
107
|
<Heading level={"subtitle"}>{heading}</Heading>
|
|
@@ -113,8 +113,8 @@ function Footer({
|
|
|
113
113
|
cancellable,
|
|
114
114
|
onCancel,
|
|
115
115
|
}: {
|
|
116
|
-
cancellable: boolean;
|
|
117
|
-
onCancel: () => void;
|
|
116
|
+
readonly cancellable: boolean;
|
|
117
|
+
readonly onCancel: () => void;
|
|
118
118
|
}) {
|
|
119
119
|
const insets = useSafeAreaInsets();
|
|
120
120
|
const { t } = useAtlantisI18n();
|
|
@@ -14,8 +14,9 @@ export interface BottomSheetOptionProps {
|
|
|
14
14
|
readonly textAlign?: TextAlign;
|
|
15
15
|
readonly destructive?: boolean;
|
|
16
16
|
readonly textTransform?: "none" | "capitalize";
|
|
17
|
-
onPress: () => void;
|
|
17
|
+
readonly onPress: () => void;
|
|
18
18
|
}
|
|
19
|
+
|
|
19
20
|
export function BottomSheetOption({
|
|
20
21
|
text,
|
|
21
22
|
icon,
|
|
@@ -27,6 +28,7 @@ export function BottomSheetOption({
|
|
|
27
28
|
}: BottomSheetOptionProps): JSX.Element {
|
|
28
29
|
const destructiveColor = "critical";
|
|
29
30
|
const textVariation = destructive ? destructiveColor : "subdued";
|
|
31
|
+
|
|
30
32
|
return (
|
|
31
33
|
<TouchableOpacity
|
|
32
34
|
style={styles.bottomSheetOption}
|
|
@@ -79,8 +79,8 @@ export const styles = StyleSheet.create({
|
|
|
79
79
|
},
|
|
80
80
|
|
|
81
81
|
learning: {
|
|
82
|
-
backgroundColor: tokens["color-
|
|
83
|
-
borderColor: tokens["color-
|
|
82
|
+
backgroundColor: tokens["color-interactive--subtle"],
|
|
83
|
+
borderColor: tokens["color-interactive--subtle"],
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
destructive: {
|
|
@@ -78,7 +78,7 @@ describe("Button", () => {
|
|
|
78
78
|
},
|
|
79
79
|
],
|
|
80
80
|
["destructive", { bgColor: tokens["color-destructive"] }],
|
|
81
|
-
["learning", { bgColor: tokens["color-
|
|
81
|
+
["learning", { bgColor: tokens["color-interactive--subtle"] }],
|
|
82
82
|
])("renders a %s Button", (variation, { bgColor, borderColor }) => {
|
|
83
83
|
const { buttonStyle } = renderButton(
|
|
84
84
|
<Button label={variation} variation={variation} onPress={jest.fn()} />,
|
|
@@ -218,7 +218,7 @@ describe("Button", () => {
|
|
|
218
218
|
variation: "learning",
|
|
219
219
|
type: "secondary",
|
|
220
220
|
});
|
|
221
|
-
expect(iconColor).toBe(tokens["color-
|
|
221
|
+
expect(iconColor).toBe(tokens["color-interactive--subtle"]);
|
|
222
222
|
expect(textColor).toBe(iconColor);
|
|
223
223
|
});
|
|
224
224
|
|
package/src/Button/Button.tsx
CHANGED
|
@@ -179,7 +179,7 @@ function getActionLabelVariation(
|
|
|
179
179
|
|
|
180
180
|
switch (variation) {
|
|
181
181
|
case "learning":
|
|
182
|
-
return "
|
|
182
|
+
return "subtle";
|
|
183
183
|
case "destructive":
|
|
184
184
|
return "destructive";
|
|
185
185
|
case "cancel":
|
|
@@ -204,7 +204,7 @@ function getIconColorVariation(
|
|
|
204
204
|
|
|
205
205
|
switch (variation) {
|
|
206
206
|
case "learning":
|
|
207
|
-
return "
|
|
207
|
+
return "interactiveSubtle";
|
|
208
208
|
case "destructive":
|
|
209
209
|
return "destructive";
|
|
210
210
|
case "cancel":
|
|
@@ -6,12 +6,12 @@ import { BottomSheetOption } from "../../../BottomSheet/components/BottomSheetOp
|
|
|
6
6
|
import { BottomSheet, BottomSheetRef } from "../../../BottomSheet/BottomSheet";
|
|
7
7
|
|
|
8
8
|
interface SecondaryActionSheetProps {
|
|
9
|
-
actions: ButtonGroupSecondaryActionProps[];
|
|
10
|
-
secondaryActionsRef: RefObject<BottomSheetRef>;
|
|
11
|
-
showCancel?: boolean;
|
|
12
|
-
heading?: string;
|
|
13
|
-
onOpenBottomSheet?: () => void;
|
|
14
|
-
onCloseBottomSheet?: () => void;
|
|
9
|
+
readonly actions: ButtonGroupSecondaryActionProps[];
|
|
10
|
+
readonly secondaryActionsRef: RefObject<BottomSheetRef>;
|
|
11
|
+
readonly showCancel?: boolean;
|
|
12
|
+
readonly heading?: string;
|
|
13
|
+
readonly onOpenBottomSheet?: () => void;
|
|
14
|
+
readonly onCloseBottomSheet?: () => void;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function SecondaryActionSheet({
|
|
@@ -34,6 +34,7 @@ export function SecondaryActionSheet({
|
|
|
34
34
|
<View>
|
|
35
35
|
{actions.map((action, index) => {
|
|
36
36
|
const { label, onPress, icon, iconColor, destructive } = action;
|
|
37
|
+
|
|
37
38
|
return (
|
|
38
39
|
<BottomSheetOption
|
|
39
40
|
destructive={destructive}
|
package/src/Card/Card.tsx
CHANGED
|
@@ -65,6 +65,7 @@ function getElevationStyle(elevation: elevationProp) {
|
|
|
65
65
|
if (elevation === "none") {
|
|
66
66
|
return undefined;
|
|
67
67
|
}
|
|
68
|
+
|
|
68
69
|
return styles[`${elevation}Elevation`];
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -85,39 +86,37 @@ export function Card({
|
|
|
85
86
|
testID={testID}
|
|
86
87
|
>
|
|
87
88
|
{header && (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
>
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)}
|
|
89
|
+
<InternalCardHeader
|
|
90
|
+
onPress={header.onPress}
|
|
91
|
+
testID={`${testID}Header`}
|
|
92
|
+
collapsable={!!children}
|
|
93
|
+
>
|
|
94
|
+
<View style={styles.headerTitle}>
|
|
95
|
+
<Typography
|
|
96
|
+
color="heading"
|
|
97
|
+
fontFamily="base"
|
|
98
|
+
fontWeight="bold"
|
|
99
|
+
size="default"
|
|
100
|
+
lineHeight="base"
|
|
101
|
+
accessibilityRole="header"
|
|
102
|
+
>
|
|
103
|
+
{header.title}
|
|
104
|
+
</Typography>
|
|
105
|
+
</View>
|
|
106
|
+
<View style={styles.actionItem}>
|
|
107
|
+
{!!header.actionItem?.label && (
|
|
108
|
+
<View style={styles.actionLabel}>
|
|
109
|
+
<ActionLabel type="cardTitle">
|
|
110
|
+
{header.actionItem.label}
|
|
111
|
+
</ActionLabel>
|
|
112
|
+
</View>
|
|
113
|
+
)}
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
</>
|
|
115
|
+
{header.actionItem?.iconName && (
|
|
116
|
+
<Icon name={header.actionItem.iconName} color="interactive" />
|
|
117
|
+
)}
|
|
118
|
+
</View>
|
|
119
|
+
</InternalCardHeader>
|
|
121
120
|
)}
|
|
122
121
|
{children}
|
|
123
122
|
{footer && (
|