@farmzone/fz-react-ui 0.0.7 → 0.0.9

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.cts CHANGED
@@ -1200,6 +1200,14 @@ interface DetailModalFrameProps<T, S extends z.ZodTypeAny = z.ZodTypeAny> {
1200
1200
  mode?: UseDetailControllerParams["mode"];
1201
1201
  onModeChange?: UseDetailControllerParams["onModeChange"];
1202
1202
  contentClassName?: string;
1203
+ /** ModalBody 내 DetailContent 하단 추가 컨텐츠 (프로필 사진 등) */
1204
+ renderExtraContent?: (ctx: {
1205
+ isEditMode: boolean;
1206
+ }) => ReactNode;
1207
+ /** read 모드 footer 추가 버튼 — 닫기 앞에 삽입 */
1208
+ renderFooterExtra?: ReactNode;
1209
+ /** isDirty 상태 외부 노출 — 라우터 blocker 등에서 활용 */
1210
+ onDirtyChange?: (isDirty: boolean) => void;
1203
1211
  }
1204
1212
  declare function DetailModalFrame<T, S extends z.ZodTypeAny = z.ZodTypeAny>(props: DetailModalFrameProps<T, S>): React$1.JSX.Element;
1205
1213
 
package/dist/index.d.ts CHANGED
@@ -1200,6 +1200,14 @@ interface DetailModalFrameProps<T, S extends z.ZodTypeAny = z.ZodTypeAny> {
1200
1200
  mode?: UseDetailControllerParams["mode"];
1201
1201
  onModeChange?: UseDetailControllerParams["onModeChange"];
1202
1202
  contentClassName?: string;
1203
+ /** ModalBody 내 DetailContent 하단 추가 컨텐츠 (프로필 사진 등) */
1204
+ renderExtraContent?: (ctx: {
1205
+ isEditMode: boolean;
1206
+ }) => ReactNode;
1207
+ /** read 모드 footer 추가 버튼 — 닫기 앞에 삽입 */
1208
+ renderFooterExtra?: ReactNode;
1209
+ /** isDirty 상태 외부 노출 — 라우터 blocker 등에서 활용 */
1210
+ onDirtyChange?: (isDirty: boolean) => void;
1203
1211
  }
1204
1212
  declare function DetailModalFrame<T, S extends z.ZodTypeAny = z.ZodTypeAny>(props: DetailModalFrameProps<T, S>): React$1.JSX.Element;
1205
1213
 
package/dist/index.js CHANGED
@@ -3060,46 +3060,36 @@ function EmptyContent(props) {
3060
3060
  const hasHeader = icon || title || description;
3061
3061
  const isPage = layout === "page";
3062
3062
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3063
- hasHeader && /* @__PURE__ */ jsxs(
3064
- "div",
3065
- {
3066
- className: cn(
3067
- "flex flex-col items-center gap-2",
3068
- isPage && "mt-14 mb-10 gap-3",
3069
- !isPage && "max-w-sm"
3070
- ),
3071
- children: [
3072
- icon && /* @__PURE__ */ jsx("div", { className: cn(emptyIconVariants({ iconVariant }), iconClassName), children: icon }),
3073
- title && /* @__PURE__ */ jsx(
3074
- "div",
3075
- {
3076
- className: cn(
3077
- isPage && "text-2xl font-bold",
3078
- !isPage && "text-lg font-medium tracking-tight text-foreground",
3079
- titleClassName
3080
- ),
3081
- children: title
3082
- }
3063
+ hasHeader && /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col items-center gap-2", isPage && "mt-14 mb-10 gap-3", !isPage && "max-w-sm"), children: [
3064
+ icon && /* @__PURE__ */ jsx("div", { className: cn(emptyIconVariants({ iconVariant }), iconClassName), children: icon }),
3065
+ title && /* @__PURE__ */ jsx(
3066
+ "div",
3067
+ {
3068
+ className: cn(
3069
+ isPage && "text-2xl font-bold",
3070
+ !isPage && "text-lg font-medium tracking-tight text-foreground",
3071
+ titleClassName
3083
3072
  ),
3084
- description && /* @__PURE__ */ jsx(
3085
- "p",
3086
- {
3087
- className: cn(
3088
- isPage && "text-lg text-gray-500",
3089
- !isPage && "text-sm leading-relaxed text-muted-foreground",
3090
- descriptionClassName
3091
- ),
3092
- children: description
3093
- }
3094
- )
3095
- ]
3096
- }
3097
- ),
3073
+ children: title
3074
+ }
3075
+ ),
3076
+ description && /* @__PURE__ */ jsx(
3077
+ "p",
3078
+ {
3079
+ className: cn(
3080
+ isPage && "text-lg text-gray-500",
3081
+ !isPage && "text-sm leading-relaxed text-muted-foreground",
3082
+ descriptionClassName
3083
+ ),
3084
+ children: description
3085
+ }
3086
+ )
3087
+ ] }),
3098
3088
  action && /* @__PURE__ */ jsx(
3099
3089
  "div",
3100
3090
  {
3101
3091
  className: cn(
3102
- isPage && "flex-center w-full",
3092
+ isPage && "flex items-center justify-center w-full",
3103
3093
  !isPage && "flex w-full max-w-sm flex-col items-center gap-3",
3104
3094
  actionClassName
3105
3095
  ),
@@ -8870,9 +8860,15 @@ function DetailModalFrame(props) {
8870
8860
  renderEditBody,
8871
8861
  mode,
8872
8862
  onModeChange,
8873
- contentClassName
8863
+ contentClassName,
8864
+ renderExtraContent,
8865
+ renderFooterExtra,
8866
+ onDirtyChange
8874
8867
  } = props;
8875
8868
  const controller = useDetailController({ mode, onModeChange });
8869
+ useEffect(() => {
8870
+ onDirtyChange?.(controller.isDirty);
8871
+ }, [controller.isDirty, onDirtyChange]);
8876
8872
  const handleClose = useCallback(async () => {
8877
8873
  if (controller.isDirty) {
8878
8874
  const confirmed = await new Promise((resolve) => {
@@ -8910,24 +8906,31 @@ function DetailModalFrame(props) {
8910
8906
  /* @__PURE__ */ jsx("span", { className: "text-base font-semibold text-gray-900", children: title }),
8911
8907
  !isEditMode && canEdit && /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: handleEdit, children: "\uC218\uC815" })
8912
8908
  ] }),
8913
- /* @__PURE__ */ jsx(ModalBody, { className: "p-0", children: /* @__PURE__ */ jsx(
8914
- DetailContent,
8915
- {
8916
- controller,
8917
- data,
8918
- readFields,
8919
- editSchema,
8920
- editFields,
8921
- onSave,
8922
- renderReadBody,
8923
- renderEditBody,
8924
- layout: "compact"
8925
- }
8926
- ) }),
8909
+ /* @__PURE__ */ jsxs(ModalBody, { className: "flex-1 min-h-0 p-0", children: [
8910
+ /* @__PURE__ */ jsx(
8911
+ DetailContent,
8912
+ {
8913
+ controller,
8914
+ data,
8915
+ readFields,
8916
+ editSchema,
8917
+ editFields,
8918
+ onSave,
8919
+ renderReadBody,
8920
+ renderEditBody,
8921
+ layout: "compact",
8922
+ className: "overflow-visible max-h-none"
8923
+ }
8924
+ ),
8925
+ renderExtraContent?.({ isEditMode })
8926
+ ] }),
8927
8927
  /* @__PURE__ */ jsx(ModalFooter, { className: "flex justify-end gap-2", children: isEditMode ? /* @__PURE__ */ jsxs(Fragment, { children: [
8928
8928
  /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: handleCancelEdit, disabled: controller.isSaving, children: "\uCDE8\uC18C" }),
8929
8929
  /* @__PURE__ */ jsx(Button, { type: "submit", form: controller.formId, variant: "save", disabled: controller.isSaving, children: controller.isSaving ? "\uC800\uC7A5 \uC911..." : "\uC800\uC7A5" })
8930
- ] }) : /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: handleClose, children: "\uB2EB\uAE30" }) })
8930
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
8931
+ renderFooterExtra,
8932
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: handleClose, children: "\uB2EB\uAE30" })
8933
+ ] }) })
8931
8934
  ] });
8932
8935
  }
8933
8936
  function useBlockModalConfirm() {