@pibit.ai/cure-design-system 0.3.48 → 0.3.52

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 (59) hide show
  1. package/dist/assets/icons/filtered-view.svg.js +4 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +103 -92
  5. package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
  6. package/dist/patterns/table/TableWrapper.js +447 -447
  7. package/dist/patterns/table/TableZoomControl.d.ts +2 -2
  8. package/dist/patterns/table/TableZoomControl.d.ts.map +1 -1
  9. package/dist/patterns/table/TableZoomControl.js +124 -46
  10. package/dist/patterns/table/index.d.ts +2 -2
  11. package/dist/patterns/table/index.d.ts.map +1 -1
  12. package/dist/patterns/table/storyHelpers/mockTableViewsApi.d.ts +25 -0
  13. package/dist/patterns/table/storyHelpers/mockTableViewsApi.d.ts.map +1 -0
  14. package/dist/patterns/table/tableZoomLayout.d.ts +6 -0
  15. package/dist/patterns/table/tableZoomLayout.d.ts.map +1 -1
  16. package/dist/patterns/table/tableZoomLayout.js +39 -33
  17. package/dist/patterns/table/toolbar/SummaryFooter.d.ts +10 -3
  18. package/dist/patterns/table/toolbar/SummaryFooter.d.ts.map +1 -1
  19. package/dist/patterns/table/toolbar/SummaryFooter.js +61 -71
  20. package/dist/patterns/table/toolbar/TableToolbar.d.ts +8 -0
  21. package/dist/patterns/table/toolbar/TableToolbar.d.ts.map +1 -1
  22. package/dist/patterns/table/toolbar/TableToolbar.js +200 -159
  23. package/dist/patterns/table/toolbar/TableViewDirtyActions.d.ts +7 -0
  24. package/dist/patterns/table/toolbar/TableViewDirtyActions.d.ts.map +1 -0
  25. package/dist/patterns/table/toolbar/TableViewDirtyActions.js +39 -0
  26. package/dist/patterns/table/toolbar/TableViewsDropdown.d.ts +8 -0
  27. package/dist/patterns/table/toolbar/TableViewsDropdown.d.ts.map +1 -0
  28. package/dist/patterns/table/toolbar/TableViewsDropdown.js +171 -0
  29. package/dist/patterns/table/toolbar/index.d.ts +4 -0
  30. package/dist/patterns/table/toolbar/index.d.ts.map +1 -1
  31. package/dist/patterns/table/toolbar/tableViewSnapshot.d.ts +18 -0
  32. package/dist/patterns/table/toolbar/tableViewSnapshot.d.ts.map +1 -0
  33. package/dist/patterns/table/toolbar/tableViewSnapshot.js +168 -0
  34. package/dist/patterns/table/toolbar/tableViewSnapshot.test.d.ts +2 -0
  35. package/dist/patterns/table/toolbar/tableViewSnapshot.test.d.ts.map +1 -0
  36. package/dist/patterns/table/toolbar/tableViewTypes.d.ts +73 -0
  37. package/dist/patterns/table/toolbar/tableViewTypes.d.ts.map +1 -0
  38. package/dist/patterns/table/toolbar/tableViewTypes.js +4 -0
  39. package/dist/patterns/table/types.d.ts +24 -1
  40. package/dist/patterns/table/types.d.ts.map +1 -1
  41. package/dist/patterns/table/useFitTableToViewport.d.ts +15 -0
  42. package/dist/patterns/table/useFitTableToViewport.d.ts.map +1 -0
  43. package/dist/patterns/table/useFitTableToViewport.js +47 -0
  44. package/dist/patterns/table/useTableZoomState.d.ts +20 -0
  45. package/dist/patterns/table/useTableZoomState.d.ts.map +1 -0
  46. package/dist/patterns/table/useTableZoomState.js +30 -0
  47. package/dist/patterns/table-component/TableComponent.d.ts.map +1 -1
  48. package/dist/patterns/table-component/TableComponent.js +331 -335
  49. package/dist/primitives/dropdown/dropdown.d.ts +11 -2
  50. package/dist/primitives/dropdown/dropdown.d.ts.map +1 -1
  51. package/dist/primitives/dropdown/dropdown.js +95 -66
  52. package/dist/primitives/dropdown/dropdown.nestedOverlay.test.d.ts +2 -0
  53. package/dist/primitives/dropdown/dropdown.nestedOverlay.test.d.ts.map +1 -0
  54. package/dist/primitives/input/hint-text.js +1 -1
  55. package/dist/primitives/tooltip/tooltip.d.ts +5 -1
  56. package/dist/primitives/tooltip/tooltip.d.ts.map +1 -1
  57. package/dist/primitives/tooltip/tooltip.js +35 -33
  58. package/dist/styles/components.css +1 -1
  59. package/package.json +3 -6
@@ -1,32 +1,34 @@
1
1
  import { jsx as n, jsxs as p } from "react/jsx-runtime";
2
- import { useMemo as S, isValidElement as M, cloneElement as k, useRef as I, useState as O, useEffect as W, useLayoutEffect as U } from "react";
3
- import { FlipBackward as j, FlipForward as F, ChevronSelectorVertical as P, DotsHorizontal as H } from "@untitledui/icons";
4
- import { cx as A } from "../../../utils/cn.js";
5
- import { AlignDropdown as T } from "./AlignDropdown.js";
6
- import { GroupByDropdown as G } from "./GroupByDropdown.js";
7
- import { HideFieldsDropdown as _ } from "./HideFieldsDropdown.js";
8
- import { RowHeightDropdown as B } from "./RowHeightDropdown.js";
9
- import { ShowSummaryDropdown as V } from "./ShowSummaryDropdown.js";
10
- import { resolveColumnLabel as $ } from "./tableToolbarHelpers.js";
11
- import { useUndoRedoShortcuts as q } from "./useUndoRedoShortcuts.js";
12
- import { ExpandableSearchInput as E } from "../../../primitives/select/ExpandableSearchInput.js";
13
- import { Button as D } from "../../../primitives/button/button.js";
14
- import { Dropdown as x } from "../../../primitives/dropdown/dropdown.js";
15
- import { Icon as J } from "../../../primitives/icon/icon.js";
16
- function Q(e, i) {
17
- return M(e) ? k(e, {
18
- onApply: i.onApply,
19
- onClear: i.onClear,
20
- clearAllSorts: i.onClear
2
+ import { useMemo as O, isValidElement as F, cloneElement as P, useRef as k, useState as W, useEffect as H, useLayoutEffect as K } from "react";
3
+ import { FlipBackward as M, FlipForward as G, ChevronSelectorVertical as T, DotsHorizontal as _ } from "@untitledui/icons";
4
+ import { cx as j } from "../../../utils/cn.js";
5
+ import { AlignDropdown as $ } from "./AlignDropdown.js";
6
+ import { GroupByDropdown as q } from "./GroupByDropdown.js";
7
+ import { HideFieldsDropdown as J } from "./HideFieldsDropdown.js";
8
+ import { RowHeightDropdown as Q } from "./RowHeightDropdown.js";
9
+ import { ShowSummaryDropdown as X } from "./ShowSummaryDropdown.js";
10
+ import { resolveColumnLabel as Y } from "./tableToolbarHelpers.js";
11
+ import { useUndoRedoShortcuts as Z } from "./useUndoRedoShortcuts.js";
12
+ import { TableViewDirtyActions as E } from "./TableViewDirtyActions.js";
13
+ import { hasSavedOrSharedViews as ee, TableViewsDropdown as ne } from "./TableViewsDropdown.js";
14
+ import { ExpandableSearchInput as oe } from "../../../primitives/select/ExpandableSearchInput.js";
15
+ import { Button as I } from "../../../primitives/button/button.js";
16
+ import { Dropdown as z } from "../../../primitives/dropdown/dropdown.js";
17
+ import { Icon as re } from "../../../primitives/icon/icon.js";
18
+ function ie(e, t) {
19
+ return F(e) ? P(e, {
20
+ onApply: t.onApply,
21
+ onClear: t.onClear,
22
+ clearAllSorts: t.onClear
21
23
  }) : e;
22
24
  }
23
- function X(e, i) {
24
- return M(e) ? k(e, {
25
- onApply: i.onApply,
26
- onClearAll: i.onClearAll
25
+ function te(e, t) {
26
+ return F(e) ? P(e, {
27
+ onApply: t.onApply,
28
+ onClearAll: t.onClearAll
27
29
  }) : e;
28
30
  }
29
- const Y = ({ config: e }) => (q({
31
+ const se = ({ config: e }) => (Z({
30
32
  enabled: e.shortcut ?? !0,
31
33
  canUndo: e.canUndo,
32
34
  canRedo: e.canRedo,
@@ -35,11 +37,11 @@ const Y = ({ config: e }) => (q({
35
37
  isDisabled: e.isDisabled
36
38
  }), /* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: [
37
39
  /* @__PURE__ */ n(
38
- D,
40
+ I,
39
41
  {
40
42
  size: "xs",
41
43
  color: "secondary",
42
- iconLeading: /* @__PURE__ */ n(j, { size: 16 }),
44
+ iconLeading: /* @__PURE__ */ n(M, { size: 16 }),
43
45
  "aria-label": "Undo",
44
46
  title: "Undo",
45
47
  isDisabled: e.isDisabled || !e.canUndo,
@@ -47,233 +49,272 @@ const Y = ({ config: e }) => (q({
47
49
  }
48
50
  ),
49
51
  /* @__PURE__ */ n(
50
- D,
52
+ I,
51
53
  {
52
54
  size: "xs",
53
55
  color: "secondary",
54
- iconLeading: /* @__PURE__ */ n(F, { size: 16 }),
56
+ iconLeading: /* @__PURE__ */ n(G, { size: 16 }),
55
57
  "aria-label": "Redo",
56
58
  title: "Redo",
57
59
  isDisabled: e.isDisabled || !e.canRedo,
58
60
  onClick: e.onRedo
59
61
  }
60
62
  )
61
- ] })), Z = ({ config: e, content: i }) => {
62
- const l = e.sorts.some((r) => r.field !== "" && r.direction !== "");
63
+ ] })), le = ({ config: e, content: t, isDisabled: d }) => {
64
+ const i = e.sorts.some((s) => s.field !== "" && s.direction !== "");
63
65
  return /* @__PURE__ */ p(
64
- x.Root,
66
+ z.Root,
65
67
  {
66
68
  isOpen: e.isOpen,
67
- onOpenChange: (r) => {
68
- r && e.onSortsChange(e.sorts.map((t) => ({ ...t }))), e.onOpenChange(r);
69
+ onOpenChange: (s) => {
70
+ s && e.onSortsChange(e.sorts.map((c) => ({ ...c }))), e.onOpenChange(s);
69
71
  },
70
72
  children: [
71
73
  /* @__PURE__ */ p(
72
- D,
74
+ I,
73
75
  {
74
76
  size: "xs",
75
77
  color: "secondary",
76
- iconLeading: /* @__PURE__ */ n(P, { size: 12 }),
77
- className: A(
78
- l && "ring-1 ring-brand-600 bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600"
78
+ isDisabled: d,
79
+ iconLeading: /* @__PURE__ */ n(T, { size: 12 }),
80
+ className: j(
81
+ i && "ring-1 ring-brand-600 bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600"
79
82
  ),
80
83
  children: [
81
84
  "Sort",
82
- l && /* @__PURE__ */ n("span", { className: "ml-1 text-xs font-semibold text-brand-600", children: e.sorts.length })
85
+ i && /* @__PURE__ */ n("span", { className: "ml-1 text-xs font-semibold text-brand-600", children: e.sorts.length })
83
86
  ]
84
87
  }
85
88
  ),
86
- /* @__PURE__ */ n(x.Popover, { className: "w-auto min-w-[300px]", children: i })
89
+ /* @__PURE__ */ n(z.Popover, { className: "w-auto min-w-[300px]", children: t })
87
90
  ]
88
91
  }
89
92
  );
90
- }, ee = ({ config: e, content: i }) => {
91
- const l = e.meaningfulConditionsCount > 0;
92
- return /* @__PURE__ */ p(x.Root, { isOpen: e.isOpen, onOpenChange: e.onOpenChange, children: [
93
+ }, ae = ({ config: e, content: t, isDisabled: d }) => {
94
+ const i = e.meaningfulConditionsCount > 0;
95
+ return /* @__PURE__ */ p(z.Root, { isOpen: e.isOpen, onOpenChange: e.onOpenChange, children: [
93
96
  /* @__PURE__ */ p(
94
- D,
97
+ I,
95
98
  {
96
99
  size: "xs",
97
100
  color: "secondary",
98
- iconLeading: /* @__PURE__ */ n(J, { name: "FilterLines", size: 12 }),
99
- className: A(
100
- l && "ring-1 ring-brand-600 bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600"
101
+ isDisabled: d,
102
+ iconLeading: /* @__PURE__ */ n(re, { name: "FilterLines", size: 12 }),
103
+ className: j(
104
+ i && "ring-1 ring-brand-600 bg-brand-primary text-brand-600 hover:bg-brand-primary hover:text-brand-600"
101
105
  ),
102
106
  children: [
103
107
  "Filter",
104
- l && /* @__PURE__ */ n("span", { className: "ml-1 text-xs font-semibold text-brand-600", children: e.meaningfulConditionsCount })
108
+ i && /* @__PURE__ */ n("span", { className: "ml-1 text-xs font-semibold text-brand-600", children: e.meaningfulConditionsCount })
105
109
  ]
106
110
  }
107
111
  ),
108
- /* @__PURE__ */ n(x.Popover, { className: "w-auto min-w-[300px]", children: i })
112
+ /* @__PURE__ */ n(z.Popover, { className: "w-auto min-w-[300px]", children: t })
109
113
  ] });
110
- }, we = ({
114
+ }, Ae = ({
111
115
  className: e,
112
- fallbackTitle: i,
113
- undoRedo: l,
114
- sort: r,
115
- filter: t,
116
- search: u,
117
- rowHeight: C,
118
- hideFields: v,
119
- align: h,
120
- groupBy: m,
121
- summary: g,
122
- beforeSearch: z,
123
- trailing: y,
124
- searchCollapsible: o,
125
- disableExtendedTools: s = !1,
126
- sortContent: a,
127
- filterContent: d
116
+ fallbackTitle: t,
117
+ undoRedo: d,
118
+ sort: i,
119
+ filter: s,
120
+ search: c,
121
+ rowHeight: x,
122
+ hideFields: f,
123
+ align: N,
124
+ groupBy: h,
125
+ summary: C,
126
+ beforeSearch: A,
127
+ trailing: w,
128
+ searchCollapsible: U,
129
+ disableExtendedTools: a = !1,
130
+ isEditMode: b = !0,
131
+ sortContent: g,
132
+ filterContent: o,
133
+ views: r
128
134
  }) => {
129
- const b = S(
130
- () => r && a ? Q(a, r) : a,
131
- [r, a]
132
- ), w = S(
133
- () => t && d ? X(d, t) : d,
134
- [t, d]
135
- ), N = S(() => {
136
- const c = [];
137
- if (l && c.push({ id: "undo-redo", node: /* @__PURE__ */ n(Y, { config: l }) }), r && b) {
138
- const f = r.sorts.some((R) => R.field !== "" && R.direction !== "");
139
- c.push({
135
+ const l = O(
136
+ () => i && g ? ie(g, i) : g,
137
+ [i, g]
138
+ ), D = O(
139
+ () => s && o ? te(o, s) : o,
140
+ [s, o]
141
+ ), S = O(() => {
142
+ const m = [];
143
+ if (b && d && m.push({ id: "undo-redo", node: /* @__PURE__ */ n(se, { config: d }) }), i && l) {
144
+ const y = i.sorts.some((v) => v.field !== "" && v.direction !== "");
145
+ m.push({
140
146
  id: "sort",
141
- widthKey: f ? String(r.sorts.length) : "",
142
- node: /* @__PURE__ */ n(Z, { config: r, content: b })
147
+ widthKey: y ? String(i.sorts.length) : "",
148
+ node: /* @__PURE__ */ n(
149
+ le,
150
+ {
151
+ config: i,
152
+ content: l,
153
+ isDisabled: a
154
+ }
155
+ )
143
156
  });
144
157
  }
145
- if (t && w && c.push({
158
+ if (s && D && m.push({
146
159
  id: "filter",
147
- widthKey: t.meaningfulConditionsCount > 0 ? String(t.meaningfulConditionsCount) : "",
148
- node: /* @__PURE__ */ n(ee, { config: t, content: w })
149
- }), C && c.push({
160
+ widthKey: s.meaningfulConditionsCount > 0 ? String(s.meaningfulConditionsCount) : "",
161
+ node: /* @__PURE__ */ n(
162
+ ae,
163
+ {
164
+ config: s,
165
+ content: D,
166
+ isDisabled: a
167
+ }
168
+ )
169
+ }), b && x && m.push({
150
170
  id: "row-height",
151
- node: /* @__PURE__ */ n(B, { ...C, isDisabled: s })
152
- }), v && c.push({
171
+ node: /* @__PURE__ */ n(Q, { ...x, isDisabled: a })
172
+ }), f && m.push({
153
173
  id: "hide-fields",
154
- widthKey: v.hiddenColumns.size > 0 ? String(v.hiddenColumns.size) : "",
155
- node: /* @__PURE__ */ n(_, { ...v, isDisabled: s })
156
- }), h && c.push({ id: "align", node: /* @__PURE__ */ n(T, { ...h, isDisabled: s }) }), m) {
157
- const f = m.value ? m.schema.find((K) => K.value === m.value) : void 0, R = f ? $(f, m.labelMeta) : "";
158
- c.push({
174
+ widthKey: f.hiddenColumns.size > 0 ? String(f.hiddenColumns.size) : "",
175
+ node: /* @__PURE__ */ n(J, { ...f, isDisabled: a })
176
+ }), N && m.push({ id: "align", node: /* @__PURE__ */ n($, { ...N, isDisabled: a }) }), b && h) {
177
+ const y = h.value ? h.schema.find((B) => B.value === h.value) : void 0, v = y ? Y(y, h.labelMeta) : "";
178
+ m.push({
159
179
  id: "group-by",
160
- widthKey: R,
161
- node: /* @__PURE__ */ n(G, { ...m, isDisabled: s })
180
+ widthKey: v,
181
+ node: /* @__PURE__ */ n(q, { ...h, isDisabled: a })
162
182
  });
163
183
  }
164
- return g && c.push({
184
+ return b && C && m.push({
165
185
  id: "summary",
166
- node: /* @__PURE__ */ n(V, { ...g, isDisabled: s })
167
- }), c;
186
+ node: /* @__PURE__ */ n(X, { ...C, isDisabled: a })
187
+ }), A && m.push({ id: "zoom", node: A }), m;
168
188
  }, [
189
+ d,
190
+ i,
169
191
  l,
170
- r,
171
- b,
172
- t,
173
- w,
174
- C,
175
- v,
192
+ s,
193
+ D,
194
+ x,
195
+ f,
196
+ N,
176
197
  h,
177
- m,
178
- g,
179
- s
180
- ]);
181
- return /* @__PURE__ */ p("div", { className: A("flex justify-between items-center gap-2", e), children: [
182
- N.length > 0 ? /* @__PURE__ */ n(oe, { items: N }) : i ? /* @__PURE__ */ n("h4", { className: "text-sm font-normal text-secondary", children: i }) : /* @__PURE__ */ n("div", {}),
198
+ C,
199
+ A,
200
+ a,
201
+ b
202
+ ]), u = !!(b && r && (r.onSelectInitial || ee(r.items))), R = b && r && r.dirtyAction !== "none" ? /* @__PURE__ */ n(E, { config: r, isDisabled: a }) : null, L = u || S.length > 0 || R != null;
203
+ return /* @__PURE__ */ p("div", { className: j("flex justify-between items-center gap-2", e), children: [
204
+ L ? /* @__PURE__ */ p("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
205
+ u && r && /* @__PURE__ */ n(ne, { config: r, isDisabled: a }),
206
+ S.length > 0 ? /* @__PURE__ */ n(ce, { items: S, suffix: R }) : R
207
+ ] }) : t ? /* @__PURE__ */ n("h4", { className: "text-sm font-normal text-secondary", children: t }) : /* @__PURE__ */ n("div", {}),
183
208
  /* @__PURE__ */ p("div", { className: "flex items-center gap-2 shrink-0", children: [
184
- z,
185
- u && /* @__PURE__ */ n(
186
- E,
209
+ c && /* @__PURE__ */ n(
210
+ oe,
187
211
  {
188
212
  size: "sm",
189
213
  placeholder: "Search",
190
- value: u.value,
191
- onChange: u.onChange,
192
- collapsible: o,
193
- isDisabled: s,
194
- shortcut: u.shortcut
214
+ value: c.value,
215
+ onChange: c.onChange,
216
+ collapsible: U,
217
+ isDisabled: a,
218
+ shortcut: c.shortcut
195
219
  }
196
220
  ),
197
- y
221
+ w
198
222
  ] })
199
223
  ] });
200
- }, ne = 40, L = 8, oe = ({ items: e }) => {
201
- const i = I(null), l = I(/* @__PURE__ */ new Map()), [r, t] = O(() => /* @__PURE__ */ new Map()), [u, C] = O(null), v = S(() => e.map((o) => `${o.id}:${o.widthKey ?? ""}`).join("|"), [e]);
202
- W(() => {
203
- t(/* @__PURE__ */ new Map());
204
- }, [v]), U(() => {
205
- if (r.size === e.length) return;
224
+ }, de = 40, V = 8, ce = ({
225
+ items: e,
226
+ suffix: t
227
+ }) => {
228
+ const d = k(null), i = k(null), s = k(/* @__PURE__ */ new Map()), [c, x] = W(() => /* @__PURE__ */ new Map()), [f, N] = W(null), [h, C] = W(0), A = O(() => e.map((o) => `${o.id}:${o.widthKey ?? ""}`).join("|"), [e]);
229
+ H(() => {
230
+ x(/* @__PURE__ */ new Map());
231
+ }, [A]), K(() => {
232
+ if (c.size === e.length) return;
206
233
  const o = /* @__PURE__ */ new Map();
207
- for (const s of e) {
208
- const a = l.current.get(s.id);
209
- a && o.set(s.id, a.getBoundingClientRect().width);
234
+ for (const r of e) {
235
+ const l = s.current.get(r.id);
236
+ l && o.set(r.id, l.getBoundingClientRect().width);
210
237
  }
211
- o.size === e.length && t(o);
212
- }, [e, r]), U(() => {
213
- const o = i.current;
238
+ o.size === e.length && x(o);
239
+ }, [e, c]), K(() => {
240
+ const o = d.current;
214
241
  if (!o) return;
215
- const s = () => {
216
- i.current && C(i.current.clientWidth);
242
+ const r = () => {
243
+ d.current && N(d.current.clientWidth);
244
+ };
245
+ r();
246
+ const l = new ResizeObserver(r);
247
+ return l.observe(o), () => l.disconnect();
248
+ }, []), K(() => {
249
+ const o = i.current;
250
+ if (!o) {
251
+ C(0);
252
+ return;
253
+ }
254
+ const r = () => {
255
+ i.current && C(i.current.getBoundingClientRect().width);
217
256
  };
218
- s();
219
- const a = new ResizeObserver(s);
220
- return a.observe(o), () => a.disconnect();
221
- }, []);
222
- const h = r.size === e.length, { visibleIds: m, overflowIds: g } = S(() => {
223
- if (!h || u == null)
257
+ r();
258
+ const l = new ResizeObserver(r);
259
+ return l.observe(o), () => l.disconnect();
260
+ }, [t]);
261
+ const w = c.size === e.length, { visibleIds: U, overflowIds: a } = O(() => {
262
+ if (!w || f == null)
224
263
  return {
225
- visibleIds: new Set(e.map((d) => d.id)),
264
+ visibleIds: new Set(e.map((u) => u.id)),
226
265
  overflowIds: /* @__PURE__ */ new Set()
227
266
  };
228
- let o = 0;
229
- const s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
230
- for (let d = 0; d < e.length; d++) {
231
- const b = e[d].id, w = r.get(b) ?? 0, c = e.length - d - 1 > 0 ? ne + L : 0;
232
- if (o + w + c > u) {
233
- for (let f = d; f < e.length; f++) a.add(e[f].id);
267
+ const o = h > 0 ? h + V : 0, r = Math.max(0, f - o);
268
+ let l = 0;
269
+ const D = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Set();
270
+ for (let u = 0; u < e.length; u++) {
271
+ const R = e[u].id, L = c.get(R) ?? 0, y = e.length - u - 1 > 0 ? de + V : 0;
272
+ if (l + L + y > r) {
273
+ for (let v = u; v < e.length; v++) S.add(e[v].id);
234
274
  break;
235
275
  }
236
- o += w + L, s.add(b);
276
+ l += L + V, D.add(R);
237
277
  }
238
- return { visibleIds: s, overflowIds: a };
239
- }, [e, r, u, h]), z = e.filter((o) => m.has(o.id)), y = e.filter((o) => g.has(o.id));
278
+ return { visibleIds: D, overflowIds: S };
279
+ }, [e, c, f, w, h]), b = e.filter((o) => U.has(o.id)), g = e.filter((o) => a.has(o.id));
240
280
  return /* @__PURE__ */ p(
241
281
  "div",
242
282
  {
243
- ref: i,
244
- className: "flex items-center gap-2 min-w-0 flex-1 overflow-hidden",
245
- style: h ? void 0 : { visibility: "hidden" },
283
+ ref: d,
284
+ className: "flex items-center gap-2 min-w-0 flex-1 overflow-visible",
285
+ style: w ? void 0 : { visibility: "hidden" },
246
286
  children: [
247
- (h ? z : e).map((o) => /* @__PURE__ */ n(
287
+ (w ? b : e).map((o) => /* @__PURE__ */ n(
248
288
  "div",
249
289
  {
250
- ref: (s) => {
251
- l.current.set(o.id, s);
290
+ ref: (r) => {
291
+ s.current.set(o.id, r);
252
292
  },
253
293
  className: "shrink-0",
254
294
  children: o.node
255
295
  },
256
296
  o.id
257
297
  )),
258
- h && y.length > 0 && /* @__PURE__ */ p(x.Root, { children: [
298
+ w && g.length > 0 && /* @__PURE__ */ p(z.Root, { children: [
259
299
  /* @__PURE__ */ n(
260
- D,
300
+ I,
261
301
  {
262
302
  size: "xs",
263
303
  color: "secondary",
264
- iconLeading: /* @__PURE__ */ n(H, { size: 16 }),
304
+ iconLeading: /* @__PURE__ */ n(_, { size: 16 }),
265
305
  "aria-label": "More tools",
266
306
  title: "More tools",
267
307
  className: "shrink-0"
268
308
  }
269
309
  ),
270
- /* @__PURE__ */ n(x.Popover, { className: "w-auto", children: /* @__PURE__ */ n("div", { className: "flex flex-col items-stretch gap-2 p-2 min-w-[180px]", children: y.map((o) => /* @__PURE__ */ n("div", { className: "[&>*]:w-full", children: o.node }, o.id)) }) })
271
- ] })
310
+ /* @__PURE__ */ n(z.Popover, { className: "w-auto", children: /* @__PURE__ */ n("div", { className: "flex flex-col items-stretch gap-2 p-2 min-w-[180px]", children: g.map((o) => /* @__PURE__ */ n("div", { className: "[&>*]:w-full", children: o.node }, o.id)) }) })
311
+ ] }),
312
+ t != null && /* @__PURE__ */ n("div", { ref: i, className: "shrink-0", children: t })
272
313
  ]
273
314
  }
274
315
  );
275
316
  };
276
- function xe(e) {
317
+ function Oe(e) {
277
318
  return {
278
319
  sort: e.sort,
279
320
  filter: e.filter,
@@ -281,6 +322,6 @@ function xe(e) {
281
322
  };
282
323
  }
283
324
  export {
284
- we as TableToolbar,
285
- xe as pickCoreToolbarProps
325
+ Ae as TableToolbar,
326
+ Oe as pickCoreToolbarProps
286
327
  };
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ import { TableViewsConfig } from './tableViewTypes';
3
+ export declare const TableViewDirtyActions: FC<{
4
+ config: TableViewsConfig;
5
+ isDisabled?: boolean;
6
+ }>;
7
+ //# sourceMappingURL=TableViewDirtyActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableViewDirtyActions.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/TableViewDirtyActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC;IACrC,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAsCA,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { jsx as r, jsxs as t } from "react/jsx-runtime";
2
+ import { RefreshCcw01 as l } from "@untitledui/icons";
3
+ import { Button as i } from "../../../primitives/button/button.js";
4
+ import { Tooltip as n } from "../../../primitives/tooltip/tooltip.js";
5
+ const m = ({ config: e, isDisabled: o }) => e.dirtyAction === "none" ? null : e.dirtyAction === "save" ? /* @__PURE__ */ r(
6
+ i,
7
+ {
8
+ size: "xs",
9
+ color: "link-color",
10
+ isDisabled: o,
11
+ onClick: e.onSaveClick,
12
+ children: "Save View"
13
+ }
14
+ ) : /* @__PURE__ */ t("div", { className: "flex items-center gap-2 shrink-0", children: [
15
+ /* @__PURE__ */ r(n, { title: "Revert to last saved", isHoverable: !1, children: /* @__PURE__ */ r(
16
+ i,
17
+ {
18
+ size: "xs",
19
+ color: "secondary",
20
+ "aria-label": "Revert to last saved",
21
+ isDisabled: o,
22
+ iconLeading: /* @__PURE__ */ r(l, { size: 16 }),
23
+ onClick: e.onRevertClick
24
+ }
25
+ ) }),
26
+ /* @__PURE__ */ r(
27
+ i,
28
+ {
29
+ size: "xs",
30
+ color: "link-color",
31
+ isDisabled: o,
32
+ onClick: e.onUpdateClick,
33
+ children: "Update View"
34
+ }
35
+ )
36
+ ] });
37
+ export {
38
+ m as TableViewDirtyActions
39
+ };
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import { TableViewListItem, TableViewsConfig } from './tableViewTypes';
3
+ export declare const TableViewsDropdown: FC<{
4
+ config: TableViewsConfig;
5
+ isDisabled?: boolean;
6
+ }>;
7
+ export declare function hasSavedOrSharedViews(items: TableViewListItem[]): boolean;
8
+ //# sourceMappingURL=TableViewsDropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableViewsDropdown.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/TableViewsDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAC;AAe/C,OAAO,EAAyB,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAwIxG,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAClC,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CA+DA,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAEzE"}