@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
|
@@ -46,10 +46,11 @@ export interface InputCurrencyProps
|
|
|
46
46
|
readonly maxLength?: number;
|
|
47
47
|
|
|
48
48
|
onChange?(newValue?: number | string | undefined): void;
|
|
49
|
-
value?: number;
|
|
50
|
-
defaultValue?: number;
|
|
51
|
-
keyboard?: "decimal-pad" | "numbers-and-punctuation";
|
|
49
|
+
readonly value?: number;
|
|
50
|
+
readonly defaultValue?: number;
|
|
51
|
+
readonly keyboard?: "decimal-pad" | "numbers-and-punctuation";
|
|
52
52
|
}
|
|
53
|
+
|
|
53
54
|
export const getInternalValue = (
|
|
54
55
|
props: InputCurrencyProps,
|
|
55
56
|
field: ControllerRenderProps<FieldValues, string>,
|
|
@@ -59,6 +60,7 @@ export const getInternalValue = (
|
|
|
59
60
|
) => string,
|
|
60
61
|
): string => {
|
|
61
62
|
if (!props.value && !field.value) return "";
|
|
63
|
+
|
|
62
64
|
return (
|
|
63
65
|
props.value?.toString() ??
|
|
64
66
|
formatNumber(field.value, {
|
|
@@ -113,6 +115,7 @@ export function InputCurrency(props: InputCurrencyProps): JSX.Element {
|
|
|
113
115
|
decimalNumbers !== ""
|
|
114
116
|
? transformedValue.toString() + "." + decimalNumbers.slice(1)
|
|
115
117
|
: transformedValue.toString();
|
|
118
|
+
|
|
116
119
|
if (checkLastChar(stringValue)) {
|
|
117
120
|
const roundedDecimal = configureDecimal(
|
|
118
121
|
decimalCount,
|
|
@@ -167,40 +170,39 @@ export function InputCurrency(props: InputCurrencyProps): JSX.Element {
|
|
|
167
170
|
const { t } = useAtlantisI18n();
|
|
168
171
|
|
|
169
172
|
return (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
onBlur
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
</>
|
|
173
|
+
<InputText
|
|
174
|
+
{...props}
|
|
175
|
+
prefix={showCurrencySymbol ? { label: currencySymbol } : undefined}
|
|
176
|
+
keyboard={getKeyboard(props)}
|
|
177
|
+
value={props.value?.toString() || displayValue}
|
|
178
|
+
defaultValue={props.defaultValue?.toString()}
|
|
179
|
+
onChangeText={handleChange}
|
|
180
|
+
transform={{
|
|
181
|
+
output: val => {
|
|
182
|
+
return val
|
|
183
|
+
?.split(floatSeparators.group)
|
|
184
|
+
.join("")
|
|
185
|
+
.replace(floatSeparators.decimal, ".");
|
|
186
|
+
},
|
|
187
|
+
}}
|
|
188
|
+
validations={{
|
|
189
|
+
pattern: {
|
|
190
|
+
value: NUMBER_VALIDATION_REGEX,
|
|
191
|
+
message: t("errors.notANumber"),
|
|
192
|
+
},
|
|
193
|
+
...props.validations,
|
|
194
|
+
}}
|
|
195
|
+
onBlur={() => {
|
|
196
|
+
props.onBlur?.();
|
|
197
|
+
|
|
198
|
+
if (
|
|
199
|
+
field.value === 0 ||
|
|
200
|
+
field.value === "" ||
|
|
201
|
+
field.value === undefined
|
|
202
|
+
) {
|
|
203
|
+
setDisplayValue("0");
|
|
204
|
+
}
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
205
207
|
);
|
|
206
208
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export function countDecimal(value: number): number {
|
|
2
2
|
const convertedValue = value.toString();
|
|
3
|
+
|
|
3
4
|
if (convertedValue.includes(".")) {
|
|
4
5
|
return convertedValue.split(".")[1].length;
|
|
5
6
|
}
|
|
@@ -12,10 +13,13 @@ export function limitInputWholeDigits(
|
|
|
12
13
|
maxInputLength: number,
|
|
13
14
|
): number {
|
|
14
15
|
let convertedValue = value.toString();
|
|
16
|
+
|
|
15
17
|
if (convertedValue.length > maxInputLength) {
|
|
16
18
|
convertedValue = convertedValue.slice(0, maxInputLength);
|
|
19
|
+
|
|
17
20
|
return parseFloat(convertedValue);
|
|
18
21
|
}
|
|
22
|
+
|
|
19
23
|
return value;
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -32,19 +36,23 @@ export function configureDecimal(
|
|
|
32
36
|
const precision = 10 ** targetDecimalPlaces;
|
|
33
37
|
const convertedValue =
|
|
34
38
|
Math.round(parseFloat(transformedValue) * precision) / precision;
|
|
39
|
+
|
|
35
40
|
return convertedValue;
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
export function convertToNumber(value: string): string | number {
|
|
39
44
|
const regexValidation = /^[0-9]*$/;
|
|
45
|
+
|
|
40
46
|
if (value?.match?.(regexValidation)) {
|
|
41
47
|
return parseFloat(value);
|
|
42
48
|
}
|
|
49
|
+
|
|
43
50
|
return value;
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
export const checkLastChar = (stringValue: string): boolean => {
|
|
47
54
|
const lastChar = stringValue[stringValue.length - 1];
|
|
55
|
+
|
|
48
56
|
return Boolean(Number(stringValue)) && lastChar !== "0" && lastChar !== ".";
|
|
49
57
|
};
|
|
50
58
|
|
|
@@ -85,6 +93,7 @@ export const parseGivenInput = (
|
|
|
85
93
|
wholeIntegerValue = splittedValue[0];
|
|
86
94
|
decimalNumbers = getDecimalNumbers(value, decimalSeparator);
|
|
87
95
|
}
|
|
96
|
+
|
|
88
97
|
return [decimalCount, wholeIntegerValue, decimalNumbers];
|
|
89
98
|
};
|
|
90
99
|
|
|
@@ -15,12 +15,12 @@ import { typographyStyles } from "../../../Typography";
|
|
|
15
15
|
import { styles } from "../../InputFieldWrapper.style";
|
|
16
16
|
|
|
17
17
|
export interface PrefixLabelProps {
|
|
18
|
-
focused: boolean;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
hasMiniLabel: boolean;
|
|
21
|
-
inputInvalid: boolean;
|
|
22
|
-
label: string;
|
|
23
|
-
styleOverride?: StyleProp<TextStyle>;
|
|
18
|
+
readonly focused: boolean;
|
|
19
|
+
readonly disabled?: boolean;
|
|
20
|
+
readonly hasMiniLabel: boolean;
|
|
21
|
+
readonly inputInvalid: boolean;
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly styleOverride?: StyleProp<TextStyle>;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export const prefixLabelTestId = "ATL-InputFieldWrapper-PrefixLabel";
|
|
@@ -68,12 +68,12 @@ export function PrefixLabel({
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export interface PrefixIconProps {
|
|
71
|
-
focused: boolean;
|
|
72
|
-
disabled?: boolean;
|
|
73
|
-
hasMiniLabel: boolean;
|
|
74
|
-
inputInvalid?: boolean;
|
|
75
|
-
icon: IconNames;
|
|
76
|
-
styleOverride?: StyleProp<ViewStyle>;
|
|
71
|
+
readonly focused: boolean;
|
|
72
|
+
readonly disabled?: boolean;
|
|
73
|
+
readonly hasMiniLabel: boolean;
|
|
74
|
+
readonly inputInvalid?: boolean;
|
|
75
|
+
readonly icon: IconNames;
|
|
76
|
+
readonly styleOverride?: StyleProp<ViewStyle>;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export function PrefixIcon({
|
|
@@ -15,13 +15,13 @@ import { typographyStyles } from "../../../Typography";
|
|
|
15
15
|
import { styles } from "../../InputFieldWrapper.style";
|
|
16
16
|
|
|
17
17
|
export interface SuffixLabelProps {
|
|
18
|
-
focused: boolean;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
hasMiniLabel: boolean;
|
|
21
|
-
inputInvalid?: boolean;
|
|
22
|
-
label: string;
|
|
23
|
-
hasLeftMargin?: boolean;
|
|
24
|
-
styleOverride?: StyleProp<TextStyle>;
|
|
18
|
+
readonly focused: boolean;
|
|
19
|
+
readonly disabled?: boolean;
|
|
20
|
+
readonly hasMiniLabel: boolean;
|
|
21
|
+
readonly inputInvalid?: boolean;
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly hasLeftMargin?: boolean;
|
|
24
|
+
readonly styleOverride?: StyleProp<TextStyle>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const suffixLabelTestId = "ATL-InputFieldWrapper-SuffixLabel";
|
|
@@ -71,13 +71,13 @@ export function SuffixLabel({
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
export interface SuffixIconProps {
|
|
74
|
-
focused: boolean;
|
|
75
|
-
disabled?: boolean;
|
|
76
|
-
hasMiniLabel: boolean;
|
|
77
|
-
inputInvalid?: boolean;
|
|
78
|
-
icon: IconNames;
|
|
79
|
-
hasLeftMargin?: boolean;
|
|
80
|
-
onPress?: () => void;
|
|
74
|
+
readonly focused: boolean;
|
|
75
|
+
readonly disabled?: boolean;
|
|
76
|
+
readonly hasMiniLabel: boolean;
|
|
77
|
+
readonly inputInvalid?: boolean;
|
|
78
|
+
readonly icon: IconNames;
|
|
79
|
+
readonly hasLeftMargin?: boolean;
|
|
80
|
+
readonly onPress?: () => void;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export function SuffixIcon({
|
|
@@ -36,12 +36,14 @@ function InputNumberInternal(props: InputNumberProps, ref: Ref<InputTextRef>) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
const { t } = useAtlantisI18n();
|
|
39
|
+
|
|
39
40
|
const handleChange = (newValue: number | string | undefined) => {
|
|
40
41
|
props.onChange?.(newValue);
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
const { inputTransform: convertToString, outputTransform: convertToNumber } =
|
|
44
45
|
useNumberTransform(props.value);
|
|
46
|
+
|
|
45
47
|
return (
|
|
46
48
|
<InputText
|
|
47
49
|
{...props}
|
|
@@ -69,10 +71,12 @@ function hasPeriodAtEnd(value: string) {
|
|
|
69
71
|
// matches patterns like ".", "0.", "12.", "+1.", and "-0."
|
|
70
72
|
return !!value?.match(/^[-+]?[0-9]*\.$/);
|
|
71
73
|
}
|
|
74
|
+
|
|
72
75
|
function hasScientificNotationAtEnd(value: string) {
|
|
73
76
|
// matches patterns like "1e", "+2e", "1.2e" and "-3e"
|
|
74
77
|
return !!value?.match(/^[-+]?[0-9]+(\.?[0-9]+)?e$/);
|
|
75
78
|
}
|
|
79
|
+
|
|
76
80
|
function hasPlusMinusAtEnd(value: string) {
|
|
77
81
|
// matches "+" and "-"
|
|
78
82
|
return !!value?.match(/^[-+]+$/);
|
|
@@ -92,6 +96,7 @@ export function shouldShowUserValue(value: string): boolean {
|
|
|
92
96
|
];
|
|
93
97
|
const isSpecial = (v: string) =>
|
|
94
98
|
specialCasesFn.reduce((acc, fn) => acc || fn(v), false);
|
|
99
|
+
|
|
95
100
|
return isSpecial(value);
|
|
96
101
|
}
|
|
97
102
|
|
|
@@ -105,9 +110,11 @@ export function useNumberTransform(controlledValue: number | undefined): {
|
|
|
105
110
|
|
|
106
111
|
const convertToNumber = (newValue: string) => {
|
|
107
112
|
setTypedValue(newValue);
|
|
113
|
+
|
|
108
114
|
if (newValue?.match?.(NUMBER_VALIDATION_REGEX)) {
|
|
109
115
|
return parseFloat(newValue);
|
|
110
116
|
}
|
|
117
|
+
|
|
111
118
|
return newValue;
|
|
112
119
|
};
|
|
113
120
|
|
|
@@ -115,6 +122,7 @@ export function useNumberTransform(controlledValue: number | undefined): {
|
|
|
115
122
|
if (shouldShowUserValue(typedValue)) {
|
|
116
123
|
return typedValue;
|
|
117
124
|
}
|
|
125
|
+
|
|
118
126
|
return internalValue?.toString() || undefined;
|
|
119
127
|
};
|
|
120
128
|
|
|
@@ -8,6 +8,7 @@ jest.mock("../InputFieldWrapper", () => ({
|
|
|
8
8
|
...jest.requireActual("../InputFieldWrapper"),
|
|
9
9
|
InputFieldWrapper: function Mock(props: InputFieldWrapperProps) {
|
|
10
10
|
MockInputFieldWrapper(props);
|
|
11
|
+
|
|
11
12
|
return jest.requireActual("../InputFieldWrapper").InputFieldWrapper(props);
|
|
12
13
|
},
|
|
13
14
|
}));
|
|
@@ -15,7 +15,7 @@ export interface InputPasswordProps
|
|
|
15
15
|
*
|
|
16
16
|
* @default true
|
|
17
17
|
*/
|
|
18
|
-
usePrivacyEye?: boolean;
|
|
18
|
+
readonly usePrivacyEye?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function InputPasswordInternal(
|
|
@@ -43,6 +43,7 @@ function InputPasswordInternal(
|
|
|
43
43
|
onPress: handleOnPress,
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
+
|
|
46
47
|
return undefined;
|
|
47
48
|
};
|
|
48
49
|
|
|
@@ -8,6 +8,7 @@ jest.mock("../InputFieldWrapper", () => ({
|
|
|
8
8
|
...jest.requireActual("../InputFieldWrapper"),
|
|
9
9
|
InputFieldWrapper: function Mock(props: InputFieldWrapperProps) {
|
|
10
10
|
MockInputFieldWrapper(props);
|
|
11
|
+
|
|
11
12
|
return jest.requireActual("../InputFieldWrapper").InputFieldWrapper(props);
|
|
12
13
|
},
|
|
13
14
|
}));
|
|
@@ -31,7 +31,7 @@ describe("InputAccessories", () => {
|
|
|
31
31
|
const mockInputOneFocus = jest.fn();
|
|
32
32
|
const mockInputTwoFocus = jest.fn();
|
|
33
33
|
|
|
34
|
-
function InputWrapper({ focusedInput }: { focusedInput: string }) {
|
|
34
|
+
function InputWrapper({ focusedInput }: { readonly focusedInput: string }) {
|
|
35
35
|
const { register, setFocusedInput, unregister } = useContext(
|
|
36
36
|
InputAccessoriesContext,
|
|
37
37
|
);
|
|
@@ -40,12 +40,14 @@ describe("InputAccessories", () => {
|
|
|
40
40
|
register(inputOneName, () => mockInputOneFocus());
|
|
41
41
|
register(inputTwoName, () => mockInputTwoFocus());
|
|
42
42
|
setFocusedInput(focusedInput);
|
|
43
|
+
|
|
43
44
|
return () => {
|
|
44
45
|
unregister(inputOneName);
|
|
45
46
|
unregister(inputTwoName);
|
|
46
47
|
setFocusedInput("");
|
|
47
48
|
};
|
|
48
49
|
}, [register, setFocusedInput, unregister, focusedInput]);
|
|
50
|
+
|
|
49
51
|
return (
|
|
50
52
|
<>
|
|
51
53
|
<InputText
|
|
@@ -58,6 +60,7 @@ describe("InputAccessories", () => {
|
|
|
58
60
|
</>
|
|
59
61
|
);
|
|
60
62
|
}
|
|
63
|
+
|
|
61
64
|
function SetupInputAccessoriesTest(focusedInput: string) {
|
|
62
65
|
mockUseFormController.mockImplementation(({ name, value, validations }) => {
|
|
63
66
|
const { field, error } = actualUseFormController({
|
|
@@ -65,8 +68,10 @@ describe("InputAccessories", () => {
|
|
|
65
68
|
value,
|
|
66
69
|
validations,
|
|
67
70
|
});
|
|
71
|
+
|
|
68
72
|
return { field, error };
|
|
69
73
|
});
|
|
74
|
+
|
|
70
75
|
return render(<InputWrapper focusedInput={focusedInput} />, {
|
|
71
76
|
wrapper: InputAccessoriesProvider,
|
|
72
77
|
});
|
|
@@ -15,7 +15,7 @@ import { styles } from "./InputAccessoriesProvider.style";
|
|
|
15
15
|
export function InputAccessoriesProvider({
|
|
16
16
|
children,
|
|
17
17
|
}: {
|
|
18
|
-
children: ReactNode;
|
|
18
|
+
readonly children: ReactNode;
|
|
19
19
|
}): JSX.Element {
|
|
20
20
|
const inputAccessoryID = useRef(v4()).current;
|
|
21
21
|
const {
|
package/src/Menu/utils.ts
CHANGED
|
@@ -82,6 +82,7 @@ function getHorizontalPosition(
|
|
|
82
82
|
if (menuPositionHorizontal === "menuRight") {
|
|
83
83
|
getRightPosition(pos, activatorLayout, windowWidth, menuPadding, menuWidth);
|
|
84
84
|
}
|
|
85
|
+
|
|
85
86
|
if (menuPositionHorizontal === "menuLeft") {
|
|
86
87
|
getLeftPosition(pos, activatorLayout, windowWidth, menuPadding, menuWidth);
|
|
87
88
|
}
|
package/src/Text/Text.tsx
CHANGED
package/src/Toast/Toast.tsx
CHANGED
|
@@ -19,6 +19,7 @@ function DefaultToast({ text1 }: ToastConfigParams<string>): JSX.Element {
|
|
|
19
19
|
const { bottom } = useSafeAreaInsets();
|
|
20
20
|
const { t } = useAtlantisI18n();
|
|
21
21
|
const toastContainerStyles = [styles.container, { paddingBottom: bottom }];
|
|
22
|
+
|
|
22
23
|
return (
|
|
23
24
|
<View style={toastContainerStyles}>
|
|
24
25
|
<View style={styles.toast}>
|
|
@@ -48,7 +49,7 @@ export interface JobberToastProps {
|
|
|
48
49
|
* Has effect only when the position is "bottom".
|
|
49
50
|
* @default 40
|
|
50
51
|
*/
|
|
51
|
-
bottomOffset?: number;
|
|
52
|
+
readonly bottomOffset?: number;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
export function JobberToast({ bottomOffset }: JobberToastProps): JSX.Element {
|
|
@@ -207,6 +207,7 @@ function getFontStyle(
|
|
|
207
207
|
fontWeight,
|
|
208
208
|
)}`;
|
|
209
209
|
const fontStyling = styles[styleKey];
|
|
210
|
+
|
|
210
211
|
if (fontStyling) {
|
|
211
212
|
return fontStyling;
|
|
212
213
|
} else {
|
|
@@ -234,6 +235,7 @@ function getColorStyle(color?: TextColor, reverseTheme?: boolean) {
|
|
|
234
235
|
return styles.greyBlue;
|
|
235
236
|
}
|
|
236
237
|
const colorStyleKey = `${color}${reverseTheme ? "Reverse" : ""}`;
|
|
238
|
+
|
|
237
239
|
return styles[`${colorStyleKey}`];
|
|
238
240
|
}
|
|
239
241
|
|
|
@@ -248,10 +250,13 @@ function getSizeAndHeightStyle(
|
|
|
248
250
|
lineHeightOverwrite?: LineHeight,
|
|
249
251
|
) {
|
|
250
252
|
const fontSize = styles[`${textSize}Size`];
|
|
253
|
+
|
|
251
254
|
if (lineHeightOverwrite) {
|
|
252
255
|
const lineHeight = styles[`${lineHeightOverwrite}LineHeight`];
|
|
256
|
+
|
|
253
257
|
return StyleSheet.flatten([fontSize, lineHeight]);
|
|
254
258
|
}
|
|
259
|
+
|
|
255
260
|
return fontSize;
|
|
256
261
|
}
|
|
257
262
|
|
|
@@ -51,6 +51,7 @@ export function useFormController<T>({
|
|
|
51
51
|
// TODO: Add support for two-part identifiers (e.g. "property.province")
|
|
52
52
|
const fieldIdentifiers = fieldName.split(".");
|
|
53
53
|
let error: FieldError | undefined;
|
|
54
|
+
|
|
54
55
|
if (fieldIdentifiers.length === 3) {
|
|
55
56
|
const [section, item, identifier] = fieldIdentifiers;
|
|
56
57
|
error = errors[section]?.[item]?.[identifier];
|
|
@@ -64,5 +65,6 @@ export function useFormController<T>({
|
|
|
64
65
|
function useControlName(name?: string): UseControllerReturn["field"]["name"] {
|
|
65
66
|
const [identifier] = useState(v1());
|
|
66
67
|
const prefix = `generatedName--${identifier}`;
|
|
68
|
+
|
|
67
69
|
return `${name || prefix}` as const;
|
|
68
70
|
}
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
} from "react-native-safe-area-context";
|
|
7
7
|
|
|
8
8
|
interface MockSafeAreaProviderProps {
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
frame?: Rect;
|
|
11
|
-
insets?: EdgeInsets;
|
|
9
|
+
readonly children: React.ReactNode;
|
|
10
|
+
readonly frame?: Rect;
|
|
11
|
+
readonly insets?: EdgeInsets;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function MockSafeAreaProvider({
|