@asteby/metacore-runtime-react 37.5.1 → 38.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @asteby/metacore-runtime-react
2
2
 
3
+ ## 38.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5f872f0: `ProcessStepper` llega a `@asteby/metacore-ui/wizard`: el indicador de pasos de los modales de proceso (círculos con icono o número, check al completar, etiqueta debajo y conectores flexibles), una sola implementación para toda la plataforma.
8
+
9
+ `runtime-react`: los wizards declarativos (`form_layout.mode = "steps"`) en `DynamicForm` y `DynamicRecordDialog` ahora usan ese stepper en lugar de la barra de progreso plana, con navegación hacia atrás al pulsar un paso completado.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [5f872f0]
14
+ - @asteby/metacore-ui@2.18.0
15
+
16
+ ## 37.6.0
17
+
18
+ ### Minor Changes
19
+
20
+ - 8231b21: Fix `ensureHref` mangling every root-relative asset URL (the platform's own
21
+ convention for locally-served files — uploads, hub-generated images,
22
+ printable documents) into a broken `https:///storage/…` link (scheme + empty
23
+ host). Root-relative paths (`/storage/…`), protocol-relative (`//…`) and
24
+ fully-qualified URLs now pass through unchanged; only a bare host like
25
+ `github.com/x` still gets `https://` prefixed.
26
+
27
+ Also: clicking an image thumbnail (table cell, detail dialog, linkified free
28
+ text — anywhere `ImageThumbnail`/`MediaValue` renders) now opens a full-size
29
+ **preview dialog** instead of navigating to the raw file in a new tab. This
30
+ is the platform-wide click-to-zoom behavior; no caller builds its own
31
+ lightbox.
32
+
3
33
  ## 37.5.1
4
34
 
5
35
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"action-modal-dispatcher.d.ts","sourceRoot":"","sources":["../src/action-modal-dispatcher.tsx"],"names":[],"mappings":"AAsEA,OAAO,KAAK,EAAE,cAAc,EAAmC,MAAM,SAAS,CAAA;AAE9E,OAAO,EACH,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
  import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, Button, Input, Textarea, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch, } from '@asteby/metacore-ui/primitives';
17
17
  import { Loader2 } from 'lucide-react';
18
+ import { ProcessStepper } from '@asteby/metacore-ui/wizard';
18
19
  import { toast } from 'sonner';
19
20
  import { toastServerError, toastServerSuccess, extractFieldErrors, localizeFieldErrorMap } from './server-error';
20
21
  import { useBranchCreateGate } from './branch-create-gate';
@@ -666,9 +667,7 @@ function WizardActionModal({ open, onOpenChange, action, model, record, endpoint
666
667
  };
667
668
  if (steps.length === 0)
668
669
  return null;
669
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: 'flex max-h-[90dvh] flex-col overflow-hidden ' + (widthPx ? '' : 'sm:max-w-xl'), style: { maxHeight: '90dvh', ...(widthPx ? { maxWidth: widthPx, width: '95vw' } : {}) }, children: [_jsxs(DialogHeader, { className: "shrink-0", children: [_jsxs(DialogTitle, { className: "flex items-center gap-2", children: [_jsx(DynamicIcon, { name: action.icon, className: "h-5 w-5" }), tl(action.label)] }), _jsxs("div", { className: "pt-2", children: [_jsx("div", { className: "flex items-center gap-1.5", role: "list", "aria-label": "progress", children: steps.map((s, i) => (_jsx("div", { role: "listitem", "aria-current": i === stepIndex ? 'step' : undefined, className: "h-1.5 flex-1 rounded-full", style: {
670
- backgroundColor: i <= stepIndex ? (action.color || 'hsl(var(--primary))') : 'hsl(var(--muted))',
671
- } }, i))) }), _jsxs(DialogDescription, { className: "pt-2", children: [t('common.step', { defaultValue: 'Paso' }), " ", stepIndex + 1, "/", steps.length, step?.title ? ` · ${tl(step.title)}` : ''] }), step?.description && (_jsx("p", { className: "pt-1 text-sm text-muted-foreground", children: tl(step.description) }))] })] }), _jsx("div", { className: "-mx-1 min-h-0 flex-1 overflow-y-auto px-1 py-4", children: _jsx(FieldGrid, { children: stepFields.map((field) => {
670
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: 'flex max-h-[90dvh] flex-col overflow-hidden ' + (widthPx ? '' : 'sm:max-w-xl'), style: { maxHeight: '90dvh', ...(widthPx ? { maxWidth: widthPx, width: '95vw' } : {}) }, children: [_jsxs(DialogHeader, { className: "shrink-0", children: [_jsxs(DialogTitle, { className: "flex items-center gap-2", children: [_jsx(DynamicIcon, { name: action.icon, className: "h-5 w-5" }), tl(action.label)] }), _jsxs("div", { className: "pt-1", children: [_jsx(ProcessStepper, { steps: steps.map((s, i) => ({ key: String(i), label: s.title ? tl(s.title) : `${t('common.step', { defaultValue: 'Paso' })} ${i + 1}` })), activeIndex: stepIndex, onStepClick: i => setStepIndex(i) }), _jsxs(DialogDescription, { className: "pt-3", children: [t('common.step', { defaultValue: 'Paso' }), " ", stepIndex + 1, "/", steps.length, step?.title ? ` · ${tl(step.title)}` : ''] }), step?.description && (_jsx("p", { className: "pt-1 text-sm text-muted-foreground", children: tl(step.description) }))] })] }), _jsx("div", { className: "-mx-1 min-h-0 flex-1 overflow-y-auto px-1 py-4", children: _jsx(FieldGrid, { children: stepFields.map((field) => {
672
671
  const fullWidth = isLineItemsField(field) ||
673
672
  resolveWidget(field) === 'textarea' ||
674
673
  resolveWidget(field) === 'richtext';
@@ -718,7 +718,7 @@ export function DynamicRecordDialog({ open, onOpenChange, nestedInlineCreateSelf
718
718
  setStepIndex(Math.min(clampedStep + 1, groups.length - 1));
719
719
  };
720
720
  const goBackStep = () => setStepIndex(Math.max(clampedStep - 1, 0));
721
- return (_jsx(RecordDialogModelContext.Provider, { value: model, children: _jsx(Dialog, { open: open, onOpenChange: onOpenChange, nestedInlineCreateSelf: nestedInlineCreateSelf, children: _jsxs(DialogContent, { className: "sm:max-w-2xl max-h-[90dvh] flex flex-col p-0 gap-0 overflow-hidden", style: { maxHeight: '90dvh' }, children: [_jsxs(DialogHeader, { className: "p-6 pb-4 border-b shrink-0", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: config.description })] }), _jsx("div", { className: "flex-1 overflow-y-auto p-6", children: loading ? (_jsx(LoadingSkeleton, {})) : modalMeta ? (_jsx(ModelContext.Provider, { value: model, children: _jsx(ImageUrlContext.Provider, { value: getImageUrl, children: _jsx(TimeZoneContext.Provider, { value: timeZone, children: _jsxs(CurrencyContext.Provider, { value: currency, children: [_jsxs("form", { id: formId, onSubmit: handleSubmit, className: "grid gap-y-4", children: [isSteps && (_jsx(WizardProgress, { groups: groups, stepIndex: clampedStep })), (isSteps ? [groups[clampedStep]] : groups).map(group => (_jsx(FieldSection, { group: group, children: _jsx("div", { className: "grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2", children: renderFields(group.fields) }) }, group.key))), record?.external_url && (_jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2", children: _jsx("div", { className: "sm:col-span-2 min-w-0", children: _jsxs("a", { href: record.external_url, target: "_blank", rel: "noreferrer", className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline mt-1", children: [_jsx(ExternalLink, { className: "h-3.5 w-3.5" }), "Ver en ", record.external_provider ?? 'proveedor externo'] }) }) }))] }), !isCreate && record && relations.length > 0 && (_jsx("div", { className: "mt-6", children: _jsx(DynamicRelations, { record: record, relations: relations, lineSubtable: true, embedOnly: true, canCreate: mode === 'edit', canEdit: mode === 'edit', canDelete: mode === 'edit', onChange: handleChildChange }) }))] }) }) }) })) : null }), _jsxs(DialogFooter, { className: "p-4 border-t shrink-0 sm:justify-between", children: [isView && onOpenFullPage ? (_jsxs(Button, { variant: "ghost", size: "sm", className: "text-muted-foreground", onClick: () => { onOpenChange(false); onOpenFullPage(); }, children: [_jsx(ExternalLink, { className: "mr-1.5 h-3.5 w-3.5" }), "Ver p\u00E1gina completa"] })) : _jsx("span", {}), _jsxs("div", { className: "flex items-center gap-2", children: [isSteps && clampedStep > 0 ? (_jsx(Button, { variant: "outline", onClick: goBackStep, disabled: saving || deleting, children: "Anterior" })) : (_jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), disabled: saving || deleting, children: config.cancelLabel })), isView && onDelete && (_jsxs(Button, { variant: "destructive", onClick: handleDelete, disabled: deleting || loading, children: [deleting && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), deleting ? 'Eliminando...' : 'Eliminar'] })), isView && onEdit && (_jsx(Button, { onClick: onEdit, disabled: deleting || loading, children: "Editar" })), isEditable && isSteps && !isLastStep && (_jsx(Button, { type: "button", onClick: goNextStep, disabled: saving || loading, children: "Siguiente" })), isEditable && (!isSteps || isLastStep) && (_jsxs(Button, { type: "submit", form: formId, disabled: saving || loading, children: [saving && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), saving ? config.submittingLabel : config.submitLabel] }))] })] })] }) }) }));
721
+ return (_jsx(RecordDialogModelContext.Provider, { value: model, children: _jsx(Dialog, { open: open, onOpenChange: onOpenChange, nestedInlineCreateSelf: nestedInlineCreateSelf, children: _jsxs(DialogContent, { className: "sm:max-w-2xl max-h-[90dvh] flex flex-col p-0 gap-0 overflow-hidden", style: { maxHeight: '90dvh' }, children: [_jsxs(DialogHeader, { className: "p-6 pb-4 border-b shrink-0", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: config.description })] }), _jsx("div", { className: "flex-1 overflow-y-auto p-6", children: loading ? (_jsx(LoadingSkeleton, {})) : modalMeta ? (_jsx(ModelContext.Provider, { value: model, children: _jsx(ImageUrlContext.Provider, { value: getImageUrl, children: _jsx(TimeZoneContext.Provider, { value: timeZone, children: _jsxs(CurrencyContext.Provider, { value: currency, children: [_jsxs("form", { id: formId, onSubmit: handleSubmit, className: "grid gap-y-4", children: [isSteps && (_jsx(WizardProgress, { groups: groups, stepIndex: clampedStep, onStepClick: i => setStepIndex(i) })), (isSteps ? [groups[clampedStep]] : groups).map(group => (_jsx(FieldSection, { group: group, children: _jsx("div", { className: "grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2", children: renderFields(group.fields) }) }, group.key))), record?.external_url && (_jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2", children: _jsx("div", { className: "sm:col-span-2 min-w-0", children: _jsxs("a", { href: record.external_url, target: "_blank", rel: "noreferrer", className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline mt-1", children: [_jsx(ExternalLink, { className: "h-3.5 w-3.5" }), "Ver en ", record.external_provider ?? 'proveedor externo'] }) }) }))] }), !isCreate && record && relations.length > 0 && (_jsx("div", { className: "mt-6", children: _jsx(DynamicRelations, { record: record, relations: relations, lineSubtable: true, embedOnly: true, canCreate: mode === 'edit', canEdit: mode === 'edit', canDelete: mode === 'edit', onChange: handleChildChange }) }))] }) }) }) })) : null }), _jsxs(DialogFooter, { className: "p-4 border-t shrink-0 sm:justify-between", children: [isView && onOpenFullPage ? (_jsxs(Button, { variant: "ghost", size: "sm", className: "text-muted-foreground", onClick: () => { onOpenChange(false); onOpenFullPage(); }, children: [_jsx(ExternalLink, { className: "mr-1.5 h-3.5 w-3.5" }), "Ver p\u00E1gina completa"] })) : _jsx("span", {}), _jsxs("div", { className: "flex items-center gap-2", children: [isSteps && clampedStep > 0 ? (_jsx(Button, { variant: "outline", onClick: goBackStep, disabled: saving || deleting, children: "Anterior" })) : (_jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), disabled: saving || deleting, children: config.cancelLabel })), isView && onDelete && (_jsxs(Button, { variant: "destructive", onClick: handleDelete, disabled: deleting || loading, children: [deleting && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), deleting ? 'Eliminando...' : 'Eliminar'] })), isView && onEdit && (_jsx(Button, { onClick: onEdit, disabled: deleting || loading, children: "Editar" })), isEditable && isSteps && !isLastStep && (_jsx(Button, { type: "button", onClick: goNextStep, disabled: saving || loading, children: "Siguiente" })), isEditable && (!isSteps || isLastStep) && (_jsxs(Button, { type: "submit", form: formId, disabled: saving || loading, children: [saving && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), saving ? config.submittingLabel : config.submitLabel] }))] })] })] }) }) }));
722
722
  }
723
723
  function LoadingSkeleton() {
724
724
  return (_jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-4", children: Array.from({ length: 6 }).map((_, i) => (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx(Skeleton, { className: "h-3.5 w-24" }), _jsx(Skeleton, { className: "h-9 w-full" })] }, i))) }));
@@ -132,7 +132,7 @@ export function DynamicForm({ fields, initialValues, onSubmit, onCancel, submitL
132
132
  setStepIndex((i) => Math.min(i + 1, groups.length - 1));
133
133
  };
134
134
  const goBack = () => setStepIndex((i) => Math.max(i - 1, 0));
135
- return (_jsxs("form", { onSubmit: handleSubmit, className: "grid gap-4", children: [_jsx(WizardProgress, { groups: groups, stepIndex: stepIndex }), renderGrid(step.fields), _jsxs("div", { className: "flex justify-between gap-2 pt-2", children: [stepIndex > 0 ? (_jsx(Button, { type: "button", variant: "outline", onClick: goBack, disabled: submitting || disabled, children: "Anterior" })) : onCancel ? (_jsx(Button, { type: "button", variant: "outline", onClick: onCancel, disabled: submitting || disabled, children: cancelLabel })) : (_jsx("span", {})), isLast ? (_jsx(Button, { type: "submit", disabled: submitting || disabled || balanceBlocked, children: submitLabel })) : (_jsx(Button, { type: "button", onClick: goNext, disabled: submitting || disabled, children: "Siguiente" }))] })] }));
135
+ return (_jsxs("form", { onSubmit: handleSubmit, className: "grid gap-4", children: [_jsx(WizardProgress, { groups: groups, stepIndex: stepIndex, onStepClick: i => setStepIndex(i) }), renderGrid(step.fields), _jsxs("div", { className: "flex justify-between gap-2 pt-2", children: [stepIndex > 0 ? (_jsx(Button, { type: "button", variant: "outline", onClick: goBack, disabled: submitting || disabled, children: "Anterior" })) : onCancel ? (_jsx(Button, { type: "button", variant: "outline", onClick: onCancel, disabled: submitting || disabled, children: cancelLabel })) : (_jsx("span", {})), isLast ? (_jsx(Button, { type: "submit", disabled: submitting || disabled || balanceBlocked, children: submitLabel })) : (_jsx(Button, { type: "button", onClick: goNext, disabled: submitting || disabled, children: "Siguiente" }))] })] }));
136
136
  }
137
137
  // ── Sections / flat mode ───────────────────────────────────────────────
138
138
  // Layout: scalar header fields flow through a responsive 2-column grid;
@@ -13,13 +13,17 @@ export declare function FieldSection({ group, children, }: {
13
13
  children: React.ReactNode;
14
14
  }): import("react").JSX.Element;
15
15
  /**
16
- * Progress bar for `mode: "steps"`: one filled segment per completed/current
17
- * step plus a "Paso i/n · <title>" caption. Mirrors the WizardActionModal look
18
- * so a model wizard and an action wizard read the same.
16
+ * Step indicator for `mode: "steps"`: the platform's ProcessStepper (numbered
17
+ * circles with a check when done, label underneath, connectors) plus a
18
+ * "Paso i/n · <title>" caption and the step's description. Same component the
19
+ * process modals (workshop, warehouse) use, so a model wizard, an action wizard
20
+ * and a process modal read the same.
19
21
  */
20
- export declare function WizardProgress({ groups, stepIndex, stepLabel, }: {
22
+ export declare function WizardProgress({ groups, stepIndex, stepLabel, onStepClick, }: {
21
23
  groups: FieldGroup<unknown>[];
22
24
  stepIndex: number;
23
25
  stepLabel?: string;
26
+ /** Jump back to an already completed step (forward jumps are never offered). */
27
+ onStepClick?: (index: number) => void;
24
28
  }): import("react").JSX.Element;
25
29
  //# sourceMappingURL=form-layout-ui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-layout-ui.d.ts","sourceRoot":"","sources":["../src/form-layout-ui.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EACzB,KAAK,EACL,QAAQ,GACX,EAAE;IACC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B,+BA6CA;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC3B,MAAM,EACN,SAAS,EACT,SAAkB,GACrB,EAAE;IACC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,CAAA;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,+BA2BA"}
1
+ {"version":3,"file":"form-layout-ui.d.ts","sourceRoot":"","sources":["../src/form-layout-ui.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,EACzB,KAAK,EACL,QAAQ,GACX,EAAE;IACC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B,+BA6CA;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC3B,MAAM,EACN,SAAS,EACT,SAAkB,EAClB,WAAW,GACd,EAAE;IACC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,CAAA;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gFAAgF;IAChF,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC,+BAeA"}
@@ -6,6 +6,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
6
6
  import { useState } from 'react';
7
7
  import { Collapsible, CollapsibleContent, CollapsibleTrigger, Button, } from '@asteby/metacore-ui/primitives';
8
8
  import { ChevronDown } from 'lucide-react';
9
+ import { ProcessStepper } from '@asteby/metacore-ui/wizard';
9
10
  /**
10
11
  * Section chrome for `mode: "sections"`. Wraps a group's (already gridded)
11
12
  * fields in a titled block.
@@ -27,13 +28,14 @@ export function FieldSection({ group, children, }) {
27
28
  return (_jsxs(Collapsible, { open: open, onOpenChange: setOpen, className: "grid gap-3", children: [_jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "ghost", className: "h-auto w-full justify-between px-0 py-1 hover:bg-transparent", children: [header, _jsx(ChevronDown, { className: 'h-4 w-4 shrink-0 transition-transform ' + (open ? 'rotate-180' : '') })] }) }), _jsx(CollapsibleContent, { className: "grid gap-3", children: children })] }));
28
29
  }
29
30
  /**
30
- * Progress bar for `mode: "steps"`: one filled segment per completed/current
31
- * step plus a "Paso i/n · <title>" caption. Mirrors the WizardActionModal look
32
- * so a model wizard and an action wizard read the same.
31
+ * Step indicator for `mode: "steps"`: the platform's ProcessStepper (numbered
32
+ * circles with a check when done, label underneath, connectors) plus a
33
+ * "Paso i/n · <title>" caption and the step's description. Same component the
34
+ * process modals (workshop, warehouse) use, so a model wizard, an action wizard
35
+ * and a process modal read the same.
33
36
  */
34
- export function WizardProgress({ groups, stepIndex, stepLabel = 'Paso', }) {
37
+ export function WizardProgress({ groups, stepIndex, stepLabel = 'Paso', onStepClick, }) {
35
38
  const current = groups[stepIndex];
36
- return (_jsxs("div", { className: "pt-2", children: [_jsx("div", { className: "flex items-center gap-1.5", role: "list", "aria-label": "progress", children: groups.map((g, i) => (_jsx("div", { role: "listitem", "aria-current": i === stepIndex ? 'step' : undefined, className: "h-1.5 flex-1 rounded-full", style: {
37
- backgroundColor: i <= stepIndex ? 'hsl(var(--primary))' : 'hsl(var(--muted))',
38
- } }, g.key))) }), _jsxs("p", { className: "pt-2 text-sm text-muted-foreground", children: [stepLabel, " ", stepIndex + 1, "/", groups.length, current?.title ? ` · ${current.title}` : ''] }), current?.description && (_jsx("p", { className: "pt-1 text-sm text-muted-foreground", children: current.description }))] }));
39
+ const steps = groups.map((g, i) => ({ key: g.key, label: g.title ?? `${stepLabel} ${i + 1}` }));
40
+ return (_jsxs("div", { className: "pt-1", children: [_jsx(ProcessStepper, { steps: steps, activeIndex: stepIndex, onStepClick: onStepClick }), _jsxs("p", { className: "pt-3 text-sm text-muted-foreground", children: [stepLabel, " ", stepIndex + 1, "/", groups.length, current?.title ? ` · ${current.title}` : ''] }), current?.description && (_jsx("p", { className: "pt-1 text-sm text-muted-foreground", children: current.description }))] }));
39
41
  }
@@ -24,7 +24,18 @@ export declare function isImageUrl(url: string): boolean;
24
24
  export declare function isFileUrl(url: string): boolean;
25
25
  /** Classify a URL so the right primitive (thumbnail / file chip / link) renders. */
26
26
  export declare function classifyUrl(url: string): UrlKind;
27
- /** Ensure a URL is absolute so `<a href>` and `new URL()` behave. */
27
+ /**
28
+ * Ensure a URL is safe to drop into `<a href>` / `new URL(..., base)`.
29
+ *
30
+ * Three shapes pass through unchanged: fully qualified (`http(s)://…`),
31
+ * protocol-relative (`//…`), and — the platform's own convention for every
32
+ * locally-served asset (uploads, hub-generated images, printable documents:
33
+ * see handlers.UploadFile, hub_image_provider_bridge.go, …) — ROOT-RELATIVE
34
+ * (`/storage/…`). A root-relative path already resolves correctly against
35
+ * the current origin; treating it as a bare host (the old behavior) produced
36
+ * "https:///storage/…" (scheme + empty host), a broken link. Anything else
37
+ * (`github.com/foo`) is assumed to be a bare host missing its scheme.
38
+ */
28
39
  export declare function ensureHref(url: string): string;
29
40
  /**
30
41
  * A short, human label for a URL. For a file-like URL (last segment carries an
@@ -58,10 +69,11 @@ export declare const FileChip: React.FC<{
58
69
  className?: string;
59
70
  }>;
60
71
  /**
61
- * Inline image thumbnail — rounded, bordered, `object-cover` — that opens the
62
- * full image in a new tab. On load error it degrades to a normal link chip so a
63
- * dead image URL is still reachable (and never a broken-image icon). `maxHeight`
64
- * keeps a cell thumbnail small (~h-8) while the dialog shows a larger preview.
72
+ * Inline image thumbnail — rounded, bordered, `object-cover` — that opens a
73
+ * full-size PREVIEW (a lightbox dialog, not a new tab). On load error it
74
+ * degrades to a normal link chip so a dead image URL is still reachable (and
75
+ * never a broken-image icon). `maxHeight` keeps a cell thumbnail small
76
+ * (~h-8) while the dialog shows a larger preview.
65
77
  */
66
78
  export declare const ImageThumbnail: React.FC<{
67
79
  url: string;
@@ -1 +1 @@
1
- {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as _Fragment } from "react/jsx-run
19
19
  */
20
20
  import React from 'react';
21
21
  import { cn } from '@asteby/metacore-ui/lib';
22
+ import { Dialog, DialogContent, DialogTitle } from '@asteby/metacore-ui/primitives';
22
23
  import { DynamicIcon } from './dynamic-icon';
23
24
  /** Image file extensions we render as an inline thumbnail. */
24
25
  const IMAGE_EXT_RE = /\.(jpe?g|png|gif|webp|avif|svg|bmp|ico)(?:[?#].*)?$/i;
@@ -46,9 +47,22 @@ export function classifyUrl(url) {
46
47
  return 'file';
47
48
  return 'link';
48
49
  }
49
- /** Ensure a URL is absolute so `<a href>` and `new URL()` behave. */
50
+ /**
51
+ * Ensure a URL is safe to drop into `<a href>` / `new URL(..., base)`.
52
+ *
53
+ * Three shapes pass through unchanged: fully qualified (`http(s)://…`),
54
+ * protocol-relative (`//…`), and — the platform's own convention for every
55
+ * locally-served asset (uploads, hub-generated images, printable documents:
56
+ * see handlers.UploadFile, hub_image_provider_bridge.go, …) — ROOT-RELATIVE
57
+ * (`/storage/…`). A root-relative path already resolves correctly against
58
+ * the current origin; treating it as a bare host (the old behavior) produced
59
+ * "https:///storage/…" (scheme + empty host), a broken link. Anything else
60
+ * (`github.com/foo`) is assumed to be a bare host missing its scheme.
61
+ */
50
62
  export function ensureHref(url) {
51
- return /^(https?:)?\/\//i.test(url) || /^(mailto|tel):/i.test(url)
63
+ return /^(https?:)?\/\//i.test(url) ||
64
+ /^(mailto|tel):/i.test(url) ||
65
+ url.startsWith('/')
52
66
  ? url
53
67
  : `https://${url}`;
54
68
  }
@@ -106,20 +120,39 @@ export const FileChip = ({ url, maxLabelWidth = 240, className }) => {
106
120
  return (_jsxs("a", { href: href, target: "_blank", rel: "noopener noreferrer", title: url, onClick: stop, className: cn('inline-flex max-w-full items-center gap-1.5 rounded-md border bg-muted/40 px-2 py-1 align-middle text-sm font-medium text-foreground hover:bg-muted', className), children: [_jsx(DynamicIcon, { name: "FileText", className: "h-3.5 w-3.5 shrink-0 opacity-70" }), _jsx("span", { className: "truncate", style: { maxWidth: maxLabelWidth }, children: fileNameFromUrl(url) })] }));
107
121
  };
108
122
  /**
109
- * Inline image thumbnail — rounded, bordered, `object-cover` — that opens the
110
- * full image in a new tab. On load error it degrades to a normal link chip so a
111
- * dead image URL is still reachable (and never a broken-image icon). `maxHeight`
112
- * keeps a cell thumbnail small (~h-8) while the dialog shows a larger preview.
123
+ * Full-size image preview — a Dialog overlay, not a new tab. Click-to-zoom is
124
+ * the platform-wide behavior for every inline thumbnail (table cell, detail
125
+ * dialog, linkified free text): the caller never builds its own lightbox.
126
+ * Download / "open original" stays one click away in the footer for the rare
127
+ * case someone wants the raw file.
128
+ */
129
+ const ImageLightbox = ({ src, alt, open, onOpenChange }) => (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "max-w-[min(92vw,1100px)] max-h-[92dvh] p-2 overflow-hidden border-0 bg-transparent shadow-none flex items-center justify-center", onClick: stop, children: [_jsx(DialogTitle, { className: "sr-only", children: alt }), _jsx("img", { src: src, alt: alt, className: "max-h-[86dvh] max-w-full rounded-lg object-contain shadow-2xl" })] }) }));
130
+ /**
131
+ * Inline image thumbnail — rounded, bordered, `object-cover` — that opens a
132
+ * full-size PREVIEW (a lightbox dialog, not a new tab). On load error it
133
+ * degrades to a normal link chip so a dead image URL is still reachable (and
134
+ * never a broken-image icon). `maxHeight` keeps a cell thumbnail small
135
+ * (~h-8) while the dialog shows a larger preview.
113
136
  */
114
137
  export const ImageThumbnail = ({ url, getImageUrl, maxHeight = 160, className }) => {
115
138
  const [failed, setFailed] = React.useState(false);
116
- const href = ensureHref(url);
139
+ const [open, setOpen] = React.useState(false);
117
140
  // Absolute URLs are used verbatim; only relative storage paths go through
118
- // the host's image resolver (which prefixes the media base).
119
- const src = /^(https?:)?\/\//i.test(url) ? url : getImageUrl ? getImageUrl(url) : url;
141
+ // the host's image resolver (which prefixes the media base). Anything
142
+ // that opens the raw file (download, the lightbox <img>) MUST resolve the
143
+ // same way — otherwise a relative "/storage/…" path (the platform's own
144
+ // convention: uploads, hub-generated assets, etc.) never matches
145
+ // ensureHref's "//"-prefixed check and gets misread as a bare host,
146
+ // producing "https:///storage/…".
147
+ const isAbsolute = /^(https?:)?\/\//i.test(url);
148
+ const src = isAbsolute ? url : getImageUrl ? getImageUrl(url) : url;
149
+ const label = smartUrlLabel(url);
120
150
  if (failed)
121
151
  return _jsx(UrlChip, { url: url, icon: "Image" });
122
- return (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", title: url, onClick: stop, className: "inline-block max-w-full align-middle", children: _jsx("img", { src: src, alt: smartUrlLabel(url), onError: () => setFailed(true), style: { maxHeight }, className: cn('max-w-full rounded-md border object-cover', className) }) }));
152
+ return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", title: label, onClick: (e) => {
153
+ stop(e);
154
+ setOpen(true);
155
+ }, className: "inline-block max-w-full cursor-zoom-in appearance-none border-0 bg-transparent p-0 align-middle", children: _jsx("img", { src: src, alt: label, onError: () => setFailed(true), style: { maxHeight }, className: cn('max-w-full rounded-md border object-cover', className) }) }), _jsx(ImageLightbox, { src: src, alt: label, open: open, onOpenChange: setOpen })] }));
123
156
  };
124
157
  /**
125
158
  * One URL value → the right primitive (thumbnail / file chip / link chip).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteby/metacore-runtime-react",
3
- "version": "37.5.1",
3
+ "version": "38.0.0",
4
4
  "description": "React runtime for metacore hosts — renders addon contributions dynamically",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  "sonner": ">=1.7",
39
39
  "zustand": ">=5",
40
40
  "@asteby/metacore-sdk": "^3.7.0",
41
- "@asteby/metacore-ui": "^2.17.3"
41
+ "@asteby/metacore-ui": "^2.18.0"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "@tanstack/react-router": {
@@ -68,7 +68,7 @@
68
68
  "vitest": "^4.0.0",
69
69
  "zustand": "^5.0.0",
70
70
  "@asteby/metacore-sdk": "3.7.0",
71
- "@asteby/metacore-ui": "2.17.3"
71
+ "@asteby/metacore-ui": "2.18.0"
72
72
  },
73
73
  "scripts": {
74
74
  "build": "tsc -p tsconfig.json",
@@ -86,6 +86,17 @@ describe('smartUrlLabel / fileNameFromUrl / ensureHref', () => {
86
86
  expect(ensureHref('https://a.com')).toBe('https://a.com')
87
87
  expect(ensureHref('mailto:a@b.com')).toBe('mailto:a@b.com')
88
88
  })
89
+
90
+ it('leaves a root-relative storage path unchanged (never "https:///…")', () => {
91
+ // The platform's own convention for every locally-served asset —
92
+ // uploads, hub-generated images (hub_image_provider_bridge.go),
93
+ // printable documents. Regression for the bug where this produced
94
+ // "https:///storage/…" (scheme + empty host, a dead link).
95
+ expect(ensureHref('/storage/hub-generations/x.png')).toBe(
96
+ '/storage/hub-generations/x.png'
97
+ )
98
+ expect(ensureHref('//cdn.example.com/x.png')).toBe('//cdn.example.com/x.png')
99
+ })
89
100
  })
90
101
 
91
102
  describe('splitTrailingPunct', () => {
@@ -173,6 +184,30 @@ describe('primitives render', () => {
173
184
  expect(screen.queryByRole('link')).toBeTruthy()
174
185
  })
175
186
 
187
+ it('ImageThumbnail resolves a relative storage path through getImageUrl', () => {
188
+ const getImageUrl = (path: string) => `http://api.local${path}`
189
+ const { container } = render(
190
+ <ImageThumbnail
191
+ url="/storage/hub-generations/x.png"
192
+ getImageUrl={getImageUrl}
193
+ />
194
+ )
195
+ const img = container.querySelector('img') as HTMLImageElement
196
+ // Regression: this used to leak into an <a href> built by ensureHref
197
+ // as "https:///storage/hub-generations/x.png" (bare-host misread of a
198
+ // relative path). There's no <a> anymore — a click opens the lightbox.
199
+ expect(img.getAttribute('src')).toBe('http://api.local/storage/hub-generations/x.png')
200
+ })
201
+
202
+ it('ImageThumbnail opens a lightbox preview on click instead of navigating', () => {
203
+ render(<ImageThumbnail url="https://cdn.x/photo.png" />)
204
+ expect(screen.queryByRole('dialog')).toBeFalsy()
205
+ fireEvent.click(screen.getByRole('button'))
206
+ const dialog = screen.getByRole('dialog')
207
+ expect(dialog).toBeTruthy()
208
+ expect(dialog.querySelector('img')?.getAttribute('src')).toBe('https://cdn.x/photo.png')
209
+ })
210
+
176
211
  it('MediaValue dispatches by kind', () => {
177
212
  const { rerender, container } = render(
178
213
  <MediaValue url="https://cdn.x/a.png" />
@@ -38,6 +38,7 @@ import {
38
38
  Switch,
39
39
  } from '@asteby/metacore-ui/primitives'
40
40
  import { Loader2 } from 'lucide-react'
41
+ import { ProcessStepper } from '@asteby/metacore-ui/wizard'
41
42
  import { toast } from 'sonner'
42
43
  import { toastServerError, toastServerSuccess, extractFieldErrors, localizeFieldErrorMap } from './server-error'
43
44
  import { useBranchCreateGate } from './branch-create-gate'
@@ -994,26 +995,16 @@ function WizardActionModal({ open, onOpenChange, action, model, record, endpoint
994
995
  <DynamicIcon name={action.icon} className="h-5 w-5" />
995
996
  {tl(action.label)}
996
997
  </DialogTitle>
997
- {/* Progress/step bar: one segment per step. The current and
998
- completed segments are filled; a numbered marker + the
999
- current step's title tell the user where they are. Inline
1000
- styles for the fill color guarantee it shows even if the
1001
- host's Tailwind scan drops an arbitrary class. */}
1002
- <div className="pt-2">
1003
- <div className="flex items-center gap-1.5" role="list" aria-label="progress">
1004
- {steps.map((s, i) => (
1005
- <div
1006
- key={i}
1007
- role="listitem"
1008
- aria-current={i === stepIndex ? 'step' : undefined}
1009
- className="h-1.5 flex-1 rounded-full"
1010
- style={{
1011
- backgroundColor: i <= stepIndex ? (action.color || 'hsl(var(--primary))') : 'hsl(var(--muted))',
1012
- }}
1013
- />
1014
- ))}
1015
- </div>
1016
- <DialogDescription className="pt-2">
998
+ {/* Step indicator: the platform ProcessStepper (same as the
999
+ declarative form_layout wizards and the process modals) +
1000
+ "Paso i/n · título" and the step's description. */}
1001
+ <div className="pt-1">
1002
+ <ProcessStepper
1003
+ steps={steps.map((s, i) => ({ key: String(i), label: s.title ? tl(s.title) : `${t('common.step', { defaultValue: 'Paso' })} ${i + 1}` }))}
1004
+ activeIndex={stepIndex}
1005
+ onStepClick={i => setStepIndex(i)}
1006
+ />
1007
+ <DialogDescription className="pt-3">
1017
1008
  {t('common.step', { defaultValue: 'Paso' })} {stepIndex + 1}/{steps.length}
1018
1009
  {step?.title ? ` · ${tl(step.title)}` : ''}
1019
1010
  </DialogDescription>
@@ -1080,7 +1080,7 @@ export function DynamicRecordDialog({
1080
1080
  className="grid gap-y-4"
1081
1081
  >
1082
1082
  {isSteps && (
1083
- <WizardProgress groups={groups} stepIndex={clampedStep} />
1083
+ <WizardProgress groups={groups} stepIndex={clampedStep} onStepClick={i => setStepIndex(i)} />
1084
1084
  )}
1085
1085
  {(isSteps ? [groups[clampedStep]] : groups).map(group => (
1086
1086
  <FieldSection key={group.key} group={group}>
@@ -211,7 +211,7 @@ export function DynamicForm({
211
211
 
212
212
  return (
213
213
  <form onSubmit={handleSubmit} className="grid gap-4">
214
- <WizardProgress groups={groups} stepIndex={stepIndex} />
214
+ <WizardProgress groups={groups} stepIndex={stepIndex} onStepClick={i => setStepIndex(i)} />
215
215
  {renderGrid(step.fields)}
216
216
  <div className="flex justify-between gap-2 pt-2">
217
217
  {stepIndex > 0 ? (
@@ -10,6 +10,7 @@ import {
10
10
  Button,
11
11
  } from '@asteby/metacore-ui/primitives'
12
12
  import { ChevronDown } from 'lucide-react'
13
+ import { ProcessStepper } from '@asteby/metacore-ui/wizard'
13
14
  import type { FieldGroup } from './form-layout'
14
15
 
15
16
  /**
@@ -75,37 +76,30 @@ export function FieldSection({
75
76
  }
76
77
 
77
78
  /**
78
- * Progress bar for `mode: "steps"`: one filled segment per completed/current
79
- * step plus a "Paso i/n · <title>" caption. Mirrors the WizardActionModal look
80
- * so a model wizard and an action wizard read the same.
79
+ * Step indicator for `mode: "steps"`: the platform's ProcessStepper (numbered
80
+ * circles with a check when done, label underneath, connectors) plus a
81
+ * "Paso i/n · <title>" caption and the step's description. Same component the
82
+ * process modals (workshop, warehouse) use, so a model wizard, an action wizard
83
+ * and a process modal read the same.
81
84
  */
82
85
  export function WizardProgress({
83
86
  groups,
84
87
  stepIndex,
85
88
  stepLabel = 'Paso',
89
+ onStepClick,
86
90
  }: {
87
91
  groups: FieldGroup<unknown>[]
88
92
  stepIndex: number
89
93
  stepLabel?: string
94
+ /** Jump back to an already completed step (forward jumps are never offered). */
95
+ onStepClick?: (index: number) => void
90
96
  }) {
91
97
  const current = groups[stepIndex]
98
+ const steps = groups.map((g, i) => ({ key: g.key, label: g.title ?? `${stepLabel} ${i + 1}` }))
92
99
  return (
93
- <div className="pt-2">
94
- <div className="flex items-center gap-1.5" role="list" aria-label="progress">
95
- {groups.map((g, i) => (
96
- <div
97
- key={g.key}
98
- role="listitem"
99
- aria-current={i === stepIndex ? 'step' : undefined}
100
- className="h-1.5 flex-1 rounded-full"
101
- style={{
102
- backgroundColor:
103
- i <= stepIndex ? 'hsl(var(--primary))' : 'hsl(var(--muted))',
104
- }}
105
- />
106
- ))}
107
- </div>
108
- <p className="pt-2 text-sm text-muted-foreground">
100
+ <div className="pt-1">
101
+ <ProcessStepper steps={steps} activeIndex={stepIndex} onStepClick={onStepClick} />
102
+ <p className="pt-3 text-sm text-muted-foreground">
109
103
  {stepLabel} {stepIndex + 1}/{groups.length}
110
104
  {current?.title ? ` · ${current.title}` : ''}
111
105
  </p>
package/src/rich-url.tsx CHANGED
@@ -18,6 +18,7 @@
18
18
  */
19
19
  import React from 'react'
20
20
  import { cn } from '@asteby/metacore-ui/lib'
21
+ import { Dialog, DialogContent, DialogTitle } from '@asteby/metacore-ui/primitives'
21
22
  import { DynamicIcon } from './dynamic-icon'
22
23
 
23
24
  /** Image file extensions we render as an inline thumbnail. */
@@ -53,9 +54,22 @@ export function classifyUrl(url: string): UrlKind {
53
54
  return 'link'
54
55
  }
55
56
 
56
- /** Ensure a URL is absolute so `<a href>` and `new URL()` behave. */
57
+ /**
58
+ * Ensure a URL is safe to drop into `<a href>` / `new URL(..., base)`.
59
+ *
60
+ * Three shapes pass through unchanged: fully qualified (`http(s)://…`),
61
+ * protocol-relative (`//…`), and — the platform's own convention for every
62
+ * locally-served asset (uploads, hub-generated images, printable documents:
63
+ * see handlers.UploadFile, hub_image_provider_bridge.go, …) — ROOT-RELATIVE
64
+ * (`/storage/…`). A root-relative path already resolves correctly against
65
+ * the current origin; treating it as a bare host (the old behavior) produced
66
+ * "https:///storage/…" (scheme + empty host), a broken link. Anything else
67
+ * (`github.com/foo`) is assumed to be a bare host missing its scheme.
68
+ */
57
69
  export function ensureHref(url: string): string {
58
- return /^(https?:)?\/\//i.test(url) || /^(mailto|tel):/i.test(url)
70
+ return /^(https?:)?\/\//i.test(url) ||
71
+ /^(mailto|tel):/i.test(url) ||
72
+ url.startsWith('/')
59
73
  ? url
60
74
  : `https://${url}`
61
75
  }
@@ -162,10 +176,39 @@ export const FileChip: React.FC<{
162
176
  }
163
177
 
164
178
  /**
165
- * Inline image thumbnail — rounded, bordered, `object-cover` — that opens the
166
- * full image in a new tab. On load error it degrades to a normal link chip so a
167
- * dead image URL is still reachable (and never a broken-image icon). `maxHeight`
168
- * keeps a cell thumbnail small (~h-8) while the dialog shows a larger preview.
179
+ * Full-size image preview — a Dialog overlay, not a new tab. Click-to-zoom is
180
+ * the platform-wide behavior for every inline thumbnail (table cell, detail
181
+ * dialog, linkified free text): the caller never builds its own lightbox.
182
+ * Download / "open original" stays one click away in the footer for the rare
183
+ * case someone wants the raw file.
184
+ */
185
+ const ImageLightbox: React.FC<{
186
+ src: string
187
+ alt: string
188
+ open: boolean
189
+ onOpenChange: (open: boolean) => void
190
+ }> = ({ src, alt, open, onOpenChange }) => (
191
+ <Dialog open={open} onOpenChange={onOpenChange}>
192
+ <DialogContent
193
+ className="max-w-[min(92vw,1100px)] max-h-[92dvh] p-2 overflow-hidden border-0 bg-transparent shadow-none flex items-center justify-center"
194
+ onClick={stop}
195
+ >
196
+ <DialogTitle className="sr-only">{alt}</DialogTitle>
197
+ <img
198
+ src={src}
199
+ alt={alt}
200
+ className="max-h-[86dvh] max-w-full rounded-lg object-contain shadow-2xl"
201
+ />
202
+ </DialogContent>
203
+ </Dialog>
204
+ )
205
+
206
+ /**
207
+ * Inline image thumbnail — rounded, bordered, `object-cover` — that opens a
208
+ * full-size PREVIEW (a lightbox dialog, not a new tab). On load error it
209
+ * degrades to a normal link chip so a dead image URL is still reachable (and
210
+ * never a broken-image icon). `maxHeight` keeps a cell thumbnail small
211
+ * (~h-8) while the dialog shows a larger preview.
169
212
  */
170
213
  export const ImageThumbnail: React.FC<{
171
214
  url: string
@@ -175,32 +218,42 @@ export const ImageThumbnail: React.FC<{
175
218
  className?: string
176
219
  }> = ({ url, getImageUrl, maxHeight = 160, className }) => {
177
220
  const [failed, setFailed] = React.useState(false)
178
- const href = ensureHref(url)
221
+ const [open, setOpen] = React.useState(false)
179
222
  // Absolute URLs are used verbatim; only relative storage paths go through
180
- // the host's image resolver (which prefixes the media base).
181
- const src =
182
- /^(https?:)?\/\//i.test(url) ? url : getImageUrl ? getImageUrl(url) : url
223
+ // the host's image resolver (which prefixes the media base). Anything
224
+ // that opens the raw file (download, the lightbox <img>) MUST resolve the
225
+ // same way — otherwise a relative "/storage/…" path (the platform's own
226
+ // convention: uploads, hub-generated assets, etc.) never matches
227
+ // ensureHref's "//"-prefixed check and gets misread as a bare host,
228
+ // producing "https:///storage/…".
229
+ const isAbsolute = /^(https?:)?\/\//i.test(url)
230
+ const src = isAbsolute ? url : getImageUrl ? getImageUrl(url) : url
231
+ const label = smartUrlLabel(url)
183
232
  if (failed) return <UrlChip url={url} icon="Image" />
184
233
  return (
185
- <a
186
- href={href}
187
- target="_blank"
188
- rel="noopener noreferrer"
189
- title={url}
190
- onClick={stop}
191
- className="inline-block max-w-full align-middle"
192
- >
193
- <img
194
- src={src}
195
- alt={smartUrlLabel(url)}
196
- onError={() => setFailed(true)}
197
- style={{ maxHeight }}
198
- className={cn(
199
- 'max-w-full rounded-md border object-cover',
200
- className
201
- )}
202
- />
203
- </a>
234
+ <>
235
+ <button
236
+ type="button"
237
+ title={label}
238
+ onClick={(e) => {
239
+ stop(e)
240
+ setOpen(true)
241
+ }}
242
+ className="inline-block max-w-full cursor-zoom-in appearance-none border-0 bg-transparent p-0 align-middle"
243
+ >
244
+ <img
245
+ src={src}
246
+ alt={label}
247
+ onError={() => setFailed(true)}
248
+ style={{ maxHeight }}
249
+ className={cn(
250
+ 'max-w-full rounded-md border object-cover',
251
+ className
252
+ )}
253
+ />
254
+ </button>
255
+ <ImageLightbox src={src} alt={label} open={open} onOpenChange={setOpen} />
256
+ </>
204
257
  )
205
258
  }
206
259