Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/beacon/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
background: color(background);
border-radius: 50%;
transform: translate(-50%, 50%);
transition: 0.25s transform ease-out;
transition: transform 0.25s ease-out;
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
cursor: pointer;

Expand Down
2 changes: 1 addition & 1 deletion src/breadcrumbs/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
.breadcrumbs-link {
color: color(white);
opacity: 0.45;
transition: 0.25s opacity ease;
transition: opacity 0.25s ease;

&:hover {
opacity: 1;
Expand Down
37 changes: 37 additions & 0 deletions src/forms/Inputs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* @overview A module that sets up form input behaviors and visual states
* @module Inputs.js
*/

export const Inputs = {

/**
* Query DOM for form fields and setup their behaviors
* @returns {void}
*/
init() {
this.formFields = document.querySelectorAll(`.form-field`);
this.setupFloatLabels();
},

/**
* Add event listeners to all form fields to float input labels above the
* content when text is entered
* @returns {void}
*/
setupFloatLabels() {
[...this.formFields].forEach((el) => {
const input = el.querySelector(`.form-input`);
const checkForInput = () => {
if (input.value) {
el.classList.add(`has-text`);
} else {
el.classList.remove(`has-text`);
}
};

input.addEventListener(`keyup`, checkForInput);
checkForInput();
});
},
};
54 changes: 38 additions & 16 deletions src/forms/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ input {
line-height: 1;
}

::placeholder {
color: color(text);
}

// Get rid of number dropdown "spinners" for an overwhelming amount of browsers
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
Expand Down Expand Up @@ -120,12 +124,6 @@ input[type="number"] {
appearance: textfield;
}

input[type="radio"] {
-webkit-appearance: radio;
border-radius: 50%;
border: 1px solid gray;
}

select {
outline: 0;
box-shadow: 0;
Expand Down Expand Up @@ -209,6 +207,7 @@ select {
}

.form-field {
position: relative;
margin-bottom: 25px;
}

Expand All @@ -228,11 +227,22 @@ select {


.form-label {
@extend %headers;

@extend %h4;

display: block;
position: absolute;
top: ms(-4);
left: 1.1rem;
font-size: ms(-2);
line-height: 1;
color: color(text);
opacity: 0;
pointer-events: none;
transform: translateY(ms(-9));
transition: transform 0.25s ease-out, opacity 0.25s ease-out;

.has-text & {
transform: translateY(0);
opacity: 1;
pointer-events: auto;
}
}


Expand All @@ -250,18 +260,19 @@ select {

.form-input {
@extend %body--sans-small;

appearance: none;
width: 100%;
border: 1px solid color(border);
border: 1px solid color(dark-border);
margin: 0;
padding: size(smaller) size(small);
color: color(dark-text);
padding: 0.85rem ms(0) 0.85rem;
color: color(text);
border-radius: size(normal-corners);
background: color(background);
cursor: auto;
transition: padding 0.25s ease-out;

&:focus {
border-color: color(gray--light3);
border-color: color(primary);
}

// these are for jquery validation plugin
Expand All @@ -270,6 +281,17 @@ select {
&.error {
border-color: color(accent);
}

.has-text & {
padding: 1.2rem ms(0) 0.5rem;
}
}

.form-input--textarea {

#{$focus} {
outline: 0;
}
}

.form-input--select {
Expand Down
2 changes: 1 addition & 1 deletion src/layout/_mobile_sticky_cta.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
.icon-sms {
height: 17px;
width: 21px;
margin-right: sizing(smaller-tracking);
margin-right: size(smaller-tracking);
}

&.btn {
Expand Down
2 changes: 1 addition & 1 deletion src/typography/_paragraphs_config.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

%body--sans-small {
font-size: ms(0);
letter-spacing: size (smaller-tracking);
letter-spacing: size(smaller-tracking);
}


Expand Down