/** * EGroupware eTemplate2 - Box widget * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package etemplate * @subpackage api * @link https://www.egroupware.org * @author Nathan Gray */ import {css, html, LitElement} from "@lion/core"; import {Et2Widget} from "../Et2Widget/Et2Widget"; import {et2_IDetachedDOM} from "../et2_core_interfaces"; export class Et2Box extends Et2Widget(LitElement) implements et2_IDetachedDOM { static get styles() { return [ ...super.styles, css` :host { display: block; } :host > div { display: flex; flex-wrap: nowrap; justify-content: flex-start; align-items: stretch; gap: 5px; } :host([align="right"]) > div { justify-content: flex-end; } :host([align="left"]) > div { justify-content: flex-start; } /* CSS for child elements */ ::slotted(*) { flex: 1 0 auto; } ::slotted(img) { /* Stop images from growing. In general we want them to stay */ flex-grow: 0; } ::slotted([align="left"]) { margin-right: auto; order: -1; } ::slotted([align="right"]) { margin-left: auto; order: 1; } `, ]; } render() { return html`