Skip to content

Commit

Permalink
fix(config): fix padding on textarea
Browse files Browse the repository at this point in the history
  • Loading branch information
iljs committed May 20, 2024
1 parent e38d594 commit 6f7ec6b
Show file tree
Hide file tree
Showing 45 changed files with 58 additions and 11 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added .github/.DS_Store
Binary file not shown.
Binary file added actions/.DS_Store
Binary file not shown.
Binary file added cypress/.DS_Store
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xxs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xxs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xxs-line-height);
${textAreaTokens.labelInnerTop}: 0rem;
${textAreaTokens.labelInnerMarginBottom}: 0rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-xs-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-xs-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-xs-font-style);
Expand Down Expand Up @@ -72,6 +74,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${textAreaTokens.labelInnerTop}: 0.375rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-s-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-s-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-s-font-style);
Expand Down Expand Up @@ -111,6 +115,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${textAreaTokens.labelInnerTop}: 0.375rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-m-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-m-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-m-font-style);
Expand Down Expand Up @@ -150,6 +156,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${textAreaTokens.labelInnerTop}: 0.5625rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-l-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-l-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-l-font-style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const meta: Meta<TextAreaProps> = {
...disableProps([
'helperBlock',
'$isFocused',
'label',
'contentRight',
'autoComplete',
'autoFocus',
Expand Down
Binary file added packages/plasma-icons/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ export const tokens = {
labelInnerLetterSpacing: '--plasma-textarea-label-inner-letter-spacing',
/** Высота строки для элемента label, когда он внутри и уменьшен */
labelInnerLineHeight: '--plasma-textarea-label-inner-line-height',
/** Отступ сверху для элемента textarea при фокусе */
labelInnerTop: '--plasma-textarea-label-inner-top',
/** Отступ между Label и TextArea */
labelInnerMarginBottom: '--plasma-textarea-label-inner-margin-bottom',
/** Шрифт для элемента textarea */
inputFontFamily: '--plasma-textarea-input-font-family',
/** Размер шрифта для элемента textarea */
Expand Down
16 changes: 13 additions & 3 deletions packages/plasma-new-hope/src/components/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const fallbackStatusMap = {

// TODO: Перенести этот метод в файл applyDynamicLabel.ts
export const getDynamicLabelClasses = (props: TextAreaProps, focused: boolean) => {
const { readOnly, label, labelPlacement, autoResize, rows, value } = props;
const { readOnly, label, labelPlacement, autoResize, rows, value, size } = props;

// Добавить класс отвечающий за изменение цвета плейсхолдера при фокусе
const withFocusedOuterUpPlaceholder =
Expand All @@ -64,6 +64,7 @@ export const getDynamicLabelClasses = (props: TextAreaProps, focused: boolean) =
label &&
!autoResize &&
!rows &&
size !== 'xs' &&
((!readOnly && (value || focused)) || (readOnly && value))
? innerPlaceholderUp
: undefined;
Expand All @@ -72,7 +73,8 @@ export const getDynamicLabelClasses = (props: TextAreaProps, focused: boolean) =
const withHidePlaceholder =
(value && !label) ||
(labelPlacement === 'inner' && ((focused && !readOnly) || value) && label && (rows || autoResize)) ||
(labelPlacement === 'outer' && value)
(labelPlacement === 'outer' && value) ||
(labelPlacement === 'inner' && size === 'xs' && value)
? hidePlaceHolder
: undefined;

Expand Down Expand Up @@ -153,7 +155,15 @@ export const textAreaRoot = (Root: RootProps<HTMLTextAreaElement, TextAreaProps>
);

const dynamicLabelClasses = getDynamicLabelClasses(
{ readOnly, label, labelPlacement, autoResize, rows, value: value || uncontrolledValue || defaultValue },
{
size,
readOnly,
label,
labelPlacement,
autoResize,
rows,
value: value || uncontrolledValue || defaultValue,
},
focused,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const {
export const applyDynamicLabel = `
.${String(innerPlaceholderUp)} {
.${String(styledTextArea)} {
height: calc(var(--plasma_private-textarea-input-actual-height) - 1rem);
height: calc(var(--plasma_private-textarea-input-actual-height) - var(${tokens.labelInnerTop}));
}
.${String(styledTextAreaWrapper)} {
padding-top: calc(var(${tokens.inputPaddingTop}) + 1rem);
padding-top: calc(calc(var(${tokens.labelInnerTop}) + var(${tokens.labelInnerFontSize})) + var(${
tokens.labelInnerMarginBottom
}));
}
.${String(styledPlaceholder)} {
Expand All @@ -26,6 +28,7 @@ export const applyDynamicLabel = `
font-weight: var(${tokens.labelInnerFontWeight});
letter-spacing: var(${tokens.labelInnerLetterSpacing});
line-height: var(${tokens.labelInnerLineHeight});
top: var(${tokens.labelInnerTop});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xxs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xxs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xxs-line-height);
${textAreaTokens.labelInnerTop}: 0rem;
${textAreaTokens.labelInnerMarginBottom}: 0rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-xs-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-xs-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-xs-font-style);
Expand Down Expand Up @@ -74,6 +76,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${textAreaTokens.labelInnerTop}: 0.375rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-s-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-s-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-s-font-style);
Expand Down Expand Up @@ -113,6 +117,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${textAreaTokens.labelInnerTop}: 0.375rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-m-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-m-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-m-font-style);
Expand Down Expand Up @@ -152,6 +158,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${textAreaTokens.labelInnerTop}: 0.5625rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-l-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-l-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-l-font-style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const config = {
${textAreaTokens.inputMinHeight}: 0.625rem;
${textAreaTokens.borderRadius}: 0.5rem;
${textAreaTokens.borderRadiusWithHelpers}: 0.5rem;
${textAreaTokens.inputPaddingTop}: 0.563rem;
${textAreaTokens.inputPaddingTop}: 0.5625rem;
${textAreaTokens.inputPaddingRight}: 0.625rem;
${textAreaTokens.inputPaddingRightWithRightContent}: 2.125rem;
${textAreaTokens.inputPaddingBottom}: 0.563rem;
Expand All @@ -36,6 +36,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xxs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xxs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xxs-line-height);
${textAreaTokens.labelInnerTop}: 0rem;
${textAreaTokens.labelInnerMarginBottom}: 0rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-xs-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-xs-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-xs-font-style);
Expand All @@ -55,7 +57,7 @@ export const config = {
${textAreaTokens.inputMinHeight}: 0.625rem;
${textAreaTokens.borderRadius}: 0.625rem;
${textAreaTokens.borderRadiusWithHelpers}: 0.625rem;
${textAreaTokens.inputPaddingTop}: 0.688rem;
${textAreaTokens.inputPaddingTop}: 0.6875rem;
${textAreaTokens.inputPaddingRight}: 0.875rem;
${textAreaTokens.inputPaddingRightWithRightContent}: 3.125rem;
${textAreaTokens.inputPaddingBottom}: 0.75rem;
Expand All @@ -76,6 +78,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${textAreaTokens.labelInnerTop}: 0.375rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-s-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-s-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-s-font-style);
Expand Down Expand Up @@ -116,6 +120,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${textAreaTokens.labelInnerTop}: 0.375rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-m-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-m-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-m-font-style);
Expand All @@ -135,7 +141,7 @@ export const config = {
${textAreaTokens.inputMinHeight}: 1.625rem;
${textAreaTokens.borderRadius}: 0.875rem;
${textAreaTokens.borderRadiusWithHelpers}: 0.875rem;
${textAreaTokens.inputPaddingTop}: 1.063rem;
${textAreaTokens.inputPaddingTop}: 1rem;
${textAreaTokens.inputPaddingRight}: 1.125rem;
${textAreaTokens.inputPaddingRightWithRightContent}: 3.625rem;
${textAreaTokens.inputPaddingBottom}: 0.75rem;
Expand All @@ -156,6 +162,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-body-xs-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-body-xs-line-height);
${textAreaTokens.labelInnerTop}: 0.5625rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body-l-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body-l-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body-l-font-style);
Expand Down
Binary file added packages/plasma-tokens-b2b/.DS_Store
Binary file not shown.
Binary file added packages/plasma-tokens-b2c/.DS_Store
Binary file not shown.
Binary file added packages/plasma-tokens-web/.DS_Store
Binary file not shown.
10 changes: 9 additions & 1 deletion packages/plasma-web/src/components/TextArea/TextArea.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: 400;
${textAreaTokens.labelInnerLetterSpacing}: -0.02em;
${textAreaTokens.labelInnerLineHeight}: 0.75rem;
${textAreaTokens.labelInnerTop}: 0rem;
${textAreaTokens.labelInnerMarginBottom}: 0rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-caption-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-caption-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-caption-font-style);
Expand Down Expand Up @@ -74,6 +76,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-caption-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-caption-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-caption-line-height);
${textAreaTokens.labelInnerTop}: 0.375rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-footnote1-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-footnote1-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-footnote1-font-style);
Expand Down Expand Up @@ -114,6 +118,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-caption-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-caption-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-caption-line-height);
${textAreaTokens.labelInnerTop}: 0.375rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: var(--plasma-typo-body1-font-family);
${textAreaTokens.inputFontSize}: var(--plasma-typo-body1-font-size);
${textAreaTokens.inputFontStyle}: var(--plasma-typo-body1-font-style);
Expand All @@ -133,7 +139,7 @@ export const config = {
${textAreaTokens.inputMinHeight}: 1.625rem;
${textAreaTokens.borderRadius}: 0.875rem;
${textAreaTokens.borderRadiusWithHelpers}: 0.875rem;
${textAreaTokens.inputPaddingTop}: 1.063rem;
${textAreaTokens.inputPaddingTop}: 1rem;
${textAreaTokens.inputPaddingRight}: 1.125rem;
${textAreaTokens.inputPaddingRightWithRightContent}: 3.625rem;
${textAreaTokens.inputPaddingBottom}: 0.75rem;
Expand All @@ -154,6 +160,8 @@ export const config = {
${textAreaTokens.labelInnerFontWeight}: var(--plasma-typo-caption-font-weight);
${textAreaTokens.labelInnerLetterSpacing}: var(--plasma-typo-caption-letter-spacing);
${textAreaTokens.labelInnerLineHeight}: var(--plasma-typo-caption-line-height);
${textAreaTokens.labelInnerTop}: 0.5625rem;
${textAreaTokens.labelInnerMarginBottom}: 0.125rem;
${textAreaTokens.inputFontFamily}: 'SB Sans Text','SBSansText',sans-serif;
${textAreaTokens.inputFontSize}: 1.125rem;
${textAreaTokens.inputFontStyle}: normal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const meta: Meta<TextAreaProps> = {
},
...disableProps([
'$isFocused',
'label',
'contentRight',
'autoComplete',
'autoFocus',
Expand Down
Binary file added packages/themes/.DS_Store
Binary file not shown.
Binary file added scripts/.DS_Store
Binary file not shown.
Binary file added utils/.DS_Store
Binary file not shown.
Binary file added website/.DS_Store
Binary file not shown.

0 comments on commit 6f7ec6b

Please sign in to comment.