AlaskaAirlines / auro-dropdown

A custom element that is a trigger and dropdown element combination intended to be used with dropdown content that is interactive.
http://auro.alaskaair.com/components/auro/dropdown
Apache License 2.0
3 stars 1 forks source link

As a developer I need help with trigger slot usage/purpose #115

Closed steve-nickerson closed 2 years ago

steve-nickerson commented 2 years ago

General Support Request

Support request

There is not great documentation on what the trigger slot is or does, just that it is there. I need an example of using the dropdown e.g.) where you select an option from menu, and it closes the popup and shows the desired selection.

I'm working with plain html project so nothing crazy going on. Is there assumption that someone would know what trigger does or how to use it?

I also don't see any default behavior for a click / select event to close the popup. that was default in labs if I recall.

Possible Solution

Below is what ive started playing with. If I put something in Trigger it shows, but never changes.

<auro-dropdown id="fc" chevron bordered rounded inset>
      <span slot="label">Options</span>
      <span slot="trigger"></span>
      <auro-menu>
        <auro-menuoption value="1">One</auro-menuoption>
        <auro-menuoption value="2">Two</auro-menuoption>
        <auro-menuoption  value="3">Three</auro-menuoption>
        <auro-menuoption  value="4">Four</auro-menuoption>
      </auro-menu>
    </auro-dropdown>
import "@aurodesignsystem/auro-dropdown";
import "@aurodesignsystem/auro-menu";
import "@alaskaairux/auro-button";
import "@alaskaairux/auro-icon";

import "@alaskaairux/design-tokens/dist/tokens/CSSCustomProperties.css";
import "@alaskaairux/webcorestylesheets/dist/bundled/essentials.css";

const clicked = ev => {
// im sure this is NOT how to do this, but it works lol

  ev.target.parentElement.parentElement.hide();
}

document.querySelector("#fc").addEventListener("dropdownToggled", ev => console.log("toggled"));
document.querySelectorAll("#fc auro-menuoption").forEach(o => o.addEventListener("click", clicked));
image

Context

working on trying to upgrade from aurolabs version which we had working for new microsite (which is react) but first want to understand how this works in vanilla html.

Your Environment

thanks!

blackfalcon commented 2 years ago

@steve-nickerson is this related to the conversation we had regarding using the auro-select element?

steve-nickerson commented 2 years ago

no worries on this. auro-select is what we needed.