@reshape-biotech/design-system 1.1.1 → 1.2.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/dist/components/activity/Activity.svelte +12 -4
- package/dist/components/activity/Activity.svelte.d.ts +1 -1
- package/dist/components/banner/Banner.svelte +1 -1
- package/dist/components/datepicker/DatePicker.stories.svelte +6 -5
- package/dist/components/datepicker/DatePicker.svelte +1 -0
- package/dist/components/graphs/bar-chart/BarChart.stories.svelte +38 -0
- package/dist/components/graphs/bar-chart/BarChart.svelte +14 -1
- package/dist/components/graphs/bar-chart/BarChart.svelte.d.ts +1 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.stories.svelte +32 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.svelte +16 -3
- package/dist/components/graphs/bar-chart/StackedBarChart.svelte.d.ts +3 -2
- package/dist/components/graphs/chart/Chart.stories.svelte +0 -3
- package/dist/components/graphs/line/LineChart.stories.svelte +21 -13
- package/dist/components/graphs/line/LineChart.svelte +14 -20
- package/dist/components/graphs/line/LineChart.svelte.d.ts +1 -0
- package/dist/components/graphs/matrix/Matrix.stories.svelte +0 -14
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte +15 -40
- package/dist/components/graphs/multiline/MultiLineChart.svelte +0 -20
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte +1 -1
- package/dist/components/icons/AnalysisIcon.svelte +10 -1
- package/dist/components/icons/AnalysisIcon.svelte.d.ts +1 -0
- package/dist/components/icons/index.d.ts +1 -1
- package/dist/components/icons/index.js +12 -0
- package/dist/components/notifications/Notifications.stories.svelte +107 -0
- package/dist/components/notifications/Notifications.stories.svelte.d.ts +19 -0
- package/dist/components/notifications/Notifications.svelte +32 -0
- package/dist/components/notifications/Notifications.svelte.d.ts +18 -0
- package/dist/components/notifications/index.d.ts +1 -0
- package/dist/components/notifications/index.js +1 -0
- package/dist/components/select-new/components/Group.svelte +3 -2
- package/dist/components/select-new/components/Group.svelte.d.ts +1 -0
- package/dist/components/select-new/index.d.ts +1 -1
- package/dist/components/stepper/Stepper.stories.svelte +243 -0
- package/dist/components/stepper/Stepper.stories.svelte.d.ts +19 -0
- package/dist/components/stepper/components/stepper-root.svelte +20 -0
- package/dist/components/stepper/components/stepper-root.svelte.d.ts +9 -0
- package/dist/components/stepper/components/stepper-step.svelte +100 -0
- package/dist/components/stepper/components/stepper-step.svelte.d.ts +11 -0
- package/dist/components/stepper/index.d.ts +15 -0
- package/dist/components/stepper/index.js +2 -0
- package/dist/components/toast/Toast.stories.svelte +209 -0
- package/dist/components/toast/Toast.stories.svelte.d.ts +19 -0
- package/dist/components/toast/Toast.svelte +62 -0
- package/dist/components/toast/Toast.svelte.d.ts +7 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/tailwind.preset.d.ts +3 -0
- package/dist/tokens.d.ts +6 -0
- package/dist/tokens.js +3 -3
- package/package.json +1 -1
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
| 'start'
|
|
13
13
|
| 'stop'
|
|
14
14
|
| 'warning'
|
|
15
|
-
| 'success'
|
|
15
|
+
| 'success'
|
|
16
|
+
| 'export-succeeded'
|
|
17
|
+
| 'export-failed';
|
|
16
18
|
|
|
17
19
|
type Activity = {
|
|
18
20
|
activity_type?: string;
|
|
@@ -40,7 +42,9 @@
|
|
|
40
42
|
start: 'Play',
|
|
41
43
|
stop: 'Stop',
|
|
42
44
|
warning: 'Warning',
|
|
43
|
-
success: 'Check'
|
|
45
|
+
success: 'Check',
|
|
46
|
+
'export-succeeded': 'DownloadSimple',
|
|
47
|
+
'export-failed': 'DownloadSimple'
|
|
44
48
|
};
|
|
45
49
|
|
|
46
50
|
const ACTIVITY_COLOR: Record<ActivityIcon, IconColor> = {
|
|
@@ -53,7 +57,9 @@
|
|
|
53
57
|
start: 'icon-secondary',
|
|
54
58
|
stop: 'icon-secondary',
|
|
55
59
|
warning: 'icon-warning',
|
|
56
|
-
success: 'icon-secondary'
|
|
60
|
+
success: 'icon-secondary',
|
|
61
|
+
'export-succeeded': 'icon-secondary',
|
|
62
|
+
'export-failed': 'icon-danger'
|
|
57
63
|
};
|
|
58
64
|
|
|
59
65
|
const ACTIVITY_BACKGROUND: Record<ActivityIcon, BackgroundClass> = {
|
|
@@ -66,7 +72,9 @@
|
|
|
66
72
|
start: 'bg-neutral',
|
|
67
73
|
stop: 'bg-neutral',
|
|
68
74
|
warning: 'bg-warning',
|
|
69
|
-
success: 'bg-neutral'
|
|
75
|
+
success: 'bg-neutral',
|
|
76
|
+
'export-succeeded': 'bg-neutral',
|
|
77
|
+
'export-failed': 'bg-danger'
|
|
70
78
|
};
|
|
71
79
|
|
|
72
80
|
function formatDateTime(timestamp: string): string {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type ActivityIcon = 'add' | 'capture' | 'delete' | 'edit' | 'failed' | 'pause' | 'start' | 'stop' | 'warning' | 'success';
|
|
1
|
+
type ActivityIcon = 'add' | 'capture' | 'delete' | 'edit' | 'failed' | 'pause' | 'start' | 'stop' | 'warning' | 'success' | 'export-succeeded' | 'export-failed';
|
|
2
2
|
type Activity = {
|
|
3
3
|
activity_type?: string;
|
|
4
4
|
icon: ActivityIcon;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
31
|
{#if show}
|
|
32
|
-
<div class="rounded-lg bg-{color} flex
|
|
32
|
+
<div class="rounded-lg bg-{color} flex w-full items-center justify-between p-3">
|
|
33
33
|
<div class="inline-flex w-full items-center justify-start gap-3">
|
|
34
34
|
{#if icon}
|
|
35
35
|
<div class="flex size-5 items-center justify-center text-icon-{color} ">
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { DateTime } from 'luxon';
|
|
5
5
|
import DatePicker from './DatePicker.svelte';
|
|
6
6
|
import Dropdown from '../dropdown/Dropdown.svelte';
|
|
7
|
-
import Button from '../button/Button.svelte';
|
|
8
7
|
import { Icon } from '../icons';
|
|
9
8
|
|
|
10
9
|
const { Story } = defineMeta({
|
|
@@ -19,6 +18,8 @@
|
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
20
|
|
|
21
|
+
const staticDate = DateTime.local(2023, 10, 15);
|
|
22
|
+
|
|
22
23
|
let selectedDate = $state<DateTime | undefined>(undefined);
|
|
23
24
|
let loggedDate = $state<string | undefined>(undefined);
|
|
24
25
|
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
|
|
52
53
|
<Story name="Default" args={{ selectedDate: undefined }} />
|
|
53
54
|
|
|
54
|
-
<Story name="With Selected Date" args={{ selectedDate:
|
|
55
|
+
<Story name="With Selected Date" args={{ selectedDate: staticDate }} />
|
|
55
56
|
|
|
56
57
|
<Story name="With Date Change Handler" asChild>
|
|
57
58
|
<div class="p-4">
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
|
|
69
70
|
<Story name="Month Navigation" asChild>
|
|
70
71
|
<div class="p-4">
|
|
71
|
-
<DatePicker selectedDate={
|
|
72
|
+
<DatePicker selectedDate={staticDate} />
|
|
72
73
|
<div class="mt-4 text-sm text-tertiary">
|
|
73
74
|
<p>Click the arrow buttons to navigate between months</p>
|
|
74
75
|
</div>
|
|
@@ -117,11 +118,11 @@
|
|
|
117
118
|
<div class="flex flex-col gap-4 p-4 md:flex-row">
|
|
118
119
|
<div>
|
|
119
120
|
<h3 class="mb-2 text-sm font-medium">Start Date</h3>
|
|
120
|
-
<DatePicker selectedDate={
|
|
121
|
+
<DatePicker selectedDate={staticDate.minus({ days: 7 })} />
|
|
121
122
|
</div>
|
|
122
123
|
<div>
|
|
123
124
|
<h3 class="mb-2 text-sm font-medium">End Date</h3>
|
|
124
|
-
<DatePicker selectedDate={
|
|
125
|
+
<DatePicker selectedDate={staticDate} />
|
|
125
126
|
</div>
|
|
126
127
|
</div>
|
|
127
128
|
</Story>
|
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
{#if dayOfMonth === currentDay && shownMonth === currentMonth && shownYear === currentYear && dayOfMonth != selectedDay}
|
|
141
141
|
<svg
|
|
142
142
|
class="current-date-indicator text-accent"
|
|
143
|
+
data-chromatic="ignore"
|
|
143
144
|
xmlns="http://www.w3.org/2000/svg"
|
|
144
145
|
width="4"
|
|
145
146
|
height="4"
|
|
@@ -79,3 +79,41 @@
|
|
|
79
79
|
name="Empty Data"
|
|
80
80
|
args={{ data: [], xAxisName: 'category', yAxisName: 'Value', height: '400px' }}
|
|
81
81
|
/>
|
|
82
|
+
|
|
83
|
+
<Story
|
|
84
|
+
name="With Capture Interval"
|
|
85
|
+
args={{
|
|
86
|
+
data: [
|
|
87
|
+
{ category: '0', value: 10 },
|
|
88
|
+
{ category: '1', value: 20 },
|
|
89
|
+
{ category: '2', value: 15 },
|
|
90
|
+
{ category: '3', value: 25 },
|
|
91
|
+
{ category: '4', value: 30 },
|
|
92
|
+
{ category: '5', value: 18 },
|
|
93
|
+
{ category: '6', value: 22 }
|
|
94
|
+
],
|
|
95
|
+
xAxisName: 'category',
|
|
96
|
+
yAxisName: 'Value',
|
|
97
|
+
height: '400px',
|
|
98
|
+
captureInterval: 3600
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
<Story
|
|
103
|
+
name="With Capture Interval - Short Duration"
|
|
104
|
+
args={{
|
|
105
|
+
data: [
|
|
106
|
+
{ category: '0', value: 10 },
|
|
107
|
+
{ category: '1', value: 20 },
|
|
108
|
+
{ category: '2', value: 15 },
|
|
109
|
+
{ category: '3', value: 25 },
|
|
110
|
+
{ category: '4', value: 30 },
|
|
111
|
+
{ category: '5', value: 18 },
|
|
112
|
+
{ category: '6', value: 22 }
|
|
113
|
+
],
|
|
114
|
+
xAxisName: 'category',
|
|
115
|
+
yAxisName: 'Value',
|
|
116
|
+
height: '400px',
|
|
117
|
+
captureInterval: 600
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import Chart, { type GenericChartProps } from '../chart/Chart.svelte';
|
|
4
4
|
import type { EChartsOption, BarSeriesOption } from 'echarts';
|
|
5
5
|
import { createTooltipFormatter } from '../utils/tooltipFormatter';
|
|
6
|
+
import { Duration } from 'luxon';
|
|
6
7
|
|
|
7
8
|
type DataItem = {
|
|
8
9
|
value: number;
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
colors?: Record<string, string>; // Optional: Color mapping per x-axis category
|
|
15
16
|
rotateXAxisLabels?: boolean;
|
|
16
17
|
grid?: EChartsOption['grid'];
|
|
18
|
+
captureInterval?: number;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
let {
|
|
@@ -22,6 +24,7 @@
|
|
|
22
24
|
rotateXAxisLabels = false,
|
|
23
25
|
xAxisName,
|
|
24
26
|
yAxisName,
|
|
27
|
+
captureInterval,
|
|
25
28
|
...props
|
|
26
29
|
}: BarChartProps = $props();
|
|
27
30
|
|
|
@@ -38,6 +41,16 @@
|
|
|
38
41
|
|
|
39
42
|
const xAxisData = $derived(data.map((item) => item[xAxisName]));
|
|
40
43
|
|
|
44
|
+
const captureIntervals = captureInterval
|
|
45
|
+
? Array(data.length)
|
|
46
|
+
.fill(null)
|
|
47
|
+
.map((_, timeIndex) => {
|
|
48
|
+
const seconds = timeIndex * captureInterval;
|
|
49
|
+
const duration = Duration.fromObject({ seconds }).shiftTo('days', 'hours', 'minutes');
|
|
50
|
+
return duration.days >= 1 ? duration.toFormat('dd:hh:mm') : duration.toFormat('hh:mm');
|
|
51
|
+
})
|
|
52
|
+
: undefined;
|
|
53
|
+
|
|
41
54
|
const createBarDataItem = (value: number | null, color: string) => ({
|
|
42
55
|
value,
|
|
43
56
|
itemStyle: {
|
|
@@ -94,7 +107,7 @@
|
|
|
94
107
|
},
|
|
95
108
|
xAxis: {
|
|
96
109
|
type: 'category',
|
|
97
|
-
data: xAxisData,
|
|
110
|
+
data: captureIntervals || xAxisData,
|
|
98
111
|
axisTick: {
|
|
99
112
|
show: false,
|
|
100
113
|
alignWithLabel: true
|
|
@@ -9,6 +9,7 @@ interface BarChartProps extends Omit<GenericChartProps, 'timeIndex'> {
|
|
|
9
9
|
colors?: Record<string, string>;
|
|
10
10
|
rotateXAxisLabels?: boolean;
|
|
11
11
|
grid?: EChartsOption['grid'];
|
|
12
|
+
captureInterval?: number;
|
|
12
13
|
}
|
|
13
14
|
declare const BarChart: import("svelte").Component<BarChartProps, {}, "">;
|
|
14
15
|
type BarChart = ReturnType<typeof BarChart>;
|
|
@@ -40,3 +40,35 @@
|
|
|
40
40
|
yAxisName: 'Count'
|
|
41
41
|
}}
|
|
42
42
|
/>
|
|
43
|
+
|
|
44
|
+
<Story
|
|
45
|
+
name="With Capture Interval"
|
|
46
|
+
args={{
|
|
47
|
+
xAxisCategories: ['0', '1', '2', '3', '4', '5', '6'],
|
|
48
|
+
series: [
|
|
49
|
+
{ name: 'Halo', data: [120, 132, 101, 134, 90, 230, 210] },
|
|
50
|
+
{ name: 'Spot', data: [220, 182, 191, 234, 290, 330, 310] },
|
|
51
|
+
{ name: 'Microbial', data: [150, 232, 201, 154, 190, 330, 410] }
|
|
52
|
+
],
|
|
53
|
+
height: '400px',
|
|
54
|
+
xAxisName: 'Time',
|
|
55
|
+
yAxisName: 'Count',
|
|
56
|
+
captureInterval: 3600
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
<Story
|
|
61
|
+
name="With Capture Interval - Short Duration"
|
|
62
|
+
args={{
|
|
63
|
+
xAxisCategories: ['0', '1', '2', '3', '4', '5', '6'],
|
|
64
|
+
series: [
|
|
65
|
+
{ name: 'Halo', data: [120, 132, 101, 134, 90, 230, 210] },
|
|
66
|
+
{ name: 'Spot', data: [220, 182, 191, 234, 290, 330, 310] },
|
|
67
|
+
{ name: 'Microbial', data: [150, 232, 201, 154, 190, 330, 410] }
|
|
68
|
+
],
|
|
69
|
+
height: '400px',
|
|
70
|
+
xAxisName: 'Time',
|
|
71
|
+
yAxisName: 'Count',
|
|
72
|
+
captureInterval: 600
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
@@ -3,25 +3,28 @@
|
|
|
3
3
|
import Chart, { type GenericChartProps } from '../chart/Chart.svelte';
|
|
4
4
|
import type { EChartsOption, BarSeriesOption } from 'echarts';
|
|
5
5
|
import type { CallbackDataParams } from 'echarts/types/dist/shared';
|
|
6
|
+
import { Duration } from 'luxon';
|
|
6
7
|
|
|
7
8
|
type StackedSeriesItem = {
|
|
8
9
|
name: string;
|
|
9
10
|
data: (number | null)[];
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
interface StackedBarChartProps extends GenericChartProps {
|
|
13
14
|
xAxisCategories: (string | number)[];
|
|
14
15
|
series: StackedSeriesItem[];
|
|
15
16
|
colors?: Record<string, string>; // Optional: Color mapping per series name
|
|
16
17
|
rotateXAxisLabels?: boolean;
|
|
17
18
|
grid?: EChartsOption['grid'];
|
|
18
|
-
|
|
19
|
+
captureInterval?: number;
|
|
20
|
+
}
|
|
19
21
|
|
|
20
22
|
let {
|
|
21
23
|
xAxisCategories,
|
|
22
24
|
series,
|
|
23
25
|
colors,
|
|
24
26
|
rotateXAxisLabels = false,
|
|
27
|
+
captureInterval,
|
|
25
28
|
...props
|
|
26
29
|
}: StackedBarChartProps = $props();
|
|
27
30
|
|
|
@@ -38,6 +41,16 @@
|
|
|
38
41
|
|
|
39
42
|
const xAxisData = $derived(xAxisCategories);
|
|
40
43
|
|
|
44
|
+
const captureIntervals = captureInterval
|
|
45
|
+
? Array(xAxisCategories.length)
|
|
46
|
+
.fill(null)
|
|
47
|
+
.map((_, timeIndex) => {
|
|
48
|
+
const seconds = timeIndex * captureInterval;
|
|
49
|
+
const duration = Duration.fromObject({ seconds }).shiftTo('days', 'hours', 'minutes');
|
|
50
|
+
return duration.days >= 1 ? duration.toFormat('dd:hh:mm') : duration.toFormat('hh:mm');
|
|
51
|
+
})
|
|
52
|
+
: undefined;
|
|
53
|
+
|
|
41
54
|
const createBarDataItem = (value: number | null, color: string) => ({
|
|
42
55
|
value,
|
|
43
56
|
itemStyle: {
|
|
@@ -135,7 +148,7 @@
|
|
|
135
148
|
},
|
|
136
149
|
xAxis: {
|
|
137
150
|
type: 'category',
|
|
138
|
-
data: xAxisData,
|
|
151
|
+
data: captureIntervals || xAxisData,
|
|
139
152
|
axisTick: {
|
|
140
153
|
show: false,
|
|
141
154
|
alignWithLabel: true
|
|
@@ -4,13 +4,14 @@ type StackedSeriesItem = {
|
|
|
4
4
|
name: string;
|
|
5
5
|
data: (number | null)[];
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
interface StackedBarChartProps extends GenericChartProps {
|
|
8
8
|
xAxisCategories: (string | number)[];
|
|
9
9
|
series: StackedSeriesItem[];
|
|
10
10
|
colors?: Record<string, string>;
|
|
11
11
|
rotateXAxisLabels?: boolean;
|
|
12
12
|
grid?: EChartsOption['grid'];
|
|
13
|
-
|
|
13
|
+
captureInterval?: number;
|
|
14
|
+
}
|
|
14
15
|
declare const StackedBarChart: import("svelte").Component<StackedBarChartProps, {}, "">;
|
|
15
16
|
type StackedBarChart = ReturnType<typeof StackedBarChart>;
|
|
16
17
|
export default StackedBarChart;
|
|
@@ -54,9 +54,6 @@
|
|
|
54
54
|
<!-- Custom Size -->
|
|
55
55
|
<Story name="Custom Size" args={{ options: baseOptions, ...defaultProps }} />
|
|
56
56
|
|
|
57
|
-
<!-- Loading State -->
|
|
58
|
-
<Story name="Loading State" args={{ options: baseOptions, ...defaultProps, loading: true }} />
|
|
59
|
-
|
|
60
57
|
<!-- With Events -->
|
|
61
58
|
<Story
|
|
62
59
|
name="With Click Events"
|
|
@@ -51,19 +51,7 @@
|
|
|
51
51
|
/>
|
|
52
52
|
</div>
|
|
53
53
|
</Story>
|
|
54
|
-
|
|
55
|
-
<div class="h-[400px] w-full">
|
|
56
|
-
<LineChart
|
|
57
|
-
{xAxisName}
|
|
58
|
-
{yAxisName}
|
|
59
|
-
{data}
|
|
60
|
-
loading
|
|
61
|
-
onitemclick={handleItemClick}
|
|
62
|
-
onmouseover={handleMouseOver}
|
|
63
|
-
onmouseout={handleMouseOut}
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
</Story>
|
|
54
|
+
|
|
67
55
|
<Story name="Large datasets with capture intervals" asChild>
|
|
68
56
|
<div class="h-[400px] w-full">
|
|
69
57
|
<LineChart
|
|
@@ -121,6 +109,26 @@
|
|
|
121
109
|
<LineChart {xAxisName} yAxisName="Value" data={[10, 8, 13, 7, 9, 6, 11]} timeIndex={3} />
|
|
122
110
|
</div>
|
|
123
111
|
</Story>
|
|
112
|
+
<Story name="With Capture Interval" asChild>
|
|
113
|
+
<div class="h-[400px] w-full">
|
|
114
|
+
<LineChart
|
|
115
|
+
{xAxisName}
|
|
116
|
+
yAxisName="Value"
|
|
117
|
+
data={[10, 8, 13, 7, 9, 6, 11, 15, 12, 8, 14, 16]}
|
|
118
|
+
captureInterval={3600}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
</Story>
|
|
122
|
+
<Story name="With Capture Interval - Short Duration" asChild>
|
|
123
|
+
<div class="h-[400px] w-full">
|
|
124
|
+
<LineChart
|
|
125
|
+
{xAxisName}
|
|
126
|
+
yAxisName="Value"
|
|
127
|
+
data={[10, 8, 13, 7, 9, 6, 11, 15, 12, 8, 14, 16]}
|
|
128
|
+
captureInterval={600}
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
</Story>
|
|
124
132
|
<Story
|
|
125
133
|
name="Interactive Current Location"
|
|
126
134
|
asChild
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
import * as echarts from 'echarts/core';
|
|
6
6
|
import type { GenericChartProps } from '../chart/Chart.svelte';
|
|
7
7
|
import { createTooltipFormatter } from '../utils/tooltipFormatter';
|
|
8
|
+
import { Duration } from 'luxon';
|
|
8
9
|
|
|
9
10
|
interface LineChartProps extends GenericChartProps {
|
|
10
11
|
data: (number | null)[];
|
|
11
12
|
withArea?: boolean;
|
|
12
13
|
color?: string;
|
|
13
14
|
grid?: EChartsOption['grid'];
|
|
15
|
+
captureInterval?: number;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
let {
|
|
@@ -19,6 +21,7 @@
|
|
|
19
21
|
yAxisName,
|
|
20
22
|
withArea = false,
|
|
21
23
|
color = textColor['icon-blue'],
|
|
24
|
+
captureInterval,
|
|
22
25
|
...props
|
|
23
26
|
}: LineChartProps = $props();
|
|
24
27
|
|
|
@@ -37,6 +40,16 @@
|
|
|
37
40
|
maximumFractionDigits: fractionDigits
|
|
38
41
|
}) ?? '';
|
|
39
42
|
|
|
43
|
+
const captureIntervals = captureInterval
|
|
44
|
+
? Array(data.length)
|
|
45
|
+
.fill(null)
|
|
46
|
+
.map((_, timeIndex) => {
|
|
47
|
+
const seconds = timeIndex * captureInterval;
|
|
48
|
+
const duration = Duration.fromObject({ seconds }).shiftTo('days', 'hours', 'minutes');
|
|
49
|
+
return duration.days >= 1 ? duration.toFormat('dd:hh:mm') : duration.toFormat('hh:mm');
|
|
50
|
+
})
|
|
51
|
+
: undefined;
|
|
52
|
+
|
|
40
53
|
let options: EChartsOption = $derived({
|
|
41
54
|
grid: {
|
|
42
55
|
top: 10,
|
|
@@ -55,26 +68,7 @@
|
|
|
55
68
|
axisLine: {
|
|
56
69
|
onZero: false
|
|
57
70
|
},
|
|
58
|
-
|
|
59
|
-
interval: (index: number, value: string) => {
|
|
60
|
-
const dataLength = data.length;
|
|
61
|
-
if (dataLength <= 1) return true; // Show label if only one point
|
|
62
|
-
|
|
63
|
-
const targetLabelCount = 10; // Aim for about 10 labels
|
|
64
|
-
// Calculate interval, ensuring it's at least 1
|
|
65
|
-
const calculatedInterval = Math.max(1, Math.ceil(dataLength / targetLabelCount));
|
|
66
|
-
|
|
67
|
-
// Show the first label (index 0)
|
|
68
|
-
if (index === 0) return true;
|
|
69
|
-
// Show the last label if data exists
|
|
70
|
-
if (dataLength > 0 && index === dataLength - 1) return true;
|
|
71
|
-
// Show labels at the calculated interval, but not the last one if it was already shown
|
|
72
|
-
if (index % calculatedInterval === 0 && index !== dataLength - 1) return true;
|
|
73
|
-
// Hide others
|
|
74
|
-
return false;
|
|
75
|
-
},
|
|
76
|
-
hideOverlap: true
|
|
77
|
-
},
|
|
71
|
+
data: captureIntervals,
|
|
78
72
|
...props.xAxisOptions
|
|
79
73
|
} as any as EChartsOption['xAxis'],
|
|
80
74
|
yAxis: {
|
|
@@ -5,6 +5,7 @@ interface LineChartProps extends GenericChartProps {
|
|
|
5
5
|
withArea?: boolean;
|
|
6
6
|
color?: string;
|
|
7
7
|
grid?: EChartsOption['grid'];
|
|
8
|
+
captureInterval?: number;
|
|
8
9
|
}
|
|
9
10
|
declare const LineChart: import("svelte").Component<LineChartProps, {}, "">;
|
|
10
11
|
type LineChart = ReturnType<typeof LineChart>;
|
|
@@ -81,20 +81,6 @@
|
|
|
81
81
|
</div>
|
|
82
82
|
</Story>
|
|
83
83
|
|
|
84
|
-
<Story name="Loading" asChild>
|
|
85
|
-
<div class="h-[500px] w-full">
|
|
86
|
-
<Matrix
|
|
87
|
-
data={confusionMatrix}
|
|
88
|
-
{rowLabels}
|
|
89
|
-
{colLabels}
|
|
90
|
-
loading={true}
|
|
91
|
-
invertYAxis={true}
|
|
92
|
-
xAxisName="Model count"
|
|
93
|
-
yAxisName="Manual count"
|
|
94
|
-
/>
|
|
95
|
-
</div>
|
|
96
|
-
</Story>
|
|
97
|
-
|
|
98
84
|
<Story name="Multiple Classes" asChild>
|
|
99
85
|
<div class="h-[500px] w-full">
|
|
100
86
|
<Matrix
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
// Import the specific type to resolve mismatch
|
|
4
3
|
import type { ECElementEvent } from 'echarts';
|
|
5
|
-
|
|
6
4
|
import MultiLineChart from './MultiLineChart.svelte';
|
|
7
5
|
|
|
8
6
|
const { Story } = defineMeta({
|
|
@@ -16,40 +14,31 @@
|
|
|
16
14
|
const xAxisName = 'Time';
|
|
17
15
|
const yAxisName = 'Value';
|
|
18
16
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
50
|
|
32
|
-
]; // length 25
|
|
33
|
-
const rawDataGroup2 = [
|
|
34
|
-
5, 7, 9, 8, 10, 12, 14, 13, 15, 17, 19, 18, 20, 22, 24, 23, 25, 27, 29, 28
|
|
35
|
-
]; // length 20
|
|
36
|
-
const rawDataGroup3 = [
|
|
37
|
-
20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66,
|
|
38
|
-
68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88
|
|
39
|
-
]; // length 35
|
|
17
|
+
const staticSmoothedData1 = [
|
|
18
|
+
12.333333333333334, 13.5, 14.8, 15.6, 17.4, 19.8, 22.2, 23.6, 25.2, 26.8, 29, 31.6, 33.8, 34.8,
|
|
19
|
+
36.4, 37.6, 40.2, 42.4, 44.4, 45.6, 46.4, 46.75, 48.25, 49, 49.333333333333336
|
|
20
|
+
];
|
|
21
|
+
const staticSmoothedData2 = [
|
|
22
|
+
7, 8, 8.8, 10.2, 11.8, 13.2, 14.8, 16.2, 17.6, 18.4, 19.2, 20.6, 22.4, 23.6, 24.8, 25.8, 27,
|
|
23
|
+
27.75, 28.5, 28.5
|
|
24
|
+
];
|
|
25
|
+
const staticSmoothedData3 = [
|
|
26
|
+
22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68,
|
|
27
|
+
70, 72, 74, 76, 78, 80, 82, 84, 86, 87, 88
|
|
28
|
+
];
|
|
40
29
|
|
|
41
30
|
const data = [
|
|
42
31
|
{
|
|
43
32
|
key: 'Group 1',
|
|
44
|
-
series:
|
|
33
|
+
series: staticSmoothedData1
|
|
45
34
|
},
|
|
46
35
|
{
|
|
47
36
|
key: 'Group 2',
|
|
48
|
-
series:
|
|
37
|
+
series: staticSmoothedData2
|
|
49
38
|
},
|
|
50
39
|
{
|
|
51
40
|
key: 'Group 3',
|
|
52
|
-
series:
|
|
41
|
+
series: staticSmoothedData3
|
|
53
42
|
}
|
|
54
43
|
];
|
|
55
44
|
|
|
@@ -77,20 +66,6 @@
|
|
|
77
66
|
</div>
|
|
78
67
|
</Story>
|
|
79
68
|
|
|
80
|
-
<Story name="Loading" asChild>
|
|
81
|
-
<div class="h-[400px] w-full">
|
|
82
|
-
<MultiLineChart
|
|
83
|
-
{xAxisName}
|
|
84
|
-
{yAxisName}
|
|
85
|
-
{data}
|
|
86
|
-
loading
|
|
87
|
-
onitemclick={handleItemClick}
|
|
88
|
-
onmouseover={handleMouseOver}
|
|
89
|
-
onmouseout={handleMouseOut}
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
-
</Story>
|
|
93
|
-
|
|
94
69
|
<Story name="With Area Gradient" asChild>
|
|
95
70
|
<div class="h-[400px] w-full">
|
|
96
71
|
<MultiLineChart
|
|
@@ -116,26 +116,6 @@
|
|
|
116
116
|
onZero: false
|
|
117
117
|
},
|
|
118
118
|
data: captureIntervals,
|
|
119
|
-
axisLabel: {
|
|
120
|
-
interval: (index: number, value: string) => {
|
|
121
|
-
const dataLength = longestSeries;
|
|
122
|
-
if (dataLength <= 1) return true; // Show label if only one point
|
|
123
|
-
|
|
124
|
-
const targetLabelCount = 10; // Aim for about 10 labels
|
|
125
|
-
// Calculate interval, ensuring it's at least 1
|
|
126
|
-
const calculatedInterval = Math.max(1, Math.ceil(dataLength / targetLabelCount));
|
|
127
|
-
|
|
128
|
-
// Show the first label (index 0)
|
|
129
|
-
if (index === 0) return true;
|
|
130
|
-
// Show the last label if data exists
|
|
131
|
-
if (dataLength > 0 && index === dataLength - 1) return true;
|
|
132
|
-
// Show labels at the calculated interval, but not the last one if it was already shown
|
|
133
|
-
if (index % calculatedInterval === 0 && index !== dataLength - 1) return true;
|
|
134
|
-
// Hide others
|
|
135
|
-
return false;
|
|
136
|
-
},
|
|
137
|
-
hideOverlap: true
|
|
138
|
-
},
|
|
139
119
|
...props.xAxisOptions
|
|
140
120
|
},
|
|
141
121
|
yAxis: {
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
withBackground?: boolean;
|
|
10
10
|
size?: 'sm' | 'md' | 'lg';
|
|
11
11
|
class?: string;
|
|
12
|
+
disabled?: boolean;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
let { model, withBackground, size = 'md', class: className }: Props = $props();
|
|
15
|
+
let { model, withBackground, size = 'md', class: className, disabled = false }: Props = $props();
|
|
15
16
|
|
|
16
17
|
const getIconSize = () => {
|
|
17
18
|
switch (size) {
|
|
@@ -25,6 +26,10 @@
|
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
const backgroundColor = (analysis: SupportedAnalysisModelIcons) => {
|
|
29
|
+
if (disabled) {
|
|
30
|
+
return 'bg-neutral';
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
switch (analysis) {
|
|
29
34
|
case 'pipeline_halos':
|
|
30
35
|
return 'bg-warning';
|
|
@@ -46,6 +51,10 @@
|
|
|
46
51
|
};
|
|
47
52
|
|
|
48
53
|
const mapAnalysisToColor = (analysis: SupportedAnalysisModelIcons): IconColor => {
|
|
54
|
+
if (disabled) {
|
|
55
|
+
return 'secondary';
|
|
56
|
+
}
|
|
57
|
+
|
|
49
58
|
switch (analysis) {
|
|
50
59
|
case 'pipeline_halos':
|
|
51
60
|
return 'warning';
|
|
@@ -2,7 +2,7 @@ import type { IconComponentProps } from 'phosphor-svelte';
|
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { textColor } from './../../tokens';
|
|
4
4
|
export type PhosphorIconProps = Component<IconComponentProps, object, ''>;
|
|
5
|
-
export type IconName = 'Aperture' | 'ArrowFatLineRight' | 'ArrowCounterClockwise' | 'ArrowRight' | 'ArrowUpRight' | 'ArrowUpLeft' | 'ArrowUUpLeft' | 'Barcode' | 'Bell' | 'BookOpen' | 'BookOpenText' | 'BowlingBall' | 'BugBeetle' | 'Calendar' | 'CalendarBlank' | 'Camera' | 'CameraSlash' | 'CaretDown' | 'CaretLeft' | 'CaretRight' | 'CaretUp' | 'CaretUpDown' | 'ChatTeardropDots' | 'Check' | 'CheckCircle' | 'CheckFat' | 'Circle' | 'CircleDashed' | 'CircleHalf' | 'CirclesFour' | 'CirclesThreePlus' | 'Clock' | 'ClockCountdown' | 'Copy' | 'Crop' | 'Cube' | 'Database' | 'DotsThree' | 'DotsThreeOutlineVertical' | 'DownloadSimple' | 'Drop' | 'EnvelopeSimple' | 'Eye' | 'Eyedropper' | 'FileCsv' | 'Flag' | 'Flask' | 'Folder' | 'FolderDashed' | 'FolderSimplePlus' | 'FunnelSimple' | 'Gear' | 'GlobeSimple' | 'GlobeSimpleX' | 'GridFour' | 'Hash' | 'House' | 'ImageSquare' | 'ImagesSquare' | 'Info' | 'Lock' | 'LineSegments' | 'List' | 'MagnifyingGlass' | 'MegaphoneSimple' | 'Moon' | 'Minus' | 'Palette' | 'Pause' | 'Pencil' | 'PencilSimple' | 'Percent' | 'Phone' | 'Plant' | 'Play' | 'Plus' | 'PlusMinus' | 'Question' | 'SealCheck' | 'RadioButton' | 'SealQuestion' | 'SealWarning' | 'SelectionAll' | 'Share' | 'SidebarSimple' | 'SkipBack' | 'SkipForward' | 'SignIn' | 'SignOut' | 'SortAscending' | 'Sparkle' | 'SpinnerGap' | 'SquaresFour' | 'Star' | 'Stop' | 'StopCircle' | 'Sun' | 'Table' | 'Tag' | 'Target' | 'TestTube' | 'Trash' | 'TrashSimple' | 'UserCircle' | 'UserPlus' | 'Video' | 'Warning' | 'WarningCircle' | 'WifiSlash' | 'X';
|
|
5
|
+
export type IconName = 'Aperture' | 'ArrowFatLineRight' | 'ArrowCounterClockwise' | 'ArrowRight' | 'ArrowUpRight' | 'ArrowUpLeft' | 'ArrowUUpLeft' | 'Barcode' | 'Bell' | 'BookOpen' | 'BookOpenText' | 'BowlingBall' | 'BugBeetle' | 'Calendar' | 'CalendarBlank' | 'Camera' | 'CameraSlash' | 'CaretDown' | 'CaretLeft' | 'CaretRight' | 'CaretUp' | 'CaretUpDown' | 'ChatTeardropDots' | 'Check' | 'CheckCircle' | 'CheckFat' | 'Circle' | 'CircleDashed' | 'CircleHalf' | 'CirclesFour' | 'CirclesThreePlus' | 'Clock' | 'ClockCountdown' | 'Copy' | 'Crop' | 'Cube' | 'Database' | 'Dna' | 'DotsThree' | 'DotsThreeOutlineVertical' | 'DownloadSimple' | 'Drop' | 'EnvelopeSimple' | 'Eye' | 'Eyedropper' | 'FileCsv' | 'Flag' | 'Flask' | 'Folder' | 'FolderDashed' | 'FolderSimplePlus' | 'FunnelSimple' | 'Gear' | 'GlobeSimple' | 'GlobeSimpleX' | 'GridFour' | 'Hash' | 'House' | 'ImageSquare' | 'ImagesSquare' | 'Info' | 'Lock' | 'LineSegments' | 'List' | 'Link' | 'ListMagnifyingGlass' | 'MagnifyingGlass' | 'MegaphoneSimple' | 'MicrosoftExcelLogo' | 'Moon' | 'Minus' | 'Palette' | 'Pause' | 'Pencil' | 'PencilSimple' | 'Percent' | 'Phone' | 'Plant' | 'Play' | 'Plus' | 'PlusMinus' | 'Ruler' | 'Question' | 'SealCheck' | 'RadioButton' | 'SealQuestion' | 'SealWarning' | 'SelectionAll' | 'Share' | 'SidebarSimple' | 'SkipBack' | 'SkipForward' | 'SignIn' | 'SignOut' | 'SortAscending' | 'Sparkle' | 'SpinnerGap' | 'SquaresFour' | 'Star' | 'Stop' | 'StopCircle' | 'Sun' | 'Table' | 'Tag' | 'Target' | 'TestTube' | 'Trash' | 'TrashSimple' | 'TreeStructure' | 'UserCircle' | 'UserPlus' | 'Video' | 'Warning' | 'WarningCircle' | 'WifiSlash' | 'X';
|
|
6
6
|
export declare const iconMap: Record<IconName, PhosphorIconProps>;
|
|
7
7
|
export declare function renderIcon(iconName: keyof typeof iconMap): PhosphorIconProps;
|
|
8
8
|
export type IconColor = keyof typeof textColor;
|