mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
154 lines
5.0 KiB
SCSS
154 lines
5.0 KiB
SCSS
@import "../../themes/ionic.globals.md";
|
|
|
|
// Material Design Input
|
|
// --------------------------------------------------
|
|
|
|
$text-input-md-background-color: $list-md-background-color !default;
|
|
|
|
$text-input-md-margin-top: $item-md-padding-top !default;
|
|
$text-input-md-margin-right: ($item-md-padding-right / 2) !default;
|
|
$text-input-md-margin-bottom: $item-md-padding-bottom !default;
|
|
$text-input-md-margin-left: ($item-md-padding-left / 2) !default;
|
|
|
|
$text-input-md-input-clear-icon-width: 30px !default;
|
|
$text-input-md-input-clear-icon-color: #5b5b5b !default;
|
|
$text-input-md-input-clear-icon-svg: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><polygon fill='" + $text-input-md-input-clear-icon-color + "' points='405,136.798 375.202,107 256,226.202 136.798,107 107,136.798 226.202,256 107,375.202 136.798,405 256,285.798 375.202,405 405,375.202 285.798,256'/></svg>" !default;
|
|
$text-input-md-input-clear-icon-size: 22px !default;
|
|
|
|
$text-input-md-show-focus-highlight: true !default;
|
|
$text-input-md-show-valid-highlight: $text-input-md-show-focus-highlight !default;
|
|
$text-input-md-show-invalid-highlight: $text-input-md-show-focus-highlight !default;
|
|
|
|
$text-input-md-highlight-color: color($colors-md, primary) !default;
|
|
$text-input-md-highlight-color-valid: color($colors-md, secondary) !default;
|
|
$text-input-md-highlight-color-invalid: color($colors-md, danger) !default;
|
|
|
|
|
|
// Material Design Default Input
|
|
// --------------------------------------------------
|
|
|
|
.text-input-md {
|
|
margin: $text-input-md-margin-top $text-input-md-margin-right $text-input-md-margin-bottom $text-input-md-margin-left;
|
|
padding: 0;
|
|
|
|
width: calc(100% - #{$text-input-md-margin-right} - #{$text-input-md-margin-left});
|
|
}
|
|
|
|
|
|
// Material Design Inset Input
|
|
// --------------------------------------------------
|
|
|
|
.input-md .inset-input {
|
|
margin: ($item-md-padding-top / 2) $item-md-padding-right ($item-md-padding-bottom / 2) $item-md-padding-left;
|
|
padding: ($item-md-padding-top / 2) ($item-md-padding-right / 2) ($item-md-padding-bottom / 2) ($item-md-padding-left / 2);
|
|
}
|
|
|
|
|
|
// Material Design Highlighted Input
|
|
// --------------------------------------------------
|
|
|
|
// Input highlight mixin for focus, valid, and invalid states
|
|
@mixin md-input-highlight($highlight-color) {
|
|
border-bottom-color: $highlight-color;
|
|
box-shadow: inset 0 -1px 0 0 $highlight-color;
|
|
}
|
|
|
|
// Show the focus highlight when the input has focus
|
|
@if ($text-input-md-show-focus-highlight) {
|
|
// In order to get a 2px border we need to add an inset
|
|
// box-shadow 1px (this is to avoid the div resizing)
|
|
.item-md.item-input.input-has-focus .item-inner {
|
|
@include md-input-highlight($text-input-md-highlight-color);
|
|
}
|
|
|
|
// The last item in a list has a border on the item, not the
|
|
// inner item, so add it to the item itself
|
|
.list-md .item-input.input-has-focus:last-child {
|
|
@include md-input-highlight($text-input-md-highlight-color);
|
|
|
|
.item-inner {
|
|
box-shadow: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Show the valid highlight when it has the .ng-valid class and a value
|
|
@if ($text-input-md-show-valid-highlight) {
|
|
.item-md.item-input.ng-valid.input-has-value:not(.input-has-focus) .item-inner {
|
|
@include md-input-highlight($text-input-md-highlight-color-valid);
|
|
}
|
|
|
|
.list-md .item-input.ng-valid.input-has-value:not(.input-has-focus):last-child {
|
|
@include md-input-highlight($text-input-md-highlight-color-valid);
|
|
|
|
.item-inner {
|
|
box-shadow: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Show the invalid highlight when it has the invalid class and has been touched
|
|
@if ($text-input-md-show-invalid-highlight) {
|
|
.item-md.item-input.ng-invalid.ng-touched:not(.input-has-focus) .item-inner {
|
|
@include md-input-highlight($text-input-md-highlight-color-invalid);
|
|
}
|
|
|
|
.list-md .item-input.ng-invalid.ng-touched:not(.input-has-focus):last-child {
|
|
@include md-input-highlight($text-input-md-highlight-color-invalid);
|
|
|
|
.item-inner {
|
|
box-shadow: none;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Material Design Stacked & Floating Inputs
|
|
// --------------------------------------------------
|
|
|
|
.item-label-stacked .text-input-md,
|
|
.item-label-floating .text-input-md {
|
|
margin-top: 8px;
|
|
margin-bottom: 8px;
|
|
margin-left: 0;
|
|
|
|
width: calc(100% - #{$text-input-md-margin-right});
|
|
}
|
|
|
|
.item-label-stacked .select-md,
|
|
.item-label-floating .select-md {
|
|
padding-top: 8px;
|
|
padding-bottom: 8px;
|
|
padding-left: 0;
|
|
}
|
|
|
|
.item-label-floating .text-input-md.cloned-input {
|
|
top: 32px;
|
|
}
|
|
|
|
.item-label-stacked .text-input-md.cloned-input {
|
|
top: 27px;
|
|
}
|
|
|
|
|
|
// Material Design Clear Input Icon
|
|
// --------------------------------------------------
|
|
|
|
.input-md[clearInput] {
|
|
position: relative;
|
|
}
|
|
|
|
.input-md[clearInput] .text-input {
|
|
padding-right: $text-input-md-input-clear-icon-width;
|
|
}
|
|
|
|
.input-md .text-input-clear-icon {
|
|
@include svg-background-image($text-input-md-input-clear-icon-svg);
|
|
|
|
right: ($item-md-padding-right / 2);
|
|
|
|
width: $text-input-md-input-clear-icon-width;
|
|
|
|
background-size: $text-input-md-input-clear-icon-size;
|
|
}
|