@onereach/ui-components-common 20.1.0-beta.5133.0 → 20.1.0-beta.5137.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-Cp_70z2s.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-DxhcSj_h.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-Cp_70z2s.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";
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-BogKi39W.js";
8
+ import { i as fs } from "./isVisible-BuGrjvTY.js";
9
9
  export {
10
10
  F as CODE_BACKSPACE,
11
11
  c as CODE_BREAK,
@@ -0,0 +1,4 @@
1
+ const t = (e) => e.getClientRects().length > 0;
2
+ export {
3
+ t as i
4
+ };
@@ -1,7 +1,7 @@
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";
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";
3
3
  import { r as C } from "./dom-CwV-xS38.js";
4
- import { i as E } from "./isVisible-BogKi39W.js";
4
+ import { i as E } from "./isVisible-BuGrjvTY.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: u(() => e.readonly),
13
- disabled: u(() => e.disabled),
14
- "force-state": u(() => e["force-state"])
12
+ readonly: o(() => e.readonly),
13
+ disabled: o(() => e.disabled),
14
+ "force-state": o(() => e["force-state"])
15
15
  };
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, {
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, {
17
17
  dateStyle: e.value,
18
18
  timeZone: "UTC"
19
19
  }).formatToParts(Date.UTC(1, 0, 1, 1, 1)).reduce((r, n) => {
@@ -37,62 +37,56 @@ 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 : d(e), r = p(t) ? t : d();
40
+ const s = p(e) ? e : c(e), r = p(t) ? t : c();
41
41
  function n(a) {
42
- return Array.from(document.body.querySelectorAll("*")).reduce((o, i) => {
43
- if (!i.isEqualNode(a) && E(i)) {
44
- const c = Number(getComputedStyle(i).zIndex);
45
- isNaN(c) || o.push(c);
46
- }
47
- return o;
48
- }, []);
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));
49
43
  }
50
44
  function l(a) {
51
45
  a.style.zIndex = String(Math.max(0, ...n(a)) + 1);
52
46
  }
53
- v([s, r], ([a]) => {
47
+ m([s, r], ([a]) => {
54
48
  a && l(a);
55
49
  }, { immediate: !0 });
56
50
  }, K = () => {
57
51
  const e = h(), t = b();
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() {
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() {
62
56
  const i = n.value;
63
57
  if (i) {
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,
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,
68
62
  outerItems: [...y, f]
69
63
  }) : (s && f.style.removeProperty("visibility"), {
70
- innerItems: [...m, f],
64
+ innerItems: [...v, f],
71
65
  outerItems: y
72
66
  });
73
67
  }, {
74
68
  innerItems: [],
75
69
  outerItems: []
76
70
  });
77
- l.value = c.innerItems, a.value = c.outerItems;
71
+ l.value = d.innerItems, a.value = d.outerItems;
78
72
  } else
79
73
  l.value = [], a.value = [];
80
74
  }
81
- return v(n, o, {
75
+ return m(n, u, {
82
76
  immediate: !0
83
- }), S(n, o, {
77
+ }), S(n, u, {
84
78
  childList: !0
85
- }), $(n, () => C(o)), {
79
+ }), $(n, () => C(u)), {
86
80
  innerItems: l,
87
81
  outerItems: a
88
82
  };
89
83
  }, te = (e, t, s = {}) => {
90
- const r = d(e.value ? "open" : "closed");
91
- v(e, (i) => {
84
+ const r = c(e.value ? "open" : "closed");
85
+ m(e, (i) => {
92
86
  r.value = i ? "open" : "closed";
93
87
  });
94
88
  const n = F(r, s.debounce ?? 0);
95
- v(n, (i) => {
89
+ m(n, (i) => {
96
90
  switch (t("update:state", i), i) {
97
91
  case "open":
98
92
  t("open");
@@ -108,24 +102,24 @@ const _ = () => {
108
102
  function a() {
109
103
  r.value = "closed";
110
104
  }
111
- function o() {
105
+ function u() {
112
106
  r.value = r.value === "open" ? "closed" : "open";
113
107
  }
114
108
  return {
115
109
  state: n,
116
110
  open: l,
117
111
  close: a,
118
- toggle: o
112
+ toggle: u
119
113
  };
120
114
  };
121
115
  function re(e, t, s = {}) {
122
116
  const { defaultValue: r } = s;
123
- return r ? u({
117
+ return r ? o({
124
118
  get: () => e.value ?? r.value,
125
119
  set: (n) => {
126
120
  t("update:modelValue", n);
127
121
  }
128
- }) : u({
122
+ }) : o({
129
123
  get: () => e.value,
130
124
  set: (n) => {
131
125
  t("update:modelValue", n);
@@ -133,29 +127,29 @@ function re(e, t, s = {}) {
133
127
  });
134
128
  }
135
129
  function ne(e) {
136
- const t = b(), s = d();
137
- e ? v(e, (o) => {
138
- s.value = o;
139
- }) : x(() => {
130
+ const t = b(), s = c();
131
+ e ? m(e, (u) => {
132
+ s.value = u;
133
+ }) : R(() => {
140
134
  if (t) {
141
- const o = t.vnode[V ? "el" : "elm"];
142
- o instanceof Element && (s.value = o);
135
+ const u = t.vnode[V ? "el" : "elm"];
136
+ u instanceof Element && (s.value = u);
143
137
  }
144
138
  });
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)
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)
149
143
  return !1;
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);
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);
152
146
  }
153
147
  return {
154
148
  isDesktop: r,
155
149
  isMobile: n
156
150
  };
157
151
  }
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, {
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, {
159
153
  timeStyle: "short",
160
154
  hourCycle: e.value !== M.Auto ? e.value : void 0,
161
155
  timeZone: "UTC"
@@ -172,7 +166,7 @@ const ue = () => Y.theme, oe = (e) => u(() => e.value ?? g(z, M.Auto)), se = (e,
172
166
  }
173
167
  }, "") : e.value(void 0, t.value));
174
168
  function ae(e = !1) {
175
- const t = d(e);
169
+ const t = c(e);
176
170
  function s() {
177
171
  t.value = !0;
178
172
  }
@@ -192,19 +186,19 @@ function ae(e = !1) {
192
186
  const ie = () => {
193
187
  const e = h();
194
188
  return {
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)
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)
202
196
  };
203
197
  };
204
198
  export {
205
199
  q as D,
206
200
  L,
207
- z as T,
201
+ N as T,
208
202
  _ as a,
209
203
  k as b,
210
204
  G as c,
@@ -1 +1 @@
1
- export declare const isVisible: (element: HTMLElement) => boolean;
1
+ export declare const isVisible: (element: Element) => 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-BogKi39W.js";
4
+ import { i as $a } from "./isVisible-BuGrjvTY.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.1.0-beta.5133.0",
3
+ "version": "20.1.0-beta.5137.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -11,16 +11,12 @@ export const useElevation = (
11
11
 
12
12
  // Functions
13
13
  function getPageElevations(currentElement: HTMLElement): number[] {
14
- return Array.from(document.body.querySelectorAll('*'))
15
- .reduce((acc: number[], element) => {
16
- if (!element.isEqualNode(currentElement) && isVisible(element as HTMLElement)) {
17
- const zIndex = Number(getComputedStyle(element).zIndex);
18
- if (!isNaN(zIndex)) {
19
- acc.push(zIndex);
20
- }
21
- }
22
- return acc;
23
- }, []);
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));
24
20
  }
25
21
 
26
22
  function setElementElevation(element: HTMLElement): void {
@@ -1,3 +1,3 @@
1
- export const isVisible = (element: HTMLElement): boolean => {
2
- return element.offsetWidth > 0 && element.offsetHeight > 0;
1
+ export const isVisible = (element: Element): boolean => {
2
+ return element.getClientRects().length > 0;
3
3
  };
@@ -1,4 +0,0 @@
1
- const s = (i) => i.offsetWidth > 0 && i.offsetHeight > 0;
2
- export {
3
- s as i
4
- };