GithubHelp home page GithubHelp logo

askingquestions / svelte-smooth-popover Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 1.0 4.67 MB

A robust, unstyled popover component for Svelte with a customizable smooth/sharp caret

Home Page: https://svelte-smooth-popover.jrmy.dev/

License: MIT License

HTML 1.15% Svelte 96.24% TypeScript 1.23% JavaScript 1.39%

svelte-smooth-popover's People

Contributors

askingquestions avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vardkin

svelte-smooth-popover's Issues

Expose Alignment interface at the top-level

It would be nice to re-expose Alignment interface at the top-level.

// Reexport your entry components here
import Popover, { type Alignment } from './Popover.svelte';

export { Popover, type Alignment };

That way, consumers can import like so:

import type { Alignment } from 'svelte-smooth-popover';

Instead of

import type { Alignment } from 'svelte-smooth-popover/Popover.svelte';

First-Use Challenges

Hello. Thank you for a very comprehensive and potentially easy-to-use Popover package for Svelte.

In attempting to use the component ("svelte": "^4.2.7"), I have encountered some challenges:

  • a) vite-plugin-svelte warning: Upon executing npm run dev, the following warning is emitted:
[vite-plugin-svelte] WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte.

[email protected]

Please see https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#missing-exports-condition for details.
  • b) Usability: With the following code:
<script lang="ts">
  import { Popover } from 'svelte-smooth-popover';
  import { browser } from '$app/environment';
  $: open = false;
</script>

<button>
  Example
  <Popover
    align="top-center"
    {open}
    showOnClick={true}
    borderRadius={10}
    caretWidth={7}
    offset={10}
    caretCurveAmount={1}
    caretCurveTopAngle={-15}
    caretCurveTopStrength={0.33}
    caretCurveBottomAngle={15}
    caretCurveBottomStrength={0.66}
    alignAnchor="auto"
  >
    <div
      style="border-radius: 10px;"
      class="flex min-w-[200px] items-center justify-center bg-slate-400 p-10 text-black"
    >
      <button class="rounded-md bg-cyan-700 px-2 text-sm text-white" on:click={() => (open = false)}>
                 Done
            </button>
    </div>
  </Popover>
</button>
  1. The caret does not display
  2. I cannot close the Popover programmatically even when I make the open prop reactive (as in the button inside the div)

Is there something that I am missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.