Giter Site home page Giter Site logo

mseemann / angular2-mdl Goto Github PK

View Code? Open in Web Editor NEW
556.0 20.0 95.0 22.31 MB

Angular 2 - 14 components, directives and styles based on material design lite (npm: @angular-mdl/core)

Home Page: https://mseemann.io/angular2-mdl

License: MIT License

TypeScript 56.95% JavaScript 0.92% HTML 16.14% Shell 0.67% CSS 0.24% SCSS 25.09%
angular angular2 material-design mdl angular4 angular5

angular2-mdl's Introduction

Angular 15 components, directives and styles based on material design lite https://getmdl.io (v: 1.3.0). This package assumes that you are building an Angular app with TypeScript. Angular CLI makes it even easier but isn't required.

CircleCI npm version Downloads Coverage Status Code Climate FOSSA Status

Status of the npm package version 15 (mdl version 1.3.0; angular 14)

  • Badges
  • Buttons
  • Cards
  • Chips
  • Dialogs (imperative and declarative)
  • Icons
  • Loading
  • Shadow
  • Toggle (Checkbox, Radio, Icon Toggle, Switch)
  • Lists
  • Slider
  • Snackbar
  • Table
  • Tooltips
  • Menu
  • Layout (standard, scroll, waterfall, tabs)
  • Tabs
  • Textfields (multiline, expandable)

Installation

npm install @angular-mdl/core --save

css from material-design-lite

You may include the material-design-lite css in your html and you're done!

<link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.indigo-pink.min.css"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Under http://mseemann.io/angular2-mdl/theme you'll find a customizing tool to change the theme colors.

How to use the scss files from material-design-lite

This package includes the scss files from material-design-lite. With these files you are able to change the colors and other variables in your own scss files:

@import "~@angular-mdl/core/scss/color-definitions";

$color-primary: $palette-blue-500;
$color-primary-dark: $palette-blue-700;
$color-accent: $palette-amber-A200;
$color-primary-contrast: $color-dark-contrast;
$color-accent-contrast: $color-dark-contrast;

@import "~@angular-mdl/core/scss/material-design-lite";

To make this working you need to find out the way how you could tell your build system where the scss is located. For example with webpack you can use the special ~@angular-mdl/core syntax used above. Or you can configure the includePaths:

sassLoader: {
  includePaths: [util.root('node_modules', '@angular-mdl/core', 'scss')]
}

@angular-mdl/*

Additional components for @angular-mdl/core that are not part of material design lite

  • current angular version: 15
  • current angular-mdl version: 15

The components

Name Provided By Description npm documentation status demo
datepicker mseemann a simple date picker npm version readme experimental demo
expansion-panel abdulqadir93 organise arbitrary content in an expansion panel npm version readme experimental demo
fab-menu leojpod a fab menu component npm version readme experimental demo
popover tb popover with arbitrary content npm version readme experimental demo
select tb a select box npm version readme experimental demo

These components support AOT and TreeShaking!

How to use the components

Install the components via npm. Please check out the individual readme for each component from the table above.

Starting with version 0.2.0 the components each have no css styles imported by default. You need to setup your build pipeline to include the scss files from each component you want to use. This makes it possible to configure the theming for the components you want to use.

If you are using webpack you may use the special webpack import syntax for node_modules:

@import '~@angular-mdl/core/scss/color-definitions';

$color-primary: $palette-blue-500;
$color-primary-dark: $palette-blue-700;
$color-accent: $palette-amber-A200;
$color-primary-contrast: $color-dark-contrast;
$color-accent-contrast: $color-dark-contrast;

@import '~@angular-mdl/core/src/scss-mdl/material-design-lite';

@import '~@angular-mdl/popover/popover';
@import '~@angular-mdl/select/select';

Another way is to include each component folder in the search path for your scss preprocessor. An example for webpack:

sassLoader: {
	includePaths: [
		'node_modules/@angular-mdl/popover',
		'node_modules/@angular-mdl/select'
	]
}

Development

  • npm start - local dev server
  • npm build - build a production release
  • npm test - run the unit tests

The coverage report is stored under: coverage/coverage-remap/index.html

Contributing

Every contribution is welcome. Please checkout the CONTRIBUTION.md file.

Remarks

And if you would like to see a real world app that uses this package have a look at https://www.yovelino.de/apps/tour-planner/.

License

FOSSA Status

angular2-mdl's People

Contributors

abdulqadir93 avatar aklaus avatar alexey-vykhrystyuk-arcadia avatar andrewbents avatar angular-cli avatar crystalraebryant avatar dependabot[bot] avatar fossabot avatar greenkeeper[bot] avatar greenkeeperio-bot avatar guzmo avatar hanzubon avatar janpio avatar jlee1201 avatar joevanwanzeele avatar jsmike avatar leojpod avatar leolorenzoluis avatar mgiuliani avatar mseemann avatar paullryan avatar tb avatar tomicasoft avatar v-zhzhou avatar winfinit avatar zskhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular2-mdl's Issues

Chrome Autofill Not Showing on TextFields

Currently i am seeing that i cannot get chromes autofill to work on any of the text inputs from angular2-mdl. If you use standard MDL CSS you can normally double click a field with name and id (say username) and it will drop down a list of previously entered values.

I havent looked into the code enough to know why this would be happening, but have you noticed this as well? Has anyone seen similar issues on other browsers?

Thanks!

Error on project setup

Hi,
I have created a new project using Angular2-mdl with gulp.

I got the following error while adding

import { MDL_DIRECTIVES } from 'angular2-mdl'; @Component{ directives: [ MDL_DIRECTIVES ] }

zone.js:461 Unhandled Promise rejection: Template parse errors: Can't bind to 'mdl-ripple' since it isn't a known native property (" (click)="mdlLayout.tabSelected(tab)" class="mdl-layout__tab" [ERROR ->][mdl-ripple]="isRipple" [ngClass]="{'is-active': tab.isActive}">{{tab.title}}</a> "): MdlLayoutHeaderComponent@7:16 ; Zone: angular ; Task: Promise.then ; Value: BaseException$1consoleError @ zone.js:461

If I didn't add this then only text is visible in demo app.

Please help me on this.

It will be great if you create a seed project using angular2-mdl

Thanks,
Ananda

MdlTabsComponent - set selected tab programmatically

Thank you for your great work. I am using MDL with angular2 for some time but not with such a component abstraction (was not aware of this library until recently)

So, I am trying it out, and first the tabs component....

When I set the selectIndex property programmatically nothing happens.

Would be really good to be able to switch the selected tab.

What do you think?

And one more. I use the tab panels also with icons (instead of title). And more customizations.. (title with icons - and icons are dynamically show or hidden)
So a great improvement would be a construct like:

<mdl-tab-panel>
   <mdl-tab-panel-title>Do whatever you want</mdl-tab-panel-title>
</mdl-tab-panel>

Radio Buttons and Drop Down

Hey Mseemann,

I will be testing out the new features tonight for the validity checking but i had one other thing i ran into:

When using radio buttons with a reactive group the radio button view never updates. What i mean is that when you select a radio button, the selection in the group is updated, but ALL of the radio buttons selected stay colored.

      <mdl-radio name="group1" formControlName="value" [formGroup]="formGroup1" value="1" mdl-ripple>1</mdl-radio>
      <mdl-radio name="group1" formControlName="value" [formGroup]="formGroup1" value="2" mdl-ripple>2</mdl-radio>
      <mdl-radio name="group1" formControlName="value" [formGroup]="formGroup1" value="3" mdl-ripple>3</mdl-radio>
      <mdl-radio name="group1" formControlName="value" [formGroup]="formGroup1" value="4" mdl-ripple>4</mdl-radio>
      <mdl-radio name="group1" formControlName="value" [formGroup]="formGroup1" value="5" mdl-ripple>5</mdl-radio>

This is similar to the code i was using. Also i was on chrome and have not tested on other browsers yet. Any tips or does this look like a bug? (Maybe not redrawing the elements or something?)

Date picker and dropdown

Hi,

I did not find any date-picker and drop-down in angular2-mdl.

Can anybody suggest where can I get these 2 component with Angular2 and material design.

Thanks
Ananda

mdl-textfield and forms

Hi!

Is mdl-textfield compatible with angular/forms?
Is there a way to pass name and id attributes to the input element?

These code:

<form (ngSubmit)="generate(reportForm.value)">

<mdl-textfield type="text"
    label="IDs"
    [(ngModel)]="reportParams.userIds"
    floating-label
    ngControl="userIds"
    name="userIds"
    required
></mdl-textfield>


</form>

produces error:

vendor.js:43701 EXCEPTION: Error: Uncaught (in promise): No value accessor for form control with name: 'userIds'

Maybe, I'm doing something wrong.
npm: Angular2 rc5, angular/forms 0.3.0, angular2-mdl 1.3.0.

Pattern on Text Input invalidating Reactive Forms

I am seeing that if I use reactive forms and build a FormGroup with validators on fields it works fine on its own. Then when i add pattern and error-msg to a textField (that matches the FormGroup validators), the FormGroup is ALWAYS invalid. Any ideas on this?

Even if i dont have a pattern validator on the FormGroup it still happens.

Side note, the URL in the readme isnt updated to http://mseemann.io/angular2-mdl/ yet :)

Plans / intentions of angular2-mdl

The first impression of angular2-mdl is really good and it looks "professional".

But I am curious what the intention of angular2-mdl is...
e.g.

  • Is the library used in production applications?
  • Do you plan to support it for a longer time (e.g. support for an upcoming mdl 2.x)?
  • Do you want to involve contributors?
  • Or is it rather a proof of concept?

TIA

some question for mdl-icon

Hi,The project is very awesome.
When i use button,look like they have a diffrerent for getmdl;
When repeatedly the button,angular2-mdl will select that icon,but getmdl is not;
angular2-mdl will show a blue selected area,like text seleted.

If change

mdl-button to button

the show style is same.So i think this is a style issue.
Demo url with http://mseemann.de/angular2-mdl/button
https://getmdl.io/components/index.html#buttons-section

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.