@gitlab/ui 37.2.0 → 37.3.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/CHANGELOG.md +7 -0
- package/dist/directives/safe_html/safe_html.documentation.js +1 -1
- package/dist/directives/safe_link/safe_link.documentation.js +2 -3
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/documentation/documented_stories.js +2 -0
- package/package.json +1 -1
- package/src/directives/safe_html/safe_html.md +0 -4
- package/src/directives/safe_html/safe_html.stories.js +53 -44
- package/src/directives/safe_link/safe_link.documentation.js +0 -1
- package/src/directives/safe_link/safe_link.md +0 -4
- package/src/directives/safe_link/safe_link.stories.js +31 -30
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/background.scss +4 -0
|
@@ -77,6 +77,7 @@ export const setupStorybookReadme = () =>
|
|
|
77
77
|
'GlSorting',
|
|
78
78
|
'GlSortingItem',
|
|
79
79
|
'GlIcon',
|
|
80
|
+
'GlSafeLinkDirective',
|
|
80
81
|
'GlDashboardSkeleton',
|
|
81
82
|
'GlToggle',
|
|
82
83
|
'GlNavbar',
|
|
@@ -113,6 +114,7 @@ export const setupStorybookReadme = () =>
|
|
|
113
114
|
'GlChartTooltip',
|
|
114
115
|
'GlInputGroupText',
|
|
115
116
|
'GlGaugeChart',
|
|
117
|
+
'GlSafeHtmlDirective',
|
|
116
118
|
'GlFormRadio',
|
|
117
119
|
'GlModal',
|
|
118
120
|
'GlKeysetPagination',
|
package/package.json
CHANGED
|
@@ -1,50 +1,59 @@
|
|
|
1
|
-
import { withKnobs, text } from '@storybook/addon-knobs';
|
|
2
1
|
import { sanitize } from 'dompurify';
|
|
3
|
-
import {
|
|
4
|
-
import { documentedStoriesOf } from '../../../documentation/documented_stories';
|
|
5
|
-
import { GlSafeHtmlDirective } from '../../index';
|
|
2
|
+
import { GlSafeHtmlDirective as GlSafeHtml } from '../../index';
|
|
6
3
|
import readme from './safe_html.md';
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
const generateProps = ({
|
|
6
|
+
unsafeHTML = '<a href="javascript:alert(document.domain)">Click me</a>',
|
|
7
|
+
} = {}) => ({
|
|
8
|
+
unsafeHTML,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const Default = (_args, { argTypes }) => ({
|
|
12
|
+
directives: {
|
|
13
|
+
GlSafeHtml,
|
|
14
|
+
},
|
|
15
|
+
props: Object.keys(argTypes),
|
|
16
|
+
computed: {
|
|
17
|
+
sanitizedHtml() {
|
|
18
|
+
return sanitize(this.unsafeHTML);
|
|
20
19
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
},
|
|
21
|
+
template: `
|
|
22
|
+
<table class="gl-table">
|
|
23
|
+
<thead>
|
|
24
|
+
<tr>
|
|
25
|
+
<th>Directive</th>
|
|
26
|
+
<th>Output</th>
|
|
27
|
+
<th>Rendered</th>
|
|
28
|
+
</tr>
|
|
29
|
+
</thead>
|
|
30
|
+
<tbody>
|
|
31
|
+
<tr>
|
|
32
|
+
<td><strong>v-html</strong></td>
|
|
33
|
+
<td><code>{{ unsafeHTML }}</code></td>
|
|
34
|
+
<td>N/A for security reasons</td>
|
|
35
|
+
</tr>
|
|
36
|
+
<tr>
|
|
37
|
+
<td><strong>v-safe-html</strong></td>
|
|
38
|
+
<td><code>{{ sanitizedHtml }}</code></td>
|
|
39
|
+
<td v-gl-safe-html="unsafeHTML"></td>
|
|
40
|
+
</tr>
|
|
41
|
+
</tbody>
|
|
42
|
+
</table>
|
|
43
|
+
`,
|
|
44
|
+
});
|
|
45
|
+
Default.args = generateProps();
|
|
46
|
+
|
|
47
|
+
export default {
|
|
48
|
+
title: 'directives/safe-html-directive',
|
|
49
|
+
component: GlSafeHtml,
|
|
50
|
+
parameters: {
|
|
51
|
+
storyshots: { disable: true },
|
|
52
|
+
knobs: { disable: true },
|
|
53
|
+
docs: {
|
|
54
|
+
description: {
|
|
55
|
+
component: readme,
|
|
24
56
|
},
|
|
25
57
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<table class="gl-table">
|
|
29
|
-
<thead>
|
|
30
|
-
<tr>
|
|
31
|
-
<th>Directive</th>
|
|
32
|
-
<th>Output</th>
|
|
33
|
-
<th>Rendered</th>
|
|
34
|
-
</tr>
|
|
35
|
-
</thead>
|
|
36
|
-
<tbody>
|
|
37
|
-
<tr>
|
|
38
|
-
<td><strong>v-html</strong></td>
|
|
39
|
-
<td><code v-html="$options.escape(unsafeHTML)"></code></td>
|
|
40
|
-
<td>N/A for security reasons</td>
|
|
41
|
-
</tr>
|
|
42
|
-
<tr>
|
|
43
|
-
<td><strong>v-safe-html</strong></td>
|
|
44
|
-
<td><code v-html="$options.escape(sanitizedHtml)"></code></td>
|
|
45
|
-
<td v-gl-safe-html="unsafeHTML"></td>
|
|
46
|
-
</tr>
|
|
47
|
-
</tbody>
|
|
48
|
-
</table>
|
|
49
|
-
`,
|
|
50
|
-
}));
|
|
58
|
+
},
|
|
59
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { withKnobs, text, select } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../documentation/documented_stories';
|
|
3
|
-
import { targetOptions } from '../../utils/constants';
|
|
4
1
|
import { SafeLinkDirective as SafeLink } from './safe_link';
|
|
5
2
|
import readme from './safe_link.md';
|
|
6
3
|
|
|
@@ -9,31 +6,35 @@ const directives = {
|
|
|
9
6
|
};
|
|
10
7
|
|
|
11
8
|
// eslint-disable-next-line no-script-url
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
const generateProps = ({ href = 'javascript:alert(1)', target = '_blank' } = {}) => ({
|
|
10
|
+
href,
|
|
11
|
+
target,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const Default = (_args, { argTypes }) => ({
|
|
15
|
+
props: Object.keys(argTypes),
|
|
16
|
+
directives,
|
|
17
|
+
template: `
|
|
18
|
+
<a
|
|
19
|
+
:href="href"
|
|
20
|
+
:target="target"
|
|
21
|
+
v-safe-link
|
|
22
|
+
>
|
|
23
|
+
This is a secure link
|
|
24
|
+
</a>`,
|
|
25
|
+
});
|
|
26
|
+
Default.args = generateProps();
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</a>`,
|
|
39
|
-
}));
|
|
28
|
+
export default {
|
|
29
|
+
title: 'directives/safe-link-directive',
|
|
30
|
+
component: SafeLink,
|
|
31
|
+
parameters: {
|
|
32
|
+
knobs: { disable: true },
|
|
33
|
+
storyshots: { disable: true },
|
|
34
|
+
docs: {
|
|
35
|
+
description: {
|
|
36
|
+
component: readme,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
package/src/scss/utilities.scss
CHANGED
|
@@ -410,6 +410,14 @@
|
|
|
410
410
|
background-color: $orange-700 !important
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
+
.gl-bg-purple-50 {
|
|
414
|
+
background-color: $purple-50
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.gl-bg-purple-50\! {
|
|
418
|
+
background-color: $purple-50 !important
|
|
419
|
+
}
|
|
420
|
+
|
|
413
421
|
.gl-bg-red-50 {
|
|
414
422
|
background-color: $red-50
|
|
415
423
|
}
|