2022-03-24 07:36:07 +08:00
|
|
|
<script lang="ts">
|
2023-06-22 03:34:12 +08:00
|
|
|
export let scale: number | null = null;
|
2023-08-04 06:01:18 +08:00
|
|
|
export let gap = true;
|
|
|
|
export let min_width = 0;
|
|
|
|
export let elem_id = "";
|
|
|
|
export let elem_classes: string[] = [];
|
|
|
|
export let visible = true;
|
2022-10-04 07:01:41 +08:00
|
|
|
export let variant: "default" | "panel" | "compact" = "default";
|
2022-03-25 14:03:47 +08:00
|
|
|
</script>
|
2022-03-24 07:36:07 +08:00
|
|
|
|
2022-04-22 17:19:59 +08:00
|
|
|
<div
|
2022-05-12 12:40:41 +08:00
|
|
|
id={elem_id}
|
2023-03-16 05:01:53 +08:00
|
|
|
class={elem_classes.join(" ")}
|
2023-06-08 09:35:31 +08:00
|
|
|
class:gap
|
2023-01-18 04:47:40 +08:00
|
|
|
class:compact={variant === "compact"}
|
|
|
|
class:panel={variant === "panel"}
|
|
|
|
class:hide={!visible}
|
2023-06-08 09:35:31 +08:00
|
|
|
style:flex-grow={scale}
|
|
|
|
style:min-width="calc(min({min_width}px, 100%))"
|
2022-04-22 17:19:59 +08:00
|
|
|
>
|
2022-03-23 06:40:36 +08:00
|
|
|
<slot />
|
|
|
|
</div>
|
2023-01-18 04:47:40 +08:00
|
|
|
|
|
|
|
<style>
|
|
|
|
div {
|
|
|
|
display: flex;
|
|
|
|
position: relative;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
|
|
|
div > :global(*),
|
|
|
|
div > :global(.form > *) {
|
|
|
|
width: var(--size-full);
|
|
|
|
}
|
|
|
|
|
|
|
|
.gap {
|
2023-03-07 04:52:31 +08:00
|
|
|
gap: var(--layout-gap);
|
2023-01-18 04:47:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.hide {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.compact > :global(*),
|
|
|
|
.compact :global(.box) {
|
|
|
|
border-radius: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.compact,
|
|
|
|
.panel {
|
2023-03-07 04:52:31 +08:00
|
|
|
border: solid var(--panel-border-width) var(--panel-border-color);
|
|
|
|
border-radius: var(--container-radius);
|
2023-03-18 08:20:55 +08:00
|
|
|
background: var(--panel-background-fill);
|
2023-03-07 04:52:31 +08:00
|
|
|
padding: var(--spacing-lg);
|
2023-01-18 04:47:40 +08:00
|
|
|
}
|
|
|
|
</style>
|