discourse/app/assets/stylesheets/common/form-kit/_default-input-mixin.scss
Penar Musaraj 47a830330f
DEV: Use token vars for filter input and form kit inputs (#40370)
I was working on a custom theme and noticed that these
easier-to-override token variables were missing for inputs. There should
be no visible changes in the default themes, each `--token` variable
matches the previous value. (Except for the new filter-input background,
but on the default themes, that has no effect because it matches the
page background.
2026-05-28 16:37:02 -04:00

53 lines
1.3 KiB
SCSS
Vendored

@use "lib/viewport";
@mixin default-input {
width: 100%;
height: var(--space-9);
background: var(--token-color-background-input);
border: 1px solid var(--primary-low-mid) !important;
border-radius: var(--d-input-border-radius);
padding: 0 0.5em !important;
box-sizing: border-box;
margin: 0 !important;
appearance: none;
@content;
@include viewport.until(sm) {
width: 100% !important;
}
&:focus,
&:focus-visible,
&:focus:focus-visible,
&:active {
// these `!important` flags are another great case for having a button element without that pesky default styling
&:not(:disabled) {
background-color: var(--token-color-background-input) !important;
color: var(--primary) !important;
border-color: var(--token-color-background-accent-bolder);
outline: 2px solid var(--token-color-background-accent-bolder);
outline-offset: -2px;
.d-icon {
color: inherit !important;
}
}
}
&:hover:not(:disabled) {
.discourse-no-touch & {
background-color: var(--token-color-background-input);
color: var(--primary);
border-color: var(--token-color-background-accent-bolder);
.d-icon {
color: inherit;
}
}
}
.has-errors & {
border-color: var(--danger);
}
}