@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.
@@ -3063,6 +3063,7 @@ const getTypographyTypeWithAncestorValue = (type, typographyTypeInContext) => {
3063
3063
 
3064
3064
  const TypographyFamilyContext = /*#__PURE__*/createContext(null);
3065
3065
  const TypographyTypeContext = /*#__PURE__*/createContext(null);
3066
+ const TypographyVariantContext = /*#__PURE__*/createContext(undefined);
3066
3067
  const TypographyColorContext = /*#__PURE__*/createContext('black');
3067
3068
  function useTypographyColor() {
3068
3069
  return useContext(TypographyColorContext);
@@ -3161,7 +3162,7 @@ function getUniversalFontWeight(type, variant, typographyFamily) {
3161
3162
  ThrowErrorIfInvalidVariant(variant, value, 'regular');
3162
3163
  resolvedVariant = 'regular';
3163
3164
  }
3164
- webFontWeight[typeName] = resolvedVariant;
3165
+ webFontWeight[typeName] = `${typographyFamily}.${resolvedVariant}`;
3165
3166
  nativeFontFamily[typeName] = `${typographyFamily}.${resolvedVariant}`;
3166
3167
  });
3167
3168
  return {
@@ -3188,24 +3189,36 @@ const TypographyBase = /*#__PURE__*/forwardRef(({
3188
3189
  ...otherProps
3189
3190
  }, ref) => {
3190
3191
  const sx = useSx();
3192
+
3193
+ // ancestors
3191
3194
  const typographyFamilyInContext = useContext(TypographyFamilyContext);
3192
3195
  const typographyTypeInContext = useContext(TypographyTypeContext);
3193
- const defaultColor = useTypographyDefaultColor();
3196
+ const typographyVariantInContext = useContext(TypographyVariantContext);
3197
+
3198
+ // family
3194
3199
  const hasTypographyAncestor = typographyFamilyInContext !== null;
3195
3200
  const typographyType = getTypographyTypeWithAncestorValue(type, typographyTypeInContext);
3196
3201
  const baseOrDefaultToBody = typographyType.base ?? 'body-m';
3197
3202
  const typographyFamily = getTypographyFamilyWithAncestorValue(baseOrDefaultToBody, typographyFamilyInContext);
3203
+
3204
+ // size
3198
3205
  const fontSizeForNativeBase = createNativeBaseFontSize({
3199
3206
  ...type,
3200
3207
  base: baseOrDefaultToBody
3201
3208
  });
3209
+
3210
+ // weight
3211
+
3202
3212
  const {
3203
3213
  webFontWeight,
3204
3214
  nativeFontFamily
3205
3215
  } = getUniversalFontWeight({
3206
3216
  ...type,
3207
3217
  base: baseOrDefaultToBody
3208
- }, variant, typographyFamily);
3218
+ }, !variant && typographyType === typographyTypeInContext ? typographyVariantInContext : variant, typographyFamily);
3219
+
3220
+ // color
3221
+ const defaultColor = useTypographyDefaultColor();
3209
3222
  const currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
3210
3223
  const currentColorValue = getTypographyColorValue(currentColor);
3211
3224
  const colorStyles = sx({
@@ -3230,11 +3243,14 @@ const TypographyBase = /*#__PURE__*/forwardRef(({
3230
3243
  ...colorStyles,
3231
3244
  ...otherProps
3232
3245
  });
3233
- const content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3234
- value: typographyFamily,
3235
- children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3236
- value: typographyType,
3237
- children: text
3246
+ const content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyVariantContext.Provider, {
3247
+ value: variant,
3248
+ children: /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3249
+ value: typographyFamily,
3250
+ children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3251
+ value: typographyType,
3252
+ children: text
3253
+ })
3238
3254
  })
3239
3255
  }) : text;
3240
3256
  return color ? /*#__PURE__*/jsx(TypographyColorContext.Provider, {
@@ -10988,17 +11004,19 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
10988
11004
  fontWeights: {
10989
11005
  headings: {
10990
11006
  regular: theme.typography.types.headings.fontWeight.regular,
11007
+ semibold: theme.typography.types.headings.fontWeight.semibold,
10991
11008
  bold: theme.typography.types.headings.fontWeight.bold
10992
11009
  },
10993
11010
  bodies: {
10994
- regular: theme.typography.types.bodies.fontWeight.regular
10995
- // 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
11011
+ regular: theme.typography.types.bodies.fontWeight.regular,
11012
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
11013
+ bold: Platform.OS === 'android' ? 400 : theme.typography.types.bodies.fontWeight.bold
10996
11014
  },
10997
11015
  labels: {
10998
11016
  semibold: theme.typography.types.labels.fontWeight.semibold
10999
11017
  },
11000
11018
  contentCaps: {
11001
- // 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
11019
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
11002
11020
  bold: Platform.OS === 'android' ? 400 : theme.typography.types.contentCaps.fontWeight.bold
11003
11021
  }
11004
11022
  },