@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.
@@ -3086,6 +3086,7 @@ const getTypographyTypeWithAncestorValue = (type, typographyTypeInContext) => {
3086
3086
 
3087
3087
  const TypographyFamilyContext = /*#__PURE__*/React.createContext(null);
3088
3088
  const TypographyTypeContext = /*#__PURE__*/React.createContext(null);
3089
+ const TypographyVariantContext = /*#__PURE__*/React.createContext(undefined);
3089
3090
  const TypographyColorContext = /*#__PURE__*/React.createContext('black');
3090
3091
  function useTypographyColor() {
3091
3092
  return React.useContext(TypographyColorContext);
@@ -3184,7 +3185,7 @@ function getUniversalFontWeight(type, variant, typographyFamily) {
3184
3185
  ThrowErrorIfInvalidVariant(variant, value, 'regular');
3185
3186
  resolvedVariant = 'regular';
3186
3187
  }
3187
- webFontWeight[typeName] = resolvedVariant;
3188
+ webFontWeight[typeName] = `${typographyFamily}.${resolvedVariant}`;
3188
3189
  nativeFontFamily[typeName] = `${typographyFamily}.${resolvedVariant}`;
3189
3190
  });
3190
3191
  return {
@@ -3211,24 +3212,36 @@ const TypographyBase = /*#__PURE__*/React.forwardRef(({
3211
3212
  ...otherProps
3212
3213
  }, ref) => {
3213
3214
  const sx = nativeBase.useSx();
3215
+
3216
+ // ancestors
3214
3217
  const typographyFamilyInContext = React.useContext(TypographyFamilyContext);
3215
3218
  const typographyTypeInContext = React.useContext(TypographyTypeContext);
3216
- const defaultColor = useTypographyDefaultColor();
3219
+ const typographyVariantInContext = React.useContext(TypographyVariantContext);
3220
+
3221
+ // family
3217
3222
  const hasTypographyAncestor = typographyFamilyInContext !== null;
3218
3223
  const typographyType = getTypographyTypeWithAncestorValue(type, typographyTypeInContext);
3219
3224
  const baseOrDefaultToBody = typographyType.base ?? 'body-m';
3220
3225
  const typographyFamily = getTypographyFamilyWithAncestorValue(baseOrDefaultToBody, typographyFamilyInContext);
3226
+
3227
+ // size
3221
3228
  const fontSizeForNativeBase = createNativeBaseFontSize({
3222
3229
  ...type,
3223
3230
  base: baseOrDefaultToBody
3224
3231
  });
3232
+
3233
+ // weight
3234
+
3225
3235
  const {
3226
3236
  webFontWeight,
3227
3237
  nativeFontFamily
3228
3238
  } = getUniversalFontWeight({
3229
3239
  ...type,
3230
3240
  base: baseOrDefaultToBody
3231
- }, variant, typographyFamily);
3241
+ }, !variant && typographyType === typographyTypeInContext ? typographyVariantInContext : variant, typographyFamily);
3242
+
3243
+ // color
3244
+ const defaultColor = useTypographyDefaultColor();
3232
3245
  const currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
3233
3246
  const currentColorValue = getTypographyColorValue(currentColor);
3234
3247
  const colorStyles = sx({
@@ -3253,11 +3266,14 @@ const TypographyBase = /*#__PURE__*/React.forwardRef(({
3253
3266
  ...colorStyles,
3254
3267
  ...otherProps
3255
3268
  });
3256
- const content = baseOrDefaultToBody ? /*#__PURE__*/jsxRuntime.jsx(TypographyFamilyContext.Provider, {
3257
- value: typographyFamily,
3258
- children: /*#__PURE__*/jsxRuntime.jsx(TypographyTypeContext.Provider, {
3259
- value: typographyType,
3260
- children: text
3269
+ const content = baseOrDefaultToBody ? /*#__PURE__*/jsxRuntime.jsx(TypographyVariantContext.Provider, {
3270
+ value: variant,
3271
+ children: /*#__PURE__*/jsxRuntime.jsx(TypographyFamilyContext.Provider, {
3272
+ value: typographyFamily,
3273
+ children: /*#__PURE__*/jsxRuntime.jsx(TypographyTypeContext.Provider, {
3274
+ value: typographyType,
3275
+ children: text
3276
+ })
3261
3277
  })
3262
3278
  }) : text;
3263
3279
  return color ? /*#__PURE__*/jsxRuntime.jsx(TypographyColorContext.Provider, {
@@ -11011,17 +11027,19 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
11011
11027
  fontWeights: {
11012
11028
  headings: {
11013
11029
  regular: theme.typography.types.headings.fontWeight.regular,
11030
+ semibold: theme.typography.types.headings.fontWeight.semibold,
11014
11031
  bold: theme.typography.types.headings.fontWeight.bold
11015
11032
  },
11016
11033
  bodies: {
11017
- regular: theme.typography.types.bodies.fontWeight.regular
11018
- // 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
11034
+ regular: theme.typography.types.bodies.fontWeight.regular,
11035
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
11036
+ bold: reactNative.Platform.OS === 'android' ? 400 : theme.typography.types.bodies.fontWeight.bold
11019
11037
  },
11020
11038
  labels: {
11021
11039
  semibold: theme.typography.types.labels.fontWeight.semibold
11022
11040
  },
11023
11041
  contentCaps: {
11024
- // 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
11042
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
11025
11043
  bold: reactNative.Platform.OS === 'android' ? 400 : theme.typography.types.contentCaps.fontWeight.bold
11026
11044
  }
11027
11045
  },