@ornikar/kitt-universal 29.4.1-canary.ee3a5de11ca14467578621a40a921148838ee329.0 → 29.4.1

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.
@@ -3107,6 +3107,7 @@ var getTypographyTypeWithAncestorValue = function (type, typographyTypeInContext
3107
3107
  var _excluded$P = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
3108
3108
  var TypographyFamilyContext = /*#__PURE__*/createContext(null);
3109
3109
  var TypographyTypeContext = /*#__PURE__*/createContext(null);
3110
+ var TypographyVariantContext = /*#__PURE__*/createContext(undefined);
3110
3111
  var TypographyColorContext = /*#__PURE__*/createContext('black');
3111
3112
  function useTypographyColor() {
3112
3113
  return useContext(TypographyColorContext);
@@ -3202,7 +3203,7 @@ function getUniversalFontWeight(type, variant, typographyFamily) {
3202
3203
  ThrowErrorIfInvalidVariant(variant, value, 'regular');
3203
3204
  resolvedVariant = 'regular';
3204
3205
  }
3205
- webFontWeight[typeName] = resolvedVariant;
3206
+ webFontWeight[typeName] = "".concat(typographyFamily, ".").concat(resolvedVariant);
3206
3207
  nativeFontFamily[typeName] = "".concat(typographyFamily, ".").concat(resolvedVariant);
3207
3208
  });
3208
3209
  return {
@@ -3230,21 +3231,33 @@ var TypographyBase = /*#__PURE__*/forwardRef(function (_ref2, ref) {
3230
3231
  color = _ref2.color,
3231
3232
  otherProps = _objectWithoutProperties(_ref2, _excluded$P);
3232
3233
  var sx = useSx();
3234
+
3235
+ // ancestors
3233
3236
  var typographyFamilyInContext = useContext(TypographyFamilyContext);
3234
3237
  var typographyTypeInContext = useContext(TypographyTypeContext);
3235
- var defaultColor = useTypographyDefaultColor();
3238
+ var typographyVariantInContext = useContext(TypographyVariantContext);
3239
+
3240
+ // family
3236
3241
  var hasTypographyAncestor = typographyFamilyInContext !== null;
3237
3242
  var typographyType = getTypographyTypeWithAncestorValue(type, typographyTypeInContext);
3238
3243
  var baseOrDefaultToBody = (_typographyType$base = typographyType.base) !== null && _typographyType$base !== void 0 ? _typographyType$base : 'body-m';
3239
3244
  var typographyFamily = getTypographyFamilyWithAncestorValue(baseOrDefaultToBody, typographyFamilyInContext);
3245
+
3246
+ // size
3240
3247
  var fontSizeForNativeBase = createNativeBaseFontSize(_objectSpread(_objectSpread({}, type), {}, {
3241
3248
  base: baseOrDefaultToBody
3242
3249
  }));
3250
+
3251
+ // weight
3252
+
3243
3253
  var _getUniversalFontWeig = getUniversalFontWeight(_objectSpread(_objectSpread({}, type), {}, {
3244
3254
  base: baseOrDefaultToBody
3245
- }), variant, typographyFamily),
3255
+ }), !variant && typographyType === typographyTypeInContext ? typographyVariantInContext : variant, typographyFamily),
3246
3256
  webFontWeight = _getUniversalFontWeig.webFontWeight,
3247
3257
  nativeFontFamily = _getUniversalFontWeig.nativeFontFamily;
3258
+
3259
+ // color
3260
+ var defaultColor = useTypographyDefaultColor();
3248
3261
  var currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
3249
3262
  var currentColorValue = getTypographyColorValue(currentColor);
3250
3263
  var colorStyles = sx({
@@ -3270,11 +3283,14 @@ var TypographyBase = /*#__PURE__*/forwardRef(function (_ref2, ref) {
3270
3283
  fontFamily: nativeFontFamily,
3271
3284
  textTransform: typographyFamily === 'contentCaps' ? 'uppercase' : undefined
3272
3285
  }, colorStyles), otherProps));
3273
- var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3274
- value: typographyFamily,
3275
- children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3276
- value: typographyType,
3277
- children: text
3286
+ var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyVariantContext.Provider, {
3287
+ value: variant,
3288
+ children: /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3289
+ value: typographyFamily,
3290
+ children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3291
+ value: typographyType,
3292
+ children: text
3293
+ })
3278
3294
  })
3279
3295
  }) : text;
3280
3296
  return color ? /*#__PURE__*/jsx(TypographyColorContext.Provider, {
@@ -10380,17 +10396,19 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10380
10396
  fontWeights: {
10381
10397
  headings: {
10382
10398
  regular: theme.typography.types.headings.fontWeight.regular,
10399
+ semibold: theme.typography.types.headings.fontWeight.semibold,
10383
10400
  bold: theme.typography.types.headings.fontWeight.bold
10384
10401
  },
10385
10402
  bodies: {
10386
- regular: theme.typography.types.bodies.fontWeight.regular
10387
- // TODO [https://ornikar.atlassian.net/browse/CME-767] This quick fix should be replaced by a 700 in every case, and native font weights should be handled by expo-fonts
10403
+ regular: theme.typography.types.bodies.fontWeight.regular,
10404
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
10405
+ bold: theme.typography.types.bodies.fontWeight.bold
10388
10406
  },
10389
10407
  labels: {
10390
10408
  semibold: theme.typography.types.labels.fontWeight.semibold
10391
10409
  },
10392
10410
  contentCaps: {
10393
- // TODO [https://ornikar.atlassian.net/browse/CME-767] This quick fix should be replaced by a 700 in every case, and native font weights should be handled by expo-fonts
10411
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
10394
10412
  bold: theme.typography.types.contentCaps.fontWeight.bold
10395
10413
  }
10396
10414
  },