@internetstiftelsen/styleguide 2.26.23 → 3.0.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.
- package/README.md +22 -10
- package/dist/atoms/range/range.js +25 -0
- package/dist/components.js +7 -7
- package/package.json +4 -2
- package/src/app.js +3 -2
- package/src/components.js +2 -3
package/README.md
CHANGED
|
@@ -33,24 +33,36 @@ $namespace: 'mysite-';
|
|
|
33
33
|
@import '~@internetstiftelsen/styleguide/src/organisms/header/header';
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
### SCSS Mixins explained:
|
|
37
|
-
```scss
|
|
38
|
-
@include e(nested-element) {} // Element (.parent-element__nested-element)
|
|
39
|
-
@include m(modifier-name) {} // Modifier (.parent-element--modifier-name)
|
|
40
|
-
@include b(block-name) {} // Block (.block-name)
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
|
|
44
36
|
Peek into the [app.scss](https://github.com/sewebb/iis-styleguide/blob/master/src/app.scss) to see the full set of components.
|
|
45
37
|
|
|
46
38
|
For javascript it's basically the same thing. In a javascript file:
|
|
47
39
|
|
|
48
40
|
```js
|
|
49
|
-
// ES5 build version
|
|
41
|
+
// ES5 build version (path "dist")
|
|
50
42
|
import Button from '@internetstiftelsen/styleguide/dist/atoms/button/button';
|
|
51
43
|
|
|
52
|
-
// Standard ES6 version
|
|
44
|
+
// Standard ES6 version (path "src")
|
|
53
45
|
import Button from '@internetstiftelsen/styleguide/src/atoms/button/button';
|
|
46
|
+
|
|
47
|
+
// Globals and Configuration/Base components are imported by default from the Styleguide Core
|
|
48
|
+
|
|
49
|
+
// Atoms
|
|
50
|
+
import '@internetstiftelsen/styleguide/src/atoms/button/button';
|
|
51
|
+
import '@internetstiftelsen/styleguide/src/atoms/input/input';
|
|
52
|
+
|
|
53
|
+
// Molecules
|
|
54
|
+
import '@internetstiftelsen/styleguide/src/molecules/card/card';
|
|
55
|
+
|
|
56
|
+
// Organisms
|
|
57
|
+
import '~@internetstiftelsen/styleguide/src/organisms/header/header';
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### SCSS Mixins explained:
|
|
61
|
+
```scss
|
|
62
|
+
@include e(nested-element) {} // Element (.parent-element__nested-element)
|
|
63
|
+
@include m(modifier-name) {} // Modifier (.parent-element--modifier-name)
|
|
64
|
+
@include b(block-name) {} // Block (.block-name)
|
|
65
|
+
|
|
54
66
|
```
|
|
55
67
|
|
|
56
68
|
Depending on your browser requirements you may use the src version which is not transpiled to ES5.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ranges = document.querySelectorAll('.js-range-wrapper');
|
|
4
|
+
function setValue(range, rangeValue) {
|
|
5
|
+
var val = range.value;
|
|
6
|
+
var min = range.min ? range.min : 0;
|
|
7
|
+
var max = range.max ? range.max : 100;
|
|
8
|
+
var newVal = Number((val - min) * 100 / (max - min));
|
|
9
|
+
rangeValue.innerHTML = val;
|
|
10
|
+
|
|
11
|
+
// Sorta magic numbers based on size of the native UI thumb
|
|
12
|
+
rangeValue.style.left = 'calc(' + newVal + '% + (' + (8 - newVal * 0.15) + 'px))';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
ranges.forEach(function (wrap) {
|
|
16
|
+
var range = wrap.querySelector('.js-range');
|
|
17
|
+
var rangeValue = wrap.querySelector('.js-range-value');
|
|
18
|
+
|
|
19
|
+
range.addEventListener('input', function () {
|
|
20
|
+
setValue(range, rangeValue);
|
|
21
|
+
range.focus();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
setValue(range, rangeValue);
|
|
25
|
+
});
|
package/dist/components.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('./molecules/form');
|
|
4
|
+
|
|
5
|
+
require('./atoms/textarea/rich-text');
|
|
6
|
+
|
|
3
7
|
require('./atoms/password-toggle/password-toggle');
|
|
4
8
|
|
|
5
9
|
require('./utilities/tab-highlighting/tab-highlighting');
|
|
6
10
|
|
|
7
11
|
require('./molecules/system-error/system-error');
|
|
8
12
|
|
|
9
|
-
require('a11y-toggle');
|
|
10
|
-
|
|
11
13
|
require('./molecules/cookie-disclaimer/cookie-disclaimer');
|
|
12
14
|
|
|
13
15
|
require('./organisms/accordion/accordion');
|
|
@@ -26,12 +28,8 @@ require('./atoms/tooltip/tooltip');
|
|
|
26
28
|
|
|
27
29
|
require('./atoms/toggle-high-contrast/toggle-high-contrast');
|
|
28
30
|
|
|
29
|
-
require('./focusTrap');
|
|
30
|
-
|
|
31
31
|
require('./atoms/height-limiter/height-limiter');
|
|
32
32
|
|
|
33
|
-
require('./assets/js/conditional');
|
|
34
|
-
|
|
35
33
|
require('./atoms/file/file');
|
|
36
34
|
|
|
37
35
|
require('./atoms/file/filePreview');
|
|
@@ -64,4 +62,6 @@ require('./molecules/overview-navigation/overview-navigation');
|
|
|
64
62
|
|
|
65
63
|
require('./organisms/schedule/schedule-filter');
|
|
66
64
|
|
|
67
|
-
require('./assets/js/ot');
|
|
65
|
+
require('./assets/js/ot');
|
|
66
|
+
|
|
67
|
+
require('./atoms/range/range');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetstiftelsen/styleguide",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"main": "dist/components.js",
|
|
5
5
|
"ports": {
|
|
6
6
|
"fractal": "3000"
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"imagemin": "imagemin --out-dir=public/assets/img src/**/*.{png,jpg,gif}",
|
|
20
20
|
"build:css": "npm run stylelint && npm run scss && npm run cssmin",
|
|
21
21
|
"build:js": "npm run eslint && npm run babel && npm run browserify",
|
|
22
|
+
"build:js:replace:string": "replace \"require('./components');\" \"//require('./components');\" src/ -r --include=\"app.js\"",
|
|
22
23
|
"build:img": "npm run imagemin",
|
|
23
24
|
"watch:css": "onchange 'src/**/*.scss' -- npm run build:css",
|
|
24
25
|
"watch:js": "onchange 'src/**/*.js' -- npm run build:js",
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"copy:zip:build": "copyfiles -f src/assets/zip/* build/assets/zip",
|
|
35
36
|
"copy:fonts:build": "copyfiles -f src/base/fonts/* build/assets/fonts",
|
|
36
37
|
"copy:build": "npm run copy:images:build && npm run copy:zip:build && npm run copy:fonts:build && npm run copy:videos:build",
|
|
37
|
-
"build": "npm run build:css && npm run build:js && npm run uglify && npm run build:fractal && npm run copy:build",
|
|
38
|
+
"build": "npm run build:css && npm run build:js:replace:string && npm run build:js && npm run uglify && npm run package-js && npm run build:fractal && npm run copy:build && npm run create-icons-config",
|
|
38
39
|
"dev": "concurrently \"npm:start:fractal\" \"npm:watch\" \"npm:copy:local-assets\"",
|
|
39
40
|
"package-js": "NODE_ENV=production babel src --out-dir dist --ignore src/**/*.config.js,src/app.js",
|
|
40
41
|
"create-icons-config": "node ./createIconsJson"
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
"onchange": "^6.1.0",
|
|
64
65
|
"postcss-class-prefix": "^0.3.0",
|
|
65
66
|
"postcss-cli": "^8.3.1",
|
|
67
|
+
"replace": "^1.2.1",
|
|
66
68
|
"sass": "^1.35.1",
|
|
67
69
|
"stylelint": "^13.13.1",
|
|
68
70
|
"uglify-es": "^3.3.9"
|
package/src/app.js
CHANGED
package/src/components.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import './molecules/form';
|
|
2
|
+
import './atoms/textarea/rich-text';
|
|
1
3
|
import './atoms/password-toggle/password-toggle';
|
|
2
4
|
import './utilities/tab-highlighting/tab-highlighting';
|
|
3
5
|
import './molecules/system-error/system-error';
|
|
4
|
-
import 'a11y-toggle';
|
|
5
6
|
import './molecules/cookie-disclaimer/cookie-disclaimer';
|
|
6
7
|
import './organisms/accordion/accordion';
|
|
7
8
|
import './organisms/tabs/tabs';
|
|
@@ -11,9 +12,7 @@ import './molecules/share/share';
|
|
|
11
12
|
import './molecules/natural-language-form/natural-language-form';
|
|
12
13
|
import './atoms/tooltip/tooltip';
|
|
13
14
|
import './atoms/toggle-high-contrast/toggle-high-contrast';
|
|
14
|
-
import './focusTrap';
|
|
15
15
|
import './atoms/height-limiter/height-limiter';
|
|
16
|
-
import './assets/js/conditional';
|
|
17
16
|
import './atoms/file/file';
|
|
18
17
|
import './atoms/file/filePreview';
|
|
19
18
|
import './organisms/podcast/podcast';
|