@ulu/frontend 0.2.0-beta.8 → 0.2.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 (53) hide show
  1. package/README.dev.md +36 -13
  2. package/README.md +3 -1
  3. package/dist/es/core/events.js +36 -25
  4. package/dist/es/core/settings.js +33 -22
  5. package/dist/es/index.js +92 -88
  6. package/dist/es/ui/dialog.js +57 -46
  7. package/dist/es/ui/index.d.ts +2 -0
  8. package/dist/es/ui/modal-builder.js +39 -28
  9. package/dist/es/ui/overflow-scroller.js +30 -24
  10. package/dist/es/ui/programmatic-modal.js +55 -0
  11. package/dist/es/ui/proxy-click.js +37 -26
  12. package/dist/es/ui/resizer.js +57 -49
  13. package/dist/es/ui/slider.d.ts.map +1 -1
  14. package/dist/es/ui/slider.js +90 -67
  15. package/dist/es/ui/tab-manager.d.ts +145 -0
  16. package/dist/es/ui/tab-manager.d.ts.map +1 -0
  17. package/dist/es/ui/tab-manager.js +155 -0
  18. package/dist/es/ui/tabs.d.ts +5 -5
  19. package/dist/es/ui/tabs.d.ts.map +1 -1
  20. package/dist/es/ui/tabs.js +34 -51
  21. package/dist/es/ui/theme-toggle.js +80 -69
  22. package/dist/es/ui/tooltip.js +53 -44
  23. package/dist/es/utils/floating-ui.js +35 -24
  24. package/dist/umd/frontend.css +1 -0
  25. package/dist/umd/ulu-frontend.umd.js +40 -47
  26. package/lib/js/exports.md +1 -0
  27. package/lib/js/ui/index.js +8 -0
  28. package/lib/js/ui/slider.js +3 -3
  29. package/lib/js/ui/tab-manager.js +324 -0
  30. package/lib/js/ui/tabs.js +33 -92
  31. package/lib/scss/_breakpoint.scss +3 -3
  32. package/lib/scss/_button.scss +3 -3
  33. package/lib/scss/_color.scss +3 -2
  34. package/lib/scss/_element.scss +10 -4
  35. package/lib/scss/_layout.scss +11 -4
  36. package/lib/scss/_selector.scss +2 -1
  37. package/lib/scss/_typography.scss +9 -10
  38. package/lib/scss/_utils.scss +52 -19
  39. package/lib/scss/base/_elements.scss +1 -1
  40. package/lib/scss/components/_basic-hero.scss +1 -1
  41. package/lib/scss/components/_button-verbose.scss +2 -2
  42. package/lib/scss/components/_callout.scss +3 -4
  43. package/lib/scss/components/_css-icon.scss +2 -2
  44. package/lib/scss/components/_data-grid.scss +5 -5
  45. package/lib/scss/components/_flipcard.scss +3 -2
  46. package/lib/scss/components/_index.scss +6 -0
  47. package/lib/scss/components/_panel.scss +1 -1
  48. package/lib/scss/components/_popover.scss +9 -6
  49. package/lib/scss/components/_tabs.scss +20 -5
  50. package/lib/scss/components/_tagged.scss +59 -0
  51. package/package.json +25 -35
  52. package/dist/umd/style.css +0 -1
  53. package/lib/js/ui/dialog.todo +0 -3
@@ -1,64 +1,47 @@
1
- import f from "aria-tablist";
2
- import { ComponentInitializer as u } from "../core/component.js";
3
- const l = [], p = new u({
1
+ var u = Object.defineProperty;
2
+ var s = Object.getOwnPropertySymbols;
3
+ var d = Object.prototype.hasOwnProperty, f = Object.prototype.propertyIsEnumerable;
4
+ var c = (i, e, t) => e in i ? u(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, l = (i, e) => {
5
+ for (var t in e || (e = {}))
6
+ d.call(e, t) && c(i, t, e[t]);
7
+ if (s)
8
+ for (var t of s(e))
9
+ f.call(e, t) && c(i, t, e[t]);
10
+ return i;
11
+ };
12
+ import { TabManager as p } from "./tab-manager.js";
13
+ import { ComponentInitializer as b } from "../core/component.js";
14
+ import { ensureId as m } from "../utils/id.js";
15
+ const h = [], w = new b({
4
16
  type: "tabs",
5
17
  baseAttribute: "data-ulu-tablist"
6
18
  });
7
- function E() {
8
- const e = () => {
9
- p.init({
19
+ function M() {
20
+ const i = () => {
21
+ w.init({
10
22
  coreEvents: ["pageModified"],
11
23
  withData: !0,
12
- setup({ element: n, data: t, initialize: o }) {
13
- m(n, t), o();
24
+ setup({ element: e, data: t, initialize: o }) {
25
+ y(e, t), o();
14
26
  }
15
- }), l.forEach(b);
27
+ });
16
28
  };
17
- document.readyState === "complete" ? e() : window.addEventListener("load", e);
18
- }
19
- function m(e, n = {}) {
20
- const t = Object.assign({}, n);
21
- t.vertical && (t.allArrows = !0);
22
- const o = { element: e, options: n };
23
- return o.ariaTablist = f(e, {
24
- onOpen(...a) {
25
- a.unshift(o), g.apply(null, a);
26
- },
27
- ...t
28
- }), l.push(o), t.equalHeights && w(e), o;
29
+ document.readyState === "complete" ? i() : window.addEventListener("load", i);
29
30
  }
30
- function b({ options: e, ariaTablist: n }) {
31
- if (e.openByUrlHash) {
32
- const { hash: t } = window.location;
33
- if (t && t.length > 1) {
34
- const o = t.substring(1);
35
- n.tabs.forEach((a) => {
36
- o === a.id && n.open(a);
37
- });
31
+ function y(i, e = {}) {
32
+ const t = l({}, e);
33
+ t.vertical && (t.allArrows = !0), t.openByUrlHash && (t.setUrlHash = !0), [...i.children].forEach((n) => {
34
+ if (!n.hasAttribute("aria-controls")) {
35
+ const r = document.querySelector(`[aria-labelledby="${n.id}"]`);
36
+ r && (m(r), n.setAttribute("aria-controls", r.id));
38
37
  }
39
- }
40
- }
41
- function g({ options: e }, n, t) {
42
- e.openByUrlHash && window.history && window.history.replaceState(null, "", `#${t.id}`);
43
- }
44
- function w(e) {
45
- const t = [...e.children].map((i) => document.querySelector(`[aria-labelledby="${i.id}"]`)), h = [...t[0].parentElement.querySelectorAll("img")].map((i) => d(i));
46
- function d(i) {
47
- return new Promise((r) => {
48
- i.complete ? r(i) : (i.onload = r, i.onerror = r);
49
- });
50
- }
51
- Promise.all(h).then(() => {
52
- const i = t.map((s) => {
53
- let c = s.offsetHeight;
54
- return s.hidden && (s.hidden = !1, c = s.offsetHeight, s.setAttribute("hidden", "hidden")), c;
55
- }), r = Math.max(...i);
56
- t.forEach((s) => s.style.minHeight = `${r}px`);
57
38
  });
39
+ const a = { element: i, options: e };
40
+ return a.tabManager = new p(i, t), h.push(a), a;
58
41
  }
59
42
  export {
60
- E as init,
61
- p as initializer,
62
- l as instances,
63
- m as setup
43
+ M as init,
44
+ w as initializer,
45
+ h as instances,
46
+ y as setup
64
47
  };
@@ -1,16 +1,28 @@
1
- import { ComponentInitializer as M } from "../core/component.js";
2
- import { getCoreEventName as y } from "../core/events.js";
3
- import { resolveClasses as b } from "../utils/dom.js";
4
- import { hasRequiredProps as q } from "@ulu/utils/object.js";
5
- import { getElements as I } from "@ulu/utils/browser/dom.js";
6
- const c = new M({
1
+ var j = Object.defineProperty, O = Object.defineProperties;
2
+ var R = Object.getOwnPropertyDescriptors;
3
+ var C = Object.getOwnPropertySymbols;
4
+ var w = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
5
+ var E = (e, t, r) => t in e ? j(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, h = (e, t) => {
6
+ for (var r in t || (t = {}))
7
+ w.call(t, r) && E(e, r, t[r]);
8
+ if (C)
9
+ for (var r of C(t))
10
+ K.call(t, r) && E(e, r, t[r]);
11
+ return e;
12
+ }, b = (e, t) => O(e, R(t));
13
+ import { ComponentInitializer as D } from "../core/component.js";
14
+ import { getCoreEventName as k } from "../core/events.js";
15
+ import { resolveClasses as y } from "../utils/dom.js";
16
+ import { hasRequiredProps as z } from "@ulu/utils/object.js";
17
+ import { getElements as A } from "@ulu/utils/browser/dom.js";
18
+ const c = new D({
7
19
  type: "theme-toggle",
8
20
  baseAttribute: "data-ulu-theme-toggle"
9
- }), Q = c.attributeSelector("label"), $ = c.attributeSelector("icon"), L = c.getAttribute("remote"), v = c.getAttribute("init"), S = c.getAttribute("state"), j = (e) => document.querySelectorAll(
10
- `[${L}="${e}"]`
11
- ), C = (e) => document.querySelectorAll(
12
- `[${L}="${e}"]:not([${v}])`
13
- ), T = ["target"], O = q(T), E = (e, r) => e ? r() : null, P = {
21
+ }), _ = c.attributeSelector("label"), N = c.attributeSelector("icon"), M = c.getAttribute("remote"), S = c.getAttribute("init"), x = c.getAttribute("state"), F = (e) => document.querySelectorAll(
22
+ `[${M}="${e}"]`
23
+ ), I = (e) => document.querySelectorAll(
24
+ `[${M}="${e}"]:not([${S}])`
25
+ ), q = ["target"], U = z(q), L = (e, t) => e ? t() : null, Q = {
14
26
  /**
15
27
  * Object of each theme that should be toggle/cycled through
16
28
  */
@@ -66,125 +78,124 @@ const c = new M({
66
78
  */
67
79
  debug: !1
68
80
  };
69
- let k = { ...P };
70
- function G(e) {
71
- k = Object.assign({}, k, e);
81
+ let T = h({}, Q);
82
+ function re(e) {
83
+ T = Object.assign({}, T, e);
72
84
  }
73
- function H() {
85
+ function oe() {
74
86
  c.init({
75
87
  coreEvents: ["pageModified"],
76
88
  withData: !0,
77
- setup({ element: e, data: r, initialize: o }) {
78
- R(e, r), o();
89
+ setup({ element: e, data: t, initialize: r }) {
90
+ B(e, t), r();
79
91
  }
80
92
  });
81
93
  }
82
- function R(e, r) {
83
- const o = Object.assign({}, P, r);
84
- if (!O(o)) {
85
- console.error(`Missing a required option: ${T.join(", ")}`);
94
+ function B(e, t) {
95
+ const r = Object.assign({}, Q, t);
96
+ if (!U(r)) {
97
+ console.error(`Missing a required option: ${q.join(", ")}`);
86
98
  return;
87
99
  }
88
- const t = o.group, n = { toggle: e, options: o }, u = w(o);
100
+ const o = r.group, n = { toggle: e, options: r }, u = G(r);
89
101
  if (!u) {
90
102
  console.error("Unable to resolve initial key");
91
103
  return;
92
104
  }
93
- p(u, n), e.addEventListener("click", a), l(), document.addEventListener(y("pageModified"), l);
105
+ v(u, n), e.addEventListener("click", a), l(), document.addEventListener(k("pageModified"), l);
94
106
  function s(g) {
95
- const d = I(o.target)[0].dataset.uluThemeToggleState, f = D(d, o);
107
+ const d = A(r.target)[0].dataset.uluThemeToggleState, f = J(d, r);
96
108
  if (!f) {
97
109
  console.error("Issue getting next theme key");
98
110
  return;
99
111
  }
100
- p(f, { ...n, event: g });
112
+ v(f, b(h({}, n), { event: g }));
101
113
  }
102
114
  function a(g) {
103
115
  s(g);
104
116
  }
105
117
  function l() {
106
- if (!t) return;
107
- C(t).forEach((i) => {
118
+ if (!o) return;
119
+ I(o).forEach((i) => {
108
120
  i.addEventListener("click", a), c.initializeElement(i);
109
121
  });
110
122
  }
111
123
  function m() {
112
- if (!t) return;
113
- C(t).forEach((i) => {
114
- i.removeEventListener("click", a), i.removeAttribute(v, "");
124
+ if (!o) return;
125
+ I(o).forEach((i) => {
126
+ i.removeEventListener("click", a), i.removeAttribute(S, "");
115
127
  });
116
128
  }
117
- function h() {
118
- e.removeEventListener("click", a), e.removeAttribute(v, ""), m(), document.removeEventListener(y("pageModified"), l);
129
+ function p() {
130
+ e.removeEventListener("click", a), e.removeAttribute(S, ""), m(), document.removeEventListener(k("pageModified"), l);
119
131
  }
120
132
  return {
121
- destroy: h,
133
+ destroy: p,
122
134
  toggle: e,
123
- options: o,
135
+ options: r,
124
136
  toggleState: s,
125
137
  setState(g) {
126
- p(g, n);
138
+ v(g, n);
127
139
  }
128
140
  };
129
141
  }
130
- function p(e, r) {
142
+ function v(e, t) {
131
143
  if (!e) {
132
144
  console.error("Missing key");
133
145
  return;
134
146
  }
135
- const { toggle: o, options: t } = r, { themes: n, group: u } = t, s = {
136
- targets: I(t.target),
137
- toggles: [o, ...u ? j(u) : []]
147
+ const { toggle: r, options: o } = t, { themes: n, group: u } = o, s = {
148
+ targets: A(o.target),
149
+ toggles: [r, ...u ? F(u) : []]
138
150
  };
139
151
  if (!s.targets.length || !s.toggles.length) {
140
152
  console.error("Issue setting state, couldn't find needed elements", s);
141
153
  return;
142
154
  }
143
- const a = n[e], l = z(e, n), m = {
144
- ...r,
155
+ const a = n[e], l = V(e, n), m = b(h({}, t), {
145
156
  key: e,
146
157
  elements: s,
147
158
  theme: a,
148
159
  otherThemes: l
149
- };
150
- t.debug && c.log("Set state context", m);
151
- const h = x(l, "targetClass"), g = x(l, "iconClass");
160
+ });
161
+ o.debug && c.log("Set state context", m);
162
+ const p = P(l, "targetClass"), g = P(l, "iconClass");
152
163
  s.targets.forEach((i) => {
153
- i.setAttribute(S, e), i.classList.remove(...h), i.classList.add(...b(a.targetClass));
164
+ i.setAttribute(x, e), i.classList.remove(...p), i.classList.add(...y(a.targetClass));
154
165
  }), s.toggles.forEach((i) => {
155
- const d = i.querySelector(Q), f = i.querySelector($);
156
- d && (d.textContent = a.label), f && (f.classList.remove(...g), f.classList.add(...b(a.iconClass))), i.setAttribute(S, e);
157
- }), t.onChange && t.onChange(m), t.savePreference && localStorage.setItem(A(t), e);
166
+ const d = i.querySelector(_), f = i.querySelector(N);
167
+ d && (d.textContent = a.label), f && (f.classList.remove(...g), f.classList.add(...y(a.iconClass))), i.setAttribute(x, e);
168
+ }), o.onChange && o.onChange(m), o.savePreference && localStorage.setItem($(o), e);
158
169
  }
159
- function w(e) {
160
- const { savePreference: r, checkMediaQuery: o, themes: t, initialState: n } = e, u = A(e), s = E(r, () => localStorage.getItem(u)), a = E(o, () => K(t)), l = s || a || n;
170
+ function G(e) {
171
+ const { savePreference: t, checkMediaQuery: r, themes: o, initialState: n } = e, u = $(e), s = L(t, () => localStorage.getItem(u)), a = L(r, () => H(o)), l = s || a || n;
161
172
  return e.debug && (c.log("Preference Saved", s), c.log("Media Query Preference", a), c.log("Initial State:", n)), l || c.logError("Failed to resolve initial theme (pass 'initialState' to options)"), l;
162
173
  }
163
- function K(e) {
164
- const r = Object.entries(e).find(([o, t]) => {
165
- if (t.mediaQuery)
166
- return window.matchMedia(t.mediaQuery).matches;
174
+ function H(e) {
175
+ const t = Object.entries(e).find(([r, o]) => {
176
+ if (o.mediaQuery)
177
+ return window.matchMedia(o.mediaQuery).matches;
167
178
  });
168
- return r ? r[0] : null;
179
+ return t ? t[0] : null;
169
180
  }
170
- function D(e, r) {
171
- const { themes: o } = r, t = Object.keys(o), n = t.findIndex((s) => s === e), u = n === -1 ? 0 : (n + 1) % t.length;
172
- return t[u];
181
+ function J(e, t) {
182
+ const { themes: r } = t, o = Object.keys(r), n = o.findIndex((s) => s === e), u = n === -1 ? 0 : (n + 1) % o.length;
183
+ return o[u];
173
184
  }
174
- function z(e, r) {
175
- return Object.entries(r).filter(([t]) => t !== e).map(([t, n]) => n);
185
+ function V(e, t) {
186
+ return Object.entries(t).filter(([o]) => o !== e).map(([o, n]) => n);
176
187
  }
177
- function x(e, r) {
178
- return e.reduce((o, t) => o.concat(b(t[r])), []);
188
+ function P(e, t) {
189
+ return e.reduce((r, o) => r.concat(y(o[t])), []);
179
190
  }
180
- function A(e) {
181
- const { storagePrefix: r, group: o } = e;
182
- return o ? `${r}${o}` : r;
191
+ function $(e) {
192
+ const { storagePrefix: t, group: r } = e;
193
+ return r ? `${t}${r}` : t;
183
194
  }
184
195
  export {
185
- P as defaults,
186
- H as init,
196
+ Q as defaults,
197
+ oe as init,
187
198
  c as initializer,
188
- G as setDefaults,
189
- R as setupToggle
199
+ re as setDefaults,
200
+ B as setupToggle
190
201
  };
@@ -1,23 +1,32 @@
1
- var f = Object.defineProperty;
2
- var g = (l, t, e) => t in l ? f(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
3
- var u = (l, t, e) => g(l, typeof t != "symbol" ? t + "" : t, e);
4
- import { ComponentInitializer as v } from "../core/component.js";
5
- import { getUluEventName as E } from "../core/events.js";
6
- import { createFloatingUi as y } from "../utils/floating-ui.js";
7
- import { createElementFromHtml as C } from "@ulu/utils/browser/dom.js";
8
- import { logError as p } from "../utils/class-logger.js";
9
- import { ensureId as b, newId as w } from "../utils/id.js";
10
- const d = new v({
1
+ var E = Object.defineProperty;
2
+ var f = Object.getOwnPropertySymbols;
3
+ var y = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
4
+ var u = (i, t, e) => t in i ? E(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, g = (i, t) => {
5
+ for (var e in t || (t = {}))
6
+ y.call(t, e) && u(i, e, t[e]);
7
+ if (f)
8
+ for (var e of f(t))
9
+ C.call(t, e) && u(i, e, t[e]);
10
+ return i;
11
+ };
12
+ var m = (i, t, e) => u(i, typeof t != "symbol" ? t + "" : t, e);
13
+ import { ComponentInitializer as b } from "../core/component.js";
14
+ import { getUluEventName as w } from "../core/events.js";
15
+ import { createFloatingUi as A } from "../utils/floating-ui.js";
16
+ import { createElementFromHtml as H } from "@ulu/utils/browser/dom.js";
17
+ import { logError as v } from "../utils/class-logger.js";
18
+ import { ensureId as S, newId as I } from "../utils/id.js";
19
+ const d = new b({
11
20
  type: "tooltip",
12
21
  baseAttribute: "data-ulu-tooltip"
13
- }), A = d.getAttribute("body"), H = d.attributeSelector("body"), S = d.attributeSelector("arrow");
14
- function j() {
22
+ }), L = d.getAttribute("body"), F = d.attributeSelector("body"), O = d.attributeSelector("arrow");
23
+ function T() {
15
24
  d.init({
16
25
  coreEvents: ["pageModified"],
17
26
  withData: !0,
18
- setup({ element: l, data: t, initialize: e }) {
27
+ setup({ element: i, data: t, initialize: e }) {
19
28
  const n = typeof t == "object" ? t : {};
20
- typeof t == "string" && (n.content = t), e(), new m({ trigger: l }, n);
29
+ typeof t == "string" && (n.content = t), e(), new p({ trigger: i }, n);
21
30
  }
22
31
  });
23
32
  }
@@ -25,10 +34,10 @@ const a = class a {
25
34
  constructor(t, e, n) {
26
35
  const { trigger: s } = t;
27
36
  if (!s) {
28
- p(this, "missing required trigger");
37
+ v(this, "missing required trigger");
29
38
  return;
30
39
  }
31
- this.options = Object.assign({}, a.defaults, e), this.floatingOptions = Object.assign({}, a.defaultFloatingOptions, n), this.elements = { ...t }, this.handlers = {}, this.isOpen = !1, b(s), this.setup();
40
+ this.options = Object.assign({}, a.defaults, e), this.floatingOptions = Object.assign({}, a.defaultFloatingOptions, n), this.elements = g({}, t), this.handlers = {}, this.isOpen = !1, S(s), this.setup();
32
41
  }
33
42
  setup() {
34
43
  this.createContentElement(), this.attachHandlers(), this.setupAccessibility();
@@ -48,40 +57,40 @@ const a = class a {
48
57
  const o = s ? this.getAnchorElement() : document.querySelector(t);
49
58
  return o ? n ? o.innerHTML : o.innerText : "";
50
59
  } else
51
- p(this, "Could not resolve inner content");
60
+ v(this, "Could not resolve inner content");
52
61
  }
53
62
  getAnchorElement() {
54
63
  const { trigger: t } = this.elements, { href: e } = t, n = e ? e.split("#")[1] : null, s = n ? document.getElementById(n) : null;
55
64
  return s || console.error("Unable to get 'fromAnchor' element", t), s;
56
65
  }
57
66
  createContentElement() {
58
- const { options: t } = this, e = C(t.template(t)), n = e.querySelector(H), s = this.getInnerContent();
59
- t.isHtml ? n.innerHTML = s : n.textContent = s, e.id = w(), t.contentClass && e.classList.add(t.contentClass), this.elements.content = e, this.elements.contentArrow = e.querySelector(S), document.body.appendChild(e);
67
+ const { options: t } = this, e = H(t.template(t)), n = e.querySelector(F), s = this.getInnerContent();
68
+ t.isHtml ? n.innerHTML = s : n.textContent = s, e.id = I(), t.contentClass && e.classList.add(t.contentClass), this.elements.content = e, this.elements.contentArrow = e.querySelector(O), document.body.appendChild(e);
60
69
  }
61
70
  attachHandlers() {
62
71
  const { trigger: t } = this.elements, { showEvents: e, hideEvents: n, delay: s } = this.options;
63
72
  let o = null;
64
- const c = (i) => {
73
+ const c = (r) => {
65
74
  o || (o = setTimeout(() => {
66
- this.show(i), clearTimeout(o);
75
+ this.show(r), clearTimeout(o);
67
76
  }, s));
68
- }, r = (i) => {
69
- o && (clearTimeout(o), o = null), this.hide(i);
70
- }, h = (i) => {
71
- i.key === "Escape" && this.hide(i);
77
+ }, l = (r) => {
78
+ o && (clearTimeout(o), o = null), this.hide(r);
79
+ }, h = (r) => {
80
+ r.key === "Escape" && this.hide(r);
72
81
  };
73
- e.forEach((i) => {
74
- t.addEventListener(i, c);
75
- }), n.forEach((i) => {
76
- t.addEventListener(i, r);
77
- }), document.addEventListener("keydown", h), this.handlers = { onShow: c, onHide: r, onDocumentKeydown: h };
82
+ e.forEach((r) => {
83
+ t.addEventListener(r, c);
84
+ }), n.forEach((r) => {
85
+ t.addEventListener(r, l);
86
+ }), document.addEventListener("keydown", h), this.handlers = { onShow: c, onHide: l, onDocumentKeydown: h };
78
87
  }
79
88
  destroyHandlers() {
80
89
  const { trigger: t } = this, { onShow: e, onHide: n, onDocumentKeydown: s } = this.handlers, { showEvents: o, hideEvents: c } = this.options;
81
- e && o.forEach((r) => {
82
- t.removeEventListener(r, e);
83
- }), n && c.forEach((r) => {
84
- t.removeEventListener(r, n);
90
+ e && o.forEach((l) => {
91
+ t.removeEventListener(l, e);
92
+ }), n && c.forEach((l) => {
93
+ t.removeEventListener(l, n);
85
94
  }), s && document.removeEventListener("keydown", s);
86
95
  }
87
96
  setState(t, e) {
@@ -89,14 +98,14 @@ const a = class a {
89
98
  instance: this,
90
99
  isOpen: t,
91
100
  event: e
92
- }, { trigger: s, content: o } = this.elements, { openClass: c } = this.options, r = (h) => h.classList[t ? "add" : "remove"](c);
93
- r(s), r(o), this.isOpen = t, this.options.onChange(n), s.dispatchEvent(this.createEvent("change", n)), this.destroyFloatingInstance(), t && this.createFloatingInstance();
101
+ }, { trigger: s, content: o } = this.elements, { openClass: c } = this.options, l = (h) => h.classList[t ? "add" : "remove"](c);
102
+ l(s), l(o), this.isOpen = t, this.options.onChange(n), s.dispatchEvent(this.createEvent("change", n)), this.destroyFloatingInstance(), t && this.createFloatingInstance();
94
103
  }
95
104
  createEvent(t, e) {
96
- return new CustomEvent(E("tooltip:" + t), { detail: e });
105
+ return new CustomEvent(w("tooltip:" + t), { detail: e });
97
106
  }
98
107
  createFloatingInstance() {
99
- this.floatingCleanup = y(this.elements, this.floatingOptions);
108
+ this.floatingCleanup = A(this.elements, this.floatingOptions);
100
109
  }
101
110
  destroyFloatingInstance() {
102
111
  this.floatingCleanup && (this.floatingCleanup(), this.floatingCleanup = null);
@@ -111,7 +120,7 @@ const a = class a {
111
120
  /**
112
121
  * Defaults options
113
122
  */
114
- u(a, "defaults", {
123
+ m(a, "defaults", {
115
124
  /**
116
125
  * Should the tooltip and content be linked accessibly
117
126
  * - Note tooltips can only apply to interactive elements! (ie button, input, role="...", etc)
@@ -161,7 +170,7 @@ u(a, "defaults", {
161
170
  template(t) {
162
171
  return `
163
172
  <div class="popover popover--tooltip">
164
- <div class="popover__inner" ${A}>
173
+ <div class="popover__inner" ${L}>
165
174
  </div>
166
175
  <span class="popover__arrow" data-ulu-tooltip-arrow></span>
167
176
  </div>
@@ -173,12 +182,12 @@ u(a, "defaults", {
173
182
  */
174
183
  onChange(t) {
175
184
  }
176
- }), u(a, "defaultFloatingOptions", {
185
+ }), m(a, "defaultFloatingOptions", {
177
186
  // strategy: "fixed"
178
187
  });
179
- let m = a;
188
+ let p = a;
180
189
  export {
181
- m as Tooltip,
182
- j as init,
190
+ p as Tooltip,
191
+ T as init,
183
192
  d as initializer
184
193
  };
@@ -1,5 +1,16 @@
1
- import { autoUpdate as d, computePosition as g, inline as y, offset as b, flip as h, shift as j, arrow as w } from "@floating-ui/dom";
2
- const $ = {
1
+ var b = Object.defineProperty;
2
+ var f = Object.getOwnPropertySymbols;
3
+ var h = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
4
+ var c = (n, e, t) => e in n ? b(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, o = (n, e) => {
5
+ for (var t in e || (e = {}))
6
+ h.call(e, t) && c(n, t, e[t]);
7
+ if (f)
8
+ for (var t of f(e))
9
+ j.call(e, t) && c(n, t, e[t]);
10
+ return n;
11
+ };
12
+ import { autoUpdate as w, computePosition as $, inline as A, offset as O, flip as U, shift as D, arrow as F } from "@floating-ui/dom";
13
+ const k = {
3
14
  strategy: "absolute",
4
15
  placement: "bottom",
5
16
  inline: !1,
@@ -11,36 +22,36 @@ const $ = {
11
22
  arrow: !0
12
23
  // Options for arrow (not element)
13
24
  };
14
- function O(l, n) {
15
- const t = Object.assign({}, $, n), { placement: r, strategy: f } = t, { trigger: o, content: s, contentArrow: a } = l;
16
- return d(o, s, () => {
17
- g(o, s, {
18
- placement: r,
19
- strategy: f,
25
+ function B(n, e) {
26
+ const t = Object.assign({}, k, e), { placement: p, strategy: u } = t, { trigger: r, content: s, contentArrow: a } = n;
27
+ return w(r, s, () => {
28
+ $(r, s, {
29
+ placement: p,
30
+ strategy: u,
20
31
  middleware: [
21
- ...i(y, t.inline),
22
- ...i(b, t.offset),
23
- ...i(h, t.flip),
24
- ...i(j, t.shift),
25
- ...i(w, a && t.arrow, { element: a })
32
+ ...l(A, t.inline),
33
+ ...l(O, t.offset),
34
+ ...l(U, t.flip),
35
+ ...l(D, t.shift),
36
+ ...l(F, a && t.arrow, { element: a })
26
37
  ]
27
- }).then((c) => {
28
- const { x: p, y: u, middlewareData: m, placement: x } = c, e = m.arrow;
38
+ }).then((m) => {
39
+ const { x, y: d, middlewareData: g, placement: y } = m, i = g.arrow;
29
40
  Object.assign(s.style, {
30
- left: `${p}px`,
31
- top: `${u}px`
32
- }), s.setAttribute("data-placement", x), e && Object.assign(a.style, {
41
+ left: `${x}px`,
42
+ top: `${d}px`
43
+ }), s.setAttribute("data-placement", y), i && Object.assign(a.style, {
33
44
  // position: "absolute",
34
- left: (e == null ? void 0 : e.x) != null ? `${e.x}px` : "",
35
- top: (e == null ? void 0 : e.y) != null ? `${e.y}px` : ""
45
+ left: (i == null ? void 0 : i.x) != null ? `${i.x}px` : "",
46
+ top: (i == null ? void 0 : i.y) != null ? `${i.y}px` : ""
36
47
  });
37
48
  });
38
49
  });
39
50
  }
40
- function i(l, n, t = {}) {
41
- return n ? typeof n == "object" ? [l({ ...n, ...t })] : [l(t)] : [];
51
+ function l(n, e, t = {}) {
52
+ return e ? typeof e == "object" ? [n(o(o({}, e), t))] : [n(t)] : [];
42
53
  }
43
54
  export {
44
- O as createFloatingUi,
45
- $ as defaults
55
+ B as createFloatingUi,
56
+ k as defaults
46
57
  };