discourse/app/assets/stylesheets/common/components/_index.scss
Joffrey JAFFEUX cbc0ece6e8
DEV: <DSelect /> (#30224)
`<DSelect />` is a wrapper similar to our existing `<DButton />` over the html element `<select>`. The code is ported from form kit which is now directly using `<DSelect />`. Note this component has also been used in edit topic timer modal.

This component is recommended for a small list of text items (no icons, no rich formatting...).

Usage:

```gjs
<DSelect class="my-select" @onChange={{this.handleChange}} as |select|>
  <select.Option @value="foo" class="my-favorite-option">Foo</select.Option>
  <select.Option @value="bar">Bar</select.Option>
</DSelect>
```

This commit comes with a set of assertions:

```gjs
import dselect from "discourse/tests/helpers/d-select-helper";
import { select } from "@ember/test-helpers";

assert
  .dselect(".my-select")
  .hasOption({ value: "bar", label: "Bar" })
  .hasOption({ value: "foo", label: "Foo" })
  .hasNoOption("baz");

await select(".my-select", "foo");

assert.dselect(".my-select").hasSelectedOption({value: "foo", label: "Foo"});
```
2024-12-13 10:40:06 +01:00

58 lines
1.5 KiB
SCSS

@import "badges";
@import "banner";
@import "d-breadcrumbs";
@import "d-stat-tiles";
@import "bookmark-list";
@import "bookmark-modal";
@import "bookmark-menu";
@import "buttons";
@import "d-select";
@import "color-input";
@import "char-counter";
@import "conditional-loading-section";
@import "calendar-date-time-input";
@import "convert-to-public-topic-modal";
@import "d-lightbox";
@import "d-toggle-switch";
@import "date-input";
@import "date-picker";
@import "date-time-input-range";
@import "date-time-input";
@import "file-size-input";
@import "footer-nav";
@import "form-template-field";
@import "group-member-dropdown";
@import "groups-form-membership-fields";
@import "hashtag";
@import "horizontal-overflow-nav";
@import "iframed-html";
@import "ignored-user-list";
@import "keyboard_shortcuts";
@import "more-topics";
@import "navs";
@import "offline-indicator";
@import "pick-files-button";
@import "powered-by-discourse";
@import "relative-time-picker";
@import "add-pm-participants";
@import "download-calendar";
@import "sidebar/edit-navigation-menu/categories-modal";
@import "sidebar/edit-navigation-menu/modal";
@import "sidebar/edit-navigation-menu/tags-modal";
@import "signup-progress-bar";
@import "svg";
@import "tap-tile";
@import "theme-card";
@import "time-input";
@import "time-shortcut-picker";
@import "topic-map";
@import "topic-query-filter";
@import "user-card";
@import "user-info";
@import "user-status-message";
@import "user-status-picker";
@import "user-stream-item";
@import "user-stream";
@import "widget-dropdown";
@import "welcome-header";