@onereach/ui-components-common 20.2.0-beta.5166.0 → 20.2.0-beta.5168.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-BogKi39W.js +4 -0
- package/dist/{useValidationAttributes-DxhcSj_h.js → useValidationAttributes-Cp_70z2s.js} +58 -52
- package/dist/utils/isVisible.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/src/hooks/useElevation.ts +10 -6
- package/src/utils/isVisible.ts +2 -2
- package/dist/isVisible-BuGrjvTY.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-Cp_70z2s.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-Cp_70z2s.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-BogKi39W.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 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-
|
|
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:
|
|
13
|
-
disabled:
|
|
14
|
-
"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(),
|
|
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 :
|
|
40
|
+
const s = p(e) ? e : d(e), r = p(t) ? t : d();
|
|
41
41
|
function n(a) {
|
|
42
|
-
return
|
|
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
|
+
}, []);
|
|
43
49
|
}
|
|
44
50
|
function l(a) {
|
|
45
51
|
a.style.zIndex = String(Math.max(0, ...n(a)) + 1);
|
|
46
52
|
}
|
|
47
|
-
|
|
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
|
|
53
|
-
}, X = (e) =>
|
|
54
|
-
const { hide: s = !0, threshold: r = 0 } = t, n = p(e) ? e :
|
|
55
|
-
function
|
|
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
|
|
59
|
-
const f = T, { x:
|
|
60
|
-
return
|
|
61
|
-
innerItems:
|
|
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: [...
|
|
70
|
+
innerItems: [...m, f],
|
|
65
71
|
outerItems: y
|
|
66
72
|
});
|
|
67
73
|
}, {
|
|
68
74
|
innerItems: [],
|
|
69
75
|
outerItems: []
|
|
70
76
|
});
|
|
71
|
-
l.value =
|
|
77
|
+
l.value = c.innerItems, a.value = c.outerItems;
|
|
72
78
|
} else
|
|
73
79
|
l.value = [], a.value = [];
|
|
74
80
|
}
|
|
75
|
-
return
|
|
81
|
+
return v(n, o, {
|
|
76
82
|
immediate: !0
|
|
77
|
-
}), S(n,
|
|
83
|
+
}), S(n, o, {
|
|
78
84
|
childList: !0
|
|
79
|
-
}), $(n, () => C(
|
|
85
|
+
}), $(n, () => C(o)), {
|
|
80
86
|
innerItems: l,
|
|
81
87
|
outerItems: a
|
|
82
88
|
};
|
|
83
89
|
}, te = (e, t, s = {}) => {
|
|
84
|
-
const r =
|
|
85
|
-
|
|
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
|
-
|
|
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
|
|
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:
|
|
118
|
+
toggle: o
|
|
113
119
|
};
|
|
114
120
|
};
|
|
115
121
|
function re(e, t, s = {}) {
|
|
116
122
|
const { defaultValue: r } = s;
|
|
117
|
-
return r ?
|
|
123
|
+
return r ? u({
|
|
118
124
|
get: () => e.value ?? r.value,
|
|
119
125
|
set: (n) => {
|
|
120
126
|
t("update:modelValue", n);
|
|
121
127
|
}
|
|
122
|
-
}) :
|
|
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 =
|
|
131
|
-
e ?
|
|
132
|
-
s.value =
|
|
133
|
-
}) :
|
|
136
|
+
const t = b(), s = d();
|
|
137
|
+
e ? v(e, (o) => {
|
|
138
|
+
s.value = o;
|
|
139
|
+
}) : x(() => {
|
|
134
140
|
if (t) {
|
|
135
|
-
const
|
|
136
|
-
|
|
141
|
+
const o = t.vnode[V ? "el" : "elm"];
|
|
142
|
+
o instanceof Element && (s.value = o);
|
|
137
143
|
}
|
|
138
144
|
});
|
|
139
|
-
const r =
|
|
140
|
-
function a(
|
|
141
|
-
var
|
|
142
|
-
if (!
|
|
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 = (
|
|
145
|
-
return i != null && i.some((
|
|
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) =>
|
|
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 =
|
|
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:
|
|
190
|
-
minlength:
|
|
191
|
-
maxlength:
|
|
192
|
-
pattern:
|
|
193
|
-
min:
|
|
194
|
-
max:
|
|
195
|
-
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
|
-
|
|
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:
|
|
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-
|
|
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.2.0-beta.
|
|
3
|
+
"version": "20.2.0-beta.5168.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"prepare": "pnpm build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@onereach/styles": "^20.2
|
|
62
|
+
"@onereach/styles": "^20.1.2",
|
|
63
63
|
"@vueuse/core": "9.13.0",
|
|
64
64
|
"lodash": "^4.17.21"
|
|
65
65
|
},
|
|
@@ -11,12 +11,16 @@ export const useElevation = (
|
|
|
11
11
|
|
|
12
12
|
// Functions
|
|
13
13
|
function getPageElevations(currentElement: HTMLElement): number[] {
|
|
14
|
-
return (
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
}, []);
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
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: HTMLElement): boolean => {
|
|
2
|
+
return element.offsetWidth > 0 && element.offsetHeight > 0;
|
|
3
3
|
};
|