flowbite-svelte 1.13.1 → 1.13.2

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.
@@ -20,7 +20,11 @@
20
20
  let btnCls = $derived(base({ class: clsx(outline && outline_(), shadow && shadow_(), theme?.base, className) }));
21
21
  </script>
22
22
 
23
- {#if restProps.href === undefined}
23
+ {#if restProps.href !== undefined}
24
+ <a {...restProps} class={btnCls}>
25
+ {@render children?.()}
26
+ </a>
27
+ {:else if tag === "button"}
24
28
  <button type="button" {...restProps} class={btnCls} disabled={isDisabled}>
25
29
  {@render children?.()}
26
30
  {#if loading}
@@ -30,10 +34,6 @@
30
34
  </svg>
31
35
  {/if}
32
36
  </button>
33
- {:else if restProps.href}
34
- <a {...restProps} class={btnCls} role="button">
35
- {@render children?.()}
36
- </a>
37
37
  {:else}
38
38
  <svelte:element this={tag} {...restProps} class={btnCls}>
39
39
  {@render children?.()}
@@ -6,7 +6,7 @@
6
6
  import { sineIn } from "svelte/easing";
7
7
  import { fly } from "svelte/transition";
8
8
  import { drawer } from ".";
9
- import { setContext } from "svelte";
9
+ import { setContext, tick } from "svelte";
10
10
 
11
11
  let { children, open = $bindable(false), hidden = $bindable(), modal, offset, width, dismissable = offset ? false : undefined, placement = "left", class: className, transitionParams, transition = fly, outsideclose, activateClickOutside, ...restProps }: DrawerProps = $props();
12
12
 
@@ -53,7 +53,15 @@
53
53
 
54
54
  function init(node: HTMLDialogElement) {
55
55
  // set initial offset, later it will be switched on/off by onintrostart
56
- if (offset) node.style[placement] = offset;
56
+ if (offset) {
57
+ node.style[placement] = offset;
58
+ tick().then(() => {
59
+ // few borwsers give focus when dialog is open even in non-modal version
60
+ // to prevent that we set dialog to inert during creation and remove it
61
+ // as soon as ready
62
+ node.inert = false;
63
+ });
64
+ }
57
65
  }
58
66
 
59
67
  function onintrostart(ev: CustomEvent & { currentTarget: HTMLDialogElement }) {
@@ -82,7 +90,7 @@
82
90
  </Dialog>
83
91
 
84
92
  {#if offset && !open}
85
- <Dialog {@attach init} open modal={false} {dismissable} {outsideclose} {...restProps} class={base({ class: clsx(theme?.base, className) })}>
93
+ <Dialog {@attach init} open modal={false} {dismissable} {outsideclose} inert {...restProps} class={base({ class: clsx(theme?.base, className) })}>
86
94
  {@render children?.()}
87
95
  </Dialog>
88
96
  {/if}
@@ -68,15 +68,15 @@ export const drawerhead = tv({
68
68
  });
69
69
  export const drawerhandle = tv({
70
70
  slots: {
71
- base: "p-4 absolute flex select-none cursor-grab active:cursor-grabbing focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500 dark:focus-visible:ring-offset-gray-800",
71
+ base: "p-4 absolute flex select-none cursor-grab active:cursor-grabbing focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-300 dark:focus-visible:ring-gray-500",
72
72
  handle: "absolute rounded-lg bg-gray-300 dark:bg-gray-600"
73
73
  },
74
74
  variants: {
75
75
  placement: {
76
- left: { base: "inset-y-0 right-0 touch-pan-y", handle: "w-1 h-8 top-1/2 -translate-y-1/2" },
77
- right: { base: "inset-y-0 left-0 touch-pan-y", handle: "w-1 h-8 top-1/2 -translate-y-1/2" },
78
- top: { base: "inset-x-0 bottom-0 touch-pan-x", handle: "w-8 h-1 left-1/2 -translate-x-1/2" },
79
- bottom: { base: "inset-x-0 top-0 touch-pan-x", handle: "w-8 h-1 left-1/2 -translate-x-1/2" }
76
+ left: { base: "inset-y-0 right-0 touch-pan-x", handle: "w-1 h-8 top-1/2 -translate-y-1/2" },
77
+ right: { base: "inset-y-0 left-0 touch-pan-x", handle: "w-1 h-8 top-1/2 -translate-y-1/2" },
78
+ top: { base: "inset-x-0 bottom-0 touch-pan-y", handle: "w-8 h-1 left-1/2 -translate-x-1/2" },
79
+ bottom: { base: "inset-x-0 top-0 touch-pan-y", handle: "w-8 h-1 left-1/2 -translate-x-1/2" }
80
80
  }
81
81
  }
82
82
  });
@@ -8,17 +8,12 @@
8
8
 
9
9
  const theme = getTheme("radioButton");
10
10
 
11
- let inputEl: HTMLInputElement;
12
11
  let isChecked = $derived(value == group);
13
12
  let base = $derived(radioButton({ inline, class: clsx(isChecked && checkedClass, theme, className) }));
14
-
15
- function clickHandler() {
16
- inputEl?.click(); // manually trigger the click on the hidden input
17
- }
18
13
  </script>
19
14
 
20
- <Button tag="label" onclick={clickHandler} {pill} {outline} {size} {color} {shadow} class={base}>
21
- <input bind:this={inputEl} type="radio" class="sr-only" {value} bind:group {...restProps} />
15
+ <Button tag="label" {pill} {outline} {size} {color} {shadow} class={base}>
16
+ <input type="radio" class="sr-only" {value} bind:group {...restProps} />
22
17
  {@render children?.()}
23
18
  </Button>
24
19
 
@@ -22,15 +22,10 @@
22
22
 
23
23
  const theme = getTheme("speedDialButton");
24
24
 
25
- let { base, span } = $derived(speedDialButton({ textOutside }));
26
- let spanCls = $derived(tooltip === "none" ? span({ class: clsx(theme?.span, styling.span) }) : "sr-only");
27
-
28
- // Add flex-col when tooltip is shown
29
- let buttonCls = $derived(
30
- base({
31
- class: clsx(theme?.base, className, tooltip !== "none" && "flex-col")
32
- })
33
- );
25
+ let { base, span } = $derived(speedDialButton({ textOutside, noTooltip: tooltip === "none" }));
26
+ let spanCls = $derived(tooltip === "none" || textOutside ? span({ class: clsx(theme?.span, styling.span) }) : "sr-only");
27
+
28
+ let buttonCls = $derived(base({ class: clsx(theme?.base, className) }));
34
29
  </script>
35
30
 
36
31
  <Button {pill} {color} {...restProps} class={buttonCls}>
@@ -31,6 +31,10 @@ export declare const speedDial: import("tailwind-variants").TVReturnType<{
31
31
  popper: string;
32
32
  }, undefined, unknown, unknown, undefined>>;
33
33
  export declare const speedDialButton: import("tailwind-variants").TVReturnType<{
34
+ noTooltip: {
35
+ false: {};
36
+ true: {};
37
+ };
34
38
  textOutside: {
35
39
  true: {
36
40
  base: string;
@@ -41,6 +45,10 @@ export declare const speedDialButton: import("tailwind-variants").TVReturnType<{
41
45
  base: string;
42
46
  span: string;
43
47
  }, undefined, {
48
+ noTooltip: {
49
+ false: {};
50
+ true: {};
51
+ };
44
52
  textOutside: {
45
53
  true: {
46
54
  base: string;
@@ -51,6 +59,10 @@ export declare const speedDialButton: import("tailwind-variants").TVReturnType<{
51
59
  base: string;
52
60
  span: string;
53
61
  }, import("tailwind-variants").TVReturnType<{
62
+ noTooltip: {
63
+ false: {};
64
+ true: {};
65
+ };
54
66
  textOutside: {
55
67
  true: {
56
68
  base: string;
@@ -17,9 +17,13 @@ export const speedDial = tv({
17
17
  export const speedDialButton = tv({
18
18
  slots: {
19
19
  base: "w-[52px] h-[52px] shadow-xs p-0",
20
- span: "block mb-px text-xs font-medium"
20
+ span: "mb-px text-xs font-medium"
21
21
  },
22
22
  variants: {
23
+ noTooltip: {
24
+ false: {},
25
+ true: {}
26
+ },
23
27
  textOutside: {
24
28
  true: {
25
29
  base: "relative",
@@ -27,5 +31,6 @@ export const speedDialButton = tv({
27
31
  }
28
32
  }
29
33
  },
34
+ compoundVariants: [{ noTooltip: true, textOutside: false, class: { base: "flex flex-col" } }],
30
35
  defaultVariants: {}
31
36
  });
@@ -5,7 +5,7 @@ export declare const hr: import("tailwind-variants").TVReturnType<{
5
5
  withChildren: {
6
6
  true: {
7
7
  base: string;
8
- container: string;
8
+ div: string;
9
9
  };
10
10
  };
11
11
  }, {
@@ -16,7 +16,7 @@ export declare const hr: import("tailwind-variants").TVReturnType<{
16
16
  withChildren: {
17
17
  true: {
18
18
  base: string;
19
- container: string;
19
+ div: string;
20
20
  };
21
21
  };
22
22
  }, {
@@ -27,7 +27,7 @@ export declare const hr: import("tailwind-variants").TVReturnType<{
27
27
  withChildren: {
28
28
  true: {
29
29
  base: string;
30
- container: string;
30
+ div: string;
31
31
  };
32
32
  };
33
33
  }, {
@@ -9,7 +9,7 @@ export const hr = tv({
9
9
  withChildren: {
10
10
  true: {
11
11
  base: "w-full",
12
- container: "relative"
12
+ div: "relative"
13
13
  }
14
14
  }
15
15
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "dist/index.js",
6
6
  "author": {
@@ -41,7 +41,7 @@
41
41
  "eslint-plugin-svelte": "^3.11.0",
42
42
  "flowbite-svelte-admin-dashboard": "^1.1.1",
43
43
  "flowbite-svelte-blocks": "^2.1.0",
44
- "flowbite-svelte-icons": "^2.3.0",
44
+ "flowbite-svelte-icons": "^3.0.0",
45
45
  "flowbite-svelte-illustrations": "^1.0.5",
46
46
  "flowbite-typography": "^1.0.5",
47
47
  "globals": "^16.3.0",