@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$e);
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$e);
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$g({
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$g({
224
- $color: colorWithDefaultToBlack,
243
+ $color: colorOrDefaultToBlack,
225
244
  $isHeader: isHeader,
226
245
  $variant: nonNullableVariant,
227
246
  accessibilityRole: accessibilityRole || undefined
@@ -1449,30 +1468,31 @@ var PressableIconButtonWebWrapper = withTheme( /*#__PURE__*/styled("div")({
1449
1468
  return theme.kitt.iconButton.scale.base.active;
1450
1469
  }],
1451
1470
  "p1nlccvg-4": [function (_ref5) {
1452
- var theme = _ref5.theme;
1453
- return theme.kitt.iconButton["default"].pressedBackgroundColor;
1454
- }],
1455
- "p1nlccvg-5": [function (_ref6) {
1456
- var theme = _ref6.theme;
1457
- return theme.kitt.iconButton.white.pressedBackgroundColor;
1471
+ var theme = _ref5.theme,
1472
+ $isWhite = _ref5.$isWhite;
1473
+ var _theme$kitt$iconButto = theme.kitt.iconButton,
1474
+ white = _theme$kitt$iconButto.white,
1475
+ defaultIconButton = _theme$kitt$iconButto["default"];
1476
+ if ($isWhite) return white.pressedBackgroundColor;
1477
+ return defaultIconButton.pressedBackgroundColor;
1458
1478
  }]
1459
1479
  }
1460
1480
  }));
1461
1481
  var StyledPressableIconButton = /*#__PURE__*/styled$1(Pressable).withConfig({
1462
1482
  displayName: "PressableIconButton__StyledPressableIconButton",
1463
1483
  componentId: "kitt-universal__sc-1m6jo3s-0"
1464
- })(["border-radius:", "px;width:", "px;height:", "px;align-items:center;justify-content:center;position:relative;background-color:transparent;", ";"], function (_ref7) {
1465
- var theme = _ref7.theme;
1484
+ })(["border-radius:", "px;width:", "px;height:", "px;align-items:center;justify-content:center;position:relative;background-color:transparent;", ";"], function (_ref6) {
1485
+ var theme = _ref6.theme;
1466
1486
  return theme.kitt.iconButton.borderRadius;
1487
+ }, function (_ref7) {
1488
+ var theme = _ref7.theme;
1489
+ return theme.kitt.iconButton.width;
1467
1490
  }, function (_ref8) {
1468
1491
  var theme = _ref8.theme;
1469
- return theme.kitt.iconButton.width;
1470
- }, function (_ref9) {
1471
- var theme = _ref9.theme;
1472
1492
  return theme.kitt.iconButton.height;
1473
- }, function (_ref10) {
1474
- var theme = _ref10.theme,
1475
- disabled = _ref10.disabled;
1493
+ }, function (_ref9) {
1494
+ var theme = _ref9.theme,
1495
+ disabled = _ref9.disabled;
1476
1496
  var iconButton = theme.kitt.iconButton;
1477
1497
  var transition = iconButton.transition;
1478
1498
 
@@ -1482,13 +1502,13 @@ var StyledPressableIconButton = /*#__PURE__*/styled$1(Pressable).withConfig({
1482
1502
 
1483
1503
  return "\n transition: ".concat(transition.property, " ").concat(transition.duration, " ").concat(transition.timingFunction, ";\n ");
1484
1504
  });
1485
- function PressableIconButton(_ref11) {
1486
- var color = _ref11.color,
1487
- props = _objectWithoutProperties(_ref11, _excluded$6);
1505
+ function PressableIconButton(_ref10) {
1506
+ var color = _ref10.color,
1507
+ props = _objectWithoutProperties(_ref10, _excluded$6);
1488
1508
 
1489
1509
  return /*#__PURE__*/jsx(StyleWebWrapper, {
1490
1510
  as: PressableIconButtonWebWrapper,
1491
- "data-color-white": color === 'white' ? true : undefined,
1511
+ $isWhite: color === 'white',
1492
1512
  children: /*#__PURE__*/jsx(StyledPressableIconButton, _objectSpread$7({}, props))
1493
1513
  });
1494
1514
  }
@@ -3196,40 +3216,46 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
3196
3216
  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; }
3197
3217
  var TypographyLinkWebWrapper = withTheme( /*#__PURE__*/styled("span")({
3198
3218
  name: "TypographyLinkWebWrapper",
3199
- "class": "tcwz3nt"
3219
+ "class": "tcwz3nt",
3220
+ vars: {
3221
+ "tcwz3nt-0": [function (_ref) {
3222
+ var $hasNoUnderline = _ref.$hasNoUnderline;
3223
+ return $hasNoUnderline ? 'underline' : 'none';
3224
+ }]
3225
+ }
3200
3226
  }));
3201
3227
  var StyledLink = /*#__PURE__*/styled$1(Text$1).withConfig({
3202
3228
  displayName: "TypographyLink__StyledLink",
3203
3229
  componentId: "kitt-universal__sc-1o1zy30-0"
3204
- })(["text-decoration:", ";", ";", ";"], function (_ref) {
3205
- var $noUnderline = _ref.$noUnderline;
3206
- return $noUnderline ? 'none' : 'underline';
3207
- }, function (_ref2) {
3208
- var $disabled = _ref2.$disabled;
3209
- return "\n text-decoration-color: inherit;\n transition: color 0.2s ease-in-out;\n cursor: ".concat($disabled ? 'not-allowed' : 'pointer', ";\n ");
3230
+ })(["text-decoration:", ";", ";", ";"], function (_ref2) {
3231
+ var $hasNoUnderline = _ref2.$hasNoUnderline;
3232
+ return $hasNoUnderline ? 'none' : 'underline';
3210
3233
  }, function (_ref3) {
3211
- var $disabled = _ref3.$disabled,
3212
- theme = _ref3.theme;
3234
+ var $disabled = _ref3.$disabled;
3235
+ return "\n text-decoration-color: inherit;\n transition: color 0.2s ease-in-out;\n cursor: ".concat($disabled ? 'not-allowed' : 'pointer', ";\n ");
3236
+ }, function (_ref4) {
3237
+ var $disabled = _ref4.$disabled,
3238
+ theme = _ref4.theme;
3213
3239
  if (!$disabled) return undefined;
3214
3240
  return "color: ".concat(theme.kitt.typography.link.disabledColor, ";");
3215
3241
  });
3216
- function TypographyLink(_ref4) {
3217
- var children = _ref4.children,
3218
- disabled = _ref4.disabled,
3219
- noUnderline = _ref4.noUnderline,
3220
- href = _ref4.href,
3221
- hrefAttrs = _ref4.hrefAttrs,
3222
- onPress = _ref4.onPress,
3223
- otherProps = _objectWithoutProperties(_ref4, _excluded$1);
3242
+ function TypographyLink(_ref5) {
3243
+ var children = _ref5.children,
3244
+ disabled = _ref5.disabled,
3245
+ noUnderline = _ref5.noUnderline,
3246
+ href = _ref5.href,
3247
+ hrefAttrs = _ref5.hrefAttrs,
3248
+ onPress = _ref5.onPress,
3249
+ otherProps = _objectWithoutProperties(_ref5, _excluded$1);
3224
3250
 
3225
3251
  return /*#__PURE__*/jsx(Typography, _objectSpread(_objectSpread({}, otherProps), {}, {
3226
3252
  accessibilityRole: "none",
3227
3253
  children: /*#__PURE__*/jsx(StyleWebWrapper, {
3228
3254
  as: TypographyLinkWebWrapper,
3229
- "data-nounderline": noUnderline ? true : undefined,
3255
+ $hasNoUnderline: noUnderline,
3230
3256
  children: /*#__PURE__*/jsx(StyledLink, {
3231
3257
  $disabled: disabled,
3232
- $noUnderline: noUnderline,
3258
+ $hasNoUnderline: noUnderline,
3233
3259
  href: href,
3234
3260
  hrefAttrs: hrefAttrs,
3235
3261
  accessibilityRole: "link",