discourse/app/assets/javascripts/select-kit/addon/components/combo-box/combo-box-header.js
David Taylor d1cc60c435
DEV: Convert select-kit components to native class syntax (#28489)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-23 12:17:07 +01:00

18 lines
754 B
JavaScript

import { computed } from "@ember/object";
import { and, reads } from "@ember/object/computed";
import { classNames } from "@ember-decorators/component";
import SingleSelectHeaderComponent from "select-kit/components/select-kit/single-select-header";
@classNames("combo-box-header")
export default class ComboBoxHeader extends SingleSelectHeaderComponent {
@reads("selectKit.options.clearable") clearable;
@reads("selectKit.options.caretUpIcon") caretUpIcon;
@reads("selectKit.options.caretDownIcon") caretDownIcon;
@and("clearable", "value") shouldDisplayClearableButton;
@computed("selectKit.isExpanded", "caretUpIcon", "caretDownIcon")
get caretIcon() {
return this.selectKit.isExpanded ? this.caretUpIcon : this.caretDownIcon;
}
}