@itilite/lumina-ui 1.0.6-alpha → 1.0.8-alpha

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.
@@ -0,0 +1,290 @@
1
+ import {
2
+ __objRest,
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "./chunk-FWCSY2DS.mjs";
6
+
7
+ // src/atom/Table/Table.tsx
8
+ import * as React from "react";
9
+ import { Table as AntTable } from "antd";
10
+ import clsx from "clsx";
11
+
12
+ // src/atom/Table/Table.module.scss
13
+ var Table_module_default = { "tableWrapper": "Table-module__tableWrapper___3cqiD", "isAccordion": "Table-module__isAccordion___-uIs6", "isToolbar": "Table-module__isToolbar___LdS-m", "hasCustomHeaderCell": "Table-module__hasCustomHeaderCell___AtCk8", "table": "Table-module__table___5d7g0", "ant-table-selection-column": "Table-module__ant-table-selection-column___H9vtu", "hasCustomBodyCell": "Table-module__hasCustomBodyCell___sf8j8", "firstRow": "Table-module__firstRow___Xq-Hi", "lastRow": "Table-module__lastRow___ahv4g", "showHoverEffect": "Table-module__showHoverEffect___IyKyO", "columnHeader": "Table-module__columnHeader___Unr6d", "columnHeaderLeft": "Table-module__columnHeaderLeft___mp7pK", "columnHeaderSortArea": "Table-module__columnHeaderSortArea___jrIYo", "columnHeaderLabel": "Table-module__columnHeaderLabel___A-mRu", "columnHeaderSortIcon": "Table-module__columnHeaderSortIcon___mWVZN", "columnHeaderSortIconActive": "Table-module__columnHeaderSortIconActive___wHAqC", "columnHeaderFilterWrapper": "Table-module__columnHeaderFilterWrapper___DnSve", "columnHeaderFilterBtn": "Table-module__columnHeaderFilterBtn___NR7DY", "columnHeaderFilterBtnActive": "Table-module__columnHeaderFilterBtnActive___JdO11", "columnHeaderFilterBadge": "Table-module__columnHeaderFilterBadge___-Q2T2", "columnHeaderFilterDropdown": "Table-module__columnHeaderFilterDropdown___M-fD4" };
14
+
15
+ // src/atom/Table/Table.tsx
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ function buildPagination(pagination, overrides = {}) {
18
+ var _a, _b, _c, _d;
19
+ if (pagination === false) {
20
+ return false;
21
+ }
22
+ const defaults = {
23
+ showSizeChanger: true,
24
+ pageSizeOptions: ["10", "25", "50"],
25
+ locale: { items_per_page: "" },
26
+ // Removes "/ page" text
27
+ showTotal: (total, range) => `${range[0]}\u2013${range[1]} of ${total} items`
28
+ };
29
+ const baseConfig = pagination === true || pagination === void 0 ? defaults : __spreadValues(__spreadValues({}, defaults), pagination);
30
+ return __spreadProps(__spreadValues({}, baseConfig), {
31
+ total: (_a = overrides.total) != null ? _a : baseConfig.total,
32
+ current: (_b = overrides.current) != null ? _b : baseConfig.current,
33
+ pageSize: (_c = overrides.pageSize) != null ? _c : baseConfig.pageSize,
34
+ onChange: (_d = overrides.onChange) != null ? _d : baseConfig.onChange
35
+ });
36
+ }
37
+ function nextSortOrder(current) {
38
+ if (current === void 0) return "ascend";
39
+ if (current === "ascend") return "descend";
40
+ return void 0;
41
+ }
42
+ function ColumnHeader({
43
+ label,
44
+ sortable = false,
45
+ sortOrder,
46
+ onSortChange,
47
+ sortIcon,
48
+ filterCount = 0,
49
+ filterIcon,
50
+ filterContent,
51
+ className = ""
52
+ }) {
53
+ const [filterOpen, setFilterOpen] = React.useState(false);
54
+ const wrapperRef = React.useRef(null);
55
+ const filterActive = filterCount > 0;
56
+ const hasFilter = filterContent !== void 0 && filterIcon !== void 0;
57
+ const hasSort = sortable && sortIcon !== void 0;
58
+ React.useEffect(() => {
59
+ if (!filterOpen) return;
60
+ const onOutside = (e) => {
61
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
62
+ setFilterOpen(false);
63
+ }
64
+ };
65
+ document.addEventListener("mousedown", onOutside);
66
+ return () => document.removeEventListener("mousedown", onOutside);
67
+ }, [filterOpen]);
68
+ return /* @__PURE__ */ jsxs("div", { className: Table_module_default.columnHeader, ref: wrapperRef, children: [
69
+ /* @__PURE__ */ jsx("div", { className: Table_module_default.columnHeaderLeft, children: hasSort ? /* @__PURE__ */ jsxs(
70
+ "button",
71
+ {
72
+ type: "button",
73
+ className: Table_module_default.columnHeaderSortArea,
74
+ onClick: () => onSortChange == null ? void 0 : onSortChange(nextSortOrder(sortOrder)),
75
+ "aria-label": typeof label === "string" ? `Sort by ${label}` : "Sort",
76
+ children: [
77
+ /* @__PURE__ */ jsx("span", { className: clsx(Table_module_default.columnHeaderLabel, "tw-typography-caption2Bold tw-text-color-text-weak", className), children: label }),
78
+ /* @__PURE__ */ jsx(
79
+ "span",
80
+ {
81
+ className: clsx(Table_module_default.columnHeaderSortIcon, {
82
+ [Table_module_default.columnHeaderSortIconActive]: sortOrder !== void 0
83
+ }),
84
+ children: sortIcon
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ ) : /* @__PURE__ */ jsx("span", { className: clsx(Table_module_default.columnHeaderLabel, "tw-typography-caption2Bold tw-text-color-text-weak", className), children: label }) }),
90
+ hasFilter && /* @__PURE__ */ jsxs("div", { className: Table_module_default.columnHeaderFilterWrapper, children: [
91
+ /* @__PURE__ */ jsxs(
92
+ "button",
93
+ {
94
+ type: "button",
95
+ className: clsx(Table_module_default.columnHeaderFilterBtn, {
96
+ [Table_module_default.columnHeaderFilterBtnActive]: filterActive
97
+ }),
98
+ onClick: () => setFilterOpen((v) => !v),
99
+ "aria-label": typeof label === "string" ? `Filter ${label}` : "Filter",
100
+ "aria-expanded": filterOpen,
101
+ "aria-haspopup": "dialog",
102
+ children: [
103
+ filterIcon,
104
+ filterActive && /* @__PURE__ */ jsx("span", { className: Table_module_default.columnHeaderFilterBadge, children: filterCount })
105
+ ]
106
+ }
107
+ ),
108
+ filterOpen && /* @__PURE__ */ jsx("div", { className: Table_module_default.columnHeaderFilterDropdown, role: "dialog", children: filterContent })
109
+ ] })
110
+ ] });
111
+ }
112
+ function processColumns(columns, headerCellClassName, bodyCellClassName) {
113
+ if (!columns) return void 0;
114
+ return columns.map((col) => {
115
+ const _a = col, { headerProps, title, onHeaderCell, onCell } = _a, rest = __objRest(_a, ["headerProps", "title", "onHeaderCell", "onCell"]);
116
+ const resolvedOnHeaderCell = (column) => {
117
+ var _a2;
118
+ const base = (_a2 = onHeaderCell == null ? void 0 : onHeaderCell(column)) != null ? _a2 : {};
119
+ return __spreadProps(__spreadValues({}, base), {
120
+ className: clsx(base.className, headerCellClassName),
121
+ style: __spreadProps(__spreadValues({}, base.style), {
122
+ minWidth: column.width
123
+ })
124
+ });
125
+ };
126
+ const resolvedOnCell = (record, rowIndex) => {
127
+ var _a2;
128
+ const base = (_a2 = onCell == null ? void 0 : onCell(record, rowIndex)) != null ? _a2 : {};
129
+ return __spreadProps(__spreadValues({}, base), {
130
+ className: clsx(base.className, bodyCellClassName),
131
+ style: __spreadProps(__spreadValues({}, base.style), {
132
+ minWidth: col.width
133
+ })
134
+ });
135
+ };
136
+ const processedTitle = headerProps ? /* @__PURE__ */ jsx(ColumnHeader, __spreadValues({ label: title }, headerProps)) : title;
137
+ return __spreadProps(__spreadValues({}, rest), {
138
+ title: processedTitle,
139
+ onHeaderCell: resolvedOnHeaderCell,
140
+ onCell: resolvedOnCell
141
+ });
142
+ });
143
+ }
144
+ function Table(props) {
145
+ var _b;
146
+ const _a = props, {
147
+ size = "middle",
148
+ variant = "default",
149
+ isAccordion = false,
150
+ isToolbar = false,
151
+ className = "",
152
+ pagination,
153
+ loading,
154
+ total,
155
+ current,
156
+ pageSize,
157
+ onPaginationChange,
158
+ columns,
159
+ rowSelection,
160
+ rowKey = "key",
161
+ onRow,
162
+ dataSource,
163
+ emptyState,
164
+ hideHeader,
165
+ loadingIndicator,
166
+ style,
167
+ headerCellClassName,
168
+ bodyCellClassName,
169
+ rowClassName
170
+ } = _a, rest = __objRest(_a, [
171
+ "size",
172
+ "variant",
173
+ "isAccordion",
174
+ "isToolbar",
175
+ "className",
176
+ "pagination",
177
+ "loading",
178
+ "total",
179
+ "current",
180
+ "pageSize",
181
+ "onPaginationChange",
182
+ "columns",
183
+ "rowSelection",
184
+ "rowKey",
185
+ "onRow",
186
+ "dataSource",
187
+ "emptyState",
188
+ "hideHeader",
189
+ "loadingIndicator",
190
+ "style",
191
+ "headerCellClassName",
192
+ "bodyCellClassName",
193
+ "rowClassName"
194
+ ]);
195
+ const isChildVariant = isAccordion || isToolbar;
196
+ const resolvedPagination = buildPagination(pagination, {
197
+ total,
198
+ current,
199
+ pageSize,
200
+ onChange: onPaginationChange
201
+ });
202
+ const processedColumns = React.useMemo(
203
+ () => processColumns(columns, headerCellClassName, bodyCellClassName),
204
+ [columns, headerCellClassName, bodyCellClassName]
205
+ );
206
+ const resolvedRowSelection = React.useMemo(() => {
207
+ if (!rowSelection) return void 0;
208
+ return __spreadValues({
209
+ columnWidth: 48
210
+ }, rowSelection);
211
+ }, [rowSelection]);
212
+ const resolvedOnRow = React.useMemo(() => {
213
+ const onChange = resolvedRowSelection == null ? void 0 : resolvedRowSelection.onChange;
214
+ if (variant !== "selectable" || !onChange) return onRow;
215
+ return (record, index) => {
216
+ var _a2;
217
+ const base = (_a2 = onRow == null ? void 0 : onRow(record, index)) != null ? _a2 : {};
218
+ const getKey = (r, i) => typeof rowKey === "function" ? rowKey(r, i) : r[rowKey];
219
+ return __spreadProps(__spreadValues({}, base), {
220
+ style: __spreadValues({ cursor: "pointer" }, base.style),
221
+ onClick: (e) => {
222
+ var _a3, _b2;
223
+ (_a3 = base.onClick) == null ? void 0 : _a3.call(base, e);
224
+ const key = getKey(record, index);
225
+ const current2 = (_b2 = resolvedRowSelection.selectedRowKeys) != null ? _b2 : [];
226
+ const isSelected = current2.some((k) => k === key);
227
+ const newKeys = isSelected ? current2.filter((k) => k !== key) : [...current2, key];
228
+ const newRows = (dataSource != null ? dataSource : []).filter(
229
+ (r) => newKeys.some((k) => k === getKey(r))
230
+ );
231
+ onChange(newKeys, newRows, { type: "single" });
232
+ }
233
+ });
234
+ };
235
+ }, [variant, resolvedRowSelection, rowKey, onRow, dataSource]);
236
+ return /* @__PURE__ */ jsx(
237
+ "div",
238
+ {
239
+ className: clsx(
240
+ Table_module_default.tableWrapper,
241
+ Table_module_default.showHoverEffect,
242
+ {
243
+ [Table_module_default.isAccordion]: isAccordion,
244
+ [Table_module_default.isToolbar]: isToolbar,
245
+ [Table_module_default.hasCustomHeaderCell]: !!headerCellClassName,
246
+ [Table_module_default.hasCustomBodyCell]: !!bodyCellClassName
247
+ },
248
+ className
249
+ ),
250
+ style,
251
+ "data-testid": "lumina-table",
252
+ children: /* @__PURE__ */ jsx(
253
+ AntTable,
254
+ __spreadProps(__spreadValues({
255
+ className: Table_module_default.table,
256
+ size,
257
+ pagination: resolvedPagination,
258
+ columns: processedColumns,
259
+ rowSelection: resolvedRowSelection,
260
+ rowKey,
261
+ onRow: resolvedOnRow,
262
+ dataSource,
263
+ showHeader: !hideHeader,
264
+ locale: {
265
+ emptyText: loading && loadingIndicator ? loadingIndicator : loading ? " " : emptyState
266
+ }
267
+ }, rest), {
268
+ loading: loadingIndicator ? { spinning: !!loading && ((_b = dataSource == null ? void 0 : dataSource.length) != null ? _b : 0) > 0, indicator: loadingIndicator } : loading,
269
+ rowClassName: (record, index) => {
270
+ var _a2;
271
+ return clsx(
272
+ {
273
+ [Table_module_default.firstRow]: index === 0,
274
+ [Table_module_default.lastRow]: index === ((_a2 = dataSource == null ? void 0 : dataSource.length) != null ? _a2 : 0) - 1
275
+ },
276
+ typeof rowClassName === "function" ? rowClassName(record, index) : rowClassName
277
+ );
278
+ }
279
+ })
280
+ )
281
+ }
282
+ );
283
+ }
284
+ Table.displayName = "Table";
285
+ var Table_default = Table;
286
+
287
+ export {
288
+ Table,
289
+ Table_default
290
+ };
@@ -0,0 +1,295 @@
1
+ import {
2
+ __objRest,
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "./chunk-FWCSY2DS.mjs";
6
+
7
+ // src/atom/Table/Table.tsx
8
+ import * as React from "react";
9
+ import { Table as AntTable } from "antd";
10
+ import clsx from "clsx";
11
+
12
+ // src/atom/Table/Table.module.scss
13
+ var Table_module_default = { "tableWrapper": "Table-module__tableWrapper___3cqiD", "isAccordion": "Table-module__isAccordion___-uIs6", "isToolbar": "Table-module__isToolbar___LdS-m", "hasCustomHeaderCell": "Table-module__hasCustomHeaderCell___AtCk8", "table": "Table-module__table___5d7g0", "ant-table-selection-column": "Table-module__ant-table-selection-column___H9vtu", "hasCustomBodyCell": "Table-module__hasCustomBodyCell___sf8j8", "firstRow": "Table-module__firstRow___Xq-Hi", "lastRow": "Table-module__lastRow___ahv4g", "showHoverEffect": "Table-module__showHoverEffect___IyKyO", "columnHeader": "Table-module__columnHeader___Unr6d", "columnHeaderLeft": "Table-module__columnHeaderLeft___mp7pK", "columnHeaderSortArea": "Table-module__columnHeaderSortArea___jrIYo", "columnHeaderLabel": "Table-module__columnHeaderLabel___A-mRu", "columnHeaderSortIcon": "Table-module__columnHeaderSortIcon___mWVZN", "columnHeaderSortIconActive": "Table-module__columnHeaderSortIconActive___wHAqC", "columnHeaderFilterWrapper": "Table-module__columnHeaderFilterWrapper___DnSve", "columnHeaderFilterBtn": "Table-module__columnHeaderFilterBtn___NR7DY", "columnHeaderFilterBtnActive": "Table-module__columnHeaderFilterBtnActive___JdO11", "columnHeaderFilterBadge": "Table-module__columnHeaderFilterBadge___-Q2T2", "columnHeaderFilterDropdown": "Table-module__columnHeaderFilterDropdown___M-fD4" };
14
+
15
+ // src/atom/Table/Table.tsx
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ function buildPagination(pagination, overrides = {}) {
18
+ var _a, _b, _c, _d;
19
+ if (pagination === false) {
20
+ return false;
21
+ }
22
+ const defaults = {
23
+ showSizeChanger: true,
24
+ pageSizeOptions: ["10", "25", "50"],
25
+ locale: { items_per_page: "" },
26
+ // Removes "/ page" text
27
+ showTotal: (total, range) => `${range[0]}\u2013${range[1]} of ${total} items`
28
+ };
29
+ const baseConfig = pagination === true || pagination === void 0 ? defaults : __spreadValues(__spreadValues({}, defaults), pagination);
30
+ return __spreadProps(__spreadValues({}, baseConfig), {
31
+ total: (_a = overrides.total) != null ? _a : baseConfig.total,
32
+ current: (_b = overrides.current) != null ? _b : baseConfig.current,
33
+ pageSize: (_c = overrides.pageSize) != null ? _c : baseConfig.pageSize,
34
+ onChange: (_d = overrides.onChange) != null ? _d : baseConfig.onChange
35
+ });
36
+ }
37
+ function nextSortOrder(current) {
38
+ if (current === void 0) return "ascend";
39
+ if (current === "ascend") return "descend";
40
+ return void 0;
41
+ }
42
+ function ColumnHeader({
43
+ label,
44
+ sortable = false,
45
+ sortOrder,
46
+ onSortChange,
47
+ sortIcon,
48
+ filterCount = 0,
49
+ filterIcon,
50
+ filterContent,
51
+ className = ""
52
+ }) {
53
+ const [filterOpen, setFilterOpen] = React.useState(false);
54
+ const wrapperRef = React.useRef(null);
55
+ const filterActive = filterCount > 0;
56
+ const hasFilter = filterContent !== void 0 && filterIcon !== void 0;
57
+ const hasSort = sortable && sortIcon !== void 0;
58
+ React.useEffect(() => {
59
+ if (!filterOpen) return;
60
+ const onOutside = (e) => {
61
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
62
+ setFilterOpen(false);
63
+ }
64
+ };
65
+ document.addEventListener("mousedown", onOutside);
66
+ return () => document.removeEventListener("mousedown", onOutside);
67
+ }, [filterOpen]);
68
+ return /* @__PURE__ */ jsxs("div", { className: Table_module_default.columnHeader, ref: wrapperRef, children: [
69
+ /* @__PURE__ */ jsx("div", { className: Table_module_default.columnHeaderLeft, children: hasSort ? /* @__PURE__ */ jsxs(
70
+ "button",
71
+ {
72
+ type: "button",
73
+ className: Table_module_default.columnHeaderSortArea,
74
+ onClick: () => onSortChange == null ? void 0 : onSortChange(nextSortOrder(sortOrder)),
75
+ "aria-label": typeof label === "string" ? `Sort by ${label}` : "Sort",
76
+ children: [
77
+ /* @__PURE__ */ jsx("span", { className: clsx(Table_module_default.columnHeaderLabel, "tw-typography-caption2Bold tw-text-color-text-weak", className), children: label }),
78
+ /* @__PURE__ */ jsx(
79
+ "span",
80
+ {
81
+ className: clsx(Table_module_default.columnHeaderSortIcon, {
82
+ [Table_module_default.columnHeaderSortIconActive]: sortOrder !== void 0
83
+ }),
84
+ children: sortIcon
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ ) : /* @__PURE__ */ jsx("span", { className: clsx(Table_module_default.columnHeaderLabel, "tw-typography-caption2Bold tw-text-color-text-weak", className), children: label }) }),
90
+ hasFilter && /* @__PURE__ */ jsxs("div", { className: Table_module_default.columnHeaderFilterWrapper, children: [
91
+ /* @__PURE__ */ jsxs(
92
+ "button",
93
+ {
94
+ type: "button",
95
+ className: clsx(Table_module_default.columnHeaderFilterBtn, {
96
+ [Table_module_default.columnHeaderFilterBtnActive]: filterActive
97
+ }),
98
+ onClick: () => setFilterOpen((v) => !v),
99
+ "aria-label": typeof label === "string" ? `Filter ${label}` : "Filter",
100
+ "aria-expanded": filterOpen,
101
+ "aria-haspopup": "dialog",
102
+ children: [
103
+ filterIcon,
104
+ filterActive && /* @__PURE__ */ jsx("span", { className: Table_module_default.columnHeaderFilterBadge, children: filterCount })
105
+ ]
106
+ }
107
+ ),
108
+ filterOpen && /* @__PURE__ */ jsx("div", { className: Table_module_default.columnHeaderFilterDropdown, role: "dialog", children: filterContent })
109
+ ] })
110
+ ] });
111
+ }
112
+ function processColumns(columns, headerCellClassName, bodyCellClassName, columnMinWidth) {
113
+ if (!columns) return void 0;
114
+ return columns.map((col) => {
115
+ var _b, _c;
116
+ const _a = col, { headerProps, title, onHeaderCell, onCell } = _a, rest = __objRest(_a, ["headerProps", "title", "onHeaderCell", "onCell"]);
117
+ const resolvedMinWidth = (_b = col.width) != null ? _b : columnMinWidth;
118
+ const resolvedOnHeaderCell = (column) => {
119
+ var _a2;
120
+ const base = (_a2 = onHeaderCell == null ? void 0 : onHeaderCell(column)) != null ? _a2 : {};
121
+ return __spreadProps(__spreadValues({}, base), {
122
+ className: clsx(base.className, headerCellClassName),
123
+ style: __spreadProps(__spreadValues({}, base.style), {
124
+ minWidth: resolvedMinWidth
125
+ })
126
+ });
127
+ };
128
+ const resolvedOnCell = (record, rowIndex) => {
129
+ var _a2;
130
+ const base = (_a2 = onCell == null ? void 0 : onCell(record, rowIndex)) != null ? _a2 : {};
131
+ return __spreadProps(__spreadValues({}, base), {
132
+ className: clsx(base.className, bodyCellClassName),
133
+ style: __spreadProps(__spreadValues({}, base.style), {
134
+ minWidth: resolvedMinWidth
135
+ })
136
+ });
137
+ };
138
+ const processedTitle = headerProps ? /* @__PURE__ */ jsx(ColumnHeader, __spreadValues({ label: title }, headerProps)) : title;
139
+ return __spreadProps(__spreadValues({}, rest), {
140
+ width: (_c = col.width) != null ? _c : columnMinWidth,
141
+ title: processedTitle,
142
+ onHeaderCell: resolvedOnHeaderCell,
143
+ onCell: resolvedOnCell
144
+ });
145
+ });
146
+ }
147
+ function Table(props) {
148
+ var _b;
149
+ const _a = props, {
150
+ size = "middle",
151
+ variant = "default",
152
+ isAccordion = false,
153
+ isToolbar = false,
154
+ className = "",
155
+ pagination,
156
+ loading,
157
+ total,
158
+ current,
159
+ pageSize,
160
+ onPaginationChange,
161
+ columns,
162
+ rowSelection,
163
+ rowKey = "key",
164
+ onRow,
165
+ dataSource,
166
+ emptyState,
167
+ hideHeader,
168
+ loadingIndicator,
169
+ style,
170
+ headerCellClassName,
171
+ bodyCellClassName,
172
+ rowClassName,
173
+ columnMinWidth
174
+ } = _a, rest = __objRest(_a, [
175
+ "size",
176
+ "variant",
177
+ "isAccordion",
178
+ "isToolbar",
179
+ "className",
180
+ "pagination",
181
+ "loading",
182
+ "total",
183
+ "current",
184
+ "pageSize",
185
+ "onPaginationChange",
186
+ "columns",
187
+ "rowSelection",
188
+ "rowKey",
189
+ "onRow",
190
+ "dataSource",
191
+ "emptyState",
192
+ "hideHeader",
193
+ "loadingIndicator",
194
+ "style",
195
+ "headerCellClassName",
196
+ "bodyCellClassName",
197
+ "rowClassName",
198
+ "columnMinWidth"
199
+ ]);
200
+ const isChildVariant = isAccordion || isToolbar;
201
+ const resolvedPagination = buildPagination(pagination, {
202
+ total,
203
+ current,
204
+ pageSize,
205
+ onChange: onPaginationChange
206
+ });
207
+ const processedColumns = React.useMemo(
208
+ () => processColumns(columns, headerCellClassName, bodyCellClassName, columnMinWidth),
209
+ [columns, headerCellClassName, bodyCellClassName, columnMinWidth]
210
+ );
211
+ const resolvedRowSelection = React.useMemo(() => {
212
+ if (!rowSelection) return void 0;
213
+ return __spreadValues({
214
+ columnWidth: 48
215
+ }, rowSelection);
216
+ }, [rowSelection]);
217
+ const resolvedOnRow = React.useMemo(() => {
218
+ const onChange = resolvedRowSelection == null ? void 0 : resolvedRowSelection.onChange;
219
+ if (variant !== "selectable" || !onChange) return onRow;
220
+ return (record, index) => {
221
+ var _a2;
222
+ const base = (_a2 = onRow == null ? void 0 : onRow(record, index)) != null ? _a2 : {};
223
+ const getKey = (r, i) => typeof rowKey === "function" ? rowKey(r, i) : r[rowKey];
224
+ return __spreadProps(__spreadValues({}, base), {
225
+ style: __spreadValues({ cursor: "pointer" }, base.style),
226
+ onClick: (e) => {
227
+ var _a3, _b2;
228
+ (_a3 = base.onClick) == null ? void 0 : _a3.call(base, e);
229
+ const key = getKey(record, index);
230
+ const current2 = (_b2 = resolvedRowSelection.selectedRowKeys) != null ? _b2 : [];
231
+ const isSelected = current2.some((k) => k === key);
232
+ const newKeys = isSelected ? current2.filter((k) => k !== key) : [...current2, key];
233
+ const newRows = (dataSource != null ? dataSource : []).filter(
234
+ (r) => newKeys.some((k) => k === getKey(r))
235
+ );
236
+ onChange(newKeys, newRows, { type: "single" });
237
+ }
238
+ });
239
+ };
240
+ }, [variant, resolvedRowSelection, rowKey, onRow, dataSource]);
241
+ return /* @__PURE__ */ jsx(
242
+ "div",
243
+ {
244
+ className: clsx(
245
+ Table_module_default.tableWrapper,
246
+ Table_module_default.showHoverEffect,
247
+ {
248
+ [Table_module_default.isAccordion]: isAccordion,
249
+ [Table_module_default.isToolbar]: isToolbar,
250
+ [Table_module_default.hasCustomHeaderCell]: !!headerCellClassName,
251
+ [Table_module_default.hasCustomBodyCell]: !!bodyCellClassName
252
+ },
253
+ className
254
+ ),
255
+ style,
256
+ "data-testid": "lumina-table",
257
+ children: /* @__PURE__ */ jsx(
258
+ AntTable,
259
+ __spreadProps(__spreadValues({
260
+ className: Table_module_default.table,
261
+ size,
262
+ pagination: resolvedPagination,
263
+ columns: processedColumns,
264
+ rowSelection: resolvedRowSelection,
265
+ rowKey,
266
+ onRow: resolvedOnRow,
267
+ dataSource,
268
+ showHeader: !hideHeader,
269
+ locale: {
270
+ emptyText: loading && loadingIndicator ? loadingIndicator : loading ? " " : emptyState
271
+ }
272
+ }, rest), {
273
+ loading: loadingIndicator ? { spinning: !!loading && ((_b = dataSource == null ? void 0 : dataSource.length) != null ? _b : 0) > 0, indicator: loadingIndicator } : loading,
274
+ rowClassName: (record, index) => {
275
+ var _a2;
276
+ return clsx(
277
+ {
278
+ [Table_module_default.firstRow]: index === 0,
279
+ [Table_module_default.lastRow]: index === ((_a2 = dataSource == null ? void 0 : dataSource.length) != null ? _a2 : 0) - 1
280
+ },
281
+ typeof rowClassName === "function" ? rowClassName(record, index) : rowClassName
282
+ );
283
+ }
284
+ })
285
+ )
286
+ }
287
+ );
288
+ }
289
+ Table.displayName = "Table";
290
+ var Table_default = Table;
291
+
292
+ export {
293
+ Table,
294
+ Table_default
295
+ };