@papillonbits/css 0.6.0 → 0.9.0

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,7 +1,7 @@
1
1
  @import "../support/variables/typography.scss";
2
2
  @import "../support/variables/misc.scss";
3
3
 
4
- // stylelint-disable selector-max-type
4
+ // stylelint-disable selector-max-type, selector-no-qualifying-type
5
5
  * {
6
6
  box-sizing: border-box;
7
7
  }
@@ -80,10 +80,70 @@ button {
80
80
  }
81
81
 
82
82
  details {
83
- summary { cursor: pointer; }
83
+ summary {
84
+ cursor: pointer;
85
+ }
84
86
 
85
87
  &:not([open]) {
86
88
  // Set details content hidden by default for browsers that don't do this
87
- > *:not(summary) { display: none !important; }
89
+ > *:not(summary) {
90
+ display: none !important;
91
+ }
92
+ }
93
+ }
94
+
95
+ // global focus styles
96
+
97
+ a,
98
+ button,
99
+ [role='button'],
100
+ input[type='radio'],
101
+ input[type='checkbox'] {
102
+ transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
103
+ transition-property: color, background-color, box-shadow, border-color;
104
+ // fallback :focus state
105
+ &:focus {
106
+ @include focusOutline;
107
+
108
+ // remove fallback :focus if :focus-visible is supported
109
+ &:not(:focus-visible) {
110
+ outline: solid 1px transparent;
111
+ }
112
+ }
113
+
114
+ // default focus state
115
+ &:focus-visible {
116
+ @include focusOutline;
117
+ }
118
+ }
119
+
120
+ a:not([class]),
121
+ input[type='radio'],
122
+ input[type='checkbox'] {
123
+ &:focus,
124
+ &:focus-visible {
125
+ outline-offset: 0;
126
+ }
127
+ }
128
+
129
+ // for handling focus conditionally
130
+ .focus {
131
+ @include focusBoxShadowInset;
132
+ }
133
+
134
+ // Windows High Contrast mode
135
+ @media (forced-colors: active) {
136
+ *:focus,
137
+ *:focus-visible {
138
+ outline: solid 1px transparent;
139
+ }
140
+
141
+ input:not([type='radio'], [type='checkbox']),
142
+ textarea,
143
+ select {
144
+ &:focus,
145
+ &:focus-visible {
146
+ outline-offset: 2px;
147
+ }
88
148
  }
89
149
  }
@@ -39,7 +39,8 @@ header,
39
39
  main, /* 2 */
40
40
  menu,
41
41
  nav,
42
- section { /* 1 */
42
+ section {
43
+ /* 1 */
43
44
  display: block;
44
45
  }
45
46
 
@@ -96,16 +97,6 @@ a {
96
97
  background-color: transparent; /* 1 */
97
98
  }
98
99
 
99
- /**
100
- * Remove the outline on focused links when they are also active or hovered
101
- * in all browsers (opinionated).
102
- */
103
-
104
- a:active,
105
- a:hover {
106
- outline-width: 0;
107
- }
108
-
109
100
  /* Text-level semantics
110
101
  ========================================================================== */
111
102
 
@@ -278,7 +269,8 @@ optgroup {
278
269
  */
279
270
 
280
271
  button,
281
- input { /* 1 */
272
+ input {
273
+ /* 1 */
282
274
  overflow: visible;
283
275
  }
284
276
 
@@ -288,7 +280,8 @@ input { /* 1 */
288
280
  */
289
281
 
290
282
  button,
291
- select { /* 1 */
283
+ select {
284
+ /* 1 */
292
285
  text-transform: none;
293
286
  }
294
287
 
@@ -305,29 +298,6 @@ html [type="button"], /* 1 */
305
298
  -webkit-appearance: button; /* 2 */
306
299
  }
307
300
 
308
- /**
309
- * Remove the inner border and padding in Firefox.
310
- */
311
-
312
- button::-moz-focus-inner,
313
- [type="button"]::-moz-focus-inner,
314
- [type="reset"]::-moz-focus-inner,
315
- [type="submit"]::-moz-focus-inner {
316
- border-style: none;
317
- padding: 0;
318
- }
319
-
320
- /**
321
- * Restore the focus styles unset by the previous rule.
322
- */
323
-
324
- button:-moz-focusring,
325
- [type="button"]:-moz-focusring,
326
- [type="reset"]:-moz-focusring,
327
- [type="submit"]:-moz-focusring {
328
- outline: 1px dotted ButtonText;
329
- }
330
-
331
301
  /**
332
302
  * Change the border, margin, and padding in all browsers (opinionated).
333
303
  */
@@ -367,8 +337,8 @@ textarea {
367
337
  * 2. Remove the padding in IE 10-.
368
338
  */
369
339
 
370
- [type="checkbox"],
371
- [type="radio"] {
340
+ [type='checkbox'],
341
+ [type='radio'] {
372
342
  box-sizing: border-box; /* 1 */
373
343
  padding: 0; /* 2 */
374
344
  }
@@ -377,27 +347,17 @@ textarea {
377
347
  * Correct the cursor style of increment and decrement buttons in Chrome.
378
348
  */
379
349
 
380
- [type="number"]::-webkit-inner-spin-button,
381
- [type="number"]::-webkit-outer-spin-button {
350
+ [type='number']::-webkit-inner-spin-button,
351
+ [type='number']::-webkit-outer-spin-button {
382
352
  height: auto;
383
353
  }
384
354
 
385
- /**
386
- * 1. Correct the odd appearance in Chrome and Safari.
387
- * 2. Correct the outline style in Safari.
388
- */
389
-
390
- [type="search"] {
391
- -webkit-appearance: textfield; /* 1 */
392
- outline-offset: -2px; /* 2 */
393
- }
394
-
395
355
  /**
396
356
  * Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
397
357
  */
398
358
 
399
- [type="search"]::-webkit-search-cancel-button,
400
- [type="search"]::-webkit-search-decoration {
359
+ [type='search']::-webkit-search-cancel-button,
360
+ [type='search']::-webkit-search-decoration {
401
361
  -webkit-appearance: none;
402
362
  }
403
363
 
@@ -3,8 +3,10 @@
3
3
  @import './themes/light.scss';
4
4
  @import './themes/light_colorblind.scss';
5
5
  @import './themes/light_high_contrast.scss';
6
+ @import './themes/light_tritanopia.scss';
6
7
  @import './themes/dark.scss';
7
8
  @import './themes/dark_dimmed.scss';
8
9
  @import './themes/dark_high_contrast.scss';
9
10
  @import './themes/dark_colorblind.scss';
11
+ @import './themes/dark_tritanopia.scss';
10
12
  @import './native.scss';
@@ -0,0 +1,6 @@
1
+ @import '../../support/index.scss';
2
+ @import '@primer/primitives/dist/scss/colors/_dark_tritanopia.scss';
3
+
4
+ @include color-mode-theme(dark_tritanopia) {
5
+ @include primer-colors-dark_tritanopia;
6
+ }
@@ -0,0 +1,6 @@
1
+ @import '../../support/index.scss';
2
+ @import '@primer/primitives/dist/scss/colors/_light_tritanopia.scss';
3
+
4
+ @include color-mode-theme(light_tritanopia) {
5
+ @include primer-colors-light_tritanopia;
6
+ }
@@ -84,10 +84,12 @@
84
84
  @each $name, $value in $color-map {
85
85
  @each $type, $color in $value {
86
86
  @if $type == dark {
87
+ // stylelint-disable-next-line function-no-unknown
87
88
  $dark-colors: append($dark-colors, (--color-#{$name}, #{$color}));
88
89
  }
89
90
 
90
91
  @else {
92
+ // stylelint-disable-next-line function-no-unknown
91
93
  $light-colors: append($light-colors, (--color-#{$name}, #{$color}));
92
94
  }
93
95
  }
@@ -9,6 +9,7 @@
9
9
 
10
10
  @else {
11
11
  // Retrieves the value from the key
12
+ // stylelint-disable-next-line function-no-unknown
12
13
  $value: map-get($breakpoints, $breakpoint);
13
14
 
14
15
  // If the key exists in the map
@@ -16,7 +16,7 @@
16
16
 
17
17
  &::after {
18
18
  // stylelint-disable-next-line primer/spacing
19
- margin-left: 1px;
19
+ margin-left: 2px;
20
20
  background-color: var(--color-canvas-default);
21
21
  background-image: linear-gradient($background, $background);
22
22
  }
@@ -25,3 +25,49 @@
25
25
  background-color: $border;
26
26
  }
27
27
  }
28
+
29
+ // global focus styles
30
+
31
+ // inset box-shadow for form controls
32
+ @mixin focusBoxShadowInset($outlineWidth: 1px, $outlineColor: var(--color-accent-fg)) {
33
+ border-color: var(--color-accent-fg);
34
+ outline: none;
35
+ box-shadow: inset 0 0 0 $outlineWidth $outlineColor;
36
+ }
37
+
38
+ // box-shadow for :target styles (no inset)
39
+ // !important to override PCSS utilities
40
+ @mixin targetBoxShadow($outlineWidth: 2px, $outlineColor: var(--color-accent-fg)) {
41
+ outline: none !important;
42
+ box-shadow: 0 0 0 $outlineWidth $outlineColor !important;
43
+ }
44
+
45
+ // outline
46
+ @mixin focusOutline($outlineOffset: -2px, $outlineColor: var(--color-accent-fg)) {
47
+ outline: 2px solid $outlineColor;
48
+ outline-offset: $outlineOffset;
49
+ box-shadow: none;
50
+ }
51
+
52
+ // outline with fg box-shadow for buttons
53
+ @mixin focusOutlineOnEmphasis($outlineOffset: -2px, $outlineColor: var(--color-accent-fg)) {
54
+ outline: 2px solid $outlineColor;
55
+ outline-offset: $outlineOffset;
56
+ box-shadow: inset 0 0 0 3px var(--color-fg-on-emphasis);
57
+ }
58
+
59
+ // if min-width is undefined, return only min-height
60
+ @mixin minTouchTarget($min-height: 32px, $min-width: '') {
61
+ position: absolute;
62
+ top: 50%;
63
+ left: 50%;
64
+ width: 100%;
65
+ height: 100%;
66
+ min-height: $min-height;
67
+ content: '';
68
+ transform: translateX(-50%) translateY(-50%);
69
+
70
+ @if $min-width != '' {
71
+ min-width: $min-width;
72
+ }
73
+ }
@@ -82,6 +82,7 @@ $spacers-large: (
82
82
  12: $spacer-12,
83
83
  ) !default;
84
84
 
85
+ // stylelint-disable-next-line function-no-unknown
85
86
  $spacer-map-extended: map-merge(
86
87
  (
87
88
  0: 0,
@@ -1,4 +1,6 @@
1
- // stylelint-disable selector-max-type
1
+ @import "../support/mixins/misc.scss";
2
+
3
+ // stylelint-disable selector-max-type, selector-max-specificity, max-nesting-depth, selector-no-qualifying-type
2
4
 
3
5
  .details-overlay[open] > summary::before {
4
6
  position: fixed;
@@ -20,9 +22,86 @@
20
22
 
21
23
  .details-reset {
22
24
  // Remove marker added by the display: list-item browser default
23
- > summary { list-style: none; }
25
+ > summary {
26
+ list-style: none;
27
+ transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
28
+ transition-property: color, background-color, box-shadow, border-color;
29
+ // fallback :focus state
30
+ &:focus {
31
+ @include focusOutline;
32
+
33
+ // remove fallback :focus if :focus-visible is supported
34
+ &:not(:focus-visible) {
35
+ outline: solid 1px transparent;
36
+ }
37
+ }
38
+
39
+ // default focus state
40
+ &:focus-visible {
41
+ @include focusOutline;
42
+ }
43
+
44
+ &.btn-primary {
45
+ // fallback :focus state
46
+ &:focus {
47
+ @include focusOutlineOnEmphasis;
48
+
49
+ // remove fallback :focus if :focus-visible is supported
50
+ &:not(:focus-visible) {
51
+ outline: solid 1px transparent;
52
+ box-shadow: none;
53
+ }
54
+ }
55
+
56
+ // default focus state
57
+ &:focus-visible {
58
+ @include focusOutlineOnEmphasis;
59
+ }
60
+ }
61
+ }
24
62
  // Remove marker added by details polyfill
25
- > summary::before { display: none; }
63
+ > summary::before {
64
+ display: none;
65
+ }
26
66
  // Remove marker added by Chrome
27
- > summary::-webkit-details-marker { display: none; }
67
+ > summary::-webkit-details-marker {
68
+ display: none;
69
+ }
70
+ }
71
+
72
+ .details-overlay > summary {
73
+ transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
74
+ transition-property: color, background-color, box-shadow, border-color;
75
+ // fallback :focus state
76
+ &:focus {
77
+ @include focusOutline;
78
+
79
+ // remove fallback :focus if :focus-visible is supported
80
+ &:not(:focus-visible) {
81
+ outline: solid 1px transparent;
82
+ }
83
+ }
84
+
85
+ // default focus state
86
+ &:focus-visible {
87
+ @include focusOutline;
88
+ }
89
+
90
+ &.btn-primary {
91
+ // fallback :focus state
92
+ &:focus {
93
+ @include focusOutlineOnEmphasis;
94
+
95
+ // remove fallback :focus if :focus-visible is supported
96
+ &:not(:focus-visible) {
97
+ outline: solid 1px transparent;
98
+ box-shadow: none;
99
+ }
100
+ }
101
+
102
+ // default focus state
103
+ &:focus-visible {
104
+ @include focusOutlineOnEmphasis;
105
+ }
106
+ }
28
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papillonbits/css",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "description": "Papillon Bits CSS",
5
5
  "homepage": "https://github.com/papillonbits/papillonbits/tree/master/packages/css",
6
6
  "repository": {
@@ -16,12 +16,12 @@
16
16
  ],
17
17
  "scripts": {
18
18
  "clean-up": "rm -rf build node_modules package-lock.json",
19
- "install-packages": "npm install",
19
+ "install-packages": "npm i",
20
20
  "install-papillonbits-latest": "echo \"css skipping install-papillonbits-latest\" && exit 0",
21
21
  "build": "rm -rf build && babel --copy-files --no-copy-ignored --out-dir build src",
22
22
  "build-test": "npm run build",
23
23
  "build-acceptance": "npm run build",
24
24
  "build-release": "npm run build"
25
25
  },
26
- "gitHead": "c8a804c952017a594fd6420ef676e70e4da4b650"
26
+ "gitHead": "ba7a354cefa1c3452d5e1a7cbfa91cb3564d44fb"
27
27
  }