@reshape-biotech/design-system 0.0.47 → 0.0.48
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/app.css +115 -0
- package/dist/components/activity/Activity.stories.svelte +100 -0
- package/dist/components/activity/Activity.stories.svelte.d.ts +19 -0
- package/dist/components/activity/Activity.svelte +80 -0
- package/dist/components/activity/Activity.svelte.d.ts +18 -0
- package/dist/components/activity/index.d.ts +1 -0
- package/dist/components/activity/index.js +1 -0
- package/dist/components/avatar/Avatar.svelte +63 -0
- package/dist/components/avatar/Avatar.svelte.d.ts +8 -0
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/banner/Banner.stories.svelte +129 -0
- package/dist/components/banner/Banner.stories.svelte.d.ts +19 -0
- package/dist/components/banner/Banner.svelte +59 -0
- package/dist/components/banner/Banner.svelte.d.ts +11 -0
- package/dist/components/banner/index.d.ts +1 -0
- package/dist/components/banner/index.js +1 -0
- package/dist/components/button/Button.stories.svelte +37 -0
- package/dist/components/button/Button.stories.svelte.d.ts +19 -0
- package/dist/components/button/Button.svelte +263 -0
- package/dist/components/button/Button.svelte.d.ts +20 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/collapsible/Collapsible.stories.svelte +40 -0
- package/dist/components/collapsible/Collapsible.stories.svelte.d.ts +19 -0
- package/dist/components/collapsible/components/collapsible-content.svelte +26 -0
- package/dist/components/collapsible/components/collapsible-content.svelte.d.ts +10 -0
- package/dist/components/collapsible/components/collapsible-trigger.svelte +36 -0
- package/dist/components/collapsible/components/collapsible-trigger.svelte.d.ts +4 -0
- package/dist/components/collapsible/index.d.ts +5 -0
- package/dist/components/collapsible/index.js +4 -0
- package/dist/components/collapsible/types.d.ts +9 -0
- package/dist/components/collapsible/types.js +1 -0
- package/dist/components/combobox/Combobox.stories.svelte +119 -0
- package/dist/components/combobox/Combobox.stories.svelte.d.ts +19 -0
- package/dist/components/combobox/components/combobox-add.svelte +30 -0
- package/dist/components/combobox/components/combobox-add.svelte.d.ts +8 -0
- package/dist/components/combobox/components/combobox-content.svelte +137 -0
- package/dist/components/combobox/components/combobox-content.svelte.d.ts +4 -0
- package/dist/components/combobox/components/combobox-indicator.svelte +5 -0
- package/dist/components/combobox/components/combobox-indicator.svelte.d.ts +18 -0
- package/dist/components/combobox/index.d.ts +14 -0
- package/dist/components/combobox/index.js +15 -0
- package/dist/components/combobox/types.d.ts +20 -0
- package/dist/components/combobox/types.js +1 -0
- package/dist/components/datepicker/DatePicker.svelte +344 -0
- package/dist/components/datepicker/DatePicker.svelte.d.ts +8 -0
- package/dist/components/datepicker/index.d.ts +1 -0
- package/dist/components/datepicker/index.js +1 -0
- package/dist/components/divider/Divider.stories.svelte +14 -0
- package/dist/components/divider/Divider.stories.svelte.d.ts +27 -0
- package/dist/components/divider/Divider.svelte +9 -0
- package/dist/components/divider/Divider.svelte.d.ts +6 -0
- package/dist/components/divider/index.d.ts +1 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/drawer/Drawer.stories.svelte +64 -0
- package/dist/components/drawer/Drawer.stories.svelte.d.ts +27 -0
- package/dist/components/drawer/Drawer.svelte +41 -0
- package/dist/components/drawer/Drawer.svelte.d.ts +12 -0
- package/dist/components/drawer/DrawerLabel.svelte +62 -0
- package/dist/components/drawer/DrawerLabel.svelte.d.ts +9 -0
- package/dist/components/drawer/index.d.ts +1 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/dropdown/Dropdown.stories.svelte +236 -0
- package/dist/components/dropdown/Dropdown.stories.svelte.d.ts +27 -0
- package/dist/components/dropdown/Dropdown.svelte +69 -0
- package/dist/components/dropdown/Dropdown.svelte.d.ts +26 -0
- package/dist/components/dropdown/components/DropdownContent.svelte +29 -0
- package/dist/components/dropdown/components/DropdownContent.svelte.d.ts +10 -0
- package/dist/components/dropdown/components/DropdownMenu.svelte +23 -0
- package/dist/components/dropdown/components/DropdownMenu.svelte.d.ts +8 -0
- package/dist/components/dropdown/components/DropdownTrigger.svelte +46 -0
- package/dist/components/dropdown/components/DropdownTrigger.svelte.d.ts +13 -0
- package/dist/components/dropdown/components/OutlinedButton.svelte +61 -0
- package/dist/components/dropdown/components/OutlinedButton.svelte.d.ts +8 -0
- package/dist/components/dropdown/index.d.ts +1 -0
- package/dist/components/dropdown/index.js +1 -0
- package/dist/components/empty-content/EmptyContent.svelte +19 -0
- package/dist/components/empty-content/EmptyContent.svelte.d.ts +8 -0
- package/dist/components/graphs/chart/Chart.stories.svelte +128 -0
- package/dist/components/graphs/chart/Chart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/chart/Chart.svelte +145 -0
- package/dist/components/graphs/chart/Chart.svelte.d.ts +17 -0
- package/dist/components/graphs/index.d.ts +4 -0
- package/dist/components/graphs/index.js +4 -0
- package/dist/components/graphs/line/LineChart.stories.svelte +73 -0
- package/dist/components/graphs/line/LineChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/line/LineChart.svelte +102 -0
- package/dist/components/graphs/line/LineChart.svelte.d.ts +18 -0
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte +77 -0
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/multiline/MultiLineChart.svelte +108 -0
- package/dist/components/graphs/multiline/MultiLineChart.svelte.d.ts +22 -0
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte +78 -0
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/scatterplot/Scatterplot.svelte +67 -0
- package/dist/components/graphs/scatterplot/Scatterplot.svelte.d.ts +16 -0
- package/dist/components/icon-button/IconButton.stories.svelte +82 -0
- package/dist/components/icon-button/IconButton.stories.svelte.d.ts +19 -0
- package/dist/components/icon-button/IconButton.svelte +152 -0
- package/dist/components/icon-button/IconButton.svelte.d.ts +16 -0
- package/dist/components/icon-button/index.d.ts +1 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/icons/AnalysisIcon.stories.svelte +38 -0
- package/dist/components/icons/AnalysisIcon.stories.svelte.d.ts +27 -0
- package/dist/components/icons/AnalysisIcon.svelte +110 -0
- package/dist/components/icons/AnalysisIcon.svelte.d.ts +10 -0
- package/dist/components/icons/Icon.svelte +23 -0
- package/dist/components/icons/Icon.svelte.d.ts +4 -0
- package/dist/components/icons/custom/Halo.svelte +32 -0
- package/dist/components/icons/custom/Halo.svelte.d.ts +26 -0
- package/dist/components/icons/custom/Well.svelte +26 -0
- package/dist/components/icons/custom/Well.svelte.d.ts +26 -0
- package/dist/components/icons/index.d.ts +17 -0
- package/dist/components/icons/index.js +21 -0
- package/dist/components/icons/types.d.ts +0 -0
- package/dist/components/icons/types.js +1 -0
- package/dist/components/image/Image.svelte +55 -0
- package/dist/components/image/Image.svelte.d.ts +7 -0
- package/dist/components/image/index.d.ts +1 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/input/Input.stories.svelte +87 -0
- package/dist/components/input/Input.stories.svelte.d.ts +27 -0
- package/dist/components/input/Input.svelte +204 -0
- package/dist/components/input/Input.svelte.d.ts +24 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/list/List.stories.svelte +97 -0
- package/dist/components/list/List.stories.svelte.d.ts +19 -0
- package/dist/components/list/List.svelte +69 -0
- package/dist/components/list/List.svelte.d.ts +24 -0
- package/dist/components/list/index.d.ts +1 -0
- package/dist/components/list/index.js +1 -0
- package/dist/components/logo/Logo.stories.svelte +21 -0
- package/dist/components/logo/Logo.stories.svelte.d.ts +27 -0
- package/dist/components/logo/Logo.svelte +39 -0
- package/dist/components/logo/Logo.svelte.d.ts +7 -0
- package/dist/components/logo/index.d.ts +1 -0
- package/dist/components/logo/index.js +1 -0
- package/dist/components/markdown/Markdown.stories.svelte +41 -0
- package/dist/components/markdown/Markdown.stories.svelte.d.ts +27 -0
- package/dist/components/markdown/Markdown.svelte +12 -0
- package/dist/components/markdown/Markdown.svelte.d.ts +6 -0
- package/dist/components/markdown/index.d.ts +1 -0
- package/dist/components/markdown/index.js +1 -0
- package/dist/components/modal/Modal.stories.svelte +39 -0
- package/dist/components/modal/Modal.stories.svelte.d.ts +19 -0
- package/dist/components/modal/Modal.svelte +76 -0
- package/dist/components/modal/Modal.svelte.d.ts +17 -0
- package/dist/components/modal/index.d.ts +1 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/notification-popup/NotificationPopup.stories.svelte +27 -0
- package/dist/components/notification-popup/NotificationPopup.stories.svelte.d.ts +27 -0
- package/dist/components/notification-popup/NotificationPopup.svelte +33 -0
- package/dist/components/notification-popup/NotificationPopup.svelte.d.ts +11 -0
- package/dist/components/notification-popup/index.d.ts +1 -0
- package/dist/components/notification-popup/index.js +1 -0
- package/dist/components/pill/Pill.svelte +39 -0
- package/dist/components/pill/Pill.svelte.d.ts +10 -0
- package/dist/components/pill/index.d.ts +1 -0
- package/dist/components/pill/index.js +1 -0
- package/dist/components/progress-circle/ProgressCircle.svelte +79 -0
- package/dist/components/progress-circle/ProgressCircle.svelte.d.ts +7 -0
- package/dist/components/progress-circle/index.d.ts +1 -0
- package/dist/components/progress-circle/index.js +1 -0
- package/dist/components/segmented-control-buttons/ControlButton.svelte +57 -0
- package/dist/components/segmented-control-buttons/ControlButton.svelte.d.ts +14 -0
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.stories.svelte +45 -0
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.stories.svelte.d.ts +19 -0
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.svelte +21 -0
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.svelte.d.ts +12 -0
- package/dist/components/segmented-control-buttons/index.d.ts +1 -0
- package/dist/components/segmented-control-buttons/index.js +1 -0
- package/dist/components/select/Select.stories.svelte +113 -0
- package/dist/components/select/Select.stories.svelte.d.ts +19 -0
- package/dist/components/select/Select.svelte +141 -0
- package/dist/components/select/Select.svelte.d.ts +60 -0
- package/dist/components/select/index.d.ts +7 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/skeleton-loader/SkeletonLoader.stories.svelte +45 -0
- package/dist/components/skeleton-loader/SkeletonLoader.stories.svelte.d.ts +27 -0
- package/dist/components/skeleton-loader/SkeletonLoader.svelte +17 -0
- package/dist/components/skeleton-loader/SkeletonLoader.svelte.d.ts +14 -0
- package/dist/components/skeleton-loader/StatcardSkeleton.svelte +14 -0
- package/dist/components/skeleton-loader/StatcardSkeleton.svelte.d.ts +18 -0
- package/dist/components/skeleton-loader/components/Skeleton.svelte +14 -0
- package/dist/components/skeleton-loader/components/Skeleton.svelte.d.ts +8 -0
- package/dist/components/skeleton-loader/components/SkeletonImage.svelte +14 -0
- package/dist/components/skeleton-loader/components/SkeletonImage.svelte.d.ts +26 -0
- package/dist/components/skeleton-loader/index.d.ts +3 -0
- package/dist/components/skeleton-loader/index.js +3 -0
- package/dist/components/slider/Slider.stories.svelte +37 -0
- package/dist/components/slider/Slider.stories.svelte.d.ts +27 -0
- package/dist/components/slider/Slider.svelte +126 -0
- package/dist/components/slider/Slider.svelte.d.ts +31 -0
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/spinner/Spinner.svelte +27 -0
- package/dist/components/spinner/Spinner.svelte.d.ts +6 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/stat-card/StatCard.stories.svelte +32 -0
- package/dist/components/stat-card/StatCard.stories.svelte.d.ts +27 -0
- package/dist/components/stat-card/StatCard.svelte +52 -0
- package/dist/components/stat-card/StatCard.svelte.d.ts +10 -0
- package/dist/components/stat-card/index.d.ts +1 -0
- package/dist/components/stat-card/index.js +1 -0
- package/dist/components/status-badge/StatusBadge.stories.svelte +401 -0
- package/dist/components/status-badge/StatusBadge.stories.svelte.d.ts +19 -0
- package/dist/components/status-badge/StatusBadge.svelte +147 -0
- package/dist/components/status-badge/StatusBadge.svelte.d.ts +12 -0
- package/dist/components/status-badge/index.d.ts +1 -0
- package/dist/components/status-badge/index.js +1 -0
- package/dist/components/table/Table.stories.svelte +90 -0
- package/dist/components/table/Table.stories.svelte.d.ts +24 -0
- package/dist/components/table/Table.svelte +47 -0
- package/dist/components/table/Table.svelte.d.ts +21 -0
- package/dist/components/table/components/TBody.svelte +14 -0
- package/dist/components/table/components/TBody.svelte.d.ts +8 -0
- package/dist/components/table/components/THead.svelte +14 -0
- package/dist/components/table/components/THead.svelte.d.ts +8 -0
- package/dist/components/table/components/Td.svelte +14 -0
- package/dist/components/table/components/Td.svelte.d.ts +8 -0
- package/dist/components/table/components/Th.svelte +15 -0
- package/dist/components/table/components/Th.svelte.d.ts +9 -0
- package/dist/components/table/components/Tr.svelte +31 -0
- package/dist/components/table/components/Tr.svelte.d.ts +8 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/tabs/Tabs.stories.svelte +28 -0
- package/dist/components/tabs/Tabs.stories.svelte.d.ts +27 -0
- package/dist/components/tabs/Tabs.svelte +13 -0
- package/dist/components/tabs/Tabs.svelte.d.ts +14 -0
- package/dist/components/tabs/components/Content.svelte +15 -0
- package/dist/components/tabs/components/Content.svelte.d.ts +9 -0
- package/dist/components/tabs/components/Tab.svelte +21 -0
- package/dist/components/tabs/components/Tab.svelte.d.ts +10 -0
- package/dist/components/tabs/components/Tabs.svelte +14 -0
- package/dist/components/tabs/components/Tabs.svelte.d.ts +8 -0
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tag/Tag.stories.svelte +51 -0
- package/dist/components/tag/Tag.stories.svelte.d.ts +19 -0
- package/dist/components/tag/Tag.svelte +102 -0
- package/dist/components/tag/Tag.svelte.d.ts +12 -0
- package/dist/components/tag/index.d.ts +1 -0
- package/dist/components/tag/index.js +1 -0
- package/dist/components/toggle/Toggle.stories.svelte +15 -0
- package/dist/components/toggle/Toggle.stories.svelte.d.ts +27 -0
- package/dist/components/toggle/Toggle.svelte +73 -0
- package/dist/components/toggle/Toggle.svelte.d.ts +8 -0
- package/dist/components/toggle/index.d.ts +1 -0
- package/dist/components/toggle/index.js +1 -0
- package/dist/components/tooltip/Tooltip.stories.svelte +126 -0
- package/dist/components/tooltip/Tooltip.stories.svelte.d.ts +27 -0
- package/dist/components/tooltip/Tooltip.svelte +49 -0
- package/dist/components/tooltip/Tooltip.svelte.d.ts +13 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/fonts/MDSystemMono-Regular.woff +0 -0
- package/dist/fonts/MDSystemMono-Regular.woff2 +0 -0
- package/dist/fonts/afAnotherSans-Medium.woff2 +0 -0
- package/dist/fonts/afAnotherSans-Regular.woff2 +0 -0
- package/dist/fonts/afAnotherSans-SemiBold.woff2 +0 -0
- package/dist/fonts/afAnotherSans.woff2 +0 -0
- package/dist/fonts/index.d.ts +4 -0
- package/dist/fonts/index.js +6 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +39 -68464
- package/dist/tailwind-safelist.d.ts +27 -0
- package/dist/tailwind-safelist.js +475 -0
- package/dist/tailwind.d.ts +11 -0
- package/dist/tailwind.js +1 -0
- package/dist/tailwind.preset.d.ts +344 -0
- package/dist/tailwind.preset.js +55 -0
- package/dist/tokens.d.ts +598 -0
- package/dist/tokens.js +285 -0
- package/dist/types/fonts.d.ts +4 -0
- package/package.json +2 -1
- package/dist/index.css +0 -1
- package/dist/index.umd.cjs +0 -148
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
interface Props {
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
5
|
+
class?: string;
|
|
6
|
+
variant?: Color;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
noPadding?: boolean;
|
|
9
|
+
iconButton?: boolean;
|
|
10
|
+
}
|
|
11
|
+
let {
|
|
12
|
+
size = 'md',
|
|
13
|
+
class: className = '',
|
|
14
|
+
variant = 'primary',
|
|
15
|
+
children,
|
|
16
|
+
noPadding = false,
|
|
17
|
+
iconButton = false
|
|
18
|
+
}: Props = $props();
|
|
19
|
+
|
|
20
|
+
type Color = 'primary' | 'secondary' | 'transparent' | 'danger';
|
|
21
|
+
|
|
22
|
+
const sizes = $derived({
|
|
23
|
+
sm: `h-8 ${noPadding ? 'px-0' : iconButton ? 'px-2' : 'px-3'} ${noPadding ? 'py-0' : iconButton ? 'py-2' : 'py-3'}`,
|
|
24
|
+
md: 'h-10 px-5 py-3',
|
|
25
|
+
lg: 'h-12 px-6 py-4'
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const colors: Record<Color, string> = {
|
|
29
|
+
primary:
|
|
30
|
+
'bg-accent-inverse text-primary-inverse hover:bg-accent-inverse-hover disabled:bg-neutral disabled:text-tertiary',
|
|
31
|
+
secondary:
|
|
32
|
+
'bg-neutral text-primary hover:bg-neutral-hover disabled:bg-neutral disabled:text-tertiary',
|
|
33
|
+
transparent:
|
|
34
|
+
'bg-transparent text-primary hover:bg-neutral disabled:bg-neutral disabled:text-tertiary',
|
|
35
|
+
danger:
|
|
36
|
+
'bg-danger text-primary-inverse hover:bg-danger-hover disabled:bg-neutral disabled:text-tertiary'
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<div
|
|
41
|
+
role="button"
|
|
42
|
+
tabindex="0"
|
|
43
|
+
class={`inline-flex items-center justify-center gap-2 rounded-full text-base font-medium leading-6 ${colors[variant]} ${sizes[size]} ${className}`}
|
|
44
|
+
>
|
|
45
|
+
{@render children?.()}
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type Color = 'primary' | 'secondary' | 'transparent' | 'danger';
|
|
3
|
+
interface Props {
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
5
|
+
class?: string;
|
|
6
|
+
variant?: Color;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
noPadding?: boolean;
|
|
9
|
+
iconButton?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const DropdownTrigger: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type DropdownTrigger = ReturnType<typeof DropdownTrigger>;
|
|
13
|
+
export default DropdownTrigger;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { class: className = '', children }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div role="button" tabindex="0" class={`${className}`}>{@render children()}</div>
|
|
13
|
+
|
|
14
|
+
<style>
|
|
15
|
+
div {
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
|
|
19
|
+
width: 100%;
|
|
20
|
+
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
|
|
23
|
+
align-items: center;
|
|
24
|
+
|
|
25
|
+
gap: 0.25rem;
|
|
26
|
+
|
|
27
|
+
border-radius: 0.5rem;
|
|
28
|
+
|
|
29
|
+
border-width: 1px;
|
|
30
|
+
|
|
31
|
+
border-color: #12192A1A;
|
|
32
|
+
|
|
33
|
+
--tw-bg-opacity: 1;
|
|
34
|
+
|
|
35
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
36
|
+
|
|
37
|
+
padding: 0.75rem;
|
|
38
|
+
|
|
39
|
+
--tw-text-opacity: 1;
|
|
40
|
+
|
|
41
|
+
color: rgb(18 25 42 / var(--tw-text-opacity, 1));
|
|
42
|
+
|
|
43
|
+
--tw-shadow: 0 1px 4px 0 rgba(18, 25, 42, 0.04);
|
|
44
|
+
|
|
45
|
+
--tw-shadow-colored: 0 1px 4px 0 var(--tw-shadow-color);
|
|
46
|
+
|
|
47
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
div:not(:focus-within):hover {
|
|
51
|
+
|
|
52
|
+
border-color: #5750ee40
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
div:focus-within {
|
|
56
|
+
|
|
57
|
+
--tw-border-opacity: 1;
|
|
58
|
+
|
|
59
|
+
border-color: rgb(87 80 238 / var(--tw-border-opacity, 1))
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
class?: string;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
}
|
|
6
|
+
declare const OutlinedButton: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type OutlinedButton = ReturnType<typeof OutlinedButton>;
|
|
8
|
+
export default OutlinedButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Dropdown } from './Dropdown.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Dropdown } from './Dropdown.svelte';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
icon: Snippet;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const { icon, children }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div class="flex w-full justify-center">
|
|
13
|
+
<div class="flex max-w-[180px] flex-col items-center justify-center gap-5 py-5 text-tertiary">
|
|
14
|
+
{@render icon()}
|
|
15
|
+
<div class="flex w-full flex-col items-center justify-center gap-2">
|
|
16
|
+
{@render children()}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script lang="ts" context="module">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Chart from './Chart.svelte';
|
|
4
|
+
import { colors } from '../../../tokens';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
component: Chart,
|
|
8
|
+
title: 'Design System/Graphs/Chart',
|
|
9
|
+
tags: ['autodocs']
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
const baseOptions = {
|
|
15
|
+
xAxis: { type: 'value' as const },
|
|
16
|
+
yAxis: { type: 'value' as const },
|
|
17
|
+
series: [
|
|
18
|
+
{
|
|
19
|
+
type: 'scatter' as const,
|
|
20
|
+
data: [
|
|
21
|
+
[10, 8.04],
|
|
22
|
+
[8.07, 6.95],
|
|
23
|
+
[13.0, 7.58]
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const lineOptions = {
|
|
30
|
+
xAxis: { type: 'category' as const, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] },
|
|
31
|
+
yAxis: { type: 'value' as const },
|
|
32
|
+
series: [
|
|
33
|
+
{
|
|
34
|
+
type: 'line' as const,
|
|
35
|
+
data: [150, 230, 224, 218, 135]
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function handleClick(params: any) {
|
|
41
|
+
console.log('Clicked:', params);
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<!-- Basic Usage -->
|
|
46
|
+
<Story name="Default">
|
|
47
|
+
<Chart options={baseOptions} />
|
|
48
|
+
</Story>
|
|
49
|
+
|
|
50
|
+
<!-- Custom Size -->
|
|
51
|
+
<Story name="Custom Size">
|
|
52
|
+
<Chart options={baseOptions} width="600px" height="400px" />
|
|
53
|
+
</Story>
|
|
54
|
+
|
|
55
|
+
<!-- Loading State -->
|
|
56
|
+
<Story name="Loading State">
|
|
57
|
+
<Chart options={baseOptions} loading={true} />
|
|
58
|
+
</Story>
|
|
59
|
+
|
|
60
|
+
<!-- With Events -->
|
|
61
|
+
<Story name="With Click Events">
|
|
62
|
+
<Chart
|
|
63
|
+
options={baseOptions}
|
|
64
|
+
onitemclick={handleClick}
|
|
65
|
+
onmouseover={(params) => console.log('Hover:', params)}
|
|
66
|
+
/>
|
|
67
|
+
</Story>
|
|
68
|
+
|
|
69
|
+
<!-- Different Chart Types -->
|
|
70
|
+
<Story name="Line Chart">
|
|
71
|
+
<Chart options={lineOptions} />
|
|
72
|
+
</Story>
|
|
73
|
+
|
|
74
|
+
<!-- Theme Example -->
|
|
75
|
+
<Story name="Dark Theme">
|
|
76
|
+
<div style="background: #333; padding: 20px;">
|
|
77
|
+
<Chart
|
|
78
|
+
options={{
|
|
79
|
+
...baseOptions,
|
|
80
|
+
backgroundColor: '#333',
|
|
81
|
+
textStyle: { color: '#fff' }
|
|
82
|
+
}}
|
|
83
|
+
theme={{
|
|
84
|
+
textStyle: { color: '#fff' },
|
|
85
|
+
color: [colors.blue[5].default]
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
</Story>
|
|
90
|
+
|
|
91
|
+
<!-- Responsive Example -->
|
|
92
|
+
<Story name="Responsive">
|
|
93
|
+
<div
|
|
94
|
+
style="resize: both; overflow: auto; min-width: 300px; min-height: 200px; border: 1px solid #ccc;"
|
|
95
|
+
>
|
|
96
|
+
<Chart options={baseOptions} autoResize={true} />
|
|
97
|
+
</div>
|
|
98
|
+
</Story>
|
|
99
|
+
|
|
100
|
+
<!-- Multiple Series -->
|
|
101
|
+
<Story name="Multiple Series">
|
|
102
|
+
<Chart
|
|
103
|
+
options={{
|
|
104
|
+
...baseOptions,
|
|
105
|
+
series: [
|
|
106
|
+
{
|
|
107
|
+
type: 'scatter' as const,
|
|
108
|
+
data: [
|
|
109
|
+
[10, 8.04],
|
|
110
|
+
[8.07, 6.95],
|
|
111
|
+
[13.0, 7.58]
|
|
112
|
+
],
|
|
113
|
+
name: 'Series 1'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: 'scatter' as const,
|
|
117
|
+
data: [
|
|
118
|
+
[9, 7.5],
|
|
119
|
+
[7.5, 6.3],
|
|
120
|
+
[12.5, 7.0]
|
|
121
|
+
],
|
|
122
|
+
name: 'Series 2'
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
legend: { data: ['Series 1', 'Series 2'] }
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Chart from './Chart.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Chart: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Chart = InstanceType<typeof Chart>;
|
|
19
|
+
export default Chart;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as echarts from 'echarts';
|
|
3
|
+
import type { ECElementEvent } from 'echarts';
|
|
4
|
+
import { onMount } from 'svelte';
|
|
5
|
+
import { colors, textColor } from '../../../tokens';
|
|
6
|
+
type Props = {
|
|
7
|
+
options: echarts.EChartsOption;
|
|
8
|
+
theme?: string | object;
|
|
9
|
+
renderer?: 'canvas' | 'svg';
|
|
10
|
+
height?: string;
|
|
11
|
+
width?: string;
|
|
12
|
+
// Common event handlers
|
|
13
|
+
onitemclick?: (params: ECElementEvent) => void;
|
|
14
|
+
onmouseover?: (params: ECElementEvent) => void;
|
|
15
|
+
onmouseout?: () => void;
|
|
16
|
+
// Additional options
|
|
17
|
+
autoResize?: boolean;
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
options,
|
|
23
|
+
theme,
|
|
24
|
+
renderer = 'svg',
|
|
25
|
+
height = '100%',
|
|
26
|
+
width = '100%',
|
|
27
|
+
onitemclick,
|
|
28
|
+
onmouseover,
|
|
29
|
+
onmouseout,
|
|
30
|
+
autoResize = true,
|
|
31
|
+
loading = false
|
|
32
|
+
}: Props = $props();
|
|
33
|
+
|
|
34
|
+
let chart = $state<echarts.ECharts | null>(null);
|
|
35
|
+
let container: HTMLElement;
|
|
36
|
+
|
|
37
|
+
function deepMerge(target: any, source: any) {
|
|
38
|
+
for (const key in source) {
|
|
39
|
+
if (source[key] instanceof Object && key in target) {
|
|
40
|
+
deepMerge(target[key], source[key]);
|
|
41
|
+
} else {
|
|
42
|
+
target[key] = source[key];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return target;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const defaultOptions = {
|
|
49
|
+
grid: {
|
|
50
|
+
left: '48px',
|
|
51
|
+
right: '16px',
|
|
52
|
+
top: '16px',
|
|
53
|
+
bottom: '48px'
|
|
54
|
+
},
|
|
55
|
+
xAxis: {
|
|
56
|
+
nameLocation: 'middle',
|
|
57
|
+
nameGap: 32,
|
|
58
|
+
axisLabel: {
|
|
59
|
+
fontSize: 10,
|
|
60
|
+
lineHeight: 14,
|
|
61
|
+
align: 'center',
|
|
62
|
+
fontWeight: 450,
|
|
63
|
+
color: textColor.secondary,
|
|
64
|
+
margin: 16,
|
|
65
|
+
fontFamily: 'monospace'
|
|
66
|
+
},
|
|
67
|
+
axisLine: {
|
|
68
|
+
lineStyle: {
|
|
69
|
+
color: colors.gray[2]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
nameTextStyle: {
|
|
73
|
+
fontSize: 12,
|
|
74
|
+
color: textColor.secondary
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
yAxis: {
|
|
78
|
+
nameLocation: 'middle',
|
|
79
|
+
nameGap: 32,
|
|
80
|
+
nameRotate: 90,
|
|
81
|
+
axisLabel: {
|
|
82
|
+
fontSize: 10,
|
|
83
|
+
lineHeight: 14,
|
|
84
|
+
align: 'center',
|
|
85
|
+
fontWeight: 450,
|
|
86
|
+
color: textColor.secondary,
|
|
87
|
+
margin: 16,
|
|
88
|
+
fontFamily: 'monospace'
|
|
89
|
+
},
|
|
90
|
+
axisLine: {
|
|
91
|
+
lineStyle: {
|
|
92
|
+
color: colors.gray[2]
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
nameTextStyle: {
|
|
96
|
+
fontSize: 12,
|
|
97
|
+
color: textColor.secondary
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
} as const;
|
|
101
|
+
|
|
102
|
+
const finalOptions = deepMerge(structuredClone(defaultOptions), options);
|
|
103
|
+
|
|
104
|
+
function initChart() {
|
|
105
|
+
if (container) {
|
|
106
|
+
chart = echarts.init(container, theme, { renderer });
|
|
107
|
+
chart.setOption(finalOptions);
|
|
108
|
+
|
|
109
|
+
if (onitemclick) chart.on('click', onitemclick);
|
|
110
|
+
if (onmouseover) chart.on('mouseover', onmouseover);
|
|
111
|
+
if (onmouseout) chart.on('mouseout', onmouseout);
|
|
112
|
+
|
|
113
|
+
if (loading) chart.showLoading();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
$effect(() => {
|
|
118
|
+
if (loading) {
|
|
119
|
+
chart?.showLoading();
|
|
120
|
+
} else {
|
|
121
|
+
chart?.hideLoading();
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
onMount(() => {
|
|
126
|
+
initChart();
|
|
127
|
+
|
|
128
|
+
if (autoResize) {
|
|
129
|
+
const resizeObserver = new ResizeObserver(() => chart?.resize());
|
|
130
|
+
resizeObserver.observe(container);
|
|
131
|
+
return () => {
|
|
132
|
+
resizeObserver.disconnect();
|
|
133
|
+
chart?.dispose();
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<div bind:this={container} style="width: {width}; height: {height};" class="chart-container"></div>
|
|
140
|
+
|
|
141
|
+
<style>
|
|
142
|
+
.chart-container {
|
|
143
|
+
position: relative;
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as echarts from 'echarts';
|
|
2
|
+
import type { ECElementEvent } from 'echarts';
|
|
3
|
+
type Props = {
|
|
4
|
+
options: echarts.EChartsOption;
|
|
5
|
+
theme?: string | object;
|
|
6
|
+
renderer?: 'canvas' | 'svg';
|
|
7
|
+
height?: string;
|
|
8
|
+
width?: string;
|
|
9
|
+
onitemclick?: (params: ECElementEvent) => void;
|
|
10
|
+
onmouseover?: (params: ECElementEvent) => void;
|
|
11
|
+
onmouseout?: () => void;
|
|
12
|
+
autoResize?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const Chart: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type Chart = ReturnType<typeof Chart>;
|
|
17
|
+
export default Chart;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as Scatterplot } from './scatterplot/Scatterplot.svelte';
|
|
2
|
+
export { default as Chart } from './chart/Chart.svelte';
|
|
3
|
+
export { default as LineChart } from './line/LineChart.svelte';
|
|
4
|
+
export { default as MultiLineChart } from './multiline/MultiLineChart.svelte';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as Scatterplot } from './scatterplot/Scatterplot.svelte';
|
|
2
|
+
export { default as Chart } from './chart/Chart.svelte';
|
|
3
|
+
export { default as LineChart } from './line/LineChart.svelte';
|
|
4
|
+
export { default as MultiLineChart } from './multiline/MultiLineChart.svelte';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
|
|
4
|
+
import LineChart from './LineChart.svelte';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
component: LineChart,
|
|
8
|
+
title: 'Design System/Graphs/LineChart',
|
|
9
|
+
tags: ['autodocs']
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const xAxis = '€€€';
|
|
13
|
+
const yAxis = '$$$';
|
|
14
|
+
|
|
15
|
+
const data = [
|
|
16
|
+
10.0, 8.04, 8.07, 6.95, 13.0, 7.58, 9.05, 8.81, 11.0, 8.33, 14.0, 7.66, 13.4, 6.81, 10.0, 6.33,
|
|
17
|
+
14.0, 8.96, 12.5, 6.82, 9.15, 7.2, 11.5, 7.2, 3.03, 4.23, 12.2, 7.83, 2.02, 4.47, 1.05, 3.33,
|
|
18
|
+
4.05, 4.96, 6.03, 7.24, 12.0, 6.26, 12.0, 8.84, 7.08, 5.82, 5.02, 5.6
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const bigData = Array.from({ length: 1000 }, (_, i) => i);
|
|
22
|
+
|
|
23
|
+
function handleItemClick(params: echarts.ECElementEvent) {
|
|
24
|
+
console.log(params);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function handleMouseOver(params: echarts.ECElementEvent) {
|
|
28
|
+
console.log(params);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function handleMouseOut() {
|
|
32
|
+
console.log('mouse out');
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<Story name="Base">
|
|
37
|
+
<div class="h-[400px] w-full">
|
|
38
|
+
<LineChart
|
|
39
|
+
{xAxis}
|
|
40
|
+
{yAxis}
|
|
41
|
+
{data}
|
|
42
|
+
onitemclick={handleItemClick}
|
|
43
|
+
onmouseover={handleMouseOver}
|
|
44
|
+
onmouseout={handleMouseOut}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</Story>
|
|
48
|
+
<Story name="Loading">
|
|
49
|
+
<div class="h-[400px] w-full">
|
|
50
|
+
<LineChart
|
|
51
|
+
{xAxis}
|
|
52
|
+
{yAxis}
|
|
53
|
+
{data}
|
|
54
|
+
loading
|
|
55
|
+
onitemclick={handleItemClick}
|
|
56
|
+
onmouseover={handleMouseOver}
|
|
57
|
+
onmouseout={handleMouseOut}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
</Story>
|
|
61
|
+
<Story name="Large datasets with capture intervals">
|
|
62
|
+
<div class="h-[400px] w-full">
|
|
63
|
+
<LineChart
|
|
64
|
+
{xAxis}
|
|
65
|
+
{yAxis}
|
|
66
|
+
data={bigData}
|
|
67
|
+
captureInterval={1000}
|
|
68
|
+
onitemclick={handleItemClick}
|
|
69
|
+
onmouseover={handleMouseOver}
|
|
70
|
+
onmouseout={handleMouseOut}
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import LineChart from './LineChart.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const LineChart: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type LineChart = InstanceType<typeof LineChart>;
|
|
19
|
+
export default LineChart;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { textColor, backgroundColor } from '../../../tokens';
|
|
3
|
+
import Chart from '../chart/Chart.svelte';
|
|
4
|
+
import type { EChartsOption } from 'echarts';
|
|
5
|
+
import { Duration } from 'luxon';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
data: (number | null)[];
|
|
9
|
+
captureInterval?: number;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
xAxis?: string;
|
|
12
|
+
yAxis?: string;
|
|
13
|
+
height?: string;
|
|
14
|
+
width?: string;
|
|
15
|
+
xAxisOptions?: EChartsOption['xAxis'];
|
|
16
|
+
yAxisOptions?: EChartsOption['yAxis'];
|
|
17
|
+
onitemclick?: (params: echarts.ECElementEvent) => void;
|
|
18
|
+
onmouseover?: (params: echarts.ECElementEvent) => void;
|
|
19
|
+
onmouseout?: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const toFixedLocaleString = (
|
|
23
|
+
value?: number | undefined,
|
|
24
|
+
fractionDigits: number | undefined = 0,
|
|
25
|
+
locale: string | undefined = undefined
|
|
26
|
+
): string =>
|
|
27
|
+
value?.toLocaleString(locale, {
|
|
28
|
+
minimumFractionDigits: fractionDigits,
|
|
29
|
+
maximumFractionDigits: fractionDigits
|
|
30
|
+
}) ?? '';
|
|
31
|
+
|
|
32
|
+
let { data, xAxis, xAxisOptions, yAxis, yAxisOptions, captureInterval, ...props }: Props =
|
|
33
|
+
$props();
|
|
34
|
+
|
|
35
|
+
const captureIntervals = captureInterval
|
|
36
|
+
? Array(data.length)
|
|
37
|
+
.fill(null)
|
|
38
|
+
.map((_, timeIndex) => {
|
|
39
|
+
const seconds = timeIndex * captureInterval;
|
|
40
|
+
const duration = Duration.fromObject({ seconds }).shiftTo('days', 'hours', 'minutes');
|
|
41
|
+
return duration.days >= 1 ? duration.toFormat('dd:hh:mm') : duration.toFormat('hh:mm');
|
|
42
|
+
})
|
|
43
|
+
: undefined;
|
|
44
|
+
|
|
45
|
+
$effect(() => {
|
|
46
|
+
console.log(captureIntervals);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
let options: EChartsOption = {
|
|
50
|
+
color: ['#5750EE', '#FF7100', '#50EEA6', '#E7EE50', '#EE5098'],
|
|
51
|
+
grid: {
|
|
52
|
+
top: 10,
|
|
53
|
+
bottom: 10,
|
|
54
|
+
left: 10,
|
|
55
|
+
right: 10,
|
|
56
|
+
containLabel: true
|
|
57
|
+
},
|
|
58
|
+
textStyle: {
|
|
59
|
+
color: textColor['secondary']
|
|
60
|
+
},
|
|
61
|
+
xAxis: {
|
|
62
|
+
type: 'category',
|
|
63
|
+
boundaryGap: false,
|
|
64
|
+
axisLine: {
|
|
65
|
+
onZero: false
|
|
66
|
+
},
|
|
67
|
+
name: xAxis,
|
|
68
|
+
data: captureIntervals,
|
|
69
|
+
...xAxisOptions
|
|
70
|
+
},
|
|
71
|
+
yAxis: {
|
|
72
|
+
type: 'value',
|
|
73
|
+
alignTicks: true,
|
|
74
|
+
axisLabel: {
|
|
75
|
+
formatter: (value: any) => value.toLocaleString()
|
|
76
|
+
} as any,
|
|
77
|
+
axisPointer: {
|
|
78
|
+
label: {
|
|
79
|
+
formatter: (value: any) => toFixedLocaleString(value.value, 2)
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
name: yAxis,
|
|
83
|
+
...yAxisOptions
|
|
84
|
+
},
|
|
85
|
+
selectedMode: 'multiple',
|
|
86
|
+
series: {
|
|
87
|
+
animation: false,
|
|
88
|
+
seriesLayoutBy: 'row',
|
|
89
|
+
emphasis: {
|
|
90
|
+
focus: 'series'
|
|
91
|
+
},
|
|
92
|
+
tooltip: {
|
|
93
|
+
show: false
|
|
94
|
+
},
|
|
95
|
+
type: 'line',
|
|
96
|
+
symbol: data.length > 1 ? 'none' : 'circle',
|
|
97
|
+
data
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<Chart {options} {...props} />
|