@zag-js/popover 0.2.11 → 0.2.12

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.
@@ -26,190 +26,18 @@ module.exports = __toCommonJS(popover_machine_exports);
26
26
  var import_aria_hidden = require("@zag-js/aria-hidden");
27
27
  var import_core = require("@zag-js/core");
28
28
  var import_dismissable = require("@zag-js/dismissable");
29
-
30
- // ../../utilities/core/src/array.ts
31
- function nextIndex(v, idx, opts = {}) {
32
- const { step = 1, loop = true } = opts;
33
- const next2 = idx + step;
34
- const len = v.length;
35
- const last = len - 1;
36
- if (idx === -1)
37
- return step > 0 ? 0 : last;
38
- if (next2 < 0)
39
- return loop ? last : 0;
40
- if (next2 >= len)
41
- return loop ? 0 : idx > len ? len : idx;
42
- return next2;
43
- }
44
- function next(v, idx, opts = {}) {
45
- return v[nextIndex(v, idx, opts)];
46
- }
47
-
48
- // ../../utilities/core/src/functions.ts
49
- var runIfFn = (v, ...a) => {
50
- const res = typeof v === "function" ? v(...a) : v;
51
- return res ?? void 0;
52
- };
53
-
54
- // ../../utilities/core/src/guard.ts
55
- var isArray = (v) => Array.isArray(v);
56
- var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
57
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
58
-
59
- // ../../utilities/core/src/object.ts
60
- function compact(obj) {
61
- if (obj === void 0)
62
- return obj;
63
- return Object.fromEntries(
64
- Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
65
- );
66
- }
67
-
68
- // ../../utilities/dom/src/query.ts
69
- function isDocument(el) {
70
- return el.nodeType === Node.DOCUMENT_NODE;
71
- }
72
- function isWindow(value) {
73
- return value?.toString() === "[object Window]";
74
- }
75
- function isFrame(element) {
76
- return element.localName === "iframe";
77
- }
78
- function getDocument(el) {
79
- if (isWindow(el))
80
- return el.document;
81
- if (isDocument(el))
82
- return el;
83
- return el?.ownerDocument ?? document;
84
- }
85
- function defineDomHelpers(helpers) {
86
- const dom2 = {
87
- getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
88
- getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
89
- getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
90
- getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
91
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
92
- };
93
- return {
94
- ...dom2,
95
- ...helpers
96
- };
97
- }
98
- function contains(parent, child) {
99
- if (!parent)
100
- return false;
101
- return parent === child || isHTMLElement(parent) && isHTMLElement(child) && parent.contains(child);
102
- }
103
- function isHTMLElement(v) {
104
- return typeof v === "object" && v?.nodeType === Node.ELEMENT_NODE && typeof v?.nodeName === "string";
105
- }
106
- function isVisible(el) {
107
- if (!isHTMLElement(el))
108
- return false;
109
- return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
110
- }
111
-
112
- // ../../utilities/dom/src/event.ts
113
- var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
114
-
115
- // ../../utilities/dom/src/focusable.ts
116
- function hasNegativeTabIndex(element) {
117
- const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
118
- return tabIndex < 0;
119
- }
120
- var focusableSelector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";
121
- var getFocusables = (container, includeContainer = false) => {
122
- if (!container)
123
- return [];
124
- const elements = Array.from(container.querySelectorAll(focusableSelector));
125
- const include = includeContainer == true || includeContainer == "if-empty" && elements.length === 0;
126
- if (include && isHTMLElement(container) && isFocusable(container)) {
127
- elements.unshift(container);
128
- }
129
- const focusableElements = elements.filter(isFocusable);
130
- focusableElements.forEach((element, i) => {
131
- if (isFrame(element) && element.contentDocument) {
132
- const frameBody = element.contentDocument.body;
133
- focusableElements.splice(i, 1, ...getFocusables(frameBody));
134
- }
135
- });
136
- return focusableElements;
137
- };
138
- function isFocusable(element) {
139
- if (!element)
140
- return false;
141
- return element.matches(focusableSelector) && isVisible(element);
142
- }
143
- function getTabbables(container, includeContainer) {
144
- if (!container)
145
- return [];
146
- const elements = Array.from(container.querySelectorAll(focusableSelector));
147
- const tabbableElements = elements.filter(isTabbable);
148
- if (includeContainer && isTabbable(container)) {
149
- tabbableElements.unshift(container);
150
- }
151
- tabbableElements.forEach((element, i) => {
152
- if (isFrame(element) && element.contentDocument) {
153
- const frameBody = element.contentDocument.body;
154
- const allFrameTabbable = getTabbables(frameBody);
155
- tabbableElements.splice(i, 1, ...allFrameTabbable);
156
- }
157
- });
158
- if (!tabbableElements.length && includeContainer) {
159
- return elements;
160
- }
161
- return tabbableElements;
162
- }
163
- function isTabbable(el) {
164
- return isFocusable(el) && !hasNegativeTabIndex(el);
165
- }
166
- function getFirstTabbable(container, includeContainer) {
167
- const [first] = getTabbables(container, includeContainer);
168
- return first || null;
169
- }
170
- function getLastTabbable(container, includeContainer) {
171
- const elements = getTabbables(container, includeContainer);
172
- return elements[elements.length - 1] || null;
173
- }
174
-
175
- // ../../utilities/dom/src/listener.ts
176
- var isRef = (v) => hasProp(v, "current");
177
- function addDomEvent(target, eventName, handler, options) {
178
- const node = isRef(target) ? target.current : runIfFn(target);
179
- node?.addEventListener(eventName, handler, options);
180
- return () => {
181
- node?.removeEventListener(eventName, handler, options);
182
- };
183
- }
184
-
185
- // ../../utilities/dom/src/next-tick.ts
186
- function nextTick(fn) {
187
- const set = /* @__PURE__ */ new Set();
188
- function raf2(fn2) {
189
- const id = globalThis.requestAnimationFrame(fn2);
190
- set.add(() => globalThis.cancelAnimationFrame(id));
191
- }
192
- raf2(() => raf2(fn));
193
- return function cleanup() {
194
- set.forEach(function(fn2) {
195
- fn2();
196
- });
197
- };
198
- }
199
- function raf(fn) {
200
- const id = globalThis.requestAnimationFrame(fn);
201
- return function cleanup() {
202
- globalThis.cancelAnimationFrame(id);
203
- };
204
- }
205
-
206
- // src/popover.machine.ts
29
+ var import_dom_query2 = require("@zag-js/dom-query");
30
+ var import_dom_event = require("@zag-js/dom-event");
207
31
  var import_popper = require("@zag-js/popper");
208
32
  var import_remove_scroll = require("@zag-js/remove-scroll");
33
+ var import_utils2 = require("@zag-js/utils");
209
34
  var import_focus_trap = require("focus-trap");
210
35
 
211
36
  // src/popover.dom.ts
212
- var dom = defineDomHelpers({
37
+ var import_dom_query = require("@zag-js/dom-query");
38
+ var import_tabbable = require("@zag-js/tabbable");
39
+ var import_utils = require("@zag-js/utils");
40
+ var dom = (0, import_dom_query.createScope)({
213
41
  getActiveEl: (ctx) => dom.getDoc(ctx).activeElement,
214
42
  getAnchorId: (ctx) => ctx.ids?.anchor ?? `popover:${ctx.id}:anchor`,
215
43
  getTriggerId: (ctx) => ctx.ids?.trigger ?? `popover:${ctx.id}:trigger`,
@@ -225,14 +53,14 @@ var dom = defineDomHelpers({
225
53
  getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
226
54
  getTitleEl: (ctx) => dom.getById(ctx, dom.getTitleId(ctx)),
227
55
  getDescriptionEl: (ctx) => dom.getById(ctx, dom.getDescriptionId(ctx)),
228
- getFocusableEls: (ctx) => getFocusables(dom.getContentEl(ctx)),
56
+ getFocusableEls: (ctx) => (0, import_tabbable.getFocusables)(dom.getContentEl(ctx)),
229
57
  getFirstFocusableEl: (ctx) => dom.getFocusableEls(ctx)[0],
230
- getDocTabbableEls: (ctx) => getTabbables(dom.getDoc(ctx).body),
231
- getTabbableEls: (ctx) => getTabbables(dom.getContentEl(ctx), "if-empty"),
232
- getFirstTabbableEl: (ctx) => getFirstTabbable(dom.getContentEl(ctx), "if-empty"),
233
- getLastTabbableEl: (ctx) => getLastTabbable(dom.getContentEl(ctx), "if-empty"),
58
+ getDocTabbableEls: (ctx) => (0, import_tabbable.getTabbables)(dom.getDoc(ctx).body),
59
+ getTabbableEls: (ctx) => (0, import_tabbable.getTabbables)(dom.getContentEl(ctx), "if-empty"),
60
+ getFirstTabbableEl: (ctx) => (0, import_tabbable.getFirstTabbable)(dom.getContentEl(ctx), "if-empty"),
61
+ getLastTabbableEl: (ctx) => (0, import_tabbable.getLastTabbable)(dom.getContentEl(ctx), "if-empty"),
234
62
  getInitialFocusEl: (ctx) => {
235
- let el = runIfFn(ctx.initialFocusEl);
63
+ let el = (0, import_utils.runIfFn)(ctx.initialFocusEl);
236
64
  if (!el && ctx.autoFocus)
237
65
  el = dom.getFirstFocusableEl(ctx);
238
66
  if (!el)
@@ -244,7 +72,7 @@ var dom = defineDomHelpers({
244
72
  // src/popover.machine.ts
245
73
  var { and, or, not } = import_core.guards;
246
74
  function machine(userContext) {
247
- const ctx = compact(userContext);
75
+ const ctx = (0, import_utils2.compact)(userContext);
248
76
  return (0, import_core.createMachine)(
249
77
  {
250
78
  id: "popover",
@@ -373,11 +201,11 @@ function machine(userContext) {
373
201
  trackTabKeyDown(ctx2, _evt, { send }) {
374
202
  if (ctx2.modal)
375
203
  return;
376
- return addDomEvent(
204
+ return (0, import_dom_event.addDomEvent)(
377
205
  dom.getWin(ctx2),
378
206
  "keydown",
379
207
  (event) => {
380
- const isTabKey = event.key === "Tab" && !isModifiedEvent(event);
208
+ const isTabKey = event.key === "Tab" && !(0, import_dom_event.isModifiedEvent)(event);
381
209
  if (!isTabKey)
382
210
  return;
383
211
  send({
@@ -392,7 +220,7 @@ function machine(userContext) {
392
220
  if (!ctx2.modal)
393
221
  return;
394
222
  let cleanup;
395
- nextTick(() => {
223
+ (0, import_dom_query2.nextTick)(() => {
396
224
  cleanup = (0, import_aria_hidden.ariaHidden)([dom.getContentEl(ctx2), dom.getTriggerEl(ctx2)]);
397
225
  });
398
226
  return () => cleanup?.();
@@ -406,7 +234,7 @@ function machine(userContext) {
406
234
  if (!ctx2.modal)
407
235
  return;
408
236
  let trap;
409
- nextTick(() => {
237
+ (0, import_dom_query2.nextTick)(() => {
410
238
  const el = dom.getContentEl(ctx2);
411
239
  if (!el)
412
240
  return;
@@ -416,7 +244,7 @@ function machine(userContext) {
416
244
  returnFocusOnDeactivate: true,
417
245
  document: dom.getDoc(ctx2),
418
246
  fallbackFocus: el,
419
- initialFocus: runIfFn(ctx2.initialFocusEl)
247
+ initialFocus: (0, import_utils2.runIfFn)(ctx2.initialFocusEl)
420
248
  });
421
249
  try {
422
250
  trap.activate();
@@ -428,7 +256,7 @@ function machine(userContext) {
428
256
  },
429
257
  guards: {
430
258
  portalled: (ctx2) => ctx2.currentPortalled,
431
- isRelatedTargetWithinContent: (ctx2, evt) => contains(dom.getContentEl(ctx2), evt.target),
259
+ isRelatedTargetWithinContent: (ctx2, evt) => (0, import_dom_query2.contains)(dom.getContentEl(ctx2), evt.target),
432
260
  closeOnInteractOutside: (ctx2) => !!ctx2.closeOnInteractOutside,
433
261
  isContentFocused: (ctx2) => dom.getContentEl(ctx2) === dom.getActiveEl(ctx2),
434
262
  isTriggerFocused: (ctx2) => dom.getTriggerEl(ctx2) === dom.getActiveEl(ctx2),
@@ -437,7 +265,7 @@ function machine(userContext) {
437
265
  },
438
266
  actions: {
439
267
  checkRenderedElements(ctx2) {
440
- raf(() => {
268
+ (0, import_dom_query2.raf)(() => {
441
269
  Object.assign(ctx2.renderedElements, {
442
270
  title: !!dom.getTitleEl(ctx2),
443
271
  description: !!dom.getDescriptionEl(ctx2),
@@ -446,14 +274,14 @@ function machine(userContext) {
446
274
  });
447
275
  },
448
276
  setInitialFocus(ctx2) {
449
- raf(() => {
277
+ (0, import_dom_query2.raf)(() => {
450
278
  dom.getInitialFocusEl(ctx2)?.focus();
451
279
  });
452
280
  },
453
281
  focusTriggerIfNeeded(ctx2) {
454
282
  if (!ctx2.focusTriggerOnClose)
455
283
  return;
456
- raf(() => dom.getTriggerEl(ctx2)?.focus());
284
+ (0, import_dom_query2.raf)(() => dom.getTriggerEl(ctx2)?.focus());
457
285
  },
458
286
  focusFirstTabbableElement(ctx2, evt) {
459
287
  evt.preventDefault();
@@ -478,15 +306,15 @@ function machine(userContext) {
478
306
  if (lastTabbable !== dom.getActiveEl(ctx2))
479
307
  return;
480
308
  let tabbables = dom.getDocTabbableEls(ctx2);
481
- let elementAfterTrigger = next(tabbables, tabbables.indexOf(button), { loop: false });
309
+ let elementAfterTrigger = (0, import_utils2.next)(tabbables, tabbables.indexOf(button), { loop: false });
482
310
  if (elementAfterTrigger === content) {
483
- tabbables = tabbables.filter((el) => !contains(content, el));
484
- elementAfterTrigger = next(tabbables, tabbables.indexOf(button), { loop: false });
311
+ tabbables = tabbables.filter((el) => !(0, import_dom_query2.contains)(content, el));
312
+ elementAfterTrigger = (0, import_utils2.next)(tabbables, tabbables.indexOf(button), { loop: false });
485
313
  }
486
314
  if (!elementAfterTrigger || elementAfterTrigger === button)
487
315
  return;
488
316
  evt.preventDefault();
489
- raf(() => elementAfterTrigger?.focus());
317
+ (0, import_dom_query2.raf)(() => elementAfterTrigger?.focus());
490
318
  }
491
319
  }
492
320
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  machine
3
- } from "./chunk-NMCDKPIS.mjs";
4
- import "./chunk-2EVL5G6H.mjs";
3
+ } from "./chunk-JT2RXXW4.mjs";
4
+ import "./chunk-4IGGT6KB.mjs";
5
5
  export {
6
6
  machine
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popover",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Core logic for the popover widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,19 +26,21 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "focus-trap": "7.2.0",
29
+ "focus-trap": "7.3.1",
30
30
  "@zag-js/anatomy": "0.1.4",
31
+ "@zag-js/core": "0.2.10",
32
+ "@zag-js/dom-event": "0.0.1",
31
33
  "@zag-js/aria-hidden": "0.2.2",
32
- "@zag-js/core": "0.2.9",
33
- "@zag-js/dismissable": "0.2.2",
34
- "@zag-js/popper": "0.2.3",
35
- "@zag-js/remove-scroll": "0.2.2",
36
- "@zag-js/types": "0.3.4"
34
+ "@zag-js/utils": "0.3.3",
35
+ "@zag-js/dom-query": "0.1.3",
36
+ "@zag-js/dismissable": "0.2.3",
37
+ "@zag-js/remove-scroll": "0.2.3",
38
+ "@zag-js/popper": "0.2.4",
39
+ "@zag-js/types": "0.3.4",
40
+ "@zag-js/tabbable": "0.0.1"
37
41
  },
38
42
  "devDependencies": {
39
- "clean-package": "2.2.0",
40
- "@zag-js/dom-utils": "0.2.4",
41
- "@zag-js/utils": "0.3.3"
43
+ "clean-package": "2.2.0"
42
44
  },
43
45
  "clean-package": "../../../clean-package.config.json",
44
46
  "main": "dist/index.js",
@@ -1,148 +0,0 @@
1
- // ../../utilities/core/src/functions.ts
2
- var runIfFn = (v, ...a) => {
3
- const res = typeof v === "function" ? v(...a) : v;
4
- return res ?? void 0;
5
- };
6
-
7
- // ../../utilities/dom/src/query.ts
8
- function isDocument(el) {
9
- return el.nodeType === Node.DOCUMENT_NODE;
10
- }
11
- function isWindow(value) {
12
- return value?.toString() === "[object Window]";
13
- }
14
- function isFrame(element) {
15
- return element.localName === "iframe";
16
- }
17
- function getDocument(el) {
18
- if (isWindow(el))
19
- return el.document;
20
- if (isDocument(el))
21
- return el;
22
- return el?.ownerDocument ?? document;
23
- }
24
- function defineDomHelpers(helpers) {
25
- const dom2 = {
26
- getRootNode: (ctx) => ctx.getRootNode?.() ?? document,
27
- getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
28
- getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
29
- getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
30
- getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
31
- };
32
- return {
33
- ...dom2,
34
- ...helpers
35
- };
36
- }
37
- function contains(parent, child) {
38
- if (!parent)
39
- return false;
40
- return parent === child || isHTMLElement(parent) && isHTMLElement(child) && parent.contains(child);
41
- }
42
- function isHTMLElement(v) {
43
- return typeof v === "object" && v?.nodeType === Node.ELEMENT_NODE && typeof v?.nodeName === "string";
44
- }
45
- function isVisible(el) {
46
- if (!isHTMLElement(el))
47
- return false;
48
- return el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0;
49
- }
50
-
51
- // ../../utilities/dom/src/focusable.ts
52
- function hasNegativeTabIndex(element) {
53
- const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
54
- return tabIndex < 0;
55
- }
56
- var focusableSelector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";
57
- var getFocusables = (container, includeContainer = false) => {
58
- if (!container)
59
- return [];
60
- const elements = Array.from(container.querySelectorAll(focusableSelector));
61
- const include = includeContainer == true || includeContainer == "if-empty" && elements.length === 0;
62
- if (include && isHTMLElement(container) && isFocusable(container)) {
63
- elements.unshift(container);
64
- }
65
- const focusableElements = elements.filter(isFocusable);
66
- focusableElements.forEach((element, i) => {
67
- if (isFrame(element) && element.contentDocument) {
68
- const frameBody = element.contentDocument.body;
69
- focusableElements.splice(i, 1, ...getFocusables(frameBody));
70
- }
71
- });
72
- return focusableElements;
73
- };
74
- function isFocusable(element) {
75
- if (!element)
76
- return false;
77
- return element.matches(focusableSelector) && isVisible(element);
78
- }
79
- function getTabbables(container, includeContainer) {
80
- if (!container)
81
- return [];
82
- const elements = Array.from(container.querySelectorAll(focusableSelector));
83
- const tabbableElements = elements.filter(isTabbable);
84
- if (includeContainer && isTabbable(container)) {
85
- tabbableElements.unshift(container);
86
- }
87
- tabbableElements.forEach((element, i) => {
88
- if (isFrame(element) && element.contentDocument) {
89
- const frameBody = element.contentDocument.body;
90
- const allFrameTabbable = getTabbables(frameBody);
91
- tabbableElements.splice(i, 1, ...allFrameTabbable);
92
- }
93
- });
94
- if (!tabbableElements.length && includeContainer) {
95
- return elements;
96
- }
97
- return tabbableElements;
98
- }
99
- function isTabbable(el) {
100
- return isFocusable(el) && !hasNegativeTabIndex(el);
101
- }
102
- function getFirstTabbable(container, includeContainer) {
103
- const [first] = getTabbables(container, includeContainer);
104
- return first || null;
105
- }
106
- function getLastTabbable(container, includeContainer) {
107
- const elements = getTabbables(container, includeContainer);
108
- return elements[elements.length - 1] || null;
109
- }
110
-
111
- // src/popover.dom.ts
112
- var dom = defineDomHelpers({
113
- getActiveEl: (ctx) => dom.getDoc(ctx).activeElement,
114
- getAnchorId: (ctx) => ctx.ids?.anchor ?? `popover:${ctx.id}:anchor`,
115
- getTriggerId: (ctx) => ctx.ids?.trigger ?? `popover:${ctx.id}:trigger`,
116
- getContentId: (ctx) => ctx.ids?.content ?? `popover:${ctx.id}:content`,
117
- getPositionerId: (ctx) => `popover:${ctx.id}:popper`,
118
- getArrowId: (ctx) => `popover:${ctx.id}:arrow`,
119
- getTitleId: (ctx) => ctx.ids?.title ?? `popover:${ctx.id}:title`,
120
- getDescriptionId: (ctx) => ctx.ids?.description ?? `popover:${ctx.id}:desc`,
121
- getCloseTriggerId: (ctx) => ctx.ids?.closeTrigger ?? `popover:${ctx.id}:close`,
122
- getAnchorEl: (ctx) => dom.getById(ctx, dom.getAnchorId(ctx)),
123
- getTriggerEl: (ctx) => dom.getById(ctx, dom.getTriggerId(ctx)),
124
- getContentEl: (ctx) => dom.getById(ctx, dom.getContentId(ctx)),
125
- getPositionerEl: (ctx) => dom.getById(ctx, dom.getPositionerId(ctx)),
126
- getTitleEl: (ctx) => dom.getById(ctx, dom.getTitleId(ctx)),
127
- getDescriptionEl: (ctx) => dom.getById(ctx, dom.getDescriptionId(ctx)),
128
- getFocusableEls: (ctx) => getFocusables(dom.getContentEl(ctx)),
129
- getFirstFocusableEl: (ctx) => dom.getFocusableEls(ctx)[0],
130
- getDocTabbableEls: (ctx) => getTabbables(dom.getDoc(ctx).body),
131
- getTabbableEls: (ctx) => getTabbables(dom.getContentEl(ctx), "if-empty"),
132
- getFirstTabbableEl: (ctx) => getFirstTabbable(dom.getContentEl(ctx), "if-empty"),
133
- getLastTabbableEl: (ctx) => getLastTabbable(dom.getContentEl(ctx), "if-empty"),
134
- getInitialFocusEl: (ctx) => {
135
- let el = runIfFn(ctx.initialFocusEl);
136
- if (!el && ctx.autoFocus)
137
- el = dom.getFirstFocusableEl(ctx);
138
- if (!el)
139
- el = dom.getContentEl(ctx);
140
- return el;
141
- }
142
- });
143
-
144
- export {
145
- runIfFn,
146
- contains,
147
- dom
148
- };