@onesaz/ui 0.3.13 → 0.3.15

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.js CHANGED
@@ -3670,7 +3670,7 @@ var Combobox = React34.forwardRef(
3670
3670
  disabled,
3671
3671
  onClick: () => setOpen(!open),
3672
3672
  className: cn(
3673
- "flex min-h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm",
3673
+ "flex min-h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm text-left",
3674
3674
  "ring-offset-background",
3675
3675
  "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
3676
3676
  "disabled:cursor-not-allowed disabled:opacity-50",
@@ -4167,7 +4167,7 @@ var ColumnVisibilityDropdown = ({
4167
4167
  }
4168
4168
  ),
4169
4169
  open && /* @__PURE__ */ jsxs20("div", { className: "absolute right-0 top-full mt-1 z-50 min-w-[180px] rounded-md border border-border bg-popover p-2 shadow-md", children: [
4170
- /* @__PURE__ */ jsx35("div", { className: "text-sm font-medium text-foreground mb-2 px-2", children: "Show/Hide Columns" }),
4170
+ /* @__PURE__ */ jsx35("div", { className: "text-xs font-medium text-foreground mb-2 px-2", children: "Show/Hide Columns" }),
4171
4171
  /* @__PURE__ */ jsx35("div", { className: "max-h-[300px] overflow-auto", children: allColumns.map((column) => {
4172
4172
  const meta = column.columnDef.meta;
4173
4173
  const headerName = meta?.headerName || column.id;
@@ -4183,7 +4183,7 @@ var ColumnVisibilityDropdown = ({
4183
4183
  onChange: (e) => column.toggleVisibility(e.target.checked)
4184
4184
  }
4185
4185
  ),
4186
- /* @__PURE__ */ jsx35("span", { className: "text-sm", children: headerName })
4186
+ /* @__PURE__ */ jsx35("span", { className: "text-xs", children: headerName })
4187
4187
  ]
4188
4188
  },
4189
4189
  column.id
@@ -4251,19 +4251,19 @@ var DataGridPagination = ({
4251
4251
  const startRow = currentPage * pageSize + 1;
4252
4252
  const endRow = Math.min((currentPage + 1) * pageSize, totalRows);
4253
4253
  return /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-end gap-4 px-4 py-3 border-t border-border bg-background", children: [
4254
- /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 text-sm text-muted-foreground whitespace-nowrap", children: [
4254
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 text-xs text-muted-foreground whitespace-nowrap", children: [
4255
4255
  /* @__PURE__ */ jsx35("span", { children: "Rows per page:" }),
4256
4256
  /* @__PURE__ */ jsx35(
4257
4257
  "select",
4258
4258
  {
4259
4259
  value: pageSize,
4260
4260
  onChange: (e) => table.setPageSize(Number(e.target.value)),
4261
- className: "h-8 rounded-md border border-border bg-background px-2 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring",
4261
+ className: "h-8 rounded-md border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-ring",
4262
4262
  children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx35("option", { value: size, children: size }, size))
4263
4263
  }
4264
4264
  )
4265
4265
  ] }),
4266
- /* @__PURE__ */ jsxs20("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
4266
+ /* @__PURE__ */ jsxs20("span", { className: "text-xs text-muted-foreground whitespace-nowrap", children: [
4267
4267
  startRow,
4268
4268
  "-",
4269
4269
  endRow,
@@ -4402,7 +4402,7 @@ var ExportDropdown = ({
4402
4402
  /* @__PURE__ */ jsxs20(
4403
4403
  "button",
4404
4404
  {
4405
- className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
4405
+ className: "flex w-full items-center gap-2 rounded px-3 py-2 text-xs hover:bg-muted",
4406
4406
  onClick: exportToCSV,
4407
4407
  children: [
4408
4408
  /* @__PURE__ */ jsxs20("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
@@ -4416,7 +4416,7 @@ var ExportDropdown = ({
4416
4416
  onExport && /* @__PURE__ */ jsxs20(
4417
4417
  "button",
4418
4418
  {
4419
- className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
4419
+ className: "flex w-full items-center gap-2 rounded px-3 py-2 text-xs hover:bg-muted",
4420
4420
  onClick: handleCustomExport,
4421
4421
  children: [
4422
4422
  /* @__PURE__ */ jsxs20("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
@@ -4463,7 +4463,7 @@ var MoreOptionsDropdown = ({
4463
4463
  open && /* @__PURE__ */ jsx35("div", { className: "absolute right-0 top-full mt-1 z-50 min-w-[160px] rounded-md border border-border bg-popover p-1 shadow-md", children: options.map((option, index) => /* @__PURE__ */ jsxs20(
4464
4464
  "button",
4465
4465
  {
4466
- className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
4466
+ className: "flex w-full items-center gap-2 rounded px-3 py-2 text-xs hover:bg-muted",
4467
4467
  onClick: () => {
4468
4468
  option.onClick();
4469
4469
  setOpen(false);
@@ -4845,91 +4845,83 @@ var PinnedRowsRenderer = ({
4845
4845
  globalWrapText = false,
4846
4846
  columnWidths,
4847
4847
  pinnedColumnOffsets,
4848
- position
4848
+ position,
4849
+ columnVisibility
4849
4850
  }) => {
4850
4851
  const pinnedTable = useReactTable({
4851
4852
  data: pinnedData,
4852
4853
  columns: tanstackColumns,
4853
4854
  getCoreRowModel: getCoreRowModel(),
4854
- getRowId: getRowIdFn ? (row) => String(getRowIdFn(row)) : void 0
4855
+ getRowId: getRowIdFn ? (row) => String(getRowIdFn(row)) : void 0,
4856
+ state: { columnVisibility }
4855
4857
  });
4856
4858
  const pinnedRows = pinnedTable.getRowModel().rows;
4857
4859
  if (pinnedRows.length === 0) return null;
4858
- return /* @__PURE__ */ jsx35(
4859
- "tbody",
4860
- {
4861
- className: cn(
4862
- "sticky z-[2]",
4863
- position === "top" && "top-0",
4864
- position === "bottom" && "bottom-0"
4865
- ),
4866
- children: pinnedRows.map((row, rowIndex) => {
4867
- const customClassName = getRowClassName?.({ row: row.original, rowIndex });
4868
- return /* @__PURE__ */ jsx35(
4869
- "tr",
4870
- {
4871
- className: cn(
4872
- "border-b border-border bg-muted/60 font-medium",
4873
- position === "top" && "border-b-2 border-b-border",
4874
- position === "bottom" && "border-t-2 border-t-border",
4875
- customClassName
4876
- ),
4877
- children: row.getVisibleCells().map((cell) => {
4878
- const meta = cell.column.columnDef.meta;
4879
- const align = meta?.align || "left";
4880
- const wrapText = meta?.wrapText !== void 0 ? meta.wrapText : globalWrapText;
4881
- const scrollable = meta?.scrollable || false;
4882
- const maxCellHeight = meta?.maxCellHeight || 100;
4883
- const cellClassName = meta?.cellClassName;
4884
- const colWidth = columnWidths.get(cell.column.id);
4885
- const width = colWidth?.width || cell.column.getSize();
4886
- const pinnedInfo = pinnedColumnOffsets?.get(cell.column.id);
4887
- return /* @__PURE__ */ jsx35(
4888
- "td",
4860
+ return /* @__PURE__ */ jsx35("tbody", { children: pinnedRows.map((row, rowIndex) => {
4861
+ const customClassName = getRowClassName?.({ row: row.original, rowIndex });
4862
+ return /* @__PURE__ */ jsx35(
4863
+ "tr",
4864
+ {
4865
+ className: cn(
4866
+ "sticky z-[2] border-b border-border bg-muted font-medium",
4867
+ position === "top" && "top-0 border-b-2 border-b-border",
4868
+ position === "bottom" && "bottom-0 border-t-2 border-t-border",
4869
+ customClassName
4870
+ ),
4871
+ children: row.getVisibleCells().map((cell) => {
4872
+ const meta = cell.column.columnDef.meta;
4873
+ const align = meta?.align || "left";
4874
+ const wrapText = meta?.wrapText !== void 0 ? meta.wrapText : globalWrapText;
4875
+ const scrollable = meta?.scrollable || false;
4876
+ const maxCellHeight = meta?.maxCellHeight || 100;
4877
+ const cellClassName = meta?.cellClassName;
4878
+ const colWidth = columnWidths.get(cell.column.id);
4879
+ const width = colWidth?.width || cell.column.getSize();
4880
+ const pinnedInfo = pinnedColumnOffsets?.get(cell.column.id);
4881
+ return /* @__PURE__ */ jsx35(
4882
+ "td",
4883
+ {
4884
+ className: cn(
4885
+ "px-4 overflow-hidden bg-muted border-b border-border",
4886
+ showCellVerticalBorder && "border-r border-border",
4887
+ pinnedInfo && "sticky z-[3]",
4888
+ pinnedInfo?.side === "left" && "border-r border-border",
4889
+ pinnedInfo?.side === "right" && "border-l border-border"
4890
+ ),
4891
+ style: {
4892
+ height: wrapText || scrollable ? "auto" : rowHeight,
4893
+ minHeight: rowHeight,
4894
+ textAlign: align,
4895
+ width,
4896
+ maxWidth: colWidth?.maxWidth || width,
4897
+ minWidth: colWidth?.minWidth || cell.column.columnDef.minSize,
4898
+ ...pinnedInfo ? {
4899
+ position: "sticky",
4900
+ [pinnedInfo.side]: pinnedInfo.offset
4901
+ } : {}
4902
+ },
4903
+ children: /* @__PURE__ */ jsx35(
4904
+ "div",
4889
4905
  {
4890
4906
  className: cn(
4891
- "px-4 overflow-hidden bg-muted/60 border-b border-border",
4892
- showCellVerticalBorder && "border-r border-border",
4893
- pinnedInfo && "sticky z-[3]",
4894
- pinnedInfo?.side === "left" && "border-r border-border",
4895
- pinnedInfo?.side === "right" && "border-l border-border"
4907
+ wrapText ? "whitespace-normal break-words" : scrollable ? "overflow-auto" : "truncate",
4908
+ scrollable && "max-h-[100px]",
4909
+ cellClassName
4896
4910
  ),
4897
4911
  style: {
4898
- height: wrapText || scrollable ? "auto" : rowHeight,
4899
- minHeight: rowHeight,
4900
- textAlign: align,
4901
- width,
4902
- maxWidth: colWidth?.maxWidth || width,
4903
- minWidth: colWidth?.minWidth || cell.column.columnDef.minSize,
4904
- ...pinnedInfo ? {
4905
- position: "sticky",
4906
- [pinnedInfo.side]: pinnedInfo.offset
4907
- } : {}
4912
+ maxHeight: scrollable ? `${maxCellHeight}px` : void 0
4908
4913
  },
4909
- children: /* @__PURE__ */ jsx35(
4910
- "div",
4911
- {
4912
- className: cn(
4913
- wrapText ? "whitespace-normal break-words" : scrollable ? "overflow-auto" : "truncate",
4914
- scrollable && "max-h-[100px]",
4915
- cellClassName
4916
- ),
4917
- style: {
4918
- maxHeight: scrollable ? `${maxCellHeight}px` : void 0
4919
- },
4920
- children: flexRender(cell.column.columnDef.cell, cell.getContext())
4921
- }
4922
- )
4923
- },
4924
- cell.id
4925
- );
4926
- })
4927
- },
4928
- row.id
4929
- );
4930
- })
4931
- }
4932
- );
4914
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
4915
+ }
4916
+ )
4917
+ },
4918
+ cell.id
4919
+ );
4920
+ })
4921
+ },
4922
+ row.id
4923
+ );
4924
+ }) });
4933
4925
  };
4934
4926
  var ColumnGroupHeader = ({
4935
4927
  columnGroupingModel,
@@ -4985,12 +4977,12 @@ var ColumnGroupHeader = ({
4985
4977
  });
4986
4978
  return cells;
4987
4979
  }, [fieldToGroup, gridColumns, columnWidths, columnVisibility, checkboxSelection, pinnedColumnOffsets]);
4988
- return /* @__PURE__ */ jsx35("tr", { className: "bg-muted border-b border-border", children: groupCells.map((cell, idx) => /* @__PURE__ */ jsx35(
4980
+ return /* @__PURE__ */ jsx35("tr", { className: "bg-muted", children: groupCells.map((cell, idx) => /* @__PURE__ */ jsx35(
4989
4981
  "th",
4990
4982
  {
4991
4983
  colSpan: cell.colSpan,
4992
4984
  className: cn(
4993
- "px-4 text-center font-semibold text-muted-foreground border-b-2 border-border bg-muted overflow-hidden",
4985
+ "px-4 text-center font-semibold text-muted-foreground border-b border-border bg-muted overflow-hidden",
4994
4986
  showColumnVerticalBorder && "border-r last:border-r-0",
4995
4987
  cell.pinnedInfo && "sticky z-[2]"
4996
4988
  ),
@@ -5056,6 +5048,7 @@ function DataGrid({
5056
5048
  columnGroupingModel
5057
5049
  }) {
5058
5050
  const tableContainerRef = React35.useRef(null);
5051
+ const effectiveVirtualized = virtualized && !columns.some((col) => col.rowSpan);
5059
5052
  const computedInitialSort = React35.useMemo(() => {
5060
5053
  if (initialSortModel && initialSortModel.length > 0) {
5061
5054
  return initialSortModel.map((s) => ({ id: s.field, desc: s.sort === "desc" }));
@@ -5151,7 +5144,7 @@ function DataGrid({
5151
5144
  data: rows,
5152
5145
  columns: tanstackColumns,
5153
5146
  getCoreRowModel: getCoreRowModel(),
5154
- getPaginationRowModel: virtualized ? void 0 : paginationMode === "client" ? getPaginationRowModel() : void 0,
5147
+ getPaginationRowModel: effectiveVirtualized ? void 0 : paginationMode === "client" ? getPaginationRowModel() : void 0,
5155
5148
  getSortedRowModel: sortingMode === "client" ? getSortedRowModel() : void 0,
5156
5149
  getFilteredRowModel: filterMode === "client" ? getFilteredRowModel() : void 0,
5157
5150
  getRowId: getRowId ? (row) => String(getRowId(row)) : void 0,
@@ -5159,7 +5152,7 @@ function DataGrid({
5159
5152
  sorting,
5160
5153
  globalFilter,
5161
5154
  rowSelection,
5162
- pagination: virtualized ? void 0 : pagination,
5155
+ pagination: effectiveVirtualized ? void 0 : pagination,
5163
5156
  columnVisibility,
5164
5157
  columnSizing
5165
5158
  },
@@ -5170,7 +5163,7 @@ function DataGrid({
5170
5163
  setRowSelection(newValue);
5171
5164
  onRowSelectionModelChange?.(newValue);
5172
5165
  },
5173
- onPaginationChange: virtualized ? void 0 : (updater) => {
5166
+ onPaginationChange: effectiveVirtualized ? void 0 : (updater) => {
5174
5167
  const newValue = typeof updater === "function" ? updater(pagination) : updater;
5175
5168
  setPagination(newValue);
5176
5169
  onPaginationModelChange?.({ page: newValue.pageIndex, pageSize: newValue.pageSize });
@@ -5196,10 +5189,10 @@ function DataGrid({
5196
5189
  }
5197
5190
  },
5198
5191
  enableRowSelection: checkboxSelection,
5199
- manualPagination: virtualized ? true : paginationMode === "server",
5192
+ manualPagination: effectiveVirtualized ? true : paginationMode === "server",
5200
5193
  manualSorting: sortingMode === "server",
5201
5194
  manualFiltering: filterMode === "server",
5202
- pageCount: virtualized ? void 0 : paginationMode === "server" && rowCount ? Math.ceil(rowCount / pagination.pageSize) : void 0
5195
+ pageCount: effectiveVirtualized ? void 0 : paginationMode === "server" && rowCount ? Math.ceil(rowCount / pagination.pageSize) : void 0
5203
5196
  });
5204
5197
  const rowHeight = densityRowHeights[density];
5205
5198
  const showQuickFilter = slotProps?.toolbar?.showQuickFilter !== false;
@@ -5225,7 +5218,7 @@ function DataGrid({
5225
5218
  "div",
5226
5219
  {
5227
5220
  className: cn(
5228
- "rounded-lg border border-border bg-background overflow-hidden flex flex-col",
5221
+ "rounded-lg border border-border bg-background overflow-hidden flex flex-col text-xs",
5229
5222
  className
5230
5223
  ),
5231
5224
  style: containerStyle,
@@ -5255,7 +5248,7 @@ function DataGrid({
5255
5248
  className: "relative flex-1 overflow-auto",
5256
5249
  children: [
5257
5250
  loading && /* @__PURE__ */ jsx35("div", { className: "absolute inset-0 bg-background/80 flex items-center justify-center z-10", children: /* @__PURE__ */ jsx35(Spinner, { size: "lg" }) }),
5258
- /* @__PURE__ */ jsxs20("table", { className: "w-full border-collapse table-fixed", children: [
5251
+ /* @__PURE__ */ jsxs20("table", { className: "w-full border-separate border-spacing-0 table-fixed", children: [
5259
5252
  /* @__PURE__ */ jsx35("colgroup", { children: table.getVisibleLeafColumns().map((column) => {
5260
5253
  const colWidth = columnWidths.get(column.id);
5261
5254
  return /* @__PURE__ */ jsx35(
@@ -5270,7 +5263,7 @@ function DataGrid({
5270
5263
  column.id
5271
5264
  );
5272
5265
  }) }),
5273
- /* @__PURE__ */ jsxs20("thead", { className: "sticky top-0 z-[1]", children: [
5266
+ /* @__PURE__ */ jsxs20("thead", { className: "sticky top-0 z-[3] bg-muted", children: [
5274
5267
  columnGroupingModel && columnGroupingModel.length > 0 && /* @__PURE__ */ jsx35(
5275
5268
  ColumnGroupHeader,
5276
5269
  {
@@ -5294,13 +5287,13 @@ function DataGrid({
5294
5287
  "th",
5295
5288
  {
5296
5289
  className: cn(
5297
- "px-4 text-left font-medium text-muted-foreground border-b border-border bg-muted overflow-hidden relative",
5290
+ "px-4 text-left text-xs font-medium text-muted-foreground border-b border-border bg-muted overflow-hidden relative",
5298
5291
  showColumnVerticalBorder && "border-r last:border-r-0",
5299
5292
  header.column.getCanSort() && "cursor-pointer select-none hover:bg-muted/80",
5300
5293
  // Add cursor class when resizing
5301
5294
  header.column.getIsResizing() && "cursor-col-resize",
5302
5295
  // Pinned column styling
5303
- pinnedInfo && "sticky z-[2]",
5296
+ pinnedInfo && "sticky z-[4]",
5304
5297
  pinnedInfo?.side === "left" && "border-r border-border",
5305
5298
  pinnedInfo?.side === "right" && "border-l border-border"
5306
5299
  ),
@@ -5351,10 +5344,11 @@ function DataGrid({
5351
5344
  globalWrapText: wrapText,
5352
5345
  columnWidths,
5353
5346
  pinnedColumnOffsets,
5347
+ columnVisibility,
5354
5348
  position: "top"
5355
5349
  }
5356
5350
  ),
5357
- virtualized ? /* @__PURE__ */ jsx35(
5351
+ effectiveVirtualized ? /* @__PURE__ */ jsx35(
5358
5352
  VirtualizedTableBody,
5359
5353
  {
5360
5354
  table,
@@ -5400,6 +5394,7 @@ function DataGrid({
5400
5394
  globalWrapText: wrapText,
5401
5395
  columnWidths,
5402
5396
  pinnedColumnOffsets,
5397
+ columnVisibility,
5403
5398
  position: "bottom"
5404
5399
  }
5405
5400
  )
@@ -5407,7 +5402,7 @@ function DataGrid({
5407
5402
  ]
5408
5403
  }
5409
5404
  ),
5410
- !virtualized && !hideFooter && !hideFooterPagination && /* @__PURE__ */ jsx35(
5405
+ !effectiveVirtualized && !hideFooter && !hideFooterPagination && /* @__PURE__ */ jsx35(
5411
5406
  DataGridPagination,
5412
5407
  {
5413
5408
  table,
@@ -5416,7 +5411,7 @@ function DataGrid({
5416
5411
  paginationMode
5417
5412
  }
5418
5413
  ),
5419
- virtualized && !hideFooter && /* @__PURE__ */ jsx35("div", { className: "flex items-center justify-end gap-4 px-4 py-3 border-t border-border bg-background", children: /* @__PURE__ */ jsxs20("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
5414
+ effectiveVirtualized && !hideFooter && /* @__PURE__ */ jsx35("div", { className: "flex items-center justify-end gap-4 px-4 py-3 border-t border-border bg-background", children: /* @__PURE__ */ jsxs20("span", { className: "text-xs text-muted-foreground whitespace-nowrap", children: [
5420
5415
  table.getFilteredRowModel().rows.length,
5421
5416
  " total rows (virtualized)"
5422
5417
  ] }) })