/
sdds
/
plasma
Обзор
Документация
Войти
/
sdds
/
plasma
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
dev
packages/sdds-sbcom/src/components/CodeField/CodeField.config.ts
112 строк
4 KB
Alexander Lobyntsev
fix(sbcom): use theme tokens in component configs
27 апр 2026, 14:10
27 апр 2026, 14:10
d633bc9
Код
Авторство
О чём код?
import { css, codeFieldTokens as tokens } from '@salutejs/plasma-new-hope/styled-components'; import { bodyL, bodyLBold, bodyM, bodyMBold, bodyS, surfaceAccent, surfaceTransparentNegative, surfaceTransparentPrimary, surfaceTransparentPrimaryHover, surfaceTransparentSecondary, textNegative, textPrimary, textSecondary, } from '@salutejs-ds/sdds_sbcom/theme/tokens'; /* * NOTE: Mixed DS tokens + raw vars. Prefer @salutejs-ds/sdds_sbcom/theme/tokens where possible. * Missing tokens in @salutejs/sdds-themes/tokens: bodyXs, outlineAccent */ export const config = { defaults: { view: 'default', size: 'l', shape: 'default', }, variations: { view: { default: css` ${tokens.caretColor}: ${surfaceAccent}; ${tokens.captionColor}: ${textSecondary}; ${tokens.captionColorError}: ${textNegative}; ${tokens.codeColor}: ${textPrimary}; ${tokens.codeColorError}: ${textNegative}; ${tokens.borderColorFocus}: var(--outline-accent); ${tokens.backgroundColor}: ${surfaceTransparentPrimary}; ${tokens.backgroundColorHover}: ${surfaceTransparentPrimaryHover}; ${tokens.backgroundColorFocus}: ${surfaceTransparentSecondary}; ${tokens.backgroundErrorColor}: ${surfaceTransparentNegative}; `, }, size: { l: css` ${tokens.captionGap}: 0.875rem; ${tokens.codeItemsGap}: 0.125rem; ${tokens.separatorWidth}: 0.25rem; ${tokens.codeItemWidth}: 2.75rem; ${tokens.codeItemHeight}: 3.5rem; ${tokens.fontFamily}: ${bodyL.fontFamily}; ${tokens.fontSize}: ${bodyL.fontSize}; ${tokens.fontStyle}: ${bodyL.fontStyle}; ${tokens.fontWeight}: ${bodyLBold.fontWeight}; ${tokens.letterSpacing}: ${bodyL.letterSpacing}; ${tokens.lineHeight}: ${bodyL.lineHeight}; ${tokens.captionFontFamily}: ${bodyS.fontFamily}; ${tokens.captionFontSize}: ${bodyS.fontSize}; ${tokens.captionFontStyle}: ${bodyS.fontStyle}; ${tokens.captionFontWeight}: ${bodyS.fontWeight}; ${tokens.captionLetterSpacing}: ${bodyS.letterSpacing}; ${tokens.captionLineHeight}: ${bodyS.lineHeight}; ${tokens.borderRadius}: 0.875rem; ${tokens.borderRadiusSegmented}: 0.375rem; ${tokens.segmentedSideBorderRadius}: 0.875rem; `, m: css` ${tokens.captionGap}: 0.75rem; ${tokens.codeItemsGap}: 0.125rem; ${tokens.separatorWidth}: 0.25rem; ${tokens.codeItemWidth}: 2.375rem; ${tokens.codeItemHeight}: 3rem; ${tokens.fontFamily}: ${bodyM.fontFamily}; ${tokens.fontSize}: ${bodyM.fontSize}; ${tokens.fontStyle}: ${bodyM.fontStyle}; ${tokens.fontWeight}: ${bodyMBold.fontWeight}; ${tokens.letterSpacing}: ${bodyM.letterSpacing}; ${tokens.lineHeight}: ${bodyM.lineHeight}; ${tokens.captionFontFamily}: var(--plasma-typo-body-xs-font-family); ${tokens.captionFontSize}: var(--plasma-typo-body-xs-font-size); ${tokens.captionFontStyle}: var(--plasma-typo-body-xs-font-style); ${tokens.captionFontWeight}: var(--plasma-typo-body-xs-font-weight); ${tokens.captionLetterSpacing}: var(--plasma-typo-body-xs-letter-spacing); ${tokens.captionLineHeight}: var(--plasma-typo-body-xs-line-height); ${tokens.borderRadius}: 0.75rem; ${tokens.borderRadiusSegmented}: 0.25rem; ${tokens.segmentedSideBorderRadius}: 0.75rem; `, }, shape: { default: css``, segmented: css``, }, disabled: { true: css` ${tokens.disabledOpacity}: 0.4; `, }, }, };