Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/uui-input/lib/uui-input.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export class UUIInputElement extends FormControlMixin(
var(--uui-input-border-color, var(--uui-color-border));

--uui-button-height: 100%;
--auto-width-text-margin-right: 0;
--auto-width-text-margin-left: 0;
}

#control {
Expand All @@ -75,6 +77,8 @@ export class UUIInputElement extends FormControlMixin(
z-index: -1;
height: 0px;
padding: 0 var(--uui-size-space-3);
margin: 0 var(--auto-width-text-margin-right) 0
var(--auto-width-text-margin-left);
}

:host([auto-width]) #input {
Expand Down Expand Up @@ -407,7 +411,7 @@ export class UUIInputElement extends FormControlMixin(
}

private renderInputWithAutoWidth() {
html`<div id="control">
return html`<div id="control">
${this.renderInput()}${this.renderAutoWidthBackground()}
</div>`;
}
Expand Down
24 changes: 20 additions & 4 deletions packages/uui-input/lib/uui-input.story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export const AutoWidth: Story = {
.name=${props.name}
.placeholder=${props.placeholder}
.value=${props.value}
.autoWidth=${props.autoWidth}>
?auto-width=${props.autoWidth}>
</uui-input>
<br /><br />
<uui-input
Expand All @@ -329,15 +329,31 @@ export const AutoWidth: Story = {
.name=${props.name}
.placeholder=${props.placeholder}
.value=${props.value}
.autoWidth=${props.autoWidth}>
?auto-width=${props.autoWidth}>
<uui-input
slot="prepend"
placeholder="Prepend auto-width"
.autoWidth=${props.autoWidth}></uui-input>
?auto-width=${props.autoWidth}></uui-input>
<uui-input
slot="append"
placeholder="Append auto-width false"></uui-input>
</uui-input>`,
</uui-input>

<br /><br />
<uui-input
.min=${props.min}
.max=${props.max}
.step=${props.step}
.disabled=${props.disabled}
.readonly=${props.readonly}
.error=${props.error}
.label=${props.label}
.type=${props.type}
.name=${props.name}
style="--auto-width-text-margin-right: 50px"
placeholder="--auto-width-text-margin-right: 50px"
.value=${props.value}
?auto-width=${props.autoWidth}></uui-input>`,
args: {
autoWidth: true,
placeholder: 'Start typing...',
Expand Down