@pagopa/io-app-design-system 1.12.0 → 1.13.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 (105) hide show
  1. package/lib/commonjs/components/buttons/ButtonSolid.js +36 -8
  2. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  3. package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +46 -29
  4. package/lib/commonjs/components/index.js +11 -0
  5. package/lib/commonjs/components/index.js.map +1 -1
  6. package/lib/commonjs/components/layout/BlockButtons.js +1 -4
  7. package/lib/commonjs/components/layout/BlockButtons.js.map +1 -1
  8. package/lib/commonjs/components/layout/FooterWithButtons.js +20 -9
  9. package/lib/commonjs/components/layout/FooterWithButtons.js.map +1 -1
  10. package/lib/commonjs/components/layout/HeaderFirstLevel.js +15 -12
  11. package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
  12. package/lib/commonjs/components/layout/HeaderSecondLevel.js +8 -8
  13. package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
  14. package/lib/commonjs/components/loadingSpinner/LoadingSpinner.js +106 -0
  15. package/lib/commonjs/components/loadingSpinner/LoadingSpinner.js.map +1 -0
  16. package/lib/commonjs/components/loadingSpinner/index.js +17 -0
  17. package/lib/commonjs/components/loadingSpinner/index.js.map +1 -0
  18. package/lib/commonjs/components/pictograms/Pictogram.js +5 -1
  19. package/lib/commonjs/components/pictograms/Pictogram.js.map +1 -1
  20. package/lib/commonjs/components/pictograms/svg/PictogramBleedNotification.js +47 -0
  21. package/lib/commonjs/components/pictograms/svg/PictogramBleedNotification.js.map +1 -0
  22. package/lib/commonjs/components/pictograms/svg/PictogramNotification.js +47 -0
  23. package/lib/commonjs/components/pictograms/svg/PictogramNotification.js.map +1 -0
  24. package/lib/commonjs/components/pictograms/svg/originals/PictogramBleedNotification.svg +30 -0
  25. package/lib/commonjs/components/pictograms/svg/originals/PictogramNotification.svg +30 -0
  26. package/lib/commonjs/core/IOStyles.js +10 -0
  27. package/lib/commonjs/core/IOStyles.js.map +1 -1
  28. package/lib/commonjs/core/IOTransitions.js +106 -0
  29. package/lib/commonjs/core/IOTransitions.js.map +1 -0
  30. package/lib/commonjs/core/index.js +11 -0
  31. package/lib/commonjs/core/index.js.map +1 -1
  32. package/lib/module/components/buttons/ButtonSolid.js +36 -9
  33. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  34. package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +46 -29
  35. package/lib/module/components/index.js +1 -0
  36. package/lib/module/components/index.js.map +1 -1
  37. package/lib/module/components/layout/BlockButtons.js +1 -4
  38. package/lib/module/components/layout/BlockButtons.js.map +1 -1
  39. package/lib/module/components/layout/FooterWithButtons.js +20 -10
  40. package/lib/module/components/layout/FooterWithButtons.js.map +1 -1
  41. package/lib/module/components/layout/HeaderFirstLevel.js +15 -12
  42. package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
  43. package/lib/module/components/layout/HeaderSecondLevel.js +8 -8
  44. package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
  45. package/lib/module/components/loadingSpinner/LoadingSpinner.js +98 -0
  46. package/lib/module/components/loadingSpinner/LoadingSpinner.js.map +1 -0
  47. package/lib/module/components/loadingSpinner/index.js +2 -0
  48. package/lib/module/components/loadingSpinner/index.js.map +1 -0
  49. package/lib/module/components/pictograms/Pictogram.js +5 -1
  50. package/lib/module/components/pictograms/Pictogram.js.map +1 -1
  51. package/lib/module/components/pictograms/svg/PictogramBleedNotification.js +39 -0
  52. package/lib/module/components/pictograms/svg/PictogramBleedNotification.js.map +1 -0
  53. package/lib/module/components/pictograms/svg/PictogramNotification.js +39 -0
  54. package/lib/module/components/pictograms/svg/PictogramNotification.js.map +1 -0
  55. package/lib/module/components/pictograms/svg/originals/PictogramBleedNotification.svg +30 -0
  56. package/lib/module/components/pictograms/svg/originals/PictogramNotification.svg +30 -0
  57. package/lib/module/core/IOStyles.js +10 -0
  58. package/lib/module/core/IOStyles.js.map +1 -1
  59. package/lib/module/core/IOTransitions.js +98 -0
  60. package/lib/module/core/IOTransitions.js.map +1 -0
  61. package/lib/module/core/index.js +1 -0
  62. package/lib/module/core/index.js.map +1 -1
  63. package/lib/typescript/components/buttons/ButtonSolid.d.ts +5 -1
  64. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
  65. package/lib/typescript/components/index.d.ts +1 -0
  66. package/lib/typescript/components/index.d.ts.map +1 -1
  67. package/lib/typescript/components/layout/FooterWithButtons.d.ts +4 -1
  68. package/lib/typescript/components/layout/FooterWithButtons.d.ts.map +1 -1
  69. package/lib/typescript/components/layout/HeaderFirstLevel.d.ts +2 -1
  70. package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
  71. package/lib/typescript/components/loadingSpinner/LoadingSpinner.d.ts +17 -0
  72. package/lib/typescript/components/loadingSpinner/LoadingSpinner.d.ts.map +1 -0
  73. package/lib/typescript/components/loadingSpinner/index.d.ts +2 -0
  74. package/lib/typescript/components/loadingSpinner/index.d.ts.map +1 -0
  75. package/lib/typescript/components/pictograms/Pictogram.d.ts +2 -1
  76. package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
  77. package/lib/typescript/components/pictograms/svg/PictogramBleedNotification.d.ts +5 -0
  78. package/lib/typescript/components/pictograms/svg/PictogramBleedNotification.d.ts.map +1 -0
  79. package/lib/typescript/components/pictograms/svg/PictogramNotification.d.ts +5 -0
  80. package/lib/typescript/components/pictograms/svg/PictogramNotification.d.ts.map +1 -0
  81. package/lib/typescript/core/IOStyles.d.ts +10 -0
  82. package/lib/typescript/core/IOStyles.d.ts.map +1 -1
  83. package/lib/typescript/core/IOTransitions.d.ts +58 -0
  84. package/lib/typescript/core/IOTransitions.d.ts.map +1 -0
  85. package/lib/typescript/core/index.d.ts +1 -0
  86. package/lib/typescript/core/index.d.ts.map +1 -1
  87. package/lib/typescript/stories/ButtonDS.stories.d.ts +1 -1
  88. package/package.json +1 -1
  89. package/src/components/buttons/ButtonSolid.tsx +67 -22
  90. package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +46 -29
  91. package/src/components/index.tsx +1 -0
  92. package/src/components/layout/BlockButtons.tsx +1 -1
  93. package/src/components/layout/FooterWithButtons.tsx +11 -5
  94. package/src/components/layout/HeaderFirstLevel.tsx +30 -9
  95. package/src/components/layout/HeaderSecondLevel.tsx +11 -11
  96. package/src/components/loadingSpinner/LoadingSpinner.tsx +125 -0
  97. package/src/components/loadingSpinner/index.tsx +1 -0
  98. package/src/components/pictograms/Pictogram.tsx +7 -2
  99. package/src/components/pictograms/svg/PictogramBleedNotification.tsx +42 -0
  100. package/src/components/pictograms/svg/PictogramNotification.tsx +42 -0
  101. package/src/components/pictograms/svg/originals/PictogramBleedNotification.svg +30 -0
  102. package/src/components/pictograms/svg/originals/PictogramNotification.svg +30 -0
  103. package/src/core/IOStyles.ts +10 -0
  104. package/src/core/IOTransitions.ts +94 -0
  105. package/src/core/index.ts +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PictogramBleedNotification.d.ts","sourceRoot":"","sources":["../../../../../src/components/pictograms/svg/PictogramBleedNotification.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,QAAA,MAAM,0BAA0B,oCAI7B,iBAAiB,sBA+BnB,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { SVGPictogramProps } from "../Pictogram";
3
+ declare const PictogramNotification: ({ size, colorValues, ...props }: SVGPictogramProps) => React.JSX.Element;
4
+ export default PictogramNotification;
5
+ //# sourceMappingURL=PictogramNotification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PictogramNotification.d.ts","sourceRoot":"","sources":["../../../../../src/components/pictograms/svg/PictogramNotification.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,QAAA,MAAM,qBAAqB,oCAIxB,iBAAiB,sBA+BnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -72,6 +72,11 @@ export declare const IOButtonLegacyStyles: {
72
72
  paddingHorizontal: number;
73
73
  elevation: number;
74
74
  };
75
+ buttonInner: {
76
+ flexDirection: "row";
77
+ alignItems: "center";
78
+ justifyContent: "center";
79
+ };
75
80
  label: {
76
81
  alignSelf: "center";
77
82
  };
@@ -92,6 +97,11 @@ export declare const IOButtonStyles: {
92
97
  paddingHorizontal: number;
93
98
  elevation: number;
94
99
  };
100
+ buttonInner: {
101
+ flexDirection: "row";
102
+ alignItems: "center";
103
+ justifyContent: "center";
104
+ };
95
105
  buttonLink: {
96
106
  flexDirection: "row";
97
107
  alignItems: "center";
@@ -1 +1 @@
1
- {"version":3,"file":"IOStyles.d.ts","sourceRoot":"","sources":["../../../src/core/IOStyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEpE;;GAEG;AAEH,UAAU,gBAAgB;IACxB,gBAAgB,EAAE,WAAW,CAAC;IAE9B,YAAY,EAAE,MAAM,CAAC;IAErB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED,eAAO,MAAM,gBAAgB,EAAE,gBAM9B,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDnB,CAAC;AAeH,eAAO,MAAM,iBAAiB,EAAE,MAAuB,CAAC;AAGxD,eAAO,MA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M,+BAA+B,EAAE,+BAQ3C,CAAC;AAEJ,eAAO,MAAM,yBAAyB;;;;;;;;;;;CAWpC,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ A custom enter transition designed for the average size
3
+ inner content of a button or module (e.g. text).
4
+ The scaling effect is slight.
5
+ */
6
+ export declare const enterTransitionInnerContent: () => {
7
+ initialValues: {
8
+ opacity: number;
9
+ transform: {
10
+ scale: number;
11
+ }[];
12
+ };
13
+ animations: {
14
+ opacity: 1;
15
+ transform: {
16
+ scale: 1;
17
+ }[];
18
+ };
19
+ };
20
+ /**
21
+ A custom enter transition designed for the small size
22
+ inner content of a button or module (e.g. loading spinner).
23
+ The scaling effect is accentuated.
24
+ */
25
+ export declare const enterTransitionInnerContentSmall: () => {
26
+ initialValues: {
27
+ opacity: number;
28
+ transform: {
29
+ scale: number;
30
+ }[];
31
+ };
32
+ animations: {
33
+ opacity: 1;
34
+ transform: {
35
+ scale: 1;
36
+ }[];
37
+ };
38
+ };
39
+ /**
40
+ A custom exit transition designed for both small
41
+ and average size inner content of a button or module.
42
+ The scaling effect is slight.
43
+ */
44
+ export declare const exitTransitionInnerContent: () => {
45
+ initialValues: {
46
+ opacity: number;
47
+ transform: {
48
+ scale: number;
49
+ }[];
50
+ };
51
+ animations: {
52
+ opacity: 0;
53
+ transform: {
54
+ scale: 0.9;
55
+ }[];
56
+ };
57
+ };
58
+ //# sourceMappingURL=IOTransitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IOTransitions.d.ts","sourceRoot":"","sources":["../../../src/core/IOTransitions.ts"],"names":[],"mappings":"AAEA;;;;EAIE;AACF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;CAwBvC,CAAC;AAEF;;;;EAIE;AACF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;CAwB5C,CAAC;AAEF;;;;EAIE;AACF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;CAwBtC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from "./IOColors";
2
2
  export * from "./IOAnimations";
3
+ export * from "./IOTransitions";
3
4
  export * from "./IOStyles";
4
5
  export * from "./IOShapes";
5
6
  export * from "./IOSpacing";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC"}
@@ -2,7 +2,7 @@
2
2
  import type { StoryObj } from "@storybook/react";
3
3
  declare const meta: {
4
4
  title: string;
5
- component: import("react").MemoExoticComponent<({ color, label, fullWidth, disabled, icon, iconPosition, onPress, accessibilityLabel, accessibilityHint, testID }: import("../components").ButtonSolidProps) => import("react").JSX.Element>;
5
+ component: import("react").MemoExoticComponent<({ color, label, fullWidth, disabled, loading, icon, iconPosition, onPress, accessibilityLabel, accessibilityHint, testID }: import("../components").ButtonSolidProps) => import("react").JSX.Element>;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-app-design-system",
3
- "version": "1.12.0",
3
+ "version": "1.13.1",
4
4
  "description": "The library defining the core components of the design system of @pagopa/io-app",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -9,6 +9,7 @@ import Animated, {
9
9
  useSharedValue,
10
10
  withSpring
11
11
  } from "react-native-reanimated";
12
+ import ReactNativeHapticFeedback from "react-native-haptic-feedback";
12
13
  import { IOIconSizeScale, IOIcons, Icon } from "../icons";
13
14
  import { WithTestID } from "../../utils/types";
14
15
  import { HSpacer } from "../spacer/Spacer";
@@ -19,8 +20,12 @@ import {
19
20
  IOColors,
20
21
  IOScaleValues,
21
22
  IOSpringValues,
23
+ enterTransitionInnerContent,
24
+ enterTransitionInnerContentSmall,
25
+ exitTransitionInnerContent,
22
26
  useIOExperimentalDesign
23
27
  } from "../../core";
28
+ import { LoadingSpinner } from "../loadingSpinner";
24
29
 
25
30
  type ButtonSolidColor = "primary" | "danger" | "contrast";
26
31
 
@@ -65,6 +70,10 @@ export type ButtonSolidProps = WithTestID<{
65
70
  * @default false
66
71
  */
67
72
  fullWidth?: boolean;
73
+ /**
74
+ * @default false
75
+ */
76
+ loading?: boolean;
68
77
  /**
69
78
  * @default false
70
79
  */
@@ -152,6 +161,7 @@ export const ButtonSolid = React.memo(
152
161
  label,
153
162
  fullWidth = false,
154
163
  disabled = false,
164
+ loading = false,
155
165
  icon,
156
166
  iconPosition = "start",
157
167
  onPress,
@@ -211,6 +221,19 @@ export const ButtonSolid = React.memo(
211
221
  isPressed.value = 0;
212
222
  }, [isPressed]);
213
223
 
224
+ const handleOnPress = useCallback(
225
+ (event: GestureResponderEvent) => {
226
+ /* Don't call `onPress` if the button is
227
+ in loading state */
228
+ if (loading) {
229
+ return;
230
+ }
231
+ ReactNativeHapticFeedback.trigger("impactLight");
232
+ onPress(event);
233
+ },
234
+ [loading, onPress]
235
+ );
236
+
214
237
  // Label & Icons colors
215
238
  const foregroundColor: IOColors = disabled
216
239
  ? colorMap[color]?.label?.disabled
@@ -218,22 +241,23 @@ export const ButtonSolid = React.memo(
218
241
 
219
242
  return (
220
243
  <Pressable
244
+ testID={testID}
245
+ accessible={true}
221
246
  accessibilityLabel={accessibilityLabel}
222
247
  accessibilityHint={accessibilityHint}
248
+ accessibilityState={{ busy: loading }}
223
249
  accessibilityRole={"button"}
224
- testID={testID}
225
- onPress={onPress}
250
+ onPress={handleOnPress}
226
251
  onPressIn={onPressIn}
227
252
  onPressOut={onPressOut}
228
- accessible={true}
229
253
  disabled={disabled}
230
254
  style={!fullWidth ? IOButtonStyles.dimensionsDefault : {}}
231
255
  >
232
256
  <Animated.View
233
257
  style={[
234
258
  buttonStyles.button,
259
+ { overflow: "hidden" },
235
260
  isExperimental && fullWidth && { paddingHorizontal: 16 },
236
- iconPosition === "end" && { flexDirection: "row-reverse" },
237
261
  buttonStyles.buttonSizeDefault,
238
262
  disabled
239
263
  ? isExperimental
@@ -241,30 +265,51 @@ export const ButtonSolid = React.memo(
241
265
  : legacyStyles.backgroundDisabled
242
266
  : { backgroundColor: colorMap[color]?.default },
243
267
  /* Prevent Reanimated from overriding background colors
244
- if button is disabled */
268
+ if button is disabled */
245
269
  !disabled && pressedAnimationStyle
246
270
  ]}
247
271
  >
248
- {icon && (
249
- <>
250
- {/* If 'iconPosition' is set to 'end', we use
272
+ {loading && (
273
+ <Animated.View
274
+ style={buttonStyles.buttonInner}
275
+ entering={enterTransitionInnerContentSmall}
276
+ exiting={exitTransitionInnerContent}
277
+ >
278
+ <LoadingSpinner color={foregroundColor} />
279
+ </Animated.View>
280
+ )}
281
+
282
+ {!loading && (
283
+ <Animated.View
284
+ style={[
285
+ buttonStyles.buttonInner,
286
+ iconPosition === "end" && { flexDirection: "row-reverse" }
287
+ ]}
288
+ entering={enterTransitionInnerContent}
289
+ exiting={exitTransitionInnerContent}
290
+ >
291
+ {icon && (
292
+ <>
293
+ {/* If 'iconPosition' is set to 'end', we use
251
294
  reverse flex property to invert the position */}
252
- <Icon name={icon} size={iconSize} color={foregroundColor} />
253
- {/* Once we have support for 'gap' property,
295
+ <Icon name={icon} size={iconSize} color={foregroundColor} />
296
+ {/* Once we have support for 'gap' property,
254
297
  we can get rid of that spacer */}
255
- <HSpacer size={8} />
256
- </>
298
+ <HSpacer size={8} />
299
+ </>
300
+ )}
301
+ <ButtonText
302
+ color={foregroundColor}
303
+ style={IOButtonStyles.label}
304
+ numberOfLines={1}
305
+ ellipsizeMode="tail"
306
+ allowFontScaling={isExperimental}
307
+ maxFontSizeMultiplier={1.3}
308
+ >
309
+ {label}
310
+ </ButtonText>
311
+ </Animated.View>
257
312
  )}
258
- <ButtonText
259
- color={foregroundColor}
260
- style={IOButtonStyles.label}
261
- numberOfLines={1}
262
- ellipsizeMode="tail"
263
- allowFontScaling={isExperimental}
264
- maxFontSizeMultiplier={1.3}
265
- >
266
- {label}
267
- </ButtonText>
268
313
  </Animated.View>
269
314
  </Pressable>
270
315
  );
@@ -371,7 +371,7 @@ exports[`Test Buttons Components ButtonSolid Snapshot 1`] = `
371
371
  accessibilityRole="button"
372
372
  accessibilityState={
373
373
  {
374
- "busy": undefined,
374
+ "busy": false,
375
375
  "checked": undefined,
376
376
  "disabled": false,
377
377
  "expanded": undefined,
@@ -416,7 +416,9 @@ exports[`Test Buttons Components ButtonSolid Snapshot 1`] = `
416
416
  "paddingHorizontal": 16,
417
417
  "textAlignVertical": "center",
418
418
  },
419
- false,
419
+ {
420
+ "overflow": "hidden",
421
+ },
420
422
  false,
421
423
  {
422
424
  "height": 40,
@@ -435,40 +437,55 @@ exports[`Test Buttons Components ButtonSolid Snapshot 1`] = `
435
437
  ]
436
438
  }
437
439
  >
438
- <Text
439
- allowFontScaling={false}
440
- color="white"
441
- defaultColor="white"
442
- defaultWeight="Bold"
443
- ellipsizeMode="tail"
444
- font="TitilliumWeb"
445
- fontStyle={
446
- {
447
- "fontSize": 16,
448
- }
449
- }
450
- maxFontSizeMultiplier={1.3}
451
- numberOfLines={1}
440
+ <View
441
+ entering={[Function]}
442
+ exiting={[Function]}
452
443
  style={
453
444
  [
454
445
  {
455
- "alignSelf": "center",
456
- },
457
- {
458
- "fontSize": 16,
459
- },
460
- {
461
- "color": "#FFFFFF",
462
- "fontFamily": "Titillium Web",
463
- "fontStyle": "normal",
464
- "fontWeight": "700",
446
+ "alignItems": "center",
447
+ "flexDirection": "row",
448
+ "justifyContent": "center",
465
449
  },
450
+ false,
466
451
  ]
467
452
  }
468
- weight="Bold"
469
453
  >
470
- label
471
- </Text>
454
+ <Text
455
+ allowFontScaling={false}
456
+ color="white"
457
+ defaultColor="white"
458
+ defaultWeight="Bold"
459
+ ellipsizeMode="tail"
460
+ font="TitilliumWeb"
461
+ fontStyle={
462
+ {
463
+ "fontSize": 16,
464
+ }
465
+ }
466
+ maxFontSizeMultiplier={1.3}
467
+ numberOfLines={1}
468
+ style={
469
+ [
470
+ {
471
+ "alignSelf": "center",
472
+ },
473
+ {
474
+ "fontSize": 16,
475
+ },
476
+ {
477
+ "color": "#FFFFFF",
478
+ "fontFamily": "Titillium Web",
479
+ "fontStyle": "normal",
480
+ "fontWeight": "700",
481
+ },
482
+ ]
483
+ }
484
+ weight="Bold"
485
+ >
486
+ label
487
+ </Text>
488
+ </View>
472
489
  </View>
473
490
  </View>
474
491
  `;
@@ -10,6 +10,7 @@ export * from "./featureInfo";
10
10
  export * from "./icons";
11
11
  export * from "./listitems";
12
12
  export * from "./logos";
13
+ export * from "./loadingSpinner";
13
14
  export * from "./modules";
14
15
  export * from "./banner";
15
16
  export * from "./pictograms";
@@ -133,7 +133,7 @@ export const BlockButtons = (props: Props) => {
133
133
  );
134
134
 
135
135
  return (
136
- <View style={{ ...IOStyles.flex, ...IOStyles.row }}>
136
+ <View style={IOStyles.row}>
137
137
  {renderLeftButton()}
138
138
  {renderMidButton()}
139
139
  {renderRightButton()}
@@ -4,6 +4,10 @@ import { StyleSheet, View } from "react-native";
4
4
  import { IOStyles } from "../../core";
5
5
  import { BlockButtons, BlockButtonsProps } from "./BlockButtons";
6
6
 
7
+ type Props = BlockButtonsProps & {
8
+ sticky?: boolean;
9
+ };
10
+
7
11
  // TODO: Refactor with an unique component like `FooterTopShadow` after bonus vacanze
8
12
  const styles = StyleSheet.create({
9
13
  container: {
@@ -11,7 +15,9 @@ const styles = StyleSheet.create({
11
15
  width: "100%",
12
16
  // This Magic number is an heritage of the app code-base, this component should be removed in favor of `GradientBottomAction`
13
17
  marginTop: -50,
14
- paddingTop: 50,
18
+ paddingTop: 50
19
+ },
20
+ sticky: {
15
21
  position: "absolute",
16
22
  bottom: 0
17
23
  }
@@ -21,15 +27,15 @@ const styles = StyleSheet.create({
21
27
  * Implements a component that show buttons as sticky footer
22
28
  * It can include 1, 2 or 3 buttons. If they are 2, they can have the inlineHalf or the inlineOneThird style
23
29
  */
24
- export const FooterWithButtons = (props: BlockButtonsProps) => (
30
+ export const FooterWithButtons = ({ sticky = false, ...rest }: Props) => (
25
31
  <View
26
- style={styles.container}
27
- accessible={props.accessible}
32
+ style={{ ...styles.container, ...(sticky ? styles.sticky : {}) }}
33
+ accessible={rest.accessible}
28
34
  pointerEvents={"box-none"}
29
35
  testID="FooterWithButtons"
30
36
  >
31
37
  <View style={IOStyles.footer}>
32
- <BlockButtons {...props} />
38
+ <BlockButtons {...rest} />
33
39
  </View>
34
40
  </View>
35
41
  );
@@ -10,6 +10,8 @@ import { ActionProp } from "./common";
10
10
 
11
11
  type CommonProps = WithTestID<{
12
12
  title: string;
13
+ // This Prop will be removed once all the screens on the first level routing will be refactored
14
+ backgroundColor?: "light" | "dark";
13
15
  }>;
14
16
 
15
17
  interface Base extends CommonProps {
@@ -42,7 +44,8 @@ interface ThreeActions extends CommonProps {
42
44
 
43
45
  export type HeaderFirstLevel = Base | OneAction | TwoActions | ThreeActions;
44
46
 
45
- const HEADER_BG_COLOR: IOColors = "white";
47
+ const HEADER_BG_COLOR_LIGHT: IOColors = "white";
48
+ const HEADER_BG_COLOR_DARK: IOColors = "bluegrey";
46
49
 
47
50
  const styles = StyleSheet.create({
48
51
  headerInner: {
@@ -59,6 +62,7 @@ export const HeaderFirstLevel = ({
59
62
  title,
60
63
  type,
61
64
  testID,
65
+ backgroundColor = "light",
62
66
  firstAction,
63
67
  secondAction,
64
68
  thirdAction
@@ -69,33 +73,50 @@ export const HeaderFirstLevel = ({
69
73
  <View
70
74
  style={{
71
75
  paddingTop: insets.top,
72
- backgroundColor: IOColors[HEADER_BG_COLOR]
76
+ backgroundColor:
77
+ backgroundColor === "light"
78
+ ? IOColors[HEADER_BG_COLOR_LIGHT]
79
+ : IOColors[HEADER_BG_COLOR_DARK]
73
80
  }}
74
81
  accessibilityRole="header"
75
82
  testID={testID}
76
83
  >
77
84
  <View style={styles.headerInner}>
78
- <H3 style={{ flexShrink: 1 }} numberOfLines={1}>
85
+ <H3
86
+ style={{ flexShrink: 1 }}
87
+ numberOfLines={1}
88
+ color={backgroundColor === "dark" ? "white" : undefined}
89
+ >
79
90
  {title}
80
91
  </H3>
81
92
  <View style={[IOStyles.row, { flexShrink: 0 }]}>
82
- {type !== "base" && <IconButton {...firstAction} color="neutral" />}
83
- {(type === "twoActions" || type === "threeActions") && (
93
+ {type === "threeActions" && (
84
94
  <>
95
+ <IconButton
96
+ {...thirdAction}
97
+ color={backgroundColor === "dark" ? "contrast" : "neutral"}
98
+ />
85
99
  {/* Ideally, with the "gap" flex property,
86
100
  we can get rid of these ugly constructs */}
87
- +.9+
88
101
  <HSpacer size={16} />
89
- <IconButton {...secondAction} color="neutral" />
90
102
  </>
91
103
  )}
92
- {type === "threeActions" && (
104
+ {(type === "twoActions" || type === "threeActions") && (
93
105
  <>
106
+ <IconButton
107
+ {...secondAction}
108
+ color={backgroundColor === "dark" ? "contrast" : "neutral"}
109
+ />
94
110
  {/* Same as above */}
95
111
  <HSpacer size={16} />
96
- <IconButton {...thirdAction} color="neutral" />
97
112
  </>
98
113
  )}
114
+ {type !== "base" && (
115
+ <IconButton
116
+ {...firstAction}
117
+ color={backgroundColor === "dark" ? "contrast" : "neutral"}
118
+ />
119
+ )}
99
120
  </View>
100
121
  </View>
101
122
  </View>
@@ -179,25 +179,25 @@ export const HeaderSecondLevel = ({
179
179
  {title}
180
180
  </Animated.Text>
181
181
  <View style={[IOStyles.row, { flexShrink: 0 }]}>
182
- {type !== "base" ? (
183
- <IconButton {...firstAction} color="neutral" />
184
- ) : (
185
- <HSpacer size={iconBtnSizeSmall as IOSpacer} />
182
+ {type === "threeActions" && (
183
+ <>
184
+ <IconButton {...thirdAction} color="neutral" />
185
+ {/* Same as above */}
186
+ <HSpacer size={16} />
187
+ </>
186
188
  )}
187
189
  {(type === "twoActions" || type === "threeActions") && (
188
190
  <>
191
+ <IconButton {...secondAction} color="neutral" />
189
192
  {/* Ideally, with the "gap" flex property,
190
193
  we can get rid of these ugly constructs */}
191
194
  <HSpacer size={16} />
192
- <IconButton {...secondAction} color="neutral" />
193
195
  </>
194
196
  )}
195
- {type === "threeActions" && (
196
- <>
197
- {/* Same as above */}
198
- <HSpacer size={16} />
199
- <IconButton {...thirdAction} color="neutral" />
200
- </>
197
+ {type !== "base" ? (
198
+ <IconButton {...firstAction} color="neutral" />
199
+ ) : (
200
+ <HSpacer size={iconBtnSizeSmall as IOSpacer} />
201
201
  )}
202
202
  </View>
203
203
  </Animated.View>