picocss/scss/themes/default/_styles.scss

433 lines
14 KiB
SCSS
Raw Normal View History

2022-10-22 11:44:10 +07:00
@use "sass:map";
2023-03-27 10:28:30 +07:00
@use "../../colors" as *;
2022-10-22 13:11:51 +07:00
@use "../../settings" as *;
2023-03-27 10:28:30 +07:00
@use "../../utils/functions";
2022-10-22 11:44:10 +07:00
2022-10-23 10:47:50 +07:00
@if map.get($modules, "themes/default") {
/**
* Styles
*/
:root {
// Typography
#{$✨}font-family: system-ui, -apple-system, "Segoe UI", "Roboto", "Ubuntu", "Cantarell",
"Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
"Noto Color Emoji";
#{$✨}line-height: 1.5;
#{$✨}font-weight: 400;
2023-02-13 20:19:54 +07:00
#{$✨}font-size: 100%;
2022-12-26 11:35:56 +07:00
#{$✨}text-underline-offset: 0.1rem;
2022-10-23 10:47:50 +07:00
// Responsive root font size
@if $enable-responsive-typography {
@each $key, $values in $breakpoints {
@if $values {
@media (min-width: map.get($values, "breakpoint")) {
#{$✨}font-size: map.get($values, "root-font-size");
}
2022-10-22 15:39:36 +07:00
}
2021-07-02 16:54:41 +07:00
}
}
2022-10-23 10:47:50 +07:00
// Borders
#{$✨}border-radius: 0.25rem;
2023-04-02 10:36:52 +07:00
#{$✨}border-width: 0.0625rem;
2022-12-26 11:35:56 +07:00
#{$✨}outline-width: 0.1875rem;
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
// Transitions
#{$✨}transition: 0.2s ease-in-out;
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
// Spacings
#{$✨}spacing: 1rem;
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
// Spacings for typography elements
@if map.get($modules, "content/typography") {
2022-12-29 17:44:09 +07:00
#{$✨}typography-spacing-vertical: 1rem;
2022-10-23 10:47:50 +07:00
}
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
// Spacings for body > header, body > main, body > footer, section, article
@if map.get($modules, "layout/landmarks") or
map.get($modules, "layout/section") or
map.get($modules, "components/card") or
map.get($modules, "components/modal")
{
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * 2);
#{$✨}block-spacing-horizontal: var(#{$}spacing);
}
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
@if map.get($modules, "layout/grid") and $enable-classes {
2023-04-02 17:40:20 +07:00
#{$✨}grid-column-gap: var(#{$}spacing);
#{$✨}grid-row-gap: var(#{$}spacing);
2022-10-23 10:47:50 +07:00
}
2020-09-29 08:38:35 +07:00
2022-10-23 10:47:50 +07:00
// Spacings for form elements and button
@if map.get($modules, "content/button") or map.get($modules, "forms/basic") {
#{$✨}form-element-spacing-vertical: 0.75rem;
#{$✨}form-element-spacing-horizontal: 1rem;
}
2022-02-27 14:41:34 +07:00
2022-10-23 10:47:50 +07:00
// Font weight for form labels & fieldsets legend
@if map.get($modules, "forms/basic") {
#{$✨}form-label-font-weight: var(#{$}font-weight);
}
2023-04-10 10:48:10 +07:00
// Group (role="group")
@if map.get($modules, "components/group") {
#{$✨}group-box-shadow: 0 0 0 rgba(0, 0, 0, 0);
#{$}group-box-shadow-focus-with-button: 0
0
0
var(#{$}outline-width)
var(#{$}primary-focus);
#{$✨}group-box-shadow-focus-with-input: 0 0 0 0.0625rem var(#{$}form-element-border-color);
}
2022-10-23 10:47:50 +07:00
// Modal (<dialog>)
@if map.get($modules, "components/modal") {
2022-12-26 11:35:56 +07:00
#{$✨}modal-overlay-backdrop-filter: blur(0.375rem);
2022-10-23 10:47:50 +07:00
}
2022-09-11 15:52:10 +07:00
2022-10-23 10:47:50 +07:00
// Spacings for nav component
@if map.get($modules, "components/nav") {
#{$✨}nav-element-spacing-vertical: 1rem;
#{$✨}nav-element-spacing-horizontal: 0.5rem;
#{$✨}nav-link-spacing-vertical: 0.5rem;
#{$✨}nav-link-spacing-horizontal: 0.5rem;
2023-03-25 19:40:57 +07:00
#{$✨}nav-breadcrumb-divider: ">";
2022-10-23 10:47:50 +07:00
}
2023-03-27 10:28:30 +07:00
// Checkboxes icons
@if map.get($modules, "forms/checkbox-radio-switch") {
#{$✨}icon-checkbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#{functions.display-rgb($white)}' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
#{$✨}icon-minus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#{functions.display-rgb($white)}' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E");
}
// Chevron icons
@if map.get($modules, "forms/basics") or
map.get($modules, "components/accordion") or
map.get($modules, "components/dropdown")
{
#{$✨}icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#{functions.display-rgb($zinc-400)}' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
2023-03-28 20:34:28 +07:00
}
// Chevron icons
// Change the icon color to white for accordion and dropdown buttons
@if map.get($modules, "components/accordion") or map.get($modules, "components/dropdown") {
details {
summary {
$selector: '&[role="button"]';
@if $enable-classes {
$selector: "#{$selector}:not(.outline)";
}
#{$selector} {
&::after {
filter: brightness(0) invert(1);
}
}
}
}
2023-03-27 10:28:30 +07:00
}
// Datetime icons
@if map.get($modules, "forms/input-date") {
#{$✨}icon-date: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#{functions.display-rgb($zinc-400)}' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
#{$✨}icon-time: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#{functions.display-rgb($zinc-400)}' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E");
}
// Search icon
@if map.get($modules, "forms/input-search") {
#{$✨}icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#{functions.display-rgb($zinc-400)}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
}
// Close icon
@if map.get($modules, "components/modal") {
#{$✨}icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='#{functions.display-rgb($zinc-400)}' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
}
// Loading icon (animated)
@if map.get($modules, "components/loading") {
// Inspired by https://codepen.io/aleksander351/pen/KzgKPo
#{$✨}icon-loading: url("data:image/svg+xml,%3Csvg fill='none' height='24' width='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' %3E%3Cstyle%3E g %7B animation: rotate 2s linear infinite; transform-origin: center center; %7D circle %7B stroke-dasharray: 75,100; stroke-dashoffset: -5; animation: dash 1.5s ease-in-out infinite; stroke-linecap: round; %7D @keyframes rotate %7B 0%25 %7B transform: rotate(0deg); %7D 100%25 %7B transform: rotate(360deg); %7D %7D @keyframes dash %7B 0%25 %7B stroke-dasharray: 1,100; stroke-dashoffset: 0; %7D 50%25 %7B stroke-dasharray: 44.5,100; stroke-dashoffset: -17.5; %7D 100%25 %7B stroke-dasharray: 44.5,100; stroke-dashoffset: -62; %7D %7D %3C/style%3E%3Cg%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='#{functions.display-rgb($zinc-400)}' stroke-width='4' /%3E%3C/g%3E%3C/svg%3E");
2023-03-28 20:34:28 +07:00
// Change the icon color to white for buttons
[aria-busy="true"]:not(input, select, textarea) {
$selector: '&:is(button, [type="submit"], [type="button"], [type="reset"], [role="button"])';
@if $enable-classes {
$selector: "#{$selector}:not(.outline)";
}
#{$selector} {
&::before {
filter: brightness(0) invert(1);
}
}
}
2023-03-27 10:28:30 +07:00
}
2022-10-23 10:47:50 +07:00
}
2020-09-29 08:38:35 +07:00
2022-10-23 10:47:50 +07:00
// Responsives spacings
@if $enable-responsive-spacings {
// Landmarks and section
@if map.get($modules, "layout/landmarks") or map.get($modules, "layout/section") {
#{$semantic-root-element} > header,
#{$semantic-root-element} > main,
#{$semantic-root-element} > footer,
section {
@each $key, $values in $breakpoints {
@if $values {
@media (min-width: map.get($values, "breakpoint")) {
2023-03-20 20:31:27 +07:00
$multiplier: 2;
2022-10-23 10:47:50 +07:00
@if $key == "sm" {
$multiplier: 2.5;
} @else if $key == "md" {
$multiplier: 3;
} @else if $key == "lg" {
$multiplier: 3.5;
} @else if $key == "xl" {
$multiplier: 4;
2023-03-20 20:31:27 +07:00
} @else if $key == "xxl" {
$multiplier: 4.5;
2022-10-23 10:47:50 +07:00
}
2023-02-20 23:44:33 +07:00
2022-10-23 10:47:50 +07:00
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * $multiplier);
}
2022-10-22 15:39:36 +07:00
}
}
2021-07-02 16:54:41 +07:00
}
}
2022-10-23 10:47:50 +07:00
// Card (<article>)
@if map.get($modules, "components/card") {
article {
@each $key, $values in $breakpoints {
@if $values {
@media (min-width: map.get($values, "breakpoint")) {
$multiplier: 1;
@if $key == "sm" {
$multiplier: 1.25;
} @else if $key == "md" {
$multiplier: 1.5;
} @else if $key == "lg" {
$multiplier: 1.75;
} @else if $key == "xl" {
$multiplier: 2;
2023-03-20 20:31:27 +07:00
} @else if $key == "xxl" {
$multiplier: 2.25;
2022-10-23 10:47:50 +07:00
}
2023-02-20 23:44:33 +07:00
2022-10-23 10:47:50 +07:00
#{$✨}block-spacing-horizontal: calc(var(#{$}spacing) * $multiplier);
}
2022-10-22 15:39:36 +07:00
}
}
2021-07-02 16:54:41 +07:00
}
}
2022-10-23 10:47:50 +07:00
// Modal
@if map.get($modules, "components/modal") {
dialog > article {
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * 2);
#{$✨}block-spacing-horizontal: var(#{$}spacing);
2022-10-23 10:47:50 +07:00
@if map.get($breakpoints, "sm") {
@media (min-width: map.get(map.get($breakpoints, "sm"), "breakpoint")) {
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * 2.5);
#{$✨}block-spacing-horizontal: calc(var(#{$}spacing) * 1.25);
}
}
2022-10-23 10:47:50 +07:00
@if map.get($breakpoints, "md") {
@media (min-width: map.get(map.get($breakpoints, "md"), "breakpoint")) {
#{$✨}block-spacing-vertical: calc(var(#{$}spacing) * 3);
#{$✨}block-spacing-horizontal: calc(var(#{$}spacing) * 1.5);
}
}
}
}
}
2020-09-29 08:38:35 +07:00
2022-10-23 10:47:50 +07:00
// Link
@if map.get($modules, "content/link") {
a {
2022-12-26 11:35:56 +07:00
#{$✨}text-decoration: underline;
2020-09-29 08:38:35 +07:00
2022-10-23 10:47:50 +07:00
// Secondary & Contrast
@if enable-classes {
&.secondary,
&.contrast {
#{$✨}text-decoration: underline;
}
}
}
2021-07-02 16:54:41 +07:00
}
2020-09-29 08:38:35 +07:00
2022-10-23 10:47:50 +07:00
// Typography
@if map.get($modules, "content/typography") {
// Small
small {
#{$✨}font-size: 0.875em;
}
2020-09-29 08:38:35 +07:00
2022-10-23 10:47:50 +07:00
// Headings
h1,
h2,
h3,
h4,
h5,
h6 {
#{$✨}font-weight: 700;
}
2020-09-29 08:38:35 +07:00
2022-10-23 10:47:50 +07:00
h1 {
#{$✨}font-size: 2rem;
2023-03-05 09:17:56 +07:00
#{$✨}line-height: 1.25;
2022-12-29 17:44:09 +07:00
#{$✨}typography-spacing-top: 3rem;
2022-10-23 10:47:50 +07:00
}
2020-09-29 08:38:35 +07:00
2022-10-23 10:47:50 +07:00
h2 {
#{$✨}font-size: 1.75rem;
2023-03-05 09:17:56 +07:00
#{$✨}line-height: 1.3;
2022-12-29 17:44:09 +07:00
#{$✨}typography-spacing-top: 2.625rem;
2022-10-23 10:47:50 +07:00
}
2020-09-29 08:38:35 +07:00
2022-10-23 10:47:50 +07:00
h3 {
#{$✨}font-size: 1.5rem;
2023-03-05 09:17:56 +07:00
#{$✨}line-height: 1.35;
2022-12-29 17:44:09 +07:00
#{$✨}typography-spacing-top: 2.25rem;
2022-10-23 10:47:50 +07:00
}
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
h4 {
#{$✨}font-size: 1.25rem;
2023-03-05 09:17:56 +07:00
#{$✨}line-height: 1.4;
2022-12-29 17:44:09 +07:00
#{$✨}typography-spacing-top: 1.874rem;
2022-10-23 10:47:50 +07:00
}
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
h5 {
#{$✨}font-size: 1.125rem;
2023-03-05 09:17:56 +07:00
#{$✨}line-height: 1.45;
2022-12-29 17:44:09 +07:00
#{$✨}typography-spacing-top: 1.6875rem;
2022-10-23 10:47:50 +07:00
}
2023-02-13 20:19:54 +07:00
h6 {
#{$✨}font-size: 1rem;
#{$✨}typography-spacing-top: 1.5rem;
}
2022-10-23 10:47:50 +07:00
}
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
// Table
@if map.get($modules, "content/table") {
thead,
tfoot {
th,
td {
2023-03-18 08:21:37 +07:00
#{$✨}font-weight: 600;
2023-04-02 10:36:52 +07:00
#{$✨}border-width: 0.1875rem;
2022-10-23 10:47:50 +07:00
}
}
2021-07-02 16:54:41 +07:00
}
2022-10-23 10:47:50 +07:00
// Code
@if map.get($modules, "content/code") {
pre,
code,
kbd,
samp {
#{$✨}font-family: "Menlo", "Consolas", "Roboto Mono", "Ubuntu Monospace", "Noto Mono",
"Oxygen Mono", "Liberation Mono", monospace, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol", "Noto Color Emoji";
}
2021-07-02 16:54:41 +07:00
2022-10-23 10:47:50 +07:00
kbd {
#{$✨}font-weight: bolder;
}
}
2020-09-29 08:38:35 +07:00
2022-12-26 11:35:56 +07:00
// Inputs and Selects
2022-12-26 13:36:41 +07:00
input:not(
[type="submit"],
[type="button"],
[type="reset"],
[type="checkbox"],
[type="radio"],
[type="file"]
),
2022-12-26 11:35:56 +07:00
:where(select, textarea) {
#{$✨}outline-width: 0.0625rem;
}
2023-04-02 10:36:52 +07:00
[type="search"] {
#{$✨}border-radius: 5rem;
}
2022-10-23 10:47:50 +07:00
// Checkboxes, Radios and Switches
@if map.get($modules, "forms/checkbox-radio-switch") {
[type="checkbox"],
[type="radio"] {
2022-12-26 11:35:56 +07:00
#{$✨}border-width: 0.125rem;
2022-10-23 10:47:50 +07:00
}
[type="checkbox"][role="switch"] {
2022-12-26 11:35:56 +07:00
#{$✨}border-width: 0.1875rem;
2022-10-23 10:47:50 +07:00
}
}
2022-12-29 17:48:18 +07:00
2023-04-02 22:37:00 +07:00
// Dropdown (details.dropdown)
@if map.get($modules, "components/dropdown") and $enable-classes {
details.dropdown {
2022-12-29 17:48:18 +07:00
summary:not([role="button"]) {
#{$✨}outline-width: 0.0625rem;
}
}
2023-04-01 10:09:45 +07:00
nav {
2023-04-02 22:37:00 +07:00
details.dropdown {
2023-04-01 10:09:45 +07:00
summary:focus-visible {
#{$✨}outline-width: 0.1875rem;
}
}
}
2022-12-29 17:48:18 +07:00
}
2023-04-02 10:36:52 +07:00
// Group (role="group")
@if map.get($modules, "components/group") {
[role="search"] {
#{$✨}border-radius: 5rem;
}
[role="search"],
[role="group"] {
@if $enable-classes {
&:has(
button.secondary:focus,
[type="submit"].secondary:focus,
[type="button"].secondary:focus,
[role="button"].secondary:focus
) {
2023-04-02 11:04:23 +07:00
#{$}group-box-shadow-focus-with-button: 0
2023-04-02 10:36:52 +07:00
0
0
var(#{$}outline-width)
var(#{$}secondary-focus);
}
&:has(
button.contrast:focus,
[type="submit"].contrast:focus,
[type="button"].contrast:focus,
[role="button"].contrast:focus
) {
2023-04-02 11:04:23 +07:00
#{$}group-box-shadow-focus-with-button: 0
2023-04-02 10:36:52 +07:00
0
0
var(#{$}outline-width)
var(#{$}contrast-focus);
}
}
button,
[type="submit"],
[type="button"],
[role="button"] {
#{$✨}form-element-spacing-horizontal: 2rem;
}
}
}
2020-09-29 08:38:35 +07:00
}