@gitlab/ui 118.0.0 → 118.1.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/dist/components/base/illustration/illustration.js +80 -0
- package/dist/components/index.js +1 -0
- package/package.json +1 -1
- package/src/components/base/illustration/illustration.vue +56 -0
- package/src/components/base/token_selector/token_selector.vue +27 -30
- package/src/components/index.js +1 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import illustrationsPath from '@gitlab/svgs/dist/illustrations.svg';
|
|
2
|
+
import illustrationsInfo from '@gitlab/svgs/dist/illustrations.json';
|
|
3
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
4
|
+
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
const knownIllustrations = illustrationsInfo.icons;
|
|
8
|
+
|
|
9
|
+
/** This is a re-usable vue component for rendering a svg sprite icon
|
|
10
|
+
* @example
|
|
11
|
+
* <illustration
|
|
12
|
+
* name="status-success-sm"
|
|
13
|
+
* />
|
|
14
|
+
*/
|
|
15
|
+
var script = {
|
|
16
|
+
name: 'GlIllustration',
|
|
17
|
+
props: {
|
|
18
|
+
/**
|
|
19
|
+
* One of the illustrations from https://gitlab-org.gitlab.io/gitlab-svgs/ project
|
|
20
|
+
*/
|
|
21
|
+
name: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: true,
|
|
24
|
+
validator: value => {
|
|
25
|
+
if (knownIllustrations.some(obj => obj.name === value)) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
// eslint-disable-next-line no-console
|
|
29
|
+
console.warn(`Illustration '${value}' is not a known illustration of @gitlab/svgs`);
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
computed: {
|
|
35
|
+
spriteHref() {
|
|
36
|
+
return `${illustrationsPath}#${this.name}`;
|
|
37
|
+
},
|
|
38
|
+
illustrationSize() {
|
|
39
|
+
return knownIllustrations.find(obj => obj.name === this.name).svg_size;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/* script */
|
|
45
|
+
const __vue_script__ = script;
|
|
46
|
+
|
|
47
|
+
/* template */
|
|
48
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('svg',_vm._g({key:_vm.spriteHref,attrs:{"data-testid":(_vm.name + "-illustration"),"aria-label":"","role":"presentation","width":_vm.illustrationSize,"height":_vm.illustrationSize}},_vm.$listeners),[_c('use',{attrs:{"href":_vm.spriteHref}})])};
|
|
49
|
+
var __vue_staticRenderFns__ = [];
|
|
50
|
+
|
|
51
|
+
/* style */
|
|
52
|
+
const __vue_inject_styles__ = undefined;
|
|
53
|
+
/* scoped */
|
|
54
|
+
const __vue_scope_id__ = undefined;
|
|
55
|
+
/* module identifier */
|
|
56
|
+
const __vue_module_identifier__ = undefined;
|
|
57
|
+
/* functional template */
|
|
58
|
+
const __vue_is_functional_template__ = false;
|
|
59
|
+
/* style inject */
|
|
60
|
+
|
|
61
|
+
/* style inject SSR */
|
|
62
|
+
|
|
63
|
+
/* style inject shadow dom */
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const __vue_component__ = /*#__PURE__*/__vue_normalize__(
|
|
68
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
69
|
+
__vue_inject_styles__,
|
|
70
|
+
__vue_script__,
|
|
71
|
+
__vue_scope_id__,
|
|
72
|
+
__vue_is_functional_template__,
|
|
73
|
+
__vue_module_identifier__,
|
|
74
|
+
false,
|
|
75
|
+
undefined,
|
|
76
|
+
undefined,
|
|
77
|
+
undefined
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export { __vue_component__ as default };
|
package/dist/components/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { default as GlTokenSelector } from './base/token_selector/token_selector
|
|
|
7
7
|
export { default as GlMarkdown } from './base/markdown/markdown';
|
|
8
8
|
export { default as GlDeprecatedLink, default as GlLink } from './base/link/link';
|
|
9
9
|
export { default as GlIcon } from './base/icon/icon';
|
|
10
|
+
export { default as GlIllustration } from './base/illustration/illustration';
|
|
10
11
|
export { default as GlAnimatedChevronRightDownIcon } from './base/animated_icon/animated_chevron_right_down_icon';
|
|
11
12
|
export { default as GlAnimatedChevronLgRightDownIcon } from './base/animated_icon/animated_chevron_lg_right_down_icon';
|
|
12
13
|
export { default as GlAnimatedChevronDownUpIcon } from './base/animated_icon/animated_chevron_down_up_icon';
|
package/package.json
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
|
+
<script>
|
|
3
|
+
import illustrationsPath from '@gitlab/svgs/dist/illustrations.svg';
|
|
4
|
+
import illustrationsInfo from '@gitlab/svgs/dist/illustrations.json';
|
|
5
|
+
|
|
6
|
+
const knownIllustrations = illustrationsInfo.icons;
|
|
7
|
+
|
|
8
|
+
/** This is a re-usable vue component for rendering a svg sprite icon
|
|
9
|
+
* @example
|
|
10
|
+
* <illustration
|
|
11
|
+
* name="status-success-sm"
|
|
12
|
+
* />
|
|
13
|
+
*/
|
|
14
|
+
export default {
|
|
15
|
+
name: 'GlIllustration',
|
|
16
|
+
props: {
|
|
17
|
+
/**
|
|
18
|
+
* One of the illustrations from https://gitlab-org.gitlab.io/gitlab-svgs/ project
|
|
19
|
+
*/
|
|
20
|
+
name: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
validator: (value) => {
|
|
24
|
+
if (knownIllustrations.some((obj) => obj.name === value)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.warn(`Illustration '${value}' is not a known illustration of @gitlab/svgs`);
|
|
29
|
+
return false;
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
computed: {
|
|
34
|
+
spriteHref() {
|
|
35
|
+
return `${illustrationsPath}#${this.name}`;
|
|
36
|
+
},
|
|
37
|
+
illustrationSize() {
|
|
38
|
+
return knownIllustrations.find((obj) => obj.name === this.name).svg_size;
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<svg
|
|
46
|
+
:key="spriteHref"
|
|
47
|
+
:data-testid="`${name}-illustration`"
|
|
48
|
+
aria-label=""
|
|
49
|
+
role="presentation"
|
|
50
|
+
:width="illustrationSize"
|
|
51
|
+
:height="illustrationSize"
|
|
52
|
+
v-on="$listeners"
|
|
53
|
+
>
|
|
54
|
+
<use :href="spriteHref" />
|
|
55
|
+
</svg>
|
|
56
|
+
</template>
|
|
@@ -414,12 +414,11 @@ export default {
|
|
|
414
414
|
@cancel-focus="cancelTokenFocus"
|
|
415
415
|
@clear-all="clearAll"
|
|
416
416
|
>
|
|
417
|
-
<template #token-content="{ token }"
|
|
418
|
-
|
|
419
|
-
to add an avatar to the token. Default content is "{{ token.name }}".
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
<slot name="token-content" :token="token"></slot>
|
|
417
|
+
<template #token-content="{ token }"
|
|
418
|
+
><!--
|
|
419
|
+
@slot Content to pass to the token component slot. Can be used to add an avatar to the token. Default content is "{{ token.name }}".
|
|
420
|
+
@binding {object} token
|
|
421
|
+
--><slot name="token-content" :token="token"></slot>
|
|
423
422
|
</template>
|
|
424
423
|
<template #text-input>
|
|
425
424
|
<!-- Can't use `v-model` due to this bug: -->
|
|
@@ -465,34 +464,32 @@ export default {
|
|
|
465
464
|
@dropdown-item-click="addToken"
|
|
466
465
|
@show="openDropdown"
|
|
467
466
|
>
|
|
468
|
-
<template #loading-content
|
|
469
|
-
|
|
470
|
-
content is "Searching..."
|
|
471
|
-
|
|
467
|
+
<template #loading-content
|
|
468
|
+
><!--
|
|
469
|
+
@slot Content to display when `loading` prop is `true`. Default content is "Searching..."
|
|
470
|
+
--><slot name="loading-content"></slot>
|
|
472
471
|
</template>
|
|
473
|
-
<template #user-defined-token-content
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
472
|
+
<template #user-defined-token-content
|
|
473
|
+
><!--
|
|
474
|
+
@slot Content to display when adding a user defined token. Default content is 'Add "{{ inputText }}"'.
|
|
475
|
+
@binding {string} inputText
|
|
476
|
+
--><slot name="user-defined-token-content" :input-text="inputText"></slot>
|
|
478
477
|
</template>
|
|
479
|
-
<template #no-results-content
|
|
480
|
-
|
|
481
|
-
both `allow-user-defined-tokens` and `show-add-new-always` is `false`. Default content is "No matches found".
|
|
482
|
-
|
|
478
|
+
<template #no-results-content
|
|
479
|
+
><!--
|
|
480
|
+
@slot Content to display when `dropdown-items` is empty and both `allow-user-defined-tokens` and `show-add-new-always` is `false`. Default content is "No matches found".
|
|
481
|
+
--><slot name="no-results-content"></slot>
|
|
483
482
|
</template>
|
|
484
|
-
<template #dropdown-item-content="{ dropdownItem }"
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
483
|
+
<template #dropdown-item-content="{ dropdownItem }"
|
|
484
|
+
><!--
|
|
485
|
+
@slot Dropdown item content. Default content is "{{ dropdownItem.name }}".
|
|
486
|
+
@binding {object} dropdownItem
|
|
487
|
+
--><slot name="dropdown-item-content" :dropdown-item="dropdownItem"></slot>
|
|
489
488
|
</template>
|
|
490
|
-
<template #dropdown-footer
|
|
491
|
-
|
|
492
|
-
Can be used in conjunction with `gl-intersection-observer` to load
|
|
493
|
-
|
|
494
|
-
-->
|
|
495
|
-
<slot name="dropdown-footer"></slot>
|
|
489
|
+
<template #dropdown-footer
|
|
490
|
+
><!--
|
|
491
|
+
@slot Content to add to the bottom of the dropdown. Can be used in conjunction with `gl-intersection-observer` to load more items as the user scrolls.
|
|
492
|
+
--><slot name="dropdown-footer"></slot>
|
|
496
493
|
</template>
|
|
497
494
|
</gl-token-selector-dropdown>
|
|
498
495
|
</div>
|
package/src/components/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { default as GlTokenSelector } from './base/token_selector/token_selector
|
|
|
8
8
|
export { default as GlMarkdown } from './base/markdown/markdown.vue';
|
|
9
9
|
export { default as GlLink, default as GlDeprecatedLink } from './base/link/link.vue';
|
|
10
10
|
export { default as GlIcon } from './base/icon/icon.vue';
|
|
11
|
+
export { default as GlIllustration } from './base/illustration/illustration.vue';
|
|
11
12
|
export { default as GlAnimatedChevronRightDownIcon } from './base/animated_icon/animated_chevron_right_down_icon.vue';
|
|
12
13
|
export { default as GlAnimatedChevronLgRightDownIcon } from './base/animated_icon/animated_chevron_lg_right_down_icon.vue';
|
|
13
14
|
export { default as GlAnimatedChevronDownUpIcon } from './base/animated_icon/animated_chevron_down_up_icon.vue';
|