flowbite-svelte 2.0.0-next.5 → 2.0.0-next.6

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/index.d.ts CHANGED
@@ -65,7 +65,7 @@ export * from "./forms/timepicker";
65
65
  export * from "./forms/toggle";
66
66
  export * from "./typography/a";
67
67
  export * from "./typography/blockquote";
68
- export * from "./typography/descriptionlist";
68
+ export * from "./typography/description-list/index.js";
69
69
  export * from "./typography/heading";
70
70
  export * from "./typography/hr";
71
71
  export * from "./typography/img";
package/dist/index.js CHANGED
@@ -71,7 +71,7 @@ export * from "./forms/toggle";
71
71
  // typography
72
72
  export * from "./typography/a";
73
73
  export * from "./typography/blockquote";
74
- export * from "./typography/descriptionlist";
74
+ export * from "./typography/description-list/index.js";
75
75
  export * from "./typography/heading";
76
76
  export * from "./typography/hr";
77
77
  export * from "./typography/img";
@@ -73,9 +73,73 @@
73
73
  registerTab: registerFn,
74
74
  unregisterTab: unregisterFn
75
75
  });
76
+
77
+ // Keyboard navigation handler for accessibility
78
+ function handleKeydown(event: KeyboardEvent) {
79
+ const target = event.target as HTMLElement;
80
+ if (target.getAttribute("role") !== "tab") return;
81
+
82
+ const tabs = Array.from(target.closest('[role="tablist"]')?.querySelectorAll('[role="tab"]') || []) as HTMLElement[];
83
+ const currentIndex = tabs.indexOf(target);
84
+
85
+ let nextIndex = currentIndex;
86
+ let attempts = 0; // Safety counter to prevent infinite loops
87
+
88
+ switch (event.key) {
89
+ case "ArrowRight":
90
+ case "ArrowDown":
91
+ event.preventDefault();
92
+ nextIndex = (currentIndex + 1) % tabs.length;
93
+ // Skip disabled tabs
94
+ attempts = 0;
95
+ while (tabs[nextIndex]?.hasAttribute("disabled") && nextIndex !== currentIndex && attempts < tabs.length) {
96
+ nextIndex = (nextIndex + 1) % tabs.length;
97
+ attempts++;
98
+ }
99
+ break;
100
+ case "ArrowLeft":
101
+ case "ArrowUp":
102
+ event.preventDefault();
103
+ nextIndex = currentIndex - 1 < 0 ? tabs.length - 1 : currentIndex - 1;
104
+ // Skip disabled tabs
105
+ attempts = 0;
106
+ while (tabs[nextIndex]?.hasAttribute("disabled") && nextIndex !== currentIndex && attempts < tabs.length) {
107
+ nextIndex = nextIndex - 1 < 0 ? tabs.length - 1 : nextIndex - 1;
108
+ attempts++;
109
+ }
110
+ break;
111
+ case "Home":
112
+ event.preventDefault();
113
+ nextIndex = 0;
114
+ // Find first non-disabled tab
115
+ attempts = 0;
116
+ while (tabs[nextIndex]?.hasAttribute("disabled") && nextIndex < tabs.length - 1 && attempts < tabs.length) {
117
+ nextIndex++;
118
+ attempts++;
119
+ }
120
+ break;
121
+ case "End":
122
+ event.preventDefault();
123
+ nextIndex = tabs.length - 1;
124
+ // Find last non-disabled tab
125
+ attempts = 0;
126
+ while (tabs[nextIndex]?.hasAttribute("disabled") && nextIndex > 0 && attempts < tabs.length) {
127
+ nextIndex--;
128
+ attempts++;
129
+ }
130
+ break;
131
+ default:
132
+ return;
133
+ }
134
+
135
+ if (nextIndex !== currentIndex && tabs[nextIndex]) {
136
+ tabs[nextIndex].focus();
137
+ tabs[nextIndex].click(); // Activate the tab
138
+ }
139
+ }
76
140
  </script>
77
141
 
78
- <ul role="tablist" {...restProps} class={base({ class: clsx(theme?.base, className) })} data-scope="tabs" data-part="base">
142
+ <ul role="tablist" {...restProps} class={base({ class: clsx(theme?.base, className) })} data-scope="tabs" data-part="base" onkeydown={handleKeydown}>
79
143
  {@render children()}
80
144
  </ul>
81
145
  {#if dividerBool}
@@ -58,7 +58,7 @@ export { timepicker } from "../forms/timepicker";
58
58
  export { toggle } from "../forms/toggle";
59
59
  export { anchor } from "../typography/a";
60
60
  export { blockquote } from "../typography/blockquote";
61
- export { descriptionList } from "../typography/descriptionlist";
61
+ export { descriptionList } from "../typography/description-list";
62
62
  export { heading } from "../typography/heading";
63
63
  export { hr } from "../typography/hr";
64
64
  export { img } from "../typography/img";
@@ -63,7 +63,7 @@ export { toggle } from "../forms/toggle";
63
63
  // typography
64
64
  export { anchor } from "../typography/a";
65
65
  export { blockquote } from "../typography/blockquote";
66
- export { descriptionList } from "../typography/descriptionlist";
66
+ export { descriptionList } from "../typography/description-list";
67
67
  export { heading } from "../typography/heading";
68
68
  export { hr } from "../typography/hr";
69
69
  export { img } from "../typography/img";
@@ -15,6 +15,12 @@
15
15
 
16
16
  <div class={card({ class: clsx(theme?.card, className) })} data-scope="group" data-part="card">
17
17
  <time class={time({ class: clsx(theme?.time, styling?.time) })} data-part="time">{date}</time>
18
+ <!--
19
+ NOTE:
20
+ restProps (data-testid, aria-*, etc.)
21
+ are intentionally forwarded to the <ol>,
22
+ which is the public/semantic root of Group.
23
+ -->
18
24
  <ol {...restProps} class={list({ class: clsx(theme?.list, styling?.list) })} data-part="list">
19
25
  {@render children()}
20
26
  </ol>
@@ -14,6 +14,12 @@
14
14
  </script>
15
15
 
16
16
  {#each timelines as { name, src, alt, isPrivate, href, comment, id }, index (id ?? href ?? name ?? index)}
17
+ <!--
18
+ NOTE:
19
+ restProps (data-testid, aria-*, etc.)
20
+ are intentionally forwarded to the <li>,
21
+ which is the public/semantic root of GroupItem.
22
+ -->
17
23
  <li class={base({ class: clsx(theme?.base, className) })} {...restProps} data-scope="group-item" data-part="base">
18
24
  <a {href} class={link({ class: clsx(theme?.link, styling?.link) })} data-part="link">
19
25
  <img class={img({ class: clsx(theme?.img, styling?.img) })} {src} {alt} data-part="img" />
@@ -17,6 +17,18 @@ export declare const toast: import("tailwind-variants").TVReturnType<{
17
17
  };
18
18
  };
19
19
  color: {
20
+ success: {
21
+ icon: string;
22
+ close: string;
23
+ };
24
+ warning: {
25
+ icon: string;
26
+ close: string;
27
+ };
28
+ danger: {
29
+ icon: string;
30
+ close: string;
31
+ };
20
32
  primary: {
21
33
  icon: string;
22
34
  close: string;
@@ -123,6 +135,18 @@ export declare const toast: import("tailwind-variants").TVReturnType<{
123
135
  };
124
136
  };
125
137
  color: {
138
+ success: {
139
+ icon: string;
140
+ close: string;
141
+ };
142
+ warning: {
143
+ icon: string;
144
+ close: string;
145
+ };
146
+ danger: {
147
+ icon: string;
148
+ close: string;
149
+ };
126
150
  primary: {
127
151
  icon: string;
128
152
  close: string;
@@ -229,6 +253,18 @@ export declare const toast: import("tailwind-variants").TVReturnType<{
229
253
  };
230
254
  };
231
255
  color: {
256
+ success: {
257
+ icon: string;
258
+ close: string;
259
+ };
260
+ warning: {
261
+ icon: string;
262
+ close: string;
263
+ };
264
+ danger: {
265
+ icon: string;
266
+ close: string;
267
+ };
232
268
  primary: {
233
269
  icon: string;
234
270
  close: string;
@@ -14,7 +14,18 @@ export const toast = tv({
14
14
  "bottom-right": { base: "absolute bottom-5 end-5" }
15
15
  },
16
16
  color: {
17
- // primary, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
17
+ success: {
18
+ icon: "text-green-500 bg-green-100 dark:bg-green-800 dark:text-green-200",
19
+ close: "text-green-500 dark:text-green-200 hover:text-green-600 dark:hover:text-green-500"
20
+ },
21
+ warning: {
22
+ icon: "text-yellow-500 bg-yellow-100 dark:bg-yellow-800 dark:text-yellow-200",
23
+ close: "text-yellow-500 dark:text-yellow-200 hover:text-yellow-600 dark:hover:text-yellow-500"
24
+ },
25
+ danger: {
26
+ icon: "text-red-500 bg-red-100 dark:bg-red-800 dark:text-red-200",
27
+ close: "text-red-500 dark:text-red-200 hover:text-red-600 dark:hover:text-red-500"
28
+ },
18
29
  primary: {
19
30
  icon: "text-primary-500 bg-primary-100 dark:bg-primary-800 dark:text-primary-200",
20
31
  close: "text-primary-500 dark:text-primary-200 hover:text-primary-600 dark:hover:text-primary-500"
package/dist/types.d.ts CHANGED
@@ -59,7 +59,7 @@ import type { ToggleVariants } from "./forms/toggle/theme";
59
59
  import type { PhoneInputVariants } from "./forms/phoneinput/theme";
60
60
  import type { AnchorVariants } from "./typography/a/theme";
61
61
  import type { BlockquoteVariants } from "./typography/blockquote/theme";
62
- import type { DescriptionListVariants } from "./typography/descriptionlist/theme";
62
+ import type { DescriptionListVariants } from "./typography/description-list/theme";
63
63
  import type { HeadingVariants } from "./typography/heading/theme";
64
64
  import type { HrVariants } from "./typography/hr/theme";
65
65
  import type { ImgVariants } from "./typography/img/theme";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "2.0.0-next.5",
3
+ "version": "2.0.0-next.6",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "author": {
6
6
  "name": "Shinichi Okada",