aboutsummaryrefslogtreecommitdiffstats
path: root/themes
diff options
context:
space:
mode:
authorAdam Wagner <wbadam@users.noreply.github.com>2017-09-26 10:20:49 +0300
committerHenri Sara <henri.sara@gmail.com>2017-09-26 10:20:49 +0300
commitde2c1ce5b7706c3ee355205265d2440667fb6b6f (patch)
tree41f90cadfb6dbdf09c11a2c648eddf1729538ad2 /themes
parent5a412dfad6f14916925128c403deac57110da57b (diff)
downloadvaadin-framework-de2c1ce5b7706c3ee355205265d2440667fb6b6f.tar.gz
vaadin-framework-de2c1ce5b7706c3ee355205265d2440667fb6b6f.zip
Implement error level on client side (#9816)
Add additional class names and style to components and error indicators to distinguish different error levels. Vaadin 7 solution for #3139
Diffstat (limited to 'themes')
-rw-r--r--themes/src/main/themes/VAADIN/themes/valo/components/_combobox.scss55
-rw-r--r--themes/src/main/themes/VAADIN/themes/valo/components/_datefield.scss55
-rw-r--r--themes/src/main/themes/VAADIN/themes/valo/components/_textfield.scss70
-rw-r--r--themes/src/main/themes/VAADIN/themes/valo/components/_twincolselect.scss34
-rw-r--r--themes/src/main/themes/VAADIN/themes/valo/shared/_global.scss24
-rw-r--r--themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss60
-rw-r--r--themes/src/main/themes/VAADIN/themes/valo/shared/_variables.scss42
7 files changed, 334 insertions, 6 deletions
diff --git a/themes/src/main/themes/VAADIN/themes/valo/components/_combobox.scss b/themes/src/main/themes/VAADIN/themes/valo/components/_combobox.scss
index e9056ef17a..32b2aec3bc 100644
--- a/themes/src/main/themes/VAADIN/themes/valo/components/_combobox.scss
+++ b/themes/src/main/themes/VAADIN/themes/valo/components/_combobox.scss
@@ -31,6 +31,61 @@
}
}
+ .#{$primary-stylename}-error-info {
+ .#{$primary-stylename}-input {
+ @include valo-textfield-error-level-info-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-info-color;
+ border-color: $v-error-indicator-level-info-color;
+ }
+ }
+
+ .#{$primary-stylename}-error-warning {
+ .#{$primary-stylename}-input {
+ @include valo-textfield-error-level-warning-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-warning-color;
+ border-color: $v-error-indicator-level-warning-color;
+ }
+ }
+
+ .#{$primary-stylename}-error-error {
+ .#{$primary-stylename}-input {
+ @include valo-textfield-error-level-error-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-error-color;
+ border-color: $v-error-indicator-level-error-color;
+ }
+ }
+
+ .#{$primary-stylename}-error-critical {
+ .#{$primary-stylename}-input {
+ @include valo-textfield-error-level-critical-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-critical-color;
+ border-color: $v-error-indicator-level-critical-color;
+ }
+ }
+
+ .#{$primary-stylename}-error-system {
+ .#{$primary-stylename}-input {
+ @include valo-textfield-error-level-system-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-system-color;
+ border-color: $v-error-indicator-level-system-color;
+ }
+ }
+
.#{$primary-stylename}-suggestpopup {
@include valo-combobox-popup-style;
}
diff --git a/themes/src/main/themes/VAADIN/themes/valo/components/_datefield.scss b/themes/src/main/themes/VAADIN/themes/valo/components/_datefield.scss
index 6ff8a70dba..f5cb8154e8 100644
--- a/themes/src/main/themes/VAADIN/themes/valo/components/_datefield.scss
+++ b/themes/src/main/themes/VAADIN/themes/valo/components/_datefield.scss
@@ -25,6 +25,61 @@
}
}
+ .#{$primary-stylename}-error-info {
+ .#{$primary-stylename}-textfield {
+ @include valo-textfield-error-level-info-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-info-color;
+ border-color: $v-error-indicator-level-info-color;
+ }
+ }
+
+ .#{$primary-stylename}-error-warning {
+ .#{$primary-stylename}-textfield {
+ @include valo-textfield-error-level-warning-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-warning-color;
+ border-color: $v-error-indicator-level-warning-color;
+ }
+ }
+
+ .#{$primary-stylename}-error-error {
+ .#{$primary-stylename}-textfield {
+ @include valo-textfield-error-level-error-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-error-color;
+ border-color: $v-error-indicator-level-error-color;
+ }
+ }
+
+ .#{$primary-stylename}-error-critical {
+ .#{$primary-stylename}-textfield {
+ @include valo-textfield-error-level-critical-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-critical-color;
+ border-color: $v-error-indicator-level-critical-color;
+ }
+ }
+
+ .#{$primary-stylename}-error-system {
+ .#{$primary-stylename}-textfield {
+ @include valo-textfield-error-level-system-style;
+ }
+
+ .#{$primary-stylename}-button {
+ color: $v-error-indicator-level-system-color;
+ border-color: $v-error-indicator-level-system-color;
+ }
+ }
+
// Different widths for different resolutions
.#{$primary-stylename}-full {
width: round($v-font-size * 15);
diff --git a/themes/src/main/themes/VAADIN/themes/valo/components/_textfield.scss b/themes/src/main/themes/VAADIN/themes/valo/components/_textfield.scss
index 50cb7b8042..1b3552763d 100644
--- a/themes/src/main/themes/VAADIN/themes/valo/components/_textfield.scss
+++ b/themes/src/main/themes/VAADIN/themes/valo/components/_textfield.scss
@@ -70,6 +70,25 @@ $v-textfield-disabled-opacity: $v-disabled-opacity !default;
@include valo-textfield-error-style;
}
+ .#{$primary-stylename}-error-info {
+ @include valo-textfield-error-level-info-style;
+ }
+
+ .#{$primary-stylename}-error-warning {
+ @include valo-textfield-error-level-warning-style;
+ }
+
+ .#{$primary-stylename}-error-error {
+ @include valo-textfield-error-level-error-style;
+ }
+
+ .#{$primary-stylename}-error-critical {
+ @include valo-textfield-error-level-critical-style;
+ }
+
+ .#{$primary-stylename}-error-system {
+ @include valo-textfield-error-level-system-style;
+ }
@if $include-additional-styles {
.#{$primary-stylename}-borderless {
@@ -326,13 +345,58 @@ $v-textfield-disabled-opacity: $v-disabled-opacity !default;
*
* @group textfield
*/
-@mixin valo-textfield-error-style {
- border-color: $v-error-indicator-color !important;
- $bg: scale-color($v-error-indicator-color, $lightness: 98%);
+@mixin valo-textfield-error-style($indicator-color: $v-error-indicator-color) {
+ border-color: $indicator-color !important;
+ $bg: scale-color($indicator-color, $lightness: 98%);
background: $bg;
color: valo-font-color($bg);
}
+/**
+ * Outputs the styles for a text field error state with error level 'info'.
+ *
+ * @group textfield
+ */
+@mixin valo-textfield-error-level-info-style {
+ @include valo-textfield-error-style($v-error-indicator-level-info-color);
+}
+
+/**
+ * Outputs the styles for a text field error state with error level 'warning'.
+ *
+ * @group textfield
+ */
+@mixin valo-textfield-error-level-warning-style {
+ @include valo-textfield-error-style($v-error-indicator-level-warning-color);
+}
+
+/**
+ * Outputs the styles for a text field error state with error level 'error'.
+ *
+ * @group textfield
+ */
+@mixin valo-textfield-error-level-error-style {
+ @include valo-textfield-error-style($v-error-indicator-level-error-color);
+}
+
+/**
+ * Outputs the styles for a text field error state with error level 'critical'.
+ *
+ * @group textfield
+ */
+@mixin valo-textfield-error-level-critical-style {
+ @include valo-textfield-error-style($v-error-indicator-level-critical-color);
+}
+
+/**
+ * Outputs the styles for a text field error state with error level 'system'.
+ *
+ * @group textfield
+ */
+@mixin valo-textfield-error-level-system-style {
+ @include valo-textfield-error-style($v-error-indicator-level-system-color);
+}
+
/**
* Outputs the selectors and styles for an inline-icon style for a text field. Included indipendently (i.e. not enclosed with a parent text field selector).
diff --git a/themes/src/main/themes/VAADIN/themes/valo/components/_twincolselect.scss b/themes/src/main/themes/VAADIN/themes/valo/components/_twincolselect.scss
index 1d9a7e773e..8d220292e7 100644
--- a/themes/src/main/themes/VAADIN/themes/valo/components/_twincolselect.scss
+++ b/themes/src/main/themes/VAADIN/themes/valo/components/_twincolselect.scss
@@ -85,6 +85,40 @@
}
}
+ .#{$primary-stylename}-error-info {
+ .#{$primary-stylename}-options,
+ .#{$primary-stylename}-selections {
+ @include valo-textfield-error-level-info-style;
+ }
+ }
+
+ .#{$primary-stylename}-error-warning {
+ .#{$primary-stylename}-options,
+ .#{$primary-stylename}-selections {
+ @include valo-textfield-error-level-warning-style;
+ }
+ }
+
+ .#{$primary-stylename}-error-error {
+ .#{$primary-stylename}-options,
+ .#{$primary-stylename}-selections {
+ @include valo-textfield-error-level-error-style;
+ }
+ }
+
+ .#{$primary-stylename}-error-critical {
+ .#{$primary-stylename}-options,
+ .#{$primary-stylename}-selections {
+ @include valo-textfield-error-level-critical-style;
+ }
+ }
+
+ .#{$primary-stylename}-error-system {
+ .#{$primary-stylename}-options,
+ .#{$primary-stylename}-selections {
+ @include valo-textfield-error-level-system-style;
+ }
+ }
}
diff --git a/themes/src/main/themes/VAADIN/themes/valo/shared/_global.scss b/themes/src/main/themes/VAADIN/themes/valo/shared/_global.scss
index 55de987120..c36864e699 100644
--- a/themes/src/main/themes/VAADIN/themes/valo/shared/_global.scss
+++ b/themes/src/main/themes/VAADIN/themes/valo/shared/_global.scss
@@ -339,6 +339,26 @@ $valo-shared-pathPrefix: null;
@include valo-error-indicator-style;
}
+ .v-errorindicator-info {
+ @include valo-error-indicator-style($indicator-color: $v-error-indicator-level-info-color);
+ }
+
+ .v-errorindicator-warning {
+ @include valo-error-indicator-style($indicator-color: $v-error-indicator-level-warning-color);
+ }
+
+ .v-errorindicator-error {
+ @include valo-error-indicator-style($indicator-color: $v-error-indicator-level-error-color);
+ }
+
+ .v-errorindicator-critical {
+ @include valo-error-indicator-style($indicator-color: $v-error-indicator-level-critical-color);
+ }
+
+ .v-errorindicator-system {
+ @include valo-error-indicator-style($indicator-color: $v-error-indicator-level-system-color);
+ }
+
.v-required-field-indicator {
color: $v-required-field-indicator-color;
padding: 0 .2em;
@@ -400,8 +420,8 @@ $valo-shared-pathPrefix: null;
*
* @requires {mixin} valo-error-indicator-icon-style by default
*/
-@mixin valo-error-indicator-style ($is-pseudo-element: false) {
- color: $v-error-indicator-color;
+@mixin valo-error-indicator-style ($is-pseudo-element: false, $indicator-color: $v-error-indicator-color) {
+ color: $indicator-color;
font-weight: 600;
width: ceil($v-unit-size/2);
text-align: center;
diff --git a/themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss b/themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss
index 3c9c914499..b8ab053513 100644
--- a/themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss
+++ b/themes/src/main/themes/VAADIN/themes/valo/shared/_tooltip.scss
@@ -63,6 +63,46 @@ $v-tooltip-error-message-background-color: #fff !default;
$v-tooltip-error-message-font-color: $v-error-indicator-color !default;
/**
+ * The font color for error tooltips for level 'info'.
+ *
+ * @type color
+ * @group tooltip
+ */
+$v-tooltip-error-message-level-info-font-color: $v-error-indicator-level-info-color !default;
+
+/**
+ * The font color for error tooltips for level 'warning'.
+ *
+ * @type color
+ * @group tooltip
+ */
+$v-tooltip-error-message-level-warning-font-color: $v-error-indicator-level-warning-color !default;
+
+/**
+ * The font color for error tooltips for level 'error'.
+ *
+ * @type color
+ * @group tooltip
+ */
+$v-tooltip-error-message-level-error-font-color: $v-error-indicator-level-error-color !default;
+
+/**
+ * The font color for error tooltips for level 'critical'.
+ *
+ * @type color
+ * @group tooltip
+ */
+$v-tooltip-error-message-level-critical-font-color: $v-error-indicator-level-critical-color !default;
+
+/**
+ * The font color for error tooltips for level 'system'.
+ *
+ * @type color
+ * @group tooltip
+ */
+$v-tooltip-error-message-level-system-font-color: $v-error-indicator-level-system-color !default;
+
+/**
* The corner radius for tooltips.
*
* @type size
@@ -100,6 +140,26 @@ $v-tooltip-border-radius: $v-border-radius - 1px !default;
}
}
+ .v-errormessage-info {
+ color: $v-tooltip-error-message-level-info-font-color;
+ }
+
+ .v-errormessage-warning {
+ color: $v-tooltip-error-message-level-warning-font-color;
+ }
+
+ .v-errormessage-error {
+ color: $v-tooltip-error-message-level-error-font-color;
+ }
+
+ .v-errormessage-critical {
+ color: $v-tooltip-error-message-level-critical-font-color;
+ }
+
+ .v-errormessage-system {
+ color: $v-tooltip-error-message-level-system-font-color;
+ }
+
.v-tooltip-text {
max-height: 10em;
overflow: auto;
diff --git a/themes/src/main/themes/VAADIN/themes/valo/shared/_variables.scss b/themes/src/main/themes/VAADIN/themes/valo/shared/_variables.scss
index 4634a71fea..8f1aaa257b 100644
--- a/themes/src/main/themes/VAADIN/themes/valo/shared/_variables.scss
+++ b/themes/src/main/themes/VAADIN/themes/valo/shared/_variables.scss
@@ -207,13 +207,53 @@ $v-disabled-opacity: 0.5 !default;
$v-selection-color: $v-focus-color !default;
/**
+ * Color of the component error indication for 'info' error level.
+
+ * @group color
+ * @type color
+ */
+$v-error-indicator-level-info-color: #00a7f5 !default;
+
+/**
+ * Color of the component error indication for 'warning' error level.
+
+ * @group color
+ * @type color
+ */
+$v-error-indicator-level-warning-color: #fc9c00 !default;
+
+/**
+ * Color of the component error indication for 'error' error level.
+
+ * @group color
+ * @type color
+ */
+$v-error-indicator-level-error-color: #ed473b !default;
+
+/**
+ * Color of the component error indication for 'critical' error level.
+
+ * @group color
+ * @type color
+ */
+$v-error-indicator-level-critical-color: #fa007d !default;
+
+/**
+ * Color of the component error indication for 'system' error level.
+
+ * @group color
+ * @type color
+ */
+$v-error-indicator-level-system-color: #bb00ff !default;
+
+/**
* Color of the component error indicator and other error indications, such as the
* error style notification.
*
* @group color
* @type color
*/
-$v-error-indicator-color: #ed473b !default;
+$v-error-indicator-color: $v-error-indicator-level-error-color !default;
/**
* Color of the required indicator in field components.