From a64329c0a98ce2411ce17ddd74c2f451d6233763 Mon Sep 17 00:00:00 2001 From: shaharzil Date: Tue, 19 Mar 2024 13:13:39 +0200 Subject: [PATCH] fix(EditableTypography): fix specificity issues when changing types and weights --- .../components/EditableHeading/EditableHeading.tsx | 2 ++ .../src/components/EditableText/EditableText.tsx | 2 ++ .../EditableTypography/EditableTypography.tsx | 12 +++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/core/src/components/EditableHeading/EditableHeading.tsx b/packages/core/src/components/EditableHeading/EditableHeading.tsx index aeb958e2da..bcf2ffa0af 100644 --- a/packages/core/src/components/EditableHeading/EditableHeading.tsx +++ b/packages/core/src/components/EditableHeading/EditableHeading.tsx @@ -40,6 +40,8 @@ const EditableHeading: VibeComponent & { data-testid={dataTestId || getTestId(ComponentDefaultTestId.EDITABLE_HEADING, id)} component={Heading} typographyClassName={getStyle(styles, camelCase(type + "-" + weight))} + type={type} + weight={weight} {...editableTypographyProps} /> ); diff --git a/packages/core/src/components/EditableText/EditableText.tsx b/packages/core/src/components/EditableText/EditableText.tsx index 2eeb776f24..295a6ef94b 100644 --- a/packages/core/src/components/EditableText/EditableText.tsx +++ b/packages/core/src/components/EditableText/EditableText.tsx @@ -43,6 +43,8 @@ const EditableText: VibeComponent & { component={Text} typographyClassName={cx(getStyle(styles, camelCase(type + "-" + weight)), styles.typography)} clearable + type={type} + weight={weight} {...editableTypographyProps} /> ); diff --git a/packages/core/src/components/EditableTypography/EditableTypography.tsx b/packages/core/src/components/EditableTypography/EditableTypography.tsx index 227262f66a..e9b24fa0d4 100644 --- a/packages/core/src/components/EditableTypography/EditableTypography.tsx +++ b/packages/core/src/components/EditableTypography/EditableTypography.tsx @@ -8,6 +8,8 @@ import { keyCodes } from "../../constants"; import { useKeyboardButtonPressedFunc } from "../../hooks/useKeyboardButtonPressedFunc"; import { TooltipProps } from "../Tooltip/Tooltip"; import usePrevious from "../../hooks/usePrevious"; +import { TextType, TextWeight } from "../Text/TextConstants"; +import { HeadingType, HeadingWeight } from "../Heading/HeadingConstants"; export interface EditableTypographyImplementationProps { /** Value of the text */ @@ -37,6 +39,10 @@ export interface EditableTypographyProps extends VibeComponentProps, EditableTyp typographyClassName: string; /** Shows placeholder when empty, if provided */ clearable?: boolean; + /** Sets the Text/Heading type */ + type?: TextType | HeadingType; + /** Sets the Text/Heading weight */ + weight?: TextWeight | HeadingWeight; } const EditableTypography: VibeComponent = forwardRef( @@ -56,7 +62,9 @@ const EditableTypography: VibeComponent = component: TypographyComponent, isEditMode, onEditModeChange, - tooltipProps + tooltipProps, + type, + weight }, ref ) => { @@ -191,6 +199,8 @@ const EditableTypography: VibeComponent = })} tabIndex={0} tooltipProps={tooltipProps} + weight={weight} + type={type} > {inputValue || placeholder}