@primer/css 0.0.0-20220620061649 → 0.0.0-20220621152621

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.
@@ -1,50 +1,7 @@
1
1
  // stylelint-disable selector-max-compound-selectors, max-nesting-depth, selector-max-specificity, primer/borders
2
- // replace with primitives
2
+ // replace with primitive
3
3
  $primer-borderRadius-large: 0.75rem;
4
4
 
5
- // https://github.com/github/primer/issues/1026
6
- $primer-duration-slow: 250ms;
7
- $primer-easing-out: cubic-bezier(0.33, 1, 0.68, 1);
8
-
9
- $Overlay-width: (
10
- xsmall: 192px,
11
- small: 256px,
12
- medium: 320px,
13
- large: 480px,
14
- xlarge: 640px,
15
- xxlarge: 960px
16
- ) !default;
17
-
18
- $Overlay-height: (
19
- xsmall: 192px,
20
- small: 256px,
21
- medium: 320px,
22
- large: 432px,
23
- xlarge: 600px
24
- ) !default;
25
-
26
- // Overlay structure
27
- // =================
28
- //
29
- // .Overlay-backdrop
30
- // ├─ .Overlay
31
- // │ ├─ .Overlay-header
32
- // │ │ ├─ .Overlay-headerContentWrap
33
- // │ │ │ ├─ .Overlay-titleWrap
34
- // │ │ │ │ ├─ .Overlay-title
35
- // │ │ │ │ ├─ .Overlay-description
36
- // │ │ ├─ .Overlay-actionWrap
37
- // │ │ │ ├─ .Overlay-closeButton
38
- // │ ├─ .Overlay-body
39
- // │ ├─ .Overlay-footer
40
- //
41
- // Todo:
42
- // - Overlay-form?
43
- // - Deprecate Overlay-closeButton in favor of redesigned iconButton
44
-
45
- // Visibility
46
- // Todo: these are applied to `Overlay-backdrop`, not to `Overlay`
47
-
48
5
  .Overlay--hidden {
49
6
  display: none !important;
50
7
  }
@@ -57,92 +14,82 @@ $Overlay-height: (
57
14
  }
58
15
 
59
16
  .Overlay {
60
- position: relative;
61
17
  display: flex;
62
- min-width: #{map-get($Overlay-width, 'xsmall')};
18
+ min-width: 192px;
63
19
  flex-direction: column;
64
20
  background-color: var(--color-canvas-overlay);
65
21
  border-radius: $primer-borderRadius-large;
66
22
  box-shadow: var(--color-overlay-shadow);
67
23
  opacity: 1;
68
- max-height: 100vh;
69
-
70
- @supports (height: 100dvh) {
71
- max-height: 100dvh;
72
- }
73
-
74
- // Dimensions
75
- // Todo: auto-generate based on Scss variables?
76
24
 
77
25
  &.Overlay--height-auto {
78
26
  height: auto;
79
27
  }
80
28
 
81
29
  &.Overlay--height-xsmall {
82
- height: min(#{map-get($Overlay-height, 'xsmall')}, 100vh - 2rem);
30
+ height: min(192px, 100vh - 2rem);
83
31
  }
84
32
 
85
33
  &.Overlay--height-small {
86
- height: min(#{map-get($Overlay-height, 'small')}, 100vh - 2rem);
34
+ height: min(256px, 100vh - 2rem);
87
35
  }
88
36
 
89
37
  &.Overlay--height-medium {
90
- height: min(#{map-get($Overlay-height, 'medium')}, 100vh - 2rem);
38
+ height: min(320px, 100vh - 2rem);
91
39
  }
92
40
 
93
41
  &.Overlay--height-large {
94
- height: min(#{map-get($Overlay-height, 'large')}, 100vh - 2rem);
42
+ height: min(432px, 100vh - 2rem);
95
43
  }
96
44
 
97
45
  &.Overlay--height-xlarge {
98
- height: min(#{map-get($Overlay-height, 'xlarge')}, 100vh - 2rem);
46
+ height: min(600px, 100vh - 2rem);
99
47
  }
100
48
 
101
49
  &.Overlay--width-auto {
102
50
  width: auto;
103
51
  }
104
52
 
105
- &.Overlay--width-xsmall {
106
- width: min(#{map-get($Overlay-width, 'xsmall')}, 100vw - 2rem);
107
- }
108
-
109
53
  &.Overlay--width-small {
110
- width: min(#{map-get($Overlay-width, 'small')}, 100vw - 2rem);
54
+ width: min(256px, 100vw - 2rem);
111
55
  }
112
56
 
113
57
  &.Overlay--width-medium {
114
- width: min(#{map-get($Overlay-width, 'medium')}, 100vw - 2rem);
58
+ width: min(320px, 100vw - 2rem);
115
59
  }
116
60
 
117
61
  &.Overlay--width-large {
118
62
  // stylelint-disable-next-line primer/responsive-widths
119
- width: min(#{map-get($Overlay-width, 'large')}, 100vw - 2rem);
63
+ width: min(480px, 100vw - 2rem);
120
64
  }
121
65
 
122
66
  &.Overlay--width-xlarge {
123
67
  // stylelint-disable-next-line primer/responsive-widths
124
- width: min(#{map-get($Overlay-width, 'xlarge')}, 100vw - 2rem);
68
+ width: min(640px, 100vw - 2rem);
125
69
  }
126
70
 
127
71
  &.Overlay--width-xxlarge {
128
72
  // stylelint-disable-next-line primer/responsive-widths
129
- width: min(#{map-get($Overlay-width, 'xxlarge')}, 100vw - 2rem);
73
+ width: min(960px, 100vw - 2rem);
130
74
  }
131
75
 
132
- // Motion
133
-
134
76
  &.Overlay--motion-scaleFade {
135
- @media (prefers-reduced-motion: no-preference) {
136
- // Todo: replace with primer-duration-slow token
137
- animation: $primer-duration-slow $primer-easing-out Overlay--motion-scaleFade;
77
+ @media screen and (prefers-reduced-motion: no-preference) {
78
+ animation: 200ms cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running Overlay--motion-scaleFade;
138
79
  }
139
80
  }
140
81
 
141
- // &.Overlay--motion-slide {
142
- // @media (prefers-reduced-motion: no-preference) {
143
- // animation: $primer-duration-slow $primer-easing-out Overlay--motion-slide;
144
- // }
145
- // }
82
+ @keyframes Overlay--motion-scaleFade {
83
+ 0% {
84
+ opacity: 0;
85
+ transform: scale(0.5);
86
+ }
87
+
88
+ 100% {
89
+ opacity: 1;
90
+ transform: scale(1);
91
+ }
92
+ }
146
93
  }
147
94
 
148
95
  // for <form> element that wraps entire contents of overlay
@@ -163,10 +110,6 @@ $Overlay-height: (
163
110
  // stylelint-disable-next-line primer/box-shadow
164
111
  box-shadow: inset 0 #{-$border-width} var(--color-border-default);
165
112
 
166
- .Overlay-subHeader {
167
- margin-bottom: -$spacer-2;
168
- }
169
-
170
113
  + .Overlay-body {
171
114
  padding-top: $spacer-3;
172
115
  }
@@ -188,12 +131,6 @@ $Overlay-height: (
188
131
  }
189
132
  }
190
133
 
191
- &.Overlay-header--custom {
192
- .Overlay-title, .Overlay-description {
193
- display: none !important;
194
- }
195
- }
196
-
197
134
  .Overlay-headerContentWrap {
198
135
  display: flex;
199
136
  align-items: flex-start;
@@ -229,10 +166,6 @@ $Overlay-height: (
229
166
  }
230
167
  }
231
168
 
232
- .Overlay-subHeader {
233
- padding-inline: $spacer-2;
234
- }
235
-
236
169
  // generic body content slot
237
170
  .Overlay-body {
238
171
  padding: $spacer-3;
@@ -322,8 +255,8 @@ $Overlay-height: (
322
255
 
323
256
  @mixin Overlay-backdrop--transparent() {
324
257
  position: absolute;
325
- background-color: transparent;
326
258
  z-index: 999;
259
+ background-color: transparent;
327
260
  }
328
261
 
329
262
  // variants must be mixins so we can extend within a media query (@extend is not supported inside media queries)
@@ -343,70 +276,56 @@ $Overlay-height: (
343
276
  @include Overlay-backdrop--transparent;
344
277
 
345
278
  .Overlay {
346
- //width: auto;
279
+ width: auto;
347
280
  }
348
281
  }
349
282
 
350
283
  // anchor side(s)
351
- @mixin Overlay-backdrop--side($viewportRange: '') {
284
+ @mixin Overlay-backdrop--side($responsiveVariant: '') {
352
285
  @include Overlay-backdrop;
353
286
 
354
287
  // default left
355
288
  align-items: center;
356
289
  justify-content: left;
357
290
 
358
- &.Overlay-backdrop--placement-left#{$viewportRange} {
291
+ &.Overlay-backdrop--placement-left#{$responsiveVariant} {
359
292
  align-items: center;
360
293
  justify-content: left;
361
294
 
362
- .Overlay {
363
- animation: $primer-duration-slow $primer-easing-out Overlay--motion-slideInRight;
295
+ .Overlay#{$responsiveVariant} {
364
296
  border-radius: $primer-borderRadius-large;
365
297
  border-top-left-radius: 0;
366
298
  border-bottom-left-radius: 0;
367
- height: 100vh;
368
-
369
- @supports(height: 100dvh) {
370
- height: 100dvh;
371
- }
372
299
  }
373
300
  }
374
301
 
375
- &.Overlay-backdrop--placement-right#{$viewportRange} {
302
+ &.Overlay-backdrop--placement-right#{$responsiveVariant} {
376
303
  align-items: center;
377
304
  justify-content: right;
378
305
 
379
- .Overlay {
380
- animation: $primer-duration-slow $primer-easing-out Overlay--motion-slideInLeft;
306
+ .Overlay#{$responsiveVariant} {
381
307
  border-radius: $primer-borderRadius-large;
382
308
  border-top-right-radius: 0;
383
309
  border-bottom-right-radius: 0;
384
- height: 100vh;
385
-
386
- @supports(height: 100dvh) {
387
- height: 100dvh;
388
- }
389
310
  }
390
311
  }
391
312
 
392
- &.Overlay-backdrop--placement-bottom#{$viewportRange} {
313
+ &.Overlay-backdrop--placement-bottom#{$responsiveVariant} {
393
314
  align-items: end;
394
315
  justify-content: center;
395
316
 
396
- .Overlay {
397
- animation: $primer-duration-slow $primer-easing-out Overlay--motion-slideInUp;
317
+ .Overlay#{$responsiveVariant} {
398
318
  border-radius: $primer-borderRadius-large;
399
319
  border-bottom-right-radius: 0;
400
320
  border-bottom-left-radius: 0;
401
321
  }
402
322
  }
403
323
 
404
- &.Overlay-backdrop--placement-top#{$viewportRange} {
324
+ &.Overlay-backdrop--placement-top#{$responsiveVariant} {
405
325
  align-items: start;
406
326
  justify-content: center;
407
327
 
408
- .Overlay {
409
- animation: $primer-duration-slow $primer-easing-out Overlay--motion-slideInDown;
328
+ .Overlay#{$responsiveVariant} {
410
329
  border-radius: $primer-borderRadius-large;
411
330
  border-top-left-radius: 0;
412
331
  border-top-right-radius: 0;
@@ -425,32 +344,24 @@ $Overlay-height: (
425
344
  max-height: 100vh;
426
345
  border-radius: unset;
427
346
  flex-grow: 1;
428
-
429
- @supports(height: 100dvh) {
430
- max-width: 100dvw;
431
- max-height: 100dvh;
432
- }
433
347
  }
434
348
  }
435
349
 
436
350
  // Overlay variant classnames
437
- @media (min-width: #{map-get($breakpoints, 'md')}) {
438
- // Regular viewports
439
- .Overlay-backdrop--center {
440
- @include Overlay-backdrop--center;
441
- }
351
+ .Overlay-backdrop--center {
352
+ @include Overlay-backdrop--center;
353
+ }
442
354
 
443
- .Overlay-backdrop--anchor {
444
- @include Overlay-backdrop--anchor;
445
- }
355
+ .Overlay-backdrop--anchor {
356
+ @include Overlay-backdrop--anchor;
357
+ }
446
358
 
447
- .Overlay-backdrop--side {
448
- @include Overlay-backdrop--side;
449
- }
359
+ .Overlay-backdrop--side {
360
+ @include Overlay-backdrop--side;
361
+ }
450
362
 
451
- .Overlay-backdrop--full {
452
- @include Overlay-backdrop--full;
453
- }
363
+ .Overlay-backdrop--full {
364
+ @include Overlay-backdrop--full;
454
365
  }
455
366
 
456
367
  // responsive variants
@@ -472,32 +383,3 @@ $Overlay-height: (
472
383
  @include Overlay-backdrop--full;
473
384
  }
474
385
  }
475
-
476
-
477
- // Animations
478
- // ==========
479
- // Todo: Replace with Primer Primitives motion tokens
480
-
481
- @keyframes Overlay--motion-slideInUp {
482
- from { transform: translateY(25%) }
483
- }
484
- @keyframes Overlay--motion-slideInDown {
485
- from { transform: translateY(-25%) }
486
- }
487
- @keyframes Overlay--motion-slideInRight {
488
- from { transform: translateX(-25%) }
489
- }
490
- @keyframes Overlay--motion-slideInLeft {
491
- from { transform: translateX(25%) }
492
- }
493
- @keyframes Overlay--motion-scaleFade {
494
- from {
495
- opacity: 0;
496
- transform: scale(0.8);
497
- }
498
-
499
- to {
500
- opacity: 1;
501
- transform: scale(1);
502
- }
503
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/css",
3
- "version": "0.0.0-20220620061649",
3
+ "version": "0.0.0-20220621152621",
4
4
  "description": "The CSS implementation of GitHub's Primer Design System",
5
5
  "homepage": "https://primer.style/css",
6
6
  "author": "GitHub, Inc.",