@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.
@@ -302,46 +302,45 @@ Typography.h4 = createHeading(4, 'header4');
302
302
 
303
303
  Typography.h5 = createHeading(5, 'header5');
304
304
 
305
- var _excluded$d = ["size"];
305
+ var _excluded$d = ["size", "base", "round", "light"];
306
306
 
307
307
  function ownKeys$f(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; }
308
308
 
309
309
  function _objectSpread$f(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$f(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
310
310
 
311
- var getFirstCharacter = function (string) {
312
- return string ? string[0] : '';
313
- };
314
-
315
311
  var getInitials = function (firstname, lastname) {
316
- return (getFirstCharacter(firstname) + getFirstCharacter(lastname)).toUpperCase();
312
+ return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
317
313
  };
318
314
 
319
315
  var StyledAvatarView = /*#__PURE__*/styled$1(View).withConfig({
320
316
  displayName: "Avatar__StyledAvatarView",
321
317
  componentId: "kitt-universal__sc-9miubv-0"
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$d);
378
-
379
- return /*#__PURE__*/jsx(StyledAvatarView, _objectSpread$f(_objectSpread$f({}, rest), {}, {
380
- size: size,
381
- children: /*#__PURE__*/jsx(AvatarContent, _objectSpread$f(_objectSpread$f({}, 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$d);
382
+
383
+ return /*#__PURE__*/jsx(StyledAvatarView, {
384
+ $size: size,
385
+ $isRound: round,
386
+ $isLight: light,
387
+ children: /*#__PURE__*/jsx(AvatarContent, _objectSpread$f({
388
+ size: size,
389
+ base: base,
390
+ isLight: light
391
+ }, props))
392
+ });
385
393
  }
386
394
 
387
395
  function isSubtle(type) {
@@ -2612,17 +2620,6 @@ var lateOceanColorPalette = {
2612
2620
  moonPurpleLight1: '#EDEBFC'
2613
2621
  };
2614
2622
 
2615
- var avatarLateOceanTheme = {
2616
- "default": {
2617
- color: lateOceanColorPalette.white,
2618
- backgroundColor: lateOceanColorPalette.lateOcean
2619
- },
2620
- light: {
2621
- color: lateOceanColorPalette.black1000,
2622
- backgroundColor: lateOceanColorPalette.black100
2623
- }
2624
- };
2625
-
2626
2623
  var colorsLateOceanTheme = {
2627
2624
  primary: lateOceanColorPalette.lateOcean,
2628
2625
  primaryLight: lateOceanColorPalette.lateOceanLight1,
@@ -2645,6 +2642,16 @@ var colorsLateOceanTheme = {
2645
2642
  }
2646
2643
  };
2647
2644
 
2645
+ var avatar = {
2646
+ borderRadius: '10px',
2647
+ "default": {
2648
+ backgroundColor: colorsLateOceanTheme.primary
2649
+ },
2650
+ light: {
2651
+ backgroundColor: lateOceanColorPalette.black100
2652
+ }
2653
+ };
2654
+
2648
2655
  var buttonLateOceanTheme = {
2649
2656
  borderRadius: '30px',
2650
2657
  borderWidth: {
@@ -3031,7 +3038,7 @@ var theme = {
3031
3038
  palettes: {
3032
3039
  lateOcean: lateOceanColorPalette
3033
3040
  },
3034
- avatar: avatarLateOceanTheme,
3041
+ avatar: avatar,
3035
3042
  button: buttonLateOceanTheme,
3036
3043
  card: cardLateOceanTheme,
3037
3044
  feedbackMessage: feedbackMessageLateOceanTheme,
@@ -3477,5 +3484,5 @@ function MatchWindowSize(_ref) {
3477
3484
  });
3478
3485
  }
3479
3486
 
3480
- 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 };
3487
+ 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 };
3481
3488
  //# sourceMappingURL=index-browser-all.es.web.js.map