@exhaustive-ui/core 3.0.0-alpha.0 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/exhaustive-ui-core-accordion.mjs +51 -78
- package/fesm2022/exhaustive-ui-core-accordion.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-animateonscroll.mjs +72 -73
- package/fesm2022/exhaustive-ui-core-animateonscroll.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-api.mjs +6 -13
- package/fesm2022/exhaustive-ui-core-api.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-autocomplete.mjs +485 -683
- package/fesm2022/exhaustive-ui-core-autocomplete.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-autofocus.mjs +21 -31
- package/fesm2022/exhaustive-ui-core-autofocus.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-avatar.mjs +47 -63
- package/fesm2022/exhaustive-ui-core-avatar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-badge.mjs +88 -115
- package/fesm2022/exhaustive-ui-core-badge.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-blockui.mjs +58 -91
- package/fesm2022/exhaustive-ui-core-blockui.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-breadcrumb.mjs +155 -169
- package/fesm2022/exhaustive-ui-core-breadcrumb.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-button.mjs +280 -385
- package/fesm2022/exhaustive-ui-core-button.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-carousel.mjs +379 -451
- package/fesm2022/exhaustive-ui-core-carousel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-cascadeselect.mjs +388 -507
- package/fesm2022/exhaustive-ui-core-cascadeselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-chart.mjs +75 -91
- package/fesm2022/exhaustive-ui-core-chart.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-checkbox.mjs +109 -160
- package/fesm2022/exhaustive-ui-core-checkbox.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-chip.mjs +98 -137
- package/fesm2022/exhaustive-ui-core-chip.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-colorpicker.mjs +123 -190
- package/fesm2022/exhaustive-ui-core-colorpicker.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-confirmdialog.mjs +157 -332
- package/fesm2022/exhaustive-ui-core-confirmdialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-confirmpopup.mjs +187 -210
- package/fesm2022/exhaustive-ui-core-confirmpopup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-contextmenu.mjs +315 -361
- package/fesm2022/exhaustive-ui-core-contextmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dataview.mjs +225 -272
- package/fesm2022/exhaustive-ui-core-dataview.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-datepicker.mjs +1012 -1157
- package/fesm2022/exhaustive-ui-core-datepicker.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dialog.mjs +370 -507
- package/fesm2022/exhaustive-ui-core-dialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dock.mjs +87 -115
- package/fesm2022/exhaustive-ui-core-dock.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dragdrop.mjs +98 -105
- package/fesm2022/exhaustive-ui-core-dragdrop.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-drawer.mjs +174 -235
- package/fesm2022/exhaustive-ui-core-drawer.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs +42 -280
- package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-editor.mjs +109 -121
- package/fesm2022/exhaustive-ui-core-editor.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-fieldset.mjs +90 -132
- package/fesm2022/exhaustive-ui-core-fieldset.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-fileupload.mjs +486 -541
- package/fesm2022/exhaustive-ui-core-fileupload.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-floatlabel.mjs +13 -16
- package/fesm2022/exhaustive-ui-core-floatlabel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-focustrap.mjs +44 -40
- package/fesm2022/exhaustive-ui-core-focustrap.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-galleria.mjs +642 -853
- package/fesm2022/exhaustive-ui-core-galleria.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-iconfield.mjs +15 -27
- package/fesm2022/exhaustive-ui-core-iconfield.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-icons-baseicon.mjs +8 -13
- package/fesm2022/exhaustive-ui-core-icons-baseicon.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-image.mjs +209 -251
- package/fesm2022/exhaustive-ui-core-image.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-imagecompare.mjs +39 -48
- package/fesm2022/exhaustive-ui-core-imagecompare.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inplace.mjs +64 -98
- package/fesm2022/exhaustive-ui-core-inplace.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputgroup.mjs +10 -20
- package/fesm2022/exhaustive-ui-core-inputgroup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs +15 -24
- package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputicon.mjs +11 -22
- package/fesm2022/exhaustive-ui-core-inputicon.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputmask.mjs +423 -392
- package/fesm2022/exhaustive-ui-core-inputmask.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputnumber.mjs +397 -469
- package/fesm2022/exhaustive-ui-core-inputnumber.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputotp.mjs +75 -95
- package/fesm2022/exhaustive-ui-core-inputotp.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputtext.mjs +27 -36
- package/fesm2022/exhaustive-ui-core-inputtext.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-keyfilter.mjs +29 -46
- package/fesm2022/exhaustive-ui-core-keyfilter.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-knob.mjs +140 -187
- package/fesm2022/exhaustive-ui-core-knob.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-listbox.mjs +365 -546
- package/fesm2022/exhaustive-ui-core-listbox.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-megamenu.mjs +320 -371
- package/fesm2022/exhaustive-ui-core-megamenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-menu.mjs +298 -348
- package/fesm2022/exhaustive-ui-core-menu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-menubar.mjs +277 -372
- package/fesm2022/exhaustive-ui-core-menubar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-metergroup.mjs +138 -166
- package/fesm2022/exhaustive-ui-core-metergroup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-multiselect.mjs +647 -835
- package/fesm2022/exhaustive-ui-core-multiselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-orderlist.mjs +337 -409
- package/fesm2022/exhaustive-ui-core-orderlist.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-organizationchart.mjs +114 -175
- package/fesm2022/exhaustive-ui-core-organizationchart.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-overlaybadge.mjs +22 -47
- package/fesm2022/exhaustive-ui-core-overlaybadge.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-paginator.mjs +232 -320
- package/fesm2022/exhaustive-ui-core-paginator.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-panel.mjs +114 -174
- package/fesm2022/exhaustive-ui-core-panel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-panelmenu.mjs +171 -282
- package/fesm2022/exhaustive-ui-core-panelmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-password.mjs +317 -377
- package/fesm2022/exhaustive-ui-core-password.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-picklist.mjs +557 -655
- package/fesm2022/exhaustive-ui-core-picklist.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-popover.mjs +154 -181
- package/fesm2022/exhaustive-ui-core-popover.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-rating.mjs +87 -119
- package/fesm2022/exhaustive-ui-core-rating.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scroller.mjs +465 -596
- package/fesm2022/exhaustive-ui-core-scroller.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scrollpanel.mjs +147 -155
- package/fesm2022/exhaustive-ui-core-scrollpanel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scrolltop.mjs +81 -115
- package/fesm2022/exhaustive-ui-core-scrolltop.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-select.mjs +581 -784
- package/fesm2022/exhaustive-ui-core-select.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-selectbutton.mjs +84 -120
- package/fesm2022/exhaustive-ui-core-selectbutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-slider.mjs +322 -352
- package/fesm2022/exhaustive-ui-core-slider.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-speeddial.mjs +209 -268
- package/fesm2022/exhaustive-ui-core-speeddial.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-splitbutton.mjs +153 -249
- package/fesm2022/exhaustive-ui-core-splitbutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-splitter.mjs +221 -237
- package/fesm2022/exhaustive-ui-core-splitter.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-steps.mjs +56 -72
- package/fesm2022/exhaustive-ui-core-steps.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-styleclass.mjs +145 -146
- package/fesm2022/exhaustive-ui-core-styleclass.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-table.mjs +2213 -2543
- package/fesm2022/exhaustive-ui-core-table.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-terminal.mjs +50 -67
- package/fesm2022/exhaustive-ui-core-terminal.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-textarea.mjs +23 -36
- package/fesm2022/exhaustive-ui-core-textarea.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tieredmenu.mjs +318 -394
- package/fesm2022/exhaustive-ui-core-tieredmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-timeline.mjs +56 -74
- package/fesm2022/exhaustive-ui-core-timeline.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-togglebutton.mjs +86 -129
- package/fesm2022/exhaustive-ui-core-togglebutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-toggleswitch.mjs +57 -94
- package/fesm2022/exhaustive-ui-core-toggleswitch.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-toolbar.mjs +36 -55
- package/fesm2022/exhaustive-ui-core-toolbar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tooltip.mjs +264 -343
- package/fesm2022/exhaustive-ui-core-tooltip.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tree.mjs +508 -639
- package/fesm2022/exhaustive-ui-core-tree.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-treeselect.mjs +327 -421
- package/fesm2022/exhaustive-ui-core-treeselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-treetable.mjs +1267 -1473
- package/fesm2022/exhaustive-ui-core-treetable.mjs.map +1 -1
- package/package.json +5 -5
- package/schematics/migrations/remove-dead-inputs/migration.js +213 -7
- package/schematics/migrations/renamed-inputs/migration.js +97 -0
- package/schematics/migrations/styleclass-to-class/migration.js +92 -1
- package/schematics/migrations.json +7 -2
- package/schematics/utils/removed-inputs.js +0 -0
- package/schematics/utils/renamed-inputs.js +175 -0
- package/schematics/utils/styleclass.js +24 -8
- package/schematics/utils/versions.json +8 -8
- package/types/exhaustive-ui-core-accordion.d.ts +8 -24
- package/types/exhaustive-ui-core-animateonscroll.d.ts +19 -21
- package/types/exhaustive-ui-core-api.d.ts +2 -3
- package/types/exhaustive-ui-core-autocomplete.d.ts +103 -176
- package/types/exhaustive-ui-core-autofocus.d.ts +4 -7
- package/types/exhaustive-ui-core-avatar.d.ts +18 -25
- package/types/exhaustive-ui-core-badge.d.ts +13 -27
- package/types/exhaustive-ui-core-blockui.d.ts +18 -30
- package/types/exhaustive-ui-core-breadcrumb.d.ts +21 -22
- package/types/exhaustive-ui-core-button.d.ts +57 -89
- package/types/exhaustive-ui-core-carousel.d.ts +56 -82
- package/types/exhaustive-ui-core-cascadeselect.d.ts +77 -111
- package/types/exhaustive-ui-core-chart.d.ts +21 -29
- package/types/exhaustive-ui-core-checkbox.d.ts +25 -39
- package/types/exhaustive-ui-core-chip.d.ts +31 -38
- package/types/exhaustive-ui-core-colorpicker.d.ts +23 -57
- package/types/exhaustive-ui-core-confirmdialog.d.ts +39 -109
- package/types/exhaustive-ui-core-confirmpopup.d.ts +24 -43
- package/types/exhaustive-ui-core-contextmenu.d.ts +54 -71
- package/types/exhaustive-ui-core-dataview.d.ts +42 -65
- package/types/exhaustive-ui-core-datepicker.d.ts +109 -191
- package/types/exhaustive-ui-core-dialog.d.ts +73 -123
- package/types/exhaustive-ui-core-dock.d.ts +16 -25
- package/types/exhaustive-ui-core-dragdrop.d.ts +32 -36
- package/types/exhaustive-ui-core-drawer.d.ts +32 -64
- package/types/exhaustive-ui-core-dynamicdialog.d.ts +9 -54
- package/types/exhaustive-ui-core-editor.d.ts +15 -25
- package/types/exhaustive-ui-core-fieldset.d.ts +15 -35
- package/types/exhaustive-ui-core-fileupload.d.ts +69 -95
- package/types/exhaustive-ui-core-floatlabel.d.ts +4 -6
- package/types/exhaustive-ui-core-focustrap.d.ts +5 -10
- package/types/exhaustive-ui-core-galleria.d.ts +124 -194
- package/types/exhaustive-ui-core-iconfield.d.ts +5 -13
- package/types/exhaustive-ui-core-icons-baseicon.d.ts +4 -5
- package/types/exhaustive-ui-core-image.d.ts +35 -68
- package/types/exhaustive-ui-core-imagecompare.d.ts +19 -20
- package/types/exhaustive-ui-core-inplace.d.ts +30 -42
- package/types/exhaustive-ui-core-inputgroup.d.ts +2 -9
- package/types/exhaustive-ui-core-inputgroupaddon.d.ts +6 -10
- package/types/exhaustive-ui-core-inputicon.d.ts +4 -11
- package/types/exhaustive-ui-core-inputmask.d.ts +53 -66
- package/types/exhaustive-ui-core-inputnumber.d.ts +62 -84
- package/types/exhaustive-ui-core-inputotp.d.ts +16 -20
- package/types/exhaustive-ui-core-inputtext.d.ts +5 -8
- package/types/exhaustive-ui-core-keyfilter.d.ts +11 -15
- package/types/exhaustive-ui-core-knob.d.ts +45 -60
- package/types/exhaustive-ui-core-listbox.d.ts +90 -126
- package/types/exhaustive-ui-core-megamenu.d.ts +45 -66
- package/types/exhaustive-ui-core-menu.d.ts +33 -53
- package/types/exhaustive-ui-core-menubar.d.ts +38 -85
- package/types/exhaustive-ui-core-metergroup.d.ts +39 -48
- package/types/exhaustive-ui-core-multiselect.d.ts +166 -219
- package/types/exhaustive-ui-core-orderlist.d.ts +58 -81
- package/types/exhaustive-ui-core-organizationchart.d.ts +32 -67
- package/types/exhaustive-ui-core-overlaybadge.d.ts +10 -20
- package/types/exhaustive-ui-core-paginator.d.ts +41 -69
- package/types/exhaustive-ui-core-panel.d.ts +18 -45
- package/types/exhaustive-ui-core-panelmenu.d.ts +31 -76
- package/types/exhaustive-ui-core-password.d.ts +56 -93
- package/types/exhaustive-ui-core-picklist.d.ts +107 -121
- package/types/exhaustive-ui-core-popover.d.ts +23 -47
- package/types/exhaustive-ui-core-rating.d.ts +18 -26
- package/types/exhaustive-ui-core-scroller.d.ts +90 -120
- package/types/exhaustive-ui-core-scrollpanel.d.ts +35 -46
- package/types/exhaustive-ui-core-scrolltop.d.ts +28 -45
- package/types/exhaustive-ui-core-select.d.ts +137 -188
- package/types/exhaustive-ui-core-selectbutton.d.ts +35 -44
- package/types/exhaustive-ui-core-slider.d.ts +52 -67
- package/types/exhaustive-ui-core-speeddial.d.ts +40 -56
- package/types/exhaustive-ui-core-splitbutton.d.ts +31 -71
- package/types/exhaustive-ui-core-splitter.d.ts +47 -59
- package/types/exhaustive-ui-core-steps.d.ts +24 -31
- package/types/exhaustive-ui-core-styleclass.d.ts +27 -33
- package/types/exhaustive-ui-core-table.d.ts +349 -453
- package/types/exhaustive-ui-core-terminal.d.ts +10 -22
- package/types/exhaustive-ui-core-textarea.d.ts +7 -10
- package/types/exhaustive-ui-core-tieredmenu.d.ts +49 -84
- package/types/exhaustive-ui-core-timeline.d.ts +20 -28
- package/types/exhaustive-ui-core-togglebutton.d.ts +32 -48
- package/types/exhaustive-ui-core-toggleswitch.d.ts +26 -37
- package/types/exhaustive-ui-core-toolbar.d.ts +17 -25
- package/types/exhaustive-ui-core-tooltip.d.ts +53 -88
- package/types/exhaustive-ui-core-tree.d.ts +82 -119
- package/types/exhaustive-ui-core-treeselect.d.ts +63 -92
- package/types/exhaustive-ui-core-treetable.d.ts +203 -280
- package/types/exhaustive-ui-core-types-chip.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { input, booleanAttribute, signal, effect, untracked, Directive, NgModule } from '@angular/core';
|
|
4
4
|
import { createElement, getFirstFocusableElement, focus, getLastFocusableElement } from '@exhaustive-ui/utils';
|
|
5
5
|
import { BaseComponent } from '@exhaustive-ui/core/basecomponent';
|
|
6
6
|
|
|
@@ -13,32 +13,36 @@ class FocusTrap extends BaseComponent {
|
|
|
13
13
|
* When set as true, focus wouldn't be managed.
|
|
14
14
|
* @group Props
|
|
15
15
|
*/
|
|
16
|
-
pFocusTrapDisabled = false;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
lastHiddenFocusableElement;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
onChanges(changes) {
|
|
27
|
-
if (changes.pFocusTrapDisabled && isPlatformBrowser(this.platformId)) {
|
|
28
|
-
if (changes.pFocusTrapDisabled.currentValue) {
|
|
29
|
-
this.removeHiddenFocusableElements();
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
this.createHiddenFocusableElements();
|
|
16
|
+
pFocusTrapDisabled = input(false, { ...(ngDevMode ? { debugName: "pFocusTrapDisabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
17
|
+
firstHiddenFocusableElement = signal(undefined, /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "firstHiddenFocusableElement" }] : /* istanbul ignore next */ []));
|
|
19
|
+
lastHiddenFocusableElement = signal(undefined, /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "lastHiddenFocusableElement" }] : /* istanbul ignore next */ []));
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
effect(() => {
|
|
24
|
+
if (!isPlatformBrowser(this.platformId)) {
|
|
25
|
+
return;
|
|
33
26
|
}
|
|
34
|
-
|
|
27
|
+
const disabled = this.pFocusTrapDisabled();
|
|
28
|
+
untracked(() => {
|
|
29
|
+
if (disabled) {
|
|
30
|
+
this.removeHiddenFocusableElements();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.createHiddenFocusableElements();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
35
37
|
}
|
|
36
38
|
removeHiddenFocusableElements() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
const firstHiddenFocusableElement = this.firstHiddenFocusableElement();
|
|
40
|
+
const lastHiddenFocusableElement = this.lastHiddenFocusableElement();
|
|
41
|
+
if (firstHiddenFocusableElement && firstHiddenFocusableElement.parentNode) {
|
|
42
|
+
firstHiddenFocusableElement.parentNode.removeChild(firstHiddenFocusableElement);
|
|
39
43
|
}
|
|
40
|
-
if (
|
|
41
|
-
|
|
44
|
+
if (lastHiddenFocusableElement && lastHiddenFocusableElement.parentNode) {
|
|
45
|
+
lastHiddenFocusableElement.parentNode.removeChild(lastHiddenFocusableElement);
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
getComputedSelector(selector) {
|
|
@@ -57,36 +61,36 @@ class FocusTrap extends BaseComponent {
|
|
|
57
61
|
onFocus: onFocus?.bind(this)
|
|
58
62
|
});
|
|
59
63
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.el.nativeElement.prepend(
|
|
65
|
-
this.el.nativeElement.append(
|
|
64
|
+
const firstHiddenFocusableElement = createFocusableElement(this.onFirstHiddenElementFocus);
|
|
65
|
+
const lastHiddenFocusableElement = createFocusableElement(this.onLastHiddenElementFocus);
|
|
66
|
+
firstHiddenFocusableElement.setAttribute('data-pc-section', 'firstfocusableelement');
|
|
67
|
+
lastHiddenFocusableElement.setAttribute('data-pc-section', 'lastfocusableelement');
|
|
68
|
+
this.el.nativeElement.prepend(firstHiddenFocusableElement);
|
|
69
|
+
this.el.nativeElement.append(lastHiddenFocusableElement);
|
|
70
|
+
this.firstHiddenFocusableElement.set(firstHiddenFocusableElement);
|
|
71
|
+
this.lastHiddenFocusableElement.set(lastHiddenFocusableElement);
|
|
66
72
|
}
|
|
67
73
|
onFirstHiddenElementFocus(event) {
|
|
68
74
|
const { currentTarget, relatedTarget } = event;
|
|
69
|
-
const
|
|
75
|
+
const lastHiddenFocusableElement = this.lastHiddenFocusableElement();
|
|
76
|
+
const focusableElement = relatedTarget === lastHiddenFocusableElement || !this.el.nativeElement?.contains(relatedTarget) ? getFirstFocusableElement(currentTarget.parentElement, ':not(.p-hidden-focusable)') : lastHiddenFocusableElement;
|
|
70
77
|
focus(focusableElement);
|
|
71
78
|
}
|
|
72
79
|
onLastHiddenElementFocus(event) {
|
|
73
80
|
const { currentTarget, relatedTarget } = event;
|
|
74
|
-
const
|
|
81
|
+
const firstHiddenFocusableElement = this.firstHiddenFocusableElement();
|
|
82
|
+
const focusableElement = relatedTarget === firstHiddenFocusableElement || !this.el.nativeElement?.contains(relatedTarget) ? getLastFocusableElement(currentTarget.parentElement, ':not(.p-hidden-focusable)') : firstHiddenFocusableElement;
|
|
75
83
|
focus(focusableElement);
|
|
76
84
|
}
|
|
77
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FocusTrap, deps:
|
|
78
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
85
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FocusTrap, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
86
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: FocusTrap, isStandalone: true, selector: "[pFocusTrap]", inputs: { pFocusTrapDisabled: { classPropertyName: "pFocusTrapDisabled", publicName: "pFocusTrapDisabled", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
|
|
79
87
|
}
|
|
80
88
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FocusTrap, decorators: [{
|
|
81
89
|
type: Directive,
|
|
82
90
|
args: [{
|
|
83
|
-
selector: '[pFocusTrap]'
|
|
84
|
-
standalone: true
|
|
91
|
+
selector: '[pFocusTrap]'
|
|
85
92
|
}]
|
|
86
|
-
}], propDecorators: { pFocusTrapDisabled: [{
|
|
87
|
-
type: Input,
|
|
88
|
-
args: [{ transform: booleanAttribute }]
|
|
89
|
-
}] } });
|
|
93
|
+
}], ctorParameters: () => [], propDecorators: { pFocusTrapDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "pFocusTrapDisabled", required: false }] }] } });
|
|
90
94
|
class FocusTrapModule {
|
|
91
95
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FocusTrapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
92
96
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.2.1", ngImport: i0, type: FocusTrapModule, imports: [FocusTrap], exports: [FocusTrap] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exhaustive-ui-core-focustrap.mjs","sources":["../../src/focustrap/focustrap.ts","../../src/focustrap/exhaustive-ui-core-focustrap.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"exhaustive-ui-core-focustrap.mjs","sources":["../../src/focustrap/focustrap.ts","../../src/focustrap/exhaustive-ui-core-focustrap.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport { booleanAttribute, Directive, effect, input, NgModule, signal, untracked } from '@angular/core';\nimport { createElement, focus, getFirstFocusableElement, getLastFocusableElement } from '@exhaustive-ui/utils';\nimport { BaseComponent } from '@exhaustive-ui/core/basecomponent';\n\n/**\n * Focus Trap keeps focus within a certain DOM element while tabbing.\n * @group Components\n */\n@Directive({\n selector: '[pFocusTrap]'\n})\nexport class FocusTrap extends BaseComponent {\n /**\n * When set as true, focus wouldn't be managed.\n * @group Props\n */\n readonly pFocusTrapDisabled = input(false, { transform: booleanAttribute });\n\n firstHiddenFocusableElement = signal<HTMLElement | undefined>(undefined);\n\n lastHiddenFocusableElement = signal<HTMLElement | undefined>(undefined);\n\n constructor() {\n super();\n effect(() => {\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n const disabled = this.pFocusTrapDisabled();\n\n untracked(() => {\n if (disabled) {\n this.removeHiddenFocusableElements();\n } else {\n this.createHiddenFocusableElements();\n }\n });\n });\n }\n\n removeHiddenFocusableElements() {\n const firstHiddenFocusableElement = this.firstHiddenFocusableElement();\n const lastHiddenFocusableElement = this.lastHiddenFocusableElement();\n\n if (firstHiddenFocusableElement && firstHiddenFocusableElement.parentNode) {\n firstHiddenFocusableElement.parentNode.removeChild(firstHiddenFocusableElement);\n }\n\n if (lastHiddenFocusableElement && lastHiddenFocusableElement.parentNode) {\n lastHiddenFocusableElement.parentNode.removeChild(lastHiddenFocusableElement);\n }\n }\n getComputedSelector(selector) {\n return `:not(.p-hidden-focusable):not([data-p-hidden-focusable=\"true\"])${selector ?? ''}`;\n }\n\n createHiddenFocusableElements() {\n const tabindex = '0';\n\n const createFocusableElement = (onFocus) => {\n return createElement('span', {\n class: 'p-hidden-accessible p-hidden-focusable',\n tabindex,\n role: 'presentation',\n 'aria-hidden': true,\n 'data-p-hidden-accessible': true,\n 'data-p-hidden-focusable': true,\n onFocus: onFocus?.bind(this)\n }) as HTMLElement;\n };\n\n const firstHiddenFocusableElement = createFocusableElement(this.onFirstHiddenElementFocus);\n const lastHiddenFocusableElement = createFocusableElement(this.onLastHiddenElementFocus);\n\n firstHiddenFocusableElement.setAttribute('data-pc-section', 'firstfocusableelement');\n lastHiddenFocusableElement.setAttribute('data-pc-section', 'lastfocusableelement');\n\n this.el.nativeElement.prepend(firstHiddenFocusableElement);\n this.el.nativeElement.append(lastHiddenFocusableElement);\n\n this.firstHiddenFocusableElement.set(firstHiddenFocusableElement);\n this.lastHiddenFocusableElement.set(lastHiddenFocusableElement);\n }\n\n onFirstHiddenElementFocus(event) {\n const { currentTarget, relatedTarget } = event;\n const lastHiddenFocusableElement = this.lastHiddenFocusableElement();\n const focusableElement = relatedTarget === lastHiddenFocusableElement || !this.el.nativeElement?.contains(relatedTarget) ? getFirstFocusableElement(currentTarget.parentElement, ':not(.p-hidden-focusable)') : lastHiddenFocusableElement;\n\n focus(focusableElement as any);\n }\n\n onLastHiddenElementFocus(event) {\n const { currentTarget, relatedTarget } = event;\n const firstHiddenFocusableElement = this.firstHiddenFocusableElement();\n const focusableElement = relatedTarget === firstHiddenFocusableElement || !this.el.nativeElement?.contains(relatedTarget) ? getLastFocusableElement(currentTarget.parentElement, ':not(.p-hidden-focusable)') : firstHiddenFocusableElement;\n\n focus(focusableElement as any);\n }\n}\n\n@NgModule({\n imports: [FocusTrap],\n exports: [FocusTrap]\n})\nexport class FocusTrapModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAKA;;;AAGG;AAIG,MAAO,SAAU,SAAQ,aAAa,CAAA;AACxC;;;AAGG;IACM,kBAAkB,GAAG,KAAK,CAAC,KAAK,0FAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAE3E,2BAA2B,GAAG,MAAM,CAA0B,SAAS;oGAAC;IAExE,0BAA0B,GAAG,MAAM,CAA0B,SAAS;mGAAC;AAEvE,IAAA,WAAA,GAAA;AACI,QAAA,KAAK,EAAE;QACP,MAAM,CAAC,MAAK;YACR,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBACrC;YACJ;AAEA,YAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,EAAE;YAE1C,SAAS,CAAC,MAAK;gBACX,IAAI,QAAQ,EAAE;oBACV,IAAI,CAAC,6BAA6B,EAAE;gBACxC;qBAAO;oBACH,IAAI,CAAC,6BAA6B,EAAE;gBACxC;AACJ,YAAA,CAAC,CAAC;AACN,QAAA,CAAC,CAAC;IACN;IAEA,6BAA6B,GAAA;AACzB,QAAA,MAAM,2BAA2B,GAAG,IAAI,CAAC,2BAA2B,EAAE;AACtE,QAAA,MAAM,0BAA0B,GAAG,IAAI,CAAC,0BAA0B,EAAE;AAEpE,QAAA,IAAI,2BAA2B,IAAI,2BAA2B,CAAC,UAAU,EAAE;AACvE,YAAA,2BAA2B,CAAC,UAAU,CAAC,WAAW,CAAC,2BAA2B,CAAC;QACnF;AAEA,QAAA,IAAI,0BAA0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