@sphereon/ui-components.ssi-react-native 0.5.1 → 0.5.2-next.2

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.
@@ -10,9 +10,11 @@ const SSIExclamationMarkBadge_1 = __importDefault(require("../../../components/a
10
10
  const styles_1 = require("../../../styles");
11
11
  const SSIStatusLabel = (props) => {
12
12
  const { status, color = ui_components_core_1.statusColors[status], style, showIcon = false } = props;
13
- return (<styles_1.SSIStatusLabelContainerStyled style={[style, { borderColor: color }]}>
13
+ const isSolid = status === ui_components_core_1.CredentialStatus.REVOKED || status === ui_components_core_1.CredentialStatus.EXPIRED;
14
+ const textColor = isSolid ? '#FFFFFF' : color;
15
+ return (<styles_1.SSIStatusLabelContainerStyled style={[style, { borderColor: isSolid ? '#FFFFFF' : color, ...(isSolid ? { backgroundColor: color } : {}) }]}>
14
16
  {showIcon && <styles_1.SSIStatusLabelBadgeContainer>{getStatusBadge(status, color)}</styles_1.SSIStatusLabelBadgeContainer>}
15
- <styles_1.SSIStatusLabelStatusCaptionStyled style={{ color }}>{(0, ui_components_core_1.getStatusTranslation)(status)}</styles_1.SSIStatusLabelStatusCaptionStyled>
17
+ <styles_1.SSIStatusLabelStatusCaptionStyled style={{ color: textColor }}>{(0, ui_components_core_1.getStatusTranslation)(status)}</styles_1.SSIStatusLabelStatusCaptionStyled>
16
18
  </styles_1.SSIStatusLabelContainerStyled>);
17
19
  };
18
20
  const getStatusBadge = (status, backgroundColor) => {
@@ -15,6 +15,11 @@ const SSICredentialCardView = (props) => {
15
15
  const { issuerName, properties } = props.body ?? {};
16
16
  const { credentialStatus, expirationDate } = props.footer ?? {};
17
17
  const { backgroundColor = ui_components_core_1.credentialCardColors.default, backgroundImage, textColor = ui_components_core_1.backgroundColors.primaryLight } = props.display ?? {};
18
+ const statusRibbonColor = credentialStatus === ui_components_core_1.CredentialStatus.REVOKED
19
+ ? ui_components_core_1.statusColors.revoked
20
+ : credentialStatus === ui_components_core_1.CredentialStatus.EXPIRED
21
+ ? ui_components_core_1.statusColors.expired
22
+ : undefined;
18
23
  const getPropertyElementsFrom = (properties) => {
19
24
  return properties.slice(0, 2).map((property, index) => (<react_native_1.View key={index} style={{
20
25
  ...(properties.length > 1 && { width: 140 }),
@@ -35,7 +40,9 @@ const SSICredentialCardView = (props) => {
35
40
  <styles_1.SSICredentialCardViewCredentialTitleTextStyled style={{ color: textColor }} numberOfLines={2}>
36
41
  {credentialTitle}
37
42
  </styles_1.SSICredentialCardViewCredentialTitleTextStyled>
38
- {credentialSubtitle && <styles_1.SSICredentialCardViewCredentialSubtitleTextStyled style={{ color: textColor }} numberOfLines={2}>{credentialSubtitle}</styles_1.SSICredentialCardViewCredentialSubtitleTextStyled>}
43
+ {credentialSubtitle && (<styles_1.SSICredentialCardViewCredentialSubtitleTextStyled style={{ color: textColor }} numberOfLines={2}>
44
+ {credentialSubtitle}
45
+ </styles_1.SSICredentialCardViewCredentialSubtitleTextStyled>)}
39
46
  </styles_1.SSICredentialCardViewHeaderTitleContainerStyled>)}
40
47
  </styles_1.SSICredentialCardViewHeaderContainerStyled>)}
41
48
  {body && (<styles_1.SSICredentialCardViewContentMainContainerStyled>
@@ -54,11 +61,28 @@ const SSICredentialCardView = (props) => {
54
61
  ? `${ui_components_core_1.Localization.translate('credential_card_expires_message')} ${(0, ui_components_core_1.toLocalDateString)(expirationDate)}`
55
62
  : ui_components_core_1.Localization.translate('credential_status_never_expires_date_label')}
56
63
  </styles_1.SSITextH5LightStyled>
57
- {credentialStatus && (<styles_1.SSICredentialCardViewStatusContainerStyled>{credentialStatus && <SSIStatusLabel_1.default status={credentialStatus} color={textColor}/>}</styles_1.SSICredentialCardViewStatusContainerStyled>)}
64
+ {credentialStatus && (<styles_1.SSICredentialCardViewStatusContainerStyled>
65
+ {credentialStatus && (<SSIStatusLabel_1.default status={credentialStatus} color={credentialStatus === ui_components_core_1.CredentialStatus.REVOKED || credentialStatus === ui_components_core_1.CredentialStatus.EXPIRED
66
+ ? ui_components_core_1.statusColors[credentialStatus]
67
+ : textColor}/>)}
68
+ </styles_1.SSICredentialCardViewStatusContainerStyled>)}
58
69
  </styles_1.SSICredentialCardViewFooterContentContainerStyled>
59
70
  </styles_1.SSICredentialCardViewFooterContainerStyled>)}
60
71
  </styles_1.SSIAlphaContainerStyled>
61
72
  </styles_1.SSICredentialCardViewBackgroundImageStyled>
73
+ {statusRibbonColor && credentialStatus && (<react_native_1.View style={{ position: 'absolute', top: 0, left: 0, right: 0, alignItems: 'center', zIndex: 5 }}>
74
+ <react_native_1.View style={{
75
+ backgroundColor: statusRibbonColor,
76
+ paddingHorizontal: 22,
77
+ paddingVertical: 3,
78
+ borderBottomLeftRadius: 9,
79
+ borderBottomRightRadius: 9,
80
+ }}>
81
+ <react_native_1.Text style={{ color: '#FFFFFF', fontSize: 10, fontWeight: '700', letterSpacing: 1.2 }}>
82
+ {(0, ui_components_core_1.getStatusTranslation)(credentialStatus).toUpperCase()}
83
+ </react_native_1.Text>
84
+ </react_native_1.View>
85
+ </react_native_1.View>)}
62
86
  </styles_1.SSICredentialCardViewContainerStyled>);
63
87
  };
64
88
  exports.default = SSICredentialCardView;
@@ -1,11 +1,12 @@
1
1
  import { FC } from 'react';
2
2
  import { ColorValue, ViewStyle } from 'react-native';
3
- import { ImageAttributes } from '@sphereon/ui-components.core';
3
+ import { CredentialStatus, ImageAttributes } from '@sphereon/ui-components.core';
4
4
  type Props = {
5
5
  backgroundImage?: ImageAttributes;
6
6
  backgroundColor?: ColorValue;
7
7
  logo?: ImageAttributes;
8
8
  logoColor?: ColorValue;
9
+ credentialStatus?: CredentialStatus;
9
10
  style?: ViewStyle;
10
11
  };
11
12
  declare const SSICredentialMiniCardView: FC<Props>;
@@ -4,13 +4,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
+ const react_native_1 = require("react-native");
7
8
  const ui_components_core_1 = require("@sphereon/ui-components.core");
8
9
  const SSILogo_1 = __importDefault(require("../../assets/logos/SSILogo"));
9
10
  const styles_1 = require("../../../styles");
10
11
  const SSICredentialMiniCardView = (props) => {
11
- const { backgroundColor = ui_components_core_1.credentialCardColors.default, backgroundImage, logo, logoColor, style } = props;
12
+ const { backgroundColor = ui_components_core_1.credentialCardColors.default, backgroundImage, logo, logoColor, credentialStatus, style } = props;
13
+ const ribbonColor = credentialStatus === ui_components_core_1.CredentialStatus.REVOKED
14
+ ? ui_components_core_1.statusColors.revoked
15
+ : credentialStatus === ui_components_core_1.CredentialStatus.EXPIRED
16
+ ? ui_components_core_1.statusColors.expired
17
+ : undefined;
12
18
  return (<styles_1.SSICredentialMiniCardViewContainerStyled style={[style, { backgroundColor }]}>
13
19
  <styles_1.SSICredentialMiniCardViewBackgroundImageStyled source={backgroundImage}>{(!backgroundImage || logo) && <SSILogo_1.default logo={logo} color={logoColor}/>}</styles_1.SSICredentialMiniCardViewBackgroundImageStyled>
20
+ {ribbonColor && credentialStatus && (<react_native_1.View style={{
21
+ position: 'absolute',
22
+ top: 0,
23
+ left: 0,
24
+ right: 0,
25
+ backgroundColor: ribbonColor,
26
+ alignItems: 'center',
27
+ paddingVertical: 1,
28
+ zIndex: 5,
29
+ }}>
30
+ <react_native_1.Text style={{ color: '#FFFFFF', fontSize: 6, fontWeight: '700', letterSpacing: 0.2 }}>
31
+ {(0, ui_components_core_1.getStatusTranslation)(credentialStatus).toUpperCase()}
32
+ </react_native_1.Text>
33
+ </react_native_1.View>)}
14
34
  </styles_1.SSICredentialMiniCardViewContainerStyled>);
15
35
  };
16
36
  exports.default = SSICredentialMiniCardView;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sphereon/ui-components.ssi-react-native",
3
3
  "private": false,
4
- "version": "0.5.1",
4
+ "version": "0.5.2-next.2+e712569",
5
5
  "description": "SSI UI components for React-Native",
6
6
  "repository": "git@github.com:Sphereon-Opensource/UI-Components.git",
7
7
  "author": "Sphereon <dev@sphereon.com>",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@react-native-masked-view/masked-view": "^0.3.2",
32
- "@sphereon/ui-components.core": "0.5.1",
32
+ "@sphereon/ui-components.core": "0.5.2-next.2+e712569",
33
33
  "expo-blur": "^15.0.8",
34
34
  "expo-image": "~2.0.6",
35
35
  "expo-linear-gradient": "~13.0.2",
@@ -46,5 +46,5 @@
46
46
  "react": ">= 18.2",
47
47
  "react-native": "~0.74.3"
48
48
  },
49
- "gitHead": "62b19af0896e0946973b50f057dc63661209a318"
49
+ "gitHead": "e712569aee9d9c8db97ca0f6484e625293560c74"
50
50
  }