@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.
package/dist/index.es.js CHANGED
@@ -3101,6 +3101,7 @@ var getTypographyTypeWithAncestorValue = function (type, typographyTypeInContext
3101
3101
  var _excluded$R = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
3102
3102
  var TypographyFamilyContext = /*#__PURE__*/createContext(null);
3103
3103
  var TypographyTypeContext = /*#__PURE__*/createContext(null);
3104
+ var TypographyVariantContext = /*#__PURE__*/createContext(undefined);
3104
3105
  var TypographyColorContext = /*#__PURE__*/createContext('black');
3105
3106
  function useTypographyColor() {
3106
3107
  return useContext(TypographyColorContext);
@@ -3196,7 +3197,7 @@ function getUniversalFontWeight(type, variant, typographyFamily) {
3196
3197
  ThrowErrorIfInvalidVariant(variant, value, 'regular');
3197
3198
  resolvedVariant = 'regular';
3198
3199
  }
3199
- webFontWeight[typeName] = resolvedVariant;
3200
+ webFontWeight[typeName] = "".concat(typographyFamily, ".").concat(resolvedVariant);
3200
3201
  nativeFontFamily[typeName] = "".concat(typographyFamily, ".").concat(resolvedVariant);
3201
3202
  });
3202
3203
  return {
@@ -3224,21 +3225,33 @@ var TypographyBase = /*#__PURE__*/forwardRef(function (_ref2, ref) {
3224
3225
  color = _ref2.color,
3225
3226
  otherProps = _objectWithoutProperties(_ref2, _excluded$R);
3226
3227
  var sx = useSx();
3228
+
3229
+ // ancestors
3227
3230
  var typographyFamilyInContext = useContext(TypographyFamilyContext);
3228
3231
  var typographyTypeInContext = useContext(TypographyTypeContext);
3229
- var defaultColor = useTypographyDefaultColor();
3232
+ var typographyVariantInContext = useContext(TypographyVariantContext);
3233
+
3234
+ // family
3230
3235
  var hasTypographyAncestor = typographyFamilyInContext !== null;
3231
3236
  var typographyType = getTypographyTypeWithAncestorValue(type, typographyTypeInContext);
3232
3237
  var baseOrDefaultToBody = (_typographyType$base = typographyType.base) !== null && _typographyType$base !== void 0 ? _typographyType$base : 'body-m';
3233
3238
  var typographyFamily = getTypographyFamilyWithAncestorValue(baseOrDefaultToBody, typographyFamilyInContext);
3239
+
3240
+ // size
3234
3241
  var fontSizeForNativeBase = createNativeBaseFontSize(_objectSpread(_objectSpread({}, type), {}, {
3235
3242
  base: baseOrDefaultToBody
3236
3243
  }));
3244
+
3245
+ // weight
3246
+
3237
3247
  var _getUniversalFontWeig = getUniversalFontWeight(_objectSpread(_objectSpread({}, type), {}, {
3238
3248
  base: baseOrDefaultToBody
3239
- }), variant, typographyFamily),
3249
+ }), !variant && typographyType === typographyTypeInContext ? typographyVariantInContext : variant, typographyFamily),
3240
3250
  webFontWeight = _getUniversalFontWeig.webFontWeight,
3241
3251
  nativeFontFamily = _getUniversalFontWeig.nativeFontFamily;
3252
+
3253
+ // color
3254
+ var defaultColor = useTypographyDefaultColor();
3242
3255
  var currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
3243
3256
  var currentColorValue = getTypographyColorValue(currentColor);
3244
3257
  var colorStyles = sx({
@@ -3264,11 +3277,14 @@ var TypographyBase = /*#__PURE__*/forwardRef(function (_ref2, ref) {
3264
3277
  fontFamily: nativeFontFamily,
3265
3278
  textTransform: typographyFamily === 'contentCaps' ? 'uppercase' : undefined
3266
3279
  }, colorStyles), otherProps));
3267
- var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3268
- value: typographyFamily,
3269
- children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3270
- value: typographyType,
3271
- children: text
3280
+ var content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyVariantContext.Provider, {
3281
+ value: variant,
3282
+ children: /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3283
+ value: typographyFamily,
3284
+ children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3285
+ value: typographyType,
3286
+ children: text
3287
+ })
3272
3288
  })
3273
3289
  }) : text;
3274
3290
  return color ? /*#__PURE__*/jsx(TypographyColorContext.Provider, {
@@ -11229,17 +11245,19 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
11229
11245
  fontWeights: {
11230
11246
  headings: {
11231
11247
  regular: theme.typography.types.headings.fontWeight.regular,
11248
+ semibold: theme.typography.types.headings.fontWeight.semibold,
11232
11249
  bold: theme.typography.types.headings.fontWeight.bold
11233
11250
  },
11234
11251
  bodies: {
11235
- regular: theme.typography.types.bodies.fontWeight.regular
11236
- // 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
11252
+ regular: theme.typography.types.bodies.fontWeight.regular,
11253
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
11254
+ bold: Platform.OS === 'android' ? 400 : theme.typography.types.bodies.fontWeight.bold
11237
11255
  },
11238
11256
  labels: {
11239
11257
  semibold: theme.typography.types.labels.fontWeight.semibold
11240
11258
  },
11241
11259
  contentCaps: {
11242
- // 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
11260
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
11243
11261
  bold: Platform.OS === 'android' ? 400 : theme.typography.types.contentCaps.fontWeight.bold
11244
11262
  }
11245
11263
  },