@gitlab/ui 62.3.0 → 62.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "62.3.0",
3
+ "version": "62.5.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -90,7 +90,7 @@
90
90
  "@gitlab/eslint-plugin": "18.3.2",
91
91
  "@gitlab/fonts": "^1.2.0",
92
92
  "@gitlab/stylelint-config": "4.1.0",
93
- "@gitlab/svgs": "3.38.0",
93
+ "@gitlab/svgs": "3.40.0",
94
94
  "@rollup/plugin-commonjs": "^11.1.0",
95
95
  "@rollup/plugin-node-resolve": "^7.1.3",
96
96
  "@rollup/plugin-replace": "^2.3.2",
@@ -117,7 +117,7 @@
117
117
  "babel-plugin-require-context-hook": "^1.0.0",
118
118
  "babel-preset-vue": "^2.0.2",
119
119
  "bootstrap": "4.6.2",
120
- "cypress": "^11.2.0",
120
+ "cypress": "12.10.0",
121
121
  "emoji-regex": "^10.0.0",
122
122
  "eslint": "8.38.0",
123
123
  "eslint-import-resolver-jest": "3.0.2",
@@ -130,6 +130,7 @@ export default {
130
130
  :alt="alt"
131
131
  :class="['gl-avatar', { 'gl-avatar-circle': isCircle }, sizeClasses]"
132
132
  @error="handleLoadError"
133
+ v-on="$listeners"
133
134
  />
134
135
  <div
135
136
  v-else
@@ -139,6 +140,7 @@ export default {
139
140
  sizeClasses,
140
141
  identiconBackgroundClass,
141
142
  ]"
143
+ v-on="$listeners"
142
144
  >
143
145
  {{ identiconText }}
144
146
  </div>
@@ -14,6 +14,7 @@
14
14
  &-label {
15
15
  @include gl-font-weight-bold;
16
16
  @include gl-p-1;
17
+ @include gl-text-gray-900;
17
18
  }
18
19
 
19
20
  &-sublabel {
@@ -63,13 +63,26 @@ describe('avatar labeled', () => {
63
63
  buildWrapper({ label, subLabel, labelLink: 'http://label', subLabelLink: 'http://subLabel' });
64
64
  });
65
65
 
66
- it('displays the avatar label link', () => {
67
- const labelLink = wrapper.findAllComponents(GlLink).at(0);
68
- expect(labelLink.text()).toBe(label);
69
- expect(labelLink.attributes('href')).toBe('http://label');
66
+ describe('with label link', () => {
67
+ const findLabelLink = () => wrapper.findAllComponents(GlLink).at(0);
68
+
69
+ it('displays the label link', () => {
70
+ const labelLink = findLabelLink();
71
+ expect(labelLink.text()).toBe(label);
72
+ expect(labelLink.attributes('href')).toBe('http://label');
73
+ });
74
+
75
+ it('navigates to label link when avatar is clicked', () => {
76
+ const labelLink = findLabelLink();
77
+ const labelLinkClickSpy = jest.spyOn(labelLink.element, 'click');
78
+
79
+ wrapper.findComponent(Avatar).vm.$emit('click');
80
+
81
+ expect(labelLinkClickSpy).toHaveBeenCalled();
82
+ });
70
83
  });
71
84
 
72
- it('displays the avatar sub-label link', () => {
85
+ it('displays the sub-label link', () => {
73
86
  const subLabelLink = wrapper.findAllComponents(GlLink).at(1);
74
87
  expect(subLabelLink.text()).toBe(subLabel);
75
88
  expect(subLabelLink.attributes('href')).toBe('http://subLabel');
@@ -1,6 +1,7 @@
1
1
  import Vue from 'vue';
2
2
  import GlBadge from '../badge/badge.vue';
3
3
  import GlButton from '../button/button.vue';
4
+ import GlIcon from '../icon/icon.vue';
4
5
  import { GlTooltipDirective } from '../../../directives/tooltip';
5
6
  import { avatarSizeOptions, avatarShapeOptions, tooltipPlacements } from '../../../utils/constants';
6
7
  import avatarPath from '../../../../static/img/avatar.png';
@@ -17,12 +18,14 @@ const generateProps = ({
17
18
  size = 32,
18
19
  shape = 'circle',
19
20
  src = avatarPath,
21
+ labelLink,
20
22
  } = {}) => ({
21
23
  label,
22
24
  subLabel,
23
25
  size,
24
26
  shape,
25
27
  src,
28
+ labelLink,
26
29
  });
27
30
 
28
31
  const generateTooltipProps = ({ tooltipText = 'Avatar tooltip', placement = 'top' } = {}) => ({
@@ -111,6 +114,38 @@ export const WithDefaultSlot = (args, { argTypes }) => ({
111
114
  });
112
115
  WithDefaultSlot.args = generateProps({ size: 64 });
113
116
 
117
+ export const WithLinks = (args, { argTypes }) => ({
118
+ components: { GlAvatarLabeled, GlBadge, GlIcon },
119
+ props: Object.keys(argTypes),
120
+ template: `
121
+ <gl-avatar-labeled
122
+ :shape="shape"
123
+ :size="size"
124
+ :label-link="labelLink"
125
+ :src="src"
126
+ :label="label"
127
+ >
128
+ <template #meta>
129
+ <gl-icon
130
+ v-gl-tooltip="'Public - The project can be accessed without any authentication.'"
131
+ name="earth"
132
+ class="gl-text-secondary gl-ml-2"
133
+ />
134
+ </template>
135
+ <div class="gl-max-w-75">
136
+ <p class="gl-mb-0 gl-mt-2 gl-font-sm">GitLab is an open source end-to-end software development platform with built-in version control, issue tracking, code review, CI/CD, and more. Self-host GitLab on your own servers, in a container, or on a cloud provider.</p>
137
+ </div>
138
+ </gl-avatar-labeled>
139
+ `,
140
+ });
141
+ WithLinks.args = generateProps({
142
+ size: 48,
143
+ shape: 'rect',
144
+ label: 'GitLab.org / GitLab',
145
+ subLabel: '',
146
+ labelLink: 'https://gitlab.com/gitlab-org/gitlab',
147
+ });
148
+
114
149
  export default {
115
150
  title: 'base/avatar/labeled',
116
151
  component: GlAvatarLabeled,
@@ -36,17 +36,37 @@ export default {
36
36
  hasSubLabelLink() {
37
37
  return Boolean(this.subLabelLink);
38
38
  },
39
+ avatarListeners() {
40
+ if (this.hasLabelLink) {
41
+ return {
42
+ ...this.$listeners,
43
+ click: this.onAvatarClick,
44
+ };
45
+ }
46
+
47
+ return this.$listeners;
48
+ },
49
+ avatarCssClasses() {
50
+ return {
51
+ 'gl-cursor-pointer': this.hasLabelLink,
52
+ };
53
+ },
54
+ },
55
+ methods: {
56
+ onAvatarClick() {
57
+ this.$refs.labelLink.$el.click();
58
+ },
39
59
  },
40
60
  };
41
61
  </script>
42
62
  <template>
43
63
  <div class="gl-avatar-labeled">
44
- <gl-avatar v-bind="$attrs" alt v-on="$listeners" />
64
+ <gl-avatar v-bind="$attrs" :class="avatarCssClasses" alt v-on="avatarListeners" />
45
65
  <div class="gl-avatar-labeled-labels gl-text-left!">
46
66
  <div
47
67
  class="gl-display-flex gl-flex-wrap gl-align-items-center gl-text-left! gl-mx-n1 gl-my-n1"
48
68
  >
49
- <gl-link v-if="hasLabelLink" :href="labelLink" class="gl-avatar-link">
69
+ <gl-link v-if="hasLabelLink" ref="labelLink" :href="labelLink" class="gl-avatar-link">
50
70
  <span class="gl-avatar-labeled-label">{{ label }}</span>
51
71
  </gl-link>
52
72
  <span v-else class="gl-avatar-labeled-label">{{ label }}</span>
@@ -5228,6 +5228,14 @@
5228
5228
  min-height: $gl-spacing-scale-8 !important;
5229
5229
  }
5230
5230
 
5231
+ .gl-min-h-100vh {
5232
+ min-height: 100vh;
5233
+ }
5234
+
5235
+ .gl-min-h-100vh\! {
5236
+ min-height: 100vh !important;
5237
+ }
5238
+
5231
5239
  .gl-max-w-0 {
5232
5240
  max-width: 0;
5233
5241
  }
@@ -392,6 +392,10 @@
392
392
  min-height: $gl-spacing-scale-8;
393
393
  }
394
394
 
395
+ @mixin gl-min-h-100vh {
396
+ min-height: 100vh;
397
+ }
398
+
395
399
  @mixin gl-max-w-0 {
396
400
  max-width: 0;
397
401
  }