diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-center-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-center-auto.png index 8a52d81bd..3d842890f 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-center-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-center-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-right-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-right-auto.png index 115ddce13..c36218d53 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-right-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-right-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-right-unit-outside-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-right-unit-outside-auto.png index 4ed3344a1..774bbe594 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-right-unit-outside-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/align-right-unit-outside-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-auto.png index c8396b221..f7d5e22d0 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-center-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-center-auto.png index 746204540..f44a646e9 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-center-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-center-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-disabled-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-disabled-auto.png index 05af8ad34..cbd07871f 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-disabled-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-disabled-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-error-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-error-auto.png index 0808dc693..a634eb2ed 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-error-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/complete-error-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/default-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/default-auto.png index a5b262c4a..f0e67bc45 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/default-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/default-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/disabled-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/disabled-auto.png index 539b9f80e..d12e45ddb 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/disabled-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/disabled-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-auto.png index 0ce08cc7e..3838890cb 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-with-icon-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-with-icon-auto.png index bb4da53f3..f7b4857e1 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-with-icon-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-with-icon-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-with-label-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-with-label-auto.png index 955f2b57c..2b650f8f3 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-with-label-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/error-with-label-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/formatting-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/formatting-auto.png new file mode 100644 index 000000000..15728462e Binary files /dev/null and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/formatting-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-center-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-center-auto.png index 26c4b8454..25c9adbbc 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-center-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-center-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-left-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-left-auto.png index 53e9b53ef..b592dde15 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-left-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-left-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-right-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-right-auto.png index 4d1c635c5..815a22034 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-right-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/helper-placement-right-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-center-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-center-auto.png index bbff46dc1..e7f64195c 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-center-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-center-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-left-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-left-auto.png index 522c92c16..b7fc0be29 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-left-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-left-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-right-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-right-auto.png index b6d6f4502..9aefc90df 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-right-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/label-placement-right-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/size-large-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/size-large-auto.png index f9156755b..8ea656934 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/size-large-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/size-large-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/size-regular-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/size-regular-auto.png index a5b262c4a..f0e67bc45 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/size-regular-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/size-regular-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-helper-text-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-helper-text-auto.png index 68ef49fa6..65e0cdfc2 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-helper-text-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-helper-text-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-helper-text-icon-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-helper-text-icon-auto.png index c22a6ae60..9efe961c3 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-helper-text-icon-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-helper-text-icon-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-auto.png index 3a2cf866f..312999405 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-icon-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-icon-auto.png index 981952749..63f048dc1 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-icon-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-icon-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-required-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-required-auto.png index 18d3ed39a..283dadf87 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-required-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-label-required-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-leading-icon-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-leading-icon-auto.png index 88adfd9d7..29a60f2d1 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-leading-icon-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-leading-icon-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-placeholder-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-placeholder-auto.png index e3f1830f1..a385ab3ee 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-placeholder-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/number-input-field/number-input-field.stories.ts/with-placeholder-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/disabled-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/disabled-auto.png index 89ded7ca8..ab1cc9918 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/disabled-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/disabled-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/left-right-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/left-right-auto.png index bfbdb089a..ec3ed7dd1 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/left-right-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/left-right-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/plus-minus-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/plus-minus-auto.png index 33d211283..dbd1e8350 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/plus-minus-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/plus-minus-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/up-down-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/up-down-auto.png index 7fc6d1cc5..840b1d1ff 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/up-down-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/up-down-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/with-helper-text-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/with-helper-text-auto.png index 049956097..afb4d280d 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/with-helper-text-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/with-helper-text-auto.png differ diff --git a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/without-unit-auto.png b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/without-unit-auto.png index 31b46f3a2..603260edb 100644 Binary files a/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/without-unit-auto.png and b/packages/openbridge-webcomponents/__vis__/linux/__baselines__/components/stepper-box/stepper-box.stories.ts/without-unit-auto.png differ diff --git a/packages/openbridge-webcomponents/src/automation/automation-input-modal/automation-input-modal.stories.ts b/packages/openbridge-webcomponents/src/automation/automation-input-modal/automation-input-modal.stories.ts index a5a51af49..38f568d34 100644 --- a/packages/openbridge-webcomponents/src/automation/automation-input-modal/automation-input-modal.stories.ts +++ b/packages/openbridge-webcomponents/src/automation/automation-input-modal/automation-input-modal.stories.ts @@ -90,7 +90,7 @@ export const Compact: Story = { diff --git a/packages/openbridge-webcomponents/src/components/icon-button/icon-button.css b/packages/openbridge-webcomponents/src/components/icon-button/icon-button.css index b426ca2d8..de22829ce 100644 --- a/packages/openbridge-webcomponents/src/components/icon-button/icon-button.css +++ b/packages/openbridge-webcomponents/src/components/icon-button/icon-button.css @@ -42,6 +42,10 @@ border-top-right-radius: 0; border-bottom-right-radius: 0; } + + &.hide-divider .visible-wrapper { + border-right: none; + } } &.corner-right { @@ -56,6 +60,10 @@ border-top-left-radius: 0; border-bottom-left-radius: 0; } + + &.hide-divider .visible-wrapper { + border-left: none; + } } &.corner-left.corner-right { diff --git a/packages/openbridge-webcomponents/src/components/icon-button/icon-button.ts b/packages/openbridge-webcomponents/src/components/icon-button/icon-button.ts index 81cea3299..42fc1446d 100644 --- a/packages/openbridge-webcomponents/src/components/icon-button/icon-button.ts +++ b/packages/openbridge-webcomponents/src/components/icon-button/icon-button.ts @@ -135,6 +135,9 @@ export class ObcIconButton extends LitElement { */ @property({type: Boolean}) hasLabel: boolean = false; + /** If false, and cornerLeft or cornerRight is true, the divider is not shown. */ + @property({type: Boolean, attribute: false}) showDivider = true; + get progressSpinner() { if (this.progress === undefined) { return nothing; @@ -202,6 +205,7 @@ export class ObcIconButton extends LitElement { 'has-label': this.hasLabel, wide: this.wide, progress: this.progress !== undefined, + 'hide-divider': !this.showDivider, })} ?disabled=${this.disabled} part="wrapper" diff --git a/packages/openbridge-webcomponents/src/components/keyboard-numeric/keyboard-numeric.ts b/packages/openbridge-webcomponents/src/components/keyboard-numeric/keyboard-numeric.ts index 9ed379bdf..d6b0d074c 100644 --- a/packages/openbridge-webcomponents/src/components/keyboard-numeric/keyboard-numeric.ts +++ b/packages/openbridge-webcomponents/src/components/keyboard-numeric/keyboard-numeric.ts @@ -17,7 +17,9 @@ import { ObcNumberInputField, ObcNumberInputFieldTextAlign, ObcNumberInputFieldSize, + ObcNumberInputFieldInputEvent, } from '../number-input-field/number-input-field.js'; +import {parseNumberInput} from '../number-input-field/number-input-format.js'; export enum ObcKeyboardNumericType { Floating = 'floating', @@ -248,20 +250,20 @@ export class ObcKeyboardNumeric extends LitElement { ); } - private handleInputChange(e: Event) { + private handleInput(e: ObcNumberInputFieldInputEvent) { const input = e.target as ObcNumberInputField; - const newValue = input.value; + const newValue = input.displayValue; if (this.validationPattern && newValue) { const regex = new RegExp(this.validationPattern); if (!regex.test(newValue)) { - input.value = this.value; + input.displayOverride = this.value; return; } } if (newValue && !this.isValidValue(newValue)) { - input.value = this.value; + input.displayOverride = this.value; return; } @@ -351,14 +353,15 @@ export class ObcKeyboardNumeric extends LitElement { return html` diff --git a/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.css b/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.css index 516dc56d1..a8c216148 100644 --- a/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.css +++ b/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.css @@ -15,6 +15,11 @@ /* Shared base styles */ @mixin base-input-field-all; +.wrapper.align-center .label-container, +.wrapper.wrapper.align-right .label-container { + align-items: baseline; +} + /* Number input specific: text alignment */ .value-input { text-align: right; @@ -48,11 +53,15 @@ justify-content: center; } +.wrapper .value-input { + text-align: right; + padding: 0; +} + .wrapper.align-center .value-input { - width: auto; - /* Fallback min-width for empty input - not defined in Figma design tokens */ - min-width: 40px; - text-align: center; + width: var(--obc-number-input-center-width, auto); + min-width: var(--obc-number-input-center-width, 40px); + text-align: right; flex: 0 0 auto; } diff --git a/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.spec.ts b/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.spec.ts new file mode 100644 index 000000000..79dced1d5 --- /dev/null +++ b/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.spec.ts @@ -0,0 +1,221 @@ +import {describe, it, expect, beforeEach, vi} from 'vitest'; +import './number-input-field.js'; +import {ObcNumberInputField} from './number-input-field.js'; +import {render} from 'vitest-browser-lit'; +import {html} from 'lit'; + +describe('obc-number-input-field', () => { + let el: ObcNumberInputField; + let input: HTMLInputElement; + + beforeEach(async () => { + const screen = render( + html`` + ); + el = screen.baseElement.querySelector( + 'obc-number-input-field' + ) as ObcNumberInputField; + await el.updateComplete; + input = el.shadowRoot!.querySelector('.value-input') as HTMLInputElement; + }); + + describe('value API', () => { + it('exposes value as a number', () => { + expect(el.value).toBe(10.2); + }); + + it('sets value to parsed number while preserving trailing decimal display', async () => { + input.focus(); + input.value = '10.'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + expect(el.value).toBe(10); + expect(input.value).toBe('10.'); + }); + + it('commits trailing decimal on blur', async () => { + input.focus(); + input.value = '10.'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + input.blur(); + await el.updateComplete; + + expect(el.value).toBe(10); + expect(input.value).toBe('10'); + }); + + it('preserves decimal when editing 10.2 to 10.', async () => { + input.focus(); + input.value = '10.'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + expect(input.value).toBe('10.'); + }); + + it('preserves decimals on blur when maxFractionDigits is undefined', async () => { + input.focus(); + input.value = '123.4512'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + input.blur(); + await el.updateComplete; + + expect(el.value).toBe(123.4512); + expect(input.value).toBe('123.4512'); + }); + }); + + describe('input event', () => { + it('dispatches input with number payload on keystroke', async () => { + const handler = vi.fn(); + el.addEventListener('input', handler); + + input.focus(); + input.value = '12.5'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + expect(handler).toHaveBeenCalledTimes(1); + const event = handler.mock.calls[0][0] as CustomEvent<{value: number}>; + expect(event.detail.value).toBe(12.5); + }); + + it('dispatches input with 10 for trailing decimal input', async () => { + const handler = vi.fn(); + el.addEventListener('input', handler); + + input.focus(); + input.value = '10.'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + expect(handler).toHaveBeenCalledTimes(1); + const event = handler.mock.calls[0][0] as CustomEvent<{value: number}>; + expect(event.detail.value).toBe(10); + }); + }); + + describe('change event', () => { + it('dispatches change on blur when committed value changed', async () => { + const handler = vi.fn(); + el.addEventListener('change', handler); + + input.focus(); + input.value = '12.5'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + input.blur(); + await el.updateComplete; + + expect(handler).toHaveBeenCalledTimes(1); + const event = handler.mock.calls[0][0] as CustomEvent<{value: number}>; + expect(event.detail.value).toBe(12.5); + }); + + it('does not dispatch change on blur when value is unchanged', async () => { + const handler = vi.fn(); + el.addEventListener('change', handler); + + input.focus(); + input.blur(); + await el.updateComplete; + + expect(handler).not.toHaveBeenCalled(); + }); + }); + + describe('rejectUpdatesOnFocus', () => { + beforeEach(async () => { + el.rejectUpdatesOnFocus = true; + await el.updateComplete; + }); + + it('keeps user-typed display when property is set while focused', async () => { + input.focus(); + input.value = '99.9'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + el.value = 12.3; + await el.updateComplete; + + expect(input.value).toBe('99.9'); + }); + }); + + describe('number formatting', () => { + beforeEach(async () => { + el.decimalSeparator = ','; + el.groupSeparator = ' '; + el.minFractionDigits = 2; + el.maxFractionDigits = 2; + el.value = 1234.5; + await el.updateComplete; + }); + + it('formats display when not focused', () => { + expect(input.value).toBe('1 234,50'); + }); + + it('removes grouping on focus', async () => { + input.focus(); + await el.updateComplete; + + expect(input.value).toBe('1234,50'); + }); + + it('shows raw input while focused', async () => { + input.focus(); + input.value = '10.'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + expect(input.value).toBe('10.'); + }); + + it('formats on blur after editing', async () => { + input.focus(); + input.value = '99,9'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + input.blur(); + await el.updateComplete; + + expect(input.value).toBe('99,90'); + expect(el.value).toBe(99.9); + }); + + it('reformats when format properties change without focus', async () => { + el.groupSeparator = "'"; + await el.updateComplete; + + expect(input.value).toBe("1'234,50"); + }); + }); + + describe('rejectDuplicateUpdates', () => { + beforeEach(async () => { + el.rejectDuplicateUpdates = true; + await el.updateComplete; + }); + + it('keeps user-typed display when property is set to same value while focused', async () => { + input.focus(); + input.value = '10.'; + input.dispatchEvent(new InputEvent('input', {bubbles: true})); + await el.updateComplete; + + el.value = 10.2; + await el.updateComplete; + + expect(input.value).toBe('10.'); + }); + }); +}); diff --git a/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.stories.ts b/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.stories.ts index a7f12a7bb..3dfa0f7c8 100644 --- a/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.stories.ts +++ b/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.stories.ts @@ -17,7 +17,7 @@ const meta: Meta = { args: {}, argTypes: { value: { - control: {type: 'text'}, + control: {type: 'number'}, description: 'The current numerical value displayed in the input', }, unit: { @@ -99,7 +99,7 @@ const meta: Meta = { return html`
= { ?hasLabelIcon=${args.hasLabelIcon} .labelPlacement=${args.labelPlacement ?? ObcNumberInputFieldPlacement.Left} + .decimalSeparator=${args.decimalSeparator ?? '.'} + .groupSeparator=${args.groupSeparator ?? ','} + .minFractionDigits=${args.minFractionDigits ?? 0} + .maxFractionDigits=${args.maxFractionDigits ?? undefined} @input=${console.log} @change=${console.log} > @@ -144,14 +148,14 @@ type Story = StoryObj; export const Default: Story = { args: { - value: '123.45', + value: 123.45, unit: 'bar', }, }; export const WithPlaceholder: Story = { args: { - value: '', + value: NaN, unit: 'kg', placeholder: '0.0', }, @@ -159,7 +163,7 @@ export const WithPlaceholder: Story = { export const WithLeadingIcon: Story = { args: { - value: '18.5', + value: 18.5, unit: 'knots', hasLeadingIcon: true, }, @@ -171,7 +175,7 @@ export const WithLeadingIcon: Story = { export const AlignRight: Story = { args: { - value: '456.78', + value: 456.78, unit: 'bar', textAlign: ObcNumberInputFieldTextAlign.Right, }, @@ -179,7 +183,7 @@ export const AlignRight: Story = { export const AlignCenter: Story = { args: { - value: '22.5', + value: 22.5, unit: '°C', textAlign: ObcNumberInputFieldTextAlign.Center, }, @@ -187,19 +191,34 @@ export const AlignCenter: Story = { export const AlignRightUnitOutside: Story = { args: { - value: '1500', + value: 1500, unit: 'RPM', textAlign: ObcNumberInputFieldTextAlign.RightUnitOutside, }, }; +// ============================================================================= +// DECIMAL SEPARATOR +// ============================================================================= + +export const Formatting: Story = { + args: { + value: 12312.45, + unit: 'bar', + decimalSeparator: '.', + groupSeparator: ',', + minFractionDigits: 3, + maxFractionDigits: 3, + }, +}; + // ============================================================================= // SIZE // ============================================================================= export const SizeRegular: Story = { args: { - value: '123.45', + value: 123.45, unit: 'bar', size: ObcNumberInputFieldSize.Regular, }, @@ -207,7 +226,7 @@ export const SizeRegular: Story = { export const SizeLarge: Story = { args: { - value: '123.45', + value: 123.45, unit: 'bar', size: ObcNumberInputFieldSize.Large, }, @@ -219,7 +238,7 @@ export const SizeLarge: Story = { export const WithLabel: Story = { args: { - value: '75', + value: 75, unit: '%', label: 'Engine Load', }, @@ -227,7 +246,7 @@ export const WithLabel: Story = { export const WithLabelRequired: Story = { args: { - value: '', + value: NaN, unit: 'bar', label: 'Oil Pressure', required: true, @@ -236,7 +255,7 @@ export const WithLabelRequired: Story = { export const WithLabelIcon: Story = { args: { - value: '25.5', + value: 25.5, unit: '°C', label: 'Temperature', hasLabelIcon: true, @@ -245,7 +264,7 @@ export const WithLabelIcon: Story = { export const LabelPlacementLeft: Story = { args: { - value: '42', + value: 42, unit: 'kg', label: 'Weight', labelPlacement: ObcNumberInputFieldPlacement.Left, @@ -254,7 +273,7 @@ export const LabelPlacementLeft: Story = { export const LabelPlacementCenter: Story = { args: { - value: '50', + value: 50, unit: '%', label: 'Progress', labelPlacement: ObcNumberInputFieldPlacement.Center, @@ -264,7 +283,7 @@ export const LabelPlacementCenter: Story = { export const LabelPlacementRight: Story = { args: { - value: '42', + value: 42, unit: 'kg', label: 'Weight', labelPlacement: ObcNumberInputFieldPlacement.Right, @@ -277,7 +296,7 @@ export const LabelPlacementRight: Story = { export const WithHelperText: Story = { args: { - value: '3.5', + value: 3.5, unit: 'bar', helperText: 'Normal range: 3.0 - 4.5 bar', }, @@ -285,7 +304,7 @@ export const WithHelperText: Story = { export const WithHelperTextIcon: Story = { args: { - value: '25', + value: 25, unit: '°C', helperText: 'Optimal temperature', hasHelperIcon: true, @@ -294,7 +313,7 @@ export const WithHelperTextIcon: Story = { export const HelperPlacementLeft: Story = { args: { - value: '180', + value: 180, unit: 'cm', helperText: 'Height measurement', helperPlacement: ObcNumberInputFieldPlacement.Left, @@ -303,7 +322,7 @@ export const HelperPlacementLeft: Story = { export const HelperPlacementCenter: Story = { args: { - value: '100', + value: 100, unit: '%', helperText: 'Progress complete', helperPlacement: ObcNumberInputFieldPlacement.Center, @@ -313,7 +332,7 @@ export const HelperPlacementCenter: Story = { export const HelperPlacementRight: Story = { args: { - value: '180', + value: 180, unit: 'cm', helperText: 'Height measurement', helperPlacement: ObcNumberInputFieldPlacement.Right, @@ -326,7 +345,7 @@ export const HelperPlacementRight: Story = { export const Disabled: Story = { args: { - value: '50', + value: 50, unit: '%', label: 'Throttle Position', disabled: true, @@ -335,7 +354,7 @@ export const Disabled: Story = { export const Error: Story = { args: { - value: '999', + value: 999, unit: 'kPa', error: true, errorText: 'Value exceeds maximum limit', @@ -344,7 +363,7 @@ export const Error: Story = { export const ErrorWithLabel: Story = { args: { - value: '', + value: NaN, unit: 'kg', label: 'Weight', required: true, @@ -355,7 +374,7 @@ export const ErrorWithLabel: Story = { export const ErrorWithIcon: Story = { args: { - value: '999', + value: 999, unit: 'kPa', error: true, errorText: 'Value exceeds maximum limit', @@ -369,7 +388,7 @@ export const ErrorWithIcon: Story = { export const Complete: Story = { args: { - value: '85.5', + value: 85.5, unit: 'kW', label: 'Power Output', required: true, @@ -380,7 +399,7 @@ export const Complete: Story = { export const CompleteCenter: Story = { args: { - value: '42', + value: 42, unit: 'Hz', label: 'Frequency', required: true, @@ -394,7 +413,7 @@ export const CompleteCenter: Story = { export const CompleteDisabled: Story = { args: { - value: '100', + value: 100, unit: '%', label: 'System Load', hasLeadingIcon: true, @@ -405,7 +424,7 @@ export const CompleteDisabled: Story = { export const CompleteError: Story = { args: { - value: '150', + value: 150, unit: 'bar', label: 'Pressure Alert', required: true, diff --git a/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.ts b/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.ts index 3eab2bed0..09299b583 100644 --- a/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.ts +++ b/packages/openbridge-webcomponents/src/components/number-input-field/number-input-field.ts @@ -11,6 +11,17 @@ import {ifDefined} from 'lit/directives/if-defined.js'; import componentStyle from './number-input-field.css?inline'; import {classMap} from 'lit/directives/class-map.js'; import {customElement} from '../../decorator.js'; +import { + formatNumberForDisplay, + NumberInputFormatOptions, + parseNumberInput, + removeGroupingFromDisplay, + valuesEqual, +} from './number-input-format.js'; +import {getCssVariableValue} from '../../charthelpers/colors.js'; + +export type ObcNumberInputFieldInputEvent = CustomEvent<{value: number}>; +export type ObcNumberInputFieldChangeEvent = CustomEvent<{value: number}>; export enum ObcNumberInputFieldTextAlign { Center = 'center', @@ -29,17 +40,23 @@ export enum ObcNumberInputFieldPlacement { Right = 'right', } +const characterWidth = 9.15199279785156; +const symbolWidth = 4.287994384765653; +const baseFontSize = 16; /** * `` – A specialized input field for numerical values with optional unit display. * * @slot leading-icon - Icon displayed before the input value (when `hasLeadingIcon` is true) * @slot label-icon - Icon displayed before the label text (when `hasLabelIcon` is true) * @slot helper-icon - Icon displayed before helper or error text (when `hasHelperIcon` is true) - * @fires input - Standard input event on value change + * @fires input {CustomEvent<{value: number}>} When the numeric value changes during editing + * @fires change {CustomEvent<{value: number}>} When the value is committed on blur */ @customElement('obc-number-input-field') export class ObcNumberInputField extends LitElement { - @property({type: String}) value = ''; + private static readonly centerAlignInputMinWidth = 10; + + @property({type: Number}) value = NaN; @property({type: String}) unit = ''; @property({type: String}) placeholder = ''; @property({type: String}) textAlign: ObcNumberInputFieldTextAlign = @@ -87,60 +104,213 @@ export class ObcNumberInputField extends LitElement { /** Internal property for squared corners, used when input is used in stepper-box */ @property({type: Boolean}) squared = false; + /** + * Optional display text override for controlled consumers (e.g. keyboard-numeric) + * that manage formatted strings while the committed value may be NaN. + */ + @property({type: String, attribute: false}) displayOverride = ''; + + @property({type: String}) decimalSeparator?: string; + @property({type: String}) groupSeparator?: string; + @property({type: Number}) minFractionDigits = 0; + @property({type: Number}) maxFractionDigits?: number | undefined; + @state() private hasFocus = false; - @state() private previousValue = ''; - @state() private previousInputElementValue = ''; + @state() private displayText = ''; + @state() private previousValue = NaN; + @state() private previousDisplayText = ''; + @state() private lastCommittedValue = NaN; @query('.value-input') private inputElement?: HTMLInputElement; + get displayValue(): string { + return this.displayText; + } + + private getFormatOptions(): NumberInputFormatOptions { + return { + decimalSeparator: this.decimalSeparator, + groupSeparator: this.groupSeparator, + minFractionDigits: this.minFractionDigits, + maxFractionDigits: this.maxFractionDigits, + }; + } + + private formatValueForDisplay(value: number): string { + return formatNumberForDisplay(value, this.getFormatOptions()); + } + private onInput(e: Event) { - this.value = (e.target as HTMLInputElement).value; - this.previousInputElementValue = this.value; + e.stopPropagation(); + const raw = (e.target as HTMLInputElement).value; + this.displayText = raw; + this.displayOverride = ''; + const parsed = parseNumberInput(raw); + this.value = parsed; + this.previousDisplayText = raw; + this.updateCenterAlignedInputWidth(raw); + this.dispatchInput(); } private onFocus() { this.hasFocus = true; + const source = this.displayOverride || this.displayText; + this.displayText = removeGroupingFromDisplay( + source, + this.getFormatOptions() + ); + this.displayOverride = ''; } private onBlur() { this.hasFocus = false; + this.commitDisplay(); + if (!valuesEqual(this.value, this.lastCommittedValue)) { + this.lastCommittedValue = this.value; + this.dispatchChange(); + } + } + + private commitDisplay() { + const trimmed = this.displayText.trim(); + if (trimmed === '') { + this.value = NaN; + this.displayText = ''; + this.displayOverride = ''; + return; + } + + const forCommit = trimmed.replace(/[.,]$/, ''); + const parsed = parseNumberInput(forCommit); + + if (Number.isFinite(parsed)) { + this.value = parsed; + this.displayText = this.formatValueForDisplay(parsed); + } else { + this.value = NaN; + } + this.displayOverride = ''; + } + + private dispatchInput() { + this.dispatchEvent( + new CustomEvent('input', { + detail: {value: this.value}, + }) + ); + } + + private dispatchChange() { + this.dispatchEvent( + new CustomEvent('change', { + detail: {value: this.value}, + }) + ); } private get shouldUpdateValue(): boolean { if (this.rejectUpdates) return false; if (this.rejectUpdatesOnFocus && this.hasFocus) return false; - if (this.rejectDuplicateUpdates && this.value === this.previousValue) { + if ( + this.rejectDuplicateUpdates && + valuesEqual(this.value, this.previousValue) + ) { return false; } return true; } + private getEffectiveDisplay(): string { + if (this.displayOverride) { + return this.displayOverride; + } + if (!this.shouldUpdateValue && this.inputElement) { + return this.inputElement.value; + } + return this.displayText; + } + + private updateCenterAlignedInputWidth(value: string) { + if (this.textAlign !== ObcNumberInputFieldTextAlign.Center) { + this.style.removeProperty('--obc-number-input-center-width'); + return; + } + + const fontSize = Number.parseFloat( + getCssVariableValue( + this, + '--global-typography-instrument-value-regular-font-size' + ) + ); + + const characters = value.replaceAll(/[.,]/g, ''); + const symbols = value.length - characters.length; + // These values are based on the font size of 16px + + const calculatedWidth = + characters.length * characterWidth + symbols * symbolWidth; + + const measuredWidth = Math.ceil( + (calculatedWidth * fontSize) / baseFontSize + ); + this.style.setProperty( + '--obc-number-input-center-width', + `${measuredWidth}px` + ); + } + + override firstUpdated() { + if (!this.displayText && !this.displayOverride) { + this.displayText = this.formatValueForDisplay(this.value); + } + this.lastCommittedValue = this.value; + this.updateCenterAlignedInputWidth(this.getEffectiveDisplay()); + } + private get isEmpty(): boolean { - const currentValue = - !this.shouldUpdateValue && this.inputElement - ? this.inputElement.value - : this.value; - return currentValue.trim().length === 0; + if (this.inputElement) { + return this.inputElement.value.trim().length === 0; + } + return isNaN(this.value); } override willUpdate(changedProperties: PropertyValues) { + const formatPropsChanged = + changedProperties.has('decimalSeparator') || + changedProperties.has('groupSeparator') || + changedProperties.has('minFractionDigits') || + changedProperties.has('maxFractionDigits'); + + if (changedProperties.has('value') && this.shouldUpdateValue) { + if (!this.hasFocus) { + this.displayText = this.formatValueForDisplay(this.value); + this.displayOverride = ''; + this.lastCommittedValue = this.value; + } + } else if (formatPropsChanged && !this.hasFocus && this.shouldUpdateValue) { + this.displayText = this.formatValueForDisplay(this.value); + this.displayOverride = ''; + } + if ( changedProperties.has('value') && !this.shouldUpdateValue && this.inputElement ) { - this.value = this.inputElement.value; + this.value = parseNumberInput(this.inputElement.value); } } override updated() { if ( this.rejectDuplicateUpdates && - this.value !== this.previousValue && - (this.previousInputElementValue !== this.value || !this.hasFocus) + !valuesEqual(this.value, this.previousValue) && + (this.previousDisplayText !== this.displayText || !this.hasFocus) ) { this.previousValue = this.value; } + + this.updateCenterAlignedInputWidth(this.getEffectiveDisplay()); } private renderFooterText( @@ -162,6 +332,47 @@ export class ObcNumberInputField extends LitElement {
`; } + private onPointerDown(e: PointerEvent) { + if (this.disabled) return; + if (this.readonly) return; + if (this.inputElement) { + e.stopPropagation(); + e.preventDefault(); + this.inputElement.focus(); + const inputBox = this.inputElement.getBoundingClientRect(); + let selectionStart: number | undefined; + if (e.clientX < inputBox.left) { + // set marker at the left edge of the input + selectionStart = 0; + } else if (e.clientX > inputBox.right) { + // set marker at the right edge of the input + selectionStart = this.inputElement.value.length; + } else { + // set marker at the mouse position + // Start from the right side of the input and move left until the mouse position is found + // This is done to set the marker also at label touch. + // Starts from the right since the label is right aligned. + const mouseX = e.clientX; + let inputX = inputBox.right; + const text = this.inputElement.value; + for (let i = text.length - 1; i >= 0; i--) { + const char = text[i]; + const isSymbol = char.match(/[.,]/); + const width = isSymbol ? symbolWidth : characterWidth; + if (mouseX > inputX - width / 2) { + selectionStart = i + 1; + break; + } + inputX -= width; + } + if (selectionStart === undefined) { + selectionStart = 0; + } + } + this.inputElement.setSelectionRange(selectionStart, selectionStart); + } + } + override render() { const hasHelperOrError = Boolean(this.helperText) || Boolean(this.error && this.errorText); @@ -172,11 +383,7 @@ export class ObcNumberInputField extends LitElement { this.unit && this.textAlign === ObcNumberInputFieldTextAlign.RightUnitOutside; - let value = this.value; - - if (!this.shouldUpdateValue && this.inputElement) { - value = this.inputElement.value; - } + const display = this.getEffectiveDisplay(); return html`