Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(action-icon): add hideActions property #752

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/action-icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export class ActionIcon extends LitElement {
/** highlight pane with dotted outline */
@property({ type: Boolean })
highlighted = false;
/** disables CSS adoption to action buttons */
@property({ type: Boolean })
noaction = false;

async firstUpdated(): Promise<void> {
this.tabIndex = 0;
Expand Down Expand Up @@ -90,11 +93,16 @@ export class ActionIcon extends LitElement {
:host(:focus-within) mwc-icon {
outline-style: solid;
outline-width: 4px;
}

:host(:focus-within:not([noaction])) ::slotted([slot='icon']),
:host(:focus-within:not([noaction])) mwc-icon {
transform: scale(0.8);
transition: all 250ms linear;
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
}

::slotted([slot='icon']:hover),
mwc-icon:hover {
outline-style: dashed;
Expand Down Expand Up @@ -177,6 +185,10 @@ export class ActionIcon extends LitElement {
opacity 200ms linear;
}

:host([secondary]) header {
background-color: var(--mdc-theme-secondary);
}

:host(:hover) header {
position: absolute;
opacity: 1;
Expand All @@ -190,11 +202,18 @@ export class ActionIcon extends LitElement {
:host(:focus-within) header {
position: absolute;
opacity: 1;
transform: translate(0, -80px);
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
opacity 250ms linear;
}

:host(:focus-within:not([noaction])) header {
transform: translate(0, -80px);
}

:host(:focus-within[noaction]) header {
transform: translate(0, -40px);
}
`;
}
1 change: 1 addition & 0 deletions src/editors/substation/l-node-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class LNodeEditor extends LitElement {
label="${this.header}"
?secondary=${this.missingIedReference}
?highlighted=${this.missingIedReference}
noaction
><mwc-icon slot="icon"
>${getLNodeIcon(this.element)}</mwc-icon
></action-icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const snapshots = {};
snapshots["web component rendering LNode element as reference to a LN/LN0 within IED looks like the latest snapshot"] =
`<action-icon
label="IED1 CircuitBreaker_CB1/ XCBR 1"
noaction=""
tabindex="0"
>
<mwc-icon slot="icon">
Expand All @@ -16,6 +17,7 @@ snapshots["web component rendering LNode element as instance of a LNodeType only
`<action-icon
highlighted=""
label="DC XSWI 1"
noaction=""
secondary=""
tabindex="0"
>
Expand Down