@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.
@@ -303,45 +303,44 @@ Typography.h4 = createHeading(4, 'header4');
303
303
 
304
304
  Typography.h5 = createHeading(5, 'header5');
305
305
 
306
- var _excluded$c = ["size"];
306
+ var _excluded$c = ["size", "base", "round", "light"];
307
307
 
308
308
  function ownKeys$g(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
309
309
 
310
310
  function _objectSpread$g(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$g(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$g(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
311
311
 
312
- var getFirstCharacter = function (string) {
313
- return string ? string[0] : '';
314
- };
315
-
316
312
  var getInitials = function (firstname, lastname) {
317
- return (getFirstCharacter(firstname) + getFirstCharacter(lastname)).toUpperCase();
313
+ return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
318
314
  };
319
315
 
320
316
  var StyledAvatarView = /*#__PURE__*/styled.View.withConfig({
321
317
  displayName: "Avatar__StyledAvatarView"
322
- })(["border-radius:", "px;background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], function (_ref) {
323
- var round = _ref.round,
324
- size = _ref.size;
325
- return round ? size / 2 : 10;
318
+ })(["border-radius:", ";background-color:", ";height:", "px;width:", "px;overflow:hidden;align-items:center;justify-content:center;"], function (_ref) {
319
+ var theme = _ref.theme,
320
+ $isRound = _ref.$isRound,
321
+ $size = _ref.$size;
322
+ if ($isRound) return "".concat($size / 2, "px");
323
+ return theme.kitt.avatar.borderRadius;
326
324
  }, function (_ref2) {
327
325
  var theme = _ref2.theme,
328
- light = _ref2.light;
329
- return light ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar["default"].backgroundColor;
326
+ $isLight = _ref2.$isLight;
327
+ return $isLight ? theme.kitt.avatar.light.backgroundColor : theme.kitt.avatar["default"].backgroundColor;
330
328
  }, function (_ref3) {
331
- var size = _ref3.size;
332
- return size;
329
+ var $size = _ref3.$size;
330
+ return $size;
333
331
  }, function (_ref4) {
334
- var size = _ref4.size;
335
- return size;
332
+ var $size = _ref4.$size;
333
+ return $size;
336
334
  });
337
335
 
338
336
  function AvatarContent(_ref5) {
339
- var _ref5$size = _ref5.size,
340
- size = _ref5$size === void 0 ? 40 : _ref5$size,
337
+ var size = _ref5.size,
341
338
  src = _ref5.src,
342
339
  firstname = _ref5.firstname,
343
340
  lastname = _ref5.lastname,
344
- light = _ref5.light;
341
+ alt = _ref5.alt,
342
+ base = _ref5.base,
343
+ isLight = _ref5.isLight;
345
344
 
346
345
  if (src) {
347
346
  return /*#__PURE__*/jsx(Image, {
@@ -351,22 +350,23 @@ function AvatarContent(_ref5) {
351
350
  style: {
352
351
  width: size,
353
352
  height: size
354
- }
353
+ },
354
+ accessibilityLabel: alt
355
355
  });
356
356
  }
357
357
 
358
358
  if (firstname && lastname) {
359
359
  return /*#__PURE__*/jsx(Typography.Text, {
360
- base: "body-small",
360
+ base: base,
361
361
  variant: "bold",
362
- color: light ? 'black' : 'white',
362
+ color: isLight ? 'black' : 'white',
363
363
  children: getInitials(firstname, lastname)
364
364
  });
365
365
  }
366
366
 
367
367
  return /*#__PURE__*/jsx(Icon, {
368
368
  icon: /*#__PURE__*/jsx(UserIcon, {}),
369
- color: light ? 'black' : 'white',
369
+ color: isLight ? 'black' : 'white',
370
370
  size: size / 2
371
371
  });
372
372
  }
@@ -374,14 +374,22 @@ function AvatarContent(_ref5) {
374
374
  function Avatar(_ref6) {
375
375
  var _ref6$size = _ref6.size,
376
376
  size = _ref6$size === void 0 ? 40 : _ref6$size,
377
- rest = _objectWithoutProperties(_ref6, _excluded$c);
378
-
379
- return /*#__PURE__*/jsx(StyledAvatarView, _objectSpread$g(_objectSpread$g({}, rest), {}, {
380
- size: size,
381
- children: /*#__PURE__*/jsx(AvatarContent, _objectSpread$g(_objectSpread$g({}, rest), {}, {
382
- size: size
383
- }))
384
- }));
377
+ _ref6$base = _ref6.base,
378
+ base = _ref6$base === void 0 ? 'body-small' : _ref6$base,
379
+ round = _ref6.round,
380
+ light = _ref6.light,
381
+ props = _objectWithoutProperties(_ref6, _excluded$c);
382
+
383
+ return /*#__PURE__*/jsx(StyledAvatarView, {
384
+ $size: size,
385
+ $isRound: round,
386
+ $isLight: light,
387
+ children: /*#__PURE__*/jsx(AvatarContent, _objectSpread$g({
388
+ size: size,
389
+ base: base,
390
+ isLight: light
391
+ }, props))
392
+ });
385
393
  }
386
394
 
387
395
  var StyledPressable = /*#__PURE__*/styled.Pressable.withConfig({
@@ -2708,17 +2716,6 @@ var lateOceanColorPalette = {
2708
2716
  moonPurpleLight1: '#EDEBFC'
2709
2717
  };
2710
2718
 
2711
- var avatarLateOceanTheme = {
2712
- "default": {
2713
- color: lateOceanColorPalette.white,
2714
- backgroundColor: lateOceanColorPalette.lateOcean
2715
- },
2716
- light: {
2717
- color: lateOceanColorPalette.black1000,
2718
- backgroundColor: lateOceanColorPalette.black100
2719
- }
2720
- };
2721
-
2722
2719
  var colorsLateOceanTheme = {
2723
2720
  primary: lateOceanColorPalette.lateOcean,
2724
2721
  primaryLight: lateOceanColorPalette.lateOceanLight1,
@@ -2741,6 +2738,16 @@ var colorsLateOceanTheme = {
2741
2738
  }
2742
2739
  };
2743
2740
 
2741
+ var avatar = {
2742
+ borderRadius: '10px',
2743
+ "default": {
2744
+ backgroundColor: colorsLateOceanTheme.primary
2745
+ },
2746
+ light: {
2747
+ backgroundColor: lateOceanColorPalette.black100
2748
+ }
2749
+ };
2750
+
2744
2751
  var buttonLateOceanTheme = {
2745
2752
  borderRadius: '30px',
2746
2753
  borderWidth: {
@@ -3127,7 +3134,7 @@ var theme = {
3127
3134
  palettes: {
3128
3135
  lateOcean: lateOceanColorPalette
3129
3136
  },
3130
- avatar: avatarLateOceanTheme,
3137
+ avatar: avatar,
3131
3138
  button: buttonLateOceanTheme,
3132
3139
  card: cardLateOceanTheme,
3133
3140
  feedbackMessage: feedbackMessageLateOceanTheme,
@@ -3691,5 +3698,5 @@ function MatchWindowSize(_ref) {
3691
3698
  });
3692
3699
  }
3693
3700
 
3694
- export { Avatar, Button, Card, Emoji, ExternalLink, Flex, FullScreenModal, Icon, IconButton, InputFeedback, InputField, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, KittThemeProvider, Label, LargeLoader, ListItem, Loader, MatchWindowSize, Message, Modal, Notification, Radio, DeprecatedSection as Section, Skeleton, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, createWindowSizeHelper, hex2rgba, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor };
3701
+ export { Avatar, Button, Card, Emoji, ExternalLink, Flex, FullScreenModal, Icon, IconButton, InputFeedback, InputField, InputText, KittBreakpoints, KittBreakpointsMax, KittThemeDecorator, KittThemeProvider, Label, LargeLoader, ListItem, Loader, MatchWindowSize, Message, Modal, Notification, Radio, DeprecatedSection as Section, Skeleton, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, createWindowSizeHelper, hex2rgba, matchWindowSize, styledTextInputMixin, theme, useKittTheme, useMatchWindowSize, useStoryBlockColor, withTheme };
3695
3702
  //# sourceMappingURL=index-browser-all.es.js.map