@ornikar/kitt-universal 3.3.0 → 3.4.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.
@@ -194,34 +194,53 @@ function useTypographyTypeForCurrentWindowSize(base, small, medium, large) {
194
194
  if (small && width >= KittBreakpoints.SMALL) return small;
195
195
  return base;
196
196
  }
197
- function Typography(_ref3) {
198
- var accessibilityRole = _ref3.accessibilityRole,
199
- base = _ref3.base,
200
- small = _ref3.small,
201
- medium = _ref3.medium,
202
- large = _ref3.large,
203
- variant = _ref3.variant,
204
- color = _ref3.color,
205
- otherProps = _objectWithoutProperties(_ref3, _excluded$d);
197
+ function getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, _ref3) {
198
+ var base = _ref3.base,
199
+ color = _ref3.color;
200
+ // return the props set or undefined. In case of undefined, the value will be inherited from its parents.
201
+ if (hasTypographyAncestor) return {
202
+ base: base,
203
+ color: color
204
+ };
205
+ return {
206
+ base: base !== null && base !== void 0 ? base : 'body',
207
+ color: color !== null && color !== void 0 ? color : 'black'
208
+ };
209
+ }
210
+ function Typography(_ref4) {
211
+ var accessibilityRole = _ref4.accessibilityRole,
212
+ base = _ref4.base,
213
+ small = _ref4.small,
214
+ medium = _ref4.medium,
215
+ large = _ref4.large,
216
+ variant = _ref4.variant,
217
+ color = _ref4.color,
218
+ otherProps = _objectWithoutProperties(_ref4, _excluded$d);
206
219
 
207
220
  var isHeaderTypographyInContext = useContext(IsHeaderTypographyContext);
208
- var typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(base, small, medium, large);
209
- var isHeader = isTypographyHeader(typeForCurrentWindowSize, isHeaderTypographyInContext);
210
- var nonNullableVariant = variant !== null && variant !== void 0 ? variant : isHeader ? 'bold' : 'regular'; // if isHeaderTypographyInContext exists, it means we are inside another typography so we don't want to
211
- // redefine the color, just inherit from it
221
+ var hasTypographyAncestor = isHeaderTypographyInContext !== undefined;
212
222
 
213
- var colorWithDefaultToBlack = color !== null && color !== void 0 ? color : isHeaderTypographyInContext !== undefined ? undefined : 'black';
214
- var content = base ? /*#__PURE__*/jsx(IsHeaderTypographyContext.Provider, {
223
+ var _getTypographyInherit = getTypographyInheritedOrDefaultValuesBasedOnExistingAncestors(hasTypographyAncestor, {
224
+ base: base,
225
+ color: color
226
+ }),
227
+ baseOrDefaultToBody = _getTypographyInherit.base,
228
+ colorOrDefaultToBlack = _getTypographyInherit.color;
229
+
230
+ var typeForCurrentWindowSize = useTypographyTypeForCurrentWindowSize(baseOrDefaultToBody, small, medium, large);
231
+ var isHeader = isTypographyHeader(typeForCurrentWindowSize, isHeaderTypographyInContext);
232
+ var nonNullableVariant = variant !== null && variant !== void 0 ? variant : isHeader ? 'bold' : 'regular';
233
+ var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(IsHeaderTypographyContext.Provider, {
215
234
  value: isHeader,
216
235
  children: /*#__PURE__*/jsx(StyledTypography, _objectSpread$h({
217
- $color: colorWithDefaultToBlack,
236
+ $color: colorOrDefaultToBlack,
218
237
  $isHeader: isHeader,
219
238
  $typeForCurrentWindowSize: typeForCurrentWindowSize,
220
239
  $variant: nonNullableVariant,
221
240
  accessibilityRole: accessibilityRole || undefined
222
241
  }, otherProps))
223
242
  }) : /*#__PURE__*/jsx(StyledTypography, _objectSpread$h({
224
- $color: colorWithDefaultToBlack,
243
+ $color: colorOrDefaultToBlack,
225
244
  $isHeader: isHeader,
226
245
  $variant: nonNullableVariant,
227
246
  accessibilityRole: accessibilityRole || undefined
@@ -1460,29 +1479,30 @@ var PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/styled$1("div")({
1460
1479
  return theme.kitt.iconButton.scale.base.active;
1461
1480
  }],
1462
1481
  "p1nlccvg-4": [function (_ref5) {
1463
- var theme = _ref5.theme;
1464
- return theme.kitt.iconButton["default"].pressedBackgroundColor;
1465
- }],
1466
- "p1nlccvg-5": [function (_ref6) {
1467
- var theme = _ref6.theme;
1468
- return theme.kitt.iconButton.white.pressedBackgroundColor;
1482
+ var theme = _ref5.theme,
1483
+ $isWhite = _ref5.$isWhite;
1484
+ var _theme$kitt$iconButto = theme.kitt.iconButton,
1485
+ white = _theme$kitt$iconButto.white,
1486
+ defaultIconButton = _theme$kitt$iconButto["default"];
1487
+ if ($isWhite) return white.pressedBackgroundColor;
1488
+ return defaultIconButton.pressedBackgroundColor;
1469
1489
  }]
1470
1490
  }
1471
1491
  }));
1472
1492
  var StyledPressableIconButton = /*#__PURE__*/styled.Pressable.withConfig({
1473
1493
  displayName: "PressableIconButton__StyledPressableIconButton"
1474
- })(["border-radius:", "px;width:", "px;height:", "px;align-items:center;justify-content:center;position:relative;background-color:transparent;", ";"], function (_ref7) {
1475
- var theme = _ref7.theme;
1494
+ })(["border-radius:", "px;width:", "px;height:", "px;align-items:center;justify-content:center;position:relative;background-color:transparent;", ";"], function (_ref6) {
1495
+ var theme = _ref6.theme;
1476
1496
  return theme.kitt.iconButton.borderRadius;
1497
+ }, function (_ref7) {
1498
+ var theme = _ref7.theme;
1499
+ return theme.kitt.iconButton.width;
1477
1500
  }, function (_ref8) {
1478
1501
  var theme = _ref8.theme;
1479
- return theme.kitt.iconButton.width;
1480
- }, function (_ref9) {
1481
- var theme = _ref9.theme;
1482
1502
  return theme.kitt.iconButton.height;
1483
- }, function (_ref10) {
1484
- var theme = _ref10.theme,
1485
- disabled = _ref10.disabled;
1503
+ }, function (_ref9) {
1504
+ var theme = _ref9.theme,
1505
+ disabled = _ref9.disabled;
1486
1506
  var iconButton = theme.kitt.iconButton;
1487
1507
 
1488
1508
  if (Platform.OS !== 'web') {
@@ -1497,13 +1517,13 @@ var StyledPressableIconButton = /*#__PURE__*/styled.Pressable.withConfig({
1497
1517
 
1498
1518
  return "\n transition: ".concat(transition.property, " ").concat(transition.duration, " ").concat(transition.timingFunction, ";\n ");
1499
1519
  });
1500
- function PressableIconButton(_ref11) {
1501
- var color = _ref11.color,
1502
- props = _objectWithoutProperties(_ref11, _excluded$6);
1520
+ function PressableIconButton(_ref10) {
1521
+ var color = _ref10.color,
1522
+ props = _objectWithoutProperties(_ref10, _excluded$6);
1503
1523
 
1504
1524
  return /*#__PURE__*/jsx(StyleWebWrapper, {
1505
1525
  as: PressableIconButtonWebWrapper,
1506
- "data-color-white": color === 'white' ? true : undefined,
1526
+ $isWhite: color === 'white',
1507
1527
  children: /*#__PURE__*/jsx(StyledPressableIconButton, _objectSpread$8({}, props))
1508
1528
  });
1509
1529
  }
@@ -3375,40 +3395,46 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
3375
3395
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3376
3396
  var TypographyLinkWebWrapper = withTheme( /*#__PURE__*/styled$1("span")({
3377
3397
  name: "TypographyLinkWebWrapper",
3378
- "class": "tcwz3nt"
3398
+ "class": "tcwz3nt",
3399
+ vars: {
3400
+ "tcwz3nt-0": [function (_ref) {
3401
+ var $hasNoUnderline = _ref.$hasNoUnderline;
3402
+ return $hasNoUnderline ? 'underline' : 'none';
3403
+ }]
3404
+ }
3379
3405
  }));
3380
3406
  var StyledLink = /*#__PURE__*/styled.Text.withConfig({
3381
3407
  displayName: "TypographyLink__StyledLink"
3382
- })(["text-decoration:", ";", ";", ";"], function (_ref) {
3383
- var $noUnderline = _ref.$noUnderline;
3384
- return $noUnderline ? 'none' : 'underline';
3385
- }, function (_ref2) {
3386
- var $disabled = _ref2.$disabled;
3408
+ })(["text-decoration:", ";", ";", ";"], function (_ref2) {
3409
+ var $hasNoUnderline = _ref2.$hasNoUnderline;
3410
+ return $hasNoUnderline ? 'none' : 'underline';
3411
+ }, function (_ref3) {
3412
+ var $disabled = _ref3.$disabled;
3387
3413
  if (Platform.OS !== 'web') return undefined;
3388
3414
  return "\n text-decoration-color: inherit;\n transition: color 0.2s ease-in-out;\n cursor: ".concat($disabled ? 'not-allowed' : 'pointer', ";\n ");
3389
- }, function (_ref3) {
3390
- var $disabled = _ref3.$disabled,
3391
- theme = _ref3.theme;
3415
+ }, function (_ref4) {
3416
+ var $disabled = _ref4.$disabled,
3417
+ theme = _ref4.theme;
3392
3418
  if (!$disabled) return undefined;
3393
3419
  return "color: ".concat(theme.kitt.typography.link.disabledColor, ";");
3394
3420
  });
3395
- function TypographyLink(_ref4) {
3396
- var children = _ref4.children,
3397
- disabled = _ref4.disabled,
3398
- noUnderline = _ref4.noUnderline,
3399
- href = _ref4.href,
3400
- hrefAttrs = _ref4.hrefAttrs,
3401
- onPress = _ref4.onPress,
3402
- otherProps = _objectWithoutProperties(_ref4, _excluded$1);
3421
+ function TypographyLink(_ref5) {
3422
+ var children = _ref5.children,
3423
+ disabled = _ref5.disabled,
3424
+ noUnderline = _ref5.noUnderline,
3425
+ href = _ref5.href,
3426
+ hrefAttrs = _ref5.hrefAttrs,
3427
+ onPress = _ref5.onPress,
3428
+ otherProps = _objectWithoutProperties(_ref5, _excluded$1);
3403
3429
 
3404
3430
  return /*#__PURE__*/jsx(Typography, _objectSpread(_objectSpread({}, otherProps), {}, {
3405
3431
  accessibilityRole: "none",
3406
3432
  children: /*#__PURE__*/jsx(StyleWebWrapper, {
3407
3433
  as: TypographyLinkWebWrapper,
3408
- "data-nounderline": noUnderline ? true : undefined,
3434
+ $hasNoUnderline: noUnderline,
3409
3435
  children: /*#__PURE__*/jsx(StyledLink, {
3410
3436
  $disabled: disabled,
3411
- $noUnderline: noUnderline,
3437
+ $hasNoUnderline: noUnderline,
3412
3438
  href: href,
3413
3439
  hrefAttrs: hrefAttrs,
3414
3440
  accessibilityRole: "link",