@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 +1 -1
- package/dist/index.js +2 -2
- package/dist/isVisible-BuGrjvTY.js +4 -0
- package/dist/{useValidationAttributes-Cp_70z2s.js → useValidationAttributes-DxhcSj_h.js} +52 -58
- package/dist/utils/isVisible.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/src/hooks/useElevation.ts +6 -10
- package/src/utils/isVisible.ts +2 -2
- package/dist/isVisible-BogKi39W.js +0 -4
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-
|
|
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-
|
|
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-
|
|
8
|
+
import { i as fs } from "./isVisible-BuGrjvTY.js";
|
|
9
9
|
export {
|
|
10
10
|
F as CODE_BACKSPACE,
|
|
11
11
|
c as CODE_BREAK,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useAttrs as h, computed as
|
|
2
|
-
import { DateFormat as
|
|
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-
|
|
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:
|
|
13
|
-
disabled:
|
|
14
|
-
"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(),
|
|
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 :
|
|
40
|
+
const s = p(e) ? e : c(e), r = p(t) ? t : c();
|
|
41
41
|
function n(a) {
|
|
42
|
-
return
|
|
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
|
-
|
|
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
|
|
59
|
-
}, X = (e) =>
|
|
60
|
-
const { hide: s = !0, threshold: r = 0 } = t, n = p(e) ? e :
|
|
61
|
-
function
|
|
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
|
|
65
|
-
const f = T, { x:
|
|
66
|
-
return
|
|
67
|
-
innerItems:
|
|
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: [...
|
|
64
|
+
innerItems: [...v, f],
|
|
71
65
|
outerItems: y
|
|
72
66
|
});
|
|
73
67
|
}, {
|
|
74
68
|
innerItems: [],
|
|
75
69
|
outerItems: []
|
|
76
70
|
});
|
|
77
|
-
l.value =
|
|
71
|
+
l.value = d.innerItems, a.value = d.outerItems;
|
|
78
72
|
} else
|
|
79
73
|
l.value = [], a.value = [];
|
|
80
74
|
}
|
|
81
|
-
return
|
|
75
|
+
return m(n, u, {
|
|
82
76
|
immediate: !0
|
|
83
|
-
}), S(n,
|
|
77
|
+
}), S(n, u, {
|
|
84
78
|
childList: !0
|
|
85
|
-
}), $(n, () => C(
|
|
79
|
+
}), $(n, () => C(u)), {
|
|
86
80
|
innerItems: l,
|
|
87
81
|
outerItems: a
|
|
88
82
|
};
|
|
89
83
|
}, te = (e, t, s = {}) => {
|
|
90
|
-
const r =
|
|
91
|
-
|
|
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
|
-
|
|
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
|
|
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:
|
|
112
|
+
toggle: u
|
|
119
113
|
};
|
|
120
114
|
};
|
|
121
115
|
function re(e, t, s = {}) {
|
|
122
116
|
const { defaultValue: r } = s;
|
|
123
|
-
return r ?
|
|
117
|
+
return r ? o({
|
|
124
118
|
get: () => e.value ?? r.value,
|
|
125
119
|
set: (n) => {
|
|
126
120
|
t("update:modelValue", n);
|
|
127
121
|
}
|
|
128
|
-
}) :
|
|
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 =
|
|
137
|
-
e ?
|
|
138
|
-
s.value =
|
|
139
|
-
}) :
|
|
130
|
+
const t = b(), s = c();
|
|
131
|
+
e ? m(e, (u) => {
|
|
132
|
+
s.value = u;
|
|
133
|
+
}) : R(() => {
|
|
140
134
|
if (t) {
|
|
141
|
-
const
|
|
142
|
-
|
|
135
|
+
const u = t.vnode[V ? "el" : "elm"];
|
|
136
|
+
u instanceof Element && (s.value = u);
|
|
143
137
|
}
|
|
144
138
|
});
|
|
145
|
-
const r =
|
|
146
|
-
function a(
|
|
147
|
-
var
|
|
148
|
-
if (!
|
|
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 = (
|
|
151
|
-
return i != null && i.some((
|
|
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) =>
|
|
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 =
|
|
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:
|
|
196
|
-
minlength:
|
|
197
|
-
maxlength:
|
|
198
|
-
pattern:
|
|
199
|
-
min:
|
|
200
|
-
max:
|
|
201
|
-
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
|
-
|
|
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:
|
|
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-
|
|
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
|
@@ -11,16 +11,12 @@ export const useElevation = (
|
|
|
11
11
|
|
|
12
12
|
// Functions
|
|
13
13
|
function getPageElevations(currentElement: HTMLElement): number[] {
|
|
14
|
-
return
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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 {
|
package/src/utils/isVisible.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const isVisible = (element:
|
|
2
|
-
return element.
|
|
1
|
+
export const isVisible = (element: Element): boolean => {
|
|
2
|
+
return element.getClientRects().length > 0;
|
|
3
3
|
};
|