@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.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +32 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -8
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -821,6 +821,10 @@ type TableColumn<T> = {
|
|
|
821
821
|
width?: string;
|
|
822
822
|
/** Maximum column width (CSS value) */
|
|
823
823
|
maxWidth?: string;
|
|
824
|
+
/** Background color for this column's header cell (overrides headerStyle.backgroundColor) */
|
|
825
|
+
headerBgColor?: string;
|
|
826
|
+
/** Text color for this column's header cell (overrides headerTextStyle.color) */
|
|
827
|
+
headerTextColor?: string;
|
|
824
828
|
/** Text alignment */
|
|
825
829
|
align?: "left" | "center" | "right";
|
|
826
830
|
/** Whether this column is sortable */
|
|
@@ -907,6 +911,10 @@ type TableProps<T> = Omit<React__default.HTMLAttributes<HTMLTableElement>, "chil
|
|
|
907
911
|
};
|
|
908
912
|
/** Callback when add row is clicked */
|
|
909
913
|
onAddRow?: () => void;
|
|
914
|
+
/** If true, rows become clickable and will call `onRowClick` when clicked */
|
|
915
|
+
rowClickable?: boolean;
|
|
916
|
+
/** Callback invoked when a row is clicked: `(row, index, event)` */
|
|
917
|
+
onRowClick?: (row: T, index: number, event?: React__default.MouseEvent<HTMLTableRowElement>) => void;
|
|
910
918
|
};
|
|
911
919
|
declare const Table: <T>(props: TableProps<T> & {
|
|
912
920
|
ref?: React__default.ForwardedRef<HTMLTableElement>;
|
package/dist/index.d.ts
CHANGED
|
@@ -821,6 +821,10 @@ type TableColumn<T> = {
|
|
|
821
821
|
width?: string;
|
|
822
822
|
/** Maximum column width (CSS value) */
|
|
823
823
|
maxWidth?: string;
|
|
824
|
+
/** Background color for this column's header cell (overrides headerStyle.backgroundColor) */
|
|
825
|
+
headerBgColor?: string;
|
|
826
|
+
/** Text color for this column's header cell (overrides headerTextStyle.color) */
|
|
827
|
+
headerTextColor?: string;
|
|
824
828
|
/** Text alignment */
|
|
825
829
|
align?: "left" | "center" | "right";
|
|
826
830
|
/** Whether this column is sortable */
|
|
@@ -907,6 +911,10 @@ type TableProps<T> = Omit<React__default.HTMLAttributes<HTMLTableElement>, "chil
|
|
|
907
911
|
};
|
|
908
912
|
/** Callback when add row is clicked */
|
|
909
913
|
onAddRow?: () => void;
|
|
914
|
+
/** If true, rows become clickable and will call `onRowClick` when clicked */
|
|
915
|
+
rowClickable?: boolean;
|
|
916
|
+
/** Callback invoked when a row is clicked: `(row, index, event)` */
|
|
917
|
+
onRowClick?: (row: T, index: number, event?: React__default.MouseEvent<HTMLTableRowElement>) => void;
|
|
910
918
|
};
|
|
911
919
|
declare const Table: <T>(props: TableProps<T> & {
|
|
912
920
|
ref?: React__default.ForwardedRef<HTMLTableElement>;
|
package/dist/index.js
CHANGED
|
@@ -4089,6 +4089,7 @@ var CustomSelect = ({
|
|
|
4089
4089
|
value,
|
|
4090
4090
|
placeholder,
|
|
4091
4091
|
rows: 1,
|
|
4092
|
+
onClick: (e) => e.stopPropagation(),
|
|
4092
4093
|
onInput: (e) => {
|
|
4093
4094
|
onChange(e.currentTarget.value);
|
|
4094
4095
|
resizeTextArea();
|
|
@@ -4097,7 +4098,7 @@ var CustomSelect = ({
|
|
|
4097
4098
|
color: inputTextColor,
|
|
4098
4099
|
backgroundColor: backgroundColor || "transparent"
|
|
4099
4100
|
},
|
|
4100
|
-
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
|
|
4101
|
+
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"
|
|
4101
4102
|
}
|
|
4102
4103
|
),
|
|
4103
4104
|
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `.rh-table-textarea::placeholder { color: ${inputPlaceholderColor}; }` })
|
|
@@ -4108,13 +4109,16 @@ var CustomSelect = ({
|
|
|
4108
4109
|
"button",
|
|
4109
4110
|
{
|
|
4110
4111
|
type: "button",
|
|
4111
|
-
onClick:
|
|
4112
|
+
onClick: (e) => {
|
|
4113
|
+
e.stopPropagation();
|
|
4114
|
+
openDropdown();
|
|
4115
|
+
},
|
|
4112
4116
|
style: { backgroundColor: backgroundColor || void 0 },
|
|
4113
4117
|
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",
|
|
4114
4118
|
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(
|
|
4115
4119
|
"span",
|
|
4116
4120
|
{
|
|
4117
|
-
className: "rh-text-[14px] rh-px-
|
|
4121
|
+
className: "rh-text-[14px] rh-px-3.5 rh-py-0.5 rh-rounded-xl rh-whitespace-normal rh-break-words",
|
|
4118
4122
|
style: { backgroundColor: displayBg || "transparent", fontFamily: "Inter, sans-serif", color: displayTextColor },
|
|
4119
4123
|
children: displayLabel
|
|
4120
4124
|
}
|
|
@@ -4133,6 +4137,7 @@ var CustomSelect = ({
|
|
|
4133
4137
|
type: "button",
|
|
4134
4138
|
onMouseDown: (e) => {
|
|
4135
4139
|
e.preventDefault();
|
|
4140
|
+
e.stopPropagation();
|
|
4136
4141
|
onChange(option.value);
|
|
4137
4142
|
setIsOpen(false);
|
|
4138
4143
|
},
|
|
@@ -4193,6 +4198,8 @@ function TableInner({
|
|
|
4193
4198
|
columns,
|
|
4194
4199
|
data,
|
|
4195
4200
|
rowKey,
|
|
4201
|
+
rowClickable = false,
|
|
4202
|
+
onRowClick,
|
|
4196
4203
|
size = "md",
|
|
4197
4204
|
variant = "default",
|
|
4198
4205
|
sort,
|
|
@@ -4328,6 +4335,7 @@ function TableInner({
|
|
|
4328
4335
|
style: {
|
|
4329
4336
|
width: column.width,
|
|
4330
4337
|
maxWidth: column.maxWidth,
|
|
4338
|
+
backgroundColor: column.headerBgColor ?? headerStyle?.backgroundColor,
|
|
4331
4339
|
...rowPaddingStyle
|
|
4332
4340
|
},
|
|
4333
4341
|
className: [
|
|
@@ -4338,10 +4346,17 @@ function TableInner({
|
|
|
4338
4346
|
column.sortable ? "rh-cursor-pointer rh-select-none hover:rh-text-text" : ""
|
|
4339
4347
|
].filter(Boolean).join(" "),
|
|
4340
4348
|
onClick: () => handleSort(column),
|
|
4341
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4349
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4350
|
+
"span",
|
|
4351
|
+
{
|
|
4352
|
+
className: "rh-inline-flex rh-items-center",
|
|
4353
|
+
style: column.headerTextColor ? { ...headerTextStyleInline, color: column.headerTextColor } : headerTextStyleInline,
|
|
4354
|
+
children: [
|
|
4355
|
+
column.header,
|
|
4356
|
+
renderSortIcon(column)
|
|
4357
|
+
]
|
|
4358
|
+
}
|
|
4359
|
+
)
|
|
4345
4360
|
},
|
|
4346
4361
|
column.key
|
|
4347
4362
|
))
|
|
@@ -4388,9 +4403,18 @@ function TableInner({
|
|
|
4388
4403
|
style: bodyStyleInline,
|
|
4389
4404
|
className: [
|
|
4390
4405
|
"rh-border-b rh-border-border rh-transition-colors",
|
|
4406
|
+
rowClickable ? "rh-cursor-pointer" : "",
|
|
4391
4407
|
"hover:rh-bg-background/50",
|
|
4392
4408
|
variant === "striped" && index % 2 === 1 ? "rh-bg-background/50" : ""
|
|
4393
4409
|
].filter(Boolean).join(" "),
|
|
4410
|
+
onClick: (e) => {
|
|
4411
|
+
if (!rowClickable || !onRowClick) return;
|
|
4412
|
+
const target = e.target;
|
|
4413
|
+
if (!target) return;
|
|
4414
|
+
const interactiveSelector = 'button, a, input, select, textarea, label, [role="button"], [data-no-row-click]';
|
|
4415
|
+
if (target.closest(interactiveSelector)) return;
|
|
4416
|
+
onRowClick(row, index, e);
|
|
4417
|
+
},
|
|
4394
4418
|
children: columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4395
4419
|
"td",
|
|
4396
4420
|
{
|
|
@@ -4400,7 +4424,7 @@ function TableInner({
|
|
|
4400
4424
|
alignClasses[column.align || "left"],
|
|
4401
4425
|
"rh-text-text"
|
|
4402
4426
|
].filter(Boolean).join(" "),
|
|
4403
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-
|
|
4427
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex rh-items-stretch rh-justify-between rh-gap-2 rh-h-full", children: [
|
|
4404
4428
|
isEditableCell(column) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4405
4429
|
CustomSelect,
|
|
4406
4430
|
{
|