/
sdds
/
plasma
Обзор
Документация
Войти
/
sdds
/
plasma
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
dev
packages/sdds-cs/src/components/TextField/TextField.config.ts
258 строк
15 KB
Dima Shugaev
feat(sdds-cs): get rid of styled-components
31 мар 2026, 11:13
31 мар 2026, 11:13
a4628f6
Код
Авторство
О чём код?
import { css, textFieldTokens as tokens } from '@salutejs/plasma-new-hope/emotion'; export const config = { defaults: { view: 'default', size: 's', labelPlacement: 'outer', }, variations: { view: { default: css` ${tokens.color}: var(--text-primary); ${tokens.backgroundColor}: var(--surface-solid-card); ${tokens.backgroundColorFocus}: var(--surface-solid-card-active); ${tokens.caretColor}: var(--text-accent); ${tokens.placeholderColor}: var(--text-secondary); ${tokens.placeholderColorFocus}: var(--text-tertiary); ${tokens.textBeforeColor}: var(--text-secondary); ${tokens.textAfterColor}: var(--text-secondary); ${tokens.labelColor}: var(--text-primary); ${tokens.leftHelperColor}: var(--text-secondary); ${tokens.titleCaptionColor}: var(--text-secondary); ${tokens.hintIconColor}: var(--text-secondary); ${tokens.contentSlotColor}: var(--text-secondary); ${tokens.contentSlotColorHover}: var(--text-secondary-hover); ${tokens.contentSlotColorActive}: var(--text-secondary-active); ${tokens.contentSlotRightColor}: var(--text-accent); ${tokens.contentSlotRightColorHover}: var(--text-accent-minor); ${tokens.contentSlotRightColorActive}: var(--text-accent-active); ${tokens.chipCloseIconColor}: var(--text-secondary); ${tokens.chipCloseIconColorReadonly}: var(--text-secondary); ${tokens.chipCloseIconColorHover}: var(--text-primary); ${tokens.chipColor}: var(--text-primary); ${tokens.chipBackground}: var(--surface-transparent-secondary); ${tokens.chipColorHover}: var(--text-primary-hover); ${tokens.chipBackgroundHover}: var(--surface-transparent-secondary-hover); ${tokens.chipColorActive}: var(--text-primary); ${tokens.chipBackgroundActive}: var(--surface-transparent-secondary-active); ${tokens.chipBackgroundReadOnly}: var(--surface-transparent-secondary); ${tokens.chipColorReadOnly}: var(--text-primary); ${tokens.chipBackgroundReadOnlyHover}: var(--surface-transparent-secondary); ${tokens.chipColorReadOnlyHover}: var(--text-primary); ${tokens.chipOpacityReadonly}: 0.72; ${tokens.focusColor}: var(--text-accent); ${tokens.borderColor}: var(--outline-solid-primary); ${tokens.borderColorFocus}: var(--outline-accent); ${tokens.borderColorHover}: var(--outline-solid-primary-hover); ${tokens.indicatorColor}: var(--surface-negative); ${tokens.optionalColor}: var(--text-tertiary); `, negative: css` ${tokens.color}: var(--text-primary); ${tokens.backgroundColor}: var(--surface-solid-card); ${tokens.backgroundColorFocus}: var(--surface-solid-card-active); ${tokens.caretColor}: var(--text-accent); ${tokens.placeholderColor}: var(--text-secondary); ${tokens.placeholderColorFocus}: var(--text-tertiary); ${tokens.textBeforeColor}: var(--text-secondary); ${tokens.textAfterColor}: var(--text-secondary); ${tokens.labelColor}: var(--text-primary); ${tokens.leftHelperColor}: var(--text-negative); ${tokens.titleCaptionColor}: var(--text-secondary); ${tokens.hintIconColor}: var(--text-secondary); ${tokens.contentSlotColor}: var(--text-negative); ${tokens.contentSlotColorHover}: var(--text-negative-hover); ${tokens.contentSlotColorActive}: var(--text-negative-active); ${tokens.contentSlotRightColor}: var(--text-accent); ${tokens.contentSlotRightColorHover}: var(--text-accent-minor); ${tokens.contentSlotRightColorActive}: var(--text-accent-active); ${tokens.chipCloseIconColor}: var(--text-secondary); ${tokens.chipCloseIconColorReadonly}: var(--text-secondary); ${tokens.chipCloseIconColorHover}: var(--text-primary); ${tokens.chipColor}: var(--text-primary); ${tokens.chipBackground}: var(--surface-transparent-secondary); ${tokens.chipColorHover}: var(--text-primary); ${tokens.chipBackgroundHover}: var(--surface-transparent-secondary-hover); ${tokens.chipColorActive}: var(--text-primary); ${tokens.chipBackgroundActive}: var(--surface-transparent-secondary-active); ${tokens.chipBackgroundReadOnly}: var(--surface-transparent-secondary); ${tokens.chipColorReadOnly}: var(--text-primary); ${tokens.chipBackgroundReadOnlyHover}: var(--surface-transparent-secondary); ${tokens.chipColorReadOnlyHover}: var(--text-primary); ${tokens.chipOpacityReadonly}: 0.72; ${tokens.borderColor}: var(--text-negative); ${tokens.focusColor}: var(--text-negative); ${tokens.indicatorColor}: var(--surface-negative); ${tokens.optionalColor}: var(--text-tertiary); `, }, size: { s: css` ${tokens.height}: 2.5rem; ${tokens.padding}: 0.6875rem 0.75rem 0.6875rem 0.75rem; ${tokens.paddingWithChips}: 0.375rem; ${tokens.borderRadius}: 0.75rem; ${tokens.borderWidth}: 0.125rem; ${tokens.leftContentMargin}: -0.1875rem 0.25rem -0.1875rem -0.125rem; ${tokens.rightContentMargin}: -0.1875rem -0.125rem -0.1875rem 0.75rem; ${tokens.textBeforeMargin}: 0 0.25rem 0 0; ${tokens.textAfterMargin}: 0 0 0 0.25rem; ${tokens.fontFamily}: var(--plasma-typo-body-m-font-family); ${tokens.fontSize}: var(--plasma-typo-body-m-font-size); ${tokens.fontStyle}: var(--plasma-typo-body-m-font-style); ${tokens.fontWeight}: var(--plasma-typo-body-m-font-weight); ${tokens.letterSpacing}: var(--plasma-typo-body-m-letter-spacing); ${tokens.lineHeight}: var(--plasma-typo-body-m-line-height); ${tokens.labelOffset}: 0.5rem; ${tokens.labelFontFamily}: var(--plasma-typo-body-s-font-family); ${tokens.labelFontSize}: var(--plasma-typo-body-s-font-size); ${tokens.labelFontStyle}: var(--plasma-typo-body-s-font-style); ${tokens.labelFontWeight}: var(--plasma-typo-body-s-font-weight); ${tokens.labelLetterSpacing}: var(--plasma-typo-body-s-letter-spacing); ${tokens.labelLineHeight}: var(--plasma-typo-body-s-line-height); ${tokens.hintMargin}: -0.688rem -0.5rem; ${tokens.hintTargetSize}: 2.375rem; ${tokens.hintInnerLabelPlacementOffset}: 0.563rem -2.938rem auto auto; ${tokens.titleCaptionInnerLabelOffset}: 0.25rem; ${tokens.titleCaptionFontFamily}: var(--plasma-typo-body-xs-font-family); ${tokens.titleCaptionFontSize}: var(--plasma-typo-body-xs-font-size); ${tokens.titleCaptionFontStyle}: var(--plasma-typo-body-xs-font-style); ${tokens.titleCaptionFontWeight}: var(--plasma-typo-body-xs-font-weight); ${tokens.titleCaptionLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing); ${tokens.titleCaptionLineHeight}: var(--plasma-typo-body-xs-line-height); ${tokens.leftHelperOffset}: 0.25rem; ${tokens.leftHelperFontFamily}: var(--plasma-typo-body-s-font-family); ${tokens.leftHelperFontSize}: var(--plasma-typo-body-s-font-size); ${tokens.leftHelperFontStyle}: var(--plasma-typo-body-s-font-style); ${tokens.leftHelperFontWeight}: var(--plasma-typo-body-s-font-weight); ${tokens.leftHelperLetterSpacing}: var(--plasma-typo-body-s-letter-spacing); ${tokens.leftHelperLineHeight}: var(--plasma-typo-body-s-line-height); ${tokens.labelInnerPadding}: 0.3125rem 0 0 0; ${tokens.contentLabelInnerPadding}: 1.0625rem 0 0.3125rem 0; ${tokens.chipGap}: 0.25rem; ${tokens.chipBorderRadius}: 0.25rem; ${tokens.chipWidth}: auto; ${tokens.chipHeight}: 1.75rem; ${tokens.chipPadding}: 0 0.5rem 0 0.75rem; ${tokens.chipClearContentMarginLeft}: 0.375rem; ${tokens.chipClearContentMarginRight}: 0rem; ${tokens.chipCloseIconSize}: 1rem; ${tokens.chipFontFamily}: var(--plasma-typo-body-s-font-family); ${tokens.chipFontSize}: var(--plasma-typo-body-s-font-size); ${tokens.chipFontStyle}: var(--plasma-typo-body-s-font-style); ${tokens.chipFontWeight}: var(--plasma-typo-body-s-font-weight); ${tokens.chipLetterSpacing}: var(--plasma-typo-body-s-letter-spacing); ${tokens.chipLineHeight}: var(--plasma-typo-body-s-line-height); ${tokens.indicatorSizeInner}: 0.375rem; ${tokens.indicatorSizeOuter}: 0.375rem; ${tokens.indicatorLabelPlacementInner}: 0 0 0 0; ${tokens.indicatorLabelPlacementOuter}: 0.3125rem auto auto -0.6875rem; ${tokens.indicatorLabelPlacementInnerRight}: 0 0 auto auto; ${tokens.indicatorLabelPlacementOuterRight}: 0.25rem -0.625rem auto auto; `, }, labelPlacement: { outer: css``, }, hintView: { default: css` ${tokens.tooltipBackgroundColor}: var(--surface-solid-card-brightness); ${tokens.tooltipBoxShadow}: var(--shadow-down-hard-m, 0px 4px 12px 0px rgba(0, 0, 0, 0.16),0px 1px 4px 0px rgba(0, 0, 0, 0.08)); ${tokens.tooltipColor}: var(--text-primary); ${tokens.tooltipArrowBackground}: var(--surface-solid-card-brightness); `, }, hintSize: { m: css` ${tokens.tooltipPaddingTop}: 0.6875rem; ${tokens.tooltipPaddingRight}: 0.875rem; ${tokens.tooltipPaddingBottom}: 0.6875rem; ${tokens.tooltipPaddingLeft}: 0.875rem; ${tokens.tooltipMinHeight}: 2.5rem; ${tokens.tooltipBorderRadius}: 0.625rem; ${tokens.tooltipTextFontFamily}: var(--plasma-typo-body-s-font-family); ${tokens.tooltipTextFontSize}: var(--plasma-typo-body-s-font-size); ${tokens.tooltipTextFontStyle}: var(--plasma-typo-body-s-font-style); ${tokens.tooltipTextFontWeight}: var(--plasma-typo-body-s-font-weight); ${tokens.tooltipTextFontLetterSpacing}: var(--plasma-typo-body-s-letter-spacing); ${tokens.tooltipTextFontLineHeight}: var(--plasma-typo-body-s-line-height); ${tokens.tooltipContentLeftMargin}: 0.375rem; ${tokens.tooltipArrowMaskWidth}: 1.25rem; ${tokens.tooltipArrowMaskHeight}: 1.25rem; ${tokens.tooltipArrowMaskImage}: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggY2xpcC1ydWxlPSJldmVub2RkIiBkPSJtMC4xNywxMS44M2wyMCwwYy01LjUyLDAgLTEwLDMuNTkgLTEwLDhjMCwtNC40MSAtNC40OCwtOCAtMTAsLTh6IiBmaWxsPSIjMTcxNzE3IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGlkPSJUYWlsIi8+Cjwvc3ZnPg=="); ${tokens.tooltipArrowHeight}: 0.5rem; ${tokens.tooltipArrowEdgeMargin}: 0.625rem; `, s: css` ${tokens.tooltipPaddingTop}: 0.5rem; ${tokens.tooltipPaddingRight}: 0.75rem; ${tokens.tooltipPaddingBottom}: 0.5rem; ${tokens.tooltipPaddingLeft}: 0.75rem; ${tokens.tooltipMinHeight}: 2rem; ${tokens.tooltipBorderRadius}: 0.5rem; ${tokens.tooltipTextFontFamily}: var(--plasma-typo-body-xs-font-family); ${tokens.tooltipTextFontSize}: var(--plasma-typo-body-xs-font-size); ${tokens.tooltipTextFontStyle}: var(--plasma-typo-body-xs-font-style); ${tokens.tooltipTextFontWeight}: var(--plasma-typo-body-xs-font-weight); ${tokens.tooltipTextFontLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing); ${tokens.tooltipTextFontLineHeight}: var(--plasma-typo-body-xs-line-height); ${tokens.tooltipContentLeftMargin}: 0.25rem; ${tokens.tooltipArrowMaskWidth}: 1rem; ${tokens.tooltipArrowMaskHeight}: 1rem; ${tokens.tooltipArrowMaskImage}: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggY2xpcC1ydWxlPSJldmVub2RkIiBkPSJtMCw5Ljg1bDE2LDBjLTQuNDEsMCAtOCwyLjY5IC04LDZjMCwtMy4zMSAtMy41OSwtNiAtOCwtNnoiIGZpbGw9IiMxNzE3MTciIGZpbGwtcnVsZT0iZXZlbm9kZCIgaWQ9IlRhaWwiLz4KPC9zdmc+"); ${tokens.tooltipArrowHeight}: 0.375rem; ${tokens.tooltipArrowEdgeMargin}: 0.5625rem; `, }, disabled: { true: css` ${tokens.disabledOpacity}: 1; ${tokens.backgroundColor}: var(--surface-solid-primary); ${tokens.backgroundColorFocus}: var(--surface-solid-primary); ${tokens.borderColor}: var(--surface-solid-primary); ${tokens.borderColorHover}: var(--surface-solid-primary); ${tokens.borderColorFocus}: var(--surface-solid-primary); ${tokens.color}: var(--text-secondary); `, }, readOnly: { true: css` ${tokens.readOnlyOpacity}: 1; ${tokens.colorReadOnly}: var(--text-primary); ${tokens.backgroundColorReadOnly}: var(--surface-clear); ${tokens.placeholderColorReadOnly}: var(--text-secondary); ${tokens.leftHelperColorReadOnly}: var(--text-secondary); ${tokens.titleCaptionColorReadOnly}: var(--text-secondary); ${tokens.labelColorReadOnly}: var(--text-secondary); ${tokens.contentSlotRightOpacityReadOnly}: 0.4; ${tokens.borderColor}: transparent; ${tokens.borderWidth}: 0; `, }, }, };