discourse/plugins/chat/assets/stylesheets/common
Joffrey JAFFEUX abcdd8d367
DEV: FloatKit (#23312)
This PR introduces three new UI elements to Discourse codebase through an addon called "FloatKit":

- menu
- tooltip
- toast

Simple cases can be express with an API similar to DButton:

```hbs
<DTooltip
  @label={{i18n "foo.bar"}}
  @icon="check"
  @content="Something"
/>
```

More complex cases can use blocks:

```hbs
<DTooltip>
  <:trigger>
   {{d-icon "check"}}
   <span>{{i18n "foo.bar"}}</span>
  </:trigger>
  <:content>
   Something
  </:content>
</DTooltip>
```

You can manually show a tooltip using the `tooltip` service:

```javascript
const tooltipInstance = await this.tooltip.show(
  document.querySelector(".my-span"),
  options
)

// and later manually close or destroy it
tooltipInstance.close();
tooltipInstance.destroy();

// you can also just close any open tooltip through the service
this.tooltip.close();
```

The service also allows you to register event listeners on a trigger, it removes the need for you to manage open/close of a tooltip started through the service:

```javascript
const tooltipInstance = this.tooltip.register(
  document.querySelector(".my-span"),
  options
)

// when done you can destroy the instance to remove the listeners
tooltipInstance.destroy();
```

Note that the service also allows you to use a custom component as content which will receive `@data` and `@close` as args:

```javascript
const tooltipInstance = await this.tooltip.show(
  document.querySelector(".my-span"),
  {
    component: MyComponent,
    data: { foo: 1 }
  }
)
```

Menus are very similar to tooltips and provide the same kind of APIs:

```hbs
<DMenu @icon="plus" @label={{i18n "foo.bar"}}>
  <ul>
    <li>Foo</li>
    <li>Bat</li>
    <li>Baz</li>
  </ul>
</DMenu>
```

They also support blocks:

```hbs
<DMenu>
  <:trigger>
    {{d-icon "plus"}}
    <span>{{i18n "foo.bar"}}</span>
  </:trigger>
  <:content>
    <ul>
      <li>Foo</li>
      <li>Bat</li>
      <li>Baz</li>
    </ul>
  </:content>
</DMenu>
```

You can manually show a menu using the `menu` service:

```javascript
const menuInstance = await this.menu.show(
  document.querySelector(".my-span"),
  options
)

// and later manually close or destroy it
menuInstance.close();
menuInstance.destroy();

// you can also just close any open tooltip through the service
this.menu.close();
```

The service also allows you to register event listeners on a trigger, it removes the need for you to manage open/close of a tooltip started through the service:

```javascript
const menuInstance = this.menu.register(
   document.querySelector(".my-span"),
   options
)

// when done you can destroy the instance to remove the listeners
menuInstance.destroy();
```

Note that the service also allows you to use a custom component as content which will receive `@data` and `@close` as args:

```javascript
const menuInstance = await this.menu.show(
  document.querySelector(".my-span"),
  {
    component: MyComponent,
    data: { foo: 1 }
  }
)
```

Interacting with toasts is made only through the `toasts` service.

A default component is provided (DDefaultToast) and can be used through dedicated service methods:

- this.toasts.success({ ... });
- this.toasts.warning({ ... });
- this.toasts.info({ ... });
- this.toasts.error({ ... });
- this.toasts.default({ ... });

```javascript
this.toasts.success({
  data: {
    title: "Foo",
    message: "Bar",
    actions: [
      {
        label: "Ok",
        class: "btn-primary",
        action: (componentArgs) => {
          // eslint-disable-next-line no-alert
          alert("Closing toast:" + componentArgs.data.title);
          componentArgs.close();
        },
      }
    ]
  },
});
```

You can also provide your own component:

```javascript
this.toasts.show(MyComponent, {
  autoClose: false,
  class: "foo",
  data: { baz: 1 },
})
```

Co-authored-by: Martin Brennan <mjrbrennan@gmail.com>
Co-authored-by: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com>
Co-authored-by: David Taylor <david@taylorhq.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2023-09-12 15:06:51 +02:00
..
base-common.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
chat-browse.scss FIX: followups to composer notch adjustments (#21592) 2023-05-16 20:05:56 +02:00
chat-channel-card.scss UX: lower border radius for channel cards (#22513) 2023-07-10 19:07:01 +02:00
chat-channel-info.scss DEV: makes chat modals use the new <DModal /> component (#22495) 2023-07-10 13:43:33 +02:00
chat-channel-preview-card.scss Remove border radius from chat (#22437) 2023-07-10 15:07:38 +02:00
chat-channel-row.scss UX: implements swipe on row channel (#23436) 2023-09-11 14:51:13 +02:00
chat-channel-settings-saved-indicator.scss FEATURE: channels can allow/disallow @all/@here mentions (#19317) 2022-12-05 17:03:51 +01:00
chat-channel-title.scss FIX: overflow of channel title in preview card (#21112) 2023-04-17 15:05:59 +02:00
chat-channel.scss FEATURE: thread pagination (#22624) 2023-07-27 09:57:03 +02:00
chat-composer-button.scss UX: composer fixes (#23334) 2023-08-30 15:10:21 +02:00
chat-composer-dropdown.scss DEV: FloatKit (#23312) 2023-09-12 15:06:51 +02:00
chat-composer-separator.scss Revert "UX: chat composer (#23267)" (#23273) 2023-08-25 13:49:41 -05:00
chat-composer-upload.scss Remove border radius from chat (#22437) 2023-07-10 15:07:38 +02:00
chat-composer-uploads.scss UX: improves composer and thread panel (#21210) 2023-04-25 10:23:03 +02:00
chat-composer.scss UX: composer fixes (#23334) 2023-08-30 15:10:21 +02:00
chat-drawer.scss FIX: s/--border-radius-large)/--d-border-radius-large (#22587) 2023-07-13 10:17:29 +02:00
chat-emoji-picker.scss Remove border radius from chat (#22437) 2023-07-10 15:07:38 +02:00
chat-form.scss UX: redesign of chat settings + add chat retention info (#19017) 2022-11-16 11:10:42 +01:00
chat-height-mixin.scss FEATURE: new jump to channel menu (#22383) 2023-07-05 18:18:27 +02:00
chat-index.scss UX: implements swipe on row channel (#23436) 2023-09-11 14:51:13 +02:00
chat-mention-warnings.scss FEATURE: Enforce mention limits for chat messages (#19034) 2022-12-06 14:54:04 -03:00
chat-message-actions.scss FIX: Chat message button radius (#23358) 2023-08-31 15:00:39 -05:00
chat-message-collapser.scss FIX: Resize chat collapser when using small width drawer (#21017) 2023-04-08 10:43:17 -03:00
chat-message-creator.scss UX: popping animation for adding users (#23459) 2023-09-07 15:42:49 +02:00
chat-message-error.scss REFACTOR: <ChatMessage> component (#22172) 2023-06-19 09:50:54 +02:00
chat-message-images.scss FIX: ensures generic onebox has width/height for thumbnail (#23040) 2023-08-09 20:31:11 +02:00
chat-message-info.scss Remove border radius from chat (#22437) 2023-07-10 15:07:38 +02:00
chat-message-left-gutter.scss DEV: Fix random typos (#21638) 2023-05-18 15:34:46 +02:00
chat-message-separator.scss Remove border radius from chat (#22437) 2023-07-10 15:07:38 +02:00
chat-message-thread-indicator.scss UI: refines thread list item (#23207) 2023-08-24 18:45:20 +02:00
chat-message.scss DEV: FloatKit (#23312) 2023-09-12 15:06:51 +02:00
chat-modal-archive-channel.scss DEV: makes chat modals use the new <DModal /> component (#22495) 2023-07-10 13:43:33 +02:00
chat-modal-channel-summary.scss DEV: makes chat modals use the new <DModal /> component (#22495) 2023-07-10 13:43:33 +02:00
chat-modal-create-channel.scss DEV: makes chat modals use the new <DModal /> component (#22495) 2023-07-10 13:43:33 +02:00
chat-modal-edit-channel-description.scss DEV: makes chat modals use the new <DModal /> component (#22495) 2023-07-10 13:43:33 +02:00
chat-modal-move-message-to-channel.scss DEV: makes chat modals use the new <DModal /> component (#22495) 2023-07-10 13:43:33 +02:00
chat-modal-new-message.scss DEV: makes chat modals use the new <DModal /> component (#22495) 2023-07-10 13:43:33 +02:00
chat-notices.scss UX: different way of centering chat notice to accommodate longer texts (#22779) 2023-07-27 15:53:43 +02:00
chat-onebox.scss REFACTOR: <ChatMessage> component (#22172) 2023-06-19 09:50:54 +02:00
chat-reply.scss UX: Fix chat-reply overflow (#20592) 2023-03-08 21:12:49 +01:00
chat-replying-indicator.scss FEATURE: new jump to channel menu (#22383) 2023-07-05 18:18:27 +02:00
chat-scroll-to-bottom.scss FEATURE: thread pagination (#22624) 2023-07-27 09:57:03 +02:00
chat-section.scss FEATURE: new jump to channel menu (#22383) 2023-07-05 18:18:27 +02:00
chat-selection-manager.scss FIX: allows selection of messages in threads (#22119) 2023-06-15 11:27:31 +02:00
chat-side-panel-resizer.scss UX: lower z-index (#23386) 2023-09-04 22:30:51 +02:00
chat-side-panel.scss FIX: ensures chat-thread is not overflowing (#21782) 2023-05-29 09:55:50 +02:00
chat-skeleton.scss FEATURE: thread pagination (#22624) 2023-07-27 09:57:03 +02:00
chat-tabs.scss FIX: followups to composer notch adjustments (#21592) 2023-05-16 20:05:56 +02:00
chat-thread-header-buttons.scss Remove border radius from chat (#22437) 2023-07-10 15:07:38 +02:00
chat-thread-header.scss FEATURE: Conditionally change back button route for thread (#22129) 2023-06-28 09:58:47 +10:00
chat-thread-list-header.scss REFACTOR: composer/thread (#21910) 2023-06-07 21:49:15 +02:00
chat-thread-list-item.scss UX: thread list design changes (#23348) 2023-08-31 18:09:41 +02:00
chat-thread-participants.scss UX: thread list design changes (#23348) 2023-08-31 18:09:41 +02:00
chat-thread-unread-indicator.scss UX: Chat unread indicator refactor (#22040) 2023-06-12 14:33:45 +10:00
chat-thread.scss FEATURE: thread pagination (#22624) 2023-07-27 09:57:03 +02:00
chat-threads-list.scss FEATURE: Improving thread list item and header (#21749) 2023-05-29 09:11:55 +02:00
chat-transcript.scss REFACTOR: <ChatMessage> component (#22172) 2023-06-19 09:50:54 +02:00
chat-unread-indicator.scss UX: Chat unread indicator refactor (#22040) 2023-06-12 14:33:45 +10:00
chat-upload-drop-zone.scss UX: improves composer and thread panel (#21210) 2023-04-25 10:23:03 +02:00
chat-user-avatar.scss FIX: makes chat user avatar show presence by default (#22490) 2023-07-10 09:36:20 +02:00
core-extensions.scss UX: Remove 'Create Topics' notice (#21958) 2023-06-08 22:30:26 +03:00
dc-filter-input.scss
direct-message-creator.scss Remove border radius from chat (#22437) 2023-07-10 15:07:38 +02:00
full-page-chat-header.scss
incoming-chat-webhooks.scss Remove border radius from chat (#22437) 2023-07-10 15:07:38 +02:00
index.scss UX: implements swipe on row channel (#23436) 2023-09-11 14:51:13 +02:00
reviewable-chat-message.scss
sidebar-extensions.scss FEATURE: new jump to channel menu (#22383) 2023-07-05 18:18:27 +02:00