@madgex/design-system 1.54.2 → 1.55.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 +25 -11
- package/coverage/components/accordion/accordion.js.html +1 -1
- package/coverage/components/accordion/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 +35 -5
- package/coverage/components/inputs/file-upload/index.html +7 -7
- package/coverage/components/inputs/multi-select/index.html +1 -1
- package/coverage/components/inputs/multi-select/multi-select.js.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/MultiSelect.vue.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckbox.vue.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/MultiSelectCheckboxGroup.vue.html +1 -1
- package/coverage/components/inputs/multi-select/vue-components/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 +10 -10
- 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 +4 -10
- package/coverage/js/index-polyfills.js.html +1 -1
- package/coverage/js/index-vue.js.html +1 -1
- package/coverage/js/index.html +5 -5
- package/coverage/js/index.js.html +10 -4
- package/coverage/js/polyfills/closest.js.html +1 -1
- package/coverage/js/polyfills/index.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 +2 -2
- package/dist/_tokens/js/_tokens-module.js +3 -9
- package/dist/_tokens/scss/_tokens.scss +2 -2
- package/dist/assets/icons.json +1 -1
- package/dist/assets/icons.svg +1 -1
- package/dist/css/index.css +1 -1
- package/dist/js/index.js +8 -8
- package/fractal.js +12 -0
- package/package.json +33 -34
- package/src/components/icons/README.md +17 -0
- package/src/components/icons/icons.njk +3 -2
- package/src/components/icons/icons.scss +15 -14
- package/src/components/inputs/_form-elements.scss +3 -7
- package/src/components/inputs/_message/_template.njk +1 -1
- package/src/components/inputs/combobox/combobox.scss +1 -1
- package/src/components/inputs/file-upload/README.md +2 -1
- package/src/components/inputs/file-upload/_template.njk +47 -14
- package/src/components/inputs/file-upload/file-upload.config.js +3 -2
- package/src/components/inputs/file-upload/file-upload.js +10 -0
- package/src/components/inputs/file-upload/file-upload.njk +1 -0
- package/src/components/inputs/file-upload/file-upload.scss +38 -13
- package/src/components/inputs/multi-select/multi-select.scss +1 -1
- package/src/icons/upload.svg +9 -0
- package/src/js/index-fractal.js +0 -2
- package/src/js/index.js +2 -0
- package/src/tokens/color.json +1 -4
package/fractal.js
CHANGED
|
@@ -100,3 +100,15 @@ fractal.web.theme(madgexTheme);
|
|
|
100
100
|
*/
|
|
101
101
|
fractal.web.set('server.port', 4000);
|
|
102
102
|
fractal.web.set('server.sync', true);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Prevent warnings "a promise was created in a handler but was not returned from it"
|
|
106
|
+
* caused by Nunjucks from polluting the console
|
|
107
|
+
* (https://github.com/frctl/fractal/issues/235)
|
|
108
|
+
*/
|
|
109
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
110
|
+
const bluebird = require('bluebird');
|
|
111
|
+
|
|
112
|
+
bluebird.config({
|
|
113
|
+
warnings: false,
|
|
114
|
+
});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@madgex/design-system",
|
|
3
3
|
"author": "Madgex",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.55.0",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"clean": "rimraf dist public tokens/build",
|
|
8
8
|
"commit": "commit",
|
|
@@ -25,60 +25,59 @@
|
|
|
25
25
|
"url": "https://github.com/madgex/madgex-design-system"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ctrl/tinycolor": "^2.
|
|
29
|
-
"css-loader": "^3.
|
|
28
|
+
"@ctrl/tinycolor": "^2.6.1",
|
|
29
|
+
"css-loader": "^3.6.0",
|
|
30
30
|
"document-register-element": "^1.14.3",
|
|
31
31
|
"mini-css-extract-plugin": "^0.8.0",
|
|
32
|
-
"node-sass": "^4.12.0",
|
|
33
32
|
"popper.js": "^1.16.0",
|
|
34
|
-
"postcss": "^7.0.
|
|
33
|
+
"postcss": "^7.0.32",
|
|
35
34
|
"postcss-cli": "^6.1.3",
|
|
36
35
|
"postcss-loader": "^3.0.0",
|
|
37
36
|
"sass-loader": "^7.3.1",
|
|
38
|
-
"style-dictionary": "^2.
|
|
37
|
+
"style-dictionary": "^2.10.1",
|
|
39
38
|
"style-loader": "^0.23.1",
|
|
40
39
|
"svgxuse": "^1.2.6",
|
|
41
40
|
"vue": "^2.6.11",
|
|
42
|
-
"vue-custom-element": "^3.2.
|
|
41
|
+
"vue-custom-element": "^3.2.14"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@babel/core": "^7.
|
|
46
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
47
|
-
"@babel/preset-env": "^7.
|
|
48
|
-
"@babel/runtime": "^7.
|
|
44
|
+
"@babel/core": "^7.10.5",
|
|
45
|
+
"@babel/plugin-transform-runtime": "^7.10.5",
|
|
46
|
+
"@babel/preset-env": "^7.10.4",
|
|
47
|
+
"@babel/runtime": "^7.10.5",
|
|
49
48
|
"@commitlint/cli": "^8.2.0",
|
|
50
49
|
"@commitlint/config-conventional": "^8.2.0",
|
|
51
50
|
"@commitlint/prompt-cli": "^8.2.0",
|
|
52
|
-
"@frctl/fractal": "^1.
|
|
53
|
-
"@frctl/mandelbrot": "^1.
|
|
54
|
-
"@frctl/nunjucks": "^2.0.
|
|
55
|
-
"@madgex/eslint-config-madgex": "^1.2.
|
|
51
|
+
"@frctl/fractal": "^1.3.0",
|
|
52
|
+
"@frctl/mandelbrot": "^1.4.0",
|
|
53
|
+
"@frctl/nunjucks": "^2.0.2",
|
|
54
|
+
"@madgex/eslint-config-madgex": "^1.2.4",
|
|
56
55
|
"@vue/eslint-config-prettier": "^6.0.0",
|
|
57
|
-
"@vue/test-utils": "^1.0.
|
|
58
|
-
"autoprefixer": "^9.
|
|
59
|
-
"axe-core": "^3.
|
|
56
|
+
"@vue/test-utils": "^1.0.3",
|
|
57
|
+
"autoprefixer": "^9.8.5",
|
|
58
|
+
"axe-core": "^3.5.5",
|
|
60
59
|
"babel-core": "^7.0.0-bridge.0",
|
|
61
60
|
"babel-jest": "^24.9.0",
|
|
62
|
-
"babel-loader": "^8.0
|
|
61
|
+
"babel-loader": "^8.1.0",
|
|
63
62
|
"bubleify": "^1.2.1",
|
|
64
63
|
"commitizen": "^3.1.2",
|
|
65
64
|
"concurrently": "^4.1.2",
|
|
66
|
-
"core-js": "^3.
|
|
67
|
-
"cross-env": "^7.0.
|
|
65
|
+
"core-js": "^3.6.5",
|
|
66
|
+
"cross-env": "^7.0.2",
|
|
68
67
|
"cssnano": "^4.1.10",
|
|
69
68
|
"cypress": "^3.6.1",
|
|
70
69
|
"cypress-axe": "^0.5.1",
|
|
71
|
-
"cypress-commands": "^1.
|
|
70
|
+
"cypress-commands": "^1.1.0",
|
|
72
71
|
"cz-conventional-changelog": "^2.1.0",
|
|
73
72
|
"del": "^5.1.0",
|
|
74
73
|
"eslint": "^6.8.0",
|
|
75
|
-
"eslint-config-airbnb-base": "^14.
|
|
76
|
-
"eslint-config-prettier": "^6.
|
|
77
|
-
"eslint-plugin-cypress": "^2.
|
|
78
|
-
"eslint-plugin-import": "^2.
|
|
79
|
-
"eslint-plugin-prettier": "^3.1.
|
|
74
|
+
"eslint-config-airbnb-base": "^14.2.0",
|
|
75
|
+
"eslint-config-prettier": "^6.11.0",
|
|
76
|
+
"eslint-plugin-cypress": "^2.11.1",
|
|
77
|
+
"eslint-plugin-import": "^2.22.0",
|
|
78
|
+
"eslint-plugin-prettier": "^3.1.4",
|
|
80
79
|
"eslint-plugin-promise": "^4.2.1",
|
|
81
|
-
"eslint-plugin-vue": "^6.
|
|
80
|
+
"eslint-plugin-vue": "^6.2.2",
|
|
82
81
|
"file-loader": "^4.2.0",
|
|
83
82
|
"flat": "^4.1.0",
|
|
84
83
|
"gulp": "^4.0.2",
|
|
@@ -88,20 +87,20 @@
|
|
|
88
87
|
"link-module-alias": "^1.2.0",
|
|
89
88
|
"lint-staged": "^9.4.2",
|
|
90
89
|
"mini-css-extract-plugin": "^0.8.0",
|
|
91
|
-
"node-sass": "^4.
|
|
90
|
+
"node-sass": "^4.14.1",
|
|
92
91
|
"prettier": "^1.19.1",
|
|
93
92
|
"rimraf": "^2.7.1",
|
|
94
93
|
"semantic-release": "^15.13.24",
|
|
95
|
-
"svg-sprite-loader": "^4.
|
|
94
|
+
"svg-sprite-loader": "^4.3.0",
|
|
96
95
|
"svgo": "^1.3.0",
|
|
97
96
|
"svgo-loader": "^2.2.1",
|
|
98
97
|
"svgstore": "^3.0.0-2",
|
|
99
|
-
"vue-jest": "^3.0.
|
|
100
|
-
"vue-loader": "^15.
|
|
98
|
+
"vue-jest": "^3.0.6",
|
|
99
|
+
"vue-loader": "^15.9.3",
|
|
101
100
|
"vue-template-compiler": "^2.6.11",
|
|
102
101
|
"webpack": "^4.41.2",
|
|
103
|
-
"webpack-cli": "^3.3.
|
|
104
|
-
"webpack-dev-server": "^3.
|
|
102
|
+
"webpack-cli": "^3.3.12",
|
|
103
|
+
"webpack-dev-server": "^3.11.0",
|
|
105
104
|
"webpack-stream": "^5.2.1"
|
|
106
105
|
},
|
|
107
106
|
"config": {
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
- `classes`: add extra CSS classes to the icon
|
|
5
5
|
- `path`: if you need to use a different path than the default (*/assets/icons.svg*)
|
|
6
6
|
- `visuallyHiddenLabel`: add a visually hidden label (see Accessibility notes below)
|
|
7
|
+
- `hasContainer`: `true/false` - used to add a container arount the icon *optional*
|
|
8
|
+
- `containerClasses`: classes for the container (see Container notes below)
|
|
7
9
|
|
|
8
10
|
**Note regarding the default path of the icons file**:
|
|
9
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:
|
|
@@ -33,6 +35,21 @@ If using an icon next to some text, use classes `mds-icon--before` or `mds-icon-
|
|
|
33
35
|
|
|
34
36
|
To make sure that the icons have the same baseline as the text, we are adding `top: 0.125em` on them which corresponds to the icon offset divided by the size of the icon. Please see https://blog.prototypr.io/align-svg-icons-to-text-and-say-goodbye-to-font-icons-d44b3d7b26b4 to see how it is calculated.
|
|
35
37
|
|
|
38
|
+
## Container
|
|
39
|
+
|
|
40
|
+
You can use the attributes `hasContainer` and `containerClasses` to add an icon within an container.
|
|
41
|
+
We currently only have a circle.
|
|
42
|
+
Add `mds-icon-container--circle` in `containerClasses`.
|
|
43
|
+
|
|
44
|
+
To add a colour to the container, add one of the following classes:
|
|
45
|
+
- `mds-icon-container--error` = `$mds-color-status-error-dark`
|
|
46
|
+
- `mds-icon-container--success` = `$mds-color-status-success-dark`
|
|
47
|
+
- `mds-icon-container--success` = `$mds-color-status-info-dark`
|
|
48
|
+
|
|
49
|
+
Reference: [Colours tokens](/docs/tokens/colour)
|
|
50
|
+
|
|
51
|
+
If the icon is next to some text, you can also add `mds-icon-container--before` or `mds-icon-container--before` to add `margin-right` or `margin-left` to the icon (It will be the same value as `mds-icon--before` or `mds-icon--after`).
|
|
52
|
+
|
|
36
53
|
## IE support
|
|
37
54
|
|
|
38
55
|
Internet Explorer doesn't support `<use href="url" />` if we use a URL in the href. We are using https://github.com/Keyamoon/svgxuse as a polyfill.
|
|
@@ -72,8 +72,9 @@
|
|
|
72
72
|
|
|
73
73
|
<h2>Has container</h2>
|
|
74
74
|
{{- MdsIcon({
|
|
75
|
-
iconName: '
|
|
75
|
+
iconName: 'cross',
|
|
76
76
|
visuallyHiddenLabel: 'Error',
|
|
77
|
+
classes: 'mds-icon--md',
|
|
77
78
|
hasContainer: true,
|
|
78
|
-
containerClasses: 'mds-icon-container--circle'
|
|
79
|
+
containerClasses: 'mds-icon-container--circle mds-icon-container--error'
|
|
79
80
|
}) -}}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
top: 0.125em;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
.mds-icon-container {
|
|
13
12
|
display: inline-flex;
|
|
14
13
|
&--circle {
|
|
@@ -19,25 +18,34 @@
|
|
|
19
18
|
& .mds-icon {
|
|
20
19
|
top: 0;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
&--error,
|
|
21
|
+
|
|
22
|
+
&--error,
|
|
23
|
+
&--success,
|
|
24
|
+
&--info {
|
|
24
25
|
& .mds-icon {
|
|
25
26
|
fill: #fff;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
|
|
29
30
|
&--error {
|
|
30
31
|
background-color: $mds-color-status-error-dark;
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
|
|
33
34
|
&--success {
|
|
34
35
|
background-color: $mds-color-status-success-dark;
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
|
|
37
38
|
&--info {
|
|
38
39
|
background-color: $mds-color-status-info-dark;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
}
|
|
42
|
+
.mds-icon-container--before,
|
|
43
|
+
.mds-icon--before {
|
|
44
|
+
margin-right: 0.5em;
|
|
45
|
+
}
|
|
46
|
+
.mds-icon-container--after,
|
|
47
|
+
.mds-icon--after {
|
|
48
|
+
margin-left: 0.5em;
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
.mds-icon--sm {
|
|
@@ -55,13 +63,6 @@
|
|
|
55
63
|
height: $mds-size-icon-lg;
|
|
56
64
|
}
|
|
57
65
|
|
|
58
|
-
.mds-icon--before {
|
|
59
|
-
margin-right: 0.5em;
|
|
60
|
-
}
|
|
61
|
-
.mds-icon--after {
|
|
62
|
-
margin-left: 0.5em;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
66
|
.mds-icon--spinner {
|
|
66
67
|
animation: spin 900ms cubic-bezier(0.21, 0, 1, 1) infinite;
|
|
67
68
|
}
|
|
@@ -36,10 +36,6 @@
|
|
|
36
36
|
display: flex;
|
|
37
37
|
align-items: center;
|
|
38
38
|
color: $mds-color-status-error-dark;
|
|
39
|
-
|
|
40
|
-
& .mds-icon-container {
|
|
41
|
-
margin-right: $mds-size-baseline;
|
|
42
|
-
}
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
41
|
|
|
@@ -47,7 +43,7 @@
|
|
|
47
43
|
width: 100%;
|
|
48
44
|
padding: $mds-size-baseline * 3;
|
|
49
45
|
border-radius: $mds-size-border-radius;
|
|
50
|
-
border: $mds-size-border-width solid $mds-color-border;
|
|
46
|
+
border: $mds-size-border-width solid $mds-color-input-border;
|
|
51
47
|
@extend .mds-font-body-copy;
|
|
52
48
|
|
|
53
49
|
&:focus {
|
|
@@ -83,7 +79,7 @@
|
|
|
83
79
|
display: inline-block;
|
|
84
80
|
margin-right: $mds-size-baseline * 2;
|
|
85
81
|
margin-bottom: 0;
|
|
86
|
-
|
|
82
|
+
|
|
87
83
|
&:last-child {
|
|
88
84
|
margin-right: 0;
|
|
89
85
|
}
|
|
@@ -98,7 +94,7 @@
|
|
|
98
94
|
height: $mds-size-baseline * 5;
|
|
99
95
|
width: $mds-size-baseline * 5;
|
|
100
96
|
padding: $mds-size-baseline;
|
|
101
|
-
border: $mds-color-input-border;
|
|
97
|
+
border: $mds-size-border-width solid $mds-color-input-border;
|
|
102
98
|
background-color: $mds-color-neutral-white;
|
|
103
99
|
outline: 0;
|
|
104
100
|
margin-right: $mds-size-baseline * 2;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
iconName: 'cross',
|
|
17
17
|
classes: 'mds-icon--sm',
|
|
18
18
|
hasContainer: true,
|
|
19
|
-
containerClasses: 'mds-icon-container--circle mds-icon-container--error'
|
|
19
|
+
containerClasses: 'mds-icon-container--circle mds-icon-container--error mds-icon-container--before'
|
|
20
20
|
})
|
|
21
21
|
-}}
|
|
22
22
|
{{- params.validationError -}}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
position: relative;
|
|
4
4
|
}
|
|
5
5
|
.mds-combobox__listbox {
|
|
6
|
-
border: $mds-size-border-width solid $mds-color-border;
|
|
6
|
+
border: $mds-size-border-width solid $mds-color-input-border;
|
|
7
7
|
border-top: none;
|
|
8
8
|
border-radius: 0 0 $mds-size-border-radius $mds-size-border-radius;
|
|
9
9
|
position: absolute;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
- `labelText`: The label for the input **required**,
|
|
4
4
|
- `buttonText`: The text for the secondary label acting as the file upload button, uses labelText unless specified **optional**,
|
|
5
5
|
- `defaultFileText`: The default text to show in place of a file name when a user has not selected a file yet **required**,
|
|
6
|
+
- `removeButtonText`: The text to show on the button that clears the input when a file has been selected **required**,
|
|
6
7
|
- `hideLabel`: true/false - Add this parameter if you need to visually hide the label **optional**
|
|
7
8
|
**(please see accessibility notes below regarding the use of this parameter)**
|
|
8
9
|
- `name`: The name of the input field, uses ID unless specified **optional**,
|
|
@@ -32,4 +33,4 @@ The styling falls back completely to a native file input with default design sys
|
|
|
32
33
|
|
|
33
34
|
## Note
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
When a file is selected, the drag & drop/file selection area is disabled. When using cloud services such as Dropbox or Google Drive, the buttons to access those services will disappear as well. The user will need to click on the "remove file" button to be able to select a file again, either using the file input or the cloud services.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{% from "../label/_macro.njk" import MdsInputLabel %}
|
|
2
2
|
{% from "../_message/_macro.njk" import MdsInputMessages %}
|
|
3
3
|
{% from "../../icons/_macro.njk" import MdsIcon %}
|
|
4
|
+
{% from "../../button/_macro.njk" import MdsButton %}
|
|
4
5
|
|
|
5
6
|
{% if params.name %}
|
|
6
7
|
{% set name = params.name %}
|
|
@@ -14,6 +15,16 @@
|
|
|
14
15
|
{% set buttonText = params.labelText %}
|
|
15
16
|
{% endif %}
|
|
16
17
|
|
|
18
|
+
{% set removeButtonText -%}
|
|
19
|
+
{{- params.removeButtonText -}}
|
|
20
|
+
{{-
|
|
21
|
+
MdsIcon({
|
|
22
|
+
iconName: 'cross',
|
|
23
|
+
classes: 'mds-icon--after'
|
|
24
|
+
})
|
|
25
|
+
-}}
|
|
26
|
+
{%- endset %}
|
|
27
|
+
|
|
17
28
|
<div class="mds-form-element mds-form-element--file{% if params.state %} mds-form-element--{{params.state}}{% endif %}{% if params.classes %} {{params.classes}}{% endif %}" id="{{ params.id }}-container" data-test="input">
|
|
18
29
|
{{ MdsInputLabel({
|
|
19
30
|
labelText: params.labelText,
|
|
@@ -48,21 +59,43 @@
|
|
|
48
59
|
{% endif %}
|
|
49
60
|
/>
|
|
50
61
|
<div class="mds-file-upload__input-controls" aria-hidden="true">
|
|
51
|
-
<div class="mds-file-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
<div class="mds-file-upload__selection-state">
|
|
63
|
+
<div class="mds-file-upload__prompt">
|
|
64
|
+
{{
|
|
65
|
+
MdsIcon({
|
|
66
|
+
iconName: 'upload',
|
|
67
|
+
classes: 'mds-icon--md mds-icon--before'
|
|
68
|
+
})
|
|
69
|
+
}}
|
|
70
|
+
<span>
|
|
71
|
+
{{ params.defaultFileText }}
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
{# The "button" is actually a label referencing the input but it looks like a button so using this for the name of the class #}
|
|
75
|
+
<div class="mds-file-upload__browse-button">
|
|
76
|
+
{{ MdsInputLabel({
|
|
77
|
+
labelText: buttonText,
|
|
78
|
+
id: params.id
|
|
79
|
+
}) }}
|
|
80
|
+
</div>
|
|
61
81
|
</div>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
<div class="mds-file-upload__selected-state">
|
|
83
|
+
<div class="mds-file-upload__file-name-container">
|
|
84
|
+
{{- MdsIcon({
|
|
85
|
+
iconName: 'check',
|
|
86
|
+
classes: 'mds-icon--md',
|
|
87
|
+
hasContainer: true,
|
|
88
|
+
containerClasses: 'mds-icon-container--circle mds-icon-container--success mds-icon-container--before'
|
|
89
|
+
})
|
|
90
|
+
-}}
|
|
91
|
+
<span class="mds-file-upload__file-name"></span>
|
|
92
|
+
</div>
|
|
93
|
+
{{ MdsButton({
|
|
94
|
+
html: removeButtonText,
|
|
95
|
+
classes: 'mds-button--plain mds-file-upload__remove-button',
|
|
96
|
+
type: 'button'
|
|
97
|
+
}) }}
|
|
98
|
+
</div>
|
|
66
99
|
</div>
|
|
67
100
|
</div>
|
|
68
101
|
</div>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
title: 'File Upload',
|
|
3
|
-
status: '
|
|
3
|
+
status: 'wip',
|
|
4
4
|
context: {
|
|
5
5
|
labelText: 'Upload a file',
|
|
6
6
|
helpText: 'Your file must be a .doc, .pdf, .docx, or .rtf. No larger than 1MB',
|
|
7
7
|
defaultFileText: 'Drag and drop',
|
|
8
|
-
buttonText: '
|
|
8
|
+
buttonText: 'Choose a file',
|
|
9
|
+
removeButtonText: 'Remove file',
|
|
9
10
|
name: 'file',
|
|
10
11
|
id: 'file',
|
|
11
12
|
fileTypes: '.doc,.docx,.pdf,.rtf',
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const fileUploadClass = '.mds-form-element--file';
|
|
2
|
+
const selectedFileClass = 'mds-form-element--selected-file';
|
|
2
3
|
const fileNameContainerClass = '.mds-file-upload__file-name';
|
|
4
|
+
const removeButtonClass = '.mds-file-upload__remove-button';
|
|
3
5
|
|
|
4
6
|
const fileUpload = {
|
|
5
7
|
init: () => {
|
|
@@ -7,11 +9,19 @@ const fileUpload = {
|
|
|
7
9
|
fileUploads.forEach((uploader) => {
|
|
8
10
|
const fileNameContainer = uploader.querySelector(fileNameContainerClass);
|
|
9
11
|
const input = uploader.querySelector('input[type=file]');
|
|
12
|
+
const removeButton = uploader.querySelector(removeButtonClass);
|
|
10
13
|
input.addEventListener('change', () => {
|
|
11
14
|
if (input.files && input.files.length) {
|
|
12
15
|
fileNameContainer.textContent = input.files[0].name;
|
|
16
|
+
uploader.classList.add(selectedFileClass);
|
|
13
17
|
}
|
|
14
18
|
});
|
|
19
|
+
removeButton.addEventListener('click', (elem) => {
|
|
20
|
+
elem.preventDefault();
|
|
21
|
+
input.value = '';
|
|
22
|
+
fileNameContainer.textContent = '';
|
|
23
|
+
uploader.classList.remove(selectedFileClass);
|
|
24
|
+
});
|
|
15
25
|
});
|
|
16
26
|
},
|
|
17
27
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.mds-file-upload__input .mds-file-upload__input-controls
|
|
1
|
+
.mds-file-upload__input .mds-file-upload__input-controls {
|
|
2
2
|
display: none;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
align-items: center;
|
|
23
23
|
justify-content: center;
|
|
24
24
|
|
|
25
|
-
@include mq($from: $mds-size-breakpoint-md) {
|
|
26
|
-
width: 50%;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
25
|
& .mds-form-label {
|
|
30
26
|
@include z-index;
|
|
31
27
|
display: block;
|
|
@@ -44,14 +40,14 @@
|
|
|
44
40
|
top: 0;
|
|
45
41
|
opacity: 0;
|
|
46
42
|
}
|
|
47
|
-
|
|
43
|
+
|
|
48
44
|
& .mds-file-upload__input-controls {
|
|
49
45
|
display: flex;
|
|
50
46
|
flex-direction: column;
|
|
51
47
|
align-items: center;
|
|
52
48
|
justify-content: center;
|
|
53
49
|
}
|
|
54
|
-
|
|
50
|
+
|
|
55
51
|
& .mds-form-control:focus ~ .mds-file-upload__input-controls {
|
|
56
52
|
// Apply some focus styling to the 'button' when the input has focus and can be keyboard-activated
|
|
57
53
|
label {
|
|
@@ -65,15 +61,44 @@
|
|
|
65
61
|
.js .mds-file-upload__prompt {
|
|
66
62
|
display: flex;
|
|
67
63
|
align-items: center;
|
|
68
|
-
margin-bottom: $mds-size-baseline *
|
|
64
|
+
margin-bottom: $mds-size-baseline * 5;
|
|
69
65
|
|
|
70
66
|
& .mds-icon {
|
|
71
|
-
display: inline-block;
|
|
72
67
|
fill: $mds-color-button-bg-base;
|
|
73
68
|
}
|
|
74
69
|
}
|
|
75
70
|
|
|
76
|
-
.
|
|
77
|
-
display:
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
.mds-file-upload__selected-state {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
.mds-file-upload__file-name-container {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
}
|
|
78
|
+
.mds-file-upload__remove-button {
|
|
79
|
+
@include z-index;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.js .mds-form-element--selected-file {
|
|
83
|
+
/* When a file is selected, we reduce the input size to 0 (.mds-form-control)
|
|
84
|
+
* so the user can't click or drag and drop in the grey area anymore.
|
|
85
|
+
* Will mostly be useful when used with the cloud services buttons
|
|
86
|
+
* as the user will need to clear the input to see the buttons again.
|
|
87
|
+
* We also remove the dotted border to indicate the change
|
|
88
|
+
*/
|
|
89
|
+
& .mds-file-upload__input {
|
|
90
|
+
border: 0;
|
|
91
|
+
}
|
|
92
|
+
& .mds-form-control {
|
|
93
|
+
width: 0;
|
|
94
|
+
height: 0;
|
|
95
|
+
padding: 0;
|
|
96
|
+
border: 0;
|
|
97
|
+
}
|
|
98
|
+
& .mds-file-upload__selection-state {
|
|
99
|
+
display: none;
|
|
100
|
+
}
|
|
101
|
+
& .mds-file-upload__selected-state {
|
|
102
|
+
display: block;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="32px" height="31px" viewBox="0 0 32 31" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>Combined Shape</title>
|
|
4
|
+
<g id="-------Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="Icon/-32/-Upload" transform="translate(0.000000, -1.000000)" fill="#000000">
|
|
6
|
+
<path d="M0.796205338,22.6627686 C1.30386191,22.3605456 1.93422258,22.3605456 2.44187915,22.6627686 C2.94953573,22.9649916 3.25426091,23.521676 3.23742093,24.1160966 L3.23742093,24.1160966 L3.23742093,26.6147633 C3.23887729,27.7820523 4.17650775,28.7279607 5.33358148,28.72943 L5.33358148,28.72943 L26.3877035,28.72943 C27.5447772,28.7279607 28.4824077,27.7820523 28.4838641,26.6147633 L28.4838641,26.6147633 L28.4838641,24.1160966 C28.4670241,23.521676 28.7717493,22.9649916 29.2794058,22.6627686 C29.7870624,22.3605456 30.4174231,22.3605456 30.9250797,22.6627686 C31.4327362,22.9649916 31.7374614,23.521676 31.7206214,24.1160966 L31.7206214,24.1160966 L31.7206214,26.6147633 C31.7177072,29.5848366 29.3317848,31.9918233 26.3877035,31.9947633 L26.3877035,31.9947633 L5.33358148,31.9947633 C2.38950019,31.9918233 0.00357777491,29.5848366 0.000663562144,26.6147633 L0.000663562144,26.6147633 L0.000663562144,24.1160966 C-0.0161764136,23.521676 0.288548762,22.9649916 0.796205338,22.6627686 Z M15.8606425,1 C16.2309482,1 16.5846485,1.15502847 16.8373529,1.42809662 L16.8373529,1.42809662 L23.3135109,8.93209662 C23.6467354,9.31805283 23.7256211,9.86486335 23.5152704,10.3306293 C23.3049198,10.7963952 22.8441513,11.095163 22.3368006,11.0947633 L22.3368006,11.0947633 L18.7802003,11.0947633 C18.5977164,11.0947633 18.4497841,11.2440017 18.4497841,11.4280966 L18.4497841,11.4280966 L18.4497841,23.64543 C18.4497841,25.0879977 17.2905859,26.25743 15.8606425,26.25743 C14.4306991,26.25743 13.2715009,25.0879977 13.2715009,23.64543 L13.2715009,23.64543 L13.2715009,11.42943 C13.2715009,11.245335 13.1235686,11.0960966 12.9410847,11.0960966 L12.9410847,11.0960966 L9.38448443,11.0960966 C8.87922881,11.0946921 8.42100228,10.7967213 8.21109093,10.3330744 C8.00117958,9.86942749 8.07798709,9.32492956 8.40777406,8.93876329 L8.40777406,8.93876329 L14.8839321,1.42809662 C15.1366365,1.15502847 15.4903368,1 15.8606425,1 Z" id="Combined-Shape"></path>
|
|
7
|
+
</g>
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|
package/src/js/index-fractal.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import switchStateScript from './fractal-scripts/switch-state';
|
|
2
2
|
import notificationScript from './fractal-scripts/notification';
|
|
3
3
|
import comboboxScript from './fractal-scripts/combobox';
|
|
4
|
-
import fileUpload from '../components/inputs/file-upload/file-upload';
|
|
5
4
|
|
|
6
5
|
document.addEventListener('DOMContentLoaded', () => {
|
|
7
6
|
switchStateScript.init();
|
|
8
7
|
notificationScript.init();
|
|
9
8
|
comboboxScript.init();
|
|
10
|
-
fileUpload.init();
|
|
11
9
|
});
|
package/src/js/index.js
CHANGED
|
@@ -12,10 +12,12 @@ import tabs from '../components/tabs/tabs';
|
|
|
12
12
|
import accordion from '../components/accordion/accordion';
|
|
13
13
|
import popovers from '../components/popover/popover';
|
|
14
14
|
import modals from '../components/modal/modal';
|
|
15
|
+
import fileUpload from '../components/inputs/file-upload/file-upload';
|
|
15
16
|
|
|
16
17
|
document.addEventListener('DOMContentLoaded', () => {
|
|
17
18
|
tabs.init();
|
|
18
19
|
accordion.init();
|
|
19
20
|
popovers.init();
|
|
20
21
|
modals.init();
|
|
22
|
+
fileUpload.init();
|
|
21
23
|
});
|
package/src/tokens/color.json
CHANGED