inclusive-elements 0.4.6 → 0.5.0-beta.2

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.
@@ -1,9 +1,9 @@
1
1
  var l = Object.defineProperty;
2
2
  var p = (o, s, t) => s in o ? l(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
3
  var e = (o, s, t) => (p(o, typeof s != "symbol" ? s + "" : s, t), t);
4
- import { autoUpdate as u, computePosition as c, shift as m, flip as v } from "@floating-ui/dom";
4
+ import { autoUpdate as u, computePosition as c, shift as v, flip as m } from "@floating-ui/dom";
5
5
  import { hello as b, goodbye as f } from "hello-goodbye";
6
- const r = class extends HTMLElement {
6
+ const n = class n extends HTMLElement {
7
7
  constructor() {
8
8
  super(...arguments);
9
9
  e(this, "parent");
@@ -13,27 +13,30 @@ const r = class extends HTMLElement {
13
13
  e(this, "showing", !1);
14
14
  e(this, "cleanup");
15
15
  e(this, "prevInnerHTML");
16
+ e(this, "tabPressed", !1);
16
17
  e(this, "onMouseEnter", this.afterDelay.bind(this, this.show));
17
- e(this, "onFocus", this.show.bind(this));
18
+ e(this, "onFocus", () => {
19
+ this.tabPressed && this.show();
20
+ });
18
21
  e(this, "onMouseLeave", this.afterDelay.bind(this, this.hide));
19
22
  e(this, "onBlur", this.hide.bind(this));
20
- e(this, "onPointerUp", (t) => {
21
- t.pointerType === "mouse" ? this.hide() : this.show();
22
- });
23
23
  e(this, "onKeyDown", (t) => {
24
- t.key === "Escape" && this.hide();
24
+ t.key === "Tab" && (this.tabPressed = !0), t.key === "Escape" && this.hide();
25
+ });
26
+ e(this, "onKeyUp", (t) => {
27
+ t.key === "Tab" && (this.tabPressed = !1);
25
28
  });
26
29
  }
27
30
  connectedCallback() {
28
- this.parent = this.parentNode, this.parent && (this.parent.addEventListener("mouseenter", this.onMouseEnter), this.parent.addEventListener("focus", this.onFocus), this.parent.addEventListener("mouseleave", this.onMouseLeave), this.parent.addEventListener("blur", this.onBlur), this.parent.addEventListener("pointerup", this.onPointerUp), this.disabledObserver = new MutationObserver((t) => {
31
+ this.parent = this.parentNode, this.parent && (this.parent.addEventListener("mouseenter", this.onMouseEnter), this.parent.addEventListener("focus", this.onFocus), this.parent.addEventListener("mouseleave", this.onMouseLeave), this.parent.addEventListener("blur", this.onBlur), this.parent.addEventListener("click", this.onBlur), this.disabledObserver = new MutationObserver((t) => {
29
32
  t.forEach((i) => {
30
33
  i.attributeName === "disabled" && this.hide();
31
34
  });
32
- }), this.disabledObserver.observe(this.parent, { attributes: !0 })), document.addEventListener("keydown", this.onKeyDown), document.addEventListener("scroll", this.onBlur);
35
+ }), this.disabledObserver.observe(this.parent, { attributes: !0 })), document.addEventListener("keydown", this.onKeyDown), document.addEventListener("keyup", this.onKeyUp), document.addEventListener("scroll", this.onBlur);
33
36
  }
34
37
  disconnectedCallback() {
35
38
  var t, i;
36
- (t = this.cleanup) == null || t.call(this), this.tooltip && (this.tooltip.remove(), this.tooltip = void 0), this.parent && (this.parent.removeEventListener("mouseenter", this.onMouseEnter), this.parent.removeEventListener("focus", this.onFocus), this.parent.removeEventListener("mouseleave", this.onMouseLeave), this.parent.removeEventListener("blur", this.onBlur), this.parent.removeEventListener("pointerup", this.onPointerUp), this.parent = void 0), document.removeEventListener("keydown", this.onKeyDown), document.removeEventListener("scroll", this.onBlur), (i = this.disabledObserver) == null || i.disconnect(), clearTimeout(this.timeout);
39
+ (t = this.cleanup) == null || t.call(this), this.tooltip && (this.tooltip.remove(), this.tooltip = void 0), this.parent && (this.parent.removeEventListener("mouseenter", this.onMouseEnter), this.parent.removeEventListener("focus", this.onFocus), this.parent.removeEventListener("mouseleave", this.onMouseLeave), this.parent.removeEventListener("blur", this.onBlur), this.parent.removeEventListener("click", this.onBlur), this.parent = void 0), document.removeEventListener("keydown", this.onKeyDown), document.removeEventListener("keyup", this.onKeyUp), document.removeEventListener("scroll", this.onBlur), (i = this.disabledObserver) == null || i.disconnect(), clearTimeout(this.timeout);
37
40
  }
38
41
  get disabled() {
39
42
  return this.hasAttribute("disabled");
@@ -50,39 +53,39 @@ const r = class extends HTMLElement {
50
53
  this.parent,
51
54
  t,
52
55
  () => c(this.parent, t, {
53
- placement: this.getAttribute("placement") || r.placement,
54
- middleware: [m(), v()]
56
+ placement: this.getAttribute("placement") || n.placement,
57
+ middleware: [v(), m()]
55
58
  }).then(({ x: h, y: a, placement: d }) => {
56
59
  Object.assign(t.style, {
57
60
  left: `${h}px`,
58
61
  top: `${a}px`
59
62
  }), t.dataset.placement = d;
60
63
  })
61
- );
64
+ ), this.dispatchEvent(new Event("open"));
62
65
  }
63
66
  hide() {
64
67
  var t;
65
68
  clearTimeout(this.timeout), (t = this.cleanup) == null || t.call(this), this.showing && (this.showing = !1, f(this.tooltip).then(() => {
66
69
  this.tooltip && (this.tooltip.hidden = !0);
67
- }));
70
+ }), this.dispatchEvent(new Event("close")));
68
71
  }
69
72
  afterDelay(t) {
70
73
  clearTimeout(this.timeout);
71
74
  const i = parseInt(this.getAttribute("delay") || "");
72
75
  this.timeout = window.setTimeout(
73
76
  t.bind(this),
74
- isNaN(i) ? r.delay : i
77
+ isNaN(i) ? n.delay : i
75
78
  );
76
79
  }
77
80
  createTooltip() {
78
- return this.tooltip || (this.tooltip = document.createElement("div"), this.tooltip.className = this.getAttribute("tooltip-class") || r.tooltipClass, this.tooltip.hidden = !0, this.tooltip.addEventListener("mouseenter", this.show.bind(this)), this.tooltip.addEventListener(
81
+ return this.tooltip || (this.tooltip = document.createElement("div"), this.tooltip.hidden = !0, this.tooltip.addEventListener("mouseenter", this.show.bind(this)), this.tooltip.addEventListener(
79
82
  "mouseleave",
80
83
  this.afterDelay.bind(this, this.hide)
81
- ), document.body.appendChild(this.tooltip)), this.tooltip;
84
+ ), document.body.appendChild(this.tooltip)), this.tooltip.className = this.getAttribute("tooltip-class") || n.tooltipClass, this.tooltip;
82
85
  }
83
86
  };
84
- let n = r;
85
87
  e(n, "delay", 100), e(n, "placement", "top"), e(n, "tooltipClass", "tooltip");
88
+ let r = n;
86
89
  export {
87
- n as default
90
+ r as default
88
91
  };
@@ -1,41 +1,30 @@
1
- var c = Object.defineProperty;
2
- var m = (a, s, t) => s in a ? c(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
- var o = (a, s, t) => (m(a, typeof s != "symbol" ? s + "" : s, t), t);
4
- import { move as n, hello as u, goodbye as f } from "hello-goodbye";
5
- const h = class extends HTMLElement {
1
+ var d = Object.defineProperty;
2
+ var u = (e, s, t) => s in e ? d(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
+ var o = (e, s, t) => (u(e, typeof s != "symbol" ? s + "" : s, t), t);
4
+ const r = class r extends HTMLElement {
6
5
  constructor() {
7
- super();
8
- o(this, "added", /* @__PURE__ */ new Set());
6
+ super(...arguments);
9
7
  o(this, "timeouts", /* @__PURE__ */ new Map());
10
8
  o(this, "index", 0);
11
- new MutationObserver((i) => {
12
- i.forEach((r) => {
13
- r.addedNodes.forEach((e) => {
14
- e instanceof HTMLElement && !this.added.has(e) && this.show(e);
15
- });
16
- });
17
- }).observe(this, { childList: !0 });
18
9
  }
19
10
  connectedCallback() {
20
11
  this.hasAttribute("role") || this.setAttribute("role", "status"), this.hasAttribute("aria-live") || this.setAttribute("aria-live", "polite"), this.hasAttribute("aria-relevant") || this.setAttribute("aria-relevant", "additions");
21
12
  for (const t of this.children)
22
- this.show(t, { animate: !1 });
13
+ this.show(t);
23
14
  }
24
15
  show(t, i = {}) {
25
- const r = i.key || t.dataset.key || String(this.index++);
26
- this.dismiss(r), t.dataset.key = r, this.contains(t) ? u(t) : i.animate === !1 ? this.append(t) : n(this.children, () => {
27
- this.append(t), u(t);
28
- }), this.added.add(t);
29
- const e = Number(
30
- i.duration !== void 0 ? i.duration : t.dataset.duration || h.duration
16
+ const h = i.key || t.dataset.key || String(this.index++);
17
+ this.dismiss(h), t.dataset.key = h, this.contains(t) || this.append(t);
18
+ const a = Number(
19
+ i.duration !== void 0 ? i.duration : t.dataset.duration || r.duration
31
20
  );
32
- return e > 0 && (this.startTimeout(t, e), t.addEventListener("mouseenter", this.clearTimeout.bind(this, t)), t.addEventListener("focusin", this.clearTimeout.bind(this, t)), t.addEventListener(
21
+ return a > 0 && (this.startTimeout(t, a), t.addEventListener("mouseenter", this.clearTimeout.bind(this, t)), t.addEventListener("focusin", this.clearTimeout.bind(this, t)), t.addEventListener(
33
22
  "mouseleave",
34
- this.startTimeout.bind(this, t, e)
23
+ this.startTimeout.bind(this, t, a)
35
24
  ), t.addEventListener(
36
25
  "focusout",
37
- this.startTimeout.bind(this, t, e)
38
- )), r;
26
+ this.startTimeout.bind(this, t, a)
27
+ )), h;
39
28
  }
40
29
  dismiss(t) {
41
30
  if (typeof t == "string") {
@@ -44,10 +33,7 @@ const h = class extends HTMLElement {
44
33
  ).forEach((i) => this.dismiss(i));
45
34
  return;
46
35
  }
47
- this.added.delete(t), n(
48
- this.children,
49
- () => f(t).then(() => t.remove())
50
- ), this.clearTimeout(t);
36
+ t.remove(), this.clearTimeout(t);
51
37
  }
52
38
  clear() {
53
39
  Array.from(this.children).forEach((t) => {
@@ -78,8 +64,8 @@ const h = class extends HTMLElement {
78
64
  this.timeouts.has(t) && clearTimeout(this.timeouts.get(t));
79
65
  }
80
66
  };
81
- let d = h;
82
- o(d, "duration", 1e4);
67
+ o(r, "duration", 1e4);
68
+ let n = r;
83
69
  export {
84
- d as default
70
+ n as default
85
71
  };
@@ -2,7 +2,7 @@ var c = Object.defineProperty;
2
2
  var u = (r, e, t) => e in r ? c(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var n = (r, e, t) => (u(r, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  import { isFocusable as l } from "tabbable";
5
- const o = class extends HTMLElement {
5
+ const a = class a extends HTMLElement {
6
6
  constructor() {
7
7
  super(...arguments);
8
8
  n(this, "search", "");
@@ -19,7 +19,7 @@ const o = class extends HTMLElement {
19
19
  }
20
20
  t.key.length > 1 || t.ctrlKey || t.metaKey || t.altKey || (this.search += t.key.toLowerCase(), t.preventDefault(), clearTimeout(this.searchTimeout), this.searchTimeout = window.setTimeout(() => {
21
21
  this.search = "";
22
- }, o.searchDelay), this.items.some((s) => {
22
+ }, a.searchDelay), this.items.some((s) => {
23
23
  var i;
24
24
  return ((i = s.textContent) == null ? void 0 : i.trim().toLowerCase().indexOf(this.search)) === 0 ? (s.focus(), !0) : !1;
25
25
  }));
@@ -40,14 +40,14 @@ const o = class extends HTMLElement {
40
40
  ).filter((t) => l(t));
41
41
  }
42
42
  navigate(t) {
43
- var h;
43
+ var o;
44
44
  const s = this.items;
45
45
  let i = (document.activeElement instanceof HTMLElement ? s.indexOf(document.activeElement) : -1) + t;
46
- i < 0 && (i = s.length - 1), i >= s.length && (i = 0), (h = s[i]) == null || h.focus();
46
+ i < 0 && (i = s.length - 1), i >= s.length && (i = 0), (o = s[i]) == null || o.focus();
47
47
  }
48
48
  };
49
- let a = o;
50
49
  n(a, "searchDelay", 800);
50
+ let h = a;
51
51
  export {
52
- a as default
52
+ h as default
53
53
  };
@@ -1,9 +1,9 @@
1
- var p = Object.defineProperty;
2
- var u = (n, s, t) => s in n ? p(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
3
- var a = (n, s, t) => (u(n, typeof s != "symbol" ? s + "" : s, t), t);
1
+ var u = Object.defineProperty;
2
+ var p = (o, e, t) => e in o ? u(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var a = (o, e, t) => (p(o, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  import { createFocusTrap as f } from "focus-trap";
5
- import { hello as b, goodbye as v } from "hello-goodbye";
6
- const o = class extends HTMLElement {
5
+ import { hello as b, goodbye as m } from "hello-goodbye";
6
+ const n = class n extends HTMLElement {
7
7
  constructor() {
8
8
  super();
9
9
  a(this, "focusTrap");
@@ -13,22 +13,23 @@ const o = class extends HTMLElement {
13
13
  <div part="backdrop" style="position: fixed; top: 0; left: 0; right: 0; bottom: 0"></div>
14
14
  <div part="content" style="z-index: 1"><slot></slot></div>
15
15
  `;
16
- const e = this.attachShadow({ mode: "open" });
17
- e.appendChild(t.content.cloneNode(!0)), this.backdrop.addEventListener("click", () => {
18
- var i;
19
- this.hasAttribute("static") ? (i = o.attention) == null || i.call(o, e.children[1]) : this.close();
16
+ const i = this.attachShadow({ mode: "open" });
17
+ i.appendChild(t.content.cloneNode(!0)), this.backdrop.addEventListener("click", () => {
18
+ var s;
19
+ this.hasAttribute("static") ? (s = n.attention) == null || s.call(n, i.children[1]) : this.close();
20
20
  }), this.focusTrap = f(this, {
21
21
  escapeDeactivates: !1,
22
22
  allowOutsideClick: !0,
23
- preventScroll: !0
23
+ preventScroll: !0,
24
+ initialFocus: () => this.querySelector("[autofocus]") || void 0
24
25
  });
25
26
  }
26
27
  static get observedAttributes() {
27
28
  return ["open"];
28
29
  }
29
30
  connectedCallback() {
30
- var t, e, i, h, l, d;
31
- this.connected = !0, (t = this.content) != null && t.hasAttribute("role") || (e = this.content) == null || e.setAttribute("role", "dialog"), (i = this.content) != null && i.hasAttribute("aria-modal") || (h = this.content) == null || h.setAttribute("aria-modal", "true"), (l = this.content) != null && l.hasAttribute("tabindex") || (d = this.content) == null || d.setAttribute("tabindex", "-1"), this.addEventListener("keydown", (r) => {
31
+ var t, i, s, c, h, l;
32
+ this.connected = !0, (t = this.content) != null && t.hasAttribute("role") || (i = this.content) == null || i.setAttribute("role", "dialog"), (s = this.content) != null && s.hasAttribute("aria-modal") || (c = this.content) == null || c.setAttribute("aria-modal", "true"), (h = this.content) != null && h.hasAttribute("tabindex") || (l = this.content) == null || l.setAttribute("tabindex", "-1"), this.addEventListener("keydown", (r) => {
32
33
  r.key === "Escape" && this.open && (r.preventDefault(), r.stopPropagation(), this.close());
33
34
  }), this.open && this.wasOpened();
34
35
  }
@@ -47,16 +48,18 @@ const o = class extends HTMLElement {
47
48
  const t = new Event("beforeclose", { cancelable: !0 });
48
49
  this.dispatchEvent(t) && (this.open = !1);
49
50
  }
50
- attributeChangedCallback(t, e, i) {
51
- t !== "open" || !this.connected || (i !== null ? this.wasOpened() : this.wasClosed());
51
+ attributeChangedCallback(t, i, s) {
52
+ t !== "open" || !this.connected || (s !== null ? this.wasOpened() : this.wasClosed());
52
53
  }
53
- wasOpened() {
54
- var t, e;
55
- this.hidden = !1, b(this), (t = this.focusTrap) == null || t.activate(), (e = this.querySelector("[autofocus]")) == null || e.focus(), this.dispatchEvent(new Event("open"));
54
+ async wasOpened() {
55
+ document.documentElement.style.overflow = "hidden", this.hidden = !1, b(this), requestAnimationFrame(() => {
56
+ var t;
57
+ return (t = this.focusTrap) == null ? void 0 : t.activate();
58
+ }), this.dispatchEvent(new Event("open"));
56
59
  }
57
60
  wasClosed() {
58
61
  var t;
59
- (t = this.focusTrap) == null || t.deactivate(), v(this).then(() => this.hidden = !0), this.dispatchEvent(new Event("close"));
62
+ document.documentElement.style.overflow = "", (t = this.focusTrap) == null || t.deactivate(), m(this).then(() => this.hidden = !0), this.dispatchEvent(new Event("close"));
60
63
  }
61
64
  get backdrop() {
62
65
  var t;
@@ -66,8 +69,7 @@ const o = class extends HTMLElement {
66
69
  return this.firstElementChild;
67
70
  }
68
71
  };
69
- let c = o;
70
- a(c, "attention", (t) => t.animate(
72
+ a(n, "attention", (t) => t.animate(
71
73
  [
72
74
  { transform: "scale(1)" },
73
75
  { transform: "scale(1.1)" },
@@ -75,6 +77,7 @@ a(c, "attention", (t) => t.animate(
75
77
  ],
76
78
  300
77
79
  ));
80
+ let d = n;
78
81
  export {
79
- c as default
82
+ d as default
80
83
  };
@@ -1,28 +1,28 @@
1
1
  var u = Object.defineProperty;
2
- var d = (i, n, t) => n in i ? u(i, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[n] = t;
3
- var o = (i, n, t) => (d(i, typeof n != "symbol" ? n + "" : n, t), t);
4
- import { autoUpdate as l, computePosition as p, shift as b, flip as f, size as m } from "@floating-ui/dom";
5
- import { cancel as r, hello as a, goodbye as c } from "hello-goodbye";
6
- import { focusable as k } from "tabbable";
2
+ var p = (r, n, t) => n in r ? u(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
+ var s = (r, n, t) => (p(r, typeof n != "symbol" ? n + "" : n, t), t);
4
+ import { autoUpdate as l, computePosition as f, shift as m, flip as b, size as k } from "@floating-ui/dom";
5
+ import { cancel as a, hello as h, goodbye as c } from "hello-goodbye";
6
+ import { focusable as g } from "tabbable";
7
7
  import { shouldOpenInNewTab as v } from "./inclusive-elements11.js";
8
- class C extends HTMLElement {
8
+ class A extends HTMLElement {
9
9
  constructor() {
10
10
  super();
11
- o(this, "cleanup");
12
- o(this, "onButtonClick", (t) => {
11
+ s(this, "cleanup");
12
+ s(this, "onButtonClick", (t) => {
13
13
  !v(t) && !this.disabled && (this.open = !this.open, t.preventDefault());
14
14
  });
15
- o(this, "onButtonKeyDown", (t) => {
15
+ s(this, "onButtonKeyDown", (t) => {
16
16
  var e;
17
- t.key === "ArrowDown" && !this.disabled && (t.preventDefault(), this.open = !0, (e = k(this.content)[0]) == null || e.focus());
17
+ t.key === "ArrowDown" && !this.disabled && (t.preventDefault(), this.open = !0, (e = g(this.content)[0]) == null || e.focus());
18
18
  });
19
- o(this, "onKeyDown", (t) => {
19
+ s(this, "onKeyDown", (t) => {
20
20
  t.key === "Escape" && this.open && (t.preventDefault(), t.stopPropagation(), this.open = !1, this.button.focus());
21
21
  });
22
- o(this, "onFocusOut", (t) => {
22
+ s(this, "onFocusOut", (t) => {
23
23
  (!(t.relatedTarget instanceof Node) || !this.contains(t.relatedTarget)) && (this.open = !1);
24
24
  });
25
- o(this, "onContentClick", (t) => {
25
+ s(this, "onContentClick", (t) => {
26
26
  t.target instanceof Element && t.target.closest("[role=menuitem], [role=menuitemradio]") && (this.open = !1, this.button.focus());
27
27
  });
28
28
  const t = document.createElement("template");
@@ -40,7 +40,7 @@ class C extends HTMLElement {
40
40
  }), this.button.addEventListener("click", this.onButtonClick), this.button.addEventListener("keydown", this.onButtonKeyDown), this.addEventListener("keydown", this.onKeyDown), this.addEventListener("focusout", this.onFocusOut), this.content.addEventListener("click", this.onContentClick);
41
41
  }
42
42
  disconnectedCallback() {
43
- r(this.backdrop), r(this.content), this.button.removeAttribute("aria-expanded"), this.button.removeAttribute("aria-haspopup"), this.button.removeEventListener("click", this.onButtonClick), this.button.removeEventListener("keydown", this.onButtonKeyDown), this.removeEventListener("keydown", this.onKeyDown), this.removeEventListener("focusout", this.onFocusOut), this.content.removeEventListener("click", this.onContentClick);
43
+ a(this.backdrop), a(this.content), this.button.removeAttribute("aria-expanded"), this.button.removeAttribute("aria-haspopup"), this.button.removeEventListener("click", this.onButtonClick), this.button.removeEventListener("keydown", this.onButtonKeyDown), this.removeEventListener("keydown", this.onKeyDown), this.removeEventListener("focusout", this.onFocusOut), this.content.removeEventListener("click", this.onContentClick);
44
44
  }
45
45
  get open() {
46
46
  return this.hasAttribute("open");
@@ -51,37 +51,42 @@ class C extends HTMLElement {
51
51
  get disabled() {
52
52
  return this.hasAttribute("disabled");
53
53
  }
54
- attributeChangedCallback(t, e, s) {
55
- t === "open" && (s !== null ? this.wasOpened() : this.wasClosed());
54
+ attributeChangedCallback(t, e, i) {
55
+ t === "open" && (i !== null ? this.wasOpened() : this.wasClosed());
56
56
  }
57
57
  wasOpened() {
58
58
  if (!this.content.hidden)
59
59
  return;
60
- this.content.hidden = !1, this.content.style.position = "absolute", this.backdrop.hidden = !1, a(this.content), a(this.backdrop), this.button.setAttribute("aria-expanded", "true"), this.cleanup = l(
60
+ this.content.hidden = !1, this.content.style.position = "fixed", this.backdrop.hidden = !1, h(this.content), h(this.backdrop), this.button.setAttribute("aria-expanded", "true"), this.cleanup = l(
61
61
  this.button,
62
62
  this.content,
63
63
  () => {
64
- p(this.button, this.content, {
64
+ f(this.button, this.content, {
65
+ strategy: "fixed",
65
66
  placement: this.getAttribute("placement") || "bottom",
66
67
  middleware: [
68
+ m(),
67
69
  b(),
68
- f(),
69
- m({
70
- apply: ({ availableWidth: e, availableHeight: s }) => {
71
- Object.assign(this.content.style, {
70
+ k({
71
+ apply: ({
72
+ availableWidth: e,
73
+ availableHeight: i,
74
+ placement: d
75
+ }) => {
76
+ this.content.dataset.placement = d, Object.assign(this.content.style, {
72
77
  maxWidth: "",
73
78
  maxHeight: ""
74
79
  });
75
- const h = getComputedStyle(this.content);
76
- (h.maxWidth === "none" || e < parseInt(h.maxWidth)) && (this.content.style.maxWidth = `${e}px`), (h.maxHeight === "none" || s < parseInt(h.maxHeight)) && (this.content.style.maxHeight = `${s}px`);
80
+ const o = getComputedStyle(this.content);
81
+ e -= parseInt(o.marginLeft) + parseInt(o.marginRight), (o.maxWidth === "none" || e < parseInt(o.maxWidth)) && (this.content.style.maxWidth = `${e}px`), i -= parseInt(o.marginTop) + parseInt(o.marginBottom), (o.maxHeight === "none" || i < parseInt(o.maxHeight)) && (this.content.style.maxHeight = `${i}px`);
77
82
  }
78
83
  })
79
84
  ]
80
- }).then(({ x: e, y: s, placement: h }) => {
85
+ }).then(({ x: e, y: i }) => {
81
86
  Object.assign(this.content.style, {
82
87
  left: `${e}px`,
83
- top: `${s}px`
84
- }), this.content.dataset.placement = h;
88
+ top: `${i}px`
89
+ });
85
90
  });
86
91
  },
87
92
  { ancestorScroll: !1 }
@@ -105,5 +110,5 @@ class C extends HTMLElement {
105
110
  }
106
111
  }
107
112
  export {
108
- C as default
113
+ A as default
109
114
  };
@@ -1,14 +1,11 @@
1
1
  export type AlertOptions = {
2
2
  key?: string;
3
3
  duration?: number;
4
- animate?: boolean;
5
4
  };
6
5
  export default class AlertsElement extends HTMLElement {
7
6
  static duration: number;
8
- private added;
9
7
  private timeouts;
10
8
  private index;
11
- constructor();
12
9
  connectedCallback(): void;
13
10
  show(el: HTMLElement, options?: AlertOptions): string;
14
11
  dismiss(el: HTMLElement): void;
@@ -9,18 +9,19 @@ export default class TooltipElement extends HTMLElement {
9
9
  private showing;
10
10
  private cleanup?;
11
11
  private prevInnerHTML?;
12
+ private tabPressed;
12
13
  private onMouseEnter;
13
14
  private onFocus;
14
15
  private onMouseLeave;
15
16
  private onBlur;
16
- private onPointerUp;
17
17
  connectedCallback(): void;
18
18
  disconnectedCallback(): void;
19
19
  get disabled(): boolean;
20
20
  set disabled(val: boolean);
21
21
  private onKeyDown;
22
- private show;
23
- private hide;
22
+ private onKeyUp;
23
+ show(): void;
24
+ hide(): void;
24
25
  private afterDelay;
25
26
  private createTooltip;
26
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inclusive-elements",
3
- "version": "0.4.6",
3
+ "version": "0.5.0-beta.2",
4
4
  "description": "Accessible, lightweight, unstyled implementations of common UI controls.",
5
5
  "module": "dist/inclusive-elements.js",
6
6
  "type": "module",
@@ -18,17 +18,17 @@
18
18
  "release": "release-it"
19
19
  },
20
20
  "dependencies": {
21
- "@floating-ui/dom": "^1.4.2",
22
- "focus-trap": "^6.9.4",
21
+ "@floating-ui/dom": "^1.5.3",
22
+ "focus-trap": "^7.5.3",
23
23
  "hello-goodbye": "^0.2.1",
24
- "tabbable": "^5.3.3"
24
+ "tabbable": "^6.2.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@release-it/conventional-changelog": "^5.1.1",
28
28
  "prettier": "^2.8.8",
29
29
  "release-it": "^15.11.0",
30
- "typescript": "^5.1.3",
31
- "vite": "^4.3.9"
30
+ "typescript": "^5.2.2",
31
+ "vite": "^4.4.11"
32
32
  },
33
33
  "release-it": {
34
34
  "git": {