@pajohns/flowbite-svelte 0.1.0 → 0.1.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.
@@ -21,8 +21,9 @@
21
21
  class: className,
22
22
  classes,
23
23
  headerClass,
24
- contentClass
25
- }: AccordionItemProps = $props();
24
+ contentClass,
25
+ headingTag = 'h2'
26
+ }: AccordionItemProps & { headingTag?: 'h2' | 'h3' | 'div' } = $props();
26
27
 
27
28
  warnThemeDeprecation(
28
29
  "AccordionItem",
@@ -70,7 +71,7 @@
70
71
  let buttonClass = $derived(clsx(open && !ctx?.flush && (styling.active || ctx?.activeClass || active()), !open && !ctx?.flush && (styling.inactive || ctx?.inactiveClass || inactive())));
71
72
  </script>
72
73
 
73
- <h2 class={base({ class: clsx(theme?.base, className) })}>
74
+ <svelte:element this={headingTag} class={base({ class: clsx(theme?.base, className) })}>
74
75
  <button type="button" onclick={handleToggle} class={button({ class: clsx(buttonClass, theme?.button, styling.button) })} aria-expanded={open}>
75
76
  {#if header}
76
77
  {@render header()}
@@ -91,7 +92,7 @@
91
92
  {/if}
92
93
  {/if}
93
94
  </button>
94
- </h2>
95
+ </svelte:element>
95
96
 
96
97
  {#if useTransition}
97
98
  {#if open && transitionType !== "none"}
@@ -128,4 +129,5 @@
128
129
  @prop classes
129
130
  @prop headerClass
130
131
  @prop contentClass
132
+ @prop headingTag = 'h2' - The HTML element to wrap the accordion header ('h2' | 'h3' | 'div')
131
133
  -->
@@ -1,4 +1,7 @@
1
1
  import type { AccordionItemProps } from "..";
2
+ type $$ComponentProps = AccordionItemProps & {
3
+ headingTag?: 'h2' | 'h3' | 'div';
4
+ };
2
5
  /**
3
6
  * [Go to docs](https://flowbite-svelte.com/)
4
7
  * ## Type
@@ -17,7 +20,8 @@ import type { AccordionItemProps } from "..";
17
20
  * @prop classes
18
21
  * @prop headerClass
19
22
  * @prop contentClass
23
+ * @prop headingTag = 'h2' - The HTML element to wrap the accordion header ('h2' | 'h3' | 'div')
20
24
  */
21
- declare const AccordionItem: import("svelte").Component<AccordionItemProps, {}, "open">;
25
+ declare const AccordionItem: import("svelte").Component<$$ComponentProps, {}, "open">;
22
26
  type AccordionItem = ReturnType<typeof AccordionItem>;
23
27
  export default AccordionItem;
@@ -198,7 +198,10 @@
198
198
  invoker = triggerEls[0];
199
199
 
200
200
  triggerEls.forEach((element: HTMLElement) => {
201
- if (element.tabIndex < 0) element.tabIndex = 0; // trigger must be focusable
201
+ // Only force focusable if tooltip is triggered by focus
202
+ if (trigger.includes('focus') && element.tabIndex < 0) {
203
+ element.tabIndex = 0;
204
+ }
202
205
  for (const [name, handler, cond] of events) if (cond) element.addEventListener(name, handler);
203
206
  });
204
207
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pajohns/flowbite-svelte",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Webapps global fork of flow-bite-svelte with customisation changes",
5
5
  "main": "dist/index.js",
6
6
  "author": {
@@ -914,4 +914,4 @@
914
914
  },
915
915
  "./package.json": "./package.json"
916
916
  }
917
- }
917
+ }