seam-react 0.12.3 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,13 +35,14 @@ export function Root() {
35
35
  }
36
36
  ```
37
37
 
38
- 组件包含:Button、Input、Switch、Tabs、Dialog、Toast、Tooltip、Sidebar。
38
+ 组件包含:Button、Input、Form、Switch、Tabs、Dialog、Toast、Tooltip、Sidebar。
39
39
 
40
40
  - Tabs 支持方向键切换、ARIA 关联与 fluid 指示器。
41
41
  - Switch 支持点击、键盘和拖拽 spring。
42
42
  - Dialog 提供 Root / Trigger / Content 与语义化内容层,自带 Motion 进出场、焦点陷阱、Esc 关闭与滚动锁定。
43
43
  - Toast 提供 `useToast` 状态队列与 `ToastStack` 呈现层,支持六向定位、自动关闭、状态图标、操作和拖拽关闭。
44
44
  - Tooltip 提供延迟显示、键盘与触屏访问、视口翻转/避让,以及可让相邻触发器共享并连续移动表面的 Group / Item 组合。
45
+ - Form 提供组合式字段、同步/异步规则、服务端错误和失败聚焦;安装 `valibot` 后可通过 `seam-react/valibot` 接入 schema 校验。
45
46
  - Sidebar 提供可折叠 Group、可配置分组间距,以及互斥的轨道与背景 hover 模式。
46
47
 
47
48
  完整文档:[chenhaojie9527.github.io/ui-kit](https://chenhaojie9527.github.io/ui-kit/)
@@ -1,4 +1,4 @@
1
- import { type FormHTMLAttributes, type HTMLAttributes, type LabelHTMLAttributes, type ReactElement, type ReactNode } from "react";
1
+ import { type FormHTMLAttributes, type HTMLAttributes, type LabelHTMLAttributes, type ReactElement, type ReactNode, type Ref } from "react";
2
2
  export type FormErrors<T extends Record<string, unknown> = Record<string, unknown>> = {
3
3
  [K in keyof T]?: string;
4
4
  } & Record<string, string | undefined>;
@@ -149,7 +149,9 @@ export interface FormActionsProps extends HTMLAttributes<HTMLDivElement> {
149
149
  export declare function useFormContext<T = Record<string, unknown>>(): FormContextValue<T>;
150
150
  export declare function useFieldState(name: string): FieldState;
151
151
  export declare function useWatch<T = unknown>(name: string | string[]): T;
152
- declare const FormRoot: import("react").ForwardRefExoticComponent<FormRootProps<Record<string, unknown>> & import("react").RefAttributes<FormRef<Record<string, unknown>>>>;
152
+ declare const FormRoot: <T extends Record<string, unknown> = Record<string, unknown>>(props: FormRootProps<T> & {
153
+ ref?: Ref<FormRef>;
154
+ }) => ReactElement | null;
153
155
  declare function FormField({ name, defaultValue, rules, transform, disabled, readOnly, hidden, preserveOnUnmount, dependencies, children, className, }: FormFieldProps): ReactElement | null;
154
156
  declare const FormLabel: import("react").ForwardRefExoticComponent<FormLabelProps & import("react").RefAttributes<HTMLLabelElement>>;
155
157
  declare function FormControl({ children }: FormControlProps): ReactElement;