@ims360/svelte-ivory 0.1.13 → 0.1.14
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/inputs/FullscreenDropzone.svelte +4 -6
- package/dist/components/inputs/FullscreenDropzone.svelte.d.ts.map +1 -1
- package/dist/components/layout/dialog/Dialog.svelte +2 -2
- package/dist/components/layout/drawer/Drawer.svelte +35 -37
- package/dist/components/layout/drawer/Drawer.svelte.d.ts.map +1 -1
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte +7 -45
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts +2 -8
- package/dist/components/layout/hiddenBackground/HiddenBackground.svelte.d.ts.map +1 -1
- package/dist/components/layout/modal/Modal.svelte +56 -64
- package/dist/components/layout/modal/Modal.svelte.d.ts.map +1 -1
- package/dist/components/layout/popover/Popover.svelte +4 -3
- package/dist/components/layout/popover/Popover.svelte.d.ts.map +1 -1
- package/dist/components/table/VirtualList.svelte +23 -23
- package/dist/components/table/VirtualList.svelte.d.ts +2 -2
- package/dist/components/table/VirtualList.svelte.d.ts.map +1 -1
- package/dist/theme.svelte.d.ts +3 -0
- package/dist/theme.svelte.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/components/inputs/FullscreenDropzone.svelte +4 -6
- package/src/lib/components/layout/dialog/Dialog.svelte +2 -2
- package/src/lib/components/layout/drawer/Drawer.svelte +35 -37
- package/src/lib/components/layout/hiddenBackground/HiddenBackground.svelte +7 -45
- package/src/lib/components/layout/modal/Modal.svelte +56 -64
- package/src/lib/components/layout/popover/Popover.svelte +4 -3
- package/src/lib/components/table/VirtualList.svelte +23 -23
- package/src/lib/theme.svelte.ts +3 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { FileUp } from '@lucide/svelte';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { scale } from 'svelte/transition';
|
|
5
|
-
import { HiddenBackground
|
|
5
|
+
import { HiddenBackground } from '../layout';
|
|
6
6
|
|
|
7
7
|
export interface FullscreenDropzoneProps {
|
|
8
8
|
ondrop: (files: File[]) => void;
|
|
@@ -64,11 +64,9 @@
|
|
|
64
64
|
/>
|
|
65
65
|
|
|
66
66
|
{#if open}
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
</HiddenBackground>
|
|
71
|
-
</Portal>
|
|
67
|
+
<HiddenBackground class="flex items-center justify-center">
|
|
68
|
+
{@render children()}
|
|
69
|
+
</HiddenBackground>
|
|
72
70
|
{/if}
|
|
73
71
|
|
|
74
72
|
{#snippet defaultChildren()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullscreenDropzone.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/inputs/FullscreenDropzone.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAItC,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"FullscreenDropzone.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/inputs/FullscreenDropzone.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAItC,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAkEL,QAAA,MAAM,kBAAkB,6DAAwC,CAAC;AACjE,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,eAAe,kBAAkB,CAAC"}
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
onclose={close}
|
|
64
64
|
class={twMerge(
|
|
65
65
|
clsx(
|
|
66
|
-
'h-full max-h-none w-screen max-w-full bg-transparent backdrop:bg-
|
|
67
|
-
theme.current.
|
|
66
|
+
'h-full max-h-none w-screen max-w-full bg-transparent backdrop:bg-transparent',
|
|
67
|
+
theme.current.dialog?.class,
|
|
68
68
|
clazz
|
|
69
69
|
)
|
|
70
70
|
)}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import { fly } from 'svelte/transition';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import { HiddenBackground
|
|
8
|
+
import { HiddenBackground } from '..';
|
|
9
9
|
import Heading from '../Heading.svelte';
|
|
10
10
|
|
|
11
11
|
export type DrawerPlacement = 'left' | 'right';
|
|
@@ -52,42 +52,40 @@
|
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
54
|
{#if currentlyOpen}
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
<HiddenBackground
|
|
56
|
+
onclose={() => {
|
|
57
|
+
if (closeOnOutsideClick) close();
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
class={twMerge(
|
|
62
|
+
clsx([
|
|
63
|
+
'bg-surface-50-950 absolute top-0 flex h-full flex-col gap-4 p-4',
|
|
64
|
+
placement === 'left' && 'left-0',
|
|
65
|
+
placement === 'right' && 'right-0',
|
|
66
|
+
clazz
|
|
67
|
+
])
|
|
68
|
+
)}
|
|
69
|
+
onclick={(e) => e.stopPropagation()}
|
|
70
|
+
in:inTransition|global
|
|
71
|
+
out:outTransition|global
|
|
72
|
+
{...rest}
|
|
60
73
|
>
|
|
61
|
-
<div
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
>
|
|
75
|
-
<div class="flex flex-row items-center justify-between gap-8">
|
|
76
|
-
{#if title}
|
|
77
|
-
<Heading class="flex grow flex-row items-center gap-4">
|
|
78
|
-
{#if typeof title === 'function'}
|
|
79
|
-
{@render title()}
|
|
80
|
-
{:else}
|
|
81
|
-
{title}
|
|
82
|
-
{/if}
|
|
83
|
-
</Heading>
|
|
84
|
-
{/if}
|
|
85
|
-
<button class="group ml-auto flex justify-end" type="button" onclick={close}>
|
|
86
|
-
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
87
|
-
</button>
|
|
88
|
-
</div>
|
|
89
|
-
{@render children()}
|
|
74
|
+
<div class="flex flex-row items-center justify-between gap-8">
|
|
75
|
+
{#if title}
|
|
76
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
77
|
+
{#if typeof title === 'function'}
|
|
78
|
+
{@render title()}
|
|
79
|
+
{:else}
|
|
80
|
+
{title}
|
|
81
|
+
{/if}
|
|
82
|
+
</Heading>
|
|
83
|
+
{/if}
|
|
84
|
+
<button class="group ml-auto flex justify-end" type="button" onclick={close}>
|
|
85
|
+
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
86
|
+
</button>
|
|
90
87
|
</div>
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
{@render children()}
|
|
89
|
+
</div>
|
|
90
|
+
</HiddenBackground>
|
|
93
91
|
{/if}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/drawer/Drawer.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAMtC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;
|
|
1
|
+
{"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/drawer/Drawer.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAMtC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAqEN,QAAA,MAAM,MAAM;;;;;MAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -1,51 +1,13 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { IvoryComponent, TransitionProps } from '../../../types';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import type { ClassValue } from 'svelte/elements';
|
|
5
|
-
import { fade } from 'svelte/transition';
|
|
6
|
-
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import { focusTrap, shortcut } from '../../../utils/actions/index';
|
|
8
|
-
|
|
9
|
-
let globalClass = $state<ClassValue>();
|
|
10
|
-
|
|
11
|
-
export function setClasses(value: ClassValue) {
|
|
12
|
-
globalClass = value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface HiddenBackgroundProps extends IvoryComponent<HTMLDivElement>, TransitionProps {
|
|
16
|
-
/** Gets called when the dialog is clicked */
|
|
17
|
-
onclose?: () => void;
|
|
18
|
-
}
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
1
|
<script lang="ts">
|
|
2
|
+
import { theme } from '../../../theme.svelte';
|
|
3
|
+
import type { DialogProps } from '../dialog';
|
|
4
|
+
import Dialog from '../dialog/Dialog.svelte';
|
|
5
|
+
|
|
22
6
|
let {
|
|
23
7
|
class: clazz,
|
|
24
|
-
|
|
25
|
-
children,
|
|
26
|
-
inTransition = (e) => fade(e, { duration: 200 }),
|
|
27
|
-
outTransition = (e) => fade(e, { duration: 100 }),
|
|
8
|
+
|
|
28
9
|
...rest
|
|
29
|
-
}:
|
|
10
|
+
}: DialogProps = $props();
|
|
30
11
|
</script>
|
|
31
12
|
|
|
32
|
-
<
|
|
33
|
-
class={twMerge(
|
|
34
|
-
clsx(
|
|
35
|
-
'bg-surface-950-50/40 pointer-events-auto absolute top-0 left-0 m-0 h-full w-full p-0',
|
|
36
|
-
globalClass,
|
|
37
|
-
clazz
|
|
38
|
-
)
|
|
39
|
-
)}
|
|
40
|
-
use:focusTrap={true}
|
|
41
|
-
{@attach shortcut({
|
|
42
|
-
code: 'Escape',
|
|
43
|
-
callback: onclose ?? (() => {})
|
|
44
|
-
})}
|
|
45
|
-
onclick={onclose}
|
|
46
|
-
in:inTransition
|
|
47
|
-
out:outTransition
|
|
48
|
-
{...rest}
|
|
49
|
-
>
|
|
50
|
-
{@render children?.()}
|
|
51
|
-
</div>
|
|
13
|
+
<Dialog {...rest} class={['bg-surface-950-50/40', theme.current.hiddenBackground?.class, clazz]} />
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export declare function setClasses(value: ClassValue): void;
|
|
4
|
-
export interface HiddenBackgroundProps extends IvoryComponent<HTMLDivElement>, TransitionProps {
|
|
5
|
-
/** Gets called when the dialog is clicked */
|
|
6
|
-
onclose?: () => void;
|
|
7
|
-
}
|
|
8
|
-
declare const HiddenBackground: import("svelte").Component<HiddenBackgroundProps, {}, "">;
|
|
1
|
+
import type { DialogProps } from '../dialog';
|
|
2
|
+
declare const HiddenBackground: import("svelte").Component<DialogProps, {}, "">;
|
|
9
3
|
type HiddenBackground = ReturnType<typeof HiddenBackground>;
|
|
10
4
|
export default HiddenBackground;
|
|
11
5
|
//# sourceMappingURL=HiddenBackground.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HiddenBackground.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/hiddenBackground/HiddenBackground.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HiddenBackground.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/hiddenBackground/HiddenBackground.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAmB7C,QAAA,MAAM,gBAAgB,iDAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
|
|
8
8
|
import { fade } from 'svelte/transition';
|
|
9
9
|
import { twMerge } from 'tailwind-merge';
|
|
10
|
-
import { Heading, HiddenBackground
|
|
10
|
+
import { Heading, HiddenBackground } from '..';
|
|
11
11
|
|
|
12
12
|
/** Props for the modal, expose if you overwrite the defaults in a custom component */
|
|
13
13
|
export type ModalProps = TransitionProps & {
|
|
@@ -83,73 +83,65 @@
|
|
|
83
83
|
A modal, comes with a title, close button and different variants per default.
|
|
84
84
|
-->
|
|
85
85
|
{#if currentlyOpen}
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
<HiddenBackground
|
|
87
|
+
onclose={() => {
|
|
88
|
+
if (closeOnOutsideClick) close();
|
|
89
|
+
}}
|
|
90
|
+
class="flex h-full w-full flex-col items-center justify-start p-8 lg:p-12 xl:p-16"
|
|
91
|
+
>
|
|
92
|
+
{#if modal}
|
|
93
|
+
<div {...rest} {onclick}>
|
|
94
|
+
{@render modal()}
|
|
95
|
+
</div>
|
|
96
|
+
{:else}
|
|
97
|
+
<div
|
|
98
|
+
class={twMerge(
|
|
99
|
+
clsx([
|
|
100
|
+
'bg-surface-50-950 relative flex max-h-full max-w-full flex-col overflow-hidden rounded',
|
|
101
|
+
theme.current.modal?.class,
|
|
102
|
+
clazz
|
|
103
|
+
])
|
|
104
|
+
)}
|
|
105
|
+
{...rest}
|
|
106
|
+
{onclick}
|
|
107
|
+
in:inTransition|global
|
|
108
|
+
out:outTransition|global
|
|
109
|
+
>
|
|
110
|
+
<div
|
|
111
|
+
class={[
|
|
112
|
+
'flex flex-row items-center justify-between gap-4 px-4 py-3',
|
|
113
|
+
!variant && 'pb-0',
|
|
114
|
+
variant === 'success' && 'preset-tonal-success',
|
|
115
|
+
variant === 'warning' && 'preset-tonal-warning',
|
|
116
|
+
variant === 'error' && 'preset-tonal-error',
|
|
117
|
+
variant === 'info' && 'preset-tonal-primary'
|
|
118
|
+
]}
|
|
119
|
+
>
|
|
120
|
+
{#if title}
|
|
121
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
122
|
+
{#if typeof title === 'function'}
|
|
123
|
+
{@render title()}
|
|
124
|
+
{:else}
|
|
125
|
+
{title}
|
|
126
|
+
{/if}
|
|
127
|
+
</Heading>
|
|
128
|
+
{/if}
|
|
129
|
+
<button class="group ml-auto flex justify-end" type="button" onclick={close}>
|
|
130
|
+
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
131
|
+
</button>
|
|
96
132
|
</div>
|
|
97
|
-
{:else}
|
|
98
133
|
<div
|
|
99
134
|
class={twMerge(
|
|
100
|
-
clsx(
|
|
101
|
-
'
|
|
102
|
-
theme.current.modal?.
|
|
103
|
-
|
|
104
|
-
|
|
135
|
+
clsx(
|
|
136
|
+
'flex grow flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
|
|
137
|
+
theme.current.modal?.innerClass,
|
|
138
|
+
innerClass
|
|
139
|
+
)
|
|
105
140
|
)}
|
|
106
|
-
{...rest}
|
|
107
|
-
{onclick}
|
|
108
|
-
in:inTransition|global
|
|
109
|
-
out:outTransition|global
|
|
110
141
|
>
|
|
111
|
-
|
|
112
|
-
class={[
|
|
113
|
-
'flex flex-row items-center justify-between gap-4 px-4 py-3',
|
|
114
|
-
!variant && 'pb-0',
|
|
115
|
-
variant === 'success' && 'preset-tonal-success',
|
|
116
|
-
variant === 'warning' && 'preset-tonal-warning',
|
|
117
|
-
variant === 'error' && 'preset-tonal-error',
|
|
118
|
-
variant === 'info' && 'preset-tonal-primary'
|
|
119
|
-
]}
|
|
120
|
-
>
|
|
121
|
-
{#if title}
|
|
122
|
-
<Heading class="flex grow flex-row items-center gap-4">
|
|
123
|
-
{#if typeof title === 'function'}
|
|
124
|
-
{@render title()}
|
|
125
|
-
{:else}
|
|
126
|
-
{title}
|
|
127
|
-
{/if}
|
|
128
|
-
</Heading>
|
|
129
|
-
{/if}
|
|
130
|
-
<button
|
|
131
|
-
class="group ml-auto flex justify-end"
|
|
132
|
-
type="button"
|
|
133
|
-
onclick={close}
|
|
134
|
-
>
|
|
135
|
-
<X
|
|
136
|
-
class="h-full w-auto transition-[stroke-width] group-hover:stroke-3"
|
|
137
|
-
/>
|
|
138
|
-
</button>
|
|
139
|
-
</div>
|
|
140
|
-
<div
|
|
141
|
-
class={twMerge(
|
|
142
|
-
clsx(
|
|
143
|
-
'flex grow flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
|
|
144
|
-
theme.current.modal?.innerClass,
|
|
145
|
-
innerClass
|
|
146
|
-
)
|
|
147
|
-
)}
|
|
148
|
-
>
|
|
149
|
-
{@render children?.()}
|
|
150
|
-
</div>
|
|
142
|
+
{@render children?.()}
|
|
151
143
|
</div>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</
|
|
144
|
+
</div>
|
|
145
|
+
{/if}
|
|
146
|
+
</HiddenBackground>
|
|
155
147
|
{/if}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/modal/Modal.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKrE,sFAAsF;AACtF,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG;IACvC,iEAAiE;IACjE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;SAIK;IACL,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,0DAA0D;IAC1D,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpE,UAAU,KAAM,SAAQ,UAAU;IAC9B,sGAAsG;IACtG,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"Modal.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/modal/Modal.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKrE,sFAAsF;AACtF,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG;IACvC,iEAAiE;IACjE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;SAIK;IACL,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,0DAA0D;IAC1D,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpE,UAAU,KAAM,SAAQ,UAAU;IAC9B,sGAAsG;IACtG,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAoGL,oFAAoF;AACpF,QAAA,MAAM,KAAK;;;;;MAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
import clsx from 'clsx';
|
|
14
14
|
import { twMerge } from 'tailwind-merge';
|
|
15
15
|
import { clickOutside } from '../../../utils/actions/clickOutside';
|
|
16
|
-
import Portal from '../portal/Portal.svelte';
|
|
17
16
|
|
|
18
17
|
/** Possible placements for the popover */
|
|
19
18
|
export type PopoverPlacement = ComputePositionConfig['placement'];
|
|
@@ -43,6 +42,8 @@
|
|
|
43
42
|
</script>
|
|
44
43
|
|
|
45
44
|
<script lang="ts">
|
|
45
|
+
import { Dialog } from '../dialog';
|
|
46
|
+
|
|
46
47
|
let {
|
|
47
48
|
class: clazz,
|
|
48
49
|
style: externalStyle,
|
|
@@ -102,7 +103,7 @@
|
|
|
102
103
|
A popover, positions itself relative to a target element.
|
|
103
104
|
-->
|
|
104
105
|
{#if currentlyOpen || keepMounted}
|
|
105
|
-
<
|
|
106
|
+
<Dialog>
|
|
106
107
|
<div
|
|
107
108
|
class={twMerge(
|
|
108
109
|
clsx(
|
|
@@ -119,5 +120,5 @@
|
|
|
119
120
|
>
|
|
120
121
|
{@render children?.()}
|
|
121
122
|
</div>
|
|
122
|
-
</
|
|
123
|
+
</Dialog>
|
|
123
124
|
{/if}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/popover/Popover.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAMH,KAAK,qBAAqB,EAC7B,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Popover.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/popover/Popover.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAMH,KAAK,qBAAqB,EAC7B,MAAM,kBAAkB,CAAC;AAK1B,0CAA0C;AAC1C,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;AAElE,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,cAAc,CAAC;IAChE,6DAA6D;IAC7D,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACzC,8FAA8F;IAC9F,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAkFL,gEAAgE;AAChE,QAAA,MAAM,OAAO;;;;;MAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -37,8 +37,21 @@
|
|
|
37
37
|
let viewport = $state<HTMLElement>();
|
|
38
38
|
let viewport_height = $state(0);
|
|
39
39
|
|
|
40
|
-
export function scrollTo(top?: number, left?: number) {
|
|
41
|
-
|
|
40
|
+
export async function scrollTo(top?: number, left?: number) {
|
|
41
|
+
if (!viewport) {
|
|
42
|
+
viewportReactivity++;
|
|
43
|
+
await tick();
|
|
44
|
+
if (!viewport) return;
|
|
45
|
+
}
|
|
46
|
+
if (top !== undefined) {
|
|
47
|
+
scroll_top = top;
|
|
48
|
+
viewport.scrollTop = top;
|
|
49
|
+
b_scrollTop = top;
|
|
50
|
+
}
|
|
51
|
+
if (left !== undefined) {
|
|
52
|
+
scroll_left = left;
|
|
53
|
+
viewport.scrollLeft = left;
|
|
54
|
+
}
|
|
42
55
|
}
|
|
43
56
|
|
|
44
57
|
const start = $derived(Math.max(0, Math.floor(scroll_top / rowHeight) - overscan));
|
|
@@ -56,26 +69,16 @@
|
|
|
56
69
|
const top = $derived(start * rowHeight);
|
|
57
70
|
const bottom = $derived((data.length - end) * rowHeight);
|
|
58
71
|
|
|
59
|
-
async function onscroll(
|
|
72
|
+
async function onscroll() {
|
|
60
73
|
if (!viewport) {
|
|
61
74
|
viewportReactivity++;
|
|
62
75
|
await tick();
|
|
63
|
-
|
|
76
|
+
onscroll();
|
|
64
77
|
return;
|
|
65
78
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
} else {
|
|
70
|
-
scroll_top = viewport.scrollTop;
|
|
71
|
-
b_scrollTop = scroll_top;
|
|
72
|
-
}
|
|
73
|
-
if (typeof left !== 'undefined') {
|
|
74
|
-
scroll_left = left;
|
|
75
|
-
viewport.scrollLeft = left;
|
|
76
|
-
} else {
|
|
77
|
-
scroll_left = viewport.scrollLeft;
|
|
78
|
-
}
|
|
79
|
+
scroll_top = viewport.scrollTop;
|
|
80
|
+
scroll_left = viewport.scrollLeft;
|
|
81
|
+
b_scrollTop = scroll_top;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
// update the scrolltop when the prop value changes
|
|
@@ -114,23 +117,20 @@
|
|
|
114
117
|
class="flex min-w-full! grow overflow-auto [scrollbar-gutter:stable]"
|
|
115
118
|
bind:this={viewport}
|
|
116
119
|
bind:offsetHeight={viewport_height}
|
|
117
|
-
|
|
120
|
+
{onscroll}
|
|
118
121
|
>
|
|
119
122
|
<div
|
|
120
123
|
class="flex h-fit shrink-0 flex-col"
|
|
121
124
|
style="padding-top: {top}px; padding-bottom: {bottom}px; min-width: max(100%, {header_width}px) !important;"
|
|
122
125
|
>
|
|
123
126
|
{#each visible as row, i (row.data.id)}
|
|
124
|
-
<
|
|
125
|
-
class={finalRowClass}
|
|
126
|
-
style="height: {rowHeight}px !important;"
|
|
127
|
-
>
|
|
127
|
+
<div class={finalRowClass} style="height: {rowHeight}px !important;">
|
|
128
128
|
{@render children({
|
|
129
129
|
row: row.data,
|
|
130
130
|
domIndex: i,
|
|
131
131
|
index: row.index
|
|
132
132
|
})}
|
|
133
|
-
</
|
|
133
|
+
</div>
|
|
134
134
|
{/each}
|
|
135
135
|
</div>
|
|
136
136
|
</div>
|
|
@@ -19,7 +19,7 @@ declare function $$render<T extends {
|
|
|
19
19
|
}>(): {
|
|
20
20
|
props: Props<T>;
|
|
21
21
|
exports: {
|
|
22
|
-
scrollTo: (top?: number, left?: number) => void
|
|
22
|
+
scrollTo: (top?: number, left?: number) => Promise<void>;
|
|
23
23
|
};
|
|
24
24
|
bindings: "b_scrollTop";
|
|
25
25
|
slots: {};
|
|
@@ -33,7 +33,7 @@ declare class __sveltets_Render<T extends {
|
|
|
33
33
|
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
34
34
|
bindings(): "b_scrollTop";
|
|
35
35
|
exports(): {
|
|
36
|
-
scrollTo: (top?: number, left?: number) => void
|
|
36
|
+
scrollTo: (top?: number, left?: number) => Promise<void>;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
interface $$IsomorphicComponent {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualList.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/VirtualList.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI9C,KAAK,KAAK,CAAC,CAAC,IAAI;IACZ,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,QAAQ,EAAE,OAAO,CAAC,CAAC;QAAE,GAAG,EAAE,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAAC,iBAAS,QAAQ,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;
|
|
1
|
+
{"version":3,"file":"VirtualList.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/table/VirtualList.svelte.ts"],"names":[],"m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K,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE;YACL,KAAK,CAAC,EAAE,UAAU,CAAC;SACtB,CAAC;KACL,CAAC;IACF,KAAK,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,UAAU,CAAC;QACnB,UAAU,CAAC,EAAE,UAAU,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,UAAU,CAAC;KACtB,CAAC;CACL;AAkBD,eAAO,MAAM,KAAK;uBAZS,KAAK;aAGF,KAAK;CASD,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { FileUp } from '@lucide/svelte';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import { scale } from 'svelte/transition';
|
|
5
|
-
import { HiddenBackground
|
|
5
|
+
import { HiddenBackground } from '../layout';
|
|
6
6
|
|
|
7
7
|
export interface FullscreenDropzoneProps {
|
|
8
8
|
ondrop: (files: File[]) => void;
|
|
@@ -64,11 +64,9 @@
|
|
|
64
64
|
/>
|
|
65
65
|
|
|
66
66
|
{#if open}
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
</HiddenBackground>
|
|
71
|
-
</Portal>
|
|
67
|
+
<HiddenBackground class="flex items-center justify-center">
|
|
68
|
+
{@render children()}
|
|
69
|
+
</HiddenBackground>
|
|
72
70
|
{/if}
|
|
73
71
|
|
|
74
72
|
{#snippet defaultChildren()}
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
onclose={close}
|
|
64
64
|
class={twMerge(
|
|
65
65
|
clsx(
|
|
66
|
-
'h-full max-h-none w-screen max-w-full bg-transparent backdrop:bg-
|
|
67
|
-
theme.current.
|
|
66
|
+
'h-full max-h-none w-screen max-w-full bg-transparent backdrop:bg-transparent',
|
|
67
|
+
theme.current.dialog?.class,
|
|
68
68
|
clazz
|
|
69
69
|
)
|
|
70
70
|
)}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type { Snippet } from 'svelte';
|
|
6
6
|
import { fly } from 'svelte/transition';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import { HiddenBackground
|
|
8
|
+
import { HiddenBackground } from '..';
|
|
9
9
|
import Heading from '../Heading.svelte';
|
|
10
10
|
|
|
11
11
|
export type DrawerPlacement = 'left' | 'right';
|
|
@@ -52,42 +52,40 @@
|
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
54
|
{#if currentlyOpen}
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
<HiddenBackground
|
|
56
|
+
onclose={() => {
|
|
57
|
+
if (closeOnOutsideClick) close();
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
class={twMerge(
|
|
62
|
+
clsx([
|
|
63
|
+
'bg-surface-50-950 absolute top-0 flex h-full flex-col gap-4 p-4',
|
|
64
|
+
placement === 'left' && 'left-0',
|
|
65
|
+
placement === 'right' && 'right-0',
|
|
66
|
+
clazz
|
|
67
|
+
])
|
|
68
|
+
)}
|
|
69
|
+
onclick={(e) => e.stopPropagation()}
|
|
70
|
+
in:inTransition|global
|
|
71
|
+
out:outTransition|global
|
|
72
|
+
{...rest}
|
|
60
73
|
>
|
|
61
|
-
<div
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
>
|
|
75
|
-
<div class="flex flex-row items-center justify-between gap-8">
|
|
76
|
-
{#if title}
|
|
77
|
-
<Heading class="flex grow flex-row items-center gap-4">
|
|
78
|
-
{#if typeof title === 'function'}
|
|
79
|
-
{@render title()}
|
|
80
|
-
{:else}
|
|
81
|
-
{title}
|
|
82
|
-
{/if}
|
|
83
|
-
</Heading>
|
|
84
|
-
{/if}
|
|
85
|
-
<button class="group ml-auto flex justify-end" type="button" onclick={close}>
|
|
86
|
-
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
87
|
-
</button>
|
|
88
|
-
</div>
|
|
89
|
-
{@render children()}
|
|
74
|
+
<div class="flex flex-row items-center justify-between gap-8">
|
|
75
|
+
{#if title}
|
|
76
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
77
|
+
{#if typeof title === 'function'}
|
|
78
|
+
{@render title()}
|
|
79
|
+
{:else}
|
|
80
|
+
{title}
|
|
81
|
+
{/if}
|
|
82
|
+
</Heading>
|
|
83
|
+
{/if}
|
|
84
|
+
<button class="group ml-auto flex justify-end" type="button" onclick={close}>
|
|
85
|
+
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
86
|
+
</button>
|
|
90
87
|
</div>
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
{@render children()}
|
|
89
|
+
</div>
|
|
90
|
+
</HiddenBackground>
|
|
93
91
|
{/if}
|
|
@@ -1,51 +1,13 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { IvoryComponent, TransitionProps } from '$lib/types';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import type { ClassValue } from 'svelte/elements';
|
|
5
|
-
import { fade } from 'svelte/transition';
|
|
6
|
-
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import { focusTrap, shortcut } from '../../../utils/actions/index';
|
|
8
|
-
|
|
9
|
-
let globalClass = $state<ClassValue>();
|
|
10
|
-
|
|
11
|
-
export function setClasses(value: ClassValue) {
|
|
12
|
-
globalClass = value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface HiddenBackgroundProps extends IvoryComponent<HTMLDivElement>, TransitionProps {
|
|
16
|
-
/** Gets called when the dialog is clicked */
|
|
17
|
-
onclose?: () => void;
|
|
18
|
-
}
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
1
|
<script lang="ts">
|
|
2
|
+
import { theme } from '$lib/theme.svelte';
|
|
3
|
+
import type { DialogProps } from '../dialog';
|
|
4
|
+
import Dialog from '../dialog/Dialog.svelte';
|
|
5
|
+
|
|
22
6
|
let {
|
|
23
7
|
class: clazz,
|
|
24
|
-
|
|
25
|
-
children,
|
|
26
|
-
inTransition = (e) => fade(e, { duration: 200 }),
|
|
27
|
-
outTransition = (e) => fade(e, { duration: 100 }),
|
|
8
|
+
|
|
28
9
|
...rest
|
|
29
|
-
}:
|
|
10
|
+
}: DialogProps = $props();
|
|
30
11
|
</script>
|
|
31
12
|
|
|
32
|
-
<
|
|
33
|
-
class={twMerge(
|
|
34
|
-
clsx(
|
|
35
|
-
'bg-surface-950-50/40 pointer-events-auto absolute top-0 left-0 m-0 h-full w-full p-0',
|
|
36
|
-
globalClass,
|
|
37
|
-
clazz
|
|
38
|
-
)
|
|
39
|
-
)}
|
|
40
|
-
use:focusTrap={true}
|
|
41
|
-
{@attach shortcut({
|
|
42
|
-
code: 'Escape',
|
|
43
|
-
callback: onclose ?? (() => {})
|
|
44
|
-
})}
|
|
45
|
-
onclick={onclose}
|
|
46
|
-
in:inTransition
|
|
47
|
-
out:outTransition
|
|
48
|
-
{...rest}
|
|
49
|
-
>
|
|
50
|
-
{@render children?.()}
|
|
51
|
-
</div>
|
|
13
|
+
<Dialog {...rest} class={['bg-surface-950-50/40', theme.current.hiddenBackground?.class, clazz]} />
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
|
|
8
8
|
import { fade } from 'svelte/transition';
|
|
9
9
|
import { twMerge } from 'tailwind-merge';
|
|
10
|
-
import { Heading, HiddenBackground
|
|
10
|
+
import { Heading, HiddenBackground } from '..';
|
|
11
11
|
|
|
12
12
|
/** Props for the modal, expose if you overwrite the defaults in a custom component */
|
|
13
13
|
export type ModalProps = TransitionProps & {
|
|
@@ -83,73 +83,65 @@
|
|
|
83
83
|
A modal, comes with a title, close button and different variants per default.
|
|
84
84
|
-->
|
|
85
85
|
{#if currentlyOpen}
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
<HiddenBackground
|
|
87
|
+
onclose={() => {
|
|
88
|
+
if (closeOnOutsideClick) close();
|
|
89
|
+
}}
|
|
90
|
+
class="flex h-full w-full flex-col items-center justify-start p-8 lg:p-12 xl:p-16"
|
|
91
|
+
>
|
|
92
|
+
{#if modal}
|
|
93
|
+
<div {...rest} {onclick}>
|
|
94
|
+
{@render modal()}
|
|
95
|
+
</div>
|
|
96
|
+
{:else}
|
|
97
|
+
<div
|
|
98
|
+
class={twMerge(
|
|
99
|
+
clsx([
|
|
100
|
+
'bg-surface-50-950 relative flex max-h-full max-w-full flex-col overflow-hidden rounded',
|
|
101
|
+
theme.current.modal?.class,
|
|
102
|
+
clazz
|
|
103
|
+
])
|
|
104
|
+
)}
|
|
105
|
+
{...rest}
|
|
106
|
+
{onclick}
|
|
107
|
+
in:inTransition|global
|
|
108
|
+
out:outTransition|global
|
|
109
|
+
>
|
|
110
|
+
<div
|
|
111
|
+
class={[
|
|
112
|
+
'flex flex-row items-center justify-between gap-4 px-4 py-3',
|
|
113
|
+
!variant && 'pb-0',
|
|
114
|
+
variant === 'success' && 'preset-tonal-success',
|
|
115
|
+
variant === 'warning' && 'preset-tonal-warning',
|
|
116
|
+
variant === 'error' && 'preset-tonal-error',
|
|
117
|
+
variant === 'info' && 'preset-tonal-primary'
|
|
118
|
+
]}
|
|
119
|
+
>
|
|
120
|
+
{#if title}
|
|
121
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
122
|
+
{#if typeof title === 'function'}
|
|
123
|
+
{@render title()}
|
|
124
|
+
{:else}
|
|
125
|
+
{title}
|
|
126
|
+
{/if}
|
|
127
|
+
</Heading>
|
|
128
|
+
{/if}
|
|
129
|
+
<button class="group ml-auto flex justify-end" type="button" onclick={close}>
|
|
130
|
+
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
131
|
+
</button>
|
|
96
132
|
</div>
|
|
97
|
-
{:else}
|
|
98
133
|
<div
|
|
99
134
|
class={twMerge(
|
|
100
|
-
clsx(
|
|
101
|
-
'
|
|
102
|
-
theme.current.modal?.
|
|
103
|
-
|
|
104
|
-
|
|
135
|
+
clsx(
|
|
136
|
+
'flex grow flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
|
|
137
|
+
theme.current.modal?.innerClass,
|
|
138
|
+
innerClass
|
|
139
|
+
)
|
|
105
140
|
)}
|
|
106
|
-
{...rest}
|
|
107
|
-
{onclick}
|
|
108
|
-
in:inTransition|global
|
|
109
|
-
out:outTransition|global
|
|
110
141
|
>
|
|
111
|
-
|
|
112
|
-
class={[
|
|
113
|
-
'flex flex-row items-center justify-between gap-4 px-4 py-3',
|
|
114
|
-
!variant && 'pb-0',
|
|
115
|
-
variant === 'success' && 'preset-tonal-success',
|
|
116
|
-
variant === 'warning' && 'preset-tonal-warning',
|
|
117
|
-
variant === 'error' && 'preset-tonal-error',
|
|
118
|
-
variant === 'info' && 'preset-tonal-primary'
|
|
119
|
-
]}
|
|
120
|
-
>
|
|
121
|
-
{#if title}
|
|
122
|
-
<Heading class="flex grow flex-row items-center gap-4">
|
|
123
|
-
{#if typeof title === 'function'}
|
|
124
|
-
{@render title()}
|
|
125
|
-
{:else}
|
|
126
|
-
{title}
|
|
127
|
-
{/if}
|
|
128
|
-
</Heading>
|
|
129
|
-
{/if}
|
|
130
|
-
<button
|
|
131
|
-
class="group ml-auto flex justify-end"
|
|
132
|
-
type="button"
|
|
133
|
-
onclick={close}
|
|
134
|
-
>
|
|
135
|
-
<X
|
|
136
|
-
class="h-full w-auto transition-[stroke-width] group-hover:stroke-3"
|
|
137
|
-
/>
|
|
138
|
-
</button>
|
|
139
|
-
</div>
|
|
140
|
-
<div
|
|
141
|
-
class={twMerge(
|
|
142
|
-
clsx(
|
|
143
|
-
'flex grow flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
|
|
144
|
-
theme.current.modal?.innerClass,
|
|
145
|
-
innerClass
|
|
146
|
-
)
|
|
147
|
-
)}
|
|
148
|
-
>
|
|
149
|
-
{@render children?.()}
|
|
150
|
-
</div>
|
|
142
|
+
{@render children?.()}
|
|
151
143
|
</div>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</
|
|
144
|
+
</div>
|
|
145
|
+
{/if}
|
|
146
|
+
</HiddenBackground>
|
|
155
147
|
{/if}
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
import clsx from 'clsx';
|
|
14
14
|
import { twMerge } from 'tailwind-merge';
|
|
15
15
|
import { clickOutside } from '../../../utils/actions/clickOutside';
|
|
16
|
-
import Portal from '../portal/Portal.svelte';
|
|
17
16
|
|
|
18
17
|
/** Possible placements for the popover */
|
|
19
18
|
export type PopoverPlacement = ComputePositionConfig['placement'];
|
|
@@ -43,6 +42,8 @@
|
|
|
43
42
|
</script>
|
|
44
43
|
|
|
45
44
|
<script lang="ts">
|
|
45
|
+
import { Dialog } from '../dialog';
|
|
46
|
+
|
|
46
47
|
let {
|
|
47
48
|
class: clazz,
|
|
48
49
|
style: externalStyle,
|
|
@@ -102,7 +103,7 @@
|
|
|
102
103
|
A popover, positions itself relative to a target element.
|
|
103
104
|
-->
|
|
104
105
|
{#if currentlyOpen || keepMounted}
|
|
105
|
-
<
|
|
106
|
+
<Dialog>
|
|
106
107
|
<div
|
|
107
108
|
class={twMerge(
|
|
108
109
|
clsx(
|
|
@@ -119,5 +120,5 @@
|
|
|
119
120
|
>
|
|
120
121
|
{@render children?.()}
|
|
121
122
|
</div>
|
|
122
|
-
</
|
|
123
|
+
</Dialog>
|
|
123
124
|
{/if}
|
|
@@ -37,8 +37,21 @@
|
|
|
37
37
|
let viewport = $state<HTMLElement>();
|
|
38
38
|
let viewport_height = $state(0);
|
|
39
39
|
|
|
40
|
-
export function scrollTo(top?: number, left?: number) {
|
|
41
|
-
|
|
40
|
+
export async function scrollTo(top?: number, left?: number) {
|
|
41
|
+
if (!viewport) {
|
|
42
|
+
viewportReactivity++;
|
|
43
|
+
await tick();
|
|
44
|
+
if (!viewport) return;
|
|
45
|
+
}
|
|
46
|
+
if (top !== undefined) {
|
|
47
|
+
scroll_top = top;
|
|
48
|
+
viewport.scrollTop = top;
|
|
49
|
+
b_scrollTop = top;
|
|
50
|
+
}
|
|
51
|
+
if (left !== undefined) {
|
|
52
|
+
scroll_left = left;
|
|
53
|
+
viewport.scrollLeft = left;
|
|
54
|
+
}
|
|
42
55
|
}
|
|
43
56
|
|
|
44
57
|
const start = $derived(Math.max(0, Math.floor(scroll_top / rowHeight) - overscan));
|
|
@@ -56,26 +69,16 @@
|
|
|
56
69
|
const top = $derived(start * rowHeight);
|
|
57
70
|
const bottom = $derived((data.length - end) * rowHeight);
|
|
58
71
|
|
|
59
|
-
async function onscroll(
|
|
72
|
+
async function onscroll() {
|
|
60
73
|
if (!viewport) {
|
|
61
74
|
viewportReactivity++;
|
|
62
75
|
await tick();
|
|
63
|
-
|
|
76
|
+
onscroll();
|
|
64
77
|
return;
|
|
65
78
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
} else {
|
|
70
|
-
scroll_top = viewport.scrollTop;
|
|
71
|
-
b_scrollTop = scroll_top;
|
|
72
|
-
}
|
|
73
|
-
if (typeof left !== 'undefined') {
|
|
74
|
-
scroll_left = left;
|
|
75
|
-
viewport.scrollLeft = left;
|
|
76
|
-
} else {
|
|
77
|
-
scroll_left = viewport.scrollLeft;
|
|
78
|
-
}
|
|
79
|
+
scroll_top = viewport.scrollTop;
|
|
80
|
+
scroll_left = viewport.scrollLeft;
|
|
81
|
+
b_scrollTop = scroll_top;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
// update the scrolltop when the prop value changes
|
|
@@ -114,23 +117,20 @@
|
|
|
114
117
|
class="flex min-w-full! grow overflow-auto [scrollbar-gutter:stable]"
|
|
115
118
|
bind:this={viewport}
|
|
116
119
|
bind:offsetHeight={viewport_height}
|
|
117
|
-
|
|
120
|
+
{onscroll}
|
|
118
121
|
>
|
|
119
122
|
<div
|
|
120
123
|
class="flex h-fit shrink-0 flex-col"
|
|
121
124
|
style="padding-top: {top}px; padding-bottom: {bottom}px; min-width: max(100%, {header_width}px) !important;"
|
|
122
125
|
>
|
|
123
126
|
{#each visible as row, i (row.data.id)}
|
|
124
|
-
<
|
|
125
|
-
class={finalRowClass}
|
|
126
|
-
style="height: {rowHeight}px !important;"
|
|
127
|
-
>
|
|
127
|
+
<div class={finalRowClass} style="height: {rowHeight}px !important;">
|
|
128
128
|
{@render children({
|
|
129
129
|
row: row.data,
|
|
130
130
|
domIndex: i,
|
|
131
131
|
index: row.index
|
|
132
132
|
})}
|
|
133
|
-
</
|
|
133
|
+
</div>
|
|
134
134
|
{/each}
|
|
135
135
|
</div>
|
|
136
136
|
</div>
|