You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

610 lines
13 KiB

  1. /*
  2. * # Semantic - Form
  3. * http://github.com/semantic-org/semantic-ui/
  4. *
  5. *
  6. * Copyright 2013 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. /*******************************
  12. Theme
  13. *******************************/
  14. @type : 'collection';
  15. @element : 'form';
  16. @import '../../semantic.config';
  17. /*******************************
  18. Standard
  19. *******************************/
  20. /*--------------------
  21. Form
  22. ---------------------*/
  23. .ui.form {
  24. position: relative;
  25. max-width: 100%;
  26. }
  27. /*--------------------
  28. Content
  29. ---------------------*/
  30. .ui.form > p {
  31. margin: @paragraphMargin;
  32. }
  33. /*--------------------
  34. Field
  35. ---------------------*/
  36. .ui.form .field {
  37. clear: both;
  38. margin: @fieldMargin;
  39. }
  40. /*--------------------
  41. Labels
  42. ---------------------*/
  43. .ui.form .field > label {
  44. margin: 0em 0em @labelMargin 0em;
  45. display: block;
  46. color: @labelColor;
  47. font-size: @labelFontSize;
  48. font-weight: @labelFontWeight;
  49. }
  50. /*--------------------
  51. Standard Inputs
  52. ---------------------*/
  53. .ui.form textarea,
  54. .ui.form input[type="text"],
  55. .ui.form input[type="email"],
  56. .ui.form input[type="date"],
  57. .ui.form input[type="password"],
  58. .ui.form input[type="number"],
  59. .ui.form input[type="url"],
  60. .ui.form input[type="tel"],
  61. .ui.form .ui.input {
  62. width: 100%;
  63. }
  64. .ui.form textarea,
  65. .ui.form input[type="text"],
  66. .ui.form input[type="email"],
  67. .ui.form input[type="date"],
  68. .ui.form input[type="password"],
  69. .ui.form input[type="number"],
  70. .ui.form input[type="url"],
  71. .ui.form input[type="tel"] {
  72. margin: 0em;
  73. padding: @inputVerticalPadding @inputHorizontalPadding;
  74. font-size: @inputFontSize;
  75. background: @inputBackground;
  76. border: @inputBorder;
  77. outline: none;
  78. color: @inputColor;
  79. border-radius: 0.3125em;
  80. box-shadow: @inputBoxShadow;
  81. -webkit-appearance: none;
  82. -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
  83. box-sizing: border-box;
  84. transition: @inputTransition;
  85. }
  86. .ui.textarea,
  87. .ui.form textarea {
  88. font-size: @textAreaFontSize;
  89. height: @textAreaHeight;
  90. min-height: @textAreaMinHeight;
  91. max-height: @textAreaMaxHeight;
  92. line-height: @textAreaLineHeight;
  93. resize: @textAreaResize;
  94. }
  95. .ui.form textarea,
  96. .ui.form input[type="checkbox"] {
  97. vertical-align: @checkboxVerticalAlign;
  98. }
  99. /*--------------------------
  100. Input w/ attached Button
  101. ---------------------------*/
  102. .ui.form input.attached {
  103. width: auto;
  104. }
  105. /*--------------------
  106. Dropdown
  107. ---------------------*/
  108. .ui.form .field > .selection.dropdown {
  109. width: 100%;
  110. }
  111. .ui.form .field > .selection.dropdown > .dropdown.icon {
  112. float: right;
  113. }
  114. .ui.form .inline.field > .selection.dropdown {
  115. width: auto;
  116. }
  117. .ui.form .inline.field > .selection.dropdown > .dropdown.icon {
  118. float: none;
  119. }
  120. /*--------------------
  121. Dividers
  122. ---------------------*/
  123. .ui.form .divider {
  124. clear: both;
  125. margin: @dividerMargin;
  126. }
  127. /*--------------------
  128. Types of Messages
  129. ---------------------*/
  130. .ui.form .info.message,
  131. .ui.form .warning.message,
  132. .ui.form .error.message {
  133. display: none;
  134. }
  135. /* Assumptions */
  136. .ui.form .message:first-child {
  137. margin-top: 0px;
  138. }
  139. /*--------------------
  140. Validation Prompt
  141. ---------------------*/
  142. .ui.form .field .prompt.label {
  143. white-space: nowrap;
  144. }
  145. .ui.form .inline.field .prompt {
  146. margin: @validationMargin;
  147. }
  148. .ui.form .inline.field .prompt:before {
  149. margin-top: @validationArrowOffset;
  150. bottom: auto;
  151. right: auto;
  152. top: 50%;
  153. left: 0em;
  154. }
  155. /*******************************
  156. States
  157. *******************************/
  158. /*--------------------
  159. Placeholder
  160. ---------------------*/
  161. /* browsers require these rules separate */
  162. .ui.form ::-webkit-input-placeholder {
  163. color: @inputPlaceholderColor;
  164. }
  165. .ui.form ::-moz-placeholder {
  166. color: @inputPlaceholderColor;
  167. }
  168. .ui.form :focus::-webkit-input-placeholder {
  169. color: @inputPlaceholderFocusColor;
  170. }
  171. .ui.form :focus::-moz-placeholder {
  172. color: @inputPlaceholderFocusColor;
  173. }
  174. /* Error Placeholder */
  175. .ui.form .error ::-webkit-input-placeholder {
  176. color: @inputErrorPlaceholderColor;
  177. }
  178. .ui.form .error ::-moz-placeholder {
  179. color: @inputErrorPlaceholderColor;
  180. }
  181. .ui.form .error :focus::-webkit-input-placeholder {
  182. color: @inputErrorPlaceholderFocusColor;
  183. }
  184. .ui.form .error :focus::-moz-placeholder {
  185. color: @inputErrorPlaceholderFocusColor;
  186. }
  187. /*--------------------
  188. Focus
  189. ---------------------*/
  190. .ui.form input[type="text"]:focus,
  191. .ui.form input[type="email"]:focus,
  192. .ui.form input[type="date"]:focus,
  193. .ui.form input[type="password"]:focus,
  194. .ui.form input[type="number"]:focus,
  195. .ui.form input[type="url"]:focus,
  196. .ui.form input[type="tel"]:focus,
  197. .ui.form textarea:focus{
  198. color: @inputFocusColor;
  199. border-color: @inputFocusBorderColor;
  200. border-radius: @inputFocusBorderRadius;
  201. background: @inputFocusBackground;
  202. box-shadow: @inputFocusBoxShadow;
  203. -webkit-appearance: none;
  204. }
  205. /*--------------------
  206. Error
  207. ---------------------*/
  208. /* On Form */
  209. .ui.form.warning .warning.message {
  210. display: block;
  211. }
  212. /*--------------------
  213. Warning
  214. ---------------------*/
  215. /* On Form */
  216. .ui.form.error .error.message {
  217. display: block;
  218. }
  219. /* On Field(s) */
  220. .ui.form .fields.error .field label,
  221. .ui.form .field.error label,
  222. .ui.form .fields.error .field .input,
  223. .ui.form .field.error .input {
  224. color: @formErrorColor;
  225. }
  226. .ui.form .fields.error .field .corner.label,
  227. .ui.form .field.error .corner.label {
  228. border-color: @formErrorColor;
  229. color: @white;
  230. }
  231. .ui.form .fields.error .field textarea,
  232. .ui.form .fields.error .field input[type="text"],
  233. .ui.form .fields.error .field input[type="email"],
  234. .ui.form .fields.error .field input[type="date"],
  235. .ui.form .fields.error .field input[type="password"],
  236. .ui.form .fields.error .field input[type="number"],
  237. .ui.form .fields.error .field input[type="url"],
  238. .ui.form .fields.error .field input[type="tel"],
  239. .ui.form .field.error textarea,
  240. .ui.form .field.error input[type="text"],
  241. .ui.form .field.error input[type="email"],
  242. .ui.form .field.error input[type="date"],
  243. .ui.form .field.error input[type="password"],
  244. .ui.form .field.error input[type="number"],
  245. .ui.form .field.error input[type="url"],
  246. .ui.form .field.error input[type="tel"] {
  247. background: @formErrorBackground;
  248. border-color: @formErrorBorder;
  249. color: @formErrorColor;
  250. border-radius: @inputErrorBorderRadius;
  251. box-shadow: @inputErrorBoxShadow;
  252. }
  253. .ui.form .field.error textarea:focus,
  254. .ui.form .field.error input[type="text"]:focus,
  255. .ui.form .field.error input[type="email"]:focus,
  256. .ui.form .field.error input[type="date"]:focus,
  257. .ui.form .field.error input[type="password"]:focus,
  258. .ui.form .field.error input[type="number"]:focus,
  259. .ui.form .field.error input[type="url"]:focus,
  260. .ui.form .field.error input[type="tel"]:focus{
  261. border-color: @formErrorFocusBorder;
  262. color: @formErrorFocusColor;
  263. -webkit-appearance: none;
  264. box-shadow: @inputErrorFocusBoxShadow;
  265. }
  266. /*------------------
  267. Dropdown Error
  268. --------------------*/
  269. .ui.form .fields.error .field .ui.dropdown,
  270. .ui.form .fields.error .field .ui.dropdown .item,
  271. .ui.form .field.error .ui.dropdown,
  272. .ui.form .field.error .ui.dropdown .text,
  273. .ui.form .field.error .ui.dropdown .item {
  274. background: @formErrorBackground;
  275. color: @formErrorColor;
  276. }
  277. .ui.form .fields.error .field .ui.dropdown,
  278. .ui.form .field.error .ui.dropdown {
  279. box-shadow: 0px 0px 0px 1px @formErrorBorder !important;
  280. }
  281. .ui.form .fields.error .field .ui.dropdown:hover,
  282. .ui.form .field.error .ui.dropdown:hover {
  283. box-shadow: 0px 0px 0px 1px @formErrorBorder !important;
  284. }
  285. .ui.form .fields.error .field .ui.dropdown:hover .menu,
  286. .ui.form .field.error .ui.dropdown:hover .menu {
  287. box-shadow: 0px 1px 0px 1px @formErrorBorder;
  288. }
  289. /* Hover */
  290. .ui.form .fields.error .field .ui.dropdown .menu .item:hover,
  291. .ui.form .field.error .ui.dropdown .menu .item:hover {
  292. background-color: @dropdownErrorHoverBackground;
  293. }
  294. /* Active */
  295. .ui.form .fields.error .field .ui.dropdown .menu .active.item,
  296. .ui.form .field.error .ui.dropdown .menu .active.item {
  297. background-color: @dropdownErrorActiveBackground !important;
  298. }
  299. /*--------------------
  300. Checkbox Error
  301. ---------------------*/
  302. .ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) label,
  303. .ui.form .field.error .checkbox:not(.toggle):not(.slider) label,
  304. .ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) .box,
  305. .ui.form .field.error .checkbox:not(.toggle):not(.slider) .box {
  306. color: @formErrorColor;
  307. }
  308. .ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) label:before,
  309. .ui.form .field.error .checkbox:not(.toggle):not(.slider) label:before,
  310. .ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) .box:before,
  311. .ui.form .field.error .checkbox:not(.toggle):not(.slider) .box:before {
  312. background: @formErrorBackground;
  313. border-color: @formErrorBorder;
  314. }
  315. .ui.form .fields.error .field .checkbox label:after,
  316. .ui.form .field.error .checkbox label:after,
  317. .ui.form .fields.error .field .checkbox .box:after,
  318. .ui.form .field.error .checkbox .box:after {
  319. color: @formErrorColor;
  320. }
  321. /*--------------------
  322. Disabled
  323. ---------------------*/
  324. .ui.form .field :disabled,
  325. .ui.form .field.disabled {
  326. opacity: 0.5;
  327. }
  328. .ui.form .field.disabled label {
  329. opacity: 0.5;
  330. }
  331. .ui.form .field.disabled :disabled {
  332. opacity: 1;
  333. }
  334. /*--------------------
  335. Loading State
  336. ---------------------*/
  337. /* On Form */
  338. .ui.form.loading {
  339. position: relative;
  340. }
  341. .ui.form.loading:after {
  342. position: absolute;
  343. top: 0%;
  344. left: 0%;
  345. content: '';
  346. width: 100%;
  347. height: 100%;
  348. background: @formLoaderDimmerColor url(@formLoaderPath) no-repeat @formLoaderPosition;
  349. visibility: visible;
  350. }
  351. /*******************************
  352. Element Types
  353. *******************************/
  354. /*--------------------
  355. Required Field
  356. ---------------------*/
  357. .ui.form .required.fields > .field > label:after,
  358. .ui.form .required.fields > .field > .checkbox:after,
  359. .ui.form .required.field > label:after,
  360. .ui.form .required.field > .checkbox:after {
  361. margin: -0.2em 0em 0em 0.2em;
  362. vertical-align: top;
  363. content: '*';
  364. color: @requiredColor;
  365. }
  366. /*--------------------
  367. Date Input
  368. ---------------------*/
  369. .ui.form .date.field > label {
  370. position: relative;
  371. }
  372. .ui.form .date.field > label:after {
  373. position: absolute;
  374. top: 2em;
  375. right: 0.5em;
  376. font-family: 'Icons';
  377. content: '\f133';
  378. font-size: 1.2em;
  379. font-weight: normal;
  380. color: #CCCCCC;
  381. }
  382. /*******************************
  383. Variations
  384. *******************************/
  385. /*--------------------
  386. Inverted Colors
  387. ---------------------*/
  388. .ui.inverted.form label,
  389. .ui.inverted.form .ui.checkbox label:hover,
  390. .ui.inverted.form .ui.checkbox .box:hover {
  391. color: @invertedFormColor;
  392. }
  393. .ui.inverted.form.loading:after {
  394. background: @formInvertedLoaderDimmerColor url(@formInvertedLoaderPath) no-repeat @formLoaderPosition;
  395. }
  396. /*--------------------
  397. Field Groups
  398. ---------------------*/
  399. /* Grouped Vertically */
  400. .ui.form .grouped.fields {
  401. margin: 0em 0em 1em;
  402. }
  403. .ui.form .grouped.fields .field {
  404. display: block;
  405. float: none;
  406. margin: 0.5em 0em;
  407. padding: 0em;
  408. }
  409. /*--------------------
  410. Fields
  411. ---------------------*/
  412. /* Split fields */
  413. .ui.form .fields {
  414. clear: both;
  415. }
  416. .ui.form .fields:after {
  417. content: ' ';
  418. display: block;
  419. clear: both;
  420. visibility: hidden;
  421. line-height: 0;
  422. height: 0;
  423. }
  424. .ui.form .fields > .field {
  425. clear: none;
  426. float: left;
  427. box-sizing: border-box;
  428. padding-left: 1%;
  429. padding-right: 1%;
  430. }
  431. .ui.form .fields > .field:first-child {
  432. border-left: none;
  433. box-shadow: none;
  434. }
  435. /* Other Combinations */
  436. .ui.form .two.fields > .fields,
  437. .ui.form .two.fields > .field {
  438. width: 50%;
  439. }
  440. .ui.form .three.fields > .fields,
  441. .ui.form .three.fields > .field {
  442. width: 33.333%;
  443. }
  444. .ui.form .four.fields > .fields,
  445. .ui.form .four.fields > .field {
  446. width: 25%;
  447. }
  448. .ui.form .five.fields > .fields,
  449. .ui.form .five.fields > .field {
  450. width: 20%;
  451. }
  452. /* Swap to full width on mobile */
  453. @media only screen and (max-width : 767px) {
  454. .ui.form .two.fields > .fields,
  455. .ui.form .two.fields > .field,
  456. .ui.form .three.fields > .fields,
  457. .ui.form .three.fields > .field,
  458. .ui.form .four.fields > .fields,
  459. .ui.form .four.fields > .field,
  460. .ui.form .five.fields > .fields,
  461. .ui.form .five.fields > .field {
  462. width: 100%;
  463. padding-left: 0%;
  464. padding-right: 0%;
  465. }
  466. }
  467. .ui.form .fields .field:first-child {
  468. padding-left: 0%;
  469. }
  470. .ui.form .fields .field:last-child {
  471. padding-right: 0%;
  472. }
  473. /*--------------------
  474. Inline Fields
  475. ---------------------*/
  476. .ui.form .inline.fields {
  477. margin: @fieldMargin;
  478. }
  479. .ui.form .inline.fields .field {
  480. margin: @inlineFieldsMargin;
  481. }
  482. .ui.form .inline.fields .field > label,
  483. .ui.form .inline.fields .field > p,
  484. .ui.form .inline.fields .field > input,
  485. .ui.form .inline.field > label,
  486. .ui.form .inline.field > p,
  487. .ui.form .inline.field > input {
  488. display: inline-block;
  489. width: auto;
  490. margin-top: 0em;
  491. margin-bottom: 0em;
  492. vertical-align: middle;
  493. font-size: 1em;
  494. }
  495. .ui.form .inline.fields .field > input,
  496. .ui.form .inline.field > input {
  497. font-size: 1em;
  498. }
  499. /* Label */
  500. .ui.form .inline.fields .field > :first-child,
  501. .ui.form .inline.field > :first-child {
  502. margin: 0em @labelMargin 0em 0em;
  503. }
  504. .ui.form .inline.fields .field > :only-child,
  505. .ui.form .inline.field > :only-child {
  506. margin: 0em;
  507. }
  508. /*--------------------
  509. Sizes
  510. ---------------------*/
  511. /* Standard */
  512. .ui.small.form {
  513. font-size: @small;
  514. }
  515. /* Large */
  516. .ui.large.form {
  517. font-size: @large;
  518. }