${label}
${type === "text" ? $input : ""}
`;
}
-function Input({ wide, transparent, icon, onrerender, ...props }) {
+function Input({ size, icon, transparent, onrerender, ...props }) {
const { html } = globalThis.__enhancerApi,
$input = html`
`,
$icon = html`
`;
useState(["rerender"], () => onrerender?.($input, $icon));
return html`
`;
}
@@ -255,7 +295,7 @@ function Input({ wide, transparent, icon, onrerender, ...props }) {
function TextInput({ _get, _set, onchange, ...props }) {
const { html } = globalThis.__enhancerApi;
return html`<${Input}
- wide
+ size="md"
type="text"
icon="text-cursor"
onchange=${(event) => {
@@ -272,6 +312,7 @@ function TextInput({ _get, _set, onchange, ...props }) {
function NumberInput({ _get, _set, onchange, ...props }) {
const { html } = globalThis.__enhancerApi;
return html`<${Input}
+ size="sm"
type="number"
icon="hash"
onchange=${(event) => {
@@ -314,6 +355,7 @@ function HotkeyInput({ _get, _set, onkeydown, ...props }) {
event.target.dispatchEvent(new Event("change"));
};
return html`<${Input}
+ size="sm"
type="text"
icon="command"
onkeydown=${(event) => {
@@ -349,6 +391,7 @@ function ColorInput({ _get, _set, oninput, ...props }) {
};
return html`<${Input}
transparent
+ size="sm"
type="text"
icon="pipette"
data-coloris
@@ -439,6 +482,9 @@ function Select({ values, _get, _set, ...props }) {
transition duration-[20ms] hover:bg-[color:var(--theme--bg-hover)]"
...${props}
>
`,
+ $options = values.map((value) => {
+ return html`<${SelectOption} ...${{ value, _get, _set }} />`;
+ }),
$popup = html`
- ${values.map((value) => {
- return html`<${SelectOption} ...${{ value, _get, _set }} />`;
- })}
+ ${$options}