@farmzone/fz-react-ui 1.0.14 → 1.0.15

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.cjs CHANGED
@@ -1096,43 +1096,50 @@ function Radio(props) {
1096
1096
  "--radio-checked": checkColor,
1097
1097
  "--radio-unchecked": unCheckColor
1098
1098
  };
1099
- const control = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-1.5", wrapperClassName), style: colorVars, children: [
1100
- /* @__PURE__ */ jsxRuntime.jsx(
1101
- RadioGroupPrimitive__namespace.Item,
1102
- {
1103
- value,
1104
- disabled,
1105
- id: inputId,
1106
- className: cn(
1107
- "group relative size-4 shrink-0 rounded-full border box-border transition-colors duration-200 outline-none",
1108
- "border-(--radio-unchecked) data-[state=checked]:border-(--radio-checked)",
1109
- "data-[state=unchecked]:hover:opacity-80",
1110
- disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
1111
- ),
1112
- children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "relative flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
1113
- lucideReact.CircleIcon,
1099
+ const control = /* @__PURE__ */ jsxRuntime.jsxs(
1100
+ "label",
1101
+ {
1102
+ htmlFor: inputId,
1103
+ className: cn("flex items-center gap-1.5", disabled ? "cursor-not-allowed" : "cursor-pointer", wrapperClassName),
1104
+ style: colorVars,
1105
+ children: [
1106
+ /* @__PURE__ */ jsxRuntime.jsx(
1107
+ RadioGroupPrimitive__namespace.Item,
1114
1108
  {
1109
+ value,
1110
+ disabled,
1111
+ id: inputId,
1115
1112
  className: cn(
1116
- "absolute top-1/2 left-1/2 size-2.5 -translate-x-1/2 -translate-y-1/2 fill-(--radio-checked) text-(--radio-checked) transition-opacity duration-200",
1117
- indicatorClassName
1118
- )
1113
+ "group relative size-4 shrink-0 rounded-full border box-border transition-colors duration-200 outline-none",
1114
+ "border-(--radio-unchecked) data-[state=checked]:border-(--radio-checked)",
1115
+ "data-[state=unchecked]:hover:opacity-80",
1116
+ disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
1117
+ ),
1118
+ children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "relative flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
1119
+ lucideReact.CircleIcon,
1120
+ {
1121
+ className: cn(
1122
+ "absolute top-1/2 left-1/2 size-2.5 -translate-x-1/2 -translate-y-1/2 fill-(--radio-checked) text-(--radio-checked) transition-opacity duration-200",
1123
+ indicatorClassName
1124
+ )
1125
+ }
1126
+ ) })
1119
1127
  }
1120
- ) })
1121
- }
1122
- ),
1123
- /* @__PURE__ */ jsxRuntime.jsx(
1124
- "label",
1125
- {
1126
- htmlFor: inputId,
1127
- className: cn(
1128
- "text-sm font-medium cursor-pointer text-black select-none",
1129
- disabled && "cursor-not-allowed text-gray-400 opacity-50",
1130
- labelClassName
1131
1128
  ),
1132
- children: label
1133
- }
1134
- )
1135
- ] });
1129
+ /* @__PURE__ */ jsxRuntime.jsx(
1130
+ "span",
1131
+ {
1132
+ className: cn(
1133
+ "text-sm font-medium text-black select-none",
1134
+ disabled && "text-gray-400 opacity-50",
1135
+ labelClassName
1136
+ ),
1137
+ children: label
1138
+ }
1139
+ )
1140
+ ]
1141
+ }
1142
+ );
1136
1143
  const withTooltip = (node) => {
1137
1144
  if (!disabled || !disabledMessage) return node;
1138
1145
  return /* @__PURE__ */ jsxRuntime.jsx(Tooltip2, { content: disabledMessage, position: "bottom", asChild: true, sideOffset: 4, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex", children: node }) });
@@ -1179,11 +1186,7 @@ function RadioGroup(props) {
1179
1186
  value,
1180
1187
  onValueChange: (newValue) => onChange(newValue),
1181
1188
  disabled,
1182
- className: cn(
1183
- "flex flex-wrap gap-3",
1184
- direction === "horizontal" ? "flex-row" : "flex-col",
1185
- containerClassName
1186
- ),
1189
+ className: cn("flex flex-wrap gap-3", direction === "horizontal" ? "flex-row" : "flex-col", containerClassName),
1187
1190
  children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
1188
1191
  Radio,
1189
1192
  {
@@ -9242,6 +9245,9 @@ function Sidebar(props) {
9242
9245
  const [overflowVisible, setOverflowVisible] = React6.useState(true);
9243
9246
  const [expandedItems, setExpandedItems] = React6.useState(/* @__PURE__ */ new Set());
9244
9247
  const [expandedSubItems, setExpandedSubItems] = React6.useState(/* @__PURE__ */ new Set());
9248
+ const toggleCollapse = () => setIsCollapsed((prev) => !prev);
9249
+ const isHeaderRenderProp = typeof header === "function";
9250
+ const headerContent = isHeaderRenderProp ? header({ isCollapsed, toggleCollapse }) : header;
9245
9251
  React6.useEffect(() => {
9246
9252
  if (isCollapsed) {
9247
9253
  setOverflowVisible(false);
@@ -9316,21 +9322,22 @@ function Sidebar(props) {
9316
9322
  ${className ?? ""}
9317
9323
  `,
9318
9324
  children: [
9319
- showCollapseButton && /* @__PURE__ */ jsxRuntime.jsx(
9325
+ showCollapseButton && !isHeaderRenderProp && /* @__PURE__ */ jsxRuntime.jsx(
9320
9326
  "button",
9321
9327
  {
9322
- onClick: () => setIsCollapsed((prev) => !prev),
9328
+ onClick: toggleCollapse,
9323
9329
  className: `absolute top-4 z-20 w-6.5 h-6.5 rounded-full flex items-center justify-center transition-colors cursor-pointer ${s.collapseBtn} ${collapseButtonPlacement === "left" ? "left-2" : "right-2"}`,
9324
9330
  children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelRightClose, { size: 18, color: primaryColor ?? s.collapseIcon }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftClose, { size: 18, color: primaryColor ?? s.collapseIcon })
9325
9331
  }
9326
9332
  ),
9333
+ isHeaderRenderProp && headerContent,
9327
9334
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-1 min-h-0 hide-scrollbar ${overflowVisible ? "overflow-y-auto" : "overflow-hidden"}`, children: /* @__PURE__ */ jsxRuntime.jsxs(
9328
9335
  "div",
9329
9336
  {
9330
9337
  className: `transition-opacity duration-200 ease-in-out ${isCollapsed ? "opacity-0 pointer-events-none select-none" : "opacity-100"} ${variant === "system-dark" || variant === "system-light" ? "pb-6" : "px-4 pb-6"}`,
9331
9338
  style: { transitionDelay: isCollapsed ? "0ms" : "150ms" },
9332
9339
  children: [
9333
- header && header,
9340
+ !isHeaderRenderProp && headerContent,
9334
9341
  /* @__PURE__ */ jsxRuntime.jsx("nav", { className: `space-y-6 ${variant === "system-dark" || variant === "system-light" ? "px-1" : ""}`, children: menuSections.map((section, sectionIndex) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9335
9342
  section.title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: s.sectionTitle, children: section.title }),
9336
9343
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5", children: section.items.map((item) => {
@@ -9810,7 +9817,16 @@ function DetailModalFrame(props) {
9810
9817
  ] }),
9811
9818
  /* @__PURE__ */ jsxRuntime.jsx(ModalFooter, { className: "flex justify-end", children: isEditMode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9812
9819
  /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", onClick: handleCancelEdit, disabled: controller.isSaving, children: "\uCDE8\uC18C" }),
9813
- /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", form: controller.formId, variant: "save", disabled: controller.isSaving, children: "\uC800\uC7A5" })
9820
+ /* @__PURE__ */ jsxRuntime.jsx(
9821
+ Button,
9822
+ {
9823
+ type: "submit",
9824
+ form: controller.formId,
9825
+ variant: "save",
9826
+ disabled: controller.isSaving || !controller.isDirty,
9827
+ children: "\uC800\uC7A5"
9828
+ }
9829
+ )
9814
9830
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9815
9831
  canEdit && /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", onClick: handleEdit, children: "\uC218\uC815" }),
9816
9832
  renderFooterExtra,