@internetstiftelsen/styleguide 3.0.17 → 4.0.1

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.
@@ -2,9 +2,9 @@
2
2
 
3
3
  var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
4
4
 
5
- var _lodash = require('lodash.throttle');
5
+ var _throttle = require('lodash/throttle');
6
6
 
7
- var _lodash2 = _interopRequireDefault(_lodash);
7
+ var _throttle2 = _interopRequireDefault(_throttle);
8
8
 
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
 
@@ -74,7 +74,7 @@ function dispatch() {
74
74
  }
75
75
  }
76
76
 
77
- var onResize = (0, _lodash2.default)(dispatch, 100);
77
+ var onResize = (0, _throttle2.default)(dispatch, 100);
78
78
 
79
79
  window.addEventListener('resize', onResize);
80
80
  dispatch();
@@ -10,9 +10,9 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = [
10
10
 
11
11
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
12
12
 
13
- var _lodash = require('lodash.template');
13
+ var _template = require('lodash/template');
14
14
 
15
- var _lodash2 = _interopRequireDefault(_lodash);
15
+ var _template2 = _interopRequireDefault(_template);
16
16
 
17
17
  var _Events = require('../../assets/js/Events');
18
18
 
@@ -128,7 +128,7 @@ var Form = function () {
128
128
  this.onSuccess = function (json) {
129
129
  _this.setLoading(false);
130
130
 
131
- var tmpl = (0, _lodash2.default)(_this.successMessage);
131
+ var tmpl = (0, _template2.default)(_this.successMessage);
132
132
 
133
133
  _this.success.classList.remove('is-hidden');
134
134
  _this.success.innerHTML = tmpl(json);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "3.0.17",
3
+ "version": "4.0.1",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
@@ -84,8 +84,7 @@
84
84
  "a11y-toggle": "^2.1.0",
85
85
  "focus-trap": "^6.7.3",
86
86
  "glider-js": "^1.7.7",
87
- "lodash.template": "^4.5.0",
88
- "lodash.throttle": "^4.1.1",
87
+ "lodash": "^4.17.21",
89
88
  "smooth-scroll": "^16.1.3",
90
89
  "van11y-accessible-accordion-aria": "^3.0.1"
91
90
  },
package/src/app.scss CHANGED
@@ -47,7 +47,6 @@ $namespace: '';
47
47
  // Molecules
48
48
  @import 'molecules/breadcrumb/breadcrumb';
49
49
  @import 'molecules/card/card';
50
- @import 'molecules/teaser/teaser';
51
50
  @import 'molecules/download/download';
52
51
  @import 'molecules/teaser-news-list/teaser-news-list';
53
52
  @import 'molecules/form-control/form-control';
@@ -1,4 +1,4 @@
1
- import throttle from 'lodash.throttle';
1
+ import throttle from 'lodash/throttle';
2
2
 
3
3
  const breakpoints = {
4
4
  xs: 0,
@@ -176,7 +176,8 @@
176
176
  width: $icon-size;
177
177
  height: $icon-size;
178
178
  transform: none;
179
- fill: $color-cyberspace;
179
+ color: var(--cyberspace-color);
180
+ fill: currentColor;
180
181
  }
181
182
 
182
183
  @include m(white) {
@@ -204,7 +205,7 @@
204
205
  border-color: transparent;
205
206
  background-color: transparent;
206
207
  box-shadow: none;
207
- color: $color-cyberspace;
208
+ color: var(--cyberspace-color);
208
209
 
209
210
  &:hover,
210
211
  &:focus {
@@ -213,13 +214,14 @@
213
214
  }
214
215
 
215
216
  @include e(text) {
216
- color: $color-cyberspace;
217
+ color: var(--cyberspace-color);
217
218
  }
218
219
 
219
220
  @include e(icon) {
220
221
  width: $icon-size;
221
222
  height: $icon-size;
222
- fill: $color-cyberspace;
223
+ fill: var(--cyberspace-cyberspace);
224
+ fill: currentColor;
223
225
  }
224
226
 
225
227
  @include m(small-icon) {
@@ -64,7 +64,7 @@
64
64
  padding: rhythm(2) rhythm(1);
65
65
  border: 0;
66
66
  background-color: transparent;
67
- color: $color-cyberspace;
67
+ color: var(--cyberspace-color);
68
68
  font-family: $font-family-medium;
69
69
  font-size: rem($size-small);
70
70
  text-decoration: none;
@@ -126,7 +126,7 @@
126
126
  border: 0;
127
127
  border-radius: 0;
128
128
  background-color: currentColor;
129
- color: $color-cyberspace;
129
+ color: var(--cyberspace-color);
130
130
 
131
131
  &::before,
132
132
  &::after {
@@ -161,7 +161,7 @@
161
161
  transition: all 0.3s ease-out;
162
162
  border: 0;
163
163
  border-radius: 0;
164
- color: $color-cyberspace;
164
+ color: var(--cyberspace-color);
165
165
 
166
166
  &::before,
167
167
  &::after {
@@ -12,7 +12,7 @@
12
12
  display: flex;
13
13
  position: relative;
14
14
  align-items: center;
15
- color: $color-cyberspace;
15
+ color: var(--cyberspace-color);
16
16
  font-family: $font-family-mono;
17
17
  text-decoration: none;
18
18
  text-transform: uppercase;
@@ -30,6 +30,8 @@
30
30
  height: $icon-size;
31
31
  margin-right: rhythm(1);
32
32
  fill: inherit;
33
+ color: var(--color-cyberspace);
34
+ fill: currentColor;
33
35
  }
34
36
 
35
37
  @include m(light) {
@@ -24,7 +24,7 @@
24
24
  }
25
25
 
26
26
  @include e(text) {
27
- color: $color-cyberspace;
27
+ color: var(--cyberspace-color);
28
28
  letter-spacing: 0.025rem;
29
29
  }
30
30
 
@@ -32,7 +32,8 @@
32
32
  overflow: visible;
33
33
  transform: translateX(-50%) translateY(-50%);
34
34
  transition: box-shadow 0.3s cubic-bezier(0.3, 0, 0, 1);
35
- fill: $color-cyberspace;
35
+ color: var(--cyberspace-color);
36
+ fill: currentColor;
36
37
  }
37
38
 
38
39
  @include e(text) {
@@ -9,7 +9,7 @@ html {
9
9
  height: 100%;
10
10
  min-height: 100%;
11
11
  background-color: theme_palette('background');
12
- color: $color-cyberspace;
12
+ color: var(--cyberspace-color);
13
13
  font-family: sans-serif;
14
14
  font-size: percentage(math.div($size-base, 16px));
15
15
  font-variant-ligatures: no-common-ligatures;
@@ -313,6 +313,7 @@ code {
313
313
  width: 100%;
314
314
  padding: rhythm(2);
315
315
  font-size: $size-medium;
316
+ color: $color-cyberspace;
316
317
  }
317
318
 
318
319
  //
@@ -17,7 +17,7 @@
17
17
  %link-styles {
18
18
  padding: rhythm(0) rhythm(0.5);
19
19
  border-bottom: rem(2px) solid $color-peacock;
20
- color: $color-black;
20
+ color: var(---cyberspace-color);
21
21
  text-decoration: none;
22
22
 
23
23
  &:hover,
@@ -79,6 +79,8 @@
79
79
  height: math.div($icon-size, 2);
80
80
  margin: 0 rhythm(1);
81
81
  transform: translateY(rem(1px));
82
+ color: var(--cyberspace-color);
83
+ fill: currentColor;
82
84
 
83
85
  &:first-child {
84
86
  margin: 0 rhythm(1) 0 0;
@@ -94,7 +96,7 @@
94
96
 
95
97
  max-width: rhythm(30);
96
98
  overflow: hidden;
97
- color: $color-cyberspace;
99
+ color: var(--cyberspace-color);
98
100
  text-decoration: none;
99
101
  text-overflow: ellipsis;
100
102
  white-space: nowrap;
@@ -42,7 +42,7 @@
42
42
  }
43
43
 
44
44
  @include e(link) {
45
- color: $color-cyberspace;
45
+ color: var(---cyberspace-color);
46
46
  text-decoration: none;
47
47
 
48
48
  &::after {
@@ -114,7 +114,7 @@
114
114
  }
115
115
 
116
116
  @include m(padded) {
117
- background-color: $color-snow;
117
+ background-color: var(--snow-color);
118
118
 
119
119
  @include e(media) {
120
120
  flex: 0 0 auto;
@@ -273,17 +273,17 @@
273
273
  align-content: stretch;
274
274
  justify-content: flex-end;
275
275
  padding: rhythm(4);
276
- color: $color-snow;
276
+ color: var(--snow-color);
277
277
  text-shadow: $text-shadow;
278
278
  }
279
279
 
280
280
  @include e(link) {
281
- color: $color-snow;
281
+ color: var(--snow-color);
282
282
  }
283
283
 
284
284
  @include e(text) {
285
285
  margin-top: 0;
286
- color: $color-snow;
286
+ color: var(--snow-color);
287
287
  }
288
288
 
289
289
  @include e(bottom) {
@@ -292,11 +292,11 @@
292
292
 
293
293
  @include e(meta) {
294
294
  * {
295
- color: $color-snow;
295
+ color: var(--snow-color);
296
296
  }
297
297
 
298
298
  svg {
299
- fill: $color-snow;
299
+ fill: var(--snow-color);
300
300
  }
301
301
  }
302
302
  }
@@ -5,7 +5,7 @@
5
5
  padding: rhythm(2.5);
6
6
  border: 1px solid $color-peacock;
7
7
  border-radius: $border-radius;
8
- background-color: $color-snow;
8
+ background-color: var(--snow-color);
9
9
 
10
10
  @include e(link) {
11
11
  display: block;
@@ -59,6 +59,8 @@
59
59
  @include b(icon) {
60
60
  width: rem(57px);
61
61
  height: rem(78px);
62
+ color: var(--cyberspace-color);
63
+ fill: currentColor;
62
64
  }
63
65
 
64
66
  @include e(trigger) {
@@ -68,6 +70,8 @@
68
70
  @include b(icon) {
69
71
  width: $icon-size-medium;
70
72
  height: $icon-size-medium;
73
+ color: var(--dark-color);
74
+ fill: currentColor;
71
75
  }
72
76
 
73
77
  @include bp-up(sm) {
@@ -1,4 +1,4 @@
1
- import template from 'lodash.template';
1
+ import template from 'lodash/template';
2
2
  import Events from '../../assets/js/Events';
3
3
  import Button from '../../atoms/button/Button';
4
4
  import className from '../../assets/js/className';
@@ -5,7 +5,7 @@
5
5
  padding: rhythm(4);
6
6
  border-top: rem(4px) solid $color-lemon;
7
7
  border-radius: $border-radius;
8
- background-color: $color-snow;
8
+ background-color: var(--snow-color);
9
9
 
10
10
  > p,
11
11
  > ul,
@@ -38,7 +38,7 @@
38
38
  padding: rhythm(4) rhythm(2) rhythm(4) rhythm(2);
39
39
  overflow-y: auto;
40
40
  border-radius: $border-radius;
41
- background: $color-snow;
41
+ background: var(--snow-color);
42
42
 
43
43
  > button {
44
44
  position: absolute;
@@ -14,6 +14,12 @@
14
14
  background-size: $icon-size-medium $icon-size-medium;
15
15
  text-decoration: none;
16
16
 
17
+ @if variable-exists(cyberspace-color) {
18
+ @media (prefers-color-scheme: dark) {
19
+ background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' id='icon-arrow-down' fill='%23ffffff' viewBox='0 0 32 18.9' width='100%25' height='100%25'%3E%3Cpolygon points='32,2.9 16,18.9 0,2.9 2.9,0 16,13.1 29.1,0 '%3E%3C/polygon%3E%3C/svg%3E%0A");
20
+ }
21
+ }
22
+
17
23
  &[data-color='ocean'] {
18
24
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' id='icon-arrow-down' fill='%2350b2fc' viewBox='0 0 32 18.9' width='100%25' height='100%25'%3E%3Cpolygon points='32,2.9 16,18.9 0,2.9 2.9,0 16,13.1 29.1,0 '%3E%3C/polygon%3E%3C/svg%3E%0A");
19
25
  }
@@ -53,7 +53,7 @@
53
53
  padding-bottom: rhythm(1);
54
54
  padding-left: rhythm(2);
55
55
  border-bottom: 2px solid $color-granit;
56
- color: $color-cyberspace;
56
+ color: var(--cyberspace-color);
57
57
  font-size: 90%;
58
58
  text-align: left;
59
59
 
@@ -128,7 +128,7 @@
128
128
  th,
129
129
  td {
130
130
  &:nth-child(even) {
131
- background-color: $color-snow;
131
+ background-color: var(--snow-color);
132
132
  }
133
133
  }
134
134
  }
@@ -136,7 +136,7 @@
136
136
  @include m(rows) {
137
137
  thead {
138
138
  th {
139
- background-color: $color-ash;
139
+ background-color: var(--ash-color);
140
140
  }
141
141
  }
142
142
 
@@ -144,14 +144,14 @@
144
144
  tr:nth-child(odd) {
145
145
  th,
146
146
  td {
147
- background-color: $color-snow;
147
+ background-color: var(--snow-color);
148
148
  }
149
149
  }
150
150
 
151
151
  tr:nth-child(even) {
152
152
  th,
153
153
  td {
154
- background-color: $color-ash;
154
+ background-color: var(--ash-color);
155
155
  }
156
156
  }
157
157
  }
@@ -173,14 +173,14 @@
173
173
  tr:nth-child(odd) {
174
174
  th,
175
175
  td {
176
- background-color: $color-ash;
176
+ background-color: var(--ash-color);
177
177
  }
178
178
  }
179
179
 
180
180
  tr:nth-child(even) {
181
181
  th,
182
182
  td {
183
- background-color: $color-snow;
183
+ background-color: var(--snow-color);
184
184
  }
185
185
  }
186
186
  }
@@ -4,7 +4,7 @@
4
4
  height: 100%;
5
5
  padding: rhythm(2);
6
6
  border-radius: $border-radius;
7
- background-color: $color-snow;
7
+ background-color: var(--snow-color);
8
8
 
9
9
  @include bp-up(md) {
10
10
  padding: rhythm(2) rhythm(4);
@@ -36,7 +36,7 @@
36
36
  transform: translateY(-50%);
37
37
  transform-origin: center center;
38
38
  transition: transform 0.25s ease-out;
39
- background-color: $color-cyberspace;
39
+ background-color: var(--cyberspace-color);
40
40
  }
41
41
 
42
42
  &::before {
@@ -70,7 +70,7 @@
70
70
  padding: 0;
71
71
  transition: visibility 0s ease, max-height 0.25s ease, opacity 0.25s ease;
72
72
  transition-delay: 0s;
73
- background-color: $color-snow;
73
+ background-color: var(--snow-color);
74
74
  }
75
75
 
76
76
  %is-visible {
@@ -112,7 +112,7 @@
112
112
  .js-accordion {
113
113
 
114
114
  @include e(header) {
115
- border-bottom: 1px solid $color-snow;
115
+ border-bottom: 1px solid var(--snow-color);
116
116
 
117
117
  &[aria-expanded='true'] {
118
118
  border-color: transparent;
@@ -274,7 +274,7 @@
274
274
 
275
275
  @extend %word-break;
276
276
 
277
- color: $color-cyberspace;
277
+ color: var(--cyberspace-color);
278
278
  text-decoration: none;
279
279
 
280
280
  &:focus,
@@ -4,7 +4,7 @@
4
4
  position: relative;
5
5
  z-index: z_index(foregroundMinus);
6
6
  border-bottom: 1px solid $color-ash;
7
- background-color: $color-snow;
7
+ background-color: var(--snow-color);
8
8
 
9
9
  @include e(logo-link) {
10
10
  display: flex;
@@ -7,15 +7,17 @@ $spacing: rhythm(6);
7
7
  @include organism(section) {
8
8
  position: relative;
9
9
  padding: math.div($spacing, 1.5) 0;
10
+ background-color: var(--ash-color);
10
11
 
11
12
  @include m(white) {
12
13
  padding: $spacing 0;
13
- background-color: $color-snow;
14
+ background-color: var(--snow-color);
14
15
 
15
16
  &::before,
16
17
  &::after {
17
18
  content: '';
18
19
  position: absolute;
20
+ z-index: z_index(background);
19
21
  right: 0;
20
22
  left: 0;
21
23
  height: $spacing;
@@ -23,12 +25,12 @@ $spacing: rhythm(6);
23
25
 
24
26
  &::before {
25
27
  top: 0;
26
- background-image: linear-gradient(to right top, #fff 0, #fff 50%, rgba(237, 237, 237, 01) 50.1%);
28
+ background-image: linear-gradient(to right top, var(--snow-color) 0, var(--snow-color) 50%, var(--ash-color) 50.1%);
27
29
  }
28
30
 
29
31
  &::after {
30
32
  bottom: 0;
31
- background-image: linear-gradient(to left top, #ededed 0, #ededed 50%, rgba(255,255,255,0) 50.1%);
33
+ background-image: linear-gradient(to left top, var(--ash-color) 0, var(--ash-color) 50%, var(--snow-color) 50.1%);
32
34
  }
33
35
 
34
36
  &:last-child {
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ status: 'ready',
3
+
4
+ context: {
5
+ alt: 'Hands typing on laptop',
6
+ img_url: '/assets/images/ALX_0876.jpg',
7
+ title: 'Gymnasieskolor med hög bandbredd har bättre skolresultat',
8
+ url: 'http://www.google.se',
9
+ exerpt: 'Eget nulla <strong>facilisi etiam</strong> dignissim diam quis enim lobortis scelerisque. Faucibus a pellentesque sit amet porttitor.',
10
+ is_padded: true,
11
+ is_wide: false,
12
+ has_shadow: false,
13
+ has_button: false,
14
+ read_time: true,
15
+ has_border: false,
16
+ has_image: true,
17
+ has_radius: true
18
+ }
19
+ }
@@ -0,0 +1,18 @@
1
+ @charset 'UTF-8';
2
+
3
+ :root {
4
+ --snow-color: #{$color-snow};
5
+ --cyberspace-color: #{$color-cyberspace};
6
+ --black-color: #{$color-black};
7
+ --ash-color: #{$color-ash};
8
+ --dark-color: #{$color-cyberspace};
9
+ --white-color: #{$color-snow};
10
+ }
11
+
12
+ @media (prefers-color-scheme: dark) {
13
+ :root {
14
+ --cyberspace-color: #{$color-snow};
15
+ --snow-color: #{$color-cyberspace};
16
+ --ash-color: #{$color-black};
17
+ }
18
+ }
@@ -6,7 +6,7 @@ $namespace: '';
6
6
 
7
7
  // Theme palette
8
8
  $theme-palette: (
9
- background: $color-ash
9
+ background: var(--ash-color)
10
10
  ) !default;
11
11
 
12
12
  @function theme_palette($key: 'background') {
@@ -24,7 +24,7 @@
24
24
  .u-link {
25
25
  padding: rhythm(0) rhythm(0.5) !important;
26
26
  border-bottom: rem(2px) solid $color-peacock !important;
27
- color: $color-black !important;
27
+ color: var(--cyberspace-color) !important;
28
28
  text-decoration: none !important;
29
29
 
30
30
  &:hover,
@@ -1,94 +0,0 @@
1
- @charset 'UTF-8';
2
-
3
- @include molecule(teaser) {
4
- position: relative;
5
- height: 100%;
6
- overflow: hidden;
7
- border-radius: $border-radius;
8
-
9
- &:hover,
10
- &:focus {
11
- img {
12
- opacity: 0.8;
13
- }
14
- }
15
-
16
- &::after {
17
- content: '';
18
- position: absolute;
19
- z-index: z_index(background);
20
- top: 0;
21
- right: 0;
22
- bottom: 0;
23
- left: 0;
24
- transition: opacity 0.75s ease-out;
25
- border-radius: $border-radius;
26
- background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba($color-cyberspace, 0) 55%, rgba($color-cyberspace, 1) 100%);
27
- }
28
-
29
- @include e(image) {
30
- display: block;
31
- width: 100%;
32
- height: 100%;
33
- transition: opacity 0.25s ease-out;
34
- object-fit: cover;
35
- }
36
-
37
- @include e(caption) {
38
- display: flex;
39
- position: absolute;
40
- z-index: z_index(middleground);
41
- top: 0;
42
- right: 0;
43
- bottom: 0;
44
- left: 0;
45
- flex-direction: column;
46
- align-content: stretch;
47
- justify-content: flex-end;
48
- }
49
-
50
- @include e(link) {
51
- display: block;
52
- padding: rhythm(4);
53
- text-decoration: none;
54
-
55
- &:hover,
56
- &:focus {
57
- color: $color-snow;
58
- text-decoration: underline;
59
- }
60
-
61
- &::after {
62
- content: '';
63
- position: absolute;
64
- z-index: z_index(middleground);
65
- top: 0;
66
- right: 0;
67
- bottom: 0;
68
- left: 0;
69
- cursor: pointer;
70
- }
71
- }
72
-
73
- @include e(headline) {
74
- align-items: flex-end;
75
- align-self: stretch;
76
- width: 100%;
77
- overflow: hidden;
78
- color: $color-snow;
79
-
80
- @include bp-up(sm) {
81
- + a {
82
- margin-top: rhythm(2);
83
- }
84
- }
85
-
86
- @include e(icon) {
87
- position: relative;
88
- width: $icon-size-medium;
89
- height: $icon-size-medium;
90
- transform: translateY(rem(1px));
91
- fill: currentColor;
92
- }
93
- }
94
- }