carbon-components-angular 5.20.0 → 5.20.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.
Files changed (66) hide show
  1. package/README.md +9 -0
  2. package/docs/documentation/components/CodeSnippet.html +81 -71
  3. package/docs/documentation/dependencies.html +2 -2
  4. package/docs/documentation/index.html +7 -0
  5. package/docs/documentation/js/search/search_index.js +2 -2
  6. package/docs/documentation/modules/ComboBoxModule/dependencies.svg +4 -4
  7. package/docs/documentation/modules/ComboBoxModule.html +4 -4
  8. package/docs/documentation/modules/ContentSwitcherModule/dependencies.svg +4 -4
  9. package/docs/documentation/modules/ContentSwitcherModule.html +4 -4
  10. package/docs/documentation/modules/DatePickerInputModule/dependencies.svg +7 -7
  11. package/docs/documentation/modules/DatePickerInputModule.html +7 -7
  12. package/docs/documentation/modules/DatePickerModule/dependencies.svg +53 -57
  13. package/docs/documentation/modules/DatePickerModule.html +53 -57
  14. package/docs/documentation/modules/DialogModule/dependencies.svg +34 -34
  15. package/docs/documentation/modules/DialogModule.html +34 -34
  16. package/docs/documentation/modules/GridModule/dependencies.svg +60 -60
  17. package/docs/documentation/modules/GridModule.html +60 -60
  18. package/docs/documentation/modules/LoadingModule/dependencies.svg +4 -4
  19. package/docs/documentation/modules/LoadingModule.html +4 -4
  20. package/docs/documentation/modules/NFormsModule/dependencies.svg +4 -4
  21. package/docs/documentation/modules/NFormsModule.html +4 -4
  22. package/docs/documentation/modules/NumberModule/dependencies.svg +4 -4
  23. package/docs/documentation/modules/NumberModule.html +4 -4
  24. package/docs/documentation/modules/ProgressIndicatorModule/dependencies.svg +4 -4
  25. package/docs/documentation/modules/ProgressIndicatorModule.html +4 -4
  26. package/docs/documentation/modules/RadioModule/dependencies.svg +4 -4
  27. package/docs/documentation/modules/RadioModule.html +4 -4
  28. package/docs/documentation/modules/SearchModule/dependencies.svg +4 -4
  29. package/docs/documentation/modules/SearchModule.html +4 -4
  30. package/docs/documentation/modules/SelectModule/dependencies.svg +58 -58
  31. package/docs/documentation/modules/SelectModule.html +58 -58
  32. package/docs/documentation/modules/SliderModule/dependencies.svg +4 -4
  33. package/docs/documentation/modules/SliderModule.html +4 -4
  34. package/docs/documentation/modules/StructuredListModule/dependencies.svg +66 -66
  35. package/docs/documentation/modules/StructuredListModule.html +66 -66
  36. package/docs/documentation/modules/TabsModule/dependencies.svg +69 -69
  37. package/docs/documentation/modules/TabsModule.html +69 -69
  38. package/docs/documentation/modules/TagModule/dependencies.svg +4 -4
  39. package/docs/documentation/modules/TagModule.html +4 -4
  40. package/docs/documentation/modules/TilesModule/dependencies.svg +100 -100
  41. package/docs/documentation/modules/TilesModule.html +100 -100
  42. package/docs/documentation/modules/TimePickerModule/dependencies.svg +20 -20
  43. package/docs/documentation/modules/TimePickerModule.html +20 -20
  44. package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +46 -42
  45. package/docs/documentation/modules/TimePickerSelectModule.html +46 -42
  46. package/docs/documentation/modules/ToggleModule/dependencies.svg +45 -41
  47. package/docs/documentation/modules/ToggleModule.html +45 -41
  48. package/docs/documentation/modules/ToggletipModule/dependencies.svg +4 -4
  49. package/docs/documentation/modules/ToggletipModule.html +4 -4
  50. package/docs/documentation/modules/TooltipModule/dependencies.svg +4 -4
  51. package/docs/documentation/modules/TooltipModule.html +4 -4
  52. package/docs/documentation/modules/TreeviewModule/dependencies.svg +34 -34
  53. package/docs/documentation/modules/TreeviewModule.html +34 -34
  54. package/docs/documentation.json +49 -49
  55. package/docs/storybook/{code-snippet-code-snippet-stories.5c727944.iframe.bundle.js → code-snippet-code-snippet-stories.d9a3162d.iframe.bundle.js} +1 -1
  56. package/docs/storybook/iframe.html +2 -2
  57. package/docs/storybook/main.b12cb86b.iframe.bundle.js +1 -0
  58. package/docs/storybook/project.json +1 -1
  59. package/docs/storybook/{runtime~main.3b1ae09e.iframe.bundle.js → runtime~main.2d269ad5.iframe.bundle.js} +1 -1
  60. package/esm2020/code-snippet/code-snippet.component.mjs +27 -18
  61. package/fesm2015/carbon-components-angular-code-snippet.mjs +26 -17
  62. package/fesm2015/carbon-components-angular-code-snippet.mjs.map +1 -1
  63. package/fesm2020/carbon-components-angular-code-snippet.mjs +26 -17
  64. package/fesm2020/carbon-components-angular-code-snippet.mjs.map +1 -1
  65. package/package.json +1 -1
  66. package/docs/storybook/main.aec7fc6c.iframe.bundle.js +0 -1
@@ -21342,7 +21342,7 @@
21342
21342
  },
21343
21343
  {
21344
21344
  "name": "CodeSnippet",
21345
- "id": "component-CodeSnippet-e4b5e5629b1682db3ee73c2b2a7ea13448e9147af4fd2c696485f6dbedd1eb219a17788e144c2cb4897b8dcbe2d40bbb337a04508395956cd3db28dad7fad4d9",
21345
+ "id": "component-CodeSnippet-01866e185f9515d76fc82300564aa4d98b740eaf72ba485f93e8eab93bff3d2e10f894ce21bcee7980aae36e72bc9186b7924add78537f8df229b5c05657ec40",
21346
21346
  "file": "src/code-snippet/code-snippet.component.ts",
21347
21347
  "encapsulation": [],
21348
21348
  "entryComponents": [],
@@ -21352,7 +21352,7 @@
21352
21352
  "selector": "cds-code-snippet, ibm-code-snippet",
21353
21353
  "styleUrls": [],
21354
21354
  "styles": [],
21355
- "template": "<ng-container *ngIf=\"display === 'inline'; else notInline\">\n\t<ng-container *ngIf=\"!hideCopyButton; else noBtnInline\">\n\t\t<ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\n\t</ng-container>\n\t<ng-template #noBtnInline>\n\t\t<span\n\t\t\tclass=\"cds--snippet cds--snippet--inline cds--snippet--no-copy\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--snippet--light': theme === 'light'\n\t\t\t}\">\n\t\t\t<ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container>\n\t\t</span>\n\t</ng-template>\n</ng-container>\n\n<ng-template #notInline>\n\t<div\n\t\t#codeContainer\n\t\tclass=\"cds--snippet-container\"\n\t\t[attr.aria-label]=\"translations.CODE_SNIPPET_TEXT\"\n\t\t[attr.tabindex]=\"display === 'single' && !disabled ? '0' : null\"\n\t\t[attr.role]=\"display==='single' ? 'textarea' : null\"\n\t\t[ngStyle]=\"styles\"\n\t\t(scroll)=\"(display === 'single' ? handleScroll() : null)\">\n\t\t<ng-container *ngIf=\"skeleton\">\n\t\t\t<span *ngIf=\"display === 'single'; else multiSkeleton\"></span>\n\t\t\t<ng-template #multiSkeleton>\n\t\t\t\t<span></span>\n\t\t\t\t<span></span>\n\t\t\t\t<span></span>\n\t\t\t</ng-template>\n\t\t</ng-container>\n\t\t<pre\n\t\t\t#codeContent\n\t\t\t*ngIf=\"!skeleton\"\n\t\t\t(scroll)=\"(display === 'multi' ? handleScroll() : null)\"><ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container></pre>\n\t</div>\n\t<div *ngIf=\"hasLeft\" class=\"cds--snippet__overflow-indicator--left\"></div>\n\t<div *ngIf=\"hasRight\" class=\"cds--snippet__overflow-indicator--right\"></div>\n\t<ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\n\t<button\n\t\t*ngIf=\"isExpandable\"\n\t\tclass=\"cds--btn cds--btn--ghost cds--btn--sm cds--snippet-btn--expand\"\n\t\t(click)=\"toggleSnippetExpansion()\"\n\t\ttype=\"button\">\n\t\t<span class=\"cds--snippet-btn--text\">{{expanded ? translations.SHOW_LESS : translations.SHOW_MORE}}</span>\n\t\t<svg cdsIcon=\"chevron--down\" size=\"16\" class=\"cds--icon-chevron--down\" [attr.aria-label]=\"translations.SHOW_MORE_ICON\"></svg>\n\t</button>\n</ng-template>\n\n<ng-template #buttonTemplate>\n\t<cds-icon-button\n\t\t*ngIf=\"!skeleton\"\n\t\t[description]=\"showFeedback ? feedbackText : copyButtonDescription\"\n\t\t[align]=\"align\"\n\t\t[dropShadow]=\"dropShadow\"\n\t\t[caret]=\"caret\"\n\t\t[highContrast]=\"highContrast\"\n\t\t[isOpen]=\"isOpen\"\n\t\t[enterDelayMs]=\"enterDelayMs\"\n\t\t[leaveDelayMs]=\"leaveDelayMs\"\n\t\ttype=\"button\"\n\t\tkind=\"primary\"\n\t\tsize=\"md\"\n\t\t(click)=\"onCopyButtonClicked($event)\"\n\t\t[buttonNgClass]=\"{\n\t\t\t'cds--snippet--light': theme === 'light',\n\t\t\t'cds--snippet--inline': display === 'inline',\n\t\t\t'cds--btn--icon-only': display !== 'inline',\n\t\t\t'cds--copy-btn': display !== 'inline',\n\t\t\t'cds--copy-btn--animating': animating,\n\t\t\t'cds--copy-btn--fade-in': showFeedback,\n\t\t\t'cds--copy-btn--fade-out': !showFeedback && animating,\n\t\t\t'cds--snippet cds--copy': true\n\t\t}\"\n\t\t[buttonAttributes]=\"{\n\t\t\t'aria-label': translations.COPY_CODE,\n\t\t\t'aria-live': 'polite',\n\t\t\t'tabindex': '0'\n\t\t}\">\n\t\t<ng-container *ngIf=\"display === 'inline'\">\n\t\t\t<ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container>\n\t\t</ng-container>\n\t\t<ng-container *ngIf=\"display !== 'inline'\">\n\t\t\t<svg cdsIcon=\"copy\" size=\"16\" class=\"cds--snippet__icon\"></svg>\n\t\t</ng-container>\n\t</cds-icon-button>\n</ng-template>\n\n<ng-template #codeTemplate>\n\t<code #code><ng-content></ng-content></code>\n</ng-template>\n\t",
21355
+ "template": "<ng-container *ngIf=\"display === 'inline'; else notInline\">\n\t<ng-container *ngIf=\"!hideCopyButton; else noBtnInline\">\n\t\t<ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\n\t</ng-container>\n\t<ng-template #noBtnInline>\n\t\t<span\n\t\t\tclass=\"cds--snippet cds--snippet--inline cds--snippet--no-copy\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--snippet--light': theme === 'light'\n\t\t\t}\">\n\t\t\t<code #code>\n\t\t\t\t<ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container>\n\t\t\t</code>\n\t\t</span>\n\t</ng-template>\n</ng-container>\n\n<ng-template #notInline>\n\t<div\n\t\t#codeContainer\n\t\tclass=\"cds--snippet-container\"\n\t\t[attr.aria-label]=\"translations.CODE_SNIPPET_TEXT\"\n\t\t[attr.tabindex]=\"display === 'single' && !disabled ? '0' : null\"\n\t\t[attr.role]=\"display==='single' ? 'textarea' : null\"\n\t\t[ngStyle]=\"styles\"\n\t\t(scroll)=\"(display === 'single' ? handleScroll() : null)\">\n\t\t<ng-container *ngIf=\"skeleton\">\n\t\t\t<span *ngIf=\"display === 'single'; else multiSkeleton\"></span>\n\t\t\t<ng-template #multiSkeleton>\n\t\t\t\t<span></span>\n\t\t\t\t<span></span>\n\t\t\t\t<span></span>\n\t\t\t</ng-template>\n\t\t</ng-container>\n\t\t<pre\n\t\t\t#codeContent\n\t\t\t*ngIf=\"!skeleton\"\n\t\t\t(scroll)=\"(display === 'multi' ? handleScroll() : null)\"><code #code><ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container></code></pre>\n\t</div>\n\t<div *ngIf=\"hasLeft\" class=\"cds--snippet__overflow-indicator--left\"></div>\n\t<div *ngIf=\"hasRight\" class=\"cds--snippet__overflow-indicator--right\"></div>\n\t<ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\n\t<button\n\t\t*ngIf=\"isExpandable\"\n\t\tclass=\"cds--btn cds--btn--ghost cds--btn--sm cds--snippet-btn--expand\"\n\t\t(click)=\"toggleSnippetExpansion()\"\n\t\ttype=\"button\">\n\t\t<span class=\"cds--snippet-btn--text\">{{expanded ? translations.SHOW_LESS : translations.SHOW_MORE}}</span>\n\t\t<svg cdsIcon=\"chevron--down\" size=\"16\" class=\"cds--icon-chevron--down\" [attr.aria-label]=\"translations.SHOW_MORE_ICON\"></svg>\n\t</button>\n</ng-template>\n\n<ng-template #buttonTemplate>\n\t<cds-icon-button\n\t\t*ngIf=\"!skeleton\"\n\t\t[description]=\"showFeedback ? feedbackText : copyButtonDescription\"\n\t\t[align]=\"align\"\n\t\t[dropShadow]=\"dropShadow\"\n\t\t[caret]=\"caret\"\n\t\t[highContrast]=\"highContrast\"\n\t\t[isOpen]=\"isOpen\"\n\t\t[enterDelayMs]=\"enterDelayMs\"\n\t\t[leaveDelayMs]=\"leaveDelayMs\"\n\t\ttype=\"button\"\n\t\tkind=\"primary\"\n\t\tsize=\"md\"\n\t\t(click)=\"onCopyButtonClicked($event)\"\n\t\t[buttonNgClass]=\"{\n\t\t\t'cds--snippet--light': theme === 'light',\n\t\t\t'cds--snippet--inline': display === 'inline',\n\t\t\t'cds--btn--icon-only': display !== 'inline',\n\t\t\t'cds--copy-btn': display !== 'inline',\n\t\t\t'cds--copy-btn--animating': animating,\n\t\t\t'cds--copy-btn--fade-in': showFeedback,\n\t\t\t'cds--copy-btn--fade-out': !showFeedback && animating,\n\t\t\t'cds--snippet cds--copy': true\n\t\t}\"\n\t\t[buttonAttributes]=\"{\n\t\t\t'aria-label': translations.COPY_CODE,\n\t\t\t'aria-live': 'polite',\n\t\t\t'tabindex': '0'\n\t\t}\">\n\t\t<ng-container *ngIf=\"display === 'inline'\">\n\t\t\t<code #code>\n\t\t\t\t<ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container>\n\t\t\t</code>\n\t\t</ng-container>\n\t\t<ng-container *ngIf=\"display !== 'inline'\">\n\t\t\t<svg cdsIcon=\"copy\" size=\"16\" class=\"cds--snippet__icon\"></svg>\n\t\t</ng-container>\n\t</cds-icon-button>\n</ng-template>\n\n<ng-template #codeTemplate>\n\t<ng-content></ng-content>\n</ng-template>\n\t",
21356
21356
  "templateUrl": [],
21357
21357
  "viewProviders": [],
21358
21358
  "hostDirectives": [],
@@ -21363,7 +21363,7 @@
21363
21363
  "deprecationMessage": "",
21364
21364
  "rawdescription": "\n\ncopy button description to show on hover\n",
21365
21365
  "description": "<p>copy button description to show on hover</p>\n",
21366
- "line": 157,
21366
+ "line": 161,
21367
21367
  "type": "string",
21368
21368
  "decorators": []
21369
21369
  },
@@ -21374,7 +21374,7 @@
21374
21374
  "deprecationMessage": "",
21375
21375
  "rawdescription": "\n\nSet to `true` to disable the code snippet\n",
21376
21376
  "description": "<p>Set to <code>true</code> to disable the code snippet</p>\n",
21377
- "line": 165,
21377
+ "line": 169,
21378
21378
  "type": "boolean",
21379
21379
  "decorators": []
21380
21380
  },
@@ -21385,7 +21385,7 @@
21385
21385
  "deprecationMessage": "",
21386
21386
  "rawdescription": "\n\nIt can be `\"single\"`, `\"multi\"` or `\"inline\"`\n",
21387
21387
  "description": "<p>It can be <code>&quot;single&quot;</code>, <code>&quot;multi&quot;</code> or <code>&quot;inline&quot;</code></p>\n",
21388
- "line": 152,
21388
+ "line": 156,
21389
21389
  "type": "SnippetType",
21390
21390
  "decorators": []
21391
21391
  },
@@ -21394,7 +21394,7 @@
21394
21394
  "defaultValue": "false",
21395
21395
  "deprecated": false,
21396
21396
  "deprecationMessage": "",
21397
- "line": 205,
21397
+ "line": 209,
21398
21398
  "type": "boolean",
21399
21399
  "decorators": []
21400
21400
  },
@@ -21405,7 +21405,7 @@
21405
21405
  "deprecationMessage": "",
21406
21406
  "rawdescription": "\n\nText displayed in the tooltip when user clicks button to copy code.\n",
21407
21407
  "description": "<p>Text displayed in the tooltip when user clicks button to copy code.</p>\n",
21408
- "line": 198,
21408
+ "line": 202,
21409
21409
  "type": "any",
21410
21410
  "decorators": []
21411
21411
  },
@@ -21416,7 +21416,7 @@
21416
21416
  "deprecationMessage": "",
21417
21417
  "rawdescription": "\n\nTime in miliseconds to keep the feedback tooltip displayed.\nDefaults to 2 seconds\n",
21418
21418
  "description": "<p>Time in miliseconds to keep the feedback tooltip displayed.\nDefaults to 2 seconds</p>\n",
21419
- "line": 203,
21419
+ "line": 207,
21420
21420
  "type": "number",
21421
21421
  "decorators": []
21422
21422
  },
@@ -21427,7 +21427,7 @@
21427
21427
  "deprecationMessage": "",
21428
21428
  "rawdescription": "\n\nSet to `true` to hide copy button\n",
21429
21429
  "description": "<p>Set to <code>true</code> to hide copy button</p>\n",
21430
- "line": 161,
21430
+ "line": 165,
21431
21431
  "type": "boolean",
21432
21432
  "decorators": []
21433
21433
  },
@@ -21438,7 +21438,7 @@
21438
21438
  "deprecationMessage": "",
21439
21439
  "rawdescription": "\n\nSpecify the max number of rows to show when collapsed\nDefault is `15`\n",
21440
21440
  "description": "<p>Specify the max number of rows to show when collapsed\nDefault is <code>15</code></p>\n",
21441
- "line": 170,
21441
+ "line": 174,
21442
21442
  "type": "number",
21443
21443
  "decorators": []
21444
21444
  },
@@ -21449,7 +21449,7 @@
21449
21449
  "deprecationMessage": "",
21450
21450
  "rawdescription": "\n\nSpecify the max number of rows to show when expanded\nDefault is `0`, hence all content will be visible when expanded\n",
21451
21451
  "description": "<p>Specify the max number of rows to show when expanded\nDefault is <code>0</code>, hence all content will be visible when expanded</p>\n",
21452
- "line": 180,
21452
+ "line": 184,
21453
21453
  "type": "number",
21454
21454
  "decorators": []
21455
21455
  },
@@ -21460,7 +21460,7 @@
21460
21460
  "deprecationMessage": "",
21461
21461
  "rawdescription": "\n\nSpecify the min number of rows to show when collapsed\nDefault is `3`\n",
21462
21462
  "description": "<p>Specify the min number of rows to show when collapsed\nDefault is <code>3</code></p>\n",
21463
- "line": 175,
21463
+ "line": 179,
21464
21464
  "type": "number",
21465
21465
  "decorators": []
21466
21466
  },
@@ -21471,7 +21471,7 @@
21471
21471
  "deprecationMessage": "",
21472
21472
  "rawdescription": "\n\nSpecify the min number of rows to show when expanded\nDefault is `16`, hence height of expanded row will be 16 * rowHeightInPixel (16) = 256px\n",
21473
21473
  "description": "<p>Specify the min number of rows to show when expanded\nDefault is <code>16</code>, hence height of expanded row will be 16 * rowHeightInPixel (16) = 256px</p>\n",
21474
- "line": 185,
21474
+ "line": 189,
21475
21475
  "type": "number",
21476
21476
  "decorators": []
21477
21477
  },
@@ -21480,7 +21480,7 @@
21480
21480
  "defaultValue": "false",
21481
21481
  "deprecated": false,
21482
21482
  "deprecationMessage": "",
21483
- "line": 206,
21483
+ "line": 210,
21484
21484
  "type": "boolean",
21485
21485
  "decorators": []
21486
21486
  },
@@ -21491,15 +21491,15 @@
21491
21491
  "deprecationMessage": "since v5 - Use `cdsLayer` directive instead\nSet to `\"light\"` to apply the light style",
21492
21492
  "jsdoctags": [
21493
21493
  {
21494
- "pos": 5970,
21495
- "end": 6074,
21494
+ "pos": 6034,
21495
+ "end": 6138,
21496
21496
  "flags": 8421376,
21497
21497
  "modifierFlagsCache": 0,
21498
21498
  "transformFlags": 0,
21499
21499
  "kind": 334,
21500
21500
  "tagName": {
21501
- "pos": 5971,
21502
- "end": 5981,
21501
+ "pos": 6035,
21502
+ "end": 6045,
21503
21503
  "flags": 8421376,
21504
21504
  "modifierFlagsCache": 0,
21505
21505
  "transformFlags": 0,
@@ -21509,7 +21509,7 @@
21509
21509
  "comment": "<p>since v5 - Use <code>cdsLayer</code> directive instead\nSet to <code>&quot;light&quot;</code> to apply the light style</p>\n"
21510
21510
  }
21511
21511
  ],
21512
- "line": 194,
21512
+ "line": 198,
21513
21513
  "type": "\"light\" | \"dark\"",
21514
21514
  "decorators": []
21515
21515
  },
@@ -21518,7 +21518,7 @@
21518
21518
  "defaultValue": "this.i18n.get().CODE_SNIPPET",
21519
21519
  "deprecated": false,
21520
21520
  "deprecationMessage": "",
21521
- "line": 153,
21521
+ "line": 157,
21522
21522
  "type": "any",
21523
21523
  "decorators": []
21524
21524
  },
@@ -21529,7 +21529,7 @@
21529
21529
  "deprecationMessage": "",
21530
21530
  "rawdescription": "\n\nSet to `true` to wrap the text\n",
21531
21531
  "description": "<p>Set to <code>true</code> to wrap the text</p>\n",
21532
- "line": 189,
21532
+ "line": 193,
21533
21533
  "type": "boolean",
21534
21534
  "decorators": []
21535
21535
  },
@@ -21642,7 +21642,7 @@
21642
21642
  "type": "",
21643
21643
  "optional": false,
21644
21644
  "description": "",
21645
- "line": 214
21645
+ "line": 218
21646
21646
  },
21647
21647
  {
21648
21648
  "name": "code",
@@ -21651,7 +21651,7 @@
21651
21651
  "type": "",
21652
21652
  "optional": false,
21653
21653
  "description": "",
21654
- "line": 209,
21654
+ "line": 213,
21655
21655
  "decorators": [
21656
21656
  {
21657
21657
  "name": "ViewChild",
@@ -21669,7 +21669,7 @@
21669
21669
  "type": "",
21670
21670
  "optional": false,
21671
21671
  "description": "",
21672
- "line": 211,
21672
+ "line": 215,
21673
21673
  "decorators": [
21674
21674
  {
21675
21675
  "name": "ViewChild",
@@ -21687,7 +21687,7 @@
21687
21687
  "type": "",
21688
21688
  "optional": false,
21689
21689
  "description": "",
21690
- "line": 210,
21690
+ "line": 214,
21691
21691
  "decorators": [
21692
21692
  {
21693
21693
  "name": "ViewChild",
@@ -21706,7 +21706,7 @@
21706
21706
  "type": "null",
21707
21707
  "optional": false,
21708
21708
  "description": "",
21709
- "line": 215
21709
+ "line": 219
21710
21710
  },
21711
21711
  {
21712
21712
  "name": "hasLeft",
@@ -21716,7 +21716,7 @@
21716
21716
  "type": "",
21717
21717
  "optional": false,
21718
21718
  "description": "",
21719
- "line": 220
21719
+ "line": 224
21720
21720
  },
21721
21721
  {
21722
21722
  "name": "hasRight",
@@ -21726,7 +21726,7 @@
21726
21726
  "type": "",
21727
21727
  "optional": false,
21728
21728
  "description": "",
21729
- "line": 219
21729
+ "line": 223
21730
21730
  },
21731
21731
  {
21732
21732
  "name": "hasRightOverflow",
@@ -21736,7 +21736,7 @@
21736
21736
  "type": "",
21737
21737
  "optional": false,
21738
21738
  "description": "",
21739
- "line": 217
21739
+ "line": 221
21740
21740
  },
21741
21741
  {
21742
21742
  "name": "isExpandable",
@@ -21746,7 +21746,7 @@
21746
21746
  "type": "",
21747
21747
  "optional": false,
21748
21748
  "description": "",
21749
- "line": 216
21749
+ "line": 220
21750
21750
  },
21751
21751
  {
21752
21752
  "name": "rowHeightInPixel",
@@ -21756,7 +21756,7 @@
21756
21756
  "type": "number",
21757
21757
  "optional": false,
21758
21758
  "description": "",
21759
- "line": 147,
21759
+ "line": 151,
21760
21760
  "modifierKind": [
21761
21761
  146
21762
21762
  ]
@@ -21769,7 +21769,7 @@
21769
21769
  "type": "",
21770
21770
  "optional": false,
21771
21771
  "description": "",
21772
- "line": 213
21772
+ "line": 217
21773
21773
  },
21774
21774
  {
21775
21775
  "name": "styles",
@@ -21779,7 +21779,7 @@
21779
21779
  "type": "any",
21780
21780
  "optional": false,
21781
21781
  "description": "",
21782
- "line": 207
21782
+ "line": 211
21783
21783
  }
21784
21784
  ],
21785
21785
  "methodsClass": [
@@ -21789,7 +21789,7 @@
21789
21789
  "optional": false,
21790
21790
  "returnType": "void",
21791
21791
  "typeParameters": [],
21792
- "line": 290,
21792
+ "line": 296,
21793
21793
  "deprecated": false,
21794
21794
  "deprecationMessage": ""
21795
21795
  },
@@ -21799,7 +21799,7 @@
21799
21799
  "optional": false,
21800
21800
  "returnType": "void",
21801
21801
  "typeParameters": [],
21802
- "line": 230,
21802
+ "line": 234,
21803
21803
  "deprecated": false,
21804
21804
  "deprecationMessage": ""
21805
21805
  },
@@ -21809,7 +21809,7 @@
21809
21809
  "optional": false,
21810
21810
  "returnType": "void",
21811
21811
  "typeParameters": [],
21812
- "line": 259,
21812
+ "line": 267,
21813
21813
  "deprecated": false,
21814
21814
  "deprecationMessage": ""
21815
21815
  },
@@ -21819,7 +21819,7 @@
21819
21819
  "optional": false,
21820
21820
  "returnType": "void",
21821
21821
  "typeParameters": [],
21822
- "line": 254,
21822
+ "line": 262,
21823
21823
  "deprecated": false,
21824
21824
  "deprecationMessage": ""
21825
21825
  }
@@ -21831,7 +21831,7 @@
21831
21831
  "name": "class.cds--snippet",
21832
21832
  "deprecated": false,
21833
21833
  "deprecationMessage": "",
21834
- "line": 131,
21834
+ "line": 135,
21835
21835
  "type": "boolean",
21836
21836
  "decorators": []
21837
21837
  },
@@ -21839,7 +21839,7 @@
21839
21839
  "name": "class.cds--snippet--disabled",
21840
21840
  "deprecated": false,
21841
21841
  "deprecationMessage": "",
21842
- "line": 140,
21842
+ "line": 144,
21843
21843
  "type": "boolean",
21844
21844
  "decorators": []
21845
21845
  },
@@ -21847,7 +21847,7 @@
21847
21847
  "name": "class.cds--snippet--light",
21848
21848
  "deprecated": false,
21849
21849
  "deprecationMessage": "",
21850
- "line": 143,
21850
+ "line": 147,
21851
21851
  "type": "boolean",
21852
21852
  "decorators": []
21853
21853
  },
@@ -21855,7 +21855,7 @@
21855
21855
  "name": "class.cds--snippet--multi",
21856
21856
  "deprecated": false,
21857
21857
  "deprecationMessage": "",
21858
- "line": 137,
21858
+ "line": 141,
21859
21859
  "type": "boolean",
21860
21860
  "decorators": []
21861
21861
  },
@@ -21863,7 +21863,7 @@
21863
21863
  "name": "class.cds--snippet--single",
21864
21864
  "deprecated": false,
21865
21865
  "deprecationMessage": "",
21866
- "line": 134,
21866
+ "line": 138,
21867
21867
  "type": "boolean",
21868
21868
  "decorators": []
21869
21869
  }
@@ -21874,7 +21874,7 @@
21874
21874
  "description": "<p>Get started with importing the module:</p>\n<div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { CodeSnippetModule } from &#39;carbon-components-angular&#39;;</code></pre></div><div><pre class=\"line-numbers\"><code class=\"language-html\">&lt;cds-code-snippet&gt;Code&lt;/cds-code-snippet&gt;</code></pre></div><p><a href=\"../../?path=/story/components-code-snippet--basic\">See demo</a></p>\n",
21875
21875
  "rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { CodeSnippetModule } from 'carbon-components-angular';\n```\n\n```html\n<cds-code-snippet>Code</cds-code-snippet>\n```\n\n[See demo](../../?path=/story/components-code-snippet--basic)\n",
21876
21876
  "type": "component",
21877
- "sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tViewChild,\n\tAfterViewInit,\n\tOnInit\n} from \"@angular/core\";\n\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { EventService } from \"carbon-components-angular/utils\";\nimport { BaseIconButton } from \"carbon-components-angular/button\";\n\nexport enum SnippetType {\n\tsingle = \"single\",\n\tmulti = \"multi\",\n\tinline = \"inline\"\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { CodeSnippetModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-code-snippet>Code</cds-code-snippet>\n * ```\n *\n * [See demo](../../?path=/story/components-code-snippet--basic)\n */\n@Component({\n\tselector: \"cds-code-snippet, ibm-code-snippet\",\n\ttemplate: `\n\t\t<ng-container *ngIf=\"display === 'inline'; else notInline\">\n\t\t\t<ng-container *ngIf=\"!hideCopyButton; else noBtnInline\">\n\t\t\t\t<ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\n\t\t\t</ng-container>\n\t\t\t<ng-template #noBtnInline>\n\t\t\t\t<span\n\t\t\t\t\tclass=\"cds--snippet cds--snippet--inline cds--snippet--no-copy\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--snippet--light': theme === 'light'\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container>\n\t\t\t\t</span>\n\t\t\t</ng-template>\n\t\t</ng-container>\n\n\t\t<ng-template #notInline>\n\t\t\t<div\n\t\t\t\t#codeContainer\n\t\t\t\tclass=\"cds--snippet-container\"\n\t\t\t\t[attr.aria-label]=\"translations.CODE_SNIPPET_TEXT\"\n\t\t\t\t[attr.tabindex]=\"display === 'single' && !disabled ? '0' : null\"\n\t\t\t\t[attr.role]=\"display==='single' ? 'textarea' : null\"\n\t\t\t\t[ngStyle]=\"styles\"\n\t\t\t\t(scroll)=\"(display === 'single' ? handleScroll() : null)\">\n\t\t\t\t<ng-container *ngIf=\"skeleton\">\n\t\t\t\t\t<span *ngIf=\"display === 'single'; else multiSkeleton\"></span>\n\t\t\t\t\t<ng-template #multiSkeleton>\n\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t<span></span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t</ng-container>\n\t\t\t\t<pre\n\t\t\t\t\t#codeContent\n\t\t\t\t\t*ngIf=\"!skeleton\"\n\t\t\t\t\t(scroll)=\"(display === 'multi' ? handleScroll() : null)\"><ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container></pre>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"hasLeft\" class=\"cds--snippet__overflow-indicator--left\"></div>\n\t\t\t<div *ngIf=\"hasRight\" class=\"cds--snippet__overflow-indicator--right\"></div>\n\t\t\t<ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\n\t\t\t<button\n\t\t\t\t*ngIf=\"isExpandable\"\n\t\t\t\tclass=\"cds--btn cds--btn--ghost cds--btn--sm cds--snippet-btn--expand\"\n\t\t\t\t(click)=\"toggleSnippetExpansion()\"\n\t\t\t\ttype=\"button\">\n\t\t\t\t<span class=\"cds--snippet-btn--text\">{{expanded ? translations.SHOW_LESS : translations.SHOW_MORE}}</span>\n\t\t\t\t<svg cdsIcon=\"chevron--down\" size=\"16\" class=\"cds--icon-chevron--down\" [attr.aria-label]=\"translations.SHOW_MORE_ICON\"></svg>\n\t\t\t</button>\n\t\t</ng-template>\n\n\t\t<ng-template #buttonTemplate>\n\t\t\t<cds-icon-button\n\t\t\t\t*ngIf=\"!skeleton\"\n\t\t\t\t[description]=\"showFeedback ? feedbackText : copyButtonDescription\"\n\t\t\t\t[align]=\"align\"\n\t\t\t\t[dropShadow]=\"dropShadow\"\n\t\t\t\t[caret]=\"caret\"\n\t\t\t\t[highContrast]=\"highContrast\"\n\t\t\t\t[isOpen]=\"isOpen\"\n\t\t\t\t[enterDelayMs]=\"enterDelayMs\"\n\t\t\t\t[leaveDelayMs]=\"leaveDelayMs\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tkind=\"primary\"\n\t\t\t\tsize=\"md\"\n\t\t\t\t(click)=\"onCopyButtonClicked($event)\"\n\t\t\t\t[buttonNgClass]=\"{\n\t\t\t\t\t'cds--snippet--light': theme === 'light',\n\t\t\t\t\t'cds--snippet--inline': display === 'inline',\n\t\t\t\t\t'cds--btn--icon-only': display !== 'inline',\n\t\t\t\t\t'cds--copy-btn': display !== 'inline',\n\t\t\t\t\t'cds--copy-btn--animating': animating,\n\t\t\t\t\t'cds--copy-btn--fade-in': showFeedback,\n\t\t\t\t\t'cds--copy-btn--fade-out': !showFeedback && animating,\n\t\t\t\t\t'cds--snippet cds--copy': true\n\t\t\t\t}\"\n\t\t\t\t[buttonAttributes]=\"{\n\t\t\t\t\t'aria-label': translations.COPY_CODE,\n\t\t\t\t\t'aria-live': 'polite',\n\t\t\t\t\t'tabindex': '0'\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"display === 'inline'\">\n\t\t\t\t\t<ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container>\n\t\t\t\t</ng-container>\n\t\t\t\t<ng-container *ngIf=\"display !== 'inline'\">\n\t\t\t\t\t<svg cdsIcon=\"copy\" size=\"16\" class=\"cds--snippet__icon\"></svg>\n\t\t\t\t</ng-container>\n\t\t\t</cds-icon-button>\n\t\t</ng-template>\n\n\t\t<ng-template #codeTemplate>\n\t\t\t<code #code><ng-content></ng-content></code>\n\t\t</ng-template>\n\t`\n})\nexport class CodeSnippet extends BaseIconButton implements OnInit, AfterViewInit {\n\t@HostBinding(\"class.cds--snippet\") get snippetClass() {\n\t\treturn this.display !== SnippetType.inline;\n\t}\n\t@HostBinding(\"class.cds--snippet--single\") get snippetSingleClass() {\n\t\treturn this.display === SnippetType.single;\n\t}\n\t@HostBinding(\"class.cds--snippet--multi\") get snippetMultiClass() {\n\t\treturn this.display === SnippetType.multi;\n\t}\n\t@HostBinding(\"class.cds--snippet--disabled\") get snippetDisabledClass() {\n\t\treturn this.display !== \"inline\" && this.disabled;\n\t}\n\t@HostBinding(\"class.cds--snippet--light\") get snippetInlineLightClass() {\n\t\treturn this.theme === \"light\";\n\t}\n\n\treadonly rowHeightInPixel: number = 16;\n\n\t/**\n\t * It can be `\"single\"`, `\"multi\"` or `\"inline\"`\n\t */\n\t@Input() display: SnippetType = SnippetType.single;\n\t@Input() translations = this.i18n.get().CODE_SNIPPET;\n\t/**\n\t * copy button description to show on hover\n\t */\n\t@Input() copyButtonDescription: string;\n\t/**\n\t * Set to `true` to hide copy button\n\t */\n\t@Input() hideCopyButton = false;\n\t/**\n\t * Set to `true` to disable the code snippet\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Specify the max number of rows to show when collapsed\n\t * Default is `15`\n\t */\n\t@Input() maxCollapsedNumberOfRows = 15;\n\t/**\n\t * Specify the min number of rows to show when collapsed\n\t * Default is `3`\n\t */\n\t@Input() minCollapsedNumberOfRows = 3;\n\t/**\n\t * Specify the max number of rows to show when expanded\n\t * Default is `0`, hence all content will be visible when expanded\n\t */\n\t@Input() maxExpandedNumberOfRows = 0;\n\t/**\n\t * Specify the min number of rows to show when expanded\n\t * Default is `16`, hence height of expanded row will be 16 * rowHeightInPixel (16) = 256px\n\t */\n\t@Input() minExpandedNumberOfRows = 16;\n\t/**\n\t * Set to `true` to wrap the text\n\t */\n\t@HostBinding(\"class.cds--snippet--wraptext\") @Input() wrapText = false;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * Set to `\"light\"` to apply the light style\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Text displayed in the tooltip when user clicks button to copy code.\n\t */\n\t@Input() feedbackText = this.translations.COPIED;\n\t/**\n\t * Time in miliseconds to keep the feedback tooltip displayed.\n\t * Defaults to 2 seconds\n\t */\n\t@Input() feedbackTimeout = 2000;\n\n\t@HostBinding(\"class.cds--snippet--expand\") @Input() expanded = false;\n\t@HostBinding(\"class.cds--skeleton\") @Input() skeleton = false;\n\tstyles: any = {};\n\n\t@ViewChild(\"code\") code;\n\t@ViewChild(\"codeContent\") codeContent;\n\t@ViewChild(\"codeContainer\") codeContainer;\n\n\tshowFeedback = false;\n\tanimating = false;\n\thasExpandButton = null;\n\tisExpandable = false;\n\thasRightOverflow = false;\n\n\thasRight = false;\n\thasLeft = false;\n\n\t/**\n\t * Creates an instance of CodeSnippet.\n\t */\n\tconstructor(protected i18n: I18n, protected eventService: EventService) {\n\t\tsuper();\n\t\tthis.dropShadow = false;\n\t}\n\n\thandleScroll() {\n\t\tlet ref;\n\t\tswitch (this.display) {\n\t\t\tcase \"multi\":\n\t\t\t\tref = this.codeContent.nativeElement;\n\t\t\t\tbreak;\n\t\t\tcase \"single\":\n\t\t\t\tref = this.codeContainer.nativeElement;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\t\tif (ref) {\n\t\t\tconst {\n\t\t\t\tscrollWidth,\n\t\t\t\tclientWidth,\n\t\t\t\tscrollLeft\n\t\t\t} = ref;\n\t\t\tconst horizontalOverflow = scrollWidth > clientWidth;\n\t\t\tthis.hasLeft = horizontalOverflow && !!scrollLeft;\n\t\t\tthis.hasRight = horizontalOverflow && scrollLeft + clientWidth !== scrollWidth;\n\t\t}\n\t}\n\n\ttoggleSnippetExpansion() {\n\t\tthis.expanded = !this.expanded;\n\t\tthis.calculateContainerHeight();\n\t}\n\n\tonCopyButtonClicked() {\n\t\tif (!this.disabled) {\n\t\t\twindow.navigator.clipboard\n\t\t\t\t.writeText(this.code.nativeElement.innerText || this.code.nativeElement.textContent).then(() => {\n\t\t\t\t\tthis.showFeedback = true;\n\t\t\t\t\tthis.animating = true;\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tthis.showFeedback = false;\n\t\t\t\t\t\tthis.animating = false;\n\t\t\t\t\t}, this.feedbackTimeout);\n\t\t\t\t});\n\t\t}\n\t}\n\n\tngOnInit() {\n\t\tthis.calculateContainerHeight();\n\t\tif (window) {\n\t\t\tthis.eventService.on(window as any, \"resize\", () => {\n\t\t\t\tthis.canExpand();\n\t\t\t\tthis.handleScroll();\n\t\t\t});\n\t\t}\n\t}\n\n\tngAfterViewInit() {\n\t\tsetTimeout(() => {\n\t\t\tthis.canExpand();\n\t\t\tthis.handleScroll();\n\t\t});\n\t}\n\n\tcalculateContainerHeight() {\n\t\tif (this.display === \"multi\") {\n\t\t\tthis.styles = {};\n\t\t\tif (this.expanded) {\n\t\t\t\tif (this.maxExpandedNumberOfRows > 0) {\n\t\t\t\t\tthis.styles[\"max-height\"] = `${this.maxExpandedNumberOfRows * this.rowHeightInPixel}px`;\n\t\t\t\t}\n\t\t\t\tif (this.minExpandedNumberOfRows > 0) {\n\t\t\t\t\tthis.styles[\"min-height\"] = `${this.minExpandedNumberOfRows * this.rowHeightInPixel}px`;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.maxCollapsedNumberOfRows > 0) {\n\t\t\t\t\tthis.styles[\"max-height\"] = `${this.maxCollapsedNumberOfRows * this.rowHeightInPixel}px`;\n\t\t\t\t}\n\t\t\t\tif (this.minCollapsedNumberOfRows > 0) {\n\t\t\t\t\tthis.styles[\"min-height\"] = `${this.minCollapsedNumberOfRows * this.rowHeightInPixel}px`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected canExpand() {\n\t\tif (this.display === \"multi\") {\n\t\t\tconst height = this.codeContent.nativeElement.getBoundingClientRect().height;\n\t\t\tif (\n\t\t\t\tthis.maxCollapsedNumberOfRows > 0 &&\n\t\t\t\t(this.maxExpandedNumberOfRows <= 0 ||\n\t\t\t\t\tthis.maxExpandedNumberOfRows > this.maxCollapsedNumberOfRows) &&\n\t\t\t\theight > this.maxCollapsedNumberOfRows * this.rowHeightInPixel\n\t\t\t) {\n\t\t\t\tthis.isExpandable = true;\n\t\t\t} else {\n\t\t\t\tthis.isExpandable = false;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tthis.expanded &&\n\t\t\t\tthis.minExpandedNumberOfRows > 0 &&\n\t\t\t\theight <= this.minExpandedNumberOfRows * this.rowHeightInPixel\n\t\t\t) {\n\t\t\t\tthis.isExpandable = false;\n\t\t\t}\n\t\t}\n\t}\n}\n",
21877
+ "sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tViewChild,\n\tAfterViewInit,\n\tOnInit\n} from \"@angular/core\";\n\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { EventService } from \"carbon-components-angular/utils\";\nimport { BaseIconButton } from \"carbon-components-angular/button\";\n\nexport enum SnippetType {\n\tsingle = \"single\",\n\tmulti = \"multi\",\n\tinline = \"inline\"\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { CodeSnippetModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-code-snippet>Code</cds-code-snippet>\n * ```\n *\n * [See demo](../../?path=/story/components-code-snippet--basic)\n */\n@Component({\n\tselector: \"cds-code-snippet, ibm-code-snippet\",\n\ttemplate: `\n\t\t<ng-container *ngIf=\"display === 'inline'; else notInline\">\n\t\t\t<ng-container *ngIf=\"!hideCopyButton; else noBtnInline\">\n\t\t\t\t<ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\n\t\t\t</ng-container>\n\t\t\t<ng-template #noBtnInline>\n\t\t\t\t<span\n\t\t\t\t\tclass=\"cds--snippet cds--snippet--inline cds--snippet--no-copy\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--snippet--light': theme === 'light'\n\t\t\t\t\t}\">\n\t\t\t\t\t<code #code>\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container>\n\t\t\t\t\t</code>\n\t\t\t\t</span>\n\t\t\t</ng-template>\n\t\t</ng-container>\n\n\t\t<ng-template #notInline>\n\t\t\t<div\n\t\t\t\t#codeContainer\n\t\t\t\tclass=\"cds--snippet-container\"\n\t\t\t\t[attr.aria-label]=\"translations.CODE_SNIPPET_TEXT\"\n\t\t\t\t[attr.tabindex]=\"display === 'single' && !disabled ? '0' : null\"\n\t\t\t\t[attr.role]=\"display==='single' ? 'textarea' : null\"\n\t\t\t\t[ngStyle]=\"styles\"\n\t\t\t\t(scroll)=\"(display === 'single' ? handleScroll() : null)\">\n\t\t\t\t<ng-container *ngIf=\"skeleton\">\n\t\t\t\t\t<span *ngIf=\"display === 'single'; else multiSkeleton\"></span>\n\t\t\t\t\t<ng-template #multiSkeleton>\n\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t<span></span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t</ng-container>\n\t\t\t\t<pre\n\t\t\t\t\t#codeContent\n\t\t\t\t\t*ngIf=\"!skeleton\"\n\t\t\t\t\t(scroll)=\"(display === 'multi' ? handleScroll() : null)\"><code #code><ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container></code></pre>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"hasLeft\" class=\"cds--snippet__overflow-indicator--left\"></div>\n\t\t\t<div *ngIf=\"hasRight\" class=\"cds--snippet__overflow-indicator--right\"></div>\n\t\t\t<ng-container *ngTemplateOutlet=\"buttonTemplate\"></ng-container>\n\t\t\t<button\n\t\t\t\t*ngIf=\"isExpandable\"\n\t\t\t\tclass=\"cds--btn cds--btn--ghost cds--btn--sm cds--snippet-btn--expand\"\n\t\t\t\t(click)=\"toggleSnippetExpansion()\"\n\t\t\t\ttype=\"button\">\n\t\t\t\t<span class=\"cds--snippet-btn--text\">{{expanded ? translations.SHOW_LESS : translations.SHOW_MORE}}</span>\n\t\t\t\t<svg cdsIcon=\"chevron--down\" size=\"16\" class=\"cds--icon-chevron--down\" [attr.aria-label]=\"translations.SHOW_MORE_ICON\"></svg>\n\t\t\t</button>\n\t\t</ng-template>\n\n\t\t<ng-template #buttonTemplate>\n\t\t\t<cds-icon-button\n\t\t\t\t*ngIf=\"!skeleton\"\n\t\t\t\t[description]=\"showFeedback ? feedbackText : copyButtonDescription\"\n\t\t\t\t[align]=\"align\"\n\t\t\t\t[dropShadow]=\"dropShadow\"\n\t\t\t\t[caret]=\"caret\"\n\t\t\t\t[highContrast]=\"highContrast\"\n\t\t\t\t[isOpen]=\"isOpen\"\n\t\t\t\t[enterDelayMs]=\"enterDelayMs\"\n\t\t\t\t[leaveDelayMs]=\"leaveDelayMs\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tkind=\"primary\"\n\t\t\t\tsize=\"md\"\n\t\t\t\t(click)=\"onCopyButtonClicked($event)\"\n\t\t\t\t[buttonNgClass]=\"{\n\t\t\t\t\t'cds--snippet--light': theme === 'light',\n\t\t\t\t\t'cds--snippet--inline': display === 'inline',\n\t\t\t\t\t'cds--btn--icon-only': display !== 'inline',\n\t\t\t\t\t'cds--copy-btn': display !== 'inline',\n\t\t\t\t\t'cds--copy-btn--animating': animating,\n\t\t\t\t\t'cds--copy-btn--fade-in': showFeedback,\n\t\t\t\t\t'cds--copy-btn--fade-out': !showFeedback && animating,\n\t\t\t\t\t'cds--snippet cds--copy': true\n\t\t\t\t}\"\n\t\t\t\t[buttonAttributes]=\"{\n\t\t\t\t\t'aria-label': translations.COPY_CODE,\n\t\t\t\t\t'aria-live': 'polite',\n\t\t\t\t\t'tabindex': '0'\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"display === 'inline'\">\n\t\t\t\t\t<code #code>\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"codeTemplate\"></ng-container>\n\t\t\t\t\t</code>\n\t\t\t\t</ng-container>\n\t\t\t\t<ng-container *ngIf=\"display !== 'inline'\">\n\t\t\t\t\t<svg cdsIcon=\"copy\" size=\"16\" class=\"cds--snippet__icon\"></svg>\n\t\t\t\t</ng-container>\n\t\t\t</cds-icon-button>\n\t\t</ng-template>\n\n\t\t<ng-template #codeTemplate>\n\t\t\t<ng-content></ng-content>\n\t\t</ng-template>\n\t`\n})\nexport class CodeSnippet extends BaseIconButton implements OnInit, AfterViewInit {\n\t@HostBinding(\"class.cds--snippet\") get snippetClass() {\n\t\treturn this.display !== SnippetType.inline;\n\t}\n\t@HostBinding(\"class.cds--snippet--single\") get snippetSingleClass() {\n\t\treturn this.display === SnippetType.single;\n\t}\n\t@HostBinding(\"class.cds--snippet--multi\") get snippetMultiClass() {\n\t\treturn this.display === SnippetType.multi;\n\t}\n\t@HostBinding(\"class.cds--snippet--disabled\") get snippetDisabledClass() {\n\t\treturn this.display !== \"inline\" && this.disabled;\n\t}\n\t@HostBinding(\"class.cds--snippet--light\") get snippetInlineLightClass() {\n\t\treturn this.theme === \"light\";\n\t}\n\n\treadonly rowHeightInPixel: number = 16;\n\n\t/**\n\t * It can be `\"single\"`, `\"multi\"` or `\"inline\"`\n\t */\n\t@Input() display: SnippetType = SnippetType.single;\n\t@Input() translations = this.i18n.get().CODE_SNIPPET;\n\t/**\n\t * copy button description to show on hover\n\t */\n\t@Input() copyButtonDescription: string;\n\t/**\n\t * Set to `true` to hide copy button\n\t */\n\t@Input() hideCopyButton = false;\n\t/**\n\t * Set to `true` to disable the code snippet\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Specify the max number of rows to show when collapsed\n\t * Default is `15`\n\t */\n\t@Input() maxCollapsedNumberOfRows = 15;\n\t/**\n\t * Specify the min number of rows to show when collapsed\n\t * Default is `3`\n\t */\n\t@Input() minCollapsedNumberOfRows = 3;\n\t/**\n\t * Specify the max number of rows to show when expanded\n\t * Default is `0`, hence all content will be visible when expanded\n\t */\n\t@Input() maxExpandedNumberOfRows = 0;\n\t/**\n\t * Specify the min number of rows to show when expanded\n\t * Default is `16`, hence height of expanded row will be 16 * rowHeightInPixel (16) = 256px\n\t */\n\t@Input() minExpandedNumberOfRows = 16;\n\t/**\n\t * Set to `true` to wrap the text\n\t */\n\t@HostBinding(\"class.cds--snippet--wraptext\") @Input() wrapText = false;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * Set to `\"light\"` to apply the light style\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Text displayed in the tooltip when user clicks button to copy code.\n\t */\n\t@Input() feedbackText = this.translations.COPIED;\n\t/**\n\t * Time in miliseconds to keep the feedback tooltip displayed.\n\t * Defaults to 2 seconds\n\t */\n\t@Input() feedbackTimeout = 2000;\n\n\t@HostBinding(\"class.cds--snippet--expand\") @Input() expanded = false;\n\t@HostBinding(\"class.cds--skeleton\") @Input() skeleton = false;\n\tstyles: any = {};\n\n\t@ViewChild(\"code\") code;\n\t@ViewChild(\"codeContent\") codeContent;\n\t@ViewChild(\"codeContainer\") codeContainer;\n\n\tshowFeedback = false;\n\tanimating = false;\n\thasExpandButton = null;\n\tisExpandable = false;\n\thasRightOverflow = false;\n\n\thasRight = false;\n\thasLeft = false;\n\n\t/**\n\t * Creates an instance of CodeSnippet.\n\t */\n\tconstructor(protected i18n: I18n, protected eventService: EventService) {\n\t\tsuper();\n\t\tthis.dropShadow = false;\n\t}\n\n\thandleScroll() {\n\t\tif (this.skeleton) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet ref;\n\t\tswitch (this.display) {\n\t\t\tcase \"multi\":\n\t\t\t\tref = this.codeContent.nativeElement;\n\t\t\t\tbreak;\n\t\t\tcase \"single\":\n\t\t\t\tref = this.codeContainer.nativeElement;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\t\tif (ref) {\n\t\t\tconst {\n\t\t\t\tscrollWidth,\n\t\t\t\tclientWidth,\n\t\t\t\tscrollLeft\n\t\t\t} = ref;\n\t\t\tconst horizontalOverflow = scrollWidth > clientWidth;\n\t\t\tthis.hasLeft = horizontalOverflow && !!scrollLeft;\n\t\t\tthis.hasRight = horizontalOverflow && scrollLeft + clientWidth !== scrollWidth;\n\t\t}\n\t}\n\n\ttoggleSnippetExpansion() {\n\t\tthis.expanded = !this.expanded;\n\t\tthis.calculateContainerHeight();\n\t}\n\n\tonCopyButtonClicked() {\n\t\tif (!this.disabled) {\n\t\t\twindow.navigator.clipboard\n\t\t\t\t.writeText(this.code).then(() => {\n\t\t\t\t\tthis.showFeedback = true;\n\t\t\t\t\tthis.animating = true;\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tthis.showFeedback = false;\n\t\t\t\t\t\tthis.animating = false;\n\t\t\t\t\t}, this.feedbackTimeout);\n\t\t\t\t});\n\t\t}\n\t}\n\n\tngOnInit() {\n\t\tthis.calculateContainerHeight();\n\t}\n\n\tngAfterViewInit() {\n\t\tthis.canExpand();\n\t\tthis.handleScroll();\n\t\tif (window) {\n\t\t\tthis.eventService.on(window as any, \"resize\", () => {\n\t\t\t\tthis.canExpand();\n\t\t\t\tthis.handleScroll();\n\t\t\t});\n\t\t}\n\t}\n\n\tcalculateContainerHeight() {\n\t\tif (this.display === \"multi\" && !this.skeleton) {\n\t\t\tthis.styles = {};\n\t\t\tif (this.expanded) {\n\t\t\t\tif (this.maxExpandedNumberOfRows > 0) {\n\t\t\t\t\tthis.styles[\"max-height\"] = `${this.maxExpandedNumberOfRows * this.rowHeightInPixel}px`;\n\t\t\t\t}\n\t\t\t\tif (this.minExpandedNumberOfRows > 0) {\n\t\t\t\t\tthis.styles[\"min-height\"] = `${this.minExpandedNumberOfRows * this.rowHeightInPixel}px`;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.maxCollapsedNumberOfRows > 0) {\n\t\t\t\t\tthis.styles[\"max-height\"] = `${this.maxCollapsedNumberOfRows * this.rowHeightInPixel}px`;\n\t\t\t\t}\n\t\t\t\tif (this.minCollapsedNumberOfRows > 0) {\n\t\t\t\t\tthis.styles[\"min-height\"] = `${this.minCollapsedNumberOfRows * this.rowHeightInPixel}px`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected canExpand() {\n\t\tif (this.display === \"multi\" && !this.skeleton) {\n\t\t\tconst height = this.codeContent.nativeElement.getBoundingClientRect().height;\n\t\t\tif (\n\t\t\t\tthis.maxCollapsedNumberOfRows > 0 &&\n\t\t\t\t(this.maxExpandedNumberOfRows <= 0 ||\n\t\t\t\t\tthis.maxExpandedNumberOfRows > this.maxCollapsedNumberOfRows) &&\n\t\t\t\theight > this.maxCollapsedNumberOfRows * this.rowHeightInPixel\n\t\t\t) {\n\t\t\t\tthis.isExpandable = true;\n\t\t\t} else {\n\t\t\t\tthis.isExpandable = false;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tthis.expanded &&\n\t\t\t\tthis.minExpandedNumberOfRows > 0 &&\n\t\t\t\theight <= this.minExpandedNumberOfRows * this.rowHeightInPixel\n\t\t\t) {\n\t\t\t\tthis.isExpandable = false;\n\t\t\t}\n\t\t}\n\t}\n}\n",
21878
21878
  "assetsDirs": [],
21879
21879
  "styleUrlsData": "",
21880
21880
  "stylesData": "",
@@ -21897,7 +21897,7 @@
21897
21897
  "deprecationMessage": ""
21898
21898
  }
21899
21899
  ],
21900
- "line": 220,
21900
+ "line": 224,
21901
21901
  "rawdescription": "\n\nCreates an instance of CodeSnippet.\n",
21902
21902
  "jsdoctags": [
21903
21903
  {
@@ -21932,7 +21932,7 @@
21932
21932
  "name": "snippetClass",
21933
21933
  "type": "",
21934
21934
  "returnType": "",
21935
- "line": 131
21935
+ "line": 135
21936
21936
  }
21937
21937
  },
21938
21938
  "snippetSingleClass": {
@@ -21941,7 +21941,7 @@
21941
21941
  "name": "snippetSingleClass",
21942
21942
  "type": "",
21943
21943
  "returnType": "",
21944
- "line": 134
21944
+ "line": 138
21945
21945
  }
21946
21946
  },
21947
21947
  "snippetMultiClass": {
@@ -21950,7 +21950,7 @@
21950
21950
  "name": "snippetMultiClass",
21951
21951
  "type": "",
21952
21952
  "returnType": "",
21953
- "line": 137
21953
+ "line": 141
21954
21954
  }
21955
21955
  },
21956
21956
  "snippetDisabledClass": {
@@ -21959,7 +21959,7 @@
21959
21959
  "name": "snippetDisabledClass",
21960
21960
  "type": "",
21961
21961
  "returnType": "",
21962
- "line": 140
21962
+ "line": 144
21963
21963
  }
21964
21964
  },
21965
21965
  "snippetInlineLightClass": {
@@ -21968,7 +21968,7 @@
21968
21968
  "name": "snippetInlineLightClass",
21969
21969
  "type": "",
21970
21970
  "returnType": "",
21971
- "line": 143
21971
+ "line": 147
21972
21972
  }
21973
21973
  }
21974
21974
  }