flowbite-svelte 0.16.14 → 0.17.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [0.17.0](https://github.com/themesberg/flowbite-svelte/compare/v0.16.14...v0.17.0) (2022-06-07)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * read the doc how to use them
11
+
12
+ ### Features
13
+
14
+ * add {...39090restProps} to ButtonGroup ([9744917](https://github.com/themesberg/flowbite-svelte/commit/9744917f9a036771e1ec285f43de56502e776a3d))
15
+ * new sidebar structure ([bf35b3e](https://github.com/themesberg/flowbite-svelte/commit/bf35b3e230b9d2f9b27d2e9576c70a3db47bc48c))
16
+ * update Sidebar components ([4f15325](https://github.com/themesberg/flowbite-svelte/commit/4f153257b519d4cbbb405a357e4c6ee7ebe30249))
17
+
5
18
  ### [0.16.14](https://github.com/themesberg/flowbite-svelte/compare/v0.16.13...v0.16.14) (2022-06-07)
6
19
 
7
20
 
@@ -1,6 +1,6 @@
1
1
  <script>export let divClass = 'inline-flex rounded-md shadow-sm';
2
2
  </script>
3
3
 
4
- <div class="{divClass} {$$props.class}" role="group">
4
+ <div class="{divClass} {$$props.class}" {...$$restProps} role="group">
5
5
  <slot />
6
6
  </div>
package/index.d.ts CHANGED
@@ -67,6 +67,12 @@ export { default as AdvancedRating } from './ratings/AdvancedRating.svelte';
67
67
  export { default as ScoreRating } from './ratings/ScoreRating.svelte';
68
68
  export { default as Sidebar } from './sidebars/Sidebar.svelte';
69
69
  export { default as SidebarItem } from './sidebars/SidebarItem.svelte';
70
+ export { default as SidebarBrand } from './sidebars/SidebarBrand.svelte';
71
+ export { default as SidebarCta } from './sidebars/SidebarCta.svelte';
72
+ export { default as SidebarDropdownItem } from './sidebars/SidebarDropdownItem.svelte';
73
+ export { default as SidebarDropdownWrapper } from './sidebars/SidebarDropdownWrapper.svelte';
74
+ export { default as SidebarGroup } from './sidebars/SidebarGroup.svelte';
75
+ export { default as SidebarWrapper } from './sidebars/SidebarWrapper.svelte';
70
76
  export { default as Spinner } from './spinners/Spinner.svelte';
71
77
  export { default as Table } from './tables/Table.svelte';
72
78
  export { default as TableDefaultRow } from './tables/TableDefaultRow.svelte';
package/index.js CHANGED
@@ -87,6 +87,12 @@ export { default as ScoreRating } from './ratings/ScoreRating.svelte';
87
87
  // Sidebar
88
88
  export { default as Sidebar } from './sidebars/Sidebar.svelte';
89
89
  export { default as SidebarItem } from './sidebars/SidebarItem.svelte';
90
+ export { default as SidebarBrand } from './sidebars/SidebarBrand.svelte';
91
+ export { default as SidebarCta } from './sidebars/SidebarCta.svelte';
92
+ export { default as SidebarDropdownItem } from './sidebars/SidebarDropdownItem.svelte';
93
+ export { default as SidebarDropdownWrapper } from './sidebars/SidebarDropdownWrapper.svelte';
94
+ export { default as SidebarGroup } from './sidebars/SidebarGroup.svelte';
95
+ export { default as SidebarWrapper } from './sidebars/SidebarWrapper.svelte';
90
96
  // Spin
91
97
  export { default as Spinner } from './spinners/Spinner.svelte';
92
98
  // Tables
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.16.14",
3
+ "version": "0.17.0",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -162,8 +162,13 @@
162
162
  "./ratings/RatingComment.svelte": "./ratings/RatingComment.svelte",
163
163
  "./ratings/ScoreRating.svelte": "./ratings/ScoreRating.svelte",
164
164
  "./sidebars/Sidebar.svelte": "./sidebars/Sidebar.svelte",
165
- "./sidebars/SidebarDropdown.svelte": "./sidebars/SidebarDropdown.svelte",
165
+ "./sidebars/SidebarBrand.svelte": "./sidebars/SidebarBrand.svelte",
166
+ "./sidebars/SidebarCta.svelte": "./sidebars/SidebarCta.svelte",
167
+ "./sidebars/SidebarDropdownItem.svelte": "./sidebars/SidebarDropdownItem.svelte",
168
+ "./sidebars/SidebarDropdownWrapper.svelte": "./sidebars/SidebarDropdownWrapper.svelte",
169
+ "./sidebars/SidebarGroup.svelte": "./sidebars/SidebarGroup.svelte",
166
170
  "./sidebars/SidebarItem.svelte": "./sidebars/SidebarItem.svelte",
171
+ "./sidebars/SidebarWrapper.svelte": "./sidebars/SidebarWrapper.svelte",
167
172
  "./spinners/Spinner.svelte": "./spinners/Spinner.svelte",
168
173
  "./tables/Table.svelte": "./tables/Table.svelte",
169
174
  "./tables/TableCheckbox.svelte": "./tables/TableCheckbox.svelte",
@@ -1,31 +1,6 @@
1
- <script>export let divClass = 'overflow-y-auto py-4 px-3 bg-gray-50 rounded dark:bg-gray-800';
2
- export let site;
3
- export let cta;
1
+ <script>export let asideClass = 'w-64';
4
2
  </script>
5
3
 
6
- <aside class="w-64" aria-label="Sidebar">
7
- <div class={divClass}>
8
- {#if site}
9
- <a href={site.href} class="flex items-center pl-2.5 mb-5">
10
- <img src={site.img} class="h-6 mr-3 sm:h-7" alt={site.name} />
11
- <span class="self-center text-xl font-semibold whitespace-nowrap dark:text-white"
12
- >{site.name}</span
13
- >
14
- </a>
15
- {/if}
16
- <slot />
17
- {#if cta}
18
- <div id="dropdown-cta" class="p-4 mt-6 bg-blue-50 rounded-lg dark:bg-blue-900" role="alert">
19
- <div class="flex items-center mb-3">
20
- <span
21
- class="bg-orange-100 text-orange-800 text-sm font-semibold mr-2 px-2.5 py-0.5 rounded dark:bg-orange-200 dark:text-orange-900"
22
- >{cta.label}</span
23
- >
24
- </div>
25
- <p class="mb-3 text-sm text-blue-900 dark:text-blue-400">
26
- {cta.text}
27
- </p>
28
- </div>
29
- {/if}
30
- </div>
4
+ <aside class="{asideClass} {$$props.class || ''}" {...$$restProps} aria-label="Sidebar">
5
+ <slot />
31
6
  </aside>
@@ -1,10 +1,8 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { SiteType, SidebarCtaType } from '../types';
3
2
  declare const __propDef: {
4
3
  props: {
5
- divClass?: string;
6
- site: SiteType;
7
- cta: SidebarCtaType;
4
+ [x: string]: any;
5
+ asideClass?: string;
8
6
  };
9
7
  events: {
10
8
  [evt: string]: CustomEvent<any>;
@@ -0,0 +1,10 @@
1
+ <script>export let site;
2
+ export let aClass = 'flex items-center pl-2.5 mb-5';
3
+ export let imgClass = 'h-6 mr-3 sm:h-7';
4
+ export let spanClass = 'self-center text-xl font-semibold whitespace-nowrap dark:text-white';
5
+ </script>
6
+
7
+ <a href={site.href} class="{aClass} {$$props.class || ''}" {...$$restProps}>
8
+ <img src={site.img} class={imgClass} alt={site.name} />
9
+ <span class={spanClass}>{site.name}</span>
10
+ </a>
@@ -0,0 +1,21 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { SiteType } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ site: SiteType;
7
+ aClass?: string;
8
+ imgClass?: string;
9
+ spanClass?: string;
10
+ };
11
+ events: {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ };
16
+ export declare type SidebarBrandProps = typeof __propDef.props;
17
+ export declare type SidebarBrandEvents = typeof __propDef.events;
18
+ export declare type SidebarBrandSlots = typeof __propDef.slots;
19
+ export default class SidebarBrand extends SvelteComponentTyped<SidebarBrandProps, SidebarBrandEvents, SidebarBrandSlots> {
20
+ }
21
+ export {};
@@ -0,0 +1,15 @@
1
+ <script>export let divWrapperClass = 'p-4 mt-6 bg-blue-50 rounded-lg dark:bg-blue-900';
2
+ export let divClass = 'flex items-center mb-3';
3
+ export let spanClass = 'bg-orange-100 text-orange-800 text-sm font-semibold mr-2 px-2.5 py-0.5 rounded dark:bg-orange-200 dark:text-orange-900';
4
+ export let label = '';
5
+ </script>
6
+
7
+ <div id="dropdown-cta" class={divWrapperClass} role="alert">
8
+ <div class={divClass}>
9
+ <span class={spanClass}>{label}</span>
10
+ {#if $$slots.icon}
11
+ <slot name="icon" />
12
+ {/if}
13
+ </div>
14
+ <slot />
15
+ </div>
@@ -0,0 +1,22 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ divWrapperClass?: string;
5
+ divClass?: string;
6
+ spanClass?: string;
7
+ label?: string;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {
13
+ icon: {};
14
+ default: {};
15
+ };
16
+ };
17
+ export declare type SidebarCtaProps = typeof __propDef.props;
18
+ export declare type SidebarCtaEvents = typeof __propDef.events;
19
+ export declare type SidebarCtaSlots = typeof __propDef.slots;
20
+ export default class SidebarCta extends SvelteComponentTyped<SidebarCtaProps, SidebarCtaEvents, SidebarCtaSlots> {
21
+ }
22
+ export {};
@@ -0,0 +1,8 @@
1
+ <script>export let aClass = 'flex items-center p-2 pl-11 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700';
2
+ export let href = '';
3
+ export let label = '';
4
+ </script>
5
+
6
+ <li>
7
+ <a {href} class={aClass}>{label}</a>
8
+ </li>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ aClass?: string;
5
+ href?: string;
6
+ label?: string;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ };
13
+ export declare type SidebarDropdownItemProps = typeof __propDef.props;
14
+ export declare type SidebarDropdownItemEvents = typeof __propDef.events;
15
+ export declare type SidebarDropdownItemSlots = typeof __propDef.slots;
16
+ export default class SidebarDropdownItem extends SvelteComponentTyped<SidebarDropdownItemProps, SidebarDropdownItemEvents, SidebarDropdownItemSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1,41 @@
1
+ <script>import { slide } from 'svelte/transition';
2
+ import { quintOut } from 'svelte/easing';
3
+ import { ChevronDown } from 'svelte-heros';
4
+ export let btnClass = 'flex items-center p-2 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700';
5
+ export let label = '';
6
+ export let spanClass = 'flex-1 ml-3 text-left whitespace-nowrap';
7
+ export let ulClass = 'py-2 space-y-2';
8
+ export let icon;
9
+ let isOpen = false;
10
+ const handleDropdown = () => {
11
+ isOpen = !isOpen;
12
+ };
13
+ </script>
14
+
15
+ <li>
16
+ <button
17
+ on:click={() => handleDropdown()}
18
+ type="button"
19
+ class="{btnClass} {$$props.class || ''}"
20
+ {...$$restProps}
21
+ aria-controls="sidebar-dropdown"
22
+ >
23
+ <svelte:component
24
+ this={icon.name}
25
+ size={icon.size}
26
+ color={icon.color}
27
+ class="mr-2 {icon.class}"
28
+ />
29
+ <span class={spanClass} sidebar-toggle-item>{label}</span>
30
+ <ChevronDown />
31
+ </button>
32
+ {#if isOpen}
33
+ <ul
34
+ id="dropdown"
35
+ class={ulClass}
36
+ transition:slide={{ delay: 250, duration: 300, easing: quintOut }}
37
+ >
38
+ <slot />
39
+ </ul>
40
+ {/if}
41
+ </li>
@@ -0,0 +1,24 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { IconType } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ btnClass?: string;
7
+ label?: string;
8
+ spanClass?: string;
9
+ ulClass?: string;
10
+ icon: IconType;
11
+ };
12
+ events: {
13
+ [evt: string]: CustomEvent<any>;
14
+ };
15
+ slots: {
16
+ default: {};
17
+ };
18
+ };
19
+ export declare type SidebarDropdownWrapperProps = typeof __propDef.props;
20
+ export declare type SidebarDropdownWrapperEvents = typeof __propDef.events;
21
+ export declare type SidebarDropdownWrapperSlots = typeof __propDef.slots;
22
+ export default class SidebarDropdownWrapper extends SvelteComponentTyped<SidebarDropdownWrapperProps, SidebarDropdownWrapperEvents, SidebarDropdownWrapperSlots> {
23
+ }
24
+ export {};
@@ -0,0 +1,11 @@
1
+ <script>export let ulClass = 'space-y-2';
2
+ export let borderClass = 'pt-4 mt-4 border-t border-gray-200 dark:border-gray-700';
3
+ export let border = false;
4
+ if (border) {
5
+ ulClass += ' ' + borderClass;
6
+ }
7
+ </script>
8
+
9
+ <ul class="{ulClass} {$$props.class || ''}" {...$$restProps}>
10
+ <slot />
11
+ </ul>
@@ -0,0 +1,21 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ ulClass?: string;
6
+ borderClass?: string;
7
+ border?: boolean;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {
13
+ default: {};
14
+ };
15
+ };
16
+ export declare type SidebarGroupProps = typeof __propDef.props;
17
+ export declare type SidebarGroupEvents = typeof __propDef.events;
18
+ export declare type SidebarGroupSlots = typeof __propDef.slots;
19
+ export default class SidebarGroup extends SvelteComponentTyped<SidebarGroupProps, SidebarGroupEvents, SidebarGroupSlots> {
20
+ }
21
+ export {};
@@ -1,36 +1,22 @@
1
- <script>import SidebarDropdown from './SidebarDropdown.svelte';
2
- export let links;
3
- export let aClass = 'flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700';
4
- export let childClass = 'flex items-center p-2 pl-11 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700';
5
- export let dropDownulClass = 'py-2 space-y-2';
6
- let ulClass = 'space-y-2';
7
- export let border = false;
8
- if (border) {
9
- ulClass = 'pt-4 mt-4 space-y-2 border-t border-gray-200 dark:border-gray-700';
10
- }
1
+ <script>export let aClass = 'flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700';
2
+ export let href = '';
3
+ export let rel = '';
4
+ export let label = '';
5
+ export let spanClass = 'ml-3';
6
+ export let icon;
11
7
  </script>
12
8
 
13
- <ul class={ulClass}>
14
- {#each links as link (link.id)}
15
- {#if link.children}
16
- <SidebarDropdown {link} ulClass={dropDownulClass} {childClass} />
17
- {:else}
18
- <li>
19
- <a href={link.href} rel={link.rel} class={aClass}>
20
- {#if link.icon}
21
- <svelte:component
22
- this={link.icon}
23
- size={link.iconSize}
24
- color={link.iconColor}
25
- class="mr-2 {link.iconClass}"
26
- />
27
- {/if}
28
- <span class="ml-3">{link.name}</span>
29
- {#if link.subtext}
30
- {@html link.subtext}
31
- {/if}
32
- </a>
33
- </li>
9
+ <li>
10
+ <a {href} {rel} class="{aClass} {$$props.class || ''}" {...$$restProps}>
11
+ <svelte:component
12
+ this={icon.name}
13
+ size={icon.size}
14
+ color={icon.color}
15
+ class="mr-2 {icon.class}"
16
+ />
17
+ <span class={spanClass}>{label}</span>
18
+ {#if $$slots.subtext}
19
+ <slot name="subtext" />
34
20
  {/if}
35
- {/each}
36
- </ul>
21
+ </a>
22
+ </li>
@@ -1,17 +1,21 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- import type { SidebarType } from '../types';
2
+ import type { IconType } from '../types';
3
3
  declare const __propDef: {
4
4
  props: {
5
- links: SidebarType[];
5
+ [x: string]: any;
6
6
  aClass?: string;
7
- childClass?: string;
8
- dropDownulClass?: string;
9
- border?: boolean;
7
+ href?: string;
8
+ rel?: string;
9
+ label?: string;
10
+ spanClass?: string;
11
+ icon: IconType;
10
12
  };
11
13
  events: {
12
14
  [evt: string]: CustomEvent<any>;
13
15
  };
14
- slots: {};
16
+ slots: {
17
+ subtext: {};
18
+ };
15
19
  };
16
20
  export declare type SidebarItemProps = typeof __propDef.props;
17
21
  export declare type SidebarItemEvents = typeof __propDef.events;
@@ -0,0 +1,6 @@
1
+ <script>export let divClass = 'overflow-y-auto py-4 px-3 bg-gray-50 rounded dark:bg-gray-800';
2
+ </script>
3
+
4
+ <div class="{divClass} {$$props.class || ''}" {...$$restProps}>
5
+ <slot />
6
+ </div>
@@ -0,0 +1,19 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ divClass?: string;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {
11
+ default: {};
12
+ };
13
+ };
14
+ export declare type SidebarWrapperProps = typeof __propDef.props;
15
+ export declare type SidebarWrapperEvents = typeof __propDef.events;
16
+ export declare type SidebarWrapperSlots = typeof __propDef.slots;
17
+ export default class SidebarWrapper extends SvelteComponentTyped<SidebarWrapperProps, SidebarWrapperEvents, SidebarWrapperSlots> {
18
+ }
19
+ export {};
package/types.d.ts CHANGED
@@ -78,6 +78,12 @@ export interface GroupTimelineType {
78
78
  isPrivate?: boolean;
79
79
  comment?: string | HTMLElement;
80
80
  }
81
+ export interface IconType {
82
+ name: string;
83
+ size?: number;
84
+ color?: Colors;
85
+ class?: string;
86
+ }
81
87
  export interface IconTabType {
82
88
  name: string;
83
89
  active: boolean;
@@ -1,30 +0,0 @@
1
- <script>import { slide } from 'svelte/transition';
2
- export let link;
3
- export let childClass = 'flex items-center p-2 pl-11 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700';
4
- export let ulClass = 'py-2 space-y-2';
5
- let isOpen = false;
6
- let activeDropdown = undefined;
7
- const handleDropdown = (id) => {
8
- isOpen = !isOpen;
9
- activeDropdown = id;
10
- };
11
- </script>
12
-
13
- <li>
14
- <button type="button" on:click={() => handleDropdown(link.id)} class="flex items-center p-2 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700" aria-controls="dropdown">
15
- {#if link.icon}
16
- <svelte:component this={link.icon} class="mr-2 {link.iconClass}" size={link.iconSize} color={link.iconColor} />
17
- {/if}
18
- <span class="flex-1 ml-3 text-left whitespace-nowrap" sidebar-toggle-item="">{link.name}</span>
19
- <svg sidebar-toggle-item="" class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" /></svg>
20
- </button>
21
- {#if isOpen && link.id == activeDropdown}
22
- <ul id="dropdown" class={ulClass} transition:slide={{ duration: 500 }}>
23
- {#each link.children as child}
24
- <li>
25
- <a href={child.href} rel={child.rel} class={childClass}>{child.name}</a>
26
- </li>
27
- {/each}
28
- </ul>
29
- {/if}
30
- </li>
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { SidebarType } from '../types';
3
- declare const __propDef: {
4
- props: {
5
- link: SidebarType;
6
- childClass?: string;
7
- ulClass?: string;
8
- };
9
- events: {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {};
13
- };
14
- export declare type SidebarDropdownProps = typeof __propDef.props;
15
- export declare type SidebarDropdownEvents = typeof __propDef.events;
16
- export declare type SidebarDropdownSlots = typeof __propDef.slots;
17
- export default class SidebarDropdown extends SvelteComponentTyped<SidebarDropdownProps, SidebarDropdownEvents, SidebarDropdownSlots> {
18
- }
19
- export {};