open-nomad/ui/app/templates/components/stepper-input.hbs

37 lines
1,019 B
Handlebars
Raw Normal View History

<label
data-test-stepper-label
for="stepper-input-{{this.elementId}}"
class="stepper-input-label">{{yield}}</label>
2020-06-18 20:19:47 +00:00
<input
2020-06-19 05:07:51 +00:00
data-test-stepper-input
2020-06-18 20:19:47 +00:00
type="number"
min={{this.min}}
max={{this.max}}
value={{this.internalValue}}
disabled={{this.disabled}}
id="stepper-input-{{this.elementId}}"
2020-06-19 03:13:36 +00:00
class="stepper-input-input"
onFocus={{action "selectValue"}}
2020-06-18 20:19:47 +00:00
onKeyDown={{action "resetTextInput"}}
onChange={{action "setValue"}}>
<button
2020-06-19 05:07:51 +00:00
data-test-stepper-decrement
2020-06-18 20:19:47 +00:00
role="button"
aria-label="decrement"
class="stepper-input-stepper button {{this.class}}"
disabled={{or this.disabled (lte this.internalValue this.min)}}
onclick={{action "decrement"}}
type="button">
2020-06-18 20:19:47 +00:00
{{x-icon "minus-plain"}}
</button>
<button
2020-06-19 05:07:51 +00:00
data-test-stepper-increment
2020-06-18 20:19:47 +00:00
role="button"
aria-label="increment"
class="stepper-input-stepper button {{this.class}}"
disabled={{or this.disabled (gte this.internalValue this.max)}}
onclick={{action "increment"}}
type="button">
2020-06-18 20:19:47 +00:00
{{x-icon "plus-plain"}}
</button>