@makolabs/ripple 0.0.1-dev.31 → 0.0.1-dev.34
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/charts/Chart.svelte +2 -0
- package/dist/elements/accordion/Accordion.svelte +109 -0
- package/dist/elements/accordion/Accordion.svelte.d.ts +4 -0
- package/dist/elements/accordion/accordion.d.ts +200 -0
- package/dist/elements/accordion/accordion.js +88 -0
- package/dist/index.d.ts +33 -3
- package/dist/index.js +10 -8
- package/package.json +1 -1
package/dist/charts/Chart.svelte
CHANGED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../helper/cls.js';
|
|
3
|
+
import { accordion } from './accordion.js';
|
|
4
|
+
import type { AccordionProps } from '../../index.js';
|
|
5
|
+
import { Color } from '../../variants.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
title,
|
|
9
|
+
description,
|
|
10
|
+
children,
|
|
11
|
+
custom,
|
|
12
|
+
open = $bindable(false),
|
|
13
|
+
color = Color.DEFAULT,
|
|
14
|
+
class: className = '',
|
|
15
|
+
titleclass: titleClass = '',
|
|
16
|
+
bodyclass: bodyClass = '',
|
|
17
|
+
headerclass: headerClass = '',
|
|
18
|
+
icon: Icon = undefined,
|
|
19
|
+
iconPosition = 'start',
|
|
20
|
+
bordered = true,
|
|
21
|
+
onexpand = () => {},
|
|
22
|
+
oncollapse = () => {}
|
|
23
|
+
}: AccordionProps = $props();
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
base,
|
|
27
|
+
header,
|
|
28
|
+
title: titleSlot,
|
|
29
|
+
body,
|
|
30
|
+
icon: iconSlot,
|
|
31
|
+
description: descriptionSlot
|
|
32
|
+
} = $derived(
|
|
33
|
+
accordion({
|
|
34
|
+
color,
|
|
35
|
+
open,
|
|
36
|
+
bordered,
|
|
37
|
+
iconPosition
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const baseClass = $derived(cn(base(), className));
|
|
42
|
+
const headerClasses = $derived(cn(header(), headerClass));
|
|
43
|
+
const titleClasses = $derived(cn(titleSlot(), titleClass));
|
|
44
|
+
const bodyClasses = $derived(cn(body(), bodyClass));
|
|
45
|
+
const iconClasses = $derived(cn(iconSlot()));
|
|
46
|
+
const descriptionClasses = $derived(cn(descriptionSlot()));
|
|
47
|
+
|
|
48
|
+
function handleToggle() {
|
|
49
|
+
open = !open;
|
|
50
|
+
if (open) {
|
|
51
|
+
onexpand();
|
|
52
|
+
} else {
|
|
53
|
+
oncollapse();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<div class={baseClass}>
|
|
59
|
+
<div class={headerClasses} onclick={handleToggle}>
|
|
60
|
+
<div class="flex flex-1 items-center">
|
|
61
|
+
{#if Icon && iconPosition === 'start'}
|
|
62
|
+
<div class="mr-3">
|
|
63
|
+
<Icon class={iconClasses} />
|
|
64
|
+
</div>
|
|
65
|
+
{/if}
|
|
66
|
+
|
|
67
|
+
<div class="flex-1">
|
|
68
|
+
{#if title}
|
|
69
|
+
<h3 class={titleClasses}>{title}</h3>
|
|
70
|
+
{/if}
|
|
71
|
+
{#if description}
|
|
72
|
+
<p class={descriptionClasses}>{description}</p>
|
|
73
|
+
{/if}
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
{#if Icon && iconPosition === 'end'}
|
|
77
|
+
<div class="ml-3">
|
|
78
|
+
<Icon class={iconClasses} />
|
|
79
|
+
</div>
|
|
80
|
+
{/if}
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<div class="ml-3 flex items-center">
|
|
84
|
+
<svg
|
|
85
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
86
|
+
width="20"
|
|
87
|
+
height="20"
|
|
88
|
+
viewBox="0 0 20 20"
|
|
89
|
+
class="text-default-500 transition-transform duration-200"
|
|
90
|
+
class:rotate-180={open}
|
|
91
|
+
>
|
|
92
|
+
<path
|
|
93
|
+
fill="currentColor"
|
|
94
|
+
d="M15.794 7.733a.75.75 0 0 1-.026 1.06l-5.25 5.001a.75.75 0 0 1-1.035 0l-5.25-5a.75.75 0 0 1 1.034-1.087l4.734 4.509l4.733-4.51a.75.75 0 0 1 1.06.027"
|
|
95
|
+
/>
|
|
96
|
+
</svg>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
{#if open}
|
|
101
|
+
<div class={bodyClasses}>
|
|
102
|
+
{#if custom}
|
|
103
|
+
{@render custom()}
|
|
104
|
+
{:else if children}
|
|
105
|
+
{@render children()}
|
|
106
|
+
{/if}
|
|
107
|
+
</div>
|
|
108
|
+
{/if}
|
|
109
|
+
</div>
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
export const accordion: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
color: {
|
|
3
|
+
[Color.DEFAULT]: {
|
|
4
|
+
base: string;
|
|
5
|
+
body: string;
|
|
6
|
+
};
|
|
7
|
+
[Color.PRIMARY]: {
|
|
8
|
+
base: string;
|
|
9
|
+
header: string;
|
|
10
|
+
title: string;
|
|
11
|
+
};
|
|
12
|
+
[Color.SECONDARY]: {
|
|
13
|
+
base: string;
|
|
14
|
+
header: string;
|
|
15
|
+
title: string;
|
|
16
|
+
};
|
|
17
|
+
[Color.SUCCESS]: {
|
|
18
|
+
base: string;
|
|
19
|
+
header: string;
|
|
20
|
+
title: string;
|
|
21
|
+
};
|
|
22
|
+
[Color.WARNING]: {
|
|
23
|
+
base: string;
|
|
24
|
+
header: string;
|
|
25
|
+
title: string;
|
|
26
|
+
};
|
|
27
|
+
[Color.DANGER]: {
|
|
28
|
+
base: string;
|
|
29
|
+
header: string;
|
|
30
|
+
title: string;
|
|
31
|
+
};
|
|
32
|
+
[Color.INFO]: {
|
|
33
|
+
base: string;
|
|
34
|
+
header: string;
|
|
35
|
+
title: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
open: {
|
|
39
|
+
true: {
|
|
40
|
+
base: string;
|
|
41
|
+
title: string;
|
|
42
|
+
};
|
|
43
|
+
false: {
|
|
44
|
+
base: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
bordered: {
|
|
48
|
+
true: {
|
|
49
|
+
base: string;
|
|
50
|
+
body: string;
|
|
51
|
+
};
|
|
52
|
+
false: {
|
|
53
|
+
base: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
iconPosition: {
|
|
57
|
+
start: {};
|
|
58
|
+
end: {};
|
|
59
|
+
};
|
|
60
|
+
}, {
|
|
61
|
+
base: string;
|
|
62
|
+
header: string;
|
|
63
|
+
title: string;
|
|
64
|
+
description: string;
|
|
65
|
+
body: string;
|
|
66
|
+
icon: string;
|
|
67
|
+
}, undefined, {
|
|
68
|
+
color: {
|
|
69
|
+
[Color.DEFAULT]: {
|
|
70
|
+
base: string;
|
|
71
|
+
body: string;
|
|
72
|
+
};
|
|
73
|
+
[Color.PRIMARY]: {
|
|
74
|
+
base: string;
|
|
75
|
+
header: string;
|
|
76
|
+
title: string;
|
|
77
|
+
};
|
|
78
|
+
[Color.SECONDARY]: {
|
|
79
|
+
base: string;
|
|
80
|
+
header: string;
|
|
81
|
+
title: string;
|
|
82
|
+
};
|
|
83
|
+
[Color.SUCCESS]: {
|
|
84
|
+
base: string;
|
|
85
|
+
header: string;
|
|
86
|
+
title: string;
|
|
87
|
+
};
|
|
88
|
+
[Color.WARNING]: {
|
|
89
|
+
base: string;
|
|
90
|
+
header: string;
|
|
91
|
+
title: string;
|
|
92
|
+
};
|
|
93
|
+
[Color.DANGER]: {
|
|
94
|
+
base: string;
|
|
95
|
+
header: string;
|
|
96
|
+
title: string;
|
|
97
|
+
};
|
|
98
|
+
[Color.INFO]: {
|
|
99
|
+
base: string;
|
|
100
|
+
header: string;
|
|
101
|
+
title: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
open: {
|
|
105
|
+
true: {
|
|
106
|
+
base: string;
|
|
107
|
+
title: string;
|
|
108
|
+
};
|
|
109
|
+
false: {
|
|
110
|
+
base: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
bordered: {
|
|
114
|
+
true: {
|
|
115
|
+
base: string;
|
|
116
|
+
body: string;
|
|
117
|
+
};
|
|
118
|
+
false: {
|
|
119
|
+
base: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
iconPosition: {
|
|
123
|
+
start: {};
|
|
124
|
+
end: {};
|
|
125
|
+
};
|
|
126
|
+
}, {
|
|
127
|
+
base: string;
|
|
128
|
+
header: string;
|
|
129
|
+
title: string;
|
|
130
|
+
description: string;
|
|
131
|
+
body: string;
|
|
132
|
+
icon: string;
|
|
133
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
134
|
+
color: {
|
|
135
|
+
[Color.DEFAULT]: {
|
|
136
|
+
base: string;
|
|
137
|
+
body: string;
|
|
138
|
+
};
|
|
139
|
+
[Color.PRIMARY]: {
|
|
140
|
+
base: string;
|
|
141
|
+
header: string;
|
|
142
|
+
title: string;
|
|
143
|
+
};
|
|
144
|
+
[Color.SECONDARY]: {
|
|
145
|
+
base: string;
|
|
146
|
+
header: string;
|
|
147
|
+
title: string;
|
|
148
|
+
};
|
|
149
|
+
[Color.SUCCESS]: {
|
|
150
|
+
base: string;
|
|
151
|
+
header: string;
|
|
152
|
+
title: string;
|
|
153
|
+
};
|
|
154
|
+
[Color.WARNING]: {
|
|
155
|
+
base: string;
|
|
156
|
+
header: string;
|
|
157
|
+
title: string;
|
|
158
|
+
};
|
|
159
|
+
[Color.DANGER]: {
|
|
160
|
+
base: string;
|
|
161
|
+
header: string;
|
|
162
|
+
title: string;
|
|
163
|
+
};
|
|
164
|
+
[Color.INFO]: {
|
|
165
|
+
base: string;
|
|
166
|
+
header: string;
|
|
167
|
+
title: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
open: {
|
|
171
|
+
true: {
|
|
172
|
+
base: string;
|
|
173
|
+
title: string;
|
|
174
|
+
};
|
|
175
|
+
false: {
|
|
176
|
+
base: string;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
bordered: {
|
|
180
|
+
true: {
|
|
181
|
+
base: string;
|
|
182
|
+
body: string;
|
|
183
|
+
};
|
|
184
|
+
false: {
|
|
185
|
+
base: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
iconPosition: {
|
|
189
|
+
start: {};
|
|
190
|
+
end: {};
|
|
191
|
+
};
|
|
192
|
+
}, {
|
|
193
|
+
base: string;
|
|
194
|
+
header: string;
|
|
195
|
+
title: string;
|
|
196
|
+
description: string;
|
|
197
|
+
body: string;
|
|
198
|
+
icon: string;
|
|
199
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
200
|
+
import { Color } from '../../variants.js';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { tv } from '../../helper/cls.js';
|
|
2
|
+
import { Color } from '../../variants.js';
|
|
3
|
+
|
|
4
|
+
export const accordion = tv({
|
|
5
|
+
slots: {
|
|
6
|
+
base: 'relative overflow-hidden rounded-lg',
|
|
7
|
+
header: 'flex cursor-pointer items-center justify-between border-default-200 p-4',
|
|
8
|
+
title: 'text-default-900 text-base font-medium',
|
|
9
|
+
description: 'text-default-500 text-sm',
|
|
10
|
+
body: 'border-default-200 p-4 pt-0',
|
|
11
|
+
icon: 'size-5'
|
|
12
|
+
},
|
|
13
|
+
variants: {
|
|
14
|
+
color: {
|
|
15
|
+
[Color.DEFAULT]: {
|
|
16
|
+
base: 'bg-white',
|
|
17
|
+
body: ''
|
|
18
|
+
},
|
|
19
|
+
[Color.PRIMARY]: {
|
|
20
|
+
base: 'bg-primary-50',
|
|
21
|
+
header: 'text-primary-700',
|
|
22
|
+
title: 'text-primary-700'
|
|
23
|
+
},
|
|
24
|
+
[Color.SECONDARY]: {
|
|
25
|
+
base: 'bg-secondary-50',
|
|
26
|
+
header: 'text-secondary-700',
|
|
27
|
+
title: 'text-secondary-700'
|
|
28
|
+
},
|
|
29
|
+
[Color.SUCCESS]: {
|
|
30
|
+
base: 'bg-success-50',
|
|
31
|
+
header: 'text-success-700',
|
|
32
|
+
title: 'text-success-700'
|
|
33
|
+
},
|
|
34
|
+
[Color.WARNING]: {
|
|
35
|
+
base: 'bg-warning-50',
|
|
36
|
+
header: 'text-warning-700',
|
|
37
|
+
title: 'text-warning-700'
|
|
38
|
+
},
|
|
39
|
+
[Color.DANGER]: {
|
|
40
|
+
base: 'bg-danger-50',
|
|
41
|
+
header: 'text-danger-700',
|
|
42
|
+
title: 'text-danger-700'
|
|
43
|
+
},
|
|
44
|
+
[Color.INFO]: {
|
|
45
|
+
base: 'bg-info-50',
|
|
46
|
+
header: 'text-info-700',
|
|
47
|
+
title: 'text-info-700'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
open: {
|
|
51
|
+
true: {
|
|
52
|
+
base: 'ring-1 ring-default-200',
|
|
53
|
+
title: 'text-default-900'
|
|
54
|
+
},
|
|
55
|
+
false: {
|
|
56
|
+
base: ''
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
bordered: {
|
|
60
|
+
true: {
|
|
61
|
+
base: 'border border-default-200 ring-1 ring-default-200/50',
|
|
62
|
+
body: 'border-t'
|
|
63
|
+
},
|
|
64
|
+
false: {
|
|
65
|
+
base: 'shadow-sm'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
iconPosition: {
|
|
69
|
+
start: {},
|
|
70
|
+
end: {}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
compoundVariants: [
|
|
74
|
+
{
|
|
75
|
+
open: true,
|
|
76
|
+
bordered: true,
|
|
77
|
+
class: {
|
|
78
|
+
base: 'shadow-sm'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
defaultVariants: {
|
|
83
|
+
color: Color.DEFAULT,
|
|
84
|
+
open: false,
|
|
85
|
+
bordered: true,
|
|
86
|
+
iconPosition: 'start'
|
|
87
|
+
}
|
|
88
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { ChartColor, Color, Size } from './variants.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Size System:
|
|
4
|
+
* - Size.*: Component dimensions (XS, SM, BASE, LG, XL, XXL)
|
|
5
|
+
*/
|
|
3
6
|
export type VariantSizes = (typeof Size)[keyof typeof Size];
|
|
4
|
-
export
|
|
7
|
+
export type VariantColors = (typeof Color)[keyof typeof Color];
|
|
8
|
+
/**
|
|
9
|
+
* Color System:
|
|
10
|
+
* - Color.*: UI component colors (buttons, text, backgrounds)
|
|
11
|
+
* Options: DEFAULT, PRIMARY, SECONDARY, INFO, SUCCESS, WARNING, DANGER
|
|
12
|
+
* - ChartColor.*: Chart-specific colors, only supported within series configurations (lines, areas, bars)
|
|
13
|
+
* Options: HEALTH, PROPERTY, AUTO, LIFE, OTHER, DEFAULT
|
|
14
|
+
* - ChartColors: Record type mapping ChartColor enum to string values
|
|
15
|
+
*/
|
|
16
|
+
export { Color, Size, ChartColor };
|
|
5
17
|
import type { ClassValue } from 'tailwind-variants';
|
|
6
18
|
import type { Snippet } from 'svelte';
|
|
7
19
|
import type { Component } from 'svelte';
|
|
@@ -341,7 +353,7 @@ export type ChartColorValue = typeof ChartColor[ChartColorKey];
|
|
|
341
353
|
export type ChartColors = {
|
|
342
354
|
[K in ChartColorValue]: string;
|
|
343
355
|
};
|
|
344
|
-
export type ChartType = 'line' | 'bar' | 'horizontal-bar' | 'pie';
|
|
356
|
+
export type ChartType = 'line' | 'bar' | 'horizontal-bar' | 'pie' | 'stacked-bar';
|
|
345
357
|
export type ChartColorString = `#${string}` | keyof ChartColors;
|
|
346
358
|
export type XAxisConfig<T> = {
|
|
347
359
|
dataKey: keyof T;
|
|
@@ -709,6 +721,24 @@ export type ProgressProps = {
|
|
|
709
721
|
barClass?: string;
|
|
710
722
|
};
|
|
711
723
|
export { default as Progress } from './elements/progress/Progress.svelte';
|
|
724
|
+
export type AccordionProps = {
|
|
725
|
+
title?: string;
|
|
726
|
+
description?: string;
|
|
727
|
+
children?: Snippet;
|
|
728
|
+
custom?: Snippet;
|
|
729
|
+
open?: boolean;
|
|
730
|
+
color?: VariantColors;
|
|
731
|
+
class?: ClassValue;
|
|
732
|
+
titleclass?: ClassValue;
|
|
733
|
+
bodyclass?: ClassValue;
|
|
734
|
+
headerclass?: ClassValue;
|
|
735
|
+
icon?: Component;
|
|
736
|
+
iconPosition?: 'start' | 'end';
|
|
737
|
+
bordered?: boolean;
|
|
738
|
+
onexpand?: () => void;
|
|
739
|
+
oncollapse?: () => void;
|
|
740
|
+
};
|
|
741
|
+
export { default as Accordion } from './elements/accordion/Accordion.svelte';
|
|
712
742
|
export interface TimelineItem {
|
|
713
743
|
title: string;
|
|
714
744
|
time: Date | string;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ChartColor, Color, Size } from './variants.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Color System:
|
|
4
|
+
* - Color.*: UI component colors (buttons, text, backgrounds)
|
|
5
|
+
* Options: DEFAULT, PRIMARY, SECONDARY, INFO, SUCCESS, WARNING, DANGER
|
|
6
|
+
* - ChartColor.*: Chart-specific colors, only supported within series configurations (lines, areas, bars)
|
|
7
|
+
* Options: HEALTH, PROPERTY, AUTO, LIFE, OTHER, DEFAULT
|
|
8
|
+
* - ChartColors: Record type mapping ChartColor enum to string values
|
|
9
|
+
*/
|
|
10
|
+
export { Color, Size, ChartColor };
|
|
10
11
|
// Helper utilities
|
|
11
12
|
export { tv, cn } from './helper/cls.js';
|
|
12
13
|
export { isRouteActive } from './helper/nav.svelte.js';
|
|
@@ -67,4 +68,5 @@ export { default as DateRange } from './forms/DateRange.svelte';
|
|
|
67
68
|
export { default as Tags } from './forms/Tags.svelte';
|
|
68
69
|
export { default as RadioPill } from './forms/RadioPill.svelte';
|
|
69
70
|
export { default as Progress } from './elements/progress/Progress.svelte';
|
|
71
|
+
export { default as Accordion } from './elements/accordion/Accordion.svelte';
|
|
70
72
|
export { default as Timeline } from './elements/timeline/Timeline.svelte';
|