seam-react 0.0.0-stage → 0.1.1
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 +21 -0
- package/README.md +42 -2
- package/dist/Button.d.ts +21 -0
- package/dist/Dialog.d.ts +32 -0
- package/dist/Input.d.ts +15 -0
- package/dist/SeamStyles.d.ts +11 -0
- package/dist/Switch.d.ts +18 -0
- package/dist/Tabs.d.ts +44 -0
- package/dist/Toast.d.ts +43 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +501 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.cjs +677 -0
- package/dist/styles.cjs.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/styles.generated.d.ts +1 -0
- package/dist/styles.js +684 -0
- package/dist/styles.js.map +1 -0
- package/dist/utils/cx.d.ts +4 -0
- package/package.json +73 -3
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
|
-
#
|
|
1
|
+
# seam-react
|
|
2
2
|
|
|
3
|
-
|
|
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、Toast。
|
|
34
|
+
|
|
35
|
+
- Tabs 支持方向键切换与 ARIA 关联。
|
|
36
|
+
- Dialog 自带焦点陷阱、Esc 关闭与滚动锁定。
|
|
37
|
+
- Toast 支持自动消失与手动关闭。
|
|
38
|
+
|
|
39
|
+
完整文档:[chenhaojie9527.github.io/ui-kit](https://chenhaojie9527.github.io/ui-kit/)
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
MIT
|
package/dist/Button.d.ts
ADDED
|
@@ -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>>;
|
package/dist/Dialog.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode, 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
|
+
/**
|
|
26
|
+
* 模态对话框。
|
|
27
|
+
*
|
|
28
|
+
* 基于原生 <dialog> + showModal():Esc 关闭、遮罩和顶层渲染由浏览器
|
|
29
|
+
* 负责;焦点陷阱由 useFocusTrap 补上反向循环、外部聚焦回收与焦点恢复,
|
|
30
|
+
* 组件本身额外提供受控开关、关闭按钮、遮罩点击与 body 滚动锁定。
|
|
31
|
+
*/
|
|
32
|
+
export declare function Dialog({ open, onOpenChange, title, description, footer, children, closeLabel, showCloseButton, closeOnBackdropClick, closeOnEscape, initialFocusRef, returnFocusRef, className, "aria-label": ariaLabel, }: DialogProps): ReactElement | null;
|
package/dist/Input.d.ts
ADDED
|
@@ -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;
|
package/dist/Switch.d.ts
ADDED
|
@@ -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/Toast.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
export type ToastVariant = "info" | "success" | "warning" | "danger";
|
|
3
|
+
export type ToastPlacement = "top-right" | "top-center" | "bottom-right" | "bottom-center";
|
|
4
|
+
export interface ToastOptions {
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** 视觉变体,默认 info。 */
|
|
8
|
+
variant?: ToastVariant;
|
|
9
|
+
/** 自动关闭时间(毫秒),0 表示常驻;默认取 Provider 配置。 */
|
|
10
|
+
duration?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ToastApi {
|
|
13
|
+
/** 弹出一条提示,返回其 id。 */
|
|
14
|
+
toast: (options: ToastOptions) => string;
|
|
15
|
+
/** 关闭指定提示。 */
|
|
16
|
+
dismiss: (id: string) => void;
|
|
17
|
+
/** 关闭当前所有提示。 */
|
|
18
|
+
dismissAll: () => void;
|
|
19
|
+
}
|
|
20
|
+
export interface ToastProviderProps {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
/** 提示出现的位置,默认 top-right。 */
|
|
23
|
+
placement?: ToastPlacement;
|
|
24
|
+
/** 默认自动关闭时间,默认 4000ms。 */
|
|
25
|
+
duration?: number;
|
|
26
|
+
/** 同屏最多保留的提示数量,默认 4。 */
|
|
27
|
+
maxToasts?: number;
|
|
28
|
+
/** 提示区域的屏幕阅读器名称。 */
|
|
29
|
+
label?: string;
|
|
30
|
+
/** 关闭按钮的无障碍名称,默认 Close。 */
|
|
31
|
+
closeLabel?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Toast 上下文。
|
|
35
|
+
*
|
|
36
|
+
* 负责队列、自动关闭、悬停/聚焦暂停、退出动画和 portal 渲染。
|
|
37
|
+
* 必须包在应用外层,子组件通过 useToast() 获取 toast()。
|
|
38
|
+
*/
|
|
39
|
+
export declare function ToastProvider({ children, placement, duration, maxToasts, label, closeLabel, }: ToastProviderProps): ReactElement;
|
|
40
|
+
/**
|
|
41
|
+
* 获取 toast API。必须在 <ToastProvider> 内使用。
|
|
42
|
+
*/
|
|
43
|
+
export declare function useToast(): ToastApi;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("react"),P=require("react-dom"),y=require("seam-hooks");function j(...t){return t.filter(Boolean).join(" ")}const $=s.forwardRef(function({variant:a="primary",size:c="md",loading:r=!1,iconOnly:u=!1,type:d="button",className:o,children:h,...i},l){return n.jsxs("button",{...i,ref:l,type:d,className:j("uk-button",o),"data-variant":a,"data-size":c,"data-loading":r?"true":void 0,"data-icon-only":u?"true":void 0,disabled:i.disabled||r,"aria-busy":r||void 0,children:[r?n.jsx("span",{className:"uk-button__spinner","aria-hidden":"true"}):null,h]})}),U=s.forwardRef(function({inputSize:a="md",invalid:c=!1,className:r,"aria-invalid":u,...d},o){return n.jsx("input",{...d,ref:o,className:j("uk-input",r),"data-size":a,"aria-invalid":c?!0:u})}),H=s.forwardRef(function({checked:a,defaultChecked:c,onCheckedChange:r,disabled:u,className:d,children:o,id:h,...i},l){const g=s.useId(),x=h??g,[C,v]=y.useControllableState({value:a,defaultValue:c??!1,onChange:r});return n.jsxs("label",{className:j("uk-switch",d),"data-disabled":u?"true":void 0,htmlFor:x,children:[n.jsx("input",{...i,ref:l,id:x,type:"checkbox",role:"switch",className:"uk-switch__input",checked:C,disabled:u,"aria-checked":C,onChange:k=>v(k.target.checked)}),n.jsx("span",{className:"uk-switch__track","aria-hidden":"true",children:n.jsx("span",{className:"uk-switch__thumb"})}),o?n.jsx("span",{className:"uk-switch__label",children:o}):null]})}),q=s.createContext(null);function D(t){const a=s.useContext(q);if(!a)throw new Error(`<${t}> must be rendered inside <Tabs>`);return a}function z(t,a){return`${t}-tab-${encodeURIComponent(a)}`}function B(t,a){return`${t}-panel-${encodeURIComponent(a)}`}function K({value:t,defaultValue:a,onValueChange:c,orientation:r="horizontal",className:u,children:d}){const o=s.useId(),[h,i]=y.useControllableState({value:t,defaultValue:a??"",onChange:c}),l=s.useMemo(()=>({baseId:o,value:h,setValue:i,orientation:r}),[o,h,r,i]);return n.jsx(q.Provider,{value:l,children:n.jsx("div",{className:j("uk-tabs",u),"data-orientation":r,children:d})})}const O=s.forwardRef(function({className:a,onKeyDown:c,...r},u){const{orientation:d}=D("Tabs.List");return n.jsx("div",{...r,ref:u,role:"tablist","aria-orientation":d,tabIndex:-1,className:j("uk-tabs__list",a),onKeyDown:o=>{if(c?.(o),o.defaultPrevented)return;const i=o.target?.closest('[role="tab"]');if(!i||i.hasAttribute("disabled"))return;const l=Array.from(o.currentTarget.querySelectorAll('[role="tab"]:not([disabled])')),g=l.indexOf(i);if(g===-1)return;const x=d==="horizontal"?"ArrowRight":"ArrowDown",C=d==="horizontal"?"ArrowLeft":"ArrowUp";let v=-1;switch(o.key){case x:v=(g+1)%l.length;break;case C:v=(g-1+l.length)%l.length;break;case"Home":v=0;break;case"End":v=l.length-1;break;default:return}o.preventDefault();const k=l[v];k&&(k.focus(),k.click())}})}),W=s.forwardRef(function({value:a,type:c="button",className:r,onClick:u,...d},o){const h=D("Tabs.Trigger"),i=h.value===a;return n.jsx("button",{...d,ref:o,type:c,role:"tab",id:z(h.baseId,a),"aria-selected":i,"aria-controls":B(h.baseId,a),tabIndex:i?0:-1,"data-state":i?"active":"inactive",className:j("uk-tabs__trigger",r),onClick:l=>{u?.(l),l.defaultPrevented||h.setValue(a)}})}),X=s.forwardRef(function({value:a,className:c,...r},u){const d=D("Tabs.Content"),o=d.value===a;return n.jsx("div",{...r,ref:u,role:"tabpanel",id:B(d.baseId,a),"aria-labelledby":z(d.baseId,a),hidden:!o,tabIndex:0,"data-state":o?"active":"inactive",className:j("uk-tabs__panel",c)})}),G=Object.assign(K,{List:O,Trigger:W,Content:X}),J=()=>()=>{},Q=()=>!0,Y=()=>!1;function Z({open:t,onOpenChange:a,title:c,description:r,footer:u,children:d,closeLabel:o="Close",showCloseButton:h=!0,closeOnBackdropClick:i=!0,closeOnEscape:l=!0,initialFocusRef:g,returnFocusRef:x,className:C,"aria-label":v}){const k=s.useRef(null),_=s.useRef(null),p=s.useRef(t),R=s.useId(),T=s.useId(),N=s.useSyncExternalStore(J,Q,Y),w=y.useEventCallback(()=>{p.current&&a(!1)});return y.useLockBodyScroll(t),s.useEffect(()=>{p.current=t},[t]),s.useEffect(()=>{const f=k.current;f&&(t&&!f.open?(_.current=document.activeElement instanceof HTMLElement?document.activeElement:null,typeof f.showModal=="function"?f.showModal():f.setAttribute("open","")):!t&&f.open&&(typeof f.close=="function"?f.close():f.removeAttribute("open")))},[t]),y.useFocusTrap({active:t,containerRef:k,initialFocusRef:g,returnFocusRef:x??_}),s.useEffect(()=>{const f=k.current;if(!f)return;const E=()=>w(),I=e=>{l||e.preventDefault()},S=e=>{i&&e.target===f&&w()};return f.addEventListener("close",E),f.addEventListener("cancel",I),f.addEventListener("click",S),()=>{f.removeEventListener("close",E),f.removeEventListener("cancel",I),f.removeEventListener("click",S)}},[i,l,w]),N?P.createPortal(n.jsx("dialog",{ref:k,className:j("uk-dialog",C),"aria-label":v,"aria-labelledby":c?R:void 0,"aria-describedby":r?T:void 0,children:n.jsxs("div",{className:"uk-dialog__panel",children:[c||r||h?n.jsxs("header",{className:"uk-dialog__header",children:[n.jsxs("div",{className:"uk-dialog__heading",children:[c?n.jsx("h2",{id:R,className:"uk-dialog__title",children:c}):null,r?n.jsx("p",{id:T,className:"uk-dialog__description",children:r}):null]}),h?n.jsx($,{variant:"ghost",size:"sm",iconOnly:!0,"aria-label":o,className:"uk-dialog__close",onClick:w,children:n.jsx("svg",{viewBox:"0 0 20 20",width:"16",height:"16","aria-hidden":"true",children:n.jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}):null]}):null,n.jsx("div",{className:"uk-dialog__body",children:d}),u?n.jsx("footer",{className:"uk-dialog__footer",children:u}):null]})}),document.body):null}const V=s.createContext(null),ee=200,te=()=>()=>{},se=()=>!0,ne=()=>!1;function ae({record:t,closeLabel:a,onDismiss:c,onPause:r,onResume:u}){return n.jsxs("div",{className:"uk-toast","data-variant":t.variant,"data-state":t.leaving?"closed":"open",onMouseEnter:()=>r(t.id),onMouseLeave:()=>u(t.id),onFocusCapture:()=>r(t.id),onBlurCapture:()=>u(t.id),children:[n.jsxs("div",{className:"uk-toast__body",children:[t.title?n.jsx("div",{className:"uk-toast__title",children:t.title}):null,t.description?n.jsx("div",{className:"uk-toast__description",children:t.description}):null]}),n.jsx("button",{type:"button",className:"uk-toast__close","aria-label":a,onClick:()=>c(t.id),children:n.jsx("svg",{viewBox:"0 0 20 20",width:"14",height:"14","aria-hidden":"true",children:n.jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})})]})}function re({children:t,placement:a="top-right",duration:c=4e3,maxToasts:r=4,label:u="Notifications",closeLabel:d="Close"}){const[o,h]=s.useState([]),i=s.useRef([]),l=s.useRef(new Map),g=s.useRef(new Map),x=s.useRef(new Map),C=s.useRef(0),v=s.useId(),k=s.useSyncExternalStore(te,se,ne),_=s.useCallback(e=>{i.current=e,h(e)},[]),p=s.useCallback(e=>{const b=g.current.get(e);b!==void 0&&(clearTimeout(b),g.current.delete(e))},[]),R=s.useCallback(e=>{const b=x.current.get(e);b!==void 0&&(clearTimeout(b),x.current.delete(e))},[]),T=s.useCallback(e=>{p(e),!(x.current.has(e)||!i.current.some(m=>m.id===e))&&(_(i.current.map(m=>m.id===e?{...m,leaving:!0}:m)),x.current.set(e,setTimeout(()=>{x.current.delete(e),l.current.delete(e),_(i.current.filter(m=>m.id!==e))},ee)))},[p,_]),N=s.useCallback((e,b)=>{p(e),!(b<=0)&&g.current.set(e,setTimeout(()=>{g.current.delete(e),T(e)},b))},[p,T]),w=s.useCallback(e=>{const b=`${v}-${C.current}`;C.current+=1;const m={id:b,title:e.title,description:e.description,variant:e.variant??"info",duration:e.duration??c,leaving:!1},L=[...i.current,m],M=Math.max(0,L.length-r);(M>0?L.slice(0,M):[]).forEach(A=>{p(A.id),R(A.id),l.current.delete(A.id)});const F=M>0?L.slice(M):L;return l.current.set(b,m.duration),_(F),N(b,m.duration),b},[v,p,R,_,c,r,N]),f=s.useCallback(e=>{p(e)},[p]),E=s.useCallback(e=>{const b=l.current.get(e);b!==void 0&&N(e,b)},[N]),I=s.useCallback(()=>{i.current.forEach(e=>T(e.id))},[T]),S=s.useMemo(()=>({toast:w,dismiss:T,dismissAll:I}),[T,I,w]);return s.useEffect(()=>{const e=g.current,b=x.current;return()=>{e.forEach(m=>clearTimeout(m)),b.forEach(m=>clearTimeout(m)),e.clear(),b.clear()}},[]),n.jsxs(V.Provider,{value:S,children:[t,k?P.createPortal(n.jsx("section",{className:"uk-toast-viewport","data-placement":a,"aria-label":u,"aria-live":"polite","aria-atomic":"false",children:o.map(e=>n.jsx(ae,{record:e,closeLabel:d,onDismiss:T,onPause:f,onResume:E},e.id))}),document.body):null]})}function oe(){const t=s.useContext(V);if(!t)throw new Error("useToast must be used within <ToastProvider>");return t}exports.Button=$;exports.Dialog=Z;exports.Input=U;exports.Switch=H;exports.Tabs=G;exports.ToastProvider=re;exports.useToast=oe;
|
|
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/Switch.tsx","../src/Tabs.tsx","../src/Dialog.tsx","../src/Toast.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 {\n forwardRef,\n useId,\n type ForwardRefExoticComponent,\n type InputHTMLAttributes,\n type ReactNode,\n type RefAttributes,\n} from \"react\";\nimport { useControllableState } from \"seam-hooks\";\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\n const [current, setCurrent] = useControllableState<boolean>({\n value: checked,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n\n return (\n <label\n className={cx(\"uk-switch\", className)}\n data-disabled={disabled ? \"true\" : undefined}\n htmlFor={inputId}\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 className=\"uk-switch__track\" aria-hidden=\"true\">\n <span className=\"uk-switch__thumb\" />\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 { useControllableState } from \"seam-hooks\";\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}\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 () => ({ baseId, value: current, setValue, orientation }),\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, ...rest },\n ref,\n) {\n const context = useTabsContext(\"Tabs.Trigger\");\n const selected = context.value === value;\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 );\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 useEffect,\n useId,\n useRef,\n useSyncExternalStore,\n type ReactElement,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useEventCallback, useFocusTrap, useLockBodyScroll } from \"seam-hooks\";\nimport { Button } from \"./Button\";\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\nconst subscribeToNothing = () => () => {};\nconst getClientSnapshot = () => true;\nconst getServerSnapshot = () => false;\n\n/**\n * 模态对话框。\n *\n * 基于原生 <dialog> + showModal():Esc 关闭、遮罩和顶层渲染由浏览器\n * 负责;焦点陷阱由 useFocusTrap 补上反向循环、外部聚焦回收与焦点恢复,\n * 组件本身额外提供受控开关、关闭按钮、遮罩点击与 body 滚动锁定。\n */\nexport function Dialog({\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 | null {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const openerRef = useRef<HTMLElement | null>(null);\n const openRef = useRef(open);\n const titleId = useId();\n const descriptionId = useId();\n const isClient = useSyncExternalStore(\n subscribeToNothing,\n getClientSnapshot,\n getServerSnapshot,\n );\n\n const requestClose = useEventCallback(() => {\n if (openRef.current) {\n onOpenChange(false);\n }\n });\n\n useLockBodyScroll(open);\n\n useEffect(() => {\n openRef.current = open;\n }, [open]);\n\n useEffect(() => {\n const dialog = dialogRef.current;\n\n if (!dialog) {\n return;\n }\n\n if (open && !dialog.open) {\n // 必须在 showModal() 之前记录,否则拿到的已经是对话框内部元素。\n openerRef.current =\n document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n\n if (typeof dialog.showModal === \"function\") {\n dialog.showModal();\n } else {\n dialog.setAttribute(\"open\", \"\");\n }\n } else if (!open && dialog.open) {\n if (typeof dialog.close === \"function\") {\n dialog.close();\n } else {\n dialog.removeAttribute(\"open\");\n }\n }\n }, [open]);\n\n // 声明顺序很关键:上面的 effect 先调用 showModal(),本 hook 再接管焦点。\n useFocusTrap({\n active: open,\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 onClose = () => requestClose();\n const onCancel = (event: Event) => {\n if (!closeOnEscape) {\n event.preventDefault();\n }\n };\n const onClick = (event: 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(\"click\", onClick);\n\n return () => {\n dialog.removeEventListener(\"close\", onClose);\n dialog.removeEventListener(\"cancel\", onCancel);\n dialog.removeEventListener(\"click\", onClick);\n };\n }, [closeOnBackdropClick, closeOnEscape, requestClose]);\n\n if (!isClient) {\n return null;\n }\n\n return createPortal(\n <dialog\n ref={dialogRef}\n className={cx(\"uk-dialog\", className)}\n aria-label={ariaLabel}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n >\n <div className=\"uk-dialog__panel\">\n {title || description || showCloseButton ? (\n <header className=\"uk-dialog__header\">\n <div className=\"uk-dialog__heading\">\n {title ? (\n <h2 id={titleId} className=\"uk-dialog__title\">\n {title}\n </h2>\n ) : null}\n {description ? (\n <p id={descriptionId} className=\"uk-dialog__description\">\n {description}\n </p>\n ) : null}\n </div>\n {showCloseButton ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n iconOnly\n aria-label={closeLabel}\n className=\"uk-dialog__close\"\n onClick={requestClose}\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 ) : null}\n </header>\n ) : null}\n\n <div className=\"uk-dialog__body\">{children}</div>\n\n {footer ? (\n <footer className=\"uk-dialog__footer\">{footer}</footer>\n ) : null}\n </div>\n </dialog>,\n document.body,\n );\n}\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nexport type ToastVariant = \"info\" | \"success\" | \"warning\" | \"danger\";\n\nexport type ToastPlacement =\n | \"top-right\"\n | \"top-center\"\n | \"bottom-right\"\n | \"bottom-center\";\n\nexport interface ToastOptions {\n title?: ReactNode;\n description?: ReactNode;\n /** 视觉变体,默认 info。 */\n variant?: ToastVariant;\n /** 自动关闭时间(毫秒),0 表示常驻;默认取 Provider 配置。 */\n duration?: number;\n}\n\nexport interface ToastApi {\n /** 弹出一条提示,返回其 id。 */\n toast: (options: ToastOptions) => string;\n /** 关闭指定提示。 */\n dismiss: (id: string) => void;\n /** 关闭当前所有提示。 */\n dismissAll: () => void;\n}\n\nexport interface ToastProviderProps {\n children: ReactNode;\n /** 提示出现的位置,默认 top-right。 */\n placement?: ToastPlacement;\n /** 默认自动关闭时间,默认 4000ms。 */\n duration?: number;\n /** 同屏最多保留的提示数量,默认 4。 */\n maxToasts?: number;\n /** 提示区域的屏幕阅读器名称。 */\n label?: string;\n /** 关闭按钮的无障碍名称,默认 Close。 */\n closeLabel?: string;\n}\n\ninterface ToastRecord {\n id: string;\n title?: ReactNode;\n description?: ReactNode;\n variant: ToastVariant;\n duration: number;\n leaving: boolean;\n}\n\ninterface ToastViewProps {\n record: ToastRecord;\n closeLabel: string;\n onDismiss: (id: string) => void;\n onPause: (id: string) => void;\n onResume: (id: string) => void;\n}\n\nconst ToastContext = createContext<ToastApi | null>(null);\n\nconst EXIT_DURATION = 200;\n\nconst subscribeToNothing = () => () => {};\nconst getClientSnapshot = () => true;\nconst getServerSnapshot = () => false;\n\nfunction ToastView({\n record,\n closeLabel,\n onDismiss,\n onPause,\n onResume,\n}: ToastViewProps) {\n return (\n <div\n className=\"uk-toast\"\n data-variant={record.variant}\n data-state={record.leaving ? \"closed\" : \"open\"}\n onMouseEnter={() => onPause(record.id)}\n onMouseLeave={() => onResume(record.id)}\n onFocusCapture={() => onPause(record.id)}\n onBlurCapture={() => onResume(record.id)}\n >\n <div className=\"uk-toast__body\">\n {record.title ? (\n <div className=\"uk-toast__title\">{record.title}</div>\n ) : null}\n {record.description ? (\n <div className=\"uk-toast__description\">{record.description}</div>\n ) : null}\n </div>\n <button\n type=\"button\"\n className=\"uk-toast__close\"\n aria-label={closeLabel}\n onClick={() => onDismiss(record.id)}\n >\n <svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" aria-hidden=\"true\">\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 </div>\n );\n}\n\n/**\n * Toast 上下文。\n *\n * 负责队列、自动关闭、悬停/聚焦暂停、退出动画和 portal 渲染。\n * 必须包在应用外层,子组件通过 useToast() 获取 toast()。\n */\nexport function ToastProvider({\n children,\n placement = \"top-right\",\n duration = 4000,\n maxToasts = 4,\n label = \"Notifications\",\n closeLabel = \"Close\",\n}: ToastProviderProps): ReactElement {\n const [records, setRecords] = useState<ToastRecord[]>([]);\n const recordsRef = useRef<ToastRecord[]>([]);\n const durationsRef = useRef(new Map<string, number>());\n const autoTimersRef = useRef(\n new Map<string, ReturnType<typeof setTimeout>>(),\n );\n const exitTimersRef = useRef(\n new Map<string, ReturnType<typeof setTimeout>>(),\n );\n const counterRef = useRef(0);\n const baseId = useId();\n const isClient = useSyncExternalStore(\n subscribeToNothing,\n getClientSnapshot,\n getServerSnapshot,\n );\n\n const commit = useCallback((next: ToastRecord[]) => {\n recordsRef.current = next;\n setRecords(next);\n }, []);\n\n const clearAutoTimer = useCallback((id: string) => {\n const timer = autoTimersRef.current.get(id);\n\n if (timer !== undefined) {\n clearTimeout(timer);\n autoTimersRef.current.delete(id);\n }\n }, []);\n\n const clearExitTimer = useCallback((id: string) => {\n const timer = exitTimersRef.current.get(id);\n\n if (timer !== undefined) {\n clearTimeout(timer);\n exitTimersRef.current.delete(id);\n }\n }, []);\n\n const dismiss = useCallback(\n (id: string) => {\n clearAutoTimer(id);\n\n if (exitTimersRef.current.has(id)) {\n return;\n }\n\n const exists = recordsRef.current.some((record) => record.id === id);\n\n if (!exists) {\n return;\n }\n\n commit(\n recordsRef.current.map((record) =>\n record.id === id ? { ...record, leaving: true } : record,\n ),\n );\n\n exitTimersRef.current.set(\n id,\n setTimeout(() => {\n exitTimersRef.current.delete(id);\n durationsRef.current.delete(id);\n commit(recordsRef.current.filter((record) => record.id !== id));\n }, EXIT_DURATION),\n );\n },\n [clearAutoTimer, commit],\n );\n\n const scheduleAutoDismiss = useCallback(\n (id: string, delay: number) => {\n clearAutoTimer(id);\n\n if (delay <= 0) {\n return;\n }\n\n autoTimersRef.current.set(\n id,\n setTimeout(() => {\n autoTimersRef.current.delete(id);\n dismiss(id);\n }, delay),\n );\n },\n [clearAutoTimer, dismiss],\n );\n\n const toast = useCallback(\n (options: ToastOptions) => {\n const id = `${baseId}-${counterRef.current}`;\n counterRef.current += 1;\n\n const record: ToastRecord = {\n id,\n title: options.title,\n description: options.description,\n variant: options.variant ?? \"info\",\n duration: options.duration ?? duration,\n leaving: false,\n };\n\n const next = [...recordsRef.current, record];\n const overflow = Math.max(0, next.length - maxToasts);\n const dropped = overflow > 0 ? next.slice(0, overflow) : [];\n\n dropped.forEach((item) => {\n clearAutoTimer(item.id);\n clearExitTimer(item.id);\n durationsRef.current.delete(item.id);\n });\n\n const kept = overflow > 0 ? next.slice(overflow) : next;\n\n durationsRef.current.set(id, record.duration);\n commit(kept);\n scheduleAutoDismiss(id, record.duration);\n\n return id;\n },\n [\n baseId,\n clearAutoTimer,\n clearExitTimer,\n commit,\n duration,\n maxToasts,\n scheduleAutoDismiss,\n ],\n );\n\n const pause = useCallback(\n (id: string) => {\n clearAutoTimer(id);\n },\n [clearAutoTimer],\n );\n\n const resume = useCallback(\n (id: string) => {\n const delay = durationsRef.current.get(id);\n\n if (delay !== undefined) {\n scheduleAutoDismiss(id, delay);\n }\n },\n [scheduleAutoDismiss],\n );\n\n const dismissAll = useCallback(() => {\n recordsRef.current.forEach((record) => dismiss(record.id));\n }, [dismiss]);\n\n const api = useMemo<ToastApi>(\n () => ({ toast, dismiss, dismissAll }),\n [dismiss, dismissAll, toast],\n );\n\n useEffect(() => {\n const autoTimers = autoTimersRef.current;\n const exitTimers = exitTimersRef.current;\n\n return () => {\n autoTimers.forEach((timer) => clearTimeout(timer));\n exitTimers.forEach((timer) => clearTimeout(timer));\n autoTimers.clear();\n exitTimers.clear();\n };\n }, []);\n\n return (\n <ToastContext.Provider value={api}>\n {children}\n {isClient\n ? createPortal(\n <section\n className=\"uk-toast-viewport\"\n data-placement={placement}\n aria-label={label}\n aria-live=\"polite\"\n aria-atomic=\"false\"\n >\n {records.map((record) => (\n <ToastView\n key={record.id}\n record={record}\n closeLabel={closeLabel}\n onDismiss={dismiss}\n onPause={pause}\n onResume={resume}\n />\n ))}\n </section>,\n document.body,\n )\n : null}\n </ToastContext.Provider>\n );\n}\n\n/**\n * 获取 toast API。必须在 <ToastProvider> 内使用。\n */\nexport function useToast(): ToastApi {\n const context = useContext(ToastContext);\n\n if (!context) {\n throw new Error(\"useToast must be used within <ToastProvider>\");\n }\n\n return context;\n}\n"],"names":["cx","values","Button","forwardRef","variant","size","loading","iconOnly","type","className","children","rest","ref","jsxs","Input","inputSize","invalid","ariaInvalid","jsx","Switch","checked","defaultChecked","onCheckedChange","disabled","id","generatedId","useId","inputId","current","setCurrent","useControllableState","event","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","subscribeToNothing","getClientSnapshot","getServerSnapshot","Dialog","open","onOpenChange","title","description","footer","closeLabel","showCloseButton","closeOnBackdropClick","closeOnEscape","initialFocusRef","returnFocusRef","ariaLabel","dialogRef","useRef","openerRef","openRef","titleId","descriptionId","isClient","useSyncExternalStore","requestClose","useEventCallback","useLockBodyScroll","useEffect","dialog","useFocusTrap","onClose","onCancel","createPortal","ToastContext","EXIT_DURATION","ToastView","record","onDismiss","onPause","onResume","ToastProvider","placement","duration","maxToasts","label","records","setRecords","useState","recordsRef","durationsRef","autoTimersRef","exitTimersRef","counterRef","commit","useCallback","next","clearAutoTimer","timer","clearExitTimer","dismiss","scheduleAutoDismiss","delay","toast","options","overflow","item","kept","pause","resume","dismissAll","api","autoTimers","exitTimers","useToast"],"mappings":"uLAGO,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,EChBYE,EAEThB,EAAAA,WAA0C,SAC5C,CACE,QAAAiB,EACA,eAAAC,EACA,gBAAAC,EACA,SAAAC,EACA,UAAAd,EACA,SAAAC,EACA,GAAAc,EACA,GAAGb,CACL,EACAC,EACA,CACA,MAAMa,EAAcC,EAAAA,MAAA,EACdC,EAAUH,GAAMC,EAEhB,CAACG,EAASC,CAAU,EAAIC,uBAA8B,CAC1D,MAAOV,EACP,aAAcC,GAAkB,GAChC,SAAUC,CAAA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AM,IAAI,MAAM,8CAA8C,EAGhE,OAAOA,CACT"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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 { DialogProps } from "./Dialog";
|
|
11
|
+
export { ToastProvider, useToast } from "./Toast";
|
|
12
|
+
export type { ToastApi, ToastOptions, ToastPlacement, ToastProviderProps, ToastVariant, } from "./Toast";
|