@pibit.ai/cure-design-system 0.3.48 → 0.3.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/filtered-view.svg.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +103 -92
- package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.js +447 -447
- package/dist/patterns/table/TableZoomControl.d.ts +2 -2
- package/dist/patterns/table/TableZoomControl.d.ts.map +1 -1
- package/dist/patterns/table/TableZoomControl.js +124 -46
- package/dist/patterns/table/index.d.ts +2 -2
- package/dist/patterns/table/index.d.ts.map +1 -1
- package/dist/patterns/table/storyHelpers/mockTableViewsApi.d.ts +25 -0
- package/dist/patterns/table/storyHelpers/mockTableViewsApi.d.ts.map +1 -0
- package/dist/patterns/table/tableZoomLayout.d.ts +6 -0
- package/dist/patterns/table/tableZoomLayout.d.ts.map +1 -1
- package/dist/patterns/table/tableZoomLayout.js +39 -33
- package/dist/patterns/table/toolbar/SummaryFooter.d.ts +10 -3
- package/dist/patterns/table/toolbar/SummaryFooter.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/SummaryFooter.js +61 -71
- package/dist/patterns/table/toolbar/TableToolbar.d.ts +8 -0
- package/dist/patterns/table/toolbar/TableToolbar.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/TableToolbar.js +200 -159
- package/dist/patterns/table/toolbar/TableViewDirtyActions.d.ts +7 -0
- package/dist/patterns/table/toolbar/TableViewDirtyActions.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/TableViewDirtyActions.js +39 -0
- package/dist/patterns/table/toolbar/TableViewsDropdown.d.ts +8 -0
- package/dist/patterns/table/toolbar/TableViewsDropdown.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/TableViewsDropdown.js +171 -0
- package/dist/patterns/table/toolbar/index.d.ts +4 -0
- package/dist/patterns/table/toolbar/index.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/tableViewSnapshot.d.ts +18 -0
- package/dist/patterns/table/toolbar/tableViewSnapshot.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/tableViewSnapshot.js +168 -0
- package/dist/patterns/table/toolbar/tableViewSnapshot.test.d.ts +2 -0
- package/dist/patterns/table/toolbar/tableViewSnapshot.test.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/tableViewTypes.d.ts +73 -0
- package/dist/patterns/table/toolbar/tableViewTypes.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/tableViewTypes.js +4 -0
- package/dist/patterns/table/types.d.ts +24 -1
- package/dist/patterns/table/types.d.ts.map +1 -1
- package/dist/patterns/table/useFitTableToViewport.d.ts +15 -0
- package/dist/patterns/table/useFitTableToViewport.d.ts.map +1 -0
- package/dist/patterns/table/useFitTableToViewport.js +47 -0
- package/dist/patterns/table/useTableZoomState.d.ts +20 -0
- package/dist/patterns/table/useTableZoomState.d.ts.map +1 -0
- package/dist/patterns/table/useTableZoomState.js +30 -0
- package/dist/patterns/table-component/TableComponent.d.ts.map +1 -1
- package/dist/patterns/table-component/TableComponent.js +331 -335
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { jsx as n, jsxs as p } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { FlipBackward as
|
|
4
|
-
import { cx as
|
|
5
|
-
import { AlignDropdown as
|
|
6
|
-
import { GroupByDropdown as
|
|
7
|
-
import { HideFieldsDropdown as
|
|
8
|
-
import { RowHeightDropdown as
|
|
9
|
-
import { ShowSummaryDropdown as
|
|
10
|
-
import { resolveColumnLabel as
|
|
11
|
-
import { useUndoRedoShortcuts as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
24
|
-
return
|
|
25
|
-
onApply:
|
|
26
|
-
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
|
|
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
|
-
|
|
40
|
+
I,
|
|
39
41
|
{
|
|
40
42
|
size: "xs",
|
|
41
43
|
color: "secondary",
|
|
42
|
-
iconLeading: /* @__PURE__ */ n(
|
|
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
|
-
|
|
52
|
+
I,
|
|
51
53
|
{
|
|
52
54
|
size: "xs",
|
|
53
55
|
color: "secondary",
|
|
54
|
-
iconLeading: /* @__PURE__ */ n(
|
|
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
|
-
] })),
|
|
62
|
-
const
|
|
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
|
-
|
|
66
|
+
z.Root,
|
|
65
67
|
{
|
|
66
68
|
isOpen: e.isOpen,
|
|
67
|
-
onOpenChange: (
|
|
68
|
-
|
|
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
|
-
|
|
74
|
+
I,
|
|
73
75
|
{
|
|
74
76
|
size: "xs",
|
|
75
77
|
color: "secondary",
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
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(
|
|
89
|
+
/* @__PURE__ */ n(z.Popover, { className: "w-auto min-w-[300px]", children: t })
|
|
87
90
|
]
|
|
88
91
|
}
|
|
89
92
|
);
|
|
90
|
-
},
|
|
91
|
-
const
|
|
92
|
-
return /* @__PURE__ */ p(
|
|
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
|
-
|
|
97
|
+
I,
|
|
95
98
|
{
|
|
96
99
|
size: "xs",
|
|
97
100
|
color: "secondary",
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
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(
|
|
112
|
+
/* @__PURE__ */ n(z.Popover, { className: "w-auto min-w-[300px]", children: t })
|
|
109
113
|
] });
|
|
110
|
-
},
|
|
114
|
+
}, Ae = ({
|
|
111
115
|
className: e,
|
|
112
|
-
fallbackTitle:
|
|
113
|
-
undoRedo:
|
|
114
|
-
sort:
|
|
115
|
-
filter:
|
|
116
|
-
search:
|
|
117
|
-
rowHeight:
|
|
118
|
-
hideFields:
|
|
119
|
-
align:
|
|
120
|
-
groupBy:
|
|
121
|
-
summary:
|
|
122
|
-
beforeSearch:
|
|
123
|
-
trailing:
|
|
124
|
-
searchCollapsible:
|
|
125
|
-
disableExtendedTools:
|
|
126
|
-
|
|
127
|
-
|
|
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
|
|
130
|
-
() =>
|
|
131
|
-
[
|
|
132
|
-
),
|
|
133
|
-
() =>
|
|
134
|
-
[
|
|
135
|
-
),
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
139
|
-
|
|
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:
|
|
142
|
-
node: /* @__PURE__ */ n(
|
|
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 (
|
|
158
|
+
if (s && D && m.push({
|
|
146
159
|
id: "filter",
|
|
147
|
-
widthKey:
|
|
148
|
-
node: /* @__PURE__ */ n(
|
|
149
|
-
|
|
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(
|
|
152
|
-
}),
|
|
171
|
+
node: /* @__PURE__ */ n(Q, { ...x, isDisabled: a })
|
|
172
|
+
}), f && m.push({
|
|
153
173
|
id: "hide-fields",
|
|
154
|
-
widthKey:
|
|
155
|
-
node: /* @__PURE__ */ n(
|
|
156
|
-
}),
|
|
157
|
-
const
|
|
158
|
-
|
|
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:
|
|
161
|
-
node: /* @__PURE__ */ n(
|
|
180
|
+
widthKey: v,
|
|
181
|
+
node: /* @__PURE__ */ n(q, { ...h, isDisabled: a })
|
|
162
182
|
});
|
|
163
183
|
}
|
|
164
|
-
return
|
|
184
|
+
return b && C && m.push({
|
|
165
185
|
id: "summary",
|
|
166
|
-
node: /* @__PURE__ */ n(
|
|
167
|
-
}),
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
v,
|
|
192
|
+
s,
|
|
193
|
+
D,
|
|
194
|
+
x,
|
|
195
|
+
f,
|
|
196
|
+
N,
|
|
176
197
|
h,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
|
|
185
|
-
|
|
186
|
-
E,
|
|
209
|
+
c && /* @__PURE__ */ n(
|
|
210
|
+
oe,
|
|
187
211
|
{
|
|
188
212
|
size: "sm",
|
|
189
213
|
placeholder: "Search",
|
|
190
|
-
value:
|
|
191
|
-
onChange:
|
|
192
|
-
collapsible:
|
|
193
|
-
isDisabled:
|
|
194
|
-
shortcut:
|
|
214
|
+
value: c.value,
|
|
215
|
+
onChange: c.onChange,
|
|
216
|
+
collapsible: U,
|
|
217
|
+
isDisabled: a,
|
|
218
|
+
shortcut: c.shortcut
|
|
195
219
|
}
|
|
196
220
|
),
|
|
197
|
-
|
|
221
|
+
w
|
|
198
222
|
] })
|
|
199
223
|
] });
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
|
208
|
-
const
|
|
209
|
-
|
|
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 &&
|
|
212
|
-
}, [e,
|
|
213
|
-
const o =
|
|
238
|
+
o.size === e.length && x(o);
|
|
239
|
+
}, [e, c]), K(() => {
|
|
240
|
+
const o = d.current;
|
|
214
241
|
if (!o) return;
|
|
215
|
-
const
|
|
216
|
-
|
|
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
|
-
|
|
219
|
-
const
|
|
220
|
-
return
|
|
221
|
-
}, []);
|
|
222
|
-
const
|
|
223
|
-
if (!
|
|
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((
|
|
264
|
+
visibleIds: new Set(e.map((u) => u.id)),
|
|
226
265
|
overflowIds: /* @__PURE__ */ new Set()
|
|
227
266
|
};
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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
|
-
|
|
276
|
+
l += L + V, D.add(R);
|
|
237
277
|
}
|
|
238
|
-
return { visibleIds:
|
|
239
|
-
}, [e,
|
|
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:
|
|
244
|
-
className: "flex items-center gap-2 min-w-0 flex-1 overflow-
|
|
245
|
-
style:
|
|
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
|
-
(
|
|
287
|
+
(w ? b : e).map((o) => /* @__PURE__ */ n(
|
|
248
288
|
"div",
|
|
249
289
|
{
|
|
250
|
-
ref: (
|
|
251
|
-
|
|
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
|
-
|
|
298
|
+
w && g.length > 0 && /* @__PURE__ */ p(z.Root, { children: [
|
|
259
299
|
/* @__PURE__ */ n(
|
|
260
|
-
|
|
300
|
+
I,
|
|
261
301
|
{
|
|
262
302
|
size: "xs",
|
|
263
303
|
color: "secondary",
|
|
264
|
-
iconLeading: /* @__PURE__ */ n(
|
|
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(
|
|
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
|
|
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
|
-
|
|
285
|
-
|
|
325
|
+
Ae as TableToolbar,
|
|
326
|
+
Oe as pickCoreToolbarProps
|
|
286
327
|
};
|
|
@@ -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"}
|