diff --git a/package.json b/package.json index a2d21de0982..c43ccad689f 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "dependencies": { "@babel/plugin-transform-regenerator": "^7.18.6", "@gorhom/bottom-sheet": "^4.1.5", - "@pagopa/io-app-design-system": "1.13.0", + "@pagopa/io-app-design-system": "1.13.1", "@pagopa/io-pagopa-commons": "^3.1.0", "@pagopa/io-react-native-crypto": "^0.2.1", "@pagopa/io-react-native-login-utils": "^0.2.0", diff --git a/ts/components/ui/LoadingIndicator.tsx b/ts/components/ui/LoadingIndicator.tsx new file mode 100644 index 00000000000..e41d9debb9a --- /dev/null +++ b/ts/components/ui/LoadingIndicator.tsx @@ -0,0 +1,32 @@ +import * as React from "react"; +import { + LoadingSpinner, + useIOExperimentalDesign +} from "@pagopa/io-app-design-system"; +import I18n from "i18n-js"; +import { WithTestID } from "../../types/WithTestID"; + +export type LoadingIndicator = WithTestID< + Exclude< + React.ComponentProps, + "size" | "color" | "duration" + > +>; + +export const LoadingIndicator = ({ + accessibilityHint = I18n.t("global.accessibility.activityIndicator.hint"), + accessibilityLabel = I18n.t("global.accessibility.activityIndicator.label"), + testID = "LoadingIndicator" +}: LoadingIndicator) => { + const { isExperimental } = useIOExperimentalDesign(); + + return ( + + ); +}; diff --git a/ts/features/design-system/core/DSLoaders.tsx b/ts/features/design-system/core/DSLoaders.tsx index a3728a0c5ac..b9921a52fb7 100644 --- a/ts/features/design-system/core/DSLoaders.tsx +++ b/ts/features/design-system/core/DSLoaders.tsx @@ -6,12 +6,58 @@ import { hexToRgba, useIOTheme } from "@pagopa/io-app-design-system"; -import { View } from "react-native"; +import { View, StyleSheet } from "react-native"; import ActivityIndicator from "../../../components/ui/ActivityIndicator"; import { DesignSystemScreen } from "../components/DesignSystemScreen"; import I18n from "../../../i18n"; import { H2 } from "../../../components/core/typography/H2"; import { DSComponentViewerBox } from "../components/DSComponentViewerBox"; +import { LoadingIndicator } from "../../../components/ui/LoadingIndicator"; + +const styles = StyleSheet.create({ + spinnerOuter: { + alignSelf: "flex-start", + borderRadius: 16, + borderWidth: 1, + borderColor: hexToRgba(IOColors.black, 0.15), + padding: 16, + overflow: "hidden" + }, + sectionTitle: { + marginBottom: 16 + } +}); + +type SpinnerViewerBox = { + name: string; + children: React.ReactNode; + variant?: "default" | "primary"; +}; + +const viewerBackgroundMap: Record< + NonNullable, + IOColors +> = { + default: "white", + primary: "blueIO-500" +}; + +const SpinnerViewerBox = ({ + name, + children, + variant = "default" +}: SpinnerViewerBox) => ( + + + {children} + + +); export const DSLoaders = () => { const theme = useIOTheme(); @@ -19,69 +65,64 @@ export const DSLoaders = () => { return ( {/* Present in the main Messages screen */} -

+

Activity Indicator

- - - -

+ + + + + + +

Loading Spinner

- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + +

+ Loading Indicator +

+ + + ); }; diff --git a/yarn.lock b/yarn.lock index cc80dcf2e71..7ef48b41845 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3122,10 +3122,10 @@ dependencies: "@types/node" ">= 8" -"@pagopa/io-app-design-system@1.13.0": - version "1.13.0" - resolved "https://registry.yarnpkg.com/@pagopa/io-app-design-system/-/io-app-design-system-1.13.0.tgz#202352cf5c221f658bc164b493af50a7de581657" - integrity sha512-QeBmh1wvSeoU+2x3PXle1dRhxYgy00v4TeXRAbunz8p7PPmvC6EkpHveM3vdHnBhDEVMNiiAXkrFx59D4SbKpA== +"@pagopa/io-app-design-system@1.13.1": + version "1.13.1" + resolved "https://registry.yarnpkg.com/@pagopa/io-app-design-system/-/io-app-design-system-1.13.1.tgz#409c065e5cb96fe7dcf65c3550f32e795481ee78" + integrity sha512-99/ojMGrEEzDYSI9BzfCT8W774QGmRQfJdDv9hn9UohSTZSacOQJxWWYwYRQzeSYz/kYnj/v0nH0FP5bu7H/mw== dependencies: "@expo/vector-icons" "^13.0.0" "@pagopa/ts-commons" "^12.0.0"