import { focusVisible } from "./chunk.XAZSQ3AT.js"; import { animateTo, shimKeyframesHeightAuto, stopAnimations, waitForEvent } from "./chunk.CTCDC263.js"; import { getAnimation, setDefaultAnimation } from "./chunk.NC36RJW4.js"; import { event, watch } from "./chunk.XX234VRK.js"; import { e as e2 } from "./chunk.YXKHB4AC.js"; import { T, e, h, n, o, r } from "./chunk.5PIDMFOE.js"; import { __decorateClass } from "./chunk.IHGPZX35.js"; // _uyihdawu1:/Users/claviska/Projects/shoelace/src/components/details/details.scss var details_default = ":host {\n position: relative;\n box-sizing: border-box;\n}\n:host *, :host *:before, :host *:after {\n box-sizing: inherit;\n}\n\n[hidden] {\n display: none !important;\n}\n\n:host {\n display: block;\n}\n\n.details {\n border: solid 1px var(--sl-color-gray-200);\n border-radius: var(--sl-border-radius-medium);\n overflow-anchor: none;\n}\n\n.details--disabled {\n opacity: 0.5;\n}\n\n.details__header {\n display: flex;\n align-items: center;\n border-radius: inherit;\n padding: var(--sl-spacing-medium);\n user-select: none;\n cursor: pointer;\n}\n.details__header:focus {\n outline: none;\n}\n\n.focus-visible .details__header:focus {\n box-shadow: 0 0 0 var(--sl-focus-ring-width) var(--sl-focus-ring-color-primary);\n}\n\n.details--disabled .details__header {\n cursor: not-allowed;\n}\n.details--disabled .details__header:focus {\n outline: none;\n box-shadow: none;\n}\n\n.details__summary {\n flex: 1 1 auto;\n display: flex;\n align-items: center;\n}\n\n.details__summary-icon {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n transition: var(--sl-transition-medium) transform ease;\n}\n\n.details--open .details__summary-icon {\n transform: rotate(90deg);\n}\n\n.details__body {\n overflow: hidden;\n}\n\n.details__content {\n padding: var(--sl-spacing-medium);\n}"; // src/components/details/details.ts var id = 0; var SlDetails = class extends h { constructor() { super(...arguments); this.componentId = `details-${++id}`; this.hasInitialized = false; this.open = false; this.disabled = false; } connectedCallback() { super.connectedCallback(); this.updateComplete.then(() => focusVisible.observe(this.details)); } firstUpdated() { this.body.hidden = !this.open; this.body.style.height = this.open ? "auto" : "0"; this.updateComplete.then(() => this.hasInitialized = true); } disconnectedCallback() { super.disconnectedCallback(); focusVisible.unobserve(this.details); } async show() { if (this.open) { return; } this.open = true; return waitForEvent(this, "sl-after-show"); } async hide() { if (!this.open) { return; } this.open = false; return waitForEvent(this, "sl-after-hide"); } handleSummaryClick() { if (!this.disabled) { this.open ? this.hide() : this.show(); this.header.focus(); } } handleSummaryKeyDown(event2) { if (event2.key === "Enter" || event2.key === " ") { event2.preventDefault(); this.open ? this.hide() : this.show(); } if (event2.key === "ArrowUp" || event2.key === "ArrowLeft") { event2.preventDefault(); this.hide(); } if (event2.key === "ArrowDown" || event2.key === "ArrowRight") { event2.preventDefault(); this.show(); } } async handleOpenChange() { if (!this.hasInitialized) { return; } if (this.open) { this.slShow.emit(); await stopAnimations(this); this.body.hidden = false; const { keyframes, options } = getAnimation(this, "details.show"); await animateTo(this.body, shimKeyframesHeightAuto(keyframes, this.body.scrollHeight), options); this.body.style.height = "auto"; this.slAfterShow.emit(); } else { this.slHide.emit(); await stopAnimations(this); const { keyframes, options } = getAnimation(this, "details.hide"); await animateTo(this.body, shimKeyframesHeightAuto(keyframes, this.body.scrollHeight), options); this.body.hidden = true; this.body.style.height = "auto"; this.slAfterHide.emit(); } } render() { return T`