@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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export { default as Root } from './components/stepper-root.svelte';
|
|
3
|
+
export { default as Step } from './components/stepper-step.svelte';
|
|
4
|
+
export type StepState = 'completed' | 'active' | 'future';
|
|
5
|
+
export interface StepperRootProps {
|
|
6
|
+
children: Snippet;
|
|
7
|
+
class?: string;
|
|
8
|
+
currentStep?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface StepperStepProps {
|
|
11
|
+
children: Snippet;
|
|
12
|
+
state?: StepState;
|
|
13
|
+
stepNumber: string;
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
dataTestId?: string;
|
|
6
|
+
align?: 'left' | 'right';
|
|
6
7
|
children?: Snippet;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
let { dataTestId = '', children }: Props = $props();
|
|
10
|
+
let { dataTestId = '', align = 'left', children }: Props = $props();
|
|
10
11
|
</script>
|
|
11
12
|
|
|
12
|
-
<td data-testid={dataTestId} class={`text
|
|
13
|
+
<td data-testid={dataTestId} class={`text-${align} text-sm font-normal`}>
|
|
13
14
|
{@render children?.()}
|
|
14
15
|
</td>
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
interface Props {
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
children?: Snippet;
|
|
7
|
+
class?: string;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
let { disabled = false, children }: Props = $props();
|
|
10
|
+
let { disabled = false, children, class: className = '' }: Props = $props();
|
|
10
11
|
</script>
|
|
11
12
|
|
|
12
|
-
<tr class=
|
|
13
|
+
<tr class={`border-static py-2 [&.disabled]:text-tertiary ${className}`} class:disabled>
|
|
13
14
|
{@render children?.()}
|
|
14
15
|
</tr>
|
|
15
16
|
|
|
@@ -25,22 +25,22 @@
|
|
|
25
25
|
];
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
|
-
<Story name="Default">
|
|
28
|
+
<Story name="Default" asChild>
|
|
29
29
|
<div class="w-fit">
|
|
30
30
|
<Tag>Default</Tag>
|
|
31
31
|
</div>
|
|
32
32
|
</Story>
|
|
33
|
-
<Story name="Default small">
|
|
33
|
+
<Story name="Default small" asChild>
|
|
34
34
|
<div class="w-fit">
|
|
35
35
|
<Tag variant="default" size="sm">Default</Tag>
|
|
36
36
|
</div>
|
|
37
37
|
</Story>
|
|
38
|
-
<Story name="Default onclick">
|
|
38
|
+
<Story name="Default onclick" asChild>
|
|
39
39
|
<div class="w-fit">
|
|
40
40
|
<Tag onclick={() => {}}>Default</Tag>
|
|
41
41
|
</div>
|
|
42
42
|
</Story>
|
|
43
|
-
<Story name="Default icon onclick">
|
|
43
|
+
<Story name="Default icon onclick" asChild>
|
|
44
44
|
<div class="w-fit">
|
|
45
45
|
<Tag onclick={() => {}}>
|
|
46
46
|
<Icon iconName="Folder" />
|
|
@@ -49,23 +49,23 @@
|
|
|
49
49
|
</div>
|
|
50
50
|
</Story>
|
|
51
51
|
|
|
52
|
-
<Story name="Transparent">
|
|
52
|
+
<Story name="Transparent" asChild>
|
|
53
53
|
<div class="w-fit">
|
|
54
54
|
<Tag variant="transparent">Transparent</Tag>
|
|
55
55
|
</div>
|
|
56
56
|
</Story>
|
|
57
|
-
<Story name="Transparent small">
|
|
57
|
+
<Story name="Transparent small" asChild>
|
|
58
58
|
<div class="w-fit">
|
|
59
59
|
<Tag variant="transparent" size="sm">Transparent</Tag>
|
|
60
60
|
</div>
|
|
61
61
|
</Story>
|
|
62
|
-
<Story name="Transparent onclick">
|
|
62
|
+
<Story name="Transparent onclick" asChild>
|
|
63
63
|
<div class="w-fit">
|
|
64
64
|
<Tag variant="transparent" onclick={() => {}}>Transparent</Tag>
|
|
65
65
|
</div>
|
|
66
66
|
</Story>
|
|
67
67
|
|
|
68
|
-
<Story name="Variants">
|
|
68
|
+
<Story name="Variants" asChild>
|
|
69
69
|
{#each variants as variant}
|
|
70
70
|
<div class="w-fit">
|
|
71
71
|
<Tag variant={variant as any}>{variant}</Tag>
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
{/each}
|
|
74
74
|
</Story>
|
|
75
75
|
|
|
76
|
-
<Story name="Button variants">
|
|
76
|
+
<Story name="Button variants" asChild>
|
|
77
77
|
{#each variants as variant}
|
|
78
78
|
<div class="w-fit">
|
|
79
79
|
<Tag variant={variant as any} onclick={() => {}}>Click me</Tag>
|
|
@@ -106,30 +106,12 @@
|
|
|
106
106
|
|
|
107
107
|
<style>
|
|
108
108
|
.outer {
|
|
109
|
-
|
|
110
109
|
display: flex;
|
|
111
|
-
|
|
112
110
|
align-items: center;
|
|
113
|
-
|
|
114
111
|
gap: 0.5rem;
|
|
115
|
-
|
|
116
112
|
overflow: hidden;
|
|
117
|
-
|
|
118
113
|
text-overflow: ellipsis;
|
|
119
|
-
|
|
120
114
|
white-space: nowrap;
|
|
121
|
-
|
|
122
115
|
border-radius: 0.25rem
|
|
123
116
|
}
|
|
124
|
-
|
|
125
|
-
svg {
|
|
126
|
-
|
|
127
|
-
height: 1rem;
|
|
128
|
-
|
|
129
|
-
width: 1rem;
|
|
130
|
-
|
|
131
|
-
--tw-text-opacity: 1;
|
|
132
|
-
|
|
133
|
-
color: rgb(136 140 148 / var(--tw-text-opacity, 1))
|
|
134
|
-
}
|
|
135
117
|
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Textarea from './Textarea.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'Design System/Textarea',
|
|
7
|
+
component: Textarea,
|
|
8
|
+
argTypes: {
|
|
9
|
+
value: { control: 'text' },
|
|
10
|
+
placeholder: { control: 'text' },
|
|
11
|
+
size: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: ['xs', 'sm', 'md', 'lg', 'dynamic']
|
|
14
|
+
},
|
|
15
|
+
required: { control: 'boolean' },
|
|
16
|
+
readonly: { control: 'boolean' },
|
|
17
|
+
autofocus: { control: 'boolean' },
|
|
18
|
+
error: { control: 'object' },
|
|
19
|
+
maxlength: { control: 'number' }
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Story
|
|
25
|
+
name="Default"
|
|
26
|
+
args={{
|
|
27
|
+
value: 'This is some default text.',
|
|
28
|
+
placeholder: 'Enter text here...',
|
|
29
|
+
size: 'md'
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
<Story
|
|
34
|
+
name="Empty and Required"
|
|
35
|
+
args={{
|
|
36
|
+
value: '',
|
|
37
|
+
placeholder: 'This field is required',
|
|
38
|
+
required: true,
|
|
39
|
+
size: 'sm'
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
<Story
|
|
44
|
+
name="With Max Length"
|
|
45
|
+
args={{
|
|
46
|
+
value: 'Short text',
|
|
47
|
+
placeholder: 'Max 20 chars',
|
|
48
|
+
maxlength: 20,
|
|
49
|
+
size: 'dynamic'
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
<Story
|
|
53
|
+
name="With Label"
|
|
54
|
+
args={{
|
|
55
|
+
value: 'Short text',
|
|
56
|
+
placeholder: 'Max 20 chars',
|
|
57
|
+
maxlength: 20,
|
|
58
|
+
size: 'dynamic',
|
|
59
|
+
label: 'Label'
|
|
60
|
+
}}
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<Story
|
|
64
|
+
name="Readonly"
|
|
65
|
+
args={{
|
|
66
|
+
value: 'This text cannot be edited.',
|
|
67
|
+
readonly: true,
|
|
68
|
+
size: 'md'
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<Story name="Invalid State" asChild>
|
|
73
|
+
<Textarea size="md" placeholder="Error here" value="This input is invalid.">
|
|
74
|
+
{#snippet error()}
|
|
75
|
+
<p class="text-danger">This is an error</p>
|
|
76
|
+
{/snippet}
|
|
77
|
+
</Textarea>
|
|
78
|
+
</Story>
|
|
79
|
+
|
|
80
|
+
<Story name="Autofocus" args={{ placeholder: 'I should be focused', autofocus: true }} />
|
|
81
|
+
|
|
82
|
+
<!-- Story to demonstrate auto-resizing. Requires interaction -->
|
|
83
|
+
<Story
|
|
84
|
+
name="Auto Resizing"
|
|
85
|
+
args={{
|
|
86
|
+
value: 'Initial line.\nAnother line to start with.',
|
|
87
|
+
placeholder: 'Type here...',
|
|
88
|
+
size: 'dynamic'
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
{#snippet template(args)}
|
|
92
|
+
<div class="w-96">
|
|
93
|
+
<p class="mb-2 text-sm">Type or paste multiple lines to see it resize (max height 200px):</p>
|
|
94
|
+
<Textarea {...args} />
|
|
95
|
+
</div>
|
|
96
|
+
{/snippet}
|
|
97
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Textarea from './Textarea.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 Textarea: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Textarea = InstanceType<typeof Textarea>;
|
|
19
|
+
export default Textarea;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
interface TextareaProps extends HTMLTextareaAttributes {
|
|
6
|
+
oninput?: (event: Event) => void;
|
|
7
|
+
onblur?: (event: Event) => void;
|
|
8
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
9
|
+
input?: HTMLTextAreaElement;
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'dynamic';
|
|
11
|
+
label?: string;
|
|
12
|
+
error?: Snippet;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
value = $bindable(),
|
|
18
|
+
oninput = () => {},
|
|
19
|
+
onblur = () => {},
|
|
20
|
+
onkeydown = () => {},
|
|
21
|
+
input = $bindable(),
|
|
22
|
+
label,
|
|
23
|
+
placeholder,
|
|
24
|
+
error,
|
|
25
|
+
id,
|
|
26
|
+
size = 'md',
|
|
27
|
+
class: className,
|
|
28
|
+
...rest
|
|
29
|
+
}: TextareaProps = $props();
|
|
30
|
+
|
|
31
|
+
const textareaId = crypto.randomUUID();
|
|
32
|
+
const inputId = $derived(id ?? textareaId);
|
|
33
|
+
|
|
34
|
+
function handleInputInternal(event: Event) {
|
|
35
|
+
if (rest.readonly) return;
|
|
36
|
+
const target = event.target as HTMLTextAreaElement;
|
|
37
|
+
value = target.value;
|
|
38
|
+
autoResizeTextarea(target);
|
|
39
|
+
oninput(event);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function autoResizeTextarea(textarea: HTMLTextAreaElement) {
|
|
43
|
+
const maxHeight = 200;
|
|
44
|
+
textarea.style.height = 'auto';
|
|
45
|
+
if (textarea.scrollHeight < maxHeight) {
|
|
46
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
47
|
+
textarea.style.overflowY = 'hidden';
|
|
48
|
+
} else {
|
|
49
|
+
textarea.style.height = `${maxHeight}px`;
|
|
50
|
+
textarea.style.overflowY = 'auto';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function handleBlurInternal(event: Event) {
|
|
55
|
+
onblur(event);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function focus() {
|
|
59
|
+
input?.focus();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
$effect(() => {
|
|
63
|
+
if (input && value) {
|
|
64
|
+
autoResizeTextarea(input);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
{#if label}
|
|
70
|
+
<label for={inputId} class="block px-1 py-2 text-sm text-secondary">
|
|
71
|
+
{label}
|
|
72
|
+
{#if rest.required}
|
|
73
|
+
<span class="ml-0.5 text-danger">*</span>
|
|
74
|
+
{/if}
|
|
75
|
+
</label>
|
|
76
|
+
{/if}
|
|
77
|
+
|
|
78
|
+
<textarea
|
|
79
|
+
id={inputId}
|
|
80
|
+
class="flex w-full items-center gap-1 rounded-lg border border-input bg-surface px-3 py-2 shadow-input focus-within:border-focus hover:border-hover {className ??
|
|
81
|
+
''}"
|
|
82
|
+
class:!border-error={error}
|
|
83
|
+
class:has-text={value}
|
|
84
|
+
class:has-placeholder={placeholder}
|
|
85
|
+
{placeholder}
|
|
86
|
+
oninput={handleInputInternal}
|
|
87
|
+
onblur={handleBlurInternal}
|
|
88
|
+
bind:this={input}
|
|
89
|
+
{value}
|
|
90
|
+
{...rest}
|
|
91
|
+
{onkeydown}
|
|
92
|
+
></textarea>
|
|
93
|
+
|
|
94
|
+
{@render error?.()}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
3
|
+
interface TextareaProps extends HTMLTextareaAttributes {
|
|
4
|
+
oninput?: (event: Event) => void;
|
|
5
|
+
onblur?: (event: Event) => void;
|
|
6
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
7
|
+
input?: HTMLTextAreaElement;
|
|
8
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'dynamic';
|
|
9
|
+
label?: string;
|
|
10
|
+
error?: Snippet;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const Textarea: import("svelte").Component<TextareaProps, {
|
|
14
|
+
focus: () => void;
|
|
15
|
+
}, "value" | "input">;
|
|
16
|
+
type Textarea = ReturnType<typeof Textarea>;
|
|
17
|
+
export default Textarea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Textarea } from './Textarea.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Textarea } from './Textarea.svelte';
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
value?: boolean;
|
|
4
4
|
onclick?: (event?: MouseEvent) => void;
|
|
5
5
|
id: string;
|
|
6
|
+
'data-testid'?: string;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
let { value = $bindable(false), onclick, id }: Props = $props();
|
|
9
|
+
let { value = $bindable(false), onclick, id, 'data-testid': testId }: Props = $props();
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<label class="switch">
|
|
12
|
-
<input type="checkbox" bind:checked={value} {onclick} {id} />
|
|
13
|
+
<input type="checkbox" bind:checked={value} {onclick} {id} data-testid={testId} />
|
|
13
14
|
<span class="slider round"></span>
|
|
14
15
|
</label>
|
|
15
16
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
});
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<Story name="States">
|
|
13
|
+
<Story name="States" asChild>
|
|
14
14
|
<div class="flex flex-col gap-4">
|
|
15
15
|
<div class="bg-neutral-dark flex gap-4 p-4">
|
|
16
16
|
<div class="flex flex-col items-center gap-2">
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</div>
|
|
30
30
|
</Story>
|
|
31
31
|
|
|
32
|
-
<Story name="Variants">
|
|
32
|
+
<Story name="Variants" asChild>
|
|
33
33
|
<div class="flex flex-col gap-4">
|
|
34
34
|
<div class="flex gap-8">
|
|
35
35
|
<div class="flex flex-col gap-2">
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
</div>
|
|
61
61
|
</Story>
|
|
62
62
|
|
|
63
|
-
<Story name="Sizes">
|
|
63
|
+
<Story name="Sizes" asChild>
|
|
64
64
|
<div class="flex gap-8">
|
|
65
65
|
<div class="flex flex-col items-center gap-2">
|
|
66
66
|
<p class="text-sm">XS</p>
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
</div>
|
|
110
110
|
</Story>
|
|
111
111
|
|
|
112
|
-
<Story name="Rounded vs Square">
|
|
112
|
+
<Story name="Rounded vs Square" asChild>
|
|
113
113
|
<div class="flex gap-8">
|
|
114
114
|
<div class="flex flex-col items-center gap-2">
|
|
115
115
|
<p class="text-sm">Rounded</p>
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
</div>
|
|
137
137
|
</Story>
|
|
138
138
|
|
|
139
|
-
<Story name="Primary Inverse Example">
|
|
139
|
+
<Story name="Primary Inverse Example" asChild>
|
|
140
140
|
<div class="bg-neutral-dark p-8">
|
|
141
141
|
<div class="flex gap-8">
|
|
142
142
|
<div class="flex flex-col items-center gap-2">
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
</div>
|
|
156
156
|
</Story>
|
|
157
157
|
|
|
158
|
-
<Story name="Disabled and Loading">
|
|
158
|
+
<Story name="Disabled and Loading" asChild>
|
|
159
159
|
<div class="flex gap-8">
|
|
160
160
|
<div class="flex flex-col items-center gap-2">
|
|
161
161
|
<p class="text-sm">Disabled</p>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
});
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
|
-
<Story name="Base">
|
|
12
|
+
<Story name="Base" asChild>
|
|
13
13
|
<div class="flex justify-center">
|
|
14
14
|
<Tooltip>
|
|
15
15
|
{#snippet trigger()}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
</Story>
|
|
24
24
|
|
|
25
|
-
<Story name="Force Open">
|
|
25
|
+
<Story name="Force Open" asChild>
|
|
26
26
|
<div class="flex justify-center">
|
|
27
27
|
<Tooltip forceOpen={true}>
|
|
28
28
|
{#snippet trigger()}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</div>
|
|
36
36
|
</Story>
|
|
37
37
|
|
|
38
|
-
<Story name="No Arrow">
|
|
38
|
+
<Story name="No Arrow" asChild>
|
|
39
39
|
<div class="flex justify-center">
|
|
40
40
|
<Tooltip showArrow={false}>
|
|
41
41
|
{#snippet trigger()}
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
</div>
|
|
49
49
|
</Story>
|
|
50
50
|
|
|
51
|
-
<Story name="Different Placements">
|
|
51
|
+
<Story name="Different Placements" asChild>
|
|
52
52
|
<div class="flex justify-center gap-4 py-8">
|
|
53
53
|
<div>
|
|
54
54
|
<Tooltip placement="top">
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
</div>
|
|
94
94
|
</Story>
|
|
95
95
|
|
|
96
|
-
<Story name="Custom Content">
|
|
96
|
+
<Story name="Custom Content" asChild>
|
|
97
97
|
<div class="flex h-28 items-end justify-center">
|
|
98
98
|
<Tooltip>
|
|
99
99
|
{#snippet trigger()}
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
</div>
|
|
110
110
|
</Story>
|
|
111
111
|
|
|
112
|
-
<Story name="Custom Content Forced Open">
|
|
112
|
+
<Story name="Custom Content Forced Open" asChild>
|
|
113
113
|
<div class="flex h-28 items-end justify-center">
|
|
114
114
|
<Tooltip forceOpen={true}>
|
|
115
115
|
{#snippet trigger()}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
open={forceOpen}
|
|
29
29
|
arrow={showArrow}
|
|
30
30
|
{placement}
|
|
31
|
-
class={`${tooltipClass} rounded bg-base-inverse px-2 py-1 text-sm font-normal text-primary-inverse shadow`}
|
|
31
|
+
class={`${tooltipClass} max-w-xs text-wrap rounded bg-base-inverse px-2 py-1 text-left text-sm font-normal text-primary-inverse shadow`}
|
|
32
32
|
>
|
|
33
33
|
{@render content?.()}
|
|
34
34
|
</Tooltip>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './components/activity/';
|
|
2
2
|
export * from './components/avatar/';
|
|
3
|
+
export * from './components/card/';
|
|
3
4
|
export * from './components/banner/';
|
|
4
5
|
export * from './components/button/';
|
|
5
6
|
export * as Collapsible from './components/collapsible/';
|
|
@@ -19,22 +20,28 @@ export * from './components/list/';
|
|
|
19
20
|
export * from './components/logo/';
|
|
20
21
|
export * from './components/markdown/';
|
|
21
22
|
export * from './components/modal/';
|
|
23
|
+
export * from './components/manual-cfu-counter/';
|
|
22
24
|
export * from './components/notification-popup/';
|
|
23
25
|
export * from './components/pill/';
|
|
24
26
|
export * from './components/progress-circle/';
|
|
27
|
+
export * from './components/required-status-indicator/';
|
|
25
28
|
export * from './components/segmented-control-buttons/';
|
|
26
29
|
export * from './components/select/';
|
|
30
|
+
export * as SelectNew from './components/select-new/';
|
|
27
31
|
export * from './components/skeleton-loader/';
|
|
28
32
|
export * from './components/slider/';
|
|
29
33
|
export * from './components/spinner/';
|
|
30
34
|
export * from './components/stat-card/';
|
|
31
35
|
export * from './components/status-badge/';
|
|
36
|
+
export * from './components/stepper/';
|
|
32
37
|
export * from './components/table/';
|
|
33
38
|
export * from './components/tabs/';
|
|
34
39
|
export * from './components/tag/';
|
|
35
40
|
export * from './components/toggle-icon-button/';
|
|
41
|
+
export * from './components/textarea/index';
|
|
36
42
|
export * from './components/tooltip/';
|
|
37
43
|
export * from './components/toggle/';
|
|
38
44
|
export * from './components/checkbox/';
|
|
45
|
+
export * from './components/sjsf-wrappers/';
|
|
39
46
|
export { tokens } from './tokens';
|
|
40
47
|
import './app.css';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Components
|
|
2
2
|
export * from './components/activity/';
|
|
3
3
|
export * from './components/avatar/';
|
|
4
|
+
export * from './components/card/';
|
|
4
5
|
export * from './components/banner/';
|
|
5
6
|
export * from './components/button/';
|
|
6
7
|
export * as Collapsible from './components/collapsible/';
|
|
@@ -20,23 +21,29 @@ export * from './components/list/';
|
|
|
20
21
|
export * from './components/logo/';
|
|
21
22
|
export * from './components/markdown/';
|
|
22
23
|
export * from './components/modal/';
|
|
24
|
+
export * from './components/manual-cfu-counter/';
|
|
23
25
|
export * from './components/notification-popup/';
|
|
24
26
|
export * from './components/pill/';
|
|
25
27
|
export * from './components/progress-circle/';
|
|
28
|
+
export * from './components/required-status-indicator/';
|
|
26
29
|
export * from './components/segmented-control-buttons/';
|
|
27
30
|
export * from './components/select/';
|
|
31
|
+
export * as SelectNew from './components/select-new/';
|
|
28
32
|
export * from './components/skeleton-loader/';
|
|
29
33
|
export * from './components/slider/';
|
|
30
34
|
export * from './components/spinner/';
|
|
31
35
|
export * from './components/stat-card/';
|
|
32
36
|
export * from './components/status-badge/';
|
|
37
|
+
export * from './components/stepper/';
|
|
33
38
|
export * from './components/table/';
|
|
34
39
|
export * from './components/tabs/';
|
|
35
40
|
export * from './components/tag/';
|
|
36
41
|
export * from './components/toggle-icon-button/';
|
|
42
|
+
export * from './components/textarea/index';
|
|
37
43
|
export * from './components/tooltip/';
|
|
38
44
|
export * from './components/toggle/';
|
|
39
45
|
export * from './components/checkbox/';
|
|
46
|
+
export * from './components/sjsf-wrappers/';
|
|
40
47
|
// Styles and Tokens
|
|
41
48
|
export { tokens } from './tokens';
|
|
42
49
|
import './app.css';
|