@bfrs/agentic-components 0.7.8 → 0.8.0

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