@proximus/lavender-toast-native 0.1.0-alpha.1 → 0.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PxToast.d.ts.map +1 -1
- package/dist/PxToast.js +8 -9
- package/package.json +1 -1
package/dist/PxToast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PxToast.d.ts","sourceRoot":"","sources":["../src/PxToast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAIL,SAAS,EAIT,SAAS,EACV,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"PxToast.d.ts","sourceRoot":"","sources":["../src/PxToast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAIL,SAAS,EAIT,SAAS,EACV,MAAM,cAAc,CAAC;AAStB,MAAM,WAAW,YAAY;IAC3B,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE9D,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,cAAc,EACd,MAAU,EACV,QAAgB,EAChB,YAAY,EACZ,cAAc,EACd,OAAO,EACP,YAAY,EACZ,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,MAAe,EACf,QAAgB,GACjB,EAAE,YAAY,4BAkNd"}
|
package/dist/PxToast.js
CHANGED
|
@@ -7,14 +7,14 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
|
7
7
|
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
8
8
|
export function PxToast({ visible, containerStyle, offset = 0, expanded = false, action1Label, action1OnPress, message, action2Label, action2OnPress, action1AccessibilityHint, action2AccessibilityHint, action1TestID, action2TestID, status = 'info', inverted = false, }) {
|
|
9
9
|
const [bottom, setBottom] = useState();
|
|
10
|
-
const [canDisplay, setCanDisplay] = useState(
|
|
10
|
+
const [canDisplay, setCanDisplay] = useState(false);
|
|
11
11
|
const [animatedVisible, setAnimatedVisible] = useState(false);
|
|
12
12
|
const { theme } = useTheme();
|
|
13
13
|
const insets = useSafeAreaInsets();
|
|
14
14
|
const translateY = useRef(new Animated.Value(10)).current;
|
|
15
15
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
16
16
|
const toastRef = useRef(null);
|
|
17
|
-
const iconSetup = useStatusIcon(
|
|
17
|
+
const iconSetup = useStatusIcon(status);
|
|
18
18
|
const onLayoutCallback = useCallback((e) => {
|
|
19
19
|
if (!bottom && e.nativeEvent.layout.height > 0) {
|
|
20
20
|
setBottom(insets.bottom + offset);
|
|
@@ -110,7 +110,7 @@ export function PxToast({ visible, containerStyle, offset = 0, expanded = false,
|
|
|
110
110
|
justifyContent: 'flex-start',
|
|
111
111
|
gap: theme.t('SpacingSMobile').number,
|
|
112
112
|
} },
|
|
113
|
-
React.createElement(PxIcon, { accessible: false, importantForAccessibility: 'no', size:
|
|
113
|
+
React.createElement(PxIcon, { accessible: false, importantForAccessibility: 'no', size: 'M', inverted: !inverted, ...iconSetup }),
|
|
114
114
|
React.createElement(Body, { inverted: !inverted, accessible: false, importantForAccessibility: 'no', numberOfLines: 1, ellipsizeMode: 'tail' }, message)),
|
|
115
115
|
React.createElement(View, { style: {
|
|
116
116
|
...(!expanded && { flex: 1 }),
|
|
@@ -146,28 +146,27 @@ export function PxToast({ visible, containerStyle, offset = 0, expanded = false,
|
|
|
146
146
|
}),
|
|
147
147
|
} }, action2Label)))))))) : null;
|
|
148
148
|
}
|
|
149
|
-
function useStatusIcon(
|
|
150
|
-
const colorSuffix = inverted ? 'Default' : 'Inverted';
|
|
149
|
+
function useStatusIcon(status) {
|
|
151
150
|
switch (status) {
|
|
152
151
|
case 'info':
|
|
153
152
|
return {
|
|
154
153
|
name: 'information_fill',
|
|
155
|
-
color:
|
|
154
|
+
color: 'Brand',
|
|
156
155
|
};
|
|
157
156
|
case 'success':
|
|
158
157
|
return {
|
|
159
158
|
name: 'checkmark_fill',
|
|
160
|
-
color:
|
|
159
|
+
color: 'PurposeSuccess',
|
|
161
160
|
};
|
|
162
161
|
case 'warning':
|
|
163
162
|
return {
|
|
164
163
|
name: 'exclamation_mark_fill',
|
|
165
|
-
color:
|
|
164
|
+
color: 'PurposeWarning',
|
|
166
165
|
};
|
|
167
166
|
case 'error':
|
|
168
167
|
return {
|
|
169
168
|
name: 'minus_fill',
|
|
170
|
-
color:
|
|
169
|
+
color: 'PurposeError',
|
|
171
170
|
};
|
|
172
171
|
}
|
|
173
172
|
}
|