@rotki/ui-library 2.3.0 → 2.4.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.
@@ -1,7 +1,7 @@
1
1
  import { logicOr as l } from "@vueuse/math";
2
2
  import { computed as f, ref as y } from "vue";
3
3
  import { get as i, objectPick as p, objectOmit as b, set as d } from "@vueuse/shared";
4
- import { c as x } from "../vendor-DcELhvq6.js";
4
+ import { c as x } from "../vendor-DONK-IZM.js";
5
5
  import { createGlobalState as A } from "@vueuse/core";
6
6
  class j extends Error {
7
7
  constructor(r) {
@@ -1,4 +1,4 @@
1
- import { g as de } from "./index-ubVTzSrC.js";
1
+ import { g as de } from "./index-B4Z0iEL-.js";
2
2
  const Ce = /\d/, De = ["-", "_", "/", "."];
3
3
  function Ee(t = "") {
4
4
  if (!Ce.test(t))
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "@rotki/ui-library",
5
- "version": "2.3.0",
5
+ "version": "2.4.1",
6
6
  "js-types-syntax": "typescript",
7
7
  "description-markup": "markdown",
8
8
  "contributions": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rotki/ui-library",
3
- "version": "2.3.0",
3
+ "version": "2.4.1",
4
4
  "description": "A vue design system and component library for rotki",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -1,477 +0,0 @@
1
- import { useWindowSize as se, breakpointsTailwind as re, useBreakpoints as ie, createSharedComposable as ce, useColorMode as ae, unrefElement as Y, useResizeObserver as ee, useVirtualList as le, useArrayMap as ue, watchOnce as fe, useEventListener as K, useMutationObserver as de } from "@vueuse/core";
2
- import { c as G, p as pe, d as me, a as he, o as ge, f as ye, b as we, e as Le, g as be } from "../vendor-DcELhvq6.js";
3
- import { computed as M, inject as te, ref as h, watch as W, onMounted as ne, watchEffect as ve, nextTick as Z } from "vue";
4
- import { get as e, set as l } from "@vueuse/shared";
5
- import { LuChevronsUpDown as Ce, LuArrowUp as xe, LuArrowDown as Te, LuArrowLeft as Se, LuArrowRight as ke, LuChevronUp as Ee, LuChevronDown as Pe, LuChevronLeft as Ie, LuChevronRight as Oe, LuChevronsLeft as $e, LuChevronsRight as Be, LuCircleAlert as De, LuCheck as Ae, LuCircleX as Me, LuCircleCheck as Re, LuCheckboxBlank as ze, LuCheckboxFill as He, LuCheckboxIndeterminateFill as _e, LuCheckboxBlankCircle as qe, LuCheckboxBlankCircleFill as je, LuRadioButtonFill as Ue, LuClock as Ve } from "../icons/icons_1.es.js";
6
- import { LuEllipsis as We, LuInfo as Fe, LuEye as Ne, LuEyeOff as Xe } from "../icons/icons_2.es.js";
7
- import { LuTriangleAlert as Ke, LuX as Ge } from "../icons/icons_4.es.js";
8
- import { c as Je } from "../utils/index-CBlHWMiJ.js";
9
- import { d as oe, T as O } from "../types/index-CN6Ip1GL.js";
10
- function dt() {
11
- const { width: r } = se(), f = {
12
- xs: 0,
13
- ...re
14
- }, p = ie(f), y = Object.keys, c = y(f), g = c.map(
15
- (n, a) => [
16
- n,
17
- a < c.length - 1 ? p.between(n, c[a + 1]) : p[n]
18
- ]
19
- ), i = g.map(([n, a]) => [
20
- G(`is_${n}`),
21
- a
22
- ]), v = c.map((n) => [
23
- G(`is_${n}_and_up`),
24
- p.greaterOrEqual(n)
25
- ]), w = c.map((n) => [
26
- G(`is_${n}_and_down`),
27
- p.smaller(n)
28
- ]), d = M(() => {
29
- var n;
30
- return ((n = g.find((a) => e(a[1]))) == null ? void 0 : n[0]) || "";
31
- });
32
- return {
33
- ...Object.fromEntries(i),
34
- ...Object.fromEntries(v),
35
- ...Object.fromEntries(w),
36
- name: d,
37
- width: r
38
- };
39
- }
40
- const Qe = [
41
- Ce,
42
- We,
43
- Ke,
44
- Ge,
45
- Fe,
46
- xe,
47
- Te,
48
- Se,
49
- ke,
50
- Ee,
51
- Pe,
52
- Ie,
53
- Oe,
54
- $e,
55
- Be,
56
- De,
57
- Ne,
58
- Xe,
59
- Ae,
60
- Me,
61
- Re,
62
- ze,
63
- He,
64
- _e,
65
- qe,
66
- je,
67
- Ue,
68
- Ve
69
- ], Ye = Symbol.for("rui:icons");
70
- function pt(r) {
71
- const f = (r == null ? void 0 : r.registeredIcons) || [];
72
- return {
73
- registeredIcons: {
74
- ...Object.fromEntries(
75
- [
76
- ...Qe,
77
- ...f
78
- ].map(({ components: p, name: y }) => [y, p])
79
- )
80
- }
81
- };
82
- }
83
- function mt() {
84
- const r = te(Ye);
85
- return Je(r, "Could not find icons injection"), r;
86
- }
87
- const V = h({ ...oe }), ht = ce(() => {
88
- const { state: r, store: f } = ae(), p = M(() => e(f) === O.auto), y = M(() => e(r) === O.light), c = M(() => e(r) === O.dark), g = M(() => e(y) ? e(V).light : e(V).dark), i = (n) => {
89
- l(f, n || O.auto);
90
- }, v = () => {
91
- e(p) ? i(O.light) : e(y) ? i(O.dark) : e(c) && i(O.auto);
92
- }, w = (n) => {
93
- l(V, n);
94
- };
95
- return {
96
- config: V,
97
- init: (n) => {
98
- i(n.mode ?? O.auto), w(n.config ?? { ...oe }), typeof window < "u" && W([y, g], ([a, x]) => {
99
- const o = /* @__PURE__ */ new Map();
100
- Object.entries(x).forEach(([C, T]) => {
101
- o.set(`--rui-${C}-darker`, T.darker), o.set(`--rui-${C}-lighter`, T.lighter), o.set(`--rui-${C}-main`, T.DEFAULT);
102
- });
103
- const u = a ? O.light : O.dark;
104
- o.set("--rui-text-disabled", `var(--rui-${u}-text-disabled)`), o.set("--rui-text-primary", `var(--rui-${u}-text-primary)`), o.set("--rui-text-secondary", `var(--rui-${u}-text-secondary)`);
105
- const P = document.documentElement.style;
106
- o.forEach((C, T) => {
107
- P.setProperty(T, C);
108
- });
109
- }, { immediate: !0 });
110
- },
111
- isAutoControlled: p,
112
- isDark: c,
113
- isLight: y,
114
- setThemeConfig: w,
115
- state: r,
116
- store: f,
117
- switchThemeScheme: i,
118
- theme: g,
119
- toggleThemeMode: v
120
- };
121
- }), $ = {
122
- adaptive: !0,
123
- gpuAcceleration: !0,
124
- locked: !1,
125
- offsetDistance: 8,
126
- offsetSkid: 0,
127
- overflowPadding: 8,
128
- placement: "bottom",
129
- resize: !0,
130
- scroll: !0,
131
- strategy: "absolute"
132
- }, Ze = pe({
133
- defaultModifiers: [
134
- ...me,
135
- he,
136
- ge,
137
- ye,
138
- we,
139
- Le,
140
- be
141
- ]
142
- });
143
- function gt(r, f = h(!1), p = h(0), y = h(0), c) {
144
- const g = h(null), i = h(null), v = h(null), w = h(!1), d = h(), n = h(), a = h(!1), x = h(!1), o = () => {
145
- l(a, !1);
146
- }, u = () => {
147
- var m;
148
- (m = e(v)) == null || m.update();
149
- }, P = (m = !1) => {
150
- if (!e(f) && (e(n) && (clearTimeout(e(n)), l(n, void 0)), l(x, !1), !e(d))) {
151
- l(a, !0);
152
- const b = setTimeout(() => {
153
- l(w, !0), l(d, void 0);
154
- }, m ? 0 : e(p));
155
- l(d, b);
156
- }
157
- }, C = (m = !1) => {
158
- if (!e(f) && (e(d) && (clearTimeout(e(d)), l(d, void 0)), !e(n))) {
159
- const b = setTimeout(() => {
160
- e(w) || o(), l(w, !1), l(n, void 0);
161
- }, m ? 0 : e(y));
162
- l(n, b);
163
- }
164
- }, T = () => {
165
- l(x, !0);
166
- };
167
- return ne(() => {
168
- ve((m) => {
169
- if (!e(i) || !e(g) && !e(c))
170
- return;
171
- const b = Y(i), B = e(c) || Y(g);
172
- if (!(b instanceof HTMLElement) || !B)
173
- return;
174
- const {
175
- adaptive: R = $.adaptive,
176
- gpuAcceleration: E = $.gpuAcceleration,
177
- locked: z = $.locked,
178
- offsetDistance: L = $.offsetDistance,
179
- offsetSkid: F = $.offsetSkid,
180
- overflowPadding: j = $.overflowPadding,
181
- placement: U = $.placement,
182
- resize: H = $.resize,
183
- scroll: _ = $.scroll,
184
- strategy: N = $.strategy
185
- } = e(r), X = Ze(B, b, {
186
- modifiers: [
187
- {
188
- enabled: !z,
189
- name: "flip"
190
- },
191
- {
192
- name: "preventOverflow",
193
- options: {
194
- padding: j
195
- }
196
- },
197
- {
198
- name: "offset",
199
- options: {
200
- offset: [F, L]
201
- }
202
- },
203
- {
204
- name: "computeStyles",
205
- options: {
206
- adaptive: R,
207
- gpuAcceleration: E
208
- }
209
- },
210
- {
211
- name: "eventListeners",
212
- options: {
213
- resize: H,
214
- scroll: _
215
- }
216
- },
217
- {
218
- name: "arrow",
219
- options: {
220
- padding: 4
221
- }
222
- }
223
- ],
224
- placement: U,
225
- strategy: N
226
- });
227
- l(v, X), m(X.destroy);
228
- });
229
- }), ee([g, i], async () => {
230
- const m = e(v);
231
- e(w) && m && await m.update();
232
- }), {
233
- instance: v,
234
- leavePending: x,
235
- onClose: C,
236
- onLeavePending: T,
237
- onOpen: P,
238
- onPopperLeave: o,
239
- open: w,
240
- popper: i,
241
- popperEnter: a,
242
- reference: g,
243
- updatePopper: u
244
- };
245
- }
246
- function et({
247
- keyAttr: r,
248
- textAttr: f
249
- }) {
250
- function p(c) {
251
- var g;
252
- return f ? typeof f == "function" ? f(c) : (g = c[f]) == null ? void 0 : g.toString() : c == null ? void 0 : c.toString();
253
- }
254
- function y(c) {
255
- return r ? c[r] : c;
256
- }
257
- return {
258
- getIdentifier: y,
259
- getText: p
260
- };
261
- }
262
- function yt({
263
- appendWidth: r,
264
- autoFocus: f,
265
- autoSelectFirst: p,
266
- dense: y,
267
- hideSelected: c,
268
- itemHeight: g = 48,
269
- keyAttr: i,
270
- menuRef: v,
271
- options: w,
272
- overscan: d = 5,
273
- prependWidth: n,
274
- setValue: a,
275
- textAttr: x,
276
- value: o
277
- }) {
278
- const u = M(() => {
279
- const t = e(w);
280
- return c ? t.filter((s) => !H(s)) : t;
281
- }), { getIdentifier: P, getText: C } = et({
282
- keyAttr: i,
283
- textAttr: x
284
- }), { containerProps: T, list: m, scrollTo: b, wrapperProps: B } = le(
285
- u,
286
- {
287
- itemHeight: g,
288
- overscan: d
289
- }
290
- ), R = ue(m, ({ data: t, index: s }) => ({ _index: s, item: t })), E = h(!1), z = M(() => {
291
- const t = e(o);
292
- return !i || !t ? t : Array.isArray(t) ? t.map((s) => s[i]) : t[i];
293
- }), L = h(e(p) ? 0 : -1), F = M(() => {
294
- const t = { max: 0, min: 0 }, s = 30, I = 1.5, S = e(y) ? 12 : 13;
295
- e(u).forEach((D) => {
296
- var J, Q;
297
- const A = ((Q = (J = C(D)) == null ? void 0 : J.toString()) == null ? void 0 : Q.length) ?? 0;
298
- t.min === 0 && t.max === 0 ? (t.min = A, t.max = A) : A < t.min ? t.min = A : A > t.max && (t.max = A);
299
- });
300
- const q = t.max - t.min;
301
- function k(D) {
302
- const A = (n ? n + 0.5 : 0) + (r ? r + 0.5 : 0);
303
- return `${Math.min(D * S / 16 + I + A, s)}rem`;
304
- }
305
- return q <= 5 ? k(t.max) : k(t.min + q / 2);
306
- });
307
- function j(t = !1) {
308
- l(E, t);
309
- }
310
- function U(t) {
311
- const s = e(o), I = Array.isArray(s) ? s : s ? [s] : [];
312
- return I.length === 0 ? -1 : I.findIndex((S) => i ? S[i] === t[i] : S === t);
313
- }
314
- function H(t) {
315
- return U(t) !== -1;
316
- }
317
- async function _(t = !1) {
318
- const s = e(L);
319
- s > -1 && await Z(() => {
320
- var S, q;
321
- if ((S = e(v)) == null ? void 0 : S.parentElement) {
322
- const k = e(v).getElementsByClassName("highlighted")[0];
323
- if (k)
324
- (q = k.scrollIntoView) == null || q.call(k, { behavior: t ? "smooth" : "auto", block: "nearest" }), e(f) && "focus" in k && typeof k.focus == "function" && (k == null || k.focus());
325
- else if (b(s), e(f)) {
326
- const D = e(v).getElementsByClassName("highlighted")[0];
327
- D && "focus" in D && typeof D.focus == "function" && D.focus();
328
- }
329
- }
330
- });
331
- }
332
- async function N(t) {
333
- await Z(() => {
334
- if (t) {
335
- const s = e(o);
336
- if (Array.isArray(s) && s.length > 0 || s) {
337
- const I = e(u).findIndex(H);
338
- I > -1 && l(L, I);
339
- }
340
- fe(m, async () => {
341
- await _();
342
- });
343
- }
344
- });
345
- }
346
- return W(E, N), W(L, async (t, s) => {
347
- t !== s && await _(!0);
348
- }), W(u, async () => {
349
- e(L) !== -1 ? e(p) ? (l(L, 0), await _()) : (l(L, -1), b(0)) : b(0);
350
- }), {
351
- applyHighlighted: () => {
352
- if (!a || !e(E))
353
- return;
354
- const t = e(L);
355
- if (t === -1)
356
- return;
357
- const s = e(u).find((I, S) => t === S);
358
- s && a(s);
359
- },
360
- containerProps: T,
361
- getIdentifier: P,
362
- getText: C,
363
- highlightedIndex: L,
364
- isActiveItem: H,
365
- isOpen: E,
366
- itemIndexInValue: U,
367
- menuWidth: F,
368
- moveHighlight: (t) => {
369
- if (!e(E)) {
370
- j(!0);
371
- return;
372
- }
373
- let s = e(L);
374
- s += t ? -1 : 1;
375
- const S = e(u).length;
376
- s >= S ? l(L, 0) : s < 0 ? l(L, S - 1) : l(L, s);
377
- },
378
- optionsWithSelectedHidden: u,
379
- renderedData: R,
380
- toggle: j,
381
- valueKey: z,
382
- wrapperProps: B
383
- };
384
- }
385
- const tt = Symbol.for("rui:table");
386
- function wt(r) {
387
- return {
388
- globalItemsPerPage: !1,
389
- itemsPerPage: h(10),
390
- limits: [10, 25, 50, 100],
391
- stickyOffset: h(0),
392
- ...r
393
- };
394
- }
395
- function Lt() {
396
- const r = te(tt);
397
- if (!r)
398
- throw new Error("Could not find rui table options injection");
399
- return r;
400
- }
401
- function bt(r = h(!1), f) {
402
- const p = h(null), y = h(null), c = h(!1), g = -0.5, i = {
403
- head: ":scope > thead[data-id=head-main]",
404
- headClone: ":scope > thead[data-id=head-clone]",
405
- row: ":scope > tbody > tr:not([hidden])",
406
- th: ":scope > th"
407
- }, v = () => {
408
- const d = e(p);
409
- if (!e(r) || !d)
410
- return;
411
- const n = d.querySelector(
412
- `${i.headClone} > tr`
413
- ), a = d.querySelector(`${i.head} > tr`) ?? null, x = () => {
414
- const o = a == null ? void 0 : a.querySelectorAll(
415
- i.th
416
- ), u = n == null ? void 0 : n.querySelectorAll(i.th);
417
- u == null || u.forEach((P, C) => {
418
- ee(P, (T) => {
419
- const m = T[0].target.getBoundingClientRect(), b = o == null ? void 0 : o.item(C);
420
- b && (b.style.width = `${m.width}px`);
421
- });
422
- });
423
- };
424
- de(n, (o) => {
425
- for (const u of o)
426
- (u.type === "childList" || u.type === "attributes") && x();
427
- }, {
428
- attributes: !0,
429
- childList: !0,
430
- subtree: !0
431
- }), x();
432
- }, w = () => {
433
- var z;
434
- const d = e(p);
435
- if (!e(r) || !d)
436
- return;
437
- const n = d.getBoundingClientRect(), a = d.querySelector(
438
- i.headClone
439
- ), x = a == null ? void 0 : a.getBoundingClientRect(), o = d.querySelector(i.head) ?? null, u = o == null ? void 0 : o.getBoundingClientRect();
440
- if (!n || !x || !o || !a || !u)
441
- return;
442
- const {
443
- height: P,
444
- left: C,
445
- width: T
446
- } = x, { bottom: m, top: b } = n, B = e(f) ?? 0;
447
- o.style.width = `${T}px`;
448
- const R = d.querySelectorAll(i.row), E = (z = R.item(R.length - 1)) == null ? void 0 : z.getBoundingClientRect();
449
- if (b <= B && m > B && R.length > 1) {
450
- l(c, !0), o.style.left = `${C + g}px`;
451
- const L = (E == null ? void 0 : E.height) ?? 0;
452
- m <= L + P + B ? o.style.top = `${m - L - P}px` : o.style.top = `${B}px`;
453
- } else
454
- l(c, !1), o.style.left = `${g}px`, o.style.top = "0";
455
- };
456
- return ne(() => {
457
- w(), K(y, "scroll", w), K(document.body, "scroll", w), K(window, "resize", w), v();
458
- }), {
459
- stick: c,
460
- table: p,
461
- tableScroller: y
462
- };
463
- }
464
- export {
465
- Ye as I,
466
- tt as T,
467
- gt as a,
468
- ht as b,
469
- et as c,
470
- yt as d,
471
- Lt as e,
472
- bt as f,
473
- wt as g,
474
- pt as h,
475
- dt as i,
476
- mt as u
477
- };
@@ -1,33 +0,0 @@
1
- import { g as l, h as m, b as n, T as c, I as u } from "./composables/index-BpCfYHMO.js";
2
- import "./types/index-CN6Ip1GL.js";
3
- import s from "dayjs";
4
- import { u as p, h as f } from "./vendor-DcELhvq6.js";
5
- import "./components/index.es.js";
6
- import "./consts/colors-D563Ic3q.js";
7
- import "./icons/index.es.js";
8
- import "./icons/icons_1.es.js";
9
- import "./icons/icons_2.es.js";
10
- import "./icons/icons_3.es.js";
11
- import "./icons/icons_4.es.js";
12
- function R(e) {
13
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
14
- }
15
- function S(e = {}) {
16
- var o, r;
17
- const { theme: i } = e, t = Object.freeze({
18
- icons: m({
19
- registeredIcons: (o = e.theme) == null ? void 0 : o.icons
20
- }),
21
- table: l((r = e.defaults) == null ? void 0 : r.table)
22
- });
23
- return {
24
- defaults: t,
25
- install: (a) => {
26
- n().init({ ...i }), a.provide(c, t.table), a.provide(u, t.icons), s.extend(p), s.extend(f);
27
- }
28
- };
29
- }
30
- export {
31
- S as c,
32
- R as g
33
- };