@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.
Files changed (135) hide show
  1. package/README.md +16 -0
  2. package/dist/adapters/ai/OpenAIAdapter.d.ts +8 -1
  3. package/dist/adapters/ai/OpenAIAdapter.js +2 -2
  4. package/dist/adapters/storage/BaseAdapter.js +2 -2
  5. package/dist/adapters/storage/S3Adapter.js +1 -6
  6. package/dist/adapters/storage/types.d.ts +3 -3
  7. package/dist/ai/AIChatInterface.svelte +0 -1
  8. package/dist/ai/ai-chat-interface.d.ts +21 -22
  9. package/dist/ai/ai-types.d.ts +44 -0
  10. package/dist/ai/ai-types.js +1 -0
  11. package/dist/ai/content-detector.js +0 -1
  12. package/dist/button/Button.svelte +9 -2
  13. package/dist/button/button-types.d.ts +25 -0
  14. package/dist/button/button-types.js +1 -0
  15. package/dist/button/button.d.ts +39 -40
  16. package/dist/charts/Chart.svelte +11 -23
  17. package/dist/charts/chart-types.d.ts +137 -0
  18. package/dist/charts/chart-types.js +1 -0
  19. package/dist/drawer/Drawer.svelte +57 -23
  20. package/dist/drawer/drawer-types.d.ts +33 -0
  21. package/dist/drawer/drawer-types.js +1 -0
  22. package/dist/drawer/drawer.d.ts +18 -19
  23. package/dist/elements/accordion/Accordion.svelte +39 -18
  24. package/dist/elements/accordion/accordion-types.d.ts +29 -0
  25. package/dist/elements/accordion/accordion-types.js +1 -0
  26. package/dist/elements/accordion/accordion.d.ts +21 -22
  27. package/dist/elements/alert/Alert.svelte +20 -8
  28. package/dist/elements/badge/Badge.svelte +5 -2
  29. package/dist/elements/badge/badge-types.d.ts +11 -0
  30. package/dist/elements/badge/badge-types.js +1 -0
  31. package/dist/elements/badge/badge.d.ts +39 -40
  32. package/dist/elements/dropdown/Dropdown.svelte +18 -2
  33. package/dist/elements/dropdown/Select.svelte +17 -5
  34. package/dist/elements/dropdown/dropdown-types.d.ts +68 -0
  35. package/dist/elements/dropdown/dropdown-types.js +1 -0
  36. package/dist/elements/dropdown/dropdown.d.ts +18 -19
  37. package/dist/elements/dropdown/select.d.ts +18 -19
  38. package/dist/elements/file-upload/file-upload-types.d.ts +68 -0
  39. package/dist/elements/file-upload/file-upload-types.js +1 -0
  40. package/dist/elements/pagination/Pagination.svelte +15 -2
  41. package/dist/elements/pagination/Pagination.svelte.d.ts +1 -0
  42. package/dist/elements/progress/progress-types.d.ts +22 -0
  43. package/dist/elements/progress/progress-types.js +1 -0
  44. package/dist/elements/timeline/timeline-types.d.ts +11 -0
  45. package/dist/elements/timeline/timeline-types.js +1 -0
  46. package/dist/filters/filter-types.d.ts +24 -0
  47. package/dist/filters/filter-types.js +1 -0
  48. package/dist/forms/Checkbox.svelte +16 -4
  49. package/dist/forms/Form.svelte +0 -2
  50. package/dist/forms/Input.svelte +19 -5
  51. package/dist/forms/NumberInput.svelte +8 -1
  52. package/dist/forms/RadioInputs.svelte +14 -5
  53. package/dist/forms/Slider.svelte +6 -4
  54. package/dist/forms/Toggle.svelte +67 -29
  55. package/dist/forms/form-types.d.ts +168 -0
  56. package/dist/forms/form-types.js +1 -0
  57. package/dist/forms/slider.d.ts +72 -10
  58. package/dist/forms/slider.js +21 -0
  59. package/dist/header/Breadcrumbs.svelte +47 -24
  60. package/dist/header/PageHeader.svelte +12 -2
  61. package/dist/header/breadcrumbs.d.ts +47 -39
  62. package/dist/header/header-types.d.ts +43 -0
  63. package/dist/header/header-types.js +1 -0
  64. package/dist/helper/deprecation.d.ts +14 -0
  65. package/dist/helper/deprecation.js +24 -0
  66. package/dist/helper/testid.d.ts +10 -0
  67. package/dist/helper/testid.js +17 -0
  68. package/dist/index.d.ts +37 -1007
  69. package/dist/index.js +38 -14
  70. package/dist/layout/activity-list/activity-list-types.d.ts +30 -0
  71. package/dist/layout/activity-list/activity-list-types.js +1 -0
  72. package/dist/layout/activity-list/activity-list.d.ts +21 -22
  73. package/dist/layout/card/Card.svelte +19 -5
  74. package/dist/layout/card/card-types.d.ts +43 -0
  75. package/dist/layout/card/card-types.js +1 -0
  76. package/dist/layout/card/card.d.ts +21 -22
  77. package/dist/layout/card/metric-card.d.ts +3 -3
  78. package/dist/layout/card/ranked-card.d.ts +2 -1
  79. package/dist/layout/navbar/Navbar.svelte +14 -16
  80. package/dist/layout/navbar/navbar-types.d.ts +19 -0
  81. package/dist/layout/navbar/navbar-types.js +1 -0
  82. package/dist/layout/navbar/navbar.d.ts +19 -19
  83. package/dist/layout/sidebar/Sidebar.svelte +6 -3
  84. package/dist/layout/sidebar/sidebar-types.d.ts +59 -0
  85. package/dist/layout/sidebar/sidebar-types.js +1 -0
  86. package/dist/layout/table/Table.svelte +237 -303
  87. package/dist/layout/table/table-types.d.ts +82 -0
  88. package/dist/layout/table/table-types.js +1 -0
  89. package/dist/layout/table/table.d.ts +24 -25
  90. package/dist/layout/tabs/Tab.svelte +3 -1
  91. package/dist/layout/tabs/TabGroup.svelte +7 -4
  92. package/dist/layout/tabs/tabs-types.d.ts +43 -0
  93. package/dist/layout/tabs/tabs-types.js +1 -0
  94. package/dist/layout/tabs/tabs.d.ts +39 -40
  95. package/dist/modal/Modal.svelte +124 -21
  96. package/dist/modal/modal-types.d.ts +34 -0
  97. package/dist/modal/modal-types.js +1 -0
  98. package/dist/modal/modal.d.ts +18 -19
  99. package/dist/modal/modal.js +2 -2
  100. package/dist/types/echarts.d.ts +27 -0
  101. package/dist/user-management/UserModal.svelte +1 -1
  102. package/dist/user-management/UserTable.svelte +3 -3
  103. package/dist/user-management/UserViewModal.svelte +2 -2
  104. package/dist/user-management/user-management-types.d.ts +156 -0
  105. package/dist/user-management/user-management-types.js +1 -0
  106. package/dist/variants.d.ts +13 -13
  107. package/package.json +9 -7
  108. package/dist/ai/AIChatInterfaceTestWrapper.svelte +0 -26
  109. package/dist/ai/AIChatInterfaceTestWrapper.svelte.d.ts +0 -17
  110. package/dist/button/ButtonTestWrapper.svelte +0 -10
  111. package/dist/button/ButtonTestWrapper.svelte.d.ts +0 -7
  112. package/dist/drawer/DrawerTestWrapper.svelte +0 -19
  113. package/dist/drawer/DrawerTestWrapper.svelte.d.ts +0 -9
  114. package/dist/elements/accordion/AccordionTestWrapper.svelte +0 -21
  115. package/dist/elements/accordion/AccordionTestWrapper.svelte.d.ts +0 -10
  116. package/dist/elements/badge/BadgeTestWrapper.svelte +0 -14
  117. package/dist/elements/badge/BadgeTestWrapper.svelte.d.ts +0 -9
  118. package/dist/forms/CheckboxTestWrapper.svelte +0 -8
  119. package/dist/forms/CheckboxTestWrapper.svelte.d.ts +0 -4
  120. package/dist/forms/InputTestWrapper.svelte +0 -8
  121. package/dist/forms/InputTestWrapper.svelte.d.ts +0 -4
  122. package/dist/forms/ToggleTestWrapper.svelte +0 -8
  123. package/dist/forms/ToggleTestWrapper.svelte.d.ts +0 -7
  124. package/dist/layout/card/CardTestWrapper.svelte +0 -15
  125. package/dist/layout/card/CardTestWrapper.svelte.d.ts +0 -7
  126. package/dist/modal/ModalTestWrapper.svelte +0 -20
  127. package/dist/modal/ModalTestWrapper.svelte.d.ts +0 -8
  128. package/dist/user-management/UserManagementTestWrapper.svelte +0 -32
  129. package/dist/user-management/UserManagementTestWrapper.svelte.d.ts +0 -12
  130. package/dist/user-management/UserModalTestWrapper.svelte +0 -22
  131. package/dist/user-management/UserModalTestWrapper.svelte.d.ts +0 -7
  132. package/dist/user-management/UserTableTestWrapper.svelte +0 -41
  133. package/dist/user-management/UserTableTestWrapper.svelte.d.ts +0 -7
  134. package/dist/user-management/UserViewModalTestWrapper.svelte +0 -22
  135. 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-4-turbo-preview)
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', // make this configurable
17
- baseUrl: 'https://api.openai.com/v1', // make this configurable
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.contentType === 'insurer_statement' ? options.insurer : null
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/v1/uploads/${importId}`);
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 || 'export/clarkfin/';
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: string): Promise<ImportStatus>;
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
- [Color.DEFAULT]: {
3
+ default: {
5
4
  userMessage: string;
6
5
  sendButton: string;
7
6
  background: string;
8
7
  };
9
- [Color.PRIMARY]: {
8
+ primary: {
10
9
  userMessage: string;
11
10
  sendButton: string;
12
11
  background: string;
13
12
  };
14
- [Color.SECONDARY]: {
13
+ secondary: {
15
14
  userMessage: string;
16
15
  sendButton: string;
17
16
  background: string;
18
17
  };
19
- [Color.SUCCESS]: {
18
+ success: {
20
19
  userMessage: string;
21
20
  sendButton: string;
22
21
  background: string;
23
22
  };
24
- [Color.WARNING]: {
23
+ warning: {
25
24
  userMessage: string;
26
25
  sendButton: string;
27
26
  background: string;
28
27
  };
29
- [Color.DANGER]: {
28
+ danger: {
30
29
  userMessage: string;
31
30
  sendButton: string;
32
31
  background: string;
33
32
  };
34
- [Color.INFO]: {
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
- [Color.DEFAULT]: {
56
+ default: {
58
57
  userMessage: string;
59
58
  sendButton: string;
60
59
  background: string;
61
60
  };
62
- [Color.PRIMARY]: {
61
+ primary: {
63
62
  userMessage: string;
64
63
  sendButton: string;
65
64
  background: string;
66
65
  };
67
- [Color.SECONDARY]: {
66
+ secondary: {
68
67
  userMessage: string;
69
68
  sendButton: string;
70
69
  background: string;
71
70
  };
72
- [Color.SUCCESS]: {
71
+ success: {
73
72
  userMessage: string;
74
73
  sendButton: string;
75
74
  background: string;
76
75
  };
77
- [Color.WARNING]: {
76
+ warning: {
78
77
  userMessage: string;
79
78
  sendButton: string;
80
79
  background: string;
81
80
  };
82
- [Color.DANGER]: {
81
+ danger: {
83
82
  userMessage: string;
84
83
  sendButton: string;
85
84
  background: string;
86
85
  };
87
- [Color.INFO]: {
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
- [Color.DEFAULT]: {
109
+ default: {
111
110
  userMessage: string;
112
111
  sendButton: string;
113
112
  background: string;
114
113
  };
115
- [Color.PRIMARY]: {
114
+ primary: {
116
115
  userMessage: string;
117
116
  sendButton: string;
118
117
  background: string;
119
118
  };
120
- [Color.SECONDARY]: {
119
+ secondary: {
121
120
  userMessage: string;
122
121
  sendButton: string;
123
122
  background: string;
124
123
  };
125
- [Color.SUCCESS]: {
124
+ success: {
126
125
  userMessage: string;
127
126
  sendButton: string;
128
127
  background: string;
129
128
  };
130
- [Color.WARNING]: {
129
+ warning: {
131
130
  userMessage: string;
132
131
  sendButton: string;
133
132
  background: string;
134
133
  };
135
- [Color.DANGER]: {
134
+ danger: {
136
135
  userMessage: string;
137
136
  sendButton: string;
138
137
  background: string;
139
138
  };
140
- [Color.INFO]: {
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 class={buttonClasses} disabled={disabled || isLoading} {...restProps}>
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 {};
@@ -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
- [Color.DEFAULT]: string;
11
- [Color.PRIMARY]: string;
12
- [Color.SECONDARY]: string;
13
- [Color.INFO]: string;
14
- [Color.SUCCESS]: string;
15
- [Color.WARNING]: string;
16
- [Color.DANGER]: string;
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
- [Size.XS]: string;
20
- [Size.SM]: string;
21
- [Size.BASE]: string;
22
- [Size.LG]: string;
23
- [Size.XL]: string;
24
- [Size.XXL]: string;
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
- [Color.DEFAULT]: string;
48
- [Color.PRIMARY]: string;
49
- [Color.SECONDARY]: string;
50
- [Color.INFO]: string;
51
- [Color.SUCCESS]: string;
52
- [Color.WARNING]: string;
53
- [Color.DANGER]: string;
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
- [Size.XS]: string;
57
- [Size.SM]: string;
58
- [Size.BASE]: string;
59
- [Size.LG]: string;
60
- [Size.XL]: string;
61
- [Size.XXL]: string;
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
- [Color.DEFAULT]: string;
85
- [Color.PRIMARY]: string;
86
- [Color.SECONDARY]: string;
87
- [Color.INFO]: string;
88
- [Color.SUCCESS]: string;
89
- [Color.WARNING]: string;
90
- [Color.DANGER]: string;
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
- [Size.XS]: string;
94
- [Size.SM]: string;
95
- [Size.BASE]: string;
96
- [Size.LG]: string;
97
- [Size.XL]: string;
98
- [Size.XXL]: string;
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;
@@ -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
- // @ts-expect-error - ECharts types are not available
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
- // @ts-expect-error - ECharts types are not available
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
- // @ts-expect-error - ECharts types are not available
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
- // @ts-expect-error - ECharts types are not available
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
  });