@rehagro/ui 1.0.59 → 1.0.61
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 +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +25 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -13
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
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
|
@@ -1586,17 +1586,21 @@ var CheckIcon2 = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
1586
1586
|
)
|
|
1587
1587
|
}
|
|
1588
1588
|
);
|
|
1589
|
-
var RadioIcon = ({ isSelected }) => /* @__PURE__ */ jsxRuntime.
|
|
1590
|
-
"
|
|
1589
|
+
var RadioIcon = ({ isSelected }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1590
|
+
"svg",
|
|
1591
1591
|
{
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
"rh-border rh-rounded-full rh-transition-colors rh-duration-150",
|
|
1596
|
-
isSelected ? "rh-border-primary" : "rh-border-border rh-bg-surface"
|
|
1597
|
-
].filter(Boolean).join(" "),
|
|
1592
|
+
width: "16",
|
|
1593
|
+
height: "16",
|
|
1594
|
+
viewBox: "0 0 16 16",
|
|
1598
1595
|
"aria-hidden": "true",
|
|
1599
|
-
|
|
1596
|
+
className: [
|
|
1597
|
+
"rh-shrink-0 rh-transition-colors rh-duration-150",
|
|
1598
|
+
isSelected ? "rh-text-primary rh-fill-surface" : "rh-text-border rh-fill-surface"
|
|
1599
|
+
].join(" "),
|
|
1600
|
+
children: [
|
|
1601
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1" }),
|
|
1602
|
+
isSelected && /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "5", className: "rh-fill-primary", stroke: "none" })
|
|
1603
|
+
]
|
|
1600
1604
|
}
|
|
1601
1605
|
);
|
|
1602
1606
|
var Select = React9.forwardRef(function Select2(props, ref) {
|
|
@@ -4573,7 +4577,8 @@ var CustomSelect = ({
|
|
|
4573
4577
|
textColor,
|
|
4574
4578
|
placeholderColor,
|
|
4575
4579
|
backgroundColor,
|
|
4576
|
-
type = "select"
|
|
4580
|
+
type = "select",
|
|
4581
|
+
disabled = false
|
|
4577
4582
|
}) => {
|
|
4578
4583
|
const [isOpen, setIsOpen] = React9.useState(false);
|
|
4579
4584
|
const [dropdownStyle, setDropdownStyle] = React9.useState({});
|
|
@@ -4607,6 +4612,7 @@ var CustomSelect = ({
|
|
|
4607
4612
|
};
|
|
4608
4613
|
};
|
|
4609
4614
|
const openDropdown = () => {
|
|
4615
|
+
if (disabled) return;
|
|
4610
4616
|
if (!isOpen) setDropdownStyle(calcPosition());
|
|
4611
4617
|
setIsOpen((prev) => !prev);
|
|
4612
4618
|
};
|
|
@@ -4655,6 +4661,7 @@ var CustomSelect = ({
|
|
|
4655
4661
|
{
|
|
4656
4662
|
ref: textAreaRef,
|
|
4657
4663
|
value,
|
|
4664
|
+
disabled,
|
|
4658
4665
|
placeholder,
|
|
4659
4666
|
rows: 1,
|
|
4660
4667
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -4666,7 +4673,7 @@ var CustomSelect = ({
|
|
|
4666
4673
|
color: inputTextColor,
|
|
4667
4674
|
backgroundColor: backgroundColor || "transparent"
|
|
4668
4675
|
},
|
|
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"
|
|
4676
|
+
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
4677
|
}
|
|
4671
4678
|
),
|
|
4672
4679
|
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `.rh-table-textarea::placeholder { color: ${inputPlaceholderColor}; }` })
|
|
@@ -4677,12 +4684,13 @@ var CustomSelect = ({
|
|
|
4677
4684
|
"button",
|
|
4678
4685
|
{
|
|
4679
4686
|
type: "button",
|
|
4687
|
+
disabled,
|
|
4680
4688
|
onClick: (e) => {
|
|
4681
4689
|
e.stopPropagation();
|
|
4682
4690
|
openDropdown();
|
|
4683
4691
|
},
|
|
4684
4692
|
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",
|
|
4693
|
+
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
4694
|
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
4695
|
"span",
|
|
4688
4696
|
{
|
|
@@ -4768,6 +4776,8 @@ function TableInner({
|
|
|
4768
4776
|
rowKey,
|
|
4769
4777
|
rowClickable = false,
|
|
4770
4778
|
onRowClick,
|
|
4779
|
+
disableEditableControls = false,
|
|
4780
|
+
disableEditableSelects = false,
|
|
4771
4781
|
size = "md",
|
|
4772
4782
|
variant = "default",
|
|
4773
4783
|
sort,
|
|
@@ -4787,6 +4797,7 @@ function TableInner({
|
|
|
4787
4797
|
className = "",
|
|
4788
4798
|
...rest
|
|
4789
4799
|
}, ref) {
|
|
4800
|
+
const shouldDisableEditableControls = disableEditableControls || disableEditableSelects;
|
|
4790
4801
|
const handleSort = (column) => {
|
|
4791
4802
|
if (!column.sortable || !onSortChange) return;
|
|
4792
4803
|
const newDirection = sort?.key === column.key ? sort.direction === "asc" ? "desc" : sort.direction === "desc" ? null : "asc" : "asc";
|
|
@@ -4879,7 +4890,7 @@ function TableInner({
|
|
|
4879
4890
|
}
|
|
4880
4891
|
return column.editablePlaceholderColor;
|
|
4881
4892
|
};
|
|
4882
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-full rh-rounded
|
|
4893
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-w-full rh-rounded", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4883
4894
|
"table",
|
|
4884
4895
|
{
|
|
4885
4896
|
ref,
|
|
@@ -4997,6 +5008,7 @@ function TableInner({
|
|
|
4997
5008
|
CustomSelect,
|
|
4998
5009
|
{
|
|
4999
5010
|
type: column.type ?? "select",
|
|
5011
|
+
disabled: shouldDisableEditableControls,
|
|
5000
5012
|
options: column.choices,
|
|
5001
5013
|
value: column.editableValue(row),
|
|
5002
5014
|
placeholder: column.editablePlaceholder,
|