@gitlab/ui 37.10.0 → 38.1.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 (67) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +1 -1
  3. package/dist/components/base/breadcrumb/breadcrumb.js +10 -5
  4. package/dist/components/base/{filtered_search/examples/filtered_search.single_unique.example.js → breadcrumb/breadcrumb_item.js} +32 -28
  5. package/dist/components/base/filtered_search/filtered_search.documentation.js +2 -66
  6. package/dist/components/base/filtered_search/filtered_search.js +38 -11
  7. package/dist/components/base/filtered_search/filtered_search_suggestion.documentation.js +2 -8
  8. package/dist/components/base/filtered_search/filtered_search_suggestion.js +4 -0
  9. package/dist/components/base/filtered_search/filtered_search_suggestion_list.documentation.js +2 -7
  10. package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +4 -0
  11. package/dist/components/base/filtered_search/filtered_search_term.documentation.js +2 -44
  12. package/dist/components/base/filtered_search/filtered_search_term.js +37 -0
  13. package/dist/components/base/filtered_search/filtered_search_token.documentation.js +2 -31
  14. package/dist/components/base/filtered_search/filtered_search_token.js +49 -0
  15. package/dist/components/base/filtered_search/filtered_search_token_segment.documentation.js +2 -46
  16. package/dist/components/base/filtered_search/filtered_search_token_segment.js +48 -0
  17. package/dist/components/base/form/form_radio/form_radio.js +1 -1
  18. package/dist/components/charts/series_label/series_label.js +6 -1
  19. package/dist/components/utilities/truncate/truncate.js +2 -2
  20. package/documentation/documented_stories.js +6 -0
  21. package/package.json +9 -7
  22. package/src/components/base/breadcrumb/breadcrumb.spec.js +24 -10
  23. package/src/components/base/breadcrumb/breadcrumb.vue +11 -6
  24. package/src/components/base/breadcrumb/breadcrumb_item.spec.js +45 -0
  25. package/src/components/base/breadcrumb/breadcrumb_item.vue +43 -0
  26. package/src/components/base/filtered_search/filtered_search.documentation.js +0 -76
  27. package/src/components/base/filtered_search/filtered_search.md +3 -4
  28. package/src/components/base/filtered_search/filtered_search.stories.js +248 -13
  29. package/src/components/base/filtered_search/filtered_search.vue +47 -10
  30. package/src/components/base/filtered_search/filtered_search_suggestion.documentation.js +0 -6
  31. package/src/components/base/filtered_search/filtered_search_suggestion.md +1 -7
  32. package/src/components/base/filtered_search/filtered_search_suggestion.stories.js +26 -18
  33. package/src/components/base/filtered_search/filtered_search_suggestion.vue +5 -0
  34. package/src/components/base/filtered_search/filtered_search_suggestion_list.documentation.js +0 -5
  35. package/src/components/base/filtered_search/filtered_search_suggestion_list.md +1 -7
  36. package/src/components/base/filtered_search/filtered_search_suggestion_list.stories.js +33 -25
  37. package/src/components/base/filtered_search/filtered_search_suggestion_list.vue +5 -0
  38. package/src/components/base/filtered_search/filtered_search_term.documentation.js +0 -41
  39. package/src/components/base/filtered_search/filtered_search_term.md +0 -2
  40. package/src/components/base/filtered_search/filtered_search_term.stories.js +33 -26
  41. package/src/components/base/filtered_search/filtered_search_term.vue +54 -0
  42. package/src/components/base/filtered_search/filtered_search_token.documentation.js +0 -26
  43. package/src/components/base/filtered_search/filtered_search_token.md +1 -3
  44. package/src/components/base/filtered_search/filtered_search_token.stories.js +136 -132
  45. package/src/components/base/filtered_search/filtered_search_token.vue +63 -0
  46. package/src/components/base/filtered_search/filtered_search_token_segment.documentation.js +0 -43
  47. package/src/components/base/filtered_search/filtered_search_token_segment.md +0 -2
  48. package/src/components/base/filtered_search/filtered_search_token_segment.stories.js +86 -79
  49. package/src/components/base/filtered_search/filtered_search_token_segment.vue +42 -0
  50. package/src/components/base/form/form_radio/form_radio.spec.js +21 -8
  51. package/src/components/base/form/form_radio/form_radio.vue +0 -1
  52. package/src/components/charts/series_label/series_label.stories.js +6 -3
  53. package/src/components/charts/series_label/series_label.vue +3 -0
  54. package/src/components/utilities/truncate/truncate.spec.js +14 -49
  55. package/src/components/utilities/truncate/truncate.stories.js +1 -59
  56. package/src/components/utilities/truncate/truncate.vue +3 -21
  57. package/dist/components/base/filtered_search/examples/filtered_search.default.example.js +0 -422
  58. package/dist/components/base/filtered_search/examples/filtered_search.friendly.example.js +0 -423
  59. package/dist/components/base/filtered_search/examples/filtered_search.history.example.js +0 -91
  60. package/dist/components/base/filtered_search/examples/filtered_search.multi_select.example.js +0 -196
  61. package/dist/components/base/filtered_search/examples/index.js +0 -32
  62. package/src/components/base/filtered_search/examples/filtered_search.default.example.vue +0 -298
  63. package/src/components/base/filtered_search/examples/filtered_search.friendly.example.vue +0 -300
  64. package/src/components/base/filtered_search/examples/filtered_search.history.example.vue +0 -50
  65. package/src/components/base/filtered_search/examples/filtered_search.multi_select.example.vue +0 -132
  66. package/src/components/base/filtered_search/examples/filtered_search.single_unique.example.vue +0 -31
  67. package/src/components/base/filtered_search/examples/index.js +0 -38
package/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ # [38.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.0.1...v38.1.0) (2022-03-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlBreadcrumbItem:** implement custom component, add `aria-current="page"` to the last breadcrumb link ([6c246e4](https://gitlab.com/gitlab-org/gitlab-ui/commit/6c246e49d3132be4f0f4d70b0f358af4622a27f6))
7
+
8
+ ## [38.0.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.0.0...v38.0.1) (2022-03-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **GlFormRadio:** prevent double emitting events ([208e251](https://gitlab.com/gitlab-org/gitlab-ui/commit/208e2512a1065e1d9b12a51269209a2e52cc835e))
14
+
15
+ # [38.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.10.0...v38.0.0) (2022-03-18)
16
+
17
+
18
+ ### Reverts
19
+
20
+ * **GlFilteredSearch:** Allow to pass token dynamically ([0dcfb53](https://gitlab.com/gitlab-org/gitlab-ui/commit/0dcfb5300f80ee821f16ab62fd655c7e4f141ffe)), closes [/gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2715#note_878880409](https://gitlab.com//gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2715/issues/note_878880409)
21
+ * **GlTruncate:** add slots to surround the text ([ed4aa40](https://gitlab.com/gitlab-org/gitlab-ui/commit/ed4aa40ed8c3e748f78e78d2e312a8be9ffb9833))
22
+
23
+
24
+ ### BREAKING CHANGES
25
+
26
+ * **GlFilteredSearch:** This makes the `value` prop of `GlFilteredSearch`
27
+ static again, so that it is only read once at mount.
28
+ * **GlTruncate:** This drops the before-text and after-text slots from
29
+ GlTruncate.
30
+
1
31
  # [37.10.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.9.1...v37.10.0) (2022-03-18)
2
32
 
3
33
 
package/README.md CHANGED
@@ -46,7 +46,7 @@ GitLab UI provides component styles, a utility-class library, and SCSS utilities
46
46
 
47
47
  ## Quick start - development
48
48
 
49
- Make sure you have [Node](https://nodejs.org/en/) 14.x (LTS) and [Yarn](https://yarnpkg.com/) 1.22
49
+ Make sure you have [Node](https://nodejs.org/en/) 16.x (LTS) and [Yarn](https://yarnpkg.com/) 1.22
50
50
  or newer.
51
51
 
52
52
  ```sh
@@ -1,16 +1,17 @@
1
- import { BBreadcrumb, BBreadcrumbItem } from 'bootstrap-vue/esm/index.js';
1
+ import { BBreadcrumb } from 'bootstrap-vue/esm/index.js';
2
2
  import GlIcon from '../icon/icon';
3
3
  import GlButton from '../button/button';
4
4
  import { GlTooltipDirective } from '../../../directives/tooltip';
5
+ import GlBreadcrumbItem from './breadcrumb_item';
5
6
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
7
 
7
8
  const COLLAPSE_AT_SIZE = 4;
8
9
  var script = {
9
10
  components: {
10
11
  BBreadcrumb,
11
- BBreadcrumbItem,
12
12
  GlIcon,
13
- GlButton
13
+ GlButton,
14
+ GlBreadcrumbItem
14
15
  },
15
16
  directives: {
16
17
  GlTooltip: GlTooltipDirective
@@ -72,7 +73,7 @@ var script = {
72
73
  this.$refs.firstItem[0].querySelector('a').focus();
73
74
  } catch (e) {
74
75
  /* eslint-disable-next-line no-console */
75
- console.error(`Failed to set focus on the last breadcrumb item.`);
76
+ console.error(`Failed to set focus on the first breadcrumb item.`);
76
77
  }
77
78
  },
78
79
 
@@ -82,6 +83,10 @@ var script = {
82
83
 
83
84
  isItemCollapsed(index) {
84
85
  return this.hasCollapsible && this.isListCollapsed && !this.nonCollapsibleIndices.includes(index);
86
+ },
87
+
88
+ getAriaCurrentAttr(index) {
89
+ return this.isLastItem(index) ? 'page' : false;
85
90
  }
86
91
 
87
92
  }
@@ -91,7 +96,7 @@ var script = {
91
96
  const __vue_script__ = script;
92
97
 
93
98
  /* template */
94
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',{staticClass:"gl-breadcrumbs",attrs:{"aria-label":"Breadcrumb"}},[_vm._t("avatar"),_vm._v(" "),_c('b-breadcrumb',_vm._g(_vm._b({staticClass:"gl-breadcrumb-list"},'b-breadcrumb',_vm.$attrs,false),_vm.$listeners),[_vm._l((_vm.items),function(item,index){return [_c('b-breadcrumb-item',{key:index,ref:_vm.isFirstItem(index) ? 'firstItem' : null,refInFor:true,staticClass:"gl-breadcrumb-item",class:{ 'gl-display-none': _vm.isItemCollapsed(index) },attrs:{"text":item.text,"href":item.href,"to":item.to}},[_c('span',[_vm._v(_vm._s(item.text))]),_vm._v(" "),(!_vm.isLastItem(index))?_c('span',{key:(index + " " + (item.text)),staticClass:"gl-breadcrumb-separator",attrs:{"data-testid":"separator"}},[_vm._t("separator",[_c('gl-icon',{attrs:{"name":"chevron-right"}})])],2):_vm._e()]),_vm._v(" "),(_vm.showCollapsedBreadcrumbsExpander(index))?[_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip.hover",value:('Show all breadcrumbs'),expression:"'Show all breadcrumbs'",modifiers:{"hover":true}}],attrs:{"aria-label":"Show all breadcrumbs","data-testid":"collapsed-expander","icon":"ellipsis_h","category":"primary"},on:{"click":_vm.expandBreadcrumbs}}),_vm._v(" "),_c('span',{key:"expander",staticClass:"gl-display-inline-flex gl-text-gray-500",attrs:{"data-testid":"expander-separator"}},[_vm._t("separator",[_c('gl-icon',{attrs:{"name":"chevron-right"}})])],2)]:_vm._e()]})],2)],2)};
99
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',{staticClass:"gl-breadcrumbs",attrs:{"aria-label":"Breadcrumb"}},[_vm._t("avatar"),_vm._v(" "),_c('b-breadcrumb',_vm._g(_vm._b({staticClass:"gl-breadcrumb-list"},'b-breadcrumb',_vm.$attrs,false),_vm.$listeners),[_vm._l((_vm.items),function(item,index){return [_c('gl-breadcrumb-item',{key:index,ref:_vm.isFirstItem(index) ? 'firstItem' : null,refInFor:true,class:{ 'gl-display-none': _vm.isItemCollapsed(index) },attrs:{"text":item.text,"href":item.href,"to":item.to,"aria-current":_vm.getAriaCurrentAttr(index)}},[_c('span',[_vm._v(_vm._s(item.text))]),_vm._v(" "),(!_vm.isLastItem(index))?_c('span',{key:(index + " " + (item.text)),staticClass:"gl-breadcrumb-separator",attrs:{"data-testid":"separator"}},[_vm._t("separator",[_c('gl-icon',{attrs:{"name":"chevron-right"}})])],2):_vm._e()]),_vm._v(" "),(_vm.showCollapsedBreadcrumbsExpander(index))?[_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip.hover",value:('Show all breadcrumbs'),expression:"'Show all breadcrumbs'",modifiers:{"hover":true}}],attrs:{"aria-label":"Show all breadcrumbs","data-testid":"collapsed-expander","icon":"ellipsis_h","category":"primary"},on:{"click":_vm.expandBreadcrumbs}}),_vm._v(" "),_c('span',{key:"expander",staticClass:"gl-display-inline-flex gl-text-gray-500",attrs:{"data-testid":"expander-separator"}},[_vm._t("separator",[_c('gl-icon',{attrs:{"name":"chevron-right"}})])],2)]:_vm._e()]})],2)],2)};
95
100
  var __vue_staticRenderFns__ = [];
96
101
 
97
102
  /* style */
@@ -1,41 +1,45 @@
1
+ import { BLink } from 'bootstrap-vue/esm/index.js';
1
2
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
3
 
3
- const testTokens = [{
4
- type: 'unique',
5
- title: 'Unique',
6
- icon: 'document',
7
- token: 'gl-filtered-search-token',
8
- operators: [{
9
- value: '=',
10
- description: 'is',
11
- default: 'true'
12
- }],
13
- options: [{
14
- icon: 'heart',
15
- title: 'heart',
16
- value: 1
17
- }, {
18
- icon: 'hook',
19
- title: 'hook',
20
- value: 2
21
- }],
22
- unique: true
23
- }];
24
4
  var script = {
25
- data() {
26
- return {
27
- tokens: testTokens,
28
- value: []
29
- };
30
- }
5
+ components: {
6
+ BLink
7
+ },
8
+ inheritAttrs: false,
9
+ props: {
10
+ text: {
11
+ type: String,
12
+ required: false,
13
+ default: null
14
+ },
15
+ to: {
16
+ type: [String, Object],
17
+ required: false,
18
+ default: null
19
+ },
20
+ href: {
21
+ type: String,
22
+ required: false,
23
+ default: null
24
+ },
25
+ ariaCurrent: {
26
+ type: [String, Boolean],
27
+ required: false,
28
+ default: false,
29
+
30
+ validator(value) {
31
+ return [false, 'page'].indexOf(value) !== -1;
32
+ }
31
33
 
34
+ }
35
+ }
32
36
  };
33
37
 
34
38
  /* script */
35
39
  const __vue_script__ = script;
36
40
 
37
41
  /* template */
38
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._v("\n "+_vm._s(_vm.value)+"\n "),_c('gl-filtered-search',{attrs:{"available-tokens":_vm.tokens},model:{value:(_vm.value),callback:function ($$v) {_vm.value=$$v;},expression:"value"}})],1)};
42
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('li',{staticClass:"gl-breadcrumb-item"},[_c('b-link',{attrs:{"href":_vm.href,"to":_vm.to,"aria-current":_vm.ariaCurrent}},[_vm._t("default",[_vm._v(_vm._s(_vm.text))])],2)],1)};
39
43
  var __vue_staticRenderFns__ = [];
40
44
 
41
45
  /* style */
@@ -1,6 +1,4 @@
1
- import examples from './examples';
2
-
3
- var filtered_search = "# Filtered Search\n\nThe filtered search component is responsible for managing search with possible filters.\n\n## Usage\n\nEach filter option (named token) requires a separate Vue component. `GlFilteredSearchToken` is an\nexample of such a token.\n\nPrepare array of available token configurations with the following fields:\n\n- `type`: unique identifier of token type\n- `title`: human-readable title of the token\n- `icon`: token icon\n- `token`: (optional) the token Vue component to use (e.g. `AuthorToken`)\n- `dataType`: (optional) identifier of type (for example \"user\") for this filter. Tokens\n of the same type could be switched without losing their values\n- `unique`: (optional) indicate this token could appear only once in the filter\n- `disabled`: (optional) indicate this token should be hidden from the dropdown\n- `operators`: (optional) an array of selectable operators.\n Each array item is an object that must contain `value` and `description`, and optionally `default`\n (e.g. `{ value: '=', description: 'is', default: 'true' }`)\n- `multiSelect`: (optional) when `true`, the suggestions list becomes multi-select instead of single-select.\n It is discouraged to use this together with `unique`, as `unique` is intended for single-select.\n- `options`: (optional) an array of options which the user can pick after the operator has been selected.\n The option object can have the following properties defined: `value`, `icon`, `text`, and `default`\n all of which are expected be of type `string`. If the `default` is omitted, the `value` of the first\n option will be displayed as a suggestion\n- any additional fields required to configure your component\n\nEach token for filtered search is a Vue component with the following props:\n\n- `value`: an object with a `data` property containing the current value, and optionally an\n`operator` value containing the operator value\n- `active`: indicates if the token is currently active. It's the token's responsibility\n to render proper control for editing (for example input).\n- `current-value`: current tokens of the filtered search.\n- `index`: current token position in the filtered search.\n- `config`: additional configuration, supplied in filtered search config for this token.\n\nThe token should emit the following events:\n\n- `activate`: when the token requests activation (for example, when being clicked).\n- `deactivate`: when token requests deactivation (for example due to losing blur on input).\n- `destroy`: when token requests self-destruction (for instance for clicking \"X\" sign).\n- `replace`: token requests its replacement with another token.\n- `split`: token requests adding string values after the current token.\n- `complete`: token indicates its editing is completed.\n\n## Examples\n\nDefine a list of available tokens:\n\n```js\nconst availableTokens = [\n { type: 'static', icon: 'label', title: 'static:token', token: staticToken },\n { type: 'dynamic', icon: 'rocket', title: 'dynamic:~token', token: dynamicToken },\n];\n```\n\nPass the list of tokens to the search component. Optionally, you can use `v-model` to receive\nrealtime updates:\n\n```js\n <gl-filtered-search :available-tokens=\"tokens\" v-model=\"value\" />\n```\n";
1
+ var filtered_search = "The filtered search component is responsible for managing search with possible filters.\n\n## Usage\n\nEach filter option (named token) requires a separate Vue component. `GlFilteredSearchToken` is an\nexample of such a token.\n\nPrepare array of available token configurations with the following fields:\n\n- `type`: unique identifier of token type\n- `title`: human-readable title of the token\n- `icon`: token icon\n- `token`: (optional) the token Vue component to use (e.g. `AuthorToken`)\n- `dataType`: (optional) identifier of type (for example \"user\") for this filter. Tokens\n of the same type could be switched without losing their values\n- `unique`: (optional) indicate this token could appear only once in the filter\n- `disabled`: (optional) indicate this token should be hidden from the dropdown\n- `operators`: (optional) an array of selectable operators.\n Each array item is an object that must contain `value` and `description`, and optionally `default`\n (e.g. `{ value: '=', description: 'is', default: 'true' }`)\n- `multiSelect`: (optional) when `true`, the suggestions list becomes multi-select instead of single-select.\n It is discouraged to use this together with `unique`, as `unique` is intended for single-select.\n- `options`: (optional) an array of options which the user can pick after the operator has been selected.\n The option object can have the following properties defined: `value`, `icon`, `text`, and `default`\n all of which are expected be of type `string`. If the `default` is omitted, the `value` of the first\n option will be displayed as a suggestion\n- any additional fields required to configure your component\n\nEach token for filtered search is a Vue component with the following props:\n\n- `value`: an object with a `data` property containing the current value, and optionally an\n`operator` value containing the operator value\n- `active`: indicates if the token is currently active. It's the token's responsibility\n to render proper control for editing (for example input).\n- `current-value`: current tokens of the filtered search.\n- `index`: current token position in the filtered search.\n- `config`: additional configuration, supplied in filtered search config for this token.\n\nThe token should emit the following events:\n\n- `activate`: when the token requests activation (for example, when being clicked).\n- `deactivate`: when token requests deactivation (for example due to losing blur on input).\n- `destroy`: when token requests self-destruction (for instance for clicking \"X\" sign).\n- `replace`: token requests its replacement with another token.\n- `split`: token requests adding string values after the current token.\n- `complete`: token indicates its editing is completed.\n\n## Examples\n\nDefine a list of available tokens:\n\n```js\nconst availableTokens = [\n { type: 'static', icon: 'label', title: 'static:token', token: staticToken },\n { type: 'dynamic', icon: 'rocket', title: 'dynamic:~token', token: dynamicToken },\n];\n```\n\nPass the list of tokens to the search component. Optionally, you can use `v-model` to receive\nrealtime updates:\n\n```html\n\n<gl-filtered-search :available-tokens=\"tokens\" v-model=\"value\" />\n```\n";
4
2
 
5
3
  var description = /*#__PURE__*/Object.freeze({
6
4
  __proto__: null,
@@ -9,69 +7,7 @@ var description = /*#__PURE__*/Object.freeze({
9
7
 
10
8
  var filtered_search_documentation = {
11
9
  description,
12
- followsDesignSystem: true,
13
- bootstrapComponent: null,
14
- examples,
15
- propsInfo: {
16
- value: {
17
- additionalInfo: 'If provided, used as value of filtered search'
18
- },
19
- historyItems: {
20
- additionalInfo: 'If provided, used as history items for this component'
21
- },
22
- availableTokens: {
23
- additionalInfo: 'Available tokens'
24
- },
25
- placeholder: {
26
- additionalInfo: 'If provided, used as history items for this component'
27
- },
28
- recentSearchesHeader: {
29
- additionalInfo: 'i18n for recent searches title within history dropdown'
30
- },
31
- clearButtonTitle: {
32
- additionalInfo: 'i18n for clear button title'
33
- },
34
- closeButtonTitle: {
35
- additionalInfo: 'i18n for close button title within history dropdown'
36
- },
37
- clearRecentSearchesText: {
38
- additionalInfo: 'i18n for recent searches clear text'
39
- },
40
- suggestionsListClass: {
41
- additionalInfo: 'Additional classes to add to the suggestion list menu. NOTE: this not reactive, and the value must be available and fixed when the component is instantiated'
42
- },
43
- searchButtonAttributes: {
44
- additionalInfo: 'HTML attributes to add to the search button'
45
- },
46
- searchInputAttributes: {
47
- additionalInfo: 'HTML attributes to add to the search input'
48
- }
49
- },
50
- events: [{
51
- event: 'clear',
52
- description: 'Emitted when search is cleared'
53
- }, {
54
- event: 'submit',
55
- args: [{
56
- arg: 'tokens',
57
- description: '(Array)'
58
- }],
59
- description: 'Emitted when search is submitted'
60
- }, {
61
- event: 'history-item-selected',
62
- args: [{
63
- arg: 'value',
64
- description: 'History item'
65
- }],
66
- description: 'Emitted when item from history is selected'
67
- }, {
68
- event: 'clear-history',
69
- description: 'Emitted when clear history button is clicked'
70
- }],
71
- slots: [{
72
- name: 'history-item',
73
- description: 'Slot to customize history item in history dropdown. Used only if using history items'
74
- }]
10
+ followsDesignSystem: true
75
11
  };
76
12
 
77
13
  export default filtered_search_documentation;
@@ -1,4 +1,3 @@
1
- import _isEqual from 'lodash/isEqual';
2
1
  import _cloneDeep from 'lodash/cloneDeep';
3
2
  import PortalVue from 'portal-vue';
4
3
  import Vue from 'vue';
@@ -27,6 +26,7 @@ function initialState() {
27
26
  }
28
27
 
29
28
  var script = {
29
+ name: 'GlFilteredSearch',
30
30
  components: {
31
31
  GlSearchBoxByClick,
32
32
  GlIcon
@@ -50,16 +50,27 @@ var script = {
50
50
 
51
51
  inheritAttrs: false,
52
52
  props: {
53
+ /**
54
+ * If provided, used as value of filtered search
55
+ */
53
56
  value: {
54
57
  required: false,
55
58
  type: Array,
56
59
  default: () => []
57
60
  },
61
+
62
+ /**
63
+ * Available tokens
64
+ */
58
65
  availableTokens: {
59
66
  type: Array,
60
67
  required: false,
61
68
  default: () => []
62
69
  },
70
+
71
+ /**
72
+ * If provided, used as history items for this component
73
+ */
63
74
  placeholder: {
64
75
  type: String,
65
76
  required: false,
@@ -75,21 +86,38 @@ var script = {
75
86
  required: false,
76
87
  default: null
77
88
  },
89
+
90
+ /**
91
+ * Additional classes to add to the suggestion list menu. NOTE: this not reactive, and the value
92
+ * must be available and fixed when the component is instantiated
93
+ */
78
94
  suggestionsListClass: {
79
95
  type: [String, Array, Object],
80
96
  required: false,
81
97
  default: null
82
98
  },
99
+
100
+ /**
101
+ * Display operators' descriptions instead of their values (e.g., "is" instead of "=").
102
+ */
83
103
  showFriendlyText: {
84
104
  type: Boolean,
85
105
  required: false,
86
106
  default: false
87
107
  },
108
+
109
+ /**
110
+ * HTML attributes to add to the search button
111
+ */
88
112
  searchButtonAttributes: {
89
113
  type: Object,
90
114
  required: false,
91
115
  default: () => ({})
92
116
  },
117
+
118
+ /**
119
+ * HTML attributes to add to the search input
120
+ */
93
121
  searchInputAttributes: {
94
122
  type: Object,
95
123
  required: false,
@@ -147,18 +175,13 @@ var script = {
147
175
  if (this.tokens.length === 0 || !this.isLastTokenEmpty()) {
148
176
  this.tokens.push(createTerm());
149
177
  }
178
+ /**
179
+ * Emitted when the tokens (value) changes
180
+ * @property {array} tokens
181
+ */
150
182
 
151
- this.$emit('input', this.tokens);
152
- },
153
183
 
154
- deep: true,
155
- immediate: true
156
- },
157
- value: {
158
- handler(newValue, oldValue) {
159
- if (newValue.length && !_isEqual(newValue, oldValue)) {
160
- this.applyNewValue(_cloneDeep(newValue));
161
- }
184
+ this.$emit('input', this.tokens);
162
185
  },
163
186
 
164
187
  deep: true,
@@ -291,6 +314,10 @@ var script = {
291
314
  },
292
315
 
293
316
  submit() {
317
+ /**
318
+ * Emitted when search is submitted
319
+ * @property {array} tokens
320
+ */
294
321
  this.$emit('submit', normalizeTokens(_cloneDeep(this.tokens)));
295
322
  },
296
323
 
@@ -1,13 +1,7 @@
1
- var description = "# Filtered Search Suggestion\n\n<!-- STORY -->\n\n## Usage\n\nThe filtered search suggestion component is a wrapper around `GlDropdownItem`, which registers\nsuggestions in a top-level suggestion list:\n\n```js\n<gl-filtered-search-suggestion-list>\n <gl-filtered-search-suggestion value=\"foo\">Example suggestion</gl-filtered-search-suggestion>\n <gl-filtered-search-suggestion value=\"bar\">Example suggestion 2</gl-filtered-search-suggestion>\n</gl-filtered-search-suggestion-list>\n```\n";
1
+ var description = "The filtered search suggestion component is a wrapper around `GlDropdownItem`, which registers\nsuggestions in a top-level suggestion list:\n\n```html\n<gl-filtered-search-suggestion-list>\n <gl-filtered-search-suggestion value=\"foo\">Example suggestion</gl-filtered-search-suggestion>\n <gl-filtered-search-suggestion value=\"bar\">Example suggestion 2</gl-filtered-search-suggestion>\n</gl-filtered-search-suggestion-list>\n```\n";
2
2
 
3
3
  var filtered_search_suggestion_documentation = {
4
- description,
5
- bootstrapComponent: 'b-dropdown-item',
6
- propsInfo: {
7
- value: {
8
- additionalInfo: 'Value which will be emitted if this suggestion will be selected in list'
9
- }
10
- }
4
+ description
11
5
  };
12
6
 
13
7
  export default filtered_search_suggestion_documentation;
@@ -2,12 +2,16 @@ import GlDropdownItem from '../dropdown/dropdown_item';
2
2
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
3
3
 
4
4
  var script = {
5
+ name: 'GlFilteredSearchSuggestion',
5
6
  components: {
6
7
  GlDropdownItem
7
8
  },
8
9
  inject: ['filteredSearchSuggestionListInstance'],
9
10
  inheritAttrs: false,
10
11
  props: {
12
+ /**
13
+ * Value that will be emitted if this suggestion is selected.
14
+ */
11
15
  value: {
12
16
  required: true,
13
17
  validator: () => true
@@ -1,12 +1,7 @@
1
- var description = "# Filtered Search Suggestion\n\n<!-- STORY -->\n\n## Usage\n\nThe filtered search suggestion list component is responsible for managing underlying suggestion instances.\nYou obtain the ref for this component and manage suggestion selection via the component public API:\n\n- `getValue()` - Retrieves the current selected suggestion.\n- `nextItem()` - Selects the next suggestion. If last suggestion was selected, selection is cleared.\n- `prevItem()` - Selects the previous suggestion. If first suggestion was selected, selection is cleared.\n\n```js\n<gl-filtered-search-suggestion-list ref=\"suggestions\">\n <gl-filtered-search-suggestion value=\"foo\">Example suggestion</gl-filtered-search-suggestion>\n <gl-filtered-search-suggestion value=\"bar\">Example suggestion 2</gl-filtered-search-suggestion>\n</gl-filtered-search-suggestion-list>\n```\n";
1
+ var description = "The filtered search suggestion list component is responsible for managing underlying suggestion instances.\nYou obtain the ref for this component and manage suggestion selection via the component public API:\n\n- `getValue()` - Retrieves the current selected suggestion.\n- `nextItem()` - Selects the next suggestion. If last suggestion was selected, selection is cleared.\n- `prevItem()` - Selects the previous suggestion. If first suggestion was selected, selection is cleared.\n\n```html\n<gl-filtered-search-suggestion-list ref=\"suggestions\">\n <gl-filtered-search-suggestion value=\"foo\">Example suggestion</gl-filtered-search-suggestion>\n <gl-filtered-search-suggestion value=\"bar\">Example suggestion 2</gl-filtered-search-suggestion>\n</gl-filtered-search-suggestion-list>\n```\n";
2
2
 
3
3
  var filtered_search_suggestion_list_documentation = {
4
- description,
5
- propsInfo: {
6
- initialValue: {
7
- additionalInfo: 'Value to be initially selected in list'
8
- }
9
- }
4
+ description
10
5
  };
11
6
 
12
7
  export default filtered_search_suggestion_list_documentation;
@@ -1,6 +1,7 @@
1
1
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
2
 
3
3
  var script = {
4
+ name: 'GlFilteredSearchSuggestionList',
4
5
  inject: ['suggestionsListClass'],
5
6
 
6
7
  provide() {
@@ -10,6 +11,9 @@ var script = {
10
11
  },
11
12
 
12
13
  props: {
14
+ /**
15
+ * Value to be initially selected in list.
16
+ */
13
17
  initialValue: {
14
18
  required: false,
15
19
  validator: () => true,
@@ -1,4 +1,4 @@
1
- var filtered_search_term = "# Filtered Search Term\n\nThe filtered search term is a component for managing \"free input\" in the filtered search component.\nIt is responsible for autocompleting available tokens and \"converting\" to a relevant\ncomponent when an autocomplete item is selected.\n\n## Usage\n\nThis component is internal and is not intended to be used by `@gitlab/ui` users.\n";
1
+ var filtered_search_term = "The filtered search term is a component for managing \"free input\" in the filtered search component.\nIt is responsible for autocompleting available tokens and \"converting\" to a relevant\ncomponent when an autocomplete item is selected.\n\n## Usage\n\nThis component is internal and is not intended to be used by `@gitlab/ui` users.\n";
2
2
 
3
3
  var description = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
@@ -6,49 +6,7 @@ var description = /*#__PURE__*/Object.freeze({
6
6
  });
7
7
 
8
8
  var filtered_search_term_documentation = {
9
- description,
10
- bootstrapComponent: null,
11
- propsInfo: {
12
- availableTokens: {
13
- additionalInfo: 'Tokens available for this filtered search instance'
14
- },
15
- active: {
16
- additionalInfo: 'If this term token is currently active'
17
- },
18
- value: {
19
- additionalInfo: 'Current term value'
20
- },
21
- searchInputAttributes: {
22
- additionalInfo: 'HTML attributes to add to the search input'
23
- },
24
- isLastToken: {
25
- additionalInfo: 'If this is the last token'
26
- }
27
- },
28
- events: [{
29
- event: 'activate',
30
- description: 'Emitted when this term token is clicked'
31
- }, {
32
- event: 'deactivate',
33
- description: 'Emitted when this term token loses its focus'
34
- }, {
35
- event: 'destroy',
36
- description: 'Emitted when token value is empty and backspace is pressed'
37
- }, {
38
- event: 'replace',
39
- args: [{
40
- arg: 'token',
41
- description: '(Object) Replacement token configuration'
42
- }],
43
- description: 'Emitted when autocomplete entry is selected'
44
- }, {
45
- event: 'split',
46
- args: [{
47
- arg: 'newTokens',
48
- description: '(Array) Token configurations'
49
- }],
50
- description: 'Emitted when Space is pressed in-between term text'
51
- }]
9
+ description
52
10
  };
53
11
 
54
12
  export default filtered_search_term_documentation;
@@ -4,21 +4,33 @@ import { INTENT_ACTIVATE_PREVIOUS } from './filtered_search_utils';
4
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
5
 
6
6
  var script = {
7
+ name: 'GlFilteredSearchTerm',
7
8
  components: {
8
9
  GlFilteredSearchTokenSegment,
9
10
  GlFilteredSearchSuggestion
10
11
  },
11
12
  inheritAttrs: false,
12
13
  props: {
14
+ /**
15
+ * Tokens available for this filtered search instance.
16
+ */
13
17
  availableTokens: {
14
18
  type: Array,
15
19
  required: true
16
20
  },
21
+
22
+ /**
23
+ * Determines if the term is being edited or not.
24
+ */
17
25
  active: {
18
26
  type: Boolean,
19
27
  required: false,
20
28
  default: false
21
29
  },
30
+
31
+ /**
32
+ * Current term value.
33
+ */
22
34
  value: {
23
35
  type: Object,
24
36
  required: false,
@@ -31,16 +43,28 @@ var script = {
31
43
  required: false,
32
44
  default: ''
33
45
  },
46
+
47
+ /**
48
+ * HTML attributes to add to the search input.
49
+ */
34
50
  searchInputAttributes: {
35
51
  type: Object,
36
52
  required: false,
37
53
  default: () => ({})
38
54
  },
55
+
56
+ /**
57
+ * If this is the last token.
58
+ */
39
59
  isLastToken: {
40
60
  type: Boolean,
41
61
  required: false,
42
62
  default: false
43
63
  },
64
+
65
+ /**
66
+ * The current `value` (tokens) of the ancestor GlFilteredSearch component.
67
+ */
44
68
  currentValue: {
45
69
  type: Array,
46
70
  required: false,
@@ -58,6 +82,12 @@ var script = {
58
82
  },
59
83
 
60
84
  set(data) {
85
+ /**
86
+ * Emitted when the token changes its value.
87
+ *
88
+ * @event input
89
+ * @type {object} dataObj Object containing the update value.
90
+ */
61
91
  this.$emit('input', {
62
92
  data
63
93
  });
@@ -67,6 +97,13 @@ var script = {
67
97
  },
68
98
  methods: {
69
99
  onBackspace() {
100
+ /**
101
+ * Emitted when token value is empty and backspace is pressed.
102
+ * Includes user intent to activate previous token.
103
+ *
104
+ * @event destroy
105
+ * @type {object} details The user intent
106
+ */
70
107
  this.$emit('destroy', {
71
108
  intent: INTENT_ACTIVATE_PREVIOUS
72
109
  });
@@ -1,4 +1,4 @@
1
- var filtered_search_token = "# Filtered Search Binary Token\n\nFiltered search token is a helper component, intended to\nsimplify the creation of filters tokens which consist of a title, operators\nand an editable value with autocomplete. This component abstracts token management\nlogic and allows you to focus on implementing autocomplete or view logic.\n\nThis component is not intended to be used outside of the `GlFilteredSearch` component.\n\n## Usage\n\nMake sure to pass `$listeners` to `gl-filtered-search-token`, or route events properly:\n\n```js\n<gl-filtered-search-token\n title=\"Confidential\"\n :active=\"active\"\n :value=\"value\"\n v-on=\"$listeners\"\n>\n <template #suggestions>\n <gl-filtered-search-suggestion value=\"Yes\"><gl-icon name=\"eye-slash\" :size=\"16\"/> Yes</gl-filtered-search-suggestion>\n <gl-filtered-search-suggestion value=\"No\"><gl-icon name=\"eye\" :size=\"16\"/> No</gl-filtered-search-suggestion>\n </template>\n</gl-filtered-search-token>\n```\n";
1
+ var filtered_search_token = "Filtered search token is a helper component, intended to\nsimplify the creation of filters tokens which consist of a title, operators\nand an editable value with autocomplete. This component abstracts token management\nlogic and allows you to focus on implementing autocomplete or view logic.\n\nThis component is not intended to be used outside of the `GlFilteredSearch` component.\n\n## Usage\n\nMake sure to pass `$listeners` to `gl-filtered-search-token`, or route events properly:\n\n```html\n<gl-filtered-search-token\n title=\"Confidential\"\n :active=\"active\"\n :value=\"value\"\n v-on=\"$listeners\"\n>\n <template #suggestions>\n <gl-filtered-search-suggestion value=\"Yes\"><gl-icon name=\"eye-slash\" :size=\"16\"/> Yes</gl-filtered-search-suggestion>\n <gl-filtered-search-suggestion value=\"No\"><gl-icon name=\"eye\" :size=\"16\"/> No</gl-filtered-search-suggestion>\n </template>\n</gl-filtered-search-token>\n```\n";
2
2
 
3
3
  var description = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
@@ -6,36 +6,7 @@ var description = /*#__PURE__*/Object.freeze({
6
6
  });
7
7
 
8
8
  var filtered_search_token_documentation = {
9
- description,
10
- bootstrapComponent: null,
11
- propsInfo: {
12
- title: {
13
- additionalInfo: 'Token title'
14
- },
15
- config: {
16
- additionalInfo: 'Token configuration with available operators and options'
17
- },
18
- active: {
19
- additionalInfo: 'If this token is currently active'
20
- },
21
- value: {
22
- additionalInfo: 'Current value'
23
- },
24
- replace: {
25
- args: [{
26
- arg: 'token',
27
- description: '(Object) Replacement token configuration'
28
- }],
29
- description: 'Emitted when this token is converted to another type'
30
- }
31
- },
32
- slots: [{
33
- name: 'view',
34
- description: 'Template for token value in inactive state'
35
- }, {
36
- name: 'suggestions',
37
- description: 'Slot for rendering autocomplete suggestions when no options are provided.'
38
- }]
9
+ description
39
10
  };
40
11
 
41
12
  export default filtered_search_token_documentation;