@onereach/ui-components-common 20.0.5 → 20.1.0-beta.5132.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hooks.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, b as u, c as t, d as o, e as r, f as i, g as l, h as m, i as n, j as b, k as d, l as v, m as T, u as f, n as g } from "./useValidationAttributes-DxhcSj_h.js";
1
+ import { a, b as u, c as t, d as o, e as r, f as i, g as l, h as m, i as n, j as b, k as d, l as v, m as T, u as f, n as g } from "./useValidationAttributes-B-UxSlMY.js";
2
2
  export {
3
3
  a as useControlAttributes,
4
4
  u as useDateFormat,
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { D as e, a as E } from "./dropdown-open-k6cFnrqA.js";
2
2
  import { g as t, a as R, s as T } from "./searchItemsByLabel-BhinsABA.js";
3
- import { D as r, L as A, T as O, a as C, b as i, c as D, d as l, e as S, f as N, g as m, h as X, i as n, j as u, k as P, l as L, m as M, u as I, n as g } from "./useValidationAttributes-DxhcSj_h.js";
3
+ import { D as r, L as A, T as O, a as C, b as i, c as D, d as l, e as S, f as N, g as m, h as X, i as n, j as u, k as P, l as L, m as M, u as I, n as g } from "./useValidationAttributes-B-UxSlMY.js";
4
4
  import { DateFormat as f, TimeFormat as p } from "./types.js";
5
5
  import { C as F, a as c, b as x, c as b, d as B, e as y, f as G, g as h, h as v, i as U, j as V, k, l as w, m as j, H as W, p as q, o as K, t as Y, s as z, r as Q, q as Z, n as J, P as $, Q as aa, R as sa, u as ea, S as Ea, T as _a, v as ta, W as Ra, X as Ta, w as oa, x as ra, y as Aa, V as Oa, z as Ca, A as ia, _ as Da, B as la, D as Sa, E as Na, Y as ma, F as Xa, Z as na, G as ua, I as Pa, J as La, K as Ma, U as Ia, L as ga, M as da, N as fa, O as pa, $ as Ha, am as Fa, a5 as ca, a4 as xa, a2 as ba, a9 as Ba, a6 as ya, a0 as Ga, a3 as ha, aa as va, ab as Ua, ac as Va, ad as ka, ae as wa, af as ja, ag as Wa, ah as qa, ai as Ka, aj as Ya, ak as za, a7 as Qa, a8 as Za, a1 as Ja, al as $a } from "./extractCssVarName-IHa2pGlF.js";
6
6
  import { M as ss, f as es, c as Es, e as _s, l as ts, q as Rs, g as Ts, t as os, w as rs, p as As, m as Os, i as Cs, u as is, v as Ds, b as ls, k as Ss, h as Ns, a as ms, o as Xs, r as ns, d as us, s as Ps, j as Ls, n as Ms } from "./dom-CwV-xS38.js";
7
7
  import { i as gs } from "./isUndefined-B5qXrATz.js";
8
- import { i as fs } from "./isVisible-BuGrjvTY.js";
8
+ import { i as fs } from "./isVisible-BogKi39W.js";
9
9
  export {
10
10
  F as CODE_BACKSPACE,
11
11
  c as CODE_BREAK,
@@ -0,0 +1,4 @@
1
+ const s = (i) => i.offsetWidth > 0 && i.offsetHeight > 0;
2
+ export {
3
+ s as i
4
+ };
@@ -1,7 +1,7 @@
1
- import { useAttrs as h, computed as o, inject as g, isRef as p, ref as c, watch as m, getCurrentInstance as b, onMounted as R } from "vue";
2
- import { DateFormat as x, TimeFormat as M } from "./types.js";
1
+ import { useAttrs as h, computed as u, inject as g, isRef as p, ref as d, watch as v, getCurrentInstance as b, onMounted as x } from "vue";
2
+ import { DateFormat as R, TimeFormat as M } from "./types.js";
3
3
  import { r as C } from "./dom-CwV-xS38.js";
4
- import { i as E } from "./isVisible-BuGrjvTY.js";
4
+ import { i as E } from "./isVisible-BogKi39W.js";
5
5
  import { useMutationObserver as S, useResizeObserver as $, refDebounced as F, useMediaQuery as P } from "@vueuse/core";
6
6
  import O from "@onereach/styles/screens.json";
7
7
  import { isVue3 as V } from "@/constants";
@@ -9,11 +9,11 @@ import Y from "@onereach/styles/tailwind.config.json";
9
9
  const _ = () => {
10
10
  const e = h();
11
11
  return {
12
- readonly: o(() => e.readonly),
13
- disabled: o(() => e.disabled),
14
- "force-state": o(() => e["force-state"])
12
+ readonly: u(() => e.readonly),
13
+ disabled: u(() => e.disabled),
14
+ "force-state": u(() => e["force-state"])
15
15
  };
16
- }, q = Symbol(), L = Symbol(), N = Symbol(), k = (e) => o(() => e.value ?? g(q, x.Short)), G = (e, t) => o(() => typeof e.value != "function" ? new Intl.DateTimeFormat(t.value, {
16
+ }, q = Symbol(), L = Symbol(), z = Symbol(), k = (e) => u(() => e.value ?? g(q, R.Short)), G = (e, t) => u(() => typeof e.value != "function" ? new Intl.DateTimeFormat(t.value, {
17
17
  dateStyle: e.value,
18
18
  timeZone: "UTC"
19
19
  }).formatToParts(Date.UTC(1, 0, 1, 1, 1)).reduce((r, n) => {
@@ -37,56 +37,62 @@ const _ = () => {
37
37
  return r + n.value;
38
38
  }
39
39
  }, "") : e.value(void 0, t.value)), J = (e, t) => {
40
- const s = p(e) ? e : c(e), r = p(t) ? t : c();
40
+ const s = p(e) ? e : d(e), r = p(t) ? t : d();
41
41
  function n(a) {
42
- return [...document.body.querySelectorAll("*")].filter(E).filter((u) => !u.isEqualNode(a)).map((u) => getComputedStyle(u)).map((u) => Number(u.zIndex)).filter((u) => !isNaN(u));
42
+ return Array.from(document.body.querySelectorAll("*")).reduce((o, i) => {
43
+ if (E(i) && !i.isEqualNode(a)) {
44
+ const c = Number(getComputedStyle(i).zIndex);
45
+ isNaN(c) || o.push(c);
46
+ }
47
+ return o;
48
+ }, []);
43
49
  }
44
50
  function l(a) {
45
51
  a.style.zIndex = String(Math.max(0, ...n(a)) + 1);
46
52
  }
47
- m([s, r], ([a]) => {
53
+ v([s, r], ([a]) => {
48
54
  a && l(a);
49
55
  }, { immediate: !0 });
50
56
  }, K = () => {
51
57
  const e = h(), t = b();
52
- return o(() => e.id ?? (t == null ? void 0 : t.uid.toString()));
53
- }, X = (e) => o(() => e.value ?? g(L, navigator.language)), ee = (e, t = {}) => {
54
- const { hide: s = !0, threshold: r = 0 } = t, n = p(e) ? e : c(e), l = c([]), a = c([]);
55
- function u() {
58
+ return u(() => e.id ?? (t == null ? void 0 : t.uid.toString()));
59
+ }, X = (e) => u(() => e.value ?? g(L, navigator.language)), ee = (e, t = {}) => {
60
+ const { hide: s = !0, threshold: r = 0 } = t, n = p(e) ? e : d(e), l = d([]), a = d([]);
61
+ function o() {
56
62
  const i = n.value;
57
63
  if (i) {
58
- const d = [...i.children].reduce(({ innerItems: v, outerItems: y }, T) => {
59
- const f = T, { x: D, width: I } = f.getBoundingClientRect(), { x: A, width: w } = i.getBoundingClientRect();
60
- return D + I > A + w + r ? (s && f.style.setProperty("visibility", "hidden"), {
61
- innerItems: v,
64
+ const c = [...i.children].reduce(({ innerItems: m, outerItems: y }, T) => {
65
+ const f = T, { x: I, width: A } = f.getBoundingClientRect(), { x: D, width: w } = i.getBoundingClientRect();
66
+ return I + A > D + w + r ? (s && f.style.setProperty("visibility", "hidden"), {
67
+ innerItems: m,
62
68
  outerItems: [...y, f]
63
69
  }) : (s && f.style.removeProperty("visibility"), {
64
- innerItems: [...v, f],
70
+ innerItems: [...m, f],
65
71
  outerItems: y
66
72
  });
67
73
  }, {
68
74
  innerItems: [],
69
75
  outerItems: []
70
76
  });
71
- l.value = d.innerItems, a.value = d.outerItems;
77
+ l.value = c.innerItems, a.value = c.outerItems;
72
78
  } else
73
79
  l.value = [], a.value = [];
74
80
  }
75
- return m(n, u, {
81
+ return v(n, o, {
76
82
  immediate: !0
77
- }), S(n, u, {
83
+ }), S(n, o, {
78
84
  childList: !0
79
- }), $(n, () => C(u)), {
85
+ }), $(n, () => C(o)), {
80
86
  innerItems: l,
81
87
  outerItems: a
82
88
  };
83
89
  }, te = (e, t, s = {}) => {
84
- const r = c(e.value ? "open" : "closed");
85
- m(e, (i) => {
90
+ const r = d(e.value ? "open" : "closed");
91
+ v(e, (i) => {
86
92
  r.value = i ? "open" : "closed";
87
93
  });
88
94
  const n = F(r, s.debounce ?? 0);
89
- m(n, (i) => {
95
+ v(n, (i) => {
90
96
  switch (t("update:state", i), i) {
91
97
  case "open":
92
98
  t("open");
@@ -102,24 +108,24 @@ const _ = () => {
102
108
  function a() {
103
109
  r.value = "closed";
104
110
  }
105
- function u() {
111
+ function o() {
106
112
  r.value = r.value === "open" ? "closed" : "open";
107
113
  }
108
114
  return {
109
115
  state: n,
110
116
  open: l,
111
117
  close: a,
112
- toggle: u
118
+ toggle: o
113
119
  };
114
120
  };
115
121
  function re(e, t, s = {}) {
116
122
  const { defaultValue: r } = s;
117
- return r ? o({
123
+ return r ? u({
118
124
  get: () => e.value ?? r.value,
119
125
  set: (n) => {
120
126
  t("update:modelValue", n);
121
127
  }
122
- }) : o({
128
+ }) : u({
123
129
  get: () => e.value,
124
130
  set: (n) => {
125
131
  t("update:modelValue", n);
@@ -127,29 +133,29 @@ function re(e, t, s = {}) {
127
133
  });
128
134
  }
129
135
  function ne(e) {
130
- const t = b(), s = c();
131
- e ? m(e, (u) => {
132
- s.value = u;
133
- }) : R(() => {
136
+ const t = b(), s = d();
137
+ e ? v(e, (o) => {
138
+ s.value = o;
139
+ }) : x(() => {
134
140
  if (t) {
135
- const u = t.vnode[V ? "el" : "elm"];
136
- u instanceof Element && (s.value = u);
141
+ const o = t.vnode[V ? "el" : "elm"];
142
+ o instanceof Element && (s.value = o);
137
143
  }
138
144
  });
139
- const r = o(() => a(s.value) || l.value), n = o(() => !r.value), l = P(`(min-width: ${O.md})`);
140
- function a(u) {
141
- var d;
142
- if (!u)
145
+ const r = u(() => a(s.value) || l.value), n = u(() => !r.value), l = P(`(min-width: ${O.md})`);
146
+ function a(o) {
147
+ var c;
148
+ if (!o)
143
149
  return !1;
144
- const i = (d = u.getAttribute("force-screen")) == null ? void 0 : d.split(/\s+/);
145
- return i != null && i.some((v) => ["md", "lg", "xl"].includes(v)) ? !0 : a(u.parentElement ?? void 0);
150
+ const i = (c = o.getAttribute("force-screen")) == null ? void 0 : c.split(/\s+/);
151
+ return i != null && i.some((m) => ["md", "lg", "xl"].includes(m)) ? !0 : a(o.parentElement ?? void 0);
146
152
  }
147
153
  return {
148
154
  isDesktop: r,
149
155
  isMobile: n
150
156
  };
151
157
  }
152
- const ue = () => Y.theme, oe = (e) => o(() => e.value ?? g(N, M.Auto)), se = (e, t) => o(() => typeof e.value != "function" ? new Intl.DateTimeFormat(t.value, {
158
+ const ue = () => Y.theme, oe = (e) => u(() => e.value ?? g(z, M.Auto)), se = (e, t) => u(() => typeof e.value != "function" ? new Intl.DateTimeFormat(t.value, {
153
159
  timeStyle: "short",
154
160
  hourCycle: e.value !== M.Auto ? e.value : void 0,
155
161
  timeZone: "UTC"
@@ -166,7 +172,7 @@ const ue = () => Y.theme, oe = (e) => o(() => e.value ?? g(N, M.Auto)), se = (e,
166
172
  }
167
173
  }, "") : e.value(void 0, t.value));
168
174
  function ae(e = !1) {
169
- const t = c(e);
175
+ const t = d(e);
170
176
  function s() {
171
177
  t.value = !0;
172
178
  }
@@ -186,19 +192,19 @@ function ae(e = !1) {
186
192
  const ie = () => {
187
193
  const e = h();
188
194
  return {
189
- required: o(() => e.required),
190
- minlength: o(() => e.minlength),
191
- maxlength: o(() => e.maxlength),
192
- pattern: o(() => e.pattern),
193
- min: o(() => e.min),
194
- max: o(() => e.max),
195
- step: o(() => e.step)
195
+ required: u(() => e.required),
196
+ minlength: u(() => e.minlength),
197
+ maxlength: u(() => e.maxlength),
198
+ pattern: u(() => e.pattern),
199
+ min: u(() => e.min),
200
+ max: u(() => e.max),
201
+ step: u(() => e.step)
196
202
  };
197
203
  };
198
204
  export {
199
205
  q as D,
200
206
  L,
201
- N as T,
207
+ z as T,
202
208
  _ as a,
203
209
  k as b,
204
210
  G as c,
@@ -1 +1 @@
1
- export declare const isVisible: (element: Element) => boolean;
1
+ export declare const isVisible: (element: HTMLElement) => boolean;
package/dist/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { C as E, a as _, b as R, c as e, d as T, e as t, f as A, g as C, h as O, i as r, j as S, k as o, l as N, m as i, H as D, p as X, o as P, t as l, s as L, r as n, q as M, n as I, P as g, Q as H, R as m, u as c, S as d, T as f, v as B, W as x, X as F, w as G, x as b, y as p, V as U, z as u, A as h, _ as y, B as v, D as V, E as W, Y as j, F as q, Z as K, G as Y, I as k, J as w, K as z, U as Q, L as Z, M as J, N as $, O as aa, $ as sa, am as Ea, a5 as _a, a4 as Ra, a2 as ea, a9 as Ta, a6 as ta, a0 as Aa, a3 as Ca, aa as Oa, ab as ra, ac as Sa, ad as oa, ae as Na, af as ia, ag as Da, ah as Xa, ai as Pa, aj as la, ak as La, a7 as na, a8 as Ma, a1 as Ia, al as ga } from "./extractCssVarName-IHa2pGlF.js";
2
2
  import { M as ma, f as ca, c as da, e as fa, l as Ba, q as xa, g as Fa, t as Ga, w as ba, p as pa, m as Ua, i as ua, u as ha, v as ya, b as va, k as Va, h as Wa, a as ja, o as qa, r as Ka, d as Ya, s as ka, j as wa, n as za } from "./dom-CwV-xS38.js";
3
3
  import { i as Za } from "./isUndefined-B5qXrATz.js";
4
- import { i as $a } from "./isVisible-BuGrjvTY.js";
4
+ import { i as $a } from "./isVisible-BogKi39W.js";
5
5
  export {
6
6
  E as CODE_BACKSPACE,
7
7
  _ as CODE_BREAK,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components-common",
3
- "version": "20.0.5",
3
+ "version": "20.1.0-beta.5132.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -71,6 +71,5 @@
71
71
  },
72
72
  "peerDependencies": {
73
73
  "vue": "^3.0.5 || 2.6.14"
74
- },
75
- "gitHead": "45b9bb386846e4012a8fbaa0a8952468124a3ded"
74
+ }
76
75
  }
@@ -11,12 +11,16 @@ export const useElevation = (
11
11
 
12
12
  // Functions
13
13
  function getPageElevations(currentElement: HTMLElement): number[] {
14
- return ([...document.body.querySelectorAll('*')] as HTMLElement[])
15
- .filter(isVisible)
16
- .filter(element => !element.isEqualNode(currentElement))
17
- .map((element) => getComputedStyle(element))
18
- .map((style) => Number(style.zIndex))
19
- .filter((zIndex) => !isNaN(zIndex));
14
+ return Array.from(document.body.querySelectorAll('*'))
15
+ .reduce((acc: number[], element) => {
16
+ if (isVisible(element as HTMLElement) && !element.isEqualNode(currentElement)) {
17
+ const zIndex = Number(getComputedStyle(element).zIndex);
18
+ if (!isNaN(zIndex)) {
19
+ acc.push(zIndex);
20
+ }
21
+ }
22
+ return acc;
23
+ }, []);
20
24
  }
21
25
 
22
26
  function setElementElevation(element: HTMLElement): void {
@@ -1,3 +1,3 @@
1
- export const isVisible = (element: Element): boolean => {
2
- return element.getClientRects().length > 0;
1
+ export const isVisible = (element: HTMLElement): boolean => {
2
+ return element.offsetWidth > 0 && element.offsetHeight > 0;
3
3
  };
@@ -1,4 +0,0 @@
1
- const t = (e) => e.getClientRects().length > 0;
2
- export {
3
- t as i
4
- };