-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: setup SplitView component from rebase main
- Loading branch information
Showing
19 changed files
with
2,710 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
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
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
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
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,183 @@ | ||
## Description | ||
|
||
An `sp-split-view` element delivers its first two direct child elements in a horizontal or vertical (`<sp-split-view vertical>`) orientation that distributes the available page real estate as per the supplied attribute API. When leveraging the resizable attribute a pointer and keyboard accessible affordance is provided to the user to customize the distribution of that area between the available children. | ||
|
||
### Usage | ||
|
||
[![See it on NPM!](https://img.shields.io/npm/v/@spectrum-web-components/split-view?style=for-the-badge)](https://www.npmjs.com/package/@spectrum-web-components/split-view) | ||
[![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/@spectrum-web-components/split-view?style=for-the-badge)](https://bundlephobia.com/result?p=@spectrum-web-components/split-view) | ||
|
||
``` | ||
yarn add @spectrum-web-components/split-view | ||
``` | ||
|
||
Import the side effectful registration of `<sp-split-view>` via: | ||
|
||
``` | ||
import '@spectrum-web-components/split-view/sp-split-view.js'; | ||
``` | ||
|
||
When looking to leverage the `SplitView` base class as a type and/or for extension purposes, do so via: | ||
|
||
``` | ||
import { SplitView } from '@spectrum-web-components/split-view'; | ||
``` | ||
|
||
### Variants | ||
|
||
#### Horizontal | ||
|
||
```html | ||
<sp-split-view> | ||
<div>Left panel</div> | ||
<div>Right panel</div> | ||
</sp-split-view> | ||
``` | ||
|
||
#### Horizontal Resizable | ||
|
||
```html | ||
<sp-split-view resizable primary-min="50" secondary-min="50"> | ||
<div> | ||
<h1>Left panel</h1> | ||
<p> | ||
Lorem Ipsum is simply dummy text of the printing and typesetting | ||
industry. | ||
</p> | ||
</div> | ||
<div> | ||
<h2>Right panel</h2> | ||
<p> | ||
It is a long established fact that a reader will be distracted by | ||
the readable content of a page when looking at its layout. | ||
</p> | ||
</div> | ||
</sp-split-view> | ||
``` | ||
|
||
#### Horizontal Resizable & Collapsible | ||
|
||
```html | ||
<sp-split-view resizable> | ||
<div> | ||
<h1>Left panel</h1> | ||
<p> | ||
Lorem Ipsum is simply dummy text of the printing and typesetting | ||
industry. | ||
</p> | ||
</div> | ||
<div> | ||
<h2>Right panel</h2> | ||
<p> | ||
It is a long established fact that a reader will be distracted by | ||
the readable content of a page when looking at its layout. | ||
</p> | ||
</div> | ||
</sp-split-view> | ||
``` | ||
|
||
#### Vertical | ||
|
||
```html | ||
<sp-split-view vertical> | ||
<div>Top panel</div> | ||
<div>Bottom panel</div> | ||
</sp-split-view> | ||
``` | ||
|
||
#### Vertical Resizable | ||
|
||
```html | ||
<sp-split-view | ||
vertical | ||
resizable | ||
primary-min="50" | ||
primary-max="150" | ||
secondary-min="50" | ||
> | ||
<div> | ||
<h1>Top panel</h1> | ||
<p> | ||
Lorem Ipsum is simply dummy text of the printing and typesetting | ||
industry. | ||
</p> | ||
</div> | ||
<div> | ||
<h2>Bottom panel</h2> | ||
<p> | ||
It is a long established fact that a reader will be distracted by | ||
the readable content of a page when looking at its layout. | ||
</p> | ||
</div> | ||
</sp-split-view> | ||
``` | ||
|
||
#### Vertical Resizable & Collapsible | ||
|
||
```html | ||
<sp-split-view vertical resizable style="height: 300px;"> | ||
<div> | ||
<h1>Top panel</h1> | ||
<p> | ||
Lorem Ipsum is simply dummy text of the printing and typesetting | ||
industry. | ||
</p> | ||
</div> | ||
<div> | ||
<h2>Bottom panel</h2> | ||
<p> | ||
It is a long established fact that a reader will be distracted by | ||
the readable content of a page when looking at its layout. | ||
</p> | ||
</div> | ||
</sp-split-view> | ||
``` | ||
|
||
#### Multiple Levels | ||
|
||
```html | ||
<sp-split-view | ||
resizable | ||
primary-min="50" | ||
primary-max="200" | ||
secondary-min="50" | ||
style="height: 400px; width: 600px;" | ||
> | ||
<div> | ||
<h1>First panel - Level 1</h1> | ||
<p> | ||
Lorem Ipsum is simply dummy text of the printing and typesetting | ||
industry. Lorem Ipsum has been the industry's standard dummy text | ||
ever since the 1500s, when an unknown printer took a galley of type | ||
and scrambled it to make a type specimen book. | ||
</p> | ||
</div> | ||
<div> | ||
<h2>Second panel - Level 1</h2> | ||
<sp-split-view | ||
vertical | ||
resizable | ||
primary-min="50" | ||
primary-size="100" | ||
secondary-min="50" | ||
style="height: 300px;" | ||
> | ||
<div> | ||
<h3>First panel - Level 2</h3> | ||
<p> | ||
Lorem Ipsum is simply dummy text of the printing and | ||
typesetting industry. | ||
</p> | ||
</div> | ||
<div> | ||
<h4>Second panel - Level 2</h4> | ||
<p> | ||
It is a long established fact that a reader will be | ||
distracted by the readable content of a page when looking at | ||
its layout. | ||
</p> | ||
</div> | ||
</sp-split-view> | ||
</div> | ||
</sp-split-view> | ||
``` |
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,58 @@ | ||
{ | ||
"name": "@spectrum-web-components/split-view", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/adobe/spectrum-web-components.git", | ||
"directory": "packages/split-view" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/adobe/spectrum-web-components/issues" | ||
}, | ||
"homepage": "https://adobe.github.io/spectrum-web-components/components/split-view", | ||
"keywords": [ | ||
"spectrum css", | ||
"web components", | ||
"lit-element", | ||
"lit-html" | ||
], | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "src/index.js", | ||
"module": "src/index.js", | ||
"type": "module", | ||
"types": "./src/index.d.ts", | ||
"exports": { | ||
".": "./src/index.js", | ||
"./src/": "./src/", | ||
"./custom-elements.json": "./custom-elements.json", | ||
"./package.json": "./package.json", | ||
"./sp-split-view": "./sp-split-view.js", | ||
"./sp-split-view.js": "./sp-split-view.js" | ||
}, | ||
"files": [ | ||
"custom-elements.json", | ||
"*.d.ts", | ||
"*.js", | ||
"*.js.map", | ||
"/src/" | ||
], | ||
"sideEffects": [ | ||
"./sp-*.js", | ||
"./sp-*.ts" | ||
], | ||
"scripts": { | ||
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
"@spectrum-css/splitview": "^3.0.0" | ||
}, | ||
"dependencies": { | ||
"@spectrum-web-components/base": "^0.3.1", | ||
"tslib": "^2.0.0" | ||
} | ||
} |
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,21 @@ | ||
/* | ||
Copyright 2020 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
|
||
import { SplitView } from './src/SplitView.js'; | ||
|
||
customElements.define('sp-split-view', SplitView); | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'sp-split-view': SplitView; | ||
} | ||
} |
Oops, something went wrong.