@rehagro/ui 1.0.59 → 1.0.60

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.d.mts CHANGED
@@ -960,6 +960,10 @@ type TableProps<T> = Omit<React__default.HTMLAttributes<HTMLTableElement>, "chil
960
960
  rowClickable?: boolean;
961
961
  /** Callback invoked when a row is clicked: `(row, index, event)` */
962
962
  onRowClick?: (row: T, index: number, event?: React__default.MouseEvent<HTMLTableRowElement>) => void;
963
+ /** Disables all editable controls inside table cells ("select", "date", "textInput") */
964
+ disableEditableControls?: boolean;
965
+ /** @deprecated Use `disableEditableControls` instead */
966
+ disableEditableSelects?: boolean;
963
967
  };
964
968
  declare const Table: <T>(props: TableProps<T> & {
965
969
  ref?: React__default.ForwardedRef<HTMLTableElement>;
package/dist/index.d.ts CHANGED
@@ -960,6 +960,10 @@ type TableProps<T> = Omit<React__default.HTMLAttributes<HTMLTableElement>, "chil
960
960
  rowClickable?: boolean;
961
961
  /** Callback invoked when a row is clicked: `(row, index, event)` */
962
962
  onRowClick?: (row: T, index: number, event?: React__default.MouseEvent<HTMLTableRowElement>) => void;
963
+ /** Disables all editable controls inside table cells ("select", "date", "textInput") */
964
+ disableEditableControls?: boolean;
965
+ /** @deprecated Use `disableEditableControls` instead */
966
+ disableEditableSelects?: boolean;
963
967
  };
964
968
  declare const Table: <T>(props: TableProps<T> & {
965
969
  ref?: React__default.ForwardedRef<HTMLTableElement>;
package/dist/index.js CHANGED
@@ -4573,7 +4573,8 @@ var CustomSelect = ({
4573
4573
  textColor,
4574
4574
  placeholderColor,
4575
4575
  backgroundColor,
4576
- type = "select"
4576
+ type = "select",
4577
+ disabled = false
4577
4578
  }) => {
4578
4579
  const [isOpen, setIsOpen] = React9.useState(false);
4579
4580
  const [dropdownStyle, setDropdownStyle] = React9.useState({});
@@ -4607,6 +4608,7 @@ var CustomSelect = ({
4607
4608
  };
4608
4609
  };
4609
4610
  const openDropdown = () => {
4611
+ if (disabled) return;
4610
4612
  if (!isOpen) setDropdownStyle(calcPosition());
4611
4613
  setIsOpen((prev) => !prev);
4612
4614
  };
@@ -4655,6 +4657,7 @@ var CustomSelect = ({
4655
4657
  {
4656
4658
  ref: textAreaRef,
4657
4659
  value,
4660
+ disabled,
4658
4661
  placeholder,
4659
4662
  rows: 1,
4660
4663
  onClick: (e) => e.stopPropagation(),
@@ -4666,7 +4669,7 @@ var CustomSelect = ({
4666
4669
  color: inputTextColor,
4667
4670
  backgroundColor: backgroundColor || "transparent"
4668
4671
  },
4669
- 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"
4672
+ 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 disabled:rh-opacity-60 disabled:rh-cursor-not-allowed disabled:hover:rh-border-transparent disabled:hover:rh-ring-0"
4670
4673
  }
4671
4674
  ),
4672
4675
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: `.rh-table-textarea::placeholder { color: ${inputPlaceholderColor}; }` })
@@ -4677,12 +4680,13 @@ var CustomSelect = ({
4677
4680
  "button",
4678
4681
  {
4679
4682
  type: "button",
4683
+ disabled,
4680
4684
  onClick: (e) => {
4681
4685
  e.stopPropagation();
4682
4686
  openDropdown();
4683
4687
  },
4684
4688
  style: { backgroundColor: backgroundColor || void 0 },
4685
- 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",
4689
+ 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 disabled:rh-cursor-not-allowed disabled:rh-opacity-60 disabled:hover:rh-border-transparent disabled:hover:rh-ring-0",
4686
4690
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-flex rh-items-center rh-gap-2 rh-flex-1 rh-px-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(
4687
4691
  "span",
4688
4692
  {
@@ -4768,6 +4772,8 @@ function TableInner({
4768
4772
  rowKey,
4769
4773
  rowClickable = false,
4770
4774
  onRowClick,
4775
+ disableEditableControls = false,
4776
+ disableEditableSelects = false,
4771
4777
  size = "md",
4772
4778
  variant = "default",
4773
4779
  sort,
@@ -4787,6 +4793,7 @@ function TableInner({
4787
4793
  className = "",
4788
4794
  ...rest
4789
4795
  }, ref) {
4796
+ const shouldDisableEditableControls = disableEditableControls || disableEditableSelects;
4790
4797
  const handleSort = (column) => {
4791
4798
  if (!column.sortable || !onSortChange) return;
4792
4799
  const newDirection = sort?.key === column.key ? sort.direction === "asc" ? "desc" : sort.direction === "desc" ? null : "asc" : "asc";
@@ -4879,7 +4886,7 @@ function TableInner({
4879
4886
  }
4880
4887
  return column.editablePlaceholderColor;
4881
4888
  };
4882
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-full rh-rounded rh-overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(
4889
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-full rh-rounded", children: /* @__PURE__ */ jsxRuntime.jsxs(
4883
4890
  "table",
4884
4891
  {
4885
4892
  ref,
@@ -4997,6 +5004,7 @@ function TableInner({
4997
5004
  CustomSelect,
4998
5005
  {
4999
5006
  type: column.type ?? "select",
5007
+ disabled: shouldDisableEditableControls,
5000
5008
  options: column.choices,
5001
5009
  value: column.editableValue(row),
5002
5010
  placeholder: column.editablePlaceholder,