Skip to content

Commit ce2ed68

Browse files
committed
refactor: modules and css vars
1 parent 2e4d6c6 commit ce2ed68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+3704
-3364
lines changed

css/pico.classless.css

Lines changed: 297 additions & 298 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/pico.classless.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/pico.classless.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/pico.css

Lines changed: 399 additions & 403 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/pico.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/pico.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scss/_settings.scss

Lines changed: 79 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
@use "sass:map";
22

3-
// Config
3+
// Settings
44
// ––––––––––––––––––––
55

66
// Prefix for CSS variables
77
$css-var-prefix: "pico-" !default;
88

9-
// Set the root element for $enable-semantic-container and $enable-responsive-spacings
9+
// Define the root element used to target <header>, <main>, <footer>
10+
// with $enable-semantic-container and $enable-responsive-spacings
1011
$semantic-root-element: "body" !default;
1112

1213
// Enable <header>, <main>, <footer> inside $semantic-root-element as containers
1314
$enable-semantic-container: false !default;
1415

15-
// Enable .container and .container-fluid
16-
$enable-class-container: true !default;
17-
18-
// Enable a centered viewport for <header>, <main>, <footer> inside $enable-semantic-container
16+
// Enable a centered viewport for <header>, <main>, <footer> inside $semantic-root-element
1917
// Fluid layout if disabled
2018
$enable-viewport: true !default;
2119

@@ -31,9 +29,6 @@ $enable-responsive-typography: true !default;
3129
// .classless version if disabled
3230
$enable-classes: true !default;
3331

34-
// Enable .grid class
35-
$enable-grid: true !default;
36-
3732
// Enable transitions
3833
$enable-transitions: true !default;
3934

@@ -44,33 +39,87 @@ $enable-important: true !default;
4439
$breakpoints: () !default;
4540
$breakpoints: map.deep-merge(
4641
(
47-
// Small (landscape phones)
48-
sm: (
49-
breakpoint: 576px,
50-
viewport: 510px,
51-
root-font-size: 17px,
52-
),
42+
// Small (landscape phones)
43+
sm:
44+
(
45+
breakpoint: 576px,
46+
viewport: 510px,
47+
root-font-size: 17px,
48+
),
5349
// Medium (tablets)
54-
md: (
55-
breakpoint: 768px,
56-
viewport: 700px,
57-
root-font-size: 18px,
58-
),
50+
md:
51+
(
52+
breakpoint: 768px,
53+
viewport: 700px,
54+
root-font-size: 18px,
55+
),
5956
// Large (desktops)
60-
lg: (
61-
breakpoint: 992px,
62-
viewport: 920px,
63-
root-font-size: 19px,
64-
),
57+
lg:
58+
(
59+
breakpoint: 992px,
60+
viewport: 920px,
61+
root-font-size: 19px,
62+
),
6563
// Extra large (large desktops)
66-
xl: (
67-
breakpoint: 1200px,
68-
viewport: 1130px,
69-
root-font-size: 20px,
70-
),
64+
xl:
65+
(
66+
breakpoint: 1200px,
67+
viewport: 1130px,
68+
root-font-size: 20px,
69+
)
7170
),
7271
$breakpoints
7372
);
7473

74+
// Modules to export
75+
$modules: () !default;
76+
$modules: map.merge(
77+
(
78+
// Theme
79+
"themes/default": true,
80+
81+
// Layout
82+
"layout/document": true,
83+
"layout/landmarks": true,
84+
"layout/container": true,
85+
"layout/section": true,
86+
"layout/grid": true,
87+
"layout/scroller": true,
88+
89+
// Content
90+
"content/link": true,
91+
"content/typography": true,
92+
"content/embedded": true,
93+
"content/button": true,
94+
"content/table": true,
95+
"content/code": true,
96+
"content/miscs": true,
97+
98+
// Forms
99+
"forms/basics": true,
100+
"forms/checkbox-radio-switch": true,
101+
"forms/input-color": true,
102+
"forms/input-date": true,
103+
"forms/input-file": true,
104+
"forms/input-range": true,
105+
"forms/input-search": true,
106+
107+
// Components
108+
"components/accordion": true,
109+
"components/card": true,
110+
"components/dropdown": true,
111+
"components/loading": true,
112+
"components/modal": true,
113+
"components/nav": true,
114+
"components/progress": true,
115+
"components/tooltip": true,
116+
117+
// Utilities
118+
"utilities/accessibility": true,
119+
"utilities/reduce-motion": true
120+
),
121+
$modules
122+
);
123+
75124
// // Shortcut for CSS vars prefix
76125
$✨: --#{$css-var-prefix};

scss/components/_accordion.scss

Lines changed: 86 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,120 @@
1+
@use "sass:map";
12
@use "../settings" as *;
23

3-
/**
4-
* Accordion (<details>)
5-
*/
4+
@if map.get($modules, "components/accordion") {
5+
/**
6+
* Accordion (<details>)
7+
*/
68

7-
details {
8-
display: block;
9-
margin-bottom: var(#{$✨}spacing);
10-
padding-bottom: var(#{$✨}spacing);
11-
border-bottom: var(#{$✨}border-width) solid var(#{$✨}accordion-border-color);
12-
13-
summary {
14-
line-height: 1rem;
15-
list-style-type: none;
16-
cursor: pointer;
17-
18-
&:not([role]) {
19-
color: var(#{$✨}accordion-close-summary-color);
20-
}
21-
22-
@if $enable-transitions {
23-
transition: color var(#{$✨}transition);
24-
}
25-
26-
// Reset marker
27-
&::-webkit-details-marker {
28-
display: none;
29-
}
30-
31-
&::marker {
32-
display: none;
33-
}
9+
details {
10+
display: block;
11+
margin-bottom: var(#{$✨}spacing);
12+
padding-bottom: var(#{$✨}spacing);
13+
border-bottom: var(#{$✨}border-width) solid var(#{$✨}accordion-border-color);
3414

35-
&::-moz-list-bullet {
15+
summary {
16+
line-height: 1rem;
3617
list-style-type: none;
37-
}
18+
cursor: pointer;
3819

39-
// Marker
40-
&::after {
41-
display: block;
42-
width: 1rem;
43-
height: 1rem;
44-
margin-inline-start: calc(var(#{$✨}spacing, 1rem) * 0.5);
45-
float: right;
46-
transform: rotate(-90deg);
47-
background-image: var(#{$✨}icon-chevron);
48-
background-position: right center;
49-
background-size: 1rem auto;
50-
background-repeat: no-repeat;
51-
content: "";
20+
&:not([role]) {
21+
color: var(#{$✨}accordion-close-summary-color);
22+
}
5223

5324
@if $enable-transitions {
54-
transition: transform var(#{$✨}transition);
25+
transition: color var(#{$✨}transition);
5526
}
56-
}
5727

58-
&:focus {
59-
outline: none;
28+
// Reset marker
29+
&::-webkit-details-marker {
30+
display: none;
31+
}
6032

61-
&:not([role="button"]) {
62-
color: var(#{$✨}accordion-active-summary-color);
33+
&::marker {
34+
display: none;
6335
}
64-
}
6536

66-
// Type button
67-
&[role="button"] {
68-
width: 100%;
69-
text-align: left;
37+
&::-moz-list-bullet {
38+
list-style-type: none;
39+
}
7040

7141
// Marker
7242
&::after {
73-
height: calc(1rem * var(#{$✨}line-height, 1.5));
74-
background-image: var(#{$✨}icon-chevron-button);
43+
display: block;
44+
width: 1rem;
45+
height: 1rem;
46+
margin-inline-start: calc(var(#{$✨}spacing, 1rem) * 0.5);
47+
float: right;
48+
transform: rotate(-90deg);
49+
background-image: var(#{$✨}icon-chevron);
50+
background-position: right center;
51+
background-size: 1rem auto;
52+
background-repeat: no-repeat;
53+
content: "";
54+
55+
@if $enable-transitions {
56+
transition: transform var(#{$✨}transition);
57+
}
7558
}
7659

77-
@if $enable-classes {
78-
// .contrast
79-
&:not(.outline).contrast {
80-
// Marker
81-
&::after {
82-
background-image: var(#{$✨}icon-chevron-button-inverse);
60+
&:focus {
61+
outline: none;
62+
63+
&:not([role="button"]) {
64+
color: var(#{$✨}accordion-active-summary-color);
65+
}
66+
}
67+
68+
// Type button
69+
&[role="button"] {
70+
width: 100%;
71+
text-align: left;
72+
73+
// Marker
74+
&::after {
75+
height: calc(1rem * var(#{$✨}line-height, 1.5));
76+
background-image: var(#{$✨}icon-chevron-button);
77+
}
78+
79+
@if $enable-classes {
80+
// .contrast
81+
&:not(.outline).contrast {
82+
// Marker
83+
&::after {
84+
background-image: var(#{$✨}icon-chevron-button-inverse);
85+
}
8386
}
8487
}
8588
}
8689
}
87-
}
8890

89-
// Open
90-
&[open] {
91-
> summary {
92-
margin-bottom: calc(var(#{$✨}spacing));
91+
// Open
92+
&[open] {
93+
> summary {
94+
margin-bottom: calc(var(#{$✨}spacing));
9395

94-
&:not([role]) {
95-
&:not(:focus) {
96-
color: var(#{$✨}accordion-open-summary-color);
96+
&:not([role]) {
97+
&:not(:focus) {
98+
color: var(#{$✨}accordion-open-summary-color);
99+
}
97100
}
98-
}
99101

100-
&::after {
101-
transform: rotate(0);
102+
&::after {
103+
transform: rotate(0);
104+
}
102105
}
103106
}
104107
}
105-
}
106108

107-
[dir="rtl"] {
108-
details {
109-
summary {
110-
text-align: right;
109+
[dir="rtl"] {
110+
details {
111+
summary {
112+
text-align: right;
111113

112-
&::after {
113-
float: left;
114-
background-position: left center;
114+
&::after {
115+
float: left;
116+
background-position: left center;
117+
}
115118
}
116119
}
117120
}

0 commit comments

Comments
 (0)