Skip to content

Commit 07a9b20

Browse files
committed
Fix: Revert search and dismiss features in dropdown
1 parent 0f1e82e commit 07a9b20

File tree

3 files changed

+1
-114
lines changed

3 files changed

+1
-114
lines changed

packages/components/src/components/hds/dropdown/index.hbs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
SPDX-License-Identifier: MPL-2.0
44
}}
55
<Hds::PopoverPrimitive @isOpen={{@isOpen}} @onClose={{@onClose}} @enableClickEvents={{true}} as |PP|>
6-
<div class={{this.classNames}} ...attributes {{PP.setupPrimitiveContainer}} {{this._setUpDropdown}}>
7-
{{#if this.onDismiss}}
8-
<button class="hds-dropdown__dismiss" type="button" {{on "click" this.onDismiss}}>
9-
<Hds::Icon class="hds-tag__dismiss-icon" @name="x" @size="16" />
10-
</button>
11-
{{/if}}
6+
<div class={{this.classNames}} ...attributes {{PP.setupPrimitiveContainer}}>
127
{{yield
138
(hash
149
ToggleButton=(component
@@ -26,15 +21,6 @@
2621
>
2722
{{#if (or PP.isOpen @preserveContentInDom)}}
2823
{{yield (hash Header=(component "hds/dropdown/header") close=PP.hidePopover)}}
29-
{{#if @searchEnabled}}
30-
<div class="hds-dropdown__search">
31-
<Hds::Form::TextInput::Base
32-
@type="search"
33-
placeholder={{if @searchPlaceholder @searchPlaceholder "Search"}}
34-
{{on "input" this.onSearch}}
35-
/>
36-
</div>
37-
{{/if}}
3824
<ul class="hds-dropdown__list" {{did-insert this.didInsertList}}>
3925
{{yield
4026
(hash

packages/components/src/components/hds/dropdown/index.ts

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import Component from '@glimmer/component';
77
import { action } from '@ember/object';
88
import { assert } from '@ember/debug';
9-
import { modifier } from 'ember-modifier';
109

1110
import {
1211
// map Dropdown's `listPosition` values to PopoverPrimitive's `placement` values
@@ -49,10 +48,6 @@ export interface HdsDropdownSignature {
4948
enableCollisionDetection?: HdsAnchoredPositionOptions['enableCollisionDetection'];
5049
preserveContentInDom?: boolean;
5150
matchToggleWidth?: boolean;
52-
searchEnabled?: boolean;
53-
searchPlaceholder?: string;
54-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
55-
onDismiss?: (event: MouseEvent, ...args: any[]) => void;
5651
};
5752
Blocks: {
5853
default: [
@@ -78,14 +73,6 @@ export interface HdsDropdownSignature {
7873
}
7974

8075
export default class HdsDropdown extends Component<HdsDropdownSignature> {
81-
private _element!: HTMLDivElement;
82-
83-
private _setUpDropdown = modifier((element: HTMLDivElement) => {
84-
this._element = element;
85-
86-
return () => {};
87-
});
88-
8976
/**
9077
* @param listPosition
9178
* @type {string}
@@ -129,17 +116,6 @@ export default class HdsDropdown extends Component<HdsDropdownSignature> {
129116
};
130117
}
131118

132-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
133-
get onDismiss(): ((event: MouseEvent, ...args: any[]) => void) | false {
134-
const { onDismiss } = this.args;
135-
136-
if (typeof onDismiss === 'function') {
137-
return onDismiss;
138-
} else {
139-
return false;
140-
}
141-
}
142-
143119
/**
144120
* Get the class names to apply to the element
145121
* @method classNames
@@ -153,10 +129,6 @@ export default class HdsDropdown extends Component<HdsDropdownSignature> {
153129
classes.push('hds-dropdown--is-inline');
154130
}
155131

156-
if (this.args.onDismiss) {
157-
classes.push('hds-dropdown--has-dismiss');
158-
}
159-
160132
return classes.join(' ');
161133
}
162134

@@ -197,20 +169,4 @@ export default class HdsDropdown extends Component<HdsDropdownSignature> {
197169
}
198170
}
199171
}
200-
201-
onSearch = (event: Event) => {
202-
const listItems = this._element.querySelectorAll('.hds-dropdown-list-item') as NodeListOf<HTMLLIElement>;
203-
const input = event.target as HTMLInputElement;
204-
listItems.forEach((item) => {
205-
if (item.textContent) {
206-
const text = item.textContent.toLowerCase();
207-
const searchText = input.value.toLowerCase();
208-
if (text.includes(searchText)) {
209-
item.style.display = '';
210-
} else {
211-
item.style.display = 'none';
212-
}
213-
}
214-
});
215-
};
216172
}

packages/components/src/styles/components/dropdown.scss

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -602,58 +602,3 @@ $hds-dropdown-toggle-border-radius: $hds-button-border-radius;
602602
vertical-align: bottom;
603603
}
604604
}
605-
606-
// SEARCH
607-
608-
.hds-dropdown__search {
609-
flex: none;
610-
padding: 8px;
611-
border-bottom: 1px solid var(--token-color-border-primary);
612-
}
613-
614-
// DISMISS BUTTON
615-
.hds-dropdown__dismiss {
616-
color: var(--token-color-foreground-primary);
617-
background-color: var(--token-color-surface-faint);
618-
border: 1px solid var(--token-color-border-strong);
619-
border-right: none;
620-
border-radius: var(--token-border-radius-small) 0 0 var(--token-border-radius-small);
621-
622-
&:hover,
623-
&.mock-hover {
624-
background-color: var(--token-color-surface-interactive);
625-
cursor: pointer;
626-
}
627-
628-
&:focus,
629-
&.mock-focus {
630-
@include hds-button-state-focus();
631-
border-color: var(--token-color-focus-action-internal);
632-
633-
&::before {
634-
border-color: var(--token-color-focus-action-external);
635-
}
636-
}
637-
638-
&:active,
639-
&.mock-active {
640-
background-color: var(--token-color-surface-interactive-active);
641-
border-color: var(--token-color-border-strong);
642-
643-
&::before {
644-
border-color: transparent;
645-
}
646-
}
647-
}
648-
649-
.hds-dropdown--has-dismiss {
650-
display: flex;
651-
652-
.hds-dropdown-toggle-button {
653-
border-left: none;
654-
655-
border-top-left-radius: 0;
656-
border-bottom-left-radius: 0;
657-
box-shadow: none;
658-
}
659-
}

0 commit comments

Comments
 (0)