@reshape-biotech/design-system 0.0.54 → 1.1.2
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.stories.svelte +21 -8
- package/dist/components/activity/Activity.svelte +44 -6
- package/dist/components/activity/Activity.svelte.d.ts +1 -1
- package/dist/components/avatar/Avatar.stories.svelte +7 -17
- package/dist/components/avatar/Avatar.svelte +2 -2
- package/dist/components/avatar/Avatar.svelte.d.ts +2 -2
- package/dist/components/banner/Banner.stories.svelte +5 -5
- package/dist/components/banner/Banner.svelte +1 -1
- package/dist/components/button/Button.stories.svelte +54 -21
- package/dist/components/button/Button.svelte +58 -11
- package/dist/components/button/Button.svelte.d.ts +4 -3
- package/dist/components/card/Card.stories.svelte +130 -0
- package/dist/components/card/Card.stories.svelte.d.ts +19 -0
- package/dist/components/card/Card.svelte +25 -0
- package/dist/components/card/Card.svelte.d.ts +10 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/Checkbox.stories.svelte +7 -15
- package/dist/components/checkbox/Checkbox.svelte +7 -7
- package/dist/components/checkbox/Checkbox.svelte.d.ts +3 -5
- package/dist/components/collapsible/Collapsible.stories.svelte +5 -4
- package/dist/components/combobox/Combobox.stories.svelte +7 -5
- package/dist/components/datepicker/DatePicker.stories.svelte +13 -18
- package/dist/components/datepicker/DatePicker.svelte +1 -0
- package/dist/components/divider/Divider.stories.svelte +1 -3
- package/dist/components/divider/Divider.svelte +8 -2
- package/dist/components/divider/Divider.svelte.d.ts +2 -0
- package/dist/components/drawer/Drawer.stories.svelte +3 -3
- package/dist/components/dropdown/Dropdown.stories.svelte +8 -8
- package/dist/components/empty-content/EmptyContent.stories.svelte +2 -2
- package/dist/components/graphs/bar-chart/BarChart.stories.svelte +81 -0
- package/dist/components/graphs/bar-chart/BarChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/bar-chart/BarChart.svelte +136 -0
- package/dist/components/graphs/bar-chart/BarChart.svelte.d.ts +15 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.stories.svelte +42 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.svelte +177 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.svelte.d.ts +16 -0
- package/dist/components/graphs/chart/Chart.stories.svelte +30 -25
- package/dist/components/graphs/chart/Chart.svelte +104 -32
- package/dist/components/graphs/chart/Chart.svelte.d.ts +15 -5
- package/dist/components/graphs/index.d.ts +3 -0
- package/dist/components/graphs/index.js +3 -0
- package/dist/components/graphs/line/LineChart.stories.svelte +97 -17
- package/dist/components/graphs/line/LineChart.svelte +90 -51
- package/dist/components/graphs/line/LineChart.svelte.d.ts +6 -13
- package/dist/components/graphs/matrix/Matrix.stories.svelte +142 -0
- package/dist/components/graphs/matrix/Matrix.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/matrix/Matrix.svelte +149 -0
- package/dist/components/graphs/matrix/Matrix.svelte.d.ts +24 -0
- package/dist/components/graphs/matrix/index.d.ts +3 -0
- package/dist/components/graphs/matrix/index.js +3 -0
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte +115 -28
- package/dist/components/graphs/multiline/MultiLineChart.svelte +187 -50
- package/dist/components/graphs/multiline/MultiLineChart.svelte.d.ts +9 -12
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte +68 -41
- package/dist/components/graphs/scatterplot/Scatterplot.svelte +312 -45
- package/dist/components/graphs/scatterplot/Scatterplot.svelte.d.ts +23 -13
- package/dist/components/graphs/utils/tooltipFormatter.d.ts +10 -0
- package/dist/components/graphs/utils/tooltipFormatter.js +52 -0
- package/dist/components/icon-button/IconButton.stories.svelte +6 -6
- package/dist/components/icon-button/IconButton.svelte +50 -9
- package/dist/components/icon-button/IconButton.svelte.d.ts +3 -5
- package/dist/components/icons/AnalysisIcon.stories.svelte +15 -21
- package/dist/components/icons/AnalysisIcon.svelte +63 -44
- package/dist/components/icons/AnalysisIcon.svelte.d.ts +1 -0
- package/dist/components/icons/Icon.stories.svelte +4 -4
- package/dist/components/icons/Icon.svelte +1 -1
- package/dist/components/icons/PrincipalIcon.svelte +96 -0
- package/dist/components/icons/PrincipalIcon.svelte.d.ts +10 -0
- package/dist/components/icons/custom/Halo.svelte +14 -8
- package/dist/components/icons/custom/Halo.svelte.d.ts +7 -25
- package/dist/components/icons/custom/Well.svelte +14 -6
- package/dist/components/icons/custom/Well.svelte.d.ts +7 -25
- package/dist/components/icons/index.d.ts +3 -2
- package/dist/components/icons/index.js +34 -0
- package/dist/components/input/Input.stories.svelte +16 -22
- package/dist/components/input/Input.svelte +140 -134
- package/dist/components/input/Input.svelte.d.ts +12 -13
- package/dist/components/label/Label.stories.svelte +28 -0
- package/dist/components/label/Label.stories.svelte.d.ts +19 -0
- package/dist/components/label/Label.svelte +17 -0
- package/dist/components/label/Label.svelte.d.ts +9 -0
- package/dist/components/list/List.stories.svelte +3 -3
- package/dist/components/logo/Logo.stories.svelte +1 -1
- package/dist/components/manual-cfu-counter/ManualCFUCounter.stories.svelte +125 -0
- package/dist/components/manual-cfu-counter/ManualCFUCounter.stories.svelte.d.ts +3 -0
- package/dist/components/manual-cfu-counter/ManualCFUCounter.svelte +577 -0
- package/dist/components/manual-cfu-counter/ManualCFUCounter.svelte.d.ts +16 -0
- package/dist/components/manual-cfu-counter/index.d.ts +1 -0
- package/dist/components/manual-cfu-counter/index.js +1 -0
- package/dist/components/manual-cfu-counter/test/ManualCFUCounterTestWrapper.svelte +22 -0
- package/dist/components/manual-cfu-counter/test/ManualCFUCounterTestWrapper.svelte.d.ts +19 -0
- package/dist/components/markdown/Markdown.stories.svelte +1 -1
- package/dist/components/markdown/Markdown.svelte +1 -1
- package/dist/components/modal/Modal.stories.svelte +2 -2
- package/dist/components/modal/Modal.svelte +27 -22
- package/dist/components/modal/Modal.svelte.d.ts +4 -1
- package/dist/components/notification-popup/NotificationPopup.stories.svelte +1 -1
- package/dist/components/pill/Pill.stories.svelte +13 -0
- package/dist/components/pill/Pill.stories.svelte.d.ts +19 -0
- package/dist/components/progress-circle/ProgressCircle.stories.svelte +15 -0
- package/dist/components/progress-circle/ProgressCircle.stories.svelte.d.ts +19 -0
- package/dist/components/required-status-indicator/RequiredStatusIndicator.stories.svelte +28 -0
- package/dist/components/required-status-indicator/RequiredStatusIndicator.stories.svelte.d.ts +19 -0
- package/dist/components/required-status-indicator/RequiredStatusIndicator.svelte +22 -0
- package/dist/components/required-status-indicator/RequiredStatusIndicator.svelte.d.ts +8 -0
- package/dist/components/required-status-indicator/index.d.ts +1 -0
- package/dist/components/required-status-indicator/index.js +1 -0
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.stories.svelte +3 -3
- package/dist/components/select/Select.stories.svelte +12 -12
- package/dist/components/select/Select.svelte +0 -2
- package/dist/components/select-new/Select.stories.svelte +219 -0
- package/dist/components/select-new/Select.stories.svelte.d.ts +19 -0
- package/dist/components/select-new/components/Group.svelte +24 -0
- package/dist/components/select-new/components/Group.svelte.d.ts +11 -0
- package/dist/components/select-new/components/MultiSelectTrigger.svelte +66 -0
- package/dist/components/select-new/components/MultiSelectTrigger.svelte.d.ts +17 -0
- package/dist/components/select-new/components/SelectContent.svelte +33 -0
- package/dist/components/select-new/components/SelectContent.svelte.d.ts +10 -0
- package/dist/components/select-new/components/SelectGroupHeading.svelte +19 -0
- package/dist/components/select-new/components/SelectGroupHeading.svelte.d.ts +9 -0
- package/dist/components/select-new/components/SelectItem.svelte +41 -0
- package/dist/components/select-new/components/SelectItem.svelte.d.ts +9 -0
- package/dist/components/select-new/components/SelectTrigger.svelte +48 -0
- package/dist/components/select-new/components/SelectTrigger.svelte.d.ts +12 -0
- package/dist/components/select-new/index.d.ts +10 -0
- package/dist/components/select-new/index.js +12 -0
- package/dist/components/select-new/types.d.ts +25 -0
- package/dist/components/select-new/types.js +1 -0
- package/dist/components/sjsf-wrappers/SjsfNumberInputWrapper.svelte +92 -0
- package/dist/components/sjsf-wrappers/SjsfNumberInputWrapper.svelte.d.ts +3 -0
- package/dist/components/sjsf-wrappers/SjsfTextInputWrapper.svelte +65 -0
- package/dist/components/sjsf-wrappers/SjsfTextInputWrapper.svelte.d.ts +3 -0
- package/dist/components/sjsf-wrappers/index.d.ts +2 -0
- package/dist/components/sjsf-wrappers/index.js +2 -0
- package/dist/components/sjsf-wrappers/sjsfCustomTheme.d.ts +2 -0
- package/dist/components/sjsf-wrappers/sjsfCustomTheme.js +8 -0
- package/dist/components/skeleton-loader/SkeletonLoader.stories.svelte +4 -4
- package/dist/components/slider/Slider.stories.svelte +4 -4
- package/dist/components/spinner/Spinner.stories.svelte +13 -0
- package/dist/components/spinner/Spinner.stories.svelte.d.ts +19 -0
- package/dist/components/stat-card/StatCard.stories.svelte +27 -19
- package/dist/components/stat-card/StatCard.svelte +100 -6
- package/dist/components/stat-card/StatCard.svelte.d.ts +3 -0
- package/dist/components/status-badge/StatusBadge.stories.svelte +6 -6
- package/dist/components/status-badge/StatusBadge.svelte +5 -3
- 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/table/Table.stories.svelte +1 -1
- package/dist/components/table/components/Td.svelte +3 -2
- package/dist/components/table/components/Td.svelte.d.ts +1 -0
- package/dist/components/table/components/Tr.svelte +3 -2
- package/dist/components/table/components/Tr.svelte.d.ts +1 -0
- package/dist/components/tabs/Tabs.stories.svelte +1 -1
- package/dist/components/tag/Tag.stories.svelte +9 -9
- package/dist/components/tag/Tag.svelte +0 -18
- package/dist/components/textarea/Textarea.stories.svelte +97 -0
- package/dist/components/textarea/Textarea.stories.svelte.d.ts +19 -0
- package/dist/components/textarea/Textarea.svelte +94 -0
- package/dist/components/textarea/Textarea.svelte.d.ts +17 -0
- package/dist/components/textarea/index.d.ts +1 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/toggle/Toggle.stories.svelte +1 -1
- package/dist/components/toggle/Toggle.svelte +3 -2
- package/dist/components/toggle/Toggle.svelte.d.ts +1 -0
- package/dist/components/toggle-icon-button/ToggleIconButton.stories.svelte +6 -6
- package/dist/components/tooltip/Tooltip.stories.svelte +6 -6
- package/dist/components/tooltip/Tooltip.svelte +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/tailwind.preset.d.ts +5 -0
- package/dist/tokens.d.ts +10 -0
- package/dist/tokens.js +6 -4
- package/package.json +1 -2
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import Activity from './Activity.svelte';
|
|
4
4
|
import * as Collapsible from '../collapsible/index';
|
|
5
5
|
import { Icon } from '../icons';
|
|
6
|
-
|
|
7
6
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
7
|
+
|
|
8
8
|
const { Story } = defineMeta({
|
|
9
9
|
component: Activity,
|
|
10
10
|
title: 'Design System/Activity',
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
{
|
|
28
28
|
icon: 'edit' as const,
|
|
29
29
|
label: 'Sample ID edited',
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
previous_value: 'Sample123',
|
|
31
|
+
value: 'Sample456',
|
|
32
32
|
timestamp: '5 Sep 2025, 12:05',
|
|
33
33
|
author: 'Ella Roth'
|
|
34
34
|
},
|
|
@@ -48,6 +48,18 @@
|
|
|
48
48
|
label: 'Some label that just happened to be very long so it will probably wrap in most cases',
|
|
49
49
|
timestamp: '4 Aug 2025, 13:05',
|
|
50
50
|
author: 'Michael Scott'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
icon: 'warning' as const,
|
|
54
|
+
label: 'Job recovered after interruption, some data may be lost',
|
|
55
|
+
timestamp: '3 Aug 2025, 10:30',
|
|
56
|
+
author: 'Jim Halpert'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
icon: 'failed' as const,
|
|
60
|
+
label: 'Job failed',
|
|
61
|
+
timestamp: '2 Aug 2025, 14:22',
|
|
62
|
+
author: 'System'
|
|
51
63
|
}
|
|
52
64
|
]);
|
|
53
65
|
|
|
@@ -57,7 +69,7 @@
|
|
|
57
69
|
};
|
|
58
70
|
</script>
|
|
59
71
|
|
|
60
|
-
<Story name="Collapsible activity">
|
|
72
|
+
<Story name="Collapsible activity" asChild>
|
|
61
73
|
<Collapsible.Root open>
|
|
62
74
|
<Collapsible.Trigger class="w-full pb-4">
|
|
63
75
|
<h6>Activity</h6>
|
|
@@ -82,11 +94,12 @@
|
|
|
82
94
|
</Collapsible.Root>
|
|
83
95
|
</Story>
|
|
84
96
|
|
|
85
|
-
<Story
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
<Story
|
|
98
|
+
name="Single activity"
|
|
99
|
+
args={{ activity: { icon: 'delete', label: 'Project deleted', timestamp: '2 Oct, 1980' } }}
|
|
100
|
+
/>
|
|
88
101
|
|
|
89
|
-
<Story name="Few activities">
|
|
102
|
+
<Story name="Few activities" asChild>
|
|
90
103
|
<Activity
|
|
91
104
|
activity={{
|
|
92
105
|
icon: 'pause',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { Icon, type IconName } from '../icons';
|
|
2
|
+
import { Icon, type IconName, type IconColor, type BackgroundClass } from '../icons';
|
|
3
3
|
import { DateTime } from 'luxon';
|
|
4
4
|
|
|
5
5
|
type ActivityIcon =
|
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
| 'pause'
|
|
12
12
|
| 'start'
|
|
13
13
|
| 'stop'
|
|
14
|
-
| '
|
|
14
|
+
| 'warning'
|
|
15
|
+
| 'success'
|
|
16
|
+
| 'export-succeeded'
|
|
17
|
+
| 'export-failed';
|
|
15
18
|
|
|
16
19
|
type Activity = {
|
|
17
20
|
activity_type?: string;
|
|
@@ -33,12 +36,45 @@
|
|
|
33
36
|
add: 'Plus',
|
|
34
37
|
capture: 'Aperture',
|
|
35
38
|
delete: 'Trash',
|
|
36
|
-
edit: '
|
|
39
|
+
edit: 'PencilSimple',
|
|
37
40
|
failed: 'WarningCircle',
|
|
38
41
|
pause: 'Pause',
|
|
39
42
|
start: 'Play',
|
|
40
43
|
stop: 'Stop',
|
|
41
|
-
|
|
44
|
+
warning: 'Warning',
|
|
45
|
+
success: 'Check',
|
|
46
|
+
'export-succeeded': 'DownloadSimple',
|
|
47
|
+
'export-failed': 'DownloadSimple'
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const ACTIVITY_COLOR: Record<ActivityIcon, IconColor> = {
|
|
51
|
+
add: 'icon-secondary',
|
|
52
|
+
capture: 'icon-secondary',
|
|
53
|
+
delete: 'icon-danger',
|
|
54
|
+
edit: 'icon-secondary',
|
|
55
|
+
failed: 'icon-danger',
|
|
56
|
+
pause: 'icon-secondary',
|
|
57
|
+
start: 'icon-secondary',
|
|
58
|
+
stop: 'icon-secondary',
|
|
59
|
+
warning: 'icon-warning',
|
|
60
|
+
success: 'icon-secondary',
|
|
61
|
+
'export-succeeded': 'icon-secondary',
|
|
62
|
+
'export-failed': 'icon-danger'
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const ACTIVITY_BACKGROUND: Record<ActivityIcon, BackgroundClass> = {
|
|
66
|
+
add: 'bg-neutral',
|
|
67
|
+
capture: 'bg-neutral',
|
|
68
|
+
delete: 'bg-neutral',
|
|
69
|
+
edit: 'bg-neutral',
|
|
70
|
+
failed: 'bg-danger',
|
|
71
|
+
pause: 'bg-neutral',
|
|
72
|
+
start: 'bg-neutral',
|
|
73
|
+
stop: 'bg-neutral',
|
|
74
|
+
warning: 'bg-warning',
|
|
75
|
+
success: 'bg-neutral',
|
|
76
|
+
'export-succeeded': 'bg-neutral',
|
|
77
|
+
'export-failed': 'bg-danger'
|
|
42
78
|
};
|
|
43
79
|
|
|
44
80
|
function formatDateTime(timestamp: string): string {
|
|
@@ -64,9 +100,11 @@
|
|
|
64
100
|
<div class="flex min-h-12 flex-col items-center gap-1.5">
|
|
65
101
|
<div class="w-0.5 grow bg-neutral group-first:invisible"></div>
|
|
66
102
|
<div
|
|
67
|
-
class="flex h-5 w-5 shrink-0 items-center justify-center rounded
|
|
103
|
+
class="flex h-5 w-5 shrink-0 items-center justify-center rounded p-0.5 text-secondary {ACTIVITY_BACKGROUND[
|
|
104
|
+
activity.icon
|
|
105
|
+
]}"
|
|
68
106
|
>
|
|
69
|
-
<Icon iconName={ACTIVITY_ICONS[activity.icon]} />
|
|
107
|
+
<Icon iconName={ACTIVITY_ICONS[activity.icon]} color={ACTIVITY_COLOR[activity.icon]} />
|
|
70
108
|
</div>
|
|
71
109
|
<div class="w-0.5 grow bg-neutral group-last:invisible"></div>
|
|
72
110
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type ActivityIcon = 'add' | 'capture' | 'delete' | 'edit' | 'failed' | 'pause' | 'start' | 'stop' | '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;
|
|
@@ -15,34 +15,24 @@
|
|
|
15
15
|
});
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<Story name="Default"
|
|
19
|
-
<Avatar name="John Doe" />
|
|
20
|
-
</Story>
|
|
18
|
+
<Story name="Default" args={{ name: 'John Doe' }} />
|
|
21
19
|
|
|
22
|
-
<Story name="Sizes">
|
|
20
|
+
<Story name="Sizes" asChild>
|
|
23
21
|
<div class="flex gap-2">
|
|
24
22
|
<Avatar name="John Doe" size="sm" />
|
|
25
23
|
<Avatar name="John Doe" size="md" />
|
|
26
24
|
</div>
|
|
27
25
|
</Story>
|
|
28
26
|
|
|
29
|
-
<Story name="Email"
|
|
30
|
-
<Avatar name="john.doe@example.com" />
|
|
31
|
-
</Story>
|
|
27
|
+
<Story name="Email" args={{ name: 'john.doe@example.com' }} />
|
|
32
28
|
|
|
33
|
-
<Story name="Single Name"
|
|
34
|
-
<Avatar name="John" />
|
|
35
|
-
</Story>
|
|
29
|
+
<Story name="Single Name" args={{ name: 'John' }} />
|
|
36
30
|
|
|
37
|
-
<Story name="No Name"
|
|
38
|
-
<Avatar name={null} />
|
|
39
|
-
</Story>
|
|
31
|
+
<Story name="No Name" args={{ name: null }} />
|
|
40
32
|
|
|
41
|
-
<Story name="Without Tooltip"
|
|
42
|
-
<Avatar name="John Doe" showTooltip={false} />
|
|
43
|
-
</Story>
|
|
33
|
+
<Story name="Without Tooltip" args={{ showTooltip: false }} />
|
|
44
34
|
|
|
45
|
-
<Story name="Multiple Avatars">
|
|
35
|
+
<Story name="Multiple Avatars" asChild>
|
|
46
36
|
<div class="flex gap-2">
|
|
47
37
|
<Avatar name="John Doe" />
|
|
48
38
|
<Avatar name="Jane Smith" />
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Tooltip from '../tooltip/Tooltip.svelte';
|
|
3
|
-
interface
|
|
3
|
+
export interface AvatarProps {
|
|
4
4
|
name: string | null | undefined;
|
|
5
5
|
size?: 'sm' | 'md';
|
|
6
6
|
showTooltip?: boolean;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
let { name, size = 'md', showTooltip = true }:
|
|
9
|
+
let { name, size = 'md', showTooltip = true }: AvatarProps = $props();
|
|
10
10
|
const sizes = {
|
|
11
11
|
sm: 'h-6 w-6 min-w-6 text-xxs font-semibold tracking-wide',
|
|
12
12
|
md: 'h-8 w-8 min-w-8 text-xs font-semibold tracking-wide'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
interface
|
|
1
|
+
export interface AvatarProps {
|
|
2
2
|
name: string | null | undefined;
|
|
3
3
|
size?: 'sm' | 'md';
|
|
4
4
|
showTooltip?: boolean;
|
|
5
5
|
}
|
|
6
|
-
declare const Avatar: import("svelte").Component<
|
|
6
|
+
declare const Avatar: import("svelte").Component<AvatarProps, {}, "">;
|
|
7
7
|
type Avatar = ReturnType<typeof Avatar>;
|
|
8
8
|
export default Avatar;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
let showBanner = $state(true);
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
<Story name="Well finding warning">
|
|
16
|
+
<Story name="Well finding warning" asChild>
|
|
17
17
|
<Banner type="warning" closable={false}>
|
|
18
18
|
{#snippet icon()}
|
|
19
19
|
<Icon size={20} iconName="Warning" color="warning" weight="bold" />
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
</Banner>
|
|
29
29
|
</Story>
|
|
30
30
|
|
|
31
|
-
<Story name="No icon">
|
|
31
|
+
<Story name="No icon" asChild>
|
|
32
32
|
<Banner type="success">
|
|
33
33
|
{#snippet content()}
|
|
34
34
|
This banner has no icon.
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</Banner>
|
|
37
37
|
</Story>
|
|
38
38
|
|
|
39
|
-
<Story name="No toggle">
|
|
39
|
+
<Story name="No toggle" asChild>
|
|
40
40
|
<Banner type="progress" closable={false}>
|
|
41
41
|
{#snippet icon()}
|
|
42
42
|
<Icon size={20} iconName="Info" color="icon-blue" weight="bold" />
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
</Banner>
|
|
48
48
|
</Story>
|
|
49
49
|
|
|
50
|
-
<Story name="Toggle back on">
|
|
50
|
+
<Story name="Toggle back on" asChild>
|
|
51
51
|
<div class="h-28">
|
|
52
52
|
<Button onClick={() => (showBanner = true)} disabled={showBanner}>Toggle banner back on</Button>
|
|
53
53
|
<br />
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
</div>
|
|
65
65
|
</Story>
|
|
66
66
|
|
|
67
|
-
<Story name="Type variations">
|
|
67
|
+
<Story name="Type variations" asChild>
|
|
68
68
|
<div class="space-y-4">
|
|
69
69
|
<div class="space-y-2">
|
|
70
70
|
<h4>Neutral</h4>
|
|
@@ -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} ">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Button from './Button.svelte';
|
|
3
|
+
import Button, { type ButtonVariant, type ButtonSize } from './Button.svelte';
|
|
4
4
|
|
|
5
5
|
const { Story } = defineMeta({
|
|
6
6
|
component: Button,
|
|
@@ -13,31 +13,64 @@
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
+
|
|
17
|
+
const variants = [
|
|
18
|
+
'primary',
|
|
19
|
+
'secondary',
|
|
20
|
+
'danger',
|
|
21
|
+
'transparent',
|
|
22
|
+
'outline',
|
|
23
|
+
'secondary-inverse'
|
|
24
|
+
];
|
|
25
|
+
const sizes = ['xs', 'sm', 'md', 'lg'];
|
|
16
26
|
</script>
|
|
17
27
|
|
|
18
|
-
<Story name="
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</
|
|
24
|
-
<
|
|
25
|
-
|
|
28
|
+
<Story name="Variants" asChild>
|
|
29
|
+
<div class="flex flex-col gap-4">
|
|
30
|
+
{#each variants as variant}
|
|
31
|
+
{#if variant === 'secondary-inverse'}
|
|
32
|
+
<div class="bg-base-inverse p-4 text-primary-inverse">
|
|
33
|
+
<p>{variant}</p>
|
|
34
|
+
<Button variant={variant as ButtonVariant}>Button</Button>
|
|
35
|
+
</div>
|
|
36
|
+
{:else}
|
|
37
|
+
<div>
|
|
38
|
+
<p>{variant}</p>
|
|
39
|
+
<Button variant={variant as ButtonVariant}>Button</Button>
|
|
40
|
+
</div>
|
|
41
|
+
{/if}
|
|
42
|
+
{/each}
|
|
43
|
+
</div>
|
|
26
44
|
</Story>
|
|
27
45
|
|
|
28
|
-
<Story name="
|
|
29
|
-
<
|
|
46
|
+
<Story name="Sizes" asChild>
|
|
47
|
+
<div class="flex flex-col gap-4">
|
|
48
|
+
{#each sizes as size}
|
|
49
|
+
<div>
|
|
50
|
+
<p>{size}</p>
|
|
51
|
+
<Button variant="primary" size={size as ButtonSize}>Button</Button>
|
|
52
|
+
</div>
|
|
53
|
+
{/each}
|
|
54
|
+
</div>
|
|
30
55
|
</Story>
|
|
31
56
|
|
|
32
|
-
<Story name="
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
</
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
<Story name="Disabled" asChild>
|
|
58
|
+
<div class="flex flex-col gap-4">
|
|
59
|
+
{#each variants as variant}
|
|
60
|
+
<div>
|
|
61
|
+
<p>{variant}</p>
|
|
62
|
+
<Button variant={variant as ButtonVariant} disabled>Button</Button>
|
|
63
|
+
</div>
|
|
64
|
+
{/each}
|
|
65
|
+
</div>
|
|
40
66
|
</Story>
|
|
41
|
-
<Story name="Loading">
|
|
42
|
-
<
|
|
67
|
+
<Story name="Loading" asChild>
|
|
68
|
+
<div class="flex flex-col gap-4">
|
|
69
|
+
{#each variants as variant}
|
|
70
|
+
<div>
|
|
71
|
+
<p>{variant}</p>
|
|
72
|
+
<Button variant={variant as ButtonVariant} loading>Button</Button>
|
|
73
|
+
</div>
|
|
74
|
+
{/each}
|
|
75
|
+
</div>
|
|
43
76
|
</Story>
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
|
|
5
|
-
type Variant =
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export type ButtonVariant =
|
|
6
3
|
| 'primary'
|
|
7
4
|
| 'secondary'
|
|
8
5
|
| 'transparent'
|
|
9
6
|
| 'danger'
|
|
10
7
|
| 'outline'
|
|
11
|
-
| 'secondary-inverse'
|
|
8
|
+
| 'secondary-inverse'
|
|
9
|
+
| 'transparent-inverse';
|
|
10
|
+
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import Spinner from '../spinner/Spinner.svelte';
|
|
15
|
+
import type { Snippet } from 'svelte';
|
|
12
16
|
|
|
13
17
|
interface Props {
|
|
14
18
|
class?: string;
|
|
@@ -17,10 +21,10 @@
|
|
|
17
21
|
loading?: boolean;
|
|
18
22
|
disabled?: boolean;
|
|
19
23
|
accessibilityLabel?: string;
|
|
20
|
-
size?:
|
|
24
|
+
size?: ButtonSize;
|
|
21
25
|
id?: string | undefined;
|
|
22
26
|
tabindex?: number | undefined;
|
|
23
|
-
variant?:
|
|
27
|
+
variant?: ButtonVariant;
|
|
24
28
|
children?: Snippet;
|
|
25
29
|
dataTestId?: string;
|
|
26
30
|
rounded?: boolean;
|
|
@@ -49,7 +53,7 @@
|
|
|
49
53
|
<button
|
|
50
54
|
aria-label={accessibilityLabel}
|
|
51
55
|
onclick={(e) => {
|
|
52
|
-
if (!loading) {
|
|
56
|
+
if (!loading && !disabled) {
|
|
53
57
|
onClick(e);
|
|
54
58
|
} else {
|
|
55
59
|
e.preventDefault();
|
|
@@ -63,6 +67,7 @@
|
|
|
63
67
|
class="button {variantClass} {sizeClass} {className}"
|
|
64
68
|
data-testid={dataTestId}
|
|
65
69
|
class:rounded
|
|
70
|
+
class:disabled
|
|
66
71
|
>
|
|
67
72
|
{#if loading}
|
|
68
73
|
<Spinner />
|
|
@@ -107,6 +112,17 @@
|
|
|
107
112
|
|
|
108
113
|
--tw-text-opacity: 1;
|
|
109
114
|
|
|
115
|
+
color: rgb(136 140 148 / var(--tw-text-opacity, 1))
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.button:hover:disabled {
|
|
119
|
+
|
|
120
|
+
cursor: not-allowed;
|
|
121
|
+
|
|
122
|
+
background-color: #12192a0d;
|
|
123
|
+
|
|
124
|
+
--tw-text-opacity: 1;
|
|
125
|
+
|
|
110
126
|
color: rgb(136 140 148 / var(--tw-text-opacity, 1))
|
|
111
127
|
}
|
|
112
128
|
|
|
@@ -115,11 +131,17 @@
|
|
|
115
131
|
border-radius: 9999px
|
|
116
132
|
}
|
|
117
133
|
|
|
134
|
+
.disabled:hover {
|
|
135
|
+
|
|
136
|
+
background-color: #12192a0d !important
|
|
137
|
+
}
|
|
118
138
|
/* Size variants */
|
|
119
139
|
.btn-size-xs {
|
|
120
140
|
|
|
121
141
|
height: 1.75rem;
|
|
122
142
|
|
|
143
|
+
border-radius: 0.375rem;
|
|
144
|
+
|
|
123
145
|
padding: 0.5rem
|
|
124
146
|
}
|
|
125
147
|
.btn-size-sm {
|
|
@@ -180,6 +202,7 @@
|
|
|
180
202
|
|
|
181
203
|
background-color: rgb(71 65 193 / var(--tw-bg-opacity, 1))
|
|
182
204
|
}
|
|
205
|
+
|
|
183
206
|
.btn-secondary {
|
|
184
207
|
|
|
185
208
|
background-color: #12192a0d;
|
|
@@ -188,10 +211,12 @@
|
|
|
188
211
|
|
|
189
212
|
color: rgb(18 25 42 / var(--tw-text-opacity, 1))
|
|
190
213
|
}
|
|
214
|
+
|
|
191
215
|
.btn-secondary:hover {
|
|
192
216
|
|
|
193
217
|
background-color: #12192A1A
|
|
194
218
|
}
|
|
219
|
+
|
|
195
220
|
.btn-secondary:active {
|
|
196
221
|
|
|
197
222
|
background-color: #12192a0d
|
|
@@ -228,7 +253,7 @@
|
|
|
228
253
|
|
|
229
254
|
border-width: 1px;
|
|
230
255
|
|
|
231
|
-
border-color: #
|
|
256
|
+
border-color: #12192A1A;
|
|
232
257
|
|
|
233
258
|
background-color: transparent;
|
|
234
259
|
|
|
@@ -238,7 +263,13 @@
|
|
|
238
263
|
}
|
|
239
264
|
.btn-outline:hover {
|
|
240
265
|
|
|
241
|
-
|
|
266
|
+
border-color: #12192A26;
|
|
267
|
+
|
|
268
|
+
background-color: #12192a0d;
|
|
269
|
+
|
|
270
|
+
--tw-text-opacity: 1;
|
|
271
|
+
|
|
272
|
+
color: rgb(18 25 42 / var(--tw-text-opacity, 1))
|
|
242
273
|
}
|
|
243
274
|
.btn-outline:disabled {
|
|
244
275
|
|
|
@@ -258,6 +289,22 @@
|
|
|
258
289
|
}
|
|
259
290
|
.btn-secondary-inverse:active {
|
|
260
291
|
|
|
292
|
+
background-color: #FFFFFF0D
|
|
293
|
+
}
|
|
294
|
+
.btn-transparent-inverse {
|
|
295
|
+
|
|
296
|
+
background-color: transparent;
|
|
297
|
+
|
|
298
|
+
--tw-text-opacity: 1;
|
|
299
|
+
|
|
300
|
+
color: rgb(255 255 255 / var(--tw-text-opacity, 1))
|
|
301
|
+
}
|
|
302
|
+
.btn-transparent-inverse:hover {
|
|
303
|
+
|
|
304
|
+
background-color: #FFFFFF26
|
|
305
|
+
}
|
|
306
|
+
.btn-transparent-inverse:active {
|
|
307
|
+
|
|
261
308
|
background-color: #FFFFFF0D
|
|
262
309
|
}
|
|
263
310
|
</style>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'transparent' | 'danger' | 'outline' | 'secondary-inverse' | 'transparent-inverse';
|
|
2
|
+
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
1
3
|
import type { Snippet } from 'svelte';
|
|
2
|
-
type Variant = 'primary' | 'secondary' | 'transparent' | 'danger' | 'outline' | 'secondary-inverse';
|
|
3
4
|
interface Props {
|
|
4
5
|
class?: string;
|
|
5
6
|
onClick?: (event?: MouseEvent) => void;
|
|
@@ -7,10 +8,10 @@ interface Props {
|
|
|
7
8
|
loading?: boolean;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
accessibilityLabel?: string;
|
|
10
|
-
size?:
|
|
11
|
+
size?: ButtonSize;
|
|
11
12
|
id?: string | undefined;
|
|
12
13
|
tabindex?: number | undefined;
|
|
13
|
-
variant?:
|
|
14
|
+
variant?: ButtonVariant;
|
|
14
15
|
children?: Snippet;
|
|
15
16
|
dataTestId?: string;
|
|
16
17
|
rounded?: boolean;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Card from './Card.svelte';
|
|
4
|
+
import RequiredStatusIndicator from '../required-status-indicator/RequiredStatusIndicator.svelte';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Design System/Card',
|
|
8
|
+
component: Card,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
Header: { description: 'Optional header snippet', control: false },
|
|
12
|
+
children: { description: 'Content snippet for the main body (required)', control: false },
|
|
13
|
+
headerBorder: { control: 'boolean', description: 'Show a border below the header' },
|
|
14
|
+
class: { control: 'text', description: 'Additional CSS classes for the card' }
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Story name="Content Only" args={{ class: 'w-96' }} asChild>
|
|
20
|
+
<Card class="w-96">
|
|
21
|
+
{#snippet children()}
|
|
22
|
+
<h3 class="mb-2 text-lg font-semibold text-primary">Card with Content Only</h3>
|
|
23
|
+
<p class="text-secondary">This card demonstrates providing only the children snippet.</p>
|
|
24
|
+
<button
|
|
25
|
+
class="mt-4 rounded bg-accent-inverse px-4 py-2 text-primary-inverse hover:bg-accent-inverse-hover"
|
|
26
|
+
>
|
|
27
|
+
Action Button
|
|
28
|
+
</button>
|
|
29
|
+
{/snippet}
|
|
30
|
+
</Card>
|
|
31
|
+
</Story>
|
|
32
|
+
|
|
33
|
+
<Story name="Header Only" args={{ class: 'w-96' }} asChild>
|
|
34
|
+
<Card class="w-96">
|
|
35
|
+
{#snippet Header()}
|
|
36
|
+
<p class="text-primary">Card with Header Only</p>
|
|
37
|
+
<p class="text-sm text-tertiary">No main content here, just a header.</p>
|
|
38
|
+
{/snippet}
|
|
39
|
+
{#snippet children()}{/snippet}
|
|
40
|
+
</Card>
|
|
41
|
+
</Story>
|
|
42
|
+
|
|
43
|
+
<Story name="Header and Content" args={{ class: 'w-96' }} asChild>
|
|
44
|
+
<Card class="w-96">
|
|
45
|
+
{#snippet Header()}
|
|
46
|
+
<div class="flex items-center justify-between">
|
|
47
|
+
<p class="text-primary">Insect Health</p>
|
|
48
|
+
<span class="text-sm text-success">Target</span>
|
|
49
|
+
</div>
|
|
50
|
+
{/snippet}
|
|
51
|
+
{#snippet children()}
|
|
52
|
+
<div class="space-y-2">
|
|
53
|
+
<div>
|
|
54
|
+
<label for="insect-name" class="block text-sm font-medium text-secondary">Name *</label>
|
|
55
|
+
<input
|
|
56
|
+
type="text"
|
|
57
|
+
id="insect-name"
|
|
58
|
+
value="Insect health"
|
|
59
|
+
class="border-border-input mt-1 block w-full rounded-md p-2"
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
<div>
|
|
63
|
+
<label for="insect-desc" class="block text-sm font-medium text-secondary"
|
|
64
|
+
>Description *</label
|
|
65
|
+
>
|
|
66
|
+
<input
|
|
67
|
+
type="text"
|
|
68
|
+
id="insect-desc"
|
|
69
|
+
value="Health based on insect activity"
|
|
70
|
+
class="border-border-input mt-1 block w-full rounded-md p-2"
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
{/snippet}
|
|
75
|
+
</Card>
|
|
76
|
+
</Story>
|
|
77
|
+
|
|
78
|
+
<Story name="Header, Content, and Border" args={{ headerBorder: true, class: 'w-96' }} asChild>
|
|
79
|
+
<Card headerBorder={true} class="w-96">
|
|
80
|
+
{#snippet Header()}
|
|
81
|
+
<div class="flex items-center justify-between">
|
|
82
|
+
<p class="text-primary">Insect Count</p>
|
|
83
|
+
<RequiredStatusIndicator requiredCount={2} currentCount={2} />
|
|
84
|
+
</div>
|
|
85
|
+
{/snippet}
|
|
86
|
+
{#snippet children()}
|
|
87
|
+
<div class="space-y-2">
|
|
88
|
+
<div>
|
|
89
|
+
<label for="count-name" class="block text-sm font-medium text-secondary">Name *</label>
|
|
90
|
+
<input
|
|
91
|
+
type="text"
|
|
92
|
+
id="count-name"
|
|
93
|
+
value="Insect count"
|
|
94
|
+
class="border-border-input mt-1 block w-full rounded-md p-2"
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
<div>
|
|
98
|
+
<label for="count-desc" class="block text-sm font-medium text-secondary"
|
|
99
|
+
>Description *</label
|
|
100
|
+
>
|
|
101
|
+
<input
|
|
102
|
+
type="text"
|
|
103
|
+
id="count-desc"
|
|
104
|
+
value="Total count of insects detected"
|
|
105
|
+
class="border-border-input mt-1 block w-full rounded-md p-2"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
<p class="text-secondary">This card has a border under the header.</p>
|
|
109
|
+
</div>
|
|
110
|
+
{/snippet}
|
|
111
|
+
</Card>
|
|
112
|
+
</Story>
|
|
113
|
+
|
|
114
|
+
<Story name="With Custom Styling" args={{}} asChild>
|
|
115
|
+
<Card class="w-1/2 bg-accent text-primary-inverse shadow-lg">
|
|
116
|
+
{#snippet Header()}
|
|
117
|
+
<p class="">Custom Styled Card</p>
|
|
118
|
+
{/snippet}
|
|
119
|
+
{#snippet children()}
|
|
120
|
+
<p>
|
|
121
|
+
This card uses the <code class="rounded bg-black/20 px-1">class</code> prop to apply a
|
|
122
|
+
different background (<code class="rounded bg-black/20 px-1">bg-accent</code>), text color (<code
|
|
123
|
+
class="rounded bg-black/20 px-1">text-primary-inverse</code
|
|
124
|
+
>), width (<code class="rounded bg-black/20 px-1">w-1/2</code>), and a larger shadow (<code
|
|
125
|
+
class="rounded bg-black/20 px-1">shadow-lg</code
|
|
126
|
+
>).
|
|
127
|
+
</p>
|
|
128
|
+
{/snippet}
|
|
129
|
+
</Card>
|
|
130
|
+
</Story>
|