tango-ui-cw 0.9.9 → 1.0.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/README.md +124 -39
- package/dist/component/CSSFab/index.d.ts +55 -0
- package/dist/component/CSSFab/useTangoStyle.d.ts +1 -0
- package/dist/component/TBanner/index.d.ts +50 -0
- package/dist/component/TButton/index.d.ts +107 -0
- package/dist/component/TColorPicker/index.d.ts +41 -0
- package/dist/component/TDate/index.d.ts +41 -0
- package/dist/component/TDatePicker/index.d.ts +49 -0
- package/dist/component/TDrawer/index.d.ts +58 -0
- package/dist/component/TInput/index.d.ts +81 -0
- package/dist/component/TLayout/index.d.ts +133 -0
- package/dist/component/TLine/index.d.ts +33 -0
- package/dist/component/TMark/index.d.ts +38 -0
- package/dist/component/TModal/index.d.ts +52 -0
- package/dist/component/TNotice/index.d.ts +30 -0
- package/dist/component/TSearch/index.d.ts +42 -0
- package/dist/component/TSpace/index.d.ts +56 -0
- package/dist/component/TTable/index.d.ts +76 -0
- package/dist/component/TTooltip/index.d.ts +31 -0
- package/dist/component/TUpload/index.d.ts +45 -0
- package/dist/component/index.d.ts +147 -0
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +3648 -2
- package/dist/providers/NoticeProvider/NoticeProvider.d.ts +19 -0
- package/dist/providers/TangoI18nProvider/TangoI18nProvider.d.ts +28 -0
- package/dist/providers/ThemeProvider/ThemeProvider.d.ts +22 -0
- package/dist/scripts/check-peers.js +82 -0
- package/dist/styles/global.css +372 -0
- package/dist/styles/theme.css +13 -0
- package/package.json +65 -48
- package/dist/assets/Upload/delLogo.png.js +0 -1
- package/dist/assets/Upload/delLogo.png.mjs +0 -4
- package/dist/assets/Upload/fileslogo.png.js +0 -1
- package/dist/assets/Upload/fileslogo.png.mjs +0 -4
- package/dist/component/CSSFab/useTangoStyle.js +0 -2
- package/dist/component/CSSFab/useTangoStyle.mjs +0 -171
- package/dist/component/MaterialButton/MaterialButton.module.css.js +0 -1
- package/dist/component/MaterialButton/MaterialButton.module.css.mjs +0 -17
- package/dist/component/MaterialButton/index.js +0 -2
- package/dist/component/MaterialButton/index.mjs +0 -62
- package/dist/component/MaterialInput/MaterialInput.module.css.js +0 -1
- package/dist/component/MaterialInput/MaterialInput.module.css.mjs +0 -17
- package/dist/component/MaterialInput/index.js +0 -2
- package/dist/component/MaterialInput/index.mjs +0 -37
- package/dist/component/TBanner/TBanner.module.css.js +0 -1
- package/dist/component/TBanner/TBanner.module.css.mjs +0 -35
- package/dist/component/TBanner/index.js +0 -2
- package/dist/component/TBanner/index.mjs +0 -341
- package/dist/component/TButton/TButton.module.css.js +0 -1
- package/dist/component/TButton/TButton.module.css.mjs +0 -26
- package/dist/component/TButton/index.js +0 -2
- package/dist/component/TButton/index.mjs +0 -186
- package/dist/component/TColorPicker/TColorPicker.module.css.js +0 -1
- package/dist/component/TColorPicker/TColorPicker.module.css.mjs +0 -13
- package/dist/component/TColorPicker/index.js +0 -2
- package/dist/component/TColorPicker/index.mjs +0 -62
- package/dist/component/TDate/index.js +0 -2
- package/dist/component/TDate/index.mjs +0 -145
- package/dist/component/TDatePicker/TDatePicker.module.css.js +0 -1
- package/dist/component/TDatePicker/TDatePicker.module.css.mjs +0 -45
- package/dist/component/TDatePicker/index.js +0 -2
- package/dist/component/TDatePicker/index.mjs +0 -167
- package/dist/component/TDrawer/TDrawer.module.css.js +0 -1
- package/dist/component/TDrawer/TDrawer.module.css.mjs +0 -49
- package/dist/component/TDrawer/index.js +0 -2
- package/dist/component/TDrawer/index.mjs +0 -111
- package/dist/component/TInput/TInput.module.css.js +0 -1
- package/dist/component/TInput/TInput.module.css.mjs +0 -21
- package/dist/component/TInput/index.js +0 -2
- package/dist/component/TInput/index.mjs +0 -75
- package/dist/component/TLayout/index.js +0 -2
- package/dist/component/TLayout/index.mjs +0 -53
- package/dist/component/TLine/TLine.module.css.js +0 -1
- package/dist/component/TLine/TLine.module.css.mjs +0 -19
- package/dist/component/TLine/index.js +0 -2
- package/dist/component/TLine/index.mjs +0 -35
- package/dist/component/TMark/TMark.module.css.js +0 -1
- package/dist/component/TMark/TMark.module.css.mjs +0 -7
- package/dist/component/TMark/index.js +0 -2
- package/dist/component/TMark/index.mjs +0 -52
- package/dist/component/TModal/TModal.module.css.js +0 -1
- package/dist/component/TModal/TModal.module.css.mjs +0 -33
- package/dist/component/TModal/index.js +0 -2
- package/dist/component/TModal/index.mjs +0 -110
- package/dist/component/TNotice/TNotice.module.css.js +0 -1
- package/dist/component/TNotice/TNotice.module.css.mjs +0 -27
- package/dist/component/TNotice/index.js +0 -4
- package/dist/component/TNotice/index.mjs +0 -40
- package/dist/component/TNotice/useNotice.js +0 -2
- package/dist/component/TNotice/useNotice.mjs +0 -19
- package/dist/component/TSearch/TSearch.module.css.js +0 -1
- package/dist/component/TSearch/TSearch.module.css.mjs +0 -21
- package/dist/component/TSearch/index.js +0 -2
- package/dist/component/TSearch/index.mjs +0 -73
- package/dist/component/TSpace/TSpace.module.css.js +0 -1
- package/dist/component/TSpace/TSpace.module.css.mjs +0 -23
- package/dist/component/TSpace/index.js +0 -2
- package/dist/component/TSpace/index.mjs +0 -49
- package/dist/component/TTable/TTable.module.css.js +0 -1
- package/dist/component/TTable/TTable.module.css.mjs +0 -25
- package/dist/component/TTable/index.js +0 -8
- package/dist/component/TTable/index.mjs +0 -154
- package/dist/component/TTooltip/TTooltip.module.css.js +0 -1
- package/dist/component/TTooltip/TTooltip.module.css.mjs +0 -17
- package/dist/component/TTooltip/index.js +0 -2
- package/dist/component/TTooltip/index.mjs +0 -34
- package/dist/component/TUpload/TUpload.module.css.js +0 -1
- package/dist/component/TUpload/TUpload.module.css.mjs +0 -15
- package/dist/component/TUpload/index.js +0 -2
- package/dist/component/TUpload/index.mjs +0 -152
- package/dist/index.mjs +0 -50
- package/dist/providers/NoticeProvider.js +0 -2
- package/dist/providers/NoticeProvider.mjs +0 -117
- package/dist/providers/ThemeProvider.js +0 -2
- package/dist/providers/ThemeProvider.mjs +0 -21
- package/dist/tango-ui-cw.css +0 -1
package/README.md
CHANGED
|
@@ -1,39 +1,124 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
# Tango UI
|
|
2
|
+
|
|
3
|
+
A lightweight, zero-dependency React UI library for Next.js, powered by Tailwind CSS.
|
|
4
|
+
|
|
5
|
+
**Author**: ClayW
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Official Docs
|
|
10
|
+
|
|
11
|
+
🔗 [https://tango-ui-new.vercel.app/](https://tango-ui-new.vercel.app/)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install tango-ui-cw
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Peer Dependencies
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install react@>=18 react-dom@>=18 next@>=14 tailwind-merge@^3.6.0 tailwindcss@^4
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
> `next` and `react-dom` are optional peers — only required if you use SSR/SSG features.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
// Import components
|
|
35
|
+
import { Button, Input, Layout, Upload } from "tango-ui-cw";
|
|
36
|
+
|
|
37
|
+
// Import styles (required)
|
|
38
|
+
import "tango-ui-cw/style.css";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Compound Components
|
|
42
|
+
|
|
43
|
+
```jsx
|
|
44
|
+
import { Button, Layout } from "tango-ui-cw";
|
|
45
|
+
|
|
46
|
+
const { MaterialButton } = Button
|
|
47
|
+
const { Header, Content } = Layout
|
|
48
|
+
|
|
49
|
+
// Access sub-components via dot notation
|
|
50
|
+
<MaterialButton>Click</MaterialButton>
|
|
51
|
+
<Header>...</Header>
|
|
52
|
+
<Content>...</Content>
|
|
53
|
+
|
|
54
|
+
// Or import directly
|
|
55
|
+
import { MaterialButton, Header, Content } from "tango-ui-cw";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Supported Versions
|
|
61
|
+
|
|
62
|
+
| Package | Version |
|
|
63
|
+
|---------|---------|
|
|
64
|
+
| React | >= 18 |
|
|
65
|
+
| React DOM | >= 18 |
|
|
66
|
+
| Next.js | >= 14 |
|
|
67
|
+
| Tailwind CSS | ^4 |
|
|
68
|
+
| tailwind-merge | ^3.6.0 |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Features
|
|
73
|
+
|
|
74
|
+
- **Zero dependencies** — no runtime deps bloating your bundle
|
|
75
|
+
- **18+ components** — Button, Input, Layout, Upload, Modal, Drawer, Table, DatePicker, ColorPicker, Search, Tooltip, Notice, Banner, Space, Line, Mark, and more
|
|
76
|
+
- **`sx` prop styling** — three input forms: Tailwind string, CSS shorthand object, or slot-structured object for per-slot control
|
|
77
|
+
- **70+ CSS shorthand properties** — `useTangoStyle()` auto-resolves shorthand like `mt`, `bgc`, `aic` to full CSS properties
|
|
78
|
+
- **Slot-based architecture** — every component declares named slots, `normalizeSxSlots()` decomposes `sx` into per-slot `{ tw, css }`
|
|
79
|
+
- **CSS variable token system** — use `$primary`, `$border` in `sx` values, auto-expanded to `var(--primary)`
|
|
80
|
+
- **Tailwind CSS powered** — `mergeTwClassNames()` for intelligent class conflict resolution via tailwind-merge
|
|
81
|
+
- **Material Design variants** — `Button.MaterialButton` with ripple effect, `Input.MaterialInput` with floating label
|
|
82
|
+
- **Compound component pattern** — `Layout.Header`, `Layout.Sider`, `Button.MaterialButton` etc., also available as named exports
|
|
83
|
+
- **Theme customization** — light/dark mode via `ThemeProvider`, runtime token overrides with `setThemeTokens()` / `setThemeColor()`
|
|
84
|
+
- **100+ CSS custom properties** — oklch color space, semantic tokens for every component, responsive breakpoints
|
|
85
|
+
- **Smooth theme transitions** — automatic transition animation when switching light/dark mode
|
|
86
|
+
- **i18n built-in** — `TangoI18nProvider` with zh-CN / en-US packs, custom message merging, dot-path `t()` lookup
|
|
87
|
+
- **Imperative notifications** — `useNotice()` with success / fail / caution variants and auto-dismiss
|
|
88
|
+
- **Neumorphism support** — Button `enu` variant with soft-UI shadow effects
|
|
89
|
+
- **Controlled & uncontrolled** — Input, DatePicker, ColorPicker, Tooltip all support both patterns
|
|
90
|
+
- **`'use client'` ready** — all components marked as client components, fully compatible with Next.js RSC
|
|
91
|
+
- **forwardRef support** — ref forwarding on Layout sub-components, Space, Tooltip, Notice, Upload, and more
|
|
92
|
+
- **Data attributes** — `data-variant`, `data-size` on Button for external CSS selector hooks
|
|
93
|
+
- **Tree-shakable** — ESM first with CJS fallback
|
|
94
|
+
- **TypeScript ready** — full `.d.ts` type declarations included and Support editor auto-inference
|
|
95
|
+
|
|
96
|
+
### 特性(中文)
|
|
97
|
+
|
|
98
|
+
- **零依赖** — 没有运行时依赖,不会增加你的包体积
|
|
99
|
+
- **18+ 组件** — Button、Input、Layout、Upload、Modal、Drawer、Table、DatePicker、ColorPicker、Search、Tooltip、Notice、Banner、Space、Line、Mark 等
|
|
100
|
+
- **`sx` 属性样式** — 三种输入形式:Tailwind 字符串、CSS 简写对象、或按 slot 分层的结构化对象
|
|
101
|
+
- **70+ CSS 简写属性** — `useTangoStyle()` 自动将 `mt`、`bgc`、`aic` 等简写解析为完整 CSS 属性
|
|
102
|
+
- **Slot 架构** — 每个组件声明命名 slot,`normalizeSxSlots()` 将 `sx` 分解为每个 slot 的 `{ tw, css }`
|
|
103
|
+
- **CSS 变量 Token 系统** — 在 `sx` 值中使用 `$primary`、`$border`,自动展开为 `var(--primary)`
|
|
104
|
+
- **Tailwind CSS 驱动** — `mergeTwClassNames()` 基于 tailwind-merge 智能解决类名冲突
|
|
105
|
+
- **Material Design 变体** — `Button.MaterialButton` 带涟漪效果,`Input.MaterialInput` 带浮动标签
|
|
106
|
+
- **复合组件模式** — `Layout.Header`、`Layout.Sider`、`Button.MaterialButton` 等,同时支持命名导出
|
|
107
|
+
- **主题定制** — 通过 `ThemeProvider` 切换亮/暗模式,`setThemeTokens()` / `setThemeColor()` 运行时覆盖 token
|
|
108
|
+
- **100+ CSS 自定义属性** — oklch 色彩空间,每个组件的语义化 token,响应式断点
|
|
109
|
+
- **平滑主题过渡** — 切换亮/暗模式时自动播放过渡动画
|
|
110
|
+
- **内置国际化** — `TangoI18nProvider` 支持 zh-CN / en-US 语言包,自定义消息合并,点路径 `t()` 查找
|
|
111
|
+
- **命令式通知** — `useNotice()` 提供 success / fail / caution 变体,支持自动消失
|
|
112
|
+
- **拟物风支持** — Button `enu` 变体带柔和 UI 阴影效果
|
|
113
|
+
- **受控与非受控** — Input、DatePicker、ColorPicker、Tooltip 均支持两种模式
|
|
114
|
+
- **`'use client'` 就绪** — 所有组件标记为客户端组件,完全兼容 Next.js RSC
|
|
115
|
+
- **forwardRef 支持** — Layout 子组件、Space、Tooltip、Notice、Upload 等支持 ref 转发
|
|
116
|
+
- **Data 属性** — Button 上的 `data-variant`、`data-size` 可用于外部 CSS 选择器
|
|
117
|
+
- **可 Tree-shaking** — ESM 优先,同时提供 CJS 回退
|
|
118
|
+
- **TypeScript 就绪** — 包含完整的 `.d.ts` 类型声明,支持编辑器自动推断
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
|
|
3
|
+
export type SxStyleObject = CSSProperties & {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type SxSlotValue =
|
|
8
|
+
| string
|
|
9
|
+
| SxStyleObject
|
|
10
|
+
| {
|
|
11
|
+
tw?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
css?: SxStyleObject;
|
|
14
|
+
style?: SxStyleObject;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type SxValue =
|
|
18
|
+
| string
|
|
19
|
+
| SxStyleObject
|
|
20
|
+
| {
|
|
21
|
+
root?: SxSlotValue;
|
|
22
|
+
slots?: Record<string, SxSlotValue>;
|
|
23
|
+
tw?: string;
|
|
24
|
+
className?: string;
|
|
25
|
+
css?: SxStyleObject;
|
|
26
|
+
style?: SxStyleObject;
|
|
27
|
+
[slotOrStyle: string]: unknown;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type NormalizedSxSlot = {
|
|
31
|
+
tw: string;
|
|
32
|
+
css: SxStyleObject;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export declare const useTangoStyle: (sx?: SxStyleObject) => SxStyleObject;
|
|
36
|
+
|
|
37
|
+
export declare const mergeTwClassNames: (
|
|
38
|
+
...inputs: Array<string | null | undefined | false>
|
|
39
|
+
) => string;
|
|
40
|
+
|
|
41
|
+
export declare const normalizeSxSlots: (
|
|
42
|
+
sx: SxValue,
|
|
43
|
+
slotNames?: string[]
|
|
44
|
+
) => Record<string, NormalizedSxSlot>;
|
|
45
|
+
|
|
46
|
+
export declare const createSlotProps: (options?: {
|
|
47
|
+
baseClassName?: string;
|
|
48
|
+
className?: string;
|
|
49
|
+
baseStyle?: SxStyleObject;
|
|
50
|
+
style?: SxStyleObject;
|
|
51
|
+
sxSlot?: NormalizedSxSlot;
|
|
52
|
+
}) => {
|
|
53
|
+
className: string;
|
|
54
|
+
style: SxStyleObject;
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import type { SxValue } from "../CSSFab";
|
|
3
|
+
|
|
4
|
+
export type BannerLevel = "info" | "success" | "warning" | "error";
|
|
5
|
+
export type BannerSize = "small" | "normal" | "large";
|
|
6
|
+
|
|
7
|
+
export type BannerI18nKey = "cancel" | "action" | (string & {});
|
|
8
|
+
|
|
9
|
+
export type BannerLocaleText = Partial<
|
|
10
|
+
Record<"cancel" | "action" | string, string>
|
|
11
|
+
>;
|
|
12
|
+
|
|
13
|
+
export interface BannerProps
|
|
14
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, "style" | "className" | "children"> {
|
|
15
|
+
/** Banner content text; falls back to i18n cancel text if omitted */
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
/** Fired when close/cancel button is clicked */
|
|
18
|
+
onCancel?: () => void;
|
|
19
|
+
/** Fired when action button is clicked */
|
|
20
|
+
onAction?: () => void;
|
|
21
|
+
/** Banner size variant */
|
|
22
|
+
size?: BannerSize;
|
|
23
|
+
/** Custom cancel button text (overrides i18n) */
|
|
24
|
+
cancelText?: string;
|
|
25
|
+
/** Custom action button text (overrides i18n) */
|
|
26
|
+
actionText?: string;
|
|
27
|
+
/** Level determines icon & color scheme */
|
|
28
|
+
level?: BannerLevel;
|
|
29
|
+
/** Transparent mode: background becomes transparent, text turns gray */
|
|
30
|
+
transparent?: boolean;
|
|
31
|
+
/** Custom background color (overrides level default) */
|
|
32
|
+
bannerBgColor?: string;
|
|
33
|
+
/** Custom border color (overrides level default) */
|
|
34
|
+
bannerBorderColor?: string;
|
|
35
|
+
/** Custom icon color (overrides level default) */
|
|
36
|
+
bannerIconColor?: string;
|
|
37
|
+
/** Style extension via CSSFab sx (string / object / slot) */
|
|
38
|
+
sx?: SxValue;
|
|
39
|
+
style?: CSSProperties;
|
|
40
|
+
className?: string;
|
|
41
|
+
/** i18n key for built-in text lookup */
|
|
42
|
+
i18nKey?: BannerI18nKey;
|
|
43
|
+
/** Override locale text map */
|
|
44
|
+
localeText?: BannerLocaleText;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare function Banner(props: BannerProps): JSX.Element;
|
|
48
|
+
|
|
49
|
+
export { Banner };
|
|
50
|
+
export default Banner;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ButtonHTMLAttributes,
|
|
3
|
+
CSSProperties,
|
|
4
|
+
ElementType,
|
|
5
|
+
ReactNode,
|
|
6
|
+
} from "react";
|
|
7
|
+
import type { SxValue } from "../CSSFab";
|
|
8
|
+
|
|
9
|
+
export type ButtonVariant = "default" | "transparent" | "danger" | "success";
|
|
10
|
+
export type ButtonSize = "small" | "medium" | "large" | "huge";
|
|
11
|
+
export type LoadingMode = boolean | "light" | "dark" | [boolean | "light" | "dark", "light" | "dark"];
|
|
12
|
+
export type ButtonI18nKey =
|
|
13
|
+
| "default"
|
|
14
|
+
| "loading"
|
|
15
|
+
| "submit"
|
|
16
|
+
| "confirm"
|
|
17
|
+
| "cancel"
|
|
18
|
+
| "search"
|
|
19
|
+
| "save"
|
|
20
|
+
| "delete"
|
|
21
|
+
| "back"
|
|
22
|
+
| "next"
|
|
23
|
+
| "prev"
|
|
24
|
+
| "add"
|
|
25
|
+
| (string & {});
|
|
26
|
+
|
|
27
|
+
export type ButtonLocaleText = Partial<
|
|
28
|
+
Record<
|
|
29
|
+
| "default"
|
|
30
|
+
| "loading"
|
|
31
|
+
| "iconAlt"
|
|
32
|
+
| "submit"
|
|
33
|
+
| "confirm"
|
|
34
|
+
| "cancel"
|
|
35
|
+
| "search"
|
|
36
|
+
| "save"
|
|
37
|
+
| "delete"
|
|
38
|
+
| "back"
|
|
39
|
+
| "next"
|
|
40
|
+
| "prev"
|
|
41
|
+
| "add"
|
|
42
|
+
| string,
|
|
43
|
+
string
|
|
44
|
+
>
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
export interface ButtonProps
|
|
48
|
+
extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "style" | "className" | "children"> {
|
|
49
|
+
type?: ButtonVariant;
|
|
50
|
+
size?: ButtonSize;
|
|
51
|
+
sx?: SxValue;
|
|
52
|
+
style?: CSSProperties;
|
|
53
|
+
className?: string;
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
outline?: boolean;
|
|
57
|
+
icon?: ElementType | ReactNode | string;
|
|
58
|
+
iconPosition?: "left" | "right";
|
|
59
|
+
loading?: LoadingMode;
|
|
60
|
+
i18nKey?: ButtonI18nKey;
|
|
61
|
+
localeText?: ButtonLocaleText;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare function Button(props: ButtonProps): JSX.Element;
|
|
65
|
+
|
|
66
|
+
// MaterialButton 类型
|
|
67
|
+
export type MaterialButtonVariant = "default" | "transparent" | "danger" | "success";
|
|
68
|
+
export type MaterialButtonSize = "small" | "medium" | "large" | "huge";
|
|
69
|
+
|
|
70
|
+
export interface MaterialButtonLocaleText {
|
|
71
|
+
default?: string;
|
|
72
|
+
loading?: string;
|
|
73
|
+
iconAlt?: string;
|
|
74
|
+
[key: string]: string | undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface MaterialButtonProps
|
|
78
|
+
extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "style" | "className" | "children"> {
|
|
79
|
+
type?: MaterialButtonVariant;
|
|
80
|
+
size?: MaterialButtonSize;
|
|
81
|
+
sx?: SxValue;
|
|
82
|
+
style?: CSSProperties;
|
|
83
|
+
className?: string;
|
|
84
|
+
children?: ReactNode;
|
|
85
|
+
disabled?: boolean;
|
|
86
|
+
outline?: boolean;
|
|
87
|
+
icon?: ElementType | ReactNode | string;
|
|
88
|
+
iconPosition?: "left" | "right";
|
|
89
|
+
loading?: LoadingMode;
|
|
90
|
+
i18nKey?: string;
|
|
91
|
+
localeText?: MaterialButtonLocaleText;
|
|
92
|
+
/** 涟漪颜色,默认使用 --material-button-ripple */
|
|
93
|
+
rippleColor?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
declare function MaterialButton(props: MaterialButtonProps): JSX.Element;
|
|
97
|
+
|
|
98
|
+
// antd 风格:Button.MaterialButton / const { MaterialButton } = Button
|
|
99
|
+
interface ButtonNamespace {
|
|
100
|
+
(props: ButtonProps): JSX.Element;
|
|
101
|
+
MaterialButton: typeof MaterialButton;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare const ButtonWithType: ButtonNamespace;
|
|
105
|
+
export { ButtonWithType as Button };
|
|
106
|
+
export { MaterialButton };
|
|
107
|
+
export default Button;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CSSProperties, InputHTMLAttributes } from "react";
|
|
2
|
+
import type { SxValue } from "../CSSFab";
|
|
3
|
+
|
|
4
|
+
export type ColorPickerSize = "small" | "medium" | "large";
|
|
5
|
+
export type ColorPickerFormat = "hex" | "rgb" | "hsl";
|
|
6
|
+
export type ColorPickerShowText = boolean | ColorPickerFormat;
|
|
7
|
+
export type ColorPickerI18nKey = "hex" | "rgb" | "hsl" | (string & {});
|
|
8
|
+
export type ColorPickerLocaleText = Partial<
|
|
9
|
+
Record<"hex" | "rgb" | "hsl" | string, string>
|
|
10
|
+
>;
|
|
11
|
+
|
|
12
|
+
export interface ColorPickerProps
|
|
13
|
+
extends Omit<InputHTMLAttributes<HTMLInputElement>, "style" | "className" | "size" | "type" | "value" | "onChange"> {
|
|
14
|
+
/** 受控颜色值(HEX) */
|
|
15
|
+
value?: string;
|
|
16
|
+
/** 非受控默认颜色值 */
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
/** 颜色变化回调,参数为 HEX 值 */
|
|
19
|
+
onChange?: (hex: string) => void;
|
|
20
|
+
/** 是否禁用 */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** 是否显示颜色文本;传格式字符串仅显示对应格式 */
|
|
23
|
+
showText?: ColorPickerShowText;
|
|
24
|
+
/** 文本输出格式(showText 为 true 时决定主格式) */
|
|
25
|
+
format?: ColorPickerFormat;
|
|
26
|
+
/** 尺寸变体 */
|
|
27
|
+
size?: ColorPickerSize;
|
|
28
|
+
/** Style extension via CSSFab sx */
|
|
29
|
+
sx?: SxValue;
|
|
30
|
+
style?: CSSProperties;
|
|
31
|
+
className?: string;
|
|
32
|
+
/** i18n key */
|
|
33
|
+
i18nKey?: ColorPickerI18nKey;
|
|
34
|
+
/** 覆盖 locale 文案 */
|
|
35
|
+
localeText?: ColorPickerLocaleText;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare function ColorPicker(props: ColorPickerProps): JSX.Element;
|
|
39
|
+
|
|
40
|
+
export { ColorPicker };
|
|
41
|
+
export default ColorPicker;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CSSProperties, HTMLAttributes } from "react";
|
|
2
|
+
import type { SxValue } from "../CSSFab";
|
|
3
|
+
|
|
4
|
+
export type DateType =
|
|
5
|
+
| "default"
|
|
6
|
+
| "line"
|
|
7
|
+
| "full"
|
|
8
|
+
| "full-line"
|
|
9
|
+
| "year-week"
|
|
10
|
+
| "year-week-line"
|
|
11
|
+
| "week-time"
|
|
12
|
+
| "no-s"
|
|
13
|
+
| "no-s-line";
|
|
14
|
+
|
|
15
|
+
export type DateI18nKey = DateType | (string & {});
|
|
16
|
+
|
|
17
|
+
export type DateLocaleText = Partial<{
|
|
18
|
+
weekdayPrefix: string;
|
|
19
|
+
weekdayShortPrefix: string;
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
export interface DateProps
|
|
23
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, "style" | "className"> {
|
|
24
|
+
/** 显示格式类型 */
|
|
25
|
+
type?: DateType;
|
|
26
|
+
/** 中文星期简写:true 显示"周X",false 显示"星期X" */
|
|
27
|
+
single?: boolean;
|
|
28
|
+
/** Style extension via CSSFab sx */
|
|
29
|
+
sx?: SxValue;
|
|
30
|
+
style?: CSSProperties;
|
|
31
|
+
className?: string;
|
|
32
|
+
/** i18n key,可指定 type 作为快捷格式 */
|
|
33
|
+
i18nKey?: DateI18nKey;
|
|
34
|
+
/** 覆盖 locale 文案 */
|
|
35
|
+
localeText?: DateLocaleText;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare function DateDisplay(props: DateProps): JSX.Element;
|
|
39
|
+
|
|
40
|
+
export { DateDisplay };
|
|
41
|
+
export default DateDisplay;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CSSProperties, HTMLAttributes } from "react";
|
|
2
|
+
import type { SxValue } from "../CSSFab";
|
|
3
|
+
|
|
4
|
+
export type DatePickerSize = "small" | "medium" | "large";
|
|
5
|
+
|
|
6
|
+
export type DatePickerI18nKey = "placeholder" | "placeholderTime" | "timeLabel" | "confirm" | "cancel" | "prevMonth" | "nextMonth" | (string & {});
|
|
7
|
+
|
|
8
|
+
export type DatePickerLocaleText = Partial<{
|
|
9
|
+
placeholder: string;
|
|
10
|
+
placeholderTime: string;
|
|
11
|
+
timeLabel: string;
|
|
12
|
+
confirm: string;
|
|
13
|
+
cancel: string;
|
|
14
|
+
prevMonth: string;
|
|
15
|
+
nextMonth: string;
|
|
16
|
+
weekDays: string[];
|
|
17
|
+
monthFormat: string;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
export interface DatePickerProps
|
|
21
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, "style" | "className" | "onChange"> {
|
|
22
|
+
/** 受控值(YYYY-MM-DD 或 YYYY-MM-DD HH:mm) */
|
|
23
|
+
value?: string;
|
|
24
|
+
/** 非受控默认值 */
|
|
25
|
+
defaultValue?: string;
|
|
26
|
+
/** 日期变化回调:(formatted, raw) => void */
|
|
27
|
+
onChange?: (formatted: string, raw: string) => void;
|
|
28
|
+
/** 是否禁用 */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** 是否显示时间选择 */
|
|
31
|
+
time?: boolean;
|
|
32
|
+
/** 尺寸变体 */
|
|
33
|
+
size?: DatePickerSize;
|
|
34
|
+
/** Style extension via CSSFab sx */
|
|
35
|
+
sx?: SxValue;
|
|
36
|
+
style?: CSSProperties;
|
|
37
|
+
className?: string;
|
|
38
|
+
/** i18n key */
|
|
39
|
+
i18nKey?: DatePickerI18nKey;
|
|
40
|
+
/** 覆盖 locale 文案 */
|
|
41
|
+
localeText?: DatePickerLocaleText;
|
|
42
|
+
/** 输入框占位文本,优先级高于 i18n / localeText */
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare function DatePicker(props: DatePickerProps): JSX.Element;
|
|
47
|
+
|
|
48
|
+
export { DatePicker };
|
|
49
|
+
export default DatePicker;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CSSProperties, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import type { SxValue } from "../CSSFab";
|
|
3
|
+
|
|
4
|
+
export type DrawerType = "top" | "bottom" | "left" | "right";
|
|
5
|
+
|
|
6
|
+
export type DrawerI18nKey = "title" | "okText" | "cancelText" | "closeAriaLabel" | (string & {});
|
|
7
|
+
|
|
8
|
+
export type DrawerLocaleText = Partial<{
|
|
9
|
+
title: string;
|
|
10
|
+
okText: string;
|
|
11
|
+
cancelText: string;
|
|
12
|
+
closeAriaLabel: string;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export type DrawerFooterButton = {
|
|
16
|
+
key: string;
|
|
17
|
+
text: string;
|
|
18
|
+
onClick: () => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export interface DrawerProps
|
|
22
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "style" | "className"> {
|
|
23
|
+
/** 抽屉内容 */
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/** 标题,优先级高于 i18n */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** 确定按钮文案,优先级高于 i18n */
|
|
28
|
+
okText?: string;
|
|
29
|
+
/** 取消按钮文案,优先级高于 i18n */
|
|
30
|
+
cancelText?: string;
|
|
31
|
+
/** 是否打开 */
|
|
32
|
+
open?: boolean;
|
|
33
|
+
/** 关闭回调 */
|
|
34
|
+
onClose?: () => void;
|
|
35
|
+
/** 确定回调,若未传则默认调用 onClose */
|
|
36
|
+
onOk?: () => void;
|
|
37
|
+
/** 抽屉方向 */
|
|
38
|
+
type?: DrawerType;
|
|
39
|
+
/** 容器宽度(left/right 生效) */
|
|
40
|
+
width?: string | number;
|
|
41
|
+
/** 容器高度(top/bottom 生效) */
|
|
42
|
+
height?: string | number;
|
|
43
|
+
/** Style extension via CSSFab sx */
|
|
44
|
+
sx?: SxValue;
|
|
45
|
+
style?: CSSProperties;
|
|
46
|
+
className?: string;
|
|
47
|
+
/** 点击遮罩是否关闭 */
|
|
48
|
+
maskClosable?: boolean;
|
|
49
|
+
/** 自定义底部按钮,传入后替代默认的取消/确定 */
|
|
50
|
+
footerButtons?: DrawerFooterButton[];
|
|
51
|
+
/** 覆盖 locale 文案 */
|
|
52
|
+
localeText?: DrawerLocaleText;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
declare function Drawer(props: DrawerProps): JSX.Element;
|
|
56
|
+
|
|
57
|
+
export { Drawer };
|
|
58
|
+
export default Drawer;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { CSSProperties, InputHTMLAttributes, TextareaHTMLAttributes } from "react";
|
|
2
|
+
import type { SxValue } from "../CSSFab";
|
|
3
|
+
|
|
4
|
+
export type InputType = "default" | "textarea" | "password";
|
|
5
|
+
export type InputSize = "small" | "medium" | "large" | "huge";
|
|
6
|
+
export type InputStatus = "default" | "error";
|
|
7
|
+
|
|
8
|
+
export interface InputProps
|
|
9
|
+
extends Omit<InputHTMLAttributes<HTMLInputElement> & TextareaHTMLAttributes<HTMLTextAreaElement>, "style" | "className" | "size" | "type" | "onChange"> {
|
|
10
|
+
/** 输入类型 */
|
|
11
|
+
type?: InputType;
|
|
12
|
+
/** 尺寸 */
|
|
13
|
+
size?: InputSize;
|
|
14
|
+
/** 校验状态 */
|
|
15
|
+
status?: InputStatus;
|
|
16
|
+
/** Style extension via CSSFab sx */
|
|
17
|
+
sx?: SxValue;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
className?: string;
|
|
20
|
+
/** 点击事件 */
|
|
21
|
+
onClick?: (e: React.MouseEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
22
|
+
/** 值变化回调,参数为当前输入值 */
|
|
23
|
+
onChange?: (value: string) => void;
|
|
24
|
+
/** 受控值 */
|
|
25
|
+
value?: string;
|
|
26
|
+
/** 非受控默认值 */
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
/** 是否禁用 */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** 占位文案 */
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
/** 最大字符数 */
|
|
33
|
+
maxlength?: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare function Input(props: InputProps): JSX.Element;
|
|
37
|
+
|
|
38
|
+
// antd 风格:Input.MaterialInput / const { MaterialInput } = Input
|
|
39
|
+
interface InputNamespace {
|
|
40
|
+
(props: InputProps): JSX.Element;
|
|
41
|
+
MaterialInput: typeof MaterialInput;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare const InputWithType: InputNamespace;
|
|
45
|
+
export { InputWithType as Input };
|
|
46
|
+
export default Input;
|
|
47
|
+
|
|
48
|
+
// MaterialInput 类型
|
|
49
|
+
export type MaterialInputSize = "small" | "medium" | "large" | "huge";
|
|
50
|
+
|
|
51
|
+
export interface MaterialInputLocaleText {
|
|
52
|
+
label?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface MaterialInputProps
|
|
56
|
+
extends Omit<InputHTMLAttributes<HTMLInputElement>, "style" | "className" | "size" | "onChange" | "type"> {
|
|
57
|
+
/** 浮动标签文案 */
|
|
58
|
+
label?: string;
|
|
59
|
+
/** 原生 input type */
|
|
60
|
+
type?: string;
|
|
61
|
+
/** 尺寸 */
|
|
62
|
+
size?: MaterialInputSize;
|
|
63
|
+
/** Style extension via CSSFab sx */
|
|
64
|
+
sx?: SxValue;
|
|
65
|
+
style?: CSSProperties;
|
|
66
|
+
className?: string;
|
|
67
|
+
/** 值变化回调,参数为当前输入值 */
|
|
68
|
+
onChange?: (value: string) => void;
|
|
69
|
+
/** 受控值 */
|
|
70
|
+
value?: string;
|
|
71
|
+
/** 非受控默认值 */
|
|
72
|
+
defaultValue?: string;
|
|
73
|
+
/** 是否禁用 */
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
/** 覆盖标签文案 */
|
|
76
|
+
localeText?: MaterialInputLocaleText;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare function MaterialInput(props: MaterialInputProps): JSX.Element;
|
|
80
|
+
|
|
81
|
+
export { MaterialInput };
|