more work on input box styles

This commit is contained in:
Jakob Pinterits
2024-09-26 23:03:26 +02:00
parent 95185e4cd1
commit 73d0958db9
2 changed files with 18 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import { markEventAsHandled, stopPropagation } from "./eventHandling";
import { createUniqueId } from "./utils";
export type InputBoxStyle = "rectangular" | "pill";
/// A text input field providing the following features and more:
///
@@ -33,7 +34,10 @@ export class InputBox {
connectClickHandlers?: boolean;
} = {}) {
this.outerElement = document.createElement("div");
this.outerElement.classList.add("rio-input-box");
this.outerElement.classList.add(
"rio-input-box",
"rio-input-box-style-rectangular"
);
this.outerElement.innerHTML = `
<div class="rio-input-box-padding"></div>
@@ -229,6 +233,15 @@ export class InputBox {
}
}
set style(style: InputBoxStyle) {
this.outerElement.classList.remove(
"rio-input-box-style-rectangular",
"rio-input-box-style-pill"
);
this.outerElement.classList.add(`rio-input-box-style-${style}`);
}
get isSensitive(): boolean {
return !this._inputElement.disabled;
}