@mittwald/flow-react-components 0.1.0-alpha.203 → 0.1.0-alpha.204

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/List.js CHANGED
@@ -1,55 +1,55 @@
1
1
  "use client"
2
2
  /* */
3
3
  var mt = Object.defineProperty;
4
- var ht = (a, t, e) => t in a ? mt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
5
- var r = (a, t, e) => ht(a, typeof t != "symbol" ? t + "" : t, e);
6
- import n, { createContext as gt, useContext as pt, createElement as Y, useState as Q, useRef as ft, useEffect as z, cloneElement as bt } from "react";
4
+ var gt = (a, t, e) => t in a ? mt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
5
+ var r = (a, t, e) => gt(a, typeof t != "symbol" ? t + "" : t, e);
6
+ import n, { createContext as pt, useContext as ft, createElement as Y, useState as Q, useEffect as L, useRef as bt, cloneElement as St } from "react";
7
7
  import "./propsContext-DzAKlmhS.js";
8
- import { P as St } from "./PropsContextProvider-C6Z4XGp6.js";
8
+ import { P as vt } from "./PropsContextProvider-C6Z4XGp6.js";
9
9
  import "@react-aria/utils";
10
- import { isShallowEqual as vt, unique as yt, times as wt } from "remeda";
11
- import { d as Et } from "./dynamic-ClpUSmEt.js";
10
+ import { isShallowEqual as yt, unique as wt, times as Et } from "remeda";
11
+ import { d as Ct } from "./dynamic-ClpUSmEt.js";
12
12
  import { B as p } from "./Button-DQtavSbo.js";
13
13
  import "@tabler/icons-react";
14
14
  import "./Icon-DPoIVASu.js";
15
- import { I as Ct } from "./IconContextMenu-jwoVcLvd.js";
16
- import { a as k, C as X } from "./ContextMenuTrigger-BdJf5T8A.js";
15
+ import { I as Ft } from "./IconContextMenu-jwoVcLvd.js";
16
+ import { a as A, C as X } from "./ContextMenuTrigger-BdJf5T8A.js";
17
17
  import { M as Z } from "./MenuItem-DcfYvfPJ.js";
18
- import { useLocalizedStringFormatter as S } from "react-aria";
19
- import { TunnelProvider as Ft, TunnelExit as $ } from "@mittwald/react-tunnel";
20
- import E from "clsx";
21
- import { g as Lt } from "./getContainerBreakpointSizeClassName-BrcFDcCY.js";
22
- import { f as Tt } from "./flowComponent-DHPUcYyM.js";
23
- import { R as It } from "./Render-BdlTa7Qb.js";
18
+ import { useLocalizedStringFormatter as v } from "react-aria";
19
+ import { TunnelProvider as Lt, TunnelExit as $ } from "@mittwald/react-tunnel";
20
+ import C from "clsx";
21
+ import { g as Tt } from "./getContainerBreakpointSizeClassName-BrcFDcCY.js";
22
+ import { f as It } from "./flowComponent-DHPUcYyM.js";
23
+ import { R as kt } from "./Render-BdlTa7Qb.js";
24
24
  import { T as f } from "./Text-Sd5q3Yme.js";
25
25
  import { I as _ } from "./IconChevronDown--OxZLX8L.js";
26
- import { I as kt } from "./IconClose-BFwPT_IX.js";
27
- import { makeObservable as At, observable as U, computed as O, action as F } from "mobx";
26
+ import { I as At } from "./IconClose-BFwPT_IX.js";
27
+ import { makeObservable as xt, observable as U, computed as O, action as F } from "mobx";
28
28
  import "./context-BB3_MApL.js";
29
- import { u as xt } from "./useOnChange-C1Quwyuz.js";
30
- import { S as Bt } from "./SearchField-DstUFmq4.js";
31
- import { getProperty as Pt } from "dot-prop";
32
- import { hash as Dt } from "object-code";
33
- import { useReactTable as Nt, getCoreRowModel as Vt, getSortedRowModel as Rt, getFilteredRowModel as Mt, getPaginationRowModel as zt, getFacetedUniqueValues as $t } from "@tanstack/react-table";
29
+ import { u as Bt } from "./useOnChange-C1Quwyuz.js";
30
+ import { S as Pt } from "./SearchField-DstUFmq4.js";
31
+ import { getProperty as Dt } from "dot-prop";
32
+ import { hash as Nt } from "object-code";
33
+ import { useReactTable as Vt, getCoreRowModel as Rt, getSortedRowModel as Mt, getFilteredRowModel as zt, getPaginationRowModel as $t, getFacetedUniqueValues as Ut } from "@tanstack/react-table";
34
34
  import tt from "invariant";
35
35
  import { getAsyncResource as q } from "@mittwald/react-use-promise";
36
36
  import { u as H } from "./useSelector-DpU7_HMO.js";
37
- import * as A from "react-aria-components";
38
- import { I as Ut } from "./IllustratedMessage-B3MHD01M.js";
39
- import { I as Ot } from "./IconSearch-C7VQTAqK.js";
37
+ import * as x from "react-aria-components";
38
+ import { I as Ot } from "./IllustratedMessage-B3MHD01M.js";
39
+ import { I as qt } from "./IconSearch-C7VQTAqK.js";
40
40
  import { H as et } from "./Heading-BEC6iPfF.js";
41
- import { d as b, a as K } from "./deepFindOfType-6pG0fH7S.js";
42
- import { ListLoaderAsyncResource as qt, TypedListLoaderAsyncResource as Ht } from "./List/ListLoaderAsyncResource.js";
43
- import { S as Kt } from "./Skeleton-CKLaTmDR.js";
44
- const Gt = "flow--list--items--item--view", jt = "flow--list--items--item--view--title", Wt = "flow--list--items--item--view--top-content", Jt = "flow--list--items--item--view--content", Yt = "flow--list--items--item--view--action", Qt = "flow--list--items--item--view--avatar", Xt = "flow--list--items--item--view--text", Zt = "flow--list--items--item--view--heading", m = {
45
- view: Gt,
46
- title: jt,
47
- topContent: Wt,
48
- content: Jt,
49
- action: Yt,
50
- avatar: Qt,
51
- text: Xt,
52
- heading: Zt,
41
+ import { d as S, a as K } from "./deepFindOfType-6pG0fH7S.js";
42
+ import { ListLoaderAsyncResource as Ht, TypedListLoaderAsyncResource as Kt } from "./List/ListLoaderAsyncResource.js";
43
+ import { S as Gt } from "./Skeleton-CKLaTmDR.js";
44
+ const jt = "flow--list--items--item--view", Wt = "flow--list--items--item--view--title", Jt = "flow--list--items--item--view--top-content", Yt = "flow--list--items--item--view--content", Qt = "flow--list--items--item--view--action", Xt = "flow--list--items--item--view--avatar", Zt = "flow--list--items--item--view--text", _t = "flow--list--items--item--view--heading", h = {
45
+ view: jt,
46
+ title: Wt,
47
+ topContent: Jt,
48
+ content: Yt,
49
+ action: Qt,
50
+ avatar: Xt,
51
+ text: Zt,
52
+ heading: _t,
53
53
  "container-breakpoint-size-xs": "flow--list--items--item--view--container-breakpoint-size-xs",
54
54
  "container-breakpoint-size-s": "flow--list--items--item--view--container-breakpoint-size-s",
55
55
  "container-breakpoint-size-m": "flow--list--items--item--view--container-breakpoint-size-m",
@@ -73,70 +73,70 @@ const Gt = "flow--list--items--item--view", jt = "flow--list--items--item--view-
73
73
  "list.setSorting": (a) => `Sorting: ${a.property}`,
74
74
  "list.showMore": "Show more",
75
75
  "list.sorting": "Sorting"
76
- } }, _t = (a) => {
77
- const { className: t, children: e } = a, s = S(g);
78
- return /* @__PURE__ */ n.createElement(k, null, /* @__PURE__ */ n.createElement(
76
+ } }, te = (a) => {
77
+ const { className: t, children: e } = a, s = v(g);
78
+ return /* @__PURE__ */ n.createElement(A, null, /* @__PURE__ */ n.createElement(
79
79
  p,
80
80
  {
81
81
  variant: "plain",
82
82
  className: t,
83
83
  "aria-label": s.format("list.options")
84
84
  },
85
- /* @__PURE__ */ n.createElement(Ct, null)
85
+ /* @__PURE__ */ n.createElement(Ft, null)
86
86
  ), e);
87
- }, te = (a) => a === "top" ? m.topContent : a === "bottom" ? m.content : m.topContent, st = (a) => {
87
+ }, ee = (a) => a === "top" ? h.topContent : a === "bottom" ? h.content : h.topContent, st = (a) => {
88
88
  const { children: t, className: e, containerBreakpointSize: s = "m" } = a, i = {
89
89
  ContextMenu: {
90
- wrapWith: /* @__PURE__ */ n.createElement(_t, { className: m.action }),
90
+ wrapWith: /* @__PURE__ */ n.createElement(te, { className: h.action }),
91
91
  placement: "bottom end"
92
92
  },
93
93
  Button: {
94
- className: m.action
94
+ className: h.action
95
95
  },
96
96
  ActionGroup: {
97
- className: m.action,
97
+ className: h.action,
98
98
  ignoreBreakpoint: !0
99
99
  },
100
100
  Content: {
101
- className: Et((l) => te(l.slot)),
101
+ className: Ct((l) => ee(l.slot)),
102
102
  tunnelId: "topContent"
103
103
  },
104
104
  Avatar: {
105
- className: m.avatar,
105
+ className: h.avatar,
106
106
  tunnelId: "title"
107
107
  },
108
108
  Heading: {
109
- className: m.heading,
109
+ className: h.heading,
110
110
  level: 5,
111
111
  tunnelId: "title"
112
112
  },
113
113
  Text: {
114
- className: m.text,
114
+ className: h.text,
115
115
  tunnelId: "title"
116
116
  },
117
117
  Link: {
118
118
  unstyled: !0
119
119
  }
120
- }, o = E(
121
- m.view,
120
+ }, o = C(
121
+ h.view,
122
122
  e,
123
- m[Lt(s)]
123
+ h[Tt(s)]
124
124
  );
125
- return /* @__PURE__ */ n.createElement("div", { className: o }, /* @__PURE__ */ n.createElement(St, { props: i }, /* @__PURE__ */ n.createElement(Ft, null, t, /* @__PURE__ */ n.createElement("div", { className: m.title }, /* @__PURE__ */ n.createElement($, { id: "title" })), /* @__PURE__ */ n.createElement($, { id: "topContent" }))));
126
- }, it = gt({}), h = () => pt(it).list, ee = () => h().loader.getLoaderInvocationHooks().map((t, e) => /* @__PURE__ */ n.createElement(It, { key: e }, () => {
125
+ return /* @__PURE__ */ n.createElement("div", { className: o }, /* @__PURE__ */ n.createElement(vt, { props: i }, /* @__PURE__ */ n.createElement(Lt, null, t, /* @__PURE__ */ n.createElement("div", { className: h.title }, /* @__PURE__ */ n.createElement($, { id: "title" })), /* @__PURE__ */ n.createElement($, { id: "topContent" }))));
126
+ }, it = pt({}), m = () => ft(it).list, se = () => m().loader.getLoaderInvocationHooks().map((t, e) => /* @__PURE__ */ n.createElement(kt, { key: e }, () => {
127
127
  t();
128
- })), se = (a) => {
128
+ })), ie = (a) => {
129
129
  const { sorting: t } = a;
130
130
  return /* @__PURE__ */ n.createElement(Z, { id: t.id }, t.name);
131
- }, L = (a) => {
131
+ }, T = (a) => {
132
132
  const { children: t, locales: e, variables: s } = a;
133
- return S(e).format(t, s);
134
- }, ie = () => {
135
- const a = h(), t = a.visibleSorting.map((i) => /* @__PURE__ */ n.createElement(se, { sorting: i, key: i.id }));
133
+ return v(e).format(t, s);
134
+ }, ae = () => {
135
+ const a = m(), t = a.visibleSorting.map((i) => /* @__PURE__ */ n.createElement(ie, { sorting: i, key: i.id }));
136
136
  if (t.length === 0)
137
137
  return null;
138
138
  const e = a.visibleSorting.find((i) => i.isSorted()), s = /* @__PURE__ */ n.createElement(f, null, e ? /* @__PURE__ */ n.createElement(
139
- L,
139
+ T,
140
140
  {
141
141
  locales: g,
142
142
  variables: {
@@ -144,8 +144,8 @@ const Gt = "flow--list--items--item--view", jt = "flow--list--items--item--view-
144
144
  }
145
145
  },
146
146
  "list.setSorting"
147
- ) : /* @__PURE__ */ n.createElement(L, { locales: g }, "list.sorting"));
148
- return /* @__PURE__ */ n.createElement(k, null, /* @__PURE__ */ n.createElement(p, { variant: "soft", size: "s", color: "secondary" }, s, /* @__PURE__ */ n.createElement(_, null)), /* @__PURE__ */ n.createElement(
147
+ ) : /* @__PURE__ */ n.createElement(T, { locales: g }, "list.sorting"));
148
+ return /* @__PURE__ */ n.createElement(A, null, /* @__PURE__ */ n.createElement(p, { variant: "soft", size: "s", color: "secondary" }, s, /* @__PURE__ */ n.createElement(_, null)), /* @__PURE__ */ n.createElement(
149
149
  X,
150
150
  {
151
151
  selectionMode: "single",
@@ -156,36 +156,36 @@ const Gt = "flow--list--items--item--view", jt = "flow--list--items--item--view-
156
156
  },
157
157
  t
158
158
  ));
159
- }, ae = (a) => {
160
- const { filter: t } = a, { values: e, mode: s, name: i, property: o } = t, l = e.map((c) => /* @__PURE__ */ n.createElement(
159
+ }, ne = (a) => {
160
+ const { filter: t } = a, { values: e, mode: s, name: i, property: o } = t, l = e.map((u) => /* @__PURE__ */ n.createElement(
161
161
  Z,
162
162
  {
163
- id: c.id,
164
- key: c.id,
163
+ id: u.id,
164
+ key: u.id,
165
165
  onAction: () => {
166
- c.toggle();
166
+ u.toggle();
167
167
  }
168
168
  },
169
- c.render()
170
- )), u = e.filter((c) => c.isActive).map((c) => c.id);
171
- return /* @__PURE__ */ n.createElement(k, null, /* @__PURE__ */ n.createElement(p, { variant: "soft", size: "s", color: "secondary" }, /* @__PURE__ */ n.createElement(f, null, i ?? o), /* @__PURE__ */ n.createElement(_, null)), /* @__PURE__ */ n.createElement(
169
+ u.render()
170
+ )), c = e.filter((u) => u.isActive).map((u) => u.id);
171
+ return /* @__PURE__ */ n.createElement(A, null, /* @__PURE__ */ n.createElement(p, { variant: "soft", size: "s", color: "secondary" }, /* @__PURE__ */ n.createElement(f, null, i ?? o), /* @__PURE__ */ n.createElement(_, null)), /* @__PURE__ */ n.createElement(
172
172
  X,
173
173
  {
174
174
  selectionMode: s === "one" ? "single" : "multiple",
175
- selectedKeys: u
175
+ selectedKeys: c
176
176
  },
177
177
  l
178
178
  ));
179
- }, ne = "flow--list--header", re = "flow--list--header--picker-list-and-search", oe = "flow--list--header--picker-list", le = "flow--list--header--search-field", y = {
180
- header: ne,
181
- pickerListAndSearch: re,
182
- pickerList: oe,
183
- searchField: le
184
- }, ce = "flow--list--header--active-filters", ue = "flow--list--header--active-filters--clear-button", G = {
185
- activeFilters: ce,
186
- clearButton: ue
187
- }, de = () => {
188
- const a = h(), t = a.filters.flatMap(
179
+ }, re = "flow--list--header", oe = "flow--list--header--picker-list-and-search", le = "flow--list--header--picker-list", ce = "flow--list--header--search-field", w = {
180
+ header: re,
181
+ pickerListAndSearch: oe,
182
+ pickerList: le,
183
+ searchField: ce
184
+ }, ue = "flow--list--header--active-filters", de = "flow--list--header--active-filters--clear-button", G = {
185
+ activeFilters: ue,
186
+ clearButton: de
187
+ }, he = () => {
188
+ const a = m(), t = a.filters.flatMap(
189
189
  (e) => e.values.filter((s) => s.isActive).map((s) => /* @__PURE__ */ n.createElement(
190
190
  p,
191
191
  {
@@ -195,7 +195,7 @@ const Gt = "flow--list--items--item--view", jt = "flow--list--items--item--view-
195
195
  onPress: () => s.deactivate()
196
196
  },
197
197
  /* @__PURE__ */ n.createElement(f, null, s.render()),
198
- /* @__PURE__ */ n.createElement(kt, null)
198
+ /* @__PURE__ */ n.createElement(At, null)
199
199
  ))
200
200
  );
201
201
  return t.length <= 0 ? null : /* @__PURE__ */ n.createElement("div", { className: G.activeFilters }, t, /* @__PURE__ */ n.createElement(
@@ -206,30 +206,30 @@ const Gt = "flow--list--items--item--view", jt = "flow--list--items--item--view-
206
206
  variant: "plain",
207
207
  onPress: () => a.clearFilters()
208
208
  },
209
- /* @__PURE__ */ n.createElement(L, { locales: g }, "list.resetAll")
209
+ /* @__PURE__ */ n.createElement(T, { locales: g }, "list.resetAll")
210
210
  ));
211
211
  }, me = (a) => {
212
212
  const { className: t, onChange: e, value: s, ...i } = a, [o, l] = Q(s ?? "");
213
- xt(s, () => {
213
+ Bt(s, () => {
214
214
  l(s ?? "");
215
215
  }, [o]);
216
- const u = () => {
216
+ const c = () => {
217
217
  e(void 0), l("");
218
- }, c = (d) => {
219
- d.key === "Enter" ? o.trim() === "" ? e(void 0) : e(o) : d.key === "Escape" && u();
218
+ }, u = (d) => {
219
+ d.key === "Enter" ? o.trim() === "" ? e(void 0) : e(o) : d.key === "Escape" && c();
220
220
  };
221
221
  return /* @__PURE__ */ n.createElement(
222
- Bt,
222
+ Pt,
223
223
  {
224
224
  className: t,
225
225
  value: o,
226
- onKeyUp: c,
226
+ onKeyUp: u,
227
227
  onChange: (d) => l(d),
228
- onClear: u,
228
+ onClear: c,
229
229
  ...i
230
230
  }
231
231
  );
232
- }, he = (a) => {
232
+ }, ge = (a) => {
233
233
  const { className: t, search: e } = a, s = e.render ?? me;
234
234
  return Y(s, {
235
235
  className: t,
@@ -237,16 +237,16 @@ const Gt = "flow--list--items--item--view", jt = "flow--list--items--item--view-
237
237
  onChange: e.setValue.bind(e),
238
238
  ...e.textFieldProps
239
239
  });
240
- }, ge = (a) => {
241
- const { className: t } = a, e = h();
240
+ }, pe = (a) => {
241
+ const { className: t } = a, e = m();
242
242
  if (e.filters.length === 0 && e.visibleSorting.length === 0 && !e.search)
243
243
  return null;
244
- const s = e.filters.map((i) => /* @__PURE__ */ n.createElement(ae, { key: i.property, filter: i }));
245
- return /* @__PURE__ */ n.createElement("div", { className: E(t, y.header) }, /* @__PURE__ */ n.createElement("div", { className: y.pickerListAndSearch }, /* @__PURE__ */ n.createElement("div", { className: y.pickerList }, /* @__PURE__ */ n.createElement(ie, null), s), e.search && /* @__PURE__ */ n.createElement(he, { className: y.searchField, search: e.search })), /* @__PURE__ */ n.createElement(de, null));
246
- }, pe = "flow--list", fe = {
247
- list: pe
244
+ const s = e.filters.map((i) => /* @__PURE__ */ n.createElement(ne, { key: i.property, filter: i }));
245
+ return /* @__PURE__ */ n.createElement("div", { className: C(t, w.header) }, /* @__PURE__ */ n.createElement("div", { className: w.pickerListAndSearch }, /* @__PURE__ */ n.createElement("div", { className: w.pickerList }, /* @__PURE__ */ n.createElement(ae, null), s), e.search && /* @__PURE__ */ n.createElement(ge, { className: w.searchField, search: e.search })), /* @__PURE__ */ n.createElement(he, null));
246
+ }, fe = "flow--list", be = {
247
+ list: fe
248
248
  };
249
- let be = class at {
249
+ let Se = class at {
250
250
  constructor(t, e, s) {
251
251
  r(this, "id");
252
252
  r(this, "data");
@@ -257,16 +257,16 @@ let be = class at {
257
257
  return new at(t, e.id, e.original);
258
258
  }
259
259
  };
260
- class Se {
260
+ class ve {
261
261
  constructor(t) {
262
262
  r(this, "list");
263
263
  this.list = t;
264
264
  }
265
265
  get entries() {
266
- return this.list.reactTable.table.getRowModel().rows.map((t) => be.fromRow(this, t));
266
+ return this.list.reactTable.table.getRowModel().rows.map((t) => Se.fromRow(this, t));
267
267
  }
268
268
  }
269
- class ve {
269
+ class ye {
270
270
  constructor(t, e = {}) {
271
271
  r(this, "batchSize");
272
272
  r(this, "list");
@@ -313,7 +313,7 @@ class ve {
313
313
  }
314
314
  }
315
315
  }
316
- const ye = "$";
316
+ const we = "$";
317
317
  class j {
318
318
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
319
319
  constructor(t, e) {
@@ -322,10 +322,10 @@ class j {
322
322
  this.filter = t, this.value = e;
323
323
  }
324
324
  equals(t) {
325
- return vt(this.value, t.value);
325
+ return yt(this.value, t.value);
326
326
  }
327
327
  get id() {
328
- return `${this.filter.property}@@${Dt(this.value)}`;
328
+ return `${this.filter.property}@@${Nt(this.value)}`;
329
329
  }
330
330
  get isActive() {
331
331
  return this.filter.isValueActive(this);
@@ -340,8 +340,8 @@ class j {
340
340
  this.filter.deactivateValue(this);
341
341
  }
342
342
  }
343
- const we = (a, t) => a === t, Ee = (a) => String(a);
344
- class Ce {
343
+ const Ee = (a, t) => a === t, Ce = (a) => String(a);
344
+ class Fe {
345
345
  constructor(t, e) {
346
346
  r(this, "_values");
347
347
  r(this, "list");
@@ -352,14 +352,14 @@ class Ce {
352
352
  r(this, "name");
353
353
  r(this, "onFilterUpdateCallbacks", /* @__PURE__ */ new Set());
354
354
  var s;
355
- this.list = t, this.property = e.property, this.mode = e.mode ?? "one", this._values = (s = e.values) == null ? void 0 : s.map((i) => new j(this, i)), this.matcher = e.matcher ?? we, this.renderItem = e.renderItem ?? Ee, this.name = e.name;
355
+ this.list = t, this.property = e.property, this.mode = e.mode ?? "one", this._values = (s = e.values) == null ? void 0 : s.map((i) => new j(this, i)), this.matcher = e.matcher ?? Ee, this.renderItem = e.renderItem ?? Ce, this.name = e.name;
356
356
  }
357
357
  updateTableColumnDef(t) {
358
358
  t.enableColumnFilter = !0, t.filterFn = this.getReactTableFilterFn();
359
359
  }
360
360
  getReactTableFilterFn() {
361
361
  return (t, e, s) => {
362
- const i = this.property, o = i.startsWith(ye) ? t.original : Pt(t.original, i);
362
+ const i = this.property, o = i.startsWith(we) ? t.original : Dt(t.original, i);
363
363
  return this.checkFilterMatches(o, s);
364
364
  };
365
365
  }
@@ -387,7 +387,7 @@ class Ce {
387
387
  return ((t = this.getTableColumnFilter()) == null ? void 0 : t.value) ?? null;
388
388
  }
389
389
  get values() {
390
- return this._values === void 0 && (this._values = yt(
390
+ return this._values === void 0 && (this._values = wt(
391
391
  Array.from(this.getTableColumn().getFacetedUniqueValues().keys()).flatMap((t) => t).filter((t) => t != null)
392
392
  ).map((t) => new j(this, t))), this._values;
393
393
  }
@@ -419,7 +419,7 @@ class Ce {
419
419
  this.onFilterUpdateCallbacks.add(t);
420
420
  }
421
421
  }
422
- class Fe {
422
+ class Le {
423
423
  constructor(t, e) {
424
424
  r(this, "list");
425
425
  r(this, "property");
@@ -453,27 +453,26 @@ class Fe {
453
453
  return `${this.getTableColumn().id}:${this.direction}`;
454
454
  }
455
455
  }
456
- class x {
457
- constructor(t, e = {}) {
456
+ class B {
457
+ constructor(t, e, s = {}) {
458
458
  r(this, "list");
459
459
  r(this, "table");
460
460
  r(this, "sortingState");
461
461
  r(this, "updateSortingState");
462
462
  this.list = t;
463
- const s = this.list.sorting.filter(
464
- (l) => l.defaultEnabled !== !1
465
- ), [i, o] = Q(
466
- s.map((l) => l.getReactTableColumnSort())
463
+ const i = this.list.sorting.filter(
464
+ (c) => c.defaultEnabled !== !1
465
+ ), [o, l] = Q(
466
+ i.map((c) => c.getReactTableColumnSort())
467
467
  );
468
- this.sortingState = i, this.updateSortingState = o, this.table = this.useReactTable(e);
468
+ this.sortingState = o, this.updateSortingState = l, this.table = this.useReactTable(e, s);
469
469
  }
470
- static useNew(t, e = {}) {
471
- return new x(t, e);
470
+ static useNew(t, e, s = {}) {
471
+ return new B(t, e, s);
472
472
  }
473
- useReactTable(t = {}) {
474
- const e = this.list.loader.useData();
475
- return Nt({
476
- data: e,
473
+ useReactTable(t, e = {}) {
474
+ const s = this.list.loader.useData(), i = Vt({
475
+ data: s,
477
476
  state: {
478
477
  sorting: this.sortingState
479
478
  },
@@ -483,17 +482,20 @@ class x {
483
482
  }
484
483
  },
485
484
  columns: this.getTableColumnDefs(),
486
- getCoreRowModel: Vt(),
487
- getSortedRowModel: Rt(),
488
- getFilteredRowModel: Mt(),
489
- getPaginationRowModel: zt(),
490
- getFacetedUniqueValues: $t(),
491
- onSortingChange: (i) => {
492
- this.handleSortingStateUpdate(i);
485
+ getCoreRowModel: Rt(),
486
+ getSortedRowModel: Mt(),
487
+ getFilteredRowModel: zt(),
488
+ getPaginationRowModel: $t(),
489
+ getFacetedUniqueValues: Ut(),
490
+ onSortingChange: (o) => {
491
+ this.handleSortingStateUpdate(o);
493
492
  },
494
493
  globalFilterFn: "auto",
495
- ...t
494
+ ...e
496
495
  });
496
+ return L(() => {
497
+ t && t(this.list);
498
+ }, [this.list, t, i]), i;
497
499
  }
498
500
  handleSortingStateUpdate(t) {
499
501
  const e = typeof t == "function" ? t(this.sortingState) : t, s = this.list.sorting.filter(
@@ -528,12 +530,12 @@ class x {
528
530
  ), Array.from(t.values());
529
531
  }
530
532
  }
531
- class B {
533
+ class P {
532
534
  constructor() {
533
535
  r(this, "dataBatches", []);
534
536
  r(this, "prevDataBatches", []);
535
537
  r(this, "batchLoadingStates", ["void"]);
536
- At(this, {
538
+ xt(this, {
537
539
  prevDataBatches: !1,
538
540
  useMergedData: !1,
539
541
  useIsLoading: !1,
@@ -547,7 +549,7 @@ class B {
547
549
  });
548
550
  }
549
551
  static useNew() {
550
- return ft(new B()).current;
552
+ return bt(new P()).current;
551
553
  }
552
554
  reset() {
553
555
  this.batchLoadingStates = [], this.dataBatches = [];
@@ -571,8 +573,8 @@ class B {
571
573
  return H(() => this.isLoading);
572
574
  }
573
575
  }
574
- const Le = [];
575
- class P {
576
+ const Te = [];
577
+ class D {
576
578
  constructor(t, e = {}) {
577
579
  r(this, "list");
578
580
  r(this, "dataSource");
@@ -580,14 +582,14 @@ class P {
580
582
  r(this, "manualFiltering");
581
583
  r(this, "manualPagination");
582
584
  r(this, "loaderState");
583
- var u;
585
+ var c;
584
586
  const { source: s } = e;
585
- this.dataSource = s ?? { staticData: Le };
587
+ this.dataSource = s ?? { staticData: Te };
586
588
  const i = "manualPagination" in this.dataSource ? this.dataSource.manualPagination : void 0, o = "manualFiltering" in this.dataSource ? this.dataSource.manualFiltering : void 0, l = "manualSorting" in this.dataSource ? this.dataSource.manualSorting : void 0;
587
- this.list = t, this.loaderState = B.useNew(), this.manualPagination = i ?? !1, this.manualFiltering = o ?? this.manualPagination, this.manualSorting = l ?? this.manualPagination, this.list.filters.forEach((c) => c.onFilterUpdated(() => this.reset())), (u = this.list.search) == null || u.onUpdated(() => this.reset());
589
+ this.list = t, this.loaderState = P.useNew(), this.manualPagination = i ?? !1, this.manualFiltering = o ?? this.manualPagination, this.manualSorting = l ?? this.manualPagination, this.list.filters.forEach((u) => u.onFilterUpdated(() => this.reset())), (c = this.list.search) == null || c.onUpdated(() => this.reset());
588
590
  }
589
591
  static useNew(t, e = {}) {
590
- return new P(t, e);
592
+ return new D(t, e);
591
593
  }
592
594
  reset() {
593
595
  this.loaderState.reset();
@@ -602,7 +604,7 @@ class P {
602
604
  return this.loaderState.useMergedData();
603
605
  }
604
606
  getLoaderInvocationHooks() {
605
- return wt(this.list.batches.getBatchIndex() + 1, (e) => e).map((e) => () => {
607
+ return Et(this.list.batches.getBatchIndex() + 1, (e) => e).map((e) => () => {
606
608
  this.useLoadBatch(e);
607
609
  });
608
610
  }
@@ -613,7 +615,7 @@ class P {
613
615
  }), this.useObserveBatchData(e, t), this.useObserveBatchLoadingState(e, t);
614
616
  }
615
617
  useObserveBatchLoadingState(t, e) {
616
- z(() => (this.loaderState.setBatchLoadingState(
618
+ L(() => (this.loaderState.setBatchLoadingState(
617
619
  e,
618
620
  t.state.value
619
621
  ), t.state.observe((s) => {
@@ -625,7 +627,7 @@ class P {
625
627
  const { data: o, itemTotalCount: l } = i;
626
628
  this.loaderState.setDataBatch(e, o), l !== void 0 && this.list.batches.updateItemTotalCount(l);
627
629
  };
628
- z(() => (t.value.value.isSet && s(t.value.value.value), t.value.observe((i) => {
630
+ L(() => (t.value.value.isSet && s(t.value.value.value), t.value.observe((i) => {
629
631
  i.isSet && s(i.value);
630
632
  })), [t, e]);
631
633
  }
@@ -671,7 +673,7 @@ class P {
671
673
  throw new Error("Unknown data source");
672
674
  }
673
675
  }
674
- class Te {
676
+ class Ie {
675
677
  constructor(t, e) {
676
678
  r(this, "list");
677
679
  r(this, "render");
@@ -685,8 +687,11 @@ class Te {
685
687
  get isSet() {
686
688
  return this.value !== void 0;
687
689
  }
690
+ callOnUpdateCallbacks() {
691
+ this.onUpdateCallbacks.forEach((t) => t());
692
+ }
688
693
  setValue(t) {
689
- t === void 0 || t.trim() === "" ? this.list.reactTable.table.resetGlobalFilter() : this.list.reactTable.table.setGlobalFilter(t), this.onUpdateCallbacks.forEach((e) => e());
694
+ t === void 0 || t.trim() === "" ? this.list.reactTable.table.getState().globalFilter && (this.list.reactTable.table.resetGlobalFilter(), this.callOnUpdateCallbacks()) : (this.list.reactTable.table.setGlobalFilter(t), this.callOnUpdateCallbacks());
690
695
  }
691
696
  clear() {
692
697
  this.setValue(void 0);
@@ -695,7 +700,7 @@ class Te {
695
700
  this.onUpdateCallbacks.add(t);
696
701
  }
697
702
  }
698
- const w = class w {
703
+ const E = class E {
699
704
  constructor(t, e = {}) {
700
705
  r(this, "list");
701
706
  r(this, "textValue");
@@ -703,15 +708,15 @@ const w = class w {
703
708
  r(this, "onAction");
704
709
  r(this, "fallback");
705
710
  r(this, "renderFn");
706
- const { onAction: s, fallback: i, textValue: o, href: l, renderFn: u } = e;
707
- this.list = t, this.textValue = o, this.renderFn = u, this.href = l, this.onAction = s, this.fallback = i;
711
+ const { onAction: s, fallback: i, textValue: o, href: l, renderFn: c } = e;
712
+ this.list = t, this.textValue = o, this.renderFn = c, this.href = l, this.onAction = s, this.fallback = i;
708
713
  }
709
714
  render(t) {
710
- return (this.renderFn ?? w.fallbackRenderItemFn)(t);
715
+ return (this.renderFn ?? E.fallbackRenderItemFn)(t);
711
716
  }
712
717
  };
713
- r(w, "fallbackRenderItemFn", (t) => Y("pre", void 0, JSON.stringify(t)));
714
- let T = w, Ie = class nt {
718
+ r(E, "fallbackRenderItemFn", (t) => Y("pre", void 0, JSON.stringify(t)));
719
+ let I = E, ke = class nt {
715
720
  constructor(t) {
716
721
  r(this, "filters");
717
722
  r(this, "itemView");
@@ -727,9 +732,10 @@ let T = w, Ie = class nt {
727
732
  filters: s = [],
728
733
  sorting: i = [],
729
734
  batchesController: o,
730
- hasAction: l
735
+ hasAction: l,
736
+ onChange: c
731
737
  } = t;
732
- this.items = new Se(this), this.filters = s.map((u) => new Ce(this, u)), this.sorting = i.map((u) => new Fe(this, u)), this.search = t.search ? new Te(this, t.search) : void 0, this.itemView = new T(this, e), this.batches = new ve(this, o), this.loader = P.useNew(this, t.loader), this.reactTable = x.useNew(this, {
738
+ this.items = new ve(this), this.filters = s.map((u) => new Fe(this, u)), this.sorting = i.map((u) => new Le(this, u)), this.search = t.search ? new Ie(this, t.search) : void 0, this.itemView = new I(this, e), this.batches = new ye(this, o), this.loader = D.useNew(this, t.loader), this.reactTable = B.useNew(this, c, {
733
739
  manualFiltering: this.loader.manualFiltering,
734
740
  manualPagination: this.loader.manualPagination,
735
741
  manualSorting: this.loader.manualSorting
@@ -759,56 +765,56 @@ let T = w, Ie = class nt {
759
765
  return !this.loader.useIsLoading() && this.items.entries.length === 0;
760
766
  }
761
767
  };
762
- const ke = "flow--list--items", Ae = "flow--list--items--is-loading", W = {
763
- items: ke,
764
- isLoading: Ae
765
- }, xe = "flow--list--items--item", Be = "flow--list--items--item--has-action", I = {
766
- item: xe,
767
- hasAction: Be
768
- }, Pe = (a) => {
769
- const { data: t, children: e } = a, s = h(), i = s.itemView, o = i.onAction, l = i.textValue ? i.textValue(t) : void 0, u = o ? () => o(t) : void 0, c = i.href ? i.href(t) : void 0, d = s.hasAction || !!u || !!c, C = E(I.item, d && I.hasAction);
768
+ const Ae = "flow--list--items", xe = "flow--list--items--is-loading", W = {
769
+ items: Ae,
770
+ isLoading: xe
771
+ }, Be = "flow--list--items--item", Pe = "flow--list--items--item--has-action", k = {
772
+ item: Be,
773
+ hasAction: Pe
774
+ }, De = (a) => {
775
+ const { data: t, children: e } = a, s = m(), i = s.itemView, o = i.onAction, l = i.textValue ? i.textValue(t) : void 0, c = o ? () => o(t) : void 0, u = i.href ? i.href(t) : void 0, d = s.hasAction || !!c || !!u, b = C(k.item, d && k.hasAction);
770
776
  return /* @__PURE__ */ n.createElement(
771
- A.GridListItem,
777
+ x.GridListItem,
772
778
  {
773
- className: C,
774
- onAction: u,
779
+ className: b,
780
+ onAction: c,
775
781
  textValue: l,
776
- href: c
782
+ href: u
777
783
  },
778
784
  e ?? i.render(t)
779
785
  );
780
- }, De = (a) => /* @__PURE__ */ n.createElement(A.GridListItem, { textValue: "-", className: I.item }, a.children), Ne = () => {
781
- const a = S(g);
782
- return /* @__PURE__ */ n.createElement(Ut, null, /* @__PURE__ */ n.createElement(Ot, null), /* @__PURE__ */ n.createElement(et, null, a.format("list.noResult.heading")), /* @__PURE__ */ n.createElement(f, null, a.format("list.noResult.text")));
783
- }, Ve = "flow--skeleton-text", Re = "flow--skeleton-text--shimmer", Me = {
784
- skeletonText: Ve,
785
- shimmer: Re
786
+ }, Ne = (a) => /* @__PURE__ */ n.createElement(x.GridListItem, { textValue: "-", className: k.item }, a.children), Ve = () => {
787
+ const a = v(g);
788
+ return /* @__PURE__ */ n.createElement(Ot, null, /* @__PURE__ */ n.createElement(qt, null), /* @__PURE__ */ n.createElement(et, null, a.format("list.noResult.heading")), /* @__PURE__ */ n.createElement(f, null, a.format("list.noResult.text")));
789
+ }, Re = "flow--skeleton-text", Me = "flow--skeleton-text--shimmer", ze = {
790
+ skeletonText: Re,
791
+ shimmer: Me
786
792
  }, J = (a) => {
787
793
  const { width: t, style: e = {}, ...s } = a;
788
- return /* @__PURE__ */ n.createElement("div", { "aria-hidden": !0, style: { width: t, ...e }, ...s }, /* @__PURE__ */ n.createElement("div", { className: Me.skeletonText }));
789
- }, ze = () => /* @__PURE__ */ n.createElement(st, null, /* @__PURE__ */ n.createElement(et, null, /* @__PURE__ */ n.createElement(J, { width: "200px" })), /* @__PURE__ */ n.createElement(f, null, /* @__PURE__ */ n.createElement(J, { width: "300px" }))), $e = () => {
790
- const t = h().itemView.fallback ?? /* @__PURE__ */ n.createElement(ze, null);
791
- return Array.from(Array(5)).map((e, s) => /* @__PURE__ */ n.createElement(De, { key: s }, bt(t)));
792
- }, Ue = (a) => {
793
- const { className: t, ...e } = a, s = h(), i = s.loader.useIsLoading(), o = s.loader.useIsInitiallyLoading(), l = s.useIsEmpty(), u = s.items.entries.map((d) => /* @__PURE__ */ n.createElement(Pe, { key: d.id, data: d.data })), c = E(
794
+ return /* @__PURE__ */ n.createElement("div", { "aria-hidden": !0, style: { width: t, ...e }, ...s }, /* @__PURE__ */ n.createElement("div", { className: ze.skeletonText }));
795
+ }, $e = () => /* @__PURE__ */ n.createElement(st, null, /* @__PURE__ */ n.createElement(et, null, /* @__PURE__ */ n.createElement(J, { width: "200px" })), /* @__PURE__ */ n.createElement(f, null, /* @__PURE__ */ n.createElement(J, { width: "300px" }))), Ue = () => {
796
+ const t = m().itemView.fallback ?? /* @__PURE__ */ n.createElement($e, null);
797
+ return Array.from(Array(5)).map((e, s) => /* @__PURE__ */ n.createElement(Ne, { key: s }, St(t)));
798
+ }, Oe = (a) => {
799
+ const { className: t, ...e } = a, s = m(), i = s.loader.useIsLoading(), o = s.loader.useIsInitiallyLoading(), l = s.useIsEmpty(), c = s.items.entries.map((d) => /* @__PURE__ */ n.createElement(De, { key: d.id, data: d.data })), u = C(
794
800
  W.items,
795
801
  t,
796
802
  i && W.isLoading
797
803
  );
798
- return l ? /* @__PURE__ */ n.createElement(Ne, null) : /* @__PURE__ */ n.createElement("div", { "aria-hidden": o, "aria-busy": i }, /* @__PURE__ */ n.createElement(A.GridList, { className: c, ...e }, o ? /* @__PURE__ */ n.createElement($e, null) : u));
799
- }, rt = (a) => null, Oe = () => rt, ot = (a) => null, qe = () => ot, lt = (a) => null, He = () => lt, ct = (a) => null, Ke = () => ct, ut = (a) => null, Ge = () => ut, je = "flow--list--footer", We = {
800
- footer: je
801
- }, Je = (a) => {
802
- const t = S(g), e = h(), s = e.batches, i = e.loader.useIsInitiallyLoading(), o = e.useIsEmpty(), l = s.getTotalItemsCount(), u = s.getVisibleItemsCount();
804
+ return l ? /* @__PURE__ */ n.createElement(Ve, null) : /* @__PURE__ */ n.createElement("div", { "aria-hidden": o, "aria-busy": i }, /* @__PURE__ */ n.createElement(x.GridList, { className: u, ...e }, o ? /* @__PURE__ */ n.createElement(Ue, null) : c));
805
+ }, rt = (a) => null, qe = () => rt, ot = (a) => null, He = () => ot, lt = (a) => null, Ke = () => lt, ct = (a) => null, Ge = () => ct, ut = (a) => null, je = () => ut, We = "flow--list--footer", Je = {
806
+ footer: We
807
+ }, Ye = (a) => {
808
+ const t = v(g), e = m(), s = e.batches, i = e.loader.useIsInitiallyLoading(), o = e.useIsEmpty(), l = s.getTotalItemsCount(), c = s.getVisibleItemsCount();
803
809
  if (o)
804
810
  return null;
805
- const c = i ? /* @__PURE__ */ n.createElement(Kt, { width: "200px" }) : t.format("list.paginationInfo", {
806
- visibleItemsCount: u,
811
+ const u = i ? /* @__PURE__ */ n.createElement(Gt, { width: "200px" }) : t.format("list.paginationInfo", {
812
+ visibleItemsCount: c,
807
813
  totalItemsCount: l
808
814
  });
809
- return /* @__PURE__ */ n.createElement(f, { ...a }, c);
810
- }, Ye = (a) => {
811
- const t = S(g), e = h(), s = e.loader.useIsLoading(), i = e.loader.useIsInitiallyLoading();
815
+ return /* @__PURE__ */ n.createElement(f, { ...a }, u);
816
+ }, Qe = (a) => {
817
+ const t = v(g), e = m(), s = e.loader.useIsLoading(), i = e.loader.useIsInitiallyLoading();
812
818
  return !e.batches.hasNextBatch() && !s ? null : /* @__PURE__ */ n.createElement(
813
819
  p,
814
820
  {
@@ -821,44 +827,45 @@ const ke = "flow--list--items", Ae = "flow--list--items--is-loading", W = {
821
827
  },
822
828
  t.format("list.showMore")
823
829
  );
824
- }, Qe = () => /* @__PURE__ */ n.createElement("div", { className: We.footer }, /* @__PURE__ */ n.createElement(Je, null), /* @__PURE__ */ n.createElement(Ye, null));
830
+ }, Xe = () => /* @__PURE__ */ n.createElement("div", { className: Je.footer }, /* @__PURE__ */ n.createElement(Ye, null), /* @__PURE__ */ n.createElement(Qe, null));
825
831
  function dt(a) {
826
832
  return null;
827
833
  }
828
- const Xe = () => dt, Ze = Tt("List", (a) => {
829
- var D, N, V, R, M;
830
- const { children: t, batchSize: e, ...s } = a, i = (D = b(
834
+ const Ze = () => dt, _e = It("List", (a) => {
835
+ var N, V, R, M, z;
836
+ const { children: t, batchSize: e, onChange: s, ...i } = a, o = (N = S(
831
837
  t,
832
838
  rt
833
- )) == null ? void 0 : D.props, o = (N = b(
839
+ )) == null ? void 0 : N.props, l = (V = S(
834
840
  t,
835
- qt
836
- )) == null ? void 0 : N.props, l = (V = b(t, ut)) == null ? void 0 : V.props, u = {
837
- source: i ? {
838
- ...i,
839
- asyncLoader: i.children
840
- } : o ? {
841
+ Ht
842
+ )) == null ? void 0 : V.props, c = (R = S(t, ut)) == null ? void 0 : R.props, u = {
843
+ source: o ? {
841
844
  ...o,
842
- asyncResourceFactory: o.children
845
+ asyncLoader: o.children
843
846
  } : l ? {
844
- staticData: l.data
847
+ ...l,
848
+ asyncResourceFactory: l.children
849
+ } : c ? {
850
+ staticData: c.data
845
851
  } : void 0
846
- }, c = (R = b(t, dt)) == null ? void 0 : R.props, d = (M = b(t, ct)) == null ? void 0 : M.props, C = Ie.useNew({
852
+ }, d = (M = S(t, dt)) == null ? void 0 : M.props, b = (z = S(t, ct)) == null ? void 0 : z.props, ht = ke.useNew({
853
+ onChange: s,
847
854
  loader: u,
848
855
  filters: K(t, ot).map(
849
- (v) => ({
850
- ...v.props,
851
- renderItem: v.props.children
856
+ (y) => ({
857
+ ...y.props,
858
+ renderItem: y.props.children
852
859
  })
853
860
  ),
854
- search: c ? {
855
- render: c.children,
856
- textFieldProps: c
861
+ search: d ? {
862
+ render: d.children,
863
+ textFieldProps: d
857
864
  } : void 0,
858
- sorting: K(t, lt).map((v) => v.props),
859
- itemView: d ? {
860
- ...d,
861
- renderFn: d.children
865
+ sorting: K(t, lt).map((y) => y.props),
866
+ itemView: b ? {
867
+ ...b,
868
+ renderFn: b.children
862
869
  } : void 0,
863
870
  batchesController: {
864
871
  batchSize: e
@@ -869,36 +876,37 @@ const Xe = () => dt, Ze = Tt("List", (a) => {
869
876
  it.Provider,
870
877
  {
871
878
  value: {
872
- list: C
879
+ list: ht
873
880
  }
874
881
  },
875
- /* @__PURE__ */ n.createElement(ee, null),
876
- /* @__PURE__ */ n.createElement("div", { className: fe.list }, /* @__PURE__ */ n.createElement(ge, null), /* @__PURE__ */ n.createElement(Ue, { ...s }), /* @__PURE__ */ n.createElement(Qe, null))
882
+ /* @__PURE__ */ n.createElement(se, null),
883
+ /* @__PURE__ */ n.createElement("div", { className: be.list }, /* @__PURE__ */ n.createElement(pe, null), /* @__PURE__ */ n.createElement(Oe, { ...i }), /* @__PURE__ */ n.createElement(Xe, null))
877
884
  );
878
- }), Ms = () => ({
879
- List: Ze,
880
- Filter: qe(),
881
- Search: Xe(),
882
- Sorting: He(),
883
- Item: Ke(),
885
+ }), ts = () => _e, $s = () => ({
886
+ List: ts(),
887
+ Filter: He(),
888
+ Search: Ze(),
889
+ Sorting: Ke(),
890
+ Item: Ge(),
884
891
  ItemView: st,
885
- StaticData: Ge(),
886
- LoaderAsync: Oe(),
887
- LoaderAsyncResource: Ht()
892
+ StaticData: je(),
893
+ LoaderAsync: qe(),
894
+ LoaderAsyncResource: Kt()
888
895
  });
889
896
  export {
890
- Ze as List,
897
+ _e as List,
891
898
  ot as ListFilter,
892
899
  ct as ListItem,
893
900
  st as ListItemView,
894
901
  rt as ListLoaderAsync,
895
902
  lt as ListSorting,
896
903
  ut as ListStaticData,
897
- qe as TypedListFilter,
898
- Ke as TypedListItem,
899
- Oe as TypedListLoaderAsync,
900
- He as TypedListSorting,
901
- Ge as TypedListStaticData,
902
- Ms as typedList,
903
- h as useList
904
+ ts as TypedList,
905
+ He as TypedListFilter,
906
+ Ge as TypedListItem,
907
+ qe as TypedListLoaderAsync,
908
+ Ke as TypedListSorting,
909
+ je as TypedListStaticData,
910
+ $s as typedList,
911
+ m as useList
904
912
  };
@@ -1,9 +1,11 @@
1
1
  import { PropsWithChildren, default as React } from 'react';
2
2
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
3
3
  import { ItemListProps } from './components/Items/Items';
4
+ import { OnListChanged } from './model/types';
4
5
 
5
- export interface ListProps extends PropsWithChildren, ItemListProps, FlowComponentProps {
6
+ export interface ListProps<T> extends PropsWithChildren, ItemListProps, FlowComponentProps {
6
7
  batchSize?: number;
8
+ onChange?: OnListChanged<T>;
7
9
  }
8
- export declare const List: React.ForwardRefExoticComponent<ListProps & React.RefAttributes<never>>;
10
+ export declare const List: React.ForwardRefExoticComponent<ListProps<never> & React.RefAttributes<never>>;
9
11
  export default List;
@@ -17,7 +17,7 @@ export declare class List<T> {
17
17
  readonly reactTable: ReactTable<T>;
18
18
  readonly batches: BatchesController<T>;
19
19
  readonly loader: IncrementalLoader<T>;
20
- readonly hasAction: boolean;
20
+ readonly hasAction?: boolean;
21
21
  private constructor();
22
22
  static useNew<T>(shape: ListShape<T>): List<T>;
23
23
  get isFiltered(): boolean;
@@ -1,6 +1,6 @@
1
1
  import { Column, ColumnSort, Table, TableOptions } from '@tanstack/react-table';
2
2
  import { default as List } from './List';
3
- import { PropertyName } from './types';
3
+ import { OnListChanged, PropertyName } from './types';
4
4
  import { SearchValue } from './search/types';
5
5
  import { Dispatch, SetStateAction } from 'react';
6
6
 
@@ -10,7 +10,7 @@ export declare class ReactTable<T> {
10
10
  readonly sortingState: ColumnSort[];
11
11
  readonly updateSortingState: Dispatch<SetStateAction<ColumnSort[]>>;
12
12
  private constructor();
13
- static useNew<T>(list: List<T>, tableOptions?: Partial<TableOptions<T>>): ReactTable<T>;
13
+ static useNew<T>(list: List<T>, onChange?: OnListChanged<T>, tableOptions?: Partial<TableOptions<T>>): ReactTable<T>;
14
14
  private useReactTable;
15
15
  private handleSortingStateUpdate;
16
16
  get searchString(): SearchValue;
@@ -9,6 +9,7 @@ export declare class Search<T> {
9
9
  constructor(list: List<T>, searchShape: SearchShape<T>);
10
10
  get value(): SearchValue;
11
11
  get isSet(): boolean;
12
+ private callOnUpdateCallbacks;
12
13
  setValue(value: SearchValue): void;
13
14
  clear(): void;
14
15
  onUpdated(cb: () => unknown): void;
@@ -7,12 +7,14 @@ import { SearchShape } from './search/types';
7
7
  import { ItemViewShape } from './item/ItemView';
8
8
  import { ReactNode } from 'react';
9
9
  import { ItemType } from '../../../lib/types/array';
10
+ import { default as List } from './List';
10
11
 
11
12
  export declare const customPropertyPrefix: "$";
12
13
  export type CustomPropertyName = `${typeof customPropertyPrefix}${string}`;
13
14
  export type PropertyName<T> = DeepKeys<T> | CustomPropertyName;
14
15
  export type PropertyValue<T, TProp> = TProp extends CustomPropertyName ? T : DeepValue<T, TProp>;
15
16
  export type PropertyValueRenderMethod<TMatcherValue> = (prop: NonNullable<ItemType<TMatcherValue>>) => ReactNode;
17
+ export type OnListChanged<T> = (list: List<T>) => void;
16
18
  export interface ListShape<T> {
17
19
  loader?: IncrementalLoaderShape<T>;
18
20
  filters?: FilterShape<T, never, never>[];
@@ -20,6 +22,7 @@ export interface ListShape<T> {
20
22
  search?: SearchShape<T>;
21
23
  sorting?: SortingShape<T>[];
22
24
  batchesController?: BatchesControllerShape;
23
- hasAction: boolean;
25
+ hasAction?: boolean;
26
+ onChange?: OnListChanged<T>;
24
27
  }
25
28
  export type PropertyRecord<T, TValue> = Partial<Record<PropertyName<T>, TValue>>;
@@ -1,9 +1,13 @@
1
+ import { ListProps } from './List';
2
+ import { ComponentType } from 'react';
3
+
4
+ export declare const TypedList: <T>() => ComponentType<ListProps<T>>;
1
5
  export declare const typedList: <T>() => {
2
- List: import('react').ForwardRefExoticComponent<import('./List').ListProps & import('react').RefAttributes<never>>;
6
+ List: ComponentType<ListProps<T>>;
3
7
  Filter: <const TProp extends import('./model/types').PropertyName<T>, TMatcherValue = import('./model/types').PropertyValue<T, TProp>>(props: Omit<import('./model/filter/types').FilterShape<T, TProp, TMatcherValue>, "type" | "renderItem"> & {
4
8
  children?: import('./model/types').PropertyValueRenderMethod<TMatcherValue> | undefined;
5
9
  }) => import('react').ReactNode;
6
- Search: import('react').ComponentType<Omit<import('./model/search/types').SearchShape<T>, "render" | "textFieldProps"> & {
10
+ Search: ComponentType<Omit<import('./model/search/types').SearchShape<T>, "render" | "textFieldProps"> & {
7
11
  children?: import('./model/search/types').SearchFieldRenderComponent;
8
12
  } & {
9
13
  className?: string | ((values: import('react-aria-components').SearchFieldRenderProps & {
@@ -11,20 +15,20 @@ export declare const typedList: <T>() => {
11
15
  }) => string) | undefined;
12
16
  autoFocus?: boolean | undefined;
13
17
  }>;
14
- Sorting: import('react').ComponentType<import('./model/sorting/types').SortingShape<T>>;
15
- Item: import('react').ComponentType<Omit<import('./model/item/ItemView').ItemViewShape<T>, "renderFn"> & {
18
+ Sorting: ComponentType<import('./model/sorting/types').SortingShape<T>>;
19
+ Item: ComponentType<Omit<import('./model/item/ItemView').ItemViewShape<T>, "renderFn"> & {
16
20
  children: import('.').RenderItemFn<T>;
17
21
  }>;
18
22
  ItemView: (props: {
19
23
  children?: import('react').ReactNode | undefined;
20
24
  } & import('../../lib/types/props').PropsWithClassName & import('../../lib/types/props').PropsWithContainerBreakpointSize) => import("react").JSX.Element;
21
- StaticData: import('react').ComponentType<{
25
+ StaticData: ComponentType<{
22
26
  data: readonly T[];
23
27
  }>;
24
- LoaderAsync: import('react').ComponentType<Omit<import('./model/loading/types').AsyncDataLoaderShape<T>, "asyncLoader"> & {
28
+ LoaderAsync: ComponentType<Omit<import('./model/loading/types').AsyncDataLoaderShape<T>, "asyncLoader"> & {
25
29
  children: import('./model/loading/types').AsyncDataLoader<T>;
26
30
  }>;
27
- LoaderAsyncResource: import('react').ComponentType<Omit<import('./model/loading/types').AsyncResourceFactoryDataLoaderShape<T>, "asyncResourceFactory"> & {
31
+ LoaderAsyncResource: ComponentType<Omit<import('./model/loading/types').AsyncResourceFactoryDataLoaderShape<T>, "asyncResourceFactory"> & {
28
32
  children: (options?: import('./model/loading/types').DataLoaderOptions<T> | undefined) => import('@mittwald/react-use-promise').AsyncResource<import('./model/loading/types').DataLoaderResult<T>>;
29
33
  }>;
30
34
  };
@@ -67,7 +67,7 @@ export interface FlowComponentPropsTypes {
67
67
  Label: LabelProps;
68
68
  LayoutCard: LayoutCardProps;
69
69
  Link: LinkProps;
70
- List: ListProps;
70
+ List: ListProps<never>;
71
71
  MenuItem: MenuItemProps;
72
72
  Modal: ModalProps;
73
73
  ModalTrigger: OverlayTriggerProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-react-components",
3
- "version": "0.1.0-alpha.203",
3
+ "version": "0.1.0-alpha.204",
4
4
  "type": "module",
5
5
  "description": "A React implementation of Flow, mittwald’s design system",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -284,7 +284,7 @@
284
284
  "dependencies": {
285
285
  "@chakra-ui/live-region": "^2.1.0",
286
286
  "@internationalized/string-compiler": "^3.2.4",
287
- "@mittwald/react-tunnel": "^0.1.0-alpha.203",
287
+ "@mittwald/react-tunnel": "^0.1.0-alpha.204",
288
288
  "@mittwald/react-use-promise": "^2.3.13",
289
289
  "@react-aria/utils": "^3.25.1",
290
290
  "@react-types/shared": "^3.24.1",
@@ -310,7 +310,7 @@
310
310
  },
311
311
  "devDependencies": {
312
312
  "@faker-js/faker": "^8.4.1",
313
- "@mittwald/flow-design-tokens": "^0.1.0-alpha.203",
313
+ "@mittwald/flow-design-tokens": "^0.1.0-alpha.204",
314
314
  "@mittwald/react-use-promise": "^2.3.13",
315
315
  "@nx/storybook": "^19.5.6",
316
316
  "@storybook/addon-a11y": "^8.2.7",
@@ -388,5 +388,5 @@
388
388
  "optional": true
389
389
  }
390
390
  },
391
- "gitHead": "1e9ccb798574cbaa70c5716aec78ee4da961b3c2"
391
+ "gitHead": "3d8e2516a876b466d461cc20b9ef923688d3d9e4"
392
392
  }