UNPKG

10.5 kBJavaScriptView Raw
1var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5 return c > 3 && r && Object.defineProperty(target, key, r), r;
6};
7var __metadata = (this && this.__metadata) || function (k, v) {
8 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9};
10import { NgModule, Component, ViewEncapsulation, ChangeDetectionStrategy, Directive } from '@angular/core';
11/**
12 * Content of a card, needed as it's used as a selector in the API.
13 */
14export var MdCardContent = (function () {
15 function MdCardContent() {
16 }
17 MdCardContent = __decorate([
18 Directive({
19 selector: 'md-card-content'
20 }),
21 __metadata('design:paramtypes', [])
22 ], MdCardContent);
23 return MdCardContent;
24}());
25/**
26 * Title of a card, needed as it's used as a selector in the API.
27 */
28export var MdCardTitle = (function () {
29 function MdCardTitle() {
30 }
31 MdCardTitle = __decorate([
32 Directive({
33 selector: 'md-card-title'
34 }),
35 __metadata('design:paramtypes', [])
36 ], MdCardTitle);
37 return MdCardTitle;
38}());
39/**
40 * Sub-title of a card, needed as it's used as a selector in the API.
41 */
42export var MdCardSubtitle = (function () {
43 function MdCardSubtitle() {
44 }
45 MdCardSubtitle = __decorate([
46 Directive({
47 selector: 'md-card-subtitle'
48 }),
49 __metadata('design:paramtypes', [])
50 ], MdCardSubtitle);
51 return MdCardSubtitle;
52}());
53/**
54 * Action section of a card, needed as it's used as a selector in the API.
55 */
56export var MdCardActions = (function () {
57 function MdCardActions() {
58 }
59 MdCardActions = __decorate([
60 Directive({
61 selector: 'md-card-actions'
62 }),
63 __metadata('design:paramtypes', [])
64 ], MdCardActions);
65 return MdCardActions;
66}());
67/*
68
69<md-card> is a basic content container component that adds the styles of a material design card.
70
71While you can use this component alone,
72it also provides a number of preset styles for common card sections, including:
73 - md-card-title
74 - md-card-subtitle
75 - md-card-content
76 - md-card-actions
77 - md-card-footer
78
79 You can see some examples of cards here:
80 http://embed.plnkr.co/s5O4YcyvbLhIApSrIhtj/
81
82 TODO(kara): update link to demo site when it exists
83
84*/
85export var MdCard = (function () {
86 function MdCard() {
87 }
88 MdCard = __decorate([
89 Component({selector: 'md-card',
90 template: "<ng-content></ng-content> ",
91 styles: ["/** * A collection of mixins and CSS classes that can be used to apply elevation to a material * element. * See: https://www.google.com/design/spec/what-is-material/elevation-shadows.html * Examples: * * * .md-foo { * @include $md-elevation(2); * * &:active { * @include $md-elevation(8); * } * } * * <div id=\"external-card\" class=\"md-elevation-z2\"><p>Some content</p></div> * * For an explanation of the design behind how elevation is implemented, see the design doc at * https://goo.gl/Kq0k9Z. */ /** * The css property used for elevation. In most cases this should not be changed. It is exposed * as a variable for abstraction / easy use when needing to reference the property directly, for * example in a will-change rule. */ /** The default duration value for elevation transitions. */ /** The default easing value for elevation transitions. */ /** * Applies the correct css rules to an element to give it the elevation specified by $zValue. * The $zValue must be between 0 and 24. */ /** * Returns a string that can be used as the value for a transition property for elevation. * Calling this function directly is useful in situations where a component needs to transition * more than one property. * * .foo { * transition: md-elevation-transition-property-value(), opacity 100ms ease; * will-change: $md-elevation-property, opacity; * } */ /** * Applies the correct css rules needed to have an element transition between elevations. * This mixin should be applied to elements whose elevation values will change depending on their * context (e.g. when active or disabled). */ md-card { box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12); transition: box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1); will-change: box-shadow; display: block; position: relative; padding: 24px; border-radius: 2px; font-family: Roboto, \"Helvetica Neue\", sans-serif; background: white; color: black; } md-card:hover { box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12); } .md-card-flat { box-shadow: none; } md-card-title, md-card-subtitle, md-card-content, md-card-actions { display: block; margin-bottom: 16px; } md-card-title { font-size: 24px; font-weight: 400; } md-card-subtitle { font-size: 14px; color: rgba(0, 0, 0, 0.54); } md-card-content { font-size: 14px; } md-card-actions { margin-left: -16px; margin-right: -16px; padding: 8px 0; } md-card-actions[align='end'] { display: flex; justify-content: flex-end; } [md-card-image] { width: calc(100% + 48px); margin: 0 -24px 16px -24px; } [md-card-xl-image] { width: 240px; height: 240px; margin: -8px; } md-card-footer { position: absolute; bottom: 0; } md-card-actions [md-button], md-card-actions [md-raised-button] { margin: 0 4px; } /* HEADER STYLES */ md-card-header { display: flex; flex-direction: row; height: 40px; margin: -8px 0 16px 0; } .md-card-header-text { height: 40px; margin: 0 8px; } [md-card-avatar] { height: 40px; width: 40px; border-radius: 50%; } md-card-header md-card-title { font-size: 14px; } /* TITLE-GROUP STYLES */ [md-card-sm-image], [md-card-md-image], [md-card-lg-image] { margin: -8px 0; } md-card-title-group { display: flex; justify-content: space-between; margin: 0 -8px; } [md-card-sm-image] { width: 80px; height: 80px; } [md-card-md-image] { width: 112px; height: 112px; } [md-card-lg-image] { width: 152px; height: 152px; } /* MEDIA QUERIES */ @media (max-width: 600px) { md-card { padding: 24px 16px; } [md-card-image] { width: calc(100% + 32px); margin: 16px -16px; } md-card-title-group { margin: 0; } [md-card-xl-image] { margin-left: 0; margin-right: 0; } md-card-header { margin: -8px 0 0 0; } } /* FIRST/LAST CHILD ADJUSTMENTS */ md-card > :first-child, md-card-content > :first-child { margin-top: 0; } md-card > :last-child, md-card-content > :last-child { margin-bottom: 0; } [md-card-image]:first-child { margin-top: -24px; } md-card > md-card-actions:last-child { margin-bottom: -16px; padding-bottom: 0; } md-card-actions [md-button]:first-child, md-card-actions [md-raised-button]:first-child { margin-left: 0; margin-right: 0; } md-card-title:not(:first-child), md-card-subtitle:not(:first-child) { margin-top: -4px; } md-card-header md-card-subtitle:not(:first-child) { margin-top: -8px; } md-card > [md-card-xl-image]:first-child { margin-top: -8px; } md-card > [md-card-xl-image]:last-child { margin-bottom: -8px; } /*# sourceMappingURL=card.css.map */ "],
92 encapsulation: ViewEncapsulation.None,
93 changeDetection: ChangeDetectionStrategy.OnPush,
94 }),
95 __metadata('design:paramtypes', [])
96 ], MdCard);
97 return MdCard;
98}());
99/* The following components don't have any behavior.
100 They simply use content projection to wrap user content
101 for flex layout purposes in <md-card> (and thus allow a cleaner, boilerplate-free API).
102
103
104<md-card-header> is a component intended to be used within the <md-card> component.
105It adds styles for a preset header section (i.e. a title, subtitle, and avatar layout).
106
107You can see an example of a card with a header here:
108http://embed.plnkr.co/tvJl19z3gZTQd6WmwkIa/
109
110TODO(kara): update link to demo site when it exists
111*/
112export var MdCardHeader = (function () {
113 function MdCardHeader() {
114 }
115 MdCardHeader = __decorate([
116 Component({selector: 'md-card-header',
117 template: "<ng-content select=\"[md-card-avatar]\"></ng-content> <div class=\"md-card-header-text\"> <ng-content select=\"md-card-title, md-card-subtitle\"></ng-content> </div> <ng-content></ng-content> ",
118 encapsulation: ViewEncapsulation.None,
119 changeDetection: ChangeDetectionStrategy.OnPush,
120 }),
121 __metadata('design:paramtypes', [])
122 ], MdCardHeader);
123 return MdCardHeader;
124}());
125/*
126
127<md-card-title-group> is a component intended to be used within the <md-card> component.
128It adds styles for a preset layout that groups an image with a title section.
129
130You can see an example of a card with a title-group section here:
131http://embed.plnkr.co/EDfgCF9eKcXjini1WODm/
132
133TODO(kara): update link to demo site when it exists
134*/
135export var MdCardTitleGroup = (function () {
136 function MdCardTitleGroup() {
137 }
138 MdCardTitleGroup = __decorate([
139 Component({selector: 'md-card-title-group',
140 template: "<div> <ng-content select=\"md-card-title, md-card-subtitle\"></ng-content> </div> <ng-content select=\"img\"></ng-content> <ng-content></ng-content> ",
141 encapsulation: ViewEncapsulation.None,
142 changeDetection: ChangeDetectionStrategy.OnPush,
143 }),
144 __metadata('design:paramtypes', [])
145 ], MdCardTitleGroup);
146 return MdCardTitleGroup;
147}());
148export var MdCardModule = (function () {
149 function MdCardModule() {
150 }
151 MdCardModule.forRoot = function () {
152 return {
153 ngModule: MdCardModule,
154 providers: []
155 };
156 };
157 MdCardModule = __decorate([
158 NgModule({
159 exports: [
160 MdCard, MdCardHeader, MdCardTitleGroup, MdCardContent, MdCardTitle, MdCardSubtitle,
161 MdCardActions
162 ],
163 declarations: [
164 MdCard, MdCardHeader, MdCardTitleGroup, MdCardContent, MdCardTitle, MdCardSubtitle,
165 MdCardActions
166 ],
167 }),
168 __metadata('design:paramtypes', [])
169 ], MdCardModule);
170 return MdCardModule;
171}());
172
173//# sourceMappingURL=card.js.map