Skip to content

Commit

Permalink
Combobox component updates (#2369)
Browse files Browse the repository at this point in the history
* Revert to previous padding

* Remove buttons from Combobox

* Account for border in input height

* Remove unnecessary Icon class

* Add data-1p-ignore to inputs
  • Loading branch information
laurakwhit authored Oct 4, 2024
1 parent 11742db commit 7757a34
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 37 deletions.
1 change: 0 additions & 1 deletion src/lib/components/search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
{name}
{value}
{placeholder}
autocomplete="off"
data-testid={`${testId}-input`}
on:input
>
Expand Down
40 changes: 4 additions & 36 deletions src/lib/holocene/combobox/combobox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import Menu from '$lib/holocene/menu/menu.svelte';
import Badge from '../badge.svelte';
import Button from '../button.svelte';
import Chip from '../chip.svelte';
import type { IconName } from '../icon';
import Icon from '../icon/icon.svelte';
Expand Down Expand Up @@ -145,14 +144,6 @@
displayValue = getDisplayValue(selectedOption);
}
const toggleList = () => {
if ($open) {
closeList();
} else {
openList();
}
};
const openList = () => {
$open = true;
inputElement.focus();
Expand Down Expand Up @@ -348,7 +339,7 @@

<div class="combobox-wrapper" class:disabled class:invalid={!valid}>
{#if leadingIcon}
<Icon width={20} height={20} class="ml-2 shrink-0" name={leadingIcon} />
<Icon width={20} height={20} class="ml-2" name={leadingIcon} />
{/if}
<div
class="input-wrapper"
Expand Down Expand Up @@ -385,6 +376,7 @@
autocapitalize="off"
spellcheck="false"
data-lpignore="true"
data-1p-ignore="true"
aria-controls="{id}-listbox"
aria-expanded={$open}
aria-required={required}
Expand All @@ -398,32 +390,8 @@
{...$$restProps}
/>
</div>
{#if multiselect && isArrayValue(value) && value.length > 0}
<Button
aria-label={deselectAllLabel}
tabindex={-1}
variant="ghost"
size="xs"
on:click={deselectAll}
{disabled}
>
<Icon name="close" />
</Button>
{/if}
<Button
aria-label={toggleLabel}
tabindex={-1}
aria-controls="{id}-listbox"
aria-expanded={$open}
variant="ghost"
size="xs"
on:click={toggleList}
{disabled}
>
<Icon name={$open ? 'chevron-up' : 'chevron-down'} />
</Button>
{#if $$slots.action}
<div class="ml-1 flex h-full items-center border-l-2 border-subtle p-1">
<div class="ml-1 flex h-full items-center border-l-2 border-subtle p-0.5">
<slot name="action" />
</div>
{/if}
Expand Down Expand Up @@ -490,6 +458,6 @@
}
.combobox-input {
@apply flex h-10 grow bg-transparent text-primary placeholder:text-secondary focus:outline-none;
@apply flex h-9 grow bg-transparent text-primary placeholder:text-secondary focus:outline-none;
}
</style>
1 change: 1 addition & 0 deletions src/lib/holocene/input/chip-input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
{/if}
<input
data-lpignore="true"
data-1p-ignore="true"
autocomplete="off"
class:cursor-not-allowed={disabled}
{disabled}
Expand Down
1 change: 1 addition & 0 deletions src/lib/holocene/input/input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
class:disabled
{disabled}
data-lpignore="true"
data-1p-ignore="true"
maxlength={maxLength > 0 ? maxLength : undefined}
{placeholder}
{id}
Expand Down
1 change: 1 addition & 0 deletions src/lib/holocene/input/number-input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
{min}
{disabled}
data-lpignore="true"
data-1p-ignore="true"
{placeholder}
{id}
{name}
Expand Down

0 comments on commit 7757a34

Please sign in to comment.