@ornikar/kitt-universal 29.4.1-canary.cbb5dfd9b37cae9e4b2943cbcdd994e53c1d96d8.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);
@@ -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, {