@pajohns/flowbite-svelte 0.1.3 → 0.1.5
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/dialog/Dialog.svelte +11 -2
- package/dist/dialog/Dialog.svelte.d.ts +1 -0
- package/dist/dialog/theme.d.ts +24 -3
- package/dist/dialog/theme.js +6 -6
- package/dist/drawer/theme.d.ts +32 -4
- package/dist/modal/Modal.svelte +9 -68
- package/dist/modal/Modal.svelte.d.ts +0 -11
- package/dist/modal/theme.d.ts +32 -4
- package/dist/types.d.ts +2 -11
- package/package.json +1 -1
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
permanent = false,
|
|
23
23
|
dismissable = true,
|
|
24
24
|
outsideclose = true,
|
|
25
|
+
animatedBackdrop = false,
|
|
25
26
|
class: className,
|
|
26
27
|
classes,
|
|
27
28
|
transition = fade,
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
|
|
32
33
|
const paramsOptions = $derived(transitionParams ?? { duration: 100, easing: sineIn });
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
const { base, form: formCls, close: closeCls, overlay: overlayCls } = $derived(dialog({ animatedBackdrop }));
|
|
35
36
|
|
|
36
37
|
const close = () => (open = false);
|
|
37
38
|
|
|
@@ -150,6 +151,13 @@
|
|
|
150
151
|
{/snippet}
|
|
151
152
|
|
|
152
153
|
{#if open}
|
|
154
|
+
{#if animatedBackdrop}
|
|
155
|
+
<div
|
|
156
|
+
class={overlayCls({ class: clsx(classes?.overlay) })}
|
|
157
|
+
transition:fade|global={paramsOptions as ParamsType}
|
|
158
|
+
aria-hidden="true"
|
|
159
|
+
></div>
|
|
160
|
+
{/if}
|
|
153
161
|
<dialog
|
|
154
162
|
{@attach init}
|
|
155
163
|
bind:this={ref}
|
|
@@ -161,7 +169,7 @@
|
|
|
161
169
|
ontoggle={_ontoggle}
|
|
162
170
|
transition:transition|global={paramsOptions as ParamsType}
|
|
163
171
|
{...restProps}
|
|
164
|
-
class={base({ class: clsx(className) })}
|
|
172
|
+
class={base({ animatedBackdrop, class: clsx(className) })}
|
|
165
173
|
>
|
|
166
174
|
{#if form}
|
|
167
175
|
<form method="dialog" class={formCls({ class: clsx(classes?.form) })}>
|
|
@@ -192,6 +200,7 @@
|
|
|
192
200
|
@prop permanent = false
|
|
193
201
|
@prop dismissable = true
|
|
194
202
|
@prop outsideclose = true
|
|
203
|
+
@prop animatedBackdrop = false
|
|
195
204
|
@prop class: className
|
|
196
205
|
@prop classes
|
|
197
206
|
@prop transition = fade
|
package/dist/dialog/theme.d.ts
CHANGED
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
import { type VariantProps } from "tailwind-variants";
|
|
2
2
|
import type { Classes } from "../theme/themeUtils";
|
|
3
3
|
export type DialogVariants = VariantProps<typeof dialog> & Classes<typeof dialog>;
|
|
4
|
-
export declare const dialog: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
export declare const dialog: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
animatedBackdrop: {
|
|
6
|
+
true: {
|
|
7
|
+
base: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
5
11
|
base: string;
|
|
6
12
|
form: string;
|
|
7
13
|
close: string;
|
|
8
|
-
|
|
14
|
+
overlay: string;
|
|
15
|
+
}, undefined, {
|
|
16
|
+
animatedBackdrop: {
|
|
17
|
+
true: {
|
|
18
|
+
base: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
9
22
|
base: string;
|
|
10
23
|
form: string;
|
|
11
24
|
close: string;
|
|
12
|
-
|
|
25
|
+
overlay: string;
|
|
26
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
27
|
+
animatedBackdrop: {
|
|
28
|
+
true: {
|
|
29
|
+
base: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}, {
|
|
13
33
|
base: string;
|
|
14
34
|
form: string;
|
|
15
35
|
close: string;
|
|
36
|
+
overlay: string;
|
|
16
37
|
}, undefined, unknown, unknown, undefined>>;
|
package/dist/dialog/theme.js
CHANGED
|
@@ -3,15 +3,15 @@ export const dialog = tv({
|
|
|
3
3
|
slots: {
|
|
4
4
|
base: "backdrop:bg-gray-900/50 open:flex flex-col bg-white dark:bg-gray-800",
|
|
5
5
|
form: "flex flex-col w-full border-inherit dark:border-inherit divide-inherit dark:divide-inherit",
|
|
6
|
-
close: "absolute top-2.5 end-2.5"
|
|
6
|
+
close: "absolute top-2.5 end-2.5",
|
|
7
|
+
overlay: "fixed inset-0 z-40 bg-gray-900/50"
|
|
7
8
|
},
|
|
8
9
|
variants: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// },
|
|
10
|
+
animatedBackdrop: {
|
|
11
|
+
true: { base: "backdrop:bg-transparent" }
|
|
12
|
+
}
|
|
13
13
|
},
|
|
14
14
|
defaultVariants: {
|
|
15
|
-
|
|
15
|
+
animatedBackdrop: false
|
|
16
16
|
}
|
|
17
17
|
});
|
package/dist/drawer/theme.d.ts
CHANGED
|
@@ -42,22 +42,50 @@ export declare const drawer: import("tailwind-variants").TVReturnType<{
|
|
|
42
42
|
};
|
|
43
43
|
}, {
|
|
44
44
|
base: string;
|
|
45
|
-
}, undefined, {
|
|
45
|
+
}, undefined, {
|
|
46
|
+
animatedBackdrop: {
|
|
47
|
+
true: {
|
|
48
|
+
base: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}, {
|
|
46
52
|
base: string;
|
|
47
53
|
form: string;
|
|
48
54
|
close: string;
|
|
49
|
-
|
|
55
|
+
overlay: string;
|
|
56
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
57
|
+
animatedBackdrop: {
|
|
58
|
+
true: {
|
|
59
|
+
base: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}, {
|
|
50
63
|
base: string;
|
|
51
64
|
form: string;
|
|
52
65
|
close: string;
|
|
53
|
-
|
|
66
|
+
overlay: string;
|
|
67
|
+
}, undefined, {
|
|
68
|
+
animatedBackdrop: {
|
|
69
|
+
true: {
|
|
70
|
+
base: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
54
74
|
base: string;
|
|
55
75
|
form: string;
|
|
56
76
|
close: string;
|
|
57
|
-
|
|
77
|
+
overlay: string;
|
|
78
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
79
|
+
animatedBackdrop: {
|
|
80
|
+
true: {
|
|
81
|
+
base: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
}, {
|
|
58
85
|
base: string;
|
|
59
86
|
form: string;
|
|
60
87
|
close: string;
|
|
88
|
+
overlay: string;
|
|
61
89
|
}, undefined, unknown, unknown, undefined>>>;
|
|
62
90
|
export type DrawerheadVariants = VariantProps<typeof drawerhead> & Classes<typeof drawerhead>;
|
|
63
91
|
export declare const drawerhead: import("tailwind-variants").TVReturnType<{
|
package/dist/modal/Modal.svelte
CHANGED
|
@@ -23,98 +23,50 @@
|
|
|
23
23
|
footerClass,
|
|
24
24
|
size = "md",
|
|
25
25
|
placement,
|
|
26
|
-
class:
|
|
26
|
+
class: className,
|
|
27
27
|
classes,
|
|
28
28
|
transitionParams,
|
|
29
29
|
transition = fade,
|
|
30
30
|
fullscreen = false,
|
|
31
|
-
// Custom passm8 props
|
|
32
|
-
zIndexLayer,
|
|
33
|
-
toggle,
|
|
34
|
-
classDialog,
|
|
35
|
-
classBody,
|
|
36
|
-
classHeader,
|
|
37
|
-
classFooter,
|
|
38
|
-
className,
|
|
39
|
-
centered = false,
|
|
40
|
-
returnFocusAfterClose = true,
|
|
41
|
-
onclose,
|
|
42
|
-
onopen,
|
|
43
31
|
...restProps
|
|
44
32
|
}: ModalProps = $props();
|
|
45
33
|
|
|
46
|
-
// Handle className alias for class
|
|
47
|
-
const resolvedClassName = $derived(classNameProp ?? className);
|
|
48
|
-
|
|
49
|
-
// Handle centered as alias for placement="center"
|
|
50
|
-
const resolvedPlacement = $derived(centered ? "center" : placement);
|
|
51
|
-
|
|
52
|
-
// Handle class aliases (classBody -> bodyClass, etc.)
|
|
53
|
-
const resolvedBodyClass = $derived(bodyClass ?? classBody);
|
|
54
|
-
const resolvedHeaderClass = $derived(headerClass ?? classHeader);
|
|
55
|
-
const resolvedFooterClass = $derived(footerClass ?? classFooter);
|
|
56
|
-
|
|
57
34
|
warnThemeDeprecation(
|
|
58
35
|
"Modal",
|
|
59
|
-
untrack(() => ({ headerClass
|
|
36
|
+
untrack(() => ({ headerClass, bodyClass, footerClass, closeBtnClass })),
|
|
60
37
|
{ bodyClass: "body", headerClass: "header", footerClass: "footer", closeBtnClass: "close" }
|
|
61
38
|
);
|
|
62
39
|
|
|
63
|
-
const styling = $derived(classes ?? { header:
|
|
40
|
+
const styling = $derived(classes ?? { header: headerClass, body: bodyClass, footer: footerClass, close: closeBtnClass });
|
|
64
41
|
|
|
65
42
|
const theme = $derived(getTheme("modal"));
|
|
66
43
|
|
|
67
44
|
const paramsDefault = { duration: 100, easing: sineIn };
|
|
68
45
|
const paramsOptions = $derived(transitionParams ?? paramsDefault);
|
|
69
46
|
|
|
70
|
-
const { base, header: headerCls, footer: footerCls, body } = $derived(modalStyle({ placement
|
|
71
|
-
|
|
72
|
-
// Z-index layer styling
|
|
73
|
-
const zIndexStyle = $derived(zIndexLayer ? `z-index: ${zIndexLayer * 10};` : undefined);
|
|
74
|
-
|
|
75
|
-
// Track open state changes for callbacks
|
|
76
|
-
let prevOpen = $state(open);
|
|
77
|
-
$effect(() => {
|
|
78
|
-
if (open !== prevOpen) {
|
|
79
|
-
if (open) {
|
|
80
|
-
onopen?.();
|
|
81
|
-
} else {
|
|
82
|
-
onclose?.();
|
|
83
|
-
}
|
|
84
|
-
prevOpen = open;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// Handle toggle prop - if provided, use it to close the modal
|
|
89
|
-
function handleCancel() {
|
|
90
|
-
if (toggle) {
|
|
91
|
-
toggle();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
47
|
+
const { base, header: headerCls, footer: footerCls, body } = $derived(modalStyle({ placement, size }));
|
|
94
48
|
</script>
|
|
95
49
|
|
|
96
50
|
<Dialog
|
|
97
51
|
bind:open
|
|
98
52
|
{transition}
|
|
99
|
-
dismissable={dismissable && !title && !permanent}
|
|
53
|
+
dismissable={dismissable && !title && !header && !permanent}
|
|
100
54
|
transitionParams={paramsOptions}
|
|
101
55
|
{classes}
|
|
102
56
|
{permanent}
|
|
103
|
-
oncancel={toggle ? handleCancel : undefined}
|
|
104
57
|
{...restProps}
|
|
105
|
-
class={base({ fullscreen, class: clsx(theme?.base,
|
|
106
|
-
style={zIndexStyle}
|
|
58
|
+
class={base({ fullscreen, class: clsx(theme?.base, className) })}
|
|
107
59
|
>
|
|
108
60
|
{#if title || header}
|
|
109
61
|
<div class={headerCls({ class: clsx(theme?.header, styling.header) })}>
|
|
110
62
|
{#if title}
|
|
111
63
|
<h3>{title}</h3>
|
|
112
|
-
{#if dismissable && !permanent}
|
|
113
|
-
<CloseButton type="submit" formnovalidate class={clsx(styling.close)} />
|
|
114
|
-
{/if}
|
|
115
64
|
{:else if header}
|
|
116
65
|
{@render header()}
|
|
117
66
|
{/if}
|
|
67
|
+
{#if dismissable && !permanent}
|
|
68
|
+
<CloseButton type="submit" formnovalidate class={clsx(styling.close)} />
|
|
69
|
+
{/if}
|
|
118
70
|
</div>
|
|
119
71
|
{/if}
|
|
120
72
|
<div class={body({ class: clsx(theme?.body, styling.body) })}>
|
|
@@ -151,16 +103,5 @@
|
|
|
151
103
|
@prop transitionParams
|
|
152
104
|
@prop transition = fade
|
|
153
105
|
@prop fullscreen = false
|
|
154
|
-
@prop zIndexLayer - Controls z-index layering (multiplied by 10)
|
|
155
|
-
@prop toggle - Function to toggle modal open/close state
|
|
156
|
-
@prop classDialog - Additional class for the dialog element
|
|
157
|
-
@prop classBody - Alias for bodyClass
|
|
158
|
-
@prop classHeader - Alias for headerClass
|
|
159
|
-
@prop classFooter - Alias for footerClass
|
|
160
|
-
@prop className - Alias for class
|
|
161
|
-
@prop centered - Shorthand for placement="center"
|
|
162
|
-
@prop returnFocusAfterClose - Whether to return focus after close (default: true)
|
|
163
|
-
@prop onclose - Callback when modal closes
|
|
164
|
-
@prop onopen - Callback when modal opens
|
|
165
106
|
@prop ...restProps
|
|
166
107
|
-->
|
|
@@ -22,17 +22,6 @@ import type { ModalProps } from "..";
|
|
|
22
22
|
* @prop transitionParams
|
|
23
23
|
* @prop transition = fade
|
|
24
24
|
* @prop fullscreen = false
|
|
25
|
-
* @prop zIndexLayer - Controls z-index layering (multiplied by 10)
|
|
26
|
-
* @prop toggle - Function to toggle modal open/close state
|
|
27
|
-
* @prop classDialog - Additional class for the dialog element
|
|
28
|
-
* @prop classBody - Alias for bodyClass
|
|
29
|
-
* @prop classHeader - Alias for headerClass
|
|
30
|
-
* @prop classFooter - Alias for footerClass
|
|
31
|
-
* @prop className - Alias for class
|
|
32
|
-
* @prop centered - Shorthand for placement="center"
|
|
33
|
-
* @prop returnFocusAfterClose - Whether to return focus after close (default: true)
|
|
34
|
-
* @prop onclose - Callback when modal closes
|
|
35
|
-
* @prop onopen - Callback when modal opens
|
|
36
25
|
* @prop ...restProps
|
|
37
26
|
*/
|
|
38
27
|
declare const Modal: import("svelte").Component<ModalProps, {}, "open">;
|
package/dist/modal/theme.d.ts
CHANGED
|
@@ -63,20 +63,48 @@ export declare const modal: import("tailwind-variants").TVReturnType<{
|
|
|
63
63
|
header: string;
|
|
64
64
|
footer: string;
|
|
65
65
|
body: string;
|
|
66
|
-
}, undefined, {
|
|
66
|
+
}, undefined, {
|
|
67
|
+
animatedBackdrop: {
|
|
68
|
+
true: {
|
|
69
|
+
base: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
}, {
|
|
67
73
|
base: string;
|
|
68
74
|
form: string;
|
|
69
75
|
close: string;
|
|
70
|
-
|
|
76
|
+
overlay: string;
|
|
77
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
78
|
+
animatedBackdrop: {
|
|
79
|
+
true: {
|
|
80
|
+
base: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}, {
|
|
71
84
|
base: string;
|
|
72
85
|
form: string;
|
|
73
86
|
close: string;
|
|
74
|
-
|
|
87
|
+
overlay: string;
|
|
88
|
+
}, undefined, {
|
|
89
|
+
animatedBackdrop: {
|
|
90
|
+
true: {
|
|
91
|
+
base: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
}, {
|
|
75
95
|
base: string;
|
|
76
96
|
form: string;
|
|
77
97
|
close: string;
|
|
78
|
-
|
|
98
|
+
overlay: string;
|
|
99
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
100
|
+
animatedBackdrop: {
|
|
101
|
+
true: {
|
|
102
|
+
base: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
}, {
|
|
79
106
|
base: string;
|
|
80
107
|
form: string;
|
|
81
108
|
close: string;
|
|
109
|
+
overlay: string;
|
|
82
110
|
}, undefined, unknown, unknown, undefined>>>;
|
package/dist/types.d.ts
CHANGED
|
@@ -542,6 +542,8 @@ export interface DialogProps extends DialogVariants, HTMLDialogAttributes {
|
|
|
542
542
|
outsideclose?: boolean;
|
|
543
543
|
transition?: TransitionFunc;
|
|
544
544
|
transitionParams?: ParamsType;
|
|
545
|
+
/** When true, uses a custom overlay element instead of native ::backdrop for smooth fade in/out animations */
|
|
546
|
+
animatedBackdrop?: boolean;
|
|
545
547
|
}
|
|
546
548
|
export interface DrawerProps extends DrawerVariants, Omit<DialogProps, "hidden" | "classes" | "shifted"> {
|
|
547
549
|
/** @deprecated Use `outsideclose` instead. Will be removed in next minor version. */
|
|
@@ -975,17 +977,6 @@ export interface ModalProps extends ModalVariants, Omit<DialogProps, "classes">
|
|
|
975
977
|
footerClass?: ClassValue;
|
|
976
978
|
closeBtnClass?: ClassValue;
|
|
977
979
|
fullscreen?: boolean;
|
|
978
|
-
zIndexLayer?: number;
|
|
979
|
-
toggle?: () => void;
|
|
980
|
-
classDialog?: ClassValue;
|
|
981
|
-
classBody?: ClassValue;
|
|
982
|
-
classHeader?: ClassValue;
|
|
983
|
-
classFooter?: ClassValue;
|
|
984
|
-
className?: ClassValue;
|
|
985
|
-
centered?: boolean;
|
|
986
|
-
returnFocusAfterClose?: boolean;
|
|
987
|
-
onclose?: () => void;
|
|
988
|
-
onopen?: () => void;
|
|
989
980
|
}
|
|
990
981
|
export interface MenuProps extends SVGAttributes<SVGSVGElement> {
|
|
991
982
|
size?: string;
|