@shlinkio/shlink-frontend-kit 0.8.7 → 0.8.8

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
@@ -210,8 +210,11 @@ export declare type ToggleResult = [boolean, () => void, () => void, () => void]
210
210
 
211
211
  export declare const ToggleSwitch: FC<BooleanControlProps>;
212
212
 
213
+ /** @deprecated Use `useRef<T>(null) instead */
213
214
  export declare const useElementRef: <T extends HTMLElement>() => RefObject<T | null>;
214
215
 
216
+ export declare const useGoBack: () => () => void | Promise<void>;
217
+
215
218
  export declare const useOrder: <T>(initialOrder: Order<T>) => [Order<T>, (orderField?: T, orderDir?: OrderDir) => void];
216
219
 
217
220
  export declare const useParsedQuery: <T>() => T;
package/dist/index.js CHANGED
@@ -1,13 +1,12 @@
1
- import { jsx as o, jsxs as m, Fragment as g } from "react/jsx-runtime";
2
- import { faCircleNotch as R, faSearch as A, faEllipsisV as I, faSortAmountUp as E, faSortAmountDown as P } from "@fortawesome/free-solid-svg-icons";
1
+ import { jsx as o, jsxs as m, Fragment as w } from "react/jsx-runtime";
2
+ import { faCircleNotch as A, faSearch as I, faEllipsisV as E, faSortAmountUp as P, faSortAmountDown as F } from "@fortawesome/free-solid-svg-icons";
3
3
  import { FontAwesomeIcon as p } from "@fortawesome/react-fontawesome";
4
4
  import { clsx as u } from "clsx";
5
- import { Card as N, CardHeader as F, CardBody as H, Dropdown as M, DropdownToggle as T, DropdownMenu as k, NavItem as $, NavLink as j, Nav as G, UncontrolledDropdown as U, DropdownItem as w } from "reactstrap";
6
- import { useId as v, useState as b, useMemo as V, useRef as q, useCallback as S, Children as Q, isValidElement as Y, useEffect as W } from "react";
7
- import { u as z, a as J } from "./use-toggle-DlYE68B3.js";
8
- import { b as Ue } from "./use-toggle-DlYE68B3.js";
9
- import { useLocation as X, NavLink as Z } from "react-router";
10
- const be = ({ className: e, children: r, loading: t = !1, type: n = "default", fullWidth: s = !1 }) => /* @__PURE__ */ o(
5
+ import { Card as N, CardHeader as H, CardBody as M, Dropdown as $, DropdownToggle as v, DropdownMenu as k, NavItem as G, NavLink as j, Nav as U, UncontrolledDropdown as V, DropdownItem as g } from "reactstrap";
6
+ import { useId as S, useState as b, useRef as y, useCallback as C, useMemo as q, Children as Q, isValidElement as Y, useEffect as W } from "react";
7
+ import { useNavigate as z, useLocation as J, NavLink as X } from "react-router";
8
+ import { u as Z, a as B } from "./use-toggle-CNvdDGvy.js";
9
+ const ge = ({ className: e, children: r, loading: t = !1, type: n = "default", fullWidth: s = !1 }) => /* @__PURE__ */ o(
11
10
  N,
12
11
  {
13
12
  body: !0,
@@ -24,18 +23,18 @@ const be = ({ className: e, children: r, loading: t = !1, type: n = "default", f
24
23
  "text-danger": n === "error"
25
24
  }),
26
25
  children: [
27
- t && /* @__PURE__ */ o(p, { icon: R, spin: !0 }),
26
+ t && /* @__PURE__ */ o(p, { icon: A, spin: !0 }),
28
27
  t && /* @__PURE__ */ o("span", { className: "ms-2", children: r ?? "Loading..." }),
29
28
  !t && r
30
29
  ]
31
30
  }
32
31
  )
33
32
  }
34
- ), B = ({ title: e, children: r, bodyClassName: t, ...n }) => /* @__PURE__ */ m(N, { ...n, children: [
35
- e && /* @__PURE__ */ o(F, { role: "heading", "aria-level": 4, children: e }),
36
- /* @__PURE__ */ o(H, { className: t, children: r })
33
+ ), K = ({ title: e, children: r, bodyClassName: t, ...n }) => /* @__PURE__ */ m(N, { ...n, children: [
34
+ e && /* @__PURE__ */ o(H, { role: "heading", "aria-level": 4, children: e }),
35
+ /* @__PURE__ */ o(M, { className: t, children: r })
37
36
  ] }), we = ({ children: e, type: r, className: t, small: n = !1 }) => /* @__PURE__ */ o(
38
- B,
37
+ K,
39
38
  {
40
39
  role: "document",
41
40
  className: u("text-center", {
@@ -49,8 +48,8 @@ const be = ({ className: e, children: r, loading: t = !1, type: n = "default", f
49
48
  bodyClassName: u({ "p-2": n }),
50
49
  children: e
51
50
  }
52
- ), y = ({ checked: e = !1, onChange: r, className: t, children: n, type: s, inline: c = !1 }) => {
53
- const i = v(), a = (h) => r == null ? void 0 : r(h.target.checked, h), l = {
51
+ ), O = ({ checked: e = !1, onChange: r, className: t, children: n, type: s, inline: c = !1 }) => {
52
+ const i = S(), a = (h) => r == null ? void 0 : r(h.target.checked, h), l = {
54
53
  "form-switch": s === "switch",
55
54
  "form-checkbox": s === "checkbox"
56
55
  }, d = c ? { display: "inline-block" } : {};
@@ -58,12 +57,12 @@ const be = ({ className: e, children: r, loading: t = !1, type: n = "default", f
58
57
  /* @__PURE__ */ o("input", { type: "checkbox", className: "form-check-input", id: i, checked: e, onChange: a }),
59
58
  /* @__PURE__ */ o("label", { className: "form-check-label", htmlFor: i, children: n })
60
59
  ] });
61
- }, ge = (e) => /* @__PURE__ */ o(y, { type: "checkbox", ...e }), Ne = (e) => /* @__PURE__ */ o(y, { type: "switch", ...e }), K = ({ children: e, label: r, className: t = "", labelClassName: n = "", noMargin: s = !1, id: c }) => /* @__PURE__ */ m("div", { className: `${t} ${s ? "" : "mb-3"}`, children: [
60
+ }, Ne = (e) => /* @__PURE__ */ o(O, { type: "checkbox", ...e }), Ce = (e) => /* @__PURE__ */ o(O, { type: "switch", ...e }), ee = ({ children: e, label: r, className: t = "", labelClassName: n = "", noMargin: s = !1, id: c }) => /* @__PURE__ */ m("div", { className: `${t} ${s ? "" : "mb-3"}`, children: [
62
61
  /* @__PURE__ */ o("label", { className: `form-label ${n}`, htmlFor: c, children: r }),
63
62
  e
64
- ] }), Ce = ({ children: e, value: r, onChange: t, type: n, required: s, placeholder: c, className: i, labelClassName: a }) => {
65
- const l = v();
66
- return /* @__PURE__ */ o(K, { label: /* @__PURE__ */ m(g, { children: [
63
+ ] }), _e = ({ children: e, value: r, onChange: t, type: n, required: s, placeholder: c, className: i, labelClassName: a }) => {
64
+ const l = S();
65
+ return /* @__PURE__ */ o(ee, { label: /* @__PURE__ */ m(w, { children: [
67
66
  e,
68
67
  ":"
69
68
  ] }), className: i, labelClassName: a, id: l, children: /* @__PURE__ */ o(
@@ -78,14 +77,14 @@ const be = ({ className: e, children: r, loading: t = !1, type: n = "default", f
78
77
  onChange: (d) => t(d.target.value)
79
78
  }
80
79
  ) });
81
- }, ee = 500;
80
+ }, re = 500;
82
81
  let f;
83
- const _ = () => {
82
+ const T = () => {
84
83
  f !== null && clearTimeout(f), f = null;
85
- }, _e = ({ onChange: e, className: r, large: t = !0, noBorder: n = !1, initialValue: s = "", setTimeout_: c = setTimeout }) => {
86
- const [i, a] = b(s), l = (d, h = ee) => {
87
- a(d), _(), f = c(() => {
88
- e(d), _();
84
+ }, Te = ({ onChange: e, className: r, large: t = !0, noBorder: n = !1, initialValue: s = "", setTimeout_: c = setTimeout }) => {
85
+ const [i, a] = b(s), l = (d, h = re) => {
86
+ a(d), T(), f = c(() => {
87
+ e(d), T();
89
88
  }, h);
90
89
  };
91
90
  return /* @__PURE__ */ m("div", { className: u("search-field", r), children: [
@@ -102,7 +101,7 @@ const _ = () => {
102
101
  onChange: (d) => l(d.target.value)
103
102
  }
104
103
  ),
105
- /* @__PURE__ */ o(p, { icon: A, className: "search-field__icon" }),
104
+ /* @__PURE__ */ o(p, { icon: I, className: "search-field__icon" }),
106
105
  /* @__PURE__ */ o(
107
106
  "button",
108
107
  {
@@ -115,7 +114,10 @@ const _ = () => {
115
114
  }
116
115
  )
117
116
  ] });
118
- }, re = (e) => {
117
+ }, ve = () => y(null), ke = () => {
118
+ const e = z();
119
+ return C(() => e(-1), [e]);
120
+ }, te = (e) => {
119
121
  const r = new URLSearchParams(e), t = {};
120
122
  return r.forEach((n, s) => {
121
123
  if (s.endsWith("[]")) {
@@ -124,23 +126,23 @@ const _ = () => {
124
126
  } else
125
127
  t[s] = n;
126
128
  }), t;
127
- }, Te = (e) => {
129
+ }, Se = (e) => {
128
130
  const r = new URLSearchParams();
129
131
  for (const [t, n] of Object.entries(e))
130
132
  n !== void 0 && (Array.isArray(n) ? n.forEach((s) => r.append(`${t}[]`, `${s}`)) : r.append(t, `${n}`));
131
133
  return r.toString();
132
- }, ke = () => {
133
- const { search: e } = X();
134
- return V(() => re(e), [e]);
135
- }, te = 2e3, ve = (e = {}, r, t = globalThis.setTimeout, n = globalThis.clearTimeout) => {
136
- const { initialValue: s = !1, delay: c = te } = typeof e == "boolean" ? {
134
+ }, ye = () => {
135
+ const { search: e } = J();
136
+ return q(() => te(e), [e]);
137
+ }, ne = 2e3, Oe = (e = {}, r, t = globalThis.setTimeout, n = globalThis.clearTimeout) => {
138
+ const { initialValue: s = !1, delay: c = ne } = typeof e == "boolean" ? {
137
139
  initialValue: e,
138
140
  delay: r
139
- } : e, { setTimeout: i } = z(c, t, n), [a, l] = b(s), d = q(s), h = S(() => {
141
+ } : e, { setTimeout: i } = Z(c, t, n), [a, l] = b(s), d = y(s), h = C(() => {
140
142
  l(!d.current), i(() => l(d.current));
141
143
  }, [i]);
142
144
  return [a, h];
143
- }, ne = ({
145
+ }, oe = ({
144
146
  text: e,
145
147
  disabled: r = !1,
146
148
  className: t,
@@ -153,18 +155,18 @@ const _ = () => {
153
155
  size: d,
154
156
  ...h
155
157
  }) => {
156
- const [O, L] = J(), x = u("dropdown-btn__toggle", t, {
158
+ const [L, x] = B(), D = u("dropdown-btn__toggle", t, {
157
159
  "btn-block": !l,
158
160
  "dropdown-btn__toggle--with-caret": !c
159
- }), D = { minWidth: a && `${a}px` };
160
- return /* @__PURE__ */ m(M, { isOpen: O, toggle: L, disabled: r, className: s, children: [
161
- /* @__PURE__ */ o(T, { size: d, caret: !c, className: x, color: "primary", ...h, children: e }),
162
- /* @__PURE__ */ o(k, { className: "w-100", end: i, style: D, children: n })
161
+ }), R = { minWidth: a && `${a}px` };
162
+ return /* @__PURE__ */ m($, { isOpen: L, toggle: x, disabled: r, className: s, children: [
163
+ /* @__PURE__ */ o(v, { size: d, caret: !c, className: D, color: "primary", ...h, children: e }),
164
+ /* @__PURE__ */ o(k, { className: "w-100", end: i, style: R, children: n })
163
165
  ] });
164
- }, Se = ({ children: e, minWidth: r, label: t = "Options" }) => /* @__PURE__ */ o(
165
- ne,
166
+ }, Le = ({ children: e, minWidth: r, label: t = "Options" }) => /* @__PURE__ */ o(
167
+ oe,
166
168
  {
167
- text: /* @__PURE__ */ o(p, { className: "px-1", icon: I }),
169
+ text: /* @__PURE__ */ o(p, { className: "px-1", icon: E }),
168
170
  "aria-label": t,
169
171
  size: "sm",
170
172
  minWidth: r,
@@ -173,41 +175,41 @@ const _ = () => {
173
175
  inline: !0,
174
176
  children: e
175
177
  }
176
- ), oe = ({ children: e, ...r }) => /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(j, { className: "nav-pills__nav-link", tag: Z, ...r, children: e }) }), ye = ({ children: e, fill: r = !1, className: t = "" }) => /* @__PURE__ */ o(N, { className: `nav-pills__nav p-0 overflow-hidden ${t}`, body: !0, children: /* @__PURE__ */ o(G, { pills: !0, fill: r, children: Q.map(e, (n) => {
177
- if (!Y(n) || n.type !== oe)
178
+ ), se = ({ children: e, ...r }) => /* @__PURE__ */ o(G, { children: /* @__PURE__ */ o(j, { className: "nav-pills__nav-link", tag: X, ...r, children: e }) }), xe = ({ children: e, fill: r = !1, className: t = "" }) => /* @__PURE__ */ o(N, { className: `nav-pills__nav p-0 overflow-hidden ${t}`, body: !0, children: /* @__PURE__ */ o(U, { pills: !0, fill: r, children: Q.map(e, (n) => {
179
+ if (!Y(n) || n.type !== se)
178
180
  throw new Error("Only NavPillItem children are allowed inside NavPills.");
179
181
  return n;
180
182
  }) }) });
181
- function C(e, r, t) {
182
- return typeof e == "object" ? C(e.currentField, e.newField, e.currentOrderDir) : e !== r ? "ASC" : t ? {
183
+ function _(e, r, t) {
184
+ return typeof e == "object" ? _(e.currentField, e.newField, e.currentOrderDir) : e !== r ? "ASC" : t ? {
183
185
  ASC: "DESC",
184
186
  DESC: void 0
185
187
  }[t] : "ASC";
186
188
  }
187
- function se(e, r, t) {
188
- return typeof e == "object" ? se(e.currentField, e.newField, e.currentOrderDir) : {
189
+ function ce(e, r, t) {
190
+ return typeof e == "object" ? ce(e.currentField, e.newField, e.currentOrderDir) : {
189
191
  field: r,
190
- dir: C(e, r, t)
192
+ dir: _(e, r, t)
191
193
  };
192
194
  }
193
- const Oe = (e, { field: r, dir: t }) => !r || !t ? e : e.sort((n, s) => {
195
+ const De = (e, { field: r, dir: t }) => !r || !t ? e : e.sort((n, s) => {
194
196
  const c = t === "ASC" ? 1 : -1, i = t === "ASC" ? -1 : 1;
195
197
  return n[r] > s[r] ? c : i;
196
- }), Le = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, xe = (e) => {
198
+ }), Re = (e) => e.dir ? `${e.field}-${e.dir}` : void 0, Ae = (e) => {
197
199
  const [r, t] = e.split("-");
198
200
  return { field: r, dir: t };
199
- }, De = (e) => {
200
- const [r, t] = b(e), n = S((s, c) => t({ field: s, dir: c }), []);
201
+ }, Ie = (e) => {
202
+ const [r, t] = b(e), n = C((s, c) => t({ field: s, dir: c }), []);
201
203
  return [r, n];
202
204
  };
203
- function Re({ items: e, order: r, onChange: t, isButton: n = !0, right: s = !1, prefixed: c = !0 }) {
205
+ function Ee({ items: e, order: r, onChange: t, isButton: n = !0, right: s = !1, prefixed: c = !0 }) {
204
206
  const i = (a) => () => {
205
- const l = C(a, r.field, r.dir);
207
+ const l = _(a, r.field, r.dir);
206
208
  t(l ? a : void 0, l);
207
209
  };
208
- return /* @__PURE__ */ m(U, { children: [
210
+ return /* @__PURE__ */ m(V, { children: [
209
211
  /* @__PURE__ */ m(
210
- T,
212
+ v,
211
213
  {
212
214
  caret: !0,
213
215
  color: n ? "primary" : "link",
@@ -216,9 +218,9 @@ function Re({ items: e, order: r, onChange: t, isButton: n = !0, right: s = !1,
216
218
  "btn-sm p-0": !n
217
219
  }),
218
220
  children: [
219
- !n && /* @__PURE__ */ o(g, { children: "Order by" }),
221
+ !n && /* @__PURE__ */ o(w, { children: "Order by" }),
220
222
  n && !r.field && /* @__PURE__ */ o("i", { children: "Order by..." }),
221
- n && r.field && /* @__PURE__ */ m(g, { children: [
223
+ n && r.field && /* @__PURE__ */ m(w, { children: [
222
224
  c && "Order by: ",
223
225
  e[r.field],
224
226
  " - ",
@@ -229,70 +231,71 @@ function Re({ items: e, order: r, onChange: t, isButton: n = !0, right: s = !1,
229
231
  ),
230
232
  /* @__PURE__ */ m(k, { end: s, className: "w-100", style: n ? void 0 : { minWidth: "11rem" }, children: [
231
233
  Object.entries(e).map(([a, l]) => /* @__PURE__ */ m(
232
- w,
234
+ g,
233
235
  {
234
236
  active: r.field === a,
235
237
  onClick: i(a),
236
238
  className: "d-flex justify-content-between align-items-center",
237
239
  children: [
238
240
  l,
239
- r.field === a && /* @__PURE__ */ o(p, { icon: r.dir === "ASC" ? E : P })
241
+ r.field === a && /* @__PURE__ */ o(p, { icon: r.dir === "ASC" ? P : F })
240
242
  ]
241
243
  },
242
244
  a
243
245
  )),
244
- /* @__PURE__ */ o(w, { divider: !0 }),
245
- /* @__PURE__ */ o(w, { disabled: !r.field, onClick: () => t(), children: /* @__PURE__ */ o("i", { children: "Clear selection" }) })
246
+ /* @__PURE__ */ o(g, { divider: !0 }),
247
+ /* @__PURE__ */ o(g, { disabled: !r.field, onClick: () => t(), children: /* @__PURE__ */ o("i", { children: "Clear selection" }) })
246
248
  ] })
247
249
  ] });
248
250
  }
249
- const Ae = "#4696e5", Ie = "rgba(70, 150, 229, 0.4)", Ee = "#f77f28", Pe = "rgba(247, 127, 40, 0.4)", Fe = "white", He = "#161b22", ce = (e) => {
251
+ const Pe = "#4696e5", Fe = "rgba(70, 150, 229, 0.4)", He = "#f77f28", Me = "rgba(247, 127, 40, 0.4)", $e = "white", Ge = "#161b22", ae = (e) => {
250
252
  var r;
251
253
  return (r = document.querySelector("html")) == null ? void 0 : r.setAttribute("data-theme", e);
252
- }, Me = () => {
254
+ }, je = () => {
253
255
  var e;
254
256
  return ((e = document.querySelector("html")) == null ? void 0 : e.getAttribute("data-theme")) === "dark";
255
- }, ae = (e = window.matchMedia.bind(window)) => e("(prefers-color-scheme: dark)").matches ? "dark" : "light", $e = (e) => {
256
- const [r, t] = b(() => e ?? ae());
257
+ }, le = (e = window.matchMedia.bind(window)) => e("(prefers-color-scheme: dark)").matches ? "dark" : "light", Ue = (e) => {
258
+ const [r, t] = b(() => e ?? le());
257
259
  return W(() => {
258
- ce(r);
260
+ ae(r);
259
261
  }, [r]), [r, t];
260
262
  };
261
263
  export {
262
- ge as Checkbox,
263
- ne as DropdownBtn,
264
- Ee as HIGHLIGHTED_COLOR,
265
- Pe as HIGHLIGHTED_COLOR_ALPHA,
266
- Ce as InputFormGroup,
267
- K as LabeledFormGroup,
268
- Ae as MAIN_COLOR,
269
- Ie as MAIN_COLOR_ALPHA,
270
- be as Message,
271
- oe as NavPillItem,
272
- ye as NavPills,
273
- Re as OrderingDropdown,
274
- He as PRIMARY_DARK_COLOR,
275
- Fe as PRIMARY_LIGHT_COLOR,
264
+ Ne as Checkbox,
265
+ oe as DropdownBtn,
266
+ He as HIGHLIGHTED_COLOR,
267
+ Me as HIGHLIGHTED_COLOR_ALPHA,
268
+ _e as InputFormGroup,
269
+ ee as LabeledFormGroup,
270
+ Pe as MAIN_COLOR,
271
+ Fe as MAIN_COLOR_ALPHA,
272
+ ge as Message,
273
+ se as NavPillItem,
274
+ xe as NavPills,
275
+ Ee as OrderingDropdown,
276
+ Ge as PRIMARY_DARK_COLOR,
277
+ $e as PRIMARY_LIGHT_COLOR,
276
278
  we as Result,
277
- Se as RowDropdownBtn,
278
- _e as SearchField,
279
- B as SimpleCard,
280
- Ne as ToggleSwitch,
281
- ce as changeThemeInMarkup,
282
- se as determineOrder,
283
- C as determineOrderDir,
284
- ae as getSystemPreferredTheme,
285
- Me as isDarkThemeEnabled,
286
- Le as orderToString,
287
- re as parseQueryString,
288
- Oe as sortList,
289
- xe as stringToOrder,
290
- Te as stringifyQueryParams,
291
- Ue as useElementRef,
292
- De as useOrder,
293
- ke as useParsedQuery,
294
- $e as useTheme,
295
- z as useTimeout,
296
- ve as useTimeoutToggle,
297
- J as useToggle
279
+ Le as RowDropdownBtn,
280
+ Te as SearchField,
281
+ K as SimpleCard,
282
+ Ce as ToggleSwitch,
283
+ ae as changeThemeInMarkup,
284
+ ce as determineOrder,
285
+ _ as determineOrderDir,
286
+ le as getSystemPreferredTheme,
287
+ je as isDarkThemeEnabled,
288
+ Re as orderToString,
289
+ te as parseQueryString,
290
+ De as sortList,
291
+ Ae as stringToOrder,
292
+ Se as stringifyQueryParams,
293
+ ve as useElementRef,
294
+ ke as useGoBack,
295
+ Ie as useOrder,
296
+ ye as useParsedQuery,
297
+ Ue as useTheme,
298
+ Z as useTimeout,
299
+ Oe as useTimeoutToggle,
300
+ B as useToggle
298
301
  };
@@ -3,16 +3,20 @@ import { FC } from 'react';
3
3
  import { ForwardRefExoticComponent } from 'react';
4
4
  import { HTMLProps } from 'react';
5
5
  import { InputHTMLAttributes } from 'react';
6
+ import { JSX } from 'react/jsx-runtime';
6
7
  import { LinkProps } from 'react-router';
7
8
  import { PropsWithChildren } from 'react';
8
9
  import { ReactNode } from 'react';
9
10
  import { RefAttributes } from 'react';
11
+ import { RefObject } from 'react';
10
12
 
11
13
  export declare type BaseInputProps = {
12
14
  size?: Size;
13
15
  feedback?: 'error';
14
16
  };
15
17
 
18
+ declare type BaseInputProps_2 = Omit<SearchInputProps, 'role' | 'aria-autocomplete' | 'aria-expanded' | 'aria-controls' | 'onChange'>;
19
+
16
20
  declare type BooleanControlProps = Omit<HTMLProps<HTMLInputElement>, 'type' | 'onChange' | 'value' | 'defaultValue'> & {
17
21
  onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
18
22
  };
@@ -155,6 +159,29 @@ export declare type LinkButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'size'
155
159
 
156
160
  declare type LinkButtonProps_2 = LinkProps;
157
161
 
162
+ export declare function Listbox<Item>({ id, items, onSelectItem, renderItem, className, noItemsMessage, anchor, 'aria-label': label, ...rest }: ListboxProps<Item>): JSX.Element;
163
+
164
+ export declare type ListboxProps<Item> = Omit<CardProps, 'id' | 'role' | 'aria-orientation'> & {
165
+ /** Map of items in the listbox, with a key representing them uniquely */
166
+ items: Map<string, Item>;
167
+ /** Invoked when the active item is selected via click or `Enter` */
168
+ onSelectItem: (item: Item) => void;
169
+ /** To customize the shape of an item */
170
+ renderItem: (item: Item) => ReactNode;
171
+ /** Used to link with the element controlling this listbox */
172
+ id: string;
173
+ /**
174
+ * Allows to optionally anchor this listbox to another element.
175
+ * If provided, it will attach arrow key and Enter press listeners to interact with the listbox.
176
+ */
177
+ anchor?: RefObject<HTMLElement | null>;
178
+ /**
179
+ * Message to display when the list of items is empty.
180
+ * Defaults to 'No items'.
181
+ */
182
+ noItemsMessage?: string;
183
+ };
184
+
158
185
  /**
159
186
  * Component used to display a card with general information, about current page status, loading, etc.
160
187
  */
@@ -255,16 +282,47 @@ export declare type RevealablePasswordInputProps = Omit<InputProps, 'type'> & {
255
282
 
256
283
  export declare const roundTen: (number: number) => number;
257
284
 
285
+ /**
286
+ * This component combines a SearchInput with a Listbox, to behave close to an editable combobox with autocomplete, as
287
+ * described in https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/.
288
+ * The main difference is that the input is used only to search in the listbox, and once an item is selected, the input
289
+ * is cleared and the listbox is closed.
290
+ */
291
+ export declare function SearchCombobox<Item>({ searchResults, onSearch, onSelectSearchResult, renderSearchResult, size, listboxSpan, onFocus, ...rest }: SearchComboboxProps<Item>): JSX.Element;
292
+
293
+ export declare type SearchComboboxProps<Item> = BaseInputProps_2 & {
294
+ /** If defined, it will display a listbox with the search results */
295
+ searchResults?: Map<string, Item>;
296
+ /** Invoked when the search input value changes */
297
+ onSearch: (searchTerm: string) => void;
298
+ /** Invoked when the active search result is selected */
299
+ onSelectSearchResult: (item: Item) => void;
300
+ /** To customize the look and feel of a search result */
301
+ renderSearchResult: (item: Item) => ReactNode;
302
+ /**
303
+ * Determines how the listbox should span when visible.
304
+ * - `full`: Be always as big as the input, regardless its content.
305
+ * - `auto`: Take only the needed space to display its content, up to the width of the input.
306
+ *
307
+ * Defaults to `full`.
308
+ */
309
+ listboxSpan?: 'full' | 'auto';
310
+ };
311
+
258
312
  export declare const SearchInput: ForwardRefExoticComponent<Omit<InputProps, "className" | "onChange" | "value"> & {
259
313
  onChange: (searchTerm: string) => void;
260
314
  containerClassName?: string;
261
315
  inputClassName?: string;
316
+ /** When set to true, it displays a loading indicator in place of the magnifyinf glass icon */
317
+ loading?: boolean;
262
318
  } & RefAttributes<HTMLInputElement>>;
263
319
 
264
320
  export declare type SearchInputProps = Omit<InputProps, 'className' | 'onChange' | 'value'> & {
265
321
  onChange: (searchTerm: string) => void;
266
322
  containerClassName?: string;
267
323
  inputClassName?: string;
324
+ /** When set to true, it displays a loading indicator in place of the magnifyinf glass icon */
325
+ loading?: boolean;
268
326
  };
269
327
 
270
328
  export declare type SectionType = 'head' | 'body' | 'footer';