Skip to content

Commit fe0571d

Browse files
feat: add supporting pane
1 parent 9233821 commit fe0571d

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// Copyright 2023 Google LLC
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
6+
// go/keep-sorted start
7+
@use 'sass:list';
8+
// go/keep-sorted end
9+
10+
@mixin styles() {
11+
.host {
12+
display: flex;
13+
flex-direction: column;
14+
height: 100%;
15+
width: 100%;
16+
}
17+
18+
slot {
19+
width: 100%;
20+
height: 100%;
21+
}
22+
23+
:host([variant='expanded']) {
24+
flex-direction: row;
25+
}
26+
27+
:host([variant='expanded']) slot[name='supporting'] {
28+
max-width: var(--md-supporting-pane-width, 360px);
29+
margin-left: 24px;
30+
}
31+
32+
:host([variant='expanded'][left]) slot[name='supporting'] {
33+
margin-right: 24px;
34+
}
35+
36+
:host([variant='medium']) slot,
37+
:host([variant='compact']) slot {
38+
position: absolute;
39+
left: 0;
40+
right: 0;
41+
bottom: 0;
42+
top: 0;
43+
}
44+
45+
:host([variant='medium']) slot:not([name='supporting']) {
46+
// max-height: calc(100% - (100% / 3));
47+
bottom: calc(100% - (100% / 3));
48+
}
49+
50+
:host([variant='medium']) slot[name='supporting'] {
51+
top: calc(100% / 3);
52+
}
53+
54+
:host([variant='compact']) slot:not([name='supporting']) {
55+
bottom: calc(100% / 2);
56+
}
57+
58+
:host([variant='compact']) slot[name='supporting'] {
59+
top: calc(100% / 2);
60+
}
61+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//
2+
// Copyright 2023 Google LLC
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
6+
// go/keep-sorted start
7+
@use './supporting-pane';
8+
// go/keep-sorted end
9+
10+
@include supporting-pane.styles;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @license
3+
* Copyright 2023 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import { html, LitElement } from 'lit';
8+
import { property } from 'lit/decorators';
9+
10+
/**
11+
* The Supporting Pane Layout.
12+
*/
13+
export class SupportingPane extends LitElement {
14+
@property({ type: String, reflect: true })
15+
variant: 'compact' | 'medium' | 'expanded' = 'expanded';
16+
17+
@property({ type: Boolean, reflect: true })
18+
left: boolean = false;
19+
20+
protected override render() {
21+
return html`
22+
<slot></slot>
23+
<slot name="supporting"></slot>
24+
`;
25+
}
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @license
3+
* Copyright 2023 Google LLC
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import { customElement } from 'lit/decorators.js';
8+
9+
import { SupportingPane } from './internal/supporting-pane.js';
10+
import { styles } from './internal/supporting-pane-styles.css.js';
11+
12+
declare global {
13+
interface HTMLElementTagNameMap {
14+
'md-supporting-pane': MDSupportingPane;
15+
}
16+
}
17+
18+
/**
19+
* @final
20+
* @suppress {visibility}
21+
*/
22+
@customElement('md-supporting-pane')
23+
export class MDSupportingPane extends SupportingPane {
24+
static override styles = [styles];
25+
}

0 commit comments

Comments
 (0)