Skip to content

Commit

Permalink
feat: setup SplitView component from rebase main
Browse files Browse the repository at this point in the history
  • Loading branch information
spdev3000 authored and Westbrook committed Feb 19, 2021
1 parent 975a9d6 commit 32f3272
Show file tree
Hide file tree
Showing 19 changed files with 2,710 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/bundle/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import '@spectrum-web-components/sidenav/sp-sidenav-heading.js';
import '@spectrum-web-components/sidenav/sp-sidenav-item.js';
import '@spectrum-web-components/slider/sp-slider.js';
import '@spectrum-web-components/split-button/sp-split-button.js';
import '@spectrum-web-components/split-view/sp-split-view.js';
import '@spectrum-web-components/status-light/sp-status-light.js';
import '@spectrum-web-components/switch/sp-switch.js';
import '@spectrum-web-components/tabs/sp-tab.js';
Expand Down
1 change: 1 addition & 0 deletions packages/bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"@spectrum-web-components/sidenav": "^0.8.1",
"@spectrum-web-components/slider": "^0.8.2",
"@spectrum-web-components/split-button": "^0.3.3",
"@spectrum-web-components/split-view": "^0.0.1",
"@spectrum-web-components/status-light": "^0.6.1",
"@spectrum-web-components/switch": "^0.6.3",
"@spectrum-web-components/tabs": "^0.4.3",
Expand Down
1 change: 1 addition & 0 deletions packages/bundle/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export * from '@spectrum-web-components/search';
export * from '@spectrum-web-components/sidenav';
export * from '@spectrum-web-components/slider';
export * from '@spectrum-web-components/split-button';
export * from '@spectrum-web-components/split-view';
export * from '@spectrum-web-components/status-light';
export * from '@spectrum-web-components/switch';
export * from '@spectrum-web-components/tabs';
Expand Down
1 change: 1 addition & 0 deletions packages/bundle/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
{ "path": "../sidenav" },
{ "path": "../slider" },
{ "path": "../split-button" },
{ "path": "../split-view" },
{ "path": "../status-light" },
{ "path": "../switch" },
{ "path": "../tabs" },
Expand Down
183 changes: 183 additions & 0 deletions packages/split-view/README.md
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>
```
58 changes: 58 additions & 0 deletions packages/split-view/package.json
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"
}
}
21 changes: 21 additions & 0 deletions packages/split-view/sp-split-view.ts
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;
}
}
Loading

0 comments on commit 32f3272

Please sign in to comment.