@pagopa/io-app-design-system 5.6.1 → 5.6.3
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/lib/commonjs/components/buttons/IOButton/IOButton.js +3 -1
- package/lib/commonjs/components/buttons/IOButton/IOButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +9 -0
- package/lib/commonjs/components/icons/Icon.js +6 -2
- package/lib/commonjs/components/icons/Icon.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconDocumentAdd.js +45 -0
- package/lib/commonjs/components/icons/svg/IconDocumentAdd.js.map +1 -0
- package/lib/commonjs/components/icons/svg/originals/IconDocumentAdd.svg +7 -0
- package/lib/commonjs/components/layout/HeaderFirstLevel.js +6 -4
- package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/commonjs/core/IOColors.js +2 -1
- package/lib/commonjs/core/IOColors.js.map +1 -1
- package/lib/module/components/buttons/IOButton/IOButton.js +3 -1
- package/lib/module/components/buttons/IOButton/IOButton.js.map +1 -1
- package/lib/module/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +9 -0
- package/lib/module/components/icons/Icon.js +6 -2
- package/lib/module/components/icons/Icon.js.map +1 -1
- package/lib/module/components/icons/svg/IconDocumentAdd.js +40 -0
- package/lib/module/components/icons/svg/IconDocumentAdd.js.map +1 -0
- package/lib/module/components/icons/svg/originals/IconDocumentAdd.svg +7 -0
- package/lib/module/components/layout/HeaderFirstLevel.js +6 -4
- package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/module/core/IOColors.js +2 -1
- package/lib/module/core/IOColors.js.map +1 -1
- package/lib/typescript/components/buttons/IOButton/IOButton.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/IconDocumentAdd.d.ts +5 -0
- package/lib/typescript/components/icons/svg/IconDocumentAdd.d.ts.map +1 -0
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts +3 -1
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
- package/lib/typescript/core/IOColors.d.ts +1 -1
- package/lib/typescript/core/IOColors.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/buttons/IOButton/IOButton.tsx +2 -1
- package/src/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +9 -0
- package/src/components/icons/Icon.tsx +5 -2
- package/src/components/icons/svg/IconDocumentAdd.tsx +36 -0
- package/src/components/icons/svg/originals/IconDocumentAdd.svg +7 -0
- package/src/components/layout/HeaderFirstLevel.tsx +17 -4
- package/src/core/IOColors.ts +2 -0
|
@@ -32,12 +32,15 @@ type HeaderActionsProp =
|
|
|
32
32
|
| readonly [HeaderActionProps, HeaderActionProps] // Two actions
|
|
33
33
|
| readonly [HeaderActionProps, HeaderActionProps, HeaderActionProps]; // Three actions
|
|
34
34
|
|
|
35
|
+
type Variant = "primary" | "contrast";
|
|
36
|
+
|
|
35
37
|
export type HeaderFirstLevel = WithTestID<{
|
|
36
38
|
title: string;
|
|
37
39
|
actions: HeaderActionsProp;
|
|
38
40
|
animatedRef?: AnimatedRef<Animated.ScrollView>;
|
|
39
41
|
animatedFlatListRef?: AnimatedRef<Animated.FlatList<any>>;
|
|
40
42
|
ignoreSafeAreaMargin?: boolean;
|
|
43
|
+
variant?: Variant;
|
|
41
44
|
}>;
|
|
42
45
|
|
|
43
46
|
const styles = StyleSheet.create({
|
|
@@ -65,12 +68,14 @@ export const HeaderFirstLevel = ({
|
|
|
65
68
|
actions = [],
|
|
66
69
|
ignoreSafeAreaMargin = false,
|
|
67
70
|
animatedRef,
|
|
71
|
+
variant = "primary",
|
|
68
72
|
animatedFlatListRef
|
|
69
73
|
}: HeaderFirstLevel) => {
|
|
70
74
|
const titleRef = createRef<View>();
|
|
71
75
|
const insets = useSafeAreaInsets();
|
|
72
76
|
const theme = useIOTheme();
|
|
73
77
|
const paddingTop = useSharedValue(ignoreSafeAreaMargin ? 0 : insets.top);
|
|
78
|
+
const isPrimary = variant === "primary";
|
|
74
79
|
|
|
75
80
|
useLayoutEffect(() => {
|
|
76
81
|
const reactNode = findNodeHandle(titleRef.current);
|
|
@@ -105,14 +110,18 @@ export const HeaderFirstLevel = ({
|
|
|
105
110
|
return (
|
|
106
111
|
<Animated.View
|
|
107
112
|
style={[
|
|
108
|
-
{
|
|
113
|
+
{
|
|
114
|
+
backgroundColor: isPrimary
|
|
115
|
+
? IOColors[theme["appBackground-primary"]]
|
|
116
|
+
: IOColors[theme["appBackground-accent"]]
|
|
117
|
+
},
|
|
109
118
|
animatedStyle
|
|
110
119
|
]}
|
|
111
120
|
accessibilityRole="header"
|
|
112
121
|
testID={testID}
|
|
113
122
|
>
|
|
114
123
|
{/* Divider */}
|
|
115
|
-
{(animatedRef || animatedFlatListRef) && (
|
|
124
|
+
{(animatedRef || animatedFlatListRef) && isPrimary && (
|
|
116
125
|
<Animated.View
|
|
117
126
|
style={[
|
|
118
127
|
{
|
|
@@ -130,7 +139,11 @@ export const HeaderFirstLevel = ({
|
|
|
130
139
|
weight="Bold"
|
|
131
140
|
style={{ flexShrink: 1 }}
|
|
132
141
|
numberOfLines={1}
|
|
133
|
-
color={
|
|
142
|
+
color={
|
|
143
|
+
isPrimary
|
|
144
|
+
? theme["textHeading-default"]
|
|
145
|
+
: theme["textHeading-constrast"]
|
|
146
|
+
}
|
|
134
147
|
maxFontSizeMultiplier={1.25}
|
|
135
148
|
>
|
|
136
149
|
{title}
|
|
@@ -141,7 +154,7 @@ export const HeaderFirstLevel = ({
|
|
|
141
154
|
<IconButton
|
|
142
155
|
key={`header-first-level-action-${index}`}
|
|
143
156
|
{...action}
|
|
144
|
-
color={
|
|
157
|
+
color={variant}
|
|
145
158
|
/>
|
|
146
159
|
))}
|
|
147
160
|
</HStack>
|
package/src/core/IOColors.ts
CHANGED
|
@@ -221,6 +221,7 @@ const themeKeys = [
|
|
|
221
221
|
"textHeading-default",
|
|
222
222
|
"textHeading-secondary",
|
|
223
223
|
"textHeading-tertiary",
|
|
224
|
+
"textHeading-constrast",
|
|
224
225
|
"textBody-default",
|
|
225
226
|
"textBody-secondary",
|
|
226
227
|
"textBody-tertiary",
|
|
@@ -294,6 +295,7 @@ export const IOThemeLight: IOTheme = {
|
|
|
294
295
|
"textHeading-default": "black",
|
|
295
296
|
"textHeading-secondary": "grey-850",
|
|
296
297
|
"textHeading-tertiary": "grey-700",
|
|
298
|
+
"textHeading-constrast": "white",
|
|
297
299
|
"textBody-default": "black",
|
|
298
300
|
"textBody-secondary": "grey-850",
|
|
299
301
|
"textBody-tertiary": "grey-700",
|