@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.
@@ -3069,6 +3069,7 @@ const getTypographyTypeWithAncestorValue = (type, typographyTypeInContext) => {
3069
3069
  const _excluded$R = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
3070
3070
  const TypographyFamilyContext = /*#__PURE__*/createContext(null);
3071
3071
  const TypographyTypeContext = /*#__PURE__*/createContext(null);
3072
+ const TypographyVariantContext = /*#__PURE__*/createContext(undefined);
3072
3073
  const TypographyColorContext = /*#__PURE__*/createContext('black');
3073
3074
  function useTypographyColor() {
3074
3075
  return useContext(TypographyColorContext);
@@ -3166,7 +3167,7 @@ function getUniversalFontWeight(type, variant, typographyFamily) {
3166
3167
  ThrowErrorIfInvalidVariant(variant, value, 'regular');
3167
3168
  resolvedVariant = 'regular';
3168
3169
  }
3169
- webFontWeight[typeName] = resolvedVariant;
3170
+ webFontWeight[typeName] = `${typographyFamily}.${resolvedVariant}`;
3170
3171
  nativeFontFamily[typeName] = `${typographyFamily}.${resolvedVariant}`;
3171
3172
  });
3172
3173
  return {
@@ -3195,22 +3196,34 @@ const TypographyBase = /*#__PURE__*/forwardRef((_ref, ref) => {
3195
3196
  } = _ref,
3196
3197
  otherProps = _objectWithoutProperties(_ref, _excluded$R);
3197
3198
  const sx = useSx();
3199
+
3200
+ // ancestors
3198
3201
  const typographyFamilyInContext = useContext(TypographyFamilyContext);
3199
3202
  const typographyTypeInContext = useContext(TypographyTypeContext);
3200
- const defaultColor = useTypographyDefaultColor();
3203
+ const typographyVariantInContext = useContext(TypographyVariantContext);
3204
+
3205
+ // family
3201
3206
  const hasTypographyAncestor = typographyFamilyInContext !== null;
3202
3207
  const typographyType = getTypographyTypeWithAncestorValue(type, typographyTypeInContext);
3203
3208
  const baseOrDefaultToBody = (_typographyType$base = typographyType.base) !== null && _typographyType$base !== void 0 ? _typographyType$base : 'body-m';
3204
3209
  const typographyFamily = getTypographyFamilyWithAncestorValue(baseOrDefaultToBody, typographyFamilyInContext);
3210
+
3211
+ // size
3205
3212
  const fontSizeForNativeBase = createNativeBaseFontSize(_objectSpread(_objectSpread({}, type), {}, {
3206
3213
  base: baseOrDefaultToBody
3207
3214
  }));
3215
+
3216
+ // weight
3217
+
3208
3218
  const {
3209
3219
  webFontWeight,
3210
3220
  nativeFontFamily
3211
3221
  } = getUniversalFontWeight(_objectSpread(_objectSpread({}, type), {}, {
3212
3222
  base: baseOrDefaultToBody
3213
- }), variant, typographyFamily);
3223
+ }), !variant && typographyType === typographyTypeInContext ? typographyVariantInContext : variant, typographyFamily);
3224
+
3225
+ // color
3226
+ const defaultColor = useTypographyDefaultColor();
3214
3227
  const currentColor = !color && !hasTypographyAncestor ? defaultColor : color;
3215
3228
  const currentColorValue = getTypographyColorValue(currentColor);
3216
3229
  const colorStyles = sx({
@@ -3233,11 +3246,14 @@ const TypographyBase = /*#__PURE__*/forwardRef((_ref, ref) => {
3233
3246
  fontFamily: nativeFontFamily,
3234
3247
  textTransform: typographyFamily === 'contentCaps' ? 'uppercase' : undefined
3235
3248
  }, colorStyles), otherProps));
3236
- const content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3237
- value: typographyFamily,
3238
- children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3239
- value: typographyType,
3240
- children: text
3249
+ const content = baseOrDefaultToBody ? /*#__PURE__*/jsx(TypographyVariantContext.Provider, {
3250
+ value: variant,
3251
+ children: /*#__PURE__*/jsx(TypographyFamilyContext.Provider, {
3252
+ value: typographyFamily,
3253
+ children: /*#__PURE__*/jsx(TypographyTypeContext.Provider, {
3254
+ value: typographyType,
3255
+ children: text
3256
+ })
3241
3257
  })
3242
3258
  }) : text;
3243
3259
  return color ? /*#__PURE__*/jsx(TypographyColorContext.Provider, {
@@ -11003,17 +11019,19 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
11003
11019
  fontWeights: {
11004
11020
  headings: {
11005
11021
  regular: theme.typography.types.headings.fontWeight.regular,
11022
+ semibold: theme.typography.types.headings.fontWeight.semibold,
11006
11023
  bold: theme.typography.types.headings.fontWeight.bold
11007
11024
  },
11008
11025
  bodies: {
11009
- regular: theme.typography.types.bodies.fontWeight.regular
11010
- // 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
11026
+ regular: theme.typography.types.bodies.fontWeight.regular,
11027
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
11028
+ bold: Platform.OS === 'android' ? 400 : theme.typography.types.bodies.fontWeight.bold
11011
11029
  },
11012
11030
  labels: {
11013
11031
  semibold: theme.typography.types.labels.fontWeight.semibold
11014
11032
  },
11015
11033
  contentCaps: {
11016
- // 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
+ // TODO [expo@>=53]: Check if still needed with new expo-fonts version
11017
11035
  bold: Platform.OS === 'android' ? 400 : theme.typography.types.contentCaps.fontWeight.bold
11018
11036
  }
11019
11037
  },