From ad8e0fb5a636a7ed66182137a660f544ac27fa57 Mon Sep 17 00:00:00 2001 From: jahnli Date: Mon, 7 Oct 2024 16:53:27 +0800 Subject: [PATCH] feat(input): add `font-weight` theme variable (#6419) Co-authored-by: 07akioni <07akioni2@gmail.com> --- CHANGELOG.en-US.md | 2 +- CHANGELOG.zh-CN.md | 1 + src/input/src/Input.tsx | 3 ++- src/input/src/styles/input.cssr.ts | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index b83b70705..f70b1c329 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -14,7 +14,7 @@ - `n-date-picker` adds `date-format` prop. - `n-progress`'s `color` prop supports gradient config. - `n-select` adds `font-weight` theme variable - +- `n-input` adds `font-weight` theme variable ## 2.40.1 diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 433cf793b..fa3c1c17d 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -14,6 +14,7 @@ - `n-date-picker` 新增 `date-format` 属性 - `n-progress` 的 `color` 属性支持渐变色配置 - `n-select` 新增 `font-weight` 主题变量 +- `n-input` 新增 `font-weight` 主题变量 ## 2.40.1 diff --git a/src/input/src/Input.tsx b/src/input/src/Input.tsx index 78a5252a8..36a353975 100644 --- a/src/input/src/Input.tsx +++ b/src/input/src/Input.tsx @@ -904,7 +904,7 @@ export default defineComponent({ const cssVarsRef = computed(() => { const { value: size } = mergedSizeRef const { - common: { cubicBezierEaseInOut }, + common: { cubicBezierEaseInOut, fontWeight }, self: { color, borderRadius, @@ -961,6 +961,7 @@ export default defineComponent({ '--n-count-text-color-disabled': countTextColorDisabled, '--n-color': color, '--n-font-size': fontSize, + '--n-font-weight': fontWeight, '--n-border-radius': borderRadius, '--n-height': height, '--n-padding-left': paddingLeft, diff --git a/src/input/src/styles/input.cssr.ts b/src/input/src/styles/input.cssr.ts index 5eeced8da..a7352877f 100644 --- a/src/input/src/styles/input.cssr.ts +++ b/src/input/src/styles/input.cssr.ts @@ -48,6 +48,7 @@ export default cB('input', ` background-color: var(--n-color); transition: background-color .3s var(--n-bezier); font-size: var(--n-font-size); + font-weight: var(--n-font-weight); --n-padding-vertical: calc((var(--n-height) - 1.5 * var(--n-font-size)) / 2); `, [ // common