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.

754 lines
17 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. /*
  2. * # Semantic - Form
  3. * http://github.com/semantic-org/semantic-ui/
  4. *
  5. *
  6. * Copyright 2014 Contributor
  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. Elements
  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. .ui.form :not(.fields) .field:last-child {
  41. margin-bottom: 0em;
  42. }
  43. /*--------------------
  44. Labels
  45. ---------------------*/
  46. .ui.form .grouped.fields > label,
  47. .ui.form .inline.fields > label,
  48. .ui.form .field > label {
  49. margin: 0em 0em @labelMargin 0em;
  50. display: block;
  51. color: @labelColor;
  52. font-size: @labelFontSize;
  53. font-weight: @labelFontWeight;
  54. }
  55. /*--------------------
  56. Standard Inputs
  57. ---------------------*/
  58. .ui.form textarea,
  59. .ui.form input[type="text"],
  60. .ui.form input[type="email"],
  61. .ui.form input[type="date"],
  62. .ui.form input[type="password"],
  63. .ui.form input[type="number"],
  64. .ui.form input[type="url"],
  65. .ui.form input[type="tel"],
  66. .ui.form .ui.input {
  67. width: 100%;
  68. }
  69. .ui.form input[type="text"],
  70. .ui.form input[type="email"],
  71. .ui.form input[type="date"],
  72. .ui.form input[type="password"],
  73. .ui.form input[type="number"],
  74. .ui.form input[type="url"],
  75. .ui.form input[type="tel"] {
  76. margin: 0em;
  77. outline: none;
  78. -webkit-appearance: none;
  79. -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
  80. line-height: @inputLineHeight;
  81. padding: @inputPadding;
  82. font-size: @inputFontSize;
  83. background: @inputBackground;
  84. border: @inputBorder;
  85. color: @inputColor;
  86. border-radius: @inputBorderRadius;
  87. box-shadow: @inputBoxShadow;
  88. box-sizing: border-box;
  89. transition: @inputTransition;
  90. }
  91. .ui.textarea,
  92. .ui.form textarea {
  93. margin: 0em;
  94. padding: @inputVerticalPadding @inputHorizontalPadding;
  95. font-size: @inputFontSize;
  96. background: @inputBackground;
  97. border: @inputBorder;
  98. outline: none;
  99. color: @inputColor;
  100. border-radius: @inputBorderRadius;
  101. box-shadow: @inputBoxShadow;
  102. -webkit-appearance: none;
  103. -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
  104. box-sizing: border-box;
  105. transition: @inputTransition;
  106. font-size: @textAreaFontSize;
  107. height: @textAreaHeight;
  108. min-height: @textAreaMinHeight;
  109. max-height: @textAreaMaxHeight;
  110. line-height: @textAreaLineHeight;
  111. resize: @textAreaResize;
  112. }
  113. .ui.form textarea,
  114. .ui.form input[type="checkbox"] {
  115. vertical-align: @checkboxVerticalAlign;
  116. }
  117. /*--------------------------
  118. Input w/ attached Button
  119. ---------------------------*/
  120. .ui.form input.attached {
  121. width: auto;
  122. }
  123. /*--------------------
  124. Dropdown
  125. ---------------------*/
  126. .ui.form .field > .selection.dropdown {
  127. width: 100%;
  128. }
  129. .ui.form .field > .selection.dropdown > .dropdown.icon {
  130. float: right;
  131. }
  132. .ui.form .inline.field > .selection.dropdown {
  133. width: auto;
  134. }
  135. .ui.form .inline.field > .selection.dropdown > .dropdown.icon {
  136. float: none;
  137. }
  138. /*--------------------
  139. Dividers
  140. ---------------------*/
  141. .ui.form .divider {
  142. clear: both;
  143. margin: @dividerMargin;
  144. }
  145. /*--------------------
  146. Types of Messages
  147. ---------------------*/
  148. .ui.form .info.message,
  149. .ui.form .success.message,
  150. .ui.form .warning.message,
  151. .ui.form .error.message {
  152. display: none;
  153. }
  154. /* Assumptions */
  155. .ui.form .message:first-child {
  156. margin-top: 0px;
  157. }
  158. /*--------------------
  159. Validation Prompt
  160. ---------------------*/
  161. .ui.form .field .prompt.label {
  162. white-space: nowrap;
  163. }
  164. .ui.form .inline.field .prompt {
  165. margin: @validationMargin;
  166. }
  167. .ui.form .inline.field .prompt:before {
  168. margin-top: @validationArrowOffset;
  169. bottom: auto;
  170. right: auto;
  171. top: 50%;
  172. left: 0em;
  173. }
  174. /*******************************
  175. States
  176. *******************************/
  177. /*--------------------
  178. Placeholder
  179. ---------------------*/
  180. /* browsers require these rules separate */
  181. .ui.form ::-webkit-input-placeholder {
  182. color: @inputPlaceholderColor;
  183. }
  184. .ui.form ::-moz-placeholder {
  185. color: @inputPlaceholderColor;
  186. }
  187. .ui.form :focus::-webkit-input-placeholder {
  188. color: @inputPlaceholderFocusColor;
  189. }
  190. .ui.form :focus::-moz-placeholder {
  191. color: @inputPlaceholderFocusColor;
  192. }
  193. /* Error Placeholder */
  194. .ui.form .error ::-webkit-input-placeholder {
  195. color: @inputErrorPlaceholderColor;
  196. }
  197. .ui.form .error ::-moz-placeholder {
  198. color: @inputErrorPlaceholderColor;
  199. }
  200. .ui.form .error :focus::-webkit-input-placeholder {
  201. color: @inputErrorPlaceholderFocusColor;
  202. }
  203. .ui.form .error :focus::-moz-placeholder {
  204. color: @inputErrorPlaceholderFocusColor;
  205. }
  206. /*--------------------
  207. Focus
  208. ---------------------*/
  209. .ui.form input[type="text"]:focus,
  210. .ui.form input[type="email"]:focus,
  211. .ui.form input[type="date"]:focus,
  212. .ui.form input[type="password"]:focus,
  213. .ui.form input[type="number"]:focus,
  214. .ui.form input[type="url"]:focus,
  215. .ui.form input[type="tel"]:focus,
  216. .ui.form textarea:focus{
  217. color: @inputFocusColor;
  218. border-color: @inputFocusBorderColor;
  219. border-radius: @inputFocusBorderRadius;
  220. background: @inputFocusBackground;
  221. box-shadow: @inputFocusBoxShadow;
  222. -webkit-appearance: none;
  223. }
  224. /*--------------------
  225. Success
  226. ---------------------*/
  227. /* On Form */
  228. .ui.form.success .success.message {
  229. display: block;
  230. }
  231. /*--------------------
  232. Error
  233. ---------------------*/
  234. /* On Form */
  235. .ui.form.warning .warning.message {
  236. display: block;
  237. }
  238. /*--------------------
  239. Warning
  240. ---------------------*/
  241. /* On Form */
  242. .ui.form.error .error.message {
  243. display: block;
  244. }
  245. /* On Field(s) */
  246. .ui.form .fields.error .field label,
  247. .ui.form .field.error label,
  248. .ui.form .fields.error .field .input,
  249. .ui.form .field.error .input {
  250. color: @formErrorColor;
  251. }
  252. .ui.form .fields.error .field .corner.label,
  253. .ui.form .field.error .corner.label {
  254. border-color: @formErrorColor;
  255. color: @white;
  256. }
  257. .ui.form .fields.error .field textarea,
  258. .ui.form .fields.error .field input[type="text"],
  259. .ui.form .fields.error .field input[type="email"],
  260. .ui.form .fields.error .field input[type="date"],
  261. .ui.form .fields.error .field input[type="password"],
  262. .ui.form .fields.error .field input[type="number"],
  263. .ui.form .fields.error .field input[type="url"],
  264. .ui.form .fields.error .field input[type="tel"],
  265. .ui.form .field.error textarea,
  266. .ui.form .field.error input[type="text"],
  267. .ui.form .field.error input[type="email"],
  268. .ui.form .field.error input[type="date"],
  269. .ui.form .field.error input[type="password"],
  270. .ui.form .field.error input[type="number"],
  271. .ui.form .field.error input[type="url"],
  272. .ui.form .field.error input[type="tel"] {
  273. background: @formErrorBackground;
  274. border-color: @formErrorBorder;
  275. color: @formErrorColor;
  276. border-radius: @inputErrorBorderRadius;
  277. box-shadow: @inputErrorBoxShadow;
  278. }
  279. .ui.form .field.error textarea:focus,
  280. .ui.form .field.error input[type="text"]:focus,
  281. .ui.form .field.error input[type="email"]:focus,
  282. .ui.form .field.error input[type="date"]:focus,
  283. .ui.form .field.error input[type="password"]:focus,
  284. .ui.form .field.error input[type="number"]:focus,
  285. .ui.form .field.error input[type="url"]:focus,
  286. .ui.form .field.error input[type="tel"]:focus{
  287. background: @inputErrorFocusBackground;
  288. border-color: @inputErrorFocusBorder;
  289. color: @inputErrorFocusColor;
  290. -webkit-appearance: none;
  291. box-shadow: @inputErrorFocusBoxShadow;
  292. }
  293. /*------------------
  294. Dropdown Error
  295. --------------------*/
  296. .ui.form .fields.error .field .ui.dropdown,
  297. .ui.form .fields.error .field .ui.dropdown .item,
  298. .ui.form .field.error .ui.dropdown,
  299. .ui.form .field.error .ui.dropdown .text,
  300. .ui.form .field.error .ui.dropdown .item {
  301. background: @formErrorBackground;
  302. color: @formErrorColor;
  303. }
  304. .ui.form .fields.error .field .ui.dropdown,
  305. .ui.form .field.error .ui.dropdown {
  306. box-shadow: 0px 0px 0px 1px @formErrorBorder !important;
  307. }
  308. .ui.form .fields.error .field .ui.dropdown:hover,
  309. .ui.form .field.error .ui.dropdown:hover {
  310. box-shadow: 0px 0px 0px 1px @formErrorBorder !important;
  311. }
  312. .ui.form .fields.error .field .ui.dropdown:hover .menu,
  313. .ui.form .field.error .ui.dropdown:hover .menu {
  314. box-shadow: 0px 1px 0px 1px @formErrorBorder;
  315. }
  316. /* Hover */
  317. .ui.form .fields.error .field .ui.dropdown .menu .item:hover,
  318. .ui.form .field.error .ui.dropdown .menu .item:hover {
  319. background-color: @dropdownErrorHoverBackground;
  320. }
  321. /* Active */
  322. .ui.form .fields.error .field .ui.dropdown .menu .active.item,
  323. .ui.form .field.error .ui.dropdown .menu .active.item {
  324. background-color: @dropdownErrorActiveBackground !important;
  325. }
  326. /*--------------------
  327. Checkbox Error
  328. ---------------------*/
  329. .ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) label,
  330. .ui.form .field.error .checkbox:not(.toggle):not(.slider) label,
  331. .ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) .box,
  332. .ui.form .field.error .checkbox:not(.toggle):not(.slider) .box {
  333. color: @formErrorColor;
  334. }
  335. .ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) label:before,
  336. .ui.form .field.error .checkbox:not(.toggle):not(.slider) label:before,
  337. .ui.form .fields.error .field .checkbox:not(.toggle):not(.slider) .box:before,
  338. .ui.form .field.error .checkbox:not(.toggle):not(.slider) .box:before {
  339. background: @formErrorBackground;
  340. border-color: @formErrorBorder;
  341. }
  342. .ui.form .fields.error .field .checkbox label:after,
  343. .ui.form .field.error .checkbox label:after,
  344. .ui.form .fields.error .field .checkbox .box:after,
  345. .ui.form .field.error .checkbox .box:after {
  346. color: @formErrorColor;
  347. }
  348. /*--------------------
  349. Disabled
  350. ---------------------*/
  351. .ui.form .field :disabled,
  352. .ui.form .field.disabled {
  353. opacity: 0.5;
  354. }
  355. .ui.form .field.disabled label {
  356. opacity: 0.5;
  357. }
  358. .ui.form .field.disabled :disabled {
  359. opacity: 1;
  360. }
  361. /*--------------------
  362. Loading State
  363. ---------------------*/
  364. /* On Form */
  365. .ui.form.loading {
  366. position: relative;
  367. }
  368. .ui.form.loading:after {
  369. position: absolute;
  370. top: 0%;
  371. left: 0%;
  372. content: '';
  373. width: 100%;
  374. height: 100%;
  375. background: @formLoaderDimmerColor url(@formLoaderPath) no-repeat @formLoaderPosition;
  376. visibility: visible;
  377. }
  378. /*******************************
  379. Element Types
  380. *******************************/
  381. /*--------------------
  382. Required Field
  383. ---------------------*/
  384. .ui.form .required.fields > .field > label:after,
  385. .ui.form .required.fields > .field > .checkbox:after,
  386. .ui.form .required.field > label:after,
  387. .ui.form .required.field > .checkbox:after {
  388. margin: -0.2em 0em 0em 0.2em;
  389. vertical-align: top;
  390. content: '*';
  391. color: @requiredColor;
  392. }
  393. /*--------------------
  394. Date Input
  395. ---------------------*/
  396. .ui.form .date.field > label {
  397. position: relative;
  398. }
  399. .ui.form .date.field > label:after {
  400. position: absolute;
  401. top: 2em;
  402. right: 0.5em;
  403. font-family: 'Icons';
  404. content: '\f133';
  405. font-size: 1.2em;
  406. font-weight: normal;
  407. color: #CCCCCC;
  408. }
  409. /*******************************
  410. Variations
  411. *******************************/
  412. /*--------------------
  413. Inverted Colors
  414. ---------------------*/
  415. .ui.inverted.form label,
  416. .ui.form .inverted.segment label,
  417. .ui.form .inverted.segment .ui.checkbox label,
  418. .ui.form .inverted.segment .ui.checkbox .box,
  419. .ui.inverted.form .ui.checkbox label,
  420. .ui.inverted.form .ui.checkbox .box {
  421. color: @invertedLabelColor;
  422. }
  423. .ui.inverted.form.loading:after {
  424. background: @formInvertedLoaderDimmerColor url(@formInvertedLoaderPath) no-repeat @formLoaderPosition;
  425. }
  426. /*--------------------
  427. Field Groups
  428. ---------------------*/
  429. /* Grouped Vertically */
  430. .ui.form .grouped.fields {
  431. margin: @groupedMargin;
  432. }
  433. .ui.form .grouped.fields:last-child {
  434. margin-bottom: 0em;
  435. }
  436. .ui.form .grouped.fields .field {
  437. display: block;
  438. float: none;
  439. margin: @groupedFieldMargin;
  440. padding: 0em;
  441. }
  442. /*--------------------
  443. Fields
  444. ---------------------*/
  445. /* Split fields */
  446. .ui.form .fields {
  447. clear: both;
  448. }
  449. .ui.form .fields:after {
  450. content: ' ';
  451. display: block;
  452. clear: both;
  453. visibility: hidden;
  454. line-height: 0;
  455. height: 0;
  456. }
  457. .ui.form .fields > .field {
  458. clear: none;
  459. float: left;
  460. box-sizing: border-box;
  461. padding-left: @gutterWidth;
  462. padding-right: @gutterWidth;
  463. }
  464. .ui.form .fields > .field:first-child {
  465. border-left: none;
  466. box-shadow: none;
  467. }
  468. /* Other Combinations */
  469. .ui.form .two.fields > .fields,
  470. .ui.form .two.fields > .field {
  471. width: @twoColumn;
  472. }
  473. .ui.form .three.fields > .fields,
  474. .ui.form .three.fields > .field {
  475. width: @threeColumn;
  476. }
  477. .ui.form .four.fields > .fields,
  478. .ui.form .four.fields > .field {
  479. width: @fourColumn;
  480. }
  481. .ui.form .five.fields > .fields,
  482. .ui.form .five.fields > .field {
  483. width: @fiveColumn;
  484. }
  485. /* Swap to full width on mobile */
  486. @media only screen and (max-width : 767px) {
  487. .ui.form .two.fields > .fields,
  488. .ui.form .two.fields > .field,
  489. .ui.form .three.fields > .fields,
  490. .ui.form .three.fields > .field,
  491. .ui.form .four.fields > .fields,
  492. .ui.form .four.fields > .field,
  493. .ui.form .five.fields > .fields,
  494. .ui.form .five.fields > .field {
  495. width: @oneColumn;
  496. padding-left: 0%;
  497. padding-right: 0%;
  498. }
  499. }
  500. .ui.form .fields .field:first-child {
  501. padding-left: 0%;
  502. }
  503. .ui.form .fields .field:last-child {
  504. padding-right: 0%;
  505. }
  506. /* Sizing Combinations */
  507. .ui.form .fields .wide.field {
  508. width: @oneWide;
  509. padding-left: @gutterWidth;
  510. padding-right: @gutterWidth;
  511. }
  512. .ui.form .fields .wide.field:first-child {
  513. padding-left: 0%;
  514. }
  515. .ui.form .fields .wide.field:last-child {
  516. padding-right: 0%;
  517. }
  518. .ui.form .one.wide.field {
  519. width: @oneWide !important;
  520. }
  521. .ui.form .two.wide.field {
  522. width: @twoWide !important;
  523. }
  524. .ui.form .three.wide.field {
  525. width: @threeWide !important;
  526. }
  527. .ui.form .four.wide.field {
  528. width: @fourWide !important;
  529. }
  530. .ui.form .five.wide.field {
  531. width: @fiveWide !important;
  532. }
  533. .ui.form .six.wide.field {
  534. width: @sixWide !important;
  535. }
  536. .ui.form .seven.wide.field {
  537. width: @sevenWide !important;
  538. }
  539. .ui.form .eight.wide.field {
  540. width: @eightWide !important;
  541. }
  542. .ui.form .nine.wide.field {
  543. width: @nineWide !important;
  544. }
  545. .ui.form .ten.wide.field {
  546. width: @tenWide !important;
  547. }
  548. .ui.form .eleven.wide.field {
  549. width: @elevenWide !important;
  550. }
  551. .ui.form .twelve.wide.field {
  552. width: @twelveWide !important;
  553. }
  554. .ui.form .thirteen.wide.field {
  555. width: @thirteenWide !important;
  556. }
  557. .ui.form .fourteen.wide.field {
  558. width: @fourteenWide !important;
  559. }
  560. .ui.form .fifteen.wide.field {
  561. width: @fifteenWide !important;
  562. }
  563. .ui.form .sixteen.wide.field {
  564. width: @sixteenWide !important;
  565. }
  566. /* Swap to full width on mobile */
  567. @media only screen and (max-width : 767px) {
  568. .ui.form .two.fields > .fields,
  569. .ui.form .two.fields > .field,
  570. .ui.form .three.fields > .fields,
  571. .ui.form .three.fields > .field,
  572. .ui.form .four.fields > .fields,
  573. .ui.form .four.fields > .field,
  574. .ui.form .five.fields > .fields,
  575. .ui.form .five.fields > .field,
  576. .ui.form .fields > .two.wide.field,
  577. .ui.form .fields > .three.wide.field,
  578. .ui.form .fields > .four.wide.field,
  579. .ui.form .fields > .five.wide.field,
  580. .ui.form .fields > .six.wide.field,
  581. .ui.form .fields > .seven.wide.field,
  582. .ui.form .fields > .eight.wide.field,
  583. .ui.form .fields > .nine.wide.field,
  584. .ui.form .fields > .ten.wide.field,
  585. .ui.form .fields > .eleven.wide.field,
  586. .ui.form .fields > .twelve.wide.field,
  587. .ui.form .fields > .thirteen.wide.field,
  588. .ui.form .fields > .fourteen.wide.field,
  589. .ui.form .fields > .fifteen.wide.field,
  590. .ui.form .fields > .sixteen.wide.field {
  591. width: @oneColumn;
  592. padding-left: 0%;
  593. padding-right: 0%;
  594. }
  595. }
  596. /*--------------------
  597. Inline Fields
  598. ---------------------*/
  599. .ui.form .inline.fields {
  600. margin: @fieldMargin;
  601. }
  602. .ui.form .inline.fields .field {
  603. display: inline-block;
  604. margin: @inlineFieldsMargin;
  605. padding: 0em;
  606. }
  607. .ui.form .inline.fields .field > label,
  608. .ui.form .inline.fields .field > p,
  609. .ui.form .inline.fields .field > input,
  610. .ui.form .inline.field > label,
  611. .ui.form .inline.field > p,
  612. .ui.form .inline.field > input {
  613. display: inline-block;
  614. width: auto;
  615. margin-top: 0em;
  616. margin-bottom: 0em;
  617. vertical-align: @inlineLabelVerticalAlign;
  618. font-size: @inlineLabelFontSize;
  619. }
  620. .ui.form .inline.fields .field > input,
  621. .ui.form .inline.field > input {
  622. font-size: @inlineLabelFontSize;
  623. }
  624. /* Label */
  625. .ui.form .inline.fields .field > :first-child,
  626. .ui.form .inline.field > :first-child {
  627. margin: 0em @labelMargin 0em 0em;
  628. }
  629. .ui.form .inline.fields .field > :only-child,
  630. .ui.form .inline.field > :only-child {
  631. margin: 0em;
  632. }
  633. /*--------------------
  634. Sizes
  635. ---------------------*/
  636. /* Standard */
  637. .ui.small.form {
  638. font-size: @small;
  639. }
  640. /* Medium */
  641. .ui.form {
  642. font-size: @medium;
  643. }
  644. /* Large */
  645. .ui.large.form {
  646. font-size: @large;
  647. }
  648. /* Huge */
  649. .ui.huge.form {
  650. font-size: @huge;
  651. }