# galadriel

> Wellbe component library

Latest version **2.0.1** (published 2021-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install galadriel
pnpm add galadriel
yarn add galadriel
bun add galadriel
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2021-03-27 |
| First published | 2020-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 12 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dj-neza |

## Links

- npm: https://www.npmjs.com/package/galadriel
- npm.io page: https://npm.io/package/galadriel

## Dependencies (4)

- [moment](https://npm.io/package/moment.md) ^2.27.0
- [flatpickr](https://npm.io/package/flatpickr.md) ^4.6.6
- [@ionic/core](https://npm.io/package/@ionic/core.md) ^5.3.2
- [@types/moment](https://npm.io/package/@types/moment.md) ^2.13.0

## Recent versions

- 2.0.1 (latest) — 2021-03-27
- 2.0.0 — 2021-03-27
- 1.1.8 — 2021-02-06
- 1.1.7 — 2021-01-24
- 1.1.6 — 2021-01-24
- 1.1.5 — 2021-01-16
- 1.1.4 — 2020-12-22
- 1.1.3 — 2020-12-07
- 1.1.2 — 2020-12-07
- 1.1.1 — 2020-12-07
- 1.1.0 — 2020-12-07
- 1.0.21 — 2020-11-10
- 1.0.20 — 2020-11-01
- 1.0.19 — 2020-11-01
- 1.0.18 — 2020-11-01
- … 145 more at https://npm.io/package/galadriel/versions

## README

![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI%2BCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI%2BCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU%2BCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00MjQuNywzNzMuOWMwLDM3LjYtNTUuMSw2OC42LTkyLjcsNjguNkgxODAuNGMtMzcuOSwwLTkyLjctMzAuNy05Mi43LTY4LjZ2LTMuNmgzMzYuOVYzNzMuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQyNC43LDI5Mi4xSDE4MC40Yy0zNy42LDAtOTIuNy0zMS05Mi43LTY4LjZ2LTMuNkgzMzJjMzcuNiwwLDkyLjcsMzEsOTIuNyw2OC42VjI5Mi4xeiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNDI0LjcsMTQxLjdIODcuN3YtMy42YzAtMzcuNiw1NC44LTY4LjYsOTIuNy02OC42SDMzMmMzNy45LDAsOTIuNywzMC43LDkyLjcsNjguNlYxNDEuN3oiLz4KPC9zdmc%2BCg%3D%3D&colorA=16161d&style=flat-square)

# GALADRIEL Design System

The library of web components and Storybook for the Galadriel Design System. The components can be used in any kind of web projects, the description here focuses on Ionic Angular so check StencilJS tutorials for other options. 

## Using the Design System

To get to know the Galadriel Design System check out the single source of truth in Storybook by following those steps: 

1. clone the git repository
2. run ```npm install```
3. run ```npm run storybook:full``` - will take care of any prebuilding needed to run the Storybook properly
4. sometimes the browser refuses to load the Addons panel of the Storybook - if that happens the Knobs, Design and HTML addon will be hidden and Canvas will take most of the space. To fix open the browser console and run ```localStorage.clear()```

## Using the component library in an Ionic project

To install the package into your project just run:

```bash
npm install --save galadriel
```

Import the package into the modules of every page that will use it (e.g. home.module.ts) by adding  `import galadriel;` into the file.

Allow non-angular elements in the project by importing and adding the  `CUSTOM_ELEMENTS_SCHEMA` to the same module file from above. The import statement should look something like that: 

```bash
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from  '@angular/core';
```

The custom elements schema is also added (in the same file) within the **NgModule** class (@NgModule decorator), under **schemas**. After adding your @NgModule should look sth like this: 

```bash
@NgModule({
    imports: [
        CommonModule,
        IonicModule
    ],
    declarations: [HomePage],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class HomePageModule {}
```

The last step is calling the `defineCustomElements` function in a `main.ts` file within the Ionic project located in the `/src` folder. Use the following import statement:

```bash
import { defineCustomElements } from  'package-name/loader';
```

Afterwards, add it in the bottom of the file (probably after 'platformBrowserDynamic()...') like this:

```bash
defineCustomElements(window);
```

All done! You can use the available components in the html of the page with their Stencil tags. Happy creating! 

## Handling object type of properties using Ionic property binding

Some of the components have objects as properties. In this case they can be added using the Ionic property binding. 

In the template file of the page (html) the property is bound to the expression with the square brackets as seen in the example below:

```html
<component [property]="expression"></component>
```

The expression is defined in the class definition of the component and can be an object of any kind. This works for any kind of objects in Ionic. 

## Handling emitted events of the components

The event emitters can be listened to in Ionic by using brackets in the template. The emitted event values can then be used in a function that is part of the page class as in the example below:

```html
<component [event]="function($event.detail.emittedvalue)"></component>
```

## Built by Wellbe 
All rights reserved.

---
_Source: https://npm.io/package/galadriel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
