Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin-component-factory/vcf-nav

Package Overview
Dependencies
Maintainers
5
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin-component-factory/vcf-nav - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "@vaadin-component-factory/vcf-nav",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/vaadin-component-factory/vcf-nav",

@@ -5,0 +5,0 @@ "repository": "https://github.com/vaadin-component-factory/vcf-nav",

@@ -1,125 +0,2 @@

import { html, css, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import '@vaadin/vaadin-lumo-styles/color.js';
import '@vaadin/vaadin-lumo-styles/typography.js';
import '@vaadin/vaadin-lumo-styles/sizing.js';
import '@vaadin/vaadin-lumo-styles/spacing.js';
import '@vaadin/vaadin-lumo-styles/style.js';
import '@vaadin/vaadin-lumo-styles/font-icons.js';
// Used for generating unique IDs for label elements
let id = 0;
@customElement('app-nav')
export class Nav extends LitElement {
@property({ type: Boolean, reflect: true })
collapsible = false;
@property({ type: Boolean, reflect: true })
collapsed = false;
connectedCallback() {
super.connectedCallback();
this.setAttribute('role', 'navigation');
}
static styles = css`
:host {
display: block;
font-family: var(--lumo-font-family);
font-size: var(--lumo-font-size-m);
font-weight: 500;
line-height: var(--lumo-line-height-xs);
color: var(--lumo-body-text-color);
-webkit-tap-highlight-color: transparent;
}
[hidden] {
display: none !important;
}
summary {
cursor: var(--lumo-clickable-cursor, default);
display: flex;
align-items: center;
justify-content: space-between;
border-radius: var(--lumo-border-radius-m);
}
summary ::slotted([slot='label']) {
font-size: var(--lumo-font-size-s);
color: var(--lumo-secondary-text-color);
margin: var(--lumo-space-s);
border-radius: inherit;
}
summary::-webkit-details-marker {
display: none;
}
summary::marker {
content: '';
}
:host([collapsible]) summary::after {
font-family: lumo-icons;
content: var(--lumo-icons-dropdown);
font-size: var(--lumo-icon-size-m);
display: inline-flex;
align-items: center;
justify-content: center;
width: var(--lumo-size-s);
height: var(--lumo-size-s);
transition: transform 140ms;
margin: -0.25em 0;
}
:host([collapsed]) summary::after {
transform: rotate(-90deg);
}
@supports selector(:focus-visible) {
summary {
outline: none;
}
summary:focus-visible {
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
}
}
slot {
/* Needed to make role="list" work */
display: block;
}
`;
render() {
const label = this.querySelector('[slot="label"]');
if (label && this.collapsible) {
return html`
<details ?open="${!this.collapsed}" @toggle="${this.toggleCollapsed}">${this.renderBody(label)}</details>
`;
}
return this.renderBody(label);
}
renderBody(label: Element | null) {
if (label) {
if (!label.id) label.id = 'app-nav-label-' + id++;
this.setAttribute('aria-labelledby', label.id);
} else {
this.removeAttribute('aria-labelledby');
}
return html`
<summary part="label" ?hidden="${label == null}">
<slot name="label" @slotchange="${() => this.requestUpdate()}"></slot>
</summary>
<slot role="list"></slot>
`;
}
toggleCollapsed(e: Event) {
this.collapsed = !(e.target as HTMLDetailsElement).open;
}
}
import './src/vcf-nav.ts';
import './src/vcf-nav-item.ts';
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc