@pagopa/io-app-design-system 1.11.2 → 1.12.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/lib/commonjs/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +1 -0
- package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +3 -0
- package/lib/commonjs/components/buttons/ButtonLink.js +3 -5
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +6 -6
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +6 -6
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +9 -0
- package/lib/commonjs/components/icons/Icon.js +6 -0
- package/lib/commonjs/components/icons/Icon.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconDocPaymentCode.js +31 -0
- package/lib/commonjs/components/icons/svg/IconDocPaymentCode.js.map +1 -0
- package/lib/commonjs/components/icons/svg/IconEntityCode.js +31 -0
- package/lib/commonjs/components/icons/svg/IconEntityCode.js.map +1 -0
- package/lib/commonjs/components/icons/svg/IconNotes.js +31 -0
- package/lib/commonjs/components/icons/svg/IconNotes.js.map +1 -0
- package/lib/commonjs/components/icons/svg/originals/IconDocPaymentCode.svg +3 -0
- package/lib/commonjs/components/icons/svg/originals/IconEntityCode.svg +3 -0
- package/lib/commonjs/components/icons/svg/originals/IconNotes.svg +3 -0
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/layout/Dismissable.js +60 -0
- package/lib/commonjs/components/layout/Dismissable.js.map +1 -0
- package/lib/commonjs/components/layout/HeaderFirstLevel.js +14 -5
- package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/commonjs/components/layout/HeaderSecondLevel.js +10 -7
- package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
- package/lib/commonjs/components/layout/common.js +6 -0
- package/lib/commonjs/components/layout/common.js.map +1 -0
- package/lib/commonjs/components/layout/index.js +11 -0
- package/lib/commonjs/components/layout/index.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js +5 -4
- package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +2 -0
- package/lib/commonjs/components/logos/LogoPaymentCard.js +50 -0
- package/lib/commonjs/components/logos/LogoPaymentCard.js.map +1 -0
- package/lib/commonjs/components/logos/LogoPaymentExt.js +1 -1
- package/lib/commonjs/components/logos/LogoPaymentExt.js.map +1 -1
- package/lib/commonjs/components/logos/README.md +2 -1
- package/lib/commonjs/components/logos/index.js +20 -1
- package/lib/commonjs/components/logos/index.js.map +1 -1
- package/lib/commonjs/components/logos/svg/LogoPaymentCardBancomatPay.js +33 -0
- package/lib/commonjs/components/logos/svg/LogoPaymentCardBancomatPay.js.map +1 -0
- package/lib/commonjs/components/logos/svg/LogoPaymentCardPayPal.js +42 -0
- package/lib/commonjs/components/logos/svg/LogoPaymentCardPayPal.js.map +1 -0
- package/lib/commonjs/components/logos/svg/originals/LogoPaymentCardBancomatPay.svg +18 -0
- package/lib/commonjs/components/logos/svg/originals/LogoPaymentCardPayPal.svg +30 -0
- package/lib/commonjs/components/toast/ToastNotification.js +73 -0
- package/lib/commonjs/components/toast/ToastNotification.js.map +1 -0
- package/lib/commonjs/components/toast/ToastProvider.js +135 -0
- package/lib/commonjs/components/toast/ToastProvider.js.map +1 -0
- package/lib/commonjs/components/toast/context.js +14 -0
- package/lib/commonjs/components/toast/context.js.map +1 -0
- package/lib/commonjs/components/toast/index.js +39 -0
- package/lib/commonjs/components/toast/index.js.map +1 -0
- package/lib/commonjs/components/toast/types.js +6 -0
- package/lib/commonjs/components/toast/types.js.map +1 -0
- package/lib/commonjs/components/toast/useIOToast.js +94 -0
- package/lib/commonjs/components/toast/useIOToast.js.map +1 -0
- package/lib/commonjs/components/typography/BaseTypography.js +3 -1
- package/lib/commonjs/components/typography/BaseTypography.js.map +1 -1
- package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +31 -0
- package/lib/module/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +1 -0
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +3 -0
- package/lib/module/components/buttons/ButtonLink.js +3 -5
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +6 -6
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +6 -6
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +9 -0
- package/lib/module/components/icons/Icon.js +6 -0
- package/lib/module/components/icons/Icon.js.map +1 -1
- package/lib/module/components/icons/svg/IconDocPaymentCode.js +23 -0
- package/lib/module/components/icons/svg/IconDocPaymentCode.js.map +1 -0
- package/lib/module/components/icons/svg/IconEntityCode.js +23 -0
- package/lib/module/components/icons/svg/IconEntityCode.js.map +1 -0
- package/lib/module/components/icons/svg/IconNotes.js +23 -0
- package/lib/module/components/icons/svg/IconNotes.js.map +1 -0
- package/lib/module/components/icons/svg/originals/IconDocPaymentCode.svg +3 -0
- package/lib/module/components/icons/svg/originals/IconEntityCode.svg +3 -0
- package/lib/module/components/icons/svg/originals/IconNotes.svg +3 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/layout/Dismissable.js +51 -0
- package/lib/module/components/layout/Dismissable.js.map +1 -0
- package/lib/module/components/layout/HeaderFirstLevel.js +14 -5
- package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/module/components/layout/HeaderSecondLevel.js +10 -7
- package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
- package/lib/module/components/layout/common.js +2 -0
- package/lib/module/components/layout/common.js.map +1 -0
- package/lib/module/components/layout/index.js +1 -0
- package/lib/module/components/layout/index.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js +5 -4
- package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +2 -0
- package/lib/module/components/logos/LogoPaymentCard.js +43 -0
- package/lib/module/components/logos/LogoPaymentCard.js.map +1 -0
- package/lib/module/components/logos/LogoPaymentExt.js +1 -1
- package/lib/module/components/logos/LogoPaymentExt.js.map +1 -1
- package/lib/module/components/logos/README.md +2 -1
- package/lib/module/components/logos/index.js +2 -0
- package/lib/module/components/logos/index.js.map +1 -1
- package/lib/module/components/logos/svg/LogoPaymentCardBancomatPay.js +25 -0
- package/lib/module/components/logos/svg/LogoPaymentCardBancomatPay.js.map +1 -0
- package/lib/module/components/logos/svg/LogoPaymentCardPayPal.js +34 -0
- package/lib/module/components/logos/svg/LogoPaymentCardPayPal.js.map +1 -0
- package/lib/module/components/logos/svg/originals/LogoPaymentCardBancomatPay.svg +18 -0
- package/lib/module/components/logos/svg/originals/LogoPaymentCardPayPal.svg +30 -0
- package/lib/module/components/toast/ToastNotification.js +66 -0
- package/lib/module/components/toast/ToastNotification.js.map +1 -0
- package/lib/module/components/toast/ToastProvider.js +123 -0
- package/lib/module/components/toast/ToastProvider.js.map +1 -0
- package/lib/module/components/toast/context.js +7 -0
- package/lib/module/components/toast/context.js.map +1 -0
- package/lib/module/components/toast/index.js +4 -0
- package/lib/module/components/toast/index.js.map +1 -0
- package/lib/module/components/toast/types.js +2 -0
- package/lib/module/components/toast/types.js.map +1 -0
- package/lib/module/components/toast/useIOToast.js +84 -0
- package/lib/module/components/toast/useIOToast.js.map +1 -0
- package/lib/module/components/typography/BaseTypography.js +3 -1
- package/lib/module/components/typography/BaseTypography.js.map +1 -1
- package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +31 -0
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/icons/Icon.d.ts +3 -0
- package/lib/typescript/components/icons/Icon.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconDocPaymentCode.d.ts +5 -0
- package/lib/typescript/components/icons/svg/IconDocPaymentCode.d.ts.map +1 -0
- package/lib/typescript/components/icons/svg/IconEntityCode.d.ts +5 -0
- package/lib/typescript/components/icons/svg/IconEntityCode.d.ts.map +1 -0
- package/lib/typescript/components/icons/svg/IconNotes.d.ts +5 -0
- package/lib/typescript/components/icons/svg/IconNotes.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/layout/Dismissable.d.ts +18 -0
- package/lib/typescript/components/layout/Dismissable.d.ts.map +1 -0
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts +28 -5
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
- package/lib/typescript/components/layout/HeaderSecondLevel.d.ts +8 -3
- package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
- package/lib/typescript/components/layout/common.d.ts +4 -0
- package/lib/typescript/components/layout/common.d.ts.map +1 -0
- package/lib/typescript/components/layout/index.d.ts +1 -0
- package/lib/typescript/components/layout/index.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts +8 -6
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
- package/lib/typescript/components/logos/LogoPaymentCard.d.ts +19 -0
- package/lib/typescript/components/logos/LogoPaymentCard.d.ts.map +1 -0
- package/lib/typescript/components/logos/index.d.ts +2 -0
- package/lib/typescript/components/logos/index.d.ts.map +1 -1
- package/lib/typescript/components/logos/svg/LogoPaymentCardBancomatPay.d.ts +5 -0
- package/lib/typescript/components/logos/svg/LogoPaymentCardBancomatPay.d.ts.map +1 -0
- package/lib/typescript/components/logos/svg/LogoPaymentCardPayPal.d.ts +5 -0
- package/lib/typescript/components/logos/svg/LogoPaymentCardPayPal.d.ts.map +1 -0
- package/lib/typescript/components/radio/RadioGroup.d.ts +2 -2
- package/lib/typescript/components/radio/RadioGroup.d.ts.map +1 -1
- package/lib/typescript/components/toast/ToastNotification.d.ts +6 -0
- package/lib/typescript/components/toast/ToastNotification.d.ts.map +1 -0
- package/lib/typescript/components/toast/ToastProvider.d.ts +22 -0
- package/lib/typescript/components/toast/ToastProvider.d.ts.map +1 -0
- package/lib/typescript/components/toast/context.d.ts +9 -0
- package/lib/typescript/components/toast/context.d.ts.map +1 -0
- package/lib/typescript/components/toast/index.d.ts +4 -0
- package/lib/typescript/components/toast/index.d.ts.map +1 -0
- package/lib/typescript/components/toast/types.d.ts +11 -0
- package/lib/typescript/components/toast/types.d.ts.map +1 -0
- package/lib/typescript/components/toast/useIOToast.d.ts +23 -0
- package/lib/typescript/components/toast/useIOToast.d.ts.map +1 -0
- package/package.json +3 -1
- package/src/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +1 -0
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +3 -0
- package/src/components/buttons/ButtonLink.tsx +2 -4
- package/src/components/buttons/ButtonOutline.tsx +3 -4
- package/src/components/buttons/ButtonSolid.tsx +3 -4
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +9 -0
- package/src/components/icons/Icon.tsx +6 -0
- package/src/components/icons/svg/IconDocPaymentCode.tsx +16 -0
- package/src/components/icons/svg/IconEntityCode.tsx +16 -0
- package/src/components/icons/svg/IconNotes.tsx +16 -0
- package/src/components/icons/svg/originals/IconDocPaymentCode.svg +3 -0
- package/src/components/icons/svg/originals/IconEntityCode.svg +3 -0
- package/src/components/icons/svg/originals/IconNotes.svg +3 -0
- package/src/components/index.tsx +1 -0
- package/src/components/layout/Dismissable.tsx +76 -0
- package/src/components/layout/HeaderFirstLevel.tsx +42 -13
- package/src/components/layout/HeaderSecondLevel.tsx +22 -18
- package/src/components/layout/common.ts +7 -0
- package/src/components/layout/index.tsx +1 -0
- package/src/components/listitems/ListItemTransaction.tsx +25 -10
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +2 -0
- package/src/components/logos/LogoPaymentCard.tsx +62 -0
- package/src/components/logos/LogoPaymentExt.tsx +1 -1
- package/src/components/logos/README.md +2 -1
- package/src/components/logos/index.tsx +2 -0
- package/src/components/logos/svg/LogoPaymentCardBancomatPay.tsx +28 -0
- package/src/components/logos/svg/LogoPaymentCardPayPal.tsx +38 -0
- package/src/components/logos/svg/originals/LogoPaymentCardBancomatPay.svg +18 -0
- package/src/components/logos/svg/originals/LogoPaymentCardPayPal.svg +30 -0
- package/src/components/radio/RadioGroup.tsx +2 -2
- package/src/components/toast/ToastNotification.tsx +76 -0
- package/src/components/toast/ToastProvider.tsx +153 -0
- package/src/components/toast/context.ts +14 -0
- package/src/components/toast/index.ts +3 -0
- package/src/components/toast/types.ts +13 -0
- package/src/components/toast/useIOToast.ts +88 -0
- package/src/components/typography/BaseTypography.tsx +1 -1
- package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +31 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The maximum number of toasts that can be displayed at the same time
|
|
4
|
+
* If the number of the toasts exceeds this number, the oldest one will be removed
|
|
5
|
+
*/
|
|
6
|
+
export declare const MAX_TOAST_STACK_SIZE = 3;
|
|
7
|
+
/**
|
|
8
|
+
* The time in milliseconds that a toast notification will be displayed
|
|
9
|
+
*/
|
|
10
|
+
export declare const TOAST_DURATION_TIME = 5000;
|
|
11
|
+
/**
|
|
12
|
+
* This is the time in milliseconds between two toast notifications.
|
|
13
|
+
* This will throttle the toast notifications to avoid displaying too many of them at the same time
|
|
14
|
+
* and causing visual glitches.
|
|
15
|
+
*/
|
|
16
|
+
export declare const TOAST_THROTTLE_TIME = 500;
|
|
17
|
+
type ToastProviderProps = {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
export declare const ToastProvider: ({ children }: ToastProviderProps) => React.JSX.Element;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=ToastProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/toast/ToastProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAe1B;;;GAGG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAyBvC,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,aAAa,iBAAkB,kBAAkB,sBAqE7D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Toast } from "./types";
|
|
3
|
+
export type ToastContext = {
|
|
4
|
+
addToast: (props: Toast) => number;
|
|
5
|
+
removeToast: (id: number) => void;
|
|
6
|
+
removeAllToasts: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const ToastContext: import("react").Context<ToastContext>;
|
|
9
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/toast/context.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;IACnC,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,YAAY,uCAIvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/toast/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HapticFeedbackTypes } from "react-native-haptic-feedback";
|
|
2
|
+
import { IOIcons } from "@pagopa/io-app-design-system";
|
|
3
|
+
export type ToastVariant = "neutral" | "error" | "info" | "success" | "warning";
|
|
4
|
+
export type Toast = {
|
|
5
|
+
message: string;
|
|
6
|
+
variant?: ToastVariant;
|
|
7
|
+
icon?: IOIcons;
|
|
8
|
+
hapticFeedback?: keyof typeof HapticFeedbackTypes;
|
|
9
|
+
};
|
|
10
|
+
export type ToastOptions = Omit<Toast, "message">;
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/toast/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhF,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,OAAO,mBAAmB,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ToastOptions } from "./types";
|
|
3
|
+
export declare const useIOToast: () => {
|
|
4
|
+
show: (message: string, options?: ToastOptions) => void;
|
|
5
|
+
error: (message: string) => void;
|
|
6
|
+
info: (message: string) => void;
|
|
7
|
+
success: (message: string) => void;
|
|
8
|
+
warning: (message: string) => void;
|
|
9
|
+
hide: (id: number) => void;
|
|
10
|
+
hideAll: () => void;
|
|
11
|
+
};
|
|
12
|
+
export type IOToast = ReturnType<typeof useIOToast>;
|
|
13
|
+
export declare const IOToastRef: React.MutableRefObject<{
|
|
14
|
+
show: (message: string, options?: ToastOptions) => void;
|
|
15
|
+
error: (message: string) => void;
|
|
16
|
+
info: (message: string) => void;
|
|
17
|
+
success: (message: string) => void;
|
|
18
|
+
warning: (message: string) => void;
|
|
19
|
+
hide: (id: number) => void;
|
|
20
|
+
hideAll: () => void;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const IOToast: IOToast;
|
|
23
|
+
//# sourceMappingURL=useIOToast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIOToast.d.ts","sourceRoot":"","sources":["../../../../src/components/toast/useIOToast.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,eAAO,MAAM,UAAU;oBAKT,MAAM,YAAY,YAAY;qBAO9B,MAAM;oBAWN,MAAM;uBAWN,MAAM;uBAWN,MAAM;;;CAsBnB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,UAAU;oBAlET,MAAM,YAAY,YAAY;qBAO9B,MAAM;oBAWN,MAAM;uBAWN,MAAM;uBAWN,MAAM;;;EA2BqC,CAAC;AAE1D,eAAO,MAAM,OAAO,EAAE,OASrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/io-app-design-system",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "The library defining the core components of the design system of @pagopa/io-app",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"@storybook/react-webpack5": "^7.4.0",
|
|
68
68
|
"@storybook/testing-library": "^0.2.0",
|
|
69
69
|
"@types/jest": "^28.1.2",
|
|
70
|
+
"@types/lodash": "^4.14.157",
|
|
70
71
|
"@types/react": "~17.0.38",
|
|
71
72
|
"@types/react-native": "0.70.0",
|
|
72
73
|
"babel-loader": "^9.1.3",
|
|
@@ -170,6 +171,7 @@
|
|
|
170
171
|
]
|
|
171
172
|
},
|
|
172
173
|
"dependencies": {
|
|
174
|
+
"lodash": "^4.17.21",
|
|
173
175
|
"@expo/vector-icons": "^13.0.0",
|
|
174
176
|
"@pagopa/ts-commons": "^12.0.0",
|
|
175
177
|
"@testing-library/jest-native": "^5.4.2",
|
|
@@ -70,6 +70,7 @@ exports[`Test Banner Components Banner Snapshot 1`] = `
|
|
|
70
70
|
}
|
|
71
71
|
>
|
|
72
72
|
<Text
|
|
73
|
+
allowFontScaling={false}
|
|
73
74
|
color="blueIO-850"
|
|
74
75
|
defaultColor="black"
|
|
75
76
|
defaultWeight="SemiBold"
|
|
@@ -184,7 +185,9 @@ exports[`Test Banner Components Banner Snapshot 1`] = `
|
|
|
184
185
|
}
|
|
185
186
|
>
|
|
186
187
|
<Text
|
|
188
|
+
allowFontScaling={false}
|
|
187
189
|
ellipsizeMode="tail"
|
|
190
|
+
maxFontSizeMultiplier={1.3}
|
|
188
191
|
numberOfLines={1}
|
|
189
192
|
style={
|
|
190
193
|
[
|
|
@@ -236,10 +236,8 @@ export const ButtonLink = React.memo(
|
|
|
236
236
|
]}
|
|
237
237
|
numberOfLines={1}
|
|
238
238
|
ellipsizeMode="tail"
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
/* allowFontScaling
|
|
242
|
-
maxFontSizeMultiplier={1.3} */
|
|
239
|
+
allowFontScaling={isExperimental}
|
|
240
|
+
maxFontSizeMultiplier={1.3}
|
|
243
241
|
>
|
|
244
242
|
{label}
|
|
245
243
|
</Animated.Text>
|
|
@@ -332,6 +332,7 @@ export const ButtonOutline = ({
|
|
|
332
332
|
<Animated.View
|
|
333
333
|
style={[
|
|
334
334
|
buttonStyles.button,
|
|
335
|
+
isExperimental && fullWidth && { paddingHorizontal: 16 },
|
|
335
336
|
buttonStylesLocal.buttonWithBorder,
|
|
336
337
|
buttonStyles.buttonSizeDefault,
|
|
337
338
|
iconPosition === "end" && { flexDirection: "row-reverse" },
|
|
@@ -380,10 +381,8 @@ export const ButtonOutline = ({
|
|
|
380
381
|
]}
|
|
381
382
|
numberOfLines={1}
|
|
382
383
|
ellipsizeMode="tail"
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
/* allowFontScaling
|
|
386
|
-
maxFontSizeMultiplier={1.3} */
|
|
384
|
+
allowFontScaling={isExperimental}
|
|
385
|
+
maxFontSizeMultiplier={1.3}
|
|
387
386
|
>
|
|
388
387
|
{label}
|
|
389
388
|
</Animated.Text>
|
|
@@ -232,6 +232,7 @@ export const ButtonSolid = React.memo(
|
|
|
232
232
|
<Animated.View
|
|
233
233
|
style={[
|
|
234
234
|
buttonStyles.button,
|
|
235
|
+
isExperimental && fullWidth && { paddingHorizontal: 16 },
|
|
235
236
|
iconPosition === "end" && { flexDirection: "row-reverse" },
|
|
236
237
|
buttonStyles.buttonSizeDefault,
|
|
237
238
|
disabled
|
|
@@ -259,10 +260,8 @@ export const ButtonSolid = React.memo(
|
|
|
259
260
|
style={IOButtonStyles.label}
|
|
260
261
|
numberOfLines={1}
|
|
261
262
|
ellipsizeMode="tail"
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
/* allowFontScaling
|
|
265
|
-
maxFontSizeMultiplier={1.3} */
|
|
263
|
+
allowFontScaling={isExperimental}
|
|
264
|
+
maxFontSizeMultiplier={1.3}
|
|
266
265
|
>
|
|
267
266
|
{label}
|
|
268
267
|
</ButtonText>
|
|
@@ -67,6 +67,7 @@ exports[`Test Buttons Components ButtonExtendedOutline Snapshot 1`] = `
|
|
|
67
67
|
}
|
|
68
68
|
>
|
|
69
69
|
<Text
|
|
70
|
+
allowFontScaling={false}
|
|
70
71
|
color="black"
|
|
71
72
|
defaultColor="black"
|
|
72
73
|
defaultWeight="SemiBold"
|
|
@@ -232,7 +233,9 @@ exports[`Test Buttons Components ButtonLink Snapshot 1`] = `
|
|
|
232
233
|
}
|
|
233
234
|
>
|
|
234
235
|
<Text
|
|
236
|
+
allowFontScaling={false}
|
|
235
237
|
ellipsizeMode="tail"
|
|
238
|
+
maxFontSizeMultiplier={1.3}
|
|
236
239
|
numberOfLines={1}
|
|
237
240
|
style={
|
|
238
241
|
[
|
|
@@ -308,6 +311,7 @@ exports[`Test Buttons Components ButtonOutline Snapshot 1`] = `
|
|
|
308
311
|
"paddingHorizontal": 16,
|
|
309
312
|
"textAlignVertical": "center",
|
|
310
313
|
},
|
|
314
|
+
false,
|
|
311
315
|
{
|
|
312
316
|
"borderWidth": 1,
|
|
313
317
|
},
|
|
@@ -332,7 +336,9 @@ exports[`Test Buttons Components ButtonOutline Snapshot 1`] = `
|
|
|
332
336
|
}
|
|
333
337
|
>
|
|
334
338
|
<Text
|
|
339
|
+
allowFontScaling={false}
|
|
335
340
|
ellipsizeMode="tail"
|
|
341
|
+
maxFontSizeMultiplier={1.3}
|
|
336
342
|
numberOfLines={1}
|
|
337
343
|
style={
|
|
338
344
|
[
|
|
@@ -411,6 +417,7 @@ exports[`Test Buttons Components ButtonSolid Snapshot 1`] = `
|
|
|
411
417
|
"textAlignVertical": "center",
|
|
412
418
|
},
|
|
413
419
|
false,
|
|
420
|
+
false,
|
|
414
421
|
{
|
|
415
422
|
"height": 40,
|
|
416
423
|
},
|
|
@@ -429,6 +436,7 @@ exports[`Test Buttons Components ButtonSolid Snapshot 1`] = `
|
|
|
429
436
|
}
|
|
430
437
|
>
|
|
431
438
|
<Text
|
|
439
|
+
allowFontScaling={false}
|
|
432
440
|
color="white"
|
|
433
441
|
defaultColor="white"
|
|
434
442
|
defaultWeight="Bold"
|
|
@@ -439,6 +447,7 @@ exports[`Test Buttons Components ButtonSolid Snapshot 1`] = `
|
|
|
439
447
|
"fontSize": 16,
|
|
440
448
|
}
|
|
441
449
|
}
|
|
450
|
+
maxFontSizeMultiplier={1.3}
|
|
442
451
|
numberOfLines={1}
|
|
443
452
|
style={
|
|
444
453
|
[
|
|
@@ -157,6 +157,9 @@ import IconContactless from "./svg/IconContactless";
|
|
|
157
157
|
import IconDisabilityCard from "./svg/IconDisabilityCard";
|
|
158
158
|
import IconDriverLicense from "./svg/IconDriverLicense";
|
|
159
159
|
import IconHealthCard from "./svg/IconHealthCard";
|
|
160
|
+
import IconDocPaymentCode from "./svg/IconDocPaymentCode";
|
|
161
|
+
import IconNotes from "./svg/IconNotes";
|
|
162
|
+
import IconEntityCode from "./svg/IconEntityCode";
|
|
160
163
|
|
|
161
164
|
export const IOIcons = {
|
|
162
165
|
archive: IconArchive,
|
|
@@ -200,13 +203,16 @@ export const IOIcons = {
|
|
|
200
203
|
option: IconOption,
|
|
201
204
|
key: IconKey,
|
|
202
205
|
docGiacenza: IconGiacenza,
|
|
206
|
+
docPaymentCode: IconDocPaymentCode,
|
|
203
207
|
docAttach: IconDocumentAttachment,
|
|
204
208
|
docAttachPDF: IconDocumentAttachmentPDF,
|
|
209
|
+
notes: IconNotes,
|
|
205
210
|
attachment: IconAttachment,
|
|
206
211
|
add: IconAdd,
|
|
207
212
|
success: IconSuccess,
|
|
208
213
|
ok: IconOk,
|
|
209
214
|
fiscalCodeIndividual: IconFiscalCodeIndividual,
|
|
215
|
+
entityCode: IconEntityCode,
|
|
210
216
|
creditCard: IconCreditCard,
|
|
211
217
|
bonus: IconBonus,
|
|
212
218
|
transactionsBoxed: IconTransactionsBoxed,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Svg, Path } from "react-native-svg";
|
|
3
|
+
import { SVGIconProps } from "../Icon";
|
|
4
|
+
|
|
5
|
+
const IconDocPaymentCode = ({ size, style, ...props }: SVGIconProps) => (
|
|
6
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" style={style} {...props}>
|
|
7
|
+
<Path
|
|
8
|
+
fillRule="evenodd"
|
|
9
|
+
clipRule="evenodd"
|
|
10
|
+
d="M5 2C3.34315 2 2 3.34315 2 5V19C2 20.6569 3.34315 22 5 22H19C20.6569 22 22 20.6569 22 19V10H17C15.3431 10 14 8.65685 14 7V2H5ZM16 2.49902V7C16 7.55229 16.4477 8 17 8H21.501C21.3911 7.83409 21.2641 7.67835 21.1213 7.53553L16.4645 2.87868C16.3216 2.73586 16.1659 2.60893 16 2.49902ZM0 5C0 2.23858 2.23858 0 5 0H14.3431C15.6692 0 16.941 0.526784 17.8787 1.46447L22.5355 6.12132C23.4732 7.059 24 8.33077 24 9.65685V19C24 21.7614 21.7614 24 19 24H5C2.23858 24 0 21.7614 0 19V5ZM5 17.5C5 16.6716 5.67157 16 6.5 16C7.32843 16 8 16.6716 8 17.5C8 18.3284 7.32843 19 6.5 19C5.67157 19 5 18.3284 5 17.5ZM10 17.5C10 16.6716 10.6716 16 11.5 16H14.5C15.3284 16 16 16.6716 16 17.5C16 18.3284 15.3284 19 14.5 19H11.5C10.6716 19 10 18.3284 10 17.5Z"
|
|
11
|
+
fill="currentColor"
|
|
12
|
+
/>
|
|
13
|
+
</Svg>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default IconDocPaymentCode;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Svg, Path } from "react-native-svg";
|
|
3
|
+
import { SVGIconProps } from "../Icon";
|
|
4
|
+
|
|
5
|
+
const IconEntityCode = ({ size, style, ...props }: SVGIconProps) => (
|
|
6
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" style={style} {...props}>
|
|
7
|
+
<Path
|
|
8
|
+
fillRule="evenodd"
|
|
9
|
+
clipRule="evenodd"
|
|
10
|
+
d="M4 4H20C21.1046 4 22 4.89543 22 6V18C22 19.1046 21.1046 20 20 20H4C2.89543 20 2 19.1046 2 18V6C2 4.89543 2.89543 4 4 4ZM0 6C0 3.79086 1.79086 2 4 2H20C22.2091 2 24 3.79086 24 6V18C24 20.2091 22.2091 22 20 22H4C1.79086 22 0 20.2091 0 18V6ZM7.20416 8.26887C7.76751 7.91038 8.48744 7.91038 9.05078 8.26887L11.7771 10.0038C12.0747 10.1932 12.2549 10.5215 12.2549 10.8743V11.5286C12.2549 11.7185 12.1009 11.8725 11.911 11.8725H11.567V15.656C11.567 15.846 11.413 16 11.2231 16H9.84725C9.65729 16 9.5033 15.846 9.5033 15.656V11.8725H6.75165V15.656C6.75165 15.846 6.59765 16 6.40769 16H5.03187C4.84191 16 4.68791 15.846 4.68791 15.656V11.8725H4.34396C4.15399 11.8725 4 11.7185 4 11.5286V10.8743C4 10.5215 4.18024 10.1932 4.47788 10.0038L7.20416 8.26887ZM15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11H17C17.5523 11 18 10.5523 18 10C18 9.44772 17.5523 9 17 9H15ZM14 14C14 13.4477 14.4477 13 15 13H19C19.5523 13 20 13.4477 20 14C20 14.5523 19.5523 15 19 15H15C14.4477 15 14 14.5523 14 14Z"
|
|
11
|
+
fill="currentColor"
|
|
12
|
+
/>
|
|
13
|
+
</Svg>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default IconEntityCode;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Svg, Path } from "react-native-svg";
|
|
3
|
+
import { SVGIconProps } from "../Icon";
|
|
4
|
+
|
|
5
|
+
const IconNotes = ({ size, style, ...props }: SVGIconProps) => (
|
|
6
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" style={style} {...props}>
|
|
7
|
+
<Path
|
|
8
|
+
fillRule="evenodd"
|
|
9
|
+
clipRule="evenodd"
|
|
10
|
+
d="M5 2C3.34315 2 2 3.34315 2 5V19C2 20.6569 3.34315 22 5 22H19C20.6569 22 22 20.6569 22 19V10H17C15.3431 10 14 8.65685 14 7V2H5ZM16 2.49902V7C16 7.55229 16.4477 8 17 8H21.501C21.3911 7.83409 21.2641 7.67835 21.1213 7.53553L16.4645 2.87868C16.3216 2.73586 16.1659 2.60893 16 2.49902ZM0 5C0 2.23858 2.23858 0 5 0H14.3431C15.6692 0 16.941 0.526784 17.8787 1.46447L22.5355 6.12132C23.4732 7.059 24 8.33077 24 9.65685V19C24 21.7614 21.7614 24 19 24H5C2.23858 24 0 21.7614 0 19V5ZM5 6.5C5 5.67157 5.67157 5 6.5 5H9.5C10.3284 5 11 5.67157 11 6.5C11 7.32843 10.3284 8 9.5 8H6.5C5.67157 8 5 7.32843 5 6.5ZM6 13C5.44772 13 5 13.4477 5 14C5 14.5523 5.44772 15 6 15H18C18.5523 15 19 14.5523 19 14C19 13.4477 18.5523 13 18 13H6ZM5 18C5 17.4477 5.44772 17 6 17H18C18.5523 17 19 17.4477 19 18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18Z"
|
|
11
|
+
fill="currentColor"
|
|
12
|
+
/>
|
|
13
|
+
</Svg>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default IconNotes;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 2C3.34315 2 2 3.34315 2 5V19C2 20.6569 3.34315 22 5 22H19C20.6569 22 22 20.6569 22 19V10H17C15.3431 10 14 8.65685 14 7V2H5ZM16 2.49902V7C16 7.55229 16.4477 8 17 8H21.501C21.3911 7.83409 21.2641 7.67835 21.1213 7.53553L16.4645 2.87868C16.3216 2.73586 16.1659 2.60893 16 2.49902ZM0 5C0 2.23858 2.23858 0 5 0H14.3431C15.6692 0 16.941 0.526784 17.8787 1.46447L22.5355 6.12132C23.4732 7.059 24 8.33077 24 9.65685V19C24 21.7614 21.7614 24 19 24H5C2.23858 24 0 21.7614 0 19V5ZM5 17.5C5 16.6716 5.67157 16 6.5 16C7.32843 16 8 16.6716 8 17.5C8 18.3284 7.32843 19 6.5 19C5.67157 19 5 18.3284 5 17.5ZM10 17.5C10 16.6716 10.6716 16 11.5 16H14.5C15.3284 16 16 16.6716 16 17.5C16 18.3284 15.3284 19 14.5 19H11.5C10.6716 19 10 18.3284 10 17.5Z" fill="#BBC2D6"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 4H20C21.1046 4 22 4.89543 22 6V18C22 19.1046 21.1046 20 20 20H4C2.89543 20 2 19.1046 2 18V6C2 4.89543 2.89543 4 4 4ZM0 6C0 3.79086 1.79086 2 4 2H20C22.2091 2 24 3.79086 24 6V18C24 20.2091 22.2091 22 20 22H4C1.79086 22 0 20.2091 0 18V6ZM7.20416 8.26887C7.76751 7.91038 8.48744 7.91038 9.05078 8.26887L11.7771 10.0038C12.0747 10.1932 12.2549 10.5215 12.2549 10.8743V11.5286C12.2549 11.7185 12.1009 11.8725 11.911 11.8725H11.567V15.656C11.567 15.846 11.413 16 11.2231 16H9.84725C9.65729 16 9.5033 15.846 9.5033 15.656V11.8725H6.75165V15.656C6.75165 15.846 6.59765 16 6.40769 16H5.03187C4.84191 16 4.68791 15.846 4.68791 15.656V11.8725H4.34396C4.15399 11.8725 4 11.7185 4 11.5286V10.8743C4 10.5215 4.18024 10.1932 4.47788 10.0038L7.20416 8.26887ZM15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11H17C17.5523 11 18 10.5523 18 10C18 9.44772 17.5523 9 17 9H15ZM14 14C14 13.4477 14.4477 13 15 13H19C19.5523 13 20 13.4477 20 14C20 14.5523 19.5523 15 19 15H15C14.4477 15 14 14.5523 14 14Z" fill="#2B2E38"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 2C3.34315 2 2 3.34315 2 5V19C2 20.6569 3.34315 22 5 22H19C20.6569 22 22 20.6569 22 19V10H17C15.3431 10 14 8.65685 14 7V2H5ZM16 2.49902V7C16 7.55229 16.4477 8 17 8H21.501C21.3911 7.83409 21.2641 7.67835 21.1213 7.53553L16.4645 2.87868C16.3216 2.73586 16.1659 2.60893 16 2.49902ZM0 5C0 2.23858 2.23858 0 5 0H14.3431C15.6692 0 16.941 0.526784 17.8787 1.46447L22.5355 6.12132C23.4732 7.059 24 8.33077 24 9.65685V19C24 21.7614 21.7614 24 19 24H5C2.23858 24 0 21.7614 0 19V5ZM5 6.5C5 5.67157 5.67157 5 6.5 5H9.5C10.3284 5 11 5.67157 11 6.5C11 7.32843 10.3284 8 9.5 8H6.5C5.67157 8 5 7.32843 5 6.5ZM6 13C5.44772 13 5 13.4477 5 14C5 14.5523 5.44772 15 6 15H18C18.5523 15 19 14.5523 19 14C19 13.4477 18.5523 13 18 13H6ZM5 18C5 17.4477 5.44772 17 6 17H18C18.5523 17 19 17.4477 19 18C19 18.5523 18.5523 19 18 19H6C5.44772 19 5 18.5523 5 18Z" fill="#BBC2D6"/>
|
|
3
|
+
</svg>
|
package/src/components/index.tsx
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Dimensions } from "react-native";
|
|
3
|
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
4
|
+
import Animated, {
|
|
5
|
+
Easing,
|
|
6
|
+
runOnJS,
|
|
7
|
+
useAnimatedStyle,
|
|
8
|
+
useSharedValue,
|
|
9
|
+
withSpring,
|
|
10
|
+
withTiming
|
|
11
|
+
} from "react-native-reanimated";
|
|
12
|
+
import { WithTestID } from "../../utils/types";
|
|
13
|
+
|
|
14
|
+
const windowWidth = Dimensions.get("window").width;
|
|
15
|
+
|
|
16
|
+
type Dismissable = WithTestID<{
|
|
17
|
+
onDismiss?: () => void;
|
|
18
|
+
dismissThreshold?: number;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Component that allows for a dismissable gesture, both left and right.
|
|
24
|
+
* When the threshold is reached, the `onDismiss` callback is called.
|
|
25
|
+
* @param onDismiss Callback to be called when the threshold is reached.
|
|
26
|
+
* @param dismissThreshold Threshold to be reached to call the `onDismiss` callback.
|
|
27
|
+
* @param children Children to be rendered inside the component.
|
|
28
|
+
* @returns A dismissable component.
|
|
29
|
+
*/
|
|
30
|
+
const Dismissable = ({
|
|
31
|
+
onDismiss = () => undefined,
|
|
32
|
+
dismissThreshold = windowWidth / 3,
|
|
33
|
+
children,
|
|
34
|
+
testID
|
|
35
|
+
}: Dismissable) => {
|
|
36
|
+
const translateX = useSharedValue(0);
|
|
37
|
+
|
|
38
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
39
|
+
transform: [
|
|
40
|
+
{
|
|
41
|
+
translateX: translateX.value
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
const pan = Gesture.Pan()
|
|
47
|
+
.onUpdate(event => {
|
|
48
|
+
// eslint-disable-next-line functional/immutable-data
|
|
49
|
+
translateX.value = event.translationX;
|
|
50
|
+
})
|
|
51
|
+
.onEnd(event => {
|
|
52
|
+
if (Math.abs(event.translationX) > dismissThreshold) {
|
|
53
|
+
// eslint-disable-next-line functional/immutable-data
|
|
54
|
+
translateX.value = withTiming(
|
|
55
|
+
windowWidth * Math.sign(event.translationX),
|
|
56
|
+
{
|
|
57
|
+
duration: 300,
|
|
58
|
+
easing: Easing.inOut(Easing.exp)
|
|
59
|
+
},
|
|
60
|
+
runOnJS(onDismiss)
|
|
61
|
+
);
|
|
62
|
+
} else {
|
|
63
|
+
// eslint-disable-next-line functional/immutable-data
|
|
64
|
+
translateX.value = withSpring(0, { mass: 0.5 });
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
.withTestId(testID ?? "");
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<GestureDetector gesture={pan}>
|
|
71
|
+
<Animated.View style={animatedStyle}>{children}</Animated.View>
|
|
72
|
+
</GestureDetector>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { Dismissable };
|
|
@@ -5,16 +5,43 @@ import { WithTestID } from "../../utils/types";
|
|
|
5
5
|
import { IOStyles, IOVisualCostants, IOColors } from "../../core";
|
|
6
6
|
import { H3 } from "../typography";
|
|
7
7
|
import { HSpacer } from "../spacer";
|
|
8
|
+
import { IconButton } from "../buttons";
|
|
9
|
+
import { ActionProp } from "./common";
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
type CommonProps = WithTestID<{
|
|
10
12
|
title: string;
|
|
11
|
-
// Accepted components: IconButton
|
|
12
|
-
// Don't use any components other than this, please.
|
|
13
|
-
firstAction?: React.ReactNode;
|
|
14
|
-
secondAction?: React.ReactNode;
|
|
15
|
-
thirdAction?: React.ReactNode;
|
|
16
13
|
}>;
|
|
17
14
|
|
|
15
|
+
interface Base extends CommonProps {
|
|
16
|
+
type: "base";
|
|
17
|
+
firstAction?: never;
|
|
18
|
+
secondAction?: never;
|
|
19
|
+
thirdAction?: never;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface OneAction extends CommonProps {
|
|
23
|
+
type: "singleAction";
|
|
24
|
+
firstAction: ActionProp;
|
|
25
|
+
secondAction?: never;
|
|
26
|
+
thirdAction?: never;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface TwoActions extends CommonProps {
|
|
30
|
+
type: "twoActions";
|
|
31
|
+
firstAction: ActionProp;
|
|
32
|
+
secondAction: ActionProp;
|
|
33
|
+
thirdAction?: never;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface ThreeActions extends CommonProps {
|
|
37
|
+
type: "threeActions";
|
|
38
|
+
firstAction: ActionProp;
|
|
39
|
+
secondAction: ActionProp;
|
|
40
|
+
thirdAction: ActionProp;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type HeaderFirstLevel = Base | OneAction | TwoActions | ThreeActions;
|
|
44
|
+
|
|
18
45
|
const HEADER_BG_COLOR: IOColors = "white";
|
|
19
46
|
|
|
20
47
|
const styles = StyleSheet.create({
|
|
@@ -30,10 +57,11 @@ const styles = StyleSheet.create({
|
|
|
30
57
|
|
|
31
58
|
export const HeaderFirstLevel = ({
|
|
32
59
|
title,
|
|
60
|
+
type,
|
|
61
|
+
testID,
|
|
33
62
|
firstAction,
|
|
34
63
|
secondAction,
|
|
35
|
-
thirdAction
|
|
36
|
-
testID
|
|
64
|
+
thirdAction
|
|
37
65
|
}: HeaderFirstLevel) => {
|
|
38
66
|
const insets = useSafeAreaInsets();
|
|
39
67
|
|
|
@@ -51,20 +79,21 @@ export const HeaderFirstLevel = ({
|
|
|
51
79
|
{title}
|
|
52
80
|
</H3>
|
|
53
81
|
<View style={[IOStyles.row, { flexShrink: 0 }]}>
|
|
54
|
-
{firstAction}
|
|
55
|
-
{
|
|
82
|
+
{type !== "base" && <IconButton {...firstAction} color="neutral" />}
|
|
83
|
+
{(type === "twoActions" || type === "threeActions") && (
|
|
56
84
|
<>
|
|
57
85
|
{/* Ideally, with the "gap" flex property,
|
|
58
86
|
we can get rid of these ugly constructs */}
|
|
87
|
+
+.9+
|
|
59
88
|
<HSpacer size={16} />
|
|
60
|
-
{secondAction}
|
|
89
|
+
<IconButton {...secondAction} color="neutral" />
|
|
61
90
|
</>
|
|
62
91
|
)}
|
|
63
|
-
{
|
|
92
|
+
{type === "threeActions" && (
|
|
64
93
|
<>
|
|
65
94
|
{/* Same as above */}
|
|
66
95
|
<HSpacer size={16} />
|
|
67
|
-
{thirdAction}
|
|
96
|
+
<IconButton {...thirdAction} color="neutral" />
|
|
68
97
|
</>
|
|
69
98
|
)}
|
|
70
99
|
</View>
|
|
@@ -19,11 +19,7 @@ import type { IOSpacer } from "../../core/IOSpacing";
|
|
|
19
19
|
import { WithTestID } from "../../utils/types";
|
|
20
20
|
import IconButton from "../buttons/IconButton";
|
|
21
21
|
import { makeFontStyleObject } from "../../utils/fonts";
|
|
22
|
-
|
|
23
|
-
type ActionProp = Pick<
|
|
24
|
-
React.ComponentProps<typeof IconButton>,
|
|
25
|
-
"icon" | "onPress" | "accessibilityLabel" | "accessibilityHint" | "testID"
|
|
26
|
-
>;
|
|
22
|
+
import { ActionProp } from "./common";
|
|
27
23
|
|
|
28
24
|
type ScrollValues = {
|
|
29
25
|
contentOffsetY: Animated.SharedValue<number>;
|
|
@@ -41,17 +37,23 @@ type CommonProps = WithTestID<{
|
|
|
41
37
|
|
|
42
38
|
interface Base extends CommonProps {
|
|
43
39
|
type: "base";
|
|
40
|
+
firstAction?: never;
|
|
41
|
+
secondAction?: never;
|
|
42
|
+
thirdAction?: never;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
interface OneAction extends CommonProps {
|
|
47
46
|
type: "singleAction";
|
|
48
47
|
firstAction: ActionProp;
|
|
48
|
+
secondAction?: never;
|
|
49
|
+
thirdAction?: never;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
interface TwoActions extends CommonProps {
|
|
52
53
|
type: "twoActions";
|
|
53
54
|
firstAction: ActionProp;
|
|
54
55
|
secondAction: ActionProp;
|
|
56
|
+
thirdAction?: never;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
interface ThreeActions extends CommonProps {
|
|
@@ -98,16 +100,18 @@ const styles = StyleSheet.create({
|
|
|
98
100
|
* @param {HeaderSecondLevel} props - The props of the component
|
|
99
101
|
* @returns React Element
|
|
100
102
|
*/
|
|
101
|
-
export const HeaderSecondLevel = (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
export const HeaderSecondLevel = ({
|
|
104
|
+
scrollValues = undefined,
|
|
105
|
+
goBack,
|
|
106
|
+
backAccessibilityLabel,
|
|
107
|
+
title,
|
|
108
|
+
type,
|
|
109
|
+
transparent = false,
|
|
110
|
+
testID,
|
|
111
|
+
firstAction,
|
|
112
|
+
secondAction,
|
|
113
|
+
thirdAction
|
|
114
|
+
}: HeaderSecondLevel) => {
|
|
111
115
|
const { isExperimental } = useIOExperimentalDesign();
|
|
112
116
|
const insets = useSafeAreaInsets();
|
|
113
117
|
|
|
@@ -176,7 +180,7 @@ export const HeaderSecondLevel = (props: HeaderSecondLevel) => {
|
|
|
176
180
|
</Animated.Text>
|
|
177
181
|
<View style={[IOStyles.row, { flexShrink: 0 }]}>
|
|
178
182
|
{type !== "base" ? (
|
|
179
|
-
<IconButton {...
|
|
183
|
+
<IconButton {...firstAction} color="neutral" />
|
|
180
184
|
) : (
|
|
181
185
|
<HSpacer size={iconBtnSizeSmall as IOSpacer} />
|
|
182
186
|
)}
|
|
@@ -185,14 +189,14 @@ export const HeaderSecondLevel = (props: HeaderSecondLevel) => {
|
|
|
185
189
|
{/* Ideally, with the "gap" flex property,
|
|
186
190
|
we can get rid of these ugly constructs */}
|
|
187
191
|
<HSpacer size={16} />
|
|
188
|
-
<IconButton {...
|
|
192
|
+
<IconButton {...secondAction} color="neutral" />
|
|
189
193
|
</>
|
|
190
194
|
)}
|
|
191
195
|
{type === "threeActions" && (
|
|
192
196
|
<>
|
|
193
197
|
{/* Same as above */}
|
|
194
198
|
<HSpacer size={16} />
|
|
195
|
-
<IconButton {...
|
|
199
|
+
<IconButton {...thirdAction} color="neutral" />
|
|
196
200
|
</>
|
|
197
201
|
)}
|
|
198
202
|
</View>
|