@onereach/ui-components-common 21.5.0-beta.5391.0 → 21.5.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.
- package/dist/directives/dropdown-close.d.ts +2 -1
- package/dist/directives/dropdown-open.d.ts +2 -1
- package/dist/directives.js +19 -3
- package/dist/hooks.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{useValidationAttributes-BpeWsfb0.js → useValidationAttributes-C9_kxaDj.js} +66 -67
- package/package.json +4 -3
- package/src/directives/dropdown-close.ts +2 -2
- package/src/directives/dropdown-open.ts +2 -2
- package/src/hooks/useResponsive/useResponsive.ts +2 -2
- package/dist/dropdown-open-k6cFnrqA.js +0 -20
package/dist/directives.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
const o = (d, n) => {
|
|
2
|
+
d.addEventListener("keydown", (e) => {
|
|
3
|
+
["Escape"].includes(e.key) && n.value(e);
|
|
4
|
+
});
|
|
5
|
+
}, a = {
|
|
6
|
+
created: o,
|
|
7
|
+
bind: o
|
|
8
|
+
}, t = (d, n) => {
|
|
9
|
+
d.addEventListener("keydown", (e) => {
|
|
10
|
+
["Enter", " "].includes(e.key) && n.value(e);
|
|
11
|
+
}), d.addEventListener("click", (e) => {
|
|
12
|
+
e.stopPropagation(), e.preventDefault(), n.value(e);
|
|
13
|
+
});
|
|
14
|
+
}, c = {
|
|
15
|
+
created: t,
|
|
16
|
+
bind: t
|
|
17
|
+
};
|
|
2
18
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
19
|
+
a as DropdownClose,
|
|
20
|
+
c as DropdownOpen
|
|
5
21
|
};
|
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-C9_kxaDj.js";
|
|
2
2
|
export {
|
|
3
3
|
a as useControlAttributes,
|
|
4
4
|
u as useDateFormat,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DropdownClose as _, DropdownOpen as s } from "./directives.js";
|
|
2
2
|
import { getItemByValue as T, getItemsByValue as a, searchItemsByLabel as t } from "./helpers.js";
|
|
3
|
-
import { D as o, L as A, T as O, a as C, b as D, c as i, d as S, e as N, f as X, g as P, h as L, i as m, j as u, k as l, l as n, m as M, u as I, n as g } from "./useValidationAttributes-
|
|
3
|
+
import { D as o, L as A, T as O, a as C, b as D, c as i, d as S, e as N, f as X, g as P, h as L, i as m, j as u, k as l, l as n, m as M, u as I, n as g } from "./useValidationAttributes-C9_kxaDj.js";
|
|
4
4
|
import { D as H, T as F } from "./TimeFormat-CdFMIbra.js";
|
|
5
5
|
import { Spacing as f } from "./types.js";
|
|
6
6
|
import { CODE_BACKSPACE as b, CODE_BREAK as d, CODE_DELETE as G, CODE_DOWN as c, CODE_END as U, CODE_ENTER as V, CODE_ESC as y, CODE_HOME as h, CODE_LEFT as v, CODE_PAGEDOWN as W, CODE_PAGEUP as k, CODE_RIGHT as w, CODE_SPACE as K, CODE_UP as Y, HSL_LIMITS as j, PLACEMENT_BOTTOM_END as q, PLACEMENT_BOTTOM_START as z, PLACEMENT_LEFT_END as Q, PLACEMENT_LEFT_START as J, PLACEMENT_RIGHT_END as Z, PLACEMENT_RIGHT_START as $, PLACEMENT_TOP_END as ee, PLACEMENT_TOP_START as Ee, RX_ABBREVIATION_FROM_STRING as _e, RX_ARRAY_NOTATION as se, RX_BV_PREFIX as Re, RX_DATE as Te, RX_DATE_SPLIT as ae, RX_DIGITS as te, RX_ENCODED_COMMA as re, RX_ENCODE_REVERSE as oe, RX_EXTENSION as Ae, RX_HASH as Oe, RX_HASH_ID as Ce, RX_HREF as De, RX_HTML_TAGS as ie, RX_HYPHENATE as Se, RX_LONG_COLOR as Ne, RX_LOWER_UPPER as Xe, RX_NUMBER as Pe, RX_PLUS as Le, RX_QUERY_START as me, RX_REGEXP_REPLACE as ue, RX_SHORT_COLOR as le, RX_SPACES as ne, RX_SPACE_SPLIT as Me, RX_STAR as Ie, RX_START_SPACE_WORD as ge, RX_TIME as pe, RX_TRIM_LEFT as He, RX_TRIM_RIGHT as Fe, RX_UNDERSCORE as xe, RX_UN_KEBAB as fe, exclude as Be, extractCssVarName as be, flattenDeep as de, generateColorFromString as Ge, generateHslFromString as ce, getAbbreviation as Ue, getHashOfString as Ve, hexToRgb as ye, hslToColorString as he, include as ve, isAncestor as We, isArray as ke, isDescendant as we, isEmpty as Ke, isEqual as Ye, isNil as je, isNull as qe, isNumber as ze, isObject as Qe, isString as Je, normalize as Ze, pxToRem as $e, rgbToHex as eE, toArray as EE } from "./utils.js";
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { useAttrs as h, computed as u, inject as g, isRef as p, ref as c, watch as
|
|
1
|
+
import { useAttrs as h, computed as u, inject as g, isRef as p, ref as c, watch as f, getCurrentInstance as M, onMounted as R } from "vue";
|
|
2
2
|
import { D as x, T as b } from "./TimeFormat-CdFMIbra.js";
|
|
3
3
|
import { r as C } from "./dom-qGGG2YCX.js";
|
|
4
4
|
import { g as E } from "./getPageElevations-BuZyM94T.js";
|
|
5
5
|
import { useMutationObserver as $, useResizeObserver as F, refDebounced as S, useMediaQuery as P } from "@vueuse/core";
|
|
6
6
|
import O from "@onereach/styles/screens.json";
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
const k = () => {
|
|
7
|
+
import Y from "@onereach/styles/tailwind.config.json";
|
|
8
|
+
const Z = () => {
|
|
10
9
|
const e = h();
|
|
11
10
|
return {
|
|
12
11
|
readonly: u(() => e.readonly),
|
|
13
12
|
disabled: u(() => e.disabled),
|
|
14
13
|
"force-state": u(() => e["force-state"])
|
|
15
14
|
};
|
|
16
|
-
},
|
|
15
|
+
}, L = Symbol(), U = Symbol(), V = Symbol(), _ = (e) => u(() => e.value ?? g(L, x.Short)), k = (e, t) => u(() => typeof e.value != "function" ? new Intl.DateTimeFormat(t.value, {
|
|
17
16
|
dateStyle: e.value,
|
|
18
17
|
timeZone: "UTC"
|
|
19
18
|
}).formatToParts(Date.UTC(1, 0, 1, 1, 1)).reduce((r, n) => {
|
|
@@ -36,55 +35,55 @@ const k = () => {
|
|
|
36
35
|
default:
|
|
37
36
|
return r + n.value;
|
|
38
37
|
}
|
|
39
|
-
}, "") : e.value(void 0, t.value)),
|
|
38
|
+
}, "") : e.value(void 0, t.value)), G = (e, t) => {
|
|
40
39
|
const s = p(e) ? e : c(e), r = p(t) ? t : c();
|
|
41
|
-
function n(
|
|
42
|
-
|
|
40
|
+
function n(i) {
|
|
41
|
+
i.style.zIndex = String(Math.max(0, ...E(i)) + 1);
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
f([s, r], ([i]) => {
|
|
44
|
+
i && n(i);
|
|
46
45
|
}, { immediate: !0 });
|
|
47
|
-
},
|
|
46
|
+
}, J = () => {
|
|
48
47
|
const e = h(), t = M();
|
|
49
48
|
return u(() => e.id ?? (t == null ? void 0 : t.uid.toString()));
|
|
50
|
-
},
|
|
51
|
-
const { hide: s = !0, threshold: r = 0 } = t, n = p(e) ? e : c(e),
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
const d = [...
|
|
56
|
-
const
|
|
57
|
-
return D + I > w + A + r ? (s &&
|
|
49
|
+
}, K = (e) => u(() => e.value ?? g(U, navigator.language)), N = (e, t = {}) => {
|
|
50
|
+
const { hide: s = !0, threshold: r = 0 } = t, n = p(e) ? e : c(e), i = c([]), l = c([]);
|
|
51
|
+
function a() {
|
|
52
|
+
const o = n.value;
|
|
53
|
+
if (o) {
|
|
54
|
+
const d = [...o.children].reduce(({ innerItems: m, outerItems: y }, T) => {
|
|
55
|
+
const v = T, { x: D, width: I } = v.getBoundingClientRect(), { x: w, width: A } = o.getBoundingClientRect();
|
|
56
|
+
return D + I > w + A + r ? (s && v.style.setProperty("visibility", "hidden"), {
|
|
58
57
|
innerItems: m,
|
|
59
|
-
outerItems: [...y,
|
|
60
|
-
}) : (s &&
|
|
61
|
-
innerItems: [...m,
|
|
58
|
+
outerItems: [...y, v]
|
|
59
|
+
}) : (s && v.style.removeProperty("visibility"), {
|
|
60
|
+
innerItems: [...m, v],
|
|
62
61
|
outerItems: y
|
|
63
62
|
});
|
|
64
63
|
}, {
|
|
65
64
|
innerItems: [],
|
|
66
65
|
outerItems: []
|
|
67
66
|
});
|
|
68
|
-
|
|
67
|
+
i.value = d.innerItems, l.value = d.outerItems;
|
|
69
68
|
} else
|
|
70
|
-
|
|
69
|
+
i.value = [], l.value = [];
|
|
71
70
|
}
|
|
72
|
-
return
|
|
71
|
+
return f(n, a, {
|
|
73
72
|
immediate: !0
|
|
74
|
-
}), $(n,
|
|
73
|
+
}), $(n, a, {
|
|
75
74
|
childList: !0
|
|
76
|
-
}), F(n, () => C(
|
|
77
|
-
innerItems:
|
|
75
|
+
}), F(n, () => C(a)), {
|
|
76
|
+
innerItems: i,
|
|
78
77
|
outerItems: l
|
|
79
78
|
};
|
|
80
|
-
},
|
|
79
|
+
}, X = (e, t, s = {}) => {
|
|
81
80
|
const r = c(e.value ? "open" : "closed");
|
|
82
|
-
|
|
83
|
-
r.value =
|
|
81
|
+
f(e, (o) => {
|
|
82
|
+
r.value = o ? "open" : "closed";
|
|
84
83
|
});
|
|
85
84
|
const n = S(r, s.debounce ?? 0);
|
|
86
|
-
|
|
87
|
-
switch (t("update:state",
|
|
85
|
+
f(n, (o) => {
|
|
86
|
+
switch (t("update:state", o), o) {
|
|
88
87
|
case "open":
|
|
89
88
|
t("open");
|
|
90
89
|
break;
|
|
@@ -93,23 +92,23 @@ const k = () => {
|
|
|
93
92
|
break;
|
|
94
93
|
}
|
|
95
94
|
});
|
|
96
|
-
function
|
|
95
|
+
function i() {
|
|
97
96
|
r.value = "open";
|
|
98
97
|
}
|
|
99
98
|
function l() {
|
|
100
99
|
r.value = "closed";
|
|
101
100
|
}
|
|
102
|
-
function
|
|
101
|
+
function a() {
|
|
103
102
|
r.value = r.value === "open" ? "closed" : "open";
|
|
104
103
|
}
|
|
105
104
|
return {
|
|
106
105
|
state: n,
|
|
107
|
-
open:
|
|
106
|
+
open: i,
|
|
108
107
|
close: l,
|
|
109
|
-
toggle:
|
|
108
|
+
toggle: a
|
|
110
109
|
};
|
|
111
110
|
};
|
|
112
|
-
function
|
|
111
|
+
function ee(e, t, s = {}) {
|
|
113
112
|
const { defaultValue: r } = s;
|
|
114
113
|
return r ? u({
|
|
115
114
|
get: () => e.value ?? r.value,
|
|
@@ -123,30 +122,30 @@ function re(e, t, s = {}) {
|
|
|
123
122
|
}
|
|
124
123
|
});
|
|
125
124
|
}
|
|
126
|
-
function
|
|
125
|
+
function te(e) {
|
|
127
126
|
const t = M(), s = c();
|
|
128
|
-
e ?
|
|
129
|
-
s.value =
|
|
127
|
+
e ? f(e, (a) => {
|
|
128
|
+
s.value = a;
|
|
130
129
|
}) : R(() => {
|
|
131
130
|
if (t) {
|
|
132
|
-
const
|
|
131
|
+
const a = t.vnode, o = a.el || a.elm;
|
|
133
132
|
o instanceof Element && (s.value = o);
|
|
134
133
|
}
|
|
135
134
|
});
|
|
136
|
-
const r = u(() => l(s.value) ||
|
|
137
|
-
function l(
|
|
135
|
+
const r = u(() => l(s.value) || i.value), n = u(() => !r.value), i = P(`(min-width: ${O.md})`);
|
|
136
|
+
function l(a) {
|
|
138
137
|
var d;
|
|
139
|
-
if (!
|
|
138
|
+
if (!a)
|
|
140
139
|
return !1;
|
|
141
|
-
const
|
|
142
|
-
return
|
|
140
|
+
const o = (d = a.getAttribute("force-screen")) == null ? void 0 : d.split(/\s+/);
|
|
141
|
+
return o != null && o.some((m) => ["md", "lg", "xl"].includes(m)) ? !0 : l(a.parentElement ?? void 0);
|
|
143
142
|
}
|
|
144
143
|
return {
|
|
145
144
|
isDesktop: r,
|
|
146
145
|
isMobile: n
|
|
147
146
|
};
|
|
148
147
|
}
|
|
149
|
-
const
|
|
148
|
+
const re = () => Y.theme, ne = (e) => u(() => e.value ?? g(V, b.Auto)), ue = (e, t) => u(() => typeof e.value != "function" ? new Intl.DateTimeFormat(t.value, {
|
|
150
149
|
timeStyle: "short",
|
|
151
150
|
hourCycle: e.value !== b.Auto ? e.value : void 0,
|
|
152
151
|
timeZone: "UTC"
|
|
@@ -162,7 +161,7 @@ const ue = () => L.theme, se = (e) => u(() => e.value ?? g(q, b.Auto)), oe = (e,
|
|
|
162
161
|
return r + n.value;
|
|
163
162
|
}
|
|
164
163
|
}, "") : e.value(void 0, t.value));
|
|
165
|
-
function
|
|
164
|
+
function se(e = !1) {
|
|
166
165
|
const t = c(e);
|
|
167
166
|
function s() {
|
|
168
167
|
t.value = !0;
|
|
@@ -180,7 +179,7 @@ function ae(e = !1) {
|
|
|
180
179
|
toggle: n
|
|
181
180
|
};
|
|
182
181
|
}
|
|
183
|
-
const
|
|
182
|
+
const oe = () => {
|
|
184
183
|
const e = h();
|
|
185
184
|
return {
|
|
186
185
|
required: u(() => e.required),
|
|
@@ -193,22 +192,22 @@ const ie = () => {
|
|
|
193
192
|
};
|
|
194
193
|
};
|
|
195
194
|
export {
|
|
196
|
-
|
|
195
|
+
L as D,
|
|
197
196
|
U as L,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
197
|
+
V as T,
|
|
198
|
+
Z as a,
|
|
199
|
+
_ as b,
|
|
200
|
+
k as c,
|
|
201
|
+
G as d,
|
|
202
|
+
J as e,
|
|
203
|
+
K as f,
|
|
204
|
+
N as g,
|
|
205
|
+
X as h,
|
|
206
|
+
ee as i,
|
|
207
|
+
te as j,
|
|
208
|
+
re as k,
|
|
209
|
+
ne as l,
|
|
210
|
+
ue as m,
|
|
211
|
+
oe as n,
|
|
212
|
+
se as u
|
|
214
213
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components-common",
|
|
3
|
-
"version": "21.5.
|
|
3
|
+
"version": "21.5.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"dev": "vite build --watch"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@onereach/styles": "^21.5.
|
|
62
|
+
"@onereach/styles": "^21.5.1",
|
|
63
63
|
"@vueuse/core": "9.13.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
@@ -69,5 +69,6 @@
|
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"vue": "3.3.4 || 2.6.14"
|
|
72
|
-
}
|
|
72
|
+
},
|
|
73
|
+
"gitHead": "0ce2ad7cf46d1390fbcfd5486b049b847bd2e27f"
|
|
73
74
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DirectiveBinding, DirectiveHook } from 'vue';
|
|
2
|
-
import { isVue3 } from '@/constants';
|
|
3
2
|
|
|
4
3
|
const created: DirectiveHook = (element: HTMLElement, binding: DirectiveBinding<(event: Event) => void>) => {
|
|
5
4
|
element.addEventListener('keydown', (event) => {
|
|
@@ -10,5 +9,6 @@ const created: DirectiveHook = (element: HTMLElement, binding: DirectiveBinding<
|
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
export const DropdownClose = {
|
|
13
|
-
|
|
12
|
+
'created': created,
|
|
13
|
+
'bind': created,
|
|
14
14
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DirectiveBinding, DirectiveHook } from 'vue';
|
|
2
|
-
import { isVue3 } from '@/constants';
|
|
3
2
|
|
|
4
3
|
const created: DirectiveHook = (element: HTMLElement, binding: DirectiveBinding<(event: Event) => void>) => {
|
|
5
4
|
element.addEventListener('keydown', (event) => {
|
|
@@ -17,5 +16,6 @@ const created: DirectiveHook = (element: HTMLElement, binding: DirectiveBinding<
|
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
export const DropdownOpen = {
|
|
20
|
-
|
|
19
|
+
'created': created,
|
|
20
|
+
'bind': created,
|
|
21
21
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import screens from '@onereach/styles/screens.json';
|
|
2
2
|
import { useMediaQuery } from '@vueuse/core';
|
|
3
3
|
import { Ref, computed, getCurrentInstance, onMounted, ref, watch } from 'vue';
|
|
4
|
-
import { isVue3 } from '@/constants';
|
|
5
4
|
|
|
6
5
|
function useResponsive(element?: Ref<Element | undefined>) {
|
|
7
6
|
const currentInstance = getCurrentInstance();
|
|
@@ -14,7 +13,8 @@ function useResponsive(element?: Ref<Element | undefined>) {
|
|
|
14
13
|
} else {
|
|
15
14
|
onMounted(() => {
|
|
16
15
|
if (currentInstance) {
|
|
17
|
-
const
|
|
16
|
+
const vnode = (currentInstance.vnode as any);
|
|
17
|
+
const element = (vnode.el || vnode.elm) as unknown;
|
|
18
18
|
|
|
19
19
|
if (element instanceof Element) {
|
|
20
20
|
currentRootElement.value = element as Element;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { isVue3 as o } from "@/constants";
|
|
2
|
-
const t = (a, d) => {
|
|
3
|
-
a.addEventListener("keydown", (e) => {
|
|
4
|
-
["Escape"].includes(e.key) && d.value(e);
|
|
5
|
-
});
|
|
6
|
-
}, s = {
|
|
7
|
-
[o ? "created" : "bind"]: t
|
|
8
|
-
}, n = (a, d) => {
|
|
9
|
-
a.addEventListener("keydown", (e) => {
|
|
10
|
-
["Enter", " "].includes(e.key) && d.value(e);
|
|
11
|
-
}), a.addEventListener("click", (e) => {
|
|
12
|
-
e.stopPropagation(), e.preventDefault(), d.value(e);
|
|
13
|
-
});
|
|
14
|
-
}, c = {
|
|
15
|
-
[o ? "created" : "bind"]: n
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
s as D,
|
|
19
|
-
c as a
|
|
20
|
-
};
|