@taicode/common-web 3.7.4 → 3.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +12 -13
- package/styles.css +2 -0
- package/output/components/alert-dialog.d.ts +0 -20
- package/output/components/alert-dialog.d.ts.map +0 -1
- package/output/components/alert-dialog.js +0 -65
- package/output/components/alert.d.ts +0 -11
- package/output/components/alert.d.ts.map +0 -1
- package/output/components/alert.js +0 -38
- package/output/components/avatar.d.ts +0 -13
- package/output/components/avatar.d.ts.map +0 -1
- package/output/components/avatar.js +0 -40
- package/output/components/badge.d.ts +0 -11
- package/output/components/badge.d.ts.map +0 -1
- package/output/components/badge.js +0 -39
- package/output/components/button.d.ts +0 -12
- package/output/components/button.d.ts.map +0 -1
- package/output/components/button.js +0 -48
- package/output/components/calendar.d.ts +0 -13
- package/output/components/calendar.d.ts.map +0 -1
- package/output/components/calendar.js +0 -57
- package/output/components/card.d.ts +0 -13
- package/output/components/card.d.ts.map +0 -1
- package/output/components/card.js +0 -43
- package/output/components/chart.d.ts +0 -56
- package/output/components/chart.d.ts.map +0 -1
- package/output/components/chart.js +0 -127
- package/output/components/checkbox.d.ts +0 -5
- package/output/components/checkbox.d.ts.map +0 -1
- package/output/components/checkbox.js +0 -21
- package/output/components/command.d.ts +0 -20
- package/output/components/command.d.ts.map +0 -1
- package/output/components/command.js +0 -55
- package/output/components/dialog.d.ts +0 -20
- package/output/components/dialog.d.ts.map +0 -1
- package/output/components/dialog.js +0 -58
- package/output/components/direction.d.ts +0 -9
- package/output/components/direction.d.ts.map +0 -1
- package/output/components/direction.js +0 -10
- package/output/components/drawer.d.ts +0 -14
- package/output/components/drawer.d.ts.map +0 -1
- package/output/components/drawer.js +0 -56
- package/output/components/dropdown-menu.d.ts +0 -29
- package/output/components/dropdown-menu.d.ts.map +0 -1
- package/output/components/dropdown-menu.js +0 -78
- package/output/components/field.d.ts +0 -39
- package/output/components/field.d.ts.map +0 -1
- package/output/components/field.js +0 -102
- package/output/components/footer/index.d.ts +0 -27
- package/output/components/footer/index.d.ts.map +0 -1
- package/output/components/footer/index.js +0 -17
- package/output/components/form.d.ts +0 -26
- package/output/components/form.d.ts.map +0 -1
- package/output/components/form.js +0 -69
- package/output/components/index.d.ts +0 -46
- package/output/components/index.d.ts.map +0 -1
- package/output/components/index.js +0 -45
- package/output/components/input-group.d.ts +0 -17
- package/output/components/input-group.d.ts.map +0 -1
- package/output/components/input-group.js +0 -75
- package/output/components/input.d.ts +0 -4
- package/output/components/input.d.ts.map +0 -1
- package/output/components/input.js +0 -19
- package/output/components/item.d.ts +0 -25
- package/output/components/item.d.ts.map +0 -1
- package/output/components/item.js +0 -89
- package/output/components/json-view/index.d.ts +0 -11
- package/output/components/json-view/index.d.ts.map +0 -1
- package/output/components/json-view/index.js +0 -52
- package/output/components/json-view/lazy/index.d.ts +0 -18
- package/output/components/json-view/lazy/index.d.ts.map +0 -1
- package/output/components/json-view/lazy/index.js +0 -22
- package/output/components/kbd.d.ts +0 -4
- package/output/components/kbd.d.ts.map +0 -1
- package/output/components/kbd.js +0 -22
- package/output/components/label.d.ts +0 -5
- package/output/components/label.d.ts.map +0 -1
- package/output/components/label.js +0 -20
- package/output/components/list-actions/index.d.ts +0 -23
- package/output/components/list-actions/index.d.ts.map +0 -1
- package/output/components/list-actions/index.js +0 -15
- package/output/components/loading-button/index.d.ts +0 -44
- package/output/components/loading-button/index.d.ts.map +0 -1
- package/output/components/loading-button/index.js +0 -75
- package/output/components/loading-button/index.test.d.ts +0 -2
- package/output/components/loading-button/index.test.d.ts.map +0 -1
- package/output/components/loading-button/index.test.js +0 -203
- package/output/components/native-select.d.ts +0 -9
- package/output/components/native-select.d.ts.map +0 -1
- package/output/components/native-select.js +0 -28
- package/output/components/page-back-button/index.d.ts +0 -8
- package/output/components/page-back-button/index.d.ts.map +0 -1
- package/output/components/page-back-button/index.js +0 -7
- package/output/components/page-state.d.ts +0 -19
- package/output/components/page-state.d.ts.map +0 -1
- package/output/components/page-state.js +0 -13
- package/output/components/pagination/index.d.ts +0 -34
- package/output/components/pagination/index.d.ts.map +0 -1
- package/output/components/pagination/index.js +0 -75
- package/output/components/popover.d.ts +0 -11
- package/output/components/popover.d.ts.map +0 -1
- package/output/components/popover.js +0 -44
- package/output/components/progress.d.ts +0 -5
- package/output/components/progress.d.ts.map +0 -1
- package/output/components/progress.js +0 -21
- package/output/components/radio-group.d.ts +0 -6
- package/output/components/radio-group.d.ts.map +0 -1
- package/output/components/radio-group.js +0 -25
- package/output/components/route-pending-indicator/index.d.ts +0 -20
- package/output/components/route-pending-indicator/index.d.ts.map +0 -1
- package/output/components/route-pending-indicator/index.js +0 -17
- package/output/components/scroll-area.d.ts +0 -6
- package/output/components/scroll-area.d.ts.map +0 -1
- package/output/components/scroll-area.js +0 -24
- package/output/components/searchable-select/index.d.ts +0 -41
- package/output/components/searchable-select/index.d.ts.map +0 -1
- package/output/components/searchable-select/index.js +0 -46
- package/output/components/select.d.ts +0 -17
- package/output/components/select.d.ts.map +0 -1
- package/output/components/select.js +0 -58
- package/output/components/separator.d.ts +0 -5
- package/output/components/separator.d.ts.map +0 -1
- package/output/components/separator.js +0 -20
- package/output/components/sheet.d.ts +0 -16
- package/output/components/sheet.d.ts.map +0 -1
- package/output/components/sheet.js +0 -58
- package/output/components/sidebar.d.ts +0 -78
- package/output/components/sidebar.d.ts.map +0 -1
- package/output/components/sidebar.js +0 -233
- package/output/components/size-provider/index.d.ts +0 -2
- package/output/components/size-provider/index.d.ts.map +0 -1
- package/output/components/size-provider/index.js +0 -1
- package/output/components/size-provider/size-provider.d.ts +0 -9
- package/output/components/size-provider/size-provider.d.ts.map +0 -1
- package/output/components/size-provider/size-provider.js +0 -29
- package/output/components/skeleton.d.ts +0 -3
- package/output/components/skeleton.d.ts.map +0 -1
- package/output/components/skeleton.js +0 -18
- package/output/components/sonner.d.ts +0 -8
- package/output/components/sonner.d.ts.map +0 -1
- package/output/components/sonner.js +0 -34
- package/output/components/spinner.d.ts +0 -3
- package/output/components/spinner.d.ts.map +0 -1
- package/output/components/spinner.js +0 -19
- package/output/components/switch.d.ts +0 -8
- package/output/components/switch.d.ts.map +0 -1
- package/output/components/switch.js +0 -20
- package/output/components/table.d.ts +0 -11
- package/output/components/table.d.ts.map +0 -1
- package/output/components/table.js +0 -47
- package/output/components/tabs.d.ts +0 -12
- package/output/components/tabs.d.ts.map +0 -1
- package/output/components/tabs.js +0 -45
- package/output/components/textarea.d.ts +0 -4
- package/output/components/textarea.d.ts.map +0 -1
- package/output/components/textarea.js +0 -19
- package/output/components/theme-switcher.d.ts +0 -6
- package/output/components/theme-switcher.d.ts.map +0 -1
- package/output/components/theme-switcher.js +0 -19
- package/output/components/toaster/index.d.ts +0 -16
- package/output/components/toaster/index.d.ts.map +0 -1
- package/output/components/toaster/index.js +0 -70
- package/output/components/toggle-group.d.ts +0 -12
- package/output/components/toggle-group.d.ts.map +0 -1
- package/output/components/toggle-group.js +0 -38
- package/output/components/toggle.d.ts +0 -10
- package/output/components/toggle.d.ts.map +0 -1
- package/output/components/toggle.js +0 -38
- package/output/components/tooltip.d.ts +0 -8
- package/output/components/tooltip.d.ts.map +0 -1
- package/output/components/tooltip.js +0 -33
- package/output/features/confirm-dialog/index.d.ts +0 -41
- package/output/features/confirm-dialog/index.d.ts.map +0 -1
- package/output/features/confirm-dialog/index.js +0 -19
- package/output/features/input-confirm/index.d.ts +0 -26
- package/output/features/input-confirm/index.d.ts.map +0 -1
- package/output/features/input-confirm/index.js +0 -59
- package/output/features/signin/context.d.ts +0 -14
- package/output/features/signin/context.d.ts.map +0 -1
- package/output/features/signin/context.js +0 -13
- package/output/features/signin/index.d.ts +0 -58
- package/output/features/signin/index.d.ts.map +0 -1
- package/output/features/signin/index.js +0 -137
- package/output/features/signin/service.d.ts +0 -92
- package/output/features/signin/service.d.ts.map +0 -1
- package/output/features/signin/service.js +0 -519
- package/output/features/signin/service.test.d.ts +0 -2
- package/output/features/signin/service.test.d.ts.map +0 -1
- package/output/features/signin/service.test.js +0 -211
- package/output/features/signin/types.d.ts +0 -63
- package/output/features/signin/types.d.ts.map +0 -1
- package/output/features/signin/types.js +0 -1
- package/output/hooks/use-loading/index.d.ts +0 -6
- package/output/hooks/use-loading/index.d.ts.map +0 -1
- package/output/hooks/use-loading/index.js +0 -14
- package/output/hooks/use-loading/index.test.d.ts +0 -2
- package/output/hooks/use-loading/index.test.d.ts.map +0 -1
- package/output/hooks/use-loading/index.test.js +0 -24
- package/output/hooks/use-mobile/index.d.ts +0 -2
- package/output/hooks/use-mobile/index.d.ts.map +0 -1
- package/output/hooks/use-mobile/index.js +0 -16
- package/output/hooks/use-observer/index.d.ts +0 -2
- package/output/hooks/use-observer/index.d.ts.map +0 -1
- package/output/hooks/use-observer/index.js +0 -1
- package/output/hooks/use-observer/use-observer.d.ts +0 -3
- package/output/hooks/use-observer/use-observer.d.ts.map +0 -1
- package/output/hooks/use-observer/use-observer.js +0 -16
- package/output/hooks/use-observer/use-observer.test.d.ts +0 -2
- package/output/hooks/use-observer/use-observer.test.d.ts.map +0 -1
- package/output/hooks/use-observer/use-observer.test.js +0 -134
- package/output/hooks/use-offline/index.d.ts +0 -6
- package/output/hooks/use-offline/index.d.ts.map +0 -1
- package/output/hooks/use-offline/index.js +0 -19
- package/output/layout/app/index.d.ts +0 -34
- package/output/layout/app/index.d.ts.map +0 -1
- package/output/layout/app/index.js +0 -34
- package/output/layout/dashboard/index.d.ts +0 -76
- package/output/layout/dashboard/index.d.ts.map +0 -1
- package/output/layout/dashboard/index.js +0 -84
- package/output/layout/index.d.ts +0 -3
- package/output/layout/index.d.ts.map +0 -1
- package/output/layout/index.js +0 -2
- package/output/services/cache-api/cache-api.d.ts +0 -23
- package/output/services/cache-api/cache-api.d.ts.map +0 -1
- package/output/services/cache-api/cache-api.js +0 -145
- package/output/services/cache-api/cache-api.test.d.ts +0 -2
- package/output/services/cache-api/cache-api.test.d.ts.map +0 -1
- package/output/services/cache-api/cache-api.test.js +0 -610
- package/output/services/cache-api/index.d.ts +0 -2
- package/output/services/cache-api/index.d.ts.map +0 -1
- package/output/services/cache-api/index.js +0 -1
- package/output/services/cached-fetch/index.d.ts +0 -50
- package/output/services/cached-fetch/index.d.ts.map +0 -1
- package/output/services/cached-fetch/index.js +0 -196
- package/output/services/service/index.d.ts +0 -2
- package/output/services/service/index.d.ts.map +0 -1
- package/output/services/service/index.js +0 -1
- package/output/services/service/service.d.ts +0 -135
- package/output/services/service/service.d.ts.map +0 -1
- package/output/services/service/service.js +0 -276
- package/output/services/service/service.test.d.ts +0 -2
- package/output/services/service/service.test.d.ts.map +0 -1
- package/output/services/service/service.test.js +0 -1399
- package/output/services/side-cache/index.d.ts +0 -2
- package/output/services/side-cache/index.d.ts.map +0 -1
- package/output/services/side-cache/index.js +0 -1
- package/output/services/side-cache/side-cache.d.ts +0 -11
- package/output/services/side-cache/side-cache.d.ts.map +0 -1
- package/output/services/side-cache/side-cache.js +0 -161
- package/output/services/side-cache/side-cache.test.d.ts +0 -2
- package/output/services/side-cache/side-cache.test.d.ts.map +0 -1
- package/output/services/side-cache/side-cache.test.js +0 -271
- package/output/utils/avatar/index.d.ts +0 -28
- package/output/utils/avatar/index.d.ts.map +0 -1
- package/output/utils/avatar/index.js +0 -35
- package/output/utils/delay/index.d.ts +0 -2
- package/output/utils/delay/index.d.ts.map +0 -1
- package/output/utils/delay/index.js +0 -5
- package/output/utils/form/index.d.ts +0 -3
- package/output/utils/form/index.d.ts.map +0 -1
- package/output/utils/form/index.js +0 -1
- package/output/utils/merge-class-names/index.d.ts +0 -3
- package/output/utils/merge-class-names/index.d.ts.map +0 -1
- package/output/utils/merge-class-names/index.js +0 -5
- package/output/utils/merge-class-names/index.test.d.ts +0 -2
- package/output/utils/merge-class-names/index.test.d.ts.map +0 -1
- package/output/utils/merge-class-names/index.test.js +0 -7
- package/output/utils/performance/index.d.ts +0 -82
- package/output/utils/performance/index.d.ts.map +0 -1
- package/output/utils/performance/index.js +0 -129
- package/output/utils/redirect/index.d.ts +0 -6
- package/output/utils/redirect/index.d.ts.map +0 -1
- package/output/utils/redirect/index.js +0 -32
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import '@testing-library/jest-dom/vitest';
|
|
14
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
15
|
-
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|
16
|
-
import { LoadingButton } from './index.js';
|
|
17
|
-
describe('LoadingButton', () => {
|
|
18
|
-
describe('基础功能', () => {
|
|
19
|
-
it('应该渲染按钮和子元素', () => {
|
|
20
|
-
render(_jsx(LoadingButton, { children: "\u70B9\u51FB\u6211" }));
|
|
21
|
-
expect(screen.getByRole('button')).toHaveTextContent('点击我');
|
|
22
|
-
});
|
|
23
|
-
it('应该支持 disabled 属性', () => {
|
|
24
|
-
render(_jsx(LoadingButton, { disabled: true, children: "\u70B9\u51FB\u6211" }));
|
|
25
|
-
expect(screen.getByRole('button')).toBeDisabled();
|
|
26
|
-
});
|
|
27
|
-
it('应该应用自定义 className', () => {
|
|
28
|
-
render(_jsx(LoadingButton, { className: "custom-class", children: "\u70B9\u51FB\u6211" }));
|
|
29
|
-
expect(screen.getByRole('button')).toHaveClass('custom-class');
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
describe('同步点击', () => {
|
|
33
|
-
it('应该处理同步点击事件', () => {
|
|
34
|
-
const handleClick = vi.fn();
|
|
35
|
-
render(_jsx(LoadingButton, { onClick: handleClick, children: "\u70B9\u51FB\u6211" }));
|
|
36
|
-
fireEvent.click(screen.getByRole('button'));
|
|
37
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
38
|
-
});
|
|
39
|
-
it('同步操作不应该显示 loading', () => {
|
|
40
|
-
const handleClick = vi.fn();
|
|
41
|
-
render(_jsx(LoadingButton, { onClick: handleClick, children: "\u70B9\u51FB\u6211" }));
|
|
42
|
-
fireEvent.click(screen.getByRole('button'));
|
|
43
|
-
expect(screen.queryByRole('button')).toHaveTextContent('点击我');
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
describe('异步点击', () => {
|
|
47
|
-
it('应该在异步操作期间显示 loading', async () => {
|
|
48
|
-
const handleClick = vi.fn(async () => {
|
|
49
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
50
|
-
});
|
|
51
|
-
render(_jsx(LoadingButton, { onClick: handleClick, children: "\u4FDD\u5B58" }));
|
|
52
|
-
const button = screen.getByRole('button');
|
|
53
|
-
fireEvent.click(button);
|
|
54
|
-
// 应该立即显示 loading
|
|
55
|
-
await waitFor(() => {
|
|
56
|
-
expect(button).toBeDisabled();
|
|
57
|
-
});
|
|
58
|
-
// 等待异步操作完成
|
|
59
|
-
await waitFor(() => {
|
|
60
|
-
expect(button).not.toBeDisabled();
|
|
61
|
-
}, { timeout: 200 });
|
|
62
|
-
});
|
|
63
|
-
it('异步操作完成后应该恢复正常状态', async () => {
|
|
64
|
-
let resolve;
|
|
65
|
-
const promise = new Promise(r => { resolve = r; });
|
|
66
|
-
const handleClick = vi.fn(() => promise);
|
|
67
|
-
render(_jsx(LoadingButton, { onClick: handleClick, children: "\u4FDD\u5B58" }));
|
|
68
|
-
const button = screen.getByRole('button');
|
|
69
|
-
fireEvent.click(button);
|
|
70
|
-
// loading 状态
|
|
71
|
-
await waitFor(() => {
|
|
72
|
-
expect(button).toBeDisabled();
|
|
73
|
-
});
|
|
74
|
-
// 完成异步操作
|
|
75
|
-
resolve();
|
|
76
|
-
// 恢复正常
|
|
77
|
-
await waitFor(() => {
|
|
78
|
-
expect(button).not.toBeDisabled();
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
it('异步操作失败后应该恢复正常状态', async () => {
|
|
82
|
-
const handleClick = vi.fn(async () => {
|
|
83
|
-
await new Promise((_, reject) => setTimeout(() => reject(new Error('失败')), 50));
|
|
84
|
-
});
|
|
85
|
-
render(_jsx(LoadingButton, { onClick: handleClick, children: "\u4FDD\u5B58" }));
|
|
86
|
-
const button = screen.getByRole('button');
|
|
87
|
-
fireEvent.click(button);
|
|
88
|
-
// loading 状态
|
|
89
|
-
await waitFor(() => {
|
|
90
|
-
expect(button).toBeDisabled();
|
|
91
|
-
});
|
|
92
|
-
// 等待失败并恢复
|
|
93
|
-
await waitFor(() => {
|
|
94
|
-
expect(button).not.toBeDisabled();
|
|
95
|
-
}, { timeout: 100 });
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
describe('手动控制 loading', () => {
|
|
99
|
-
it('应该支持外部控制 loading 状态', () => {
|
|
100
|
-
const { rerender } = render(_jsx(LoadingButton, { loading: false, children: "\u4FDD\u5B58" }));
|
|
101
|
-
expect(screen.getByRole('button')).not.toBeDisabled();
|
|
102
|
-
rerender(_jsx(LoadingButton, { loading: true, children: "\u4FDD\u5B58" }));
|
|
103
|
-
expect(screen.getByRole('button')).toBeDisabled();
|
|
104
|
-
});
|
|
105
|
-
it('外部 loading 状态应该优先于内部状态', async () => {
|
|
106
|
-
const handleClick = vi.fn(async () => {
|
|
107
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
108
|
-
});
|
|
109
|
-
render(_jsx(LoadingButton, { loading: true, onClick: handleClick, children: "\u4FDD\u5B58" }));
|
|
110
|
-
const button = screen.getByRole('button');
|
|
111
|
-
// 外部 loading 为 true,应该禁用
|
|
112
|
-
expect(button).toBeDisabled();
|
|
113
|
-
// 点击不应该触发
|
|
114
|
-
fireEvent.click(button);
|
|
115
|
-
expect(handleClick).not.toHaveBeenCalled();
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
describe('loading 显示定制', () => {
|
|
119
|
-
it('应该显示自定义 loadingText', async () => {
|
|
120
|
-
const handleClick = vi.fn(async () => {
|
|
121
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
122
|
-
});
|
|
123
|
-
render(_jsx(LoadingButton, { loadingText: "\u5904\u7406\u4E2D...", onClick: handleClick, children: "\u4FDD\u5B58" }));
|
|
124
|
-
fireEvent.click(screen.getByRole('button'));
|
|
125
|
-
await waitFor(() => {
|
|
126
|
-
expect(screen.getByText('处理中...')).toBeInTheDocument();
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
it('应该显示自定义 loadingIcon', async () => {
|
|
130
|
-
const handleClick = vi.fn(async () => {
|
|
131
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
132
|
-
});
|
|
133
|
-
render(_jsx(LoadingButton, { loadingIcon: _jsx("span", { "data-testid": "custom-icon", children: "\u23F3" }), onClick: handleClick, children: "\u4FDD\u5B58" }));
|
|
134
|
-
fireEvent.click(screen.getByRole('button'));
|
|
135
|
-
await waitFor(() => {
|
|
136
|
-
expect(screen.getByTestId('custom-icon')).toBeInTheDocument();
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
describe('多态组件 (as prop)', () => {
|
|
141
|
-
it('应该渲染为自定义组件', () => {
|
|
142
|
-
const CustomButton = (_a) => {
|
|
143
|
-
var { children } = _a, props = __rest(_a, ["children"]);
|
|
144
|
-
return (_jsx("button", Object.assign({ "data-testid": "custom-button" }, props, { children: children })));
|
|
145
|
-
};
|
|
146
|
-
render(_jsx(LoadingButton, { as: CustomButton, children: "\u70B9\u51FB\u6211" }));
|
|
147
|
-
expect(screen.getByTestId('custom-button')).toBeInTheDocument();
|
|
148
|
-
});
|
|
149
|
-
it('应该渲染为 anchor 标签', () => {
|
|
150
|
-
render(_jsx(LoadingButton, { as: "a", href: "#", children: "\u94FE\u63A5" }));
|
|
151
|
-
const link = screen.getByText('链接');
|
|
152
|
-
expect(link.tagName).toBe('A');
|
|
153
|
-
});
|
|
154
|
-
it('自定义组件应该保留其 props', () => {
|
|
155
|
-
render(_jsx(LoadingButton, { as: "a", href: "https://example.com", target: "_blank", children: "\u94FE\u63A5" }));
|
|
156
|
-
const link = screen.getByText('链接');
|
|
157
|
-
expect(link).toHaveAttribute('href', 'https://example.com');
|
|
158
|
-
expect(link).toHaveAttribute('target', '_blank');
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
describe('禁用状态', () => {
|
|
162
|
-
it('禁用时不应该触发点击', () => {
|
|
163
|
-
const handleClick = vi.fn();
|
|
164
|
-
render(_jsx(LoadingButton, { disabled: true, onClick: handleClick, children: "\u70B9\u51FB\u6211" }));
|
|
165
|
-
fireEvent.click(screen.getByRole('button'));
|
|
166
|
-
expect(handleClick).not.toHaveBeenCalled();
|
|
167
|
-
});
|
|
168
|
-
it('loading 时不应该触发点击', async () => {
|
|
169
|
-
const handleClick = vi.fn(async () => {
|
|
170
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
171
|
-
});
|
|
172
|
-
render(_jsx(LoadingButton, { onClick: handleClick, children: "\u4FDD\u5B58" }));
|
|
173
|
-
const button = screen.getByRole('button');
|
|
174
|
-
// 第一次点击
|
|
175
|
-
fireEvent.click(button);
|
|
176
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
177
|
-
// loading 期间再次点击
|
|
178
|
-
fireEvent.click(button);
|
|
179
|
-
fireEvent.click(button);
|
|
180
|
-
// 不应该再次触发
|
|
181
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
182
|
-
// 等待完成
|
|
183
|
-
await waitFor(() => {
|
|
184
|
-
expect(button).not.toBeDisabled();
|
|
185
|
-
}, { timeout: 150 });
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
describe('默认样式', () => {
|
|
189
|
-
it('使用默认 button 时应该应用默认样式', () => {
|
|
190
|
-
render(_jsx(LoadingButton, { children: "\u70B9\u51FB\u6211" }));
|
|
191
|
-
const button = screen.getByRole('button');
|
|
192
|
-
// 检查是否包含默认样式类
|
|
193
|
-
expect(button.className).toContain('inline-flex');
|
|
194
|
-
expect(button.className).toContain('bg-[var(--primary)]');
|
|
195
|
-
});
|
|
196
|
-
it('使用 as prop 时不应该应用默认样式', () => {
|
|
197
|
-
render(_jsx(LoadingButton, { as: "a", children: "\u94FE\u63A5" }));
|
|
198
|
-
const link = screen.getByText('链接');
|
|
199
|
-
// 不应该包含默认 button 样式
|
|
200
|
-
expect(link.className).not.toContain('bg-[var(--primary)]');
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
|
|
3
|
-
size?: "sm" | "default";
|
|
4
|
-
};
|
|
5
|
-
declare function NativeSelect(params: NativeSelectProps): React.JSX.Element;
|
|
6
|
-
declare function NativeSelectOption(params: React.ComponentProps<"option">): React.JSX.Element;
|
|
7
|
-
declare function NativeSelectOptGroup(params: React.ComponentProps<"optgroup">): React.JSX.Element;
|
|
8
|
-
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
|
|
9
|
-
//# sourceMappingURL=native-select.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"native-select.d.ts","sourceRoot":"","sources":["../../source/components/native-select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,KAAK,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG;IACtE,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACxB,CAAA;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,iBAAiB,qBAwB9C;AAED,iBAAS,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,qBAGjE;AAED,iBAAS,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,qBAYrE;AAED,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
import { mergeClassNames } from "../utils/merge-class-names/index.js";
|
|
15
|
-
import { ChevronDownIcon } from "lucide-react";
|
|
16
|
-
function NativeSelect(params) {
|
|
17
|
-
const { className, size = "default" } = params, props = __rest(params, ["className", "size"]);
|
|
18
|
-
return (_jsxs("div", { className: mergeClassNames("group/native-select relative w-fit has-[select:disabled]:opacity-50", className), "data-slot": "native-select-wrapper", "data-size": size, children: [_jsx("select", Object.assign({ "data-slot": "native-select", "data-size": size, className: "border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-9 w-full min-w-0 appearance-none rounded-md border bg-transparent py-1 pr-8 pl-2.5 text-sm shadow-xs transition-[color,box-shadow] select-none focus-visible:ring-[3px] aria-invalid:ring-[3px] data-[size=sm]:h-8 outline-none disabled:pointer-events-none disabled:cursor-not-allowed" }, props)), _jsx(ChevronDownIcon, { className: "text-muted-foreground top-1/2 right-2.5 size-4 -translate-y-1/2 pointer-events-none absolute select-none", "aria-hidden": "true", "data-slot": "native-select-icon" })] }));
|
|
19
|
-
}
|
|
20
|
-
function NativeSelectOption(params) {
|
|
21
|
-
const props = __rest(params, []);
|
|
22
|
-
return _jsx("option", Object.assign({ "data-slot": "native-select-option" }, props));
|
|
23
|
-
}
|
|
24
|
-
function NativeSelectOptGroup(params) {
|
|
25
|
-
const { className } = params, props = __rest(params, ["className"]);
|
|
26
|
-
return (_jsx("optgroup", Object.assign({ "data-slot": "native-select-optgroup", className: mergeClassNames(className) }, props)));
|
|
27
|
-
}
|
|
28
|
-
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/components/page-back-button/index.tsx"],"names":[],"mappings":"AAIA,KAAK,mBAAmB,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,+BAYxD"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ArrowLeftIcon } from 'lucide-react';
|
|
3
|
-
import { Button } from '../button.js';
|
|
4
|
-
export function PageBackButton(props) {
|
|
5
|
-
const { label = 'Back', context, onClick } = props;
|
|
6
|
-
return (_jsxs("div", { className: "flex min-h-9 min-w-0 items-center gap-2", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: onClick, className: "-ml-2 shrink-0 gap-1.5 px-2", children: [_jsx(ArrowLeftIcon, { className: "size-4" }), _jsx("span", { children: label })] }), context && _jsx("span", { className: "truncate text-sm text-muted-foreground", children: context })] }));
|
|
7
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export interface EmptyProps {
|
|
3
|
-
icon?: ReactNode;
|
|
4
|
-
title: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
action?: {
|
|
7
|
-
label: string;
|
|
8
|
-
onClick: () => void;
|
|
9
|
-
icon?: ReactNode;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export interface LoadingStateProps {
|
|
13
|
-
title: string;
|
|
14
|
-
description?: string;
|
|
15
|
-
fullscreen?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare function LoadingState(props: LoadingStateProps): import("react").JSX.Element;
|
|
18
|
-
export declare function Empty(props: EmptyProps): import("react").JSX.Element;
|
|
19
|
-
//# sourceMappingURL=page-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page-state.d.ts","sourceRoot":"","sources":["../../source/components/page-state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,IAAI,CAAA;QACnB,IAAI,CAAC,EAAE,SAAS,CAAA;KACjB,CAAA;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAmBpD;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,+BAsBtC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { LoaderCircleIcon, PlusIcon } from 'lucide-react';
|
|
3
|
-
import { Button } from './button.js';
|
|
4
|
-
export function LoadingState(props) {
|
|
5
|
-
const { title, description, fullscreen = false } = props;
|
|
6
|
-
return (_jsx("div", { className: fullscreen
|
|
7
|
-
? 'flex min-h-screen items-center justify-center'
|
|
8
|
-
: 'flex min-h-75 items-center justify-center rounded-lg border border-dashed py-8 md:min-h-100 md:py-12', role: "status", "aria-live": "polite", "aria-busy": "true", children: _jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [_jsx(LoaderCircleIcon, { className: "size-8 animate-spin text-muted-foreground" }), _jsx("div", { className: "text-sm text-muted-foreground md:text-base", children: title }), description && _jsx("p", { className: "max-w-sm px-4 text-xs text-muted-foreground md:text-sm", children: description })] }) }));
|
|
9
|
-
}
|
|
10
|
-
export function Empty(props) {
|
|
11
|
-
const { icon, title, description, action } = props;
|
|
12
|
-
return (_jsxs("div", { className: "flex min-h-75 flex-col items-center justify-center rounded-lg border border-dashed py-8 md:min-h-100 md:py-12", children: [icon && (_jsx("div", { className: "mb-3 flex size-10 items-center justify-center rounded-full bg-muted md:mb-4 md:size-12", children: _jsx("div", { className: "size-5 text-muted-foreground md:size-6", children: icon }) })), _jsx("h3", { className: "mt-2 text-sm font-semibold md:text-base", children: title }), description && _jsx("p", { className: "mt-1 max-w-sm px-4 text-center text-xs text-muted-foreground md:text-sm", children: description }), action && (_jsx("div", { className: "mt-4 md:mt-6", children: _jsxs(Button, { onClick: action.onClick, size: "sm", children: [action.icon || _jsx(PlusIcon, { className: "size-4" }), action.label] }) }))] }));
|
|
13
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
interface PaginationProps {
|
|
2
|
-
/**
|
|
3
|
-
* 当前页码(从1开始)
|
|
4
|
-
*/
|
|
5
|
-
currentPage: number;
|
|
6
|
-
/**
|
|
7
|
-
* 每页数量
|
|
8
|
-
*/
|
|
9
|
-
pageSize: number;
|
|
10
|
-
/**
|
|
11
|
-
* 总数据量
|
|
12
|
-
*/
|
|
13
|
-
total: number;
|
|
14
|
-
/**
|
|
15
|
-
* 页码改变回调
|
|
16
|
-
*/
|
|
17
|
-
onPageChange: (page: number) => void;
|
|
18
|
-
/**
|
|
19
|
-
* 每页数量改变回调(可选)
|
|
20
|
-
*/
|
|
21
|
-
onPageSizeChange?: (pageSize: number) => void;
|
|
22
|
-
/**
|
|
23
|
-
* 文案(可选,用于 i18n 覆盖)
|
|
24
|
-
*/
|
|
25
|
-
labels?: {
|
|
26
|
-
showingResults?: (start: number, end: number, total: number) => string;
|
|
27
|
-
previous?: string;
|
|
28
|
-
next?: string;
|
|
29
|
-
pageOf?: (current: number, total: number) => string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export declare function Pagination(props: PaginationProps): import("react").JSX.Element | null;
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/components/pagination/index.tsx"],"names":[],"mappings":"AAIA,UAAU,eAAe;IACvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;QACtE,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;KACpD,CAAA;CACF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,sCAmIhD"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-react';
|
|
3
|
-
import { Button } from '../button.js';
|
|
4
|
-
export function Pagination(props) {
|
|
5
|
-
var _a, _b;
|
|
6
|
-
const { currentPage, pageSize, total, onPageChange, labels } = props;
|
|
7
|
-
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
8
|
-
const getPageNumbers = () => {
|
|
9
|
-
const pages = [];
|
|
10
|
-
const maxVisible = 7;
|
|
11
|
-
if (totalPages <= maxVisible) {
|
|
12
|
-
for (let i = 1; i <= totalPages; i++) {
|
|
13
|
-
pages.push(i);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
if (currentPage <= 4) {
|
|
18
|
-
for (let i = 1; i <= 5; i++) {
|
|
19
|
-
pages.push(i);
|
|
20
|
-
}
|
|
21
|
-
pages.push('...');
|
|
22
|
-
pages.push(totalPages);
|
|
23
|
-
}
|
|
24
|
-
else if (currentPage >= totalPages - 3) {
|
|
25
|
-
pages.push(1);
|
|
26
|
-
pages.push('...');
|
|
27
|
-
for (let i = totalPages - 4; i <= totalPages; i++) {
|
|
28
|
-
pages.push(i);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
pages.push(1);
|
|
33
|
-
pages.push('...');
|
|
34
|
-
for (let i = currentPage - 1; i <= currentPage + 1; i++) {
|
|
35
|
-
pages.push(i);
|
|
36
|
-
}
|
|
37
|
-
pages.push('...');
|
|
38
|
-
pages.push(totalPages);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return pages;
|
|
42
|
-
};
|
|
43
|
-
const pageNumbers = getPageNumbers();
|
|
44
|
-
const handleFirst = () => {
|
|
45
|
-
onPageChange(1);
|
|
46
|
-
};
|
|
47
|
-
const handlePrevious = () => {
|
|
48
|
-
if (currentPage > 1) {
|
|
49
|
-
onPageChange(currentPage - 1);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const handleNext = () => {
|
|
53
|
-
if (currentPage < totalPages) {
|
|
54
|
-
onPageChange(currentPage + 1);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const handleLast = () => {
|
|
58
|
-
onPageChange(totalPages);
|
|
59
|
-
};
|
|
60
|
-
const handlePageClick = (page) => {
|
|
61
|
-
if (typeof page === 'number') {
|
|
62
|
-
onPageChange(page);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const startIndex = (currentPage - 1) * pageSize + 1;
|
|
66
|
-
const endIndex = Math.min(currentPage * pageSize, total);
|
|
67
|
-
if (total === 0) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
const showingResults = (labels === null || labels === void 0 ? void 0 : labels.showingResults) ? labels.showingResults(startIndex, endIndex, total) : `Showing ${startIndex} to ${endIndex} of ${total} results`;
|
|
71
|
-
const previousLabel = (_a = labels === null || labels === void 0 ? void 0 : labels.previous) !== null && _a !== void 0 ? _a : 'Previous';
|
|
72
|
-
const nextLabel = (_b = labels === null || labels === void 0 ? void 0 : labels.next) !== null && _b !== void 0 ? _b : 'Next';
|
|
73
|
-
const pageOfLabel = (labels === null || labels === void 0 ? void 0 : labels.pageOf) ? labels.pageOf(currentPage, totalPages) : `Page ${currentPage} of ${totalPages}`;
|
|
74
|
-
return (_jsxs("div", { className: "flex items-center justify-between px-4", children: [_jsx("div", { className: "text-muted-foreground hidden flex-1 text-sm lg:flex", children: showingResults }), _jsxs("div", { className: "flex w-full items-center justify-between gap-1 lg:hidden", children: [_jsxs(Button, { variant: "outline", size: "sm", className: "shrink-0 px-2", onClick: handlePrevious, disabled: currentPage === 1, children: [_jsx(ChevronLeft, { className: "h-4 w-4" }), previousLabel] }), _jsx("div", { className: "min-w-0 truncate px-1 text-center text-xs font-medium", children: pageOfLabel }), _jsxs(Button, { variant: "outline", size: "sm", className: "shrink-0 px-2", onClick: handleNext, disabled: currentPage === totalPages, children: [nextLabel, _jsx(ChevronRight, { className: "h-4 w-4" })] })] }), _jsxs("div", { className: "hidden w-full items-center gap-2 lg:flex lg:w-fit", children: [_jsxs(Button, { variant: "outline", className: "size-8 p-0", onClick: handleFirst, disabled: currentPage === 1, children: [_jsx("span", { className: "sr-only", children: "Go to first page" }), _jsx(ChevronsLeft, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "size-8 p-0", onClick: handlePrevious, disabled: currentPage === 1, children: [_jsx("span", { className: "sr-only", children: "Go to previous page" }), _jsx(ChevronLeft, { className: "h-4 w-4" })] }), _jsx("div", { className: "flex items-center gap-1", children: pageNumbers.map((page, index) => typeof page === 'number' ? (_jsx(Button, { variant: page === currentPage ? 'default' : 'outline', className: "size-8 p-0", onClick: () => handlePageClick(page), children: page }, `page-${page}`)) : (_jsx("span", { className: "flex size-8 items-center justify-center text-muted-foreground", children: page }, `ellipsis-${index}`))) }), _jsxs(Button, { variant: "outline", className: "size-8 p-0", onClick: handleNext, disabled: currentPage === totalPages, children: [_jsx("span", { className: "sr-only", children: "Go to next page" }), _jsx(ChevronRight, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "size-8 p-0", onClick: handleLast, disabled: currentPage === totalPages, children: [_jsx("span", { className: "sr-only", children: "Go to last page" }), _jsx(ChevronsRight, { className: "h-4 w-4" })] })] })] }));
|
|
75
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
3
|
-
declare function Popover(params: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
|
|
4
|
-
declare function PopoverTrigger(params: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
-
declare function PopoverContent(params: React.ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element;
|
|
6
|
-
declare function PopoverAnchor(params: React.ComponentProps<typeof PopoverPrimitive.Anchor>): React.JSX.Element;
|
|
7
|
-
declare function PopoverHeader(params: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
-
declare function PopoverTitle(params: React.ComponentProps<"h2">): React.JSX.Element;
|
|
9
|
-
declare function PopoverDescription(params: React.ComponentProps<"p">): React.JSX.Element;
|
|
10
|
-
export { Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, };
|
|
11
|
-
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../source/components/popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAItD,iBAAS,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,qBAK1E;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,qBAKpF;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,qBAqBpF;AAED,iBAAS,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,qBAKlF;AAED,iBAAS,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBASzD;AAED,iBAAS,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBASvD;AAED,iBAAS,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,qBAY5D;AAED,OAAO,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,cAAc,GACf,CAAA"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
15
|
-
import { mergeClassNames } from "../utils/merge-class-names/index.js";
|
|
16
|
-
function Popover(params) {
|
|
17
|
-
const props = __rest(params, []);
|
|
18
|
-
return _jsx(PopoverPrimitive.Root, Object.assign({ "data-slot": "popover" }, props));
|
|
19
|
-
}
|
|
20
|
-
function PopoverTrigger(params) {
|
|
21
|
-
const props = __rest(params, []);
|
|
22
|
-
return _jsx(PopoverPrimitive.Trigger, Object.assign({ "data-slot": "popover-trigger" }, props));
|
|
23
|
-
}
|
|
24
|
-
function PopoverContent(params) {
|
|
25
|
-
const { className, align = "center", sideOffset = 4 } = params, props = __rest(params, ["className", "align", "sideOffset"]);
|
|
26
|
-
return (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, Object.assign({ "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: mergeClassNames("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-4 rounded-md p-4 text-sm shadow-md ring-1 duration-100 z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden", className) }, props)) }));
|
|
27
|
-
}
|
|
28
|
-
function PopoverAnchor(params) {
|
|
29
|
-
const props = __rest(params, []);
|
|
30
|
-
return _jsx(PopoverPrimitive.Anchor, Object.assign({ "data-slot": "popover-anchor" }, props));
|
|
31
|
-
}
|
|
32
|
-
function PopoverHeader(params) {
|
|
33
|
-
const { className } = params, props = __rest(params, ["className"]);
|
|
34
|
-
return (_jsx("div", Object.assign({ "data-slot": "popover-header", className: mergeClassNames("flex flex-col gap-1 text-sm", className) }, props)));
|
|
35
|
-
}
|
|
36
|
-
function PopoverTitle(params) {
|
|
37
|
-
const { className } = params, props = __rest(params, ["className"]);
|
|
38
|
-
return (_jsx("div", Object.assign({ "data-slot": "popover-title", className: mergeClassNames("font-medium", className) }, props)));
|
|
39
|
-
}
|
|
40
|
-
function PopoverDescription(params) {
|
|
41
|
-
const { className } = params, props = __rest(params, ["className"]);
|
|
42
|
-
return (_jsx("p", Object.assign({ "data-slot": "popover-description", className: mergeClassNames("text-muted-foreground", className) }, props)));
|
|
43
|
-
}
|
|
44
|
-
export { Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../source/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAIxD,iBAAS,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,qBAsB5E;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import * as React from "react";
|
|
15
|
-
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
16
|
-
import { mergeClassNames } from "../utils/merge-class-names/index.js";
|
|
17
|
-
function Progress(params) {
|
|
18
|
-
const { className, value } = params, props = __rest(params, ["className", "value"]);
|
|
19
|
-
return (_jsx(ProgressPrimitive.Root, Object.assign({ "data-slot": "progress", className: mergeClassNames("bg-muted h-1.5 rounded-full relative flex w-full items-center overflow-x-hidden", className) }, props, { children: _jsx(ProgressPrimitive.Indicator, { "data-slot": "progress-indicator", className: "bg-primary size-full flex-1 transition-all", style: { transform: `translateX(-${100 - (value || 0)}%)` } }) })));
|
|
20
|
-
}
|
|
21
|
-
export { Progress };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { RadioGroup as RadioGroupPrimitive } from 'radix-ui';
|
|
3
|
-
declare function RadioGroup(params: React.ComponentProps<typeof RadioGroupPrimitive.Root>): React.JSX.Element;
|
|
4
|
-
declare function RadioGroupItem(params: React.ComponentProps<typeof RadioGroupPrimitive.Item>): React.JSX.Element;
|
|
5
|
-
export { RadioGroup, RadioGroupItem };
|
|
6
|
-
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../source/components/radio-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAK5D,iBAAS,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,qBAGhF;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,qBAgBpF;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import * as React from 'react';
|
|
14
|
-
import { RadioGroup as RadioGroupPrimitive } from 'radix-ui';
|
|
15
|
-
import { CircleIcon } from 'lucide-react';
|
|
16
|
-
import { mergeClassNames } from '../utils/merge-class-names/index.js';
|
|
17
|
-
function RadioGroup(params) {
|
|
18
|
-
const { className } = params, props = __rest(params, ["className"]);
|
|
19
|
-
return _jsx(RadioGroupPrimitive.Root, Object.assign({ "data-slot": "radio-group", className: mergeClassNames('grid gap-3 w-full', className) }, props));
|
|
20
|
-
}
|
|
21
|
-
function RadioGroupItem(params) {
|
|
22
|
-
const { className } = params, props = __rest(params, ["className"]);
|
|
23
|
-
return (_jsx(RadioGroupPrimitive.Item, Object.assign({ "data-slot": "radio-group-item", className: mergeClassNames('border-input text-primary dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 flex size-4 rounded-full shadow-xs focus-visible:ring-[3px] aria-invalid:ring-[3px] group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50', className) }, props, { children: _jsx(RadioGroupPrimitive.Indicator, { "data-slot": "radio-group-indicator", className: "group-aria-invalid/radio-group-item:text-destructive text-primary flex size-4 items-center justify-center", children: _jsx(CircleIcon, { className: "absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-current" }) }) })));
|
|
24
|
-
}
|
|
25
|
-
export { RadioGroup, RadioGroupItem };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface RoutePendingIndicatorProps {
|
|
2
|
-
/** 进度条的 aria-label */
|
|
3
|
-
label?: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* 路由切换时显示的顶部进度条组件
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* import { RoutePendingIndicator } from '@taicode/common-web/components/route-pending-indicator'
|
|
11
|
-
*
|
|
12
|
-
* const router = createRouter({
|
|
13
|
-
* routeTree,
|
|
14
|
-
* defaultPendingComponent: RoutePendingIndicator,
|
|
15
|
-
* })
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare function RoutePendingIndicator({ label }: RoutePendingIndicatorProps): import("react").JSX.Element;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/components/route-pending-indicator/index.tsx"],"names":[],"mappings":"AAAA,UAAU,0BAA0B;IAClC,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,KAAiB,EAAE,EAAE,0BAA0B,+BAUtF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* 路由切换时显示的顶部进度条组件
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```tsx
|
|
7
|
-
* import { RoutePendingIndicator } from '@taicode/common-web/components/route-pending-indicator'
|
|
8
|
-
*
|
|
9
|
-
* const router = createRouter({
|
|
10
|
-
* routeTree,
|
|
11
|
-
* defaultPendingComponent: RoutePendingIndicator,
|
|
12
|
-
* })
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export function RoutePendingIndicator({ label = 'Loading' }) {
|
|
16
|
-
return (_jsx("div", { role: "progressbar", "aria-label": label, className: "fixed inset-x-0 top-0 z-100 h-0.5 overflow-hidden bg-primary/20", children: _jsx("div", { className: "h-full w-2/5 animate-pulse bg-primary motion-reduce:animate-none" }) }));
|
|
17
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
|
|
3
|
-
declare function ScrollArea(params: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): React.JSX.Element;
|
|
4
|
-
declare function ScrollBar(params: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): React.JSX.Element;
|
|
5
|
-
export { ScrollArea, ScrollBar };
|
|
6
|
-
//# sourceMappingURL=scroll-area.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../source/components/scroll-area.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAI5D,iBAAS,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,qBAsBhF;AAED,iBAAS,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,mBAAmB,CAAC,qBAuB9F;AAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAA"}
|