2019-11-27 15:31:49 +07:00
|
|
|
|
/**
|
|
|
|
|
* Button
|
|
|
|
|
*/
|
|
|
|
|
|
2020-09-11 23:22:50 +07:00
|
|
|
|
// Reboot based on :
|
|
|
|
|
// - normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
|
|
|
|
|
// - sanitize.css v12.0.1 | CC0 1.0 Universal | github.com/csstools/sanitize.css
|
2019-11-27 15:31:49 +07:00
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
|
2020-09-11 23:22:50 +07:00
|
|
|
|
// 1. Change the font styles in all browsers
|
2019-11-27 15:31:49 +07:00
|
|
|
|
// 2. Remove the margin in Firefox and Safari
|
|
|
|
|
// 3. Show the overflow in Edge
|
|
|
|
|
button {
|
|
|
|
|
margin: 0; // 2
|
|
|
|
|
overflow: visible; // 3
|
|
|
|
|
font-family: inherit; // 1
|
|
|
|
|
text-transform: none; // 1
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-11 23:22:50 +07:00
|
|
|
|
// Correct the inability to style clickable types in iOS and Safari
|
2019-11-27 15:31:49 +07:00
|
|
|
|
button,
|
|
|
|
|
[type="button"],
|
|
|
|
|
[type="reset"],
|
|
|
|
|
[type="submit"] {
|
|
|
|
|
-webkit-appearance: button;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-11 23:22:50 +07:00
|
|
|
|
// Remove the inner border and padding in Firefox
|
2019-11-27 15:31:49 +07:00
|
|
|
|
button::-moz-focus-inner,
|
|
|
|
|
[type="button"]::-moz-focus-inner,
|
|
|
|
|
[type="reset"]::-moz-focus-inner,
|
|
|
|
|
[type="submit"]::-moz-focus-inner {
|
2021-07-02 16:54:41 +07:00
|
|
|
|
padding: 0;
|
|
|
|
|
border-style: none;
|
2019-11-27 15:31:49 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Pico
|
|
|
|
|
// ––––––––––––––––––––
|
|
|
|
|
|
|
|
|
|
button {
|
|
|
|
|
display: block;
|
|
|
|
|
width: 100%;
|
2021-07-02 16:54:41 +07:00
|
|
|
|
margin-bottom: var(--spacing);
|
2019-11-27 15:31:49 +07:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-16 11:41:50 +07:00
|
|
|
|
[role="button"] {
|
2019-11-27 15:31:49 +07:00
|
|
|
|
display: inline-block;
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
button,
|
|
|
|
|
input[type="submit"],
|
2020-09-24 22:35:30 +07:00
|
|
|
|
input[type="button"],
|
2020-09-29 08:38:35 +07:00
|
|
|
|
input[type="reset"],
|
2022-01-16 11:41:50 +07:00
|
|
|
|
[role="button"] {
|
2021-07-02 16:54:41 +07:00
|
|
|
|
--background-color: var(--primary);
|
|
|
|
|
--border-color: var(--primary);
|
|
|
|
|
--color: var(--primary-inverse);
|
2021-07-02 22:18:14 +07:00
|
|
|
|
--box-shadow: var(--button-box-shadow, 0 0 0 rgba(0, 0, 0, 0));
|
2021-10-24 12:33:20 +07:00
|
|
|
|
padding: var(--form-element-spacing-vertical)
|
|
|
|
|
var(--form-element-spacing-horizontal);
|
2021-07-02 16:54:41 +07:00
|
|
|
|
border: var(--border-width) solid var(--border-color);
|
|
|
|
|
border-radius: var(--border-radius);
|
2019-11-27 15:31:49 +07:00
|
|
|
|
outline: none;
|
2021-07-02 16:54:41 +07:00
|
|
|
|
background-color: var(--background-color);
|
|
|
|
|
box-shadow: var(--box-shadow);
|
|
|
|
|
color: var(--color);
|
2021-11-08 00:12:34 +07:00
|
|
|
|
font-weight: var(--font-weight);
|
2021-12-19 09:50:55 +07:00
|
|
|
|
font-size: 1rem;
|
2020-09-29 08:38:35 +07:00
|
|
|
|
line-height: var(--line-height);
|
2019-11-27 15:31:49 +07:00
|
|
|
|
text-align: center;
|
|
|
|
|
cursor: pointer;
|
2019-12-02 23:22:13 +07:00
|
|
|
|
|
|
|
|
|
@if $enable-transitions {
|
2021-10-24 12:33:20 +07:00
|
|
|
|
transition: background-color var(--transition),
|
|
|
|
|
border-color var(--transition), color var(--transition),
|
2020-09-29 08:38:35 +07:00
|
|
|
|
box-shadow var(--transition);
|
2019-12-02 23:22:13 +07:00
|
|
|
|
}
|
2019-11-27 15:31:49 +07:00
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
&:active,
|
|
|
|
|
&:focus {
|
2022-01-16 11:41:50 +07:00
|
|
|
|
--color: var(--primary-inverse);
|
2021-07-02 16:54:41 +07:00
|
|
|
|
--background-color: var(--primary-hover);
|
|
|
|
|
--border-color: var(--primary-hover);
|
2021-07-02 22:18:14 +07:00
|
|
|
|
--box-shadow: var(--button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0));
|
2019-11-27 15:31:49 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:focus {
|
2021-10-24 12:33:20 +07:00
|
|
|
|
--box-shadow: var(--button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
|
|
|
|
0 0 0 var(--outline-width) var(--primary-focus);
|
2019-11-27 15:31:49 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-02 16:54:41 +07:00
|
|
|
|
// Secondary button without .class
|
2019-11-27 15:31:49 +07:00
|
|
|
|
input[type="reset"] {
|
2021-07-02 16:54:41 +07:00
|
|
|
|
--background-color: var(--secondary);
|
|
|
|
|
--border-color: var(--secondary);
|
|
|
|
|
--color: var(--secondary-inverse);
|
2019-11-27 15:31:49 +07:00
|
|
|
|
cursor: pointer;
|
2021-07-02 16:54:41 +07:00
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
&:active,
|
|
|
|
|
&:focus {
|
|
|
|
|
--background-color: var(--secondary-hover);
|
|
|
|
|
--border-color: var(--secondary-hover);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:focus {
|
2021-10-24 12:33:20 +07:00
|
|
|
|
--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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// .secondary, .contrast & .outline
|
|
|
|
|
@if $enable-classes {
|
|
|
|
|
button,
|
|
|
|
|
input[type="submit"],
|
|
|
|
|
input[type="button"],
|
|
|
|
|
input[type="reset"],
|
2022-01-16 11:41:50 +07:00
|
|
|
|
[role="button"] {
|
2021-07-02 16:54:41 +07:00
|
|
|
|
// Secondary
|
|
|
|
|
&.secondary {
|
|
|
|
|
--background-color: var(--secondary);
|
|
|
|
|
--border-color: var(--secondary);
|
|
|
|
|
--color: var(--secondary-inverse);
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
&:active,
|
|
|
|
|
&:focus {
|
|
|
|
|
--background-color: var(--secondary-hover);
|
|
|
|
|
--border-color: var(--secondary-hover);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:focus {
|
2021-10-24 12:33:20 +07:00
|
|
|
|
--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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Contrast
|
|
|
|
|
&.contrast {
|
|
|
|
|
--background-color: var(--contrast);
|
|
|
|
|
--border-color: var(--contrast);
|
|
|
|
|
--color: var(--contrast-inverse);
|
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
&:active,
|
|
|
|
|
&:focus {
|
|
|
|
|
--background-color: var(--contrast-hover);
|
|
|
|
|
--border-color: var(--contrast-hover);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:focus {
|
2021-10-24 12:33:20 +07:00
|
|
|
|
--box-shadow: var(--button-hover-box-shadow, 0 0 0 rgba(0, 0, 0, 0)),
|
|
|
|
|
0 0 0 var(--outline-width) var(--contrast-focus);
|
2021-07-02 16:54:41 +07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Outline (primary)
|
|
|
|
|
&.outline {
|
|
|
|
|
--background-color: transparent;
|
|
|
|
|
--color: var(--primary);
|
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
&:active,
|
|
|
|
|
&:focus {
|
|
|
|
|
--background-color: transparent;
|
|
|
|
|
--color: var(--primary-hover);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Outline (secondary)
|
|
|
|
|
&.outline.secondary {
|
|
|
|
|
--color: var(--secondary);
|
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
&:active,
|
|
|
|
|
&:focus {
|
|
|
|
|
--color: var(--secondary-hover);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Outline (contrast)
|
|
|
|
|
&.outline.contrast {
|
|
|
|
|
--color: var(--contrast);
|
|
|
|
|
|
|
|
|
|
&:hover,
|
|
|
|
|
&:active,
|
|
|
|
|
&:focus {
|
|
|
|
|
--color: var(--contrast-hover);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-27 15:31:49 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Button [disabled]
|
2022-01-16 11:41:50 +07:00
|
|
|
|
// 1. Links without href are disabled by default
|
2021-12-31 12:51:37 +07:00
|
|
|
|
button[disabled],
|
|
|
|
|
input[type="submit"][disabled],
|
|
|
|
|
input[type="button"][disabled],
|
|
|
|
|
input[type="reset"][disabled],
|
2022-01-16 11:41:50 +07:00
|
|
|
|
a[role="button"]:not([href]), // 1
|
|
|
|
|
[role="button"][disabled] {
|
2021-12-25 18:03:25 +09:00
|
|
|
|
opacity: 0.5;
|
|
|
|
|
pointer-events: none;
|
2021-12-31 12:51:37 +07:00
|
|
|
|
}
|