@pajohns/flowbite-svelte 0.1.4 → 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.
@@ -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
- let { base, form: formCls, close: closeCls } = dialog();
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
@@ -17,6 +17,7 @@ import type { DialogProps } from "..";
17
17
  * @prop permanent = false
18
18
  * @prop dismissable = true
19
19
  * @prop outsideclose = true
20
+ * @prop animatedBackdrop = false
20
21
  * @prop class: className
21
22
  * @prop classes
22
23
  * @prop transition = fade
@@ -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
- }, undefined, {}, {
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
- }, import("tailwind-variants").TVReturnType<{}, {
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>>;
@@ -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
- // position: {
10
- // fixed: { base: "fixed" },
11
- // absolute: { base: "absolute" }
12
- // },
10
+ animatedBackdrop: {
11
+ true: { base: "backdrop:bg-transparent" }
12
+ }
13
13
  },
14
14
  defaultVariants: {
15
- // position: "fixed"
15
+ animatedBackdrop: false
16
16
  }
17
17
  });
@@ -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
- }, import("tailwind-variants").TVReturnType<{}, {
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
- }, undefined, {}, {
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
- }, import("tailwind-variants").TVReturnType<{}, {
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<{
@@ -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
- }, import("tailwind-variants").TVReturnType<{}, {
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
- }, undefined, {}, {
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
- }, import("tailwind-variants").TVReturnType<{}, {
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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pajohns/flowbite-svelte",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Webapps global fork of flow-bite-svelte with customisation changes",
5
5
  "main": "dist/index.js",
6
6
  "author": {