@rehagro/ui 1.0.47 → 1.0.48

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
@@ -1112,6 +1112,7 @@ var TextInput = forwardRef(function TextInput2({
1112
1112
  className = "",
1113
1113
  wrapperClassName = "",
1114
1114
  borderColor,
1115
+ backgroundColor,
1115
1116
  borderWidth = "sm",
1116
1117
  id,
1117
1118
  ...rest
@@ -1121,6 +1122,10 @@ var TextInput = forwardRef(function TextInput2({
1121
1122
  const [isHelperDismissed, setIsHelperDismissed] = React9.useState(false);
1122
1123
  const { onChange, ...inputProps } = rest;
1123
1124
  const visualStatus = helperText && isHelperDismissed ? "default" : status;
1125
+ const containerStyle = {
1126
+ ...borderColor ? { borderColor } : {},
1127
+ ...!disabled && backgroundColor ? { backgroundColor } : {}
1128
+ };
1124
1129
  return /* @__PURE__ */ jsxs(
1125
1130
  "div",
1126
1131
  {
@@ -1140,7 +1145,7 @@ var TextInput = forwardRef(function TextInput2({
1140
1145
  /* @__PURE__ */ jsxs(
1141
1146
  "div",
1142
1147
  {
1143
- style: borderColor ? { borderColor } : void 0,
1148
+ style: containerStyle,
1144
1149
  className: [
1145
1150
  "rh-flex rh-items-center rh-gap-2",
1146
1151
  "rh-bg-surface rh-font-body",
@@ -1588,7 +1593,8 @@ var Select = forwardRef(function Select2(props, ref) {
1588
1593
  disabled = false,
1589
1594
  className = "",
1590
1595
  wrapperClassName = "",
1591
- multiple = false
1596
+ multiple = false,
1597
+ backgroundColor
1592
1598
  } = props;
1593
1599
  const triggerId = React9.useId();
1594
1600
  const listboxId = React9.useId();
@@ -1767,9 +1773,11 @@ var Select = forwardRef(function Select2(props, ref) {
1767
1773
  disabled,
1768
1774
  onClick: () => !disabled && setIsOpen((o) => !o),
1769
1775
  onKeyDown: handleKeyDown,
1776
+ style: backgroundColor ? { backgroundColor } : void 0,
1770
1777
  className: [
1771
1778
  "rh-group rh-flex rh-items-center rh-justify-between rh-gap-2",
1772
- "rh-border rh-bg-surface rh-font-body",
1779
+ "rh-border rh-font-body",
1780
+ !backgroundColor && "rh-bg-surface",
1773
1781
  "rh-transition-colors rh-duration-150",
1774
1782
  "rh-text-left rh-w-full",
1775
1783
  statusClasses2[visualStatus],
@@ -1793,7 +1801,7 @@ var Select = forwardRef(function Select2(props, ref) {
1793
1801
  ChevronIcon,
1794
1802
  {
1795
1803
  className: [
1796
- "rh-w-5 rh-h-5 rh-shrink-0 rh-text-text-muted rh-transition-transform rh-duration-150",
1804
+ "rh-w-4 rh-h-4 rh-shrink-0 rh-text-text-muted rh-transition-transform rh-duration-150 rh-bg-surface rh-rounded-xl",
1797
1805
  isOpen ? "rh-rotate-180" : ""
1798
1806
  ].filter(Boolean).join(" ")
1799
1807
  }
@@ -2912,24 +2920,282 @@ var Spinner = forwardRef(function Spinner2({ size = "md", color = "primary", lab
2912
2920
  }
2913
2921
  );
2914
2922
  });
2915
- var CustomSelect = ({ options, value, onChange, className = "" }) => {
2923
+ var DAYS_SHORT = ["D", "S", "T", "Q", "Q", "S", "S"];
2924
+ var MONTHS_PT = [
2925
+ "Janeiro",
2926
+ "Fevereiro",
2927
+ "Mar\xE7o",
2928
+ "Abril",
2929
+ "Maio",
2930
+ "Junho",
2931
+ "Julho",
2932
+ "Agosto",
2933
+ "Setembro",
2934
+ "Outubro",
2935
+ "Novembro",
2936
+ "Dezembro"
2937
+ ];
2938
+ function parseDate(value) {
2939
+ if (!value) return null;
2940
+ if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
2941
+ const [y, m, d] = value.split("-").map(Number);
2942
+ return new Date(y, m - 1, d);
2943
+ }
2944
+ if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
2945
+ const [d, m, y] = value.split("/").map(Number);
2946
+ return new Date(y, m - 1, d);
2947
+ }
2948
+ return null;
2949
+ }
2950
+ function formatISO(date) {
2951
+ const y = date.getFullYear();
2952
+ const m = String(date.getMonth() + 1).padStart(2, "0");
2953
+ const d = String(date.getDate()).padStart(2, "0");
2954
+ return `${y}-${m}-${d}`;
2955
+ }
2956
+ function formatDisplay(date) {
2957
+ const d = String(date.getDate()).padStart(2, "0");
2958
+ const m = String(date.getMonth() + 1).padStart(2, "0");
2959
+ const y = date.getFullYear();
2960
+ return `${d}/${m}/${y}`;
2961
+ }
2962
+ function getDaysInMonth(year, month) {
2963
+ return new Date(year, month + 1, 0).getDate();
2964
+ }
2965
+ function getFirstDayOfMonth(year, month) {
2966
+ return new Date(year, month, 1).getDay();
2967
+ }
2968
+ var ChevronLeftIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", className: "rh-w-5 rh-h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
2969
+ "path",
2970
+ {
2971
+ fillRule: "evenodd",
2972
+ d: "M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",
2973
+ clipRule: "evenodd"
2974
+ }
2975
+ ) });
2976
+ var ChevronRightIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", className: "rh-w-5 rh-h-5", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
2977
+ "path",
2978
+ {
2979
+ fillRule: "evenodd",
2980
+ d: "M7.21 14.77a.75.75 0 010-1.06L11.168 10 7.23 6.29a.75.75 0 011.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",
2981
+ clipRule: "evenodd"
2982
+ }
2983
+ ) });
2984
+ var DatePickerDropdown = ({
2985
+ style,
2986
+ selectedDate,
2987
+ onSelect,
2988
+ onClose,
2989
+ containerRef
2990
+ }) => {
2991
+ const today = /* @__PURE__ */ new Date();
2992
+ const [viewYear, setViewYear] = useState(
2993
+ selectedDate ? selectedDate.getFullYear() : today.getFullYear()
2994
+ );
2995
+ const [viewMonth, setViewMonth] = useState(
2996
+ selectedDate ? selectedDate.getMonth() : today.getMonth()
2997
+ );
2998
+ const [tempDate, setTempDate] = useState(selectedDate);
2999
+ const dropdownRef = useRef(null);
3000
+ useEffect(() => {
3001
+ const handleClickOutside = (e) => {
3002
+ const target = e.target;
3003
+ if (dropdownRef.current && !dropdownRef.current.contains(target) && containerRef.current && !containerRef.current.contains(target)) {
3004
+ onClose();
3005
+ }
3006
+ };
3007
+ document.addEventListener("mousedown", handleClickOutside);
3008
+ return () => document.removeEventListener("mousedown", handleClickOutside);
3009
+ }, [onClose, containerRef]);
3010
+ const prevMonth = () => {
3011
+ if (viewMonth === 0) {
3012
+ setViewMonth(11);
3013
+ setViewYear((y) => y - 1);
3014
+ } else {
3015
+ setViewMonth((m) => m - 1);
3016
+ }
3017
+ };
3018
+ const nextMonth = () => {
3019
+ if (viewMonth === 11) {
3020
+ setViewMonth(0);
3021
+ setViewYear((y) => y + 1);
3022
+ } else {
3023
+ setViewMonth((m) => m + 1);
3024
+ }
3025
+ };
3026
+ const daysInMonth = getDaysInMonth(viewYear, viewMonth);
3027
+ const firstDay = getFirstDayOfMonth(viewYear, viewMonth);
3028
+ const prevMonthDays = getDaysInMonth(
3029
+ viewMonth === 0 ? viewYear - 1 : viewYear,
3030
+ viewMonth === 0 ? 11 : viewMonth - 1
3031
+ );
3032
+ const totalCells = firstDay + daysInMonth;
3033
+ const trailingCount = totalCells % 7 === 0 ? 0 : 7 - totalCells % 7;
3034
+ const isSelected = (day) => !!tempDate && tempDate.getFullYear() === viewYear && tempDate.getMonth() === viewMonth && tempDate.getDate() === day;
3035
+ return createPortal(
3036
+ /* @__PURE__ */ jsxs(
3037
+ "div",
3038
+ {
3039
+ ref: dropdownRef,
3040
+ style: {
3041
+ ...style,
3042
+ boxShadow: "0 0 9.6px 0 rgba(8, 11, 18, 0.08)",
3043
+ width: 260
3044
+ },
3045
+ className: "rh-bg-surface rh-rounded-xs rh-p-5 rh-select-none rh-font-body",
3046
+ children: [
3047
+ /* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-between", children: [
3048
+ /* @__PURE__ */ jsx(
3049
+ "button",
3050
+ {
3051
+ type: "button",
3052
+ onMouseDown: (e) => {
3053
+ e.preventDefault();
3054
+ prevMonth();
3055
+ },
3056
+ className: "rh-p-1 hover:rh-bg-background rh-rounded rh-cursor-pointer rh-text-text",
3057
+ children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
3058
+ }
3059
+ ),
3060
+ /* @__PURE__ */ jsxs("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: [
3061
+ MONTHS_PT[viewMonth],
3062
+ " - ",
3063
+ viewYear
3064
+ ] }),
3065
+ /* @__PURE__ */ jsx(
3066
+ "button",
3067
+ {
3068
+ type: "button",
3069
+ onMouseDown: (e) => {
3070
+ e.preventDefault();
3071
+ nextMonth();
3072
+ },
3073
+ className: "rh-p-1 hover:rh-bg-background rh-rounded rh-cursor-pointer rh-text-text",
3074
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
3075
+ }
3076
+ )
3077
+ ] }),
3078
+ /* @__PURE__ */ jsx("div", { className: "rh-grid rh-grid-cols-7", children: DAYS_SHORT.map((d, i) => /* @__PURE__ */ jsx(
3079
+ "div",
3080
+ {
3081
+ className: "rh-text-center rh-text-xs rh-text-text-muted rh-font-medium rh-py-1",
3082
+ children: d
3083
+ },
3084
+ i
3085
+ )) }),
3086
+ /* @__PURE__ */ jsx(
3087
+ "svg",
3088
+ {
3089
+ xmlns: "http://www.w3.org/2000/svg",
3090
+ width: "100%",
3091
+ height: "1",
3092
+ viewBox: "0 0 350 1",
3093
+ fill: "none",
3094
+ className: "rh-mb-3",
3095
+ children: /* @__PURE__ */ jsx("path", { d: "M0 0.5H350", stroke: "#F5F5F5" })
3096
+ }
3097
+ ),
3098
+ /* @__PURE__ */ jsxs("div", { className: "rh-grid rh-grid-cols-7 rh-gap-0", children: [
3099
+ Array.from({ length: firstDay }).map((_, i) => /* @__PURE__ */ jsx(
3100
+ "div",
3101
+ {
3102
+ 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",
3103
+ children: prevMonthDays - firstDay + i + 1
3104
+ },
3105
+ `prev-${i}`
3106
+ )),
3107
+ Array.from({ length: daysInMonth }).map((_, i) => {
3108
+ const day = i + 1;
3109
+ const selected = isSelected(day);
3110
+ return /* @__PURE__ */ jsx(
3111
+ "button",
3112
+ {
3113
+ type: "button",
3114
+ style: { backgroundColor: selected ? "#15607A" : "transparent" },
3115
+ onMouseDown: (e) => {
3116
+ e.preventDefault();
3117
+ setTempDate(new Date(viewYear, viewMonth, day));
3118
+ },
3119
+ className: [
3120
+ "rh-w-7 rh-h-7 rh-flex rh-items-center rh-justify-center rh-text-sm rh-rounded-lg rh-transition-colors rh-duration-150 rh-cursor-pointer",
3121
+ selected ? "rh-text-surface" : "rh-text-text hover:rh-ring-1 hover:rh-ring-[#15607A] hover:rh-bg-transparent"
3122
+ ].join(" "),
3123
+ children: day
3124
+ },
3125
+ day
3126
+ );
3127
+ }),
3128
+ Array.from({ length: trailingCount }).map((_, i) => /* @__PURE__ */ jsx(
3129
+ "div",
3130
+ {
3131
+ 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",
3132
+ children: i + 1
3133
+ },
3134
+ `next-${i}`
3135
+ ))
3136
+ ] }),
3137
+ /* @__PURE__ */ jsx("div", { className: "rh-flex rh-justify-end rh-gap-2 rh-mt-4", children: /* @__PURE__ */ jsx(
3138
+ "button",
3139
+ {
3140
+ type: "button",
3141
+ style: { backgroundColor: "#87A851" },
3142
+ onClick: () => {
3143
+ if (tempDate) {
3144
+ onSelect(tempDate);
3145
+ }
3146
+ onClose();
3147
+ },
3148
+ className: "rh-text-sm rh-font-medium rh-px-4 rh-py-1.5 rh-rounded-lg rh-transition-colors rh-duration-150 rh-bg-success rh-text-surface",
3149
+ children: "Aplicar"
3150
+ }
3151
+ ) })
3152
+ ]
3153
+ }
3154
+ ),
3155
+ document.body
3156
+ );
3157
+ };
3158
+ var CustomSelect = ({
3159
+ options = [],
3160
+ value,
3161
+ onChange,
3162
+ className = "",
3163
+ type = "select"
3164
+ }) => {
2916
3165
  const [isOpen, setIsOpen] = useState(false);
2917
3166
  const [dropdownStyle, setDropdownStyle] = useState({});
2918
3167
  const containerRef = useRef(null);
2919
- const selectedOption = options.find((opt) => opt.value === value);
2920
- const handleOpen = () => {
2921
- if (!isOpen && containerRef.current) {
2922
- const rect = containerRef.current.getBoundingClientRect();
2923
- setDropdownStyle({
2924
- position: "fixed",
2925
- top: rect.bottom + 4,
2926
- left: rect.left,
2927
- zIndex: 2
2928
- });
2929
- }
3168
+ const calcPosition = () => {
3169
+ if (!containerRef.current) return {};
3170
+ const rect = containerRef.current.getBoundingClientRect();
3171
+ const spaceBelow = window.innerHeight - rect.bottom;
3172
+ const spaceAbove = rect.top;
3173
+ const DROPDOWN_HEIGHT = 320;
3174
+ const openUpward = spaceBelow < DROPDOWN_HEIGHT && spaceAbove > spaceBelow;
3175
+ return {
3176
+ position: "fixed",
3177
+ ...openUpward ? { bottom: window.innerHeight - rect.top + 4 } : { top: rect.bottom + 4 },
3178
+ left: rect.left,
3179
+ zIndex: 2
3180
+ };
3181
+ };
3182
+ const openDropdown = () => {
3183
+ if (!isOpen) setDropdownStyle(calcPosition());
2930
3184
  setIsOpen((prev) => !prev);
2931
3185
  };
2932
3186
  useEffect(() => {
3187
+ if (!isOpen) return;
3188
+ const close = () => setIsOpen(false);
3189
+ window.addEventListener("scroll", close, { capture: true, passive: true });
3190
+ window.addEventListener("resize", close, { passive: true });
3191
+ return () => {
3192
+ window.removeEventListener("scroll", close, { capture: true });
3193
+ window.removeEventListener("resize", close);
3194
+ };
3195
+ }, [isOpen]);
3196
+ const selectedOption = options.find((opt) => opt.value === value);
3197
+ useEffect(() => {
3198
+ if (type !== "select") return;
2933
3199
  const handleClickOutside = (e) => {
2934
3200
  if (containerRef.current && !containerRef.current.contains(e.target)) {
2935
3201
  setIsOpen(false);
@@ -2939,29 +3205,38 @@ var CustomSelect = ({ options, value, onChange, className = "" }) => {
2939
3205
  document.addEventListener("mousedown", handleClickOutside);
2940
3206
  return () => document.removeEventListener("mousedown", handleClickOutside);
2941
3207
  }
2942
- }, [isOpen]);
3208
+ }, [isOpen, type]);
3209
+ const selectedDate = type === "date" ? parseDate(value) : null;
3210
+ const handleDateSelect = (date) => {
3211
+ if (date) {
3212
+ onChange(formatISO(date));
3213
+ }
3214
+ setIsOpen(false);
3215
+ };
3216
+ const displayLabel = type === "date" ? selectedDate ? formatDisplay(selectedDate) : value || "\u2014" : selectedOption?.label || value;
3217
+ const displayBg = type === "date" ? void 0 : selectedOption?.backgroundColor;
2943
3218
  return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `rh-relative ${className}`, children: [
2944
3219
  /* @__PURE__ */ jsx(
2945
3220
  "button",
2946
3221
  {
2947
3222
  type: "button",
2948
- onClick: handleOpen,
3223
+ onClick: openDropdown,
2949
3224
  className: "rh-w-full rh-h-full rh-flex rh-items-center rh-justify-between rh-py-1 rh-bg-transparent hover:rh-bg-background/50 rh-cursor-pointer rh-text-left",
2950
3225
  children: /* @__PURE__ */ jsx("div", { className: "rh-flex rh-items-center rh-gap-2 rh-flex-1 rh-truncate", children: /* @__PURE__ */ jsx(
2951
3226
  "span",
2952
3227
  {
2953
3228
  className: "rh-truncate rh-text-[14px] rh-px-2 rh-py-1 rh-rounded-xl",
2954
3229
  style: {
2955
- backgroundColor: selectedOption?.backgroundColor || "transparent",
3230
+ backgroundColor: displayBg || "transparent",
2956
3231
  fontFamily: "Inter, sans-serif",
2957
- color: selectedOption?.backgroundColor ? "white" : "inherit"
3232
+ color: displayBg ? "white" : "inherit"
2958
3233
  },
2959
- children: selectedOption?.label || value
3234
+ children: displayLabel
2960
3235
  }
2961
3236
  ) })
2962
3237
  }
2963
3238
  ),
2964
- isOpen && createPortal(
3239
+ type === "select" && isOpen && createPortal(
2965
3240
  /* @__PURE__ */ jsx(
2966
3241
  "div",
2967
3242
  {
@@ -2981,13 +3256,23 @@ var CustomSelect = ({ options, value, onChange, className = "" }) => {
2981
3256
  },
2982
3257
  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",
2983
3258
  children: [
2984
- /* @__PURE__ */ jsx("div", { className: "rh-w-4 rh-h-4", children: option.value === value && /* @__PURE__ */ jsx("svg", { width: "13", height: "10", viewBox: "0 0 13 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
2985
- "path",
3259
+ /* @__PURE__ */ jsx("div", { className: "rh-w-4 rh-h-4", children: option.value === value && /* @__PURE__ */ jsx(
3260
+ "svg",
2986
3261
  {
2987
- d: "M12.7826 1.2813L4.78255 9.2813C4.71287 9.35122 4.63008 9.4067 4.53891 9.44455C4.44775 9.48241 4.35001 9.50189 4.2513 9.50189C4.15259 9.50189 4.05485 9.48241 3.96369 9.44455C3.87252 9.4067 3.78973 9.35122 3.72005 9.2813L0.220051 5.7813C0.150286 5.71154 0.0949458 5.62871 0.0571893 5.53756C0.0194329 5.44641 1.03958e-09 5.34871 0 5.25005C-1.03958e-09 5.15139 0.0194329 5.05369 0.0571893 4.96254C0.0949458 4.87139 0.150286 4.78857 0.220051 4.7188C0.289816 4.64904 0.372638 4.5937 0.46379 4.55594C0.554942 4.51818 0.652639 4.49875 0.751301 4.49875C0.849963 4.49875 0.947659 4.51818 1.03881 4.55594C1.12996 4.5937 1.21279 4.64904 1.28255 4.7188L4.25193 7.68818L11.7213 0.220051C11.8622 0.0791546 12.0533 0 12.2526 0C12.4518 0 12.6429 0.0791546 12.7838 0.220051C12.9247 0.360947 13.0039 0.552044 13.0039 0.751301C13.0039 0.950559 12.9247 1.14165 12.7838 1.28255L12.7826 1.2813Z",
2988
- fill: "#374151"
3262
+ width: "13",
3263
+ height: "10",
3264
+ viewBox: "0 0 13 10",
3265
+ fill: "none",
3266
+ xmlns: "http://www.w3.org/2000/svg",
3267
+ children: /* @__PURE__ */ jsx(
3268
+ "path",
3269
+ {
3270
+ d: "M12.7826 1.2813L4.78255 9.2813C4.71287 9.35122 4.63008 9.4067 4.53891 9.44455C4.44775 9.48241 4.35001 9.50189 4.2513 9.50189C4.15259 9.50189 4.05485 9.48241 3.96369 9.44455C3.87252 9.4067 3.78973 9.35122 3.72005 9.2813L0.220051 5.7813C0.150286 5.71154 0.0949458 5.62871 0.0571893 5.53756C0.0194329 5.44641 1.03958e-09 5.34871 0 5.25005C-1.03958e-09 5.15139 0.0194329 5.05369 0.0571893 4.96254C0.0949458 4.87139 0.150286 4.78857 0.220051 4.7188C0.289816 4.64904 0.372638 4.5937 0.46379 4.55594C0.554942 4.51818 0.652639 4.49875 0.751301 4.49875C0.849963 4.49875 0.947659 4.51818 1.03881 4.55594C1.12996 4.5937 1.21279 4.64904 1.28255 4.7188L4.25193 7.68818L11.7213 0.220051C11.8622 0.0791546 12.0533 0 12.2526 0C12.4518 0 12.6429 0.0791546 12.7838 0.220051C12.9247 0.360947 13.0039 0.552044 13.0039 0.751301C13.0039 0.950559 12.9247 1.14165 12.7838 1.28255L12.7826 1.2813Z",
3271
+ fill: "#374151"
3272
+ }
3273
+ )
2989
3274
  }
2990
- ) }) }),
3275
+ ) }),
2991
3276
  /* @__PURE__ */ jsx(
2992
3277
  "span",
2993
3278
  {
@@ -3006,6 +3291,16 @@ var CustomSelect = ({ options, value, onChange, className = "" }) => {
3006
3291
  }
3007
3292
  ),
3008
3293
  document.body
3294
+ ),
3295
+ type === "date" && isOpen && /* @__PURE__ */ jsx(
3296
+ DatePickerDropdown,
3297
+ {
3298
+ style: dropdownStyle,
3299
+ selectedDate,
3300
+ onSelect: handleDateSelect,
3301
+ onClose: () => setIsOpen(false),
3302
+ containerRef
3303
+ }
3009
3304
  )
3010
3305
  ] });
3011
3306
  };
@@ -3111,6 +3406,11 @@ function TableInner({
3111
3406
  return {};
3112
3407
  };
3113
3408
  const rowPaddingStyle = getRowPaddingStyle();
3409
+ const isEditableCell = (column) => {
3410
+ if (!column.editable || !column.editableValue) return false;
3411
+ if (column.type === "date") return true;
3412
+ return !!column.choices;
3413
+ };
3114
3414
  return /* @__PURE__ */ jsx("div", { className: "rh-w-full rh-rounded rh-overflow-hidden", children: /* @__PURE__ */ jsxs(
3115
3415
  "table",
3116
3416
  {
@@ -3208,9 +3508,10 @@ function TableInner({
3208
3508
  "rh-text-text"
3209
3509
  ].filter(Boolean).join(" "),
3210
3510
  children: /* @__PURE__ */ jsxs("div", { className: "rh-flex rh-items-center rh-justify-between rh-gap-2", children: [
3211
- column.editable && column.choices && column.editableValue ? /* @__PURE__ */ jsx(
3511
+ isEditableCell(column) ? /* @__PURE__ */ jsx(
3212
3512
  CustomSelect,
3213
3513
  {
3514
+ type: column.type ?? "select",
3214
3515
  options: column.choices,
3215
3516
  value: column.editableValue(row),
3216
3517
  onChange: (value) => column.onEditChange?.(row, index, value),