@atlassian/aui
Version:
Atlassian User Interface library
298 lines (258 loc) • 8.16 kB
text/less
@import './imports/global';
@import './imports/mixins';
@import (reference) './imports/aui-theme/components/forms';
body:not(.aui-legacy-focus) {
form.aui:not(.aui-legacy-forms) {
.text,
.password,
.textarea,
.select,
.multi-select {
&:focus {
#aui-forms.aui-input-field-style(focus);
}
&:focus > option {
#aui-forms.aui-input-field-style(focus);
}
}
.text,
.password,
.textarea,
.select,
.multi-select,
.aui-select2-container .select2-choices {
// Forms get a custom "border-as-focus" style, because:
// a) the form field doesn't "grow" in size,
// b) the "focus ring" is impossible to clip when it's a border, and
// c) it's more in line with how Atlaskit does it.
&:focus {
#aui.with-focus-border(@aui-focus-ring-color, @aui-form-field-border-width);
}
}
.aui-select2-container.select2-container-active .select2-choices {
#aui.with-focus-border();
}
.button {
#aui.focus-ring();
}
.cancel {
#aui.focus-ring();
}
}
}
/* Field styles */
form.aui:not(.aui-legacy-forms) {
.text,
.password,
.textarea,
.select {
#aui-forms.aui-input-field-style(normal);
font-size: @aui-font-size-medium;
font-family: inherit;
&:hover {
#aui-forms.aui-input-field-style(hover);
}
}
.multi-select {
#aui-forms.aui-select2-input-field-style(normal);
font-size: @aui-font-size-medium;
font-family: inherit;
&:hover {
#aui-forms.aui-select2-input-field-style(hover);
}
}
.select,
.multi-select {
&:hover {
background-color: @aui-form-select-hover-bg-color;
border-color: @aui-form-select-hover-bg-color;
}
}
.aui-select2-container {
& > ul:hover {
#aui-forms.aui-select2-input-field-style(hover);
}
&.select2-container-active > ul {
#aui-forms.aui-input-field-style(focus);
}
}
.multi-select {
&:hover > option {
#aui-forms.aui-select2-input-field-style(hover);
}
}
.text,
.password,
.textarea,
.select {
#aui.transition(background-color @aui-form-transition-time ease-in-out);
#aui.transition(border-color @aui-form-transition-time ease-in-out);
border: @aui-form-field-border-width solid @aui-form-field-border-color;
border-radius: @aui-form-field-border-radius;
box-sizing: border-box;
font-size: inherit;
margin: 0;
vertical-align: baseline;
}
.multi-select,
.aui-select2-container .select2-choices {
#aui.transition(background-color @aui-form-transition-time ease-in-out);
#aui.transition(border-color @aui-form-transition-time ease-in-out);
border: @aui-form-field-border-width solid @aui-select2-field-border-color;
border-radius: @aui-form-field-border-radius;
box-sizing: border-box;
font-size: inherit;
margin: 0;
vertical-align: baseline;
}
.multi-select {
background-color: @aui-form-select-bg-color;
border-color: @aui-form-select-border-color;
}
.text,
.password,
.select,
.aui-select2-container .select2-choices {
height: @aui-form-field-height;
line-height: 1.4285714285714;
padding: 3px 4px;
}
.textarea,
.select[size],
.multi-select {
height: auto;
line-height: 1.4285714285714;
margin: 0;
padding: 3px 4px;
}
.textarea {
overflow-y: auto;
}
.multi-select {
margin-top: 2px;
}
.group .field-group,
.date-select .field-group {
clear: none;
padding-left: 0;
padding-top: 0;
}
/* Placeholder form element styles */
.text, .password, .textarea {
#aui.placeholder(@aui-form-placeholder-text-color);
&[disabled] {
#aui.placeholder(@aui-form-placeholder-disabled-text-color);
}
}
/* Disabled form element styles */
.text[disabled],
.password[disabled],
.textarea[disabled],
.select[disabled],
.multi-select[disabled],
.select[disabled] option,
.select[disabled] optgroup,
.multi-select[disabled] option,
.multi-select[disabled] optgroup {
background-color: @aui-form-disabled-field-bg-color;
color: @aui-form-disabled-field-text-color;
border: none;
}
.text[disabled],
.password[disabled],
.textarea[disabled],
.select[disabled],
.multi-select[disabled] {
border: 2px solid transparent;
}
.select {
margin-top: 1px;
vertical-align: top;
background-color: @aui-form-select-bg-color;
border-color: @aui-form-select-border-color;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
&::-ms-expand {
display: none;
}
}
/* Ensure AUI Select2's do not show as regular text fields */
.aui-select2-container {
border: 0;
height: auto;
padding: 0;
vertical-align: baseline;
width: 100%;
}
.aui-select2-container .select2-choices {
height: auto;
max-width: none;
}
.field-group,
.group,
.date-select {
box-sizing: border-box;
clear: both;
padding: 4px 0 4px 145px;
position: relative;
margin: 1px 0;
width: 100%;
}
.group {
padding-top: 0;
}
.select[disabled]:not([size]) {
#aui-forms.aui-select-icon(~"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgc3Ryb2tlLXdpZHRoPSIxIiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZvY3VzYWJsZT0iZmFsc2UiPjxwYXRoIGQ9Ik02Ljc0NCA4Ljc0NGExLjA1MyAxLjA1MyAwIDAgMCAwIDEuNDlsNC41NDcgNC41NTdhMSAxIDAgMCAwIDEuNDE2IDBsNC41NS00LjU1OGExLjA1MSAxLjA1MSAwIDEgMC0xLjQ4OC0xLjQ4OGwtMy43NyAzLjc3Ni0zLjc2OC0zLjc3NmExLjA1MSAxLjA1MSAwIDAgMC0xLjQ4NyAweiIgZmlsbD0iI0E1QURCQSI+PC9wYXRoPjwvc3ZnPgo=')");
}
select:not([size]) {
padding-right: 22px;
#aui-forms.aui-select-icon(~"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgc3Ryb2tlLXdpZHRoPSIxIiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZvY3VzYWJsZT0iZmFsc2UiIGZpbGw9IiM0MjUyNkUiPjxwYXRoIGQ9Ik02Ljc0NCA4Ljc0NGExLjA1MyAxLjA1MyAwIDAgMCAwIDEuNDlsNC41NDcgNC41NTdhMSAxIDAgMCAwIDEuNDE2IDBsNC41NS00LjU1OGExLjA1MSAxLjA1MSAwIDEgMC0xLjQ4OC0xLjQ4OGwtMy43NyAzLjc3Ni0zLjc2OC0zLjc3NmExLjA1MSAxLjA1MSAwIDAgMC0xLjQ4NyAweiIgZmlsbD0iIzM0NDU2MyI+PC9wYXRoPjwvc3ZnPgo=')");
}
.icon-required {
left: 100%;
position: absolute;
top: 7px;
&::before {
content: "*";
position: absolute;
left: 0;
top: 0;
text-indent: initial;
color: @aui-form-error-text-color;
line-height: 1;
font-size: @aui-font-size-small;
}
}
legend,
label {
color: @aui-form-label-text-color;
font-weight: @aui-font-weight-medium;
font-size: @aui-font-size-medium;
}
legend + .field-group {
margin-top: 0;
padding-top: 5px;
}
div.description {
font-size: @aui-font-size-xsmall;
line-height: unit(20 / @aui-font-size-xsmall);
color: @aui-form-description-text-color;
margin: 5px 0 0 0;
&:first-child {
margin-top: 0;
}
}
legend,
.field-group > label,
.field-group > aui-label {
float: left;
margin-left: -145px;
padding: 5px 0 0 0;
position: relative;
text-align: right;
width: 130px;
word-wrap: break-word;
}
}
@import 'forms-radios-and-checkboxes';