@almadar/ui 5.161.0 → 5.163.0

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/avl/index.js CHANGED
@@ -35340,6 +35340,33 @@ var init_Lightbox = __esm({
35340
35340
  Lightbox.displayName = "Lightbox";
35341
35341
  }
35342
35342
  });
35343
+
35344
+ // lib/relationLabel.ts
35345
+ function relationLabel(value) {
35346
+ if (value === null || typeof value !== "object" || Array.isArray(value) || value instanceof Date)
35347
+ return null;
35348
+ for (const key of ["name", "title", "label"]) {
35349
+ const candidate = value[key];
35350
+ if (typeof candidate === "string" && candidate !== "") return candidate;
35351
+ }
35352
+ const id = value.id;
35353
+ return id !== void 0 && id !== null ? String(id) : null;
35354
+ }
35355
+ function relationDisplayLabels(value, options) {
35356
+ if (value === void 0 || value === null || value === "") return [];
35357
+ if (Array.isArray(value)) {
35358
+ return value.flatMap((item) => relationDisplayLabels(item, options));
35359
+ }
35360
+ const hydrated = relationLabel(value);
35361
+ if (hydrated !== null) return [hydrated];
35362
+ const raw = String(value);
35363
+ const match = options?.find((opt) => opt.value === raw);
35364
+ return [match ? match.label : raw];
35365
+ }
35366
+ var init_relationLabel = __esm({
35367
+ "lib/relationLabel.ts"() {
35368
+ }
35369
+ });
35343
35370
  function renderIconInput3(icon, props) {
35344
35371
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
35345
35372
  }
@@ -35657,6 +35684,7 @@ var init_TableView = __esm({
35657
35684
  "use client";
35658
35685
  init_cn();
35659
35686
  init_format();
35687
+ init_relationLabel();
35660
35688
  init_getNestedValue();
35661
35689
  init_useEventBus();
35662
35690
  init_Box();
@@ -35670,7 +35698,13 @@ var init_TableView = __esm({
35670
35698
  init_Menu();
35671
35699
  init_useDataDnd();
35672
35700
  tableViewLog = createLogger("almadar:ui:table-view");
35673
- formatCell = (value, format) => formatValue(value, format);
35701
+ formatCell = (value, format) => {
35702
+ if (value !== null && value !== void 0 && typeof value === "object" && !(value instanceof Date)) {
35703
+ const labels = relationDisplayLabels(value);
35704
+ if (labels.length > 0) return labels.join(", ");
35705
+ }
35706
+ return formatValue(value, format);
35707
+ };
35674
35708
  MAX_MEASURED_COL_CH = 32;
35675
35709
  BADGE_CHROME_CH = 4;
35676
35710
  alignClass = {
@@ -39285,6 +39319,13 @@ var init_RichTextEditor = __esm({
39285
39319
  document.execCommand("createLink", false, safe);
39286
39320
  afterEdit();
39287
39321
  }, [afterEdit, t, toolbar.link]);
39322
+ const execImage = useCallback(() => {
39323
+ const url = window.prompt(t("richTextEditor.imagePrompt"));
39324
+ if (!url) return;
39325
+ const safe = safeUrl(url, ["http://", "https://", "data:image/"]) ?? `https://${url}`;
39326
+ document.execCommand("insertImage", false, safe);
39327
+ afterEdit();
39328
+ }, [afterEdit, t]);
39288
39329
  const execRule = useCallback(() => {
39289
39330
  document.execCommand("insertHorizontalRule", false);
39290
39331
  afterEdit();
@@ -39322,6 +39363,7 @@ var init_RichTextEditor = __esm({
39322
39363
  /* @__PURE__ */ jsx(ToolbarButton, { icon: Quote, label: t("richTextEditor.quote"), active: toolbar.block === "blockquote", onExec: () => execBlock("blockquote") }),
39323
39364
  /* @__PURE__ */ jsx(ToolbarButton, { icon: Code, label: t("richTextEditor.code"), active: toolbar.block === "pre", onExec: () => execBlock("pre") }),
39324
39365
  /* @__PURE__ */ jsx(ToolbarButton, { icon: Link$1, label: toolbar.link ? t("richTextEditor.removeLink") : t("richTextEditor.link"), active: toolbar.link, onExec: execLink }),
39366
+ /* @__PURE__ */ jsx(ToolbarButton, { icon: Image$1, label: t("richTextEditor.image"), onExec: execImage }),
39325
39367
  /* @__PURE__ */ jsx(ToolbarButton, { icon: Minus, label: t("richTextEditor.divider"), onExec: execRule })
39326
39368
  ]
39327
39369
  }
@@ -39359,9 +39401,11 @@ function renderIconInput4(icon, props) {
39359
39401
  return typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: icon, ...props }) : /* @__PURE__ */ jsx(Icon, { icon, ...props });
39360
39402
  }
39361
39403
  function DocumentPanel({
39362
- entity,
39404
+ id,
39363
39405
  title,
39364
39406
  subtitle,
39407
+ coverImage,
39408
+ icon,
39365
39409
  value,
39366
39410
  actions,
39367
39411
  maxInlineActions,
@@ -39379,14 +39423,14 @@ function DocumentPanel({
39379
39423
  const eventBus = useEventBus();
39380
39424
  const { t } = useTranslate();
39381
39425
  const [titleDraft, setTitleDraft] = useState(null);
39382
- const recordId = entity?.id !== void 0 && entity?.id !== null ? String(entity.id) : "";
39426
+ const recordId = id ?? "";
39383
39427
  const actionDefs = actions ?? [];
39384
39428
  const inlineCap = Math.min(maxInlineActions ?? 1, 1);
39385
39429
  const inlineActions = actionDefs.filter((a) => a.variant === "primary").slice(0, inlineCap);
39386
39430
  const menuActions = actionDefs.filter((a) => !inlineActions.includes(a));
39387
39431
  const fireAction = (action) => {
39388
39432
  if (!action.event) return;
39389
- eventBus.emit(`UI:${action.event}`, { id: recordId, row: entity });
39433
+ eventBus.emit(`UI:${action.event}`, { id: recordId, title: title ?? "" });
39390
39434
  };
39391
39435
  const commitTitle = () => {
39392
39436
  if (!titleCommitEvent) return;
@@ -39437,62 +39481,74 @@ function DocumentPanel({
39437
39481
  const emitWithId = (event) => () => {
39438
39482
  if (event) eventBus.emit(`UI:${event}`, { id: recordId });
39439
39483
  };
39440
- return /* @__PURE__ */ jsx(Card, { variant: "elevated", className: cn("w-full", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "p-6 sm:p-8", children: [
39441
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
39442
- /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
39443
- titleNode,
39444
- subtitle ? /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: subtitle }) : null
39445
- ] }),
39446
- /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0 pt-1 items-center", children: editing ? /* @__PURE__ */ jsxs(Fragment, { children: [
39447
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "hidden sm:block", children: autosaveHint ?? (t("documentPanel.autosaveHint") || "") }),
39448
- /* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", onClick: emitWithId(doneEvent), "data-testid": "document-done", children: doneLabel ?? (t("documentPanel.done") || "Done") })
39449
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
39450
- editEvent && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: emitWithId(editEvent), "data-testid": "document-edit", children: [
39451
- /* @__PURE__ */ jsx(Icon, { name: "edit", size: "xs", className: "mr-1" }),
39452
- editLabel ?? (t("documentPanel.edit") || "Edit")
39453
- ] }),
39454
- inlineActions.map((action, idx) => /* @__PURE__ */ jsxs(
39455
- Button,
39456
- {
39457
- variant: "primary",
39458
- size: "sm",
39459
- onClick: () => fireAction(action),
39460
- "data-testid": `action-${action.event}`,
39461
- children: [
39462
- action.icon && renderIconInput4(action.icon, { size: "xs", className: "mr-1" }),
39463
- action.label
39464
- ]
39465
- },
39466
- idx
39467
- )),
39468
- menuActions.length > 0 && /* @__PURE__ */ jsx(
39469
- Menu,
39470
- {
39471
- position: "bottom-end",
39472
- trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
39473
- items: menuActions.map((action) => ({
39474
- label: action.label,
39475
- icon: action.icon,
39476
- variant: action.variant === "danger" ? "danger" : "default",
39477
- onClick: () => fireAction(action)
39478
- }))
39479
- }
39480
- )
39481
- ] }) })
39482
- ] }),
39483
- editing ? /* @__PURE__ */ jsx(RichTextEditor, { value, changeEvent: contentChangeEvent, placeholder }) : /* @__PURE__ */ jsx(
39484
- Box,
39484
+ return /* @__PURE__ */ jsxs(Card, { variant: "elevated", className: cn("w-full overflow-hidden", className), children: [
39485
+ coverImage ? /* @__PURE__ */ jsx(Box, { className: "h-44 w-full sm:h-52", "data-testid": "document-cover", children: /* @__PURE__ */ jsx(
39486
+ "img",
39485
39487
  {
39486
- onClick: emitWithId(editEvent),
39487
- className: cn(
39488
- "rounded-md px-1 -mx-1 min-h-[16rem]",
39489
- editEvent && "cursor-text transition-colors hover:bg-muted/30"
39490
- ),
39491
- "data-testid": "document-body",
39492
- children: value && value !== "" ? /* @__PURE__ */ jsx(RichTextEditor, { value, readOnly: true }) : /* @__PURE__ */ jsx(Typography, { variant: "body", color: "muted", children: placeholder ?? (t("documentPanel.placeholder") || "") })
39493
- }
39494
- )
39495
- ] }) });
39488
+ src: coverImage,
39489
+ alt: "",
39490
+ "aria-hidden": "true",
39491
+ className: "h-full w-full object-cover"
39492
+ }
39493
+ ) }) : null,
39494
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "p-6 sm:p-8", children: [
39495
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-between items-start", children: [
39496
+ /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
39497
+ icon ? /* @__PURE__ */ jsx(Box, { className: "text-muted-foreground", "data-testid": "document-icon", children: renderIconInput4(icon, { size: "lg" }) }) : null,
39498
+ titleNode,
39499
+ subtitle ? /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: subtitle }) : null
39500
+ ] }),
39501
+ /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-shrink-0 pt-1 items-center", children: editing ? /* @__PURE__ */ jsxs(Fragment, { children: [
39502
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "hidden sm:block", children: autosaveHint ?? (t("documentPanel.autosaveHint") || "") }),
39503
+ /* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", onClick: emitWithId(doneEvent), "data-testid": "document-done", children: doneLabel ?? (t("documentPanel.done") || "Done") })
39504
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
39505
+ editEvent && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: emitWithId(editEvent), "data-testid": "document-edit", children: [
39506
+ /* @__PURE__ */ jsx(Icon, { name: "edit", size: "xs", className: "mr-1" }),
39507
+ editLabel ?? (t("documentPanel.edit") || "Edit")
39508
+ ] }),
39509
+ inlineActions.map((action, idx) => /* @__PURE__ */ jsxs(
39510
+ Button,
39511
+ {
39512
+ variant: "primary",
39513
+ size: "sm",
39514
+ onClick: () => fireAction(action),
39515
+ "data-testid": `action-${action.event}`,
39516
+ children: [
39517
+ action.icon && renderIconInput4(action.icon, { size: "xs", className: "mr-1" }),
39518
+ action.label
39519
+ ]
39520
+ },
39521
+ idx
39522
+ )),
39523
+ menuActions.length > 0 && /* @__PURE__ */ jsx(
39524
+ Menu,
39525
+ {
39526
+ position: "bottom-end",
39527
+ trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": t("common.actions"), "data-testid": "action-overflow", children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
39528
+ items: menuActions.map((action) => ({
39529
+ label: action.label,
39530
+ icon: action.icon,
39531
+ variant: action.variant === "danger" ? "danger" : "default",
39532
+ onClick: () => fireAction(action)
39533
+ }))
39534
+ }
39535
+ )
39536
+ ] }) })
39537
+ ] }),
39538
+ editing ? /* @__PURE__ */ jsx(RichTextEditor, { value, changeEvent: contentChangeEvent, placeholder }) : /* @__PURE__ */ jsx(
39539
+ Box,
39540
+ {
39541
+ onClick: emitWithId(editEvent),
39542
+ className: cn(
39543
+ "rounded-md px-1 -mx-1 min-h-[16rem]",
39544
+ editEvent && "cursor-text transition-colors hover:bg-muted/30"
39545
+ ),
39546
+ "data-testid": "document-body",
39547
+ children: value && value !== "" ? /* @__PURE__ */ jsx(RichTextEditor, { value, readOnly: true }) : /* @__PURE__ */ jsx(Typography, { variant: "body", color: "muted", children: placeholder ?? (t("documentPanel.placeholder") || "") })
39548
+ }
39549
+ )
39550
+ ] })
39551
+ ] });
39496
39552
  }
39497
39553
  var init_DocumentPanel = __esm({
39498
39554
  "components/core/molecules/DocumentPanel.tsx"() {
@@ -39516,17 +39572,16 @@ function renderIconInput5(icon, props) {
39516
39572
  function fieldName(field) {
39517
39573
  return field.name ?? field.key ?? "";
39518
39574
  }
39519
- function relationLabel(value) {
39520
- if (value === null || typeof value !== "object" || Array.isArray(value) || value instanceof Date) return null;
39521
- for (const key of ["name", "title", "label"]) {
39522
- const candidate = value[key];
39523
- if (typeof candidate === "string" && candidate !== "") return candidate;
39575
+ function relationId(value) {
39576
+ if (value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date)) {
39577
+ const id = value.id;
39578
+ if (id !== void 0 && id !== null) return String(id);
39524
39579
  }
39525
- const id = value.id;
39526
- return id !== void 0 && id !== null ? String(id) : null;
39580
+ return String(value);
39527
39581
  }
39528
39582
  function fieldKind(field, value) {
39529
39583
  if (field.kind) return field.kind;
39584
+ if (field.type === "image") return "image";
39530
39585
  if (field.options && field.options.length > 0) return "select";
39531
39586
  if (typeof value === "boolean" || field.format === "boolean") return "boolean";
39532
39587
  if (Array.isArray(value) || relationLabel(value ?? null) !== null) return "readonly";
@@ -39536,6 +39591,7 @@ function DocumentDetails({
39536
39591
  entity,
39537
39592
  fields,
39538
39593
  metaCommitEvent,
39594
+ relationEvent,
39539
39595
  title,
39540
39596
  className
39541
39597
  }) {
@@ -39550,11 +39606,51 @@ function DocumentDetails({
39550
39606
  if (!metaCommitEvent || next === current) return;
39551
39607
  eventBus.emit(`UI:${metaCommitEvent}`, { id: recordId, patch: { id: recordId, [name]: next } });
39552
39608
  };
39609
+ const relationChip = (item, name, key) => {
39610
+ const label = relationLabel(item) ?? humanizeEnumValue(String(item));
39611
+ if (!relationEvent) {
39612
+ return /* @__PURE__ */ jsx(Badge, { variant: "default", children: label }, key);
39613
+ }
39614
+ const emitClick = () => eventBus.emit(`UI:${relationEvent}`, { field: name, id: relationId(item), name: label });
39615
+ return /* @__PURE__ */ jsx(
39616
+ Badge,
39617
+ {
39618
+ variant: "default",
39619
+ role: "button",
39620
+ tabIndex: 0,
39621
+ className: "cursor-pointer transition-colors hover:bg-accent",
39622
+ onClick: emitClick,
39623
+ onKeyDown: (e) => {
39624
+ if (e.key === "Enter" || e.key === " ") {
39625
+ e.preventDefault();
39626
+ emitClick();
39627
+ }
39628
+ },
39629
+ "data-testid": `relation-chip-${name}`,
39630
+ children: label
39631
+ },
39632
+ key
39633
+ );
39634
+ };
39553
39635
  const renderValue = (field) => {
39554
39636
  const name = fieldName(field);
39555
39637
  const raw = getNestedValue(entity ?? {}, name);
39556
39638
  const kind = fieldKind(field, raw);
39557
39639
  const label = field.label ?? field.header ?? humanizeFieldName(name);
39640
+ if (kind === "image") {
39641
+ const url = typeof raw === "string" ? raw : "";
39642
+ if (!url) return /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: "\u2014" });
39643
+ return /* @__PURE__ */ jsx(
39644
+ "img",
39645
+ {
39646
+ src: url,
39647
+ alt: label,
39648
+ loading: "lazy",
39649
+ className: "max-h-32 w-full rounded-md border border-border object-cover",
39650
+ "data-testid": `document-property-image-${name}`
39651
+ }
39652
+ );
39653
+ }
39558
39654
  if (kind === "boolean") {
39559
39655
  return /* @__PURE__ */ jsx(
39560
39656
  Switch,
@@ -39584,9 +39680,12 @@ function DocumentDetails({
39584
39680
  if (raw.length === 0) {
39585
39681
  return /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: "\u2014" });
39586
39682
  }
39587
- return /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: raw.map((item, i) => /* @__PURE__ */ jsx(Badge, { variant: "default", children: relationLabel(item) ?? humanizeEnumValue(String(item)) }, i)) });
39683
+ return /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: raw.map((item, i) => relationChip(item, name, i)) });
39684
+ }
39685
+ if (raw !== void 0 && raw !== null && raw !== "" && relationLabel(raw) !== null) {
39686
+ return relationChip(raw, name);
39588
39687
  }
39589
- const shown2 = raw === void 0 || raw === null || raw === "" ? "\u2014" : relationLabel(raw) ?? formatValue(raw, field.format);
39688
+ const shown2 = raw === void 0 || raw === null || raw === "" ? "\u2014" : formatValue(raw, field.format);
39590
39689
  return /* @__PURE__ */ jsx(Typography, { variant: "small", className: "break-words", children: shown2 });
39591
39690
  }
39592
39691
  if (fieldDraft?.name === name) {
@@ -39655,6 +39754,7 @@ var init_DocumentDetails = __esm({
39655
39754
  init_cn();
39656
39755
  init_format();
39657
39756
  init_getNestedValue();
39757
+ init_relationLabel();
39658
39758
  init_useEventBus();
39659
39759
  init_Box();
39660
39760
  init_Stack();
@@ -44240,7 +44340,18 @@ function renderRichFieldValue(value, fieldName2, fieldType, meta) {
44240
44340
  if (value === void 0 || value === null) return "\u2014";
44241
44341
  const str = String(value);
44242
44342
  switch (fieldType) {
44243
- case "image":
44343
+ case "image": {
44344
+ if (!str) return "\u2014";
44345
+ return /* @__PURE__ */ jsx(Box, { className: "mt-1 max-w-full", children: /* @__PURE__ */ jsx(
44346
+ "img",
44347
+ {
44348
+ src: str,
44349
+ alt: formatFieldLabel(fieldName2),
44350
+ className: "max-w-full max-h-64 rounded-md object-contain",
44351
+ loading: "lazy"
44352
+ }
44353
+ ) });
44354
+ }
44244
44355
  case "url": {
44245
44356
  if (str.match(/\.(png|jpe?g|gif|svg|webp|avif)(\?|$)/i) || str.startsWith("data:image/")) {
44246
44357
  return /* @__PURE__ */ jsx(Box, { className: "mt-1 max-w-full", children: /* @__PURE__ */ jsx(
@@ -44253,7 +44364,7 @@ function renderRichFieldValue(value, fieldName2, fieldType, meta) {
44253
44364
  }
44254
44365
  ) });
44255
44366
  }
44256
- if (fieldType === "url" && /^https?:\/\//i.test(str)) {
44367
+ if (/^https?:\/\//i.test(str)) {
44257
44368
  return /* @__PURE__ */ jsx(
44258
44369
  "a",
44259
44370
  {
@@ -44339,8 +44450,10 @@ function renderRichFieldValue(value, fieldName2, fieldType, meta) {
44339
44450
  return str;
44340
44451
  }
44341
44452
  case "relation": {
44342
- const match = meta?.options?.find((opt) => opt.value === str);
44343
- return match ? match.label : str;
44453
+ const labels = relationDisplayLabels(value, meta?.options);
44454
+ if (labels.length === 0) return "\u2014";
44455
+ if (labels.length === 1) return labels[0];
44456
+ return /* @__PURE__ */ jsx(HStack, { gap: "xs", wrap: true, children: labels.map((label, i) => /* @__PURE__ */ jsx(Badge, { variant: "default", children: label }, i)) });
44344
44457
  }
44345
44458
  case "file": {
44346
44459
  if (value !== null && typeof value === "object" && !Array.isArray(value)) {
@@ -44442,6 +44555,7 @@ var init_DetailPanel = __esm({
44442
44555
  init_cn();
44443
44556
  init_format();
44444
44557
  init_getNestedValue();
44558
+ init_relationLabel();
44445
44559
  init_useEventBus();
44446
44560
  init_UploadDropZone();
44447
44561
  formatFieldLabel = humanizeFieldName;
@@ -45100,6 +45214,8 @@ function determineInputType(field) {
45100
45214
  return "url";
45101
45215
  case "file":
45102
45216
  return "file";
45217
+ case "image":
45218
+ return "image";
45103
45219
  case "money":
45104
45220
  return "currency";
45105
45221
  case "number":
@@ -45699,6 +45815,49 @@ var init_Form = __esm({
45699
45815
  }
45700
45816
  }
45701
45817
  );
45818
+ case "image": {
45819
+ const imageUrl = typeof currentValue === "string" ? currentValue : "";
45820
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
45821
+ imageUrl ? /* @__PURE__ */ jsx(
45822
+ "img",
45823
+ {
45824
+ src: imageUrl,
45825
+ alt: "",
45826
+ "aria-hidden": "true",
45827
+ className: "h-24 w-full max-w-xs rounded-md border border-border object-cover",
45828
+ "data-testid": `image-preview-${fieldName2}`
45829
+ }
45830
+ ) : null,
45831
+ /* @__PURE__ */ jsx(
45832
+ Input,
45833
+ {
45834
+ ...commonProps,
45835
+ type: "url",
45836
+ value: imageUrl,
45837
+ onChange: (e) => handleChange(fieldName2, e.target.value)
45838
+ }
45839
+ ),
45840
+ /* @__PURE__ */ jsx(
45841
+ UploadDropZone,
45842
+ {
45843
+ accept: "image/*",
45844
+ maxFiles: 1,
45845
+ maxSize: 2 * 1024 * 1024,
45846
+ disabled: isLoading,
45847
+ onFiles: (files) => {
45848
+ const f3 = files[0];
45849
+ if (!f3) return;
45850
+ const reader = new FileReader();
45851
+ reader.onload = () => handleChange(
45852
+ fieldName2,
45853
+ typeof reader.result === "string" ? reader.result : ""
45854
+ );
45855
+ reader.readAsDataURL(f3);
45856
+ }
45857
+ }
45858
+ )
45859
+ ] });
45860
+ }
45702
45861
  case "date":
45703
45862
  return /* @__PURE__ */ jsx(
45704
45863
  Input,