@jobber/components-native 0.40.1 → 0.42.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/src/AutoLink/AutoLink.js +23 -0
- package/dist/src/AutoLink/clipboard.js +9 -0
- package/dist/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.js +19 -0
- package/dist/src/AutoLink/components/Link/Link.js +7 -0
- package/dist/src/AutoLink/components/index.js +2 -0
- package/dist/src/AutoLink/hooks/useCreateLinkedText.js +24 -0
- package/dist/src/AutoLink/hooks/useTokenGenerator.js +10 -0
- package/dist/src/AutoLink/index.js +1 -0
- package/dist/src/AutoLink/messages.js +18 -0
- package/dist/src/AutoLink/types.js +1 -0
- package/dist/src/AutoLink/utils.js +45 -0
- package/dist/src/FormatFile/FormatFile.js +114 -0
- package/dist/src/FormatFile/FormatFile.style.js +16 -0
- package/dist/src/FormatFile/components/ErrorIcon/ErrorIcon.js +8 -0
- package/dist/src/FormatFile/components/ErrorIcon/ErrorIcon.style.js +10 -0
- package/dist/src/FormatFile/components/ErrorIcon/index.js +1 -0
- package/dist/src/FormatFile/components/FileView/FileView.js +67 -0
- package/dist/src/FormatFile/components/FileView/FileView.style.js +64 -0
- package/dist/src/FormatFile/components/FileView/index.js +1 -0
- package/dist/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.js +22 -0
- package/dist/src/FormatFile/components/FormatFileBottomSheet/index.js +1 -0
- package/dist/src/FormatFile/components/FormatFileBottomSheet/messages.js +13 -0
- package/dist/src/FormatFile/components/MediaView/MediaView.js +56 -0
- package/dist/src/FormatFile/components/MediaView/MediaView.style.js +27 -0
- package/dist/src/FormatFile/components/MediaView/index.js +1 -0
- package/dist/src/FormatFile/components/ProgressBar/ProgressBar.js +29 -0
- package/dist/src/FormatFile/components/ProgressBar/ProgressBar.style.js +15 -0
- package/dist/src/FormatFile/components/ProgressBar/index.js +1 -0
- package/dist/src/FormatFile/components/_mocks/mockFiles.js +78 -0
- package/dist/src/FormatFile/constants.js +14 -0
- package/dist/src/FormatFile/context/FormatFileContext.js +8 -0
- package/dist/src/FormatFile/context/types.js +1 -0
- package/dist/src/FormatFile/index.js +1 -0
- package/dist/src/FormatFile/messages.js +23 -0
- package/dist/src/FormatFile/types.js +8 -0
- package/dist/src/FormatFile/utils/computeA11yLabel.js +12 -0
- package/dist/src/FormatFile/utils/createUseCreateThumbnail.js +22 -0
- package/dist/src/FormatFile/utils/index.js +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/utils/test/wait.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/AutoLink/AutoLink.d.ts +3 -0
- package/dist/types/src/AutoLink/clipboard.d.ts +2 -0
- package/dist/types/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.d.ts +3 -0
- package/dist/types/src/AutoLink/components/Link/Link.d.ts +8 -0
- package/dist/types/src/AutoLink/components/index.d.ts +2 -0
- package/dist/types/src/AutoLink/hooks/useCreateLinkedText.d.ts +12 -0
- package/dist/types/src/AutoLink/hooks/useTokenGenerator.d.ts +1 -0
- package/dist/types/src/AutoLink/index.d.ts +1 -0
- package/dist/types/src/AutoLink/messages.d.ts +17 -0
- package/dist/types/src/AutoLink/types.d.ts +32 -0
- package/dist/types/src/AutoLink/utils.d.ts +6 -0
- package/dist/types/src/Form/components/FormMessage/FormMessage.d.ts +1 -0
- package/dist/types/src/FormatFile/FormatFile.d.ts +47 -0
- package/dist/types/src/FormatFile/FormatFile.style.d.ts +14 -0
- package/dist/types/src/FormatFile/components/ErrorIcon/ErrorIcon.d.ts +2 -0
- package/dist/types/src/FormatFile/components/ErrorIcon/ErrorIcon.style.d.ts +8 -0
- package/dist/types/src/FormatFile/components/ErrorIcon/index.d.ts +1 -0
- package/dist/types/src/FormatFile/components/FileView/FileView.d.ts +12 -0
- package/dist/types/src/FormatFile/components/FileView/FileView.style.d.ts +62 -0
- package/dist/types/src/FormatFile/components/FileView/index.d.ts +1 -0
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +11 -0
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/index.d.ts +2 -0
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/messages.d.ts +12 -0
- package/dist/types/src/FormatFile/components/MediaView/MediaView.d.ts +12 -0
- package/dist/types/src/FormatFile/components/MediaView/MediaView.style.d.ts +25 -0
- package/dist/types/src/FormatFile/components/MediaView/index.d.ts +1 -0
- package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.d.ts +19 -0
- package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.style.d.ts +13 -0
- package/dist/types/src/FormatFile/components/ProgressBar/index.d.ts +1 -0
- package/dist/types/src/FormatFile/components/_mocks/mockFiles.d.ts +18 -0
- package/dist/types/src/FormatFile/constants.d.ts +6 -0
- package/dist/types/src/FormatFile/context/FormatFileContext.d.ts +10 -0
- package/dist/types/src/FormatFile/context/types.d.ts +9 -0
- package/dist/types/src/FormatFile/index.d.ts +3 -0
- package/dist/types/src/FormatFile/messages.d.ts +22 -0
- package/dist/types/src/FormatFile/types.d.ts +105 -0
- package/dist/types/src/FormatFile/utils/computeA11yLabel.d.ts +9 -0
- package/dist/types/src/FormatFile/utils/createUseCreateThumbnail.d.ts +5 -0
- package/dist/types/src/FormatFile/utils/index.d.ts +1 -0
- package/dist/types/src/InputCurrency/InputCurrency.d.ts +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +5 -2
- package/src/AutoLink/AutoLink.test.tsx +203 -0
- package/src/AutoLink/AutoLink.tsx +36 -0
- package/src/AutoLink/clipboard.ts +14 -0
- package/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.tsx +38 -0
- package/src/AutoLink/components/Link/Link.test.tsx +30 -0
- package/src/AutoLink/components/Link/Link.tsx +21 -0
- package/src/AutoLink/components/index.ts +2 -0
- package/src/AutoLink/hooks/useCreateLinkedText.ts +35 -0
- package/src/AutoLink/hooks/useTokenGenerator.ts +11 -0
- package/src/AutoLink/index.ts +1 -0
- package/src/AutoLink/messages.ts +19 -0
- package/src/AutoLink/types.ts +39 -0
- package/src/AutoLink/utils.ts +63 -0
- package/src/FormatFile/FormatFile.style.ts +17 -0
- package/src/FormatFile/FormatFile.test.tsx +333 -0
- package/src/FormatFile/FormatFile.tsx +300 -0
- package/src/FormatFile/components/ErrorIcon/ErrorIcon.style.ts +11 -0
- package/src/FormatFile/components/ErrorIcon/ErrorIcon.tsx +12 -0
- package/src/FormatFile/components/ErrorIcon/index.ts +1 -0
- package/src/FormatFile/components/FileView/FileView.style.ts +65 -0
- package/src/FormatFile/components/FileView/FileView.tsx +134 -0
- package/src/FormatFile/components/FileView/index.ts +1 -0
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.test.tsx +108 -0
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +56 -0
- package/src/FormatFile/components/FormatFileBottomSheet/index.ts +2 -0
- package/src/FormatFile/components/FormatFileBottomSheet/messages.ts +14 -0
- package/src/FormatFile/components/MediaView/MediaView.style.ts +28 -0
- package/src/FormatFile/components/MediaView/MediaView.tsx +145 -0
- package/src/FormatFile/components/MediaView/index.ts +1 -0
- package/src/FormatFile/components/ProgressBar/ProgressBar.style.tsx +16 -0
- package/src/FormatFile/components/ProgressBar/ProgressBar.tsx +57 -0
- package/src/FormatFile/components/ProgressBar/index.ts +1 -0
- package/src/FormatFile/components/_mocks/mockFiles.ts +105 -0
- package/src/FormatFile/constants.ts +15 -0
- package/src/FormatFile/context/FormatFileContext.ts +13 -0
- package/src/FormatFile/context/types.ts +12 -0
- package/src/FormatFile/index.ts +13 -0
- package/src/FormatFile/messages.ts +24 -0
- package/src/FormatFile/types.ts +126 -0
- package/src/FormatFile/utils/computeA11yLabel.ts +26 -0
- package/src/FormatFile/utils/createUseCreateThumbnail.ts +33 -0
- package/src/FormatFile/utils/index.ts +1 -0
- package/src/InputCurrency/InputCurrency.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/utils/test/wait.ts +3 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { Text as RNText } from "react-native";
|
|
14
|
+
import { ComposeTextWithLinks } from "./components";
|
|
15
|
+
import { useCreateLinkedText } from "./hooks/useCreateLinkedText";
|
|
16
|
+
import { TypographyGestureDetector } from "../Typography";
|
|
17
|
+
import { tokens } from "../utils/design";
|
|
18
|
+
export function AutoLink(_a) {
|
|
19
|
+
var { children: text = "", bottomTabsVisible = true, selectable = true } = _a, rest = __rest(_a, ["children", "bottomTabsVisible", "selectable"]);
|
|
20
|
+
const { splitText, matches } = useCreateLinkedText(Object.assign({ text }, rest));
|
|
21
|
+
return (React.createElement(TypographyGestureDetector, null,
|
|
22
|
+
React.createElement(RNText, { selectable: selectable, selectionColor: tokens["color-brand--highlight"] }, splitText.map((part, index) => (React.createElement(ComposeTextWithLinks, { key: index, part: part, index: index, match: matches[part], bottomTabsVisible: bottomTabsVisible, selectable: selectable }))))));
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Clipboard from "@react-native-clipboard/clipboard";
|
|
2
|
+
import { showToast } from "../Toast";
|
|
3
|
+
export function copyTextToClipboard(text, toastConfig) {
|
|
4
|
+
Clipboard.setString(text);
|
|
5
|
+
if (toastConfig) {
|
|
6
|
+
const { message, bottomTabsVisible } = toastConfig;
|
|
7
|
+
showToast({ message, bottomTabsVisible });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
import { Platform } from "react-native";
|
|
4
|
+
import { onLongPressLink, onPressLink } from "../../utils";
|
|
5
|
+
import { Link } from "../Link/Link";
|
|
6
|
+
import { Text } from "../../../Text";
|
|
7
|
+
export function ComposeTextWithLinks({ part, index, match, bottomTabsVisible, selectable = true, }) {
|
|
8
|
+
const { formatMessage } = useIntl();
|
|
9
|
+
const isLink = match === null || match === void 0 ? void 0 : match.getType();
|
|
10
|
+
if (isLink) {
|
|
11
|
+
return (React.createElement(Link, { key: index, onPress: () => onPressLink(match), onLongPress: () => {
|
|
12
|
+
if (selectable && Platform.OS === "android") {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
onLongPressLink(match, bottomTabsVisible, formatMessage);
|
|
16
|
+
} }, match.getAnchorText()));
|
|
17
|
+
}
|
|
18
|
+
return React.createElement(Text, { key: index }, part);
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Text as RNText } from "react-native";
|
|
3
|
+
import { Text } from "../../../Text";
|
|
4
|
+
export function Link({ children, onPress, onLongPress, }) {
|
|
5
|
+
return (React.createElement(RNText, { onPress: onPress, onLongPress: onLongPress },
|
|
6
|
+
React.createElement(Text, { variation: "interactive" }, children)));
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Autolinker from "autolinker";
|
|
2
|
+
import { useTokenGenerator } from "./useTokenGenerator";
|
|
3
|
+
import { shouldIgnoreURL } from "../utils";
|
|
4
|
+
export function useCreateLinkedText({ text = "", email = true, phone = true, urls = true, }) {
|
|
5
|
+
const [generateToken, tokenRegexp] = useTokenGenerator();
|
|
6
|
+
const matches = {};
|
|
7
|
+
const linkedText = Autolinker.link(text, {
|
|
8
|
+
email,
|
|
9
|
+
phone,
|
|
10
|
+
urls,
|
|
11
|
+
replaceFn: match => {
|
|
12
|
+
if (shouldIgnoreURL(text, match))
|
|
13
|
+
return false;
|
|
14
|
+
const token = generateToken();
|
|
15
|
+
matches[token] = match;
|
|
16
|
+
return token;
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
const splitText = splitLinkedText(linkedText, tokenRegexp);
|
|
20
|
+
return { splitText, matches };
|
|
21
|
+
}
|
|
22
|
+
function splitLinkedText(linkedText, tokenRegexp) {
|
|
23
|
+
return linkedText.split(tokenRegexp).filter(part => Boolean(part));
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { v1 } from "react-native-uuid";
|
|
3
|
+
export function useTokenGenerator() {
|
|
4
|
+
let counter = 0;
|
|
5
|
+
const [identifier] = useState(v1());
|
|
6
|
+
return [
|
|
7
|
+
() => `@__ELEMENT-${identifier}-${counter++}__@`,
|
|
8
|
+
new RegExp(`(@__ELEMENT-${identifier}-\\d+__@)`, "g"),
|
|
9
|
+
];
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./AutoLink";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineMessages } from "react-intl";
|
|
2
|
+
export const messages = defineMessages({
|
|
3
|
+
phoneCopied: {
|
|
4
|
+
id: "phoneCopied",
|
|
5
|
+
defaultMessage: "Phone number copied",
|
|
6
|
+
description: "Message shown after copying a phone number",
|
|
7
|
+
},
|
|
8
|
+
emailCopied: {
|
|
9
|
+
id: "emailCopied",
|
|
10
|
+
defaultMessage: "Email copied",
|
|
11
|
+
description: "Message shown after copying an email",
|
|
12
|
+
},
|
|
13
|
+
urlCopied: {
|
|
14
|
+
id: "urlCopied",
|
|
15
|
+
defaultMessage: "URL copied",
|
|
16
|
+
description: "Message shown after copying a URL",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Linking } from "react-native";
|
|
2
|
+
import { messages } from "./messages";
|
|
3
|
+
import { copyTextToClipboard } from "./clipboard";
|
|
4
|
+
function hasPrefix(text, prefixes) {
|
|
5
|
+
return prefixes.some(prefix => text.includes(prefix));
|
|
6
|
+
}
|
|
7
|
+
export function shouldIgnoreURL(text, match) {
|
|
8
|
+
const matchedText = match.getMatchedText().toLocaleLowerCase();
|
|
9
|
+
const urlPrefixes = ["http://", "https://", "www."];
|
|
10
|
+
const ignorePrefixes = ["file://", "ftp://"];
|
|
11
|
+
const previousChar = text.charAt(match.getOffset() - 1);
|
|
12
|
+
if (match.getType() === "url") {
|
|
13
|
+
const hasUrlPrefix = hasPrefix(matchedText, urlPrefixes);
|
|
14
|
+
const hasIgnorePrefix = hasPrefix(matchedText, ignorePrefixes) || previousChar === "/";
|
|
15
|
+
return hasIgnorePrefix && !hasUrlPrefix;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
export function getUrl(match, immediateOpen = true) {
|
|
20
|
+
const matchType = match.getType();
|
|
21
|
+
switch (matchType) {
|
|
22
|
+
case "email":
|
|
23
|
+
return immediateOpen
|
|
24
|
+
? `mailto:${encodeURIComponent(match.getEmail())}`
|
|
25
|
+
: match.getEmail();
|
|
26
|
+
case "phone":
|
|
27
|
+
return immediateOpen
|
|
28
|
+
? `tel:${match.getNumber()}`
|
|
29
|
+
: match.getNumber();
|
|
30
|
+
default:
|
|
31
|
+
return match.getAnchorHref();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function onLongPressLink(match, bottomTabsVisible, formatMessage) {
|
|
35
|
+
const linkUrl = getUrl(match, false);
|
|
36
|
+
const toastConfig = {
|
|
37
|
+
message: formatMessage(messages[`${match.getType()}Copied`]),
|
|
38
|
+
bottomTabsVisible,
|
|
39
|
+
};
|
|
40
|
+
copyTextToClipboard(linkUrl, toastConfig);
|
|
41
|
+
}
|
|
42
|
+
export function onPressLink(match) {
|
|
43
|
+
const linkUrl = getUrl(match);
|
|
44
|
+
Linking.openURL(linkUrl);
|
|
45
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import React, { createRef, useCallback, useState } from "react";
|
|
11
|
+
import { TouchableOpacity, View } from "react-native";
|
|
12
|
+
import { useIntl } from "react-intl";
|
|
13
|
+
import { messages } from "./messages";
|
|
14
|
+
import { styles } from "./FormatFile.style";
|
|
15
|
+
import { MediaView } from "./components/MediaView";
|
|
16
|
+
import { FormatFileBottomSheet, } from "./components/FormatFileBottomSheet";
|
|
17
|
+
import { FileView } from "./components/FileView";
|
|
18
|
+
import { acceptedExtensions, videoExtensions } from "./constants";
|
|
19
|
+
import { StatusCode, } from "./types";
|
|
20
|
+
import { AtlantisFormatFileContext } from "./context/FormatFileContext";
|
|
21
|
+
import { createUseCreateThumbnail } from "./utils/createUseCreateThumbnail";
|
|
22
|
+
function FormatFileContent({ accessibilityLabel, file, showOverlay, styleInGrid, onUploadComplete, isMedia, }) {
|
|
23
|
+
return (React.createElement(View, { style: [
|
|
24
|
+
styles.thumbnailContainer,
|
|
25
|
+
styleInGrid && styles.thumbnailContainerGrid,
|
|
26
|
+
] }, isMedia ? (React.createElement(MediaView, { accessibilityLabel: accessibilityLabel, file: file, showOverlay: showOverlay, showError: file.error, styleInGrid: styleInGrid, onUploadComplete: onUploadComplete })) : (React.createElement(FileView, { accessibilityLabel: accessibilityLabel, file: file, showOverlay: showOverlay, showError: file.error, styleInGrid: styleInGrid, onUploadComplete: onUploadComplete }))));
|
|
27
|
+
}
|
|
28
|
+
const FormatFileInternalMemoized = React.memo(FormatFileInternal);
|
|
29
|
+
function isMediaFile(fileType) {
|
|
30
|
+
return fileType.includes("image") || fileType.includes("video");
|
|
31
|
+
}
|
|
32
|
+
function isVideo(fileName) {
|
|
33
|
+
const extension = fileName.substring(fileName.lastIndexOf(".") + 1);
|
|
34
|
+
return videoExtensions.some(({ type }) => type === extension.toLowerCase());
|
|
35
|
+
}
|
|
36
|
+
function getContentType(fileName = "", fileType = "unknown") {
|
|
37
|
+
if (isVideo(fileName)) {
|
|
38
|
+
return "video";
|
|
39
|
+
}
|
|
40
|
+
return fileType;
|
|
41
|
+
}
|
|
42
|
+
function isAcceptedExtension(file) {
|
|
43
|
+
return acceptedExtensions.some(extension =>
|
|
44
|
+
// type property may return undefined on M1 Systems running iOS Simulator
|
|
45
|
+
(file.type || "").includes(extension.name));
|
|
46
|
+
}
|
|
47
|
+
function parseFile(file, showFileTypeIndicator) {
|
|
48
|
+
let formattedFile;
|
|
49
|
+
if ("progress" in file) {
|
|
50
|
+
formattedFile = {
|
|
51
|
+
source: file.sourcePath,
|
|
52
|
+
name: file.name,
|
|
53
|
+
size: file.size,
|
|
54
|
+
external: false,
|
|
55
|
+
progress: file.progress,
|
|
56
|
+
status: file.status,
|
|
57
|
+
error: file.status === StatusCode.Failed,
|
|
58
|
+
type: file.type || file.key,
|
|
59
|
+
isMedia: false,
|
|
60
|
+
showPreview: false,
|
|
61
|
+
showFileTypeIndicator: showFileTypeIndicator,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
formattedFile = {
|
|
66
|
+
source: file.url,
|
|
67
|
+
thumbnailUrl: file.thumbnailUrl,
|
|
68
|
+
name: file.fileName,
|
|
69
|
+
size: file.fileSize,
|
|
70
|
+
external: true,
|
|
71
|
+
progress: 1,
|
|
72
|
+
status: StatusCode.Completed,
|
|
73
|
+
error: false,
|
|
74
|
+
type: getContentType(file.fileName, file.contentType),
|
|
75
|
+
isMedia: false,
|
|
76
|
+
showPreview: false,
|
|
77
|
+
showFileTypeIndicator: showFileTypeIndicator,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
formattedFile.isMedia = isMediaFile(formattedFile.type || "");
|
|
81
|
+
formattedFile.showPreview =
|
|
82
|
+
formattedFile.isMedia || isAcceptedExtension(formattedFile);
|
|
83
|
+
return formattedFile;
|
|
84
|
+
}
|
|
85
|
+
export function FormatFile({ file, accessibilityLabel, accessibilityHint, onTap, onRemove, bottomSheetOptionsSuffix, styleInGrid = false, testID, showFileTypeIndicator = true, createThumbnail, onPreviewPress, }) {
|
|
86
|
+
const onTapModified = onTap ? () => onTap(file) : () => undefined;
|
|
87
|
+
const formattedFile = parseFile(file, showFileTypeIndicator);
|
|
88
|
+
return (React.createElement(FormatFileInternalMemoized, { file: formattedFile, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, onTap: onTapModified, onRemove: onRemove, bottomSheetOptionsSuffix: bottomSheetOptionsSuffix, styleInGrid: styleInGrid, testID: testID, createThumbnail: createThumbnail, onPreviewPress: onPreviewPress }));
|
|
89
|
+
}
|
|
90
|
+
function FormatFileInternal({ file, accessibilityLabel, accessibilityHint, onTap, onRemove, bottomSheetOptionsSuffix, styleInGrid = false, onPreviewPress, testID, createThumbnail: createThumbnailProp, }) {
|
|
91
|
+
const [showOverlay, setShowOverlay] = useState(file.status !== StatusCode.Completed);
|
|
92
|
+
const { formatMessage } = useIntl();
|
|
93
|
+
const bottomSheetRef = createRef();
|
|
94
|
+
const handlePreviewPress = useCallback(() => {
|
|
95
|
+
onPreviewPress === null || onPreviewPress === void 0 ? void 0 : onPreviewPress(file);
|
|
96
|
+
}, [file, onPreviewPress]);
|
|
97
|
+
const createThumbnail = createThumbnailProp
|
|
98
|
+
? createThumbnailProp
|
|
99
|
+
: () => __awaiter(this, void 0, void 0, function* () { return ({ error: false, thumbnail: "" }); });
|
|
100
|
+
const { useCreateThumbnail } = createUseCreateThumbnail(createThumbnail);
|
|
101
|
+
return (React.createElement(AtlantisFormatFileContext.Provider, { value: { useCreateThumbnail } },
|
|
102
|
+
React.createElement(View, null,
|
|
103
|
+
React.createElement(TouchableOpacity, { accessibilityRole: "imagebutton", accessibilityHint: accessibilityHint !== null && accessibilityHint !== void 0 ? accessibilityHint : formatMessage(messages.defaultAccessibilityHint), onPress: handleOnPress, testID: testID },
|
|
104
|
+
React.createElement(FormatFileContent, { accessibilityLabel: accessibilityLabel, file: file, onUploadComplete: () => setShowOverlay(false), isMedia: !!file.isMedia, styleInGrid: styleInGrid, showOverlay: showOverlay })),
|
|
105
|
+
React.createElement(FormatFileBottomSheet, { bottomSheetRef: bottomSheetRef, onRemovePress: onRemove, bottomSheetOptionsSuffix: bottomSheetOptionsSuffix, onPreviewPress: file.showPreview ? handlePreviewPress : undefined }))));
|
|
106
|
+
function handleOnPress() {
|
|
107
|
+
var _a;
|
|
108
|
+
if (showOverlay || !onRemove) {
|
|
109
|
+
onTap();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
(_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { tokens } from "../utils/design";
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
thumbnailContainer: {
|
|
5
|
+
backgroundColor: tokens["color-surface--background"],
|
|
6
|
+
borderWidth: tokens["border-base"],
|
|
7
|
+
borderColor: tokens["color-border"],
|
|
8
|
+
borderRadius: tokens["radius-base"],
|
|
9
|
+
marginBottom: tokens["space-small"],
|
|
10
|
+
},
|
|
11
|
+
thumbnailContainerGrid: {
|
|
12
|
+
width: tokens["space-extravagant"],
|
|
13
|
+
height: tokens["space-extravagant"],
|
|
14
|
+
marginRight: tokens["space-small"],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { styles } from "./ErrorIcon.style";
|
|
4
|
+
import { Icon } from "../../../Icon";
|
|
5
|
+
export function ErrorIcon() {
|
|
6
|
+
return (React.createElement(View, { testID: "format-file-error-icon", style: styles.circle },
|
|
7
|
+
React.createElement(Icon, { name: "alert", color: "critical" })));
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { tokens } from "../../../utils/design";
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
circle: {
|
|
5
|
+
width: tokens["space-large"],
|
|
6
|
+
height: tokens["space-large"],
|
|
7
|
+
borderRadius: tokens["radius-circle"],
|
|
8
|
+
backgroundColor: tokens["color-surface"],
|
|
9
|
+
},
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ErrorIcon } from "./ErrorIcon";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import { styles } from "./FileView.style";
|
|
5
|
+
import { Icon } from "../../../Icon";
|
|
6
|
+
import { Text } from "../../../Text";
|
|
7
|
+
import { StatusCode } from "../../types";
|
|
8
|
+
import { computeA11yLabel } from "../../utils";
|
|
9
|
+
import { ProgressBar } from "../ProgressBar";
|
|
10
|
+
import { ErrorIcon } from "../ErrorIcon";
|
|
11
|
+
export function FileView({ accessibilityLabel, styleInGrid, file, showOverlay, showError, onUploadComplete, }) {
|
|
12
|
+
const { formatMessage } = useIntl();
|
|
13
|
+
const a11yLabel = computeA11yLabel({
|
|
14
|
+
accessibilityLabel,
|
|
15
|
+
showOverlay,
|
|
16
|
+
showError,
|
|
17
|
+
formatMessage,
|
|
18
|
+
});
|
|
19
|
+
const freezeProgressBar = file.status !== StatusCode.Completed && file.progress >= 0.9;
|
|
20
|
+
return (React.createElement(View, { style: [
|
|
21
|
+
styles.fileBackground,
|
|
22
|
+
styleInGrid ? styles.fileBackgroundGrid : styles.fileBackgroundFlat,
|
|
23
|
+
], accessible: true, accessibilityLabel: a11yLabel },
|
|
24
|
+
React.createElement(View, { style: [
|
|
25
|
+
styles.fileBackground,
|
|
26
|
+
styleInGrid ? styles.fileIconGrid : styles.fileIconFlat,
|
|
27
|
+
], testID: "test-file" }, (styleInGrid || !showError) && file.showFileTypeIndicator && (React.createElement(Icon, { size: "large", name: mapFileTypeToIconName({
|
|
28
|
+
fileName: file.name,
|
|
29
|
+
fileType: file.type,
|
|
30
|
+
}) }))),
|
|
31
|
+
React.createElement(View, { style: [
|
|
32
|
+
showError && styleInGrid ? styles.fileNameError : styles.fileName,
|
|
33
|
+
styleInGrid ? styles.fileNameGrid : styles.fileNameFlat,
|
|
34
|
+
] },
|
|
35
|
+
React.createElement(Text, { level: "textSupporting", variation: "subdued", maxLines: "single" }, file.name)),
|
|
36
|
+
!showError && showOverlay && (React.createElement(View, { style: [styles.fileBackground, styles.overlay, styles.fileOverlay], testID: "format-file-progress-bar-container" },
|
|
37
|
+
React.createElement(ProgressBar, { status: file.status, progress: freezeProgressBar ? 0.9 : file.progress, onComplete: onUploadComplete }))),
|
|
38
|
+
showError && (React.createElement(View, { style: [
|
|
39
|
+
styles.fileBackground,
|
|
40
|
+
styles.overlayError,
|
|
41
|
+
styles.fileOverlay,
|
|
42
|
+
], testID: "format-file-error-container" },
|
|
43
|
+
React.createElement(View, { style: !styleInGrid ? styles.iconCenter : undefined },
|
|
44
|
+
React.createElement(ErrorIcon, null))))));
|
|
45
|
+
}
|
|
46
|
+
function mapFileTypeToIconName({ fileName, fileType, }) {
|
|
47
|
+
if (!fileName && !fileType) {
|
|
48
|
+
return "alert";
|
|
49
|
+
}
|
|
50
|
+
if ((fileType === null || fileType === void 0 ? void 0 : fileType.includes("pdf")) || (fileName === null || fileName === void 0 ? void 0 : fileName.match(/~*.pdf$/))) {
|
|
51
|
+
return "pdf";
|
|
52
|
+
}
|
|
53
|
+
else if ((fileType === null || fileType === void 0 ? void 0 : fileType.includes("ms-word")) ||
|
|
54
|
+
(fileName === null || fileName === void 0 ? void 0 : fileName.match(/~*.doc$|docx$/))) {
|
|
55
|
+
return "word";
|
|
56
|
+
}
|
|
57
|
+
else if ((fileType === null || fileType === void 0 ? void 0 : fileType.includes("ms-excel")) ||
|
|
58
|
+
(fileName === null || fileName === void 0 ? void 0 : fileName.match(/~*.xls$|xlsx$/))) {
|
|
59
|
+
return "excel";
|
|
60
|
+
}
|
|
61
|
+
else if ((fileType === null || fileType === void 0 ? void 0 : fileType.includes("video")) || (fileName === null || fileName === void 0 ? void 0 : fileName.match(/~*.mp4$|mp4$/))) {
|
|
62
|
+
return "video";
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return "file";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { tokens } from "../../../utils/design";
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
overlay: {
|
|
5
|
+
backgroundColor: tokens["color-overlay--dimmed"],
|
|
6
|
+
},
|
|
7
|
+
overlayError: {
|
|
8
|
+
backgroundColor: tokens["color-overlay--dimmed"],
|
|
9
|
+
borderColor: tokens["color-critical"],
|
|
10
|
+
borderWidth: tokens["border-base"],
|
|
11
|
+
},
|
|
12
|
+
iconCenter: {
|
|
13
|
+
marginBottom: tokens["space-large"],
|
|
14
|
+
},
|
|
15
|
+
fileBackground: {
|
|
16
|
+
width: "100%",
|
|
17
|
+
display: "flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
},
|
|
20
|
+
fileBackgroundGrid: {
|
|
21
|
+
height: "100%",
|
|
22
|
+
},
|
|
23
|
+
fileBackgroundFlat: {
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
height: tokens["space-extravagant"],
|
|
26
|
+
},
|
|
27
|
+
fileIconGrid: {
|
|
28
|
+
top: tokens["space-small"],
|
|
29
|
+
},
|
|
30
|
+
fileIconFlat: {
|
|
31
|
+
top: tokens["space-smaller"],
|
|
32
|
+
},
|
|
33
|
+
fileNameError: {
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
borderTopColor: tokens["color-border"],
|
|
36
|
+
borderTopWidth: tokens["space-minuscule"],
|
|
37
|
+
width: "100%",
|
|
38
|
+
marginTop: tokens["space-base"],
|
|
39
|
+
},
|
|
40
|
+
fileName: {
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
borderTopColor: tokens["color-border"],
|
|
43
|
+
borderTopWidth: tokens["space-minuscule"],
|
|
44
|
+
width: "100%",
|
|
45
|
+
},
|
|
46
|
+
fileNameGrid: {
|
|
47
|
+
position: "absolute",
|
|
48
|
+
right: 0,
|
|
49
|
+
bottom: 0,
|
|
50
|
+
left: 0,
|
|
51
|
+
},
|
|
52
|
+
fileNameFlat: {
|
|
53
|
+
top: tokens["space-small"],
|
|
54
|
+
},
|
|
55
|
+
fileOverlay: {
|
|
56
|
+
position: "absolute",
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
right: 0,
|
|
59
|
+
bottom: 0,
|
|
60
|
+
left: 0,
|
|
61
|
+
height: "100%",
|
|
62
|
+
paddingHorizontal: tokens["space-small"],
|
|
63
|
+
},
|
|
64
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FileView } from "./FileView";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Portal } from "react-native-portalize";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import { messages } from "./messages";
|
|
5
|
+
import { BottomSheet } from "../../../BottomSheet/BottomSheet";
|
|
6
|
+
import { BottomSheetOption } from "../../../BottomSheet/components/BottomSheetOption";
|
|
7
|
+
export const FormatFileBottomSheet = ({ bottomSheetRef, onPreviewPress, onRemovePress, bottomSheetOptionsSuffix, }) => {
|
|
8
|
+
const { formatMessage } = useIntl();
|
|
9
|
+
const handlePress = (onPressAction) => {
|
|
10
|
+
var _a;
|
|
11
|
+
onPressAction();
|
|
12
|
+
(_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
13
|
+
};
|
|
14
|
+
return (React.createElement(Portal, null,
|
|
15
|
+
React.createElement(BottomSheet, { ref: bottomSheetRef },
|
|
16
|
+
onPreviewPress ? (React.createElement(BottomSheetOption, { icon: "eye", text: formatMessage(messages.lightBoxPreviewButton, {
|
|
17
|
+
bottomSheetOptionsSuffix,
|
|
18
|
+
}), onPress: () => handlePress(onPreviewPress) })) : undefined,
|
|
19
|
+
onRemovePress ? (React.createElement(BottomSheetOption, { icon: "trash", destructive: true, text: formatMessage(messages.removeButton, {
|
|
20
|
+
bottomSheetOptionsSuffix,
|
|
21
|
+
}), onPress: () => handlePress(onRemovePress) })) : undefined)));
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormatFileBottomSheet } from "./FormatFileBottomSheet";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineMessages } from "react-intl";
|
|
2
|
+
export const messages = defineMessages({
|
|
3
|
+
lightBoxPreviewButton: {
|
|
4
|
+
id: "lightBoxPreviewButton",
|
|
5
|
+
defaultMessage: "Preview {bottomSheetOptionsSuffix}",
|
|
6
|
+
description: "Label for button when preview the file",
|
|
7
|
+
},
|
|
8
|
+
removeButton: {
|
|
9
|
+
id: "removeButton",
|
|
10
|
+
defaultMessage: "Remove {bottomSheetOptionsSuffix}",
|
|
11
|
+
description: "Label for button when remove the file",
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { ImageBackground, View } from "react-native";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import { styles } from "./MediaView.style";
|
|
5
|
+
import { StatusCode } from "../../types";
|
|
6
|
+
import { computeA11yLabel } from "../../utils";
|
|
7
|
+
import { ActivityIndicator } from "../../../ActivityIndicator";
|
|
8
|
+
import { Icon } from "../../../Icon";
|
|
9
|
+
import { ProgressBar } from "../ProgressBar";
|
|
10
|
+
import { ErrorIcon } from "../ErrorIcon";
|
|
11
|
+
import { useAtlantisFormatFileContext } from "../../context/FormatFileContext";
|
|
12
|
+
export function MediaView({ accessibilityLabel, showOverlay, showError, file, styleInGrid, onUploadComplete, }) {
|
|
13
|
+
const { formatMessage } = useIntl();
|
|
14
|
+
const { useCreateThumbnail } = useAtlantisFormatFileContext();
|
|
15
|
+
const { thumbnail, error } = useCreateThumbnail(file);
|
|
16
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
17
|
+
const a11yLabel = computeA11yLabel({
|
|
18
|
+
accessibilityLabel,
|
|
19
|
+
showOverlay,
|
|
20
|
+
showError,
|
|
21
|
+
formatMessage,
|
|
22
|
+
});
|
|
23
|
+
const hasError = showError || error;
|
|
24
|
+
const uri = thumbnail || file.thumbnailUrl || file.source;
|
|
25
|
+
return (React.createElement(View, { accessible: true, accessibilityLabel: a11yLabel },
|
|
26
|
+
React.createElement(ImageBackground, { style: [
|
|
27
|
+
styles.imageBackground,
|
|
28
|
+
styleInGrid ? styles.imageBackgroundGrid : styles.imageBackgroundFlat,
|
|
29
|
+
], resizeMode: styleInGrid ? "cover" : "contain", source: { uri }, testID: "test-image", onLoadStart: () => setIsLoading(true), onLoadEnd: () => setIsLoading(false) },
|
|
30
|
+
React.createElement(Overlay, { isLoading: isLoading, showOverlay: showOverlay, hasError: hasError, file: file, onUploadComplete: onUploadComplete }))));
|
|
31
|
+
}
|
|
32
|
+
function Overlay({ isLoading, showOverlay, hasError, file, onUploadComplete, }) {
|
|
33
|
+
if (isLoading)
|
|
34
|
+
return React.createElement(ActivityIndicator, null);
|
|
35
|
+
if (hasError)
|
|
36
|
+
return React.createElement(ErrorOverlay, null);
|
|
37
|
+
if (showOverlay) {
|
|
38
|
+
return (React.createElement(ProgressOverlay, { status: file.status, progress: file.progress, onUploadComplete: onUploadComplete }));
|
|
39
|
+
}
|
|
40
|
+
if (isVideo(file.type) && file.showFileTypeIndicator) {
|
|
41
|
+
return React.createElement(Icon, { name: "video", color: "white" });
|
|
42
|
+
}
|
|
43
|
+
return React.createElement(React.Fragment, null);
|
|
44
|
+
}
|
|
45
|
+
function ProgressOverlay({ status, progress, onUploadComplete, }) {
|
|
46
|
+
const freezeProgressBar = status !== StatusCode.Completed && progress >= 0.9;
|
|
47
|
+
return (React.createElement(View, { style: [styles.imageBackground, styles.overlay], testID: "format-file-progress-bar-container" },
|
|
48
|
+
React.createElement(ProgressBar, { status: status, progress: freezeProgressBar ? 0.9 : progress, onComplete: onUploadComplete })));
|
|
49
|
+
}
|
|
50
|
+
function ErrorOverlay() {
|
|
51
|
+
return (React.createElement(View, { style: [styles.imageBackground, styles.overlayError], testID: "format-file-error-container" },
|
|
52
|
+
React.createElement(ErrorIcon, null)));
|
|
53
|
+
}
|
|
54
|
+
function isVideo(fileType = "") {
|
|
55
|
+
return fileType.includes("video");
|
|
56
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { tokens } from "../../../utils/design";
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
imageBackground: {
|
|
5
|
+
width: "100%",
|
|
6
|
+
justifyContent: "center",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
},
|
|
9
|
+
imageBackgroundFlat: {
|
|
10
|
+
aspectRatio: 375 / 150,
|
|
11
|
+
},
|
|
12
|
+
imageBackgroundGrid: {
|
|
13
|
+
height: "100%",
|
|
14
|
+
},
|
|
15
|
+
overlay: {
|
|
16
|
+
height: "100%",
|
|
17
|
+
backgroundColor: tokens["color-overlay--dimmed"],
|
|
18
|
+
paddingHorizontal: tokens["space-small"],
|
|
19
|
+
},
|
|
20
|
+
overlayError: {
|
|
21
|
+
height: "100%",
|
|
22
|
+
backgroundColor: tokens["color-overlay--dimmed"],
|
|
23
|
+
paddingHorizontal: tokens["space-small"],
|
|
24
|
+
borderColor: tokens["color-critical"],
|
|
25
|
+
borderWidth: tokens["border-base"],
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MediaView } from "./MediaView";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { Animated, View } from "react-native";
|
|
3
|
+
import { styles } from "./ProgressBar.style";
|
|
4
|
+
import { StatusCode } from "../../types";
|
|
5
|
+
export const ProgressBar = ({ progress, status, onComplete, }) => {
|
|
6
|
+
const barWidth = useRef(new Animated.Value(0)).current;
|
|
7
|
+
const progressPercentage = barWidth.interpolate({
|
|
8
|
+
inputRange: [0, 1],
|
|
9
|
+
outputRange: ["0%", `100%`],
|
|
10
|
+
});
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
Animated.timing(barWidth, {
|
|
13
|
+
toValue: progress,
|
|
14
|
+
duration: 500,
|
|
15
|
+
useNativeDriver: false,
|
|
16
|
+
}).start(({ finished }) => {
|
|
17
|
+
if (status === StatusCode.Completed && finished && onComplete) {
|
|
18
|
+
onComplete();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}, [progress, barWidth, onComplete, status]);
|
|
22
|
+
return (React.createElement(View, { testID: "format-file-progress-bar", style: styles.container },
|
|
23
|
+
React.createElement(Animated.View, { testID: "format-file-inner-progress-bar", style: [
|
|
24
|
+
styles.progress,
|
|
25
|
+
{
|
|
26
|
+
width: progressPercentage,
|
|
27
|
+
},
|
|
28
|
+
] })));
|
|
29
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { tokens } from "../../../utils/design";
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
width: "100%",
|
|
6
|
+
height: 8,
|
|
7
|
+
borderRadius: tokens["radius-circle"],
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
backgroundColor: tokens["color-surface--background"],
|
|
10
|
+
},
|
|
11
|
+
progress: {
|
|
12
|
+
height: "100%",
|
|
13
|
+
backgroundColor: tokens["color-green"],
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressBar } from "./ProgressBar";
|