Skip to content

Commit

Permalink
fix(number-input): add number input disabled styles back in (carbon-d…
Browse files Browse the repository at this point in the history
…esign-system#447)

* fix(number-input): add number input disabled styles back in

* fix(number-input): add support for invalid number input

* fix(number-input): change example text
  • Loading branch information
tw15egan authored and marijohannessen committed Nov 30, 2017
1 parent 546a7e4 commit 8ca3986
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/components/number-input/_number-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@
&:focus {
@include focus-outline('border');
}

&:disabled {
opacity: 0.5;
cursor: not-allowed;
}

&:disabled ~ .bx--number__controls {
opacity: 0.5;
cursor: not-allowed;
pointer-events: none;
}
}

.bx--number input[type='number'] {
Expand Down Expand Up @@ -87,3 +98,12 @@
}
}
}

.bx--number[data-invalid] {
input[type='number'] {
box-shadow: 0 2px 0px 0px $support-01;
}
~ .bx--form-requirement {
max-height: rem(200px);
}
}
22 changes: 22 additions & 0 deletions src/components/number-input/number-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,25 @@
</div>
</div>
</div>

<div class="bx--form-item">
<label for="number-input" class="bx--label">Number Input label</label>
<div data-invalid data-numberinput class="bx--number">
<input id="number-input" type="number" min="0" max="100" value="1">
<div class="bx--number__controls">
<button class="bx--number__control-btn up-icon">
<svg viewBox="0 2 10 5" width="10" height="5" fill-rule="evenodd">
<path d="M10 5L5 0 0 5z"></path>
</svg>
</button>
<button class="bx--number__control-btn down-icon">
<svg viewBox="0 2 10 5" width="10" height="5" fill-rule="evenodd">
<path d="M10 0L5 5 0 0z"></path>
</svg>
</button>
</div>
</div>
<div class="bx--form-requirement">
Invalid number
</div>
</div>

0 comments on commit 8ca3986

Please sign in to comment.