npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@terminus/ui-drawer

v2.0.0

Published

<h1>Drawer</h1>

Downloads

5

Readme

CI/CD Status Codecov MIT License
NPM version Library size

The drawer component is designed to add side content to a section of the DOM.

Table of Contents

Installation

Packages that need to be installed

  • @angular/cdk
  • @angular/common
  • @angular/core
  • @angular/flex-layout
  • @angular/forms
  • @angular/platform-browser
  • @terminus/design-tokens
  • @terminus/fe-utilities
  • @terminus/ui-utilities
  • @terminus/ui-expansion-panel
  • date-fns
  • tslib

Use the ng add command to quickly install all the needed dependencies:

ng add @terminus/ui-drawer

Modules that need to be in NgModule

  • BrowserAnimationsModule
  • TsDrawerModule

CSS imports

In your top level stylesheet, add these imports:

@import '~@terminus/design-tokens/css/library-design-tokens.css';
@import '~@terminus/ui-styles/terminus-ui.css';

CSS resources

Load the needed font families by adding this link to the <head> of your application:

<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">

Usage

Define a container, a drawer, and the page content:

<ts-drawer-container>
  <ts-drawer mode="push" posistion="start">
    <div>Inside drawer</div>
  </ts-drawer>
  
  <ts-drawer-content>
    <div>Main content</div>
  </ts-drawer-content>
</ts-drawer-container>

Backdrop

If hasBackdrop is set to true, users can close the drawer by clicking outside (default is false):

<ts-drawer-container hasBackdrop="true">
  <ts-drawer>...</ts-drawer>
</ts-drawer-container>

Mode

The mode defines how the page content reacts to the drawer. A drawer can open over the page content (overlay) or push (push) the content to make room for the drawer (default is overlay):

<ts-drawer [mode]="push">...</ts-drawer>

Position

Consumers can specify which side of the container the drawer opens from. The default is start which opens from the left side of the page. If set to end, it would expand the drawer from right of the page.

<ts-drawer [position]="end">...</ts-drawer>

NOTE: An error will be thrown if more than one drawer in a given container has the same position AND push mode set.

Collapsed and expanded sizes

The size of a drawer when it's collapsed and expanded can be customized:

<ts-drawer
  [collapsedSize]="2rem"
  [expandedSize]="12rem"
>...</ts-drawer>

NOTE: collapsedSize defaults to 3.75rem and expandedSize to 12.5rem.

Expand on load

The drawer can be forced to expand on load:

<ts-drawer [isExpanded]="true">...</ts-drawer>

Hide shadow when collapsed

When a drawer is expanded, there is box shadow around the drawer. When a drawer is collapsed, if input hideShadowWhenCollapsed set to false and collapseSize greater than 0, there is box shadow shown; otherwise, no box shadow.

<ts-drawer [hideShadowWhenCollapsed]="true">...</ts-drawer>

Fixed header and footer

The drawer supports both a header and footer:

<ts-drawer-header>
  My header content...
</ts-drawer-header>
<ts-drawer-footer>
  My footer content...
</ts-drawer-footer>

Events

Container events

| Event | Description | Payload | |:----------------|:-------------------------------|:--------| | backdropClick | Fired when backdrop is clicked | void |

Drawer events

| Event | Description | Payload | |:-----------------|:----------------------------------------------|:--------| | expandedStart | Fired when the drawer expansion starts | void | | collapsedStart | Fired when the drawer collapse starts | void | | expandedChange | Fired when state change ends (animation ends) | boolean |