@internetstiftelsen/styleguide 5.1.13 → 5.1.14-beta.0.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "5.1.13",
3
+ "version": "5.1.14-beta.0.2",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
@@ -68,6 +68,7 @@
68
68
  "@tiptap/extension-paragraph": "^3.4.4",
69
69
  "@tiptap/extension-text": "^3.4.4",
70
70
  "a11y-toggle": "^2.1.0",
71
+ "ag-grid-community": "^34.2.0",
71
72
  "focus-trap": "^7.6.5",
72
73
  "glider-js": "^1.7.9",
73
74
  "lodash": "^4.17.21",
package/src/app.scss CHANGED
@@ -50,6 +50,7 @@
50
50
  @use 'molecules/form-control/form-control';
51
51
  @use 'molecules/alert/alert';
52
52
  @use 'molecules/table/table';
53
+ @use 'molecules/table-advanced/table-advanced';
53
54
  @use 'molecules/system-error/system-error';
54
55
  @use 'molecules/info-box/info-box';
55
56
  @use 'molecules/share/share';
@@ -89,6 +89,8 @@
89
89
  }
90
90
 
91
91
  @include bem.m(heat) {
92
+ position: relative;
93
+
92
94
  &[value]::-webkit-progress-value,
93
95
  &[value]::-webkit-meter-optimum-value {
94
96
  border-radius: 0;
@@ -104,6 +106,21 @@
104
106
  background-size: var(--progressbar-width) 100%; /* The value is calculated by JS and set in the DOM */
105
107
  background-repeat: no-repeat;
106
108
  }
109
+
110
+ &::after {
111
+ position: absolute;
112
+ top: 50%;
113
+ left: var(--progressbar-width-percent);
114
+ content: attr(data-value) '%';
115
+ display: block;
116
+ color: colors.$color-cyberspace;
117
+ transform: translateX(-100%) translateY(-50%);
118
+ padding-right: func.rhythm(1);
119
+ color: colors.$color-snow;
120
+ text-shadow: 0 0 5px colors.$color-cyberspace;
121
+ font-size: var.$size-base * 1.2;
122
+ line-height: 1;
123
+ }
107
124
  }
108
125
  }
109
126
 
@@ -119,4 +136,15 @@
119
136
  @include bem.m(large) {
120
137
  font-size: var.$size-base * 1.5;
121
138
  }
139
+
140
+ @include bem.m(hidden) {
141
+ span {
142
+ @include mixin.visuallyhidden;
143
+ }
144
+
145
+ > progress,
146
+ > meter {
147
+ margin-left: 0;
148
+ }
149
+ }
122
150
  }
@@ -15,7 +15,8 @@ module.exports = {
15
15
  context: {
16
16
  heat: true,
17
17
  meter: false,
18
- value: '100'
18
+ value: '100',
19
+ hidden_label: true
19
20
  }
20
21
  },
21
22
  {
@@ -1,10 +1,15 @@
1
- const progressbars = document.querySelectorAll('[data-width-progress]')
1
+ const progressbars = document.querySelectorAll('[data-width-progress]');
2
2
 
3
- if (progressbars) {
3
+ if (progressbars.length) {
4
4
  function progressBarWidths() {
5
- progressbars.forEach((container, index) => {
5
+ progressbars.forEach((container) => {
6
6
  const width = container.offsetWidth;
7
- document.documentElement.style.setProperty(`--progressbar-width`, width + 'px');
7
+ const value = +container.getAttribute('value') || 0;
8
+ const max = +container.getAttribute('max') || 100;
9
+ const percent = Math.round((value / max * 100) / 2) * 2;
10
+
11
+ document.documentElement.style.setProperty('--progressbar-width', width + 'px');
12
+ document.documentElement.style.setProperty('--progressbar-width-percent', percent + '%');
8
13
  });
9
14
  }
10
15
 
package/src/components.js CHANGED
@@ -38,3 +38,4 @@ import './assets/js/iconToggle';
38
38
  import './molecules/multi-select/multi-select';
39
39
  import './organisms/haveibeenpwned/haveibeenpwned';
40
40
  import './atoms/progress/progress';
41
+ import './molecules/table-advanced/table-advanced';
@@ -286,7 +286,7 @@
286
286
  -webkit-overflow-scrolling: touch;
287
287
  }
288
288
 
289
- @include breakpoint.bp-up(sm) {
289
+ @include breakpoint.bp-up(lg) {
290
290
  @include bem.b(scroll-indicator) {
291
291
  display: none;
292
292
  }
@@ -0,0 +1,14 @@
1
+ @charset "UTF-8";
2
+ @use '../../configurations/variables' as var;
3
+
4
+ body {
5
+ height: 100%;
6
+ }
7
+
8
+ :root {
9
+ --ag-header-font-family: 'Roboto Mono Regular', monospace;
10
+ --ag-font-family: 'HK Grotesk', sans-serif;
11
+ --ag-cell-font-family: 'HK Grotesk', sans-serif;
12
+ --ag-header-font-size: 15px;
13
+ --ag-font-size: 16px;
14
+ }
@@ -0,0 +1,44 @@
1
+ import * as agGrid from "ag-grid-community";
2
+ import {
3
+ ModuleRegistry,
4
+ AllCommunityModule
5
+ } from 'ag-grid-community';
6
+
7
+ ModuleRegistry.registerModules([
8
+ AllCommunityModule,
9
+ ]);
10
+
11
+ let gridApi;
12
+
13
+ const gridOptions = {
14
+ columnDefs: [
15
+ { field: "athlete", width: 150 },
16
+ { field: "age", width: 90 },
17
+ { field: "country", width: 150 },
18
+ { field: "year", width: 90 },
19
+ { field: "date", width: 150 },
20
+ { field: "sport", width: 150 },
21
+ { field: "gold", width: 100 },
22
+ { field: "silver", width: 100 },
23
+ { field: "bronze", width: 100 },
24
+ { field: "total", width: 100 },
25
+ ],
26
+ };
27
+
28
+ (function fillLarge() {
29
+ setWidthAndHeight("100%");
30
+ })();
31
+
32
+
33
+ function setWidthAndHeight(size) {
34
+ const eGridDiv = document.querySelector("#myGrid");
35
+ eGridDiv.style.setProperty("width", size);
36
+ eGridDiv.style.setProperty("height", size);
37
+ }
38
+
39
+ const gridDiv = document.querySelector("#myGrid");
40
+ gridApi = agGrid.createGrid(gridDiv, gridOptions);
41
+
42
+ fetch("https://www.ag-grid.com/example-assets/olympic-winners.json")
43
+ .then((response) => response.json())
44
+ .then((data) => gridApi.setGridOption("rowData", data));
@@ -1,5 +1,6 @@
1
1
  @charset "UTF-8";
2
2
  @use "sass:color";
3
+ @use "sass:math";
3
4
  @use '../../configurations/mixins' as mixin;
4
5
  @use '../../configurations/extends';
5
6
  @use '../../configurations/bem' as bem;
@@ -42,4 +43,37 @@
42
43
  @include bem.m(shadow-large) {
43
44
  @include mixin.card-shadow(colors.$color-cyberspace, 0.2);
44
45
  }
46
+
47
+ @include bem.m(article-indent) {
48
+ @include breakpoint.bp-up(lg) {
49
+ @include bem.e(item) {
50
+ > p:not(.preamble),
51
+ > h2,
52
+ > h3,
53
+ > h4,
54
+ > h5,
55
+ > h6,
56
+ > ul,
57
+ > ol,
58
+ > .wp-block-image > figure,
59
+ > figure,
60
+ > blockquote {
61
+ &:not(.alignfull):not(.alignleft):not(.alignright):not(.alignwide):not(.wp-block-iis-hero) {
62
+ max-width: calc(#{func.to_rem(612px)} + #{(var.$indent * 2)});
63
+ margin-right: math.div(var.$grid-gutter-width, 2);
64
+ margin-left: var.$indent * 2;
65
+ }
66
+ }
67
+
68
+ > [class*='meta'] {
69
+ margin-left: var.$indent;
70
+ }
71
+
72
+ > p.preamble {
73
+ max-width: func.to_rem(612px);
74
+ margin-left: var.$indent;
75
+ }
76
+ }
77
+ }
78
+ }
45
79
  }