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,
|
2022-12-29 17:53:16 +07:00
|
|
|
|
input[type="submit"],
|
|
|
|
|
input[type="reset"],
|
|
|
|
|
input[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 {
|
|
|
|
|
display: block;
|
|
|
|
|
margin-bottom: var(#{$✨}spacing);
|
2019-11-27 15:31:49 +07:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-29 17:53:16 +07:00
|
|
|
|
input[type="submit"],
|
|
|
|
|
input[type="reset"],
|
|
|
|
|
input[type="button"] {
|
|
|
|
|
width: 100%;
|
2019-11-27 15:31:49 +07:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
button,
|
|
|
|
|
input[type="submit"],
|
|
|
|
|
input[type="reset"],
|
2022-12-29 17:53:16 +07:00
|
|
|
|
input[type="button"],
|
2022-10-23 10:47:50 +07:00
|
|
|
|
[role="button"] {
|
2022-12-26 11:35:56 +07:00
|
|
|
|
#{$✨}background-color: var(#{$✨}primary-background);
|
|
|
|
|
#{$✨}border-color: var(#{$✨}primary-border);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
#{$✨}color: var(#{$✨}primary-inverse);
|
|
|
|
|
#{$✨}box-shadow: var(#{$✨}button-box-shadow, 0 0 0 rgba(0, 0, 0, 0));
|
|
|
|
|
padding: var(#{$✨}form-element-spacing-vertical) var(#{$✨}form-element-spacing-horizontal);
|
|
|
|
|
border: var(#{$✨}border-width) solid var(#{$✨}border-color);
|
|
|
|
|
border-radius: var(#{$✨}border-radius);
|
|
|
|
|
outline: none;
|
|
|
|
|
background-color: var(#{$✨}background-color);
|
|
|
|
|
box-shadow: var(#{$✨}box-shadow);
|
|
|
|
|
color: var(#{$✨}color);
|
|
|
|
|
font-weight: var(#{$✨}font-weight);
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
line-height: var(#{$✨}line-height);
|
|
|
|
|
text-align: center;
|
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 {
|
|
|
|
|
transition: background-color var(#{$✨}transition), border-color var(#{$✨}transition),
|
|
|
|
|
color var(#{$✨}transition), box-shadow var(#{$✨}transition);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-06 12:17:34 +07:00
|
|
|
|
&:is([aria-current], :hover, :active, :focus) {
|
2022-12-26 11:35:56 +07:00
|
|
|
|
#{$✨}background-color: var(#{$✨}primary-background-hover);
|
|
|
|
|
#{$✨}border-color: var(#{$✨}primary-border-hover);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
#{$✨}box-shadow: var(#{$✨}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0));
|
|
|
|
|
#{$✨}color: var(#{$✨}primary-inverse);
|
2021-07-02 16:54:41 +07:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-06 12:17:34 +07:00
|
|
|
|
&:focus {
|
2022-10-22 13:11:51 +07:00
|
|
|
|
#{$✨}box-shadow: var(#{$✨}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
2022-10-23 10:47:50 +07:00
|
|
|
|
0 0 0 var(#{$✨}outline-width) var(#{$✨}primary-focus);
|
2022-03-06 12:17:34 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// .secondary, .contrast & .outline
|
|
|
|
|
@if $enable-classes {
|
|
|
|
|
// Secondary
|
|
|
|
|
:is(button, input[type="submit"], input[type="button"], [role="button"]).secondary,
|
|
|
|
|
input[type="reset"] {
|
2022-12-26 11:35:56 +07:00
|
|
|
|
#{$✨}background-color: var(#{$✨}secondary-background);
|
|
|
|
|
#{$✨}border-color: var(#{$✨}secondary-border);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
#{$✨}color: var(#{$✨}secondary-inverse);
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
&:is([aria-current], :hover, :active, :focus) {
|
2022-12-26 11:35:56 +07:00
|
|
|
|
#{$✨}background-color: var(#{$✨}secondary-background-hover);
|
|
|
|
|
#{$✨}border-color: var(#{$✨}secondary-border-hover);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
#{$✨}color: var(#{$✨}secondary-inverse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:focus {
|
|
|
|
|
#{$✨}box-shadow: var(#{$✨}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
|
|
|
|
0 0 0 var(#{$✨}outline-width) var(#{$✨}secondary-focus);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-06 12:17:34 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Contrast
|
|
|
|
|
:is(button, input[type="submit"], input[type="button"], [role="button"]).contrast {
|
2022-12-26 11:35:56 +07:00
|
|
|
|
#{$✨}background-color: var(#{$✨}contrast-background);
|
|
|
|
|
#{$✨}border-color: var(#{$✨}contrast-border);
|
2022-10-22 13:11:51 +07:00
|
|
|
|
#{$✨}color: var(#{$✨}contrast-inverse);
|
2021-07-02 16:54:41 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
&:is([aria-current], :hover, :active, :focus) {
|
2022-12-26 11:35:56 +07:00
|
|
|
|
#{$✨}background-color: var(#{$✨}contrast-background-hover);
|
|
|
|
|
#{$✨}border-color: var(#{$✨}contrast-border-hover);
|
2022-10-23 10:47:50 +07:00
|
|
|
|
#{$✨}color: var(#{$✨}contrast-inverse);
|
|
|
|
|
}
|
2022-03-06 11:45:06 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
&:focus {
|
|
|
|
|
#{$✨}box-shadow: var(#{$✨}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
|
|
|
|
0 0 0 var(#{$✨}outline-width) var(#{$✨}contrast-focus);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-06 12:17:34 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Outline (primary)
|
|
|
|
|
:is(button, input[type="submit"], input[type="button"], [role="button"]).outline,
|
|
|
|
|
input[type="reset"].outline {
|
2022-10-22 13:11:51 +07:00
|
|
|
|
#{$✨}background-color: transparent;
|
2022-10-23 10:47:50 +07:00
|
|
|
|
#{$✨}color: var(#{$✨}primary);
|
2022-12-26 11:35:56 +07:00
|
|
|
|
#{$✨}border-color: currentColor;
|
2022-10-23 10:47:50 +07:00
|
|
|
|
|
|
|
|
|
&:is([aria-current], :hover, :active, :focus) {
|
|
|
|
|
#{$✨}background-color: transparent;
|
|
|
|
|
#{$✨}color: var(#{$✨}primary-hover);
|
|
|
|
|
}
|
2021-07-02 16:54:41 +07:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
// Outline (secondary)
|
|
|
|
|
:is(button, input[type="submit"], input[type="button"], [role="button"]).outline.secondary,
|
|
|
|
|
input[type="reset"].outline {
|
|
|
|
|
#{$✨}color: var(#{$✨}secondary);
|
2022-12-26 11:35:56 +07:00
|
|
|
|
#{$✨}border-color: currentColor;
|
2022-03-06 11:45:06 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
&:is([aria-current], :hover, :active, :focus) {
|
|
|
|
|
#{$✨}color: var(#{$✨}secondary-hover);
|
|
|
|
|
}
|
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)
|
|
|
|
|
:is(button, input[type="submit"], input[type="button"], [role="button"]).outline.contrast {
|
|
|
|
|
#{$✨}color: var(#{$✨}contrast);
|
2022-03-06 11:45:06 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
&:is([aria-current], :hover, :active, :focus) {
|
|
|
|
|
#{$✨}color: var(#{$✨}contrast-hover);
|
|
|
|
|
}
|
2021-07-02 16:54:41 +07:00
|
|
|
|
}
|
2022-10-23 10:47:50 +07:00
|
|
|
|
} @else {
|
|
|
|
|
// Secondary button without .class
|
|
|
|
|
input[type="reset"] {
|
|
|
|
|
#{$✨}background-color: var(#{$✨}secondary);
|
|
|
|
|
#{$✨}border-color: var(#{$✨}secondary);
|
|
|
|
|
#{$✨}color: var(#{$✨}secondary-inverse);
|
|
|
|
|
cursor: pointer;
|
2022-01-16 12:12:52 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
&:is([aria-current], :hover, :active, :focus) {
|
|
|
|
|
#{$✨}background-color: var(#{$✨}secondary-hover);
|
|
|
|
|
#{$✨}border-color: var(#{$✨}secondary-hover);
|
|
|
|
|
}
|
2021-07-02 16:54:41 +07:00
|
|
|
|
|
2022-10-23 10:47:50 +07:00
|
|
|
|
&:focus {
|
|
|
|
|
#{$✨}box-shadow: var(#{$✨}button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
|
|
|
|
0 0 0 var(#{$✨}outline-width) var(#{$✨}secondary-focus);
|
|
|
|
|
}
|
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]
|
2022-12-29 17:53:16 +07:00
|
|
|
|
:where(
|
|
|
|
|
button,
|
|
|
|
|
input[type="submit"],
|
|
|
|
|
input[type="reset"],
|
|
|
|
|
input[type="button"],
|
|
|
|
|
[role="button"]
|
|
|
|
|
)[disabled],
|
2022-10-23 10:47:50 +07:00
|
|
|
|
:where(fieldset[disabled])
|
2022-12-29 17:53:16 +07:00
|
|
|
|
:is(button, input[type="submit"], input[type="button"], input[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
|
|
|
|
}
|