xref: /openbmc/phosphor-webui/app/common/styles/base/forms.scss (revision 4148f2eee6313068d3223871005160b2902abb18)
1*4148f2eeSYoshie Muranaka.label,
2c652ed18SDixsie Wolmerslabel,
3c652ed18SDixsie Wolmerslegend {
499d199f3SIftekharul Islam  margin: 0;
5fa56273dSYoshie Muranaka  color: $text-02;
6fa56273dSYoshie Muranaka  text-transform: uppercase;
7fa56273dSYoshie Muranaka  font-weight: 700;
8fa56273dSYoshie Muranaka  font-size: 0.75em;
9fa56273dSYoshie Muranaka  margin-bottom: 0;
10fa56273dSYoshie Muranaka  line-height: 2.2;
1199d199f3SIftekharul Islam  .error {
12c652ed18SDixsie Wolmers    font-size: 0.9em;
1399d199f3SIftekharul Islam  }
1499d199f3SIftekharul Islam}
1599d199f3SIftekharul Islam
16c652ed18SDixsie Wolmers// TODO: Start replacing use of label__helper-text
17c652ed18SDixsie Wolmers.label__helper-text,
18c652ed18SDixsie Wolmers.form__helper-text {
196f7ec80eSYoshie Muranaka  color: $text-02;
20e4194ce0SYoshie Muranaka  line-height: 1.2;
21e4194ce0SYoshie Muranaka  font-size: 0.9em;
22e4194ce0SYoshie Muranaka  margin-bottom: 0.4em;
23e4194ce0SYoshie Muranaka}
24e4194ce0SYoshie Muranaka
25c652ed18SDixsie Wolmersinput[type="email"],
26c652ed18SDixsie Wolmersinput[type="number"],
27c652ed18SDixsie Wolmersinput[type="password"],
28c652ed18SDixsie Wolmersinput[type="search"],
29c652ed18SDixsie Wolmersinput[type="tel"],
30c652ed18SDixsie Wolmersinput[type="url"],
31c652ed18SDixsie Wolmersinput[type="text"],
32c652ed18SDixsie Wolmersinput[type="date"],
33c652ed18SDixsie Wolmersinput[type="time"],
3499d199f3SIftekharul Islamtextarea {
3599d199f3SIftekharul Islam  border-radius: 0px;
366f7ec80eSYoshie Muranaka  border: 1px solid $border-color-02;
37a09cc2daSbeccabroek  margin: 0;
386f7ec80eSYoshie Muranaka  background: $primary-light;
3999d199f3SIftekharul Islam  box-shadow: 0 0 0;
4099d199f3SIftekharul Islam  transition: none !important;
415bd1dec7SYoshie Muranaka  max-height: 2.1em;
4299d199f3SIftekharul Islam  &:focus {
436f7ec80eSYoshie Muranaka    border-color: $border-color-01;
446f7ec80eSYoshie Muranaka    box-shadow: 0 -3px $primary-accent inset;
4599d199f3SIftekharul Islam  }
4651946552SMichael Davis  &:disabled,
4751946552SMichael Davis  .disabled {
486f7ec80eSYoshie Muranaka    background: $background-03;
496f7ec80eSYoshie Muranaka    border: 1px solid $border-color-02;
5099d199f3SIftekharul Islam  }
5199d199f3SIftekharul Islam  &.input__error {
526f7ec80eSYoshie Muranaka    box-shadow: 0 -5px $status-error inset;
536f7ec80eSYoshie Muranaka    color: $status-error;
5451946552SMichael Davis    &:focus {
556f7ec80eSYoshie Muranaka      box-shadow: 0 -5px $primary-accent inset;
5699d199f3SIftekharul Islam    }
5799d199f3SIftekharul Islam  }
5851946552SMichael Davis}
5951946552SMichael Davis
60a09cc2daSbeccabroek//input validation
61a09cc2daSbeccabroek.ng-invalid.ng-touched {
626f7ec80eSYoshie Muranaka  box-shadow: 0 -3px $status-error inset;
63a09cc2daSbeccabroek  &:focus {
646f7ec80eSYoshie Muranaka    border-color: $border-color-01;
656f7ec80eSYoshie Muranaka    box-shadow: 0 -3px $status-error inset;
66a09cc2daSbeccabroek  }
67a09cc2daSbeccabroek}
68a09cc2daSbeccabroek.submitted .ng-invalid {
696f7ec80eSYoshie Muranaka  box-shadow: 0 -3px $status-error inset;
70a09cc2daSbeccabroek  &:focus {
716f7ec80eSYoshie Muranaka    border-color: $border-color-01;
726f7ec80eSYoshie Muranaka    box-shadow: 0 -3px $status-error inset;
73a09cc2daSbeccabroek  }
74a09cc2daSbeccabroek}
75a09cc2daSbeccabroek
76a09cc2daSbeccabroek.form-error {
77c652ed18SDixsie Wolmers  margin-bottom: 0.7em;
78a09cc2daSbeccabroek  font-size: 0.8rem;
796f7ec80eSYoshie Muranaka  color: $status-error;
80a09cc2daSbeccabroek  height: 1rem;
81a09cc2daSbeccabroek  display: block;
82a09cc2daSbeccabroek  visibility: hidden;
83c652ed18SDixsie Wolmers  // TODO: Create state rulesets rather than relying on one off solutions
84a09cc2daSbeccabroek  .visible {
85a09cc2daSbeccabroek    visibility: visible;
86a09cc2daSbeccabroek  }
87a09cc2daSbeccabroek}
884ac71d42SMichael Davis//Foundation overwrite
89c652ed18SDixsie Wolmers[type="color"],
90c652ed18SDixsie Wolmers[type="date"],
91c652ed18SDixsie Wolmers[type="datetime-local"],
92c652ed18SDixsie Wolmers[type="datetime"],
93c652ed18SDixsie Wolmers[type="email"],
94c652ed18SDixsie Wolmers[type="month"],
95c652ed18SDixsie Wolmers[type="number"],
96c652ed18SDixsie Wolmers[type="password"],
97c652ed18SDixsie Wolmers[type="search"],
98c652ed18SDixsie Wolmers[type="tel"],
99c652ed18SDixsie Wolmers[type="text"],
100c652ed18SDixsie Wolmers[type="time"],
101c652ed18SDixsie Wolmers[type="url"],
102c652ed18SDixsie Wolmers[type="week"],
103c652ed18SDixsie Wolmerstextarea {
1046f7ec80eSYoshie Muranaka  border-color: $border-color-02;
1054ac71d42SMichael Davis}
1064ac71d42SMichael Davis
10751946552SMichael Davisinput[readonly],
10851946552SMichael Davisinput[readonly]:focus {
10951946552SMichael Davis  box-shadow: 0 0 0;
1106f7ec80eSYoshie Muranaka  background: $background-03;
1116f7ec80eSYoshie Muranaka  border: 1px solid $border-color-02;
11251946552SMichael Davis}
11399d199f3SIftekharul Islam
114c652ed18SDixsie Wolmerstextarea {
115c652ed18SDixsie Wolmers  padding: 0.2em;
116c652ed18SDixsie Wolmers  height: auto;
117c652ed18SDixsie Wolmers}
118c652ed18SDixsie Wolmers
119c652ed18SDixsie Wolmersinput[type="submit"],
120c652ed18SDixsie Wolmers.submit {
12199d199f3SIftekharul Islam  margin: 1em 0;
12299d199f3SIftekharul Islam  width: 100%;
12399d199f3SIftekharul Islam}
12499d199f3SIftekharul Islam
12599d199f3SIftekharul Islam// Custom select
12699d199f3SIftekharul Islamselect {
12799d199f3SIftekharul Islam  border-radius: 0px;
12899d199f3SIftekharul Islam  height: auto;
129de382089SYoshie Muranaka  padding-right: 0.5rem; //override inherited Foundation style
1306f7ec80eSYoshie Muranaka  border-color: $border-color-02;
13199d199f3SIftekharul Islam  @include fastTransition-all;
13299d199f3SIftekharul Islam  @include bgImage__arrowDown-primary;
13399d199f3SIftekharul Islam  &:focus {
13499d199f3SIftekharul Islam    box-shadow: 0 0 0;
13599d199f3SIftekharul Islam  }
136de382089SYoshie Muranaka  &[disabled] {
137de382089SYoshie Muranaka    @include bgImage__arrowDown-disabled;
138de382089SYoshie Muranaka  }
13999d199f3SIftekharul Islam}
1405bd1dec7SYoshie Muranaka
1415bd1dec7SYoshie Muranaka#login__form {
1425bd1dec7SYoshie Muranaka  input {
1435bd1dec7SYoshie Muranaka    height: 3em;
1445bd1dec7SYoshie Muranaka    max-height: none;
1455bd1dec7SYoshie Muranaka  }
1465bd1dec7SYoshie Muranaka}
147e4194ce0SYoshie Muranaka.form__validation-message {
1486f7ec80eSYoshie Muranaka  color: $status-error;
149fa56273dSYoshie Muranaka  font-size: 0.8em;
150fa56273dSYoshie Muranaka  line-height: 1.1;
151fa56273dSYoshie Muranaka  padding-top: 2px;
152fa56273dSYoshie Muranaka}
153fa56273dSYoshie Muranaka
154fa56273dSYoshie Muranaka.radio-label {
155fa56273dSYoshie Muranaka  text-transform: none;
156fa56273dSYoshie Muranaka  font-weight: normal;
157e4194ce0SYoshie Muranaka  font-size: 0.9em;
158fa56273dSYoshie Muranaka  line-height: 1.2;
159fa56273dSYoshie Muranaka  margin: 0.8em 0;
160fa56273dSYoshie Muranaka  color: $text-01;
161fa56273dSYoshie Muranaka  input[type=radio] {
162fa56273dSYoshie Muranaka    margin-bottom: 0;
163fa56273dSYoshie Muranaka  }
164e4194ce0SYoshie Muranaka}
165c652ed18SDixsie Wolmers
166c652ed18SDixsie Wolmers/**
167c652ed18SDixsie Wolmers * Used for basic vertically stacked forms
168c652ed18SDixsie Wolmers * that do not need a grid for layout
169c652ed18SDixsie Wolmers * Should only wrap form elements and label
170c652ed18SDixsie Wolmers * Helper text shoul not be wrapped in the
171c652ed18SDixsie Wolmers * form-field container
172c652ed18SDixsie Wolmers * EX: Manage Power Usage
173c652ed18SDixsie Wolmers * Markup
174c652ed18SDixsie Wolmers    <div class="section-content">
175c652ed18SDixsie Wolmers      <p class="form__helper-text">Some helper text</p>
176c652ed18SDixsie Wolmers      <div class=" form__field">
177c652ed18SDixsie Wolmers        <label for="power-cap" class="content-label">POWER CAP VALUE IN WATTS</label>
178c652ed18SDixsie Wolmers        <input id="power-cap type="number" />
179c652ed18SDixsie Wolmers      </div>
180c652ed18SDixsie Wolmers    </div>
181c652ed18SDixsie Wolmers  */
182c652ed18SDixsie Wolmers
183c652ed18SDixsie Wolmers.form__field {
184c652ed18SDixsie Wolmers  min-width: 150px;
185c652ed18SDixsie Wolmers  max-width: 240px;
186c652ed18SDixsie Wolmers}
187c652ed18SDixsie Wolmers
188c652ed18SDixsie Wolmers.form__field--large {
189c652ed18SDixsie Wolmers  max-width: 330px;
190c652ed18SDixsie Wolmers}
191c652ed18SDixsie Wolmers
192c652ed18SDixsie Wolmers// TODO Replace form-actions with form__actions. see below
193c652ed18SDixsie Wolmers.form-actions {
194c652ed18SDixsie Wolmers  width: 100%;
195c652ed18SDixsie Wolmers  margin-top: 3rem;
196c652ed18SDixsie Wolmers  padding-top: 1rem;
197c652ed18SDixsie Wolmers  border-top: 1px solid $border-color-01;
198c652ed18SDixsie Wolmers
199c652ed18SDixsie Wolmers  button {
200c652ed18SDixsie Wolmers    display: block;
201c652ed18SDixsie Wolmers    float: right;
202c652ed18SDixsie Wolmers    margin: 0.5em 0 0 1em;
203c652ed18SDixsie Wolmers  }
204c652ed18SDixsie Wolmers}
205c652ed18SDixsie Wolmers
206c652ed18SDixsie Wolmers/**
207c652ed18SDixsie Wolmers * Use to wrap the cancel and submit buttons on
208c652ed18SDixsie Wolmers * a form to create the top border and white space
209c652ed18SDixsie Wolmers * Markup
210c652ed18SDixsie Wolmers  <div class="form-actions">
211c652ed18SDixsie Wolmers    <button type="submit" class="btn-primary" ng-click="setPowerCap()">
212c652ed18SDixsie Wolmers      Save settings
213c652ed18SDixsie Wolmers    </button>
214c652ed18SDixsie Wolmers    <button type="button" class="btn btn-secondary" ng-click="refresh()">
215c652ed18SDixsie Wolmers      Cancel
216c652ed18SDixsie Wolmers    </button>
217c652ed18SDixsie Wolmers  </div>
218c652ed18SDixsie Wolmers */
219c652ed18SDixsie Wolmers
220c652ed18SDixsie Wolmers.form__actions {
221c652ed18SDixsie Wolmers  margin-top: 3rem;
222c652ed18SDixsie Wolmers  padding-top: 1rem;
223c652ed18SDixsie Wolmers  border-top: 1px solid $border-color-01;
224c652ed18SDixsie Wolmers  display: flex;
225c652ed18SDixsie Wolmers  justify-content: flex-end;
226c652ed18SDixsie Wolmers
227c652ed18SDixsie Wolmers  button:first-of-type {
228c652ed18SDixsie Wolmers    order: 1;
229c652ed18SDixsie Wolmers    margin-left: 1rem;
230c652ed18SDixsie Wolmers  }
231c652ed18SDixsie Wolmers}
232fa56273dSYoshie Muranaka
233fa56273dSYoshie Muranaka.radio-option__input-field-group {
234fa56273dSYoshie Muranaka  margin-left: 1.5em;
235fa56273dSYoshie Muranaka}
236fa56273dSYoshie Muranaka
237fa56273dSYoshie Muranaka.field-group-container {
238fa56273dSYoshie Muranaka  margin-bottom: 30px;
239fa56273dSYoshie Muranaka  position: relative;
240fa56273dSYoshie Muranaka  &:last-child {
241fa56273dSYoshie Muranaka    margin-bottom: 12px;
242fa56273dSYoshie Muranaka  }
243fa56273dSYoshie Muranaka
244fa56273dSYoshie Muranaka  input + .form__validation-message {
245fa56273dSYoshie Muranaka    position: absolute;
246fa56273dSYoshie Muranaka  }
247fa56273dSYoshie Muranaka}
248