pixelize-design-library 2.2.174 → 2.2.175

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.
@@ -18,10 +18,10 @@ var AccountCard = function (_a) {
18
18
  var handleToggle = function () {
19
19
  onToggleExpand === null || onToggleExpand === void 0 ? void 0 : onToggleExpand();
20
20
  };
21
- return (react_1.default.createElement(react_2.Box, { width: "100%", borderRadius: "0.25rem", borderWidth: "0.063rem", background: (_b = colors === null || colors === void 0 ? void 0 : colors.background) === null || _b === void 0 ? void 0 : _b[200], border: "0.1rem solid ".concat((_c = colors.gray) === null || _c === void 0 ? void 0 : _c[200]), p: 2, boxSizing: "border-box", minHeight: isExpanded ? "180px" : "100px", transition: "border-color 0.15s ease", _hover: {
21
+ return (react_1.default.createElement(react_2.Box, { width: "100%", borderRadius: "0.25rem", borderWidth: "0.063rem", background: (_b = colors === null || colors === void 0 ? void 0 : colors.background) === null || _b === void 0 ? void 0 : _b[200], border: "0.1rem solid ".concat((_c = colors.gray) === null || _c === void 0 ? void 0 : _c[200]), p: 2, boxSizing: "border-box", minHeight: isExpanded ? "180px" : "80px", transition: "border-color 0.15s ease", _hover: {
22
22
  borderColor: (_d = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _d === void 0 ? void 0 : _d[200],
23
23
  } },
24
- react_1.default.createElement(react_2.VStack, { align: "start", spacing: 2, fontSize: "0.875rem", color: (_e = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _e === void 0 ? void 0 : _e[700] },
24
+ react_1.default.createElement(react_2.VStack, { align: "start", spacing: 0.5, fontSize: "0.875rem", color: (_e = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _e === void 0 ? void 0 : _e[700] },
25
25
  visibleKeys.map(function (key) { return (react_1.default.createElement(AccountRow_1.default, { key: key, label: key.replace(/\b\w/g, function (c) { return c.toUpperCase(); }), value: account[key] })); }),
26
26
  react_1.default.createElement(react_2.Collapse, { in: isExpanded && account.details !== undefined, animateOpacity: true },
27
27
  react_1.default.createElement(react_2.Text, { pt: 2 }, account.details)),
@@ -11,11 +11,11 @@ var AccountRow = function (_a) {
11
11
  var _b, _c;
12
12
  var label = _a.label, value = _a.value;
13
13
  var colors = (0, useCustomTheme_1.useCustomTheme)().colors;
14
- return (react_1.default.createElement(react_2.Flex, { w: "full" },
14
+ return (react_1.default.createElement(react_2.Flex, { w: "full", gap: 1 },
15
15
  react_1.default.createElement(react_2.Tooltip, { label: label, isDisabled: label.length <= 15, hasArrow: true },
16
- react_1.default.createElement(react_2.Text, { color: (_b = colors === null || colors === void 0 ? void 0 : colors.text) === null || _b === void 0 ? void 0 : _b[700], w: "45%", noOfLines: 1 }, (0, functions_1.toWords)(label))),
17
- react_1.default.createElement(react_2.Text, { w: "0.625rem", textAlign: "center" }, ":"),
16
+ react_1.default.createElement(react_2.Text, { color: (_b = colors === null || colors === void 0 ? void 0 : colors.text) === null || _b === void 0 ? void 0 : _b[700], w: "30%", noOfLines: 1, fontSize: "0.75rem" }, (0, functions_1.toWords)(label))),
17
+ react_1.default.createElement(react_2.Text, { w: "0.75rem", textAlign: "center", fontSize: "0.75rem" }, ":"),
18
18
  react_1.default.createElement(react_2.Tooltip, { label: value, isDisabled: value.length <= 17, hasArrow: true },
19
- react_1.default.createElement(react_2.Text, { fontWeight: 600, color: (_c = colors === null || colors === void 0 ? void 0 : colors.text) === null || _c === void 0 ? void 0 : _c[800], w: "calc(55% - 0.625rem)", noOfLines: 1 }, value))));
19
+ react_1.default.createElement(react_2.Text, { fontWeight: 600, color: (_c = colors === null || colors === void 0 ? void 0 : colors.text) === null || _c === void 0 ? void 0 : _c[800], w: "calc(55% - 0.625rem)", noOfLines: 1, fontSize: "0.75rem" }, value))));
20
20
  };
21
21
  exports.default = AccountRow;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { KanbanBoardProps } from "./KanbanBoardProps";
3
- declare const KanbanBoard: ({ data, customColumns, customizeColumn, onDrag, onDelete, onOpen, onColumnDelete, isLoading, kanbanSelect, kanbanEdit, kanbanCreate, virtualization, permissions, noItems, enableColumnCollapse, collapsedColumns: defaultCollapsedColumns, enableColumnReorder, onColumnReorder, }: KanbanBoardProps) => React.JSX.Element | null;
3
+ declare const KanbanBoard: ({ data, customColumns, customizeColumn, onDrag, onDelete, onOpen, onColumnDelete, isLoading, kanbanSelect, kanbanEdit, kanbanCreate, virtualization, permissions, noItems, enableColumnCollapse, collapsedColumns: defaultCollapsedColumns, onColumnCollapseChange, enableColumnReorder, onColumnReorder, }: KanbanBoardProps) => React.JSX.Element | null;
4
4
  export default KanbanBoard;
@@ -77,7 +77,7 @@ function reorderColumnEntries(entries, startIndex, endIndex) {
77
77
  }
78
78
  var KanbanBoard = function (_a) {
79
79
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
80
- var data = _a.data, customColumns = _a.customColumns, customizeColumn = _a.customizeColumn, onDrag = _a.onDrag, onDelete = _a.onDelete, onOpen = _a.onOpen, onColumnDelete = _a.onColumnDelete, _u = _a.isLoading, isLoading = _u === void 0 ? false : _u, kanbanSelect = _a.kanbanSelect, kanbanEdit = _a.kanbanEdit, kanbanCreate = _a.kanbanCreate, virtualization = _a.virtualization, permissions = _a.permissions, noItems = _a.noItems, _v = _a.enableColumnCollapse, enableColumnCollapse = _v === void 0 ? false : _v, defaultCollapsedColumns = _a.collapsedColumns, _w = _a.enableColumnReorder, enableColumnReorder = _w === void 0 ? false : _w, onColumnReorder = _a.onColumnReorder;
80
+ var data = _a.data, customColumns = _a.customColumns, customizeColumn = _a.customizeColumn, onDrag = _a.onDrag, onDelete = _a.onDelete, onOpen = _a.onOpen, onColumnDelete = _a.onColumnDelete, _u = _a.isLoading, isLoading = _u === void 0 ? false : _u, kanbanSelect = _a.kanbanSelect, kanbanEdit = _a.kanbanEdit, kanbanCreate = _a.kanbanCreate, virtualization = _a.virtualization, permissions = _a.permissions, noItems = _a.noItems, _v = _a.enableColumnCollapse, enableColumnCollapse = _v === void 0 ? false : _v, defaultCollapsedColumns = _a.collapsedColumns, onColumnCollapseChange = _a.onColumnCollapseChange, _w = _a.enableColumnReorder, enableColumnReorder = _w === void 0 ? false : _w, onColumnReorder = _a.onColumnReorder;
81
81
  var colors = (0, useCustomTheme_1.useCustomTheme)().colors;
82
82
  var canDrag = (permissions === null || permissions === void 0 ? void 0 : permissions.isEditable) !== false;
83
83
  var canDelete = (permissions === null || permissions === void 0 ? void 0 : permissions.isDeletable) !== false;
@@ -103,9 +103,16 @@ var KanbanBoard = function (_a) {
103
103
  var toggleColumnCollapsed = (0, react_1.useCallback)(function (colId) {
104
104
  setCollapsedColumns(function (prev) {
105
105
  var _a;
106
- return (__assign(__assign({}, prev), (_a = {}, _a[colId] = !prev[colId], _a)));
106
+ var collapsed = !prev[colId];
107
+ var next = __assign(__assign({}, prev), (_a = {}, _a[colId] = collapsed, _a));
108
+ onColumnCollapseChange === null || onColumnCollapseChange === void 0 ? void 0 : onColumnCollapseChange({
109
+ colId: colId,
110
+ collapsed: collapsed,
111
+ collapsedColumns: next,
112
+ });
113
+ return next;
107
114
  });
108
- }, []);
115
+ }, [onColumnCollapseChange]);
109
116
  /** Rotated collapsed summaries paint outside layout; reserve space so they are not clipped under the rail header. */
110
117
  var COLLAPSED_CUSTOM_NODE_TOP_RESERVE = "3.5rem";
111
118
  // ref for lists
@@ -269,7 +276,7 @@ var KanbanBoard = function (_a) {
269
276
  react_1.default.createElement(react_2.VStack, { align: "stretch", spacing: 1, minW: "max-content", fontSize: "xs", color: (_s = colors === null || colors === void 0 ? void 0 : colors.text) === null || _s === void 0 ? void 0 : _s[600] }, column.customNode())))) : (react_1.default.createElement(react_2.Box, { flex: "1", minH: 0 })))) : (react_1.default.createElement(react_2.Flex, { width: "95%", h: "2.75rem", borderRadius: "0.25rem", borderLeft: "0.188rem solid", borderLeftColor: (_t = column.color) !== null && _t !== void 0 ? _t : (_u = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _u === void 0 ? void 0 : _u[500], background: (_v = colors === null || colors === void 0 ? void 0 : colors.background) === null || _v === void 0 ? void 0 : _v[300], align: "center", px: 2, m: 2, flexShrink: 0, justifyContent: "space-between", position: "relative", gap: 2 },
270
277
  enableColumnReorder && columnDragHandleProps ? (react_1.default.createElement(react_2.Flex, __assign({ align: "center", justify: "center", flexShrink: 0, cursor: "grab" }, columnDragHandleProps),
271
278
  react_1.default.createElement(react_2.Box, { as: lucide_react_1.GripVertical, size: 14, color: (_w = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _w === void 0 ? void 0 : _w[400] }))) : null,
272
- react_1.default.createElement(react_2.Text, { as: "span", fontWeight: "600", fontSize: "1rem", color: (_x = colors === null || colors === void 0 ? void 0 : colors.text) === null || _x === void 0 ? void 0 : _x[700], noOfLines: 1, flex: "1", minW: 0 },
279
+ react_1.default.createElement(react_2.Text, { as: "span", fontWeight: "600", fontSize: "0.875rem", color: (_x = colors === null || colors === void 0 ? void 0 : colors.text) === null || _x === void 0 ? void 0 : _x[700], noOfLines: 1, flex: "1", minW: 0 },
273
280
  react_1.default.createElement(OverflowTooltipText_1.default, { placement: "top" }, column.title)),
274
281
  react_1.default.createElement(react_2.Badge, { minW: { base: "20px", sm: "22px", md: "24px" }, h: { base: "20px", sm: "22px", md: "24px" }, borderRadius: "999px", border: "1px solid", backgroundColor: (_y = colors === null || colors === void 0 ? void 0 : colors.background) === null || _y === void 0 ? void 0 : _y[100], borderColor: (_z = colors === null || colors === void 0 ? void 0 : colors.gray) === null || _z === void 0 ? void 0 : _z[300], display: "flex", alignItems: "center", justifyContent: "center", color: (_0 = colors === null || colors === void 0 ? void 0 : colors.text) === null || _0 === void 0 ? void 0 : _0[900], fontWeight: 600, fontSize: { base: "10px", sm: "11px", md: "12px" } }, (_1 = column === null || column === void 0 ? void 0 : column.items) === null || _1 === void 0 ? void 0 : _1.length),
275
282
  enableColumnCollapse && (react_1.default.createElement(react_2.IconButton, { "aria-label": "Collapse column", icon: react_1.default.createElement(lucide_react_1.ChevronLeft, { size: 14 }), variant: "ghost", size: "xs", minW: "1.5rem", h: "1.75rem", flexShrink: 0, onClick: function () { return toggleColumnCollapsed(colId); } })),
@@ -163,5 +163,23 @@ describe("KanbanBoard – permissions", function () {
163
163
  expect(react_2.screen.queryByLabelText("Delete")).not.toBeInTheDocument();
164
164
  expect(react_2.screen.getByLabelText("Expand column")).toBeInTheDocument();
165
165
  });
166
+ it("calls onColumnCollapseChange when collapsing and expanding", function () {
167
+ var onColumnCollapseChange = jest.fn();
168
+ renderWithChakra(react_1.default.createElement(KanbanBoard_1.default, { data: sampleData, enableColumnCollapse: true, onColumnCollapseChange: onColumnCollapseChange }));
169
+ react_2.fireEvent.click(react_2.screen.getAllByLabelText("Collapse column")[0]);
170
+ expect(onColumnCollapseChange).toHaveBeenCalledTimes(1);
171
+ expect(onColumnCollapseChange).toHaveBeenLastCalledWith({
172
+ colId: "col1",
173
+ collapsed: true,
174
+ collapsedColumns: { col1: true },
175
+ });
176
+ react_2.fireEvent.click(react_2.screen.getByLabelText("Expand column"));
177
+ expect(onColumnCollapseChange).toHaveBeenCalledTimes(2);
178
+ expect(onColumnCollapseChange).toHaveBeenLastCalledWith({
179
+ colId: "col1",
180
+ collapsed: false,
181
+ collapsedColumns: { col1: false },
182
+ });
183
+ });
166
184
  });
167
185
  });
@@ -18,6 +18,14 @@ export type ColumnType = {
18
18
  /** Column-level slot (e.g. totals). Only in the collapsed narrow rail; rotated 270° along the column. */
19
19
  customNode?: () => ReactNode;
20
20
  };
21
+ /** Fired after a column rail is collapsed or expanded via the board UI. */
22
+ export type ColumnCollapseChangePayload = {
23
+ colId: string;
24
+ /** True when the column is in the narrow collapsed rail. */
25
+ collapsed: boolean;
26
+ /** Full collapsed map for all columns (same shape as `collapsedColumns` initial prop). */
27
+ collapsedColumns: Record<string, boolean>;
28
+ };
21
29
  export type KanbanBoardProps = {
22
30
  data: Record<string, ColumnType>;
23
31
  customColumns?: Record<string, ColumnType>;
@@ -77,6 +85,8 @@ export type KanbanBoardProps = {
77
85
  * Only read on first mount; remount the board or toggle in UI to change afterward.
78
86
  */
79
87
  collapsedColumns?: Record<string, boolean>;
88
+ /** Called when the user collapses or expands a column (after internal state updates). */
89
+ onColumnCollapseChange?: (payload: ColumnCollapseChangePayload) => void;
80
90
  /** When true, columns can be reordered via the header grip handle. */
81
91
  enableColumnReorder?: boolean;
82
92
  /** Called after column order changes (same shape as `data` keys order). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelize-design-library",
3
- "version": "2.2.174",
3
+ "version": "2.2.175",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",