2022-10-23 10:47:50 +07:00
|
|
|
|
@use "sass:map";
|
2022-10-22 13:11:51 +07:00
|
|
|
|
@use "../settings" as *;
|
2022-10-22 11:44:10 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
@if map.get($modules, "content/button") {
|
|
|
|
|
/**
|
|
|
|
|
* Button
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Reboot based on :
|
|
|
|
|
// - normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
|
|
|
|
|
// - sanitize.css v13.0.0 | CC0 1.0 Universal | github.com/csstools/sanitize.css
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
|
|
|
|
|
// 1. Change the font styles in all browsers
|
|
|
|
|
// 2. Remove the margin on controls in Safari
|
|
|
|
|
// 3. Show the overflow in Edge
|
|
|
|
|
button {
|
|
|
|
|
margin: 0; // 2
|
|
|
|
|
overflow: visible; // 3
|
|
|
|
|
font-family: inherit; // 1
|
|
|
|
|
text-transform: none; // 1
|
|
|
|
|
}
|
2019-11-27 15:31:49 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Correct the inability to style buttons in iOS and Safari
|
|
|
|
|
button,
|
2023-03-12 12:12:18 +07:00
|
|
|
|
[type="submit"],
|
2023-04-02 10:06:26 +07:00
|
|
|
|
[type="reset"],
|
|
|
|
|
[type="button"] {
|
2022-10-23 10:47:50 +07:00
|
|
|
|
-webkit-appearance: button;
|
2019-12-02 23:22:13 +07:00
|
|
|
|
}
|
2019-11-27 15:31:49 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Pico
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
|
|
|
|
|
button,
|
2023-03-12 12:12:18 +07:00
|
|
|
|
[type="submit"],
|
2023-04-02 10:06:26 +07:00
|
|
|
|
[type="reset"],
|
|
|
|
|
[type="button"],
|
|
|
|
|
[type="file"]::file-selector-button,
|
2022-10-23 10:47:50 +07:00
|
|
|
|
[role="button"] {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}background-color: var(#{$css-var-prefix}primary-background);
|
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}primary-border);
|
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}primary-inverse);
|
|
|
|
|
#{$css-var-prefix}box-shadow: var(#{$css-var-prefix}button-box-shadow, 0 0 0 rgba(0, 0, 0, 0));
|
|
|
|
|
padding: var(#{$css-var-prefix}form-element-spacing-vertical)
|
|
|
|
|
var(#{$css-var-prefix}form-element-spacing-horizontal);
|
|
|
|
|
border: var(#{$css-var-prefix}border-width) solid var(#{$css-var-prefix}border-color);
|
|
|
|
|
border-radius: var(#{$css-var-prefix}border-radius);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
outline: none;
|
2023-12-28 13:21:52 +07:00
|
|
|
|
background-color: var(#{$css-var-prefix}background-color);
|
|
|
|
|
box-shadow: var(#{$css-var-prefix}box-shadow);
|
|
|
|
|
color: var(#{$css-var-prefix}color);
|
|
|
|
|
font-weight: var(#{$css-var-prefix}font-weight);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
font-size: 1rem;
|
2023-12-28 13:21:52 +07:00
|
|
|
|
line-height: var(#{$css-var-prefix}line-height);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
text-align: center;
|
2023-03-12 11:39:53 +07:00
|
|
|
|
text-decoration: none;
|
2022-03-06 12:17:34 +07:00
|
|
|
|
cursor: pointer;
|
2023-01-01 13:47:54 +07:00
|
|
|
|
user-select: none;
|
2022-03-06 12:17:34 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
@if $enable-transitions {
|
2023-12-24 10:41:54 +07:00
|
|
|
|
transition:
|
2023-12-28 13:21:52 +07:00
|
|
|
|
background-color var(#{$css-var-prefix}transition),
|
|
|
|
|
border-color var(#{$css-var-prefix}transition),
|
|
|
|
|
color var(#{$css-var-prefix}transition),
|
|
|
|
|
box-shadow var(#{$css-var-prefix}transition);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
|
|
|
|
|
2024-01-04 21:32:34 +07:00
|
|
|
|
&:is([aria-current]:not([aria-current="false"])),
|
|
|
|
|
&:is(:hover, :active, :focus) {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}background-color: var(#{$css-var-prefix}primary-hover-background);
|
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}primary-hover-border);
|
|
|
|
|
#{$css-var-prefix}box-shadow: var(
|
|
|
|
|
#{$css-var-prefix}button-hover-box-shadow,
|
|
|
|
|
0 0 0 rgba(0, 0, 0, 0)
|
|
|
|
|
);
|
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}primary-inverse);
|
2021-07-02 16:54:41 +07:00
|
|
|
|
}
|
|
|
|
|
|
2024-01-04 21:32:34 +07:00
|
|
|
|
&:focus,
|
|
|
|
|
&:is([aria-current]:not([aria-current="false"])):focus {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}box-shadow:
|
|
|
|
|
var(#{$css-var-prefix}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
|
|
|
|
0 0 0 var(#{$css-var-prefix}outline-width) var(#{$css-var-prefix}primary-focus);
|
2022-03-06 12:17:34 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-12 12:12:18 +07:00
|
|
|
|
[type="submit"],
|
2023-04-02 10:06:26 +07:00
|
|
|
|
[type="reset"],
|
|
|
|
|
[type="button"] {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
margin-bottom: var(#{$css-var-prefix}spacing);
|
2023-03-12 12:12:18 +07:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// .secondary, .contrast & .outline
|
|
|
|
|
@if $enable-classes {
|
|
|
|
|
// Secondary
|
2023-04-02 10:06:26 +07:00
|
|
|
|
:is(button, [type="submit"], [type="button"], [role="button"]).secondary,
|
|
|
|
|
[type="reset"],
|
|
|
|
|
[type="file"]::file-selector-button {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}background-color: var(#{$css-var-prefix}secondary-background);
|
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary-border);
|
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}secondary-inverse);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
2023-10-20 12:10:00 -07:00
|
|
|
|
&:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}background-color: var(#{$css-var-prefix}secondary-hover-background);
|
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary-hover-border);
|
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}secondary-inverse);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
|
|
|
|
|
2024-01-04 21:32:34 +07:00
|
|
|
|
&:focus,
|
|
|
|
|
&:is([aria-current]:not([aria-current="false"])):focus {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}box-shadow:
|
|
|
|
|
var(#{$css-var-prefix}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
|
|
|
|
0 0 0 var(#{$css-var-prefix}outline-width) var(#{$css-var-prefix}secondary-focus);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-06 12:17:34 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Contrast
|
2023-04-02 10:06:26 +07:00
|
|
|
|
:is(button, [type="submit"], [type="button"], [role="button"]).contrast {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}background-color: var(#{$css-var-prefix}contrast-background);
|
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}contrast-border);
|
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}contrast-inverse);
|
2021-07-02 16:54:41 +07:00
|
|
|
|
|
2023-10-20 12:10:00 -07:00
|
|
|
|
&:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}background-color: var(#{$css-var-prefix}contrast-hover-background);
|
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}contrast-hover-border);
|
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}contrast-inverse);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
2022-03-06 11:45:06 +07:00
|
|
|
|
|
2024-01-04 21:32:34 +07:00
|
|
|
|
&:focus,
|
|
|
|
|
&:is([aria-current]:not([aria-current="false"])):focus {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}box-shadow:
|
|
|
|
|
var(#{$css-var-prefix}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
|
|
|
|
0 0 0 var(#{$css-var-prefix}outline-width) var(#{$css-var-prefix}contrast-focus);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-06 12:17:34 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Outline (primary)
|
2023-04-02 10:06:26 +07:00
|
|
|
|
:is(button, [type="submit"], [type="button"], [role="button"]).outline,
|
|
|
|
|
[type="reset"].outline {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}background-color: transparent;
|
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}primary);
|
2024-01-14 13:37:32 +07:00
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}primary);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
|
2023-10-20 12:10:00 -07:00
|
|
|
|
&:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}background-color: transparent;
|
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}primary-hover);
|
2024-01-14 13:37:32 +07:00
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}primary-hover);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
2021-07-02 16:54:41 +07:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Outline (secondary)
|
2023-04-02 10:06:26 +07:00
|
|
|
|
:is(button, [type="submit"], [type="button"], [role="button"]).outline.secondary,
|
|
|
|
|
[type="reset"].outline {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}secondary);
|
2024-01-14 13:37:32 +07:00
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary);
|
2022-03-06 11:45:06 +07:00
|
|
|
|
|
2023-10-20 12:10:00 -07:00
|
|
|
|
&:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}secondary-hover);
|
2024-01-14 13:37:32 +07:00
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary-hover);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
2022-01-16 12:12:52 +07:00
|
|
|
|
}
|
2021-07-02 16:54:41 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Outline (contrast)
|
2023-04-02 10:06:26 +07:00
|
|
|
|
:is(button, [type="submit"], [type="button"], [role="button"]).outline.contrast {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}contrast);
|
2024-01-14 13:37:32 +07:00
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}contrast);
|
2022-03-06 11:45:06 +07:00
|
|
|
|
|
2023-10-20 12:10:00 -07:00
|
|
|
|
&:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}contrast-hover);
|
2024-01-14 13:37:32 +07:00
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}contrast-hover);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
2021-07-02 16:54:41 +07:00
|
|
|
|
}
|
2022-10-23 10:47:50 +07:00
|
|
|
|
} @else {
|
|
|
|
|
// Secondary button without .class
|
2023-04-02 10:06:26 +07:00
|
|
|
|
[type="reset"],
|
|
|
|
|
[type="file"]::file-selector-button {
|
2024-01-14 23:25:55 +07:00
|
|
|
|
#{$css-var-prefix}background-color: var(#{$css-var-prefix}secondary-background);
|
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary-border);
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}secondary-inverse);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
cursor: pointer;
|
2022-01-16 12:12:52 +07:00
|
|
|
|
|
2023-10-20 12:10:00 -07:00
|
|
|
|
&:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
|
2024-01-14 23:25:55 +07:00
|
|
|
|
#{$css-var-prefix}background-color: var(#{$css-var-prefix}secondary-hover-background);
|
|
|
|
|
#{$css-var-prefix}border-color: var(#{$css-var-prefix}secondary-hover-border);
|
|
|
|
|
#{$css-var-prefix}color: var(#{$css-var-prefix}secondary-inverse);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
2021-07-02 16:54:41 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
&:focus {
|
2023-12-28 13:21:52 +07:00
|
|
|
|
#{$css-var-prefix}box-shadow:
|
|
|
|
|
var(#{$css-var-prefix}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
|
|
|
|
0 0 0 var(#{$css-var-prefix}outline-width) var(#{$css-var-prefix}secondary-focus);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
}
|
2021-07-02 16:54:41 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-27 15:31:49 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Button [disabled]
|
2023-04-02 10:06:26 +07:00
|
|
|
|
:where(button, [type="submit"], [type="reset"], [type="button"], [role="button"])[disabled],
|
2022-10-23 10:47:50 +07:00
|
|
|
|
:where(fieldset[disabled])
|
2023-04-02 10:06:26 +07:00
|
|
|
|
:is(button, [type="submit"], [type="button"], [type="reset"], [role="button"]) {
|
2022-10-23 10:47:50 +07:00
|
|
|
|
opacity: 0.5;
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
}
|
2022-10-15 23:22:12 +07:00
|
|
|
|
}
|