@procivis/one-react-native-components 0.3.132 → 0.3.143
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/history/history-list-item-icon.js +2 -0
- package/lib/commonjs/components/history/history-list-item-icon.js.map +1 -1
- package/lib/commonjs/components/proof-request/index.js +1 -12
- package/lib/commonjs/components/proof-request/index.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/commonjs/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/commonjs/ui-components/buttons/scan-button.js +122 -27
- package/lib/commonjs/ui-components/buttons/scan-button.js.map +1 -1
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js +37 -18
- package/lib/commonjs/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/commonjs/ui-components/credential/credential-attribute-item.js +13 -4
- package/lib/commonjs/ui-components/credential/credential-attribute-item.js.map +1 -1
- package/lib/commonjs/ui-components/icons/icons.js +36 -2
- package/lib/commonjs/ui-components/icons/icons.js.map +1 -1
- package/lib/commonjs/ui-components/list/wallet/empty-list.js +2 -1
- package/lib/commonjs/ui-components/list/wallet/empty-list.js.map +1 -1
- package/lib/commonjs/ui-components/notice/wallet-notice.js +4 -2
- package/lib/commonjs/ui-components/notice/wallet-notice.js.map +1 -1
- package/lib/commonjs/ui-components/text/expandableTypography.js +64 -0
- package/lib/commonjs/ui-components/text/expandableTypography.js.map +1 -0
- package/lib/commonjs/ui-components/text/index.js +15 -0
- package/lib/commonjs/ui-components/text/index.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/credential-schemas.js +24 -1
- package/lib/commonjs/utils/hooks/core/credential-schemas.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/proofs.js +1 -1
- package/lib/commonjs/utils/hooks/core/proofs.js.map +1 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js +20 -1
- package/lib/commonjs/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js +34 -7
- package/lib/commonjs/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/commonjs/utils/parsers/credential.js +12 -4
- package/lib/commonjs/utils/parsers/credential.js.map +1 -1
- package/lib/commonjs/utils/parsers/index.js +0 -11
- package/lib/commonjs/utils/parsers/index.js.map +1 -1
- package/lib/commonjs/utils/parsers/query.js +1 -1
- package/lib/commonjs/utils/parsers/query.js.map +1 -1
- package/lib/module/components/history/history-list-item-icon.js +2 -0
- package/lib/module/components/history/history-list-item-icon.js.map +1 -1
- package/lib/module/components/proof-request/index.js +0 -1
- package/lib/module/components/proof-request/index.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2-group.js.map +1 -1
- package/lib/module/components/proof-request/v2/share-credential-v2.js.map +1 -1
- package/lib/module/ui-components/buttons/scan-button.js +124 -29
- package/lib/module/ui-components/buttons/scan-button.js.map +1 -1
- package/lib/module/ui-components/credential/card/credential-details-card.js +37 -18
- package/lib/module/ui-components/credential/card/credential-details-card.js.map +1 -1
- package/lib/module/ui-components/credential/credential-attribute-item.js +13 -4
- package/lib/module/ui-components/credential/credential-attribute-item.js.map +1 -1
- package/lib/module/ui-components/icons/icons.js +32 -0
- package/lib/module/ui-components/icons/icons.js.map +1 -1
- package/lib/module/ui-components/list/wallet/empty-list.js +2 -1
- package/lib/module/ui-components/list/wallet/empty-list.js.map +1 -1
- package/lib/module/ui-components/notice/wallet-notice.js +4 -2
- package/lib/module/ui-components/notice/wallet-notice.js.map +1 -1
- package/lib/module/ui-components/text/expandableTypography.js +55 -0
- package/lib/module/ui-components/text/expandableTypography.js.map +1 -0
- package/lib/module/ui-components/text/index.js +2 -1
- package/lib/module/ui-components/text/index.js.map +1 -1
- package/lib/module/utils/hooks/core/credential-schemas.js +24 -1
- package/lib/module/utils/hooks/core/credential-schemas.js.map +1 -1
- package/lib/module/utils/hooks/core/proofs.js +1 -1
- package/lib/module/utils/hooks/core/proofs.js.map +1 -1
- package/lib/module/utils/hooks/core/wallet-unit.js +18 -0
- package/lib/module/utils/hooks/core/wallet-unit.js.map +1 -1
- package/lib/module/utils/parsers/credential-sharing-v2.js +32 -6
- package/lib/module/utils/parsers/credential-sharing-v2.js.map +1 -1
- package/lib/module/utils/parsers/credential.js +10 -4
- package/lib/module/utils/parsers/credential.js.map +1 -1
- package/lib/module/utils/parsers/index.js +0 -1
- package/lib/module/utils/parsers/index.js.map +1 -1
- package/lib/module/utils/parsers/query.js +1 -1
- package/lib/module/utils/parsers/query.js.map +1 -1
- package/lib/typescript/components/proof-request/index.d.ts +0 -1
- package/lib/typescript/components/proof-request/v2/share-credential-v2-group.d.ts +8 -1
- package/lib/typescript/components/proof-request/v2/share-credential-v2.d.ts +1 -1
- package/lib/typescript/ui-components/buttons/scan-button.d.ts +9 -3
- package/lib/typescript/ui-components/credential/card/credential-details-card.d.ts +3 -0
- package/lib/typescript/ui-components/credential/credential-attribute-item.d.ts +3 -0
- package/lib/typescript/ui-components/icons/icons.d.ts +2 -0
- package/lib/typescript/ui-components/list/wallet/empty-list.d.ts +2 -2
- package/lib/typescript/ui-components/text/expandableTypography.d.ts +10 -0
- package/lib/typescript/ui-components/text/index.d.ts +2 -1
- package/lib/typescript/ui-components/text/typography.d.ts +14 -14
- package/lib/typescript/utils/hooks/app-state.d.ts +1 -1
- package/lib/typescript/utils/hooks/core/proofs.d.ts +2 -2
- package/lib/typescript/utils/hooks/core/wallet-unit.d.ts +5 -1
- package/lib/typescript/utils/parsers/credential-sharing-v2.d.ts +10 -2
- package/lib/typescript/utils/parsers/credential.d.ts +2 -1
- package/lib/typescript/utils/parsers/index.d.ts +0 -1
- package/package.json +5 -4
- package/src/components/history/history-list-item-icon.tsx +2 -0
- package/src/components/proof-request/index.ts +0 -1
- package/src/components/proof-request/v2/share-credential-v2-group.tsx +9 -2
- package/src/components/proof-request/v2/share-credential-v2.tsx +1 -1
- package/src/ui-components/buttons/scan-button.tsx +130 -38
- package/src/ui-components/credential/card/credential-details-card.tsx +46 -19
- package/src/ui-components/credential/credential-attribute-item.tsx +15 -3
- package/src/ui-components/icons/icons.tsx +24 -0
- package/src/ui-components/list/wallet/empty-list.tsx +11 -8
- package/src/ui-components/notice/wallet-notice.tsx +4 -2
- package/src/ui-components/text/expandableTypography.tsx +71 -0
- package/src/ui-components/text/index.ts +2 -1
- package/src/utils/hooks/core/credential-schemas.ts +23 -1
- package/src/utils/hooks/core/proofs.ts +3 -3
- package/src/utils/hooks/core/wallet-unit.ts +21 -0
- package/src/utils/parsers/credential-sharing-v2.tsx +71 -6
- package/src/utils/parsers/credential.ts +14 -3
- package/src/utils/parsers/index.ts +0 -1
- package/src/utils/parsers/query.ts +0 -1
- package/lib/commonjs/components/proof-request/v1/group.js +0 -35
- package/lib/commonjs/components/proof-request/v1/group.js.map +0 -1
- package/lib/commonjs/components/proof-request/v1/index.js +0 -39
- package/lib/commonjs/components/proof-request/v1/index.js.map +0 -1
- package/lib/commonjs/components/proof-request/v1/select-credential.js +0 -53
- package/lib/commonjs/components/proof-request/v1/select-credential.js.map +0 -1
- package/lib/commonjs/components/proof-request/v1/share-credential.js +0 -110
- package/lib/commonjs/components/proof-request/v1/share-credential.js.map +0 -1
- package/lib/commonjs/utils/parsers/credential-sharing.js +0 -263
- package/lib/commonjs/utils/parsers/credential-sharing.js.map +0 -1
- package/lib/module/components/proof-request/v1/group.js +0 -27
- package/lib/module/components/proof-request/v1/group.js.map +0 -1
- package/lib/module/components/proof-request/v1/index.js +0 -4
- package/lib/module/components/proof-request/v1/index.js.map +0 -1
- package/lib/module/components/proof-request/v1/select-credential.js +0 -44
- package/lib/module/components/proof-request/v1/select-credential.js.map +0 -1
- package/lib/module/components/proof-request/v1/share-credential.js +0 -101
- package/lib/module/components/proof-request/v1/share-credential.js.map +0 -1
- package/lib/module/utils/parsers/credential-sharing.js +0 -250
- package/lib/module/utils/parsers/credential-sharing.js.map +0 -1
- package/lib/typescript/components/proof-request/v1/group.d.ts +0 -2
- package/lib/typescript/components/proof-request/v1/index.d.ts +0 -3
- package/lib/typescript/components/proof-request/v1/select-credential.d.ts +0 -15
- package/lib/typescript/components/proof-request/v1/share-credential.d.ts +0 -27
- package/lib/typescript/utils/parsers/credential-sharing.d.ts +0 -20
- package/src/components/proof-request/v1/group.tsx +0 -26
- package/src/components/proof-request/v1/index.ts +0 -3
- package/src/components/proof-request/v1/select-credential.tsx +0 -55
- package/src/components/proof-request/v1/share-credential.tsx +0 -159
- package/src/utils/parsers/credential-sharing.tsx +0 -404
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { StyleSheet, View } from 'react-native';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
4
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
4
|
import { TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';
|
|
6
5
|
import { useAccessibilityTranslation } from '../accessibility/accessibilityLanguage';
|
|
7
6
|
import BlurView from '../blur/blur-view';
|
|
8
|
-
import { ScanIcon } from '../icons';
|
|
7
|
+
import { IssueIcon, ScanIcon, SignIcon } from '../icons';
|
|
9
8
|
import { useAppColorScheme } from '../theme';
|
|
10
9
|
const hitSlop = {
|
|
11
10
|
top: 10,
|
|
@@ -13,65 +12,161 @@ const hitSlop = {
|
|
|
13
12
|
bottom: 10,
|
|
14
13
|
right: 10
|
|
15
14
|
};
|
|
15
|
+
const SCAN_WIDTH = 104;
|
|
16
|
+
const SCAN_HEIGHT = 80;
|
|
17
|
+
const SIDE_WIDTH = 94;
|
|
18
|
+
const SIDE_HEIGHT = 64;
|
|
19
|
+
const OVERLAP = 50;
|
|
16
20
|
const ScanButton = /*#__PURE__*/React.forwardRef(({
|
|
17
21
|
style,
|
|
18
|
-
|
|
22
|
+
onSignPress,
|
|
23
|
+
onIssuePress,
|
|
24
|
+
onScanPress,
|
|
25
|
+
testID
|
|
19
26
|
}, ref) => {
|
|
20
27
|
const t = useAccessibilityTranslation();
|
|
21
28
|
const colorScheme = useAppColorScheme();
|
|
22
29
|
const insets = useSafeAreaInsets();
|
|
23
|
-
|
|
30
|
+
const showLeftButton = onSignPress !== undefined;
|
|
31
|
+
const showRightButton = onIssuePress !== undefined;
|
|
32
|
+
const leftButtonOpacity = showLeftButton ? 1 : 0;
|
|
33
|
+
const rightButtonOpacity = showRightButton ? 1 : 0;
|
|
34
|
+
const bottomOffset = Math.max(24, insets.bottom);
|
|
35
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
36
|
+
style: [styles.wrapper, {
|
|
37
|
+
bottom: bottomOffset
|
|
38
|
+
}, style]
|
|
39
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
40
|
+
pointerEvents: showLeftButton ? 'auto' : 'none',
|
|
41
|
+
style: [styles.sideButtonContainer, {
|
|
42
|
+
opacity: leftButtonOpacity
|
|
43
|
+
}]
|
|
44
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
45
|
+
accessibilityRole: "button",
|
|
46
|
+
hitSlop: hitSlop,
|
|
47
|
+
testID: `${testID}.sign`,
|
|
48
|
+
onPress: onSignPress,
|
|
49
|
+
style: styles.sideButton
|
|
50
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
51
|
+
style: [styles.sideInnerLeft, {
|
|
52
|
+
backgroundColor: colorScheme.white
|
|
53
|
+
}]
|
|
54
|
+
}, /*#__PURE__*/React.createElement(SignIcon, {
|
|
55
|
+
color: colorScheme.black
|
|
56
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
57
|
+
style: [styles.sideLabel, {
|
|
58
|
+
color: colorScheme.black
|
|
59
|
+
}]
|
|
60
|
+
}, "Sign")))), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
24
61
|
accessibilityLabel: t('accessibility.icon.scan'),
|
|
25
62
|
accessibilityRole: "button",
|
|
26
63
|
hitSlop: hitSlop,
|
|
27
64
|
ref: ref,
|
|
28
|
-
style:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
65
|
+
style: styles.scanButton,
|
|
66
|
+
testID: `${testID}.scan`,
|
|
67
|
+
onPress: onScanPress
|
|
68
|
+
}, /*#__PURE__*/React.createElement(BlurView, {
|
|
32
69
|
blurStyle: "soft",
|
|
33
|
-
style: styles.
|
|
70
|
+
style: styles.scanBlurWrapper
|
|
34
71
|
}, /*#__PURE__*/React.createElement(View, {
|
|
35
|
-
style: [styles.
|
|
72
|
+
style: [styles.scanInner, {
|
|
36
73
|
backgroundColor: colorScheme.accent
|
|
37
74
|
}]
|
|
38
75
|
}, /*#__PURE__*/React.createElement(ScanIcon, {
|
|
39
76
|
color: colorScheme.white
|
|
40
|
-
}))))
|
|
77
|
+
})))), /*#__PURE__*/React.createElement(View, {
|
|
78
|
+
pointerEvents: showRightButton ? 'auto' : 'none',
|
|
79
|
+
style: [styles.sideButtonContainer, {
|
|
80
|
+
opacity: rightButtonOpacity
|
|
81
|
+
}]
|
|
82
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
83
|
+
accessibilityRole: "button",
|
|
84
|
+
testID: `${testID}.issue`,
|
|
85
|
+
hitSlop: hitSlop,
|
|
86
|
+
onPress: onIssuePress,
|
|
87
|
+
style: styles.sideButton
|
|
88
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
89
|
+
style: [styles.sideInnerRight, {
|
|
90
|
+
backgroundColor: colorScheme.white
|
|
91
|
+
}]
|
|
92
|
+
}, /*#__PURE__*/React.createElement(IssueIcon, {
|
|
93
|
+
color: colorScheme.black
|
|
94
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
95
|
+
style: [styles.sideLabel, {
|
|
96
|
+
color: colorScheme.black
|
|
97
|
+
}]
|
|
98
|
+
}, "Issue")))));
|
|
41
99
|
});
|
|
42
100
|
ScanButton.displayName = 'ScanButton';
|
|
43
101
|
export default ScanButton;
|
|
44
102
|
const styles = StyleSheet.create({
|
|
45
|
-
|
|
103
|
+
scanBlurWrapper: {
|
|
46
104
|
borderRadius: 28,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
padding: 8,
|
|
50
|
-
width: 104
|
|
105
|
+
flex: 1,
|
|
106
|
+
padding: 8
|
|
51
107
|
},
|
|
52
|
-
|
|
108
|
+
scanButton: {
|
|
53
109
|
borderRadius: 28,
|
|
54
|
-
|
|
55
|
-
height: 80,
|
|
56
|
-
left: '50%',
|
|
57
|
-
marginLeft: -52,
|
|
58
|
-
position: 'absolute',
|
|
110
|
+
height: SCAN_HEIGHT,
|
|
59
111
|
shadowColor: '#000000',
|
|
60
112
|
shadowOffset: {
|
|
61
113
|
height: 4,
|
|
62
114
|
width: 0
|
|
63
115
|
},
|
|
64
|
-
shadowOpacity: 0.
|
|
116
|
+
shadowOpacity: 0.25,
|
|
65
117
|
shadowRadius: 24,
|
|
66
|
-
width:
|
|
118
|
+
width: SCAN_WIDTH,
|
|
119
|
+
zIndex: 1
|
|
67
120
|
},
|
|
68
|
-
|
|
121
|
+
scanInner: {
|
|
69
122
|
alignItems: 'center',
|
|
70
123
|
borderRadius: 20,
|
|
71
|
-
|
|
72
|
-
|
|
124
|
+
flex: 1,
|
|
125
|
+
justifyContent: 'center'
|
|
126
|
+
},
|
|
127
|
+
sideButton: {
|
|
128
|
+
borderRadius: 24,
|
|
129
|
+
flex: 1
|
|
130
|
+
},
|
|
131
|
+
sideButtonContainer: {
|
|
132
|
+
height: SIDE_HEIGHT,
|
|
133
|
+
marginHorizontal: -OVERLAP / 2,
|
|
134
|
+
width: SIDE_WIDTH,
|
|
135
|
+
zIndex: 0
|
|
136
|
+
},
|
|
137
|
+
sideInnerLeft: {
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
borderBottomLeftRadius: 22,
|
|
140
|
+
borderBottomRightRadius: 0,
|
|
141
|
+
borderTopLeftRadius: 22,
|
|
142
|
+
borderTopRightRadius: 0,
|
|
143
|
+
flex: 1,
|
|
144
|
+
justifyContent: 'center',
|
|
145
|
+
paddingRight: 10
|
|
146
|
+
},
|
|
147
|
+
sideInnerRight: {
|
|
148
|
+
alignItems: 'center',
|
|
149
|
+
borderBottomLeftRadius: 0,
|
|
150
|
+
borderBottomRightRadius: 22,
|
|
151
|
+
borderTopLeftRadius: 0,
|
|
152
|
+
borderTopRightRadius: 22,
|
|
153
|
+
flex: 1,
|
|
73
154
|
justifyContent: 'center',
|
|
74
|
-
|
|
155
|
+
paddingLeft: 10
|
|
156
|
+
},
|
|
157
|
+
sideLabel: {
|
|
158
|
+
fontSize: 14,
|
|
159
|
+
fontWeight: '500',
|
|
160
|
+
marginTop: 6
|
|
161
|
+
},
|
|
162
|
+
wrapper: {
|
|
163
|
+
alignItems: 'center',
|
|
164
|
+
flexDirection: 'row',
|
|
165
|
+
height: SCAN_HEIGHT,
|
|
166
|
+
justifyContent: 'center',
|
|
167
|
+
left: 0,
|
|
168
|
+
position: 'absolute',
|
|
169
|
+
right: 0
|
|
75
170
|
}
|
|
76
171
|
});
|
|
77
172
|
//# sourceMappingURL=scan-button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","View","useSafeAreaInsets","TouchableOpacity","useAccessibilityTranslation","BlurView","ScanIcon","useAppColorScheme","hitSlop","top","left","bottom","right","ScanButton","forwardRef","style","props","ref","t","colorScheme","insets","createElement","_extends","accessibilityLabel","accessibilityRole","styles","button","Math","max","blurStyle","blurWrapper","iconWrapper","backgroundColor","accent","color","white","displayName","create","borderRadius","borderWidth","height","padding","width","marginLeft","position","shadowColor","shadowOffset","shadowOpacity","shadowRadius","alignItems","justifyContent"],"sources":["scan-button.tsx"],"sourcesContent":["import React from 'react';\nimport { Insets, StyleSheet, TouchableOpacityProps, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { TouchableOpacity, TouchableOpacityRef } from '../accessibility/accessibilityHistoryWrappers';\nimport { useAccessibilityTranslation } from '../accessibility/accessibilityLanguage';\nimport BlurView from '../blur/blur-view';\nimport { ScanIcon } from '../icons';\nimport { useAppColorScheme } from '../theme';\n\nexport type ScanButtonProps = TouchableOpacityProps;\n\nconst hitSlop: Insets = { top: 10, left: 10, bottom: 10, right: 10 };\n\nconst ScanButton = React.forwardRef<TouchableOpacityRef, ScanButtonProps>(({ style, ...props }, ref) => {\n const t = useAccessibilityTranslation();\n const colorScheme = useAppColorScheme();\n const insets = useSafeAreaInsets();\n\n return (\n <TouchableOpacity\n accessibilityLabel={t('accessibility.icon.scan')}\n accessibilityRole=\"button\"\n hitSlop={hitSlop}\n ref={ref}\n style={[styles.button, { bottom: Math.max(24, insets.bottom) }, style]}\n {...props}>\n <BlurView blurStyle=\"soft\" style={styles.blurWrapper}>\n <View style={[styles.iconWrapper, { backgroundColor: colorScheme.accent }]}>\n <ScanIcon color={colorScheme.white} />\n </View>\n </BlurView>\n </TouchableOpacity>\n );\n});\n\nScanButton.displayName = 'ScanButton';\nexport default ScanButton;\n\nconst styles = StyleSheet.create({\n blurWrapper: {\n borderRadius: 28,\n borderWidth: 0,\n height: 80,\n padding: 8,\n width: 104,\n },\n button: {\n borderRadius: 28,\n borderWidth: 0,\n height: 80,\n left: '50%',\n marginLeft: -52,\n position: 'absolute',\n shadowColor: '#000000',\n shadowOffset: { height: 4, width: 0 },\n shadowOpacity: 0.2,\n shadowRadius: 24,\n width: 104,\n },\n iconWrapper: {\n alignItems: 'center',\n borderRadius: 20,\n borderWidth: 0,\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n },\n});\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAiBC,UAAU,EAAyBC,IAAI,QAAQ,cAAc;AAC9E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,gBAAgB,QAA6B,+CAA+C;AACrG,SAASC,2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CACM,CAAC;AAEvB,CAAC,CAAC;AAEFtB,UAAU,CAACuB,WAAW,GAAG,YAAY;AACrC,eAAevB,UAAU;AAEzB,MAAMY,MAAM,GAAGzB,UAAU,CAACqC,MAAM,CAAC;EAC/BP,WAAW,EAAE;IACXQ,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,CAAC;IACdC,MAAM,EAAE,EAAE;IACVC,OAAO,EAAE,CAAC;IACVC,KAAK,EAAE;EACT,CAAC;EACDhB,MAAM,EAAE;IACNY,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,CAAC;IACdC,MAAM,EAAE,EAAE;IACV9B,IAAI,EAAE,KAAK;IACXiC,UAAU,EAAE,CAAC,EAAE;IACfC,QAAQ,EAAE,UAAU;IACpBC,WAAW,EAAE,SAAS;IACtBC,YAAY,EAAE;MAAEN,MAAM,EAAE,CAAC;MAAEE,KAAK,EAAE;IAAE,CAAC;IACrCK,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,EAAE;IAChBN,KAAK,EAAE;EACT,CAAC;EACDX,WAAW,EAAE;IACXkB,UAAU,EAAE,QAAQ;IACpBX,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,CAAC;IACdC,MAAM,EAAE,MAAM;IACdU,cAAc,EAAE,QAAQ;IACxBR,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","Text","View","useSafeAreaInsets","TouchableOpacity","useAccessibilityTranslation","BlurView","IssueIcon","ScanIcon","SignIcon","useAppColorScheme","hitSlop","top","left","bottom","right","SCAN_WIDTH","SCAN_HEIGHT","SIDE_WIDTH","SIDE_HEIGHT","OVERLAP","ScanButton","forwardRef","style","onSignPress","onIssuePress","onScanPress","testID","ref","t","colorScheme","insets","showLeftButton","undefined","showRightButton","leftButtonOpacity","rightButtonOpacity","bottomOffset","Math","max","createElement","styles","wrapper","pointerEvents","sideButtonContainer","opacity","accessibilityRole","onPress","sideButton","sideInnerLeft","backgroundColor","white","color","black","sideLabel","accessibilityLabel","scanButton","blurStyle","scanBlurWrapper","scanInner","accent","sideInnerRight","displayName","create","borderRadius","flex","padding","height","shadowColor","shadowOffset","width","shadowOpacity","shadowRadius","zIndex","alignItems","justifyContent","marginHorizontal","borderBottomLeftRadius","borderBottomRightRadius","borderTopLeftRadius","borderTopRightRadius","paddingRight","paddingLeft","fontSize","fontWeight","marginTop","flexDirection","position"],"sources":["scan-button.tsx"],"sourcesContent":["import React from 'react';\nimport { Insets, StyleProp, StyleSheet, Text, View, ViewStyle } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { TouchableOpacity, TouchableOpacityRef } from '../accessibility/accessibilityHistoryWrappers';\nimport { useAccessibilityTranslation } from '../accessibility/accessibilityLanguage';\nimport BlurView from '../blur/blur-view';\nimport { IssueIcon, ScanIcon, SignIcon } from '../icons';\nimport { useAppColorScheme } from '../theme';\n\nexport type ScanButtonProps = {\n onSignPress?: () => void;\n onIssuePress?: () => void;\n onScanPress: () => void;\n testID?: string;\n style?: StyleProp<ViewStyle>;\n};\n\nconst hitSlop: Insets = { top: 10, left: 10, bottom: 10, right: 10 };\n\nconst SCAN_WIDTH = 104;\nconst SCAN_HEIGHT = 80;\nconst SIDE_WIDTH = 94;\nconst SIDE_HEIGHT = 64;\nconst OVERLAP = 50;\n\nconst ScanButton = React.forwardRef<TouchableOpacityRef, ScanButtonProps>(\n ({ style, onSignPress, onIssuePress, onScanPress, testID }, ref) => {\n const t = useAccessibilityTranslation();\n const colorScheme = useAppColorScheme();\n const insets = useSafeAreaInsets();\n const showLeftButton = onSignPress !== undefined;\n const showRightButton = onIssuePress !== undefined;\n const leftButtonOpacity = showLeftButton ? 1 : 0;\n const rightButtonOpacity = showRightButton ? 1 : 0;\n\n const bottomOffset = Math.max(24, insets.bottom);\n\n return (\n <View style={[styles.wrapper, { bottom: bottomOffset }, style as object]}>\n <View\n pointerEvents={showLeftButton ? 'auto' : 'none'}\n style={[styles.sideButtonContainer, { opacity: leftButtonOpacity }]}>\n <TouchableOpacity\n accessibilityRole=\"button\"\n hitSlop={hitSlop}\n testID={`${testID}.sign`}\n onPress={onSignPress}\n style={styles.sideButton}>\n <View style={[styles.sideInnerLeft, { backgroundColor: colorScheme.white }]}>\n <SignIcon color={colorScheme.black} />\n <Text style={[styles.sideLabel, { color: colorScheme.black }]}>Sign</Text>\n </View>\n </TouchableOpacity>\n </View>\n\n <TouchableOpacity\n accessibilityLabel={t('accessibility.icon.scan')}\n accessibilityRole=\"button\"\n hitSlop={hitSlop}\n ref={ref}\n style={styles.scanButton}\n testID={`${testID}.scan`}\n onPress={onScanPress}>\n <BlurView blurStyle=\"soft\" style={styles.scanBlurWrapper}>\n <View style={[styles.scanInner, { backgroundColor: colorScheme.accent }]}>\n <ScanIcon color={colorScheme.white} />\n </View>\n </BlurView>\n </TouchableOpacity>\n\n <View\n pointerEvents={showRightButton ? 'auto' : 'none'}\n style={[styles.sideButtonContainer, { opacity: rightButtonOpacity }]}>\n <TouchableOpacity\n accessibilityRole=\"button\"\n testID={`${testID}.issue`}\n hitSlop={hitSlop}\n onPress={onIssuePress}\n style={styles.sideButton}>\n <View style={[styles.sideInnerRight, { backgroundColor: colorScheme.white }]}>\n <IssueIcon color={colorScheme.black} />\n <Text style={[styles.sideLabel, { color: colorScheme.black }]}>Issue</Text>\n </View>\n </TouchableOpacity>\n </View>\n </View>\n );\n },\n);\n\nScanButton.displayName = 'ScanButton';\nexport default ScanButton;\n\nconst styles = StyleSheet.create({\n scanBlurWrapper: {\n borderRadius: 28,\n flex: 1,\n padding: 8,\n },\n scanButton: {\n borderRadius: 28,\n height: SCAN_HEIGHT,\n shadowColor: '#000000',\n shadowOffset: { height: 4, width: 0 },\n shadowOpacity: 0.25,\n shadowRadius: 24,\n width: SCAN_WIDTH,\n zIndex: 1,\n },\n scanInner: {\n alignItems: 'center',\n borderRadius: 20,\n flex: 1,\n justifyContent: 'center',\n },\n sideButton: {\n borderRadius: 24,\n flex: 1,\n },\n sideButtonContainer: {\n height: SIDE_HEIGHT,\n marginHorizontal: -OVERLAP / 2,\n width: SIDE_WIDTH,\n zIndex: 0,\n },\n sideInnerLeft: {\n alignItems: 'center',\n borderBottomLeftRadius: 22,\n borderBottomRightRadius: 0,\n borderTopLeftRadius: 22,\n borderTopRightRadius: 0,\n flex: 1,\n justifyContent: 'center',\n paddingRight: 10,\n },\n sideInnerRight: {\n alignItems: 'center',\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 22,\n borderTopLeftRadius: 0,\n borderTopRightRadius: 22,\n flex: 1,\n justifyContent: 'center',\n paddingLeft: 10,\n },\n sideLabel: {\n fontSize: 14,\n fontWeight: '500',\n marginTop: 6,\n },\n wrapper: {\n alignItems: 'center',\n flexDirection: 'row',\n height: SCAN_HEIGHT,\n justifyContent: 'center',\n left: 0,\n position: 'absolute',\n right: 0,\n },\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAA4BC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAmB,cAAc;AACnF,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,gBAAgB,QAA6B,+CAA+C;AACrG,SAASC,2BAA2B,QAAQ,wCAAwC;AACpF,OAAOC,QAAQ,MAAM,mBAAmB;AACxC,SAASC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,UAAU;AACxD,SAASC,iBAAiB,QAAQ,UAAU;AAU5C,MAAMC,OAAe,GAAG;EAAEC,GAAG,EAAE,EAAE;EAAEC,IAAI,EAAE,EAAE;EAAEC,MAAM,EAAE,EAAE;EAAEC,KAAK,EAAE;AAAG,CAAC;AAEpE,MAAMC,UAAU,GAAG,GAAG;AACtB,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,OAAO,GAAG,EAAE;AAElB,MAAMC,UAAU,gBAAGtB,KAAK,CAACuB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EAAE,EAAE;IAChBC,IAAI,EAAE;EACR,CAAC;EACDrB,mBAAmB,EAAE;IACnBuB,MAAM,EAAEhD,WAAW;IACnByD,gBAAgB,EAAE,CAACxD,OAAO,GAAG,CAAC;IAC9BkD,KAAK,EAAEpD,UAAU;IACjBuD,MAAM,EAAE;EACV,CAAC;EACDxB,aAAa,EAAE;IACbyB,UAAU,EAAE,QAAQ;IACpBG,sBAAsB,EAAE,EAAE;IAC1BC,uBAAuB,EAAE,CAAC;IAC1BC,mBAAmB,EAAE,EAAE;IACvBC,oBAAoB,EAAE,CAAC;IACvBf,IAAI,EAAE,CAAC;IACPU,cAAc,EAAE,QAAQ;IACxBM,YAAY,EAAE;EAChB,CAAC;EACDpB,cAAc,EAAE;IACda,UAAU,EAAE,QAAQ;IACpBG,sBAAsB,EAAE,CAAC;IACzBC,uBAAuB,EAAE,EAAE;IAC3BC,mBAAmB,EAAE,CAAC;IACtBC,oBAAoB,EAAE,EAAE;IACxBf,IAAI,EAAE,CAAC;IACPU,cAAc,EAAE,QAAQ;IACxBO,WAAW,EAAE;EACf,CAAC;EACD5B,SAAS,EAAE;IACT6B,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,SAAS,EAAE;EACb,CAAC;EACD3C,OAAO,EAAE;IACPgC,UAAU,EAAE,QAAQ;IACpBY,aAAa,EAAE,KAAK;IACpBnB,MAAM,EAAElD,WAAW;IACnB0D,cAAc,EAAE,QAAQ;IACxB9D,IAAI,EAAE,CAAC;IACP0E,QAAQ,EAAE,UAAU;IACpBxE,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -19,7 +19,10 @@ const CredentialDetailsCard = ({
|
|
|
19
19
|
onImagePreview,
|
|
20
20
|
onAttributeSelected,
|
|
21
21
|
style,
|
|
22
|
-
showAllButtonLabel,
|
|
22
|
+
showAllButtonLabel = 'Show all',
|
|
23
|
+
showLessButtonLabel = 'Show less',
|
|
24
|
+
moreLabel = 'More',
|
|
25
|
+
lessLabel = 'Less',
|
|
23
26
|
testID,
|
|
24
27
|
...viewProps
|
|
25
28
|
}) => {
|
|
@@ -34,6 +37,8 @@ const CredentialDetailsCard = ({
|
|
|
34
37
|
const [animatedHeightSet, setAnimatedHeightSet] = useState(false);
|
|
35
38
|
const previewAttributes = attributes ? attributes.slice(0, PREVIEW_ATTRIBUTES_COUNT) : [];
|
|
36
39
|
const extraAttributes = useMemo(() => attributes ? attributes.slice(PREVIEW_ATTRIBUTES_COUNT) : [], [attributes]);
|
|
40
|
+
const showSeeAllButton = extraAttributes.length > 0;
|
|
41
|
+
const isExpanded = allAttributesRendered;
|
|
37
42
|
useEffect(() => {
|
|
38
43
|
if (extraAttributes.length === 0) {
|
|
39
44
|
const viewStyle = StyleSheet.flatten([styles.allAttributesWrapper, footer && styles.allAttributesWrapperWithFooter]);
|
|
@@ -48,9 +53,9 @@ const CredentialDetailsCard = ({
|
|
|
48
53
|
if (allAttributesRendered && fullAttributesHeight === undefined) {
|
|
49
54
|
return;
|
|
50
55
|
}
|
|
51
|
-
const buttonViewHeight =
|
|
56
|
+
const buttonViewHeight = showSeeAllButton ? SEE_ALL_BUTTON_HEIGHT : 0;
|
|
52
57
|
const additionalAttributesHeight = fullAttributesHeight !== null && fullAttributesHeight !== void 0 ? fullAttributesHeight : 0;
|
|
53
|
-
const additionalHeight = allAttributesRendered ? additionalAttributesHeight : buttonViewHeight;
|
|
58
|
+
const additionalHeight = allAttributesRendered ? additionalAttributesHeight + buttonViewHeight : buttonViewHeight;
|
|
54
59
|
const fullHeight = previewAttributesHeight + additionalHeight;
|
|
55
60
|
setAnimatedHeightSet(true);
|
|
56
61
|
if (!animate) {
|
|
@@ -66,7 +71,7 @@ const CredentialDetailsCard = ({
|
|
|
66
71
|
currentHeight.value = withTiming(newHeight, {
|
|
67
72
|
duration
|
|
68
73
|
});
|
|
69
|
-
}, [allAttributesRendered, currentHeight, animate, expanded, extraAttributes, fullAttributesHeight, previewAttributes.length, previewAttributesHeight]);
|
|
74
|
+
}, [allAttributesRendered, currentHeight, animate, expanded, extraAttributes, fullAttributesHeight, previewAttributes.length, previewAttributesHeight, showSeeAllButton]);
|
|
70
75
|
const animatedStyle = useAnimatedStyle(() => {
|
|
71
76
|
if (currentHeight.value === undefined) {
|
|
72
77
|
if (expanded) {
|
|
@@ -121,30 +126,36 @@ const CredentialDetailsCard = ({
|
|
|
121
126
|
onLayout: onPreviewAttrContentLayout,
|
|
122
127
|
style: styles.previewAttributesWrapper
|
|
123
128
|
}, previewAttributes.map((attribute, idx) => /*#__PURE__*/React.createElement(CredentialAttributeItem, _extends({
|
|
129
|
+
moreLabel: moreLabel,
|
|
130
|
+
lessLabel: lessLabel,
|
|
124
131
|
key: attribute.id,
|
|
125
|
-
last: !footerView && !
|
|
132
|
+
last: !footerView && !showSeeAllButton && idx === previewAttributes.length - 1,
|
|
126
133
|
testID: concatTestID(testID, 'attribute', idx.toString()),
|
|
127
134
|
onImagePreview: onImagePreview,
|
|
128
|
-
onPress: onAttributeSelected
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
onPress: () => setAllAttributesRendered(true),
|
|
133
|
-
type: ButtonType.Secondary,
|
|
134
|
-
testID: concatTestID(testID, 'showAllAttributesButton'),
|
|
135
|
-
title: showAllButtonLabel
|
|
136
|
-
})), renderExtraAttributes && /*#__PURE__*/React.createElement(View, {
|
|
137
|
-
style: [styles.allAttributesWrapper, footerView && styles.allAttributesWrapperWithFooter],
|
|
135
|
+
onPress: onAttributeSelected,
|
|
136
|
+
isExpanded: isExpanded
|
|
137
|
+
}, attribute)))), renderExtraAttributes && /*#__PURE__*/React.createElement(View, {
|
|
138
|
+
style: [styles.allAttributesWrapper, footerView && styles.allAttributesWrapperWithFooter, showSeeAllButton && styles.allAttributesWrapperWithButton, !allAttributesRendered && styles.hidden],
|
|
138
139
|
onLayout: onFullAttrContentLayout
|
|
139
140
|
}, extraAttributes.map((attribute, index, {
|
|
140
141
|
length
|
|
141
142
|
}) => /*#__PURE__*/React.createElement(CredentialAttributeItem, _extends({
|
|
143
|
+
moreLabel: moreLabel,
|
|
144
|
+
lessLabel: lessLabel,
|
|
142
145
|
key: attribute.id,
|
|
143
|
-
last: !footerView && index === length - 1,
|
|
146
|
+
last: !footerView && !showSeeAllButton && index === length - 1,
|
|
144
147
|
testID: concatTestID(testID, 'attribute', index.toString()),
|
|
145
148
|
onImagePreview: onImagePreview,
|
|
146
|
-
onPress: onAttributeSelected
|
|
147
|
-
|
|
149
|
+
onPress: onAttributeSelected,
|
|
150
|
+
isExpanded: isExpanded
|
|
151
|
+
}, attribute)))), showSeeAllButton && /*#__PURE__*/React.createElement(View, {
|
|
152
|
+
style: styles.buttonWrapper
|
|
153
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
154
|
+
onPress: () => setAllAttributesRendered(prev => !prev),
|
|
155
|
+
type: ButtonType.Secondary,
|
|
156
|
+
testID: concatTestID(testID, 'showAllAttributesButton'),
|
|
157
|
+
title: isExpanded ? showLessButtonLabel : showAllButtonLabel
|
|
158
|
+
})))), footerView ? /*#__PURE__*/React.createElement(View, {
|
|
148
159
|
style: styles.footer
|
|
149
160
|
}, footerView) : null);
|
|
150
161
|
};
|
|
@@ -154,6 +165,9 @@ const styles = StyleSheet.create({
|
|
|
154
165
|
paddingHorizontal: 4,
|
|
155
166
|
width: '100%'
|
|
156
167
|
},
|
|
168
|
+
allAttributesWrapperWithButton: {
|
|
169
|
+
paddingBottom: 0
|
|
170
|
+
},
|
|
157
171
|
allAttributesWrapperWithFooter: {
|
|
158
172
|
paddingBottom: 0
|
|
159
173
|
},
|
|
@@ -163,8 +177,10 @@ const styles = StyleSheet.create({
|
|
|
163
177
|
},
|
|
164
178
|
buttonWrapper: {
|
|
165
179
|
height: SEE_ALL_BUTTON_HEIGHT,
|
|
180
|
+
justifyContent: 'flex-end',
|
|
166
181
|
paddingBottom: 12,
|
|
167
182
|
paddingHorizontal: 4,
|
|
183
|
+
paddingTop: 0,
|
|
168
184
|
width: '100%'
|
|
169
185
|
},
|
|
170
186
|
card: {
|
|
@@ -179,6 +195,9 @@ const styles = StyleSheet.create({
|
|
|
179
195
|
footer: {
|
|
180
196
|
marginTop: 12
|
|
181
197
|
},
|
|
198
|
+
hidden: {
|
|
199
|
+
display: 'none'
|
|
200
|
+
},
|
|
182
201
|
previewAttributesWrapper: {
|
|
183
202
|
paddingHorizontal: 4,
|
|
184
203
|
width: '100%'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useMemo","useState","StyleSheet","View","Animated","useAnimatedStyle","useSharedValue","withTiming","concatTestID","Button","ButtonType","DownIcon","UpIcon","useAppColorScheme","CredentialAttributeItem","CredentialCard","CredentialCardRatio","PREVIEW_ATTRIBUTES_COUNT","SEE_ALL_BUTTON_HEIGHT","CredentialDetailsCard","animate","attributes","card","expanded","footer","onImagePreview","onAttributeSelected","style","showAllButtonLabel","testID","viewProps","_header$accessory","colorScheme","previewAttributesHeight","setPreviewAttributesHeight","fullAttributesHeight","setFullAttributesHeight","allAttributesRendered","setAllAttributesRendered","length","CaretIcon","cardHeight","Math","ceil","width","currentHeight","undefined","animatedHeightSet","setAnimatedHeightSet","previewAttributes","slice","extraAttributes","viewStyle","flatten","styles","allAttributesWrapper","allAttributesWrapperWithFooter","padding","paddingBottom","buttonViewHeight","additionalAttributesHeight","additionalHeight","fullHeight","value","newHeight","duration","animatedStyle","height","onPreviewAttrContentLayout","event","nativeEvent","layout","onFullAttrContentLayout","footerView","isValidElement","FooterComponent","createElement","header","cardProps","renderExtraAttributes","ContainerComponent","_extends","detailsCard","backgroundColor","white","accessory","onHeaderPress","attributesWrapper","onLayout","previewAttributesWrapper","map","attribute","idx","key","id","last","toString","onPress","buttonWrapper","type","Secondary","title","index","create","paddingHorizontal","paddingTop","borderRadius","borderWidth","overflow","marginTop"],"sources":["credential-details-card.tsx"],"sourcesContent":["import React, { ComponentType, FC, ReactElement, useCallback, useEffect, useMemo, useState } from 'react';\nimport { ImageSourcePropType, LayoutChangeEvent, StyleSheet, View, ViewProps } from 'react-native';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\n\nimport { concatTestID } from '../../../utils/testID';\nimport { Button, ButtonType } from '../../buttons';\nimport { DownIcon, UpIcon } from '../../icons/credential';\nimport { useAppColorScheme } from '../../theme/color-scheme-context';\nimport CredentialAttributeItem, { CredentialAttribute } from '../credential-attribute-item';\nimport CredentialCard, { CredentialCardProps, CredentialCardRatio } from './credential-card';\n\nexport type CredentialDetailsCardProps = ViewProps & {\n animate?: boolean;\n attributes: CredentialAttribute[] | false;\n card: CredentialCardProps;\n expanded?: boolean;\n footer?: ComponentType<any> | ReactElement;\n onImagePreview?: (name: string, image: ImageSourcePropType) => void;\n onAttributeSelected?: (id: string, selected: boolean) => void;\n showAllButtonLabel?: string;\n};\n\nconst PREVIEW_ATTRIBUTES_COUNT = 3;\nconst SEE_ALL_BUTTON_HEIGHT = 78;\n\nconst CredentialDetailsCard: FC<CredentialDetailsCardProps> = ({\n animate = true,\n attributes,\n card,\n expanded,\n footer,\n onImagePreview,\n onAttributeSelected,\n style,\n showAllButtonLabel,\n testID,\n ...viewProps\n}) => {\n const colorScheme = useAppColorScheme();\n const [previewAttributesHeight, setPreviewAttributesHeight] = useState<number>();\n const [fullAttributesHeight, setFullAttributesHeight] = useState<number>();\n\n const [allAttributesRendered, setAllAttributesRendered] = useState<boolean>(\n (attributes && attributes.length <= PREVIEW_ATTRIBUTES_COUNT) || !showAllButtonLabel,\n );\n\n const CaretIcon = expanded ? UpIcon : DownIcon;\n\n const cardHeight = Math.ceil(card.width / CredentialCardRatio);\n const currentHeight = useSharedValue<number | undefined>(undefined);\n const [animatedHeightSet, setAnimatedHeightSet] = useState(false);\n\n const previewAttributes = attributes ? attributes.slice(0, PREVIEW_ATTRIBUTES_COUNT) : [];\n const extraAttributes = useMemo(() => (attributes ? attributes.slice(PREVIEW_ATTRIBUTES_COUNT) : []), [attributes]);\n\n useEffect(() => {\n if (extraAttributes.length === 0) {\n const viewStyle = StyleSheet.flatten([\n styles.allAttributesWrapper,\n footer && styles.allAttributesWrapperWithFooter,\n ]);\n const padding = viewStyle.paddingBottom;\n setFullAttributesHeight(padding);\n }\n }, [extraAttributes, footer]);\n\n useEffect(() => {\n if (previewAttributesHeight === undefined) {\n return;\n }\n if (allAttributesRendered && fullAttributesHeight === undefined) {\n return;\n }\n\n const buttonViewHeight = !extraAttributes || allAttributesRendered ? 0 : SEE_ALL_BUTTON_HEIGHT;\n const additionalAttributesHeight = fullAttributesHeight ?? 0;\n const additionalHeight = allAttributesRendered ? additionalAttributesHeight : buttonViewHeight;\n const fullHeight = previewAttributesHeight + additionalHeight;\n\n setAnimatedHeightSet(true);\n if (!animate) {\n currentHeight.value = fullHeight;\n return;\n }\n\n const newHeight = expanded ? fullHeight : 0;\n\n if (currentHeight.value === undefined || !animate) {\n currentHeight.value = newHeight;\n return;\n }\n\n const duration = fullHeight / 5;\n currentHeight.value = withTiming(newHeight, {\n duration,\n });\n }, [\n allAttributesRendered,\n currentHeight,\n animate,\n expanded,\n extraAttributes,\n fullAttributesHeight,\n previewAttributes.length,\n previewAttributesHeight,\n ]);\n\n const animatedStyle = useAnimatedStyle(() => {\n if (currentHeight.value === undefined) {\n if (expanded) {\n return {};\n }\n return {\n height: cardHeight,\n };\n }\n return {\n height: cardHeight + currentHeight.value,\n };\n }, [expanded, currentHeight]);\n\n const onPreviewAttrContentLayout = useCallback((event: LayoutChangeEvent) => {\n setPreviewAttributesHeight(event.nativeEvent.layout.height);\n }, []);\n\n const onFullAttrContentLayout = useCallback((event: LayoutChangeEvent) => {\n setFullAttributesHeight(event.nativeEvent.layout.height);\n }, []);\n\n const footerView: ReactElement | undefined = useMemo(() => {\n if (!footer) {\n return undefined;\n }\n if (React.isValidElement(footer)) {\n return footer;\n } else {\n const FooterComponent = footer as React.ComponentType<any>;\n return <FooterComponent />;\n }\n }, [footer]);\n\n const { header, ...cardProps } = card;\n\n const renderExtraAttributes = allAttributesRendered || (previewAttributesHeight !== undefined && animatedHeightSet);\n\n const ContainerComponent = animate ? Animated.View : View;\n return (\n <ContainerComponent\n style={[styles.detailsCard, { backgroundColor: colorScheme.white }, animate ? animatedStyle : undefined, style]}\n {...viewProps}\n testID={concatTestID(card.testID, expanded ? 'expanded' : 'collapsed')}>\n <CredentialCard\n {...cardProps}\n header={{ ...header, accessory: header.accessory ?? (cardProps.onHeaderPress ? CaretIcon : undefined) }}\n style={[styles.card, cardProps.style]}\n />\n {previewAttributes.length > 0 && (\n <View>\n <View style={styles.attributesWrapper}>\n <View onLayout={onPreviewAttrContentLayout} style={styles.previewAttributesWrapper}>\n {previewAttributes.map((attribute, idx) => (\n <CredentialAttributeItem\n key={attribute.id}\n last={!footerView && !extraAttributes.length && idx === previewAttributes.length - 1}\n testID={concatTestID(testID, 'attribute', idx.toString())}\n onImagePreview={onImagePreview}\n onPress={onAttributeSelected}\n {...attribute}\n />\n ))}\n </View>\n {!allAttributesRendered && extraAttributes.length > 0 && (\n <View style={styles.buttonWrapper}>\n <Button\n onPress={() => setAllAttributesRendered(true)}\n type={ButtonType.Secondary}\n testID={concatTestID(testID, 'showAllAttributesButton')}\n title={showAllButtonLabel!}\n />\n </View>\n )}\n {renderExtraAttributes && (\n <View\n style={[styles.allAttributesWrapper, footerView && styles.allAttributesWrapperWithFooter]}\n onLayout={onFullAttrContentLayout}>\n {extraAttributes.map((attribute, index, { length }) => (\n <CredentialAttributeItem\n key={attribute.id}\n last={!footerView && index === length - 1}\n testID={concatTestID(testID, 'attribute', index.toString())}\n onImagePreview={onImagePreview}\n onPress={onAttributeSelected}\n {...attribute}\n />\n ))}\n </View>\n )}\n </View>\n </View>\n )}\n {footerView ? <View style={styles.footer}>{footerView}</View> : null}\n </ContainerComponent>\n );\n};\n\nconst styles = StyleSheet.create({\n allAttributesWrapper: {\n paddingBottom: 12,\n paddingHorizontal: 4,\n width: '100%',\n },\n allAttributesWrapperWithFooter: {\n paddingBottom: 0,\n },\n attributesWrapper: {\n paddingTop: 7,\n width: '100%',\n },\n buttonWrapper: {\n height: SEE_ALL_BUTTON_HEIGHT,\n paddingBottom: 12,\n paddingHorizontal: 4,\n width: '100%',\n },\n card: {\n borderRadius: 0,\n borderWidth: 0,\n },\n detailsCard: {\n borderRadius: 10,\n borderWidth: 0,\n overflow: 'hidden',\n },\n footer: {\n marginTop: 12,\n },\n previewAttributesWrapper: {\n paddingHorizontal: 4,\n width: '100%',\n },\n});\n\nexport default CredentialDetailsCard;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAqCC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACzG,SAAiDC,UAAU,EAAEC,IAAI,QAAmB,cAAc;AAClG,OAAOC,QAAQ,IAAIC,gBAAgB,EAAEC,cAAc,EAAEC,UAAU,QAAQ,yBAAyB;AAEhG,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,MAAM,EAAEC,UAAU,QAAQ,eAAe;AAClD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,wBAAwB;AACzD,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,OAAOC,uBAAuB,MAA+B,8BAA8B;AAC3F,OAAOC,cAAc,IAAyBC,mBAAmB,QAAQ,mBAAmB;AAa5F,MAAMC,wBAAwB,GAAG,CAAC;AAClC,MAAMC,qBAAqB,GAAG,EAAE;AAEhC,MAAMC,qBAAqD,GAAGA,CAAC;EAC7DC,OAAO,GAAG,IAAI;EACdC,UAAU;EACVC,IAAI;EACJC,QAAQ;EACRC,MAAM;EACNC,cAAc;EACdC,mBAAmB;EACnBC,KAAK;EACLC,kBAAkB;EAClBC,MAAM;EACN,GAAGC;AACL,CAAC,KAAK;EAAA,IAAAC,iBAAA;EACJ,MAAMC,WAAW,GAAGnB,iBAAiB,CAAC,CAAC;EACvC,MAAM,CAACoB,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGjC,QAAQ,CAAS,CAA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BG,aAAa,EAAE,EAAE;IACjB8C,iBAAiB,EAAE,CAAC;IACpB5D,KAAK,EAAE;EACT,CAAC;EACDY,8BAA8B,EAAE;IAC9BE,aAAa,EAAE;EACjB,CAAC;EACD6B,iBAAiB,EAAE;IACjBkB,UAAU,EAAE,CAAC;IACb7D,KAAK,EAAE;EACT,CAAC;EACDsD,aAAa,EAAE;IACb/B,MAAM,EAAEjD,qBAAqB;IAC7BwC,aAAa,EAAE,EAAE;IACjB8C,iBAAiB,EAAE,CAAC;IACpB5D,KAAK,EAAE;EACT,CAAC;EACDtB,IAAI,EAAE;IACJoF,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE;EACf,CAAC;EACDzB,WAAW,EAAE;IACXwB,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,CAAC;IACdC,QAAQ,EAAE;EACZ,CAAC;EACDpF,MAAM,EAAE;IACNqF,SAAS,EAAE;EACb,CAAC;EACDpB,wBAAwB,EAAE;IACxBe,iBAAiB,EAAE,CAAC;IACpB5D,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,eAAezB,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","useState","StyleSheet","View","Animated","useAnimatedStyle","useSharedValue","withTiming","concatTestID","Button","ButtonType","DownIcon","UpIcon","useAppColorScheme","CredentialAttributeItem","CredentialCard","CredentialCardRatio","PREVIEW_ATTRIBUTES_COUNT","SEE_ALL_BUTTON_HEIGHT","CredentialDetailsCard","animate","attributes","card","expanded","footer","onImagePreview","onAttributeSelected","style","showAllButtonLabel","showLessButtonLabel","moreLabel","lessLabel","testID","viewProps","_header$accessory","colorScheme","previewAttributesHeight","setPreviewAttributesHeight","fullAttributesHeight","setFullAttributesHeight","allAttributesRendered","setAllAttributesRendered","length","CaretIcon","cardHeight","Math","ceil","width","currentHeight","undefined","animatedHeightSet","setAnimatedHeightSet","previewAttributes","slice","extraAttributes","showSeeAllButton","isExpanded","viewStyle","flatten","styles","allAttributesWrapper","allAttributesWrapperWithFooter","padding","paddingBottom","buttonViewHeight","additionalAttributesHeight","additionalHeight","fullHeight","value","newHeight","duration","animatedStyle","height","onPreviewAttrContentLayout","event","nativeEvent","layout","onFullAttrContentLayout","footerView","isValidElement","FooterComponent","createElement","header","cardProps","renderExtraAttributes","ContainerComponent","_extends","detailsCard","backgroundColor","white","accessory","onHeaderPress","attributesWrapper","onLayout","previewAttributesWrapper","map","attribute","idx","key","id","last","toString","onPress","allAttributesWrapperWithButton","hidden","index","buttonWrapper","prev","type","Secondary","title","create","paddingHorizontal","paddingTop","justifyContent","borderRadius","borderWidth","overflow","marginTop","display"],"sources":["credential-details-card.tsx"],"sourcesContent":["import React, { ComponentType, FC, ReactElement, useCallback, useEffect, useMemo, useState } from 'react';\nimport { ImageSourcePropType, LayoutChangeEvent, StyleSheet, View, ViewProps } from 'react-native';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\n\nimport { concatTestID } from '../../../utils/testID';\nimport { Button, ButtonType } from '../../buttons';\nimport { DownIcon, UpIcon } from '../../icons/credential';\nimport { useAppColorScheme } from '../../theme/color-scheme-context';\nimport CredentialAttributeItem, { CredentialAttribute } from '../credential-attribute-item';\nimport CredentialCard, { CredentialCardProps, CredentialCardRatio } from './credential-card';\n\nexport type CredentialDetailsCardProps = ViewProps & {\n animate?: boolean;\n attributes: CredentialAttribute[] | false;\n card: CredentialCardProps;\n expanded?: boolean;\n footer?: ComponentType<any> | ReactElement;\n onImagePreview?: (name: string, image: ImageSourcePropType) => void;\n onAttributeSelected?: (id: string, selected: boolean) => void;\n showAllButtonLabel?: string;\n showLessButtonLabel?: string;\n moreLabel?: string;\n lessLabel?: string;\n};\n\nconst PREVIEW_ATTRIBUTES_COUNT = 3;\nconst SEE_ALL_BUTTON_HEIGHT = 78;\n\nconst CredentialDetailsCard: FC<CredentialDetailsCardProps> = ({\n animate = true,\n attributes,\n card,\n expanded,\n footer,\n onImagePreview,\n onAttributeSelected,\n style,\n showAllButtonLabel = 'Show all',\n showLessButtonLabel = 'Show less',\n moreLabel = 'More',\n lessLabel = 'Less',\n testID,\n ...viewProps\n}) => {\n const colorScheme = useAppColorScheme();\n const [previewAttributesHeight, setPreviewAttributesHeight] = useState<number>();\n const [fullAttributesHeight, setFullAttributesHeight] = useState<number>();\n\n const [allAttributesRendered, setAllAttributesRendered] = useState<boolean>(\n (attributes && attributes.length <= PREVIEW_ATTRIBUTES_COUNT) || !showAllButtonLabel,\n );\n const CaretIcon = expanded ? UpIcon : DownIcon;\n const cardHeight = Math.ceil(card.width / CredentialCardRatio);\n const currentHeight = useSharedValue<number | undefined>(undefined);\n const [animatedHeightSet, setAnimatedHeightSet] = useState(false);\n const previewAttributes = attributes ? attributes.slice(0, PREVIEW_ATTRIBUTES_COUNT) : [];\n const extraAttributes = useMemo(() => (attributes ? attributes.slice(PREVIEW_ATTRIBUTES_COUNT) : []), [attributes]);\n const showSeeAllButton = extraAttributes.length > 0;\n const isExpanded = allAttributesRendered;\n\n useEffect(() => {\n if (extraAttributes.length === 0) {\n const viewStyle = StyleSheet.flatten([\n styles.allAttributesWrapper,\n footer && styles.allAttributesWrapperWithFooter,\n ]);\n const padding = viewStyle.paddingBottom;\n setFullAttributesHeight(padding);\n }\n }, [extraAttributes, footer]);\n\n useEffect(() => {\n if (previewAttributesHeight === undefined) {\n return;\n }\n if (allAttributesRendered && fullAttributesHeight === undefined) {\n return;\n }\n\n const buttonViewHeight = showSeeAllButton ? SEE_ALL_BUTTON_HEIGHT : 0;\n const additionalAttributesHeight = fullAttributesHeight ?? 0;\n const additionalHeight = allAttributesRendered ? additionalAttributesHeight + buttonViewHeight : buttonViewHeight;\n const fullHeight = previewAttributesHeight + additionalHeight;\n\n setAnimatedHeightSet(true);\n if (!animate) {\n currentHeight.value = fullHeight;\n return;\n }\n\n const newHeight = expanded ? fullHeight : 0;\n\n if (currentHeight.value === undefined || !animate) {\n currentHeight.value = newHeight;\n return;\n }\n\n const duration = fullHeight / 5;\n currentHeight.value = withTiming(newHeight, {\n duration,\n });\n }, [\n allAttributesRendered,\n currentHeight,\n animate,\n expanded,\n extraAttributes,\n fullAttributesHeight,\n previewAttributes.length,\n previewAttributesHeight,\n showSeeAllButton,\n ]);\n\n const animatedStyle = useAnimatedStyle(() => {\n if (currentHeight.value === undefined) {\n if (expanded) {\n return {};\n }\n return {\n height: cardHeight,\n };\n }\n return {\n height: cardHeight + currentHeight.value,\n };\n }, [expanded, currentHeight]);\n\n const onPreviewAttrContentLayout = useCallback((event: LayoutChangeEvent) => {\n setPreviewAttributesHeight(event.nativeEvent.layout.height);\n }, []);\n\n const onFullAttrContentLayout = useCallback((event: LayoutChangeEvent) => {\n setFullAttributesHeight(event.nativeEvent.layout.height);\n }, []);\n\n const footerView: ReactElement | undefined = useMemo(() => {\n if (!footer) {\n return undefined;\n }\n if (React.isValidElement(footer)) {\n return footer;\n } else {\n const FooterComponent = footer as React.ComponentType<any>;\n return <FooterComponent />;\n }\n }, [footer]);\n\n const { header, ...cardProps } = card;\n\n const renderExtraAttributes = allAttributesRendered || (previewAttributesHeight !== undefined && animatedHeightSet);\n\n const ContainerComponent = animate ? Animated.View : View;\n return (\n <ContainerComponent\n style={[styles.detailsCard, { backgroundColor: colorScheme.white }, animate ? animatedStyle : undefined, style]}\n {...viewProps}\n testID={concatTestID(card.testID, expanded ? 'expanded' : 'collapsed')}>\n <CredentialCard\n {...cardProps}\n header={{ ...header, accessory: header.accessory ?? (cardProps.onHeaderPress ? CaretIcon : undefined) }}\n style={[styles.card, cardProps.style]}\n />\n {previewAttributes.length > 0 && (\n <View>\n <View style={styles.attributesWrapper}>\n <View onLayout={onPreviewAttrContentLayout} style={styles.previewAttributesWrapper}>\n {previewAttributes.map((attribute, idx) => (\n <CredentialAttributeItem\n moreLabel={moreLabel}\n lessLabel={lessLabel}\n key={attribute.id}\n last={!footerView && !showSeeAllButton && idx === previewAttributes.length - 1}\n testID={concatTestID(testID, 'attribute', idx.toString())}\n onImagePreview={onImagePreview}\n onPress={onAttributeSelected}\n isExpanded={isExpanded}\n {...attribute}\n />\n ))}\n </View>\n\n {renderExtraAttributes && (\n <View\n style={[\n styles.allAttributesWrapper,\n footerView && styles.allAttributesWrapperWithFooter,\n showSeeAllButton && styles.allAttributesWrapperWithButton,\n !allAttributesRendered && styles.hidden,\n ]}\n onLayout={onFullAttrContentLayout}>\n {extraAttributes.map((attribute, index, { length }) => (\n <CredentialAttributeItem\n moreLabel={moreLabel}\n lessLabel={lessLabel}\n key={attribute.id}\n last={!footerView && !showSeeAllButton && index === length - 1}\n testID={concatTestID(testID, 'attribute', index.toString())}\n onImagePreview={onImagePreview}\n onPress={onAttributeSelected}\n isExpanded={isExpanded}\n {...attribute}\n />\n ))}\n </View>\n )}\n\n {showSeeAllButton && (\n <View style={styles.buttonWrapper}>\n <Button\n onPress={() => setAllAttributesRendered((prev) => !prev)}\n type={ButtonType.Secondary}\n testID={concatTestID(testID, 'showAllAttributesButton')}\n title={isExpanded ? showLessButtonLabel : showAllButtonLabel}\n />\n </View>\n )}\n </View>\n </View>\n )}\n {footerView ? <View style={styles.footer}>{footerView}</View> : null}\n </ContainerComponent>\n );\n};\n\nconst styles = StyleSheet.create({\n allAttributesWrapper: {\n paddingBottom: 12,\n paddingHorizontal: 4,\n width: '100%',\n },\n allAttributesWrapperWithButton: {\n paddingBottom: 0,\n },\n allAttributesWrapperWithFooter: {\n paddingBottom: 0,\n },\n attributesWrapper: {\n paddingTop: 7,\n width: '100%',\n },\n buttonWrapper: {\n height: SEE_ALL_BUTTON_HEIGHT,\n justifyContent: 'flex-end',\n paddingBottom: 12,\n paddingHorizontal: 4,\n paddingTop: 0,\n width: '100%',\n },\n card: {\n borderRadius: 0,\n borderWidth: 0,\n },\n detailsCard: {\n borderRadius: 10,\n borderWidth: 0,\n overflow: 'hidden',\n },\n footer: {\n marginTop: 12,\n },\n hidden: {\n display: 'none',\n },\n previewAttributesWrapper: {\n paddingHorizontal: 4,\n width: '100%',\n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,KAAK,EAAEgC,MAAM,CAACnC;EAAO,GAAEsD,UAAiB,CAAC,GAAG,IAC9C,CAAC;AAEzB,CAAC;AAED,MAAMnB,MAAM,GAAGzD,UAAU,CAAC6G,MAAM,CAAC;EAC/BnD,oBAAoB,EAAE;IACpBG,aAAa,EAAE,EAAE;IACjBiD,iBAAiB,EAAE,CAAC;IACpBjE,KAAK,EAAE;EACT,CAAC;EACDwD,8BAA8B,EAAE;IAC9BxC,aAAa,EAAE;EACjB,CAAC;EACDF,8BAA8B,EAAE;IAC9BE,aAAa,EAAE;EACjB,CAAC;EACD6B,iBAAiB,EAAE;IACjBqB,UAAU,EAAE,CAAC;IACblE,KAAK,EAAE;EACT,CAAC;EACD2D,aAAa,EAAE;IACblC,MAAM,EAAEtD,qBAAqB;IAC7BgG,cAAc,EAAE,UAAU;IAC1BnD,aAAa,EAAE,EAAE;IACjBiD,iBAAiB,EAAE,CAAC;IACpBC,UAAU,EAAE,CAAC;IACblE,KAAK,EAAE;EACT,CAAC;EACDzB,IAAI,EAAE;IACJ6F,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE;EACf,CAAC;EACD7B,WAAW,EAAE;IACX4B,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,CAAC;IACdC,QAAQ,EAAE;EACZ,CAAC;EACD7F,MAAM,EAAE;IACN8F,SAAS,EAAE;EACb,CAAC;EACDd,MAAM,EAAE;IACNe,OAAO,EAAE;EACX,CAAC;EACDzB,wBAAwB,EAAE;IACxBkB,iBAAiB,EAAE,CAAC;IACpBjE,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,eAAe5B,qBAAqB","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import { Image, StyleSheet, View } from 'react-native';
|
|
|
4
4
|
import { colorWithAlphaComponent } from '../../utils/color';
|
|
5
5
|
import { concatTestID } from '../../utils/testID';
|
|
6
6
|
import { TouchableHighlight, TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';
|
|
7
|
+
import ExpandableTypography from '../text/expandableTypography';
|
|
7
8
|
import Typography from '../text/typography';
|
|
8
9
|
import { useAppColorScheme } from '../theme/color-scheme-context';
|
|
9
10
|
const CredentialAttributeItemButton = ({
|
|
@@ -60,7 +61,10 @@ const CredentialAttributeItem = ({
|
|
|
60
61
|
testID,
|
|
61
62
|
value,
|
|
62
63
|
values,
|
|
63
|
-
valueErrorColor
|
|
64
|
+
valueErrorColor,
|
|
65
|
+
isExpanded,
|
|
66
|
+
moreLabel,
|
|
67
|
+
lessLabel
|
|
64
68
|
}) => {
|
|
65
69
|
const colorScheme = useAppColorScheme();
|
|
66
70
|
const imagePreviewHandler = useCallback(() => {
|
|
@@ -125,11 +129,15 @@ const CredentialAttributeItem = ({
|
|
|
125
129
|
testID: concatTestID(testID, 'image'),
|
|
126
130
|
source: image,
|
|
127
131
|
style: styles.dataItemImage
|
|
128
|
-
})), value && /*#__PURE__*/React.createElement(
|
|
132
|
+
})), value && /*#__PURE__*/React.createElement(ExpandableTypography, {
|
|
129
133
|
color: valueErrorColor ? colorScheme.error : colorScheme.text,
|
|
130
|
-
numberOfLines:
|
|
134
|
+
numberOfLines: 3,
|
|
135
|
+
ellipsizeMode: "tail",
|
|
131
136
|
preset: "s",
|
|
137
|
+
hideExpandButton: !isExpanded && !listValue && !nested,
|
|
132
138
|
style: listValue ? styles.listValue : undefined,
|
|
139
|
+
moreLabel: moreLabel,
|
|
140
|
+
lessLabel: lessLabel,
|
|
133
141
|
testID: concatTestID(testID, 'value')
|
|
134
142
|
}, value), isObject && attributes.map((attribute, index, {
|
|
135
143
|
length
|
|
@@ -160,7 +168,8 @@ const CredentialAttributeItem = ({
|
|
|
160
168
|
const styles = StyleSheet.create({
|
|
161
169
|
attributeItem: {
|
|
162
170
|
flex: 1,
|
|
163
|
-
paddingLeft: 8
|
|
171
|
+
paddingLeft: 8,
|
|
172
|
+
paddingRight: 8
|
|
164
173
|
},
|
|
165
174
|
attributeItemContainer: {
|
|
166
175
|
marginTop: 2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useMemo","Image","StyleSheet","View","colorWithAlphaComponent","concatTestID","TouchableHighlight","TouchableOpacity","Typography","useAppColorScheme","CredentialAttributeItemButton","children","disabled","id","onPress","selected","colorScheme","pressHandler","createElement","style","styles","touchableAttribute","activeOpacity","backgroundColor","background","underlayColor","IMAGE_SIZE","CredentialAttributeItem","attributes","image","last","name","onImagePreview","rightAccessory","nested","listValue","testID","value","values","valueErrorColor","imagePreviewHandler","rightAccessoryView","undefined","isValidElement","RightAccessoryComponent","isObject","length","isArray","attributeItemContainer","attributeItemRow","dataItemButtonChildren","decorator","decoratorCircle","listDecoratorCircle","listImageDecoratorCircle","text","decoratorCircleInner","borderColor","decoratorLine","listDecoratorLine","listStringValueDecoratorLine","listImageDecoratorLine","objectAttributeItem","attributeItem","nestedAttributeItem","color","preset","nestedObjectLabel","dataItemLabel","dataItemImageWrapper","resizeMode","source","dataItemImage","error","numberOfLines","map","attribute","index","_extends","key","arrayValue","objectAccessory","separator","create","flex","paddingLeft","marginTop","flexDirection","alignItems","height","width","borderRadius","borderWidth","overflow","marginBottom","opacity","justifyContent","left","position","top","bottom","marginLeft","paddingVertical","alignSelf","paddingHorizontal","right","marginHorizontal"],"sources":["credential-attribute-item.tsx"],"sourcesContent":["import React, { ComponentType, FC, PropsWithChildren, ReactElement, useCallback, useMemo } from 'react';\nimport { Image, ImageSourcePropType, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport { colorWithAlphaComponent } from '../../utils/color';\nimport { concatTestID } from '../../utils/testID';\nimport { TouchableHighlight, TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';\nimport Typography from '../text/typography';\nimport { useAppColorScheme } from '../theme/color-scheme-context';\n\ntype CredentialAttributeItemButtonProps = {\n disabled?: boolean;\n id: string;\n onPress?: (id: string, selected: boolean) => void;\n selected?: boolean;\n};\n\nconst CredentialAttributeItemButton: FC<PropsWithChildren<CredentialAttributeItemButtonProps>> = ({\n children,\n disabled,\n id,\n onPress,\n selected,\n}) => {\n const colorScheme = useAppColorScheme();\n\n const pressHandler = useCallback(() => {\n if (!onPress) {\n return;\n }\n onPress(id, !selected);\n }, [onPress, id, selected]);\n\n if (!onPress) {\n return <View style={styles.touchableAttribute}>{children}</View>;\n }\n\n if (selected) {\n return (\n <TouchableOpacity\n activeOpacity={0.8}\n disabled={disabled}\n onPress={pressHandler}\n style={[styles.touchableAttribute, { backgroundColor: colorScheme.background }]}>\n {children}\n </TouchableOpacity>\n );\n }\n\n return (\n <TouchableHighlight\n disabled={disabled}\n onPress={pressHandler}\n underlayColor={colorWithAlphaComponent(colorScheme.background, 0.5)}\n style={styles.touchableAttribute}>\n {children}\n </TouchableHighlight>\n );\n};\n\nconst IMAGE_SIZE = 64;\n\nexport type CredentialAttributeValue =\n | {\n attributes: CredentialAttribute[];\n image?: never;\n value?: never;\n values?: never;\n valueErrorColor?: never;\n testID?: string;\n }\n | {\n attributes?: never;\n image: ImageSourcePropType;\n value?: never;\n values?: never;\n valueErrorColor?: never;\n testID?: string;\n }\n | {\n attributes?: never;\n image?: never;\n value: string;\n values?: never;\n valueErrorColor?: boolean;\n testID?: string;\n }\n | {\n attributes?: never;\n image?: never;\n value?: never;\n values: CredentialAttribute[];\n valueErrorColor?: boolean;\n testID?: string;\n };\n\nexport type CredentialAttribute = CredentialAttributeValue & {\n disabled?: boolean;\n selected?: boolean;\n nested?: boolean;\n listValue?: boolean;\n id: string;\n name?: string;\n path: string;\n rightAccessory?: ComponentType<any> | ReactElement;\n};\n\nexport type CredentialAttributeItemProps = CredentialAttribute & {\n last: boolean | undefined;\n onImagePreview?: (name: string, image: ImageSourcePropType) => void;\n onPress?: (id: string, selected: boolean) => void;\n style?: StyleProp<ViewStyle>;\n};\n\nconst CredentialAttributeItem: FC<CredentialAttributeItemProps> = ({\n attributes,\n disabled,\n id,\n image,\n last,\n name,\n onImagePreview,\n onPress,\n rightAccessory,\n nested = false,\n listValue = false,\n selected,\n style,\n testID,\n value,\n values,\n valueErrorColor,\n}) => {\n const colorScheme = useAppColorScheme();\n\n const imagePreviewHandler = useCallback(() => {\n if (!onImagePreview || !image) {\n return;\n }\n onImagePreview(name ?? '', image);\n }, [image, name, onImagePreview]);\n\n const rightAccessoryView: React.ReactElement | undefined = useMemo(() => {\n if (!rightAccessory) {\n return undefined;\n }\n if (React.isValidElement(rightAccessory)) {\n return rightAccessory;\n } else {\n const RightAccessoryComponent = rightAccessory as React.ComponentType<any>;\n return <RightAccessoryComponent />;\n }\n }, [rightAccessory]);\n\n const isObject = attributes && attributes.length > 0;\n const isArray = values && values.length > 0;\n\n return (\n <View style={[!nested && styles.attributeItemContainer, style]} testID={testID}>\n <View style={styles.attributeItemRow}>\n <CredentialAttributeItemButton disabled={disabled} id={id} onPress={onPress} selected={selected}>\n <View style={[styles.dataItemButtonChildren]}>\n {(isObject || isArray || listValue) && (\n <View style={styles.decorator}>\n <View\n style={[\n styles.decoratorCircle,\n listValue ? styles.listDecoratorCircle : undefined,\n listValue && image ? styles.listImageDecoratorCircle : undefined,\n { backgroundColor: colorScheme.text },\n ]}>\n <View\n style={[\n styles.decoratorCircleInner,\n { backgroundColor: colorScheme.text, borderColor: colorScheme.background },\n ]}\n />\n </View>\n <View\n style={[\n styles.decoratorLine,\n listValue ? styles.listDecoratorLine : undefined,\n listValue && value ? styles.listStringValueDecoratorLine : undefined,\n listValue && image ? styles.listImageDecoratorLine : undefined,\n { backgroundColor: colorScheme.text },\n ]}\n />\n </View>\n )}\n <View\n style={[\n isObject || isArray || listValue ? styles.objectAttributeItem : styles.attributeItem,\n nested && styles.nestedAttributeItem,\n ]}>\n {name && (\n <Typography\n color={colorScheme.text}\n preset={image ? 'xs' : 'xs/line-height-small'}\n style={isObject || isArray ? styles.nestedObjectLabel : styles.dataItemLabel}\n testID={concatTestID(testID, 'title')}>\n {name}\n </Typography>\n )}\n {image && (\n <TouchableOpacity\n disabled={!onImagePreview}\n onPress={imagePreviewHandler}\n style={[styles.dataItemImageWrapper, listValue ? styles.listValue : undefined]}>\n <Image\n resizeMode=\"cover\"\n testID={concatTestID(testID, 'image')}\n source={image}\n style={styles.dataItemImage}\n />\n </TouchableOpacity>\n )}\n {value && (\n <Typography\n color={valueErrorColor ? colorScheme.error : colorScheme.text}\n numberOfLines={10}\n preset=\"s\"\n style={listValue ? styles.listValue : undefined}\n testID={concatTestID(testID, 'value')}>\n {value}\n </Typography>\n )}\n {isObject &&\n attributes.map((attribute, index, { length }) => (\n <CredentialAttributeItem\n nested={true}\n key={attribute.id}\n onPress={onPress}\n last={index === length - 1}\n onImagePreview={onImagePreview}\n {...attribute}\n />\n ))}\n {isArray &&\n values.map((arrayValue, index, { length }) => (\n <CredentialAttributeItem\n key={arrayValue.id}\n onPress={onPress}\n last={index === length - 1}\n onImagePreview={onImagePreview}\n listValue={true}\n {...arrayValue}\n name={undefined}\n />\n ))}\n <View />\n </View>\n {rightAccessoryView && (\n <View style={[styles.rightAccessory, isObject && styles.objectAccessory]}>{rightAccessoryView}</View>\n )}\n </View>\n </CredentialAttributeItemButton>\n </View>\n {!last && !nested && <View style={[styles.separator, { backgroundColor: colorScheme.background }]} />}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n attributeItem: {\n flex: 1,\n paddingLeft: 8,\n },\n attributeItemContainer: {\n marginTop: 2,\n },\n attributeItemRow: {\n flexDirection: 'row',\n },\n dataItemButtonChildren: {\n alignItems: 'center',\n flexDirection: 'row',\n },\n dataItemImage: {\n height: IMAGE_SIZE,\n width: IMAGE_SIZE,\n },\n dataItemImageWrapper: {\n borderColor: '#0004',\n borderRadius: 4,\n borderWidth: 0.5,\n height: IMAGE_SIZE,\n marginTop: 4,\n overflow: 'hidden',\n width: IMAGE_SIZE,\n },\n dataItemLabel: {\n marginBottom: 4,\n opacity: 0.7,\n },\n decorator: {\n height: '100%',\n justifyContent: 'center',\n left: 8,\n position: 'absolute',\n },\n decoratorCircle: {\n alignItems: 'center',\n borderRadius: 3.5,\n borderWidth: 1,\n height: 7,\n justifyContent: 'center',\n position: 'absolute',\n top: 6,\n width: 7,\n },\n decoratorCircleInner: {\n borderRadius: 2,\n borderWidth: 1,\n height: 4,\n width: 4,\n },\n decoratorLine: {\n bottom: 12,\n left: 3,\n position: 'absolute',\n top: 13,\n width: 1,\n },\n listDecoratorCircle: {\n top: 18,\n },\n listDecoratorLine: {\n top: 25,\n },\n listImageDecoratorCircle: {\n top: 32,\n },\n listImageDecoratorLine: {\n bottom: 40,\n top: 39,\n },\n listStringValueDecoratorLine: {\n bottom: 24,\n },\n listValue: {\n marginLeft: 13,\n paddingVertical: 10,\n },\n nestedAttributeItem: {\n paddingLeft: 12,\n },\n nestedObjectLabel: {\n opacity: 0.7,\n paddingLeft: 13,\n },\n objectAccessory: {\n alignSelf: 'flex-start',\n },\n objectAttributeItem: {\n alignItems: 'stretch',\n flex: 1,\n paddingLeft: 12,\n },\n rightAccessory: {\n paddingHorizontal: 8,\n position: 'absolute',\n right: 0,\n },\n separator: {\n height: 1,\n marginHorizontal: 8,\n marginTop: -1,\n },\n touchableAttribute: {\n borderRadius: 8,\n borderWidth: 0,\n flex: 1,\n paddingVertical: 11,\n },\n});\n\nexport default CredentialAttributeItem;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAwDC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACvG,SAASC,KAAK,EAAkCC,UAAU,EAAEC,IAAI,QAAmB,cAAc;AAEjG,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ,+CAA+C;AACpG,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,SAASC,iBAAiB,QAAQ,+BAA+B;AASjE,MAAMC,6BAAwF,GAAGA,CAAC;EAChGC,QAAQ;EACRC,QAAQ;EACRC,EAAE;EACFC,OAAO;EACPC;AACF,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGP,iBAAiB,CAAC,C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AE;IACjBwC,GAAG,EAAE;EACP,CAAC;EACD7C,wBAAwB,EAAE;IACxB6C,GAAG,EAAE;EACP,CAAC;EACDtC,sBAAsB,EAAE;IACtBuC,MAAM,EAAE,EAAE;IACVD,GAAG,EAAE;EACP,CAAC;EACDvC,4BAA4B,EAAE;IAC5BwC,MAAM,EAAE;EACV,CAAC;EACDjE,SAAS,EAAE;IACTkE,UAAU,EAAE,EAAE;IACdC,eAAe,EAAE;EACnB,CAAC;EACDtC,mBAAmB,EAAE;IACnBqB,WAAW,EAAE;EACf,CAAC;EACDlB,iBAAiB,EAAE;IACjB4B,OAAO,EAAE,GAAG;IACZV,WAAW,EAAE;EACf,CAAC;EACDJ,eAAe,EAAE;IACfsB,SAAS,EAAE;EACb,CAAC;EACDzC,mBAAmB,EAAE;IACnB0B,UAAU,EAAE,SAAS;IACrBJ,IAAI,EAAE,CAAC;IACPC,WAAW,EAAE;EACf,CAAC;EACDpD,cAAc,EAAE;IACduE,iBAAiB,EAAE,CAAC;IACpBN,QAAQ,EAAE,UAAU;IACpBO,KAAK,EAAE;EACT,CAAC;EACDvB,SAAS,EAAE;IACTO,MAAM,EAAE,CAAC;IACTiB,gBAAgB,EAAE,CAAC;IACnBpB,SAAS,EAAE,CAAC;EACd,CAAC;EACDjE,kBAAkB,EAAE;IAClBsE,YAAY,EAAE,CAAC;IACfC,WAAW,EAAE,CAAC;IACdR,IAAI,EAAE,CAAC;IACPkB,eAAe,EAAE;EACnB;AACF,CAAC,CAAC;AAEF,eAAe3E,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","Image","StyleSheet","View","colorWithAlphaComponent","concatTestID","TouchableHighlight","TouchableOpacity","ExpandableTypography","Typography","useAppColorScheme","CredentialAttributeItemButton","children","disabled","id","onPress","selected","colorScheme","pressHandler","createElement","style","styles","touchableAttribute","activeOpacity","backgroundColor","background","underlayColor","IMAGE_SIZE","CredentialAttributeItem","attributes","image","last","name","onImagePreview","rightAccessory","nested","listValue","testID","value","values","valueErrorColor","isExpanded","moreLabel","lessLabel","imagePreviewHandler","rightAccessoryView","undefined","isValidElement","RightAccessoryComponent","isObject","length","isArray","attributeItemContainer","attributeItemRow","dataItemButtonChildren","decorator","decoratorCircle","listDecoratorCircle","listImageDecoratorCircle","text","decoratorCircleInner","borderColor","decoratorLine","listDecoratorLine","listStringValueDecoratorLine","listImageDecoratorLine","objectAttributeItem","attributeItem","nestedAttributeItem","color","preset","nestedObjectLabel","dataItemLabel","dataItemImageWrapper","resizeMode","source","dataItemImage","error","numberOfLines","ellipsizeMode","hideExpandButton","map","attribute","index","_extends","key","arrayValue","objectAccessory","separator","create","flex","paddingLeft","paddingRight","marginTop","flexDirection","alignItems","height","width","borderRadius","borderWidth","overflow","marginBottom","opacity","justifyContent","left","position","top","bottom","marginLeft","paddingVertical","alignSelf","paddingHorizontal","right","marginHorizontal"],"sources":["credential-attribute-item.tsx"],"sourcesContent":["import React, { ComponentType, FC, PropsWithChildren, ReactElement, useCallback, useMemo } from 'react';\nimport { Image, ImageSourcePropType, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport { colorWithAlphaComponent } from '../../utils/color';\nimport { concatTestID } from '../../utils/testID';\nimport { TouchableHighlight, TouchableOpacity } from '../accessibility/accessibilityHistoryWrappers';\nimport ExpandableTypography from '../text/expandableTypography';\nimport Typography from '../text/typography';\nimport { useAppColorScheme } from '../theme/color-scheme-context';\n\ntype CredentialAttributeItemButtonProps = {\n disabled?: boolean;\n id: string;\n onPress?: (id: string, selected: boolean) => void;\n selected?: boolean;\n};\n\nconst CredentialAttributeItemButton: FC<PropsWithChildren<CredentialAttributeItemButtonProps>> = ({\n children,\n disabled,\n id,\n onPress,\n selected,\n}) => {\n const colorScheme = useAppColorScheme();\n\n const pressHandler = useCallback(() => {\n if (!onPress) {\n return;\n }\n onPress(id, !selected);\n }, [onPress, id, selected]);\n\n if (!onPress) {\n return <View style={styles.touchableAttribute}>{children}</View>;\n }\n\n if (selected) {\n return (\n <TouchableOpacity\n activeOpacity={0.8}\n disabled={disabled}\n onPress={pressHandler}\n style={[styles.touchableAttribute, { backgroundColor: colorScheme.background }]}>\n {children}\n </TouchableOpacity>\n );\n }\n\n return (\n <TouchableHighlight\n disabled={disabled}\n onPress={pressHandler}\n underlayColor={colorWithAlphaComponent(colorScheme.background, 0.5)}\n style={styles.touchableAttribute}>\n {children}\n </TouchableHighlight>\n );\n};\n\nconst IMAGE_SIZE = 64;\n\nexport type CredentialAttributeValue =\n | {\n attributes: CredentialAttribute[];\n image?: never;\n value?: never;\n values?: never;\n valueErrorColor?: never;\n testID?: string;\n }\n | {\n attributes?: never;\n image: ImageSourcePropType;\n value?: never;\n values?: never;\n valueErrorColor?: never;\n testID?: string;\n }\n | {\n attributes?: never;\n image?: never;\n value: string;\n values?: never;\n valueErrorColor?: boolean;\n testID?: string;\n }\n | {\n attributes?: never;\n image?: never;\n value?: never;\n values: CredentialAttribute[];\n valueErrorColor?: boolean;\n testID?: string;\n };\n\nexport type CredentialAttribute = CredentialAttributeValue & {\n disabled?: boolean;\n selected?: boolean;\n nested?: boolean;\n listValue?: boolean;\n id: string;\n name?: string;\n path: string;\n rightAccessory?: ComponentType<any> | ReactElement;\n};\n\nexport type CredentialAttributeItemProps = CredentialAttribute & {\n last: boolean | undefined;\n onImagePreview?: (name: string, image: ImageSourcePropType) => void;\n onPress?: (id: string, selected: boolean) => void;\n style?: StyleProp<ViewStyle>;\n isExpanded?: boolean;\n moreLabel?: string;\n lessLabel?: string;\n};\n\nconst CredentialAttributeItem: FC<CredentialAttributeItemProps> = ({\n attributes,\n disabled,\n id,\n image,\n last,\n name,\n onImagePreview,\n onPress,\n rightAccessory,\n nested = false,\n listValue = false,\n selected,\n style,\n testID,\n value,\n values,\n valueErrorColor,\n isExpanded,\n moreLabel,\n lessLabel,\n}) => {\n const colorScheme = useAppColorScheme();\n\n const imagePreviewHandler = useCallback(() => {\n if (!onImagePreview || !image) {\n return;\n }\n onImagePreview(name ?? '', image);\n }, [image, name, onImagePreview]);\n\n const rightAccessoryView: React.ReactElement | undefined = useMemo(() => {\n if (!rightAccessory) {\n return undefined;\n }\n if (React.isValidElement(rightAccessory)) {\n return rightAccessory;\n } else {\n const RightAccessoryComponent = rightAccessory as React.ComponentType<any>;\n return <RightAccessoryComponent />;\n }\n }, [rightAccessory]);\n\n const isObject = attributes && attributes.length > 0;\n const isArray = values && values.length > 0;\n\n return (\n <View style={[!nested && styles.attributeItemContainer, style]} testID={testID}>\n <View style={styles.attributeItemRow}>\n <CredentialAttributeItemButton disabled={disabled} id={id} onPress={onPress} selected={selected}>\n <View style={[styles.dataItemButtonChildren]}>\n {(isObject || isArray || listValue) && (\n <View style={styles.decorator}>\n <View\n style={[\n styles.decoratorCircle,\n listValue ? styles.listDecoratorCircle : undefined,\n listValue && image ? styles.listImageDecoratorCircle : undefined,\n { backgroundColor: colorScheme.text },\n ]}>\n <View\n style={[\n styles.decoratorCircleInner,\n { backgroundColor: colorScheme.text, borderColor: colorScheme.background },\n ]}\n />\n </View>\n <View\n style={[\n styles.decoratorLine,\n listValue ? styles.listDecoratorLine : undefined,\n listValue && value ? styles.listStringValueDecoratorLine : undefined,\n listValue && image ? styles.listImageDecoratorLine : undefined,\n { backgroundColor: colorScheme.text },\n ]}\n />\n </View>\n )}\n <View\n style={[\n isObject || isArray || listValue ? styles.objectAttributeItem : styles.attributeItem,\n nested && styles.nestedAttributeItem,\n ]}>\n {name && (\n <Typography\n color={colorScheme.text}\n preset={image ? 'xs' : 'xs/line-height-small'}\n style={isObject || isArray ? styles.nestedObjectLabel : styles.dataItemLabel}\n testID={concatTestID(testID, 'title')}>\n {name}\n </Typography>\n )}\n {image && (\n <TouchableOpacity\n disabled={!onImagePreview}\n onPress={imagePreviewHandler}\n style={[styles.dataItemImageWrapper, listValue ? styles.listValue : undefined]}>\n <Image\n resizeMode=\"cover\"\n testID={concatTestID(testID, 'image')}\n source={image}\n style={styles.dataItemImage}\n />\n </TouchableOpacity>\n )}\n {value && (\n <ExpandableTypography\n color={valueErrorColor ? colorScheme.error : colorScheme.text}\n numberOfLines={3}\n ellipsizeMode=\"tail\"\n preset=\"s\"\n hideExpandButton={!isExpanded && !listValue && !nested}\n style={listValue ? styles.listValue : undefined}\n moreLabel={moreLabel}\n lessLabel={lessLabel}\n testID={concatTestID(testID, 'value')}>\n {value}\n </ExpandableTypography>\n )}\n {isObject &&\n attributes.map((attribute, index, { length }) => (\n <CredentialAttributeItem\n nested={true}\n key={attribute.id}\n onPress={onPress}\n last={index === length - 1}\n onImagePreview={onImagePreview}\n {...attribute}\n />\n ))}\n {isArray &&\n values.map((arrayValue, index, { length }) => (\n <CredentialAttributeItem\n key={arrayValue.id}\n onPress={onPress}\n last={index === length - 1}\n onImagePreview={onImagePreview}\n listValue={true}\n {...arrayValue}\n name={undefined}\n />\n ))}\n <View />\n </View>\n {rightAccessoryView && (\n <View style={[styles.rightAccessory, isObject && styles.objectAccessory]}>{rightAccessoryView}</View>\n )}\n </View>\n </CredentialAttributeItemButton>\n </View>\n {!last && !nested && <View style={[styles.separator, { backgroundColor: colorScheme.background }]} />}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n attributeItem: {\n flex: 1,\n paddingLeft: 8,\n paddingRight: 8,\n },\n attributeItemContainer: {\n marginTop: 2,\n },\n attributeItemRow: {\n flexDirection: 'row',\n },\n dataItemButtonChildren: {\n alignItems: 'center',\n flexDirection: 'row',\n },\n dataItemImage: {\n height: IMAGE_SIZE,\n width: IMAGE_SIZE,\n },\n dataItemImageWrapper: {\n borderColor: '#0004',\n borderRadius: 4,\n borderWidth: 0.5,\n height: IMAGE_SIZE,\n marginTop: 4,\n overflow: 'hidden',\n width: IMAGE_SIZE,\n },\n dataItemLabel: {\n marginBottom: 4,\n opacity: 0.7,\n },\n decorator: {\n height: '100%',\n justifyContent: 'center',\n left: 8,\n position: 'absolute',\n },\n decoratorCircle: {\n alignItems: 'center',\n borderRadius: 3.5,\n borderWidth: 1,\n height: 7,\n justifyContent: 'center',\n position: 'absolute',\n top: 6,\n width: 7,\n },\n decoratorCircleInner: {\n borderRadius: 2,\n borderWidth: 1,\n height: 4,\n width: 4,\n },\n decoratorLine: {\n bottom: 12,\n left: 3,\n position: 'absolute',\n top: 13,\n width: 1,\n },\n listDecoratorCircle: {\n top: 18,\n },\n listDecoratorLine: {\n top: 25,\n },\n listImageDecoratorCircle: {\n top: 32,\n },\n listImageDecoratorLine: {\n bottom: 40,\n top: 39,\n },\n listStringValueDecoratorLine: {\n bottom: 24,\n },\n listValue: {\n marginLeft: 13,\n paddingVertical: 10,\n },\n nestedAttributeItem: {\n paddingLeft: 12,\n },\n nestedObjectLabel: {\n opacity: 0.7,\n paddingLeft: 13,\n },\n objectAccessory: {\n alignSelf: 'flex-start',\n },\n objectAttributeItem: {\n alignItems: 'stretch',\n flex: 1,\n paddingLeft: 12,\n },\n rightAccessory: {\n paddingHorizontal: 8,\n position: 'absolute',\n right: 0,\n },\n separator: {\n height: 1,\n marginHorizontal: 8,\n marginTop: -1,\n },\n touchableAttribute: {\n borderRadius: 8,\n borderWidth: 0,\n flex: 1,\n paddingVertical: 11,\n },\n});\n\nexport default CredentialAttributeItem;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAwDC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACvG,SAASC,KAAK,EAAkCC,UAAU,EAAEC,IAAI,QAAmB,cAAc;AAEjG,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ,+CAA+C;AACpG,OAAOC,oBAAoB,MAAM,8BAA8B;AAC/D,OAAOC,UAAU,MAAM,oBAAoB;AAC3C,SAASC,iBAAiB,QAAQ,+BAA+B;AASjE,MAAMC,6BAAwF,GAAGA,CAAC;EAChGC,QAAQ;EACRC,QAAQ;EACRC,EAAE;EACFC,OAAO;EACPC;AACF,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAG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