@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.
@@ -3072,6 +3072,7 @@ const getTypographyTypeWithAncestorValue = (type, typographyTypeInContext) => {
3072
3072
 
3073
3073
  const TypographyFamilyContext = /*#__PURE__*/createContext(null);
3074
3074
  const TypographyTypeContext = /*#__PURE__*/createContext(null);
3075
+ const TypographyVariantContext = /*#__PURE__*/createContext(undefined);
3075
3076
  const TypographyColorContext = /*#__PURE__*/createContext('black');
3076
3077
  function useTypographyColor() {
3077
3078
  return useContext(TypographyColorContext);
@@ -3170,7 +3171,7 @@ function getUniversalFontWeight(type, variant, typographyFamily) {
3170
3171
  ThrowErrorIfInvalidVariant(variant, value, 'regular');
3171
3172
  resolvedVariant = 'regular';
3172
3173
  }
3173
- webFontWeight[typeName] = resolvedVariant;
3174
+ webFontWeight[typeName] = `${typographyFamily}.${resolvedVariant}`;
3174
3175
  nativeFontFamily[typeName] = `${typographyFamily}.${resolvedVariant}`;
3175
3176
  });
3176
3177
  return {
@@ -3197,24 +3198,36 @@ const TypographyBase = /*#__PURE__*/forwardRef(({
3197
3198
  ...otherProps
3198
3199
  }, ref) => {
3199
3200
  const sx = useSx();
3201
+
3202
+ // ancestors
3200
3203
  const typographyFamilyInContext = useContext(TypographyFamilyContext);
3201
3204
  const typographyTypeInContext = useContext(TypographyTypeContext);
3202
- const defaultColor = useTypographyDefaultColor();
3205
+ const typographyVariantInContext = useContext(TypographyVariantContext);
3206
+
3207
+ // family
3203
3208
  const hasTypographyAncestor = typographyFamilyInContext !== null;
3204
3209
  const typographyType = getTypographyTypeWithAncestorValue(type, typographyTypeInContext);
3205
3210
  const baseOrDefaultToBody = typographyType.base ?? 'body-m';
3206
3211
  const typographyFamily = getTypographyFamilyWithAncestorValue(baseOrDefaultToBody, typographyFamilyInContext);
3212
+
3213
+ // size
3207
3214
  const fontSizeForNativeBase = createNativeBaseFontSize({
3208
3215
  ...type,
3209
3216
  base: baseOrDefaultToBody
3210
3217
  });
3218
+
3219
+ // weight
3220
+
3211
3221
  const {
3212
3222
  webFontWeight,
3213
3223
  nativeFontFamily
3214
3224
  } = getUniversalFontWeight({
3215
3225
  ...type,
3216
3226
  base: baseOrDefaultToBody
3217
- }, variant, typographyFamily);
3227
+ }, !variant && typographyType === typographyTypeInContext ? typographyVariantInContext : variant, typographyFamily);
3228
+
3229
+ // color
3230
+ const defaultColor = useTypographyDefaultColor();
3218
3231
  const currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
3219
3232
  const currentColorValue = getTypographyColorValue(currentColor);
3220
3233
  const colorStyles = sx({
@@ -3239,11 +3252,14 @@ const TypographyBase = /*#__PURE__*/forwardRef(({
3239
3252
  ...colorStyles,
3240
3253
  ...otherProps
3241
3254
  });
3242
- const content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3243
- value: typographyFamily,
3244
- children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3245
- value: typographyType,
3246
- children: text
3255
+ const content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyVariantContext.Provider, {
3256
+ value: variant,
3257
+ children: /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3258
+ value: typographyFamily,
3259
+ children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3260
+ value: typographyType,
3261
+ children: text
3262
+ })
3247
3263
  })
3248
3264
  }) : text;
3249
3265
  return color ? /*#__PURE__*/jsx(TypographyColorContext.Provider, {
@@ -10194,17 +10210,19 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10194
10210
  fontWeights: {
10195
10211
  headings: {
10196
10212
  regular: theme.typography.types.headings.fontWeight.regular,
10213
+ semibold: theme.typography.types.headings.fontWeight.semibold,
10197
10214
  bold: theme.typography.types.headings.fontWeight.bold
10198
10215
  },
10199
10216
  bodies: {
10200
- regular: theme.typography.types.bodies.fontWeight.regular
10201
- // 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
10217
+ regular: theme.typography.types.bodies.fontWeight.regular,
10218
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
10219
+ bold: theme.typography.types.bodies.fontWeight.bold
10202
10220
  },
10203
10221
  labels: {
10204
10222
  semibold: theme.typography.types.labels.fontWeight.semibold
10205
10223
  },
10206
10224
  contentCaps: {
10207
- // 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
10225
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
10208
10226
  bold: theme.typography.types.contentCaps.fontWeight.bold
10209
10227
  }
10210
10228
  },