@reshape-biotech/design-system 2.0.4 → 2.2.0
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/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/modal/Modal.stories.svelte +234 -26
- package/dist/components/modal/Modal.stories.svelte.d.ts +1 -1
- package/dist/components/modal/components/modal-bottom.svelte +14 -0
- package/dist/components/modal/components/modal-bottom.svelte.d.ts +4 -0
- package/dist/components/modal/components/modal-close.svelte +19 -0
- package/dist/components/modal/components/modal-close.svelte.d.ts +4 -0
- package/dist/components/modal/components/modal-content.svelte +58 -0
- package/dist/components/modal/components/modal-content.svelte.d.ts +4 -0
- package/dist/components/modal/components/modal-overlay.svelte +23 -0
- package/dist/components/modal/components/modal-overlay.svelte.d.ts +4 -0
- package/dist/components/modal/components/modal-title.svelte +20 -0
- package/dist/components/modal/components/modal-title.svelte.d.ts +4 -0
- package/dist/components/modal/components/modal-trigger.svelte +10 -0
- package/dist/components/modal/components/modal-trigger.svelte.d.ts +4 -0
- package/dist/components/modal/index.d.ts +12 -1
- package/dist/components/modal/index.js +15 -1
- package/dist/components/modal/types.d.ts +32 -0
- package/dist/components/modal/types.js +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- 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
- package/dist/components/modal/Modal.svelte +0 -81
- package/dist/components/modal/Modal.svelte.d.ts +0 -20
|
@@ -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';
|