Skip to content

Commit

Permalink
Merge pull request #99 from werkbot/release/2.2.0
Browse files Browse the repository at this point in the history
Release/2.2.0
  • Loading branch information
aletail authored Nov 1, 2024
2 parents 1316d25 + 373ce4b commit 74f575c
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/en/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,6 @@ $component-form-text-with-button-properties: (
## Form Process Animation
When a form is submitted all fields are disabled including the submit button. An animated icon is added next to the submit button as well.
You must opt-in for this to take effect, the form element must contain the following class: `fw-form-process-event` as well as the `fw-form` class.

## Label placements
By default, labels are placed inside the input box. To change this, simply add the `fw-form-label-above` class alongside the `fw-form` class. This adjustment moves labels above the fields, eliminating any animation when a field gains or loses focus.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "werkbot-framewerk",
"version": "2.1.17",
"version": "2.2.0",
"description": "A framework of css and javascript that Werkbot uses as a foundation to build our websites.",
"main": "js/form.js",
"directories": {
Expand Down
3 changes: 2 additions & 1 deletion sass/components/form/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ $default-component-form-properties:(
validationSuccessTextColor: #000000,
validationSuccessBackgroundColor: #00cc00,
validationWarningTextColor: #000000,
validationWarningBackgroundColor: #ffcc00
validationWarningBackgroundColor: #ffcc00,
labelAboveMargin: 0,
);
// If $component-form-checkbox-properties is set, lets merge into our defaults
$component-form-properties: $default-component-form-properties !default;
Expand Down
9 changes: 9 additions & 0 deletions sass/components/form/components/_numeric.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,13 @@ $component-form-numeric-properties: $default-component-form-numeric-properties !
}
}
}

// Label above field
&.fw-form-label-above{
.field.numeric{
input, input[type='number']{
padding: 9px 50px;
}
}
}
}
19 changes: 19 additions & 0 deletions sass/components/form/components/_select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,25 @@ $component-form-select-properties: $default-component-form-select-properties !de
pointer-events: none;
}
}

// Label above field
&.fw-form-label-above{
.field.dropdown{
label{
position: relative;
transform: none;
margin: getThemeProperty(labelAboveMargin, $component-form-properties);
&.labelShrunk{
transform: none;
}
}
select{
&.labelShrunk{
padding: 20px;
}
}
}
}
}
@-moz-document url-prefix() {
.fw-form{
Expand Down
19 changes: 19 additions & 0 deletions sass/components/form/components/_text-with-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,25 @@ $component-form-text-with-button-properties: $default-component-form-text-with-b
border-radius: getThemeProperty(buttonBorderRadius, $component-form-text-with-button-properties);
}
}
}

// Label above field
&.fw-form-label-above{
.field.text-with-button{
label{
position: relative;
transform: none;
margin: getThemeProperty(labelAboveMargin, $component-form-properties);
&.labelShrunk{
transform: none;
}
}
input{
padding: 20px;
&.labelShrunk{
padding: 20px;
}
}
}
}
}
20 changes: 20 additions & 0 deletions sass/components/form/components/_text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,24 @@ $component-form-text-properties: $default-component-form-text-properties !defaul
}
}
}

// Label above field
&.fw-form-label-above{
.field.text{
label{
position: relative;
transform: none;
margin: getThemeProperty(labelAboveMargin, $component-form-properties);
&.labelShrunk{
transform: none;
}
}
input{
padding: 20px;
&.labelShrunk{
padding: 20px;
}
}
}
}
}
20 changes: 20 additions & 0 deletions sass/components/form/components/_textarea.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,24 @@ $component-form-textarea-properties: $default-component-form-textarea-properties
}
}
}

// Label above field
&.fw-form-label-above{
.field.textarea{
label{
position: relative;
transform: none;
margin: getThemeProperty(labelAboveMargin, $component-form-properties);
&.labelShrunk{
transform: none;
}
}
textarea{
padding: 20px;
&.labelShrunk{
padding: 20px;
}
}
}
}
}

0 comments on commit 74f575c

Please sign in to comment.