@machinemetrics/mm-react-components 0.2.3-26 → 0.2.3-28

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.
@@ -10340,6 +10340,32 @@ var Content$3 = DialogContent$1;
10340
10340
  var Title = DialogTitle$1;
10341
10341
  var Description = DialogDescription$1;
10342
10342
  var Close = DialogClose$1;
10343
+ const SheetBanner = React.forwardRef(
10344
+ ({ variant, icon, text: text2, additionalText, className, ...props }, ref) => {
10345
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
10346
+ "div",
10347
+ {
10348
+ ref,
10349
+ "data-slot": "sheet-banner",
10350
+ className: cn$1(
10351
+ "sheet-banner",
10352
+ variant === "shared" ? "sheet-banner-shared" : "sheet-banner-company",
10353
+ className
10354
+ ),
10355
+ ...props,
10356
+ children: [
10357
+ icon,
10358
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sheet-banner-text", children: text2 }),
10359
+ additionalText && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10360
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sheet-banner-text", children: "|" }),
10361
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sheet-banner-text", children: additionalText })
10362
+ ] })
10363
+ ]
10364
+ }
10365
+ );
10366
+ }
10367
+ );
10368
+ SheetBanner.displayName = "SheetBanner";
10343
10369
  function Sheet({ ...props }) {
10344
10370
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Root$9, { "data-slot": "sheet", ...props });
10345
10371
  }
@@ -10425,6 +10451,11 @@ function SheetContent({
10425
10451
  side = "right",
10426
10452
  showCloseButton = true,
10427
10453
  closeButtonPosition = "corner",
10454
+ showBanner = false,
10455
+ bannerVariant,
10456
+ bannerIcon,
10457
+ bannerText,
10458
+ bannerAdditionalText,
10428
10459
  ...props
10429
10460
  }) {
10430
10461
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(SheetPortal, { children: [
@@ -10434,7 +10465,8 @@ function SheetContent({
10434
10465
  {
10435
10466
  "data-slot": "sheet-content",
10436
10467
  className: cn$1(
10437
- "data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 outline-none",
10468
+ "data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 outline-none",
10469
+ showBanner ? "gap-0" : "gap-4",
10438
10470
  side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
10439
10471
  side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
10440
10472
  side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
@@ -10443,12 +10475,24 @@ function SheetContent({
10443
10475
  ),
10444
10476
  ...props,
10445
10477
  children: [
10478
+ showBanner && bannerVariant && bannerIcon && bannerText && /* @__PURE__ */ jsxRuntimeExports.jsx(
10479
+ SheetBanner,
10480
+ {
10481
+ variant: bannerVariant,
10482
+ icon: bannerIcon,
10483
+ text: bannerText,
10484
+ additionalText: bannerAdditionalText
10485
+ }
10486
+ ),
10446
10487
  children,
10447
10488
  showCloseButton && closeButtonPosition === "corner" && /* @__PURE__ */ jsxRuntimeExports.jsxs(
10448
10489
  Close,
10449
10490
  {
10450
10491
  "data-slot": "sheet-close",
10451
- className: "absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none",
10492
+ className: cn$1(
10493
+ "absolute right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:outline-none disabled:pointer-events-none",
10494
+ showBanner ? "top-12" : "top-4"
10495
+ ),
10452
10496
  children: [
10453
10497
  /* @__PURE__ */ jsxRuntimeExports.jsx(X$1, { className: "size-4" }),
10454
10498
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Close" })
@@ -30336,7 +30380,8 @@ function TableBody({
30336
30380
  renderOrder,
30337
30381
  isDragging,
30338
30382
  activeColumnId,
30339
- skeletonRowCount = 5
30383
+ skeletonRowCount = 5,
30384
+ onRowClick
30340
30385
  }) {
30341
30386
  let tableContent;
30342
30387
  if (loading) {
@@ -30344,11 +30389,24 @@ function TableBody({
30344
30389
  } else if (rows?.length) {
30345
30390
  tableContent = rows.map((row) => {
30346
30391
  const visibleCells = getVisibleCellsInOrder(row, isDragging, renderOrder);
30392
+ const handleRowClick = onRowClick ? (event) => {
30393
+ const target = event.target;
30394
+ if (!target) return;
30395
+ const interactive = target.closest(
30396
+ 'a,button,input,select,textarea,label,[role=checkbox],[data-slot="table-action-trigger"]'
30397
+ );
30398
+ if (interactive) return;
30399
+ onRowClick(row.original, row.index);
30400
+ } : void 0;
30347
30401
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
30348
30402
  "tr",
30349
30403
  {
30350
30404
  "data-state": row.getIsSelected() && "selected",
30351
- className: "border-b transition-colors hover:bg-[var(--accent)] data-[state=selected]:bg-muted",
30405
+ className: cn$1(
30406
+ "border-b transition-colors hover:bg-[var(--accent)] data-[state=selected]:bg-muted",
30407
+ onRowClick && "cursor-pointer"
30408
+ ),
30409
+ onClick: handleRowClick,
30352
30410
  children: visibleCells.map(
30353
30411
  (cell) => renderTableCell(cell, isDragging, activeColumnId)
30354
30412
  )
@@ -30490,7 +30548,8 @@ function renderTableContent({
30490
30548
  handleDragOver,
30491
30549
  handleDragEnd,
30492
30550
  tableRef,
30493
- debug: debug2
30551
+ debug: debug2,
30552
+ onRowClick
30494
30553
  }) {
30495
30554
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
30496
30555
  DndContext,
@@ -30534,7 +30593,8 @@ function renderTableContent({
30534
30593
  renderOrder,
30535
30594
  isDragging,
30536
30595
  activeColumnId,
30537
- skeletonRowCount
30596
+ skeletonRowCount,
30597
+ onRowClick
30538
30598
  }
30539
30599
  )
30540
30600
  ]
@@ -30576,7 +30636,8 @@ function DataTable({
30576
30636
  setGlobalFilter,
30577
30637
  handleResetColumns,
30578
30638
  onBatchAction: controllerOnBatchAction,
30579
- onExportComplete: controllerOnExportComplete
30639
+ onExportComplete: controllerOnExportComplete,
30640
+ onRowClick: controllerOnRowClick
30580
30641
  } = useTableController({
30581
30642
  columns,
30582
30643
  data,
@@ -30652,7 +30713,8 @@ function DataTable({
30652
30713
  handleDragOver,
30653
30714
  handleDragEnd,
30654
30715
  tableRef,
30655
- debug: debug2
30716
+ debug: debug2,
30717
+ onRowClick: controllerOnRowClick
30656
30718
  });
30657
30719
  const toolbarElement = /* @__PURE__ */ jsxRuntimeExports.jsx(
30658
30720
  DataTableToolbar,
@@ -45704,6 +45766,7 @@ export {
45704
45766
  SelectValue,
45705
45767
  Separator,
45706
45768
  Sheet,
45769
+ SheetBanner,
45707
45770
  SheetClose,
45708
45771
  SheetCloseButton,
45709
45772
  SheetContent,