You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2023/03/28 15:17:20 UTC

[myfaces-tobago] 01/02: fix(theme): Use Bootstrap default for disabled form components

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit c64025cb9bff9902e43fc2dcd3d3c3d51b859014
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Nov 4 13:08:14 2022 +0100

    fix(theme): Use Bootstrap default for disabled form components
    
    * default Bootstrap looking for standard theme
    * scarborough theme:
      * outlined secondary buttons
      * greyed-out text for disabled form components
      * grey background for readonly form components
    
    Issue: TOBAGO-2206
---
 tobago-theme/src/main/scss/_tobago.scss            | 43 ----------------------
 .../src/main/scss/_custom.scss                     | 26 +++++++++++++
 .../src/main/scss/tobago-theme.scss                | 13 +++++++
 3 files changed, 39 insertions(+), 43 deletions(-)

diff --git a/tobago-theme/src/main/scss/_tobago.scss b/tobago-theme/src/main/scss/_tobago.scss
index b7a7bd28eb..c8102322b0 100644
--- a/tobago-theme/src/main/scss/_tobago.scss
+++ b/tobago-theme/src/main/scss/_tobago.scss
@@ -46,14 +46,10 @@ $icon-sort-numbers: (
 
 /* non-bootstrap variables --------------------------------------- */
 
-$tobago-form-disabled-alpha: 0.5;
 $tobago-page-padding-top: 1rem;
 $tobago-header-margin-bottom: $tobago-page-padding-top;
 $tobago-flex-layout-spacing: 0.5rem;
 
-/* bootstrap variables --------------------------------------- */
-$form-select-disabled-color: rgba($form-select-color, $tobago-form-disabled-alpha) !default;
-
 /* utilities ----------------------------------------------------- */
 .tobago-display-inline-block {
   display: inline-block;
@@ -109,12 +105,6 @@ $form-select-disabled-color: rgba($form-select-color, $tobago-form-disabled-alph
   }
 }
 
-@mixin formControlDisabled() {
-  &:disabled {
-    color: rgba($input-color, $tobago-form-disabled-alpha);
-  }
-}
-
 @mixin formControlFocusShadows() {
   //_form-control:focus from bootstrap
   @if $enable-shadows {
@@ -134,12 +124,6 @@ $form-select-disabled-color: rgba($form-select-color, $tobago-form-disabled-alph
   @include formControlFocusShadows();
 }
 
-@mixin formControlSelectListDisabled() {
-  &:disabled option, option:disabled {
-    color: rgba($input-color, $tobago-form-disabled-alpha);
-  }
-}
-
 @mixin inlinePadding() {
   padding-top: calc(#{$input-padding-y} + #{$input-border-width});
   padding-bottom: calc(#{$input-padding-y} + #{$input-border-width});
@@ -487,7 +471,6 @@ tobago-date {
   display: block;
 
   input {
-    @include formControlDisabled();
     min-width: 7em;
 
     &::-ms-clear {
@@ -716,12 +699,7 @@ tobago-image {
 tobago-in {
   display: block;
 
-  input[type='text'] {
-    @include formControlDisabled();
-  }
-
   .input-group {
-
     > tobago-dropdown {
       /* fix corner styling, because tobago-dropdown use a surrounding container inside an input group */
       &:not(:last-child) > .tobago-button {
@@ -1334,10 +1312,6 @@ tobago-select-boolean-toggle {
 
 tobago-select-one-choice {
   display: block;
-
-  select {
-    @include formControlDisabled();
-  }
 }
 
 tobago-select-one-list {
@@ -1346,10 +1320,6 @@ tobago-select-one-list {
 
 tobago-select-one-listbox {
   display: block;
-
-  select {
-    @include formControlSelectListDisabled();
-  }
 }
 
 /* selectOneRadio ---------------------------------------------------------- */
@@ -1396,10 +1366,6 @@ tobago-select-many-checkbox {
 
 tobago-select-many-listbox {
   display: block;
-
-  select {
-    @include formControlSelectListDisabled();
-  }
 }
 
 /* selectManyShuttle ----------------------------------------------------------- */
@@ -1416,11 +1382,6 @@ tobago-select-many-shuttle {
     }
 
     .tobago-unselected {
-      @include formControlSelectListDisabled();
-    }
-
-    .tobago-selected {
-      @include formControlSelectListDisabled();
     }
   }
 
@@ -1713,10 +1674,6 @@ tobago-tab-group {
 
 tobago-textarea {
   display: block;
-
-  textarea {
-    @include formControlDisabled();
-  }
 }
 
 /* tree ---------------------------------------------------------------------- */
diff --git a/tobago-theme/tobago-theme-scarborough/src/main/scss/_custom.scss b/tobago-theme/tobago-theme-scarborough/src/main/scss/_custom.scss
new file mode 100644
index 0000000000..47ac84fdb8
--- /dev/null
+++ b/tobago-theme/tobago-theme-scarborough/src/main/scss/_custom.scss
@@ -0,0 +1,26 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+@import "node_modules/bootstrap/scss/functions";
+@import "node_modules/bootstrap/scss/variables";
+
+$tobago-form-disabled-alpha: 0.5;
+
+$input-disabled-color: rgba($input-color, $tobago-form-disabled-alpha);
+$form-select-disabled-color: rgba($form-select-color, $tobago-form-disabled-alpha);
diff --git a/tobago-theme/tobago-theme-scarborough/src/main/scss/tobago-theme.scss b/tobago-theme/tobago-theme-scarborough/src/main/scss/tobago-theme.scss
index 86fe0c9b86..ae090a2091 100644
--- a/tobago-theme/tobago-theme-scarborough/src/main/scss/tobago-theme.scss
+++ b/tobago-theme/tobago-theme-scarborough/src/main/scss/tobago-theme.scss
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+@import "custom";
 @import "node_modules/bootstrap/scss/bootstrap";
 
 .btn-secondary {
@@ -22,3 +23,15 @@
 }
 
 @import "../../../../src/main/scss/_tobago";
+
+.form-control:read-only {
+  background-color: $input-disabled-bg;
+}
+
+.tobago-button.badge.btn {
+  --bs-btn-border-width: 1px;
+  --bs-badge-padding-y: 0;
+}
+.tobago-button.badge.btn-secondary {
+  --bs-badge-color: #000;
+}