flowbite-svelte 1.7.1 → 1.8.1

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.
@@ -136,16 +136,16 @@ export declare const drawer: import("tailwind-variants").TVReturnType<{
136
136
  export declare const drawerhead: import("tailwind-variants").TVReturnType<{
137
137
  [key: string]: {
138
138
  [key: string]: import("tailwind-variants").ClassValue | {
139
- button?: import("tailwind-variants").ClassValue;
140
139
  base?: import("tailwind-variants").ClassValue;
140
+ button?: import("tailwind-variants").ClassValue;
141
141
  svg?: import("tailwind-variants").ClassValue;
142
142
  };
143
143
  };
144
144
  } | {
145
145
  [x: string]: {
146
146
  [x: string]: import("tailwind-variants").ClassValue | {
147
- button?: import("tailwind-variants").ClassValue;
148
147
  base?: import("tailwind-variants").ClassValue;
148
+ button?: import("tailwind-variants").ClassValue;
149
149
  svg?: import("tailwind-variants").ClassValue;
150
150
  };
151
151
  };
@@ -156,8 +156,8 @@ export declare const drawerhead: import("tailwind-variants").TVReturnType<{
156
156
  }, undefined, {
157
157
  [key: string]: {
158
158
  [key: string]: import("tailwind-variants").ClassValue | {
159
- button?: import("tailwind-variants").ClassValue;
160
159
  base?: import("tailwind-variants").ClassValue;
160
+ button?: import("tailwind-variants").ClassValue;
161
161
  svg?: import("tailwind-variants").ClassValue;
162
162
  };
163
163
  };
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { idGenerator } from "../../uiHelpers.svelte";
2
+ import { idGenerator } from "../../utils";
3
3
  import { floatingLabelInput } from ".";
4
4
  import { type FloatingLabelInputProps, CloseButton, cn } from "../..";
5
5
 
@@ -1,20 +1,20 @@
1
1
  export declare const tags: import("tailwind-variants").TVReturnType<{
2
2
  [key: string]: {
3
3
  [key: string]: import("tailwind-variants").ClassValue | {
4
- close?: import("tailwind-variants").ClassValue;
5
- input?: import("tailwind-variants").ClassValue;
6
4
  base?: import("tailwind-variants").ClassValue;
7
5
  span?: import("tailwind-variants").ClassValue;
6
+ close?: import("tailwind-variants").ClassValue;
7
+ input?: import("tailwind-variants").ClassValue;
8
8
  tag?: import("tailwind-variants").ClassValue;
9
9
  };
10
10
  };
11
11
  } | {
12
12
  [x: string]: {
13
13
  [x: string]: import("tailwind-variants").ClassValue | {
14
- close?: import("tailwind-variants").ClassValue;
15
- input?: import("tailwind-variants").ClassValue;
16
14
  base?: import("tailwind-variants").ClassValue;
17
15
  span?: import("tailwind-variants").ClassValue;
16
+ close?: import("tailwind-variants").ClassValue;
17
+ input?: import("tailwind-variants").ClassValue;
18
18
  tag?: import("tailwind-variants").ClassValue;
19
19
  };
20
20
  };
@@ -27,10 +27,10 @@ export declare const tags: import("tailwind-variants").TVReturnType<{
27
27
  }, undefined, {
28
28
  [key: string]: {
29
29
  [key: string]: import("tailwind-variants").ClassValue | {
30
- close?: import("tailwind-variants").ClassValue;
31
- input?: import("tailwind-variants").ClassValue;
32
30
  base?: import("tailwind-variants").ClassValue;
33
31
  span?: import("tailwind-variants").ClassValue;
32
+ close?: import("tailwind-variants").ClassValue;
33
+ input?: import("tailwind-variants").ClassValue;
34
34
  tag?: import("tailwind-variants").ClassValue;
35
35
  };
36
36
  };
@@ -2751,16 +2751,16 @@ export declare const baseThemes: {
2751
2751
  drawerhead: import("tailwind-variants").TVReturnType<{
2752
2752
  [key: string]: {
2753
2753
  [key: string]: import("tailwind-variants").ClassValue | {
2754
- button?: import("tailwind-variants").ClassValue;
2755
2754
  base?: import("tailwind-variants").ClassValue;
2755
+ button?: import("tailwind-variants").ClassValue;
2756
2756
  svg?: import("tailwind-variants").ClassValue;
2757
2757
  };
2758
2758
  };
2759
2759
  } | {
2760
2760
  [x: string]: {
2761
2761
  [x: string]: import("tailwind-variants").ClassValue | {
2762
- button?: import("tailwind-variants").ClassValue;
2763
2762
  base?: import("tailwind-variants").ClassValue;
2763
+ button?: import("tailwind-variants").ClassValue;
2764
2764
  svg?: import("tailwind-variants").ClassValue;
2765
2765
  };
2766
2766
  };
@@ -2771,8 +2771,8 @@ export declare const baseThemes: {
2771
2771
  }, undefined, {
2772
2772
  [key: string]: {
2773
2773
  [key: string]: import("tailwind-variants").ClassValue | {
2774
- button?: import("tailwind-variants").ClassValue;
2775
2774
  base?: import("tailwind-variants").ClassValue;
2775
+ button?: import("tailwind-variants").ClassValue;
2776
2776
  svg?: import("tailwind-variants").ClassValue;
2777
2777
  };
2778
2778
  };
@@ -1,11 +1,10 @@
1
- export declare function uiHelpers(): {
1
+ export function uiHelpers(): {
2
2
  isOpen: boolean;
3
3
  toggle: () => void;
4
4
  close: () => void;
5
5
  open: () => void;
6
6
  };
7
- export declare function clickOutside(element: HTMLElement, callbackFunction?: (e: MouseEvent) => void): {
8
- update(newCallbackFunction: () => void): void;
7
+ export function clickOutside(element: any, callbackFunction: any): {
8
+ update(newCallbackFunction: any): void;
9
9
  destroy(): void;
10
10
  };
11
- export declare function idGenerator(): string;
@@ -1,54 +1,57 @@
1
+ // @ts-nocheck
1
2
  export function uiHelpers() {
2
- let isOpen = $state(false);
3
- function toggle() {
4
- isOpen = !isOpen;
5
- }
6
- function close() {
7
- isOpen = false;
8
- }
9
- function open() {
10
- isOpen = true;
11
- }
12
- return {
13
- get isOpen() {
14
- return isOpen;
15
- },
16
- set isOpen(value) {
17
- isOpen = value;
18
- },
19
- toggle,
20
- close,
21
- open
22
- };
3
+ let isOpen = $state(false);
4
+
5
+ function toggle() {
6
+ isOpen = !isOpen;
7
+ }
8
+
9
+ function close() {
10
+ isOpen = false;
11
+ }
12
+
13
+ function open() {
14
+ isOpen = true;
15
+ }
16
+
17
+ return {
18
+ get isOpen() {
19
+ return isOpen;
20
+ },
21
+ set isOpen(value) {
22
+ isOpen = value;
23
+ },
24
+
25
+ toggle,
26
+ close,
27
+ open
28
+ };
23
29
  }
30
+
24
31
  export function clickOutside(element, callbackFunction) {
25
- const onClick = (event) => {
26
- if (typeof callbackFunction === "function") {
27
- const targetNode = event.target;
28
- if (!element.contains(targetNode)) {
29
- callbackFunction(event);
30
- }
31
- }
32
- else {
33
- console.error("Callback function is not a function");
34
- }
35
- };
36
- element.ownerDocument.body.addEventListener("click", onClick);
37
- return {
38
- update(newCallbackFunction) {
39
- if (typeof newCallbackFunction === "function") {
40
- callbackFunction = newCallbackFunction;
41
- }
42
- else {
43
- console.error("New callback function is not a function");
44
- }
45
- },
46
- destroy() {
47
- element.ownerDocument.body.removeEventListener("click", onClick);
48
- }
49
- };
50
- }
51
- let n = Date.now();
52
- export function idGenerator() {
53
- return (++n).toString(36);
32
+ const onClick = (event) => {
33
+ if (typeof callbackFunction === "function") {
34
+ const targetNode = event.target;
35
+ if (!element.contains(targetNode)) {
36
+ callbackFunction(event);
37
+ }
38
+ } else {
39
+ console.error("Callback function is not a function");
40
+ }
41
+ };
42
+
43
+ element.ownerDocument.body.addEventListener("click", onClick);
44
+
45
+ return {
46
+ update(newCallbackFunction) {
47
+ if (typeof newCallbackFunction === "function") {
48
+ callbackFunction = newCallbackFunction;
49
+ } else {
50
+ console.error("New callback function is not a function");
51
+ }
52
+ },
53
+ destroy() {
54
+ element.ownerDocument.body.removeEventListener("click", onClick);
55
+ }
56
+ };
54
57
  }
@@ -51,7 +51,8 @@ export function trapFocus(node, options = {}) {
51
51
  isFocusMovedOutside = true;
52
52
  }
53
53
  }
54
- $effect(() => {
54
+ // Initialize the action
55
+ function initialize() {
55
56
  // Only add event listeners if options is not null
56
57
  if (options !== null) {
57
58
  // Check if we're currently in a closing state
@@ -65,50 +66,42 @@ export function trapFocus(node, options = {}) {
65
66
  }
66
67
  node.addEventListener("keydown", handleKeydown);
67
68
  node.addEventListener("focusout", handleFocusOut);
68
- return () => {
69
- node.removeEventListener("keydown", handleKeydown);
70
- node.removeEventListener("focusout", handleFocusOut);
71
- // Only restore focus if not closing via outside click and focus hasn't moved outside
72
- if (!isClosingViaOutsideClick && !isFocusMovedOutside && previous) {
73
- setTimeout(() => {
74
- previous.focus({ preventScroll: true });
75
- }, 0);
76
- }
77
- };
78
69
  }
79
- });
80
- // Return the action object with destroy method
70
+ }
71
+ // Cleanup function
72
+ function cleanup() {
73
+ if (options !== null) {
74
+ node.removeEventListener("keydown", handleKeydown);
75
+ node.removeEventListener("focusout", handleFocusOut);
76
+ // Only restore focus if not closing via outside click and focus hasn't moved outside
77
+ if (!isClosingViaOutsideClick && !isFocusMovedOutside && previous) {
78
+ setTimeout(() => {
79
+ previous.focus({ preventScroll: true });
80
+ }, 0);
81
+ }
82
+ }
83
+ }
84
+ // Initialize on mount
85
+ initialize();
86
+ // Return the action object with update and destroy methods
81
87
  return {
82
88
  update(newOptions = {}) {
89
+ // Clean up existing listeners first
90
+ node.removeEventListener("keydown", handleKeydown);
91
+ node.removeEventListener("focusout", handleFocusOut);
83
92
  // Update the closing state
84
93
  if (newOptions && newOptions.isClosing !== undefined) {
85
94
  isClosingViaOutsideClick = newOptions.isClosing;
86
95
  }
87
96
  options = newOptions;
88
- // Clean up existing listeners if options becomes null
89
- if (options === null) {
90
- node.removeEventListener("keydown", handleKeydown);
91
- node.removeEventListener("focusout", handleFocusOut);
92
- }
93
- else if (options !== null) {
94
- // Add listener if it wasn't already there
95
- node.removeEventListener("keydown", handleKeydown);
96
- node.removeEventListener("focusout", handleFocusOut);
97
+ // Reinitialize with new options
98
+ if (options !== null) {
97
99
  node.addEventListener("keydown", handleKeydown);
98
100
  node.addEventListener("focusout", handleFocusOut);
99
101
  }
100
102
  },
101
103
  destroy() {
102
- if (options !== null) {
103
- node.removeEventListener("keydown", handleKeydown);
104
- node.removeEventListener("focusout", handleFocusOut);
105
- // Only restore focus if not closing via outside click and focus hasn't moved outside
106
- if (!isClosingViaOutsideClick && !isFocusMovedOutside && previous) {
107
- setTimeout(() => {
108
- previous.focus({ preventScroll: true });
109
- }, 0);
110
- }
111
- }
104
+ cleanup();
112
105
  }
113
106
  };
114
107
  }
@@ -1,6 +1,7 @@
1
1
  import { type ClassValue } from "clsx";
2
2
  export { default as CloseButton } from "./CloseButton.svelte";
3
3
  export { closeButtonVariants } from "./theme";
4
- export { trapFocus } from "./actions.svelte";
4
+ export { trapFocus } from "./actions";
5
5
  export { default as Popper } from "./Popper.svelte";
6
6
  export declare function cn(...inputs: ClassValue[]): string;
7
+ export declare function idGenerator(): string;
@@ -2,8 +2,12 @@ import { clsx } from "clsx";
2
2
  import { twMerge } from "tailwind-merge";
3
3
  export { default as CloseButton } from "./CloseButton.svelte";
4
4
  export { closeButtonVariants } from "./theme";
5
- export { trapFocus } from "./actions.svelte";
5
+ export { trapFocus } from "./actions";
6
6
  export { default as Popper } from "./Popper.svelte";
7
7
  export function cn(...inputs) {
8
8
  return twMerge(clsx(inputs));
9
9
  }
10
+ let n = Date.now();
11
+ export function idGenerator() {
12
+ return (++n).toString(36);
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "dist/index.js",
6
6
  "author": {
@@ -17,10 +17,13 @@
17
17
  "@docsearch/js": "^3.9.0",
18
18
  "@eslint/compat": "^1.3.0",
19
19
  "@eslint/js": "^9.29.0",
20
- "@playwright/test": "^1.53.0",
20
+ "@flowbite-svelte-plugins/chart": "^0.2.4",
21
+ "@flowbite-svelte-plugins/datatable": "^0.3.4",
22
+ "@flowbite-svelte-plugins/texteditor": "^0.9.5",
23
+ "@playwright/test": "^1.53.1",
21
24
  "@sveltejs/adapter-auto": "^6.0.1",
22
25
  "@sveltejs/adapter-vercel": "^5.7.2",
23
- "@sveltejs/kit": "^2.21.5",
26
+ "@sveltejs/kit": "^2.22.0",
24
27
  "@sveltejs/package": "2.3.11",
25
28
  "@sveltejs/vite-plugin-svelte": "^5.1.0",
26
29
  "@svitejs/changesets-changelog-github-compact": "^1.2.0",
@@ -28,23 +31,27 @@
28
31
  "@testing-library/jest-dom": "^6.6.3",
29
32
  "@testing-library/svelte": "^5.2.8",
30
33
  "@testing-library/user-event": "^14.6.1",
34
+ "@tiptap/core": "^2.22.3",
31
35
  "dayjs": "^1.11.13",
32
36
  "deepmerge": "^4.3.1",
33
37
  "eslint": "^9.29.0",
34
38
  "eslint-config-prettier": "^10.1.5",
35
- "eslint-plugin-svelte": "^3.9.2",
36
- "flowbite-svelte-icons": "^2.2.0",
39
+ "eslint-plugin-svelte": "^3.9.3",
40
+ "flowbite-svelte-icons": "^2.2.1",
41
+ "flowbite-typography": "^1.0.5",
37
42
  "globals": "^16.2.0",
38
43
  "jsdom": "^26.1.0",
44
+ "lowlight": "^3.3.0",
39
45
  "mdsvex": "^0.12.6",
40
46
  "mdsvexamples": "^0.5.0",
41
47
  "prettier": "^3.5.3",
42
48
  "prettier-plugin-svelte": "^3.4.0",
43
- "prettier-plugin-tailwindcss": "^0.6.12",
49
+ "prettier-plugin-tailwindcss": "^0.6.13",
44
50
  "prism-themes": "^1.9.0",
45
51
  "publint": "^0.3.12",
46
- "svelte": "^5.34.3",
47
- "svelte-check": "^4.2.1",
52
+ "simple-datatables": "^10.0.0",
53
+ "svelte": "^5.34.7",
54
+ "svelte-check": "^4.2.2",
48
55
  "svelte-doc-llm": "^0.2.2",
49
56
  "svelte-lib-helpers": "^0.4.30",
50
57
  "svelte-meta-tags": "^4.4.0",
@@ -54,7 +61,8 @@
54
61
  "typescript": "^5.8.3",
55
62
  "typescript-eslint": "8.31.1",
56
63
  "vite": "^6.3.5",
57
- "vitest": "^3.2.3"
64
+ "vite-plugin-devtools-json": "^0.2.0",
65
+ "vitest": "^3.2.4"
58
66
  },
59
67
  "peerDependencies": {
60
68
  "svelte": "^5.0.0",