npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

svelte-complete

v0.0.1

Published

A simple autocomplete component for Svelte that fully supports RTL.

Downloads

2

Readme

Svelte Complete

A simple autocomplete component for Svelte that fully supports RTL.

🔧 Installation

Work in progress.

❓ Usage

Minimalist Example

<script>
    import Autocomplete from "svelte-complete";

    let items = ["apple", "banana", "orange"];
    let value;
</script>

<Autocomplete {items} bind:value="{value}" />

Component Properties

| Property Name | Type | Description | Default Value | |-------------------------|------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------| | displayField | string | When providing an object array displayField will be used to determine which field in the object will be displayed in the suggestions list | Empty string | | highlightCharacters | "matched", or "unmatched" | Will highlight the matching/non matching characters based on the input | "matched" | | item | string[], or object[] | The list of items to be used by the autocomplete | Empty array | | noResultsMessage | string | The message to be displayed when no item matches the given input | "No results found" | | setItemsOnFocus | () => Promise<any[]> | A lambda that allows for setting the item array when the autocomplete component is focused instead of when it is instantiated | Returns an empty array | | sort | "ascend", "descend", or ((a: any, b: any) => number) | The sorting algorithm for the given items array, descend and ascend sorts only apply to a string array, for an objects array provide your own implementation | "ascend" | | textDirection | "auto", "ltr", or "rtl" | Use this property if you want to use the autocomplete in RTL mode, not required if parent's dir is set to "rtl" | "auto" | | value | string | The currently selected value | Empty string |


Component CSS Variables

| CSS Variable Name | Description | Default Value | |---------------------------------------------------|------------------------------------------------------------|----------------------------------| | --autocomplete-active-suggestion-background-color | Sets background color for an active/hovered suggestion | rgb(115 115 115 / 0.2) | | --autocomplete-container-height | Sets the height for the autocomplete component | fit-content | | --autocomplete-container-width | Sets the width for the autocomplete component | fit-content | | --autocomplete-input-background-color | Sets the background color for the autocomplete input | rgb(250 250 250) | | --autocomplete-input-border-color | Sets the border color for the autocomplete input | rgb(115 115 115) | | --autocomplete-input-border-width | Sets the border width for the autocomplete input | 1px | | --autocomplete-input-icon-color | Sets the color for the icon in the input box | var(--autocomplete-text-color) | | --autocomplete-input-width | Sets the width for the input box | 100% | | --autocomplete-input-x-padding | Sets the x axis padding for the input box | 0.5rem | | --autocomplete-input-y-padding | Sets the y axis padding for the input box | 0.5rem | | --autocomplete-no-results-text--color | Sets the text color for the no results message | rgb(64 64 64) | | --autocomplete-suggestion-text-color | Sets the text color for a suggestion | var(--autocomplete-text-color) | | --autocomplete-suggestions-list-background-color | Sets the background color for the suggestions list | rgb(250 250 250) | | --autocomplete-suggestions-list-z-index | Sets the z-index for the suggestions list | 10 | | --autocomplete-text-color | Sets the general text color for the autocomplete container | rgb(23 23 23) |