/**
 * Copyright IBM Corp. 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

import "../../globals/settings.js";
import { forEach } from "../../globals/internal/collection-helpers.js";
import { carbonElement } from "../../globals/decorators/carbon-element.js";
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.126.0/helpers/decorate.js";
import FocusMixin from "../../globals/mixins/focus.js";
import structured_list_default$1 from "./structured-list.scss.js";
import { LitElement, html } from "lit";
import { property } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
//#region src/components/structured-list/structured-list.ts
/**
* Copyright IBM Corp. 2019, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* Structured list wrapper.
*
* @element cds-structured-list
*/
let CDSStructuredList = class CDSStructuredList extends FocusMixin(LitElement) {
	constructor(..._args) {
		super(..._args);
		this.selectionName = "";
		this.condensed = false;
		this.flush = false;
	}
	connectedCallback() {
		if (!this.hasAttribute("role")) this.setAttribute("role", "table");
		super.connectedCallback();
	}
	shouldUpdate(changedProperties) {
		if (changedProperties.has("selectionName")) forEach(this.querySelectorAll(this.constructor.selectorRowsWithHeader), (elem) => {
			elem.selectionName = this.selectionName;
		});
		return true;
	}
	updated(changedProperties) {
		["condensed", "flush"].forEach((attr) => {
			if (changedProperties.has(attr)) forEach(this.querySelectorAll(this.constructor.selectorRowsWithHeader), (elem) => {
				if (this[`${attr}`]) elem.setAttribute(attr, "");
				else elem.removeAttribute(attr);
			});
		});
	}
	render() {
		const { condensed, flush, selectionName } = this;
		return html`
      <section id="section" class=${classMap({
			[`cds--structured-list`]: true,
			[`cds--structured-list--selection`]: Boolean(selectionName),
			[`cds--structured-list--condensed`]: condensed,
			[`cds--structured-list--flush`]: flush
		})}><slot></slot></section>
    `;
	}
	static {
		this.selectorRowsWithHeader = `cds-structured-list-row,cds-structured-list-header-row`;
	}
	static {
		this.shadowRootOptions = {
			...LitElement.shadowRootOptions,
			delegatesFocus: true
		};
	}
	static {
		this.styles = structured_list_default$1;
	}
};
__decorate([property({ attribute: "selection-name" })], CDSStructuredList.prototype, "selectionName", void 0);
__decorate([property({
	type: Boolean,
	reflect: true
})], CDSStructuredList.prototype, "condensed", void 0);
__decorate([property({
	type: Boolean,
	reflect: true
})], CDSStructuredList.prototype, "flush", void 0);
CDSStructuredList = __decorate([carbonElement(`cds-structured-list`)], CDSStructuredList);
var structured_list_default = CDSStructuredList;
//#endregion
export { structured_list_default as default };

//# sourceMappingURL=structured-list.js.map