@ornikar/kitt-universal 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -317,31 +317,35 @@ Typography.h4 = createHeading(4, 'header4');
317
317
 
318
318
  Typography.h5 = createHeading(5, 'header5');
319
319
 
320
- const getFirstCharacter = string => string ? string[0] : '';
321
-
322
- const getInitials = (firstname, lastname) => (getFirstCharacter(firstname) + getFirstCharacter(lastname)).toUpperCase();
320
+ const getInitials = (firstname, lastname) => `${firstname[0]}${lastname[0]}`.toUpperCase();
323
321
 
324
322
  const StyledAvatarView = /*#__PURE__*/styled__default.View.withConfig({
325
323
  displayName: "Avatar__StyledAvatarView",
326
324
  componentId: "kitt-universal__sc-9miubv-0"
327
- })(["border-radius:", "px;background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], ({
328
- round,
329
- size
330
- }) => round ? size / 2 : 10, ({
325
+ })(["border-radius:", ";background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], ({
331
326
  theme,
332
- light
333
- }) => light ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
334
- size
335
- }) => size, ({
336
- size
337
- }) => size);
327
+ $isRound,
328
+ $size
329
+ }) => {
330
+ if ($isRound) return `${$size / 2}px`;
331
+ return theme.kitt.avatar.borderRadius;
332
+ }, ({
333
+ theme,
334
+ $isLight
335
+ }) => $isLight ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar.default.backgroundColor, ({
336
+ $size
337
+ }) => $size, ({
338
+ $size
339
+ }) => $size);
338
340
 
339
341
  function AvatarContent({
340
- size = 40,
342
+ size,
341
343
  src,
342
344
  firstname,
343
345
  lastname,
344
- light
346
+ alt,
347
+ base,
348
+ isLight
345
349
  }) {
346
350
  if (src) {
347
351
  return /*#__PURE__*/jsxRuntime.jsx(reactNative.Image, {
@@ -351,34 +355,43 @@ function AvatarContent({
351
355
  style: {
352
356
  width: size,
353
357
  height: size
354
- }
358
+ },
359
+ accessibilityLabel: alt
355
360
  });
356
361
  }
357
362
 
358
363
  if (firstname && lastname) {
359
364
  return /*#__PURE__*/jsxRuntime.jsx(Typography.Text, {
360
- base: "body-small",
365
+ base: base,
361
366
  variant: "bold",
362
- color: light ? 'black' : 'white',
367
+ color: isLight ? 'black' : 'white',
363
368
  children: getInitials(firstname, lastname)
364
369
  });
365
370
  }
366
371
 
367
372
  return /*#__PURE__*/jsxRuntime.jsx(Icon, {
368
373
  icon: /*#__PURE__*/jsxRuntime.jsx(kittIcons.UserIcon, {}),
369
- color: light ? 'black' : 'white',
374
+ color: isLight ? 'black' : 'white',
370
375
  size: size / 2
371
376
  });
372
377
  }
373
378
 
374
379
  function Avatar({
375
380
  size = 40,
376
- ...rest
381
+ base = 'body-small',
382
+ round,
383
+ light,
384
+ ...props
377
385
  }) {
378
- return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, { ...rest,
379
- size: size,
380
- children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, { ...rest,
381
- size: size
386
+ return /*#__PURE__*/jsxRuntime.jsx(StyledAvatarView, {
387
+ $size: size,
388
+ $isRound: round,
389
+ $isLight: light,
390
+ children: /*#__PURE__*/jsxRuntime.jsx(AvatarContent, {
391
+ size: size,
392
+ base: base,
393
+ isLight: light,
394
+ ...props
382
395
  })
383
396
  });
384
397
  }
@@ -2600,17 +2613,6 @@ const lateOceanColorPalette = {
2600
2613
  moonPurpleLight1: '#EDEBFC'
2601
2614
  };
2602
2615
 
2603
- const avatarLateOceanTheme = {
2604
- default: {
2605
- color: lateOceanColorPalette.white,
2606
- backgroundColor: lateOceanColorPalette.lateOcean
2607
- },
2608
- light: {
2609
- color: lateOceanColorPalette.black1000,
2610
- backgroundColor: lateOceanColorPalette.black100
2611
- }
2612
- };
2613
-
2614
2616
  const colorsLateOceanTheme = {
2615
2617
  primary: lateOceanColorPalette.lateOcean,
2616
2618
  primaryLight: lateOceanColorPalette.lateOceanLight1,
@@ -2633,6 +2635,16 @@ const colorsLateOceanTheme = {
2633
2635
  }
2634
2636
  };
2635
2637
 
2638
+ const avatar = {
2639
+ borderRadius: '10px',
2640
+ default: {
2641
+ backgroundColor: colorsLateOceanTheme.primary
2642
+ },
2643
+ light: {
2644
+ backgroundColor: lateOceanColorPalette.black100
2645
+ }
2646
+ };
2647
+
2636
2648
  const buttonLateOceanTheme = {
2637
2649
  borderRadius: '30px',
2638
2650
  borderWidth: {
@@ -3015,7 +3027,7 @@ const theme = {
3015
3027
  palettes: {
3016
3028
  lateOcean: lateOceanColorPalette
3017
3029
  },
3018
- avatar: avatarLateOceanTheme,
3030
+ avatar,
3019
3031
  button: buttonLateOceanTheme,
3020
3032
  card: cardLateOceanTheme,
3021
3033
  feedbackMessage: feedbackMessageLateOceanTheme,
@@ -3602,6 +3614,7 @@ exports.theme = theme;
3602
3614
  exports.useKittTheme = useKittTheme;
3603
3615
  exports.useMatchWindowSize = useMatchWindowSize;
3604
3616
  exports.useStoryBlockColor = useStoryBlockColor;
3617
+ exports.withTheme = withTheme;
3605
3618
  Object.keys(kittIcons).forEach(function (k) {
3606
3619
  if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = kittIcons[k];
3607
3620
  });