@bfrs/agentic-components 0.7.8 → 0.7.9

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.
@@ -1,44 +1,48 @@
1
- import { jsxs as s, jsx as r, Fragment as xe } from "react/jsx-runtime";
2
- import { Root as Se, Portal as Te, Overlay as Tt, Content as _t, Title as Rt, Description as Ct } from "../../../node_modules/@radix-ui/react-dialog/dist/index.js";
3
- import { Root as kt, Trigger as zt, Portal as At, Content as Vt } from "../../../node_modules/@radix-ui/react-popover/dist/index.js";
4
- import { BookmarkSimple as _e } from "../../../node_modules/@phosphor-icons/react/dist/csr/BookmarkSimple.es.js";
1
+ import { jsxs as s, jsx as r, Fragment as Te } from "react/jsx-runtime";
2
+ import { Root as _e, Portal as Re, Overlay as _t, Content as Rt, Title as Ct, Description as kt } from "../../../node_modules/@radix-ui/react-dialog/dist/index.js";
3
+ import { Root as At, Trigger as zt, Portal as Vt, Content as It } from "../../../node_modules/@radix-ui/react-popover/dist/index.js";
4
+ import { BookmarkSimple as Ce } from "../../../node_modules/@phosphor-icons/react/dist/csr/BookmarkSimple.es.js";
5
5
  import { CaretDown as Wt } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretDown.es.js";
6
- import { DotsThreeVertical as It } from "../../../node_modules/@phosphor-icons/react/dist/csr/DotsThreeVertical.es.js";
7
- import { PencilSimple as Ot } from "../../../node_modules/@phosphor-icons/react/dist/csr/PencilSimple.es.js";
6
+ import { DotsThreeVertical as Ot } from "../../../node_modules/@phosphor-icons/react/dist/csr/DotsThreeVertical.es.js";
7
+ import { Info as Bt } from "../../../node_modules/@phosphor-icons/react/dist/csr/Info.es.js";
8
+ import { PencilSimple as Ht } from "../../../node_modules/@phosphor-icons/react/dist/csr/PencilSimple.es.js";
8
9
  import { Star as le } from "../../../node_modules/@phosphor-icons/react/dist/csr/Star.es.js";
9
- import { Trash as Bt } from "../../../node_modules/@phosphor-icons/react/dist/csr/Trash.es.js";
10
- import { useRef as k, useMemo as ie, useState as m, useId as Ht, useEffect as E, useCallback as N } from "react";
10
+ import { Trash as Ft } from "../../../node_modules/@phosphor-icons/react/dist/csr/Trash.es.js";
11
+ import { useRef as k, useMemo as ie, useState as m, useId as Lt, useEffect as j, useCallback as N } from "react";
11
12
  import n from "@emotion/styled";
12
- import { IconButton as Lt, Button as j } from "../../primitives/Button/Button.js";
13
- import { twRing as M, twTransform as Oe, kfContentIn as Ft, kfOverlayIn as Dt, kfModalContentIn as Pt } from "../../../lib/emotionTw.js";
14
- import { floatingCollisionPadding as Et } from "../../ui/overlays/overlayPositioning.js";
15
- import { createTableViewSelectorStore as Nt, isReservedViewName as Re } from "./viewStore.js";
13
+ import { IconButton as Dt, Button as M } from "../../primitives/Button/Button.js";
14
+ import { twRing as $, twTransform as He, kfContentIn as Pt, kfOverlayIn as Et, kfModalContentIn as jt } from "../../../lib/emotionTw.js";
15
+ import { floatingCollisionPadding as Nt } from "../../ui/overlays/overlayPositioning.js";
16
+ import { createTableViewSelectorStore as Mt, isReservedViewName as ke } from "./viewStore.js";
16
17
  import { BfrsPortalScope as ae } from "../../ui/providers/BfrsProvider/BfrsProvider.js";
17
- import { ActionMenu as jt } from "../../navigation/ActionMenu/ActionMenu.js";
18
- const z = {
18
+ import { Tooltip as $t } from "../../ui/overlays/Tooltip/Tooltip.js";
19
+ import { ActionMenu as Kt } from "../../navigation/ActionMenu/ActionMenu.js";
20
+ const A = {
19
21
  "--tw-text-opacity": "1",
20
22
  color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
21
- }, Be = {
23
+ }, Fe = {
22
24
  "--tw-text-opacity": "1",
23
25
  color: "hsl(var(--bfrs-color-text-secondary) / var(--tw-text-opacity, 1))"
24
- }, B = {
26
+ }, z = {
25
27
  "--tw-text-opacity": "1",
26
28
  color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
27
29
  }, se = {
28
30
  "--tw-bg-opacity": "1",
29
31
  backgroundColor: "hsl(var(--bfrs-color-surface-card) / var(--tw-bg-opacity, 1))"
30
- }, He = {
32
+ }, Le = {
31
33
  "--tw-bg-opacity": "1",
32
34
  backgroundColor: "hsl(var(--bfrs-color-primary-soft) / var(--tw-bg-opacity, 1))"
35
+ }, qt = {
36
+ backgroundColor: "#F6F9F6"
33
37
  }, ce = {
34
38
  "--tw-border-opacity": "1",
35
39
  borderColor: "hsl(var(--bfrs-color-border) / var(--tw-border-opacity, 1))"
36
- }, Mt = /* @__PURE__ */ n("div", {
40
+ }, Ut = /* @__PURE__ */ n("div", {
37
41
  label: "AgenticTableViewSelector-root"
38
42
  })({
39
43
  display: "inline-flex",
40
44
  minWidth: "0px"
41
- }), Kt = /* @__PURE__ */ n("button", {
45
+ }), Yt = /* @__PURE__ */ n("button", {
42
46
  label: "AgenticTableViewSelector-trigger",
43
47
  shouldForwardProp: (o) => o !== "ownerState"
44
48
  })(({ ownerState: o }) => [
@@ -51,20 +55,20 @@ const z = {
51
55
  gap: ".5rem",
52
56
  borderRadius: "7px",
53
57
  borderWidth: "1px",
54
- ...se,
58
+ ...qt,
55
59
  paddingLeft: ".75rem",
56
60
  paddingRight: ".75rem",
57
61
  fontSize: "12px",
58
62
  lineHeight: "normal",
59
63
  fontWeight: 400,
60
- ...z,
64
+ ...A,
61
65
  outline: "2px solid transparent",
62
66
  outlineOffset: "2px",
63
67
  transitionProperty: "color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter",
64
68
  transitionTimingFunction: "cubic-bezier(0,0,.2,1)",
65
69
  transitionDuration: ".15s",
66
- "&:hover": He,
67
- "&:focus-visible": M("2px", "hsl(var(--bfrs-color-border-focus) / .25)"),
70
+ "&:hover": Le,
71
+ "&:focus-visible": $("2px", "hsl(var(--bfrs-color-border-focus) / .25)"),
68
72
  "&:disabled": {
69
73
  pointerEvents: "none",
70
74
  opacity: ".55"
@@ -75,12 +79,15 @@ const z = {
75
79
  // open — matches the data-filled convention every other Select-like
76
80
  // trigger in the library already follows (Select, MultiSelect,
77
81
  // SearchableSelect, DateRangePicker, TagInput, Input).
78
- o.open || o.filled ? {
82
+ // "Default" is a real selection, not an empty trigger, so it carries the same
83
+ // emphasized border as a named view. border-focus is the ink colour (#29343D
84
+ // in light) and flips light in dark mode — a literal black would not.
85
+ o.open || o.filled || o.defaultSelected ? {
79
86
  "--tw-border-opacity": "1",
80
87
  borderColor: "hsl(var(--bfrs-color-border-focus) / var(--tw-border-opacity, 1))"
81
88
  } : ce,
82
- o.empty && B
83
- ]), $t = /* @__PURE__ */ n("span", {
89
+ o.empty && z
90
+ ]), Gt = /* @__PURE__ */ n("span", {
84
91
  label: "AgenticTableViewSelector-triggerLabel"
85
92
  })({
86
93
  minWidth: "0px",
@@ -88,25 +95,25 @@ const z = {
88
95
  overflow: "hidden",
89
96
  textOverflow: "ellipsis",
90
97
  whiteSpace: "nowrap"
91
- }), Ce = /* @__PURE__ */ n(le, {
98
+ }), Ae = /* @__PURE__ */ n(le, {
92
99
  label: "AgenticTableViewSelector-primaryStar"
93
100
  })({
94
101
  flexShrink: 0,
95
102
  "--tw-text-opacity": "1",
96
103
  color: "hsl(var(--bfrs-color-warning) / var(--tw-text-opacity, 1))"
97
- }), qt = /* @__PURE__ */ n(Wt, {
104
+ }), Jt = /* @__PURE__ */ n(Wt, {
98
105
  label: "AgenticTableViewSelector-caret",
99
106
  shouldForwardProp: (o) => o !== "ownerState"
100
107
  })(({ ownerState: o }) => [
101
108
  {
102
109
  flexShrink: 0,
103
- ...B,
110
+ ...z,
104
111
  transitionProperty: "transform",
105
112
  transitionTimingFunction: "cubic-bezier(.4,0,.2,1)",
106
113
  transitionDuration: ".15s"
107
114
  },
108
- o.open && Oe({ "--tw-rotate": "180deg" })
109
- ]), Ut = /* @__PURE__ */ n(Vt, {
115
+ o.open && He({ "--tw-rotate": "180deg" })
116
+ ]), Qt = /* @__PURE__ */ n(It, {
110
117
  label: "AgenticTableViewSelector-content"
111
118
  })({
112
119
  zIndex: 1e3,
@@ -115,17 +122,20 @@ const z = {
115
122
  borderRadius: "var(--bfrs-radius-lg)",
116
123
  borderWidth: "1px",
117
124
  ...ce,
118
- backgroundColor: "#F6F9F6",
125
+ ...se,
119
126
  "--tw-shadow": "var(--bfrs-shadow-elevated)",
120
127
  "--tw-shadow-colored": "var(--bfrs-shadow-elevated)",
121
128
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)",
122
129
  outline: "2px solid transparent",
123
130
  outlineOffset: "2px",
124
- ...Ft,
131
+ ...Pt,
125
132
  animation: "bfrs-bfrs-content-in var(--bfrs-motion-normal) var(--bfrs-ease-out)"
126
- }), Yt = /* @__PURE__ */ n("div", {
133
+ }), Xt = /* @__PURE__ */ n("div", {
127
134
  label: "AgenticTableViewSelector-header"
128
135
  })({
136
+ display: "flex",
137
+ alignItems: "center",
138
+ gap: ".3125rem",
129
139
  paddingLeft: ".75rem",
130
140
  paddingRight: "1rem",
131
141
  paddingTop: ".625rem",
@@ -135,8 +145,27 @@ const z = {
135
145
  fontWeight: 700,
136
146
  letterSpacing: ".08em",
137
147
  textTransform: "uppercase",
138
- ...B
139
- }), Gt = /* @__PURE__ */ n("div", {
148
+ ...z
149
+ }), Zt = /* @__PURE__ */ n("span", {
150
+ label: "AgenticTableViewSelector-headerInfo"
151
+ })({
152
+ display: "inline-flex",
153
+ width: "1rem",
154
+ height: "1rem",
155
+ flexShrink: 0,
156
+ alignItems: "center",
157
+ justifyContent: "center",
158
+ borderRadius: "var(--bfrs-radius-pill)",
159
+ // The header text is uppercase + letter-spaced; the icon must not inherit
160
+ // either or it renders offset from the cap height.
161
+ letterSpacing: "normal",
162
+ cursor: "default",
163
+ ...z,
164
+ "&:hover": {
165
+ "--tw-text-opacity": "1",
166
+ color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
167
+ }
168
+ }), er = /* @__PURE__ */ n("div", {
140
169
  label: "AgenticTableViewSelector-list"
141
170
  })({
142
171
  display: "flex",
@@ -144,7 +173,7 @@ const z = {
144
173
  flexDirection: "column",
145
174
  overflowY: "auto",
146
175
  paddingBottom: ".25rem"
147
- }), Jt = /* @__PURE__ */ n("div", {
176
+ }), tr = /* @__PURE__ */ n("div", {
148
177
  label: "AgenticTableViewSelector-row"
149
178
  })({
150
179
  display: "flex",
@@ -153,7 +182,7 @@ const z = {
153
182
  gap: ".375rem",
154
183
  paddingLeft: ".5rem",
155
184
  paddingRight: ".625rem"
156
- }), Qt = /* @__PURE__ */ n("button", {
185
+ }), rr = /* @__PURE__ */ n("button", {
157
186
  label: "AgenticTableViewSelector-viewButton",
158
187
  shouldForwardProp: (o) => o !== "ownerState"
159
188
  })(({ ownerState: o }) => [
@@ -173,16 +202,16 @@ const z = {
173
202
  fontSize: "12px",
174
203
  lineHeight: "1rem",
175
204
  fontWeight: 500,
176
- ...z,
205
+ ...A,
177
206
  outline: "2px solid transparent",
178
207
  outlineOffset: "2px",
179
- "&:hover": Be,
180
- "&:focus-visible": M("2px", "hsl(var(--bfrs-color-border-focus) / .25)")
208
+ "&:hover": Fe,
209
+ "&:focus-visible": $("2px", "hsl(var(--bfrs-color-border-focus) / .25)")
181
210
  },
182
211
  o.selected && {
183
212
  fontWeight: 700
184
213
  }
185
- ]), Xt = /* @__PURE__ */ n("span", {
214
+ ]), or = /* @__PURE__ */ n("span", {
186
215
  label: "AgenticTableViewSelector-name"
187
216
  })({
188
217
  minWidth: "0px",
@@ -190,13 +219,13 @@ const z = {
190
219
  overflow: "hidden",
191
220
  textOverflow: "ellipsis",
192
221
  whiteSpace: "nowrap"
193
- }), Zt = /* @__PURE__ */ n("div", {
222
+ }), nr = /* @__PURE__ */ n("div", {
194
223
  label: "AgenticTableViewSelector-divider"
195
224
  })({
196
225
  height: "1px",
197
226
  "--tw-bg-opacity": "1",
198
227
  backgroundColor: "hsl(var(--bfrs-color-border-light) / var(--tw-bg-opacity, 1))"
199
- }), er = /* @__PURE__ */ n("button", {
228
+ }), ir = /* @__PURE__ */ n("button", {
200
229
  label: "AgenticTableViewSelector-resetButton"
201
230
  })({
202
231
  display: "flex",
@@ -209,12 +238,12 @@ const z = {
209
238
  fontSize: ".75rem",
210
239
  lineHeight: "1rem",
211
240
  fontWeight: 500,
212
- ...Be,
241
+ ...Fe,
213
242
  outline: "2px solid transparent",
214
243
  outlineOffset: "2px",
215
- "&:hover": He,
216
- "&:focus-visible": M("2px", "hsl(var(--bfrs-color-border-focus) / .25)")
217
- }), ke = /* @__PURE__ */ n("div", {
244
+ "&:hover": Le,
245
+ "&:focus-visible": $("2px", "hsl(var(--bfrs-color-border-focus) / .25)")
246
+ }), ze = /* @__PURE__ */ n("div", {
218
247
  label: "AgenticTableViewSelector-empty"
219
248
  })({
220
249
  paddingLeft: ".75rem",
@@ -223,17 +252,17 @@ const z = {
223
252
  paddingBottom: ".75rem",
224
253
  fontSize: ".75rem",
225
254
  lineHeight: "1rem",
226
- ...B
227
- }), ze = /* @__PURE__ */ n(Tt, {
255
+ ...z
256
+ }), Ve = /* @__PURE__ */ n(_t, {
228
257
  label: "AgenticTableViewSelector-renameOverlay"
229
258
  })({
230
259
  position: "fixed",
231
260
  inset: 0,
232
261
  zIndex: 1050,
233
262
  backgroundColor: "hsl(var(--bfrs-color-text-primary) / .45)",
234
- ...Dt,
263
+ ...Et,
235
264
  animation: "bfrs-bfrs-overlay-in var(--bfrs-motion-fast) var(--bfrs-ease-out)"
236
- }), Ae = /* @__PURE__ */ n(_t, {
265
+ }), Ie = /* @__PURE__ */ n(Rt, {
237
266
  label: "AgenticTableViewSelector-renameContent"
238
267
  })({
239
268
  position: "fixed",
@@ -249,30 +278,30 @@ const z = {
249
278
  ...ce,
250
279
  ...se,
251
280
  padding: "1.25rem",
252
- ...z,
281
+ ...A,
253
282
  "--tw-shadow": "var(--bfrs-shadow-overlay)",
254
283
  "--tw-shadow-colored": "var(--bfrs-shadow-overlay)",
255
284
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)",
256
285
  outline: "2px solid transparent",
257
286
  outlineOffset: "2px",
258
- ...Oe({ "--tw-translate-x": "-50%", "--tw-translate-y": "-50%" }),
259
- ...Pt,
287
+ ...He({ "--tw-translate-x": "-50%", "--tw-translate-y": "-50%" }),
288
+ ...jt,
260
289
  animation: "bfrs-bfrs-modal-content-in var(--bfrs-motion-normal) var(--bfrs-ease-out)"
261
- }), Ve = /* @__PURE__ */ n(Rt, {
290
+ }), We = /* @__PURE__ */ n(Ct, {
262
291
  label: "AgenticTableViewSelector-renameTitle"
263
292
  })({
264
293
  fontSize: "1.125rem",
265
294
  lineHeight: "1.5rem",
266
295
  fontWeight: 700,
267
- ...z
268
- }), We = /* @__PURE__ */ n(Ct, {
296
+ ...A
297
+ }), Oe = /* @__PURE__ */ n(kt, {
269
298
  label: "AgenticTableViewSelector-renameDescription"
270
299
  })({
271
300
  marginTop: ".25rem",
272
301
  fontSize: ".75rem",
273
302
  lineHeight: "1.25rem",
274
- ...B
275
- }), tr = /* @__PURE__ */ n("label", {
303
+ ...z
304
+ }), ar = /* @__PURE__ */ n("label", {
276
305
  label: "AgenticTableViewSelector-renameLabel"
277
306
  })({
278
307
  display: "block",
@@ -280,8 +309,8 @@ const z = {
280
309
  fontSize: ".75rem",
281
310
  lineHeight: "1rem",
282
311
  fontWeight: 700,
283
- ...z
284
- }), rr = /* @__PURE__ */ n("input", {
312
+ ...A
313
+ }), lr = /* @__PURE__ */ n("input", {
285
314
  label: "AgenticTableViewSelector-renameInput"
286
315
  })({
287
316
  marginTop: ".5rem",
@@ -297,18 +326,18 @@ const z = {
297
326
  fontSize: ".875rem",
298
327
  lineHeight: "1.25rem",
299
328
  fontWeight: 500,
300
- ...z,
329
+ ...A,
301
330
  outline: "2px solid transparent",
302
331
  outlineOffset: "2px",
303
- "&:focus-visible": M("2px", "hsl(var(--bfrs-color-border-focus) / .25)")
304
- }), Ie = /* @__PURE__ */ n("div", {
332
+ "&:focus-visible": $("2px", "hsl(var(--bfrs-color-border-focus) / .25)")
333
+ }), Be = /* @__PURE__ */ n("div", {
305
334
  label: "AgenticTableViewSelector-renameFooter"
306
335
  })({
307
336
  marginTop: "1.5rem",
308
337
  display: "flex",
309
338
  justifyContent: "flex-end",
310
339
  gap: ".625rem"
311
- }), or = /* @__PURE__ */ n(j, {
340
+ }), sr = /* @__PURE__ */ n(M, {
312
341
  label: "AgenticTableViewSelector-renameSubmitButton"
313
342
  })({
314
343
  "&&:disabled": {
@@ -319,7 +348,7 @@ const z = {
319
348
  "--tw-text-opacity": "1",
320
349
  color: "hsl(var(--bfrs-color-text-muted) / var(--tw-text-opacity, 1))"
321
350
  }
322
- }), nr = /* @__PURE__ */ n("p", {
351
+ }), cr = /* @__PURE__ */ n("p", {
323
352
  label: "AgenticTableViewSelector-renameFieldError"
324
353
  })({
325
354
  marginTop: ".375rem",
@@ -328,14 +357,14 @@ const z = {
328
357
  "--tw-text-opacity": "1",
329
358
  color: "hsl(var(--bfrs-color-danger) / var(--tw-text-opacity, 1))"
330
359
  });
331
- function O(o, i) {
360
+ function B(o, i) {
332
361
  return i ? o.find((t) => t.view_id === i) ?? null : null;
333
362
  }
334
- function ir(o, i, t) {
363
+ function dr(o, i, t) {
335
364
  var p;
336
365
  const w = [], y = /* @__PURE__ */ new Set(), x = i ?? ((p = o.find((c) => c.is_default)) == null ? void 0 : p.view_id) ?? null, f = (c) => {
337
366
  if (!c || y.has(c)) return;
338
- const b = O(o, c);
367
+ const b = B(o, c);
339
368
  b && (w.push(b), y.add(b.view_id));
340
369
  };
341
370
  f(x), f(t);
@@ -343,14 +372,14 @@ function ir(o, i, t) {
343
372
  y.has(c.view_id) || (w.push(c), y.add(c.view_id));
344
373
  return w;
345
374
  }
346
- function ar(o) {
375
+ function ur(o) {
347
376
  return o ? [
348
377
  "api",
349
378
  o.viewType && o.tab ? "scoped" : "local",
350
379
  o.saveEndpoint || o.endpoint ? "remote-save" : "local-save"
351
380
  ].join(":") : "none";
352
381
  }
353
- function lr(o) {
382
+ function mr(o) {
354
383
  const i = () => o.current;
355
384
  return {
356
385
  get baseUrl() {
@@ -403,7 +432,7 @@ function lr(o) {
403
432
  }
404
433
  };
405
434
  }
406
- function Rr({
435
+ function Wr({
407
436
  screenName: o,
408
437
  store: i,
409
438
  saveApi: t,
@@ -415,49 +444,50 @@ function Rr({
415
444
  onPrimaryViewChange: c,
416
445
  onUnsetPrimaryView: b,
417
446
  onRenameView: K,
418
- onDeleteView: $,
419
- onResetSavedFilters: q,
447
+ onDeleteView: q,
448
+ onResetSavedFilters: U,
420
449
  onError: H,
421
- triggerLabel: Le,
422
- placeholder: Fe = "Views",
423
- viewsLabel: De = "VIEWS",
424
- emptyLabel: Pe = "No saved views",
425
- loadingLabel: Ee = "Loading views",
426
- defaultViewLabel: Ne = "Default",
427
- setPrimaryLabel: je = "Set as Primary View",
428
- unsetPrimaryLabel: Me = "Unset as Primary",
429
- renameLabel: Ke = "Rename",
430
- deleteLabel: $e = "Delete",
431
- renameTitle: qe = "Rename view",
432
- renameDescription: de = "Update the saved view name.",
433
- renameInputLabel: Ue = "View name",
434
- renameCancelLabel: Ye = "Cancel",
435
- renameSaveLabel: Ge = "Save",
436
- deleteTitle: Je = "Delete view",
437
- deleteDescription: Qe,
438
- deleteCancelLabel: Xe = "Cancel",
439
- deleteConfirmLabel: Ze = "Delete",
440
- size: et = "sm",
441
- disabled: tt = !1,
442
- className: rt,
443
- triggerClassName: ot,
444
- contentClassName: nt,
445
- actionMenuClassName: it
450
+ triggerLabel: De,
451
+ placeholder: Pe = "Views",
452
+ viewsLabel: Ee = "VIEWS",
453
+ primaryHintLabel: de = "Set a view as primary to load it automatically. With no primary view, the table opens in its default state.",
454
+ emptyLabel: je = "No saved views",
455
+ loadingLabel: Ne = "Loading views",
456
+ defaultViewLabel: Me = "Default",
457
+ setPrimaryLabel: $e = "Set as Primary View",
458
+ unsetPrimaryLabel: Ke = "Unset as Primary",
459
+ renameLabel: qe = "Rename",
460
+ deleteLabel: Ue = "Delete",
461
+ renameTitle: Ye = "Rename view",
462
+ renameDescription: ue = "Update the saved view name.",
463
+ renameInputLabel: Ge = "View name",
464
+ renameCancelLabel: Je = "Cancel",
465
+ renameSaveLabel: Qe = "Save",
466
+ deleteTitle: Xe = "Delete view",
467
+ deleteDescription: Ze,
468
+ deleteCancelLabel: et = "Cancel",
469
+ deleteConfirmLabel: tt = "Delete",
470
+ size: rt = "sm",
471
+ disabled: ot = !1,
472
+ className: nt,
473
+ triggerClassName: it,
474
+ contentClassName: at,
475
+ actionMenuClassName: lt
446
476
  }) {
447
- const ue = k(t);
448
- ue.current = t;
449
- const me = ar(t), U = ie(
450
- () => me === "none" ? void 0 : lr(ue),
451
- [me]
477
+ const me = k(t);
478
+ me.current = t;
479
+ const fe = ur(t), Y = ie(
480
+ () => fe === "none" ? void 0 : mr(me),
481
+ [fe]
452
482
  ), u = ie(
453
- () => i ?? Nt(o, U ? { saveApi: U } : void 0),
454
- [o, i, U]
455
- ), L = w !== void 0, [Y, G] = m(!1), [A, at] = m([]), [J, lt] = m(null), [st, fe] = m(y ?? null), [pe, be] = m(!1), [F, he] = m(null), [V, Q] = m(""), [h, ge] = m(null), W = w ?? st, I = k(W), D = k(L), X = k(!1), g = k(!1), S = k(null), ve = Ht();
456
- E(() => {
457
- I.current = W, W && (g.current = !1);
458
- }, [W]), E(() => {
459
- D.current = L;
460
- }, [L]), E(() => {
483
+ () => i ?? Mt(o, Y ? { saveApi: Y } : void 0),
484
+ [o, i, Y]
485
+ ), F = w !== void 0, [G, J] = m(!1), [V, st] = m([]), [L, ct] = m(null), [dt, pe] = m(y ?? null), [be, he] = m(!1), [D, ge] = m(null), [I, Q] = m(""), [h, ve] = m(null), W = w ?? dt, O = k(W), P = k(F), X = k(!1), g = k(!1), S = k(null), we = Lt();
486
+ j(() => {
487
+ O.current = W, W && (g.current = !1);
488
+ }, [W]), j(() => {
489
+ P.current = F;
490
+ }, [F]), j(() => {
461
491
  S.current = null, X.current = !1, g.current = !1;
462
492
  }, [u, o]);
463
493
  const T = N(
@@ -467,7 +497,7 @@ function Rr({
467
497
  [H]
468
498
  ), v = N(
469
499
  (e) => {
470
- e && (g.current = !1), D.current || fe((e == null ? void 0 : e.view_id) ?? null), f == null || f((e == null ? void 0 : e.view_id) ?? null, e), e && (p == null || p(e));
500
+ e && (g.current = !1), P.current || pe((e == null ? void 0 : e.view_id) ?? null), f == null || f((e == null ? void 0 : e.view_id) ?? null, e), e && (p == null || p(e));
471
501
  },
472
502
  [f, p]
473
503
  ), Z = N(
@@ -477,142 +507,145 @@ function Rr({
477
507
  [v]
478
508
  ), _ = N(
479
509
  async (e) => {
480
- var we;
510
+ var xe;
481
511
  const l = e === void 0 ? "__default__" : e ?? "__none__";
482
- if (((we = S.current) == null ? void 0 : we.key) === l) return S.current.promise;
512
+ if (((xe = S.current) == null ? void 0 : xe.key) === l) return S.current.promise;
483
513
  const d = { key: l, promise: Promise.resolve(null) };
484
514
  return S.current = d, d.promise = (async () => {
485
- be(!0);
515
+ he(!0);
486
516
  try {
487
- const R = await u.list(), C = R.find((St) => St.is_default) ?? null, yt = e !== void 0 ? e : I.current, ye = O(R, yt), xt = !g.current && (e !== void 0 || x || !D.current), ne = ye || !xt ? null : O(R, C == null ? void 0 : C.view_id), P = ye ?? ne ?? null;
488
- return at(R), lt((C == null ? void 0 : C.view_id) ?? null), D.current || fe((P == null ? void 0 : P.view_id) ?? null), x && ne && e === void 0 && !I.current && !X.current && (X.current = !0, Z(ne)), P;
517
+ const R = await u.list(), C = R.find((Tt) => Tt.is_default) ?? null, xt = e !== void 0 ? e : O.current, Se = B(R, xt), St = !g.current && (e !== void 0 || x || !P.current), ne = Se || !St ? null : B(R, C == null ? void 0 : C.view_id), E = Se ?? ne ?? null;
518
+ return st(R), ct((C == null ? void 0 : C.view_id) ?? null), P.current || pe((E == null ? void 0 : E.view_id) ?? null), x && ne && e === void 0 && !O.current && !X.current && (X.current = !0, Z(ne)), E;
489
519
  } catch (R) {
490
520
  return T(R), null;
491
521
  } finally {
492
- be(!1), S.current === d && (S.current = null);
522
+ he(!1), S.current === d && (S.current = null);
493
523
  }
494
524
  })(), d.promise;
495
525
  },
496
526
  [Z, T, u, x, v]
497
527
  );
498
- E(() => {
528
+ j(() => {
499
529
  const e = () => {
500
530
  _();
501
531
  };
502
532
  return e(), u.subscribe(e);
503
533
  }, [_, u]);
504
- const a = O(A, W) ?? (!g.current && (x || !L) ? O(A, J) : null), ct = ie(
505
- () => ir(A, J, a == null ? void 0 : a.view_id),
506
- [J, a == null ? void 0 : a.view_id, A]
507
- ), dt = !a && g.current, ut = Le ?? (a == null ? void 0 : a.name) ?? (dt ? Ne : Fe), ee = A.length > 0, mt = (e) => {
508
- G(!1), Z(e);
509
- }, ft = (e) => {
534
+ const a = B(V, W) ?? (!g.current && (x || !F) ? B(V, L) : null), ut = ie(
535
+ () => dr(V, L, a == null ? void 0 : a.view_id),
536
+ [L, a == null ? void 0 : a.view_id, V]
537
+ ), ye = !a && (g.current || !L), mt = De ?? (a == null ? void 0 : a.name) ?? (ye ? Me : Pe), ee = V.length > 0, ft = (e) => {
538
+ J(!1), Z(e);
539
+ }, pt = (e) => {
510
540
  u.setPrimary(e.view_id).then(async (l) => {
511
541
  const d = await _(e.view_id);
512
542
  v(d ?? l), c == null || c(l);
513
543
  }).catch(T);
514
- }, pt = (e) => {
544
+ }, bt = (e) => {
515
545
  u.unsetPrimary(e.view_id).then(async (l) => {
516
546
  const d = await _(e.view_id);
517
547
  v(d ?? l), b == null || b(l);
518
548
  }).catch(T);
519
- }, te = () => ge(null), bt = (e) => {
520
- const l = I.current === e.view_id;
549
+ }, te = () => ve(null), ht = (e) => {
550
+ const l = O.current === e.view_id;
521
551
  u.remove(e.view_id).then(async () => {
522
- const d = await _(l ? null : I.current);
523
- l && v(d), $ == null || $(e.view_id);
552
+ const d = await _(l ? null : O.current);
553
+ l && v(d), q == null || q(e.view_id);
524
554
  }).catch(T).finally(te);
525
- }, ht = () => {
526
- h && bt(h);
527
555
  }, gt = () => {
528
- g.current = !0, v(null), q == null || q(), G(!1);
529
- }, vt = (e) => {
530
- he(e), Q(e.name);
531
- }, re = () => {
532
- he(null), Q("");
556
+ h && ht(h);
557
+ }, vt = () => {
558
+ g.current = !0, v(null), U == null || U(), J(!1);
533
559
  }, wt = (e) => {
560
+ ge(e), Q(e.name);
561
+ }, re = () => {
562
+ ge(null), Q("");
563
+ }, yt = (e) => {
534
564
  e.preventDefault();
535
- const l = V.trim();
536
- !F || !l || Re(l) || u.rename(F.view_id, l).then(async (d) => {
537
- await _(F.view_id), K == null || K(d), re();
565
+ const l = I.trim();
566
+ !D || !l || ke(l) || u.rename(D.view_id, l).then(async (d) => {
567
+ await _(D.view_id), K == null || K(d), re();
538
568
  }).catch(T);
539
- }, oe = Re(V);
540
- return ee ? /* @__PURE__ */ s(Mt, { className: rt, children: [
541
- /* @__PURE__ */ s(kt, { open: Y, onOpenChange: G, children: [
569
+ }, oe = ke(I);
570
+ return ee ? /* @__PURE__ */ s(Ut, { className: nt, children: [
571
+ /* @__PURE__ */ s(At, { open: G, onOpenChange: J, children: [
542
572
  /* @__PURE__ */ r(zt, { asChild: !0, children: /* @__PURE__ */ s(
543
- Kt,
573
+ Yt,
544
574
  {
545
575
  type: "button",
546
576
  "aria-label": "Saved views",
547
- className: ot,
548
- disabled: tt,
577
+ className: it,
578
+ disabled: ot,
549
579
  "data-filled": a ? "" : void 0,
550
- ownerState: { open: Y, empty: !a, filled: !!a, size: et },
580
+ ownerState: { open: G, empty: !a, filled: !!a, defaultSelected: ye, size: rt },
551
581
  children: [
552
- /* @__PURE__ */ r(_e, { size: 13 }),
553
- /* @__PURE__ */ r($t, { children: ut }),
554
- a != null && a.is_default ? /* @__PURE__ */ r(Ce, { size: 13, "aria-hidden": "true", "data-primary-view-indicator": "outline" }) : null,
555
- /* @__PURE__ */ r(qt, { size: 13, ownerState: { open: Y } })
582
+ /* @__PURE__ */ r(Ce, { size: 13 }),
583
+ /* @__PURE__ */ r(Gt, { children: mt }),
584
+ a != null && a.is_default ? /* @__PURE__ */ r(Ae, { size: 13, "aria-hidden": "true", "data-primary-view-indicator": "outline" }) : null,
585
+ /* @__PURE__ */ r(Jt, { size: 13, ownerState: { open: G } })
556
586
  ]
557
587
  }
558
588
  ) }),
559
- /* @__PURE__ */ r(At, { children: /* @__PURE__ */ r(ae, { children: /* @__PURE__ */ s(
560
- Ut,
589
+ /* @__PURE__ */ r(Vt, { children: /* @__PURE__ */ r(ae, { children: /* @__PURE__ */ s(
590
+ Qt,
561
591
  {
562
592
  align: "start",
563
593
  sideOffset: 8,
564
- collisionPadding: Et,
565
- className: nt,
594
+ collisionPadding: Nt,
595
+ className: at,
566
596
  children: [
567
- /* @__PURE__ */ r(Yt, { children: De }),
568
- /* @__PURE__ */ s(Gt, { children: [
569
- pe && !ee ? /* @__PURE__ */ r(ke, { children: Ee }) : null,
570
- !pe && !ee ? /* @__PURE__ */ r(ke, { children: Pe }) : null,
571
- ct.map((e) => {
597
+ /* @__PURE__ */ s(Xt, { children: [
598
+ Ee,
599
+ de ? /* @__PURE__ */ r($t, { content: de, side: "right", variant: "white", children: /* @__PURE__ */ r(Zt, { role: "img", "aria-label": "About primary views", children: /* @__PURE__ */ r(Bt, { size: 13, weight: "fill", "aria-hidden": "true" }) }) }) : null
600
+ ] }),
601
+ /* @__PURE__ */ s(er, { children: [
602
+ be && !ee ? /* @__PURE__ */ r(ze, { children: Ne }) : null,
603
+ !be && !ee ? /* @__PURE__ */ r(ze, { children: je }) : null,
604
+ ut.map((e) => {
572
605
  const l = (a == null ? void 0 : a.view_id) === e.view_id;
573
- return /* @__PURE__ */ s(Jt, { children: [
574
- /* @__PURE__ */ s(Qt, { type: "button", ownerState: { selected: l }, onClick: () => mt(e), children: [
575
- /* @__PURE__ */ r(Xt, { children: e.name }),
576
- e.is_default ? /* @__PURE__ */ r(Ce, { size: 13, "aria-hidden": "true", "data-primary-view-indicator": "outline" }) : null
606
+ return /* @__PURE__ */ s(tr, { children: [
607
+ /* @__PURE__ */ s(rr, { type: "button", ownerState: { selected: l }, onClick: () => ft(e), children: [
608
+ /* @__PURE__ */ r(or, { children: e.name }),
609
+ e.is_default ? /* @__PURE__ */ r(Ae, { size: 13, "aria-hidden": "true", "data-primary-view-indicator": "outline" }) : null
577
610
  ] }),
578
611
  /* @__PURE__ */ r(
579
- jt,
612
+ Kt,
580
613
  {
581
614
  align: "start",
582
615
  side: "right",
583
616
  size: "sm",
584
- className: it,
617
+ className: lt,
585
618
  trigger: /* @__PURE__ */ r(
586
- Lt,
619
+ Dt,
587
620
  {
588
621
  variant: "secondary",
589
622
  size: "sm",
590
- icon: /* @__PURE__ */ r(It, { size: 14, weight: "bold" }),
623
+ icon: /* @__PURE__ */ r(Ot, { size: 14, weight: "bold" }),
591
624
  "aria-label": `View actions for ${e.name}`
592
625
  }
593
626
  ),
594
627
  items: [
595
628
  ...e.is_system_defined ? [] : [
596
629
  e.is_default ? {
597
- label: Me,
630
+ label: Ke,
598
631
  icon: /* @__PURE__ */ r(le, { size: 16 }),
599
- onSelect: () => pt(e)
632
+ onSelect: () => bt(e)
600
633
  } : {
601
- label: je,
634
+ label: $e,
602
635
  icon: /* @__PURE__ */ r(le, { size: 16 }),
603
- onSelect: () => ft(e)
636
+ onSelect: () => pt(e)
604
637
  }
605
638
  ],
606
639
  {
607
- label: Ke,
608
- icon: /* @__PURE__ */ r(Ot, { size: 16 }),
609
- onSelect: () => vt(e)
640
+ label: qe,
641
+ icon: /* @__PURE__ */ r(Ht, { size: 16 }),
642
+ onSelect: () => wt(e)
610
643
  },
611
644
  {
612
- label: $e,
613
- icon: /* @__PURE__ */ r(Bt, { size: 16 }),
645
+ label: Ue,
646
+ icon: /* @__PURE__ */ r(Ft, { size: 16 }),
614
647
  destructive: !0,
615
- onSelect: () => ge(e)
648
+ onSelect: () => ve(e)
616
649
  }
617
650
  ]
618
651
  }
@@ -620,68 +653,68 @@ function Rr({
620
653
  ] }, e.view_id);
621
654
  })
622
655
  ] }),
623
- /* @__PURE__ */ r(Zt, {}),
624
- /* @__PURE__ */ s(er, { type: "button", onClick: gt, children: [
625
- /* @__PURE__ */ r(_e, { size: 16 }),
656
+ /* @__PURE__ */ r(nr, {}),
657
+ /* @__PURE__ */ s(ir, { type: "button", onClick: vt, children: [
658
+ /* @__PURE__ */ r(Ce, { size: 16 }),
626
659
  /* @__PURE__ */ r("span", { children: "Switch to default" })
627
660
  ] })
628
661
  ]
629
662
  }
630
663
  ) }) })
631
664
  ] }),
632
- /* @__PURE__ */ r(Se, { open: !!F, onOpenChange: (e) => {
665
+ /* @__PURE__ */ r(_e, { open: !!D, onOpenChange: (e) => {
633
666
  e || re();
634
- }, children: /* @__PURE__ */ r(Te, { children: /* @__PURE__ */ s(ae, { children: [
635
- /* @__PURE__ */ r(ze, {}),
636
- /* @__PURE__ */ r(Ae, { children: /* @__PURE__ */ s("form", { onSubmit: wt, children: [
637
- /* @__PURE__ */ r(Ve, { children: qe }),
638
- de ? /* @__PURE__ */ r(We, { children: de }) : null,
639
- /* @__PURE__ */ r(tr, { htmlFor: ve, children: Ue }),
667
+ }, children: /* @__PURE__ */ r(Re, { children: /* @__PURE__ */ s(ae, { children: [
668
+ /* @__PURE__ */ r(Ve, {}),
669
+ /* @__PURE__ */ r(Ie, { children: /* @__PURE__ */ s("form", { onSubmit: yt, children: [
670
+ /* @__PURE__ */ r(We, { children: Ye }),
671
+ ue ? /* @__PURE__ */ r(Oe, { children: ue }) : null,
672
+ /* @__PURE__ */ r(ar, { htmlFor: we, children: Ge }),
640
673
  /* @__PURE__ */ r(
641
- rr,
674
+ lr,
642
675
  {
643
- id: ve,
676
+ id: we,
644
677
  autoFocus: !0,
645
- value: V,
678
+ value: I,
646
679
  onChange: (e) => Q(e.currentTarget.value),
647
680
  "aria-invalid": oe
648
681
  }
649
682
  ),
650
- oe ? /* @__PURE__ */ s(nr, { children: [
683
+ oe ? /* @__PURE__ */ s(cr, { children: [
651
684
  "“",
652
- V.trim(),
685
+ I.trim(),
653
686
  "” is reserved. Choose a different name."
654
687
  ] }) : null,
655
- /* @__PURE__ */ s(Ie, { children: [
656
- /* @__PURE__ */ r(j, { type: "button", variant: "secondary", onClick: re, children: Ye }),
657
- /* @__PURE__ */ r(or, { type: "submit", disabled: V.trim().length === 0 || oe, children: Ge })
688
+ /* @__PURE__ */ s(Be, { children: [
689
+ /* @__PURE__ */ r(M, { type: "button", variant: "secondary", onClick: re, children: Je }),
690
+ /* @__PURE__ */ r(sr, { type: "submit", disabled: I.trim().length === 0 || oe, children: Qe })
658
691
  ] })
659
692
  ] }) })
660
693
  ] }) }) }),
661
- /* @__PURE__ */ r(Se, { open: !!h, onOpenChange: (e) => {
694
+ /* @__PURE__ */ r(_e, { open: !!h, onOpenChange: (e) => {
662
695
  e || te();
663
- }, children: /* @__PURE__ */ r(Te, { children: /* @__PURE__ */ s(ae, { children: [
664
- /* @__PURE__ */ r(ze, {}),
665
- /* @__PURE__ */ s(Ae, { children: [
666
- /* @__PURE__ */ r(Ve, { children: Je }),
667
- /* @__PURE__ */ r(We, { children: Qe ?? /* @__PURE__ */ s(xe, { children: [
696
+ }, children: /* @__PURE__ */ r(Re, { children: /* @__PURE__ */ s(ae, { children: [
697
+ /* @__PURE__ */ r(Ve, {}),
698
+ /* @__PURE__ */ s(Ie, { children: [
699
+ /* @__PURE__ */ r(We, { children: Xe }),
700
+ /* @__PURE__ */ r(Oe, { children: Ze ?? /* @__PURE__ */ s(Te, { children: [
668
701
  "Are you sure you want to delete",
669
- h != null && h.name ? /* @__PURE__ */ s(xe, { children: [
702
+ h != null && h.name ? /* @__PURE__ */ s(Te, { children: [
670
703
  " “",
671
704
  /* @__PURE__ */ r("strong", { children: h.name }),
672
705
  "”"
673
706
  ] }) : " this view",
674
707
  "? This can’t be undone."
675
708
  ] }) }),
676
- /* @__PURE__ */ s(Ie, { children: [
677
- /* @__PURE__ */ r(j, { type: "button", variant: "secondary", onClick: te, children: Xe }),
678
- /* @__PURE__ */ r(j, { type: "button", variant: "danger", onClick: ht, children: Ze })
709
+ /* @__PURE__ */ s(Be, { children: [
710
+ /* @__PURE__ */ r(M, { type: "button", variant: "secondary", onClick: te, children: et }),
711
+ /* @__PURE__ */ r(M, { type: "button", variant: "danger", onClick: gt, children: tt })
679
712
  ] })
680
713
  ] })
681
714
  ] }) }) })
682
715
  ] }) : null;
683
716
  }
684
717
  export {
685
- Rr as TableViewSelector
718
+ Wr as TableViewSelector
686
719
  };
687
720
  //# sourceMappingURL=TableViewSelector.js.map