Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
feat: new calcite-shell-center-row component and updated slot for cal…
Browse files Browse the repository at this point in the history
…cite-shell (#950)

* #935 add slot "bottom-panel" and deprecate "tip-manager" on shell

* working but still some issues

* Adjustments to keep bottom-panel from pusing contextual-panel off frame.

* Added calcite-shell-center-row component and associated styles. TODO: collapsed event.

* Added content node in order to recieve the `hidden` attribute for the `collapsed` property.

* Reverted the removal of the tip-manager slot. Arranged nodes in shell to put center-row after contextual-panel and added associated flex order.

* Added demo app for center-row.

* added e2e

* updated e2e

* Rearranged nodes. Nixed styles no longer needed after rearranging nodes.

* Added shell-center-row to shell Storybook.

* Removed collapsed property and associated tests. Added expand/collpase toggle to demo.

* Removed collapsed property from storybook.

* Removed unused Watch import.

* Fixed e2e test.

* restored tip-manager slot references

* Fixed e2e test. Reset block-configuration demo.

* removed non-behavioral test.

Co-authored-by: Matt Driscoll <MDriscoll@esri.com>
  • Loading branch information
asangma and driskull committed May 1, 2020
1 parent 3eabce2 commit 56a47d4
Show file tree
Hide file tree
Showing 13 changed files with 625 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { accessible, defaults, hidden, renders } from "../../tests/commonTests";

describe("calcite-shell-center-row", () => {
it("renders", async () => renders("calcite-shell-center-row"));

it("honors hidden attribute", async () => hidden("calcite-shell-center-row"));

it("defaults", async () =>
defaults("calcite-shell-center-row", [
{
propertyName: "detached",
defaultValue: false
},
{
propertyName: "heightScale",
defaultValue: "s"
},
{
propertyName: "position",
defaultValue: "end"
}
]));

it("should be accessible", async () =>
accessible("<calcite-shell-center-row><div>content</div></calcite-shell-center-row>"));
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
:host {
@extend %component-host;
overflow: hidden;
transition: height var(--calcite-app-animation-time) ease-in-out;

--calcite-app-shell-center-row-height-small: 33%;
--calcite-app-shell-center-row-height-medium: 70%;
--calcite-app-shell-center-row-height-large: 100%;
}

@import "../../scss/includes/_component";

.content {
background-color: var(--calcite-app-background-content);
border: 1px solid var(--calcite-app-border);
flex: 1 0 0;
height: 100%;
margin: 0;
overflow: hidden;
width: 100%;
}

:host([detached]) {
animation: calcite-app-fade-in-up var(--calcite-app-animation-time) var(--calcite-app-easing-function);
border-radius: var(--calcite-app-border-radius);
box-shadow: var(--calcite-app-shadow-0);
margin: var(--calcite-app-cap-spacing-half) var(--calcite-app-side-spacing-half)
var(--calcite-app-cap-spacing-plus-half);
}

:host([position="end"]) {
align-self: flex-end;
}

:host([position="start"]) {
align-self: flex-start;
}

:host([height-scale="s"]) {
height: var(--calcite-app-shell-center-row-height-small);
}

:host([height-scale="m"]) {
height: var(--calcite-app-shell-center-row-height-medium);
}

:host([height-scale="l"]) {
height: var(--calcite-app-shell-center-row-height-large);
}

:host([height-scale="l"][detached]) {
height: calc(var(--calcite-app-shell-center-row-height-large) - var(--calcite-app-cap-spacing-double));
}

::slotted(calcite-panel) {
width: 100%;
height: 100%;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Component, Host, Prop, h, VNode } from "@stencil/core";
import { CSS } from "./resources";
import { CalcitePosition, CalciteScale } from "../interfaces";

/**
* @slot action-bar - A slot for adding a `calcite-action-bar` to the panel.
* @slot - A slot for adding content to the shell panel.
*/
@Component({
tag: "calcite-shell-center-row",
styleUrl: "calcite-shell-center-row.scss",
shadow: true
})
export class CalciteShellCenterRow {
// --------------------------------------------------------------------------
//
// Properties
//
// --------------------------------------------------------------------------

/**
* This property makes the content area appear like a "floating" panel.
*/
@Prop({ reflect: true }) detached = false;

/**
* Specifies the maxiumum height of the row.
*/
@Prop({ reflect: true }) heightScale: CalciteScale = "s";

/**
* Arranges the component depending on the elements 'dir' property.
*/
@Prop({ reflect: true }) position: CalcitePosition = "end";

// --------------------------------------------------------------------------
//
// Render Methods
//
// --------------------------------------------------------------------------

render(): VNode {
return (
<Host>
<div class={CSS.content}>
<slot />
</div>
</Host>
);
}
}
3 changes: 3 additions & 0 deletions src/components/calcite-shell-center-row/resources.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const CSS = {
content: "content"
};
6 changes: 3 additions & 3 deletions src/components/calcite-shell/calcite-shell.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
display: flex;
flex-direction: column;
overflow: hidden;

--calcite-app-shell-tip-spacing: 26vw;
}

Expand Down Expand Up @@ -49,15 +48,16 @@
font-size: var(--calcite-app-font-size-1);
}

::slotted(calcite-shell-panel) {
::slotted(calcite-shell-panel),
::slotted(calcite-shell-center-row) {
position: relative;
z-index: 1;
}

::slotted(calcite-tip-manager) {
animation: calcite-app-fade-in-up var(--calcite-app-animation-time) var(--calcite-app-easing-function);
border-radius: var(--calcite-app-border-radius);
bottom: var(--calcite-app-cap-spacing);
bottom: var(--calcite-app-cap-spacing-plus-half);
box-shadow: var(--calcite-app-shadow-2);
box-sizing: border-box;
left: var(--calcite-app-shell-tip-spacing);
Expand Down
33 changes: 33 additions & 0 deletions src/components/calcite-shell/calcite-shell.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,27 @@ const createShellPanelAttributes: (group: "Leading Panel" | "Trailing Panel") =>
];
};

const createShellCenterRowAttributes: (group: string) => Attributes = (group) => {
return [
{
name: "detached",
value: boolean("detached", false, group)
},
{
name: "height-scale",
value: select("heightScale", scale.values, scale.values[0], group)
},
{
name: "position",
value: select("position", position.values, position.values[1], group)
},
{
name: "slot",
value: "center-row"
}
];
};

const actionBarPrimaryContentHTML = dedent`
<calcite-action-group>
<calcite-action text="Add" label="Add Item" icon="plus"></calcite-action>
Expand Down Expand Up @@ -98,6 +119,16 @@ const leadingPanelHTML = dedent`
<p>My Leading Panel</p>
`;

const centerRowHTML = dedent`
<div style="
width:50vw;
background-color: var(--calcite-app-background-content);
padding: var(--calcite-app-cap-spacing) var(--calcite-app-side-spacing);
">
<span>My Shell Center Row</span>
</div>
`;

const trailingPanelHTML = dedent`
${actionBarContextualHTML}
<p>My Trailing Panel</p>
Expand Down Expand Up @@ -185,6 +216,7 @@ export const basic = (): string =>
${headerHTML}
${create("calcite-shell-panel", createShellPanelAttributes("Leading Panel"), leadingPanelHTML)}
${contentHTML}
${create("calcite-shell-center-row", createShellCenterRowAttributes("Center Row"), centerRowHTML)}
${create("calcite-shell-panel", createShellPanelAttributes("Trailing Panel"), trailingPanelHTML)}
${footerHTML}
`
Expand Down Expand Up @@ -294,6 +326,7 @@ export const advanced = (): string =>
${headerHTML}
${create("calcite-shell-panel", createShellPanelAttributes("Leading Panel"), advancedLeadingPanelHTML)}
${contentHTML}
${create("calcite-shell-center-row", createShellCenterRowAttributes("Center Row"), centerRowHTML)}
${create("calcite-shell-panel", createShellPanelAttributes("Trailing Panel"), advancedTrailingPanelHTMl)}
${tipManagerHTML}
${footerHTML}
Expand Down
4 changes: 3 additions & 1 deletion src/components/calcite-shell/calcite-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { getCalcitePosition, getSlotted } from "../utils/dom";
* @slot shell-footer - A slot for adding footer content. This content will be positioned at the bottom of the shell.
* @slot primary-panel - A slot for adding the leading `calcite-shell-panel`.
* @slot contextual-panel - A slot for adding the trailing `calcite-shell-panel`.
* @slot tip-manager - A slot for adding a `calcite-tip-manager`. This component will be absolutely positioned.
* @slot tip-manager - **[DEPRECATED]** use "bottom-panel" instead.
* @slot bottom-panel - A slot for adding a bottom floating panel such as a chart or `calcite-tip-manager`.
* @slot - A slot for adding content to the shell. This content will appear between any leading and trailing panels added to the shell. (eg. a map)
*/
@Component({
Expand Down Expand Up @@ -78,6 +79,7 @@ export class CalciteShell {
<div class={mainClasses}>
<slot name={SLOTS.primaryPanel} />
{this.renderContent()}
<slot name={SLOTS.centerRow} />
<slot name={SLOTS.contextualPanel} />
<slot name={SLOTS.tipManager} />
</div>
Expand Down
13 changes: 4 additions & 9 deletions src/components/calcite-shell/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ _note: calcite-shell supports tablet as the smallest screen size_

<!-- Auto Generated Below -->


## Usage

### Advanced
Expand Down Expand Up @@ -83,7 +82,6 @@ Renders a shell with leading and trailing floating panels, action bar/pad, block
</calcite-shell>
```


### Basic

#### Basic
Expand Down Expand Up @@ -142,27 +140,24 @@ Renders a single panel with actions in an action bar.
</calcite-shell>
```



## Properties

| Property | Attribute | Description | Type | Default |
| -------- | --------- | ----------------------------------------- | ------------------- | ----------- |
| `theme` | `theme` | Used to set the component's color scheme. | `"dark" \| "light"` | `undefined` |


## Slots

| Slot | Description |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| | A slot for adding content to the shell. This content will appear between any leading and trailing panels added to the shell. (eg. a map) |
| `"bottom-panel"` | A slot for adding a bottom floating panel such as a chart or `calcite-tip-manager`. |
| `"contextual-panel"` | A slot for adding the trailing `calcite-shell-panel`. |
| `"primary-panel"` | A slot for adding the leading `calcite-shell-panel`. |
| `"shell-footer"` | A slot for adding footer content. This content will be positioned at the bottom of the shell. |
| `"shell-header"` | A slot for adding header content. This content will be positioned at the top of the shell. |
| `"tip-manager"` | A slot for adding a `calcite-tip-manager`. This component will be absolutely positioned. |

| `"tip-manager"` | **[DEPRECATED]** use "bottom-panel" instead. |

----------------------------------------------
---

*Built with [StencilJS](https://stenciljs.com/)*
_Built with [StencilJS](https://stenciljs.com/)_
1 change: 1 addition & 0 deletions src/components/calcite-shell/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const CSS = {
};

export const SLOTS = {
centerRow: "center-row",
primaryPanel: "primary-panel",
contextualPanel: "contextual-panel",
header: "shell-header",
Expand Down
2 changes: 1 addition & 1 deletion src/demos/shell/block-configurations.html
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,4 @@ <h3 class="heading" slot="header-content">WE CARE A LOT</h3>
</script>
</main>
</body>
</html>
</html>
8 changes: 4 additions & 4 deletions src/demos/shell/demo-app-advanced-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
<section class="form-section">
<label for="">
Label attribute
<input type="text" value="2018 Total Population (Esri)">
<input type="text" value="2018 Total Population (Esri)">
</label>
</section>
<section class="form-section">
Expand All @@ -162,7 +162,7 @@
<section class="form-section">
<label for="">
Label attribute
<input type="text" value="NAME">
<input type="text" value="NAME">
</label>
</section>
<section class="form-section">
Expand All @@ -184,7 +184,7 @@
<section class="form-section">
<label for="">
Label attribute
<input type="text" value="2018 Total Households (Esri)">
<input type="text" value="2018 Total Households (Esri)">
</label>
</section>
<section class="form-section">
Expand Down Expand Up @@ -306,4 +306,4 @@ <h3 class="heading" slot="header-content">WE CARE A LOT</h3>
</script>
</main>
</body>
</html>
</html>
Loading

0 comments on commit 56a47d4

Please sign in to comment.