mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(build): rename ionic directory to src and update all references in the build process.
This commit is contained in:
73
src/components/label/label.ios.scss
Normal file
73
src/components/label/label.ios.scss
Normal file
@@ -0,0 +1,73 @@
|
||||
@import "../../globals.ios";
|
||||
@import "./label";
|
||||
|
||||
// iOS Label
|
||||
// --------------------------------------------------
|
||||
|
||||
$label-ios-text-color: #7f7f7f !default;
|
||||
$label-ios-margin: $item-ios-padding-top ($item-ios-padding-right / 2) $item-ios-padding-bottom 0 !default;
|
||||
|
||||
|
||||
// iOS Default Label
|
||||
// --------------------------------------------------
|
||||
|
||||
ion-label {
|
||||
margin: $label-ios-margin;
|
||||
}
|
||||
|
||||
|
||||
// iOS Default Label Inside An Input/Select Item
|
||||
// --------------------------------------------------
|
||||
|
||||
.item-input ion-label,
|
||||
.item-select ion-label {
|
||||
color: $label-ios-text-color;
|
||||
}
|
||||
|
||||
ion-label + ion-input .text-input,
|
||||
ion-label + ion-textarea .text-input {
|
||||
margin-left: $item-ios-padding-left;
|
||||
|
||||
width: calc(100% - (#{$item-ios-padding-right} / 2) - #{$item-ios-padding-left});
|
||||
}
|
||||
|
||||
|
||||
// iOS Stacked & Floating Labels
|
||||
// --------------------------------------------------
|
||||
|
||||
ion-label[stacked] {
|
||||
margin-bottom: 4px;
|
||||
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
ion-label[floating] {
|
||||
margin-bottom: 0;
|
||||
|
||||
transform: translate3d(0, 27px, 0);
|
||||
transform-origin: left top;
|
||||
transition: transform 150ms ease-in-out;
|
||||
}
|
||||
|
||||
.input-has-focus ion-label[floating],
|
||||
.input-has-value ion-label[floating] {
|
||||
transform: translate3d(0, 0, 0) scale(.8);
|
||||
}
|
||||
|
||||
.item-label-stacked [item-right],
|
||||
.item-label-floating [item-right] {
|
||||
margin-top: $item-ios-padding-media-top - 2;
|
||||
margin-bottom: $item-ios-padding-media-bottom - 2;
|
||||
}
|
||||
|
||||
|
||||
// Generate iOS Label colors
|
||||
// --------------------------------------------------
|
||||
|
||||
@each $color-name, $color-base, $color-contrast in get-colors($colors-ios) {
|
||||
|
||||
ion-label[#{$color-name}] {
|
||||
color: $color-base;
|
||||
}
|
||||
|
||||
}
|
||||
78
src/components/label/label.md.scss
Normal file
78
src/components/label/label.md.scss
Normal file
@@ -0,0 +1,78 @@
|
||||
@import "../../globals.md";
|
||||
@import "./label";
|
||||
|
||||
// Material Design Label
|
||||
// --------------------------------------------------
|
||||
|
||||
$label-md-text-color: #999 !default;
|
||||
$label-md-text-color-focused: color($colors-md, primary) !default;
|
||||
$label-md-margin: $item-md-padding-top ($item-md-padding-right / 2) $item-md-padding-bottom 0 !default;
|
||||
|
||||
|
||||
// Material Design Default Label
|
||||
// --------------------------------------------------
|
||||
|
||||
ion-label {
|
||||
margin: $label-md-margin;
|
||||
}
|
||||
|
||||
[text-wrap] ion-label {
|
||||
font-size: $item-md-body-text-font-size;
|
||||
line-height: $item-md-body-text-line-height;
|
||||
}
|
||||
|
||||
// Material Design Default Label Inside An Input/Select Item
|
||||
// --------------------------------------------------
|
||||
|
||||
.item-input ion-label,
|
||||
.item-select ion-label {
|
||||
color: $label-md-text-color;
|
||||
}
|
||||
|
||||
|
||||
// Material Design Stacked & Floating Labels
|
||||
// --------------------------------------------------
|
||||
|
||||
ion-label[stacked] {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
ion-label[floating] {
|
||||
transform: translate3d(0, 27px, 0);
|
||||
transform-origin: left top;
|
||||
transition: transform 150ms ease-in-out;
|
||||
}
|
||||
|
||||
ion-label[stacked],
|
||||
ion-label[floating] {
|
||||
margin-bottom: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.input-has-focus ion-label[stacked],
|
||||
.input-has-focus ion-label[floating] {
|
||||
color: $label-md-text-color-focused;
|
||||
}
|
||||
|
||||
.input-has-focus ion-label[floating],
|
||||
.input-has-value ion-label[floating] {
|
||||
transform: translate3d(0, 0, 0) scale(.8);
|
||||
}
|
||||
|
||||
.item-label-stacked [item-right],
|
||||
.item-label-floating [item-right] {
|
||||
margin-top: $item-md-padding-media-top - 2;
|
||||
margin-bottom: $item-md-padding-media-bottom - 2;
|
||||
}
|
||||
|
||||
|
||||
// Generate Material Design Label colors
|
||||
// --------------------------------------------------
|
||||
|
||||
@each $color-name, $color-base, $color-contrast in get-colors($colors-md) {
|
||||
|
||||
ion-label[#{$color-name}] {
|
||||
color: $color-base;
|
||||
}
|
||||
|
||||
}
|
||||
68
src/components/label/label.scss
Normal file
68
src/components/label/label.scss
Normal file
@@ -0,0 +1,68 @@
|
||||
@import "../../globals.core";
|
||||
|
||||
// Label
|
||||
// --------------------------------------------------
|
||||
|
||||
ion-label {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
|
||||
flex: 1;
|
||||
|
||||
margin: 0;
|
||||
|
||||
font-size: inherit;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.item-input ion-label {
|
||||
flex: initial;
|
||||
|
||||
max-width: 200px;
|
||||
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
[text-wrap] ion-label {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
|
||||
// Stacked & Floating Inputs
|
||||
// --------------------------------------------------
|
||||
|
||||
ion-label[fixed] {
|
||||
flex: 0 0 100px;
|
||||
|
||||
width: 100px;
|
||||
min-width: 100px;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
ion-label[stacked],
|
||||
ion-label[floating] {
|
||||
align-self: stretch;
|
||||
|
||||
margin-bottom: 0;
|
||||
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.item-label-stacked .input-wrapper,
|
||||
.item-label-floating .input-wrapper {
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.item-label-stacked ion-select,
|
||||
.item-label-floating ion-select {
|
||||
align-self: stretch;
|
||||
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.item-select ion-label[floating] {
|
||||
transform: translate3d(0, 0, 0) scale(.8);
|
||||
}
|
||||
106
src/components/label/label.ts
Normal file
106
src/components/label/label.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import {Directive, ElementRef, Renderer, Input, Optional, Attribute} from '@angular/core';
|
||||
|
||||
|
||||
/**
|
||||
* @name Label
|
||||
* @description
|
||||
* Labels are placed inside of an `ion-item` element and can be used
|
||||
* to describe an `ion-input`, `ion-toggle`, `ion-checkbox`, and more.
|
||||
*
|
||||
* @property [fixed] - A persistent label that sits next the input.
|
||||
* @property [floating] - A label that will float about the input if the input is empty or loses focus.
|
||||
* @property [stacked] - A stacked label will always appear on top of the input.
|
||||
|
||||
*
|
||||
* @usage
|
||||
* ```html
|
||||
* <ion-item>
|
||||
* <ion-label>Username</ion-label>
|
||||
* <ion-input></ion-input>
|
||||
* </ion-item>
|
||||
*
|
||||
* <ion-item>
|
||||
* <ion-label fixed>Website</ion-label>
|
||||
* <ion-input type="url"></ion-input>
|
||||
* </ion-item>
|
||||
*
|
||||
* <ion-item>
|
||||
* <ion-label floating>Email</ion-label>
|
||||
* <ion-input type="email"></ion-input>
|
||||
* </ion-item>
|
||||
*
|
||||
* <ion-item>
|
||||
* <ion-label stacked>Phone</ion-label>
|
||||
* <ion-input type="tel"></ion-input>
|
||||
* </ion-item>
|
||||
*
|
||||
* <ion-item>
|
||||
* <ion-label>Toggle</ion-label>
|
||||
* <ion-toggle></ion-toggle>
|
||||
* </ion-item>
|
||||
*
|
||||
* <ion-item>
|
||||
* <ion-label>Checkbox</ion-label>
|
||||
* <ion-checkbox></ion-checkbox>
|
||||
* </ion-item>
|
||||
* ```
|
||||
*
|
||||
* @demo /docs/v2/demos/label/
|
||||
* @see {@link ../../../../components#inputs Input Component Docs}
|
||||
* @see {@link ../Input Input API Docs}
|
||||
*
|
||||
*/
|
||||
|
||||
@Directive({
|
||||
selector: 'ion-label'
|
||||
})
|
||||
export class Label {
|
||||
private _id: string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
type: string;
|
||||
|
||||
constructor(
|
||||
private _elementRef: ElementRef,
|
||||
private _renderer: Renderer,
|
||||
@Attribute('floating') isFloating: string,
|
||||
@Attribute('stacked') isStacked: string,
|
||||
@Attribute('fixed') isFixed: string,
|
||||
@Attribute('inset') isInset: string
|
||||
) {
|
||||
this.type = (isFloating === '' ? 'floating' : (isStacked === '' ? 'stacked' : (isFixed === '' ? 'fixed' : (isInset === '' ? 'inset' : null))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@Input()
|
||||
get id(): string {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
set id(val: string) {
|
||||
this._id = val;
|
||||
if (val) {
|
||||
this._renderer.setElementAttribute(this._elementRef.nativeElement, 'id', val);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
get text(): string {
|
||||
return this._elementRef.nativeElement.textContent || '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {string} add class name
|
||||
*/
|
||||
addClass(className: string) {
|
||||
this._renderer.setElementClass(this._elementRef.nativeElement, className, true);
|
||||
}
|
||||
|
||||
}
|
||||
72
src/components/label/label.wp.scss
Normal file
72
src/components/label/label.wp.scss
Normal file
@@ -0,0 +1,72 @@
|
||||
@import "../../globals.wp";
|
||||
@import "./label";
|
||||
|
||||
// Windows Label
|
||||
// --------------------------------------------------
|
||||
|
||||
$label-wp-text-color: #999 !default;
|
||||
$label-wp-text-color-focused: color($colors-wp, primary) !default;
|
||||
|
||||
|
||||
// Windows Default Label
|
||||
// --------------------------------------------------
|
||||
|
||||
ion-label {
|
||||
margin: $item-wp-padding-top ($item-wp-padding-right / 2) $item-wp-padding-bottom 0;
|
||||
}
|
||||
|
||||
|
||||
// Windows Default Label Inside An Input/Select Item
|
||||
// --------------------------------------------------
|
||||
|
||||
.item-input ion-label,
|
||||
.item-select ion-label {
|
||||
color: $label-wp-text-color;
|
||||
}
|
||||
|
||||
|
||||
// Windows Stacked & Floating Labels
|
||||
// --------------------------------------------------
|
||||
|
||||
ion-label[stacked] {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
ion-label[floating] {
|
||||
transform: translate3d(8px, 34px, 0);
|
||||
transform-origin: left top;
|
||||
}
|
||||
|
||||
ion-label[stacked],
|
||||
ion-label[floating] {
|
||||
margin-bottom: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.input-has-focus ion-label[stacked],
|
||||
.input-has-focus ion-label[floating] {
|
||||
color: $label-wp-text-color-focused;
|
||||
}
|
||||
|
||||
.input-has-focus ion-label[floating],
|
||||
.input-has-value ion-label[floating] {
|
||||
transform: translate3d(0, 0, 0) scale(.8);
|
||||
}
|
||||
|
||||
.item-label-stacked [item-right],
|
||||
.item-label-floating [item-right] {
|
||||
margin-top: $item-wp-padding-media-top + 4;
|
||||
margin-bottom: $item-wp-padding-media-top + 4;
|
||||
}
|
||||
|
||||
|
||||
// Generate Windows Label colors
|
||||
// --------------------------------------------------
|
||||
|
||||
@each $color-name, $color-base, $color-contrast in get-colors($colors-wp) {
|
||||
|
||||
ion-label[#{$color-name}] {
|
||||
color: $color-base;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user