@pagopa/io-app-design-system 2.1.2 → 3.0.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/common/LogoPaymentWithFallback.js +20 -11
- package/lib/commonjs/components/common/LogoPaymentWithFallback.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +1 -3
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js +70 -91
- package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/commonjs/components/listitems/PressableListItemsBase.js +3 -1
- package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +18 -38
- package/lib/commonjs/components/listitems/__test__/listitem.test.js +8 -4
- package/lib/commonjs/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleIDP.js +2 -9
- package/lib/commonjs/components/modules/ModuleIDP.js.map +1 -1
- package/lib/commonjs/components/modules/ModulePaymentNotice.js +8 -6
- package/lib/commonjs/components/modules/ModulePaymentNotice.js.map +1 -1
- package/lib/commonjs/components/tag/Tag.js +4 -11
- package/lib/commonjs/components/tag/Tag.js.map +1 -1
- package/lib/commonjs/core/IODSExperimentalContextProvider.js +1 -2
- package/lib/commonjs/core/IODSExperimentalContextProvider.js.map +1 -1
- package/lib/commonjs/core/IOThemeContextProvider.js +1 -2
- package/lib/commonjs/core/IOThemeContextProvider.js.map +1 -1
- package/lib/commonjs/utils/accessibility.js +1 -14
- package/lib/commonjs/utils/accessibility.js.map +1 -1
- package/lib/commonjs/utils/image.js +23 -14
- package/lib/commonjs/utils/image.js.map +1 -1
- package/lib/commonjs/utils/object.js +10 -5
- package/lib/commonjs/utils/object.js.map +1 -1
- package/lib/module/components/common/LogoPaymentWithFallback.js +20 -11
- package/lib/module/components/common/LogoPaymentWithFallback.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadioWithAmount.js +1 -3
- package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js +71 -90
- package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/module/components/listitems/PressableListItemsBase.js +4 -2
- package/lib/module/components/listitems/PressableListItemsBase.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +18 -38
- package/lib/module/components/listitems/__test__/listitem.test.js +8 -4
- package/lib/module/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/module/components/modules/ModuleIDP.js +3 -10
- package/lib/module/components/modules/ModuleIDP.js.map +1 -1
- package/lib/module/components/modules/ModulePaymentNotice.js +8 -6
- package/lib/module/components/modules/ModulePaymentNotice.js.map +1 -1
- package/lib/module/components/tag/Tag.js +4 -9
- package/lib/module/components/tag/Tag.js.map +1 -1
- package/lib/module/core/IODSExperimentalContextProvider.js +1 -2
- package/lib/module/core/IODSExperimentalContextProvider.js.map +1 -1
- package/lib/module/core/IOThemeContextProvider.js +1 -2
- package/lib/module/core/IOThemeContextProvider.js.map +1 -1
- package/lib/module/utils/accessibility.js +0 -9
- package/lib/module/utils/accessibility.js.map +1 -1
- package/lib/module/utils/image.js +23 -12
- package/lib/module/utils/image.js.map +1 -1
- package/lib/module/utils/object.js +10 -3
- package/lib/module/utils/object.js.map +1 -1
- package/lib/typescript/components/common/LogoPaymentWithFallback.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts +21 -13
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleIDP.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModulePaymentNotice.d.ts +10 -4
- package/lib/typescript/components/modules/ModulePaymentNotice.d.ts.map +1 -1
- package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
- package/lib/typescript/core/IODSExperimentalContextProvider.d.ts.map +1 -1
- package/lib/typescript/core/IOThemeContextProvider.d.ts.map +1 -1
- package/lib/typescript/utils/accessibility.d.ts +0 -5
- package/lib/typescript/utils/accessibility.d.ts.map +1 -1
- package/lib/typescript/utils/image.d.ts +2 -2
- package/lib/typescript/utils/image.d.ts.map +1 -1
- package/lib/typescript/utils/object.d.ts +1 -2
- package/lib/typescript/utils/object.d.ts.map +1 -1
- package/package.json +1 -4
- package/src/components/common/LogoPaymentWithFallback.tsx +15 -17
- package/src/components/listitems/ListItemRadioWithAmount.tsx +0 -1
- package/src/components/listitems/ListItemTransaction.tsx +88 -131
- package/src/components/listitems/PressableListItemsBase.tsx +6 -2
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +18 -38
- package/src/components/listitems/__test__/listitem.test.tsx +8 -4
- package/src/components/modules/ModuleIDP.tsx +4 -13
- package/src/components/modules/ModulePaymentNotice.tsx +14 -10
- package/src/components/tag/Tag.tsx +10 -19
- package/src/core/IODSExperimentalContextProvider.tsx +1 -2
- package/src/core/IOThemeContextProvider.tsx +1 -2
- package/src/utils/accessibility.ts +0 -17
- package/src/utils/image.ts +28 -28
- package/src/utils/object.ts +13 -12
- package/lib/commonjs/utils/dates.js +0 -20
- package/lib/commonjs/utils/dates.js.map +0 -1
- package/lib/module/utils/dates.js +0 -11
- package/lib/module/utils/dates.js.map +0 -1
- package/lib/typescript/utils/dates.d.ts +0 -9
- package/lib/typescript/utils/dates.d.ts.map +0 -1
- package/src/utils/dates.ts +0 -18
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import { pipe } from "fp-ts/lib/function";
|
|
2
|
-
import * as O from "fp-ts/lib/Option";
|
|
3
|
-
import I18n from "i18n-js";
|
|
4
1
|
import { useEffect, useState } from "react";
|
|
5
2
|
import { AccessibilityInfo, Platform } from "react-native";
|
|
6
3
|
|
|
7
|
-
/**
|
|
8
|
-
* This function is used to get the text that will be read by the screen reader
|
|
9
|
-
* with the correct minus symbol pronunciation.
|
|
10
|
-
*/
|
|
11
|
-
export const getAccessibleAmountText = (amount?: string) =>
|
|
12
|
-
pipe(
|
|
13
|
-
amount,
|
|
14
|
-
O.fromNullable,
|
|
15
|
-
O.map(amount =>
|
|
16
|
-
amount.replace("-", I18n.t("global.accessibility.minusSymbol"))
|
|
17
|
-
),
|
|
18
|
-
O.getOrElseW(() => undefined)
|
|
19
|
-
);
|
|
20
|
-
|
|
21
4
|
/**
|
|
22
5
|
* Query whether a bold text is currently enabled. The result is true
|
|
23
6
|
* when bold text is enabled and false otherwise.
|
package/src/utils/image.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ImageURISource, Platform } from "react-native";
|
|
3
|
-
import * as B from "fp-ts/boolean";
|
|
4
|
-
import * as T from "io-ts";
|
|
5
|
-
import * as E from "fp-ts/Either";
|
|
6
|
-
import { toAndroidCacheTimestamp } from "./dates";
|
|
1
|
+
import { ImageSourcePropType, Platform } from "react-native";
|
|
7
2
|
|
|
8
3
|
/**
|
|
9
4
|
* Adds a locale timestamp to the image URI to invalidate cache on the following day if the current platform is Android.
|
|
@@ -12,27 +7,32 @@ import { toAndroidCacheTimestamp } from "./dates";
|
|
|
12
7
|
* @returns a new source with a modified URI which includes the actual timestamp in the locale format without slashes
|
|
13
8
|
* if the platform is Android and the source contains an URI. The same source otherwise.
|
|
14
9
|
*/
|
|
15
|
-
export const addCacheTimestampToUri = (source:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
export const addCacheTimestampToUri = (source: ImageSourcePropType) => {
|
|
11
|
+
// If the platform is not Android, return the source as is
|
|
12
|
+
if (Platform.OS !== "android") {
|
|
13
|
+
return source;
|
|
14
|
+
}
|
|
19
15
|
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
)
|
|
37
|
-
|
|
16
|
+
// If the source is a number, it's a local image return as is
|
|
17
|
+
if (typeof source === "number") {
|
|
18
|
+
return source;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// This invalidates the cache on the following day
|
|
22
|
+
const cacheBurstParam = new Date()
|
|
23
|
+
.toISOString()
|
|
24
|
+
.split("T")[0]
|
|
25
|
+
.replace(/-/g, "");
|
|
26
|
+
|
|
27
|
+
if (Array.isArray(source)) {
|
|
28
|
+
return source.map(image =>
|
|
29
|
+
image.uri
|
|
30
|
+
? { ...image, uri: `${image.uri}?ts=${cacheBurstParam}` }
|
|
31
|
+
: image
|
|
32
|
+
);
|
|
33
|
+
} else {
|
|
34
|
+
return source.uri
|
|
35
|
+
? { ...source, uri: `${source.uri}?ts=${cacheBurstParam}` }
|
|
36
|
+
: source;
|
|
37
|
+
}
|
|
38
38
|
};
|
package/src/utils/object.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
// Function to find the first case-insensitive logo
|
|
2
|
+
export const findFirstCaseInsensitive = <T>(
|
|
3
|
+
obj: { [key: string]: T },
|
|
4
|
+
key: string
|
|
5
|
+
) => {
|
|
6
|
+
const lowerKey = key.toLowerCase();
|
|
7
|
+
for (const [k] of Object.entries(obj)) {
|
|
8
|
+
if (k.toLowerCase() === lowerKey) {
|
|
9
|
+
return k;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.toAndroidCacheTimestamp = exports.localeDateFormat = void 0;
|
|
7
|
-
var _i18nJs = _interopRequireDefault(require("i18n-js"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
const localeDateFormat = (date, format) => isNaN(date.getTime()) ? _i18nJs.default.t("global.date.invalid") : _i18nJs.default.strftime(date, format);
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Generates a locale formatted timestamp,
|
|
13
|
-
* used to force the refresh of the Image component cache for Android devices
|
|
14
|
-
* every 24 hours.
|
|
15
|
-
* @returns the actual locale date short format without slashes.
|
|
16
|
-
*/
|
|
17
|
-
exports.localeDateFormat = localeDateFormat;
|
|
18
|
-
const toAndroidCacheTimestamp = () => localeDateFormat(new Date(), _i18nJs.default.t("global.dateFormats.shortFormat").replace(/\//g, ""));
|
|
19
|
-
exports.toAndroidCacheTimestamp = toAndroidCacheTimestamp;
|
|
20
|
-
//# sourceMappingURL=dates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_i18nJs","_interopRequireDefault","require","obj","__esModule","default","localeDateFormat","date","format","isNaN","getTime","I18n","t","strftime","exports","toAndroidCacheTimestamp","Date","replace"],"sourceRoot":"../../../src","sources":["utils/dates.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2B,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpB,MAAMG,gBAAgB,GAAGA,CAACC,IAAU,EAAEC,MAAc,KACzDC,KAAK,CAACF,IAAI,CAACG,OAAO,CAAC,CAAC,CAAC,GACjBC,eAAI,CAACC,CAAC,CAAC,qBAAqB,CAAC,GAC7BD,eAAI,CAACE,QAAQ,CAACN,IAAI,EAAEC,MAAM,CAAC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AALAM,OAAA,CAAAR,gBAAA,GAAAA,gBAAA;AAMO,MAAMS,uBAAuB,GAAGA,CAAA,KACrCT,gBAAgB,CACd,IAAIU,IAAI,CAAC,CAAC,EACVL,eAAI,CAACC,CAAC,CAAC,gCAAgC,CAAC,CAACK,OAAO,CAAC,KAAK,EAAE,EAAE,CAC5D,CAAC;AAACH,OAAA,CAAAC,uBAAA,GAAAA,uBAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import I18n from "i18n-js";
|
|
2
|
-
export const localeDateFormat = (date, format) => isNaN(date.getTime()) ? I18n.t("global.date.invalid") : I18n.strftime(date, format);
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Generates a locale formatted timestamp,
|
|
6
|
-
* used to force the refresh of the Image component cache for Android devices
|
|
7
|
-
* every 24 hours.
|
|
8
|
-
* @returns the actual locale date short format without slashes.
|
|
9
|
-
*/
|
|
10
|
-
export const toAndroidCacheTimestamp = () => localeDateFormat(new Date(), I18n.t("global.dateFormats.shortFormat").replace(/\//g, ""));
|
|
11
|
-
//# sourceMappingURL=dates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["I18n","localeDateFormat","date","format","isNaN","getTime","t","strftime","toAndroidCacheTimestamp","Date","replace"],"sourceRoot":"../../../src","sources":["utils/dates.ts"],"mappings":"AAAA,OAAOA,IAAI,MAAM,SAAS;AAE1B,OAAO,MAAMC,gBAAgB,GAAGA,CAACC,IAAU,EAAEC,MAAc,KACzDC,KAAK,CAACF,IAAI,CAACG,OAAO,CAAC,CAAC,CAAC,GACjBL,IAAI,CAACM,CAAC,CAAC,qBAAqB,CAAC,GAC7BN,IAAI,CAACO,QAAQ,CAACL,IAAI,EAAEC,MAAM,CAAC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,uBAAuB,GAAGA,CAAA,KACrCP,gBAAgB,CACd,IAAIQ,IAAI,CAAC,CAAC,EACVT,IAAI,CAACM,CAAC,CAAC,gCAAgC,CAAC,CAACI,OAAO,CAAC,KAAK,EAAE,EAAE,CAC5D,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const localeDateFormat: (date: Date, format: string) => string;
|
|
2
|
-
/**
|
|
3
|
-
* Generates a locale formatted timestamp,
|
|
4
|
-
* used to force the refresh of the Image component cache for Android devices
|
|
5
|
-
* every 24 hours.
|
|
6
|
-
* @returns the actual locale date short format without slashes.
|
|
7
|
-
*/
|
|
8
|
-
export declare const toAndroidCacheTimestamp: () => string;
|
|
9
|
-
//# sourceMappingURL=dates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../../src/utils/dates.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,SAAU,IAAI,UAAU,MAAM,KAAG,MAG7B,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,cAIjC,CAAC"}
|
package/src/utils/dates.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import I18n from "i18n-js";
|
|
2
|
-
|
|
3
|
-
export const localeDateFormat = (date: Date, format: string): string =>
|
|
4
|
-
isNaN(date.getTime())
|
|
5
|
-
? I18n.t("global.date.invalid")
|
|
6
|
-
: I18n.strftime(date, format);
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Generates a locale formatted timestamp,
|
|
10
|
-
* used to force the refresh of the Image component cache for Android devices
|
|
11
|
-
* every 24 hours.
|
|
12
|
-
* @returns the actual locale date short format without slashes.
|
|
13
|
-
*/
|
|
14
|
-
export const toAndroidCacheTimestamp = () =>
|
|
15
|
-
localeDateFormat(
|
|
16
|
-
new Date(),
|
|
17
|
-
I18n.t("global.dateFormats.shortFormat").replace(/\//g, "")
|
|
18
|
-
);
|