@pagopa/io-app-design-system 4.0.1 → 4.1.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.
Files changed (40) hide show
  1. package/lib/commonjs/components/alert/Alert.js +34 -7
  2. package/lib/commonjs/components/alert/Alert.js.map +1 -1
  3. package/lib/commonjs/components/banner/Banner.js +35 -20
  4. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  5. package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +36 -190
  6. package/lib/commonjs/components/featureInfo/FeatureInfo.js +27 -26
  7. package/lib/commonjs/components/featureInfo/FeatureInfo.js.map +1 -1
  8. package/lib/commonjs/components/spacer/Spacer.js +1 -1
  9. package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
  10. package/lib/commonjs/components/stack/Stack.js +17 -14
  11. package/lib/commonjs/components/stack/Stack.js.map +1 -1
  12. package/lib/commonjs/core/IOColors.js.map +1 -1
  13. package/lib/module/components/alert/Alert.js +36 -9
  14. package/lib/module/components/alert/Alert.js.map +1 -1
  15. package/lib/module/components/banner/Banner.js +40 -25
  16. package/lib/module/components/banner/Banner.js.map +1 -1
  17. package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +36 -190
  18. package/lib/module/components/featureInfo/FeatureInfo.js +29 -28
  19. package/lib/module/components/featureInfo/FeatureInfo.js.map +1 -1
  20. package/lib/module/components/spacer/Spacer.js +1 -1
  21. package/lib/module/components/spacer/Spacer.js.map +1 -1
  22. package/lib/module/components/stack/Stack.js +17 -14
  23. package/lib/module/components/stack/Stack.js.map +1 -1
  24. package/lib/module/core/IOColors.js.map +1 -1
  25. package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
  26. package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
  27. package/lib/typescript/components/featureInfo/FeatureInfo.d.ts.map +1 -1
  28. package/lib/typescript/components/spacer/Spacer.d.ts +0 -1
  29. package/lib/typescript/components/spacer/Spacer.d.ts.map +1 -1
  30. package/lib/typescript/components/stack/Stack.d.ts +9 -6
  31. package/lib/typescript/components/stack/Stack.d.ts.map +1 -1
  32. package/lib/typescript/core/IOColors.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/components/alert/Alert.tsx +46 -15
  35. package/src/components/banner/Banner.tsx +55 -27
  36. package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +36 -190
  37. package/src/components/featureInfo/FeatureInfo.tsx +26 -28
  38. package/src/components/spacer/Spacer.tsx +2 -4
  39. package/src/components/stack/Stack.tsx +24 -16
  40. package/src/core/IOColors.ts +1 -0
@@ -1,27 +1,36 @@
1
- import React, { ReactNode } from "react";
1
+ import React, { PropsWithChildren } from "react";
2
2
  import { View, ViewStyle } from "react-native";
3
3
  import { IOSpacer } from "../../core";
4
4
 
5
5
  type AllowedStyleProps = Pick<
6
6
  ViewStyle,
7
- "alignItems" | "flexShrink" | "flexGrow" | "flex" | "flexWrap"
7
+ "alignItems" | "flexShrink" | "flexGrow" | "flex" | "flexWrap" | "width"
8
8
  >;
9
9
 
10
- type Stack = {
10
+ type Stack = PropsWithChildren<{
11
11
  space?: IOSpacer;
12
- children: ReactNode;
13
12
  style?: AllowedStyleProps;
13
+ }>;
14
+
15
+ type BaseStack = Stack & {
16
+ orientation: "vertical" | "horizontal";
14
17
  };
15
18
 
16
19
  /**
17
20
  Horizontal Stack component
18
21
  @param {IOSpacer} space
19
22
  */
20
- export const HStack = ({ space, children, style }: Stack) => (
23
+
24
+ const Stack = ({
25
+ space,
26
+ style,
27
+ orientation = "vertical",
28
+ children
29
+ }: BaseStack) => (
21
30
  <View
22
31
  style={{
23
32
  display: "flex",
24
- flexDirection: "row",
33
+ flexDirection: orientation === "horizontal" ? "row" : "column",
25
34
  gap: space,
26
35
  ...style
27
36
  }}
@@ -30,20 +39,19 @@ export const HStack = ({ space, children, style }: Stack) => (
30
39
  </View>
31
40
  );
32
41
 
42
+ export const HStack = ({ children, ...props }: Stack) => (
43
+ <Stack orientation="horizontal" {...props}>
44
+ {children}
45
+ </Stack>
46
+ );
47
+
33
48
  /**
34
49
  Vertical Stack component
35
50
  @param {IOSpacer} space
36
51
  */
37
52
 
38
- export const VStack = ({ space, children, style }: Stack) => (
39
- <View
40
- style={{
41
- display: "flex",
42
- flexDirection: "column",
43
- gap: space,
44
- ...style
45
- }}
46
- >
53
+ export const VStack = ({ children, ...props }: Stack) => (
54
+ <Stack orientation="vertical" {...props}>
47
55
  {children}
48
- </View>
56
+ </Stack>
49
57
  );
@@ -233,6 +233,7 @@ export const IOColorsStatus = asIOColors({
233
233
  });
234
234
 
235
235
  export type IOColorsStatus = keyof typeof IOColorsStatus;
236
+
236
237
  export type IOColorsStatusForeground = Extract<
237
238
  IOColorsStatus,
238
239
  "error-850" | "warning-850" | "info-850" | "success-850"