@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.
@@ -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;AAQtB,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,4BAiNd"}
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(true);
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(theme, status, inverted);
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: 24, ...iconSetup }),
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(theme, status, inverted) {
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: theme.t(`ColorIconBrand${colorSuffix}`),
154
+ color: 'Brand',
156
155
  };
157
156
  case 'success':
158
157
  return {
159
158
  name: 'checkmark_fill',
160
- color: theme.t(`ColorIconPurposeSuccess${colorSuffix}`),
159
+ color: 'PurposeSuccess',
161
160
  };
162
161
  case 'warning':
163
162
  return {
164
163
  name: 'exclamation_mark_fill',
165
- color: theme.t(`ColorIconPurposeWarning${colorSuffix}`),
164
+ color: 'PurposeWarning',
166
165
  };
167
166
  case 'error':
168
167
  return {
169
168
  name: 'minus_fill',
170
- color: theme.t(`ColorIconPurposeError${colorSuffix}`),
169
+ color: 'PurposeError',
171
170
  };
172
171
  }
173
172
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-toast-native",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Lavender toast native component",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",