@gitlab/ui 37.1.0 → 37.4.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 (93) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/components/base/form/form_group/form_group.documentation.js +2 -6
  3. package/dist/components/base/form/form_input_group/form_input_group.documentation.js +2 -26
  4. package/dist/components/base/form/form_input_group/form_input_group.js +7 -0
  5. package/dist/components/base/loading_icon/loading_icon.js +1 -1
  6. package/dist/components/base/pagination/pagination.js +22 -2
  7. package/dist/components/base/path/path.js +9 -3
  8. package/dist/components/base/search_box_by_click/search_box_by_click.documentation.js +2 -80
  9. package/dist/components/base/search_box_by_click/search_box_by_click.js +60 -1
  10. package/dist/components/base/search_box_by_type/search_box_by_type.documentation.js +2 -20
  11. package/dist/components/base/search_box_by_type/search_box_by_type.js +19 -5
  12. package/dist/directives/hover_load/hover_load.documentation.js +1 -1
  13. package/dist/directives/resize_observer/resize_observer.documentation.js +2 -5
  14. package/dist/directives/safe_html/safe_html.documentation.js +1 -1
  15. package/dist/directives/safe_link/safe_link.documentation.js +2 -3
  16. package/dist/index.css +1 -1
  17. package/dist/index.css.map +1 -1
  18. package/dist/utility_classes.css +1 -1
  19. package/dist/utility_classes.css.map +1 -1
  20. package/documentation/documented_stories.js +8 -0
  21. package/package.json +1 -1
  22. package/src/components/base/button/button.scss +5 -9
  23. package/src/components/base/form/form_group/form_group.documentation.js +0 -3
  24. package/src/components/base/form/form_group/form_group.md +0 -2
  25. package/src/components/base/form/form_group/form_group.stories.js +106 -145
  26. package/src/components/base/form/form_input_group/form_input_group.documentation.js +0 -28
  27. package/src/components/base/form/form_input_group/form_input_group.md +0 -4
  28. package/src/components/base/form/form_input_group/form_input_group.stories.js +84 -62
  29. package/src/components/base/form/form_input_group/form_input_group.vue +9 -0
  30. package/src/components/base/loading_icon/loading_icon.vue +1 -1
  31. package/src/components/base/pagination/pagination.spec.js +9 -2
  32. package/src/components/base/pagination/pagination.vue +22 -6
  33. package/src/components/base/path/path.spec.js +12 -0
  34. package/src/components/base/path/path.vue +8 -3
  35. package/src/components/base/search_box_by_click/search_box_by_click.documentation.js +0 -90
  36. package/src/components/base/search_box_by_click/search_box_by_click.md +0 -2
  37. package/src/components/base/search_box_by_click/search_box_by_click.stories.js +91 -48
  38. package/src/components/base/search_box_by_click/search_box_by_click.vue +50 -1
  39. package/src/components/base/search_box_by_type/search_box_by_type.documentation.js +0 -18
  40. package/src/components/base/search_box_by_type/search_box_by_type.md +0 -2
  41. package/src/components/base/search_box_by_type/search_box_by_type.stories.js +49 -43
  42. package/src/components/base/search_box_by_type/search_box_by_type.vue +16 -6
  43. package/src/components/base/tabs/tabs/tabs.stories.js +2 -4
  44. package/src/directives/hover_load/hover_load.md +0 -2
  45. package/src/directives/hover_load/hover_load.stories.js +39 -34
  46. package/src/directives/resize_observer/resize_observer.documentation.js +0 -2
  47. package/src/directives/resize_observer/resize_observer.md +0 -6
  48. package/src/directives/resize_observer/resize_observer.stories.js +70 -51
  49. package/src/directives/safe_html/safe_html.md +0 -4
  50. package/src/directives/safe_html/safe_html.stories.js +53 -44
  51. package/src/directives/safe_link/safe_link.documentation.js +0 -1
  52. package/src/directives/safe_link/safe_link.md +0 -4
  53. package/src/directives/safe_link/safe_link.stories.js +31 -30
  54. package/src/scss/utilities.scss +8 -0
  55. package/src/scss/utility-mixins/background.scss +4 -0
  56. package/dist/components/base/form/form_group/examples/form_group/form_group.basic.example.js +0 -38
  57. package/dist/components/base/form/form_group/examples/form_group/form_group.disabled.example.js +0 -48
  58. package/dist/components/base/form/form_group/examples/form_group/form_group.textarea.example.js +0 -48
  59. package/dist/components/base/form/form_group/examples/form_group/form_group.validation.example.js +0 -66
  60. package/dist/components/base/form/form_group/examples/form_group/index.js +0 -27
  61. package/dist/components/base/form/form_input_group/examples/form_input_group.basic.example.js +0 -38
  62. package/dist/components/base/form/form_input_group/examples/form_input_group.predefined_options.example.js +0 -54
  63. package/dist/components/base/form/form_input_group/examples/form_input_group.predefined_reactive.example.js +0 -55
  64. package/dist/components/base/form/form_input_group/examples/form_input_group.reactive.example.js +0 -48
  65. package/dist/components/base/form/form_input_group/examples/index.js +0 -27
  66. package/dist/components/base/search_box_by_click/examples/index.js +0 -22
  67. package/dist/components/base/search_box_by_click/examples/search_box_by_click.default.example.js +0 -48
  68. package/dist/components/base/search_box_by_click/examples/search_box_by_click.history.example.js +0 -51
  69. package/dist/components/base/search_box_by_click/examples/search_box_by_click.v_model.example.js +0 -54
  70. package/dist/components/base/search_box_by_type/examples/index.js +0 -17
  71. package/dist/components/base/search_box_by_type/examples/search_box_by_type.default.example.js +0 -48
  72. package/dist/components/base/search_box_by_type/examples/search_box_by_type.loading.example.js +0 -65
  73. package/dist/directives/resize_observer/examples/index.js +0 -12
  74. package/dist/directives/resize_observer/examples/resize_observer.basic.example.js +0 -62
  75. package/src/components/base/form/form_group/examples/form_group/form_group.basic.example.vue +0 -11
  76. package/src/components/base/form/form_group/examples/form_group/form_group.disabled.example.vue +0 -21
  77. package/src/components/base/form/form_group/examples/form_group/form_group.textarea.example.vue +0 -15
  78. package/src/components/base/form/form_group/examples/form_group/form_group.validation.example.vue +0 -36
  79. package/src/components/base/form/form_group/examples/form_group/index.js +0 -32
  80. package/src/components/base/form/form_input_group/examples/form_input_group.basic.example.vue +0 -10
  81. package/src/components/base/form/form_input_group/examples/form_input_group.predefined_options.example.vue +0 -25
  82. package/src/components/base/form/form_input_group/examples/form_input_group.predefined_reactive.example.vue +0 -32
  83. package/src/components/base/form/form_input_group/examples/form_input_group.reactive.example.vue +0 -25
  84. package/src/components/base/form/form_input_group/examples/index.js +0 -32
  85. package/src/components/base/search_box_by_click/examples/index.js +0 -26
  86. package/src/components/base/search_box_by_click/examples/search_box_by_click.default.example.vue +0 -14
  87. package/src/components/base/search_box_by_click/examples/search_box_by_click.history.example.vue +0 -23
  88. package/src/components/base/search_box_by_click/examples/search_box_by_click.v_model.example.vue +0 -23
  89. package/src/components/base/search_box_by_type/examples/index.js +0 -20
  90. package/src/components/base/search_box_by_type/examples/search_box_by_type.default.example.vue +0 -14
  91. package/src/components/base/search_box_by_type/examples/search_box_by_type.loading.example.vue +0 -34
  92. package/src/directives/resize_observer/examples/index.js +0 -14
  93. package/src/directives/resize_observer/examples/resize_observer.basic.example.vue +0 -21
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # [37.4.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.3.0...v37.4.0) (2022-03-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlButton:** Update selected state background ([b9e3116](https://gitlab.com/gitlab-org/gitlab-ui/commit/b9e31166ee8a43c2ea09c2f4a9cafd9e71e222d8))
7
+ * **GlButton:** Update selected state design ([a5ebf70](https://gitlab.com/gitlab-org/gitlab-ui/commit/a5ebf701e38fd32ff965af33c30319e4c7f2edc5))
8
+
9
+ # [37.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.2.0...v37.3.0) (2022-03-03)
10
+
11
+
12
+ ### Features
13
+
14
+ * **css:** Add gl-bg-purple-50 util class ([29acbbb](https://gitlab.com/gitlab-org/gitlab-ui/commit/29acbbbe7726f763b0e7ba86dc4de74db45a545e))
15
+
16
+ # [37.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.1.0...v37.2.0) (2022-03-03)
17
+
18
+
19
+ ### Features
20
+
21
+ * **GlPath:** allow changing selected index programmatically ([d711441](https://gitlab.com/gitlab-org/gitlab-ui/commit/d71144162363ae62ff4d1aeb3ee3dc956bd04108))
22
+
1
23
  # [37.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.0.0...v37.1.0) (2022-02-28)
2
24
 
3
25
 
@@ -1,11 +1,7 @@
1
- import examples from './examples/form_group';
2
-
3
- var description = "# Form Group\n\nForm group adds structure to forms.\n";
1
+ var description = "Form group adds structure to forms.\n";
4
2
 
5
3
  var form_group_documentation = {
6
- description,
7
- examples,
8
- bootstrapComponent: 'b-form-group'
4
+ description
9
5
  };
10
6
 
11
7
  export default form_group_documentation;
@@ -1,32 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "# Form Group Input\n\n<!-- STORY -->\n\nThe `GlFormInputGroup` component allows one to build more advanced text\ninput fields than generic `GlFormInput` when one needs that flexibility.\nBasic usage of the component:\n\n```html\n<div>\n <gl-form-input-group>\n <template #prepend>\n <!-- Content to prepend your text input field -->\n </template>\n <template #append>\n <!-- Content to append your text input field -->\n </template>\n </gl-form-input-group>\n</div>\n```\n\nOne can use any other component (custom or `<gl-*>`) in both slots or\nnot to use the slots at all. In the latter, the component will fallback\nto simple `GlFormInput`.\n\n## Predefined options\n\nSometimes custom text input from the user isn't desired. Instead, the\nuser should pick one of the predefined options that will automatically\npopulate the input field. Typically, such cases will also include an\nactionable button (like **Copy**) put into the `append` slot.\n\nTo achieve this effect, the `GlFormInputGroup` component accepts an\narray of options in the form of `predefinedOptions` param. For example:\n\n```javascript\nconst optionValues = [\n { name: 'Option #1', value: 'Option #1 is selected!' },\n { name: 'Option #2', value: 'Option #2 is selected!' },\n];\n...\n<gl-form-input-group :predefined-options=\"optionValues\" />\n```\n\nThis will tell `GlFormInputGroup` to render a dropdown in the `prepend`\nslot with all of the supplied options' `name`s. When one of the options\nis selected, the input field is automatically populated with the\noption's `value`. Check the \"Examples\" section below for \"With\npredefined options\" example.\n\n### Pro tips\n\nRead some useful tips below about specific usage of the component.\n\n### Readonly input\n\nOften you want to make sure user doesn't mess up the predefined content\npasted into the input field. In this case, you can set `readonly`\nparam to `true`. You can play with `Readonly` knob on the right.\n\n### Preselect the text to copy\n\nIf you set the `readonly` param on the `GlFormInputGroup` component,\nusers will still be able to manually select the text and copy it.\nHowever, it's more user-friendly to preselect the text for the users if\nthey click anywhere in the input field. This can be achieved by setting\nthe `select-on-click` param to `true`. You can play with\n`Select text on click` knob on the right. Even better, try enabling\n`Readonly`, `Select text on click`, and `Switch to predefined input`\naltogether. And, probably, remove `Prepend text`. Or leave it. It's your\ncall. :)\n";
1
+ var description = "The `GlFormInputGroup` component allows one to build more advanced text\ninput fields than generic `GlFormInput` when one needs that flexibility.\nBasic usage of the component:\n\n```html\n<div>\n <gl-form-input-group>\n <template #prepend>\n <!-- Content to prepend your text input field -->\n </template>\n <template #append>\n <!-- Content to append your text input field -->\n </template>\n </gl-form-input-group>\n</div>\n```\n\nOne can use any other component (custom or `<gl-*>`) in both slots or\nnot to use the slots at all. In the latter, the component will fallback\nto simple `GlFormInput`.\n\n## Predefined options\n\nSometimes custom text input from the user isn't desired. Instead, the\nuser should pick one of the predefined options that will automatically\npopulate the input field. Typically, such cases will also include an\nactionable button (like **Copy**) put into the `append` slot.\n\nTo achieve this effect, the `GlFormInputGroup` component accepts an\narray of options in the form of `predefinedOptions` param. For example:\n\n```javascript\nconst optionValues = [\n { name: 'Option #1', value: 'Option #1 is selected!' },\n { name: 'Option #2', value: 'Option #2 is selected!' },\n];\n...\n<gl-form-input-group :predefined-options=\"optionValues\" />\n```\n\nThis will tell `GlFormInputGroup` to render a dropdown in the `prepend`\nslot with all of the supplied options' `name`s. When one of the options\nis selected, the input field is automatically populated with the\noption's `value`. Check the \"Examples\" section below for \"With\npredefined options\" example.\n\n### Pro tips\n\nRead some useful tips below about specific usage of the component.\n\n### Readonly input\n\nOften you want to make sure user doesn't mess up the predefined content\npasted into the input field. In this case, you can set `readonly`\nparam to `true`. You can play with `Readonly` knob on the right.\n\n### Preselect the text to copy\n\nIf you set the `readonly` param on the `GlFormInputGroup` component,\nusers will still be able to manually select the text and copy it.\nHowever, it's more user-friendly to preselect the text for the users if\nthey click anywhere in the input field. This can be achieved by setting\nthe `select-on-click` param to `true`. You can play with\n`Select text on click` knob on the right. Even better, try enabling\n`Readonly`, `Select text on click`, and `Switch to predefined input`\naltogether. And, probably, remove `Prepend text`. Or leave it. It's your\ncall. :)\n";
4
2
 
5
3
  var form_input_group_documentation = {
6
4
  followsDesignSystem: false,
7
- description,
8
- examples,
9
- bootstrapComponent: 'b-form-input',
10
- propsInfo: {
11
- 'select-on-click': {
12
- type: Boolean,
13
- additionalInfo: 'Automatically selects the content of the input field on click'
14
- },
15
- 'predefined-options': {
16
- type: Array,
17
- additionalInfo: 'Array of options. Each option should have `name` and `value` information: {name: "Foo", value: "Bar"})'
18
- }
19
- },
20
- slots: [{
21
- name: 'default',
22
- description: 'Allows replacement of default input field.'
23
- }, {
24
- name: 'prepend',
25
- description: 'Is rendered in front of the input field.'
26
- }, {
27
- name: 'append',
28
- description: 'Is rendered after the input field.'
29
- }]
5
+ description
30
6
  };
31
7
 
32
8
  export default form_input_group_documentation;
@@ -16,11 +16,18 @@ var script = {
16
16
  },
17
17
  mixins: [InputGroupMixin],
18
18
  props: {
19
+ /**
20
+ * Automatically selects the content of the input field on click.
21
+ */
19
22
  selectOnClick: {
20
23
  type: Boolean,
21
24
  required: false,
22
25
  default: false
23
26
  },
27
+
28
+ /**
29
+ * Array of options. Each option should have `name` and `value` information: {name: "Foo", value: "Bar"})
30
+ */
24
31
  predefinedOptions: {
25
32
  type: Array,
26
33
  required: false,
@@ -67,7 +67,7 @@ var script = {
67
67
  const __vue_script__ = script;
68
68
 
69
69
  /* template */
70
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.rootElementType,{tag:"component",staticClass:"gl-spinner-container",attrs:{"role":"status"}},[_c('span',{staticClass:"align-text-bottom",class:_vm.cssClasses,attrs:{"aria-label":_vm.label}})])};
70
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.rootElementType,{tag:"component",staticClass:"gl-spinner-container",attrs:{"role":"status"}},[_c('span',{staticClass:"gl-vertical-align-text-bottom!",class:_vm.cssClasses,attrs:{"aria-label":_vm.label}})])};
71
71
  var __vue_staticRenderFns__ = [];
72
72
 
73
73
  /* style */
@@ -277,6 +277,26 @@ var script = {
277
277
 
278
278
  nextPageIsDisabled() {
279
279
  return this.pageIsDisabled(this.value + 1);
280
+ },
281
+
282
+ prevPageAriaLabel() {
283
+ return this.prevPageIsDisabled ? false : this.labelPrevPage || this.labelPage(this.value - 1);
284
+ },
285
+
286
+ nextPageAriaLabel() {
287
+ return this.nextPageIsDisabled ? false : this.labelNextPage || this.labelPage(this.value + 1);
288
+ },
289
+
290
+ prevPageHref() {
291
+ if (this.prevPageIsDisabled) return false;
292
+ if (this.isLinkBased) return this.linkGen(this.value - 1);
293
+ return '#';
294
+ },
295
+
296
+ nextPageHref() {
297
+ if (this.nextPageIsDisabled) return false;
298
+ if (this.isLinkBased) return this.linkGen(this.value + 1);
299
+ return '#';
280
300
  }
281
301
 
282
302
  },
@@ -392,13 +412,13 @@ const __vue_script__ = script;
392
412
  var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.isVisible)?_c('ul',{staticClass:"pagination gl-pagination text-nowrap",class:_vm.wrapperClasses,attrs:{"role":"navigation","aria-label":"Pagination"}},[_c('li',{staticClass:"page-item",class:{
393
413
  disabled: _vm.prevPageIsDisabled,
394
414
  'flex-fill': _vm.isFillAlign,
395
- }},[_c(_vm.prevPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link prev-page-item gl-display-flex",attrs:{"aria-disabled":_vm.prevPageIsDisabled,"aria-label":_vm.labelPrevPage || _vm.labelPage(_vm.value - 1),"href":_vm.isLinkBased ? _vm.linkGen(_vm.value - 1) : '#'},on:{"click":function($event){return _vm.handlePrevious($event, _vm.value - 1)}}},[_vm._t("previous",[_c('gl-icon',{attrs:{"name":"chevron-left"}}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.prevText))])],null,{ page: _vm.value - 1, disabled: _vm.prevPageIsDisabled })],2)],1),_vm._v(" "),_vm._l((_vm.visibleItems),function(item){return _c('li',{key:item.key,staticClass:"page-item",class:{
415
+ },attrs:{"aria-hidden":_vm.prevPageIsDisabled}},[_c(_vm.prevPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link prev-page-item gl-display-flex",attrs:{"aria-label":_vm.prevPageAriaLabel,"href":_vm.prevPageHref},on:{"click":function($event){return _vm.handlePrevious($event, _vm.value - 1)}}},[_vm._t("previous",[_c('gl-icon',{attrs:{"name":"chevron-left"}}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.prevText))])],null,{ page: _vm.value - 1, disabled: _vm.prevPageIsDisabled })],2)],1),_vm._v(" "),_vm._l((_vm.visibleItems),function(item){return _c('li',{key:item.key,staticClass:"page-item",class:{
396
416
  disabled: item.disabled,
397
417
  'flex-fill': _vm.isFillAlign,
398
418
  }},[_c(item.component,_vm._g(_vm._b({tag:"component",staticClass:"page-link",attrs:{"size":"md","aria-disabled":item.disabled}},'component',item.attrs,false),item.listeners),[_vm._t(item.slot,[_vm._v(_vm._s(item.content))],null,item.slotData)],2)],1)}),_vm._v(" "),_c('li',{staticClass:"page-item",class:{
399
419
  disabled: _vm.nextPageIsDisabled,
400
420
  'flex-fill': _vm.isFillAlign,
401
- }},[_c(_vm.nextPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link next-page-item gl-display-flex",attrs:{"aria-disabled":_vm.nextPageIsDisabled,"aria-label":_vm.labelNextPage || _vm.labelPage(_vm.value + 1),"href":_vm.isLinkBased ? _vm.linkGen(_vm.value + 1) : '#'},on:{"click":function($event){return _vm.handleNext($event, _vm.value + 1)}}},[_vm._t("next",[_c('span',[_vm._v(_vm._s(_vm.nextText))]),_vm._v(" "),_c('gl-icon',{attrs:{"name":"chevron-right"}})],null,{ page: _vm.value + 1, disabled: _vm.nextPageIsDisabled })],2)],1)],2):_vm._e()};
421
+ },attrs:{"aria-hidden":_vm.nextPageIsDisabled}},[_c(_vm.nextPageIsDisabled ? 'span' : 'a',{tag:"component",staticClass:"gl-link page-link next-page-item gl-display-flex",attrs:{"aria-label":_vm.nextPageAriaLabel,"href":_vm.nextPageHref},on:{"click":function($event){return _vm.handleNext($event, _vm.value + 1)}}},[_vm._t("next",[_c('span',[_vm._v(_vm._s(_vm.nextText))]),_vm._v(" "),_c('gl-icon',{attrs:{"name":"chevron-right"}})],null,{ page: _vm.value + 1, disabled: _vm.nextPageIsDisabled })],2)],1)],2):_vm._e()};
402
422
  var __vue_staticRenderFns__ = [];
403
423
 
404
424
  /* style */
@@ -89,10 +89,16 @@ var script = {
89
89
  }
90
90
 
91
91
  },
92
+ watch: {
93
+ items: {
94
+ immediate: true,
95
+
96
+ handler(items) {
97
+ const selectedIndex = items.findIndex(item => item.selected);
98
+ this.selectedIndex = selectedIndex > 0 ? selectedIndex : 0;
99
+ }
92
100
 
93
- mounted() {
94
- const selectedIndex = this.items.findIndex(item => item.selected);
95
- this.selectedIndex = selectedIndex > 0 ? selectedIndex : 0;
101
+ }
96
102
  },
97
103
 
98
104
  beforeCreate() {
@@ -1,86 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "# Search Box By Click\n\nProvides a clearable text input with loading state to be used for [search](https://design.gitlab.com/components/search).\n";
1
+ var description = "Provides a clearable text input with loading state to be used for [search](https://design.gitlab.com/components/search).\n";
4
2
 
5
3
  var search_box_by_click_documentation = {
6
4
  followsDesignSystem: true,
7
- description,
8
- examples,
9
- propsInfo: {
10
- value: {
11
- additionalInfo: 'If provided, used as value of search input'
12
- },
13
- historyItems: {
14
- type: Array,
15
- required: false,
16
- additionalInfo: 'If provided, used as history items for this component'
17
- },
18
- placeholder: {
19
- type: String,
20
- required: false,
21
- additionalInfo: 'If provided, used as history items for this component'
22
- },
23
- disabled: {
24
- type: Boolean,
25
- required: false,
26
- additionalInfo: 'If provided and true, disables the input and controls'
27
- },
28
- recentSearchesHeader: {
29
- type: String,
30
- required: false,
31
- default: 'Recent searches',
32
- additionalInfo: 'i18n for recent searches title within history dropdown'
33
- },
34
- clearButtonTitle: {
35
- type: String,
36
- required: false,
37
- default: 'Clear',
38
- additionalInfo: 'i18n for clear button title'
39
- },
40
- closeButtonTitle: {
41
- type: String,
42
- required: false,
43
- default: 'Close',
44
- additionalInfo: 'i18n for close button title within history dropdown'
45
- },
46
- clearRecentSearchesText: {
47
- type: String,
48
- required: false,
49
- default: 'Clear recent searches',
50
- additionalInfo: 'i18n for recent searches clear text'
51
- },
52
- tooltipContainer: {
53
- additionalInfo: 'Container for tooltip. Valid values: DOM node, selector string or `false` for default'
54
- },
55
- searchButtonAttributes: {
56
- additionalInfo: 'HTML attributes to add to the search button'
57
- }
58
- },
59
- events: [{
60
- event: 'clear',
61
- description: 'Emitted when search is cleared'
62
- }, {
63
- event: 'submit',
64
- args: [{
65
- arg: 'value',
66
- description: 'Search value'
67
- }],
68
- description: 'Emitted when search is submitted'
69
- }, {
70
- event: 'history-item-selected',
71
- args: [{
72
- arg: 'value',
73
- description: 'History item'
74
- }],
75
- description: 'Emitted when item from history is selected'
76
- }, {
77
- event: 'clear-history',
78
- description: 'Emitted when clear history button is clicked'
79
- }],
80
- slots: [{
81
- name: 'history-item',
82
- description: 'Slot to customize history item in history dropdown. Used only with history-items prop'
83
- }]
5
+ description
84
6
  };
85
7
 
86
8
  export default search_box_by_click_documentation;
@@ -26,6 +26,9 @@ var script = {
26
26
  GlTooltip: GlTooltipDirective
27
27
  },
28
28
  props: {
29
+ /**
30
+ * If provided, used as value of search input
31
+ */
29
32
  value: {
30
33
  required: false,
31
34
  default: '',
@@ -33,11 +36,19 @@ var script = {
33
36
  // so we should not force any specific type for value here
34
37
  validator: () => true
35
38
  },
39
+
40
+ /**
41
+ * If provided, used as history items for this component
42
+ */
36
43
  historyItems: {
37
44
  type: Array,
38
45
  required: false,
39
46
  default: null
40
47
  },
48
+
49
+ /**
50
+ * If provided, used as a placeholder for this component
51
+ */
41
52
  placeholder: {
42
53
  type: String,
43
54
  required: false,
@@ -48,26 +59,46 @@ var script = {
48
59
  required: false,
49
60
  default: true
50
61
  },
62
+
63
+ /**
64
+ * If provided and true, disables the input and controls
65
+ */
51
66
  disabled: {
52
67
  type: Boolean,
53
68
  required: false,
54
69
  default: false
55
70
  },
71
+
72
+ /**
73
+ * i18n for recent searches title within history dropdown
74
+ */
56
75
  recentSearchesHeader: {
57
76
  type: String,
58
77
  required: false,
59
78
  default: 'Recent searches'
60
79
  },
80
+
81
+ /**
82
+ * i18n for clear button title
83
+ */
61
84
  clearButtonTitle: {
62
85
  type: String,
63
86
  required: false,
64
87
  default: 'Clear'
65
88
  },
89
+
90
+ /**
91
+ * i18n for close button title within history dropdown
92
+ */
66
93
  closeButtonTitle: {
67
94
  type: String,
68
95
  required: false,
69
96
  default: 'Close'
70
97
  },
98
+
99
+ /**
100
+ * i18n for recent searches clear text
101
+ */
71
102
  clearRecentSearchesText: {
72
103
  type: String,
73
104
  required: false,
@@ -78,11 +109,19 @@ var script = {
78
109
  required: false,
79
110
  default: "You don't have any recent searches"
80
111
  },
112
+
113
+ /**
114
+ * Container for tooltip. Valid values: DOM node, selector string or `false` for default
115
+ */
81
116
  tooltipContainer: {
82
117
  required: false,
83
118
  default: false,
84
119
  validator: value => value === false || typeof value === 'string' || value instanceof HTMLElement
85
120
  },
121
+
122
+ /**
123
+ * HTML attributes to add to the search button
124
+ */
86
125
  searchButtonAttributes: {
87
126
  type: Object,
88
127
  required: false,
@@ -137,11 +176,20 @@ var script = {
137
176
  },
138
177
 
139
178
  search(value) {
179
+ /**
180
+ * Emitted when search is submitted
181
+ * @property {*} value Search value
182
+ */
140
183
  this.$emit('submit', value);
141
184
  },
142
185
 
143
186
  selectHistoryItem(item) {
144
187
  this.currentValue = item;
188
+ /**
189
+ * Emitted when item from history is selected
190
+ * @property {*} item History item
191
+ */
192
+
145
193
  this.$emit('history-item-selected', item);
146
194
  setTimeout(() => {
147
195
  document.activeElement.blur();
@@ -150,11 +198,22 @@ var script = {
150
198
 
151
199
  clearInput() {
152
200
  this.currentValue = '';
201
+ /**
202
+ * Emitted when search is cleared
203
+ */
204
+
153
205
  this.$emit('clear');
154
206
 
155
207
  if (this.$refs.input) {
156
208
  this.$refs.input.$el.focus();
157
209
  }
210
+ },
211
+
212
+ emitClearHistory() {
213
+ /**
214
+ * Emitted when clear history button is clicked
215
+ */
216
+ this.$emit('clear-history');
158
217
  }
159
218
 
160
219
  }
@@ -164,7 +223,7 @@ var script = {
164
223
  const __vue_script__ = script;
165
224
 
166
225
  /* template */
167
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-form-input-group',{staticClass:"gl-search-box-by-click",scopedSlots:_vm._u([(_vm.historyItems)?{key:"prepend",fn:function(){return [_c('gl-dropdown',{ref:"historyDropdown",staticClass:"gl-search-box-by-click-history",attrs:{"menu-class":"gl-search-box-by-click-menu","category":"secondary","disabled":_vm.disabled},scopedSlots:_vm._u([{key:"button-content",fn:function(){return [_c('gl-icon',{staticClass:"gl-search-box-by-click-history-icon",attrs:{"name":"history"}}),_vm._v(" "),_c('gl-icon',{staticClass:"gl-search-box-by-click-history-icon-chevron",attrs:{"name":"chevron-down"}}),_vm._v(" "),_c('span',{staticClass:"gl-sr-only"},[_vm._v("Toggle history")])]},proxy:true}],null,false,2220989388)},[_vm._v(" "),_c('gl-dropdown-text',{staticClass:"gl-search-box-by-click-history-header"},[_vm._v("\n "+_vm._s(_vm.recentSearchesHeader)+"\n "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip.hover",value:({ container: _vm.tooltipContainer }),expression:"{ container: tooltipContainer }",modifiers:{"hover":true}}],ref:"closeHistory",staticClass:"gl-search-box-by-click-close-history-button",attrs:{"title":_vm.closeButtonTitle,"aria-label":_vm.closeButtonTitle,"category":"tertiary","name":"close","icon":"close"},on:{"click":_vm.closeHistoryDropdown}})],1),_vm._v(" "),_c('gl-dropdown-divider'),_vm._v(" "),(_vm.historyItems.length)?[_vm._l((_vm.historyItems),function(item,idx){return _c('gl-dropdown-item',{key:idx,staticClass:"gl-search-box-by-click-history-item",on:{"click":function($event){return _vm.selectHistoryItem(item)}}},[_vm._t("history-item",[_vm._v(_vm._s(item))],{"historyItem":item})],2)}),_vm._v(" "),_c('gl-dropdown-divider'),_vm._v(" "),_c('gl-dropdown-item',{ref:"clearHistory",on:{"click":function($event){return _vm.$emit('clear-history')}}},[_vm._v(_vm._s(_vm.clearRecentSearchesText))])]:_c('gl-dropdown-text',{staticClass:"gl-search-box-by-click-history-no-searches"},[_vm._v(_vm._s(_vm.noRecentSearchesText))])],2)]},proxy:true}:null,{key:"append",fn:function(){return [_c('gl-button',_vm._b({ref:"searchButton",staticClass:"gl-search-box-by-click-search-button",attrs:{"icon":"search","disabled":_vm.disabled,"aria-label":"Search","data-testid":"search-button"},on:{"click":function($event){return _vm.search(_vm.currentValue)}}},'gl-button',_vm.searchButtonAttributes,false))]},proxy:true}],null,true)},[_vm._v(" "),_vm._t("input",[_c('gl-form-input',_vm._b({ref:"input",staticClass:"gl-search-box-by-click-input",attrs:{"disabled":_vm.disabled},on:{"focus":function($event){_vm.isFocused = true;},"blur":function($event){_vm.isFocused = false;},"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.search(_vm.currentValue)}},model:{value:(_vm.currentValue),callback:function ($$v) {_vm.currentValue=$$v;},expression:"currentValue"}},'gl-form-input',_vm.inputAttributes,false))]),_vm._v(" "),(_vm.clearable && _vm.hasValue && !_vm.disabled)?_c('gl-clear-icon-button',{staticClass:"gl-search-box-by-click-icon-button gl-search-box-by-click-clear-button gl-clear-icon-button",attrs:{"title":_vm.clearButtonTitle,"tooltip-container":_vm.tooltipContainer,"data-testid":"filtered-search-clear-button"},on:{"click":_vm.clearInput}}):_vm._e()],2)};
226
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-form-input-group',{staticClass:"gl-search-box-by-click",scopedSlots:_vm._u([(_vm.historyItems)?{key:"prepend",fn:function(){return [_c('gl-dropdown',{ref:"historyDropdown",staticClass:"gl-search-box-by-click-history",attrs:{"menu-class":"gl-search-box-by-click-menu","category":"secondary","disabled":_vm.disabled},scopedSlots:_vm._u([{key:"button-content",fn:function(){return [_c('gl-icon',{staticClass:"gl-search-box-by-click-history-icon",attrs:{"name":"history"}}),_vm._v(" "),_c('gl-icon',{staticClass:"gl-search-box-by-click-history-icon-chevron",attrs:{"name":"chevron-down"}}),_vm._v(" "),_c('span',{staticClass:"gl-sr-only"},[_vm._v("Toggle history")])]},proxy:true}],null,false,2220989388)},[_vm._v(" "),_c('gl-dropdown-text',{staticClass:"gl-search-box-by-click-history-header"},[_vm._v("\n "+_vm._s(_vm.recentSearchesHeader)+"\n "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip.hover",value:({ container: _vm.tooltipContainer }),expression:"{ container: tooltipContainer }",modifiers:{"hover":true}}],ref:"closeHistory",staticClass:"gl-search-box-by-click-close-history-button",attrs:{"title":_vm.closeButtonTitle,"aria-label":_vm.closeButtonTitle,"category":"tertiary","name":"close","icon":"close"},on:{"click":_vm.closeHistoryDropdown}})],1),_vm._v(" "),_c('gl-dropdown-divider'),_vm._v(" "),(_vm.historyItems.length)?[_vm._l((_vm.historyItems),function(item,idx){return _c('gl-dropdown-item',{key:idx,staticClass:"gl-search-box-by-click-history-item",on:{"click":function($event){return _vm.selectHistoryItem(item)}}},[_vm._t("history-item",[_vm._v(_vm._s(item))],{"historyItem":item})],2)}),_vm._v(" "),_c('gl-dropdown-divider'),_vm._v(" "),_c('gl-dropdown-item',{ref:"clearHistory",on:{"click":_vm.emitClearHistory}},[_vm._v(_vm._s(_vm.clearRecentSearchesText))])]:_c('gl-dropdown-text',{staticClass:"gl-search-box-by-click-history-no-searches"},[_vm._v(_vm._s(_vm.noRecentSearchesText))])],2)]},proxy:true}:null,{key:"append",fn:function(){return [_c('gl-button',_vm._b({ref:"searchButton",staticClass:"gl-search-box-by-click-search-button",attrs:{"icon":"search","disabled":_vm.disabled,"aria-label":"Search","data-testid":"search-button"},on:{"click":function($event){return _vm.search(_vm.currentValue)}}},'gl-button',_vm.searchButtonAttributes,false))]},proxy:true}],null,true)},[_vm._v(" "),_vm._t("input",[_c('gl-form-input',_vm._b({ref:"input",staticClass:"gl-search-box-by-click-input",attrs:{"disabled":_vm.disabled},on:{"focus":function($event){_vm.isFocused = true;},"blur":function($event){_vm.isFocused = false;},"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.search(_vm.currentValue)}},model:{value:(_vm.currentValue),callback:function ($$v) {_vm.currentValue=$$v;},expression:"currentValue"}},'gl-form-input',_vm.inputAttributes,false))]),_vm._v(" "),(_vm.clearable && _vm.hasValue && !_vm.disabled)?_c('gl-clear-icon-button',{staticClass:"gl-search-box-by-click-icon-button gl-search-box-by-click-clear-button gl-clear-icon-button",attrs:{"title":_vm.clearButtonTitle,"tooltip-container":_vm.tooltipContainer,"data-testid":"filtered-search-clear-button"},on:{"click":_vm.clearInput}}):_vm._e()],2)};
168
227
  var __vue_staticRenderFns__ = [];
169
228
 
170
229
  /* style */
@@ -1,26 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "# Search Box By Type\n\nProvides a clearable text input with loading state to be used for [search](https://design.gitlab.com/components/search).\n";
1
+ var description = "Provides a clearable text input with loading state to be used for [search](https://design.gitlab.com/components/search).\n";
4
2
 
5
3
  var search_box_by_type_documentation = {
6
4
  followsDesignSystem: true,
7
- description,
8
- propsInfo: {
9
- value: {
10
- additionalInfo: 'If provided, used as value of search input'
11
- },
12
- disabled: {
13
- additionalInfo: 'If provided and true, disables the input and controls'
14
- },
15
- isLoading: {
16
- additionalInfo: 'Puts search box into loading state, rendering spinner'
17
- },
18
- tooltipContainer: {
19
- additionalInfo: 'Container for tooltip. Valid values: DOM node, selector string or `false` for default'
20
- }
21
- },
22
- examples,
23
- bootstrapComponent: 'b-form-input'
5
+ description
24
6
  };
25
7
 
26
8
  export default search_box_by_type_documentation;
@@ -4,10 +4,6 @@ import GlIcon from '../icon/icon';
4
4
  import GlLoadingIcon from '../loading_icon/loading_icon';
5
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
6
 
7
- const model = {
8
- prop: 'value',
9
- event: 'input'
10
- };
11
7
  var script = {
12
8
  components: {
13
9
  GlClearIconButton,
@@ -16,8 +12,14 @@ var script = {
16
12
  GlLoadingIcon
17
13
  },
18
14
  inheritAttrs: false,
19
- model,
15
+ model: {
16
+ prop: 'value',
17
+ event: 'input'
18
+ },
20
19
  props: {
20
+ /**
21
+ * If provided, used as value of search input
22
+ */
21
23
  value: {
22
24
  type: String,
23
25
  required: false,
@@ -28,16 +30,28 @@ var script = {
28
30
  required: false,
29
31
  default: 'Clear'
30
32
  },
33
+
34
+ /**
35
+ * If provided and true, disables the input and controls
36
+ */
31
37
  disabled: {
32
38
  type: Boolean,
33
39
  required: false,
34
40
  default: false
35
41
  },
42
+
43
+ /**
44
+ * Puts search box into loading state, rendering spinner
45
+ */
36
46
  isLoading: {
37
47
  type: Boolean,
38
48
  required: false,
39
49
  default: false
40
50
  },
51
+
52
+ /**
53
+ * Container for tooltip. Valid values: DOM node, selector string or `false` for default
54
+ */
41
55
  tooltipContainer: {
42
56
  required: false,
43
57
  default: false,
@@ -1,4 +1,4 @@
1
- var hover_load = "# Hover Load\n\nA Vue Directive to help with preloading resources when hovering over an element.\n\n## Usage\n\n```html\n<script>\nimport { GlHoverLoadDirective } from '@gitlab/ui';\n\nexport default {\n directives: { GlHoverLoadDirective },\n methods: {\n handlePreload() {\n fetch('some/endpoint');\n },\n },\n};\n</script>\n\n<template>\n <div v-gl-hover-load=\"handlePreload\">Hover me to preload</div>\n</template>\n```\n";
1
+ var hover_load = "A Vue Directive to help with preloading resources when hovering over an element.\n\n## Usage\n\n```html\n<script>\nimport { GlHoverLoadDirective } from '@gitlab/ui';\n\nexport default {\n directives: { GlHoverLoadDirective },\n methods: {\n handlePreload() {\n fetch('some/endpoint');\n },\n },\n};\n</script>\n\n<template>\n <div v-gl-hover-load=\"handlePreload\">Hover me to preload</div>\n</template>\n```\n";
2
2
 
3
3
  var description = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
@@ -1,11 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "# Resize Observer\n\n<!-- STORY -->\n\n## Usage\n\nThis directive can be used to get notified whenever a given element's size (width or height) changes\nand to retrieve the updated dimensions.\n\nUnder the hood, it leverages the [Resize Observer API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver).\nIf you use GitLab UI in an older browser which doesn't support the Resize Observer API,\nyou can use a [polyfill](https://github.com/que-etc/resize-observer-polyfill).\n\nThe directive accepts a callback as a value and passes on the received\n[contentRect](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentRect)\nand the target element whenever a resize event gets triggered.\n\n```html\n<script>\nexport default {\n data() {\n return {\n width: 0,\n height: 0,\n };\n },\n methods: {\n handleResize({ contentRect: { width, height } }) {\n this.width = width;\n this.height = height;\n },\n },\n};\n</script>\n<template>\n <div v-gl-resize-observer-directive=\"handleResize\">\n <p>{{ width }} x {{ height }}</p>\n </div>\n</template>\n```\n\nThe observer can be toggled on or off by passing a boolean argument to the directive:\n\n```html\n<script>\nexport default {\n data() {\n return {\n shouldObserve: true,\n };\n },\n methods: {\n handleResize() {},\n },\n};\n</script>\n<template>\n <div v-gl-resize-observer-directive[shouldObserve]=\"handleResize\"></div>\n</template>\n```\n";
1
+ var description = "This directive can be used to get notified whenever a given element's size (width or height) changes\nand to retrieve the updated dimensions.\n\nUnder the hood, it leverages the [Resize Observer API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver).\nIf you use GitLab UI in an older browser which doesn't support the Resize Observer API,\nyou can use a [polyfill](https://github.com/que-etc/resize-observer-polyfill).\n\nThe directive accepts a callback as a value and passes on the received\n[contentRect](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentRect)\nand the target element whenever a resize event gets triggered.\n\n```html\n<script>\nexport default {\n data() {\n return {\n width: 0,\n height: 0,\n };\n },\n methods: {\n handleResize({ contentRect: { width, height } }) {\n this.width = width;\n this.height = height;\n },\n },\n};\n</script>\n<template>\n <div v-gl-resize-observer-directive=\"handleResize\">\n <p>{{ width }} x {{ height }}</p>\n </div>\n</template>\n```\n\nThe observer can be toggled on or off by passing a boolean argument to the directive:\n\n```html\n<script>\nexport default {\n data() {\n return {\n shouldObserve: true,\n };\n },\n methods: {\n handleResize() {},\n },\n};\n</script>\n<template>\n <div v-gl-resize-observer-directive[shouldObserve]=\"handleResize\"></div>\n</template>\n```\n";
4
2
 
5
3
  var resize_observer_documentation = {
6
4
  followsDesignSystem: false,
7
- description,
8
- examples
5
+ description
9
6
  };
10
7
 
11
8
  export default resize_observer_documentation;
@@ -1,4 +1,4 @@
1
- var description = "# Safe Html\n\nA Vue Directive to sanitize HTML to avoid any XSS vulnerabilities.\n\n<!-- STORY -->\n\n## Usage\n\nThis directive can be used to sanitize HTML code which may contain user input, to prevent cross-site\nscripting (XSS) vulnerabilities.\n\nUnder the hood, it uses [DOMPurify](https://github.com/cure53/DOMPurify) to sanitize the provided HTML.\n\nDOMPurify will strip out dangerous HTML and will keep the safe HTML. You can refer complete list of\n[tags][1] and [attributes][2] allowed by DOMPurify.\n\n[1]: https://github.com/cure53/DOMPurify/blob/main/src/tags.js\n[2]: https://github.com/cure53/DOMPurify/blob/main/src/attrs.js\n\n## Example\n\n```html\n<script>\nimport { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';\n\nexport default {\n directives: {\n SafeHtml,\n },\n data() {\n return {\n rawHtml: \"Hello! <script>alert('XSS')</script>\",\n };\n },\n};\n</script>\n\n<template>\n <div v-safe-html=\"rawHtml\"></div>\n</template>\n```\n\n## Advanced configuration\n\n```js\n// It allows only <b> tags\nconst config = { ALLOWED_TAGS: ['b'] };\n\n// It doesn't allow any html tags\nconst config = { ALLOWED_TAGS: [] };\n```\n\n```html\n<div v-safe-html:[config]=\"rawHtml\"></div>\n```\n\nFor advanced configuration options, please refer to [DOMPurify's documentation](https://github.com/cure53/DOMPurify#can-i-configure-dompurify).\n\n### Notes\n\n1. `target` attribute is not allowed by default - See <https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1427>.\n1. To know more about other tips & caveats - See <https://gitlab.com/groups/gitlab-org/-/epics/4273#caveats>.\n";
1
+ var description = "A Vue Directive to sanitize HTML to avoid any XSS vulnerabilities.\n\n## Usage\n\nThis directive can be used to sanitize HTML code which may contain user input, to prevent cross-site\nscripting (XSS) vulnerabilities.\n\nUnder the hood, it uses [DOMPurify](https://github.com/cure53/DOMPurify) to sanitize the provided HTML.\n\nDOMPurify will strip out dangerous HTML and will keep the safe HTML. You can refer complete list of\n[tags][1] and [attributes][2] allowed by DOMPurify.\n\n[1]: https://github.com/cure53/DOMPurify/blob/main/src/tags.js\n[2]: https://github.com/cure53/DOMPurify/blob/main/src/attrs.js\n\n## Example\n\n```html\n<script>\nimport { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';\n\nexport default {\n directives: {\n SafeHtml,\n },\n data() {\n return {\n rawHtml: \"Hello! <script>alert('XSS')</script>\",\n };\n },\n};\n</script>\n\n<template>\n <div v-safe-html=\"rawHtml\"></div>\n</template>\n```\n\n## Advanced configuration\n\n```js\n// It allows only <b> tags\nconst config = { ALLOWED_TAGS: ['b'] };\n\n// It doesn't allow any html tags\nconst config = { ALLOWED_TAGS: [] };\n```\n\n```html\n<div v-safe-html:[config]=\"rawHtml\"></div>\n```\n\nFor advanced configuration options, please refer to [DOMPurify's documentation](https://github.com/cure53/DOMPurify#can-i-configure-dompurify).\n\n### Notes\n\n1. `target` attribute is not allowed by default - See <https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1427>.\n1. To know more about other tips & caveats - See <https://gitlab.com/groups/gitlab-org/-/epics/4273#caveats>.\n";
2
2
 
3
3
  var safe_html_documentation = {
4
4
  followsDesignSystem: false,
@@ -1,9 +1,8 @@
1
- var description = "# Safe Link Directive\n\nA Vue directive to make the hyperlinks secure by default.\n\n<!-- STORY -->\n\n## Security measures\n\n### rel\n\nWhen setting target to `_blank`, the rel attribute gets set automatically to `noopener noreferrer`,\nthis is done to avoid the `window.opener` [API exploit]. If you set the `rel` attribute manually,\nthis will overwrite the aforementioned logic.\n\n### href\n\nThis directive enforces \"safe\" URLs. What this means is that, if the provided `href`\ndoesn't point to a safe protocol (one of `http:`, `https:`, `mailto:` or `ftp:`), then it is\nreplaced with `about:blank` to prevent [URL injections].\n\n```html\n<script>\nimport { GlSafeLinkDirective as SafeLink } from '@gitlab/ui';\n\nexport default {\n data() {\n return {\n url: 'javascript:alert(1)',\n };\n },\n directives: { SafeLink },\n};\n</script>\n<template>\n <a v-safe-link href=\"url\" target=\"_blank\">Click</a>\n <!-- Renders to: <a href=\"about:blank\" target=\"_blank\">Click</a> -->\n</template>\n```\n\n[API exploit]: https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/\n[URL injections]: https://vuejs.org/v2/guide/security.html#Injecting-URLs\n";
1
+ var description = "A Vue directive to make the hyperlinks secure by default.\n\n## Security measures\n\n### rel\n\nWhen setting target to `_blank`, the rel attribute gets set automatically to `noopener noreferrer`,\nthis is done to avoid the `window.opener` [API exploit]. If you set the `rel` attribute manually,\nthis will overwrite the aforementioned logic.\n\n### href\n\nThis directive enforces \"safe\" URLs. What this means is that, if the provided `href`\ndoesn't point to a safe protocol (one of `http:`, `https:`, `mailto:` or `ftp:`), then it is\nreplaced with `about:blank` to prevent [URL injections].\n\n```html\n<script>\nimport { GlSafeLinkDirective as SafeLink } from '@gitlab/ui';\n\nexport default {\n data() {\n return {\n url: 'javascript:alert(1)',\n };\n },\n directives: { SafeLink },\n};\n</script>\n<template>\n <a v-safe-link href=\"url\" target=\"_blank\">Click</a>\n <!-- Renders to: <a href=\"about:blank\" target=\"_blank\">Click</a> -->\n</template>\n```\n\n[API exploit]: https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/\n[URL injections]: https://vuejs.org/v2/guide/security.html#Injecting-URLs\n";
2
2
 
3
3
  var safe_link_documentation = {
4
4
  followsDesignSystem: false,
5
- description,
6
- examples: false
5
+ description
7
6
  };
8
7
 
9
8
  export default safe_link_documentation;