@pagopa/io-app-design-system 1.2.0 → 1.3.1

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.
Files changed (161) hide show
  1. package/lib/commonjs/components/accordion/RawAccordion.js.map +1 -1
  2. package/lib/commonjs/components/alert/Alert.js.map +1 -1
  3. package/lib/commonjs/components/avatar/__test__/avatar.test.js.map +1 -1
  4. package/lib/commonjs/components/badge/Badge.js.map +1 -1
  5. package/lib/commonjs/components/banner/Banner.js +1 -1
  6. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  7. package/lib/commonjs/components/banner/__test__/banner.test.js.map +1 -1
  8. package/lib/commonjs/components/buttons/ButtonExtendedOutline.js.map +1 -1
  9. package/lib/commonjs/components/buttons/ButtonOutline.js +3 -3
  10. package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
  11. package/lib/commonjs/components/buttons/ButtonSolid.js +3 -3
  12. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  13. package/lib/commonjs/components/contentWrapper/ContentWrapper.js.map +1 -1
  14. package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
  15. package/lib/commonjs/components/listitems/ListItemIDP.js.map +1 -1
  16. package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
  17. package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
  18. package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +1 -1
  19. package/lib/commonjs/components/listitems/__test__/listitem.test.js.map +1 -1
  20. package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js.map +1 -1
  21. package/lib/commonjs/components/pictograms/Pictogram.js +7 -3
  22. package/lib/commonjs/components/pictograms/Pictogram.js.map +1 -1
  23. package/lib/commonjs/components/pictograms/svg/PictogramFocusOn.js +56 -0
  24. package/lib/commonjs/components/pictograms/svg/PictogramFocusOn.js.map +1 -0
  25. package/lib/commonjs/components/pictograms/svg/originals/PictogramFocusOn.svg +19 -0
  26. package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
  27. package/lib/commonjs/components/typography/Body.js.map +1 -1
  28. package/lib/commonjs/components/typography/Factory.js.map +1 -1
  29. package/lib/commonjs/components/typography/H1.js.map +1 -1
  30. package/lib/commonjs/components/typography/H2.js.map +1 -1
  31. package/lib/commonjs/components/typography/H4.js.map +1 -1
  32. package/lib/commonjs/components/typography/H5.js.map +1 -1
  33. package/lib/commonjs/components/typography/H6.js.map +1 -1
  34. package/lib/commonjs/components/typography/Label.js.map +1 -1
  35. package/lib/commonjs/components/typography/LabelSmall.js.map +1 -1
  36. package/lib/commonjs/components/typography/Monospace.js.map +1 -1
  37. package/lib/commonjs/components/typography/common.js +2 -2
  38. package/lib/commonjs/components/typography/common.js.map +1 -1
  39. package/lib/commonjs/utils/image.js.map +1 -1
  40. package/lib/module/components/accordion/RawAccordion.js.map +1 -1
  41. package/lib/module/components/alert/Alert.js.map +1 -1
  42. package/lib/module/components/avatar/__test__/avatar.test.js.map +1 -1
  43. package/lib/module/components/badge/Badge.js.map +1 -1
  44. package/lib/module/components/banner/Banner.js +1 -1
  45. package/lib/module/components/banner/Banner.js.map +1 -1
  46. package/lib/module/components/banner/__test__/banner.test.js.map +1 -1
  47. package/lib/module/components/buttons/ButtonExtendedOutline.js.map +1 -1
  48. package/lib/module/components/buttons/ButtonOutline.js +3 -3
  49. package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
  50. package/lib/module/components/buttons/ButtonSolid.js +3 -3
  51. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  52. package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
  53. package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
  54. package/lib/module/components/contentWrapper/ContentWrapper.js.map +1 -1
  55. package/lib/module/components/listitems/ListItemAction.js.map +1 -1
  56. package/lib/module/components/listitems/ListItemIDP.js.map +1 -1
  57. package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
  58. package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
  59. package/lib/module/components/listitems/PressableListItemsBase.js.map +1 -1
  60. package/lib/module/components/listitems/__test__/listitem.test.js.map +1 -1
  61. package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js.map +1 -1
  62. package/lib/module/components/pictograms/Pictogram.js +7 -3
  63. package/lib/module/components/pictograms/Pictogram.js.map +1 -1
  64. package/lib/module/components/pictograms/svg/PictogramFocusOn.js +48 -0
  65. package/lib/module/components/pictograms/svg/PictogramFocusOn.js.map +1 -0
  66. package/lib/module/components/pictograms/svg/originals/PictogramFocusOn.svg +19 -0
  67. package/lib/module/components/spacer/Spacer.js.map +1 -1
  68. package/lib/module/components/typography/Body.js.map +1 -1
  69. package/lib/module/components/typography/Factory.js.map +1 -1
  70. package/lib/module/components/typography/H1.js.map +1 -1
  71. package/lib/module/components/typography/H2.js.map +1 -1
  72. package/lib/module/components/typography/H4.js.map +1 -1
  73. package/lib/module/components/typography/H5.js.map +1 -1
  74. package/lib/module/components/typography/H6.js.map +1 -1
  75. package/lib/module/components/typography/Label.js.map +1 -1
  76. package/lib/module/components/typography/LabelSmall.js.map +1 -1
  77. package/lib/module/components/typography/Monospace.js.map +1 -1
  78. package/lib/module/components/typography/common.js +2 -2
  79. package/lib/module/components/typography/common.js.map +1 -1
  80. package/lib/module/utils/image.js.map +1 -1
  81. package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
  82. package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
  83. package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
  84. package/lib/typescript/components/buttons/ButtonExtendedOutline.d.ts.map +1 -1
  85. package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
  86. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
  87. package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
  88. package/lib/typescript/components/contentWrapper/ContentWrapper.d.ts.map +1 -1
  89. package/lib/typescript/components/listitems/ListItemAction.d.ts.map +1 -1
  90. package/lib/typescript/components/listitems/ListItemIDP.d.ts +1 -1
  91. package/lib/typescript/components/listitems/ListItemIDP.d.ts.map +1 -1
  92. package/lib/typescript/components/listitems/ListItemNavAlert.d.ts.map +1 -1
  93. package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
  94. package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +1 -1
  95. package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts.map +1 -1
  96. package/lib/typescript/components/pictograms/Pictogram.d.ts +2 -0
  97. package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
  98. package/lib/typescript/components/pictograms/svg/PictogramFocusOn.d.ts +5 -0
  99. package/lib/typescript/components/pictograms/svg/PictogramFocusOn.d.ts.map +1 -0
  100. package/lib/typescript/components/spacer/Spacer.d.ts.map +1 -1
  101. package/lib/typescript/components/typography/Body.d.ts.map +1 -1
  102. package/lib/typescript/components/typography/Factory.d.ts.map +1 -1
  103. package/lib/typescript/components/typography/H1.d.ts.map +1 -1
  104. package/lib/typescript/components/typography/H2.d.ts.map +1 -1
  105. package/lib/typescript/components/typography/H4.d.ts.map +1 -1
  106. package/lib/typescript/components/typography/H5.d.ts.map +1 -1
  107. package/lib/typescript/components/typography/H6.d.ts.map +1 -1
  108. package/lib/typescript/components/typography/Label.d.ts.map +1 -1
  109. package/lib/typescript/components/typography/LabelSmall.d.ts.map +1 -1
  110. package/lib/typescript/components/typography/Monospace.d.ts.map +1 -1
  111. package/lib/typescript/components/typography/common.d.ts +2 -2
  112. package/lib/typescript/components/typography/common.d.ts.map +1 -1
  113. package/lib/typescript/utils/image.d.ts.map +1 -1
  114. package/package.json +3 -2
  115. package/src/components/Advice/index.tsx +1 -1
  116. package/src/components/accordion/RawAccordion.tsx +3 -3
  117. package/src/components/alert/Alert.tsx +4 -1
  118. package/src/components/avatar/Avatar.tsx +1 -1
  119. package/src/components/avatar/__test__/avatar.test.tsx +7 -4
  120. package/src/components/avatar/index.tsx +1 -1
  121. package/src/components/badge/Badge.tsx +16 -11
  122. package/src/components/banner/Banner.tsx +206 -195
  123. package/src/components/banner/__test__/banner.test.tsx +11 -9
  124. package/src/components/banner/index.tsx +1 -1
  125. package/src/components/buttons/ButtonExtendedOutline.tsx +80 -80
  126. package/src/components/buttons/ButtonOutline.tsx +278 -280
  127. package/src/components/buttons/ButtonSolid.tsx +142 -141
  128. package/src/components/buttons/IconButtonContained.tsx +17 -17
  129. package/src/components/buttons/IconButtonSolid.tsx +11 -11
  130. package/src/components/contentWrapper/ContentWrapper.tsx +12 -12
  131. package/src/components/contentWrapper/index.tsx +1 -1
  132. package/src/components/divider/index.tsx +1 -1
  133. package/src/components/icons/index.tsx +1 -1
  134. package/src/components/listitems/ListItemAction.tsx +120 -119
  135. package/src/components/listitems/ListItemIDP.tsx +115 -115
  136. package/src/components/listitems/ListItemNavAlert.tsx +114 -110
  137. package/src/components/listitems/ListItemTransaction.tsx +2 -6
  138. package/src/components/listitems/PressableListItemsBase.tsx +29 -29
  139. package/src/components/listitems/__test__/listitem.test.tsx +53 -15
  140. package/src/components/listitems/hooks/useListItemSpringAnimation.ts +54 -52
  141. package/src/components/pictograms/Pictogram.tsx +6 -3
  142. package/src/components/pictograms/svg/PictogramFocusOn.tsx +39 -0
  143. package/src/components/pictograms/svg/originals/PictogramFocusOn.svg +19 -0
  144. package/src/components/spacer/Spacer.tsx +21 -18
  145. package/src/components/spacer/index.tsx +1 -1
  146. package/src/components/typography/Body.tsx +10 -10
  147. package/src/components/typography/Factory.tsx +38 -38
  148. package/src/components/typography/H1.tsx +19 -19
  149. package/src/components/typography/H2.tsx +19 -19
  150. package/src/components/typography/H4.tsx +12 -12
  151. package/src/components/typography/H5.tsx +24 -24
  152. package/src/components/typography/H6.tsx +10 -10
  153. package/src/components/typography/Label.tsx +16 -16
  154. package/src/components/typography/LabelSmall.tsx +27 -28
  155. package/src/components/typography/Monospace.tsx +14 -14
  156. package/src/components/typography/common.tsx +20 -20
  157. package/src/components/typography/index.tsx +0 -1
  158. package/src/index.tsx +0 -1
  159. package/src/json-import.d.ts +3 -4
  160. package/src/utils/dates.ts +1 -1
  161. package/src/utils/image.ts +22 -22
@@ -5,12 +5,12 @@ import { hexToRgba, IOColors, IOSpacer } from "../../core";
5
5
  export type SpacerOrientation = "vertical" | "horizontal";
6
6
 
7
7
  type BaseSpacerProps = {
8
- orientation: SpacerOrientation;
9
- size: IOSpacer;
8
+ orientation: SpacerOrientation;
9
+ size: IOSpacer;
10
10
  };
11
11
 
12
12
  type SpacerProps = {
13
- size?: IOSpacer;
13
+ size?: IOSpacer;
14
14
  };
15
15
 
16
16
  const DEFAULT_SIZE = 16;
@@ -25,19 +25,22 @@ Native `Spacer` component
25
25
  @param {IOSpacer} size
26
26
  */
27
27
  const Spacer = ({ orientation, size }: BaseSpacerProps) => {
28
- const style = React.useMemo(() => ({
29
- ...(orientation === "vertical" && {
30
- height: size
31
- }),
32
- ...(orientation === "horizontal" && {
33
- width: size
34
- }),
35
- ...((debugMode as boolean) && {
36
- backgroundColor: debugBg
37
- })
38
- }), [orientation, size]);
39
-
40
- return <View style={style} />;
28
+ const style = React.useMemo(
29
+ () => ({
30
+ ...(orientation === "vertical" && {
31
+ height: size
32
+ }),
33
+ ...(orientation === "horizontal" && {
34
+ width: size
35
+ }),
36
+ ...((debugMode as boolean) && {
37
+ backgroundColor: debugBg
38
+ })
39
+ }),
40
+ [orientation, size]
41
+ );
42
+
43
+ return <View style={style} />;
41
44
  };
42
45
 
43
46
  /**
@@ -45,12 +48,12 @@ Horizontal spacer component
45
48
  @param {IOSpacer} size
46
49
  */
47
50
  export const HSpacer = ({ size = DEFAULT_SIZE }: SpacerProps) => (
48
- <Spacer orientation={"horizontal"} size={size} />
51
+ <Spacer orientation={"horizontal"} size={size} />
49
52
  );
50
53
  /**
51
54
  Vertical spacer component
52
55
  @param {IOSpacer} size
53
56
  */
54
57
  export const VSpacer = ({ size = DEFAULT_SIZE }: SpacerProps) => (
55
- <Spacer orientation={"vertical"} size={size} />
58
+ <Spacer orientation={"vertical"} size={size} />
56
59
  );
@@ -1 +1 @@
1
- export * from "./Spacer";
1
+ export * from "./Spacer";
@@ -5,14 +5,14 @@ import { useTypographyFactory } from "./Factory";
5
5
  import { ExternalTypographyProps, TypographyProps } from "./common";
6
6
 
7
7
  type PartialAllowedColors = Extract<
8
- IOColors,
9
- "bluegreyDark" | "white" | "blue" | "bluegrey" | "bluegreyLight"
8
+ IOColors,
9
+ "bluegreyDark" | "white" | "blue" | "bluegrey" | "bluegreyLight"
10
10
  >;
11
11
  type AllowedColors = PartialAllowedColors | IOTheme["textBody-default"];
12
12
  type AllowedWeight = IOFontWeight | "Regular" | "SemiBold";
13
13
 
14
14
  type OwnProps = ExternalTypographyProps<
15
- TypographyProps<AllowedWeight, AllowedColors>
15
+ TypographyProps<AllowedWeight, AllowedColors>
16
16
  >;
17
17
 
18
18
  const fontName: FontFamily = "TitilliumWeb";
@@ -28,10 +28,10 @@ export const bodyDefaultWeight: AllowedWeight = "Regular";
28
28
  * @constructor
29
29
  */
30
30
  export const Body: React.FunctionComponent<OwnProps> = props =>
31
- useTypographyFactory<AllowedWeight, AllowedColors>({
32
- ...props,
33
- defaultWeight: bodyDefaultWeight,
34
- defaultColor: bodyDefaultColor,
35
- font: fontName,
36
- fontStyle: { fontSize: bodyFontSize, lineHeight: bodyLineHeight }
37
- });
31
+ useTypographyFactory<AllowedWeight, AllowedColors>({
32
+ ...props,
33
+ defaultWeight: bodyDefaultWeight,
34
+ defaultColor: bodyDefaultColor,
35
+ font: fontName,
36
+ fontStyle: { fontSize: bodyFontSize, lineHeight: bodyLineHeight }
37
+ });
@@ -4,9 +4,9 @@ import { IOFontWeight } from "../../utils/fonts";
4
4
  import { XOR } from "../../utils/types";
5
5
  import { BaseTypography } from "./BaseTypography";
6
6
  import {
7
- calculateWeightColor,
8
- RequiredTypographyProps,
9
- TypographyProps
7
+ calculateWeightColor,
8
+ RequiredTypographyProps,
9
+ TypographyProps
10
10
  } from "./common";
11
11
 
12
12
  /**
@@ -14,8 +14,8 @@ import {
14
14
  * that will be used when the fields weight and color will be undefined.
15
15
  */
16
16
  type DefaultArgumentProps<WeightPropsType, ColorsPropsType> = {
17
- defaultWeight: WeightPropsType;
18
- defaultColor: ColorsPropsType;
17
+ defaultWeight: WeightPropsType;
18
+ defaultColor: ColorsPropsType;
19
19
  };
20
20
 
21
21
  /**
@@ -23,18 +23,18 @@ type DefaultArgumentProps<WeightPropsType, ColorsPropsType> = {
23
23
  * weight and color, thus allowing to implement more sophisticated strategies.
24
24
  */
25
25
  type DefaultFactoryProps<WeightPropsType, ColorsPropsType> = {
26
- weightColorFactory: (
27
- weight?: WeightPropsType,
28
- color?: ColorsPropsType
29
- ) => RequiredTypographyProps<WeightPropsType, ColorsPropsType>;
26
+ weightColorFactory: (
27
+ weight?: WeightPropsType,
28
+ color?: ColorsPropsType
29
+ ) => RequiredTypographyProps<WeightPropsType, ColorsPropsType>;
30
30
  };
31
31
 
32
32
  /**
33
33
  * Only one type of default props strategy is allowed
34
34
  */
35
35
  type DefaultProps<WeightPropsType, ColorsPropsType> = XOR<
36
- DefaultArgumentProps<WeightPropsType, ColorsPropsType>,
37
- DefaultFactoryProps<WeightPropsType, ColorsPropsType>
36
+ DefaultArgumentProps<WeightPropsType, ColorsPropsType>,
37
+ DefaultFactoryProps<WeightPropsType, ColorsPropsType>
38
38
  >;
39
39
 
40
40
  /**
@@ -44,25 +44,25 @@ type DefaultProps<WeightPropsType, ColorsPropsType> = XOR<
44
44
  * - The default {@link TypographyProps}
45
45
  */
46
46
  type FactoryProps<WeightPropsType, ColorsPropsType> = TypographyProps<
47
- WeightPropsType,
48
- ColorsPropsType
47
+ WeightPropsType,
48
+ ColorsPropsType
49
49
  > &
50
- DefaultProps<WeightPropsType, ColorsPropsType> &
51
- Omit<React.ComponentProps<typeof BaseTypography>, "weight" | "color">;
50
+ DefaultProps<WeightPropsType, ColorsPropsType> &
51
+ Omit<React.ComponentProps<typeof BaseTypography>, "weight" | "color">;
52
52
 
53
53
  /**
54
54
  * Calculate if the props is of type {@link DefaultFactoryProps}
55
55
  * @param props
56
56
  */
57
57
  function isDefaultFactoryProps<WeightPropsType, ColorsPropsType>(
58
- props:
59
- | DefaultFactoryProps<WeightPropsType, ColorsPropsType>
60
- | DefaultArgumentProps<WeightPropsType, ColorsPropsType>
58
+ props:
59
+ | DefaultFactoryProps<WeightPropsType, ColorsPropsType>
60
+ | DefaultArgumentProps<WeightPropsType, ColorsPropsType>
61
61
  ): props is DefaultFactoryProps<WeightPropsType, ColorsPropsType> {
62
- return (
63
- (props as DefaultFactoryProps<WeightPropsType, ColorsPropsType>)
64
- .weightColorFactory !== undefined
65
- );
62
+ return (
63
+ (props as DefaultFactoryProps<WeightPropsType, ColorsPropsType>)
64
+ .weightColorFactory !== undefined
65
+ );
66
66
  }
67
67
 
68
68
  /**
@@ -72,22 +72,22 @@ function isDefaultFactoryProps<WeightPropsType, ColorsPropsType>(
72
72
  * @param props
73
73
  */
74
74
  export function useTypographyFactory<
75
- WeightPropsType extends IOFontWeight,
76
- ColorsPropsType extends IOColors
75
+ WeightPropsType extends IOFontWeight,
76
+ ColorsPropsType extends IOColors
77
77
  >(props: FactoryProps<WeightPropsType, ColorsPropsType>) {
78
- // Use different strategy to calculate the default values, based on DefaultProps
79
- const { weight, color } = useMemo(
80
- () =>
81
- isDefaultFactoryProps(props)
82
- ? props.weightColorFactory(props.weight, props.color)
83
- : calculateWeightColor(
84
- props.defaultWeight,
85
- props.defaultColor,
86
- props.weight,
87
- props.color
88
- ),
89
- [props]
90
- );
78
+ // Use different strategy to calculate the default values, based on DefaultProps
79
+ const { weight, color } = useMemo(
80
+ () =>
81
+ isDefaultFactoryProps(props)
82
+ ? props.weightColorFactory(props.weight, props.color)
83
+ : calculateWeightColor(
84
+ props.defaultWeight,
85
+ props.defaultColor,
86
+ props.weight,
87
+ props.color
88
+ ),
89
+ [props]
90
+ );
91
91
 
92
- return <BaseTypography weight={weight} color={color} {...props} />;
92
+ return <BaseTypography weight={weight} color={color} {...props} />;
93
93
  }
@@ -1,25 +1,25 @@
1
1
  import React from "react";
2
2
  import {
3
- IOColors,
4
- IOColorsStatusForeground,
5
- IOTheme
3
+ IOColors,
4
+ IOColorsStatusForeground,
5
+ IOTheme
6
6
  } from "../../core/IOColors";
7
7
  import { FontFamily, IOFontWeight } from "../../utils/fonts";
8
8
  import { useTypographyFactory } from "./Factory";
9
9
  import { ExternalTypographyProps, TypographyProps } from "./common";
10
10
 
11
11
  type PartialAllowedColors = Extract<
12
- IOColors,
13
- "bluegreyDark" | "white" | "blue"
12
+ IOColors,
13
+ "bluegreyDark" | "white" | "blue"
14
14
  >;
15
15
  type AllowedColors =
16
- | PartialAllowedColors
17
- | IOColorsStatusForeground
18
- | IOTheme["textHeading-default"];
16
+ | PartialAllowedColors
17
+ | IOColorsStatusForeground
18
+ | IOTheme["textHeading-default"];
19
19
  type AllowedWeight = Extract<IOFontWeight, "Bold">;
20
20
 
21
21
  type OwnProps = ExternalTypographyProps<
22
- TypographyProps<AllowedWeight, AllowedColors>
22
+ TypographyProps<AllowedWeight, AllowedColors>
23
23
  >;
24
24
 
25
25
  export const h1FontSize = 26;
@@ -33,13 +33,13 @@ export const h1DefaultWeight: AllowedWeight = "Bold";
33
33
  * @param props
34
34
  * @constructor
35
35
  */
36
- export const H1: React.FC<OwnProps> = (props) => {
37
- const fontName: FontFamily = "TitilliumWeb";
38
- return useTypographyFactory<AllowedWeight, AllowedColors>({
39
- ...props,
40
- defaultWeight: h1DefaultWeight,
41
- defaultColor: h1DefaultColor,
42
- font: fontName,
43
- fontStyle: { fontSize: h1FontSize, lineHeight: h1LineHeight }
44
- });
45
- };
36
+ export const H1: React.FC<OwnProps> = props => {
37
+ const fontName: FontFamily = "TitilliumWeb";
38
+ return useTypographyFactory<AllowedWeight, AllowedColors>({
39
+ ...props,
40
+ defaultWeight: h1DefaultWeight,
41
+ defaultColor: h1DefaultColor,
42
+ font: fontName,
43
+ fontStyle: { fontSize: h1FontSize, lineHeight: h1LineHeight }
44
+ });
45
+ };
@@ -1,25 +1,25 @@
1
1
  import React from "react";
2
2
  import {
3
- IOColors,
4
- IOColorsStatusForeground,
5
- IOTheme
3
+ IOColors,
4
+ IOColorsStatusForeground,
5
+ IOTheme
6
6
  } from "../../core/IOColors";
7
7
  import { FontFamily, IOFontWeight } from "../../utils/fonts";
8
8
  import { useTypographyFactory } from "./Factory";
9
9
  import { ExternalTypographyProps, TypographyProps } from "./common";
10
10
 
11
11
  type PartialAllowedColors = Extract<
12
- IOColors,
13
- "bluegreyDark" | "white" | "blue" | "bluegrey"
12
+ IOColors,
13
+ "bluegreyDark" | "white" | "blue" | "bluegrey"
14
14
  >;
15
15
  type AllowedColors =
16
- | PartialAllowedColors
17
- | IOColorsStatusForeground
18
- | IOTheme["textHeading-default"];
16
+ | PartialAllowedColors
17
+ | IOColorsStatusForeground
18
+ | IOTheme["textHeading-default"];
19
19
  type AllowedWeight = Extract<IOFontWeight, "Bold" | "SemiBold">;
20
20
 
21
21
  type OwnProps = ExternalTypographyProps<
22
- TypographyProps<AllowedWeight, AllowedColors>
22
+ TypographyProps<AllowedWeight, AllowedColors>
23
23
  >;
24
24
 
25
25
  export const h2FontSize = 20;
@@ -33,13 +33,13 @@ export const h2DefaultWeight: AllowedWeight = "Bold";
33
33
  * @param props
34
34
  * @constructor
35
35
  */
36
- export const H2: React.FC<OwnProps> = (props) => {
37
- const fontName: FontFamily = "TitilliumWeb";
38
- return useTypographyFactory<AllowedWeight, AllowedColors>({
39
- ...props,
40
- defaultWeight: h2DefaultWeight,
41
- defaultColor: h2DefaultColor,
42
- font: fontName,
43
- fontStyle: { fontSize: h2FontSize, lineHeight: h2LineHeight }
44
- });
45
- };
36
+ export const H2: React.FC<OwnProps> = props => {
37
+ const fontName: FontFamily = "TitilliumWeb";
38
+ return useTypographyFactory<AllowedWeight, AllowedColors>({
39
+ ...props,
40
+ defaultWeight: h2DefaultWeight,
41
+ defaultColor: h2DefaultColor,
42
+ font: fontName,
43
+ fontStyle: { fontSize: h2FontSize, lineHeight: h2LineHeight }
44
+ });
45
+ };
@@ -8,7 +8,7 @@ type AllowedColors = IOColorsStatusForeground | IOTheme["textHeading-default"];
8
8
  type AllowedWeight = Extract<IOFontWeight, "SemiBold" | "Regular">;
9
9
 
10
10
  type OwnProps = ExternalTypographyProps<
11
- TypographyProps<AllowedWeight, AllowedColors>
11
+ TypographyProps<AllowedWeight, AllowedColors>
12
12
  >;
13
13
 
14
14
  /* Common typographic styles */
@@ -22,16 +22,16 @@ export const h4LineHeight = 24;
22
22
  * @constructor
23
23
  */
24
24
  export const H4: React.FC<OwnProps> = props => {
25
- /* New typographic styles */
26
- const font: FontFamily = "ReadexPro";
27
- const defaultColor: AllowedColors = "black";
28
- const defaultWeight: AllowedWeight = "Regular";
25
+ /* New typographic styles */
26
+ const font: FontFamily = "ReadexPro";
27
+ const defaultColor: AllowedColors = "black";
28
+ const defaultWeight: AllowedWeight = "Regular";
29
29
 
30
- return useTypographyFactory<AllowedWeight, AllowedColors>({
31
- ...props,
32
- defaultWeight,
33
- defaultColor,
34
- font,
35
- fontStyle: { fontSize: h4FontSize, lineHeight: h4LineHeight }
36
- });
30
+ return useTypographyFactory<AllowedWeight, AllowedColors>({
31
+ ...props,
32
+ defaultWeight,
33
+ defaultColor,
34
+ font,
35
+ fontStyle: { fontSize: h4FontSize, lineHeight: h4LineHeight }
36
+ });
37
37
  };
@@ -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
- IOColors,
10
- "bluegreyDark" | "bluegrey" | "bluegreyLight" | "blue" | "white" | "red"
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
- IOColors,
16
- | "bluegreyDark"
17
- | "bluegrey"
18
- | "bluegreyLight"
19
- | "blue"
20
- | "white"
21
- | "red"
22
- | "grey"
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
- weight?: Extract<IOFontWeight, "SemiBold">;
34
- color?: AllowedSemiBoldColors;
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
- weight: Extract<IOFontWeight, "Regular">;
40
- color?: AllowedRegularColors;
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> = (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
- };
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
- TypographyProps<AllowedWeight, AllowedColors>
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> = (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
- });
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
- IOColors,
9
- "blue" | "bluegrey" | "bluegreyDark" | "white" | "red"
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
- TypographyProps<AllowedWeight, AllowedColors>
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> = (props) => {
24
- const fontName: FontFamily = "TitilliumWeb";
25
- const fontSize = 16;
26
- const labelDefaultWeight = "Bold";
27
- const labelDefaultcolor = "blue";
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
- return useTypographyFactory<AllowedWeight, AllowedColors>({
30
- ...props,
31
- defaultWeight: labelDefaultWeight,
32
- defaultColor: labelDefaultcolor,
33
- font: fontName,
34
- fontStyle: { fontSize }
35
- });
36
- };
29
+ return useTypographyFactory<AllowedWeight, AllowedColors>({
30
+ ...props,
31
+ defaultWeight: labelDefaultWeight,
32
+ defaultColor: labelDefaultcolor,
33
+ font: fontName,
34
+ fontStyle: { fontSize }
35
+ });
36
+ };
@@ -5,24 +5,23 @@ import { useTypographyFactory } from "./Factory";
5
5
  import { ExternalTypographyProps, TypographyProps } from "./common";
6
6
 
7
7
  type PartialAllowedColors = Extract<
8
- IOColors,
9
- | "blue"
10
- | "bluegrey"
11
- | "red"
12
- | "white"
13
- | "bluegreyDark"
14
- | "grey-700"
15
- | "grey-200"
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
- TypographyProps<AllowedWeight, AllowedColors>
22
+ TypographyProps<AllowedWeight, AllowedColors>
23
23
  > &
24
- AllowedFontSize;
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> = (props) => {
34
- const fontName: FontFamily = "TitilliumWeb";
35
- const fontSizeMapping: Record<FontSize, number> = { regular: 14, small: 12 };
36
- const labelDefaultWeight = "Bold";
37
- const labelDefaultcolor = "blue";
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
- return useTypographyFactory<AllowedWeight, AllowedColors>({
40
- ...props,
41
- defaultWeight: labelDefaultWeight,
42
- defaultColor:labelDefaultcolor,
43
- font: fontName,
44
- fontStyle: {
45
- fontSize: props.fontSize
46
- ? fontSizeMapping[props.fontSize]
47
- : fontSizeMapping.regular
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
- TypographyProps<AllowedWeight, AllowedColors>
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> = (props) => {
21
- const fontName: FontFamily = "RobotoMono";
22
- const fontSize = 16;
20
+ export const Monospace: React.FC<OwnProps> = props => {
21
+ const fontName: FontFamily = "RobotoMono";
22
+ const fontSize = 16;
23
23
 
24
- const monospaceDefaultWeight = "Regular";
25
- const monospaceDefaultcolor = "bluegrey";
24
+ const monospaceDefaultWeight = "Regular";
25
+ const monospaceDefaultcolor = "bluegrey";
26
26
 
27
- return useTypographyFactory<AllowedWeight, AllowedColors>({
28
- ...props,
29
- defaultWeight: monospaceDefaultWeight,
30
- defaultColor: monospaceDefaultcolor,
31
- font: fontName,
32
- fontStyle: { fontSize }
33
- });
34
- };
27
+ return useTypographyFactory<AllowedWeight, AllowedColors>({
28
+ ...props,
29
+ defaultWeight: monospaceDefaultWeight,
30
+ defaultColor: monospaceDefaultcolor,
31
+ font: fontName,
32
+ fontStyle: { fontSize }
33
+ });
34
+ };