fix(input-stepper): make decrement and increment functions protected instead of private (#2568)

This commit is contained in:
gerjanvangeest 2025-09-04 14:28:54 +02:00 committed by GitHub
parent b80c6f41b0
commit 02d0106a06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 10 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/ui': patch
---
[input-stepper] make decrement and increment functions protected instead of private

View file

@ -94,8 +94,8 @@ export class LionInputStepper extends LocalizeMixin(LionInput) {
step: this.step, step: this.step,
}; };
this.__increment = this.__increment.bind(this); this._increment = this._increment.bind(this);
this.__decrement = this.__decrement.bind(this); this._decrement = this._decrement.bind(this);
this._onEnterButton = this._onEnterButton.bind(this); this._onEnterButton = this._onEnterButton.bind(this);
this._onLeaveButton = this._onLeaveButton.bind(this); this._onLeaveButton = this._onLeaveButton.bind(this);
} }
@ -192,11 +192,11 @@ export class LionInputStepper extends LocalizeMixin(LionInput) {
*/ */
__keyDownHandler(ev) { __keyDownHandler(ev) {
if (ev.key === 'ArrowUp') { if (ev.key === 'ArrowUp') {
this.__increment(); this._increment();
} }
if (ev.key === 'ArrowDown') { if (ev.key === 'ArrowDown') {
this.__decrement(); this._decrement();
} }
} }
@ -262,9 +262,9 @@ export class LionInputStepper extends LocalizeMixin(LionInput) {
/** /**
* Increment the value based on given step or default step value is 1 * Increment the value based on given step or default step value is 1
* @private * @protected
*/ */
__increment() { _increment() {
const { step, min, max } = this.values; const { step, min, max } = this.values;
const stepMin = min !== Infinity ? min : 0; const stepMin = min !== Infinity ? min : 0;
@ -284,9 +284,9 @@ export class LionInputStepper extends LocalizeMixin(LionInput) {
/** /**
* Decrement the value based on given step or default step value is 1 * Decrement the value based on given step or default step value is 1
* @private * @protected
*/ */
__decrement() { _decrement() {
const { step, max, min } = this.values; const { step, max, min } = this.values;
const stepMin = min !== Infinity ? min : 0; const stepMin = min !== Infinity ? min : 0;
@ -379,7 +379,7 @@ export class LionInputStepper extends LocalizeMixin(LionInput) {
return html` return html`
<button <button
?disabled=${this.disabled || this.readOnly} ?disabled=${this.disabled || this.readOnly}
@click=${this.__decrement} @click=${this._decrement}
@focus=${this._onEnterButton} @focus=${this._onEnterButton}
@blur=${this._onLeaveButton} @blur=${this._onLeaveButton}
type="button" type="button"
@ -399,7 +399,7 @@ export class LionInputStepper extends LocalizeMixin(LionInput) {
return html` return html`
<button <button
?disabled=${this.disabled || this.readOnly} ?disabled=${this.disabled || this.readOnly}
@click=${this.__increment} @click=${this._increment}
@focus=${this._onEnterButton} @focus=${this._onEnterButton}
@blur=${this._onLeaveButton} @blur=${this._onLeaveButton}
type="button" type="button"