@pagopa/io-app-design-system 1.1.3 → 1.3.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 +1 -0
- package/lib/commonjs/components/accordion/RawAccordion.js.map +1 -1
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/avatar/__test__/avatar.test.js.map +1 -1
- package/lib/commonjs/components/badge/Badge.js.map +1 -1
- package/lib/commonjs/components/banner/Banner.js +1 -1
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/banner/__test__/banner.test.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonExtendedOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +3 -3
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +3 -3
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/common/AnimatedTick.js +2 -1
- package/lib/commonjs/components/common/AnimatedTick.js.map +1 -1
- package/lib/commonjs/components/contentWrapper/ContentWrapper.js.map +1 -1
- package/lib/commonjs/components/icons/Icon.js +124 -120
- package/lib/commonjs/components/icons/Icon.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconLight.js +31 -0
- package/lib/commonjs/components/icons/svg/IconLight.js.map +1 -0
- package/lib/commonjs/components/icons/svg/IconLightFilled.js +31 -0
- package/lib/commonjs/components/icons/svg/IconLightFilled.js.map +1 -0
- package/lib/commonjs/components/icons/svg/originals/IconLight.svg +3 -0
- package/lib/commonjs/components/icons/svg/originals/IconLightFilled.svg +3 -0
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemIDP.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js.map +1 -1
- package/lib/commonjs/components/pictograms/Pictogram.js +37 -31
- package/lib/commonjs/components/pictograms/Pictogram.js.map +1 -1
- package/lib/commonjs/components/pictograms/svg/PictogramFocusOn.js +56 -0
- package/lib/commonjs/components/pictograms/svg/PictogramFocusOn.js.map +1 -0
- package/lib/commonjs/components/pictograms/svg/PictogramSuccess.js +61 -0
- package/lib/commonjs/components/pictograms/svg/PictogramSuccess.js.map +1 -0
- package/lib/commonjs/components/pictograms/svg/originals/PictogramFocusOn.svg +19 -0
- package/lib/commonjs/components/pictograms/svg/originals/PictogramSuccess.svg +35 -0
- package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
- package/lib/commonjs/components/tabs/TabItem.js +123 -0
- package/lib/commonjs/components/tabs/TabItem.js.map +1 -0
- package/lib/commonjs/components/tabs/TabNavigation.js +80 -0
- package/lib/commonjs/components/tabs/TabNavigation.js.map +1 -0
- package/lib/commonjs/components/tabs/index.js +20 -0
- package/lib/commonjs/components/tabs/index.js.map +1 -0
- package/lib/commonjs/components/typography/Body.js.map +1 -1
- package/lib/commonjs/components/typography/Factory.js.map +1 -1
- package/lib/commonjs/components/typography/H1.js.map +1 -1
- package/lib/commonjs/components/typography/H2.js.map +1 -1
- package/lib/commonjs/components/typography/H4.js.map +1 -1
- package/lib/commonjs/components/typography/H5.js.map +1 -1
- package/lib/commonjs/components/typography/H6.js.map +1 -1
- package/lib/commonjs/components/typography/Label.js.map +1 -1
- package/lib/commonjs/components/typography/LabelHeader.js +37 -0
- package/lib/commonjs/components/typography/LabelHeader.js.map +1 -0
- package/lib/commonjs/components/typography/LabelSmall.js.map +1 -1
- package/lib/commonjs/components/typography/Monospace.js.map +1 -1
- package/lib/commonjs/components/typography/common.js +2 -2
- package/lib/commonjs/components/typography/common.js.map +1 -1
- package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js +31 -0
- package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js.map +1 -0
- package/lib/commonjs/utils/image.js.map +1 -1
- package/lib/module/components/accordion/RawAccordion.js.map +1 -1
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/avatar/__test__/avatar.test.js.map +1 -1
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/banner/Banner.js +1 -1
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/banner/__test__/banner.test.js.map +1 -1
- package/lib/module/components/buttons/ButtonExtendedOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +3 -3
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +3 -3
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/module/components/common/AnimatedTick.js +2 -1
- package/lib/module/components/common/AnimatedTick.js.map +1 -1
- package/lib/module/components/contentWrapper/ContentWrapper.js.map +1 -1
- package/lib/module/components/icons/Icon.js +124 -120
- package/lib/module/components/icons/Icon.js.map +1 -1
- package/lib/module/components/icons/svg/IconLight.js +23 -0
- package/lib/module/components/icons/svg/IconLight.js.map +1 -0
- package/lib/module/components/icons/svg/IconLightFilled.js +23 -0
- package/lib/module/components/icons/svg/IconLightFilled.js.map +1 -0
- package/lib/module/components/icons/svg/originals/IconLight.svg +3 -0
- package/lib/module/components/icons/svg/originals/IconLightFilled.svg +3 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/listitems/ListItemAction.js.map +1 -1
- package/lib/module/components/listitems/ListItemIDP.js.map +1 -1
- package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/module/components/listitems/PressableListItemsBase.js.map +1 -1
- package/lib/module/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js.map +1 -1
- package/lib/module/components/pictograms/Pictogram.js +37 -31
- package/lib/module/components/pictograms/Pictogram.js.map +1 -1
- package/lib/module/components/pictograms/svg/PictogramFocusOn.js +48 -0
- package/lib/module/components/pictograms/svg/PictogramFocusOn.js.map +1 -0
- package/lib/module/components/pictograms/svg/PictogramSuccess.js +51 -0
- package/lib/module/components/pictograms/svg/PictogramSuccess.js.map +1 -0
- package/lib/module/components/pictograms/svg/originals/PictogramFocusOn.svg +19 -0
- package/lib/module/components/pictograms/svg/originals/PictogramSuccess.svg +35 -0
- package/lib/module/components/spacer/Spacer.js.map +1 -1
- package/lib/module/components/tabs/TabItem.js +114 -0
- package/lib/module/components/tabs/TabItem.js.map +1 -0
- package/lib/module/components/tabs/TabNavigation.js +73 -0
- package/lib/module/components/tabs/TabNavigation.js.map +1 -0
- package/lib/module/components/tabs/index.js +3 -0
- package/lib/module/components/tabs/index.js.map +1 -0
- package/lib/module/components/typography/Body.js.map +1 -1
- package/lib/module/components/typography/Factory.js.map +1 -1
- package/lib/module/components/typography/H1.js.map +1 -1
- package/lib/module/components/typography/H2.js.map +1 -1
- package/lib/module/components/typography/H4.js.map +1 -1
- package/lib/module/components/typography/H5.js.map +1 -1
- package/lib/module/components/typography/H6.js.map +1 -1
- package/lib/module/components/typography/Label.js.map +1 -1
- package/lib/module/components/typography/LabelHeader.js +27 -0
- package/lib/module/components/typography/LabelHeader.js.map +1 -0
- package/lib/module/components/typography/LabelSmall.js.map +1 -1
- package/lib/module/components/typography/Monospace.js.map +1 -1
- package/lib/module/components/typography/common.js +2 -2
- package/lib/module/components/typography/common.js.map +1 -1
- package/lib/module/utils/hooks/useSpringPressProgressValue.js +22 -0
- package/lib/module/utils/hooks/useSpringPressProgressValue.js.map +1 -0
- package/lib/module/utils/image.js.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonExtendedOutline.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/buttons/IconButtonContained.d.ts.map +1 -1
- package/lib/typescript/components/common/AnimatedTick.d.ts.map +1 -1
- package/lib/typescript/components/contentWrapper/ContentWrapper.d.ts.map +1 -1
- package/lib/typescript/components/icons/Icon.d.ts +2 -0
- package/lib/typescript/components/icons/Icon.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconLight.d.ts +5 -0
- package/lib/typescript/components/icons/svg/IconLight.d.ts.map +1 -0
- package/lib/typescript/components/icons/svg/IconLightFilled.d.ts +5 -0
- package/lib/typescript/components/icons/svg/IconLightFilled.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/listitems/ListItemAction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemIDP.d.ts +1 -1
- package/lib/typescript/components/listitems/ListItemIDP.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNavAlert.d.ts.map +1 -1
- 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/listitems/hooks/useListItemSpringAnimation.d.ts.map +1 -1
- package/lib/typescript/components/pictograms/Pictogram.d.ts +3 -0
- package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
- package/lib/typescript/components/pictograms/svg/PictogramFocusOn.d.ts +5 -0
- package/lib/typescript/components/pictograms/svg/PictogramFocusOn.d.ts.map +1 -0
- package/lib/typescript/components/pictograms/svg/PictogramSuccess.d.ts +5 -0
- package/lib/typescript/components/pictograms/svg/PictogramSuccess.d.ts.map +1 -0
- package/lib/typescript/components/spacer/Spacer.d.ts.map +1 -1
- package/lib/typescript/components/tabs/TabItem.d.ts +19 -0
- package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -0
- package/lib/typescript/components/tabs/TabNavigation.d.ts +15 -0
- package/lib/typescript/components/tabs/TabNavigation.d.ts.map +1 -0
- package/lib/typescript/components/tabs/index.d.ts +3 -0
- package/lib/typescript/components/tabs/index.d.ts.map +1 -0
- package/lib/typescript/components/typography/Body.d.ts.map +1 -1
- package/lib/typescript/components/typography/Factory.d.ts.map +1 -1
- package/lib/typescript/components/typography/H1.d.ts.map +1 -1
- package/lib/typescript/components/typography/H2.d.ts.map +1 -1
- package/lib/typescript/components/typography/H4.d.ts.map +1 -1
- package/lib/typescript/components/typography/H5.d.ts.map +1 -1
- package/lib/typescript/components/typography/H6.d.ts.map +1 -1
- package/lib/typescript/components/typography/Label.d.ts.map +1 -1
- package/lib/typescript/components/typography/LabelHeader.d.ts +19 -0
- package/lib/typescript/components/typography/LabelHeader.d.ts.map +1 -0
- package/lib/typescript/components/typography/LabelSmall.d.ts.map +1 -1
- package/lib/typescript/components/typography/Monospace.d.ts.map +1 -1
- package/lib/typescript/components/typography/common.d.ts +2 -2
- package/lib/typescript/components/typography/common.d.ts.map +1 -1
- package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts +11 -0
- package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts.map +1 -0
- package/lib/typescript/utils/image.d.ts.map +1 -1
- package/package.json +6 -4
- package/src/components/Advice/index.tsx +1 -1
- package/src/components/accordion/RawAccordion.tsx +3 -3
- package/src/components/alert/Alert.tsx +4 -1
- package/src/components/avatar/Avatar.tsx +1 -1
- package/src/components/avatar/__test__/avatar.test.tsx +7 -4
- package/src/components/avatar/index.tsx +1 -1
- package/src/components/badge/Badge.tsx +16 -11
- package/src/components/banner/Banner.tsx +206 -195
- package/src/components/banner/__test__/banner.test.tsx +11 -9
- package/src/components/banner/index.tsx +1 -1
- package/src/components/buttons/ButtonExtendedOutline.tsx +80 -80
- package/src/components/buttons/ButtonOutline.tsx +278 -280
- package/src/components/buttons/ButtonSolid.tsx +142 -141
- package/src/components/buttons/IconButtonContained.tsx +17 -17
- package/src/components/buttons/IconButtonSolid.tsx +11 -11
- package/src/components/common/AnimatedTick.tsx +1 -0
- package/src/components/contentWrapper/ContentWrapper.tsx +12 -12
- package/src/components/contentWrapper/index.tsx +1 -1
- package/src/components/divider/index.tsx +1 -1
- package/src/components/icons/Icon.tsx +124 -120
- package/src/components/icons/index.tsx +1 -1
- package/src/components/icons/svg/IconLight.tsx +16 -0
- package/src/components/icons/svg/IconLightFilled.tsx +16 -0
- package/src/components/icons/svg/originals/IconLight.svg +3 -0
- package/src/components/icons/svg/originals/IconLightFilled.svg +3 -0
- package/src/components/index.tsx +1 -0
- package/src/components/listitems/ListItemAction.tsx +120 -119
- package/src/components/listitems/ListItemIDP.tsx +115 -115
- package/src/components/listitems/ListItemNavAlert.tsx +114 -110
- package/src/components/listitems/ListItemTransaction.tsx +2 -6
- package/src/components/listitems/PressableListItemsBase.tsx +29 -29
- package/src/components/listitems/__test__/listitem.test.tsx +53 -15
- package/src/components/listitems/hooks/useListItemSpringAnimation.ts +54 -52
- package/src/components/pictograms/Pictogram.tsx +36 -31
- package/src/components/pictograms/svg/PictogramFocusOn.tsx +39 -0
- package/src/components/pictograms/svg/PictogramSuccess.tsx +49 -0
- package/src/components/pictograms/svg/originals/PictogramFocusOn.svg +19 -0
- package/src/components/pictograms/svg/originals/PictogramSuccess.svg +35 -0
- package/src/components/spacer/Spacer.tsx +21 -18
- package/src/components/spacer/index.tsx +1 -1
- package/src/components/tabs/TabItem.tsx +183 -0
- package/src/components/tabs/TabNavigation.tsx +114 -0
- package/src/components/tabs/index.tsx +2 -0
- package/src/components/typography/Body.tsx +10 -10
- package/src/components/typography/Factory.tsx +38 -38
- package/src/components/typography/H1.tsx +19 -19
- package/src/components/typography/H2.tsx +19 -19
- package/src/components/typography/H4.tsx +12 -12
- package/src/components/typography/H5.tsx +24 -24
- package/src/components/typography/H6.tsx +10 -10
- package/src/components/typography/Label.tsx +16 -16
- package/src/components/typography/LabelHeader.tsx +44 -0
- package/src/components/typography/LabelSmall.tsx +27 -28
- package/src/components/typography/Monospace.tsx +14 -14
- package/src/components/typography/common.tsx +20 -20
- package/src/components/typography/index.tsx +0 -1
- package/src/index.tsx +0 -1
- package/src/json-import.d.ts +3 -4
- package/src/utils/dates.ts +1 -1
- package/src/utils/hooks/useSpringPressProgressValue.ts +28 -0
- package/src/utils/image.ts +22 -22
|
@@ -6,20 +6,20 @@ import { ExternalTypographyProps } from "./common";
|
|
|
6
6
|
|
|
7
7
|
// these colors are allowed only when the weight is SemiBold
|
|
8
8
|
type AllowedSemiBoldColors = Extract<
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
IOColors,
|
|
10
|
+
"bluegreyDark" | "bluegrey" | "bluegreyLight" | "blue" | "white" | "red"
|
|
11
11
|
>;
|
|
12
12
|
|
|
13
13
|
// when the weight is bold, only the white color is allowed
|
|
14
14
|
type AllowedRegularColors = Extract<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
IOColors,
|
|
16
|
+
| "bluegreyDark"
|
|
17
|
+
| "bluegrey"
|
|
18
|
+
| "bluegreyLight"
|
|
19
|
+
| "blue"
|
|
20
|
+
| "white"
|
|
21
|
+
| "red"
|
|
22
|
+
| "grey"
|
|
23
23
|
>;
|
|
24
24
|
|
|
25
25
|
// all the possible colors
|
|
@@ -30,14 +30,14 @@ type AllowedWeight = Extract<IOFontWeight, "SemiBold" | "Regular">;
|
|
|
30
30
|
|
|
31
31
|
// these are the properties allowed only if weight is undefined or SemiBold
|
|
32
32
|
type SemiBoldProps = {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
weight?: Extract<IOFontWeight, "SemiBold">;
|
|
34
|
+
color?: AllowedSemiBoldColors;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
// these are the properties allowed only if weight is Bold
|
|
38
38
|
type RegularProps = {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
weight: Extract<IOFontWeight, "Regular">;
|
|
40
|
+
color?: AllowedRegularColors;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
type BoldKindProps = SemiBoldProps | RegularProps;
|
|
@@ -54,13 +54,13 @@ export const h5DefaultWeight: AllowedWeight = "SemiBold";
|
|
|
54
54
|
* @param props
|
|
55
55
|
* @constructor
|
|
56
56
|
*/
|
|
57
|
-
export const H5: React.FC<OwnProps> =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
57
|
+
export const H5: React.FC<OwnProps> = props => {
|
|
58
|
+
const fontName: FontFamily = "TitilliumWeb";
|
|
59
|
+
return useTypographyFactory<AllowedWeight, AllowedColors>({
|
|
60
|
+
...props,
|
|
61
|
+
defaultWeight: h5DefaultWeight,
|
|
62
|
+
defaultColor: h5DefaultColor,
|
|
63
|
+
font: fontName,
|
|
64
|
+
fontStyle: { fontSize: h5FontSize }
|
|
65
|
+
});
|
|
66
|
+
};
|
|
@@ -9,7 +9,7 @@ type AllowedColors = IOTheme["textBody-default"] | "blueIO-850";
|
|
|
9
9
|
type AllowedWeight = Extract<IOFontWeight, "SemiBold" | "Regular">;
|
|
10
10
|
|
|
11
11
|
type OwnProps = ExternalTypographyProps<
|
|
12
|
-
|
|
12
|
+
TypographyProps<AllowedWeight, AllowedColors>
|
|
13
13
|
>;
|
|
14
14
|
|
|
15
15
|
export const h6FontSize = 16;
|
|
@@ -23,13 +23,13 @@ export const h6DefaultWeight: AllowedWeight = "Regular";
|
|
|
23
23
|
* @param props
|
|
24
24
|
* @constructor
|
|
25
25
|
*/
|
|
26
|
-
export const H6: React.FC<OwnProps> =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
export const H6: React.FC<OwnProps> = props => {
|
|
27
|
+
const fontName: FontFamily = "ReadexPro";
|
|
28
|
+
return useTypographyFactory<AllowedWeight, AllowedColors>({
|
|
29
|
+
...props,
|
|
30
|
+
defaultWeight: h6DefaultWeight,
|
|
31
|
+
defaultColor: h6DefaultColor,
|
|
32
|
+
font: fontName,
|
|
33
|
+
fontStyle: { fontSize: h6FontSize, lineHeight: h6LineHeight }
|
|
34
|
+
});
|
|
35
35
|
};
|
|
@@ -5,13 +5,13 @@ import { useTypographyFactory } from "./Factory";
|
|
|
5
5
|
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
6
6
|
|
|
7
7
|
type PartialAllowedColors = Extract<
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
IOColors,
|
|
9
|
+
"blue" | "bluegrey" | "bluegreyDark" | "white" | "red"
|
|
10
10
|
>;
|
|
11
11
|
type AllowedColors = PartialAllowedColors | IOColorsStatusForeground;
|
|
12
12
|
type AllowedWeight = Extract<IOFontWeight, "Bold" | "Regular" | "SemiBold">;
|
|
13
13
|
type OwnProps = ExternalTypographyProps<
|
|
14
|
-
|
|
14
|
+
TypographyProps<AllowedWeight, AllowedColors>
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -20,17 +20,17 @@ type OwnProps = ExternalTypographyProps<
|
|
|
20
20
|
* @param props`
|
|
21
21
|
* @constructor
|
|
22
22
|
*/
|
|
23
|
-
export const Label: React.FC<OwnProps> =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export const Label: React.FC<OwnProps> = props => {
|
|
24
|
+
const fontName: FontFamily = "TitilliumWeb";
|
|
25
|
+
const fontSize = 16;
|
|
26
|
+
const labelDefaultWeight = "Bold";
|
|
27
|
+
const labelDefaultcolor = "blue";
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
29
|
+
return useTypographyFactory<AllowedWeight, AllowedColors>({
|
|
30
|
+
...props,
|
|
31
|
+
defaultWeight: labelDefaultWeight,
|
|
32
|
+
defaultColor: labelDefaultcolor,
|
|
33
|
+
font: fontName,
|
|
34
|
+
fontStyle: { fontSize }
|
|
35
|
+
});
|
|
36
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IOFontFamily, IOFontWeight } from "../../utils/fonts";
|
|
3
|
+
import { IOTheme, IOThemeLight } from "../../core";
|
|
4
|
+
import { useTypographyFactory } from "./Factory";
|
|
5
|
+
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
6
|
+
|
|
7
|
+
type AllowedColors =
|
|
8
|
+
| IOTheme["textBody-default"]
|
|
9
|
+
| "grey-650"
|
|
10
|
+
| "grey-850"
|
|
11
|
+
| "white"
|
|
12
|
+
| "black";
|
|
13
|
+
type AllowedWeight = Extract<IOFontWeight, "Regular">;
|
|
14
|
+
|
|
15
|
+
type OwnProps = ExternalTypographyProps<
|
|
16
|
+
TypographyProps<AllowedWeight, AllowedColors>
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
/* Common typographic styles */
|
|
20
|
+
export const labelHeaderFontSize = 14;
|
|
21
|
+
export const labelHeaderLineHeight = 18;
|
|
22
|
+
export const labelHeaderDefaultColor: AllowedColors =
|
|
23
|
+
IOThemeLight["textBody-default"];
|
|
24
|
+
/* New typographic styles */
|
|
25
|
+
const labelHeaderFontName: IOFontFamily = "ReadexPro";
|
|
26
|
+
const labelHeaderDefaultWeight: AllowedWeight = "Regular";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Typography component to render `LabelHeader` text with font size {@link fontSize} and fontFamily {@link fontName}.
|
|
30
|
+
* default values(if not defined) are weight: `Regular`, color: `bluegreyDark`
|
|
31
|
+
* @param props
|
|
32
|
+
* @constructor
|
|
33
|
+
*/
|
|
34
|
+
export const LabelHeader: React.FunctionComponent<OwnProps> = props =>
|
|
35
|
+
useTypographyFactory<AllowedWeight, AllowedColors>({
|
|
36
|
+
...props,
|
|
37
|
+
defaultWeight: labelHeaderDefaultWeight,
|
|
38
|
+
defaultColor: labelHeaderDefaultColor,
|
|
39
|
+
font: labelHeaderFontName,
|
|
40
|
+
fontStyle: {
|
|
41
|
+
fontSize: labelHeaderFontSize,
|
|
42
|
+
lineHeight: labelHeaderLineHeight
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -5,24 +5,23 @@ import { useTypographyFactory } from "./Factory";
|
|
|
5
5
|
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
6
6
|
|
|
7
7
|
type PartialAllowedColors = Extract<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
IOColors,
|
|
9
|
+
| "blue"
|
|
10
|
+
| "bluegrey"
|
|
11
|
+
| "red"
|
|
12
|
+
| "white"
|
|
13
|
+
| "bluegreyDark"
|
|
14
|
+
| "grey-700"
|
|
15
|
+
| "grey-200"
|
|
16
16
|
>;
|
|
17
17
|
type AllowedColors = PartialAllowedColors | IOTheme["textBody-tertiary"];
|
|
18
18
|
type AllowedWeight = Extract<IOFontWeight, "Bold" | "Regular" | "SemiBold">;
|
|
19
19
|
type FontSize = "regular" | "small";
|
|
20
20
|
type AllowedFontSize = { fontSize?: FontSize };
|
|
21
21
|
type OwnProps = ExternalTypographyProps<
|
|
22
|
-
|
|
22
|
+
TypographyProps<AllowedWeight, AllowedColors>
|
|
23
23
|
> &
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
AllowedFontSize;
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* Typography component to render `LabelSmall` text with font size {@link fontSize} and fontFamily {@link fontName}.
|
|
@@ -30,21 +29,21 @@ type OwnProps = ExternalTypographyProps<
|
|
|
30
29
|
* @param props`
|
|
31
30
|
* @constructor
|
|
32
31
|
*/
|
|
33
|
-
export const LabelSmall: React.FC<OwnProps> =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
export const LabelSmall: React.FC<OwnProps> = props => {
|
|
33
|
+
const fontName: FontFamily = "TitilliumWeb";
|
|
34
|
+
const fontSizeMapping: Record<FontSize, number> = { regular: 14, small: 12 };
|
|
35
|
+
const labelDefaultWeight = "Bold";
|
|
36
|
+
const labelDefaultcolor = "blue";
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
38
|
+
return useTypographyFactory<AllowedWeight, AllowedColors>({
|
|
39
|
+
...props,
|
|
40
|
+
defaultWeight: labelDefaultWeight,
|
|
41
|
+
defaultColor: labelDefaultcolor,
|
|
42
|
+
font: fontName,
|
|
43
|
+
fontStyle: {
|
|
44
|
+
fontSize: props.fontSize
|
|
45
|
+
? fontSizeMapping[props.fontSize]
|
|
46
|
+
: fontSizeMapping.regular
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
@@ -8,7 +8,7 @@ type AllowedColors = Extract<IOColors, "bluegreyDark" | "bluegrey">;
|
|
|
8
8
|
type AllowedWeight = Extract<IOFontWeight, "Regular" | "SemiBold" | "Bold">;
|
|
9
9
|
|
|
10
10
|
type OwnProps = ExternalTypographyProps<
|
|
11
|
-
|
|
11
|
+
TypographyProps<AllowedWeight, AllowedColors>
|
|
12
12
|
>;
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -17,18 +17,18 @@ type OwnProps = ExternalTypographyProps<
|
|
|
17
17
|
* @param props`
|
|
18
18
|
* @constructor
|
|
19
19
|
*/
|
|
20
|
-
export const Monospace: React.FC<OwnProps> =
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
export const Monospace: React.FC<OwnProps> = props => {
|
|
21
|
+
const fontName: FontFamily = "RobotoMono";
|
|
22
|
+
const fontSize = 16;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const monospaceDefaultWeight = "Regular";
|
|
25
|
+
const monospaceDefaultcolor = "bluegrey";
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
27
|
+
return useTypographyFactory<AllowedWeight, AllowedColors>({
|
|
28
|
+
...props,
|
|
29
|
+
defaultWeight: monospaceDefaultWeight,
|
|
30
|
+
defaultColor: monospaceDefaultcolor,
|
|
31
|
+
font: fontName,
|
|
32
|
+
fontStyle: { fontSize }
|
|
33
|
+
});
|
|
34
|
+
};
|
|
@@ -8,18 +8,18 @@ import { RequiredAll } from "../../utils/types";
|
|
|
8
8
|
* The style exported for the typography elements, without the fields characterizing the font style
|
|
9
9
|
*/
|
|
10
10
|
type TypographyStyle = StyleProp<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
Omit<
|
|
12
|
+
TextStyle,
|
|
13
|
+
"color" | "fontFamily" | "fontStyle" | "fontWeight" | "fontSize"
|
|
14
|
+
>
|
|
15
15
|
>;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Define a generic type for props used by all the typography leaf components
|
|
19
19
|
*/
|
|
20
20
|
export type TypographyProps<WeightPropsType, ColorsPropsType> = {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
weight?: WeightPropsType;
|
|
22
|
+
color?: ColorsPropsType;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
// Define a standard type, using IOFontWeight and IOColors
|
|
@@ -33,15 +33,15 @@ type DefaultTypographyProps = TypographyProps<IOFontWeight, IOColors>;
|
|
|
33
33
|
* @param color the optional color value
|
|
34
34
|
*/
|
|
35
35
|
export function calculateWeightColor<WeightPropsType, ColorsPropsType>(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
defaultWeight: WeightPropsType,
|
|
37
|
+
defaultColor: ColorsPropsType,
|
|
38
|
+
weight?: WeightPropsType,
|
|
39
|
+
color?: ColorsPropsType
|
|
40
40
|
): RequiredTypographyProps<WeightPropsType, ColorsPropsType> {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
return {
|
|
42
|
+
weight: weight ?? defaultWeight,
|
|
43
|
+
color: color ?? defaultColor
|
|
44
|
+
};
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -49,12 +49,12 @@ export function calculateWeightColor<WeightPropsType, ColorsPropsType>(
|
|
|
49
49
|
* In addition to the {@link DefaultTypographyProps} all the {@link Text} props are allowed (`style` excluded)
|
|
50
50
|
*/
|
|
51
51
|
export type ExternalTypographyProps<T> = T extends DefaultTypographyProps
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
? Omit<React.ComponentPropsWithRef<typeof Text>, "style"> &
|
|
53
|
+
T & { style?: TypographyStyle }
|
|
54
|
+
: never;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* Define mandatory all the keys of {@link TypographyProps}
|
|
58
|
-
*/
|
|
57
|
+
* Define mandatory all the keys of {@link TypographyProps}
|
|
58
|
+
*/
|
|
59
59
|
export type RequiredTypographyProps<WeightPropsType, ColorsPropsType> =
|
|
60
|
-
|
|
60
|
+
RequiredAll<TypographyProps<WeightPropsType, ColorsPropsType>>;
|
package/src/index.tsx
CHANGED
package/src/json-import.d.ts
CHANGED
package/src/utils/dates.ts
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Animated, {
|
|
3
|
+
useDerivedValue,
|
|
4
|
+
useSharedValue,
|
|
5
|
+
withSpring
|
|
6
|
+
} from "react-native-reanimated";
|
|
7
|
+
import { IOSpringValues } from "../../core";
|
|
8
|
+
|
|
9
|
+
export const useSpringPressProgressValue = (
|
|
10
|
+
springValue = IOSpringValues.button
|
|
11
|
+
) => {
|
|
12
|
+
const isPressed: Animated.SharedValue<number> = useSharedValue(0);
|
|
13
|
+
|
|
14
|
+
const progress = useDerivedValue(() =>
|
|
15
|
+
withSpring(isPressed.value, springValue)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const onPressIn = React.useCallback(() => {
|
|
19
|
+
// eslint-disable-next-line functional/immutable-data
|
|
20
|
+
isPressed.value = 1;
|
|
21
|
+
}, [isPressed]);
|
|
22
|
+
const onPressOut = React.useCallback(() => {
|
|
23
|
+
// eslint-disable-next-line functional/immutable-data
|
|
24
|
+
isPressed.value = 0;
|
|
25
|
+
}, [isPressed]);
|
|
26
|
+
|
|
27
|
+
return { onPressIn, onPressOut, progress };
|
|
28
|
+
};
|
package/src/utils/image.ts
CHANGED
|
@@ -13,26 +13,26 @@ import { toAndroidCacheTimestamp } from "./dates";
|
|
|
13
13
|
* if the platform is Android and the source contains an URI. The same source otherwise.
|
|
14
14
|
*/
|
|
15
15
|
export const addCacheTimestampToUri = (source: ImageURISource) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
)
|
|
16
|
+
const UriSource = T.type({
|
|
17
|
+
uri: T.string
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return pipe(
|
|
21
|
+
Platform.OS === "android",
|
|
22
|
+
B.fold(
|
|
23
|
+
() => source,
|
|
24
|
+
() =>
|
|
25
|
+
pipe(
|
|
26
|
+
source,
|
|
27
|
+
UriSource.decode,
|
|
28
|
+
E.fold(
|
|
29
|
+
() => source,
|
|
30
|
+
() => ({
|
|
31
|
+
...source,
|
|
32
|
+
uri: `${source.uri}?ts=${toAndroidCacheTimestamp()}`
|
|
33
|
+
})
|
|
35
34
|
)
|
|
36
|
-
|
|
37
|
-
)
|
|
38
|
-
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
};
|