@reshape-biotech/design-system 0.0.38 → 0.0.40
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 +18 -1
- 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/logo/index.d.ts +1 -0
- package/dist/components/logo/index.js +1 -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/toggle/index.d.ts +1 -0
- package/dist/components/toggle/index.js +1 -0
- package/dist/components/tooltip/Tooltip.stories.svelte +0 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/tailwind-safelist.js +23 -17
- 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
|
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
{id}
|
|
59
59
|
{tabindex}
|
|
60
60
|
class:cursor-wait={loading}
|
|
61
|
-
class="
|
|
61
|
+
class="button {variantClass} {sizeClass} {className}"
|
|
62
62
|
data-testid={dataTestId}
|
|
63
63
|
>
|
|
64
64
|
{#if loading}
|
|
@@ -69,6 +69,23 @@
|
|
|
69
69
|
</button>
|
|
70
70
|
|
|
71
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
|
+
|
|
72
89
|
/* Size variants */
|
|
73
90
|
.btn-size-sm {
|
|
74
91
|
height: 2rem;
|
|
@@ -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
|
+
class?: string;
|
|
6
|
+
children: Snippet;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { class: className = '', children }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<button class={`${className}`}>{@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
|
+
class?: 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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Logo } from './Logo.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Logo } from './Logo.svelte';
|
|
@@ -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>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Toggle } from './Toggle.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Toggle } from './Toggle.svelte';
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './components/icon-button/';
|
|
|
10
10
|
export * from './components/image';
|
|
11
11
|
export * from './components/input/';
|
|
12
12
|
export * from './components/list/';
|
|
13
|
+
export * from './components/logo/';
|
|
13
14
|
export * from './components/markdown/';
|
|
14
15
|
export * from './components/modal/';
|
|
15
16
|
export * from './components/notification-popup/';
|
|
@@ -26,5 +27,6 @@ export * from './components/table/';
|
|
|
26
27
|
export * from './components/tabs/';
|
|
27
28
|
export * from './components/tag/';
|
|
28
29
|
export * from './components/tooltip/';
|
|
30
|
+
export * from './components/toggle/';
|
|
29
31
|
export { tokens } from './tokens';
|
|
30
32
|
import './app.css';
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from './components/icon-button/';
|
|
|
11
11
|
export * from './components/image';
|
|
12
12
|
export * from './components/input/';
|
|
13
13
|
export * from './components/list/';
|
|
14
|
+
export * from './components/logo/';
|
|
14
15
|
export * from './components/markdown/';
|
|
15
16
|
export * from './components/modal/';
|
|
16
17
|
export * from './components/notification-popup/';
|
|
@@ -27,6 +28,7 @@ export * from './components/table/';
|
|
|
27
28
|
export * from './components/tabs/';
|
|
28
29
|
export * from './components/tag/';
|
|
29
30
|
export * from './components/tooltip/';
|
|
31
|
+
export * from './components/toggle/';
|
|
30
32
|
// Styles and Tokens
|
|
31
33
|
export { tokens } from './tokens';
|
|
32
34
|
import './app.css';
|
|
@@ -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
|
];
|
|
@@ -197,6 +199,10 @@ export const sizing = [
|
|
|
197
199
|
'h-5',
|
|
198
200
|
'h-6',
|
|
199
201
|
'h-7',
|
|
202
|
+
'h-8',
|
|
203
|
+
'h-10',
|
|
204
|
+
'h-11',
|
|
205
|
+
'h-12',
|
|
200
206
|
'h-16',
|
|
201
207
|
'h-28',
|
|
202
208
|
'h-screen',
|
|
@@ -391,23 +397,23 @@ export const daisyui = [
|
|
|
391
397
|
|
|
392
398
|
// Add hover variants
|
|
393
399
|
export const hoverVariants = [
|
|
394
|
-
'hover:bg-neutral'
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
400
|
+
'hover:bg-neutral',
|
|
401
|
+
'hover:bg-neutral-hover',
|
|
402
|
+
'hover:bg-neutral-darker-hover',
|
|
403
|
+
'hover:bg-neutral-inverse-hover',
|
|
404
|
+
'hover:bg-accent-hover',
|
|
405
|
+
'hover:bg-accent-inverse-hover',
|
|
406
|
+
'hover:bg-success-hover',
|
|
407
|
+
'hover:bg-success-inverse-hover',
|
|
408
|
+
'hover:bg-warning-hover',
|
|
409
|
+
'hover:bg-warning-inverse-hover',
|
|
410
|
+
'hover:bg-danger-hover',
|
|
411
|
+
'hover:bg-danger-inverse-hover',
|
|
412
|
+
'hover:bg-blue-hover',
|
|
413
|
+
'hover:bg-orange-hover',
|
|
414
|
+
'hover:bg-orange-inverse-hover',
|
|
415
|
+
'hover:bg-sky-hover',
|
|
416
|
+
'hover:bg-sky-inverse-hover'
|
|
411
417
|
];
|
|
412
418
|
|
|
413
419
|
// Add focus variants
|
|
@@ -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]}`,
|