@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
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## [32.51.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.51.0...v32.51.1) (2022-01-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **Avatar:** Add support for multiple-character emojis ([f3fcb2f](https://gitlab.com/gitlab-org/gitlab-ui/commit/f3fcb2ff5a2e74f77b3a96dc8922a3821c86e2fa))
7
+
8
+ # [32.51.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.50.0...v32.51.0) (2021-12-29)
9
+
10
+
11
+ ### Features
12
+
13
+ * **css:** Added gl-max-w-26 and gl-max-w-62 classes ([69a6829](https://gitlab.com/gitlab-org/gitlab-ui/commit/69a6829bbcaa5dc821a4fa29c4f3ec79e4b7aa5e))
14
+
15
+ # [32.50.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.49.0...v32.50.0) (2021-12-16)
16
+
17
+
18
+ ### Features
19
+
20
+ * Add support for @gitlab/svgs@2 peer dependency ([77076b7](https://gitlab.com/gitlab-org/gitlab-ui/commit/77076b7d717f4245a29df115113c96d72b002540))
21
+
22
+ # [32.49.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.48.0...v32.49.0) (2021-12-15)
23
+
24
+
25
+ ### Features
26
+
27
+ * **GlKeysetPagination:** Migrate storybook story ([b78abe6](https://gitlab.com/gitlab-org/gitlab-ui/commit/b78abe68d2c86c973af50ee20754e5b2be163f25))
28
+
1
29
  # [32.48.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.47.0...v32.48.0) (2021-12-13)
2
30
 
3
31
 
@@ -1,11 +1,7 @@
1
- import examples from './examples';
2
-
3
1
  var description = "A wrapper element for `gl-form-*` input elements. Supports `@submit` and `@reset` events, as well as\ncontrolling validation settings for form inputs.\n";
4
2
 
5
3
  var form_documentation = {
6
- description,
7
- examples,
8
- bootstrapComponent: 'b-form'
4
+ description
9
5
  };
10
6
 
11
7
  export default form_documentation;
@@ -1,39 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "# GlFormRadio\n\nA radio button typically represents a single option in a group of related\nchoices. Each radio button is boolean and only one can be selected at a time.\n\n## Usage\n\n`GlFormRadio` components can be used directly, or via a `GlFormRadioGroup`.\n\nBelow is an example which demonstrates the direct approach. For examples using\n`GlFormRadioGroup`, see the documentation for that component.\n\n```html\n<script>\nexport default {\n data() {\n return {\n selected: 'yes',\n };\n },\n};\n</script>\n\n<template>\n <div>\n <gl-form-radio v-model=\"selected\" value=\"yes\">Yes</gl-form-radio>\n <gl-form-radio v-model=\"selected\" value=\"no\">No</gl-form-radio>\n </div>\n</template>\n```\n";
1
+ var description = "`GlFormRadio` components can be used directly, or via a `GlFormRadioGroup`.\n\nBelow is an example which demonstrates the direct approach. For examples using\n`GlFormRadioGroup`, see the documentation for that component.\n\n```html\n<script>\n export default {\n data() {\n return {\n selected: 'yes',\n };\n },\n };\n</script>\n\n<template>\n <div>\n <gl-form-radio v-model=\"selected\" value=\"yes\">Yes</gl-form-radio>\n <gl-form-radio v-model=\"selected\" value=\"no\">No</gl-form-radio>\n </div>\n</template>\n```\n";
4
2
 
5
3
  var form_radio_documentation = {
6
4
  description,
7
- examples,
8
- followsDesignSystem: true,
9
- bootstrapComponent: 'b-form-radio',
10
- propsInfo: {
11
- checked: {
12
- additionalInfo: 'The current value of the radio(s)'
13
- }
14
- },
15
- events: [{
16
- event: 'input',
17
- args: [{
18
- arg: 'checked',
19
- description: 'current selected value of radio group'
20
- }],
21
- description: 'Emitted when the selected value is changed'
22
- }, {
23
- event: 'change',
24
- args: [{
25
- arg: 'checked',
26
- description: 'current selected value of radio group'
27
- }],
28
- description: 'Emitted when the selected value is changed due to user interaction'
29
- }],
30
- slots: [{
31
- name: 'help',
32
- description: 'Content provided here will be shown beneath the radio. Typically used for help or descriptive text.'
33
- }, {
34
- name: 'default',
35
- description: 'Content to use for the label'
36
- }]
5
+ followsDesignSystem: true
37
6
  };
38
7
 
39
8
  export default form_radio_documentation;
@@ -10,14 +10,27 @@ var script = {
10
10
  BFormRadio
11
11
  },
12
12
  inheritAttrs: false,
13
- model
13
+ model: {
14
+ prop: model.prop,
15
+ event: model.event
16
+ },
17
+ props: {
18
+ /**
19
+ * Whether the radio is checked
20
+ */
21
+ checked: {
22
+ type: [String, Number, Boolean, Object],
23
+ required: false,
24
+ default: false
25
+ }
26
+ }
14
27
  };
15
28
 
16
29
  /* script */
17
30
  const __vue_script__ = script;
18
31
 
19
32
  /* template */
20
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-form-radio',_vm._g(_vm._b({staticClass:"gl-form-radio",on:{"input":function($event){return _vm.$emit('input', $event)},"change":function($event){return _vm.$emit('change', $event)}}},'b-form-radio',_vm.$attrs,false),_vm.$listeners),[_vm._t("default"),_vm._v(" "),(_vm.$scopedSlots.help)?_c('p',{staticClass:"help-text"},[_vm._t("help")],2):_vm._e()],2)};
33
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-form-radio',_vm._g(_vm._b({staticClass:"gl-form-radio",attrs:{"checked":_vm.checked},on:{"input":function($event){return _vm.$emit('input', $event)},"change":function($event){return _vm.$emit('change', $event)}}},'b-form-radio',_vm.$attrs,false),_vm.$listeners),[_vm._t("default"),_vm._v(" "),(_vm.$scopedSlots.help)?_c('p',{staticClass:"help-text"},[_vm._t("help")],2):_vm._e()],2)};
21
34
  var __vue_staticRenderFns__ = [];
22
35
 
23
36
  /* style */
@@ -1,23 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "# Form Select\n\nForm select component used to select from group of options in a form.\n";
1
+ var description = "Form select component used to select from group of options in a form.\n";
4
2
 
5
3
  var form_select_documentation = {
6
4
  description,
7
- examples,
8
- followDesignSystem: true,
9
- bootstrapComponent: 'b-form-select',
10
- events: [{
11
- event: 'change',
12
- description: 'Emitted with the select value changes via user interaction.'
13
- }, {
14
- event: 'input',
15
- description: 'Emitted with the select value changes.'
16
- }],
17
- slots: [{
18
- name: 'first',
19
- description: 'Slot to place option tags above options provided via options prop'
20
- }]
5
+ followDesignSystem: true
21
6
  };
22
7
 
23
8
  export default form_select_documentation;
@@ -1,6 +1,4 @@
1
- import examples from './examples';
2
-
3
- var keyset_pagination = "# Keyset Pagination\n\nPagination is used to help users parse a large number of items on a page,\nwhenever there are too many results to show at once. Pagination breaks up\nresults into several pages with controls for navigating forward and backward, or\nto a specific page.\n\n## Usage\n\nThe simplest way to use `GlKeysetPagination` with a paginated GraphQL response\nis to `v-bind` to the\n[`PageInfo`](https://docs.gitlab.com/ee/api/graphql/reference/#pageinfo) type\nreturned by the endpoint:\n\n```html\n<gl-keyset-pagination v-bind=\"pageInfo\" />\n```\n\nThis is possible because the default field names of the `PageInfo` type align\nwith the `props` of this component.\n\n## Dos and don'ts\n\n**✅ Do** provide the `prevText` and `nextText` props with translatable strings.\nThe default strings (\"Prev\" and \"Next\") are hardcoded in this component and\ncan't be translated.\n\nExample:\n\n```html\n<gl-keyset-pagination v-bind=\"pageInfo\" :prev-text=\"__('Prev')\" :next-text=\"__('Next')\" />\n```\n\n**✅ Do** use this component for paginating GraphQL requests<sup>1</sup> (or any\nendpoint that uses keyset pagination).\n\n**❌ Don't** use this component for paginating REST requests<sup>1</sup> (or any\nendpoint that uses offset pagination).\n\nFor offset pagination, use the [`GlPagination`\ncomponent](/?path=/story/base-pagination--default) instead.\n\nFor more information on the difference between offset and keyset pagination see\n[our documentation on GraphQL\npagination](https://docs.gitlab.com/ee/development/graphql_guide/pagination.html).\n\n<small><sup>1</sup>There's no intrinsic reason why GraphQL endpoints can't\nsupport offset pagination (in fact, [the official\ndocumentation](https://graphql.org/learn/pagination/#pagination-and-edges) shows\nan example offset pagination implementation) or why REST endpoints can't support\nkeyset pagination. This is simply how we've chosen to implement our REST and\nGraphQL endpoints at GitLab.</small>\n\n## Pajamas reference\n\n<https://design.gitlab.com/components/pagination>\n";
1
+ var keyset_pagination = "Pagination is used to help users parse a large number of items on a page,\nwhenever there are too many results to show at once. Pagination breaks up\nresults into several pages with controls for navigating forward and backward, or\nto a specific page.\n\n## Usage\n\nThe simplest way to use `GlKeysetPagination` with a paginated GraphQL response\nis to `v-bind` to the\n[`PageInfo`](https://docs.gitlab.com/ee/api/graphql/reference/#pageinfo) type\nreturned by the endpoint:\n\n```html\n<gl-keyset-pagination v-bind=\"pageInfo\" />\n```\n\nThis is possible because the default field names of the `PageInfo` type align\nwith the `props` of this component.\n\n## Dos and don'ts\n\n**✅ Do** provide the `prevText` and `nextText` props with translatable strings.\nThe default strings (\"Prev\" and \"Next\") are hardcoded in this component and\ncan't be translated.\n\nExample:\n\n```html\n<gl-keyset-pagination v-bind=\"pageInfo\" :prev-text=\"__('Prev')\" :next-text=\"__('Next')\" />\n```\n\n**✅ Do** use this component for paginating GraphQL requests<sup>1</sup> (or any\nendpoint that uses keyset pagination).\n\n**❌ Don't** use this component for paginating REST requests<sup>1</sup> (or any\nendpoint that uses offset pagination).\n\nFor offset pagination, use the [`GlPagination`\ncomponent](/?path=/story/base-pagination--default) instead.\n\nFor more information on the difference between offset and keyset pagination see\n[our documentation on GraphQL\npagination](https://docs.gitlab.com/ee/development/graphql_guide/pagination.html).\n\n<small><sup>1</sup>There's no intrinsic reason why GraphQL endpoints can't\nsupport offset pagination (in fact, [the official\ndocumentation](https://graphql.org/learn/pagination/#pagination-and-edges) shows\nan example offset pagination implementation) or why REST endpoints can't support\nkeyset pagination. This is simply how we've chosen to implement our REST and\nGraphQL endpoints at GitLab.</small>\n\n## Pajamas reference\n\n<https://design.gitlab.com/components/pagination>\n";
4
2
 
5
3
  var description = /*#__PURE__*/Object.freeze({
6
4
  __proto__: null,
@@ -9,87 +7,7 @@ var description = /*#__PURE__*/Object.freeze({
9
7
 
10
8
  var keyset_pagination_documentation = {
11
9
  description,
12
- followsDesignSystem: true,
13
- bootstrapComponent: false,
14
- examples,
15
- propsInfo: {
16
- hasPreviousPage: {
17
- type: Boolean,
18
- required: false,
19
- default: false,
20
- additionalInfo: 'Whether or not the "Prev" button should be enabled'
21
- },
22
- hasNextPage: {
23
- type: Boolean,
24
- required: false,
25
- default: false,
26
- additionalInfo: 'Whether or not the "Next" button should be enabled'
27
- },
28
- startCursor: {
29
- type: String,
30
- required: false,
31
- default: null,
32
- additionalInfo: '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.'
33
- },
34
- endCursor: {
35
- type: String,
36
- required: false,
37
- default: null,
38
- additionalInfo: '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.'
39
- },
40
- prevText: {
41
- type: String,
42
- required: false,
43
- default: 'Prev',
44
- additionalInfo: 'The text that will be rendered inside the "Prev" button. It\'s important to provide this parameter since the default text is not translatable.'
45
- },
46
- prevButtonLink: {
47
- type: String,
48
- required: false,
49
- default: null,
50
- additionalInfo: '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.'
51
- },
52
- nextText: {
53
- type: String,
54
- required: false,
55
- default: 'Next',
56
- additionalInfo: '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: '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.'
63
- },
64
- disabled: {
65
- type: Boolean,
66
- required: false,
67
- default: false,
68
- additionalInfo: 'Whether or not both buttons should be disabled (regardless of the "hasPreviousPage" and "hasNextPage" values).'
69
- }
70
- },
71
- events: [{
72
- event: 'prev',
73
- description: 'Emitted when the "Prev" button is clicked',
74
- args: [{
75
- arg: 'startCursor',
76
- description: 'A cursor that points to the first item in the current page.'
77
- }]
78
- }, {
79
- event: 'next',
80
- description: 'Emitted when the "Next" button is clicked',
81
- args: [{
82
- arg: 'endCursor',
83
- description: 'A cursor that points to the last item in the current page'
84
- }]
85
- }],
86
- slots: [{
87
- name: 'previous-button-content',
88
- description: 'Used to customize the appearance of the "Prev" button'
89
- }, {
90
- name: 'next-button-content',
91
- description: 'Used to customize the appearance of the "Next" button'
92
- }]
10
+ followsDesignSystem: true
93
11
  };
94
12
 
95
13
  export default keyset_pagination_documentation;
@@ -16,46 +16,88 @@ var script = {
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
+ /**
21
+ * Whether or not the "Prev" button should be enabled
22
+ */
19
23
  hasPreviousPage: {
20
24
  type: Boolean,
21
25
  required: false,
22
26
  default: false
23
27
  },
28
+
29
+ /**
30
+ * Whether or not the "Next" button should be enabled
31
+ */
24
32
  hasNextPage: {
25
33
  type: Boolean,
26
34
  required: false,
27
35
  default: false
28
36
  },
37
+
38
+ /**
39
+ * A cursor that points to the first item in the current page.
40
+ * Will be passed as an event parameter when the "prev" event is fired.
41
+ */
29
42
  startCursor: {
30
43
  type: String,
31
44
  required: false,
32
45
  default: null
33
46
  },
47
+
48
+ /**
49
+ * A cursor that points to the last item in the current page.
50
+ * Will be passed as an event parameter when the "next" event is fired.
51
+ */
34
52
  endCursor: {
35
53
  type: String,
36
54
  required: false,
37
55
  default: null
38
56
  },
57
+
58
+ /**
59
+ * The text that will be rendered inside the "Prev" button.
60
+ * It\'s important to provide this parameter since the default text is not translatable.
61
+ */
39
62
  prevText: {
40
63
  type: String,
41
64
  required: false,
42
65
  default: 'Prev'
43
66
  },
67
+
68
+ /**
69
+ * A link that will be used as the "Prev" button\'s "href" attribute.
70
+ * If provided, the "Prev" button renders as a link button; otherwise, it is rendered as a regular button.
71
+ */
44
72
  prevButtonLink: {
45
73
  type: String,
46
74
  required: false,
47
75
  default: null
48
76
  },
77
+
78
+ /**
79
+ * The text that will be rendered inside the "Next" button.
80
+ * It\'s important to provide this parameter since the default text is not translatable.
81
+ */
49
82
  nextText: {
50
83
  type: String,
51
84
  required: false,
52
85
  default: 'Next'
53
86
  },
87
+
88
+ /**
89
+ * A link that will be used as the "Next" button\'s "href" attribute.
90
+ * If provided, the "Next" button renders as a link button; otherwise, it is rendered as a regular button.
91
+ */
54
92
  nextButtonLink: {
55
93
  type: String,
56
94
  required: false,
57
95
  default: null
58
96
  },
97
+
98
+ /**
99
+ * Whether or not both buttons should be disabled (regardless of the "hasPreviousPage" and "hasNextPage" values).
100
+ */
59
101
  disabled: {
60
102
  type: Boolean,
61
103
  required: false,
@@ -1,38 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "# Modal\n\n<!-- STORY -->\n## Usage\n\nModals are used to reveal critical information, show information without losing context, or when the\nsystem requires a user response. Modals can also fragment a complex workflow into simpler steps and\nshould serve a single purpose dedicated to completing the user’s task.\n\n## VModel\n\nYou can use the `v-model` directive to control the modal’s visibility. The `v-model`\ndirective interfaces with the `visible` property and the `@change` event.\n\n## Deprecation Warning\n\nWe are deprecating the `modal-ok` and `modal-cancel` slots. We are also changing the way the\n`modal-footer` slot content is populated. This is in order to align this component with the design\nsystem.\n\nThe `modal-footer` slot should only be populated via props: `action-primary`, `action-secondary` and\n`action-cancel`. These props allow you to handle how a primary, secondary and cancel button will\nbehave in the modals footer. The props receive an object as such:\n\n~~~js\n{\n text: 'Save Changes',\n attributes: [\n { variant: 'confirm' },\n { disabled: this.someState },\n { class: 'some-class' },\n ...\n ]\n}\n~~~\n";
1
+ var description = "Modals are used to reveal critical information, show information without losing context, or when the\nsystem requires a user response. Modals can also fragment a complex workflow into simpler steps and\nshould serve a single purpose dedicated to completing the user’s task.\n\n## VModel\n\nYou can use the `v-model` directive to control the modal’s visibility. The `v-model`\ndirective interfaces with the `visible` property and the `@change` event.\n\n## Deprecation Warning\n\nWe are deprecating the `modal-ok` and `modal-cancel` slots. We are also changing the way the\n`modal-footer` slot content is populated. This is in order to align this component with the design\nsystem.\n\nThe `modal-footer` slot should only be populated via props: `action-primary`, `action-secondary` and\n`action-cancel`. These props allow you to handle how a primary, secondary and cancel button will\nbehave in the modals footer. The props receive an object as such:\n\n```js\n{\n text: 'Save Changes',\n attributes: [\n { variant: 'confirm' },\n { disabled: this.someState },\n { class: 'some-class' },\n ...\n ]\n}\n```\n";
4
2
 
5
3
  var modal_documentation = {
6
- bootstrapComponent: 'b-modal',
7
4
  followsDesignSystem: true,
8
- description,
9
- examples,
10
- slots: [{
11
- name: 'modal-header',
12
- description: 'Entire modal header container contents (including the close button on the top right corner)'
13
- }, {
14
- name: 'modal-title',
15
- description: 'Modal title. If modal-header slot is used, this slot will not be shown.'
16
- }, {
17
- name: 'modal-header-close',
18
- description: 'Content of Modal header close button. If modal-header slot is used, this slot will not be shown.'
19
- }, {
20
- name: 'modal-footer',
21
- description: 'Populated via props: modal-action-primary, modal-action-cancel and modal-action-secondary.'
22
- }],
23
- events: [{
24
- event: '@primary',
25
- description: 'Emitted when clicked on modal-action-primary'
26
- }, {
27
- event: '@secondary',
28
- description: 'Emitted when clicked on modal-action-secondary'
29
- }, {
30
- event: '@canceled',
31
- description: 'Emitted when clicked on modal-action-cancel'
32
- }, {
33
- event: '@change',
34
- description: 'Emitted when the modal visibility changes'
35
- }]
5
+ description
36
6
  };
37
7
 
38
8
  export default modal_documentation;
@@ -75,6 +75,20 @@ var script = {
75
75
  default: false
76
76
  }
77
77
  },
78
+ computed: {
79
+ shouldRenderModalOk() {
80
+ return Boolean(this.$slots['modal-ok']);
81
+ },
82
+
83
+ shouldRenderModalCancel() {
84
+ return Boolean(this.$slots['modal-cancel']);
85
+ },
86
+
87
+ shouldRenderModalFooter() {
88
+ return Boolean(this.actionCancel || this.actionSecondary || this.actionPrimary || this.$slots['modal-footer']);
89
+ }
90
+
91
+ },
78
92
  methods: {
79
93
  show() {
80
94
  this.$refs.modal.show();
@@ -151,7 +165,7 @@ var script = {
151
165
  const __vue_script__ = script;
152
166
 
153
167
  /* template */
154
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-modal',_vm._g(_vm._b({ref:"modal",attrs:{"id":_vm.modalId,"title-tag":_vm.titleTag,"size":_vm.size,"visible":_vm.visible,"lazy":"","modal-class":['gl-modal', _vm.modalClass]},on:{"shown":_vm.setFocus,"ok":_vm.primary,"cancel":_vm.canceled,"change":function($event){return _vm.$emit('change', $event)}},scopedSlots:_vm._u([{key:"modal-header",fn:function(){return [_vm._t("modal-header",[_c('h4',{staticClass:"modal-title"},[_vm._t("modal-title",[_vm._v(_vm._s(_vm.title))])],2)]),_vm._v(" "),_c('close-button',{ref:"close-button",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.close}})]},proxy:true}],null,true)},'b-modal',_vm.$attrs,false),_vm.$listeners),[_vm._t("default"),_vm._v(" "),_vm._v(" "),_vm._t("modal-ok",null,{"slot":"modal-ok"}),_vm._v(" "),_vm._t("modal-cancel",null,{"slot":"modal-cancel"}),_vm._v(" "),_vm._t("modal-footer",[(_vm.actionCancel)?_c('gl-button',_vm._b({staticClass:"js-modal-action-cancel",on:{"click":_vm.cancel}},'gl-button',_vm.buttonBinding(_vm.actionCancel, 'actionCancel'),false),[_vm._v("\n "+_vm._s(_vm.actionCancel.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionSecondary)?_c('gl-button',_vm._b({staticClass:"js-modal-action-secondary",on:{"click":_vm.secondary}},'gl-button',_vm.buttonBinding(_vm.actionSecondary, 'actionSecondary'),false),[_vm._v("\n "+_vm._s(_vm.actionSecondary.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionPrimary)?_c('gl-button',_vm._b({staticClass:"js-modal-action-primary",on:{"click":_vm.ok}},'gl-button',_vm.buttonBinding(_vm.actionPrimary, 'actionPrimary'),false),[_vm._v("\n "+_vm._s(_vm.actionPrimary.text)+"\n ")]):_vm._e()],{"slot":"modal-footer"})],2)};
168
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-modal',_vm._g(_vm._b({ref:"modal",attrs:{"id":_vm.modalId,"title-tag":_vm.titleTag,"size":_vm.size,"visible":_vm.visible,"lazy":"","modal-class":['gl-modal', _vm.modalClass]},on:{"shown":_vm.setFocus,"ok":_vm.primary,"cancel":_vm.canceled,"change":function($event){return _vm.$emit('change', $event)}},scopedSlots:_vm._u([{key:"default",fn:function(){return [_vm._t("default")]},proxy:true},{key:"modal-header",fn:function(){return [_vm._t("modal-header",[_c('h4',{staticClass:"modal-title"},[_vm._t("modal-title",[_vm._v(_vm._s(_vm.title))])],2)]),_vm._v(" "),_c('close-button',{ref:"close-button",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.close}})]},proxy:true},(_vm.shouldRenderModalOk)?{key:"modal-ok",fn:function(){return [_vm._t("modal-ok")]},proxy:true}:null,(_vm.shouldRenderModalCancel)?{key:"modal-cancel",fn:function(){return [_vm._t("modal-cancel")]},proxy:true}:null,(_vm.shouldRenderModalFooter)?{key:"modal-footer",fn:function(){return [_vm._t("modal-footer",[(_vm.actionCancel)?_c('gl-button',_vm._b({staticClass:"js-modal-action-cancel",on:{"click":_vm.cancel}},'gl-button',_vm.buttonBinding(_vm.actionCancel, 'actionCancel'),false),[_vm._v("\n "+_vm._s(_vm.actionCancel.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionSecondary)?_c('gl-button',_vm._b({staticClass:"js-modal-action-secondary",on:{"click":_vm.secondary}},'gl-button',_vm.buttonBinding(_vm.actionSecondary, 'actionSecondary'),false),[_vm._v("\n "+_vm._s(_vm.actionSecondary.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionPrimary)?_c('gl-button',_vm._b({staticClass:"js-modal-action-primary",on:{"click":_vm.ok}},'gl-button',_vm.buttonBinding(_vm.actionPrimary, 'actionPrimary'),false),[_vm._v("\n "+_vm._s(_vm.actionPrimary.text)+"\n ")]):_vm._e()])]},proxy:true}:null],null,true)},'b-modal',_vm.$attrs,false),_vm.$listeners))};
155
169
  var __vue_staticRenderFns__ = [];
156
170
 
157
171
  /* style */