@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
|
@@ -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';
|
|
@@ -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}
|
|
@@ -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 {};
|
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
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { cn } from '../../helper/cls.js';
|
|
3
|
+
import { buildTestId } from '../../helper/testid.js';
|
|
4
|
+
import { warnDeprecatedProps } from '../../helper/deprecation.js';
|
|
3
5
|
import { accordion } from './accordion.js';
|
|
4
6
|
import type { AccordionProps } from '../../index.js';
|
|
5
7
|
|
|
@@ -13,22 +15,36 @@
|
|
|
13
15
|
onexpand,
|
|
14
16
|
oncollapse,
|
|
15
17
|
class: className,
|
|
18
|
+
titleclass,
|
|
19
|
+
titleClass = titleclass ?? '',
|
|
20
|
+
bodyclass,
|
|
21
|
+
bodyClass = bodyclass ?? '',
|
|
22
|
+
headerclass,
|
|
23
|
+
headerClass = headerclass ?? '',
|
|
16
24
|
summary,
|
|
17
25
|
children,
|
|
18
|
-
icon: Icon
|
|
26
|
+
icon: Icon,
|
|
27
|
+
testId
|
|
19
28
|
}: AccordionProps = $props();
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
warnDeprecatedProps(
|
|
31
|
+
'Accordion',
|
|
32
|
+
{ titleclass, bodyclass, headerclass },
|
|
33
|
+
{
|
|
34
|
+
titleclass: 'titleClass',
|
|
35
|
+
bodyclass: 'bodyClass',
|
|
36
|
+
headerclass: 'headerClass'
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const styles = $derived(
|
|
41
|
+
accordion({
|
|
42
|
+
color,
|
|
43
|
+
open,
|
|
44
|
+
bordered,
|
|
45
|
+
hasChildren: !!children
|
|
46
|
+
})
|
|
47
|
+
);
|
|
32
48
|
|
|
33
49
|
function handleClick() {
|
|
34
50
|
if (!children) return; // Don't toggle if no children
|
|
@@ -40,16 +56,17 @@
|
|
|
40
56
|
}
|
|
41
57
|
}
|
|
42
58
|
|
|
43
|
-
const baseClasses = $derived(
|
|
59
|
+
const baseClasses = $derived(cn(styles.base(), className));
|
|
44
60
|
</script>
|
|
45
61
|
|
|
46
62
|
<div class={baseClasses}>
|
|
47
63
|
{#if children}
|
|
48
64
|
<button
|
|
49
|
-
class={
|
|
65
|
+
class={cn(styles.header(), 'flex gap-3', headerClass)}
|
|
50
66
|
aria-expanded={open}
|
|
51
67
|
aria-controls={id}
|
|
52
68
|
onclick={handleClick}
|
|
69
|
+
data-testid={buildTestId('accordion', 'trigger', testId)}
|
|
53
70
|
>
|
|
54
71
|
{@render accordionHeaderContent()}
|
|
55
72
|
<div class="flex items-center">
|
|
@@ -69,12 +86,16 @@
|
|
|
69
86
|
</div>
|
|
70
87
|
</button>
|
|
71
88
|
{#if open}
|
|
72
|
-
<div
|
|
89
|
+
<div
|
|
90
|
+
class={cn(styles.body(), bodyClass)}
|
|
91
|
+
{id}
|
|
92
|
+
data-testid={buildTestId('accordion', 'content', testId)}
|
|
93
|
+
>
|
|
73
94
|
{@render children()}
|
|
74
95
|
</div>
|
|
75
96
|
{/if}
|
|
76
97
|
{:else}
|
|
77
|
-
<div class={
|
|
98
|
+
<div class={cn(styles.header(), 'flex gap-3', headerClass)}>
|
|
78
99
|
{@render accordionHeaderContent()}
|
|
79
100
|
</div>
|
|
80
101
|
{/if}
|
|
@@ -87,7 +108,7 @@
|
|
|
87
108
|
{/if}
|
|
88
109
|
<div class="flex flex-col items-start text-left">
|
|
89
110
|
{#if title}
|
|
90
|
-
<h3 class={
|
|
111
|
+
<h3 class={cn(styles.title(), titleClass)}>{title}</h3>
|
|
91
112
|
{/if}
|
|
92
113
|
{#if description}
|
|
93
114
|
<p class="text-default-500 text-xs whitespace-nowrap">{description}</p>
|
|
@@ -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 {};
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import { Color } from '../../variants.js';
|
|
2
1
|
export declare const accordion: import("tailwind-variants").TVReturnType<{
|
|
3
2
|
color: {
|
|
4
|
-
|
|
3
|
+
default: {
|
|
5
4
|
base: string;
|
|
6
5
|
header: string;
|
|
7
6
|
body: string;
|
|
8
7
|
};
|
|
9
|
-
|
|
8
|
+
primary: {
|
|
10
9
|
base: string;
|
|
11
10
|
header: string;
|
|
12
11
|
title: string;
|
|
13
12
|
};
|
|
14
|
-
|
|
13
|
+
secondary: {
|
|
15
14
|
base: string;
|
|
16
15
|
header: string;
|
|
17
16
|
title: string;
|
|
18
17
|
};
|
|
19
|
-
|
|
18
|
+
success: {
|
|
20
19
|
base: string;
|
|
21
20
|
header: string;
|
|
22
21
|
title: string;
|
|
23
22
|
};
|
|
24
|
-
|
|
23
|
+
warning: {
|
|
25
24
|
base: string;
|
|
26
25
|
header: string;
|
|
27
26
|
title: string;
|
|
28
27
|
};
|
|
29
|
-
|
|
28
|
+
danger: {
|
|
30
29
|
base: string;
|
|
31
30
|
header: string;
|
|
32
31
|
title: string;
|
|
33
32
|
};
|
|
34
|
-
|
|
33
|
+
info: {
|
|
35
34
|
base: string;
|
|
36
35
|
header: string;
|
|
37
36
|
title: string;
|
|
@@ -76,37 +75,37 @@ export declare const accordion: import("tailwind-variants").TVReturnType<{
|
|
|
76
75
|
body: string;
|
|
77
76
|
}, undefined, {
|
|
78
77
|
color: {
|
|
79
|
-
|
|
78
|
+
default: {
|
|
80
79
|
base: string;
|
|
81
80
|
header: string;
|
|
82
81
|
body: string;
|
|
83
82
|
};
|
|
84
|
-
|
|
83
|
+
primary: {
|
|
85
84
|
base: string;
|
|
86
85
|
header: string;
|
|
87
86
|
title: string;
|
|
88
87
|
};
|
|
89
|
-
|
|
88
|
+
secondary: {
|
|
90
89
|
base: string;
|
|
91
90
|
header: string;
|
|
92
91
|
title: string;
|
|
93
92
|
};
|
|
94
|
-
|
|
93
|
+
success: {
|
|
95
94
|
base: string;
|
|
96
95
|
header: string;
|
|
97
96
|
title: string;
|
|
98
97
|
};
|
|
99
|
-
|
|
98
|
+
warning: {
|
|
100
99
|
base: string;
|
|
101
100
|
header: string;
|
|
102
101
|
title: string;
|
|
103
102
|
};
|
|
104
|
-
|
|
103
|
+
danger: {
|
|
105
104
|
base: string;
|
|
106
105
|
header: string;
|
|
107
106
|
title: string;
|
|
108
107
|
};
|
|
109
|
-
|
|
108
|
+
info: {
|
|
110
109
|
base: string;
|
|
111
110
|
header: string;
|
|
112
111
|
title: string;
|
|
@@ -151,37 +150,37 @@ export declare const accordion: import("tailwind-variants").TVReturnType<{
|
|
|
151
150
|
body: string;
|
|
152
151
|
}, import("tailwind-variants").TVReturnType<{
|
|
153
152
|
color: {
|
|
154
|
-
|
|
153
|
+
default: {
|
|
155
154
|
base: string;
|
|
156
155
|
header: string;
|
|
157
156
|
body: string;
|
|
158
157
|
};
|
|
159
|
-
|
|
158
|
+
primary: {
|
|
160
159
|
base: string;
|
|
161
160
|
header: string;
|
|
162
161
|
title: string;
|
|
163
162
|
};
|
|
164
|
-
|
|
163
|
+
secondary: {
|
|
165
164
|
base: string;
|
|
166
165
|
header: string;
|
|
167
166
|
title: string;
|
|
168
167
|
};
|
|
169
|
-
|
|
168
|
+
success: {
|
|
170
169
|
base: string;
|
|
171
170
|
header: string;
|
|
172
171
|
title: string;
|
|
173
172
|
};
|
|
174
|
-
|
|
173
|
+
warning: {
|
|
175
174
|
base: string;
|
|
176
175
|
header: string;
|
|
177
176
|
title: string;
|
|
178
177
|
};
|
|
179
|
-
|
|
178
|
+
danger: {
|
|
180
179
|
base: string;
|
|
181
180
|
header: string;
|
|
182
181
|
title: string;
|
|
183
182
|
};
|
|
184
|
-
|
|
183
|
+
info: {
|
|
185
184
|
base: string;
|
|
186
185
|
header: string;
|
|
187
186
|
title: string;
|