@gitlab/ui 33.0.1 → 34.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/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ # [34.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v33.1.2...v34.0.0) (2022-01-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlAvatarsInline:** Add badgeSrOnlyText prop ([bcb0d29](https://gitlab.com/gitlab-org/gitlab-ui/commit/bcb0d299e9468e13cc7d565784388e3b9585e4a0))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * **GlAvatarsInline:** This change adds a required
12
+ property named badgeSrOnlyText that ensures
13
+ that badge displayed when avatars inline is
14
+ collapsed, provides a screen reader only
15
+ label that gives contextual information
16
+ for users that use this form factor
17
+
18
+ ## [33.1.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v33.1.1...v33.1.2) (2022-01-27)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * Add a workaround for GlAccordion compatibility with Vue Apollo ([55deabf](https://gitlab.com/gitlab-org/gitlab-ui/commit/55deabf3260643079e20db1ad2787980afdd8e56))
24
+
25
+ ## [33.1.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v33.1.0...v33.1.1) (2022-01-27)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **deps:** update dependency dompurify to ^2.3.5 ([0bced05](https://gitlab.com/gitlab-org/gitlab-ui/commit/0bced051c61365c77cd4e4369b8838677217a46b))
31
+
32
+ # [33.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v33.0.1...v33.1.0) (2022-01-26)
33
+
34
+
35
+ ### Features
36
+
37
+ * **GlPopover:** add support for a close button ([583be0b](https://gitlab.com/gitlab-org/gitlab-ui/commit/583be0bd76f5c72384c19fe0eeeb4bc334eb58be))
38
+
1
39
  ## [33.0.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v33.0.0...v33.0.1) (2022-01-26)
2
40
 
3
41
 
@@ -5,9 +5,13 @@ var script = {
5
5
  name: 'GlAccordion',
6
6
 
7
7
  provide() {
8
+ const accordionId = _uniqueId('accordion-set-'); // temporary fix for this issue: https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2019#note_514671251
9
+ // MR for the upstream pending: https://github.com/vuejs/apollo/pull/1153
10
+
11
+
8
12
  return {
9
- defaultHeaderLevel: this.headerLevel,
10
- accordionSetId: this.autoCollapse && _uniqueId('accordion-set-')
13
+ defaultHeaderLevel: () => this.headerLevel,
14
+ accordionSetId: () => this.autoCollapse && accordionId
11
15
  };
12
16
  },
13
17
 
@@ -57,12 +57,12 @@ var script = {
57
57
 
58
58
  computed: {
59
59
  headerComponent() {
60
- const level = this.headerLevel || this.defaultHeaderLevel;
60
+ const level = this.headerLevel || this.defaultHeaderLevel();
61
61
  return `h${level}`;
62
62
  },
63
63
 
64
64
  accordion() {
65
- return this.accordionSetId || undefined;
65
+ return this.accordionSetId() || undefined;
66
66
  },
67
67
 
68
68
  icon() {
@@ -1,4 +1,4 @@
1
- var avatars_inline = "Use `<avatars-inline />` to display multiple avatars organized in a single row.\n\n### Basic usage\n\nThe `avatars` property accepts an array of objects that contains the avatar properties. By default,\n`<avatars-inline />` expects each object contained in the array to have the same shape as the\nproperties of the `<avatar />` component. You can customize the display of each avatar by\noverriding the default slot:\n\n```html\n<gl-avatars-inline :avatars=\"avatars\">\n <template #avatar=\"{ avatar }\">\n <gl-avatar-link v-gl-tooltip target=\"blank\" :href=\"avatar.href\" :title=\"avatar.tooltip\">\n <gl-avatar :src=\"avatar.src\" :size=\"32\" />\n </gl-avatar-link>\n </template>\n</gl-avatars-inline>\n```\n\nIn the example above, the avatars displayed inside `<avatars-inline />` are links pointing to a URL\nstored in each avatar object. Each avatar also displays a tooltip. If you override\n`<inline-avatars />` default display, you can pass an array of objects with any desired shape to\nthe `avatars` property.\n\n### Collapsing\n\nWhen the `collapse` property value is `true` and the `maxVisible` property value is a number less\nthan the length of the `avatars` property array, `<avatars-inline>` will hide the overflown avatars\nand display a badge instead.\n\n### Supported sizes\n\n`<avatars-inline>` only supports avatars with `24` or `32` size.\n";
1
+ var avatars_inline = "Use `<avatars-inline />` to display multiple avatars organized in a single row.\n\n### Basic usage\n\nThe `avatars` property accepts an array of objects that contains the avatar properties. By default,\n`<avatars-inline />` expects each object contained in the array to have the same shape as the\nproperties of the `<avatar />` component. You can customize the display of each avatar by\noverriding the default slot:\n\n```html\n<gl-avatars-inline :avatars=\"avatars\">\n <template #avatar=\"{ avatar }\">\n <gl-avatar-link v-gl-tooltip target=\"blank\" :href=\"avatar.href\" :title=\"avatar.tooltip\">\n <gl-avatar :src=\"avatar.src\" :size=\"32\" />\n </gl-avatar-link>\n </template>\n</gl-avatars-inline>\n```\n\nIn the example above, the avatars displayed inside `<avatars-inline />` are links pointing to a URL\nstored in each avatar object. Each avatar also displays a tooltip. If you override\n`<inline-avatars />` default display, you can pass an array of objects with any desired shape to\nthe `avatars` property.\n\n### Collapsing\n\nWhen the `collapse` property value is `true` and the `maxVisible` property value is a number less\nthan the length of the `avatars` property array, `<avatars-inline>` will hide the overflown avatars\nand display a badge instead.\n\n### Badge description in screen readers\n\nThe `badgeSrOnlyText` property provides a meaningful description of the badge that appears\nwhen avatars are collapsed for screen reader users.\n\n### Supported sizes\n\n`<avatars-inline>` only supports avatars with `24` or `32` size.\n";
2
2
 
3
3
  var description = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
@@ -30,6 +30,10 @@ var script = {
30
30
  required: false,
31
31
  default: false
32
32
  },
33
+ badgeSrOnlyText: {
34
+ type: String,
35
+ required: true
36
+ },
33
37
  badgeTooltipProp: {
34
38
  type: String,
35
39
  required: false,
@@ -100,7 +104,7 @@ var script = {
100
104
  const __vue_script__ = script;
101
105
 
102
106
  /* template */
103
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['gl-avatars-inline', { collapsed: _vm.collapsed }],style:(_vm.containerSizeStyles)},[_vm._l((_vm.visibleAvatars),function(avatar,index){return _c('div',{key:index,staticClass:"gl-avatars-inline-child",style:(_vm.calcAvatarPosition(index))},[_vm._t("avatar",[_c('gl-avatar',_vm._b({attrs:{"size":_vm.avatarSize}},'gl-avatar',avatar,false))],{"avatar":avatar})],2)}),_vm._v(" "),(_vm.collapsed && _vm.collapsable)?_c('div',{staticClass:"gl-avatars-inline-child",style:(_vm.calcAvatarPosition(_vm.visibleAvatars.length))},[(_vm.badgeTooltipProp)?_c('gl-tooltip',{attrs:{"target":function () { return _vm.$refs.badge; }}},[_vm._v("\n "+_vm._s(_vm.badgeTooltipTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('span',{ref:"badge",class:['gl-avatars-inline-badge', _vm.badgeSize]},[_vm._v("\n "+_vm._s(_vm.badgeLabel)+"\n ")])],1):_vm._e()],2)};
107
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['gl-avatars-inline', { collapsed: _vm.collapsed }],style:(_vm.containerSizeStyles)},[_vm._l((_vm.visibleAvatars),function(avatar,index){return _c('div',{key:index,staticClass:"gl-avatars-inline-child",style:(_vm.calcAvatarPosition(index))},[_vm._t("avatar",[_c('gl-avatar',_vm._b({attrs:{"size":_vm.avatarSize}},'gl-avatar',avatar,false))],{"avatar":avatar})],2)}),_vm._v(" "),(_vm.collapsed && _vm.collapsable)?_c('div',{staticClass:"gl-avatars-inline-child",style:(_vm.calcAvatarPosition(_vm.visibleAvatars.length))},[(_vm.badgeTooltipProp)?_c('gl-tooltip',{attrs:{"target":function () { return _vm.$refs.badge; }}},[_vm._v("\n "+_vm._s(_vm.badgeTooltipTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('span',{ref:"badge",class:['gl-avatars-inline-badge', _vm.badgeSize],attrs:{"data-testid":"collapsed-avatars-badge","aria-hidden":"true"}},[_vm._v("\n "+_vm._s(_vm.badgeLabel)+"\n ")]),_vm._v(" "),_c('span',{staticClass:"sr-only",attrs:{"data-testid":"badge-sr-only-text"}},[_vm._v(_vm._s(_vm.badgeSrOnlyText))])],1):_vm._e()],2)};
104
108
  var __vue_staticRenderFns__ = [];
105
109
 
106
110
  /* style */
@@ -1,11 +1,13 @@
1
1
  import { BPopover } from 'bootstrap-vue/esm/index.js';
2
2
  import tooltipMixin from '../../mixins/tooltip_mixin';
3
+ import CloseButton from '../../shared_components/close_button/close_button';
3
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
5
 
5
6
  const popoverRefName = 'bPopover';
6
7
  var script = {
7
8
  components: {
8
- BPopover
9
+ BPopover,
10
+ CloseButton
9
11
  },
10
12
  mixins: [tooltipMixin(popoverRefName)],
11
13
  inheritAttrs: false,
@@ -19,11 +21,32 @@ var script = {
19
21
  type: String,
20
22
  required: false,
21
23
  default: 'hover focus'
24
+ },
25
+ title: {
26
+ type: String,
27
+ required: false,
28
+ default: ''
29
+ },
30
+ showCloseButton: {
31
+ type: Boolean,
32
+ required: false,
33
+ default: false
22
34
  }
23
35
  },
24
36
  computed: {
25
37
  customClass() {
26
38
  return ['gl-popover', ...this.cssClasses].join(' ');
39
+ },
40
+
41
+ shouldShowTitle() {
42
+ return this.$scopedSlots.title || this.title || this.showCloseButton;
43
+ }
44
+
45
+ },
46
+ methods: {
47
+ close(e) {
48
+ this.$refs[popoverRefName].doClose();
49
+ this.$emit('close-button-clicked', e);
27
50
  }
28
51
 
29
52
  },
@@ -34,7 +57,7 @@ var script = {
34
57
  const __vue_script__ = script;
35
58
 
36
59
  /* template */
37
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-popover',_vm._g(_vm._b({ref:_vm.$options.popoverRefName,attrs:{"custom-class":_vm.customClass,"triggers":_vm.triggers},scopedSlots:_vm._u([(_vm.$scopedSlots.title)?{key:"title",fn:function(){return [_vm._t("title")]},proxy:true}:null],null,true)},'b-popover',_vm.$attrs,false),_vm.$listeners),[_vm._v(" "),_vm._t("default")],2)};
60
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-popover',_vm._g(_vm._b({ref:_vm.$options.popoverRefName,attrs:{"custom-class":_vm.customClass,"triggers":_vm.triggers,"title":_vm.title},scopedSlots:_vm._u([(_vm.shouldShowTitle)?{key:"title",fn:function(){return [_vm._t("title",[_vm._v("\n "+_vm._s(_vm.title)+"\n ")]),_vm._v(" "),(_vm.showCloseButton)?_c('close-button',{staticClass:"gl-float-right gl-mt-n2 gl-mr-n3",attrs:{"data-testid":"close-button"},on:{"click":_vm.close}}):_vm._e()]},proxy:true}:null],null,true)},'b-popover',_vm.$attrs,false),_vm.$listeners),[_vm._v(" "),_vm._t("default")],2)};
38
61
  var __vue_staticRenderFns__ = [];
39
62
 
40
63
  /* style */