@reshape-biotech/design-system 0.0.37 → 0.0.39
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 +1 -1
- package/dist/components/button/Button.svelte +110 -19
- package/dist/components/drawer/Drawer.stories.svelte +10 -17
- package/dist/components/drawer/Drawer.svelte +2 -2
- package/dist/components/drawer/Drawer.svelte.d.ts +1 -4
- package/dist/components/drawer/DrawerLabel.svelte +51 -2
- package/dist/components/drawer/DrawerLabel.svelte.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.stories.svelte +22 -0
- package/dist/components/dropdown/Dropdown.svelte +3 -2
- package/dist/components/dropdown/Dropdown.svelte.d.ts +2 -0
- package/dist/components/dropdown/components/OutlinedButton.svelte +61 -0
- package/dist/components/dropdown/components/OutlinedButton.svelte.d.ts +8 -0
- package/dist/components/input/Input.svelte +18 -2
- package/dist/components/logo/Logo.stories.svelte +21 -0
- package/dist/components/logo/Logo.stories.svelte.d.ts +27 -0
- package/dist/components/logo/Logo.svelte +36 -0
- package/dist/components/logo/Logo.svelte.d.ts +6 -0
- package/dist/components/select/Select.svelte +5 -4
- package/dist/components/toggle/Toggle.stories.svelte +15 -0
- package/dist/components/toggle/Toggle.stories.svelte.d.ts +27 -0
- package/dist/components/toggle/Toggle.svelte +73 -0
- package/dist/components/toggle/Toggle.svelte.d.ts +7 -0
- package/dist/components/tooltip/Tooltip.stories.svelte +0 -1
- package/dist/tailwind-safelist.js +2 -0
- package/dist/tailwind.preset.d.ts +2 -0
- package/dist/tokens.d.ts +4 -0
- package/dist/tokens.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ This package contains the core design system for Reshape Biotech frontend projec
|
|
|
19
19
|
|
|
20
20
|
1. **Component Library**
|
|
21
21
|
|
|
22
|
-
- A collection of shared, reusable
|
|
22
|
+
- A collection of shared, reusable Svelte components
|
|
23
23
|
- Standardized UI elements following Reshape Biotech's design guidelines
|
|
24
24
|
- Fully typed components with TypeScript support
|
|
25
25
|
|
|
@@ -40,24 +40,8 @@
|
|
|
40
40
|
| 'outline'
|
|
41
41
|
| 'secondary-inverse';
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
secondary: 'bg-neutral text-primary hover:bg-neutral-hover active:bg-neutral',
|
|
46
|
-
transparent: 'bg-transparent text-primary hover:bg-neutral active:red',
|
|
47
|
-
danger: 'bg-danger-inverse text-primary-inverse hover:bg-danger-inverse-hover ',
|
|
48
|
-
outline:
|
|
49
|
-
'bg-transparent text-primary border border-interactive hover:bg-neutral-hover disabled:border-none',
|
|
50
|
-
'secondary-inverse':
|
|
51
|
-
'bg-neutral-inverse text-primary-inverse hover:bg-neutral-inverse-hover active:bg-neutral-inverse'
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const sizes = {
|
|
55
|
-
sm: 'h-8 px-3 py-2',
|
|
56
|
-
md: 'h-10 px-5 py-3',
|
|
57
|
-
lg: 'h-12 px-6 py-4'
|
|
58
|
-
};
|
|
59
|
-
let sizeClassName = $derived(sizes[size]);
|
|
60
|
-
let colorClassName = $derived(Variants[variant]);
|
|
43
|
+
let variantClass = $derived(`btn-${variant}`);
|
|
44
|
+
let sizeClass = $derived(`btn-size-${size}`);
|
|
61
45
|
</script>
|
|
62
46
|
|
|
63
47
|
<button
|
|
@@ -74,7 +58,7 @@
|
|
|
74
58
|
{id}
|
|
75
59
|
{tabindex}
|
|
76
60
|
class:cursor-wait={loading}
|
|
77
|
-
class="
|
|
61
|
+
class="button {variantClass} {sizeClass} {className}"
|
|
78
62
|
data-testid={dataTestId}
|
|
79
63
|
>
|
|
80
64
|
{#if loading}
|
|
@@ -83,3 +67,110 @@
|
|
|
83
67
|
{@render children?.()}
|
|
84
68
|
{/if}
|
|
85
69
|
</button>
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
.button {
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
gap: 0.5rem;
|
|
77
|
+
border-radius: 9999px;
|
|
78
|
+
font-size: 1rem;
|
|
79
|
+
font-weight: 500;
|
|
80
|
+
line-height: 1.5rem;
|
|
81
|
+
transition-duration: 150ms
|
|
82
|
+
}
|
|
83
|
+
.button:disabled {
|
|
84
|
+
background-color: #12192a0d;
|
|
85
|
+
--tw-text-opacity: 1;
|
|
86
|
+
color: rgb(136 140 148 / var(--tw-text-opacity, 1))
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Size variants */
|
|
90
|
+
.btn-size-sm {
|
|
91
|
+
height: 2rem;
|
|
92
|
+
padding-left: 0.75rem;
|
|
93
|
+
padding-right: 0.75rem;
|
|
94
|
+
padding-top: 0.5rem;
|
|
95
|
+
padding-bottom: 0.5rem
|
|
96
|
+
}
|
|
97
|
+
.btn-size-md {
|
|
98
|
+
height: 2.5rem;
|
|
99
|
+
padding-left: 1.25rem;
|
|
100
|
+
padding-right: 1.25rem;
|
|
101
|
+
padding-top: 0.75rem;
|
|
102
|
+
padding-bottom: 0.75rem
|
|
103
|
+
}
|
|
104
|
+
.btn-size-lg {
|
|
105
|
+
height: 3rem;
|
|
106
|
+
padding-left: 1.5rem;
|
|
107
|
+
padding-right: 1.5rem;
|
|
108
|
+
padding-top: 1rem;
|
|
109
|
+
padding-bottom: 1rem
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Button variants */
|
|
113
|
+
.btn-primary {
|
|
114
|
+
--tw-bg-opacity: 1;
|
|
115
|
+
background-color: rgb(87 80 238 / var(--tw-bg-opacity, 1));
|
|
116
|
+
--tw-text-opacity: 1;
|
|
117
|
+
color: rgb(255 255 255 / var(--tw-text-opacity, 1))
|
|
118
|
+
}
|
|
119
|
+
.btn-primary:hover {
|
|
120
|
+
--tw-bg-opacity: 1;
|
|
121
|
+
background-color: rgb(71 65 193 / var(--tw-bg-opacity, 1))
|
|
122
|
+
}
|
|
123
|
+
.btn-secondary {
|
|
124
|
+
background-color: #12192a0d;
|
|
125
|
+
--tw-text-opacity: 1;
|
|
126
|
+
color: rgb(18 25 42 / var(--tw-text-opacity, 1))
|
|
127
|
+
}
|
|
128
|
+
.btn-secondary:hover {
|
|
129
|
+
background-color: #12192A1A
|
|
130
|
+
}
|
|
131
|
+
.btn-secondary:active {
|
|
132
|
+
background-color: #12192a0d
|
|
133
|
+
}
|
|
134
|
+
.btn-transparent {
|
|
135
|
+
background-color: transparent;
|
|
136
|
+
--tw-text-opacity: 1;
|
|
137
|
+
color: rgb(18 25 42 / var(--tw-text-opacity, 1))
|
|
138
|
+
}
|
|
139
|
+
.btn-transparent:hover {
|
|
140
|
+
background-color: #12192a0d
|
|
141
|
+
}
|
|
142
|
+
.btn-danger {
|
|
143
|
+
--tw-bg-opacity: 1;
|
|
144
|
+
background-color: rgb(235 70 71 / var(--tw-bg-opacity, 1));
|
|
145
|
+
--tw-text-opacity: 1;
|
|
146
|
+
color: rgb(255 255 255 / var(--tw-text-opacity, 1))
|
|
147
|
+
}
|
|
148
|
+
.btn-danger:hover {
|
|
149
|
+
--tw-bg-opacity: 1;
|
|
150
|
+
background-color: rgb(191 57 58 / var(--tw-bg-opacity, 1))
|
|
151
|
+
}
|
|
152
|
+
.btn-outline {
|
|
153
|
+
border-width: 1px;
|
|
154
|
+
border-color: #12192A26;
|
|
155
|
+
background-color: transparent;
|
|
156
|
+
--tw-text-opacity: 1;
|
|
157
|
+
color: rgb(18 25 42 / var(--tw-text-opacity, 1))
|
|
158
|
+
}
|
|
159
|
+
.btn-outline:hover {
|
|
160
|
+
background-color: #12192A1A
|
|
161
|
+
}
|
|
162
|
+
.btn-outline:disabled {
|
|
163
|
+
border-style: none
|
|
164
|
+
}
|
|
165
|
+
.btn-secondary-inverse {
|
|
166
|
+
background-color: #FFFFFF0D;
|
|
167
|
+
--tw-text-opacity: 1;
|
|
168
|
+
color: rgb(255 255 255 / var(--tw-text-opacity, 1))
|
|
169
|
+
}
|
|
170
|
+
.btn-secondary-inverse:hover {
|
|
171
|
+
background-color: #FFFFFF26
|
|
172
|
+
}
|
|
173
|
+
.btn-secondary-inverse:active {
|
|
174
|
+
background-color: #FFFFFF0D
|
|
175
|
+
}
|
|
176
|
+
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script module>
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
3
|
import Drawer from './Drawer.svelte';
|
|
4
|
+
import Button from '../button/Button.svelte';
|
|
4
5
|
|
|
5
6
|
const { Story } = defineMeta({
|
|
6
7
|
component: Drawer,
|
|
@@ -8,18 +9,14 @@
|
|
|
8
9
|
tags: ['autodocs']
|
|
9
10
|
});
|
|
10
11
|
|
|
11
|
-
let open = false;
|
|
12
|
+
let open = $state(false);
|
|
12
13
|
</script>
|
|
13
14
|
|
|
14
15
|
<Story name="Base">
|
|
15
16
|
<div class="py-12">
|
|
16
|
-
<Drawer id="my-drawer">
|
|
17
|
-
{#snippet trigger(
|
|
18
|
-
<
|
|
19
|
-
<DrawerLabel id="my-drawer" classes="btn btn-primary rounded-full "
|
|
20
|
-
>Open Drawer
|
|
21
|
-
</DrawerLabel>
|
|
22
|
-
</div>
|
|
17
|
+
<Drawer id="my-drawer" bind:open controlled>
|
|
18
|
+
{#snippet trigger()}
|
|
19
|
+
<Button onClick={() => (open = true)}>Open Drawer</Button>
|
|
23
20
|
{/snippet}
|
|
24
21
|
{#snippet content()}
|
|
25
22
|
<div>
|
|
@@ -35,10 +32,8 @@
|
|
|
35
32
|
<Story name="Open">
|
|
36
33
|
<div class="py-12">
|
|
37
34
|
<Drawer id="my-drawer" open controlled>
|
|
38
|
-
{#snippet trigger(
|
|
39
|
-
<
|
|
40
|
-
>Open Drawer
|
|
41
|
-
</DrawerLabel>
|
|
35
|
+
{#snippet trigger()}
|
|
36
|
+
<Button onClick={() => (open = true)}>Open Drawer</Button>
|
|
42
37
|
{/snippet}
|
|
43
38
|
{#snippet content()}
|
|
44
39
|
<div>
|
|
@@ -53,11 +48,9 @@
|
|
|
53
48
|
|
|
54
49
|
<Story name="Open Left">
|
|
55
50
|
<div class="py-12">
|
|
56
|
-
<Drawer id="my-drawer" side="left">
|
|
57
|
-
{#snippet trigger(
|
|
58
|
-
<
|
|
59
|
-
>Open Drawer
|
|
60
|
-
</DrawerLabel>
|
|
51
|
+
<Drawer id="my-drawer" side="left" bind:open controlled>
|
|
52
|
+
{#snippet trigger()}
|
|
53
|
+
<Button onClick={() => (open = true)}>Open Drawer</Button>
|
|
61
54
|
{/snippet}
|
|
62
55
|
{#snippet content()}
|
|
63
56
|
<div>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// Open only works when controlled is true
|
|
9
9
|
open?: boolean;
|
|
10
10
|
side?: 'left' | 'right';
|
|
11
|
-
trigger?: Snippet
|
|
11
|
+
trigger?: Snippet;
|
|
12
12
|
content: Snippet;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
{/if}
|
|
31
31
|
|
|
32
32
|
<div class="drawer-content">
|
|
33
|
-
{@render trigger?.(
|
|
33
|
+
{@render trigger?.()}
|
|
34
34
|
</div>
|
|
35
35
|
<div class="drawer-side" inert={controlled ? !open : false}>
|
|
36
36
|
<label for={id} aria-label="close sidebar" class="drawer-overlay"></label>
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import DrawerLabel from './DrawerLabel.svelte';
|
|
3
2
|
interface Props {
|
|
4
3
|
id: string;
|
|
5
4
|
controlled?: boolean;
|
|
6
5
|
open?: boolean;
|
|
7
6
|
side?: 'left' | 'right';
|
|
8
|
-
trigger?: Snippet
|
|
9
|
-
DrawerLabel: typeof DrawerLabel;
|
|
10
|
-
}]>;
|
|
7
|
+
trigger?: Snippet;
|
|
11
8
|
content: Snippet;
|
|
12
9
|
}
|
|
13
10
|
declare const Drawer: import("svelte").Component<Props, {}, "open">;
|
|
@@ -4,10 +4,59 @@
|
|
|
4
4
|
interface Props {
|
|
5
5
|
id: string;
|
|
6
6
|
classes?: string;
|
|
7
|
-
children
|
|
7
|
+
children: Snippet;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
let { id, classes = '', children }: Props = $props();
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<label for={id} class={`${classes}
|
|
13
|
+
<label for={id} class={`${classes}`}>{@render children()}</label>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
label {
|
|
17
|
+
|
|
18
|
+
display: flex;
|
|
19
|
+
|
|
20
|
+
width: 100%;
|
|
21
|
+
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
|
|
24
|
+
align-items: center;
|
|
25
|
+
|
|
26
|
+
gap: 0.25rem;
|
|
27
|
+
|
|
28
|
+
border-radius: 0.5rem;
|
|
29
|
+
|
|
30
|
+
border-width: 1px;
|
|
31
|
+
|
|
32
|
+
border-color: #12192A1A;
|
|
33
|
+
|
|
34
|
+
--tw-bg-opacity: 1;
|
|
35
|
+
|
|
36
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
37
|
+
|
|
38
|
+
padding: 0.75rem;
|
|
39
|
+
|
|
40
|
+
--tw-text-opacity: 1;
|
|
41
|
+
|
|
42
|
+
color: rgb(18 25 42 / var(--tw-text-opacity, 1));
|
|
43
|
+
|
|
44
|
+
--tw-shadow: 0px 1px 4px 0px rgba(18, 25, 42, 0.04);
|
|
45
|
+
|
|
46
|
+
--tw-shadow-colored: 0px 1px 4px 0px var(--tw-shadow-color);
|
|
47
|
+
|
|
48
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
label:not(:focus-within):hover {
|
|
52
|
+
|
|
53
|
+
border-color: #5750ee40
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
label:focus-within {
|
|
57
|
+
|
|
58
|
+
--tw-border-opacity: 1;
|
|
59
|
+
|
|
60
|
+
border-color: rgb(87 80 238 / var(--tw-border-opacity, 1))
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
@@ -31,6 +31,28 @@
|
|
|
31
31
|
</div>
|
|
32
32
|
</Story>
|
|
33
33
|
|
|
34
|
+
<Story name="OutlinedButton">
|
|
35
|
+
<div class="py-12">
|
|
36
|
+
<Dropdown>
|
|
37
|
+
{#snippet trigger({ OutlinedButton })}
|
|
38
|
+
<OutlinedButton>Dropdown</OutlinedButton>
|
|
39
|
+
{/snippet}
|
|
40
|
+
{#snippet content({ DropdownMenu })}
|
|
41
|
+
<div>
|
|
42
|
+
<DropdownMenu class="w-full">
|
|
43
|
+
<li>
|
|
44
|
+
<p>1st item</p>
|
|
45
|
+
</li>
|
|
46
|
+
<li>
|
|
47
|
+
<p>2nd item</p>
|
|
48
|
+
</li>
|
|
49
|
+
</DropdownMenu>
|
|
50
|
+
</div>
|
|
51
|
+
{/snippet}
|
|
52
|
+
</Dropdown>
|
|
53
|
+
</div>
|
|
54
|
+
</Story>
|
|
55
|
+
|
|
34
56
|
<Story name="Secondary">
|
|
35
57
|
<div class="py-12">
|
|
36
58
|
<Dropdown>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import DropdownContent from './components/DropdownContent.svelte';
|
|
4
4
|
import DropdownMenu from './components/DropdownMenu.svelte';
|
|
5
5
|
import DropdownTrigger from './components/DropdownTrigger.svelte';
|
|
6
|
+
import OutlinedButton from './components/OutlinedButton.svelte';
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
9
|
side?: 'dropdown-top' | 'dropdown-bottom' | 'dropdown-left' | 'dropdown-right';
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
openOnHover?: boolean;
|
|
12
13
|
closeOnItemClick?: boolean;
|
|
13
14
|
class?: string;
|
|
14
|
-
trigger?: Snippet<[{ Trigger: typeof DropdownTrigger }]>;
|
|
15
|
+
trigger?: Snippet<[{ Trigger: typeof DropdownTrigger; OutlinedButton: typeof OutlinedButton }]>;
|
|
15
16
|
content?: Snippet<
|
|
16
17
|
[{ DropdownContent: typeof DropdownContent; DropdownMenu: typeof DropdownMenu }]
|
|
17
18
|
>;
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
class:dropdown-open={open}
|
|
56
57
|
class:dropdown-hover={openOnHover}
|
|
57
58
|
>
|
|
58
|
-
{@render trigger?.({ Trigger: DropdownTrigger })}
|
|
59
|
+
{@render trigger?.({ Trigger: DropdownTrigger, OutlinedButton: OutlinedButton })}
|
|
59
60
|
<div
|
|
60
61
|
class="dropdown-content z-10 w-full"
|
|
61
62
|
role="menu"
|
|
@@ -2,6 +2,7 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import DropdownContent from './components/DropdownContent.svelte';
|
|
3
3
|
import DropdownMenu from './components/DropdownMenu.svelte';
|
|
4
4
|
import DropdownTrigger from './components/DropdownTrigger.svelte';
|
|
5
|
+
import OutlinedButton from './components/OutlinedButton.svelte';
|
|
5
6
|
interface Props {
|
|
6
7
|
side?: 'dropdown-top' | 'dropdown-bottom' | 'dropdown-left' | 'dropdown-right';
|
|
7
8
|
open?: boolean;
|
|
@@ -11,6 +12,7 @@ interface Props {
|
|
|
11
12
|
class?: string;
|
|
12
13
|
trigger?: Snippet<[{
|
|
13
14
|
Trigger: typeof DropdownTrigger;
|
|
15
|
+
OutlinedButton: typeof OutlinedButton;
|
|
14
16
|
}]>;
|
|
15
17
|
content?: Snippet<[
|
|
16
18
|
{
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
classes?: string;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { classes = '', children }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<button class={`${classes}`}>{@render children()}</button>
|
|
13
|
+
|
|
14
|
+
<style>
|
|
15
|
+
button {
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
|
|
19
|
+
width: 100%;
|
|
20
|
+
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
|
|
23
|
+
align-items: center;
|
|
24
|
+
|
|
25
|
+
gap: 0.25rem;
|
|
26
|
+
|
|
27
|
+
border-radius: 0.5rem;
|
|
28
|
+
|
|
29
|
+
border-width: 1px;
|
|
30
|
+
|
|
31
|
+
border-color: #12192A1A;
|
|
32
|
+
|
|
33
|
+
--tw-bg-opacity: 1;
|
|
34
|
+
|
|
35
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
36
|
+
|
|
37
|
+
padding: 0.75rem;
|
|
38
|
+
|
|
39
|
+
--tw-text-opacity: 1;
|
|
40
|
+
|
|
41
|
+
color: rgb(18 25 42 / var(--tw-text-opacity, 1));
|
|
42
|
+
|
|
43
|
+
--tw-shadow: 0px 1px 4px 0px rgba(18, 25, 42, 0.04);
|
|
44
|
+
|
|
45
|
+
--tw-shadow-colored: 0px 1px 4px 0px var(--tw-shadow-color);
|
|
46
|
+
|
|
47
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
button:not(:focus-within):hover {
|
|
51
|
+
|
|
52
|
+
border-color: #5750ee40
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
button:focus-within {
|
|
56
|
+
|
|
57
|
+
--tw-border-opacity: 1;
|
|
58
|
+
|
|
59
|
+
border-color: rgb(87 80 238 / var(--tw-border-opacity, 1))
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
classes?: string;
|
|
4
|
+
children: Snippet;
|
|
5
|
+
}
|
|
6
|
+
declare const OutlinedButton: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type OutlinedButton = ReturnType<typeof OutlinedButton>;
|
|
8
|
+
export default OutlinedButton;
|
|
@@ -67,9 +67,8 @@
|
|
|
67
67
|
<label for={id ?? inputId} class="block px-1 py-2 text-sm text-secondary">{label}</label>
|
|
68
68
|
{/if}
|
|
69
69
|
<div
|
|
70
|
-
class="flex w-full items-center gap-1 rounded-lg border border-
|
|
70
|
+
class="flex w-full items-center gap-1 rounded-lg border border-input bg-surface p-3 shadow-input"
|
|
71
71
|
class:!border-error={!valid}
|
|
72
|
-
class:focus-within:border-focus={valid}
|
|
73
72
|
>
|
|
74
73
|
{#if type === 'textarea'}
|
|
75
74
|
<textarea
|
|
@@ -122,10 +121,27 @@
|
|
|
122
121
|
<style>
|
|
123
122
|
input,
|
|
124
123
|
textarea {
|
|
124
|
+
|
|
125
125
|
width: 100%;
|
|
126
|
+
|
|
126
127
|
resize: none;
|
|
128
|
+
|
|
127
129
|
overflow: hidden;
|
|
130
|
+
|
|
128
131
|
outline: 2px solid transparent;
|
|
132
|
+
|
|
129
133
|
outline-offset: 2px
|
|
130
134
|
}
|
|
135
|
+
|
|
136
|
+
div:not(:focus-within):hover {
|
|
137
|
+
|
|
138
|
+
border-color: #5750ee40
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
div:focus-within {
|
|
142
|
+
|
|
143
|
+
--tw-border-opacity: 1;
|
|
144
|
+
|
|
145
|
+
border-color: rgb(87 80 238 / var(--tw-border-opacity, 1))
|
|
146
|
+
}
|
|
131
147
|
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Logo from './Logo.svelte';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Design System/Logo',
|
|
8
|
+
component: Logo,
|
|
9
|
+
tags: ['autodocs']
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="Base">
|
|
14
|
+
<div class="flex flex-col gap-4">
|
|
15
|
+
<Logo size="xs" />
|
|
16
|
+
<Logo size="sm" />
|
|
17
|
+
<Logo size="md" />
|
|
18
|
+
<Logo size="lg" />
|
|
19
|
+
<Logo size="xl" />
|
|
20
|
+
</div>
|
|
21
|
+
</Story>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Logo;
|
|
2
|
+
type Logo = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Logo: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Logo from './Logo.svelte';
|
|
15
|
+
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> {
|
|
16
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
+
$$bindings?: Bindings;
|
|
18
|
+
} & Exports;
|
|
19
|
+
(internal: unknown, props: {
|
|
20
|
+
$$events?: Events;
|
|
21
|
+
$$slots?: Slots;
|
|
22
|
+
}): Exports & {
|
|
23
|
+
$set?: any;
|
|
24
|
+
$on?: any;
|
|
25
|
+
};
|
|
26
|
+
z_$$bindings?: Bindings;
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
type Props = {
|
|
3
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
let { size = 'md' }: Props = $props();
|
|
7
|
+
|
|
8
|
+
const sizeMap = {
|
|
9
|
+
xs: 16,
|
|
10
|
+
sm: 20,
|
|
11
|
+
md: 24,
|
|
12
|
+
lg: 32,
|
|
13
|
+
xl: 40
|
|
14
|
+
};
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<svg
|
|
18
|
+
width={sizeMap[size]}
|
|
19
|
+
height={sizeMap[size]}
|
|
20
|
+
viewBox={`0 0 24 24`}
|
|
21
|
+
fill="none"
|
|
22
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
23
|
+
>
|
|
24
|
+
<path
|
|
25
|
+
d="M5.25 10.5C2.3511 10.5 0 8.1489 0 5.25C0 2.3511 2.3511 0 5.25 0C8.1489 0 10.5 2.3511 10.5 5.25C10.5034 8.1489 8.1523 10.5 5.25 10.5Z"
|
|
26
|
+
fill="#FF7A00"
|
|
27
|
+
/>
|
|
28
|
+
<path
|
|
29
|
+
d="M18.75 10.5C15.8511 10.5 13.5 8.1489 13.5 5.25C13.5 2.3511 15.8511 0 18.75 0C21.6489 0 24 2.3511 24 5.25C24.0034 8.1489 21.6523 10.5 18.75 10.5Z"
|
|
30
|
+
fill="#FF7A00"
|
|
31
|
+
/>
|
|
32
|
+
<path
|
|
33
|
+
d="M0 18.75C0 15.8511 2.3511 13.5 5.25 13.5C8.1489 13.5 10.5 15.8511 10.5 18.75C10.5 21.6489 8.1489 24 5.25 24C2.3511 24 0 21.6489 0 18.75Z"
|
|
34
|
+
fill="#FF7A00"
|
|
35
|
+
/>
|
|
36
|
+
</svg>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- @migration-task Error while migrating Svelte code: Cannot overwrite a zero-length range – use appendLeft or prependRight instead -->
|
|
2
2
|
<!-- @migration-task Error while migrating Svelte code: This migration would change the name of a slot making the component unusable -->
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import { backgroundColor, textColor } from '../../tokens';
|
|
4
|
+
import { backgroundColor, borderColor, textColor } from '../../tokens';
|
|
5
5
|
import { CaretDown, X } from 'phosphor-svelte';
|
|
6
6
|
import { createEventDispatcher } from 'svelte';
|
|
7
7
|
let className = '';
|
|
@@ -71,9 +71,10 @@
|
|
|
71
71
|
--item-is-active-bg={backgroundColor['accent']}
|
|
72
72
|
--item-is-active-color={textColor['primary']}
|
|
73
73
|
--item-hover-bg={backgroundColor['neutral']}
|
|
74
|
-
--border="
|
|
75
|
-
--border-hover="
|
|
76
|
-
--border-focused="
|
|
74
|
+
--border="1px solid {borderColor['input']}"
|
|
75
|
+
--border-hover="1px solid {borderColor['hover']}"
|
|
76
|
+
--border-focused="1px solid {borderColor['focus']}"
|
|
77
|
+
--border-radius="8px"
|
|
77
78
|
>
|
|
78
79
|
<div slot="chevron-icon" class="">
|
|
79
80
|
<CaretDown weight="bold" size="1rem" />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Toggle from './Toggle.svelte';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Design System/Toggle',
|
|
8
|
+
component: Toggle,
|
|
9
|
+
tags: ['autodocs']
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="Base">
|
|
14
|
+
<Toggle id="toggle-1" />
|
|
15
|
+
</Story>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Toggle;
|
|
2
|
+
type Toggle = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Toggle: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Toggle from './Toggle.svelte';
|
|
15
|
+
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> {
|
|
16
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
+
$$bindings?: Bindings;
|
|
18
|
+
} & Exports;
|
|
19
|
+
(internal: unknown, props: {
|
|
20
|
+
$$events?: Events;
|
|
21
|
+
$$slots?: Slots;
|
|
22
|
+
}): Exports & {
|
|
23
|
+
$set?: any;
|
|
24
|
+
$on?: any;
|
|
25
|
+
};
|
|
26
|
+
z_$$bindings?: Bindings;
|
|
27
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
value?: boolean;
|
|
4
|
+
onclick?: (event?: MouseEvent) => void;
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let { value = $bindable(false), onclick, id }: Props = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<label class="switch">
|
|
12
|
+
<input type="checkbox" bind:checked={value} {onclick} {id} />
|
|
13
|
+
<span class="slider round"></span>
|
|
14
|
+
</label>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
/* The switch - the box around the slider */
|
|
18
|
+
.switch {
|
|
19
|
+
position: relative;
|
|
20
|
+
display: inline-block;
|
|
21
|
+
height: 1.25rem;
|
|
22
|
+
width: 2.25rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Hide default HTML checkbox */
|
|
26
|
+
.switch input {
|
|
27
|
+
height: 0px;
|
|
28
|
+
width: 0px;
|
|
29
|
+
opacity: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* The slider */
|
|
33
|
+
.slider {
|
|
34
|
+
position: absolute;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
top: 0;
|
|
37
|
+
left: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
transition: 0.1s;
|
|
41
|
+
background-color: #12192A26;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.slider:before {
|
|
45
|
+
content: '';
|
|
46
|
+
left: 2px;
|
|
47
|
+
bottom: 2px;
|
|
48
|
+
transition: 0.1s;
|
|
49
|
+
position: absolute;
|
|
50
|
+
height: 1rem;
|
|
51
|
+
width: 1rem;
|
|
52
|
+
--tw-bg-opacity: 1;
|
|
53
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
input:checked + .slider {
|
|
57
|
+
--tw-bg-opacity: 1;
|
|
58
|
+
background-color: rgb(87 80 238 / var(--tw-bg-opacity, 1));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
input:checked + .slider:before {
|
|
62
|
+
transform: translateX(16px);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Rounded sliders */
|
|
66
|
+
.slider.round {
|
|
67
|
+
border-radius: var(--rounded-badge, 1.9rem);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.slider.round:before {
|
|
71
|
+
border-radius: 9999px;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -74,6 +74,7 @@ export const borders = [
|
|
|
74
74
|
'border-hover',
|
|
75
75
|
'border-focus',
|
|
76
76
|
'border-danger',
|
|
77
|
+
'border-input',
|
|
77
78
|
'border-transparent'
|
|
78
79
|
];
|
|
79
80
|
|
|
@@ -85,6 +86,7 @@ export const shadows = [
|
|
|
85
86
|
'shadow-calendar',
|
|
86
87
|
'shadow-container',
|
|
87
88
|
'shadow-panel',
|
|
89
|
+
'shadow-input',
|
|
88
90
|
'shadow-outline',
|
|
89
91
|
'shadow-focus'
|
|
90
92
|
];
|
|
@@ -238,6 +238,7 @@ declare const config: {
|
|
|
238
238
|
'dark-focus': string;
|
|
239
239
|
'dark-danger': string;
|
|
240
240
|
static: string;
|
|
241
|
+
input: string;
|
|
241
242
|
interactive: string;
|
|
242
243
|
hover: string;
|
|
243
244
|
focus: string;
|
|
@@ -277,6 +278,7 @@ declare const config: {
|
|
|
277
278
|
danger: string;
|
|
278
279
|
};
|
|
279
280
|
boxShadow: {
|
|
281
|
+
input: string;
|
|
280
282
|
field: string;
|
|
281
283
|
nav: string;
|
|
282
284
|
calendar: string;
|
package/dist/tokens.d.ts
CHANGED
|
@@ -163,6 +163,7 @@ export declare const borderColor: {
|
|
|
163
163
|
'dark-focus': string;
|
|
164
164
|
'dark-danger': string;
|
|
165
165
|
static: string;
|
|
166
|
+
input: string;
|
|
166
167
|
interactive: string;
|
|
167
168
|
hover: string;
|
|
168
169
|
focus: string;
|
|
@@ -272,6 +273,7 @@ export declare const backgroundColor: {
|
|
|
272
273
|
'sky-inverse-hover': string;
|
|
273
274
|
};
|
|
274
275
|
export declare const boxShadow: {
|
|
276
|
+
input: string;
|
|
275
277
|
field: string;
|
|
276
278
|
nav: string;
|
|
277
279
|
calendar: string;
|
|
@@ -446,6 +448,7 @@ export declare const tokens: {
|
|
|
446
448
|
'dark-focus': string;
|
|
447
449
|
'dark-danger': string;
|
|
448
450
|
static: string;
|
|
451
|
+
input: string;
|
|
449
452
|
interactive: string;
|
|
450
453
|
hover: string;
|
|
451
454
|
focus: string;
|
|
@@ -555,6 +558,7 @@ export declare const tokens: {
|
|
|
555
558
|
'sky-inverse-hover': string;
|
|
556
559
|
};
|
|
557
560
|
boxShadow: {
|
|
561
|
+
input: string;
|
|
558
562
|
field: string;
|
|
559
563
|
nav: string;
|
|
560
564
|
calendar: string;
|
package/dist/tokens.js
CHANGED
|
@@ -122,6 +122,7 @@ const lightIconColor = {
|
|
|
122
122
|
};
|
|
123
123
|
const lightBorderColor = {
|
|
124
124
|
static: colors.base.midnight[5],
|
|
125
|
+
input: colors.base.midnight[10],
|
|
125
126
|
interactive: colors.base.midnight[15],
|
|
126
127
|
hover: colors.periwinkle[5][25],
|
|
127
128
|
focus: colors.periwinkle[5].default,
|
|
@@ -248,6 +249,7 @@ export const backgroundColor = {
|
|
|
248
249
|
...darkBackgroundColor
|
|
249
250
|
};
|
|
250
251
|
export const boxShadow = {
|
|
252
|
+
input: `0px 1px 4px 0px ${colors.shadow[4]}`,
|
|
251
253
|
field: `0px 8px 12px 0px ${colors.shadow[4]}`,
|
|
252
254
|
nav: `0px 0px 24px 0px ${colors.shadow[12]}`,
|
|
253
255
|
calendar: `0px 16px 24px 0px ${colors.shadow[16]}`,
|