@gitlab/ui 39.1.0 → 39.2.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": "39.1.0",
3
+ "version": "39.2.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -8,6 +8,10 @@
8
8
  @include gl-pr-5;
9
9
  }
10
10
 
11
+ &-no-icon {
12
+ @include gl-pl-5;
13
+ }
14
+
11
15
  .gl-link:not(.gl-label-link) {
12
16
  @include gl-text-blue-600;
13
17
  @include gl-text-decoration-underline;
@@ -20,6 +20,7 @@ describe('Alert component', () => {
20
20
  });
21
21
  };
22
22
 
23
+ const findIcon = () => wrapper.find('.gl-alert-icon');
23
24
  const findDismissButton = () => wrapper.findComponent({ ref: 'dismiss' });
24
25
  const findTitle = () => wrapper.find('.gl-alert-title');
25
26
  const findBodyContainer = () => wrapper.find('.gl-alert-body');
@@ -31,6 +32,10 @@ describe('Alert component', () => {
31
32
  createComponent({ slots: { default: DummyComponent } });
32
33
  });
33
34
 
35
+ it('renders a variant icon', () => {
36
+ expect(findIcon().exists()).toBe(true);
37
+ });
38
+
34
39
  it('renders a dismiss button', () => {
35
40
  expect(findDismissButton().exists()).toBe(true);
36
41
  });
@@ -54,6 +59,12 @@ describe('Alert component', () => {
54
59
  });
55
60
  });
56
61
 
62
+ it('does not render a variant icon when showIcon = false', () => {
63
+ createComponent({ propsData: { showIcon: false } });
64
+
65
+ expect(findIcon().exists()).toBe(false);
66
+ });
67
+
57
68
  it('does not render a dismiss button when dismissible = false', () => {
58
69
  createComponent({ propsData: { dismissible: false } });
59
70
 
@@ -6,6 +6,7 @@ const template = `
6
6
  <gl-alert
7
7
  :title="title"
8
8
  :dismissible="dismissible"
9
+ :show-icon="showIcon"
9
10
  :dismiss-label="dismissLabel"
10
11
  :variant="variant"
11
12
  :primary-button-text="primaryButtonText"
@@ -21,6 +22,7 @@ const generateProps = ({
21
22
  title = defaultValue('title'),
22
23
  variant = defaultValue('variant'),
23
24
  dismissible = defaultValue('dismissible'),
25
+ showIcon = defaultValue('showIcon'),
24
26
  dismissLabel = defaultValue('dismissLabel'),
25
27
  primaryButtonText = defaultValue('primaryButtonText'),
26
28
  primaryButtonLink = defaultValue('primaryButtonLink'),
@@ -32,6 +34,7 @@ const generateProps = ({
32
34
  message: 'Lorem ipsum dolor sit amet',
33
35
  variant,
34
36
  dismissible,
37
+ showIcon,
35
38
  dismissLabel,
36
39
  primaryButtonText,
37
40
  primaryButtonLink,
@@ -92,6 +95,17 @@ TextLinks.parameters = {
92
95
  storyshots: { disable: true },
93
96
  };
94
97
 
98
+ export const NoIcon = () => ({
99
+ components: { GlAlert },
100
+ template: `
101
+ <gl-alert :show-icon="false">
102
+ Lorem ipsum dolor sit amet
103
+ </gl-alert>`,
104
+ });
105
+ NoIcon.parameters = {
106
+ storyshots: { disable: true },
107
+ };
108
+
95
109
  export const Variants = () => ({
96
110
  components: { GlAlert },
97
111
  variants: alertVariantOptions,
@@ -28,6 +28,14 @@ export default {
28
28
  required: false,
29
29
  default: true,
30
30
  },
31
+ /**
32
+ * Shows icon based on variant.
33
+ */
34
+ showIcon: {
35
+ type: Boolean,
36
+ required: false,
37
+ default: true,
38
+ },
31
39
  /**
32
40
  * Dismiss button's aria-label.
33
41
  */
@@ -165,10 +173,12 @@ export default {
165
173
  'gl-alert',
166
174
  { 'gl-alert-sticky': sticky },
167
175
  { 'gl-alert-not-dismissible': !dismissible },
176
+ { 'gl-alert-no-icon': !showIcon },
168
177
  variantClass,
169
178
  ]"
170
179
  >
171
180
  <gl-icon
181
+ v-if="showIcon"
172
182
  :name="iconName"
173
183
  :class="{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !title }"
174
184
  />