@gitlab/ui 32.45.1 → 32.49.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 (151) hide show
  1. package/CHANGELOG.md +28 -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/base/form/form_combobox/form_combobox.documentation.js +2 -9
  5. package/dist/components/base/form/form_combobox/form_combobox.js +5 -0
  6. package/dist/components/base/form/form_group/form_group.js +11 -1
  7. package/dist/components/base/form/form_radio/form_radio.documentation.js +2 -33
  8. package/dist/components/base/form/form_radio/form_radio.js +15 -2
  9. package/dist/components/base/form/input_group_text/input_group_text.documentation.js +1 -5
  10. package/dist/components/base/keyset_pagination/keyset_pagination.documentation.js +2 -84
  11. package/dist/components/base/keyset_pagination/keyset_pagination.js +42 -0
  12. package/dist/components/base/modal/modal.documentation.js +2 -32
  13. package/dist/components/base/modal/modal.js +1 -1
  14. package/dist/components/charts/discrete_scatter/discrete_scatter.documentation.js +1 -7
  15. package/dist/components/charts/gauge/gauge.documentation.js +2 -6
  16. package/dist/components/charts/stacked_column/stacked_column.documentation.js +2 -5
  17. package/dist/components/charts/tooltip/tooltip.documentation.js +1 -5
  18. package/dist/components/utilities/intersperse/intersperse.documentation.js +2 -5
  19. package/dist/index.css +1 -1
  20. package/dist/index.css.map +1 -1
  21. package/documentation/documented_stories.js +12 -0
  22. package/package.json +1 -1
  23. package/src/components/base/avatar_labeled/avatar_labeled.documentation.js +0 -9
  24. package/src/components/base/avatar_labeled/avatar_labeled.md +2 -5
  25. package/src/components/base/avatar_labeled/avatar_labeled.stories.js +68 -62
  26. package/src/components/base/avatar_labeled/avatar_labeled.vue +1 -0
  27. package/src/components/base/avatars_inline/avatars_inline.documentation.js +0 -2
  28. package/src/components/base/avatars_inline/avatars_inline.md +1 -3
  29. package/src/components/base/avatars_inline/avatars_inline.stories.js +49 -44
  30. package/src/components/base/form/form_combobox/form_combobox.documentation.js +0 -8
  31. package/src/components/base/form/form_combobox/form_combobox.md +0 -2
  32. package/src/components/base/form/form_combobox/form_combobox.stories.js +30 -30
  33. package/src/components/base/form/form_combobox/form_combobox.vue +4 -0
  34. package/src/components/base/form/form_group/form_group.scss +4 -0
  35. package/src/components/base/form/form_group/form_group.spec.js +66 -64
  36. package/src/components/base/form/form_group/form_group.stories.js +36 -13
  37. package/src/components/base/form/form_group/form_group.vue +15 -2
  38. package/src/components/base/form/form_radio/form_radio.documentation.js +0 -31
  39. package/src/components/base/form/form_radio/form_radio.md +7 -14
  40. package/src/components/base/form/form_radio/form_radio.stories.js +40 -28
  41. package/src/components/base/form/form_radio/form_radio.vue +26 -1
  42. package/src/components/base/form/input_group_text/input_group_text.documentation.js +0 -3
  43. package/src/components/base/form/input_group_text/input_group_text.stories.js +24 -18
  44. package/src/components/base/keyset_pagination/keyset_pagination.documentation.js +0 -99
  45. package/src/components/base/keyset_pagination/keyset_pagination.md +0 -2
  46. package/src/components/base/keyset_pagination/keyset_pagination.stories.js +60 -58
  47. package/src/components/base/keyset_pagination/keyset_pagination.vue +35 -1
  48. package/src/components/base/modal/modal.documentation.js +0 -42
  49. package/src/components/base/modal/modal.md +2 -7
  50. package/src/components/base/modal/modal.stories.js +107 -85
  51. package/src/components/base/modal/modal.vue +20 -0
  52. package/src/components/charts/discrete_scatter/discrete_scatter.documentation.js +0 -5
  53. package/src/components/charts/discrete_scatter/discrete_scatter.stories.js +34 -46
  54. package/src/components/charts/gauge/gauge.documentation.js +0 -3
  55. package/src/components/charts/gauge/gauge.md +0 -2
  56. package/src/components/charts/gauge/gauge.stories.js +70 -86
  57. package/src/components/charts/stacked_column/stacked_column.documentation.js +0 -2
  58. package/src/components/charts/stacked_column/stacked_column.md +0 -2
  59. package/src/components/charts/stacked_column/stacked_column.stories.js +74 -99
  60. package/src/components/charts/tooltip/tooltip.documentation.js +0 -3
  61. package/src/components/charts/tooltip/tooltip.stories.js +59 -44
  62. package/src/components/utilities/intersperse/intersperse.documentation.js +0 -2
  63. package/src/components/utilities/intersperse/intersperse.md +0 -2
  64. package/src/components/utilities/intersperse/intersperse.stories.js +38 -38
  65. package/dist/components/base/avatar_labeled/examples/avatar.labeled.example.js +0 -38
  66. package/dist/components/base/avatar_labeled/examples/avatar.labeled_badges.example.js +0 -38
  67. package/dist/components/base/avatar_labeled/examples/avatar.labeled_links.example.js +0 -38
  68. package/dist/components/base/avatar_labeled/examples/avatar.labeled_tooltip.example.js +0 -38
  69. package/dist/components/base/avatar_labeled/examples/index.js +0 -31
  70. package/dist/components/base/avatars_inline/examples/avatars.inline.example.js +0 -58
  71. package/dist/components/base/avatars_inline/examples/avatars.inline_large.example.js +0 -58
  72. package/dist/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips.example.js +0 -70
  73. package/dist/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips_badge.example.js +0 -70
  74. package/dist/components/base/avatars_inline/examples/index.js +0 -31
  75. package/dist/components/base/form/form_combobox/examples/form_combobox.basic.example.js +0 -50
  76. package/dist/components/base/form/form_combobox/examples/index.js +0 -13
  77. package/dist/components/base/form/form_radio/examples/form_radio.basic.example.js +0 -48
  78. package/dist/components/base/form/form_radio/examples/form_radio.checked_disabled.example.js +0 -48
  79. package/dist/components/base/form/form_radio/examples/index.js +0 -19
  80. package/dist/components/base/form/input_group_text/examples/index.js +0 -13
  81. package/dist/components/base/form/input_group_text/examples/input_group_text.basic.example.js +0 -38
  82. package/dist/components/base/keyset_pagination/examples/index.js +0 -37
  83. package/dist/components/base/keyset_pagination/examples/keyset_pagination.basic.example.js +0 -51
  84. package/dist/components/base/keyset_pagination/examples/keyset_pagination.events.example.js +0 -64
  85. package/dist/components/base/keyset_pagination/examples/keyset_pagination.internationalization.example.js +0 -59
  86. package/dist/components/base/keyset_pagination/examples/keyset_pagination.links.example.js +0 -51
  87. package/dist/components/base/keyset_pagination/examples/keyset_pagination.slots.example.js +0 -51
  88. package/dist/components/base/modal/examples/index.js +0 -31
  89. package/dist/components/base/modal/examples/modal.basic.example.js +0 -62
  90. package/dist/components/base/modal/examples/modal.disabled.example.js +0 -89
  91. package/dist/components/base/modal/examples/modal.sizes.example.js +0 -62
  92. package/dist/components/charts/discrete_scatter/examples/discrete_scatter.basic.example.js +0 -51
  93. package/dist/components/charts/discrete_scatter/examples/index.js +0 -13
  94. package/dist/components/charts/gauge/examples/gauge.basic.example.js +0 -38
  95. package/dist/components/charts/gauge/examples/gauge.no_thresholds.example.js +0 -38
  96. package/dist/components/charts/gauge/examples/gauge.no_value.example.js +0 -38
  97. package/dist/components/charts/gauge/examples/gauge.with_text.example.js +0 -38
  98. package/dist/components/charts/gauge/examples/index.js +0 -31
  99. package/dist/components/charts/stacked_column/examples/index.js +0 -13
  100. package/dist/components/charts/stacked_column/examples/stacked_column.basic.example.js +0 -46
  101. package/dist/components/charts/tooltip/examples/chart_tooltip.basic.example.js +0 -54
  102. package/dist/components/charts/tooltip/examples/index.js +0 -13
  103. package/dist/components/utilities/intersperse/examples/index.js +0 -31
  104. package/dist/components/utilities/intersperse/examples/intersperse.custom_last_separator.example.js +0 -38
  105. package/dist/components/utilities/intersperse/examples/intersperse.custom_last_separator_two_items.example.js +0 -38
  106. package/dist/components/utilities/intersperse/examples/intersperse.custom_separator.example.js +0 -38
  107. package/dist/components/utilities/intersperse/examples/intersperse.default.example.js +0 -38
  108. package/src/components/base/avatar_labeled/examples/avatar.labeled.example.vue +0 -8
  109. package/src/components/base/avatar_labeled/examples/avatar.labeled_badges.example.vue +0 -17
  110. package/src/components/base/avatar_labeled/examples/avatar.labeled_links.example.vue +0 -10
  111. package/src/components/base/avatar_labeled/examples/avatar.labeled_tooltip.example.vue +0 -10
  112. package/src/components/base/avatar_labeled/examples/index.js +0 -36
  113. package/src/components/base/avatars_inline/examples/avatars.inline.example.vue +0 -18
  114. package/src/components/base/avatars_inline/examples/avatars.inline_large.example.vue +0 -18
  115. package/src/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips.example.vue +0 -24
  116. package/src/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips_badge.example.vue +0 -31
  117. package/src/components/base/avatars_inline/examples/index.js +0 -36
  118. package/src/components/base/form/form_combobox/examples/form_combobox.basic.example.vue +0 -31
  119. package/src/components/base/form/form_combobox/examples/index.js +0 -15
  120. package/src/components/base/form/form_radio/examples/form_radio.basic.example.vue +0 -16
  121. package/src/components/base/form/form_radio/examples/form_radio.checked_disabled.example.vue +0 -13
  122. package/src/components/base/form/form_radio/examples/index.js +0 -22
  123. package/src/components/base/form/input_group_text/examples/index.js +0 -15
  124. package/src/components/base/form/input_group_text/examples/input_group_text.basic.example.vue +0 -3
  125. package/src/components/base/keyset_pagination/examples/index.js +0 -43
  126. package/src/components/base/keyset_pagination/examples/keyset_pagination.basic.example.vue +0 -16
  127. package/src/components/base/keyset_pagination/examples/keyset_pagination.events.example.vue +0 -29
  128. package/src/components/base/keyset_pagination/examples/keyset_pagination.internationalization.example.vue +0 -23
  129. package/src/components/base/keyset_pagination/examples/keyset_pagination.links.example.vue +0 -20
  130. package/src/components/base/keyset_pagination/examples/keyset_pagination.slots.example.vue +0 -23
  131. package/src/components/base/modal/examples/index.js +0 -39
  132. package/src/components/base/modal/examples/modal.basic.example.vue +0 -39
  133. package/src/components/base/modal/examples/modal.disabled.example.vue +0 -58
  134. package/src/components/base/modal/examples/modal.sizes.example.vue +0 -61
  135. package/src/components/charts/discrete_scatter/discrete_scatter.md +0 -1
  136. package/src/components/charts/discrete_scatter/examples/discrete_scatter.basic.example.vue +0 -31
  137. package/src/components/charts/discrete_scatter/examples/index.js +0 -15
  138. package/src/components/charts/gauge/examples/gauge.basic.example.vue +0 -5
  139. package/src/components/charts/gauge/examples/gauge.no_thresholds.example.vue +0 -5
  140. package/src/components/charts/gauge/examples/gauge.no_value.example.vue +0 -5
  141. package/src/components/charts/gauge/examples/gauge.with_text.example.vue +0 -12
  142. package/src/components/charts/gauge/examples/index.js +0 -36
  143. package/src/components/charts/stacked_column/examples/index.js +0 -15
  144. package/src/components/charts/stacked_column/examples/stacked_column.basic.example.vue +0 -18
  145. package/src/components/charts/tooltip/examples/chart_tooltip.basic.example.vue +0 -32
  146. package/src/components/charts/tooltip/examples/index.js +0 -15
  147. package/src/components/utilities/intersperse/examples/index.js +0 -36
  148. package/src/components/utilities/intersperse/examples/intersperse.custom_last_separator.example.vue +0 -7
  149. package/src/components/utilities/intersperse/examples/intersperse.custom_last_separator_two_items.example.vue +0 -6
  150. package/src/components/utilities/intersperse/examples/intersperse.custom_separator.example.vue +0 -7
  151. package/src/components/utilities/intersperse/examples/intersperse.default.example.vue +0 -7
@@ -1,5 +1,3 @@
1
- import { withKnobs, object, number, text as textKnob, array } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
1
  import { toolbox } from '../../../utils/charts/story_config';
4
2
  import readme from './gauge.md';
5
3
  import GlGauge from './gauge.vue';
@@ -16,7 +14,7 @@ const template = `
16
14
  />
17
15
  `;
18
16
 
19
- function generateProps({
17
+ const generateProps = ({
20
18
  value = 48,
21
19
  min = 0,
22
20
  max = 100,
@@ -24,88 +22,74 @@ function generateProps({
24
22
  option = {},
25
23
  thresholds = [38, 82],
26
24
  splitNumber = 10,
27
- } = {}) {
28
- return {
29
- option: {
30
- default: object('EChart Options', option),
31
- },
32
- value: {
33
- default: number('Value', value),
34
- },
35
- min: {
36
- default: number('Min', min),
37
- },
38
- max: {
39
- default: number('Max', max),
40
- },
41
- thresholds: {
42
- default: array('Thresholds', thresholds),
43
- },
44
- text: {
45
- default: textKnob('Detail Text', text),
46
- },
47
- splitNumber: {
48
- default: number('Split Number', splitNumber),
49
- },
50
- };
51
- }
25
+ } = {}) => ({
26
+ option,
27
+ value,
28
+ min,
29
+ max,
30
+ thresholds,
31
+ text,
32
+ splitNumber,
33
+ });
34
+
35
+ const Template = (args, { argTypes }) => ({
36
+ components: { GlGauge },
37
+ props: Object.keys(argTypes),
38
+ template,
39
+ });
52
40
 
53
- documentedStoriesOf('charts/gauge-chart', readme)
54
- .addDecorator(withKnobs)
55
- .add('default', () => ({
56
- props: generateProps(),
57
- components: { GlGauge },
58
- template,
59
- }))
60
- .add('one threshold', () => ({
61
- props: generateProps({
62
- value: 65,
63
- thresholds: [85],
64
- }),
65
- components: { GlGauge },
66
- template,
67
- }))
68
- .add('two thresholds', () => ({
69
- props: generateProps({
70
- value: 90,
71
- thresholds: [60, 85],
72
- }),
73
- components: { GlGauge },
74
- template,
75
- }))
76
- .add('no thresholds', () => ({
77
- props: generateProps({
78
- value: 90,
79
- thresholds: [],
80
- }),
81
- components: { GlGauge },
82
- template,
83
- }))
84
- .add('with custom detail text', () => ({
85
- props: generateProps({
86
- value: 90,
87
- text: '90Mbps',
88
- thresholds: [60, 85],
89
- }),
90
- components: { GlGauge },
91
- template,
92
- }))
93
- .add('with NaN values', () => ({
94
- props: generateProps({
95
- min: 'not a number value',
96
- max: 'not a number value',
97
- value: 'not a number value',
98
- thresholds: [60, 85],
99
- }),
100
- components: { GlGauge },
101
- template,
102
- }))
103
- .add('with toolbox', () => ({
104
- props: generateProps({
105
- option: {
106
- toolbox,
41
+ export const Default = Template.bind({});
42
+ Default.args = generateProps();
43
+
44
+ export const OneThreshold = Template.bind({});
45
+ OneThreshold.args = generateProps({
46
+ value: 65,
47
+ thresholds: [85],
48
+ });
49
+
50
+ export const TwoThresholds = Template.bind({});
51
+ TwoThresholds.args = generateProps({
52
+ value: 90,
53
+ thresholds: [60, 85],
54
+ });
55
+
56
+ export const NoThresholds = Template.bind({});
57
+ NoThresholds.args = generateProps({
58
+ value: 90,
59
+ thresholds: [],
60
+ });
61
+
62
+ export const WithCustomDetailText = Template.bind({});
63
+ WithCustomDetailText.args = generateProps({
64
+ value: 90,
65
+ text: '90Mbps',
66
+ thresholds: [60, 85],
67
+ });
68
+
69
+ export const WithNaNValues = Template.bind({});
70
+ WithNaNValues.args = generateProps({
71
+ min: 'not a number value',
72
+ max: 'not a number value',
73
+ value: 'not a number value',
74
+ thresholds: [60, 85],
75
+ });
76
+
77
+ export const WithToolbox = Template.bind({});
78
+ WithToolbox.args = generateProps({
79
+ option: {
80
+ toolbox,
81
+ },
82
+ });
83
+
84
+ export default {
85
+ title: 'charts/gauge-chart',
86
+ component: GlGauge,
87
+ parameters: {
88
+ knobs: { disable: true },
89
+ docs: {
90
+ description: {
91
+ component: readme,
107
92
  },
108
- }),
109
- components: { GlGauge },
110
- template,
111
- }));
93
+ },
94
+ },
95
+ };
@@ -1,8 +1,6 @@
1
- import examples from './examples';
2
1
  import description from './stacked_column.md';
3
2
 
4
3
  export default {
5
4
  followsDesignSystem: false,
6
5
  description,
7
- examples,
8
6
  };
@@ -1,5 +1,3 @@
1
- # Stacked Column Chart
2
-
3
1
  The `presentation` property allows you to change between a stacked and tiled presentation style. It
4
2
  is only setup to accept `stacked` or `tiled` as values, the default value is `tiled`.
5
3
 
@@ -1,6 +1,4 @@
1
- import { withKnobs, object, text, array, select } from '@storybook/addon-knobs';
2
1
  import { GlStackedColumnChart } from '../../../../charts';
3
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
4
2
  import {
5
3
  mockDefaultStackedLineData,
6
4
  mockDefaultStackedBarData,
@@ -10,10 +8,6 @@ import { toolbox } from '../../../utils/charts/story_config';
10
8
  import { columnOptions } from '../../../utils/constants';
11
9
  import readme from './stacked_column.md';
12
10
 
13
- const components = {
14
- GlStackedColumnChart,
15
- };
16
-
17
11
  const template = `
18
12
  <gl-stacked-column-chart
19
13
  :bars="bars"
@@ -31,7 +25,7 @@ const template = `
31
25
 
32
26
  const mockSecondaryDataTitle = 'Merges';
33
27
 
34
- function generateProps({
28
+ const generateProps = ({
35
29
  bars = mockDefaultStackedBarData,
36
30
  lines = [],
37
31
  option = {},
@@ -42,98 +36,79 @@ function generateProps({
42
36
  presentation = columnOptions.stacked,
43
37
  secondaryData = [],
44
38
  secondaryDataTitle = '',
45
- } = {}) {
46
- return {
47
- bars: {
48
- default: object('Bar chart Data', bars),
49
- },
50
- lines: {
51
- default: object('Line chart Data', lines),
52
- },
53
- option: {
54
- default: object('Echart Options', option),
55
- },
56
- presentation: {
57
- default: select('presentation', columnOptions, presentation),
58
- },
59
- groupBy: {
60
- default: array('Group By', groupBy),
61
- },
62
- xAxisType: {
63
- default: text('X Axis Type', xAxisType),
64
- },
65
- xAxisTitle: {
66
- default: text('X Axis Title', xAxisTitle),
67
- },
68
- yAxisTitle: {
69
- default: text('Y Axis Title', yAxisTitle),
70
- },
71
- secondaryDataTitle: {
72
- default: text('Secondary Data Title', secondaryDataTitle),
73
- },
74
- secondaryData: {
75
- default: object('Secondary Data', secondaryData),
76
- },
77
- };
78
- }
39
+ } = {}) => ({
40
+ bars,
41
+ lines,
42
+ option,
43
+ presentation,
44
+ groupBy,
45
+ xAxisType,
46
+ xAxisTitle,
47
+ yAxisTitle,
48
+ secondaryDataTitle,
49
+ secondaryData,
50
+ });
79
51
 
80
- documentedStoriesOf('charts/stacked-column-chart', readme)
81
- .addDecorator(withKnobs)
82
- .add('stacked', () => ({
83
- props: generateProps(),
84
- components,
85
- template,
86
- }))
87
- .add('tiled', () => ({
88
- props: generateProps({ presentation: columnOptions.tiled }),
89
- components,
90
- template,
91
- }))
92
- .add('stacked with line data', () => ({
93
- props: generateProps({ lines: mockDefaultStackedLineData }),
94
- components,
95
- template,
96
- }))
97
- .add('tiled with line data', () => ({
98
- props: generateProps({ presentation: columnOptions.tiled, lines: mockDefaultStackedLineData }),
99
- components,
100
- template,
101
- }))
102
- .add('with zoom and scroll', () => ({
103
- props: generateProps({
104
- option: {
105
- dataZoom: [
106
- {
107
- startValue: 1,
108
- },
109
- ],
52
+ const Template = (args, { argTypes }) => ({
53
+ components: { GlStackedColumnChart },
54
+ props: Object.keys(argTypes),
55
+ template,
56
+ });
57
+
58
+ export const Stacked = Template.bind({});
59
+ Stacked.args = generateProps();
60
+
61
+ export const Tiled = Template.bind({});
62
+ Tiled.args = generateProps({ presentation: columnOptions.tiled });
63
+
64
+ export const StackedWithLineData = Template.bind({});
65
+ StackedWithLineData.args = generateProps({ lines: mockDefaultStackedLineData });
66
+
67
+ export const TiledWithLineData = Template.bind({});
68
+ TiledWithLineData.args = generateProps({
69
+ presentation: columnOptions.tiled,
70
+ lines: mockDefaultStackedLineData,
71
+ });
72
+
73
+ export const WithZoomAndScroll = Template.bind({});
74
+ WithZoomAndScroll.args = generateProps({
75
+ option: {
76
+ dataZoom: [
77
+ {
78
+ startValue: 1,
110
79
  },
111
- }),
112
- components,
113
- template,
114
- }))
115
- .add('with toolbox', () => ({
116
- props: generateProps({
117
- option: {
118
- toolbox,
80
+ ],
81
+ },
82
+ });
83
+
84
+ export const WithToolbox = Template.bind({});
85
+ WithToolbox.args = generateProps({
86
+ option: {
87
+ toolbox,
88
+ },
89
+ });
90
+
91
+ export const SecondaryYAxis = Template.bind({});
92
+ SecondaryYAxis.args = generateProps({
93
+ secondaryData: mockSecondaryData,
94
+ secondaryDataTitle: mockSecondaryDataTitle,
95
+ });
96
+
97
+ export const SecondaryYAxisLine = Template.bind({});
98
+ SecondaryYAxisLine.args = generateProps({
99
+ secondaryData: [{ ...mockSecondaryData[0], type: 'line' }],
100
+ secondaryDataTitle: mockSecondaryDataTitle,
101
+ });
102
+
103
+ export default {
104
+ title: 'charts/stacked-column-chart',
105
+ component: GlStackedColumnChart,
106
+ parameters: {
107
+ knobs: { disable: true },
108
+ docs: {
109
+ description: {
110
+ component: readme,
119
111
  },
120
- }),
121
- components,
122
- template,
123
- }))
124
- .add('secondary Y axis', () => ({
125
- props: generateProps({
126
- secondaryData: mockSecondaryData,
127
- secondaryDataTitle: mockSecondaryDataTitle,
128
- }),
129
- components,
130
- template,
131
- }))
132
- .add('secondary Y axis line', () => ({
133
- props: generateProps({
134
- secondaryData: [{ ...mockSecondaryData[0], type: 'line' }],
135
- secondaryDataTitle: mockSecondaryDataTitle,
136
- }),
137
- components,
138
- template,
139
- }));
112
+ },
113
+ },
114
+ };
@@ -1,9 +1,6 @@
1
- import examples from './examples';
2
1
  import description from './tooltip.md';
3
2
 
4
3
  export default {
5
4
  followsDesignSystem: false,
6
5
  description,
7
- examples,
8
- bootstrapComponent: 'b-popover',
9
6
  };
@@ -1,11 +1,9 @@
1
1
  import { GlChart, GlChartTooltip, GlChartSeriesLabel } from '../../../../charts';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
2
  import {
4
3
  SERIES_NAME,
5
4
  SERIES_NAME_LONG,
6
5
  SERIES_NAME_LONG_WITHOUT_SPACES,
7
6
  } from '../../../utils/stories_utils';
8
-
9
7
  import readme from './tooltip.md';
10
8
 
11
9
  const components = {
@@ -33,10 +31,9 @@ const baseStoryOptions = {
33
31
  },
34
32
  };
35
33
 
36
- const getStoryOptions = (tooltipContent) => {
37
- return {
38
- ...baseStoryOptions,
39
- template: `<div class="position-relative">
34
+ const getStoryOptions = (tooltipContent) => ({
35
+ ...baseStoryOptions,
36
+ template: `<div class="position-relative">
40
37
  <gl-chart
41
38
  :options="options"
42
39
  :height="100"
@@ -57,43 +54,61 @@ const getStoryOptions = (tooltipContent) => {
57
54
  ${tooltipContent}
58
55
  </gl-chart-tooltip>
59
56
  </div>`,
60
- };
61
- };
57
+ });
58
+
59
+ export const Default = (args, { argTypes }) => ({
60
+ props: Object.keys(argTypes),
61
+ ...getStoryOptions('Example Content'),
62
+ });
63
+
64
+ export const WithLongSeriesLabel = (args, { argTypes }) => ({
65
+ props: Object.keys(argTypes),
66
+ ...getStoryOptions(`
67
+ <gl-chart-series-label color="#1F78D1">${SERIES_NAME[SERIES_NAME_LONG]}</gl-chart-series-label>
68
+ `),
69
+ });
62
70
 
63
- documentedStoriesOf('charts/chart-tooltip', readme)
64
- .add('default', () => getStoryOptions('Example Content'))
65
- .add('with long series label', () =>
66
- getStoryOptions(`
67
- <gl-chart-series-label color="#1F78D1">${SERIES_NAME[SERIES_NAME_LONG]}</gl-chart-series-label>
68
- `)
69
- )
70
- .add('with long series label with no spaces', () =>
71
- getStoryOptions(`
72
- <gl-chart-series-label color="#1F78D1">${SERIES_NAME[SERIES_NAME_LONG_WITHOUT_SPACES]}</gl-chart-series-label>
73
- `)
74
- )
71
+ export const WithLongSeriesLabelWithNoSpaces = (args, { argTypes }) => ({
72
+ props: Object.keys(argTypes),
73
+ ...getStoryOptions(`
74
+ <gl-chart-series-label color="#1F78D1">${SERIES_NAME[SERIES_NAME_LONG_WITHOUT_SPACES]}</gl-chart-series-label>
75
+ `),
76
+ });
75
77
 
76
- // This story exists to avoid regressions as part of
77
- // https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1482, and may be affected
78
- // by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1479
79
- .add('title prop', () => ({
80
- ...baseStoryOptions,
81
- template: `
82
- <div class="position-relative">
83
- <gl-chart
84
- :options="options"
85
- :height="100"
86
- @created="onCreated"
87
- />
88
- <gl-chart-tooltip
89
- v-if="chart"
90
- :chart="chart"
91
- :show="showTooltip"
92
- :top="top"
93
- :left="left"
94
- title="Title from prop"
95
- >
96
- Example content
97
- </gl-chart-tooltip>
98
- </div>`,
99
- }));
78
+ export const TitleProp = (args, { argTypes }) => ({
79
+ props: Object.keys(argTypes),
80
+ ...baseStoryOptions,
81
+ template: `
82
+ <div class="position-relative">
83
+ <gl-chart
84
+ :options="options"
85
+ :height="100"
86
+ @created="onCreated"
87
+ />
88
+ <gl-chart-tooltip
89
+ v-if="chart"
90
+ :chart="chart"
91
+ :show="showTooltip"
92
+ :top="top"
93
+ :left="left"
94
+ title="Title from prop"
95
+ >
96
+ Example content
97
+ </gl-chart-tooltip>
98
+ </div>`,
99
+ });
100
+
101
+ export default {
102
+ title: 'charts/chart-tooltip',
103
+ component: GlChartTooltip,
104
+ parameters: {
105
+ bootstrapComponent: 'b-popover',
106
+ knobs: { disable: true },
107
+ controls: { disable: true },
108
+ docs: {
109
+ description: {
110
+ component: readme,
111
+ },
112
+ },
113
+ },
114
+ };
@@ -1,8 +1,6 @@
1
- import examples from './examples';
2
1
  import description from './intersperse.md';
3
2
 
4
3
  export default {
5
4
  followsDesignSystem: false,
6
5
  description,
7
- examples,
8
6
  };
@@ -1,5 +1,3 @@
1
- ## Intersperse
2
-
3
1
  The intersperse component separates a list of elements
4
2
  by a given character (the default is `, `).
5
3
 
@@ -1,5 +1,3 @@
1
- import { array, text, withKnobs } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
1
  import { GlIntersperse } from '../../../../index';
4
2
  import readme from './intersperse.md';
5
3
 
@@ -11,44 +9,46 @@ const template = `
11
9
  </div>
12
10
  `;
13
11
 
14
- function generateProps({
12
+ const generateProps = ({
15
13
  separator = ', ',
16
14
  lastSeparator = '',
17
15
  items = ['Foo', 'Bar', 'Baz', 'Qaz'],
18
- } = {}) {
19
- return {
20
- items: {
21
- default: array('items', items),
22
- },
23
- separator: {
24
- default: text('separator', separator),
25
- },
26
- lastSeparator: {
27
- default: text('lastSeparator', lastSeparator),
28
- },
29
- };
30
- }
16
+ } = {}) => ({
17
+ separator,
18
+ lastSeparator,
19
+ items,
20
+ });
31
21
 
32
- documentedStoriesOf('utilities/intersperse', readme)
33
- .addDecorator(withKnobs)
34
- .add('default', () => ({
35
- props: generateProps(),
36
- components: {
37
- GlIntersperse,
38
- },
39
- template,
40
- }))
41
- .add('custom seperator', () => ({
42
- props: generateProps({ separator: '-' }),
43
- components: {
44
- GlIntersperse,
45
- },
46
- template,
47
- }))
48
- .add('custom last separator', () => ({
49
- props: generateProps({ lastSeparator: ' and ' }),
50
- components: {
51
- GlIntersperse,
22
+ const Template = (args, { argTypes }) => ({
23
+ components: {
24
+ GlIntersperse,
25
+ },
26
+ props: Object.keys(argTypes),
27
+ template,
28
+ });
29
+
30
+ export const Default = Template.bind({});
31
+ Default.args = generateProps();
32
+
33
+ export default {
34
+ title: 'utilities/intersperse',
35
+ component: GlIntersperse,
36
+ parameters: {
37
+ knobs: { disable: true },
38
+ docs: {
39
+ description: {
40
+ component: readme,
41
+ },
52
42
  },
53
- template,
54
- }));
43
+ },
44
+ };
45
+
46
+ export const CustomSeparator = Template.bind({});
47
+ CustomSeparator.args = generateProps({
48
+ separator: '-',
49
+ });
50
+
51
+ export const CustomLastSeparator = Template.bind({});
52
+ CustomLastSeparator.args = generateProps({
53
+ lastSeparator: ' and ',
54
+ });
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-avatar-labeled',{attrs:{"size":32,"src":"https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=64","label":"GitLab User","sub-label":"gitlab"}})};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;