@rehagro/ui 1.0.54 → 1.0.56

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
@@ -4083,6 +4083,7 @@ var CustomSelect = ({
4083
4083
  value,
4084
4084
  placeholder,
4085
4085
  rows: 1,
4086
+ onClick: (e) => e.stopPropagation(),
4086
4087
  onInput: (e) => {
4087
4088
  onChange(e.currentTarget.value);
4088
4089
  resizeTextArea();
@@ -4091,7 +4092,7 @@ var CustomSelect = ({
4091
4092
  color: inputTextColor,
4092
4093
  backgroundColor: backgroundColor || "transparent"
4093
4094
  },
4094
- className: "rh-table-textarea rh-flex rh-items-center rh-leading-[20px] rh-py-[7px] rh-w-full rh-min-h-[40px] rh-text-sm rh-px-1 rh-border rh-bg-surface rh-rounded-xs rh-border-transparent rh-line-height-[20px] rh-outline-none rh-resize-none rh-overflow-hidden hover:rh-border-primary focus:rh-border-primary focus:rh-ring-2 focus:rh-ring-gray-200"
4095
+ className: "rh-table-textarea rh-flex rh-items-center rh-leading-[20px] rh-py-[7px] rh-w-full rh-min-h-[40px] rh-text-sm rh-px-1 rh-border rh-bg-surface rh-rounded-xs rh-border-transparent rh-line-height-[20px] rh-outline-none rh-resize-none rh-overflow-hidden hover:rh-border-primary hover:rh-ring-2 hover:rh-ring-gray-200"
4095
4096
  }
4096
4097
  ),
4097
4098
  /* @__PURE__ */ jsx("style", { children: `.rh-table-textarea::placeholder { color: ${inputPlaceholderColor}; }` })
@@ -4102,13 +4103,16 @@ var CustomSelect = ({
4102
4103
  "button",
4103
4104
  {
4104
4105
  type: "button",
4105
- onClick: openDropdown,
4106
+ onClick: (e) => {
4107
+ e.stopPropagation();
4108
+ openDropdown();
4109
+ },
4106
4110
  style: { backgroundColor: backgroundColor || void 0 },
4107
4111
  className: "rh-w-full rh-min-h-[40px] rh-flex rh-items-center rh-border rh-bg-surface rh-rounded-sm rh-border-transparent rh-justify-between rh-py-2 hover:rh-border-primary hover:rh-ring-2 hover:rh-ring-gray-200 rh-cursor-pointer rh-text-left",
4108
4112
  children: /* @__PURE__ */ jsx("div", { className: "rh-flex rh-items-center rh-gap-2 rh-flex-1 rh-px-0.5", children: /* @__PURE__ */ jsx(
4109
4113
  "span",
4110
4114
  {
4111
- className: "rh-text-[14px] rh-px-2 rh-py-0.5 rh-rounded-xl rh-whitespace-normal rh-break-words",
4115
+ className: "rh-text-[14px] rh-px-3.5 rh-py-0.5 rh-rounded-xl rh-whitespace-normal rh-break-words",
4112
4116
  style: { backgroundColor: displayBg || "transparent", fontFamily: "Inter, sans-serif", color: displayTextColor },
4113
4117
  children: displayLabel
4114
4118
  }
@@ -4127,6 +4131,7 @@ var CustomSelect = ({
4127
4131
  type: "button",
4128
4132
  onMouseDown: (e) => {
4129
4133
  e.preventDefault();
4134
+ e.stopPropagation();
4130
4135
  onChange(option.value);
4131
4136
  setIsOpen(false);
4132
4137
  },
@@ -4187,6 +4192,8 @@ function TableInner({
4187
4192
  columns,
4188
4193
  data,
4189
4194
  rowKey,
4195
+ rowClickable = false,
4196
+ onRowClick,
4190
4197
  size = "md",
4191
4198
  variant = "default",
4192
4199
  sort,
@@ -4322,6 +4329,7 @@ function TableInner({
4322
4329
  style: {
4323
4330
  width: column.width,
4324
4331
  maxWidth: column.maxWidth,
4332
+ backgroundColor: column.headerBgColor ?? headerStyle?.backgroundColor,
4325
4333
  ...rowPaddingStyle
4326
4334
  },
4327
4335
  className: [
@@ -4332,10 +4340,17 @@ function TableInner({
4332
4340
  column.sortable ? "rh-cursor-pointer rh-select-none hover:rh-text-text" : ""
4333
4341
  ].filter(Boolean).join(" "),
4334
4342
  onClick: () => handleSort(column),
4335
- children: /* @__PURE__ */ jsxs("span", { className: "rh-inline-flex rh-items-center", style: headerTextStyleInline, children: [
4336
- column.header,
4337
- renderSortIcon(column)
4338
- ] })
4343
+ children: /* @__PURE__ */ jsxs(
4344
+ "span",
4345
+ {
4346
+ className: "rh-inline-flex rh-items-center",
4347
+ style: column.headerTextColor ? { ...headerTextStyleInline, color: column.headerTextColor } : headerTextStyleInline,
4348
+ children: [
4349
+ column.header,
4350
+ renderSortIcon(column)
4351
+ ]
4352
+ }
4353
+ )
4339
4354
  },
4340
4355
  column.key
4341
4356
  ))
@@ -4382,9 +4397,18 @@ function TableInner({
4382
4397
  style: bodyStyleInline,
4383
4398
  className: [
4384
4399
  "rh-border-b rh-border-border rh-transition-colors",
4400
+ rowClickable ? "rh-cursor-pointer" : "",
4385
4401
  "hover:rh-bg-background/50",
4386
4402
  variant === "striped" && index % 2 === 1 ? "rh-bg-background/50" : ""
4387
4403
  ].filter(Boolean).join(" "),
4404
+ onClick: (e) => {
4405
+ if (!rowClickable || !onRowClick) return;
4406
+ const target = e.target;
4407
+ if (!target) return;
4408
+ const interactiveSelector = 'button, a, input, select, textarea, label, [role="button"], [data-no-row-click]';
4409
+ if (target.closest(interactiveSelector)) return;
4410
+ onRowClick(row, index, e);
4411
+ },
4388
4412
  children: columns.map((column) => /* @__PURE__ */ jsx(
4389
4413
  "td",
4390
4414
  {
@@ -4394,7 +4418,7 @@ function TableInner({
4394
4418
  alignClasses[column.align || "left"],
4395
4419
  "rh-text-text"
4396
4420
  ].filter(Boolean).join(" "),
4397
- children: /* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-between rh-gap-2", children: [
4421
+ children: /* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-stretch rh-justify-between rh-gap-2 rh-h-full", children: [
4398
4422
  isEditableCell(column) ? /* @__PURE__ */ jsx(
4399
4423
  CustomSelect,
4400
4424
  {