@eui/ecl 22.0.0-alpha.23 → 22.0.0-alpha.24

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.
@@ -29853,12 +29853,12 @@
29853
29853
  },
29854
29854
  {
29855
29855
  "name": "EclPopoverContentDirective",
29856
- "id": "directive-EclPopoverContentDirective-3cdbc1d4254e769969145a4f4587faf1e4ff9d712aef3995ee8b80395eebd6605a09d6e7fb0a2964cb6839af8d4660024def0038fe8b45ecb79b567dc1882c52",
29856
+ "id": "directive-EclPopoverContentDirective-b8699a8bc3b35b54eab845cb018247c20c19bdf4241f71d55c2aa5554df6fda93bb7314776c01aa64ec719a917d6f9c8b976312c75d8aee944a481b62a9eee03",
29857
29857
  "file": "packages/ecl/components/ecl-popover/ecl-popover-content.directive.ts",
29858
29858
  "type": "directive",
29859
29859
  "description": "<p>Directive applied to the content section of an <code>ecl-popover</code> component.</p>\n<p>Responsible for applying the appropriate CSS class to the popover content container.</p>\n",
29860
29860
  "rawdescription": "\n\nDirective applied to the content section of an `ecl-popover` component.\n\nResponsible for applying the appropriate CSS class to the popover content container.\n",
29861
- "sourceCode": "import { Directive, HostBinding } from '@angular/core';\nimport { ECLBaseDirective } from '@eui/ecl/core';\n\n/**\n * Directive applied to the content section of an `ecl-popover` component.\n *\n * Responsible for applying the appropriate CSS class to the popover content container.\n */\n@Directive({\n selector: '[eclPopoverContent]',\n})\nexport class EclPopoverContentDirective extends ECLBaseDirective {\n /**\n * Host binding that applies the CSS class to style the popover content.\n */\n @HostBinding('class')\n get cssClasses(): string {\n return [super.getCssClasses('ecl-popover__content')].join(' ').trim();\n }\n}\n",
29861
+ "sourceCode": "import { Directive } from '@angular/core';\nimport { ECLBaseDirective } from '@eui/ecl/core';\n\n/**\n * Directive applied to the content section of an `ecl-popover` component.\n *\n * Responsible for applying the appropriate CSS class to the popover content container.\n */\n@Directive({\n selector: '[eclPopoverContent]',\n host: {\n '[class]': 'cssClasses',\n },\n})\nexport class EclPopoverContentDirective extends ECLBaseDirective {\n /**\n * Host binding that applies the CSS class to style the popover content.\n */\n get cssClasses(): string {\n return [super.getCssClasses('ecl-popover__content')].join(' ').trim();\n }\n}\n",
29862
29862
  "selector": "[eclPopoverContent]",
29863
29863
  "providers": [],
29864
29864
  "hostDirectives": [],
@@ -29911,20 +29911,7 @@
29911
29911
  "outputsClass": [],
29912
29912
  "deprecated": false,
29913
29913
  "deprecationMessage": "",
29914
- "hostBindings": [
29915
- {
29916
- "coverageIgnore": false,
29917
- "name": "class",
29918
- "actualName": "cssClasses",
29919
- "deprecated": false,
29920
- "deprecationMessage": "",
29921
- "rawdescription": "\n\nHost binding that applies the CSS class to style the popover content.\n",
29922
- "description": "<p>Host binding that applies the CSS class to style the popover content.</p>\n",
29923
- "line": 17,
29924
- "type": "string",
29925
- "decorators": []
29926
- }
29927
- ],
29914
+ "hostBindings": [],
29928
29915
  "hostListeners": [],
29929
29916
  "propertiesClass": [],
29930
29917
  "methodsClass": [
@@ -29970,8 +29957,8 @@
29970
29957
  "coverageIgnore": false,
29971
29958
  "jsdoctags": [
29972
29959
  {
29973
- "pos": 107,
29974
- "end": 280,
29960
+ "pos": 94,
29961
+ "end": 267,
29975
29962
  "kind": 321,
29976
29963
  "id": 0,
29977
29964
  "flags": 16777216,
@@ -29990,7 +29977,7 @@
29990
29977
  "name": "cssClasses",
29991
29978
  "type": "string",
29992
29979
  "returnType": "string",
29993
- "line": 17,
29980
+ "line": 19,
29994
29981
  "rawdescription": "\n\nHost binding that applies the CSS class to style the popover content.\n",
29995
29982
  "description": "<p>Host binding that applies the CSS class to style the popover content.</p>\n"
29996
29983
  }
@@ -30008,12 +29995,12 @@
30008
29995
  },
30009
29996
  {
30010
29997
  "name": "EclPopoverToggleDirective",
30011
- "id": "directive-EclPopoverToggleDirective-02bd17a313e4b1b3c9d67a3623eb82c1f3cf98e884407d1c5a00bd3178f4c3a74de986f22e899e625434caf81f8198f76255f289687baf54421077b1a48e89c2",
29998
+ "id": "directive-EclPopoverToggleDirective-c844b5e056189367d8b48640ab7ef44c1d849d58d8b6b9ac80a3374b519d216947d034f0a563f4bf38755df5c1a3833084de5bac8ea9d6c1a93b4998e0246ad8",
30012
29999
  "file": "packages/ecl/components/ecl-popover/ecl-popover-toggle.directive.ts",
30013
30000
  "type": "directive",
30014
30001
  "description": "<p>Directive used to toggle the visibility of an <code>ecl-popover</code> component.</p>\n<p>This directive emits a custom click event and manages accessibility attributes.</p>\n",
30015
30002
  "rawdescription": "\n\nDirective used to toggle the visibility of an `ecl-popover` component.\n\nThis directive emits a custom click event and manages accessibility attributes.\n",
30016
- "sourceCode": "import { Directive, ElementRef, EventEmitter, HostBinding, HostListener, Output, inject } from '@angular/core';\nimport { ECLBaseDirective } from '@eui/ecl/core';\n\n/**\n * Directive used to toggle the visibility of an `ecl-popover` component.\n *\n * This directive emits a custom click event and manages accessibility attributes.\n */\n@Directive({\n selector: '[eclPopoverToggle]',\n})\nexport class EclPopoverToggleDirective extends ECLBaseDirective {\n hostElementRef = inject(ElementRef);\n\n /**\n * Sets the `aria-expanded` attribute to reflect the popover's open state.\n * This should be updated by the parent popover component.\n */\n @HostBinding('attr.aria-expanded') isExpanded = false;\n\n /**\n * Event emitted when the toggle element is clicked with the left mouse button.\n */\n // eslint-disable-next-line @angular-eslint/no-output-native\n @Output() click = new EventEmitter();\n\n /**\n * Host binding that applies the appropriate CSS class to the toggle element.\n */\n @HostBinding('class')\n get cssClasses(): string {\n return [super.getCssClasses('ecl-popover__toggle')].join(' ').trim();\n }\n\n /**\n * Emits the `click` event only for left mouse button clicks.\n * Used by the popover component to toggle visibility.\n */\n @HostListener('mouseup', ['$event'])\n onClick(evt: MouseEvent): void {\n const LEFT_BUTTON = 0;\n\n if (evt.button === LEFT_BUTTON) {\n this.click.next(null);\n }\n }\n\n /**\n * Triggers the click event on Enter or Space keydown and prevents default behavior.\n */\n @HostListener('keydown.enter', ['$event'])\n @HostListener('keydown.space', ['$event'])\n onKeyboardActivate(evt: Event): void {\n evt.preventDefault();\n this.click.next(null);\n }\n\n /**\n * Returns the native HTML element of the directive.\n * Used internally by the popover to query attributes.\n */\n public getHostElement(): HTMLElement {\n return this.hostElementRef.nativeElement;\n }\n}\n",
30003
+ "sourceCode": "import { Directive, ElementRef, inject, output, signal } from '@angular/core';\nimport { ECLBaseDirective } from '@eui/ecl/core';\n\n/**\n * Directive used to toggle the visibility of an `ecl-popover` component.\n *\n * This directive emits a custom click event and manages accessibility attributes.\n */\n@Directive({\n selector: '[eclPopoverToggle]',\n host: {\n '[attr.aria-expanded]': 'isExpanded()',\n '[class]': 'cssClasses',\n '(mouseup)': 'onClick($event)',\n '(keydown.enter)': 'onKeyboardActivate($event)',\n '(keydown.space)': 'onKeyboardActivate($event)',\n },\n})\nexport class EclPopoverToggleDirective extends ECLBaseDirective {\n hostElementRef = inject(ElementRef);\n\n /**\n * Sets the `aria-expanded` attribute to reflect the popover's open state.\n * This should be updated by the parent popover component.\n */\n readonly isExpanded = signal(false);\n\n /**\n * Event emitted when the toggle element is clicked with the left mouse button.\n */\n // eslint-disable-next-line @angular-eslint/no-output-native\n readonly click = output();\n\n /**\n * Host binding that applies the appropriate CSS class to the toggle element.\n */\n get cssClasses(): string {\n return [super.getCssClasses('ecl-popover__toggle')].join(' ').trim();\n }\n\n /**\n * Emits the `click` event only for left mouse button clicks.\n * Used by the popover component to toggle visibility.\n */\n onClick(evt: MouseEvent): void {\n const LEFT_BUTTON = 0;\n\n if (evt.button === LEFT_BUTTON) {\n this.click.emit();\n }\n }\n\n /**\n * Triggers the click event on Enter or Space keydown and prevents default behavior.\n */\n onKeyboardActivate(evt: Event): void {\n evt.preventDefault();\n this.click.emit();\n }\n\n /**\n * Returns the native HTML element of the directive.\n * Used internally by the popover to query attributes.\n */\n public getHostElement(): HTMLElement {\n return this.hostElementRef.nativeElement;\n }\n}\n",
30017
30004
  "selector": "[eclPopoverToggle]",
30018
30005
  "providers": [],
30019
30006
  "hostDirectives": [],
@@ -30067,112 +30054,23 @@
30067
30054
  {
30068
30055
  "name": "click",
30069
30056
  "coverageIgnore": false,
30070
- "defaultValue": "new EventEmitter()",
30071
30057
  "deprecated": false,
30072
30058
  "deprecationMessage": "",
30073
- "rawdescription": "\n\nEvent emitted when the toggle element is clicked with the left mouse button.\n",
30059
+ "indexKey": "",
30060
+ "optional": false,
30074
30061
  "description": "<p>Event emitted when the toggle element is clicked with the left mouse button.</p>\n",
30075
- "line": 25,
30076
- "type": "EventEmitter"
30062
+ "line": 32,
30063
+ "rawdescription": "\n\nEvent emitted when the toggle element is clicked with the left mouse button.\n",
30064
+ "modifierKind": [
30065
+ 148
30066
+ ],
30067
+ "required": false
30077
30068
  }
30078
30069
  ],
30079
30070
  "deprecated": false,
30080
30071
  "deprecationMessage": "",
30081
- "hostBindings": [
30082
- {
30083
- "coverageIgnore": false,
30084
- "name": "attr.aria-expanded",
30085
- "actualName": "isExpanded",
30086
- "defaultValue": "false",
30087
- "deprecated": false,
30088
- "deprecationMessage": "",
30089
- "rawdescription": "\n\nSets the `aria-expanded` attribute to reflect the popover's open state.\nThis should be updated by the parent popover component.\n",
30090
- "description": "<p>Sets the <code>aria-expanded</code> attribute to reflect the popover&#39;s open state.\nThis should be updated by the parent popover component.</p>\n",
30091
- "line": 19,
30092
- "type": "boolean",
30093
- "decorators": []
30094
- },
30095
- {
30096
- "coverageIgnore": false,
30097
- "name": "class",
30098
- "actualName": "cssClasses",
30099
- "deprecated": false,
30100
- "deprecationMessage": "",
30101
- "rawdescription": "\n\nHost binding that applies the appropriate CSS class to the toggle element.\n",
30102
- "description": "<p>Host binding that applies the appropriate CSS class to the toggle element.</p>\n",
30103
- "line": 31,
30104
- "type": "string",
30105
- "decorators": []
30106
- }
30107
- ],
30108
- "hostListeners": [
30109
- {
30110
- "coverageIgnore": false,
30111
- "name": "keydown.enter",
30112
- "args": [
30113
- {
30114
- "name": "evt",
30115
- "type": "Event",
30116
- "optional": false,
30117
- "dotDotDotToken": false,
30118
- "deprecated": false,
30119
- "deprecationMessage": ""
30120
- }
30121
- ],
30122
- "argsDecorator": [
30123
- "$event"
30124
- ],
30125
- "deprecated": false,
30126
- "deprecationMessage": "",
30127
- "rawdescription": "\n\nTriggers the click event on Enter or Space keydown and prevents default behavior.\n",
30128
- "description": "<p>Triggers the click event on Enter or Space keydown and prevents default behavior.</p>\n",
30129
- "line": 53
30130
- },
30131
- {
30132
- "coverageIgnore": false,
30133
- "name": "keydown.space",
30134
- "args": [
30135
- {
30136
- "name": "evt",
30137
- "type": "Event",
30138
- "optional": false,
30139
- "dotDotDotToken": false,
30140
- "deprecated": false,
30141
- "deprecationMessage": ""
30142
- }
30143
- ],
30144
- "argsDecorator": [
30145
- "$event"
30146
- ],
30147
- "deprecated": false,
30148
- "deprecationMessage": "",
30149
- "rawdescription": "\n\nTriggers the click event on Enter or Space keydown and prevents default behavior.\n",
30150
- "description": "<p>Triggers the click event on Enter or Space keydown and prevents default behavior.</p>\n",
30151
- "line": 53
30152
- },
30153
- {
30154
- "coverageIgnore": false,
30155
- "name": "mouseup",
30156
- "args": [
30157
- {
30158
- "name": "evt",
30159
- "type": "MouseEvent",
30160
- "optional": false,
30161
- "dotDotDotToken": false,
30162
- "deprecated": false,
30163
- "deprecationMessage": ""
30164
- }
30165
- ],
30166
- "argsDecorator": [
30167
- "$event"
30168
- ],
30169
- "deprecated": false,
30170
- "deprecationMessage": "",
30171
- "rawdescription": "\n\nEmits the `click` event only for left mouse button clicks.\nUsed by the popover component to toggle visibility.\n",
30172
- "description": "<p>Emits the <code>click</code> event only for left mouse button clicks.\nUsed by the popover component to toggle visibility.</p>\n",
30173
- "line": 40
30174
- }
30175
- ],
30072
+ "hostBindings": [],
30073
+ "hostListeners": [],
30176
30074
  "propertiesClass": [
30177
30075
  {
30178
30076
  "name": "hostElementRef",
@@ -30184,29 +30082,23 @@
30184
30082
  "indexKey": "",
30185
30083
  "optional": false,
30186
30084
  "description": "",
30187
- "line": 13,
30085
+ "line": 20,
30188
30086
  "rawdescription": "\n"
30189
30087
  },
30190
30088
  {
30191
30089
  "name": "isExpanded",
30192
30090
  "coverageIgnore": false,
30193
- "defaultValue": "false",
30091
+ "defaultValue": "signal(false)",
30194
30092
  "deprecated": false,
30195
30093
  "deprecationMessage": "",
30196
30094
  "type": "unknown",
30197
30095
  "indexKey": "",
30198
30096
  "optional": false,
30199
30097
  "description": "<p>Sets the <code>aria-expanded</code> attribute to reflect the popover&#39;s open state.\nThis should be updated by the parent popover component.</p>\n",
30200
- "line": 19,
30098
+ "line": 26,
30201
30099
  "rawdescription": "\n\nSets the `aria-expanded` attribute to reflect the popover's open state.\nThis should be updated by the parent popover component.\n",
30202
- "decorators": [
30203
- {
30204
- "name": "HostBinding",
30205
- "stringifiedArguments": "'attr.aria-expanded'"
30206
- }
30207
- ],
30208
30100
  "modifierKind": [
30209
- 171
30101
+ 148
30210
30102
  ]
30211
30103
  }
30212
30104
  ],
@@ -30218,7 +30110,7 @@
30218
30110
  "optional": false,
30219
30111
  "returnType": "HTMLElement",
30220
30112
  "typeParameters": [],
30221
- "line": 62,
30113
+ "line": 65,
30222
30114
  "deprecated": false,
30223
30115
  "deprecationMessage": "",
30224
30116
  "rawdescription": "\n\nReturns the native HTML element of the directive.\nUsed internally by the popover to query attributes.\n",
@@ -30243,20 +30135,11 @@
30243
30135
  "optional": false,
30244
30136
  "returnType": "void",
30245
30137
  "typeParameters": [],
30246
- "line": 40,
30138
+ "line": 45,
30247
30139
  "deprecated": false,
30248
30140
  "deprecationMessage": "",
30249
30141
  "rawdescription": "\n\nEmits the `click` event only for left mouse button clicks.\nUsed by the popover component to toggle visibility.\n",
30250
30142
  "description": "<p>Emits the <code>click</code> event only for left mouse button clicks.\nUsed by the popover component to toggle visibility.</p>\n",
30251
- "decorators": [
30252
- {
30253
- "name": "HostListener",
30254
- "stringifiedArguments": "'mouseup', ['$event']"
30255
- }
30256
- ],
30257
- "modifierKind": [
30258
- 171
30259
- ],
30260
30143
  "jsdoctags": [
30261
30144
  {
30262
30145
  "name": "evt",
@@ -30287,25 +30170,11 @@
30287
30170
  "optional": false,
30288
30171
  "returnType": "void",
30289
30172
  "typeParameters": [],
30290
- "line": 53,
30173
+ "line": 56,
30291
30174
  "deprecated": false,
30292
30175
  "deprecationMessage": "",
30293
30176
  "rawdescription": "\n\nTriggers the click event on Enter or Space keydown and prevents default behavior.\n",
30294
30177
  "description": "<p>Triggers the click event on Enter or Space keydown and prevents default behavior.</p>\n",
30295
- "decorators": [
30296
- {
30297
- "name": "HostListener",
30298
- "stringifiedArguments": "'keydown.enter', ['$event']"
30299
- },
30300
- {
30301
- "name": "HostListener",
30302
- "stringifiedArguments": "'keydown.space', ['$event']"
30303
- }
30304
- ],
30305
- "modifierKind": [
30306
- 171,
30307
- 171
30308
- ],
30309
30178
  "jsdoctags": [
30310
30179
  {
30311
30180
  "name": "evt",
@@ -30362,8 +30231,8 @@
30362
30231
  "coverageIgnore": false,
30363
30232
  "jsdoctags": [
30364
30233
  {
30365
- "pos": 163,
30366
- "end": 330,
30234
+ "pos": 130,
30235
+ "end": 297,
30367
30236
  "kind": 321,
30368
30237
  "id": 0,
30369
30238
  "flags": 16777216,
@@ -30382,7 +30251,7 @@
30382
30251
  "name": "cssClasses",
30383
30252
  "type": "string",
30384
30253
  "returnType": "string",
30385
- "line": 31,
30254
+ "line": 37,
30386
30255
  "rawdescription": "\n\nHost binding that applies the appropriate CSS class to the toggle element.\n",
30387
30256
  "description": "<p>Host binding that applies the appropriate CSS class to the toggle element.</p>\n"
30388
30257
  }
@@ -73948,10 +73817,11 @@
73948
73817
  },
73949
73818
  {
73950
73819
  "name": "EclPopoverComponent",
73951
- "id": "component-EclPopoverComponent-94889b974be58dee9fd2d45b76aef05cf5f2c361f8d9ac0f6a2ab030d53f3e06434161d73d0de96088341393e5755af75c3ae4e6cac51bf7f86b28d399e7d284",
73820
+ "id": "component-EclPopoverComponent-69f74ba25ed820bb35976f69f73156f370ce60196a5e09af6885eba78cfef67ac293775c262d77c47511ca1fbc6061d4d3b296e0d26b7ebb8770ca5e8a851ffe",
73952
73821
  "file": "packages/ecl/components/ecl-popover/ecl-popover.component.ts",
73953
73822
  "encapsulation": [],
73954
73823
  "entryComponents": [],
73824
+ "host": {},
73955
73825
  "inputs": [],
73956
73826
  "outputs": [],
73957
73827
  "providers": [],
@@ -74026,7 +73896,7 @@
74026
73896
  "indexKey": "",
74027
73897
  "optional": false,
74028
73898
  "description": "",
74029
- "line": 47,
73899
+ "line": 54,
74030
73900
  "rawdescription": "\n",
74031
73901
  "required": false
74032
73902
  },
@@ -74038,7 +73908,7 @@
74038
73908
  "indexKey": "",
74039
73909
  "optional": false,
74040
73910
  "description": "",
74041
- "line": 46,
73911
+ "line": 53,
74042
73912
  "rawdescription": "\n",
74043
73913
  "required": false
74044
73914
  }
@@ -74054,7 +73924,7 @@
74054
73924
  "indexKey": "",
74055
73925
  "optional": false,
74056
73926
  "description": "<p>Reference to the popover container element.</p>\n",
74057
- "line": 34,
73927
+ "line": 41,
74058
73928
  "rawdescription": "\n\nReference to the popover container element.\n",
74059
73929
  "modifierKind": [
74060
73930
  148
@@ -74070,7 +73940,7 @@
74070
73940
  "indexKey": "",
74071
73941
  "optional": false,
74072
73942
  "description": "<p>Reference to the scrollable content element inside the popover.</p>\n",
74073
- "line": 39,
73943
+ "line": 46,
74074
73944
  "rawdescription": "\n\nReference to the scrollable content element inside the popover.\n",
74075
73945
  "modifierKind": [
74076
73946
  148
@@ -74086,7 +73956,7 @@
74086
73956
  "indexKey": "",
74087
73957
  "optional": false,
74088
73958
  "description": "<p>Reference to the toggle element used to open/close the popover.</p>\n",
74089
- "line": 44,
73959
+ "line": 51,
74090
73960
  "rawdescription": "\n\nReference to the toggle element used to open/close the popover.\n",
74091
73961
  "modifierKind": [
74092
73962
  148
@@ -74102,7 +73972,7 @@
74102
73972
  "indexKey": "",
74103
73973
  "optional": false,
74104
73974
  "description": "<p>Controls visibility of the popover. <code>true</code> means hidden.</p>\n",
74105
- "line": 52,
73975
+ "line": 59,
74106
73976
  "rawdescription": "\n\nControls visibility of the popover. `true` means hidden.\n",
74107
73977
  "modifierKind": [
74108
73978
  124
@@ -74117,7 +73987,7 @@
74117
73987
  "optional": false,
74118
73988
  "returnType": "void",
74119
73989
  "typeParameters": [],
74120
- "line": 159,
73990
+ "line": 167,
74121
73991
  "deprecated": false,
74122
73992
  "deprecationMessage": "",
74123
73993
  "rawdescription": "\n\nProtected method used to close the popover and reset related styles.\n",
@@ -74142,7 +74012,7 @@
74142
74012
  "optional": false,
74143
74013
  "returnType": "void",
74144
74014
  "typeParameters": [],
74145
- "line": 338,
74015
+ "line": 348,
74146
74016
  "deprecated": false,
74147
74017
  "deprecationMessage": "",
74148
74018
  "rawdescription": "\n\nCheck whether the popover is going out of its scrollable container and apply the needed repositioning.\n\n",
@@ -74150,8 +74020,8 @@
74150
74020
  "jsdoctags": [
74151
74021
  {
74152
74022
  "name": {
74153
- "pos": 12343,
74154
- "end": 12352,
74023
+ "pos": 12812,
74024
+ "end": 12821,
74155
74025
  "kind": 80,
74156
74026
  "id": 0,
74157
74027
  "flags": 16842752,
@@ -74164,8 +74034,8 @@
74164
74034
  "deprecated": false,
74165
74035
  "deprecationMessage": "",
74166
74036
  "tagName": {
74167
- "pos": 12328,
74168
- "end": 12333,
74037
+ "pos": 12797,
74038
+ "end": 12802,
74169
74039
  "kind": 80,
74170
74040
  "id": 0,
74171
74041
  "flags": 16842752,
@@ -74174,16 +74044,16 @@
74174
74044
  },
74175
74045
  "comment": "",
74176
74046
  "typeExpression": {
74177
- "pos": 12334,
74178
- "end": 12342,
74047
+ "pos": 12803,
74048
+ "end": 12811,
74179
74049
  "kind": 310,
74180
74050
  "id": 0,
74181
74051
  "flags": 16842752,
74182
74052
  "modifierFlagsCache": 0,
74183
74053
  "transformFlags": 0,
74184
74054
  "type": {
74185
- "pos": 12335,
74186
- "end": 12341,
74055
+ "pos": 12804,
74056
+ "end": 12810,
74187
74057
  "kind": 154,
74188
74058
  "id": 0,
74189
74059
  "flags": 16777216,
@@ -74200,7 +74070,7 @@
74200
74070
  "optional": false,
74201
74071
  "returnType": "void",
74202
74072
  "typeParameters": [],
74203
- "line": 99,
74073
+ "line": 106,
74204
74074
  "deprecated": false,
74205
74075
  "deprecationMessage": "",
74206
74076
  "rawdescription": "\n\nInitializes event subscriptions for toggle button.\n",
@@ -74213,7 +74083,7 @@
74213
74083
  "optional": false,
74214
74084
  "returnType": "void",
74215
74085
  "typeParameters": [],
74216
- "line": 84,
74086
+ "line": 91,
74217
74087
  "deprecated": false,
74218
74088
  "deprecationMessage": "",
74219
74089
  "rawdescription": "\n\nRecalculates popover position when the window is resized.\n",
@@ -74226,7 +74096,7 @@
74226
74096
  "optional": false,
74227
74097
  "returnType": "void",
74228
74098
  "typeParameters": [],
74229
- "line": 116,
74099
+ "line": 127,
74230
74100
  "deprecated": false,
74231
74101
  "deprecationMessage": "",
74232
74102
  "rawdescription": "\n\nLifecycle hook that cleans up subscriptions on destroy.\n",
@@ -74239,20 +74109,11 @@
74239
74109
  "optional": false,
74240
74110
  "returnType": "void",
74241
74111
  "typeParameters": [],
74242
- "line": 134,
74112
+ "line": 144,
74243
74113
  "deprecated": false,
74244
74114
  "deprecationMessage": "",
74245
74115
  "rawdescription": "\n\nHandler triggered when a click outside the popover is detected.\nCloses the popover if it is open.\n",
74246
- "description": "<p>Handler triggered when a click outside the popover is detected.\nCloses the popover if it is open.</p>\n",
74247
- "decorators": [
74248
- {
74249
- "name": "HostListener",
74250
- "stringifiedArguments": "'eclClickOutside'"
74251
- }
74252
- ],
74253
- "modifierKind": [
74254
- 171
74255
- ]
74116
+ "description": "<p>Handler triggered when a click outside the popover is detected.\nCloses the popover if it is open.</p>\n"
74256
74117
  },
74257
74118
  {
74258
74119
  "name": "onDocumentScroll",
@@ -74261,20 +74122,11 @@
74261
74122
  "optional": false,
74262
74123
  "returnType": "void",
74263
74124
  "typeParameters": [],
74264
- "line": 152,
74125
+ "line": 160,
74265
74126
  "deprecated": false,
74266
74127
  "deprecationMessage": "",
74267
74128
  "rawdescription": "\n\nRecalculates popover position when the document is scrolled.\n",
74268
- "description": "<p>Recalculates popover position when the document is scrolled.</p>\n",
74269
- "decorators": [
74270
- {
74271
- "name": "HostListener",
74272
- "stringifiedArguments": "'document:scroll'"
74273
- }
74274
- ],
74275
- "modifierKind": [
74276
- 171
74277
- ]
74129
+ "description": "<p>Recalculates popover position when the document is scrolled.</p>\n"
74278
74130
  },
74279
74131
  {
74280
74132
  "name": "onEscapeKeydownHandler",
@@ -74283,20 +74135,11 @@
74283
74135
  "optional": false,
74284
74136
  "returnType": "void",
74285
74137
  "typeParameters": [],
74286
- "line": 144,
74138
+ "line": 153,
74287
74139
  "deprecated": false,
74288
74140
  "deprecationMessage": "",
74289
74141
  "rawdescription": "\n\nCloses the popover when the Escape key is pressed.\n",
74290
- "description": "<p>Closes the popover when the Escape key is pressed.</p>\n",
74291
- "decorators": [
74292
- {
74293
- "name": "HostListener",
74294
- "stringifiedArguments": "'document:keydown.escape'"
74295
- }
74296
- ],
74297
- "modifierKind": [
74298
- 171
74299
- ]
74142
+ "description": "<p>Closes the popover when the Escape key is pressed.</p>\n"
74300
74143
  },
74301
74144
  {
74302
74145
  "name": "getCssClasses",
@@ -74340,55 +74183,8 @@
74340
74183
  "coverageIgnore": false,
74341
74184
  "deprecated": false,
74342
74185
  "deprecationMessage": "",
74343
- "hostBindings": [
74344
- {
74345
- "coverageIgnore": false,
74346
- "name": "class",
74347
- "actualName": "cssClasses",
74348
- "deprecated": false,
74349
- "deprecationMessage": "",
74350
- "rawdescription": "\n",
74351
- "description": "",
74352
- "line": 73,
74353
- "type": "string",
74354
- "decorators": []
74355
- }
74356
- ],
74357
- "hostListeners": [
74358
- {
74359
- "coverageIgnore": false,
74360
- "name": "document:keydown.escape",
74361
- "args": [],
74362
- "argsDecorator": [],
74363
- "deprecated": false,
74364
- "deprecationMessage": "",
74365
- "rawdescription": "\n\nCloses the popover when the Escape key is pressed.\n",
74366
- "description": "<p>Closes the popover when the Escape key is pressed.</p>\n",
74367
- "line": 144
74368
- },
74369
- {
74370
- "coverageIgnore": false,
74371
- "name": "document:scroll",
74372
- "args": [],
74373
- "argsDecorator": [],
74374
- "deprecated": false,
74375
- "deprecationMessage": "",
74376
- "rawdescription": "\n\nRecalculates popover position when the document is scrolled.\n",
74377
- "description": "<p>Recalculates popover position when the document is scrolled.</p>\n",
74378
- "line": 152
74379
- },
74380
- {
74381
- "coverageIgnore": false,
74382
- "name": "eclClickOutside",
74383
- "args": [],
74384
- "argsDecorator": [],
74385
- "deprecated": false,
74386
- "deprecationMessage": "",
74387
- "rawdescription": "\n\nHandler triggered when a click outside the popover is detected.\nCloses the popover if it is open.\n",
74388
- "description": "<p>Handler triggered when a click outside the popover is detected.\nCloses the popover if it is open.</p>\n",
74389
- "line": 134
74390
- }
74391
- ],
74186
+ "hostBindings": [],
74187
+ "hostListeners": [],
74392
74188
  "standalone": false,
74393
74189
  "imports": [
74394
74190
  {
@@ -74401,14 +74197,14 @@
74401
74197
  "description": "<p>Component representing an ECL Popover.</p>\n<p>It handles toggling visibility, positioning, and closing behavior of the popover.</p>\n",
74402
74198
  "rawdescription": "\n\nComponent representing an ECL Popover.\n\nIt handles toggling visibility, positioning, and closing behavior of the popover.\n",
74403
74199
  "type": "component",
74404
- "sourceCode": "import { AfterContentInit, AfterViewInit, Component, DOCUMENT, ElementRef, HostBinding, HostListener, OnDestroy, PLATFORM_ID, Renderer2, inject, output, viewChild, contentChild } from '@angular/core';\nimport { auditTime, fromEvent, Subject, takeUntil } from 'rxjs';\nimport { ECLClickOutsideDirective } from '@eui/ecl/core';\nimport { ECLBaseDirective } from '@eui/ecl/core';\nimport { EclPopoverToggleDirective } from './ecl-popover-toggle.directive';\nimport { EUI_ECL_BUTTON } from '@eui/ecl/components/ecl-button';\nimport { EUI_ECL_ICON } from '@eui/ecl/components/ecl-icon';\nimport { isPlatformBrowser } from '@angular/common';\n\n/**\n * Component representing an ECL Popover.\n *\n * It handles toggling visibility, positioning, and closing behavior of the popover.\n */\n@Component({\n selector: 'ecl-popover',\n templateUrl: './ecl-popover.component.html',\n hostDirectives: [\n {\n directive: ECLClickOutsideDirective,\n\n outputs: ['eclClickOutside'],\n },\n ],\n imports: [\n ...EUI_ECL_BUTTON,\n ...EUI_ECL_ICON,\n ],\n})\nexport class EclPopoverComponent extends ECLBaseDirective implements AfterViewInit, AfterContentInit, OnDestroy {\n /**\n * Reference to the popover container element.\n */\n readonly eclPopoverContainerElement = viewChild<ElementRef>('container');\n\n /**\n * Reference to the scrollable content element inside the popover.\n */\n readonly eclPopoverScrollableElement = viewChild<ElementRef>('scrollable');\n\n /**\n * Reference to the toggle element used to open/close the popover.\n */\n readonly eclPopoverToggle = contentChild(EclPopoverToggleDirective);\n\n openEvent = output();\n closeEvent = output();\n\n /**\n * Controls visibility of the popover. `true` means hidden.\n */\n protected isHidden = true;\n\n private destroy$: Subject<boolean> = new Subject<boolean>();\n\n private readonly topClass = 'ecl-popover--top';\n private readonly bottomClass = 'ecl-popover--bottom';\n private readonly leftClass = 'ecl-popover--left';\n private readonly rightClass = 'ecl-popover--right';\n private readonly pushTopClass = 'ecl-popover--push-top';\n private readonly pushBottomClass = 'ecl-popover--push-bottom';\n private readonly pushLeftClass = 'ecl-popover--push-left';\n private readonly pushRightClass = 'ecl-popover--push-right';\n private toggleRect = null;\n private scrollableParent = null;\n private el = inject(ElementRef);\n private renderer = inject(Renderer2);\n private readonly document = inject<Document>(DOCUMENT);\n private readonly window = this.document.defaultView; // Window | null\n private platformId = inject(PLATFORM_ID);\n\n @HostBinding('class')\n get cssClasses(): string {\n return [\n super.getCssClasses('ecl-popover'),\n ]\n .join(' ')\n .trim();\n }\n\n /**\n * Recalculates popover position when the window is resized.\n */\n ngAfterViewInit(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n\n if (this.window) {\n fromEvent(this.window, 'resize').pipe(\n auditTime(50),\n takeUntil(this.destroy$)).subscribe(() => {\n this.checkPosition();\n });\n }\n }\n\n /**\n * Initializes event subscriptions for toggle button.\n */\n ngAfterContentInit(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n this.eclPopoverToggle()?.click.pipe(takeUntil(this.destroy$)).subscribe(() => {\n if (this.isHidden) {\n this.doOpen();\n } else {\n this.doClose();\n }\n this.checkPosition(); // TODO: wrap on a platformBrowser check as it calls window and document\n });\n\n this.scrollableParent = this.getClosestScrollableParent(this.eclPopoverToggle()?.hostElementRef.nativeElement);\n }\n\n /**\n * Lifecycle hook that cleans up subscriptions on destroy.\n */\n ngOnDestroy(): void {\n this.destroy$.next(true);\n this.destroy$.unsubscribe();\n }\n\n /**\n * Returns the value of the `aria-controls` attribute from the toggle element,\n * if available. Used for accessibility linking.\n */\n get popoverToggleAriaControls(): string | null {\n return this.eclPopoverToggle()?.hostElementRef.nativeElement.getAttribute('aria-controls');\n }\n\n /**\n * Handler triggered when a click outside the popover is detected.\n * Closes the popover if it is open.\n */\n @HostListener('eclClickOutside')\n onClickOutsidePopover(): void {\n if (!this.isHidden) {\n this.doClose();\n }\n }\n\n /**\n * Closes the popover when the Escape key is pressed.\n */\n @HostListener('document:keydown.escape')\n onEscapeKeydownHandler(): void {\n this.doClose();\n }\n\n /**\n * Recalculates popover position when the document is scrolled.\n */\n @HostListener('document:scroll')\n onDocumentScroll(): void {\n this.checkPosition();\n }\n\n /**\n * Protected method used to close the popover and reset related styles.\n */\n protected doClose(): void {\n this.isHidden = true;\n this.resetStyles();\n this.closeEvent.emit();\n }\n\n private doOpen(): void {\n this.isHidden = false;\n this.openEvent.emit();\n }\n\n private getClosestScrollableParent(element: HTMLElement): HTMLElement {\n let parent = element.parentElement;\n\n while (parent) {\n const { overflowY, overflowX } = getComputedStyle(parent);\n const isScrollableY =\n (overflowY === 'auto' || overflowY === 'scroll') &&\n parent.scrollHeight > parent.clientHeight;\n const isScrollableX =\n (overflowX === 'auto' || overflowX === 'scroll') &&\n parent.scrollWidth > parent.clientWidth;\n\n if (isScrollableY || isScrollableX) {\n return parent; // Found the closest scrollable parent\n }\n\n parent = parent.parentElement;\n }\n\n return this.document.body;\n }\n\n private calculateAvailableSpace(toggleElement, scrollableParent = null) {\n // Get the bounding rect for the toggle element\n this.toggleRect = toggleElement.getBoundingClientRect();\n\n // If no scrollable parent is provided, use the viewport\n const containerRect = scrollableParent\n ? scrollableParent.getBoundingClientRect()\n : {\n top: 0,\n left: 0,\n right: this.window.innerWidth,\n bottom: this.window.innerHeight,\n };\n const containerWidth = containerRect.right - containerRect.left;\n const containerHeight = containerRect.bottom - containerRect.top;\n // Calculate the space available in the four directions\n const containerBottom = Math.max(\n 0,\n this.window.innerHeight - containerRect.bottom,\n );\n const toggleBottom = Math.max(\n 0,\n this.window.innerHeight - this.toggleRect.bottom,\n );\n const spaceBottom = Math.max(0, toggleBottom - containerBottom);\n\n // Top Space (from toggle's top to container's top)\n const containerTop = Math.max(0, containerRect.top);\n const toggleTop = Math.max(0, this.toggleRect.top);\n const spaceTop = Math.max(0, toggleTop - containerTop);\n\n // Right Space (from toggle's right to container's right)\n const containerRight = Math.max(0, this.window.innerWidth - containerRect.right);\n const toggleRight = Math.max(0, this.window.innerWidth - this.toggleRect.right);\n const spaceRight = Math.max(0, toggleRight - containerRight);\n\n // Left Space (from toggle's left to container's left)\n const containerLeft = Math.max(0, containerRect.left);\n const toggleLeft = Math.max(0, this.toggleRect.left);\n const spaceLeft = Math.max(0, toggleLeft - containerLeft);\n\n return {\n containerWidth,\n containerHeight,\n spaceTop,\n spaceBottom,\n spaceLeft,\n spaceRight,\n };\n }\n\n private checkPosition(): void {\n setTimeout(() => {\n if (!this.isHidden) {\n this.positionPopover();\n }\n });\n }\n\n private positionPopover(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n this.resetStyles();\n\n const { containerWidth, spaceTop, spaceBottom, spaceLeft, spaceRight } =\n this.calculateAvailableSpace(this.eclPopoverToggle().getHostElement(), this.scrollableParent);\n\n // Find the direction with the most available space\n const positioningClass = 'ecl-popover--';\n let direction = '';\n\n if (\n spaceTop > spaceBottom &&\n spaceTop > spaceLeft &&\n spaceTop > spaceRight\n ) {\n direction = 'top';\n } else if (spaceBottom > spaceLeft && spaceBottom > spaceRight) {\n direction = 'bottom';\n } else if (spaceLeft > spaceRight) {\n direction = 'left';\n } else {\n direction = 'right';\n }\n\n this.renderer.addClass(this.el.nativeElement, `${positioningClass}${direction}`);\n\n // Try to use as much of the available width, respecting the max-width set.\n const styles = this.window.getComputedStyle(this.eclPopoverScrollableElement().nativeElement);\n const maxWidth = parseInt(styles.getPropertyValue('max-width'), 10);\n const minWidth = parseInt(styles.getPropertyValue('min-width'), 10);\n const padding = parseInt(styles.getPropertyValue('padding-left'), 10) * 2;\n\n // We consider 90% of the biggest space available\n const horizontalSpace = Math.max(spaceLeft, spaceRight) * 0.9;\n let targetWidth;\n\n // If the available space is larger than maxWidth (plus padding), set to maxWidth\n if (\n maxWidth + padding < horizontalSpace ||\n (direction !== 'left' &&\n direction !== 'right' &&\n containerWidth > maxWidth)\n ) {\n targetWidth = maxWidth;\n }\n // If the available space is smaller than minWidth (plus padding), set to minWidth\n else if (horizontalSpace < minWidth + padding) {\n targetWidth = minWidth;\n }\n // Otherwise, set the width to the available space minus the padding\n else if (direction === 'left' || direction === 'right') {\n targetWidth = horizontalSpace - padding;\n } else {\n targetWidth = (horizontalSpace - padding) * 2;\n }\n\n // Ensure the width does not exceed available space\n this.renderer.setStyle(this.eclPopoverScrollableElement().nativeElement, 'width', `${targetWidth}px`);\n\n this.handlePushClass(direction);\n }\n\n private resetStyles(): void {\n const popoverContainer = this.eclPopoverContainerElement().nativeElement;\n this.renderer.removeClass(this.el.nativeElement, this.topClass);\n this.renderer.removeClass(this.el.nativeElement, this.bottomClass);\n this.renderer.removeClass(this.el.nativeElement, this.leftClass);\n this.renderer.removeClass(this.el.nativeElement, this.rightClass);\n this.renderer.removeClass(this.el.nativeElement, this.pushTopClass);\n this.renderer.removeClass(this.el.nativeElement, this.pushBottomClass);\n this.renderer.removeClass(this.el.nativeElement, this.pushLeftClass);\n this.renderer.removeClass(this.el.nativeElement, this.pushRightClass);\n this.renderer.removeStyle(popoverContainer, '--ecl-popover-position');\n this.renderer.removeStyle(popoverContainer, 'top');\n this.renderer.removeStyle(popoverContainer, 'right');\n this.renderer.removeStyle(popoverContainer, 'left');\n this.renderer.removeStyle(popoverContainer, 'bottom');\n this.renderer.removeStyle(popoverContainer, 'transform');\n this.renderer.removeStyle(this.eclPopoverScrollableElement().nativeElement, 'width');\n }\n\n /**\n * Check whether the popover is going out of its scrollable container and apply the needed repositioning.\n *\n * @param {string} direction\n */\n handlePushClass(direction: string): void {\n requestAnimationFrame(() => {\n const popoverRect = this.eclPopoverContainerElement().nativeElement.getBoundingClientRect();\n const scrollableRect = this.scrollableParent.getBoundingClientRect();\n const containerBottom =\n scrollableRect.bottom > this.window.innerHeight ? 0 : this.window.innerHeight - scrollableRect.bottom;\n const containerTop =\n scrollableRect.top > this.window.innerHeight ? 0 : scrollableRect.top;\n const leftOverflow = scrollableRect.left > popoverRect.left;\n const rightOverflow = scrollableRect.right < popoverRect.right;\n const topOverflow = popoverRect.top < containerTop;\n const bottomOverflow =\n containerBottom > this.window.innerHeight - popoverRect.bottom;\n\n if (direction === 'left' || direction === 'right') {\n const eclPopoverContainerElement = this.eclPopoverContainerElement();\n if (topOverflow) {\n this.renderer.addClass(this.el.nativeElement, this.pushTopClass);\n // Push the popover to the top edge of the container\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'top', `-${Math.round(this.toggleRect.top)}px`);\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'bottom', '');\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'transform', '');\n }\n if (bottomOverflow) {\n this.renderer.addClass(this.el.nativeElement, this.pushBottomClass);\n // Push the popover to the bottom edge of the container\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'bottom', `-${this.window.innerHeight - this.toggleRect.bottom - containerBottom}px`);\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'top', '');\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'transform', '');\n }\n } else {\n const eclPopoverContainerElement = this.eclPopoverContainerElement();\n if (leftOverflow) {\n this.renderer.addClass(this.el.nativeElement, this.pushLeftClass);\n // Push the popover 8px to the left edge of the container\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'left', `-${this.toggleRect.left - scrollableRect.left - 8}px`);\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'right', 'auto');\n }\n if (rightOverflow) {\n this.renderer.addClass(this.el.nativeElement, this.pushRightClass);\n // Push the popover 8px to the right edge of the container\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'right', `-${scrollableRect.right - this.toggleRect.right - 8}px`);\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'left', 'auto');\n }\n }\n\n this.handleArrowPosition(direction);\n });\n }\n\n private handleArrowPosition(direction: string): void {\n const popoverRect = this.eclPopoverContainerElement().nativeElement.getBoundingClientRect();\n\n if (direction === 'left' || direction === 'right') {\n if (this.el.nativeElement.classList.contains(this.pushBottomClass)) {\n this.renderer.setStyle(this.eclPopoverContainerElement().nativeElement, '--ecl-popover-position',\n `${Math.round(this.toggleRect.top - popoverRect.top + this.toggleRect.height / 2)}px`);\n } else if (this.el.nativeElement.classList.contains(this.pushTopClass)) {\n this.renderer.setStyle(this.eclPopoverContainerElement().nativeElement, '--ecl-popover-position',\n `${Math.round(popoverRect.top + this.toggleRect.top + this.toggleRect.height / 2)}px`);\n }\n } else {\n\n if (this.el.nativeElement.classList.contains(this.pushRightClass)) {\n this.renderer.setStyle(this.eclPopoverContainerElement().nativeElement, '--ecl-popover-position',\n `${Math.round(popoverRect.right - (this.toggleRect.right - this.toggleRect.width / 2))}px`);\n } else if (this.el.nativeElement.classList.contains(this.pushLeftClass)) {\n this.renderer.setStyle(this.eclPopoverContainerElement().nativeElement, '--ecl-popover-position',\n `${Math.round(this.toggleRect.left - popoverRect.left + this.toggleRect.width / 2)}px`);\n }\n }\n }\n}\n",
74200
+ "sourceCode": "import { AfterContentInit, AfterViewInit, Component, DOCUMENT, ElementRef, Injector, OnDestroy, PLATFORM_ID, Renderer2, inject, output, runInInjectionContext, viewChild, contentChild } from '@angular/core';\nimport { auditTime, fromEvent, Subject, takeUntil } from 'rxjs';\nimport { ECLClickOutsideDirective } from '@eui/ecl/core';\nimport { ECLBaseDirective } from '@eui/ecl/core';\nimport { EclPopoverToggleDirective } from './ecl-popover-toggle.directive';\nimport { EUI_ECL_BUTTON } from '@eui/ecl/components/ecl-button';\nimport { EUI_ECL_ICON } from '@eui/ecl/components/ecl-icon';\nimport { isPlatformBrowser } from '@angular/common';\nimport { outputToObservable } from '@angular/core/rxjs-interop';\n\n/**\n * Component representing an ECL Popover.\n *\n * It handles toggling visibility, positioning, and closing behavior of the popover.\n */\n@Component({\n selector: 'ecl-popover',\n templateUrl: './ecl-popover.component.html',\n host: {\n '[class]': 'cssClasses',\n '(eclClickOutside)': 'onClickOutsidePopover()',\n '(document:keydown.escape)': 'onEscapeKeydownHandler()',\n '(document:scroll)': 'onDocumentScroll()',\n },\n hostDirectives: [\n {\n directive: ECLClickOutsideDirective,\n\n outputs: ['eclClickOutside'],\n },\n ],\n imports: [\n ...EUI_ECL_BUTTON,\n ...EUI_ECL_ICON,\n ],\n})\nexport class EclPopoverComponent extends ECLBaseDirective implements AfterViewInit, AfterContentInit, OnDestroy {\n /**\n * Reference to the popover container element.\n */\n readonly eclPopoverContainerElement = viewChild<ElementRef>('container');\n\n /**\n * Reference to the scrollable content element inside the popover.\n */\n readonly eclPopoverScrollableElement = viewChild<ElementRef>('scrollable');\n\n /**\n * Reference to the toggle element used to open/close the popover.\n */\n readonly eclPopoverToggle = contentChild(EclPopoverToggleDirective);\n\n openEvent = output();\n closeEvent = output();\n\n /**\n * Controls visibility of the popover. `true` means hidden.\n */\n protected isHidden = true;\n\n private destroy$: Subject<boolean> = new Subject<boolean>();\n\n private readonly topClass = 'ecl-popover--top';\n private readonly bottomClass = 'ecl-popover--bottom';\n private readonly leftClass = 'ecl-popover--left';\n private readonly rightClass = 'ecl-popover--right';\n private readonly pushTopClass = 'ecl-popover--push-top';\n private readonly pushBottomClass = 'ecl-popover--push-bottom';\n private readonly pushLeftClass = 'ecl-popover--push-left';\n private readonly pushRightClass = 'ecl-popover--push-right';\n private toggleRect = null;\n private scrollableParent = null;\n private el = inject(ElementRef);\n private renderer = inject(Renderer2);\n private readonly injector = inject(Injector);\n private readonly document = inject<Document>(DOCUMENT);\n private readonly window = this.document.defaultView; // Window | null\n private platformId = inject(PLATFORM_ID);\n\n get cssClasses(): string {\n return [\n super.getCssClasses('ecl-popover'),\n ]\n .join(' ')\n .trim();\n }\n\n /**\n * Recalculates popover position when the window is resized.\n */\n ngAfterViewInit(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n\n if (this.window) {\n fromEvent(this.window, 'resize').pipe(\n auditTime(50),\n takeUntil(this.destroy$)).subscribe(() => {\n this.checkPosition();\n });\n }\n }\n\n /**\n * Initializes event subscriptions for toggle button.\n */\n ngAfterContentInit(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n const toggle = this.eclPopoverToggle();\n if (toggle) {\n runInInjectionContext(this.injector, () => outputToObservable(toggle.click))\n .pipe(takeUntil(this.destroy$)).subscribe(() => {\n if (this.isHidden) {\n this.doOpen();\n } else {\n this.doClose();\n }\n this.checkPosition(); // TODO: wrap on a platformBrowser check as it calls window and document\n });\n }\n\n this.scrollableParent = this.getClosestScrollableParent(toggle?.hostElementRef.nativeElement);\n }\n\n /**\n * Lifecycle hook that cleans up subscriptions on destroy.\n */\n ngOnDestroy(): void {\n this.destroy$.next(true);\n this.destroy$.unsubscribe();\n }\n\n /**\n * Returns the value of the `aria-controls` attribute from the toggle element,\n * if available. Used for accessibility linking.\n */\n get popoverToggleAriaControls(): string | null {\n return this.eclPopoverToggle()?.hostElementRef.nativeElement.getAttribute('aria-controls');\n }\n\n /**\n * Handler triggered when a click outside the popover is detected.\n * Closes the popover if it is open.\n */\n onClickOutsidePopover(): void {\n if (!this.isHidden) {\n this.doClose();\n }\n }\n\n /**\n * Closes the popover when the Escape key is pressed.\n */\n onEscapeKeydownHandler(): void {\n this.doClose();\n }\n\n /**\n * Recalculates popover position when the document is scrolled.\n */\n onDocumentScroll(): void {\n this.checkPosition();\n }\n\n /**\n * Protected method used to close the popover and reset related styles.\n */\n protected doClose(): void {\n this.isHidden = true;\n this.eclPopoverToggle()?.isExpanded.set(false);\n this.resetStyles();\n this.closeEvent.emit();\n }\n\n private doOpen(): void {\n this.isHidden = false;\n this.eclPopoverToggle()?.isExpanded.set(true);\n this.openEvent.emit();\n }\n\n private getClosestScrollableParent(element: HTMLElement): HTMLElement {\n let parent = element.parentElement;\n\n while (parent) {\n const { overflowY, overflowX } = getComputedStyle(parent);\n const isScrollableY =\n (overflowY === 'auto' || overflowY === 'scroll') &&\n parent.scrollHeight > parent.clientHeight;\n const isScrollableX =\n (overflowX === 'auto' || overflowX === 'scroll') &&\n parent.scrollWidth > parent.clientWidth;\n\n if (isScrollableY || isScrollableX) {\n return parent; // Found the closest scrollable parent\n }\n\n parent = parent.parentElement;\n }\n\n return this.document.body;\n }\n\n private calculateAvailableSpace(toggleElement, scrollableParent = null) {\n // Get the bounding rect for the toggle element\n this.toggleRect = toggleElement.getBoundingClientRect();\n\n // If no scrollable parent is provided, use the viewport\n const containerRect = scrollableParent\n ? scrollableParent.getBoundingClientRect()\n : {\n top: 0,\n left: 0,\n right: this.window.innerWidth,\n bottom: this.window.innerHeight,\n };\n const containerWidth = containerRect.right - containerRect.left;\n const containerHeight = containerRect.bottom - containerRect.top;\n // Calculate the space available in the four directions\n const containerBottom = Math.max(\n 0,\n this.window.innerHeight - containerRect.bottom,\n );\n const toggleBottom = Math.max(\n 0,\n this.window.innerHeight - this.toggleRect.bottom,\n );\n const spaceBottom = Math.max(0, toggleBottom - containerBottom);\n\n // Top Space (from toggle's top to container's top)\n const containerTop = Math.max(0, containerRect.top);\n const toggleTop = Math.max(0, this.toggleRect.top);\n const spaceTop = Math.max(0, toggleTop - containerTop);\n\n // Right Space (from toggle's right to container's right)\n const containerRight = Math.max(0, this.window.innerWidth - containerRect.right);\n const toggleRight = Math.max(0, this.window.innerWidth - this.toggleRect.right);\n const spaceRight = Math.max(0, toggleRight - containerRight);\n\n // Left Space (from toggle's left to container's left)\n const containerLeft = Math.max(0, containerRect.left);\n const toggleLeft = Math.max(0, this.toggleRect.left);\n const spaceLeft = Math.max(0, toggleLeft - containerLeft);\n\n return {\n containerWidth,\n containerHeight,\n spaceTop,\n spaceBottom,\n spaceLeft,\n spaceRight,\n };\n }\n\n private checkPosition(): void {\n setTimeout(() => {\n if (!this.isHidden) {\n this.positionPopover();\n }\n });\n }\n\n private positionPopover(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n this.resetStyles();\n\n const { containerWidth, spaceTop, spaceBottom, spaceLeft, spaceRight } =\n this.calculateAvailableSpace(this.eclPopoverToggle().getHostElement(), this.scrollableParent);\n\n // Find the direction with the most available space\n const positioningClass = 'ecl-popover--';\n let direction = '';\n\n if (\n spaceTop > spaceBottom &&\n spaceTop > spaceLeft &&\n spaceTop > spaceRight\n ) {\n direction = 'top';\n } else if (spaceBottom > spaceLeft && spaceBottom > spaceRight) {\n direction = 'bottom';\n } else if (spaceLeft > spaceRight) {\n direction = 'left';\n } else {\n direction = 'right';\n }\n\n this.renderer.addClass(this.el.nativeElement, `${positioningClass}${direction}`);\n\n // Try to use as much of the available width, respecting the max-width set.\n const styles = this.window.getComputedStyle(this.eclPopoverScrollableElement().nativeElement);\n const maxWidth = parseInt(styles.getPropertyValue('max-width'), 10);\n const minWidth = parseInt(styles.getPropertyValue('min-width'), 10);\n const padding = parseInt(styles.getPropertyValue('padding-left'), 10) * 2;\n\n // We consider 90% of the biggest space available\n const horizontalSpace = Math.max(spaceLeft, spaceRight) * 0.9;\n let targetWidth;\n\n // If the available space is larger than maxWidth (plus padding), set to maxWidth\n if (\n maxWidth + padding < horizontalSpace ||\n (direction !== 'left' &&\n direction !== 'right' &&\n containerWidth > maxWidth)\n ) {\n targetWidth = maxWidth;\n }\n // If the available space is smaller than minWidth (plus padding), set to minWidth\n else if (horizontalSpace < minWidth + padding) {\n targetWidth = minWidth;\n }\n // Otherwise, set the width to the available space minus the padding\n else if (direction === 'left' || direction === 'right') {\n targetWidth = horizontalSpace - padding;\n } else {\n targetWidth = (horizontalSpace - padding) * 2;\n }\n\n // Ensure the width does not exceed available space\n this.renderer.setStyle(this.eclPopoverScrollableElement().nativeElement, 'width', `${targetWidth}px`);\n\n this.handlePushClass(direction);\n }\n\n private resetStyles(): void {\n const popoverContainer = this.eclPopoverContainerElement().nativeElement;\n this.renderer.removeClass(this.el.nativeElement, this.topClass);\n this.renderer.removeClass(this.el.nativeElement, this.bottomClass);\n this.renderer.removeClass(this.el.nativeElement, this.leftClass);\n this.renderer.removeClass(this.el.nativeElement, this.rightClass);\n this.renderer.removeClass(this.el.nativeElement, this.pushTopClass);\n this.renderer.removeClass(this.el.nativeElement, this.pushBottomClass);\n this.renderer.removeClass(this.el.nativeElement, this.pushLeftClass);\n this.renderer.removeClass(this.el.nativeElement, this.pushRightClass);\n this.renderer.removeStyle(popoverContainer, '--ecl-popover-position');\n this.renderer.removeStyle(popoverContainer, 'top');\n this.renderer.removeStyle(popoverContainer, 'right');\n this.renderer.removeStyle(popoverContainer, 'left');\n this.renderer.removeStyle(popoverContainer, 'bottom');\n this.renderer.removeStyle(popoverContainer, 'transform');\n this.renderer.removeStyle(this.eclPopoverScrollableElement().nativeElement, 'width');\n }\n\n /**\n * Check whether the popover is going out of its scrollable container and apply the needed repositioning.\n *\n * @param {string} direction\n */\n handlePushClass(direction: string): void {\n requestAnimationFrame(() => {\n const popoverRect = this.eclPopoverContainerElement().nativeElement.getBoundingClientRect();\n const scrollableRect = this.scrollableParent.getBoundingClientRect();\n const containerBottom =\n scrollableRect.bottom > this.window.innerHeight ? 0 : this.window.innerHeight - scrollableRect.bottom;\n const containerTop =\n scrollableRect.top > this.window.innerHeight ? 0 : scrollableRect.top;\n const leftOverflow = scrollableRect.left > popoverRect.left;\n const rightOverflow = scrollableRect.right < popoverRect.right;\n const topOverflow = popoverRect.top < containerTop;\n const bottomOverflow =\n containerBottom > this.window.innerHeight - popoverRect.bottom;\n\n if (direction === 'left' || direction === 'right') {\n const eclPopoverContainerElement = this.eclPopoverContainerElement();\n if (topOverflow) {\n this.renderer.addClass(this.el.nativeElement, this.pushTopClass);\n // Push the popover to the top edge of the container\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'top', `-${Math.round(this.toggleRect.top)}px`);\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'bottom', '');\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'transform', '');\n }\n if (bottomOverflow) {\n this.renderer.addClass(this.el.nativeElement, this.pushBottomClass);\n // Push the popover to the bottom edge of the container\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'bottom', `-${this.window.innerHeight - this.toggleRect.bottom - containerBottom}px`);\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'top', '');\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'transform', '');\n }\n } else {\n const eclPopoverContainerElement = this.eclPopoverContainerElement();\n if (leftOverflow) {\n this.renderer.addClass(this.el.nativeElement, this.pushLeftClass);\n // Push the popover 8px to the left edge of the container\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'left', `-${this.toggleRect.left - scrollableRect.left - 8}px`);\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'right', 'auto');\n }\n if (rightOverflow) {\n this.renderer.addClass(this.el.nativeElement, this.pushRightClass);\n // Push the popover 8px to the right edge of the container\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'right', `-${scrollableRect.right - this.toggleRect.right - 8}px`);\n this.renderer.setStyle(eclPopoverContainerElement.nativeElement, 'left', 'auto');\n }\n }\n\n this.handleArrowPosition(direction);\n });\n }\n\n private handleArrowPosition(direction: string): void {\n const popoverRect = this.eclPopoverContainerElement().nativeElement.getBoundingClientRect();\n\n if (direction === 'left' || direction === 'right') {\n if (this.el.nativeElement.classList.contains(this.pushBottomClass)) {\n this.renderer.setStyle(this.eclPopoverContainerElement().nativeElement, '--ecl-popover-position',\n `${Math.round(this.toggleRect.top - popoverRect.top + this.toggleRect.height / 2)}px`);\n } else if (this.el.nativeElement.classList.contains(this.pushTopClass)) {\n this.renderer.setStyle(this.eclPopoverContainerElement().nativeElement, '--ecl-popover-position',\n `${Math.round(popoverRect.top + this.toggleRect.top + this.toggleRect.height / 2)}px`);\n }\n } else {\n\n if (this.el.nativeElement.classList.contains(this.pushRightClass)) {\n this.renderer.setStyle(this.eclPopoverContainerElement().nativeElement, '--ecl-popover-position',\n `${Math.round(popoverRect.right - (this.toggleRect.right - this.toggleRect.width / 2))}px`);\n } else if (this.el.nativeElement.classList.contains(this.pushLeftClass)) {\n this.renderer.setStyle(this.eclPopoverContainerElement().nativeElement, '--ecl-popover-position',\n `${Math.round(this.toggleRect.left - popoverRect.left + this.toggleRect.width / 2)}px`);\n }\n }\n }\n}\n",
74405
74201
  "assetsDirs": [],
74406
74202
  "styleUrlsData": "",
74407
74203
  "stylesData": "",
74408
74204
  "jsdoctags": [
74409
74205
  {
74410
- "pos": 630,
74411
- "end": 767,
74206
+ "pos": 701,
74207
+ "end": 838,
74412
74208
  "kind": 321,
74413
74209
  "id": 0,
74414
74210
  "flags": 16777216,
@@ -74432,7 +74228,7 @@
74432
74228
  "name": "cssClasses",
74433
74229
  "type": "string",
74434
74230
  "returnType": "string",
74435
- "line": 73,
74231
+ "line": 80,
74436
74232
  "rawdescription": "\n",
74437
74233
  "description": ""
74438
74234
  }
@@ -74443,7 +74239,7 @@
74443
74239
  "name": "popoverToggleAriaControls",
74444
74240
  "type": "unknown",
74445
74241
  "returnType": "string | null",
74446
- "line": 125,
74242
+ "line": 136,
74447
74243
  "rawdescription": "\n\nReturns the value of the `aria-controls` attribute from the toggle element,\nif available. Used for accessibility linking.\n",
74448
74244
  "description": "<p>Returns the value of the <code>aria-controls</code> attribute from the toggle element,\nif available. Used for accessibility linking.</p>\n"
74449
74245
  }