@rehagro/ui 1.0.51 → 1.0.53
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 +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +100 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -17
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1835,7 +1835,7 @@ var Select = forwardRef(function Select2(props, ref) {
|
|
|
1835
1835
|
className: [
|
|
1836
1836
|
"rh-absolute rh-z-50 rh-w-full rh-mt-1",
|
|
1837
1837
|
"rh-border rh-border-border rh-bg-surface",
|
|
1838
|
-
"rh-shadow-md rh-overflow-auto rh-max-h-60",
|
|
1838
|
+
"rh-shadow-md rh-overflow-y-auto rh-overscroll-contain rh-max-h-60",
|
|
1839
1839
|
"rh-py-1",
|
|
1840
1840
|
dropdownRadiusClasses[radius]
|
|
1841
1841
|
].filter(Boolean).join(" "),
|
|
@@ -3813,6 +3813,17 @@ function getDaysInMonth(year, month) {
|
|
|
3813
3813
|
function getFirstDayOfMonth(year, month) {
|
|
3814
3814
|
return new Date(year, month, 1).getDay();
|
|
3815
3815
|
}
|
|
3816
|
+
function removeHexAlpha(color) {
|
|
3817
|
+
if (!color) return color;
|
|
3818
|
+
if (/^#[0-9a-fA-F]{4}$/.test(color)) {
|
|
3819
|
+
const [, r, g, b] = color;
|
|
3820
|
+
return `#${r}${r}${g}${g}${b}${b}`;
|
|
3821
|
+
}
|
|
3822
|
+
if (/^#[0-9a-fA-F]{8}$/.test(color)) {
|
|
3823
|
+
return color.slice(0, 7);
|
|
3824
|
+
}
|
|
3825
|
+
return color;
|
|
3826
|
+
}
|
|
3816
3827
|
var ChevronLeftIcon2 = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", className: "rh-w-5 rh-h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
3817
3828
|
"path",
|
|
3818
3829
|
{
|
|
@@ -3834,9 +3845,14 @@ var DatePickerDropdown = ({
|
|
|
3834
3845
|
selectedDate,
|
|
3835
3846
|
onSelect,
|
|
3836
3847
|
onClose,
|
|
3837
|
-
containerRef
|
|
3848
|
+
containerRef,
|
|
3849
|
+
backgroundColor,
|
|
3850
|
+
textColor,
|
|
3851
|
+
calendarTextColor
|
|
3838
3852
|
}) => {
|
|
3839
3853
|
const today = /* @__PURE__ */ new Date();
|
|
3854
|
+
const opaqueBackgroundColor = removeHexAlpha(backgroundColor);
|
|
3855
|
+
const calendarTextStyle = calendarTextColor ? { color: calendarTextColor } : void 0;
|
|
3840
3856
|
const [viewYear, setViewYear] = useState(
|
|
3841
3857
|
selectedDate ? selectedDate.getFullYear() : today.getFullYear()
|
|
3842
3858
|
);
|
|
@@ -3887,6 +3903,8 @@ var DatePickerDropdown = ({
|
|
|
3887
3903
|
ref: dropdownRef,
|
|
3888
3904
|
style: {
|
|
3889
3905
|
...style,
|
|
3906
|
+
backgroundColor: opaqueBackgroundColor,
|
|
3907
|
+
color: textColor,
|
|
3890
3908
|
boxShadow: "0 0 9.6px 0 rgba(8, 11, 18, 0.08)",
|
|
3891
3909
|
width: 260
|
|
3892
3910
|
},
|
|
@@ -3897,6 +3915,7 @@ var DatePickerDropdown = ({
|
|
|
3897
3915
|
"button",
|
|
3898
3916
|
{
|
|
3899
3917
|
type: "button",
|
|
3918
|
+
style: calendarTextStyle,
|
|
3900
3919
|
onMouseDown: (e) => {
|
|
3901
3920
|
e.preventDefault();
|
|
3902
3921
|
prevMonth();
|
|
@@ -3905,7 +3924,7 @@ var DatePickerDropdown = ({
|
|
|
3905
3924
|
children: /* @__PURE__ */ jsx(ChevronLeftIcon2, {})
|
|
3906
3925
|
}
|
|
3907
3926
|
),
|
|
3908
|
-
/* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
|
|
3927
|
+
/* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", style: calendarTextStyle, children: [
|
|
3909
3928
|
MONTHS_PT[viewMonth],
|
|
3910
3929
|
" - ",
|
|
3911
3930
|
viewYear
|
|
@@ -3914,6 +3933,7 @@ var DatePickerDropdown = ({
|
|
|
3914
3933
|
"button",
|
|
3915
3934
|
{
|
|
3916
3935
|
type: "button",
|
|
3936
|
+
style: calendarTextStyle,
|
|
3917
3937
|
onMouseDown: (e) => {
|
|
3918
3938
|
e.preventDefault();
|
|
3919
3939
|
nextMonth();
|
|
@@ -3927,6 +3947,7 @@ var DatePickerDropdown = ({
|
|
|
3927
3947
|
"div",
|
|
3928
3948
|
{
|
|
3929
3949
|
className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
|
|
3950
|
+
style: calendarTextStyle,
|
|
3930
3951
|
children: d
|
|
3931
3952
|
},
|
|
3932
3953
|
i
|
|
@@ -3948,6 +3969,7 @@ var DatePickerDropdown = ({
|
|
|
3948
3969
|
"div",
|
|
3949
3970
|
{
|
|
3950
3971
|
className: "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-text-text-muted rh-opacity-40",
|
|
3972
|
+
style: calendarTextStyle,
|
|
3951
3973
|
children: prevMonthDays - firstDay + i + 1
|
|
3952
3974
|
},
|
|
3953
3975
|
`prev-${i}`
|
|
@@ -3959,7 +3981,10 @@ var DatePickerDropdown = ({
|
|
|
3959
3981
|
"button",
|
|
3960
3982
|
{
|
|
3961
3983
|
type: "button",
|
|
3962
|
-
style: {
|
|
3984
|
+
style: {
|
|
3985
|
+
backgroundColor: selected ? "#15607A" : "transparent",
|
|
3986
|
+
...calendarTextStyle
|
|
3987
|
+
},
|
|
3963
3988
|
onMouseDown: (e) => {
|
|
3964
3989
|
e.preventDefault();
|
|
3965
3990
|
setTempDate(new Date(viewYear, viewMonth, day));
|
|
@@ -3977,6 +4002,7 @@ var DatePickerDropdown = ({
|
|
|
3977
4002
|
"div",
|
|
3978
4003
|
{
|
|
3979
4004
|
className: "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-text-text-muted rh-opacity-40",
|
|
4005
|
+
style: calendarTextStyle,
|
|
3980
4006
|
children: i + 1
|
|
3981
4007
|
},
|
|
3982
4008
|
`next-${i}`
|
|
@@ -4008,6 +4034,11 @@ var CustomSelect = ({
|
|
|
4008
4034
|
value,
|
|
4009
4035
|
onChange,
|
|
4010
4036
|
className = "",
|
|
4037
|
+
textColor,
|
|
4038
|
+
backgroundColor,
|
|
4039
|
+
selectBackgroundColor,
|
|
4040
|
+
calendarBackgroundColor,
|
|
4041
|
+
calendarTextColor,
|
|
4011
4042
|
type = "select"
|
|
4012
4043
|
}) => {
|
|
4013
4044
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -4062,14 +4093,16 @@ var CustomSelect = ({
|
|
|
4062
4093
|
setIsOpen(false);
|
|
4063
4094
|
};
|
|
4064
4095
|
const displayLabel = type === "date" ? selectedDate ? formatDisplay(selectedDate) : value || "\u2014" : selectedOption?.label || value;
|
|
4065
|
-
const displayBg = type === "date" ?
|
|
4096
|
+
const displayBg = type === "date" ? backgroundColor : selectedOption?.backgroundColor || backgroundColor;
|
|
4097
|
+
const displayTextColor = type === "date" ? textColor : selectedOption?.textColor || textColor || (displayBg ? "white" : "inherit");
|
|
4066
4098
|
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `rh-relative ${className}`, children: [
|
|
4067
4099
|
/* @__PURE__ */ jsx(
|
|
4068
4100
|
"button",
|
|
4069
4101
|
{
|
|
4070
4102
|
type: "button",
|
|
4071
4103
|
onClick: openDropdown,
|
|
4072
|
-
|
|
4104
|
+
style: { backgroundColor: selectBackgroundColor || void 0 },
|
|
4105
|
+
className: "rh-w-full rh-h-full rh-flex rh-items-center rh-border rh-bg-surface rh-rounded-sm rh-border-transparent rh-justify-between rh-py-2\n hover:rh-border-primary hover:rh-ring-2 hover:rh-ring-gray-200 rh-cursor-pointer rh-text-left",
|
|
4073
4106
|
children: /* @__PURE__ */ jsx("div", { className: "rh-flex rh-items-center rh-gap-2 rh-flex-1 rh-truncate", children: /* @__PURE__ */ jsx(
|
|
4074
4107
|
"span",
|
|
4075
4108
|
{
|
|
@@ -4077,7 +4110,7 @@ var CustomSelect = ({
|
|
|
4077
4110
|
style: {
|
|
4078
4111
|
backgroundColor: displayBg || "transparent",
|
|
4079
4112
|
fontFamily: "Inter, sans-serif",
|
|
4080
|
-
color:
|
|
4113
|
+
color: displayTextColor
|
|
4081
4114
|
},
|
|
4082
4115
|
children: displayLabel
|
|
4083
4116
|
}
|
|
@@ -4090,9 +4123,10 @@ var CustomSelect = ({
|
|
|
4090
4123
|
{
|
|
4091
4124
|
style: {
|
|
4092
4125
|
...dropdownStyle,
|
|
4126
|
+
backgroundColor: selectBackgroundColor || void 0,
|
|
4093
4127
|
boxShadow: "0 10px 20px 0 rgba(0, 0, 0, 0.05)"
|
|
4094
4128
|
},
|
|
4095
|
-
className: "rh-
|
|
4129
|
+
className: "rh-border rh-border-border rh-rounded-xs rh-max-h-60 rh-overflow-auto",
|
|
4096
4130
|
children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
4097
4131
|
"button",
|
|
4098
4132
|
{
|
|
@@ -4102,9 +4136,9 @@ var CustomSelect = ({
|
|
|
4102
4136
|
onChange(option.value);
|
|
4103
4137
|
setIsOpen(false);
|
|
4104
4138
|
},
|
|
4105
|
-
className: "rh-flex rh-items-center rh-gap-2 rh-px-3 rh-py-2 rh-text-left hover:rh-bg-background/50 rh-cursor-pointer",
|
|
4139
|
+
className: "rh-flex rh-items-center rh-gap-2 rh-px-3 rh-py-2 rh-text-left hover:rh-bg-background/50 rh-w-full rh-cursor-pointer",
|
|
4106
4140
|
children: [
|
|
4107
|
-
/* @__PURE__ */ jsx("div", { className: "rh-w-4
|
|
4141
|
+
/* @__PURE__ */ jsx("div", { className: "rh-w-4", children: option.value === value && /* @__PURE__ */ jsx(
|
|
4108
4142
|
"svg",
|
|
4109
4143
|
{
|
|
4110
4144
|
width: "13",
|
|
@@ -4126,8 +4160,9 @@ var CustomSelect = ({
|
|
|
4126
4160
|
{
|
|
4127
4161
|
className: "rh-truncate rh-p-1 rh-px-2 rh-rounded-xl rh-text-white rh-text-[14px]",
|
|
4128
4162
|
style: {
|
|
4129
|
-
backgroundColor: option.backgroundColor || "transparent",
|
|
4130
|
-
fontFamily: "Inter, sans-serif"
|
|
4163
|
+
backgroundColor: option.backgroundColor || backgroundColor || "transparent",
|
|
4164
|
+
fontFamily: "Inter, sans-serif",
|
|
4165
|
+
color: option.textColor || textColor || (option.backgroundColor || backgroundColor ? "white" : "inherit")
|
|
4131
4166
|
},
|
|
4132
4167
|
children: option.label
|
|
4133
4168
|
}
|
|
@@ -4147,7 +4182,10 @@ var CustomSelect = ({
|
|
|
4147
4182
|
selectedDate,
|
|
4148
4183
|
onSelect: handleDateSelect,
|
|
4149
4184
|
onClose: () => setIsOpen(false),
|
|
4150
|
-
containerRef
|
|
4185
|
+
containerRef,
|
|
4186
|
+
backgroundColor: calendarBackgroundColor,
|
|
4187
|
+
textColor,
|
|
4188
|
+
calendarTextColor
|
|
4151
4189
|
}
|
|
4152
4190
|
)
|
|
4153
4191
|
] });
|
|
@@ -4259,6 +4297,36 @@ function TableInner({
|
|
|
4259
4297
|
if (column.type === "date") return true;
|
|
4260
4298
|
return !!column.choices;
|
|
4261
4299
|
};
|
|
4300
|
+
const getEditableTextColor = (column, row, index) => {
|
|
4301
|
+
if (typeof column.editableTextColor === "function") {
|
|
4302
|
+
return column.editableTextColor(row, index);
|
|
4303
|
+
}
|
|
4304
|
+
return column.editableTextColor;
|
|
4305
|
+
};
|
|
4306
|
+
const getEditableBackgroundColor = (column, row, index) => {
|
|
4307
|
+
if (typeof column.editableBackgroundColor === "function") {
|
|
4308
|
+
return column.editableBackgroundColor(row, index);
|
|
4309
|
+
}
|
|
4310
|
+
return column.editableBackgroundColor;
|
|
4311
|
+
};
|
|
4312
|
+
const getEditableSelectBackgroundColor = (column, row, index) => {
|
|
4313
|
+
if (typeof column.editableSelectBackgroundColor === "function") {
|
|
4314
|
+
return column.editableSelectBackgroundColor(row, index);
|
|
4315
|
+
}
|
|
4316
|
+
return column.editableSelectBackgroundColor;
|
|
4317
|
+
};
|
|
4318
|
+
const getEditableCalendarBackgroundColor = (column, row, index) => {
|
|
4319
|
+
if (typeof column.editableCalendarBackgroundColor === "function") {
|
|
4320
|
+
return column.editableCalendarBackgroundColor(row, index);
|
|
4321
|
+
}
|
|
4322
|
+
return column.editableCalendarBackgroundColor;
|
|
4323
|
+
};
|
|
4324
|
+
const getEditableCalendarTextColor = (column, row, index) => {
|
|
4325
|
+
if (typeof column.editableCalendarTextColor === "function") {
|
|
4326
|
+
return column.editableCalendarTextColor(row, index);
|
|
4327
|
+
}
|
|
4328
|
+
return column.editableCalendarTextColor;
|
|
4329
|
+
};
|
|
4262
4330
|
return /* @__PURE__ */ jsx("div", { className: "rh-w-full rh-rounded rh-overflow-hidden", children: /* @__PURE__ */ jsxs(
|
|
4263
4331
|
"table",
|
|
4264
4332
|
{
|
|
@@ -4362,6 +4430,23 @@ function TableInner({
|
|
|
4362
4430
|
type: column.type ?? "select",
|
|
4363
4431
|
options: column.choices,
|
|
4364
4432
|
value: column.editableValue(row),
|
|
4433
|
+
textColor: getEditableTextColor(column, row, index),
|
|
4434
|
+
backgroundColor: getEditableBackgroundColor(column, row, index),
|
|
4435
|
+
selectBackgroundColor: getEditableSelectBackgroundColor(
|
|
4436
|
+
column,
|
|
4437
|
+
row,
|
|
4438
|
+
index
|
|
4439
|
+
),
|
|
4440
|
+
calendarBackgroundColor: getEditableCalendarBackgroundColor(
|
|
4441
|
+
column,
|
|
4442
|
+
row,
|
|
4443
|
+
index
|
|
4444
|
+
),
|
|
4445
|
+
calendarTextColor: getEditableCalendarTextColor(
|
|
4446
|
+
column,
|
|
4447
|
+
row,
|
|
4448
|
+
index
|
|
4449
|
+
),
|
|
4365
4450
|
onChange: (value) => column.onEditChange?.(row, index, value),
|
|
4366
4451
|
className: "rh-w-full rh-h-full"
|
|
4367
4452
|
}
|
|
@@ -4384,14 +4469,12 @@ function TableInner({
|
|
|
4384
4469
|
},
|
|
4385
4470
|
rowKey(row, index)
|
|
4386
4471
|
)),
|
|
4387
|
-
addRowButton && !loading && /* @__PURE__ */ jsx("tr", { className: "rh-border-border hover:rh-bg-background/50 rh-
|
|
4472
|
+
addRowButton && !loading && /* @__PURE__ */ jsx("tr", { className: "rh-border-border hover:rh-bg-background/50 rh-cursor-pointer rh-py-3", children: /* @__PURE__ */ jsx(
|
|
4388
4473
|
"td",
|
|
4389
4474
|
{
|
|
4390
4475
|
colSpan,
|
|
4391
|
-
style: rowPaddingStyle,
|
|
4392
4476
|
className: [
|
|
4393
|
-
|
|
4394
|
-
"rh-text-center rh-cursor-pointer rh-text-[#9CA3AF] rh-font-medium"
|
|
4477
|
+
"rh-text-center rh-cursor-pointer rh-text-[#9CA3AF] rh-font-medium rh-px-4 rh-py-3 rh-rounded-b"
|
|
4395
4478
|
].filter(Boolean).join(" "),
|
|
4396
4479
|
onClick: onAddRow,
|
|
4397
4480
|
children: /* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-center rh-gap-2 rh-h-6 rh-font-bold rh-text-sm", children: [
|