-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for form label tooltips.
* Make form labels inline-block by default and add block modifier. * Make input field and dropdown block by default and add inline modifier. * Bump version to 2.0.0 as these changes are potentially breaking.
- Loading branch information
Henrik Hedlund
committed
Sep 20, 2016
1 parent
99f2809
commit 8fa8b95
Showing
11 changed files
with
141 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head lang="nb"> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" type="text/css" href="examples.css"> | ||
</head> | ||
|
||
<body class="ffe-body-text"> | ||
<main class="styleguide-wrapper"> | ||
<section class="ffe-section-wrapper"> | ||
|
||
<div class="ffe-content-container ffe-content-container--text-left"> | ||
<h2 class="ffe-h2">Input-felt med hjelpetekst</h2> | ||
<div class="ffe-content-container ffe-content-container--text-left"> | ||
<h2 class="ffe-h4">Lukket</h2> | ||
<p class="ffe-body-paragraph">Trykk på ? for å åpne/lukke</p> | ||
<div class="ffe-input-group" aria-live="polite"> | ||
<label for="cvv" id="cvv-label" class="ffe-form-label"> | ||
Normal with info | ||
</label> | ||
<button id="cvv-tooltip-button" class="ffe-tooltip__icon">?</button> | ||
|
||
<p id="cvv-tooltip" class="ffe-tooltip__text ffe-small-text"> | ||
Hjelpetekst | ||
</p> | ||
|
||
<input type="text" id="cvv" class="ffe-input-field ffe-input-field--large" name="cvv" maxlength="3" | ||
autocomplete="off"> | ||
</div> | ||
</div> | ||
<div class="ffe-content-container ffe-content-container--text-left"> | ||
<h2 class="ffe-h4">Åpen</h2> | ||
|
||
|
||
<div class="ffe-input-group" aria-live="polite"> | ||
<label for="cvv-open" class="ffe-form-label"> | ||
CVV2 | ||
</label> | ||
<button class="ffe-tooltip__icon ffe-tooltip__icon--active">?</button> | ||
|
||
<p class="ffe-tooltip__text ffe-tooltip__text--active ffe-small-text" style="max-height: 22px"> | ||
Hjelpetekst | ||
</p> | ||
|
||
<input type="text" id="cvv-open" class="ffe-input-field ffe-input-field--medium" name="cvv" | ||
maxlength="3" autocomplete="off"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
document.getElementById('cvv-tooltip-button').onclick = function () { | ||
var tooltip = document.getElementById('cvv-tooltip'); | ||
var displayHeight = tooltip.clientHeight; | ||
var scrollHeight = tooltip.scrollHeight; | ||
displayHeight ? document.getElementById('cvv-tooltip-button').classList.remove('ffe-tooltip__icon--active') : document.getElementById('cvv-tooltip-button').classList.add('ffe-tooltip__icon--active'); | ||
displayHeight ? tooltip.classList.remove('ffe-tooltip__text--active') : tooltip.classList.add('ffe-tooltip__text--active'); | ||
displayHeight ? tooltip.style = '' : tooltip.style = 'max-height: ' + scrollHeight + 'px;'; | ||
}; | ||
</script> | ||
|
||
</section> | ||
</main> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.ffe-tooltip { | ||
|
||
@ffe-tooltip-size: 25px; | ||
|
||
&__icon { | ||
background: @ffe-white; | ||
border-radius: 50%; | ||
border: 2px solid @ffe-grey-light; | ||
color: @ffe-blue-royal-light-wcag; | ||
cursor: help; | ||
display: inline-block; | ||
font-size: 18px; | ||
height: @ffe-tooltip-size; | ||
line-height: @ffe-tooltip-size; | ||
margin: 0 0 4px 13px; | ||
padding: 0 0 0 1px; | ||
text-align: center; | ||
vertical-align: middle; | ||
width: @ffe-tooltip-size; | ||
|
||
&:hover, &:focus { | ||
border-color: @ffe-blue-royal-light-wcag; | ||
} | ||
|
||
&:focus { | ||
box-shadow: 0 0 0 2px @ffe-blue-focus; | ||
outline: none; | ||
} | ||
|
||
&:active, &--active { | ||
border-color: @ffe-blue-royal; | ||
color: @ffe-blue-royal; | ||
} | ||
} | ||
|
||
&__text { | ||
margin: 0; | ||
max-height: 0; | ||
overflow: hidden; | ||
transition: all 0.3s ease-in-out; | ||
|
||
&--active { | ||
margin-bottom: 12px | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.