@bfrs/agentic-components 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.
Files changed (27) hide show
  1. package/dist/components/data-display/DataTable/TableSaveView.d.ts +14 -1
  2. package/dist/components/data-display/DataTable/TableSaveView.js +164 -144
  3. package/dist/components/data-display/DataTable/TableSaveView.js.map +1 -1
  4. package/dist/components/data-display/DataTable/TableViewSelector.d.ts +15 -1
  5. package/dist/components/data-display/DataTable/TableViewSelector.js +304 -296
  6. package/dist/components/data-display/DataTable/TableViewSelector.js.map +1 -1
  7. package/dist/components/data-display/DataTable/index.d.ts +1 -0
  8. package/dist/components/data-display/DataTable/savedViewAnalytics.d.ts +109 -0
  9. package/dist/components/data-display/DataTable/savedViewAnalytics.js +140 -0
  10. package/dist/components/data-display/DataTable/savedViewAnalytics.js.map +1 -0
  11. package/dist/components/ui/index.d.ts +2 -0
  12. package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.d.ts +18 -0
  13. package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.js +12 -0
  14. package/dist/components/ui/providers/BfrsAnalyticsProvider/BfrsAnalyticsProvider.js.map +1 -0
  15. package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.d.ts +78 -0
  16. package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.js +41 -0
  17. package/dist/components/ui/providers/BfrsAnalyticsProvider/analyticsContext.js.map +1 -0
  18. package/dist/components/ui/providers/BfrsAnalyticsProvider/index.d.ts +4 -0
  19. package/dist/components/ui/providers/BfrsProvider/BfrsProvider.d.ts +25 -0
  20. package/dist/components/ui/providers/BfrsProvider/BfrsProvider.js +42 -41
  21. package/dist/components/ui/providers/BfrsProvider/BfrsProvider.js.map +1 -1
  22. package/dist/custom-elements.js +9120 -8932
  23. package/dist/custom-elements.js.map +1 -1
  24. package/dist/index.js +224 -213
  25. package/dist/index.js.map +1 -1
  26. package/package.json +1 -1
  27. package/scripts/lint/cli.cjs +6 -0
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { TableColumnVisibilityColumn, ViewFilter, ViewType, SaveViewPayload, SaveViewResult } from './DataTable.types';
3
3
  import { SaveViewApiConfig } from './saveViewApi';
4
+ import { SavedViewAnalyticsInput } from './savedViewAnalytics';
4
5
  export type TableSaveViewProps = {
5
6
  open?: boolean;
6
7
  defaultOpen?: boolean;
@@ -53,5 +54,17 @@ export type TableSaveViewProps = {
53
54
  preventClose?: boolean;
54
55
  className?: string;
55
56
  triggerClassName?: string;
57
+ /**
58
+ * Registered ids for reporting this dialog's own moments.
59
+ *
60
+ * Supply it and the component reports the dialog opening and closing, the
61
+ * submission the moment the request is dispatched, a submission its own
62
+ * validation blocked, and the outcome. Omit it and nothing is reported.
63
+ *
64
+ * The submit and the block are observable ONLY here: with `screenName` the
65
+ * component dispatches through its own store, so `onSave` never fires, and a
66
+ * blocked submission produces no callback at all.
67
+ */
68
+ analytics?: SavedViewAnalyticsInput;
56
69
  };
57
- export declare function TableSaveView({ open, defaultOpen, onOpenChange, onClose, trigger, triggerLabel, title, description, viewName, defaultViewName, onViewNameChange, viewNameLabel, viewNamePlaceholder, appliedLabel, appliedSettings, appliedSettingLabels, columns, visibleColumnIds, hiddenColumnCount, filtersCount, viewType, filters, priority, screenName, saveApi, cancelLabel, saveLabel, onCancel, onSave, onSaved, onError, loading, disabled, closeOnSave, closeOnOverlayClick, closeOnEscape, preventClose, className, triggerClassName }: TableSaveViewProps): import("react/jsx-runtime").JSX.Element;
70
+ export declare function TableSaveView({ open, defaultOpen, onOpenChange, onClose, trigger, triggerLabel, title, description, viewName, defaultViewName, onViewNameChange, viewNameLabel, viewNamePlaceholder, appliedLabel, appliedSettings, appliedSettingLabels, columns, visibleColumnIds, hiddenColumnCount, filtersCount, viewType, filters, priority, screenName, saveApi, cancelLabel, saveLabel, onCancel, onSave, onSaved, onError, loading, disabled, closeOnSave, closeOnOverlayClick, closeOnEscape, preventClose, className, triggerClassName, analytics }: TableSaveViewProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,13 @@
1
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import { Root as Vt, Trigger as kt, Portal as At, Overlay as zt, Content as Ct, Title as Ht, Description as Dt } from "../../../node_modules/@radix-ui/react-dialog/dist/index.js";
3
- import { useId as Wt, useState as y, useMemo as F, useEffect as It } from "react";
1
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
+ import { Root as Ct, Trigger as Dt, Portal as Rt, Overlay as zt, Content as Ht, Title as Ft, Description as Wt } from "../../../node_modules/@radix-ui/react-dialog/dist/index.js";
3
+ import { useId as It, useState as V, useMemo as B, useEffect as Bt, useRef as Lt } from "react";
4
4
  import r from "@emotion/styled";
5
- import { kfOverlayIn as Ft, kfModalContentIn as Rt, twTransform as Bt, twRing as Q } from "../../../lib/emotionTw.js";
6
- import { Button as R } from "../../primitives/Button/Button.js";
7
- import { isReservedViewName as X, createTableViewSelectorStore as Lt } from "./viewStore.js";
8
- import { BfrsPortalScope as Pt } from "../../ui/providers/BfrsProvider/BfrsProvider.js";
9
- const jt = /* @__PURE__ */ r(zt, {
5
+ import { kfOverlayIn as Pt, kfModalContentIn as jt, twTransform as Ot, twRing as Z } from "../../../lib/emotionTw.js";
6
+ import { Button as L } from "../../primitives/Button/Button.js";
7
+ import { useSavedViewAnalytics as Mt } from "./savedViewAnalytics.js";
8
+ import { isReservedViewName as N, createTableViewSelectorStore as Gt } from "./viewStore.js";
9
+ import { BfrsPortalScope as _t } from "../../ui/providers/BfrsProvider/BfrsProvider.js";
10
+ const $t = /* @__PURE__ */ r(zt, {
10
11
  label: "AgenticTableSaveView-overlay"
11
12
  })({
12
13
  position: "fixed",
@@ -16,9 +17,9 @@ const jt = /* @__PURE__ */ r(zt, {
16
17
  left: 0,
17
18
  zIndex: 50,
18
19
  backgroundColor: "hsl(var(--bfrs-color-text-primary) / .45)",
19
- ...Ft,
20
+ ...Pt,
20
21
  animation: "bfrs-bfrs-overlay-in var(--bfrs-motion-fast) var(--bfrs-ease-out)"
21
- }), Ot = /* @__PURE__ */ r(Ct, {
22
+ }), Et = /* @__PURE__ */ r(Ht, {
22
23
  label: "AgenticTableSaveView-content"
23
24
  })({
24
25
  position: "fixed",
@@ -28,7 +29,7 @@ const jt = /* @__PURE__ */ r(zt, {
28
29
  maxHeight: "calc(100dvh - 2rem)",
29
30
  width: "calc(100% - 2rem)",
30
31
  maxWidth: "420px",
31
- ...Bt({ "--tw-translate-x": "-50%", "--tw-translate-y": "-50%" }),
32
+ ...Ot({ "--tw-translate-x": "-50%", "--tw-translate-y": "-50%" }),
32
33
  overflow: "auto",
33
34
  borderRadius: "var(--bfrs-radius-lg)",
34
35
  borderWidth: "1px",
@@ -44,17 +45,17 @@ const jt = /* @__PURE__ */ r(zt, {
44
45
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)",
45
46
  outline: "2px solid transparent",
46
47
  outlineOffset: "2px",
47
- ...Rt,
48
+ ...jt,
48
49
  animation: "bfrs-bfrs-modal-content-in var(--bfrs-motion-normal) var(--bfrs-ease-out)",
49
50
  "@media (min-width:640px)": {
50
51
  padding: "1.25rem"
51
52
  }
52
- }), Gt = /* @__PURE__ */ r("form", {
53
+ }), Kt = /* @__PURE__ */ r("form", {
53
54
  label: "AgenticTableSaveView-form"
54
55
  })({
55
56
  display: "flex",
56
57
  flexDirection: "column"
57
- }), Mt = /* @__PURE__ */ r(Ht, {
58
+ }), Ut = /* @__PURE__ */ r(Ft, {
58
59
  label: "AgenticTableSaveView-title"
59
60
  })({
60
61
  fontSize: "1.125rem",
@@ -62,7 +63,7 @@ const jt = /* @__PURE__ */ r(zt, {
62
63
  lineHeight: "1.5rem",
63
64
  "--tw-text-opacity": "1",
64
65
  color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
65
- }), $t = /* @__PURE__ */ r(Dt, {
66
+ }), qt = /* @__PURE__ */ r(Wt, {
66
67
  label: "AgenticTableSaveView-description"
67
68
  })({
68
69
  marginTop: ".25rem",
@@ -70,11 +71,11 @@ const jt = /* @__PURE__ */ r(zt, {
70
71
  lineHeight: "1.25rem",
71
72
  "--tw-text-opacity": "1",
72
73
  color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
73
- }), Et = /* @__PURE__ */ r("div", {
74
+ }), Jt = /* @__PURE__ */ r("div", {
74
75
  label: "AgenticTableSaveView-field"
75
76
  })({
76
77
  marginTop: "1.25rem"
77
- }), Kt = /* @__PURE__ */ r("label", {
78
+ }), Qt = /* @__PURE__ */ r("label", {
78
79
  label: "AgenticTableSaveView-label"
79
80
  })({
80
81
  display: "block",
@@ -83,7 +84,7 @@ const jt = /* @__PURE__ */ r(zt, {
83
84
  lineHeight: "1.25rem",
84
85
  "--tw-text-opacity": "1",
85
86
  color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
86
- }), Ut = /* @__PURE__ */ r("input", {
87
+ }), Xt = /* @__PURE__ */ r("input", {
87
88
  label: "AgenticTableSaveView-input"
88
89
  })({
89
90
  marginTop: ".375rem",
@@ -116,11 +117,11 @@ const jt = /* @__PURE__ */ r(zt, {
116
117
  color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
117
118
  },
118
119
  "&:focus": {
119
- ...Q("2px", "hsl(var(--bfrs-color-primary-soft) / var(--tw-ring-opacity, 1))"),
120
+ ...Z("2px", "hsl(var(--bfrs-color-primary-soft) / var(--tw-ring-opacity, 1))"),
120
121
  "--tw-ring-opacity": "1"
121
122
  },
122
123
  "&:focus-visible": {
123
- ...Q("2px", "hsl(var(--bfrs-color-primary-soft) / var(--tw-ring-opacity, 1))"),
124
+ ...Z("2px", "hsl(var(--bfrs-color-primary-soft) / var(--tw-ring-opacity, 1))"),
124
125
  "--tw-ring-opacity": "1"
125
126
  },
126
127
  // Disabled while the save is in flight. The value stays text-primary, which is
@@ -146,7 +147,7 @@ const jt = /* @__PURE__ */ r(zt, {
146
147
  color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))",
147
148
  WebkitTextFillColor: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
148
149
  }
149
- }), Y = /* @__PURE__ */ r("p", {
150
+ }), tt = /* @__PURE__ */ r("p", {
150
151
  label: "AgenticTableSaveView-fieldError"
151
152
  })({
152
153
  marginTop: ".375rem",
@@ -154,11 +155,11 @@ const jt = /* @__PURE__ */ r(zt, {
154
155
  lineHeight: "1rem",
155
156
  "--tw-text-opacity": "1",
156
157
  color: "hsl(var(--bfrs-color-danger) / var(--tw-text-opacity, 1))"
157
- }), _t = /* @__PURE__ */ r("section", {
158
+ }), Yt = /* @__PURE__ */ r("section", {
158
159
  label: "AgenticTableSaveView-section"
159
160
  })({
160
161
  marginTop: "1.25rem"
161
- }), qt = /* @__PURE__ */ r("div", {
162
+ }), Zt = /* @__PURE__ */ r("div", {
162
163
  label: "AgenticTableSaveView-sectionTitle"
163
164
  })({
164
165
  fontSize: "11px",
@@ -167,14 +168,14 @@ const jt = /* @__PURE__ */ r(zt, {
167
168
  letterSpacing: ".12em",
168
169
  "--tw-text-opacity": "1",
169
170
  color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
170
- }), Jt = /* @__PURE__ */ r("div", {
171
+ }), Nt = /* @__PURE__ */ r("div", {
171
172
  label: "AgenticTableSaveView-chips"
172
173
  })({
173
174
  marginTop: ".5rem",
174
175
  display: "flex",
175
176
  flexWrap: "wrap",
176
177
  gap: ".5rem"
177
- }), Z = /* @__PURE__ */ r("span", {
178
+ }), et = /* @__PURE__ */ r("span", {
178
179
  label: "AgenticTableSaveView-chip",
179
180
  shouldForwardProp: (o) => o !== "ownerState"
180
181
  })(({ ownerState: o }) => [
@@ -200,7 +201,7 @@ const jt = /* @__PURE__ */ r(zt, {
200
201
  "--tw-text-opacity": "1",
201
202
  color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
202
203
  }
203
- ]), Nt = /* @__PURE__ */ r("div", {
204
+ ]), te = /* @__PURE__ */ r("div", {
204
205
  label: "AgenticTableSaveView-footer"
205
206
  })({
206
207
  marginTop: "1.5rem",
@@ -210,7 +211,7 @@ const jt = /* @__PURE__ */ r(zt, {
210
211
  "@media (min-width:640px)": {
211
212
  gridTemplateColumns: "repeat(2,minmax(0,1fr))"
212
213
  }
213
- }), Qt = /* @__PURE__ */ r(R, {
214
+ }), ee = /* @__PURE__ */ r(L, {
214
215
  label: "AgenticTableSaveView-cancelButton"
215
216
  })({
216
217
  "&&": {
@@ -235,7 +236,7 @@ const jt = /* @__PURE__ */ r(zt, {
235
236
  backgroundColor: "hsl(var(--bfrs-color-surface-muted) / var(--tw-bg-opacity, 1))"
236
237
  }
237
238
  }
238
- }), Xt = /* @__PURE__ */ r(R, {
239
+ }), re = /* @__PURE__ */ r(L, {
239
240
  label: "AgenticTableSaveView-submitButton"
240
241
  })({
241
242
  "&&": {
@@ -276,163 +277,182 @@ const jt = /* @__PURE__ */ r(zt, {
276
277
  color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
277
278
  }
278
279
  }
279
- }), Yt = (o) => !!o && typeof o.then == "function", Zt = (o, m) => {
280
- if (!o || !m) return 0;
281
- const d = new Set(m);
282
- return o.filter((p) => !d.has(p.id)).length;
280
+ }), oe = (o) => !!o && typeof o.then == "function", ie = (o, g) => {
281
+ if (!o || !g) return 0;
282
+ const b = new Set(g);
283
+ return o.filter((v) => !b.has(v.id)).length;
283
284
  };
284
- function se({
285
+ function me({
285
286
  open: o,
286
- defaultOpen: m,
287
- onOpenChange: d,
288
- onClose: p,
289
- trigger: B,
290
- triggerLabel: tt = "Save",
291
- title: et = "Save this view",
292
- description: L = "Give your custom view a name to save it for later",
293
- viewName: w,
294
- defaultViewName: x = "",
295
- onViewNameChange: S,
296
- viewNameLabel: rt = "View Name",
297
- viewNamePlaceholder: ot = "e.g. High Priority Orders",
298
- appliedLabel: T = "APPLIED FILTERS & SETTINGS",
299
- appliedSettings: it,
300
- appliedSettingLabels: at,
301
- columns: P,
302
- visibleColumnIds: j = [],
303
- hiddenColumnCount: lt,
304
- filtersCount: V = 0,
305
- viewType: ct,
306
- filters: nt,
307
- priority: st = 0,
308
- screenName: k,
309
- saveApi: b,
310
- cancelLabel: dt = "Cancel",
311
- saveLabel: pt = "Save view",
312
- onCancel: A,
313
- onSave: O,
314
- onSaved: n,
315
- onError: s,
316
- loading: bt,
317
- disabled: G,
318
- closeOnSave: M = !0,
319
- closeOnOverlayClick: ft = !0,
320
- closeOnEscape: vt = !0,
287
+ defaultOpen: g,
288
+ onOpenChange: b,
289
+ onClose: v,
290
+ trigger: P,
291
+ triggerLabel: rt = "Save",
292
+ title: ot = "Save this view",
293
+ description: j = "Give your custom view a name to save it for later",
294
+ viewName: y,
295
+ defaultViewName: k = "",
296
+ onViewNameChange: A,
297
+ viewNameLabel: it = "View Name",
298
+ viewNamePlaceholder: at = "e.g. High Priority Orders",
299
+ appliedLabel: C = "APPLIED FILTERS & SETTINGS",
300
+ appliedSettings: lt,
301
+ appliedSettingLabels: ct,
302
+ columns: O,
303
+ visibleColumnIds: M = [],
304
+ hiddenColumnCount: st,
305
+ filtersCount: D = 0,
306
+ viewType: nt,
307
+ filters: dt,
308
+ priority: pt = 0,
309
+ screenName: x,
310
+ saveApi: m,
311
+ cancelLabel: ft = "Cancel",
312
+ saveLabel: bt = "Save view",
313
+ onCancel: R,
314
+ onSave: G,
315
+ onSaved: d,
316
+ onError: p,
317
+ loading: vt,
318
+ disabled: _,
319
+ closeOnSave: $ = !0,
320
+ closeOnOverlayClick: mt = !0,
321
+ closeOnEscape: ut = !0,
321
322
  preventClose: z = !1,
322
- className: mt,
323
- triggerClassName: wt
323
+ className: wt,
324
+ triggerClassName: ht,
325
+ analytics: gt
324
326
  }) {
325
- const $ = Wt(), [ut, ht] = y(m ?? !1), [gt, E] = y(x), [yt, K] = y(!1), [U, f] = y(null), u = o ?? ut, v = w ?? gt, h = !!(bt || yt), C = lt ?? Zt(P, j), H = X(v), _ = G || h || v.trim().length === 0 || H, D = F(
326
- () => b ? { ...b, saveEndpoint: b.saveEndpoint ?? b.endpoint ?? "api/v1/saveview" } : void 0,
327
- [b]
328
- ), W = F(
329
- () => k ? Lt(k, D ? { saveApi: D } : void 0) : void 0,
330
- [D, k]
331
- ), xt = F(() => {
327
+ const E = It(), [yt, xt] = V(g ?? !1), [St, K] = V(k), [Tt, U] = V(!1), [q, u] = V(null), w = o ?? yt, h = y ?? St, S = !!(vt || Tt), H = st ?? ie(O, M), F = N(h), J = _ || S || h.trim().length === 0 || F, W = B(
328
+ () => m ? { ...m, saveEndpoint: m.saveEndpoint ?? m.endpoint ?? "api/v1/saveview" } : void 0,
329
+ [m]
330
+ ), I = B(
331
+ () => x ? Gt(x, W ? { saveApi: W } : void 0) : void 0,
332
+ [W, x]
333
+ ), Vt = B(() => {
332
334
  const t = [];
333
- return C > 0 && t.push(`Columns hidden (${C})`), V > 0 && t.push(`Filters applied (${V})`), t;
334
- }, [C, V]), q = at ?? xt;
335
- It(() => {
336
- u && w === void 0 && E(x), u && f(null);
337
- }, [u, x, w]);
338
- const g = (t) => {
339
- !t && z || (o === void 0 && ht(t), d == null || d(t), t || p == null || p());
340
- }, St = (t) => {
341
- w === void 0 && E(t), S == null || S(t), f(null);
342
- }, Tt = () => {
343
- A == null || A(), g(!1);
335
+ return H > 0 && t.push(`Columns hidden (${H})`), D > 0 && t.push(`Filters applied (${D})`), t;
336
+ }, [H, D]), Q = ct ?? Vt, l = Mt(gt, x);
337
+ Bt(() => {
338
+ w && y === void 0 && K(k), w && u(null);
339
+ }, [w, k, y]);
340
+ const n = Lt(null), T = (t) => {
341
+ if (!t && z) return;
342
+ const f = w;
343
+ o === void 0 && xt(t), b == null || b(t), t || v == null || v(), t && !f ? l.saveOpened() : !t && f && l.saveDismissed(n.current ?? "close_icon"), n.current = null;
344
+ }, kt = (t) => {
345
+ y === void 0 && K(t), A == null || A(t), u(null);
346
+ }, At = () => {
347
+ R == null || R(), n.current = "cancel", T(!1);
344
348
  };
345
- return /* @__PURE__ */ c(Vt, { open: u, onOpenChange: g, children: [
346
- B !== null && /* @__PURE__ */ e(kt, { asChild: !0, children: B ?? /* @__PURE__ */ e(R, { size: "sm", className: wt, children: tt }) }),
347
- /* @__PURE__ */ e(At, { children: /* @__PURE__ */ c(Pt, { children: [
348
- /* @__PURE__ */ e(jt, {}),
349
+ return /* @__PURE__ */ s(Ct, { open: w, onOpenChange: T, children: [
350
+ P !== null && /* @__PURE__ */ e(Dt, { asChild: !0, children: P ?? /* @__PURE__ */ e(L, { size: "sm", className: ht, children: rt }) }),
351
+ /* @__PURE__ */ e(Rt, { children: /* @__PURE__ */ s(_t, { children: [
352
+ /* @__PURE__ */ e($t, {}),
349
353
  /* @__PURE__ */ e(
350
- Ot,
354
+ Et,
351
355
  {
352
- className: mt,
356
+ className: wt,
353
357
  onPointerDownOutside: (t) => {
354
- (!ft || z) && t.preventDefault();
358
+ if (!mt || z) {
359
+ t.preventDefault();
360
+ return;
361
+ }
362
+ n.current = "outside";
355
363
  },
356
364
  onEscapeKeyDown: (t) => {
357
- (!vt || z) && t.preventDefault();
365
+ if (!ut || z) {
366
+ t.preventDefault();
367
+ return;
368
+ }
369
+ n.current = "esc";
358
370
  },
359
- children: /* @__PURE__ */ c(Gt, { onSubmit: (t) => {
371
+ children: /* @__PURE__ */ s(Kt, { onSubmit: (t) => {
360
372
  t.preventDefault();
361
- const I = v.trim();
362
- if (!I || _ || X(I)) return;
363
- const J = {
364
- view_type: ct ?? "orders",
365
- name: I,
366
- columns: (P ?? []).map((i, a) => ({
373
+ const f = h.trim();
374
+ if (!f || J || N(f)) return;
375
+ const X = {
376
+ view_type: nt ?? "orders",
377
+ name: f,
378
+ columns: (O ?? []).map((i, a) => ({
367
379
  key: i.id,
368
380
  order: a,
369
- visible: j.includes(i.id)
381
+ visible: M.includes(i.id)
370
382
  })),
371
- filters: nt ?? [],
372
- priority: st
383
+ filters: dt ?? [],
384
+ priority: pt
373
385
  };
374
- f(null);
375
- const N = (i) => !!(i.alreadyExists && i.message);
376
- let l;
386
+ u(null);
387
+ const Y = (i) => !!(i.alreadyExists && i.message);
388
+ l.saveSubmitted();
389
+ let c;
377
390
  try {
378
- l = O ? O(J) : W == null ? void 0 : W.save(J);
391
+ c = G ? G(X) : I == null ? void 0 : I.save(X);
379
392
  } catch (i) {
380
- s == null || s(i);
393
+ l.saveFailed(i), p == null || p(i);
381
394
  return;
382
395
  }
383
- if (Yt(l)) {
384
- K(!0);
396
+ if (oe(c)) {
397
+ U(!0);
385
398
  let i = !1;
386
- l.then((a) => {
387
- i = !0, a && typeof a == "object" && "view" in a && (N(a) ? (i = !1, f(a.message ?? null)) : n == null || n(a));
399
+ c.then((a) => {
400
+ if (i = !0, a && typeof a == "object" && "view" in a) {
401
+ if (Y(a)) {
402
+ i = !1, u(a.message ?? null), l.saveRejectedAsDuplicate();
403
+ return;
404
+ }
405
+ d == null || d(a);
406
+ }
407
+ l.saveCompleted();
388
408
  }).catch((a) => {
389
- s == null || s(a);
409
+ l.saveFailed(a), p == null || p(a);
390
410
  }).finally(() => {
391
- K(!1), M && i && g(!1);
411
+ U(!1), $ && i && (n.current = "completed", T(!1));
392
412
  });
393
413
  return;
394
414
  }
395
- if (typeof l == "object" && l !== null && "view" in l) {
396
- if (N(l)) {
397
- f(l.message ?? null);
415
+ if (typeof c == "object" && c !== null && "view" in c) {
416
+ if (Y(c)) {
417
+ u(c.message ?? null), l.saveRejectedAsDuplicate();
398
418
  return;
399
419
  }
400
- n == null || n(l);
420
+ d == null || d(c), l.saveCompleted();
401
421
  }
402
- M && g(!1);
422
+ $ && (n.current = "completed", T(!1));
403
423
  }, children: [
404
- /* @__PURE__ */ c("header", { children: [
405
- /* @__PURE__ */ e(Mt, { children: et }),
406
- L && /* @__PURE__ */ e($t, { children: L })
424
+ /* @__PURE__ */ s("header", { children: [
425
+ /* @__PURE__ */ e(Ut, { children: ot }),
426
+ j && /* @__PURE__ */ e(qt, { children: j })
407
427
  ] }),
408
- /* @__PURE__ */ c(Et, { children: [
409
- /* @__PURE__ */ e(Kt, { htmlFor: $, children: rt }),
428
+ /* @__PURE__ */ s(Jt, { children: [
429
+ /* @__PURE__ */ e(Qt, { htmlFor: E, children: it }),
410
430
  /* @__PURE__ */ e(
411
- Ut,
431
+ Xt,
412
432
  {
413
- id: $,
433
+ id: E,
414
434
  autoFocus: !0,
415
- value: v,
416
- placeholder: ot,
417
- disabled: G || h,
418
- onChange: (t) => St(t.target.value),
419
- "aria-invalid": H
435
+ value: h,
436
+ placeholder: at,
437
+ disabled: _ || S,
438
+ onChange: (t) => kt(t.target.value),
439
+ "aria-invalid": F
420
440
  }
421
441
  ),
422
- H ? /* @__PURE__ */ c(Y, { children: [
442
+ F ? /* @__PURE__ */ s(tt, { children: [
423
443
  "“",
424
- v.trim(),
444
+ h.trim(),
425
445
  "” is reserved. Choose a different name."
426
446
  ] }) : null,
427
- U ? /* @__PURE__ */ e(Y, { children: U }) : null
447
+ q ? /* @__PURE__ */ e(tt, { children: q }) : null
428
448
  ] }),
429
- /* @__PURE__ */ c(_t, { "aria-label": typeof T == "string" ? T : "Applied filters and settings", children: [
430
- /* @__PURE__ */ e(qt, { children: T }),
431
- /* @__PURE__ */ e(Jt, { children: it ?? (q.length > 0 ? q.map((t) => /* @__PURE__ */ e(Z, { ownerState: {}, children: t }, t)) : /* @__PURE__ */ e(Z, { ownerState: { muted: !0 }, children: "No changes applied" })) })
449
+ /* @__PURE__ */ s(Yt, { "aria-label": typeof C == "string" ? C : "Applied filters and settings", children: [
450
+ /* @__PURE__ */ e(Zt, { children: C }),
451
+ /* @__PURE__ */ e(Nt, { children: lt ?? (Q.length > 0 ? Q.map((t) => /* @__PURE__ */ e(et, { ownerState: {}, children: t }, t)) : /* @__PURE__ */ e(et, { ownerState: { muted: !0 }, children: "No changes applied" })) })
432
452
  ] }),
433
- /* @__PURE__ */ c(Nt, { children: [
434
- /* @__PURE__ */ e(Qt, { type: "button", variant: "secondary", disabled: h, onClick: Tt, children: dt }),
435
- /* @__PURE__ */ e(Xt, { type: "submit", loading: h, disabled: _, children: pt })
453
+ /* @__PURE__ */ s(te, { children: [
454
+ /* @__PURE__ */ e(ee, { type: "button", variant: "secondary", disabled: S, onClick: At, children: ft }),
455
+ /* @__PURE__ */ e(re, { type: "submit", loading: S, disabled: J, children: bt })
436
456
  ] })
437
457
  ] })
438
458
  }
@@ -441,6 +461,6 @@ function se({
441
461
  ] });
442
462
  }
443
463
  export {
444
- se as TableSaveView
464
+ me as TableSaveView
445
465
  };
446
466
  //# sourceMappingURL=TableSaveView.js.map