@ims360/svelte-ivory 0.4.11 → 0.4.13
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/basic/toggle/Toggle.svelte +1 -1
- package/dist/components/inputs/ColorInput.svelte +1 -3
- package/dist/components/inputs/Input.svelte +3 -3
- package/dist/components/layout/dialog/Dialog.svelte +46 -31
- package/dist/components/layout/dialog/Dialog.svelte.d.ts +5 -1
- package/dist/components/layout/dialog/Dialog.svelte.d.ts.map +1 -1
- package/dist/components/layout/drawer/Drawer.svelte +68 -59
- package/dist/components/layout/drawer/Drawer.svelte.d.ts +4 -5
- package/dist/components/layout/drawer/Drawer.svelte.d.ts.map +1 -1
- package/dist/components/layout/modal/Modal.svelte +83 -83
- package/dist/components/layout/modal/Modal.svelte.d.ts +4 -5
- package/dist/components/layout/modal/Modal.svelte.d.ts.map +1 -1
- package/dist/components/layout/popover/Popover.svelte +2 -4
- package/dist/components/layout/popover/Popover.svelte.d.ts.map +1 -1
- package/dist/components/table/Column.svelte +2 -2
- package/dist/components/table/Table.svelte +2 -2
- package/dist/components/table/VirtualList.svelte +2 -2
- package/dist/theme.svelte.d.ts +3 -0
- package/dist/theme.svelte.d.ts.map +1 -1
- package/dist/types.d.ts +0 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/components/basic/toggle/Toggle.svelte +1 -1
- package/src/lib/components/inputs/ColorInput.svelte +1 -3
- package/src/lib/components/inputs/Input.svelte +3 -3
- package/src/lib/components/layout/dialog/Dialog.svelte +46 -31
- package/src/lib/components/layout/drawer/Drawer.svelte +68 -59
- package/src/lib/components/layout/modal/Modal.svelte +83 -83
- package/src/lib/components/layout/popover/Popover.svelte +2 -4
- package/src/lib/components/table/Column.svelte +2 -2
- package/src/lib/components/table/Table.svelte +2 -2
- package/src/lib/components/table/VirtualList.svelte +2 -2
- package/src/lib/theme.svelte.ts +3 -0
- package/src/lib/types.ts +0 -6
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<svelte:element
|
|
19
19
|
this={rest.onclick ? 'button' : 'div'}
|
|
20
20
|
class={merge(
|
|
21
|
-
'group relative flex h-5 w-9 flex-row items-center rounded-full p-0.5 transition-colors
|
|
21
|
+
'group relative flex h-5 w-9 flex-row items-center rounded-full p-0.5 transition-colors ',
|
|
22
22
|
value ? 'bg-primary-500' : 'bg-surface-300-700',
|
|
23
23
|
clazz
|
|
24
24
|
)}
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<Input {...props}>
|
|
9
9
|
{#snippet children({ id, class: inputClass })}
|
|
10
|
-
<div
|
|
11
|
-
class={merge([inputClass, 'flex grow flex-row items-center justify-between gap-4 p-0'])}
|
|
12
|
-
>
|
|
10
|
+
<div class={merge(inputClass, 'flex grow flex-row items-center justify-between gap-4 p-0')}>
|
|
13
11
|
<input
|
|
14
12
|
type="text"
|
|
15
13
|
bind:value={props.form.value, props.form.set}
|
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
'group flex h-full grow flex-col overflow-hidden rounded border-2',
|
|
66
66
|
hasIssues
|
|
67
67
|
? 'bg-error-500/20 border-error-500'
|
|
68
|
-
: 'focus-within:border-primary-500 focus-within:hover:border-primary-500 border-surface-300-700/25 hover:border-surface-300-700/50 transition-[border-color]
|
|
68
|
+
: 'focus-within:border-primary-500 focus-within:hover:border-primary-500 border-surface-300-700/25 hover:border-surface-300-700/50 transition-[border-color]',
|
|
69
69
|
theme.current.input?.class?.(hasValue, hasIssues)
|
|
70
70
|
)}
|
|
71
71
|
>
|
|
72
72
|
{@render children({ class: inputClass, id, ...inputProps })}
|
|
73
73
|
{#if label}
|
|
74
74
|
<label
|
|
75
|
-
class={merge(
|
|
75
|
+
class={merge(
|
|
76
76
|
'pointer-events-none absolute cursor-text px-1 transition-all select-none group-focus-within:top-0 group-focus-within:left-0 group-focus-within:text-sm focus:cursor-default',
|
|
77
77
|
hasValue ? 'top-0 left-0 cursor-default text-sm' : 'top-10 left-3',
|
|
78
78
|
hasIssues ? 'text-error-500' : 'text-surface-700-300',
|
|
79
79
|
theme.current.input?.label?.class?.(hasValue, hasIssues)
|
|
80
|
-
|
|
80
|
+
)}
|
|
81
81
|
for={id}
|
|
82
82
|
>
|
|
83
83
|
{label}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { theme } from '../../../theme.svelte';
|
|
3
3
|
import type { IvoryComponent } from '../../../types';
|
|
4
4
|
import { merge } from '../../../utils/functions';
|
|
5
|
-
import { onMount, tick } from 'svelte';
|
|
6
5
|
import type { MouseEventHandler } from 'svelte/elements';
|
|
7
6
|
|
|
8
7
|
export interface DialogProps extends IvoryComponent<HTMLElement> {
|
|
@@ -14,49 +13,43 @@
|
|
|
14
13
|
<script lang="ts">
|
|
15
14
|
let {
|
|
16
15
|
class: clazz,
|
|
17
|
-
onclose:
|
|
16
|
+
onclose: onclose, // This is the prop from the parent
|
|
18
17
|
children,
|
|
19
18
|
...rest
|
|
20
19
|
}: DialogProps = $props();
|
|
21
20
|
|
|
22
21
|
let dialog = $state<HTMLDialogElement>();
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
async function requestClose(event: Event) {
|
|
29
|
-
event.preventDefault(); // Stop the native close
|
|
30
|
-
event.stopPropagation();
|
|
31
|
-
close?.(); // Ask the parent to close
|
|
32
|
-
await tick();
|
|
33
|
-
await tick();
|
|
23
|
+
let currentlyOpen = $state(false);
|
|
24
|
+
|
|
25
|
+
export const open = () => {
|
|
34
26
|
dialog?.showModal();
|
|
35
|
-
|
|
27
|
+
currentlyOpen = true;
|
|
28
|
+
};
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
dialog.close();
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
});
|
|
30
|
+
export const isOpen = () => currentlyOpen;
|
|
31
|
+
|
|
32
|
+
export const close = () => {
|
|
33
|
+
dialog?.close();
|
|
34
|
+
currentlyOpen = false;
|
|
35
|
+
};
|
|
47
36
|
|
|
48
37
|
const handleBackdropClick: MouseEventHandler<HTMLElement> = (event) => {
|
|
49
|
-
if (event.target
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
if (event.target !== dialog) return;
|
|
39
|
+
onclose?.();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const handleClose = () => {
|
|
43
|
+
onclose?.();
|
|
44
|
+
currentlyOpen = false;
|
|
52
45
|
};
|
|
53
46
|
</script>
|
|
54
47
|
|
|
55
48
|
<dialog
|
|
56
49
|
bind:this={dialog}
|
|
57
50
|
onclick={handleBackdropClick}
|
|
58
|
-
oncancel={
|
|
59
|
-
onclose={
|
|
51
|
+
oncancel={handleClose}
|
|
52
|
+
onclose={handleClose}
|
|
60
53
|
class={merge(
|
|
61
54
|
'backdrop:bg-surface-800-200/30 h-full max-h-none w-screen max-w-full overflow-hidden bg-transparent',
|
|
62
55
|
theme.current.dialog?.class,
|
|
@@ -68,12 +61,34 @@
|
|
|
68
61
|
</dialog>
|
|
69
62
|
|
|
70
63
|
<style>
|
|
64
|
+
dialog {
|
|
65
|
+
transition:
|
|
66
|
+
display var(--tw-duration, var(--default-transition-duration)) allow-discrete,
|
|
67
|
+
overlay var(--tw-duration, var(--default-transition-duration)) allow-discrete;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Dialog backdrop fade-in animation */
|
|
71
71
|
dialog::backdrop {
|
|
72
|
-
|
|
72
|
+
opacity: 0;
|
|
73
|
+
transition:
|
|
74
|
+
display var(--tw-duration, var(--default-transition-duration)) allow-discrete,
|
|
75
|
+
overlay var(--tw-duration, var(--default-transition-duration)) allow-discrete,
|
|
76
|
+
opacity var(--tw-duration, var(--default-transition-duration))
|
|
77
|
+
cubic-bezier(0.16, 1, 0.3, 1);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
dialog[open]::backdrop {
|
|
81
|
+
opacity: 1;
|
|
73
82
|
}
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
|
|
84
|
+
/* Starting style for entry animation */
|
|
85
|
+
@starting-style {
|
|
86
|
+
dialog[open]::backdrop {
|
|
76
87
|
opacity: 0;
|
|
77
88
|
}
|
|
78
89
|
}
|
|
90
|
+
|
|
91
|
+
dialog:not([open]):not(:popover-open) {
|
|
92
|
+
display: none !important;
|
|
93
|
+
}
|
|
79
94
|
</style>
|
|
@@ -3,7 +3,11 @@ export interface DialogProps extends IvoryComponent<HTMLElement> {
|
|
|
3
3
|
/** Gets called when the dialog requests to close (Escape, backdrop click) */
|
|
4
4
|
onclose?: () => void;
|
|
5
5
|
}
|
|
6
|
-
declare const Dialog: import("svelte").Component<DialogProps, {
|
|
6
|
+
declare const Dialog: import("svelte").Component<DialogProps, {
|
|
7
|
+
open: () => void;
|
|
8
|
+
isOpen: () => boolean;
|
|
9
|
+
close: () => void;
|
|
10
|
+
}, "">;
|
|
7
11
|
type Dialog = ReturnType<typeof Dialog>;
|
|
8
12
|
export default Dialog;
|
|
9
13
|
//# sourceMappingURL=Dialog.svelte.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/dialog/Dialog.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/dialog/Dialog.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC5D,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAmDL,QAAA,MAAM,MAAM;;;;MAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { TransitionProps } from '../../../types';
|
|
3
2
|
import { merge } from '../../../utils/functions';
|
|
4
3
|
import { X } from '@lucide/svelte';
|
|
5
4
|
import type { Snippet } from 'svelte';
|
|
6
|
-
import { fly } from 'svelte/transition';
|
|
7
5
|
import Heading from '../Heading.svelte';
|
|
8
6
|
import { Dialog } from '../dialog';
|
|
9
7
|
|
|
10
8
|
export type DrawerPlacement = 'left' | 'right';
|
|
11
9
|
|
|
12
|
-
export type DrawerProps =
|
|
10
|
+
export type DrawerProps = {
|
|
13
11
|
class?: string;
|
|
14
12
|
title?: string | Snippet;
|
|
15
13
|
children: Snippet;
|
|
@@ -27,69 +25,80 @@
|
|
|
27
25
|
title,
|
|
28
26
|
placement = 'right',
|
|
29
27
|
closeOnOutsideClick = true,
|
|
30
|
-
inTransition = (e) =>
|
|
31
|
-
fly(e, { x: placement === 'right' ? '100%' : '-100%', duration: 200 }),
|
|
32
|
-
outTransition = (e) =>
|
|
33
|
-
fly(e, { x: placement === 'right' ? '100%' : '-100%', duration: 200 }),
|
|
34
28
|
inner,
|
|
35
29
|
...rest
|
|
36
30
|
}: DrawerProps = $props();
|
|
37
31
|
|
|
38
|
-
let
|
|
39
|
-
export function close() {
|
|
40
|
-
currentlyOpen = false;
|
|
41
|
-
}
|
|
32
|
+
let dialog = $state<Dialog>();
|
|
42
33
|
|
|
43
|
-
export
|
|
44
|
-
currentlyOpen = true;
|
|
45
|
-
}
|
|
34
|
+
export const close = () => dialog?.close();
|
|
46
35
|
|
|
47
|
-
export
|
|
48
|
-
currentlyOpen = !currentlyOpen;
|
|
49
|
-
}
|
|
36
|
+
export const open = () => dialog?.open();
|
|
50
37
|
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
export const isOpen = () => dialog?.isOpen();
|
|
39
|
+
|
|
40
|
+
export const toggle = () => {
|
|
41
|
+
if (isOpen()) close();
|
|
42
|
+
else open();
|
|
43
|
+
};
|
|
54
44
|
</script>
|
|
55
45
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
46
|
+
<Dialog
|
|
47
|
+
bind:this={dialog}
|
|
48
|
+
onclose={() => {
|
|
49
|
+
if (closeOnOutsideClick) close();
|
|
50
|
+
}}
|
|
51
|
+
class={['flex flex-row justify-start overflow-visible', placement === 'right' && 'justify-end']}
|
|
52
|
+
>
|
|
53
|
+
<div
|
|
54
|
+
data-placement={placement}
|
|
55
|
+
class={merge(
|
|
56
|
+
'drawer bg-surface-50-950 flex h-full flex-col gap-4 p-4 transition-transform ease-in-out',
|
|
57
|
+
clazz
|
|
58
|
+
)}
|
|
59
|
+
onclick={(e) => e.stopPropagation()}
|
|
60
|
+
{...rest}
|
|
66
61
|
>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
62
|
+
{#if inner}
|
|
63
|
+
{@render inner()}
|
|
64
|
+
{:else}
|
|
65
|
+
<div class="flex flex-row items-center justify-between gap-8">
|
|
66
|
+
{#if title}
|
|
67
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
68
|
+
{#if typeof title === 'function'}
|
|
69
|
+
{@render title()}
|
|
70
|
+
{:else}
|
|
71
|
+
{title}
|
|
72
|
+
{/if}
|
|
73
|
+
</Heading>
|
|
74
|
+
{/if}
|
|
75
|
+
<button class="group ml-auto flex justify-end" type="button" onclick={close}>
|
|
76
|
+
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
77
|
+
</button>
|
|
78
|
+
</div>
|
|
79
|
+
{@render children()}
|
|
80
|
+
{/if}
|
|
81
|
+
</div>
|
|
82
|
+
</Dialog>
|
|
83
|
+
|
|
84
|
+
<style>
|
|
85
|
+
.drawer[data-placement='right'] {
|
|
86
|
+
transform: translateX(100%);
|
|
87
|
+
}
|
|
88
|
+
.drawer[data-placement='left'] {
|
|
89
|
+
transform: translateX(-100%);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:global(dialog[open]) .drawer {
|
|
93
|
+
transform: translateX(0);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@starting-style {
|
|
97
|
+
:global(dialog[open]) .drawer[data-placement='right'] {
|
|
98
|
+
transform: translateX(100%);
|
|
99
|
+
}
|
|
100
|
+
:global(dialog[open]) .drawer[data-placement='left'] {
|
|
101
|
+
transform: translateX(-100%);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { TransitionProps } from '../../../types';
|
|
2
1
|
import type { Snippet } from 'svelte';
|
|
3
2
|
export type DrawerPlacement = 'left' | 'right';
|
|
4
|
-
export type DrawerProps =
|
|
3
|
+
export type DrawerProps = {
|
|
5
4
|
class?: string;
|
|
6
5
|
title?: string | Snippet;
|
|
7
6
|
children: Snippet;
|
|
@@ -11,10 +10,10 @@ export type DrawerProps = TransitionProps & {
|
|
|
11
10
|
inner?: Snippet;
|
|
12
11
|
};
|
|
13
12
|
declare const Drawer: import("svelte").Component<DrawerProps, {
|
|
14
|
-
close: () => void;
|
|
15
|
-
open: () => void;
|
|
13
|
+
close: () => void | undefined;
|
|
14
|
+
open: () => void | undefined;
|
|
15
|
+
isOpen: () => boolean | undefined;
|
|
16
16
|
toggle: () => void;
|
|
17
|
-
isOpen: () => boolean;
|
|
18
17
|
}, "">;
|
|
19
18
|
type Drawer = ReturnType<typeof Drawer>;
|
|
20
19
|
export default Drawer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/drawer/Drawer.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Drawer.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/drawer/Drawer.svelte.ts"],"names":[],"mappings":"AAKI,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAItC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG;IACtB,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;IAC9B,8CAA8C;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AA8DN,QAAA,MAAM,MAAM;;;;;MAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Variant } from '../../..';
|
|
3
3
|
import { theme } from '../../../theme.svelte';
|
|
4
|
-
import type { TransitionProps } from '../../../types';
|
|
5
4
|
import { merge } from '../../../utils/functions';
|
|
6
5
|
import { X } from '@lucide/svelte';
|
|
7
6
|
import { type Snippet } from 'svelte';
|
|
8
7
|
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
|
|
9
|
-
import { scale } from 'svelte/transition';
|
|
10
8
|
import { Heading } from '..';
|
|
11
9
|
import { Dialog } from '../dialog';
|
|
12
10
|
|
|
13
11
|
/** Props for the modal, expose if you overwrite the defaults in a custom component */
|
|
14
|
-
export type ModalProps =
|
|
12
|
+
export type ModalProps = {
|
|
15
13
|
/** Class of the modal itself, does not apply to the inner div */
|
|
16
14
|
class?: ClassValue;
|
|
17
15
|
/** Class of the div wrapping the children */
|
|
@@ -45,32 +43,21 @@
|
|
|
45
43
|
closeOnOutsideClick = true,
|
|
46
44
|
variant,
|
|
47
45
|
innerClass,
|
|
48
|
-
inTransition = (e) =>
|
|
49
|
-
scale(e, {
|
|
50
|
-
duration: 200,
|
|
51
|
-
start: 0.8
|
|
52
|
-
}),
|
|
53
|
-
outTransition = () => ({}),
|
|
54
46
|
...rest
|
|
55
47
|
}: Props = $props();
|
|
56
48
|
|
|
57
|
-
let
|
|
49
|
+
let dialog = $state<Dialog>();
|
|
58
50
|
|
|
59
|
-
export
|
|
60
|
-
currentlyOpen = false;
|
|
61
|
-
}
|
|
51
|
+
export const close = () => dialog?.close();
|
|
62
52
|
|
|
63
|
-
export
|
|
64
|
-
currentlyOpen = true;
|
|
65
|
-
}
|
|
53
|
+
export const open = () => dialog?.open();
|
|
66
54
|
|
|
67
|
-
export
|
|
68
|
-
currentlyOpen = !currentlyOpen;
|
|
69
|
-
}
|
|
55
|
+
export const isOpen = () => dialog?.isOpen();
|
|
70
56
|
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
export const toggle = () => {
|
|
58
|
+
if (isOpen()) close();
|
|
59
|
+
else open();
|
|
60
|
+
};
|
|
74
61
|
|
|
75
62
|
const onclick: MouseEventHandler<HTMLDivElement> = (e) => {
|
|
76
63
|
e.stopPropagation();
|
|
@@ -82,68 +69,81 @@
|
|
|
82
69
|
@component
|
|
83
70
|
A modal, comes with a title, close button and different variants per default.
|
|
84
71
|
-->
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
72
|
+
<Dialog
|
|
73
|
+
bind:this={dialog}
|
|
74
|
+
onclose={() => {
|
|
75
|
+
if (closeOnOutsideClick) close();
|
|
76
|
+
}}
|
|
77
|
+
class={merge('flex h-full w-full flex-col items-center justify-center p-8 lg:p-12 xl:p-16')}
|
|
78
|
+
>
|
|
79
|
+
{#if modal}
|
|
80
|
+
<div {...rest} {onclick} class="modal-content transition-all ease-in-out">
|
|
81
|
+
{@render modal()}
|
|
82
|
+
</div>
|
|
83
|
+
{:else}
|
|
84
|
+
<div
|
|
85
|
+
class={merge(
|
|
86
|
+
'modal-content bg-surface-50-950 flex max-h-full max-w-full flex-col overflow-hidden rounded transition-all ease-in-out',
|
|
87
|
+
theme.current.modal?.class,
|
|
88
|
+
clazz
|
|
89
|
+
)}
|
|
90
|
+
{...rest}
|
|
91
|
+
{onclick}
|
|
92
|
+
>
|
|
93
|
+
<div
|
|
94
|
+
class={[
|
|
95
|
+
'flex flex-row items-center justify-between gap-4 px-4 py-3',
|
|
96
|
+
!variant && 'pb-0',
|
|
97
|
+
variant === 'primary' && 'preset-tonal-primary',
|
|
98
|
+
variant === 'secondary' && 'preset-tonal-secondary',
|
|
99
|
+
variant === 'tertiary' && 'preset-tonal-tertiary',
|
|
100
|
+
variant === 'success' && 'preset-tonal-success',
|
|
101
|
+
variant === 'warning' && 'preset-tonal-warning',
|
|
102
|
+
variant === 'error' && 'preset-tonal-error',
|
|
103
|
+
variant === 'surface' && 'preset-tonal-surface'
|
|
104
|
+
]}
|
|
105
|
+
>
|
|
106
|
+
{#if title}
|
|
107
|
+
<Heading class="flex grow flex-row items-center gap-4">
|
|
108
|
+
{#if typeof title === 'function'}
|
|
109
|
+
{@render title()}
|
|
110
|
+
{:else}
|
|
111
|
+
{title}
|
|
112
|
+
{/if}
|
|
113
|
+
</Heading>
|
|
114
|
+
{/if}
|
|
115
|
+
<button class="group ml-auto flex justify-end" type="button" onclick={close}>
|
|
116
|
+
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
117
|
+
</button>
|
|
98
118
|
</div>
|
|
99
|
-
{:else}
|
|
100
119
|
<div
|
|
101
|
-
class={merge(
|
|
102
|
-
'
|
|
103
|
-
theme.current.modal?.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{...rest}
|
|
107
|
-
{onclick}
|
|
108
|
-
in:inTransition|global
|
|
109
|
-
out:outTransition|global
|
|
120
|
+
class={merge(
|
|
121
|
+
'flex grow flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
|
|
122
|
+
theme.current.modal?.innerClass,
|
|
123
|
+
innerClass
|
|
124
|
+
)}
|
|
110
125
|
>
|
|
111
|
-
|
|
112
|
-
class={[
|
|
113
|
-
'flex flex-row items-center justify-between gap-4 px-4 py-3',
|
|
114
|
-
!variant && 'pb-0',
|
|
115
|
-
variant === 'primary' && 'preset-tonal-primary',
|
|
116
|
-
variant === 'secondary' && 'preset-tonal-secondary',
|
|
117
|
-
variant === 'tertiary' && 'preset-tonal-tertiary',
|
|
118
|
-
variant === 'success' && 'preset-tonal-success',
|
|
119
|
-
variant === 'warning' && 'preset-tonal-warning',
|
|
120
|
-
variant === 'error' && 'preset-tonal-error',
|
|
121
|
-
variant === 'surface' && 'preset-tonal-surface'
|
|
122
|
-
]}
|
|
123
|
-
>
|
|
124
|
-
{#if title}
|
|
125
|
-
<Heading class="flex grow flex-row items-center gap-4">
|
|
126
|
-
{#if typeof title === 'function'}
|
|
127
|
-
{@render title()}
|
|
128
|
-
{:else}
|
|
129
|
-
{title}
|
|
130
|
-
{/if}
|
|
131
|
-
</Heading>
|
|
132
|
-
{/if}
|
|
133
|
-
<button class="group ml-auto flex justify-end" type="button" onclick={close}>
|
|
134
|
-
<X class="h-full w-auto transition-[stroke-width] group-hover:stroke-3" />
|
|
135
|
-
</button>
|
|
136
|
-
</div>
|
|
137
|
-
<div
|
|
138
|
-
class={merge(
|
|
139
|
-
'flex grow flex-col gap-4 overflow-hidden bg-inherit p-4 pt-3',
|
|
140
|
-
theme.current.modal?.innerClass,
|
|
141
|
-
innerClass
|
|
142
|
-
)}
|
|
143
|
-
>
|
|
144
|
-
{@render children?.()}
|
|
145
|
-
</div>
|
|
126
|
+
{@render children?.()}
|
|
146
127
|
</div>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
128
|
+
</div>
|
|
129
|
+
{/if}
|
|
130
|
+
</Dialog>
|
|
131
|
+
|
|
132
|
+
<style>
|
|
133
|
+
.modal-content {
|
|
134
|
+
opacity: 0;
|
|
135
|
+
transform: scale(0.97);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:global(dialog[open]) .modal-content {
|
|
139
|
+
opacity: 1;
|
|
140
|
+
transform: scale(1);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@starting-style {
|
|
144
|
+
:global(dialog[open]) .modal-content {
|
|
145
|
+
opacity: 0;
|
|
146
|
+
transform: scale(0.97);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</style>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Variant } from '../../..';
|
|
2
|
-
import type { TransitionProps } from '../../../types';
|
|
3
2
|
import { type Snippet } from 'svelte';
|
|
4
3
|
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
|
|
5
4
|
/** Props for the modal, expose if you overwrite the defaults in a custom component */
|
|
6
|
-
export type ModalProps =
|
|
5
|
+
export type ModalProps = {
|
|
7
6
|
/** Class of the modal itself, does not apply to the inner div */
|
|
8
7
|
class?: ClassValue;
|
|
9
8
|
/** Class of the div wrapping the children */
|
|
@@ -27,10 +26,10 @@ interface Props extends ModalProps {
|
|
|
27
26
|
}
|
|
28
27
|
/** A modal, comes with a title, close button and different variants per default. */
|
|
29
28
|
declare const Modal: import("svelte").Component<Props, {
|
|
30
|
-
close: () => void;
|
|
31
|
-
open: () => void;
|
|
29
|
+
close: () => void | undefined;
|
|
30
|
+
open: () => void | undefined;
|
|
31
|
+
isOpen: () => boolean | undefined;
|
|
32
32
|
toggle: () => void;
|
|
33
|
-
isOpen: () => boolean;
|
|
34
33
|
}, "">;
|
|
35
34
|
type Modal = ReturnType<typeof Modal>;
|
|
36
35
|
export default Modal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/modal/Modal.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/modal/Modal.svelte.ts"],"names":[],"mappings":"AAGI,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIrE,sFAAsF;AACtF,MAAM,MAAM,UAAU,GAAG;IACrB,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,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;CAC/C,CAAC;AAEF,UAAU,KAAM,SAAQ,UAAU;IAC9B,sGAAsG;IACtG,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAyFL,oFAAoF;AACpF,QAAA,MAAM,KAAK;;;;;MAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import { theme } from '../../../theme.svelte';
|
|
3
3
|
import type { IvoryComponent } from '../../../types';
|
|
4
|
-
import { pseudoRandomId } from '../../../utils/functions';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { merge, pseudoRandomId } from '../../../utils/functions';
|
|
7
5
|
|
|
8
6
|
/** Possible placements for the popover */
|
|
9
7
|
export type PopoverPlacement =
|
|
@@ -177,7 +175,7 @@
|
|
|
177
175
|
bind:this={popoverEl}
|
|
178
176
|
style="{style} {externalStyle}"
|
|
179
177
|
{popover}
|
|
180
|
-
class={
|
|
178
|
+
class={merge('bg-transparent not-open:hidden!', theme.current.popover?.class, clazz)}
|
|
181
179
|
{...rest}
|
|
182
180
|
>
|
|
183
181
|
{@render children?.()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/popover/Popover.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Popover.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/layout/popover/Popover.svelte.ts"],"names":[],"mappings":"AAII,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,0CAA0C;AAC1C,MAAM,MAAM,gBAAgB,GACtB,KAAK,GACL,WAAW,GACX,SAAS,GACT,OAAO,GACP,aAAa,GACb,WAAW,GACX,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,UAAU,CAAC;AAEjB,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,cAAc,CAAC;IAChE,6DAA6D;IAC7D,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAmJL,QAAA,MAAM,OAAO;;;;;MAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
onclick={finalOnClick}
|
|
74
74
|
href={finalHref}
|
|
75
75
|
style={ignoreWidth ? '' : `width: ${widthStyle}`}
|
|
76
|
-
class={merge(
|
|
76
|
+
class={merge(
|
|
77
77
|
'box-border flex h-full shrink-0 flex-row items-center justify-start gap-1 truncate',
|
|
78
78
|
column.width !== 0 && 'border-r-[calc(var(--spacing)*2)] border-transparent',
|
|
79
79
|
theme.current.table?.column?.class,
|
|
80
80
|
clazz
|
|
81
|
-
|
|
81
|
+
)}
|
|
82
82
|
/>
|
|
@@ -200,11 +200,11 @@
|
|
|
200
200
|
bind:this={list}
|
|
201
201
|
bind:b_scrollTop
|
|
202
202
|
data={results.entries}
|
|
203
|
-
class={merge(
|
|
203
|
+
class={merge(
|
|
204
204
|
'flex flex-col overflow-hidden border-transparent',
|
|
205
205
|
theme.current.table?.class,
|
|
206
206
|
clazz
|
|
207
|
-
|
|
207
|
+
)}
|
|
208
208
|
rowClass={merge('pl-2 pr-4', theme.current.table?.row?.class, rowClass)}
|
|
209
209
|
{rowHeight}
|
|
210
210
|
>
|