feat(styles): export shared field variant maps and restore the border fallback
HD-05 scope, against heroui ce90ea3 styles sources: - add labelVariants/descriptionVariants/fieldErrorVariants/ textFieldVariants/switchGroupVariants (+ VariantProps types) to @heroui-vue/styles and re-export them from @heroui-vue/components; variant keys, defaultVariants and slot sets match the pinned *.styles.ts files key for key (hv- namespace only) - Label/Description/FieldError/useTextField/SwitchGroup now consume those mappings instead of inline class strings, so the state classes have a single source; rendered class output is unchanged and pinned by tests/shared-field-styles.test.ts (mapping output <-> component output) - restore the global border-color fallback (*, ::after, ::before, ::backdrop, ::file-selector-button -> border-color: var(--border, currentColor)) in a new base/base.css, imported layer(base) right after preflight like the pinned entry: a low-priority default that components, utilities and consumer CSS override without !important - view-transition globals from the pinned base.css stay unported: no View Transitions API usage exists in the library or docs site - shared-styles package contract: packed runtime exports from both entries, variant-output assertions, CSS tokens incl. the fallback, strict nodenext+bundler type contract, and a real-browser consumer fixture (light/dark --border, explicit colors, consumer overrides, currentColor fallback) wired into check-package.mjs - docs: styling layers/border fallback/exports notes, five component API pages, compatibility matrix and upstream source records Full suite 111 files / 1634 tests, typecheck and build:docs pass; shared-styles + api-root-aliases + handbook-styles verified against the final tarballs.
This commit is contained in:
@@ -83,6 +83,8 @@ HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态
|
||||
|
||||
Description 组件使用以下 CSS 类([查看源码样式](https://github.com/heroui-inc/heroui/blob/v3/packages/styles/components/description.css)):
|
||||
|
||||
> 变体映射 `descriptionVariants` 从 `@heroui-vue/styles` 公开(`@heroui-vue/components` 再导出同一函数与 `DescriptionVariants` 类型);组件渲染的类名由该映射生成。
|
||||
|
||||
#### 基础类 [!toc]
|
||||
|
||||
- `.hv-description` - 基础描述样式,使用 `muted` 文本颜色
|
||||
|
||||
@@ -178,6 +178,8 @@ HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态
|
||||
|
||||
FieldError 组件使用以下 CSS 类([查看源码样式](https://github.com/heroui-inc/heroui/blob/v3/packages/styles/components/field-error.css)):
|
||||
|
||||
> 变体映射 `fieldErrorVariants` 从 `@heroui-vue/styles` 公开(`@heroui-vue/components` 再导出同一函数与 `FieldErrorVariants` 类型);组件渲染的类名由该映射生成。
|
||||
|
||||
#### 基础类 [!toc]
|
||||
|
||||
- `.hv-field-error` - 基础错误样式,danger 色
|
||||
|
||||
@@ -88,6 +88,8 @@ HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态
|
||||
|
||||
Label 使用以下 CSS 类([查看源码样式](https://github.com/heroui-inc/heroui/blob/v3/packages/styles/components/label.css)):
|
||||
|
||||
> 变体映射 `labelVariants` 从 `@heroui-vue/styles` 公开(`@heroui-vue/components` 再导出同一函数与 `LabelVariants` 类型);组件渲染的类名由该映射生成,状态修饰类随 `isDisabled` / `isInvalid` / `isRequired` 输出。
|
||||
|
||||
#### 基础类 [!toc]
|
||||
|
||||
- `.hv-label` — 基础标签文本样式
|
||||
|
||||
@@ -182,6 +182,8 @@ SwitchGroup 组件使用以下 CSS 类([查看源码样式](https://github.com
|
||||
- `.hv-switch-group--horizontal` - 横向布局
|
||||
- `.hv-switch-group--vertical` - 纵向布局(默认)
|
||||
|
||||
> 变体映射 `switchGroupVariants` 从 `@heroui-vue/styles` 公开(`@heroui-vue/components` 再导出同一函数与 `SwitchGroupVariants` 类型),提供 `base` / `items` 两个槽;组件渲染的类名由该映射生成。
|
||||
|
||||
### 交互状态
|
||||
|
||||
该 Switch 同时支持 CSS 伪类与 data 属性,以提供更灵活的状态控制:
|
||||
|
||||
@@ -133,6 +133,8 @@ HeroUI 遵循 [BEM](https://getbem.com/) 方法论,确保组件变体与状态
|
||||
|
||||
- `.hv-textfield` – 根容器,样式极少(`flex flex-col gap-1`)
|
||||
|
||||
> 变体映射 `textFieldVariants` 从 `@heroui-vue/styles` 公开(`@heroui-vue/components` 再导出同一函数与 `TextFieldVariants` 类型);`full-width` 输出 `.hv-textfield--full-width`,组件根类名由该映射生成。
|
||||
|
||||
> **提示:** 子组件([Label](/components/label)、[Input](/components/input)、[TextArea](/components/textarea)、[Description](/components/description)、[FieldError](/components/field-error))各自拥有 CSS 类与样式,定制方式请参见对应文档。
|
||||
|
||||
### 交互状态
|
||||
|
||||
Reference in New Issue
Block a user