carbon-components-angular 5.13.1 → 5.14.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 (35) hide show
  1. package/combobox/combobox.component.d.ts +6 -3
  2. package/docs/documentation/components/ComboBox.html +231 -138
  3. package/docs/documentation/coverage.html +1 -1
  4. package/docs/documentation/js/search/search_index.js +2 -2
  5. package/docs/documentation/modules/TilesModule/dependencies.svg +98 -98
  6. package/docs/documentation/modules/TilesModule.html +98 -98
  7. package/docs/documentation/modules/TimePickerModule/dependencies.svg +4 -4
  8. package/docs/documentation/modules/TimePickerModule.html +4 -4
  9. package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +49 -45
  10. package/docs/documentation/modules/TimePickerSelectModule.html +49 -45
  11. package/docs/documentation/modules/ToggleModule/dependencies.svg +4 -4
  12. package/docs/documentation/modules/ToggleModule.html +4 -4
  13. package/docs/documentation/modules/ToggletipModule/dependencies.svg +37 -37
  14. package/docs/documentation/modules/ToggletipModule.html +37 -37
  15. package/docs/documentation/modules/TooltipModule/dependencies.svg +28 -28
  16. package/docs/documentation/modules/TooltipModule.html +28 -28
  17. package/docs/documentation/modules/UIShellModule/dependencies.svg +4 -4
  18. package/docs/documentation/modules/UIShellModule.html +4 -4
  19. package/docs/documentation.json +127 -102
  20. package/docs/storybook/9115.b37cce0a.iframe.bundle.js +1 -0
  21. package/docs/storybook/combobox-combobox-stories.07443101.iframe.bundle.js +1 -0
  22. package/docs/storybook/iframe.html +2 -2
  23. package/docs/storybook/main.0fc88865.iframe.bundle.js +1 -0
  24. package/docs/storybook/project.json +1 -1
  25. package/docs/storybook/{runtime~main.c4aa93fd.iframe.bundle.js → runtime~main.66a4fe80.iframe.bundle.js} +1 -1
  26. package/docs/storybook/{slider-slider-stories.feee50aa.iframe.bundle.js → slider-slider-stories.67a7e6a8.iframe.bundle.js} +1 -1
  27. package/esm2020/combobox/combobox.component.mjs +23 -19
  28. package/fesm2015/carbon-components-angular-combobox.mjs +22 -18
  29. package/fesm2015/carbon-components-angular-combobox.mjs.map +1 -1
  30. package/fesm2020/carbon-components-angular-combobox.mjs +22 -18
  31. package/fesm2020/carbon-components-angular-combobox.mjs.map +1 -1
  32. package/package.json +1 -1
  33. package/docs/storybook/9115.e3ed2f59.iframe.bundle.js +0 -1
  34. package/docs/storybook/combobox-combobox-stories.48876c96.iframe.bundle.js +0 -1
  35. package/docs/storybook/main.43c62519.iframe.bundle.js +0 -1
@@ -21739,7 +21739,7 @@
21739
21739
  },
21740
21740
  {
21741
21741
  "name": "ComboBox",
21742
- "id": "component-ComboBox-c507b69ada729c040d6555d7153a4a56deec52c4c3d740d5de060621e7b7b3088a7bcd6dde802ff447192542b21230e82565c95a236de61c013d1567be6f6d67",
21742
+ "id": "component-ComboBox-3a6c05e0d547b73b32756e8c15beec5130ffeb8982bdfdf8a31a551cf7d5882185295fbea4a136e53b8f9bd9481b03223a4bdfb3353f56d2e1dc8e3735dcae16",
21743
21743
  "file": "src/combobox/combobox.component.ts",
21744
21744
  "encapsulation": [],
21745
21745
  "entryComponents": [],
@@ -21765,7 +21765,7 @@
21765
21765
  "deprecationMessage": "",
21766
21766
  "rawdescription": "\n\nset to `true` to place the dropdown view inline with the component\n",
21767
21767
  "description": "<p>set to <code>true</code> to place the dropdown view inline with the component</p>\n",
21768
- "line": 306,
21768
+ "line": 305,
21769
21769
  "type": "boolean",
21770
21770
  "decorators": []
21771
21771
  },
@@ -21776,7 +21776,7 @@
21776
21776
  "deprecationMessage": "",
21777
21777
  "rawdescription": "\n\nSpecify aria-autocomplete attribute of text input.\n\"list\", is the expected value for a combobox that invokes a drop-down list\n",
21778
21778
  "description": "<p>Specify aria-autocomplete attribute of text input.\n&quot;list&quot;, is the expected value for a combobox that invokes a drop-down list</p>\n",
21779
- "line": 342,
21779
+ "line": 341,
21780
21780
  "type": "string",
21781
21781
  "decorators": []
21782
21782
  },
@@ -21786,7 +21786,7 @@
21786
21786
  "deprecationMessage": "",
21787
21787
  "rawdescription": "\n\nValue to display for accessibility purposes on the clear the selected item icon, when single is selected\n",
21788
21788
  "description": "<p>Value to display for accessibility purposes on the clear the selected item icon, when single is selected</p>\n",
21789
- "line": 247,
21789
+ "line": 246,
21790
21790
  "type": "string | Observable",
21791
21791
  "decorators": []
21792
21792
  },
@@ -21796,7 +21796,7 @@
21796
21796
  "deprecationMessage": "",
21797
21797
  "rawdescription": "\n\nValue to display for accessibility purposes to clear selections, when multi is selected\n",
21798
21798
  "description": "<p>Value to display for accessibility purposes to clear selections, when multi is selected</p>\n",
21799
- "line": 227,
21799
+ "line": 226,
21800
21800
  "type": "string | Observable",
21801
21801
  "decorators": []
21802
21802
  },
@@ -21806,7 +21806,7 @@
21806
21806
  "deprecationMessage": "",
21807
21807
  "rawdescription": "\n\nValue to display on the clear selections icon, when multi is selected\n",
21808
21808
  "description": "<p>Value to display on the clear selections icon, when multi is selected</p>\n",
21809
- "line": 217,
21809
+ "line": 216,
21810
21810
  "type": "string | Observable",
21811
21811
  "decorators": []
21812
21812
  },
@@ -21816,7 +21816,7 @@
21816
21816
  "deprecationMessage": "",
21817
21817
  "rawdescription": "\n\nValue to display on the clear the selected item icon, when single is selected\n",
21818
21818
  "description": "<p>Value to display on the clear the selected item icon, when single is selected</p>\n",
21819
- "line": 237,
21819
+ "line": 236,
21820
21820
  "type": "string | Observable",
21821
21821
  "decorators": []
21822
21822
  },
@@ -21826,7 +21826,7 @@
21826
21826
  "deprecationMessage": "",
21827
21827
  "rawdescription": "\n\nValue to display for accessibility purposes on the combobox control menu when opened\n",
21828
21828
  "description": "<p>Value to display for accessibility purposes on the combobox control menu when opened</p>\n",
21829
- "line": 207,
21829
+ "line": 206,
21830
21830
  "type": "string | Observable",
21831
21831
  "decorators": []
21832
21832
  },
@@ -21837,7 +21837,7 @@
21837
21837
  "deprecationMessage": "",
21838
21838
  "rawdescription": "\n\nSet to `true` to disable combobox.\n",
21839
21839
  "description": "<p>Set to <code>true</code> to disable combobox.</p>\n",
21840
- "line": 350,
21840
+ "line": 349,
21841
21841
  "type": "boolean",
21842
21842
  "decorators": []
21843
21843
  },
@@ -21847,7 +21847,7 @@
21847
21847
  "deprecationMessage": "",
21848
21848
  "rawdescription": "\n\nOverrides the automatic dropUp.\n",
21849
21849
  "description": "<p>Overrides the automatic dropUp.</p>\n",
21850
- "line": 346,
21850
+ "line": 345,
21851
21851
  "type": "boolean",
21852
21852
  "decorators": []
21853
21853
  },
@@ -21857,7 +21857,7 @@
21857
21857
  "deprecationMessage": "",
21858
21858
  "rawdescription": "\n\nSets the optional helper text.\n",
21859
21859
  "description": "<p>Sets the optional helper text.</p>\n",
21860
- "line": 302,
21860
+ "line": 301,
21861
21861
  "type": "string | TemplateRef<any>",
21862
21862
  "decorators": []
21863
21863
  },
@@ -21866,7 +21866,7 @@
21866
21866
  "defaultValue": "`dropdown-${ComboBox.comboBoxCount++}`",
21867
21867
  "deprecated": false,
21868
21868
  "deprecationMessage": "",
21869
- "line": 255,
21869
+ "line": 254,
21870
21870
  "type": "string",
21871
21871
  "decorators": []
21872
21872
  },
@@ -21877,7 +21877,7 @@
21877
21877
  "deprecationMessage": "",
21878
21878
  "rawdescription": "\n\nSet to `true` to show the invalid state.\n",
21879
21879
  "description": "<p>Set to <code>true</code> to show the invalid state.</p>\n",
21880
- "line": 310,
21880
+ "line": 309,
21881
21881
  "type": "boolean",
21882
21882
  "decorators": []
21883
21883
  },
@@ -21887,7 +21887,7 @@
21887
21887
  "deprecationMessage": "",
21888
21888
  "rawdescription": "\n\nValue displayed if combobox is in an invalid state.\n",
21889
21889
  "description": "<p>Value displayed if combobox is in an invalid state.</p>\n",
21890
- "line": 314,
21890
+ "line": 313,
21891
21891
  "type": "string | TemplateRef<any>",
21892
21892
  "decorators": []
21893
21893
  },
@@ -21898,7 +21898,7 @@
21898
21898
  "deprecationMessage": "",
21899
21899
  "rawdescription": "\n\nList of items to fill the content with.\n\n**Example:**\n```javascript\nitems = [\n\t\t{\n\t\t\tcontent: \"Abacus\",\n\t\t\tselected: false\n\t\t},\n\t\t{\n\t\t\tcontent: \"Byte\",\n\t\t\tselected: false,\n\t\t},\n\t\t{\n\t\t\tcontent: \"Computer\",\n\t\t\tselected: false\n\t\t},\n\t\t{\n\t\t\tcontent: \"Digital\",\n\t\t\tselected: false\n\t\t}\n];\n```\n\n",
21900
21900
  "description": "<p>List of items to fill the content with.</p>\n<p><strong>Example:</strong></p>\n<div><pre class=\"line-numbers\"><code class=\"language-javascript\">items = [\n {\n content: &quot;Abacus&quot;,\n selected: false\n },\n {\n content: &quot;Byte&quot;,\n selected: false,\n },\n {\n content: &quot;Computer&quot;,\n selected: false\n },\n {\n content: &quot;Digital&quot;,\n selected: false\n }\n];</code></pre></div>",
21901
- "line": 282,
21901
+ "line": 281,
21902
21902
  "type": "Array<ListItem>",
21903
21903
  "decorators": []
21904
21904
  },
@@ -21908,7 +21908,7 @@
21908
21908
  "deprecationMessage": "",
21909
21909
  "rawdescription": "\n\nSpecifies the property to be used as the return value to `ngModel`\n",
21910
21910
  "description": "<p>Specifies the property to be used as the return value to <code>ngModel</code></p>\n",
21911
- "line": 294,
21911
+ "line": 293,
21912
21912
  "type": "string",
21913
21913
  "decorators": []
21914
21914
  },
@@ -21918,7 +21918,7 @@
21918
21918
  "deprecationMessage": "",
21919
21919
  "rawdescription": "\n\nLabel for the combobox.\n",
21920
21920
  "description": "<p>Label for the combobox.</p>\n",
21921
- "line": 298,
21921
+ "line": 297,
21922
21922
  "type": "string | TemplateRef<any>",
21923
21923
  "decorators": []
21924
21924
  },
@@ -21929,7 +21929,7 @@
21929
21929
  "deprecationMessage": "",
21930
21930
  "rawdescription": "\n\nMax length value to limit input characters\n",
21931
21931
  "description": "<p>Max length value to limit input characters</p>\n",
21932
- "line": 326,
21932
+ "line": 325,
21933
21933
  "type": "number",
21934
21934
  "decorators": []
21935
21935
  },
@@ -21939,7 +21939,7 @@
21939
21939
  "deprecationMessage": "",
21940
21940
  "rawdescription": "\n\nValue to display for accessibility purposes on the combobox control menu when closed\n",
21941
21941
  "description": "<p>Value to display for accessibility purposes on the combobox control menu when closed</p>\n",
21942
- "line": 197,
21942
+ "line": 196,
21943
21943
  "type": "string | Observable",
21944
21944
  "decorators": []
21945
21945
  },
@@ -21949,7 +21949,7 @@
21949
21949
  "deprecationMessage": "",
21950
21950
  "rawdescription": "\n\nText to show when nothing is selected.\n",
21951
21951
  "description": "<p>Text to show when nothing is selected.</p>\n",
21952
- "line": 187,
21952
+ "line": 186,
21953
21953
  "type": "string | Observable",
21954
21954
  "decorators": []
21955
21955
  },
@@ -21960,7 +21960,7 @@
21960
21960
  "deprecationMessage": "",
21961
21961
  "rawdescription": "\n\nSpecify feedback (mode) of the selection.\n`top`: selected item jumps to top\n`fixed`: selected item stays at its position\n`top-after-reopen`: selected item jump to top after reopen dropdown\n",
21962
21962
  "description": "<p>Specify feedback (mode) of the selection.\n<code>top</code>: selected item jumps to top\n<code>fixed</code>: selected item stays at its position\n<code>top-after-reopen</code>: selected item jump to top after reopen dropdown</p>\n",
21963
- "line": 337,
21963
+ "line": 336,
21964
21964
  "type": "\"top\" | \"fixed\" | \"top-after-reopen\"",
21965
21965
  "decorators": []
21966
21966
  },
@@ -21971,7 +21971,7 @@
21971
21971
  "deprecationMessage": "",
21972
21972
  "rawdescription": "\n\nCombo box render size.\n",
21973
21973
  "description": "<p>Combo box render size.</p>\n",
21974
- "line": 290,
21974
+ "line": 289,
21975
21975
  "type": "\"sm\" | \"md\" | \"lg\"",
21976
21976
  "decorators": []
21977
21977
  },
@@ -21982,15 +21982,15 @@
21982
21982
  "deprecationMessage": "since v5 - Use `cdsLayer` directive instead",
21983
21983
  "jsdoctags": [
21984
21984
  {
21985
- "pos": 9432,
21986
- "end": 9490,
21985
+ "pos": 9414,
21986
+ "end": 9472,
21987
21987
  "flags": 8421376,
21988
21988
  "modifierFlagsCache": 0,
21989
21989
  "transformFlags": 0,
21990
21990
  "kind": 334,
21991
21991
  "tagName": {
21992
- "pos": 9433,
21993
- "end": 9443,
21992
+ "pos": 9415,
21993
+ "end": 9425,
21994
21994
  "flags": 8421376,
21995
21995
  "modifierFlagsCache": 0,
21996
21996
  "transformFlags": 0,
@@ -22000,7 +22000,7 @@
22000
22000
  "comment": "<p>since v5 - Use <code>cdsLayer</code> directive instead</p>\n"
22001
22001
  }
22002
22002
  ],
22003
- "line": 330,
22003
+ "line": 329,
22004
22004
  "type": "\"light\" | \"dark\"",
22005
22005
  "decorators": []
22006
22006
  },
@@ -22011,7 +22011,7 @@
22011
22011
  "deprecationMessage": "",
22012
22012
  "rawdescription": "\n\nCombo box type (supporting single or multi selection of items).\n",
22013
22013
  "description": "<p>Combo box type (supporting single or multi selection of items).</p>\n",
22014
- "line": 286,
22014
+ "line": 285,
22015
22015
  "type": "\"single\" | \"multi\"",
22016
22016
  "decorators": []
22017
22017
  },
@@ -22022,7 +22022,7 @@
22022
22022
  "deprecationMessage": "",
22023
22023
  "rawdescription": "\n\nSet to `true` to show a warning (contents set by warnText)\n",
22024
22024
  "description": "<p>Set to <code>true</code> to show a warning (contents set by warnText)</p>\n",
22025
- "line": 318,
22025
+ "line": 317,
22026
22026
  "type": "boolean",
22027
22027
  "decorators": []
22028
22028
  },
@@ -22032,7 +22032,7 @@
22032
22032
  "deprecationMessage": "",
22033
22033
  "rawdescription": "\n\nSets the warning text\n",
22034
22034
  "description": "<p>Sets the warning text</p>\n",
22035
- "line": 322,
22035
+ "line": 321,
22036
22036
  "type": "string | TemplateRef<any>",
22037
22037
  "decorators": []
22038
22038
  }
@@ -22045,7 +22045,7 @@
22045
22045
  "deprecationMessage": "",
22046
22046
  "rawdescription": "\nEmits an event when the clear button is clicked.",
22047
22047
  "description": "<p>Emits an event when the clear button is clicked.</p>\n",
22048
- "line": 402,
22048
+ "line": 401,
22049
22049
  "type": "EventEmitter"
22050
22050
  },
22051
22051
  {
@@ -22055,7 +22055,7 @@
22055
22055
  "deprecationMessage": "",
22056
22056
  "rawdescription": "\nEmits an empty event when the menu is closed",
22057
22057
  "description": "<p>Emits an empty event when the menu is closed</p>\n",
22058
- "line": 398,
22058
+ "line": 397,
22059
22059
  "type": "EventEmitter"
22060
22060
  },
22061
22061
  {
@@ -22065,7 +22065,7 @@
22065
22065
  "deprecationMessage": "",
22066
22066
  "rawdescription": "\nEmits the search string from the input",
22067
22067
  "description": "<p>Emits the search string from the input</p>\n",
22068
- "line": 400,
22068
+ "line": 399,
22069
22069
  "type": "EventEmitter"
22070
22070
  },
22071
22071
  {
@@ -22075,17 +22075,17 @@
22075
22075
  "deprecationMessage": "",
22076
22076
  "rawdescription": "\n\nEmits a ListItem\n\nExample:\n```javascript\n{\n\t\tcontent: \"one\",\n\t\tselected: true\n}\n```\n",
22077
22077
  "description": "<p>Emits a ListItem</p>\n<p>Example:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-javascript\">{\n content: &quot;one&quot;,\n selected: true\n}</code></pre></div>",
22078
- "line": 362,
22078
+ "line": 361,
22079
22079
  "type": "EventEmitter"
22080
22080
  },
22081
22081
  {
22082
22082
  "name": "submit",
22083
- "defaultValue": "new EventEmitter <{\n\t\titems: ListItem[],\n\t\tindex: number,\n\t\tvalue: {\n\t\t\tcontent: string,\n\t\t\tselected: boolean\n\t\t}\n\t}>()",
22083
+ "defaultValue": "new EventEmitter<{\n\t\titems: ListItem[],\n\t\tindex: number,\n\t\tvalue: {\n\t\t\tcontent: string,\n\t\t\tselected: boolean\n\t\t}\n\t}>()",
22084
22084
  "deprecated": false,
22085
22085
  "deprecationMessage": "",
22086
22086
  "rawdescription": "\n\nIntended to be used to add items to the list.\n\nEmits an event that includes the current item list, the suggested index for the new item, and a simple ListItem\n\nExample:\n```javascript\n\t{\n\t\titems: [{content: \"one\", selected: true}, {content: \"two\", selected: true}],\n\t\tindex: 1,\n\t\tvalue: {\n\t\t\tcontent: \"some user string\",\n\t\t\tselected: false\n\t\t}\n\t}\n```\n\n\nExample:\n```javascript\n{\n\tafter: 1,\n\tvalue: \"some user string\"\n}\n```\n",
22087
22087
  "description": "<p>Intended to be used to add items to the list.</p>\n<p>Emits an event that includes the current item list, the suggested index for the new item, and a simple ListItem</p>\n<p>Example:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-javascript\"> {\n items: [{content: &quot;one&quot;, selected: true}, {content: &quot;two&quot;, selected: true}],\n index: 1,\n value: {\n content: &quot;some user string&quot;,\n selected: false\n }\n }</code></pre></div><p>Example:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-javascript\">{\n after: 1,\n value: &quot;some user string&quot;\n}</code></pre></div>",
22088
- "line": 389,
22088
+ "line": 388,
22089
22089
  "type": "EventEmitter"
22090
22090
  }
22091
22091
  ],
@@ -22109,7 +22109,7 @@
22109
22109
  "type": "number",
22110
22110
  "optional": false,
22111
22111
  "description": "",
22112
- "line": 254,
22112
+ "line": 253,
22113
22113
  "modifierKind": [
22114
22114
  124
22115
22115
  ]
@@ -22122,7 +22122,7 @@
22122
22122
  "type": "string",
22123
22123
  "optional": false,
22124
22124
  "description": "",
22125
- "line": 409,
22125
+ "line": 408,
22126
22126
  "decorators": [
22127
22127
  {
22128
22128
  "name": "HostBinding",
@@ -22140,7 +22140,7 @@
22140
22140
  "type": "",
22141
22141
  "optional": false,
22142
22142
  "description": "",
22143
- "line": 405,
22143
+ "line": 404,
22144
22144
  "decorators": [
22145
22145
  {
22146
22146
  "name": "ViewChild",
@@ -22159,7 +22159,7 @@
22159
22159
  "type": "",
22160
22160
  "optional": false,
22161
22161
  "description": "",
22162
- "line": 408,
22162
+ "line": 407,
22163
22163
  "decorators": [
22164
22164
  {
22165
22165
  "name": "HostBinding",
@@ -22177,7 +22177,7 @@
22177
22177
  "type": "ElementRef",
22178
22178
  "optional": false,
22179
22179
  "description": "",
22180
- "line": 406,
22180
+ "line": 405,
22181
22181
  "decorators": [
22182
22182
  {
22183
22183
  "name": "ViewChild",
@@ -22205,7 +22205,7 @@
22205
22205
  "type": "ElementRef",
22206
22206
  "optional": false,
22207
22207
  "description": "",
22208
- "line": 407,
22208
+ "line": 406,
22209
22209
  "decorators": [
22210
22210
  {
22211
22211
  "name": "ViewChild",
@@ -22224,11 +22224,21 @@
22224
22224
  "type": "",
22225
22225
  "optional": false,
22226
22226
  "description": "",
22227
- "line": 411,
22227
+ "line": 410,
22228
22228
  "modifierKind": [
22229
22229
  123
22230
22230
  ]
22231
22231
  },
22232
+ {
22233
+ "name": "outsideClick",
22234
+ "defaultValue": "this._outsideClick.bind(this)",
22235
+ "deprecated": false,
22236
+ "deprecationMessage": "",
22237
+ "type": "",
22238
+ "optional": false,
22239
+ "description": "",
22240
+ "line": 419
22241
+ },
22232
22242
  {
22233
22243
  "name": "pills",
22234
22244
  "defaultValue": "[]",
@@ -22237,7 +22247,7 @@
22237
22247
  "type": "[]",
22238
22248
  "optional": false,
22239
22249
  "description": "<p>Selected items for multi-select combo-boxes.</p>\n",
22240
- "line": 416,
22250
+ "line": 415,
22241
22251
  "rawdescription": "\nSelected items for multi-select combo-boxes.",
22242
22252
  "modifierKind": [
22243
22253
  123
@@ -22251,7 +22261,7 @@
22251
22261
  "type": "string",
22252
22262
  "optional": false,
22253
22263
  "description": "<p>used to update the displayValue</p>\n",
22254
- "line": 418,
22264
+ "line": 417,
22255
22265
  "rawdescription": "\nused to update the displayValue",
22256
22266
  "modifierKind": [
22257
22267
  123
@@ -22265,7 +22275,7 @@
22265
22275
  "type": "",
22266
22276
  "optional": false,
22267
22277
  "description": "",
22268
- "line": 413,
22278
+ "line": 412,
22269
22279
  "modifierKind": [
22270
22280
  123
22271
22281
  ]
@@ -22277,7 +22287,7 @@
22277
22287
  "type": "AbstractDropdownView",
22278
22288
  "optional": false,
22279
22289
  "description": "<p>ContentChild reference to the instantiated dropdown list</p>\n",
22280
- "line": 404,
22290
+ "line": 403,
22281
22291
  "rawdescription": "\nContentChild reference to the instantiated dropdown list",
22282
22292
  "decorators": [
22283
22293
  {
@@ -22297,7 +22307,7 @@
22297
22307
  "optional": false,
22298
22308
  "returnType": "void",
22299
22309
  "typeParameters": [],
22300
- "line": 812,
22310
+ "line": 807,
22301
22311
  "deprecated": false,
22302
22312
  "deprecationMessage": "",
22303
22313
  "rawdescription": "\n\nCreates the `Dropdown` list as an element that is appended to the DOM body.\n",
@@ -22309,7 +22319,7 @@
22309
22319
  "optional": false,
22310
22320
  "returnType": "void",
22311
22321
  "typeParameters": [],
22312
- "line": 823,
22322
+ "line": 818,
22313
22323
  "deprecated": false,
22314
22324
  "deprecationMessage": "",
22315
22325
  "rawdescription": "\n\nCreates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n",
@@ -22328,7 +22338,7 @@
22328
22338
  "optional": false,
22329
22339
  "returnType": "void",
22330
22340
  "typeParameters": [],
22331
- "line": 792,
22341
+ "line": 787,
22332
22342
  "deprecated": false,
22333
22343
  "deprecationMessage": "",
22334
22344
  "rawdescription": "\n\nHandles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n",
@@ -22351,17 +22361,47 @@
22351
22361
  "optional": false,
22352
22362
  "returnType": "void",
22353
22363
  "typeParameters": [],
22354
- "line": 594,
22364
+ "line": 585,
22355
22365
  "deprecated": false,
22356
22366
  "deprecationMessage": ""
22357
22367
  },
22368
+ {
22369
+ "name": "_outsideClick",
22370
+ "args": [
22371
+ {
22372
+ "name": "event",
22373
+ "type": "",
22374
+ "deprecated": false,
22375
+ "deprecationMessage": ""
22376
+ }
22377
+ ],
22378
+ "optional": false,
22379
+ "returnType": "void",
22380
+ "typeParameters": [],
22381
+ "line": 847,
22382
+ "deprecated": false,
22383
+ "deprecationMessage": "",
22384
+ "rawdescription": "\n\nHandles clicks outside of the `Dropdown` list.\n",
22385
+ "description": "<p>Handles clicks outside of the <code>Dropdown</code> list.</p>\n",
22386
+ "jsdoctags": [
22387
+ {
22388
+ "name": "event",
22389
+ "type": "",
22390
+ "deprecated": false,
22391
+ "deprecationMessage": "",
22392
+ "tagName": {
22393
+ "text": "param"
22394
+ }
22395
+ }
22396
+ ]
22397
+ },
22358
22398
  {
22359
22399
  "name": "_shouldDropUp",
22360
22400
  "args": [],
22361
22401
  "optional": false,
22362
22402
  "returnType": "any",
22363
22403
  "typeParameters": [],
22364
- "line": 832,
22404
+ "line": 827,
22365
22405
  "deprecated": false,
22366
22406
  "deprecationMessage": "",
22367
22407
  "rawdescription": "\n\nDetects whether or not the `Dropdown` list is visible within all scrollable parents.\nThis can be overridden by passing in a value to the `dropUp` input.\n",
@@ -22380,7 +22420,7 @@
22380
22420
  "optional": false,
22381
22421
  "returnType": "void",
22382
22422
  "typeParameters": [],
22383
- "line": 768,
22423
+ "line": 763,
22384
22424
  "deprecated": false,
22385
22425
  "deprecationMessage": "",
22386
22426
  "jsdoctags": [
@@ -22408,7 +22448,7 @@
22408
22448
  "optional": false,
22409
22449
  "returnType": "void",
22410
22450
  "typeParameters": [],
22411
- "line": 660,
22451
+ "line": 651,
22412
22452
  "deprecated": false,
22413
22453
  "deprecationMessage": "",
22414
22454
  "modifierKind": [
@@ -22432,7 +22472,7 @@
22432
22472
  "optional": false,
22433
22473
  "returnType": "void",
22434
22474
  "typeParameters": [],
22435
- "line": 680,
22475
+ "line": 671,
22436
22476
  "deprecated": false,
22437
22477
  "deprecationMessage": "",
22438
22478
  "rawdescription": "\n\nCloses the dropdown and emits the close event.\n",
@@ -22454,7 +22494,7 @@
22454
22494
  "optional": false,
22455
22495
  "returnType": "void",
22456
22496
  "typeParameters": [],
22457
- "line": 569,
22497
+ "line": 560,
22458
22498
  "deprecated": false,
22459
22499
  "deprecationMessage": "",
22460
22500
  "rawdescription": "\n\nHandles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n",
@@ -22493,7 +22533,7 @@
22493
22533
  "optional": false,
22494
22534
  "returnType": "boolean",
22495
22535
  "typeParameters": [],
22496
- "line": 785,
22536
+ "line": 780,
22497
22537
  "deprecated": false,
22498
22538
  "deprecationMessage": "",
22499
22539
  "modifierKind": [
@@ -22517,7 +22557,7 @@
22517
22557
  "optional": false,
22518
22558
  "returnType": "void",
22519
22559
  "typeParameters": [],
22520
- "line": 631,
22560
+ "line": 622,
22521
22561
  "deprecated": false,
22522
22562
  "deprecationMessage": ""
22523
22563
  },
@@ -22541,7 +22581,7 @@
22541
22581
  "optional": false,
22542
22582
  "returnType": "void",
22543
22583
  "typeParameters": [],
22544
- "line": 724,
22584
+ "line": 719,
22545
22585
  "deprecated": false,
22546
22586
  "deprecationMessage": "",
22547
22587
  "rawdescription": "\n\nSets the list group filter, and manages single select item selection.\n",
@@ -22584,7 +22624,7 @@
22584
22624
  "optional": false,
22585
22625
  "returnType": "void",
22586
22626
  "typeParameters": [],
22587
- "line": 757,
22627
+ "line": 752,
22588
22628
  "deprecated": false,
22589
22629
  "deprecationMessage": "",
22590
22630
  "rawdescription": "\n\nIntended to be used to add items to the list.\n",
@@ -22610,7 +22650,7 @@
22610
22650
  "optional": false,
22611
22651
  "returnType": "void",
22612
22652
  "typeParameters": [],
22613
- "line": 692,
22653
+ "line": 685,
22614
22654
  "deprecated": false,
22615
22655
  "deprecationMessage": "",
22616
22656
  "rawdescription": "\n\nOpens the dropdown.\n",
@@ -22632,7 +22672,7 @@
22632
22672
  "optional": false,
22633
22673
  "returnType": "void",
22634
22674
  "typeParameters": [],
22635
- "line": 635,
22675
+ "line": 626,
22636
22676
  "deprecated": false,
22637
22677
  "deprecationMessage": "",
22638
22678
  "jsdoctags": [
@@ -22660,7 +22700,7 @@
22660
22700
  "optional": false,
22661
22701
  "returnType": "void",
22662
22702
  "typeParameters": [],
22663
- "line": 639,
22703
+ "line": 630,
22664
22704
  "deprecated": false,
22665
22705
  "deprecationMessage": "",
22666
22706
  "jsdoctags": [
@@ -22688,7 +22728,7 @@
22688
22728
  "optional": false,
22689
22729
  "returnType": "void",
22690
22730
  "typeParameters": [],
22691
- "line": 648,
22731
+ "line": 639,
22692
22732
  "deprecated": false,
22693
22733
  "deprecationMessage": "",
22694
22734
  "rawdescription": "\n\n`ControlValueAccessor` method to programmatically disable the combobox.\n\nex: `this.formGroup.get(\"myCoolCombobox\").disable();`\n",
@@ -22711,7 +22751,7 @@
22711
22751
  "optional": false,
22712
22752
  "returnType": "void",
22713
22753
  "typeParameters": [],
22714
- "line": 713,
22754
+ "line": 708,
22715
22755
  "deprecated": false,
22716
22756
  "deprecationMessage": "",
22717
22757
  "rawdescription": "\n\nToggles the dropdown.\n",
@@ -22726,7 +22766,7 @@
22726
22766
  "optional": false,
22727
22767
  "returnType": "void",
22728
22768
  "typeParameters": [],
22729
- "line": 655,
22769
+ "line": 646,
22730
22770
  "deprecated": false,
22731
22771
  "deprecationMessage": "",
22732
22772
  "rawdescription": "\n\nCalled by `n-pill-input` when the selected pills have changed.\n",
@@ -22748,7 +22788,7 @@
22748
22788
  "optional": false,
22749
22789
  "returnType": "void",
22750
22790
  "typeParameters": [],
22751
- "line": 599,
22791
+ "line": 590,
22752
22792
  "deprecated": false,
22753
22793
  "deprecationMessage": "",
22754
22794
  "jsdoctags": [
@@ -22772,7 +22812,7 @@
22772
22812
  "defaultValue": "true",
22773
22813
  "deprecated": false,
22774
22814
  "deprecationMessage": "",
22775
- "line": 408,
22815
+ "line": 407,
22776
22816
  "type": "boolean",
22777
22817
  "decorators": []
22778
22818
  },
@@ -22781,7 +22821,7 @@
22781
22821
  "defaultValue": "\"block\"",
22782
22822
  "deprecated": false,
22783
22823
  "deprecationMessage": "",
22784
- "line": 409,
22824
+ "line": 408,
22785
22825
  "type": "string",
22786
22826
  "decorators": []
22787
22827
  }
@@ -22804,7 +22844,7 @@
22804
22844
  "deprecationMessage": "",
22805
22845
  "rawdescription": "\n\nHandles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n",
22806
22846
  "description": "<p>Handles <code>Escape/Tab</code> key closing the dropdown, and arrow up/down focus to/from the dropdown list.</p>\n",
22807
- "line": 569
22847
+ "line": 560
22808
22848
  }
22809
22849
  ],
22810
22850
  "standalone": false,
@@ -22812,7 +22852,7 @@
22812
22852
  "description": "<p>ComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\nMulti-select comboboxes also provide &quot;pills&quot; of selected items.</p>\n<p><a href=\"../../?path=/story/components-combobox--basic\">See demo</a></p>\n",
22813
22853
  "rawdescription": "\n\nComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\nMulti-select comboboxes also provide \"pills\" of selected items.\n\n[See demo](../../?path=/story/components-combobox--basic)\n",
22814
22854
  "type": "component",
22815
- "sourceCode": "import {\n\tComponent,\n\tOnChanges,\n\tContentChild,\n\tInput,\n\tOutput,\n\tHostListener,\n\tElementRef,\n\tViewChild,\n\tEventEmitter,\n\tAfterViewInit,\n\tAfterContentInit,\n\tHostBinding,\n\tTemplateRef,\n\tOnDestroy\n} from \"@angular/core\";\nimport { AbstractDropdownView, DropdownService } from \"carbon-components-angular/dropdown\";\nimport { ListItem } from \"carbon-components-angular/dropdown\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { filter } from \"rxjs/operators\";\nimport {\n\tDocumentService,\n\tgetScrollableParents,\n\thasScrollableParents\n} from \"carbon-components-angular/utils\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * ComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\n * Multi-select comboboxes also provide \"pills\" of selected items.\n *\n * [See demo](../../?path=/story/components-combobox--basic)\n */\n@Component({\n\tselector: \"cds-combo-box, ibm-combo-box\",\n\ttemplate: `\n\t\t<div class=\"cds--list-box__wrapper\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\t#listbox\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--multi-select cds--multi-select--filterable': type === 'multi',\n\t\t\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t\t\t'cds--list-box--expanded': open,\n\t\t\t\t\t'cds--list-box--sm': size === 'sm',\n\t\t\t\t\t'cds--list-box--md': size === 'md',\n\t\t\t\t\t'cds--list-box--lg': size === 'lg',\n\t\t\t\t\t'cds--list-box--disabled': disabled,\n\t\t\t\t\t'cds--combo-box--warning cds--list-box--warning': warn\n\t\t\t\t}\"\n\t\t\t\tclass=\"cds--list-box cds--combo-box\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\">\n\t\t\t\t<div\n\t\t\t\t\tclass=\"cds--list-box__field\"\n\t\t\t\t\t(click)=\"toggleDropdown()\"\n\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"type === 'multi' && pills.length > 0\"\n\t\t\t\t\t\tclass=\"cds--tag cds--tag--filter cds--tag--high-contrast\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--tag--disabled': disabled}\">\n\t\t\t\t\t\t<span class=\"cds--tag__label\">{{ pills.length }}</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t(click)=\"clearSelected($event)\"\n\t\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t\t(keydown.enter)=\"clearSelected($event)\"\n\t\t\t\t\t\t\tclass=\"cds--tag__close-icon\"\n\t\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t\t[title]=\"clearSelectionsTitle\"\n\t\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\">\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<input\n\t\t\t\t\t\t#input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t(input)=\"onSearch($event.target.value)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t(keydown.enter)=\"onSubmit($event)\"\n\t\t\t\t\t\t[value]=\"selectedValue\"\n\t\t\t\t\t\tclass=\"cds--text-input\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--text-input--empty': !showClearButton}\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t\t[attr.aria-labelledby]=\"id\"\n\t\t\t\t\t\t[attr.aria-expanded]=\"open\"\n\t\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\t\t[attr.maxlength]=\"maxLength\"\n\t\t\t\t\t\t[attr.aria-controls]=\"open ? view?.listId : null\"\n\t\t\t\t\t\t[attr.aria-autocomplete]=\"autocomplete\"\n\t\t\t\t\t\t[placeholder]=\"placeholder\"/>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!warn && invalid\"\n\t\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"showClearButton\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__selection\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\"\n\t\t\t\t\t\t[title]=\"clearSelectionTitle\"\n\t\t\t\t\t\t(keyup.enter)=\"clearInput($event)\"\n\t\t\t\t\t\t(click)=\"clearInput($event)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t\t<svg cdsIcon=\"close\" size=\"16\"></svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-icon\"\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t[title]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[attr.aria-label]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': open}\">\n\t\t\t\t\t\t<svg cdsIcon=\"chevron--down\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\t#dropdownMenu\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-content *ngIf=\"open\"></ng-content>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!warn && invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: ComboBox,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnDestroy {\n\t/**\n\t * Text to show when nothing is selected.\n\t */\n\t@Input() set placeholder(value: string | Observable<string>) {\n\t\tthis._placeholder.override(value);\n\t}\n\n\tget placeholder() {\n\t\treturn this._placeholder.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when closed\n\t */\n\t@Input() set openMenuAria(value: string | Observable<string>) {\n\t\tthis._openMenuAria.override(value);\n\t}\n\n\tget openMenuAria() {\n\t\treturn this._openMenuAria.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when opened\n\t */\n\t@Input() set closeMenuAria(value: string | Observable<string>) {\n\t\tthis._closeMenuAria.override(value);\n\t}\n\n\tget closeMenuAria() {\n\t\treturn this._closeMenuAria.value;\n\t}\n\t/**\n\t * Value to display on the clear selections icon, when multi is selected\n\t */\n\t@Input() set clearSelectionsTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionsTitle.override(value);\n\t}\n\n\tget clearSelectionsTitle() {\n\t\treturn this._clearSelectionsTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes to clear selections, when multi is selected\n\t */\n\t@Input() set clearSelectionsAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionsAria.override(value);\n\t}\n\n\tget clearSelectionsAria() {\n\t\treturn this._clearSelectionsAria.value;\n\t}\n\t/**\n\t * Value to display on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionTitle.override(value);\n\t}\n\n\tget clearSelectionTitle() {\n\t\treturn this._clearSelectionTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionAria.override(value);\n\t}\n\n\tget clearSelectionAria() {\n\t\treturn this._clearSelectionAria.value;\n\t}\n\tstatic comboBoxCount = 0;\n\t@Input() id = `dropdown-${ComboBox.comboBoxCount++}`;\n\t/**\n\t * List of items to fill the content with.\n\t *\n\t * **Example:**\n\t * ```javascript\n\t * items = [\n\t *\t\t{\n\t *\t\t\tcontent: \"Abacus\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Byte\",\n\t *\t\t\tselected: false,\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Computer\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Digital\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t * ];\n\t * ```\n\t *\n\t */\n\t@Input() items: Array<ListItem> = [];\n\t/**\n\t * Combo box type (supporting single or multi selection of items).\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * Combo box render size.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Specifies the property to be used as the return value to `ngModel`\n\t */\n\t@Input() itemValueKey: string;\n\t/**\n\t * Label for the combobox.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Set to `true` to show the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if combobox is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t* Set to `true` to show a warning (contents set by warnText)\n\t*/\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Max length value to limit input characters\n\t */\n\t@Input() maxLength: number = null;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at its position\n\t * `top-after-reopen`: selected item jump to top after reopen dropdown\n\t */\n\t@Input() selectionFeedback: \"top\" | \"fixed\" | \"top-after-reopen\" = \"top-after-reopen\";\n\t/**\n\t * Specify aria-autocomplete attribute of text input.\n\t * \"list\", is the expected value for a combobox that invokes a drop-down list\n\t */\n\t@Input() autocomplete = \"list\";\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Set to `true` to disable combobox.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Emits a ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t * \t\tcontent: \"one\",\n\t * \t\tselected: true\n\t * }\n\t * ```\n\t */\n\t@Output() selected = new EventEmitter<ListItem | ListItem[]>();\n\t/**\n\t * Intended to be used to add items to the list.\n\t *\n\t * Emits an event that includes the current item list, the suggested index for the new item, and a simple ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t *\t{\n\t *\t\titems: [{content: \"one\", selected: true}, {content: \"two\", selected: true}],\n\t *\t\tindex: 1,\n\t *\t\tvalue: {\n\t *\t\t\tcontent: \"some user string\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t *\t}\n\t * ```\n\t *\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t *\tafter: 1,\n\t *\tvalue: \"some user string\"\n\t * }\n\t * ```\n\t */\n\t@Output() submit = new EventEmitter <{\n\t\titems: ListItem[],\n\t\tindex: number,\n\t\tvalue: {\n\t\t\tcontent: string,\n\t\t\tselected: boolean\n\t\t}\n\t}>();\n\t/** Emits an empty event when the menu is closed */\n\t@Output() close = new EventEmitter<void>();\n\t/** Emits the search string from the input */\n\t@Output() search = new EventEmitter<string>();\n\t/** Emits an event when the clear button is clicked. */\n\t@Output() clear = new EventEmitter<Event>();\n\t/** ContentChild reference to the instantiated dropdown list */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t@ViewChild(\"dropdownMenu\") dropdownMenu;\n\t@ViewChild(\"input\", { static: true }) input: ElementRef;\n\t@ViewChild(\"listbox\", { static: true }) listbox: ElementRef;\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostClass = true;\n\t@HostBinding(\"style.display\") display = \"block\";\n\n\tpublic open = false;\n\n\tpublic showClearButton = false;\n\n\t/** Selected items for multi-select combo-boxes. */\n\tpublic pills = [];\n\t/** used to update the displayValue */\n\tpublic selectedValue = \"\";\n\n\tkeyboardNav = this._keyboardNav.bind(this);\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\tprotected noop = this._noop.bind(this);\n\tprotected onTouchedCallback: () => void = this._noop;\n\tprotected propagateChangeCallback: (_: any) => void = this._noop;\n\n\tprotected _placeholder = this.i18n.getOverridable(\"COMBOBOX.PLACEHOLDER\");\n\tprotected _closeMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLOSE_MENU\");\n\tprotected _openMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.OPEN_MENU\");\n\tprotected _clearSelectionsTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionsAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTED\");\n\tprotected _clearSelectionAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTED\");\n\n\t/**\n\t * Creates an instance of ComboBox.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected documentService: DocumentService,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected i18n: I18n\n\t) {}\n\n\t/**\n\t * Lifecycle hook.\n\t * Updates pills if necessary.\n\t *\n\t */\n\tngOnChanges(changes) {\n\t\tif (changes.items) {\n\t\t\tthis.view.items = changes.items.currentValue;\n\t\t\tthis.updateSelected();\n\t\t\t// If new items are added into the combobox while there is search input,\n\t\t\t// repeat the search. Search should only trigger for type 'single' when there is no value selected.\n\t\t\tif ( this.type === \"multi\" || (this.type === \"single\" && !this.selectedValue)) {\n\t\t\t\tthis.onSearch(this.input.nativeElement.value, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets initial state that depends on child components\n\t * Subscribes to select events and handles focus/filtering/initial list updates\n\t */\n\tngAfterContentInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\n\t\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\t\tthis.view.select.subscribe(event => {\n\t\t\t\tif (Array.isArray(event)) {\n\t\t\t\t\tthis.updatePills();\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\t\t\tthis.propagateChangeCallback(values);\n\t\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.propagateChangeCallback(this.view.getSelected());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If type is single, dropdown list will emit an object\n\t\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\t\tthis.showClearButton = true;\n\t\t\t\t\t\tthis.selectedValue = event.item.content;\n\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\t\t\tthis.propagateChangeCallback(event.item[this.itemValueKey]);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.propagateChangeCallback(event.item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.selectedValue = \"\";\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tthis.propagateChangeCallback(null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// not guarding these since the nativeElement has to be loaded\n\t\t\t\t\t// for select to even fire\n\t\t\t\t\t// only focus for \"organic\" selections\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tthis.elementRef.nativeElement.querySelector(\"input\").focus();\n\t\t\t\t\t\tthis.view.filterBy(\"\");\n\t\t\t\t\t}\n\t\t\t\t\tthis.closeDropdown();\n\t\t\t\t}\n\t\t\t\tif (!isUpdate(event) && !Array.isArray(event)) {\n\t\t\t\t\tthis.selected.emit(event.item);\n\t\t\t\t}\n\t\t\t});\n\t\t\t// update the rest of combobox with any pre-selected items\n\t\t\t// setTimeout just defers the call to the next check cycle\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.updateSelected();\n\t\t\t});\n\n\t\t\tthis.view.blurIntent.pipe(filter(v => v === \"top\")).subscribe(() => {\n\t\t\t\tthis.elementRef.nativeElement.querySelector(\".cds--text-input\").focus();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Binds event handlers against the rendered view\n\t */\n\tngAfterViewInit() {\n\t\tthis.documentService.handleClick(event => {\n\t\t\tif (!this.elementRef.nativeElement.contains(event.target) &&\n\t\t\t\t!this.dropdownMenu.nativeElement.contains(event.target)) {\n\t\t\t\tif (this.open) {\n\t\t\t\t\tthis.closeDropdown();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t// if appendInline is default valued (null) we should:\n\t\t// 1. if there are scrollable parents (not including body) don't append inline\n\t\t// this should also cover the case where the dropdown is in a modal\n\t\t// (where we _do_ want to append to the placeholder)\n\t\tif (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n\t\t\tthis.appendInline = false;\n\t\t// 2. otherwise we should append inline\n\t\t} else if (this.appendInline === null) {\n\t\t\tthis.appendInline = true;\n\t\t}\n\t}\n\n\t/**\n\t * Removing the `Dropdown` from the body if it is appended to the body.\n\t */\n\tngOnDestroy() {\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Handles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\thostkeys(ev: KeyboardEvent) {\n\t\tif (ev.key === \"Escape\") {\n\t\t\tthis.closeDropdown();\n\t\t} else if ((ev.key === \"ArrowDown\")\n\t\t\t&& (!this.dropdownMenu || !this.dropdownMenu.nativeElement.contains(ev.target))) {\n\t\t\tev.stopPropagation();\n\t\t\tthis.openDropdown();\n\t\t\tsetTimeout(() => { this.view.initFocus(); }, 0);\n\t\t}\n\n\t\tif (\n\t\t\tthis.open && ev.key === \"Tab\" &&\n\t\t\t(this.dropdownMenu.nativeElement.contains(ev.target as Node) || ev.target === this.input.nativeElement)\n\t\t) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tif (this.open && ev.key === \"Tab\" && ev.shiftKey) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/*\n\t * no-op method for null event listeners, and other no op calls\n\t */\n\t_noop() {}\n\n\t/*\n\t * propagates the value provided from ngModel\n\t */\n\twriteValue(value: any) {\n\t\tif (this.type === \"single\") {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the specified item and update its state\n\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\tnewValue.selected = true;\n\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t} else {\n\t\t\t\t// all items in propagateSelected must be iterable\n\t\t\t\tthis.view.propagateSelected([value || \"\"]);\n\t\t\t}\n\t\t\tthis.showClearButton = !!(value && this.view.getSelected().length);\n\t\t} else {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the items and update their state based on the received value array\n\t\t\t\t// this way we don't lose any additional metadata that may be passed in via the `items` Input\n\t\t\t\tlet newValues = [];\n\t\t\t\tfor (const v of value) {\n\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t} else {\n\t\t\t\tthis.view.propagateSelected(value ? value : [\"\"]);\n\t\t\t}\n\t\t}\n\t\tthis.updateSelected();\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.propagateChangeCallback = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the combobox.\n\t *\n\t * ex: `this.formGroup.get(\"myCoolCombobox\").disable();`\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called by `n-pill-input` when the selected pills have changed.\n\t */\n\tpublic updatePills() {\n\t\tthis.pills = this.view.getSelected() || [];\n\t\tthis.checkForReorder();\n\t}\n\n\tpublic clearSelected(event) {\n\t\tthis.items = this.items.map(item => {\n\t\t\tif (!item.disabled) {\n\t\t\t\titem.selected = false;\n\t\t\t}\n\t\t\treturn item;\n\t\t});\n\t\tthis.view.items = this.items;\n\t\tthis.updatePills();\n\t\t// clearSelected can only fire on type=multi\n\t\t// so we just emit getSelected() (just in case there's any disabled but selected items)\n\t\tconst selected = this.view.getSelected();\n\t\tthis.propagateChangeCallback(selected);\n\t\tthis.selected.emit(selected as any);\n\t\tthis.clear.emit(event);\n\t}\n\n\t/**\n\t * Closes the dropdown and emits the close event.\n\t */\n\tpublic closeDropdown() {\n\t\tthis.open = false;\n\t\tthis.checkForReorder();\n\t\tthis.close.emit();\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Opens the dropdown.\n\t */\n\tpublic openDropdown() {\n\t\tif (this.disabled) { return; }\n\t\tthis.open = true;\n\t\tthis._dropUp = false;\n\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\t// set the dropdown menu to drop up if it is near the bottom of the screen\n\t\t// setTimeout lets us do the calculations after it is visible in the DOM\n\t\tsetTimeout(() => {\n\t\t\tif (this.dropUp === null || this.dropUp === undefined) {\n\t\t\t\tthis._dropUp = this._shouldDropUp();\n\t\t\t}\n\t\t}, 0);\n\t}\n\n\t/**\n\t * Toggles the dropdown.\n\t */\n\tpublic toggleDropdown() {\n\t\tif (this.open) {\n\t\t\tthis.closeDropdown();\n\t\t} else {\n\t\t\tthis.openDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Sets the list group filter, and manages single select item selection.\n\t */\n\tpublic onSearch(searchString, shouldEmitSearch = true) {\n\t\tif (shouldEmitSearch) {\n\t\t\tthis.search.emit(searchString);\n\t\t}\n\t\tthis.showClearButton = !!searchString;\n\t\tthis.view.filterBy(searchString);\n\t\tif (searchString !== \"\") {\n\t\t\tif (!this.open) {\n\t\t\t\tthis.openDropdown();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectedValue = \"\";\n\t\t\tif (this.type === \"multi\" &&\n\t\t\t\t(this.selectionFeedback === \"top\" || this.selectionFeedback === \"top-after-reopen\")) {\n\t\t\t\tthis.view.reorderSelected();\n\t\t\t}\n\t\t}\n\t\tif (this.type === \"single\") {\n\t\t\t// deselect if the input doesn't match the content\n\t\t\t// of any given item\n\t\t\tconst matches = this.view.getListItems().some(item => item.content.toLowerCase().includes(searchString.toLowerCase()));\n\t\t\tif (!matches) {\n\t\t\t\tconst selected = this.view.getSelected();\n\t\t\t\tif (!selected || !selected[0]) {\n\t\t\t\t\tthis.view.filterBy(searchString);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Intended to be used to add items to the list.\n\t */\n\tpublic onSubmit(event: KeyboardEvent) {\n\t\tthis.submit.emit({\n\t\t\titems: this.view.getListItems(),\n\t\t\tindex: 0,\n\t\t\tvalue: {\n\t\t\t\tcontent: (event.target as HTMLInputElement).value,\n\t\t\t\tselected: false\n\t\t\t}\n\t\t});\n\t}\n\n\tclearInput(event) {\n\t\tevent.stopPropagation();\n\t\tevent.preventDefault();\n\n\t\tif (this.type === \"single\") { // don't want to clear selected or close if multi\n\t\t\tthis.clearSelected(event);\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tthis.selectedValue = \"\";\n\t\tthis.input.nativeElement.value = \"\";\n\n\t\tthis.showClearButton = false;\n\t\tthis.input.nativeElement.focus();\n\t\tthis.onSearch(this.input.nativeElement.value);\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n\t */\n\t_keyboardNav(event: KeyboardEvent) {\n\t\tif ((event.key === \"Escape\") && this.open) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeDropdown();\n\t\t\tthis.input.nativeElement.focus();\n\t\t} else if (this.open && event.key === \"Tab\") {\n\t\t\t// this way focus will start on the next focusable item from the dropdown\n\t\t\t// not the top of the body!\n\t\t\tthis.input.nativeElement.focus();\n\t\t\tthis.input.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", {bubbles: true, cancelable: true, key: \"Tab\"}));\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.listbox.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${this.open ? \" cds--list-box--expanded\" : \"\"}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n\t */\n\t_appendToDropdown() {\n\t\tthis.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n\t\tthis.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n\t * This can be overridden by passing in a value to the `dropUp` input.\n\t */\n\t_shouldDropUp() {\n\t\t// check if dropdownMenu exists first.\n\t\tconst menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n\t\t// check if menu exists first.\n\t\tconst menuRect = menu && menu.getBoundingClientRect();\n\t\tif (menu && menuRect) {\n\t\t\tconst scrollableParents = getScrollableParents(menu);\n\t\t\treturn scrollableParents.reduce((shouldDropUp: boolean, parent: HTMLElement) => {\n\t\t\t\tconst parentRect = parent.getBoundingClientRect();\n\t\t\t\tconst isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n\t\t\t\treturn shouldDropUp || isBelowParent;\n\t\t\t}, false);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprotected updateSelected() {\n\t\tconst selected = this.view.getSelected();\n\t\tif (this.type === \"multi\" ) {\n\t\t\tthis.updatePills();\n\t\t} else if (selected) {\n\t\t\tconst value = selected[0] ? selected[0].content : \"\";\n\t\t\tconst changeCallbackValue = selected[0] ? selected[0] : \"\";\n\t\t\tthis.selectedValue = value;\n\t\t\tthis.showClearButton = !!value;\n\t\t}\n\t}\n\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = !this.open && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected(true);\n\t\t}\n\t}\n}\n",
22855
+ "sourceCode": "import {\n\tComponent,\n\tOnChanges,\n\tContentChild,\n\tInput,\n\tOutput,\n\tHostListener,\n\tElementRef,\n\tViewChild,\n\tEventEmitter,\n\tAfterViewInit,\n\tAfterContentInit,\n\tHostBinding,\n\tTemplateRef,\n\tOnDestroy\n} from \"@angular/core\";\nimport { AbstractDropdownView, DropdownService } from \"carbon-components-angular/dropdown\";\nimport { ListItem } from \"carbon-components-angular/dropdown\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { filter } from \"rxjs/operators\";\nimport {\n\tgetScrollableParents,\n\thasScrollableParents\n} from \"carbon-components-angular/utils\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * ComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\n * Multi-select comboboxes also provide \"pills\" of selected items.\n *\n * [See demo](../../?path=/story/components-combobox--basic)\n */\n@Component({\n\tselector: \"cds-combo-box, ibm-combo-box\",\n\ttemplate: `\n\t\t<div class=\"cds--list-box__wrapper\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\t#listbox\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--multi-select cds--multi-select--filterable': type === 'multi',\n\t\t\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t\t\t'cds--list-box--expanded': open,\n\t\t\t\t\t'cds--list-box--sm': size === 'sm',\n\t\t\t\t\t'cds--list-box--md': size === 'md',\n\t\t\t\t\t'cds--list-box--lg': size === 'lg',\n\t\t\t\t\t'cds--list-box--disabled': disabled,\n\t\t\t\t\t'cds--combo-box--warning cds--list-box--warning': warn\n\t\t\t\t}\"\n\t\t\t\tclass=\"cds--list-box cds--combo-box\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\">\n\t\t\t\t<div\n\t\t\t\t\tclass=\"cds--list-box__field\"\n\t\t\t\t\t(click)=\"toggleDropdown()\"\n\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"type === 'multi' && pills.length > 0\"\n\t\t\t\t\t\tclass=\"cds--tag cds--tag--filter cds--tag--high-contrast\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--tag--disabled': disabled}\">\n\t\t\t\t\t\t<span class=\"cds--tag__label\">{{ pills.length }}</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t(click)=\"clearSelected($event)\"\n\t\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t\t(keydown.enter)=\"clearSelected($event)\"\n\t\t\t\t\t\t\tclass=\"cds--tag__close-icon\"\n\t\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t\t[title]=\"clearSelectionsTitle\"\n\t\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\">\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<input\n\t\t\t\t\t\t#input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t(input)=\"onSearch($event.target.value)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t(keydown.enter)=\"onSubmit($event)\"\n\t\t\t\t\t\t[value]=\"selectedValue\"\n\t\t\t\t\t\tclass=\"cds--text-input\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--text-input--empty': !showClearButton}\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t\t[attr.aria-labelledby]=\"id\"\n\t\t\t\t\t\t[attr.aria-expanded]=\"open\"\n\t\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\t\t[attr.maxlength]=\"maxLength\"\n\t\t\t\t\t\t[attr.aria-controls]=\"open ? view?.listId : null\"\n\t\t\t\t\t\t[attr.aria-autocomplete]=\"autocomplete\"\n\t\t\t\t\t\t[placeholder]=\"placeholder\"/>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!warn && invalid\"\n\t\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"showClearButton\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__selection\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\"\n\t\t\t\t\t\t[title]=\"clearSelectionTitle\"\n\t\t\t\t\t\t(keyup.enter)=\"clearInput($event)\"\n\t\t\t\t\t\t(click)=\"clearInput($event)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t\t<svg cdsIcon=\"close\" size=\"16\"></svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-icon\"\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t[title]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[attr.aria-label]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': open}\">\n\t\t\t\t\t\t<svg cdsIcon=\"chevron--down\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\t#dropdownMenu\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-content *ngIf=\"open\"></ng-content>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!warn && invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: ComboBox,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnDestroy {\n\t/**\n\t * Text to show when nothing is selected.\n\t */\n\t@Input() set placeholder(value: string | Observable<string>) {\n\t\tthis._placeholder.override(value);\n\t}\n\n\tget placeholder() {\n\t\treturn this._placeholder.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when closed\n\t */\n\t@Input() set openMenuAria(value: string | Observable<string>) {\n\t\tthis._openMenuAria.override(value);\n\t}\n\n\tget openMenuAria() {\n\t\treturn this._openMenuAria.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when opened\n\t */\n\t@Input() set closeMenuAria(value: string | Observable<string>) {\n\t\tthis._closeMenuAria.override(value);\n\t}\n\n\tget closeMenuAria() {\n\t\treturn this._closeMenuAria.value;\n\t}\n\t/**\n\t * Value to display on the clear selections icon, when multi is selected\n\t */\n\t@Input() set clearSelectionsTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionsTitle.override(value);\n\t}\n\n\tget clearSelectionsTitle() {\n\t\treturn this._clearSelectionsTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes to clear selections, when multi is selected\n\t */\n\t@Input() set clearSelectionsAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionsAria.override(value);\n\t}\n\n\tget clearSelectionsAria() {\n\t\treturn this._clearSelectionsAria.value;\n\t}\n\t/**\n\t * Value to display on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionTitle.override(value);\n\t}\n\n\tget clearSelectionTitle() {\n\t\treturn this._clearSelectionTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionAria.override(value);\n\t}\n\n\tget clearSelectionAria() {\n\t\treturn this._clearSelectionAria.value;\n\t}\n\tstatic comboBoxCount = 0;\n\t@Input() id = `dropdown-${ComboBox.comboBoxCount++}`;\n\t/**\n\t * List of items to fill the content with.\n\t *\n\t * **Example:**\n\t * ```javascript\n\t * items = [\n\t *\t\t{\n\t *\t\t\tcontent: \"Abacus\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Byte\",\n\t *\t\t\tselected: false,\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Computer\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Digital\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t * ];\n\t * ```\n\t *\n\t */\n\t@Input() items: Array<ListItem> = [];\n\t/**\n\t * Combo box type (supporting single or multi selection of items).\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * Combo box render size.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Specifies the property to be used as the return value to `ngModel`\n\t */\n\t@Input() itemValueKey: string;\n\t/**\n\t * Label for the combobox.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Set to `true` to show the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if combobox is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t* Set to `true` to show a warning (contents set by warnText)\n\t*/\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Max length value to limit input characters\n\t */\n\t@Input() maxLength: number = null;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at its position\n\t * `top-after-reopen`: selected item jump to top after reopen dropdown\n\t */\n\t@Input() selectionFeedback: \"top\" | \"fixed\" | \"top-after-reopen\" = \"top-after-reopen\";\n\t/**\n\t * Specify aria-autocomplete attribute of text input.\n\t * \"list\", is the expected value for a combobox that invokes a drop-down list\n\t */\n\t@Input() autocomplete = \"list\";\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Set to `true` to disable combobox.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Emits a ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t * \t\tcontent: \"one\",\n\t * \t\tselected: true\n\t * }\n\t * ```\n\t */\n\t@Output() selected = new EventEmitter<ListItem | ListItem[]>();\n\t/**\n\t * Intended to be used to add items to the list.\n\t *\n\t * Emits an event that includes the current item list, the suggested index for the new item, and a simple ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t *\t{\n\t *\t\titems: [{content: \"one\", selected: true}, {content: \"two\", selected: true}],\n\t *\t\tindex: 1,\n\t *\t\tvalue: {\n\t *\t\t\tcontent: \"some user string\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t *\t}\n\t * ```\n\t *\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t *\tafter: 1,\n\t *\tvalue: \"some user string\"\n\t * }\n\t * ```\n\t */\n\t@Output() submit = new EventEmitter<{\n\t\titems: ListItem[],\n\t\tindex: number,\n\t\tvalue: {\n\t\t\tcontent: string,\n\t\t\tselected: boolean\n\t\t}\n\t}>();\n\t/** Emits an empty event when the menu is closed */\n\t@Output() close = new EventEmitter<void>();\n\t/** Emits the search string from the input */\n\t@Output() search = new EventEmitter<string>();\n\t/** Emits an event when the clear button is clicked. */\n\t@Output() clear = new EventEmitter<Event>();\n\t/** ContentChild reference to the instantiated dropdown list */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t@ViewChild(\"dropdownMenu\") dropdownMenu;\n\t@ViewChild(\"input\", { static: true }) input: ElementRef;\n\t@ViewChild(\"listbox\", { static: true }) listbox: ElementRef;\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostClass = true;\n\t@HostBinding(\"style.display\") display = \"block\";\n\n\tpublic open = false;\n\n\tpublic showClearButton = false;\n\n\t/** Selected items for multi-select combo-boxes. */\n\tpublic pills = [];\n\t/** used to update the displayValue */\n\tpublic selectedValue = \"\";\n\n\toutsideClick = this._outsideClick.bind(this);\n\tkeyboardNav = this._keyboardNav.bind(this);\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\tprotected noop = this._noop.bind(this);\n\tprotected onTouchedCallback: () => void = this._noop;\n\tprotected propagateChangeCallback: (_: any) => void = this._noop;\n\n\tprotected _placeholder = this.i18n.getOverridable(\"COMBOBOX.PLACEHOLDER\");\n\tprotected _closeMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLOSE_MENU\");\n\tprotected _openMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.OPEN_MENU\");\n\tprotected _clearSelectionsTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionsAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTED\");\n\tprotected _clearSelectionAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTED\");\n\n\t/**\n\t * Creates an instance of ComboBox.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected i18n: I18n\n\t) {}\n\n\t/**\n\t * Lifecycle hook.\n\t * Updates pills if necessary.\n\t *\n\t */\n\tngOnChanges(changes) {\n\t\tif (changes.items) {\n\t\t\tthis.view.items = changes.items.currentValue;\n\t\t\tthis.updateSelected();\n\t\t\t// If new items are added into the combobox while there is search input,\n\t\t\t// repeat the search. Search should only trigger for type 'single' when there is no value selected.\n\t\t\tif (this.type === \"multi\" || (this.type === \"single\" && !this.selectedValue)) {\n\t\t\t\tthis.onSearch(this.input.nativeElement.value, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets initial state that depends on child components\n\t * Subscribes to select events and handles focus/filtering/initial list updates\n\t */\n\tngAfterContentInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\n\t\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\t\tthis.view.select.subscribe(event => {\n\t\t\t\tif (Array.isArray(event)) {\n\t\t\t\t\tthis.updatePills();\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\t\t\tthis.propagateChangeCallback(values);\n\t\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.propagateChangeCallback(this.view.getSelected());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If type is single, dropdown list will emit an object\n\t\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\t\tthis.showClearButton = true;\n\t\t\t\t\t\tthis.selectedValue = event.item.content;\n\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\t\t\tthis.propagateChangeCallback(event.item[this.itemValueKey]);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.propagateChangeCallback(event.item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.selectedValue = \"\";\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tthis.propagateChangeCallback(null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// not guarding these since the nativeElement has to be loaded\n\t\t\t\t\t// for select to even fire\n\t\t\t\t\t// only focus for \"organic\" selections\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tthis.elementRef.nativeElement.querySelector(\"input\").focus();\n\t\t\t\t\t\tthis.view.filterBy(\"\");\n\t\t\t\t\t}\n\t\t\t\t\tthis.closeDropdown();\n\t\t\t\t}\n\t\t\t\tif (!isUpdate(event) && !Array.isArray(event)) {\n\t\t\t\t\tthis.selected.emit(event.item);\n\t\t\t\t}\n\t\t\t});\n\t\t\t// update the rest of combobox with any pre-selected items\n\t\t\t// setTimeout just defers the call to the next check cycle\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.updateSelected();\n\t\t\t});\n\n\t\t\tthis.view.blurIntent.pipe(filter(v => v === \"top\")).subscribe(() => {\n\t\t\t\tthis.elementRef.nativeElement.querySelector(\".cds--text-input\").focus();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Binds event handlers against the rendered view\n\t */\n\tngAfterViewInit() {\n\t\t// if appendInline is default valued (null) we should:\n\t\t// 1. if there are scrollable parents (not including body) don't append inline\n\t\t// this should also cover the case where the dropdown is in a modal\n\t\t// (where we _do_ want to append to the placeholder)\n\t\tif (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n\t\t\tthis.appendInline = false;\n\t\t// 2. otherwise we should append inline\n\t\t} else if (this.appendInline === null) {\n\t\t\tthis.appendInline = true;\n\t\t}\n\t}\n\n\t/**\n\t * Removing the `Dropdown` from the body if it is appended to the body.\n\t */\n\tngOnDestroy() {\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Handles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\thostkeys(ev: KeyboardEvent) {\n\t\tif (ev.key === \"Escape\") {\n\t\t\tthis.closeDropdown();\n\t\t} else if ((ev.key === \"ArrowDown\")\n\t\t\t&& (!this.dropdownMenu || !this.dropdownMenu.nativeElement.contains(ev.target))) {\n\t\t\tev.stopPropagation();\n\t\t\tthis.openDropdown();\n\t\t\tsetTimeout(() => { this.view.initFocus(); }, 0);\n\t\t}\n\n\t\tif (\n\t\t\tthis.open && ev.key === \"Tab\" &&\n\t\t\t(this.dropdownMenu.nativeElement.contains(ev.target as Node) || ev.target === this.input.nativeElement)\n\t\t) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tif (this.open && ev.key === \"Tab\" && ev.shiftKey) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/*\n\t * no-op method for null event listeners, and other no op calls\n\t */\n\t_noop() {}\n\n\t/*\n\t * propagates the value provided from ngModel\n\t */\n\twriteValue(value: any) {\n\t\tif (this.type === \"single\") {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the specified item and update its state\n\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\tnewValue.selected = true;\n\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t} else {\n\t\t\t\t// all items in propagateSelected must be iterable\n\t\t\t\tthis.view.propagateSelected([value || \"\"]);\n\t\t\t}\n\t\t\tthis.showClearButton = !!(value && this.view.getSelected().length);\n\t\t} else {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the items and update their state based on the received value array\n\t\t\t\t// this way we don't lose any additional metadata that may be passed in via the `items` Input\n\t\t\t\tlet newValues = [];\n\t\t\t\tfor (const v of value) {\n\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t} else {\n\t\t\t\tthis.view.propagateSelected(value ? value : [\"\"]);\n\t\t\t}\n\t\t}\n\t\tthis.updateSelected();\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.propagateChangeCallback = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the combobox.\n\t *\n\t * ex: `this.formGroup.get(\"myCoolCombobox\").disable();`\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called by `n-pill-input` when the selected pills have changed.\n\t */\n\tpublic updatePills() {\n\t\tthis.pills = this.view.getSelected() || [];\n\t\tthis.checkForReorder();\n\t}\n\n\tpublic clearSelected(event) {\n\t\tthis.items = this.items.map(item => {\n\t\t\tif (!item.disabled) {\n\t\t\t\titem.selected = false;\n\t\t\t}\n\t\t\treturn item;\n\t\t});\n\t\tthis.view.items = this.items;\n\t\tthis.updatePills();\n\t\t// clearSelected can only fire on type=multi\n\t\t// so we just emit getSelected() (just in case there's any disabled but selected items)\n\t\tconst selected = this.view.getSelected();\n\t\tthis.propagateChangeCallback(selected);\n\t\tthis.selected.emit(selected as any);\n\t\tthis.clear.emit(event);\n\t}\n\n\t/**\n\t * Closes the dropdown and emits the close event.\n\t */\n\tpublic closeDropdown() {\n\t\tthis.open = false;\n\t\tthis.checkForReorder();\n\t\tthis.close.emit();\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\n\t\tdocument.removeEventListener(\"click\", this.outsideClick, true);\n\t}\n\n\t/**\n\t * Opens the dropdown.\n\t */\n\tpublic openDropdown() {\n\t\tif (this.disabled) { return; }\n\t\tthis.open = true;\n\t\tthis._dropUp = false;\n\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\tdocument.addEventListener(\"click\", this.outsideClick, true);\n\n\t\t// set the dropdown menu to drop up if it is near the bottom of the screen\n\t\t// setTimeout lets us do the calculations after it is visible in the DOM\n\t\tsetTimeout(() => {\n\t\t\tif (this.dropUp === null || this.dropUp === undefined) {\n\t\t\t\tthis._dropUp = this._shouldDropUp();\n\t\t\t}\n\t\t}, 0);\n\t}\n\n\t/**\n\t * Toggles the dropdown.\n\t */\n\tpublic toggleDropdown() {\n\t\tif (this.open) {\n\t\t\tthis.closeDropdown();\n\t\t} else {\n\t\t\tthis.openDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Sets the list group filter, and manages single select item selection.\n\t */\n\tpublic onSearch(searchString, shouldEmitSearch = true) {\n\t\tif (shouldEmitSearch) {\n\t\t\tthis.search.emit(searchString);\n\t\t}\n\t\tthis.showClearButton = !!searchString;\n\t\tthis.view.filterBy(searchString);\n\t\tif (searchString !== \"\") {\n\t\t\tif (!this.open) {\n\t\t\t\tthis.openDropdown();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectedValue = \"\";\n\t\t\tif (this.type === \"multi\" &&\n\t\t\t\t(this.selectionFeedback === \"top\" || this.selectionFeedback === \"top-after-reopen\")) {\n\t\t\t\tthis.view.reorderSelected();\n\t\t\t}\n\t\t}\n\t\tif (this.type === \"single\") {\n\t\t\t// deselect if the input doesn't match the content\n\t\t\t// of any given item\n\t\t\tconst matches = this.view.getListItems().some(item => item.content.toLowerCase().includes(searchString.toLowerCase()));\n\t\t\tif (!matches) {\n\t\t\t\tconst selected = this.view.getSelected();\n\t\t\t\tif (!selected || !selected[0]) {\n\t\t\t\t\tthis.view.filterBy(searchString);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Intended to be used to add items to the list.\n\t */\n\tpublic onSubmit(event: KeyboardEvent) {\n\t\tthis.submit.emit({\n\t\t\titems: this.view.getListItems(),\n\t\t\tindex: 0,\n\t\t\tvalue: {\n\t\t\t\tcontent: (event.target as HTMLInputElement).value,\n\t\t\t\tselected: false\n\t\t\t}\n\t\t});\n\t}\n\n\tclearInput(event) {\n\t\tevent.stopPropagation();\n\t\tevent.preventDefault();\n\n\t\tif (this.type === \"single\") { // don't want to clear selected or close if multi\n\t\t\tthis.clearSelected(event);\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tthis.selectedValue = \"\";\n\t\tthis.input.nativeElement.value = \"\";\n\n\t\tthis.showClearButton = false;\n\t\tthis.input.nativeElement.focus();\n\t\tthis.onSearch(this.input.nativeElement.value);\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n\t */\n\t_keyboardNav(event: KeyboardEvent) {\n\t\tif ((event.key === \"Escape\") && this.open) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeDropdown();\n\t\t\tthis.input.nativeElement.focus();\n\t\t} else if (this.open && event.key === \"Tab\") {\n\t\t\t// this way focus will start on the next focusable item from the dropdown\n\t\t\t// not the top of the body!\n\t\t\tthis.input.nativeElement.focus();\n\t\t\tthis.input.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.listbox.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${this.open ? \" cds--list-box--expanded\" : \"\"}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n\t */\n\t_appendToDropdown() {\n\t\tthis.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n\t\tthis.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n\t * This can be overridden by passing in a value to the `dropUp` input.\n\t */\n\t_shouldDropUp() {\n\t\t// check if dropdownMenu exists first.\n\t\tconst menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n\t\t// check if menu exists first.\n\t\tconst menuRect = menu && menu.getBoundingClientRect();\n\t\tif (menu && menuRect) {\n\t\t\tconst scrollableParents = getScrollableParents(menu);\n\t\t\treturn scrollableParents.reduce((shouldDropUp: boolean, parent: HTMLElement) => {\n\t\t\t\tconst parentRect = parent.getBoundingClientRect();\n\t\t\t\tconst isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n\t\t\t\treturn shouldDropUp || isBelowParent;\n\t\t\t}, false);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Handles clicks outside of the `Dropdown` list.\n\t */\n\t_outsideClick(event) {\n\t\tif (!this.elementRef.nativeElement.contains(event.target) &&\n\t\t\t// if we're appendToBody the list isn't within the _elementRef,\n\t\t\t// so we've got to check if our target is possibly in there too.\n\t\t\t!this.dropdownMenu.nativeElement.contains(event.target)) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\tprotected updateSelected() {\n\t\tconst selected = this.view.getSelected();\n\t\tif (this.type === \"multi\") {\n\t\t\tthis.updatePills();\n\t\t} else if (selected) {\n\t\t\tconst value = selected[0] ? selected[0].content : \"\";\n\t\t\tconst changeCallbackValue = selected[0] ? selected[0] : \"\";\n\t\t\tthis.selectedValue = value;\n\t\t\tthis.showClearButton = !!value;\n\t\t}\n\t}\n\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = !this.open && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected(true);\n\t\t}\n\t}\n}\n",
22816
22856
  "assetsDirs": [],
22817
22857
  "styleUrlsData": "",
22818
22858
  "stylesData": "",
@@ -22828,12 +22868,6 @@
22828
22868
  "deprecated": false,
22829
22869
  "deprecationMessage": ""
22830
22870
  },
22831
- {
22832
- "name": "documentService",
22833
- "type": "DocumentService",
22834
- "deprecated": false,
22835
- "deprecationMessage": ""
22836
- },
22837
22871
  {
22838
22872
  "name": "dropdownService",
22839
22873
  "type": "DropdownService",
@@ -22859,15 +22893,6 @@
22859
22893
  "text": "param"
22860
22894
  }
22861
22895
  },
22862
- {
22863
- "name": "documentService",
22864
- "type": "DocumentService",
22865
- "deprecated": false,
22866
- "deprecationMessage": "",
22867
- "tagName": {
22868
- "text": "param"
22869
- }
22870
- },
22871
22896
  {
22872
22897
  "name": "dropdownService",
22873
22898
  "type": "DropdownService",
@@ -22911,7 +22936,7 @@
22911
22936
  }
22912
22937
  ],
22913
22938
  "returnType": "void",
22914
- "line": 187,
22939
+ "line": 186,
22915
22940
  "rawdescription": "\n\nText to show when nothing is selected.\n",
22916
22941
  "description": "<p>Text to show when nothing is selected.</p>\n",
22917
22942
  "jsdoctags": [
@@ -22930,7 +22955,7 @@
22930
22955
  "name": "placeholder",
22931
22956
  "type": "",
22932
22957
  "returnType": "",
22933
- "line": 191
22958
+ "line": 190
22934
22959
  }
22935
22960
  },
22936
22961
  "openMenuAria": {
@@ -22949,7 +22974,7 @@
22949
22974
  }
22950
22975
  ],
22951
22976
  "returnType": "void",
22952
- "line": 197,
22977
+ "line": 196,
22953
22978
  "rawdescription": "\n\nValue to display for accessibility purposes on the combobox control menu when closed\n",
22954
22979
  "description": "<p>Value to display for accessibility purposes on the combobox control menu when closed</p>\n",
22955
22980
  "jsdoctags": [
@@ -22968,7 +22993,7 @@
22968
22993
  "name": "openMenuAria",
22969
22994
  "type": "",
22970
22995
  "returnType": "",
22971
- "line": 201
22996
+ "line": 200
22972
22997
  }
22973
22998
  },
22974
22999
  "closeMenuAria": {
@@ -22987,7 +23012,7 @@
22987
23012
  }
22988
23013
  ],
22989
23014
  "returnType": "void",
22990
- "line": 207,
23015
+ "line": 206,
22991
23016
  "rawdescription": "\n\nValue to display for accessibility purposes on the combobox control menu when opened\n",
22992
23017
  "description": "<p>Value to display for accessibility purposes on the combobox control menu when opened</p>\n",
22993
23018
  "jsdoctags": [
@@ -23006,7 +23031,7 @@
23006
23031
  "name": "closeMenuAria",
23007
23032
  "type": "",
23008
23033
  "returnType": "",
23009
- "line": 211
23034
+ "line": 210
23010
23035
  }
23011
23036
  },
23012
23037
  "clearSelectionsTitle": {
@@ -23025,7 +23050,7 @@
23025
23050
  }
23026
23051
  ],
23027
23052
  "returnType": "void",
23028
- "line": 217,
23053
+ "line": 216,
23029
23054
  "rawdescription": "\n\nValue to display on the clear selections icon, when multi is selected\n",
23030
23055
  "description": "<p>Value to display on the clear selections icon, when multi is selected</p>\n",
23031
23056
  "jsdoctags": [
@@ -23044,7 +23069,7 @@
23044
23069
  "name": "clearSelectionsTitle",
23045
23070
  "type": "",
23046
23071
  "returnType": "",
23047
- "line": 221
23072
+ "line": 220
23048
23073
  }
23049
23074
  },
23050
23075
  "clearSelectionsAria": {
@@ -23063,7 +23088,7 @@
23063
23088
  }
23064
23089
  ],
23065
23090
  "returnType": "void",
23066
- "line": 227,
23091
+ "line": 226,
23067
23092
  "rawdescription": "\n\nValue to display for accessibility purposes to clear selections, when multi is selected\n",
23068
23093
  "description": "<p>Value to display for accessibility purposes to clear selections, when multi is selected</p>\n",
23069
23094
  "jsdoctags": [
@@ -23082,7 +23107,7 @@
23082
23107
  "name": "clearSelectionsAria",
23083
23108
  "type": "",
23084
23109
  "returnType": "",
23085
- "line": 231
23110
+ "line": 230
23086
23111
  }
23087
23112
  },
23088
23113
  "clearSelectionTitle": {
@@ -23101,7 +23126,7 @@
23101
23126
  }
23102
23127
  ],
23103
23128
  "returnType": "void",
23104
- "line": 237,
23129
+ "line": 236,
23105
23130
  "rawdescription": "\n\nValue to display on the clear the selected item icon, when single is selected\n",
23106
23131
  "description": "<p>Value to display on the clear the selected item icon, when single is selected</p>\n",
23107
23132
  "jsdoctags": [
@@ -23120,7 +23145,7 @@
23120
23145
  "name": "clearSelectionTitle",
23121
23146
  "type": "",
23122
23147
  "returnType": "",
23123
- "line": 241
23148
+ "line": 240
23124
23149
  }
23125
23150
  },
23126
23151
  "clearSelectionAria": {
@@ -23139,7 +23164,7 @@
23139
23164
  }
23140
23165
  ],
23141
23166
  "returnType": "void",
23142
- "line": 247,
23167
+ "line": 246,
23143
23168
  "rawdescription": "\n\nValue to display for accessibility purposes on the clear the selected item icon, when single is selected\n",
23144
23169
  "description": "<p>Value to display for accessibility purposes on the clear the selected item icon, when single is selected</p>\n",
23145
23170
  "jsdoctags": [
@@ -23158,7 +23183,7 @@
23158
23183
  "name": "clearSelectionAria",
23159
23184
  "type": "",
23160
23185
  "returnType": "",
23161
- "line": 251
23186
+ "line": 250
23162
23187
  }
23163
23188
  }
23164
23189
  }
@@ -78076,8 +78101,8 @@
78076
78101
  "type": "component",
78077
78102
  "linktype": "component",
78078
78103
  "name": "ComboBox",
78079
- "coveragePercent": 69,
78080
- "coverageCount": "47/68",
78104
+ "coveragePercent": 68,
78105
+ "coverageCount": "48/70",
78081
78106
  "status": "good"
78082
78107
  },
78083
78108
  {