tango-ui-cw 1.0.10 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -126
- package/dist/component/CSSFab/index.d.ts +61 -55
- package/dist/component/CSSFab/useTangoStyle.d.ts +1 -1
- package/dist/component/TBanner/index.d.ts +53 -50
- package/dist/component/TButton/index.d.ts +109 -107
- package/dist/component/TCard/index.d.ts +40 -0
- package/dist/component/TColorPicker/index.d.ts +42 -41
- package/dist/component/TDate/index.d.ts +42 -41
- package/dist/component/TDatePicker/index.d.ts +54 -49
- package/dist/component/TDrawer/index.d.ts +59 -58
- package/dist/component/TInput/index.d.ts +111 -81
- package/dist/component/TLayout/index.d.ts +136 -133
- package/dist/component/TLine/index.d.ts +36 -33
- package/dist/component/TMark/index.d.ts +41 -38
- package/dist/component/TModal/index.d.ts +107 -52
- package/dist/component/TNotice/index.d.ts +47 -30
- package/dist/component/TSearch/index.d.ts +56 -42
- package/dist/component/TSpace/index.d.ts +60 -59
- package/dist/component/TTable/index.d.ts +117 -76
- package/dist/component/TTooltip/index.d.ts +34 -31
- package/dist/component/TUpload/index.d.ts +74 -45
- package/dist/component/index.d.ts +167 -146
- package/dist/index.cjs +26 -8
- package/dist/index.d.cts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +3334 -2305
- package/dist/providers/NoticeProvider/NoticeProvider.d.ts +43 -19
- package/dist/providers/TangoI18nProvider/TangoI18nProvider.d.ts +27 -27
- package/dist/providers/ThemeProvider/ThemeProvider.d.ts +21 -21
- package/dist/scripts/check-peers.js +82 -82
- package/dist/styles/base.css +383 -353
- package/dist/styles/global.css +383 -353
- package/dist/styles/style.css +1 -1
- package/dist/styles/theme.css +13 -13
- package/dist/styles/utilities.css +1 -1
- package/package.json +68 -68
|
@@ -1,19 +1,43 @@
|
|
|
1
|
-
import type { PropsWithChildren, ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export type NoticeType = "success" | "fail" | "caution";
|
|
4
|
-
export type NoticeVariant = "default" | "md";
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import type { PropsWithChildren, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type NoticeType = "success" | "fail" | "caution";
|
|
4
|
+
export type NoticeVariant = "default" | "md";
|
|
5
|
+
// added by clayw on 20260624: placement 四角位置类型(大小写均可)
|
|
6
|
+
export type NoticePlacement = "TL" | "TR" | "BL" | "BR" | "tl" | "tr" | "bl" | "br";
|
|
7
|
+
|
|
8
|
+
// added by clayw on 20260624: useNotice 调用 options 参数
|
|
9
|
+
export interface NoticeCallOptions {
|
|
10
|
+
variant?: NoticeVariant;
|
|
11
|
+
duration?: number;
|
|
12
|
+
placement?: NoticePlacement;
|
|
13
|
+
key?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// added by clayw on 20260624: useNotice 支持 per-call duration/placement/key
|
|
17
|
+
export interface NoticeApi {
|
|
18
|
+
success: (message: ReactNode, optionsOrDuration?: NoticeCallOptions | number) => void;
|
|
19
|
+
fail: (message: ReactNode, optionsOrDuration?: NoticeCallOptions | number) => void;
|
|
20
|
+
caution: (message: ReactNode, optionsOrDuration?: NoticeCallOptions | number) => void;
|
|
21
|
+
md: {
|
|
22
|
+
success: (message: ReactNode, options?: NoticeCallOptions) => void;
|
|
23
|
+
fail: (message: ReactNode, options?: NoticeCallOptions) => void;
|
|
24
|
+
caution: (message: ReactNode, options?: NoticeCallOptions) => void;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// added by clayw on 20260624: NoticeProvider 支持 maxCount
|
|
29
|
+
export interface NoticeProviderProps {
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
maxCount?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare function NoticeProvider(props: PropsWithChildren<NoticeProviderProps>): JSX.Element;
|
|
35
|
+
|
|
36
|
+
export declare function useNotice(): NoticeApi;
|
|
37
|
+
|
|
38
|
+
export interface NoticeContextApi {
|
|
39
|
+
add: (type: NoticeType, message: ReactNode, optionsOrVariant?: NoticeCallOptions | NoticeVariant | number) => void;
|
|
40
|
+
remove: (id: number) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export declare function useNoticeContext(): NoticeContextApi;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import type { PropsWithChildren } from "react";
|
|
2
|
-
|
|
3
|
-
export type TangoLocale = "zh-CN" | "en-US" | (string & {});
|
|
4
|
-
|
|
5
|
-
export type TangoMessages = Record<string, Record<string, unknown>>;
|
|
6
|
-
|
|
7
|
-
export interface TangoI18nContextValue {
|
|
8
|
-
locale: TangoLocale;
|
|
9
|
-
setLocale: (nextLocale: TangoLocale) => void;
|
|
10
|
-
toggleLocale: () => void;
|
|
11
|
-
messages: TangoMessages;
|
|
12
|
-
t: (key: string, fallback?: string) => string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface TangoI18nProviderProps extends PropsWithChildren {
|
|
16
|
-
locale?: TangoLocale;
|
|
17
|
-
defaultLocale?: TangoLocale;
|
|
18
|
-
onLocaleChange?: (nextLocale: TangoLocale) => void;
|
|
19
|
-
messages?: TangoMessages;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export declare function TangoI18nProvider(
|
|
23
|
-
props: TangoI18nProviderProps
|
|
24
|
-
): JSX.Element;
|
|
25
|
-
|
|
26
|
-
export declare function useTangoI18n(): TangoI18nContextValue;
|
|
27
|
-
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
|
|
3
|
+
export type TangoLocale = "zh-CN" | "en-US" | (string & {});
|
|
4
|
+
|
|
5
|
+
export type TangoMessages = Record<string, Record<string, unknown>>;
|
|
6
|
+
|
|
7
|
+
export interface TangoI18nContextValue {
|
|
8
|
+
locale: TangoLocale;
|
|
9
|
+
setLocale: (nextLocale: TangoLocale) => void;
|
|
10
|
+
toggleLocale: () => void;
|
|
11
|
+
messages: TangoMessages;
|
|
12
|
+
t: (key: string, fallback?: string) => string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface TangoI18nProviderProps extends PropsWithChildren {
|
|
16
|
+
locale?: TangoLocale;
|
|
17
|
+
defaultLocale?: TangoLocale;
|
|
18
|
+
onLocaleChange?: (nextLocale: TangoLocale) => void;
|
|
19
|
+
messages?: TangoMessages;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export declare function TangoI18nProvider(
|
|
23
|
+
props: TangoI18nProviderProps
|
|
24
|
+
): JSX.Element;
|
|
25
|
+
|
|
26
|
+
export declare function useTangoI18n(): TangoI18nContextValue;
|
|
27
|
+
|
|
28
28
|
export declare function normalizeTangoLocale(locale: TangoLocale): TangoLocale;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import type { PropsWithChildren } from "react";
|
|
2
|
-
|
|
3
|
-
export type ThemeMode = "light" | "dark";
|
|
4
|
-
export type ThemeTokens = Record<string, string>;
|
|
5
|
-
|
|
6
|
-
export interface ThemeContextValue {
|
|
7
|
-
theme: ThemeMode;
|
|
8
|
-
setTheme: (nextTheme: ThemeMode) => void;
|
|
9
|
-
toggleTheme: () => void;
|
|
10
|
-
themeTokens: ThemeTokens;
|
|
11
|
-
setThemeTokens: (
|
|
12
|
-
nextTokensOrUpdater:
|
|
13
|
-
| ThemeTokens
|
|
14
|
-
| ((previousTokens: ThemeTokens) => ThemeTokens)
|
|
15
|
-
) => void;
|
|
16
|
-
setThemeColor: (color: string, tokenList?: string[]) => void;
|
|
17
|
-
resetThemeTokens: () => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export declare function ThemeProvider(props: PropsWithChildren): JSX.Element;
|
|
21
|
-
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
|
|
3
|
+
export type ThemeMode = "light" | "dark";
|
|
4
|
+
export type ThemeTokens = Record<string, string>;
|
|
5
|
+
|
|
6
|
+
export interface ThemeContextValue {
|
|
7
|
+
theme: ThemeMode;
|
|
8
|
+
setTheme: (nextTheme: ThemeMode) => void;
|
|
9
|
+
toggleTheme: () => void;
|
|
10
|
+
themeTokens: ThemeTokens;
|
|
11
|
+
setThemeTokens: (
|
|
12
|
+
nextTokensOrUpdater:
|
|
13
|
+
| ThemeTokens
|
|
14
|
+
| ((previousTokens: ThemeTokens) => ThemeTokens)
|
|
15
|
+
) => void;
|
|
16
|
+
setThemeColor: (color: string, tokenList?: string[]) => void;
|
|
17
|
+
resetThemeTokens: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare function ThemeProvider(props: PropsWithChildren): JSX.Element;
|
|
21
|
+
|
|
22
22
|
export declare function useTheme(): ThemeContextValue;
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* tango-ui-cw postinstall peer-dependency checker
|
|
5
|
-
* Per NPM-Summary.md §10.3, warns if required peers are missing.
|
|
6
|
-
*
|
|
7
|
-
* Gracefully skips if the dist/ build output doesn't exist yet
|
|
8
|
-
* (e.g. during `npm install` in the library's own repo before first build).
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import fs from "fs";
|
|
12
|
-
import path from "path";
|
|
13
|
-
import { fileURLToPath } from "url";
|
|
14
|
-
import { createRequire } from "module";
|
|
15
|
-
|
|
16
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
-
const __dirname = path.dirname(__filename);
|
|
18
|
-
|
|
19
|
-
// If dist/index.js doesn't exist, we're in a pre-build state — skip silently.
|
|
20
|
-
const distEntry = path.resolve(__dirname, "..", "index.js");
|
|
21
|
-
if (!fs.existsSync(distEntry)) {
|
|
22
|
-
process.exit(0);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const require = createRequire(import.meta.url);
|
|
26
|
-
|
|
27
|
-
const REQUIRED_PEERS = [
|
|
28
|
-
{ name: "react", range: ">=18", hint: "React 18+ is required." },
|
|
29
|
-
{ name: "react-dom", range: ">=18", hint: "ReactDOM 18+ is required." },
|
|
30
|
-
{ name: "next", range: ">=14", hint: "Next.js 14+ is required for SSR/SSG components." },
|
|
31
|
-
{ name: "tailwind-merge", range: "^3.6.0", hint: "tailwind-merge ^3.6.0 is required for class merging." },
|
|
32
|
-
{ name: "tailwindcss", range: "^4", hint: "Tailwind CSS v4 is required for utility classes." },
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
function getVersion(name) {
|
|
36
|
-
try {
|
|
37
|
-
const resolved = require.resolve(`${name}/package.json`, { paths: [process.cwd()] });
|
|
38
|
-
const pkg = require(resolved);
|
|
39
|
-
return pkg.version;
|
|
40
|
-
} catch {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function satisfies(version, range) {
|
|
46
|
-
if (!version) return false;
|
|
47
|
-
const major = parseInt(version.split(".")[0], 10);
|
|
48
|
-
if (range.startsWith(">=")) {
|
|
49
|
-
const min = parseInt(range.replace(">=", ""), 10);
|
|
50
|
-
return major >= min;
|
|
51
|
-
}
|
|
52
|
-
if (range.startsWith("^")) {
|
|
53
|
-
const min = parseInt(range.replace("^", "").split(".")[0], 10);
|
|
54
|
-
return major >= min;
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
let hasMissing = false;
|
|
60
|
-
|
|
61
|
-
for (const peer of REQUIRED_PEERS) {
|
|
62
|
-
const version = getVersion(peer.name);
|
|
63
|
-
if (!version) {
|
|
64
|
-
console.warn(
|
|
65
|
-
`[tango-ui-cw] ⚠️ Peer dependency "${peer.name}" (${peer.range}) is not installed. ${peer.hint}`
|
|
66
|
-
);
|
|
67
|
-
hasMissing = true;
|
|
68
|
-
} else if (!satisfies(version, peer.range)) {
|
|
69
|
-
console.warn(
|
|
70
|
-
`[tango-ui-cw] ⚠️ Peer dependency "${peer.name}@${version}" does not satisfy "${peer.range}". ${peer.hint}`
|
|
71
|
-
);
|
|
72
|
-
hasMissing = true;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (hasMissing) {
|
|
77
|
-
console.warn(
|
|
78
|
-
`[tango-ui-cw] Some peer dependencies are missing or incompatible. The library may not work correctly.`
|
|
79
|
-
);
|
|
80
|
-
} else {
|
|
81
|
-
console.log(`[tango-ui-cw] ✅ All peer dependencies are satisfied.`);
|
|
82
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* tango-ui-cw postinstall peer-dependency checker
|
|
5
|
+
* Per NPM-Summary.md §10.3, warns if required peers are missing.
|
|
6
|
+
*
|
|
7
|
+
* Gracefully skips if the dist/ build output doesn't exist yet
|
|
8
|
+
* (e.g. during `npm install` in the library's own repo before first build).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import fs from "fs";
|
|
12
|
+
import path from "path";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
14
|
+
import { createRequire } from "module";
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = path.dirname(__filename);
|
|
18
|
+
|
|
19
|
+
// If dist/index.js doesn't exist, we're in a pre-build state — skip silently.
|
|
20
|
+
const distEntry = path.resolve(__dirname, "..", "index.js");
|
|
21
|
+
if (!fs.existsSync(distEntry)) {
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const require = createRequire(import.meta.url);
|
|
26
|
+
|
|
27
|
+
const REQUIRED_PEERS = [
|
|
28
|
+
{ name: "react", range: ">=18", hint: "React 18+ is required." },
|
|
29
|
+
{ name: "react-dom", range: ">=18", hint: "ReactDOM 18+ is required." },
|
|
30
|
+
{ name: "next", range: ">=14", hint: "Next.js 14+ is required for SSR/SSG components." },
|
|
31
|
+
{ name: "tailwind-merge", range: "^3.6.0", hint: "tailwind-merge ^3.6.0 is required for class merging." },
|
|
32
|
+
{ name: "tailwindcss", range: "^4", hint: "Tailwind CSS v4 is required for utility classes." },
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
function getVersion(name) {
|
|
36
|
+
try {
|
|
37
|
+
const resolved = require.resolve(`${name}/package.json`, { paths: [process.cwd()] });
|
|
38
|
+
const pkg = require(resolved);
|
|
39
|
+
return pkg.version;
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function satisfies(version, range) {
|
|
46
|
+
if (!version) return false;
|
|
47
|
+
const major = parseInt(version.split(".")[0], 10);
|
|
48
|
+
if (range.startsWith(">=")) {
|
|
49
|
+
const min = parseInt(range.replace(">=", ""), 10);
|
|
50
|
+
return major >= min;
|
|
51
|
+
}
|
|
52
|
+
if (range.startsWith("^")) {
|
|
53
|
+
const min = parseInt(range.replace("^", "").split(".")[0], 10);
|
|
54
|
+
return major >= min;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let hasMissing = false;
|
|
60
|
+
|
|
61
|
+
for (const peer of REQUIRED_PEERS) {
|
|
62
|
+
const version = getVersion(peer.name);
|
|
63
|
+
if (!version) {
|
|
64
|
+
console.warn(
|
|
65
|
+
`[tango-ui-cw] ⚠️ Peer dependency "${peer.name}" (${peer.range}) is not installed. ${peer.hint}`
|
|
66
|
+
);
|
|
67
|
+
hasMissing = true;
|
|
68
|
+
} else if (!satisfies(version, peer.range)) {
|
|
69
|
+
console.warn(
|
|
70
|
+
`[tango-ui-cw] ⚠️ Peer dependency "${peer.name}@${version}" does not satisfy "${peer.range}". ${peer.hint}`
|
|
71
|
+
);
|
|
72
|
+
hasMissing = true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (hasMissing) {
|
|
77
|
+
console.warn(
|
|
78
|
+
`[tango-ui-cw] Some peer dependencies are missing or incompatible. The library may not work correctly.`
|
|
79
|
+
);
|
|
80
|
+
} else {
|
|
81
|
+
console.log(`[tango-ui-cw] ✅ All peer dependencies are satisfied.`);
|
|
82
|
+
}
|