flowbite-svelte 0.26.9 → 0.26.10

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,22 @@
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.26.10](https://github.com/themesberg/flowbite-svelte/compare/v0.26.9...v0.26.10) (2022-09-05)
6
+
7
+
8
+ ### Features
9
+
10
+ * add bgColor and bgOpacity to Drawer component ([8dc01fb](https://github.com/themesberg/flowbite-svelte/commit/8dc01fb9ec82b14d5f893d1255b646630e205ce2))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * 683restProps for toolbarbutton ([6ce830c](https://github.com/themesberg/flowbite-svelte/commit/6ce830c2657c6727835ded2b01728c8830a1a7d2))
16
+ * change ml-2 after get access to ml-1 ([b8ffc2c](https://github.com/themesberg/flowbite-svelte/commit/b8ffc2ca5016737da2d40ed5b83d4ef5fdc07e08))
17
+ * megamenu fullscreen position ([eaf0729](https://github.com/themesberg/flowbite-svelte/commit/eaf07294a728b524f2873df26f8250d23682dd81))
18
+ * navbar updates ([468839b](https://github.com/themesberg/flowbite-svelte/commit/468839bd2efee738787b428ef902cecee3f70e12))
19
+ * remove Figma from image page ([0276b51](https://github.com/themesberg/flowbite-svelte/commit/0276b517fc828e77bfd383be122b514bb0793da0))
20
+
5
21
  ### [0.26.9](https://github.com/themesberg/flowbite-svelte/compare/v0.26.8...v0.26.9) (2022-09-04)
6
22
 
7
23
 
@@ -5,6 +5,8 @@ export let hidden = true;
5
5
  export let position = 'fixed';
6
6
  export let width = 'w-80';
7
7
  export let backdrop = true;
8
+ export let bgColor = 'bg-gray-900';
9
+ export let bgOpacity = 'bg-opacity-75';
8
10
  export let placement = 'left';
9
11
  export let id = 'drawer-example';
10
12
  export let divClass = 'overflow-y-auto z-50 p-4 bg-white dark:bg-gray-800';
@@ -32,13 +34,12 @@ const handleDrawer = () => {
32
34
  hidden = !hidden;
33
35
  console.log('clicked');
34
36
  };
37
+ let backdropDivClass = classNames('fixed top-0 left-0 z-50 w-full h-full', backdrop && bgColor, backdrop && bgOpacity);
35
38
  </script>
36
39
 
37
40
  {#if !hidden}
38
41
  {#if backdrop}
39
- <div
40
- class="fixed top-0 left-0 z-50 w-full h-full bg-gray-900/70"
41
- on:click={() => !hidden && handleDrawer()} />
42
+ <div class={backdropDivClass} on:click={() => !hidden && handleDrawer()} />
42
43
  {/if}
43
44
  <div
44
45
  use:clickOutside={() => !hidden && handleDrawer()}
@@ -7,6 +7,8 @@ declare const __propDef: {
7
7
  position?: 'fixed' | 'absolute';
8
8
  width?: string;
9
9
  backdrop?: boolean;
10
+ bgColor?: string;
11
+ bgOpacity?: string;
10
12
  placement?: 'left' | 'right' | 'top' | 'bottom';
11
13
  id?: string;
12
14
  divClass?: string;
@@ -8,6 +8,7 @@ export let arrowIcon = true;
8
8
  export let labelClass = 'flex items-center justify-between w-full py-2 pl-3 pr-4 font-medium 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 md:w-auto dark:text-gray-400 dark:hover:text-white dark:focus:text-white dark:border-gray-700 dark:hover:bg-gray-700 md:dark:hover:bg-transparent';
9
9
  export let placement = 'bottom';
10
10
  export let open = false;
11
+ export let color = 'dropdown';
11
12
  let popoverClass;
12
13
  $: popoverClass = classNames('outline-none', $$props.class);
13
14
  </script>
@@ -36,9 +37,9 @@ $: popoverClass = classNames('outline-none', $$props.class);
36
37
 
37
38
  <Popper
38
39
  rounded
39
- border
40
40
  shadow
41
41
  activeContent
42
+ {color}
42
43
  arrow={false}
43
44
  {placement}
44
45
  trigger="click"
@@ -9,6 +9,7 @@ declare const __propDef: {
9
9
  labelClass?: string;
10
10
  placement?: Placement;
11
11
  open?: boolean;
12
+ color?: string;
12
13
  };
13
14
  events: {
14
15
  show: CustomEvent<any>;
@@ -1,24 +1,27 @@
1
1
  <script>import classNames from 'classnames';
2
2
  export let liClass = 'block font-medium cursor-pointer py-2 px-4 text-sm hover:bg-gray-100 dark:hover:bg-gray-600';
3
3
  export let color = 'default';
4
- export let tabindex = 0;
4
+ export let href = undefined;
5
5
  const colors = {
6
6
  default: 'text-gray-700 dark:text-gray-200 dark:hover:text-white',
7
7
  red: 'text-red-600 dark:text-red-500'
8
8
  };
9
9
  </script>
10
10
 
11
- <li
12
- {...$$restProps}
13
- class={classNames(liClass, colors[color] ?? colors.default, $$props.class)}
14
- on:click
15
- on:change
16
- on:keydown
17
- on:keyup
18
- on:focus
19
- on:blur
20
- on:mouseenter
21
- on:mouseleave
22
- {tabindex}>
23
- <slot />
11
+ <li>
12
+ <svelte:element
13
+ this={href ? 'a' : 'div'}
14
+ {href}
15
+ {...$$restProps}
16
+ class={classNames(liClass, colors[color] ?? colors.default, $$props.class)}
17
+ on:click
18
+ on:change
19
+ on:keydown
20
+ on:keyup
21
+ on:focus
22
+ on:blur
23
+ on:mouseenter
24
+ on:mouseleave>
25
+ <slot />
26
+ </svelte:element>
24
27
  </li>
@@ -4,7 +4,7 @@ declare const __propDef: {
4
4
  [x: string]: any;
5
5
  liClass?: string;
6
6
  color?: string;
7
- tabindex?: number;
7
+ href?: string;
8
8
  };
9
9
  events: {
10
10
  click: MouseEvent;
package/index.d.ts CHANGED
@@ -50,7 +50,6 @@ export { default as Modal } from './modals/Modal.svelte';
50
50
  export { default as MegaMenu } from './megamenu/MegaMenu.svelte';
51
51
  export { default as Navbar } from './navbar/Navbar.svelte';
52
52
  export { default as NavBrand } from './navbar/NavBrand.svelte';
53
- export { default as NavDropdown } from './navbar/NavDropdown.svelte';
54
53
  export { default as NavHamburger } from './navbar/NavHamburger.svelte';
55
54
  export { default as NavLi } from './navbar/NavLi.svelte';
56
55
  export { default as NavUl } from './navbar/NavUl.svelte';
@@ -125,5 +124,6 @@ export { default as ChevronDown } from './utils/ChevronDown.svelte';
125
124
  export { default as ChevronLeft } from './utils/ChevronLeft.svelte';
126
125
  export { default as ChevronRight } from './utils/ChevronRight.svelte';
127
126
  export { default as ChevronUp } from './utils/ChevronUp.svelte';
127
+ export { default as Chevron } from './utils/Chevron.svelte';
128
128
  export { default as InformationCircle } from './utils/InformationCircle.svelte';
129
129
  export { default as UserCircle } from './utils/UserCircle.svelte';
package/index.js CHANGED
@@ -70,7 +70,6 @@ export { default as MegaMenu } from './megamenu/MegaMenu.svelte';
70
70
  // Navbar
71
71
  export { default as Navbar } from './navbar/Navbar.svelte';
72
72
  export { default as NavBrand } from './navbar/NavBrand.svelte';
73
- export { default as NavDropdown } from './navbar/NavDropdown.svelte';
74
73
  export { default as NavHamburger } from './navbar/NavHamburger.svelte';
75
74
  export { default as NavLi } from './navbar/NavLi.svelte';
76
75
  export { default as NavUl } from './navbar/NavUl.svelte';
@@ -160,5 +159,6 @@ export { default as ChevronDown } from './utils/ChevronDown.svelte';
160
159
  export { default as ChevronLeft } from './utils/ChevronLeft.svelte';
161
160
  export { default as ChevronRight } from './utils/ChevronRight.svelte';
162
161
  export { default as ChevronUp } from './utils/ChevronUp.svelte';
162
+ export { default as Chevron } from './utils/Chevron.svelte';
163
163
  export { default as InformationCircle } from './utils/InformationCircle.svelte';
164
164
  export { default as UserCircle } from './utils/UserCircle.svelte';
@@ -1,12 +1,12 @@
1
- <script>import { setContext, afterUpdate } from 'svelte';
2
- import classNames from 'classnames';
1
+ <script>import classNames from 'classnames';
2
+ import Popper from '../utils/Popper.svelte';
3
3
  export let items = [];
4
4
  export let full = false;
5
- setContext('background', true);
5
+ export let open = false;
6
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);
7
+ $: wrapperClass = classNames(full && 'border-y w-full', $$props.class);
8
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 ? 'grid-cols-2' : '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');
9
+ $: ulClass = classNames('grid grid-flow-row gap-y-4 md:gap-x-0 auto-col-max auto-row-max', full && $$slots.extra ? 'grid-cols-2' : 'grid-cols-2 md:grid-cols-3', 'text-sm font-medium', full && $$slots.extra && 'md:w-2/3');
10
10
  const init = (node) => {
11
11
  if (full) {
12
12
  node.parentElement.classList.add('inset-x-0');
@@ -14,8 +14,20 @@ const init = (node) => {
14
14
  };
15
15
  </script>
16
16
 
17
- <div class={wrapperClass} use:init>
18
- <div class="flex flex-col md:flex-row p-4 max-w-screen-xl justify-center mx-auto">
17
+ <Popper
18
+ color={full ? 'default' : 'dropdown'}
19
+ border={!full}
20
+ rounded={!full}
21
+ activeContent
22
+ arrow={false}
23
+ trigger="click"
24
+ placement="bottom"
25
+ yOnly={full}
26
+ {...$$restProps}
27
+ class={wrapperClass}
28
+ on:show
29
+ bind:open>
30
+ <div class="flex flex-col md:flex-row p-4 max-w-screen-md justify-center mx-auto">
19
31
  <ul class={ulClass}>
20
32
  {#each items as item, index}
21
33
  <li>
@@ -27,4 +39,4 @@ const init = (node) => {
27
39
  </ul>
28
40
  {#if full && $$slots.extra}<div class="md:w-1/3 mt-4 md:mt-0"><slot name="extra" /></div>{/if}
29
41
  </div>
30
- </div>
42
+ </Popper>
@@ -7,8 +7,11 @@ declare const __propDef: {
7
7
  [propName: string]: any;
8
8
  })[];
9
9
  full?: boolean;
10
+ open?: boolean;
10
11
  };
11
12
  events: {
13
+ show: CustomEvent<any>;
14
+ } & {
12
15
  [evt: string]: CustomEvent<any>;
13
16
  };
14
17
  slots: {
@@ -1,13 +1,9 @@
1
- <script>import classNames from 'classnames';
1
+ <script>import ToolbarButton from '../toolbar/ToolbarButton.svelte';
2
+ import classNames from 'classnames';
2
3
  import Menu from './Menu.svelte';
3
- export let btnClass = 'ml-3 inline-flex items-center rounded-lg p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600 md:hidden';
4
+ export let btnClass = 'ml-3 md:hidden';
4
5
  </script>
5
6
 
6
- <button
7
- {...$$restProps}
8
- class={classNames(btnClass, $$props.class)}
9
- data-testid="navbar-toggle"
10
- on:click>
11
- <span class="sr-only">Open main menu</span>
7
+ <ToolbarButton name="Open main menu" on:click {...$$restProps} class={classNames(btnClass, $$props.class)}>
12
8
  <Menu class="h-6 w-6 shrink-0" />
13
- </button>
9
+ </ToolbarButton>
@@ -1,9 +1,10 @@
1
1
  <script>import classNames from 'classnames';
2
2
  export let href = '';
3
3
  export let active = false;
4
- export let activeClass = 'block py-2 pr-4 pl-3 text-white bg-blue-700 rounded md:bg-transparent md:text-blue-700 md:p-0 dark:text-white';
5
- export let nonActiveClass = 'block 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';
6
- $: aClass = active ? activeClass : nonActiveClass;
4
+ export let activeClass = 'text-white bg-blue-700 md:bg-transparent md:text-blue-700 md:dark:text-white dark:bg-blue-600 md:dark:bg-transparent';
5
+ export let nonActiveClass = 'text-gray-700 hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 dark:text-gray-400 md:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent';
6
+ let liClass;
7
+ $: liClass = classNames('block py-2 pr-4 pl-3 md:p-0 rounded md:border-0', active ? activeClass : nonActiveClass, $$props.class);
7
8
  </script>
8
9
 
9
10
  <li>
@@ -21,7 +22,7 @@ $: aClass = active ? activeClass : nonActiveClass;
21
22
  on:mouseenter
22
23
  on:mouseleave
23
24
  on:mouseover
24
- class={classNames(aClass, $$props.class)}>
25
+ class={liClass}>
25
26
  <slot />
26
27
  </svelte:element>
27
28
  </li>
@@ -1,25 +1,27 @@
1
1
  <script>import classNames from 'classnames';
2
2
  import { slide } from 'svelte/transition';
3
3
  import { quintOut } from 'svelte/easing';
4
+ import Frame from '../utils/Frame.svelte';
4
5
  export let divClass = 'w-full md:block md:w-auto';
5
- export let ulClass = 'flex flex-col mt-4 md:flex-row md:space-x-8 md:mt-0 md:text-sm md:font-medium';
6
+ export let ulClass = 'flex flex-col p-4 mt-4 md:flex-row md:space-x-8 md:mt-0 md:text-sm md:font-medium';
6
7
  export let hidden = true;
8
+ let _divClass;
9
+ $: _divClass = classNames(divClass, $$props.class);
10
+ let _ulClass;
11
+ $: _ulClass = classNames(ulClass,
12
+ // 'divide-y md:divide-y-0 divide-gray-100 dark:divide-gray-700',
13
+ $$props.class);
7
14
  </script>
8
15
 
9
16
  {#if !hidden}
10
- <div
11
- {...$$restProps}
12
- class={classNames(divClass, $$props.class)}
13
- id="mobile-menu"
14
- transition:slide={{ delay: 250, duration: 500, easing: quintOut }}
15
- >
16
- <ul class={classNames(ulClass, $$props.class)}>
17
+ <div {...$$restProps} class={_divClass} transition:slide={{ delay: 250, duration: 500, easing: quintOut }}>
18
+ <Frame tag="ul" border rounded color="navbarUl" class={_ulClass}>
17
19
  <slot />
18
- </ul>
20
+ </Frame>
19
21
  </div>
20
22
  {:else}
21
- <div {...$$restProps} class={classNames(divClass, $$props.class)} {hidden} id="mobile-menu">
22
- <ul class={classNames(ulClass, $$props.class)}>
23
+ <div {...$$restProps} class={_divClass} {hidden}>
24
+ <ul class={_ulClass}>
23
25
  <slot />
24
26
  </ul>
25
27
  </div>
@@ -1,31 +1,17 @@
1
- <script>import classNames from 'classnames';
2
- export let navClass = 'bg-white border-gray-200 px-2 sm:px-4 py-2.5 dark:bg-gray-800';
1
+ <script>import Frame from '../utils/Frame.svelte';
2
+ import classNames from 'classnames';
3
+ export let navClass = 'px-2 sm:px-4 py-2.5';
3
4
  export let navDivClass = 'mx-auto flex flex-wrap justify-between items-center ';
4
5
  export let fluid = true;
5
- export let rounded = false;
6
- export let border = false;
6
+ export let color = 'navbar';
7
7
  let hidden = true;
8
8
  let toggle = () => {
9
9
  hidden = !hidden;
10
10
  };
11
11
  </script>
12
12
 
13
- <nav
14
- {...$$restProps}
15
- class={classNames(
16
- navClass,
17
- {
18
- rounded: rounded,
19
- border: border
20
- },
21
- $$props.class
22
- )}
23
- >
24
- <div
25
- class={classNames(navDivClass, {
26
- container: fluid
27
- })}
28
- >
13
+ <Frame tag="nav" {color} {...$$restProps} class={classNames(navClass, $$props.class)}>
14
+ <div class={classNames(navDivClass, fluid && 'container')}>
29
15
  <slot {hidden} {toggle} />
30
16
  </div>
31
- </nav>
17
+ </Frame>
@@ -5,8 +5,7 @@ declare const __propDef: {
5
5
  navClass?: string;
6
6
  navDivClass?: string;
7
7
  fluid?: boolean;
8
- rounded?: boolean;
9
- border?: boolean;
8
+ color?: string;
10
9
  };
11
10
  events: {
12
11
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "0.26.9",
3
+ "version": "0.26.10",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -23,9 +23,7 @@ const sizing = {
23
23
  };
24
24
  let buttonClass;
25
25
  $: buttonClass = classNames('focus:outline-none whitespace-normal', sizing[size], colors[color], color === 'default' &&
26
- (background
27
- ? 'hover:bg-gray-100 dark:hover:bg-gray-600'
28
- : 'hover:bg-gray-100 dark:hover:bg-gray-700'), $$props.class);
26
+ (background ? 'hover:bg-gray-100 dark:hover:bg-gray-600' : 'hover:bg-gray-100 dark:hover:bg-gray-700'), $$props.class);
29
27
  const svgSizes = {
30
28
  xs: 'w-3 h-3',
31
29
  sm: 'w-3.5 h-3.5',
@@ -33,20 +31,14 @@ const svgSizes = {
33
31
  };
34
32
  </script>
35
33
 
36
- <button on:click type="button" class={buttonClass} aria-label={ariaLabel ?? name}>
34
+ <button on:click type="button" {...$$restProps} class={buttonClass} aria-label={ariaLabel ?? name}>
37
35
  {#if name}<span class="sr-only">{name}</span>{/if}
38
36
  <slot>
39
- <svg
40
- class={svgSizes[size]}
41
- fill="currentColor"
42
- viewBox="0 0 20 20"
43
- xmlns="http://www.w3.org/2000/svg"
44
- >
37
+ <svg class={svgSizes[size]} fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
45
38
  <path
46
39
  fill-rule="evenodd"
47
40
  d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
48
- clip-rule="evenodd"
49
- />
41
+ clip-rule="evenodd" />
50
42
  </svg>
51
43
  </slot>
52
44
  </button>
@@ -2,7 +2,9 @@
2
2
  import ChevronLeft from './ChevronLeft.svelte';
3
3
  import ChevronUp from './ChevronUp.svelte';
4
4
  import ChevronRight from './ChevronRight.svelte';
5
+ import Wrapper from './Wrapper.svelte';
5
6
  export let placement = 'bottom';
7
+ export let aligned = false;
6
8
  const icons = {
7
9
  top: ChevronUp,
8
10
  right: ChevronRight,
@@ -14,10 +16,12 @@ let icon;
14
16
  $: icon = icons[placement.split('-')[0]] ?? ChevronDown;
15
17
  </script>
16
18
 
17
- {#if placement.split('-')[0] === 'left'}
18
- <ChevronLeft class="h-4 w-4 mr-2" />
19
- <slot />
20
- {:else}
21
- <slot />
22
- <svelte:component this={icon} class="h-4 w-4 ml-2" />
23
- {/if}
19
+ <Wrapper class="flex items-center justify-between" show={aligned}>
20
+ {#if placement.split('-')[0] === 'left'}
21
+ <ChevronLeft class="h-4 w-4 mr-2" />
22
+ <slot />
23
+ {:else}
24
+ <slot />
25
+ <svelte:component this={icon} class="h-4 w-4 ml-2" />
26
+ {/if}
27
+ </Wrapper>
@@ -3,6 +3,7 @@ import type { Placement } from '@popperjs/core';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  placement?: Placement;
6
+ aligned?: boolean;
6
7
  };
7
8
  events: {
8
9
  [evt: string]: CustomEvent<any>;
@@ -29,6 +29,10 @@ const bgColors = {
29
29
  light: 'bg-gray-50 dark:bg-gray-700',
30
30
  dark: 'bg-gray-100 dark:bg-gray-700',
31
31
  default: 'bg-white dark:bg-gray-800',
32
+ dropdown: 'bg-white dark:bg-gray-700',
33
+ navbar: 'bg-white dark:bg-gray-900',
34
+ navbarUl: 'bg-gray-50 dark:bg-gray-800',
35
+ form: 'bg-gray-50 dark:bg-gray-700',
32
36
  none: ''
33
37
  };
34
38
  const textColors = {
@@ -43,6 +47,10 @@ const textColors = {
43
47
  light: 'text-gray-700 dark:text-gray-300',
44
48
  dark: 'text-gray-700 dark:text-gray-300',
45
49
  default: 'text-gray-500 dark:text-gray-400',
50
+ dropdown: 'text-gray-500 dark:text-gray-400',
51
+ navbar: 'text-gray-700 dark:text-gray-200',
52
+ navbarUl: 'text-gray-700 dark:text-gray-400',
53
+ from: 'text-gray-900 dark:text-white',
46
54
  none: ''
47
55
  };
48
56
  const borderColors = {
@@ -57,6 +65,10 @@ const borderColors = {
57
65
  light: 'border-gray-500',
58
66
  dark: 'border-gray-500',
59
67
  default: 'border-gray-200 dark:border-gray-700',
68
+ dropdown: 'border-gray-100 dark:border-gray-700',
69
+ navbar: 'border-gray-100 dark:border-gray-700',
70
+ navbarUl: 'border-gray-100 dark:border-gray-700',
71
+ form: 'border-gray-300 dark:border-gray-700',
60
72
  none: ''
61
73
  };
62
74
  // have a custom transition function that returns the desired transition
@@ -4,7 +4,7 @@ import type { TransitionConfig } from 'svelte/transition';
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  [x: string]: any;
7
- tag?: 'div' | 'a';
7
+ tag?: 'div' | 'a' | 'nav' | 'ul';
8
8
  color?: string;
9
9
  rounded?: boolean;
10
10
  border?: boolean;
@@ -9,7 +9,9 @@ export let offset = 8;
9
9
  export let placement = 'top';
10
10
  export let trigger = 'hover';
11
11
  export let triggeredBy = undefined;
12
+ export let strategy = 'absolute';
12
13
  export let open = false;
14
+ export let yOnly = false;
13
15
  const dispatch = createEventDispatcher();
14
16
  let clickable;
15
17
  $: clickable = trigger === 'click';
@@ -53,8 +55,16 @@ const hideHandler = (ev) => {
53
55
  function init(node, _triggerEl) {
54
56
  popper = createPopper(_triggerEl, node, {
55
57
  placement,
58
+ strategy,
56
59
  modifiers: [
57
- { name: 'offset', options: { offset: [0, offset] } },
60
+ {
61
+ name: 'offset',
62
+ options: {
63
+ offset: ({ placement, reference, popper }) => {
64
+ return [yOnly ? popper.width / 2 - reference.width / 2 - reference.x : 0, offset];
65
+ }
66
+ }
67
+ },
58
68
  { name: 'eventListeners', enabled: open }
59
69
  ]
60
70
  });
@@ -9,7 +9,9 @@ declare const __propDef: {
9
9
  placement?: Placement;
10
10
  trigger?: 'hover' | 'click';
11
11
  triggeredBy?: string;
12
+ strategy?: 'absolute' | 'fixed';
12
13
  open?: boolean;
14
+ yOnly?: boolean;
13
15
  };
14
16
  events: {
15
17
  [evt: string]: CustomEvent<any>;