@agnos-ui/core 0.9.3 → 0.10.0-next.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 (113) hide show
  1. package/{accordion-cR5JqWJ8.cjs → accordion-B5LiN1uy.cjs} +15 -20
  2. package/{accordion-CoM4efp-.js → accordion-_zen-g8l.js} +15 -20
  3. package/{alert-DtDozJal.cjs → alert-B-jQDQcB.cjs} +1 -1
  4. package/{alert-YIlqdEPO.js → alert-gGz2CDS9.js} +1 -1
  5. package/{collapse-DwXz2kNw.js → collapse-BV4kD3j9.js} +2 -2
  6. package/{collapse-DRp53EuG.cjs → collapse-gLiT080Y.cjs} +2 -2
  7. package/{common-BToNPUDq.cjs → common-D3QcdJ6S.cjs} +1 -1
  8. package/{common-BqUjUBPy.js → common-DK0ADNTX.js} +1 -1
  9. package/components/accordion/accordion.d.ts +6 -6
  10. package/components/accordion/index.cjs +1 -1
  11. package/components/accordion/index.js +1 -1
  12. package/components/alert/index.cjs +1 -1
  13. package/components/alert/index.js +1 -1
  14. package/components/carousel/carousel.d.ts +15 -0
  15. package/components/carousel/index.cjs +10 -23
  16. package/components/carousel/index.js +10 -23
  17. package/components/collapse/collapse.d.ts +5 -2
  18. package/components/collapse/index.cjs +1 -1
  19. package/components/collapse/index.js +1 -1
  20. package/components/drawer/drawer.d.ts +242 -0
  21. package/components/drawer/index.cjs +5 -0
  22. package/components/drawer/index.d.ts +1 -0
  23. package/components/drawer/index.js +5 -0
  24. package/components/modal/index.cjs +2 -1
  25. package/components/modal/index.js +2 -1
  26. package/components/modal/modal.d.ts +5 -0
  27. package/components/pagination/index.cjs +1 -1
  28. package/components/pagination/index.js +1 -1
  29. package/components/progressbar/index.cjs +1 -1
  30. package/components/progressbar/index.js +1 -1
  31. package/components/rating/index.cjs +1 -1
  32. package/components/rating/index.js +1 -1
  33. package/components/select/index.cjs +1 -1
  34. package/components/select/index.js +1 -1
  35. package/components/slider/index.cjs +1 -1
  36. package/components/slider/index.js +1 -1
  37. package/components/slider/slider.d.ts +4 -4
  38. package/components/toast/index.cjs +1 -1
  39. package/components/toast/index.js +1 -1
  40. package/components/tree/index.cjs +1 -1
  41. package/components/tree/index.js +1 -1
  42. package/components/tree/tree.d.ts +0 -6
  43. package/config.cjs +2 -2
  44. package/config.d.ts +5 -0
  45. package/config.js +2 -2
  46. package/{dom-gfxqXJpK.js → dom-Bcg9ORcA.js} +64 -54
  47. package/{dom-CuBx1JPZ.cjs → dom-C2gi9OCP.cjs} +47 -37
  48. package/drawer-D5SO73ew.js +251 -0
  49. package/drawer-DP7UPojk.cjs +250 -0
  50. package/index.cjs +19 -13
  51. package/index.d.ts +1 -0
  52. package/index.js +36 -30
  53. package/isFocusable-Ckwus82R.js +32 -0
  54. package/isFocusable-DfzDLeAN.cjs +31 -0
  55. package/{modal-D3wGIDlj.js → modal-CAvQW-vo.js} +26 -32
  56. package/{modal-BEnQ6c5M.cjs → modal-DiXZXYjR.cjs} +27 -33
  57. package/package.json +1 -1
  58. package/{pagination-B97wBLok.js → pagination-BKbMROV6.js} +4 -4
  59. package/{pagination-C1TT-oea.cjs → pagination-DvZ2rLsz.cjs} +4 -4
  60. package/{progressbar-BWBlRk_Y.js → progressbar-D8zIcm9n.js} +2 -2
  61. package/{progressbar-CRvhNB5R.cjs → progressbar-i9xfAxb7.cjs} +2 -2
  62. package/{promise-XSP94FjG.js → promise-Y53vc4Ia.js} +5 -5
  63. package/{rating-BXvy9kXq.js → rating-DEXTGWCU.js} +2 -2
  64. package/{rating-DAb6nR67.cjs → rating-DmG4oUkr.cjs} +2 -2
  65. package/scrollbars-CT87iv_6.cjs +30 -0
  66. package/scrollbars-CcxSrnCx.js +31 -0
  67. package/{select-BdjpnE7_.js → select-Bw68Xdu5.js} +4 -5
  68. package/{select-C0rJJQfl.cjs → select-MFjAnIt7.cjs} +4 -5
  69. package/services/extendWidget.cjs +2 -2
  70. package/services/extendWidget.js +2 -2
  71. package/services/floatingUI.cjs +8 -29
  72. package/services/floatingUI.js +9 -30
  73. package/services/focusElement.cjs +46 -0
  74. package/services/focusElement.d.ts +9 -0
  75. package/services/focusElement.js +46 -0
  76. package/services/focustrack.cjs +1 -1
  77. package/services/focustrack.js +1 -1
  78. package/services/matchMedia.cjs +1 -1
  79. package/services/matchMedia.js +1 -1
  80. package/services/navManager.cjs +7 -37
  81. package/services/navManager.js +6 -36
  82. package/services/portal.cjs +7 -10
  83. package/services/portal.js +7 -10
  84. package/services/resizeObserver.cjs +2 -2
  85. package/services/resizeObserver.js +2 -2
  86. package/services/siblingsInert.cjs +9 -8
  87. package/services/siblingsInert.d.ts +13 -3
  88. package/services/siblingsInert.js +9 -8
  89. package/services/transitions/baseTransitions.cjs +9 -10
  90. package/services/transitions/baseTransitions.js +10 -11
  91. package/services/transitions/collapse.cjs +1 -1
  92. package/services/transitions/collapse.js +1 -1
  93. package/services/transitions/cssTransitions.cjs +1 -1
  94. package/services/transitions/cssTransitions.js +2 -2
  95. package/services/transitions/simpleClassTransition.cjs +1 -1
  96. package/services/transitions/simpleClassTransition.js +1 -1
  97. package/{slider-BmxQ3A_u.js → slider-Cx50Eghd.js} +14 -24
  98. package/{slider-DSx5CAce.cjs → slider-Dl4Trh32.cjs} +14 -24
  99. package/toaster-UDglac7x.cjs +187 -0
  100. package/toaster-_p1GTtHI.js +188 -0
  101. package/{tree-BFrXdJox.js → tree-DV0tfPlZ.js} +7 -11
  102. package/{tree-Pvr2rZ-D.cjs → tree-rGHtmCnS.cjs} +7 -11
  103. package/utils/directive.cjs +3 -1
  104. package/utils/directive.d.ts +47 -0
  105. package/utils/directive.js +14 -12
  106. package/utils/stores.cjs +8 -9
  107. package/utils/stores.js +8 -9
  108. package/utils/writables.cjs +1 -1
  109. package/utils/writables.js +1 -1
  110. package/{writables-Bn3uhKEG.cjs → writables-DcGT98a7.cjs} +1 -1
  111. package/{writables-CgpOQ4hA.js → writables-e0tyaQpe.js} +1 -1
  112. package/toaster-Cayg6Lbq.cjs +0 -209
  113. package/toaster-XfzHDqz_.js +0 -210
@@ -1,6 +1,6 @@
1
1
  import { readable } from "@amadeus-it-group/tansu";
2
2
  import { BROWSER } from "esm-env";
3
- import { u as addEvent } from "../dom-gfxqXJpK.js";
3
+ import { w as addEvent } from "../dom-Bcg9ORcA.js";
4
4
  import { false$ } from "../utils/stores.js";
5
5
  const createMatchMedia = (query) => BROWSER ? readable(false, {
6
6
  onUse({ set }) {
@@ -1,37 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const tansu = require("@amadeus-it-group/tansu");
4
- const utils_directive = require("../dom-CuBx1JPZ.cjs");
5
- const isInertOrInvisible = (element) => {
6
- let curElement = element;
7
- while (curElement) {
8
- const style = getComputedStyle(curElement);
9
- if (curElement.inert || curElement.hidden || style.display === "none" || style.visibility === "hidden") {
10
- return true;
11
- }
12
- curElement = curElement.parentElement;
13
- }
14
- return false;
15
- };
16
- const checkNotDisabled = (element) => {
17
- var _a;
18
- if (element.disabled) {
19
- return false;
20
- }
21
- const parentFieldset = (_a = element.parentElement) == null ? void 0 : _a.closest("fieldset");
22
- return parentFieldset ? checkNotDisabled(parentFieldset) : true;
23
- };
24
- const isFocusableOtherTags = (element) => element.isContentEditable || !!element.hasAttribute("tabindex");
25
- const isFocusableByTagName = {
26
- INPUT: (element) => element.type !== "hidden" && checkNotDisabled(element),
27
- SELECT: checkNotDisabled,
28
- TEXTAREA: checkNotDisabled,
29
- BUTTON: checkNotDisabled,
30
- A: (element) => !!element.href || isFocusableOtherTags(element)
31
- };
32
- const isFocusable = (element) => {
33
- return document.contains(element) && !isInertOrInvisible(element) && (isFocusableByTagName[element.tagName] ?? isFocusableOtherTags)(element);
34
- };
4
+ const utils_directive = require("../dom-C2gi9OCP.cjs");
5
+ const isFocusable = require("../isFocusable-DfzDLeAN.cjs");
35
6
  const compareDomOrder = (element1, element2) => {
36
7
  if (element1 === element2) {
37
8
  return 0;
@@ -107,7 +78,7 @@ const createNavManager = () => {
107
78
  };
108
79
  const preventDefaultIfRelevant = (value, event) => {
109
80
  if (value) {
110
- event == null ? void 0 : event.preventDefault();
81
+ event?.preventDefault();
111
82
  }
112
83
  return value;
113
84
  };
@@ -115,7 +86,7 @@ const createNavManager = () => {
115
86
  const array = elementsInDomOrder$();
116
87
  while (index >= 0 && index < array.length) {
117
88
  const newItem = array[index];
118
- if (isFocusable(newItem)) {
89
+ if (isFocusable.isFocusable(newItem)) {
119
90
  newItem.focus();
120
91
  if (moveDirection != 0 && isTextInput(newItem)) {
121
92
  const changeDirection = ancestorDirection() !== getTextDirection(newItem);
@@ -134,7 +105,7 @@ const createNavManager = () => {
134
105
  };
135
106
  const createFocusNeighbour = (moveDirection) => ({
136
107
  event,
137
- referenceElement = (event == null ? void 0 : event.target) ?? document.activeElement
108
+ referenceElement = event?.target ?? document.activeElement
138
109
  } = {}) => {
139
110
  const curIndex = referenceElement ? elementsInDomOrder$().indexOf(referenceElement) : -1;
140
111
  if (curIndex > -1) {
@@ -144,19 +115,18 @@ const createNavManager = () => {
144
115
  };
145
116
  const directive = utils_directive.browserDirective((directiveElement, config) => {
146
117
  const onKeyDown = (event) => {
147
- var _a;
148
118
  if (isInternalInputNavigation(event)) {
149
119
  return;
150
120
  }
151
121
  const keyName = getKeyName(event);
152
- const handler = (_a = config.keys) == null ? void 0 : _a[keyName];
122
+ const handler = config.keys?.[keyName];
153
123
  if (handler) {
154
124
  refreshElements(false);
155
125
  handler({ event, directiveElement, navManager, context: config.context });
156
126
  }
157
127
  };
158
128
  directiveElement.addEventListener("keydown", onKeyDown);
159
- const unregister = directiveInstances$.register(() => ((config == null ? void 0 : config.selector) ?? defaultSelector)(directiveElement));
129
+ const unregister = directiveInstances$.register(() => (config?.selector ?? defaultSelector)(directiveElement));
160
130
  return {
161
131
  update(newConfig) {
162
132
  config = newConfig;
@@ -1,35 +1,6 @@
1
1
  import { writable, computed } from "@amadeus-it-group/tansu";
2
- import { r as registrationArray, y as computeCommonAncestor, b as browserDirective } from "../dom-gfxqXJpK.js";
3
- const isInertOrInvisible = (element) => {
4
- let curElement = element;
5
- while (curElement) {
6
- const style = getComputedStyle(curElement);
7
- if (curElement.inert || curElement.hidden || style.display === "none" || style.visibility === "hidden") {
8
- return true;
9
- }
10
- curElement = curElement.parentElement;
11
- }
12
- return false;
13
- };
14
- const checkNotDisabled = (element) => {
15
- var _a;
16
- if (element.disabled) {
17
- return false;
18
- }
19
- const parentFieldset = (_a = element.parentElement) == null ? void 0 : _a.closest("fieldset");
20
- return parentFieldset ? checkNotDisabled(parentFieldset) : true;
21
- };
22
- const isFocusableOtherTags = (element) => element.isContentEditable || !!element.hasAttribute("tabindex");
23
- const isFocusableByTagName = {
24
- INPUT: (element) => element.type !== "hidden" && checkNotDisabled(element),
25
- SELECT: checkNotDisabled,
26
- TEXTAREA: checkNotDisabled,
27
- BUTTON: checkNotDisabled,
28
- A: (element) => !!element.href || isFocusableOtherTags(element)
29
- };
30
- const isFocusable = (element) => {
31
- return document.contains(element) && !isInertOrInvisible(element) && (isFocusableByTagName[element.tagName] ?? isFocusableOtherTags)(element);
32
- };
2
+ import { r as registrationArray, A as computeCommonAncestor, b as browserDirective } from "../dom-Bcg9ORcA.js";
3
+ import { i as isFocusable } from "../isFocusable-Ckwus82R.js";
33
4
  const compareDomOrder = (element1, element2) => {
34
5
  if (element1 === element2) {
35
6
  return 0;
@@ -105,7 +76,7 @@ const createNavManager = () => {
105
76
  };
106
77
  const preventDefaultIfRelevant = (value, event) => {
107
78
  if (value) {
108
- event == null ? void 0 : event.preventDefault();
79
+ event?.preventDefault();
109
80
  }
110
81
  return value;
111
82
  };
@@ -132,7 +103,7 @@ const createNavManager = () => {
132
103
  };
133
104
  const createFocusNeighbour = (moveDirection) => ({
134
105
  event,
135
- referenceElement = (event == null ? void 0 : event.target) ?? document.activeElement
106
+ referenceElement = event?.target ?? document.activeElement
136
107
  } = {}) => {
137
108
  const curIndex = referenceElement ? elementsInDomOrder$().indexOf(referenceElement) : -1;
138
109
  if (curIndex > -1) {
@@ -142,19 +113,18 @@ const createNavManager = () => {
142
113
  };
143
114
  const directive = browserDirective((directiveElement, config) => {
144
115
  const onKeyDown = (event) => {
145
- var _a;
146
116
  if (isInternalInputNavigation(event)) {
147
117
  return;
148
118
  }
149
119
  const keyName = getKeyName(event);
150
- const handler = (_a = config.keys) == null ? void 0 : _a[keyName];
120
+ const handler = config.keys?.[keyName];
151
121
  if (handler) {
152
122
  refreshElements(false);
153
123
  handler({ event, directiveElement, navManager, context: config.context });
154
124
  }
155
125
  };
156
126
  directiveElement.addEventListener("keydown", onKeyDown);
157
- const unregister = directiveInstances$.register(() => ((config == null ? void 0 : config.selector) ?? defaultSelector)(directiveElement));
127
+ const unregister = directiveInstances$.register(() => (config?.selector ?? defaultSelector)(directiveElement));
158
128
  return {
159
129
  update(newConfig) {
160
130
  config = newConfig;
@@ -1,27 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const utils_directive = require("../dom-CuBx1JPZ.cjs");
3
+ const utils_directive = require("../dom-C2gi9OCP.cjs");
4
4
  const portal = utils_directive.browserDirective((content, newArg) => {
5
5
  let arg;
6
6
  let replaceComment;
7
7
  const removeReplaceComment = () => {
8
- var _a;
9
8
  if (replaceComment) {
10
- (_a = replaceComment.parentNode) == null ? void 0 : _a.replaceChild(content, replaceComment);
9
+ replaceComment.parentNode?.replaceChild(content, replaceComment);
11
10
  replaceComment = null;
12
11
  }
13
12
  };
14
13
  const update = (newArg2) => {
15
- var _a, _b;
16
- if (newArg2 !== arg && ((newArg2 == null ? void 0 : newArg2.container) !== (arg == null ? void 0 : arg.container) || (newArg2 == null ? void 0 : newArg2.insertBefore) !== (arg == null ? void 0 : arg.insertBefore))) {
14
+ if (newArg2 !== arg && (newArg2?.container !== arg?.container || newArg2?.insertBefore !== arg?.insertBefore)) {
17
15
  arg = newArg2;
18
- const container = (arg == null ? void 0 : arg.container) ?? ((_a = arg == null ? void 0 : arg.insertBefore) == null ? void 0 : _a.parentElement);
16
+ const container = arg?.container ?? arg?.insertBefore?.parentElement;
19
17
  if (container) {
20
- const insertBefore = (arg == null ? void 0 : arg.insertBefore) ?? null;
18
+ const insertBefore = arg?.insertBefore ?? null;
21
19
  const moveNeeded = content.parentElement !== container || content.nextSibling !== insertBefore;
22
20
  if (moveNeeded) {
23
21
  if (!replaceComment) {
24
- replaceComment = (_b = content.parentNode) == null ? void 0 : _b.insertBefore(content.ownerDocument.createComment("portal"), content);
22
+ replaceComment = content.parentNode?.insertBefore(content.ownerDocument.createComment("portal"), content);
25
23
  }
26
24
  container.insertBefore(content, insertBefore);
27
25
  }
@@ -34,9 +32,8 @@ const portal = utils_directive.browserDirective((content, newArg) => {
34
32
  return {
35
33
  update,
36
34
  destroy: () => {
37
- var _a;
38
35
  removeReplaceComment();
39
- (_a = content.parentNode) == null ? void 0 : _a.removeChild(content);
36
+ content.parentNode?.removeChild(content);
40
37
  }
41
38
  };
42
39
  });
@@ -1,25 +1,23 @@
1
- import { b as browserDirective } from "../dom-gfxqXJpK.js";
1
+ import { b as browserDirective } from "../dom-Bcg9ORcA.js";
2
2
  const portal = browserDirective((content, newArg) => {
3
3
  let arg;
4
4
  let replaceComment;
5
5
  const removeReplaceComment = () => {
6
- var _a;
7
6
  if (replaceComment) {
8
- (_a = replaceComment.parentNode) == null ? void 0 : _a.replaceChild(content, replaceComment);
7
+ replaceComment.parentNode?.replaceChild(content, replaceComment);
9
8
  replaceComment = null;
10
9
  }
11
10
  };
12
11
  const update = (newArg2) => {
13
- var _a, _b;
14
- if (newArg2 !== arg && ((newArg2 == null ? void 0 : newArg2.container) !== (arg == null ? void 0 : arg.container) || (newArg2 == null ? void 0 : newArg2.insertBefore) !== (arg == null ? void 0 : arg.insertBefore))) {
12
+ if (newArg2 !== arg && (newArg2?.container !== arg?.container || newArg2?.insertBefore !== arg?.insertBefore)) {
15
13
  arg = newArg2;
16
- const container = (arg == null ? void 0 : arg.container) ?? ((_a = arg == null ? void 0 : arg.insertBefore) == null ? void 0 : _a.parentElement);
14
+ const container = arg?.container ?? arg?.insertBefore?.parentElement;
17
15
  if (container) {
18
- const insertBefore = (arg == null ? void 0 : arg.insertBefore) ?? null;
16
+ const insertBefore = arg?.insertBefore ?? null;
19
17
  const moveNeeded = content.parentElement !== container || content.nextSibling !== insertBefore;
20
18
  if (moveNeeded) {
21
19
  if (!replaceComment) {
22
- replaceComment = (_b = content.parentNode) == null ? void 0 : _b.insertBefore(content.ownerDocument.createComment("portal"), content);
20
+ replaceComment = content.parentNode?.insertBefore(content.ownerDocument.createComment("portal"), content);
23
21
  }
24
22
  container.insertBefore(content, insertBefore);
25
23
  }
@@ -32,9 +30,8 @@ const portal = browserDirective((content, newArg) => {
32
30
  return {
33
31
  update,
34
32
  destroy: () => {
35
- var _a;
36
33
  removeReplaceComment();
37
- (_a = content.parentNode) == null ? void 0 : _a.removeChild(content);
34
+ content.parentNode?.removeChild(content);
38
35
  }
39
36
  };
40
37
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const tansu = require("@amadeus-it-group/tansu");
4
- const utils_directive = require("../dom-CuBx1JPZ.cjs");
4
+ const utils_directive = require("../dom-C2gi9OCP.cjs");
5
5
  const utils_func = require("../utils/func.cjs");
6
6
  const createResizeObserver = () => {
7
7
  const { element$, directive } = utils_directive.createBrowserStoreDirective();
@@ -15,7 +15,7 @@ const createResizeObserver = () => {
15
15
  set(entries[0]);
16
16
  });
17
17
  observer.observe(element);
18
- return () => observer == null ? void 0 : observer.disconnect();
18
+ return () => observer?.disconnect();
19
19
  },
20
20
  void 0
21
21
  );
@@ -1,5 +1,5 @@
1
1
  import { derived } from "@amadeus-it-group/tansu";
2
- import { j as createBrowserStoreDirective } from "../dom-gfxqXJpK.js";
2
+ import { l as createBrowserStoreDirective } from "../dom-Bcg9ORcA.js";
3
3
  import { noop } from "../utils/func.js";
4
4
  const createResizeObserver = () => {
5
5
  const { element$, directive } = createBrowserStoreDirective();
@@ -13,7 +13,7 @@ const createResizeObserver = () => {
13
13
  set(entries[0]);
14
14
  });
15
15
  observer.observe(element);
16
- return () => observer == null ? void 0 : observer.disconnect();
16
+ return () => observer?.disconnect();
17
17
  },
18
18
  void 0
19
19
  );
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const tansu = require("@amadeus-it-group/tansu");
4
+ const utils_directive = require("../dom-C2gi9OCP.cjs");
4
5
  const utils_func = require("../utils/func.cjs");
5
- const utils_directive = require("../dom-CuBx1JPZ.cjs");
6
- const internalSetSiblingsInert = (element) => {
6
+ const ignoreInertAttributeName = "data-agnos-ignore-inert";
7
+ const applyInertToSiblingsRecursively = (element) => {
7
8
  const inertValues = /* @__PURE__ */ new Map();
8
9
  const recursiveHelper = (element2) => {
9
10
  const parent = element2.parentElement;
10
11
  if (parent && element2 !== document.body) {
11
12
  Array.from(parent.children).forEach((sibling) => {
12
- if (sibling !== element2 && sibling.nodeName !== "SCRIPT") {
13
+ if (sibling !== element2 && sibling.nodeName !== "SCRIPT" && !sibling.hasAttribute(ignoreInertAttributeName)) {
13
14
  inertValues.set(sibling, sibling.hasAttribute("inert"));
14
15
  sibling.toggleAttribute("inert", true);
15
16
  }
@@ -25,16 +26,16 @@ const internalSetSiblingsInert = (element) => {
25
26
  let internalRevert = utils_func.noop;
26
27
  const setSiblingsInert = (element) => {
27
28
  internalRevert();
28
- internalRevert = element ? internalSetSiblingsInert(element) : utils_func.noop;
29
+ internalRevert = element ? applyInertToSiblingsRecursively(element) : utils_func.noop;
29
30
  };
30
- const { directive: storeArrayDirective, elements$ } = utils_directive.createBrowserStoreArrayDirective();
31
- const lastElement$ = tansu.computed(
31
+ const { directive: storeArrayDirective, elements$ } = utils_directive.createConditionalBrowserStoreArrayDirective();
32
+ const lastTrackedElement$ = tansu.computed(
32
33
  () => {
33
34
  const elements = elements$();
34
35
  return elements[elements.length - 1];
35
36
  },
36
37
  { equal: Object.is }
37
38
  );
38
- const inertAction$ = tansu.computed(() => setSiblingsInert(lastElement$()));
39
- const siblingsInert = utils_directive.mergeDirectives(storeArrayDirective, utils_directive.directiveSubscribe(inertAction$));
39
+ const updateInertState$ = tansu.computed(() => setSiblingsInert(lastTrackedElement$()));
40
+ const siblingsInert = utils_directive.mergeDirectives(storeArrayDirective, utils_directive.directiveSubscribe(updateInertState$));
40
41
  exports.siblingsInert = siblingsInert;
@@ -1,6 +1,16 @@
1
1
  import type { Directive } from '../types';
2
2
  /**
3
- * A directive that sets the `inert` attribute on all sibling elements of the given element recursively up the DOM tree,
4
- * excluding the element itself and any `<script>` elements.
3
+ * Directive to manage focus trapping by setting the `inert` attribute on sibling elements.
4
+ * This is useful for modal dialogs or overlays where interaction should be limited to a specific subtree.
5
+ *
6
+ * - Recursively traverses up the DOM tree.
7
+ * - Sets `inert` on all siblings except the target element and `<script>` tags.
8
+ * - Use `data-agnos-ignore-inert` to avoid inert attribute for a specified element.
9
+ *
10
+ * Takes boolean or undefined as value:
11
+ * - `true` or `undefined`: Apply inert to siblings.
12
+ * - `false`: Do not apply inert to siblings.
13
+ *
14
+ * Automatically reverts when the target element changes or is removed.
5
15
  */
6
- export declare const siblingsInert: Directive;
16
+ export declare const siblingsInert: Directive<boolean | undefined>;
@@ -1,13 +1,14 @@
1
1
  import { computed } from "@amadeus-it-group/tansu";
2
+ import { j as createConditionalBrowserStoreArrayDirective, n as mergeDirectives, d as directiveSubscribe } from "../dom-Bcg9ORcA.js";
2
3
  import { noop } from "../utils/func.js";
3
- import { g as createBrowserStoreArrayDirective, k as mergeDirectives, d as directiveSubscribe } from "../dom-gfxqXJpK.js";
4
- const internalSetSiblingsInert = (element) => {
4
+ const ignoreInertAttributeName = "data-agnos-ignore-inert";
5
+ const applyInertToSiblingsRecursively = (element) => {
5
6
  const inertValues = /* @__PURE__ */ new Map();
6
7
  const recursiveHelper = (element2) => {
7
8
  const parent = element2.parentElement;
8
9
  if (parent && element2 !== document.body) {
9
10
  Array.from(parent.children).forEach((sibling) => {
10
- if (sibling !== element2 && sibling.nodeName !== "SCRIPT") {
11
+ if (sibling !== element2 && sibling.nodeName !== "SCRIPT" && !sibling.hasAttribute(ignoreInertAttributeName)) {
11
12
  inertValues.set(sibling, sibling.hasAttribute("inert"));
12
13
  sibling.toggleAttribute("inert", true);
13
14
  }
@@ -23,18 +24,18 @@ const internalSetSiblingsInert = (element) => {
23
24
  let internalRevert = noop;
24
25
  const setSiblingsInert = (element) => {
25
26
  internalRevert();
26
- internalRevert = element ? internalSetSiblingsInert(element) : noop;
27
+ internalRevert = element ? applyInertToSiblingsRecursively(element) : noop;
27
28
  };
28
- const { directive: storeArrayDirective, elements$ } = createBrowserStoreArrayDirective();
29
- const lastElement$ = computed(
29
+ const { directive: storeArrayDirective, elements$ } = createConditionalBrowserStoreArrayDirective();
30
+ const lastTrackedElement$ = computed(
30
31
  () => {
31
32
  const elements = elements$();
32
33
  return elements[elements.length - 1];
33
34
  },
34
35
  { equal: Object.is }
35
36
  );
36
- const inertAction$ = computed(() => setSiblingsInert(lastElement$()));
37
- const siblingsInert = mergeDirectives(storeArrayDirective, directiveSubscribe(inertAction$));
37
+ const updateInertState$ = computed(() => setSiblingsInert(lastTrackedElement$()));
38
+ const siblingsInert = mergeDirectives(storeArrayDirective, directiveSubscribe(updateInertState$));
38
39
  export {
39
40
  siblingsInert
40
41
  };
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const tansu = require("@amadeus-it-group/tansu");
4
- const utils_writables = require("../../writables-Bn3uhKEG.cjs");
4
+ const utils_writables = require("../../writables-DcGT98a7.cjs");
5
5
  const promise = require("../../promise-CxCD3NYv.cjs");
6
6
  const utils_func = require("../../utils/func.cjs");
7
7
  const utils_stores = require("../../utils/stores.cjs");
8
- const utils_directive = require("../../dom-CuBx1JPZ.cjs");
8
+ const utils_directive = require("../../dom-C2gi9OCP.cjs");
9
9
  const neverEndingPromise = new Promise(utils_func.noop);
10
10
  const noAnimation = (element, direction) => {
11
11
  element.style.display = direction === "show" ? "" : "none";
@@ -41,8 +41,8 @@ const createTransition = (config) => {
41
41
  const stop = () => {
42
42
  let context;
43
43
  currentTransition$.update((currentTransition) => {
44
- currentTransition == null ? void 0 : currentTransition.abort.abort();
45
- context = currentTransition == null ? void 0 : currentTransition.context;
44
+ currentTransition?.abort.abort();
45
+ context = currentTransition?.context;
46
46
  return null;
47
47
  });
48
48
  return context;
@@ -64,7 +64,6 @@ const createTransition = (config) => {
64
64
  currentTransition$.set(currentTransition);
65
65
  resolve(
66
66
  (async () => {
67
- var _a;
68
67
  try {
69
68
  await transitionFn(element, visible ? "show" : "hide", animated, signal, context);
70
69
  } finally {
@@ -72,7 +71,7 @@ const createTransition = (config) => {
72
71
  await neverEndingPromise;
73
72
  } else {
74
73
  currentTransition$.set(null);
75
- (_a = (visible ? onShown$ : onHidden$)()) == null ? void 0 : _a();
74
+ (visible ? onShown$ : onHidden$)()?.();
76
75
  }
77
76
  }
78
77
  })()
@@ -100,9 +99,9 @@ const createTransition = (config) => {
100
99
  if (visibleChanged || animationFromToggle != null) {
101
100
  pendingTransition = null;
102
101
  }
103
- const animate = animationFromToggle ?? (pendingTransition == null ? void 0 : pendingTransition.animated) ?? (elementChanged && !visible ? false : animated);
102
+ const animate = animationFromToggle ?? pendingTransition?.animated ?? (elementChanged && !visible ? false : animated);
104
103
  currentTransition = runTransition(visible, animate, element, transition);
105
- pendingTransition == null ? void 0 : pendingTransition.resolve(currentTransition.promise);
104
+ pendingTransition?.resolve(currentTransition.promise);
106
105
  pendingTransition = null;
107
106
  }
108
107
  } else {
@@ -110,7 +109,7 @@ const createTransition = (config) => {
110
109
  stop();
111
110
  currentTransition = null;
112
111
  }
113
- if (visibleChanged || visible && (pendingTransition == null ? void 0 : pendingTransition.animated) !== animationFromToggle) {
112
+ if (visibleChanged || visible && pendingTransition?.animated !== animationFromToggle) {
114
113
  pendingTransition = visible && animationFromToggle != null ? {
115
114
  // toggle was called to display the element, but the element is not yet in the DOM
116
115
  // let's keep the animation setting from toggle and provide the promise for the end of toggle
@@ -119,7 +118,7 @@ const createTransition = (config) => {
119
118
  } : null;
120
119
  }
121
120
  }
122
- return (pendingTransition == null ? void 0 : pendingTransition.promise) ?? (currentTransition == null ? void 0 : currentTransition.promise);
121
+ return pendingTransition?.promise ?? currentTransition?.promise;
123
122
  }
124
123
  );
125
124
  let lastToggle = {};
@@ -1,9 +1,9 @@
1
1
  import { computed, writable, derived, batch } from "@amadeus-it-group/tansu";
2
- import { d as typeBooleanOrNull, g as typeFunction, c as typeBoolean } from "../../writables-CgpOQ4hA.js";
3
- import { c as promiseWithResolve } from "../../promise-XSP94FjG.js";
2
+ import { d as typeBooleanOrNull, g as typeFunction, c as typeBoolean } from "../../writables-e0tyaQpe.js";
3
+ import { d as promiseWithResolve } from "../../promise-Y53vc4Ia.js";
4
4
  import { noop } from "../../utils/func.js";
5
5
  import { writablesForProps, bindableDerived, stateStores } from "../../utils/stores.js";
6
- import { h as createStoreDirective, k as mergeDirectives, d as directiveSubscribe } from "../../dom-gfxqXJpK.js";
6
+ import { k as createStoreDirective, n as mergeDirectives, d as directiveSubscribe } from "../../dom-Bcg9ORcA.js";
7
7
  const neverEndingPromise = new Promise(noop);
8
8
  const noAnimation = (element, direction) => {
9
9
  element.style.display = direction === "show" ? "" : "none";
@@ -39,8 +39,8 @@ const createTransition = (config) => {
39
39
  const stop = () => {
40
40
  let context;
41
41
  currentTransition$.update((currentTransition) => {
42
- currentTransition == null ? void 0 : currentTransition.abort.abort();
43
- context = currentTransition == null ? void 0 : currentTransition.context;
42
+ currentTransition?.abort.abort();
43
+ context = currentTransition?.context;
44
44
  return null;
45
45
  });
46
46
  return context;
@@ -62,7 +62,6 @@ const createTransition = (config) => {
62
62
  currentTransition$.set(currentTransition);
63
63
  resolve(
64
64
  (async () => {
65
- var _a;
66
65
  try {
67
66
  await transitionFn(element, visible ? "show" : "hide", animated, signal, context);
68
67
  } finally {
@@ -70,7 +69,7 @@ const createTransition = (config) => {
70
69
  await neverEndingPromise;
71
70
  } else {
72
71
  currentTransition$.set(null);
73
- (_a = (visible ? onShown$ : onHidden$)()) == null ? void 0 : _a();
72
+ (visible ? onShown$ : onHidden$)()?.();
74
73
  }
75
74
  }
76
75
  })()
@@ -98,9 +97,9 @@ const createTransition = (config) => {
98
97
  if (visibleChanged || animationFromToggle != null) {
99
98
  pendingTransition = null;
100
99
  }
101
- const animate = animationFromToggle ?? (pendingTransition == null ? void 0 : pendingTransition.animated) ?? (elementChanged && !visible ? false : animated);
100
+ const animate = animationFromToggle ?? pendingTransition?.animated ?? (elementChanged && !visible ? false : animated);
102
101
  currentTransition = runTransition(visible, animate, element, transition);
103
- pendingTransition == null ? void 0 : pendingTransition.resolve(currentTransition.promise);
102
+ pendingTransition?.resolve(currentTransition.promise);
104
103
  pendingTransition = null;
105
104
  }
106
105
  } else {
@@ -108,7 +107,7 @@ const createTransition = (config) => {
108
107
  stop();
109
108
  currentTransition = null;
110
109
  }
111
- if (visibleChanged || visible && (pendingTransition == null ? void 0 : pendingTransition.animated) !== animationFromToggle) {
110
+ if (visibleChanged || visible && pendingTransition?.animated !== animationFromToggle) {
112
111
  pendingTransition = visible && animationFromToggle != null ? {
113
112
  // toggle was called to display the element, but the element is not yet in the DOM
114
113
  // let's keep the animation setting from toggle and provide the promise for the end of toggle
@@ -117,7 +116,7 @@ const createTransition = (config) => {
117
116
  } : null;
118
117
  }
119
118
  }
120
- return (pendingTransition == null ? void 0 : pendingTransition.promise) ?? (currentTransition == null ? void 0 : currentTransition.promise);
119
+ return pendingTransition?.promise ?? currentTransition?.promise;
121
120
  }
122
121
  );
123
122
  let lastToggle = {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const utils_directive = require("../../dom-CuBx1JPZ.cjs");
3
+ const utils_directive = require("../../dom-C2gi9OCP.cjs");
4
4
  const services_transitions_cssTransitions = require("./cssTransitions.cjs");
5
5
  const createCollapseTransition = ({
6
6
  dimension = "height",
@@ -1,4 +1,4 @@
1
- import { i as isBrowserHTMLElement, v as removeClasses, w as addClasses, x as reflow } from "../../dom-gfxqXJpK.js";
1
+ import { i as isBrowserHTMLElement, x as removeClasses, y as addClasses, z as reflow } from "../../dom-Bcg9ORcA.js";
2
2
  import { createCSSTransition } from "./cssTransitions.js";
3
3
  const createCollapseTransition = ({
4
4
  dimension = "height",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const utils_directive = require("../../dom-CuBx1JPZ.cjs");
3
+ const utils_directive = require("../../dom-C2gi9OCP.cjs");
4
4
  const utils_func = require("../../utils/func.cjs");
5
5
  const promise = require("../../promise-CxCD3NYv.cjs");
6
6
  function hasTransition(element) {
@@ -1,6 +1,6 @@
1
- import { i as isBrowserHTMLElement } from "../../dom-gfxqXJpK.js";
1
+ import { i as isBrowserHTMLElement } from "../../dom-Bcg9ORcA.js";
2
2
  import { noop } from "../../utils/func.js";
3
- import { a as promiseFromEvent, b as promiseFromTimeout } from "../../promise-XSP94FjG.js";
3
+ import { b as promiseFromEvent, c as promiseFromTimeout } from "../../promise-Y53vc4Ia.js";
4
4
  function hasTransition(element) {
5
5
  return window.getComputedStyle(element).transitionProperty !== "none";
6
6
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const services_transitions_cssTransitions = require("./cssTransitions.cjs");
4
- const utils_directive = require("../../dom-CuBx1JPZ.cjs");
4
+ const utils_directive = require("../../dom-C2gi9OCP.cjs");
5
5
  const createSimpleClassTransition = (config) => {
6
6
  const { animationPendingClasses, animationPendingShowClasses, animationPendingHideClasses, showClasses, hideClasses } = config;
7
7
  return services_transitions_cssTransitions.createCSSTransition((element, direction, animated, context) => {
@@ -1,5 +1,5 @@
1
1
  import { createCSSTransition } from "./cssTransitions.js";
2
- import { v as removeClasses, w as addClasses, x as reflow } from "../../dom-gfxqXJpK.js";
2
+ import { x as removeClasses, y as addClasses, z as reflow } from "../../dom-Bcg9ORcA.js";
3
3
  const createSimpleClassTransition = (config) => {
4
4
  const { animationPendingClasses, animationPendingShowClasses, animationPendingHideClasses, showClasses, hideClasses } = config;
5
5
  return createCSSTransition((element, direction, animated, context) => {