@caspeco/casper-ui-library 10.8.0 → 10.9.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.
Files changed (45) hide show
  1. package/dist/components/table/helper.d.ts +3 -0
  2. package/dist/components/table/helper.d.ts.map +1 -1
  3. package/dist/components/table/helper.js +17 -11
  4. package/dist/components/table/index.d.ts +1 -1
  5. package/dist/components/table/index.d.ts.map +1 -1
  6. package/dist/components/table/table-cell.d.ts +2 -1
  7. package/dist/components/table/table-cell.d.ts.map +1 -1
  8. package/dist/components/table/table-cell.js +62 -55
  9. package/dist/components/table/table-content.d.ts.map +1 -1
  10. package/dist/components/table/table-content.js +84 -56
  11. package/dist/components/table/table-context-provider.d.ts +17 -2
  12. package/dist/components/table/table-context-provider.d.ts.map +1 -1
  13. package/dist/components/table/table-context-provider.js +179 -122
  14. package/dist/components/table/table-drag-accessibility.d.ts +11 -0
  15. package/dist/components/table/table-drag-accessibility.d.ts.map +1 -0
  16. package/dist/components/table/table-drag-accessibility.js +22 -0
  17. package/dist/components/table/table-header-row.d.ts.map +1 -1
  18. package/dist/components/table/table-header-row.js +70 -62
  19. package/dist/components/table/table-recipe.d.ts.map +1 -1
  20. package/dist/components/table/table-recipe.js +6 -0
  21. package/dist/components/table/table-row-drag-handle.d.ts +6 -0
  22. package/dist/components/table/table-row-drag-handle.d.ts.map +1 -0
  23. package/dist/components/table/table-row-drag-handle.js +53 -0
  24. package/dist/components/table/table-row-reorder.spec.d.ts +2 -0
  25. package/dist/components/table/table-row-reorder.spec.d.ts.map +1 -0
  26. package/dist/components/table/table-row.d.ts.map +1 -1
  27. package/dist/components/table/table-row.js +59 -42
  28. package/dist/components/table/table-sorted-reorder-prompt.d.ts +8 -0
  29. package/dist/components/table/table-sorted-reorder-prompt.d.ts.map +1 -0
  30. package/dist/components/table/table-sorted-reorder-prompt.js +64 -0
  31. package/dist/components/table/table-toolbar-settings.js +27 -27
  32. package/dist/components/table/table.composition.d.ts +2 -0
  33. package/dist/components/table/table.composition.d.ts.map +1 -1
  34. package/dist/components/table/table.constants.d.ts +15 -0
  35. package/dist/components/table/table.constants.d.ts.map +1 -1
  36. package/dist/components/table/table.constants.js +2 -2
  37. package/dist/components/table/table.d.ts +1 -1
  38. package/dist/components/table/table.d.ts.map +1 -1
  39. package/dist/components/table/table.js +4 -2
  40. package/dist/components/table/translations.d.ts +70 -0
  41. package/dist/components/table/translations.d.ts.map +1 -1
  42. package/dist/components/table/translations.js +66 -6
  43. package/dist/components/table/types.d.ts +37 -5
  44. package/dist/components/table/types.d.ts.map +1 -1
  45. package/package.json +1 -1
@@ -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 { getColumnWidth as g, getPinnedLeft as _ } from "./helper.js";
16
- import { useTableContext as v } from "./table-context.js";
17
- import { closestCenter as y } from "../../node_modules/@dnd-kit/collision/dist/index.js";
18
- import { SortableKeyboardPlugin as b } from "../../node_modules/@dnd-kit/dom/sortable.js";
19
- import { useSortable as x } from "../../node_modules/@dnd-kit/react/sortable.js";
20
- import { interpolate as S, translations as C } from "./translations.js";
21
- import { ColumnResizeHandle as w } from "./table-column-resize-handle.js";
22
- import { TableHeaderDropdown as T } from "./table-header-dropdown.js";
23
- import { memo as E, useCallback as D, useMemo as O } from "react";
24
- import { Box as k, Portal as A, Table as j, useMediaQuery as M } from "@chakra-ui/react";
25
- import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
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
- var I = ({ headerGroup: t, hideTableHeaderDropdown: n, portalContainerRef: r }) => {
28
- let i = v(), a = !!i.getRowActions, o = (i.selectedRowIds?.length ?? 0) > 0 && (i.selectionActions?.length ?? 0) > 0, s = +!!i.enableColumnResizing;
29
- return /* @__PURE__ */ P(N, { children: /* @__PURE__ */ P(j.Row, { children: o ? /* @__PURE__ */ P(j.ColumnHeader, {
30
- colSpan: t.headers.length + s,
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: a ? "24px" : void 0
40
+ paddingLeft: o ? `${o}px` : void 0
37
41
  },
38
42
  scope: "col",
39
43
  zIndex: 1,
40
- children: /* @__PURE__ */ P(z, {
44
+ children: /* @__PURE__ */ F(V, {
41
45
  showSelectAll: !0,
42
- children: /* @__PURE__ */ P(V, {})
46
+ children: /* @__PURE__ */ F(U, {})
43
47
  })
44
- }) : /* @__PURE__ */ F(N, { children: [t.headers.map((e, t) => /* @__PURE__ */ P(L, {
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__ */ P(R, {})] }) }, t.id) });
52
- }, L = ({ header: t, hideTableHeaderDropdown: n, applyActionMenuPadding: i, portalContainerRef: a, isFirstColumn: o = !1, enableColumnReorder: s = !1 }) => {
53
- let c = v(), { column: l } = t, u = c.enableColumnResizing, d = u && l.getCanResize(), f = s && !l.columnDef.meta?.disableColumnReorder, { ref: p, isDragging: m, isDropTarget: S } = x({
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: y,
58
- plugins: [b]
65
+ collisionDetector: S,
66
+ plugins: [C]
59
67
  });
60
- return /* @__PURE__ */ F(j.ColumnHeader, {
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: S || m ? e.Background : void 0,
74
+ backgroundColor: b || m ? e.Background : void 0,
67
75
  scope: "col",
68
76
  style: {
69
77
  ...((t) => {
70
- let n = t.getIsPinned(), r = g(t, u);
78
+ let n = t.getIsPinned(), r = _(t, u);
71
79
  return {
72
80
  position: n ? "sticky" : "relative",
73
- left: n ? _(t, u) : void 0,
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: o && i ? "24px" : void 0,
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__ */ P(z, {
88
- showSelectAll: c.canSelectRows && o,
89
- children: /* @__PURE__ */ P(N, { children: n ? /* @__PURE__ */ P(k, {
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__ */ P(T, {
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: a,
109
+ portalContainerRef: i,
102
110
  dragRef: f ? p : void 0
103
111
  }) })
104
- }), d && /* @__PURE__ */ P(w, { header: t })]
112
+ }), d && /* @__PURE__ */ F(T, { header: t })]
105
113
  });
106
- }, R = () => /* @__PURE__ */ P(j.ColumnHeader, {
114
+ }, B = () => /* @__PURE__ */ F(M.ColumnHeader, {
107
115
  "aria-hidden": !0,
108
116
  scope: "col",
109
117
  style: { borderBottom: `1px solid ${e.OnBackgroundBorder}` }
110
- }), z = ({ showSelectAll: e, children: t }) => e ? /* @__PURE__ */ F(l, {
118
+ }), V = ({ showSelectAll: e, children: t }) => e ? /* @__PURE__ */ I(l, {
111
119
  w: "100%",
112
120
  align: "center",
113
- children: [/* @__PURE__ */ P(k, {
121
+ children: [/* @__PURE__ */ F(A, {
114
122
  justifyContent: "center",
115
123
  alignItems: "center",
116
- children: /* @__PURE__ */ P(B, {})
124
+ children: /* @__PURE__ */ F(H, {})
117
125
  }), t]
118
- }) : /* @__PURE__ */ P(N, { children: t }), B = () => {
119
- let e = v(), t = D(({ checked: t }) => {
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 } = O(() => {
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__ */ P(p, {
137
+ return /* @__PURE__ */ F(p, {
130
138
  isChecked: n,
131
139
  isIndeterminate: r,
132
140
  onCheckedChange: t
133
141
  });
134
- }, V = () => {
135
- let { localeString: i, selectedRowIds: s = [], selectionActions: u = [], totalDataCount: d } = v(), p = C[i], [h] = M(["(min-width: 48em)"]), g = u.length > 3 || !h, _ = s.length, y = d ? S(p.selectedWithTotal, {
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 ? S(p.selectedSingular, { count: 1 }) : S(p.selected, { count: _ });
139
- return /* @__PURE__ */ F(l, {
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__ */ P(k, {
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: y
159
+ children: v
152
160
  }),
153
- /* @__PURE__ */ P(k, { children: /* @__PURE__ */ P(m, {
161
+ /* @__PURE__ */ F(A, { children: /* @__PURE__ */ F(m, {
154
162
  orientation: "vertical",
155
163
  height: "20px"
156
164
  }) }),
157
- /* @__PURE__ */ P(l, {
165
+ /* @__PURE__ */ F(l, {
158
166
  gap: r.Small,
159
167
  align: "center",
160
- children: g ? /* @__PURE__ */ F(o, { children: [/* @__PURE__ */ P(c, {
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__ */ P(A, { children: /* @__PURE__ */ P(f, { children: u.map((e) => /* @__PURE__ */ P(H, {
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__ */ P(H, {
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
- }, H = ({ isMenuItem: t, action: n }) => {
176
- let { selectedRowIds: r, localeString: a } = v(), o = C[a], c = D(() => {
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__ */ P(d, {
187
+ return t ? /* @__PURE__ */ F(d, {
180
188
  onClick: c,
181
189
  value: n.name,
182
- children: n.variant === "delete" ? /* @__PURE__ */ P(k, {
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__ */ P(u, {
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__ */ P(s, {
201
+ }) : /* @__PURE__ */ F(s, {
194
202
  onClick: c,
195
203
  size: "sm",
196
204
  variant: "ghost",
197
205
  children: n.name
198
206
  });
199
- }, U = E(I);
207
+ }, G = D(R);
200
208
  //#endregion
201
- export { U as TableHeaderRow };
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;AAgG1B,eAAO,MAAM,WAAW,EAAE,oBAUxB,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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=table-row-reorder.spec.d.ts.map
@@ -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":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAIvD,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,gCA2EtB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAA0B,OAAO,aAAa,CAAC"}
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 { useTableContext as e } from "./table-context.js";
3
- import { TableCell as t } from "./table-cell.js";
4
- import { memo as n, useCallback as r, useMemo as i } from "react";
5
- import { Table as a } from "@chakra-ui/react";
6
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
- var c = n(({ row: n, visibleCells: c, onClickRow: l, showRowHoverStyle: u, onRowClickIndication: d }) => {
8
- let f = e(), p = r((e) => {
9
- l && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l(n.original, e));
10
- }, [l, n.original]), m = r((e) => {
11
- e.stopPropagation(), n.getToggleSelectedHandler(), l && l(n.original, e), d && f.setRowHighlight({ [e.currentTarget.id]: !0 });
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
- n,
14
- l,
15
- d,
16
- f
17
- ]), h = i(() => n.getIsSelected() || f.selectedRowIds?.includes(n.id), [
18
- n,
19
- f.rowHighlight,
20
- f.selectedRowIds
21
- ]), g = f.getRowActions?.(n.original), _ = (e) => f.disableSelectionCheckbox?.(e) ?? !1;
22
- return /* @__PURE__ */ s(a.Row, {
23
- id: n.id,
24
- tabIndex: l ? 0 : void 0,
25
- onClick: m,
26
- onKeyDown: p,
27
- cursor: l ? "pointer" : void 0,
28
- "data-row-selected": h,
29
- "data-allow-hovered": u,
30
- "data-is-root-level": n.depth === 0,
31
- children: [c.map((e, r) => {
32
- let i = r === 0;
33
- return /* @__PURE__ */ o(t, {
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: c,
36
- row: n,
37
- rowIsExpanded: n.getIsExpanded(),
38
- breakingContentState: f.breakingContentState,
39
- localeString: f.localeString,
40
- actionMenu: i ? g : void 0,
41
- canSelectRows: f.canSelectRows && i,
42
- isCheckboxDisabled: _(n)
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
- }), f.enableColumnResizing && /* @__PURE__ */ o(a.Cell, {
61
+ }), g.enableColumnResizing && /* @__PURE__ */ u(l.Cell, {
45
62
  "aria-hidden": !0,
46
63
  style: { borderBottom: 0 }
47
64
  })]
48
- }, n.id);
65
+ }, o.id);
49
66
  });
50
67
  //#endregion
51
- export { c as TableRow };
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 };