carbon-components-angular 5.72.0 → 5.72.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/documentation/components/TextInputLabelComponent.html +171 -65
- package/docs/documentation/components/TextareaLabelComponent.html +142 -74
- package/docs/documentation/coverage.html +12 -12
- 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 +4 -4
- package/docs/documentation/modules/DialogModule.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 +58 -58
- package/docs/documentation/modules/FileUploaderModule.html +58 -58
- package/docs/documentation/modules/GridModule/dependencies.svg +29 -29
- package/docs/documentation/modules/GridModule.html +29 -29
- package/docs/documentation/modules/I18nModule/dependencies.svg +4 -4
- package/docs/documentation/modules/I18nModule.html +4 -4
- package/docs/documentation/modules/IconModule/dependencies.svg +4 -4
- package/docs/documentation/modules/IconModule.html +4 -4
- package/docs/documentation/modules/InputModule/dependencies.svg +76 -76
- package/docs/documentation/modules/InputModule.html +76 -76
- package/docs/documentation/modules/LayerModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LayerModule.html +4 -4
- package/docs/documentation/modules/ListModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ListModule.html +4 -4
- package/docs/documentation/modules/LoadingModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LoadingModule.html +4 -4
- package/docs/documentation/modules/MenuButtonModule/dependencies.svg +29 -29
- package/docs/documentation/modules/MenuButtonModule.html +29 -29
- package/docs/documentation/modules/ModalModule/dependencies.svg +37 -37
- package/docs/documentation/modules/ModalModule.html +37 -37
- package/docs/documentation/modules/NumberModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NumberModule.html +4 -4
- package/docs/documentation/modules/PaginationModule/dependencies.svg +56 -56
- package/docs/documentation/modules/PaginationModule.html +56 -56
- package/docs/documentation/modules/PanelModule/dependencies.svg +36 -36
- package/docs/documentation/modules/PanelModule.html +36 -36
- package/docs/documentation/modules/PopoverModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PopoverModule.html +4 -4
- package/docs/documentation/modules/ProgressBarModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ProgressBarModule.html +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule.html +4 -4
- package/docs/documentation/modules/RadioModule/dependencies.svg +55 -59
- package/docs/documentation/modules/RadioModule.html +55 -59
- package/docs/documentation/modules/SelectModule/dependencies.svg +61 -61
- package/docs/documentation/modules/SelectModule.html +61 -61
- package/docs/documentation/modules/SideNavModule/dependencies.svg +41 -41
- package/docs/documentation/modules/SideNavModule.html +41 -41
- package/docs/documentation/modules/SkeletonModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SkeletonModule.html +4 -4
- package/docs/documentation/modules/SliderModule/dependencies.svg +40 -36
- package/docs/documentation/modules/SliderModule.html +40 -36
- 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 +137 -137
- package/docs/documentation/modules/TabsModule.html +137 -137
- package/docs/documentation/modules/TagModule/dependencies.svg +38 -38
- package/docs/documentation/modules/TagModule.html +38 -38
- package/docs/documentation/modules/ThemeModule/dependencies.svg +13 -13
- package/docs/documentation/modules/ThemeModule.html +13 -13
- package/docs/documentation/modules/TilesModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TilesModule.html +4 -4
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +7 -7
- package/docs/documentation/modules/TimePickerModule.html +7 -7
- package/docs/documentation/modules/ToggleModule/dependencies.svg +18 -18
- package/docs/documentation/modules/ToggleModule.html +18 -18
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ToggletipModule.html +4 -4
- package/docs/documentation/modules/TooltipModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TooltipModule.html +4 -4
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +28 -28
- package/docs/documentation/modules/TreeviewModule.html +28 -28
- package/docs/documentation/modules/UIShellModule/dependencies.svg +4 -4
- package/docs/documentation/modules/UIShellModule.html +4 -4
- package/docs/documentation.json +249 -131
- package/docs/storybook/1345.da6e3dec.iframe.bundle.js +1 -0
- package/docs/storybook/7019.75ad5817.iframe.bundle.js +2 -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.d2b9abb3.iframe.bundle.js +1 -0
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/{runtime~main.e32f2dfb.iframe.bundle.js → runtime~main.86875b86.iframe.bundle.js} +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/fesm2015/carbon-components-angular-input.mjs +112 -46
- package/fesm2015/carbon-components-angular-input.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-input.mjs +102 -45
- package/fesm2020/carbon-components-angular-input.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/docs/storybook/1345.9ccf4f3f.iframe.bundle.js +0 -1
- package/docs/storybook/7019.b8944046.iframe.bundle.js +0 -2
- package/docs/storybook/main.cdbf1814.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
|
}
|
|
@@ -72700,7 +72800,7 @@
|
|
|
72700
72800
|
},
|
|
72701
72801
|
{
|
|
72702
72802
|
"name": "TextareaLabelComponent",
|
|
72703
|
-
"id": "component-TextareaLabelComponent-
|
|
72803
|
+
"id": "component-TextareaLabelComponent-e4970fada6f6d2a3eaf4d70389becac87203471765858b2a5e72895920f14fd956c84f630e534d74bbaa021f54652e7ed093ed5f9fba7caf6cf63399fc818fce",
|
|
72704
72804
|
"file": "src/input/textarea-label.component.ts",
|
|
72705
72805
|
"encapsulation": [],
|
|
72706
72806
|
"entryComponents": [],
|
|
@@ -72721,7 +72821,7 @@
|
|
|
72721
72821
|
"deprecationMessage": "",
|
|
72722
72822
|
"rawdescription": "\n\nSet the arialabel for label\n",
|
|
72723
72823
|
"description": "<p>Set the arialabel for label</p>\n",
|
|
72724
|
-
"line":
|
|
72824
|
+
"line": 199,
|
|
72725
72825
|
"type": "string",
|
|
72726
72826
|
"decorators": []
|
|
72727
72827
|
},
|
|
@@ -72732,7 +72832,7 @@
|
|
|
72732
72832
|
"deprecationMessage": "",
|
|
72733
72833
|
"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
72834
|
"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":
|
|
72835
|
+
"line": 229,
|
|
72736
72836
|
"type": "\"character\" | \"word\"",
|
|
72737
72837
|
"decorators": []
|
|
72738
72838
|
},
|
|
@@ -72742,7 +72842,7 @@
|
|
|
72742
72842
|
"deprecationMessage": "",
|
|
72743
72843
|
"rawdescription": "\n\n**Experimental**: Optional decorator (e.g. AI label).\n",
|
|
72744
72844
|
"description": "<p><strong>Experimental</strong>: Optional decorator (e.g. AI label).</p>\n",
|
|
72745
|
-
"line":
|
|
72845
|
+
"line": 234,
|
|
72746
72846
|
"type": "TemplateRef<any>",
|
|
72747
72847
|
"decorators": []
|
|
72748
72848
|
},
|
|
@@ -72753,7 +72853,7 @@
|
|
|
72753
72853
|
"deprecationMessage": "",
|
|
72754
72854
|
"rawdescription": "\n\nSet to `true` for a disabled label.\n",
|
|
72755
72855
|
"description": "<p>Set to <code>true</code> for a disabled label.</p>\n",
|
|
72756
|
-
"line":
|
|
72856
|
+
"line": 164,
|
|
72757
72857
|
"type": "boolean",
|
|
72758
72858
|
"decorators": []
|
|
72759
72859
|
},
|
|
@@ -72764,7 +72864,7 @@
|
|
|
72764
72864
|
"deprecationMessage": "",
|
|
72765
72865
|
"rawdescription": "\n\nSet to `true` (`maxCount` must be set) to displays a live character/word\ncounter alongside the label.\n",
|
|
72766
72866
|
"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":
|
|
72867
|
+
"line": 216,
|
|
72768
72868
|
"type": "boolean",
|
|
72769
72869
|
"decorators": []
|
|
72770
72870
|
},
|
|
@@ -72775,7 +72875,7 @@
|
|
|
72775
72875
|
"deprecationMessage": "",
|
|
72776
72876
|
"rawdescription": "\n\nExperimental: enable fluid state\n",
|
|
72777
72877
|
"description": "<p>Experimental: enable fluid state</p>\n",
|
|
72778
|
-
"line":
|
|
72878
|
+
"line": 204,
|
|
72779
72879
|
"type": "boolean",
|
|
72780
72880
|
"decorators": []
|
|
72781
72881
|
},
|
|
@@ -72785,7 +72885,7 @@
|
|
|
72785
72885
|
"deprecationMessage": "",
|
|
72786
72886
|
"rawdescription": "\n\nOptional helper text that appears under the label.\n",
|
|
72787
72887
|
"description": "<p>Optional helper text that appears under the label.</p>\n",
|
|
72788
|
-
"line":
|
|
72888
|
+
"line": 179,
|
|
72789
72889
|
"type": "string | TemplateRef<any>",
|
|
72790
72890
|
"decorators": []
|
|
72791
72891
|
},
|
|
@@ -72796,7 +72896,7 @@
|
|
|
72796
72896
|
"deprecationMessage": "",
|
|
72797
72897
|
"rawdescription": "\n\nSet to `true` to hide the label visually, but keep accessible to\nscreen readers.\n",
|
|
72798
72898
|
"description": "<p>Set to <code>true</code> to hide the label visually, but keep accessible to\nscreen readers.</p>\n",
|
|
72799
|
-
"line":
|
|
72899
|
+
"line": 210,
|
|
72800
72900
|
"type": "boolean",
|
|
72801
72901
|
"decorators": []
|
|
72802
72902
|
},
|
|
@@ -72807,7 +72907,7 @@
|
|
|
72807
72907
|
"deprecationMessage": "",
|
|
72808
72908
|
"rawdescription": "\n\nSet to `true` for an invalid label component.\n",
|
|
72809
72909
|
"description": "<p>Set to <code>true</code> for an invalid label component.</p>\n",
|
|
72810
|
-
"line":
|
|
72910
|
+
"line": 187,
|
|
72811
72911
|
"type": "boolean",
|
|
72812
72912
|
"decorators": []
|
|
72813
72913
|
},
|
|
@@ -72817,7 +72917,7 @@
|
|
|
72817
72917
|
"deprecationMessage": "",
|
|
72818
72918
|
"rawdescription": "\n\nSets the invalid text.\n",
|
|
72819
72919
|
"description": "<p>Sets the invalid text.</p>\n",
|
|
72820
|
-
"line":
|
|
72920
|
+
"line": 183,
|
|
72821
72921
|
"type": "string | TemplateRef<any>",
|
|
72822
72922
|
"decorators": []
|
|
72823
72923
|
},
|
|
@@ -72828,7 +72928,7 @@
|
|
|
72828
72928
|
"deprecationMessage": "",
|
|
72829
72929
|
"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
72930
|
"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":
|
|
72931
|
+
"line": 159,
|
|
72832
72932
|
"type": "string",
|
|
72833
72933
|
"decorators": []
|
|
72834
72934
|
},
|
|
@@ -72838,7 +72938,7 @@
|
|
|
72838
72938
|
"deprecationMessage": "",
|
|
72839
72939
|
"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
72940
|
"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":
|
|
72941
|
+
"line": 174,
|
|
72842
72942
|
"type": "TemplateRef<any>",
|
|
72843
72943
|
"decorators": []
|
|
72844
72944
|
},
|
|
@@ -72848,7 +72948,7 @@
|
|
|
72848
72948
|
"deprecationMessage": "",
|
|
72849
72949
|
"rawdescription": "\n\nMaximum number of characters (or words) allowed. Required for the\ncounter to display.\n",
|
|
72850
72950
|
"description": "<p>Maximum number of characters (or words) allowed. Required for the\ncounter to display.</p>\n",
|
|
72851
|
-
"line":
|
|
72951
|
+
"line": 222,
|
|
72852
72952
|
"type": "number",
|
|
72853
72953
|
"decorators": []
|
|
72854
72954
|
},
|
|
@@ -72859,7 +72959,7 @@
|
|
|
72859
72959
|
"deprecationMessage": "",
|
|
72860
72960
|
"rawdescription": "\n\nSet to `true` for a loading label.\n",
|
|
72861
72961
|
"description": "<p>Set to <code>true</code> for a loading label.</p>\n",
|
|
72862
|
-
"line":
|
|
72962
|
+
"line": 168,
|
|
72863
72963
|
"type": "boolean",
|
|
72864
72964
|
"decorators": []
|
|
72865
72965
|
},
|
|
@@ -72867,7 +72967,7 @@
|
|
|
72867
72967
|
"name": "textAreaTemplate",
|
|
72868
72968
|
"deprecated": false,
|
|
72869
72969
|
"deprecationMessage": "",
|
|
72870
|
-
"line":
|
|
72970
|
+
"line": 175,
|
|
72871
72971
|
"type": "TemplateRef<any>",
|
|
72872
72972
|
"decorators": []
|
|
72873
72973
|
},
|
|
@@ -72878,7 +72978,7 @@
|
|
|
72878
72978
|
"deprecationMessage": "",
|
|
72879
72979
|
"rawdescription": "\n\nSet to `true` to show a warning (contents set by warningText)\n",
|
|
72880
72980
|
"description": "<p>Set to <code>true</code> to show a warning (contents set by warningText)</p>\n",
|
|
72881
|
-
"line":
|
|
72981
|
+
"line": 191,
|
|
72882
72982
|
"type": "boolean",
|
|
72883
72983
|
"decorators": []
|
|
72884
72984
|
},
|
|
@@ -72888,7 +72988,7 @@
|
|
|
72888
72988
|
"deprecationMessage": "",
|
|
72889
72989
|
"rawdescription": "\n\nSets the warning text\n",
|
|
72890
72990
|
"description": "<p>Sets the warning text</p>\n",
|
|
72891
|
-
"line":
|
|
72991
|
+
"line": 195,
|
|
72892
72992
|
"type": "string | TemplateRef<any>",
|
|
72893
72993
|
"decorators": []
|
|
72894
72994
|
}
|
|
@@ -72903,7 +73003,7 @@
|
|
|
72903
73003
|
"type": "",
|
|
72904
73004
|
"optional": false,
|
|
72905
73005
|
"description": "",
|
|
72906
|
-
"line":
|
|
73006
|
+
"line": 245,
|
|
72907
73007
|
"decorators": [
|
|
72908
73008
|
{
|
|
72909
73009
|
"name": "HostBinding",
|
|
@@ -72922,7 +73022,7 @@
|
|
|
72922
73022
|
"type": "number",
|
|
72923
73023
|
"optional": false,
|
|
72924
73024
|
"description": "<p>Used to build the id of the input item associated with the <code>Label</code>.</p>\n",
|
|
72925
|
-
"line":
|
|
73025
|
+
"line": 154,
|
|
72926
73026
|
"rawdescription": "\n\nUsed to build the id of the input item associated with the `Label`.\n",
|
|
72927
73027
|
"modifierKind": [
|
|
72928
73028
|
126
|
|
@@ -72935,7 +73035,7 @@
|
|
|
72935
73035
|
"type": "TextArea",
|
|
72936
73036
|
"optional": false,
|
|
72937
73037
|
"description": "",
|
|
72938
|
-
"line":
|
|
73038
|
+
"line": 243,
|
|
72939
73039
|
"decorators": [
|
|
72940
73040
|
{
|
|
72941
73041
|
"name": "ContentChild",
|
|
@@ -72954,7 +73054,7 @@
|
|
|
72954
73054
|
"type": "number",
|
|
72955
73055
|
"optional": false,
|
|
72956
73056
|
"description": "",
|
|
72957
|
-
"line":
|
|
73057
|
+
"line": 237
|
|
72958
73058
|
},
|
|
72959
73059
|
{
|
|
72960
73060
|
"name": "wrapper",
|
|
@@ -72963,7 +73063,7 @@
|
|
|
72963
73063
|
"type": "ElementRef<HTMLDivElement>",
|
|
72964
73064
|
"optional": false,
|
|
72965
73065
|
"description": "",
|
|
72966
|
-
"line":
|
|
73066
|
+
"line": 240,
|
|
72967
73067
|
"decorators": [
|
|
72968
73068
|
{
|
|
72969
73069
|
"name": "ViewChild",
|
|
@@ -72989,7 +73089,7 @@
|
|
|
72989
73089
|
"optional": false,
|
|
72990
73090
|
"returnType": "boolean",
|
|
72991
73091
|
"typeParameters": [],
|
|
72992
|
-
"line":
|
|
73092
|
+
"line": 327,
|
|
72993
73093
|
"deprecated": false,
|
|
72994
73094
|
"deprecationMessage": "",
|
|
72995
73095
|
"modifierKind": [
|
|
@@ -73016,7 +73116,7 @@
|
|
|
73016
73116
|
"defaultValue": "true",
|
|
73017
73117
|
"deprecated": false,
|
|
73018
73118
|
"deprecationMessage": "",
|
|
73019
|
-
"line":
|
|
73119
|
+
"line": 245,
|
|
73020
73120
|
"type": "boolean",
|
|
73021
73121
|
"decorators": []
|
|
73022
73122
|
},
|
|
@@ -73024,7 +73124,7 @@
|
|
|
73024
73124
|
"name": "class.cds--text-area__wrapper--readonly",
|
|
73025
73125
|
"deprecated": false,
|
|
73026
73126
|
"deprecationMessage": "",
|
|
73027
|
-
"line":
|
|
73127
|
+
"line": 140,
|
|
73028
73128
|
"type": "any",
|
|
73029
73129
|
"decorators": []
|
|
73030
73130
|
},
|
|
@@ -73032,7 +73132,7 @@
|
|
|
73032
73132
|
"name": "class.cds--text-area--fluid",
|
|
73033
73133
|
"deprecated": false,
|
|
73034
73134
|
"deprecationMessage": "",
|
|
73035
|
-
"line":
|
|
73135
|
+
"line": 144,
|
|
73036
73136
|
"type": "boolean",
|
|
73037
73137
|
"decorators": []
|
|
73038
73138
|
},
|
|
@@ -73040,7 +73140,7 @@
|
|
|
73040
73140
|
"name": "class.cds--text-area--fluid__skeleton",
|
|
73041
73141
|
"deprecated": false,
|
|
73042
73142
|
"deprecationMessage": "",
|
|
73043
|
-
"line":
|
|
73143
|
+
"line": 148,
|
|
73044
73144
|
"type": "boolean",
|
|
73045
73145
|
"decorators": []
|
|
73046
73146
|
}
|
|
@@ -73051,7 +73151,7 @@
|
|
|
73051
73151
|
"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
73152
|
"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
73153
|
"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",
|
|
73154
|
+
"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
73155
|
"assetsDirs": [],
|
|
73056
73156
|
"styleUrlsData": "",
|
|
73057
73157
|
"stylesData": "",
|
|
@@ -73068,7 +73168,7 @@
|
|
|
73068
73168
|
"deprecationMessage": ""
|
|
73069
73169
|
}
|
|
73070
73170
|
],
|
|
73071
|
-
"line":
|
|
73171
|
+
"line": 254,
|
|
73072
73172
|
"rawdescription": "\n\nCreates an instance of Label.\n",
|
|
73073
73173
|
"jsdoctags": [
|
|
73074
73174
|
{
|
|
@@ -73095,7 +73195,7 @@
|
|
|
73095
73195
|
"name": "isReadonly",
|
|
73096
73196
|
"type": "",
|
|
73097
73197
|
"returnType": "",
|
|
73098
|
-
"line":
|
|
73198
|
+
"line": 140
|
|
73099
73199
|
}
|
|
73100
73200
|
},
|
|
73101
73201
|
"fluidClass": {
|
|
@@ -73104,7 +73204,7 @@
|
|
|
73104
73204
|
"name": "fluidClass",
|
|
73105
73205
|
"type": "",
|
|
73106
73206
|
"returnType": "",
|
|
73107
|
-
"line":
|
|
73207
|
+
"line": 144
|
|
73108
73208
|
}
|
|
73109
73209
|
},
|
|
73110
73210
|
"fluidSkeletonClass": {
|
|
@@ -73113,14 +73213,14 @@
|
|
|
73113
73213
|
"name": "fluidSkeletonClass",
|
|
73114
73214
|
"type": "",
|
|
73115
73215
|
"returnType": "",
|
|
73116
|
-
"line":
|
|
73216
|
+
"line": 148
|
|
73117
73217
|
}
|
|
73118
73218
|
}
|
|
73119
73219
|
}
|
|
73120
73220
|
},
|
|
73121
73221
|
{
|
|
73122
73222
|
"name": "TextInputLabelComponent",
|
|
73123
|
-
"id": "component-TextInputLabelComponent-
|
|
73223
|
+
"id": "component-TextInputLabelComponent-6b58080fc4acf26ac8406e1f9cb93af889c56bb67ee44c721ee7a2d82d9a3d67a40e791cbc951dcd1f2d1bc65baf522d7f3dce104e6f5a011c5da9cad3fe5274",
|
|
73124
73224
|
"file": "src/input/text-input-label.component.ts",
|
|
73125
73225
|
"encapsulation": [],
|
|
73126
73226
|
"entryComponents": [],
|
|
@@ -73141,7 +73241,7 @@
|
|
|
73141
73241
|
"deprecationMessage": "",
|
|
73142
73242
|
"rawdescription": "\n\nSet the arialabel for label\n",
|
|
73143
73243
|
"description": "<p>Set the arialabel for label</p>\n",
|
|
73144
|
-
"line":
|
|
73244
|
+
"line": 229,
|
|
73145
73245
|
"type": "string",
|
|
73146
73246
|
"decorators": []
|
|
73147
73247
|
},
|
|
@@ -73151,7 +73251,7 @@
|
|
|
73151
73251
|
"deprecationMessage": "",
|
|
73152
73252
|
"rawdescription": "\n\n**Experimental**: Optional decorator (e.g. AI label).\n",
|
|
73153
73253
|
"description": "<p><strong>Experimental</strong>: Optional decorator (e.g. AI label).</p>\n",
|
|
73154
|
-
"line":
|
|
73254
|
+
"line": 239,
|
|
73155
73255
|
"type": "TemplateRef<any>",
|
|
73156
73256
|
"decorators": []
|
|
73157
73257
|
},
|
|
@@ -73162,7 +73262,7 @@
|
|
|
73162
73262
|
"deprecationMessage": "",
|
|
73163
73263
|
"rawdescription": "\n\nSet to `true` for a disabled label.\n",
|
|
73164
73264
|
"description": "<p>Set to <code>true</code> for a disabled label.</p>\n",
|
|
73165
|
-
"line":
|
|
73265
|
+
"line": 194,
|
|
73166
73266
|
"type": "boolean",
|
|
73167
73267
|
"decorators": []
|
|
73168
73268
|
},
|
|
@@ -73173,7 +73273,7 @@
|
|
|
73173
73273
|
"deprecationMessage": "",
|
|
73174
73274
|
"rawdescription": "\n\nSet to `true` (`maxCount` must be set) to displays a live character\ncounter alongside the label.\n",
|
|
73175
73275
|
"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":
|
|
73276
|
+
"line": 262,
|
|
73177
73277
|
"type": "boolean",
|
|
73178
73278
|
"decorators": []
|
|
73179
73279
|
},
|
|
@@ -73184,7 +73284,7 @@
|
|
|
73184
73284
|
"deprecationMessage": "",
|
|
73185
73285
|
"rawdescription": "\n\nExperimental: enable fluid state\n",
|
|
73186
73286
|
"description": "<p>Experimental: enable fluid state</p>\n",
|
|
73187
|
-
"line":
|
|
73287
|
+
"line": 234,
|
|
73188
73288
|
"type": "boolean",
|
|
73189
73289
|
"decorators": []
|
|
73190
73290
|
},
|
|
@@ -73194,7 +73294,7 @@
|
|
|
73194
73294
|
"deprecationMessage": "",
|
|
73195
73295
|
"rawdescription": "\n\nOptional helper text that appears under the label.\n",
|
|
73196
73296
|
"description": "<p>Optional helper text that appears under the label.</p>\n",
|
|
73197
|
-
"line":
|
|
73297
|
+
"line": 209,
|
|
73198
73298
|
"type": "string | TemplateRef<any>",
|
|
73199
73299
|
"decorators": []
|
|
73200
73300
|
},
|
|
@@ -73205,7 +73305,7 @@
|
|
|
73205
73305
|
"deprecationMessage": "",
|
|
73206
73306
|
"rawdescription": "\n\nSet to `true` to hide the label visually, but keep accessible to\nscreen readers.\n",
|
|
73207
73307
|
"description": "<p>Set to <code>true</code> to hide the label visually, but keep accessible to\nscreen readers.</p>\n",
|
|
73208
|
-
"line":
|
|
73308
|
+
"line": 245,
|
|
73209
73309
|
"type": "boolean",
|
|
73210
73310
|
"decorators": []
|
|
73211
73311
|
},
|
|
@@ -73216,7 +73316,7 @@
|
|
|
73216
73316
|
"deprecationMessage": "",
|
|
73217
73317
|
"rawdescription": "\n\nSet to `true` to render the label and field side-by-side instead of stacked.\n",
|
|
73218
73318
|
"description": "<p>Set to <code>true</code> to render the label and field side-by-side instead of stacked.</p>\n",
|
|
73219
|
-
"line":
|
|
73319
|
+
"line": 250,
|
|
73220
73320
|
"type": "boolean",
|
|
73221
73321
|
"decorators": []
|
|
73222
73322
|
},
|
|
@@ -73227,7 +73327,7 @@
|
|
|
73227
73327
|
"deprecationMessage": "",
|
|
73228
73328
|
"rawdescription": "\n\nSet to `true` for an invalid label component.\n",
|
|
73229
73329
|
"description": "<p>Set to <code>true</code> for an invalid label component.</p>\n",
|
|
73230
|
-
"line":
|
|
73330
|
+
"line": 217,
|
|
73231
73331
|
"type": "boolean",
|
|
73232
73332
|
"decorators": []
|
|
73233
73333
|
},
|
|
@@ -73237,7 +73337,7 @@
|
|
|
73237
73337
|
"deprecationMessage": "",
|
|
73238
73338
|
"rawdescription": "\n\nSets the invalid text.\n",
|
|
73239
73339
|
"description": "<p>Sets the invalid text.</p>\n",
|
|
73240
|
-
"line":
|
|
73340
|
+
"line": 213,
|
|
73241
73341
|
"type": "string | TemplateRef<any>",
|
|
73242
73342
|
"decorators": []
|
|
73243
73343
|
},
|
|
@@ -73248,7 +73348,7 @@
|
|
|
73248
73348
|
"deprecationMessage": "",
|
|
73249
73349
|
"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
73350
|
"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":
|
|
73351
|
+
"line": 189,
|
|
73252
73352
|
"type": "string",
|
|
73253
73353
|
"decorators": []
|
|
73254
73354
|
},
|
|
@@ -73258,7 +73358,7 @@
|
|
|
73258
73358
|
"deprecationMessage": "",
|
|
73259
73359
|
"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
73360
|
"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":
|
|
73361
|
+
"line": 204,
|
|
73262
73362
|
"type": "TemplateRef<any>",
|
|
73263
73363
|
"decorators": []
|
|
73264
73364
|
},
|
|
@@ -73268,7 +73368,7 @@
|
|
|
73268
73368
|
"deprecationMessage": "",
|
|
73269
73369
|
"rawdescription": "\n\nMaximum number of characters (or words) allowed. Required for the\ncounter to display.\n",
|
|
73270
73370
|
"description": "<p>Maximum number of characters (or words) allowed. Required for the\ncounter to display.</p>\n",
|
|
73271
|
-
"line":
|
|
73371
|
+
"line": 268,
|
|
73272
73372
|
"type": "number",
|
|
73273
73373
|
"decorators": []
|
|
73274
73374
|
},
|
|
@@ -73279,7 +73379,7 @@
|
|
|
73279
73379
|
"deprecationMessage": "",
|
|
73280
73380
|
"rawdescription": "\n\nThe render size for the `TextInput`. Used to compute the INLINE label size\nvariant class (`cds--label--inline--{size}`).\n",
|
|
73281
73381
|
"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":
|
|
73382
|
+
"line": 256,
|
|
73283
73383
|
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
73284
73384
|
"decorators": []
|
|
73285
73385
|
},
|
|
@@ -73290,7 +73390,7 @@
|
|
|
73290
73390
|
"deprecationMessage": "",
|
|
73291
73391
|
"rawdescription": "\n\nSet to `true` for a loading label.\n",
|
|
73292
73392
|
"description": "<p>Set to <code>true</code> for a loading label.</p>\n",
|
|
73293
|
-
"line":
|
|
73393
|
+
"line": 198,
|
|
73294
73394
|
"type": "boolean",
|
|
73295
73395
|
"decorators": []
|
|
73296
73396
|
},
|
|
@@ -73298,7 +73398,7 @@
|
|
|
73298
73398
|
"name": "textInputTemplate",
|
|
73299
73399
|
"deprecated": false,
|
|
73300
73400
|
"deprecationMessage": "",
|
|
73301
|
-
"line":
|
|
73401
|
+
"line": 205,
|
|
73302
73402
|
"type": "TemplateRef<any>",
|
|
73303
73403
|
"decorators": []
|
|
73304
73404
|
},
|
|
@@ -73309,7 +73409,7 @@
|
|
|
73309
73409
|
"deprecationMessage": "",
|
|
73310
73410
|
"rawdescription": "\n\nSet to `true` to show a warning (contents set by warningText)\n",
|
|
73311
73411
|
"description": "<p>Set to <code>true</code> to show a warning (contents set by warningText)</p>\n",
|
|
73312
|
-
"line":
|
|
73412
|
+
"line": 221,
|
|
73313
73413
|
"type": "boolean",
|
|
73314
73414
|
"decorators": []
|
|
73315
73415
|
},
|
|
@@ -73319,7 +73419,7 @@
|
|
|
73319
73419
|
"deprecationMessage": "",
|
|
73320
73420
|
"rawdescription": "\n\nSets the warning text\n",
|
|
73321
73421
|
"description": "<p>Sets the warning text</p>\n",
|
|
73322
|
-
"line":
|
|
73422
|
+
"line": 225,
|
|
73323
73423
|
"type": "string | TemplateRef<any>",
|
|
73324
73424
|
"decorators": []
|
|
73325
73425
|
}
|
|
@@ -73334,7 +73434,7 @@
|
|
|
73334
73434
|
"type": "",
|
|
73335
73435
|
"optional": false,
|
|
73336
73436
|
"description": "",
|
|
73337
|
-
"line":
|
|
73437
|
+
"line": 279,
|
|
73338
73438
|
"decorators": [
|
|
73339
73439
|
{
|
|
73340
73440
|
"name": "HostBinding",
|
|
@@ -73353,7 +73453,7 @@
|
|
|
73353
73453
|
"type": "number",
|
|
73354
73454
|
"optional": false,
|
|
73355
73455
|
"description": "<p>Used to build the id of the input item associated with the <code>Label</code>.</p>\n",
|
|
73356
|
-
"line":
|
|
73456
|
+
"line": 184,
|
|
73357
73457
|
"rawdescription": "\n\nUsed to build the id of the input item associated with the `Label`.\n",
|
|
73358
73458
|
"modifierKind": [
|
|
73359
73459
|
126
|
|
@@ -73367,7 +73467,25 @@
|
|
|
73367
73467
|
"type": "number",
|
|
73368
73468
|
"optional": false,
|
|
73369
73469
|
"description": "",
|
|
73370
|
-
"line":
|
|
73470
|
+
"line": 271
|
|
73471
|
+
},
|
|
73472
|
+
{
|
|
73473
|
+
"name": "textInput",
|
|
73474
|
+
"deprecated": false,
|
|
73475
|
+
"deprecationMessage": "",
|
|
73476
|
+
"type": "TextInput",
|
|
73477
|
+
"optional": false,
|
|
73478
|
+
"description": "",
|
|
73479
|
+
"line": 277,
|
|
73480
|
+
"decorators": [
|
|
73481
|
+
{
|
|
73482
|
+
"name": "ContentChild",
|
|
73483
|
+
"stringifiedArguments": "TextInput, {static: false}"
|
|
73484
|
+
}
|
|
73485
|
+
],
|
|
73486
|
+
"modifierKind": [
|
|
73487
|
+
170
|
|
73488
|
+
]
|
|
73371
73489
|
},
|
|
73372
73490
|
{
|
|
73373
73491
|
"name": "textInputWrapper",
|
|
@@ -73377,7 +73495,7 @@
|
|
|
73377
73495
|
"type": "",
|
|
73378
73496
|
"optional": false,
|
|
73379
73497
|
"description": "",
|
|
73380
|
-
"line":
|
|
73498
|
+
"line": 281,
|
|
73381
73499
|
"decorators": [
|
|
73382
73500
|
{
|
|
73383
73501
|
"name": "HostBinding",
|
|
@@ -73395,7 +73513,7 @@
|
|
|
73395
73513
|
"type": "ElementRef<HTMLDivElement>",
|
|
73396
73514
|
"optional": false,
|
|
73397
73515
|
"description": "",
|
|
73398
|
-
"line":
|
|
73516
|
+
"line": 274,
|
|
73399
73517
|
"decorators": [
|
|
73400
73518
|
{
|
|
73401
73519
|
"name": "ViewChild",
|
|
@@ -73421,7 +73539,7 @@
|
|
|
73421
73539
|
"optional": false,
|
|
73422
73540
|
"returnType": "boolean",
|
|
73423
73541
|
"typeParameters": [],
|
|
73424
|
-
"line":
|
|
73542
|
+
"line": 359,
|
|
73425
73543
|
"deprecated": false,
|
|
73426
73544
|
"deprecationMessage": "",
|
|
73427
73545
|
"modifierKind": [
|
|
@@ -73448,7 +73566,7 @@
|
|
|
73448
73566
|
"defaultValue": "true",
|
|
73449
73567
|
"deprecated": false,
|
|
73450
73568
|
"deprecationMessage": "",
|
|
73451
|
-
"line":
|
|
73569
|
+
"line": 279,
|
|
73452
73570
|
"type": "boolean",
|
|
73453
73571
|
"decorators": []
|
|
73454
73572
|
},
|
|
@@ -73456,7 +73574,7 @@
|
|
|
73456
73574
|
"name": "class.cds--text-input--fluid",
|
|
73457
73575
|
"deprecated": false,
|
|
73458
73576
|
"deprecationMessage": "",
|
|
73459
|
-
"line":
|
|
73577
|
+
"line": 174,
|
|
73460
73578
|
"type": "boolean",
|
|
73461
73579
|
"decorators": []
|
|
73462
73580
|
},
|
|
@@ -73464,7 +73582,7 @@
|
|
|
73464
73582
|
"name": "class.cds--text-input--fluid__skeleton",
|
|
73465
73583
|
"deprecated": false,
|
|
73466
73584
|
"deprecationMessage": "",
|
|
73467
|
-
"line":
|
|
73585
|
+
"line": 178,
|
|
73468
73586
|
"type": "boolean",
|
|
73469
73587
|
"decorators": []
|
|
73470
73588
|
},
|
|
@@ -73473,7 +73591,7 @@
|
|
|
73473
73591
|
"defaultValue": "true",
|
|
73474
73592
|
"deprecated": false,
|
|
73475
73593
|
"deprecationMessage": "",
|
|
73476
|
-
"line":
|
|
73594
|
+
"line": 281,
|
|
73477
73595
|
"type": "boolean",
|
|
73478
73596
|
"decorators": []
|
|
73479
73597
|
},
|
|
@@ -73481,7 +73599,7 @@
|
|
|
73481
73599
|
"name": "class.cds--text-input-wrapper--inline",
|
|
73482
73600
|
"deprecated": false,
|
|
73483
73601
|
"deprecationMessage": "",
|
|
73484
|
-
"line":
|
|
73602
|
+
"line": 166,
|
|
73485
73603
|
"type": "boolean",
|
|
73486
73604
|
"decorators": []
|
|
73487
73605
|
},
|
|
@@ -73489,7 +73607,7 @@
|
|
|
73489
73607
|
"name": "class.cds--text-input-wrapper--readonly",
|
|
73490
73608
|
"deprecated": false,
|
|
73491
73609
|
"deprecationMessage": "",
|
|
73492
|
-
"line":
|
|
73610
|
+
"line": 170,
|
|
73493
73611
|
"type": "any",
|
|
73494
73612
|
"decorators": []
|
|
73495
73613
|
}
|
|
@@ -73500,7 +73618,7 @@
|
|
|
73500
73618
|
"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
73619
|
"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
73620
|
"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",
|
|
73621
|
+
"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
73622
|
"assetsDirs": [],
|
|
73505
73623
|
"styleUrlsData": "",
|
|
73506
73624
|
"stylesData": "",
|
|
@@ -73517,7 +73635,7 @@
|
|
|
73517
73635
|
"deprecationMessage": ""
|
|
73518
73636
|
}
|
|
73519
73637
|
],
|
|
73520
|
-
"line":
|
|
73638
|
+
"line": 290,
|
|
73521
73639
|
"rawdescription": "\n\nCreates an instance of Label.\n",
|
|
73522
73640
|
"jsdoctags": [
|
|
73523
73641
|
{
|
|
@@ -73545,7 +73663,7 @@
|
|
|
73545
73663
|
"name": "isInlineWrapper",
|
|
73546
73664
|
"type": "",
|
|
73547
73665
|
"returnType": "",
|
|
73548
|
-
"line":
|
|
73666
|
+
"line": 166
|
|
73549
73667
|
}
|
|
73550
73668
|
},
|
|
73551
73669
|
"isReadonly": {
|
|
@@ -73554,7 +73672,7 @@
|
|
|
73554
73672
|
"name": "isReadonly",
|
|
73555
73673
|
"type": "",
|
|
73556
73674
|
"returnType": "",
|
|
73557
|
-
"line":
|
|
73675
|
+
"line": 170
|
|
73558
73676
|
}
|
|
73559
73677
|
},
|
|
73560
73678
|
"fluidClass": {
|
|
@@ -73563,7 +73681,7 @@
|
|
|
73563
73681
|
"name": "fluidClass",
|
|
73564
73682
|
"type": "",
|
|
73565
73683
|
"returnType": "",
|
|
73566
|
-
"line":
|
|
73684
|
+
"line": 174
|
|
73567
73685
|
}
|
|
73568
73686
|
},
|
|
73569
73687
|
"fluidSkeletonClass": {
|
|
@@ -73572,7 +73690,7 @@
|
|
|
73572
73690
|
"name": "fluidSkeletonClass",
|
|
73573
73691
|
"type": "",
|
|
73574
73692
|
"returnType": "",
|
|
73575
|
-
"line":
|
|
73693
|
+
"line": 178
|
|
73576
73694
|
}
|
|
73577
73695
|
}
|
|
73578
73696
|
}
|
|
@@ -88606,7 +88724,7 @@
|
|
|
88606
88724
|
"deprecated": false,
|
|
88607
88725
|
"deprecationMessage": "",
|
|
88608
88726
|
"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})"
|
|
88727
|
+
"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
88728
|
},
|
|
88611
88729
|
{
|
|
88612
88730
|
"name": "Template",
|
|
@@ -94349,7 +94467,7 @@
|
|
|
94349
94467
|
"deprecated": false,
|
|
94350
94468
|
"deprecationMessage": "",
|
|
94351
94469
|
"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})"
|
|
94470
|
+
"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
94471
|
},
|
|
94354
94472
|
{
|
|
94355
94473
|
"name": "withAILabel",
|
|
@@ -101879,8 +101997,8 @@
|
|
|
101879
101997
|
"type": "directive",
|
|
101880
101998
|
"linktype": "directive",
|
|
101881
101999
|
"name": "TextInput",
|
|
101882
|
-
"coveragePercent":
|
|
101883
|
-
"coverageCount": "2/
|
|
102000
|
+
"coveragePercent": 11,
|
|
102001
|
+
"coverageCount": "2/18",
|
|
101884
102002
|
"status": "low"
|
|
101885
102003
|
},
|
|
101886
102004
|
{
|
|
@@ -102025,8 +102143,8 @@
|
|
|
102025
102143
|
"type": "directive",
|
|
102026
102144
|
"linktype": "directive",
|
|
102027
102145
|
"name": "TextArea",
|
|
102028
|
-
"coveragePercent":
|
|
102029
|
-
"coverageCount": "2/
|
|
102146
|
+
"coveragePercent": 18,
|
|
102147
|
+
"coverageCount": "2/11",
|
|
102030
102148
|
"status": "low"
|
|
102031
102149
|
},
|
|
102032
102150
|
{
|
|
@@ -102034,8 +102152,8 @@
|
|
|
102034
102152
|
"type": "component",
|
|
102035
102153
|
"linktype": "component",
|
|
102036
102154
|
"name": "TextInputLabelComponent",
|
|
102037
|
-
"coveragePercent":
|
|
102038
|
-
"coverageCount": "20/
|
|
102155
|
+
"coveragePercent": 60,
|
|
102156
|
+
"coverageCount": "20/33",
|
|
102039
102157
|
"status": "good"
|
|
102040
102158
|
},
|
|
102041
102159
|
{
|