@reshape-biotech/design-system 0.0.23 → 0.0.25
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/README.md +30 -38
- package/dist/app.css +4 -4
- 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.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.svelte +85 -0
- package/dist/components/button/Button.svelte.d.ts +17 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/datepicker/DatePicker.svelte +283 -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.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 +99 -0
- package/dist/components/drawer/Drawer.svelte +45 -0
- package/dist/components/drawer/Drawer.svelte.d.ts +12 -0
- package/dist/components/drawer/DrawerLabel.svelte +13 -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 +214 -0
- package/dist/components/dropdown/Dropdown.svelte +69 -0
- package/dist/components/dropdown/Dropdown.svelte.d.ts +14 -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 +44 -0
- package/dist/components/dropdown/components/DropdownTrigger.svelte.d.ts +12 -0
- package/dist/components/dropdown/index.d.ts +1 -0
- package/dist/components/dropdown/index.js +1 -0
- package/dist/components/icon-button/IconButton.stories.svelte +52 -0
- package/dist/components/icon-button/IconButton.svelte +72 -0
- package/dist/components/icon-button/IconButton.svelte.d.ts +14 -0
- package/dist/components/icon-button/index.d.ts +1 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/image/Image.svelte +56 -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 +81 -0
- package/dist/components/input/Input.svelte +131 -0
- package/dist/components/input/Input.svelte.d.ts +20 -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.svelte +75 -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/markdown/Markdown.stories.svelte +41 -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 +41 -0
- package/dist/components/modal/Modal.svelte +56 -0
- package/dist/components/modal/Modal.svelte.d.ts +16 -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.svelte +31 -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 +59 -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.svelte +21 -0
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.svelte.d.ts +10 -0
- package/dist/components/segmented-control-buttons/index.d.ts +2 -0
- package/dist/components/segmented-control-buttons/index.js +2 -0
- package/dist/components/select/Select.stories.svelte +113 -0
- package/dist/components/select/Select.svelte +137 -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 +71 -0
- package/dist/components/skeleton-loader/SkeletonLoader.svelte +17 -0
- package/dist/components/skeleton-loader/SkeletonLoader.svelte.d.ts +9 -0
- package/dist/components/skeleton-loader/StatcardSkeleton.svelte +17 -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/{tooltip/Tooltip.stories.svelte.d.ts → skeleton-loader/components/SkeletonImage.svelte.d.ts} +3 -4
- 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.svelte +117 -0
- package/dist/components/slider/Slider.svelte.d.ts +29 -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.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.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 +86 -0
- package/dist/components/table/Table.svelte +33 -0
- package/dist/components/table/Table.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 +30 -0
- package/dist/components/tabs/Tabs.svelte +15 -0
- package/dist/components/tabs/Tabs.svelte.d.ts +8 -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 +50 -0
- package/dist/components/tag/Tag.svelte +104 -0
- package/dist/components/tag/Tag.svelte.d.ts +11 -0
- package/dist/components/tag/index.d.ts +1 -0
- package/dist/components/tag/index.js +1 -0
- package/dist/components/toast/Toast.svelte +66 -0
- package/dist/components/toast/Toast.svelte.d.ts +5 -0
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/fonts/MDSystem-Medium.woff +0 -0
- package/dist/fonts/MDSystem-Medium.woff2 +0 -0
- package/dist/fonts/MDSystem-Regular.woff +0 -0
- package/dist/fonts/MDSystem-Regular.woff2 +0 -0
- package/dist/fonts/MDSystem-Semibold.woff +0 -0
- package/dist/fonts/MDSystem-Semibold.woff2 +0 -0
- package/dist/fonts/MDSystemMono-Regular.woff +0 -0
- package/dist/fonts/MDSystemMono-Regular.woff2 +0 -0
- package/dist/fonts/index.d.ts +6 -0
- package/dist/fonts/index.js +10 -0
- package/dist/index.d.ts +29 -3
- package/dist/index.js +31 -4
- package/dist/tailwind.preset.d.ts +1 -0
- package/dist/tokens.d.ts +314 -36
- package/dist/tokens.js +235 -248
- package/dist/types/fonts.d.ts +4 -0
- package/package.json +9 -15
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import Input from './Input.svelte';
|
|
3
|
+
|
|
4
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
component: Input,
|
|
8
|
+
title: 'Design System/Input',
|
|
9
|
+
tags: ['autodocs']
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
let value = '';
|
|
13
|
+
let email = 'bob@foo.com';
|
|
14
|
+
let password = 'wordpass';
|
|
15
|
+
|
|
16
|
+
let textareaValue = '';
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Story name="Base">
|
|
20
|
+
<Input bind:value autofocus />
|
|
21
|
+
</Story>
|
|
22
|
+
|
|
23
|
+
<Story name="Login">
|
|
24
|
+
<div class="flex flex-col gap-2">
|
|
25
|
+
<Input bind:value={email} label="Email" type="text" required id="email-select" autofocus />
|
|
26
|
+
<Input bind:value={password} label="Password" id="password-select" type="password" required />
|
|
27
|
+
</div>
|
|
28
|
+
</Story>
|
|
29
|
+
|
|
30
|
+
<Story name="Textarea">
|
|
31
|
+
<Input
|
|
32
|
+
bind:value={textareaValue}
|
|
33
|
+
label="Description"
|
|
34
|
+
type="textarea"
|
|
35
|
+
placeholder="Add a description..."
|
|
36
|
+
/>
|
|
37
|
+
</Story>
|
|
38
|
+
|
|
39
|
+
<Story name="Prefix">
|
|
40
|
+
<Input value="Bob">
|
|
41
|
+
{#snippet prefix()}
|
|
42
|
+
<div>Mr.</div>
|
|
43
|
+
{/snippet}
|
|
44
|
+
</Input>
|
|
45
|
+
</Story>
|
|
46
|
+
|
|
47
|
+
<Story name="Suffix">
|
|
48
|
+
<Input value="30">
|
|
49
|
+
{#snippet suffix()}
|
|
50
|
+
<div>± 1°C</div>
|
|
51
|
+
{/snippet}
|
|
52
|
+
</Input>
|
|
53
|
+
</Story>
|
|
54
|
+
|
|
55
|
+
<Story name="Prefix & Suffix">
|
|
56
|
+
<Input value="9001">
|
|
57
|
+
{#snippet prefix()}
|
|
58
|
+
<div>$</div>
|
|
59
|
+
{/snippet}
|
|
60
|
+
{#snippet suffix()}
|
|
61
|
+
<div>🔥</div>
|
|
62
|
+
{/snippet}
|
|
63
|
+
</Input>
|
|
64
|
+
</Story>
|
|
65
|
+
|
|
66
|
+
<Story name="Validation">
|
|
67
|
+
<Input value="Focus me, then click away" validator={(val) => val.toString().length < 10}>
|
|
68
|
+
{#snippet prefix({ valid })}
|
|
69
|
+
<div>
|
|
70
|
+
{#if valid}
|
|
71
|
+
😊
|
|
72
|
+
{:else}
|
|
73
|
+
😔
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
76
|
+
{/snippet}
|
|
77
|
+
{#snippet error()}
|
|
78
|
+
<p class="pt-2 text-error">Oh no! Too many characters!</p>
|
|
79
|
+
{/snippet}
|
|
80
|
+
</Input>
|
|
81
|
+
</Story>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
label?: string | null;
|
|
6
|
+
value: string | number;
|
|
7
|
+
type?: 'text' | 'password' | 'textarea' | 'number';
|
|
8
|
+
required?: boolean;
|
|
9
|
+
autofocus?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
id?: string | undefined;
|
|
12
|
+
validator?: (a: string | number) => boolean;
|
|
13
|
+
onBlur?: (e: Event) => void;
|
|
14
|
+
onkeydown?: (e: KeyboardEvent) => void;
|
|
15
|
+
prefix?: Snippet<[any]>;
|
|
16
|
+
suffix?: Snippet;
|
|
17
|
+
error?: Snippet;
|
|
18
|
+
input?: HTMLInputElement | HTMLTextAreaElement;
|
|
19
|
+
maxlength?: number | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
label = null,
|
|
24
|
+
value = $bindable(),
|
|
25
|
+
type = 'text',
|
|
26
|
+
required = false,
|
|
27
|
+
autofocus = false,
|
|
28
|
+
placeholder = '',
|
|
29
|
+
id = undefined,
|
|
30
|
+
validator = (_) => {
|
|
31
|
+
return true;
|
|
32
|
+
},
|
|
33
|
+
onBlur = () => {},
|
|
34
|
+
onkeydown = () => {},
|
|
35
|
+
prefix,
|
|
36
|
+
suffix,
|
|
37
|
+
error,
|
|
38
|
+
input = $bindable(),
|
|
39
|
+
maxlength = null
|
|
40
|
+
}: Props = $props();
|
|
41
|
+
|
|
42
|
+
let valid = $state(true);
|
|
43
|
+
|
|
44
|
+
const inputId = Math.random().toString(36).substring(7); // used for A11y
|
|
45
|
+
|
|
46
|
+
function handleInput(event: Event) {
|
|
47
|
+
const target = event.target as HTMLTextAreaElement | HTMLInputElement;
|
|
48
|
+
value = target.value;
|
|
49
|
+
|
|
50
|
+
if (type === 'textarea') {
|
|
51
|
+
autoResizeTextarea(target as HTMLTextAreaElement);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function autoResizeTextarea(textarea: HTMLTextAreaElement) {
|
|
55
|
+
textarea.style.height = 'auto';
|
|
56
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleBlur(event: Event) {
|
|
60
|
+
valid = validator(value);
|
|
61
|
+
onBlur(event);
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<div class="w-full">
|
|
66
|
+
{#if label}
|
|
67
|
+
<label for={id ?? inputId} class="block px-1 py-2 text-sm text-secondary">{label}</label>
|
|
68
|
+
{/if}
|
|
69
|
+
<div
|
|
70
|
+
class="flex w-full items-center gap-1 rounded-lg border border-transparent bg-surface p-3"
|
|
71
|
+
class:!border-error={!valid}
|
|
72
|
+
class:focus-within:border-focus={valid}
|
|
73
|
+
>
|
|
74
|
+
{#if type === 'textarea'}
|
|
75
|
+
<textarea
|
|
76
|
+
id={id ?? inputId}
|
|
77
|
+
rows="3"
|
|
78
|
+
class:has-text={value}
|
|
79
|
+
class:has-placeholder={placeholder}
|
|
80
|
+
aria-label={label}
|
|
81
|
+
oninput={handleInput}
|
|
82
|
+
onblur={handleBlur}
|
|
83
|
+
{onkeydown}
|
|
84
|
+
bind:this={input}
|
|
85
|
+
{value}
|
|
86
|
+
{required}
|
|
87
|
+
{autofocus}
|
|
88
|
+
{placeholder}
|
|
89
|
+
{maxlength}
|
|
90
|
+
></textarea>
|
|
91
|
+
{:else}
|
|
92
|
+
<div class="whitespace-nowrap text-secondary">
|
|
93
|
+
{@render prefix?.({ valid })}
|
|
94
|
+
</div>
|
|
95
|
+
<input
|
|
96
|
+
id={id ?? inputId}
|
|
97
|
+
class="inline leading-none"
|
|
98
|
+
class:has-text={value}
|
|
99
|
+
class:has-placeholder={placeholder}
|
|
100
|
+
aria-label={label}
|
|
101
|
+
{type}
|
|
102
|
+
{required}
|
|
103
|
+
oninput={handleInput}
|
|
104
|
+
onblur={handleBlur}
|
|
105
|
+
{onkeydown}
|
|
106
|
+
bind:this={input}
|
|
107
|
+
{value}
|
|
108
|
+
{autofocus}
|
|
109
|
+
{placeholder}
|
|
110
|
+
{maxlength}
|
|
111
|
+
/>
|
|
112
|
+
<div class="whitespace-nowrap text-secondary">
|
|
113
|
+
{@render suffix?.()}
|
|
114
|
+
</div>
|
|
115
|
+
{/if}
|
|
116
|
+
</div>
|
|
117
|
+
{#if !valid}
|
|
118
|
+
{@render error?.()}
|
|
119
|
+
{/if}
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<style>
|
|
123
|
+
input,
|
|
124
|
+
textarea {
|
|
125
|
+
width: 100%;
|
|
126
|
+
resize: none;
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
outline: 2px solid transparent;
|
|
129
|
+
outline-offset: 2px
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
declare const Input: import("svelte").Component<{
|
|
3
|
+
label?: string | null;
|
|
4
|
+
value: string | number;
|
|
5
|
+
type?: "text" | "password" | "textarea" | "number";
|
|
6
|
+
required?: boolean;
|
|
7
|
+
autofocus?: boolean;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
id?: string | undefined;
|
|
10
|
+
validator?: (a: string | number) => boolean;
|
|
11
|
+
onBlur?: (e: Event) => void;
|
|
12
|
+
onkeydown?: (e: KeyboardEvent) => void;
|
|
13
|
+
prefix?: Snippet<[any]>;
|
|
14
|
+
suffix?: Snippet;
|
|
15
|
+
error?: Snippet;
|
|
16
|
+
input?: HTMLInputElement | HTMLTextAreaElement;
|
|
17
|
+
maxlength?: number | null;
|
|
18
|
+
}, {}, "input" | "value">;
|
|
19
|
+
type Input = ReturnType<typeof Input>;
|
|
20
|
+
export default Input;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Input } from './Input.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Input } from './Input.svelte';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import List from './List.svelte';
|
|
3
|
+
import Tag from 'design-system/components/tag/Tag.svelte';
|
|
4
|
+
import { ArrowUpRight } from 'phosphor-svelte';
|
|
5
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: List,
|
|
9
|
+
title: 'Design System/List',
|
|
10
|
+
tags: ['autodocs']
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const items: { name: string; licenses: string; repository: string }[] = [
|
|
14
|
+
{ name: 'Formik', licenses: 'MIT', repository: 'somewhere' },
|
|
15
|
+
{ name: 'Formik', licenses: 'MIT', repository: 'somewhere' },
|
|
16
|
+
{ name: 'Formik', licenses: 'MIT', repository: 'somewhere' },
|
|
17
|
+
{ name: 'Formik', licenses: 'MIT', repository: 'somewhere' }
|
|
18
|
+
];
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Story name="Default" args={{}}>
|
|
22
|
+
<List {items}>
|
|
23
|
+
{#snippet item(item)}
|
|
24
|
+
<div class="flex min-h-2 flex-row gap-2">
|
|
25
|
+
<div class="flex flex-row justify-start gap-2">
|
|
26
|
+
<div class="max-w-56 truncate font-bold">
|
|
27
|
+
{item.name}
|
|
28
|
+
</div>
|
|
29
|
+
{#if item.licenses}
|
|
30
|
+
<Tag>
|
|
31
|
+
{item.licenses}
|
|
32
|
+
</Tag>
|
|
33
|
+
{/if}
|
|
34
|
+
</div>
|
|
35
|
+
<div class="flex grow flex-row justify-end gap-3">
|
|
36
|
+
{#if item.repository}
|
|
37
|
+
<div class="flex flex-row items-center gap-1">
|
|
38
|
+
<a
|
|
39
|
+
href={item.repository}
|
|
40
|
+
class="text-secondary"
|
|
41
|
+
target="_blank"
|
|
42
|
+
rel="noopener noreferrer"
|
|
43
|
+
>
|
|
44
|
+
Repository
|
|
45
|
+
</a>
|
|
46
|
+
<ArrowUpRight />
|
|
47
|
+
</div>
|
|
48
|
+
{/if}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
{/snippet}
|
|
52
|
+
</List>
|
|
53
|
+
</Story>
|
|
54
|
+
|
|
55
|
+
<Story name="Compact" args={{ variant: 'compact' }}>
|
|
56
|
+
<List {items} variant="compact">
|
|
57
|
+
{#snippet item(item)}
|
|
58
|
+
<div class="flex min-h-2 flex-row gap-2">
|
|
59
|
+
<div class="flex flex-row justify-start gap-2">
|
|
60
|
+
<div class="max-w-56 truncate font-bold">
|
|
61
|
+
{item.name}
|
|
62
|
+
</div>
|
|
63
|
+
{#if item.licenses}
|
|
64
|
+
<Tag>
|
|
65
|
+
{item.licenses}
|
|
66
|
+
</Tag>
|
|
67
|
+
{/if}
|
|
68
|
+
</div>
|
|
69
|
+
<div class="flex grow flex-row justify-end gap-3">
|
|
70
|
+
{#if item.repository}
|
|
71
|
+
<div class="flex flex-row items-center gap-1">
|
|
72
|
+
<a
|
|
73
|
+
href={item.repository}
|
|
74
|
+
class="text-gray-700"
|
|
75
|
+
target="_blank"
|
|
76
|
+
rel="noopener noreferrer"
|
|
77
|
+
>
|
|
78
|
+
Repository
|
|
79
|
+
</a>
|
|
80
|
+
<ArrowUpRight />
|
|
81
|
+
</div>
|
|
82
|
+
{/if}
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
{/snippet}
|
|
86
|
+
</List>
|
|
87
|
+
</Story>
|
|
88
|
+
|
|
89
|
+
<Story name="Loading">
|
|
90
|
+
<List variant="compact" items={[{}, {}, {}]}>
|
|
91
|
+
{#snippet item({})}
|
|
92
|
+
<div class="flex h-8 w-full items-center">
|
|
93
|
+
<div class="skeleton h-6 w-full bg-neutral"></div>
|
|
94
|
+
</div>
|
|
95
|
+
{/snippet}
|
|
96
|
+
</List>
|
|
97
|
+
</Story>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import type { Overflow } from '../../tailwind';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
items: T[];
|
|
7
|
+
item: Snippet<[T]>;
|
|
8
|
+
overflow?: Overflow;
|
|
9
|
+
variant?: 'compact' | 'default';
|
|
10
|
+
};
|
|
11
|
+
let { items, item, overflow = 'overflow-y-auto', variant = 'default' }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class="{`listStyles ${variant === 'compact' ? 'compact' : 'default'} ${overflow} `}}">
|
|
15
|
+
{#each items as currentItem, i}
|
|
16
|
+
<div class="item">
|
|
17
|
+
{@render item(currentItem)}
|
|
18
|
+
</div>
|
|
19
|
+
{/each}
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
.listStyles {
|
|
24
|
+
|
|
25
|
+
display: flex;
|
|
26
|
+
|
|
27
|
+
height: 100%;
|
|
28
|
+
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
|
|
31
|
+
align-items: flex-start;
|
|
32
|
+
|
|
33
|
+
align-self: stretch;
|
|
34
|
+
|
|
35
|
+
border-radius: 0.25rem
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.listStyles.default {
|
|
39
|
+
|
|
40
|
+
gap: 0.5rem
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.listStyles.compact {
|
|
44
|
+
|
|
45
|
+
gap: 0px;
|
|
46
|
+
|
|
47
|
+
--tw-bg-opacity: 1;
|
|
48
|
+
|
|
49
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
50
|
+
|
|
51
|
+
padding-bottom: 0.5rem;
|
|
52
|
+
|
|
53
|
+
padding-left: 1.5rem;
|
|
54
|
+
|
|
55
|
+
padding-right: 1.5rem;
|
|
56
|
+
|
|
57
|
+
padding-top: 0.5rem
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.listStyles.compact :global(> .item:not(:last-child)) {
|
|
61
|
+
|
|
62
|
+
border-bottom-width: 1px;
|
|
63
|
+
|
|
64
|
+
border-style: solid;
|
|
65
|
+
|
|
66
|
+
--tw-border-opacity: 1;
|
|
67
|
+
|
|
68
|
+
border-color: var(--fallback-n,oklch(var(--n)/var(--tw-border-opacity, 1)))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.listStyles :global(.item) {
|
|
72
|
+
|
|
73
|
+
align-self: stretch
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Overflow } from '../../tailwind';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
declare class __sveltets_Render<T> {
|
|
4
|
+
props(): {
|
|
5
|
+
items: T[];
|
|
6
|
+
item: Snippet<[T]>;
|
|
7
|
+
overflow?: Overflow;
|
|
8
|
+
variant?: "compact" | "default";
|
|
9
|
+
};
|
|
10
|
+
events(): {};
|
|
11
|
+
slots(): {};
|
|
12
|
+
bindings(): "";
|
|
13
|
+
exports(): {};
|
|
14
|
+
}
|
|
15
|
+
interface $$IsomorphicComponent {
|
|
16
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
17
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
18
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
19
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
20
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
21
|
+
}
|
|
22
|
+
declare const List: $$IsomorphicComponent;
|
|
23
|
+
type List<T> = InstanceType<typeof List<T>>;
|
|
24
|
+
export default List;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as List } from './List.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as List } from './List.svelte';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import Markdown from './Markdown.svelte';
|
|
3
|
+
|
|
4
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
5
|
+
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
component: Markdown,
|
|
8
|
+
title: 'Design System/Markdown',
|
|
9
|
+
tags: ['autodocs']
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="Primary">
|
|
14
|
+
<Markdown
|
|
15
|
+
markdown={`# Welcome to My Markdown Story
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- **Bold** and *italic* text
|
|
20
|
+
- Lists (ordered and unordered)
|
|
21
|
+
- [Links](https://example.com)
|
|
22
|
+
- Code blocks
|
|
23
|
+
|
|
24
|
+
### Example Code
|
|
25
|
+
|
|
26
|
+
\`\`\`javascript
|
|
27
|
+
function greet(name) {
|
|
28
|
+
console.log(\`Hello, \${name}!\`);
|
|
29
|
+
}
|
|
30
|
+
greet('Storybook');
|
|
31
|
+
\`\`\`
|
|
32
|
+
|
|
33
|
+
> This is a blockquote. It's great for highlighting important information.
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
Happy storytelling with Markdown!`}
|
|
40
|
+
/>
|
|
41
|
+
</Story>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { marked } from 'marked';
|
|
3
|
+
interface Props {
|
|
4
|
+
markdown: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
let { markdown }: Props = $props();
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div class="prose text-sm text-tertiary dark:prose-invert">
|
|
11
|
+
{@html marked.parse(markdown ?? '')}
|
|
12
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Markdown } from './Markdown.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Markdown } from './Markdown.svelte';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import Button from 'design-system/components/button/Button.svelte';
|
|
3
|
+
import Modal from 'design-system/components/modal/Modal.svelte';
|
|
4
|
+
import ContactSupportModal from './ContactSupportModal.svelte';
|
|
5
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
component: Modal,
|
|
8
|
+
title: 'Design System/Modal',
|
|
9
|
+
tags: ['autodocs']
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="Default">
|
|
14
|
+
<Modal>
|
|
15
|
+
{#snippet Trigger({ openModal })}
|
|
16
|
+
<Button onClick={openModal}>Open Modal</Button>
|
|
17
|
+
{/snippet}
|
|
18
|
+
{#snippet Content()}
|
|
19
|
+
<div>
|
|
20
|
+
<p>Modal Content</p>
|
|
21
|
+
</div>
|
|
22
|
+
{/snippet}
|
|
23
|
+
</Modal>
|
|
24
|
+
</Story>
|
|
25
|
+
|
|
26
|
+
<Story name="Default open">
|
|
27
|
+
<Modal defaultOpen>
|
|
28
|
+
{#snippet Trigger({ openModal })}
|
|
29
|
+
<Button onClick={openModal}>Open Modal</Button>
|
|
30
|
+
{/snippet}
|
|
31
|
+
{#snippet Content()}
|
|
32
|
+
<div>
|
|
33
|
+
<p>Modal Content</p>
|
|
34
|
+
</div>
|
|
35
|
+
{/snippet}
|
|
36
|
+
</Modal>
|
|
37
|
+
</Story>
|
|
38
|
+
|
|
39
|
+
<Story name="Contact support">
|
|
40
|
+
<ContactSupportModal />
|
|
41
|
+
</Story>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
+
import IconButton from '../icon-button/IconButton.svelte';
|
|
5
|
+
import { X } from 'phosphor-svelte';
|
|
6
|
+
|
|
7
|
+
type ModalProps = {
|
|
8
|
+
Trigger?: Snippet<[{ openModal: () => void; closeModal: () => void }]>;
|
|
9
|
+
Content: Snippet;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
id?: string;
|
|
12
|
+
withClose?: boolean;
|
|
13
|
+
closeOnClickOutside?: boolean;
|
|
14
|
+
class?: string;
|
|
15
|
+
};
|
|
16
|
+
let {
|
|
17
|
+
Trigger,
|
|
18
|
+
Content,
|
|
19
|
+
defaultOpen = false,
|
|
20
|
+
id = 'modal-' + uuidv4(),
|
|
21
|
+
withClose = true,
|
|
22
|
+
closeOnClickOutside = true,
|
|
23
|
+
class: modalClass
|
|
24
|
+
}: ModalProps = $props();
|
|
25
|
+
|
|
26
|
+
const openModal = () => {
|
|
27
|
+
const dialog = document.getElementById(id) as HTMLDialogElement | null;
|
|
28
|
+
dialog?.showModal();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const closeModal = () => {
|
|
32
|
+
const dialog = document.getElementById(id) as HTMLDialogElement | null;
|
|
33
|
+
dialog?.close();
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
{#if Trigger}
|
|
38
|
+
{@render Trigger({ openModal, closeModal })}
|
|
39
|
+
{/if}
|
|
40
|
+
<dialog {id} class="modal {modalClass}" class:modal-open={defaultOpen}>
|
|
41
|
+
<div class="modal-box relative w-fit max-w-full rounded-xl bg-base p-6">
|
|
42
|
+
{#if withClose}
|
|
43
|
+
<div class="absolute right-0 top-0 p-6">
|
|
44
|
+
<IconButton onclick={closeModal} size="md" color="secondary">
|
|
45
|
+
<X />
|
|
46
|
+
</IconButton>
|
|
47
|
+
</div>
|
|
48
|
+
{/if}
|
|
49
|
+
{@render Content()}
|
|
50
|
+
</div>
|
|
51
|
+
{#if closeOnClickOutside}
|
|
52
|
+
<form method="dialog" class="modal-backdrop">
|
|
53
|
+
<button>close</button>
|
|
54
|
+
</form>
|
|
55
|
+
{/if}
|
|
56
|
+
</dialog>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type ModalProps = {
|
|
3
|
+
Trigger?: Snippet<[{
|
|
4
|
+
openModal: () => void;
|
|
5
|
+
closeModal: () => void;
|
|
6
|
+
}]>;
|
|
7
|
+
Content: Snippet;
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
id?: string;
|
|
10
|
+
withClose?: boolean;
|
|
11
|
+
closeOnClickOutside?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const Modal: import("svelte").Component<ModalProps, {}, "">;
|
|
15
|
+
type Modal = ReturnType<typeof Modal>;
|
|
16
|
+
export default Modal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Modal } from './Modal.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Modal } from './Modal.svelte';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import NotificationPopup from './NotificationPopup.svelte';
|
|
3
|
+
import { Sparkle } from 'phosphor-svelte';
|
|
4
|
+
|
|
5
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
component: NotificationPopup,
|
|
9
|
+
title: 'Design System/NotificationPopup',
|
|
10
|
+
tags: ['autodocs']
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
let visible = true;
|
|
14
|
+
|
|
15
|
+
function handleClick() {
|
|
16
|
+
visible = !visible;
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Story name="Primary">
|
|
21
|
+
<NotificationPopup onClose={handleClick} title="See what's new" {visible}>
|
|
22
|
+
<a href="_blank" color="transparent" class="flex items-center gap-1 font-sans">
|
|
23
|
+
<Sparkle />
|
|
24
|
+
<p>Product updates</p>
|
|
25
|
+
</a>
|
|
26
|
+
</NotificationPopup>
|
|
27
|
+
</Story>
|