Skip to content

Commit

Permalink
fix: eui-combo-box
Browse files Browse the repository at this point in the history
  • Loading branch information
betocantu93 committed Feb 8, 2025
1 parent aecc0c8 commit eda4470
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 33 deletions.
1 change: 1 addition & 0 deletions packages/core/src/components/eui-combo-box.gts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { isArray } from '@ember/array';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { isEqual } from '@ember/utils';
import 'ember-basic-dropdown/styles';

import optional from 'ember-composable-helpers/helpers/optional';
import pipe from 'ember-composable-helpers/helpers/pipe';
Expand Down
29 changes: 2 additions & 27 deletions packages/core/src/components/eui-combo-box/options.gts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { isArray as isEmberArray } from '@ember/array';
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
import willDestroy from '@ember/render-modifiers/modifiers/will-destroy';
import { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/template';
import { isEqual } from '@ember/utils';
import { EnsureSafeComponentHelper } from '@embroider/util';

//@ts-expect-error
Expand All @@ -21,27 +19,7 @@ import EuiLoadingSpinner from '../eui-loading-spinner.gts';
import EuiText from '../eui-text.gts';

import type EuiConfigService from '../../services/eui-config';


//This was extracted from ember-power-select v7.2.0, becuase it was removed in v8.0.0... or renamed to ember-power-select-
function emberPowerSelectIsSelected([option, selected]: [any, any[]]/* , hash*/): boolean {
if (selected === undefined || selected === null) {
return false;
}

if (isEmberArray(selected)) {
for (let i = 0; i < selected.length; i++) {
if (isEqual(selected[i], option)) {
return true;
}
}

return false;
} else {
return isEqual(option, selected);
}
}

import emberPowerSelectIsEqual from 'ember-power-select/helpers/ember-power-select-is-equal';

export default class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions {
@service declare euiConfig: EuiConfigService;
Expand Down Expand Up @@ -143,10 +121,7 @@ export default class EuiComboBoxOptionsComponent extends EmberPowerSelectOptions
(eq opt @select.highlighted)
' euiFilterSelectItem-isFocused'
}}"
aria-selected="{{emberPowerSelectIsSelected
opt
@select.selected
}}"
aria-selected="{{emberPowerSelectIsEqual opt @select.selected}}"
aria-disabled={{if opt.disabled "true"}}
aria-current="{{eq opt @select.highlighted}}"
data-option-index="{{index}}"
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/components/eui-combo-box/trigger.gts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export default class EuiComboBoxTriggerComponent extends EmberPowerSelectMultipl
{{this.maybePlaceholder}}
</p>
{{/if}}

{{#let
(component
EuiComboBoxTriggerInput
Expand Down Expand Up @@ -127,7 +126,7 @@ export default class EuiComboBoxTriggerComponent extends EmberPowerSelectMultipl
(EnsureSafeComponentHelper @placeholderComponent)
select=@select
placeholder=@placeholder
isMutlipleWithSearch=true
isMultipleWithSearch=true
inputComponent=InputComponent
displayPlaceholder=(and
(not @select.searchText) (not @select.selected)
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/components/eui-combo-box/trigger/input.gts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { on } from '@ember/modifier';
import { action } from '@ember/object';
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
import { scheduleOnce } from '@ember/runloop';
import { htmlSafe } from '@ember/template';
import { isBlank } from '@ember/utils';
Expand Down Expand Up @@ -103,16 +102,13 @@ export default class EuiComboBoxTriggerInputComponent extends EmberPowerSelectPo
id="ember-power-select-trigger-multiple-input-{{@select.uniqueId}}"
value={{@select.searchText}}
aria-controls={{@listboxId}}
style={{this.triggerMultipleInputStyle}}
disabled={{@select.disabled}}
tabindex={{@tabindex}}
form="power-select-fake-form"
{{on "focus" @onFocus}}
{{on "blur" @onBlur}}
{{on "input" this.handleInput}}
{{on "keydown" this.handleKeydown}}
{{!@glint-expect-error}}
{{didInsert this.storeInputStyles}}
/>
</div>
</template>
Expand Down

0 comments on commit eda4470

Please sign in to comment.