-
Notifications
You must be signed in to change notification settings - Fork 907
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9233821
commit fe0571d
Showing
4 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// Copyright 2023 Google LLC | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
// go/keep-sorted start | ||
@use 'sass:list'; | ||
// go/keep-sorted end | ||
|
||
@mixin styles() { | ||
.host { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
|
||
slot { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
:host([variant='expanded']) { | ||
flex-direction: row; | ||
} | ||
|
||
:host([variant='expanded']) slot[name='supporting'] { | ||
max-width: var(--md-supporting-pane-width, 360px); | ||
margin-left: 24px; | ||
} | ||
|
||
:host([variant='expanded'][left]) slot[name='supporting'] { | ||
margin-right: 24px; | ||
} | ||
|
||
:host([variant='medium']) slot, | ||
:host([variant='compact']) slot { | ||
position: absolute; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
top: 0; | ||
} | ||
|
||
:host([variant='medium']) slot:not([name='supporting']) { | ||
// max-height: calc(100% - (100% / 3)); | ||
bottom: calc(100% - (100% / 3)); | ||
} | ||
|
||
:host([variant='medium']) slot[name='supporting'] { | ||
top: calc(100% / 3); | ||
} | ||
|
||
:host([variant='compact']) slot:not([name='supporting']) { | ||
bottom: calc(100% / 2); | ||
} | ||
|
||
:host([variant='compact']) slot[name='supporting'] { | ||
top: calc(100% / 2); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
labs/layout/supportingpane/internal/supporting-pane-styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// | ||
// Copyright 2023 Google LLC | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
// go/keep-sorted start | ||
@use './supporting-pane'; | ||
// go/keep-sorted end | ||
|
||
@include supporting-pane.styles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { html, LitElement } from 'lit'; | ||
import { property } from 'lit/decorators'; | ||
|
||
/** | ||
* The Supporting Pane Layout. | ||
*/ | ||
export class SupportingPane extends LitElement { | ||
@property({ type: String, reflect: true }) | ||
variant: 'compact' | 'medium' | 'expanded' = 'expanded'; | ||
|
||
@property({ type: Boolean, reflect: true }) | ||
left: boolean = false; | ||
|
||
protected override render() { | ||
return html` | ||
<slot></slot> | ||
<slot name="supporting"></slot> | ||
`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { customElement } from 'lit/decorators.js'; | ||
|
||
import { SupportingPane } from './internal/supporting-pane.js'; | ||
import { styles } from './internal/supporting-pane-styles.css.js'; | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'md-supporting-pane': MDSupportingPane; | ||
} | ||
} | ||
|
||
/** | ||
* @final | ||
* @suppress {visibility} | ||
*/ | ||
@customElement('md-supporting-pane') | ||
export class MDSupportingPane extends SupportingPane { | ||
static override styles = [styles]; | ||
} |