@shlinkio/shlink-frontend-kit 0.9.9 → 0.9.10

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/index.d.ts CHANGED
@@ -36,10 +36,12 @@ export declare const Checkbox: FC<BooleanControlProps>;
36
36
 
37
37
  export declare function determineOrder<Fields extends string = string>(orderDirChange: OrderDirChange<Fields>): Order<Fields>;
38
38
 
39
+ /** @deprecated */
39
40
  export declare function determineOrder<Fields extends string = string>(currentField?: Fields, newField?: Fields, currentOrderDir?: OrderDir): Order<Fields>;
40
41
 
41
42
  export declare function determineOrderDir<Fields extends string = string>(orderDirChange: OrderDirChange<Fields>): OrderDir;
42
43
 
44
+ /** @deprecated */
43
45
  export declare function determineOrderDir<Fields extends string = string>(currentField?: Fields, newField?: Fields, currentOrderDir?: OrderDir): OrderDir;
44
46
 
45
47
  /** @deprecated */
@@ -152,6 +154,7 @@ export declare type OrderingDropdownProps<T extends string = string> = {
152
154
 
153
155
  export declare type OrderSetter<T> = {
154
156
  (order: Order<T>): void;
157
+ /** @deprecated Pass the order object as the only argument */
155
158
  (orderField?: T, orderDir?: OrderDir): void;
156
159
  };
157
160
 
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@ import { FontAwesomeIcon as b } from "@fortawesome/react-fontawesome";
4
4
  import { clsx as u } from "clsx";
5
5
  import { Card as w, CardHeader as H, CardBody as M, Dropdown as v, DropdownToggle as k, DropdownMenu as C, NavItem as $, NavLink as F, Nav as G, DropdownItem as g } from "reactstrap";
6
6
  import { useId as O, useState as x, useRef as j, useCallback as U, useMemo as q, Children as Q, isValidElement as V, useEffect as Y } from "react";
7
- import { u as T, d as W } from "./ordering-B_hekQuu.js";
8
- import { e as He, o as Me, s as $e, f as Fe, a as Ge, g as je, b as Ue, c as qe } from "./ordering-B_hekQuu.js";
7
+ import { u as T, d as W } from "./ordering-VI1mTe3x.js";
8
+ import { e as He, o as Me, s as $e, f as Fe, a as Ge, g as je, b as Ue, c as qe } from "./ordering-VI1mTe3x.js";
9
9
  import { useNavigate as z, useLocation as J, NavLink as X } from "react-router";
10
10
  const ue = ({ className: r, children: e, loading: s = !1, type: t = "default", fullWidth: a = !1 }) => /* @__PURE__ */ n(
11
11
  w,
@@ -0,0 +1,102 @@
1
+ import { useMemo as T, useEffect as C, useRef as A, useCallback as d, useState as b } from "react";
2
+ function k(e, { elementsSelector: o, focusFirstItem: r = !1, vertical: n = !0, horizontal: t = !0 }) {
3
+ const s = T(() => {
4
+ const c = [];
5
+ return n && c.push("ArrowDown"), t && c.push("ArrowRight"), c;
6
+ }, [t, n]), u = T(() => {
7
+ const c = [];
8
+ return n && c.push("ArrowUp"), t && c.push("ArrowLeft"), c;
9
+ }, [t, n]), l = T(() => [...s, ...u], [s, u]);
10
+ C(() => {
11
+ const c = e.current;
12
+ if (!c)
13
+ return () => {
14
+ };
15
+ const f = new AbortController(), g = () => [...c.querySelectorAll(o)], w = g(), h = Math.max(w.findIndex((i) => i.dataset.selected === "true"), 0);
16
+ return w.forEach((i, a) => {
17
+ i.tabIndex = a === h ? 0 : -1, r && a === h && i.focus();
18
+ }), c.addEventListener("keydown", (i) => {
19
+ if (!l.includes(i.key))
20
+ return;
21
+ i.preventDefault();
22
+ const a = g(), p = a.findIndex((m) => m.tabIndex === 0), y = s.includes(i.key) ? a[p + 1] ?? a[0] : a[p - 1] ?? a[a.length - 1];
23
+ a.forEach((m) => {
24
+ m.tabIndex = -1;
25
+ }), y.tabIndex = 0, y.focus();
26
+ }, { signal: f.signal }), () => f.abort();
27
+ }, [l, e, o, r, s]);
28
+ }
29
+ function E(e, o = globalThis.setTimeout, r = globalThis.clearTimeout) {
30
+ const n = A(null), t = d(() => {
31
+ n.current && r(n.current);
32
+ }, [r]), s = d((u, l) => {
33
+ t(), n.current = o(() => {
34
+ u(), n.current = null;
35
+ }, l ?? e);
36
+ }, [t, e, o]);
37
+ return C(() => t, [t]), T(
38
+ () => ({ setTimeout: s, clearCurrentTimeout: t }),
39
+ [t, s]
40
+ );
41
+ }
42
+ const F = 2e3, I = (e = {}, o, r = globalThis.setTimeout, n = globalThis.clearTimeout) => {
43
+ const { initialValue: t = !1, delay: s = F } = typeof e == "boolean" ? {
44
+ initialValue: e,
45
+ delay: o
46
+ } : e, { setTimeout: u } = E(s, r, n), [l, c] = b(t), f = A(t), g = d(() => {
47
+ c(!f.current), u(() => c(f.current));
48
+ }, [u]);
49
+ return [l, g];
50
+ };
51
+ function L(e = !1, o = !1) {
52
+ const [r, n] = b(e), t = d(() => n((l) => !l), []), s = d(() => n(!0), []), u = d(() => n(!1), []);
53
+ return o ? { flag: r, toggle: t, setToTrue: s, setToFalse: u } : [r, t, s, u];
54
+ }
55
+ function D(e, o, r) {
56
+ if (!e || typeof e == "string")
57
+ return D({ currentField: e, newField: o, currentOrderDir: r });
58
+ const n = e;
59
+ if (n.currentField !== n.newField)
60
+ return "ASC";
61
+ const t = {
62
+ ASC: "DESC",
63
+ DESC: void 0
64
+ };
65
+ return n.currentOrderDir ? t[n.currentOrderDir] : "ASC";
66
+ }
67
+ function S(e, o, r) {
68
+ if (!e || typeof e == "string")
69
+ return S({ currentField: e, newField: o, currentOrderDir: r });
70
+ const n = e, t = D(n);
71
+ return {
72
+ field: t ? n.newField : void 0,
73
+ dir: t
74
+ };
75
+ }
76
+ const v = (e, { field: o, dir: r }) => !o || !r ? e : e.sort((n, t) => {
77
+ const s = r === "ASC" ? 1 : -1, u = r === "ASC" ? -1 : 1;
78
+ return n[o] > t[o] ? s : u;
79
+ }), M = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, R = (e) => {
80
+ const [o, r] = e.split("-");
81
+ return { field: o, dir: r };
82
+ }, U = (e) => {
83
+ const [o, r] = b(e), n = d(
84
+ (t, s) => r(
85
+ t && typeof t == "object" ? t : { field: t, dir: s }
86
+ ),
87
+ []
88
+ );
89
+ return [o, n];
90
+ };
91
+ export {
92
+ k as a,
93
+ E as b,
94
+ I as c,
95
+ D as d,
96
+ S as e,
97
+ R as f,
98
+ U as g,
99
+ M as o,
100
+ v as s,
101
+ L as u
102
+ };
package/dist/tailwind.js CHANGED
@@ -2,9 +2,9 @@ import { jsxs as p, jsx as n, Fragment as _ } from "react/jsx-runtime";
2
2
  import w, { clsx as f } from "clsx";
3
3
  import { useRef as T, useState as R, useEffect as B, forwardRef as y, useCallback as P, createContext as q, useContext as O, useId as $, useMemo as W } from "react";
4
4
  import { Link as G, NavLink as mt } from "react-router";
5
- import { faClose as pt, faEyeSlash as bt, faEye as gt, faCircleNotch as nt, faSearch as ut, faCaretDown as ht, faChevronLeft as V, faChevronRight as tt, faEllipsisV as ft, faSortAmountUp as xt, faSortAmountDown as yt, faCheck as kt } from "@fortawesome/free-solid-svg-icons";
5
+ import { faClose as pt, faEyeSlash as gt, faEye as bt, faCircleNotch as nt, faSearch as ut, faCaretDown as ht, faChevronLeft as V, faChevronRight as tt, faEllipsisV as ft, faSortAmountUp as xt, faSortAmountDown as yt, faCheck as kt } from "@fortawesome/free-solid-svg-icons";
6
6
  import { FontAwesomeIcon as v } from "@fortawesome/react-fontawesome";
7
- import { u as vt, b as Nt, a as Ct, e as Tt, c as It } from "./ordering-B_hekQuu.js";
7
+ import { u as vt, b as Nt, a as Ct, e as Tt, c as It } from "./ordering-VI1mTe3x.js";
8
8
  import { useFloating as ot, flip as Pt, offset as Ot, useClick as Dt, useInteractions as at, autoPlacement as Lt, arrow as Mt, useHover as Bt, useTransitionStyles as Rt } from "@floating-ui/react";
9
9
  import { createPortal as Ft } from "react-dom";
10
10
  import "reactstrap";
@@ -89,20 +89,20 @@ function Ht({
89
89
  "aria-label": s = "Items",
90
90
  ...c
91
91
  }) {
92
- const [m, g] = R(0), u = P((x) => {
93
- if (g(x), o) {
94
- const [b, h] = [...e.entries()][x];
95
- o(b, h);
92
+ const [m, b] = R(0), u = P((x) => {
93
+ if (b(x), o) {
94
+ const [g, h] = [...e.entries()][x];
95
+ o(g, h);
96
96
  }
97
97
  }, [e, o]);
98
98
  return B(() => {
99
99
  const x = i == null ? void 0 : i.current;
100
100
  if (!x)
101
101
  return;
102
- const b = (h) => {
102
+ const g = (h) => {
103
103
  ["Enter", "ArrowUp", "ArrowDown"].includes(h.key) && h.preventDefault(), h.key === "ArrowDown" ? u(Math.min(m + 1, e.size - 1)) : h.key === "ArrowUp" ? u(Math.max(m - 1, 0)) : h.key === "Enter" && t([...e.values()][m]);
104
104
  };
105
- return x.addEventListener("keydown", b), () => x.removeEventListener("keydown", b);
105
+ return x.addEventListener("keydown", g), () => x.removeEventListener("keydown", g);
106
106
  }, [m, i, u, e, t]), /* @__PURE__ */ p(
107
107
  C,
108
108
  {
@@ -114,7 +114,7 @@ function Ht({
114
114
  ...c,
115
115
  children: [
116
116
  e.size === 0 && /* @__PURE__ */ n("i", { role: "option", "aria-disabled": !0, "aria-selected": !1, "data-testid": "no-items", className: "tw:px-2 tw:py-1", children: d }),
117
- [...e.entries()].map(([x, b], h) => /* @__PURE__ */ n(
117
+ [...e.entries()].map(([x, g], h) => /* @__PURE__ */ n(
118
118
  "button",
119
119
  {
120
120
  id: `${r}_${x}`,
@@ -126,9 +126,9 @@ function Ht({
126
126
  { "tw:bg-lm-secondary tw:dark:bg-dm-secondary": h === m }
127
127
  ),
128
128
  tabIndex: -1,
129
- onClick: () => t(b),
129
+ onClick: () => t(g),
130
130
  onMouseOver: () => u(h),
131
- children: a(b)
131
+ children: a(g)
132
132
  },
133
133
  x
134
134
  ))
@@ -206,6 +206,7 @@ const H = q(void 0), F = q({ responsive: !0, size: "md" }), Ut = ({ children: r,
206
206
  "tw:p-3": s === "lg",
207
207
  "tw:border-b-1": !i,
208
208
  "tw:block tw:lg:table-cell tw:not-last:border-b-1 tw:lg:border-b-1": i,
209
+ "tw:text-left": d === "th",
209
210
  // For responsive tables, display the content in data-column attribute for md sizes and lower
210
211
  "tw:before:lg:hidden tw:before:content-[attr(data-column)] tw:before:font-bold tw:before:mr-1": i && d === "td"
211
212
  },
@@ -229,7 +230,7 @@ const H = q(void 0), F = q({ responsive: !0, size: "md" }), Ut = ({ children: r,
229
230
  type: d = "button",
230
231
  ...i
231
232
  }, s) => {
232
- const c = "to" in i, m = c ? G : "button", g = c ? void 0 : d;
233
+ const c = "to" in i, m = c ? G : "button", b = c ? void 0 : d;
233
234
  return /* @__PURE__ */ n(
234
235
  m,
235
236
  {
@@ -277,13 +278,14 @@ const H = q(void 0), F = q({ responsive: !0, size: "md" }), Ut = ({ children: r,
277
278
  "tw:highlight:bg-danger": t === "danger"
278
279
  },
279
280
  {
281
+ "tw:cursor-pointer": !e,
280
282
  "tw:pointer-events-none tw:opacity-65": e
281
283
  },
282
284
  r
283
285
  ),
284
286
  disabled: c ? void 0 : e,
285
287
  "aria-disabled": c ? e : void 0,
286
- type: g,
288
+ type: b,
287
289
  ...i
288
290
  }
289
291
  );
@@ -321,7 +323,7 @@ const H = q(void 0), F = q({ responsive: !0, size: "md" }), Ut = ({ children: r,
321
323
  onClick: r,
322
324
  className: w(
323
325
  "tw:opacity-50 tw:highlight:opacity-80 tw:transition-opacity",
324
- "tw:rounded-md tw:focus-ring",
326
+ "tw:rounded-md tw:focus-ring tw:cursor-pointer",
325
327
  e
326
328
  ),
327
329
  "aria-label": t,
@@ -395,8 +397,8 @@ const H = q(void 0), F = q({ responsive: !0, size: "md" }), Ut = ({ children: r,
395
397
  ] });
396
398
  }), Qt = y(({ containerClassName: r, className: e, size: t, ...o }, a) => {
397
399
  const [l, d, , i] = vt(!1), s = T(null), c = P(({ relatedTarget: m }) => {
398
- var g;
399
- (g = s.current) != null && g.contains(m) || i();
400
+ var b;
401
+ (b = s.current) != null && b.contains(m) || i();
400
402
  }, [s, i]);
401
403
  return /* @__PURE__ */ p(
402
404
  "div",
@@ -430,7 +432,7 @@ const H = q(void 0), F = q({ responsive: !0, size: "md" }), Ut = ({ children: r,
430
432
  title: l ? "Hide password" : "Show password",
431
433
  "aria-label": l ? "Hide password" : "Show password",
432
434
  className: f(
433
- "tw:absolute tw:top-[50%] tw:translate-y-[-50%] tw:px-1",
435
+ "tw:absolute tw:top-[50%] tw:translate-y-[-50%] tw:px-1 tw:cursor-pointer",
434
436
  "tw:text-placeholder tw:hover:text-lm-text tw:hover:dark:text-dm-text tw:transition-colors",
435
437
  {
436
438
  "tw:right-1.5": t !== "sm",
@@ -438,7 +440,7 @@ const H = q(void 0), F = q({ responsive: !0, size: "md" }), Ut = ({ children: r,
438
440
  }
439
441
  ),
440
442
  tabIndex: -1,
441
- children: /* @__PURE__ */ n(v, { fixedWidth: !0, icon: l ? bt : gt })
443
+ children: /* @__PURE__ */ n(v, { fixedWidth: !0, icon: l ? gt : bt })
442
444
  }
443
445
  )
444
446
  ]
@@ -575,18 +577,18 @@ function Fe({
575
577
  onFocus: d,
576
578
  ...i
577
579
  }) {
578
- const s = T(null), c = $(), [m, g] = R(), u = W(
580
+ const s = T(null), c = $(), [m, b] = R(), u = W(
579
581
  () => r ? m ?? [...r.keys()][0] : void 0,
580
582
  [m, r]
581
- ), x = P((b) => {
582
- t(b), e(""), s.current.value = "";
583
+ ), x = P((g) => {
584
+ t(g), e(""), s.current.value = "";
583
585
  }, [e, t]);
584
586
  return /* @__PURE__ */ p(
585
587
  "div",
586
588
  {
587
589
  className: "tw:relative",
588
- onBlur: (b) => {
589
- b.currentTarget.contains(b.relatedTarget) || e("");
590
+ onBlur: (g) => {
591
+ g.currentTarget.contains(g.relatedTarget) || e("");
590
592
  },
591
593
  children: [
592
594
  /* @__PURE__ */ n(
@@ -602,8 +604,8 @@ function Fe({
602
604
  "aria-activedescendant": u ? `${c}_${u}` : void 0,
603
605
  autoComplete: "off",
604
606
  autoCorrect: "off",
605
- onFocus: (b) => {
606
- d == null || d(b), e(b.target.value);
607
+ onFocus: (g) => {
608
+ d == null || d(g), e(g.target.value);
607
609
  },
608
610
  ...i
609
611
  }
@@ -615,7 +617,7 @@ function Fe({
615
617
  items: r,
616
618
  anchor: s,
617
619
  onSelectItem: x,
618
- onActiveItemChange: g,
620
+ onActiveItemChange: b,
619
621
  renderItem: o,
620
622
  className: w(
621
623
  "tw:absolute tw:top-full tw:mt-1 tw:z-10",
@@ -659,6 +661,7 @@ const Ee = y(({ className: r, ...e }, t) => /* @__PURE__ */ n(
659
661
  // Overwrite link styles in case a Link is being used
660
662
  "tw:no-underline tw:text-inherit",
661
663
  {
664
+ "tw:cursor-pointer": !t,
662
665
  "tw:pointer-events-none tw:opacity-50": t,
663
666
  "tw:bg-lm-secondary tw:dark:bg-dm-secondary": e && !t,
664
667
  "tw:highlight:bg-lm-secondary tw:dark:highlight:bg-dm-secondary tw:highlight:z-1 tw:relative": !e && !t
@@ -722,8 +725,8 @@ const Ee = y(({ className: r, ...e }, t) => /* @__PURE__ */ n(
722
725
  caretless: c,
723
726
  buttonLabel: m
724
727
  }) => {
725
- const [g, u] = R(!1), x = T(null), { refs: b, floatingStyles: h, context: D } = ot({
726
- open: g,
728
+ const [b, u] = R(!1), x = T(null), { refs: g, floatingStyles: h, context: D } = ot({
729
+ open: b,
727
730
  onOpenChange: u,
728
731
  placement: e === "right" ? "bottom-end" : "bottom-start",
729
732
  middleware: [Pt(), Ot(3)],
@@ -761,7 +764,7 @@ const Ee = y(({ className: r, ...e }, t) => /* @__PURE__ */ n(
761
764
  ...K(),
762
765
  type: "button",
763
766
  "aria-haspopup": !0,
764
- "aria-expanded": g,
767
+ "aria-expanded": b,
765
768
  "aria-controls": S,
766
769
  "aria-label": m,
767
770
  disabled: d,
@@ -769,6 +772,7 @@ const Ee = y(({ className: r, ...e }, t) => /* @__PURE__ */ n(
769
772
  "tw:flex tw:items-center tw:rounded-md tw:focus-ring",
770
773
  {
771
774
  "tw:justify-between": !c,
775
+ "tw:cursor-pointer": !d,
772
776
  "tw:pointer-events-none tw:opacity-50": d,
773
777
  // Button variant
774
778
  "tw:border tw:border-lm-border tw:dark:border-dm-border": t === "button",
@@ -794,10 +798,10 @@ const Ee = y(({ className: r, ...e }, t) => /* @__PURE__ */ n(
794
798
  ]
795
799
  }
796
800
  ),
797
- g && /* @__PURE__ */ n(
801
+ b && /* @__PURE__ */ n(
798
802
  "div",
799
803
  {
800
- ref: b.setFloating,
804
+ ref: g.setFloating,
801
805
  style: h,
802
806
  className: "tw:min-w-full tw:z-1000",
803
807
  ...k(),
@@ -832,6 +836,7 @@ const Ee = y(({ className: r, ...e }, t) => /* @__PURE__ */ n(
832
836
  "tw:px-1.5 tw:py-1 tw:text-sm": t === "sm",
833
837
  "tw:px-3 tw:py-1.5": t === "md",
834
838
  "tw:px-4 tw:py-2 tw:text-lg": t === "lg",
839
+ "tw:cursor-pointer": !e,
835
840
  "tw:pointer-events-none tw:opacity-65": e
836
841
  },
837
842
  r
@@ -876,7 +881,7 @@ const Ee = y(({ className: r, ...e }, t) => /* @__PURE__ */ n(
876
881
  "tw:rounded-none tw:first:rounded-l tw:last:rounded-r"
877
882
  ], st = (r = !1) => w(
878
883
  it,
879
- "tw:px-3 py-2 tw:cursor-pointer tw:no-underline",
884
+ "tw:px-3 tw:py-2 tw:cursor-pointer tw:no-underline",
880
885
  "tw:focus-ring tw:focus-visible:z-1",
881
886
  !r && [
882
887
  "tw:text-lm-brand tw:dark:text-dm-brand",
@@ -884,17 +889,17 @@ const Ee = y(({ className: r, ...e }, t) => /* @__PURE__ */ n(
884
889
  "tw:highlight:bg-lm-secondary tw:dark:highlight:bg-dm-secondary"
885
890
  ],
886
891
  r && "tw:bg-lm-main tw:dark:bg-dm-main tw:text-white"
887
- ), z = ({ children: r }) => /* @__PURE__ */ n("span", { "aria-hidden": !0, className: w(it, "tw:px-3 py-2 tw:text-gray-400"), children: r }), ct = () => /* @__PURE__ */ n(z, { children: U });
892
+ ), z = ({ children: r }) => /* @__PURE__ */ n("span", { "aria-hidden": !0, className: w(it, "tw:px-3 tw:py-2 tw:text-gray-400"), children: r }), ct = () => /* @__PURE__ */ n(z, { children: U });
888
893
  function pe({ children: r, active: e, isEllipsis: t, href: o, ...a }) {
889
894
  const l = W(() => st(e), [e]);
890
895
  return t ? /* @__PURE__ */ n(ct, {}) : /* @__PURE__ */ n(G, { className: l, to: o, ...a, children: r });
891
896
  }
892
- function be({ children: r, active: e, isEllipsis: t, ...o }) {
897
+ function ge({ children: r, active: e, isEllipsis: t, ...o }) {
893
898
  const a = W(() => st(e), [e]);
894
899
  return t ? /* @__PURE__ */ n(ct, {}) : /* @__PURE__ */ n("button", { type: "button", className: a, ...o, children: r });
895
900
  }
896
901
  const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
897
- const o = "urlForPage" in t, a = o ? pe : be, l = P(
902
+ const o = "urlForPage" in t, a = o ? pe : ge, l = P(
898
903
  (d) => o ? { href: A(d) ? void 0 : t.urlForPage(d) } : { onClick: () => !A(d) && t.onPageChange(d) },
899
904
  [o, t]
900
905
  );
@@ -912,7 +917,7 @@ const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
912
917
  )),
913
918
  r === e ? /* @__PURE__ */ n(z, { children: /* @__PURE__ */ n(v, { size: "xs", icon: tt }) }) : /* @__PURE__ */ n(a, { ...l(Math.min(e, r + 1)), "aria-label": "Next", children: /* @__PURE__ */ n(v, { size: "xs", icon: tt }) })
914
919
  ] });
915
- }, ge = ({ buttonLabel: r = "Options", buttonSize: e = "md", ...t }) => /* @__PURE__ */ n(
920
+ }, be = ({ buttonLabel: r = "Options", buttonSize: e = "md", ...t }) => /* @__PURE__ */ n(
916
921
  I,
917
922
  {
918
923
  buttonContent: /* @__PURE__ */ n(
@@ -927,7 +932,7 @@ const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
927
932
  buttonSize: e,
928
933
  ...t
929
934
  }
930
- ), _e = Object.assign(ge, {
935
+ ), _e = Object.assign(be, {
931
936
  Item: I.Item,
932
937
  Separator: I.Separator,
933
938
  Title: I.Title,
@@ -944,8 +949,8 @@ const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
944
949
  var c, m;
945
950
  const d = document.body, i = d.style.overflow, s = d.style.paddingRight;
946
951
  if (r) {
947
- const g = window.outerWidth - d.clientWidth, u = d.scrollHeight > d.clientHeight;
948
- d.style.overflow = "hidden", u && (d.style.paddingRight = `${g}px`), (c = l.current) == null || c.showModal();
952
+ const b = window.outerWidth - d.clientWidth, u = d.scrollHeight > d.clientHeight;
953
+ d.style.overflow = "hidden", u && (d.style.paddingRight = `${b}px`), (c = l.current) == null || c.showModal();
949
954
  } else
950
955
  (m = l.current) == null || m.close();
951
956
  return () => {
@@ -980,12 +985,12 @@ const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
980
985
  confirmText: s = "Confirm",
981
986
  cancelText: c = "Cancel",
982
987
  confirmDisabled: m,
983
- onConfirm: g,
988
+ onConfirm: b,
984
989
  onClosed: u,
985
990
  ...x
986
- } = "onConfirm" in d ? d : { ...d }, [b, h] = R(r), D = T(null), E = T("cancel"), K = P((k) => {
987
- k.preventDefault(), k.stopPropagation(), E.current = "confirm", g == null || g();
988
- }, [g]);
991
+ } = "onConfirm" in d ? d : { ...d }, [g, h] = R(r), D = T(null), E = T("cancel"), K = P((k) => {
992
+ k.preventDefault(), k.stopPropagation(), E.current = "confirm", b == null || b();
993
+ }, [b]);
989
994
  return B(() => {
990
995
  if (r) {
991
996
  E.current = "cancel", h(!0);
@@ -1004,15 +1009,15 @@ const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
1004
1009
  }
1005
1010
  }, [u, r]), B(() => {
1006
1011
  const k = D.current;
1007
- b && k && (k.dataset.open = "");
1008
- }, [b]), /* @__PURE__ */ n(
1012
+ g && k && (k.dataset.open = "");
1013
+ }, [g]), /* @__PURE__ */ n(
1009
1014
  ue,
1010
1015
  {
1011
- open: b,
1016
+ open: g,
1012
1017
  onClose: e,
1013
1018
  className: w(
1014
1019
  {
1015
- "tw:flex tw:w-screen tw:h-screen tw:max-w-screen tw:max-h-screen": b,
1020
+ "tw:flex tw:w-screen tw:h-screen tw:max-w-screen tw:max-h-screen": g,
1016
1021
  "tw:overflow-hidden": t === "cover"
1017
1022
  },
1018
1023
  l
@@ -1067,7 +1072,7 @@ const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
1067
1072
  /* @__PURE__ */ n(et, { onClick: e, label: "Close dialog" })
1068
1073
  ] }),
1069
1074
  /* @__PURE__ */ n(C.Body, { children: a }),
1070
- g && /* @__PURE__ */ p(
1075
+ b && /* @__PURE__ */ p(
1071
1076
  C.Footer,
1072
1077
  {
1073
1078
  "data-testid": "footer",
@@ -1134,7 +1139,7 @@ const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
1134
1139
  }), c = Bt(i, {
1135
1140
  delay: { open: 300 },
1136
1141
  move: !0
1137
- }), { getFloatingProps: m, getReferenceProps: g } = at([c]), { isMounted: u, styles: x } = Rt(i, { duration: 200 }), b = W(() => {
1142
+ }), { getFloatingProps: m, getReferenceProps: b } = at([c]), { isMounted: u, styles: x } = Rt(i, { duration: 200 }), g = W(() => {
1138
1143
  const h = i.placement.split("-")[0];
1139
1144
  return {
1140
1145
  top: "bottom",
@@ -1144,7 +1149,7 @@ const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
1144
1149
  }[h] ?? "";
1145
1150
  }, [i.placement]);
1146
1151
  return {
1147
- anchor: { ...g(), ref: l.setReference },
1152
+ anchor: { ...b(), ref: l.setReference },
1148
1153
  tooltip: {
1149
1154
  ...m(),
1150
1155
  refSetter: l.setFloating,
@@ -1152,7 +1157,7 @@ const Ae = ({ currentPage: r, pagesCount: e, ...t }) => {
1152
1157
  styles: { ...d, ...x },
1153
1158
  arrowPos: s.arrow,
1154
1159
  arrowRef: e,
1155
- arrowSide: b
1160
+ arrowSide: g
1156
1161
  }
1157
1162
  };
1158
1163
  }, Ke = ({ children: r, isMounted: e, styles: t, refSetter: o, arrowRef: a, arrowPos: l, arrowSide: d, ...i }) => {
@@ -1232,7 +1237,7 @@ function ze({ items: r, order: e, onChange: t, prefixed: o = !0, buttonVariant:
1232
1237
  {
1233
1238
  selected: e.field === s,
1234
1239
  onClick: () => d(s),
1235
- className: "tw:flex tw:items-center tw:justify-between",
1240
+ className: "tw:flex tw:items-center tw:justify-between tw:gap-2",
1236
1241
  children: [
1237
1242
  c,
1238
1243
  e.field === s && /* @__PURE__ */ n(v, { icon: e.dir === "ASC" ? xt : yt })
@@ -1256,7 +1261,7 @@ const qe = ({ text: r, className: e, size: t = "lg", initialCopied: o = !1, navi
1256
1261
  {
1257
1262
  type: "button",
1258
1263
  className: f(
1259
- "tw:focus-ring tw:rounded-sm",
1264
+ "tw:focus-ring tw:rounded-sm tw:cursor-pointer",
1260
1265
  {
1261
1266
  "tw:text-md": t === "sm",
1262
1267
  "tw:text-lg": t === "md",
@@ -51,7 +51,7 @@
51
51
  --breakpoint-md: 768px;
52
52
  --breakpoint-lg: 992px;
53
53
  --breakpoint-xl: 1200px;
54
- --breakpoint-2xl: 1400px;
54
+ --breakpoint-2xl: 1320px; /* 1400px according to bootstrap docs, but then the container is bigger than before */
55
55
  }
56
56
 
57
57
  /* Deprecated. TODO Remove with bootstrap support */
@@ -150,7 +150,7 @@
150
150
  }
151
151
 
152
152
  hr {
153
- @apply tw:my-2
153
+ @apply tw:my-3;
154
154
  }
155
155
 
156
156
  p {
@@ -160,6 +160,10 @@
160
160
  code {
161
161
  @apply tw:text-sm tw:text-pink-600 tw:dark:text-pink-500 tw:font-mono;
162
162
  }
163
+
164
+ input[type="search"]::-webkit-search-cancel-button {
165
+ @apply tw:cursor-pointer;
166
+ }
163
167
  }
164
168
 
165
169
  @utility focus-ring-base {
package/package.json CHANGED
@@ -93,5 +93,5 @@
93
93
  "not ie <= 11",
94
94
  "not op_mini all"
95
95
  ],
96
- "version": "0.9.9"
96
+ "version": "0.9.10"
97
97
  }
@@ -1,96 +0,0 @@
1
- import { useMemo as b, useEffect as C, useRef as E, useCallback as d, useState as g } from "react";
2
- function k(e, { elementsSelector: s, focusFirstItem: n = !1, vertical: o = !0, horizontal: t = !0 }) {
3
- const r = b(() => {
4
- const c = [];
5
- return o && c.push("ArrowDown"), t && c.push("ArrowRight"), c;
6
- }, [t, o]), u = b(() => {
7
- const c = [];
8
- return o && c.push("ArrowUp"), t && c.push("ArrowLeft"), c;
9
- }, [t, o]), l = b(() => [...r, ...u], [r, u]);
10
- C(() => {
11
- const c = e.current;
12
- if (!c)
13
- return () => {
14
- };
15
- const f = new AbortController(), T = () => [...c.querySelectorAll(s)], w = T(), p = Math.max(w.findIndex((i) => i.dataset.selected === "true"), 0);
16
- return w.forEach((i, a) => {
17
- i.tabIndex = a === p ? 0 : -1, n && a === p && i.focus();
18
- }), c.addEventListener("keydown", (i) => {
19
- if (!l.includes(i.key))
20
- return;
21
- i.preventDefault();
22
- const a = T(), h = a.findIndex((m) => m.tabIndex === 0), y = r.includes(i.key) ? a[h + 1] ?? a[0] : a[h - 1] ?? a[a.length - 1];
23
- a.forEach((m) => {
24
- m.tabIndex = -1;
25
- }), y.tabIndex = 0, y.focus();
26
- }, { signal: f.signal }), () => f.abort();
27
- }, [l, e, s, n, r]);
28
- }
29
- function F(e, s = globalThis.setTimeout, n = globalThis.clearTimeout) {
30
- const o = E(null), t = d(() => {
31
- o.current && n(o.current);
32
- }, [n]), r = d((u, l) => {
33
- t(), o.current = s(() => {
34
- u(), o.current = null;
35
- }, l ?? e);
36
- }, [t, e, s]);
37
- return C(() => t, [t]), b(
38
- () => ({ setTimeout: r, clearCurrentTimeout: t }),
39
- [t, r]
40
- );
41
- }
42
- const S = 2e3, I = (e = {}, s, n = globalThis.setTimeout, o = globalThis.clearTimeout) => {
43
- const { initialValue: t = !1, delay: r = S } = typeof e == "boolean" ? {
44
- initialValue: e,
45
- delay: s
46
- } : e, { setTimeout: u } = F(r, n, o), [l, c] = g(t), f = E(t), T = d(() => {
47
- c(!f.current), u(() => c(f.current));
48
- }, [u]);
49
- return [l, T];
50
- };
51
- function L(e = !1, s = !1) {
52
- const [n, o] = g(e), t = d(() => o((l) => !l), []), r = d(() => o(!0), []), u = d(() => o(!1), []);
53
- return s ? { flag: n, toggle: t, setToTrue: r, setToFalse: u } : [n, t, r, u];
54
- }
55
- function A(e, s, n) {
56
- return typeof e == "object" ? A(e.currentField, e.newField, e.currentOrderDir) : e !== s ? "ASC" : n ? {
57
- ASC: "DESC",
58
- DESC: void 0
59
- }[n] : "ASC";
60
- }
61
- function x(e, s, n) {
62
- if (typeof e == "object")
63
- return x(e.currentField, e.newField, e.currentOrderDir);
64
- const o = A(e, s, n);
65
- return {
66
- field: o ? s : void 0,
67
- dir: o
68
- };
69
- }
70
- const v = (e, { field: s, dir: n }) => !s || !n ? e : e.sort((o, t) => {
71
- const r = n === "ASC" ? 1 : -1, u = n === "ASC" ? -1 : 1;
72
- return o[s] > t[s] ? r : u;
73
- }), M = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, j = (e) => {
74
- const [s, n] = e.split("-");
75
- return { field: s, dir: n };
76
- }, R = (e) => {
77
- const [s, n] = g(e), o = d(
78
- (t, r) => n(
79
- t && typeof t == "object" ? t : { field: t, dir: r }
80
- ),
81
- []
82
- );
83
- return [s, o];
84
- };
85
- export {
86
- k as a,
87
- F as b,
88
- I as c,
89
- A as d,
90
- x as e,
91
- j as f,
92
- R as g,
93
- M as o,
94
- v as s,
95
- L as u
96
- };