@jobber/components-native 0.44.2-pre.14 → 0.45.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 +88 -0
- package/dist/src/AtlantisContext/AtlantisContext.js +1 -0
- package/dist/src/BottomSheet/BottomSheet.js +3 -4
- package/dist/src/ButtonGroup/ButtonGroup.js +3 -4
- package/dist/src/ButtonGroup/utils.js +4 -5
- package/dist/src/ContentOverlay/ContentOverlay.js +3 -4
- package/dist/src/Form/components/FormErrorBanner/FormErrorBanner.js +5 -13
- package/dist/src/Form/components/FormMask/FormMask.js +3 -4
- package/dist/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.js +4 -5
- package/dist/src/Form/components/FormSaveButton/FormSaveButton.js +4 -5
- package/dist/src/Form/hooks/useOfflineHandler.js +6 -7
- package/dist/src/FormatFile/FormatFile.js +3 -4
- package/dist/src/FormatFile/components/FileView/FileView.js +3 -3
- package/dist/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.js +6 -7
- package/dist/src/FormatFile/components/MediaView/MediaView.js +3 -3
- package/dist/src/FormatFile/utils/computeA11yLabel.js +4 -5
- package/dist/src/InputCurrency/InputCurrency.js +3 -3
- package/dist/src/InputDate/InputDate.js +4 -5
- package/dist/src/InputFieldWrapper/components/ClearAction/ClearAction.js +3 -4
- package/dist/src/InputFieldWrapper/components/ClearAction/index.js +0 -1
- package/dist/src/InputNumber/InputNumber.js +3 -4
- package/dist/src/InputPassword/InputPassword.js +3 -4
- package/dist/src/InputTime/InputTime.js +3 -4
- package/dist/src/Menu/Menu.js +3 -4
- package/dist/src/ProgressBar/ProgressBar.js +14 -8
- package/dist/src/Select/Select.js +5 -6
- package/dist/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.js +3 -4
- package/dist/src/Toast/Toast.js +4 -5
- package/dist/src/hooks/useAtlantisI18n/index.js +1 -0
- package/dist/src/hooks/useAtlantisI18n/locales/en.json +31 -0
- package/dist/src/hooks/useAtlantisI18n/locales/es.json +31 -0
- package/dist/src/hooks/useAtlantisI18n/useAtlantisI18n.js +22 -0
- package/dist/tsconfig.json +38 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/AtlantisContext/AtlantisContext.d.ts +8 -0
- package/dist/types/src/FormatFile/utils/computeA11yLabel.d.ts +6 -6
- package/dist/types/src/InputFieldWrapper/components/ClearAction/index.d.ts +0 -1
- package/dist/types/src/hooks/useAtlantisI18n/index.d.ts +1 -0
- package/dist/types/src/hooks/useAtlantisI18n/useAtlantisI18n.d.ts +6 -0
- package/package.json +2 -2
- package/src/AtlantisContext/AtlantisContext.test.tsx +4 -0
- package/src/AtlantisContext/AtlantisContext.tsx +10 -0
- package/src/BottomSheet/BottomSheet.test.tsx +3 -4
- package/src/BottomSheet/BottomSheet.tsx +3 -4
- package/src/ButtonGroup/ButtonGroup.test.tsx +8 -9
- package/src/ButtonGroup/ButtonGroup.tsx +3 -4
- package/src/ButtonGroup/utils.ts +5 -6
- package/src/ContentOverlay/ContentOverlay.test.tsx +1 -11
- package/src/ContentOverlay/ContentOverlay.tsx +5 -9
- package/src/Form/Form.test.tsx +9 -40
- package/src/Form/components/FormErrorBanner/FormErrorBanner.test.tsx +9 -72
- package/src/Form/components/FormErrorBanner/FormErrorBanner.tsx +6 -15
- package/src/Form/components/FormMask/FormMask.tsx +3 -7
- package/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.tsx +4 -5
- package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +3 -7
- package/src/Form/components/FormSaveButton/FormSaveButton.tsx +4 -5
- package/src/Form/hooks/useOfflineHandler.ts +7 -8
- package/src/FormatFile/FormatFile.test.tsx +7 -31
- package/src/FormatFile/FormatFile.tsx +3 -7
- package/src/FormatFile/components/FileView/FileView.tsx +3 -3
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.test.tsx +2 -9
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +6 -7
- package/src/FormatFile/components/MediaView/MediaView.tsx +3 -3
- package/src/FormatFile/utils/computeA11yLabel.ts +9 -12
- package/src/InputCurrency/InputCurrency.test.tsx +6 -1
- package/src/InputCurrency/InputCurrency.tsx +3 -3
- package/src/InputDate/InputDate.tsx +6 -5
- package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +4 -15
- package/src/InputFieldWrapper/components/ClearAction/ClearAction.test.tsx +1 -5
- package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +3 -4
- package/src/InputFieldWrapper/components/ClearAction/index.ts +0 -1
- package/src/InputNumber/InputNumber.test.tsx +10 -18
- package/src/InputNumber/InputNumber.tsx +3 -4
- package/src/InputPassword/InputPassword.test.tsx +1 -2
- package/src/InputPassword/InputPassword.tsx +3 -4
- package/src/InputSearch/InputSearch.test.tsx +1 -6
- package/src/InputText/InputText.test.tsx +10 -38
- package/src/InputTime/InputTime.tsx +3 -4
- package/src/Menu/Menu.test.tsx +10 -9
- package/src/Menu/Menu.tsx +3 -4
- package/src/ProgressBar/ProgressBar.tsx +17 -8
- package/src/Select/Select.test.tsx +4 -5
- package/src/Select/Select.tsx +5 -8
- package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.tsx +3 -4
- package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.test.tsx +1 -2
- package/src/Toast/Toast.tsx +4 -9
- package/src/hooks/useAtlantisI18n/index.ts +1 -0
- package/src/hooks/useAtlantisI18n/locales/en.json +31 -0
- package/src/hooks/useAtlantisI18n/locales/es.json +31 -0
- package/src/hooks/useAtlantisI18n/useAtlantisI18n.test.ts +53 -0
- package/src/hooks/useAtlantisI18n/useAtlantisI18n.ts +43 -0
- package/dist/src/BottomSheet/messages.js +0 -8
- package/dist/src/ButtonGroup/messages.js +0 -18
- package/dist/src/ContentOverlay/messages.js +0 -8
- package/dist/src/Form/components/FormErrorBanner/messages.js +0 -13
- package/dist/src/Form/components/FormMessage/components/InternalFormMessage/messages.js +0 -8
- package/dist/src/Form/components/FormSaveButton/messages.js +0 -8
- package/dist/src/Form/messages.js +0 -28
- package/dist/src/FormatFile/components/FormatFileBottomSheet/messages.js +0 -13
- package/dist/src/FormatFile/messages.js +0 -23
- package/dist/src/InputCurrency/messages.js +0 -8
- package/dist/src/InputDate/messages.js +0 -8
- package/dist/src/InputFieldWrapper/components/ClearAction/messages.js +0 -8
- package/dist/src/InputNumber/messages.js +0 -8
- package/dist/src/InputPassword/messages.js +0 -8
- package/dist/src/InputTime/messages.js +0 -8
- package/dist/src/Menu/messages.js +0 -8
- package/dist/src/ProgressBar/messages.js +0 -13
- package/dist/src/Select/components/SelectDefaultPicker/messages.js +0 -8
- package/dist/src/Select/messages.js +0 -13
- package/dist/src/Toast/messages.js +0 -13
- package/dist/types/src/BottomSheet/messages.d.ts +0 -7
- package/dist/types/src/ButtonGroup/messages.d.ts +0 -17
- package/dist/types/src/ContentOverlay/messages.d.ts +0 -7
- package/dist/types/src/Form/components/FormErrorBanner/messages.d.ts +0 -12
- package/dist/types/src/Form/components/FormMessage/components/InternalFormMessage/messages.d.ts +0 -7
- package/dist/types/src/Form/components/FormSaveButton/messages.d.ts +0 -7
- package/dist/types/src/Form/messages.d.ts +0 -27
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/messages.d.ts +0 -12
- package/dist/types/src/FormatFile/messages.d.ts +0 -22
- package/dist/types/src/InputCurrency/messages.d.ts +0 -7
- package/dist/types/src/InputDate/messages.d.ts +0 -7
- package/dist/types/src/InputFieldWrapper/components/ClearAction/messages.d.ts +0 -7
- package/dist/types/src/InputNumber/messages.d.ts +0 -7
- package/dist/types/src/InputPassword/messages.d.ts +0 -7
- package/dist/types/src/InputTime/messages.d.ts +0 -7
- package/dist/types/src/Menu/messages.d.ts +0 -7
- package/dist/types/src/ProgressBar/messages.d.ts +0 -12
- package/dist/types/src/Select/components/SelectDefaultPicker/messages.d.ts +0 -7
- package/dist/types/src/Select/messages.d.ts +0 -12
- package/dist/types/src/Toast/messages.d.ts +0 -12
- package/src/BottomSheet/messages.ts +0 -9
- package/src/ButtonGroup/messages.ts +0 -19
- package/src/ContentOverlay/messages.ts +0 -9
- package/src/Form/components/FormErrorBanner/messages.ts +0 -14
- package/src/Form/components/FormMessage/components/InternalFormMessage/messages.ts +0 -10
- package/src/Form/components/FormSaveButton/messages.ts +0 -9
- package/src/Form/messages.ts +0 -33
- package/src/FormatFile/components/FormatFileBottomSheet/messages.ts +0 -14
- package/src/FormatFile/messages.ts +0 -24
- package/src/InputCurrency/messages.ts +0 -10
- package/src/InputDate/messages.ts +0 -9
- package/src/InputFieldWrapper/components/ClearAction/messages.ts +0 -9
- package/src/InputNumber/messages.ts +0 -10
- package/src/InputPassword/messages.ts +0 -9
- package/src/InputTime/messages.ts +0 -9
- package/src/Menu/messages.ts +0 -9
- package/src/ProgressBar/messages.ts +0 -14
- package/src/Select/components/SelectDefaultPicker/messages.ts +0 -9
- package/src/Select/messages.ts +0 -14
- package/src/Toast/messages.ts +0 -14
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jobber/components-native",
|
|
3
|
+
"version": "0.45.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "React Native implementation of Atlantis",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/GetJobber/atlantis.git"
|
|
9
|
+
},
|
|
10
|
+
"author": "The Frends",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/GetJobber/atlantis/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/GetJobber/atlantis#readme",
|
|
15
|
+
"main": "dist/src/index.js",
|
|
16
|
+
"module": "dist/src/index.js",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src",
|
|
21
|
+
"!**/__tests__",
|
|
22
|
+
"!**/__fixtures__",
|
|
23
|
+
"!**/__mocks__",
|
|
24
|
+
"ios",
|
|
25
|
+
"cpp",
|
|
26
|
+
"*.podspec",
|
|
27
|
+
"!ios/build",
|
|
28
|
+
"./jestSetup.js"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"clean": "rm -rf dist/* tsconfig.tsbuildinfo",
|
|
32
|
+
"build": "npm run build:clean && npm run compile",
|
|
33
|
+
"bootstrap": "npm run build",
|
|
34
|
+
"prepack": "npm run build",
|
|
35
|
+
"compile": "tsc -b",
|
|
36
|
+
"build:clean": "rm -rf ./dist"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@jobber/design": "^0.44.4",
|
|
40
|
+
"@jobber/hooks": "^2.1.5",
|
|
41
|
+
"@react-native-clipboard/clipboard": "^1.11.2",
|
|
42
|
+
"@react-native-picker/picker": "^2.4.10",
|
|
43
|
+
"autolinker": "^4.0.0",
|
|
44
|
+
"deepmerge": "^4.2.2",
|
|
45
|
+
"lodash": "^4.17.21",
|
|
46
|
+
"react-hook-form": "^7.30.0",
|
|
47
|
+
"react-intl": "^6.4.2",
|
|
48
|
+
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
49
|
+
"react-native-modalize": "^2.0.13",
|
|
50
|
+
"react-native-portalize": "^1.0.7",
|
|
51
|
+
"react-native-safe-area-context": "^4.5.2",
|
|
52
|
+
"react-native-svg": "^13.9.0",
|
|
53
|
+
"react-native-toast-message": "^2.1.6",
|
|
54
|
+
"react-native-uuid": "^1.4.9",
|
|
55
|
+
"ts-xor": "^1.1.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@testing-library/jest-native": "^5.4.2",
|
|
59
|
+
"@testing-library/react-hooks": "^7.0.2",
|
|
60
|
+
"@testing-library/react-native": "^12.0.1",
|
|
61
|
+
"@types/lodash.chunk": "^4.2.7",
|
|
62
|
+
"@types/lodash.debounce": "^4.0.7",
|
|
63
|
+
"@types/lodash.identity": "^3.0.7",
|
|
64
|
+
"@types/react": "^18.0.28",
|
|
65
|
+
"@types/react-native": "^0.71.6",
|
|
66
|
+
"@types/react-native-uuid": "^1.4.0",
|
|
67
|
+
"metro-react-native-babel-preset": "^0.76.0",
|
|
68
|
+
"react-test-renderer": "^18.2.0",
|
|
69
|
+
"typescript": "^4.9.5"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"@babel/core": "^7.4.5",
|
|
73
|
+
"@react-native-community/datetimepicker": ">=6.7.0",
|
|
74
|
+
"date-fns": "^2.0.0",
|
|
75
|
+
"date-fns-tz": "*",
|
|
76
|
+
"react": "^18",
|
|
77
|
+
"react-intl": "^6.4.2",
|
|
78
|
+
"react-native": ">=0.69.2",
|
|
79
|
+
"react-native-gesture-handler": ">=2.10.0",
|
|
80
|
+
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
81
|
+
"react-native-modal-datetime-picker": " >=13.0.0",
|
|
82
|
+
"react-native-modalize": "^2.0.13",
|
|
83
|
+
"react-native-portalize": "^1.0.7",
|
|
84
|
+
"react-native-reanimated": "^2.17.0",
|
|
85
|
+
"react-native-safe-area-context": "^4.5.2"
|
|
86
|
+
},
|
|
87
|
+
"gitHead": "90e9d2a124e1d65d678364063f6ef57e066939af"
|
|
88
|
+
}
|
|
@@ -2,13 +2,12 @@ import React, { forwardRef, useState } from "react";
|
|
|
2
2
|
import { Modalize } from "react-native-modalize";
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
4
|
import { Keyboard, View } from "react-native";
|
|
5
|
-
import { useIntl } from "react-intl";
|
|
6
5
|
import { BottomSheetOption } from "./components/BottomSheetOption";
|
|
7
6
|
import { styles } from "./BottomSheet.style";
|
|
8
|
-
import { messages } from "./messages";
|
|
9
7
|
import { useIsScreenReaderEnabled } from "../hooks";
|
|
10
8
|
import { Divider } from "../Divider";
|
|
11
9
|
import { Heading } from "../Heading";
|
|
10
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
12
11
|
export const BottomSheet = forwardRef(BottomSheetInternal);
|
|
13
12
|
function BottomSheetInternal({ children, showCancel, loading = false, heading, onOpen, onClose, }, ref) {
|
|
14
13
|
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
@@ -36,11 +35,11 @@ function Header({ heading }) {
|
|
|
36
35
|
}
|
|
37
36
|
function Footer({ cancellable, onCancel, }) {
|
|
38
37
|
const insets = useSafeAreaInsets();
|
|
39
|
-
const {
|
|
38
|
+
const { t } = useAtlantisI18n();
|
|
40
39
|
return (React.createElement(View, { style: { marginBottom: insets.bottom } }, cancellable && (React.createElement(View, { style: styles.children },
|
|
41
40
|
React.createElement(View, { style: styles.footerDivider },
|
|
42
41
|
React.createElement(Divider, null)),
|
|
43
|
-
React.createElement(BottomSheetOption, { text:
|
|
42
|
+
React.createElement(BottomSheetOption, { text: t("cancel"), icon: "remove", onPress: onCancel })))));
|
|
44
43
|
}
|
|
45
44
|
function dismissKeyboard() {
|
|
46
45
|
//Dismisses the keyboard before opening the bottom sheet.
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
|
-
import { useIntl } from "react-intl";
|
|
3
2
|
import { View } from "react-native";
|
|
4
3
|
import { PrimaryAction, SecondaryAction } from "./ButtonGroupAction";
|
|
5
|
-
import { messages } from "./messages";
|
|
6
4
|
import { styles } from "./ButtonGroup.style";
|
|
7
5
|
import { SecondaryActionSheet } from "./components/SecondaryActionSheet";
|
|
8
6
|
import { getActions, usePreventTapWhenOffline } from "./utils";
|
|
9
7
|
import { Button } from "../Button";
|
|
8
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
10
9
|
export function ButtonGroup({ children, showCancelInBottomSheet, bottomSheetHeading, onOpenBottomSheet, onCloseBottomSheet, allowTapWhenOffline = false, }) {
|
|
11
|
-
const {
|
|
10
|
+
const { t } = useAtlantisI18n();
|
|
12
11
|
const { handlePress } = usePreventTapWhenOffline();
|
|
13
12
|
const secondaryActionsRef = useRef();
|
|
14
13
|
const { primaryActions, secondaryActions } = getActions(children);
|
|
@@ -18,7 +17,7 @@ export function ButtonGroup({ children, showCancelInBottomSheet, bottomSheetHead
|
|
|
18
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 }))));
|
|
19
18
|
}),
|
|
20
19
|
secondaryActions.length > 0 && (React.createElement(View, { style: styles.moreButton },
|
|
21
|
-
React.createElement(Button, { icon: "more", accessibilityLabel:
|
|
20
|
+
React.createElement(Button, { icon: "more", accessibilityLabel: t("more"), onPress: handlePress(openBottomSheet), fullHeight: true }))),
|
|
22
21
|
React.createElement(SecondaryActionSheet, { heading: bottomSheetHeading, showCancel: showCancelInBottomSheet, secondaryActionsRef: secondaryActionsRef, actions: secondaryActions.map(secondaryAction => secondaryAction.props), onOpenBottomSheet: onOpenBottomSheet, onCloseBottomSheet: onCloseBottomSheet })));
|
|
23
22
|
function openBottomSheet() {
|
|
24
23
|
var _a;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
|
-
import { useIntl } from "react-intl";
|
|
3
2
|
import { Alert } from "react-native";
|
|
4
|
-
import { messages } from "./messages";
|
|
5
3
|
import { PrimaryAction, SecondaryAction, } from "./ButtonGroupAction";
|
|
6
4
|
import { useAtlantisContext } from "../AtlantisContext/AtlantisContext";
|
|
5
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
7
6
|
/**
|
|
8
7
|
* Determine if the onPress should be fired or an alert when the device is
|
|
9
8
|
* online or offline
|
|
10
9
|
*/
|
|
11
10
|
export function usePreventTapWhenOffline() {
|
|
12
|
-
const {
|
|
11
|
+
const { t } = useAtlantisI18n();
|
|
13
12
|
const { isOnline } = useAtlantisContext();
|
|
14
13
|
const handlePress = useCallback((callback) => {
|
|
15
14
|
if (isOnline)
|
|
16
15
|
return callback;
|
|
17
|
-
return () => Alert.alert(
|
|
18
|
-
}, [
|
|
16
|
+
return () => Alert.alert(t("networkUnavailableTitle"), t("networkUnavailableDescription"));
|
|
17
|
+
}, [isOnline]);
|
|
19
18
|
return { handlePress };
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
@@ -3,22 +3,21 @@ import { Modalize } from "react-native-modalize";
|
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
4
|
import { AccessibilityInfo, Platform, View, findNodeHandle, useWindowDimensions, } from "react-native";
|
|
5
5
|
import { Portal } from "react-native-portalize";
|
|
6
|
-
import { useIntl } from "react-intl";
|
|
7
6
|
import { useKeyboardVisibility } from "./hooks/useKeyboardVisibility";
|
|
8
7
|
import { styles } from "./ContentOverlay.style";
|
|
9
|
-
import { messages } from "./messages";
|
|
10
8
|
import { useViewLayoutHeight } from "./hooks/useViewLayoutHeight";
|
|
11
9
|
import { useIsScreenReaderEnabled } from "../hooks";
|
|
12
10
|
import { IconButton } from "../IconButton";
|
|
13
11
|
import { tokens } from "../utils/design";
|
|
14
12
|
import { Heading } from "../Heading";
|
|
13
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
15
14
|
export const ContentOverlay = forwardRef(ContentOverlayPortal);
|
|
16
15
|
const ContentOverlayModal = forwardRef(ContentOverlayInternal);
|
|
17
16
|
// eslint-disable-next-line max-statements
|
|
18
17
|
function ContentOverlayInternal({ children, title, accessibilityLabel, fullScreen = false, showDismiss = false, isDraggable = true, adjustToContentHeight = false, keyboardShouldPersistTaps = false, keyboardAvoidingBehavior, scrollEnabled = false, modalBackgroundColor = "surface", onClose, onOpen, onBeforeExit, loading = false, avoidKeyboardLikeIOS, }, ref) {
|
|
19
18
|
isDraggable = onBeforeExit ? false : isDraggable;
|
|
20
19
|
const isCloseableOnOverlayTap = onBeforeExit ? false : true;
|
|
21
|
-
const {
|
|
20
|
+
const { t } = useAtlantisI18n();
|
|
22
21
|
const { width: windowWidth, height: windowHeight } = useWindowDimensions();
|
|
23
22
|
const insets = useSafeAreaInsets();
|
|
24
23
|
const [position, setPosition] = useState("initial");
|
|
@@ -106,7 +105,7 @@ function ContentOverlayInternal({ children, title, accessibilityLabel, fullScree
|
|
|
106
105
|
!childrenHeightKnown && (React.createElement(View, { style: [styles.hiddenContent, modalStyle] }, renderedChildren)),
|
|
107
106
|
!headerHeightKnown && (React.createElement(View, { style: [styles.hiddenContent, modalStyle] }, renderedHeader))));
|
|
108
107
|
function renderHeader() {
|
|
109
|
-
const closeOverlayA11YLabel =
|
|
108
|
+
const closeOverlayA11YLabel = t("ContentOverlay.close", {
|
|
110
109
|
title: title,
|
|
111
110
|
});
|
|
112
111
|
const headerStyles = [
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { useIntl } from "react-intl";
|
|
3
|
-
import { messages } from "./messages";
|
|
4
|
-
import { useAtlantisContext } from "../../../AtlantisContext";
|
|
5
2
|
import { Banner } from "../../../Banner";
|
|
3
|
+
import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
|
|
6
4
|
export function FormErrorBanner({ networkError, bannerError, }) {
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return (React.createElement(Banner, { text: formatMessage(messages.offlineError), type: "error" }));
|
|
11
|
-
}
|
|
12
|
-
else if (networkError) {
|
|
13
|
-
return (React.createElement(Banner, { text: formatMessage(messages.networkError), type: "error" }));
|
|
5
|
+
const { t } = useAtlantisI18n();
|
|
6
|
+
if (networkError) {
|
|
7
|
+
return React.createElement(Banner, { type: "error" }, t("errors.couldNotSave"));
|
|
14
8
|
}
|
|
15
9
|
else if (bannerError) {
|
|
16
10
|
return (React.createElement(Banner, { text: bannerError.title, details: bannerError.messages, type: "error" }));
|
|
17
11
|
}
|
|
18
|
-
|
|
19
|
-
return React.createElement(React.Fragment, null);
|
|
20
|
-
}
|
|
12
|
+
return React.createElement(React.Fragment, null);
|
|
21
13
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
3
|
import { styles } from "./FormMask.style";
|
|
5
4
|
import { ActivityIndicator } from "../../../ActivityIndicator";
|
|
6
|
-
import {
|
|
5
|
+
import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
|
|
7
6
|
export function FormMask() {
|
|
8
|
-
const {
|
|
9
|
-
return (React.createElement(View, { style: styles.mask, accessibilityLabel:
|
|
7
|
+
const { t } = useAtlantisI18n();
|
|
8
|
+
return (React.createElement(View, { style: styles.mask, accessibilityLabel: t("loading") },
|
|
10
9
|
React.createElement(ActivityIndicator, null)));
|
|
11
10
|
}
|
package/dist/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.js
CHANGED
|
@@ -2,23 +2,22 @@ import React, { useMemo } from "react";
|
|
|
2
2
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
3
3
|
import { Modal, StatusBar, View } from "react-native";
|
|
4
4
|
import { ScrollView } from "react-native-gesture-handler";
|
|
5
|
-
import { useIntl } from "react-intl";
|
|
6
5
|
import { styles } from "./InternalFormMessage.style";
|
|
7
|
-
import { messages } from "./messages";
|
|
8
6
|
import { EmptyState } from "../../../../../EmptyState";
|
|
7
|
+
import { useAtlantisI18n } from "../../../../../hooks/useAtlantisI18n";
|
|
9
8
|
export function InternalFormMessage({ data, onRequestClose, }) {
|
|
10
|
-
const {
|
|
9
|
+
const { t } = useAtlantisI18n();
|
|
11
10
|
const emptyStateData = useMemo(() => {
|
|
12
11
|
if (data.secondaryAction) {
|
|
13
12
|
return data;
|
|
14
13
|
}
|
|
15
14
|
else {
|
|
16
15
|
return Object.assign(Object.assign({}, data), { secondaryAction: {
|
|
17
|
-
label:
|
|
16
|
+
label: t("goBack"),
|
|
18
17
|
onPress: onRequestClose,
|
|
19
18
|
} });
|
|
20
19
|
}
|
|
21
|
-
}, [data,
|
|
20
|
+
}, [data, t, onRequestClose]);
|
|
22
21
|
return (React.createElement(Modal, { animationType: "fade", transparent: true, visible: true, onRequestClose: onRequestClose },
|
|
23
22
|
React.createElement(View, { style: styles.wrapper },
|
|
24
23
|
React.createElement(StatusBar, { barStyle: "dark-content" }),
|
|
@@ -8,18 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import React from "react";
|
|
11
|
-
import { useIntl } from "react-intl";
|
|
12
11
|
import { useFormContext } from "react-hook-form";
|
|
13
|
-
import { messages } from "./messages";
|
|
14
12
|
import { ButtonGroup, } from "../../../ButtonGroup";
|
|
13
|
+
import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
|
|
15
14
|
export function FormSaveButton({ primaryAction, loading, label, secondaryActions, setSecondaryActionLoading, onOpenBottomSheet, onCloseBottomSheet, }) {
|
|
16
|
-
const {
|
|
15
|
+
const { t } = useAtlantisI18n();
|
|
17
16
|
const formContext = useFormContext();
|
|
18
17
|
const buttonActions = useButtonGroupAction(secondaryActions);
|
|
19
18
|
return (React.createElement(React.Fragment, null,
|
|
20
19
|
React.createElement(ButtonGroup, { onOpenBottomSheet: onOpenBottomSheet, onCloseBottomSheet: onCloseBottomSheet, allowTapWhenOffline: true }, buttonActions.map((action, index) => {
|
|
21
20
|
if (index === 0) {
|
|
22
|
-
return (React.createElement(ButtonGroup.PrimaryAction, { key: index, onPress: primaryAction, label: label !== null && label !== void 0 ? label :
|
|
21
|
+
return (React.createElement(ButtonGroup.PrimaryAction, { key: index, onPress: primaryAction, label: label !== null && label !== void 0 ? label : t("save"), loading: loading }));
|
|
23
22
|
}
|
|
24
23
|
else {
|
|
25
24
|
return (React.createElement(ButtonGroup.SecondaryAction, { key: index, label: action.label, icon: action.icon, onPress: action.onPress, destructive: action.destructive }));
|
|
@@ -37,7 +36,7 @@ export function FormSaveButton({ primaryAction, loading, label, secondaryActions
|
|
|
37
36
|
})
|
|
38
37
|
: [];
|
|
39
38
|
buttonGroupActionProps.unshift({
|
|
40
|
-
label: label !== null && label !== void 0 ? label :
|
|
39
|
+
label: label !== null && label !== void 0 ? label : t("save"),
|
|
41
40
|
onPress: primaryAction,
|
|
42
41
|
loading: loading,
|
|
43
42
|
icon: undefined,
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
|
-
import { useIntl } from "react-intl";
|
|
3
2
|
import { Alert } from "react-native";
|
|
4
|
-
import {
|
|
3
|
+
import { useAtlantisI18n } from "../../hooks/useAtlantisI18n";
|
|
5
4
|
export function useOfflineHandler() {
|
|
6
|
-
const {
|
|
5
|
+
const { t } = useAtlantisI18n();
|
|
7
6
|
const handleOfflineSubmit = useCallback((callback, dismiss) => {
|
|
8
7
|
return () => {
|
|
9
|
-
Alert.alert(
|
|
8
|
+
Alert.alert(t("networkUnavailableTitle"), t("networkUnavailableDescription"), [
|
|
10
9
|
{
|
|
11
|
-
text:
|
|
10
|
+
text: t("dismiss"),
|
|
12
11
|
style: "cancel",
|
|
13
12
|
onPress: dismiss,
|
|
14
13
|
},
|
|
15
14
|
{
|
|
16
|
-
text:
|
|
15
|
+
text: t("tryAgain"),
|
|
17
16
|
style: "default",
|
|
18
17
|
onPress: callback,
|
|
19
18
|
},
|
|
20
19
|
]);
|
|
21
20
|
};
|
|
22
|
-
}, [
|
|
21
|
+
}, [t]);
|
|
23
22
|
return handleOfflineSubmit;
|
|
24
23
|
}
|
|
@@ -9,8 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import React, { createRef, useCallback, useState } from "react";
|
|
11
11
|
import { TouchableOpacity, View } from "react-native";
|
|
12
|
-
import { useIntl } from "react-intl";
|
|
13
|
-
import { messages } from "./messages";
|
|
14
12
|
import { styles } from "./FormatFile.style";
|
|
15
13
|
import { MediaView } from "./components/MediaView";
|
|
16
14
|
import { FormatFileBottomSheet, } from "./components/FormatFileBottomSheet";
|
|
@@ -19,6 +17,7 @@ import { acceptedExtensions, videoExtensions } from "./constants";
|
|
|
19
17
|
import { StatusCode, } from "./types";
|
|
20
18
|
import { AtlantisFormatFileContext } from "./context/FormatFileContext";
|
|
21
19
|
import { createUseCreateThumbnail } from "./utils/createUseCreateThumbnail";
|
|
20
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
22
21
|
function FormatFileContent({ accessibilityLabel, file, showOverlay, styleInGrid, onUploadComplete, isMedia, }) {
|
|
23
22
|
return (React.createElement(View, { style: [
|
|
24
23
|
styles.thumbnailContainer,
|
|
@@ -89,7 +88,7 @@ export function FormatFile({ file, accessibilityLabel, accessibilityHint, onTap,
|
|
|
89
88
|
}
|
|
90
89
|
function FormatFileInternal({ file, accessibilityLabel, accessibilityHint, onTap, onRemove, bottomSheetOptionsSuffix, styleInGrid = false, onPreviewPress, testID, createThumbnail: createThumbnailProp, }) {
|
|
91
90
|
const [showOverlay, setShowOverlay] = useState(file.status !== StatusCode.Completed);
|
|
92
|
-
const {
|
|
91
|
+
const { t } = useAtlantisI18n();
|
|
93
92
|
const bottomSheetRef = createRef();
|
|
94
93
|
const handlePreviewPress = useCallback(() => {
|
|
95
94
|
onPreviewPress === null || onPreviewPress === void 0 ? void 0 : onPreviewPress(file);
|
|
@@ -100,7 +99,7 @@ function FormatFileInternal({ file, accessibilityLabel, accessibilityHint, onTap
|
|
|
100
99
|
const { useCreateThumbnail } = createUseCreateThumbnail(createThumbnail);
|
|
101
100
|
return (React.createElement(AtlantisFormatFileContext.Provider, { value: { useCreateThumbnail } },
|
|
102
101
|
React.createElement(View, null,
|
|
103
|
-
React.createElement(TouchableOpacity, { accessibilityRole: "imagebutton", accessibilityHint: accessibilityHint !== null && accessibilityHint !== void 0 ? accessibilityHint :
|
|
102
|
+
React.createElement(TouchableOpacity, { accessibilityRole: "imagebutton", accessibilityHint: accessibilityHint !== null && accessibilityHint !== void 0 ? accessibilityHint : t("FormatFile.hint"), onPress: handleOnPress, testID: testID },
|
|
104
103
|
React.createElement(FormatFileContent, { accessibilityLabel: accessibilityLabel, file: file, onUploadComplete: () => setShowOverlay(false), isMedia: !!file.isMedia, styleInGrid: styleInGrid, showOverlay: showOverlay })),
|
|
105
104
|
React.createElement(FormatFileBottomSheet, { bottomSheetRef: bottomSheetRef, onRemovePress: onRemove, bottomSheetOptionsSuffix: bottomSheetOptionsSuffix, onPreviewPress: file.showPreview ? handlePreviewPress : undefined }))));
|
|
106
105
|
function handleOnPress() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
3
|
import { styles } from "./FileView.style";
|
|
5
4
|
import { Icon } from "../../../Icon";
|
|
6
5
|
import { Text } from "../../../Text";
|
|
@@ -8,13 +7,14 @@ import { StatusCode } from "../../types";
|
|
|
8
7
|
import { computeA11yLabel } from "../../utils";
|
|
9
8
|
import { ProgressBar } from "../ProgressBar";
|
|
10
9
|
import { ErrorIcon } from "../ErrorIcon";
|
|
10
|
+
import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
|
|
11
11
|
export function FileView({ accessibilityLabel, styleInGrid, file, showOverlay, showError, onUploadComplete, }) {
|
|
12
|
-
const {
|
|
12
|
+
const { t } = useAtlantisI18n();
|
|
13
13
|
const a11yLabel = computeA11yLabel({
|
|
14
14
|
accessibilityLabel,
|
|
15
15
|
showOverlay,
|
|
16
16
|
showError,
|
|
17
|
-
|
|
17
|
+
t,
|
|
18
18
|
});
|
|
19
19
|
const freezeProgressBar = file.status !== StatusCode.Completed && file.progress >= 0.9;
|
|
20
20
|
return (React.createElement(View, { style: [
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Portal } from "react-native-portalize";
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
|
-
import { messages } from "./messages";
|
|
5
3
|
import { BottomSheet } from "../../../BottomSheet/BottomSheet";
|
|
6
4
|
import { BottomSheetOption } from "../../../BottomSheet/components/BottomSheetOption";
|
|
5
|
+
import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
|
|
7
6
|
export const FormatFileBottomSheet = ({ bottomSheetRef, onPreviewPress, onRemovePress, bottomSheetOptionsSuffix, }) => {
|
|
8
|
-
const {
|
|
7
|
+
const { t } = useAtlantisI18n();
|
|
9
8
|
const handlePress = (onPressAction) => {
|
|
10
9
|
var _a;
|
|
11
10
|
onPressAction();
|
|
@@ -13,10 +12,10 @@ export const FormatFileBottomSheet = ({ bottomSheetRef, onPreviewPress, onRemove
|
|
|
13
12
|
};
|
|
14
13
|
return (React.createElement(Portal, null,
|
|
15
14
|
React.createElement(BottomSheet, { ref: bottomSheetRef },
|
|
16
|
-
onPreviewPress ? (React.createElement(BottomSheetOption, { icon: "eye", text:
|
|
17
|
-
bottomSheetOptionsSuffix,
|
|
15
|
+
onPreviewPress ? (React.createElement(BottomSheetOption, { icon: "eye", text: t("FormatFile.preview", {
|
|
16
|
+
item: bottomSheetOptionsSuffix || "",
|
|
18
17
|
}), onPress: () => handlePress(onPreviewPress) })) : undefined,
|
|
19
|
-
onRemovePress ? (React.createElement(BottomSheetOption, { icon: "trash", destructive: true, text:
|
|
20
|
-
bottomSheetOptionsSuffix,
|
|
18
|
+
onRemovePress ? (React.createElement(BottomSheetOption, { icon: "trash", destructive: true, text: t("FormatFile.remove", {
|
|
19
|
+
item: bottomSheetOptionsSuffix || "",
|
|
21
20
|
}), onPress: () => handlePress(onRemovePress) })) : undefined)));
|
|
22
21
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { ImageBackground, View } from "react-native";
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
3
|
import { styles } from "./MediaView.style";
|
|
5
4
|
import { StatusCode } from "../../types";
|
|
6
5
|
import { computeA11yLabel } from "../../utils";
|
|
@@ -9,8 +8,9 @@ import { Icon } from "../../../Icon";
|
|
|
9
8
|
import { ProgressBar } from "../ProgressBar";
|
|
10
9
|
import { ErrorIcon } from "../ErrorIcon";
|
|
11
10
|
import { useAtlantisFormatFileContext } from "../../context/FormatFileContext";
|
|
11
|
+
import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
|
|
12
12
|
export function MediaView({ accessibilityLabel, showOverlay, showError, file, styleInGrid, onUploadComplete, }) {
|
|
13
|
-
const {
|
|
13
|
+
const { t } = useAtlantisI18n();
|
|
14
14
|
const { useCreateThumbnail } = useAtlantisFormatFileContext();
|
|
15
15
|
const { thumbnail, error } = useCreateThumbnail(file);
|
|
16
16
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -18,7 +18,7 @@ export function MediaView({ accessibilityLabel, showOverlay, showError, file, st
|
|
|
18
18
|
accessibilityLabel,
|
|
19
19
|
showOverlay,
|
|
20
20
|
showError,
|
|
21
|
-
|
|
21
|
+
t,
|
|
22
22
|
});
|
|
23
23
|
const hasError = showError || error;
|
|
24
24
|
const uri = thumbnail || file.thumbnailUrl || file.source;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export function computeA11yLabel({ accessibilityLabel, showOverlay, showError, formatMessage, }) {
|
|
1
|
+
export function computeA11yLabel({ accessibilityLabel, showOverlay, showError, t, }) {
|
|
3
2
|
if (!showError && showOverlay) {
|
|
4
|
-
return
|
|
3
|
+
return t("upload.inProgress");
|
|
5
4
|
}
|
|
6
5
|
else if (showError) {
|
|
7
|
-
return
|
|
6
|
+
return t("upload.failed");
|
|
8
7
|
}
|
|
9
8
|
else {
|
|
10
|
-
return
|
|
9
|
+
return accessibilityLabel || t("FormatFile.label");
|
|
11
10
|
}
|
|
12
11
|
}
|
|
@@ -2,10 +2,10 @@ import React, { useState } from "react";
|
|
|
2
2
|
import { useIntl } from "react-intl";
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
4
|
import { NUMBER_VALIDATION_REGEX, checkLastChar, configureDecimal, convertToNumber, isValidNumber, limitInputWholeDigits, parseGivenInput, } from "./utils";
|
|
5
|
-
import { messages } from "./messages";
|
|
6
5
|
import { useAtlantisContext } from "../AtlantisContext";
|
|
7
6
|
import { InputText } from "../InputText";
|
|
8
7
|
import { useFormController } from "../hooks/useFormController";
|
|
8
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
9
9
|
export const getInternalValue = (props, field, formatNumber) => {
|
|
10
10
|
var _a, _b;
|
|
11
11
|
if (!props.value && !field.value)
|
|
@@ -72,7 +72,7 @@ export function InputCurrency(props) {
|
|
|
72
72
|
setOnChangeAndDisplayValues(value, value);
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
const {
|
|
75
|
+
const { t } = useAtlantisI18n();
|
|
76
76
|
return (React.createElement(React.Fragment, null,
|
|
77
77
|
React.createElement(InputText, Object.assign({}, props, { prefix: showCurrencySymbol ? { label: currencySymbol } : undefined, keyboard: getKeyboard(props), value: ((_a = props.value) === null || _a === void 0 ? void 0 : _a.toString()) || displayValue, defaultValue: (_b = props.defaultValue) === null || _b === void 0 ? void 0 : _b.toString(), onChangeText: handleChange, transform: {
|
|
78
78
|
output: val => {
|
|
@@ -80,7 +80,7 @@ export function InputCurrency(props) {
|
|
|
80
80
|
},
|
|
81
81
|
}, validations: Object.assign({ pattern: {
|
|
82
82
|
value: NUMBER_VALIDATION_REGEX,
|
|
83
|
-
message:
|
|
83
|
+
message: t("errors.notANumber"),
|
|
84
84
|
} }, props.validations), onBlur: () => {
|
|
85
85
|
var _a;
|
|
86
86
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { useMemo, useState } from "react";
|
|
2
2
|
import DateTimePicker from "react-native-modal-datetime-picker";
|
|
3
3
|
import { Platform } from "react-native";
|
|
4
|
-
import { useIntl } from "react-intl";
|
|
5
4
|
import { utcToZonedTime } from "date-fns-tz";
|
|
6
5
|
import { format as formatDate } from "date-fns";
|
|
7
|
-
import { messages } from "./messages";
|
|
8
6
|
import { FormField } from "../FormField";
|
|
9
7
|
import { InputPressable } from "../InputPressable";
|
|
10
8
|
import { useAtlantisContext } from "../AtlantisContext";
|
|
9
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
11
10
|
function formatInvalidState(error, invalid) {
|
|
12
11
|
if (invalid)
|
|
13
12
|
return invalid;
|
|
@@ -33,7 +32,7 @@ export function InputDate(props) {
|
|
|
33
32
|
}
|
|
34
33
|
function InternalInputDate({ clearable = "always", disabled, emptyValueLabel, invalid, maxDate, minDate, placeholder, value, name, onChange, accessibilityLabel, accessibilityHint, }) {
|
|
35
34
|
const [showPicker, setShowPicker] = useState(false);
|
|
36
|
-
const {
|
|
35
|
+
const { t, locale } = useAtlantisI18n();
|
|
37
36
|
const { timeZone, dateFormat } = useAtlantisContext();
|
|
38
37
|
const date = useMemo(() => {
|
|
39
38
|
if (typeof value === "string")
|
|
@@ -48,10 +47,10 @@ function InternalInputDate({ clearable = "always", disabled, emptyValueLabel, in
|
|
|
48
47
|
return emptyValueLabel;
|
|
49
48
|
}, [date, emptyValueLabel, timeZone, dateFormat]);
|
|
50
49
|
const canClearDate = formattedDate === emptyValueLabel ? "never" : clearable;
|
|
51
|
-
const placeholderLabel = placeholder !== null && placeholder !== void 0 ? placeholder :
|
|
50
|
+
const placeholderLabel = placeholder !== null && placeholder !== void 0 ? placeholder : t("date");
|
|
52
51
|
return (React.createElement(React.Fragment, null,
|
|
53
52
|
React.createElement(InputPressable, { clearable: canClearDate, disabled: disabled, invalid: invalid, placeholder: placeholderLabel, prefix: { icon: "calendar" }, value: formattedDate, onClear: handleClear, onPress: showDatePicker, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint }),
|
|
54
|
-
React.createElement(DateTimePicker, { testID: "inputDate-datePicker", date: date || undefined, display: display, isVisible: showPicker, maximumDate: maxDate, minimumDate: minDate, mode: "date", onCancel: handleCancel, onConfirm: handleConfirm })));
|
|
53
|
+
React.createElement(DateTimePicker, { testID: "inputDate-datePicker", date: date || undefined, display: display, isVisible: showPicker, maximumDate: maxDate, minimumDate: minDate, mode: "date", confirmTextIOS: t("confirm"), cancelTextIOS: t("cancel"), locale: locale, onCancel: handleCancel, onConfirm: handleConfirm })));
|
|
55
54
|
function showDatePicker() {
|
|
56
55
|
setShowPicker(true);
|
|
57
56
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Pressable, View } from "react-native";
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
3
|
import { styles } from "./ClearAction.style";
|
|
5
|
-
import { messages } from "./messages";
|
|
6
4
|
import { Icon } from "../../../Icon";
|
|
5
|
+
import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
|
|
7
6
|
export function ClearAction({ onPress, hasMarginRight = false, }) {
|
|
8
|
-
const {
|
|
9
|
-
return (React.createElement(Pressable, { style: [styles.container, hasMarginRight && styles.addedMargin], onPress: onPress, accessibilityLabel:
|
|
7
|
+
const { t } = useAtlantisI18n();
|
|
8
|
+
return (React.createElement(Pressable, { style: [styles.container, hasMarginRight && styles.addedMargin], onPress: onPress, accessibilityLabel: t("InputFieldWrapper.clear") },
|
|
10
9
|
React.createElement(View, { style: styles.circle },
|
|
11
10
|
React.createElement(Icon, { size: "small", name: "cross", color: "interactiveSubtle" }))));
|
|
12
11
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React, { forwardRef, useState } from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
3
|
import flow from "lodash/flow";
|
|
5
4
|
import identity from "lodash/identity";
|
|
6
|
-
import { messages } from "./messages";
|
|
7
5
|
import { InputText } from "../InputText";
|
|
6
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
8
7
|
const NUMBER_VALIDATION_REGEX = /^[-+]?(([0-9]*\.[0-9]+)|([0-9]+)|([0-9]+(\.?[0-9]+)?e[-+]?[0-9]+))$/;
|
|
9
8
|
export const InputNumber = forwardRef(InputNumberInternal);
|
|
10
9
|
function InputNumberInternal(props, ref) {
|
|
@@ -19,7 +18,7 @@ function InputNumberInternal(props, ref) {
|
|
|
19
18
|
return "numeric";
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
|
-
const {
|
|
21
|
+
const { t } = useAtlantisI18n();
|
|
23
22
|
const handleChange = (newValue) => {
|
|
24
23
|
var _a;
|
|
25
24
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, newValue);
|
|
@@ -30,7 +29,7 @@ function InputNumberInternal(props, ref) {
|
|
|
30
29
|
output: flow(convertToNumber, ((_b = props.transform) === null || _b === void 0 ? void 0 : _b.output) || identity),
|
|
31
30
|
}, ref: ref, value: (_c = props.value) === null || _c === void 0 ? void 0 : _c.toString(), defaultValue: (_d = props.defaultValue) === null || _d === void 0 ? void 0 : _d.toString(), onChangeText: handleChange, validations: Object.assign({ pattern: {
|
|
32
31
|
value: NUMBER_VALIDATION_REGEX,
|
|
33
|
-
message:
|
|
32
|
+
message: t("errors.notANumber"),
|
|
34
33
|
} }, props.validations) })));
|
|
35
34
|
}
|
|
36
35
|
function hasPeriodAtEnd(value) {
|
|
@@ -10,13 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React, { forwardRef, useState } from "react";
|
|
13
|
-
import { useIntl } from "react-intl";
|
|
14
|
-
import { messages } from "./messages";
|
|
15
13
|
import { InputText } from "../InputText";
|
|
14
|
+
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
16
15
|
export const InputPassword = forwardRef(InputPasswordInternal);
|
|
17
16
|
function InputPasswordInternal(_a, ref) {
|
|
18
17
|
var { usePrivacyEye = true } = _a, props = __rest(_a, ["usePrivacyEye"]);
|
|
19
|
-
const {
|
|
18
|
+
const { t } = useAtlantisI18n();
|
|
20
19
|
const [passwordHidden, setPasswordHidden] = useState(true);
|
|
21
20
|
const [privacyEye, setPrivacyEye] = useState("eye");
|
|
22
21
|
const handleOnPress = () => {
|
|
@@ -40,6 +39,6 @@ function InputPasswordInternal(_a, ref) {
|
|
|
40
39
|
};
|
|
41
40
|
return (React.createElement(InputText, Object.assign({}, props, { ref: ref, keyboard: "default", secureTextEntry: passwordHidden, textContentType: "password", clearable: "never", suffix: privacyEyeSuffix(), validations: Object.assign({ required: {
|
|
42
41
|
value: true,
|
|
43
|
-
message:
|
|
42
|
+
message: t("InputPassword.enterPassword"),
|
|
44
43
|
} }, props.validations) })));
|
|
45
44
|
}
|