@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
@@ -16,47 +16,79 @@ export default {
16
16
  // GraphQL type, allowing the returned `pageInfo` object to
17
17
  // be bound directly to this component:
18
18
  // `<gl-keyset-pagination v-bind="pageInfo">`
19
+ /**
20
+ * Whether or not the "Prev" button should be enabled
21
+ */
19
22
  hasPreviousPage: {
20
23
  type: Boolean,
21
24
  required: false,
22
25
  default: false,
23
26
  },
27
+ /**
28
+ * Whether or not the "Next" button should be enabled
29
+ */
24
30
  hasNextPage: {
25
31
  type: Boolean,
26
32
  required: false,
27
33
  default: false,
28
34
  },
35
+ /**
36
+ * A cursor that points to the first item in the current page.
37
+ * Will be passed as an event parameter when the "prev" event is fired.
38
+ */
29
39
  startCursor: {
30
40
  type: String,
31
41
  required: false,
32
42
  default: null,
33
43
  },
44
+ /**
45
+ * A cursor that points to the last item in the current page.
46
+ * Will be passed as an event parameter when the "next" event is fired.
47
+ */
34
48
  endCursor: {
35
49
  type: String,
36
50
  required: false,
37
51
  default: null,
38
52
  },
39
-
53
+ /**
54
+ * The text that will be rendered inside the "Prev" button.
55
+ * It\'s important to provide this parameter since the default text is not translatable.
56
+ */
40
57
  prevText: {
41
58
  type: String,
42
59
  required: false,
43
60
  default: 'Prev',
44
61
  },
62
+ /**
63
+ * A link that will be used as the "Prev" button\'s "href" attribute.
64
+ * If provided, the "Prev" button renders as a link button; otherwise, it is rendered as a regular button.
65
+ */
45
66
  prevButtonLink: {
46
67
  type: String,
47
68
  required: false,
48
69
  default: null,
49
70
  },
71
+ /**
72
+ * The text that will be rendered inside the "Next" button.
73
+ * It\'s important to provide this parameter since the default text is not translatable.
74
+ */
50
75
  nextText: {
51
76
  type: String,
52
77
  required: false,
53
78
  default: 'Next',
54
79
  },
80
+ /**
81
+ * A link that will be used as the "Next" button\'s "href" attribute.
82
+ * If provided, the "Next" button renders as a link button; otherwise, it is rendered as a regular button.
83
+ */
55
84
  nextButtonLink: {
56
85
  type: String,
57
86
  required: false,
58
87
  default: null,
59
88
  },
89
+ /**
90
+ * Whether or not both buttons should be disabled (regardless of the "hasPreviousPage" and "hasNextPage" values).
91
+ */
60
92
  disabled: {
61
93
  type: Boolean,
62
94
  required: false,
@@ -74,6 +106,7 @@ export default {
74
106
  data-testid="prevButton"
75
107
  @click="$emit('prev', startCursor)"
76
108
  >
109
+ <!-- @slot Used to customize the appearance of the "Prev" button -->
77
110
  <slot name="previous-button-content">
78
111
  <div class="gl-display-flex gl-align-center">
79
112
  <gl-icon name="chevron-left" />
@@ -87,6 +120,7 @@ export default {
87
120
  data-testid="nextButton"
88
121
  @click="$emit('next', endCursor)"
89
122
  >
123
+ <!-- @slot Used to customize the appearance of the "Next" button -->
90
124
  <slot name="next-button-content">
91
125
  <div class="gl-display-flex gl-align-center">
92
126
  {{ nextText }}
@@ -1,48 +1,6 @@
1
- import examples from './examples';
2
1
  import description from './modal.md';
3
2
 
4
3
  export default {
5
- bootstrapComponent: 'b-modal',
6
4
  followsDesignSystem: true,
7
5
  description,
8
- examples,
9
- slots: [
10
- {
11
- name: 'modal-header',
12
- description:
13
- 'Entire modal header container contents (including the close button on the top right corner)',
14
- },
15
- {
16
- name: 'modal-title',
17
- description: 'Modal title. If modal-header slot is used, this slot will not be shown.',
18
- },
19
- {
20
- name: 'modal-header-close',
21
- description:
22
- 'Content of Modal header close button. If modal-header slot is used, this slot will not be shown.',
23
- },
24
- {
25
- name: 'modal-footer',
26
- description:
27
- 'Populated via props: modal-action-primary, modal-action-cancel and modal-action-secondary.',
28
- },
29
- ],
30
- events: [
31
- {
32
- event: '@primary',
33
- description: 'Emitted when clicked on modal-action-primary',
34
- },
35
- {
36
- event: '@secondary',
37
- description: 'Emitted when clicked on modal-action-secondary',
38
- },
39
- {
40
- event: '@canceled',
41
- description: 'Emitted when clicked on modal-action-cancel',
42
- },
43
- {
44
- event: '@change',
45
- description: 'Emitted when the modal visibility changes',
46
- },
47
- ],
48
6
  };
@@ -1,8 +1,3 @@
1
- # Modal
2
-
3
- <!-- STORY -->
4
- ## Usage
5
-
6
1
  Modals are used to reveal critical information, show information without losing context, or when the
7
2
  system requires a user response. Modals can also fragment a complex workflow into simpler steps and
8
3
  should serve a single purpose dedicated to completing the user’s task.
@@ -22,7 +17,7 @@ The `modal-footer` slot should only be populated via props: `action-primary`, `a
22
17
  `action-cancel`. These props allow you to handle how a primary, secondary and cancel button will
23
18
  behave in the modals footer. The props receive an object as such:
24
19
 
25
- ~~~js
20
+ ```js
26
21
  {
27
22
  text: 'Save Changes',
28
23
  attributes: [
@@ -32,4 +27,4 @@ behave in the modals footer. The props receive an object as such:
32
27
  ...
33
28
  ]
34
29
  }
35
- ~~~
30
+ ```
@@ -1,19 +1,8 @@
1
- import { withKnobs, select, number, boolean } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
1
  import { GlModal, GlModalDirective, GlButton } from '../../../../index';
4
2
  import { variantOptionsWithNoDefault } from '../../../utils/constants';
5
3
  import readme from './modal.md';
6
4
 
7
- const components = {
8
- GlModal,
9
- GlButton,
10
- };
11
-
12
- const directives = {
13
- GlModalDirective,
14
- };
15
-
16
- function generateTemplate({ props = {}, slots = {} } = {}) {
5
+ const generateTemplate = ({ props = {}, slots = {} } = {}) => {
17
6
  const extraProps = Object.entries(props)
18
7
  .map(([key, value]) => `:${key}="${value}"`)
19
8
  .join('\n ');
@@ -51,97 +40,130 @@ function generateTemplate({ props = {}, slots = {} } = {}) {
51
40
  </gl-modal>
52
41
  </div>
53
42
  `;
54
- }
43
+ };
44
+
45
+ const Template = (args, { argTypes }) => ({
46
+ components: { GlModal, GlButton },
47
+ directives: { GlModalDirective },
48
+ props: Object.keys(argTypes),
49
+ template: generateTemplate(),
50
+ });
55
51
 
56
- function generateProps({
52
+ const generateProps = ({
57
53
  variant = variantOptionsWithNoDefault.default,
58
54
  contentPagraphs = 1,
59
55
  scrollable = false,
60
56
  visible = false,
61
- } = {}) {
62
- return {
57
+ } = {}) => ({
58
+ headerBgVariant: variant,
59
+ headerBorderVariant: variant,
60
+ headerTextVariant: variant,
61
+ bodyBgVariant: variant,
62
+ bodyTextVariant: variant,
63
+ footerBgVariant: variant,
64
+ footerBorderVariant: variant,
65
+ footerTextVariant: variant,
66
+ contentParagraphs: contentPagraphs,
67
+ scrollable,
68
+ visible,
69
+ });
70
+
71
+ export const Default = Template.bind({});
72
+ Default.args = generateProps();
73
+
74
+ export const OpenedModal = Template.bind({});
75
+ OpenedModal.args = generateProps({ visible: true });
76
+
77
+ export const WithScrollingContent = Template.bind({});
78
+ WithScrollingContent.args = generateProps({
79
+ contentPagraphs: 100,
80
+ scrollable: true,
81
+ visible: true,
82
+ });
83
+
84
+ export const WithAHeader = (args, { argTypes }) => ({
85
+ components: { GlModal, GlButton },
86
+ directives: { GlModalDirective },
87
+ props: Object.keys(argTypes),
88
+ template: generateTemplate({
89
+ slots: {
90
+ 'modal-header': '<h4>A custom header</h4>',
91
+ },
92
+ }),
93
+ });
94
+ WithAHeader.args = generateProps({ visible: true });
95
+
96
+ export const WithoutAFooter = (args, { argTypes }) => ({
97
+ components: { GlModal, GlButton },
98
+ directives: { GlModalDirective },
99
+ props: Object.keys(argTypes),
100
+ template: generateTemplate({
101
+ props: { 'hide-footer': true },
102
+ }),
103
+ });
104
+ WithoutAFooter.args = generateProps({ visible: true });
105
+
106
+ export default {
107
+ title: 'base/modal',
108
+ components: { GlModal, GlButton },
109
+ directives: { GlModalDirective },
110
+ bootstrapComponent: 'b-modal',
111
+ parameters: {
112
+ knobs: { disable: true },
113
+ docs: {
114
+ description: {
115
+ component: readme,
116
+ },
117
+ },
118
+ },
119
+ argTypes: {
63
120
  headerBgVariant: {
64
- type: String,
65
- default: select('header bg', variantOptionsWithNoDefault, variant),
121
+ control: {
122
+ type: 'select',
123
+ options: variantOptionsWithNoDefault,
124
+ },
66
125
  },
67
126
  headerBorderVariant: {
68
- type: String,
69
- default: select('header border', variantOptionsWithNoDefault, variant),
127
+ control: {
128
+ type: 'select',
129
+ options: variantOptionsWithNoDefault,
130
+ },
70
131
  },
71
132
  headerTextVariant: {
72
- type: String,
73
- default: select('header text', variantOptionsWithNoDefault, variant),
133
+ control: {
134
+ type: 'select',
135
+ options: variantOptionsWithNoDefault,
136
+ },
74
137
  },
75
138
  bodyBgVariant: {
76
- type: String,
77
- default: select('body bg', variantOptionsWithNoDefault, variant),
139
+ control: {
140
+ type: 'select',
141
+ options: variantOptionsWithNoDefault,
142
+ },
78
143
  },
79
144
  bodyTextVariant: {
80
- type: String,
81
- default: select('body text', variantOptionsWithNoDefault, variant),
145
+ control: {
146
+ type: 'select',
147
+ options: variantOptionsWithNoDefault,
148
+ },
82
149
  },
83
150
  footerBgVariant: {
84
- type: String,
85
- default: select('footer bg', variantOptionsWithNoDefault, variant),
151
+ control: {
152
+ type: 'select',
153
+ options: variantOptionsWithNoDefault,
154
+ },
86
155
  },
87
156
  footerBorderVariant: {
88
- type: String,
89
- default: select('footer border', variantOptionsWithNoDefault, variant),
157
+ control: {
158
+ type: 'select',
159
+ options: variantOptionsWithNoDefault,
160
+ },
90
161
  },
91
162
  footerTextVariant: {
92
- type: String,
93
- default: select('footer text', variantOptionsWithNoDefault, variant),
94
- },
95
- contentParagraphs: {
96
- type: Number,
97
- default: number('content paragraphs', contentPagraphs),
98
- },
99
- scrollable: {
100
- type: Boolean,
101
- default: boolean('scrollable', scrollable),
102
- },
103
- visible: {
104
- type: Boolean,
105
- default: visible,
106
- },
107
- };
108
- }
109
-
110
- documentedStoriesOf('base/modal', readme)
111
- .addDecorator(withKnobs)
112
- .add('default', () => ({
113
- props: generateProps(),
114
- components,
115
- directives,
116
- template: generateTemplate(),
117
- }))
118
- .add('opened modal', () => ({
119
- props: generateProps({ visible: true }),
120
- components,
121
- directives,
122
- template: generateTemplate(),
123
- }))
124
- .add('with scrolling content', () => ({
125
- props: generateProps({ contentPagraphs: 100, scrollable: true, visible: true }),
126
- components,
127
- directives,
128
- template: generateTemplate(),
129
- }))
130
- .add('with a header', () => ({
131
- props: generateProps({ visible: true }),
132
- components,
133
- directives,
134
- template: generateTemplate({
135
- slots: {
136
- 'modal-header': '<h4>A custom header</h4>',
163
+ control: {
164
+ type: 'select',
165
+ options: variantOptionsWithNoDefault,
137
166
  },
138
- }),
139
- }))
140
- .add('without a footer', () => ({
141
- props: generateProps({ visible: true }),
142
- components,
143
- directives,
144
- template: generateTemplate({
145
- props: { 'hide-footer': true },
146
- }),
147
- }));
167
+ },
168
+ },
169
+ };
@@ -139,6 +139,10 @@ export default {
139
139
  </script>
140
140
 
141
141
  <template>
142
+ <!--
143
+ Emitted when the modal visibility changes
144
+ @event change
145
+ -->
142
146
  <b-modal
143
147
  :id="modalId"
144
148
  ref="modal"
@@ -156,19 +160,27 @@ export default {
156
160
  >
157
161
  <slot></slot>
158
162
  <template #modal-header>
163
+ <!-- @slot Entire modal header container contents (including the close button on the top right corner) -->
159
164
  <slot name="modal-header">
160
165
  <h4 class="modal-title">
166
+ <!-- @slot Modal title. If modal-header slot is used, this slot will not be shown. -->
161
167
  <slot name="modal-title">{{ title }}</slot>
162
168
  </h4>
163
169
  </slot>
170
+ <!-- @slot Content of Modal header close button. If modal-header slot is used, this slot will not be shown. -->
164
171
  <close-button ref="close-button" :label="dismissLabel" @click="close" />
165
172
  </template>
166
173
  <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
167
174
  <slot slot="modal-ok" name="modal-ok"></slot>
168
175
  <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
169
176
  <slot slot="modal-cancel" name="modal-cancel"></slot>
177
+ <!-- @slot Populated via props: modal-action-primary, modal-action-cancel and modal-action-secondary. -->
170
178
  <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
171
179
  <slot slot="modal-footer" name="modal-footer">
180
+ <!--
181
+ Emitted when clicked on modal-action-cancel
182
+ @event canceled
183
+ -->
172
184
  <gl-button
173
185
  v-if="actionCancel"
174
186
  class="js-modal-action-cancel"
@@ -177,6 +189,10 @@ export default {
177
189
  >
178
190
  {{ actionCancel.text }}
179
191
  </gl-button>
192
+ <!--
193
+ Emitted when clicked on modal-action-secondary
194
+ @event secondary
195
+ -->
180
196
  <gl-button
181
197
  v-if="actionSecondary"
182
198
  class="js-modal-action-secondary"
@@ -185,6 +201,10 @@ export default {
185
201
  >
186
202
  {{ actionSecondary.text }}
187
203
  </gl-button>
204
+ <!--
205
+ Emitted when clicked on modal-action-primary
206
+ @event primary
207
+ -->
188
208
  <gl-button
189
209
  v-if="actionPrimary"
190
210
  class="js-modal-action-primary"
@@ -1,8 +1,3 @@
1
- import description from './discrete_scatter.md';
2
- import examples from './examples';
3
-
4
1
  export default {
5
2
  followsDesignSystem: true,
6
- description,
7
- examples,
8
3
  };
@@ -1,13 +1,9 @@
1
- import { withKnobs, object, text } from '@storybook/addon-knobs';
2
1
  import { GlDiscreteScatterChart } from '../../../../charts';
3
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
4
- import readme from './discrete_scatter.md';
5
2
 
6
- const components = {
7
- GlDiscreteScatterChart,
8
- };
9
-
10
- const template = `
3
+ const Template = (args, { argTypes }) => ({
4
+ components: { GlDiscreteScatterChart },
5
+ props: Object.keys(argTypes),
6
+ template: `
11
7
  <gl-discrete-scatter-chart
12
8
  :data="data"
13
9
  :option="option"
@@ -15,9 +11,10 @@ const template = `
15
11
  :x-axis-title="xAxisTitle"
16
12
  data-testid="discrete-scatter-chart"
17
13
  />
18
- `;
14
+ `,
15
+ });
19
16
 
20
- function generateProps({
17
+ const generateProps = ({
21
18
  data = [
22
19
  {
23
20
  type: 'scatter',
@@ -35,41 +32,32 @@ function generateProps({
35
32
  option = {},
36
33
  yAxisTitle = 'Pushes per day',
37
34
  xAxisTitle = 'Date',
38
- } = {}) {
39
- return {
40
- data: {
41
- default: object('Chart Data', data),
42
- },
43
- option: {
44
- default: object('EChart Options', option),
45
- },
46
- yAxisTitle: {
47
- default: text('Y Axis Title', yAxisTitle),
48
- },
49
- xAxisTitle: {
50
- default: text('X Axis Title', xAxisTitle),
51
- },
52
- };
53
- }
35
+ } = {}) => ({
36
+ data,
37
+ option,
38
+ yAxisTitle,
39
+ xAxisTitle,
40
+ });
41
+
42
+ export const Default = Template.bind({});
43
+ Default.args = generateProps();
54
44
 
55
- documentedStoriesOf('charts/discrete-scatter-chart', readme)
56
- .addDecorator(withKnobs)
57
- .add('default', () => ({
58
- props: generateProps(),
59
- components,
60
- template,
61
- }))
62
- .add('with zoom and scroll', () => ({
63
- props: generateProps({
64
- option: {
65
- dataZoom: [
66
- {
67
- type: 'slider',
68
- startValue: 1,
69
- },
70
- ],
45
+ export const WithZoomAndScroll = Template.bind({});
46
+ WithZoomAndScroll.args = generateProps({
47
+ option: {
48
+ dataZoom: [
49
+ {
50
+ type: 'slider',
51
+ startValue: 1,
71
52
  },
72
- }),
73
- components,
74
- template,
75
- }));
53
+ ],
54
+ },
55
+ });
56
+
57
+ export default {
58
+ title: 'charts/discrete-scatter-chart',
59
+ component: GlDiscreteScatterChart,
60
+ parameters: {
61
+ knobs: { disable: true },
62
+ },
63
+ };
@@ -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