@pagopa/io-app-design-system 4.0.0 → 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.
- package/lib/commonjs/components/alert/Alert.js +34 -7
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/badge/Badge.js +95 -14
- package/lib/commonjs/components/badge/Badge.js.map +1 -1
- package/lib/commonjs/components/banner/Banner.js +35 -20
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +36 -190
- package/lib/commonjs/components/featureInfo/FeatureInfo.js +27 -26
- package/lib/commonjs/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +1 -1
- package/lib/commonjs/components/spacer/Spacer.js +1 -1
- package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
- package/lib/commonjs/components/stack/Stack.js +18 -15
- package/lib/commonjs/components/stack/Stack.js.map +1 -1
- package/lib/commonjs/components/tag/Tag.js +40 -26
- package/lib/commonjs/components/tag/Tag.js.map +1 -1
- package/lib/commonjs/components/typography/IOText.js.map +1 -1
- package/lib/commonjs/core/IOColors.js +9 -1
- package/lib/commonjs/core/IOColors.js.map +1 -1
- package/lib/commonjs/utils/fonts.js.map +1 -1
- package/lib/module/components/alert/Alert.js +36 -9
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/badge/Badge.js +96 -15
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/banner/Banner.js +40 -25
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +36 -190
- package/lib/module/components/featureInfo/FeatureInfo.js +29 -28
- package/lib/module/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +1 -1
- package/lib/module/components/spacer/Spacer.js +1 -1
- package/lib/module/components/spacer/Spacer.js.map +1 -1
- package/lib/module/components/stack/Stack.js +18 -15
- package/lib/module/components/stack/Stack.js.map +1 -1
- package/lib/module/components/tag/Tag.js +41 -27
- package/lib/module/components/tag/Tag.js.map +1 -1
- package/lib/module/components/typography/IOText.js.map +1 -1
- package/lib/module/core/IOColors.js +9 -1
- package/lib/module/core/IOColors.js.map +1 -1
- package/lib/module/utils/fonts.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/featureInfo/FeatureInfo.d.ts.map +1 -1
- package/lib/typescript/components/spacer/Spacer.d.ts +0 -1
- package/lib/typescript/components/spacer/Spacer.d.ts.map +1 -1
- package/lib/typescript/components/stack/Stack.d.ts +9 -6
- package/lib/typescript/components/stack/Stack.d.ts.map +1 -1
- package/lib/typescript/components/tag/Tag.d.ts +13 -8
- package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodyMonospace.d.ts +1 -1
- package/lib/typescript/components/typography/ButtonText.d.ts +1 -1
- package/lib/typescript/components/typography/Caption.d.ts +1 -1
- package/lib/typescript/components/typography/H1.d.ts +1 -1
- package/lib/typescript/components/typography/H2.d.ts +1 -1
- package/lib/typescript/components/typography/H3.d.ts +1 -1
- package/lib/typescript/components/typography/H4.d.ts +1 -1
- package/lib/typescript/components/typography/H5.d.ts +1 -1
- package/lib/typescript/components/typography/H6.d.ts +1 -1
- package/lib/typescript/components/typography/Hero.d.ts +1 -1
- package/lib/typescript/components/typography/IOText.d.ts +2 -2
- package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH1.d.ts +1 -1
- package/lib/typescript/components/typography/markdown/MdH2.d.ts +1 -1
- package/lib/typescript/components/typography/markdown/MdH3.d.ts +1 -1
- package/lib/typescript/core/IOColors.d.ts +2 -1
- package/lib/typescript/core/IOColors.d.ts.map +1 -1
- package/lib/typescript/utils/fonts.d.ts +3 -3
- package/lib/typescript/utils/fonts.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/alert/Alert.tsx +46 -15
- package/src/components/badge/Badge.tsx +109 -19
- package/src/components/banner/Banner.tsx +55 -27
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +36 -190
- package/src/components/featureInfo/FeatureInfo.tsx +26 -28
- package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +1 -1
- package/src/components/spacer/Spacer.tsx +2 -4
- package/src/components/stack/Stack.tsx +25 -17
- package/src/components/tag/Tag.tsx +66 -33
- package/src/components/typography/IOText.tsx +1 -2
- package/src/core/IOColors.ts +12 -0
- package/src/utils/fonts.ts +2 -2
|
@@ -111,104 +111,27 @@ exports[`Test Banner Components - Experimental Enabled Banner Snapshot 1`] = `
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
/>
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"busy": undefined,
|
|
120
|
-
"checked": undefined,
|
|
121
|
-
"disabled": false,
|
|
122
|
-
"expanded": undefined,
|
|
123
|
-
"selected": undefined,
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
accessibilityValue={
|
|
127
|
-
{
|
|
128
|
-
"max": undefined,
|
|
129
|
-
"min": undefined,
|
|
130
|
-
"now": undefined,
|
|
131
|
-
"text": undefined,
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
accessible={true}
|
|
135
|
-
collapsable={false}
|
|
136
|
-
focusable={true}
|
|
137
|
-
hitSlop={
|
|
138
|
-
{
|
|
139
|
-
"bottom": 14,
|
|
140
|
-
"left": 24,
|
|
141
|
-
"right": 24,
|
|
142
|
-
"top": 14,
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
onBlur={[Function]}
|
|
146
|
-
onClick={[Function]}
|
|
147
|
-
onFocus={[Function]}
|
|
148
|
-
onResponderGrant={[Function]}
|
|
149
|
-
onResponderMove={[Function]}
|
|
150
|
-
onResponderRelease={[Function]}
|
|
151
|
-
onResponderTerminate={[Function]}
|
|
152
|
-
onResponderTerminationRequest={[Function]}
|
|
153
|
-
onStartShouldSetResponder={[Function]}
|
|
154
|
-
onTouchEnd={[Function]}
|
|
114
|
+
<Text
|
|
115
|
+
allowFontScaling={true}
|
|
116
|
+
ellipsizeMode="tail"
|
|
117
|
+
maxFontSizeMultiplier={1.25}
|
|
118
|
+
numberOfLines={1}
|
|
155
119
|
style={
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
120
|
+
[
|
|
121
|
+
{},
|
|
122
|
+
{
|
|
123
|
+
"color": "#0B3EE3",
|
|
124
|
+
"fontFamily": "Titillio",
|
|
125
|
+
"fontSize": 16,
|
|
126
|
+
"fontStyle": "normal",
|
|
127
|
+
"fontWeight": "400",
|
|
128
|
+
"lineHeight": undefined,
|
|
129
|
+
},
|
|
130
|
+
]
|
|
159
131
|
}
|
|
160
132
|
>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
[
|
|
164
|
-
{
|
|
165
|
-
"alignItems": "center",
|
|
166
|
-
"elevation": 0,
|
|
167
|
-
"flexDirection": "row",
|
|
168
|
-
"justifyContent": "center",
|
|
169
|
-
"textAlignVertical": "center",
|
|
170
|
-
},
|
|
171
|
-
false,
|
|
172
|
-
{},
|
|
173
|
-
{
|
|
174
|
-
"transform": [
|
|
175
|
-
{
|
|
176
|
-
"scale": undefined,
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
},
|
|
180
|
-
]
|
|
181
|
-
}
|
|
182
|
-
>
|
|
183
|
-
<Text
|
|
184
|
-
accessibilityElementsHidden={true}
|
|
185
|
-
accessible={false}
|
|
186
|
-
allowFontScaling={true}
|
|
187
|
-
ellipsizeMode="tail"
|
|
188
|
-
importantForAccessibility="no-hide-descendants"
|
|
189
|
-
maxFontSizeMultiplier={1.25}
|
|
190
|
-
numberOfLines={1}
|
|
191
|
-
style={
|
|
192
|
-
[
|
|
193
|
-
{},
|
|
194
|
-
{
|
|
195
|
-
"color": "#0E0F13",
|
|
196
|
-
"fontFamily": "Titillio",
|
|
197
|
-
"fontSize": 16,
|
|
198
|
-
"fontStyle": "normal",
|
|
199
|
-
"fontWeight": "600",
|
|
200
|
-
"lineHeight": undefined,
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"color": undefined,
|
|
204
|
-
},
|
|
205
|
-
]
|
|
206
|
-
}
|
|
207
|
-
>
|
|
208
|
-
Action text
|
|
209
|
-
</Text>
|
|
210
|
-
</View>
|
|
211
|
-
</View>
|
|
133
|
+
Action text
|
|
134
|
+
</Text>
|
|
212
135
|
</View>
|
|
213
136
|
</View>
|
|
214
137
|
<View
|
|
@@ -461,104 +384,27 @@ exports[`Test Banner Components Banner Snapshot 1`] = `
|
|
|
461
384
|
}
|
|
462
385
|
}
|
|
463
386
|
/>
|
|
464
|
-
<
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
"busy": undefined,
|
|
470
|
-
"checked": undefined,
|
|
471
|
-
"disabled": false,
|
|
472
|
-
"expanded": undefined,
|
|
473
|
-
"selected": undefined,
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
accessibilityValue={
|
|
477
|
-
{
|
|
478
|
-
"max": undefined,
|
|
479
|
-
"min": undefined,
|
|
480
|
-
"now": undefined,
|
|
481
|
-
"text": undefined,
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
accessible={true}
|
|
485
|
-
collapsable={false}
|
|
486
|
-
focusable={true}
|
|
487
|
-
hitSlop={
|
|
488
|
-
{
|
|
489
|
-
"bottom": 14,
|
|
490
|
-
"left": 24,
|
|
491
|
-
"right": 24,
|
|
492
|
-
"top": 14,
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
onBlur={[Function]}
|
|
496
|
-
onClick={[Function]}
|
|
497
|
-
onFocus={[Function]}
|
|
498
|
-
onResponderGrant={[Function]}
|
|
499
|
-
onResponderMove={[Function]}
|
|
500
|
-
onResponderRelease={[Function]}
|
|
501
|
-
onResponderTerminate={[Function]}
|
|
502
|
-
onResponderTerminationRequest={[Function]}
|
|
503
|
-
onStartShouldSetResponder={[Function]}
|
|
504
|
-
onTouchEnd={[Function]}
|
|
387
|
+
<Text
|
|
388
|
+
allowFontScaling={false}
|
|
389
|
+
ellipsizeMode="tail"
|
|
390
|
+
maxFontSizeMultiplier={1.25}
|
|
391
|
+
numberOfLines={1}
|
|
505
392
|
style={
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
393
|
+
[
|
|
394
|
+
{},
|
|
395
|
+
{
|
|
396
|
+
"color": "#0B3EE3",
|
|
397
|
+
"fontFamily": "Titillium Sans Pro",
|
|
398
|
+
"fontSize": 16,
|
|
399
|
+
"fontStyle": "normal",
|
|
400
|
+
"fontWeight": "700",
|
|
401
|
+
"lineHeight": undefined,
|
|
402
|
+
},
|
|
403
|
+
]
|
|
509
404
|
}
|
|
510
405
|
>
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
[
|
|
514
|
-
{
|
|
515
|
-
"alignItems": "center",
|
|
516
|
-
"elevation": 0,
|
|
517
|
-
"flexDirection": "row",
|
|
518
|
-
"justifyContent": "center",
|
|
519
|
-
"textAlignVertical": "center",
|
|
520
|
-
},
|
|
521
|
-
false,
|
|
522
|
-
{},
|
|
523
|
-
{
|
|
524
|
-
"transform": [
|
|
525
|
-
{
|
|
526
|
-
"scale": undefined,
|
|
527
|
-
},
|
|
528
|
-
],
|
|
529
|
-
},
|
|
530
|
-
]
|
|
531
|
-
}
|
|
532
|
-
>
|
|
533
|
-
<Text
|
|
534
|
-
accessibilityElementsHidden={true}
|
|
535
|
-
accessible={false}
|
|
536
|
-
allowFontScaling={false}
|
|
537
|
-
ellipsizeMode="tail"
|
|
538
|
-
importantForAccessibility="no-hide-descendants"
|
|
539
|
-
maxFontSizeMultiplier={1.25}
|
|
540
|
-
numberOfLines={1}
|
|
541
|
-
style={
|
|
542
|
-
[
|
|
543
|
-
{},
|
|
544
|
-
{
|
|
545
|
-
"color": "#0E0F13",
|
|
546
|
-
"fontFamily": "Titillium Sans Pro",
|
|
547
|
-
"fontSize": 16,
|
|
548
|
-
"fontStyle": "normal",
|
|
549
|
-
"fontWeight": "600",
|
|
550
|
-
"lineHeight": undefined,
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
"color": undefined,
|
|
554
|
-
},
|
|
555
|
-
]
|
|
556
|
-
}
|
|
557
|
-
>
|
|
558
|
-
Action text
|
|
559
|
-
</Text>
|
|
560
|
-
</View>
|
|
561
|
-
</View>
|
|
406
|
+
Action text
|
|
407
|
+
</Text>
|
|
562
408
|
</View>
|
|
563
409
|
</View>
|
|
564
410
|
<View
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
IOPictograms,
|
|
10
10
|
Icon,
|
|
11
11
|
Pictogram,
|
|
12
|
-
|
|
12
|
+
VStack
|
|
13
13
|
} from "../../components";
|
|
14
|
-
import { IOStyles } from "../../core";
|
|
14
|
+
import { IOStyles, useIOTheme } from "../../core";
|
|
15
15
|
|
|
16
16
|
type PartialFeatureInfo = {
|
|
17
17
|
// Necessary to render main body with different formatting
|
|
@@ -42,11 +42,7 @@ const DEFAULT_PICTOGRAM_SIZE: IOPictogramSizeScale = 48;
|
|
|
42
42
|
|
|
43
43
|
const renderNode = (body: FeatureInfoProps["body"]) => {
|
|
44
44
|
if (typeof body === "string") {
|
|
45
|
-
return
|
|
46
|
-
<BodySmall color="grey-700" testID="infoScreenBody">
|
|
47
|
-
{body}
|
|
48
|
-
</BodySmall>
|
|
49
|
-
);
|
|
45
|
+
return <BodySmall testID="infoScreenBody">{body}</BodySmall>;
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
return body;
|
|
@@ -57,23 +53,25 @@ export const FeatureInfo = ({
|
|
|
57
53
|
pictogramName,
|
|
58
54
|
body,
|
|
59
55
|
action
|
|
60
|
-
}: FeatureInfoProps) =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
56
|
+
}: FeatureInfoProps) => {
|
|
57
|
+
const theme = useIOTheme();
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<View style={[IOStyles.flex, IOStyles.row, IOStyles.alignCenter]}>
|
|
61
|
+
{iconName && (
|
|
62
|
+
<Icon
|
|
63
|
+
name={iconName}
|
|
64
|
+
size={DEFAULT_ICON_SIZE}
|
|
65
|
+
color={theme["icon-decorative"]}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
{pictogramName && (
|
|
69
|
+
<Pictogram name={pictogramName} size={DEFAULT_PICTOGRAM_SIZE} />
|
|
70
|
+
)}
|
|
71
|
+
<HSpacer size={24} />
|
|
72
|
+
<VStack space={4} style={{ flexShrink: 1 }}>
|
|
73
|
+
{renderNode(body)}
|
|
74
|
+
{action && (
|
|
77
75
|
<BodySmall
|
|
78
76
|
weight="Semibold"
|
|
79
77
|
asLink
|
|
@@ -84,8 +82,8 @@ export const FeatureInfo = ({
|
|
|
84
82
|
>
|
|
85
83
|
{action.label}
|
|
86
84
|
</BodySmall>
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
)}
|
|
86
|
+
</VStack>
|
|
89
87
|
</View>
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
);
|
|
89
|
+
};
|
|
@@ -2,10 +2,8 @@ import React from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { hexToRgba, IOColors, IOSpacer } from "../../core";
|
|
4
4
|
|
|
5
|
-
export type SpacerOrientation = "vertical" | "horizontal";
|
|
6
|
-
|
|
7
5
|
type BaseSpacerProps = {
|
|
8
|
-
orientation:
|
|
6
|
+
orientation: "vertical" | "horizontal";
|
|
9
7
|
size: IOSpacer;
|
|
10
8
|
};
|
|
11
9
|
|
|
@@ -21,7 +19,7 @@ const debugBg = hexToRgba(IOColors.red, 0.2);
|
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
21
|
Native `Spacer` component
|
|
24
|
-
@param {
|
|
22
|
+
@param {string} orientation
|
|
25
23
|
@param {IOSpacer} size
|
|
26
24
|
*/
|
|
27
25
|
const Spacer = ({ orientation, size }: BaseSpacerProps) => {
|
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
import 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
|
-
|
|
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",
|
|
25
|
-
|
|
33
|
+
flexDirection: orientation === "horizontal" ? "row" : "column",
|
|
34
|
+
gap: space,
|
|
26
35
|
...style
|
|
27
36
|
}}
|
|
28
37
|
>
|
|
@@ -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 = ({
|
|
39
|
-
<
|
|
40
|
-
style={{
|
|
41
|
-
display: "flex",
|
|
42
|
-
flexDirection: "column",
|
|
43
|
-
rowGap: space,
|
|
44
|
-
...style
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
53
|
+
export const VStack = ({ children, ...props }: Stack) => (
|
|
54
|
+
<Stack orientation="vertical" {...props}>
|
|
47
55
|
{children}
|
|
48
|
-
</
|
|
56
|
+
</Stack>
|
|
49
57
|
);
|
|
@@ -3,6 +3,8 @@ import { Platform, StyleSheet, View } from "react-native";
|
|
|
3
3
|
import {
|
|
4
4
|
IOColors,
|
|
5
5
|
IOTagRadius,
|
|
6
|
+
IOTheme,
|
|
7
|
+
IOThemeLight,
|
|
6
8
|
useIOExperimentalDesign,
|
|
7
9
|
useIOTheme
|
|
8
10
|
} from "../../core";
|
|
@@ -15,9 +17,21 @@ import { WithTestID } from "../../utils/types";
|
|
|
15
17
|
import { IOIconSizeScale, IOIcons, Icon } from "../icons";
|
|
16
18
|
import { IOText } from "../typography";
|
|
17
19
|
|
|
20
|
+
const IconColorsMap: Record<string, keyof IOTheme> = {
|
|
21
|
+
primary: "interactiveElem-default",
|
|
22
|
+
warning: "warningIcon",
|
|
23
|
+
error: "errorIcon",
|
|
24
|
+
success: "successIcon",
|
|
25
|
+
info: "infoIcon",
|
|
26
|
+
grey: "icon-default",
|
|
27
|
+
lightGrey: "icon-decorative"
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type IconColorVariant = keyof typeof IconColorsMap;
|
|
31
|
+
|
|
18
32
|
type VariantProps = {
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
color: IconColorVariant;
|
|
34
|
+
name: IOIcons;
|
|
21
35
|
};
|
|
22
36
|
|
|
23
37
|
type TextProps =
|
|
@@ -30,8 +44,7 @@ type TextProps =
|
|
|
30
44
|
iconAccessibilityLabel: string;
|
|
31
45
|
};
|
|
32
46
|
|
|
33
|
-
export type Tag = TextProps &
|
|
34
|
-
WithTestID<
|
|
47
|
+
export type Tag = TextProps & { forceLightMode?: boolean } & WithTestID<
|
|
35
48
|
| {
|
|
36
49
|
variant:
|
|
37
50
|
| "qrCode"
|
|
@@ -42,11 +55,12 @@ export type Tag = TextProps &
|
|
|
42
55
|
| "success"
|
|
43
56
|
| "attachment"
|
|
44
57
|
| "noIcon";
|
|
45
|
-
|
|
58
|
+
iconName?: never;
|
|
59
|
+
icon?: never;
|
|
46
60
|
}
|
|
47
61
|
| {
|
|
48
|
-
variant: "
|
|
49
|
-
|
|
62
|
+
variant: "custom";
|
|
63
|
+
icon: VariantProps;
|
|
50
64
|
}
|
|
51
65
|
>;
|
|
52
66
|
|
|
@@ -64,9 +78,7 @@ const styles = StyleSheet.create({
|
|
|
64
78
|
textAlignVertical: "center"
|
|
65
79
|
}
|
|
66
80
|
}),
|
|
67
|
-
backgroundColor: IOColors.white,
|
|
68
81
|
borderWidth: 1,
|
|
69
|
-
borderColor: IOColors["grey-100"],
|
|
70
82
|
borderRadius: IOTagRadius,
|
|
71
83
|
borderCurve: "continuous",
|
|
72
84
|
paddingHorizontal: IOTagHSpacing,
|
|
@@ -82,45 +94,46 @@ const styles = StyleSheet.create({
|
|
|
82
94
|
|
|
83
95
|
const getVariantProps = (
|
|
84
96
|
variant: NonNullable<Tag["variant"]>,
|
|
85
|
-
|
|
97
|
+
customIcon?: VariantProps
|
|
86
98
|
): VariantProps | undefined => {
|
|
99
|
+
if (variant === "custom" && customIcon) {
|
|
100
|
+
return customIcon;
|
|
101
|
+
}
|
|
87
102
|
switch (variant) {
|
|
88
|
-
case "customIcon":
|
|
89
|
-
return customIconProps;
|
|
90
103
|
case "qrCode":
|
|
91
104
|
return {
|
|
92
|
-
|
|
93
|
-
|
|
105
|
+
color: "primary",
|
|
106
|
+
name: "qrCode"
|
|
94
107
|
};
|
|
95
108
|
case "attachment":
|
|
96
109
|
return {
|
|
97
|
-
|
|
98
|
-
|
|
110
|
+
color: "grey",
|
|
111
|
+
name: "attachment"
|
|
99
112
|
};
|
|
100
113
|
case "legalMessage":
|
|
101
114
|
return {
|
|
102
|
-
|
|
103
|
-
|
|
115
|
+
color: "primary",
|
|
116
|
+
name: "legalValue"
|
|
104
117
|
};
|
|
105
118
|
case "info":
|
|
106
119
|
return {
|
|
107
|
-
|
|
108
|
-
|
|
120
|
+
color: "info",
|
|
121
|
+
name: "infoFilled"
|
|
109
122
|
};
|
|
110
123
|
case "warning":
|
|
111
124
|
return {
|
|
112
|
-
|
|
113
|
-
|
|
125
|
+
color: "warning",
|
|
126
|
+
name: "warningFilled"
|
|
114
127
|
};
|
|
115
128
|
case "error":
|
|
116
129
|
return {
|
|
117
|
-
|
|
118
|
-
|
|
130
|
+
color: "error",
|
|
131
|
+
name: "errorFilled"
|
|
119
132
|
};
|
|
120
133
|
case "success":
|
|
121
134
|
return {
|
|
122
|
-
|
|
123
|
-
|
|
135
|
+
color: "success",
|
|
136
|
+
name: "success"
|
|
124
137
|
};
|
|
125
138
|
case "noIcon":
|
|
126
139
|
return undefined;
|
|
@@ -136,21 +149,37 @@ export const Tag = ({
|
|
|
136
149
|
text,
|
|
137
150
|
variant,
|
|
138
151
|
testID,
|
|
139
|
-
|
|
140
|
-
iconAccessibilityLabel
|
|
152
|
+
icon,
|
|
153
|
+
iconAccessibilityLabel,
|
|
154
|
+
forceLightMode = false
|
|
141
155
|
}: Tag) => {
|
|
142
156
|
const theme = useIOTheme();
|
|
143
157
|
const { isExperimental } = useIOExperimentalDesign();
|
|
144
158
|
|
|
145
|
-
const variantProps = getVariantProps(variant,
|
|
159
|
+
const variantProps = getVariantProps(variant, icon);
|
|
160
|
+
|
|
161
|
+
const borderColor = forceLightMode
|
|
162
|
+
? IOColors[IOThemeLight["cardBorder-default"]]
|
|
163
|
+
: IOColors[theme["cardBorder-default"]];
|
|
164
|
+
|
|
165
|
+
const backgroundColor = forceLightMode
|
|
166
|
+
? IOColors[IOThemeLight["appBackground-primary"]]
|
|
167
|
+
: IOColors[theme["appBackground-primary"]];
|
|
146
168
|
|
|
147
169
|
return (
|
|
148
|
-
<View
|
|
170
|
+
<View
|
|
171
|
+
testID={testID}
|
|
172
|
+
style={[styles.tag, { borderColor, backgroundColor }]}
|
|
173
|
+
>
|
|
149
174
|
{variantProps && (
|
|
150
175
|
<View style={styles.iconWrapper}>
|
|
151
176
|
<Icon
|
|
152
|
-
name={variantProps.
|
|
153
|
-
color={
|
|
177
|
+
name={variantProps.name}
|
|
178
|
+
color={
|
|
179
|
+
forceLightMode
|
|
180
|
+
? IOThemeLight[IconColorsMap[variantProps.color]]
|
|
181
|
+
: theme[IconColorsMap[variantProps.color]]
|
|
182
|
+
}
|
|
154
183
|
size={IOTagIconSize}
|
|
155
184
|
accessible={!!iconAccessibilityLabel}
|
|
156
185
|
accessibilityLabel={iconAccessibilityLabel}
|
|
@@ -164,7 +193,11 @@ export const Tag = ({
|
|
|
164
193
|
weight={"Semibold"}
|
|
165
194
|
size={12}
|
|
166
195
|
lineHeight={16}
|
|
167
|
-
color={
|
|
196
|
+
color={
|
|
197
|
+
forceLightMode
|
|
198
|
+
? IOThemeLight["textBody-tertiary"]
|
|
199
|
+
: theme["textBody-tertiary"]
|
|
200
|
+
}
|
|
168
201
|
numberOfLines={1}
|
|
169
202
|
ellipsizeMode="tail"
|
|
170
203
|
style={{
|
|
@@ -10,7 +10,6 @@ import { IOColors, useIOExperimentalDesign, useIOTheme } from "../../core";
|
|
|
10
10
|
import { useBoldTextEnabled } from "../../utils/accessibility";
|
|
11
11
|
import {
|
|
12
12
|
IOFontFamily,
|
|
13
|
-
IOFontSize,
|
|
14
13
|
IOFontWeight,
|
|
15
14
|
makeFontStyleObject
|
|
16
15
|
} from "../../utils/fonts";
|
|
@@ -37,7 +36,7 @@ export type TypographicStyleProps = Omit<
|
|
|
37
36
|
* cannot be included in the default StyleProp<TextStyle>
|
|
38
37
|
*/
|
|
39
38
|
type IOTextBaseProps = {
|
|
40
|
-
size?:
|
|
39
|
+
size?: number;
|
|
41
40
|
weight?: IOFontWeight;
|
|
42
41
|
color?: IOColors;
|
|
43
42
|
font?: IOFontFamily;
|
package/src/core/IOColors.ts
CHANGED
|
@@ -53,6 +53,7 @@ export const IOColors = asIOColors({
|
|
|
53
53
|
"turquoise-850": "#003B3D",
|
|
54
54
|
"turquoise-500": "#00C5CA",
|
|
55
55
|
"turquoise-450": "#19CBCF" /* Dark mode */,
|
|
56
|
+
"turquoise-300": "#61DCDF",
|
|
56
57
|
"turquoise-150": "#AAEEEF",
|
|
57
58
|
"turquoise-100": "#C2F3F4",
|
|
58
59
|
"turquoise-50": "#DBF9FA",
|
|
@@ -232,6 +233,7 @@ export const IOColorsStatus = asIOColors({
|
|
|
232
233
|
});
|
|
233
234
|
|
|
234
235
|
export type IOColorsStatus = keyof typeof IOColorsStatus;
|
|
236
|
+
|
|
235
237
|
export type IOColorsStatusForeground = Extract<
|
|
236
238
|
IOColorsStatus,
|
|
237
239
|
"error-850" | "warning-850" | "info-850" | "success-850"
|
|
@@ -283,7 +285,10 @@ const themeKeys = [
|
|
|
283
285
|
// Status
|
|
284
286
|
"errorIcon",
|
|
285
287
|
"errorText",
|
|
288
|
+
"successIcon",
|
|
286
289
|
"successText",
|
|
290
|
+
"warningIcon",
|
|
291
|
+
"infoIcon",
|
|
287
292
|
// Pictograms
|
|
288
293
|
"pictogram-hands",
|
|
289
294
|
"pictogram-tint-main",
|
|
@@ -322,7 +327,10 @@ export const IOThemeLight: IOTheme = {
|
|
|
322
327
|
// Status
|
|
323
328
|
errorIcon: "error-600",
|
|
324
329
|
errorText: "error-600",
|
|
330
|
+
successIcon: "success-700",
|
|
325
331
|
successText: "success-700",
|
|
332
|
+
warningIcon: "warning-700",
|
|
333
|
+
infoIcon: "info-700",
|
|
326
334
|
// Pictograms
|
|
327
335
|
"pictogram-hands": "blueIO-500",
|
|
328
336
|
"pictogram-tint-main": "turquoise-150",
|
|
@@ -356,6 +364,7 @@ export const IOThemeDark: IOTheme = {
|
|
|
356
364
|
// Design System related
|
|
357
365
|
"cardBorder-default": "grey-850",
|
|
358
366
|
"icon-default": "grey-450",
|
|
367
|
+
"icon-decorative": "grey-650",
|
|
359
368
|
// Layout
|
|
360
369
|
"divider-header": "grey-850",
|
|
361
370
|
"divider-default": "grey-850",
|
|
@@ -364,6 +373,9 @@ export const IOThemeDark: IOTheme = {
|
|
|
364
373
|
errorIcon: "error-400",
|
|
365
374
|
errorText: "error-400",
|
|
366
375
|
successText: "success-400",
|
|
376
|
+
successIcon: "success-500",
|
|
377
|
+
warningIcon: "warning-500",
|
|
378
|
+
infoIcon: "info-500",
|
|
367
379
|
// Pictograms
|
|
368
380
|
"pictogram-hands": "white",
|
|
369
381
|
"pictogram-tint-main": "turquoise-150",
|