@reshape-biotech/design-system 2.1.0 → 2.2.1
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/button/Button.svelte +5 -4
- package/dist/components/button/Button.svelte.d.ts +2 -1
- package/dist/components/combobox/components/combobox-content.svelte +35 -20
- package/dist/components/combobox/types.d.ts +2 -0
- package/dist/components/drawer/Drawer.stories.svelte +213 -46
- package/dist/components/drawer/Drawer.stories.svelte.d.ts +1 -1
- package/dist/components/drawer/components/drawer-bottom.svelte +14 -0
- package/dist/components/drawer/components/drawer-bottom.svelte.d.ts +4 -0
- package/dist/components/drawer/components/drawer-close.svelte +19 -0
- package/dist/components/drawer/components/drawer-close.svelte.d.ts +4 -0
- package/dist/components/drawer/components/drawer-content.svelte +74 -0
- package/dist/components/drawer/components/drawer-content.svelte.d.ts +4 -0
- package/dist/components/drawer/components/drawer-overlay.svelte +23 -0
- package/dist/components/drawer/components/drawer-overlay.svelte.d.ts +4 -0
- package/dist/components/drawer/components/drawer-title.svelte +20 -0
- package/dist/components/drawer/components/drawer-title.svelte.d.ts +4 -0
- package/dist/components/drawer/components/drawer-trigger.svelte +10 -0
- package/dist/components/drawer/components/drawer-trigger.svelte.d.ts +4 -0
- package/dist/components/drawer/index.d.ts +12 -1
- package/dist/components/drawer/index.js +15 -1
- package/dist/components/drawer/types.d.ts +36 -0
- package/dist/components/drawer/types.js +1 -0
- package/dist/components/icon-button/IconButton.svelte +17 -16
- package/dist/components/icons/index.d.ts +5 -0
- package/dist/components/icons/index.js +1 -1
- package/dist/components/input/Input.svelte +39 -21
- package/dist/components/input/Input.svelte.d.ts +1 -1
- package/dist/components/modal/components/modal-content.svelte +11 -21
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/package.json +1 -1
- package/dist/components/drawer/Drawer.svelte +0 -41
- package/dist/components/drawer/Drawer.svelte.d.ts +0 -12
- package/dist/components/drawer/DrawerLabel.svelte +0 -62
- package/dist/components/drawer/DrawerLabel.svelte.d.ts +0 -9
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
| 'secondary-inverse'
|
|
9
9
|
| 'transparent-inverse';
|
|
10
10
|
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
11
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
11
12
|
</script>
|
|
12
13
|
|
|
13
14
|
<script lang="ts">
|
|
14
15
|
import Spinner from '../spinner/Spinner.svelte';
|
|
15
16
|
import type { Snippet } from 'svelte';
|
|
16
17
|
|
|
17
|
-
interface Props {
|
|
18
|
+
interface Props extends HTMLButtonAttributes {
|
|
18
19
|
class?: string;
|
|
19
20
|
onClick?: (event?: MouseEvent) => void;
|
|
20
21
|
type?: 'button' | 'submit' | 'reset' | null | undefined;
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
children,
|
|
45
46
|
dataTestId = undefined,
|
|
46
47
|
rounded = false,
|
|
48
|
+
...rest
|
|
47
49
|
}: Props = $props();
|
|
48
50
|
|
|
49
51
|
let variantClass = $derived(`btn-${variant}`);
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
data-testid={dataTestId}
|
|
69
71
|
class:rounded
|
|
70
72
|
class:disabled
|
|
73
|
+
{...rest}
|
|
71
74
|
>
|
|
72
75
|
{#if loading}
|
|
73
76
|
<Spinner />
|
|
@@ -225,9 +228,7 @@
|
|
|
225
228
|
|
|
226
229
|
background-color: transparent;
|
|
227
230
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
color: rgb(18 25 42 / var(--tw-text-opacity, 1))
|
|
231
|
+
color: inherit
|
|
231
232
|
}
|
|
232
233
|
.btn-transparent:hover {
|
|
233
234
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type ButtonVariant = 'primary' | 'secondary' | 'transparent' | 'danger' | 'outline' | 'secondary-inverse' | 'transparent-inverse';
|
|
2
2
|
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
3
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
4
|
import type { Snippet } from 'svelte';
|
|
4
|
-
interface Props {
|
|
5
|
+
interface Props extends HTMLButtonAttributes {
|
|
5
6
|
class?: string;
|
|
6
7
|
onClick?: (event?: MouseEvent) => void;
|
|
7
8
|
type?: 'button' | 'submit' | 'reset' | null | undefined;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Combobox } from 'bits-ui';
|
|
3
3
|
import type { ComboboxContentProps } from '../types';
|
|
4
4
|
import { Icon } from '../../icons';
|
|
5
|
+
import { fade } from 'svelte/transition';
|
|
5
6
|
|
|
6
7
|
let {
|
|
7
8
|
children,
|
|
@@ -10,27 +11,41 @@
|
|
|
10
11
|
portalled = true,
|
|
11
12
|
header,
|
|
12
13
|
footer,
|
|
14
|
+
paddedContent = true,
|
|
15
|
+
fadeDuration = 0,
|
|
13
16
|
...props
|
|
14
17
|
}: ComboboxContentProps = $props();
|
|
15
18
|
</script>
|
|
16
19
|
|
|
17
20
|
{#snippet content()}
|
|
18
|
-
<Combobox.Content {...props} class={className}>
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
<Combobox.Content {...props} class={className} forceMount>
|
|
22
|
+
{#snippet child({ wrapperProps, props, open })}
|
|
23
|
+
{#snippet content()}
|
|
24
|
+
{@render header?.()}
|
|
25
|
+
{#if showScroll}
|
|
26
|
+
<Combobox.ScrollUpButton class="flex justify-center">
|
|
27
|
+
<Icon iconName="CaretUp" />
|
|
28
|
+
</Combobox.ScrollUpButton>
|
|
29
|
+
<Combobox.Viewport class={paddedContent ? 'p-1' : ''}>
|
|
30
|
+
{@render children()}
|
|
31
|
+
</Combobox.Viewport>
|
|
32
|
+
<Combobox.ScrollDownButton class="flex justify-center">
|
|
33
|
+
<Icon iconName="CaretDown" />
|
|
34
|
+
</Combobox.ScrollDownButton>
|
|
35
|
+
{:else}
|
|
36
|
+
{@render children()}
|
|
37
|
+
{/if}
|
|
38
|
+
{@render footer?.()}
|
|
39
|
+
{/snippet}
|
|
40
|
+
|
|
41
|
+
{#if open}
|
|
42
|
+
<div {...wrapperProps}>
|
|
43
|
+
<div {...props} transition:fade={{ duration: fadeDuration }}>
|
|
44
|
+
{@render content()}
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
48
|
+
{/snippet}
|
|
34
49
|
</Combobox.Content>
|
|
35
50
|
{/snippet}
|
|
36
51
|
|
|
@@ -45,19 +60,19 @@
|
|
|
45
60
|
<style>
|
|
46
61
|
:global([data-combobox-content]) {
|
|
47
62
|
|
|
63
|
+
z-index: 1;
|
|
64
|
+
|
|
48
65
|
width: 100%;
|
|
49
66
|
|
|
50
67
|
border-radius: 0.75rem;
|
|
51
68
|
|
|
52
|
-
border-width: 1px;
|
|
53
|
-
|
|
54
69
|
--tw-bg-opacity: 1;
|
|
55
70
|
|
|
56
71
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
57
72
|
|
|
58
|
-
--tw-shadow: 0 4px
|
|
73
|
+
--tw-shadow: 0 4px 20px 0 rgba(18, 25, 42, 0.06), 0 0 0 1px rgba(18, 25, 42, 0.08);
|
|
59
74
|
|
|
60
|
-
--tw-shadow-colored: 0 4px
|
|
75
|
+
--tw-shadow-colored: 0 4px 20px 0 var(--tw-shadow-color), 0 0 0 1px var(--tw-shadow-color);
|
|
61
76
|
|
|
62
77
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
63
78
|
|
|
@@ -1,64 +1,231 @@
|
|
|
1
|
-
<script module>
|
|
1
|
+
<script context="module">
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Drawer from './Drawer.svelte';
|
|
4
3
|
import Button from '../button/Button.svelte';
|
|
4
|
+
import * as Drawer from './';
|
|
5
|
+
import { Root } from './';
|
|
5
6
|
|
|
6
7
|
const { Story } = defineMeta({
|
|
7
|
-
component: Drawer,
|
|
8
8
|
title: 'Design System/Drawer',
|
|
9
|
-
|
|
9
|
+
component: Root,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
side: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: ['left', 'right'],
|
|
17
|
+
description: 'Side from which the drawer slides in',
|
|
18
|
+
},
|
|
19
|
+
width: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
description: 'Custom width for the drawer',
|
|
22
|
+
},
|
|
23
|
+
withOverlay: {
|
|
24
|
+
control: 'boolean',
|
|
25
|
+
description: 'Show overlay behind the drawer',
|
|
26
|
+
},
|
|
27
|
+
withClose: {
|
|
28
|
+
control: 'boolean',
|
|
29
|
+
description: 'Show close button in the drawer',
|
|
30
|
+
},
|
|
31
|
+
closeOnOutsideClick: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description: 'Close drawer when clicking outside',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
10
36
|
});
|
|
11
|
-
|
|
12
|
-
|
|
37
|
+
const defaultArgs = {
|
|
38
|
+
side: 'right',
|
|
39
|
+
width: '460px',
|
|
40
|
+
withOverlay: false,
|
|
41
|
+
withClose: true,
|
|
42
|
+
closeOnOutsideClick: false,
|
|
43
|
+
};
|
|
13
44
|
</script>
|
|
14
45
|
|
|
15
|
-
<Story name="
|
|
16
|
-
<
|
|
17
|
-
<Drawer
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
<Story name="Default" asChild>
|
|
47
|
+
<Drawer.Root open>
|
|
48
|
+
<Drawer.Trigger>
|
|
49
|
+
<Button variant="primary">Open Drawer</Button>
|
|
50
|
+
</Drawer.Trigger>
|
|
51
|
+
|
|
52
|
+
<Drawer.Content>
|
|
53
|
+
<div class="flex h-full flex-col p-5">
|
|
54
|
+
<Drawer.Title>Drawer Title</Drawer.Title>
|
|
55
|
+
|
|
56
|
+
<div class="mt-6 flex-1 space-y-4">
|
|
57
|
+
<p>This is the main content of the drawer.</p>
|
|
58
|
+
<p>
|
|
59
|
+
The drawer slides in from the {defaultArgs.side} side and provides a focused interface for
|
|
60
|
+
specific tasks or detailed information.
|
|
61
|
+
</p>
|
|
62
|
+
<p>You can customize the width, add an overlay, control the close behavior, and more.</p>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<Drawer.Bottom>
|
|
66
|
+
<Drawer.Close>
|
|
67
|
+
<span>Cancel</span>
|
|
68
|
+
</Drawer.Close>
|
|
69
|
+
|
|
70
|
+
<Button variant="primary">Save</Button>
|
|
71
|
+
</Drawer.Bottom>
|
|
72
|
+
</div>
|
|
73
|
+
</Drawer.Content>
|
|
74
|
+
</Drawer.Root>
|
|
75
|
+
</Story>
|
|
76
|
+
|
|
77
|
+
<Story name="Left Side">
|
|
78
|
+
<Drawer.Root open>
|
|
79
|
+
<Drawer.Trigger>
|
|
80
|
+
<Button variant="secondary">Open Left Drawer</Button>
|
|
81
|
+
</Drawer.Trigger>
|
|
82
|
+
|
|
83
|
+
<Drawer.Content {...defaultArgs} side="left">
|
|
84
|
+
<div class="flex h-full flex-col p-5">
|
|
85
|
+
<Drawer.Title>Left Drawer</Drawer.Title>
|
|
86
|
+
|
|
87
|
+
<div class="mt-6 flex-1 space-y-4">
|
|
88
|
+
<p>This drawer slides in from the left side.</p>
|
|
89
|
+
<p>It includes an overlay and closes when clicking outside.</p>
|
|
90
|
+
<ul class="list-inside list-disc space-y-2">
|
|
91
|
+
<li>Navigation items</li>
|
|
92
|
+
<li>Settings</li>
|
|
93
|
+
<li>User profile</li>
|
|
94
|
+
<li>Help & support</li>
|
|
95
|
+
</ul>
|
|
26
96
|
</div>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
97
|
+
|
|
98
|
+
<Drawer.Bottom>
|
|
99
|
+
<Drawer.Close>
|
|
100
|
+
<span>Close</span>
|
|
101
|
+
</Drawer.Close>
|
|
102
|
+
</Drawer.Bottom>
|
|
103
|
+
</div>
|
|
104
|
+
</Drawer.Content>
|
|
105
|
+
</Drawer.Root>
|
|
30
106
|
</Story>
|
|
31
107
|
|
|
32
|
-
<Story name="
|
|
33
|
-
<
|
|
34
|
-
<Drawer
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
108
|
+
<Story name="With Overlay">
|
|
109
|
+
<Drawer.Root open>
|
|
110
|
+
<Drawer.Trigger>
|
|
111
|
+
<Button variant="primary">Open with Overlay</Button>
|
|
112
|
+
</Drawer.Trigger>
|
|
113
|
+
|
|
114
|
+
<Drawer.Content {...defaultArgs} withOverlay side="right">
|
|
115
|
+
<div class="flex h-full flex-col p-5">
|
|
116
|
+
<Drawer.Title>Drawer with Overlay</Drawer.Title>
|
|
117
|
+
|
|
118
|
+
<div class="mt-6 flex-1 space-y-4">
|
|
119
|
+
<p>This drawer includes a backdrop overlay.</p>
|
|
120
|
+
<p>Clicking outside the drawer will close it.</p>
|
|
121
|
+
|
|
122
|
+
<div class="space-y-3 rounded-lg border border-gray-200 p-4">
|
|
123
|
+
<h3 class="font-semibold">Form Example</h3>
|
|
124
|
+
<input
|
|
125
|
+
type="text"
|
|
126
|
+
placeholder="Enter your name"
|
|
127
|
+
class="w-full rounded border border-gray-300 p-2"
|
|
128
|
+
/>
|
|
129
|
+
<textarea
|
|
130
|
+
placeholder="Add a comment..."
|
|
131
|
+
class="h-24 w-full rounded border border-gray-300 p-2"
|
|
132
|
+
></textarea>
|
|
42
133
|
</div>
|
|
43
134
|
</div>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
135
|
+
|
|
136
|
+
<Drawer.Bottom>
|
|
137
|
+
<Drawer.Close>
|
|
138
|
+
<span>Cancel</span>
|
|
139
|
+
</Drawer.Close>
|
|
140
|
+
<Button variant="primary">Submit</Button>
|
|
141
|
+
</Drawer.Bottom>
|
|
142
|
+
</div>
|
|
143
|
+
</Drawer.Content>
|
|
144
|
+
</Drawer.Root>
|
|
47
145
|
</Story>
|
|
48
146
|
|
|
49
|
-
<Story name="
|
|
50
|
-
<
|
|
51
|
-
<Drawer
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
147
|
+
<Story name="Custom Width">
|
|
148
|
+
<Drawer.Root open>
|
|
149
|
+
<Drawer.Trigger>
|
|
150
|
+
<Button variant="primary">Open Wide Drawer</Button>
|
|
151
|
+
</Drawer.Trigger>
|
|
152
|
+
|
|
153
|
+
<Drawer.Content {...defaultArgs} class="!w-[800px]" side="right">
|
|
154
|
+
<div class="flex h-full flex-col p-5">
|
|
155
|
+
<Drawer.Title>Wide Drawer (600px)</Drawer.Title>
|
|
156
|
+
|
|
157
|
+
<div class="mt-6 flex-1 space-y-4">
|
|
158
|
+
<p>This drawer has a custom width of 600px.</p>
|
|
159
|
+
<p>Perfect for forms, data tables, or detailed content.</p>
|
|
160
|
+
|
|
161
|
+
<div class="grid grid-cols-2 gap-4">
|
|
162
|
+
<div class="rounded-lg border border-static p-4">
|
|
163
|
+
<h4 class="mb-2 font-semibold">Column 1</h4>
|
|
164
|
+
<p>Content for the first column.</p>
|
|
165
|
+
</div>
|
|
166
|
+
<div class="rounded-lg border border-static p-4">
|
|
167
|
+
<h4 class="mb-2 font-semibold">Column 2</h4>
|
|
168
|
+
<p>Content for the second column.</p>
|
|
169
|
+
</div>
|
|
59
170
|
</div>
|
|
60
171
|
</div>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
172
|
+
|
|
173
|
+
<Drawer.Bottom>
|
|
174
|
+
<Drawer.Close>
|
|
175
|
+
<span>Close</span>
|
|
176
|
+
</Drawer.Close>
|
|
177
|
+
</Drawer.Bottom>
|
|
178
|
+
</div>
|
|
179
|
+
</Drawer.Content>
|
|
180
|
+
</Drawer.Root>
|
|
181
|
+
</Story>
|
|
182
|
+
|
|
183
|
+
<Story name="Without Close Button">
|
|
184
|
+
<Drawer.Root open>
|
|
185
|
+
<Drawer.Trigger>
|
|
186
|
+
<Button variant="primary">Open Drawer</Button>
|
|
187
|
+
</Drawer.Trigger>
|
|
188
|
+
|
|
189
|
+
<Drawer.Content {...defaultArgs} withClose={false} side="right">
|
|
190
|
+
<div class="flex h-full flex-col p-5">
|
|
191
|
+
<Drawer.Title>No Close Button</Drawer.Title>
|
|
192
|
+
|
|
193
|
+
<div class="mt-6 flex-1 space-y-4">
|
|
194
|
+
<p>This drawer doesn't have a close button in the top-right corner.</p>
|
|
195
|
+
<p>Users must use the bottom buttons to close it.</p>
|
|
196
|
+
<p>This is useful for critical actions or multi-step processes.</p>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<Drawer.Bottom>
|
|
200
|
+
<Drawer.Close>
|
|
201
|
+
<span>Done</span>
|
|
202
|
+
</Drawer.Close>
|
|
203
|
+
</Drawer.Bottom>
|
|
204
|
+
</div>
|
|
205
|
+
</Drawer.Content>
|
|
206
|
+
</Drawer.Root>
|
|
207
|
+
</Story>
|
|
208
|
+
|
|
209
|
+
<Story name="Behavior test" asChild>
|
|
210
|
+
<Drawer.Root>
|
|
211
|
+
<Drawer.Trigger>
|
|
212
|
+
<Button variant="primary">Open Drawer</Button>
|
|
213
|
+
</Drawer.Trigger>
|
|
214
|
+
|
|
215
|
+
<Drawer.Content>
|
|
216
|
+
<div class="flex h-full flex-col p-5">
|
|
217
|
+
<div class="mt-6 flex-1 space-y-4">
|
|
218
|
+
<p>This drawer doesn't have a close button in the top-right corner.</p>
|
|
219
|
+
<p>Users must use the bottom buttons to close it.</p>
|
|
220
|
+
<p>This is useful for critical actions or multi-step processes.</p>
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<Drawer.Bottom>
|
|
224
|
+
<Drawer.Close variant="primary">
|
|
225
|
+
<span>Done</span>
|
|
226
|
+
</Drawer.Close>
|
|
227
|
+
</Drawer.Bottom>
|
|
228
|
+
</div>
|
|
229
|
+
</Drawer.Content>
|
|
230
|
+
</Drawer.Root>
|
|
64
231
|
</Story>
|
|
@@ -11,7 +11,7 @@ declare const Drawer: $$__sveltets_2_IsomorphicComponent<{
|
|
|
11
11
|
}, {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|
|
13
13
|
}, {}, {}, string>;
|
|
14
|
-
import Drawer from './
|
|
14
|
+
import * as Drawer from './';
|
|
15
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
16
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
17
|
$$bindings?: Bindings;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { DrawerBottomProps } from '../types';
|
|
3
|
+
|
|
4
|
+
let { children, class: className = '', ...restProps }: DrawerBottomProps = $props();
|
|
5
|
+
|
|
6
|
+
const baseClasses = 'border-t border-static -mx-5';
|
|
7
|
+
const finalClasses = `${baseClasses} ${className}`;
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div class={finalClasses} {...restProps}>
|
|
11
|
+
<div class="flex justify-end gap-4 px-5 py-4 pb-0">
|
|
12
|
+
{@render children()}
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog } from 'bits-ui';
|
|
3
|
+
import Button from '../../button/Button.svelte';
|
|
4
|
+
import type { DrawerCloseProps } from '../types';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
variant = 'secondary',
|
|
9
|
+
disabled = false,
|
|
10
|
+
class: className = '',
|
|
11
|
+
...restProps
|
|
12
|
+
}: DrawerCloseProps = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Dialog.Close class={className} {...restProps} {disabled}>
|
|
16
|
+
<Button {variant} {disabled} tabindex={-1}>
|
|
17
|
+
{@render children()}
|
|
18
|
+
</Button>
|
|
19
|
+
</Dialog.Close>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog } from 'bits-ui';
|
|
3
|
+
import { fly } from 'svelte/transition';
|
|
4
|
+
import { Icon } from '../../icons';
|
|
5
|
+
import type { DrawerContentProps } from '../types';
|
|
6
|
+
import Overlay from './drawer-overlay.svelte';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
children,
|
|
10
|
+
class: className = '',
|
|
11
|
+
side = 'right',
|
|
12
|
+
withClose = true,
|
|
13
|
+
withPortal = true,
|
|
14
|
+
withOverlay = false,
|
|
15
|
+
closeOnOutsideClick = false,
|
|
16
|
+
'data-testid': dataTestId,
|
|
17
|
+
...restProps
|
|
18
|
+
}: DrawerContentProps = $props();
|
|
19
|
+
|
|
20
|
+
const baseClasses = 'fixed top-0 h-screen z-50 w-[460px] flex flex-col bg-surface shadow-lg';
|
|
21
|
+
const sideClasses = side === 'left' ? 'left-0' : 'right-0';
|
|
22
|
+
const finalClasses = `${baseClasses} ${sideClasses} ${className}`;
|
|
23
|
+
|
|
24
|
+
const getTransitionParams = (side: 'left' | 'right') => ({
|
|
25
|
+
x: side === 'left' ? -300 : 300,
|
|
26
|
+
duration: 300,
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
{#snippet withCloseButton()}
|
|
31
|
+
{#if withClose}
|
|
32
|
+
<Dialog.Close
|
|
33
|
+
class="ring-offset-background focus:ring-ring absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none"
|
|
34
|
+
>
|
|
35
|
+
<Icon iconName="X" />
|
|
36
|
+
</Dialog.Close>
|
|
37
|
+
{/if}
|
|
38
|
+
{/snippet}
|
|
39
|
+
|
|
40
|
+
{#snippet content()}
|
|
41
|
+
<Dialog.Content
|
|
42
|
+
forceMount
|
|
43
|
+
{...restProps}
|
|
44
|
+
interactOutsideBehavior={closeOnOutsideClick ? 'close' : 'ignore'}
|
|
45
|
+
>
|
|
46
|
+
{#snippet child({ props, open })}
|
|
47
|
+
{#if open}
|
|
48
|
+
<div
|
|
49
|
+
{...props}
|
|
50
|
+
class={finalClasses}
|
|
51
|
+
data-testid={dataTestId}
|
|
52
|
+
transition:fly={getTransitionParams(side)}
|
|
53
|
+
>
|
|
54
|
+
{@render withCloseButton()}
|
|
55
|
+
{@render children()}
|
|
56
|
+
</div>
|
|
57
|
+
{/if}
|
|
58
|
+
{/snippet}
|
|
59
|
+
</Dialog.Content>
|
|
60
|
+
{/snippet}
|
|
61
|
+
|
|
62
|
+
{#if withPortal}
|
|
63
|
+
<Dialog.Portal>
|
|
64
|
+
{#if withOverlay}
|
|
65
|
+
<Overlay />
|
|
66
|
+
{/if}
|
|
67
|
+
{@render content()}
|
|
68
|
+
</Dialog.Portal>
|
|
69
|
+
{:else}
|
|
70
|
+
{#if withOverlay}
|
|
71
|
+
<Overlay />
|
|
72
|
+
{/if}
|
|
73
|
+
{@render content()}
|
|
74
|
+
{/if}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog, type WithoutChildrenOrChild } from 'bits-ui';
|
|
3
|
+
import type { DrawerOverlayProps } from '../types';
|
|
4
|
+
import { fade } from 'svelte/transition';
|
|
5
|
+
|
|
6
|
+
let { children, ...restProps }: DrawerOverlayProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Dialog.Overlay forceMount {...restProps}>
|
|
10
|
+
{#snippet child({ props, open })}
|
|
11
|
+
{#if open}
|
|
12
|
+
<div
|
|
13
|
+
{...props}
|
|
14
|
+
class="fixed inset-0 z-50 bg-overlay backdrop-blur-sm"
|
|
15
|
+
transition:fade={{ duration: 200 }}
|
|
16
|
+
>
|
|
17
|
+
{#if children}
|
|
18
|
+
{@render children()}
|
|
19
|
+
{/if}
|
|
20
|
+
</div>
|
|
21
|
+
{/if}
|
|
22
|
+
{/snippet}
|
|
23
|
+
</Dialog.Overlay>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog } from 'bits-ui';
|
|
3
|
+
import type { DrawerTitleProps } from '../types';
|
|
4
|
+
|
|
5
|
+
let { children, class: className = '', icon, ...restProps }: DrawerTitleProps = $props();
|
|
6
|
+
|
|
7
|
+
const baseClasses = 'text-xl font-semibold tracking-tight text-primary';
|
|
8
|
+
const finalClasses = `${baseClasses} ${className}`;
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div class="space-y-6">
|
|
12
|
+
{#if icon}
|
|
13
|
+
<div class="flex justify-start">
|
|
14
|
+
{@render icon()}
|
|
15
|
+
</div>
|
|
16
|
+
{/if}
|
|
17
|
+
<Dialog.Title class={finalClasses} {...restProps}>
|
|
18
|
+
{@render children()}
|
|
19
|
+
</Dialog.Title>
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog } from 'bits-ui';
|
|
3
|
+
import type { DrawerTriggerProps } from '../types';
|
|
4
|
+
|
|
5
|
+
let { children, ...restProps }: DrawerTriggerProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<Dialog.Trigger {...restProps}>
|
|
9
|
+
{@render children()}
|
|
10
|
+
</Dialog.Trigger>
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { Dialog } from 'bits-ui';
|
|
2
|
+
import Content from './components/drawer-content.svelte';
|
|
3
|
+
import Overlay from './components/drawer-overlay.svelte';
|
|
4
|
+
import Trigger from './components/drawer-trigger.svelte';
|
|
5
|
+
import Title from './components/drawer-title.svelte';
|
|
6
|
+
import Bottom from './components/drawer-bottom.svelte';
|
|
7
|
+
import Close from './components/drawer-close.svelte';
|
|
8
|
+
export declare const Root: import("svelte").Component<import("bits-ui").AlertDialogRootPropsWithoutHTML, {}, "open">;
|
|
9
|
+
export declare const Portal: import("svelte").Component<import("bits-ui").PortalProps, {}, "">;
|
|
10
|
+
export declare const Description: import("svelte").Component<Dialog.DescriptionProps, {}, "ref">;
|
|
11
|
+
export { Content, Overlay, Trigger, Title, Bottom, Close };
|
|
12
|
+
export * from './types';
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { Dialog } from 'bits-ui';
|
|
2
|
+
// Custom Svelte components
|
|
3
|
+
import Content from './components/drawer-content.svelte';
|
|
4
|
+
import Overlay from './components/drawer-overlay.svelte';
|
|
5
|
+
import Trigger from './components/drawer-trigger.svelte';
|
|
6
|
+
import Title from './components/drawer-title.svelte';
|
|
7
|
+
import Bottom from './components/drawer-bottom.svelte';
|
|
8
|
+
import Close from './components/drawer-close.svelte';
|
|
9
|
+
// Re-export Dialog primitives
|
|
10
|
+
export const Root = Dialog.Root;
|
|
11
|
+
export const Portal = Dialog.Portal;
|
|
12
|
+
export const Description = Dialog.Description;
|
|
13
|
+
// Export custom components
|
|
14
|
+
export { Content, Overlay, Trigger, Title, Bottom, Close };
|
|
15
|
+
export * from './types';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type DialogContentProps as BitsDialogContentProps, type DialogOverlayProps as BitsDialogOverlayProps, type DialogTriggerProps as BitsDialogTriggerProps, type DialogTitleProps as BitsDialogTitleProps, type DialogCloseProps as BitsDialogCloseProps } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import type { ButtonVariant } from '../button/Button.svelte';
|
|
5
|
+
export type DrawerSide = 'left' | 'right';
|
|
6
|
+
export type DrawerTriggerProps = {
|
|
7
|
+
children: Snippet;
|
|
8
|
+
} & BitsDialogTriggerProps;
|
|
9
|
+
export type DrawerOverlayProps = {
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
} & BitsDialogOverlayProps;
|
|
12
|
+
export type DrawerContentProps = {
|
|
13
|
+
children: Snippet;
|
|
14
|
+
class?: string;
|
|
15
|
+
side?: DrawerSide;
|
|
16
|
+
withClose?: boolean;
|
|
17
|
+
withPortal?: boolean;
|
|
18
|
+
withOverlay?: boolean;
|
|
19
|
+
closeOnOutsideClick?: boolean;
|
|
20
|
+
} & BitsDialogContentProps;
|
|
21
|
+
export type DrawerTitleProps = {
|
|
22
|
+
children: Snippet;
|
|
23
|
+
class?: string;
|
|
24
|
+
icon?: Snippet;
|
|
25
|
+
} & BitsDialogTitleProps;
|
|
26
|
+
export type DrawerBottomProps = {
|
|
27
|
+
children: Snippet;
|
|
28
|
+
class?: string;
|
|
29
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
30
|
+
export type DrawerCloseProps = {
|
|
31
|
+
children: Snippet;
|
|
32
|
+
class?: string;
|
|
33
|
+
variant?: ButtonVariant;
|
|
34
|
+
onclick?: (event: MouseEvent) => void;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
} & BitsDialogCloseProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {} from 'bits-ui';
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
<style>
|
|
76
76
|
button {
|
|
77
77
|
display: flex;
|
|
78
|
+
flex-shrink: 0;
|
|
78
79
|
cursor: pointer;
|
|
79
80
|
align-items: center;
|
|
80
81
|
justify-content: center;
|
|
@@ -94,39 +95,39 @@
|
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
.size-xs {
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
width: 1.5rem;
|
|
99
|
+
height: 1.5rem
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
.size-xs :global(svg) {
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
width: 1rem;
|
|
104
|
+
height: 1rem
|
|
104
105
|
}
|
|
105
106
|
.size-sm {
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
width: 2rem;
|
|
108
|
+
height: 2rem
|
|
108
109
|
}
|
|
109
110
|
.size-sm :global(svg) {
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
width: 1rem;
|
|
112
|
+
height: 1rem
|
|
112
113
|
}
|
|
113
114
|
.size-md {
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
width: 2.5rem;
|
|
116
|
+
height: 2.5rem
|
|
116
117
|
}
|
|
117
118
|
.size-md :global(svg) {
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
width: 1.25rem;
|
|
120
|
+
height: 1.25rem
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
.size-lg {
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
width: 3rem;
|
|
125
|
+
height: 3rem
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
.size-lg :global(svg) {
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
width: 1.5rem;
|
|
130
|
+
height: 1.5rem
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
.color-primary {
|
|
@@ -9,6 +9,11 @@ export type BackgroundClass = `bg-${keyof typeof backgroundColor}`;
|
|
|
9
9
|
export type IconColor = keyof typeof textColor;
|
|
10
10
|
export type SupportedAnalysisModelIcons = 'pipeline_halos' | 'pipeline_large_colonies' | 'pipeline_microbial_colonies' | 'pipeline_small_colonies' | 'sgs_enteros' | 'general_germination_rate_with_tracking' | 'general_germination_rate_without_tracking' | 'pipeline_insects' | 'pipeline_colony_formation' | 'pipeline_radial_growth' | 'syngenta_health_score_crw' | 'pipeline_seed_germination' | 'syngenta_health_score_faw' | 'syngenta_health_score_sbl' | 'unilever_cfu_count_lowres';
|
|
11
11
|
export type SupportedPrincipalIcons = 'user' | 'group' | 'organization';
|
|
12
|
+
export interface IconComponentProps {
|
|
13
|
+
size?: number | string;
|
|
14
|
+
color?: string;
|
|
15
|
+
weight?: 'thin' | 'light' | 'regular' | 'bold' | 'fill' | 'duotone';
|
|
16
|
+
}
|
|
12
17
|
export { default as Icon } from './Icon.svelte';
|
|
13
18
|
export type IconProps = {
|
|
14
19
|
iconName: IconName;
|
|
@@ -60,7 +60,6 @@ import House from 'phosphor-svelte/lib/House';
|
|
|
60
60
|
import ImageSquare from 'phosphor-svelte/lib/ImageSquare';
|
|
61
61
|
import ImagesSquare from 'phosphor-svelte/lib/ImagesSquare';
|
|
62
62
|
import Info from 'phosphor-svelte/lib/Info';
|
|
63
|
-
import Link from 'phosphor-svelte/lib/Link';
|
|
64
63
|
import Lock from 'phosphor-svelte/lib/Lock';
|
|
65
64
|
import LineSegments from 'phosphor-svelte/lib/LineSegments';
|
|
66
65
|
import List from 'phosphor-svelte/lib/List';
|
|
@@ -102,6 +101,7 @@ import Stop from 'phosphor-svelte/lib/Stop';
|
|
|
102
101
|
import StopCircle from 'phosphor-svelte/lib/StopCircle';
|
|
103
102
|
import Sun from 'phosphor-svelte/lib/Sun';
|
|
104
103
|
import Table from 'phosphor-svelte/lib/Table';
|
|
104
|
+
import Link from 'phosphor-svelte/lib/Link';
|
|
105
105
|
import Tag from 'phosphor-svelte/lib/Tag';
|
|
106
106
|
import Target from 'phosphor-svelte/lib/Target';
|
|
107
107
|
import TestTube from 'phosphor-svelte/lib/TestTube';
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
interface InputProps extends Omit<HTMLInputAttributes, 'size' | 'prefix' | 'suffix'> {
|
|
8
8
|
label?: string | null;
|
|
9
9
|
id?: string | undefined;
|
|
10
|
+
variant?: 'default' | 'transparent' | 'borderless';
|
|
10
11
|
validator?: (a: string | number) => boolean;
|
|
11
12
|
prefix?: Snippet<[any]>;
|
|
12
13
|
suffix?: Snippet;
|
|
13
14
|
error?: Snippet;
|
|
14
15
|
input?: HTMLInputElement;
|
|
15
16
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'dynamic';
|
|
16
|
-
transparent?: boolean;
|
|
17
17
|
clearable?: boolean;
|
|
18
18
|
onclear?: () => void;
|
|
19
19
|
class?: string;
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
let {
|
|
25
25
|
label = null,
|
|
26
|
+
variant = 'default',
|
|
26
27
|
value = $bindable(),
|
|
27
28
|
type = 'text',
|
|
28
29
|
validator = (_) => {
|
|
@@ -33,7 +34,6 @@
|
|
|
33
34
|
error,
|
|
34
35
|
input = $bindable(),
|
|
35
36
|
size = 'md',
|
|
36
|
-
transparent = false,
|
|
37
37
|
clearable = false,
|
|
38
38
|
onclear = () => {},
|
|
39
39
|
class: className,
|
|
@@ -75,9 +75,10 @@
|
|
|
75
75
|
|
|
76
76
|
<div
|
|
77
77
|
class="flex w-full items-center gap-1 rounded-lg border border-input bg-surface shadow-input size-{size}"
|
|
78
|
-
class:border-transparent={transparent}
|
|
79
|
-
class:shadow-input={!transparent}
|
|
78
|
+
class:border-transparent={variant === 'transparent'}
|
|
79
|
+
class:shadow-input={!(variant === 'transparent')}
|
|
80
80
|
class:!border-error={!valid}
|
|
81
|
+
class:borderless={variant === 'borderless'}
|
|
81
82
|
>
|
|
82
83
|
<div class="whitespace-nowrap text-secondary">
|
|
83
84
|
{@render prefix?.({ valid })}
|
|
@@ -102,6 +103,7 @@
|
|
|
102
103
|
{#if clearable && value}
|
|
103
104
|
<IconButton
|
|
104
105
|
variant="transparent"
|
|
106
|
+
rounded={false}
|
|
105
107
|
size="xs"
|
|
106
108
|
onclick={() => {
|
|
107
109
|
value = '';
|
|
@@ -124,6 +126,8 @@
|
|
|
124
126
|
|
|
125
127
|
resize: none;
|
|
126
128
|
|
|
129
|
+
padding: 0.25rem;
|
|
130
|
+
|
|
127
131
|
outline: 2px solid transparent;
|
|
128
132
|
|
|
129
133
|
outline-offset: 2px
|
|
@@ -141,11 +145,37 @@
|
|
|
141
145
|
border-color: rgb(87 80 238 / var(--tw-border-opacity, 1))
|
|
142
146
|
}
|
|
143
147
|
|
|
148
|
+
.borderless {
|
|
149
|
+
|
|
150
|
+
border-style: none;
|
|
151
|
+
|
|
152
|
+
--tw-shadow: 0 0 #0000;
|
|
153
|
+
|
|
154
|
+
--tw-shadow-colored: 0 0 #0000;
|
|
155
|
+
|
|
156
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.borderless input {
|
|
160
|
+
|
|
161
|
+
border-style: none;
|
|
162
|
+
|
|
163
|
+
outline: 2px solid transparent;
|
|
164
|
+
|
|
165
|
+
outline-offset: 2px;
|
|
166
|
+
|
|
167
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
168
|
+
|
|
169
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
170
|
+
|
|
171
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)
|
|
172
|
+
}
|
|
173
|
+
|
|
144
174
|
.size-xs {
|
|
145
175
|
|
|
146
176
|
height: 1.5rem;
|
|
147
177
|
|
|
148
|
-
padding: 0.
|
|
178
|
+
padding: 0.25rem;
|
|
149
179
|
|
|
150
180
|
font-size: 0.75rem;
|
|
151
181
|
|
|
@@ -156,35 +186,23 @@
|
|
|
156
186
|
|
|
157
187
|
height: 2rem;
|
|
158
188
|
|
|
159
|
-
padding
|
|
160
|
-
|
|
161
|
-
padding-right: 0.75rem;
|
|
162
|
-
|
|
163
|
-
padding-top: 0.5rem;
|
|
164
|
-
|
|
165
|
-
padding-bottom: 0.5rem
|
|
189
|
+
padding: 0.25rem
|
|
166
190
|
}
|
|
167
191
|
|
|
168
192
|
.size-md {
|
|
169
193
|
|
|
170
194
|
height: 2.5rem;
|
|
171
195
|
|
|
172
|
-
padding
|
|
173
|
-
|
|
174
|
-
padding-right: 0.75rem;
|
|
175
|
-
|
|
176
|
-
padding-top: 0.5rem;
|
|
177
|
-
|
|
178
|
-
padding-bottom: 0.5rem
|
|
196
|
+
padding: 0.5rem
|
|
179
197
|
}
|
|
180
198
|
|
|
181
199
|
.size-lg {
|
|
182
200
|
|
|
183
201
|
height: 3rem;
|
|
184
202
|
|
|
185
|
-
padding-left: 0.
|
|
203
|
+
padding-left: 0.5rem;
|
|
186
204
|
|
|
187
|
-
padding-right: 0.
|
|
205
|
+
padding-right: 0.5rem;
|
|
188
206
|
|
|
189
207
|
padding-top: 0.75rem;
|
|
190
208
|
|
|
@@ -3,13 +3,13 @@ import type { HTMLInputAttributes } from 'svelte/elements';
|
|
|
3
3
|
interface InputProps extends Omit<HTMLInputAttributes, 'size' | 'prefix' | 'suffix'> {
|
|
4
4
|
label?: string | null;
|
|
5
5
|
id?: string | undefined;
|
|
6
|
+
variant?: 'default' | 'transparent' | 'borderless';
|
|
6
7
|
validator?: (a: string | number) => boolean;
|
|
7
8
|
prefix?: Snippet<[any]>;
|
|
8
9
|
suffix?: Snippet;
|
|
9
10
|
error?: Snippet;
|
|
10
11
|
input?: HTMLInputElement;
|
|
11
12
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'dynamic';
|
|
12
|
-
transparent?: boolean;
|
|
13
13
|
clearable?: boolean;
|
|
14
14
|
onclear?: () => void;
|
|
15
15
|
class?: string;
|
|
@@ -29,27 +29,7 @@
|
|
|
29
29
|
{/if}
|
|
30
30
|
{/snippet}
|
|
31
31
|
|
|
32
|
-
{#
|
|
33
|
-
<Dialog.Portal>
|
|
34
|
-
<Overlay />
|
|
35
|
-
<Dialog.Content forceMount {...restProps}>
|
|
36
|
-
{#snippet child({ props, open })}
|
|
37
|
-
{#if open}
|
|
38
|
-
<div
|
|
39
|
-
{...props}
|
|
40
|
-
class={finalClasses}
|
|
41
|
-
data-testid={dataTestId}
|
|
42
|
-
transition:scale={{ duration: 200, start: 0.95 }}
|
|
43
|
-
>
|
|
44
|
-
{@render withCloseButton()}
|
|
45
|
-
{@render children()}
|
|
46
|
-
</div>
|
|
47
|
-
{/if}
|
|
48
|
-
{/snippet}
|
|
49
|
-
</Dialog.Content>
|
|
50
|
-
</Dialog.Portal>
|
|
51
|
-
{:else}
|
|
52
|
-
<Overlay />
|
|
32
|
+
{#snippet content()}
|
|
53
33
|
<Dialog.Content forceMount {...restProps}>
|
|
54
34
|
{#snippet child({ props, open })}
|
|
55
35
|
{#if open}
|
|
@@ -65,4 +45,14 @@
|
|
|
65
45
|
{/if}
|
|
66
46
|
{/snippet}
|
|
67
47
|
</Dialog.Content>
|
|
48
|
+
{/snippet}
|
|
49
|
+
|
|
50
|
+
{#if withPortal}
|
|
51
|
+
<Dialog.Portal>
|
|
52
|
+
<Overlay />
|
|
53
|
+
{@render content()}
|
|
54
|
+
</Dialog.Portal>
|
|
55
|
+
{:else}
|
|
56
|
+
<Overlay />
|
|
57
|
+
{@render content()}
|
|
68
58
|
{/if}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,7 @@ export * as Combobox from './components/combobox/';
|
|
|
8
8
|
export * from './components/graphs';
|
|
9
9
|
export * from './components/datepicker/';
|
|
10
10
|
export * from './components/divider/';
|
|
11
|
-
export * from './components/drawer/';
|
|
12
|
-
export * from './components/drawer/';
|
|
11
|
+
export * as Drawer from './components/drawer/';
|
|
13
12
|
export * from './components/dropdown/';
|
|
14
13
|
export * from './components/empty-content/';
|
|
15
14
|
export * from './components/icons/';
|
package/dist/index.js
CHANGED
|
@@ -9,8 +9,7 @@ export * as Combobox from './components/combobox/';
|
|
|
9
9
|
export * from './components/graphs';
|
|
10
10
|
export * from './components/datepicker/';
|
|
11
11
|
export * from './components/divider/';
|
|
12
|
-
export * from './components/drawer/';
|
|
13
|
-
export * from './components/drawer/';
|
|
12
|
+
export * as Drawer from './components/drawer/';
|
|
14
13
|
export * from './components/dropdown/';
|
|
15
14
|
export * from './components/empty-content/';
|
|
16
15
|
export * from './components/icons/';
|
package/package.json
CHANGED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import DrawerLabel from './DrawerLabel.svelte';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
id: string;
|
|
7
|
-
controlled?: boolean;
|
|
8
|
-
// Open only works when controlled is true
|
|
9
|
-
open?: boolean;
|
|
10
|
-
side?: 'left' | 'right';
|
|
11
|
-
trigger?: Snippet;
|
|
12
|
-
content: Snippet;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
id,
|
|
17
|
-
controlled = false,
|
|
18
|
-
open = $bindable(false),
|
|
19
|
-
side = 'right',
|
|
20
|
-
trigger,
|
|
21
|
-
content,
|
|
22
|
-
}: Props = $props();
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<div class={`drawer-auto-gutter drawer`} class:drawer-end={side === 'right'}>
|
|
26
|
-
{#if controlled}
|
|
27
|
-
<input {id} type="checkbox" class="drawer-toggle" bind:checked={open} />
|
|
28
|
-
{:else}
|
|
29
|
-
<input {id} type="checkbox" class="drawer-toggle" />
|
|
30
|
-
{/if}
|
|
31
|
-
|
|
32
|
-
<div class="drawer-content">
|
|
33
|
-
{@render trigger?.()}
|
|
34
|
-
</div>
|
|
35
|
-
<div class="drawer-side" inert={controlled ? !open : false}>
|
|
36
|
-
<label for={id} aria-label="close sidebar" class="drawer-overlay"></label>
|
|
37
|
-
<div class="h-screen bg-surface sm:w-[460px]">
|
|
38
|
-
{@render content()}
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
interface Props {
|
|
3
|
-
id: string;
|
|
4
|
-
controlled?: boolean;
|
|
5
|
-
open?: boolean;
|
|
6
|
-
side?: 'left' | 'right';
|
|
7
|
-
trigger?: Snippet;
|
|
8
|
-
content: Snippet;
|
|
9
|
-
}
|
|
10
|
-
declare const Drawer: import("svelte").Component<Props, {}, "open">;
|
|
11
|
-
type Drawer = ReturnType<typeof Drawer>;
|
|
12
|
-
export default Drawer;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
id: string;
|
|
6
|
-
classes?: string;
|
|
7
|
-
children: Snippet;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let { id, classes = '', children }: Props = $props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
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: 0 1px 4px 0 rgba(18, 25, 42, 0.04);
|
|
45
|
-
|
|
46
|
-
--tw-shadow-colored: 0 1px 4px 0 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>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
interface Props {
|
|
3
|
-
id: string;
|
|
4
|
-
classes?: string;
|
|
5
|
-
children: Snippet;
|
|
6
|
-
}
|
|
7
|
-
declare const DrawerLabel: import("svelte").Component<Props, {}, "">;
|
|
8
|
-
type DrawerLabel = ReturnType<typeof DrawerLabel>;
|
|
9
|
-
export default DrawerLabel;
|