@caspeco/casper-ui-library 10.8.0 → 10.9.1
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/components/phone-input/country-data.d.ts +4 -1
- package/dist/components/phone-input/country-data.d.ts.map +1 -1
- package/dist/components/phone-input/country-data.js +1 -1
- package/dist/components/phone-input/translations.js +18 -18
- package/dist/components/table/helper.d.ts +3 -0
- package/dist/components/table/helper.d.ts.map +1 -1
- package/dist/components/table/helper.js +17 -11
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/table-cell.d.ts +2 -1
- package/dist/components/table/table-cell.d.ts.map +1 -1
- package/dist/components/table/table-cell.js +62 -55
- package/dist/components/table/table-content.d.ts.map +1 -1
- package/dist/components/table/table-content.js +84 -56
- package/dist/components/table/table-context-provider.d.ts +17 -2
- package/dist/components/table/table-context-provider.d.ts.map +1 -1
- package/dist/components/table/table-context-provider.js +179 -122
- package/dist/components/table/table-drag-accessibility.d.ts +11 -0
- package/dist/components/table/table-drag-accessibility.d.ts.map +1 -0
- package/dist/components/table/table-drag-accessibility.js +22 -0
- package/dist/components/table/table-header-row.d.ts.map +1 -1
- package/dist/components/table/table-header-row.js +70 -62
- package/dist/components/table/table-recipe.d.ts.map +1 -1
- package/dist/components/table/table-recipe.js +6 -0
- package/dist/components/table/table-row-drag-handle.d.ts +6 -0
- package/dist/components/table/table-row-drag-handle.d.ts.map +1 -0
- package/dist/components/table/table-row-drag-handle.js +53 -0
- package/dist/components/table/table-row-reorder.spec.d.ts +2 -0
- package/dist/components/table/table-row-reorder.spec.d.ts.map +1 -0
- package/dist/components/table/table-row.d.ts.map +1 -1
- package/dist/components/table/table-row.js +59 -42
- package/dist/components/table/table-sorted-reorder-prompt.d.ts +8 -0
- package/dist/components/table/table-sorted-reorder-prompt.d.ts.map +1 -0
- package/dist/components/table/table-sorted-reorder-prompt.js +64 -0
- package/dist/components/table/table-toolbar-settings.js +27 -27
- package/dist/components/table/table.composition.d.ts +2 -0
- package/dist/components/table/table.composition.d.ts.map +1 -1
- package/dist/components/table/table.constants.d.ts +15 -0
- package/dist/components/table/table.constants.d.ts.map +1 -1
- package/dist/components/table/table.constants.js +2 -2
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +4 -2
- package/dist/components/table/translations.d.ts +70 -0
- package/dist/components/table/translations.d.ts.map +1 -1
- package/dist/components/table/translations.js +66 -6
- package/dist/components/table/types.d.ts +37 -5
- package/dist/components/table/types.d.ts.map +1 -1
- package/dist/node_modules/@tiptap/core/dist/index.js +84 -74
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +1 -1
- package/dist/node_modules/libphonenumber-js/metadata.mobile.json.js +27 -30
- package/package.json +15 -15
|
@@ -12,65 +12,73 @@ import { MenuList as f } from "../menu/menu-list.js";
|
|
|
12
12
|
import { Checkbox as p } from "../checkbox/checkbox.js";
|
|
13
13
|
import { Divider as m } from "../divider/divider.js";
|
|
14
14
|
import { flexRender as h } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
15
|
+
import { COLUMN_SORTABLE_TYPE as g } from "./table.constants.js";
|
|
16
|
+
import { getColumnWidth as _, getPinnedLeft as v } from "./helper.js";
|
|
17
|
+
import { useTableContext as y } from "./table-context.js";
|
|
18
|
+
import { interpolate as b, translations as x } from "./translations.js";
|
|
19
|
+
import { closestCenter as S } from "../../node_modules/@dnd-kit/collision/dist/index.js";
|
|
20
|
+
import { SortableKeyboardPlugin as C } from "../../node_modules/@dnd-kit/dom/sortable.js";
|
|
21
|
+
import { useSortable as w } from "../../node_modules/@dnd-kit/react/sortable.js";
|
|
22
|
+
import { ColumnResizeHandle as T } from "./table-column-resize-handle.js";
|
|
23
|
+
import { TableHeaderDropdown as E } from "./table-header-dropdown.js";
|
|
24
|
+
import { memo as D, useCallback as O, useMemo as k } from "react";
|
|
25
|
+
import { Box as A, Portal as j, Table as M, useMediaQuery as N } from "@chakra-ui/react";
|
|
26
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
26
27
|
//#region lib/components/table/table-header-row.tsx
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
function L(e, t) {
|
|
29
|
+
return (e ? 24 : 0) + (t ? 24 : 0);
|
|
30
|
+
}
|
|
31
|
+
var R = ({ headerGroup: t, hideTableHeaderDropdown: n, portalContainerRef: r }) => {
|
|
32
|
+
let i = y(), a = !!i.getRowActions, o = L(a, i.rowReorderMode !== "off"), s = (i.selectedRowIds?.length ?? 0) > 0 && (i.selectionActions?.length ?? 0) > 0, c = +!!i.enableColumnResizing;
|
|
33
|
+
return /* @__PURE__ */ F(P, { children: /* @__PURE__ */ F(M.Row, { children: s ? /* @__PURE__ */ F(M.ColumnHeader, {
|
|
34
|
+
colSpan: t.headers.length + c,
|
|
31
35
|
cursor: "default",
|
|
32
36
|
css: {
|
|
33
37
|
"& div:not(label *):hover": { backgroundColor: "transparent !important" },
|
|
34
38
|
"& div span": { color: e.OnBackground },
|
|
35
39
|
borderBottom: `1px solid ${e.OnBackgroundBorder}`,
|
|
36
|
-
paddingLeft:
|
|
40
|
+
paddingLeft: o ? `${o}px` : void 0
|
|
37
41
|
},
|
|
38
42
|
scope: "col",
|
|
39
43
|
zIndex: 1,
|
|
40
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ F(V, {
|
|
41
45
|
showSelectAll: !0,
|
|
42
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ F(U, {})
|
|
43
47
|
})
|
|
44
|
-
}) : /* @__PURE__ */
|
|
48
|
+
}) : /* @__PURE__ */ I(P, { children: [t.headers.map((e, t) => /* @__PURE__ */ F(z, {
|
|
45
49
|
header: e,
|
|
46
50
|
hideTableHeaderDropdown: n,
|
|
47
51
|
applyActionMenuPadding: a,
|
|
48
52
|
portalContainerRef: r,
|
|
49
53
|
isFirstColumn: !e.isPlaceholder && t === 0,
|
|
54
|
+
leadingSlotsWidth: o,
|
|
50
55
|
enableColumnReorder: i.enableColumnReorder
|
|
51
|
-
}, e.id)), i.enableColumnResizing && /* @__PURE__ */
|
|
52
|
-
},
|
|
53
|
-
let c =
|
|
56
|
+
}, e.id)), i.enableColumnResizing && /* @__PURE__ */ F(B, {})] }) }, t.id) });
|
|
57
|
+
}, z = ({ header: t, hideTableHeaderDropdown: n, portalContainerRef: i, isFirstColumn: a = !1, leadingSlotsWidth: o = 0, enableColumnReorder: s = !1 }) => {
|
|
58
|
+
let c = y(), { column: l } = t, u = c.enableColumnResizing, d = u && l.getCanResize(), f = s && !l.columnDef.meta?.disableColumnReorder, { ref: p, isDragging: m, isDropTarget: b } = w({
|
|
54
59
|
id: l.id,
|
|
55
60
|
index: l.getIndex(),
|
|
61
|
+
type: g,
|
|
62
|
+
accept: g,
|
|
63
|
+
group: g,
|
|
56
64
|
disabled: !f,
|
|
57
|
-
collisionDetector:
|
|
58
|
-
plugins: [
|
|
65
|
+
collisionDetector: S,
|
|
66
|
+
plugins: [C]
|
|
59
67
|
});
|
|
60
|
-
return /* @__PURE__ */
|
|
68
|
+
return /* @__PURE__ */ I(M.ColumnHeader, {
|
|
61
69
|
className: "tableHeaderCell",
|
|
62
70
|
textAlign: l.columnDef.meta?.isNumeric ? "end" : "start",
|
|
63
71
|
zIndex: l.getIsPinned() ? 2 : 1,
|
|
64
72
|
cursor: s ? m ? "grabbing" : "pointer" : void 0,
|
|
65
73
|
opacity: m ? .5 : 1,
|
|
66
|
-
backgroundColor:
|
|
74
|
+
backgroundColor: b || m ? e.Background : void 0,
|
|
67
75
|
scope: "col",
|
|
68
76
|
style: {
|
|
69
77
|
...((t) => {
|
|
70
|
-
let n = t.getIsPinned(), r =
|
|
78
|
+
let n = t.getIsPinned(), r = _(t, u);
|
|
71
79
|
return {
|
|
72
80
|
position: n ? "sticky" : "relative",
|
|
73
|
-
left: n ?
|
|
81
|
+
left: n ? v(t, u) : void 0,
|
|
74
82
|
backgroundColor: n ? e.Background : void 0,
|
|
75
83
|
zIndex: +!!n,
|
|
76
84
|
width: r,
|
|
@@ -78,18 +86,18 @@ var I = ({ headerGroup: t, hideTableHeaderDropdown: n, portalContainerRef: r })
|
|
|
78
86
|
};
|
|
79
87
|
})(l),
|
|
80
88
|
borderBottom: `1px solid ${e.OnBackgroundBorder}`,
|
|
81
|
-
paddingLeft:
|
|
89
|
+
paddingLeft: a && o ? `${o}px` : void 0,
|
|
82
90
|
...f ? {
|
|
83
91
|
userSelect: "none",
|
|
84
92
|
WebkitUserSelect: "none"
|
|
85
93
|
} : {}
|
|
86
94
|
},
|
|
87
|
-
children: [/* @__PURE__ */
|
|
88
|
-
showSelectAll: c.canSelectRows &&
|
|
89
|
-
children: /* @__PURE__ */ P
|
|
95
|
+
children: [/* @__PURE__ */ F(V, {
|
|
96
|
+
showSelectAll: c.canSelectRows && a,
|
|
97
|
+
children: /* @__PURE__ */ F(P, { children: n ? /* @__PURE__ */ F(A, {
|
|
90
98
|
paddingLeft: r.Small,
|
|
91
99
|
children: h(t.column.columnDef.header, t.getContext())
|
|
92
|
-
}) : /* @__PURE__ */
|
|
100
|
+
}) : /* @__PURE__ */ F(E, {
|
|
93
101
|
header: t,
|
|
94
102
|
breakingContentState: c.breakingContentState,
|
|
95
103
|
headerGroup: c.table.getHeaderGroups(),
|
|
@@ -98,104 +106,104 @@ var I = ({ headerGroup: t, hideTableHeaderDropdown: n, portalContainerRef: r })
|
|
|
98
106
|
setSorting: c.setSorting,
|
|
99
107
|
sorting: c.sorting,
|
|
100
108
|
onBreakingContentChange: c.onBreakingContentChange,
|
|
101
|
-
portalContainerRef:
|
|
109
|
+
portalContainerRef: i,
|
|
102
110
|
dragRef: f ? p : void 0
|
|
103
111
|
}) })
|
|
104
|
-
}), d && /* @__PURE__ */
|
|
112
|
+
}), d && /* @__PURE__ */ F(T, { header: t })]
|
|
105
113
|
});
|
|
106
|
-
},
|
|
114
|
+
}, B = () => /* @__PURE__ */ F(M.ColumnHeader, {
|
|
107
115
|
"aria-hidden": !0,
|
|
108
116
|
scope: "col",
|
|
109
117
|
style: { borderBottom: `1px solid ${e.OnBackgroundBorder}` }
|
|
110
|
-
}),
|
|
118
|
+
}), V = ({ showSelectAll: e, children: t }) => e ? /* @__PURE__ */ I(l, {
|
|
111
119
|
w: "100%",
|
|
112
120
|
align: "center",
|
|
113
|
-
children: [/* @__PURE__ */
|
|
121
|
+
children: [/* @__PURE__ */ F(A, {
|
|
114
122
|
justifyContent: "center",
|
|
115
123
|
alignItems: "center",
|
|
116
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ F(H, {})
|
|
117
125
|
}), t]
|
|
118
|
-
}) : /* @__PURE__ */ P
|
|
119
|
-
let e =
|
|
126
|
+
}) : /* @__PURE__ */ F(P, { children: t }), H = () => {
|
|
127
|
+
let e = y(), t = O(({ checked: t }) => {
|
|
120
128
|
let n = typeof t == "boolean" && t, r = e.getSelectableRowIds();
|
|
121
129
|
n ? e.setSelectedRowIds((e) => [.../* @__PURE__ */ new Set([...e, ...r])]) : e.setSelectedRowIds((e) => e.filter((e) => !r.includes(e)));
|
|
122
|
-
}, [e]), { allIsSelected: n, shouldShowIndeterminateState: r } =
|
|
130
|
+
}, [e]), { allIsSelected: n, shouldShowIndeterminateState: r } = k(() => {
|
|
123
131
|
let t = e.table.getRowModel().flatRows, n = new Set(e.selectedRowIds), r = e.getSelectableRowIds(), i = r.length > 0 && r.every((e) => n.has(e));
|
|
124
132
|
return {
|
|
125
133
|
allIsSelected: i,
|
|
126
134
|
shouldShowIndeterminateState: t.some((e) => n.has(e.id)) && !i
|
|
127
135
|
};
|
|
128
136
|
}, [e]);
|
|
129
|
-
return /* @__PURE__ */
|
|
137
|
+
return /* @__PURE__ */ F(p, {
|
|
130
138
|
isChecked: n,
|
|
131
139
|
isIndeterminate: r,
|
|
132
140
|
onCheckedChange: t
|
|
133
141
|
});
|
|
134
|
-
},
|
|
135
|
-
let { localeString: i, selectedRowIds: s = [], selectionActions: u = [], totalDataCount: d } =
|
|
142
|
+
}, U = () => {
|
|
143
|
+
let { localeString: i, selectedRowIds: s = [], selectionActions: u = [], totalDataCount: d } = y(), p = x[i], [h] = N(["(min-width: 48em)"]), g = u.length > 3 || !h, _ = s.length, v = d ? b(p.selectedWithTotal, {
|
|
136
144
|
count: _,
|
|
137
145
|
total: d
|
|
138
|
-
}) : s.length === 1 ?
|
|
139
|
-
return /* @__PURE__ */
|
|
146
|
+
}) : s.length === 1 ? b(p.selectedSingular, { count: 1 }) : b(p.selected, { count: _ });
|
|
147
|
+
return /* @__PURE__ */ I(l, {
|
|
140
148
|
gap: r.Medium,
|
|
141
149
|
align: "center",
|
|
142
150
|
alignContent: "center",
|
|
143
151
|
children: [
|
|
144
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ F(A, {
|
|
145
153
|
pl: r.Small,
|
|
146
154
|
color: e.OnBackground,
|
|
147
155
|
fontFamily: n.Body,
|
|
148
156
|
fontSize: t.Medium,
|
|
149
157
|
whiteSpace: "nowrap",
|
|
150
158
|
css: { fontVariantNumeric: "normal" },
|
|
151
|
-
children:
|
|
159
|
+
children: v
|
|
152
160
|
}),
|
|
153
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ F(A, { children: /* @__PURE__ */ F(m, {
|
|
154
162
|
orientation: "vertical",
|
|
155
163
|
height: "20px"
|
|
156
164
|
}) }),
|
|
157
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ F(l, {
|
|
158
166
|
gap: r.Small,
|
|
159
167
|
align: "center",
|
|
160
|
-
children: g ? /* @__PURE__ */
|
|
168
|
+
children: g ? /* @__PURE__ */ I(o, { children: [/* @__PURE__ */ F(c, {
|
|
161
169
|
variant: "ghost",
|
|
162
170
|
rightIcon: a,
|
|
163
171
|
size: "sm",
|
|
164
172
|
children: p.action
|
|
165
|
-
}), /* @__PURE__ */
|
|
173
|
+
}), /* @__PURE__ */ F(j, { children: /* @__PURE__ */ F(f, { children: u.map((e) => /* @__PURE__ */ F(W, {
|
|
166
174
|
isMenuItem: !0,
|
|
167
175
|
action: e
|
|
168
|
-
}, e.name)) }) })] }) : u.map((e) => /* @__PURE__ */
|
|
176
|
+
}, e.name)) }) })] }) : u.map((e) => /* @__PURE__ */ F(W, {
|
|
169
177
|
isMenuItem: !1,
|
|
170
178
|
action: e
|
|
171
179
|
}, e.name))
|
|
172
180
|
})
|
|
173
181
|
]
|
|
174
182
|
});
|
|
175
|
-
},
|
|
176
|
-
let { selectedRowIds: r, localeString: a } =
|
|
183
|
+
}, W = ({ isMenuItem: t, action: n }) => {
|
|
184
|
+
let { selectedRowIds: r, localeString: a } = y(), o = x[a], c = O(() => {
|
|
177
185
|
n.onClick(r || []);
|
|
178
186
|
}, [n, r]);
|
|
179
|
-
return t ? /* @__PURE__ */
|
|
187
|
+
return t ? /* @__PURE__ */ F(d, {
|
|
180
188
|
onClick: c,
|
|
181
189
|
value: n.name,
|
|
182
|
-
children: n.variant === "delete" ? /* @__PURE__ */
|
|
190
|
+
children: n.variant === "delete" ? /* @__PURE__ */ F(A, {
|
|
183
191
|
as: "span",
|
|
184
192
|
color: e.Error,
|
|
185
193
|
children: n.name
|
|
186
194
|
}) : n.name
|
|
187
|
-
}) : n.variant === "delete" ? /* @__PURE__ */
|
|
195
|
+
}) : n.variant === "delete" ? /* @__PURE__ */ F(u, {
|
|
188
196
|
onClick: c,
|
|
189
197
|
icon: i,
|
|
190
198
|
"aria-label": o.deleteSelectedRows,
|
|
191
199
|
size: "sm",
|
|
192
200
|
variant: "ghost"
|
|
193
|
-
}) : /* @__PURE__ */
|
|
201
|
+
}) : /* @__PURE__ */ F(s, {
|
|
194
202
|
onClick: c,
|
|
195
203
|
size: "sm",
|
|
196
204
|
variant: "ghost",
|
|
197
205
|
children: n.name
|
|
198
206
|
});
|
|
199
|
-
},
|
|
207
|
+
}, G = D(R);
|
|
200
208
|
//#endregion
|
|
201
|
-
export {
|
|
209
|
+
export { G as TableHeaderRow };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-recipe.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-recipe.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,oBAAoB,EAIzB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"table-recipe.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-recipe.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,oBAAoB,EAIzB,MAAM,kBAAkB,CAAC;AA2G1B,eAAO,MAAM,WAAW,EAAE,oBAUxB,CAAC"}
|
|
@@ -45,8 +45,14 @@ var o = {
|
|
|
45
45
|
borderTop: "none",
|
|
46
46
|
_first: { borderTop: "none" },
|
|
47
47
|
"&[data-row-selected=\"true\"]": { backgroundColor: t.AccentHoverAlpha },
|
|
48
|
+
"&[data-dragging=\"true\"]": {
|
|
49
|
+
opacity: .5,
|
|
50
|
+
"& .row-drag-handle": { opacity: 1 }
|
|
51
|
+
},
|
|
52
|
+
"&[data-drop-target=\"true\"]": { backgroundColor: t.AccentHoverAlpha },
|
|
48
53
|
_hover: {
|
|
49
54
|
"& .action-menu-button": { opacity: 1 },
|
|
55
|
+
"& .row-drag-handle": { opacity: 1 },
|
|
50
56
|
"&[data-allow-hovered=\"true\"]": { backgroundColor: t.AccentHoverAlpha }
|
|
51
57
|
},
|
|
52
58
|
"&[data-is-root-level=\"true\"]:not(:first-of-type)": { "& > td": { borderTop: `1px solid ${t.OnBackgroundBorder}` } }
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Locales } from './translations.js';
|
|
2
|
+
export declare const TableRowDragHandle: import('react').MemoExoticComponent<({ localeString, handleRef, }: {
|
|
3
|
+
localeString: Locales;
|
|
4
|
+
handleRef?: (element: Element | null) => void;
|
|
5
|
+
}) => import("react").JSX.Element>;
|
|
6
|
+
//# sourceMappingURL=table-row-drag-handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-row-drag-handle.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row-drag-handle.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AA0F5D,eAAO,MAAM,kBAAkB,qEA9E5B;IACF,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;CAC9C,iCA2EkE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
import { ThemeColorVariable as e, ThemeIconSizeVariable as t } from "../../theme/theme-types.js";
|
|
3
|
+
import { GripMoreIcon as n } from "../icon/icons/grip-more-icon.js";
|
|
4
|
+
import { useTableContext as r } from "./table-context.js";
|
|
5
|
+
import { translations as i } from "./translations.js";
|
|
6
|
+
import { memo as a, useRef as o } from "react";
|
|
7
|
+
import { Box as s } from "@chakra-ui/react";
|
|
8
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
9
|
+
var l = a(({ localeString: a, handleRef: l }) => {
|
|
10
|
+
let u = i[a], { rowReorderMode: d, setIsSortedReorderPromptOpen: f } = r(), p = d === "blockedBySort", m = o(null), h = (e) => {
|
|
11
|
+
p && (m.current = {
|
|
12
|
+
x: e.clientX,
|
|
13
|
+
y: e.clientY
|
|
14
|
+
}, e.currentTarget.setPointerCapture(e.pointerId));
|
|
15
|
+
}, g = (e) => {
|
|
16
|
+
let t = m.current;
|
|
17
|
+
t && (Math.hypot(e.clientX - t.x, e.clientY - t.y) < 4 || (m.current = null, f(!0)));
|
|
18
|
+
}, _ = () => {
|
|
19
|
+
m.current = null;
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ c(s, {
|
|
22
|
+
ref: l,
|
|
23
|
+
onPointerDown: h,
|
|
24
|
+
onPointerMove: g,
|
|
25
|
+
onPointerUp: _,
|
|
26
|
+
onPointerCancel: _,
|
|
27
|
+
onClick: (e) => e.stopPropagation(),
|
|
28
|
+
onKeyDown: (e) => {
|
|
29
|
+
e.stopPropagation(), p && (e.key === " " || e.key === "Enter") && (e.preventDefault(), f(!0));
|
|
30
|
+
},
|
|
31
|
+
role: "button",
|
|
32
|
+
"aria-label": u.reorderRow,
|
|
33
|
+
tabIndex: 0,
|
|
34
|
+
className: "row-drag-handle",
|
|
35
|
+
position: "absolute",
|
|
36
|
+
left: "0",
|
|
37
|
+
top: "0",
|
|
38
|
+
height: "100%",
|
|
39
|
+
width: "24px",
|
|
40
|
+
display: "flex",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
justifyContent: "center",
|
|
43
|
+
color: e.OnBackgroundSubdued,
|
|
44
|
+
opacity: 0,
|
|
45
|
+
_focusVisible: { opacity: 1 },
|
|
46
|
+
cursor: "grab",
|
|
47
|
+
userSelect: "none",
|
|
48
|
+
css: { "&:active": { cursor: "grabbing" } },
|
|
49
|
+
children: /* @__PURE__ */ c(n, { size: t.Small })
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//#endregion
|
|
53
|
+
export { l as TableRowDragHandle };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-row-reorder.spec.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row-reorder.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAKvD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,KAAK,aAAa,CAAC,KAAK,SAAS,SAAS,IAAI;IAC7C,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;IACnD,UAAU,CAAC,EAAE,CACZ,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,EACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KACnF,IAAI,CAAC;IACV,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,aAAa,GAAI,KAAK,SAAS,SAAS,EAAE,6EAM7C,aAAa,CAAC,KAAK,CAAC,gCAiGtB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAA0B,OAAO,aAAa,CAAC"}
|
|
@@ -1,51 +1,68 @@
|
|
|
1
1
|
"use no memo";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { ROW_SORTABLE_TYPE as e } from "./table.constants.js";
|
|
3
|
+
import { useTableContext as t } from "./table-context.js";
|
|
4
|
+
import { closestCenter as n } from "../../node_modules/@dnd-kit/collision/dist/index.js";
|
|
5
|
+
import { SortableKeyboardPlugin as r } from "../../node_modules/@dnd-kit/dom/sortable.js";
|
|
6
|
+
import { useSortable as i } from "../../node_modules/@dnd-kit/react/sortable.js";
|
|
7
|
+
import { TableCell as a } from "./table-cell.js";
|
|
8
|
+
import { memo as o, useCallback as s, useMemo as c } from "react";
|
|
9
|
+
import { Table as l } from "@chakra-ui/react";
|
|
10
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
11
|
+
var f = o(({ row: o, visibleCells: f, onClickRow: p, showRowHoverStyle: m, onRowClickIndication: h }) => {
|
|
12
|
+
let g = t(), _ = o.depth === 0, v = g.rowReorderMode === "enabled" && _, { ref: y, handleRef: b, isDragging: x, isDropTarget: S } = i({
|
|
13
|
+
id: o.id,
|
|
14
|
+
index: o.index,
|
|
15
|
+
type: e,
|
|
16
|
+
accept: e,
|
|
17
|
+
group: e,
|
|
18
|
+
disabled: !v,
|
|
19
|
+
collisionDetector: n,
|
|
20
|
+
plugins: [r]
|
|
21
|
+
}), C = s((e) => {
|
|
22
|
+
p && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p(o.original, e));
|
|
23
|
+
}, [p, o.original]), w = s((e) => {
|
|
24
|
+
e.stopPropagation(), o.getToggleSelectedHandler(), p && p(o.original, e), h && g.setRowHighlight({ [e.currentTarget.id]: !0 });
|
|
12
25
|
}, [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
]),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
]),
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"data-
|
|
30
|
-
"data-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
o,
|
|
27
|
+
p,
|
|
28
|
+
h,
|
|
29
|
+
g
|
|
30
|
+
]), T = c(() => o.getIsSelected() || g.selectedRowIds?.includes(o.id), [
|
|
31
|
+
o,
|
|
32
|
+
g.rowHighlight,
|
|
33
|
+
g.selectedRowIds
|
|
34
|
+
]), E = g.getRowActions?.(o.original), D = (e) => g.disableSelectionCheckbox?.(e) ?? !1;
|
|
35
|
+
return /* @__PURE__ */ d(l.Row, {
|
|
36
|
+
ref: v ? y : void 0,
|
|
37
|
+
id: o.id,
|
|
38
|
+
tabIndex: p ? 0 : void 0,
|
|
39
|
+
onClick: w,
|
|
40
|
+
onKeyDown: C,
|
|
41
|
+
cursor: p ? "pointer" : void 0,
|
|
42
|
+
"data-row-selected": T,
|
|
43
|
+
"data-allow-hovered": m,
|
|
44
|
+
"data-is-root-level": o.depth === 0,
|
|
45
|
+
"data-dragging": x || void 0,
|
|
46
|
+
"data-drop-target": S || void 0,
|
|
47
|
+
children: [f.map((e, t) => {
|
|
48
|
+
let n = t === 0;
|
|
49
|
+
return /* @__PURE__ */ u(a, {
|
|
34
50
|
cell: e,
|
|
35
|
-
visibleCells:
|
|
36
|
-
row:
|
|
37
|
-
rowIsExpanded:
|
|
38
|
-
breakingContentState:
|
|
39
|
-
localeString:
|
|
40
|
-
actionMenu:
|
|
41
|
-
canSelectRows:
|
|
42
|
-
isCheckboxDisabled:
|
|
51
|
+
visibleCells: f,
|
|
52
|
+
row: o,
|
|
53
|
+
rowIsExpanded: o.getIsExpanded(),
|
|
54
|
+
breakingContentState: g.breakingContentState,
|
|
55
|
+
localeString: g.localeString,
|
|
56
|
+
actionMenu: n ? E : void 0,
|
|
57
|
+
canSelectRows: g.canSelectRows && n,
|
|
58
|
+
isCheckboxDisabled: D(o),
|
|
59
|
+
dragHandleRef: n && v ? b : void 0
|
|
43
60
|
}, e.id);
|
|
44
|
-
}),
|
|
61
|
+
}), g.enableColumnResizing && /* @__PURE__ */ u(l.Cell, {
|
|
45
62
|
"aria-hidden": !0,
|
|
46
63
|
style: { borderBottom: 0 }
|
|
47
64
|
})]
|
|
48
|
-
},
|
|
65
|
+
}, o.id);
|
|
49
66
|
});
|
|
50
67
|
//#endregion
|
|
51
|
-
export {
|
|
68
|
+
export { f as TableRow };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Locales } from './translations.js';
|
|
2
|
+
export declare const TableSortedReorderPrompt: ({ isOpen, localeString, onCancel, onConfirm, }: {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
localeString: Locales;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
onConfirm: () => void;
|
|
7
|
+
}) => import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=table-sorted-reorder-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-sorted-reorder-prompt.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-sorted-reorder-prompt.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAO,MAAM,wBAAwB,GAAI,gDAKtC;IACF,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;CACtB,gCA8BA,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { require_compiler_runtime as e } from "../../node_modules/react/compiler-runtime.js";
|
|
2
|
+
import { ThemeColorVariable as t, ThemeFontSizeVariable as n, ThemeFontVariable as r, ThemeSpaceVariable as i } from "../../theme/theme-types.js";
|
|
3
|
+
import { Text as a } from "../text/text.js";
|
|
4
|
+
import { Button as o } from "../button/button.js";
|
|
5
|
+
import { Flex as s } from "../flex/flex.js";
|
|
6
|
+
import { Modal as c } from "../modal/modal.js";
|
|
7
|
+
import { ModalBody as l } from "../modal/modal-body.js";
|
|
8
|
+
import { ModalFooter as u } from "../modal/modal-footer.js";
|
|
9
|
+
import { ModalHeader as d } from "../modal/modal-header.js";
|
|
10
|
+
import { translations as f } from "./translations.js";
|
|
11
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
//#region lib/components/table/table-sorted-reorder-prompt.tsx
|
|
13
|
+
var h = e(), g = (e) => {
|
|
14
|
+
let g = (0, h.c)(19), { isOpen: _, localeString: v, onCancel: y, onConfirm: b } = e, x = f[v], S;
|
|
15
|
+
g[0] === x.reorderSortedTitle ? S = g[1] : (S = /* @__PURE__ */ p(d, {
|
|
16
|
+
p: i.Medium,
|
|
17
|
+
children: /* @__PURE__ */ p(a, {
|
|
18
|
+
color: t.OnSurfaceHeader,
|
|
19
|
+
fontFamily: r.SubHeader,
|
|
20
|
+
fontWeight: "medium",
|
|
21
|
+
fontSize: n.XLarge,
|
|
22
|
+
children: x.reorderSortedTitle
|
|
23
|
+
})
|
|
24
|
+
}), g[0] = x.reorderSortedTitle, g[1] = S);
|
|
25
|
+
let C;
|
|
26
|
+
g[2] === x.reorderSortedBody ? C = g[3] : (C = /* @__PURE__ */ p(l, {
|
|
27
|
+
px: i.Medium,
|
|
28
|
+
children: /* @__PURE__ */ p(a, { children: x.reorderSortedBody })
|
|
29
|
+
}), g[2] = x.reorderSortedBody, g[3] = C);
|
|
30
|
+
let w;
|
|
31
|
+
g[4] !== y || g[5] !== x.cancel ? (w = /* @__PURE__ */ p(o, {
|
|
32
|
+
variant: "secondary",
|
|
33
|
+
onClick: y,
|
|
34
|
+
children: x.cancel
|
|
35
|
+
}), g[4] = y, g[5] = x.cancel, g[6] = w) : w = g[6];
|
|
36
|
+
let T;
|
|
37
|
+
g[7] !== b || g[8] !== x.reorderSortedConfirm ? (T = /* @__PURE__ */ p(o, {
|
|
38
|
+
variant: "primary",
|
|
39
|
+
onClick: b,
|
|
40
|
+
children: x.reorderSortedConfirm
|
|
41
|
+
}), g[7] = b, g[8] = x.reorderSortedConfirm, g[9] = T) : T = g[9];
|
|
42
|
+
let E;
|
|
43
|
+
g[10] !== w || g[11] !== T ? (E = /* @__PURE__ */ p(u, {
|
|
44
|
+
p: i.Medium,
|
|
45
|
+
children: /* @__PURE__ */ m(s, {
|
|
46
|
+
gap: i.Small,
|
|
47
|
+
justify: "flex-end",
|
|
48
|
+
w: "100%",
|
|
49
|
+
children: [w, T]
|
|
50
|
+
})
|
|
51
|
+
}), g[10] = w, g[11] = T, g[12] = E) : E = g[12];
|
|
52
|
+
let D;
|
|
53
|
+
return g[13] !== _ || g[14] !== y || g[15] !== S || g[16] !== C || g[17] !== E ? (D = /* @__PURE__ */ m(c, {
|
|
54
|
+
isOpen: _,
|
|
55
|
+
onClose: y,
|
|
56
|
+
children: [
|
|
57
|
+
S,
|
|
58
|
+
C,
|
|
59
|
+
E
|
|
60
|
+
]
|
|
61
|
+
}), g[13] = _, g[14] = y, g[15] = S, g[16] = C, g[17] = E, g[18] = D) : D = g[18], D;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { g as TableSortedReorderPrompt };
|