@pibit.ai/cure-design-system 0.3.17 → 1.0.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.
- package/dist/assets/icons/group-by.svg.js +4 -0
- package/dist/assets/icons/reorder-dots-new.svg.js +4 -0
- package/dist/assets/icons/reorder-dots.svg.js +4 -0
- package/dist/assets/icons/resize-1.svg.js +4 -0
- package/dist/assets/icons/resize-2.svg.js +4 -0
- package/dist/assets/icons/resize-4.svg.js +4 -0
- package/dist/assets/icons/resize-5.svg.js +4 -0
- package/dist/assets/icons/show-summary.svg.js +4 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +125 -64
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/Group.js +46 -0
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/Item.js +34 -0
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/utils/auto-scroll.js +65 -0
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/utils/check-reorder.js +17 -0
- package/dist/node_modules/framer-motion/dist/es/context/ReorderContext.js +5 -0
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js +70 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-combine-values.js +15 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-computed.js +10 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-motion-value.js +15 -0
- package/dist/node_modules/framer-motion/dist/es/value/use-transform.js +23 -0
- package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/utils/transform.js +8 -0
- package/dist/node_modules/motion-dom/dist/es/value/index.js +21 -18
- package/dist/node_modules/motion-utils/dist/es/array.js +15 -6
- package/dist/patterns/table/TablePagination.d.ts +23 -0
- package/dist/patterns/table/TablePagination.d.ts.map +1 -0
- package/dist/patterns/table/TablePagination.js +60 -0
- package/dist/patterns/table/TableWrapper.d.ts +2 -72
- package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.js +730 -75
- package/dist/patterns/table/index.d.ts +11 -1
- package/dist/patterns/table/index.d.ts.map +1 -1
- package/dist/patterns/table/pagination-base.d.ts +78 -0
- package/dist/patterns/table/pagination-base.d.ts.map +1 -0
- package/dist/patterns/table/pagination-base.js +127 -0
- package/dist/patterns/table/pagination-card.d.ts +9 -0
- package/dist/patterns/table/pagination-card.d.ts.map +1 -0
- package/dist/patterns/table/pagination-card.js +65 -0
- package/dist/patterns/table/row-height-icons.d.ts +9 -0
- package/dist/patterns/table/row-height-icons.d.ts.map +1 -0
- package/dist/patterns/table/row-height-icons.js +13 -0
- package/dist/patterns/table/storyHelpers/mockToolbarSlots.d.ts +7 -0
- package/dist/patterns/table/storyHelpers/mockToolbarSlots.d.ts.map +1 -0
- package/dist/patterns/table/storyHelpers/useMockTableState.d.ts +31 -0
- package/dist/patterns/table/storyHelpers/useMockTableState.d.ts.map +1 -0
- package/dist/patterns/table/storyHelpers/useMockTableToolbar.d.ts +3 -0
- package/dist/patterns/table/storyHelpers/useMockTableToolbar.d.ts.map +1 -0
- package/dist/patterns/table/table.d.ts +10 -13
- package/dist/patterns/table/table.d.ts.map +1 -1
- package/dist/patterns/table/table.js +235 -312
- package/dist/patterns/table/toolbar/AlignDropdown.d.ts +11 -0
- package/dist/patterns/table/toolbar/AlignDropdown.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/AlignDropdown.js +77 -0
- package/dist/patterns/table/toolbar/BasicSortPanel.d.ts +6 -0
- package/dist/patterns/table/toolbar/BasicSortPanel.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/BulkActionBar.d.ts +12 -0
- package/dist/patterns/table/toolbar/BulkActionBar.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/BulkActionBar.js +62 -0
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts +41 -0
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.js +171 -0
- package/dist/patterns/table/toolbar/GroupByDropdown.d.ts +11 -0
- package/dist/patterns/table/toolbar/GroupByDropdown.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/GroupByDropdown.js +80 -0
- package/dist/patterns/table/toolbar/HideFieldsDropdown.d.ts +13 -0
- package/dist/patterns/table/toolbar/HideFieldsDropdown.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/HideFieldsDropdown.js +180 -0
- package/dist/patterns/table/toolbar/LegacySortFilterTools.d.ts +9 -0
- package/dist/patterns/table/toolbar/LegacySortFilterTools.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/RowActionsMenu.d.ts +19 -0
- package/dist/patterns/table/toolbar/RowActionsMenu.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/RowActionsMenu.js +84 -0
- package/dist/patterns/table/toolbar/RowHeightDropdown.d.ts +9 -0
- package/dist/patterns/table/toolbar/RowHeightDropdown.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/RowHeightDropdown.js +60 -0
- package/dist/patterns/table/toolbar/ShowSummaryDropdown.d.ts +8 -0
- package/dist/patterns/table/toolbar/ShowSummaryDropdown.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/ShowSummaryDropdown.js +22 -0
- package/dist/patterns/table/toolbar/SummaryFooter.d.ts +16 -0
- package/dist/patterns/table/toolbar/SummaryFooter.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/SummaryFooter.js +83 -0
- package/dist/patterns/table/toolbar/TableToolbar.d.ts +55 -0
- package/dist/patterns/table/toolbar/TableToolbar.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/TableToolbar.js +234 -0
- package/dist/patterns/table/toolbar/ToolbarRadio.d.ts +18 -0
- package/dist/patterns/table/toolbar/ToolbarRadio.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/ToolbarRadio.js +63 -0
- package/dist/patterns/table/toolbar/index.d.ts +24 -0
- package/dist/patterns/table/toolbar/index.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/legacyToolbarTypes.d.ts +69 -0
- package/dist/patterns/table/toolbar/legacyToolbarTypes.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/tableToolbarHelpers.d.ts +35 -0
- package/dist/patterns/table/toolbar/tableToolbarHelpers.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/tableToolbarHelpers.js +259 -0
- package/dist/patterns/table/toolbar/tableToolbarHelpers.test.d.ts +2 -0
- package/dist/patterns/table/toolbar/tableToolbarHelpers.test.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/toolbarExtensions.d.ts +12 -0
- package/dist/patterns/table/toolbar/toolbarExtensions.d.ts.map +1 -0
- package/dist/patterns/table/toolbar/toolbarExtensions.js +18 -0
- package/dist/patterns/table/toolbar-icons.d.ts +8 -0
- package/dist/patterns/table/toolbar-icons.d.ts.map +1 -0
- package/dist/patterns/table/toolbar-icons.js +13 -0
- package/dist/patterns/table/types.d.ts +141 -0
- package/dist/patterns/table/types.d.ts.map +1 -0
- package/dist/patterns/table/useGridKeyboardNavigation.d.ts +38 -0
- package/dist/patterns/table/useGridKeyboardNavigation.d.ts.map +1 -0
- package/dist/patterns/table/useGridKeyboardNavigation.js +65 -0
- package/dist/primitives/checkbox/checkbox.d.ts +2 -2
- package/dist/primitives/checkbox/checkbox.d.ts.map +1 -1
- package/dist/primitives/dropdown/dropdown.d.ts +32 -0
- package/dist/primitives/dropdown/dropdown.d.ts.map +1 -0
- package/dist/primitives/dropdown/dropdown.js +118 -0
- package/dist/primitives/dropdown/index.d.ts +2 -0
- package/dist/primitives/dropdown/index.d.ts.map +1 -0
- package/dist/primitives/select/ExpandableSearchInput.d.ts +5 -1
- package/dist/primitives/select/ExpandableSearchInput.d.ts.map +1 -1
- package/dist/primitives/select/ExpandableSearchInput.js +80 -77
- package/dist/primitives/shimmer/index.d.ts +2 -0
- package/dist/primitives/shimmer/index.d.ts.map +1 -0
- package/dist/primitives/shimmer/shimmer.d.ts +24 -0
- package/dist/primitives/shimmer/shimmer.d.ts.map +1 -0
- package/dist/primitives/shimmer/shimmer.js +37 -0
- package/dist/styles/components.css +1 -1
- package/dist/styles/theme.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
const T = {
|
|
2
|
+
small: "h-9!",
|
|
3
|
+
medium: "h-10!",
|
|
4
|
+
large: "h-11!",
|
|
5
|
+
xl: "h-16!"
|
|
6
|
+
};
|
|
7
|
+
function m(e) {
|
|
8
|
+
return typeof e == "object" && e !== null;
|
|
9
|
+
}
|
|
10
|
+
function g(e, n) {
|
|
11
|
+
var i;
|
|
12
|
+
if (!((i = n == null ? void 0 : n.trim) != null && i.call(n)) || e === null || e === void 0) return;
|
|
13
|
+
const a = n.split(".").filter((r) => r.length > 0);
|
|
14
|
+
let t = e;
|
|
15
|
+
for (const r of a) {
|
|
16
|
+
if (t == null) return;
|
|
17
|
+
if (m(t) && r in t) {
|
|
18
|
+
t = t[r];
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(t)) {
|
|
22
|
+
const u = t.find((s) => m(s) ? s.field_identifier === r || s.id === r || s.key === r : !1);
|
|
23
|
+
if (u !== void 0) {
|
|
24
|
+
t = u;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
}
|
|
32
|
+
function y(e, n) {
|
|
33
|
+
return !n || !e ? null : n.split(".").reduce((a, t) => {
|
|
34
|
+
if (!a || typeof a != "object") return null;
|
|
35
|
+
if (t.includes("[") && t.includes("]")) {
|
|
36
|
+
const r = t.substring(0, t.indexOf("[")), u = parseInt(t.substring(t.indexOf("[") + 1, t.indexOf("]")), 10), s = a;
|
|
37
|
+
return r && Array.isArray(s[r]) ? s[r][u] : null;
|
|
38
|
+
}
|
|
39
|
+
const i = a;
|
|
40
|
+
return i[t] !== void 0 ? i[t] : null;
|
|
41
|
+
}, e);
|
|
42
|
+
}
|
|
43
|
+
function E(e, n) {
|
|
44
|
+
if (e.label) return e.label;
|
|
45
|
+
if (n && typeof n == "object" && Object.keys(n).length > 0) {
|
|
46
|
+
const a = g(n, e.header);
|
|
47
|
+
if (a && typeof a.label == "string") return a.label;
|
|
48
|
+
}
|
|
49
|
+
return e.header;
|
|
50
|
+
}
|
|
51
|
+
function v(e, n, a) {
|
|
52
|
+
if (!e.length) return [];
|
|
53
|
+
const t = new Map(e.map((u) => [u.value, u])), i = [];
|
|
54
|
+
for (const u of a) {
|
|
55
|
+
const s = t.get(u);
|
|
56
|
+
s && !n.has(u) && i.push(s);
|
|
57
|
+
}
|
|
58
|
+
const r = new Set(a);
|
|
59
|
+
for (const u of e)
|
|
60
|
+
!r.has(u.value) && !n.has(u.value) && i.push(u);
|
|
61
|
+
return i;
|
|
62
|
+
}
|
|
63
|
+
function p(e) {
|
|
64
|
+
switch (e) {
|
|
65
|
+
case "number":
|
|
66
|
+
case "currency":
|
|
67
|
+
case "percentage":
|
|
68
|
+
case "decimal_percentage":
|
|
69
|
+
return "right";
|
|
70
|
+
default:
|
|
71
|
+
return "left";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function x(e, n) {
|
|
75
|
+
return n.get(e.value) ?? p(e.value_type);
|
|
76
|
+
}
|
|
77
|
+
function S(e) {
|
|
78
|
+
return e === "right" ? "text-right" : e === "center" ? "text-center" : "text-left";
|
|
79
|
+
}
|
|
80
|
+
const A = {
|
|
81
|
+
none: "-None-",
|
|
82
|
+
count: "Count",
|
|
83
|
+
sum: "Sum",
|
|
84
|
+
average: "Average",
|
|
85
|
+
median: "Median",
|
|
86
|
+
min: "Min",
|
|
87
|
+
max: "Max",
|
|
88
|
+
range: "Range",
|
|
89
|
+
totalItems: "Total Items"
|
|
90
|
+
}, R = {
|
|
91
|
+
none: "-None-",
|
|
92
|
+
count: "Count",
|
|
93
|
+
sum: "Sum",
|
|
94
|
+
average: "Avg",
|
|
95
|
+
median: "Med",
|
|
96
|
+
min: "Min",
|
|
97
|
+
max: "Max",
|
|
98
|
+
range: "Range",
|
|
99
|
+
totalItems: "Items"
|
|
100
|
+
};
|
|
101
|
+
function b(e) {
|
|
102
|
+
if (e)
|
|
103
|
+
switch (e.toUpperCase()) {
|
|
104
|
+
case "NUMBER":
|
|
105
|
+
case "INTEGER":
|
|
106
|
+
case "PERCENT":
|
|
107
|
+
return "number";
|
|
108
|
+
case "CURRENCY":
|
|
109
|
+
return "currency";
|
|
110
|
+
case "DATE":
|
|
111
|
+
case "TIMESTAMP":
|
|
112
|
+
return "date";
|
|
113
|
+
case "ARRAY":
|
|
114
|
+
return "array";
|
|
115
|
+
case "LINK":
|
|
116
|
+
return "link";
|
|
117
|
+
default:
|
|
118
|
+
return "string";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function N(e) {
|
|
122
|
+
const { value_type: n, data_type: a } = e;
|
|
123
|
+
if (n === "number" || n === "currency" || n === "percentage" || n === "decimal_percentage" || n === "date" || n === "array" || n === "link")
|
|
124
|
+
return n;
|
|
125
|
+
switch (a) {
|
|
126
|
+
case "number":
|
|
127
|
+
return "number";
|
|
128
|
+
case "currency":
|
|
129
|
+
return "currency";
|
|
130
|
+
case "date":
|
|
131
|
+
return "date";
|
|
132
|
+
case "percentage":
|
|
133
|
+
return "percentage";
|
|
134
|
+
case "array":
|
|
135
|
+
return "array";
|
|
136
|
+
case "link":
|
|
137
|
+
return "link";
|
|
138
|
+
default:
|
|
139
|
+
return n;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function w(e, n) {
|
|
143
|
+
return n && Object.prototype.hasOwnProperty.call(n, e.value) ? b(n[e.value]) : N(e);
|
|
144
|
+
}
|
|
145
|
+
function O(e) {
|
|
146
|
+
const n = (a) => a.map((t) => ({ id: t, label: A[t] }));
|
|
147
|
+
switch (e) {
|
|
148
|
+
case "number":
|
|
149
|
+
case "currency":
|
|
150
|
+
case "percentage":
|
|
151
|
+
case "decimal_percentage":
|
|
152
|
+
return n(["none", "count", "sum", "average", "median", "min", "max"]);
|
|
153
|
+
case "date":
|
|
154
|
+
return n(["none", "count", "min", "max", "range"]);
|
|
155
|
+
case "array":
|
|
156
|
+
return n(["none", "count", "totalItems"]);
|
|
157
|
+
case "string":
|
|
158
|
+
case "link":
|
|
159
|
+
default:
|
|
160
|
+
return n(["none", "count"]);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const _ = (e) => e == null ? !0 : typeof e == "string" ? e.trim() === "" : Array.isArray(e) ? e.length === 0 : !1, h = (e) => {
|
|
164
|
+
if (e == null || e === "") return null;
|
|
165
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
166
|
+
if (typeof e == "string") {
|
|
167
|
+
const n = e.replace(/[^0-9.-]/g, "");
|
|
168
|
+
if (n === "" || n === "-" || n === ".") return null;
|
|
169
|
+
const a = Number(n);
|
|
170
|
+
return Number.isFinite(a) ? a : null;
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
}, I = (e) => {
|
|
174
|
+
if (e == null || e === "") return null;
|
|
175
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
|
|
176
|
+
const n = new Date(String(e));
|
|
177
|
+
return Number.isNaN(n.getTime()) ? null : n;
|
|
178
|
+
}, c = (e) => Number.isFinite(e) ? Number.isInteger(e) ? e.toLocaleString() : e.toLocaleString(void 0, { maximumFractionDigits: 2 }) : "—";
|
|
179
|
+
function d(e, n) {
|
|
180
|
+
return Object.prototype.hasOwnProperty.call(e, n) ? e[n] : y(e, n);
|
|
181
|
+
}
|
|
182
|
+
function L(e, n, a) {
|
|
183
|
+
if (a === "none") return "";
|
|
184
|
+
const t = e.map((i) => d(i, n));
|
|
185
|
+
switch (a) {
|
|
186
|
+
case "count":
|
|
187
|
+
return String(t.length);
|
|
188
|
+
case "sum":
|
|
189
|
+
case "average":
|
|
190
|
+
case "median":
|
|
191
|
+
case "min":
|
|
192
|
+
case "max": {
|
|
193
|
+
const i = [];
|
|
194
|
+
for (const r of t) {
|
|
195
|
+
const u = h(r);
|
|
196
|
+
u !== null && i.push(u);
|
|
197
|
+
}
|
|
198
|
+
if (i.length === 0) return "—";
|
|
199
|
+
if (a === "sum") return c(i.reduce((r, u) => r + u, 0));
|
|
200
|
+
if (a === "average") return c(i.reduce((r, u) => r + u, 0) / i.length);
|
|
201
|
+
if (a === "median") {
|
|
202
|
+
const r = [...i].sort((f, o) => f - o), u = Math.floor(r.length / 2), s = r.length % 2 === 0 ? (r[u - 1] + r[u]) / 2 : r[u];
|
|
203
|
+
return c(s);
|
|
204
|
+
}
|
|
205
|
+
return c(a === "min" ? i.reduce((r, u) => u < r ? u : r) : i.reduce((r, u) => u > r ? u : r));
|
|
206
|
+
}
|
|
207
|
+
case "range": {
|
|
208
|
+
let i = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY, u = !1;
|
|
209
|
+
for (const f of t) {
|
|
210
|
+
const o = I(f);
|
|
211
|
+
if (!o) continue;
|
|
212
|
+
u = !0;
|
|
213
|
+
const l = o.getTime();
|
|
214
|
+
l < i && (i = l), l > r && (r = l);
|
|
215
|
+
}
|
|
216
|
+
if (!u) return "—";
|
|
217
|
+
const s = Math.round((r - i) / 864e5);
|
|
218
|
+
return `${s} day${s === 1 ? "" : "s"}`;
|
|
219
|
+
}
|
|
220
|
+
case "totalItems": {
|
|
221
|
+
let i = 0;
|
|
222
|
+
for (const r of t) Array.isArray(r) && (i += r.length);
|
|
223
|
+
return String(i);
|
|
224
|
+
}
|
|
225
|
+
default:
|
|
226
|
+
return "";
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function C(e, n) {
|
|
230
|
+
if (!n) return [{ key: "__all__", label: "", rows: e }];
|
|
231
|
+
const a = /* @__PURE__ */ new Map();
|
|
232
|
+
for (const t of e) {
|
|
233
|
+
const i = d(t, n), r = _(i) ? "__empty__" : String(i), u = a.get(r);
|
|
234
|
+
u ? u.push(t) : a.set(r, [t]);
|
|
235
|
+
}
|
|
236
|
+
return Array.from(a.entries()).map(([t, i]) => ({
|
|
237
|
+
key: t,
|
|
238
|
+
label: t === "__empty__" ? "(Empty)" : t,
|
|
239
|
+
rows: i
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
export {
|
|
243
|
+
R as AGGREGATION_CELL_LABELS,
|
|
244
|
+
A as AGGREGATION_LABELS,
|
|
245
|
+
T as ROW_HEIGHT_CLASS,
|
|
246
|
+
S as alignmentClass,
|
|
247
|
+
v as applyHideAndReorder,
|
|
248
|
+
L as computeAggregation,
|
|
249
|
+
O as getAggregationsForType,
|
|
250
|
+
p as getDefaultAlignmentForType,
|
|
251
|
+
x as getEffectiveAlignment,
|
|
252
|
+
y as getNestedValue,
|
|
253
|
+
g as getObjectLabelByPath,
|
|
254
|
+
d as getRowColumnValue,
|
|
255
|
+
C as groupRows,
|
|
256
|
+
b as mapOmDataTypeToAggregationValueType,
|
|
257
|
+
w as resolveAggregationValueType,
|
|
258
|
+
E as resolveColumnLabel
|
|
259
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableToolbarHelpers.test.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/tableToolbarHelpers.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
export type ToolbarExtensionComponents = {
|
|
3
|
+
/** Optional override — defaults to DS `BasicSortPanel` when omitted. */
|
|
4
|
+
SortComponent?: ComponentType<Record<string, unknown>>;
|
|
5
|
+
/** Required for legacy filter tool rendering (platform-ui `SchemaFilter`). */
|
|
6
|
+
SchemaFilter?: ComponentType<Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
export declare function registerToolbarExtensions(components: ToolbarExtensionComponents): void;
|
|
9
|
+
/** Reads optional `globalThis.__PIBIT_TOOLBAR_EXTENSIONS__` set by the host app. */
|
|
10
|
+
export declare function autoBootstrapPlatformToolbar(): void;
|
|
11
|
+
export declare function getToolbarExtensions(): Readonly<ToolbarExtensionComponents>;
|
|
12
|
+
//# sourceMappingURL=toolbarExtensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarExtensions.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/toolbarExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,0BAA0B,GAAG;IACvC,wEAAwE;IACxE,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvD,8EAA8E;IAC9E,YAAY,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvD,CAAC;AAIF,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,0BAA0B,GAAG,IAAI,CAEtF;AAED,oFAAoF;AACpF,wBAAgB,4BAA4B,IAAI,IAAI,CAQnD;AAED,wBAAgB,oBAAoB,IAAI,QAAQ,CAAC,0BAA0B,CAAC,CAO3E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
let n = {};
|
|
2
|
+
function t(o) {
|
|
3
|
+
n = { ...n, ...o };
|
|
4
|
+
}
|
|
5
|
+
function e() {
|
|
6
|
+
const o = typeof globalThis < "u" ? globalThis.__PIBIT_TOOLBAR_EXTENSIONS__ : void 0;
|
|
7
|
+
o && t(o);
|
|
8
|
+
}
|
|
9
|
+
function i() {
|
|
10
|
+
e();
|
|
11
|
+
const o = typeof globalThis < "u" ? globalThis.__PIBIT_TOOLBAR_EXTENSIONS__ : void 0;
|
|
12
|
+
return { ...n, ...o };
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
e as autoBootstrapPlatformToolbar,
|
|
16
|
+
i as getToolbarExtensions,
|
|
17
|
+
t as registerToolbarExtensions
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Toolbar icon URLs bundled with the design system. */
|
|
2
|
+
export declare const TOOLBAR_ICONS: {
|
|
3
|
+
readonly groupBy: string;
|
|
4
|
+
readonly showSummary: string;
|
|
5
|
+
readonly reorderDots: string;
|
|
6
|
+
readonly reorderDotsNew: string;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=toolbar-icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-icons.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/toolbar-icons.ts"],"names":[],"mappings":"AAKA,wDAAwD;AACxD,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import o from "../../assets/icons/group-by.svg.js";
|
|
2
|
+
import r from "../../assets/icons/show-summary.svg.js";
|
|
3
|
+
import m from "../../assets/icons/reorder-dots.svg.js";
|
|
4
|
+
import e from "../../assets/icons/reorder-dots-new.svg.js";
|
|
5
|
+
const n = {
|
|
6
|
+
groupBy: o,
|
|
7
|
+
showSummary: r,
|
|
8
|
+
reorderDots: m,
|
|
9
|
+
reorderDotsNew: e
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
n as TOOLBAR_ICONS
|
|
13
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TablePaginationConfig } from './TablePagination';
|
|
3
|
+
import { AlignToolConfig, GroupByToolConfig, HideFieldsToolConfig, RowHeightToolConfig, SearchToolConfig, SummaryToolConfig, CellAlignment, ColumnMenuAction, ColumnMenuCapabilities, RowActionsConfig, RowGroup, SummaryFooterRowProps } from './toolbar';
|
|
4
|
+
import { LegacyFilterToolConfig, LegacySortToolConfig } from './toolbar/legacyToolbarTypes';
|
|
5
|
+
/** Value type used for alignment defaults and aggregation eligibility. */
|
|
6
|
+
export type TableColumnValueType = "string" | "number" | "currency" | "date" | "percentage" | "decimal_percentage" | "array" | "link";
|
|
7
|
+
/**
|
|
8
|
+
* Generic column schema consumed by toolbar helpers and dropdown tools.
|
|
9
|
+
* Mirrors platform-ui `TableSchema` without app-specific imports.
|
|
10
|
+
*/
|
|
11
|
+
export interface TableColumnSchema {
|
|
12
|
+
value: string;
|
|
13
|
+
header: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
value_type?: TableColumnValueType;
|
|
16
|
+
data_type?: string;
|
|
17
|
+
/** When false, column is excluded from Group By. When true, always groupable. */
|
|
18
|
+
groupable?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Generic column metadata for `ColumnHeaderMenu`.
|
|
22
|
+
* Domain-specific menu rows can be supplied via `renderExtraItems`.
|
|
23
|
+
*/
|
|
24
|
+
export interface TableColumnMenuSchema {
|
|
25
|
+
key: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
dataType?: string;
|
|
28
|
+
variant?: "default" | "lookup" | "derived";
|
|
29
|
+
/** Shown in the formula header when `variant` is `"derived"`. */
|
|
30
|
+
formula?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Alias for `TablePaginationConfig` — matches platform-ui `TableWrapperPaginationConfig`. */
|
|
33
|
+
export type TableWrapperPaginationConfig = TablePaginationConfig;
|
|
34
|
+
export type TableWrapperToolbarConfig = {
|
|
35
|
+
sort?: LegacySortToolConfig;
|
|
36
|
+
filter?: LegacyFilterToolConfig;
|
|
37
|
+
search?: SearchToolConfig;
|
|
38
|
+
rowHeight?: RowHeightToolConfig;
|
|
39
|
+
hideFields?: HideFieldsToolConfig;
|
|
40
|
+
align?: AlignToolConfig;
|
|
41
|
+
groupBy?: GroupByToolConfig;
|
|
42
|
+
summary?: SummaryToolConfig;
|
|
43
|
+
/** Consumer-rendered sort UI. Required for sort popover content when `sort` is configured. */
|
|
44
|
+
sortContent?: ReactNode;
|
|
45
|
+
/** Consumer-rendered filter UI. Required for filter popover content when `filter` is configured. */
|
|
46
|
+
filterContent?: ReactNode;
|
|
47
|
+
};
|
|
48
|
+
/** Controlled selection value for TableWrapper (`"all"` = every row in the current body). */
|
|
49
|
+
export type TableWrapperSelectedKeys = "all" | ReadonlySet<string>;
|
|
50
|
+
/** Selection updates from TableWrapper (`"all"` or an explicit id set). */
|
|
51
|
+
export type TableWrapperSelectionChange = "all" | Set<string>;
|
|
52
|
+
/** Context for `renderBulkActionBar` — selected ids/rows plus clear helper. */
|
|
53
|
+
export type BulkActionContext<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
54
|
+
selectedKeys: ReadonlySet<string>;
|
|
55
|
+
selectedRows: T[];
|
|
56
|
+
clearSelection: () => void;
|
|
57
|
+
busy?: boolean;
|
|
58
|
+
};
|
|
59
|
+
export type TableWrapperEditChrome = {
|
|
60
|
+
onAddRow: () => void;
|
|
61
|
+
onDeleteRow: (sourceRowIndex: number) => void;
|
|
62
|
+
/** When true, render in-table "+ Add Row" footer (single-table layout only). */
|
|
63
|
+
showFooterRow?: boolean;
|
|
64
|
+
};
|
|
65
|
+
export type ColumnConfig = {
|
|
66
|
+
label: string;
|
|
67
|
+
key: string;
|
|
68
|
+
sticky?: "left" | "right";
|
|
69
|
+
stickyOffset?: number;
|
|
70
|
+
allowsSorting?: boolean;
|
|
71
|
+
maxWidth?: string;
|
|
72
|
+
minWidth?: string;
|
|
73
|
+
headClassName?: string;
|
|
74
|
+
cellClassName?: string;
|
|
75
|
+
headerCellClass?: string;
|
|
76
|
+
};
|
|
77
|
+
export type TableWrapperProps = {
|
|
78
|
+
data: any[];
|
|
79
|
+
columns: ColumnConfig[];
|
|
80
|
+
renderRowCell: (key: string, val: any, item: any) => ReactNode;
|
|
81
|
+
onRowClick?: (item: any) => void;
|
|
82
|
+
arialabel?: string;
|
|
83
|
+
size?: "sm" | "md" | "xs";
|
|
84
|
+
allowDefaultRowClass?: boolean;
|
|
85
|
+
centeredHeaders?: string[];
|
|
86
|
+
tableClassName?: string;
|
|
87
|
+
headerClassName?: string;
|
|
88
|
+
rootClassName?: string;
|
|
89
|
+
removeBorders?: boolean;
|
|
90
|
+
isRowExpandable?: (item: any) => boolean;
|
|
91
|
+
renderExpandedContent?: (item: any) => ReactNode;
|
|
92
|
+
loading?: boolean;
|
|
93
|
+
loadingRowCount?: number;
|
|
94
|
+
renderHeaderCell?: (key: string) => ReactNode;
|
|
95
|
+
getRowClassName?: (item: any) => string | undefined;
|
|
96
|
+
selectionMode?: "none" | "single" | "multiple";
|
|
97
|
+
selectedKeys?: TableWrapperSelectedKeys;
|
|
98
|
+
onSelectionChange?: (keys: TableWrapperSelectionChange) => void;
|
|
99
|
+
inlineSelection?: boolean;
|
|
100
|
+
toolbar?: TableWrapperToolbarConfig;
|
|
101
|
+
showToolbar?: boolean;
|
|
102
|
+
toolbarTitle?: string;
|
|
103
|
+
toolbarTrailing?: ReactNode;
|
|
104
|
+
pagination?: TableWrapperPaginationConfig;
|
|
105
|
+
showBorders?: boolean;
|
|
106
|
+
emptyState?: ReactNode;
|
|
107
|
+
editChrome?: TableWrapperEditChrome;
|
|
108
|
+
showEditActions?: boolean;
|
|
109
|
+
searchCollapsible?: boolean;
|
|
110
|
+
disableExtendedTools?: boolean;
|
|
111
|
+
isEditable?: boolean;
|
|
112
|
+
rowHeightClass?: string;
|
|
113
|
+
groupedData?: RowGroup<Record<string, unknown>>[];
|
|
114
|
+
showSummaryFooter?: boolean;
|
|
115
|
+
summaryFooterProps?: SummaryFooterRowProps;
|
|
116
|
+
bulkActionBar?: ReactNode;
|
|
117
|
+
renderBulkActionBar?: (ctx: BulkActionContext) => ReactNode;
|
|
118
|
+
onBulkDuplicate?: () => void | Promise<void>;
|
|
119
|
+
onBulkDelete?: () => void | Promise<void>;
|
|
120
|
+
bulkActionBusy?: boolean;
|
|
121
|
+
columnAlignments?: ReadonlyMap<string, CellAlignment>;
|
|
122
|
+
onColumnHeaderAction?: (columnKey: string, action: ColumnMenuAction) => void;
|
|
123
|
+
showColumnHeaderMenu?: boolean;
|
|
124
|
+
columnMenuCapabilities?: ColumnMenuCapabilities;
|
|
125
|
+
renderGroupHeader?: (group: RowGroup<Record<string, unknown>>) => ReactNode;
|
|
126
|
+
/** Schema entries for `ColumnHeaderMenu` (matched by column `key`). */
|
|
127
|
+
columnMenuSchema?: TableColumnMenuSchema[];
|
|
128
|
+
/** Column schema for alignment defaults (`getEffectiveAlignment`). */
|
|
129
|
+
columnSchema?: TableColumnSchema[];
|
|
130
|
+
labelMeta?: unknown;
|
|
131
|
+
toolbarSlot?: ReactNode;
|
|
132
|
+
fillWidth?: boolean;
|
|
133
|
+
rowActions?: RowActionsConfig;
|
|
134
|
+
onCellActivate?: (info: {
|
|
135
|
+
rowId: string;
|
|
136
|
+
columnKey: string;
|
|
137
|
+
sourceIndex: number | null;
|
|
138
|
+
}) => void;
|
|
139
|
+
renderColumnHeaderMenuExtraItems?: (column: TableColumnMenuSchema) => ReactNode;
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACjG,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,QAAQ,EACR,qBAAqB,EACtB,MAAM,WAAW,CAAC;AAEnB,0EAA0E;AAC1E,MAAM,MAAM,oBAAoB,GAC5B,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,MA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U,CAAC,EAAE,gBAAgB,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IAClG,gCAAgC,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,SAAS,CAAC;CACjF,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
export type GridNavDirection = "up" | "down" | "left" | "right";
|
|
3
|
+
export interface GridNeighbor {
|
|
4
|
+
rowId: string;
|
|
5
|
+
columnKey: string;
|
|
6
|
+
sourceIndex: number | null;
|
|
7
|
+
element: HTMLElement;
|
|
8
|
+
}
|
|
9
|
+
export interface GridNavValue {
|
|
10
|
+
getNeighbor: (rowId: string, columnKey: string, dir: GridNavDirection) => GridNeighbor | null;
|
|
11
|
+
getTabNeighbor: (rowId: string, columnKey: string, forward: boolean) => GridNeighbor | null;
|
|
12
|
+
focusCell: (rowId: string, columnKey: string) => boolean;
|
|
13
|
+
selectCell: (rowId: string, columnKey: string, sourceIndex?: number | null) => void;
|
|
14
|
+
setEditingCell: (cell: {
|
|
15
|
+
rowId: string;
|
|
16
|
+
columnKey: string;
|
|
17
|
+
} | null) => void;
|
|
18
|
+
}
|
|
19
|
+
/** True when `target` is inside an editable control, so the cell editor owns the keystroke. */
|
|
20
|
+
export declare const isWithinCellEditor: (target: EventTarget | null) => boolean;
|
|
21
|
+
export declare const findGridCell: (container: HTMLElement | null, rowId: string, columnKey: string) => HTMLElement | null;
|
|
22
|
+
export declare const getGridNeighbor: (container: HTMLElement | null, rowIds: readonly string[], columnKeys: readonly string[], rowId: string, columnKey: string, dir: GridNavDirection) => GridNeighbor | null;
|
|
23
|
+
export declare const getGridTabNeighbor: (container: HTMLElement | null, rowIds: readonly string[], columnKeys: readonly string[], rowId: string, columnKey: string, forward: boolean) => GridNeighbor | null;
|
|
24
|
+
export declare const focusGridCellElement: (cell: HTMLElement | null) => boolean;
|
|
25
|
+
export declare const focusGridCell: (container: HTMLElement | null, rowId: string, columnKey: string) => boolean;
|
|
26
|
+
export declare const GridNavProvider: ({ rowIds, columnKeys, containerRef, onSelectCell, onEditingCellChange, children, }: {
|
|
27
|
+
rowIds: string[];
|
|
28
|
+
columnKeys: string[];
|
|
29
|
+
containerRef: RefObject<HTMLElement | null>;
|
|
30
|
+
onSelectCell: (rowId: string, columnKey: string, sourceIndex?: number | null) => void;
|
|
31
|
+
onEditingCellChange: (cell: {
|
|
32
|
+
rowId: string;
|
|
33
|
+
columnKey: string;
|
|
34
|
+
} | null) => void;
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare const useGridKeyboardNavigation: () => GridNavValue | null;
|
|
38
|
+
//# sourceMappingURL=useGridKeyboardNavigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGridKeyboardNavigation.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/useGridKeyboardNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmD,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExG,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,gBAAgB,KAAK,YAAY,GAAG,IAAI,CAAC;IAC9F,cAAc,EA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EAAE,WAAW,MAAM,KAAG,OAC/B,CAAC;AAElE,eAAO,MAAM,eAAe,GAAI,oFAO7B;IACD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC5C,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtF,mBAAmB,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACjF,QAAQ,EAAE,SAAS,CAAC;CACrB,4CA8BA,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAO,YAAY,GAAG,IAAkC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as h, useCallback as g, useMemo as p, createContext as G } from "react";
|
|
3
|
+
const x = G(null), S = (e, t) => `[data-grid-cell][data-grid-row-id="${CSS.escape(e)}"][data-grid-col-key="${CSS.escape(t)}"]`, q = (e) => e instanceof HTMLElement ? !!(e.closest('[contenteditable]:not([contenteditable="false"])') || e.closest("input, textarea, select") || e.closest('[role="textbox"]')) : !1, b = (e, t, r) => (e == null ? void 0 : e.querySelector(S(t, r))) ?? null, N = (e, t, r, u, c) => {
|
|
4
|
+
if (u < 0 || u >= t.length || c < 0 || c >= r.length) return null;
|
|
5
|
+
const s = t[u], i = r[c], l = b(e, s, i);
|
|
6
|
+
if (!l) return null;
|
|
7
|
+
const n = l.getAttribute("data-grid-source-index"), o = n != null && n !== "" ? Number(n) : NaN;
|
|
8
|
+
return {
|
|
9
|
+
rowId: s,
|
|
10
|
+
columnKey: i,
|
|
11
|
+
sourceIndex: Number.isNaN(o) ? null : o,
|
|
12
|
+
element: l
|
|
13
|
+
};
|
|
14
|
+
}, v = (e, t, r, u, c, s) => {
|
|
15
|
+
const i = t.indexOf(u), l = r.indexOf(c);
|
|
16
|
+
if (i === -1 || l === -1) return null;
|
|
17
|
+
let n = i, o = l;
|
|
18
|
+
return s === "up" ? n -= 1 : s === "down" ? n += 1 : s === "left" ? o -= 1 : s === "right" && (o += 1), N(e, t, r, n, o);
|
|
19
|
+
}, m = (e, t, r, u, c, s) => {
|
|
20
|
+
const i = t.indexOf(u), l = r.indexOf(c);
|
|
21
|
+
if (i === -1 || l === -1) return null;
|
|
22
|
+
let n = i, o = l + (s ? 1 : -1);
|
|
23
|
+
return o >= r.length ? (o = 0, n += 1) : o < 0 && (o = r.length - 1, n -= 1), N(e, t, r, n, o);
|
|
24
|
+
}, I = (e) => (e == null ? void 0 : e.querySelector("[data-grid-focus]")) ?? e, O = (e) => {
|
|
25
|
+
const t = I(e);
|
|
26
|
+
return !t || typeof t.focus != "function" ? !1 : (t.focus(), !0);
|
|
27
|
+
}, T = (e, t, r) => O(b(e, t, r)), M = ({
|
|
28
|
+
rowIds: e,
|
|
29
|
+
columnKeys: t,
|
|
30
|
+
containerRef: r,
|
|
31
|
+
onSelectCell: u,
|
|
32
|
+
onEditingCellChange: c,
|
|
33
|
+
children: s
|
|
34
|
+
}) => {
|
|
35
|
+
const i = g(
|
|
36
|
+
(d, f, a) => v(r.current, e, t, d, f, a),
|
|
37
|
+
[r, e, t]
|
|
38
|
+
), l = g(
|
|
39
|
+
(d, f, a) => m(r.current, e, t, d, f, a),
|
|
40
|
+
[r, e, t]
|
|
41
|
+
), n = g(
|
|
42
|
+
(d, f) => T(r.current, d, f),
|
|
43
|
+
[r]
|
|
44
|
+
), o = p(
|
|
45
|
+
() => ({
|
|
46
|
+
getNeighbor: i,
|
|
47
|
+
getTabNeighbor: l,
|
|
48
|
+
focusCell: n,
|
|
49
|
+
selectCell: u,
|
|
50
|
+
setEditingCell: c
|
|
51
|
+
}),
|
|
52
|
+
[i, l, n, u, c]
|
|
53
|
+
);
|
|
54
|
+
return /* @__PURE__ */ C(x.Provider, { value: o, children: s });
|
|
55
|
+
}, P = () => h(x);
|
|
56
|
+
export {
|
|
57
|
+
M as GridNavProvider,
|
|
58
|
+
b as findGridCell,
|
|
59
|
+
T as focusGridCell,
|
|
60
|
+
O as focusGridCellElement,
|
|
61
|
+
v as getGridNeighbor,
|
|
62
|
+
m as getGridTabNeighbor,
|
|
63
|
+
q as isWithinCellEditor,
|
|
64
|
+
P as useGridKeyboardNavigation
|
|
65
|
+
};
|
|
@@ -5,8 +5,8 @@ export interface CheckboxProps extends Omit<RadixCheckbox.CheckboxProps, 'checke
|
|
|
5
5
|
label?: ReactNode;
|
|
6
6
|
/** Description text */
|
|
7
7
|
description?: string;
|
|
8
|
-
/** Checked state */
|
|
9
|
-
checked?: boolean;
|
|
8
|
+
/** Checked state (Radix also supports `"indeterminate"`). */
|
|
9
|
+
checked?: boolean | "indeterminate";
|
|
10
10
|
/** Additional CSS classes */
|
|
11
11
|
className?: string;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/primitives/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,SAAS,CAAC;IACpD,qBAAqB;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/primitives/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAC;AAG1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,SAAS,CAAC;IACpD,qBAAqB;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IACpC,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,EAAE,EACF,GAAG,KAAK,EACT,EAAE,aAAa,2CAwCf;yBA/Ce,QAAQ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC, RefAttributes } from 'react';
|
|
2
|
+
import { ButtonProps as AriaButtonProps, MenuItemProps as AriaMenuItemProps, MenuProps as AriaMenuProps, PopoverProps as AriaPopoverProps, SeparatorProps as AriaSeparatorProps, MenuTrigger as AriaMenuTrigger } from 'react-aria-components';
|
|
3
|
+
interface DropdownItemProps extends AriaMenuItemProps {
|
|
4
|
+
/** The label of the item to be displayed. */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** An addon to be displayed on the right side of the item. */
|
|
7
|
+
addon?: string;
|
|
8
|
+
/** If true, the item will not have any styles. */
|
|
9
|
+
unstyled?: boolean;
|
|
10
|
+
/** An icon to be displayed on the left side of the item. */
|
|
11
|
+
icon?: FC<{
|
|
12
|
+
className?: string;
|
|
13
|
+
}>;
|
|
14
|
+
/** If true, the item will be selected. */
|
|
15
|
+
isSelected?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface DropdownMenuProps<T extends object> extends AriaMenuProps<T> {
|
|
18
|
+
}
|
|
19
|
+
interface DropdownPopoverProps extends AriaPopoverProps {
|
|
20
|
+
}
|
|
21
|
+
export declare const Dropdown: {
|
|
22
|
+
Root: typeof AriaMenuTrigger;
|
|
23
|
+
Popover: (props: DropdownPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
Menu: <T extends object>(props: DropdownMenuProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
Section: <T extends object>(props: import('react-aria-components').MenuSectionProps<T> & React.RefAttributes<HTMLElement>) => import('react').ReactElement | null;
|
|
26
|
+
SectionHeader: (props: React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
|
|
27
|
+
Item: ({ label, children, addon, icon: Icon, unstyled, isSelected, ...props }: DropdownItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
Separator: (props: AriaSeparatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
DotsButton: (props: AriaButtonProps & RefAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
};
|
|
31
|
+
export type { DropdownItemProps, DropdownMenuProps, DropdownPopoverProps };
|
|
32
|
+
//# sourceMappingURL=dropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/primitives/dropdown/dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,aAAa,IAAI,iBAAiB,EAClC,SAAS,IAAI,aAAa,EAC1B,YAAY,IAAI,gBAAgB,EAChC,cAAc,IAAI,kBAAkB,EACrC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAML,WAAW,IAAI,eAAe,EAG/B,MAAM,uBAAuB,CAAC;AAG/B,UAAU,iBAAkB,SAAQ,iBAAiB;IACnD,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CA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