carbon-components-angular 5.72.0 → 5.72.2
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.
- package/combobox/combobox.component.d.ts +3 -0
- package/docs/documentation/components/ComboBox.html +214 -67
- package/docs/documentation/components/Dropdown.html +322 -134
- package/docs/documentation/components/DropdownList.html +6 -2
- package/docs/documentation/components/RadioGroup.html +166 -77
- package/docs/documentation/components/TextInputLabelComponent.html +171 -65
- package/docs/documentation/components/TextareaLabelComponent.html +142 -74
- package/docs/documentation/coverage.html +22 -22
- package/docs/documentation/directives/TextArea.html +106 -11
- package/docs/documentation/directives/TextInput.html +118 -24
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/modules/CheckboxModule/dependencies.svg +42 -42
- package/docs/documentation/modules/CheckboxModule.html +42 -42
- package/docs/documentation/modules/CodeSnippetModule/dependencies.svg +4 -4
- package/docs/documentation/modules/CodeSnippetModule.html +4 -4
- package/docs/documentation/modules/ComboBoxModule/dependencies.svg +6 -6
- package/docs/documentation/modules/ComboBoxModule.html +6 -6
- package/docs/documentation/modules/ContentSwitcherModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ContentSwitcherModule.html +4 -4
- package/docs/documentation/modules/ContextMenuModule/dependencies.svg +67 -67
- package/docs/documentation/modules/ContextMenuModule.html +67 -67
- package/docs/documentation/modules/DatePickerInputModule/dependencies.svg +4 -4
- package/docs/documentation/modules/DatePickerInputModule.html +4 -4
- package/docs/documentation/modules/DatePickerModule/dependencies.svg +6 -6
- package/docs/documentation/modules/DatePickerModule.html +6 -6
- package/docs/documentation/modules/DialogModule/dependencies.svg +33 -33
- package/docs/documentation/modules/DialogModule.html +33 -33
- package/docs/documentation/modules/DocumentationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/DocumentationModule.html +4 -4
- package/docs/documentation/modules/DropdownModule/dependencies.svg +53 -53
- package/docs/documentation/modules/DropdownModule.html +53 -53
- package/docs/documentation/modules/FileUploaderModule/dependencies.svg +35 -35
- package/docs/documentation/modules/FileUploaderModule.html +35 -35
- package/docs/documentation/modules/GridModule/dependencies.svg +61 -61
- package/docs/documentation/modules/GridModule.html +61 -61
- package/docs/documentation/modules/HeaderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/HeaderModule.html +4 -4
- package/docs/documentation/modules/I18nModule/dependencies.svg +13 -13
- package/docs/documentation/modules/I18nModule.html +13 -13
- package/docs/documentation/modules/InlineLoadingModule/dependencies.svg +15 -15
- package/docs/documentation/modules/InlineLoadingModule.html +15 -15
- package/docs/documentation/modules/InputModule/dependencies.svg +4 -4
- package/docs/documentation/modules/InputModule.html +4 -4
- package/docs/documentation/modules/LayerModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LayerModule.html +4 -4
- package/docs/documentation/modules/MenuButtonModule/dependencies.svg +4 -4
- package/docs/documentation/modules/MenuButtonModule.html +4 -4
- package/docs/documentation/modules/ModalModule/dependencies.svg +114 -114
- package/docs/documentation/modules/ModalModule.html +114 -114
- package/docs/documentation/modules/NFormsModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NFormsModule.html +4 -4
- package/docs/documentation/modules/NotificationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NotificationModule.html +4 -4
- package/docs/documentation/modules/NumberModule/dependencies.svg +25 -25
- package/docs/documentation/modules/NumberModule.html +25 -25
- package/docs/documentation/modules/PaginationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PaginationModule.html +4 -4
- package/docs/documentation/modules/PanelModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PanelModule.html +4 -4
- package/docs/documentation/modules/PlaceholderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PlaceholderModule.html +4 -4
- package/docs/documentation/modules/RadioModule/dependencies.svg +4 -4
- package/docs/documentation/modules/RadioModule.html +4 -4
- package/docs/documentation/modules/SearchModule/dependencies.svg +48 -44
- package/docs/documentation/modules/SearchModule.html +48 -44
- package/docs/documentation/modules/SelectModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SelectModule.html +4 -4
- package/docs/documentation/modules/SideNavModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SideNavModule.html +4 -4
- package/docs/documentation/modules/SkeletonModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SkeletonModule.html +4 -4
- package/docs/documentation/modules/SliderModule/dependencies.svg +26 -26
- package/docs/documentation/modules/SliderModule.html +26 -26
- package/docs/documentation/modules/StructuredListModule/dependencies.svg +43 -43
- package/docs/documentation/modules/StructuredListModule.html +43 -43
- package/docs/documentation/modules/TableModule/dependencies.svg +225 -225
- package/docs/documentation/modules/TableModule.html +225 -225
- package/docs/documentation/modules/TabsModule/dependencies.svg +136 -136
- package/docs/documentation/modules/TabsModule.html +136 -136
- package/docs/documentation/modules/TagModule/dependencies.svg +38 -38
- package/docs/documentation/modules/TagModule.html +38 -38
- package/docs/documentation/modules/ThemeModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ThemeModule.html +4 -4
- package/docs/documentation/modules/TilesModule/dependencies.svg +108 -108
- package/docs/documentation/modules/TilesModule.html +108 -108
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +41 -45
- package/docs/documentation/modules/TimePickerModule.html +41 -45
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +46 -42
- package/docs/documentation/modules/TimePickerSelectModule.html +46 -42
- package/docs/documentation/modules/ToggleModule/dependencies.svg +7 -7
- package/docs/documentation/modules/ToggleModule.html +7 -7
- package/docs/documentation/modules/TooltipModule/dependencies.svg +28 -28
- package/docs/documentation/modules/TooltipModule.html +28 -28
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +28 -28
- package/docs/documentation/modules/TreeviewModule.html +28 -28
- package/docs/documentation.json +510 -362
- package/docs/storybook/1345.da6e3dec.iframe.bundle.js +1 -0
- package/docs/storybook/3224.14e2c79a.iframe.bundle.js +1 -0
- package/docs/storybook/557.d4341469.iframe.bundle.js +1 -0
- package/docs/storybook/7019.75ad5817.iframe.bundle.js +2 -0
- package/docs/storybook/955.7522f55b.iframe.bundle.js +1 -0
- package/docs/storybook/combobox-combobox-stories.e3d08f7d.iframe.bundle.js +1 -0
- package/docs/storybook/dropdown-dropdown-stories.cf59b2ab.iframe.bundle.js +1 -0
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/{input-input-stories.85a9e65e.iframe.bundle.js → input-input-stories.8bf34960.iframe.bundle.js} +1 -1
- package/docs/storybook/{input-textarea-stories.77240fb3.iframe.bundle.js → input-textarea-stories.ad775432.iframe.bundle.js} +1 -1
- package/docs/storybook/main.a1247bb8.iframe.bundle.js +1 -0
- package/docs/storybook/modal-modal-stories.cc2d04cb.iframe.bundle.js +1 -0
- package/docs/storybook/{pagination-pagination-nav-stories.547eede3.iframe.bundle.js → pagination-pagination-nav-stories.01637d11.iframe.bundle.js} +1 -1
- package/docs/storybook/{pagination-pagination-stories.fa7c9094.iframe.bundle.js → pagination-pagination-stories.40d17ebd.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-filtering-single-selection-stories.ec91f833.iframe.bundle.js → patterns-filtering-multi-selection-stories.a46a1d6e.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-filtering-multiple-categories-stories.531f27d7.iframe.bundle.js → patterns-filtering-multiple-categories-stories.740c719e.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-filtering-multi-selection-stories.9086f77f.iframe.bundle.js → patterns-filtering-single-selection-stories.cc647b4a.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-forms-multi-step-form-stories.8696062a.iframe.bundle.js → patterns-forms-multi-step-form-stories.2ea46e56.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-loading-large-loading-stories.734fb9bc.iframe.bundle.js → patterns-loading-large-loading-stories.e6ae3e31.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-loading-progressive-loading-stories.10bcf9f2.iframe.bundle.js → patterns-loading-progressive-loading-stories.63165c09.iframe.bundle.js} +1 -1
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/radio-radio-stories.8ff73370.iframe.bundle.js +1 -0
- package/docs/storybook/runtime~main.b11c471e.iframe.bundle.js +1 -0
- package/dropdown/dropdown.component.d.ts +8 -1
- package/dropdown/list/dropdown-list.component.d.ts +1 -1
- package/esm2020/combobox/combobox.component.mjs +19 -9
- package/esm2020/dropdown/dropdown.component.mjs +31 -15
- package/esm2020/dropdown/list/dropdown-list.component.mjs +1 -1
- package/esm2020/input/input.directive.mjs +11 -5
- package/esm2020/input/text-area.directive.mjs +11 -5
- package/esm2020/input/text-input-label.component.mjs +38 -15
- package/esm2020/input/textarea-label.component.mjs +46 -21
- package/esm2020/radio/radio-group.component.mjs +19 -7
- package/fesm2015/carbon-components-angular-combobox.mjs +18 -8
- package/fesm2015/carbon-components-angular-combobox.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-dropdown.mjs +31 -14
- package/fesm2015/carbon-components-angular-dropdown.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-input.mjs +112 -46
- package/fesm2015/carbon-components-angular-input.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-radio.mjs +18 -6
- package/fesm2015/carbon-components-angular-radio.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-combobox.mjs +18 -8
- package/fesm2020/carbon-components-angular-combobox.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-dropdown.mjs +30 -14
- package/fesm2020/carbon-components-angular-dropdown.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-input.mjs +102 -45
- package/fesm2020/carbon-components-angular-input.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-radio.mjs +18 -6
- package/fesm2020/carbon-components-angular-radio.mjs.map +1 -1
- package/input/input.directive.d.ts +4 -1
- package/input/text-area.directive.d.ts +4 -1
- package/input/text-input-label.component.d.ts +9 -5
- package/input/textarea-label.component.d.ts +5 -3
- package/package.json +1 -1
- package/radio/radio-group.component.d.ts +4 -2
- package/docs/storybook/1250.47c381c1.iframe.bundle.js +0 -1
- package/docs/storybook/1345.9ccf4f3f.iframe.bundle.js +0 -1
- package/docs/storybook/3224.3e279e46.iframe.bundle.js +0 -1
- package/docs/storybook/7019.b8944046.iframe.bundle.js +0 -2
- package/docs/storybook/955.99b6ac85.iframe.bundle.js +0 -1
- package/docs/storybook/combobox-combobox-stories.e7427226.iframe.bundle.js +0 -1
- package/docs/storybook/dropdown-dropdown-stories.a76101be.iframe.bundle.js +0 -1
- package/docs/storybook/main.cdbf1814.iframe.bundle.js +0 -1
- package/docs/storybook/modal-modal-stories.0a864a6a.iframe.bundle.js +0 -1
- package/docs/storybook/radio-radio-stories.444fc044.iframe.bundle.js +0 -1
- package/docs/storybook/runtime~main.e32f2dfb.iframe.bundle.js +0 -1
- /package/docs/storybook/{7019.b8944046.iframe.bundle.js.LICENSE.txt → 7019.75ad5817.iframe.bundle.js.LICENSE.txt} +0 -0
package/docs/documentation.json
CHANGED
|
@@ -19018,12 +19018,12 @@
|
|
|
19018
19018
|
},
|
|
19019
19019
|
{
|
|
19020
19020
|
"name": "TextArea",
|
|
19021
|
-
"id": "directive-TextArea-
|
|
19021
|
+
"id": "directive-TextArea-437bb57944f06b6ddc9e513ee256c9647c385f8688d2af0d8267a994ea98b7d5c4bd06acab4c05d786994bfcea582fecad321f89ceb8215a64fe2229f7d85415",
|
|
19022
19022
|
"file": "src/input/text-area.directive.ts",
|
|
19023
19023
|
"type": "directive",
|
|
19024
19024
|
"description": "<p>A directive for applying styling to a textarea element.</p>\n<p>Example:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-html\"><textarea cdsTextArea></textarea></code></pre></div><p>See the <a href=\"http://www.carbondesignsystem.com/components/text-input/code\">vanilla carbon docs</a> for more detail.</p>\n",
|
|
19025
19025
|
"rawdescription": "\n\nA directive for applying styling to a textarea element.\n\nExample:\n\n```html\n<textarea cdsTextArea></textarea>\n```\n\nSee the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.\n",
|
|
19026
|
-
"sourceCode": "import { Directive, HostBinding, Input } from \"@angular/core\";\n\n/**\n * A directive for applying styling to a textarea element.\n *\n * Example:\n *\n * ```html\n * <textarea cdsTextArea></textarea>\n * ```\n *\n * See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.\n */\n@Directive({\n\tselector: \"[cdsTextArea], [ibmTextArea]\"\n})\nexport class TextArea {\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` input theme\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\n\t@HostBinding(\"class.cds--text-area\") baseClass = true;\n\t@HostBinding(\"class.cds--text-area--invalid\") @Input() invalid = false;\n\t/**\n\t * Set to `true` to put the textarea in a warning state.\n\t */\n\t@HostBinding(\"class.cds--text-area--warn\") @Input() warn = false;\n\t@HostBinding(\"class.cds--skeleton\") @Input() skeleton = false;\n\t@HostBinding(\"class.cds--text-area--light\") get isLightTheme() {\n\t\treturn this.theme === \"light\";\n\t}\n\n\t@HostBinding(\"attr.data-invalid\") get getInvalidAttr() {\n\t\treturn this.invalid ? true : undefined;\n\t}\n}\n",
|
|
19026
|
+
"sourceCode": "import { Directive, HostBinding, Input, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\n\n/**\n * A directive for applying styling to a textarea element.\n *\n * Example:\n *\n * ```html\n * <textarea cdsTextArea></textarea>\n * ```\n *\n * See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.\n */\n@Directive({\n\tselector: \"[cdsTextArea], [ibmTextArea]\"\n})\nexport class TextArea {\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` input theme\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\n\t@HostBinding(\"class.cds--text-area\") baseClass = true;\n\t@HostBinding(\"class.cds--text-area--invalid\") @Input() invalid = false;\n\t/**\n\t * Set to `true` to put the textarea in a warning state.\n\t */\n\t@HostBinding(\"class.cds--text-area--warn\") @Input() warn = false;\n\t@HostBinding(\"class.cds--skeleton\") @Input() skeleton = false;\n\t@HostBinding(\"class.cds--text-area--light\") get isLightTheme() {\n\t\treturn this.theme === \"light\";\n\t}\n\n\t@HostBinding(\"attr.data-invalid\") get getInvalidAttr() {\n\t\treturn this.invalid ? true : undefined;\n\t}\n\n\tconstructor(@Self() @Optional() public ngControl: NgControl) {}\n}\n",
|
|
19027
19027
|
"selector": "[cdsTextArea], [ibmTextArea]",
|
|
19028
19028
|
"providers": [],
|
|
19029
19029
|
"hostDirectives": [],
|
|
@@ -19034,7 +19034,7 @@
|
|
|
19034
19034
|
"defaultValue": "false",
|
|
19035
19035
|
"deprecated": false,
|
|
19036
19036
|
"deprecationMessage": "",
|
|
19037
|
-
"line":
|
|
19037
|
+
"line": 26,
|
|
19038
19038
|
"type": "boolean",
|
|
19039
19039
|
"decorators": []
|
|
19040
19040
|
},
|
|
@@ -19043,7 +19043,7 @@
|
|
|
19043
19043
|
"defaultValue": "false",
|
|
19044
19044
|
"deprecated": false,
|
|
19045
19045
|
"deprecationMessage": "",
|
|
19046
|
-
"line":
|
|
19046
|
+
"line": 31,
|
|
19047
19047
|
"type": "boolean",
|
|
19048
19048
|
"decorators": []
|
|
19049
19049
|
},
|
|
@@ -19054,15 +19054,15 @@
|
|
|
19054
19054
|
"deprecationMessage": "since v5 - Use `cdsLayer` directive instead\n`light` or `dark` input theme",
|
|
19055
19055
|
"jsdoctags": [
|
|
19056
19056
|
{
|
|
19057
|
-
"pos":
|
|
19058
|
-
"end":
|
|
19057
|
+
"pos": 470,
|
|
19058
|
+
"end": 562,
|
|
19059
19059
|
"flags": 16842752,
|
|
19060
19060
|
"modifierFlagsCache": 0,
|
|
19061
19061
|
"transformFlags": 0,
|
|
19062
19062
|
"kind": 338,
|
|
19063
19063
|
"tagName": {
|
|
19064
|
-
"pos":
|
|
19065
|
-
"end":
|
|
19064
|
+
"pos": 471,
|
|
19065
|
+
"end": 481,
|
|
19066
19066
|
"flags": 16842752,
|
|
19067
19067
|
"modifierFlagsCache": 0,
|
|
19068
19068
|
"transformFlags": 0,
|
|
@@ -19072,7 +19072,7 @@
|
|
|
19072
19072
|
"comment": "<p>since v5 - Use <code>cdsLayer</code> directive instead\n<code>light</code> or <code>dark</code> input theme</p>\n"
|
|
19073
19073
|
}
|
|
19074
19074
|
],
|
|
19075
|
-
"line":
|
|
19075
|
+
"line": 23,
|
|
19076
19076
|
"type": "\"light\" | \"dark\"",
|
|
19077
19077
|
"decorators": []
|
|
19078
19078
|
},
|
|
@@ -19083,7 +19083,7 @@
|
|
|
19083
19083
|
"deprecationMessage": "",
|
|
19084
19084
|
"rawdescription": "\n\nSet to `true` to put the textarea in a warning state.\n",
|
|
19085
19085
|
"description": "<p>Set to <code>true</code> to put the textarea in a warning state.</p>\n",
|
|
19086
|
-
"line":
|
|
19086
|
+
"line": 30,
|
|
19087
19087
|
"type": "boolean",
|
|
19088
19088
|
"decorators": []
|
|
19089
19089
|
}
|
|
@@ -19096,7 +19096,7 @@
|
|
|
19096
19096
|
"name": "attr.data-invalid",
|
|
19097
19097
|
"deprecated": false,
|
|
19098
19098
|
"deprecationMessage": "",
|
|
19099
|
-
"line":
|
|
19099
|
+
"line": 36,
|
|
19100
19100
|
"type": "boolean",
|
|
19101
19101
|
"decorators": []
|
|
19102
19102
|
},
|
|
@@ -19105,7 +19105,7 @@
|
|
|
19105
19105
|
"defaultValue": "true",
|
|
19106
19106
|
"deprecated": false,
|
|
19107
19107
|
"deprecationMessage": "",
|
|
19108
|
-
"line":
|
|
19108
|
+
"line": 25,
|
|
19109
19109
|
"type": "boolean",
|
|
19110
19110
|
"decorators": []
|
|
19111
19111
|
},
|
|
@@ -19113,7 +19113,7 @@
|
|
|
19113
19113
|
"name": "class.cds--text-area--light",
|
|
19114
19114
|
"deprecated": false,
|
|
19115
19115
|
"deprecationMessage": "",
|
|
19116
|
-
"line":
|
|
19116
|
+
"line": 32,
|
|
19117
19117
|
"type": "boolean",
|
|
19118
19118
|
"decorators": []
|
|
19119
19119
|
}
|
|
@@ -19128,7 +19128,7 @@
|
|
|
19128
19128
|
"type": "",
|
|
19129
19129
|
"optional": false,
|
|
19130
19130
|
"description": "",
|
|
19131
|
-
"line":
|
|
19131
|
+
"line": 25,
|
|
19132
19132
|
"decorators": [
|
|
19133
19133
|
{
|
|
19134
19134
|
"name": "HostBinding",
|
|
@@ -19138,10 +19138,60 @@
|
|
|
19138
19138
|
"modifierKind": [
|
|
19139
19139
|
170
|
|
19140
19140
|
]
|
|
19141
|
+
},
|
|
19142
|
+
{
|
|
19143
|
+
"name": "ngControl",
|
|
19144
|
+
"deprecated": false,
|
|
19145
|
+
"deprecationMessage": "",
|
|
19146
|
+
"type": "NgControl",
|
|
19147
|
+
"optional": false,
|
|
19148
|
+
"description": "",
|
|
19149
|
+
"line": 40,
|
|
19150
|
+
"decorators": [
|
|
19151
|
+
{
|
|
19152
|
+
"name": "Self",
|
|
19153
|
+
"stringifiedArguments": ""
|
|
19154
|
+
},
|
|
19155
|
+
{
|
|
19156
|
+
"name": "Optional",
|
|
19157
|
+
"stringifiedArguments": ""
|
|
19158
|
+
}
|
|
19159
|
+
],
|
|
19160
|
+
"modifierKind": [
|
|
19161
|
+
170,
|
|
19162
|
+
170,
|
|
19163
|
+
125
|
|
19164
|
+
]
|
|
19141
19165
|
}
|
|
19142
19166
|
],
|
|
19143
19167
|
"methodsClass": [],
|
|
19144
19168
|
"extends": [],
|
|
19169
|
+
"constructorObj": {
|
|
19170
|
+
"name": "constructor",
|
|
19171
|
+
"description": "",
|
|
19172
|
+
"deprecated": false,
|
|
19173
|
+
"deprecationMessage": "",
|
|
19174
|
+
"args": [
|
|
19175
|
+
{
|
|
19176
|
+
"name": "ngControl",
|
|
19177
|
+
"type": "NgControl",
|
|
19178
|
+
"deprecated": false,
|
|
19179
|
+
"deprecationMessage": ""
|
|
19180
|
+
}
|
|
19181
|
+
],
|
|
19182
|
+
"line": 38,
|
|
19183
|
+
"jsdoctags": [
|
|
19184
|
+
{
|
|
19185
|
+
"name": "ngControl",
|
|
19186
|
+
"type": "NgControl",
|
|
19187
|
+
"deprecated": false,
|
|
19188
|
+
"deprecationMessage": "",
|
|
19189
|
+
"tagName": {
|
|
19190
|
+
"text": "param"
|
|
19191
|
+
}
|
|
19192
|
+
}
|
|
19193
|
+
]
|
|
19194
|
+
},
|
|
19145
19195
|
"accessors": {
|
|
19146
19196
|
"isLightTheme": {
|
|
19147
19197
|
"name": "isLightTheme",
|
|
@@ -19149,7 +19199,7 @@
|
|
|
19149
19199
|
"name": "isLightTheme",
|
|
19150
19200
|
"type": "",
|
|
19151
19201
|
"returnType": "",
|
|
19152
|
-
"line":
|
|
19202
|
+
"line": 32
|
|
19153
19203
|
}
|
|
19154
19204
|
},
|
|
19155
19205
|
"getInvalidAttr": {
|
|
@@ -19158,19 +19208,19 @@
|
|
|
19158
19208
|
"name": "getInvalidAttr",
|
|
19159
19209
|
"type": "",
|
|
19160
19210
|
"returnType": "",
|
|
19161
|
-
"line":
|
|
19211
|
+
"line": 36
|
|
19162
19212
|
}
|
|
19163
19213
|
}
|
|
19164
19214
|
}
|
|
19165
19215
|
},
|
|
19166
19216
|
{
|
|
19167
19217
|
"name": "TextInput",
|
|
19168
|
-
"id": "directive-TextInput-
|
|
19218
|
+
"id": "directive-TextInput-7e1b2524d20b795ceb5ea3a24f454ecd25a6e66539384bf1200f2fc477f904da9f4f9b3b525df5bd7f9852c4efcebd89d48b612eb5755552613cb4269422df58",
|
|
19169
19219
|
"file": "src/input/input.directive.ts",
|
|
19170
19220
|
"type": "directive",
|
|
19171
19221
|
"description": "<p>A directive for applying styling to an input element.</p>\n<p>Example:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-html\"><input cdsText/></code></pre></div><p>See the <a href=\"http://www.carbondesignsystem.com/components/text-input/code\">vanilla carbon docs</a> for more detail.</p>\n",
|
|
19172
19222
|
"rawdescription": "\n\nA directive for applying styling to an input element.\n\nExample:\n\n```html\n<input cdsText/>\n```\n\nSee the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.\n",
|
|
19173
|
-
"sourceCode": "import { Directive, HostBinding, Input } from \"@angular/core\";\n\n/**\n * A directive for applying styling to an input element.\n *\n * Example:\n *\n * ```html\n * <input cdsText/>\n * ```\n *\n * See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.\n */\n@Directive({\n\tselector: \"[cdsText], [ibmText]\"\n})\nexport class TextInput {\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` input theme\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\n\t/**\n\t * Input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\n\t@HostBinding(\"class.cds--text-input\") inputClass = true;\n\n\t/**\n\t * @todo - remove `cds--text-input--${size}` classes in v12\n\t */\n\t@HostBinding(\"class.cds--text-input--sm\") get isSizeSm() {\n\t\treturn this.size === \"sm\";\n\t}\n\t@HostBinding(\"class.cds--text-input--md\") get isSizeMd() {\n\t\treturn this.size === \"md\";\n\t}\n\t@HostBinding(\"class.cds--text-input--lg\") get isSizelg() {\n\t\treturn this.size === \"lg\";\n\t}\n\n\t// Size\n\t@HostBinding(\"class.cds--layout--size-sm\") get sizeSm() {\n\t\treturn this.size === \"sm\";\n\t}\n\t@HostBinding(\"class.cds--layout--size-md\") get sizeMd() {\n\t\treturn this.size === \"md\";\n\t}\n\t@HostBinding(\"class.cds--layout--size-lg\") get sizelg() {\n\t\treturn this.size === \"lg\";\n\t}\n\n\t@HostBinding(\"class.cds--text-input--invalid\") @Input() invalid = false;\n\t@HostBinding(\"class.cds--text-input--warning\") @Input() warn = false;\n\t@HostBinding(\"class.cds--skeleton\") @Input() skeleton = false;\n\t@HostBinding(\"class.cds--text-input--light\") get isLightTheme() {\n\t\treturn this.theme === \"light\";\n\t}\n\n\t@HostBinding(\"attr.data-invalid\") get getInvalidAttribute() {\n\t\treturn this.invalid ? true : undefined;\n\t}\n\n}\n",
|
|
19223
|
+
"sourceCode": "import { Directive, HostBinding, Input, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\n\n/**\n * A directive for applying styling to an input element.\n *\n * Example:\n *\n * ```html\n * <input cdsText/>\n * ```\n *\n * See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.\n */\n@Directive({\n\tselector: \"[cdsText], [ibmText]\"\n})\nexport class TextInput {\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` input theme\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\n\t/**\n\t * Input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\n\t@HostBinding(\"class.cds--text-input\") inputClass = true;\n\n\t/**\n\t * @todo - remove `cds--text-input--${size}` classes in v12\n\t */\n\t@HostBinding(\"class.cds--text-input--sm\") get isSizeSm() {\n\t\treturn this.size === \"sm\";\n\t}\n\t@HostBinding(\"class.cds--text-input--md\") get isSizeMd() {\n\t\treturn this.size === \"md\";\n\t}\n\t@HostBinding(\"class.cds--text-input--lg\") get isSizelg() {\n\t\treturn this.size === \"lg\";\n\t}\n\n\t// Size\n\t@HostBinding(\"class.cds--layout--size-sm\") get sizeSm() {\n\t\treturn this.size === \"sm\";\n\t}\n\t@HostBinding(\"class.cds--layout--size-md\") get sizeMd() {\n\t\treturn this.size === \"md\";\n\t}\n\t@HostBinding(\"class.cds--layout--size-lg\") get sizelg() {\n\t\treturn this.size === \"lg\";\n\t}\n\n\t@HostBinding(\"class.cds--text-input--invalid\") @Input() invalid = false;\n\t@HostBinding(\"class.cds--text-input--warning\") @Input() warn = false;\n\t@HostBinding(\"class.cds--skeleton\") @Input() skeleton = false;\n\t@HostBinding(\"class.cds--text-input--light\") get isLightTheme() {\n\t\treturn this.theme === \"light\";\n\t}\n\n\t@HostBinding(\"attr.data-invalid\") get getInvalidAttribute() {\n\t\treturn this.invalid ? true : undefined;\n\t}\n\n\tconstructor(@Self() @Optional() public ngControl: NgControl) {}\n}\n",
|
|
19174
19224
|
"selector": "[cdsText], [ibmText]",
|
|
19175
19225
|
"providers": [],
|
|
19176
19226
|
"hostDirectives": [],
|
|
@@ -19181,7 +19231,7 @@
|
|
|
19181
19231
|
"defaultValue": "false",
|
|
19182
19232
|
"deprecated": false,
|
|
19183
19233
|
"deprecationMessage": "",
|
|
19184
|
-
"line":
|
|
19234
|
+
"line": 56,
|
|
19185
19235
|
"type": "boolean",
|
|
19186
19236
|
"decorators": []
|
|
19187
19237
|
},
|
|
@@ -19192,7 +19242,7 @@
|
|
|
19192
19242
|
"deprecationMessage": "",
|
|
19193
19243
|
"rawdescription": "\n\nInput field render size\n",
|
|
19194
19244
|
"description": "<p>Input field render size</p>\n",
|
|
19195
|
-
"line":
|
|
19245
|
+
"line": 28,
|
|
19196
19246
|
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
19197
19247
|
"decorators": []
|
|
19198
19248
|
},
|
|
@@ -19201,7 +19251,7 @@
|
|
|
19201
19251
|
"defaultValue": "false",
|
|
19202
19252
|
"deprecated": false,
|
|
19203
19253
|
"deprecationMessage": "",
|
|
19204
|
-
"line":
|
|
19254
|
+
"line": 58,
|
|
19205
19255
|
"type": "boolean",
|
|
19206
19256
|
"decorators": []
|
|
19207
19257
|
},
|
|
@@ -19212,15 +19262,15 @@
|
|
|
19212
19262
|
"deprecationMessage": "since v5 - Use `cdsLayer` directive instead\n`light` or `dark` input theme",
|
|
19213
19263
|
"jsdoctags": [
|
|
19214
19264
|
{
|
|
19215
|
-
"pos":
|
|
19216
|
-
"end":
|
|
19265
|
+
"pos": 444,
|
|
19266
|
+
"end": 536,
|
|
19217
19267
|
"flags": 16842752,
|
|
19218
19268
|
"modifierFlagsCache": 0,
|
|
19219
19269
|
"transformFlags": 0,
|
|
19220
19270
|
"kind": 338,
|
|
19221
19271
|
"tagName": {
|
|
19222
|
-
"pos":
|
|
19223
|
-
"end":
|
|
19272
|
+
"pos": 445,
|
|
19273
|
+
"end": 455,
|
|
19224
19274
|
"flags": 16842752,
|
|
19225
19275
|
"modifierFlagsCache": 0,
|
|
19226
19276
|
"transformFlags": 0,
|
|
@@ -19230,7 +19280,7 @@
|
|
|
19230
19280
|
"comment": "<p>since v5 - Use <code>cdsLayer</code> directive instead\n<code>light</code> or <code>dark</code> input theme</p>\n"
|
|
19231
19281
|
}
|
|
19232
19282
|
],
|
|
19233
|
-
"line":
|
|
19283
|
+
"line": 23,
|
|
19234
19284
|
"type": "\"light\" | \"dark\"",
|
|
19235
19285
|
"decorators": []
|
|
19236
19286
|
},
|
|
@@ -19239,7 +19289,7 @@
|
|
|
19239
19289
|
"defaultValue": "false",
|
|
19240
19290
|
"deprecated": false,
|
|
19241
19291
|
"deprecationMessage": "",
|
|
19242
|
-
"line":
|
|
19292
|
+
"line": 57,
|
|
19243
19293
|
"type": "boolean",
|
|
19244
19294
|
"decorators": []
|
|
19245
19295
|
}
|
|
@@ -19252,7 +19302,7 @@
|
|
|
19252
19302
|
"name": "attr.data-invalid",
|
|
19253
19303
|
"deprecated": false,
|
|
19254
19304
|
"deprecationMessage": "",
|
|
19255
|
-
"line":
|
|
19305
|
+
"line": 63,
|
|
19256
19306
|
"type": "boolean",
|
|
19257
19307
|
"decorators": []
|
|
19258
19308
|
},
|
|
@@ -19260,7 +19310,7 @@
|
|
|
19260
19310
|
"name": "class.cds--layout--size-lg",
|
|
19261
19311
|
"deprecated": false,
|
|
19262
19312
|
"deprecationMessage": "",
|
|
19263
|
-
"line":
|
|
19313
|
+
"line": 52,
|
|
19264
19314
|
"type": "boolean",
|
|
19265
19315
|
"decorators": []
|
|
19266
19316
|
},
|
|
@@ -19268,7 +19318,7 @@
|
|
|
19268
19318
|
"name": "class.cds--layout--size-md",
|
|
19269
19319
|
"deprecated": false,
|
|
19270
19320
|
"deprecationMessage": "",
|
|
19271
|
-
"line":
|
|
19321
|
+
"line": 49,
|
|
19272
19322
|
"type": "boolean",
|
|
19273
19323
|
"decorators": []
|
|
19274
19324
|
},
|
|
@@ -19276,7 +19326,7 @@
|
|
|
19276
19326
|
"name": "class.cds--layout--size-sm",
|
|
19277
19327
|
"deprecated": false,
|
|
19278
19328
|
"deprecationMessage": "",
|
|
19279
|
-
"line":
|
|
19329
|
+
"line": 46,
|
|
19280
19330
|
"type": "boolean",
|
|
19281
19331
|
"decorators": []
|
|
19282
19332
|
},
|
|
@@ -19285,7 +19335,7 @@
|
|
|
19285
19335
|
"defaultValue": "true",
|
|
19286
19336
|
"deprecated": false,
|
|
19287
19337
|
"deprecationMessage": "",
|
|
19288
|
-
"line":
|
|
19338
|
+
"line": 30,
|
|
19289
19339
|
"type": "boolean",
|
|
19290
19340
|
"decorators": []
|
|
19291
19341
|
},
|
|
@@ -19293,7 +19343,7 @@
|
|
|
19293
19343
|
"name": "class.cds--text-input--lg",
|
|
19294
19344
|
"deprecated": false,
|
|
19295
19345
|
"deprecationMessage": "",
|
|
19296
|
-
"line":
|
|
19346
|
+
"line": 41,
|
|
19297
19347
|
"type": "boolean",
|
|
19298
19348
|
"decorators": []
|
|
19299
19349
|
},
|
|
@@ -19301,7 +19351,7 @@
|
|
|
19301
19351
|
"name": "class.cds--text-input--light",
|
|
19302
19352
|
"deprecated": false,
|
|
19303
19353
|
"deprecationMessage": "",
|
|
19304
|
-
"line":
|
|
19354
|
+
"line": 59,
|
|
19305
19355
|
"type": "boolean",
|
|
19306
19356
|
"decorators": []
|
|
19307
19357
|
},
|
|
@@ -19309,7 +19359,7 @@
|
|
|
19309
19359
|
"name": "class.cds--text-input--md",
|
|
19310
19360
|
"deprecated": false,
|
|
19311
19361
|
"deprecationMessage": "",
|
|
19312
|
-
"line":
|
|
19362
|
+
"line": 38,
|
|
19313
19363
|
"type": "boolean",
|
|
19314
19364
|
"decorators": []
|
|
19315
19365
|
},
|
|
@@ -19319,15 +19369,15 @@
|
|
|
19319
19369
|
"deprecationMessage": "",
|
|
19320
19370
|
"jsdoctags": [
|
|
19321
19371
|
{
|
|
19322
|
-
"pos":
|
|
19323
|
-
"end":
|
|
19372
|
+
"pos": 734,
|
|
19373
|
+
"end": 793,
|
|
19324
19374
|
"flags": 16842752,
|
|
19325
19375
|
"modifierFlagsCache": 0,
|
|
19326
19376
|
"transformFlags": 0,
|
|
19327
19377
|
"kind": 334,
|
|
19328
19378
|
"tagName": {
|
|
19329
|
-
"pos":
|
|
19330
|
-
"end":
|
|
19379
|
+
"pos": 735,
|
|
19380
|
+
"end": 739,
|
|
19331
19381
|
"flags": 16842752,
|
|
19332
19382
|
"modifierFlagsCache": 0,
|
|
19333
19383
|
"transformFlags": 0,
|
|
@@ -19337,7 +19387,7 @@
|
|
|
19337
19387
|
"comment": "<ul>\n<li>remove <code>cds--text-input--${size}</code> classes in v12</li>\n</ul>\n"
|
|
19338
19388
|
}
|
|
19339
19389
|
],
|
|
19340
|
-
"line":
|
|
19390
|
+
"line": 35,
|
|
19341
19391
|
"type": "boolean",
|
|
19342
19392
|
"decorators": []
|
|
19343
19393
|
}
|
|
@@ -19352,7 +19402,7 @@
|
|
|
19352
19402
|
"type": "",
|
|
19353
19403
|
"optional": false,
|
|
19354
19404
|
"description": "",
|
|
19355
|
-
"line":
|
|
19405
|
+
"line": 30,
|
|
19356
19406
|
"decorators": [
|
|
19357
19407
|
{
|
|
19358
19408
|
"name": "HostBinding",
|
|
@@ -19362,10 +19412,60 @@
|
|
|
19362
19412
|
"modifierKind": [
|
|
19363
19413
|
170
|
|
19364
19414
|
]
|
|
19415
|
+
},
|
|
19416
|
+
{
|
|
19417
|
+
"name": "ngControl",
|
|
19418
|
+
"deprecated": false,
|
|
19419
|
+
"deprecationMessage": "",
|
|
19420
|
+
"type": "NgControl",
|
|
19421
|
+
"optional": false,
|
|
19422
|
+
"description": "",
|
|
19423
|
+
"line": 67,
|
|
19424
|
+
"decorators": [
|
|
19425
|
+
{
|
|
19426
|
+
"name": "Self",
|
|
19427
|
+
"stringifiedArguments": ""
|
|
19428
|
+
},
|
|
19429
|
+
{
|
|
19430
|
+
"name": "Optional",
|
|
19431
|
+
"stringifiedArguments": ""
|
|
19432
|
+
}
|
|
19433
|
+
],
|
|
19434
|
+
"modifierKind": [
|
|
19435
|
+
170,
|
|
19436
|
+
170,
|
|
19437
|
+
125
|
|
19438
|
+
]
|
|
19365
19439
|
}
|
|
19366
19440
|
],
|
|
19367
19441
|
"methodsClass": [],
|
|
19368
19442
|
"extends": [],
|
|
19443
|
+
"constructorObj": {
|
|
19444
|
+
"name": "constructor",
|
|
19445
|
+
"description": "",
|
|
19446
|
+
"deprecated": false,
|
|
19447
|
+
"deprecationMessage": "",
|
|
19448
|
+
"args": [
|
|
19449
|
+
{
|
|
19450
|
+
"name": "ngControl",
|
|
19451
|
+
"type": "NgControl",
|
|
19452
|
+
"deprecated": false,
|
|
19453
|
+
"deprecationMessage": ""
|
|
19454
|
+
}
|
|
19455
|
+
],
|
|
19456
|
+
"line": 65,
|
|
19457
|
+
"jsdoctags": [
|
|
19458
|
+
{
|
|
19459
|
+
"name": "ngControl",
|
|
19460
|
+
"type": "NgControl",
|
|
19461
|
+
"deprecated": false,
|
|
19462
|
+
"deprecationMessage": "",
|
|
19463
|
+
"tagName": {
|
|
19464
|
+
"text": "param"
|
|
19465
|
+
}
|
|
19466
|
+
}
|
|
19467
|
+
]
|
|
19468
|
+
},
|
|
19369
19469
|
"accessors": {
|
|
19370
19470
|
"isSizeSm": {
|
|
19371
19471
|
"name": "isSizeSm",
|
|
@@ -19373,20 +19473,20 @@
|
|
|
19373
19473
|
"name": "isSizeSm",
|
|
19374
19474
|
"type": "",
|
|
19375
19475
|
"returnType": "",
|
|
19376
|
-
"line":
|
|
19476
|
+
"line": 35,
|
|
19377
19477
|
"rawdescription": "\n\n",
|
|
19378
19478
|
"description": "",
|
|
19379
19479
|
"jsdoctags": [
|
|
19380
19480
|
{
|
|
19381
|
-
"pos":
|
|
19382
|
-
"end":
|
|
19481
|
+
"pos": 734,
|
|
19482
|
+
"end": 793,
|
|
19383
19483
|
"flags": 16842752,
|
|
19384
19484
|
"modifierFlagsCache": 0,
|
|
19385
19485
|
"transformFlags": 0,
|
|
19386
19486
|
"kind": 334,
|
|
19387
19487
|
"tagName": {
|
|
19388
|
-
"pos":
|
|
19389
|
-
"end":
|
|
19488
|
+
"pos": 735,
|
|
19489
|
+
"end": 739,
|
|
19390
19490
|
"flags": 16842752,
|
|
19391
19491
|
"modifierFlagsCache": 0,
|
|
19392
19492
|
"transformFlags": 0,
|
|
@@ -19404,7 +19504,7 @@
|
|
|
19404
19504
|
"name": "isSizeMd",
|
|
19405
19505
|
"type": "",
|
|
19406
19506
|
"returnType": "",
|
|
19407
|
-
"line":
|
|
19507
|
+
"line": 38
|
|
19408
19508
|
}
|
|
19409
19509
|
},
|
|
19410
19510
|
"isSizelg": {
|
|
@@ -19413,7 +19513,7 @@
|
|
|
19413
19513
|
"name": "isSizelg",
|
|
19414
19514
|
"type": "",
|
|
19415
19515
|
"returnType": "",
|
|
19416
|
-
"line":
|
|
19516
|
+
"line": 41
|
|
19417
19517
|
}
|
|
19418
19518
|
},
|
|
19419
19519
|
"sizeSm": {
|
|
@@ -19422,7 +19522,7 @@
|
|
|
19422
19522
|
"name": "sizeSm",
|
|
19423
19523
|
"type": "",
|
|
19424
19524
|
"returnType": "",
|
|
19425
|
-
"line":
|
|
19525
|
+
"line": 46
|
|
19426
19526
|
}
|
|
19427
19527
|
},
|
|
19428
19528
|
"sizeMd": {
|
|
@@ -19431,7 +19531,7 @@
|
|
|
19431
19531
|
"name": "sizeMd",
|
|
19432
19532
|
"type": "",
|
|
19433
19533
|
"returnType": "",
|
|
19434
|
-
"line":
|
|
19534
|
+
"line": 49
|
|
19435
19535
|
}
|
|
19436
19536
|
},
|
|
19437
19537
|
"sizelg": {
|
|
@@ -19440,7 +19540,7 @@
|
|
|
19440
19540
|
"name": "sizelg",
|
|
19441
19541
|
"type": "",
|
|
19442
19542
|
"returnType": "",
|
|
19443
|
-
"line":
|
|
19543
|
+
"line": 52
|
|
19444
19544
|
}
|
|
19445
19545
|
},
|
|
19446
19546
|
"isLightTheme": {
|
|
@@ -19449,7 +19549,7 @@
|
|
|
19449
19549
|
"name": "isLightTheme",
|
|
19450
19550
|
"type": "",
|
|
19451
19551
|
"returnType": "",
|
|
19452
|
-
"line":
|
|
19552
|
+
"line": 59
|
|
19453
19553
|
}
|
|
19454
19554
|
},
|
|
19455
19555
|
"getInvalidAttribute": {
|
|
@@ -19458,7 +19558,7 @@
|
|
|
19458
19558
|
"name": "getInvalidAttribute",
|
|
19459
19559
|
"type": "",
|
|
19460
19560
|
"returnType": "",
|
|
19461
|
-
"line":
|
|
19561
|
+
"line": 63
|
|
19462
19562
|
}
|
|
19463
19563
|
}
|
|
19464
19564
|
}
|
|
@@ -25953,7 +26053,7 @@
|
|
|
25953
26053
|
},
|
|
25954
26054
|
{
|
|
25955
26055
|
"name": "ComboBox",
|
|
25956
|
-
"id": "component-ComboBox-
|
|
26056
|
+
"id": "component-ComboBox-01df5a8c617e643167be1a25ea303f8ac883421cc1efcdf2681a19900f42023b15d94cee9e7dca6c68e6ae66d98e6c7b7cd2133cdac75cf1a44fa20e61a189b0",
|
|
25957
26057
|
"file": "src/combobox/combobox.component.ts",
|
|
25958
26058
|
"encapsulation": [],
|
|
25959
26059
|
"entryComponents": [],
|
|
@@ -26554,7 +26654,7 @@
|
|
|
26554
26654
|
"optional": false,
|
|
26555
26655
|
"returnType": "void",
|
|
26556
26656
|
"typeParameters": [],
|
|
26557
|
-
"line":
|
|
26657
|
+
"line": 883,
|
|
26558
26658
|
"deprecated": false,
|
|
26559
26659
|
"deprecationMessage": "",
|
|
26560
26660
|
"rawdescription": "\n\nCreates the `Dropdown` list as an element that is appended to the DOM body.\n",
|
|
@@ -26566,7 +26666,7 @@
|
|
|
26566
26666
|
"optional": false,
|
|
26567
26667
|
"returnType": "void",
|
|
26568
26668
|
"typeParameters": [],
|
|
26569
|
-
"line":
|
|
26669
|
+
"line": 894,
|
|
26570
26670
|
"deprecated": false,
|
|
26571
26671
|
"deprecationMessage": "",
|
|
26572
26672
|
"rawdescription": "\n\nCreates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n",
|
|
@@ -26585,7 +26685,7 @@
|
|
|
26585
26685
|
"optional": false,
|
|
26586
26686
|
"returnType": "void",
|
|
26587
26687
|
"typeParameters": [],
|
|
26588
|
-
"line":
|
|
26688
|
+
"line": 863,
|
|
26589
26689
|
"deprecated": false,
|
|
26590
26690
|
"deprecationMessage": "",
|
|
26591
26691
|
"rawdescription": "\n\nHandles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n",
|
|
@@ -26608,7 +26708,7 @@
|
|
|
26608
26708
|
"optional": false,
|
|
26609
26709
|
"returnType": "void",
|
|
26610
26710
|
"typeParameters": [],
|
|
26611
|
-
"line":
|
|
26711
|
+
"line": 635,
|
|
26612
26712
|
"deprecated": false,
|
|
26613
26713
|
"deprecationMessage": ""
|
|
26614
26714
|
},
|
|
@@ -26625,7 +26725,7 @@
|
|
|
26625
26725
|
"optional": false,
|
|
26626
26726
|
"returnType": "void",
|
|
26627
26727
|
"typeParameters": [],
|
|
26628
|
-
"line":
|
|
26728
|
+
"line": 923,
|
|
26629
26729
|
"deprecated": false,
|
|
26630
26730
|
"deprecationMessage": "",
|
|
26631
26731
|
"rawdescription": "\n\nHandles clicks outside of the `Dropdown` list.\n",
|
|
@@ -26648,7 +26748,7 @@
|
|
|
26648
26748
|
"optional": false,
|
|
26649
26749
|
"returnType": "any",
|
|
26650
26750
|
"typeParameters": [],
|
|
26651
|
-
"line":
|
|
26751
|
+
"line": 903,
|
|
26652
26752
|
"deprecated": false,
|
|
26653
26753
|
"deprecationMessage": "",
|
|
26654
26754
|
"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",
|
|
@@ -26667,7 +26767,7 @@
|
|
|
26667
26767
|
"optional": false,
|
|
26668
26768
|
"returnType": "void",
|
|
26669
26769
|
"typeParameters": [],
|
|
26670
|
-
"line":
|
|
26770
|
+
"line": 835,
|
|
26671
26771
|
"deprecated": false,
|
|
26672
26772
|
"deprecationMessage": "",
|
|
26673
26773
|
"jsdoctags": [
|
|
@@ -26695,7 +26795,7 @@
|
|
|
26695
26795
|
"optional": false,
|
|
26696
26796
|
"returnType": "void",
|
|
26697
26797
|
"typeParameters": [],
|
|
26698
|
-
"line":
|
|
26798
|
+
"line": 709,
|
|
26699
26799
|
"deprecated": false,
|
|
26700
26800
|
"deprecationMessage": "",
|
|
26701
26801
|
"modifierKind": [
|
|
@@ -26719,7 +26819,7 @@
|
|
|
26719
26819
|
"optional": false,
|
|
26720
26820
|
"returnType": "void",
|
|
26721
26821
|
"typeParameters": [],
|
|
26722
|
-
"line":
|
|
26822
|
+
"line": 743,
|
|
26723
26823
|
"deprecated": false,
|
|
26724
26824
|
"deprecationMessage": "",
|
|
26725
26825
|
"rawdescription": "\n\nCloses the dropdown and emits the close event.\n",
|
|
@@ -26741,7 +26841,7 @@
|
|
|
26741
26841
|
"optional": false,
|
|
26742
26842
|
"returnType": "void",
|
|
26743
26843
|
"typeParameters": [],
|
|
26744
|
-
"line":
|
|
26844
|
+
"line": 932,
|
|
26745
26845
|
"deprecated": false,
|
|
26746
26846
|
"deprecationMessage": "",
|
|
26747
26847
|
"jsdoctags": [
|
|
@@ -26769,7 +26869,7 @@
|
|
|
26769
26869
|
"optional": false,
|
|
26770
26870
|
"returnType": "void",
|
|
26771
26871
|
"typeParameters": [],
|
|
26772
|
-
"line":
|
|
26872
|
+
"line": 610,
|
|
26773
26873
|
"deprecated": false,
|
|
26774
26874
|
"deprecationMessage": "",
|
|
26775
26875
|
"rawdescription": "\n\nHandles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n",
|
|
@@ -26808,7 +26908,7 @@
|
|
|
26808
26908
|
"optional": false,
|
|
26809
26909
|
"returnType": "boolean",
|
|
26810
26910
|
"typeParameters": [],
|
|
26811
|
-
"line":
|
|
26911
|
+
"line": 856,
|
|
26812
26912
|
"deprecated": false,
|
|
26813
26913
|
"deprecationMessage": "",
|
|
26814
26914
|
"modifierKind": [
|
|
@@ -26832,7 +26932,7 @@
|
|
|
26832
26932
|
"optional": false,
|
|
26833
26933
|
"returnType": "void",
|
|
26834
26934
|
"typeParameters": [],
|
|
26835
|
-
"line":
|
|
26935
|
+
"line": 679,
|
|
26836
26936
|
"deprecated": false,
|
|
26837
26937
|
"deprecationMessage": ""
|
|
26838
26938
|
},
|
|
@@ -26856,7 +26956,7 @@
|
|
|
26856
26956
|
"optional": false,
|
|
26857
26957
|
"returnType": "void",
|
|
26858
26958
|
"typeParameters": [],
|
|
26859
|
-
"line":
|
|
26959
|
+
"line": 791,
|
|
26860
26960
|
"deprecated": false,
|
|
26861
26961
|
"deprecationMessage": "",
|
|
26862
26962
|
"rawdescription": "\n\nSets the list group filter, and manages single select item selection.\n",
|
|
@@ -26899,7 +26999,7 @@
|
|
|
26899
26999
|
"optional": false,
|
|
26900
27000
|
"returnType": "void",
|
|
26901
27001
|
"typeParameters": [],
|
|
26902
|
-
"line":
|
|
27002
|
+
"line": 824,
|
|
26903
27003
|
"deprecated": false,
|
|
26904
27004
|
"deprecationMessage": "",
|
|
26905
27005
|
"rawdescription": "\n\nIntended to be used to add items to the list.\n",
|
|
@@ -26925,7 +27025,7 @@
|
|
|
26925
27025
|
"optional": false,
|
|
26926
27026
|
"returnType": "void",
|
|
26927
27027
|
"typeParameters": [],
|
|
26928
|
-
"line":
|
|
27028
|
+
"line": 757,
|
|
26929
27029
|
"deprecated": false,
|
|
26930
27030
|
"deprecationMessage": "",
|
|
26931
27031
|
"rawdescription": "\n\nOpens the dropdown.\n",
|
|
@@ -26947,7 +27047,7 @@
|
|
|
26947
27047
|
"optional": false,
|
|
26948
27048
|
"returnType": "void",
|
|
26949
27049
|
"typeParameters": [],
|
|
26950
|
-
"line":
|
|
27050
|
+
"line": 683,
|
|
26951
27051
|
"deprecated": false,
|
|
26952
27052
|
"deprecationMessage": "",
|
|
26953
27053
|
"jsdoctags": [
|
|
@@ -26975,7 +27075,7 @@
|
|
|
26975
27075
|
"optional": false,
|
|
26976
27076
|
"returnType": "void",
|
|
26977
27077
|
"typeParameters": [],
|
|
26978
|
-
"line":
|
|
27078
|
+
"line": 688,
|
|
26979
27079
|
"deprecated": false,
|
|
26980
27080
|
"deprecationMessage": "",
|
|
26981
27081
|
"jsdoctags": [
|
|
@@ -27003,7 +27103,7 @@
|
|
|
27003
27103
|
"optional": false,
|
|
27004
27104
|
"returnType": "void",
|
|
27005
27105
|
"typeParameters": [],
|
|
27006
|
-
"line":
|
|
27106
|
+
"line": 697,
|
|
27007
27107
|
"deprecated": false,
|
|
27008
27108
|
"deprecationMessage": "",
|
|
27009
27109
|
"rawdescription": "\n\n`ControlValueAccessor` method to programmatically disable the combobox.\n\nex: `this.formGroup.get(\"myCoolCombobox\").disable();`\n",
|
|
@@ -27026,7 +27126,7 @@
|
|
|
27026
27126
|
"optional": false,
|
|
27027
27127
|
"returnType": "void",
|
|
27028
27128
|
"typeParameters": [],
|
|
27029
|
-
"line":
|
|
27129
|
+
"line": 780,
|
|
27030
27130
|
"deprecated": false,
|
|
27031
27131
|
"deprecationMessage": "",
|
|
27032
27132
|
"rawdescription": "\n\nToggles the dropdown.\n",
|
|
@@ -27041,7 +27141,7 @@
|
|
|
27041
27141
|
"optional": false,
|
|
27042
27142
|
"returnType": "void",
|
|
27043
27143
|
"typeParameters": [],
|
|
27044
|
-
"line":
|
|
27144
|
+
"line": 704,
|
|
27045
27145
|
"deprecated": false,
|
|
27046
27146
|
"deprecationMessage": "",
|
|
27047
27147
|
"rawdescription": "\n\nCalled by `n-pill-input` when the selected pills have changed.\n",
|
|
@@ -27063,7 +27163,7 @@
|
|
|
27063
27163
|
"optional": false,
|
|
27064
27164
|
"returnType": "void",
|
|
27065
27165
|
"typeParameters": [],
|
|
27066
|
-
"line":
|
|
27166
|
+
"line": 640,
|
|
27067
27167
|
"deprecated": false,
|
|
27068
27168
|
"deprecationMessage": "",
|
|
27069
27169
|
"jsdoctags": [
|
|
@@ -27110,7 +27210,7 @@
|
|
|
27110
27210
|
"deprecationMessage": "",
|
|
27111
27211
|
"rawdescription": "\n\nHandles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n",
|
|
27112
27212
|
"description": "<p>Handles <code>Escape/Tab</code> key closing the dropdown, and arrow up/down focus to/from the dropdown list.</p>\n",
|
|
27113
|
-
"line":
|
|
27213
|
+
"line": 610
|
|
27114
27214
|
}
|
|
27115
27215
|
],
|
|
27116
27216
|
"standalone": false,
|
|
@@ -27118,7 +27218,7 @@
|
|
|
27118
27218
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { ComboBoxModule } from 'carbon-components-angular';</code></pre></div><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 "pills" of selected items.</p>\n<p><a href=\"../../?path=/story/components-combobox--basic\">See demo</a></p>\n",
|
|
27119
27219
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { ComboBoxModule } from 'carbon-components-angular';\n```\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",
|
|
27120
27220
|
"type": "component",
|
|
27121
|
-
"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 * Get started with importing the module:\n *\n * ```typescript\n * import { ComboBoxModule } from 'carbon-components-angular';\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\n\t\t\tclass=\"cds--list-box__wrapper\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--list-box__wrapper--fluid': fluid,\n\t\t\t\t'cds--list-box__wrapper--fluid--invalid': fluid && invalid,\n\t\t\t\t'cds--list-box__wrapper--fluid--focus': fluid && _isFocused,\n\t\t\t\t'cds--list-box__wrapper--decorator': !!decorator\n\t\t\t}\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\t[id]=\"labelId\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t}\">\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--readonly': readonly,\n\t\t\t\t\t'cds--combo-box--warning cds--list-box--warning': warn,\n\t\t\t\t\t'cds--list-box--invalid': invalid\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 || readonly}\">\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 || readonly\"\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[readOnly]=\"readonly\"\n\t\t\t\t\t\t(input)=\"onSearch($event.target.value)\"\n\t\t\t\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t\t\t\t(blur)=\"fluid ? handleFocus($event) : 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]=\"labelId\"\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=\"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<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\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<hr *ngIf=\"fluid\" class=\"cds--list-box__divider\" />\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn && !fluid\"\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=\"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 = `combobox-${ComboBox.comboBoxCount++}`;\n\t@Input() labelId = `combobox-label-${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 * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: 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 * Set to `true` for readonly state.\n\t */\n\t@Input() readonly = false;\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@Input() fluid = 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\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\tprotected _isFocused = false;\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\tthis.selected.emit(event);\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\tthis.selected.emit(event.item);\n\t\t\t\t\t\tthis.closeDropdown();\n\t\t\t\t\t}\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.preventDefault();\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/**\n\t\t * @todo - In next major version update to the following:\n\t\t * const selected = this.type === \"multi\" ? this.view.getSelected() : undefined;\n\t\t *\n\t\t * Previously it returned an empty array even for type === 'single'\n\t\t * Also resolve #ref-1245723\n\t\t */\n\t\t// On type=multi we just emit getSelected() (just in case there's any disabled but selected items)\n\t\tconst selected = this.view.getSelected();\n\n\t\t// in case there are disabled items they should be mapped according to itemValueKey\n\t\tif (this.itemValueKey && selected) {\n\t\t\tconst values = selected.map((item) => item[this.itemValueKey]);\n\t\t\tthis.propagateChangeCallback(values);\n\t\t} else {\n\t\t\tthis.propagateChangeCallback(selected);\n\t\t}\n\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 || this.readonly) { 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.disabled || this.readonly) {\n\t\t\treturn;\n\t\t}\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\thandleFocus(event: FocusEvent) {\n\t\tthis._isFocused = event.type === \"focus\";\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",
|
|
27221
|
+
"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 * Get started with importing the module:\n *\n * ```typescript\n * import { ComboBoxModule } from 'carbon-components-angular';\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\n\t\t\tclass=\"cds--list-box__wrapper\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--list-box__wrapper--fluid': fluid,\n\t\t\t\t'cds--list-box__wrapper--fluid--invalid': fluid && invalid,\n\t\t\t\t'cds--list-box__wrapper--fluid--focus': fluid && _isFocused,\n\t\t\t\t'cds--list-box__wrapper--decorator': !!decorator\n\t\t\t}\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\t[id]=\"labelId\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t}\">\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--readonly': readonly,\n\t\t\t\t\t'cds--combo-box--warning cds--list-box--warning': warn,\n\t\t\t\t\t'cds--list-box--invalid': invalid\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 || readonly}\">\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 || readonly\"\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[readOnly]=\"readonly\"\n\t\t\t\t\t\t(input)=\"onSearch($event.target.value)\"\n\t\t\t\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t\t\t\t(blur)=\"fluid ? handleFocus($event) : 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]=\"labelId\"\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=\"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<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\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<hr *ngIf=\"fluid\" class=\"cds--list-box__divider\" />\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn && !fluid\"\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=\"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 = `combobox-${ComboBox.comboBoxCount++}`;\n\t@Input() labelId = `combobox-label-${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 * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: 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 * Set to `true` for readonly state.\n\t */\n\t@Input() readonly = false;\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@Input() fluid = 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\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\tprotected _isFocused = false;\n\n\tprivate _writtenValue: any;\n\tprivate _isUsingNgControl = false;\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._propagateChange(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._propagateChange(this.view.getSelected());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.selected.emit(event);\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._propagateChange(event.item[this.itemValueKey]);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._propagateChange(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._propagateChange(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\tthis.selected.emit(event.item);\n\t\t\t\t\t\tthis.closeDropdown();\n\t\t\t\t\t} else if (this._isUsingNgControl) {\n\t\t\t\t\t\tthis.writeValue(this._writtenValue);\n\t\t\t\t\t}\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.preventDefault();\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\tthis._writtenValue = value;\n\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\tprivate _propagateChange(value: any) {\n\t\tthis._writtenValue = value;\n\t\tthis.propagateChangeCallback(value);\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis._isUsingNgControl = true;\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.propagateSelected([]);\n\t\tthis.updatePills();\n\t\t/**\n\t\t * @todo - In next major version update to the following:\n\t\t * const selected = this.type === \"multi\" ? this.view.getSelected() : undefined;\n\t\t *\n\t\t * Previously it returned an empty array even for type === 'single'\n\t\t * Also resolve #ref-1245723\n\t\t */\n\t\t// On type=multi we just emit getSelected() (just in case there's any disabled but selected items)\n\t\tconst selected = this.view.getSelected();\n\n\t\t// in case there are disabled items they should be mapped according to itemValueKey\n\t\tif (this.itemValueKey && selected) {\n\t\t\tconst values = selected.map((item) => item[this.itemValueKey]);\n\t\t\tthis._propagateChange(values);\n\t\t} else {\n\t\t\tthis._propagateChange(selected);\n\t\t}\n\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 || this.readonly) { 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.disabled || this.readonly) {\n\t\t\treturn;\n\t\t}\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\thandleFocus(event: FocusEvent) {\n\t\tthis._isFocused = event.type === \"focus\";\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",
|
|
27122
27222
|
"assetsDirs": [],
|
|
27123
27223
|
"styleUrlsData": "",
|
|
27124
27224
|
"stylesData": "",
|
|
@@ -27147,7 +27247,7 @@
|
|
|
27147
27247
|
"deprecationMessage": ""
|
|
27148
27248
|
}
|
|
27149
27249
|
],
|
|
27150
|
-
"line":
|
|
27250
|
+
"line": 485,
|
|
27151
27251
|
"rawdescription": "\n\nCreates an instance of ComboBox.\n",
|
|
27152
27252
|
"jsdoctags": [
|
|
27153
27253
|
{
|
|
@@ -32155,7 +32255,7 @@
|
|
|
32155
32255
|
},
|
|
32156
32256
|
{
|
|
32157
32257
|
"name": "Dropdown",
|
|
32158
|
-
"id": "component-Dropdown-
|
|
32258
|
+
"id": "component-Dropdown-8323b47b0d5e3f1be053855e9caaf816eeb43797684a23deb2f798678d396b662a0ce7965b19db845d26a22d4b0904c52285556976ef4890d549b5a9d34d4119",
|
|
32159
32259
|
"file": "src/dropdown/dropdown.component.ts",
|
|
32160
32260
|
"encapsulation": [],
|
|
32161
32261
|
"entryComponents": [],
|
|
@@ -32174,6 +32274,17 @@
|
|
|
32174
32274
|
"viewProviders": [],
|
|
32175
32275
|
"hostDirectives": [],
|
|
32176
32276
|
"inputsClass": [
|
|
32277
|
+
{
|
|
32278
|
+
"name": "allowNullValues",
|
|
32279
|
+
"defaultValue": "false",
|
|
32280
|
+
"deprecated": false,
|
|
32281
|
+
"deprecationMessage": "",
|
|
32282
|
+
"rawdescription": "\n\nSet to `true` to allow null values in the dropdown ListItems.\n",
|
|
32283
|
+
"description": "<p>Set to <code>true</code> to allow null values in the dropdown ListItems.</p>\n",
|
|
32284
|
+
"line": 331,
|
|
32285
|
+
"type": "boolean",
|
|
32286
|
+
"decorators": []
|
|
32287
|
+
},
|
|
32177
32288
|
{
|
|
32178
32289
|
"name": "appendInline",
|
|
32179
32290
|
"defaultValue": "null",
|
|
@@ -32181,7 +32292,7 @@
|
|
|
32181
32292
|
"deprecationMessage": "",
|
|
32182
32293
|
"rawdescription": "\n\nset to `true` to place the dropdown view inline with the component\n",
|
|
32183
32294
|
"description": "<p>set to <code>true</code> to place the dropdown view inline with the component</p>\n",
|
|
32184
|
-
"line":
|
|
32295
|
+
"line": 297,
|
|
32185
32296
|
"type": "boolean",
|
|
32186
32297
|
"decorators": []
|
|
32187
32298
|
},
|
|
@@ -32192,7 +32303,7 @@
|
|
|
32192
32303
|
"deprecationMessage": "",
|
|
32193
32304
|
"rawdescription": "\n\nSets the optional clear button tooltip text.\n",
|
|
32194
32305
|
"description": "<p>Sets the optional clear button tooltip text.</p>\n",
|
|
32195
|
-
"line":
|
|
32306
|
+
"line": 243,
|
|
32196
32307
|
"type": "string",
|
|
32197
32308
|
"decorators": []
|
|
32198
32309
|
},
|
|
@@ -32202,7 +32313,7 @@
|
|
|
32202
32313
|
"deprecationMessage": "",
|
|
32203
32314
|
"rawdescription": "\n\n**Experimental**: Optional decorator (e.g. AI label).\n",
|
|
32204
32315
|
"description": "<p><strong>Experimental</strong>: Optional decorator (e.g. AI label).</p>\n",
|
|
32205
|
-
"line":
|
|
32316
|
+
"line": 231,
|
|
32206
32317
|
"type": "TemplateRef<any>",
|
|
32207
32318
|
"decorators": []
|
|
32208
32319
|
},
|
|
@@ -32213,7 +32324,7 @@
|
|
|
32213
32324
|
"deprecationMessage": "",
|
|
32214
32325
|
"rawdescription": "\n\nSet to `true` for a dropdown without arrow key activation.\n",
|
|
32215
32326
|
"description": "<p>Set to <code>true</code> for a dropdown without arrow key activation.</p>\n",
|
|
32216
|
-
"line":
|
|
32327
|
+
"line": 277,
|
|
32217
32328
|
"type": "boolean",
|
|
32218
32329
|
"decorators": []
|
|
32219
32330
|
},
|
|
@@ -32224,7 +32335,7 @@
|
|
|
32224
32335
|
"deprecationMessage": "",
|
|
32225
32336
|
"rawdescription": "\n\nSet to `true` to disable the dropdown.\n",
|
|
32226
32337
|
"description": "<p>Set to <code>true</code> to disable the dropdown.</p>\n",
|
|
32227
|
-
"line":
|
|
32338
|
+
"line": 261,
|
|
32228
32339
|
"type": "boolean",
|
|
32229
32340
|
"decorators": []
|
|
32230
32341
|
},
|
|
@@ -32235,7 +32346,7 @@
|
|
|
32235
32346
|
"deprecationMessage": "",
|
|
32236
32347
|
"rawdescription": "\n\nThe selected value from the `Dropdown`. Can be a string or template.\n",
|
|
32237
32348
|
"description": "<p>The selected value from the <code>Dropdown</code>. Can be a string or template.</p>\n",
|
|
32238
|
-
"line":
|
|
32349
|
+
"line": 239,
|
|
32239
32350
|
"type": "string | TemplateRef<any>",
|
|
32240
32351
|
"decorators": []
|
|
32241
32352
|
},
|
|
@@ -32245,7 +32356,7 @@
|
|
|
32245
32356
|
"deprecationMessage": "",
|
|
32246
32357
|
"rawdescription": "\n\nOverrides the automatic dropUp.\n",
|
|
32247
32358
|
"description": "<p>Overrides the automatic dropUp.</p>\n",
|
|
32248
|
-
"line":
|
|
32359
|
+
"line": 327,
|
|
32249
32360
|
"type": "boolean",
|
|
32250
32361
|
"decorators": []
|
|
32251
32362
|
},
|
|
@@ -32256,7 +32367,7 @@
|
|
|
32256
32367
|
"deprecationMessage": "",
|
|
32257
32368
|
"rawdescription": "\n\nExperimental: enable fluid state\n",
|
|
32258
32369
|
"description": "<p>Experimental: enable fluid state</p>\n",
|
|
32259
|
-
"line":
|
|
32370
|
+
"line": 369,
|
|
32260
32371
|
"type": "boolean",
|
|
32261
32372
|
"decorators": []
|
|
32262
32373
|
},
|
|
@@ -32266,7 +32377,7 @@
|
|
|
32266
32377
|
"deprecationMessage": "",
|
|
32267
32378
|
"rawdescription": "\n\nSets the optional helper text.\n",
|
|
32268
32379
|
"description": "<p>Sets the optional helper text.</p>\n",
|
|
32269
|
-
"line":
|
|
32380
|
+
"line": 227,
|
|
32270
32381
|
"type": "string | TemplateRef<any>",
|
|
32271
32382
|
"decorators": []
|
|
32272
32383
|
},
|
|
@@ -32277,7 +32388,7 @@
|
|
|
32277
32388
|
"deprecationMessage": "",
|
|
32278
32389
|
"rawdescription": "\n\nHide label while keeping it accessible for screen readers\n",
|
|
32279
32390
|
"description": "<p>Hide label while keeping it accessible for screen readers</p>\n",
|
|
32280
|
-
"line":
|
|
32391
|
+
"line": 223,
|
|
32281
32392
|
"type": "boolean",
|
|
32282
32393
|
"decorators": []
|
|
32283
32394
|
},
|
|
@@ -32286,7 +32397,7 @@
|
|
|
32286
32397
|
"defaultValue": "`dropdown-${Dropdown.dropdownCount++}`",
|
|
32287
32398
|
"deprecated": false,
|
|
32288
32399
|
"deprecationMessage": "",
|
|
32289
|
-
"line":
|
|
32400
|
+
"line": 215,
|
|
32290
32401
|
"type": "string",
|
|
32291
32402
|
"decorators": []
|
|
32292
32403
|
},
|
|
@@ -32297,7 +32408,7 @@
|
|
|
32297
32408
|
"deprecationMessage": "",
|
|
32298
32409
|
"rawdescription": "\n\nSet to `true` for an inline dropdown.\n",
|
|
32299
32410
|
"description": "<p>Set to <code>true</code> for an inline dropdown.</p>\n",
|
|
32300
|
-
"line":
|
|
32411
|
+
"line": 273,
|
|
32301
32412
|
"type": "boolean",
|
|
32302
32413
|
"decorators": []
|
|
32303
32414
|
},
|
|
@@ -32308,7 +32419,7 @@
|
|
|
32308
32419
|
"deprecationMessage": "",
|
|
32309
32420
|
"rawdescription": "\n\nSet to `true` for invalid state.\n",
|
|
32310
32421
|
"description": "<p>Set to <code>true</code> for invalid state.</p>\n",
|
|
32311
|
-
"line":
|
|
32422
|
+
"line": 281,
|
|
32312
32423
|
"type": "boolean",
|
|
32313
32424
|
"decorators": []
|
|
32314
32425
|
},
|
|
@@ -32318,7 +32429,7 @@
|
|
|
32318
32429
|
"deprecationMessage": "",
|
|
32319
32430
|
"rawdescription": "\n\nValue displayed if dropdown is in invalid state.\n",
|
|
32320
32431
|
"description": "<p>Value displayed if dropdown is in invalid state.</p>\n",
|
|
32321
|
-
"line":
|
|
32432
|
+
"line": 285,
|
|
32322
32433
|
"type": "string | TemplateRef<any>",
|
|
32323
32434
|
"decorators": []
|
|
32324
32435
|
},
|
|
@@ -32328,7 +32439,7 @@
|
|
|
32328
32439
|
"deprecationMessage": "",
|
|
32329
32440
|
"rawdescription": "\n\nSpecifies the property to be used as the return value to `ngModel`\n",
|
|
32330
32441
|
"description": "<p>Specifies the property to be used as the return value to <code>ngModel</code></p>\n",
|
|
32331
|
-
"line":
|
|
32442
|
+
"line": 306,
|
|
32332
32443
|
"type": "string",
|
|
32333
32444
|
"decorators": []
|
|
32334
32445
|
},
|
|
@@ -32338,7 +32449,7 @@
|
|
|
32338
32449
|
"deprecationMessage": "",
|
|
32339
32450
|
"rawdescription": "\n\nLabel for the dropdown.\n",
|
|
32340
32451
|
"description": "<p>Label for the dropdown.</p>\n",
|
|
32341
|
-
"line":
|
|
32452
|
+
"line": 219,
|
|
32342
32453
|
"type": "string | TemplateRef<any>",
|
|
32343
32454
|
"decorators": []
|
|
32344
32455
|
},
|
|
@@ -32349,7 +32460,7 @@
|
|
|
32349
32460
|
"deprecationMessage": "",
|
|
32350
32461
|
"rawdescription": "\n\nAccessible label for the button that opens the dropdown list.\nDefaults to the `DROPDOWN.OPEN` value from the i18n service.\n",
|
|
32351
32462
|
"description": "<p>Accessible label for the button that opens the dropdown list.\nDefaults to the <code>DROPDOWN.OPEN</code> value from the i18n service.</p>\n",
|
|
32352
|
-
"line":
|
|
32463
|
+
"line": 318,
|
|
32353
32464
|
"type": "any",
|
|
32354
32465
|
"decorators": []
|
|
32355
32466
|
},
|
|
@@ -32360,7 +32471,7 @@
|
|
|
32360
32471
|
"deprecationMessage": "",
|
|
32361
32472
|
"rawdescription": "\n\nValue displayed if no item is selected.\n",
|
|
32362
32473
|
"description": "<p>Value displayed if no item is selected.</p>\n",
|
|
32363
|
-
"line":
|
|
32474
|
+
"line": 235,
|
|
32364
32475
|
"type": "string",
|
|
32365
32476
|
"decorators": []
|
|
32366
32477
|
},
|
|
@@ -32371,7 +32482,7 @@
|
|
|
32371
32482
|
"deprecationMessage": "",
|
|
32372
32483
|
"rawdescription": "\n\nSet to `true` for a readonly state.\n",
|
|
32373
32484
|
"description": "<p>Set to <code>true</code> for a readonly state.</p>\n",
|
|
32374
|
-
"line":
|
|
32485
|
+
"line": 265,
|
|
32375
32486
|
"type": "boolean",
|
|
32376
32487
|
"decorators": []
|
|
32377
32488
|
},
|
|
@@ -32381,7 +32492,7 @@
|
|
|
32381
32492
|
"deprecationMessage": "",
|
|
32382
32493
|
"rawdescription": "\n\nQuery string for the element that contains the `Dropdown`.\nUsed to trigger closing the dropdown if it scrolls outside of the viewport of the `scrollableContainer`.\n",
|
|
32383
32494
|
"description": "<p>Query string for the element that contains the <code>Dropdown</code>.\nUsed to trigger closing the dropdown if it scrolls outside of the viewport of the <code>scrollableContainer</code>.</p>\n",
|
|
32384
|
-
"line":
|
|
32495
|
+
"line": 302,
|
|
32385
32496
|
"type": "string",
|
|
32386
32497
|
"decorators": []
|
|
32387
32498
|
},
|
|
@@ -32392,7 +32503,7 @@
|
|
|
32392
32503
|
"deprecationMessage": "",
|
|
32393
32504
|
"rawdescription": "\n\nProvides the label for the \"# selected\" text.\nDefaults to the `DROPDOWN.SELECTED` value from the i18n service.\n",
|
|
32394
32505
|
"description": "<p>Provides the label for the "# selected" text.\nDefaults to the <code>DROPDOWN.SELECTED</code> value from the i18n service.</p>\n",
|
|
32395
|
-
"line":
|
|
32506
|
+
"line": 323,
|
|
32396
32507
|
"type": "any",
|
|
32397
32508
|
"decorators": []
|
|
32398
32509
|
},
|
|
@@ -32403,7 +32514,7 @@
|
|
|
32403
32514
|
"deprecationMessage": "",
|
|
32404
32515
|
"rawdescription": "\n\nSpecify feedback (mode) of the selection.\n`top`: selected item jumps to top\n`fixed`: selected item stays at it's position\n`top-after-reopen`: selected item jump to top after reopen dropdown\n",
|
|
32405
32516
|
"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 it's position\n<code>top-after-reopen</code>: selected item jump to top after reopen dropdown</p>\n",
|
|
32406
|
-
"line":
|
|
32517
|
+
"line": 313,
|
|
32407
32518
|
"type": "\"top\" | \"fixed\" | \"top-after-reopen\"",
|
|
32408
32519
|
"decorators": []
|
|
32409
32520
|
},
|
|
@@ -32414,7 +32525,7 @@
|
|
|
32414
32525
|
"deprecationMessage": "",
|
|
32415
32526
|
"rawdescription": "\n\nSize to render the dropdown field.\n",
|
|
32416
32527
|
"description": "<p>Size to render the dropdown field.</p>\n",
|
|
32417
|
-
"line":
|
|
32528
|
+
"line": 247,
|
|
32418
32529
|
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
32419
32530
|
"decorators": []
|
|
32420
32531
|
},
|
|
@@ -32425,7 +32536,7 @@
|
|
|
32425
32536
|
"deprecationMessage": "",
|
|
32426
32537
|
"rawdescription": "\n\nSet to `true` for a loading dropdown.\n",
|
|
32427
32538
|
"description": "<p>Set to <code>true</code> for a loading dropdown.</p>\n",
|
|
32428
|
-
"line":
|
|
32539
|
+
"line": 269,
|
|
32429
32540
|
"type": "boolean",
|
|
32430
32541
|
"decorators": []
|
|
32431
32542
|
},
|
|
@@ -32436,15 +32547,15 @@
|
|
|
32436
32547
|
"deprecationMessage": "since v5 - Use `cdsLayer` directive instead\n`light` or `dark` dropdown theme",
|
|
32437
32548
|
"jsdoctags": [
|
|
32438
32549
|
{
|
|
32439
|
-
"pos":
|
|
32440
|
-
"end":
|
|
32550
|
+
"pos": 8080,
|
|
32551
|
+
"end": 8175,
|
|
32441
32552
|
"flags": 16842752,
|
|
32442
32553
|
"modifierFlagsCache": 0,
|
|
32443
32554
|
"transformFlags": 0,
|
|
32444
32555
|
"kind": 338,
|
|
32445
32556
|
"tagName": {
|
|
32446
|
-
"pos":
|
|
32447
|
-
"end":
|
|
32557
|
+
"pos": 8081,
|
|
32558
|
+
"end": 8091,
|
|
32448
32559
|
"flags": 16842752,
|
|
32449
32560
|
"modifierFlagsCache": 0,
|
|
32450
32561
|
"transformFlags": 0,
|
|
@@ -32454,7 +32565,7 @@
|
|
|
32454
32565
|
"comment": "<p>since v5 - Use <code>cdsLayer</code> directive instead\n<code>light</code> or <code>dark</code> dropdown theme</p>\n"
|
|
32455
32566
|
}
|
|
32456
32567
|
],
|
|
32457
|
-
"line":
|
|
32568
|
+
"line": 257,
|
|
32458
32569
|
"type": "\"light\" | \"dark\"",
|
|
32459
32570
|
"decorators": []
|
|
32460
32571
|
},
|
|
@@ -32465,7 +32576,7 @@
|
|
|
32465
32576
|
"deprecationMessage": "",
|
|
32466
32577
|
"rawdescription": "\n\nDefines whether or not the `Dropdown` supports selecting multiple items as opposed to single\nitem selection.\n",
|
|
32467
32578
|
"description": "<p>Defines whether or not the <code>Dropdown</code> supports selecting multiple items as opposed to single\nitem selection.</p>\n",
|
|
32468
|
-
"line":
|
|
32579
|
+
"line": 252,
|
|
32469
32580
|
"type": "\"single\" | \"multi\"",
|
|
32470
32581
|
"decorators": []
|
|
32471
32582
|
},
|
|
@@ -32476,7 +32587,7 @@
|
|
|
32476
32587
|
"deprecationMessage": "",
|
|
32477
32588
|
"rawdescription": "\n\nSet to `true` to show a warning (contents set by warningText)\n",
|
|
32478
32589
|
"description": "<p>Set to <code>true</code> to show a warning (contents set by warningText)</p>\n",
|
|
32479
|
-
"line":
|
|
32590
|
+
"line": 289,
|
|
32480
32591
|
"type": "boolean",
|
|
32481
32592
|
"decorators": []
|
|
32482
32593
|
},
|
|
@@ -32486,7 +32597,7 @@
|
|
|
32486
32597
|
"deprecationMessage": "",
|
|
32487
32598
|
"rawdescription": "\n\nSets the warning text\n",
|
|
32488
32599
|
"description": "<p>Sets the warning text</p>\n",
|
|
32489
|
-
"line":
|
|
32600
|
+
"line": 293,
|
|
32490
32601
|
"type": "string | TemplateRef<any>",
|
|
32491
32602
|
"decorators": []
|
|
32492
32603
|
}
|
|
@@ -32499,7 +32610,7 @@
|
|
|
32499
32610
|
"deprecationMessage": "",
|
|
32500
32611
|
"rawdescription": "\n\nEmits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n",
|
|
32501
32612
|
"description": "<p>Emits event notifying to other classes that the <code>Dropdown</code> has been closed (collapsed).</p>\n",
|
|
32502
|
-
"line":
|
|
32613
|
+
"line": 343,
|
|
32503
32614
|
"type": "EventEmitter<any>"
|
|
32504
32615
|
},
|
|
32505
32616
|
{
|
|
@@ -32509,7 +32620,7 @@
|
|
|
32509
32620
|
"deprecationMessage": "",
|
|
32510
32621
|
"rawdescription": "\n\nEmits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n",
|
|
32511
32622
|
"description": "<p>Emits event notifying to other classes that the <code>Dropdown</code> has been closed (collapsed).</p>\n",
|
|
32512
|
-
"line":
|
|
32623
|
+
"line": 339,
|
|
32513
32624
|
"type": "EventEmitter<any>"
|
|
32514
32625
|
},
|
|
32515
32626
|
{
|
|
@@ -32519,7 +32630,7 @@
|
|
|
32519
32630
|
"deprecationMessage": "",
|
|
32520
32631
|
"rawdescription": "\n\nEmits selection events.\n",
|
|
32521
32632
|
"description": "<p>Emits selection events.</p>\n",
|
|
32522
|
-
"line":
|
|
32633
|
+
"line": 335,
|
|
32523
32634
|
"type": "EventEmitter<Object>"
|
|
32524
32635
|
}
|
|
32525
32636
|
],
|
|
@@ -32532,7 +32643,7 @@
|
|
|
32532
32643
|
"type": "",
|
|
32533
32644
|
"optional": false,
|
|
32534
32645
|
"description": "<p>controls whether the <code>drop-up</code> class is applied</p>\n",
|
|
32535
|
-
"line":
|
|
32646
|
+
"line": 379,
|
|
32536
32647
|
"rawdescription": "\n\ncontrols whether the `drop-up` class is applied\n"
|
|
32537
32648
|
},
|
|
32538
32649
|
{
|
|
@@ -32542,7 +32653,7 @@
|
|
|
32542
32653
|
"type": "",
|
|
32543
32654
|
"optional": false,
|
|
32544
32655
|
"description": "<p>Maintains a reference to the view DOM element of the <code>Dropdown</code> button.</p>\n",
|
|
32545
|
-
"line":
|
|
32656
|
+
"line": 352,
|
|
32546
32657
|
"rawdescription": "\n\nMaintains a reference to the view DOM element of the `Dropdown` button.\n",
|
|
32547
32658
|
"decorators": [
|
|
32548
32659
|
{
|
|
@@ -32562,7 +32673,7 @@
|
|
|
32562
32673
|
"type": "number",
|
|
32563
32674
|
"optional": false,
|
|
32564
32675
|
"description": "",
|
|
32565
|
-
"line":
|
|
32676
|
+
"line": 195,
|
|
32566
32677
|
"modifierKind": [
|
|
32567
32678
|
126
|
|
32568
32679
|
]
|
|
@@ -32574,7 +32685,7 @@
|
|
|
32574
32685
|
"type": "",
|
|
32575
32686
|
"optional": false,
|
|
32576
32687
|
"description": "<p>ViewChid of the dropdown view.</p>\n",
|
|
32577
|
-
"line":
|
|
32688
|
+
"line": 356,
|
|
32578
32689
|
"rawdescription": "\n\nViewChid of the dropdown view.\n",
|
|
32579
32690
|
"decorators": [
|
|
32580
32691
|
{
|
|
@@ -32594,7 +32705,7 @@
|
|
|
32594
32705
|
"type": "",
|
|
32595
32706
|
"optional": false,
|
|
32596
32707
|
"description": "",
|
|
32597
|
-
"line":
|
|
32708
|
+
"line": 358,
|
|
32598
32709
|
"decorators": [
|
|
32599
32710
|
{
|
|
32600
32711
|
"name": "HostBinding",
|
|
@@ -32613,7 +32724,7 @@
|
|
|
32613
32724
|
"type": "",
|
|
32614
32725
|
"optional": false,
|
|
32615
32726
|
"description": "",
|
|
32616
|
-
"line":
|
|
32727
|
+
"line": 360,
|
|
32617
32728
|
"decorators": [
|
|
32618
32729
|
{
|
|
32619
32730
|
"name": "HostBinding",
|
|
@@ -32632,7 +32743,7 @@
|
|
|
32632
32743
|
"type": "",
|
|
32633
32744
|
"optional": false,
|
|
32634
32745
|
"description": "",
|
|
32635
|
-
"line":
|
|
32746
|
+
"line": 386
|
|
32636
32747
|
},
|
|
32637
32748
|
{
|
|
32638
32749
|
"name": "menuIsClosed",
|
|
@@ -32642,7 +32753,7 @@
|
|
|
32642
32753
|
"type": "",
|
|
32643
32754
|
"optional": false,
|
|
32644
32755
|
"description": "<p>Set to <code>true</code> if the dropdown is closed (not expanded).</p>\n",
|
|
32645
|
-
"line":
|
|
32756
|
+
"line": 374,
|
|
32646
32757
|
"rawdescription": "\n\nSet to `true` if the dropdown is closed (not expanded).\n"
|
|
32647
32758
|
},
|
|
32648
32759
|
{
|
|
@@ -32653,7 +32764,7 @@
|
|
|
32653
32764
|
"type": "",
|
|
32654
32765
|
"optional": false,
|
|
32655
32766
|
"description": "",
|
|
32656
|
-
"line":
|
|
32767
|
+
"line": 383
|
|
32657
32768
|
},
|
|
32658
32769
|
{
|
|
32659
32770
|
"name": "outsideClick",
|
|
@@ -32663,7 +32774,7 @@
|
|
|
32663
32774
|
"type": "",
|
|
32664
32775
|
"optional": false,
|
|
32665
32776
|
"description": "",
|
|
32666
|
-
"line":
|
|
32777
|
+
"line": 384
|
|
32667
32778
|
},
|
|
32668
32779
|
{
|
|
32669
32780
|
"name": "outsideKey",
|
|
@@ -32673,7 +32784,7 @@
|
|
|
32673
32784
|
"type": "",
|
|
32674
32785
|
"optional": false,
|
|
32675
32786
|
"description": "",
|
|
32676
|
-
"line":
|
|
32787
|
+
"line": 385
|
|
32677
32788
|
},
|
|
32678
32789
|
{
|
|
32679
32790
|
"name": "propagateChange",
|
|
@@ -32683,7 +32794,7 @@
|
|
|
32683
32794
|
"type": "",
|
|
32684
32795
|
"optional": false,
|
|
32685
32796
|
"description": "<p>function passed in by <code>registerOnChange</code></p>\n",
|
|
32686
|
-
"line":
|
|
32797
|
+
"line": 555,
|
|
32687
32798
|
"rawdescription": "\n\nfunction passed in by `registerOnChange`\n"
|
|
32688
32799
|
},
|
|
32689
32800
|
{
|
|
@@ -32693,7 +32804,7 @@
|
|
|
32693
32804
|
"type": "AbstractDropdownView",
|
|
32694
32805
|
"optional": false,
|
|
32695
32806
|
"description": "<p>Maintains a reference to the <code>AbstractDropdownView</code> object within the content DOM.</p>\n",
|
|
32696
|
-
"line":
|
|
32807
|
+
"line": 348,
|
|
32697
32808
|
"rawdescription": "\n\nMaintains a reference to the `AbstractDropdownView` object within the content DOM.\n",
|
|
32698
32809
|
"decorators": [
|
|
32699
32810
|
{
|
|
@@ -32713,7 +32824,7 @@
|
|
|
32713
32824
|
"optional": false,
|
|
32714
32825
|
"returnType": "void",
|
|
32715
32826
|
"typeParameters": [],
|
|
32716
|
-
"line":
|
|
32827
|
+
"line": 740,
|
|
32717
32828
|
"deprecated": false,
|
|
32718
32829
|
"deprecationMessage": "",
|
|
32719
32830
|
"rawdescription": "\n\nCreates the `Dropdown` list as an element that is appended to the DOM body.\n",
|
|
@@ -32725,7 +32836,7 @@
|
|
|
32725
32836
|
"optional": false,
|
|
32726
32837
|
"returnType": "void",
|
|
32727
32838
|
"typeParameters": [],
|
|
32728
|
-
"line":
|
|
32839
|
+
"line": 732,
|
|
32729
32840
|
"deprecated": false,
|
|
32730
32841
|
"deprecationMessage": "",
|
|
32731
32842
|
"rawdescription": "\n\nCreates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n",
|
|
@@ -32744,7 +32855,7 @@
|
|
|
32744
32855
|
"optional": false,
|
|
32745
32856
|
"returnType": "void",
|
|
32746
32857
|
"typeParameters": [],
|
|
32747
|
-
"line":
|
|
32858
|
+
"line": 712,
|
|
32748
32859
|
"deprecated": false,
|
|
32749
32860
|
"deprecationMessage": "",
|
|
32750
32861
|
"rawdescription": "\n\nHandles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n",
|
|
@@ -32767,7 +32878,7 @@
|
|
|
32767
32878
|
"optional": false,
|
|
32768
32879
|
"returnType": "void",
|
|
32769
32880
|
"typeParameters": [],
|
|
32770
|
-
"line":
|
|
32881
|
+
"line": 692,
|
|
32771
32882
|
"deprecated": false,
|
|
32772
32883
|
"deprecationMessage": ""
|
|
32773
32884
|
},
|
|
@@ -32784,7 +32895,7 @@
|
|
|
32784
32895
|
"optional": false,
|
|
32785
32896
|
"returnType": "void",
|
|
32786
32897
|
"typeParameters": [],
|
|
32787
|
-
"line":
|
|
32898
|
+
"line": 696,
|
|
32788
32899
|
"deprecated": false,
|
|
32789
32900
|
"deprecationMessage": "",
|
|
32790
32901
|
"rawdescription": "\n\nHandles clicks outside of the `Dropdown`.\n",
|
|
@@ -32814,7 +32925,7 @@
|
|
|
32814
32925
|
"optional": false,
|
|
32815
32926
|
"returnType": "void",
|
|
32816
32927
|
"typeParameters": [],
|
|
32817
|
-
"line":
|
|
32928
|
+
"line": 704,
|
|
32818
32929
|
"deprecated": false,
|
|
32819
32930
|
"deprecationMessage": "",
|
|
32820
32931
|
"jsdoctags": [
|
|
@@ -32835,7 +32946,7 @@
|
|
|
32835
32946
|
"optional": false,
|
|
32836
32947
|
"returnType": "any",
|
|
32837
32948
|
"typeParameters": [],
|
|
32838
|
-
"line":
|
|
32949
|
+
"line": 754,
|
|
32839
32950
|
"deprecated": false,
|
|
32840
32951
|
"deprecationMessage": "",
|
|
32841
32952
|
"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",
|
|
@@ -32847,7 +32958,7 @@
|
|
|
32847
32958
|
"optional": false,
|
|
32848
32959
|
"returnType": "void",
|
|
32849
32960
|
"typeParameters": [],
|
|
32850
|
-
"line":
|
|
32961
|
+
"line": 673,
|
|
32851
32962
|
"deprecated": false,
|
|
32852
32963
|
"deprecationMessage": ""
|
|
32853
32964
|
},
|
|
@@ -32864,7 +32975,7 @@
|
|
|
32864
32975
|
"optional": false,
|
|
32865
32976
|
"returnType": "void",
|
|
32866
32977
|
"typeParameters": [],
|
|
32867
|
-
"line":
|
|
32978
|
+
"line": 613,
|
|
32868
32979
|
"deprecated": false,
|
|
32869
32980
|
"deprecationMessage": "",
|
|
32870
32981
|
"jsdoctags": [
|
|
@@ -32885,7 +32996,7 @@
|
|
|
32885
32996
|
"optional": false,
|
|
32886
32997
|
"returnType": "void",
|
|
32887
32998
|
"typeParameters": [],
|
|
32888
|
-
"line":
|
|
32999
|
+
"line": 818,
|
|
32889
33000
|
"deprecated": false,
|
|
32890
33001
|
"deprecationMessage": "",
|
|
32891
33002
|
"rawdescription": "\n\nCollapsing the dropdown menu and removing unnecessary `EventListeners`.\n",
|
|
@@ -32897,7 +33008,7 @@
|
|
|
32897
33008
|
"optional": false,
|
|
32898
33009
|
"returnType": "Observable<string>",
|
|
32899
33010
|
"typeParameters": [],
|
|
32900
|
-
"line":
|
|
33011
|
+
"line": 632,
|
|
32901
33012
|
"deprecated": false,
|
|
32902
33013
|
"deprecationMessage": "",
|
|
32903
33014
|
"rawdescription": "\n\nReturns the display value if there is a selection and displayValue is set,\nif there is just a selection the ListItem content property will be returned,\notherwise the placeholder will be returned.\n",
|
|
@@ -32909,7 +33020,7 @@
|
|
|
32909
33020
|
"optional": false,
|
|
32910
33021
|
"returnType": "{ items: any; item?: undefined; } | { item: any; items?: undefined; } | { items?: undefined; item?: undefined; }",
|
|
32911
33022
|
"typeParameters": [],
|
|
32912
|
-
"line":
|
|
33023
|
+
"line": 653,
|
|
32913
33024
|
"deprecated": false,
|
|
32914
33025
|
"deprecationMessage": ""
|
|
32915
33026
|
},
|
|
@@ -32919,7 +33030,7 @@
|
|
|
32919
33030
|
"optional": false,
|
|
32920
33031
|
"returnType": "number",
|
|
32921
33032
|
"typeParameters": [],
|
|
32922
|
-
"line":
|
|
33033
|
+
"line": 667,
|
|
32923
33034
|
"deprecated": false,
|
|
32924
33035
|
"deprecationMessage": ""
|
|
32925
33036
|
},
|
|
@@ -32936,7 +33047,7 @@
|
|
|
32936
33047
|
"optional": false,
|
|
32937
33048
|
"returnType": "void",
|
|
32938
33049
|
"typeParameters": [],
|
|
32939
|
-
"line":
|
|
33050
|
+
"line": 860,
|
|
32940
33051
|
"deprecated": false,
|
|
32941
33052
|
"deprecationMessage": "",
|
|
32942
33053
|
"jsdoctags": [
|
|
@@ -32957,7 +33068,7 @@
|
|
|
32957
33068
|
"optional": false,
|
|
32958
33069
|
"returnType": "boolean",
|
|
32959
33070
|
"typeParameters": [],
|
|
32960
|
-
"line":
|
|
33071
|
+
"line": 649,
|
|
32961
33072
|
"deprecated": false,
|
|
32962
33073
|
"deprecationMessage": ""
|
|
32963
33074
|
},
|
|
@@ -32974,7 +33085,7 @@
|
|
|
32974
33085
|
"optional": false,
|
|
32975
33086
|
"returnType": "boolean",
|
|
32976
33087
|
"typeParameters": [],
|
|
32977
|
-
"line":
|
|
33088
|
+
"line": 856,
|
|
32978
33089
|
"deprecated": false,
|
|
32979
33090
|
"deprecationMessage": "",
|
|
32980
33091
|
"modifierKind": [
|
|
@@ -32998,7 +33109,7 @@
|
|
|
32998
33109
|
"optional": false,
|
|
32999
33110
|
"returnType": "void",
|
|
33000
33111
|
"typeParameters": [],
|
|
33001
|
-
"line":
|
|
33112
|
+
"line": 536,
|
|
33002
33113
|
"deprecated": false,
|
|
33003
33114
|
"deprecationMessage": ""
|
|
33004
33115
|
},
|
|
@@ -33015,7 +33126,7 @@
|
|
|
33015
33126
|
"optional": false,
|
|
33016
33127
|
"returnType": "void",
|
|
33017
33128
|
"typeParameters": [],
|
|
33018
|
-
"line":
|
|
33129
|
+
"line": 578,
|
|
33019
33130
|
"deprecated": false,
|
|
33020
33131
|
"deprecationMessage": "",
|
|
33021
33132
|
"rawdescription": "\n\nAdds keyboard functionality for navigation, selection and closing of the `Dropdown`.\n",
|
|
@@ -33047,7 +33158,7 @@
|
|
|
33047
33158
|
"optional": false,
|
|
33048
33159
|
"returnType": "void",
|
|
33049
33160
|
"typeParameters": [],
|
|
33050
|
-
"line":
|
|
33161
|
+
"line": 774,
|
|
33051
33162
|
"deprecated": false,
|
|
33052
33163
|
"deprecationMessage": "",
|
|
33053
33164
|
"rawdescription": "\n\nExpands the dropdown menu in the view.\n",
|
|
@@ -33066,7 +33177,7 @@
|
|
|
33066
33177
|
"optional": false,
|
|
33067
33178
|
"returnType": "void",
|
|
33068
33179
|
"typeParameters": [],
|
|
33069
|
-
"line":
|
|
33180
|
+
"line": 540,
|
|
33070
33181
|
"deprecated": false,
|
|
33071
33182
|
"deprecationMessage": "",
|
|
33072
33183
|
"jsdoctags": [
|
|
@@ -33094,7 +33205,7 @@
|
|
|
33094
33205
|
"optional": false,
|
|
33095
33206
|
"returnType": "void",
|
|
33096
33207
|
"typeParameters": [],
|
|
33097
|
-
"line":
|
|
33208
|
+
"line": 548,
|
|
33098
33209
|
"deprecated": false,
|
|
33099
33210
|
"deprecationMessage": "",
|
|
33100
33211
|
"rawdescription": "\n\nRegistering the function injected to control the touch use of the `Dropdown`.\n",
|
|
@@ -33124,7 +33235,7 @@
|
|
|
33124
33235
|
"optional": false,
|
|
33125
33236
|
"returnType": "void",
|
|
33126
33237
|
"typeParameters": [],
|
|
33127
|
-
"line":
|
|
33238
|
+
"line": 570,
|
|
33128
33239
|
"deprecated": false,
|
|
33129
33240
|
"deprecationMessage": "",
|
|
33130
33241
|
"rawdescription": "\n\n`ControlValueAccessor` method to programmatically disable the dropdown.\n\nex: `this.formGroup.get(\"myDropdown\").disable();`\n\n",
|
|
@@ -33132,8 +33243,8 @@
|
|
|
33132
33243
|
"jsdoctags": [
|
|
33133
33244
|
{
|
|
33134
33245
|
"name": {
|
|
33135
|
-
"pos":
|
|
33136
|
-
"end":
|
|
33246
|
+
"pos": 17341,
|
|
33247
|
+
"end": 17351,
|
|
33137
33248
|
"flags": 16842752,
|
|
33138
33249
|
"modifierFlagsCache": 0,
|
|
33139
33250
|
"transformFlags": 0,
|
|
@@ -33144,8 +33255,8 @@
|
|
|
33144
33255
|
"deprecated": false,
|
|
33145
33256
|
"deprecationMessage": "",
|
|
33146
33257
|
"tagName": {
|
|
33147
|
-
"pos":
|
|
33148
|
-
"end":
|
|
33258
|
+
"pos": 17335,
|
|
33259
|
+
"end": 17340,
|
|
33149
33260
|
"flags": 16842752,
|
|
33150
33261
|
"modifierFlagsCache": 0,
|
|
33151
33262
|
"transformFlags": 0,
|
|
@@ -33162,7 +33273,7 @@
|
|
|
33162
33273
|
"optional": false,
|
|
33163
33274
|
"returnType": "void",
|
|
33164
33275
|
"typeParameters": [],
|
|
33165
|
-
"line":
|
|
33276
|
+
"line": 848,
|
|
33166
33277
|
"deprecated": false,
|
|
33167
33278
|
"deprecationMessage": "",
|
|
33168
33279
|
"rawdescription": "\n\nControls toggling menu states between open/expanded and closed/collapsed.\n",
|
|
@@ -33174,7 +33285,7 @@
|
|
|
33174
33285
|
"optional": false,
|
|
33175
33286
|
"returnType": "boolean",
|
|
33176
33287
|
"typeParameters": [],
|
|
33177
|
-
"line":
|
|
33288
|
+
"line": 687,
|
|
33178
33289
|
"deprecated": false,
|
|
33179
33290
|
"deprecationMessage": "",
|
|
33180
33291
|
"rawdescription": "\n\nReturns `true` if there is a value selected.\n",
|
|
@@ -33193,7 +33304,7 @@
|
|
|
33193
33304
|
"optional": false,
|
|
33194
33305
|
"returnType": "void",
|
|
33195
33306
|
"typeParameters": [],
|
|
33196
|
-
"line":
|
|
33307
|
+
"line": 497,
|
|
33197
33308
|
"deprecated": false,
|
|
33198
33309
|
"deprecationMessage": "",
|
|
33199
33310
|
"rawdescription": "\n\nPropagates the injected `value`.\n",
|
|
@@ -33219,7 +33330,7 @@
|
|
|
33219
33330
|
"defaultValue": "true",
|
|
33220
33331
|
"deprecated": false,
|
|
33221
33332
|
"deprecationMessage": "",
|
|
33222
|
-
"line":
|
|
33333
|
+
"line": 358,
|
|
33223
33334
|
"type": "boolean",
|
|
33224
33335
|
"decorators": []
|
|
33225
33336
|
},
|
|
@@ -33228,7 +33339,7 @@
|
|
|
33228
33339
|
"defaultValue": "true",
|
|
33229
33340
|
"deprecated": false,
|
|
33230
33341
|
"deprecationMessage": "",
|
|
33231
|
-
"line":
|
|
33342
|
+
"line": 360,
|
|
33232
33343
|
"type": "boolean",
|
|
33233
33344
|
"decorators": []
|
|
33234
33345
|
},
|
|
@@ -33236,7 +33347,7 @@
|
|
|
33236
33347
|
"name": "class.cds--list-box__wrapper--decorator",
|
|
33237
33348
|
"deprecated": false,
|
|
33238
33349
|
"deprecationMessage": "",
|
|
33239
|
-
"line":
|
|
33350
|
+
"line": 362,
|
|
33240
33351
|
"type": "boolean",
|
|
33241
33352
|
"decorators": []
|
|
33242
33353
|
},
|
|
@@ -33244,7 +33355,7 @@
|
|
|
33244
33355
|
"name": "class.cds--list-box__wrapper--fluid--focus",
|
|
33245
33356
|
"deprecated": false,
|
|
33246
33357
|
"deprecationMessage": "",
|
|
33247
|
-
"line":
|
|
33358
|
+
"line": 200,
|
|
33248
33359
|
"type": "boolean",
|
|
33249
33360
|
"decorators": []
|
|
33250
33361
|
},
|
|
@@ -33252,7 +33363,7 @@
|
|
|
33252
33363
|
"name": "class.cds--list-box__wrapper--fluid--invalid",
|
|
33253
33364
|
"deprecated": false,
|
|
33254
33365
|
"deprecationMessage": "",
|
|
33255
|
-
"line":
|
|
33366
|
+
"line": 196,
|
|
33256
33367
|
"type": "boolean",
|
|
33257
33368
|
"decorators": []
|
|
33258
33369
|
}
|
|
@@ -33275,7 +33386,7 @@
|
|
|
33275
33386
|
"deprecationMessage": "",
|
|
33276
33387
|
"rawdescription": "\n\nAdds keyboard functionality for navigation, selection and closing of the `Dropdown`.\n",
|
|
33277
33388
|
"description": "<p>Adds keyboard functionality for navigation, selection and closing of the <code>Dropdown</code>.</p>\n",
|
|
33278
|
-
"line":
|
|
33389
|
+
"line": 578
|
|
33279
33390
|
}
|
|
33280
33391
|
],
|
|
33281
33392
|
"standalone": false,
|
|
@@ -33283,7 +33394,7 @@
|
|
|
33283
33394
|
"description": "<p>Drop-down lists enable users to select one or more items from a list.</p>\n<h4>Opening behavior/List DOM placement</h4>\n<p>By default the dropdown will try to figure out the best placement for the dropdown list.</p>\n<p>If it's not contained within any scrolling elements, it will open inline, if it <em>is</em>\ncontained within a scrolling container it will try to open in the body, or an <code>cds-placeholder</code>.</p>\n<p>To control this behavior you can use the <code>appendInline</code> input:</p>\n<ul>\n<li><code>[appendInline]="null"</code> is the default (auto detection)</li>\n<li><code>[appendInline]="false"</code> will always append to the body/<code>cds-placeholder</code></li>\n<li><code>[appendInline]="true"</code> will always append inline (next to the dropdown button)</li>\n</ul>\n<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { DropdownModule } from 'carbon-components-angular';</code></pre></div><p><a href=\"../../?path=/story/components-dropdown--basic\">See demo</a></p>\n",
|
|
33284
33395
|
"rawdescription": "\n\nDrop-down lists enable users to select one or more items from a list.\n\n#### Opening behavior/List DOM placement\nBy default the dropdown will try to figure out the best placement for the dropdown list.\n\nIf it's not contained within any scrolling elements, it will open inline, if it _is_\ncontained within a scrolling container it will try to open in the body, or an `cds-placeholder`.\n\nTo control this behavior you can use the `appendInline` input:\n- `[appendInline]=\"null\"` is the default (auto detection)\n- `[appendInline]=\"false\"` will always append to the body/`cds-placeholder`\n- `[appendInline]=\"true\"` will always append inline (next to the dropdown button)\n\nGet started with importing the module:\n\n```typescript\nimport { DropdownModule } from 'carbon-components-angular';\n```\n\n[See demo](../../?path=/story/components-dropdown--basic)\n",
|
|
33285
33396
|
"type": "component",
|
|
33286
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tElementRef,\n\tContentChild,\n\tOnInit,\n\tViewChild,\n\tAfterContentInit,\n\tHostListener,\n\tOnDestroy,\n\tHostBinding,\n\tTemplateRef,\n\tAfterViewInit\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\n\n// Observable import is required here so typescript can compile correctly\nimport {\n\tObservable,\n\tof,\n\tSubscription\n} from \"rxjs\";\n\nimport { AbstractDropdownView } from \"./abstract-dropdown-view.class\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { ListItem } from \"./list-item.interface\";\nimport { DropdownService } from \"./dropdown.service\";\nimport { ElementService, getScrollableParents } from \"carbon-components-angular/utils\";\nimport { hasScrollableParents } from \"carbon-components-angular/utils\";\n\n/**\n * Drop-down lists enable users to select one or more items from a list.\n *\n * #### Opening behavior/List DOM placement\n * By default the dropdown will try to figure out the best placement for the dropdown list.\n *\n * If it's not contained within any scrolling elements, it will open inline, if it _is_\n * contained within a scrolling container it will try to open in the body, or an `cds-placeholder`.\n *\n * To control this behavior you can use the `appendInline` input:\n * - `[appendInline]=\"null\"` is the default (auto detection)\n * - `[appendInline]=\"false\"` will always append to the body/`cds-placeholder`\n * - `[appendInline]=\"true\"` will always append inline (next to the dropdown button)\n *\n * Get started with importing the module:\n *\n * ```typescript\n * import { DropdownModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-dropdown--basic)\n */\n@Component({\n\tselector: \"cds-dropdown, ibm-dropdown\",\n\ttemplate: `\n\t<label\n\t\t*ngIf=\"label && !skeleton\"\n\t\t[for]=\"id\"\n\t\tclass=\"cds--label\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--label--disabled': disabled,\n\t\t\t'cds--visually-hidden': hideLabel\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t</label>\n\t<div\n\t\tclass=\"cds--list-box\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--dropdown': type !== 'multi' && !(skeleton && fluid),\n\t\t\t'cds--multiselect': type === 'multi',\n\t\t\t'cds--multi-select--selected': type === 'multi' && getSelectedCount() > 0,\n\t\t\t'cds--dropdown--light': theme === 'light',\n\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t'cds--list-box--inline': inline,\n\t\t\t'cds--skeleton': skeleton,\n\t\t\t'cds--dropdown--disabled cds--list-box--disabled': disabled,\n\t\t\t'cds--dropdown--readonly': readonly,\n\t\t\t'cds--dropdown--invalid': invalid,\n\t\t\t'cds--dropdown--warning cds--list-box--warning': warn,\n\t\t\t'cds--dropdown--sm cds--list-box--sm': size === 'sm',\n\t\t\t'cds--dropdown--md cds--list-box--md': size === 'md',\n\t\t\t'cds--dropdown--lg cds--list-box--lg': size === 'lg',\n\t\t\t'cds--list-box--expanded': !menuIsClosed,\n\t\t\t'cds--list-box--invalid': invalid\n\t\t}\"\n\t\t[attr.data-invalid]=\"invalid ? true : null\">\n\t\t<div *ngIf=\"skeleton && fluid\" class=\"cds--list-box__label\"></div>\n\t\t<button\n\t\t\t#dropdownButton\n\t\t\t[id]=\"id\"\n\t\t\ttype=\"button\"\n\t\t\tclass=\"cds--list-box__field\"\n\t\t\t[ngClass]=\"{'a': !menuIsClosed}\"\n\t\t\t[attr.aria-expanded]=\"!menuIsClosed\"\n\t\t\t[attr.aria-disabled]=\"disabled\"\n\t\t\taria-haspopup=\"listbox\"\n\t\t\t(click)=\"disabled || readonly ? $event.stopPropagation() : toggleMenu()\"\n\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t(blur)=\"fluid ? handleFocus($event) : onBlur()\"\n\t\t\t[attr.disabled]=\"disabled ? true : null\">\n\t\t\t<div\n\t\t\t\t(click)=\"clearSelected()\"\n\t\t\t\t(keydown.enter)=\"clearSelected()\"\n\t\t\t\t*ngIf=\"type === 'multi' && getSelectedCount() > 0\"\n\t\t\t\tclass=\"cds--list-box__selection cds--tag--filter cds--list-box__selection--multi\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t\t[title]=\"clearText\">\n\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t<svg\n\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\trole=\"img\"\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\twidth=\"16\"\n\t\t\t\t\theight=\"16\"\n\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\taria-hidden=\"true\">\n\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</svg>\n\t\t\t</div>\n\t\t\t<span *ngIf=\"isRenderString()\" class=\"cds--list-box__label\">{{getDisplayStringValue() | async}}</span>\n\t\t\t<ng-template\n\t\t\t\t*ngIf=\"!isRenderString()\"\n\t\t\t\t[ngTemplateOutletContext]=\"getRenderTemplateContext()\"\n\t\t\t\t[ngTemplateOutlet]=\"displayValue\">\n\t\t\t</ng-template>\n\t\t\t<span class=\"cds--list-box__menu-icon\">\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton\"\n\t\t\t\t\tcdsIcon=\"chevron--down\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t[attr.aria-label]=\"menuButtonLabel\"\n\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': !menuIsClosed }\">\n\t\t\t\t</svg>\n\t\t\t</span>\n\t\t</button>\n\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t</div>\n\t\t</ng-container>\n\t\t<svg\n\t\t\t*ngIf=\"invalid\"\n\t\t\tclass=\"cds--list-box__invalid-icon\"\n\t\t\tcdsIcon=\"warning--filled\"\n\t\t\tsize=\"16\">\n\t\t</svg>\n\t\t<svg\n\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t</svg>\n\t\t<div\n\t\t\t#dropdownMenu\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t}\">\n\t\t\t<ng-content *ngIf=\"!menuIsClosed\"></ng-content>\n\t\t</div>\n\t</div>\n\t<hr *ngIf=\"fluid\" class=\"cds--list-box__divider\" />\n\t<div\n\t\t*ngIf=\"helperText && !invalid && !warn && !skeleton && !fluid\"\n\t\tclass=\"cds--form__helper-text\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: Dropdown,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class Dropdown implements OnInit, AfterContentInit, AfterViewInit, OnDestroy, ControlValueAccessor {\n\tstatic dropdownCount = 0;\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid--invalid\") get fluidInvalidClass() {\n\t\treturn this.invalid && this.fluid;\n\t}\n\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid--focus\") get fluidFocusClass() {\n\t\treturn this.fluid && this._isFocused && this.menuIsClosed;\n\t}\n\n\tprotected get writtenValue() {\n\t\treturn this._writtenValue;\n\t}\n\n\tprotected set writtenValue(val: any[]) {\n\t\tif (val && val.length === 0) {\n\t\t\tthis.clearSelected();\n\t\t}\n\t\tthis._writtenValue = val;\n\t}\n\n\t@Input() id = `dropdown-${Dropdown.dropdownCount++}`;\n\t/**\n\t * Label for the dropdown.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\t/**\n\t * Value displayed if no item is selected.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * The selected value from the `Dropdown`. Can be a string or template.\n\t */\n\t@Input() displayValue: string | TemplateRef<any> = \"\";\n\t/**\n\t * Sets the optional clear button tooltip text.\n\t */\n\t@Input() clearText: string = this.i18n.get().DROPDOWN.CLEAR;\n\t/**\n\t * Size to render the dropdown field.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Defines whether or not the `Dropdown` supports selecting multiple items as opposed to single\n\t * item selection.\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` dropdown theme\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` to disable the dropdown.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a readonly state.\n\t */\n\t@Input() readonly = false;\n\t/**\n\t * Set to `true` for a loading dropdown.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an inline dropdown.\n\t */\n\t@Input() inline = false;\n\t/**\n\t * Set to `true` for a dropdown without arrow key activation.\n\t */\n\t@Input() disableArrowKeys = false;\n\t/**\n\t * Set to `true` for invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if dropdown is in 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 warningText)\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 * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Query string for the element that contains the `Dropdown`.\n\t * Used to trigger closing the dropdown if it scrolls outside of the viewport of the `scrollableContainer`.\n\t */\n\t@Input() scrollableContainer: string;\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 * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at it's 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 * Accessible label for the button that opens the dropdown list.\n\t * Defaults to the `DROPDOWN.OPEN` value from the i18n service.\n\t */\n\t@Input() menuButtonLabel = this.i18n.get().DROPDOWN.OPEN;\n\t/**\n\t * Provides the label for the \"# selected\" text.\n\t * Defaults to the `DROPDOWN.SELECTED` value from the i18n service.\n\t */\n\t@Input() selectedLabel = this.i18n.get().DROPDOWN.SELECTED;\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Emits selection events.\n\t */\n\t@Output() selected: EventEmitter<Object> = new EventEmitter<Object>();\n\t/**\n\t * Emits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n\t */\n\t@Output() onClose: EventEmitter<any> = new EventEmitter<any>();\n\t/**\n\t * Emits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n\t */\n\t@Output() close: EventEmitter<any> = new EventEmitter<any>();\n\n\t/**\n\t * Maintains a reference to the `AbstractDropdownView` object within the content DOM.\n\t */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t/**\n\t * Maintains a reference to the view DOM element of the `Dropdown` button.\n\t */\n\t@ViewChild(\"dropdownButton\", { static: true }) dropdownButton;\n\t/**\n\t * ViewChid of the dropdown view.\n\t */\n\t@ViewChild(\"dropdownMenu\", { static: true }) dropdownMenu;\n\n\t@HostBinding(\"class.cds--dropdown__wrapper\") hostClass = true;\n\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostWrapperClass = true;\n\n\t@HostBinding(\"class.cds--list-box__wrapper--decorator\") get hasDecorator() {\n\t\treturn !!this.decorator;\n\t}\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid\") @Input() fluid = false;\n\n\t/**\n\t * Set to `true` if the dropdown is closed (not expanded).\n\t */\n\tmenuIsClosed = true;\n\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\t// .bind creates a new function, so we declare the methods below\n\t// but .bind them up here\n\tnoop = this._noop.bind(this);\n\toutsideClick = this._outsideClick.bind(this);\n\toutsideKey = this._outsideKey.bind(this);\n\tkeyboardNav = this._keyboardNav.bind(this);\n\n\tprotected visibilitySubscription = new Subscription();\n\n\tprotected onTouchedCallback: () => void = this._noop;\n\n\tprotected _isFocused = false;\n\n\t// primarily used to capture and propagate input to `writeValue` before the content is available\n\tprivate _writtenValue: any = [];\n\n\t/**\n\t * Creates an instance of Dropdown.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected i18n: I18n,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected elementService: ElementService) {}\n\n\t/**\n\t * Updates the `type` property in the `@ContentChild`.\n\t * The `type` property specifies whether the `Dropdown` allows single selection or multi selection.\n\t */\n\tngOnInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\t\t}\n\t}\n\n\t/**\n\t * Initializes classes and subscribes to events for single or multi selection.\n\t */\n\tngAfterContentInit() {\n\t\tif (!this.view) {\n\t\t\treturn;\n\t\t}\n\t\tif ((this.writtenValue && this.writtenValue.length) || typeof this.writtenValue === \"number\") {\n\t\t\tthis.writeValue(this.writtenValue);\n\t\t}\n\t\tthis.view.type = this.type;\n\t\tthis.view.size = this.size;\n\n\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\tthis.view.select.subscribe(event => {\n\t\t\tif (this.type === \"single\" && !isUpdate(event) && !Array.isArray(event)) {\n\t\t\t\tthis.closeMenu();\n\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\tthis.propagateChange(event.item[this.itemValueKey]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.propagateChange(event.item);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.propagateChange(null);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.type === \"multi\" && !isUpdate(event)) {\n\t\t\t\t// if we have a `value` selector and selected items map them appropriately\n\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\tthis.propagateChange(values);\n\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t} else {\n\t\t\t\t\tthis.propagateChange(this.view.getSelected());\n\t\t\t\t}\n\t\t\t}\n\t\t\t// only emit selected for \"organic\" selections\n\t\t\tif (!isUpdate(event)) {\n\t\t\t\tthis.checkForReorder();\n\t\t\t\tthis.selected.emit(event);\n\t\t\t}\n\t\t});\n\t}\n\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\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\tthis.checkForReorder();\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 * Propagates the injected `value`.\n\t */\n\twriteValue(value: any) {\n\t\t// cache the written value so we can use it in `AfterContentInit`\n\t\tthis.writtenValue = value;\n\t\tthis.view.onItemsReady(() => {\n\t\t\t// propagate null/falsey as an array (deselect everything)\n\t\t\tif (!value) {\n\t\t\t\tthis.view.propagateSelected([value]);\n\t\t\t} else if (this.type === \"single\") {\n\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t// clone the specified item and update its state\n\t\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\t\tnewValue.selected = true;\n\t\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t\t} else {\n\t\t\t\t\t// pass the singular value as an array of ListItem\n\t\t\t\t\tthis.view.propagateSelected([value]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t// clone the items and update their state based on the received value array\n\t\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\t\tlet newValues = [];\n\t\t\t\t\tfor (const v of value) {\n\t\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t\t} else {\n\t\t\t\t\t// we can safely assume we're passing an array of `ListItem`s\n\t\t\t\t\tthis.view.propagateSelected(value);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.checkForReorder();\n\t\t});\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registering the function injected to control the touch use of the `Dropdown`.\n\t */\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * function passed in by `registerOnChange`\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the dropdown.\n\t *\n\t * ex: `this.formGroup.get(\"myDropdown\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the input\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Adds keyboard functionality for navigation, selection and closing of the `Dropdown`.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\tonKeyDown(event: KeyboardEvent) {\n\t\tif (this.readonly) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ((event.key === \"Escape\") && !this.menuIsClosed) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close other widgets that listen for Escape\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeMenu();\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t} else if (this.menuIsClosed && (event.key === \" \" || event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n\t\t\tif (this.disableArrowKeys && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tthis.openMenu();\n\t\t}\n\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target as Node)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && event.shiftKey) {\n\t\t\tthis.closeMenu();\n\t\t}\n\n\t\tif (this.type === \"multi\") { return; }\n\n\t\tif (this.menuIsClosed) {\n\t\t\tthis.closedDropdownNavigation(event);\n\t\t}\n\t}\n\n\tclosedDropdownNavigation(event) {\n\t\tif (event.key === \"ArrowDown\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.view.getCurrentItem().selected = false;\n\t\t\tlet item = this.view.getNextItem();\n\t\t\tif (item) { item.selected = true; }\n\t\t} else if (event.key === \"ArrowUp\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.view.getCurrentItem().selected = false;\n\t\t\tlet item = this.view.getPrevItem();\n\t\t\tif (item) { item.selected = true; }\n\t\t}\n\t}\n\n\t/**\n\t * Returns the display value if there is a selection and displayValue is set,\n\t * if there is just a selection the ListItem content property will be returned,\n\t * otherwise the placeholder will be returned.\n\t */\n\tgetDisplayStringValue(): Observable<string> {\n\t\tif (!this.view || this.skeleton) {\n\t\t\treturn;\n\t\t}\n\t\tlet selected = this.view.getSelected();\n\t\tif (selected.length && (!this.displayValue || !this.isRenderString())) {\n\t\t\tif (this.type === \"multi\") {\n\t\t\t\treturn of(this.placeholder);\n\t\t\t} else {\n\t\t\t\treturn of(selected[0].content);\n\t\t\t}\n\t\t} else if (selected.length && this.isRenderString()) {\n\t\t\treturn of(this.displayValue as string);\n\t\t}\n\t\treturn of(this.placeholder);\n\t}\n\n\tisRenderString(): boolean {\n\t\treturn typeof this.displayValue === \"string\";\n\t}\n\n\tgetRenderTemplateContext() {\n\t\tif (!this.view) {\n\t\t\treturn;\n\t\t}\n\t\tlet selected = this.view.getSelected();\n\t\tif (this.type === \"multi\") {\n\t\t\treturn { items: selected };\n\t\t} else if (selected && selected.length > 0) {\n\t\t\treturn { item: selected[0] }; // this is to be compatible with the dropdown-list template\n\t\t} else {\n\t\t\treturn {};\n\t\t}\n\t}\n\n\tgetSelectedCount(): number {\n\t\tif (this.view.getSelected()) {\n\t\t\treturn this.view.getSelected().length;\n\t\t}\n\t}\n\n\tclearSelected() {\n\t\tif (this.disabled || this.getSelectedCount() === 0) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const item of this.view.getListItems()) {\n\t\t\titem.selected = false;\n\t\t}\n\t\tthis.selected.emit([]);\n\t\tthis.propagateChange([]);\n\t}\n\n\t/**\n\t * Returns `true` if there is a value selected.\n\t */\n\tvalueSelected(): boolean {\n\t\tif (this.view.getSelected()) { return true; }\n\t\treturn false;\n\t}\n\n\t_noop() { }\n\t/**\n\t * Handles clicks outside of the `Dropdown`.\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.closeMenu();\n\t\t}\n\t}\n\t_outsideKey(event) {\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target as Node)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\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.menuIsClosed) {\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.closeMenu();\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t} else if (!this.menuIsClosed && 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.dropdownButton.nativeElement.focus();\n\t\t\tthis.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n\t\t\tthis.closeMenu();\n\t\t}\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 * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tconst lightClass = this.theme === \"light\" ? \" cds--list-box--light\" : \"\";\n\t\tconst expandedClass = !this.menuIsClosed ? \" cds--list-box--expanded\" : \"\";\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.dropdownButton.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"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 * Expands the dropdown menu in the view.\n\t */\n\topenMenu() {\n\t\t// prevents the dropdown from opening when list of items is empty\n\t\tif (this.view.getListItems().length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._dropUp = false;\n\t\tthis.menuIsClosed = false;\n\n\t\t// move the dropdown list to the body if we're not appending inline\n\t\t// and position it relative to the dropdown wrapper\n\t\tif (!this.appendInline) {\n\t\t\tconst target = this.dropdownButton.nativeElement;\n\t\t\tconst parent = this.elementRef.nativeElement;\n\t\t\tthis.visibilitySubscription = this.elementService\n\t\t\t\t.visibility(target, parent)\n\t\t\t\t.subscribe(value => {\n\t\t\t\t\tif (!value.visible) {\n\t\t\t\t\t\tthis.closeMenu();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\t// set the dropdown menu to drop up if it's near the bottom of the screen\n\t\t// setTimeout lets us measure after it's 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\n\t\t// we bind noop to document.body.firstElementChild to allow safari to fire events\n\t\t// from document. Then we unbind everything later to keep things light.\n\t\tdocument.body.firstElementChild.addEventListener(\"click\", this.noop, true);\n\t\tdocument.body.firstElementChild.addEventListener(\"keydown\", this.noop, true);\n\t\tdocument.addEventListener(\"click\", this.outsideClick, true);\n\t\tdocument.addEventListener(\"keydown\", this.outsideKey, true);\n\t\tsetTimeout(() => this.view.initFocus(), 0);\n\t}\n\n\t/**\n\t * Collapsing the dropdown menu and removing unnecessary `EventListeners`.\n\t */\n\tcloseMenu() {\n\t\t// return early if the menu is already closed\n\t\tif (this.menuIsClosed) { return; }\n\t\tthis.menuIsClosed = true;\n\t\tthis.checkForReorder();\n\t\tthis.onClose.emit();\n\t\tthis.close.emit();\n\n\t\t// focus the trigger button when we close ...\n\t\tthis.dropdownButton.nativeElement.focus();\n\n\t\t// remove the conditional once this api is settled and part of abstract-dropdown-view.class\n\t\tif (this.view[\"disableScroll\"]) {\n\t\t\tthis.view[\"disableScroll\"]();\n\t\t}\n\n\t\t// move the list back in the component on close\n\t\tif (!this.appendInline) {\n\t\t\tthis.visibilitySubscription.unsubscribe();\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t\tdocument.body.firstElementChild.removeEventListener(\"click\", this.noop, true);\n\t\tdocument.body.firstElementChild.removeEventListener(\"keydown\", this.noop, true);\n\t\tdocument.removeEventListener(\"click\", this.outsideClick, true);\n\t\tdocument.removeEventListener(\"keydown\", this.outsideKey, true);\n\t}\n\n\t/**\n\t * Controls toggling menu states between open/expanded and closed/collapsed.\n\t */\n\ttoggleMenu() {\n\t\tif (this.menuIsClosed) {\n\t\t\tthis.openMenu();\n\t\t} else {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tthis._isFocused = event.type === \"focus\";\n\t\tif (event.type === \"blur\") {\n\t\t\tthis.onBlur();\n\t\t}\n\t}\n\n\t/**\n\t * Controls when it's needed to apply the selection feedback\n\t */\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = this.menuIsClosed && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected();\n\t\t}\n\t}\n}\n",
|
|
33397
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tElementRef,\n\tContentChild,\n\tOnInit,\n\tViewChild,\n\tAfterContentInit,\n\tHostListener,\n\tOnDestroy,\n\tHostBinding,\n\tTemplateRef,\n\tAfterViewInit\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\n\n// Observable import is required here so typescript can compile correctly\nimport {\n\tObservable,\n\tof,\n\tSubscription\n} from \"rxjs\";\nimport { isNull, isUndefined } from \"lodash-es\";\n\nimport { AbstractDropdownView } from \"./abstract-dropdown-view.class\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { ListItem } from \"./list-item.interface\";\nimport { DropdownService } from \"./dropdown.service\";\nimport { ElementService, getScrollableParents } from \"carbon-components-angular/utils\";\nimport { hasScrollableParents } from \"carbon-components-angular/utils\";\n\n/**\n * Drop-down lists enable users to select one or more items from a list.\n *\n * #### Opening behavior/List DOM placement\n * By default the dropdown will try to figure out the best placement for the dropdown list.\n *\n * If it's not contained within any scrolling elements, it will open inline, if it _is_\n * contained within a scrolling container it will try to open in the body, or an `cds-placeholder`.\n *\n * To control this behavior you can use the `appendInline` input:\n * - `[appendInline]=\"null\"` is the default (auto detection)\n * - `[appendInline]=\"false\"` will always append to the body/`cds-placeholder`\n * - `[appendInline]=\"true\"` will always append inline (next to the dropdown button)\n *\n * Get started with importing the module:\n *\n * ```typescript\n * import { DropdownModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-dropdown--basic)\n */\n@Component({\n\tselector: \"cds-dropdown, ibm-dropdown\",\n\ttemplate: `\n\t<label\n\t\t*ngIf=\"label && !skeleton\"\n\t\t[for]=\"id\"\n\t\tclass=\"cds--label\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--label--disabled': disabled,\n\t\t\t'cds--visually-hidden': hideLabel\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t</label>\n\t<div\n\t\tclass=\"cds--list-box\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--dropdown': type !== 'multi' && !(skeleton && fluid),\n\t\t\t'cds--multiselect': type === 'multi',\n\t\t\t'cds--multi-select--selected': type === 'multi' && getSelectedCount() > 0,\n\t\t\t'cds--dropdown--light': theme === 'light',\n\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t'cds--list-box--inline': inline,\n\t\t\t'cds--skeleton': skeleton,\n\t\t\t'cds--dropdown--disabled cds--list-box--disabled': disabled,\n\t\t\t'cds--dropdown--readonly': readonly,\n\t\t\t'cds--dropdown--invalid': invalid,\n\t\t\t'cds--dropdown--warning cds--list-box--warning': warn,\n\t\t\t'cds--dropdown--sm cds--list-box--sm': size === 'sm',\n\t\t\t'cds--dropdown--md cds--list-box--md': size === 'md',\n\t\t\t'cds--dropdown--lg cds--list-box--lg': size === 'lg',\n\t\t\t'cds--list-box--expanded': !menuIsClosed,\n\t\t\t'cds--list-box--invalid': invalid\n\t\t}\"\n\t\t[attr.data-invalid]=\"invalid ? true : null\">\n\t\t<div *ngIf=\"skeleton && fluid\" class=\"cds--list-box__label\"></div>\n\t\t<button\n\t\t\t#dropdownButton\n\t\t\t[id]=\"id\"\n\t\t\ttype=\"button\"\n\t\t\tclass=\"cds--list-box__field\"\n\t\t\t[ngClass]=\"{'a': !menuIsClosed}\"\n\t\t\t[attr.aria-expanded]=\"!menuIsClosed\"\n\t\t\t[attr.aria-disabled]=\"disabled\"\n\t\t\taria-haspopup=\"listbox\"\n\t\t\t(click)=\"disabled || readonly ? $event.stopPropagation() : toggleMenu()\"\n\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t(blur)=\"fluid ? handleFocus($event) : onBlur()\"\n\t\t\t[attr.disabled]=\"disabled ? true : null\">\n\t\t\t<div\n\t\t\t\t(click)=\"clearSelected()\"\n\t\t\t\t(keydown.enter)=\"clearSelected()\"\n\t\t\t\t*ngIf=\"type === 'multi' && getSelectedCount() > 0\"\n\t\t\t\tclass=\"cds--list-box__selection cds--tag--filter cds--list-box__selection--multi\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t\t[title]=\"clearText\">\n\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t<svg\n\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\trole=\"img\"\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\twidth=\"16\"\n\t\t\t\t\theight=\"16\"\n\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\taria-hidden=\"true\">\n\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</svg>\n\t\t\t</div>\n\t\t\t<span *ngIf=\"isRenderString()\" class=\"cds--list-box__label\">{{getDisplayStringValue() | async}}</span>\n\t\t\t<ng-template\n\t\t\t\t*ngIf=\"!isRenderString()\"\n\t\t\t\t[ngTemplateOutletContext]=\"getRenderTemplateContext()\"\n\t\t\t\t[ngTemplateOutlet]=\"displayValue\">\n\t\t\t</ng-template>\n\t\t\t<span class=\"cds--list-box__menu-icon\">\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton\"\n\t\t\t\t\tcdsIcon=\"chevron--down\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t[attr.aria-label]=\"menuButtonLabel\"\n\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': !menuIsClosed }\">\n\t\t\t\t</svg>\n\t\t\t</span>\n\t\t</button>\n\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t</div>\n\t\t</ng-container>\n\t\t<svg\n\t\t\t*ngIf=\"invalid\"\n\t\t\tclass=\"cds--list-box__invalid-icon\"\n\t\t\tcdsIcon=\"warning--filled\"\n\t\t\tsize=\"16\">\n\t\t</svg>\n\t\t<svg\n\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t</svg>\n\t\t<div\n\t\t\t#dropdownMenu\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t}\">\n\t\t\t<ng-content *ngIf=\"!menuIsClosed\"></ng-content>\n\t\t</div>\n\t</div>\n\t<hr *ngIf=\"fluid\" class=\"cds--list-box__divider\" />\n\t<div\n\t\t*ngIf=\"helperText && !invalid && !warn && !skeleton && !fluid\"\n\t\tclass=\"cds--form__helper-text\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: Dropdown,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class Dropdown implements OnInit, AfterContentInit, AfterViewInit, OnDestroy, ControlValueAccessor {\n\tstatic dropdownCount = 0;\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid--invalid\") get fluidInvalidClass() {\n\t\treturn this.invalid && this.fluid;\n\t}\n\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid--focus\") get fluidFocusClass() {\n\t\treturn this.fluid && this._isFocused && this.menuIsClosed;\n\t}\n\n\tprotected get writtenValue() {\n\t\treturn this._writtenValue;\n\t}\n\n\tprotected set writtenValue(val: any[]) {\n\t\tif (val && val.length === 0) {\n\t\t\tthis.clearSelected();\n\t\t}\n\t\tthis._writtenValue = val;\n\t}\n\n\t@Input() id = `dropdown-${Dropdown.dropdownCount++}`;\n\t/**\n\t * Label for the dropdown.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\t/**\n\t * Value displayed if no item is selected.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * The selected value from the `Dropdown`. Can be a string or template.\n\t */\n\t@Input() displayValue: string | TemplateRef<any> = \"\";\n\t/**\n\t * Sets the optional clear button tooltip text.\n\t */\n\t@Input() clearText: string = this.i18n.get().DROPDOWN.CLEAR;\n\t/**\n\t * Size to render the dropdown field.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Defines whether or not the `Dropdown` supports selecting multiple items as opposed to single\n\t * item selection.\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` dropdown theme\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` to disable the dropdown.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a readonly state.\n\t */\n\t@Input() readonly = false;\n\t/**\n\t * Set to `true` for a loading dropdown.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an inline dropdown.\n\t */\n\t@Input() inline = false;\n\t/**\n\t * Set to `true` for a dropdown without arrow key activation.\n\t */\n\t@Input() disableArrowKeys = false;\n\t/**\n\t * Set to `true` for invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if dropdown is in 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 warningText)\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 * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Query string for the element that contains the `Dropdown`.\n\t * Used to trigger closing the dropdown if it scrolls outside of the viewport of the `scrollableContainer`.\n\t */\n\t@Input() scrollableContainer: string;\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 * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at it's 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 * Accessible label for the button that opens the dropdown list.\n\t * Defaults to the `DROPDOWN.OPEN` value from the i18n service.\n\t */\n\t@Input() menuButtonLabel = this.i18n.get().DROPDOWN.OPEN;\n\t/**\n\t * Provides the label for the \"# selected\" text.\n\t * Defaults to the `DROPDOWN.SELECTED` value from the i18n service.\n\t */\n\t@Input() selectedLabel = this.i18n.get().DROPDOWN.SELECTED;\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Set to `true` to allow null values in the dropdown ListItems.\n\t */\n\t@Input() allowNullValues = false;\n\t/**\n\t * Emits selection events.\n\t */\n\t@Output() selected: EventEmitter<Object> = new EventEmitter<Object>();\n\t/**\n\t * Emits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n\t */\n\t@Output() onClose: EventEmitter<any> = new EventEmitter<any>();\n\t/**\n\t * Emits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n\t */\n\t@Output() close: EventEmitter<any> = new EventEmitter<any>();\n\n\t/**\n\t * Maintains a reference to the `AbstractDropdownView` object within the content DOM.\n\t */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t/**\n\t * Maintains a reference to the view DOM element of the `Dropdown` button.\n\t */\n\t@ViewChild(\"dropdownButton\", { static: true }) dropdownButton;\n\t/**\n\t * ViewChid of the dropdown view.\n\t */\n\t@ViewChild(\"dropdownMenu\", { static: true }) dropdownMenu;\n\n\t@HostBinding(\"class.cds--dropdown__wrapper\") hostClass = true;\n\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostWrapperClass = true;\n\n\t@HostBinding(\"class.cds--list-box__wrapper--decorator\") get hasDecorator() {\n\t\treturn !!this.decorator;\n\t}\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid\") @Input() fluid = false;\n\n\t/**\n\t * Set to `true` if the dropdown is closed (not expanded).\n\t */\n\tmenuIsClosed = true;\n\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\t// .bind creates a new function, so we declare the methods below\n\t// but .bind them up here\n\tnoop = this._noop.bind(this);\n\toutsideClick = this._outsideClick.bind(this);\n\toutsideKey = this._outsideKey.bind(this);\n\tkeyboardNav = this._keyboardNav.bind(this);\n\n\tprotected visibilitySubscription = new Subscription();\n\n\tprotected onTouchedCallback: () => void = this._noop;\n\n\tprotected _isFocused = false;\n\n\t// primarily used to capture and propagate input to `writeValue` before the content is available\n\tprivate _writtenValue: any = [];\n\n\tprivate _isUsingNgControl = false;\n\n\tprivate selectionSubscription: Subscription;\n\n\t/**\n\t * Creates an instance of Dropdown.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected i18n: I18n,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected elementService: ElementService) {}\n\n\t/**\n\t * Updates the `type` property in the `@ContentChild`.\n\t * The `type` property specifies whether the `Dropdown` allows single selection or multi selection.\n\t */\n\tngOnInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\t\t}\n\t}\n\n\t/**\n\t * Initializes classes and subscribes to events for single or multi selection.\n\t */\n\tngAfterContentInit() {\n\t\tif (!this.view) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.view.type = this.type;\n\t\tthis.view.size = this.size;\n\n\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\tthis.selectionSubscription = this.view.select.subscribe(event => {\n\t\t\tif (this.type === \"single\" && !isUpdate(event) && !Array.isArray(event)) {\n\t\t\t\tthis.closeMenu();\n\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\tthis._propagateChange(event.item[this.itemValueKey]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._propagateChange(event.item);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis._propagateChange(null);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.type === \"multi\" && !isUpdate(event)) {\n\t\t\t\t// if we have a `value` selector and selected items map them appropriately\n\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\tthis._propagateChange(values);\n\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t} else {\n\t\t\t\t\tthis._propagateChange(this.view.getSelected());\n\t\t\t\t}\n\t\t\t}\n\t\t\t// only emit selected for \"organic\" selections\n\t\t\tif (!isUpdate(event)) {\n\t\t\t\tthis.checkForReorder();\n\t\t\t\tthis.selected.emit(event);\n\t\t\t} else if (this._isUsingNgControl) {\n\t\t\t\tthis.writeValue(this.writtenValue);\n\t\t\t}\n\t\t});\n\t}\n\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\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\tthis.checkForReorder();\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\n\t\tthis.visibilitySubscription?.unsubscribe();\n\t\tthis.selectionSubscription?.unsubscribe();\n\t}\n\n\t/**\n\t * Propagates the injected `value`.\n\t */\n\twriteValue(value: any) {\n\t\t// cache the written value so we can use it in `AfterContentInit`\n\t\tthis.writtenValue = value;\n\t\tthis.view.onItemsReady(() => {\n\t\t\t// propagate null/undefined as an array (deselect everything) unless `allowNullValues` is true\n\t\t\tif (isUndefined(value) || (isNull(value) && !this.allowNullValues)) {\n\t\t\t\tthis.view.propagateSelected([value]);\n\t\t\t} else if (this.type === \"single\") {\n\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t// clone the specified item and update its state\n\t\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\t\tnewValue.selected = true;\n\t\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t\t} else {\n\t\t\t\t\t// pass the singular value as an array of ListItem\n\t\t\t\t\tthis.view.propagateSelected([value]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t// clone the items and update their state based on the received value array\n\t\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\t\tlet newValues = [];\n\t\t\t\t\tfor (const v of value) {\n\t\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t\t} else {\n\t\t\t\t\t// we can safely assume we're passing an array of `ListItem`s\n\t\t\t\t\tthis.view.propagateSelected(value || [value]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.checkForReorder();\n\t\t});\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis._isUsingNgControl = true;\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registering the function injected to control the touch use of the `Dropdown`.\n\t */\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * function passed in by `registerOnChange`\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t// used only to update writtenValue\n\tprivate _propagateChange(value: any) {\n\t\tthis.writtenValue = value;\n\t\tthis.propagateChange(value);\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the dropdown.\n\t *\n\t * ex: `this.formGroup.get(\"myDropdown\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the input\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Adds keyboard functionality for navigation, selection and closing of the `Dropdown`.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\tonKeyDown(event: KeyboardEvent) {\n\t\tif (this.readonly) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ((event.key === \"Escape\") && !this.menuIsClosed) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close other widgets that listen for Escape\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeMenu();\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t} else if (this.menuIsClosed && (event.key === \" \" || event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n\t\t\tif (this.disableArrowKeys && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tthis.openMenu();\n\t\t}\n\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target as Node)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && event.shiftKey) {\n\t\t\tthis.closeMenu();\n\t\t}\n\n\t\tif (this.type === \"multi\") { return; }\n\n\t\tif (this.menuIsClosed) {\n\t\t\tthis.closedDropdownNavigation(event);\n\t\t}\n\t}\n\n\tclosedDropdownNavigation(event) {\n\t\tif (event.key === \"ArrowDown\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.view.getCurrentItem().selected = false;\n\t\t\tlet item = this.view.getNextItem();\n\t\t\tif (item) { item.selected = true; }\n\t\t} else if (event.key === \"ArrowUp\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.view.getCurrentItem().selected = false;\n\t\t\tlet item = this.view.getPrevItem();\n\t\t\tif (item) { item.selected = true; }\n\t\t}\n\t}\n\n\t/**\n\t * Returns the display value if there is a selection and displayValue is set,\n\t * if there is just a selection the ListItem content property will be returned,\n\t * otherwise the placeholder will be returned.\n\t */\n\tgetDisplayStringValue(): Observable<string> {\n\t\tif (!this.view || this.skeleton) {\n\t\t\treturn;\n\t\t}\n\t\tlet selected = this.view.getSelected();\n\t\tif (selected.length && (!this.displayValue || !this.isRenderString())) {\n\t\t\tif (this.type === \"multi\") {\n\t\t\t\treturn of(this.placeholder);\n\t\t\t} else {\n\t\t\t\treturn of(selected[0].content);\n\t\t\t}\n\t\t} else if (selected.length && this.isRenderString()) {\n\t\t\treturn of(this.displayValue as string);\n\t\t}\n\t\treturn of(this.placeholder);\n\t}\n\n\tisRenderString(): boolean {\n\t\treturn typeof this.displayValue === \"string\";\n\t}\n\n\tgetRenderTemplateContext() {\n\t\tif (!this.view) {\n\t\t\treturn;\n\t\t}\n\t\tlet selected = this.view.getSelected();\n\t\tif (this.type === \"multi\") {\n\t\t\treturn { items: selected };\n\t\t} else if (selected && selected.length > 0) {\n\t\t\treturn { item: selected[0] }; // this is to be compatible with the dropdown-list template\n\t\t} else {\n\t\t\treturn {};\n\t\t}\n\t}\n\n\tgetSelectedCount(): number {\n\t\tif (this.view.getSelected()) {\n\t\t\treturn this.view.getSelected().length;\n\t\t}\n\t}\n\n\tclearSelected() {\n\t\tif (this.disabled || this.getSelectedCount() === 0) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const item of this.view.getListItems()) {\n\t\t\titem.selected = false;\n\t\t}\n\t\tthis.selected.emit([]);\n\t\tthis._propagateChange([]);\n\t}\n\n\t/**\n\t * Returns `true` if there is a value selected.\n\t */\n\tvalueSelected(): boolean {\n\t\tif (this.view.getSelected()) { return true; }\n\t\treturn false;\n\t}\n\n\t_noop() { }\n\t/**\n\t * Handles clicks outside of the `Dropdown`.\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.closeMenu();\n\t\t}\n\t}\n\t_outsideKey(event) {\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target as Node)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\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.menuIsClosed) {\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.closeMenu();\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t} else if (!this.menuIsClosed && 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.dropdownButton.nativeElement.focus();\n\t\t\tthis.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n\t\t\tthis.closeMenu();\n\t\t}\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 * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tconst lightClass = this.theme === \"light\" ? \" cds--list-box--light\" : \"\";\n\t\tconst expandedClass = !this.menuIsClosed ? \" cds--list-box--expanded\" : \"\";\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.dropdownButton.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"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 * Expands the dropdown menu in the view.\n\t */\n\topenMenu() {\n\t\t// prevents the dropdown from opening when list of items is empty\n\t\tif (this.view.getListItems().length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._dropUp = false;\n\t\tthis.menuIsClosed = false;\n\n\t\t// move the dropdown list to the body if we're not appending inline\n\t\t// and position it relative to the dropdown wrapper\n\t\tif (!this.appendInline) {\n\t\t\tconst target = this.dropdownButton.nativeElement;\n\t\t\tconst parent = this.elementRef.nativeElement;\n\t\t\tthis.visibilitySubscription = this.elementService\n\t\t\t\t.visibility(target, parent)\n\t\t\t\t.subscribe(value => {\n\t\t\t\t\tif (!value.visible) {\n\t\t\t\t\t\tthis.closeMenu();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\t// set the dropdown menu to drop up if it's near the bottom of the screen\n\t\t// setTimeout lets us measure after it's 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\n\t\t// we bind noop to document.body.firstElementChild to allow safari to fire events\n\t\t// from document. Then we unbind everything later to keep things light.\n\t\tdocument.body.firstElementChild.addEventListener(\"click\", this.noop, true);\n\t\tdocument.body.firstElementChild.addEventListener(\"keydown\", this.noop, true);\n\t\tdocument.addEventListener(\"click\", this.outsideClick, true);\n\t\tdocument.addEventListener(\"keydown\", this.outsideKey, true);\n\t\tsetTimeout(() => this.view.initFocus(), 0);\n\t}\n\n\t/**\n\t * Collapsing the dropdown menu and removing unnecessary `EventListeners`.\n\t */\n\tcloseMenu() {\n\t\t// return early if the menu is already closed\n\t\tif (this.menuIsClosed) { return; }\n\t\tthis.menuIsClosed = true;\n\t\tthis.checkForReorder();\n\t\tthis.onClose.emit();\n\t\tthis.close.emit();\n\n\t\t// focus the trigger button when we close ...\n\t\tthis.dropdownButton.nativeElement.focus();\n\n\t\t// remove the conditional once this api is settled and part of abstract-dropdown-view.class\n\t\tif (this.view[\"disableScroll\"]) {\n\t\t\tthis.view[\"disableScroll\"]();\n\t\t}\n\n\t\t// move the list back in the component on close\n\t\tif (!this.appendInline) {\n\t\t\tthis.visibilitySubscription.unsubscribe();\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t\tdocument.body.firstElementChild.removeEventListener(\"click\", this.noop, true);\n\t\tdocument.body.firstElementChild.removeEventListener(\"keydown\", this.noop, true);\n\t\tdocument.removeEventListener(\"click\", this.outsideClick, true);\n\t\tdocument.removeEventListener(\"keydown\", this.outsideKey, true);\n\t}\n\n\t/**\n\t * Controls toggling menu states between open/expanded and closed/collapsed.\n\t */\n\ttoggleMenu() {\n\t\tif (this.menuIsClosed) {\n\t\t\tthis.openMenu();\n\t\t} else {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tthis._isFocused = event.type === \"focus\";\n\t\tif (event.type === \"blur\") {\n\t\t\tthis.onBlur();\n\t\t}\n\t}\n\n\t/**\n\t * Controls when it's needed to apply the selection feedback\n\t */\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = this.menuIsClosed && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected();\n\t\t}\n\t}\n}\n",
|
|
33287
33398
|
"assetsDirs": [],
|
|
33288
33399
|
"styleUrlsData": "",
|
|
33289
33400
|
"stylesData": "",
|
|
@@ -33318,7 +33429,7 @@
|
|
|
33318
33429
|
"deprecationMessage": ""
|
|
33319
33430
|
}
|
|
33320
33431
|
],
|
|
33321
|
-
"line":
|
|
33432
|
+
"line": 399,
|
|
33322
33433
|
"rawdescription": "\n\nCreates an instance of Dropdown.\n",
|
|
33323
33434
|
"jsdoctags": [
|
|
33324
33435
|
{
|
|
@@ -33374,7 +33485,7 @@
|
|
|
33374
33485
|
"name": "fluidInvalidClass",
|
|
33375
33486
|
"type": "",
|
|
33376
33487
|
"returnType": "",
|
|
33377
|
-
"line":
|
|
33488
|
+
"line": 196
|
|
33378
33489
|
}
|
|
33379
33490
|
},
|
|
33380
33491
|
"fluidFocusClass": {
|
|
@@ -33383,7 +33494,7 @@
|
|
|
33383
33494
|
"name": "fluidFocusClass",
|
|
33384
33495
|
"type": "",
|
|
33385
33496
|
"returnType": "",
|
|
33386
|
-
"line":
|
|
33497
|
+
"line": 200
|
|
33387
33498
|
}
|
|
33388
33499
|
},
|
|
33389
33500
|
"hasDecorator": {
|
|
@@ -33392,14 +33503,14 @@
|
|
|
33392
33503
|
"name": "hasDecorator",
|
|
33393
33504
|
"type": "",
|
|
33394
33505
|
"returnType": "",
|
|
33395
|
-
"line":
|
|
33506
|
+
"line": 362
|
|
33396
33507
|
}
|
|
33397
33508
|
}
|
|
33398
33509
|
}
|
|
33399
33510
|
},
|
|
33400
33511
|
{
|
|
33401
33512
|
"name": "DropdownList",
|
|
33402
|
-
"id": "component-DropdownList-
|
|
33513
|
+
"id": "component-DropdownList-94f3bf70177862d120129d4920477ebd053b337114916c63546dff3586f8d1c7397a6c112defab77f84aac8636edfdf17681b7a33f6419a4aa46e0bae2ede828",
|
|
33403
33514
|
"file": "src/dropdown/list/dropdown-list.component.ts",
|
|
33404
33515
|
"encapsulation": [],
|
|
33405
33516
|
"entryComponents": [],
|
|
@@ -34106,7 +34217,7 @@
|
|
|
34106
34217
|
"args": [
|
|
34107
34218
|
{
|
|
34108
34219
|
"name": "items",
|
|
34109
|
-
"type": "",
|
|
34220
|
+
"type": "ListItem[]",
|
|
34110
34221
|
"deprecated": false,
|
|
34111
34222
|
"deprecationMessage": ""
|
|
34112
34223
|
}
|
|
@@ -34122,7 +34233,7 @@
|
|
|
34122
34233
|
"jsdoctags": [
|
|
34123
34234
|
{
|
|
34124
34235
|
"name": "items",
|
|
34125
|
-
"type": "",
|
|
34236
|
+
"type": "ListItem[]",
|
|
34126
34237
|
"deprecated": false,
|
|
34127
34238
|
"deprecationMessage": "",
|
|
34128
34239
|
"tagName": {
|
|
@@ -34141,7 +34252,7 @@
|
|
|
34141
34252
|
"description": "<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-dropdown-list [items]="listItems"></cds-dropdown-list></code></pre></div><b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">listItems = [\n {\n content: "item one",\n selected: false\n },\n {\n content: "item two",\n selected: false,\n },\n {\n content: "item three",\n selected: false\n },\n {\n content: "item four",\n selected: false\n }\n];</code></pre></div>",
|
|
34142
34253
|
"rawdescription": "\n\n```html\n<cds-dropdown-list [items]=\"listItems\"></cds-dropdown-list>\n```\n```typescript\nlistItems = [\n\t{\n\t\tcontent: \"item one\",\n\t\tselected: false\n\t},\n\t{\n\t\tcontent: \"item two\",\n\t\tselected: false,\n\t},\n\t{\n\t\tcontent: \"item three\",\n\t\tselected: false\n\t},\n\t{\n\t\tcontent: \"item four\",\n\t\tselected: false\n\t}\n];\n```\n",
|
|
34143
34254
|
"type": "component",
|
|
34144
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tOnDestroy,\n\tEventEmitter,\n\tTemplateRef,\n\tAfterViewInit,\n\tViewChild,\n\tElementRef,\n\tViewChildren,\n\tQueryList,\n\tApplicationRef\n} from \"@angular/core\";\nimport { Observable, isObservable, Subscription, of } from \"rxjs\";\nimport { first } from \"rxjs/operators\";\n\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { AbstractDropdownView } from \"../abstract-dropdown-view.class\";\nimport { ListItem } from \"../list-item.interface\";\nimport { watchFocusJump } from \"../dropdowntools\";\nimport { ScrollCustomEvent } from \"./scroll-custom-event.interface\";\n\n\n/**\n * ```html\n * <cds-dropdown-list [items]=\"listItems\"></cds-dropdown-list>\n * ```\n * ```typescript\n * listItems = [\n * \t{\n * \t\tcontent: \"item one\",\n * \t\tselected: false\n * \t},\n * \t{\n * \t\tcontent: \"item two\",\n * \t\tselected: false,\n * \t},\n * \t{\n * \t\tcontent: \"item three\",\n * \t\tselected: false\n * \t},\n * \t{\n * \t\tcontent: \"item four\",\n * \t\tselected: false\n * \t}\n * ];\n * ```\n */\n@Component({\n\tselector: \"cds-dropdown-list, ibm-dropdown-list\",\n\ttemplate: `\n\t\t<ul\n\t\t\t#list\n\t\t\t[id]=\"listId\"\n\t\t\trole=\"listbox\"\n\t\t\tclass=\"cds--list-box__menu cds--multi-select\"\n\t\t\t(scroll)=\"emitScroll($event)\"\n\t\t\t(keydown)=\"navigateList($event)\"\n\t\t\ttabindex=\"0\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t[attr.aria-activedescendant]=\"highlightedItem\">\n\t\t\t<li\n\t\t\t\trole=\"option\"\n\t\t\t\t*ngFor=\"let item of displayItems; let i = index\"\n\t\t\t\t(click)=\"doClick($event, item)\"\n\t\t\t\tclass=\"cds--list-box__menu-item\"\n\t\t\t\t[attr.aria-selected]=\"item.selected\"\n\t\t\t\t[id]=\"getItemId(i)\"\n\t\t\t\t[attr.tabindex]=\"highlightedItem === getItemId(i) ? 0 : null\"\n\t\t\t\t[attr.title]=\" showTitles ? item.content : null\"\n\t\t\t\t[attr.disabled]=\"item.disabled ? true : null\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--list-box__menu-item--active': item.selected,\n\t\t\t\t\t'cds--list-box__menu-item--highlighted': highlightedItem === getItemId(i)\n\t\t\t\t}\">\n\t\t\t\t<div\n\t\t\t\t\t#listItem\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\tclass=\"cds--list-box__menu-item__option\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"!listTpl && type === 'multi'\"\n\t\t\t\t\t\tclass=\"cds--form-item cds--checkbox-wrapper\">\n\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t[attr.data-contained-checkbox-state]=\"item.selected\"\n\t\t\t\t\t\t\tclass=\"cds--checkbox-label\">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclass=\"cds--checkbox\"\n\t\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\t\t[checked]=\"item.selected\"\n\t\t\t\t\t\t\t\t[disabled]=\"item.disabled\"\n\t\t\t\t\t\t\t\ttabindex=\"-1\">\n\t\t\t\t\t\t\t<span class=\"cds--checkbox-appearance\"></span>\n\t\t\t\t\t\t\t<span class=\"cds--checkbox-label-text\">{{item.content}}</span>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<ng-container *ngIf=\"!listTpl && type === 'single'\">{{item.content}}</ng-container>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!listTpl && type === 'single'\"\n\t\t\t\t\t\tcdsIcon=\"checkmark\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-item__selected-icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t*ngIf=\"listTpl\"\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{item: item}\"\n\t\t\t\t\t\t[ngTemplateOutlet]=\"listTpl\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t</ul>`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: AbstractDropdownView,\n\t\t\tuseExisting: DropdownList\n\t\t}\n\t]\n})\nexport class DropdownList implements AbstractDropdownView, AfterViewInit, OnDestroy {\n\tstatic listCount = 0;\n\t@Input() ariaLabel = this.i18n.get().DROPDOWN_LIST.LABEL;\n\t/**\n\t * The list items belonging to the `DropdownList`.\n\t */\n\t@Input() set items(value: Array<ListItem> | Observable<Array<ListItem>>) {\n\t\tif (isObservable(value)) {\n\t\t\tif (this._itemsSubscription) {\n\t\t\t\tthis._itemsSubscription.unsubscribe();\n\t\t\t}\n\t\t\tthis._itemsReady = new Observable<boolean>((observer) => {\n\t\t\t\tthis._itemsSubscription = value.subscribe(v => {\n\t\t\t\t\tthis.updateList(v);\n\t\t\t\t\tobserver.next(true);\n\t\t\t\t\tobserver.complete();\n\t\t\t\t});\n\t\t\t});\n\t\t\tthis.onItemsReady(null);\n\t\t} else {\n\t\t\tthis.updateList(value);\n\t\t}\n\t\tthis._originalItems = value;\n\t}\n\n\tget items(): Array<ListItem> | Observable<Array<ListItem>> {\n\t\treturn this._originalItems;\n\t}\n\t/**\n\t * Template to bind to items in the `DropdownList` (optional).\n\t */\n\t@Input() listTpl: string | TemplateRef<any> = null;\n\t/**\n\t * Event to emit selection of a list item within the `DropdownList`.\n\t */\n\t@Output() select: EventEmitter<{ item: ListItem, isUpdate?: boolean } | ListItem[]> = new EventEmitter();\n\t/**\n\t * Event to emit scroll event of a list within the `DropdownList`.\n\t */\n\t@Output() scroll: EventEmitter<ScrollCustomEvent> = new EventEmitter();\n\t/**\n\t * Event to suggest a blur on the view.\n\t * Emits _after_ the first/last item has been focused.\n\t * ex.\n\t * ArrowUp -> focus first item\n\t * ArrowUp -> emit event\n\t *\n\t * When this event fires focus should be placed on some element outside of the list - blurring the list as a result\n\t */\n\t@Output() blurIntent = new EventEmitter<\"top\" | \"bottom\">();\n\t/**\n\t * Maintains a reference to the view DOM element for the unordered list of items within the `DropdownList`.\n\t */\n\t@ViewChild(\"list\", { static: true }) list: ElementRef;\n\t/**\n\t * Defines whether or not the `DropdownList` supports selecting multiple items as opposed to single\n\t * item selection.\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\n\t/**\n\t * Defines whether to show title attribute or not\n\t */\n\t@Input() showTitles = true;\n\n\t/**\n\t * Defines the rendering size of the `DropdownList` input component.\n\t */\n\tpublic size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\tpublic listId = `listbox-${DropdownList.listCount++}`;\n\tpublic highlightedItem = null;\n\t/**\n\t * Holds the list of items that will be displayed in the `DropdownList`.\n\t * It differs from the the complete set of items when filtering is used (but\n\t * it is always a subset of the total items in `DropdownList`).\n\t */\n\tpublic displayItems: Array<ListItem> = [];\n\t/**\n\t * Maintains the index for the selected item within the `DropdownList`.\n\t */\n\tprotected index = -1;\n\t/**\n\t * An array holding the HTML list elements in the view.\n\t */\n\t@ViewChildren(\"listItem\") protected listElementList: QueryList<ElementRef>;\n\t/**\n\t * Observable bound to keydown events to control filtering.\n\t */\n\tprotected focusJump;\n\t/**\n\t * Tracks the current (if any) subscription to the items observable so we can clean up when the input is updated.\n\t */\n\tprotected _itemsSubscription: Subscription;\n\t/**\n\t * Used to retain the original items passed to the setter.\n\t */\n\tprotected _originalItems: Array<ListItem> | Observable<Array<ListItem>>;\n\t/**\n\t * Useful representation of the items, should be accessed via `getListItems`.\n\t */\n\tprotected _items: Array<ListItem> = [];\n\t/**\n\t * Used to wait for items in case they are passed through an observable.\n\t */\n\tprotected _itemsReady: Observable<boolean>;\n\n\t/**\n\t * Creates an instance of `DropdownList`.\n\t */\n\tconstructor(public elementRef: ElementRef, protected i18n: I18n, protected appRef: ApplicationRef) {}\n\n\t/**\n\t * Retrieves array of list items and index of the selected item after view has rendered.\n\t * Additionally, any Observables for the `DropdownList` are initialized.\n\t */\n\tngAfterViewInit() {\n\t\tthis.index = this.getListItems().findIndex(item => item.selected);\n\t\tthis.setupFocusObservable();\n\t\tsetTimeout(() => {\n\t\t\tthis.doEmitSelect(true);\n\t\t});\n\t}\n\n\t/**\n\t * Removes any Observables on destruction of the component.\n\t */\n\tngOnDestroy() {\n\t\tif (this.focusJump) {\n\t\t\tthis.focusJump.unsubscribe();\n\t\t}\n\t\tif (this._itemsSubscription) {\n\t\t\tthis._itemsSubscription.unsubscribe();\n\t\t}\n\t}\n\n\tdoEmitSelect(isUpdate = true) {\n\t\tif (this.type === \"single\") {\n\t\t\tthis.select.emit({ item: this._items.find(item => item.selected), isUpdate: isUpdate });\n\t\t} else {\n\t\t\t// abuse javascripts object mutability until we can break the API and switch to\n\t\t\t// { items: [], isUpdate: true }\n\t\t\tconst selected = this.getSelected() || [];\n\t\t\tselected[\"isUpdate\"] = isUpdate;\n\t\t\tthis.select.emit(selected);\n\t\t}\n\t}\n\n\tgetItemId(index: number) {\n\t\treturn `${this.listId}-${index}`;\n\t}\n\n\t/**\n\t * Updates the displayed list of items and then retrieves the most current properties for the `DropdownList` from the DOM.\n\t */\n\tupdateList(items) {\n\t\tthis._items = items.map(item => Object.assign({}, item));\n\t\tthis.displayItems = this._items;\n\t\tthis.updateIndex();\n\t\tthis.setupFocusObservable();\n\t\tthis.doEmitSelect();\n\t}\n\n\t/**\n\t * Filters the items being displayed in the DOM list.\n\t */\n\tfilterBy(query = \"\") {\n\t\tif (query) {\n\t\t\tthis.displayItems = this.getListItems().filter(item => item.content.toLowerCase().includes(query.toLowerCase()));\n\t\t\t// Reset index if items were found\n\t\t\t// Prevent selecting index in list that are undefined.\n\t\t\tif (this.displayItems) {\n\t\t\t\tthis.index = 0;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.displayItems = this.getListItems();\n\t\t}\n\n\t\tthis.updateIndex();\n\t}\n\n\t/**\n\t * Initializes (or re-initializes) the Observable that handles switching focus to an element based on\n\t * key input matching the first letter of the item in the list.\n\t */\n\tsetupFocusObservable() {\n\t\tif (!this.list) { return; }\n\t\tif (this.focusJump) {\n\t\t\tthis.focusJump.unsubscribe();\n\t\t}\n\t\tlet elList = Array.from(this.list.nativeElement.querySelectorAll(\"li\"));\n\t\tthis.focusJump = watchFocusJump(this.list.nativeElement, elList)\n\t\t\t.subscribe(el => {\n\t\t\t\tel.focus();\n\t\t\t});\n\t}\n\n\t/**\n\t * Returns the `ListItem` that is subsequent to the selected item in the `DropdownList`.\n\t */\n\tgetNextItem(): ListItem {\n\t\tif (this.index < this.displayItems.length - 1) {\n\t\t\tthis.index++;\n\t\t}\n\t\treturn this.displayItems[this.index];\n\t}\n\n\t/**\n\t * Returns `true` if the selected item is not the last item in the `DropdownList`.\n\t */\n\thasNextElement(): boolean {\n\t\treturn this.index < this.displayItems.length - 1 &&\n\t\t\t(!(this.index === this.displayItems.length - 2) || !this.displayItems[this.index + 1].disabled);\n\t}\n\n\t/**\n\t * Returns the `HTMLElement` for the item that is subsequent to the selected item.\n\t */\n\tgetNextElement(): HTMLElement {\n\t\t// Only return native elements if they are rendered\n\t\tconst elemList = this.listElementList ? this.listElementList.toArray() : [];\n\t\tif (!elemList.length) {\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Start checking from next index\n\t\t * Continue looping through the list until a non disabeled element is found or\n\t\t * end of list is reached\n\t\t */\n\t\tfor (let i = this.index + 1; i < elemList.length; i++) {\n\t\t\t// If the values in the list are not disabled\n\t\t\tif (!this.displayItems[i].disabled) {\n\t\t\t\tthis.index = i;\n\t\t\t\treturn elemList[i].nativeElement;\n\t\t\t}\n\t\t}\n\n\t\treturn elemList[this.index]?.nativeElement;\n\t}\n\n\t/**\n\t * Returns the `ListItem` that precedes the selected item within `DropdownList`.\n\t */\n\tgetPrevItem(): ListItem {\n\t\tif (this.index > 0) {\n\t\t\tthis.index--;\n\t\t}\n\t\treturn this.displayItems[this.index];\n\t}\n\n\t/**\n\t * Returns `true` if the selected item is not the first in the list.\n\t */\n\thasPrevElement(): boolean {\n\t\treturn this.index > 0 && (!(this.index === 1) || !this.displayItems[0].disabled);\n\t}\n\n\t/**\n\t * Returns the `HTMLElement` for the item that precedes the selected item.\n\t */\n\tgetPrevElement(): HTMLElement {\n\t\t// Only return native elements if they are rendered\n\t\tconst elemList = this.listElementList ? this.listElementList.toArray() : [];\n\t\tif (!elemList.length) {\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Start checking from next index\n\t\t * Continue looping through the list until a non disabeled element is found or\n\t\t * end of list is reached\n\t\t */\n\t\tfor (let i = this.index - 1; i < this.index && i >= 0; i--) {\n\t\t\t// If the values in the list are not disabled\n\t\t\tif (!this.displayItems[i].disabled) {\n\t\t\t\tthis.index = i;\n\t\t\t\treturn elemList[i].nativeElement;\n\t\t\t}\n\t\t}\n\n\t\treturn elemList[this.index].nativeElement;\n\t}\n\n\t/**\n\t * Returns the `ListItem` that is selected within `DropdownList`.\n\t */\n\tgetCurrentItem(): ListItem {\n\t\tif (this.index < 0) {\n\t\t\treturn this.displayItems[0];\n\t\t}\n\t\treturn this.displayItems[this.index];\n\t}\n\n\t/**\n\t * Returns the `HTMLElement` for the item that is selected within the `DropdownList`.\n\t */\n\tgetCurrentElement(): HTMLElement {\n\t\tif (this.index < 0) {\n\t\t\treturn this.listElementList.first.nativeElement;\n\t\t}\n\t\treturn this.listElementList.toArray()[this.index].nativeElement;\n\t}\n\n\t/**\n\t * Returns the items as an Array\n\t */\n\tgetListItems(): Array<ListItem> {\n\t\treturn this._items;\n\t}\n\n\t/**\n\t * Returns a list containing the selected item(s) in the `DropdownList`.\n\t */\n\tgetSelected(): ListItem[] {\n\t\tlet selected = this.getListItems().filter(item => item.selected);\n\t\tif (selected.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\treturn selected;\n\t}\n\n\t/**\n\t * Transforms array input list of items to the correct state by updating the selected item(s).\n\t */\n\tpropagateSelected(value: Array<ListItem>): void {\n\t\t// if we get a non-array, log out an error (since it is one)\n\t\tif (!Array.isArray(value)) {\n\t\t\tconsole.error(`${this.constructor.name}.propagateSelected expects an Array<ListItem>, got ${JSON.stringify(value)}`);\n\t\t}\n\t\tthis.onItemsReady(() => {\n\t\t\tconst selectedNewItems = [];\n\t\t\tfor (let newItem of value) {\n\t\t\t\tif (newItem && newItem.selected) {\n\t\t\t\t\t// copy the item\n\t\t\t\t\tlet tempNewItem: string | ListItem = Object.assign({}, newItem);\n\t\t\t\t\t// deleted selected because it's what we _want_ to change\n\t\t\t\t\tdelete tempNewItem.selected;\n\t\t\t\t\t// stringify for compare later\n\t\t\t\t\ttempNewItem = JSON.stringify(tempNewItem);\n\t\t\t\t\t// add to the list of selected items\n\t\t\t\t\tselectedNewItems.push(tempNewItem);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// loop through the list items and update the `selected` state for matching items in `value`\n\t\t\tfor (let oldItem of this.getListItems()) {\n\t\t\t\t// fast path when no items are selected\n\t\t\t\tif (selectedNewItems.length === 0) {\n\t\t\t\t\toldItem.selected = false;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// copy the item\n\t\t\t\tlet tempOldItem: string | ListItem = Object.assign({}, oldItem);\n\t\t\t\t// deleted selected because it's what we _want_ to change\n\t\t\t\tdelete tempOldItem.selected;\n\t\t\t\t// stringify for compare\n\t\t\t\ttempOldItem = JSON.stringify(tempOldItem);\n\t\t\t\tfor (let selectedNewItem of selectedNewItems) {\n\t\t\t\t\t// do the compare\n\t\t\t\t\tif (tempOldItem.includes(selectedNewItem)) {\n\t\t\t\t\t\toldItem.selected = true;\n\t\t\t\t\t\t// if we've found a matching item, we can stop looping\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\toldItem.selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Initializes focus in the list, effectively a wrapper for `getCurrentElement().focus()`\n\t */\n\tinitFocus() {\n\t\tif (this.index < 0) {\n\t\t\tthis.updateIndex();\n\t\t}\n\n\t\tthis.list.nativeElement.focus();\n\t\tsetTimeout(() => {\n\t\t\tthis.highlightedItem = this.getItemId(this.index);\n\t\t});\n\t}\n\n\tupdateIndex() {\n\t\t// initialize index on the first selected item or\n\t\t// on the next non disabled item if no items are selected\n\t\t// in case, if all items are disabled, the index value will remain same\n\t\tconst selected = this.getSelected();\n\t\tif (selected.length) {\n\t\t\tthis.index = this.displayItems.indexOf(selected[0]);\n\t\t} else if (this.index < 0 && this.hasNextElement()) {\n\t\t\tthis.getNextElement();\n\t\t}\n\t}\n\n\t/**\n\t * Manages the keyboard accessibility for navigation and selection within a `DropdownList`.\n\t */\n\tnavigateList(event: KeyboardEvent) {\n\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\tif (this.listElementList.some(option => option.nativeElement === event.target)) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t\tif (event.key === \"Enter\") {\n\t\t\t\tthis.doClick(event, this.getCurrentItem());\n\t\t\t}\n\t\t} else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n\t\t\tevent.preventDefault();\n\t\t\tif (event.key === \"ArrowDown\") {\n\t\t\t\tif (this.hasNextElement()) {\n\t\t\t\t\tthis.getNextElement()?.scrollIntoView({ block: \"end\" });\n\t\t\t\t} else {\n\t\t\t\t\tthis.blurIntent.emit(\"bottom\");\n\t\t\t\t}\n\t\t\t} else if (event.key === \"ArrowUp\") {\n\t\t\t\tif (this.hasPrevElement()) {\n\t\t\t\t\tthis.getPrevElement().scrollIntoView({ block: \"nearest\" });\n\t\t\t\t} else {\n\t\t\t\t\tthis.blurIntent.emit(\"top\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.highlightedItem = this.getItemId(this.index);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Emits the selected item or items after a mouse click event has occurred.\n\t */\n\tdoClick(event, item) {\n\t\tevent.preventDefault();\n\t\tif (item && !item.disabled) {\n\t\t\tthis.list.nativeElement.focus();\n\t\t\tif (this.type === \"single\") {\n\t\t\t\titem.selected = true;\n\t\t\t\t// reset the selection\n\t\t\t\tfor (let otherItem of this.getListItems()) {\n\t\t\t\t\tif (item !== otherItem) { otherItem.selected = false; }\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem.selected = !item.selected;\n\t\t\t}\n\t\t\tthis.index = this.displayItems.indexOf(item);\n\t\t\tthis.highlightedItem = this.getItemId(this.index);\n\t\t\tthis.doEmitSelect(false);\n\t\t\tthis.appRef.tick();\n\t\t}\n\t}\n\n\tonItemFocus(index) {\n\t\tconst element = this.listElementList.toArray()[index].nativeElement;\n\t\telement.classList.add(\"cds--list-box__menu-item--highlighted\");\n\t\telement.tabIndex = 0;\n\t}\n\n\tonItemBlur(index) {\n\t\tconst element = this.listElementList.toArray()[index].nativeElement;\n\t\telement.classList.remove(\"cds--list-box__menu-item--highlighted\");\n\t\telement.tabIndex = -1;\n\t}\n\n\t/**\n\t * Emits the scroll event of the options list\n\t */\n\temitScroll(event) {\n\t\tconst atTop: boolean = event.srcElement.scrollTop === 0;\n\t\tconst atBottom: boolean = event.srcElement.scrollHeight - event.srcElement.scrollTop === event.srcElement.clientHeight;\n\t\tconst customScrollEvent = { atTop, atBottom, event };\n\t\tthis.scroll.emit(customScrollEvent);\n\t}\n\n\t/**\n\t * Subscribe the function passed to an internal observable that will resolve once the items are ready\n\t */\n\tonItemsReady(subcription: () => void): void {\n\t\t// this subscription will auto unsubscribe because of the `first()` pipe\n\t\t(this._itemsReady || of(true)).pipe(first()).subscribe(subcription);\n\t}\n\n\treorderSelected(moveFocus = true): void {\n\t\tthis.displayItems = [...this.getSelected(), ...this.getListItems().filter(item => !item.selected)];\n\t\tif (moveFocus) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.updateIndex();\n\t\t\t\tthis.highlightedItem = this.getItemId(this.index);\n\t\t\t});\n\t\t}\n\t}\n}\n",
|
|
34255
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tOnDestroy,\n\tEventEmitter,\n\tTemplateRef,\n\tAfterViewInit,\n\tViewChild,\n\tElementRef,\n\tViewChildren,\n\tQueryList,\n\tApplicationRef\n} from \"@angular/core\";\nimport { Observable, isObservable, Subscription, of } from \"rxjs\";\nimport { first } from \"rxjs/operators\";\n\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { AbstractDropdownView } from \"../abstract-dropdown-view.class\";\nimport { ListItem } from \"../list-item.interface\";\nimport { watchFocusJump } from \"../dropdowntools\";\nimport { ScrollCustomEvent } from \"./scroll-custom-event.interface\";\n\n\n/**\n * ```html\n * <cds-dropdown-list [items]=\"listItems\"></cds-dropdown-list>\n * ```\n * ```typescript\n * listItems = [\n * \t{\n * \t\tcontent: \"item one\",\n * \t\tselected: false\n * \t},\n * \t{\n * \t\tcontent: \"item two\",\n * \t\tselected: false,\n * \t},\n * \t{\n * \t\tcontent: \"item three\",\n * \t\tselected: false\n * \t},\n * \t{\n * \t\tcontent: \"item four\",\n * \t\tselected: false\n * \t}\n * ];\n * ```\n */\n@Component({\n\tselector: \"cds-dropdown-list, ibm-dropdown-list\",\n\ttemplate: `\n\t\t<ul\n\t\t\t#list\n\t\t\t[id]=\"listId\"\n\t\t\trole=\"listbox\"\n\t\t\tclass=\"cds--list-box__menu cds--multi-select\"\n\t\t\t(scroll)=\"emitScroll($event)\"\n\t\t\t(keydown)=\"navigateList($event)\"\n\t\t\ttabindex=\"0\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t[attr.aria-activedescendant]=\"highlightedItem\">\n\t\t\t<li\n\t\t\t\trole=\"option\"\n\t\t\t\t*ngFor=\"let item of displayItems; let i = index\"\n\t\t\t\t(click)=\"doClick($event, item)\"\n\t\t\t\tclass=\"cds--list-box__menu-item\"\n\t\t\t\t[attr.aria-selected]=\"item.selected\"\n\t\t\t\t[id]=\"getItemId(i)\"\n\t\t\t\t[attr.tabindex]=\"highlightedItem === getItemId(i) ? 0 : null\"\n\t\t\t\t[attr.title]=\" showTitles ? item.content : null\"\n\t\t\t\t[attr.disabled]=\"item.disabled ? true : null\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--list-box__menu-item--active': item.selected,\n\t\t\t\t\t'cds--list-box__menu-item--highlighted': highlightedItem === getItemId(i)\n\t\t\t\t}\">\n\t\t\t\t<div\n\t\t\t\t\t#listItem\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\tclass=\"cds--list-box__menu-item__option\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"!listTpl && type === 'multi'\"\n\t\t\t\t\t\tclass=\"cds--form-item cds--checkbox-wrapper\">\n\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t[attr.data-contained-checkbox-state]=\"item.selected\"\n\t\t\t\t\t\t\tclass=\"cds--checkbox-label\">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclass=\"cds--checkbox\"\n\t\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\t\t[checked]=\"item.selected\"\n\t\t\t\t\t\t\t\t[disabled]=\"item.disabled\"\n\t\t\t\t\t\t\t\ttabindex=\"-1\">\n\t\t\t\t\t\t\t<span class=\"cds--checkbox-appearance\"></span>\n\t\t\t\t\t\t\t<span class=\"cds--checkbox-label-text\">{{item.content}}</span>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<ng-container *ngIf=\"!listTpl && type === 'single'\">{{item.content}}</ng-container>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!listTpl && type === 'single'\"\n\t\t\t\t\t\tcdsIcon=\"checkmark\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-item__selected-icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<ng-template\n\t\t\t\t\t\t*ngIf=\"listTpl\"\n\t\t\t\t\t\t[ngTemplateOutletContext]=\"{item: item}\"\n\t\t\t\t\t\t[ngTemplateOutlet]=\"listTpl\">\n\t\t\t\t\t</ng-template>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t</ul>`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: AbstractDropdownView,\n\t\t\tuseExisting: DropdownList\n\t\t}\n\t]\n})\nexport class DropdownList implements AbstractDropdownView, AfterViewInit, OnDestroy {\n\tstatic listCount = 0;\n\t@Input() ariaLabel = this.i18n.get().DROPDOWN_LIST.LABEL;\n\t/**\n\t * The list items belonging to the `DropdownList`.\n\t */\n\t@Input() set items(value: Array<ListItem> | Observable<Array<ListItem>>) {\n\t\tif (isObservable(value)) {\n\t\t\tif (this._itemsSubscription) {\n\t\t\t\tthis._itemsSubscription.unsubscribe();\n\t\t\t}\n\t\t\tthis._itemsReady = new Observable<boolean>((observer) => {\n\t\t\t\tthis._itemsSubscription = value.subscribe(v => {\n\t\t\t\t\tthis.updateList(v);\n\t\t\t\t\tobserver.next(true);\n\t\t\t\t\tobserver.complete();\n\t\t\t\t});\n\t\t\t});\n\t\t\tthis.onItemsReady(null);\n\t\t} else {\n\t\t\tthis.updateList(value);\n\t\t}\n\t\tthis._originalItems = value;\n\t}\n\n\tget items(): Array<ListItem> | Observable<Array<ListItem>> {\n\t\treturn this._originalItems;\n\t}\n\t/**\n\t * Template to bind to items in the `DropdownList` (optional).\n\t */\n\t@Input() listTpl: string | TemplateRef<any> = null;\n\t/**\n\t * Event to emit selection of a list item within the `DropdownList`.\n\t */\n\t@Output() select: EventEmitter<{ item: ListItem, isUpdate?: boolean } | ListItem[]> = new EventEmitter();\n\t/**\n\t * Event to emit scroll event of a list within the `DropdownList`.\n\t */\n\t@Output() scroll: EventEmitter<ScrollCustomEvent> = new EventEmitter();\n\t/**\n\t * Event to suggest a blur on the view.\n\t * Emits _after_ the first/last item has been focused.\n\t * ex.\n\t * ArrowUp -> focus first item\n\t * ArrowUp -> emit event\n\t *\n\t * When this event fires focus should be placed on some element outside of the list - blurring the list as a result\n\t */\n\t@Output() blurIntent = new EventEmitter<\"top\" | \"bottom\">();\n\t/**\n\t * Maintains a reference to the view DOM element for the unordered list of items within the `DropdownList`.\n\t */\n\t@ViewChild(\"list\", { static: true }) list: ElementRef;\n\t/**\n\t * Defines whether or not the `DropdownList` supports selecting multiple items as opposed to single\n\t * item selection.\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\n\t/**\n\t * Defines whether to show title attribute or not\n\t */\n\t@Input() showTitles = true;\n\n\t/**\n\t * Defines the rendering size of the `DropdownList` input component.\n\t */\n\tpublic size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\tpublic listId = `listbox-${DropdownList.listCount++}`;\n\tpublic highlightedItem = null;\n\t/**\n\t * Holds the list of items that will be displayed in the `DropdownList`.\n\t * It differs from the the complete set of items when filtering is used (but\n\t * it is always a subset of the total items in `DropdownList`).\n\t */\n\tpublic displayItems: Array<ListItem> = [];\n\t/**\n\t * Maintains the index for the selected item within the `DropdownList`.\n\t */\n\tprotected index = -1;\n\t/**\n\t * An array holding the HTML list elements in the view.\n\t */\n\t@ViewChildren(\"listItem\") protected listElementList: QueryList<ElementRef>;\n\t/**\n\t * Observable bound to keydown events to control filtering.\n\t */\n\tprotected focusJump;\n\t/**\n\t * Tracks the current (if any) subscription to the items observable so we can clean up when the input is updated.\n\t */\n\tprotected _itemsSubscription: Subscription;\n\t/**\n\t * Used to retain the original items passed to the setter.\n\t */\n\tprotected _originalItems: Array<ListItem> | Observable<Array<ListItem>>;\n\t/**\n\t * Useful representation of the items, should be accessed via `getListItems`.\n\t */\n\tprotected _items: Array<ListItem> = [];\n\t/**\n\t * Used to wait for items in case they are passed through an observable.\n\t */\n\tprotected _itemsReady: Observable<boolean>;\n\n\t/**\n\t * Creates an instance of `DropdownList`.\n\t */\n\tconstructor(public elementRef: ElementRef, protected i18n: I18n, protected appRef: ApplicationRef) {}\n\n\t/**\n\t * Retrieves array of list items and index of the selected item after view has rendered.\n\t * Additionally, any Observables for the `DropdownList` are initialized.\n\t */\n\tngAfterViewInit() {\n\t\tthis.index = this.getListItems().findIndex(item => item.selected);\n\t\tthis.setupFocusObservable();\n\t\tsetTimeout(() => {\n\t\t\tthis.doEmitSelect(true);\n\t\t});\n\t}\n\n\t/**\n\t * Removes any Observables on destruction of the component.\n\t */\n\tngOnDestroy() {\n\t\tif (this.focusJump) {\n\t\t\tthis.focusJump.unsubscribe();\n\t\t}\n\t\tif (this._itemsSubscription) {\n\t\t\tthis._itemsSubscription.unsubscribe();\n\t\t}\n\t}\n\n\tdoEmitSelect(isUpdate = true) {\n\t\tif (this.type === \"single\") {\n\t\t\tthis.select.emit({ item: this._items.find(item => item.selected), isUpdate: isUpdate });\n\t\t} else {\n\t\t\t// abuse javascripts object mutability until we can break the API and switch to\n\t\t\t// { items: [], isUpdate: true }\n\t\t\tconst selected = this.getSelected() || [];\n\t\t\tselected[\"isUpdate\"] = isUpdate;\n\t\t\tthis.select.emit(selected);\n\t\t}\n\t}\n\n\tgetItemId(index: number) {\n\t\treturn `${this.listId}-${index}`;\n\t}\n\n\t/**\n\t * Updates the displayed list of items and then retrieves the most current properties for the `DropdownList` from the DOM.\n\t */\n\tupdateList(items: ListItem[]) {\n\t\tthis._items = items.map(item => Object.assign({}, item));\n\t\tthis.displayItems = this._items;\n\t\tthis.updateIndex();\n\t\tthis.setupFocusObservable();\n\t\tthis.doEmitSelect();\n\t}\n\n\t/**\n\t * Filters the items being displayed in the DOM list.\n\t */\n\tfilterBy(query = \"\") {\n\t\tif (query) {\n\t\t\tthis.displayItems = this.getListItems().filter(item => item.content.toLowerCase().includes(query.toLowerCase()));\n\t\t\t// Reset index if items were found\n\t\t\t// Prevent selecting index in list that are undefined.\n\t\t\tif (this.displayItems) {\n\t\t\t\tthis.index = 0;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.displayItems = this.getListItems();\n\t\t}\n\n\t\tthis.updateIndex();\n\t}\n\n\t/**\n\t * Initializes (or re-initializes) the Observable that handles switching focus to an element based on\n\t * key input matching the first letter of the item in the list.\n\t */\n\tsetupFocusObservable() {\n\t\tif (!this.list) { return; }\n\t\tif (this.focusJump) {\n\t\t\tthis.focusJump.unsubscribe();\n\t\t}\n\t\tlet elList = Array.from(this.list.nativeElement.querySelectorAll(\"li\"));\n\t\tthis.focusJump = watchFocusJump(this.list.nativeElement, elList)\n\t\t\t.subscribe(el => {\n\t\t\t\tel.focus();\n\t\t\t});\n\t}\n\n\t/**\n\t * Returns the `ListItem` that is subsequent to the selected item in the `DropdownList`.\n\t */\n\tgetNextItem(): ListItem {\n\t\tif (this.index < this.displayItems.length - 1) {\n\t\t\tthis.index++;\n\t\t}\n\t\treturn this.displayItems[this.index];\n\t}\n\n\t/**\n\t * Returns `true` if the selected item is not the last item in the `DropdownList`.\n\t */\n\thasNextElement(): boolean {\n\t\treturn this.index < this.displayItems.length - 1 &&\n\t\t\t(!(this.index === this.displayItems.length - 2) || !this.displayItems[this.index + 1].disabled);\n\t}\n\n\t/**\n\t * Returns the `HTMLElement` for the item that is subsequent to the selected item.\n\t */\n\tgetNextElement(): HTMLElement {\n\t\t// Only return native elements if they are rendered\n\t\tconst elemList = this.listElementList ? this.listElementList.toArray() : [];\n\t\tif (!elemList.length) {\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Start checking from next index\n\t\t * Continue looping through the list until a non disabeled element is found or\n\t\t * end of list is reached\n\t\t */\n\t\tfor (let i = this.index + 1; i < elemList.length; i++) {\n\t\t\t// If the values in the list are not disabled\n\t\t\tif (!this.displayItems[i].disabled) {\n\t\t\t\tthis.index = i;\n\t\t\t\treturn elemList[i].nativeElement;\n\t\t\t}\n\t\t}\n\n\t\treturn elemList[this.index]?.nativeElement;\n\t}\n\n\t/**\n\t * Returns the `ListItem` that precedes the selected item within `DropdownList`.\n\t */\n\tgetPrevItem(): ListItem {\n\t\tif (this.index > 0) {\n\t\t\tthis.index--;\n\t\t}\n\t\treturn this.displayItems[this.index];\n\t}\n\n\t/**\n\t * Returns `true` if the selected item is not the first in the list.\n\t */\n\thasPrevElement(): boolean {\n\t\treturn this.index > 0 && (!(this.index === 1) || !this.displayItems[0].disabled);\n\t}\n\n\t/**\n\t * Returns the `HTMLElement` for the item that precedes the selected item.\n\t */\n\tgetPrevElement(): HTMLElement {\n\t\t// Only return native elements if they are rendered\n\t\tconst elemList = this.listElementList ? this.listElementList.toArray() : [];\n\t\tif (!elemList.length) {\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Start checking from next index\n\t\t * Continue looping through the list until a non disabeled element is found or\n\t\t * end of list is reached\n\t\t */\n\t\tfor (let i = this.index - 1; i < this.index && i >= 0; i--) {\n\t\t\t// If the values in the list are not disabled\n\t\t\tif (!this.displayItems[i].disabled) {\n\t\t\t\tthis.index = i;\n\t\t\t\treturn elemList[i].nativeElement;\n\t\t\t}\n\t\t}\n\n\t\treturn elemList[this.index].nativeElement;\n\t}\n\n\t/**\n\t * Returns the `ListItem` that is selected within `DropdownList`.\n\t */\n\tgetCurrentItem(): ListItem {\n\t\tif (this.index < 0) {\n\t\t\treturn this.displayItems[0];\n\t\t}\n\t\treturn this.displayItems[this.index];\n\t}\n\n\t/**\n\t * Returns the `HTMLElement` for the item that is selected within the `DropdownList`.\n\t */\n\tgetCurrentElement(): HTMLElement {\n\t\tif (this.index < 0) {\n\t\t\treturn this.listElementList.first.nativeElement;\n\t\t}\n\t\treturn this.listElementList.toArray()[this.index].nativeElement;\n\t}\n\n\t/**\n\t * Returns the items as an Array\n\t */\n\tgetListItems(): Array<ListItem> {\n\t\treturn this._items;\n\t}\n\n\t/**\n\t * Returns a list containing the selected item(s) in the `DropdownList`.\n\t */\n\tgetSelected(): ListItem[] {\n\t\tlet selected = this.getListItems().filter(item => item.selected);\n\t\tif (selected.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\treturn selected;\n\t}\n\n\t/**\n\t * Transforms array input list of items to the correct state by updating the selected item(s).\n\t */\n\tpropagateSelected(value: Array<ListItem>): void {\n\t\t// if we get a non-array, log out an error (since it is one)\n\t\tif (!Array.isArray(value)) {\n\t\t\tconsole.error(`${this.constructor.name}.propagateSelected expects an Array<ListItem>, got ${JSON.stringify(value)}`);\n\t\t}\n\t\tthis.onItemsReady(() => {\n\t\t\tconst selectedNewItems = [];\n\t\t\tfor (let newItem of value) {\n\t\t\t\tif (newItem && newItem.selected) {\n\t\t\t\t\t// copy the item\n\t\t\t\t\tlet tempNewItem: string | ListItem = Object.assign({}, newItem);\n\t\t\t\t\t// deleted selected because it's what we _want_ to change\n\t\t\t\t\tdelete tempNewItem.selected;\n\t\t\t\t\t// stringify for compare later\n\t\t\t\t\ttempNewItem = JSON.stringify(tempNewItem);\n\t\t\t\t\t// add to the list of selected items\n\t\t\t\t\tselectedNewItems.push(tempNewItem);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// loop through the list items and update the `selected` state for matching items in `value`\n\t\t\tfor (let oldItem of this.getListItems()) {\n\t\t\t\t// fast path when no items are selected\n\t\t\t\tif (selectedNewItems.length === 0) {\n\t\t\t\t\toldItem.selected = false;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// copy the item\n\t\t\t\tlet tempOldItem: string | ListItem = Object.assign({}, oldItem);\n\t\t\t\t// deleted selected because it's what we _want_ to change\n\t\t\t\tdelete tempOldItem.selected;\n\t\t\t\t// stringify for compare\n\t\t\t\ttempOldItem = JSON.stringify(tempOldItem);\n\t\t\t\tfor (let selectedNewItem of selectedNewItems) {\n\t\t\t\t\t// do the compare\n\t\t\t\t\tif (tempOldItem.includes(selectedNewItem)) {\n\t\t\t\t\t\toldItem.selected = true;\n\t\t\t\t\t\t// if we've found a matching item, we can stop looping\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\toldItem.selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Initializes focus in the list, effectively a wrapper for `getCurrentElement().focus()`\n\t */\n\tinitFocus() {\n\t\tif (this.index < 0) {\n\t\t\tthis.updateIndex();\n\t\t}\n\n\t\tthis.list.nativeElement.focus();\n\t\tsetTimeout(() => {\n\t\t\tthis.highlightedItem = this.getItemId(this.index);\n\t\t});\n\t}\n\n\tupdateIndex() {\n\t\t// initialize index on the first selected item or\n\t\t// on the next non disabled item if no items are selected\n\t\t// in case, if all items are disabled, the index value will remain same\n\t\tconst selected = this.getSelected();\n\t\tif (selected.length) {\n\t\t\tthis.index = this.displayItems.indexOf(selected[0]);\n\t\t} else if (this.index < 0 && this.hasNextElement()) {\n\t\t\tthis.getNextElement();\n\t\t}\n\t}\n\n\t/**\n\t * Manages the keyboard accessibility for navigation and selection within a `DropdownList`.\n\t */\n\tnavigateList(event: KeyboardEvent) {\n\t\tif (event.key === \"Enter\" || event.key === \" \") {\n\t\t\tif (this.listElementList.some(option => option.nativeElement === event.target)) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t\tif (event.key === \"Enter\") {\n\t\t\t\tthis.doClick(event, this.getCurrentItem());\n\t\t\t}\n\t\t} else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n\t\t\tevent.preventDefault();\n\t\t\tif (event.key === \"ArrowDown\") {\n\t\t\t\tif (this.hasNextElement()) {\n\t\t\t\t\tthis.getNextElement()?.scrollIntoView({ block: \"end\" });\n\t\t\t\t} else {\n\t\t\t\t\tthis.blurIntent.emit(\"bottom\");\n\t\t\t\t}\n\t\t\t} else if (event.key === \"ArrowUp\") {\n\t\t\t\tif (this.hasPrevElement()) {\n\t\t\t\t\tthis.getPrevElement().scrollIntoView({ block: \"nearest\" });\n\t\t\t\t} else {\n\t\t\t\t\tthis.blurIntent.emit(\"top\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.highlightedItem = this.getItemId(this.index);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Emits the selected item or items after a mouse click event has occurred.\n\t */\n\tdoClick(event, item) {\n\t\tevent.preventDefault();\n\t\tif (item && !item.disabled) {\n\t\t\tthis.list.nativeElement.focus();\n\t\t\tif (this.type === \"single\") {\n\t\t\t\titem.selected = true;\n\t\t\t\t// reset the selection\n\t\t\t\tfor (let otherItem of this.getListItems()) {\n\t\t\t\t\tif (item !== otherItem) { otherItem.selected = false; }\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem.selected = !item.selected;\n\t\t\t}\n\t\t\tthis.index = this.displayItems.indexOf(item);\n\t\t\tthis.highlightedItem = this.getItemId(this.index);\n\t\t\tthis.doEmitSelect(false);\n\t\t\tthis.appRef.tick();\n\t\t}\n\t}\n\n\tonItemFocus(index) {\n\t\tconst element = this.listElementList.toArray()[index].nativeElement;\n\t\telement.classList.add(\"cds--list-box__menu-item--highlighted\");\n\t\telement.tabIndex = 0;\n\t}\n\n\tonItemBlur(index) {\n\t\tconst element = this.listElementList.toArray()[index].nativeElement;\n\t\telement.classList.remove(\"cds--list-box__menu-item--highlighted\");\n\t\telement.tabIndex = -1;\n\t}\n\n\t/**\n\t * Emits the scroll event of the options list\n\t */\n\temitScroll(event) {\n\t\tconst atTop: boolean = event.srcElement.scrollTop === 0;\n\t\tconst atBottom: boolean = event.srcElement.scrollHeight - event.srcElement.scrollTop === event.srcElement.clientHeight;\n\t\tconst customScrollEvent = { atTop, atBottom, event };\n\t\tthis.scroll.emit(customScrollEvent);\n\t}\n\n\t/**\n\t * Subscribe the function passed to an internal observable that will resolve once the items are ready\n\t */\n\tonItemsReady(subcription: () => void): void {\n\t\t// this subscription will auto unsubscribe because of the `first()` pipe\n\t\t(this._itemsReady || of(true)).pipe(first()).subscribe(subcription);\n\t}\n\n\treorderSelected(moveFocus = true): void {\n\t\tthis.displayItems = [...this.getSelected(), ...this.getListItems().filter(item => !item.selected)];\n\t\tif (moveFocus) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.updateIndex();\n\t\t\t\tthis.highlightedItem = this.getItemId(this.index);\n\t\t\t});\n\t\t}\n\t}\n}\n",
|
|
34145
34256
|
"assetsDirs": [],
|
|
34146
34257
|
"styleUrlsData": "",
|
|
34147
34258
|
"stylesData": "",
|
|
@@ -34339,7 +34450,7 @@
|
|
|
34339
34450
|
},
|
|
34340
34451
|
{
|
|
34341
34452
|
"name": "DynamicListComboBox",
|
|
34342
|
-
"id": "component-DynamicListComboBox-
|
|
34453
|
+
"id": "component-DynamicListComboBox-1c9aa4d55f79938ecc1920aa73daf986566aa07e52949d4d2cfa9bbea1a4f9b866a822a5f988a04f697ee3920fd15513a149d911e96c7ee50f08d83b89e4ae53",
|
|
34343
34454
|
"file": "src/combobox/stories/app-dynamic-list-combobox.component.ts",
|
|
34344
34455
|
"encapsulation": [],
|
|
34345
34456
|
"entryComponents": [],
|
|
@@ -34349,7 +34460,7 @@
|
|
|
34349
34460
|
"selector": "app-dynamic-list-combobox",
|
|
34350
34461
|
"styleUrls": [],
|
|
34351
34462
|
"styles": [],
|
|
34352
|
-
"template": "<cds-combo-box\n\t[(items)]=\"items\"\n\ttype=\"multi\"\n\t(selected)=\"updateSelected($event)\">\n\t<cds-dropdown-list></cds-dropdown-list>\n</cds-combo-box>\n\t",
|
|
34463
|
+
"template": "<cds-combo-box\n\t[(items)]=\"items\"\n\titemValueKey=\"content\"\n\ttype=\"multi\"\n\t(selected)=\"updateSelected($event)\">\n\t<cds-dropdown-list></cds-dropdown-list>\n</cds-combo-box>\n\t",
|
|
34353
34464
|
"templateUrl": [],
|
|
34354
34465
|
"viewProviders": [],
|
|
34355
34466
|
"hostDirectives": [],
|
|
@@ -34364,7 +34475,7 @@
|
|
|
34364
34475
|
"type": "[]",
|
|
34365
34476
|
"optional": false,
|
|
34366
34477
|
"description": "",
|
|
34367
|
-
"line":
|
|
34478
|
+
"line": 16
|
|
34368
34479
|
}
|
|
34369
34480
|
],
|
|
34370
34481
|
"methodsClass": [
|
|
@@ -34381,7 +34492,7 @@
|
|
|
34381
34492
|
"optional": false,
|
|
34382
34493
|
"returnType": "void",
|
|
34383
34494
|
"typeParameters": [],
|
|
34384
|
-
"line":
|
|
34495
|
+
"line": 31,
|
|
34385
34496
|
"deprecated": false,
|
|
34386
34497
|
"deprecationMessage": "",
|
|
34387
34498
|
"jsdoctags": [
|
|
@@ -34406,7 +34517,7 @@
|
|
|
34406
34517
|
"description": "",
|
|
34407
34518
|
"rawdescription": "\n",
|
|
34408
34519
|
"type": "component",
|
|
34409
|
-
"sourceCode": "import { Component, AfterViewInit } from \"@angular/core\";\n\n@Component({\n\tselector: \"app-dynamic-list-combobox\",\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[(items)]=\"items\"\n\t\t\ttype=\"multi\"\n\t\t\t(selected)=\"updateSelected($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t`\n})\nexport class DynamicListComboBox implements AfterViewInit {\n\titems = [\n\t\t{\n\t\t\tcontent: \"one\"\n\t\t},\n\t\t{\n\t\t\tcontent: \"two\"\n\t\t},\n\t\t{\n\t\t\tcontent: \"three\"\n\t\t},\n\t\t{\n\t\t\tcontent: \"four\"\n\t\t}\n\t];\n\n\tupdateSelected(event) {\n\t\tthis.items.forEach((item: any) => {\n\t\t\tif (event.some(selectedItem => selectedItem.content === item.content)) {\n\t\t\t\titem.selected = true;\n\t\t\t} else {\n\t\t\t\titem.selected = false;\n\t\t\t}\n\t\t});\n\t}\n\n\tngAfterViewInit() {\n\t\tsetTimeout(() => {\n\t\t\tconst newItems = JSON.parse(JSON.stringify(this.items));\n\t\t\tnewItems.push({ content: `New ${newItems.length}` });\n\t\t\tthis.items = newItems;\n\t\t}, 4000);\n\t}\n}\n",
|
|
34520
|
+
"sourceCode": "import { Component, AfterViewInit } from \"@angular/core\";\n\n@Component({\n\tselector: \"app-dynamic-list-combobox\",\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[(items)]=\"items\"\n\t\t\titemValueKey=\"content\"\n\t\t\ttype=\"multi\"\n\t\t\t(selected)=\"updateSelected($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t`\n})\nexport class DynamicListComboBox implements AfterViewInit {\n\titems = [\n\t\t{\n\t\t\tcontent: \"one\"\n\t\t},\n\t\t{\n\t\t\tcontent: \"two\"\n\t\t},\n\t\t{\n\t\t\tcontent: \"three\"\n\t\t},\n\t\t{\n\t\t\tcontent: \"four\"\n\t\t}\n\t];\n\n\tupdateSelected(event) {\n\t\tthis.items.forEach((item: any) => {\n\t\t\tif (event.some(selectedItem => selectedItem.content === item.content)) {\n\t\t\t\titem.selected = true;\n\t\t\t} else {\n\t\t\t\titem.selected = false;\n\t\t\t}\n\t\t});\n\t}\n\n\tngAfterViewInit() {\n\t\tsetTimeout(() => {\n\t\t\tconst newItems = JSON.parse(JSON.stringify(this.items));\n\t\t\tnewItems.push({ content: `New ${newItems.length}` });\n\t\t\tthis.items = newItems;\n\t\t}, 4000);\n\t}\n}\n",
|
|
34410
34521
|
"assetsDirs": [],
|
|
34411
34522
|
"styleUrlsData": "",
|
|
34412
34523
|
"stylesData": "",
|
|
@@ -42103,7 +42214,7 @@
|
|
|
42103
42214
|
},
|
|
42104
42215
|
{
|
|
42105
42216
|
"name": "MockQueryCombobox",
|
|
42106
|
-
"id": "component-MockQueryCombobox-
|
|
42217
|
+
"id": "component-MockQueryCombobox-fb25ff9ce1e14a38ef8cd0418b432bf10e3204ff81cc8feacc51c410e01e3ac9c3bda0e358e09da67775c8abd741f76ff9c6cd10d538ce413ca2f31d812857b8",
|
|
42107
42218
|
"file": "src/combobox/stories/app-mock-query-search.component.ts",
|
|
42108
42219
|
"encapsulation": [],
|
|
42109
42220
|
"entryComponents": [],
|
|
@@ -42113,7 +42224,7 @@
|
|
|
42113
42224
|
"selector": "app-mock-query-search",
|
|
42114
42225
|
"styleUrls": [],
|
|
42115
42226
|
"styles": [],
|
|
42116
|
-
"template": "<cds-combo-box\n\tappendInline=\"true\"\n\t[items]=\"filterItems\"\n\t(search)=\"onSearch($event)\"\n\t(selected)=\"selected($event)\">\n\t<cds-dropdown-list></cds-dropdown-list>\n</cds-combo-box>\n\t",
|
|
42227
|
+
"template": "<cds-combo-box\n\tappendInline=\"true\"\n\t[items]=\"filterItems\"\n\titemValueKey=\"content\"\n\t(search)=\"onSearch($event)\"\n\t(selected)=\"selected($event)\">\n\t<cds-dropdown-list></cds-dropdown-list>\n</cds-combo-box>\n\t",
|
|
42117
42228
|
"templateUrl": [],
|
|
42118
42229
|
"viewProviders": [],
|
|
42119
42230
|
"hostDirectives": [],
|
|
@@ -42127,7 +42238,7 @@
|
|
|
42127
42238
|
"type": "any",
|
|
42128
42239
|
"optional": false,
|
|
42129
42240
|
"description": "",
|
|
42130
|
-
"line":
|
|
42241
|
+
"line": 18
|
|
42131
42242
|
},
|
|
42132
42243
|
{
|
|
42133
42244
|
"name": "filterItems",
|
|
@@ -42137,7 +42248,7 @@
|
|
|
42137
42248
|
"type": "any",
|
|
42138
42249
|
"optional": false,
|
|
42139
42250
|
"description": "",
|
|
42140
|
-
"line":
|
|
42251
|
+
"line": 17
|
|
42141
42252
|
}
|
|
42142
42253
|
],
|
|
42143
42254
|
"methodsClass": [
|
|
@@ -42189,7 +42300,7 @@
|
|
|
42189
42300
|
"description": "",
|
|
42190
42301
|
"rawdescription": "\n",
|
|
42191
42302
|
"type": "component",
|
|
42192
|
-
"sourceCode": "import { Component } from \"@angular/core\";\n\n@Component({\n\tselector: \"app-mock-query-search\",\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\tappendInline=\"true\"\n\t\t\t[items]=\"filterItems\"\n\t\t\t(search)=\"onSearch($event)\"\n\t\t\t(selected)=\"selected($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t`\n})\nexport class MockQueryCombobox {\n\tfilterItems: any = [];\n\tcurrentlySelected: any;\n\
|
|
42303
|
+
"sourceCode": "import { Component, Input } from \"@angular/core\";\n\n@Component({\n\tselector: \"app-mock-query-search\",\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\tappendInline=\"true\"\n\t\t\t[items]=\"filterItems\"\n\t\t\titemValueKey=\"content\"\n\t\t\t(search)=\"onSearch($event)\"\n\t\t\t(selected)=\"selected($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t`\n})\nexport class MockQueryCombobox {\n\tfilterItems: any = [];\n\tcurrentlySelected: any;\n\tonSearch() {\n\t\t// Call API or search through items list\n\t\tsetTimeout(() => {\n\t\t\tconst array = [\n\t\t\t\t{ content: `Random ${Math.random()}` },\n\t\t\t\t{ content: `Random ${Math.random()}` },\n\t\t\t\t{ content: `Random ${Math.random()}` },\n\t\t\t\t{ content: `Random ${Math.random()}` }\n\t\t\t];\n\n\t\t\t// Include current selected in the list to avoid auto clear\n\t\t\tif (this.currentlySelected) {\n\t\t\t\tarray.push(this.currentlySelected);\n\t\t\t}\n\t\t\tthis.filterItems = array;\n\t\t}, 1000);\n\t}\n\n\tselected(event: any) {\n\t\t/**\n\t\t * #ref-1245723\n\t\t * Update this on major release\n\t\t */\n\t\tif (Array.isArray(event) && !event.length) {\n\t\t\tthis.currentlySelected = undefined;\n\t\t} else {\n\t\t\tthis.currentlySelected = event;\n\t\t}\n\t}\n}\n",
|
|
42193
42304
|
"assetsDirs": [],
|
|
42194
42305
|
"styleUrlsData": "",
|
|
42195
42306
|
"stylesData": "",
|
|
@@ -50794,7 +50905,7 @@
|
|
|
50794
50905
|
},
|
|
50795
50906
|
{
|
|
50796
50907
|
"name": "RadioGroup",
|
|
50797
|
-
"id": "component-RadioGroup-
|
|
50908
|
+
"id": "component-RadioGroup-92514bdc3aa775d3809e06446501d9657c9db475411b6b0fcaa3bb9d65834e99f5d85390904ce04db7a3bbe711fdc8ab8be4170b6359aade0105f30dbeea32cb",
|
|
50798
50909
|
"file": "src/radio/radio-group.component.ts",
|
|
50799
50910
|
"encapsulation": [],
|
|
50800
50911
|
"entryComponents": [],
|
|
@@ -50819,7 +50930,7 @@
|
|
|
50819
50930
|
"deprecationMessage": "",
|
|
50820
50931
|
"rawdescription": "\n\nUsed to set the `aria-label` attribute on the radio group element.\n",
|
|
50821
50932
|
"description": "<p>Used to set the <code>aria-label</code> attribute on the radio group element.</p>\n",
|
|
50822
|
-
"line":
|
|
50933
|
+
"line": 224,
|
|
50823
50934
|
"type": "string",
|
|
50824
50935
|
"decorators": []
|
|
50825
50936
|
},
|
|
@@ -50829,7 +50940,7 @@
|
|
|
50829
50940
|
"deprecationMessage": "",
|
|
50830
50941
|
"rawdescription": "\n\nUsed to set the `aria-labelledby` attribute on the radio group element.\n",
|
|
50831
50942
|
"description": "<p>Used to set the <code>aria-labelledby</code> attribute on the radio group element.</p>\n",
|
|
50832
|
-
"line":
|
|
50943
|
+
"line": 229,
|
|
50833
50944
|
"type": "string",
|
|
50834
50945
|
"decorators": []
|
|
50835
50946
|
},
|
|
@@ -50839,7 +50950,7 @@
|
|
|
50839
50950
|
"deprecationMessage": "",
|
|
50840
50951
|
"rawdescription": "\n\n**Experimental**: Optional decorator (e.g. AI label).\n",
|
|
50841
50952
|
"description": "<p><strong>Experimental</strong>: Optional decorator (e.g. AI label).</p>\n",
|
|
50842
|
-
"line":
|
|
50953
|
+
"line": 219,
|
|
50843
50954
|
"type": "TemplateRef<any>",
|
|
50844
50955
|
"decorators": []
|
|
50845
50956
|
},
|
|
@@ -50849,7 +50960,7 @@
|
|
|
50849
50960
|
"deprecationMessage": "",
|
|
50850
50961
|
"rawdescription": "\n\nSet to true to disable the whole radio group\n",
|
|
50851
50962
|
"description": "<p>Set to true to disable the whole radio group</p>\n",
|
|
50852
|
-
"line":
|
|
50963
|
+
"line": 179,
|
|
50853
50964
|
"type": "boolean",
|
|
50854
50965
|
"decorators": []
|
|
50855
50966
|
},
|
|
@@ -50859,7 +50970,7 @@
|
|
|
50859
50970
|
"deprecationMessage": "",
|
|
50860
50971
|
"rawdescription": "\n\nSets the optional helper text.\n",
|
|
50861
50972
|
"description": "<p>Sets the optional helper text.</p>\n",
|
|
50862
|
-
"line":
|
|
50973
|
+
"line": 234,
|
|
50863
50974
|
"type": "string | TemplateRef<any>",
|
|
50864
50975
|
"decorators": []
|
|
50865
50976
|
},
|
|
@@ -50870,7 +50981,7 @@
|
|
|
50870
50981
|
"deprecationMessage": "",
|
|
50871
50982
|
"rawdescription": "\n\nSet to `true` to show the invalid state.\n",
|
|
50872
50983
|
"description": "<p>Set to <code>true</code> to show the invalid state.</p>\n",
|
|
50873
|
-
"line":
|
|
50984
|
+
"line": 239,
|
|
50874
50985
|
"type": "boolean",
|
|
50875
50986
|
"decorators": []
|
|
50876
50987
|
},
|
|
@@ -50880,7 +50991,7 @@
|
|
|
50880
50991
|
"deprecationMessage": "",
|
|
50881
50992
|
"rawdescription": "\n\nValue displayed if combobox is in an invalid state.\n",
|
|
50882
50993
|
"description": "<p>Value displayed if combobox is in an invalid state.</p>\n",
|
|
50883
|
-
"line":
|
|
50994
|
+
"line": 244,
|
|
50884
50995
|
"type": "string | TemplateRef<any>",
|
|
50885
50996
|
"decorators": []
|
|
50886
50997
|
},
|
|
@@ -50889,7 +51000,7 @@
|
|
|
50889
51000
|
"defaultValue": "\"right\"",
|
|
50890
51001
|
"deprecated": false,
|
|
50891
51002
|
"deprecationMessage": "",
|
|
50892
|
-
"line":
|
|
51003
|
+
"line": 212,
|
|
50893
51004
|
"type": "\"right\" | \"left\"",
|
|
50894
51005
|
"decorators": []
|
|
50895
51006
|
},
|
|
@@ -50897,7 +51008,7 @@
|
|
|
50897
51008
|
"name": "legend",
|
|
50898
51009
|
"deprecated": false,
|
|
50899
51010
|
"deprecationMessage": "",
|
|
50900
|
-
"line":
|
|
51011
|
+
"line": 214,
|
|
50901
51012
|
"type": "string | TemplateRef<any>",
|
|
50902
51013
|
"decorators": []
|
|
50903
51014
|
},
|
|
@@ -50907,7 +51018,7 @@
|
|
|
50907
51018
|
"deprecationMessage": "",
|
|
50908
51019
|
"rawdescription": "\n\nReplaces the name associated with the `RadioGroup` with the provided parameter.\n",
|
|
50909
51020
|
"description": "<p>Replaces the name associated with the <code>RadioGroup</code> with the provided parameter.</p>\n",
|
|
50910
|
-
"line":
|
|
51021
|
+
"line": 164,
|
|
50911
51022
|
"type": "string",
|
|
50912
51023
|
"decorators": []
|
|
50913
51024
|
},
|
|
@@ -50916,7 +51027,7 @@
|
|
|
50916
51027
|
"defaultValue": "\"horizontal\"",
|
|
50917
51028
|
"deprecated": false,
|
|
50918
51029
|
"deprecationMessage": "",
|
|
50919
|
-
"line":
|
|
51030
|
+
"line": 210,
|
|
50920
51031
|
"type": "\"horizontal\" | \"vertical\"",
|
|
50921
51032
|
"decorators": []
|
|
50922
51033
|
},
|
|
@@ -50926,7 +51037,7 @@
|
|
|
50926
51037
|
"deprecationMessage": "",
|
|
50927
51038
|
"rawdescription": "\n\nSets the passed in `Radio` item as the selected input within the `RadioGroup`.\n",
|
|
50928
51039
|
"description": "<p>Sets the passed in <code>Radio</code> item as the selected input within the <code>RadioGroup</code>.</p>\n",
|
|
50929
|
-
"line":
|
|
51040
|
+
"line": 118,
|
|
50930
51041
|
"type": "Radio | null",
|
|
50931
51042
|
"decorators": []
|
|
50932
51043
|
},
|
|
@@ -50936,7 +51047,7 @@
|
|
|
50936
51047
|
"deprecationMessage": "",
|
|
50937
51048
|
"rawdescription": "\n\nReturns the skeleton value in the `RadioGroup` if there is one.\n",
|
|
50938
51049
|
"description": "<p>Returns the skeleton value in the <code>RadioGroup</code> if there is one.</p>\n",
|
|
50939
|
-
"line":
|
|
51050
|
+
"line": 194,
|
|
50940
51051
|
"type": "any",
|
|
50941
51052
|
"decorators": []
|
|
50942
51053
|
},
|
|
@@ -50946,7 +51057,7 @@
|
|
|
50946
51057
|
"deprecationMessage": "",
|
|
50947
51058
|
"rawdescription": "\n\nSets the value/state of the selected `Radio` within the `RadioGroup` to the passed in value.\n",
|
|
50948
51059
|
"description": "<p>Sets the value/state of the selected <code>Radio</code> within the <code>RadioGroup</code> to the passed in value.</p>\n",
|
|
50949
|
-
"line":
|
|
51060
|
+
"line": 144,
|
|
50950
51061
|
"type": "any",
|
|
50951
51062
|
"decorators": []
|
|
50952
51063
|
},
|
|
@@ -50957,7 +51068,7 @@
|
|
|
50957
51068
|
"deprecationMessage": "",
|
|
50958
51069
|
"rawdescription": "\n\nSet to `true` to show a warning (contents set by warnText)\n",
|
|
50959
51070
|
"description": "<p>Set to <code>true</code> to show a warning (contents set by warnText)</p>\n",
|
|
50960
|
-
"line":
|
|
51071
|
+
"line": 249,
|
|
50961
51072
|
"type": "boolean",
|
|
50962
51073
|
"decorators": []
|
|
50963
51074
|
},
|
|
@@ -50967,7 +51078,7 @@
|
|
|
50967
51078
|
"deprecationMessage": "",
|
|
50968
51079
|
"rawdescription": "\n\nSets the warning text\n",
|
|
50969
51080
|
"description": "<p>Sets the warning text</p>\n",
|
|
50970
|
-
"line":
|
|
51081
|
+
"line": 254,
|
|
50971
51082
|
"type": "string | TemplateRef<any>",
|
|
50972
51083
|
"decorators": []
|
|
50973
51084
|
}
|
|
@@ -50980,7 +51091,7 @@
|
|
|
50980
51091
|
"deprecationMessage": "",
|
|
50981
51092
|
"rawdescription": "\n\nEmits event notifying other classes of a change using a `RadioChange` class.\n",
|
|
50982
51093
|
"description": "<p>Emits event notifying other classes of a change using a <code>RadioChange</code> class.</p>\n",
|
|
50983
|
-
"line":
|
|
51094
|
+
"line": 259,
|
|
50984
51095
|
"type": "EventEmitter<RadioChange>"
|
|
50985
51096
|
}
|
|
50986
51097
|
],
|
|
@@ -50993,7 +51104,7 @@
|
|
|
50993
51104
|
"type": "function",
|
|
50994
51105
|
"optional": false,
|
|
50995
51106
|
"description": "<p>Needed to properly implement ControlValueAccessor.</p>\n",
|
|
50996
|
-
"line":
|
|
51107
|
+
"line": 428,
|
|
50997
51108
|
"rawdescription": "\n\nNeeded to properly implement ControlValueAccessor.\n"
|
|
50998
51109
|
},
|
|
50999
51110
|
{
|
|
@@ -51004,7 +51115,7 @@
|
|
|
51004
51115
|
"type": "",
|
|
51005
51116
|
"optional": false,
|
|
51006
51117
|
"description": "<p>Method set in registerOnChange to propagate changes back to the form.</p>\n",
|
|
51007
|
-
"line":
|
|
51118
|
+
"line": 433,
|
|
51008
51119
|
"rawdescription": "\n\nMethod set in registerOnChange to propagate changes back to the form.\n"
|
|
51009
51120
|
},
|
|
51010
51121
|
{
|
|
@@ -51015,7 +51126,7 @@
|
|
|
51015
51126
|
"type": "",
|
|
51016
51127
|
"optional": false,
|
|
51017
51128
|
"description": "<p>Binds 'cds--form-item' value to the class for <code>RadioGroup</code>.</p>\n",
|
|
51018
|
-
"line":
|
|
51129
|
+
"line": 270,
|
|
51019
51130
|
"rawdescription": "\n\nBinds 'cds--form-item' value to the class for `RadioGroup`.\n",
|
|
51020
51131
|
"decorators": [
|
|
51021
51132
|
{
|
|
@@ -51035,7 +51146,7 @@
|
|
|
51035
51146
|
"type": "number",
|
|
51036
51147
|
"optional": false,
|
|
51037
51148
|
"description": "<p>Used for creating the <code>RadioGroup</code> 'name' property dynamically.</p>\n",
|
|
51038
|
-
"line":
|
|
51149
|
+
"line": 208,
|
|
51039
51150
|
"rawdescription": "\n\nUsed for creating the `RadioGroup` 'name' property dynamically.\n",
|
|
51040
51151
|
"modifierKind": [
|
|
51041
51152
|
126
|
|
@@ -51048,7 +51159,7 @@
|
|
|
51048
51159
|
"type": "QueryList<Radio>",
|
|
51049
51160
|
"optional": false,
|
|
51050
51161
|
"description": "<p>The <code>Radio</code> input items in the <code>RadioGroup</code>.</p>\n",
|
|
51051
|
-
"line":
|
|
51162
|
+
"line": 265,
|
|
51052
51163
|
"rawdescription": "\n\nThe `Radio` input items in the `RadioGroup`.\n",
|
|
51053
51164
|
"decorators": [
|
|
51054
51165
|
{
|
|
@@ -51068,7 +51179,7 @@
|
|
|
51068
51179
|
"optional": false,
|
|
51069
51180
|
"returnType": "void",
|
|
51070
51181
|
"typeParameters": [],
|
|
51071
|
-
"line":
|
|
51182
|
+
"line": 302,
|
|
51072
51183
|
"deprecated": false,
|
|
51073
51184
|
"deprecationMessage": "",
|
|
51074
51185
|
"rawdescription": "\n\nUpdates the selected `Radio` to be checked (selected).\n",
|
|
@@ -51087,7 +51198,7 @@
|
|
|
51087
51198
|
"optional": false,
|
|
51088
51199
|
"returnType": "void",
|
|
51089
51200
|
"typeParameters": [],
|
|
51090
|
-
"line":
|
|
51201
|
+
"line": 343,
|
|
51091
51202
|
"deprecated": false,
|
|
51092
51203
|
"deprecationMessage": "",
|
|
51093
51204
|
"rawdescription": "\n\nCreates a class of `RadioChange` to emit the change in the `RadioGroup`.\n",
|
|
@@ -51110,7 +51221,7 @@
|
|
|
51110
51221
|
"optional": false,
|
|
51111
51222
|
"returnType": "void",
|
|
51112
51223
|
"typeParameters": [],
|
|
51113
|
-
"line":
|
|
51224
|
+
"line": 421,
|
|
51114
51225
|
"deprecated": false,
|
|
51115
51226
|
"deprecationMessage": "",
|
|
51116
51227
|
"decorators": [
|
|
@@ -51136,7 +51247,7 @@
|
|
|
51136
51247
|
"optional": false,
|
|
51137
51248
|
"returnType": "boolean",
|
|
51138
51249
|
"typeParameters": [],
|
|
51139
|
-
"line":
|
|
51250
|
+
"line": 435,
|
|
51140
51251
|
"deprecated": false,
|
|
51141
51252
|
"deprecationMessage": "",
|
|
51142
51253
|
"modifierKind": [
|
|
@@ -51167,7 +51278,7 @@
|
|
|
51167
51278
|
"optional": false,
|
|
51168
51279
|
"returnType": "void",
|
|
51169
51280
|
"typeParameters": [],
|
|
51170
|
-
"line":
|
|
51281
|
+
"line": 408,
|
|
51171
51282
|
"deprecated": false,
|
|
51172
51283
|
"deprecationMessage": "",
|
|
51173
51284
|
"rawdescription": "\n\nUsed to set method to propagate changes back to the form.\n",
|
|
@@ -51200,7 +51311,7 @@
|
|
|
51200
51311
|
"optional": false,
|
|
51201
51312
|
"returnType": "void",
|
|
51202
51313
|
"typeParameters": [],
|
|
51203
|
-
"line":
|
|
51314
|
+
"line": 416,
|
|
51204
51315
|
"deprecated": false,
|
|
51205
51316
|
"deprecationMessage": "",
|
|
51206
51317
|
"rawdescription": "\n\nRegisters a callback to be triggered when the control has been touched.\n",
|
|
@@ -51211,8 +51322,8 @@
|
|
|
51211
51322
|
"jsdoctags": [
|
|
51212
51323
|
{
|
|
51213
51324
|
"name": {
|
|
51214
|
-
"pos":
|
|
51215
|
-
"end":
|
|
51325
|
+
"pos": 10139,
|
|
51326
|
+
"end": 10141,
|
|
51216
51327
|
"flags": 16842752,
|
|
51217
51328
|
"modifierFlagsCache": 0,
|
|
51218
51329
|
"transformFlags": 0,
|
|
@@ -51223,8 +51334,8 @@
|
|
|
51223
51334
|
"deprecated": false,
|
|
51224
51335
|
"deprecationMessage": "",
|
|
51225
51336
|
"tagName": {
|
|
51226
|
-
"pos":
|
|
51227
|
-
"end":
|
|
51337
|
+
"pos": 10133,
|
|
51338
|
+
"end": 10138,
|
|
51228
51339
|
"flags": 16842752,
|
|
51229
51340
|
"modifierFlagsCache": 0,
|
|
51230
51341
|
"transformFlags": 0,
|
|
@@ -51248,7 +51359,7 @@
|
|
|
51248
51359
|
"optional": false,
|
|
51249
51360
|
"returnType": "void",
|
|
51250
51361
|
"typeParameters": [],
|
|
51251
|
-
"line":
|
|
51362
|
+
"line": 336,
|
|
51252
51363
|
"deprecated": false,
|
|
51253
51364
|
"deprecationMessage": "",
|
|
51254
51365
|
"rawdescription": "\n\n`ControlValueAccessor` method to programmatically disable the `RadioGroup`.\n\nex: `this.formGroup.get(\"myRadioGroup\").disable();`\n\n",
|
|
@@ -51256,8 +51367,8 @@
|
|
|
51256
51367
|
"jsdoctags": [
|
|
51257
51368
|
{
|
|
51258
51369
|
"name": {
|
|
51259
|
-
"pos":
|
|
51260
|
-
"end":
|
|
51370
|
+
"pos": 8519,
|
|
51371
|
+
"end": 8529,
|
|
51261
51372
|
"flags": 16842752,
|
|
51262
51373
|
"modifierFlagsCache": 0,
|
|
51263
51374
|
"transformFlags": 0,
|
|
@@ -51268,8 +51379,8 @@
|
|
|
51268
51379
|
"deprecated": false,
|
|
51269
51380
|
"deprecationMessage": "",
|
|
51270
51381
|
"tagName": {
|
|
51271
|
-
"pos":
|
|
51272
|
-
"end":
|
|
51382
|
+
"pos": 8513,
|
|
51383
|
+
"end": 8518,
|
|
51273
51384
|
"flags": 16842752,
|
|
51274
51385
|
"modifierFlagsCache": 0,
|
|
51275
51386
|
"transformFlags": 0,
|
|
@@ -51286,7 +51397,7 @@
|
|
|
51286
51397
|
"optional": false,
|
|
51287
51398
|
"returnType": "void",
|
|
51288
51399
|
"typeParameters": [],
|
|
51289
|
-
"line":
|
|
51400
|
+
"line": 352,
|
|
51290
51401
|
"deprecated": false,
|
|
51291
51402
|
"deprecationMessage": "",
|
|
51292
51403
|
"rawdescription": "\n\nSynchronizes radio properties.\n",
|
|
@@ -51298,7 +51409,7 @@
|
|
|
51298
51409
|
"optional": false,
|
|
51299
51410
|
"returnType": "void",
|
|
51300
51411
|
"typeParameters": [],
|
|
51301
|
-
"line":
|
|
51412
|
+
"line": 311,
|
|
51302
51413
|
"deprecated": false,
|
|
51303
51414
|
"deprecationMessage": "",
|
|
51304
51415
|
"rawdescription": "\n\nUse the value of the `RadioGroup` to update the selected radio to the right state (selected state).\n",
|
|
@@ -51317,7 +51428,7 @@
|
|
|
51317
51428
|
"optional": false,
|
|
51318
51429
|
"returnType": "void",
|
|
51319
51430
|
"typeParameters": [],
|
|
51320
|
-
"line":
|
|
51431
|
+
"line": 369,
|
|
51321
51432
|
"deprecated": false,
|
|
51322
51433
|
"deprecationMessage": "",
|
|
51323
51434
|
"rawdescription": "\n\nUpdates the value of the `RadioGroup` using the provided parameter.\n",
|
|
@@ -51345,7 +51456,7 @@
|
|
|
51345
51456
|
"deprecationMessage": "",
|
|
51346
51457
|
"rawdescription": "\n\nBinds 'cds--form-item' value to the class for `RadioGroup`.\n",
|
|
51347
51458
|
"description": "<p>Binds 'cds--form-item' value to the class for <code>RadioGroup</code>.</p>\n",
|
|
51348
|
-
"line":
|
|
51459
|
+
"line": 270,
|
|
51349
51460
|
"type": "boolean",
|
|
51350
51461
|
"decorators": []
|
|
51351
51462
|
}
|
|
@@ -51357,7 +51468,7 @@
|
|
|
51357
51468
|
"argsDecorator": [],
|
|
51358
51469
|
"deprecated": false,
|
|
51359
51470
|
"deprecationMessage": "",
|
|
51360
|
-
"line":
|
|
51471
|
+
"line": 421
|
|
51361
51472
|
}
|
|
51362
51473
|
],
|
|
51363
51474
|
"standalone": false,
|
|
@@ -51365,7 +51476,7 @@
|
|
|
51365
51476
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { RadioModule } from 'carbon-components-angular';</code></pre></div><p>Ex:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-radio-group [(ngModel)]="radio">\n <cds-radio *ngFor="let one of manyRadios" [value]="one">\n Radio {{one}}\n </cds-radio>\n</cds-radio-group>\n\nRadio selected: {{radio}}</code></pre></div><b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-ts\"> const manyRadios = ["one", "two", "three", "four", "five", "six"];</code></pre></div><p><a href=\"../../?path=/story/components-radio--basic\">See demo</a></p>\n",
|
|
51366
51477
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { RadioModule } from 'carbon-components-angular';\n```\n\nEx:\n\n```html\n<cds-radio-group [(ngModel)]=\"radio\">\n\t<cds-radio *ngFor=\"let one of manyRadios\" [value]=\"one\">\n\t\tRadio {{one}}\n\t</cds-radio>\n</cds-radio-group>\n\nRadio selected: {{radio}}\n```\n\n```ts\n\tconst manyRadios = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\"];\n```\n\n[See demo](../../?path=/story/components-radio--basic)\n",
|
|
51367
51478
|
"type": "component",
|
|
51368
|
-
"sourceCode": "import {\n\tAfterContentInit,\n\tContentChildren,\n\tComponent,\n\tEventEmitter,\n\tforwardRef,\n\tInput,\n\tOutput,\n\tQueryList,\n\tHostBinding,\n\tAfterViewInit,\n\tHostListener,\n\tTemplateRef\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\nimport { Radio } from \"./radio.component\";\nimport { RadioChange } from \"./radio-change.class\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { RadioModule } from 'carbon-components-angular';\n * ```\n *\n * Ex:\n *\n * ```html\n * <cds-radio-group [(ngModel)]=\"radio\">\n * \t<cds-radio *ngFor=\"let one of manyRadios\" [value]=\"one\">\n *\t\tRadio {{one}}\n * \t</cds-radio>\n * </cds-radio-group>\n *\n * Radio selected: {{radio}}\n * ```\n *\n * ```ts\n *\tconst manyRadios = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\"];\n * ```\n *\n * [See demo](../../?path=/story/components-radio--basic)\n */\n@Component({\n\tselector: \"cds-radio-group, ibm-radio-group\",\n\ttemplate: `\n\t\t<fieldset\n\t\t\tclass=\"cds--radio-button-group\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t[attr.aria-labelledby]=\"ariaLabelledby\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--radio-button-group--vertical': orientation === 'vertical',\n\t\t\t\t'cds--radio-button-group--label-left': labelPlacement === 'left',\n\t\t\t\t'cds--radio-button-group--invalid': invalid,\n\t\t\t\t'cds--radio-button-group--warning': !invalid && warn,\n\t\t\t\t'cds--radio-button-group--decorator': !!decorator\n\t\t\t}\"\n\t\t\t[attr.data-invalid]=\"invalid ? true : null\">\n\t\t\t<legend *ngIf=\"legend\" class=\"cds--label\">\n\t\t\t\t<ng-template *ngIf=\"isTemplate(legend); else legendLabel;\" [ngTemplateOutlet]=\"legend\"></ng-template>\n\t\t\t\t<ng-template #legendLabel>{{legend}}</ng-template>\n\t\t\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t<div class=\"cds--radio-button-group-inner--decorator\">\n\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\n\t\t\t</legend>\n\t\t\t<ng-content></ng-content>\n\t\t</fieldset>\n\t\t<div class=\"cds--radio-button__validation-msg\">\n\t\t\t<ng-container *ngIf=\"invalid\">\n\t\t\t\t<svg\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--radio-button__invalid-icon\">\n\t\t\t\t</svg>\n\t\t\t\t<div class=\"cds--form-requirement\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t\t<ng-container *ngIf=\"!invalid && warn\">\n\t\t\t\t<svg\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tclass=\"cds--radio-button__invalid-icon cds--radio-button__invalid-icon--warning\"\n\t\t\t\t\tsize=\"16\">\n\t\t\t\t</svg>\n\t\t\t\t<div class=\"cds--form-requirement\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t</div>\n\t\t<div\n\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: RadioGroup,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class RadioGroup implements AfterContentInit, AfterViewInit, ControlValueAccessor {\n\n\t/**\n\t * Sets the passed in `Radio` item as the selected input within the `RadioGroup`.\n\t */\n\t@Input()\n\tset selected(selected: Radio | null) {\n\t\tconst alreadySelected = (this._selected && this._selected.value) === (selected && selected.value);\n\t\tif (alreadySelected) {\n\t\t\t// no need to redo\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._selected) {\n\t\t\tthis._selected.checked = false;\n\t\t}\n\t\tthis._selected = selected;\n\t\tthis.value = selected ? selected.value : null;\n\t\tthis.checkSelectedRadio();\n\t}\n\n\t/**\n\t * Returns the `Radio` that is selected within the `RadioGroup`.\n\t */\n\tget selected() {\n\t\treturn this._selected;\n\t}\n\n\t/**\n\t * Sets the value/state of the selected `Radio` within the `RadioGroup` to the passed in value.\n\t */\n\t@Input()\n\tset value(newValue: any) {\n\t\tif (this._value !== newValue) {\n\t\t\tthis._value = newValue;\n\n\t\t\tthis.updateSelectedRadioFromValue();\n\t\t\tthis.checkSelectedRadio();\n\t\t}\n\t}\n\n\t/**\n\t * Returns the value/state of the selected `Radio` within the `RadioGroup`.\n\t */\n\tget value() {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * Replaces the name associated with the `RadioGroup` with the provided parameter.\n\t */\n\t@Input()\n\tset name(name: string) {\n\t\tthis._name = name;\n\t\tthis.updateRadios();\n\t}\n\t/**\n\t * Returns the associated name of the `RadioGroup`.\n\t */\n\tget name() {\n\t\treturn this._name;\n\t}\n\n\t/**\n\t * Set to true to disable the whole radio group\n\t */\n\t@Input()\n\tset disabled(disabled: boolean) {\n\t\tthis._disabled = disabled;\n\t\tthis.updateRadios();\n\t}\n\t/**\n\t * Returns the disabled value for the `RadioGroup`.\n\t */\n\tget disabled(): boolean {\n\t\treturn this._disabled;\n\t}\n\n\t/**\n\t * Returns the skeleton value in the `RadioGroup` if there is one.\n\t */\n\t@Input()\n\tget skeleton(): any {\n\t\treturn this._skeleton;\n\t}\n\n\t/**\n\t * Sets the skeleton value for all `Radio` to the skeleton value of `RadioGroup`.\n\t */\n\tset skeleton(value: any) {\n\t\tthis._skeleton = value;\n\t\tthis.updateChildren();\n\t}\n\t/**\n\t * Used for creating the `RadioGroup` 'name' property dynamically.\n\t */\n\tstatic radioGroupCount = 0;\n\n\t@Input() orientation: \"horizontal\" | \"vertical\" = \"horizontal\";\n\n\t@Input() labelPlacement: \"right\" | \"left\" = \"right\";\n\n\t@Input() legend: string | TemplateRef<any>;\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\n\t/**\n\t * Used to set the `aria-label` attribute on the radio group element.\n\t */\n\t@Input() ariaLabel: string;\n\n\t/**\n\t * Used to set the `aria-labelledby` attribute on the radio group element.\n\t */\n\t@Input() ariaLabelledby: string;\n\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\n\t/**\n\t * Set to `true` to show the invalid state.\n\t */\n\t@Input() invalid = false;\n\n\t/**\n\t * Value displayed if combobox is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\n\t/**\n\t* Set to `true` to show a warning (contents set by warnText)\n\t*/\n\t@Input() warn = false;\n\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\n\t/**\n\t * Emits event notifying other classes of a change using a `RadioChange` class.\n\t */\n\t@Output() change: EventEmitter<RadioChange> = new EventEmitter<RadioChange>();\n\n\t/**\n\t * The `Radio` input items in the `RadioGroup`.\n\t */\n\t// tslint:disable-next-line:no-forward-ref\n\t@ContentChildren(forwardRef(() => Radio)) radios: QueryList<Radio>;\n\n\t/**\n\t * Binds 'cds--form-item' value to the class for `RadioGroup`.\n\t */\n\t@HostBinding(\"class.cds--form-item\") radioButtonGroupClass = true;\n\n\t/**\n\t * To track whether the `RadioGroup` has been initialized.\n\t */\n\tprotected isInitialized = false;\n\t/**\n\t * Reflects whether or not the input is disabled and cannot be selected.\n\t */\n\tprotected _disabled = false;\n\t/**\n\t * Reflects whether or not the dropdown is loading.\n\t */\n\tprotected _skeleton = false;\n\t/**\n\t * The value of the selected option within the `RadioGroup`.\n\t */\n\tprotected _value: any = null;\n\t/**\n\t * The `Radio` within the `RadioGroup` that is selected.\n\t */\n\tprotected _selected: Radio = null;\n\t/**\n\t * The name attribute associated with the `RadioGroup`.\n\t */\n\tprotected _name = `radio-group-${RadioGroup.radioGroupCount++}`;\n\n\t/**\n\t * Updates the selected `Radio` to be checked (selected).\n\t */\n\tcheckSelectedRadio() {\n\t\tif (this.selected && !this._selected.checked) {\n\t\t\tthis.selected.checked = true;\n\t\t}\n\t}\n\n\t/**\n\t * Use the value of the `RadioGroup` to update the selected radio to the right state (selected state).\n\t */\n\tupdateSelectedRadioFromValue() {\n\t\tlet alreadySelected = this._selected != null && this._selected.value === this._value;\n\t\tif (this.radios && !alreadySelected) {\n\t\t\tif (this.selected && this.value) {\n\t\t\t\tthis.selected.checked = false;\n\t\t\t}\n\t\t\tthis._selected = null;\n\t\t\tthis.radios.forEach(radio => {\n\t\t\t\tif (radio.checked || radio.value === this._value) {\n\t\t\t\t\tthis._selected = radio;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (this.selected && !this.value) {\n\t\t\t\tthis._value = this.selected.value;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the `RadioGroup`.\n\t *\n\t * ex: `this.formGroup.get(\"myRadioGroup\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the inputs\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Creates a class of `RadioChange` to emit the change in the `RadioGroup`.\n\t */\n\temitChangeEvent(event: RadioChange) {\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(event.value);\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Synchronizes radio properties.\n\t */\n\tupdateRadios() {\n\t\tif (this.radios) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.radios.forEach(radio => {\n\t\t\t\t\tradio.name = this.name;\n\t\t\t\t\tradio.setDisabledFromGroup(this.disabled);\n\t\t\t\t\tif (this.labelPlacement === \"left\") {\n\t\t\t\t\t\tradio.labelPlacement = \"left\";\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Updates the value of the `RadioGroup` using the provided parameter.\n\t */\n\twriteValue(value: any) {\n\t\tthis.value = value;\n\t\tsetTimeout(() => {\n\t\t\tthis.updateSelectedRadioFromValue();\n\t\t\tthis.checkSelectedRadio();\n\t\t});\n\t}\n\n\tngAfterContentInit() {\n\t\tthis.radios.changes.subscribe(() => {\n\t\t\tthis.updateRadios();\n\t\t\tthis.updateRadioChangeHandler();\n\t\t});\n\n\t\tthis.updateChildren();\n\t\tthis.updateRadioChangeHandler();\n\t}\n\n\tngAfterViewInit() {\n\t\tthis.updateRadios();\n\t}\n\n\t/**\n\t * Used to set method to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the checkbox is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Needed to properly implement ControlValueAccessor.\n\t */\n\tonTouched: () => any = () => {};\n\n\t/**\n\t * Method set in registerOnChange to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => {};\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\tprotected updateChildren() {\n\t\tif (this.radios) {\n\t\t\tthis.radios.forEach(child => child.skeleton = this.skeleton);\n\t\t}\n\t}\n\n\tprotected updateRadioChangeHandler() {\n\t\tthis.radios.forEach(radio => {\n\t\t\tradio.registerRadioChangeHandler((event: RadioChange) => {\n\t\t\t\tif ((this.selected && this.selected.value) === event.value) {\n\t\t\t\t\t// no need to redo\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// deselect previous radio\n\t\t\t\tif (this.selected) {\n\t\t\t\t\tthis.selected.checked = false;\n\t\t\t\t}\n\t\t\t\t// update selected and value from the event\n\t\t\t\tthis._selected = event.source;\n\t\t\t\tthis._value = event.value;\n\t\t\t\t// bubble the event\n\t\t\t\tthis.emitChangeEvent(event);\n\t\t\t});\n\t\t});\n\t}\n}\n",
|
|
51479
|
+
"sourceCode": "import {\n\tAfterContentInit,\n\tContentChildren,\n\tComponent,\n\tEventEmitter,\n\tforwardRef,\n\tInput,\n\tOutput,\n\tQueryList,\n\tHostBinding,\n\tAfterViewInit,\n\tHostListener,\n\tTemplateRef,\n\tOnDestroy\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\nimport { Radio } from \"./radio.component\";\nimport { RadioChange } from \"./radio-change.class\";\nimport { Subscription } from \"rxjs/internal/Subscription\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { RadioModule } from 'carbon-components-angular';\n * ```\n *\n * Ex:\n *\n * ```html\n * <cds-radio-group [(ngModel)]=\"radio\">\n * \t<cds-radio *ngFor=\"let one of manyRadios\" [value]=\"one\">\n *\t\tRadio {{one}}\n * \t</cds-radio>\n * </cds-radio-group>\n *\n * Radio selected: {{radio}}\n * ```\n *\n * ```ts\n *\tconst manyRadios = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\"];\n * ```\n *\n * [See demo](../../?path=/story/components-radio--basic)\n */\n@Component({\n\tselector: \"cds-radio-group, ibm-radio-group\",\n\ttemplate: `\n\t\t<fieldset\n\t\t\tclass=\"cds--radio-button-group\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t[attr.aria-labelledby]=\"ariaLabelledby\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--radio-button-group--vertical': orientation === 'vertical',\n\t\t\t\t'cds--radio-button-group--label-left': labelPlacement === 'left',\n\t\t\t\t'cds--radio-button-group--invalid': invalid,\n\t\t\t\t'cds--radio-button-group--warning': !invalid && warn,\n\t\t\t\t'cds--radio-button-group--decorator': !!decorator\n\t\t\t}\"\n\t\t\t[attr.data-invalid]=\"invalid ? true : null\">\n\t\t\t<legend *ngIf=\"legend\" class=\"cds--label\">\n\t\t\t\t<ng-template *ngIf=\"isTemplate(legend); else legendLabel;\" [ngTemplateOutlet]=\"legend\"></ng-template>\n\t\t\t\t<ng-template #legendLabel>{{legend}}</ng-template>\n\t\t\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t<div class=\"cds--radio-button-group-inner--decorator\">\n\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\n\t\t\t</legend>\n\t\t\t<ng-content></ng-content>\n\t\t</fieldset>\n\t\t<div class=\"cds--radio-button__validation-msg\">\n\t\t\t<ng-container *ngIf=\"invalid\">\n\t\t\t\t<svg\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--radio-button__invalid-icon\">\n\t\t\t\t</svg>\n\t\t\t\t<div class=\"cds--form-requirement\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t\t<ng-container *ngIf=\"!invalid && warn\">\n\t\t\t\t<svg\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tclass=\"cds--radio-button__invalid-icon cds--radio-button__invalid-icon--warning\"\n\t\t\t\t\tsize=\"16\">\n\t\t\t\t</svg>\n\t\t\t\t<div class=\"cds--form-requirement\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t</div>\n\t\t<div\n\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: RadioGroup,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class RadioGroup implements AfterContentInit, AfterViewInit, OnDestroy, ControlValueAccessor {\n\n\t/**\n\t * Sets the passed in `Radio` item as the selected input within the `RadioGroup`.\n\t */\n\t@Input()\n\tset selected(selected: Radio | null) {\n\t\tconst alreadySelected = (this._selected && this._selected.value) === (selected && selected.value);\n\t\tif (alreadySelected) {\n\t\t\t// no need to redo\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._selected) {\n\t\t\tthis._selected.checked = false;\n\t\t}\n\t\tthis._selected = selected;\n\t\tthis.value = selected ? selected.value : null;\n\t\tthis.checkSelectedRadio();\n\t}\n\n\t/**\n\t * Returns the `Radio` that is selected within the `RadioGroup`.\n\t */\n\tget selected() {\n\t\treturn this._selected;\n\t}\n\n\t/**\n\t * Sets the value/state of the selected `Radio` within the `RadioGroup` to the passed in value.\n\t */\n\t@Input()\n\tset value(newValue: any) {\n\t\tif (this._value !== newValue) {\n\t\t\tthis._value = newValue;\n\n\t\t\tthis.updateSelectedRadioFromValue();\n\t\t\tthis.checkSelectedRadio();\n\t\t}\n\t}\n\n\t/**\n\t * Returns the value/state of the selected `Radio` within the `RadioGroup`.\n\t */\n\tget value() {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * Replaces the name associated with the `RadioGroup` with the provided parameter.\n\t */\n\t@Input()\n\tset name(name: string) {\n\t\tthis._name = name;\n\t\tthis.updateRadios();\n\t}\n\t/**\n\t * Returns the associated name of the `RadioGroup`.\n\t */\n\tget name() {\n\t\treturn this._name;\n\t}\n\n\t/**\n\t * Set to true to disable the whole radio group\n\t */\n\t@Input()\n\tset disabled(disabled: boolean) {\n\t\tthis._disabled = disabled;\n\t\tthis.updateRadios();\n\t}\n\t/**\n\t * Returns the disabled value for the `RadioGroup`.\n\t */\n\tget disabled(): boolean {\n\t\treturn this._disabled;\n\t}\n\n\t/**\n\t * Returns the skeleton value in the `RadioGroup` if there is one.\n\t */\n\t@Input()\n\tget skeleton(): any {\n\t\treturn this._skeleton;\n\t}\n\n\t/**\n\t * Sets the skeleton value for all `Radio` to the skeleton value of `RadioGroup`.\n\t */\n\tset skeleton(value: any) {\n\t\tthis._skeleton = value;\n\t\tthis.updateChildren();\n\t}\n\t/**\n\t * Used for creating the `RadioGroup` 'name' property dynamically.\n\t */\n\tstatic radioGroupCount = 0;\n\n\t@Input() orientation: \"horizontal\" | \"vertical\" = \"horizontal\";\n\n\t@Input() labelPlacement: \"right\" | \"left\" = \"right\";\n\n\t@Input() legend: string | TemplateRef<any>;\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\n\t/**\n\t * Used to set the `aria-label` attribute on the radio group element.\n\t */\n\t@Input() ariaLabel: string;\n\n\t/**\n\t * Used to set the `aria-labelledby` attribute on the radio group element.\n\t */\n\t@Input() ariaLabelledby: string;\n\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\n\t/**\n\t * Set to `true` to show the invalid state.\n\t */\n\t@Input() invalid = false;\n\n\t/**\n\t * Value displayed if combobox is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\n\t/**\n\t* Set to `true` to show a warning (contents set by warnText)\n\t*/\n\t@Input() warn = false;\n\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\n\t/**\n\t * Emits event notifying other classes of a change using a `RadioChange` class.\n\t */\n\t@Output() change: EventEmitter<RadioChange> = new EventEmitter<RadioChange>();\n\n\t/**\n\t * The `Radio` input items in the `RadioGroup`.\n\t */\n\t// tslint:disable-next-line:no-forward-ref\n\t@ContentChildren(forwardRef(() => Radio)) radios: QueryList<Radio>;\n\n\t/**\n\t * Binds 'cds--form-item' value to the class for `RadioGroup`.\n\t */\n\t@HostBinding(\"class.cds--form-item\") radioButtonGroupClass = true;\n\n\t/**\n\t * To track whether the `RadioGroup` has been initialized.\n\t */\n\tprotected isInitialized = false;\n\t/**\n\t * Reflects whether or not the input is disabled and cannot be selected.\n\t */\n\tprotected _disabled = false;\n\t/**\n\t * Reflects whether or not the dropdown is loading.\n\t */\n\tprotected _skeleton = false;\n\t/**\n\t * The value of the selected option within the `RadioGroup`.\n\t */\n\tprotected _value: any = null;\n\t/**\n\t * The `Radio` within the `RadioGroup` that is selected.\n\t */\n\tprotected _selected: Radio = null;\n\t/**\n\t * The name attribute associated with the `RadioGroup`.\n\t */\n\tprotected _name = `radio-group-${RadioGroup.radioGroupCount++}`;\n\n\tprivate subscription = new Subscription();\n\n\t/**\n\t * Updates the selected `Radio` to be checked (selected).\n\t */\n\tcheckSelectedRadio() {\n\t\tif (this.selected && !this._selected.checked) {\n\t\t\tthis.selected.checked = true;\n\t\t}\n\t}\n\n\t/**\n\t * Use the value of the `RadioGroup` to update the selected radio to the right state (selected state).\n\t */\n\tupdateSelectedRadioFromValue() {\n\t\tlet alreadySelected = this._selected != null && this._selected.value === this._value;\n\t\tif (this.radios && !alreadySelected) {\n\t\t\tif (this.selected && this.value) {\n\t\t\t\tthis.selected.checked = false;\n\t\t\t}\n\t\t\tthis._selected = null;\n\t\t\tthis.radios.forEach(radio => {\n\t\t\t\tif (radio.checked || radio.value === this._value) {\n\t\t\t\t\tthis._selected = radio;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (this.selected && !this.value) {\n\t\t\t\tthis._value = this.selected.value;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the `RadioGroup`.\n\t *\n\t * ex: `this.formGroup.get(\"myRadioGroup\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the inputs\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Creates a class of `RadioChange` to emit the change in the `RadioGroup`.\n\t */\n\temitChangeEvent(event: RadioChange) {\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(event.value);\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Synchronizes radio properties.\n\t */\n\tupdateRadios() {\n\t\tif (this.radios) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.radios.forEach(radio => {\n\t\t\t\t\tradio.name = this.name;\n\t\t\t\t\tradio.setDisabledFromGroup(this.disabled);\n\t\t\t\t\tif (this.labelPlacement === \"left\") {\n\t\t\t\t\t\tradio.labelPlacement = \"left\";\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Updates the value of the `RadioGroup` using the provided parameter.\n\t */\n\twriteValue(value: any) {\n\t\tthis.value = value;\n\t}\n\n\tngAfterContentInit() {\n\t\tthis.subscription.add(\n\t\t\tthis.radios.changes.subscribe(() => {\n\t\t\t\tif (this.value) {\n\t\t\t\t\tif (this.selected) {\n\t\t\t\t\t\tthis._selected = null;\n\t\t\t\t\t}\n\t\t\t\t\tthis.updateSelectedRadioFromValue();\n\t\t\t\t\tthis.checkSelectedRadio();\n\t\t\t\t}\n\t\t\t\tthis.updateRadios();\n\t\t\t\tthis.updateRadioChangeHandler();\n\t\t\t})\n\t\t);\n\n\t\tif (this.value) {\n\t\t\tthis.updateSelectedRadioFromValue();\n\t\t\tthis.checkSelectedRadio();\n\t\t}\n\n\t\tthis.updateChildren();\n\t\tthis.updateRadioChangeHandler();\n\t}\n\n\tngAfterViewInit() {\n\t\tthis.updateRadios();\n\t}\n\n\tngOnDestroy() {\n\t\tthis.subscription.unsubscribe();\n\t}\n\n\t/**\n\t * Used to set method to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the checkbox is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Needed to properly implement ControlValueAccessor.\n\t */\n\tonTouched: () => any = () => {};\n\n\t/**\n\t * Method set in registerOnChange to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => {};\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\tprotected updateChildren() {\n\t\tif (this.radios) {\n\t\t\tthis.radios.forEach(child => child.skeleton = this.skeleton);\n\t\t}\n\t}\n\n\tprotected updateRadioChangeHandler() {\n\t\tthis.radios.forEach(radio => {\n\t\t\tradio.registerRadioChangeHandler((event: RadioChange) => {\n\t\t\t\tif ((this.selected && this.selected.value) === event.value) {\n\t\t\t\t\t// no need to redo\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// deselect previous radio\n\t\t\t\tif (this.selected) {\n\t\t\t\t\tthis.selected.checked = false;\n\t\t\t\t}\n\t\t\t\t// update selected and value from the event\n\t\t\t\tthis._selected = event.source;\n\t\t\t\tthis._value = event.value;\n\t\t\t\t// bubble the event\n\t\t\t\tthis.emitChangeEvent(event);\n\t\t\t});\n\t\t});\n\t}\n}\n",
|
|
51369
51480
|
"assetsDirs": [],
|
|
51370
51481
|
"styleUrlsData": "",
|
|
51371
51482
|
"stylesData": "",
|
|
@@ -51373,6 +51484,7 @@
|
|
|
51373
51484
|
"implements": [
|
|
51374
51485
|
"AfterContentInit",
|
|
51375
51486
|
"AfterViewInit",
|
|
51487
|
+
"OnDestroy",
|
|
51376
51488
|
"ControlValueAccessor"
|
|
51377
51489
|
],
|
|
51378
51490
|
"accessors": {
|
|
@@ -51392,7 +51504,7 @@
|
|
|
51392
51504
|
}
|
|
51393
51505
|
],
|
|
51394
51506
|
"returnType": "void",
|
|
51395
|
-
"line":
|
|
51507
|
+
"line": 118,
|
|
51396
51508
|
"rawdescription": "\n\nSets the passed in `Radio` item as the selected input within the `RadioGroup`.\n",
|
|
51397
51509
|
"description": "<p>Sets the passed in <code>Radio</code> item as the selected input within the <code>RadioGroup</code>.</p>\n",
|
|
51398
51510
|
"jsdoctags": [
|
|
@@ -51411,7 +51523,7 @@
|
|
|
51411
51523
|
"name": "selected",
|
|
51412
51524
|
"type": "",
|
|
51413
51525
|
"returnType": "",
|
|
51414
|
-
"line":
|
|
51526
|
+
"line": 136,
|
|
51415
51527
|
"rawdescription": "\n\nReturns the `Radio` that is selected within the `RadioGroup`.\n",
|
|
51416
51528
|
"description": "<p>Returns the <code>Radio</code> that is selected within the <code>RadioGroup</code>.</p>\n"
|
|
51417
51529
|
}
|
|
@@ -51432,7 +51544,7 @@
|
|
|
51432
51544
|
}
|
|
51433
51545
|
],
|
|
51434
51546
|
"returnType": "void",
|
|
51435
|
-
"line":
|
|
51547
|
+
"line": 144,
|
|
51436
51548
|
"rawdescription": "\n\nSets the value/state of the selected `Radio` within the `RadioGroup` to the passed in value.\n",
|
|
51437
51549
|
"description": "<p>Sets the value/state of the selected <code>Radio</code> within the <code>RadioGroup</code> to the passed in value.</p>\n",
|
|
51438
51550
|
"jsdoctags": [
|
|
@@ -51451,7 +51563,7 @@
|
|
|
51451
51563
|
"name": "value",
|
|
51452
51564
|
"type": "",
|
|
51453
51565
|
"returnType": "",
|
|
51454
|
-
"line":
|
|
51566
|
+
"line": 156,
|
|
51455
51567
|
"rawdescription": "\n\nReturns the value/state of the selected `Radio` within the `RadioGroup`.\n",
|
|
51456
51568
|
"description": "<p>Returns the value/state of the selected <code>Radio</code> within the <code>RadioGroup</code>.</p>\n"
|
|
51457
51569
|
}
|
|
@@ -51472,7 +51584,7 @@
|
|
|
51472
51584
|
}
|
|
51473
51585
|
],
|
|
51474
51586
|
"returnType": "void",
|
|
51475
|
-
"line":
|
|
51587
|
+
"line": 164,
|
|
51476
51588
|
"rawdescription": "\n\nReplaces the name associated with the `RadioGroup` with the provided parameter.\n",
|
|
51477
51589
|
"description": "<p>Replaces the name associated with the <code>RadioGroup</code> with the provided parameter.</p>\n",
|
|
51478
51590
|
"jsdoctags": [
|
|
@@ -51491,7 +51603,7 @@
|
|
|
51491
51603
|
"name": "name",
|
|
51492
51604
|
"type": "",
|
|
51493
51605
|
"returnType": "",
|
|
51494
|
-
"line":
|
|
51606
|
+
"line": 171,
|
|
51495
51607
|
"rawdescription": "\n\nReturns the associated name of the `RadioGroup`.\n",
|
|
51496
51608
|
"description": "<p>Returns the associated name of the <code>RadioGroup</code>.</p>\n"
|
|
51497
51609
|
}
|
|
@@ -51512,7 +51624,7 @@
|
|
|
51512
51624
|
}
|
|
51513
51625
|
],
|
|
51514
51626
|
"returnType": "void",
|
|
51515
|
-
"line":
|
|
51627
|
+
"line": 179,
|
|
51516
51628
|
"rawdescription": "\n\nSet to true to disable the whole radio group\n",
|
|
51517
51629
|
"description": "<p>Set to true to disable the whole radio group</p>\n",
|
|
51518
51630
|
"jsdoctags": [
|
|
@@ -51531,7 +51643,7 @@
|
|
|
51531
51643
|
"name": "disabled",
|
|
51532
51644
|
"type": "boolean",
|
|
51533
51645
|
"returnType": "boolean",
|
|
51534
|
-
"line":
|
|
51646
|
+
"line": 186,
|
|
51535
51647
|
"rawdescription": "\n\nReturns the disabled value for the `RadioGroup`.\n",
|
|
51536
51648
|
"description": "<p>Returns the disabled value for the <code>RadioGroup</code>.</p>\n"
|
|
51537
51649
|
}
|
|
@@ -51552,7 +51664,7 @@
|
|
|
51552
51664
|
}
|
|
51553
51665
|
],
|
|
51554
51666
|
"returnType": "void",
|
|
51555
|
-
"line":
|
|
51667
|
+
"line": 201,
|
|
51556
51668
|
"rawdescription": "\n\nSets the skeleton value for all `Radio` to the skeleton value of `RadioGroup`.\n",
|
|
51557
51669
|
"description": "<p>Sets the skeleton value for all <code>Radio</code> to the skeleton value of <code>RadioGroup</code>.</p>\n",
|
|
51558
51670
|
"jsdoctags": [
|
|
@@ -51571,7 +51683,7 @@
|
|
|
51571
51683
|
"name": "skeleton",
|
|
51572
51684
|
"type": "any",
|
|
51573
51685
|
"returnType": "any",
|
|
51574
|
-
"line":
|
|
51686
|
+
"line": 194,
|
|
51575
51687
|
"rawdescription": "\n\nReturns the skeleton value in the `RadioGroup` if there is one.\n",
|
|
51576
51688
|
"description": "<p>Returns the skeleton value in the <code>RadioGroup</code> if there is one.</p>\n"
|
|
51577
51689
|
}
|
|
@@ -51580,7 +51692,7 @@
|
|
|
51580
51692
|
},
|
|
51581
51693
|
{
|
|
51582
51694
|
"name": "ReactiveFormsCombobox",
|
|
51583
|
-
"id": "component-ReactiveFormsCombobox-
|
|
51695
|
+
"id": "component-ReactiveFormsCombobox-9f2cbdf9b54c8033cabf6aa1f6ddd138e0797c6146ab99c0334d15f4cdf9539f5795e50bdb5fbf2bb4815c6aae3d0b82135d120f91b5f9db40313d0cae3aa73e",
|
|
51584
51696
|
"file": "src/combobox/stories/app-reactive-combobox.component.ts",
|
|
51585
51697
|
"encapsulation": [],
|
|
51586
51698
|
"entryComponents": [],
|
|
@@ -51590,7 +51702,7 @@
|
|
|
51590
51702
|
"selector": "app-reactive-combobox",
|
|
51591
51703
|
"styleUrls": [],
|
|
51592
51704
|
"styles": [],
|
|
51593
|
-
"template": "<form [formGroup]=\"sampleForm\" (ngSubmit)=\"onSubmit(sampleForm)\">\n\t<cds-combo-box\n\t\tformControlName=\"combobox\"\n\t\t[size]=\"size\"\n\t\t[label]=\"label\"\n\t\t[helperText]=\"helperText\"\n\t\
|
|
51705
|
+
"template": "<form [formGroup]=\"sampleForm\" (ngSubmit)=\"onSubmit(sampleForm)\">\n\t<cds-combo-box\n\t\tformControlName=\"combobox\"\n\t\t[size]=\"size\"\n\t\t[label]=\"label\"\n\t\t[helperText]=\"helperText\"\n\t\t[itemValueKey]=\"itemValueKey\"\n\t\t[theme]=\"theme\"\n\t\t[invalid]=\"invalid\"\n\t\t[invalidText]=\"invalidText\"\n\t\t[warn]=\"warn\"\n\t\t[warnText]=\"warnText\"\n\t\t[items]=\"_items\">\n\t\t<cds-dropdown-list></cds-dropdown-list>\n\t</cds-combo-box>\n\tselected: {{ sampleForm.get(\"combobox\").value | json }}\n\t<cds-combo-box\n\t\tstyle=\"margin-top: 40px\"\n\t\tformControlName=\"multibox\"\n\t\t[label]=\"label\"\n\t\t[size]=\"size\"\n\t\t[itemValueKey]=\"itemValueKey\"\n\t\t[helperText]=\"helperText\"\n\t\ttype=\"multi\"\n\t\t[invalid]=\"invalid\"\n\t\t[invalidText]=\"invalidText\"\n\t\t[warn]=\"warn\"\n\t\t[warnText]=\"warnText\"\n\t\t[items]=\"_items\">\n\t\t<cds-dropdown-list></cds-dropdown-list>\n\t</cds-combo-box>\n\tselected: {{ sampleForm.get(\"multibox\").value | json }}\n</form>\n\t",
|
|
51594
51706
|
"templateUrl": [],
|
|
51595
51707
|
"viewProviders": [],
|
|
51596
51708
|
"hostDirectives": [],
|
|
@@ -51599,7 +51711,7 @@
|
|
|
51599
51711
|
"name": "disabled",
|
|
51600
51712
|
"deprecated": false,
|
|
51601
51713
|
"deprecationMessage": "",
|
|
51602
|
-
"line":
|
|
51714
|
+
"line": 70,
|
|
51603
51715
|
"type": "boolean",
|
|
51604
51716
|
"decorators": []
|
|
51605
51717
|
},
|
|
@@ -51634,10 +51746,19 @@
|
|
|
51634
51746
|
"name": "items",
|
|
51635
51747
|
"deprecated": false,
|
|
51636
51748
|
"deprecationMessage": "",
|
|
51637
|
-
"line":
|
|
51749
|
+
"line": 62,
|
|
51638
51750
|
"type": "Array<any>",
|
|
51639
51751
|
"decorators": []
|
|
51640
51752
|
},
|
|
51753
|
+
{
|
|
51754
|
+
"name": "itemValueKey",
|
|
51755
|
+
"defaultValue": "\"\"",
|
|
51756
|
+
"deprecated": false,
|
|
51757
|
+
"deprecationMessage": "",
|
|
51758
|
+
"line": 61,
|
|
51759
|
+
"type": "string",
|
|
51760
|
+
"decorators": []
|
|
51761
|
+
},
|
|
51641
51762
|
{
|
|
51642
51763
|
"name": "label",
|
|
51643
51764
|
"defaultValue": "\"\"",
|
|
@@ -51694,7 +51815,7 @@
|
|
|
51694
51815
|
"type": "any[]",
|
|
51695
51816
|
"optional": false,
|
|
51696
51817
|
"description": "",
|
|
51697
|
-
"line":
|
|
51818
|
+
"line": 80
|
|
51698
51819
|
},
|
|
51699
51820
|
{
|
|
51700
51821
|
"name": "sampleForm",
|
|
@@ -51719,7 +51840,7 @@
|
|
|
51719
51840
|
"description": "",
|
|
51720
51841
|
"rawdescription": "\n",
|
|
51721
51842
|
"type": "component",
|
|
51722
|
-
"sourceCode": "import {\n\tFormGroup,\n\tFormBuilder,\n\tFormControl\n} from \"@angular/forms\";\nimport {\n\tComponent,\n\tOnInit,\n\tInput\n} from \"@angular/core\";\nimport isEqual from \"lodash-es/isEqual\";\n\n@Component({\n\tselector: \"app-reactive-combobox\",\n\ttemplate: `\n\t\t<form [formGroup]=\"sampleForm\" (ngSubmit)=\"onSubmit(sampleForm)\">\n\t\t\t<cds-combo-box\n\t\t\t\tformControlName=\"combobox\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\
|
|
51843
|
+
"sourceCode": "import {\n\tFormGroup,\n\tFormBuilder,\n\tFormControl\n} from \"@angular/forms\";\nimport {\n\tComponent,\n\tOnInit,\n\tInput\n} from \"@angular/core\";\nimport isEqual from \"lodash-es/isEqual\";\n\n@Component({\n\tselector: \"app-reactive-combobox\",\n\ttemplate: `\n\t\t<form [formGroup]=\"sampleForm\" (ngSubmit)=\"onSubmit(sampleForm)\">\n\t\t\t<cds-combo-box\n\t\t\t\tformControlName=\"combobox\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[items]=\"_items\">\n\t\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t\t</cds-combo-box>\n\t\t\tselected: {{ sampleForm.get(\"combobox\").value | json }}\n\t\t\t<cds-combo-box\n\t\t\t\tstyle=\"margin-top: 40px\"\n\t\t\t\tformControlName=\"multibox\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\ttype=\"multi\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[items]=\"_items\">\n\t\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t\t</cds-combo-box>\n\t\t\tselected: {{ sampleForm.get(\"multibox\").value | json }}\n\t\t</form>\n\t`\n})\nexport class ReactiveFormsCombobox implements OnInit {\n\tpublic sampleForm: FormGroup;\n\t@Input() invalid = false;\n\t@Input() invalidText = \"\";\n\t@Input() warn = false;\n\t@Input() warnText = \"\";\n\t@Input() label = \"\";\n\t@Input() helperText = \"\";\n\t@Input() size = \"md\";\n\t@Input() theme = \"dark\";\n\t@Input() itemValueKey = \"\";\n\t@Input() set items(newItems: Array<any>) {\n\t\tif (!newItems.length) {\n\t\t\tnewItems = [];\n\t\t}\n\t\tif (!isEqual(this._items, newItems)) {\n\t\t\tthis._items = newItems;\n\t\t}\n\t}\n\t@Input() set disabled(isDisabled: boolean) {\n\t\tif (this.sampleForm) {\n\t\t\tif (isDisabled) {\n\t\t\t\tthis.sampleForm.disable();\n\t\t\t} else {\n\t\t\t\tthis.sampleForm.enable();\n\t\t\t}\n\t\t}\n\t}\n\n\t_items: any[] = [];\n\n\tconstructor(private fb: FormBuilder) {}\n\n\tngOnInit() {\n\t\tthis.sampleForm = this.fb.group({\n\t\t\tcombobox: new FormControl,\n\t\t\tmultibox: new FormControl\n\t\t});\n\n\t\tthis.sampleForm.get(\"combobox\")?.setValue(\"four\");\n\t\tthis.sampleForm.get(\"multibox\")?.setValue([\"four\", \"two\"]);\n\t}\n}\n",
|
|
51723
51844
|
"assetsDirs": [],
|
|
51724
51845
|
"styleUrlsData": "",
|
|
51725
51846
|
"stylesData": "",
|
|
@@ -51736,7 +51857,7 @@
|
|
|
51736
51857
|
"deprecationMessage": ""
|
|
51737
51858
|
}
|
|
51738
51859
|
],
|
|
51739
|
-
"line":
|
|
51860
|
+
"line": 80,
|
|
51740
51861
|
"jsdoctags": [
|
|
51741
51862
|
{
|
|
51742
51863
|
"name": "fb",
|
|
@@ -51770,7 +51891,7 @@
|
|
|
51770
51891
|
}
|
|
51771
51892
|
],
|
|
51772
51893
|
"returnType": "void",
|
|
51773
|
-
"line":
|
|
51894
|
+
"line": 62,
|
|
51774
51895
|
"jsdoctags": [
|
|
51775
51896
|
{
|
|
51776
51897
|
"name": "newItems",
|
|
@@ -51800,7 +51921,7 @@
|
|
|
51800
51921
|
}
|
|
51801
51922
|
],
|
|
51802
51923
|
"returnType": "void",
|
|
51803
|
-
"line":
|
|
51924
|
+
"line": 70,
|
|
51804
51925
|
"jsdoctags": [
|
|
51805
51926
|
{
|
|
51806
51927
|
"name": "isDisabled",
|
|
@@ -52004,7 +52125,7 @@
|
|
|
52004
52125
|
},
|
|
52005
52126
|
{
|
|
52006
52127
|
"name": "ReactiveFormsStory",
|
|
52007
|
-
"id": "component-ReactiveFormsStory-
|
|
52128
|
+
"id": "component-ReactiveFormsStory-22fea6f676798dd7aad8e8be5239ab157a6fa134f2a45d66b63a6bc1084e1a6be9e4f085c4c4b5c638c4ce42d9bea1f7f8c03d93809bc2818358d2ffeda37f6b-1",
|
|
52008
52129
|
"file": "src/dropdown/stories/app-reactive-forms.component.ts",
|
|
52009
52130
|
"encapsulation": [],
|
|
52010
52131
|
"entryComponents": [],
|
|
@@ -52014,7 +52135,7 @@
|
|
|
52014
52135
|
"selector": "app-reactive-forms",
|
|
52015
52136
|
"styleUrls": [],
|
|
52016
52137
|
"styles": [],
|
|
52017
|
-
"template": "<form [formGroup]=\"formGroup\">\n\t<div style=\"width: 300px\">\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\tplaceholder=\"Multi-select\"\n\t\t\tvalue=\"oid\"\n\t\t\t(selected)=\"selected.emit($event)\"\n\t\t\t(onClose)=\"onClose.emit($event)\"\n\t\t\tformControlName=\"roles\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t</div>\n</form>\n<br>\n<code>{{ formGroup.get(\"roles\").value | json }}</code>\n\t",
|
|
52138
|
+
"template": "<form [formGroup]=\"formGroup\">\n\t<div style=\"width: 300px\">\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\tplaceholder=\"Multi-select\"\n\t\t\tvalue=\"oid\"\n\t\t\t(selected)=\"selected.emit($event)\"\n\t\t\t(onClose)=\"onClose.emit($event)\"\n\t\t\tformControlName=\"roles\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t</div>\n</form>\n<br>\n<code>{{ formGroup.get(\"roles\").value | json }}</code>\n\t",
|
|
52018
52139
|
"templateUrl": [],
|
|
52019
52140
|
"viewProviders": [],
|
|
52020
52141
|
"hostDirectives": [],
|
|
@@ -52023,7 +52144,7 @@
|
|
|
52023
52144
|
"name": "disabled",
|
|
52024
52145
|
"deprecated": false,
|
|
52025
52146
|
"deprecationMessage": "",
|
|
52026
|
-
"line":
|
|
52147
|
+
"line": 52,
|
|
52027
52148
|
"type": "boolean",
|
|
52028
52149
|
"decorators": []
|
|
52029
52150
|
},
|
|
@@ -52032,7 +52153,7 @@
|
|
|
52032
52153
|
"defaultValue": "\"\"",
|
|
52033
52154
|
"deprecated": false,
|
|
52034
52155
|
"deprecationMessage": "",
|
|
52035
|
-
"line":
|
|
52156
|
+
"line": 47,
|
|
52036
52157
|
"type": "string",
|
|
52037
52158
|
"decorators": []
|
|
52038
52159
|
},
|
|
@@ -52041,7 +52162,7 @@
|
|
|
52041
52162
|
"defaultValue": "false",
|
|
52042
52163
|
"deprecated": false,
|
|
52043
52164
|
"deprecationMessage": "",
|
|
52044
|
-
"line":
|
|
52165
|
+
"line": 46,
|
|
52045
52166
|
"type": "boolean",
|
|
52046
52167
|
"decorators": []
|
|
52047
52168
|
},
|
|
@@ -52050,7 +52171,7 @@
|
|
|
52050
52171
|
"defaultValue": "false",
|
|
52051
52172
|
"deprecated": false,
|
|
52052
52173
|
"deprecationMessage": "",
|
|
52053
|
-
"line":
|
|
52174
|
+
"line": 48,
|
|
52054
52175
|
"type": "boolean",
|
|
52055
52176
|
"decorators": []
|
|
52056
52177
|
},
|
|
@@ -52059,7 +52180,7 @@
|
|
|
52059
52180
|
"defaultValue": "\"\"",
|
|
52060
52181
|
"deprecated": false,
|
|
52061
52182
|
"deprecationMessage": "",
|
|
52062
|
-
"line":
|
|
52183
|
+
"line": 49,
|
|
52063
52184
|
"type": "string",
|
|
52064
52185
|
"decorators": []
|
|
52065
52186
|
},
|
|
@@ -52068,16 +52189,25 @@
|
|
|
52068
52189
|
"defaultValue": "[]",
|
|
52069
52190
|
"deprecated": false,
|
|
52070
52191
|
"deprecationMessage": "",
|
|
52071
|
-
"line":
|
|
52192
|
+
"line": 44,
|
|
52072
52193
|
"type": "{}",
|
|
52073
52194
|
"decorators": []
|
|
52074
52195
|
},
|
|
52196
|
+
{
|
|
52197
|
+
"name": "itemValueKey",
|
|
52198
|
+
"defaultValue": "\"\"",
|
|
52199
|
+
"deprecated": false,
|
|
52200
|
+
"deprecationMessage": "",
|
|
52201
|
+
"line": 51,
|
|
52202
|
+
"type": "string",
|
|
52203
|
+
"decorators": []
|
|
52204
|
+
},
|
|
52075
52205
|
{
|
|
52076
52206
|
"name": "label",
|
|
52077
52207
|
"defaultValue": "\"\"",
|
|
52078
52208
|
"deprecated": false,
|
|
52079
52209
|
"deprecationMessage": "",
|
|
52080
|
-
"line":
|
|
52210
|
+
"line": 45,
|
|
52081
52211
|
"type": "string",
|
|
52082
52212
|
"decorators": []
|
|
52083
52213
|
},
|
|
@@ -52086,7 +52216,7 @@
|
|
|
52086
52216
|
"defaultValue": "\"top-after-reopen\"",
|
|
52087
52217
|
"deprecated": false,
|
|
52088
52218
|
"deprecationMessage": "",
|
|
52089
|
-
"line":
|
|
52219
|
+
"line": 50,
|
|
52090
52220
|
"type": "string",
|
|
52091
52221
|
"decorators": []
|
|
52092
52222
|
}
|
|
@@ -52097,7 +52227,7 @@
|
|
|
52097
52227
|
"defaultValue": "new EventEmitter()",
|
|
52098
52228
|
"deprecated": false,
|
|
52099
52229
|
"deprecationMessage": "",
|
|
52100
|
-
"line":
|
|
52230
|
+
"line": 61,
|
|
52101
52231
|
"type": "EventEmitter"
|
|
52102
52232
|
},
|
|
52103
52233
|
{
|
|
@@ -52105,7 +52235,7 @@
|
|
|
52105
52235
|
"defaultValue": "new EventEmitter()",
|
|
52106
52236
|
"deprecated": false,
|
|
52107
52237
|
"deprecationMessage": "",
|
|
52108
|
-
"line":
|
|
52238
|
+
"line": 60,
|
|
52109
52239
|
"type": "EventEmitter"
|
|
52110
52240
|
}
|
|
52111
52241
|
],
|
|
@@ -52117,7 +52247,7 @@
|
|
|
52117
52247
|
"type": "FormGroup",
|
|
52118
52248
|
"optional": false,
|
|
52119
52249
|
"description": "",
|
|
52120
|
-
"line":
|
|
52250
|
+
"line": 42,
|
|
52121
52251
|
"modifierKind": [
|
|
52122
52252
|
125
|
|
52123
52253
|
]
|
|
@@ -52133,7 +52263,7 @@
|
|
|
52133
52263
|
"description": "",
|
|
52134
52264
|
"rawdescription": "\n",
|
|
52135
52265
|
"type": "component",
|
|
52136
|
-
"sourceCode": "import {\n\tComponent,\n\tOnInit,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\nimport {\n\tFormBuilder,\n\tFormGroup,\n\tFormControl\n} from \"@angular/forms\";\n\n@Component({\n\tselector: \"app-reactive-forms\",\n\ttemplate: `\n\t\t<form [formGroup]=\"formGroup\">\n\t\t\t<div style=\"width: 300px\">\n\t\t\t\t<cds-dropdown\n\t\t\t\t\t[label]=\"label\"\n\t\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[theme]=\"theme\"\n\t\t\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t\t\tplaceholder=\"Multi-select\"\n\t\t\t\t\tvalue=\"oid\"\n\t\t\t\t\t(selected)=\"selected.emit($event)\"\n\t\t\t\t\t(onClose)=\"onClose.emit($event)\"\n\t\t\t\t\tformControlName=\"roles\">\n\t\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t\t</cds-dropdown>\n\t\t\t</div>\n\t\t</form>\n\t\t<br>\n\t\t<code>{{ formGroup.get(\"roles\").value | json }}</code>\n\t`\n})\nexport class ReactiveFormsStory implements OnInit {\n\tpublic formGroup: FormGroup;\n\n\t@Input() items = [];\n\t@Input() label = \"\";\n\t@Input() hideLabel = false;\n\t@Input() helperText = \"\";\n\t@Input() invalid = false;\n\t@Input() invalidText = \"\";\n\t@Input() selectionFeedback = \"top-after-reopen\";\n\t@Input() set disabled(value: boolean) {\n\t\tif (!this.formGroup) { return; }\n\t\tif (value) {\n\t\t\tthis.formGroup.get(\"roles\")?.disable();\n\t\t} else {\n\t\t\tthis.formGroup.get(\"roles\")?.enable();\n\t\t}\n\t}\n\t@Output() selected = new EventEmitter();\n\t@Output() onClose = new EventEmitter();\n\n\tconstructor(protected formBuilder: FormBuilder) { }\n\n\tngOnInit() {\n\t\tthis.formGroup = this.formBuilder.group({\n\t\t\troles: new FormControl()\n\t\t});\n\t\tthis.selectRoles();\n\t}\n\n\tprivate selectRoles() {\n\t\tthis.formGroup.get(\"roles\")?.setValue(
|
|
52266
|
+
"sourceCode": "import {\n\tComponent,\n\tOnInit,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\nimport {\n\tFormBuilder,\n\tFormGroup,\n\tFormControl\n} from \"@angular/forms\";\n\n@Component({\n\tselector: \"app-reactive-forms\",\n\ttemplate: `\n\t\t<form [formGroup]=\"formGroup\">\n\t\t\t<div style=\"width: 300px\">\n\t\t\t\t<cds-dropdown\n\t\t\t\t\t[label]=\"label\"\n\t\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[theme]=\"theme\"\n\t\t\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t\t\tplaceholder=\"Multi-select\"\n\t\t\t\t\tvalue=\"oid\"\n\t\t\t\t\t(selected)=\"selected.emit($event)\"\n\t\t\t\t\t(onClose)=\"onClose.emit($event)\"\n\t\t\t\t\tformControlName=\"roles\">\n\t\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t\t</cds-dropdown>\n\t\t\t</div>\n\t\t</form>\n\t\t<br>\n\t\t<code>{{ formGroup.get(\"roles\").value | json }}</code>\n\t`\n})\nexport class ReactiveFormsStory implements OnInit {\n\tpublic formGroup: FormGroup;\n\n\t@Input() items = [];\n\t@Input() label = \"\";\n\t@Input() hideLabel = false;\n\t@Input() helperText = \"\";\n\t@Input() invalid = false;\n\t@Input() invalidText = \"\";\n\t@Input() selectionFeedback = \"top-after-reopen\";\n\t@Input() itemValueKey = \"\";\n\t@Input() set disabled(value: boolean) {\n\t\tif (!this.formGroup) { return; }\n\t\tif (value) {\n\t\t\tthis.formGroup.get(\"roles\")?.disable();\n\t\t} else {\n\t\t\tthis.formGroup.get(\"roles\")?.enable();\n\t\t}\n\t}\n\t@Output() selected = new EventEmitter();\n\t@Output() onClose = new EventEmitter();\n\n\tconstructor(protected formBuilder: FormBuilder) { }\n\n\tngOnInit() {\n\t\tthis.formGroup = this.formBuilder.group({\n\t\t\troles: new FormControl()\n\t\t});\n\t\tthis.selectRoles();\n\t}\n\n\tprivate selectRoles() {\n\t\tthis.formGroup.get(\"roles\")?.setValue(\"one\");\n\t}\n}\n",
|
|
52137
52267
|
"assetsDirs": [],
|
|
52138
52268
|
"styleUrlsData": "",
|
|
52139
52269
|
"stylesData": "",
|
|
@@ -52150,7 +52280,7 @@
|
|
|
52150
52280
|
"deprecationMessage": ""
|
|
52151
52281
|
}
|
|
52152
52282
|
],
|
|
52153
|
-
"line":
|
|
52283
|
+
"line": 61,
|
|
52154
52284
|
"jsdoctags": [
|
|
52155
52285
|
{
|
|
52156
52286
|
"name": "formBuilder",
|
|
@@ -52184,7 +52314,7 @@
|
|
|
52184
52314
|
}
|
|
52185
52315
|
],
|
|
52186
52316
|
"returnType": "void",
|
|
52187
|
-
"line":
|
|
52317
|
+
"line": 52,
|
|
52188
52318
|
"jsdoctags": [
|
|
52189
52319
|
{
|
|
52190
52320
|
"name": "value",
|
|
@@ -72700,7 +72830,7 @@
|
|
|
72700
72830
|
},
|
|
72701
72831
|
{
|
|
72702
72832
|
"name": "TextareaLabelComponent",
|
|
72703
|
-
"id": "component-TextareaLabelComponent-
|
|
72833
|
+
"id": "component-TextareaLabelComponent-e4970fada6f6d2a3eaf4d70389becac87203471765858b2a5e72895920f14fd956c84f630e534d74bbaa021f54652e7ed093ed5f9fba7caf6cf63399fc818fce",
|
|
72704
72834
|
"file": "src/input/textarea-label.component.ts",
|
|
72705
72835
|
"encapsulation": [],
|
|
72706
72836
|
"entryComponents": [],
|
|
@@ -72721,7 +72851,7 @@
|
|
|
72721
72851
|
"deprecationMessage": "",
|
|
72722
72852
|
"rawdescription": "\n\nSet the arialabel for label\n",
|
|
72723
72853
|
"description": "<p>Set the arialabel for label</p>\n",
|
|
72724
|
-
"line":
|
|
72854
|
+
"line": 199,
|
|
72725
72855
|
"type": "string",
|
|
72726
72856
|
"decorators": []
|
|
72727
72857
|
},
|
|
@@ -72732,7 +72862,7 @@
|
|
|
72732
72862
|
"deprecationMessage": "",
|
|
72733
72863
|
"rawdescription": "\n\nDetermines whether the counter counts characters or words.\nWhen `\"word\"` and `maxCount` is set, input is clamped to `maxCount` words\non each change. Excess words are trimmed from the end of the value.\n",
|
|
72734
72864
|
"description": "<p>Determines whether the counter counts characters or words.\nWhen <code>"word"</code> and <code>maxCount</code> is set, input is clamped to <code>maxCount</code> words\non each change. Excess words are trimmed from the end of the value.</p>\n",
|
|
72735
|
-
"line":
|
|
72865
|
+
"line": 229,
|
|
72736
72866
|
"type": "\"character\" | \"word\"",
|
|
72737
72867
|
"decorators": []
|
|
72738
72868
|
},
|
|
@@ -72742,7 +72872,7 @@
|
|
|
72742
72872
|
"deprecationMessage": "",
|
|
72743
72873
|
"rawdescription": "\n\n**Experimental**: Optional decorator (e.g. AI label).\n",
|
|
72744
72874
|
"description": "<p><strong>Experimental</strong>: Optional decorator (e.g. AI label).</p>\n",
|
|
72745
|
-
"line":
|
|
72875
|
+
"line": 234,
|
|
72746
72876
|
"type": "TemplateRef<any>",
|
|
72747
72877
|
"decorators": []
|
|
72748
72878
|
},
|
|
@@ -72753,7 +72883,7 @@
|
|
|
72753
72883
|
"deprecationMessage": "",
|
|
72754
72884
|
"rawdescription": "\n\nSet to `true` for a disabled label.\n",
|
|
72755
72885
|
"description": "<p>Set to <code>true</code> for a disabled label.</p>\n",
|
|
72756
|
-
"line":
|
|
72886
|
+
"line": 164,
|
|
72757
72887
|
"type": "boolean",
|
|
72758
72888
|
"decorators": []
|
|
72759
72889
|
},
|
|
@@ -72764,7 +72894,7 @@
|
|
|
72764
72894
|
"deprecationMessage": "",
|
|
72765
72895
|
"rawdescription": "\n\nSet to `true` (`maxCount` must be set) to displays a live character/word\ncounter alongside the label.\n",
|
|
72766
72896
|
"description": "<p>Set to <code>true</code> (<code>maxCount</code> must be set) to displays a live character/word\ncounter alongside the label.</p>\n",
|
|
72767
|
-
"line":
|
|
72897
|
+
"line": 216,
|
|
72768
72898
|
"type": "boolean",
|
|
72769
72899
|
"decorators": []
|
|
72770
72900
|
},
|
|
@@ -72775,7 +72905,7 @@
|
|
|
72775
72905
|
"deprecationMessage": "",
|
|
72776
72906
|
"rawdescription": "\n\nExperimental: enable fluid state\n",
|
|
72777
72907
|
"description": "<p>Experimental: enable fluid state</p>\n",
|
|
72778
|
-
"line":
|
|
72908
|
+
"line": 204,
|
|
72779
72909
|
"type": "boolean",
|
|
72780
72910
|
"decorators": []
|
|
72781
72911
|
},
|
|
@@ -72785,7 +72915,7 @@
|
|
|
72785
72915
|
"deprecationMessage": "",
|
|
72786
72916
|
"rawdescription": "\n\nOptional helper text that appears under the label.\n",
|
|
72787
72917
|
"description": "<p>Optional helper text that appears under the label.</p>\n",
|
|
72788
|
-
"line":
|
|
72918
|
+
"line": 179,
|
|
72789
72919
|
"type": "string | TemplateRef<any>",
|
|
72790
72920
|
"decorators": []
|
|
72791
72921
|
},
|
|
@@ -72796,7 +72926,7 @@
|
|
|
72796
72926
|
"deprecationMessage": "",
|
|
72797
72927
|
"rawdescription": "\n\nSet to `true` to hide the label visually, but keep accessible to\nscreen readers.\n",
|
|
72798
72928
|
"description": "<p>Set to <code>true</code> to hide the label visually, but keep accessible to\nscreen readers.</p>\n",
|
|
72799
|
-
"line":
|
|
72929
|
+
"line": 210,
|
|
72800
72930
|
"type": "boolean",
|
|
72801
72931
|
"decorators": []
|
|
72802
72932
|
},
|
|
@@ -72807,7 +72937,7 @@
|
|
|
72807
72937
|
"deprecationMessage": "",
|
|
72808
72938
|
"rawdescription": "\n\nSet to `true` for an invalid label component.\n",
|
|
72809
72939
|
"description": "<p>Set to <code>true</code> for an invalid label component.</p>\n",
|
|
72810
|
-
"line":
|
|
72940
|
+
"line": 187,
|
|
72811
72941
|
"type": "boolean",
|
|
72812
72942
|
"decorators": []
|
|
72813
72943
|
},
|
|
@@ -72817,7 +72947,7 @@
|
|
|
72817
72947
|
"deprecationMessage": "",
|
|
72818
72948
|
"rawdescription": "\n\nSets the invalid text.\n",
|
|
72819
72949
|
"description": "<p>Sets the invalid text.</p>\n",
|
|
72820
|
-
"line":
|
|
72950
|
+
"line": 183,
|
|
72821
72951
|
"type": "string | TemplateRef<any>",
|
|
72822
72952
|
"decorators": []
|
|
72823
72953
|
},
|
|
@@ -72828,7 +72958,7 @@
|
|
|
72828
72958
|
"deprecationMessage": "",
|
|
72829
72959
|
"rawdescription": "\n\nThe id of the input item associated with the `Label`. This value is also used to associate the `Label` with\nits input counterpart through the 'for' attribute.\n",
|
|
72830
72960
|
"description": "<p>The id of the input item associated with the <code>Label</code>. This value is also used to associate the <code>Label</code> with\nits input counterpart through the 'for' attribute.</p>\n",
|
|
72831
|
-
"line":
|
|
72961
|
+
"line": 159,
|
|
72832
72962
|
"type": "string",
|
|
72833
72963
|
"decorators": []
|
|
72834
72964
|
},
|
|
@@ -72838,7 +72968,7 @@
|
|
|
72838
72968
|
"deprecationMessage": "",
|
|
72839
72969
|
"rawdescription": "\n\nHelper input property for ease of migration\nSince we cannot pass ng-content down easily from label component, we will accept the templates\n",
|
|
72840
72970
|
"description": "<p>Helper input property for ease of migration\nSince we cannot pass ng-content down easily from label component, we will accept the templates</p>\n",
|
|
72841
|
-
"line":
|
|
72971
|
+
"line": 174,
|
|
72842
72972
|
"type": "TemplateRef<any>",
|
|
72843
72973
|
"decorators": []
|
|
72844
72974
|
},
|
|
@@ -72848,7 +72978,7 @@
|
|
|
72848
72978
|
"deprecationMessage": "",
|
|
72849
72979
|
"rawdescription": "\n\nMaximum number of characters (or words) allowed. Required for the\ncounter to display.\n",
|
|
72850
72980
|
"description": "<p>Maximum number of characters (or words) allowed. Required for the\ncounter to display.</p>\n",
|
|
72851
|
-
"line":
|
|
72981
|
+
"line": 222,
|
|
72852
72982
|
"type": "number",
|
|
72853
72983
|
"decorators": []
|
|
72854
72984
|
},
|
|
@@ -72859,7 +72989,7 @@
|
|
|
72859
72989
|
"deprecationMessage": "",
|
|
72860
72990
|
"rawdescription": "\n\nSet to `true` for a loading label.\n",
|
|
72861
72991
|
"description": "<p>Set to <code>true</code> for a loading label.</p>\n",
|
|
72862
|
-
"line":
|
|
72992
|
+
"line": 168,
|
|
72863
72993
|
"type": "boolean",
|
|
72864
72994
|
"decorators": []
|
|
72865
72995
|
},
|
|
@@ -72867,7 +72997,7 @@
|
|
|
72867
72997
|
"name": "textAreaTemplate",
|
|
72868
72998
|
"deprecated": false,
|
|
72869
72999
|
"deprecationMessage": "",
|
|
72870
|
-
"line":
|
|
73000
|
+
"line": 175,
|
|
72871
73001
|
"type": "TemplateRef<any>",
|
|
72872
73002
|
"decorators": []
|
|
72873
73003
|
},
|
|
@@ -72878,7 +73008,7 @@
|
|
|
72878
73008
|
"deprecationMessage": "",
|
|
72879
73009
|
"rawdescription": "\n\nSet to `true` to show a warning (contents set by warningText)\n",
|
|
72880
73010
|
"description": "<p>Set to <code>true</code> to show a warning (contents set by warningText)</p>\n",
|
|
72881
|
-
"line":
|
|
73011
|
+
"line": 191,
|
|
72882
73012
|
"type": "boolean",
|
|
72883
73013
|
"decorators": []
|
|
72884
73014
|
},
|
|
@@ -72888,7 +73018,7 @@
|
|
|
72888
73018
|
"deprecationMessage": "",
|
|
72889
73019
|
"rawdescription": "\n\nSets the warning text\n",
|
|
72890
73020
|
"description": "<p>Sets the warning text</p>\n",
|
|
72891
|
-
"line":
|
|
73021
|
+
"line": 195,
|
|
72892
73022
|
"type": "string | TemplateRef<any>",
|
|
72893
73023
|
"decorators": []
|
|
72894
73024
|
}
|
|
@@ -72903,7 +73033,7 @@
|
|
|
72903
73033
|
"type": "",
|
|
72904
73034
|
"optional": false,
|
|
72905
73035
|
"description": "",
|
|
72906
|
-
"line":
|
|
73036
|
+
"line": 245,
|
|
72907
73037
|
"decorators": [
|
|
72908
73038
|
{
|
|
72909
73039
|
"name": "HostBinding",
|
|
@@ -72922,7 +73052,7 @@
|
|
|
72922
73052
|
"type": "number",
|
|
72923
73053
|
"optional": false,
|
|
72924
73054
|
"description": "<p>Used to build the id of the input item associated with the <code>Label</code>.</p>\n",
|
|
72925
|
-
"line":
|
|
73055
|
+
"line": 154,
|
|
72926
73056
|
"rawdescription": "\n\nUsed to build the id of the input item associated with the `Label`.\n",
|
|
72927
73057
|
"modifierKind": [
|
|
72928
73058
|
126
|
|
@@ -72935,7 +73065,7 @@
|
|
|
72935
73065
|
"type": "TextArea",
|
|
72936
73066
|
"optional": false,
|
|
72937
73067
|
"description": "",
|
|
72938
|
-
"line":
|
|
73068
|
+
"line": 243,
|
|
72939
73069
|
"decorators": [
|
|
72940
73070
|
{
|
|
72941
73071
|
"name": "ContentChild",
|
|
@@ -72954,7 +73084,7 @@
|
|
|
72954
73084
|
"type": "number",
|
|
72955
73085
|
"optional": false,
|
|
72956
73086
|
"description": "",
|
|
72957
|
-
"line":
|
|
73087
|
+
"line": 237
|
|
72958
73088
|
},
|
|
72959
73089
|
{
|
|
72960
73090
|
"name": "wrapper",
|
|
@@ -72963,7 +73093,7 @@
|
|
|
72963
73093
|
"type": "ElementRef<HTMLDivElement>",
|
|
72964
73094
|
"optional": false,
|
|
72965
73095
|
"description": "",
|
|
72966
|
-
"line":
|
|
73096
|
+
"line": 240,
|
|
72967
73097
|
"decorators": [
|
|
72968
73098
|
{
|
|
72969
73099
|
"name": "ViewChild",
|
|
@@ -72989,7 +73119,7 @@
|
|
|
72989
73119
|
"optional": false,
|
|
72990
73120
|
"returnType": "boolean",
|
|
72991
73121
|
"typeParameters": [],
|
|
72992
|
-
"line":
|
|
73122
|
+
"line": 327,
|
|
72993
73123
|
"deprecated": false,
|
|
72994
73124
|
"deprecationMessage": "",
|
|
72995
73125
|
"modifierKind": [
|
|
@@ -73016,7 +73146,7 @@
|
|
|
73016
73146
|
"defaultValue": "true",
|
|
73017
73147
|
"deprecated": false,
|
|
73018
73148
|
"deprecationMessage": "",
|
|
73019
|
-
"line":
|
|
73149
|
+
"line": 245,
|
|
73020
73150
|
"type": "boolean",
|
|
73021
73151
|
"decorators": []
|
|
73022
73152
|
},
|
|
@@ -73024,7 +73154,7 @@
|
|
|
73024
73154
|
"name": "class.cds--text-area__wrapper--readonly",
|
|
73025
73155
|
"deprecated": false,
|
|
73026
73156
|
"deprecationMessage": "",
|
|
73027
|
-
"line":
|
|
73157
|
+
"line": 140,
|
|
73028
73158
|
"type": "any",
|
|
73029
73159
|
"decorators": []
|
|
73030
73160
|
},
|
|
@@ -73032,7 +73162,7 @@
|
|
|
73032
73162
|
"name": "class.cds--text-area--fluid",
|
|
73033
73163
|
"deprecated": false,
|
|
73034
73164
|
"deprecationMessage": "",
|
|
73035
|
-
"line":
|
|
73165
|
+
"line": 144,
|
|
73036
73166
|
"type": "boolean",
|
|
73037
73167
|
"decorators": []
|
|
73038
73168
|
},
|
|
@@ -73040,7 +73170,7 @@
|
|
|
73040
73170
|
"name": "class.cds--text-area--fluid__skeleton",
|
|
73041
73171
|
"deprecated": false,
|
|
73042
73172
|
"deprecationMessage": "",
|
|
73043
|
-
"line":
|
|
73173
|
+
"line": 148,
|
|
73044
73174
|
"type": "boolean",
|
|
73045
73175
|
"decorators": []
|
|
73046
73176
|
}
|
|
@@ -73051,7 +73181,7 @@
|
|
|
73051
73181
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { InputModule } from 'carbon-components-angular';</code></pre></div><b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-textarea-label>\n Label\n <textarea cdsTextArea class="textarea-field">\n</cds-textarea-label></code></pre></div><p><a href=\"../../?path=/story/components-input-text-area--basic\">See demo</a></p>\n",
|
|
73052
73182
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { InputModule } from 'carbon-components-angular';\n```\n\n```html\n<cds-textarea-label>\n\tLabel\n\t<textarea cdsTextArea class=\"textarea-field\">\n</cds-textarea-label>\n```\n\n[See demo](../../?path=/story/components-input-text-area--basic)\n",
|
|
73053
73183
|
"type": "component",
|
|
73054
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tAfterViewInit,\n\tOnChanges,\n\tOnDestroy,\n\tElementRef,\n\tHostBinding,\n\tTemplateRef,\n\tViewChild,\n\tContentChild,\n\tChangeDetectorRef,\n\tSimpleChanges\n} from \"@angular/core\";\n\nimport { TextArea } from \"./text-area.directive\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { InputModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-textarea-label>\n * \tLabel\n * \t<textarea cdsTextArea class=\"textarea-field\">\n * </cds-textarea-label>\n * ```\n *\n * [See demo](../../?path=/story/components-input-text-area--basic)\n */\n@Component({\n\tselector: \"cds-textarea-label, ibm-textarea-label\",\n\ttemplate: `\n\t\t<ng-container *ngIf=\"skeleton\">\n\t\t\t<span class=\"cds--label cds--skeleton\"></span>\n\t\t\t<div class=\"cds--text-area cds--skeleton\"></div>\n\t\t</ng-container>\n\t\t<ng-container *ngIf=\"!skeleton\">\n\t\t\t<div class=\"cds--text-area__label-wrapper\">\n\t\t\t\t<label\n\t\t\t\t\t[for]=\"labelInputID\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-template *ngIf=\"labelTemplate; else labelContent\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t\t\t\t\t<ng-template #labelContent>\n\t\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t\t</ng-template>\n\t\t\t\t</label>\n\t\t\t\t<span\n\t\t\t\t\t*ngIf=\"enableCounter && maxCount\"\n\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\"\n\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t{{textCount}}/{{maxCount}}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclass=\"cds--text-area__wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--text-area__wrapper--warn': warn,\n\t\t\t\t\t'cds--text-area__wrapper--decorator': !!decorator\n\t\t\t\t}\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\t\t#wrapper>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!fluid && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--text-area__invalid-icon\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!fluid && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--text-area__invalid-icon cds--text-area__invalid-icon--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<ng-template *ngIf=\"textAreaTemplate; else textAreaContent\" [ngTemplateOutlet]=\"textAreaTemplate\"></ng-template>\n\t\t\t\t<ng-template #textAreaContent>\n\t\t\t\t\t<ng-content select=\"[cdsTextArea],[ibmTextArea],textarea\"></ng-content>\n\t\t\t\t</ng-template>\n\t\t\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t<div class=\"cds--text-area__inner-wrapper--decorator\">\n\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\n\n\t\t\t\t<ng-container *ngIf=\"fluid\">\n\t\t\t\t\t<hr class=\"cds--text-area__divider\" />\n\t\t\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\tclass=\"cds--text-area__invalid-icon\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\tclass=\"cds--text-area__invalid-icon cds--text-area__invalid-icon--warning\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\n\t\t\t</div>\n\t\t\t<ng-container *ngIf=\"!fluid\">\n\t\t\t\t<div\n\t\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t</ng-container>\n\t`\n})\nexport class TextareaLabelComponent implements AfterViewInit, OnChanges, OnDestroy {\n\n\t@HostBinding(\"class.cds--text-area__wrapper--readonly\") get isReadonly() {\n\t\treturn this.wrapper?.nativeElement.querySelector(\"textarea\")?.readOnly ?? false;\n\t}\n\n\t@HostBinding(\"class.cds--text-area--fluid\") get fluidClass() {\n\t\treturn this.fluid && !this.skeleton;\n\t}\n\n\t@HostBinding(\"class.cds--text-area--fluid__skeleton\") get fluidSkeletonClass() {\n\t\treturn this.fluid && this.skeleton;\n\t}\n\t/**\n\t * Used to build the id of the input item associated with the `Label`.\n\t */\n\tstatic labelCounter = 0;\n\t/**\n\t * The id of the input item associated with the `Label`. This value is also used to associate the `Label` with\n\t * its input counterpart through the 'for' attribute.\n\t*/\n\t@Input() labelInputID = \"ibm-textarea-\" + TextareaLabelComponent.labelCounter;\n\n\t/**\n\t * Set to `true` for a disabled label.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading label.\n\t */\n\t@Input() skeleton = false;\n\n\t/**\n\t * Helper input property for ease of migration\n\t * Since we cannot pass ng-content down easily from label component, we will accept the templates\n\t */\n\t@Input() labelTemplate: TemplateRef<any>;\n\t@Input() textAreaTemplate: TemplateRef<any>;\n\t/**\n\t * Optional helper text that appears under the label.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` for an invalid label component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\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 * Set the arialabel for label\n\t */\n\t@Input() ariaLabel: string;\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@Input() fluid = false;\n\n\t/**\n\t * Set to `true` to hide the label visually, but keep accessible to\n\t * screen readers.\n\t */\n\t@Input() hideLabel = false;\n\n\t/**\n\t * Set to `true` (`maxCount` must be set) to displays a live character/word\n\t * counter alongside the label.\n\t */\n\t@Input() enableCounter = false;\n\n\t/**\n\t * Maximum number of characters (or words) allowed. Required for the\n\t * counter to display.\n\t */\n\t@Input() maxCount: number;\n\n\t/**\n\t * Determines whether the counter counts characters or words.\n\t * When `\"word\"` and `maxCount` is set, input is clamped to `maxCount` words\n\t * on each change. Excess words are trimmed from the end of the value.\n\t */\n\t@Input() counterMode: \"character\" | \"word\" = \"character\";\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\n\t// Tracks current character / word count for the counter display.\n\ttextCount = 0;\n\n\t// @ts-ignore\n\t@ViewChild(\"wrapper\", { static: false }) wrapper: ElementRef<HTMLDivElement>;\n\n\t// @ts-ignore\n\t@ContentChild(TextArea, { static: false }) textArea: TextArea;\n\n\t@HostBinding(\"class.cds--form-item\") labelClass = true;\n\n\t// Cached reference to the textarea element, set once in ngAfterViewInit.\n\tprivate _textareaElement: HTMLTextAreaElement | null = null;\n\t// Cached listener so it can be removed precisely (avoids anonymous-function leak)\n\tprivate _inputListener: ((e: Event) => void) | null = null;\n\n\t/**\n\t * Creates an instance of Label.\n\t */\n\tconstructor(protected changeDetectorRef: ChangeDetectorRef) {}\n\n\t/**\n\t * Sets the id on the input item associated with the `Label` and attaches the\n\t * counter listener when `enableCounter` is already `true` on first render.\n\t */\n\tngAfterViewInit() {\n\t\tif (this.wrapper) {\n\t\t\t// Prioritize setting id to `textarea` over div\n\t\t\tconst inputElement = this.wrapper.nativeElement.querySelector(\"textarea\");\n\t\t\tif (inputElement) {\n\t\t\t\t// avoid overriding ids already set by the user — reuse it instead\n\t\t\t\tif (inputElement.id) {\n\t\t\t\t\tthis.labelInputID = inputElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tinputElement.setAttribute(\"id\", this.labelInputID);\n\n\t\t\t\tthis._textareaElement = inputElement;\n\t\t\t\tthis._syncMaxLength();\n\n\t\t\t\tif (this.enableCounter) {\n\t\t\t\t\tthis.textCount = this._countValue(inputElement.value || \"\");\n\t\t\t\t\tthis._attachCounterListener();\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst divElement = this.wrapper.nativeElement.querySelector(\"div\");\n\t\t\tif (divElement) {\n\t\t\t\tif (divElement.id) {\n\t\t\t\t\tthis.labelInputID = divElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tdivElement.setAttribute(\"id\", this.labelInputID);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Attach/remove listener and seed `textCount` from the textarea's current value.\n\t * @param changes\n\t */\n\tngOnChanges(changes: SimpleChanges) {\n\t\tif (changes.enableCounter && !changes.enableCounter.firstChange) {\n\t\t\tif (changes.enableCounter.currentValue) {\n\t\t\t\tif (this._textareaElement) {\n\t\t\t\t\tthis.textCount = this._countValue(this._textareaElement.value || \"\");\n\t\t\t\t\tthis._attachCounterListener();\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._detachCounterListener();\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t(changes.maxCount || changes.counterMode) &&\n\t\t\t!(changes.maxCount?.firstChange && changes.counterMode?.firstChange)\n\t\t) {\n\t\t\tthis._syncMaxLength();\n\t\t}\n\t}\n\n\tngOnDestroy() {\n\t\tthis._detachCounterListener();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Keeps the textarea's `maxlength` attribute in sync with `maxCount`. This is only set\n\t * when counterMode is set to `character`. When counterMode is set to `word`, we enforce limit via JS.\n\t * If `maxCount` is unset or the mode is `\"word\"`, any previously applied\n\t * `maxlength` is removed so the textarea is unrestricted by the attribute.\n\t */\n\tprivate _syncMaxLength(): void {\n\t\tif (!this._textareaElement) {\n\t\t\treturn;\n\t\t}\n\t\tif (this.counterMode === \"character\" && this.maxCount != null) {\n\t\t\tthis._textareaElement.setAttribute(\"maxlength\", String(this.maxCount));\n\t\t} else {\n\t\t\tthis._textareaElement.removeAttribute(\"maxlength\");\n\t\t}\n\t}\n\n\t/**\n\t * Attaches the input event listener, ensuring it is never added twice.\n\t */\n\tprivate _attachCounterListener(): void {\n\t\tthis._detachCounterListener();\n\t\tif (!this._textareaElement) {\n\t\t\treturn;\n\t\t}\n\t\tthis._inputListener = (e: Event) => {\n\t\t\tconst el = e.target as HTMLTextAreaElement;\n\t\t\t// Word-mode enforcement: clamp value to maxCount words on each input so\n\t\t\t// the textarea never holds more words than allowed. Character mode relies\n\t\t\t// on the native `maxlength` attribute set by the developer.\n\t\t\tif (this.counterMode === \"word\" && this.maxCount != null) {\n\t\t\t\tconst clamped = this._truncateToWordLimit(el.value || \"\", this.maxCount);\n\t\t\t\tif (clamped !== el.value) {\n\t\t\t\t\tel.value = clamped;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.textCount = this._countValue(el.value || \"\");\n\t\t};\n\t\tthis._textareaElement.addEventListener(\"input\", this._inputListener);\n\t}\n\n\t/**\n\t * Truncates `value` so it contains at most `limit` Unicode words.\n\t * Whitespace between and around words is preserved up to the last allowed word;\n\t * any trailing content (partial word or space) beyond the limit is dropped.\n\t */\n\tprivate _truncateToWordLimit(value: string, limit: number): string {\n\t\tlet wordsSeen = 0;\n\t\t// Walk through the string capturing word boundaries\n\t\tconst wordPattern = /\\p{L}+/gu;\n\t\tlet match: RegExpExecArray | null;\n\t\tlet cutIndex = value.length;\n\t\twhile ((match = wordPattern.exec(value)) !== null) {\n\t\t\twordsSeen++;\n\t\t\tif (wordsSeen === limit) {\n\t\t\t\t// Allow the string to continue up to (but not past) the end of this word\n\t\t\t\tcutIndex = match.index + match[0].length;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn wordsSeen < limit ? value : value.slice(0, cutIndex);\n\t}\n\n\n\t/**\n\t * Removes the input event listener and clears the cached reference.\n\t */\n\tprivate _detachCounterListener(): void {\n\t\tif (this._inputListener && this._textareaElement) {\n\t\t\tthis._textareaElement.removeEventListener(\"input\", this._inputListener);\n\t\t\tthis._inputListener = null;\n\t\t}\n\t}\n\n\tprivate _countValue(value: string): number {\n\t\tif (this.counterMode === \"word\") {\n\t\t\treturn value.match(/\\p{L}+/gu)?.length || 0;\n\t\t}\n\t\treturn value.length;\n\t}\n}\n",
|
|
73184
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tAfterViewInit,\n\tOnChanges,\n\tOnDestroy,\n\tElementRef,\n\tHostBinding,\n\tTemplateRef,\n\tViewChild,\n\tContentChild,\n\tChangeDetectorRef,\n\tSimpleChanges\n} from \"@angular/core\";\nimport { Subscription } from \"rxjs\";\nimport { startWith } from \"rxjs/operators\";\n\nimport { TextArea } from \"./text-area.directive\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { InputModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-textarea-label>\n * \tLabel\n * \t<textarea cdsTextArea class=\"textarea-field\">\n * </cds-textarea-label>\n * ```\n *\n * [See demo](../../?path=/story/components-input-text-area--basic)\n */\n@Component({\n\tselector: \"cds-textarea-label, ibm-textarea-label\",\n\ttemplate: `\n\t\t<ng-container *ngIf=\"skeleton\">\n\t\t\t<span class=\"cds--label cds--skeleton\"></span>\n\t\t\t<div class=\"cds--text-area cds--skeleton\"></div>\n\t\t</ng-container>\n\t\t<ng-container *ngIf=\"!skeleton\">\n\t\t\t<div class=\"cds--text-area__label-wrapper\">\n\t\t\t\t<label\n\t\t\t\t\t[for]=\"labelInputID\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-template *ngIf=\"labelTemplate; else labelContent\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t\t\t\t\t<ng-template #labelContent>\n\t\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t\t</ng-template>\n\t\t\t\t</label>\n\t\t\t\t<span\n\t\t\t\t\t*ngIf=\"enableCounter && maxCount\"\n\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\"\n\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t{{textCount}}/{{maxCount}}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclass=\"cds--text-area__wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--text-area__wrapper--warn': warn,\n\t\t\t\t\t'cds--text-area__wrapper--decorator': !!decorator\n\t\t\t\t}\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\t\t#wrapper>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!fluid && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--text-area__invalid-icon\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!fluid && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--text-area__invalid-icon cds--text-area__invalid-icon--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<ng-template *ngIf=\"textAreaTemplate; else textAreaContent\" [ngTemplateOutlet]=\"textAreaTemplate\"></ng-template>\n\t\t\t\t<ng-template #textAreaContent>\n\t\t\t\t\t<ng-content select=\"[cdsTextArea],[ibmTextArea],textarea\"></ng-content>\n\t\t\t\t</ng-template>\n\t\t\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t<div class=\"cds--text-area__inner-wrapper--decorator\">\n\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\n\n\t\t\t\t<ng-container *ngIf=\"fluid\">\n\t\t\t\t\t<hr class=\"cds--text-area__divider\" />\n\t\t\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\tclass=\"cds--text-area__invalid-icon\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\tclass=\"cds--text-area__invalid-icon cds--text-area__invalid-icon--warning\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\n\t\t\t</div>\n\t\t\t<ng-container *ngIf=\"!fluid\">\n\t\t\t\t<div\n\t\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t</ng-container>\n\t`\n})\nexport class TextareaLabelComponent implements AfterViewInit, OnChanges, OnDestroy {\n\n\t@HostBinding(\"class.cds--text-area__wrapper--readonly\") get isReadonly() {\n\t\treturn this.wrapper?.nativeElement.querySelector(\"textarea\")?.readOnly ?? false;\n\t}\n\n\t@HostBinding(\"class.cds--text-area--fluid\") get fluidClass() {\n\t\treturn this.fluid && !this.skeleton;\n\t}\n\n\t@HostBinding(\"class.cds--text-area--fluid__skeleton\") get fluidSkeletonClass() {\n\t\treturn this.fluid && this.skeleton;\n\t}\n\t/**\n\t * Used to build the id of the input item associated with the `Label`.\n\t */\n\tstatic labelCounter = 0;\n\t/**\n\t * The id of the input item associated with the `Label`. This value is also used to associate the `Label` with\n\t * its input counterpart through the 'for' attribute.\n\t*/\n\t@Input() labelInputID = \"ibm-textarea-\" + TextareaLabelComponent.labelCounter;\n\n\t/**\n\t * Set to `true` for a disabled label.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading label.\n\t */\n\t@Input() skeleton = false;\n\n\t/**\n\t * Helper input property for ease of migration\n\t * Since we cannot pass ng-content down easily from label component, we will accept the templates\n\t */\n\t@Input() labelTemplate: TemplateRef<any>;\n\t@Input() textAreaTemplate: TemplateRef<any>;\n\t/**\n\t * Optional helper text that appears under the label.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` for an invalid label component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\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 * Set the arialabel for label\n\t */\n\t@Input() ariaLabel: string;\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@Input() fluid = false;\n\n\t/**\n\t * Set to `true` to hide the label visually, but keep accessible to\n\t * screen readers.\n\t */\n\t@Input() hideLabel = false;\n\n\t/**\n\t * Set to `true` (`maxCount` must be set) to displays a live character/word\n\t * counter alongside the label.\n\t */\n\t@Input() enableCounter = false;\n\n\t/**\n\t * Maximum number of characters (or words) allowed. Required for the\n\t * counter to display.\n\t */\n\t@Input() maxCount: number;\n\n\t/**\n\t * Determines whether the counter counts characters or words.\n\t * When `\"word\"` and `maxCount` is set, input is clamped to `maxCount` words\n\t * on each change. Excess words are trimmed from the end of the value.\n\t */\n\t@Input() counterMode: \"character\" | \"word\" = \"character\";\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\n\t// Tracks current character / word count for the counter display.\n\ttextCount = 0;\n\n\t// @ts-ignore\n\t@ViewChild(\"wrapper\", { static: false }) wrapper: ElementRef<HTMLDivElement>;\n\n\t// @ts-ignore\n\t@ContentChild(TextArea, { static: false }) textArea: TextArea;\n\n\t@HostBinding(\"class.cds--form-item\") labelClass = true;\n\n\t// Cached reference to the textarea element, set once in ngAfterViewInit.\n\tprivate _textareaElement: HTMLTextAreaElement | null = null;\n\n\t// RxJS subscription used when NgControl is available (template-driven & reactive forms).\n\tprivate _subscription: Subscription | null = null;\n\n\t// Fallback DOM listener used only when no NgControl is present (plain textarea).\n\tprivate _inputListener: ((e: Event) => void) | null = null;\n\n\t/**\n\t * Creates an instance of Label.\n\t */\n\tconstructor(protected changeDetectorRef: ChangeDetectorRef) {}\n\n\t/**\n\t * Sets the id on the input item associated with the `Label` and attaches the\n\t * counter listener when `enableCounter` is already `true` on first render.\n\t */\n\tngAfterViewInit() {\n\t\tif (this.wrapper) {\n\t\t\t// Prioritize setting id to `textarea` over div\n\t\t\tconst inputElement = this.wrapper.nativeElement.querySelector(\"textarea\");\n\t\t\tif (inputElement) {\n\t\t\t\t// avoid overriding ids already set by the user — reuse it instead\n\t\t\t\tif (inputElement.id) {\n\t\t\t\t\tthis.labelInputID = inputElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tinputElement.setAttribute(\"id\", this.labelInputID);\n\n\t\t\t\tthis._textareaElement = inputElement;\n\t\t\t\tthis._syncMaxLength();\n\n\t\t\t\tif (this.enableCounter) {\n\t\t\t\t\tthis.textCount = this._countValue(inputElement.value || \"\");\n\t\t\t\t\tthis._attachCounterListener();\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst divElement = this.wrapper.nativeElement.querySelector(\"div\");\n\t\t\tif (divElement) {\n\t\t\t\tif (divElement.id) {\n\t\t\t\t\tthis.labelInputID = divElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tdivElement.setAttribute(\"id\", this.labelInputID);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Attach/remove listener and seed `textCount` from the textarea's current value.\n\t */\n\tngOnChanges(changes: SimpleChanges) {\n\t\tif (changes.enableCounter && !changes.enableCounter.firstChange) {\n\t\t\tif (changes.enableCounter.currentValue) {\n\t\t\t\tif (this._textareaElement) {\n\t\t\t\t\tthis.textCount = this._countValue(this._textareaElement.value || \"\");\n\t\t\t\t\tthis._attachCounterListener();\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._detachCounterListener();\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t(changes.maxCount || changes.counterMode) &&\n\t\t\t!(changes.maxCount?.firstChange && changes.counterMode?.firstChange)\n\t\t) {\n\t\t\tthis._syncMaxLength();\n\t\t}\n\t}\n\n\tngOnDestroy() {\n\t\tthis._detachCounterListener();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Keeps the textarea's `maxlength` attribute in sync with `maxCount`. This is only set\n\t * when counterMode is set to `character`. When counterMode is set to `word`, we enforce limit via JS.\n\t * If `maxCount` is unset or the mode is `\"word\"`, any previously applied\n\t * `maxlength` is removed so the textarea is unrestricted by the attribute.\n\t */\n\tprivate _syncMaxLength(): void {\n\t\tif (!this._textareaElement) {\n\t\t\treturn;\n\t\t}\n\t\tif (this.counterMode === \"character\" && this.maxCount != null) {\n\t\t\tthis._textareaElement.setAttribute(\"maxlength\", String(this.maxCount));\n\t\t} else {\n\t\t\tthis._textareaElement.removeAttribute(\"maxlength\");\n\t\t}\n\t}\n\n\t/**\n\t * Attaches the counter listener, listen for either ngControl or native DOM input\n\t * event listener\n\t */\n\tprivate _attachCounterListener(): void {\n\t\tthis._detachCounterListener();\n\n\t\tconst control = this.textArea?.ngControl;\n\t\tif (control?.valueChanges) {\n\t\t\t// NgControl listener\n\t\t\tthis._subscription = control.valueChanges\n\t\t\t\t.pipe(startWith(control.value))\n\t\t\t\t.subscribe((value: string) => {\n\t\t\t\t\tconst raw = value || \"\";\n\n\t\t\t\t\tif (this.counterMode === \"word\" && this.maxCount != null) {\n\t\t\t\t\t\tconst clamped = this._truncateToWordLimit(raw, this.maxCount);\n\t\t\t\t\t\tif (clamped !== raw) {\n\t\t\t\t\t\t\t// Write back through the control so the form model stays in sync.\n\t\t\t\t\t\t\t// emitEvent false to avoid infinite loop\n\t\t\t\t\t\t\tcontrol?.control?.setValue(clamped, { emitEvent: false });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.textCount = this._countValue(raw);\n\t\t\t\t\tthis.changeDetectorRef.markForCheck();\n\t\t\t\t});\n\t\t} else {\n\t\t\t// Fallback DOM path\n\t\t\tif (!this._textareaElement) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._inputListener = (e: Event) => {\n\t\t\t\tconst el = e.target as HTMLTextAreaElement;\n\t\t\t\tif (this.counterMode === \"word\" && this.maxCount != null) {\n\t\t\t\t\tconst clamped = this._truncateToWordLimit(el.value || \"\", this.maxCount);\n\t\t\t\t\tif (clamped !== el.value) {\n\t\t\t\t\t\tel.value = clamped;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.textCount = this._countValue(el.value || \"\");\n\t\t\t};\n\t\t\tthis._textareaElement.addEventListener(\"input\", this._inputListener);\n\t\t}\n\t}\n\n\t/**\n\t * Truncates `value` so it contains at most `limit` Unicode words.\n\t * Whitespace between and around words is preserved up to the last allowed word;\n\t * any trailing content (partial word or space) beyond the limit is dropped.\n\t */\n\tprivate _truncateToWordLimit(value: string, limit: number): string {\n\t\tlet wordsSeen = 0;\n\t\t// Walk through the string capturing word boundaries\n\t\tconst wordPattern = /\\p{L}+/gu;\n\t\tlet match: RegExpExecArray | null;\n\t\tlet cutIndex = value.length;\n\t\twhile ((match = wordPattern.exec(value)) !== null) {\n\t\t\twordsSeen++;\n\t\t\tif (wordsSeen === limit) {\n\t\t\t\t// Allow the string to continue up to (but not past) the end of this word\n\t\t\t\tcutIndex = match.index + match[0].length;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn wordsSeen < limit ? value : value.slice(0, cutIndex);\n\t}\n\n\t/**\n\t * Removes the subscription (NgControl path) and removes the DOM listener\n\t * (fallback path). Safe to call when neither is active.\n\t */\n\tprivate _detachCounterListener(): void {\n\t\tthis._subscription?.unsubscribe();\n\t\tthis._subscription = null;\n\n\t\tif (this._inputListener && this._textareaElement) {\n\t\t\tthis._textareaElement.removeEventListener(\"input\", this._inputListener);\n\t\t\tthis._inputListener = null;\n\t\t}\n\t}\n\n\tprivate _countValue(value: string): number {\n\t\tif (this.counterMode === \"word\") {\n\t\t\treturn value.match(/\\p{L}+/gu)?.length || 0;\n\t\t}\n\t\treturn value.length;\n\t}\n}\n",
|
|
73055
73185
|
"assetsDirs": [],
|
|
73056
73186
|
"styleUrlsData": "",
|
|
73057
73187
|
"stylesData": "",
|
|
@@ -73068,7 +73198,7 @@
|
|
|
73068
73198
|
"deprecationMessage": ""
|
|
73069
73199
|
}
|
|
73070
73200
|
],
|
|
73071
|
-
"line":
|
|
73201
|
+
"line": 254,
|
|
73072
73202
|
"rawdescription": "\n\nCreates an instance of Label.\n",
|
|
73073
73203
|
"jsdoctags": [
|
|
73074
73204
|
{
|
|
@@ -73095,7 +73225,7 @@
|
|
|
73095
73225
|
"name": "isReadonly",
|
|
73096
73226
|
"type": "",
|
|
73097
73227
|
"returnType": "",
|
|
73098
|
-
"line":
|
|
73228
|
+
"line": 140
|
|
73099
73229
|
}
|
|
73100
73230
|
},
|
|
73101
73231
|
"fluidClass": {
|
|
@@ -73104,7 +73234,7 @@
|
|
|
73104
73234
|
"name": "fluidClass",
|
|
73105
73235
|
"type": "",
|
|
73106
73236
|
"returnType": "",
|
|
73107
|
-
"line":
|
|
73237
|
+
"line": 144
|
|
73108
73238
|
}
|
|
73109
73239
|
},
|
|
73110
73240
|
"fluidSkeletonClass": {
|
|
@@ -73113,14 +73243,14 @@
|
|
|
73113
73243
|
"name": "fluidSkeletonClass",
|
|
73114
73244
|
"type": "",
|
|
73115
73245
|
"returnType": "",
|
|
73116
|
-
"line":
|
|
73246
|
+
"line": 148
|
|
73117
73247
|
}
|
|
73118
73248
|
}
|
|
73119
73249
|
}
|
|
73120
73250
|
},
|
|
73121
73251
|
{
|
|
73122
73252
|
"name": "TextInputLabelComponent",
|
|
73123
|
-
"id": "component-TextInputLabelComponent-
|
|
73253
|
+
"id": "component-TextInputLabelComponent-6b58080fc4acf26ac8406e1f9cb93af889c56bb67ee44c721ee7a2d82d9a3d67a40e791cbc951dcd1f2d1bc65baf522d7f3dce104e6f5a011c5da9cad3fe5274",
|
|
73124
73254
|
"file": "src/input/text-input-label.component.ts",
|
|
73125
73255
|
"encapsulation": [],
|
|
73126
73256
|
"entryComponents": [],
|
|
@@ -73141,7 +73271,7 @@
|
|
|
73141
73271
|
"deprecationMessage": "",
|
|
73142
73272
|
"rawdescription": "\n\nSet the arialabel for label\n",
|
|
73143
73273
|
"description": "<p>Set the arialabel for label</p>\n",
|
|
73144
|
-
"line":
|
|
73274
|
+
"line": 229,
|
|
73145
73275
|
"type": "string",
|
|
73146
73276
|
"decorators": []
|
|
73147
73277
|
},
|
|
@@ -73151,7 +73281,7 @@
|
|
|
73151
73281
|
"deprecationMessage": "",
|
|
73152
73282
|
"rawdescription": "\n\n**Experimental**: Optional decorator (e.g. AI label).\n",
|
|
73153
73283
|
"description": "<p><strong>Experimental</strong>: Optional decorator (e.g. AI label).</p>\n",
|
|
73154
|
-
"line":
|
|
73284
|
+
"line": 239,
|
|
73155
73285
|
"type": "TemplateRef<any>",
|
|
73156
73286
|
"decorators": []
|
|
73157
73287
|
},
|
|
@@ -73162,7 +73292,7 @@
|
|
|
73162
73292
|
"deprecationMessage": "",
|
|
73163
73293
|
"rawdescription": "\n\nSet to `true` for a disabled label.\n",
|
|
73164
73294
|
"description": "<p>Set to <code>true</code> for a disabled label.</p>\n",
|
|
73165
|
-
"line":
|
|
73295
|
+
"line": 194,
|
|
73166
73296
|
"type": "boolean",
|
|
73167
73297
|
"decorators": []
|
|
73168
73298
|
},
|
|
@@ -73173,7 +73303,7 @@
|
|
|
73173
73303
|
"deprecationMessage": "",
|
|
73174
73304
|
"rawdescription": "\n\nSet to `true` (`maxCount` must be set) to displays a live character\ncounter alongside the label.\n",
|
|
73175
73305
|
"description": "<p>Set to <code>true</code> (<code>maxCount</code> must be set) to displays a live character\ncounter alongside the label.</p>\n",
|
|
73176
|
-
"line":
|
|
73306
|
+
"line": 262,
|
|
73177
73307
|
"type": "boolean",
|
|
73178
73308
|
"decorators": []
|
|
73179
73309
|
},
|
|
@@ -73184,7 +73314,7 @@
|
|
|
73184
73314
|
"deprecationMessage": "",
|
|
73185
73315
|
"rawdescription": "\n\nExperimental: enable fluid state\n",
|
|
73186
73316
|
"description": "<p>Experimental: enable fluid state</p>\n",
|
|
73187
|
-
"line":
|
|
73317
|
+
"line": 234,
|
|
73188
73318
|
"type": "boolean",
|
|
73189
73319
|
"decorators": []
|
|
73190
73320
|
},
|
|
@@ -73194,7 +73324,7 @@
|
|
|
73194
73324
|
"deprecationMessage": "",
|
|
73195
73325
|
"rawdescription": "\n\nOptional helper text that appears under the label.\n",
|
|
73196
73326
|
"description": "<p>Optional helper text that appears under the label.</p>\n",
|
|
73197
|
-
"line":
|
|
73327
|
+
"line": 209,
|
|
73198
73328
|
"type": "string | TemplateRef<any>",
|
|
73199
73329
|
"decorators": []
|
|
73200
73330
|
},
|
|
@@ -73205,7 +73335,7 @@
|
|
|
73205
73335
|
"deprecationMessage": "",
|
|
73206
73336
|
"rawdescription": "\n\nSet to `true` to hide the label visually, but keep accessible to\nscreen readers.\n",
|
|
73207
73337
|
"description": "<p>Set to <code>true</code> to hide the label visually, but keep accessible to\nscreen readers.</p>\n",
|
|
73208
|
-
"line":
|
|
73338
|
+
"line": 245,
|
|
73209
73339
|
"type": "boolean",
|
|
73210
73340
|
"decorators": []
|
|
73211
73341
|
},
|
|
@@ -73216,7 +73346,7 @@
|
|
|
73216
73346
|
"deprecationMessage": "",
|
|
73217
73347
|
"rawdescription": "\n\nSet to `true` to render the label and field side-by-side instead of stacked.\n",
|
|
73218
73348
|
"description": "<p>Set to <code>true</code> to render the label and field side-by-side instead of stacked.</p>\n",
|
|
73219
|
-
"line":
|
|
73349
|
+
"line": 250,
|
|
73220
73350
|
"type": "boolean",
|
|
73221
73351
|
"decorators": []
|
|
73222
73352
|
},
|
|
@@ -73227,7 +73357,7 @@
|
|
|
73227
73357
|
"deprecationMessage": "",
|
|
73228
73358
|
"rawdescription": "\n\nSet to `true` for an invalid label component.\n",
|
|
73229
73359
|
"description": "<p>Set to <code>true</code> for an invalid label component.</p>\n",
|
|
73230
|
-
"line":
|
|
73360
|
+
"line": 217,
|
|
73231
73361
|
"type": "boolean",
|
|
73232
73362
|
"decorators": []
|
|
73233
73363
|
},
|
|
@@ -73237,7 +73367,7 @@
|
|
|
73237
73367
|
"deprecationMessage": "",
|
|
73238
73368
|
"rawdescription": "\n\nSets the invalid text.\n",
|
|
73239
73369
|
"description": "<p>Sets the invalid text.</p>\n",
|
|
73240
|
-
"line":
|
|
73370
|
+
"line": 213,
|
|
73241
73371
|
"type": "string | TemplateRef<any>",
|
|
73242
73372
|
"decorators": []
|
|
73243
73373
|
},
|
|
@@ -73248,7 +73378,7 @@
|
|
|
73248
73378
|
"deprecationMessage": "",
|
|
73249
73379
|
"rawdescription": "\n\nThe id of the input item associated with the `Label`. This value is also used to associate the `Label` with\nits input counterpart through the 'for' attribute.\n",
|
|
73250
73380
|
"description": "<p>The id of the input item associated with the <code>Label</code>. This value is also used to associate the <code>Label</code> with\nits input counterpart through the 'for' attribute.</p>\n",
|
|
73251
|
-
"line":
|
|
73381
|
+
"line": 189,
|
|
73252
73382
|
"type": "string",
|
|
73253
73383
|
"decorators": []
|
|
73254
73384
|
},
|
|
@@ -73258,7 +73388,7 @@
|
|
|
73258
73388
|
"deprecationMessage": "",
|
|
73259
73389
|
"rawdescription": "\n\nHelper input property for ease of migration\nSince we cannot pass ng-content down easily from label component, we will accept the templates\n",
|
|
73260
73390
|
"description": "<p>Helper input property for ease of migration\nSince we cannot pass ng-content down easily from label component, we will accept the templates</p>\n",
|
|
73261
|
-
"line":
|
|
73391
|
+
"line": 204,
|
|
73262
73392
|
"type": "TemplateRef<any>",
|
|
73263
73393
|
"decorators": []
|
|
73264
73394
|
},
|
|
@@ -73268,7 +73398,7 @@
|
|
|
73268
73398
|
"deprecationMessage": "",
|
|
73269
73399
|
"rawdescription": "\n\nMaximum number of characters (or words) allowed. Required for the\ncounter to display.\n",
|
|
73270
73400
|
"description": "<p>Maximum number of characters (or words) allowed. Required for the\ncounter to display.</p>\n",
|
|
73271
|
-
"line":
|
|
73401
|
+
"line": 268,
|
|
73272
73402
|
"type": "number",
|
|
73273
73403
|
"decorators": []
|
|
73274
73404
|
},
|
|
@@ -73279,7 +73409,7 @@
|
|
|
73279
73409
|
"deprecationMessage": "",
|
|
73280
73410
|
"rawdescription": "\n\nThe render size for the `TextInput`. Used to compute the INLINE label size\nvariant class (`cds--label--inline--{size}`).\n",
|
|
73281
73411
|
"description": "<p>The render size for the <code>TextInput</code>. Used to compute the INLINE label size\nvariant class (<code>cds--label--inline--{size}</code>).</p>\n",
|
|
73282
|
-
"line":
|
|
73412
|
+
"line": 256,
|
|
73283
73413
|
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
73284
73414
|
"decorators": []
|
|
73285
73415
|
},
|
|
@@ -73290,7 +73420,7 @@
|
|
|
73290
73420
|
"deprecationMessage": "",
|
|
73291
73421
|
"rawdescription": "\n\nSet to `true` for a loading label.\n",
|
|
73292
73422
|
"description": "<p>Set to <code>true</code> for a loading label.</p>\n",
|
|
73293
|
-
"line":
|
|
73423
|
+
"line": 198,
|
|
73294
73424
|
"type": "boolean",
|
|
73295
73425
|
"decorators": []
|
|
73296
73426
|
},
|
|
@@ -73298,7 +73428,7 @@
|
|
|
73298
73428
|
"name": "textInputTemplate",
|
|
73299
73429
|
"deprecated": false,
|
|
73300
73430
|
"deprecationMessage": "",
|
|
73301
|
-
"line":
|
|
73431
|
+
"line": 205,
|
|
73302
73432
|
"type": "TemplateRef<any>",
|
|
73303
73433
|
"decorators": []
|
|
73304
73434
|
},
|
|
@@ -73309,7 +73439,7 @@
|
|
|
73309
73439
|
"deprecationMessage": "",
|
|
73310
73440
|
"rawdescription": "\n\nSet to `true` to show a warning (contents set by warningText)\n",
|
|
73311
73441
|
"description": "<p>Set to <code>true</code> to show a warning (contents set by warningText)</p>\n",
|
|
73312
|
-
"line":
|
|
73442
|
+
"line": 221,
|
|
73313
73443
|
"type": "boolean",
|
|
73314
73444
|
"decorators": []
|
|
73315
73445
|
},
|
|
@@ -73319,7 +73449,7 @@
|
|
|
73319
73449
|
"deprecationMessage": "",
|
|
73320
73450
|
"rawdescription": "\n\nSets the warning text\n",
|
|
73321
73451
|
"description": "<p>Sets the warning text</p>\n",
|
|
73322
|
-
"line":
|
|
73452
|
+
"line": 225,
|
|
73323
73453
|
"type": "string | TemplateRef<any>",
|
|
73324
73454
|
"decorators": []
|
|
73325
73455
|
}
|
|
@@ -73334,7 +73464,7 @@
|
|
|
73334
73464
|
"type": "",
|
|
73335
73465
|
"optional": false,
|
|
73336
73466
|
"description": "",
|
|
73337
|
-
"line":
|
|
73467
|
+
"line": 279,
|
|
73338
73468
|
"decorators": [
|
|
73339
73469
|
{
|
|
73340
73470
|
"name": "HostBinding",
|
|
@@ -73353,7 +73483,7 @@
|
|
|
73353
73483
|
"type": "number",
|
|
73354
73484
|
"optional": false,
|
|
73355
73485
|
"description": "<p>Used to build the id of the input item associated with the <code>Label</code>.</p>\n",
|
|
73356
|
-
"line":
|
|
73486
|
+
"line": 184,
|
|
73357
73487
|
"rawdescription": "\n\nUsed to build the id of the input item associated with the `Label`.\n",
|
|
73358
73488
|
"modifierKind": [
|
|
73359
73489
|
126
|
|
@@ -73367,7 +73497,25 @@
|
|
|
73367
73497
|
"type": "number",
|
|
73368
73498
|
"optional": false,
|
|
73369
73499
|
"description": "",
|
|
73370
|
-
"line":
|
|
73500
|
+
"line": 271
|
|
73501
|
+
},
|
|
73502
|
+
{
|
|
73503
|
+
"name": "textInput",
|
|
73504
|
+
"deprecated": false,
|
|
73505
|
+
"deprecationMessage": "",
|
|
73506
|
+
"type": "TextInput",
|
|
73507
|
+
"optional": false,
|
|
73508
|
+
"description": "",
|
|
73509
|
+
"line": 277,
|
|
73510
|
+
"decorators": [
|
|
73511
|
+
{
|
|
73512
|
+
"name": "ContentChild",
|
|
73513
|
+
"stringifiedArguments": "TextInput, {static: false}"
|
|
73514
|
+
}
|
|
73515
|
+
],
|
|
73516
|
+
"modifierKind": [
|
|
73517
|
+
170
|
|
73518
|
+
]
|
|
73371
73519
|
},
|
|
73372
73520
|
{
|
|
73373
73521
|
"name": "textInputWrapper",
|
|
@@ -73377,7 +73525,7 @@
|
|
|
73377
73525
|
"type": "",
|
|
73378
73526
|
"optional": false,
|
|
73379
73527
|
"description": "",
|
|
73380
|
-
"line":
|
|
73528
|
+
"line": 281,
|
|
73381
73529
|
"decorators": [
|
|
73382
73530
|
{
|
|
73383
73531
|
"name": "HostBinding",
|
|
@@ -73395,7 +73543,7 @@
|
|
|
73395
73543
|
"type": "ElementRef<HTMLDivElement>",
|
|
73396
73544
|
"optional": false,
|
|
73397
73545
|
"description": "",
|
|
73398
|
-
"line":
|
|
73546
|
+
"line": 274,
|
|
73399
73547
|
"decorators": [
|
|
73400
73548
|
{
|
|
73401
73549
|
"name": "ViewChild",
|
|
@@ -73421,7 +73569,7 @@
|
|
|
73421
73569
|
"optional": false,
|
|
73422
73570
|
"returnType": "boolean",
|
|
73423
73571
|
"typeParameters": [],
|
|
73424
|
-
"line":
|
|
73572
|
+
"line": 359,
|
|
73425
73573
|
"deprecated": false,
|
|
73426
73574
|
"deprecationMessage": "",
|
|
73427
73575
|
"modifierKind": [
|
|
@@ -73448,7 +73596,7 @@
|
|
|
73448
73596
|
"defaultValue": "true",
|
|
73449
73597
|
"deprecated": false,
|
|
73450
73598
|
"deprecationMessage": "",
|
|
73451
|
-
"line":
|
|
73599
|
+
"line": 279,
|
|
73452
73600
|
"type": "boolean",
|
|
73453
73601
|
"decorators": []
|
|
73454
73602
|
},
|
|
@@ -73456,7 +73604,7 @@
|
|
|
73456
73604
|
"name": "class.cds--text-input--fluid",
|
|
73457
73605
|
"deprecated": false,
|
|
73458
73606
|
"deprecationMessage": "",
|
|
73459
|
-
"line":
|
|
73607
|
+
"line": 174,
|
|
73460
73608
|
"type": "boolean",
|
|
73461
73609
|
"decorators": []
|
|
73462
73610
|
},
|
|
@@ -73464,7 +73612,7 @@
|
|
|
73464
73612
|
"name": "class.cds--text-input--fluid__skeleton",
|
|
73465
73613
|
"deprecated": false,
|
|
73466
73614
|
"deprecationMessage": "",
|
|
73467
|
-
"line":
|
|
73615
|
+
"line": 178,
|
|
73468
73616
|
"type": "boolean",
|
|
73469
73617
|
"decorators": []
|
|
73470
73618
|
},
|
|
@@ -73473,7 +73621,7 @@
|
|
|
73473
73621
|
"defaultValue": "true",
|
|
73474
73622
|
"deprecated": false,
|
|
73475
73623
|
"deprecationMessage": "",
|
|
73476
|
-
"line":
|
|
73624
|
+
"line": 281,
|
|
73477
73625
|
"type": "boolean",
|
|
73478
73626
|
"decorators": []
|
|
73479
73627
|
},
|
|
@@ -73481,7 +73629,7 @@
|
|
|
73481
73629
|
"name": "class.cds--text-input-wrapper--inline",
|
|
73482
73630
|
"deprecated": false,
|
|
73483
73631
|
"deprecationMessage": "",
|
|
73484
|
-
"line":
|
|
73632
|
+
"line": 166,
|
|
73485
73633
|
"type": "boolean",
|
|
73486
73634
|
"decorators": []
|
|
73487
73635
|
},
|
|
@@ -73489,7 +73637,7 @@
|
|
|
73489
73637
|
"name": "class.cds--text-input-wrapper--readonly",
|
|
73490
73638
|
"deprecated": false,
|
|
73491
73639
|
"deprecationMessage": "",
|
|
73492
|
-
"line":
|
|
73640
|
+
"line": 170,
|
|
73493
73641
|
"type": "any",
|
|
73494
73642
|
"decorators": []
|
|
73495
73643
|
}
|
|
@@ -73500,7 +73648,7 @@
|
|
|
73500
73648
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { InputModule } from 'carbon-components-angular';</code></pre></div><b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-text-label>\n Label\n <input cdsText type="text" class="input-field">\n</cds-text-label></code></pre></div><p><a href=\"../../?path=/story/components-input--basic\">See demo</a></p>\n",
|
|
73501
73649
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { InputModule } from 'carbon-components-angular';\n```\n\n```html\n<cds-text-label>\n\tLabel\n\t<input cdsText type=\"text\" class=\"input-field\">\n</cds-text-label>\n```\n\n[See demo](../../?path=/story/components-input--basic)\n",
|
|
73502
73650
|
"type": "component",
|
|
73503
|
-
"sourceCode": "import {\n\tAfterContentInit,\n\tAfterViewInit,\n\tChangeDetectorRef,\n\tComponent,\n\tElementRef,\n\tHostBinding,\n\tInput,\n\tOnChanges,\n\tOnDestroy,\n\tSimpleChanges,\n\tTemplateRef,\n\tViewChild\n} from \"@angular/core\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { InputModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-text-label>\n * \tLabel\n * \t<input cdsText type=\"text\" class=\"input-field\">\n * </cds-text-label>\n * ```\n *\n * [See demo](../../?path=/story/components-input--basic)\n */\n@Component({\n\tselector: \"cds-text-label, ibm-text-label\",\n\ttemplate: `\n\t\t<ng-container *ngIf=\"skeleton\">\n\t\t\t<span class=\"cds--label cds--skeleton\"></span>\n\t\t\t<div class=\"cds--text-input cds--skeleton\"></div>\n\t\t</ng-container>\n\t\t<ng-container *ngIf=\"!skeleton\">\n\t\t\t<!-- non-inline: label-wrapper above field; inline: label+validation side-by-side -->\n\t\t\t<ng-container *ngIf=\"!inline; else inlineHeader\">\n\t\t\t\t<div class=\"cds--text-input__label-wrapper\">\n\t\t\t\t\t<label\n\t\t\t\t\t\t[for]=\"labelInputID\"\n\t\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t\t\t}\">\n\t\t\t\t\t\t<ng-template *ngIf=\"labelTemplate; else labelContent\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t\t\t\t\t\t<ng-template #labelContent>\n\t\t\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t</label>\n\t\t\t\t\t<span\n\t\t\t\t\t\t*ngIf=\"enableCounter && maxCount\"\n\t\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\"\n\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t{{textCount}}/{{maxCount}}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\n\t\t\t<ng-template #inlineHeader>\n\t\t\t\t<div class=\"cds--text-input__label-helper-wrapper\">\n\t\t\t\t\t<div class=\"cds--text-input__label-wrapper\">\n\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t[for]=\"labelInputID\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t\t\t\t'cds--visually-hidden': hideLabel,\n\t\t\t\t\t\t\t\t'cds--label--inline': true,\n\t\t\t\t\t\t\t\t'cds--label--inline--sm': size === 'sm',\n\t\t\t\t\t\t\t\t'cds--label--inline--md': size === 'md',\n\t\t\t\t\t\t\t\t'cds--label--inline--lg': size === 'lg'\n\t\t\t\t\t\t\t}\">\n\t\t\t\t\t\t\t<ng-template *ngIf=\"labelTemplate\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<ng-container *ngIf=\"!fluid\">\n\t\t\t\t\t\t<ng-container [ngTemplateOutlet]=\"validationOrHelper\"></ng-container>\n\t\t\t\t\t</ng-container>\n\t\t\t\t</div>\n\t\t\t</ng-template>\n\n\t\t\t<div\n\t\t\t\tclass=\"cds--text-input__field-outer-wrapper\"\n\t\t\t\t[ngClass]=\"{'cds--text-input__field-outer-wrapper--inline': inline}\">\n\t\t\t<div\n\t\t\t\tclass=\"cds--text-input__field-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--text-input__field-wrapper--warning': warn,\n\t\t\t\t\t'cds--text-input__field-wrapper--decorator': !!decorator\n\t\t\t\t}\"\n\t\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\t\t\t#wrapper>\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--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--text-input__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--text-input__invalid-icon cds--text-input__invalid-icon--warning\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<ng-template *ngIf=\"textInputTemplate; else textInputContent\" [ngTemplateOutlet]=\"textInputTemplate\"></ng-template>\n\t\t\t\t\t<ng-template #textInputContent>\n\t\t\t\t\t\t<ng-content select=\"[cdsText],[ibmText],input[type=text],div\"></ng-content>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t\t<div class=\"cds--text-input__field-inner-wrapper--decorator\">\n\t\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</ng-container>\n\n\t\t\t\t\t<ng-container *ngIf=\"fluid\">\n\t\t\t\t\t\t<hr class=\"cds--text-input__divider\" />\n\t\t\t\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</ng-container>\n\t\t\t\t</div>\n\t\t\t\t<ng-container *ngIf=\"!fluid && !inline\">\n\t\t\t\t\t<ng-container [ngTemplateOutlet]=\"validationOrHelper\"></ng-container>\n\t\t\t\t</ng-container>\n\t\t\t</div>\n\t\t</ng-container>\n\n\t\t<ng-template #validationOrHelper>\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, 'cds--form__helper-text--inline': inline}\">\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=\"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</ng-template>\n\t`\n})\nexport class TextInputLabelComponent implements AfterViewInit, AfterContentInit, OnChanges, OnDestroy {\n\n\t@HostBinding(\"class.cds--text-input-wrapper--inline\") get isInlineWrapper() {\n\t\treturn this.inline;\n\t}\n\n\t@HostBinding(\"class.cds--text-input-wrapper--readonly\") get isReadonly() {\n\t\treturn this.wrapper?.nativeElement.querySelector(\"input\")?.readOnly ?? false;\n\t}\n\n\t@HostBinding(\"class.cds--text-input--fluid\") get fluidClass() {\n\t\treturn this.fluid && !this.skeleton;\n\t}\n\n\t@HostBinding(\"class.cds--text-input--fluid__skeleton\") get fluidSkeletonClass() {\n\t\treturn this.fluid && this.skeleton;\n\t}\n\t/**\n\t * Used to build the id of the input item associated with the `Label`.\n\t */\n\tstatic labelCounter = 0;\n\t/**\n\t * The id of the input item associated with the `Label`. This value is also used to associate the `Label` with\n\t * its input counterpart through the 'for' attribute.\n\t*/\n\t@Input() labelInputID = \"ibm-text-input-\" + TextInputLabelComponent.labelCounter++;\n\n\t/**\n\t * Set to `true` for a disabled label.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading label.\n\t */\n\t@Input() skeleton = false;\n\n\t/**\n\t * Helper input property for ease of migration\n\t * Since we cannot pass ng-content down easily from label component, we will accept the templates\n\t */\n\t@Input() labelTemplate: TemplateRef<any>;\n\t@Input() textInputTemplate: TemplateRef<any>;\n\t/**\n\t * Optional helper text that appears under the label.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` for an invalid label component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\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 * Set the arialabel for label\n\t */\n\t@Input() ariaLabel: string;\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@Input() fluid = false;\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\n\t/**\n\t * Set to `true` to hide the label visually, but keep accessible to\n\t * screen readers.\n\t */\n\t@Input() hideLabel = false;\n\n\t/**\n\t * Set to `true` to render the label and field side-by-side instead of stacked.\n\t */\n\t@Input() inline = false;\n\n\t/**\n\t * The render size for the `TextInput`. Used to compute the INLINE label size\n\t * variant class (`cds--label--inline--{size}`).\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\n\t/**\n\t * Set to `true` (`maxCount` must be set) to displays a live character\n\t * counter alongside the label.\n\t */\n\t@Input() enableCounter = false;\n\n\t/**\n\t * Maximum number of characters (or words) allowed. Required for the\n\t * counter to display.\n\t */\n\t@Input() maxCount: number;\n\n\t// Tracks current character count for the counter display.\n\ttextCount = 0;\n\n\t// @ts-ignore\n\t@ViewChild(\"wrapper\", { static: false }) wrapper: ElementRef<HTMLDivElement>;\n\n\t@HostBinding(\"class.cds--form-item\") labelClass = true;\n\n\t@HostBinding(\"class.cds--text-input-wrapper\") textInputWrapper = true;\n\n\t// Cached reference to the input element, set once in ngAfterViewInit.\n\tprivate _inputElement: HTMLInputElement | null = null;\n\t// Cached listener so it can be removed precisely (avoids anonymous-function leak).\n\tprivate _inputListener: ((e: Event) => void) | null = null;\n\n\t/**\n\t * Creates an instance of Label.\n\t */\n\tconstructor(protected changeDetectorRef: ChangeDetectorRef) {}\n\n\t/**\n\t * Sets the id on the input item associated with the `Label` and attaches the\n\t * counter listener when `enableCounter` is already `true` on first render.\n\t */\n\tngAfterViewInit() {\n\t\tif (this.wrapper) {\n\t\t\t// Prioritize setting id to `input` over div\n\t\t\tconst inputElement = this.wrapper.nativeElement.querySelector(\"input\");\n\t\t\tif (inputElement) {\n\t\t\t\t// avoid overriding ids already set by the user, reuse it instead\n\t\t\t\tif (inputElement.id) {\n\t\t\t\t\tthis.labelInputID = inputElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tinputElement.setAttribute(\"id\", this.labelInputID);\n\n\t\t\t\tthis._inputElement = inputElement;\n\n\t\t\t\tif (this.enableCounter) {\n\t\t\t\t\tthis.textCount = inputElement.value?.length || 0;\n\t\t\t\t\tthis._attachCounterListener();\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst divElement = this.wrapper.nativeElement.querySelector(\"div\");\n\t\t\tif (divElement) {\n\t\t\t\tif (divElement.id) {\n\t\t\t\t\tthis.labelInputID = divElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tdivElement.setAttribute(\"id\", this.labelInputID);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Attach/remove listener and seed `textCount` from the textarea's current value.\n\t * @param changes\n\t */\n\tngOnChanges(changes: SimpleChanges) {\n\t\tif (changes.enableCounter && !changes.enableCounter.firstChange) {\n\t\t\tif (changes.enableCounter.currentValue) {\n\t\t\t\tif (this._inputElement) {\n\t\t\t\t\tthis.textCount = this._inputElement.value?.length || 0;\n\t\t\t\t\tthis._attachCounterListener();\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._detachCounterListener();\n\t\t\t}\n\t\t}\n\t}\n\n\tngAfterContentInit() {\n\t\tthis.changeDetectorRef.detectChanges();\n\t}\n\n\tngOnDestroy() {\n\t\tthis._detachCounterListener();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Attaches the input event listener, ensuring it is never added twice.\n\t */\n\tprivate _attachCounterListener(): void {\n\t\tthis._detachCounterListener();\n\t\tif (!this._inputElement) {\n\t\t\treturn;\n\t\t}\n\t\tthis._inputListener = (e: Event) => {\n\t\t\tthis.textCount = (e.target as HTMLInputElement).value?.length || 0;\n\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t};\n\t\tthis._inputElement.addEventListener(\"input\", this._inputListener);\n\t}\n\n\t/**\n\t * Removes the input event listener and clears the cached reference.\n\t */\n\tprivate _detachCounterListener(): void {\n\t\tif (this._inputListener && this._inputElement) {\n\t\t\tthis._inputElement.removeEventListener(\"input\", this._inputListener);\n\t\t\tthis._inputListener = null;\n\t\t}\n\t}\n}\n",
|
|
73651
|
+
"sourceCode": "import {\n\tAfterContentInit,\n\tAfterViewInit,\n\tChangeDetectorRef,\n\tComponent,\n\tContentChild,\n\tElementRef,\n\tHostBinding,\n\tInput,\n\tOnChanges,\n\tOnDestroy,\n\tSimpleChanges,\n\tTemplateRef,\n\tViewChild\n} from \"@angular/core\";\nimport { Subscription } from \"rxjs\";\nimport { startWith } from \"rxjs/operators\";\nimport { TextInput } from \"./input.directive\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { InputModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-text-label>\n * \tLabel\n * \t<input cdsText type=\"text\" class=\"input-field\">\n * </cds-text-label>\n * ```\n *\n * [See demo](../../?path=/story/components-input--basic)\n */\n@Component({\n\tselector: \"cds-text-label, ibm-text-label\",\n\ttemplate: `\n\t\t<ng-container *ngIf=\"skeleton\">\n\t\t\t<span class=\"cds--label cds--skeleton\"></span>\n\t\t\t<div class=\"cds--text-input cds--skeleton\"></div>\n\t\t</ng-container>\n\t\t<ng-container *ngIf=\"!skeleton\">\n\t\t\t<!-- non-inline: label-wrapper above field; inline: label+validation side-by-side -->\n\t\t\t<ng-container *ngIf=\"!inline; else inlineHeader\">\n\t\t\t\t<div class=\"cds--text-input__label-wrapper\">\n\t\t\t\t\t<label\n\t\t\t\t\t\t[for]=\"labelInputID\"\n\t\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t\t\t}\">\n\t\t\t\t\t\t<ng-template *ngIf=\"labelTemplate; else labelContent\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t\t\t\t\t\t<ng-template #labelContent>\n\t\t\t\t\t\t\t<ng-content></ng-content>\n\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t</label>\n\t\t\t\t\t<span\n\t\t\t\t\t\t*ngIf=\"enableCounter && maxCount\"\n\t\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\"\n\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t{{textCount}}/{{maxCount}}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\n\t\t\t<ng-template #inlineHeader>\n\t\t\t\t<div class=\"cds--text-input__label-helper-wrapper\">\n\t\t\t\t\t<div class=\"cds--text-input__label-wrapper\">\n\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t[for]=\"labelInputID\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t\t\tclass=\"cds--label\"\n\t\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t\t\t\t'cds--visually-hidden': hideLabel,\n\t\t\t\t\t\t\t\t'cds--label--inline': true,\n\t\t\t\t\t\t\t\t'cds--label--inline--sm': size === 'sm',\n\t\t\t\t\t\t\t\t'cds--label--inline--md': size === 'md',\n\t\t\t\t\t\t\t\t'cds--label--inline--lg': size === 'lg'\n\t\t\t\t\t\t\t}\">\n\t\t\t\t\t\t\t<ng-template *ngIf=\"labelTemplate\" [ngTemplateOutlet]=\"labelTemplate\"></ng-template>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<ng-container *ngIf=\"!fluid\">\n\t\t\t\t\t\t<ng-container [ngTemplateOutlet]=\"validationOrHelper\"></ng-container>\n\t\t\t\t\t</ng-container>\n\t\t\t\t</div>\n\t\t\t</ng-template>\n\n\t\t\t<div\n\t\t\t\tclass=\"cds--text-input__field-outer-wrapper\"\n\t\t\t\t[ngClass]=\"{'cds--text-input__field-outer-wrapper--inline': inline}\">\n\t\t\t<div\n\t\t\t\tclass=\"cds--text-input__field-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--text-input__field-wrapper--warning': warn,\n\t\t\t\t\t'cds--text-input__field-wrapper--decorator': !!decorator\n\t\t\t\t}\"\n\t\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\t\t\t#wrapper>\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--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--text-input__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--text-input__invalid-icon cds--text-input__invalid-icon--warning\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<ng-template *ngIf=\"textInputTemplate; else textInputContent\" [ngTemplateOutlet]=\"textInputTemplate\"></ng-template>\n\t\t\t\t\t<ng-template #textInputContent>\n\t\t\t\t\t\t<ng-content select=\"[cdsText],[ibmText],input[type=text],div\"></ng-content>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t\t<div class=\"cds--text-input__field-inner-wrapper--decorator\">\n\t\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</ng-container>\n\n\t\t\t\t\t<ng-container *ngIf=\"fluid\">\n\t\t\t\t\t\t<hr class=\"cds--text-input__divider\" />\n\t\t\t\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</ng-container>\n\t\t\t\t</div>\n\t\t\t\t<ng-container *ngIf=\"!fluid && !inline\">\n\t\t\t\t\t<ng-container [ngTemplateOutlet]=\"validationOrHelper\"></ng-container>\n\t\t\t\t</ng-container>\n\t\t\t</div>\n\t\t</ng-container>\n\n\t\t<ng-template #validationOrHelper>\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, 'cds--form__helper-text--inline': inline}\">\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=\"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</ng-template>\n\t`\n})\nexport class TextInputLabelComponent implements AfterViewInit, AfterContentInit, OnChanges, OnDestroy {\n\n\t@HostBinding(\"class.cds--text-input-wrapper--inline\") get isInlineWrapper() {\n\t\treturn this.inline;\n\t}\n\n\t@HostBinding(\"class.cds--text-input-wrapper--readonly\") get isReadonly() {\n\t\treturn this.wrapper?.nativeElement.querySelector(\"input\")?.readOnly ?? false;\n\t}\n\n\t@HostBinding(\"class.cds--text-input--fluid\") get fluidClass() {\n\t\treturn this.fluid && !this.skeleton;\n\t}\n\n\t@HostBinding(\"class.cds--text-input--fluid__skeleton\") get fluidSkeletonClass() {\n\t\treturn this.fluid && this.skeleton;\n\t}\n\t/**\n\t * Used to build the id of the input item associated with the `Label`.\n\t */\n\tstatic labelCounter = 0;\n\t/**\n\t * The id of the input item associated with the `Label`. This value is also used to associate the `Label` with\n\t * its input counterpart through the 'for' attribute.\n\t*/\n\t@Input() labelInputID = \"ibm-text-input-\" + TextInputLabelComponent.labelCounter++;\n\n\t/**\n\t * Set to `true` for a disabled label.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading label.\n\t */\n\t@Input() skeleton = false;\n\n\t/**\n\t * Helper input property for ease of migration\n\t * Since we cannot pass ng-content down easily from label component, we will accept the templates\n\t */\n\t@Input() labelTemplate: TemplateRef<any>;\n\t@Input() textInputTemplate: TemplateRef<any>;\n\t/**\n\t * Optional helper text that appears under the label.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` for an invalid label component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\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 * Set the arialabel for label\n\t */\n\t@Input() ariaLabel: string;\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@Input() fluid = false;\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\n\t/**\n\t * Set to `true` to hide the label visually, but keep accessible to\n\t * screen readers.\n\t */\n\t@Input() hideLabel = false;\n\n\t/**\n\t * Set to `true` to render the label and field side-by-side instead of stacked.\n\t */\n\t@Input() inline = false;\n\n\t/**\n\t * The render size for the `TextInput`. Used to compute the INLINE label size\n\t * variant class (`cds--label--inline--{size}`).\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\n\t/**\n\t * Set to `true` (`maxCount` must be set) to displays a live character\n\t * counter alongside the label.\n\t */\n\t@Input() enableCounter = false;\n\n\t/**\n\t * Maximum number of characters (or words) allowed. Required for the\n\t * counter to display.\n\t */\n\t@Input() maxCount: number;\n\n\t// Tracks current character count for the counter display.\n\ttextCount = 0;\n\n\t// @ts-ignore\n\t@ViewChild(\"wrapper\", { static: false }) wrapper: ElementRef<HTMLDivElement>;\n\n\t// @ts-ignore\n\t@ContentChild(TextInput, { static: false }) textInput: TextInput;\n\n\t@HostBinding(\"class.cds--form-item\") labelClass = true;\n\n\t@HostBinding(\"class.cds--text-input-wrapper\") textInputWrapper = true;\n\n\t// Cached reference to the input element, set once in ngAfterViewInit.\n\tprivate _inputElement: HTMLInputElement | null = null;\n\n\t// RxJS subscription used when NgControl is available (template-driven & reactive forms).\n\tprivate _subscription: Subscription | null = null;\n\n\t// Fallback cached DOM listener so it can be removed precisely (avoids anonymous-function leak).\n\tprivate _inputListener: ((e: Event) => void) | null = null;\n\n\t/**\n\t * Creates an instance of Label.\n\t */\n\tconstructor(protected changeDetectorRef: ChangeDetectorRef) {}\n\n\t/**\n\t * Sets the id on the input item associated with the `Label` and attaches the\n\t * counter listener when `enableCounter` is already `true` on first render.\n\t */\n\tngAfterViewInit() {\n\t\tif (this.wrapper) {\n\t\t\t// Prioritize setting id to `input` over div\n\t\t\tconst inputElement = this.wrapper.nativeElement.querySelector(\"input\");\n\t\t\tif (inputElement) {\n\t\t\t\t// avoid overriding ids already set by the user, reuse it instead\n\t\t\t\tif (inputElement.id) {\n\t\t\t\t\tthis.labelInputID = inputElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tinputElement.setAttribute(\"id\", this.labelInputID);\n\n\t\t\t\tthis._inputElement = inputElement;\n\n\t\t\t\tif (this.enableCounter) {\n\t\t\t\t\tthis.textCount = inputElement.value?.length || 0;\n\t\t\t\t\tthis._attachCounterListener();\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst divElement = this.wrapper.nativeElement.querySelector(\"div\");\n\t\t\tif (divElement) {\n\t\t\t\tif (divElement.id) {\n\t\t\t\t\tthis.labelInputID = divElement.id;\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t\tdivElement.setAttribute(\"id\", this.labelInputID);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Attach/remove listener and seed `textCount` from the input's current value.\n\t */\n\tngOnChanges(changes: SimpleChanges) {\n\t\tif (changes.enableCounter && !changes.enableCounter.firstChange) {\n\t\t\tif (changes.enableCounter.currentValue) {\n\t\t\t\tif (this._inputElement) {\n\t\t\t\t\tthis.textCount = this._inputElement.value?.length || 0;\n\t\t\t\t\tthis._attachCounterListener();\n\t\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._detachCounterListener();\n\t\t\t}\n\t\t}\n\t}\n\n\tngAfterContentInit() {\n\t\tthis.changeDetectorRef.detectChanges();\n\t}\n\n\tngOnDestroy() {\n\t\tthis._detachCounterListener();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Attaches the counter listener, listen for either ngControl or native DOM input\n\t * event listener\n\t */\n\tprivate _attachCounterListener(): void {\n\t\tthis._detachCounterListener();\n\n\t\tconst control = this.textInput?.ngControl;\n\t\tif (control?.valueChanges) {\n\t\t\t// NgControl listener\n\t\t\tthis._subscription = control.valueChanges\n\t\t\t\t.pipe(startWith(control.value))\n\t\t\t\t.subscribe((value: string) => {\n\t\t\t\t\tthis.textCount = value?.length || 0;\n\t\t\t\t\tthis.changeDetectorRef.markForCheck();\n\t\t\t\t});\n\t\t} else {\n\t\t\t// Fallback DOM path\n\t\t\tif (!this._inputElement) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._inputListener = (e: Event) => {\n\t\t\t\tthis.textCount = (e.target as HTMLInputElement).value?.length || 0;\n\t\t\t\tthis.changeDetectorRef.detectChanges();\n\t\t\t};\n\t\t\tthis._inputElement.addEventListener(\"input\", this._inputListener);\n\t\t}\n\t}\n\n\t/**\n\t * Removes the subscription (NgControl path) or removes the DOM listener.\n\t * Safe to call when neither is active.\n\t */\n\tprivate _detachCounterListener(): void {\n\t\tthis._subscription?.unsubscribe();\n\t\tthis._subscription = null;\n\n\t\tif (this._inputListener && this._inputElement) {\n\t\t\tthis._inputElement.removeEventListener(\"input\", this._inputListener);\n\t\t\tthis._inputListener = null;\n\t\t}\n\t}\n}\n",
|
|
73504
73652
|
"assetsDirs": [],
|
|
73505
73653
|
"styleUrlsData": "",
|
|
73506
73654
|
"stylesData": "",
|
|
@@ -73517,7 +73665,7 @@
|
|
|
73517
73665
|
"deprecationMessage": ""
|
|
73518
73666
|
}
|
|
73519
73667
|
],
|
|
73520
|
-
"line":
|
|
73668
|
+
"line": 290,
|
|
73521
73669
|
"rawdescription": "\n\nCreates an instance of Label.\n",
|
|
73522
73670
|
"jsdoctags": [
|
|
73523
73671
|
{
|
|
@@ -73545,7 +73693,7 @@
|
|
|
73545
73693
|
"name": "isInlineWrapper",
|
|
73546
73694
|
"type": "",
|
|
73547
73695
|
"returnType": "",
|
|
73548
|
-
"line":
|
|
73696
|
+
"line": 166
|
|
73549
73697
|
}
|
|
73550
73698
|
},
|
|
73551
73699
|
"isReadonly": {
|
|
@@ -73554,7 +73702,7 @@
|
|
|
73554
73702
|
"name": "isReadonly",
|
|
73555
73703
|
"type": "",
|
|
73556
73704
|
"returnType": "",
|
|
73557
|
-
"line":
|
|
73705
|
+
"line": 170
|
|
73558
73706
|
}
|
|
73559
73707
|
},
|
|
73560
73708
|
"fluidClass": {
|
|
@@ -73563,7 +73711,7 @@
|
|
|
73563
73711
|
"name": "fluidClass",
|
|
73564
73712
|
"type": "",
|
|
73565
73713
|
"returnType": "",
|
|
73566
|
-
"line":
|
|
73714
|
+
"line": 174
|
|
73567
73715
|
}
|
|
73568
73716
|
},
|
|
73569
73717
|
"fluidSkeletonClass": {
|
|
@@ -73572,7 +73720,7 @@
|
|
|
73572
73720
|
"name": "fluidSkeletonClass",
|
|
73573
73721
|
"type": "",
|
|
73574
73722
|
"returnType": "",
|
|
73575
|
-
"line":
|
|
73723
|
+
"line": 178
|
|
73576
73724
|
}
|
|
73577
73725
|
}
|
|
73578
73726
|
}
|
|
@@ -87241,7 +87389,7 @@
|
|
|
87241
87389
|
"deprecated": false,
|
|
87242
87390
|
"deprecationMessage": "",
|
|
87243
87391
|
"type": "",
|
|
87244
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-dropdown\n\t\t\t\ttype=\"multi\"\n\t\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t\t[(ngModel)]=\"model\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[dropUp]=\"dropUp\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\tplaceholder=\"Select\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t[dropUp]=\"false\"\n\t\t\t\t[fluid]=\"fluid\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t</cds-dropdown>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
87392
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-dropdown\n\t\t\t\ttype=\"multi\"\n\t\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t\t[(ngModel)]=\"model\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[dropUp]=\"dropUp\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\tplaceholder=\"Select\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t[dropUp]=\"false\"\n\t\t\t\t[fluid]=\"fluid\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t</cds-dropdown>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
87245
87393
|
},
|
|
87246
87394
|
{
|
|
87247
87395
|
"name": "MultiStep",
|
|
@@ -87271,7 +87419,7 @@
|
|
|
87271
87419
|
"deprecated": false,
|
|
87272
87420
|
"deprecationMessage": "",
|
|
87273
87421
|
"type": "",
|
|
87274
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[size]=\"size\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[appendInline]=\"false\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\ttype=\"multi\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t`\n})"
|
|
87422
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[size]=\"size\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[appendInline]=\"false\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\ttype=\"multi\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t`\n})"
|
|
87275
87423
|
},
|
|
87276
87424
|
{
|
|
87277
87425
|
"name": "MultiTemplate",
|
|
@@ -87281,7 +87429,7 @@
|
|
|
87281
87429
|
"deprecated": false,
|
|
87282
87430
|
"deprecationMessage": "",
|
|
87283
87431
|
"type": "",
|
|
87284
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\ttype=\"multi\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[size]=\"size\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
87432
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\ttype=\"multi\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[size]=\"size\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
87285
87433
|
},
|
|
87286
87434
|
{
|
|
87287
87435
|
"name": "MultiTemplate",
|
|
@@ -87381,7 +87529,7 @@
|
|
|
87381
87529
|
"deprecated": false,
|
|
87382
87530
|
"deprecationMessage": "",
|
|
87383
87531
|
"type": "",
|
|
87384
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[displayValue]=\"dropdownRenderer\"\n\t\t\t[size]=\"size\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\" [listTpl]=\"dropdownRenderer\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t\t<ng-template #dropdownRenderer let-item=\"item\">\n\t\t\t<div *ngIf=\"item && item.content\" style=\"font-size: 14px;\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\twidth=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\" style=\"will-change: transform;\">\n\t\t\t\t\t<path d=\"M9.3 3.7l3.8 3.8H1v1h12.1l-3.8 3.8.7.7 5-5-5-5z\"></path>\n\t\t\t\t</svg>\n\t\t\t\t {{item.content}}\n\t\t\t</div>\n\t\t</ng-template>\n\t`\n})"
|
|
87532
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[displayValue]=\"dropdownRenderer\"\n\t\t\t[size]=\"size\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\" [listTpl]=\"dropdownRenderer\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t\t<ng-template #dropdownRenderer let-item=\"item\">\n\t\t\t<div *ngIf=\"item && item.content\" style=\"font-size: 14px;\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\twidth=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\" style=\"will-change: transform;\">\n\t\t\t\t\t<path d=\"M9.3 3.7l3.8 3.8H1v1h12.1l-3.8 3.8.7.7 5-5-5-5z\"></path>\n\t\t\t\t</svg>\n\t\t\t\t {{item.content}}\n\t\t\t</div>\n\t\t</ng-template>\n\t`\n})"
|
|
87385
87533
|
},
|
|
87386
87534
|
{
|
|
87387
87535
|
"name": "NoDataTemplate",
|
|
@@ -87681,7 +87829,7 @@
|
|
|
87681
87829
|
"deprecated": false,
|
|
87682
87830
|
"deprecationMessage": "",
|
|
87683
87831
|
"type": "",
|
|
87684
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/combobox/stories/app-reactive-combobox.component.ts\n\t\t-->\n\t\t<app-reactive-combobox\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\">\n\t\t</app-reactive-combobox>\n\t`\n})"
|
|
87832
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/combobox/stories/app-reactive-combobox.component.ts\n\t\t-->\n\t\t<app-reactive-combobox\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[itemValueKey]=\"itemValueKey\">\n\t\t</app-reactive-combobox>\n\t`\n})"
|
|
87685
87833
|
},
|
|
87686
87834
|
{
|
|
87687
87835
|
"name": "ReactiveTemplate",
|
|
@@ -87691,7 +87839,7 @@
|
|
|
87691
87839
|
"deprecated": false,
|
|
87692
87840
|
"deprecationMessage": "",
|
|
87693
87841
|
"type": "",
|
|
87694
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/dropdown/stories/app-reactive-forms.component.ts\n\t\t-->\n\t\t<app-reactive-forms\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[items]=\"items\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t</app-reactive-forms>\n\t`\n})"
|
|
87842
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/dropdown/stories/app-reactive-forms.component.ts\n\t\t-->\n\t\t<app-reactive-forms\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[items]=\"items\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t</app-reactive-forms>\n\t`\n})"
|
|
87695
87843
|
},
|
|
87696
87844
|
{
|
|
87697
87845
|
"name": "ReactiveTemplate",
|
|
@@ -88486,7 +88634,7 @@
|
|
|
88486
88634
|
"deprecated": false,
|
|
88487
88635
|
"deprecationMessage": "",
|
|
88488
88636
|
"type": "",
|
|
88489
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(search)=\"search($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
88637
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(search)=\"search($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
88490
88638
|
},
|
|
88491
88639
|
{
|
|
88492
88640
|
"name": "Template",
|
|
@@ -88526,7 +88674,7 @@
|
|
|
88526
88674
|
"deprecated": false,
|
|
88527
88675
|
"deprecationMessage": "",
|
|
88528
88676
|
"type": "",
|
|
88529
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[size]=\"size\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t`\n})"
|
|
88677
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[size]=\"size\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t`\n})"
|
|
88530
88678
|
},
|
|
88531
88679
|
{
|
|
88532
88680
|
"name": "Template",
|
|
@@ -88606,7 +88754,7 @@
|
|
|
88606
88754
|
"deprecated": false,
|
|
88607
88755
|
"deprecationMessage": "",
|
|
88608
88756
|
"type": "",
|
|
88609
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-textarea-label\n\t\t[helperText]=\"helperText\"\n\t\t[invalid]=\"invalid\"\n\t\t[disabled]=\"disabled\"\n\t\t[invalidText]=\"invalidText\"\n\t\t[fluid]=\"fluid\"\n\t\t[skeleton]=\"skeleton\"\n\t\t[warn]=\"warn\"\n\t\t[warnText]=\"warnText\"\n\t\t[enableCounter]=\"enableCounter\"\n\t\t[maxCount]=\"maxCount\"\n\t\t[counterMode]=\"counterMode\">\n\t\t{{label}}\n\t\t<textarea\n\t\t\tcdsTextArea\n\t\t\t[placeholder]=\"placeholder\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[rows]=\"rows\"\n\t\t\t[cols]=\"cols\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\taria-label=\"textarea\"></textarea>\n\t\t</cds-textarea-label>\n\t`\n})"
|
|
88757
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-textarea-label\n\t\t[helperText]=\"helperText\"\n\t\t[invalid]=\"invalid\"\n\t\t[disabled]=\"disabled\"\n\t\t[invalidText]=\"invalidText\"\n\t\t[fluid]=\"fluid\"\n\t\t[skeleton]=\"skeleton\"\n\t\t[warn]=\"warn\"\n\t\t[warnText]=\"warnText\"\n\t\t[enableCounter]=\"enableCounter\"\n\t\t[maxCount]=\"maxCount\"\n\t\t[counterMode]=\"counterMode\">\n\t\t{{label}}\n\t\t<textarea\n\t\t\tcdsTextArea\n\t\t\t[placeholder]=\"placeholder\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[rows]=\"rows\"\n\t\t\t[cols]=\"cols\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\tstyle=\"width: 100%\"\n\t\t\taria-label=\"textarea\"></textarea>\n\t\t</cds-textarea-label>\n\t`\n})"
|
|
88610
88758
|
},
|
|
88611
88759
|
{
|
|
88612
88760
|
"name": "Template",
|
|
@@ -89398,7 +89546,7 @@
|
|
|
89398
89546
|
"deprecated": false,
|
|
89399
89547
|
"deprecationMessage": "",
|
|
89400
89548
|
"type": "",
|
|
89401
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-combo-box\n\t\t\t\t[(ngModel)]=\"model\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[items]=\"items\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\t[dropUp]=\"dropUp\"\n\t\t\t\t[fluid]=\"fluid\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(submit)=\"submit($event)\"\n\t\t\t\t(search)=\"search($event)\"\n\t\t\t\t(clear)=\"clear($event)\">\n\t\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t\t</cds-combo-box>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
89549
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-combo-box\n\t\t\t\t[(ngModel)]=\"model\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[items]=\"items\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\t[dropUp]=\"dropUp\"\n\t\t\t\t[fluid]=\"fluid\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(submit)=\"submit($event)\"\n\t\t\t\t(search)=\"search($event)\"\n\t\t\t\t(clear)=\"clear($event)\">\n\t\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t\t</cds-combo-box>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
89402
89550
|
},
|
|
89403
89551
|
{
|
|
89404
89552
|
"name": "withAILabelTemplate",
|
|
@@ -89418,7 +89566,7 @@
|
|
|
89418
89566
|
"deprecated": false,
|
|
89419
89567
|
"deprecationMessage": "",
|
|
89420
89568
|
"type": "",
|
|
89421
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-dropdown\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\tplaceholder=\"Select\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t[dropUp]=\"false\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t</cds-dropdown>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
89569
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-dropdown\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\tplaceholder=\"Select\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t[dropUp]=\"false\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t</cds-dropdown>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
89422
89570
|
},
|
|
89423
89571
|
{
|
|
89424
89572
|
"name": "withAILabelTemplate",
|
|
@@ -93527,7 +93675,7 @@
|
|
|
93527
93675
|
"deprecated": false,
|
|
93528
93676
|
"deprecationMessage": "",
|
|
93529
93677
|
"type": "",
|
|
93530
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[size]=\"size\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[appendInline]=\"false\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\ttype=\"multi\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t`\n})"
|
|
93678
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[size]=\"size\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[appendInline]=\"false\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\ttype=\"multi\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t`\n})"
|
|
93531
93679
|
},
|
|
93532
93680
|
{
|
|
93533
93681
|
"name": "ReactiveForms",
|
|
@@ -93547,7 +93695,7 @@
|
|
|
93547
93695
|
"deprecated": false,
|
|
93548
93696
|
"deprecationMessage": "",
|
|
93549
93697
|
"type": "",
|
|
93550
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/combobox/stories/app-reactive-combobox.component.ts\n\t\t-->\n\t\t<app-reactive-combobox\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\">\n\t\t</app-reactive-combobox>\n\t`\n})"
|
|
93698
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/combobox/stories/app-reactive-combobox.component.ts\n\t\t-->\n\t\t<app-reactive-combobox\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[itemValueKey]=\"itemValueKey\">\n\t\t</app-reactive-combobox>\n\t`\n})"
|
|
93551
93699
|
},
|
|
93552
93700
|
{
|
|
93553
93701
|
"name": "Template",
|
|
@@ -93557,7 +93705,7 @@
|
|
|
93557
93705
|
"deprecated": false,
|
|
93558
93706
|
"deprecationMessage": "",
|
|
93559
93707
|
"type": "",
|
|
93560
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(search)=\"search($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
93708
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(search)=\"search($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
93561
93709
|
},
|
|
93562
93710
|
{
|
|
93563
93711
|
"name": "withAILabel",
|
|
@@ -93577,7 +93725,7 @@
|
|
|
93577
93725
|
"deprecated": false,
|
|
93578
93726
|
"deprecationMessage": "",
|
|
93579
93727
|
"type": "",
|
|
93580
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-combo-box\n\t\t\t\t[(ngModel)]=\"model\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[items]=\"items\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\t[dropUp]=\"dropUp\"\n\t\t\t\t[fluid]=\"fluid\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(submit)=\"submit($event)\"\n\t\t\t\t(search)=\"search($event)\"\n\t\t\t\t(clear)=\"clear($event)\">\n\t\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t\t</cds-combo-box>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
93728
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-combo-box\n\t\t\t\t[(ngModel)]=\"model\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[items]=\"items\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\t[dropUp]=\"dropUp\"\n\t\t\t\t[fluid]=\"fluid\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(submit)=\"submit($event)\"\n\t\t\t\t(search)=\"search($event)\"\n\t\t\t\t(clear)=\"clear($event)\">\n\t\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t\t</cds-combo-box>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
93581
93729
|
}
|
|
93582
93730
|
],
|
|
93583
93731
|
"src/content-switcher/content-switcher.stories.ts": [
|
|
@@ -93775,7 +93923,7 @@
|
|
|
93775
93923
|
"deprecated": false,
|
|
93776
93924
|
"deprecationMessage": "",
|
|
93777
93925
|
"type": "",
|
|
93778
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-dropdown\n\t\t\t\ttype=\"multi\"\n\t\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t\t[(ngModel)]=\"model\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[dropUp]=\"dropUp\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\tplaceholder=\"Select\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t[dropUp]=\"false\"\n\t\t\t\t[fluid]=\"fluid\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t</cds-dropdown>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
93926
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-dropdown\n\t\t\t\ttype=\"multi\"\n\t\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t\t[(ngModel)]=\"model\"\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[dropUp]=\"dropUp\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[warn]=\"warn\"\n\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\tplaceholder=\"Select\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t[dropUp]=\"false\"\n\t\t\t\t[fluid]=\"fluid\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t</cds-dropdown>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
93779
93927
|
},
|
|
93780
93928
|
{
|
|
93781
93929
|
"name": "MultiTemplate",
|
|
@@ -93785,7 +93933,7 @@
|
|
|
93785
93933
|
"deprecated": false,
|
|
93786
93934
|
"deprecationMessage": "",
|
|
93787
93935
|
"type": "",
|
|
93788
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\ttype=\"multi\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[size]=\"size\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
93936
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\ttype=\"multi\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[size]=\"size\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
93789
93937
|
},
|
|
93790
93938
|
{
|
|
93791
93939
|
"name": "NgTemplate",
|
|
@@ -93795,7 +93943,7 @@
|
|
|
93795
93943
|
"deprecated": false,
|
|
93796
93944
|
"deprecationMessage": "",
|
|
93797
93945
|
"type": "",
|
|
93798
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[displayValue]=\"dropdownRenderer\"\n\t\t\t[size]=\"size\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\" [listTpl]=\"dropdownRenderer\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t\t<ng-template #dropdownRenderer let-item=\"item\">\n\t\t\t<div *ngIf=\"item && item.content\" style=\"font-size: 14px;\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\twidth=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\" style=\"will-change: transform;\">\n\t\t\t\t\t<path d=\"M9.3 3.7l3.8 3.8H1v1h12.1l-3.8 3.8.7.7 5-5-5-5z\"></path>\n\t\t\t\t</svg>\n\t\t\t\t {{item.content}}\n\t\t\t</div>\n\t\t</ng-template>\n\t`\n})"
|
|
93946
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[displayValue]=\"dropdownRenderer\"\n\t\t\t[size]=\"size\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\" [listTpl]=\"dropdownRenderer\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t\t<ng-template #dropdownRenderer let-item=\"item\">\n\t\t\t<div *ngIf=\"item && item.content\" style=\"font-size: 14px;\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\twidth=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\" style=\"will-change: transform;\">\n\t\t\t\t\t<path d=\"M9.3 3.7l3.8 3.8H1v1h12.1l-3.8 3.8.7.7 5-5-5-5z\"></path>\n\t\t\t\t</svg>\n\t\t\t\t {{item.content}}\n\t\t\t</div>\n\t\t</ng-template>\n\t`\n})"
|
|
93799
93947
|
},
|
|
93800
93948
|
{
|
|
93801
93949
|
"name": "ReactiveForms",
|
|
@@ -93815,7 +93963,7 @@
|
|
|
93815
93963
|
"deprecated": false,
|
|
93816
93964
|
"deprecationMessage": "",
|
|
93817
93965
|
"type": "",
|
|
93818
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/dropdown/stories/app-reactive-forms.component.ts\n\t\t-->\n\t\t<app-reactive-forms\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[items]=\"items\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t</app-reactive-forms>\n\t`\n})"
|
|
93966
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/dropdown/stories/app-reactive-forms.component.ts\n\t\t-->\n\t\t<app-reactive-forms\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[items]=\"items\"\n\t\t\t[selectionFeedback]=\"selectionFeedback\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t</app-reactive-forms>\n\t`\n})"
|
|
93819
93967
|
},
|
|
93820
93968
|
{
|
|
93821
93969
|
"name": "Template",
|
|
@@ -93825,7 +93973,7 @@
|
|
|
93825
93973
|
"deprecated": false,
|
|
93826
93974
|
"deprecationMessage": "",
|
|
93827
93975
|
"type": "",
|
|
93828
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[size]=\"size\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t`\n})"
|
|
93976
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-dropdown\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[size]=\"size\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[theme]=\"theme\"\n\t\t\tplaceholder=\"Select\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t</cds-dropdown>\n\t`\n})"
|
|
93829
93977
|
},
|
|
93830
93978
|
{
|
|
93831
93979
|
"name": "withAILabel",
|
|
@@ -93845,7 +93993,7 @@
|
|
|
93845
93993
|
"deprecated": false,
|
|
93846
93994
|
"deprecationMessage": "",
|
|
93847
93995
|
"type": "",
|
|
93848
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-dropdown\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\tplaceholder=\"Select\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t[dropUp]=\"false\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t</cds-dropdown>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
93996
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\tstyles: AI_LABEL_STORY_STYLES,\n\ttemplate: `\n\t\t<div style=\"width: 400px\">\n\t\t\t<cds-dropdown\n\t\t\t\t[label]=\"label\"\n\t\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t[size]=\"size\"\n\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t[theme]=\"theme\"\n\t\t\t\tplaceholder=\"Select\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t[dropUp]=\"false\"\n\t\t\t\t[decorator]=\"decoratorTpl\"\n\t\t\t\t[itemValueKey]=\"itemValueKey\"\n\t\t\t\t(selected)=\"selected($event)\"\n\t\t\t\t(onClose)=\"onClose($event)\">\n\t\t\t\t<cds-dropdown-list [items]=\"items\"></cds-dropdown-list>\n\t\t\t</cds-dropdown>\n\t\t</div>\n\t\t<ng-template #decoratorTpl>\n\t\t\t<cds-ai-label\n\t\t\t\tclass=\"ai-label-container\"\n\t\t\t\tkind=\"default\"\n\t\t\t\tsize=\"mini\"\n\t\t\t\t[autoAlign]=\"true\"\n\t\t\t\taiText=\"AI\"\n\t\t\t\tariaLabel=\"Show information\">\n\t\t\t\t` + AI_LABEL_INNER + `\n\t\t\t</cds-ai-label>\n\t\t</ng-template>\n\t`\n})"
|
|
93849
93997
|
},
|
|
93850
93998
|
{
|
|
93851
93999
|
"name": "WithTemplate",
|
|
@@ -94349,7 +94497,7 @@
|
|
|
94349
94497
|
"deprecated": false,
|
|
94350
94498
|
"deprecationMessage": "",
|
|
94351
94499
|
"type": "",
|
|
94352
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-textarea-label\n\t\t[helperText]=\"helperText\"\n\t\t[invalid]=\"invalid\"\n\t\t[disabled]=\"disabled\"\n\t\t[invalidText]=\"invalidText\"\n\t\t[fluid]=\"fluid\"\n\t\t[skeleton]=\"skeleton\"\n\t\t[warn]=\"warn\"\n\t\t[warnText]=\"warnText\"\n\t\t[enableCounter]=\"enableCounter\"\n\t\t[maxCount]=\"maxCount\"\n\t\t[counterMode]=\"counterMode\">\n\t\t{{label}}\n\t\t<textarea\n\t\t\tcdsTextArea\n\t\t\t[placeholder]=\"placeholder\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[rows]=\"rows\"\n\t\t\t[cols]=\"cols\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\taria-label=\"textarea\"></textarea>\n\t\t</cds-textarea-label>\n\t`\n})"
|
|
94500
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-textarea-label\n\t\t[helperText]=\"helperText\"\n\t\t[invalid]=\"invalid\"\n\t\t[disabled]=\"disabled\"\n\t\t[invalidText]=\"invalidText\"\n\t\t[fluid]=\"fluid\"\n\t\t[skeleton]=\"skeleton\"\n\t\t[warn]=\"warn\"\n\t\t[warnText]=\"warnText\"\n\t\t[enableCounter]=\"enableCounter\"\n\t\t[maxCount]=\"maxCount\"\n\t\t[counterMode]=\"counterMode\">\n\t\t{{label}}\n\t\t<textarea\n\t\t\tcdsTextArea\n\t\t\t[placeholder]=\"placeholder\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[rows]=\"rows\"\n\t\t\t[cols]=\"cols\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\tstyle=\"width: 100%\"\n\t\t\taria-label=\"textarea\"></textarea>\n\t\t</cds-textarea-label>\n\t`\n})"
|
|
94353
94501
|
},
|
|
94354
94502
|
{
|
|
94355
94503
|
"name": "withAILabel",
|
|
@@ -100025,7 +100173,7 @@
|
|
|
100025
100173
|
"linktype": "component",
|
|
100026
100174
|
"name": "ReactiveFormsCombobox",
|
|
100027
100175
|
"coveragePercent": 0,
|
|
100028
|
-
"coverageCount": "0/
|
|
100176
|
+
"coverageCount": "0/15",
|
|
100029
100177
|
"status": "low"
|
|
100030
100178
|
},
|
|
100031
100179
|
{
|
|
@@ -100810,7 +100958,7 @@
|
|
|
100810
100958
|
"linktype": "component",
|
|
100811
100959
|
"name": "Dropdown",
|
|
100812
100960
|
"coveragePercent": 67,
|
|
100813
|
-
"coverageCount": "
|
|
100961
|
+
"coverageCount": "53/78",
|
|
100814
100962
|
"status": "good"
|
|
100815
100963
|
},
|
|
100816
100964
|
{
|
|
@@ -101024,7 +101172,7 @@
|
|
|
101024
101172
|
"linktype": "component",
|
|
101025
101173
|
"name": "ReactiveFormsStory",
|
|
101026
101174
|
"coveragePercent": 0,
|
|
101027
|
-
"coverageCount": "0/
|
|
101175
|
+
"coverageCount": "0/14",
|
|
101028
101176
|
"status": "low"
|
|
101029
101177
|
},
|
|
101030
101178
|
{
|
|
@@ -101879,8 +102027,8 @@
|
|
|
101879
102027
|
"type": "directive",
|
|
101880
102028
|
"linktype": "directive",
|
|
101881
102029
|
"name": "TextInput",
|
|
101882
|
-
"coveragePercent":
|
|
101883
|
-
"coverageCount": "2/
|
|
102030
|
+
"coveragePercent": 11,
|
|
102031
|
+
"coverageCount": "2/18",
|
|
101884
102032
|
"status": "low"
|
|
101885
102033
|
},
|
|
101886
102034
|
{
|
|
@@ -102025,8 +102173,8 @@
|
|
|
102025
102173
|
"type": "directive",
|
|
102026
102174
|
"linktype": "directive",
|
|
102027
102175
|
"name": "TextArea",
|
|
102028
|
-
"coveragePercent":
|
|
102029
|
-
"coverageCount": "2/
|
|
102176
|
+
"coveragePercent": 18,
|
|
102177
|
+
"coverageCount": "2/11",
|
|
102030
102178
|
"status": "low"
|
|
102031
102179
|
},
|
|
102032
102180
|
{
|
|
@@ -102034,8 +102182,8 @@
|
|
|
102034
102182
|
"type": "component",
|
|
102035
102183
|
"linktype": "component",
|
|
102036
102184
|
"name": "TextInputLabelComponent",
|
|
102037
|
-
"coveragePercent":
|
|
102038
|
-
"coverageCount": "20/
|
|
102185
|
+
"coveragePercent": 60,
|
|
102186
|
+
"coverageCount": "20/33",
|
|
102039
102187
|
"status": "good"
|
|
102040
102188
|
},
|
|
102041
102189
|
{
|