seam-react 0.0.0-stage → 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ChenHaoJie9527
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
1
+ # seam-react
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 基于 `seam-hooks` 的 React 组件库,内置可访问性与主题 token。
4
+
5
+ ## 安装
6
+
7
+ 包发布在 npm,安装不需要访问令牌:
8
+
9
+ ```bash
10
+ pnpm add seam-react
11
+ # 或
12
+ npm install seam-react
13
+ ```
14
+
15
+ 也可以从 JSR 安装 `@seam/ui`。
16
+
17
+ ## 使用
18
+
19
+ ```tsx
20
+ import { Button, Tabs, Dialog } from "seam-react";
21
+ import { SeamStyles } from "seam-react/styles";
22
+
23
+ export function Root() {
24
+ return (
25
+ <>
26
+ <SeamStyles />
27
+ <Button>保存</Button>
28
+ </>
29
+ );
30
+ }
31
+ ```
32
+
33
+ 组件包含:Button、Input、Switch、Tabs、Dialog。
34
+
35
+ - Tabs 支持方向键切换、ARIA 关联与 fluid 指示器。
36
+ - Switch 支持点击、键盘和拖拽 spring。
37
+ - Dialog 提供 Root / Trigger / Content 与语义化内容层,自带 Motion 进出场、焦点陷阱、Esc 关闭与滚动锁定。
38
+
39
+ 完整文档:[chenhaojie9527.github.io/ui-kit](https://chenhaojie9527.github.io/ui-kit/)
40
+
41
+ ## License
42
+
43
+ MIT
@@ -0,0 +1,21 @@
1
+ import { type ButtonHTMLAttributes, type ForwardRefExoticComponent, type ReactNode, type RefAttributes } from "react";
2
+ export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
3
+ export type ButtonSize = "sm" | "md" | "lg";
4
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
5
+ /** 视觉层级,默认 primary。 */
6
+ variant?: ButtonVariant;
7
+ /** 尺寸,默认 md。 */
8
+ size?: ButtonSize;
9
+ /** 展示加载指示器并禁用点击。 */
10
+ loading?: boolean;
11
+ /** 仅包含图标时使用方形内边距,需自行提供 aria-label。 */
12
+ iconOnly?: boolean;
13
+ children?: ReactNode;
14
+ }
15
+ /**
16
+ * 基础按钮。
17
+ *
18
+ * 样式由 data-variant / data-size 驱动,所有原生 button 属性都会透传。
19
+ * loading 时自动设置 disabled 与 aria-busy,避免重复提交。
20
+ */
21
+ export declare const Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,89 @@
1
+ import { type ForwardRefExoticComponent, type HTMLAttributes, type ReactElement, type ReactNode, type RefAttributes, type RefObject } from "react";
2
+ export interface DialogProps {
3
+ /** 是否打开。由调用方控制,配合 onOpenChange 使用。 */
4
+ open: boolean;
5
+ /** 打开状态变化时触发,用于同步外部 state。 */
6
+ onOpenChange: (open: boolean) => void;
7
+ title?: ReactNode;
8
+ description?: ReactNode;
9
+ footer?: ReactNode;
10
+ children?: ReactNode;
11
+ /** 关闭按钮的无障碍名称,默认 Close。 */
12
+ closeLabel?: string;
13
+ showCloseButton?: boolean;
14
+ /** 点击遮罩是否关闭,默认 true。 */
15
+ closeOnBackdropClick?: boolean;
16
+ /** 按 Esc 是否关闭,默认 true。 */
17
+ closeOnEscape?: boolean;
18
+ /** 打开后优先聚焦的元素;不传则聚焦第一个可聚焦元素。 */
19
+ initialFocusRef?: RefObject<HTMLElement | null>;
20
+ /** 关闭后恢复焦点的元素;默认恢复到打开前的活动元素。 */
21
+ returnFocusRef?: RefObject<HTMLElement | null>;
22
+ className?: string;
23
+ "aria-label"?: string;
24
+ }
25
+ export interface DialogRootProps {
26
+ children: ReactNode;
27
+ /** 受控打开状态。 */
28
+ open?: boolean;
29
+ /** 非受控模式下的初始状态。 */
30
+ defaultOpen?: boolean;
31
+ /** 打开状态变化时触发。 */
32
+ onOpenChange?: (open: boolean) => void;
33
+ }
34
+ /** Dialog 状态与语义 ID 的根节点。 */
35
+ declare function DialogRoot({ children, open, defaultOpen, onOpenChange, }: DialogRootProps): ReactElement;
36
+ export interface DialogTriggerProps {
37
+ children: ReactElement;
38
+ }
39
+ /** 包装一个交互元素,同步 dialog 的状态与 ARIA 关联。 */
40
+ declare function DialogTrigger({ children }: DialogTriggerProps): ReactElement;
41
+ export interface DialogCloseProps {
42
+ children?: ReactElement;
43
+ label?: string;
44
+ }
45
+ /** 包装关闭触发器,或渲染一个默认关闭按钮。 */
46
+ declare function DialogClose({ children, label, }: DialogCloseProps): ReactElement;
47
+ export type DialogHeaderProps = HTMLAttributes<HTMLElement>;
48
+ declare const DialogHeader: ForwardRefExoticComponent<DialogHeaderProps & RefAttributes<HTMLElement>>;
49
+ export type DialogTitleProps = HTMLAttributes<HTMLHeadingElement>;
50
+ declare const DialogTitle: ForwardRefExoticComponent<DialogTitleProps & RefAttributes<HTMLHeadingElement>>;
51
+ export type DialogDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
52
+ declare const DialogDescription: ForwardRefExoticComponent<DialogDescriptionProps & RefAttributes<HTMLParagraphElement>>;
53
+ export type DialogBodyProps = HTMLAttributes<HTMLDivElement>;
54
+ declare const DialogBody: ForwardRefExoticComponent<DialogBodyProps & RefAttributes<HTMLDivElement>>;
55
+ export type DialogFooterProps = HTMLAttributes<HTMLElement>;
56
+ declare const DialogFooter: ForwardRefExoticComponent<DialogFooterProps & RefAttributes<HTMLElement>>;
57
+ export interface DialogContentProps {
58
+ children?: ReactNode;
59
+ className?: string;
60
+ closeOnBackdropClick?: boolean;
61
+ closeOnEscape?: boolean;
62
+ initialFocusRef?: RefObject<HTMLElement | null>;
63
+ returnFocusRef?: RefObject<HTMLElement | null>;
64
+ "aria-label"?: string;
65
+ "aria-labelledby"?: string;
66
+ "aria-describedby"?: string;
67
+ }
68
+ /** Portal、原生 dialog、焦点与 presence 生命周期的语义层。 */
69
+ declare function DialogContent({ children, closeOnBackdropClick, closeOnEscape, initialFocusRef, returnFocusRef, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, }: DialogContentProps): ReactElement | null;
70
+ export interface DialogComponent {
71
+ (props: DialogProps): ReactElement;
72
+ Root: typeof DialogRoot;
73
+ Trigger: typeof DialogTrigger;
74
+ Content: typeof DialogContent;
75
+ Header: typeof DialogHeader;
76
+ Title: typeof DialogTitle;
77
+ Description: typeof DialogDescription;
78
+ Body: typeof DialogBody;
79
+ Footer: typeof DialogFooter;
80
+ Close: typeof DialogClose;
81
+ }
82
+ /**
83
+ * 模态对话框。
84
+ *
85
+ * 组合式 API 由 Root / Trigger / Content 和各语义层组成;无子组件的调用
86
+ * 保留既有 title / description / footer slot API。
87
+ */
88
+ export declare const Dialog: DialogComponent;
89
+ export {};
@@ -0,0 +1,15 @@
1
+ import { type ForwardRefExoticComponent, type InputHTMLAttributes, type RefAttributes } from "react";
2
+ export type InputSize = "sm" | "md" | "lg";
3
+ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
4
+ /** 输入框尺寸,默认 md。原生 size 属性被该字段替代。 */
5
+ inputSize?: InputSize;
6
+ /** 标记校验失败状态,等同于 aria-invalid="true"。 */
7
+ invalid?: boolean;
8
+ }
9
+ /**
10
+ * 文本输入框。
11
+ *
12
+ * 只负责样式与校验状态,label、提示文案与错误信息由调用方组合,
13
+ * 这样表单结构可以完全自定义。
14
+ */
15
+ export declare const Input: ForwardRefExoticComponent<InputProps & RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,11 @@
1
+ import type { ReactElement } from "react";
2
+ export interface SeamStylesProps {
3
+ /** 与 Content Security Policy 的 style-src nonce 保持一致。 */
4
+ nonce?: string;
5
+ }
6
+ /**
7
+ * JSR 不支持 CSS package exports,因此将样式以内联 style 标签提供。
8
+ *
9
+ * 在应用根部渲染一次即可。使用 npm 构建时仍可继续导入 styles.css。
10
+ */
11
+ export declare function SeamStyles({ nonce }: SeamStylesProps): ReactElement;
@@ -0,0 +1,18 @@
1
+ import { type ForwardRefExoticComponent, type InputHTMLAttributes, type ReactNode, type RefAttributes } from "react";
2
+ export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "checked" | "defaultChecked" | "onChange"> {
3
+ /** 受控选中状态。传入即进入受控模式。 */
4
+ checked?: boolean;
5
+ /** 非受控模式下的初始状态。 */
6
+ defaultChecked?: boolean;
7
+ /** 状态变化回调,受控与非受控都会触发。 */
8
+ onCheckedChange?: (checked: boolean) => void;
9
+ /** 显示在开关右侧的标签文本。 */
10
+ children?: ReactNode;
11
+ }
12
+ /**
13
+ * 开关。
14
+ *
15
+ * 底层是原生 checkbox(role="switch"),所以表单提交、键盘操作和
16
+ * 屏幕阅读器语义都是免费的;视觉部分由 track / thumb 两个 span 承担。
17
+ */
18
+ export declare const Switch: ForwardRefExoticComponent<SwitchProps & RefAttributes<HTMLInputElement>>;
package/dist/Tabs.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { type ButtonHTMLAttributes, type ForwardRefExoticComponent, type HTMLAttributes, type ReactElement, type ReactNode, type RefAttributes } from "react";
2
+ export type TabsOrientation = "horizontal" | "vertical";
3
+ interface TabsBaseProps {
4
+ onValueChange?: (value: string) => void;
5
+ orientation?: TabsOrientation;
6
+ className?: string;
7
+ children: ReactNode;
8
+ }
9
+ export type TabsProps = TabsBaseProps & ({
10
+ value: string;
11
+ defaultValue?: never;
12
+ } | {
13
+ value?: never;
14
+ defaultValue: string;
15
+ });
16
+ export interface TabsListProps extends HTMLAttributes<HTMLDivElement> {
17
+ children?: ReactNode;
18
+ }
19
+ declare const TabsList: ForwardRefExoticComponent<TabsListProps & RefAttributes<HTMLDivElement>>;
20
+ export interface TabsTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
21
+ value: string;
22
+ children?: ReactNode;
23
+ }
24
+ declare const TabsTrigger: ForwardRefExoticComponent<TabsTriggerProps & RefAttributes<HTMLButtonElement>>;
25
+ export interface TabsContentProps extends HTMLAttributes<HTMLDivElement> {
26
+ value: string;
27
+ children?: ReactNode;
28
+ }
29
+ declare const TabsContent: ForwardRefExoticComponent<TabsContentProps & RefAttributes<HTMLDivElement>>;
30
+ /**
31
+ * 标签页。
32
+ *
33
+ * 组合式 API:Tabs / Tabs.List / Tabs.Trigger / Tabs.Content。
34
+ * 实现 roving tabindex、方向键循环、Home/End 跳转,并自动生成
35
+ * aria-controls / aria-labelledby 关联。
36
+ */
37
+ export interface TabsComponent {
38
+ (props: TabsProps): ReactElement;
39
+ List: typeof TabsList;
40
+ Trigger: typeof TabsTrigger;
41
+ Content: typeof TabsContent;
42
+ }
43
+ export declare const Tabs: TabsComponent;
44
+ export {};
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),i=require("react"),I=require("motion/react"),W=require("react-dom"),R=require("seam-hooks");function m(...o){return o.filter(Boolean).join(" ")}const M=i.forwardRef(function({variant:e="primary",size:n="md",loading:r=!1,iconOnly:s=!1,type:l="button",className:c,children:f,...d},u){return a.jsxs("button",{...d,ref:u,type:l,className:m("uk-button",c),"data-variant":e,"data-size":n,"data-loading":r?"true":void 0,"data-icon-only":s?"true":void 0,disabled:d.disabled||r,"aria-busy":r||void 0,children:[r?a.jsx("span",{className:"uk-button__spinner","aria-hidden":"true"}):null,f]})}),J=i.forwardRef(function({inputSize:e="md",invalid:n=!1,className:r,"aria-invalid":s,...l},c){return a.jsx("input",{...l,ref:c,className:m("uk-input",r),"data-size":e,"aria-invalid":n?!0:s})}),Q=[.23,1,.32,1],S={type:"spring",bounce:0,duration:.3},L={type:"spring",bounce:.04,duration:.38},Z={type:"spring",bounce:.08,duration:.34},A={duration:.12,ease:Q},ee=i.forwardRef(function({checked:e,defaultChecked:n,onCheckedChange:r,disabled:s,className:l,children:c,id:f,...d},u){const g=i.useId(),b=f??g,C=I.useReducedMotion()??!1,h=i.useRef(!1),x=i.useRef(null),[k,j]=R.useControllableState({value:e,defaultValue:n??!1,onChange:r}),D=I.useMotionValue(k?16:0);i.useEffect(()=>{if(x.current)return;const t=I.animate(D,k?16:0,C?{duration:0}:S);return()=>t.stop()},[k,C,D]);const _=t=>{const p=x.current;if(!(!p||p.pointerId!==t.pointerId)){if(p.moved){const T=p.samples[0],w=p.samples[p.samples.length-1],E=T&&w?Math.max(w.time-T.time,1):1,v=T&&w?(w.x-T.x)/E*1e3:0,y=Math.abs(v)>220?v>0:D.get()>=8;h.current=!0,x.current=null,j(y),I.animate(D,y?16:0,C?{duration:0}:{...S,velocity:v}),window.setTimeout(()=>{h.current=!1},0)}else x.current=null;t.currentTarget.hasPointerCapture(t.pointerId)&&typeof t.currentTarget.releasePointerCapture=="function"&&t.currentTarget.releasePointerCapture(t.pointerId)}};return a.jsxs("label",{className:m("uk-switch",l),"data-disabled":s?"true":void 0,htmlFor:b,onClickCapture:t=>{h.current&&(t.preventDefault(),t.stopPropagation())},children:[a.jsx("input",{...d,ref:u,id:b,type:"checkbox",role:"switch",className:"uk-switch__input",checked:k,disabled:s,"aria-checked":k,onChange:t=>j(t.target.checked)}),a.jsx("span",{className:"uk-switch__track","aria-hidden":"true",onPointerDown:t=>{s||(x.current={pointerId:t.pointerId,startX:t.clientX,startValue:D.get(),moved:!1,samples:[{x:t.clientX,time:performance.now()}]},typeof t.currentTarget.setPointerCapture=="function"&&t.currentTarget.setPointerCapture(t.pointerId))},onPointerMove:t=>{const p=x.current;if(!p||p.pointerId!==t.pointerId)return;const T=t.clientX-p.startX;Math.abs(T)>4&&(p.moved=!0),p.moved&&(t.preventDefault(),D.set(Math.max(0,Math.min(16,p.startValue+T))),p.samples.push({x:t.clientX,time:performance.now()}),p.samples=p.samples.filter(w=>performance.now()-w.time<120))},onPointerUp:_,onPointerCancel:_,children:a.jsx(I.motion.span,{className:"uk-switch__thumb",style:{x:D}})}),c?a.jsx("span",{className:"uk-switch__label",children:c}):null]})}),H=i.createContext(null);function P(o){const e=i.useContext(H);if(!e)throw new Error(`<${o}> must be rendered inside <Tabs>`);return e}function O(o,e){return`${o}-tab-${encodeURIComponent(e)}`}function $(o,e){return`${o}-panel-${encodeURIComponent(e)}`}function te({value:o,defaultValue:e,onValueChange:n,orientation:r="horizontal",className:s,children:l}){const c=i.useId(),[f,d]=R.useControllableState({value:o,defaultValue:e??"",onChange:n}),u=i.useMemo(()=>({baseId:c,value:f,setValue:d,orientation:r,indicatorId:`${c}-indicator`}),[c,f,r,d]);return a.jsx(H.Provider,{value:u,children:a.jsx("div",{className:m("uk-tabs",s),"data-orientation":r,children:l})})}const ne=i.forwardRef(function({className:e,onKeyDown:n,...r},s){const{orientation:l}=P("Tabs.List");return a.jsx("div",{...r,ref:s,role:"tablist","aria-orientation":l,tabIndex:-1,className:m("uk-tabs__list",e),onKeyDown:c=>{if(n?.(c),c.defaultPrevented)return;const d=c.target?.closest('[role="tab"]');if(!d||d.hasAttribute("disabled"))return;const u=Array.from(c.currentTarget.querySelectorAll('[role="tab"]:not([disabled])')),g=u.indexOf(d);if(g===-1)return;const b=l==="horizontal"?"ArrowRight":"ArrowDown",C=l==="horizontal"?"ArrowLeft":"ArrowUp";let h=-1;switch(c.key){case b:h=(g+1)%u.length;break;case C:h=(g-1+u.length)%u.length;break;case"Home":h=0;break;case"End":h=u.length-1;break;default:return}c.preventDefault();const x=u[h];x&&(x.focus(),x.click())}})}),re=i.forwardRef(function({value:e,type:n="button",className:r,onClick:s,children:l,...c},f){const d=P("Tabs.Trigger"),u=d.value===e,g=I.useReducedMotion()??!1;return a.jsxs("button",{...c,ref:f,type:n,role:"tab",id:O(d.baseId,e),"aria-selected":u,"aria-controls":$(d.baseId,e),tabIndex:u?0:-1,"data-state":u?"active":"inactive",className:m("uk-tabs__trigger",r),onClick:b=>{s?.(b),b.defaultPrevented||d.setValue(e)},children:[l,u?a.jsx(I.motion.span,{className:"uk-tabs__indicator",layoutId:d.indicatorId,"aria-hidden":"true",transition:g?{duration:0}:Z}):null]})}),oe=i.forwardRef(function({value:e,className:n,...r},s){const l=P("Tabs.Content"),c=l.value===e;return a.jsx("div",{...r,ref:s,role:"tabpanel",id:$(l.baseId,e),"aria-labelledby":O(l.baseId,e),hidden:!c,tabIndex:0,"data-state":c?"active":"inactive",className:m("uk-tabs__panel",n)})}),ae=Object.assign(te,{List:ne,Trigger:re,Content:oe}),V=i.createContext(null),se=()=>()=>{},ie=()=>!0,ce=()=>!1;function N(o){const e=i.useContext(V);if(!e)throw new Error(`<${o}> must be rendered inside <Dialog.Root>`);return e}function U(o,e){return n=>{o?.(n),n.defaultPrevented||e(n)}}function X({children:o,open:e,defaultOpen:n,onOpenChange:r}){const s=i.useId(),[l,c]=i.useState(!1),[f,d]=i.useState(!1),[u,g]=R.useControllableState({value:e,defaultValue:n??!1,onChange:r}),b=i.useMemo(()=>({open:u,setOpen:g,triggerId:`${s}-trigger`,contentId:`${s}-content`,titleId:`${s}-title`,descriptionId:`${s}-description`,hasTitle:l,setHasTitle:c,hasDescription:f,setHasDescription:d}),[s,u,f,l,g]);return a.jsx(V.Provider,{value:b,children:o})}function le({children:o}){const e=N("Dialog.Trigger"),n=o,r=n.props.onClick;return i.cloneElement(n,{id:e.triggerId,"aria-haspopup":"dialog","aria-expanded":e.open,"aria-controls":e.open?e.contentId:void 0,onClick:U(r,()=>{e.setOpen(!e.open)})})}function z({children:o,label:e="Close"}){const n=N("Dialog.Close");if(i.isValidElement(o)){const r=o,s=r.props.onClick;return i.cloneElement(r,{onClick:U(s,()=>{n.setOpen(!1)})})}return a.jsx(M,{variant:"ghost",onClick:()=>n.setOpen(!1),children:e})}const B=i.forwardRef(function({className:e,...n},r){return a.jsx("header",{...n,ref:r,className:m("uk-dialog__header",e)})}),F=i.forwardRef(function({className:e,children:n,...r},s){const l=N("Dialog.Title"),c=l.setHasTitle;return i.useEffect(()=>(c(!0),()=>c(!1)),[c]),a.jsx("h2",{...r,ref:s,id:l.titleId,className:m("uk-dialog__title",e),children:n})}),q=i.forwardRef(function({className:e,...n},r){const s=N("Dialog.Description"),l=s.setHasDescription;return i.useEffect(()=>(l(!0),()=>l(!1)),[l]),a.jsx("p",{...n,ref:r,id:s.descriptionId,className:m("uk-dialog__description",e)})}),K=i.forwardRef(function({className:e,...n},r){return a.jsx("div",{...n,ref:r,className:m("uk-dialog__body",e)})}),Y=i.forwardRef(function({className:e,...n},r){return a.jsx("footer",{...n,ref:r,className:m("uk-dialog__footer",e)})});function ue({requestClose:o,contentId:e,titleId:n,descriptionId:r,hasTitle:s,hasDescription:l,children:c,closeOnBackdropClick:f=!0,closeOnEscape:d=!0,initialFocusRef:u,returnFocusRef:g,className:b,"aria-label":C,"aria-labelledby":h,"aria-describedby":x}){const k=i.useRef(null),j=i.useRef(null),D=I.useIsPresent(),_=I.useReducedMotion()??!1;return R.useLockBodyScroll(!0),i.useLayoutEffect(()=>{const t=k.current;t&&(j.current??(j.current=document.activeElement instanceof HTMLElement?document.activeElement:null),!t.open&&(typeof t.showModal=="function"?t.showModal():t.setAttribute("open","")))},[]),R.useFocusTrap({active:!0,containerRef:k,initialFocusRef:u,returnFocusRef:g??j}),i.useEffect(()=>{const t=k.current;if(!t)return;const p=()=>{t.open||(typeof t.showModal=="function"?t.showModal():t.setAttribute("open",""))},T=()=>{if(!d){p();return}o()},w=y=>{y.preventDefault(),d&&o()},E=y=>{d||y.key!=="Escape"||y.defaultPrevented||(y.preventDefault(),y.stopPropagation())},v=y=>{f&&y.target===t&&o()};return t.addEventListener("close",T),t.addEventListener("cancel",w),t.addEventListener("keydown",E,!0),t.addEventListener("click",v),()=>{t.removeEventListener("close",T),t.removeEventListener("cancel",w),t.removeEventListener("keydown",E,!0),t.removeEventListener("click",v)}},[f,d,o]),a.jsx("dialog",{ref:k,id:e,className:m("uk-dialog",b),closedby:d||f?"any":"none","data-state":D?"open":"closed",inert:!D,"aria-label":C,"aria-labelledby":h??(C?void 0:s?n:void 0),"aria-describedby":x??(l?r:void 0),children:a.jsx(I.motion.div,{className:"uk-dialog__panel",initial:_?{opacity:0}:{opacity:0,transform:"translateY(12px) scale(0.96)"},animate:{opacity:1,transform:"translateY(0px) scale(1)",transition:_?A:{...L,delay:.06}},exit:_?{opacity:0,transition:A}:{opacity:0,transform:"translateY(8px) scale(0.97)",transition:L},children:c})})}function G({children:o,closeOnBackdropClick:e=!0,closeOnEscape:n=!0,initialFocusRef:r,returnFocusRef:s,className:l,"aria-label":c,"aria-labelledby":f,"aria-describedby":d}){const u=N("Dialog.Content"),g=R.useEventCallback(()=>{u.setOpen(!1)});return i.useSyncExternalStore(se,ie,ce)?W.createPortal(a.jsx(I.MotionConfig,{reducedMotion:"user",children:a.jsx(I.AnimatePresence,{children:u.open?a.jsx(ue,{requestClose:g,contentId:u.contentId,titleId:u.titleId,descriptionId:u.descriptionId,hasTitle:u.hasTitle,hasDescription:u.hasDescription,closeOnBackdropClick:e,closeOnEscape:n,initialFocusRef:r,returnFocusRef:s,className:l,"aria-label":c,"aria-labelledby":f,"aria-describedby":d,children:o},"uk-dialog"):null})}),document.body):null}function de({open:o,onOpenChange:e,title:n,description:r,footer:s,children:l,closeLabel:c="Close",showCloseButton:f=!0,closeOnBackdropClick:d=!0,closeOnEscape:u=!0,initialFocusRef:g,returnFocusRef:b,className:C,"aria-label":h}){return a.jsx(X,{open:o,onOpenChange:e,children:a.jsxs(G,{className:C,closeOnBackdropClick:d,closeOnEscape:u,initialFocusRef:g,returnFocusRef:b,"aria-label":h,children:[n||r||f?a.jsxs(B,{children:[a.jsxs("div",{className:"uk-dialog__heading",children:[n?a.jsx(F,{children:n}):null,r?a.jsx(q,{children:r}):null]}),f?a.jsx(z,{children:a.jsx(M,{variant:"ghost",size:"sm",iconOnly:!0,"aria-label":c,className:"uk-dialog__close",children:a.jsx("svg",{viewBox:"0 0 20 20",width:"16",height:"16","aria-hidden":"true",children:a.jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})})}):null]}):null,a.jsx(K,{children:l}),s?a.jsx(Y,{children:s}):null]})})}const fe=Object.assign(de,{Root:X,Trigger:le,Content:G,Header:B,Title:F,Description:q,Body:K,Footer:Y,Close:z});exports.Button=M;exports.Dialog=fe;exports.Input=J;exports.Switch=ee;exports.Tabs=ae;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/utils/cx.ts","../src/Button.tsx","../src/Input.tsx","../src/motion.ts","../src/Switch.tsx","../src/Tabs.tsx","../src/Dialog.tsx"],"sourcesContent":["/**\n * 拼接 className,忽略 false / null / undefined。\n */\nexport function cx(\n ...values: Array<string | false | null | undefined>\n): string {\n return values.filter(Boolean).join(\" \");\n}\n","import {\n forwardRef,\n type ButtonHTMLAttributes,\n type ForwardRefExoticComponent,\n type ReactNode,\n type RefAttributes,\n} from \"react\";\nimport { cx } from \"./utils/cx\";\n\nexport type ButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"outline\"\n | \"ghost\"\n | \"danger\";\n\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** 视觉层级,默认 primary。 */\n variant?: ButtonVariant;\n /** 尺寸,默认 md。 */\n size?: ButtonSize;\n /** 展示加载指示器并禁用点击。 */\n loading?: boolean;\n /** 仅包含图标时使用方形内边距,需自行提供 aria-label。 */\n iconOnly?: boolean;\n children?: ReactNode;\n}\n\n/**\n * 基础按钮。\n *\n * 样式由 data-variant / data-size 驱动,所有原生 button 属性都会透传。\n * loading 时自动设置 disabled 与 aria-busy,避免重复提交。\n */\nexport const Button: ForwardRefExoticComponent<\n ButtonProps & RefAttributes<HTMLButtonElement>\n> = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"primary\",\n size = \"md\",\n loading = false,\n iconOnly = false,\n type = \"button\",\n className,\n children,\n ...rest\n },\n ref,\n) {\n return (\n <button\n {...rest}\n ref={ref}\n type={type}\n className={cx(\"uk-button\", className)}\n data-variant={variant}\n data-size={size}\n data-loading={loading ? \"true\" : undefined}\n data-icon-only={iconOnly ? \"true\" : undefined}\n disabled={rest.disabled || loading}\n aria-busy={loading || undefined}\n >\n {loading ? (\n <span className=\"uk-button__spinner\" aria-hidden=\"true\" />\n ) : null}\n {children}\n </button>\n );\n});\n","import {\n forwardRef,\n type ForwardRefExoticComponent,\n type InputHTMLAttributes,\n type RefAttributes,\n} from \"react\";\nimport { cx } from \"./utils/cx\";\n\nexport type InputSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface InputProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"size\"\n> {\n /** 输入框尺寸,默认 md。原生 size 属性被该字段替代。 */\n inputSize?: InputSize;\n /** 标记校验失败状态,等同于 aria-invalid=\"true\"。 */\n invalid?: boolean;\n}\n\n/**\n * 文本输入框。\n *\n * 只负责样式与校验状态,label、提示文案与错误信息由调用方组合,\n * 这样表单结构可以完全自定义。\n */\nexport const Input: ForwardRefExoticComponent<\n InputProps & RefAttributes<HTMLInputElement>\n> = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n inputSize = \"md\",\n invalid = false,\n className,\n \"aria-invalid\": ariaInvalid,\n ...rest\n },\n ref,\n) {\n return (\n <input\n {...rest}\n ref={ref}\n className={cx(\"uk-input\", className)}\n data-size={inputSize}\n aria-invalid={invalid ? true : ariaInvalid}\n />\n );\n});\n","import type { Transition } from \"motion/react\";\n\nexport const EASE_OUT = [0.23, 1, 0.32, 1] as const;\nexport const EASE_IN_OUT = [0.77, 0, 0.175, 1] as const;\n\nexport const UI_SPRING: Transition = {\n type: \"spring\",\n bounce: 0,\n duration: 0.3,\n};\n\nexport const OVERLAY_SPRING: Transition = {\n type: \"spring\",\n bounce: 0.04,\n duration: 0.38,\n};\n\nexport const INDICATOR_SPRING: Transition = {\n type: \"spring\",\n bounce: 0.08,\n duration: 0.34,\n};\n\nexport const REDUCED_MOTION_TRANSITION: Transition = {\n duration: 0.12,\n ease: EASE_OUT,\n};\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n type ForwardRefExoticComponent,\n type InputHTMLAttributes,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n type RefAttributes,\n} from \"react\";\nimport {\n animate,\n motion,\n useMotionValue,\n useReducedMotion,\n} from \"motion/react\";\nimport { useControllableState } from \"seam-hooks\";\nimport { UI_SPRING } from \"./motion\";\nimport { cx } from \"./utils/cx\";\n\nexport interface SwitchProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"size\" | \"checked\" | \"defaultChecked\" | \"onChange\"\n> {\n /** 受控选中状态。传入即进入受控模式。 */\n checked?: boolean;\n /** 非受控模式下的初始状态。 */\n defaultChecked?: boolean;\n /** 状态变化回调,受控与非受控都会触发。 */\n onCheckedChange?: (checked: boolean) => void;\n /** 显示在开关右侧的标签文本。 */\n children?: ReactNode;\n}\n\n/**\n * 开关。\n *\n * 底层是原生 checkbox(role=\"switch\"),所以表单提交、键盘操作和\n * 屏幕阅读器语义都是免费的;视觉部分由 track / thumb 两个 span 承担。\n */\nexport const Switch: ForwardRefExoticComponent<\n SwitchProps & RefAttributes<HTMLInputElement>\n> = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n {\n checked,\n defaultChecked,\n onCheckedChange,\n disabled,\n className,\n children,\n id,\n ...rest\n },\n ref,\n) {\n const generatedId = useId();\n const inputId = id ?? generatedId;\n const reduceMotion = useReducedMotion() ?? false;\n const suppressClickRef = useRef(false);\n const dragRef = useRef<{\n pointerId: number;\n startX: number;\n startValue: number;\n moved: boolean;\n samples: Array<{ x: number; time: number }>;\n } | null>(null);\n\n const [current, setCurrent] = useControllableState<boolean>({\n value: checked,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n const thumbX = useMotionValue(current ? 16 : 0);\n\n useEffect(() => {\n if (dragRef.current) {\n return;\n }\n\n const controls = animate(\n thumbX,\n current ? 16 : 0,\n reduceMotion ? { duration: 0 } : UI_SPRING,\n );\n\n return () => controls.stop();\n }, [current, reduceMotion, thumbX]);\n\n const finishDrag = (event: ReactPointerEvent<HTMLSpanElement>) => {\n const drag = dragRef.current;\n\n if (!drag || drag.pointerId !== event.pointerId) {\n return;\n }\n\n if (drag.moved) {\n const first = drag.samples[0];\n const last = drag.samples[drag.samples.length - 1];\n const elapsed = first && last ? Math.max(last.time - first.time, 1) : 1;\n const velocity =\n first && last ? ((last.x - first.x) / elapsed) * 1000 : 0;\n const next = Math.abs(velocity) > 220 ? velocity > 0 : thumbX.get() >= 8;\n\n suppressClickRef.current = true;\n dragRef.current = null;\n setCurrent(next);\n animate(\n thumbX,\n next ? 16 : 0,\n reduceMotion ? { duration: 0 } : { ...UI_SPRING, velocity },\n );\n window.setTimeout(() => {\n suppressClickRef.current = false;\n }, 0);\n } else {\n dragRef.current = null;\n }\n\n if (\n event.currentTarget.hasPointerCapture(event.pointerId) &&\n typeof event.currentTarget.releasePointerCapture === \"function\"\n ) {\n event.currentTarget.releasePointerCapture(event.pointerId);\n }\n };\n\n return (\n <label\n className={cx(\"uk-switch\", className)}\n data-disabled={disabled ? \"true\" : undefined}\n htmlFor={inputId}\n onClickCapture={(event) => {\n if (suppressClickRef.current) {\n event.preventDefault();\n event.stopPropagation();\n }\n }}\n >\n <input\n {...rest}\n ref={ref}\n id={inputId}\n type=\"checkbox\"\n role=\"switch\"\n className=\"uk-switch__input\"\n checked={current}\n disabled={disabled}\n aria-checked={current}\n onChange={(event) => setCurrent(event.target.checked)}\n />\n <span\n className=\"uk-switch__track\"\n aria-hidden=\"true\"\n onPointerDown={(event) => {\n if (disabled) {\n return;\n }\n\n dragRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n startValue: thumbX.get(),\n moved: false,\n samples: [{ x: event.clientX, time: performance.now() }],\n };\n if (typeof event.currentTarget.setPointerCapture === \"function\") {\n event.currentTarget.setPointerCapture(event.pointerId);\n }\n }}\n onPointerMove={(event) => {\n const drag = dragRef.current;\n\n if (!drag || drag.pointerId !== event.pointerId) {\n return;\n }\n\n const delta = event.clientX - drag.startX;\n if (Math.abs(delta) > 4) {\n drag.moved = true;\n }\n\n if (!drag.moved) {\n return;\n }\n\n event.preventDefault();\n thumbX.set(Math.max(0, Math.min(16, drag.startValue + delta)));\n drag.samples.push({ x: event.clientX, time: performance.now() });\n drag.samples = drag.samples.filter(\n (sample) => performance.now() - sample.time < 120,\n );\n }}\n onPointerUp={finishDrag}\n onPointerCancel={finishDrag}\n >\n <motion.span className=\"uk-switch__thumb\" style={{ x: thumbX }} />\n </span>\n {children ? <span className=\"uk-switch__label\">{children}</span> : null}\n </label>\n );\n});\n","import {\n createContext,\n forwardRef,\n useContext,\n useId,\n useMemo,\n type ButtonHTMLAttributes,\n type ForwardRefExoticComponent,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n} from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\nimport { useControllableState } from \"seam-hooks\";\nimport { INDICATOR_SPRING } from \"./motion\";\nimport { cx } from \"./utils/cx\";\n\nexport type TabsOrientation = \"horizontal\" | \"vertical\";\n\ninterface TabsContextValue {\n baseId: string;\n value: string;\n setValue: (value: string) => void;\n orientation: TabsOrientation;\n indicatorId: string;\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(component: string): TabsContextValue {\n const context = useContext(TabsContext);\n\n if (!context) {\n throw new Error(`<${component}> must be rendered inside <Tabs>`);\n }\n\n return context;\n}\n\nfunction tabId(baseId: string, value: string) {\n return `${baseId}-tab-${encodeURIComponent(value)}`;\n}\n\nfunction panelId(baseId: string, value: string) {\n return `${baseId}-panel-${encodeURIComponent(value)}`;\n}\n\ninterface TabsBaseProps {\n onValueChange?: (value: string) => void;\n orientation?: TabsOrientation;\n className?: string;\n children: ReactNode;\n}\n\nexport type TabsProps = TabsBaseProps &\n (\n | { value: string; defaultValue?: never }\n | { value?: never; defaultValue: string }\n );\n\nfunction TabsRoot({\n value,\n defaultValue,\n onValueChange,\n orientation = \"horizontal\",\n className,\n children,\n}: TabsProps): ReactElement {\n const baseId = useId();\n const [current, setValue] = useControllableState<string>({\n value,\n defaultValue: defaultValue ?? \"\",\n onChange: onValueChange,\n });\n\n const context = useMemo<TabsContextValue>(\n () => ({\n baseId,\n value: current,\n setValue,\n orientation,\n indicatorId: `${baseId}-indicator`,\n }),\n [baseId, current, orientation, setValue],\n );\n\n return (\n <TabsContext.Provider value={context}>\n <div className={cx(\"uk-tabs\", className)} data-orientation={orientation}>\n {children}\n </div>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabsListProps extends HTMLAttributes<HTMLDivElement> {\n children?: ReactNode;\n}\n\nconst TabsList: ForwardRefExoticComponent<\n TabsListProps & RefAttributes<HTMLDivElement>\n> = forwardRef<HTMLDivElement, TabsListProps>(function TabsList(\n { className, onKeyDown, ...rest },\n ref,\n) {\n const { orientation } = useTabsContext(\"Tabs.List\");\n\n return (\n <div\n {...rest}\n ref={ref}\n role=\"tablist\"\n aria-orientation={orientation}\n tabIndex={-1}\n className={cx(\"uk-tabs__list\", className)}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n\n if (event.defaultPrevented) {\n return;\n }\n\n const target = event.target as HTMLElement | null;\n const trigger = target?.closest<HTMLElement>('[role=\"tab\"]');\n\n if (!trigger || trigger.hasAttribute(\"disabled\")) {\n return;\n }\n\n const triggers = Array.from(\n event.currentTarget.querySelectorAll<HTMLElement>(\n '[role=\"tab\"]:not([disabled])',\n ),\n );\n const index = triggers.indexOf(trigger);\n\n if (index === -1) {\n return;\n }\n\n const nextKey =\n orientation === \"horizontal\" ? \"ArrowRight\" : \"ArrowDown\";\n const previousKey =\n orientation === \"horizontal\" ? \"ArrowLeft\" : \"ArrowUp\";\n\n let nextIndex = -1;\n\n switch (event.key) {\n case nextKey:\n nextIndex = (index + 1) % triggers.length;\n break;\n case previousKey:\n nextIndex = (index - 1 + triggers.length) % triggers.length;\n break;\n case \"Home\":\n nextIndex = 0;\n break;\n case \"End\":\n nextIndex = triggers.length - 1;\n break;\n default:\n return;\n }\n\n event.preventDefault();\n\n const nextTrigger = triggers[nextIndex];\n\n if (nextTrigger) {\n nextTrigger.focus();\n nextTrigger.click();\n }\n }}\n />\n );\n});\n\nexport interface TabsTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n value: string;\n children?: ReactNode;\n}\n\nconst TabsTrigger: ForwardRefExoticComponent<\n TabsTriggerProps & RefAttributes<HTMLButtonElement>\n> = forwardRef<HTMLButtonElement, TabsTriggerProps>(function TabsTrigger(\n { value, type = \"button\", className, onClick, children, ...rest },\n ref,\n) {\n const context = useTabsContext(\"Tabs.Trigger\");\n const selected = context.value === value;\n const reduceMotion = useReducedMotion() ?? false;\n\n return (\n <button\n {...rest}\n ref={ref}\n type={type}\n role=\"tab\"\n id={tabId(context.baseId, value)}\n aria-selected={selected}\n aria-controls={panelId(context.baseId, value)}\n tabIndex={selected ? 0 : -1}\n data-state={selected ? \"active\" : \"inactive\"}\n className={cx(\"uk-tabs__trigger\", className)}\n onClick={(event) => {\n onClick?.(event);\n\n if (!event.defaultPrevented) {\n context.setValue(value);\n }\n }}\n >\n {children}\n {selected ? (\n <motion.span\n className=\"uk-tabs__indicator\"\n layoutId={context.indicatorId}\n aria-hidden=\"true\"\n transition={reduceMotion ? { duration: 0 } : INDICATOR_SPRING}\n />\n ) : null}\n </button>\n );\n});\n\nexport interface TabsContentProps extends HTMLAttributes<HTMLDivElement> {\n value: string;\n children?: ReactNode;\n}\n\nconst TabsContent: ForwardRefExoticComponent<\n TabsContentProps & RefAttributes<HTMLDivElement>\n> = forwardRef<HTMLDivElement, TabsContentProps>(function TabsContent(\n { value, className, ...rest },\n ref,\n) {\n const context = useTabsContext(\"Tabs.Content\");\n const selected = context.value === value;\n\n return (\n <div\n {...rest}\n ref={ref}\n role=\"tabpanel\"\n id={panelId(context.baseId, value)}\n aria-labelledby={tabId(context.baseId, value)}\n hidden={!selected}\n tabIndex={0}\n data-state={selected ? \"active\" : \"inactive\"}\n className={cx(\"uk-tabs__panel\", className)}\n />\n );\n});\n\n/**\n * 标签页。\n *\n * 组合式 API:Tabs / Tabs.List / Tabs.Trigger / Tabs.Content。\n * 实现 roving tabindex、方向键循环、Home/End 跳转,并自动生成\n * aria-controls / aria-labelledby 关联。\n */\nexport interface TabsComponent {\n (props: TabsProps): ReactElement;\n List: typeof TabsList;\n Trigger: typeof TabsTrigger;\n Content: typeof TabsContent;\n}\n\nexport const Tabs: TabsComponent = Object.assign(TabsRoot, {\n List: TabsList,\n Trigger: TabsTrigger,\n Content: TabsContent,\n});\n","import {\n cloneElement,\n createContext,\n forwardRef,\n isValidElement,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type ForwardRefExoticComponent,\n type HTMLAttributes,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n type RefObject,\n} from \"react\";\nimport {\n AnimatePresence,\n motion,\n MotionConfig,\n useIsPresent,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\nimport {\n useControllableState,\n useEventCallback,\n useFocusTrap,\n useLockBodyScroll,\n} from \"seam-hooks\";\nimport { Button } from \"./Button\";\nimport { OVERLAY_SPRING, REDUCED_MOTION_TRANSITION } from \"./motion\";\nimport { cx } from \"./utils/cx\";\n\nexport interface DialogProps {\n /** 是否打开。由调用方控制,配合 onOpenChange 使用。 */\n open: boolean;\n /** 打开状态变化时触发,用于同步外部 state。 */\n onOpenChange: (open: boolean) => void;\n title?: ReactNode;\n description?: ReactNode;\n footer?: ReactNode;\n children?: ReactNode;\n /** 关闭按钮的无障碍名称,默认 Close。 */\n closeLabel?: string;\n showCloseButton?: boolean;\n /** 点击遮罩是否关闭,默认 true。 */\n closeOnBackdropClick?: boolean;\n /** 按 Esc 是否关闭,默认 true。 */\n closeOnEscape?: boolean;\n /** 打开后优先聚焦的元素;不传则聚焦第一个可聚焦元素。 */\n initialFocusRef?: RefObject<HTMLElement | null>;\n /** 关闭后恢复焦点的元素;默认恢复到打开前的活动元素。 */\n returnFocusRef?: RefObject<HTMLElement | null>;\n className?: string;\n \"aria-label\"?: string;\n}\n\nexport interface DialogRootProps {\n children: ReactNode;\n /** 受控打开状态。 */\n open?: boolean;\n /** 非受控模式下的初始状态。 */\n defaultOpen?: boolean;\n /** 打开状态变化时触发。 */\n onOpenChange?: (open: boolean) => void;\n}\n\ninterface DialogContextValue {\n open: boolean;\n setOpen: (open: boolean) => void;\n triggerId: string;\n contentId: string;\n titleId: string;\n descriptionId: string;\n hasTitle: boolean;\n setHasTitle: (hasTitle: boolean) => void;\n hasDescription: boolean;\n setHasDescription: (hasDescription: boolean) => void;\n}\n\nconst DialogContext = createContext<DialogContextValue | null>(null);\n\nconst subscribeToNothing = () => () => {};\nconst getClientSnapshot = () => true;\nconst getServerSnapshot = () => false;\n\nfunction useDialogContext(component: string): DialogContextValue {\n const context = useContext(DialogContext);\n\n if (!context) {\n throw new Error(`<${component}> must be rendered inside <Dialog.Root>`);\n }\n\n return context;\n}\n\nfunction composeHandler<T extends { defaultPrevented: boolean }>(\n childHandler: ((event: T) => void) | undefined,\n handler: (event: T) => void,\n) {\n return (event: T) => {\n childHandler?.(event);\n\n if (!event.defaultPrevented) {\n handler(event);\n }\n };\n}\n\n/** Dialog 状态与语义 ID 的根节点。 */\nfunction DialogRoot({\n children,\n open,\n defaultOpen,\n onOpenChange,\n}: DialogRootProps): ReactElement {\n const baseId = useId();\n const [hasTitle, setHasTitle] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n const [current, setOpen] = useControllableState<boolean>({\n value: open,\n defaultValue: defaultOpen ?? false,\n onChange: onOpenChange,\n });\n const value = useMemo<DialogContextValue>(\n () => ({\n open: current,\n setOpen,\n triggerId: `${baseId}-trigger`,\n contentId: `${baseId}-content`,\n titleId: `${baseId}-title`,\n descriptionId: `${baseId}-description`,\n hasTitle,\n setHasTitle,\n hasDescription,\n setHasDescription,\n }),\n [baseId, current, hasDescription, hasTitle, setOpen],\n );\n\n return (\n <DialogContext.Provider value={value}>{children}</DialogContext.Provider>\n );\n}\n\nexport interface DialogTriggerProps {\n children: ReactElement;\n}\n\n/** 包装一个交互元素,同步 dialog 的状态与 ARIA 关联。 */\nfunction DialogTrigger({ children }: DialogTriggerProps): ReactElement {\n const context = useDialogContext(\"Dialog.Trigger\");\n const child = children as ReactElement<Record<string, unknown>>;\n const childOnClick = child.props.onClick as\n | ((event: MouseEvent<HTMLElement>) => void)\n | undefined;\n\n return cloneElement(child, {\n id: context.triggerId,\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": context.open,\n \"aria-controls\": context.open ? context.contentId : undefined,\n onClick: composeHandler(childOnClick, () => {\n context.setOpen(!context.open);\n }),\n });\n}\n\nexport interface DialogCloseProps {\n children?: ReactElement;\n label?: string;\n}\n\n/** 包装关闭触发器,或渲染一个默认关闭按钮。 */\nfunction DialogClose({\n children,\n label = \"Close\",\n}: DialogCloseProps): ReactElement {\n const context = useDialogContext(\"Dialog.Close\");\n\n if (isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n const childOnClick = child.props.onClick as\n | ((event: MouseEvent<HTMLElement>) => void)\n | undefined;\n\n return cloneElement(child, {\n onClick: composeHandler(childOnClick, () => {\n context.setOpen(false);\n }),\n });\n }\n\n return (\n <Button variant=\"ghost\" onClick={() => context.setOpen(false)}>\n {label}\n </Button>\n );\n}\n\nexport type DialogHeaderProps = HTMLAttributes<HTMLElement>;\n\nconst DialogHeader: ForwardRefExoticComponent<\n DialogHeaderProps & RefAttributes<HTMLElement>\n> = forwardRef<HTMLElement, DialogHeaderProps>(function DialogHeader(\n { className, ...rest },\n ref,\n) {\n return (\n <header\n {...rest}\n ref={ref}\n className={cx(\"uk-dialog__header\", className)}\n />\n );\n});\n\nexport type DialogTitleProps = HTMLAttributes<HTMLHeadingElement>;\n\nconst DialogTitle: ForwardRefExoticComponent<\n DialogTitleProps & RefAttributes<HTMLHeadingElement>\n> = forwardRef<HTMLHeadingElement, DialogTitleProps>(function DialogTitle(\n { className, children, ...rest },\n ref,\n) {\n const context = useDialogContext(\"Dialog.Title\");\n const setHasTitle = context.setHasTitle;\n\n useEffect(() => {\n setHasTitle(true);\n return () => setHasTitle(false);\n }, [setHasTitle]);\n\n return (\n <h2\n {...rest}\n ref={ref}\n id={context.titleId}\n className={cx(\"uk-dialog__title\", className)}\n >\n {children}\n </h2>\n );\n});\n\nexport type DialogDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\nconst DialogDescription: ForwardRefExoticComponent<\n DialogDescriptionProps & RefAttributes<HTMLParagraphElement>\n> = forwardRef<HTMLParagraphElement, DialogDescriptionProps>(\n function DialogDescription({ className, ...rest }, ref) {\n const context = useDialogContext(\"Dialog.Description\");\n const setHasDescription = context.setHasDescription;\n\n useEffect(() => {\n setHasDescription(true);\n return () => setHasDescription(false);\n }, [setHasDescription]);\n\n return (\n <p\n {...rest}\n ref={ref}\n id={context.descriptionId}\n className={cx(\"uk-dialog__description\", className)}\n />\n );\n },\n);\n\nexport type DialogBodyProps = HTMLAttributes<HTMLDivElement>;\n\nconst DialogBody: ForwardRefExoticComponent<\n DialogBodyProps & RefAttributes<HTMLDivElement>\n> = forwardRef<HTMLDivElement, DialogBodyProps>(function DialogBody(\n { className, ...rest },\n ref,\n) {\n return (\n <div {...rest} ref={ref} className={cx(\"uk-dialog__body\", className)} />\n );\n});\n\nexport type DialogFooterProps = HTMLAttributes<HTMLElement>;\n\nconst DialogFooter: ForwardRefExoticComponent<\n DialogFooterProps & RefAttributes<HTMLElement>\n> = forwardRef<HTMLElement, DialogFooterProps>(function DialogFooter(\n { className, ...rest },\n ref,\n) {\n return (\n <footer\n {...rest}\n ref={ref}\n className={cx(\"uk-dialog__footer\", className)}\n />\n );\n});\n\nexport interface DialogContentProps {\n children?: ReactNode;\n className?: string;\n closeOnBackdropClick?: boolean;\n closeOnEscape?: boolean;\n initialFocusRef?: RefObject<HTMLElement | null>;\n returnFocusRef?: RefObject<HTMLElement | null>;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n}\n\ninterface DialogLayerProps extends DialogContentProps {\n requestClose: () => void;\n contentId: string;\n titleId: string;\n descriptionId: string;\n hasTitle: boolean;\n hasDescription: boolean;\n}\n\nfunction DialogLayer({\n requestClose,\n contentId,\n titleId,\n descriptionId,\n hasTitle,\n hasDescription,\n children,\n closeOnBackdropClick = true,\n closeOnEscape = true,\n initialFocusRef,\n returnFocusRef,\n className,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n}: DialogLayerProps): ReactElement {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const openerRef = useRef<HTMLElement | null>(null);\n const isPresent = useIsPresent();\n const reduceMotion = useReducedMotion() ?? false;\n\n useLockBodyScroll(true);\n\n useLayoutEffect(() => {\n const dialog = dialogRef.current;\n\n if (!dialog) {\n return;\n }\n\n openerRef.current ??=\n document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n\n if (dialog.open) {\n return;\n }\n\n if (typeof dialog.showModal === \"function\") {\n dialog.showModal();\n } else {\n dialog.setAttribute(\"open\", \"\");\n }\n }, []);\n\n useFocusTrap({\n active: true,\n containerRef: dialogRef,\n initialFocusRef,\n returnFocusRef: returnFocusRef ?? openerRef,\n });\n\n useEffect(() => {\n const dialog = dialogRef.current;\n\n if (!dialog) {\n return;\n }\n\n const reopen = () => {\n if (dialog.open) {\n return;\n }\n\n if (typeof dialog.showModal === \"function\") {\n dialog.showModal();\n } else {\n dialog.setAttribute(\"open\", \"\");\n }\n };\n const onClose = () => {\n if (!closeOnEscape) {\n reopen();\n return;\n }\n\n requestClose();\n };\n const onCancel = (event: Event) => {\n event.preventDefault();\n\n if (closeOnEscape) {\n requestClose();\n }\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (closeOnEscape || event.key !== \"Escape\" || event.defaultPrevented) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n };\n const onClick = (event: globalThis.MouseEvent) => {\n if (closeOnBackdropClick && event.target === dialog) {\n requestClose();\n }\n };\n\n dialog.addEventListener(\"close\", onClose);\n dialog.addEventListener(\"cancel\", onCancel);\n dialog.addEventListener(\"keydown\", onKeyDown, true);\n dialog.addEventListener(\"click\", onClick);\n\n return () => {\n dialog.removeEventListener(\"close\", onClose);\n dialog.removeEventListener(\"cancel\", onCancel);\n dialog.removeEventListener(\"keydown\", onKeyDown, true);\n dialog.removeEventListener(\"click\", onClick);\n };\n }, [closeOnBackdropClick, closeOnEscape, requestClose]);\n\n return (\n <dialog\n ref={dialogRef}\n id={contentId}\n className={cx(\"uk-dialog\", className)}\n closedby={closeOnEscape || closeOnBackdropClick ? \"any\" : \"none\"}\n data-state={isPresent ? \"open\" : \"closed\"}\n inert={!isPresent}\n aria-label={ariaLabel}\n aria-labelledby={\n ariaLabelledBy ??\n (ariaLabel ? undefined : hasTitle ? titleId : undefined)\n }\n aria-describedby={\n ariaDescribedBy ?? (hasDescription ? descriptionId : undefined)\n }\n >\n <motion.div\n className=\"uk-dialog__panel\"\n initial={\n reduceMotion\n ? { opacity: 0 }\n : {\n opacity: 0,\n transform: \"translateY(12px) scale(0.96)\",\n }\n }\n animate={{\n opacity: 1,\n transform: \"translateY(0px) scale(1)\",\n transition: reduceMotion\n ? REDUCED_MOTION_TRANSITION\n : { ...OVERLAY_SPRING, delay: 0.06 },\n }}\n exit={\n reduceMotion\n ? { opacity: 0, transition: REDUCED_MOTION_TRANSITION }\n : {\n opacity: 0,\n transform: \"translateY(8px) scale(0.97)\",\n transition: OVERLAY_SPRING,\n }\n }\n >\n {children}\n </motion.div>\n </dialog>\n );\n}\n\n/** Portal、原生 dialog、焦点与 presence 生命周期的语义层。 */\nfunction DialogContent({\n children,\n closeOnBackdropClick = true,\n closeOnEscape = true,\n initialFocusRef,\n returnFocusRef,\n className,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n}: DialogContentProps): ReactElement | null {\n const context = useDialogContext(\"Dialog.Content\");\n const requestClose = useEventCallback(() => {\n context.setOpen(false);\n });\n const isClient = useSyncExternalStore(\n subscribeToNothing,\n getClientSnapshot,\n getServerSnapshot,\n );\n\n if (!isClient) {\n return null;\n }\n\n return createPortal(\n <MotionConfig reducedMotion=\"user\">\n <AnimatePresence>\n {context.open ? (\n <DialogLayer\n key=\"uk-dialog\"\n requestClose={requestClose}\n contentId={context.contentId}\n titleId={context.titleId}\n descriptionId={context.descriptionId}\n hasTitle={context.hasTitle}\n hasDescription={context.hasDescription}\n closeOnBackdropClick={closeOnBackdropClick}\n closeOnEscape={closeOnEscape}\n initialFocusRef={initialFocusRef}\n returnFocusRef={returnFocusRef}\n className={className}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n >\n {children}\n </DialogLayer>\n ) : null}\n </AnimatePresence>\n </MotionConfig>,\n document.body,\n );\n}\n\n/** 保持既有 slot API 兼容的便捷封装。 */\nfunction LegacyDialog({\n open,\n onOpenChange,\n title,\n description,\n footer,\n children,\n closeLabel = \"Close\",\n showCloseButton = true,\n closeOnBackdropClick = true,\n closeOnEscape = true,\n initialFocusRef,\n returnFocusRef,\n className,\n \"aria-label\": ariaLabel,\n}: DialogProps): ReactElement {\n return (\n <DialogRoot open={open} onOpenChange={onOpenChange}>\n <DialogContent\n className={className}\n closeOnBackdropClick={closeOnBackdropClick}\n closeOnEscape={closeOnEscape}\n initialFocusRef={initialFocusRef}\n returnFocusRef={returnFocusRef}\n aria-label={ariaLabel}\n >\n {title || description || showCloseButton ? (\n <DialogHeader>\n <div className=\"uk-dialog__heading\">\n {title ? <DialogTitle>{title}</DialogTitle> : null}\n {description ? (\n <DialogDescription>{description}</DialogDescription>\n ) : null}\n </div>\n {showCloseButton ? (\n <DialogClose>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n iconOnly\n aria-label={closeLabel}\n className=\"uk-dialog__close\"\n >\n <svg\n viewBox=\"0 0 20 20\"\n width=\"16\"\n height=\"16\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M5 5l10 10M15 5L5 15\"\n stroke=\"currentColor\"\n strokeWidth=\"1.8\"\n strokeLinecap=\"round\"\n />\n </svg>\n </Button>\n </DialogClose>\n ) : null}\n </DialogHeader>\n ) : null}\n\n <DialogBody>{children}</DialogBody>\n\n {footer ? <DialogFooter>{footer}</DialogFooter> : null}\n </DialogContent>\n </DialogRoot>\n );\n}\n\nexport interface DialogComponent {\n (props: DialogProps): ReactElement;\n Root: typeof DialogRoot;\n Trigger: typeof DialogTrigger;\n Content: typeof DialogContent;\n Header: typeof DialogHeader;\n Title: typeof DialogTitle;\n Description: typeof DialogDescription;\n Body: typeof DialogBody;\n Footer: typeof DialogFooter;\n Close: typeof DialogClose;\n}\n\n/**\n * 模态对话框。\n *\n * 组合式 API 由 Root / Trigger / Content 和各语义层组成;无子组件的调用\n * 保留既有 title / description / footer slot API。\n */\nexport const Dialog: DialogComponent = Object.assign(LegacyDialog, {\n Root: DialogRoot,\n Trigger: DialogTrigger,\n Content: DialogContent,\n Header: DialogHeader,\n Title: DialogTitle,\n Description: DialogDescription,\n Body: DialogBody,\n Footer: DialogFooter,\n Close: DialogClose,\n});\n"],"names":["cx","values","Button","forwardRef","variant","size","loading","iconOnly","type","className","children","rest","ref","jsxs","Input","inputSize","invalid","ariaInvalid","jsx","EASE_OUT","UI_SPRING","OVERLAY_SPRING","INDICATOR_SPRING","REDUCED_MOTION_TRANSITION","Switch","checked","defaultChecked","onCheckedChange","disabled","id","generatedId","useId","inputId","reduceMotion","useReducedMotion","suppressClickRef","useRef","dragRef","current","setCurrent","useControllableState","thumbX","useMotionValue","useEffect","controls","animate","finishDrag","event","drag","first","last","elapsed","velocity","next","delta","sample","motion","TabsContext","createContext","useTabsContext","component","context","useContext","tabId","baseId","value","panelId","TabsRoot","defaultValue","onValueChange","orientation","setValue","useMemo","TabsList","onKeyDown","trigger","triggers","index","nextKey","previousKey","nextIndex","nextTrigger","TabsTrigger","onClick","selected","TabsContent","Tabs","DialogContext","subscribeToNothing","getClientSnapshot","getServerSnapshot","useDialogContext","composeHandler","childHandler","handler","DialogRoot","open","defaultOpen","onOpenChange","hasTitle","setHasTitle","useState","hasDescription","setHasDescription","setOpen","DialogTrigger","child","childOnClick","cloneElement","DialogClose","label","isValidElement","DialogHeader","DialogTitle","DialogDescription","DialogBody","DialogFooter","DialogLayer","requestClose","contentId","titleId","descriptionId","closeOnBackdropClick","closeOnEscape","initialFocusRef","returnFocusRef","ariaLabel","ariaLabelledBy","ariaDescribedBy","dialogRef","openerRef","isPresent","useIsPresent","useLockBodyScroll","useLayoutEffect","dialog","useFocusTrap","reopen","onClose","onCancel","DialogContent","useEventCallback","useSyncExternalStore","createPortal","MotionConfig","AnimatePresence","LegacyDialog","title","description","footer","closeLabel","showCloseButton","Dialog"],"mappings":"iNAGO,SAASA,KACXC,EACK,CACR,OAAOA,EAAO,OAAO,OAAO,EAAE,KAAK,GAAG,CACxC,CC6BO,MAAMC,EAETC,EAAAA,WAA2C,SAC7C,CACE,QAAAC,EAAU,UACV,KAAAC,EAAO,KACP,QAAAC,EAAU,GACV,SAAAC,EAAW,GACX,KAAAC,EAAO,SACP,UAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,OACEC,EAAAA,KAAC,SAAA,CACE,GAAGF,EACJ,IAAAC,EACA,KAAAJ,EACA,UAAWR,EAAG,YAAaS,CAAS,EACpC,eAAcL,EACd,YAAWC,EACX,eAAcC,EAAU,OAAS,OACjC,iBAAgBC,EAAW,OAAS,OACpC,SAAUI,EAAK,UAAYL,EAC3B,YAAWA,GAAW,OAErB,SAAA,CAAAA,QACE,OAAA,CAAK,UAAU,qBAAqB,cAAY,OAAO,EACtD,KACHI,CAAA,CAAA,CAAA,CAGP,CAAC,EC5CYI,EAETX,EAAAA,WAAyC,SAC3C,CACE,UAAAY,EAAY,KACZ,QAAAC,EAAU,GACV,UAAAP,EACA,eAAgBQ,EAChB,GAAGN,CACL,EACAC,EACA,CACA,OACEM,EAAAA,IAAC,QAAA,CACE,GAAGP,EACJ,IAAAC,EACA,UAAWZ,EAAG,WAAYS,CAAS,EACnC,YAAWM,EACX,eAAcC,EAAU,GAAOC,CAAA,CAAA,CAGrC,CAAC,EC7CYE,EAAW,CAAC,IAAM,EAAG,IAAM,CAAC,EAG5BC,EAAwB,CACnC,KAAM,SACN,OAAQ,EACR,SAAU,EACZ,EAEaC,EAA6B,CACxC,KAAM,SACN,OAAQ,IACR,SAAU,GACZ,EAEaC,EAA+B,CAC1C,KAAM,SACN,OAAQ,IACR,SAAU,GACZ,EAEaC,EAAwC,CACnD,SAAU,IACV,KAAMJ,CACR,ECeaK,GAETrB,EAAAA,WAA0C,SAC5C,CACE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,IAAA,CAAA,CACN,EACE,KAEJA,MAACiG,GAAY,SAAAzG,EAAS,EAErB2I,EAASnI,EAAAA,IAACkG,EAAA,CAAc,SAAAiC,CAAA,CAAO,EAAkB,IAAA,CAAA,CAAA,EAEtD,CAEJ,CAqBO,MAAMG,GAA0B,OAAO,OAAON,GAAc,CACjE,KAAMnD,EACN,QAASU,GACT,QAASmC,EACT,OAAQ5B,EACR,MAAOC,EACP,YAAaC,EACb,KAAMC,EACN,OAAQC,EACR,MAAOP,CACT,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { Button } from "./Button";
2
+ export type { ButtonProps, ButtonSize, ButtonVariant } from "./Button";
3
+ export { Input } from "./Input";
4
+ export type { InputProps, InputSize } from "./Input";
5
+ export { Switch } from "./Switch";
6
+ export type { SwitchProps } from "./Switch";
7
+ export { Tabs } from "./Tabs";
8
+ export type { TabsContentProps, TabsListProps, TabsOrientation, TabsProps, TabsTriggerProps, } from "./Tabs";
9
+ export { Dialog } from "./Dialog";
10
+ export type { DialogBodyProps, DialogCloseProps, DialogComponent, DialogContentProps, DialogDescriptionProps, DialogFooterProps, DialogHeaderProps, DialogProps, DialogRootProps, DialogTitleProps, DialogTriggerProps, } from "./Dialog";