@jrgermain/stylesheet 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,268 @@
1
+ @use "../utils";
2
+ @use "./layout";
3
+
4
+ .app {
5
+ min-width: 100svw;
6
+ min-height: 100svh;
7
+
8
+ > header {
9
+ height: var(--header-height);
10
+ width: 100%;
11
+ display: flex;
12
+ align-items: center;
13
+ color: var(--color-brand-3);
14
+ background-color: var(--color-body-alt);
15
+ border-bottom: var(--border-l) solid var(--color-brand-transparent);
16
+ box-shadow: var(--shadow-s);
17
+ padding-inline: max(var(--space-2xs), calc(50dvw - 55rem));
18
+
19
+ @media (prefers-color-scheme: dark) {
20
+ color: var(--color-brand-2);
21
+ }
22
+
23
+ > :is(.header-item, .toggle-sidebar) {
24
+ height: 100%;
25
+ padding: 0.5rem;
26
+ cursor: pointer;
27
+ text-decoration: none;
28
+ color: inherit;
29
+ transition-property: color;
30
+ transition-duration: 200ms;
31
+ transition-timing-function: ease;
32
+ display: flex;
33
+ align-items: center;
34
+ position: relative;
35
+ border-radius: var(--radius-s);
36
+ font-weight: var(--font-weight-semibold);
37
+
38
+ &:focus-visible {
39
+ outline-offset: calc(-1 * var(--border-m));
40
+ }
41
+
42
+ &:hover {
43
+ color: var(--color-body-text);
44
+ }
45
+
46
+ &:is([aria-current], .current) {
47
+ font-weight: var(--font-weight-bold);
48
+
49
+ &::after {
50
+ opacity: 1;
51
+ }
52
+ }
53
+
54
+ &::after {
55
+ content: "";
56
+ position: absolute;
57
+ width: 100%;
58
+ height: var(--border-l);
59
+ bottom: calc(-1 * var(--border-l));
60
+ left: 0;
61
+ background-color: currentcolor;
62
+ opacity: 0;
63
+ border-radius: 1px;
64
+ }
65
+ }
66
+
67
+ .toggle-sidebar {
68
+ @include utils.transition(("color", "background-color"));
69
+
70
+ display: none;
71
+ width: 2.75rem;
72
+ margin-inline-start: 1rem;
73
+
74
+ &:hover {
75
+ color: var(--color-body-text);
76
+ }
77
+
78
+ &:has(input:focus-visible) {
79
+ outline: var(--border-m) solid var(--color-brand-5);
80
+ outline-offset: calc(-1 * var(--border-m));
81
+ }
82
+
83
+ input[type="checkbox"] {
84
+ @extend %visually-hidden;
85
+ }
86
+
87
+ &::before {
88
+ content: "";
89
+ position: absolute;
90
+ top: 0;
91
+ left: -0.5rem;
92
+ height: 100%;
93
+ width: var(--border-s);
94
+ background-color: var(--color-outline);
95
+ }
96
+
97
+ > div {
98
+ @include utils.transition(("transform", "opacity"));
99
+
100
+ position: absolute;
101
+ width: 1.75rem;
102
+ height: 2px;
103
+ border-radius: 2px;
104
+ background-color: currentcolor;
105
+ opacity: 1;
106
+ top: 50%;
107
+ left: 50%;
108
+
109
+ &:nth-of-type(1) {
110
+ transform: translateY(calc(-50% - 0.45rem)) translateX(-50%);
111
+ }
112
+
113
+ &:nth-of-type(2) {
114
+ transform: translateY(-50%) translateX(-50%);
115
+ }
116
+
117
+ &:nth-of-type(3) {
118
+ transform: translateY(calc(-50% + 0.45rem)) translateX(-50%);
119
+ }
120
+ }
121
+
122
+ &:has(input:checked) > div {
123
+ &:nth-of-type(1) {
124
+ transform: translateY(-50%) translateX(-50%) rotate(45deg);
125
+ }
126
+
127
+ &:nth-of-type(2) {
128
+ opacity: 0;
129
+ transform: translateY(-50%) translateX(-50%) rotate3d(0, 1, 0, 90deg);
130
+ }
131
+
132
+ &:nth-of-type(3) {
133
+ transform: translateY(-50%) translateX(-50%) rotate(-45deg);
134
+ }
135
+ }
136
+ }
137
+ }
138
+
139
+ > .sidebar {
140
+ overflow: auto;
141
+ transition:
142
+ opacity 150ms ease,
143
+ display 150ms allow-discrete;
144
+ display: flex;
145
+ flex-direction: column;
146
+ padding: var(--space-body);
147
+ width: var(--sidebar-width);
148
+ gap: var(--space-3xs);
149
+ position: fixed;
150
+ top: var(--header-height);
151
+ left: 0;
152
+ height: calc(100dvh - var(--header-height));
153
+ z-index: 3;
154
+ opacity: 1;
155
+
156
+ &::after {
157
+ content: "";
158
+ height: calc(100dvh - var(--header-height) - 2 * var(--space-s));
159
+ width: var(--border-s);
160
+ background-color: var(--color-outline);
161
+ position: fixed;
162
+ top: calc(var(--header-height) + var(--space-s));
163
+ left: calc(var(--sidebar-width) - var(--border-s));
164
+ }
165
+
166
+ .sidebar-heading {
167
+ font-size: 1.2rem;
168
+ margin: var(--space-s) 0 var(--space-3xs);
169
+ font-weight: var(--font-weight-semibold);
170
+
171
+ &:first-of-type {
172
+ margin-block-start: 0;
173
+ }
174
+ }
175
+
176
+ .sidebar-item {
177
+ padding: var(--space-2xs) var(--space-xs);
178
+ margin: 0 calc(-1 * var(--space-xs));
179
+ border-radius: var(--radius-l);
180
+ color: var(--color-body-text-alt);
181
+ text-decoration: none;
182
+ font-weight: var(--font-weight-normal);
183
+ font-size: 1rem;
184
+ transition-property: color, background-color, box-shadow;
185
+ transition-duration: 200ms;
186
+ transition-timing-function: ease;
187
+
188
+ &:hover {
189
+ background-color: var(--color-brand-extra-transparent);
190
+ }
191
+
192
+ &:active {
193
+ color: var(--color-brand-1);
194
+ }
195
+
196
+ &:is(.current, [aria-current="page"]) {
197
+ color: var(--color-brand-4);
198
+ font-weight: var(--font-weight-bold);
199
+ }
200
+
201
+ &:hover:active {
202
+ background-color: var(--color-brand-transparent);
203
+ }
204
+
205
+ &:focus-visible {
206
+ outline-offset: 0;
207
+ }
208
+ }
209
+ }
210
+
211
+ > .content {
212
+ padding: var(--space-body);
213
+ padding-inline: max(var(--space-body), calc(50dvw - 55rem));
214
+ width: 100%;
215
+ }
216
+
217
+ &:has(> .sidebar) {
218
+ height: 100dvh;
219
+ width: 100dvw;
220
+
221
+ > header {
222
+ position: fixed;
223
+ top: 0;
224
+ left: 0;
225
+ padding-inline: var(--space-2xs);
226
+ }
227
+
228
+ > .content {
229
+ overflow: auto;
230
+ position: fixed;
231
+ top: var(--header-height);
232
+ left: var(--sidebar-width);
233
+ width: calc(100dvw - var(--sidebar-width));
234
+ height: calc(100dvh - var(--header-height));
235
+ }
236
+ }
237
+
238
+ @media (width < 55rem) {
239
+ > header .toggle-sidebar {
240
+ display: initial;
241
+ }
242
+
243
+ > .sidebar {
244
+ width: 100dvw;
245
+ opacity: 1;
246
+ background-color: #fffc;
247
+ backdrop-filter: blur(24px) saturate(120%);
248
+
249
+ @media (prefers-color-scheme: dark) {
250
+ background-color: #000c;
251
+ }
252
+
253
+ &::after {
254
+ content: initial;
255
+ }
256
+ }
257
+
258
+ > header:has(.toggle-sidebar input:not(:checked)) ~ .sidebar {
259
+ opacity: 0;
260
+ display: none;
261
+ }
262
+
263
+ > .content {
264
+ left: 0 !important;
265
+ width: 100dvw !important;
266
+ }
267
+ }
268
+ }
@@ -0,0 +1,220 @@
1
+ :is(
2
+ button,
3
+ .button,
4
+ input[type="button"],
5
+ input[type="submit"],
6
+ input[type="reset"]
7
+ ):not(.chip, .card, .chip .delete, .input-group .action) {
8
+ --button-shadow: var(--shadow-s);
9
+ --button-hover-bg-color: var(--button-border-color);
10
+
11
+ box-sizing: border-box;
12
+ display: inline-flex;
13
+ outline: 0;
14
+ padding-inline: 1.25em;
15
+ padding-block: 0.75em;
16
+ gap: 0.5em;
17
+ border-style: solid;
18
+ transform: scale(1);
19
+ transition-property: box-shadow, background-color, transform, opacity;
20
+ transition-duration: 200ms;
21
+ transition-timing-function: ease;
22
+ text-decoration: none;
23
+ position: relative;
24
+ align-items: center;
25
+ justify-content: center;
26
+ overflow: hidden;
27
+ cursor: pointer;
28
+ border-width: var(--border-s);
29
+ border-radius: var(--radius-m);
30
+ min-height: 2.6em;
31
+ min-width: 3em;
32
+ line-height: 1;
33
+ font-family: var(--font-family-ui);
34
+ box-shadow: var(--button-shadow);
35
+ user-select: none;
36
+ font-size: 1rem;
37
+
38
+ &::before {
39
+ content: "";
40
+ background-color: var(--button-hover-bg-color);
41
+ position: absolute;
42
+ inset: 0;
43
+ margin: auto;
44
+ transition-property: opacity, width, height, border-radius;
45
+ transition-duration: 200ms;
46
+ transition-timing-function: ease;
47
+ z-index: -1;
48
+ border-radius: 2em;
49
+ width: 4em;
50
+ height: 4em;
51
+ opacity: 0;
52
+ }
53
+
54
+ &:is(:focus-visible, .focus) {
55
+ box-shadow:
56
+ var(--button-shadow),
57
+ 0 0 0 0.1em var(--button-border-color),
58
+ 0 0 0 calc(0.2em + var(--border-s)) var(--button-focus-ring-color);
59
+ }
60
+
61
+ &:is(:active, .active) {
62
+ transform: scale(0.98);
63
+
64
+ // On low-resolution screens, the scale effect makes text jump
65
+ // around awkwardly, so we use an alternative.
66
+ @media screen and (resolution < 2x) {
67
+ transform: translateY(1px);
68
+ }
69
+ }
70
+
71
+ &:is(:hover, .hover) {
72
+ text-decoration: none;
73
+
74
+ &::before {
75
+ opacity: 1;
76
+ width: 100%;
77
+ height: 100%;
78
+ border-radius: 5px;
79
+ }
80
+
81
+ // inputs don't support children, so the ::before pseudo element won't work
82
+ &:is(input) {
83
+ background-color: var(--button-hover-bg-color);
84
+ }
85
+ }
86
+
87
+ color: var(--button-fg-color);
88
+ background-color: var(--button-bg-color);
89
+ border-color: var(--button-border-color);
90
+ font-weight: var(--button-font-weight);
91
+
92
+ &.primary {
93
+ --button-fg-color: white;
94
+ --button-bg-color: var(--color-brand-5);
95
+ --button-border-color: var(--color-brand-4);
96
+ --button-font-weight: var(--font-weight-bold);
97
+ --button-focus-ring-color: var(--color-brand-transparent);
98
+
99
+ @each $color
100
+ in (
101
+ "red",
102
+ "orange",
103
+ "yellow",
104
+ "green",
105
+ "sky",
106
+ "blue",
107
+ "purple",
108
+ "magenta",
109
+ "gray"
110
+ )
111
+ {
112
+ &.#{$color} {
113
+ --button-bg-color: var(--color-#{$color}-5);
114
+ --button-border-color: var(--color-#{$color}-4);
115
+ --button-focus-ring-color: var(--color-#{$color}-transparent);
116
+ }
117
+ }
118
+ }
119
+
120
+ // .secondary, default
121
+ &:not(.primary, .subtle, .close) {
122
+ --button-fg-color: var(--color-body-text);
123
+ --button-bg-color: var(--color-gray-9);
124
+ --button-border-color: var(--color-gray-8);
125
+ --button-font-weight: var(--font-weight-normal);
126
+ --button-focus-ring-color: var(--color-gray-extra-transparent);
127
+ }
128
+
129
+ &:is(.subtle, .close) {
130
+ --button-fg-color: var(--color-brand-4);
131
+ --button-bg-color: transparent;
132
+ --button-border-color: transparent;
133
+ --button-hover-bg-color: var(--color-brand-extra-transparent);
134
+ --button-font-weight: var(--font-weight-bold);
135
+ --button-focus-ring-color: transparent;
136
+ --button-shadow: none;
137
+
138
+ &:is(:focus-visible, .focus) {
139
+ --button-bg-color: var(--color-brand-transparent);
140
+ --button-hover-bg-color: transparent;
141
+ }
142
+ }
143
+
144
+ &:is(.small, .close) {
145
+ font-size: 0.8rem;
146
+ }
147
+
148
+ &.large {
149
+ font-size: 1.2rem;
150
+ }
151
+
152
+ &:is(.icon, .close) {
153
+ border-radius: var(--radius-full);
154
+ padding-inline: 0.5em;
155
+ padding-block: 0.5em;
156
+ min-width: 0;
157
+ min-height: 0;
158
+ aspect-ratio: 1;
159
+
160
+ &:is(.subtle, .close) {
161
+ &::before {
162
+ width: 75%;
163
+ height: 75%;
164
+ }
165
+
166
+ &:is(:hover, .hover)::before {
167
+ width: 100%;
168
+ height: 100%;
169
+ border-radius: 100%;
170
+ }
171
+ }
172
+
173
+ &:not(.subtle, .close) {
174
+ &::before {
175
+ content: unset;
176
+ }
177
+
178
+ &:is(:hover, .hover) {
179
+ background-color: var(--button-hover-bg-color);
180
+ }
181
+ }
182
+ }
183
+
184
+ &:is(:disabled, .disabled, [aria-disabled="true"]) {
185
+ opacity: 0.7;
186
+ cursor: not-allowed;
187
+ transform: scale(1);
188
+
189
+ &:is(:hover, .hover)::before {
190
+ opacity: 0;
191
+ }
192
+ }
193
+
194
+ &.loading {
195
+ cursor: wait;
196
+
197
+ &::before {
198
+ opacity: 1 !important;
199
+ height: 100% !important;
200
+ border-radius: inherit !important;
201
+ animation: button-loading-bg 1200ms ease-in-out infinite forwards;
202
+ }
203
+ }
204
+ }
205
+
206
+ @keyframes button-loading-bg {
207
+ 0% {
208
+ width: 0;
209
+ margin: 0 auto 0 0;
210
+ }
211
+
212
+ 50% {
213
+ width: 100%;
214
+ }
215
+
216
+ 100% {
217
+ width: 0;
218
+ margin: 0 0 0 auto;
219
+ }
220
+ }
@@ -0,0 +1,37 @@
1
+ .card {
2
+ background-color: var(--color-body-alt);
3
+ border-radius: var(--radius-l);
4
+ border: var(--border-s) solid var(--color-outline);
5
+ box-shadow: var(--shadow-m);
6
+
7
+ &.secondary {
8
+ background-color: var(--color-body);
9
+ border-radius: var(--radius-m);
10
+ color: var(--color-body-text-alt);
11
+ box-shadow: var(--shadow-s);
12
+
13
+ .card-title {
14
+ font-size: var(--font-size-m);
15
+ margin-block-end: var(--space-2xs);
16
+ }
17
+
18
+ &:not(.no-padding) {
19
+ padding: var(--space-s);
20
+ }
21
+ }
22
+
23
+ &:not(.no-padding) {
24
+ padding: var(--space-m);
25
+
26
+ .card-title {
27
+ margin-block-start: 0;
28
+ }
29
+ }
30
+ }
31
+
32
+ .card-title {
33
+ font-size: var(--font-size-l);
34
+ font-weight: var(--font-weight-bold);
35
+ color: var(--color-brand-3);
36
+ margin-block-end: var(--space-xs);
37
+ }
@@ -0,0 +1,165 @@
1
+ @use "../utils";
2
+
3
+ $color-variants: (
4
+ "red",
5
+ "orange",
6
+ "yellow",
7
+ "green",
8
+ "sky",
9
+ "blue",
10
+ "purple",
11
+ "magenta",
12
+ "brand",
13
+ "gray"
14
+ );
15
+
16
+ .chip {
17
+ --chip-fg-color: white;
18
+
19
+ display: inline-flex;
20
+ align-items: center;
21
+ border-radius: var(--radius-full);
22
+ font-size: var(--font-size-s);
23
+ padding-block: var(--space-3xs);
24
+ padding-inline: var(--space-xs);
25
+ background-color: var(--chip-bg-color);
26
+ border: var(--border-s) solid var(--chip-border-color);
27
+ color: var(--chip-fg-color);
28
+ flex-shrink: 0;
29
+ cursor: default;
30
+ transition-property: box-shadow, background-color, border-color;
31
+ transition-duration: 200ms;
32
+ transition-timing-function: ease;
33
+ text-decoration: none;
34
+ appearance: none;
35
+ line-height: 1.2;
36
+
37
+ &:is(:focus-visible, .focus) {
38
+ box-shadow: 0 0 0 0.2em var(--chip-focus-ring-color);
39
+ }
40
+
41
+ &.clickable {
42
+ cursor: pointer;
43
+ box-shadow: var(--shadow-s);
44
+
45
+ &:is(:focus-visible, .focus) {
46
+ outline: 0;
47
+ box-shadow:
48
+ var(--shadow-s),
49
+ 0 0 0 0.2em var(--chip-focus-ring-color);
50
+ }
51
+
52
+ &:is(:hover, .hover) {
53
+ background-color: var(--chip-border-color);
54
+ }
55
+
56
+ &:is(:active, .active) {
57
+ background-color: var(--chip-bg-color-active);
58
+ border-color: var(--chip-bg-color-active);
59
+ }
60
+ }
61
+
62
+ @each $color in $color-variants {
63
+ &.#{$color} {
64
+ --chip-bg-color: var(--color-#{$color}-6);
65
+ --chip-border-color: var(--color-#{$color}-7);
66
+ --chip-focus-ring-color: var(--color-#{$color}-transparent);
67
+ --chip-bg-color-active: var(--color-#{$color}-5);
68
+ }
69
+ }
70
+
71
+ &.black {
72
+ --chip-bg-color: black;
73
+ --chip-border-color: var(--color-gray-4);
74
+ --chip-focus-ring-color: var(--color-gray-transparent);
75
+ --chip-bg-color-active: var(--color-gray-1);
76
+ }
77
+
78
+ &.white {
79
+ --chip-fg-color: black;
80
+ --chip-bg-color: white;
81
+ --chip-border-color: var(--color-gray-8);
82
+ --chip-focus-ring-color: var(--color-gray-transparent);
83
+ --chip-bg-color-active: var(--color-gray-7);
84
+ }
85
+
86
+ @media (prefers-color-scheme: dark) {
87
+ @each $color in $color-variants {
88
+ &.#{$color} {
89
+ --chip-border-color: var(--color-#{$color}-5);
90
+ --chip-bg-color-active: var(--color-#{$color}-7);
91
+ }
92
+ }
93
+
94
+ &.black {
95
+ --chip-border-color: var(--color-gray-7);
96
+ --chip-bg-color-active: var(--color-gray-8);
97
+ }
98
+
99
+ &.white {
100
+ --chip-border-color: var(--color-gray-2);
101
+ --chip-bg-color-active: var(--color-gray-3);
102
+ }
103
+ }
104
+
105
+ :is(button, .button).delete {
106
+ outline: 0;
107
+ margin-inline: var(--space-3xs) calc(-1 * var(--space-2xs));
108
+ font-size: 0.6em;
109
+ border: var(--border-s) solid var(--chip-border-color);
110
+ border-radius: var(--radius-full);
111
+ transition-property: box-shadow, background-color, transform, opacity,
112
+ border-color;
113
+ transition-duration: 200ms;
114
+ transition-timing-function: ease;
115
+ position: relative;
116
+ align-items: center;
117
+ justify-content: center;
118
+ overflow: hidden;
119
+ cursor: pointer;
120
+ height: 2em;
121
+ width: 2em;
122
+ user-select: none;
123
+ background-color: transparent;
124
+ padding: 0;
125
+ display: inline-flex;
126
+
127
+ &::before {
128
+ content: "";
129
+ width: 100%;
130
+ height: 100%;
131
+ opacity: 0.7;
132
+ position: absolute;
133
+ inset-block-start: 0;
134
+ inset-inline-start: 0;
135
+ background-color: var(--chip-border-color);
136
+ transition-duration: 200ms;
137
+ transition-timing-function: ease;
138
+ transition-property: background-color, opacity;
139
+ }
140
+
141
+ &::after {
142
+ content: "";
143
+ width: 1.2em;
144
+ height: 1.2em;
145
+ mask-image: #{utils.svg-to-data-url(
146
+ '<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><path fill="black" d="M208.49 191.51a12 12 0 0 1-17 17L128 145l-63.51 63.49a12 12 0 0 1-17-17L111 128L47.51 64.49a12 12 0 0 1 17-17L128 111l63.51-63.52a12 12 0 0 1 17 17L145 128Z"/></svg>'
147
+ )};
148
+ mask-size: contain;
149
+ mask-repeat: no-repeat;
150
+ background-color: var(--chip-fg-color);
151
+ }
152
+
153
+ &:is(:focus-visible, .focus) {
154
+ border-color: var(--chip-fg-color);
155
+ }
156
+
157
+ &:is(:hover, .hover, :focus-visible, .focus)::before {
158
+ opacity: 1;
159
+ }
160
+
161
+ &:is(:active, .active)::before {
162
+ opacity: 0.5;
163
+ }
164
+ }
165
+ }