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

@chameleon-ds/accordions

v4.0.1

Published

Chameleon accordions

Downloads

3

Readme

Chameleon Accordions

import { html, svg } from "lit-html";
import "./chameleon-accordion.js";
import "./chameleon-accordions.js";

export default {
  title: "Components|Data and Visualizations/Accordions",
  component: "chameleon-accordions",
  options: { selectedPanel: "storybook/docs/panel" },
};

Properties

chameleon-accordions

| Property Name | Type(s) | Default Value | Description | | ------------- | ------- | ------------- | ------------------------------------------ | | accordions | Array | [] | Stores references to registered accordions |

chameleon-accordion

| Property Name | Type(s) | Default Value | Description | | ------------- | ------- | ------------- | ----------------------------------------------------- | | expanded | Boolean | false | Determines if the accordion appears expanded | | caret | Boolean | true | When false, the caret icon will not display | | accentColor | String | null | The CSS color value to be applied to the accent color | | uid | String | "" | A random/unique identifier for this accordion |

If you're nesting accordions inside your own components and subscribing them to chameleon-accordions and need to track whether or not they're expanded, you can use:

| Event Name | Composed | Bubbles | Description | | ---------- | -------- | ------- | ----------------------------------------------------------- | | expanded | false | false | Dispatched when the accordionEl.expanded property changes |

CSS Properties

chameleon-accordions

| Property Name | Default Value | | ------------------- | ------------- | | --accordion-width | 100% |

chameleon-accordion

| Property Name | Default Value | | ------------------------------ | ------------- | | --accordion-background-color | #ffffff |

Examples

Default

<chameleon-accordions> will automatically register any <chameleon-accordion> descendant and make sure only one accordion can be open at a time.

export const Default = () => html`
  <chameleon-accordions>
    <chameleon-accordion>
      <h4 slot="header">Tower Grove</h4>
      <section slot="panel">
        Tower Grove South is a neighborhood of south St. Louis, Missouri.
        Formerly known as Oak Hill, Tower Grove South is bounded by Arsenal
        Street on the north, Chippewa Street on the south, Kingshighway
        Boulevard on the west, and Grand Boulevard on the east.
      </section>
    </chameleon-accordion>
    <chameleon-accordion>
      <h4 slot="header">Benton Park</h4>
      <section slot="panel">
        Benton Park is a neighborhood in southside St. Louis, Missouri, just
        west of the Soulard neighborhood. The official boundaries of the area
        are Gravois Avenue on the north, Cherokee Street on the south, I-55 on
        the east, and Jefferson Avenue on the west.
      </section>
    </chameleon-accordion>
    <chameleon-accordion>
      <h4 slot="header">Soulard</h4>
      <section slot="panel">
        Known for its blues scene, buzzing Soulard has raucous bars with live
        music alongside casual pizzerias, down-to-earth Southern restaurants and
        seafood spots serving oysters and crawfish. Established in 1779, Soulard
        Farmers Market displays a colorful spread of produce, meats and cheeses,
        while the huge, 19th-century Anheuser-Busch Brewery offers tours. The
        area’s lively annual Mardi Gras parade draws big crowds.
      </section>
    </chameleon-accordion>
  </chameleon-accordions>
`;

Individual Accordions

If you don't want that, you can use <chameleon-accordion> on it's own!

export const IndividualAccordions = () => html`
  <chameleon-accordion>
    <h4 slot="header">Tower Grove</h4>
    <section slot="panel">
      Tower Grove South is a neighborhood of south St. Louis, Missouri. Formerly
      known as Oak Hill, Tower Grove South is bounded by Arsenal Street on the
      north, Chippewa Street on the south, Kingshighway Boulevard on the west,
      and Grand Boulevard on the east.
    </section>
  </chameleon-accordion>
  <chameleon-accordion>
    <h4 slot="header">Benton Park</h4>
    <section slot="panel">
      Benton Park is a neighborhood in southside St. Louis, Missouri, just west
      of the Soulard neighborhood. The official boundaries of the area are
      Gravois Avenue on the north, Cherokee Street on the south, I-55 on the
      east, and Jefferson Avenue on the west.
    </section>
  </chameleon-accordion>
  <chameleon-accordion>
    <h4 slot="header">Soulard</h4>
    <section slot="panel">
      Known for its blues scene, buzzing Soulard has raucous bars with live
      music alongside casual pizzerias, down-to-earth Southern restaurants and
      seafood spots serving oysters and crawfish. Established in 1779, Soulard
      Farmers Market displays a colorful spread of produce, meats and cheeses,
      while the huge, 19th-century Anheuser-Busch Brewery offers tours. The
      area’s lively annual Mardi Gras parade draws big crowds.
    </section>
  </chameleon-accordion>
`;

Accent Color

export const AccentColor = () => html`
  <chameleon-accordions>
    <chameleon-accordion accentColor>
      <h4 slot="header">Tower Grove</h4>
      <section slot="panel">
        Tower Grove South is a neighborhood of south St. Louis, Missouri.
        Formerly known as Oak Hill, Tower Grove South is bounded by Arsenal
        Street on the north, Chippewa Street on the south, Kingshighway
        Boulevard on the west, and Grand Boulevard on the east.
      </section>
    </chameleon-accordion>
    <chameleon-accordion accentColor>
      <h4 slot="header">Benton Park</h4>
      <section slot="panel">
        Benton Park is a neighborhood in southside St. Louis, Missouri, just
        west of the Soulard neighborhood. The official boundaries of the area
        are Gravois Avenue on the north, Cherokee Street on the south, I-55 on
        the east, and Jefferson Avenue on the west.
      </section>
    </chameleon-accordion>
    <chameleon-accordion accentColor>
      <h4 slot="header">Soulard</h4>
      <section slot="panel">
        Known for its blues scene, buzzing Soulard has raucous bars with live
        music alongside casual pizzerias, down-to-earth Southern restaurants and
        seafood spots serving oysters and crawfish. Established in 1779, Soulard
        Farmers Market displays a colorful spread of produce, meats and cheeses,
        while the huge, 19th-century Anheuser-Busch Brewery offers tours. The
        area’s lively annual Mardi Gras parade draws big crowds.
      </section>
    </chameleon-accordion>
  </chameleon-accordions>
`;

No Caret

export const NoCaret = () => html`
  <chameleon-accordions>
    <chameleon-accordion .caret="${false}">
      <h4 slot="header">Tower Grove</h4>
      <section slot="panel">
        Tower Grove South is a neighborhood of south St. Louis, Missouri.
        Formerly known as Oak Hill, Tower Grove South is bounded by Arsenal
        Street on the north, Chippewa Street on the south, Kingshighway
        Boulevard on the west, and Grand Boulevard on the east.
      </section>
    </chameleon-accordion>
    <chameleon-accordion .caret="${false}">
      <h4 slot="header">Benton Park</h4>
      <section slot="panel">
        Benton Park is a neighborhood in southside St. Louis, Missouri, just
        west of the Soulard neighborhood. The official boundaries of the area
        are Gravois Avenue on the north, Cherokee Street on the south, I-55 on
        the east, and Jefferson Avenue on the west.
      </section>
    </chameleon-accordion>
    <chameleon-accordion .caret="${false}">
      <h4 slot="header">Soulard</h4>
      <section slot="panel">
        Known for its blues scene, buzzing Soulard has raucous bars with live
        music alongside casual pizzerias, down-to-earth Southern restaurants and
        seafood spots serving oysters and crawfish. Established in 1779, Soulard
        Farmers Market displays a colorful spread of produce, meats and cheeses,
        while the huge, 19th-century Anheuser-Busch Brewery offers tours. The
        area’s lively annual Mardi Gras parade draws big crowds.
      </section>
    </chameleon-accordion>
  </chameleon-accordions>
`;

Custom Icon

const heartIcon = svg`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-heart"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path></svg>`;

export const CustomIcon = () => html`
  <chameleon-accordions>
    <chameleon-accordion>
      <span slot="toggle-icon">${heartIcon}</span>
      <h4 slot="header">Tower Grove</h4>
      <section slot="panel">
        Tower Grove South is a neighborhood of south St. Louis, Missouri.
        Formerly known as Oak Hill, Tower Grove South is bounded by Arsenal
        Street on the north, Chippewa Street on the south, Kingshighway
        Boulevard on the west, and Grand Boulevard on the east.
      </section>
    </chameleon-accordion>
    <chameleon-accordion>
      <span slot="toggle-icon">${heartIcon}</span>
      <h4 slot="header">Benton Park</h4>
      <section slot="panel">
        Benton Park is a neighborhood in southside St. Louis, Missouri, just
        west of the Soulard neighborhood. The official boundaries of the area
        are Gravois Avenue on the north, Cherokee Street on the south, I-55 on
        the east, and Jefferson Avenue on the west.
      </section>
    </chameleon-accordion>
    <chameleon-accordion>
      <span slot="toggle-icon">${heartIcon}</span>
      <h4 slot="header">Soulard</h4>
      <section slot="panel">
        Known for its blues scene, buzzing Soulard has raucous bars with live
        music alongside casual pizzerias, down-to-earth Southern restaurants and
        seafood spots serving oysters and crawfish. Established in 1779, Soulard
        Farmers Market displays a colorful spread of produce, meats and cheeses,
        while the huge, 19th-century Anheuser-Busch Brewery offers tours. The
        area’s lively annual Mardi Gras parade draws big crowds.
      </section>
    </chameleon-accordion>
  </chameleon-accordions>
`;