@makolabs/ripple 1.7.11 → 1.9.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 +16 -0
- package/dist/adapters/ai/OpenAIAdapter.d.ts +8 -1
- package/dist/adapters/ai/OpenAIAdapter.js +2 -2
- package/dist/adapters/storage/BaseAdapter.js +2 -2
- package/dist/adapters/storage/S3Adapter.js +1 -6
- package/dist/adapters/storage/types.d.ts +3 -3
- package/dist/ai/AIChatInterface.svelte +0 -1
- package/dist/ai/ai-chat-interface.d.ts +21 -22
- package/dist/ai/ai-types.d.ts +44 -0
- package/dist/ai/ai-types.js +1 -0
- package/dist/ai/content-detector.js +0 -1
- package/dist/button/Button.svelte +9 -2
- package/dist/button/button-types.d.ts +25 -0
- package/dist/button/button-types.js +1 -0
- package/dist/button/button.d.ts +39 -40
- package/dist/charts/Chart.svelte +11 -23
- package/dist/charts/chart-types.d.ts +137 -0
- package/dist/charts/chart-types.js +1 -0
- package/dist/drawer/Drawer.svelte +57 -23
- package/dist/drawer/drawer-types.d.ts +33 -0
- package/dist/drawer/drawer-types.js +1 -0
- package/dist/drawer/drawer.d.ts +18 -19
- package/dist/elements/accordion/Accordion.svelte +39 -18
- package/dist/elements/accordion/accordion-types.d.ts +29 -0
- package/dist/elements/accordion/accordion-types.js +1 -0
- package/dist/elements/accordion/accordion.d.ts +21 -22
- package/dist/elements/alert/Alert.svelte +20 -8
- package/dist/elements/badge/Badge.svelte +5 -2
- package/dist/elements/badge/badge-types.d.ts +11 -0
- package/dist/elements/badge/badge-types.js +1 -0
- package/dist/elements/badge/badge.d.ts +39 -40
- package/dist/elements/dropdown/Dropdown.svelte +18 -2
- package/dist/elements/dropdown/Select.svelte +17 -5
- package/dist/elements/dropdown/dropdown-types.d.ts +68 -0
- package/dist/elements/dropdown/dropdown-types.js +1 -0
- package/dist/elements/dropdown/dropdown.d.ts +18 -19
- package/dist/elements/dropdown/select.d.ts +18 -19
- package/dist/elements/file-upload/file-upload-types.d.ts +68 -0
- package/dist/elements/file-upload/file-upload-types.js +1 -0
- package/dist/elements/pagination/Pagination.svelte +15 -2
- package/dist/elements/pagination/Pagination.svelte.d.ts +1 -0
- package/dist/elements/progress/progress-types.d.ts +22 -0
- package/dist/elements/progress/progress-types.js +1 -0
- package/dist/elements/timeline/timeline-types.d.ts +11 -0
- package/dist/elements/timeline/timeline-types.js +1 -0
- package/dist/filters/filter-types.d.ts +24 -0
- package/dist/filters/filter-types.js +1 -0
- package/dist/forms/Checkbox.svelte +16 -4
- package/dist/forms/Form.svelte +0 -2
- package/dist/forms/Input.svelte +19 -5
- package/dist/forms/NumberInput.svelte +8 -1
- package/dist/forms/RadioInputs.svelte +14 -5
- package/dist/forms/Slider.svelte +6 -4
- package/dist/forms/Toggle.svelte +67 -29
- package/dist/forms/form-types.d.ts +168 -0
- package/dist/forms/form-types.js +1 -0
- package/dist/forms/slider.d.ts +72 -10
- package/dist/forms/slider.js +21 -0
- package/dist/header/Breadcrumbs.svelte +47 -24
- package/dist/header/PageHeader.svelte +12 -2
- package/dist/header/breadcrumbs.d.ts +47 -39
- package/dist/header/header-types.d.ts +43 -0
- package/dist/header/header-types.js +1 -0
- package/dist/helper/deprecation.d.ts +14 -0
- package/dist/helper/deprecation.js +24 -0
- package/dist/helper/testid.d.ts +10 -0
- package/dist/helper/testid.js +17 -0
- package/dist/index.d.ts +37 -1007
- package/dist/index.js +38 -14
- package/dist/layout/activity-list/activity-list-types.d.ts +30 -0
- package/dist/layout/activity-list/activity-list-types.js +1 -0
- package/dist/layout/activity-list/activity-list.d.ts +21 -22
- package/dist/layout/card/Card.svelte +19 -5
- package/dist/layout/card/card-types.d.ts +43 -0
- package/dist/layout/card/card-types.js +1 -0
- package/dist/layout/card/card.d.ts +21 -22
- package/dist/layout/card/metric-card.d.ts +3 -3
- package/dist/layout/card/ranked-card.d.ts +2 -1
- package/dist/layout/navbar/Navbar.svelte +14 -16
- package/dist/layout/navbar/navbar-types.d.ts +19 -0
- package/dist/layout/navbar/navbar-types.js +1 -0
- package/dist/layout/navbar/navbar.d.ts +19 -19
- package/dist/layout/sidebar/Sidebar.svelte +6 -3
- package/dist/layout/sidebar/sidebar-types.d.ts +59 -0
- package/dist/layout/sidebar/sidebar-types.js +1 -0
- package/dist/layout/table/Table.svelte +237 -303
- package/dist/layout/table/table-types.d.ts +82 -0
- package/dist/layout/table/table-types.js +1 -0
- package/dist/layout/table/table.d.ts +24 -25
- package/dist/layout/tabs/Tab.svelte +3 -1
- package/dist/layout/tabs/TabGroup.svelte +7 -4
- package/dist/layout/tabs/tabs-types.d.ts +43 -0
- package/dist/layout/tabs/tabs-types.js +1 -0
- package/dist/layout/tabs/tabs.d.ts +39 -40
- package/dist/modal/Modal.svelte +124 -21
- package/dist/modal/modal-types.d.ts +34 -0
- package/dist/modal/modal-types.js +1 -0
- package/dist/modal/modal.d.ts +18 -19
- package/dist/modal/modal.js +2 -2
- package/dist/types/echarts.d.ts +27 -0
- package/dist/user-management/UserModal.svelte +1 -1
- package/dist/user-management/UserTable.svelte +3 -3
- package/dist/user-management/UserViewModal.svelte +2 -2
- package/dist/user-management/user-management-types.d.ts +156 -0
- package/dist/user-management/user-management-types.js +1 -0
- package/dist/variants.d.ts +13 -13
- package/package.json +9 -7
- package/dist/ai/AIChatInterfaceTestWrapper.svelte +0 -26
- package/dist/ai/AIChatInterfaceTestWrapper.svelte.d.ts +0 -17
- package/dist/button/ButtonTestWrapper.svelte +0 -10
- package/dist/button/ButtonTestWrapper.svelte.d.ts +0 -7
- package/dist/drawer/DrawerTestWrapper.svelte +0 -19
- package/dist/drawer/DrawerTestWrapper.svelte.d.ts +0 -9
- package/dist/elements/accordion/AccordionTestWrapper.svelte +0 -21
- package/dist/elements/accordion/AccordionTestWrapper.svelte.d.ts +0 -10
- package/dist/elements/badge/BadgeTestWrapper.svelte +0 -14
- package/dist/elements/badge/BadgeTestWrapper.svelte.d.ts +0 -9
- package/dist/forms/CheckboxTestWrapper.svelte +0 -8
- package/dist/forms/CheckboxTestWrapper.svelte.d.ts +0 -4
- package/dist/forms/InputTestWrapper.svelte +0 -8
- package/dist/forms/InputTestWrapper.svelte.d.ts +0 -4
- package/dist/forms/ToggleTestWrapper.svelte +0 -8
- package/dist/forms/ToggleTestWrapper.svelte.d.ts +0 -7
- package/dist/layout/card/CardTestWrapper.svelte +0 -15
- package/dist/layout/card/CardTestWrapper.svelte.d.ts +0 -7
- package/dist/modal/ModalTestWrapper.svelte +0 -20
- package/dist/modal/ModalTestWrapper.svelte.d.ts +0 -8
- package/dist/user-management/UserManagementTestWrapper.svelte +0 -32
- package/dist/user-management/UserManagementTestWrapper.svelte.d.ts +0 -12
- package/dist/user-management/UserModalTestWrapper.svelte +0 -22
- package/dist/user-management/UserModalTestWrapper.svelte.d.ts +0 -7
- package/dist/user-management/UserTableTestWrapper.svelte +0 -41
- package/dist/user-management/UserTableTestWrapper.svelte.d.ts +0 -7
- package/dist/user-management/UserViewModalTestWrapper.svelte +0 -22
- package/dist/user-management/UserViewModalTestWrapper.svelte.d.ts +0 -7
package/README.md
CHANGED
|
@@ -637,3 +637,19 @@ For CI environments (GitHub Actions, etc.), use:
|
|
|
637
637
|
- name: Run tests
|
|
638
638
|
run: npm run test:unit -- --run
|
|
639
639
|
```
|
|
640
|
+
|
|
641
|
+
## Troubleshooting
|
|
642
|
+
|
|
643
|
+
### Missing color tokens (components render without color)
|
|
644
|
+
|
|
645
|
+
Ripple UI uses custom color tokens (e.g. `primary`, `secondary`, `danger`) that must be defined in your app's CSS. If components appear unstyled or use fallback colors, add the `@theme` block with all required color token definitions to your `app.css`. See the full token list in the [Usage](#usage) section above.
|
|
646
|
+
|
|
647
|
+
### TailwindCSS 4 `@source` configuration
|
|
648
|
+
|
|
649
|
+
TailwindCSS 4 does not automatically scan `node_modules` for class names. You must add the following directive to your `app.css` so that Tailwind generates the utility classes used by Ripple UI components:
|
|
650
|
+
|
|
651
|
+
```css
|
|
652
|
+
@source '../node_modules/@makolabs/ripple';
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
Without this, component styles that rely on Tailwind utilities will be missing from your build output.
|
|
@@ -2,14 +2,21 @@ import type { ChatResponse, ChatMessage, StreamingCallback } from '../../index.j
|
|
|
2
2
|
import type { AIAdapter, AIContext } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for OpenAI adapter
|
|
5
|
+
*
|
|
6
|
+
* **Security warning:** This adapter makes API calls directly from the browser.
|
|
7
|
+
* The API key will be visible in network requests. For production use, consider
|
|
8
|
+
* proxying requests through a server-side endpoint to avoid exposing the key.
|
|
5
9
|
*/
|
|
6
10
|
export interface OpenAIAdapterConfig {
|
|
7
11
|
/**
|
|
8
12
|
* OpenAI API key
|
|
13
|
+
*
|
|
14
|
+
* **Warning:** This key is sent in browser-side fetch requests and will be
|
|
15
|
+
* visible in network traffic. Use a server-side proxy for production.
|
|
9
16
|
*/
|
|
10
17
|
apiKey: string;
|
|
11
18
|
/**
|
|
12
|
-
* Model to use (defaults to gpt-
|
|
19
|
+
* Model to use (defaults to gpt-5-mini)
|
|
13
20
|
*/
|
|
14
21
|
model?: string;
|
|
15
22
|
/**
|
|
@@ -13,8 +13,8 @@ export class OpenAIAdapter {
|
|
|
13
13
|
constructor(config) {
|
|
14
14
|
// Set defaults
|
|
15
15
|
this.config = {
|
|
16
|
-
model: 'gpt-5',
|
|
17
|
-
baseUrl: 'https://api.openai.com/v1',
|
|
16
|
+
model: 'gpt-5-mini',
|
|
17
|
+
baseUrl: 'https://api.openai.com/v1',
|
|
18
18
|
systemPrompt: this.getDefaultSystemPrompt(),
|
|
19
19
|
temperature: 0.7,
|
|
20
20
|
maxTokens: 4000,
|
|
@@ -17,7 +17,7 @@ export class BaseAdapter {
|
|
|
17
17
|
contentType: options.contentType,
|
|
18
18
|
fileFormat: options.fileFormat,
|
|
19
19
|
reference: options.reference || file.name,
|
|
20
|
-
insurer: options.
|
|
20
|
+
insurer: options.insurer || null
|
|
21
21
|
})
|
|
22
22
|
});
|
|
23
23
|
if (!response.ok) {
|
|
@@ -44,7 +44,7 @@ export class BaseAdapter {
|
|
|
44
44
|
}
|
|
45
45
|
async getImportStatus(importId) {
|
|
46
46
|
try {
|
|
47
|
-
const response = await fetch(`/api/
|
|
47
|
+
const response = await fetch(`/api/${this.getApiPath()}/imports/${importId}`);
|
|
48
48
|
if (!response.ok) {
|
|
49
49
|
if (response.status === 404) {
|
|
50
50
|
throw new Error(`404: File ${importId} not found on server`);
|
|
@@ -6,7 +6,7 @@ export class S3Adapter extends BaseAdapter {
|
|
|
6
6
|
basePath;
|
|
7
7
|
constructor(basePath, publicS3BasePath) {
|
|
8
8
|
super();
|
|
9
|
-
this.basePath = basePath || publicS3BasePath || '
|
|
9
|
+
this.basePath = basePath || publicS3BasePath || '/';
|
|
10
10
|
}
|
|
11
11
|
getName() {
|
|
12
12
|
return 'S3';
|
|
@@ -111,11 +111,6 @@ export class S3Adapter extends BaseAdapter {
|
|
|
111
111
|
parentPath = this.basePath;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
// Debug log
|
|
115
|
-
console.log(`S3 listing path: ${normalizedPath}, files: ${fileItems.length}, folders: ${folders.length}`);
|
|
116
|
-
if (folders.length > 0) {
|
|
117
|
-
console.log('Sample folder names:', folders.slice(0, 3).map((f) => f.name));
|
|
118
|
-
}
|
|
119
114
|
return {
|
|
120
115
|
files,
|
|
121
116
|
currentPath: normalizedPath,
|
|
@@ -89,9 +89,9 @@ export interface StorageAdapter {
|
|
|
89
89
|
getName(): string;
|
|
90
90
|
list(path: string, searchQuery?: string): Promise<FileListResult>;
|
|
91
91
|
download(file: FileItem): Promise<URLString>;
|
|
92
|
-
import(file: FileItem, options: ImportOptions): Promise<ImportResult>;
|
|
93
|
-
batchImport(files: FileItem[], options: ImportOptions): Promise<BatchImportResult>;
|
|
94
|
-
getImportStatus(importId: string, fileKey
|
|
92
|
+
import?(file: FileItem, options: ImportOptions): Promise<ImportResult>;
|
|
93
|
+
batchImport?(files: FileItem[], options: ImportOptions): Promise<BatchImportResult>;
|
|
94
|
+
getImportStatus?(importId: string, fileKey?: string): Promise<ImportStatus>;
|
|
95
95
|
reportError?(importId: string, options: ErrorReportOptions): Promise<boolean>;
|
|
96
96
|
isConfigured(): Promise<boolean>;
|
|
97
97
|
authenticate?(): Promise<boolean>;
|
|
@@ -273,7 +273,6 @@
|
|
|
273
273
|
function handleThinkingToggle(enabled: boolean) {
|
|
274
274
|
thinkingMode = enabled;
|
|
275
275
|
// You can add additional logic here when thinking mode changes
|
|
276
|
-
console.log('Thinking mode:', enabled ? 'enabled' : 'disabled');
|
|
277
276
|
}
|
|
278
277
|
|
|
279
278
|
// Check adapter configuration
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import { Color } from '../variants.js';
|
|
2
1
|
export declare const aiChatInterface: import("tailwind-variants").TVReturnType<{
|
|
3
2
|
color: {
|
|
4
|
-
|
|
3
|
+
default: {
|
|
5
4
|
userMessage: string;
|
|
6
5
|
sendButton: string;
|
|
7
6
|
background: string;
|
|
8
7
|
};
|
|
9
|
-
|
|
8
|
+
primary: {
|
|
10
9
|
userMessage: string;
|
|
11
10
|
sendButton: string;
|
|
12
11
|
background: string;
|
|
13
12
|
};
|
|
14
|
-
|
|
13
|
+
secondary: {
|
|
15
14
|
userMessage: string;
|
|
16
15
|
sendButton: string;
|
|
17
16
|
background: string;
|
|
18
17
|
};
|
|
19
|
-
|
|
18
|
+
success: {
|
|
20
19
|
userMessage: string;
|
|
21
20
|
sendButton: string;
|
|
22
21
|
background: string;
|
|
23
22
|
};
|
|
24
|
-
|
|
23
|
+
warning: {
|
|
25
24
|
userMessage: string;
|
|
26
25
|
sendButton: string;
|
|
27
26
|
background: string;
|
|
28
27
|
};
|
|
29
|
-
|
|
28
|
+
danger: {
|
|
30
29
|
userMessage: string;
|
|
31
30
|
sendButton: string;
|
|
32
31
|
background: string;
|
|
33
32
|
};
|
|
34
|
-
|
|
33
|
+
info: {
|
|
35
34
|
userMessage: string;
|
|
36
35
|
sendButton: string;
|
|
37
36
|
background: string;
|
|
@@ -54,37 +53,37 @@ export declare const aiChatInterface: import("tailwind-variants").TVReturnType<{
|
|
|
54
53
|
background: string;
|
|
55
54
|
}, undefined, {
|
|
56
55
|
color: {
|
|
57
|
-
|
|
56
|
+
default: {
|
|
58
57
|
userMessage: string;
|
|
59
58
|
sendButton: string;
|
|
60
59
|
background: string;
|
|
61
60
|
};
|
|
62
|
-
|
|
61
|
+
primary: {
|
|
63
62
|
userMessage: string;
|
|
64
63
|
sendButton: string;
|
|
65
64
|
background: string;
|
|
66
65
|
};
|
|
67
|
-
|
|
66
|
+
secondary: {
|
|
68
67
|
userMessage: string;
|
|
69
68
|
sendButton: string;
|
|
70
69
|
background: string;
|
|
71
70
|
};
|
|
72
|
-
|
|
71
|
+
success: {
|
|
73
72
|
userMessage: string;
|
|
74
73
|
sendButton: string;
|
|
75
74
|
background: string;
|
|
76
75
|
};
|
|
77
|
-
|
|
76
|
+
warning: {
|
|
78
77
|
userMessage: string;
|
|
79
78
|
sendButton: string;
|
|
80
79
|
background: string;
|
|
81
80
|
};
|
|
82
|
-
|
|
81
|
+
danger: {
|
|
83
82
|
userMessage: string;
|
|
84
83
|
sendButton: string;
|
|
85
84
|
background: string;
|
|
86
85
|
};
|
|
87
|
-
|
|
86
|
+
info: {
|
|
88
87
|
userMessage: string;
|
|
89
88
|
sendButton: string;
|
|
90
89
|
background: string;
|
|
@@ -107,37 +106,37 @@ export declare const aiChatInterface: import("tailwind-variants").TVReturnType<{
|
|
|
107
106
|
background: string;
|
|
108
107
|
}, import("tailwind-variants").TVReturnType<{
|
|
109
108
|
color: {
|
|
110
|
-
|
|
109
|
+
default: {
|
|
111
110
|
userMessage: string;
|
|
112
111
|
sendButton: string;
|
|
113
112
|
background: string;
|
|
114
113
|
};
|
|
115
|
-
|
|
114
|
+
primary: {
|
|
116
115
|
userMessage: string;
|
|
117
116
|
sendButton: string;
|
|
118
117
|
background: string;
|
|
119
118
|
};
|
|
120
|
-
|
|
119
|
+
secondary: {
|
|
121
120
|
userMessage: string;
|
|
122
121
|
sendButton: string;
|
|
123
122
|
background: string;
|
|
124
123
|
};
|
|
125
|
-
|
|
124
|
+
success: {
|
|
126
125
|
userMessage: string;
|
|
127
126
|
sendButton: string;
|
|
128
127
|
background: string;
|
|
129
128
|
};
|
|
130
|
-
|
|
129
|
+
warning: {
|
|
131
130
|
userMessage: string;
|
|
132
131
|
sendButton: string;
|
|
133
132
|
background: string;
|
|
134
133
|
};
|
|
135
|
-
|
|
134
|
+
danger: {
|
|
136
135
|
userMessage: string;
|
|
137
136
|
sendButton: string;
|
|
138
137
|
background: string;
|
|
139
138
|
};
|
|
140
|
-
|
|
139
|
+
info: {
|
|
141
140
|
userMessage: string;
|
|
142
141
|
sendButton: string;
|
|
143
142
|
background: string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
import type { FileAction, StorageAdapter } from '../adapters/storage/types.js';
|
|
3
|
+
export type ChatMessageType = 'chat' | 'action' | 'thinking';
|
|
4
|
+
export type StreamingCallback = (response: ChatResponse) => void;
|
|
5
|
+
export interface ChatAction {
|
|
6
|
+
type: string;
|
|
7
|
+
data: any;
|
|
8
|
+
metadata?: Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
export interface ChatMessage {
|
|
11
|
+
id: string;
|
|
12
|
+
type: ChatMessageType;
|
|
13
|
+
content: string;
|
|
14
|
+
timestamp: Date;
|
|
15
|
+
action?: ChatAction;
|
|
16
|
+
thinkingContent?: string;
|
|
17
|
+
isThinkingComplete?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ChatResponse {
|
|
20
|
+
type: ChatMessageType;
|
|
21
|
+
content: string;
|
|
22
|
+
action?: ChatAction;
|
|
23
|
+
messageId?: string;
|
|
24
|
+
isStreaming?: boolean;
|
|
25
|
+
isStreamEnd?: boolean;
|
|
26
|
+
thinkingContent?: string;
|
|
27
|
+
isThinkingComplete?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface QuickAction {
|
|
30
|
+
label: string;
|
|
31
|
+
prompt: string;
|
|
32
|
+
icon?: Component;
|
|
33
|
+
}
|
|
34
|
+
export interface FileBrowserProps {
|
|
35
|
+
adapter: StorageAdapter;
|
|
36
|
+
startPath?: string;
|
|
37
|
+
actions?: FileAction[];
|
|
38
|
+
selectedFiles?: string[];
|
|
39
|
+
infoSection?: (props: {
|
|
40
|
+
selectedFiles: string[];
|
|
41
|
+
navToFileFolder: (fileKey: string) => void;
|
|
42
|
+
}) => any;
|
|
43
|
+
testId?: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -72,7 +72,6 @@ function isMermaidLanguage(language) {
|
|
|
72
72
|
* Parses content into segments (text, code, mermaid)
|
|
73
73
|
*/
|
|
74
74
|
export function parseContentSegments(content) {
|
|
75
|
-
console.log('parseContentSegments', content);
|
|
76
75
|
const segments = [];
|
|
77
76
|
const mermaidBlocks = detectMermaidDiagrams(content);
|
|
78
77
|
const codeBlocks = detectCodeBlocks(content);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn } from '../helper/cls.js';
|
|
3
|
+
import { buildTestId } from '../helper/testid.js';
|
|
3
4
|
import { buttonVariants } from './button.js';
|
|
4
5
|
import type { ButtonProps } from '../index.js';
|
|
5
6
|
import { Color, Size } from '../variants.js';
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
disabled = false,
|
|
13
14
|
isLoading = false,
|
|
14
15
|
class: className = '',
|
|
16
|
+
testId,
|
|
15
17
|
children,
|
|
16
18
|
...restProps
|
|
17
19
|
}: ButtonProps = $props();
|
|
@@ -34,13 +36,18 @@
|
|
|
34
36
|
</script>
|
|
35
37
|
|
|
36
38
|
{#if restProps['href']}
|
|
37
|
-
<a class={buttonClasses} {...restProps}>
|
|
39
|
+
<a class={buttonClasses} data-testid={buildTestId('button', undefined, testId)} {...restProps}>
|
|
38
40
|
{#if children}
|
|
39
41
|
{@render children()}
|
|
40
42
|
{/if}
|
|
41
43
|
</a>
|
|
42
44
|
{:else}
|
|
43
|
-
<button
|
|
45
|
+
<button
|
|
46
|
+
class={buttonClasses}
|
|
47
|
+
data-testid={buildTestId('button', undefined, testId)}
|
|
48
|
+
disabled={disabled || isLoading}
|
|
49
|
+
{...restProps}
|
|
50
|
+
>
|
|
44
51
|
{#if children}
|
|
45
52
|
{@render children()}
|
|
46
53
|
{/if}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLButtonAttributes, HTMLAttributeAnchorTarget } from 'svelte/elements';
|
|
4
|
+
import type { VariantColors, VariantSizes } from '../index.js';
|
|
5
|
+
export type BaseButtonProps = {
|
|
6
|
+
class?: ClassValue;
|
|
7
|
+
variant?: 'solid' | 'outline' | 'ghost' | 'link';
|
|
8
|
+
color?: VariantColors;
|
|
9
|
+
size?: VariantSizes;
|
|
10
|
+
rounded?: 'none' | 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | 'full';
|
|
11
|
+
disabled?: boolean | undefined | null;
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
testId?: string;
|
|
15
|
+
};
|
|
16
|
+
export type ButtonHTMLProps = {
|
|
17
|
+
href?: never;
|
|
18
|
+
} & HTMLButtonAttributes;
|
|
19
|
+
export type AnchorHTMLProps = {
|
|
20
|
+
rel?: string | undefined | null;
|
|
21
|
+
target?: HTMLAttributeAnchorTarget | undefined | null;
|
|
22
|
+
referrerpolicy?: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url' | undefined | null;
|
|
23
|
+
href: string;
|
|
24
|
+
} & Record<string, unknown>;
|
|
25
|
+
export type ButtonProps = BaseButtonProps & (ButtonHTMLProps | AnchorHTMLProps);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/button/button.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Color, Size } from '../variants.js';
|
|
2
1
|
export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
3
2
|
variant: {
|
|
4
3
|
solid: string;
|
|
@@ -7,21 +6,21 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
7
6
|
link: string;
|
|
8
7
|
};
|
|
9
8
|
color: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
default: string;
|
|
10
|
+
primary: string;
|
|
11
|
+
secondary: string;
|
|
12
|
+
info: string;
|
|
13
|
+
success: string;
|
|
14
|
+
warning: string;
|
|
15
|
+
danger: string;
|
|
17
16
|
};
|
|
18
17
|
size: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
xs: string;
|
|
19
|
+
sm: string;
|
|
20
|
+
base: string;
|
|
21
|
+
lg: string;
|
|
22
|
+
xl: string;
|
|
23
|
+
"2xl": string;
|
|
25
24
|
};
|
|
26
25
|
rounded: {
|
|
27
26
|
none: string;
|
|
@@ -44,21 +43,21 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
44
43
|
link: string;
|
|
45
44
|
};
|
|
46
45
|
color: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
default: string;
|
|
47
|
+
primary: string;
|
|
48
|
+
secondary: string;
|
|
49
|
+
info: string;
|
|
50
|
+
success: string;
|
|
51
|
+
warning: string;
|
|
52
|
+
danger: string;
|
|
54
53
|
};
|
|
55
54
|
size: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
xs: string;
|
|
56
|
+
sm: string;
|
|
57
|
+
base: string;
|
|
58
|
+
lg: string;
|
|
59
|
+
xl: string;
|
|
60
|
+
"2xl": string;
|
|
62
61
|
};
|
|
63
62
|
rounded: {
|
|
64
63
|
none: string;
|
|
@@ -81,21 +80,21 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
81
80
|
link: string;
|
|
82
81
|
};
|
|
83
82
|
color: {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
default: string;
|
|
84
|
+
primary: string;
|
|
85
|
+
secondary: string;
|
|
86
|
+
info: string;
|
|
87
|
+
success: string;
|
|
88
|
+
warning: string;
|
|
89
|
+
danger: string;
|
|
91
90
|
};
|
|
92
91
|
size: {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
xs: string;
|
|
93
|
+
sm: string;
|
|
94
|
+
base: string;
|
|
95
|
+
lg: string;
|
|
96
|
+
xl: string;
|
|
97
|
+
"2xl": string;
|
|
99
98
|
};
|
|
100
99
|
rounded: {
|
|
101
100
|
none: string;
|
package/dist/charts/Chart.svelte
CHANGED
|
@@ -2,29 +2,18 @@
|
|
|
2
2
|
import { onMount, onDestroy } from 'svelte';
|
|
3
3
|
import { cn } from '../helper/cls.js';
|
|
4
4
|
import * as echarts from 'echarts/core';
|
|
5
|
-
// @ts-expect-error - ECharts types are not available
|
|
6
5
|
import { LineChart, BarChart, PieChart } from 'echarts/charts';
|
|
7
6
|
import {
|
|
8
|
-
// @ts-expect-error - ECharts types are not available
|
|
9
7
|
GridComponent,
|
|
10
|
-
// @ts-expect-error - ECharts types are not available
|
|
11
8
|
TooltipComponent,
|
|
12
|
-
// @ts-expect-error - ECharts types are not available
|
|
13
9
|
TitleComponent,
|
|
14
|
-
// @ts-expect-error - ECharts types are not available
|
|
15
10
|
LegendComponent,
|
|
16
|
-
// @ts-expect-error - ECharts types are not available
|
|
17
11
|
DataZoomComponent,
|
|
18
|
-
// @ts-expect-error - ECharts types are not available
|
|
19
12
|
ToolboxComponent,
|
|
20
|
-
// @ts-expect-error - ECharts types are not available
|
|
21
13
|
MarkLineComponent,
|
|
22
|
-
// @ts-expect-error - ECharts types are not available
|
|
23
14
|
MarkPointComponent,
|
|
24
|
-
// @ts-expect-error - ECharts types are not available
|
|
25
15
|
GraphicComponent
|
|
26
16
|
} from 'echarts/components';
|
|
27
|
-
// @ts-expect-error - ECharts types are not available
|
|
28
17
|
import { SVGRenderer } from 'echarts/renderers';
|
|
29
18
|
import {
|
|
30
19
|
type ChartProps,
|
|
@@ -34,7 +23,6 @@
|
|
|
34
23
|
} from '../index.js';
|
|
35
24
|
import { defaultChartColors } from '../variants.js';
|
|
36
25
|
|
|
37
|
-
// @ts-expect-error - ECharts types are not available
|
|
38
26
|
echarts.use([
|
|
39
27
|
LineChart,
|
|
40
28
|
BarChart,
|
|
@@ -107,9 +95,9 @@
|
|
|
107
95
|
const hasPieChart = $derived(series.some((s) => s.type === 'pie'));
|
|
108
96
|
|
|
109
97
|
let chartContainer: HTMLDivElement;
|
|
110
|
-
// @ts-expect-error - ECharts types are not available
|
|
111
98
|
let chart: echarts.ECharts;
|
|
112
99
|
let resizeObserver: ResizeObserver;
|
|
100
|
+
let resizeTimeoutId: ReturnType<typeof setTimeout>;
|
|
113
101
|
|
|
114
102
|
const chartColors: ChartColors = { ...defaultChartColors, ...colors };
|
|
115
103
|
const baseColors = [
|
|
@@ -286,8 +274,8 @@
|
|
|
286
274
|
label: {
|
|
287
275
|
show: seriesConfig.showLabel || false,
|
|
288
276
|
position: actualType === 'line' ? 'top' : 'inside',
|
|
289
|
-
//
|
|
290
|
-
formatter: (params) => {
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
278
|
+
formatter: (params: any) => {
|
|
291
279
|
const yAxisIndex = seriesConfig.yAxisIndex || 0;
|
|
292
280
|
const axisConfig = yAxis[yAxisIndex];
|
|
293
281
|
return formatValue(params.value, axisConfig.format, axisConfig.unit);
|
|
@@ -374,8 +362,8 @@
|
|
|
374
362
|
// Add center text if specified in the first pie series
|
|
375
363
|
const pieSeriesWithCenterText = series.find((s) => s.type === 'pie' && s.centerText);
|
|
376
364
|
if (pieSeriesWithCenterText?.centerText) {
|
|
377
|
-
//
|
|
378
|
-
pieOptions.graphic = {
|
|
365
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
366
|
+
(pieOptions as any).graphic = {
|
|
379
367
|
elements: [
|
|
380
368
|
{
|
|
381
369
|
type: 'text',
|
|
@@ -463,8 +451,8 @@
|
|
|
463
451
|
show: false
|
|
464
452
|
},
|
|
465
453
|
axisLabel: {
|
|
466
|
-
//
|
|
467
|
-
formatter: (value) => formatValue(value, axis.format, axis.unit)
|
|
454
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
455
|
+
formatter: (value: any) => formatValue(value, axis.format, axis.unit)
|
|
468
456
|
},
|
|
469
457
|
splitLine: {
|
|
470
458
|
show: index === 0 ? grid.horizontal || true : false
|
|
@@ -502,11 +490,11 @@
|
|
|
502
490
|
}
|
|
503
491
|
|
|
504
492
|
onMount(() => {
|
|
505
|
-
// @ts-expect-error - ECharts types are not available
|
|
506
493
|
chart = echarts.init(chartContainer, theme);
|
|
507
494
|
|
|
508
495
|
// Instantly triggering resizes disables animation, hence the timeout
|
|
509
|
-
setTimeout(() => {
|
|
496
|
+
resizeTimeoutId = setTimeout(() => {
|
|
497
|
+
if (!chartContainer) return;
|
|
510
498
|
resizeObserver = new ResizeObserver(() => {
|
|
511
499
|
chart?.resize();
|
|
512
500
|
});
|
|
@@ -514,8 +502,7 @@
|
|
|
514
502
|
}, AnimationDuration);
|
|
515
503
|
|
|
516
504
|
updateChart();
|
|
517
|
-
|
|
518
|
-
chart.on('click', (params) => {
|
|
505
|
+
chart.on('click', (params: echarts.ECElementEvent) => {
|
|
519
506
|
if (onpointclick) {
|
|
520
507
|
onpointclick({
|
|
521
508
|
detail: {
|
|
@@ -538,6 +525,7 @@
|
|
|
538
525
|
});
|
|
539
526
|
|
|
540
527
|
onDestroy(() => {
|
|
528
|
+
clearTimeout(resizeTimeoutId);
|
|
541
529
|
resizeObserver?.disconnect();
|
|
542
530
|
chart?.dispose();
|
|
543
531
|
});
|