@onereach/ui-components-common 21.5.0 → 21.5.2

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.
@@ -1,4 +1,5 @@
1
1
  import { DirectiveHook } from 'vue';
2
2
  export declare const DropdownClose: {
3
- [x: string]: DirectiveHook;
3
+ created: DirectiveHook;
4
+ bind: DirectiveHook;
4
5
  };
@@ -1,4 +1,5 @@
1
1
  import { DirectiveHook } from 'vue';
2
2
  export declare const DropdownOpen: {
3
- [x: string]: DirectiveHook;
3
+ created: DirectiveHook;
4
+ bind: DirectiveHook;
4
5
  };
@@ -1,5 +1,21 @@
1
- import { D as r, a } from "./dropdown-open-k6cFnrqA.js";
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
- r as DropdownClose,
4
- a as DropdownOpen
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-BpeWsfb0.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-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 { D as _, a as s } from "./dropdown-open-k6cFnrqA.js";
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-BpeWsfb0.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-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 v, getCurrentInstance as M, onMounted as R } from "vue";
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 { isVue3 as Y } from "@/constants";
8
- import L from "@onereach/styles/tailwind.config.json";
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
- }, V = Symbol(), U = Symbol(), q = Symbol(), G = (e) => u(() => e.value ?? g(V, x.Short)), J = (e, t) => u(() => typeof e.value != "function" ? new Intl.DateTimeFormat(t.value, {
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)), K = (e, t) => {
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(a) {
42
- a.style.zIndex = String(Math.max(0, ...E(a)) + 1);
40
+ function n(i) {
41
+ i.style.zIndex = String(Math.max(0, ...E(i)) + 1);
43
42
  }
44
- v([s, r], ([a]) => {
45
- a && n(a);
43
+ f([s, r], ([i]) => {
44
+ i && n(i);
46
45
  }, { immediate: !0 });
47
- }, N = () => {
46
+ }, J = () => {
48
47
  const e = h(), t = M();
49
48
  return u(() => e.id ?? (t == null ? void 0 : t.uid.toString()));
50
- }, X = (e) => u(() => e.value ?? g(U, navigator.language)), ee = (e, t = {}) => {
51
- const { hide: s = !0, threshold: r = 0 } = t, n = p(e) ? e : c(e), a = c([]), l = c([]);
52
- function o() {
53
- const i = n.value;
54
- if (i) {
55
- const d = [...i.children].reduce(({ innerItems: m, outerItems: y }, T) => {
56
- const f = T, { x: D, width: I } = f.getBoundingClientRect(), { x: w, width: A } = i.getBoundingClientRect();
57
- return D + I > w + A + r ? (s && f.style.setProperty("visibility", "hidden"), {
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, f]
60
- }) : (s && f.style.removeProperty("visibility"), {
61
- innerItems: [...m, f],
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
- a.value = d.innerItems, l.value = d.outerItems;
67
+ i.value = d.innerItems, l.value = d.outerItems;
69
68
  } else
70
- a.value = [], l.value = [];
69
+ i.value = [], l.value = [];
71
70
  }
72
- return v(n, o, {
71
+ return f(n, a, {
73
72
  immediate: !0
74
- }), $(n, o, {
73
+ }), $(n, a, {
75
74
  childList: !0
76
- }), F(n, () => C(o)), {
77
- innerItems: a,
75
+ }), F(n, () => C(a)), {
76
+ innerItems: i,
78
77
  outerItems: l
79
78
  };
80
- }, te = (e, t, s = {}) => {
79
+ }, X = (e, t, s = {}) => {
81
80
  const r = c(e.value ? "open" : "closed");
82
- v(e, (i) => {
83
- r.value = i ? "open" : "closed";
81
+ f(e, (o) => {
82
+ r.value = o ? "open" : "closed";
84
83
  });
85
84
  const n = S(r, s.debounce ?? 0);
86
- v(n, (i) => {
87
- switch (t("update:state", i), i) {
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 a() {
95
+ function i() {
97
96
  r.value = "open";
98
97
  }
99
98
  function l() {
100
99
  r.value = "closed";
101
100
  }
102
- function o() {
101
+ function a() {
103
102
  r.value = r.value === "open" ? "closed" : "open";
104
103
  }
105
104
  return {
106
105
  state: n,
107
- open: a,
106
+ open: i,
108
107
  close: l,
109
- toggle: o
108
+ toggle: a
110
109
  };
111
110
  };
112
- function re(e, t, s = {}) {
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 ne(e) {
125
+ function te(e) {
127
126
  const t = M(), s = c();
128
- e ? v(e, (o) => {
129
- s.value = o;
127
+ e ? f(e, (a) => {
128
+ s.value = a;
130
129
  }) : R(() => {
131
130
  if (t) {
132
- const o = t.vnode[Y ? "el" : "elm"];
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) || a.value), n = u(() => !r.value), a = P(`(min-width: ${O.md})`);
137
- function l(o) {
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 (!o)
138
+ if (!a)
140
139
  return !1;
141
- const i = (d = o.getAttribute("force-screen")) == null ? void 0 : d.split(/\s+/);
142
- return i != null && i.some((m) => ["md", "lg", "xl"].includes(m)) ? !0 : l(o.parentElement ?? void 0);
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 ue = () => L.theme, se = (e) => u(() => e.value ?? g(q, b.Auto)), oe = (e, t) => u(() => typeof e.value != "function" ? new Intl.DateTimeFormat(t.value, {
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 ae(e = !1) {
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 ie = () => {
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
- V as D,
195
+ L as D,
197
196
  U as L,
198
- q as T,
199
- k as a,
200
- G as b,
201
- J as c,
202
- K as d,
203
- N as e,
204
- X as f,
205
- ee as g,
206
- te as h,
207
- re as i,
208
- ne as j,
209
- ue as k,
210
- se as l,
211
- oe as m,
212
- ie as n,
213
- ae as u
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.0",
3
+ "version": "21.5.2",
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.0",
62
+ "@onereach/styles": "^21.5.2",
63
63
  "@vueuse/core": "9.13.0"
64
64
  },
65
65
  "devDependencies": {
@@ -70,5 +70,5 @@
70
70
  "peerDependencies": {
71
71
  "vue": "3.3.4 || 2.6.14"
72
72
  },
73
- "gitHead": "d61e2dc2eff47fc993e8e2fd863fa1199d38bc0d"
73
+ "gitHead": "13fdf07a7d669cb6998d43e7d973486b0f1d2c4b"
74
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
- [isVue3 ? 'created' : 'bind']: created,
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
- [isVue3 ? 'created' : 'bind']: created,
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 element = (currentInstance.vnode as any)[isVue3 ? 'el' : 'elm'] as unknown;
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
- };