@gitlab/ui 32.48.0 → 32.51.1

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 (84) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/base/form/form.documentation.js +1 -5
  3. package/dist/components/base/form/form_radio/form_radio.documentation.js +2 -33
  4. package/dist/components/base/form/form_radio/form_radio.js +15 -2
  5. package/dist/components/base/form/form_select/form_select.documentation.js +2 -17
  6. package/dist/components/base/keyset_pagination/keyset_pagination.documentation.js +2 -84
  7. package/dist/components/base/keyset_pagination/keyset_pagination.js +42 -0
  8. package/dist/components/base/modal/modal.documentation.js +2 -32
  9. package/dist/components/base/modal/modal.js +15 -1
  10. package/dist/utility_classes.css +1 -1
  11. package/dist/utility_classes.css.map +1 -1
  12. package/dist/utils/string_utils.js +6 -2
  13. package/documentation/documented_stories.js +5 -0
  14. package/package.json +5 -3
  15. package/scss_to_js/scss_variables.js +2 -0
  16. package/scss_to_js/scss_variables.json +10 -0
  17. package/src/components/base/form/form.documentation.js +0 -3
  18. package/src/components/base/form/form.stories.js +99 -14
  19. package/src/components/base/form/form_radio/form_radio.documentation.js +0 -31
  20. package/src/components/base/form/form_radio/form_radio.md +7 -14
  21. package/src/components/base/form/form_radio/form_radio.stories.js +40 -28
  22. package/src/components/base/form/form_radio/form_radio.vue +26 -1
  23. package/src/components/base/form/form_select/form_select.documentation.js +0 -19
  24. package/src/components/base/form/form_select/form_select.md +0 -2
  25. package/src/components/base/form/form_select/form_select.stories.js +98 -80
  26. package/src/components/base/keyset_pagination/keyset_pagination.documentation.js +0 -99
  27. package/src/components/base/keyset_pagination/keyset_pagination.md +0 -2
  28. package/src/components/base/keyset_pagination/keyset_pagination.stories.js +60 -58
  29. package/src/components/base/keyset_pagination/keyset_pagination.vue +35 -1
  30. package/src/components/base/modal/modal.documentation.js +0 -42
  31. package/src/components/base/modal/modal.md +2 -7
  32. package/src/components/base/modal/modal.stories.js +107 -85
  33. package/src/components/base/modal/modal.vue +73 -32
  34. package/src/scss/utilities.scss +16 -0
  35. package/src/scss/utility-mixins/sizing.scss +8 -0
  36. package/src/scss/variables.scss +2 -0
  37. package/src/utils/string_utils.js +6 -2
  38. package/src/utils/string_utils.spec.js +8 -0
  39. package/dist/components/base/form/examples/form.basic.example.js +0 -76
  40. package/dist/components/base/form/examples/form.edit.example.js +0 -66
  41. package/dist/components/base/form/examples/form.inline.example.js +0 -62
  42. package/dist/components/base/form/examples/form.novalidate.example.js +0 -61
  43. package/dist/components/base/form/examples/index.js +0 -27
  44. package/dist/components/base/form/form_radio/examples/form_radio.basic.example.js +0 -48
  45. package/dist/components/base/form/form_radio/examples/form_radio.checked_disabled.example.js +0 -48
  46. package/dist/components/base/form/form_radio/examples/index.js +0 -19
  47. package/dist/components/base/form/form_select/examples/form_select.basic.example.js +0 -55
  48. package/dist/components/base/form/form_select/examples/form_select.disabled.example.js +0 -55
  49. package/dist/components/base/form/form_select/examples/form_select.manual_options.example.js +0 -48
  50. package/dist/components/base/form/form_select/examples/form_select.mixed_options.example.js +0 -55
  51. package/dist/components/base/form/form_select/examples/index.js +0 -27
  52. package/dist/components/base/keyset_pagination/examples/index.js +0 -37
  53. package/dist/components/base/keyset_pagination/examples/keyset_pagination.basic.example.js +0 -51
  54. package/dist/components/base/keyset_pagination/examples/keyset_pagination.events.example.js +0 -64
  55. package/dist/components/base/keyset_pagination/examples/keyset_pagination.internationalization.example.js +0 -59
  56. package/dist/components/base/keyset_pagination/examples/keyset_pagination.links.example.js +0 -51
  57. package/dist/components/base/keyset_pagination/examples/keyset_pagination.slots.example.js +0 -51
  58. package/dist/components/base/modal/examples/index.js +0 -31
  59. package/dist/components/base/modal/examples/modal.basic.example.js +0 -62
  60. package/dist/components/base/modal/examples/modal.disabled.example.js +0 -89
  61. package/dist/components/base/modal/examples/modal.sizes.example.js +0 -62
  62. package/src/components/base/form/examples/form.basic.example.vue +0 -73
  63. package/src/components/base/form/examples/form.edit.example.vue +0 -37
  64. package/src/components/base/form/examples/form.inline.example.vue +0 -36
  65. package/src/components/base/form/examples/form.novalidate.example.vue +0 -30
  66. package/src/components/base/form/examples/index.js +0 -32
  67. package/src/components/base/form/form_radio/examples/form_radio.basic.example.vue +0 -16
  68. package/src/components/base/form/form_radio/examples/form_radio.checked_disabled.example.vue +0 -13
  69. package/src/components/base/form/form_radio/examples/index.js +0 -22
  70. package/src/components/base/form/form_select/examples/form_select.basic.example.vue +0 -17
  71. package/src/components/base/form/form_select/examples/form_select.disabled.example.vue +0 -17
  72. package/src/components/base/form/form_select/examples/form_select.manual_options.example.vue +0 -17
  73. package/src/components/base/form/form_select/examples/form_select.mixed_options.example.vue +0 -21
  74. package/src/components/base/form/form_select/examples/index.js +0 -32
  75. package/src/components/base/keyset_pagination/examples/index.js +0 -43
  76. package/src/components/base/keyset_pagination/examples/keyset_pagination.basic.example.vue +0 -16
  77. package/src/components/base/keyset_pagination/examples/keyset_pagination.events.example.vue +0 -29
  78. package/src/components/base/keyset_pagination/examples/keyset_pagination.internationalization.example.vue +0 -23
  79. package/src/components/base/keyset_pagination/examples/keyset_pagination.links.example.vue +0 -20
  80. package/src/components/base/keyset_pagination/examples/keyset_pagination.slots.example.vue +0 -23
  81. package/src/components/base/modal/examples/index.js +0 -39
  82. package/src/components/base/modal/examples/modal.basic.example.vue +0 -39
  83. package/src/components/base/modal/examples/modal.disabled.example.vue +0 -58
  84. package/src/components/base/modal/examples/modal.sizes.example.vue +0 -61
@@ -1,105 +1,6 @@
1
- import examples from './examples';
2
1
  import * as description from './keyset_pagination.md';
3
2
 
4
3
  export default {
5
4
  description,
6
5
  followsDesignSystem: true,
7
- bootstrapComponent: false,
8
- examples,
9
- propsInfo: {
10
- hasPreviousPage: {
11
- type: Boolean,
12
- required: false,
13
- default: false,
14
- additionalInfo: 'Whether or not the "Prev" button should be enabled',
15
- },
16
- hasNextPage: {
17
- type: Boolean,
18
- required: false,
19
- default: false,
20
- additionalInfo: 'Whether or not the "Next" button should be enabled',
21
- },
22
- startCursor: {
23
- type: String,
24
- required: false,
25
- default: null,
26
- additionalInfo:
27
- 'A cursor that points to the first item in the current page. Will be passed as an event parameter when the "prev" event is fired.',
28
- },
29
- endCursor: {
30
- type: String,
31
- required: false,
32
- default: null,
33
- additionalInfo:
34
- 'A cursor that points to the last item in the current page. Will be passed as an event parameter when the "next" event is fired.',
35
- },
36
-
37
- prevText: {
38
- type: String,
39
- required: false,
40
- default: 'Prev',
41
- additionalInfo:
42
- 'The text that will be rendered inside the "Prev" button. It\'s important to provide this parameter since the default text is not translatable.',
43
- },
44
- prevButtonLink: {
45
- type: String,
46
- required: false,
47
- default: null,
48
- additionalInfo:
49
- 'A link that will be used as the "Prev" button\'s "href" attribute. If provided, the "Prev" button renders as a link button; otherwise, it is rendered as a regular button.',
50
- },
51
- nextText: {
52
- type: String,
53
- required: false,
54
- default: 'Next',
55
- additionalInfo:
56
- 'The text that will be rendered inside the "Next" button. It\'s important to provide this parameter since the default text is not translatable.',
57
- },
58
- nextButtonLink: {
59
- type: String,
60
- required: false,
61
- default: null,
62
- additionalInfo:
63
- 'A link that will be used as the "Next" button\'s "href" attribute. If provided, the "Next" button renders as a link button; otherwise, it is rendered as a regular button.',
64
- },
65
- disabled: {
66
- type: Boolean,
67
- required: false,
68
- default: false,
69
- additionalInfo:
70
- 'Whether or not both buttons should be disabled (regardless of the "hasPreviousPage" and "hasNextPage" values).',
71
- },
72
- },
73
- events: [
74
- {
75
- event: 'prev',
76
- description: 'Emitted when the "Prev" button is clicked',
77
- args: [
78
- {
79
- arg: 'startCursor',
80
- description: 'A cursor that points to the first item in the current page.',
81
- },
82
- ],
83
- },
84
- {
85
- event: 'next',
86
- description: 'Emitted when the "Next" button is clicked',
87
- args: [
88
- {
89
- arg: 'endCursor',
90
- description: 'A cursor that points to the last item in the current page',
91
- },
92
- ],
93
- },
94
- ],
95
- slots: [
96
- {
97
- name: 'previous-button-content',
98
- description: 'Used to customize the appearance of the "Prev" button',
99
- },
100
- {
101
- name: 'next-button-content',
102
- description: 'Used to customize the appearance of the "Next" button',
103
- },
104
- ],
105
6
  };
@@ -1,5 +1,3 @@
1
- # Keyset Pagination
2
-
3
1
  Pagination is used to help users parse a large number of items on a page,
4
2
  whenever there are too many results to show at once. Pagination breaks up
5
3
  results into several pages with controls for navigating forward and backward, or
@@ -1,65 +1,67 @@
1
- import { withKnobs, boolean, text } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
1
  import readme from './keyset_pagination.md';
4
2
  import GlKeysetPagination from './keyset_pagination.vue';
5
3
 
6
- const components = {
7
- GlKeysetPagination,
8
- };
4
+ const generateProps = ({
5
+ hasPreviousPage = false,
6
+ hasNextPage = true,
7
+ startCursor = 'eyJpZCI6IjE3NTg1ODciLCJyZWxlYXNlZF9hdCI6IjIwMjAtMDgtMjAgMTQ6NDc6MDguNTQ1MjE1MDAwIFVUQyJ9',
8
+ endCursor = 'eyJpZCI6IjEyNjcxNzkiLCJyZWxlYXNlZF9hdCI6IjIwMjAtMDItMTkgMjE6MDA6MDUuODU5NTQ2MDAwIFVUQyJ9',
9
+ prevText = 'Prev',
10
+ nextText = 'Next',
11
+ prevButtonLink = '',
12
+ nextButtonLink = '',
13
+ disabled = false,
14
+ } = {}) => ({
15
+ hasPreviousPage,
16
+ hasNextPage,
17
+ startCursor,
18
+ endCursor,
19
+ prevText,
20
+ nextText,
21
+ prevButtonLink,
22
+ nextButtonLink,
23
+ disabled,
24
+ });
9
25
 
10
- function generateProps() {
11
- return {
12
- hasPreviousPage: {
13
- type: Boolean,
14
- default: boolean('hasPreviousPage', false),
15
- },
16
- hasNextPage: {
17
- type: Boolean,
18
- default: boolean('hasNextPage', true),
19
- },
20
- startCursor: {
21
- type: String,
22
- default: text(
23
- 'startCursor',
24
- 'eyJpZCI6IjE3NTg1ODciLCJyZWxlYXNlZF9hdCI6IjIwMjAtMDgtMjAgMTQ6NDc6MDguNTQ1MjE1MDAwIFVUQyJ9'
25
- ),
26
- },
27
- endCursor: {
28
- type: String,
29
- default: text(
30
- 'endCursor',
31
- 'eyJpZCI6IjEyNjcxNzkiLCJyZWxlYXNlZF9hdCI6IjIwMjAtMDItMTkgMjE6MDA6MDUuODU5NTQ2MDAwIFVUQyJ9'
32
- ),
33
- },
34
- prevText: {
35
- type: String,
36
- default: text('prevText'),
37
- },
38
- nextText: {
39
- type: String,
40
- default: text('nextText'),
41
- },
42
- prevButtonLink: {
43
- type: String,
44
- default: text('prevButtonLink'),
45
- },
46
- nextButtonLink: {
47
- type: String,
48
- default: text('nextButtonLink'),
26
+ const Template = (args, { argTypes }) => ({
27
+ components: { GlKeysetPagination },
28
+ props: Object.keys(argTypes),
29
+ template: `
30
+ <gl-keyset-pagination v-bind="$props"/>
31
+ `,
32
+ });
33
+
34
+ /* eslint-disable no-alert */
35
+ export const Events = (args, { argTypes }) => ({
36
+ components: { GlKeysetPagination },
37
+ props: Object.keys(argTypes),
38
+ methods: {
39
+ onPrev(startCursor) {
40
+ alert(`"prev" event fired with start cursor: "${startCursor}"`);
49
41
  },
50
- disabled: {
51
- type: Boolean,
52
- default: boolean('disabled', false),
42
+ onNext(endCursor) {
43
+ alert(`"next" event fired with end cursor: "${endCursor}"`);
53
44
  },
54
- };
55
- }
56
-
57
- documentedStoriesOf('base/keyset-pagination', readme)
58
- .addDecorator(withKnobs)
59
- .add('default', () => ({
60
- components,
61
- props: generateProps(),
62
- template: `
63
- <gl-keyset-pagination v-bind="$props"/>
45
+ },
46
+ template: `
47
+ <gl-keyset-pagination v-bind="$props" @prev="onPrev($event)" @next="onNext($event)" />
64
48
  `,
65
- }));
49
+ });
50
+ Events.args = generateProps({ hasPreviousPage: true });
51
+
52
+ export const Default = Template.bind({});
53
+ Default.args = generateProps();
54
+
55
+ export default {
56
+ title: 'base/keyset-pagination',
57
+ component: GlKeysetPagination,
58
+ parameters: {
59
+ bootstrapComponent: false,
60
+ knobs: { disable: true },
61
+ docs: {
62
+ description: {
63
+ component: readme,
64
+ },
65
+ },
66
+ },
67
+ };
@@ -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
+ };