Skip to content

Commit

Permalink
feat(input): make invalid pseudo class optional
Browse files Browse the repository at this point in the history
This PR makes automatic browser invalidation via :invalid pseudo class optional via new variables

@variationInputInvalid
@variationFormInvalid
  • Loading branch information
lubber-de authored Nov 2, 2022
1 parent 14a4f8c commit 69527dc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/definitions/collections/form.less
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
border-radius: @formStates[@@state][borderRadius];
box-shadow: @formStates[@@state][boxShadow];
}
& when (@state=error) {
& when (@state=error) and (@variationFormInvalid) {
.ui.form .field input:not(:placeholder-shown):invalid {
color: @c;
background: @bg;
Expand Down
15 changes: 8 additions & 7 deletions src/definitions/elements/input.less
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
color: @formStates[@@state][color];
box-shadow: @formStates[@@state][boxShadow];
}
& when (@state=error) {
& when (@state=error) and (@variationInputInvalid) {
.ui.input > input:not(:placeholder-shown):invalid {
background-color: @formStates[@@state][background];
border-color: @formStates[@@state][borderColor];
Expand Down Expand Up @@ -718,12 +718,13 @@
color: @fileButtonTextColor;
}
}

.ui.form .field input[type="file"]:required:invalid,
.ui.file.input input[type="file"]:required:invalid {
color: @negativeTextColor;
background: @negativeBackgroundColor ;
border-color: @negativeBorderColor;
& when (@variationInputInvalid) {
.ui.form .field input[type="file"]:required:invalid,
.ui.file.input input[type="file"]:required:invalid {
color: @negativeTextColor;
background: @negativeBackgroundColor;
border-color: @negativeBorderColor;
}
}

input[type="file"].ui.invisible.file.input,
Expand Down
2 changes: 2 additions & 0 deletions src/themes/default/globals/variation.variables
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
@variationInputDisabled: true;
@variationInputInverted: true;
@variationInputStates: @variationAllStates;
@variationInputInvalid: true;
@variationInputTransparent: true;
@variationInputCorner: true;
@variationInputLoading: true;
Expand Down Expand Up @@ -272,6 +273,7 @@
@variationFormTransparent: true;
@variationFormLoading: true;
@variationFormStates: @variationAllStates;
@variationFormInvalid: true;
@variationFormRequired: true;
@variationFormInline: true;
@variationFormGrouped: true;
Expand Down

0 comments on commit 69527dc

Please sign in to comment.