@shlinkio/shlink-frontend-kit 0.9.8 → 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
@@ -9,6 +9,17 @@ import { ReactNode } from 'react';
9
9
  import { RefObject } from 'react';
10
10
  import { SetStateAction } from 'react';
11
11
 
12
+ export declare type ArrowKeyNavigationOptions = {
13
+ /** Query selector for focusable elements that need to be included in the loop */
14
+ elementsSelector: string;
15
+ /** Whether first focusable item should be focused or not. Defaults to false */
16
+ focusFirstItem?: boolean;
17
+ /** Enables up and down arrows navigation. Defaults to true */
18
+ vertical?: boolean;
19
+ /** Enables left and right arrows navigation. Defaults to true */
20
+ horizontal?: boolean;
21
+ };
22
+
12
23
  declare type BooleanControlProps = PropsWithChildren<{
13
24
  checked?: boolean;
14
25
  onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
@@ -20,16 +31,20 @@ export declare type Callback = () => unknown;
20
31
 
21
32
  export declare const changeThemeInMarkup: (theme: Theme) => void | undefined;
22
33
 
34
+ /** @deprecated */
23
35
  export declare const Checkbox: FC<BooleanControlProps>;
24
36
 
25
37
  export declare function determineOrder<Fields extends string = string>(orderDirChange: OrderDirChange<Fields>): Order<Fields>;
26
38
 
27
- export declare function determineOrder<Fields extends string = string>(currentField: Fields, newField?: Fields, currentOrderDir?: OrderDir): Order<Fields>;
39
+ /** @deprecated */
40
+ export declare function determineOrder<Fields extends string = string>(currentField?: Fields, newField?: Fields, currentOrderDir?: OrderDir): Order<Fields>;
28
41
 
29
42
  export declare function determineOrderDir<Fields extends string = string>(orderDirChange: OrderDirChange<Fields>): OrderDir;
30
43
 
31
- export declare function determineOrderDir<Fields extends string = string>(currentField: Fields, newField?: Fields, currentOrderDir?: OrderDir): OrderDir;
44
+ /** @deprecated */
45
+ export declare function determineOrderDir<Fields extends string = string>(currentField?: Fields, newField?: Fields, currentOrderDir?: OrderDir): OrderDir;
32
46
 
47
+ /** @deprecated */
33
48
  export declare const DropdownBtn: FC<DropdownBtnProps>;
34
49
 
35
50
  export declare type DropdownBtnMenuProps = PropsWithChildren<{
@@ -54,6 +69,7 @@ export declare const HIGHLIGHTED_COLOR = "#f77f28";
54
69
 
55
70
  export declare const HIGHLIGHTED_COLOR_ALPHA = "rgba(247, 127, 40, 0.4)";
56
71
 
72
+ /** @deprecated */
57
73
  export declare const InputFormGroup: FC<InputFormGroupProps>;
58
74
 
59
75
  export declare type InputFormGroupProps = PropsWithChildren<{
@@ -83,6 +99,7 @@ export declare const MAIN_COLOR = "#4696e5";
83
99
 
84
100
  export declare const MAIN_COLOR_ALPHA = "rgba(70, 150, 229, 0.4)";
85
101
 
102
+ /** @deprecated */
86
103
  export declare const Message: FC<MessageProps>;
87
104
 
88
105
  export declare type MessageProps = PropsWithChildren<{
@@ -94,6 +111,7 @@ export declare type MessageProps = PropsWithChildren<{
94
111
 
95
112
  declare type MessageType = 'default' | 'error';
96
113
 
114
+ /** @deprecated */
97
115
  export declare const NavPillItem: FC<NavPillItemProps>;
98
116
 
99
117
  declare type NavPillItemProps = PropsWithChildren<{
@@ -101,6 +119,7 @@ declare type NavPillItemProps = PropsWithChildren<{
101
119
  replace?: boolean;
102
120
  }>;
103
121
 
122
+ /** @deprecated */
104
123
  export declare const NavPills: FC<NavPillsProps>;
105
124
 
106
125
  declare type NavPillsProps = PropsWithChildren<{
@@ -116,11 +135,12 @@ export declare type Order<Fields> = {
116
135
  export declare type OrderDir = 'ASC' | 'DESC' | undefined;
117
136
 
118
137
  export declare type OrderDirChange<Fields extends string = string> = {
119
- currentField: Fields;
138
+ currentField?: Fields;
120
139
  newField?: Fields;
121
140
  currentOrderDir?: OrderDir;
122
141
  };
123
142
 
143
+ /** @deprecated */
124
144
  export declare function OrderingDropdown<T extends string = string>({ items, order, onChange, isButton, right, prefixed }: OrderingDropdownProps<T>): JSX.Element;
125
145
 
126
146
  export declare type OrderingDropdownProps<T extends string = string> = {
@@ -132,6 +152,12 @@ export declare type OrderingDropdownProps<T extends string = string> = {
132
152
  prefixed?: boolean;
133
153
  };
134
154
 
155
+ export declare type OrderSetter<T> = {
156
+ (order: Order<T>): void;
157
+ /** @deprecated Pass the order object as the only argument */
158
+ (orderField?: T, orderDir?: OrderDir): void;
159
+ };
160
+
135
161
  /**
136
162
  * Convert provided order object to string, with the pattern `${order.field}-${order.di}`.
137
163
  * @return - A `string` if the `dir` prop is set, `undefined` otherwise.
@@ -148,6 +174,7 @@ export declare const PRIMARY_DARK_COLOR = "#161b22";
148
174
 
149
175
  export declare const PRIMARY_LIGHT_COLOR = "white";
150
176
 
177
+ /** @deprecated */
151
178
  export declare const Result: FC<ResultProps>;
152
179
 
153
180
  export declare type ResultProps = PropsWithChildren<{
@@ -158,8 +185,10 @@ export declare type ResultProps = PropsWithChildren<{
158
185
 
159
186
  export declare type ResultType = 'success' | 'error' | 'warning';
160
187
 
188
+ /** @deprecated */
161
189
  export declare const RowDropdownBtn: FC<DropdownBtnMenuProps>;
162
190
 
191
+ /** @deprecated */
163
192
  export declare const SearchField: ({ onChange, className, large, noBorder, initialValue, setTimeout_ }: SearchFieldProps) => JSX.Element;
164
193
 
165
194
  declare type SearchFieldProps = {
@@ -171,6 +200,7 @@ declare type SearchFieldProps = {
171
200
  setTimeout_?: typeof setTimeout;
172
201
  };
173
202
 
203
+ /** @deprecated */
174
204
  export declare const SimpleCard: ({ title, children, bodyClassName, ...rest }: SimpleCardProps) => JSX.Element;
175
205
 
176
206
  export declare type SimpleCardProps = Omit<CardProps, 'title'> & {
@@ -219,14 +249,23 @@ export declare type ToggleResultObject = {
219
249
  /** @deprecated */
220
250
  export declare type ToggleResultTuple = [boolean, () => void, () => void, () => void];
221
251
 
252
+ /** @deprecated */
222
253
  export declare const ToggleSwitch: FC<BooleanControlProps>;
223
254
 
255
+ /**
256
+ * Allows focus navigation via arrow keys on the elements of a container.
257
+ *
258
+ * Initially, the first element with [data-selected=true] or the first globally, matching `elementsSelector`, will be
259
+ * focusable via Tab, then arrow keys need to be used to move through the sequence.
260
+ */
261
+ export declare function useArrowKeyNavigation(containerRef: RefObject<HTMLElement | null>, { elementsSelector, focusFirstItem, vertical, horizontal }: ArrowKeyNavigationOptions): void;
262
+
224
263
  /** @deprecated Use `useRef<T>(null) instead */
225
264
  export declare const useElementRef: <T extends HTMLElement>() => RefObject<T | null>;
226
265
 
227
266
  export declare const useGoBack: () => () => void | Promise<void>;
228
267
 
229
- export declare const useOrder: <T>(initialOrder: Order<T>) => [Order<T>, (orderField?: T, orderDir?: OrderDir) => void];
268
+ export declare const useOrder: <T>(initialOrder: Order<T>) => [Order<T>, OrderSetter<T>];
230
269
 
231
270
  export declare const useParsedQuery: <T>() => T;
232
271
 
package/dist/index.js CHANGED
@@ -1,109 +1,109 @@
1
- import { jsx as s, jsxs as i, Fragment as f } from "react/jsx-runtime";
2
- import { faCircleNotch as A, faSearch as E, faEllipsisV as P, faSortAmountUp as F, faSortAmountDown as H } from "@fortawesome/free-solid-svg-icons";
1
+ import { jsx as n, jsxs as i, Fragment as f } from "react/jsx-runtime";
2
+ import { faCircleNotch as S, faSearch as R, faEllipsisV as D, faSortAmountUp as P, faSortAmountDown as E } from "@fortawesome/free-solid-svg-icons";
3
3
  import { FontAwesomeIcon as b } from "@fortawesome/react-fontawesome";
4
- import { clsx as h } from "clsx";
5
- import { Card as w, CardHeader as M, CardBody as $, Dropdown as v, DropdownToggle as k, DropdownMenu as S, NavItem as G, NavLink as j, Nav as U, DropdownItem as g } from "reactstrap";
6
- import { useId as x, useState as N, useRef as q, useCallback as T, useMemo as Q, Children as V, isValidElement as Y, useEffect as W } from "react";
4
+ import { clsx as u } from "clsx";
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
+ 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-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";
7
9
  import { useNavigate as z, useLocation as J, NavLink as X } from "react-router";
8
- import { u as y } from "./use-toggle-C1uZwbSD.js";
9
- import { a as je, b as Ue } from "./use-toggle-C1uZwbSD.js";
10
- const fe = ({ className: e, children: r, loading: t = !1, type: n = "default", fullWidth: o = !1 }) => /* @__PURE__ */ s(
10
+ const ue = ({ className: r, children: e, loading: s = !1, type: t = "default", fullWidth: a = !1 }) => /* @__PURE__ */ n(
11
11
  w,
12
12
  {
13
13
  body: !0,
14
- className: h(e, {
15
- "w-100": o,
16
- "w-75 mx-auto": !o,
17
- "border-danger": n === "error"
14
+ className: u(r, {
15
+ "w-100": a,
16
+ "w-75 mx-auto": !a,
17
+ "border-danger": t === "error"
18
18
  }),
19
19
  children: /* @__PURE__ */ i(
20
20
  "h3",
21
21
  {
22
- className: h("text-center mb-0", {
23
- "text-muted": n === "default",
24
- "text-danger": n === "error"
22
+ className: u("text-center mb-0", {
23
+ "text-muted": t === "default",
24
+ "text-danger": t === "error"
25
25
  }),
26
26
  children: [
27
- t && /* @__PURE__ */ s(b, { icon: A, spin: !0 }),
28
- t && /* @__PURE__ */ s("span", { className: "ms-2", children: r ?? "Loading..." }),
29
- !t && r
27
+ s && /* @__PURE__ */ n(b, { icon: S, spin: !0 }),
28
+ s && /* @__PURE__ */ n("span", { className: "ms-2", children: e ?? "Loading..." }),
29
+ !s && e
30
30
  ]
31
31
  }
32
32
  )
33
33
  }
34
- ), Z = ({ title: e, children: r, bodyClassName: t, ...n }) => /* @__PURE__ */ i(w, { ...n, children: [
35
- e && /* @__PURE__ */ s(M, { role: "heading", "aria-level": 4, children: e }),
36
- /* @__PURE__ */ s($, { className: t, children: r })
37
- ] }), pe = ({ children: e, type: r, className: t, small: n = !1 }) => /* @__PURE__ */ s(
34
+ ), Z = ({ title: r, children: e, bodyClassName: s, ...t }) => /* @__PURE__ */ i(w, { ...t, children: [
35
+ r && /* @__PURE__ */ n(H, { role: "heading", "aria-level": 4, children: r }),
36
+ /* @__PURE__ */ n(M, { className: s, children: e })
37
+ ] }), fe = ({ children: r, type: e, className: s, small: t = !1 }) => /* @__PURE__ */ n(
38
38
  Z,
39
39
  {
40
40
  role: "document",
41
- className: h("text-center", {
42
- "w-75 mx-auto": !n,
43
- "w-100": n,
44
- "bg-main": r === "success",
45
- "bg-danger": r === "error",
46
- "bg-warning": r === "warning",
47
- "text-white": r !== "warning"
48
- }, t),
49
- bodyClassName: h({ "p-2": n }),
50
- children: e
41
+ className: u("text-center", {
42
+ "w-75 mx-auto": !t,
43
+ "w-100": t,
44
+ "bg-main": e === "success",
45
+ "bg-danger": e === "error",
46
+ "bg-warning": e === "warning",
47
+ "text-white": e !== "warning"
48
+ }, s),
49
+ bodyClassName: u({ "p-2": t }),
50
+ children: r
51
51
  }
52
- ), L = ({ checked: e = !1, onChange: r, className: t, children: n, type: o, inline: c = !1 }) => {
53
- const l = x(), u = (m) => r == null ? void 0 : r(m.target.checked, m), d = {
54
- "form-switch": o === "switch",
55
- "form-checkbox": o === "checkbox"
56
- }, a = c ? { display: "inline-block" } : {};
57
- return /* @__PURE__ */ i("span", { className: h("form-check", d, t), style: a, children: [
58
- /* @__PURE__ */ s("input", { type: "checkbox", className: "form-check-input", id: l, checked: e, onChange: u }),
59
- /* @__PURE__ */ s("label", { className: "form-check-label", htmlFor: l, children: n })
52
+ ), y = ({ checked: r = !1, onChange: e, className: s, children: t, type: a, inline: c = !1 }) => {
53
+ const l = O(), h = (m) => e == null ? void 0 : e(m.target.checked, m), d = {
54
+ "form-switch": a === "switch",
55
+ "form-checkbox": a === "checkbox"
56
+ }, o = c ? { display: "inline-block" } : {};
57
+ return /* @__PURE__ */ i("span", { className: u("form-check", d, s), style: o, children: [
58
+ /* @__PURE__ */ n("input", { type: "checkbox", className: "form-check-input", id: l, checked: r, onChange: h }),
59
+ /* @__PURE__ */ n("label", { className: "form-check-label", htmlFor: l, children: t })
60
60
  ] });
61
- }, be = (e) => /* @__PURE__ */ s(L, { type: "checkbox", ...e }), ge = (e) => /* @__PURE__ */ s(L, { type: "switch", ...e }), B = ({ children: e, label: r, className: t = "", labelClassName: n = "", noMargin: o = !1, id: c }) => /* @__PURE__ */ i("div", { className: `${t} ${o ? "" : "mb-3"}`, children: [
62
- /* @__PURE__ */ s("label", { className: `form-label ${n}`, htmlFor: c, children: r }),
63
- e
64
- ] }), we = ({ children: e, value: r, onChange: t, type: n, required: o, placeholder: c, className: l, labelClassName: u }) => {
65
- const d = x();
66
- return /* @__PURE__ */ s(B, { label: /* @__PURE__ */ i(f, { children: [
67
- e,
61
+ }, pe = (r) => /* @__PURE__ */ n(y, { type: "checkbox", ...r }), be = (r) => /* @__PURE__ */ n(y, { type: "switch", ...r }), B = ({ children: r, label: e, className: s = "", labelClassName: t = "", noMargin: a = !1, id: c }) => /* @__PURE__ */ i("div", { className: `${s} ${a ? "" : "mb-3"}`, children: [
62
+ /* @__PURE__ */ n("label", { className: `form-label ${t}`, htmlFor: c, children: e }),
63
+ r
64
+ ] }), ge = ({ children: r, value: e, onChange: s, type: t, required: a, placeholder: c, className: l, labelClassName: h }) => {
65
+ const d = O();
66
+ return /* @__PURE__ */ n(B, { label: /* @__PURE__ */ i(f, { children: [
67
+ r,
68
68
  ":"
69
- ] }), className: l, labelClassName: u, id: d, children: /* @__PURE__ */ s(
69
+ ] }), className: l, labelClassName: h, id: d, children: /* @__PURE__ */ n(
70
70
  "input",
71
71
  {
72
72
  id: d,
73
73
  className: "form-control",
74
- type: n ?? "text",
75
- value: r,
76
- required: o ?? !0,
74
+ type: t ?? "text",
75
+ value: e,
76
+ required: a ?? !0,
77
77
  placeholder: c,
78
- onChange: (a) => t(a.target.value)
78
+ onChange: (o) => s(o.target.value)
79
79
  }
80
80
  ) });
81
81
  }, K = 500;
82
82
  let p;
83
- const O = () => {
83
+ const _ = () => {
84
84
  p !== null && clearTimeout(p), p = null;
85
- }, Ne = ({ onChange: e, className: r, large: t = !0, noBorder: n = !1, initialValue: o = "", setTimeout_: c = setTimeout }) => {
86
- const [l, u] = N(o), d = (a, m = K) => {
87
- u(a), O(), p = c(() => {
88
- e(a), O();
85
+ }, we = ({ onChange: r, className: e, large: s = !0, noBorder: t = !1, initialValue: a = "", setTimeout_: c = setTimeout }) => {
86
+ const [l, h] = x(a), d = (o, m = K) => {
87
+ h(o), _(), p = c(() => {
88
+ r(o), _();
89
89
  }, m);
90
90
  };
91
- return /* @__PURE__ */ i("div", { className: h("search-field", r), children: [
92
- /* @__PURE__ */ s(
91
+ return /* @__PURE__ */ i("div", { className: u("search-field", e), children: [
92
+ /* @__PURE__ */ n(
93
93
  "input",
94
94
  {
95
95
  type: "text",
96
- className: h("form-control search-field__input", {
97
- "form-control-lg": t,
98
- "search-field__input--no-border": n
96
+ className: u("form-control search-field__input", {
97
+ "form-control-lg": s,
98
+ "search-field__input--no-border": t
99
99
  }),
100
100
  placeholder: "Search...",
101
101
  value: l,
102
- onChange: (a) => d(a.target.value)
102
+ onChange: (o) => d(o.target.value)
103
103
  }
104
104
  ),
105
- /* @__PURE__ */ s(b, { icon: E, className: "search-field__icon" }),
106
- /* @__PURE__ */ s(
105
+ /* @__PURE__ */ n(b, { icon: R, className: "search-field__icon" }),
106
+ /* @__PURE__ */ n(
107
107
  "button",
108
108
  {
109
109
  "aria-label": "Clear search",
@@ -115,181 +115,160 @@ const O = () => {
115
115
  }
116
116
  )
117
117
  ] });
118
- }, Ce = () => q(null), _e = () => {
119
- const e = z();
120
- return T(() => e(-1), [e]);
121
- }, ee = (e) => {
122
- const r = new URLSearchParams(e), t = {};
123
- return r.forEach((n, o) => {
124
- if (o.endsWith("[]")) {
125
- const c = o.slice(0, -2);
126
- t[c] ?? (t[c] = []), t[c].push(n);
118
+ }, Ne = () => j(null), _e = () => {
119
+ const r = z();
120
+ return U(() => r(-1), [r]);
121
+ }, ee = (r) => {
122
+ const e = new URLSearchParams(r), s = {};
123
+ return e.forEach((t, a) => {
124
+ if (a.endsWith("[]")) {
125
+ const c = a.slice(0, -2);
126
+ s[c] ?? (s[c] = []), s[c].push(t);
127
127
  } else
128
- t[o] = n;
129
- }), t;
130
- }, Oe = (e) => {
131
- const r = new URLSearchParams();
132
- for (const [t, n] of Object.entries(e))
133
- n !== void 0 && (Array.isArray(n) ? n.forEach((o) => r.append(`${t}[]`, `${o}`)) : r.append(t, `${n}`));
134
- return r.toString();
135
- }, ve = () => {
136
- const { search: e } = J();
137
- return Q(() => ee(e), [e]);
128
+ s[a] = t;
129
+ }), s;
130
+ }, ve = (r) => {
131
+ const e = new URLSearchParams();
132
+ for (const [s, t] of Object.entries(r))
133
+ t !== void 0 && (Array.isArray(t) ? t.forEach((a) => e.append(`${s}[]`, `${a}`)) : e.append(s, `${t}`));
134
+ return e.toString();
135
+ }, ke = () => {
136
+ const { search: r } = J();
137
+ return q(() => ee(r), [r]);
138
138
  }, re = ({
139
- text: e,
140
- disabled: r = !1,
141
- className: t,
142
- children: n,
143
- dropdownClassName: o,
139
+ text: r,
140
+ disabled: e = !1,
141
+ className: s,
142
+ children: t,
143
+ dropdownClassName: a,
144
144
  noCaret: c,
145
145
  end: l = !1,
146
- minWidth: u,
146
+ minWidth: h,
147
147
  inline: d,
148
- size: a,
148
+ size: o,
149
149
  ...m
150
150
  }) => {
151
- const [_, I] = y(), D = h("dropdown-btn__toggle", t, {
151
+ const [N, L] = T(), A = u("dropdown-btn__toggle", s, {
152
152
  "btn-block": !d,
153
153
  "dropdown-btn__toggle--with-caret": !c
154
- }), R = { minWidth: u && `${u}px` };
155
- return /* @__PURE__ */ i(v, { isOpen: _, toggle: I, disabled: r, className: o, children: [
156
- /* @__PURE__ */ s(k, { size: a, caret: !c, className: D, color: "primary", ...m, children: e }),
157
- /* @__PURE__ */ s(S, { className: "w-100", end: l, style: R, children: _ && n })
154
+ }), I = { minWidth: h && `${h}px` };
155
+ return /* @__PURE__ */ i(v, { isOpen: N, toggle: L, disabled: e, className: a, children: [
156
+ /* @__PURE__ */ n(k, { size: o, caret: !c, className: A, color: "primary", ...m, children: r }),
157
+ /* @__PURE__ */ n(C, { className: "w-100", end: l, style: I, children: N && t })
158
158
  ] });
159
- }, ke = ({ children: e, minWidth: r, label: t = "Options" }) => /* @__PURE__ */ s(
159
+ }, Ce = ({ children: r, minWidth: e, label: s = "Options" }) => /* @__PURE__ */ n(
160
160
  re,
161
161
  {
162
- text: /* @__PURE__ */ s(b, { className: "px-1", icon: P }),
163
- "aria-label": t,
162
+ text: /* @__PURE__ */ n(b, { className: "px-1", icon: D }),
163
+ "aria-label": s,
164
164
  size: "sm",
165
- minWidth: r,
165
+ minWidth: e,
166
166
  end: !0,
167
167
  noCaret: !0,
168
168
  inline: !0,
169
- children: e
169
+ children: r
170
170
  }
171
- ), te = ({ children: e, ...r }) => /* @__PURE__ */ s(G, { children: /* @__PURE__ */ s(j, { className: "nav-pills__nav-link", tag: X, ...r, children: e }) }), Se = ({ children: e, fill: r = !1, className: t = "" }) => /* @__PURE__ */ s(w, { className: `nav-pills__nav p-0 overflow-hidden ${t}`, body: !0, children: /* @__PURE__ */ s(U, { pills: !0, fill: r, children: V.map(e, (n) => {
172
- if (!Y(n) || n.type !== te)
171
+ ), te = ({ children: r, ...e }) => /* @__PURE__ */ n($, { children: /* @__PURE__ */ n(F, { className: "nav-pills__nav-link", tag: X, ...e, children: r }) }), Oe = ({ children: r, fill: e = !1, className: s = "" }) => /* @__PURE__ */ n(w, { className: `nav-pills__nav p-0 overflow-hidden ${s}`, body: !0, children: /* @__PURE__ */ n(G, { pills: !0, fill: e, children: Q.map(r, (t) => {
172
+ if (!V(t) || t.type !== te)
173
173
  throw new Error("Only NavPillItem children are allowed inside NavPills.");
174
- return n;
174
+ return t;
175
175
  }) }) });
176
- function C(e, r, t) {
177
- return typeof e == "object" ? C(e.currentField, e.newField, e.currentOrderDir) : e !== r ? "ASC" : t ? {
178
- ASC: "DESC",
179
- DESC: void 0
180
- }[t] : "ASC";
181
- }
182
- function ne(e, r, t) {
183
- return typeof e == "object" ? ne(e.currentField, e.newField, e.currentOrderDir) : {
184
- field: r,
185
- dir: C(e, r, t)
186
- };
187
- }
188
- const xe = (e, { field: r, dir: t }) => !r || !t ? e : e.sort((n, o) => {
189
- const c = t === "ASC" ? 1 : -1, l = t === "ASC" ? -1 : 1;
190
- return n[r] > o[r] ? c : l;
191
- }), Te = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, ye = (e) => {
192
- const [r, t] = e.split("-");
193
- return { field: r, dir: t };
194
- }, Le = (e) => {
195
- const [r, t] = N(e), n = T((o, c) => t({ field: o, dir: c }), []);
196
- return [r, n];
197
- };
198
- function Ie({ items: e, order: r, onChange: t, isButton: n = !0, right: o = !1, prefixed: c = !0 }) {
199
- const [l, u] = y(), d = (a) => () => {
200
- const m = C(a, r.field, r.dir);
201
- t(m ? a : void 0, m);
176
+ function xe({ items: r, order: e, onChange: s, isButton: t = !0, right: a = !1, prefixed: c = !0 }) {
177
+ const [l, h] = T(), d = (o) => () => {
178
+ const m = W(o, e.field, e.dir);
179
+ s(m ? o : void 0, m);
202
180
  };
203
- return /* @__PURE__ */ i(v, { isOpen: l, toggle: u, children: [
181
+ return /* @__PURE__ */ i(v, { isOpen: l, toggle: h, children: [
204
182
  /* @__PURE__ */ i(
205
183
  k,
206
184
  {
207
185
  caret: !0,
208
- color: n ? "primary" : "link",
209
- className: h({
210
- "dropdown-btn__toggle btn-block pe-4 overflow-hidden": n,
211
- "btn-sm p-0": !n
186
+ color: t ? "primary" : "link",
187
+ className: u({
188
+ "dropdown-btn__toggle btn-block pe-4 overflow-hidden": t,
189
+ "btn-sm p-0": !t
212
190
  }),
213
191
  children: [
214
- !n && /* @__PURE__ */ s(f, { children: "Order by" }),
215
- n && !r.field && /* @__PURE__ */ s("i", { children: "Order by..." }),
216
- n && r.field && /* @__PURE__ */ i(f, { children: [
192
+ !t && /* @__PURE__ */ n(f, { children: "Order by" }),
193
+ t && !e.field && /* @__PURE__ */ n("i", { children: "Order by..." }),
194
+ t && e.field && /* @__PURE__ */ i(f, { children: [
217
195
  c && "Order by: ",
218
- e[r.field],
196
+ r[e.field],
219
197
  " - ",
220
- /* @__PURE__ */ s("small", { children: r.dir ?? "DESC" })
198
+ /* @__PURE__ */ n("small", { children: e.dir ?? "DESC" })
221
199
  ] })
222
200
  ]
223
201
  }
224
202
  ),
225
- /* @__PURE__ */ s(S, { end: o, className: "w-100", style: n ? void 0 : { minWidth: "11rem" }, children: l && /* @__PURE__ */ i(f, { children: [
226
- Object.entries(e).map(([a, m]) => /* @__PURE__ */ i(
203
+ /* @__PURE__ */ n(C, { end: a, className: "w-100", style: t ? void 0 : { minWidth: "11rem" }, children: l && /* @__PURE__ */ i(f, { children: [
204
+ Object.entries(r).map(([o, m]) => /* @__PURE__ */ i(
227
205
  g,
228
206
  {
229
- active: r.field === a,
230
- onClick: d(a),
207
+ active: e.field === o,
208
+ onClick: d(o),
231
209
  className: "d-flex justify-content-between align-items-center",
232
210
  tabIndex: -1,
233
211
  children: [
234
212
  m,
235
- r.field === a && /* @__PURE__ */ s(b, { icon: r.dir === "ASC" ? F : H })
213
+ e.field === o && /* @__PURE__ */ n(b, { icon: e.dir === "ASC" ? P : E })
236
214
  ]
237
215
  },
238
- a
216
+ o
239
217
  )),
240
- /* @__PURE__ */ s(g, { divider: !0, tag: "hr" }),
241
- /* @__PURE__ */ s(g, { disabled: !r.field, onClick: () => t(), tabIndex: -1, children: /* @__PURE__ */ s("i", { children: "Clear selection" }) })
218
+ /* @__PURE__ */ n(g, { divider: !0, tag: "hr" }),
219
+ /* @__PURE__ */ n(g, { disabled: !e.field, onClick: () => s(), tabIndex: -1, children: /* @__PURE__ */ n("i", { children: "Clear selection" }) })
242
220
  ] }) })
243
221
  ] });
244
222
  }
245
- const De = "#4696e5", Re = "rgba(70, 150, 229, 0.4)", Ae = "#f77f28", Ee = "rgba(247, 127, 40, 0.4)", Pe = "white", Fe = "#161b22", se = (e) => {
246
- var r;
247
- return (r = document.querySelector("html")) == null ? void 0 : r.setAttribute("data-theme", e);
248
- }, He = () => {
223
+ const Te = "#4696e5", ye = "rgba(70, 150, 229, 0.4)", Le = "#f77f28", Ae = "rgba(247, 127, 40, 0.4)", Ie = "white", Se = "#161b22", se = (r) => {
249
224
  var e;
250
- return ((e = document.querySelector("html")) == null ? void 0 : e.getAttribute("data-theme")) === "dark";
251
- }, oe = (e = window.matchMedia.bind(window)) => e("(prefers-color-scheme: dark)").matches ? "dark" : "light", Me = (e) => {
252
- const [r, t] = N(() => e ?? oe());
253
- return W(() => {
254
- se(r);
255
- }, [r]), [r, t];
225
+ return (e = document.querySelector("html")) == null ? void 0 : e.setAttribute("data-theme", r);
226
+ }, Re = () => {
227
+ var r;
228
+ return ((r = document.querySelector("html")) == null ? void 0 : r.getAttribute("data-theme")) === "dark";
229
+ }, ne = (r = window.matchMedia.bind(window)) => r("(prefers-color-scheme: dark)").matches ? "dark" : "light", De = (r) => {
230
+ const [e, s] = x(() => r ?? ne());
231
+ return Y(() => {
232
+ se(e);
233
+ }, [e]), [e, s];
256
234
  };
257
235
  export {
258
- be as Checkbox,
236
+ pe as Checkbox,
259
237
  re as DropdownBtn,
260
- Ae as HIGHLIGHTED_COLOR,
261
- Ee as HIGHLIGHTED_COLOR_ALPHA,
262
- we as InputFormGroup,
238
+ Le as HIGHLIGHTED_COLOR,
239
+ Ae as HIGHLIGHTED_COLOR_ALPHA,
240
+ ge as InputFormGroup,
263
241
  B as LabeledFormGroup,
264
- De as MAIN_COLOR,
265
- Re as MAIN_COLOR_ALPHA,
266
- fe as Message,
242
+ Te as MAIN_COLOR,
243
+ ye as MAIN_COLOR_ALPHA,
244
+ ue as Message,
267
245
  te as NavPillItem,
268
- Se as NavPills,
269
- Ie as OrderingDropdown,
270
- Fe as PRIMARY_DARK_COLOR,
271
- Pe as PRIMARY_LIGHT_COLOR,
272
- pe as Result,
273
- ke as RowDropdownBtn,
274
- Ne as SearchField,
246
+ Oe as NavPills,
247
+ xe as OrderingDropdown,
248
+ Se as PRIMARY_DARK_COLOR,
249
+ Ie as PRIMARY_LIGHT_COLOR,
250
+ fe as Result,
251
+ Ce as RowDropdownBtn,
252
+ we as SearchField,
275
253
  Z as SimpleCard,
276
- ge as ToggleSwitch,
254
+ be as ToggleSwitch,
277
255
  se as changeThemeInMarkup,
278
- ne as determineOrder,
279
- C as determineOrderDir,
280
- oe as getSystemPreferredTheme,
281
- He as isDarkThemeEnabled,
282
- Te as orderToString,
256
+ He as determineOrder,
257
+ W as determineOrderDir,
258
+ ne as getSystemPreferredTheme,
259
+ Re as isDarkThemeEnabled,
260
+ Me as orderToString,
283
261
  ee as parseQueryString,
284
- xe as sortList,
285
- ye as stringToOrder,
286
- Oe as stringifyQueryParams,
287
- Ce as useElementRef,
262
+ $e as sortList,
263
+ Fe as stringToOrder,
264
+ ve as stringifyQueryParams,
265
+ Ge as useArrowKeyNavigation,
266
+ Ne as useElementRef,
288
267
  _e as useGoBack,
289
- Le as useOrder,
290
- ve as useParsedQuery,
291
- Me as useTheme,
292
- je as useTimeout,
293
- Ue as useTimeoutToggle,
294
- y as useToggle
268
+ je as useOrder,
269
+ ke as useParsedQuery,
270
+ De as useTheme,
271
+ Ue as useTimeout,
272
+ qe as useTimeoutToggle,
273
+ T as useToggle
295
274
  };