@madgex/design-system 3.4.2 → 3.5.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/coverage/cobertura-coverage.xml +1 -1
- package/coverage/components/accordion/accordion.js.html +1 -1
- package/coverage/components/accordion/index.html +1 -1
- package/coverage/components/button/button.js.html +1 -1
- package/coverage/components/button/index.html +1 -1
- package/coverage/components/inputs/combobox/combobox.js.html +1 -1
- package/coverage/components/inputs/combobox/index.html +1 -1
- package/coverage/components/inputs/combobox/vue-components/Combobox.vue.html +1 -1
- package/coverage/components/inputs/combobox/vue-components/ListBoxOption.vue.html +1 -1
- package/coverage/components/inputs/combobox/vue-components/index.html +1 -1
- package/coverage/components/inputs/file-upload/file-upload.js.html +1 -1
- package/coverage/components/inputs/file-upload/index.html +1 -1
- package/coverage/components/inputs/textarea/character-count.js.html +1 -1
- package/coverage/components/inputs/textarea/index.html +1 -1
- package/coverage/components/modal/index.html +1 -1
- package/coverage/components/modal/modal.js.html +1 -1
- package/coverage/components/notification/index.html +1 -1
- package/coverage/components/notification/notification.js.html +1 -1
- package/coverage/components/popover/index.html +1 -1
- package/coverage/components/popover/popover.js.html +1 -1
- package/coverage/components/switch-state/index.html +1 -1
- package/coverage/components/switch-state/switch-state.js.html +1 -1
- package/coverage/components/tabs/index.html +1 -1
- package/coverage/components/tabs/tabs.js.html +1 -1
- package/coverage/index.html +1 -1
- package/coverage/js/common.js.html +1 -1
- package/coverage/js/fractal-scripts/combobox.js.html +1 -1
- package/coverage/js/fractal-scripts/index.html +1 -1
- package/coverage/js/fractal-scripts/notification.js.html +1 -1
- package/coverage/js/fractal-scripts/switch-state.js.html +1 -1
- package/coverage/js/index-fractal.js.html +1 -1
- package/coverage/js/index-polyfills.js.html +1 -1
- package/coverage/js/index-vue.js.html +1 -1
- package/coverage/js/index.html +1 -1
- package/coverage/js/index.js.html +1 -1
- package/coverage/js/polyfills/arrayPrototypeFind.js.html +1 -1
- package/coverage/js/polyfills/closest.js.html +1 -1
- package/coverage/js/polyfills/index.html +1 -1
- package/coverage/js/polyfills/objectAssign.js.html +1 -1
- package/coverage/js/polyfills/remove.js.html +1 -1
- package/coverage/tokens/_config.js.html +1 -1
- package/coverage/tokens/index.html +1 -1
- package/dist/_tokens/css/_tokens.css +1 -1
- package/dist/_tokens/js/_tokens-module.js +1 -1
- package/dist/_tokens/scss/_tokens.scss +1 -1
- package/dist/assets/icons-inline.svg +1 -0
- package/dist/assets/icons.json +1 -1
- package/dist/assets/icons.svg +1 -6
- package/dist/js/index.js +1 -1
- package/docs/tokens/icons.njk +1 -1
- package/package.json +2 -2
- package/src/components/icons/README.md +10 -6
- package/src/components/icons/_template.njk +1 -8
- package/src/components/inputs/combobox/vue-components/ListBox.vue +1 -1
- package/src/icons/check.svg +1 -1
- package/src/icons/question-mark.svg +1 -1
- package/tasks/svgsprite.js +20 -14
package/docs/tokens/icons.njk
CHANGED
|
@@ -9,7 +9,7 @@ All icons available in MDS
|
|
|
9
9
|
{% macro Icon(params) %}
|
|
10
10
|
<div class="icon">
|
|
11
11
|
<svg class="mds-icon mds-icon--{{ params.name }}{% if class %} {{ class }}{% endif %}">
|
|
12
|
-
<use href="{{ '/assets/icons.svg' | path }}#{{ params.name }}" />
|
|
12
|
+
<use href="{{ '/assets/icons.svg' | path }}#icon-{{ params.name }}" />
|
|
13
13
|
</svg>
|
|
14
14
|
<span class="icon__label"><code>mds-icon--{{ params.name }}</code></span>
|
|
15
15
|
</div>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@madgex/design-system",
|
|
3
3
|
"author": "Madgex",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.5.0",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"clean": "rimraf dist public tokens/build",
|
|
8
8
|
"commit": "commit",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"sass": "^1.35.2",
|
|
98
98
|
"semantic-release": "^15.13.24",
|
|
99
99
|
"svg-sprite-loader": "^6.0.9",
|
|
100
|
-
"svgo": "^2.
|
|
100
|
+
"svgo": "^2.8.0",
|
|
101
101
|
"svgo-loader": "^3.0.0",
|
|
102
102
|
"svgstore": "^3.0.0-2",
|
|
103
103
|
"vue-jest": "^3.0.7",
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
## Setup
|
|
2
|
+
|
|
3
|
+
**Default path of the icons file**:
|
|
4
|
+
|
|
5
|
+
You need to set `defaultIconPath` as a Nunjucks global if you want to use an external file (for example, `/assets/icons/svg`).
|
|
6
|
+
https://mozilla.github.io/nunjucks/api.html#addglobal
|
|
7
|
+
|
|
8
|
+
If you prefer using inline svgs, don't set the path and include the file `icons-inline.svg` in your template instead.
|
|
9
|
+
|
|
1
10
|
## Parameters
|
|
2
11
|
|
|
3
12
|
- `iconName`: the name of the icon you want to use
|
|
4
13
|
- `classes`: add extra CSS classes to the icon
|
|
5
|
-
- `path`: if you need to use a different path than
|
|
14
|
+
- `path`: if you need to use a different path than your default
|
|
6
15
|
- `visuallyHiddenLabel`: add a visually hidden label (see Accessibility notes below)
|
|
7
16
|
- `hasContainer`: `true/false` - used to add a container arount the icon *optional*
|
|
8
17
|
- `containerClasses`: classes for the container (see Container notes below)
|
|
9
18
|
|
|
10
|
-
**Note regarding the default path of the icons file**:
|
|
11
|
-
If you would like to change the default path, you can use the `defaultIconPath` variable in Nunjucks. You can set it as global variable like this:
|
|
12
|
-
|
|
13
|
-
`env.addGlobal('defaultIconPath', value)`
|
|
14
|
-
|
|
15
19
|
## Accessibility
|
|
16
20
|
|
|
17
21
|
The SVGs are hidden from screen readers by default (with the use of `aria-hidden=true` and `focusable=false`). When the icons are used without a visible label, a **visually hidden label needs to be added** instead.
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
{%- set iconPath -%}
|
|
2
|
-
{%- if defaultIconPath -%}
|
|
3
|
-
{{- defaultIconPath -}}
|
|
4
|
-
{%- else -%}
|
|
5
|
-
'/assets/icons.svg'
|
|
6
|
-
{%- endif -%}
|
|
7
|
-
{%- endset -%}
|
|
8
1
|
{%- if params.hasContainer -%}
|
|
9
2
|
<span class="mds-icon-container {{ params.containerClasses }}">
|
|
10
3
|
{%- endif -%}
|
|
11
4
|
<svg aria-hidden="true" focusable="false" class="mds-icon mds-icon--{{ params.iconName }}{% if params.classes %} {{ params.classes }}{% endif %}">
|
|
12
|
-
<use href="{{ params.path | default(
|
|
5
|
+
<use href="{{ params.path | default(defaultIconPath) }}#icon-{{ params.iconName }}" />
|
|
13
6
|
</svg>
|
|
14
7
|
{%- if params.visuallyHiddenLabel %}
|
|
15
8
|
<span class="mds-visually-hidden">{{ params.visuallyHiddenLabel }}</span>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<!-- Ideally we would pass this in as a slot in the custom element with MdsIcon, but something is borked
|
|
5
5
|
with passing slots in Chrome https://github.com/karol-f/vue-custom-element/issues/162 -->
|
|
6
6
|
<svg aria-hidden="true" focusable="true" class="mds-icon mds-icon--spinner mds-icon--after">
|
|
7
|
-
<use :href="`${iconPath}#spinner`" />
|
|
7
|
+
<use :href="`${iconPath}#icon-spinner`" />
|
|
8
8
|
</svg>
|
|
9
9
|
<span class="mds-visually-hidden">Loading...</span>
|
|
10
10
|
</li>
|
package/src/icons/check.svg
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg width="36" height="36" xmlns="http://www.w3.org/2000/svg"><path d="M26.18 9.546a1.205 1.205 0 00-1.628.255L13.636 24.296l-3.644-3.473a1.207 1.207 0 00-1.127-.288 1.14 1.14 0 00-.825.786c-.108.383.007.792.301 1.073l4.617 4.396c.245.224.58.338.918.312.34-.027.65-.19.854-.45l11.718-15.556a1.078 1.078 0 00-.268-1.55z" fill="#FFF" fill-rule="nonzero"/></svg>
|
|
1
|
+
<svg width="36" height="36" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg"><path d="M26.18 9.546a1.205 1.205 0 00-1.628.255L13.636 24.296l-3.644-3.473a1.207 1.207 0 00-1.127-.288 1.14 1.14 0 00-.825.786c-.108.383.007.792.301 1.073l4.617 4.396c.245.224.58.338.918.312.34-.027.65-.19.854-.45l11.718-15.556a1.078 1.078 0 00-.268-1.55z" fill="#FFF" fill-rule="nonzero"/></svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="
|
|
1
|
+
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
2
2
|
<path fill="#000" fill-rule="evenodd" d="M16 0c2.9027923 0 5.5798489.71527063 8.03125 2.14583333 2.4514011 1.43056271 4.392354 3.37498771 5.8229167 5.83333334C31.2847294 10.4236233 32 13.0972077 32 16c0 2.9027923-.7152706 5.5798489-2.1458333 8.03125s-3.3715156 4.392354-5.8229167 5.8229167C21.5798489 31.2847294 18.9027923 32 16 32c-2.9027923 0-5.5798489-.7152706-8.03125-2.1458333-2.45140115-1.4305627-4.39235396-3.3715156-5.82291667-5.8229167C.71527063 21.5798489 0 18.9027923 0 16c0-2.9027923.71527063-5.5798489 2.14583333-8.03125C3.57639604 5.51734885 5.51734885 3.57639604 7.96875 2.14583333 10.4201511.71527063 13.0972077 0 16 0zm2 21.3333333h-4c-.1944454 0-.354166.0624994-.4791667.1875-.1250006.1250007-.1875.2847213-.1875.4791667v4c0 .1944454.0624994.354166.1875.4791667.1250007.1250006.2847213.1875.4791667.1875h4c.1944454 0 .354166-.0624994.4791667-.1875.1250006-.1250007.1875-.2847213.1875-.4791667v-4c0-.1944454-.0624994-.354166-.1875-.4791667-.1250007-.1250006-.2847213-.1875-.4791667-.1875zM16.4166667 5.33333333c-3.3750169 0-5.95138 1.47915188-7.7291667 4.4375-.20833438.33333497-.15277938.62499877.16666667.87499997l2.75000003 2.0833334c.0972227.0833337.2291658.125.3958333.125.2222233 0 .3958327-.0833325.5208333-.25.7361148-.9444492 1.3333311-1.5833317 1.7916667-1.9166667.4722246-.333335 1.0694408-.5 1.7916667-.5.66667 0 1.260414.1805537 1.78125.5416667.5208359.3611129.78125.770831.78125 1.2291666 0 .5277804-.1388875.9513873-.4166667 1.2708334-.2777792.319446-.7499967.6319429-1.4166667.9375-.8750043.3888908-1.6770797.9895792-2.40625 1.8020833-.7291703.8125041-1.09375 1.6840231-1.09375 2.6145833v.75c0 .1944454.0624994.3541661.1875.4791667C13.645834 19.9375006 13.8055546 20 14 20h4c.1944454 0 .354166-.0624994.4791667-.1875.1250006-.1250006.1875-.2847213.1875-.4791667 0-.2638902.149304-.6076367.4479166-1.03125.2986126-.4236132.6770811-.7673598 1.1354167-1.03125.4444467-.2500012.784721-.4479159 1.0208333-.59375.2361123-.145834.5555536-.3888872.9583334-.7291666.4027798-.3402795.7118044-.6736095.9270833-1 .2152789-.3263906.4097214-.7465252.5833333-1.2604167C23.9131953 13.1736085 24 12.6111142 24 12c0-1.2222283-.3854128-2.35416146-1.15625-3.39583333-.7708372-1.04167188-1.7326331-1.84721938-2.8854167-2.41666667-1.1527835-.56944729-2.3333273-.85416667-3.5416666-.85416667z" id="a"/>
|
|
3
3
|
</svg>
|
package/tasks/svgsprite.js
CHANGED
|
@@ -5,25 +5,21 @@ const svgstore = require('svgstore');
|
|
|
5
5
|
|
|
6
6
|
const filepath = path.resolve(__dirname, '../src/icons/');
|
|
7
7
|
const prefix = path.basename(filepath, path.extname(filepath));
|
|
8
|
+
|
|
8
9
|
const svgoOptions = {
|
|
9
10
|
plugins: [
|
|
10
11
|
{
|
|
11
|
-
name: '
|
|
12
|
+
name: 'preset-default',
|
|
12
13
|
params: {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
overrides: {
|
|
15
|
+
cleanupIDs: {
|
|
16
|
+
prefix: `${prefix}-`,
|
|
17
|
+
minify: true,
|
|
18
|
+
},
|
|
19
|
+
removeViewBox: false,
|
|
20
|
+
},
|
|
15
21
|
},
|
|
16
22
|
},
|
|
17
|
-
{ name: 'removeDoctype', params: true },
|
|
18
|
-
{ name: 'removeComments', params: true },
|
|
19
|
-
{ name: 'removeTitle', params: true },
|
|
20
|
-
{ name: 'removeDesc', params: true },
|
|
21
|
-
{ name: 'removeUselessDefs', params: true },
|
|
22
|
-
{ name: 'removeEditorsNSData', params: true },
|
|
23
|
-
{ name: 'cleanupAttrs', params: true },
|
|
24
|
-
{ name: 'cleanupNumericValues', params: true },
|
|
25
|
-
{ name: 'removeViewBox', params: false },
|
|
26
|
-
{ name: 'removeDimensions', params: true },
|
|
27
23
|
{
|
|
28
24
|
name: 'removeAttrs',
|
|
29
25
|
params: {
|
|
@@ -36,6 +32,13 @@ const svgoOptions = {
|
|
|
36
32
|
let files = [];
|
|
37
33
|
const icons = [];
|
|
38
34
|
const sprites = svgstore();
|
|
35
|
+
const inlineSprites = svgstore({
|
|
36
|
+
inline: true,
|
|
37
|
+
svgAttrs: {
|
|
38
|
+
id: 'spritesheet',
|
|
39
|
+
style: 'display: none',
|
|
40
|
+
},
|
|
41
|
+
});
|
|
39
42
|
|
|
40
43
|
async function createSvgStack() {
|
|
41
44
|
return new Promise((resolve, reject) => {
|
|
@@ -53,12 +56,15 @@ async function createSvgStack() {
|
|
|
53
56
|
})
|
|
54
57
|
.then((icon) => {
|
|
55
58
|
const fileName = path.parse(file).name;
|
|
59
|
+
const prefixedName = `icon-${fileName}`;
|
|
56
60
|
|
|
57
|
-
sprites.add(
|
|
61
|
+
sprites.add(prefixedName, icon.data);
|
|
62
|
+
inlineSprites.add(prefixedName, icon.data);
|
|
58
63
|
|
|
59
64
|
return fs.mkdir(path.resolve(__dirname, '../dist/assets'), { recursive: true }, async () => {
|
|
60
65
|
icons.push({ name: fileName });
|
|
61
66
|
fs.writeFileSync(`${path.resolve(__dirname, '../dist/assets', 'icons.svg')}`, sprites);
|
|
67
|
+
fs.writeFileSync(`${path.resolve(__dirname, '../dist/assets', 'icons-inline.svg')}`, inlineSprites);
|
|
62
68
|
fs.writeFileSync(`${path.resolve(__dirname, '../dist/assets', 'icons.json')}`, JSON.stringify(icons));
|
|
63
69
|
});
|
|
64
70
|
})
|