@makolabs/ripple 1.8.0 → 1.9.1
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/ai/ai-types.d.ts +44 -0
- package/dist/ai/ai-types.js +1 -0
- package/dist/button/button-types.d.ts +25 -0
- package/dist/button/button-types.js +1 -0
- package/dist/charts/Chart.svelte +7 -22
- package/dist/charts/chart-types.d.ts +137 -0
- package/dist/charts/chart-types.js +1 -0
- package/dist/drawer/drawer-types.d.ts +33 -0
- package/dist/drawer/drawer-types.js +1 -0
- package/dist/elements/accordion/accordion-types.d.ts +29 -0
- package/dist/elements/accordion/accordion-types.js +1 -0
- package/dist/elements/badge/badge-types.d.ts +11 -0
- package/dist/elements/badge/badge-types.js +1 -0
- package/dist/elements/dropdown/dropdown-types.d.ts +68 -0
- package/dist/elements/dropdown/dropdown-types.js +1 -0
- 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/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/Input.svelte +4 -2
- package/dist/forms/form-types.d.ts +168 -0
- package/dist/forms/form-types.js +1 -0
- package/dist/header/header-types.d.ts +43 -0
- package/dist/header/header-types.js +1 -0
- package/dist/index.d.ts +35 -1105
- package/dist/index.js +37 -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/card/card-types.d.ts +43 -0
- package/dist/layout/card/card-types.js +1 -0
- package/dist/layout/card/metric-card.d.ts +3 -3
- package/dist/layout/navbar/navbar-types.d.ts +19 -0
- package/dist/layout/navbar/navbar-types.js +1 -0
- package/dist/layout/sidebar/Sidebar.svelte +10 -1
- package/dist/layout/sidebar/sidebar-types.d.ts +63 -0
- package/dist/layout/sidebar/sidebar-types.js +1 -0
- package/dist/layout/table/table-types.d.ts +82 -0
- package/dist/layout/table/table-types.js +1 -0
- package/dist/layout/tabs/tabs-types.d.ts +43 -0
- package/dist/layout/tabs/tabs-types.js +1 -0
- package/dist/modal/modal-types.d.ts +34 -0
- package/dist/modal/modal-types.js +1 -0
- package/dist/types/echarts.d.ts +27 -0
- package/dist/user-management/user-management-types.d.ts +156 -0
- package/dist/user-management/user-management-types.js +1 -0
- package/package.json +1 -2
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.
|
|
@@ -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 {};
|
|
@@ -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/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,7 +95,6 @@
|
|
|
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;
|
|
113
100
|
let resizeTimeoutId: ReturnType<typeof setTimeout>;
|
|
@@ -287,8 +274,8 @@
|
|
|
287
274
|
label: {
|
|
288
275
|
show: seriesConfig.showLabel || false,
|
|
289
276
|
position: actualType === 'line' ? 'top' : 'inside',
|
|
290
|
-
//
|
|
291
|
-
formatter: (params) => {
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
278
|
+
formatter: (params: any) => {
|
|
292
279
|
const yAxisIndex = seriesConfig.yAxisIndex || 0;
|
|
293
280
|
const axisConfig = yAxis[yAxisIndex];
|
|
294
281
|
return formatValue(params.value, axisConfig.format, axisConfig.unit);
|
|
@@ -375,8 +362,8 @@
|
|
|
375
362
|
// Add center text if specified in the first pie series
|
|
376
363
|
const pieSeriesWithCenterText = series.find((s) => s.type === 'pie' && s.centerText);
|
|
377
364
|
if (pieSeriesWithCenterText?.centerText) {
|
|
378
|
-
//
|
|
379
|
-
pieOptions.graphic = {
|
|
365
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
366
|
+
(pieOptions as any).graphic = {
|
|
380
367
|
elements: [
|
|
381
368
|
{
|
|
382
369
|
type: 'text',
|
|
@@ -464,8 +451,8 @@
|
|
|
464
451
|
show: false
|
|
465
452
|
},
|
|
466
453
|
axisLabel: {
|
|
467
|
-
//
|
|
468
|
-
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)
|
|
469
456
|
},
|
|
470
457
|
splitLine: {
|
|
471
458
|
show: index === 0 ? grid.horizontal || true : false
|
|
@@ -503,7 +490,6 @@
|
|
|
503
490
|
}
|
|
504
491
|
|
|
505
492
|
onMount(() => {
|
|
506
|
-
// @ts-expect-error - ECharts types are not available
|
|
507
493
|
chart = echarts.init(chartContainer, theme);
|
|
508
494
|
|
|
509
495
|
// Instantly triggering resizes disables animation, hence the timeout
|
|
@@ -516,8 +502,7 @@
|
|
|
516
502
|
}, AnimationDuration);
|
|
517
503
|
|
|
518
504
|
updateChart();
|
|
519
|
-
|
|
520
|
-
chart.on('click', (params) => {
|
|
505
|
+
chart.on('click', (params: echarts.ECElementEvent) => {
|
|
521
506
|
if (onpointclick) {
|
|
522
507
|
onpointclick({
|
|
523
508
|
detail: {
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { ECharts } from 'echarts/types/src/export/core.js';
|
|
3
|
+
import { ChartColor } from '../variants.js';
|
|
4
|
+
export type ChartColorKey = keyof typeof ChartColor;
|
|
5
|
+
export type ChartColorValue = (typeof ChartColor)[ChartColorKey];
|
|
6
|
+
export type ChartColors = {
|
|
7
|
+
[K in ChartColorValue]: string;
|
|
8
|
+
};
|
|
9
|
+
export type ChartType = 'line' | 'bar' | 'horizontal-bar' | 'pie' | 'stacked-bar';
|
|
10
|
+
export type ChartColorString = `#${string}` | keyof ChartColors;
|
|
11
|
+
export type XAxisConfig<T> = {
|
|
12
|
+
dataKey: keyof T;
|
|
13
|
+
label?: string;
|
|
14
|
+
format?: (value: any) => string;
|
|
15
|
+
tick?: {
|
|
16
|
+
fontSize?: number;
|
|
17
|
+
rotate?: number;
|
|
18
|
+
interval?: number | 'auto' | Function;
|
|
19
|
+
};
|
|
20
|
+
axisLine?: {
|
|
21
|
+
show?: boolean;
|
|
22
|
+
lineStyle?: {
|
|
23
|
+
color?: string;
|
|
24
|
+
width?: number;
|
|
25
|
+
type?: 'solid' | 'dashed' | 'dotted';
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type YAxisConfig<T> = {
|
|
30
|
+
dataKey: keyof T;
|
|
31
|
+
label?: string;
|
|
32
|
+
format?: (value: any) => string;
|
|
33
|
+
unit?: string;
|
|
34
|
+
position?: 'left' | 'right';
|
|
35
|
+
min?: number;
|
|
36
|
+
max?: number;
|
|
37
|
+
axisLine?: {
|
|
38
|
+
show?: boolean;
|
|
39
|
+
lineStyle?: {
|
|
40
|
+
color?: string;
|
|
41
|
+
width?: number;
|
|
42
|
+
type?: 'solid' | 'dashed' | 'dotted';
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export interface SeriesConfig<T> {
|
|
47
|
+
dataKey: keyof T;
|
|
48
|
+
name?: string;
|
|
49
|
+
type?: ChartType;
|
|
50
|
+
color?: ChartColorString;
|
|
51
|
+
yAxisIndex?: number;
|
|
52
|
+
stack?: string;
|
|
53
|
+
barWidth?: string;
|
|
54
|
+
showArea?: boolean;
|
|
55
|
+
showSymbol?: boolean;
|
|
56
|
+
showLabel?: boolean;
|
|
57
|
+
smooth?: boolean;
|
|
58
|
+
areaOpacity?: number;
|
|
59
|
+
lineWidth?: number;
|
|
60
|
+
opacity?: number;
|
|
61
|
+
lineStyle?: {
|
|
62
|
+
type?: 'solid' | 'dashed' | 'dotted';
|
|
63
|
+
width?: number;
|
|
64
|
+
color?: string;
|
|
65
|
+
};
|
|
66
|
+
emphasis?: {
|
|
67
|
+
focus?: 'series' | 'self' | 'none';
|
|
68
|
+
};
|
|
69
|
+
radius?: [string, string];
|
|
70
|
+
centerText?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface GridConfig {
|
|
73
|
+
horizontal?: boolean;
|
|
74
|
+
vertical?: boolean;
|
|
75
|
+
containLabel?: boolean;
|
|
76
|
+
top?: number | string;
|
|
77
|
+
right?: number | string;
|
|
78
|
+
bottom?: number | string;
|
|
79
|
+
left?: number | string;
|
|
80
|
+
}
|
|
81
|
+
export interface LegendConfig {
|
|
82
|
+
show?: boolean;
|
|
83
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
84
|
+
orient?: 'horizontal' | 'vertical';
|
|
85
|
+
}
|
|
86
|
+
export interface TooltipConfig {
|
|
87
|
+
show?: boolean;
|
|
88
|
+
trigger?: 'item' | 'axis' | 'none';
|
|
89
|
+
formatter?: string | ((params: any) => string);
|
|
90
|
+
}
|
|
91
|
+
export interface ToolboxConfig {
|
|
92
|
+
show?: boolean;
|
|
93
|
+
features?: {
|
|
94
|
+
saveAsImage?: boolean;
|
|
95
|
+
dataView?: boolean;
|
|
96
|
+
dataZoom?: boolean;
|
|
97
|
+
magicType?: boolean;
|
|
98
|
+
restore?: boolean;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export type ChartConfig<T> = {
|
|
102
|
+
xAxis: XAxisConfig<T>;
|
|
103
|
+
yAxis: YAxisConfig<T>[];
|
|
104
|
+
series: SeriesConfig<T>[];
|
|
105
|
+
grid?: GridConfig;
|
|
106
|
+
legend?: LegendConfig;
|
|
107
|
+
tooltip?: TooltipConfig;
|
|
108
|
+
toolbox?: ToolboxConfig;
|
|
109
|
+
showAxisLines?: boolean;
|
|
110
|
+
};
|
|
111
|
+
export interface PointClickType<T> {
|
|
112
|
+
detail: {
|
|
113
|
+
seriesIndex: number;
|
|
114
|
+
dataIndex: number;
|
|
115
|
+
seriesName: string;
|
|
116
|
+
name: string;
|
|
117
|
+
value?: number | string | null;
|
|
118
|
+
originalData: T;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export interface ChartRenderType<T> {
|
|
122
|
+
detail: {
|
|
123
|
+
chart: ECharts;
|
|
124
|
+
options: ChartConfig<T>;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export interface ChartProps<T> {
|
|
128
|
+
data: T[];
|
|
129
|
+
config: ChartConfig<T>;
|
|
130
|
+
colors?: Partial<ChartColors>;
|
|
131
|
+
height?: string;
|
|
132
|
+
width?: string;
|
|
133
|
+
class?: ClassValue;
|
|
134
|
+
onpointclick?: (event: PointClickType<T>) => void;
|
|
135
|
+
onchartrender?: (event: ChartRenderType<T>) => void;
|
|
136
|
+
testId?: string;
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ChartColor } from '../variants.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { VariantSizes } from '../index.js';
|
|
4
|
+
export type DrawerProps = {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
onclose?: () => void;
|
|
7
|
+
title?: string;
|
|
8
|
+
position?: 'left' | 'right';
|
|
9
|
+
size?: VariantSizes;
|
|
10
|
+
class?: ClassValue;
|
|
11
|
+
/** @deprecated Use backdropClass instead */
|
|
12
|
+
backdropclass?: ClassValue;
|
|
13
|
+
backdropClass?: ClassValue;
|
|
14
|
+
/** @deprecated Use contentClass instead */
|
|
15
|
+
contentclass?: ClassValue;
|
|
16
|
+
contentClass?: ClassValue;
|
|
17
|
+
/** @deprecated Use headerClass instead */
|
|
18
|
+
headerclass?: ClassValue;
|
|
19
|
+
headerClass?: ClassValue;
|
|
20
|
+
/** @deprecated Use bodyClass instead */
|
|
21
|
+
bodyclass?: ClassValue;
|
|
22
|
+
bodyClass?: ClassValue;
|
|
23
|
+
/** @deprecated Use titleClass instead */
|
|
24
|
+
titleclass?: ClassValue;
|
|
25
|
+
titleClass?: ClassValue;
|
|
26
|
+
/** @deprecated Use footerClass instead */
|
|
27
|
+
footerclass?: ClassValue;
|
|
28
|
+
footerClass?: ClassValue;
|
|
29
|
+
children?: Snippet;
|
|
30
|
+
header?: Snippet;
|
|
31
|
+
footer?: Snippet;
|
|
32
|
+
testId?: string;
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Component } from 'svelte';
|
|
4
|
+
import type { VariantColors } from '../../index.js';
|
|
5
|
+
export type AccordionProps = {
|
|
6
|
+
id?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
summary?: Snippet;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
color?: VariantColors;
|
|
13
|
+
class?: ClassValue;
|
|
14
|
+
/** @deprecated Use titleClass instead */
|
|
15
|
+
titleclass?: ClassValue;
|
|
16
|
+
titleClass?: ClassValue;
|
|
17
|
+
/** @deprecated Use bodyClass instead */
|
|
18
|
+
bodyclass?: ClassValue;
|
|
19
|
+
bodyClass?: ClassValue;
|
|
20
|
+
/** @deprecated Use headerClass instead */
|
|
21
|
+
headerclass?: ClassValue;
|
|
22
|
+
headerClass?: ClassValue;
|
|
23
|
+
icon?: Component;
|
|
24
|
+
iconPosition?: 'start' | 'end';
|
|
25
|
+
bordered?: boolean;
|
|
26
|
+
onexpand?: () => void;
|
|
27
|
+
oncollapse?: () => void;
|
|
28
|
+
testId?: string;
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { VariantColors, VariantSizes } from '../../index.js';
|
|
4
|
+
export type BadgeProps = {
|
|
5
|
+
size?: VariantSizes;
|
|
6
|
+
color?: VariantColors;
|
|
7
|
+
class?: ClassValue;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
onclose?: (event: MouseEvent) => void;
|
|
10
|
+
testId?: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Component } from 'svelte';
|
|
4
|
+
import type { VariantSizes } from '../../index.js';
|
|
5
|
+
export type DropdownItem = {
|
|
6
|
+
label: string;
|
|
7
|
+
href?: `/${string}`;
|
|
8
|
+
icon?: Component;
|
|
9
|
+
onclick?: () => void;
|
|
10
|
+
active?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type DropSection = {
|
|
13
|
+
items: DropdownItem[];
|
|
14
|
+
};
|
|
15
|
+
export type DropHeaderConfig = {
|
|
16
|
+
title?: string;
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
content?: Snippet<[]>;
|
|
19
|
+
class?: ClassValue;
|
|
20
|
+
titleClass?: ClassValue;
|
|
21
|
+
subtitleClass?: ClassValue;
|
|
22
|
+
onclick?: () => void;
|
|
23
|
+
};
|
|
24
|
+
export type DropdownMenuProps = {
|
|
25
|
+
open?: boolean;
|
|
26
|
+
sections: DropSection[];
|
|
27
|
+
label?: string;
|
|
28
|
+
icon?: Component;
|
|
29
|
+
containerClass?: ClassValue;
|
|
30
|
+
itemClass?: ClassValue;
|
|
31
|
+
class?: ClassValue;
|
|
32
|
+
size?: VariantSizes;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
35
|
+
width?: string;
|
|
36
|
+
header?: DropHeaderConfig;
|
|
37
|
+
testId?: string;
|
|
38
|
+
};
|
|
39
|
+
export type SelectItem = {
|
|
40
|
+
label: string;
|
|
41
|
+
value: string;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
icon?: Component;
|
|
44
|
+
};
|
|
45
|
+
export type SelectProps = {
|
|
46
|
+
items: SelectItem[];
|
|
47
|
+
value?: string | string[];
|
|
48
|
+
multiple?: boolean;
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
searchable?: boolean;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
size?: VariantSizes;
|
|
53
|
+
class?: ClassValue;
|
|
54
|
+
containerClass?: ClassValue;
|
|
55
|
+
listClass?: ClassValue;
|
|
56
|
+
itemClass?: ClassValue;
|
|
57
|
+
triggerClass?: ClassValue;
|
|
58
|
+
searchInputClass?: ClassValue;
|
|
59
|
+
clearable?: boolean;
|
|
60
|
+
icon?: Component;
|
|
61
|
+
iconClass?: ClassValue;
|
|
62
|
+
onselect?: ({ value }: {
|
|
63
|
+
value: string | string[];
|
|
64
|
+
}) => void;
|
|
65
|
+
onopen?: () => void;
|
|
66
|
+
onclose?: () => void;
|
|
67
|
+
testId?: string;
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export interface FileUploadProps {
|
|
4
|
+
/**
|
|
5
|
+
* Array of allowed file MIME types or extensions
|
|
6
|
+
* @example ['image/jpeg', 'image/png']
|
|
7
|
+
*/
|
|
8
|
+
allowedMimeTypes?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Maximum file size in bytes
|
|
11
|
+
*/
|
|
12
|
+
maxSize?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Maximum number of files that can be uploaded; maxFiles<=0 is disabled, maxFiles=1 is singular, maxFiles>1 is multiple
|
|
15
|
+
* @default 10
|
|
16
|
+
*/
|
|
17
|
+
maxFiles?: number;
|
|
18
|
+
/**
|
|
19
|
+
* CSS class for the component container
|
|
20
|
+
*/
|
|
21
|
+
class?: ClassValue;
|
|
22
|
+
/**
|
|
23
|
+
* CSS class for the dropzone
|
|
24
|
+
*/
|
|
25
|
+
dropzoneClass?: ClassValue;
|
|
26
|
+
/**
|
|
27
|
+
* ID for the file input element
|
|
28
|
+
* @default 'file-upload'
|
|
29
|
+
*/
|
|
30
|
+
id?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Callback when files are selected or dropped
|
|
33
|
+
*/
|
|
34
|
+
onfiles?: (files: FileList | File[]) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Content to display when no files are uploaded
|
|
37
|
+
*/
|
|
38
|
+
uploadContent?: Snippet;
|
|
39
|
+
testId?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface FilePreviewProps {
|
|
42
|
+
files: UploadedFile[];
|
|
43
|
+
ondelete?: (fileId: string, index: number) => void;
|
|
44
|
+
class?: ClassValue;
|
|
45
|
+
testId?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface UploadedFile {
|
|
48
|
+
FileID: string;
|
|
49
|
+
OriginalFilename: string;
|
|
50
|
+
Size: number;
|
|
51
|
+
ContentType: string;
|
|
52
|
+
MD5Hash: string;
|
|
53
|
+
UploadTimestamp: string;
|
|
54
|
+
Expiry?: string;
|
|
55
|
+
CustomMetadata?: Record<string, string>;
|
|
56
|
+
/**
|
|
57
|
+
* Current status of the file
|
|
58
|
+
*/
|
|
59
|
+
status: 'uploading' | 'success' | 'error';
|
|
60
|
+
/**
|
|
61
|
+
* Upload progress (0-100)
|
|
62
|
+
*/
|
|
63
|
+
progress?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Error message if upload failed
|
|
66
|
+
*/
|
|
67
|
+
error?: string;
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { VariantColors, VariantSizes } from '../../index.js';
|
|
3
|
+
export type ProgressSegment = {
|
|
4
|
+
value: number;
|
|
5
|
+
color: VariantColors;
|
|
6
|
+
label?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ProgressProps = {
|
|
9
|
+
value: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
size?: VariantSizes;
|
|
12
|
+
color?: VariantColors;
|
|
13
|
+
showLabel?: boolean;
|
|
14
|
+
labelPosition?: 'top' | 'bottom' | 'right';
|
|
15
|
+
segments?: ProgressSegment[];
|
|
16
|
+
showLabels?: boolean;
|
|
17
|
+
showValues?: boolean;
|
|
18
|
+
class?: ClassValue;
|
|
19
|
+
labelClass?: ClassValue;
|
|
20
|
+
barClass?: ClassValue;
|
|
21
|
+
testId?: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
export type FilterTab = {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
export type FilterGroup = {
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
tabs: FilterTab[];
|
|
11
|
+
selectedValue: string;
|
|
12
|
+
onChange: (value: string) => void;
|
|
13
|
+
minWidth?: string;
|
|
14
|
+
};
|
|
15
|
+
export type CompactFiltersProps = {
|
|
16
|
+
filterGroups: FilterGroup[];
|
|
17
|
+
isExpanded?: boolean;
|
|
18
|
+
title?: string;
|
|
19
|
+
class?: ClassValue;
|
|
20
|
+
summaryClass?: ClassValue;
|
|
21
|
+
expandedClass?: ClassValue;
|
|
22
|
+
FilterIcon?: Component;
|
|
23
|
+
testId?: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/forms/Input.svelte
CHANGED
|
@@ -49,7 +49,9 @@
|
|
|
49
49
|
disabled,
|
|
50
50
|
class: inputClasses,
|
|
51
51
|
'aria-invalid': !!errors.length,
|
|
52
|
-
'aria-describedby': errors.length
|
|
52
|
+
'aria-describedby': errors.length
|
|
53
|
+
? errors.map((_, i) => `${name}-error-${i}`).join(' ')
|
|
54
|
+
: undefined
|
|
53
55
|
});
|
|
54
56
|
|
|
55
57
|
const inputProps = $derived({
|
|
@@ -78,7 +80,7 @@
|
|
|
78
80
|
{#if errors.length}
|
|
79
81
|
{#each errors as error, i (i)}
|
|
80
82
|
<p
|
|
81
|
-
id="{name}-
|
|
83
|
+
id="{name}-error-{i}"
|
|
82
84
|
class="text-danger-600 mt-1 text-sm"
|
|
83
85
|
role="alert"
|
|
84
86
|
data-testid={buildTestId('input', 'error', testId, i)}
|