@makolabs/ripple 1.7.11 → 1.8.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/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/content-detector.js +0 -1
- package/dist/button/Button.svelte +9 -2
- package/dist/button/button.d.ts +39 -40
- package/dist/charts/Chart.svelte +4 -1
- package/dist/drawer/Drawer.svelte +57 -23
- package/dist/drawer/drawer.d.ts +18 -19
- package/dist/elements/accordion/Accordion.svelte +39 -18
- 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.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.d.ts +18 -19
- package/dist/elements/dropdown/select.d.ts +18 -19
- package/dist/elements/pagination/Pagination.svelte +15 -2
- package/dist/elements/pagination/Pagination.svelte.d.ts +1 -0
- package/dist/forms/Checkbox.svelte +16 -4
- package/dist/forms/Form.svelte +0 -2
- package/dist/forms/Input.svelte +16 -4
- 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/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/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 +147 -47
- package/dist/index.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.d.ts +21 -22
- package/dist/layout/card/ranked-card.d.ts +2 -1
- package/dist/layout/navbar/Navbar.svelte +14 -16
- package/dist/layout/navbar/navbar.d.ts +19 -19
- package/dist/layout/sidebar/Sidebar.svelte +6 -3
- package/dist/layout/table/Table.svelte +237 -303
- 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.d.ts +39 -40
- package/dist/modal/Modal.svelte +124 -21
- package/dist/modal/modal.d.ts +18 -19
- package/dist/modal/modal.js +2 -2
- 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/variants.d.ts +13 -13
- package/package.json +9 -6
- 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
|
@@ -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;
|
|
@@ -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}
|
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
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
// @ts-expect-error - ECharts types are not available
|
|
111
111
|
let chart: echarts.ECharts;
|
|
112
112
|
let resizeObserver: ResizeObserver;
|
|
113
|
+
let resizeTimeoutId: ReturnType<typeof setTimeout>;
|
|
113
114
|
|
|
114
115
|
const chartColors: ChartColors = { ...defaultChartColors, ...colors };
|
|
115
116
|
const baseColors = [
|
|
@@ -506,7 +507,8 @@
|
|
|
506
507
|
chart = echarts.init(chartContainer, theme);
|
|
507
508
|
|
|
508
509
|
// Instantly triggering resizes disables animation, hence the timeout
|
|
509
|
-
setTimeout(() => {
|
|
510
|
+
resizeTimeoutId = setTimeout(() => {
|
|
511
|
+
if (!chartContainer) return;
|
|
510
512
|
resizeObserver = new ResizeObserver(() => {
|
|
511
513
|
chart?.resize();
|
|
512
514
|
});
|
|
@@ -538,6 +540,7 @@
|
|
|
538
540
|
});
|
|
539
541
|
|
|
540
542
|
onDestroy(() => {
|
|
543
|
+
clearTimeout(resizeTimeoutId);
|
|
541
544
|
resizeObserver?.disconnect();
|
|
542
545
|
chart?.dispose();
|
|
543
546
|
});
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import { fade, fly } from 'svelte/transition';
|
|
5
5
|
import { quintOut } from 'svelte/easing';
|
|
6
6
|
import { cn } from '../helper/cls.js';
|
|
7
|
+
import { buildTestId } from '../helper/testid.js';
|
|
8
|
+
import { warnDeprecatedProps } from '../helper/deprecation.js';
|
|
7
9
|
import { drawer } from './drawer.js';
|
|
8
10
|
import type { DrawerProps } from '../index.js';
|
|
9
11
|
|
|
@@ -17,14 +19,34 @@
|
|
|
17
19
|
header,
|
|
18
20
|
footer,
|
|
19
21
|
class: className = '',
|
|
20
|
-
backdropclass
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
backdropclass,
|
|
23
|
+
backdropClass = backdropclass ?? '',
|
|
24
|
+
contentclass,
|
|
25
|
+
contentClass = contentclass ?? '',
|
|
26
|
+
headerclass,
|
|
27
|
+
headerClass = headerclass ?? '',
|
|
28
|
+
bodyclass,
|
|
29
|
+
bodyClass = bodyclass ?? '',
|
|
30
|
+
titleclass,
|
|
31
|
+
titleClass = titleclass ?? '',
|
|
32
|
+
footerclass,
|
|
33
|
+
footerClass = footerclass ?? '',
|
|
34
|
+
testId
|
|
26
35
|
}: DrawerProps = $props();
|
|
27
36
|
|
|
37
|
+
warnDeprecatedProps(
|
|
38
|
+
'Drawer',
|
|
39
|
+
{ backdropclass, contentclass, headerclass, bodyclass, titleclass, footerclass },
|
|
40
|
+
{
|
|
41
|
+
backdropclass: 'backdropClass',
|
|
42
|
+
contentclass: 'contentClass',
|
|
43
|
+
headerclass: 'headerClass',
|
|
44
|
+
bodyclass: 'bodyClass',
|
|
45
|
+
titleclass: 'titleClass',
|
|
46
|
+
footerclass: 'footerClass'
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
28
50
|
let drawerElement: HTMLDivElement | undefined = $state();
|
|
29
51
|
|
|
30
52
|
const {
|
|
@@ -35,7 +57,7 @@
|
|
|
35
57
|
header: headerVClass,
|
|
36
58
|
body,
|
|
37
59
|
footer: footerVClass,
|
|
38
|
-
title:
|
|
60
|
+
title: titleVClass,
|
|
39
61
|
closeButton
|
|
40
62
|
} = $derived(
|
|
41
63
|
drawer({
|
|
@@ -45,15 +67,15 @@
|
|
|
45
67
|
})
|
|
46
68
|
);
|
|
47
69
|
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const titleClasses = $derived(cn(
|
|
70
|
+
const baseClasses = $derived(cn(base(), className));
|
|
71
|
+
const backdropClasses = $derived(cn(backdrop(), backdropClass));
|
|
72
|
+
const contentWrapperClasses = $derived(cn(contentWrapper(), contentClass));
|
|
73
|
+
const contentClasses = $derived(cn(content(), ''));
|
|
74
|
+
const headerClasses = $derived(cn(headerVClass(), headerClass));
|
|
75
|
+
const bodyClasses = $derived(cn(body(), bodyClass));
|
|
76
|
+
const titleClasses = $derived(cn(titleVClass(), titleClass));
|
|
55
77
|
const closeButtonClasses = $derived(cn(closeButton(), ''));
|
|
56
|
-
const
|
|
78
|
+
const footerClasses = $derived(cn(footerVClass(), 'mt-auto', footerClass));
|
|
57
79
|
|
|
58
80
|
function handleBackdropClick(e: MouseEvent) {
|
|
59
81
|
if (e.target === e.currentTarget) {
|
|
@@ -156,7 +178,7 @@
|
|
|
156
178
|
|
|
157
179
|
{#if browser}
|
|
158
180
|
<div
|
|
159
|
-
class={
|
|
181
|
+
class={baseClasses}
|
|
160
182
|
bind:this={drawerElement}
|
|
161
183
|
role="dialog"
|
|
162
184
|
aria-modal="true"
|
|
@@ -165,29 +187,41 @@
|
|
|
165
187
|
{#key open}
|
|
166
188
|
<!-- Backdrop -->
|
|
167
189
|
<button
|
|
168
|
-
class={
|
|
190
|
+
class={backdropClasses}
|
|
169
191
|
onclick={handleBackdropClick}
|
|
170
192
|
transition:fade={{ duration: 200 }}
|
|
171
193
|
aria-label="Close drawer"
|
|
194
|
+
data-testid={buildTestId('drawer', 'backdrop', testId)}
|
|
172
195
|
></button>
|
|
173
196
|
|
|
174
197
|
<!-- Drawer content -->
|
|
175
|
-
<div
|
|
176
|
-
|
|
198
|
+
<div
|
|
199
|
+
class={contentWrapperClasses}
|
|
200
|
+
transition:fly={getTransition()}
|
|
201
|
+
data-testid={buildTestId('drawer', 'dialog', testId)}
|
|
202
|
+
>
|
|
203
|
+
<div class={contentClasses}>
|
|
177
204
|
<!-- Header -->
|
|
178
205
|
{#if header || title}
|
|
179
|
-
<div class={
|
|
206
|
+
<div class={headerClasses}>
|
|
180
207
|
{#if header}
|
|
181
208
|
{@render header()}
|
|
182
209
|
{:else}
|
|
183
210
|
{#if title}
|
|
184
|
-
<h3
|
|
211
|
+
<h3
|
|
212
|
+
id="drawer-title"
|
|
213
|
+
class={titleClasses}
|
|
214
|
+
data-testid={buildTestId('drawer', 'title', testId)}
|
|
215
|
+
>
|
|
216
|
+
{title}
|
|
217
|
+
</h3>
|
|
185
218
|
{/if}
|
|
186
219
|
<button
|
|
187
220
|
type="button"
|
|
188
221
|
class={closeButtonClasses}
|
|
189
222
|
onclick={handleCloseClick}
|
|
190
223
|
aria-label="Close drawer"
|
|
224
|
+
data-testid={buildTestId('drawer', 'close', testId)}
|
|
191
225
|
>
|
|
192
226
|
<svg
|
|
193
227
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -205,7 +239,7 @@
|
|
|
205
239
|
</div>
|
|
206
240
|
{/if}
|
|
207
241
|
|
|
208
|
-
<div class={
|
|
242
|
+
<div class={bodyClasses} data-testid={buildTestId('drawer', 'body', testId)}>
|
|
209
243
|
{#if children}
|
|
210
244
|
{@render children()}
|
|
211
245
|
{/if}
|
|
@@ -213,7 +247,7 @@
|
|
|
213
247
|
|
|
214
248
|
<!-- Add footer section -->
|
|
215
249
|
{#if footer}
|
|
216
|
-
<div class={
|
|
250
|
+
<div class={footerClasses}>
|
|
217
251
|
{@render footer()}
|
|
218
252
|
</div>
|
|
219
253
|
{/if}
|
package/dist/drawer/drawer.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Size } from '../variants.js';
|
|
2
1
|
export declare const drawer: import("tailwind-variants").TVReturnType<{
|
|
3
2
|
open: {
|
|
4
3
|
true: {
|
|
@@ -23,22 +22,22 @@ export declare const drawer: import("tailwind-variants").TVReturnType<{
|
|
|
23
22
|
};
|
|
24
23
|
};
|
|
25
24
|
size: {
|
|
26
|
-
|
|
25
|
+
xs: {
|
|
27
26
|
contentWrapper: string;
|
|
28
27
|
};
|
|
29
|
-
|
|
28
|
+
sm: {
|
|
30
29
|
contentWrapper: string;
|
|
31
30
|
};
|
|
32
|
-
|
|
31
|
+
base: {
|
|
33
32
|
contentWrapper: string;
|
|
34
33
|
};
|
|
35
|
-
|
|
34
|
+
lg: {
|
|
36
35
|
contentWrapper: string;
|
|
37
36
|
};
|
|
38
|
-
|
|
37
|
+
xl: {
|
|
39
38
|
contentWrapper: string;
|
|
40
39
|
};
|
|
41
|
-
|
|
40
|
+
"2xl": {
|
|
42
41
|
contentWrapper: string;
|
|
43
42
|
};
|
|
44
43
|
};
|
|
@@ -76,22 +75,22 @@ export declare const drawer: import("tailwind-variants").TVReturnType<{
|
|
|
76
75
|
};
|
|
77
76
|
};
|
|
78
77
|
size: {
|
|
79
|
-
|
|
78
|
+
xs: {
|
|
80
79
|
contentWrapper: string;
|
|
81
80
|
};
|
|
82
|
-
|
|
81
|
+
sm: {
|
|
83
82
|
contentWrapper: string;
|
|
84
83
|
};
|
|
85
|
-
|
|
84
|
+
base: {
|
|
86
85
|
contentWrapper: string;
|
|
87
86
|
};
|
|
88
|
-
|
|
87
|
+
lg: {
|
|
89
88
|
contentWrapper: string;
|
|
90
89
|
};
|
|
91
|
-
|
|
90
|
+
xl: {
|
|
92
91
|
contentWrapper: string;
|
|
93
92
|
};
|
|
94
|
-
|
|
93
|
+
"2xl": {
|
|
95
94
|
contentWrapper: string;
|
|
96
95
|
};
|
|
97
96
|
};
|
|
@@ -129,22 +128,22 @@ export declare const drawer: import("tailwind-variants").TVReturnType<{
|
|
|
129
128
|
};
|
|
130
129
|
};
|
|
131
130
|
size: {
|
|
132
|
-
|
|
131
|
+
xs: {
|
|
133
132
|
contentWrapper: string;
|
|
134
133
|
};
|
|
135
|
-
|
|
134
|
+
sm: {
|
|
136
135
|
contentWrapper: string;
|
|
137
136
|
};
|
|
138
|
-
|
|
137
|
+
base: {
|
|
139
138
|
contentWrapper: string;
|
|
140
139
|
};
|
|
141
|
-
|
|
140
|
+
lg: {
|
|
142
141
|
contentWrapper: string;
|
|
143
142
|
};
|
|
144
|
-
|
|
143
|
+
xl: {
|
|
145
144
|
contentWrapper: string;
|
|
146
145
|
};
|
|
147
|
-
|
|
146
|
+
"2xl": {
|
|
148
147
|
contentWrapper: string;
|
|
149
148
|
};
|
|
150
149
|
};
|