@gitlab/ui 32.47.0 → 32.48.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 (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/base/avatar_labeled/avatar_labeled.documentation.js +2 -9
  3. package/dist/components/base/avatars_inline/avatars_inline.documentation.js +2 -5
  4. package/dist/components/charts/gauge/gauge.documentation.js +2 -6
  5. package/dist/components/utilities/intersperse/intersperse.documentation.js +2 -5
  6. package/documentation/documented_stories.js +4 -0
  7. package/package.json +1 -1
  8. package/src/components/base/avatar_labeled/avatar_labeled.documentation.js +0 -9
  9. package/src/components/base/avatar_labeled/avatar_labeled.md +2 -5
  10. package/src/components/base/avatar_labeled/avatar_labeled.stories.js +68 -62
  11. package/src/components/base/avatar_labeled/avatar_labeled.vue +1 -0
  12. package/src/components/base/avatars_inline/avatars_inline.documentation.js +0 -2
  13. package/src/components/base/avatars_inline/avatars_inline.md +1 -3
  14. package/src/components/base/avatars_inline/avatars_inline.stories.js +49 -44
  15. package/src/components/charts/gauge/gauge.documentation.js +0 -3
  16. package/src/components/charts/gauge/gauge.md +0 -2
  17. package/src/components/charts/gauge/gauge.stories.js +70 -86
  18. package/src/components/utilities/intersperse/intersperse.documentation.js +0 -2
  19. package/src/components/utilities/intersperse/intersperse.md +0 -2
  20. package/src/components/utilities/intersperse/intersperse.stories.js +38 -38
  21. package/dist/components/base/avatar_labeled/examples/avatar.labeled.example.js +0 -38
  22. package/dist/components/base/avatar_labeled/examples/avatar.labeled_badges.example.js +0 -38
  23. package/dist/components/base/avatar_labeled/examples/avatar.labeled_links.example.js +0 -38
  24. package/dist/components/base/avatar_labeled/examples/avatar.labeled_tooltip.example.js +0 -38
  25. package/dist/components/base/avatar_labeled/examples/index.js +0 -31
  26. package/dist/components/base/avatars_inline/examples/avatars.inline.example.js +0 -58
  27. package/dist/components/base/avatars_inline/examples/avatars.inline_large.example.js +0 -58
  28. package/dist/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips.example.js +0 -70
  29. package/dist/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips_badge.example.js +0 -70
  30. package/dist/components/base/avatars_inline/examples/index.js +0 -31
  31. package/dist/components/charts/gauge/examples/gauge.basic.example.js +0 -38
  32. package/dist/components/charts/gauge/examples/gauge.no_thresholds.example.js +0 -38
  33. package/dist/components/charts/gauge/examples/gauge.no_value.example.js +0 -38
  34. package/dist/components/charts/gauge/examples/gauge.with_text.example.js +0 -38
  35. package/dist/components/charts/gauge/examples/index.js +0 -31
  36. package/dist/components/utilities/intersperse/examples/index.js +0 -31
  37. package/dist/components/utilities/intersperse/examples/intersperse.custom_last_separator.example.js +0 -38
  38. package/dist/components/utilities/intersperse/examples/intersperse.custom_last_separator_two_items.example.js +0 -38
  39. package/dist/components/utilities/intersperse/examples/intersperse.custom_separator.example.js +0 -38
  40. package/dist/components/utilities/intersperse/examples/intersperse.default.example.js +0 -38
  41. package/src/components/base/avatar_labeled/examples/avatar.labeled.example.vue +0 -8
  42. package/src/components/base/avatar_labeled/examples/avatar.labeled_badges.example.vue +0 -17
  43. package/src/components/base/avatar_labeled/examples/avatar.labeled_links.example.vue +0 -10
  44. package/src/components/base/avatar_labeled/examples/avatar.labeled_tooltip.example.vue +0 -10
  45. package/src/components/base/avatar_labeled/examples/index.js +0 -36
  46. package/src/components/base/avatars_inline/examples/avatars.inline.example.vue +0 -18
  47. package/src/components/base/avatars_inline/examples/avatars.inline_large.example.vue +0 -18
  48. package/src/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips.example.vue +0 -24
  49. package/src/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips_badge.example.vue +0 -31
  50. package/src/components/base/avatars_inline/examples/index.js +0 -36
  51. package/src/components/charts/gauge/examples/gauge.basic.example.vue +0 -5
  52. package/src/components/charts/gauge/examples/gauge.no_thresholds.example.vue +0 -5
  53. package/src/components/charts/gauge/examples/gauge.no_value.example.vue +0 -5
  54. package/src/components/charts/gauge/examples/gauge.with_text.example.vue +0 -12
  55. package/src/components/charts/gauge/examples/index.js +0 -36
  56. package/src/components/utilities/intersperse/examples/index.js +0 -36
  57. package/src/components/utilities/intersperse/examples/intersperse.custom_last_separator.example.vue +0 -7
  58. package/src/components/utilities/intersperse/examples/intersperse.custom_last_separator_two_items.example.vue +0 -6
  59. package/src/components/utilities/intersperse/examples/intersperse.custom_separator.example.vue +0 -7
  60. package/src/components/utilities/intersperse/examples/intersperse.default.example.vue +0 -7
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [32.48.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.47.0...v32.48.0) (2021-12-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlAvatarsInline:** Migrate storybook story ([0720510](https://gitlab.com/gitlab-org/gitlab-ui/commit/07205105cb98e8493cfe3f8b70191707175ca8a9))
7
+
1
8
  # [32.47.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.46.0...v32.47.0) (2021-12-13)
2
9
 
3
10
 
@@ -1,15 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "# Avatar labeled\n\n<!-- STORY -->\n## Usage\n\nAvatars may also be adjacent to a text alternative, such as a user or project name. In these cases,\na null `alt` text should be used so that they can be ignored by assistive technologies.\n\nUse the `avatar-labeled` component in those scenarios. It will set a null `alt` text by default.\nIt allows to display a `label` and/or a `sub-label` next to the avatar image. It accepts the same\nproperties as the avatar component to modify the avatar’s shape and size.\n\n## Using the component\n\n~~~js\n<gl-avatar-labeled\n :shape=\"shape\"\n :size=\"size\"\n :src=\"src\"\n :label=\"label\"\n :sub-label=\"subLabel\"\n/>\n~~~\n";
1
+ var description = "## Usage\n\nAvatars may also be adjacent to a text alternative, such as a user or project name. In these cases,\na null `alt` text should be used so that they can be ignored by assistive technologies.\n\nUse the `avatar-labeled` component in those scenarios. It will set a null `alt` text by default.\nIt allows to display a `label` and/or a `sub-label` next to the avatar image. It accepts the same\nproperties as the avatar component to modify the avatar’s shape and size.\n\n## Using the component\n\n```js\n<gl-avatar-labeled\n :shape=\"shape\"\n :size=\"size\"\n :src=\"src\"\n :label=\"label\"\n :sub-label=\"subLabel\"\n/>\n```\n";
4
2
 
5
3
  var avatar_labeled_documentation = {
6
4
  followsDesignSystem: true,
7
- description,
8
- examples,
9
- slots: [{
10
- name: 'meta',
11
- description: 'Meta data to add to the avatar. Generally used for badges or user status emoji.'
12
- }]
5
+ description
13
6
  };
14
7
 
15
8
  export default avatar_labeled_documentation;
@@ -1,6 +1,4 @@
1
- import examples from './examples';
2
-
3
- var avatars_inline = "## Avatars inline\n\nUse `<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### Supported sizes\n\n`<avatars-inline>` only supports avatars with `24` or `32` size.\n";
4
2
 
5
3
  var description = /*#__PURE__*/Object.freeze({
6
4
  __proto__: null,
@@ -9,8 +7,7 @@ var description = /*#__PURE__*/Object.freeze({
9
7
 
10
8
  var avatars_inline_documentation = {
11
9
  followsDesignSystem: true,
12
- description,
13
- examples
10
+ description
14
11
  };
15
12
 
16
13
  export default avatars_inline_documentation;
@@ -1,6 +1,4 @@
1
- import examples from './examples';
2
-
3
- var gauge = "### Gauge Chart\n\nSome layout problems can be encountered with this component. Specifically, when the gauge chart's\naxis labels or detail text have larger widths, they can overlap with the chart elements.\n\nAlso, when the containing element of the gauge chart has either of a small calculated `width` and\n`height`, its axis width could become bulkier in relation to other chart elements. This is because\nat this time [eCharts only allows for setting the axis line width in absolute units](https://echarts.apache.org/en/option.html#series-gauge.axisLine.lineStyle.width).\n\nThis issue is to be addressed by [https://gitlab.com/gitlab-org/gitlab-ui/-/issues/916](https://gitlab.com/gitlab-org/gitlab-ui/-/issues/916).\n";
1
+ var gauge = "Some layout problems can be encountered with this component. Specifically, when the gauge chart's\naxis labels or detail text have larger widths, they can overlap with the chart elements.\n\nAlso, when the containing element of the gauge chart has either of a small calculated `width` and\n`height`, its axis width could become bulkier in relation to other chart elements. This is because\nat this time [eCharts only allows for setting the axis line width in absolute units](https://echarts.apache.org/en/option.html#series-gauge.axisLine.lineStyle.width).\n\nThis issue is to be addressed by [https://gitlab.com/gitlab-org/gitlab-ui/-/issues/916](https://gitlab.com/gitlab-org/gitlab-ui/-/issues/916).\n";
4
2
 
5
3
  var description = /*#__PURE__*/Object.freeze({
6
4
  __proto__: null,
@@ -8,9 +6,7 @@ var description = /*#__PURE__*/Object.freeze({
8
6
  });
9
7
 
10
8
  var gauge_documentation = {
11
- description,
12
- examples,
13
- propsInfo: {}
9
+ description
14
10
  };
15
11
 
16
12
  export default gauge_documentation;
@@ -1,11 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "## Intersperse\n\nThe intersperse component separates a list of elements\nby a given character (the default is `, `).\n\nIt takes all direct descendants of its default slot and inserts\nthe given separator between each item:\n\n`item 1, item 2, item 3`\n\nOptionally the character used for separating each item and the last separator can be set\nindependently:\n\n* `separator=\"/\"` renders `item 1/item 2/item 3`\n* `lastSeparator=\" and \"` will render `item 1, item 2, and item 3`\n* `lastSeparator=\" and \"` and given two items will render `item 1 and item 2`\n\n**Note**:\n\nThe component provides an inline context since the result is wrapped in a `span`.\n\nAlso, whitespace elements that are direct children of the default-slot get removed to ensure\nconsistent formatting.\n\n## Usage\n\n### Default\n\n```html\n<gl-intersperse>\n <span>Item 1</span>\n <span>Item 2</span>\n <span>Item 3</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span>, <span>Item 2</span>, <span>Item 3</span></span>\n```\n\n### Custom Separator\n\nA custom separator can be defined via the `separator` prop:\n\n```html\n<gl-intersperse separator=\"/\">\n <span>Item 1</span>\n <span>Item 2</span>\n <span>Item 3</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span>/<span>Item 2</span>/<span>Item 3</span></span>\n```\n\n### Custom Last Separator\n\nA custom last separator can be defined via the `lastSeparator` prop:\n\n```html\n<gl-intersperse last-separator=\" and \">\n <span>Item 1</span>\n <span>Item 2</span>\n <span>Item 3</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span>, <span>Item 2</span>, and <span>Item 3</span></span>\n```\n\nA custom last separator used on two items will only place `lastSeparator` between them:\n\n```html\n<gl-intersperse last-separator=\" and \">\n <span>Item 1</span>\n <span>Item 2</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span> and <span>Item 2</span></span>\n```\n";
1
+ var description = "The intersperse component separates a list of elements\nby a given character (the default is `, `).\n\nIt takes all direct descendants of its default slot and inserts\nthe given separator between each item:\n\n`item 1, item 2, item 3`\n\nOptionally the character used for separating each item and the last separator can be set\nindependently:\n\n* `separator=\"/\"` renders `item 1/item 2/item 3`\n* `lastSeparator=\" and \"` will render `item 1, item 2, and item 3`\n* `lastSeparator=\" and \"` and given two items will render `item 1 and item 2`\n\n**Note**:\n\nThe component provides an inline context since the result is wrapped in a `span`.\n\nAlso, whitespace elements that are direct children of the default-slot get removed to ensure\nconsistent formatting.\n\n## Usage\n\n### Default\n\n```html\n<gl-intersperse>\n <span>Item 1</span>\n <span>Item 2</span>\n <span>Item 3</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span>, <span>Item 2</span>, <span>Item 3</span></span>\n```\n\n### Custom Separator\n\nA custom separator can be defined via the `separator` prop:\n\n```html\n<gl-intersperse separator=\"/\">\n <span>Item 1</span>\n <span>Item 2</span>\n <span>Item 3</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span>/<span>Item 2</span>/<span>Item 3</span></span>\n```\n\n### Custom Last Separator\n\nA custom last separator can be defined via the `lastSeparator` prop:\n\n```html\n<gl-intersperse last-separator=\" and \">\n <span>Item 1</span>\n <span>Item 2</span>\n <span>Item 3</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span>, <span>Item 2</span>, and <span>Item 3</span></span>\n```\n\nA custom last separator used on two items will only place `lastSeparator` between them:\n\n```html\n<gl-intersperse last-separator=\" and \">\n <span>Item 1</span>\n <span>Item 2</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span> and <span>Item 2</span></span>\n```\n";
4
2
 
5
3
  var intersperse_documentation = {
6
4
  followsDesignSystem: false,
7
- description,
8
- examples
5
+ description
9
6
  };
10
7
 
11
8
  export default intersperse_documentation;
@@ -60,6 +60,7 @@ export const setupStorybookReadme = () =>
60
60
  'GlTableLite',
61
61
  'GlAlert',
62
62
  'GlSparklineChart',
63
+ 'GlAvatarsInline',
63
64
  'GlSprintf',
64
65
  'GlLink',
65
66
  'GlChart',
@@ -88,7 +89,9 @@ export const setupStorybookReadme = () =>
88
89
  'GlFormCheckbox',
89
90
  'GlAccordion',
90
91
  'GlAccordionItem',
92
+ 'GlIntersperse',
91
93
  'GlDaterangePicker',
94
+ 'GlAvatarLabeled',
92
95
  'GlBarChart',
93
96
  'GlCarousel',
94
97
  'GlMarkdown',
@@ -107,6 +110,7 @@ export const setupStorybookReadme = () =>
107
110
  'GlFormCombobox',
108
111
  'GlChartTooltip',
109
112
  'GlInputGroupText',
113
+ 'GlGaugeChart',
110
114
  ],
111
115
  components: {
112
116
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "32.47.0",
3
+ "version": "32.48.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,15 +1,6 @@
1
1
  import description from './avatar_labeled.md';
2
- import examples from './examples';
3
2
 
4
3
  export default {
5
4
  followsDesignSystem: true,
6
5
  description,
7
- examples,
8
- slots: [
9
- {
10
- name: 'meta',
11
- description:
12
- 'Meta data to add to the avatar. Generally used for badges or user status emoji.',
13
- },
14
- ],
15
6
  };
@@ -1,6 +1,3 @@
1
- # Avatar labeled
2
-
3
- <!-- STORY -->
4
1
  ## Usage
5
2
 
6
3
  Avatars may also be adjacent to a text alternative, such as a user or project name. In these cases,
@@ -12,7 +9,7 @@ properties as the avatar component to modify the avatar’s shape and size.
12
9
 
13
10
  ## Using the component
14
11
 
15
- ~~~js
12
+ ```js
16
13
  <gl-avatar-labeled
17
14
  :shape="shape"
18
15
  :size="size"
@@ -20,4 +17,4 @@ properties as the avatar component to modify the avatar’s shape and size.
20
17
  :label="label"
21
18
  :sub-label="subLabel"
22
19
  />
23
- ~~~
20
+ ```
@@ -1,62 +1,32 @@
1
- import { text, withKnobs, select } from '@storybook/addon-knobs';
2
1
  import Vue from 'vue';
3
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
4
2
  import { GlTooltipDirective } from '../../../directives/tooltip';
5
3
  import { avatarSizeOptions, avatarShapeOptions, tooltipPlacements } from '../../../utils/constants';
6
4
  import readme from './avatar_labeled.md';
7
5
 
8
6
  Vue.directive('gl-tooltip', GlTooltipDirective);
9
7
 
10
- function generateProps() {
11
- const props = {
12
- label: {
13
- type: String,
14
- default: text('label', 'GitLab User'),
15
- },
16
- subLabel: {
17
- type: String,
18
- default: text('subLabel', '@gitlab'),
19
- },
20
- size: {
21
- type: Number,
22
- default: select('size', avatarSizeOptions, 32),
23
- },
24
- shape: {
25
- type: String,
26
- default: select('shape', avatarShapeOptions, 'circle'),
27
- },
28
- src: {
29
- type: String,
30
- default: text(
31
- 'src',
32
- 'https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=64'
33
- ),
34
- },
35
- };
36
-
37
- return props;
38
- }
39
-
40
- function generateTooltipProps() {
41
- const props = {
42
- tooltipText: {
43
- type: String,
44
- default: text('tooltipText', 'Avatar tooltip'),
45
- },
46
- placement: {
47
- type: String,
48
- default: select('placement', tooltipPlacements, 'top'),
49
- },
50
- };
8
+ const generateProps = ({
9
+ label = 'GitLab User',
10
+ subLabel = '@gitlab',
11
+ size = 32,
12
+ shape = 'circle',
13
+ src = 'https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=64',
14
+ } = {}) => ({
15
+ label,
16
+ subLabel,
17
+ size,
18
+ shape,
19
+ src,
20
+ });
51
21
 
52
- return props;
53
- }
22
+ const generateTooltipProps = ({ tooltipText = 'Avatar tooltip', placement = 'top' } = {}) => ({
23
+ tooltipText,
24
+ placement,
25
+ });
54
26
 
55
- documentedStoriesOf('base/avatar/labeled', readme)
56
- .addDecorator(withKnobs)
57
- .add('default', () => ({
58
- props: generateProps(),
59
- template: `
27
+ export const Default = (args, { argTypes }) => ({
28
+ props: Object.keys(argTypes),
29
+ template: `
60
30
  <gl-avatar-labeled
61
31
  :shape="shape"
62
32
  :size="size"
@@ -65,13 +35,12 @@ documentedStoriesOf('base/avatar/labeled', readme)
65
35
  :sub-label="subLabel"
66
36
  />
67
37
  `,
68
- }))
69
- .add('with-tooltip', () => ({
70
- props: {
71
- ...generateProps(),
72
- ...generateTooltipProps(),
73
- },
74
- template: `
38
+ });
39
+ Default.args = generateProps();
40
+
41
+ export const WithTooltip = (args, { argTypes }) => ({
42
+ props: Object.keys(argTypes),
43
+ template: `
75
44
  <gl-avatar-labeled
76
45
  :shape="shape"
77
46
  :size="size"
@@ -82,10 +51,20 @@ documentedStoriesOf('base/avatar/labeled', readme)
82
51
  v-gl-tooltip="{ placement }"
83
52
  />
84
53
  `,
85
- }))
86
- .add('with-badges', () => ({
87
- props: generateProps(),
88
- template: `
54
+ });
55
+ WithTooltip.args = { ...generateProps(), ...generateTooltipProps() };
56
+ WithTooltip.argTypes = {
57
+ placement: {
58
+ control: {
59
+ type: 'select',
60
+ options: tooltipPlacements,
61
+ },
62
+ },
63
+ };
64
+
65
+ export const WithBadges = (args, { argTypes }) => ({
66
+ props: Object.keys(argTypes),
67
+ template: `
89
68
  <gl-avatar-labeled
90
69
  :shape="shape"
91
70
  :size="size"
@@ -103,4 +82,31 @@ documentedStoriesOf('base/avatar/labeled', readme)
103
82
  </template>
104
83
  </gl-avatar-labeled>
105
84
  `,
106
- }));
85
+ });
86
+ WithBadges.args = generateProps();
87
+
88
+ export default {
89
+ title: 'base/avatar/labeled',
90
+ parameters: {
91
+ knobs: { disable: true },
92
+ docs: {
93
+ description: {
94
+ component: readme,
95
+ },
96
+ },
97
+ },
98
+ argTypes: {
99
+ size: {
100
+ control: {
101
+ type: 'select',
102
+ options: avatarSizeOptions,
103
+ },
104
+ },
105
+ shape: {
106
+ control: {
107
+ type: 'select',
108
+ options: avatarShapeOptions,
109
+ },
110
+ },
111
+ },
112
+ };
@@ -49,6 +49,7 @@ export default {
49
49
  <span class="gl-avatar-labeled-label">{{ label }}</span>
50
50
  </gl-link>
51
51
  <span v-else class="gl-avatar-labeled-label">{{ label }}</span>
52
+ <!-- @slot Metadata to add to the avatar. Generally used for badges or user status emoji. -->
52
53
  <slot name="meta"></slot>
53
54
  </div>
54
55
  <gl-link v-if="hasSubLabelLink" :href="subLabelLink" class="gl-avatar-link">
@@ -1,8 +1,6 @@
1
1
  import * as description from './avatars_inline.md';
2
- import examples from './examples';
3
2
 
4
3
  export default {
5
4
  followsDesignSystem: true,
6
5
  description,
7
- examples,
8
6
  };
@@ -1,12 +1,10 @@
1
- ## Avatars inline
2
-
3
1
  Use `<avatars-inline />` to display multiple avatars organized in a single row.
4
2
 
5
3
  ### Basic usage
6
4
 
7
5
  The `avatars` property accepts an array of objects that contains the avatar properties. By default,
8
6
  `<avatars-inline />` expects each object contained in the array to have the same shape as the
9
- properties of the `<avatar />` component. You can customize the display of each avatar by
7
+ properties of the `<avatar />` component. You can customize the display of each avatar by
10
8
  overriding the default slot:
11
9
 
12
10
  ```html
@@ -1,7 +1,4 @@
1
- import { number, boolean, object, select, withKnobs } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
1
  import { avatarsInlineSizeOptions } from '../../../utils/constants';
4
-
5
2
  import readme from './avatars_inline.md';
6
3
 
7
4
  const defaultAvatars = [
@@ -12,53 +9,61 @@ const defaultAvatars = [
12
9
  { src: 'https://picsum.photos/id/1012/32' },
13
10
  ];
14
11
 
15
- function generateProps(avatars = defaultAvatars) {
16
- const props = {
17
- maxVisible: {
18
- type: Number,
19
- default: number('maxVisible', 2),
20
- },
21
- collapsed: {
22
- type: Boolean,
23
- default: boolean('collapsed', true),
24
- },
25
- size: {
26
- type: Number,
27
- default: select('size', avatarsInlineSizeOptions, 24),
28
- },
29
- avatars: {
30
- type: Array,
31
- default: object('avatars', avatars),
32
- },
33
- };
34
-
35
- return props;
36
- }
12
+ const generateProps = (
13
+ avatars = defaultAvatars,
14
+ { maxVisible = 2, collapsed = true, avatarSize = 24 } = {}
15
+ ) => ({
16
+ maxVisible,
17
+ collapsed,
18
+ avatarSize,
19
+ avatars,
20
+ });
37
21
 
38
- documentedStoriesOf('base/avatar/avatars-inline', readme)
39
- .addDecorator(withKnobs)
40
- .add('default', () => ({
41
- props: generateProps(),
42
- template: `
43
- <gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="size" :max-visible="maxVisible">
22
+ export const Default = (args, { argTypes }) => ({
23
+ props: Object.keys(argTypes),
24
+ template: `
25
+ <gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible">
44
26
  </gl-avatars-inline>
45
27
  `,
46
- }))
47
- .add('with links and tooltips', () => ({
48
- props: generateProps(
49
- defaultAvatars.map((avatar, index) => ({
50
- ...avatar,
51
- href: '//gitlab.com',
52
- tooltip: `Avatar ${index}`,
53
- }))
54
- ),
55
- template: `
56
- <gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="size" :max-visible="maxVisible">
28
+ });
29
+ Default.args = generateProps();
30
+
31
+ export const WithLinksAndTooltips = (args, { argTypes }) => ({
32
+ props: Object.keys(argTypes),
33
+ template: `
34
+ <gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible">
57
35
  <template #avatar="{ avatar }">
58
36
  <gl-avatar-link target="blank" :href="avatar.href" v-gl-tooltip :title="avatar.tooltip">
59
- <gl-avatar :src="avatar.src" :size="size" />
37
+ <gl-avatar :src="avatar.src" :size="avatarSize" />
60
38
  </gl-avatar-link>
61
39
  </template>
62
40
  </gl-avatars-inline>
63
41
  `,
64
- }));
42
+ });
43
+ WithLinksAndTooltips.args = generateProps(
44
+ defaultAvatars.map((avatar, index) => ({
45
+ ...avatar,
46
+ href: '//gitlab.com',
47
+ tooltip: `Avatar ${index}`,
48
+ }))
49
+ );
50
+
51
+ export default {
52
+ title: 'base/avatar/avatars-inline',
53
+ parameters: {
54
+ knobs: { disable: true },
55
+ docs: {
56
+ description: {
57
+ component: readme,
58
+ },
59
+ },
60
+ },
61
+ argTypes: {
62
+ avatarSize: {
63
+ control: {
64
+ type: 'select',
65
+ options: avatarsInlineSizeOptions,
66
+ },
67
+ },
68
+ },
69
+ };
@@ -1,8 +1,5 @@
1
- import examples from './examples';
2
1
  import * as description from './gauge.md';
3
2
 
4
3
  export default {
5
4
  description,
6
- examples,
7
- propsInfo: {},
8
5
  };
@@ -1,5 +1,3 @@
1
- ### Gauge Chart
2
-
3
1
  Some layout problems can be encountered with this component. Specifically, when the gauge chart's
4
2
  axis labels or detail text have larger widths, they can overlap with the chart elements.
5
3