@ug666/ui-react 0.1.0 → 0.3.0-beta.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/dist/aliases.d.ts +59 -0
- package/dist/aliases.d.ts.map +1 -0
- package/dist/blocks/feature-grid.d.ts +40 -0
- package/dist/blocks/feature-grid.d.ts.map +1 -0
- package/dist/blocks/index.cjs +467 -0
- package/dist/blocks/index.cjs.map +1 -0
- package/dist/blocks/index.d.ts +8 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +194 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/blocks/landing-hero.d.ts +55 -0
- package/dist/blocks/landing-hero.d.ts.map +1 -0
- package/dist/chunk-AKWJMDCW.js +467 -0
- package/dist/chunk-AKWJMDCW.js.map +1 -0
- package/dist/chunk-F23X4N6B.js +11 -0
- package/dist/chunk-F23X4N6B.js.map +1 -0
- package/dist/chunk-HGO3GZ56.js +1777 -0
- package/dist/chunk-HGO3GZ56.js.map +1 -0
- package/dist/chunk-HXIWD5LQ.js +319 -0
- package/dist/chunk-HXIWD5LQ.js.map +1 -0
- package/dist/chunk-M6J4PLF4.js +521 -0
- package/dist/chunk-M6J4PLF4.js.map +1 -0
- package/dist/chunk-N3Z7R6GG.js +139 -0
- package/dist/chunk-N3Z7R6GG.js.map +1 -0
- package/dist/chunk-UXWCK6M7.js +5757 -0
- package/dist/chunk-UXWCK6M7.js.map +1 -0
- package/dist/components/accordion.d.ts +59 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/alert.d.ts +23 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/avatar-group.d.ts +20 -0
- package/dist/components/avatar-group.d.ts.map +1 -0
- package/dist/components/avatar.d.ts +34 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/badge.d.ts +17 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/breadcrumb.d.ts +33 -0
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/button-group.d.ts +26 -0
- package/dist/components/button-group.d.ts.map +1 -0
- package/dist/components/button.d.ts +43 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/card.d.ts +26 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/checkbox-group-context.d.ts +14 -0
- package/dist/components/checkbox-group-context.d.ts.map +1 -0
- package/dist/components/checkbox-group.d.ts +18 -0
- package/dist/components/checkbox-group.d.ts.map +1 -0
- package/dist/components/checkbox.d.ts +32 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/config-provider.d.ts +29 -0
- package/dist/components/config-provider.d.ts.map +1 -0
- package/dist/components/container.d.ts +27 -0
- package/dist/components/container.d.ts.map +1 -0
- package/dist/components/context/form-context.d.ts +41 -0
- package/dist/components/context/form-context.d.ts.map +1 -0
- package/dist/components/context-menu.d.ts +39 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/descriptions.d.ts +40 -0
- package/dist/components/descriptions.d.ts.map +1 -0
- package/dist/components/dialog.d.ts +55 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/drawer.d.ts +38 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/dropdown.d.ts +42 -0
- package/dist/components/dropdown.d.ts.map +1 -0
- package/dist/components/empty-state.d.ts +24 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/form.d.ts +127 -0
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/icon.d.ts +16 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/index.cjs +8684 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.ts +60 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +391 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/input.d.ts +28 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/label.d.ts +18 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/layout.d.ts +34 -0
- package/dist/components/layout.d.ts.map +1 -0
- package/dist/components/link.d.ts +18 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/modal.d.ts +46 -0
- package/dist/components/modal.d.ts.map +1 -0
- package/dist/components/navigation-menu.d.ts +39 -0
- package/dist/components/navigation-menu.d.ts.map +1 -0
- package/dist/components/number-input.d.ts +35 -0
- package/dist/components/number-input.d.ts.map +1 -0
- package/dist/components/otp-input.d.ts +35 -0
- package/dist/components/otp-input.d.ts.map +1 -0
- package/dist/components/pagination.d.ts +16 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/popover.d.ts +36 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/progress.d.ts +21 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/radio.d.ts +68 -0
- package/dist/components/radio.d.ts.map +1 -0
- package/dist/components/scrollbar.d.ts +29 -0
- package/dist/components/scrollbar.d.ts.map +1 -0
- package/dist/components/select.d.ts +48 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/separator.d.ts +28 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/sheet.d.ts +24 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sidebar.d.ts +48 -0
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/skeleton.d.ts +16 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/slider.d.ts +44 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/space.d.ts +19 -0
- package/dist/components/space.d.ts.map +1 -0
- package/dist/components/spinner.d.ts +18 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/splitter.d.ts +51 -0
- package/dist/components/splitter.d.ts.map +1 -0
- package/dist/components/statistic.d.ts +30 -0
- package/dist/components/statistic.d.ts.map +1 -0
- package/dist/components/steps.d.ts +33 -0
- package/dist/components/steps.d.ts.map +1 -0
- package/dist/components/switch.d.ts +49 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/table.d.ts +32 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/tabs.d.ts +27 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tag.d.ts +27 -0
- package/dist/components/tag.d.ts.map +1 -0
- package/dist/components/text.d.ts +16 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/textarea.d.ts +26 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/toast.d.ts +26 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/tooltip.d.ts +29 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/hooks/index.cjs +229 -27
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +19 -231
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/use-click-outside.d.ts +9 -0
- package/dist/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +12 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts.map +1 -0
- package/dist/hooks/use-debounce.d.ts +7 -0
- package/dist/hooks/use-debounce.d.ts.map +1 -0
- package/dist/hooks/use-escape-key.d.ts +10 -0
- package/dist/hooks/use-escape-key.d.ts.map +1 -0
- package/dist/hooks/use-event-listener.d.ts +28 -0
- package/dist/hooks/use-event-listener.d.ts.map +1 -0
- package/dist/hooks/use-form.d.ts +48 -0
- package/dist/hooks/use-form.d.ts.map +1 -0
- package/dist/hooks/use-hotkeys.d.ts +30 -0
- package/dist/hooks/use-hotkeys.d.ts.map +1 -0
- package/dist/hooks/use-interval.d.ts +19 -0
- package/dist/hooks/use-interval.d.ts.map +1 -0
- package/dist/hooks/use-local-storage.d.ts +9 -0
- package/dist/hooks/use-local-storage.d.ts.map +1 -0
- package/dist/hooks/use-media-query.d.ts +8 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-mounted.d.ts +18 -0
- package/dist/hooks/use-mounted.d.ts.map +1 -0
- package/dist/hooks/use-pagination.d.ts +36 -0
- package/dist/hooks/use-pagination.d.ts.map +1 -0
- package/dist/hooks/use-timeout.d.ts +19 -0
- package/dist/hooks/use-timeout.d.ts.map +1 -0
- package/dist/hooks/use-toggle.d.ts +9 -0
- package/dist/hooks/use-toggle.d.ts.map +1 -0
- package/dist/index.cjs +7017 -1610
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +74 -1361
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +281 -3245
- package/dist/index.js.map +1 -1
- package/dist/internal/button-group-context.d.ts +11 -0
- package/dist/internal/button-group-context.d.ts.map +1 -0
- package/dist/internal/cn.d.ts +8 -0
- package/dist/internal/cn.d.ts.map +1 -0
- package/dist/internal/use-overlay-focus.d.ts +8 -0
- package/dist/internal/use-overlay-focus.d.ts.map +1 -0
- package/dist/internal/use-portal-container.d.ts +2 -0
- package/dist/internal/use-portal-container.d.ts.map +1 -0
- package/dist/labs/file-preview.d.ts +44 -0
- package/dist/labs/file-preview.d.ts.map +1 -0
- package/dist/labs/index.cjs +224 -0
- package/dist/labs/index.cjs.map +1 -0
- package/dist/labs/index.d.ts +14 -0
- package/dist/labs/index.d.ts.map +1 -0
- package/dist/labs/index.js +188 -0
- package/dist/labs/index.js.map +1 -0
- package/dist/labs/model-card.d.ts +50 -0
- package/dist/labs/model-card.d.ts.map +1 -0
- package/dist/patterns/admin-shell.d.ts +52 -0
- package/dist/patterns/admin-shell.d.ts.map +1 -0
- package/dist/patterns/confirm-dialog.d.ts +50 -0
- package/dist/patterns/confirm-dialog.d.ts.map +1 -0
- package/dist/patterns/copy-field.d.ts +29 -0
- package/dist/patterns/copy-field.d.ts.map +1 -0
- package/dist/patterns/index.cjs +1206 -0
- package/dist/patterns/index.cjs.map +1 -0
- package/dist/patterns/index.d.ts +5 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +375 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/page-header.d.ts +37 -0
- package/dist/patterns/page-header.d.ts.map +1 -0
- package/dist/primitives/index.cjs +2161 -0
- package/dist/primitives/index.cjs.map +1 -0
- package/dist/primitives/index.d.ts +24 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +107 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/styles.css +4365 -0
- package/dist/theme.cjs +161 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.ts +39 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +19 -0
- package/dist/theme.js.map +1 -0
- package/dist/themes/default.css +80 -0
- package/dist/themes/mecha.css +195 -0
- package/dist/themes/minimal.css +160 -0
- package/dist/tokens.css +1241 -9
- package/package.json +54 -14
- package/dist/chunk-MGXIF756.js +0 -313
- package/dist/chunk-MGXIF756.js.map +0 -1
- package/dist/hooks/index.d.cts +0 -232
- package/dist/index.d.cts +0 -1363
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type StatisticSize = 'sm' | 'default' | 'lg';
|
|
2
|
+
export type StatisticTrend = 'up' | 'down' | 'flat';
|
|
3
|
+
export interface StatisticProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'prefix'> {
|
|
4
|
+
/** 标题文案 */
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
/** 统计数值(数字会自动格式化,字符串原样展示) */
|
|
7
|
+
value: number | string;
|
|
8
|
+
/** 小数位数,仅 value 为 number 时生效 */
|
|
9
|
+
precision?: number;
|
|
10
|
+
/** 数值前缀,如图标 */
|
|
11
|
+
prefix?: React.ReactNode;
|
|
12
|
+
/** 数值后缀,如单位文字 */
|
|
13
|
+
suffix?: React.ReactNode;
|
|
14
|
+
/** 趋势方向 */
|
|
15
|
+
trend?: StatisticTrend;
|
|
16
|
+
/** 趋势说明文案,如 "+12%" */
|
|
17
|
+
change?: string;
|
|
18
|
+
/** 尺寸 */
|
|
19
|
+
size?: StatisticSize;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 统计数字卡片组件
|
|
23
|
+
* @example
|
|
24
|
+
* <Statistic title="今日订单" value={1234} suffix="单" trend="up" change="+12%" />
|
|
25
|
+
* <Statistic title="总收入" value={98765.5} precision={2} prefix={<DollarSign size={20} />} />
|
|
26
|
+
* <Statistic title="退单率" value={3.2} precision={1} suffix="%" trend="down" change="-0.5%" size="lg" />
|
|
27
|
+
*/
|
|
28
|
+
declare const Statistic: import("react").ForwardRefExoticComponent<StatisticProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export { Statistic };
|
|
30
|
+
//# sourceMappingURL=statistic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistic.d.ts","sourceRoot":"","sources":["../../src/components/statistic.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAA;AACnD,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAEnD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACpG,WAAW;IACX,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe;IACf,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,iBAAiB;IACjB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,WAAW;IACX,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS;IACT,IAAI,CAAC,EAAE,aAAa,CAAA;CACrB;AA4CD;;;;;;GAMG;AACH,QAAA,MAAM,SAAS,2GA8Dd,CAAA;AAID,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface StepItem {
|
|
2
|
+
/** 步骤标题 */
|
|
3
|
+
title: string;
|
|
4
|
+
/** 步骤描述(可选) */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** 自定义图标(可选,仅在未完成且非当前时生效) */
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface StepsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/** 当前激活步骤下标(0-based) */
|
|
11
|
+
current: number;
|
|
12
|
+
/** 步骤列表 */
|
|
13
|
+
items: StepItem[];
|
|
14
|
+
/** 排列方向 */
|
|
15
|
+
direction?: 'horizontal' | 'vertical';
|
|
16
|
+
/** 当前步骤状态 */
|
|
17
|
+
status?: 'process' | 'finish' | 'error';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 步骤条组件,展示流程进度
|
|
21
|
+
* @example
|
|
22
|
+
* <Steps
|
|
23
|
+
* current={1}
|
|
24
|
+
* items={[
|
|
25
|
+
* { title: '填写信息', description: '输入基本资料' },
|
|
26
|
+
* { title: '确认订单', description: '核对下单内容' },
|
|
27
|
+
* { title: '完成支付' },
|
|
28
|
+
* ]}
|
|
29
|
+
* />
|
|
30
|
+
*/
|
|
31
|
+
declare const Steps: import("react").ForwardRefExoticComponent<StepsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export { Steps };
|
|
33
|
+
//# sourceMappingURL=steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/components/steps.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,QAAQ;IACvB,WAAW;IACX,KAAK,EAAE,MAAM,CAAA;IACb,eAAe;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB;AAED,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACtE,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW;IACX,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,WAAW;IACX,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACrC,aAAa;IACb,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;CACxC;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,KAAK,uGAmHV,CAAA;AAID,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: Switch 开关组件 — 受控模式,支持 disabled、label、动画过渡
|
|
3
|
+
* @author: UG - 一个斗码大陆苦逼的三段码之气的少年,并没有神秘戒指中码老的帮助,但总有一天,我会成为斗码大陆中码帝一样的存在。三十年河东,三十年河西,莫欺少年穷。
|
|
4
|
+
* @date: 2026-04-15
|
|
5
|
+
*/
|
|
6
|
+
import { type ReactNode } from 'react';
|
|
7
|
+
import { type ControlSize } from './config-provider';
|
|
8
|
+
export interface SwitchProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onChange'> {
|
|
9
|
+
/** 是否选中(受控) */
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
/** 初始选中状态(非受控) */
|
|
12
|
+
defaultChecked?: boolean;
|
|
13
|
+
/** 切换回调 */
|
|
14
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
15
|
+
/** 切换前守卫;返回 false 或抛错会取消切换 */
|
|
16
|
+
beforeChange?: (checked: boolean) => boolean | Promise<boolean>;
|
|
17
|
+
/** 外部加载状态 */
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
/** 是否禁用 */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** 标签文本 */
|
|
22
|
+
label?: string;
|
|
23
|
+
/** 标签位置 */
|
|
24
|
+
labelPlacement?: 'left' | 'right';
|
|
25
|
+
/** 轨道宽度 */
|
|
26
|
+
width?: number | string;
|
|
27
|
+
/** 在轨道内部显示当前状态内容 */
|
|
28
|
+
inlinePrompt?: boolean;
|
|
29
|
+
/** 开启与关闭状态文本 */
|
|
30
|
+
activeText?: string;
|
|
31
|
+
inactiveText?: string;
|
|
32
|
+
/** 开启与关闭状态图标;优先于同状态文本 */
|
|
33
|
+
activeIcon?: ReactNode;
|
|
34
|
+
inactiveIcon?: ReactNode;
|
|
35
|
+
/** 滑块内部的开启与关闭内容 */
|
|
36
|
+
activeAction?: ReactNode;
|
|
37
|
+
inactiveAction?: ReactNode;
|
|
38
|
+
/** 控件尺寸;未指定时继承 ConfigProvider */
|
|
39
|
+
size?: ControlSize;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 开关组件
|
|
43
|
+
* @example
|
|
44
|
+
* <Switch checked={enabled} onCheckedChange={setEnabled} label="启用通知" />
|
|
45
|
+
* <Switch checked={dark} onCheckedChange={setDark} label="深色模式" labelPlacement="left" disabled />
|
|
46
|
+
*/
|
|
47
|
+
declare const Switch: import("react").ForwardRefExoticComponent<SwitchProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
48
|
+
export { Switch };
|
|
49
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/components/switch.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAA;AAEd,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAClG,eAAe;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kBAAkB;IAClB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW;IACX,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,8BAA8B;IAC9B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/D,aAAa;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW;IACX,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACjC,WAAW;IACX,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,oBAAoB;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,gBAAgB;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,yBAAyB;IACzB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,mBAAmB;IACnB,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,cAAc,CAAC,EAAE,SAAS,CAAA;IAC1B,iCAAiC;IACjC,IAAI,CAAC,EAAE,WAAW,CAAA;CACnB;AAgBD;;;;;GAKG;AACH,QAAA,MAAM,MAAM,2GA2NX,CAAA;AAID,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type TableProps = React.HTMLAttributes<HTMLTableElement>;
|
|
2
|
+
export type TableHeaderProps = React.HTMLAttributes<HTMLTableSectionElement>;
|
|
3
|
+
export type TableBodyProps = React.HTMLAttributes<HTMLTableSectionElement>;
|
|
4
|
+
export type TableRowProps = React.HTMLAttributes<HTMLTableRowElement>;
|
|
5
|
+
export type TableHeadProps = React.ThHTMLAttributes<HTMLTableCellElement>;
|
|
6
|
+
export type TableCellProps = React.TdHTMLAttributes<HTMLTableCellElement>;
|
|
7
|
+
/**
|
|
8
|
+
* 表格组件
|
|
9
|
+
* @example
|
|
10
|
+
* <Table>
|
|
11
|
+
* <TableHeader>
|
|
12
|
+
* <TableRow>
|
|
13
|
+
* <TableHead>姓名</TableHead>
|
|
14
|
+
* <TableHead>邮箱</TableHead>
|
|
15
|
+
* </TableRow>
|
|
16
|
+
* </TableHeader>
|
|
17
|
+
* <TableBody>
|
|
18
|
+
* <TableRow>
|
|
19
|
+
* <TableCell>张三</TableCell>
|
|
20
|
+
* <TableCell>zhangsan@example.com</TableCell>
|
|
21
|
+
* </TableRow>
|
|
22
|
+
* </TableBody>
|
|
23
|
+
* </Table>
|
|
24
|
+
*/
|
|
25
|
+
declare const Table: import("react").ForwardRefExoticComponent<TableProps & import("react").RefAttributes<HTMLTableElement>>;
|
|
26
|
+
declare const TableHeader: import("react").ForwardRefExoticComponent<TableHeaderProps & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
27
|
+
declare const TableBody: import("react").ForwardRefExoticComponent<TableBodyProps & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
28
|
+
declare const TableRow: import("react").ForwardRefExoticComponent<TableRowProps & import("react").RefAttributes<HTMLTableRowElement>>;
|
|
29
|
+
declare const TableHead: import("react").ForwardRefExoticComponent<TableHeadProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
30
|
+
declare const TableCell: import("react").ForwardRefExoticComponent<TableCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
31
|
+
export { Table, TableHeader, TableBody, TableRow, TableHead, TableCell };
|
|
32
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/components/table.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAA;AAC/D,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAA;AAC5E,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAA;AAC1E,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAA;AACrE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAA;AACzE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAA;AAEzE;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,KAAK,yGAiBT,CAAA;AAEF,QAAA,MAAM,WAAW,sHAEf,CAAA;AAEF,QAAA,MAAM,SAAS,oHAEb,CAAA;AAEF,QAAA,MAAM,QAAQ,+GAEZ,CAAA;AAEF,QAAA,MAAM,SAAS,iHAEb,CAAA;AAEF,QAAA,MAAM,SAAS,iHAEb,CAAA;AASF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
/** 当前激活的标签值 */
|
|
3
|
+
value: string;
|
|
4
|
+
/** 切换标签回调 */
|
|
5
|
+
onValueChange: (value: string) => void;
|
|
6
|
+
/** 子内容 */
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface TabsListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
}
|
|
11
|
+
export interface TabsTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
12
|
+
/** 对应的标签值 */
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
export interface TabsContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
+
/** 对应的标签值 */
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
declare const Tabs: import("react").ForwardRefExoticComponent<TabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
+
/** 标签列表容器 */
|
|
21
|
+
declare const TabsList: import("react").ForwardRefExoticComponent<TabsListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
|
+
/** 单个标签触发器 */
|
|
23
|
+
declare const TabsTrigger: import("react").ForwardRefExoticComponent<TabsTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
/** 标签内容面板 */
|
|
25
|
+
declare const TabsContent: import("react").ForwardRefExoticComponent<TabsContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
27
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":"AAsBA,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACrE,eAAe;IACf,KAAK,EAAE,MAAM,CAAA;IACb,aAAa;IACb,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,UAAU;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAE9E,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrF,aAAa;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5E,aAAa;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAkBD,QAAA,MAAM,IAAI,sGAmBR,CAAA;AAEF,aAAa;AACb,QAAA,MAAM,QAAQ,0GAYZ,CAAA;AAEF,cAAc;AACd,QAAA,MAAM,WAAW,gHA8Df,CAAA;AAEF,aAAa;AACb,QAAA,MAAM,WAAW,6GAoBf,CAAA;AAOF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
declare const tagVariants: (props?: ({
|
|
3
|
+
variant?: "default" | "destructive" | "outline" | "primary" | "success" | "warning" | null | undefined;
|
|
4
|
+
size?: "default" | "sm" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export interface TagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'>, VariantProps<typeof tagVariants> {
|
|
7
|
+
/** 是否显示关闭按钮 */
|
|
8
|
+
closable?: boolean;
|
|
9
|
+
/** 是否禁用 */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** 自定义背景色(覆盖 variant 颜色,建议传 token CSS 变量) */
|
|
12
|
+
color?: string;
|
|
13
|
+
/** 关闭按钮点击回调 */
|
|
14
|
+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 标签组件(可交互,支持关闭)
|
|
18
|
+
* @example
|
|
19
|
+
* <Tag>默认标签</Tag>
|
|
20
|
+
* <Tag variant="success">已完成</Tag>
|
|
21
|
+
* <Tag variant="primary" closable onClose={removeTag}>可关闭</Tag>
|
|
22
|
+
* <Tag variant="warning" disabled>禁用状态</Tag>
|
|
23
|
+
* <Tag color="hsl(var(--primary))">自定义颜色</Tag>
|
|
24
|
+
*/
|
|
25
|
+
declare const Tag: import("react").ForwardRefExoticComponent<TagProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
26
|
+
export { Tag, tagVariants };
|
|
27
|
+
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/components/tag.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGjE,QAAA,MAAM,WAAW;;;8EAsBhB,CAAA;AAED,MAAM,WAAW,QACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,EAC1D,YAAY,CAAC,OAAO,WAAW,CAAC;IAClC,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe;IACf,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAC/D;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,GAAG,sGA8CR,CAAA;AAID,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ElementType } from 'react';
|
|
2
|
+
import { type ControlSize } from './config-provider';
|
|
3
|
+
export type TextElement = ElementType;
|
|
4
|
+
export type TextTone = 'default' | 'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'info' | 'inherit';
|
|
5
|
+
export type TextSize = ControlSize | 'xs' | 'md';
|
|
6
|
+
export interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
7
|
+
as?: TextElement;
|
|
8
|
+
tone?: TextTone;
|
|
9
|
+
size?: TextSize;
|
|
10
|
+
truncate?: boolean;
|
|
11
|
+
/** 最多显示的行数;超出内容使用省略号裁切 */
|
|
12
|
+
lineClamp?: number | string;
|
|
13
|
+
}
|
|
14
|
+
declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<HTMLElement>>;
|
|
15
|
+
export { Text };
|
|
16
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components/text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,OAAO,CAAA;AAEd,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,MAAM,WAAW,GAAG,WAAW,CAAA;AACrC,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,SAAS,GACT,WAAW,GACX,UAAU,GACV,SAAS,GACT,SAAS,GACT,QAAQ,GACR,MAAM,GACN,SAAS,CAAA;AACb,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,IAAI,GAAG,IAAI,CAAA;AAEhD,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IAClE,EAAE,CAAC,EAAE,WAAW,CAAA;IAChB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC5B;AA4BD,QAAA,MAAM,IAAI,mGA6CT,CAAA;AAID,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type TextCountFunction } from '@ug666/ui-core';
|
|
2
|
+
import { type ControlSize } from './config-provider';
|
|
3
|
+
export type TextareaResize = 'none' | 'both' | 'horizontal' | 'vertical';
|
|
4
|
+
export interface TextareaAutosizeOptions {
|
|
5
|
+
minRows?: number;
|
|
6
|
+
maxRows?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
error?: React.ReactNode;
|
|
11
|
+
helperText?: React.ReactNode;
|
|
12
|
+
rows?: number;
|
|
13
|
+
size?: ControlSize;
|
|
14
|
+
resize?: TextareaResize;
|
|
15
|
+
autosize?: boolean | TextareaAutosizeOptions;
|
|
16
|
+
clearable?: boolean;
|
|
17
|
+
clearIcon?: React.ReactNode;
|
|
18
|
+
showWordLimit?: boolean;
|
|
19
|
+
wordLimitPosition?: 'inside' | 'outside';
|
|
20
|
+
countCharacters?: TextCountFunction;
|
|
21
|
+
onClear?: () => void;
|
|
22
|
+
onValueChange?: (value: string) => void;
|
|
23
|
+
}
|
|
24
|
+
declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
25
|
+
export { Textarea };
|
|
26
|
+
//# sourceMappingURL=textarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/components/textarea.tsx"],"names":[],"mappings":"AAYA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,CAAA;AAExE,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC;IACtF,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAA;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,iBAAiB,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IACxC,eAAe,CAAC,EAAE,iBAAiB,CAAA;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC;AA6CD,QAAA,MAAM,QAAQ,+GAyMb,CAAA;AAID,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ToastType = 'success' | 'error' | 'info';
|
|
2
|
+
export interface ToastItem {
|
|
3
|
+
id: string;
|
|
4
|
+
message: string;
|
|
5
|
+
type: ToastType;
|
|
6
|
+
}
|
|
7
|
+
/** toast 调用接口 */
|
|
8
|
+
export declare const toast: {
|
|
9
|
+
success: (message: string) => void;
|
|
10
|
+
error: (message: string) => void;
|
|
11
|
+
info: (message: string) => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Toaster 组件,放在应用根布局中一次即可
|
|
15
|
+
* @example
|
|
16
|
+
* // 在 layout 或 App 中:
|
|
17
|
+
* <Toaster />
|
|
18
|
+
*
|
|
19
|
+
* // 在任意组件中调用:
|
|
20
|
+
* toast.success('保存成功')
|
|
21
|
+
* toast.error('网络异常,请重试')
|
|
22
|
+
* toast.info('请先登录')
|
|
23
|
+
*/
|
|
24
|
+
declare const Toaster: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
25
|
+
export { Toaster };
|
|
26
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../src/components/toast.tsx"],"names":[],"mappings":"AAYA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;AAEpD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,SAAS,CAAA;CAChB;AA+BD,iBAAiB;AACjB,eAAO,MAAM,KAAK;IAChB,OAAO,YAAY,MAAM;IACzB,KAAK,YAAY,MAAM;IACvB,IAAI,YAAY,MAAM;CACvB,CAAA;AAcD;;;;;;;;;;GAUG;AACH,QAAA,MAAM,OAAO,2IA2EX,CAAA;AAIF,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface TooltipProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TooltipTriggerProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TooltipContentProps {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/** 显示方向 */
|
|
12
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Tooltip 容器
|
|
17
|
+
* @example
|
|
18
|
+
* <Tooltip>
|
|
19
|
+
* <TooltipTrigger><Button>悬停我</Button></TooltipTrigger>
|
|
20
|
+
* <TooltipContent side="top">这是提示文字</TooltipContent>
|
|
21
|
+
* </Tooltip>
|
|
22
|
+
*/
|
|
23
|
+
declare const Tooltip: import("react").ForwardRefExoticComponent<TooltipProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
24
|
+
/** Tooltip 触发器 */
|
|
25
|
+
declare const TooltipTrigger: import("react").ForwardRefExoticComponent<TooltipTriggerProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
26
|
+
/** Tooltip 内容气泡 */
|
|
27
|
+
declare const TooltipContent: import("react").ForwardRefExoticComponent<TooltipContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export { Tooltip, TooltipTrigger, TooltipContent };
|
|
29
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../src/components/tooltip.tsx"],"names":[],"mappings":"AAWA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,WAAW;IACX,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AA6BD;;;;;;;GAOG;AACH,QAAA,MAAM,OAAO,0GA4BX,CAAA;AAEF,kBAAkB;AAClB,QAAA,MAAM,cAAc,iHA4DlB,CAAA;AASF,mBAAmB;AACnB,QAAA,MAAM,cAAc,gHAuElB,CAAA;AAMF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,CAAA"}
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use client";
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -63,7 +64,10 @@ function useLocalStorage(key, initialValue) {
|
|
|
63
64
|
setStoredValue((prev) => {
|
|
64
65
|
const next = value instanceof Function ? value(prev) : value;
|
|
65
66
|
if (typeof window !== "undefined") {
|
|
66
|
-
|
|
67
|
+
try {
|
|
68
|
+
window.localStorage.setItem(key, JSON.stringify(next));
|
|
69
|
+
} catch {
|
|
70
|
+
}
|
|
67
71
|
}
|
|
68
72
|
return next;
|
|
69
73
|
});
|
|
@@ -71,7 +75,10 @@ function useLocalStorage(key, initialValue) {
|
|
|
71
75
|
const removeValue = (0, import_react2.useCallback)(() => {
|
|
72
76
|
setStoredValue(initialValue);
|
|
73
77
|
if (typeof window !== "undefined") {
|
|
74
|
-
|
|
78
|
+
try {
|
|
79
|
+
window.localStorage.removeItem(key);
|
|
80
|
+
} catch {
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
}, [key, initialValue]);
|
|
77
84
|
return [storedValue, setValue, removeValue];
|
|
@@ -134,7 +141,6 @@ function useCopyToClipboard() {
|
|
|
134
141
|
}, []);
|
|
135
142
|
const copy = (0, import_react5.useCallback)(async (text) => {
|
|
136
143
|
if (typeof navigator === "undefined" || !navigator.clipboard) {
|
|
137
|
-
console.error("\u526A\u8D34\u677F API \u4E0D\u53EF\u7528");
|
|
138
144
|
return;
|
|
139
145
|
}
|
|
140
146
|
try {
|
|
@@ -144,8 +150,8 @@ function useCopyToClipboard() {
|
|
|
144
150
|
clearTimeout(timerRef.current);
|
|
145
151
|
}
|
|
146
152
|
timerRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
147
|
-
} catch
|
|
148
|
-
|
|
153
|
+
} catch {
|
|
154
|
+
setCopied(false);
|
|
149
155
|
}
|
|
150
156
|
}, []);
|
|
151
157
|
return { copied, copy };
|
|
@@ -207,35 +213,231 @@ function usePagination({
|
|
|
207
213
|
|
|
208
214
|
// src/hooks/use-form.ts
|
|
209
215
|
var import_react8 = require("react");
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
);
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
216
|
+
var import_ui_core = require("@ug666/ui-core");
|
|
217
|
+
function normalizeFields(names, values) {
|
|
218
|
+
if (names === void 0) return Object.keys(values);
|
|
219
|
+
return Array.isArray(names) ? names : [names];
|
|
220
|
+
}
|
|
221
|
+
function useForm(initialValues, options = {}) {
|
|
222
|
+
const initialValuesRef = (0, import_react8.useRef)({ ...initialValues });
|
|
223
|
+
const [values, setValuesState] = (0, import_react8.useState)(() => ({ ...initialValues }));
|
|
224
|
+
const [errors, setErrors] = (0, import_react8.useState)(options.initialErrors ?? {});
|
|
225
|
+
const [touched, setTouched] = (0, import_react8.useState)({});
|
|
226
|
+
const [validatingFields, setValidatingFields] = (0, import_react8.useState)({});
|
|
227
|
+
const [isValidating, setIsValidating] = (0, import_react8.useState)(false);
|
|
228
|
+
const validationCountRef = (0, import_react8.useRef)(0);
|
|
229
|
+
const validationGenerationRef = (0, import_react8.useRef)(0);
|
|
230
|
+
const validationRunRef = (0, import_react8.useRef)({});
|
|
231
|
+
const fieldElementsRef = (0, import_react8.useRef)(/* @__PURE__ */ new Map());
|
|
232
|
+
const dirtyFields = (0, import_react8.useMemo)(() => {
|
|
233
|
+
const next = {};
|
|
234
|
+
for (const name of Object.keys(values)) {
|
|
235
|
+
if (!Object.is(values[name], initialValuesRef.current[name])) next[name] = true;
|
|
236
|
+
}
|
|
237
|
+
return next;
|
|
238
|
+
}, [values]);
|
|
239
|
+
const isDirty = Object.keys(dirtyFields).length > 0;
|
|
240
|
+
const isValid = Object.keys(errors).length === 0;
|
|
241
|
+
const beginValidation = (0, import_react8.useCallback)(() => {
|
|
242
|
+
const generation = validationGenerationRef.current;
|
|
243
|
+
validationCountRef.current += 1;
|
|
244
|
+
setIsValidating(true);
|
|
245
|
+
return generation;
|
|
246
|
+
}, []);
|
|
247
|
+
const endValidation = (0, import_react8.useCallback)((generation) => {
|
|
248
|
+
if (generation !== validationGenerationRef.current) return;
|
|
249
|
+
validationCountRef.current = Math.max(0, validationCountRef.current - 1);
|
|
250
|
+
if (validationCountRef.current === 0) setIsValidating(false);
|
|
251
|
+
}, []);
|
|
252
|
+
const runFieldValidation = (0, import_react8.useCallback)(async (name, trigger, currentValues) => {
|
|
253
|
+
const run = (validationRunRef.current[name] ?? 0) + 1;
|
|
254
|
+
validationRunRef.current[name] = run;
|
|
255
|
+
setValidatingFields((current) => ({ ...current, [name]: true }));
|
|
256
|
+
const generation = beginValidation();
|
|
257
|
+
const message = await (0, import_ui_core.validateFormValue)(
|
|
258
|
+
currentValues[name],
|
|
259
|
+
options.rules?.[name],
|
|
260
|
+
currentValues,
|
|
261
|
+
trigger
|
|
262
|
+
);
|
|
263
|
+
const isCurrentRun = validationRunRef.current[name] === run;
|
|
264
|
+
if (isCurrentRun) {
|
|
265
|
+
setErrors((current) => {
|
|
266
|
+
if (message) return { ...current, [name]: message };
|
|
267
|
+
if (current[name] === void 0) return current;
|
|
268
|
+
const next = { ...current };
|
|
269
|
+
delete next[name];
|
|
270
|
+
return next;
|
|
271
|
+
});
|
|
272
|
+
setValidatingFields((current) => {
|
|
273
|
+
const next = { ...current };
|
|
274
|
+
delete next[name];
|
|
275
|
+
return next;
|
|
276
|
+
});
|
|
277
|
+
options.onValidate?.(name, !message, message);
|
|
278
|
+
}
|
|
279
|
+
endValidation(generation);
|
|
280
|
+
return isCurrentRun ? !message : true;
|
|
281
|
+
}, [beginValidation, endValidation, options.onValidate, options.rules]);
|
|
282
|
+
const setFieldValue = (0, import_react8.useCallback)((name, value) => {
|
|
283
|
+
setValuesState((current) => {
|
|
284
|
+
const next = { ...current, [name]: value };
|
|
285
|
+
if (options.validateOnChange) void runFieldValidation(name, "change", next);
|
|
225
286
|
return next;
|
|
226
287
|
});
|
|
288
|
+
}, [options.validateOnChange, runFieldValidation]);
|
|
289
|
+
const handleChange = setFieldValue;
|
|
290
|
+
const handleBlur = (0, import_react8.useCallback)((name) => {
|
|
291
|
+
setTouched((current) => ({ ...current, [name]: true }));
|
|
292
|
+
if (options.validateOnBlur) void runFieldValidation(name, "blur", values);
|
|
293
|
+
}, [options.validateOnBlur, runFieldValidation, values]);
|
|
294
|
+
const setValues = (0, import_react8.useCallback)((nextValue) => {
|
|
295
|
+
setValuesState((current) => typeof nextValue === "function" ? nextValue(current) : nextValue);
|
|
227
296
|
}, []);
|
|
228
297
|
const setError = (0, import_react8.useCallback)((name, message) => {
|
|
229
|
-
setErrors((
|
|
298
|
+
setErrors((current) => ({ ...current, [name]: message }));
|
|
230
299
|
}, []);
|
|
231
|
-
const clearErrors = (0, import_react8.useCallback)(() => {
|
|
232
|
-
|
|
300
|
+
const clearErrors = (0, import_react8.useCallback)((names) => {
|
|
301
|
+
if (names === void 0) {
|
|
302
|
+
setErrors({});
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const fields = Array.isArray(names) ? names : [names];
|
|
306
|
+
setErrors((current) => {
|
|
307
|
+
const next = { ...current };
|
|
308
|
+
for (const name of fields) delete next[name];
|
|
309
|
+
return next;
|
|
310
|
+
});
|
|
233
311
|
}, []);
|
|
234
|
-
const
|
|
235
|
-
|
|
312
|
+
const clearValidate = (0, import_react8.useCallback)((names) => {
|
|
313
|
+
clearErrors(names);
|
|
314
|
+
const fields = names === void 0 ? Object.keys(validationRunRef.current) : Array.isArray(names) ? names : [names];
|
|
315
|
+
for (const name of fields) {
|
|
316
|
+
validationRunRef.current[name] = (validationRunRef.current[name] ?? 0) + 1;
|
|
317
|
+
}
|
|
318
|
+
setValidatingFields((current) => {
|
|
319
|
+
if (names === void 0) return {};
|
|
320
|
+
const next = { ...current };
|
|
321
|
+
for (const name of fields) delete next[name];
|
|
322
|
+
return next;
|
|
323
|
+
});
|
|
324
|
+
}, [clearErrors]);
|
|
325
|
+
const registerField = (0, import_react8.useCallback)((name, element) => {
|
|
326
|
+
if (element) fieldElementsRef.current.set(name, element);
|
|
327
|
+
else fieldElementsRef.current.delete(name);
|
|
328
|
+
}, []);
|
|
329
|
+
const getField = (0, import_react8.useCallback)(
|
|
330
|
+
(name) => fieldElementsRef.current.get(name),
|
|
331
|
+
[]
|
|
332
|
+
);
|
|
333
|
+
const scrollToField = (0, import_react8.useCallback)((name, scrollOptions = options.scrollIntoViewOptions ?? {
|
|
334
|
+
behavior: "smooth",
|
|
335
|
+
block: "center"
|
|
336
|
+
}) => {
|
|
337
|
+
fieldElementsRef.current.get(name)?.scrollIntoView(scrollOptions);
|
|
338
|
+
}, [options.scrollIntoViewOptions]);
|
|
339
|
+
const scrollToError = (0, import_react8.useCallback)((scrollOptions) => {
|
|
340
|
+
const firstInvalidField = Object.keys(errors)[0];
|
|
341
|
+
if (firstInvalidField !== void 0) scrollToField(firstInvalidField, scrollOptions);
|
|
342
|
+
}, [errors, scrollToField]);
|
|
343
|
+
const validateField = (0, import_react8.useCallback)((name, trigger = "submit") => runFieldValidation(name, trigger, values), [runFieldValidation, values]);
|
|
344
|
+
const validate = (0, import_react8.useCallback)(async (names) => {
|
|
345
|
+
const fields = normalizeFields(names, values);
|
|
346
|
+
const results = await Promise.all(
|
|
347
|
+
fields.map((name) => runFieldValidation(name, "submit", values))
|
|
348
|
+
);
|
|
349
|
+
return results.every(Boolean);
|
|
350
|
+
}, [runFieldValidation, values]);
|
|
351
|
+
const handleSubmit = (0, import_react8.useCallback)((callback) => async (event) => {
|
|
352
|
+
event.preventDefault();
|
|
353
|
+
setTouched(Object.fromEntries(
|
|
354
|
+
Object.keys(values).map((name) => [name, true])
|
|
355
|
+
));
|
|
356
|
+
if (await validate()) {
|
|
357
|
+
await callback(values, event);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (options.scrollToError) {
|
|
361
|
+
requestAnimationFrame(() => {
|
|
362
|
+
const firstInvalidEntry = [...fieldElementsRef.current.entries()].find(([, element]) => element.dataset.state === "invalid");
|
|
363
|
+
if (firstInvalidEntry) scrollToField(firstInvalidEntry[0]);
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}, [options.scrollToError, scrollToField, validate, values]);
|
|
367
|
+
const reset = (0, import_react8.useCallback)((nextValues) => {
|
|
368
|
+
if (nextValues) initialValuesRef.current = { ...nextValues };
|
|
369
|
+
setValuesState({ ...nextValues ?? initialValuesRef.current });
|
|
236
370
|
setErrors({});
|
|
237
|
-
|
|
238
|
-
|
|
371
|
+
setTouched({});
|
|
372
|
+
setValidatingFields({});
|
|
373
|
+
for (const name of Object.keys(validationRunRef.current)) {
|
|
374
|
+
validationRunRef.current[name] = (validationRunRef.current[name] ?? 0) + 1;
|
|
375
|
+
}
|
|
376
|
+
validationGenerationRef.current += 1;
|
|
377
|
+
validationCountRef.current = 0;
|
|
378
|
+
setIsValidating(false);
|
|
379
|
+
}, []);
|
|
380
|
+
const resetFields = (0, import_react8.useCallback)((names) => {
|
|
381
|
+
if (names === void 0) {
|
|
382
|
+
reset();
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
const fields = Array.isArray(names) ? names : [names];
|
|
386
|
+
for (const name of fields) {
|
|
387
|
+
validationRunRef.current[name] = (validationRunRef.current[name] ?? 0) + 1;
|
|
388
|
+
}
|
|
389
|
+
setValuesState((current) => {
|
|
390
|
+
const next = { ...current };
|
|
391
|
+
for (const name of fields) next[name] = initialValuesRef.current[name];
|
|
392
|
+
return next;
|
|
393
|
+
});
|
|
394
|
+
setErrors((current) => {
|
|
395
|
+
const next = { ...current };
|
|
396
|
+
for (const name of fields) delete next[name];
|
|
397
|
+
return next;
|
|
398
|
+
});
|
|
399
|
+
setTouched((current) => {
|
|
400
|
+
const next = { ...current };
|
|
401
|
+
for (const name of fields) delete next[name];
|
|
402
|
+
return next;
|
|
403
|
+
});
|
|
404
|
+
setValidatingFields((current) => {
|
|
405
|
+
const next = { ...current };
|
|
406
|
+
for (const name of fields) delete next[name];
|
|
407
|
+
return next;
|
|
408
|
+
});
|
|
409
|
+
}, [reset]);
|
|
410
|
+
const setInitialValues = (0, import_react8.useCallback)((nextValues) => {
|
|
411
|
+
initialValuesRef.current = { ...nextValues };
|
|
412
|
+
}, []);
|
|
413
|
+
return {
|
|
414
|
+
values,
|
|
415
|
+
rules: options.rules,
|
|
416
|
+
errors,
|
|
417
|
+
touched,
|
|
418
|
+
dirtyFields,
|
|
419
|
+
validatingFields,
|
|
420
|
+
isDirty,
|
|
421
|
+
isValid,
|
|
422
|
+
isValidating,
|
|
423
|
+
handleChange,
|
|
424
|
+
handleBlur,
|
|
425
|
+
setFieldValue,
|
|
426
|
+
setValues,
|
|
427
|
+
setError,
|
|
428
|
+
clearErrors,
|
|
429
|
+
clearValidate,
|
|
430
|
+
validateField,
|
|
431
|
+
validate,
|
|
432
|
+
handleSubmit,
|
|
433
|
+
reset,
|
|
434
|
+
resetFields,
|
|
435
|
+
setInitialValues,
|
|
436
|
+
registerField,
|
|
437
|
+
getField,
|
|
438
|
+
scrollToField,
|
|
439
|
+
scrollToError
|
|
440
|
+
};
|
|
239
441
|
}
|
|
240
442
|
|
|
241
443
|
// src/hooks/use-mounted.ts
|