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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ewc-lib/ewc-treeselect

v0.0.7-alpha

Published

Repo for EWC-treeselect WebComponent

Readme

EWC treeselect Component

A dropdown box, which presents a hierarchical tree view, including checkbox-based multi-selection and integrated filtering.

Documentation

For features, requirements, specification and test cases, see documentation

Screenshot

API

Attributes and Properties

The following attributes and properties are available and can be modified at runtime:

| Attribute | Property | Default | Run-time modifiable | Description |----------------|------------|---------|---------------------|----- | - | data (setter)| | no | Sets the items ("options"). Please see here for the format and an example. | allow-empty-selection| - | false | yes | Should it be possible to have no element selected at all? false when attribute is missing or set to "false", true otherwise | collective-term | - | "Items selected" | no | A text displayed in the head in case >1 items are selected | query-placeholder | - | "Search..." | yes | A text displayed in the search query text input box in case it's empty | ignore-case | - | true | no | Should letter casing be ignored in the query input regarding search/filter functionality. false when attribute is missing or set to "false", true otherwise | auto-select-children | - | true | yes | Should children also be selected when a parent element is selected? | no-match-infotext| - | "No items available" | no | A text displayed when there is no match for the query input | isLocked | - | false | yes | If true, the component's state can't be modified (eg change selection, search), while interaction that doesn't change it's state are still allowed (eg open/close, change mode, etc.) | reset-label | - | "Reset" | yes | The label for the reset button | clear-label | - | "Clear" | yes | The label for the clear search query button | general-label | - | "" | yes | The label for the whole component. | - | selectCallback (setter) | - | yes | If set, is invoked after a user clicks/enter-keys an item but before it is actually selected/deselected. If callback returns false, no actual de-/selection happens - true permits the de-/selection. | - | selected (getter) | | | Returns array of objects of currently selected items. Each object has "id" and "label" property.

selectCallback

The callback receives two parameters: clickedItemData and selectedItems.

  • clickedItemData: an object w/ props "id", "label" of the clicked item, as well as "isGoingToBeSelected", which is true in case the user attempts a selection, false in case of deselection.
// Example of clickedItemData:
{id: '11', label: 'Tofu', isGoingToBeSelected: true}
  • selectedItems is an array, containing objects (w/ props "id" and "label") of the currently selected items.

Methods

| Method | Description |-------------|----- | isOpen() | true if the dropdown is visible, false if not | toggle() | opens/closes the dropdown | open() | opens the dropdown | close() | closes the dropdown

Event

  • onSelected: Is fired when a selection actually happened - i.e.
    • in case selectCallback is omitted: always
    • in case selectCallback is set and returns true

The event's detail property is an array. It contains objects of all selected elements (properties id and label), similar to selected getter.

Style

| Custom Property | Default | Description |---------------------|---------|----- |--dropdown-height | 400px | determines the height of the dropdown

Usage

Installation

npm install @ewc-lib/ewc-treeselect

Import the component in your application:

// Using ES modules
import "@ewc-lib/ewc-css-common/custom-props.css";
import '@ewc-lib/ewc-treeselect';

Note about ewc-css-common

  • "ewc-css-common/custom-props.css" is necessary for the correct styling of this component.
  • It needs to be imported by the host project because it's not imported by this component implicitly.

Notes

Accessibility

The component is designed with accessibility in mind:

  • Keyboard navigable element
  • Sufficient color contrast

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Edge (latest)

License

European Union Public License (EUPL)

Known issues

  • searching doesn't expand matched branches (but yellow marks parents' expand button)
  • don't yellow-mark the current parent's expand button if a match is only in that parent item, but in no children [currently: any expand btn of a node having a match is yellowed]

Changelog

  • 0.0.7-alpha

    • add config options to demo page
    • collective term support runtime modification
    • focus after kbd opening dropdown
  • 0.0.6-alpha

    • fix Missing items in show-selected mode
    • fix Reset btn height
    • Avoid event fired on Collapse/Expand
  • 0.0.5-alpha

    • styling
  • 0.0.4-alpha

    • improved screenreader support
  • 0.0.3-alpha

    • refactoring
  • 0.0.2-alpha

    • first alpha RC
  • 0.0.1-alpha

    • intial commit