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

@guillotinaweb/pastanaga-angular

v2.67.8

Published

Provides Pastanaga UI elements as Angular components

Downloads

318

Readme

Pastanaga Angular

Build Status npm version code style: prettier

Pastanaga Angular is an Angular implementation of Pastanaga design system offering a set of re-usable UI components which are covering typical needs of any web application. It is maintained by Plone and Guillotina communities. It aims to remain simple, and pays particular attention to:

  • Accessibility: semantic is respected, and aria attributes are implemented where needed;
  • Internationalisation: the translation service allows to manage several languages in a single Angular build, and support granular overriding;
  • Maintenance: releases are frequent, and upgrade to latest Angular version is performed very quickly after each Angular release.

See https://plone.github.io/pastanaga-angular for usage examples and developer guide.

Table of content

Setup

Installation

You can install Pastanaga-angular using its npm package:

  • using npm:
npm install @guillotinaweb/pastanaga-angular
  • using yarn:
yarn add @guillotinaweb/pastanaga-angular

But if you want to build your own demo application using pastanaga demo components, you need to install it using mrs-developer:

  • first install mrs-developer if you don't already have it:
yarn add mrs-developer 
  • then add pastanaga-angular to your mrs.developer.json configuration (you can choose a specific tag as below, or a branch):
{
  "pastanaga-angular": {
    "url": "[email protected]:plone/pastanaga-angular.git",
    "https": "https://github.com/plone/pastanaga-angular.git",
    "path": "/projects/pastanaga-angular/src",
    "package": "@guillotinaweb/pastanaga-angular",
    "tag": "2.52.1"
  }
}
  • and launch the installation by running missdev:
missdev

Note: By default, missdev will install the dependencies in src/dev folder. If you're in a workspace with a mono-repository structure (using nx for instance), then you probably want to install pastanaga-angular in your libs folder. You can do so by using missdev --output option:

missdev --output=../libs

Configuration

Style preprocessing

Pastanaga-angular requires two files (pastanaga-core-overrides.scss and pastanaga-component-overrides.scss) to be in the src folder of any project using it. In order for those files to be found during the compilation, you have to add src folder in style preprocessing options of angular.json:

    "stylePreprocessorOptions": {
        "includePaths": [
            "src"
        ]
    }

Assets

Pastanaga-angular is using Poppins fonts and Quanta glyphs.

If you want to use the same fonts and glyphs sprite, declare Pastanaga assets in angular.json:

  • when using npm package:
{
  "assets": [
    "src/favicon.ico",
    "src/assets",
    {
      "glob": "**/*",
      "input": "./node_modules/@guillotinaweb/pastanaga-angular/assets",
      "output": "assets"
    }
  ]
}
  • when using mrs-developer:
{
  "assets": [
    "src/favicon.ico",
    "src/assets",
    {
      "glob": "**/*",
      "input": "./src/develop/pastanaga-angular/projects/pastanaga-angular/assets",
      "output": "assets"
    }
  ]
}

Core style

Import Pastanaga core style in your application style (usually src/styles.scss):

  • when using npm package:
@import "~@guillotinaweb/pastanaga-angular/lib/styles/core";
  • when using mrs-developer
@import "./develop/pastanaga-angular/projects/pastanaga-angular/lib/styles/core";

Theming

Fonts

If you want to use Pastanaga fonts in your application, you need to

  • declare the $font-path in your application style:
$font-path: '../../../assets/fonts';

Warning: since angular 10, scss variable is now relative to the place it is called.

  • and import Pastanaga fonts in your application style as well:
    • when using npm package
@import "~@guillotinaweb/pastanaga-angular/lib/styles/fonts";
  • when using mrs-developer
@import "./develop/pastanaga-angular/projects/pastanaga-angular/lib/styles/fonts";

Overriding theme

Any project using pastanaga-angular must have two files (pastanaga-core-overrides.scss and pastanaga-component-overrides.scss) in their src folder. Keep those file empty if you want to use Pastanaga theme.

If you have your own theme, you can override pastanaga theme by overriding the tokens in these two files:

  • pastanaga-core-overrides.scss allows to override variables from:
    • theme/palette
    • theme/layout
    • theme/scrollbar
    • theme/shadows
    • theme/spacing
    • theme/transitions
    • theme/typography
    • theme/z-index
  • pastanaga-component-overrides.scss allows to override variables from all other theming files like:
    • theme/avatar
    • theme/body
    • theme/button
    • theme/chips
    • theme/icon
    • theme/menu
    • theme/modal
    • theme/tables
    • theme/tabs
    • theme/textfield
    • theme/toast
    • theme/toggle
    • theme/tooltip

Pastanaga theme is defined in src/lib/styles/theme folder. Any variable with !default suffix can be overwritten.

Pastanaga theme is built around token. For example, _palette.token.scss contains all the colors used in Pastanaga with general token names (e.g. $color-neutral-regular, $color-primary-stronger). See the full list in https://plone.github.io/pastanaga-angular/palette.

Then, some components have a second layer of tokens. For example buttons have a list of tokens for each aspect and kind (e.g. $color-text-button-primary-solid, $color-background-button-primary-solid,…). So you can have your own theme by overwriting the whole color palette or just by changing some aspects of some components.

Migration guide version 1.x to version 2.x

Module names

In Pastanaga 2+, we prefix all modules with Pa: ButtonModule becomes PaButtonModule.

Components common properties

Pastanaga now contains some useful types for properties configuring several components:

  • Kind: primary | secondary | destructive | inverted
  • Size: tee-shirt size going from small to xxlarge. Not all sizes are available for all components

Buttons

We changed the way to configure buttons:

  • color is now managed by kind property
  • size is now expecting to be one of the values of Size type
  • border property is replaced by aspect which can be solid or basic

See https://plone.github.io/pastanaga-angular/button for full documentation.

Icons

pa-icon is now using a svg sprites to display icons by name. You can still provide a full path to display any other image though.

See https://plone.github.io/pastanaga-angular/icon for full documentation.

Form elements

We changed form elements hierarchy: now they are all in the same place under controls folder. They still belong to two distinct modules (PaTextFieldModule and PaTogglesModule).

All controls are sharing some properties:

  • PaFormControlDirective is the base class containing common properties (like id, name, disabled…) for all form elements components
  • NativeTextFieldDirective is extending PaFormControlDirective and contains common properties for all text field elements (like placeholder, value, readonly,…)