@moontra/moonui-pro 2.26.38 → 2.26.40

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/index.mjs CHANGED
@@ -74001,44 +74001,42 @@ function DataTable({
74001
74001
  const checkboxColumn = {
74002
74002
  id: "select",
74003
74003
  header: ({ table: table2 }) => {
74004
- const isAllSelected = table2.getIsAllPageRowsSelected();
74005
- const isSomeSelected = table2.getIsSomePageRowsSelected();
74004
+ const allRowIds = table2.getRowModel().rows.map((row) => row.id);
74005
+ const isAllSelected = allRowIds.length > 0 && allRowIds.every((id) => rowSelection[id]);
74006
+ const isSomeSelected = allRowIds.some((id) => rowSelection[id]);
74006
74007
  return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
74007
- "input",
74008
+ MoonUICheckboxPro,
74008
74009
  {
74009
- type: "checkbox",
74010
- checked: isAllSelected,
74011
- ref: (el) => {
74012
- if (el) {
74013
- el.indeterminate = !isAllSelected && isSomeSelected;
74010
+ checked: isAllSelected ? true : isSomeSelected ? "indeterminate" : false,
74011
+ onCheckedChange: (value) => {
74012
+ const newSelection = {};
74013
+ if (value) {
74014
+ allRowIds.forEach((id) => {
74015
+ newSelection[id] = true;
74016
+ });
74014
74017
  }
74015
- },
74016
- onChange: (e) => {
74017
- table2.toggleAllPageRowsSelected(e.target.checked);
74018
- },
74019
- onClick: (e) => {
74020
- e.stopPropagation();
74018
+ setRowSelection(newSelection);
74021
74019
  },
74022
74020
  "aria-label": "Select all",
74023
- className: "h-4 w-4 rounded border-input bg-background text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 accent-primary",
74024
- style: { accentColor: "hsl(var(--primary))" }
74021
+ className: "h-4 w-4"
74025
74022
  }
74026
74023
  ) });
74027
74024
  },
74028
74025
  cell: ({ row }) => {
74026
+ const rowId = row.id;
74027
+ const isSelected = !!rowSelection[rowId];
74029
74028
  return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(
74030
- "input",
74029
+ MoonUICheckboxPro,
74031
74030
  {
74032
- type: "checkbox",
74033
- checked: row.getIsSelected(),
74034
- disabled: !row.getCanSelect(),
74035
- onChange: row.getToggleSelectedHandler(),
74036
- onClick: (e) => {
74037
- e.stopPropagation();
74031
+ checked: isSelected,
74032
+ onCheckedChange: (value) => {
74033
+ setRowSelection((prev) => ({
74034
+ ...prev,
74035
+ [rowId]: !!value
74036
+ }));
74038
74037
  },
74039
74038
  "aria-label": "Select row",
74040
- className: "h-4 w-4 rounded border-input bg-background text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 accent-primary",
74041
- style: { accentColor: "hsl(var(--primary))" }
74039
+ className: "h-4 w-4"
74042
74040
  }
74043
74041
  ) });
74044
74042
  },
@@ -74167,10 +74165,11 @@ function DataTable({
74167
74165
  });
74168
74166
  t__default.useEffect(() => {
74169
74167
  if (onRowSelect && selectable) {
74170
- const selectedRows = table.getFilteredSelectedRowModel().rows.map((row) => row.original);
74168
+ const selectedRowIds = Object.keys(rowSelection).filter((id) => rowSelection[id]);
74169
+ const selectedRows = table.getRowModel().rows.filter((row) => selectedRowIds.includes(row.id)).map((row) => row.original);
74171
74170
  onRowSelect(selectedRows);
74172
74171
  }
74173
- }, [rowSelection]);
74172
+ }, [rowSelection, onRowSelect, selectable]);
74174
74173
  table.getState();
74175
74174
  const rowModel = table.getRowModel();
74176
74175
  const rowsRef = t__default.useRef(rowModel.rows);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.26.38",
3
+ "version": "2.26.40",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",