* tag edit * more * chop chop * spec * Apply suggestions from code review Co-authored-by: Michael Kohl <me@citizen428.net> * french translation * Fix I18n usage * Apply suggestions from code review Co-authored-by: Suzanne Aitchison <suzanne@forem.com> * lang Co-authored-by: Michael Kohl <me@citizen428.net> Co-authored-by: Michael Kohl <citizen428@forem.com> Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
278 lines
5.5 KiB
SCSS
278 lines
5.5 KiB
SCSS
@import '../config/import';
|
|
|
|
%form-styling {
|
|
--border-width: 1px;
|
|
background-color: var(--form-bg);
|
|
border: var(--border-width) solid var(--form-border);
|
|
color: var(--body-color);
|
|
appearance: none;
|
|
-webkit-appearance: none;
|
|
border-radius: var(--radius);
|
|
transition: all var(--transition-props);
|
|
|
|
&-hover {
|
|
border-color: var(--form-border-hover);
|
|
}
|
|
|
|
&-focus {
|
|
background-color: var(--form-bg-focus);
|
|
border-color: var(--form-border-focus);
|
|
box-shadow: 0 0 0 1px var(--form-border-focus);
|
|
}
|
|
|
|
&-disabled {
|
|
opacity: 0.6;
|
|
}
|
|
|
|
&-checked {
|
|
background-color: var(--form-border-focus);
|
|
border-color: var(--form-border-focus);
|
|
color: var(--form-bg-focus);
|
|
background-position: center center;
|
|
background-repeat: no-repeat;
|
|
}
|
|
}
|
|
|
|
// Text inputs and textareas.
|
|
.crayons-textfield {
|
|
line-height: var(--lh-base);
|
|
padding: calc(0.5em - var(--border-width)) 0.5em;
|
|
font-family: inherit;
|
|
font-size: var(--fs-base);
|
|
width: 100%;
|
|
resize: vertical;
|
|
@extend %form-styling;
|
|
|
|
&::placeholder {
|
|
color: var(--form-placeholder-color);
|
|
}
|
|
|
|
&:hover {
|
|
@extend %form-styling-hover;
|
|
}
|
|
|
|
&:focus {
|
|
@extend %form-styling-focus;
|
|
}
|
|
|
|
&--disabled,
|
|
&[disabled] {
|
|
@extend %form-styling-disabled;
|
|
}
|
|
|
|
&::-ms-clear {
|
|
display: none;
|
|
}
|
|
|
|
&--icon {
|
|
padding-left: var(--su-7);
|
|
}
|
|
}
|
|
|
|
// Checkboxes, Radios
|
|
.crayons-checkbox,
|
|
.crayons-radio {
|
|
@extend %form-styling;
|
|
width: 1.125em;
|
|
height: 1.125em;
|
|
cursor: pointer;
|
|
background-position: center center;
|
|
vertical-align: middle;
|
|
flex-shrink: 0;
|
|
|
|
&:hover {
|
|
@extend %form-styling-hover;
|
|
}
|
|
|
|
&--disabled,
|
|
&[disabled] {
|
|
@extend %form-styling-disabled;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
&--checked,
|
|
&:checked {
|
|
@extend %form-styling-checked;
|
|
background-image: url("data:image/svg+xml,%3Csvg width='12' height='10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.157.933a.75.75 0 01.077 1.058L4.817 9.407a.75.75 0 01-1.134 0L.766 6.037a.75.75 0 011.135-.982L4.25 7.77l5.85-6.76a.75.75 0 011.057-.077z' fill='%23fff'/%3E%3C/svg%3E");
|
|
|
|
&--disabled,
|
|
&[disabled] {
|
|
@extend %form-styling-disabled;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Radios
|
|
.crayons-radio {
|
|
border-radius: 50%;
|
|
|
|
&--checked,
|
|
&:checked {
|
|
@extend %form-styling-checked;
|
|
background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='6' height='6' rx='3' fill='%23fff'/%3E%3C/svg%3E");
|
|
}
|
|
}
|
|
|
|
// Selects
|
|
.crayons-select {
|
|
line-height: var(--lh-base);
|
|
padding: calc(0.5em - var(--border-width)) 0.5em;
|
|
padding-right: var(--su-7);
|
|
font-family: inherit;
|
|
font-size: var(--fs-base);
|
|
width: 100%;
|
|
position: relative;
|
|
outline: none;
|
|
@extend %form-styling;
|
|
background-image: var(--select-icon);
|
|
background-position: calc(100% - var(--su-2)) calc(50% - 1px);
|
|
background-repeat: no-repeat;
|
|
|
|
&:hover {
|
|
@extend %form-styling-hover;
|
|
}
|
|
|
|
&:focus {
|
|
@extend %form-styling-focus;
|
|
}
|
|
|
|
&--disabled,
|
|
&[disabled] {
|
|
@extend %form-styling-disabled;
|
|
}
|
|
|
|
&::-ms-clear {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
///////////////////////////////////////////////////
|
|
|
|
// Full Fields markup
|
|
.crayons-field {
|
|
display: flex;
|
|
flex-flow: column;
|
|
font-size: var(--fs-base); // todo: do we need it?
|
|
|
|
$this: &;
|
|
|
|
&__label {
|
|
color: var(--label-primary);
|
|
font-weight: var(--fw-medium);
|
|
|
|
+ .crayons-field__description {
|
|
margin-top: 0;
|
|
}
|
|
}
|
|
|
|
&__required {
|
|
color: var(--accent-danger);
|
|
padding: 0 var(--su-1);
|
|
display: inline-block;
|
|
}
|
|
|
|
&__description {
|
|
color: var(--label-secondary);
|
|
font-size: var(--fs-s);
|
|
font-weight: var(--fw-normal); // for when it's inside --label
|
|
margin: 0; //todo remove
|
|
}
|
|
|
|
> * + * {
|
|
margin-top: var(--su-2);
|
|
}
|
|
|
|
&--checkbox,
|
|
&--radio {
|
|
display: grid;
|
|
grid-template-columns: 1.5em 1fr;
|
|
grid-gap: var(--su-2);
|
|
border-radius: var(--radius);
|
|
transition: all var(--transition-props);
|
|
|
|
&:hover {
|
|
background: var(--body-bg);
|
|
box-shadow: 0 0 0 var(--su-1) var(--body-bg);
|
|
}
|
|
|
|
#{$this}__label {
|
|
margin-top: 0;
|
|
padding-right: var(
|
|
--su-2
|
|
); // adding this to make hovers look slightly better.
|
|
}
|
|
}
|
|
|
|
.crayons-checkbox,
|
|
.crayons-radio {
|
|
margin: 0.1875em; // centering checkbox within 1.5em grid cell.
|
|
justify-self: center;
|
|
}
|
|
}
|
|
|
|
.crayons-fields {
|
|
display: flex;
|
|
flex-flow: column;
|
|
$this: &;
|
|
|
|
&:not(#{$this}--horizontal) {
|
|
> .crayons-field + .crayons-field {
|
|
margin-top: var(--su-4);
|
|
}
|
|
}
|
|
|
|
&--horizontal {
|
|
flex-flow: row;
|
|
flex-wrap: wrap;
|
|
|
|
> .crayons-field:not(:last-child) {
|
|
margin-right: var(--su-4);
|
|
}
|
|
}
|
|
}
|
|
|
|
///////////////////////////////////////////////////
|
|
.crayons-textfield {
|
|
&--ghost,
|
|
&--ghost:hover,
|
|
&--ghost:focus,
|
|
&--ghost[disabled] {
|
|
background: transparent;
|
|
border: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
outline: none;
|
|
width: 100%;
|
|
box-shadow: none;
|
|
resize: none;
|
|
transition: none;
|
|
}
|
|
}
|
|
|
|
textarea.crayons-textfield.crayons-textfield--ghost {
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
///////////////////////////////////////////////////
|
|
.crayons-color-selector {
|
|
--swatch-width: var(--su-6);
|
|
--swatch-height: var(--su-6);
|
|
@extend %form-styling;
|
|
padding: calc(0.5em - var(--border-width)) 0.5em;
|
|
height: 40px;
|
|
|
|
&::-webkit-color-swatch-wrapper {
|
|
padding: 0;
|
|
width: var(--swatch-width);
|
|
height: var(--swatch-height);
|
|
}
|
|
|
|
&::-webkit-color-swatch {
|
|
border: 0;
|
|
}
|
|
|
|
&--full {
|
|
width: 100%;
|
|
--swatch-width: 100%;
|
|
}
|
|
}
|