2022-06-29 10:49:01 +08:00
|
|
|
:root {
|
2022-07-20 10:56:41 +08:00
|
|
|
--d-sidebar-width: #{$d-sidebar-width};
|
2023-02-14 06:51:42 +08:00
|
|
|
@include breakpoint(large) {
|
|
|
|
--d-sidebar-width: #{$d-sidebar-narrow-width};
|
|
|
|
}
|
2022-07-07 01:31:06 +08:00
|
|
|
--d-sidebar-animation-time: 0.25s;
|
|
|
|
--d-sidebar-animation-ease: ease-in-out;
|
2022-09-29 12:28:01 +08:00
|
|
|
// 1.25rem gets text left-aligned with the hamburger icon
|
|
|
|
--d-sidebar-row-horizontal-padding: 1.25rem;
|
2023-05-24 23:00:20 +08:00
|
|
|
// ems so height is variable along with font size
|
2023-05-25 23:21:30 +08:00
|
|
|
--d-sidebar-row-height: 2.1em;
|
2023-06-06 21:24:56 +08:00
|
|
|
|
|
|
|
--d-sidebar-background: var(--secondary);
|
|
|
|
--d-sidebar-prefix-background: var(
|
|
|
|
--primary-low
|
|
|
|
); // example: chat participant count
|
|
|
|
|
|
|
|
--d-sidebar-header-color: var(--primary);
|
|
|
|
--d-sidebar-header-icon-color: var(--primary-medium);
|
|
|
|
|
|
|
|
--d-sidebar-link-color: var(--primary-high);
|
|
|
|
--d-sidebar-link-icon-color: var(--primary-500);
|
|
|
|
--d-sidebar-link-badge-color: var(--primary-700); // example: new count
|
|
|
|
|
|
|
|
--d-sidebar-highlight-background: var(--primary-low);
|
|
|
|
--d-sidebar-highlight-color: var(--primary-high);
|
|
|
|
--d-sidebar-highlight-prefix-background: var(--primary-300);
|
|
|
|
--d-sidebar-highlight-hover-background: var(
|
|
|
|
--primary-medium
|
|
|
|
); // example: hovering a button within a highlighted section
|
|
|
|
--d-sidebar-highlight-hover-icon: var(
|
|
|
|
--primary-very-low
|
|
|
|
); // example: hovering a button within a highlighted section
|
2022-09-29 12:28:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar-row {
|
|
|
|
box-sizing: border-box;
|
|
|
|
height: var(--d-sidebar-row-height);
|
2023-05-24 23:00:20 +08:00
|
|
|
padding: 0 var(--d-sidebar-row-horizontal-padding);
|
2022-09-29 12:28:01 +08:00
|
|
|
align-items: center;
|
2022-06-29 10:49:01 +08:00
|
|
|
}
|
|
|
|
|
2022-08-18 15:03:28 +08:00
|
|
|
.sidebar-wrapper {
|
2022-08-25 01:26:25 +08:00
|
|
|
display: flex;
|
2022-08-18 15:03:28 +08:00
|
|
|
grid-area: sidebar;
|
|
|
|
position: sticky;
|
|
|
|
top: var(--header-offset);
|
2023-06-06 21:24:56 +08:00
|
|
|
background: var(--d-sidebar-background);
|
2022-08-24 09:33:15 +08:00
|
|
|
|
2023-03-31 06:28:22 +08:00
|
|
|
@include unselectable;
|
2023-03-29 11:32:28 +08:00
|
|
|
|
2023-05-15 17:46:33 +08:00
|
|
|
// 1dvh with fallback for old browsers
|
|
|
|
--1dvh: 1vh;
|
|
|
|
@supports (height: 1dvh) {
|
|
|
|
--1dvh: 1dvh;
|
2023-04-27 23:31:09 +08:00
|
|
|
}
|
|
|
|
|
2023-05-15 17:46:33 +08:00
|
|
|
height: calc(
|
|
|
|
var(--composer-vh, var(--1dvh)) * 100 - var(--header-offset, 0px)
|
|
|
|
);
|
2023-04-27 23:31:09 +08:00
|
|
|
|
2022-08-18 15:03:28 +08:00
|
|
|
align-self: start;
|
|
|
|
overflow-y: auto;
|
|
|
|
|
2022-05-05 14:35:08 +08:00
|
|
|
.sidebar-container {
|
2022-07-22 13:06:47 +08:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2022-05-05 14:35:08 +08:00
|
|
|
box-sizing: border-box;
|
|
|
|
height: 100%;
|
2022-08-25 01:26:25 +08:00
|
|
|
width: 100%;
|
2022-08-24 09:33:15 +08:00
|
|
|
padding: 0;
|
2023-06-06 21:24:56 +08:00
|
|
|
border-right: 1px solid var(--primary-low);
|
2022-07-01 04:14:29 +08:00
|
|
|
overflow-x: hidden;
|
2022-08-25 01:26:25 +08:00
|
|
|
// allows sidebar to scroll to the bottom when the composer is open
|
2023-03-21 04:06:49 +08:00
|
|
|
height: calc(100% - var(--composer-height, 0px));
|
2022-08-19 10:51:55 +08:00
|
|
|
}
|
|
|
|
|
2022-08-25 01:26:25 +08:00
|
|
|
.sidebar-sections {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
box-sizing: border-box;
|
|
|
|
flex: 1;
|
2023-05-24 23:00:20 +08:00
|
|
|
padding: 1.35em 0 1em;
|
2022-08-19 10:51:55 +08:00
|
|
|
overflow-x: hidden;
|
|
|
|
overflow-y: overlay;
|
2022-07-01 04:14:29 +08:00
|
|
|
|
|
|
|
// custom scrollbar styling
|
|
|
|
--scrollbarBg: transparent;
|
|
|
|
--scrollbarThumbBg: var(--primary-low);
|
2022-08-25 03:46:01 +08:00
|
|
|
--scrollbarWidth: 0.5em;
|
2022-07-01 04:14:29 +08:00
|
|
|
|
|
|
|
scrollbar-color: transparent var(--scrollbarBg);
|
2022-07-12 00:58:48 +08:00
|
|
|
transition: scrollbar-color 0.25s ease-in-out;
|
|
|
|
transition-delay: 0.5s;
|
|
|
|
|
2022-08-25 03:46:01 +08:00
|
|
|
&::-webkit-scrollbar {
|
|
|
|
width: var(--scrollbarWidth);
|
|
|
|
}
|
|
|
|
|
2022-07-01 04:14:29 +08:00
|
|
|
&::-webkit-scrollbar-thumb {
|
|
|
|
background-color: transparent;
|
|
|
|
border-radius: calc(var(--scrollbarWidth) / 2);
|
2022-08-24 09:33:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&::-webkit-scrollbar-track {
|
|
|
|
background-color: transparent;
|
2022-07-01 04:14:29 +08:00
|
|
|
}
|
2022-08-18 15:03:28 +08:00
|
|
|
|
2022-07-01 04:14:29 +08:00
|
|
|
&:hover {
|
|
|
|
scrollbar-color: var(--scrollbarThumbBg) var(--scrollbarBg);
|
2022-08-19 10:51:55 +08:00
|
|
|
|
2022-07-01 04:14:29 +08:00
|
|
|
&::-webkit-scrollbar-thumb {
|
|
|
|
background-color: var(--scrollbarThumbBg);
|
|
|
|
}
|
2022-08-19 10:51:55 +08:00
|
|
|
|
2022-07-12 00:58:48 +08:00
|
|
|
transition-delay: 0s;
|
2022-07-01 04:14:29 +08:00
|
|
|
}
|
2022-08-24 09:33:15 +08:00
|
|
|
}
|
2023-02-08 08:45:34 +08:00
|
|
|
.sidebar-footer-wrapper {
|
|
|
|
.btn-flat.add-section {
|
|
|
|
padding: 0.25em 0.4em;
|
|
|
|
&:hover {
|
2023-06-06 21:24:56 +08:00
|
|
|
background: var(--d-sidebar-highlight-background);
|
2023-02-08 08:45:34 +08:00
|
|
|
svg {
|
2023-06-06 21:24:56 +08:00
|
|
|
color: var(--d-sidebar-link-icon-color);
|
2023-02-08 08:45:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-24 09:33:15 +08:00
|
|
|
}
|
2023-07-11 09:40:37 +08:00
|
|
|
|
2023-02-03 11:44:40 +08:00
|
|
|
.sidebar-section-form-modal {
|
2023-05-29 13:20:23 +08:00
|
|
|
.draggable {
|
2023-06-01 10:37:28 +08:00
|
|
|
display: flex;
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
color: var(--primary-medium);
|
2023-05-29 13:20:23 +08:00
|
|
|
align-self: center;
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: auto;
|
2023-06-01 10:37:28 +08:00
|
|
|
cursor: move;
|
2023-05-29 13:20:23 +08:00
|
|
|
-webkit-user-drag: element;
|
|
|
|
user-drag: element;
|
|
|
|
}
|
|
|
|
.dragging {
|
|
|
|
opacity: 0.4;
|
|
|
|
}
|
2023-02-03 11:44:40 +08:00
|
|
|
.modal-inner-container {
|
|
|
|
width: var(--modal-max-width);
|
|
|
|
}
|
2023-02-08 08:45:34 +08:00
|
|
|
form {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
2023-02-22 05:55:44 +08:00
|
|
|
.input-group input {
|
2023-02-03 11:44:40 +08:00
|
|
|
width: 100%;
|
2023-06-01 10:37:28 +08:00
|
|
|
margin-bottom: 0;
|
2023-02-03 11:44:40 +08:00
|
|
|
}
|
|
|
|
input.warning {
|
|
|
|
border: 1px solid var(--danger);
|
|
|
|
}
|
2023-07-13 01:57:11 +08:00
|
|
|
.icon.warning,
|
2023-06-01 10:37:28 +08:00
|
|
|
.value.warning {
|
|
|
|
position: absolute;
|
|
|
|
}
|
2023-07-11 09:40:37 +08:00
|
|
|
.sidebar-section-form__input-wrapper {
|
|
|
|
margin-bottom: 1em;
|
|
|
|
|
|
|
|
input {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-03 11:44:40 +08:00
|
|
|
.row-wrapper {
|
|
|
|
display: grid;
|
2023-06-01 10:37:28 +08:00
|
|
|
grid-template-columns: 2em 4.5em repeat(2, 1fr) 2em;
|
|
|
|
padding: 0.55em 0 0.7em;
|
2023-05-29 13:20:23 +08:00
|
|
|
-webkit-user-drag: none;
|
|
|
|
user-drag: none;
|
|
|
|
cursor: default;
|
2023-06-01 10:37:28 +08:00
|
|
|
border-top: 2px solid transparent;
|
|
|
|
border-bottom: 2px solid transparent;
|
|
|
|
margin-bottom: -2px;
|
2023-07-11 09:40:37 +08:00
|
|
|
|
2023-05-29 13:20:23 +08:00
|
|
|
&.header {
|
|
|
|
padding-bottom: 0;
|
2023-07-11 09:40:37 +08:00
|
|
|
|
2023-05-29 13:20:23 +08:00
|
|
|
label {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.drag-above {
|
2023-06-01 10:37:28 +08:00
|
|
|
border-top: 2px solid var(--tertiary);
|
2023-05-29 13:20:23 +08:00
|
|
|
}
|
|
|
|
&.drag-below {
|
2023-06-01 10:37:28 +08:00
|
|
|
border-bottom: 2px solid var(--tertiary);
|
2023-05-29 13:20:23 +08:00
|
|
|
}
|
|
|
|
.link-icon {
|
2023-06-01 10:37:28 +08:00
|
|
|
grid-column: 2;
|
2023-05-29 13:20:23 +08:00
|
|
|
}
|
2023-10-20 00:20:03 +08:00
|
|
|
|
2023-06-01 10:37:28 +08:00
|
|
|
.input-group {
|
|
|
|
margin: 0 0.5em;
|
|
|
|
@include breakpoint(mobile-large) {
|
|
|
|
margin: 0 0.25em;
|
|
|
|
}
|
|
|
|
}
|
2023-02-03 11:44:40 +08:00
|
|
|
}
|
DEV: FloatKit (#23650)
This PR introduces three new concepts to Discourse codebase through an addon called "FloatKit":
- menu
- tooltip
- toast
## Tooltips
### Component
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>
```
### Service
You can manually show a tooltip using the `tooltip` service:
```javascript
const tooltipInstance = await this.tooltip.show(
document.querySelector(".my-span"),
options
)
// and later manual 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
Menus are very similar to tooltips and provide the same kind of APIs:
### Component
```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>
```
### Service
You can manually show a menu using the `menu` service:
```javascript
const menuInstance = await this.menu.show(
document.querySelector(".my-span"),
options
)
// and later manual 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 }
}
)
```
## Toasts
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-26 19:39:52 +08:00
|
|
|
|
|
|
|
.always-public-tooltip {
|
|
|
|
padding-right: 0.5rem;
|
|
|
|
}
|
|
|
|
|
2023-06-01 10:37:28 +08:00
|
|
|
.btn-flat.add-link {
|
|
|
|
margin-top: 0.5em;
|
|
|
|
margin-left: -0.5em;
|
2023-02-03 11:44:40 +08:00
|
|
|
&:active,
|
|
|
|
&:focus {
|
|
|
|
background: none;
|
|
|
|
}
|
2023-02-08 08:45:34 +08:00
|
|
|
svg {
|
|
|
|
color: var(--tertiary);
|
|
|
|
width: 0.75em;
|
|
|
|
height: 0.75em;
|
|
|
|
}
|
|
|
|
&:hover svg {
|
|
|
|
color: var(--tertiary-hover);
|
|
|
|
}
|
2023-02-03 11:44:40 +08:00
|
|
|
}
|
|
|
|
.modal-footer {
|
2023-10-20 00:20:03 +08:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: auto 1fr auto;
|
|
|
|
gap: 0.5em;
|
|
|
|
@include breakpoint(mobile-extra-large) {
|
|
|
|
grid-template-columns: auto 1fr;
|
|
|
|
justify-items: left;
|
|
|
|
.mark-public-wrapper {
|
|
|
|
grid-row: 1;
|
|
|
|
grid-column: 1 / span 2;
|
|
|
|
}
|
|
|
|
.checkbox-label {
|
|
|
|
padding: 0 0 0.5em 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.reset-link,
|
2023-02-03 11:44:40 +08:00
|
|
|
.delete {
|
2023-10-20 00:20:03 +08:00
|
|
|
margin: 0;
|
|
|
|
justify-self: right;
|
|
|
|
}
|
|
|
|
.mark-public-wrapper {
|
|
|
|
&.-disabled label {
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
.checkbox-label {
|
|
|
|
margin: 0;
|
|
|
|
}
|
2023-02-03 11:44:40 +08:00
|
|
|
}
|
|
|
|
}
|
2023-05-29 13:20:23 +08:00
|
|
|
.select-kit.multi-select .multi-select-header .formatted-selection {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
.modal-inner-container .select-kit {
|
2023-06-01 10:37:28 +08:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
.select-kit-header {
|
|
|
|
height: 100%;
|
|
|
|
}
|
2023-05-29 13:20:23 +08:00
|
|
|
}
|
|
|
|
.select-kit.is-expanded .select-kit-body {
|
2023-06-01 10:37:28 +08:00
|
|
|
min-width: 220px;
|
|
|
|
}
|
|
|
|
.reset-link {
|
|
|
|
margin-right: 0;
|
|
|
|
.discourse-no-touch & {
|
|
|
|
&:hover {
|
|
|
|
.d-icon {
|
|
|
|
color: var(--tertiary-hover);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.d-icon {
|
|
|
|
font-size: var(--font-down-1);
|
|
|
|
color: var(--tertiary);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.delete-link {
|
|
|
|
.d-icon {
|
|
|
|
color: var(--primary-medium);
|
|
|
|
}
|
|
|
|
.discourse-no-touch & {
|
|
|
|
&:hover {
|
|
|
|
.d-icon {
|
|
|
|
color: var(--danger);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-05-29 13:20:23 +08:00
|
|
|
}
|
2023-02-03 11:44:40 +08:00
|
|
|
}
|
2023-07-19 09:31:45 +08:00
|
|
|
|
|
|
|
.sidebar__panel-switch-button {
|
|
|
|
margin: 1em 1.3em 0 1.3em;
|
|
|
|
&:last-of-type {
|
|
|
|
margin-bottom: 1em;
|
|
|
|
}
|
|
|
|
}
|