smartsell-ui-kit 0.1.16 → 0.1.17

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/README.md CHANGED
@@ -215,6 +215,20 @@ function CustomerField() {
215
215
 
216
216
  `TableAsync` follows the same idea for remote datasets, with debounced search and request cancellation support built into the component flow.
217
217
 
218
+ Both `Table` and `TableAsync` accept the optional `onRowClick` callback. When provided, it
219
+ receives the clicked item and its visible row index. The desktop table row and the responsive
220
+ mobile card use the same callback; the only visual change is the pointer cursor. Built-in row
221
+ action buttons stop propagation so their handlers do not also trigger `onRowClick`.
222
+
223
+ ```tsx
224
+ <Table
225
+ items={customers}
226
+ desktopColumns={desktopColumns}
227
+ mobileColumns={mobileColumns}
228
+ onRowClick={(customer) => openCustomer(customer)}
229
+ />
230
+ ```
231
+
218
232
  ## Development workflow
219
233
 
220
234
  Useful local commands:
package/dist/index.cjs CHANGED
@@ -4458,7 +4458,8 @@ function OverflowMenu({ label, children }) {
4458
4458
  "aria-label": label,
4459
4459
  "aria-haspopup": "menu",
4460
4460
  "aria-expanded": isOpen,
4461
- onClick: () => {
4461
+ onClick: (event) => {
4462
+ event.stopPropagation();
4462
4463
  if (!isOpen) {
4463
4464
  updateMenuPosition();
4464
4465
  }
@@ -4513,6 +4514,7 @@ function TableBase({
4513
4514
  desktopColumns,
4514
4515
  mobileColumns,
4515
4516
  getRowId: getCustomRowId,
4517
+ onRowClick,
4516
4518
  actions,
4517
4519
  stickyActionsColumn = true,
4518
4520
  maxInlineActions = DEFAULT_MAX_INLINE_ACTIONS,
@@ -4602,6 +4604,7 @@ function TableBase({
4602
4604
  ariaLabel,
4603
4605
  normalizedPage
4604
4606
  );
4607
+ const hasRowClick = Boolean(onRowClick);
4605
4608
  const shouldStickActionsColumn = Boolean(actions) && stickyActionsColumn;
4606
4609
  const getStickyActionsCellStyle = (backgroundColor, backgroundImage, isHeader = false) => ({
4607
4610
  position: "sticky",
@@ -4670,7 +4673,8 @@ function TableBase({
4670
4673
  disabled,
4671
4674
  title: action.label,
4672
4675
  "aria-label": action.label,
4673
- onClick: () => {
4676
+ onClick: (event) => {
4677
+ event.stopPropagation();
4674
4678
  if (disabled) {
4675
4679
  return;
4676
4680
  }
@@ -4844,8 +4848,10 @@ function TableBase({
4844
4848
  "flex min-w-0 flex-col rounded-[20px]",
4845
4849
  rowActions ? "gap-1" : "gap-2.5",
4846
4850
  "border-[3px] border-solid border-[var(--theme-background)] bg-[var(--theme-surface)]",
4847
- "px-3.5 py-3 shadow-none"
4851
+ "px-3.5 py-3 shadow-none",
4852
+ hasRowClick ? "cursor-pointer" : ""
4848
4853
  ].join(" "),
4854
+ onClick: onRowClick ? () => onRowClick(item, rowIndex) : void 0,
4849
4855
  children: [
4850
4856
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4851
4857
  "div",
@@ -5012,7 +5018,11 @@ function TableBase({
5012
5018
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5013
5019
  "tr",
5014
5020
  {
5015
- className: isAlternateRow ? "bg-[var(--theme-background)]" : "bg-[var(--theme-surface)]",
5021
+ className: [
5022
+ isAlternateRow ? "bg-[var(--theme-background)]" : "bg-[var(--theme-surface)]",
5023
+ hasRowClick ? "cursor-pointer" : ""
5024
+ ].join(" "),
5025
+ onClick: onRowClick ? () => onRowClick(item, rowIndex) : void 0,
5016
5026
  children: [
5017
5027
  desktopColumns.map((column, columnIndex) => {
5018
5028
  return renderDesktopCell(