Work on panels
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
export * from './lib/normalize';
|
export * from './lib/normalize';
|
||||||
|
|
||||||
export * from './lib/variable.helper';
|
export * from './lib/variable.helper';
|
||||||
|
|
||||||
|
export * from './lib/variable.func';
|
||||||
|
|||||||
5
libs/_internal/styles/src/lib/variable.func.ts
Normal file
5
libs/_internal/styles/src/lib/variable.func.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { unsafeCSS } from 'lit';
|
||||||
|
|
||||||
|
export function variable(variableName: string, defaultValue?: string) {
|
||||||
|
return unsafeCSS(`var(${variableName}${defaultValue ? `, ${defaultValue}` : ''})`);
|
||||||
|
}
|
||||||
@@ -16,6 +16,10 @@ export default {
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<z-panels.bottom ?open=${args.open}>
|
<z-panels.bottom ?open=${args.open}>
|
||||||
|
<div slot="header">
|
||||||
|
<h2>est excepteur ea irure elit</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Esse laborum pariatur irure in consequat deserunt officia. Eu aliquip ad duis. Voluptate velit fugiat ex Lorem et. Ea laborum ut
|
Esse laborum pariatur irure in consequat deserunt officia. Eu aliquip ad duis. Voluptate velit fugiat ex Lorem et. Ea laborum ut
|
||||||
veniam est ad consequat pariatur.
|
veniam est ad consequat pariatur.
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ export default class BottomPanel extends LitElement {
|
|||||||
/** Private variables */
|
/** Private variables */
|
||||||
private readonly _destroyController = new DestroyController(this);
|
private readonly _destroyController = new DestroyController(this);
|
||||||
|
|
||||||
|
private readonly _closeEvent = new CustomEvent('close', { bubbles: false });
|
||||||
|
|
||||||
/** Protected variables */
|
/** Protected variables */
|
||||||
|
|
||||||
/** Public variables */
|
/** Public variables */
|
||||||
@@ -29,7 +31,10 @@ export default class BottomPanel extends LitElement {
|
|||||||
.pipe(
|
.pipe(
|
||||||
filter(() => this.open),
|
filter(() => this.open),
|
||||||
filter((event: MouseEvent) => event.target === this),
|
filter((event: MouseEvent) => event.target === this),
|
||||||
tap(() => (this.open = false)),
|
tap(() => {
|
||||||
|
this.open = false;
|
||||||
|
this.dispatchEvent(this._closeEvent);
|
||||||
|
}),
|
||||||
takeUntil(this._destroyController.destroy),
|
takeUntil(this._destroyController.destroy),
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
import { variable } from '@hijlkema-codes/internal/z-styles';
|
||||||
|
|
||||||
import { css } from 'lit';
|
import { css } from 'lit';
|
||||||
|
|
||||||
|
import { backgroundColor, borderRadius, maxHeight, padding } from './variables';
|
||||||
|
|
||||||
export const hostStyles = css`
|
export const hostStyles = css`
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
@@ -36,13 +40,13 @@ export const hostStyles = css`
|
|||||||
export const panelStyles = css`
|
export const panelStyles = css`
|
||||||
aside {
|
aside {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #fff;
|
background-color: ${variable(backgroundColor, 'hsl(0, 100%, 100%)')};
|
||||||
box-shadow: 0 -3px 6px rgba(0, 0, 0, 0.04);
|
box-shadow: 0 -3px 6px rgba(0, 0, 0, 0.04);
|
||||||
border-radius: 12px 12px 0 0;
|
border-radius: ${variable(borderRadius, '.75rem .75rem 0 0')};
|
||||||
padding: 2rem 1.5rem;
|
padding: ${variable(padding, '2rem 1.5rem')};
|
||||||
inset-inline: 0;
|
inset-inline: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
max-height: 60dvh;
|
max-height: ${variable(maxHeight, '60vh')};
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
transition: transform 0.3s ease-out;
|
transition: transform 0.3s ease-out;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
|
|||||||
4
libs/panels/bottom-panel/src/lib/styles/variables.ts
Normal file
4
libs/panels/bottom-panel/src/lib/styles/variables.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export const borderRadius = '--z-panels--bottom-panel--border-radius';
|
||||||
|
export const backgroundColor = '--z-panels--bottom-panel--background-color';
|
||||||
|
export const padding = '--z-panels--bottom-panel--padding';
|
||||||
|
export const maxHeight = '--z-panels--bottom-panel--max-height';
|
||||||
@@ -1,3 +1,28 @@
|
|||||||
export function panelsSidePanel(): string {
|
import { DestroyController } from '@z-elements/_internal/controllers';
|
||||||
return 'panels-side-panel';
|
|
||||||
|
import { LitElement } from 'lit';
|
||||||
|
import { customElement } from 'lit/decorators.js';
|
||||||
|
|
||||||
|
@customElement('z-panels.side')
|
||||||
|
export default class SidePanel extends LitElement {
|
||||||
|
static override get styles() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Private variables */
|
||||||
|
private readonly _destroyController = new DestroyController(this);
|
||||||
|
|
||||||
|
private readonly _closeEvent = new CustomEvent('close', { bubbles: false });
|
||||||
|
|
||||||
|
/** Protected variables */
|
||||||
|
|
||||||
|
/** Public variables */
|
||||||
|
|
||||||
|
/** constructor & lifecycle */
|
||||||
|
|
||||||
|
/** Public methods */
|
||||||
|
|
||||||
|
/** Protected methods */
|
||||||
|
|
||||||
|
/** Private methods */
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user