@pagopa/io-app-design-system 1.0.0-9 → 1.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/README.md +39 -4
- package/lib/commonjs/components/Advice/Advice.js +5 -7
- package/lib/commonjs/components/Advice/Advice.js.map +1 -1
- package/lib/commonjs/components/Advice/__test__/advice.test.js +2 -2
- package/lib/commonjs/components/Advice/__test__/advice.test.js.map +1 -1
- package/lib/commonjs/components/accordion/RawAccordion.js.map +1 -1
- package/lib/commonjs/components/badge/__test__/badge.test.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonLink.js +4 -5
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButton.js +0 -2
- package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonContained.js +131 -0
- package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -0
- package/lib/commonjs/components/buttons/IconButtonSolid.js +109 -0
- package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -0
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +370 -0
- package/lib/commonjs/components/buttons/__test__/button.test.js +27 -0
- package/lib/commonjs/components/buttons/__test__/button.test.js.map +1 -1
- package/lib/commonjs/components/buttons/index.js +30 -8
- package/lib/commonjs/components/buttons/index.js.map +1 -1
- package/lib/commonjs/components/checkbox/AnimatedCheckbox.js +1 -1
- package/lib/commonjs/components/checkbox/AnimatedCheckbox.js.map +1 -1
- package/lib/commonjs/components/icons/index.js +0 -18
- package/lib/commonjs/components/icons/index.js.map +1 -1
- package/lib/commonjs/components/index.js +72 -72
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/layout/GradientBottomActions.js +90 -0
- package/lib/commonjs/components/layout/GradientBottomActions.js.map +1 -0
- package/lib/commonjs/components/layout/GradientScrollView.js +111 -0
- package/lib/commonjs/components/layout/GradientScrollView.js.map +1 -0
- package/lib/commonjs/components/layout/HeaderFirstLevel.js +62 -0
- package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -0
- package/lib/commonjs/components/layout/index.js +17 -0
- package/lib/commonjs/components/layout/index.js.map +1 -0
- package/lib/commonjs/components/listitems/ListItemCheckbox.js +135 -0
- package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -0
- package/lib/commonjs/components/listitems/ListItemInfo.js +3 -6
- package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js +1 -4
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js +136 -0
- package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -0
- package/lib/commonjs/components/listitems/ListItemSwitch.js +82 -0
- package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -0
- package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -14
- package/lib/commonjs/components/listitems/index.js +33 -0
- package/lib/commonjs/components/listitems/index.js.map +1 -1
- package/lib/commonjs/components/logos/svg/LogoPaymentExtMaestro.js +3 -19
- package/lib/commonjs/components/logos/svg/LogoPaymentExtMaestro.js.map +1 -1
- package/lib/commonjs/components/logos/svg/LogoPaymentExtMastercard.js +5 -21
- package/lib/commonjs/components/logos/svg/LogoPaymentExtMastercard.js.map +1 -1
- package/lib/commonjs/components/logos/svg/LogoPaymentExtPayPal.js +9 -28
- package/lib/commonjs/components/logos/svg/LogoPaymentExtPayPal.js.map +1 -1
- package/lib/commonjs/components/logos/svg/LogoPaymentMaestro.js +8 -18
- package/lib/commonjs/components/logos/svg/LogoPaymentMaestro.js.map +1 -1
- package/lib/commonjs/components/logos/svg/LogoPaymentMastercard.js +7 -17
- package/lib/commonjs/components/logos/svg/LogoPaymentMastercard.js.map +1 -1
- package/lib/commonjs/components/logos/svg/LogoPaymentPayPal.js +5 -5
- package/lib/commonjs/components/logos/svg/LogoPaymentPayPal.js.map +1 -1
- package/lib/commonjs/components/radio/AnimatedRadio.js +1 -1
- package/lib/commonjs/components/radio/AnimatedRadio.js.map +1 -1
- package/lib/commonjs/components/radio/RadioGroup.js +36 -0
- package/lib/commonjs/components/radio/RadioGroup.js.map +1 -0
- package/lib/commonjs/components/radio/index.js +11 -0
- package/lib/commonjs/components/radio/index.js.map +1 -1
- package/lib/commonjs/components/typography/H3.js +20 -49
- package/lib/commonjs/components/typography/H3.js.map +1 -1
- package/lib/commonjs/components/typography/Link.js +17 -23
- package/lib/commonjs/components/typography/Link.js.map +1 -1
- package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -45
- package/lib/commonjs/core/IOColors.js +1 -1
- package/lib/commonjs/core/IOColors.js.map +1 -1
- package/lib/commonjs/core/IOSpacing.js +1 -1
- package/lib/commonjs/core/IOSpacing.js.map +1 -1
- package/lib/commonjs/core/IOStyles.js +7 -1
- package/lib/commonjs/core/IOStyles.js.map +1 -1
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/json-import.d.js +2 -0
- package/lib/commonjs/json-import.d.js.map +1 -0
- package/lib/module/components/Advice/Advice.js +4 -6
- package/lib/module/components/Advice/Advice.js.map +1 -1
- package/lib/module/components/Advice/__test__/advice.test.js +1 -1
- package/lib/module/components/Advice/__test__/advice.test.js.map +1 -1
- package/lib/module/components/accordion/RawAccordion.js +1 -1
- package/lib/module/components/accordion/RawAccordion.js.map +1 -1
- package/lib/module/components/badge/__test__/badge.test.js.map +1 -1
- package/lib/module/components/buttons/ButtonLink.js +4 -5
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/IconButton.js +0 -2
- package/lib/module/components/buttons/IconButton.js.map +1 -1
- package/lib/module/components/buttons/IconButtonContained.js +122 -0
- package/lib/module/components/buttons/IconButtonContained.js.map +1 -0
- package/lib/module/components/buttons/IconButtonSolid.js +100 -0
- package/lib/module/components/buttons/IconButtonSolid.js.map +1 -0
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +370 -0
- package/lib/module/components/buttons/__test__/button.test.js +27 -0
- package/lib/module/components/buttons/__test__/button.test.js.map +1 -1
- package/lib/module/components/buttons/index.js +4 -2
- package/lib/module/components/buttons/index.js.map +1 -1
- package/lib/module/components/checkbox/AnimatedCheckbox.js +3 -3
- package/lib/module/components/checkbox/AnimatedCheckbox.js.map +1 -1
- package/lib/module/components/icons/index.js +0 -1
- package/lib/module/components/icons/index.js.map +1 -1
- package/lib/module/components/index.js +13 -13
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/layout/GradientBottomActions.js +79 -0
- package/lib/module/components/layout/GradientBottomActions.js.map +1 -0
- package/lib/module/components/layout/GradientScrollView.js +100 -0
- package/lib/module/components/layout/GradientScrollView.js.map +1 -0
- package/lib/module/components/layout/HeaderFirstLevel.js +52 -0
- package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -0
- package/lib/module/components/layout/index.js +2 -0
- package/lib/module/components/layout/index.js.map +1 -0
- package/lib/module/components/listitems/ListItemCheckbox.js +126 -0
- package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -0
- package/lib/module/components/listitems/ListItemInfo.js +3 -6
- package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfoCopy.js +1 -4
- package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadio.js +127 -0
- package/lib/module/components/listitems/ListItemRadio.js.map +1 -0
- package/lib/module/components/listitems/ListItemSwitch.js +74 -0
- package/lib/module/components/listitems/ListItemSwitch.js.map +1 -0
- package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -14
- package/lib/module/components/listitems/index.js +3 -0
- package/lib/module/components/listitems/index.js.map +1 -1
- package/lib/module/components/logos/svg/LogoPaymentExtMaestro.js +3 -19
- package/lib/module/components/logos/svg/LogoPaymentExtMaestro.js.map +1 -1
- package/lib/module/components/logos/svg/LogoPaymentExtMastercard.js +5 -21
- package/lib/module/components/logos/svg/LogoPaymentExtMastercard.js.map +1 -1
- package/lib/module/components/logos/svg/LogoPaymentExtPayPal.js +10 -29
- package/lib/module/components/logos/svg/LogoPaymentExtPayPal.js.map +1 -1
- package/lib/module/components/logos/svg/LogoPaymentMaestro.js +9 -19
- package/lib/module/components/logos/svg/LogoPaymentMaestro.js.map +1 -1
- package/lib/module/components/logos/svg/LogoPaymentMastercard.js +8 -18
- package/lib/module/components/logos/svg/LogoPaymentMastercard.js.map +1 -1
- package/lib/module/components/logos/svg/LogoPaymentPayPal.js +5 -5
- package/lib/module/components/logos/svg/LogoPaymentPayPal.js.map +1 -1
- package/lib/module/components/radio/AnimatedRadio.js +3 -3
- package/lib/module/components/radio/AnimatedRadio.js.map +1 -1
- package/lib/module/components/radio/RadioGroup.js +28 -0
- package/lib/module/components/radio/RadioGroup.js.map +1 -0
- package/lib/module/components/radio/index.js +1 -0
- package/lib/module/components/radio/index.js.map +1 -1
- package/lib/module/components/typography/H3.js +19 -47
- package/lib/module/components/typography/H3.js.map +1 -1
- package/lib/module/components/typography/Link.js +17 -23
- package/lib/module/components/typography/Link.js.map +1 -1
- package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -45
- package/lib/module/core/IOColors.js +1 -1
- package/lib/module/core/IOColors.js.map +1 -1
- package/lib/module/core/IOSpacing.js +1 -1
- package/lib/module/core/IOSpacing.js.map +1 -1
- package/lib/module/core/IOStyles.js +5 -0
- package/lib/module/core/IOStyles.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/json-import.d.js +2 -0
- package/lib/module/json-import.d.js.map +1 -0
- package/lib/typescript/components/Advice/Advice.d.ts +7 -3
- package/lib/typescript/components/Advice/Advice.d.ts.map +1 -1
- package/lib/typescript/components/accordion/RawAccordion.d.ts +2 -2
- package/lib/typescript/components/accordion/RawAccordion.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonContained.d.ts +15 -0
- package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -0
- package/lib/typescript/components/buttons/IconButtonSolid.d.ts +15 -0
- package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -0
- package/lib/typescript/components/buttons/index.d.ts +4 -2
- package/lib/typescript/components/buttons/index.d.ts.map +1 -1
- package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/icons/index.d.ts +0 -1
- package/lib/typescript/components/icons/index.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +13 -13
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/layout/GradientBottomActions.d.ts +22 -0
- package/lib/typescript/components/layout/GradientBottomActions.d.ts.map +1 -0
- package/lib/typescript/components/layout/GradientScrollView.d.ts +14 -0
- package/lib/typescript/components/layout/GradientScrollView.d.ts.map +1 -0
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts +11 -0
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -0
- package/lib/typescript/components/layout/index.d.ts +2 -0
- package/lib/typescript/components/layout/index.d.ts.map +1 -0
- package/lib/typescript/components/listitems/ListItemCheckbox.d.ts +21 -0
- package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -0
- package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfoCopy.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadio.d.ts +22 -0
- package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -0
- package/lib/typescript/components/listitems/ListItemSwitch.d.ts +18 -0
- package/lib/typescript/components/listitems/ListItemSwitch.d.ts.map +1 -0
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/index.d.ts +3 -0
- package/lib/typescript/components/listitems/index.d.ts.map +1 -1
- package/lib/typescript/components/logos/svg/LogoPaymentExtMaestro.d.ts.map +1 -1
- package/lib/typescript/components/logos/svg/LogoPaymentExtMastercard.d.ts +2 -2
- package/lib/typescript/components/logos/svg/LogoPaymentExtMastercard.d.ts.map +1 -1
- package/lib/typescript/components/logos/svg/LogoPaymentExtPayPal.d.ts.map +1 -1
- package/lib/typescript/components/logos/svg/LogoPaymentMaestro.d.ts.map +1 -1
- package/lib/typescript/components/logos/svg/LogoPaymentMastercard.d.ts.map +1 -1
- package/lib/typescript/components/radio/AnimatedRadio.d.ts.map +1 -1
- package/lib/typescript/components/radio/RadioGroup.d.ts +22 -0
- package/lib/typescript/components/radio/RadioGroup.d.ts.map +1 -0
- package/lib/typescript/components/radio/index.d.ts +1 -0
- package/lib/typescript/components/radio/index.d.ts.map +1 -1
- package/lib/typescript/components/typography/H3.d.ts +11 -30
- package/lib/typescript/components/typography/H3.d.ts.map +1 -1
- package/lib/typescript/components/typography/Link.d.ts +4 -4
- package/lib/typescript/components/typography/Link.d.ts.map +1 -1
- package/lib/typescript/core/IOColors.d.ts +2 -1
- package/lib/typescript/core/IOColors.d.ts.map +1 -1
- package/lib/typescript/core/IOSpacing.d.ts +1 -1
- package/lib/typescript/core/IOSpacing.d.ts.map +1 -1
- package/lib/typescript/core/IOStyles.d.ts +6 -2
- package/lib/typescript/core/IOStyles.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +9 -5
- package/src/components/Advice/Advice.tsx +19 -23
- package/src/components/Advice/__test__/advice.test.tsx +4 -2
- package/src/components/accordion/RawAccordion.tsx +6 -6
- package/src/components/badge/__test__/badge.test.tsx +4 -2
- package/src/components/buttons/ButtonLink.tsx +177 -177
- package/src/components/buttons/IconButton.tsx +9 -6
- package/src/components/buttons/IconButtonContained.tsx +201 -0
- package/src/components/buttons/IconButtonSolid.tsx +168 -0
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +370 -0
- package/src/components/buttons/__test__/button.test.tsx +59 -4
- package/src/components/buttons/index.tsx +5 -3
- package/src/components/checkbox/AnimatedCheckbox.tsx +6 -8
- package/src/components/icons/index.tsx +1 -2
- package/src/components/index.tsx +13 -13
- package/src/components/layout/GradientBottomActions.tsx +119 -0
- package/src/components/layout/GradientScrollView.tsx +167 -0
- package/src/components/layout/HeaderFirstLevel.tsx +76 -0
- package/src/components/layout/index.tsx +1 -0
- package/src/components/listitems/ListItemCheckbox.tsx +182 -0
- package/src/components/listitems/ListItemInfo.tsx +53 -58
- package/src/components/listitems/ListItemInfoCopy.tsx +122 -127
- package/src/components/listitems/ListItemRadio.tsx +185 -0
- package/src/components/listitems/ListItemSwitch.tsx +109 -0
- package/src/components/listitems/ListItemTransaction.tsx +154 -150
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -14
- package/src/components/listitems/index.tsx +3 -0
- package/src/components/logos/svg/LogoPaymentExtMaestro.tsx +3 -20
- package/src/components/logos/svg/LogoPaymentExtMastercard.tsx +5 -22
- package/src/components/logos/svg/LogoPaymentExtPayPal.tsx +9 -31
- package/src/components/logos/svg/LogoPaymentMaestro.tsx +8 -6
- package/src/components/logos/svg/LogoPaymentMastercard.tsx +8 -6
- package/src/components/logos/svg/LogoPaymentPayPal.tsx +5 -5
- package/src/components/radio/AnimatedRadio.tsx +6 -8
- package/src/components/radio/RadioGroup.tsx +43 -0
- package/src/components/radio/index.tsx +1 -0
- package/src/components/typography/H3.tsx +25 -91
- package/src/components/typography/Link.tsx +23 -30
- package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -45
- package/src/core/IOColors.ts +2 -2
- package/src/core/IOSpacing.ts +2 -2
- package/src/core/IOStyles.ts +9 -0
- package/src/index.tsx +1 -0
- package/src/json-import.d.ts +13 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Pressable, PressableProps, StyleSheet, View } from "react-native";
|
|
3
3
|
import Animated, {
|
|
4
|
-
|
|
5
|
-
useAnimatedStyle,
|
|
4
|
+
Easing,
|
|
6
5
|
interpolate,
|
|
6
|
+
useAnimatedStyle,
|
|
7
|
+
useSharedValue,
|
|
7
8
|
withSpring,
|
|
8
|
-
withTiming
|
|
9
|
-
Easing
|
|
9
|
+
withTiming
|
|
10
10
|
} from "react-native-reanimated";
|
|
11
|
-
import { IOSelectionTickVisualParams } from "../../core/IOStyles";
|
|
12
11
|
import { IOSpringValues } from "../../core/IOAnimations";
|
|
13
12
|
import { IOColors } from "../../core/IOColors";
|
|
13
|
+
import { IOSelectionTickVisualParams } from "../../core/IOStyles";
|
|
14
14
|
import { AnimatedTick } from "../common/AnimatedTick";
|
|
15
15
|
|
|
16
16
|
type Props = {
|
|
@@ -83,7 +83,6 @@ export const AnimatedRadio = ({ checked, onPress, disabled }: OwnProps) => {
|
|
|
83
83
|
onPress={onPress}
|
|
84
84
|
style={styles.radioWrapper}
|
|
85
85
|
>
|
|
86
|
-
{/* ◀ REMOVE_LEGACY_COMPONENT: Remove the following conditions */}
|
|
87
86
|
<View
|
|
88
87
|
style={[
|
|
89
88
|
styles.radioBorder,
|
|
@@ -103,7 +102,6 @@ export const AnimatedRadio = ({ checked, onPress, disabled }: OwnProps) => {
|
|
|
103
102
|
animatedCheckboxSquare
|
|
104
103
|
]}
|
|
105
104
|
/>
|
|
106
|
-
{/* REMOVE_LEGACY_COMPONENT: End ▶ */}
|
|
107
105
|
{isChecked && (
|
|
108
106
|
<View>
|
|
109
107
|
<AnimatedTick
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { Divider } from "../divider";
|
|
4
|
+
import { IOIcons } from "../icons";
|
|
5
|
+
import { ListItemRadio } from "../listitems/ListItemRadio";
|
|
6
|
+
|
|
7
|
+
export type NewRadioItem<T> = {
|
|
8
|
+
id: T;
|
|
9
|
+
value: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
icon?: IOIcons;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type Props<T> = {
|
|
16
|
+
items: ReadonlyArray<NewRadioItem<T>>;
|
|
17
|
+
selectedItem?: T;
|
|
18
|
+
onPress: (selected: T) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A list of radio buttons.
|
|
23
|
+
* The management of the selection is demanded and derived by the `selectedItem` prop.
|
|
24
|
+
* The item with the `id` equal to the `selectedItem` is the active one.
|
|
25
|
+
*/
|
|
26
|
+
export const RadioGroup = <T,>({ items, selectedItem, onPress }: Props<T>) => (
|
|
27
|
+
<View>
|
|
28
|
+
{items.map((item, index) => (
|
|
29
|
+
<React.Fragment key={`radio_item_${item.id}`}>
|
|
30
|
+
<ListItemRadio
|
|
31
|
+
testID={`RadioItemTestID_${item.id}`}
|
|
32
|
+
value={item.value}
|
|
33
|
+
description={item.description}
|
|
34
|
+
icon={item.icon}
|
|
35
|
+
disabled={item.disabled}
|
|
36
|
+
onValueChange={() => onPress(item.id)}
|
|
37
|
+
selected={selectedItem === item.id}
|
|
38
|
+
/>
|
|
39
|
+
{index < items.length - 1 && <Divider />}
|
|
40
|
+
</React.Fragment>
|
|
41
|
+
))}
|
|
42
|
+
</View>
|
|
43
|
+
);
|
|
@@ -1,101 +1,35 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IOFontFamily, IOFontWeight } from "../../utils/fonts";
|
|
3
|
+
import { IOColorsStatusForeground, IOTheme } from "../../core";
|
|
4
|
+
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
4
5
|
import { useTypographyFactory } from "./Factory";
|
|
5
|
-
import { ExternalTypographyProps, RequiredTypographyProps } from "./common";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
IOColors,
|
|
10
|
-
| "bluegreyDark"
|
|
11
|
-
| "bluegreyLight"
|
|
12
|
-
| "white"
|
|
13
|
-
| "red"
|
|
14
|
-
| "blue"
|
|
15
|
-
| "bluegrey"
|
|
16
|
-
| "grey"
|
|
17
|
-
>;
|
|
7
|
+
type AllowedColors = IOColorsStatusForeground | IOTheme["textHeading-default"];
|
|
8
|
+
type AllowedWeight = Extract<IOFontWeight, "Bold" | "Regular">;
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
IOColors,
|
|
22
|
-
| "white"
|
|
23
|
-
| "bluegreyLight"
|
|
24
|
-
| "black"
|
|
25
|
-
| "bluegreyDark"
|
|
26
|
-
| "blue"
|
|
27
|
-
| "bluegrey"
|
|
28
|
-
| "grey-200"
|
|
10
|
+
type OwnProps = ExternalTypographyProps<
|
|
11
|
+
TypographyProps<AllowedWeight, AllowedColors>
|
|
29
12
|
>;
|
|
30
13
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
type AllowedWeight = Extract<IOFontWeight, "Bold" | "SemiBold">;
|
|
39
|
-
|
|
40
|
-
// these are the properties allowed only if weight is undefined or SemiBold
|
|
41
|
-
type SemiBoldProps = {
|
|
42
|
-
weight?: Extract<IOFontWeight, "SemiBold">;
|
|
43
|
-
color?: AllowedSemiBoldColors | IOTheme["textHeading-default"];
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// these are the properties allowed only if weight is Bold
|
|
47
|
-
type BoldProps = {
|
|
48
|
-
weight: Extract<IOFontWeight, "Bold">;
|
|
49
|
-
color?: AllowedBoldColors | IOTheme["textHeading-default"];
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
type BoldKindProps = SemiBoldProps | BoldProps;
|
|
53
|
-
|
|
54
|
-
type OwnProps = ExternalTypographyProps<BoldKindProps>;
|
|
55
|
-
|
|
56
|
-
export const h3FontSize = 18;
|
|
57
|
-
export const h3LineHeight = 22;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* A custom function to calculate the values if no weight or color is provided.
|
|
61
|
-
* The choose of the default color depends on the weight, for this reason cannot be used
|
|
62
|
-
* the default calculateWeightColor with fallback if undefined.
|
|
63
|
-
* @param weight
|
|
64
|
-
* @param color
|
|
65
|
-
*/
|
|
66
|
-
export const calculateH3WeightColor = (
|
|
67
|
-
weight?: AllowedWeight,
|
|
68
|
-
color?: AllowedColors
|
|
69
|
-
): RequiredTypographyProps<AllowedWeight, AllowedColors> => {
|
|
70
|
-
const newWeight = weight ?? "SemiBold";
|
|
71
|
-
const newColor =
|
|
72
|
-
color !== undefined
|
|
73
|
-
? color
|
|
74
|
-
: newWeight === "SemiBold"
|
|
75
|
-
? "bluegreyDark"
|
|
76
|
-
: "white";
|
|
77
|
-
return {
|
|
78
|
-
weight: newWeight,
|
|
79
|
-
color: newColor
|
|
80
|
-
};
|
|
81
|
-
};
|
|
14
|
+
/* Common typographic styles */
|
|
15
|
+
export const h3FontSize = 22;
|
|
16
|
+
export const h3LineHeight = 33;
|
|
17
|
+
/* New typographic styles */
|
|
18
|
+
const h3FontName: IOFontFamily = "ReadexPro";
|
|
19
|
+
const h3DefaultColor: AllowedColors = "black";
|
|
20
|
+
const h3DefaultWeight: AllowedWeight = "Regular";
|
|
82
21
|
|
|
83
22
|
/**
|
|
84
|
-
* Typography component to render `
|
|
85
|
-
* default values(if not defined) are weight: `
|
|
23
|
+
* Typography component to render `H2` text with font size {@link fontSize} and fontFamily {@link fontName}.
|
|
24
|
+
* default values(if not defined) are weight: `Bold`, color: `bluegreyDark`
|
|
86
25
|
* @param props
|
|
87
26
|
* @constructor
|
|
88
27
|
*/
|
|
89
|
-
export const H3: React.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
weightColorFactory,
|
|
98
|
-
font: fontName,
|
|
99
|
-
fontStyle: { fontSize: h3FontSize, lineHeight: h3LineHeight }
|
|
100
|
-
});
|
|
101
|
-
};
|
|
28
|
+
export const H3: React.FunctionComponent<OwnProps> = props =>
|
|
29
|
+
useTypographyFactory<AllowedWeight, AllowedColors>({
|
|
30
|
+
...props,
|
|
31
|
+
defaultWeight: h3DefaultWeight,
|
|
32
|
+
defaultColor: h3DefaultColor,
|
|
33
|
+
font: h3FontName,
|
|
34
|
+
fontStyle: { fontSize: h3FontSize, lineHeight: h3LineHeight }
|
|
35
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { useTypographyFactory } from "./Factory";
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IOFontFamily, IOFontWeight } from "../../utils/fonts";
|
|
3
|
+
import type { IOColors } from "../../core";
|
|
5
4
|
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
5
|
+
import { useTypographyFactory } from "./Factory";
|
|
6
6
|
|
|
7
7
|
type AllowedColors = IOColors;
|
|
8
8
|
type AllowedWeight = Extract<IOFontWeight, "SemiBold" | "Bold">;
|
|
@@ -10,40 +10,33 @@ type FontSize = "regular" | "small";
|
|
|
10
10
|
type AllowedFontSize = { fontSize?: FontSize };
|
|
11
11
|
|
|
12
12
|
type OwnProps = ExternalTypographyProps<
|
|
13
|
-
|
|
13
|
+
TypographyProps<AllowedWeight, AllowedColors>
|
|
14
14
|
> &
|
|
15
|
-
|
|
15
|
+
AllowedFontSize;
|
|
16
|
+
|
|
17
|
+
const fontName: IOFontFamily = "TitilliumWeb";
|
|
18
|
+
const fontSizeMapping: Record<FontSize, number> = { regular: 16, small: 14 };
|
|
16
19
|
|
|
17
20
|
export const linkDefaultColor: AllowedColors = "blueIO-500";
|
|
18
21
|
export const linkDefaultWeight: AllowedWeight = "Bold";
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Typography component to render `Link` text with font size {@link fontSize} and fontFamily {@link fontName}.
|
|
22
|
-
* default values(if not defined) are weight: `
|
|
25
|
+
* default values(if not defined) are weight: `SemiBold`, color: `blue`
|
|
23
26
|
* @param props`
|
|
24
27
|
* @constructor
|
|
25
28
|
*/
|
|
26
|
-
export const Link: React.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
export const Link: React.FunctionComponent<OwnProps> = props =>
|
|
30
|
+
useTypographyFactory<AllowedWeight, AllowedColors>({
|
|
31
|
+
accessibilityRole: props.onPress ? "link" : undefined,
|
|
32
|
+
...props,
|
|
33
|
+
defaultWeight: linkDefaultWeight,
|
|
34
|
+
defaultColor: linkDefaultColor,
|
|
35
|
+
font: fontName,
|
|
36
|
+
fontStyle: {
|
|
37
|
+
fontSize: props.fontSize
|
|
34
38
|
? fontSizeMapping[props.fontSize]
|
|
35
|
-
: fontSizeMapping.regular
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
accessibilityRole: props.onPress ? "link" : undefined,
|
|
40
|
-
...props,
|
|
41
|
-
defaultWeight,
|
|
42
|
-
defaultColor,
|
|
43
|
-
font: fontName,
|
|
44
|
-
fontStyle: {
|
|
45
|
-
fontSize: defaultFontSize,
|
|
46
|
-
textDecorationLine: defaultTextDecorationLine
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
};
|
|
39
|
+
: fontSizeMapping.regular,
|
|
40
|
+
textDecorationLine: "underline"
|
|
41
|
+
}
|
|
42
|
+
});
|
|
@@ -130,30 +130,31 @@ exports[`Test Typography Components H2 Snapshot 1`] = `
|
|
|
130
130
|
|
|
131
131
|
exports[`Test Typography Components H3 Snapshot 1`] = `
|
|
132
132
|
<Text
|
|
133
|
-
color="
|
|
134
|
-
|
|
133
|
+
color="black"
|
|
134
|
+
defaultColor="black"
|
|
135
|
+
defaultWeight="Regular"
|
|
136
|
+
font="ReadexPro"
|
|
135
137
|
fontStyle={
|
|
136
138
|
{
|
|
137
|
-
"fontSize":
|
|
138
|
-
"lineHeight":
|
|
139
|
+
"fontSize": 22,
|
|
140
|
+
"lineHeight": 33,
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
style={
|
|
142
144
|
[
|
|
143
145
|
{
|
|
144
|
-
"fontSize":
|
|
145
|
-
"lineHeight":
|
|
146
|
+
"fontSize": 22,
|
|
147
|
+
"lineHeight": 33,
|
|
146
148
|
},
|
|
147
149
|
{
|
|
148
|
-
"color": "#
|
|
149
|
-
"fontFamily": "
|
|
150
|
+
"color": "#0E0F13",
|
|
151
|
+
"fontFamily": "Readex Pro",
|
|
150
152
|
"fontStyle": "normal",
|
|
151
|
-
"fontWeight": "
|
|
153
|
+
"fontWeight": "400",
|
|
152
154
|
},
|
|
153
155
|
]
|
|
154
156
|
}
|
|
155
|
-
weight="
|
|
156
|
-
weightColorFactory={[Function]}
|
|
157
|
+
weight="Regular"
|
|
157
158
|
>
|
|
158
159
|
Text
|
|
159
160
|
</Text>
|
|
@@ -162,29 +163,30 @@ exports[`Test Typography Components H3 Snapshot 1`] = `
|
|
|
162
163
|
exports[`Test Typography Components H3 Snapshot 2`] = `
|
|
163
164
|
<Text
|
|
164
165
|
color="bluegreyLight"
|
|
165
|
-
|
|
166
|
+
defaultColor="black"
|
|
167
|
+
defaultWeight="Regular"
|
|
168
|
+
font="ReadexPro"
|
|
166
169
|
fontStyle={
|
|
167
170
|
{
|
|
168
|
-
"fontSize":
|
|
169
|
-
"lineHeight":
|
|
171
|
+
"fontSize": 22,
|
|
172
|
+
"lineHeight": 33,
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
style={
|
|
173
176
|
[
|
|
174
177
|
{
|
|
175
|
-
"fontSize":
|
|
176
|
-
"lineHeight":
|
|
178
|
+
"fontSize": 22,
|
|
179
|
+
"lineHeight": 33,
|
|
177
180
|
},
|
|
178
181
|
{
|
|
179
182
|
"color": "#CCD4DC",
|
|
180
|
-
"fontFamily": "
|
|
183
|
+
"fontFamily": "Readex Pro",
|
|
181
184
|
"fontStyle": "normal",
|
|
182
|
-
"fontWeight": "
|
|
185
|
+
"fontWeight": "400",
|
|
183
186
|
},
|
|
184
187
|
]
|
|
185
188
|
}
|
|
186
|
-
weight="
|
|
187
|
-
weightColorFactory={[Function]}
|
|
189
|
+
weight="Regular"
|
|
188
190
|
>
|
|
189
191
|
Text
|
|
190
192
|
</Text>
|
|
@@ -193,29 +195,30 @@ exports[`Test Typography Components H3 Snapshot 2`] = `
|
|
|
193
195
|
exports[`Test Typography Components H3 Snapshot 3`] = `
|
|
194
196
|
<Text
|
|
195
197
|
color="white"
|
|
196
|
-
|
|
198
|
+
defaultColor="black"
|
|
199
|
+
defaultWeight="Regular"
|
|
200
|
+
font="ReadexPro"
|
|
197
201
|
fontStyle={
|
|
198
202
|
{
|
|
199
|
-
"fontSize":
|
|
200
|
-
"lineHeight":
|
|
203
|
+
"fontSize": 22,
|
|
204
|
+
"lineHeight": 33,
|
|
201
205
|
}
|
|
202
206
|
}
|
|
203
207
|
style={
|
|
204
208
|
[
|
|
205
209
|
{
|
|
206
|
-
"fontSize":
|
|
207
|
-
"lineHeight":
|
|
210
|
+
"fontSize": 22,
|
|
211
|
+
"lineHeight": 33,
|
|
208
212
|
},
|
|
209
213
|
{
|
|
210
214
|
"color": "#FFFFFF",
|
|
211
|
-
"fontFamily": "
|
|
215
|
+
"fontFamily": "Readex Pro",
|
|
212
216
|
"fontStyle": "normal",
|
|
213
|
-
"fontWeight": "
|
|
217
|
+
"fontWeight": "400",
|
|
214
218
|
},
|
|
215
219
|
]
|
|
216
220
|
}
|
|
217
|
-
weight="
|
|
218
|
-
weightColorFactory={[Function]}
|
|
221
|
+
weight="Regular"
|
|
219
222
|
>
|
|
220
223
|
Text
|
|
221
224
|
</Text>
|
|
@@ -224,29 +227,30 @@ exports[`Test Typography Components H3 Snapshot 3`] = `
|
|
|
224
227
|
exports[`Test Typography Components H3 Snapshot 4`] = `
|
|
225
228
|
<Text
|
|
226
229
|
color="white"
|
|
227
|
-
|
|
230
|
+
defaultColor="black"
|
|
231
|
+
defaultWeight="Regular"
|
|
232
|
+
font="ReadexPro"
|
|
228
233
|
fontStyle={
|
|
229
234
|
{
|
|
230
|
-
"fontSize":
|
|
231
|
-
"lineHeight":
|
|
235
|
+
"fontSize": 22,
|
|
236
|
+
"lineHeight": 33,
|
|
232
237
|
}
|
|
233
238
|
}
|
|
234
239
|
style={
|
|
235
240
|
[
|
|
236
241
|
{
|
|
237
|
-
"fontSize":
|
|
238
|
-
"lineHeight":
|
|
242
|
+
"fontSize": 22,
|
|
243
|
+
"lineHeight": 33,
|
|
239
244
|
},
|
|
240
245
|
{
|
|
241
246
|
"color": "#FFFFFF",
|
|
242
|
-
"fontFamily": "
|
|
247
|
+
"fontFamily": "Readex Pro",
|
|
243
248
|
"fontStyle": "normal",
|
|
244
249
|
"fontWeight": "700",
|
|
245
250
|
},
|
|
246
251
|
]
|
|
247
252
|
}
|
|
248
253
|
weight="Bold"
|
|
249
|
-
weightColorFactory={[Function]}
|
|
250
254
|
>
|
|
251
255
|
Text
|
|
252
256
|
</Text>
|
|
@@ -254,30 +258,31 @@ exports[`Test Typography Components H3 Snapshot 4`] = `
|
|
|
254
258
|
|
|
255
259
|
exports[`Test Typography Components H3 Snapshot 5`] = `
|
|
256
260
|
<Text
|
|
257
|
-
color="
|
|
258
|
-
|
|
261
|
+
color="black"
|
|
262
|
+
defaultColor="black"
|
|
263
|
+
defaultWeight="Regular"
|
|
264
|
+
font="ReadexPro"
|
|
259
265
|
fontStyle={
|
|
260
266
|
{
|
|
261
|
-
"fontSize":
|
|
262
|
-
"lineHeight":
|
|
267
|
+
"fontSize": 22,
|
|
268
|
+
"lineHeight": 33,
|
|
263
269
|
}
|
|
264
270
|
}
|
|
265
271
|
style={
|
|
266
272
|
[
|
|
267
273
|
{
|
|
268
|
-
"fontSize":
|
|
269
|
-
"lineHeight":
|
|
274
|
+
"fontSize": 22,
|
|
275
|
+
"lineHeight": 33,
|
|
270
276
|
},
|
|
271
277
|
{
|
|
272
|
-
"color": "#
|
|
273
|
-
"fontFamily": "
|
|
278
|
+
"color": "#0E0F13",
|
|
279
|
+
"fontFamily": "Readex Pro",
|
|
274
280
|
"fontStyle": "normal",
|
|
275
281
|
"fontWeight": "700",
|
|
276
282
|
},
|
|
277
283
|
]
|
|
278
284
|
}
|
|
279
285
|
weight="Bold"
|
|
280
|
-
weightColorFactory={[Function]}
|
|
281
286
|
>
|
|
282
287
|
Text
|
|
283
288
|
</Text>
|
package/src/core/IOColors.ts
CHANGED
|
@@ -404,8 +404,8 @@ Return the color value with RGBA format (RGB + Alpha transparency), starting fro
|
|
|
404
404
|
@param opacity Opacity value that range from 0 to 1. Default value = 1.
|
|
405
405
|
*/
|
|
406
406
|
/* Taken from this Gist: https://gist.github.com/danieliser/b4b24c9f772066bcf0a6 */
|
|
407
|
-
export const hexToRgba = (hexCode:
|
|
408
|
-
const hex = hexCode.replace("#", "");
|
|
407
|
+
export const hexToRgba = (hexCode: ColorValue, opacity: number = 1) => {
|
|
408
|
+
const hex = hexCode.toString().replace("#", "");
|
|
409
409
|
|
|
410
410
|
const r = parseInt(hex.substring(0, 2), 16);
|
|
411
411
|
const g = parseInt(hex.substring(2, 4), 16);
|
package/src/core/IOSpacing.ts
CHANGED
|
@@ -5,7 +5,7 @@ should use a value defined in the following scale.
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export const IOSpacingScale = [
|
|
8
|
-
4, 6, 8, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 72
|
|
8
|
+
4, 6, 8, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 72, 80
|
|
9
9
|
] as const;
|
|
10
10
|
|
|
11
11
|
export type IOSpacingScale = (typeof IOSpacingScale)[number];
|
|
@@ -45,4 +45,4 @@ export type IOListItemIDPSpacing = Extract<IOSpacingScale, 8 | 16 | 24>;
|
|
|
45
45
|
export const IOListItemIDPHSpacing: IOListItemIDPSpacing = 16 as const;
|
|
46
46
|
export const IOListItemIDPVSpacing: IOListItemIDPSpacing = 16 as const;
|
|
47
47
|
export const IOListItemIDPSavedVSpacing: IOListItemIDPSpacing = 24 as const;
|
|
48
|
-
export const IOListItemLogoMargin: IOListItemIDPSpacing = 8 as const;
|
|
48
|
+
export const IOListItemLogoMargin: IOListItemIDPSpacing = 8 as const;
|
package/src/core/IOStyles.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { IOAppMargin, IOSpacer, IOSpacingScale } from "./IOSpacing";
|
|
|
9
9
|
|
|
10
10
|
interface IOVisualCostants {
|
|
11
11
|
appMarginDefault: IOAppMargin;
|
|
12
|
+
// Header
|
|
13
|
+
headerHeight: number;
|
|
12
14
|
// Dimensions
|
|
13
15
|
avatarSizeSmall: number;
|
|
14
16
|
avatarSizeMedium: number;
|
|
@@ -16,6 +18,7 @@ interface IOVisualCostants {
|
|
|
16
18
|
|
|
17
19
|
export const IOVisualCostants: IOVisualCostants = {
|
|
18
20
|
appMarginDefault: 24,
|
|
21
|
+
headerHeight: 56,
|
|
19
22
|
avatarSizeSmall: 44,
|
|
20
23
|
avatarSizeMedium: 66
|
|
21
24
|
};
|
|
@@ -88,6 +91,8 @@ const btnSizeLarge = 56;
|
|
|
88
91
|
// NEW Design System
|
|
89
92
|
const btnBorderRadius = 8;
|
|
90
93
|
const btnSizeDefault = 48;
|
|
94
|
+
export const buttonSolidHeight: number = btnSizeDefault;
|
|
95
|
+
|
|
91
96
|
// TODO: Replace the number type with the new IOIconSizeScale
|
|
92
97
|
const iconBtnSizeSmall: number = 24;
|
|
93
98
|
|
|
@@ -217,6 +222,7 @@ interface IOListItemVisualParams {
|
|
|
217
222
|
paddingVertical: IOSpacingScale;
|
|
218
223
|
paddingHorizontal: IOAppMargin;
|
|
219
224
|
iconMargin: IOSpacingScale;
|
|
225
|
+
actionMargin: IOSpacingScale;
|
|
220
226
|
iconSize: IOIconSizeScale;
|
|
221
227
|
chevronSize: IOIconSizeScale;
|
|
222
228
|
}
|
|
@@ -225,6 +231,7 @@ export const IOListItemVisualParams: IOListItemVisualParams = {
|
|
|
225
231
|
paddingVertical: 12,
|
|
226
232
|
paddingHorizontal: IOVisualCostants.appMarginDefault,
|
|
227
233
|
iconMargin: 16,
|
|
234
|
+
actionMargin: 16,
|
|
228
235
|
iconSize: 24,
|
|
229
236
|
chevronSize: 24
|
|
230
237
|
};
|
|
@@ -298,6 +305,7 @@ interface IOSelectionListItemVisualParams {
|
|
|
298
305
|
paddingVertical: IOSpacingScale;
|
|
299
306
|
paddingHorizontal: IOAppMargin;
|
|
300
307
|
iconMargin: IOSpacingScale;
|
|
308
|
+
actionMargin: IOSpacer;
|
|
301
309
|
iconSize: IOIconSizeScale;
|
|
302
310
|
descriptionMargin: IOSpacer;
|
|
303
311
|
}
|
|
@@ -308,6 +316,7 @@ export const IOSelectionListItemVisualParams: IOSelectionListItemVisualParams =
|
|
|
308
316
|
paddingHorizontal: IOVisualCostants.appMarginDefault,
|
|
309
317
|
iconMargin: 8,
|
|
310
318
|
iconSize: 24,
|
|
319
|
+
actionMargin: 16,
|
|
311
320
|
descriptionMargin: 4
|
|
312
321
|
};
|
|
313
322
|
|
package/src/index.tsx
CHANGED