@gitlab/ui 33.1.1 → 35.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/components/base/accordion/accordion.js +6 -2
  3. package/dist/components/base/accordion/accordion_item.js +2 -2
  4. package/dist/components/base/avatars_inline/avatars_inline.documentation.js +1 -1
  5. package/dist/components/base/avatars_inline/avatars_inline.js +5 -1
  6. package/dist/components/base/nav/nav.documentation.js +2 -7
  7. package/dist/components/base/tabs/tabs/tabs.documentation.js +1 -1
  8. package/dist/components/base/tabs/tabs/tabs.js +2 -12
  9. package/dist/components/utilities/truncate/truncate.documentation.js +2 -17
  10. package/dist/components/utilities/truncate/truncate.js +11 -0
  11. package/dist/index.css +1 -1
  12. package/dist/index.css.map +1 -1
  13. package/dist/utility_classes.css +1 -1
  14. package/dist/utility_classes.css.map +1 -1
  15. package/documentation/components_documentation.js +0 -2
  16. package/documentation/documented_stories.js +4 -0
  17. package/package.json +13 -13
  18. package/src/components/base/accordion/accordion.vue +5 -2
  19. package/src/components/base/accordion/accordion_item.spec.js +2 -2
  20. package/src/components/base/accordion/accordion_item.stories.js +2 -2
  21. package/src/components/base/accordion/accordion_item.vue +2 -2
  22. package/src/components/base/avatar/avatar.stories.js +8 -0
  23. package/src/components/base/avatar_labeled/avatar_labeled.stories.js +7 -0
  24. package/src/components/base/avatar_link/avatar_link.stories.js +7 -0
  25. package/src/components/base/avatars_inline/avatars_inline.md +5 -0
  26. package/src/components/base/avatars_inline/avatars_inline.spec.js +21 -1
  27. package/src/components/base/avatars_inline/avatars_inline.stories.js +23 -9
  28. package/src/components/base/avatars_inline/avatars_inline.vue +11 -1
  29. package/src/components/base/badge/badge.stories.js +114 -9
  30. package/src/components/base/broadcast_message/broadcast_message.stories.js +2 -2
  31. package/src/components/base/button/button.stories.js +11 -11
  32. package/src/components/base/dropdown/dropdown.stories.js +4 -2
  33. package/src/components/base/filtered_search/filtered_search.stories.js +11 -1
  34. package/src/components/base/filtered_search/filtered_search_suggestion.stories.js +2 -0
  35. package/src/components/base/filtered_search/filtered_search_suggestion_list.stories.js +2 -0
  36. package/src/components/base/filtered_search/filtered_search_token.stories.js +2 -0
  37. package/src/components/base/filtered_search/filtered_search_token_segment.stories.js +2 -0
  38. package/src/components/base/form/form_group/form_group.stories.js +6 -5
  39. package/src/components/base/form/form_radio_group/form_radio_group.stories.js +2 -1
  40. package/src/components/base/loading_icon/loading_icon.stories.js +1 -0
  41. package/src/components/base/modal/modal.scss +5 -2
  42. package/src/components/base/nav/nav.documentation.js +0 -4
  43. package/src/components/base/nav/nav.md +8 -5
  44. package/src/components/base/nav/nav.stories.js +52 -15
  45. package/src/components/base/pagination/pagination.stories.js +7 -0
  46. package/src/components/base/path/path.stories.js +2 -2
  47. package/src/components/base/popover/popover.stories.js +6 -0
  48. package/src/components/base/table/table.stories.js +6 -1
  49. package/src/components/base/tabs/tabs/scrollable_tabs.spec.js +0 -1
  50. package/src/components/base/tabs/tabs/tabs.md +2 -2
  51. package/src/components/base/tabs/tabs/tabs.scss +3 -115
  52. package/src/components/base/tabs/tabs/tabs.spec.js +7 -4
  53. package/src/components/base/tabs/tabs/tabs.stories.js +8 -12
  54. package/src/components/base/tabs/tabs/tabs.vue +2 -11
  55. package/src/components/base/toast/toast.stories.js +6 -4
  56. package/src/components/base/token/token.stories.js +2 -2
  57. package/src/components/base/tooltip/tooltip.stories.js +2 -1
  58. package/src/components/utilities/truncate/truncate.documentation.js +0 -14
  59. package/src/components/utilities/truncate/truncate.md +0 -4
  60. package/src/components/utilities/truncate/truncate.stories.js +37 -26
  61. package/src/components/utilities/truncate/truncate.vue +9 -0
  62. package/src/scss/utilities.scss +8 -0
  63. package/src/scss/utility-mixins/box-shadow.scss +4 -0
  64. package/dist/components/base/nav/examples/index.js +0 -13
  65. package/dist/components/base/nav/examples/nav.basic.example.js +0 -38
  66. package/dist/components/base/nav/nav_item.documentation.js +0 -13
  67. package/dist/components/base/nav/nav_item_dropdown.documentation.js +0 -14
  68. package/dist/components/utilities/truncate/examples/index.js +0 -13
  69. package/dist/components/utilities/truncate/examples/truncate.basic.example.js +0 -38
  70. package/src/components/base/nav/examples/index.js +0 -15
  71. package/src/components/base/nav/examples/nav.basic.example.vue +0 -8
  72. package/src/components/base/nav/nav_item.documentation.js +0 -6
  73. package/src/components/base/nav/nav_item.md +0 -7
  74. package/src/components/base/nav/nav_item.stories.js +0 -23
  75. package/src/components/base/nav/nav_item_dropdown.documentation.js +0 -7
  76. package/src/components/base/nav/nav_item_dropdown.md +0 -7
  77. package/src/components/base/nav/nav_item_dropdown.stories.js +0 -51
  78. package/src/components/utilities/truncate/examples/index.js +0 -15
  79. package/src/components/utilities/truncate/examples/truncate.basic.example.vue +0 -5
@@ -9,9 +9,7 @@ export { default as GlFormTextDocumentation } from '../src/components/base/form/
9
9
  export { default as GlFormComboboxDocumentation } from '../src/components/base/form/form_combobox/form_combobox.documentation';
10
10
  export { default as GlGaugeChartDocumentation } from '../src/components/charts/gauge/gauge.documentation';
11
11
  export { default as GlTokenSelectorDocumentation } from '../src/components/base/token_selector/token_selector.documentation';
12
- export { default as GlNavItemDropdownDocumentation } from '../src/components/base/nav/nav_item_dropdown.documentation';
13
12
  export { default as GlNavDocumentation } from '../src/components/base/nav/nav.documentation';
14
- export { default as GlNavItemDocumentation } from '../src/components/base/nav/nav_item.documentation';
15
13
  export { default as GlFormCheckboxTreeDocumentation } from '../src/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation';
16
14
  export { default as GlMarkdownDocumentation } from '../src/components/base/markdown/markdown.documentation';
17
15
  export { default as GlNavbarDocumentation } from '../src/components/base/navbar/navbar.documentation';
@@ -122,6 +122,10 @@ export const setupStorybookReadme = () =>
122
122
  'GlIntersectionObserver',
123
123
  'GlInfiniteScroll',
124
124
  'GlColumnChart',
125
+ 'GlTruncate',
126
+ 'GlNav',
127
+ 'GlNavItem',
128
+ 'GlNavItemDropdown',
125
129
  ],
126
130
  components: {
127
131
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "33.1.1",
3
+ "version": "35.1.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -85,21 +85,21 @@
85
85
  "@arkweid/lefthook": "^0.7.6",
86
86
  "@babel/core": "^7.10.2",
87
87
  "@babel/preset-env": "^7.10.2",
88
- "@gitlab/eslint-plugin": "10.0.1",
89
- "@gitlab/stylelint-config": "3.0.0",
88
+ "@gitlab/eslint-plugin": "10.0.2",
89
+ "@gitlab/stylelint-config": "4.0.0",
90
90
  "@gitlab/svgs": "2.2.0",
91
91
  "@rollup/plugin-commonjs": "^11.1.0",
92
92
  "@rollup/plugin-node-resolve": "^7.1.3",
93
93
  "@rollup/plugin-replace": "^2.3.2",
94
- "@storybook/addon-a11y": "6.4.14",
95
- "@storybook/addon-docs": "6.4.14",
96
- "@storybook/addon-essentials": "6.4.14",
94
+ "@storybook/addon-a11y": "6.4.15",
95
+ "@storybook/addon-docs": "6.4.15",
96
+ "@storybook/addon-essentials": "6.4.15",
97
97
  "@storybook/addon-knobs": "6.4.0",
98
- "@storybook/addon-storyshots": "6.4.14",
99
- "@storybook/addon-storyshots-puppeteer": "6.4.14",
100
- "@storybook/addon-viewport": "6.4.14",
101
- "@storybook/theming": "6.4.14",
102
- "@storybook/vue": "6.4.14",
98
+ "@storybook/addon-storyshots": "6.4.15",
99
+ "@storybook/addon-storyshots-puppeteer": "6.4.15",
100
+ "@storybook/addon-viewport": "6.4.15",
101
+ "@storybook/theming": "6.4.15",
102
+ "@storybook/vue": "6.4.15",
103
103
  "@vue/test-utils": "1.3.0",
104
104
  "autoprefixer": "^9.7.6",
105
105
  "babel-jest": "^26.6.3",
@@ -129,7 +129,7 @@
129
129
  "npm-run-all": "^4.1.5",
130
130
  "pikaday": "^1.8.0",
131
131
  "plop": "^2.5.4",
132
- "postcss": "^7.0.30",
132
+ "postcss": "8.4.5",
133
133
  "postcss-loader": "^3.0.0",
134
134
  "postcss-scss": "^2.1.1",
135
135
  "prettier": "2.2.1",
@@ -147,7 +147,7 @@
147
147
  "sass-true": "^5.0.0",
148
148
  "start-server-and-test": "^1.10.6",
149
149
  "storybook-readme": "5.0.9",
150
- "stylelint": "13.9.0",
150
+ "stylelint": "14.3.0",
151
151
  "stylelint-config-prettier": "9.0.3",
152
152
  "stylelint-prettier": "2.0.0",
153
153
  "vue": "^2.6.11",
@@ -4,9 +4,12 @@ import { uniqueId } from 'lodash';
4
4
  export default {
5
5
  name: 'GlAccordion',
6
6
  provide() {
7
+ const accordionId = uniqueId('accordion-set-');
8
+ // 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
7
10
  return {
8
- defaultHeaderLevel: this.headerLevel,
9
- accordionSetId: this.autoCollapse && uniqueId('accordion-set-'),
11
+ defaultHeaderLevel: () => this.headerLevel,
12
+ accordionSetId: () => this.autoCollapse && accordionId,
10
13
  };
11
14
  },
12
15
  props: {
@@ -16,8 +16,8 @@ describe('GlAccordionItem', () => {
16
16
  GlCollapseToggle: GlCollapseToggleDirective,
17
17
  },
18
18
  provide: {
19
- defaultHeaderLevel,
20
- accordionSetId,
19
+ defaultHeaderLevel: () => defaultHeaderLevel,
20
+ accordionSetId: () => accordionSetId,
21
21
  },
22
22
  propsData: {
23
23
  title: defaultTitle,
@@ -26,8 +26,8 @@ const Template = (args) => ({
26
26
  props: Object.keys(args),
27
27
  template,
28
28
  provide: {
29
- defaultHeaderLevel: defaultValue('headerLevel'),
30
- accordionSetId: '1',
29
+ defaultHeaderLevel: () => defaultValue('headerLevel'),
30
+ accordionSetId: () => '1',
31
31
  },
32
32
  });
33
33
 
@@ -51,11 +51,11 @@ When set, it will ensure the accordion item is initially visible
51
51
  },
52
52
  computed: {
53
53
  headerComponent() {
54
- const level = this.headerLevel || this.defaultHeaderLevel;
54
+ const level = this.headerLevel || this.defaultHeaderLevel();
55
55
  return `h${level}`;
56
56
  },
57
57
  accordion() {
58
- return this.accordionSetId || undefined;
58
+ return this.accordionSetId() || undefined;
59
59
  },
60
60
  icon() {
61
61
  return this.isVisible ? 'chevron-down' : 'chevron-right';
@@ -1,10 +1,13 @@
1
1
  import Vue from 'vue';
2
+ import { GlAvatar } from '../../../../index';
2
3
  import { GlTooltipDirective } from '../../../directives/tooltip';
3
4
  import { avatarSizeOptions, avatarShapeOptions, tooltipPlacements } from '../../../utils/constants';
4
5
  import readme from './avatar.md';
5
6
 
6
7
  Vue.directive('gl-tooltip', GlTooltipDirective);
7
8
 
9
+ const components = { GlAvatar };
10
+
8
11
  const generateImageProps = ({ size = 64, shape = 'circle' } = {}) => ({
9
12
  size,
10
13
  shape,
@@ -44,6 +47,7 @@ const template = `
44
47
  `;
45
48
 
46
49
  export const Image = (args, { argTypes }) => ({
50
+ components,
47
51
  props: Object.keys(argTypes),
48
52
  template: `
49
53
  <gl-avatar
@@ -56,18 +60,21 @@ export const Image = (args, { argTypes }) => ({
56
60
  Image.args = generateImageProps();
57
61
 
58
62
  export const ProjectFallback = (args, { argTypes }) => ({
63
+ components,
59
64
  props: Object.keys(argTypes),
60
65
  template,
61
66
  });
62
67
  ProjectFallback.args = generateProjectFallbackProps();
63
68
 
64
69
  export const EmojiProjectName = (args, { argTypes }) => ({
70
+ components,
65
71
  props: Object.keys(argTypes),
66
72
  template,
67
73
  });
68
74
  EmojiProjectName.args = generateEmojiProjectProps();
69
75
 
70
76
  export const WithTooltip = (args, { argTypes }) => ({
77
+ components,
71
78
  props: Object.keys(argTypes),
72
79
  template: `
73
80
  <gl-avatar
@@ -83,6 +90,7 @@ WithTooltip.args = { ...generateImageProps(), ...generateTooltipProps() };
83
90
 
84
91
  export default {
85
92
  title: 'base/avatar',
93
+ component: GlAvatar,
86
94
  parameters: {
87
95
  knobs: { disable: true },
88
96
  docs: {
@@ -1,10 +1,13 @@
1
1
  import Vue from 'vue';
2
+ import { GlAvatarLabeled, GlBadge } from '../../../../index';
2
3
  import { GlTooltipDirective } from '../../../directives/tooltip';
3
4
  import { avatarSizeOptions, avatarShapeOptions, tooltipPlacements } from '../../../utils/constants';
4
5
  import readme from './avatar_labeled.md';
5
6
 
6
7
  Vue.directive('gl-tooltip', GlTooltipDirective);
7
8
 
9
+ const components = { GlAvatarLabeled };
10
+
8
11
  const generateProps = ({
9
12
  label = 'GitLab User',
10
13
  subLabel = '@gitlab',
@@ -25,6 +28,7 @@ const generateTooltipProps = ({ tooltipText = 'Avatar tooltip', placement = 'top
25
28
  });
26
29
 
27
30
  export const Default = (args, { argTypes }) => ({
31
+ components,
28
32
  props: Object.keys(argTypes),
29
33
  template: `
30
34
  <gl-avatar-labeled
@@ -39,6 +43,7 @@ export const Default = (args, { argTypes }) => ({
39
43
  Default.args = generateProps();
40
44
 
41
45
  export const WithTooltip = (args, { argTypes }) => ({
46
+ components,
42
47
  props: Object.keys(argTypes),
43
48
  template: `
44
49
  <gl-avatar-labeled
@@ -63,6 +68,7 @@ WithTooltip.argTypes = {
63
68
  };
64
69
 
65
70
  export const WithBadges = (args, { argTypes }) => ({
71
+ components: { GlAvatarLabeled, GlBadge },
66
72
  props: Object.keys(argTypes),
67
73
  template: `
68
74
  <gl-avatar-labeled
@@ -87,6 +93,7 @@ WithBadges.args = generateProps();
87
93
 
88
94
  export default {
89
95
  title: 'base/avatar/labeled',
96
+ component: GlAvatarLabeled,
90
97
  parameters: {
91
98
  knobs: { disable: true },
92
99
  docs: {
@@ -1,6 +1,9 @@
1
+ import { GlAvatarLink, GlAvatar, GlAvatarLabeled } from '../../../../index';
1
2
  import { avatarSizeOptions, avatarShapeOptions } from '../../../utils/constants';
2
3
  import readme from './avatar_link.md';
3
4
 
5
+ const components = { GlAvatarLink, GlAvatar };
6
+
4
7
  const generateDefaultProps = ({
5
8
  href = 'https://gitlab.com/gitlab-org/gitlab',
6
9
  shape = 'circle',
@@ -23,6 +26,7 @@ const generateImageProps = ({
23
26
  });
24
27
 
25
28
  export const Default = (args, { argTypes }) => ({
29
+ components,
26
30
  props: Object.keys(argTypes),
27
31
  template: `
28
32
  <gl-avatar-link target="blank" :href="href">
@@ -33,6 +37,7 @@ export const Default = (args, { argTypes }) => ({
33
37
  Default.args = { ...generateDefaultProps(), ...generateImageProps() };
34
38
 
35
39
  export const WithLabeledAvatar = (args, { argTypes }) => ({
40
+ components: { GlAvatarLink, GlAvatarLabeled },
36
41
  props: Object.keys(argTypes),
37
42
  template: `
38
43
  <gl-avatar-link target="blank" :href="href">
@@ -47,6 +52,7 @@ WithLabeledAvatar.args = {
47
52
  };
48
53
 
49
54
  export const WithNoImageAvatar = (args, { argTypes }) => ({
55
+ components,
50
56
  props: Object.keys(argTypes),
51
57
  template: `
52
58
  <gl-avatar-link target="blank" :href="href">
@@ -58,6 +64,7 @@ WithNoImageAvatar.args = { ...generateDefaultProps({}), ...generateLabelsProps({
58
64
 
59
65
  export default {
60
66
  title: 'base/avatar/avatar-link',
67
+ component: GlAvatarLink,
61
68
  parameters: {
62
69
  knobs: { disable: true },
63
70
  docs: {
@@ -28,6 +28,11 @@ When the `collapse` property value is `true` and the `maxVisible` property value
28
28
  than the length of the `avatars` property array, `<avatars-inline>` will hide the overflown avatars
29
29
  and display a badge instead.
30
30
 
31
+ ### Badge description in screen readers
32
+
33
+ The `badgeSrOnlyText` property provides a meaningful description of the badge that appears
34
+ when avatars are collapsed for screen reader users.
35
+
31
36
  ### Supported sizes
32
37
 
33
38
  `<avatars-inline>` only supports avatars with `24` or `32` size.
@@ -11,10 +11,14 @@ describe('avatars inline', () => {
11
11
  { src: 'avatar 2', tooltip: 'Avatar 2' },
12
12
  { src: 'avatar 3', tooltip: 'Avatar 3' },
13
13
  ];
14
+ const badgeSrOnlyText = 'additional users';
14
15
 
15
16
  const buildWrapper = (propsData = {}) => {
16
17
  wrapper = shallowMount(AvatarsInline, {
17
- propsData,
18
+ propsData: {
19
+ badgeSrOnlyText,
20
+ ...propsData,
21
+ },
18
22
  stubs: {
19
23
  GlTooltip,
20
24
  },
@@ -107,4 +111,20 @@ describe('avatars inline', () => {
107
111
  });
108
112
  });
109
113
  });
114
+
115
+ describe('a11y', () => {
116
+ it('renders screen reader only text for the collapse badge', () => {
117
+ buildWrapper({ avatars, maxVisible: 1, collapsed: true, avatarSize: 32 });
118
+
119
+ expect(wrapper.find('[data-testid="badge-sr-only-text"]').text()).toBe(badgeSrOnlyText);
120
+ });
121
+
122
+ it('hides badge text for screen readers', () => {
123
+ buildWrapper({ avatars, maxVisible: 1, collapsed: true, avatarSize: 32 });
124
+
125
+ expect(
126
+ wrapper.find('[data-testid="collapsed-avatars-badge"]').attributes('aria-hidden')
127
+ ).toBe('true');
128
+ });
129
+ });
110
130
  });
@@ -1,37 +1,49 @@
1
+ import { GlAvatarsInline, GlAvatar, GlAvatarLink, GlTooltipDirective } from '../../../../index';
1
2
  import { avatarsInlineSizeOptions } from '../../../utils/constants';
2
3
  import readme from './avatars_inline.md';
3
4
 
4
5
  const defaultAvatars = [
5
- { src: 'https://picsum.photos/id/1005/32' },
6
- { src: 'https://picsum.photos/id/1006/32' },
7
- { src: 'https://picsum.photos/id/1009/32' },
8
- { src: 'https://picsum.photos/id/1011/32' },
9
- { src: 'https://picsum.photos/id/1012/32' },
6
+ { src: 'https://picsum.photos/id/1005/32', alt: 'Administrator’s user avatar' },
7
+ { src: 'https://picsum.photos/id/1006/32', alt: 'Ops Manager’s user avatar' },
8
+ { src: 'https://picsum.photos/id/1009/32', alt: 'Developer’s user avatar' },
9
+ { src: 'https://picsum.photos/id/1011/32', alt: 'Business Admin’s user avatar' },
10
+ { src: 'https://picsum.photos/id/1012/32', alt: 'Product designer’s user avatar' },
10
11
  ];
11
12
 
12
13
  const generateProps = (
13
14
  avatars = defaultAvatars,
14
- { maxVisible = 2, collapsed = true, avatarSize = 24 } = {}
15
+ {
16
+ maxVisible = 2,
17
+ collapsed = true,
18
+ avatarSize = 24,
19
+ badgeTooltipProp = '',
20
+ badgeSrOnlyText = `${avatars.length - maxVisible} additional users`,
21
+ } = {}
15
22
  ) => ({
16
23
  maxVisible,
17
24
  collapsed,
18
25
  avatarSize,
19
26
  avatars,
27
+ badgeTooltipProp,
28
+ badgeSrOnlyText,
20
29
  });
21
30
 
22
31
  export const Default = (args, { argTypes }) => ({
32
+ components: { GlAvatarsInline },
23
33
  props: Object.keys(argTypes),
24
34
  template: `
25
- <gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible">
35
+ <gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible" :badgeTooltipProp="badgeTooltipProp" :badgeSrOnlyText="badgeSrOnlyText">
26
36
  </gl-avatars-inline>
27
37
  `,
28
38
  });
29
39
  Default.args = generateProps();
30
40
 
31
41
  export const WithLinksAndTooltips = (args, { argTypes }) => ({
42
+ components: { GlAvatarsInline, GlAvatar, GlAvatarLink },
43
+ directives: { GlTooltip: GlTooltipDirective },
32
44
  props: Object.keys(argTypes),
33
45
  template: `
34
- <gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible">
46
+ <gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible" :badgeTooltipProp="badgeTooltipProp" :badgeSrOnlyText="badgeSrOnlyText">
35
47
  <template #avatar="{ avatar }">
36
48
  <gl-avatar-link target="blank" :href="avatar.href" v-gl-tooltip :title="avatar.tooltip">
37
49
  <gl-avatar :src="avatar.src" :size="avatarSize" />
@@ -45,11 +57,13 @@ WithLinksAndTooltips.args = generateProps(
45
57
  ...avatar,
46
58
  href: '//gitlab.com',
47
59
  tooltip: `Avatar ${index}`,
48
- }))
60
+ })),
61
+ { badgeTooltipProp: 'tooltip' }
49
62
  );
50
63
 
51
64
  export default {
52
65
  title: 'base/avatar/avatars-inline',
66
+ component: GlAvatarsInline,
53
67
  parameters: {
54
68
  knobs: { disable: true },
55
69
  docs: {
@@ -29,6 +29,10 @@ export default {
29
29
  required: false,
30
30
  default: false,
31
31
  },
32
+ badgeSrOnlyText: {
33
+ type: String,
34
+ required: true,
35
+ },
32
36
  badgeTooltipProp: {
33
37
  type: String,
34
38
  required: false,
@@ -111,9 +115,15 @@ export default {
111
115
  <gl-tooltip v-if="badgeTooltipProp" :target="() => $refs.badge">
112
116
  {{ badgeTooltipTitle }}
113
117
  </gl-tooltip>
114
- <span ref="badge" :class="['gl-avatars-inline-badge', badgeSize]">
118
+ <span
119
+ ref="badge"
120
+ data-testid="collapsed-avatars-badge"
121
+ :class="['gl-avatars-inline-badge', badgeSize]"
122
+ aria-hidden="true"
123
+ >
115
124
  {{ badgeLabel }}
116
125
  </span>
126
+ <span data-testid="badge-sr-only-text" class="sr-only">{{ badgeSrOnlyText }}</span>
117
127
  </div>
118
128
  </div>
119
129
  </template>
@@ -36,23 +36,128 @@ const Template = (args, { argTypes }) => ({
36
36
 
37
37
  export const Default = Template.bind({});
38
38
  Default.args = generateProps();
39
+ Default.parameters = {
40
+ storyshots: { disable: true },
41
+ };
39
42
 
40
- export const ActionableWarning = Template.bind({});
41
- ActionableWarning.args = generateProps({
43
+ export const Variants = (args, { argTypes }) => ({
44
+ components: { GlBadge },
45
+ props: Object.keys(argTypes),
46
+ template: `
47
+ <div>
48
+ <gl-badge
49
+ v-for="variant in $options.badgeVariantOptions"
50
+ :key="variant"
51
+ :href="href"
52
+ :variant="variant"
53
+ :size="size"
54
+ :icon="icon"
55
+ class="gl-mr-3"
56
+ >{{ variant }}</gl-badge>
57
+ </div>
58
+ `,
59
+ badgeVariantOptions,
60
+ });
61
+ Variants.args = generateProps({
62
+ variant: badgeVariantOptions.warning,
63
+ });
64
+ Variants.argTypes = {
65
+ content: {
66
+ control: { disable: true },
67
+ },
68
+ variant: {
69
+ control: { disable: true },
70
+ },
71
+ };
72
+
73
+ export const Actionable = (args, { argTypes }) => ({
74
+ components: { GlBadge },
75
+ props: Object.keys(argTypes),
76
+ template: `
77
+ <div>
78
+ <gl-badge
79
+ v-for="variant in $options.badgeVariantOptions"
80
+ :key="variant"
81
+ :href="href"
82
+ :variant="variant"
83
+ :size="size"
84
+ :icon="icon"
85
+ class="gl-mr-3"
86
+ >{{ variant }}</gl-badge>
87
+ </div>
88
+ `,
89
+ badgeVariantOptions,
90
+ });
91
+ Actionable.args = generateProps({
42
92
  href: '#foo',
43
93
  variant: badgeVariantOptions.warning,
44
94
  });
95
+ Actionable.parameters = {
96
+ storyshots: { disable: true },
97
+ };
98
+ Actionable.argTypes = {
99
+ content: {
100
+ control: { disable: true },
101
+ },
102
+ variant: {
103
+ control: { disable: true },
104
+ },
105
+ };
45
106
 
46
- export const LargeDanger = Template.bind({});
47
- LargeDanger.args = generateProps({
48
- size: badgeSizeOptions.lg,
107
+ export const Sizes = (args, { argTypes }) => ({
108
+ components: { GlBadge },
109
+ props: Object.keys(argTypes),
110
+ template: `
111
+ <div>
112
+ <gl-badge
113
+ v-for="size in $options.badgeSizeOptions"
114
+ :key="size"
115
+ :href="href"
116
+ :variant="variant"
117
+ :size="size"
118
+ :icon="icon"
119
+ class="gl-mr-3"
120
+ >{{ size }}</gl-badge>
121
+ </div>
122
+ `,
123
+ badgeSizeOptions,
124
+ });
125
+ Sizes.args = generateProps({
49
126
  variant: badgeVariantOptions.danger,
50
127
  });
128
+ Sizes.argTypes = {
129
+ content: {
130
+ control: { disable: true },
131
+ },
132
+ size: {
133
+ control: { disable: true },
134
+ },
135
+ };
51
136
 
52
- export const BadgeIcon = Template.bind({});
137
+ export const BadgeIcon = (args, { argTypes }) => ({
138
+ components: { GlBadge },
139
+ props: Object.keys(argTypes),
140
+ template: `
141
+ <div>
142
+ <gl-badge
143
+ :href="href"
144
+ :variant="variant"
145
+ :size="size"
146
+ :icon="icon"
147
+ >{{ content }}</gl-badge>
148
+ <gl-badge
149
+ :href="href"
150
+ :variant="variant"
151
+ :size="size"
152
+ :icon="icon"
153
+ />
154
+ </div>
155
+ `,
156
+ });
53
157
  BadgeIcon.args = generateProps({
54
158
  variant: badgeVariantOptions.success,
55
159
  icon: 'calendar',
160
+ content: 'Badge icon',
56
161
  });
57
162
 
58
163
  export default {
@@ -68,21 +173,21 @@ export default {
68
173
  },
69
174
  argTypes: {
70
175
  variant: {
176
+ options: Object.keys(badgeVariantOptions),
71
177
  control: {
72
178
  type: 'select',
73
- options: badgeVariantOptions,
74
179
  },
75
180
  },
76
181
  size: {
182
+ options: Object.keys(badgeSizeOptions),
77
183
  control: {
78
184
  type: 'select',
79
- options: badgeSizeOptions,
80
185
  },
81
186
  },
82
187
  icon: {
188
+ options: ['', ...iconSpriteInfo.icons],
83
189
  control: {
84
190
  type: 'select',
85
- options: ['', ...iconSpriteInfo.icons],
86
191
  },
87
192
  },
88
193
  },
@@ -29,7 +29,7 @@ const generateProps = ({
29
29
  });
30
30
 
31
31
  const Template = (args, { argTypes }) => ({
32
- component: {
32
+ components: {
33
33
  GlBroadcastMessage,
34
34
  },
35
35
  props: Object.keys(argTypes),
@@ -39,7 +39,7 @@ export const Default = Template.bind({});
39
39
  Default.args = generateProps();
40
40
 
41
41
  const StackedStory = (args, { argTypes }) => ({
42
- component: {
42
+ components: {
43
43
  GlBroadcastMessage,
44
44
  },
45
45
  props: Object.keys(argTypes),