@makolabs/ripple 0.0.1-dev.65 → 0.0.1-dev.67
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/elements/dropdown/Select.svelte +2 -0
- package/dist/elements/dropdown/select.js +7 -7
- package/dist/forms/Input.svelte +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/index.js +2 -0
- package/dist/layout/card/MetricCard.svelte +61 -0
- package/dist/layout/card/MetricCard.svelte.d.ts +4 -0
- package/dist/layout/card/metric-card.d.ts +49 -0
- package/dist/layout/card/metric-card.js +10 -0
- package/package.json +1 -1
|
@@ -208,6 +208,8 @@
|
|
|
208
208
|
{disabled}
|
|
209
209
|
aria-expanded={open}
|
|
210
210
|
onclick={handleToggle}
|
|
211
|
+
class="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
|
|
212
|
+
tabindex={disabled ? -1 : 0}
|
|
211
213
|
></button>
|
|
212
214
|
<span class="flex min-h-[1.5rem] flex-1 flex-wrap items-center gap-1 overflow-hidden">
|
|
213
215
|
{#if multiple && selectedItems.length > 0}
|
|
@@ -3,10 +3,10 @@ import { Size } from '../../variants.js';
|
|
|
3
3
|
export const selectTV = tv({
|
|
4
4
|
slots: {
|
|
5
5
|
base: '',
|
|
6
|
-
trigger: `flex items-center justify-between w-full text-left bg-white border
|
|
7
|
-
border-default-
|
|
6
|
+
trigger: `relative flex items-center justify-between w-full text-left bg-white border
|
|
7
|
+
border-default-300 text-sm focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:border-primary-500 focus-within:ring-primary-500 rounded-lg shadow-xs cursor-pointer transition-colors hover:border-default-400`,
|
|
8
8
|
triggerIcon: 'transition-transform duration-200 text-default-500',
|
|
9
|
-
container: 'absolute z-50 w-full mt-1 bg-white overflow-clip border border-default-200 rounded-md shadow-
|
|
9
|
+
container: 'absolute z-50 w-full mt-1 bg-white overflow-clip border border-default-200 rounded-md shadow-sm origin-top-left top-full left-0 mt-2',
|
|
10
10
|
searchInput: 'flex items-center gap-x-3 w-full outline-none px-2 h-10 border-b border-b-default-200',
|
|
11
11
|
list: 'py-1 max-h-60 overflow-x-clip overflow-y-auto h-full',
|
|
12
12
|
item: `w-full px-3 py-2 text-sm text-left
|
|
@@ -26,21 +26,21 @@ export const selectTV = tv({
|
|
|
26
26
|
base: 'w-24'
|
|
27
27
|
},
|
|
28
28
|
[Size.SM]: {
|
|
29
|
-
trigger: 'h-8 px-
|
|
29
|
+
trigger: 'h-8 px-3 py-2 text-sm gap-1.5',
|
|
30
30
|
triggerIcon: 'h-3.5 w-3.5',
|
|
31
31
|
container: 'max-h-48',
|
|
32
32
|
item: 'px-2.5 py-1.5 text-xs',
|
|
33
33
|
base: 'w-32'
|
|
34
34
|
},
|
|
35
35
|
[Size.BASE]: {
|
|
36
|
-
trigger: 'h-10 px-3 py-2 text-
|
|
36
|
+
trigger: 'h-10 px-3 py-2 text-base gap-2',
|
|
37
37
|
triggerIcon: 'h-4 w-4',
|
|
38
38
|
container: 'max-h-60',
|
|
39
39
|
item: 'px-3 py-2 text-sm',
|
|
40
40
|
base: 'w-40'
|
|
41
41
|
},
|
|
42
42
|
[Size.LG]: {
|
|
43
|
-
trigger: 'h-
|
|
43
|
+
trigger: 'h-12 px-3 py-2 text-lg gap-2.5',
|
|
44
44
|
triggerIcon: 'h-5 w-5',
|
|
45
45
|
container: 'max-h-72',
|
|
46
46
|
item: 'px-4 py-2.5 text-base',
|
|
@@ -63,7 +63,7 @@ export const selectTV = tv({
|
|
|
63
63
|
},
|
|
64
64
|
disabled: {
|
|
65
65
|
true: {
|
|
66
|
-
trigger: 'opacity-50 cursor-not-allowed hover:border-default-
|
|
66
|
+
trigger: 'opacity-50 cursor-not-allowed hover:border-default-300',
|
|
67
67
|
container: 'pointer-events-none',
|
|
68
68
|
item: 'disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent'
|
|
69
69
|
}
|
package/dist/forms/Input.svelte
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
cn(
|
|
23
23
|
'transition-colors',
|
|
24
24
|
{
|
|
25
|
-
'border rounded-lg shadow-
|
|
25
|
+
'border rounded-lg shadow-xs w-full bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2':
|
|
26
26
|
BASIC_TYPES.includes(type),
|
|
27
27
|
'w-full bg-white px-3 py-2 text-sm resize-y min-h-[100px]': type === 'textarea',
|
|
28
28
|
'border-red-300 focus:border-red-500 focus:ring-red-500': errors.length,
|
package/dist/index.d.ts
CHANGED
|
@@ -177,6 +177,21 @@ export type StatsCardProps = {
|
|
|
177
177
|
class?: ClassValue;
|
|
178
178
|
formatLargeNumbers?: boolean;
|
|
179
179
|
};
|
|
180
|
+
export type MetricDetail = {
|
|
181
|
+
label: string;
|
|
182
|
+
value: string | number;
|
|
183
|
+
color?: string;
|
|
184
|
+
};
|
|
185
|
+
export type MetricCardProps = {
|
|
186
|
+
title: string;
|
|
187
|
+
value: string | number;
|
|
188
|
+
details?: MetricDetail[];
|
|
189
|
+
percent?: number;
|
|
190
|
+
segments?: ProgressSegment[];
|
|
191
|
+
primaryColor?: string;
|
|
192
|
+
secondaryColor?: string;
|
|
193
|
+
class?: ClassValue;
|
|
194
|
+
};
|
|
180
195
|
export type DataRow = Record<string, any>;
|
|
181
196
|
export type KeyType = keyof DataRow;
|
|
182
197
|
export type StatusType = 'active' | 'inactive' | 'pending' | 'error' | 'default';
|
|
@@ -341,6 +356,7 @@ export { default as Dropdown } from './elements/dropdown/Dropdown.svelte';
|
|
|
341
356
|
export { default as Select } from './elements/dropdown/Select.svelte';
|
|
342
357
|
export { default as Card } from './layout/card/Card.svelte';
|
|
343
358
|
export { default as StatsCard } from './layout/card/StatsCard.svelte';
|
|
359
|
+
export { default as MetricCard } from './layout/card/MetricCard.svelte';
|
|
344
360
|
export { default as Alert } from './elements/alert/Alert.svelte';
|
|
345
361
|
export type TabProps = {
|
|
346
362
|
value: string;
|
|
@@ -388,6 +404,7 @@ export { modal } from './modal/modal.js';
|
|
|
388
404
|
export { drawer } from './drawer/drawer.js';
|
|
389
405
|
export { selectTV } from './elements/dropdown/select.js';
|
|
390
406
|
export { breadcrumbs } from './header/breadcrumbs.js';
|
|
407
|
+
export { metricCard } from './layout/card/metric-card.js';
|
|
391
408
|
export type ChartColorKey = keyof typeof ChartColor;
|
|
392
409
|
export type ChartColorValue = typeof ChartColor[ChartColorKey];
|
|
393
410
|
export type ChartColors = {
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ export { default as Select } from './elements/dropdown/Select.svelte';
|
|
|
28
28
|
// Elements - Card
|
|
29
29
|
export { default as Card } from './layout/card/Card.svelte';
|
|
30
30
|
export { default as StatsCard } from './layout/card/StatsCard.svelte';
|
|
31
|
+
export { default as MetricCard } from './layout/card/MetricCard.svelte';
|
|
31
32
|
// Elements - Alert
|
|
32
33
|
export { default as Alert } from './elements/alert/Alert.svelte';
|
|
33
34
|
export { default as Tab } from './layout/tabs/Tab.svelte';
|
|
@@ -50,6 +51,7 @@ export { modal } from './modal/modal.js';
|
|
|
50
51
|
export { drawer } from './drawer/drawer.js';
|
|
51
52
|
export { selectTV } from './elements/dropdown/select.js';
|
|
52
53
|
export { breadcrumbs } from './header/breadcrumbs.js';
|
|
54
|
+
export { metricCard } from './layout/card/metric-card.js';
|
|
53
55
|
export { default as Chart } from './charts/Chart.svelte';
|
|
54
56
|
export { default as FileUpload } from './elements/file-upload/FileUpload.svelte';
|
|
55
57
|
export { default as FilesPreview } from './elements/file-upload/FilesPreview.svelte';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../helper/cls.js';
|
|
3
|
+
import { metricCard } from './metric-card.js';
|
|
4
|
+
import type { MetricCardProps } from '../../index.js';
|
|
5
|
+
import Progress from '../../elements/progress/Progress.svelte';
|
|
6
|
+
import { Size, Color } from '../../variants.js';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
title,
|
|
10
|
+
value,
|
|
11
|
+
details = [],
|
|
12
|
+
percent,
|
|
13
|
+
segments,
|
|
14
|
+
primaryColor = 'primary',
|
|
15
|
+
secondaryColor = 'default',
|
|
16
|
+
class: className = ''
|
|
17
|
+
}: MetricCardProps = $props();
|
|
18
|
+
|
|
19
|
+
const { base, title: titleSlot, value: valueSlot, detail: detailSlot, progress: progressSlot } = $derived(
|
|
20
|
+
metricCard()
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const baseClass = $derived(cn(base(), className));
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<div class={baseClass}>
|
|
27
|
+
<h3 class={titleSlot()}>{title}</h3>
|
|
28
|
+
<div class={valueSlot()}>{value}</div>
|
|
29
|
+
|
|
30
|
+
{#if details.length > 0}
|
|
31
|
+
<div class={detailSlot()}>
|
|
32
|
+
{#each details as detail}
|
|
33
|
+
<div class="flex items-center justify-between">
|
|
34
|
+
<span class="text-sm text-default-600">{detail.label}</span>
|
|
35
|
+
<span class="text-sm font-medium">{detail.value}</span>
|
|
36
|
+
</div>
|
|
37
|
+
{/each}
|
|
38
|
+
</div>
|
|
39
|
+
{/if}
|
|
40
|
+
|
|
41
|
+
{#if segments}
|
|
42
|
+
<div class={progressSlot()}>
|
|
43
|
+
<Progress
|
|
44
|
+
value={0}
|
|
45
|
+
{segments}
|
|
46
|
+
size={Size.SM}
|
|
47
|
+
showLabels={true}
|
|
48
|
+
showValues={true}
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
{:else if percent !== undefined}
|
|
52
|
+
<div class={progressSlot()}>
|
|
53
|
+
<Progress
|
|
54
|
+
value={percent}
|
|
55
|
+
size={Size.SM}
|
|
56
|
+
color={Color.SUCCESS}
|
|
57
|
+
showLabel={false}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
{/if}
|
|
61
|
+
</div>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const metricCard: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
[key: string]: {
|
|
3
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
4
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
5
|
+
value?: import("tailwind-merge").ClassNameValue;
|
|
6
|
+
title?: import("tailwind-merge").ClassNameValue;
|
|
7
|
+
progress?: import("tailwind-merge").ClassNameValue;
|
|
8
|
+
detail?: import("tailwind-merge").ClassNameValue;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
} | {
|
|
12
|
+
[x: string]: {
|
|
13
|
+
[x: string]: import("tailwind-merge").ClassNameValue | {
|
|
14
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
15
|
+
value?: import("tailwind-merge").ClassNameValue;
|
|
16
|
+
title?: import("tailwind-merge").ClassNameValue;
|
|
17
|
+
progress?: import("tailwind-merge").ClassNameValue;
|
|
18
|
+
detail?: import("tailwind-merge").ClassNameValue;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
} | {}, {
|
|
22
|
+
base: string;
|
|
23
|
+
title: string;
|
|
24
|
+
value: string;
|
|
25
|
+
detail: string;
|
|
26
|
+
progress: string;
|
|
27
|
+
}, undefined, {
|
|
28
|
+
[key: string]: {
|
|
29
|
+
[key: string]: import("tailwind-merge").ClassNameValue | {
|
|
30
|
+
base?: import("tailwind-merge").ClassNameValue;
|
|
31
|
+
value?: import("tailwind-merge").ClassNameValue;
|
|
32
|
+
title?: import("tailwind-merge").ClassNameValue;
|
|
33
|
+
progress?: import("tailwind-merge").ClassNameValue;
|
|
34
|
+
detail?: import("tailwind-merge").ClassNameValue;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
} | {}, {
|
|
38
|
+
base: string;
|
|
39
|
+
title: string;
|
|
40
|
+
value: string;
|
|
41
|
+
detail: string;
|
|
42
|
+
progress: string;
|
|
43
|
+
}, import("tailwind-variants").TVReturnType<unknown, {
|
|
44
|
+
base: string;
|
|
45
|
+
title: string;
|
|
46
|
+
value: string;
|
|
47
|
+
detail: string;
|
|
48
|
+
progress: string;
|
|
49
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const metricCard = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
base: 'border-default-200 rounded-xl border bg-white p-6 shadow-sm',
|
|
5
|
+
title: 'text-default-500 text-sm',
|
|
6
|
+
value: 'text-default-900 mt-2 text-3xl font-bold',
|
|
7
|
+
detail: 'mt-2 flex justify-between text-xs',
|
|
8
|
+
progress: 'mt-2 h-2 w-full rounded-full bg-gray-200'
|
|
9
|
+
}
|
|
10
|
+
});
|