flowbite-svelte 0.22.11 → 0.22.12

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,24 @@
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.22.12](https://github.com/themesberg/flowbite-svelte/compare/v0.22.11...v0.22.12) (2022-07-24)
6
+
7
+
8
+ ### Features
9
+
10
+ * megamenu - code skel ([d02c5c7](https://github.com/themesberg/flowbite-svelte/commit/d02c5c78a5360f623ffe3fb3659265d679e43426))
11
+ * megamenu - wip ([02bbabc](https://github.com/themesberg/flowbite-svelte/commit/02bbabcdda0f924aefa2829a94e3b822bdb0bbf6))
12
+ * megamenu + examples ([2f24a26](https://github.com/themesberg/flowbite-svelte/commit/2f24a268dfe474da45a654d6a4bd128f4175ae44))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * layout and index page ([7db0e00](https://github.com/themesberg/flowbite-svelte/commit/7db0e00d1094d4d03a7386fd96c13c5b2ee09f6f))
18
+ * layout logo ([1a78683](https://github.com/themesberg/flowbite-svelte/commit/1a78683e734bf0dae58fe704bd652fcef196dae9))
19
+ * layout width ([e17969e](https://github.com/themesberg/flowbite-svelte/commit/e17969ec2c6f2938ed1a7c7b8f083bd3da6801e8))
20
+ * position and classes ([caa1f13](https://github.com/themesberg/flowbite-svelte/commit/caa1f136e964503ff1976c7de7c006615038489b))
21
+ * removed console.log ([f0f7ee9](https://github.com/themesberg/flowbite-svelte/commit/f0f7ee96bc48310ed245c00678960ac9d2eaa05b))
22
+
5
23
  ### [0.22.11](https://github.com/themesberg/flowbite-svelte/compare/v0.22.10...v0.22.11) (2022-07-23)
6
24
 
7
25
 
package/index.d.ts CHANGED
@@ -59,6 +59,7 @@ export { default as MediumModal } from './modals/MediumModal.svelte';
59
59
  export { default as ModalButton } from './modals/ModalButton.svelte';
60
60
  export { default as SignInModal } from './modals/SignInModal.svelte';
61
61
  export { default as SmallModal } from './modals/SmallModal.svelte';
62
+ export { default as MegaMenu } from './megamenu/MegaMenu.svelte';
62
63
  export { default as Navbar } from './navbar/Navbar.svelte';
63
64
  export { default as NavBrand } from './navbar/NavBrand.svelte';
64
65
  export { default as NavHamburger } from './navbar/NavHamburger.svelte';
package/index.js CHANGED
@@ -75,6 +75,8 @@ export { default as MediumModal } from './modals/MediumModal.svelte';
75
75
  export { default as ModalButton } from './modals/ModalButton.svelte';
76
76
  export { default as SignInModal } from './modals/SignInModal.svelte';
77
77
  export { default as SmallModal } from './modals/SmallModal.svelte';
78
+ // MegaMenu
79
+ export { default as MegaMenu } from './megamenu/MegaMenu.svelte';
78
80
  // Navbar
79
81
  export { default as Navbar } from './navbar/Navbar.svelte';
80
82
  export { default as NavBrand } from './navbar/NavBrand.svelte';
@@ -0,0 +1,39 @@
1
+ <script>import { setContext, afterUpdate } from 'svelte';
2
+ import classNames from 'classnames';
3
+ export let items = [];
4
+ export let full = false;
5
+ setContext('background', true);
6
+ let wrapperClass;
7
+ $: wrapperClass = classNames('border-gray-100 shadow-md dark:border-gray-700', full ? 'border-y' : 'rounded-lg border', full ? 'bg-white dark:bg-gray-800' : 'bg-white dark:bg-gray-700', $$props.class);
8
+ let ulClass;
9
+ $: ulClass = classNames('grid grid-flow-row gap-y-4 md:gap-x-0 auto-col-max auto-row-max', full && $$slots.extra ? 'sm:grid-cols-2' : 'sm:grid-cols-2 md:grid-cols-3', 'text-sm font-medium', 'text-gray-500 dark:text-gray-400', full && $$slots.extra && 'md:w-2/3');
10
+ function init(node) {
11
+ if (full) {
12
+ node.parentElement.classList.add('inset-x-0');
13
+ }
14
+ }
15
+ let wrapper;
16
+ afterUpdate(() => {
17
+ if (wrapper) {
18
+ const width = wrapper.getBoundingClientRect();
19
+ // wrapper.style.marginLeft = '-50%';
20
+ // console.log('after', width);
21
+ // console.log(wrapper.clientWidth);
22
+ }
23
+ });
24
+ </script>
25
+
26
+ <div class={wrapperClass} use:init bind:this={wrapper}>
27
+ <div class="flex flex-col md:flex-row p-4 max-w-screen-xl justify-center mx-auto">
28
+ <ul class={ulClass}>
29
+ {#each items as item, index}
30
+ <li>
31
+ <slot {item} {index} />
32
+ </li>
33
+ {:else}
34
+ <slot />
35
+ {/each}
36
+ </ul>
37
+ {#if full && $$slots.extra}<div class="md:w-1/3 mt-4 md:mt-0"><slot name="extra" /></div>{/if}
38
+ </div>
39
+ </div>
@@ -0,0 +1,24 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { LinkType } from '../types';
3
+ declare const __propDef: {
4
+ props: {
5
+ [x: string]: any;
6
+ items?: (LinkType & {
7
+ [propName: string]: any;
8
+ })[];
9
+ full?: boolean;
10
+ };
11
+ events: {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {
15
+ default: {};
16
+ extra: {};
17
+ };
18
+ };
19
+ export declare type MegaMenuProps = typeof __propDef.props;
20
+ export declare type MegaMenuEvents = typeof __propDef.events;
21
+ export declare type MegaMenuSlots = typeof __propDef.slots;
22
+ export default class MegaMenu extends SvelteComponentTyped<MegaMenuProps, MegaMenuEvents, MegaMenuSlots> {
23
+ }
24
+ export {};
@@ -1,18 +1,20 @@
1
- <script>export let liButtonClass;
1
+ <script>import { clickOutside } from '../utils/clickOutside';
2
+ export let liButtonClass = 'flex items-center';
2
3
  export let name;
4
+ export let child = [];
3
5
  let hidden = true;
4
6
  let block = false;
5
- export let child;
6
7
  const handleDropdown = () => {
7
8
  hidden = !hidden;
8
9
  block = !block;
9
10
  };
10
- export let dropdownDiv;
11
- export let dropdownLinkClassWithChild;
12
- export let rel;
11
+ export let dropdownDiv = '';
12
+ export let dropdownLinkClassWithChild = undefined;
13
+ export let rel = undefined;
14
+ let liClass = 'flex justify-center py-2 pr-4 pl-3 text-gray-700 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-gray-400 md:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700';
13
15
  </script>
14
16
 
15
- <li>
17
+ <li use:clickOutside={() => !hidden && handleDropdown()} class={liClass}>
16
18
  <button on:click={() => handleDropdown()} class={liButtonClass}
17
19
  >{name}
18
20
  <svg
@@ -29,13 +31,15 @@ export let rel;
29
31
  >
30
32
 
31
33
  <!-- Dropdown menu -->
32
- <div class:hidden class:block class={dropdownDiv} style="position: absolute; margin: 0px;">
33
- <ul class="py-1" aria-labelledby="dropdownLargeButton">
34
- {#each child as item}
35
- <li>
36
- <a href={item.href} {rel} class={dropdownLinkClassWithChild}>{item.name}</a>
37
- </li>
38
- {/each}
39
- </ul>
34
+ <div class:hidden class="absolute {dropdownDiv} mt-8 z-10">
35
+ <slot>
36
+ <ul class="py-1" aria-labelledby="dropdownLargeButton">
37
+ {#each child as item}
38
+ <li>
39
+ <a href={item.href} {rel} class={dropdownLinkClassWithChild}>{item.name}</a>
40
+ </li>
41
+ {/each}
42
+ </ul>
43
+ </slot>
40
44
  </div>
41
45
  </li>
@@ -2,17 +2,19 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { NavbarType } from '../types';
3
3
  declare const __propDef: {
4
4
  props: {
5
- liButtonClass: string;
5
+ liButtonClass?: string;
6
6
  name: string;
7
- child: NavbarType[];
8
- dropdownDiv: string;
9
- dropdownLinkClassWithChild: string;
10
- rel: string;
7
+ child?: NavbarType[];
8
+ dropdownDiv?: string;
9
+ dropdownLinkClassWithChild?: string;
10
+ rel?: string;
11
11
  };
12
12
  events: {
13
13
  [evt: string]: CustomEvent<any>;
14
14
  };
15
- slots: {};
15
+ slots: {
16
+ default: {};
17
+ };
16
18
  };
17
19
  export declare type NavDropdownProps = typeof __propDef.props;
18
20
  export declare type NavDropdownEvents = typeof __propDef.events;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.22.11",
3
+ "version": "0.22.12",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -163,6 +163,7 @@
163
163
  "./kbd/Kbd.svelte": "./kbd/Kbd.svelte",
164
164
  "./list-group/List.svelte": "./list-group/List.svelte",
165
165
  "./list-group/ListItem.svelte": "./list-group/ListItem.svelte",
166
+ "./megamenu/MegaMenu.svelte": "./megamenu/MegaMenu.svelte",
166
167
  "./modals/ExtraLargeModal.svelte": "./modals/ExtraLargeModal.svelte",
167
168
  "./modals/LargeModal.svelte": "./modals/LargeModal.svelte",
168
169
  "./modals/MediumModal.svelte": "./modals/MediumModal.svelte",