@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.mjs CHANGED
@@ -4567,7 +4567,8 @@ var CustomSelect = ({
4567
4567
  textColor,
4568
4568
  placeholderColor,
4569
4569
  backgroundColor,
4570
- type = "select"
4570
+ type = "select",
4571
+ disabled = false
4571
4572
  }) => {
4572
4573
  const [isOpen, setIsOpen] = useState(false);
4573
4574
  const [dropdownStyle, setDropdownStyle] = useState({});
@@ -4601,6 +4602,7 @@ var CustomSelect = ({
4601
4602
  };
4602
4603
  };
4603
4604
  const openDropdown = () => {
4605
+ if (disabled) return;
4604
4606
  if (!isOpen) setDropdownStyle(calcPosition());
4605
4607
  setIsOpen((prev) => !prev);
4606
4608
  };
@@ -4649,6 +4651,7 @@ var CustomSelect = ({
4649
4651
  {
4650
4652
  ref: textAreaRef,
4651
4653
  value,
4654
+ disabled,
4652
4655
  placeholder,
4653
4656
  rows: 1,
4654
4657
  onClick: (e) => e.stopPropagation(),
@@ -4660,7 +4663,7 @@ var CustomSelect = ({
4660
4663
  color: inputTextColor,
4661
4664
  backgroundColor: backgroundColor || "transparent"
4662
4665
  },
4663
- 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"
4666
+ 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"
4664
4667
  }
4665
4668
  ),
4666
4669
  /* @__PURE__ */ jsx("style", { children: `.rh-table-textarea::placeholder { color: ${inputPlaceholderColor}; }` })
@@ -4671,12 +4674,13 @@ var CustomSelect = ({
4671
4674
  "button",
4672
4675
  {
4673
4676
  type: "button",
4677
+ disabled,
4674
4678
  onClick: (e) => {
4675
4679
  e.stopPropagation();
4676
4680
  openDropdown();
4677
4681
  },
4678
4682
  style: { backgroundColor: backgroundColor || void 0 },
4679
- 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",
4683
+ 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",
4680
4684
  children: /* @__PURE__ */ jsx("div", { className: "rh-flex rh-items-center rh-gap-2 rh-flex-1 rh-px-0.5", children: /* @__PURE__ */ jsx(
4681
4685
  "span",
4682
4686
  {
@@ -4762,6 +4766,8 @@ function TableInner({
4762
4766
  rowKey,
4763
4767
  rowClickable = false,
4764
4768
  onRowClick,
4769
+ disableEditableControls = false,
4770
+ disableEditableSelects = false,
4765
4771
  size = "md",
4766
4772
  variant = "default",
4767
4773
  sort,
@@ -4781,6 +4787,7 @@ function TableInner({
4781
4787
  className = "",
4782
4788
  ...rest
4783
4789
  }, ref) {
4790
+ const shouldDisableEditableControls = disableEditableControls || disableEditableSelects;
4784
4791
  const handleSort = (column) => {
4785
4792
  if (!column.sortable || !onSortChange) return;
4786
4793
  const newDirection = sort?.key === column.key ? sort.direction === "asc" ? "desc" : sort.direction === "desc" ? null : "asc" : "asc";
@@ -4873,7 +4880,7 @@ function TableInner({
4873
4880
  }
4874
4881
  return column.editablePlaceholderColor;
4875
4882
  };
4876
- return /* @__PURE__ */ jsx("div", { className: "rh-w-full rh-rounded rh-overflow-hidden", children: /* @__PURE__ */ jsxs(
4883
+ return /* @__PURE__ */ jsx("div", { className: "rh-w-full rh-rounded", children: /* @__PURE__ */ jsxs(
4877
4884
  "table",
4878
4885
  {
4879
4886
  ref,
@@ -4991,6 +4998,7 @@ function TableInner({
4991
4998
  CustomSelect,
4992
4999
  {
4993
5000
  type: column.type ?? "select",
5001
+ disabled: shouldDisableEditableControls,
4994
5002
  options: column.choices,
4995
5003
  value: column.editableValue(row),
4996
5004
  placeholder: column.editablePlaceholder,