@medway-ui/core 1.38.1 → 1.39.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/COMPONENTS.md +1 -1
- package/COMPONENTS_SUMMARY.md +1 -1
- package/dist/COMPONENTS.md +1 -1
- package/dist/COMPONENTS_SUMMARY.md +1 -1
- package/dist/components/Dialog.d.ts +2 -2
- package/dist/components/Dialog.js +1 -1
- package/dist/components/Dialog.mjs +1 -1
- package/dist/components/NoteEditorLinkDialog.mjs +1 -1
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @medway-ui/core — Component Reference
|
|
2
2
|
|
|
3
3
|
> **Auto-generated — do not edit manually.**
|
|
4
|
-
> Package `@medway-ui/core` · v1.
|
|
4
|
+
> Package `@medway-ui/core` · v1.39.0 · Generated 2026-10-29
|
|
5
5
|
|
|
6
6
|
All components require React 18+ and are client components (`"use client"`).
|
|
7
7
|
|
package/COMPONENTS_SUMMARY.md
CHANGED
package/dist/COMPONENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @medway-ui/core — Component Reference
|
|
2
2
|
|
|
3
3
|
> **Auto-generated — do not edit manually.**
|
|
4
|
-
> Package `@medway-ui/core` · v1.
|
|
4
|
+
> Package `@medway-ui/core` · v1.39.0 · Generated 2026-10-29
|
|
5
5
|
|
|
6
6
|
All components require React 18+ and are client components (`"use client"`).
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
2
2
|
import { type ComponentProps, type ReactNode } from "react";
|
|
3
|
-
declare function Dialog({ ...props }: ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function Dialog({ open: openProp, defaultOpen, onOpenChange, ...props }: ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const DialogTrigger: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare function DialogPortal({ ...props }: ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare const DialogClose: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -10,7 +10,7 @@ interface DialogContainerProps extends ComponentProps<typeof DialogPrimitive.Con
|
|
|
10
10
|
overlayClassName?: string;
|
|
11
11
|
closeLabel?: string;
|
|
12
12
|
}
|
|
13
|
-
declare function DialogContainer({ className, overlayClassName, children, showCloseButton, closeLabel, ...props }: DialogContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DialogContainer({ className, overlayClassName, children, showCloseButton, closeLabel, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, ...props }: DialogContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
interface DialogContentProps extends ComponentProps<"div"> {
|
|
15
15
|
containerClassName?: string;
|
|
16
16
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var
|
|
3
|
+
"use strict";var r=require("react/jsx-runtime"),f=require("radix-ui"),d=require("react"),C=require("./Dismiss.js"),D=require("./Separator.js"),c=require("../lib/utils.js"),z=Object.defineProperty,q=Object.defineProperties,M=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,y=(t,e,a)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,m=(t,e)=>{for(var a in e||(e={}))N.call(e,a)&&y(t,a,e[a]);if(P)for(var a of P(e))j.call(e,a)&&y(t,a,e[a]);return t},w=(t,e)=>q(t,M(e)),p=(t,e)=>{var a={};for(var o in t)N.call(t,o)&&e.indexOf(o)<0&&(a[o]=t[o]);if(t!=null&&P)for(var o of P(t))e.indexOf(o)<0&&j.call(t,o)&&(a[o]=t[o]);return a};const R=40,k=.25,U=.5,Y=16,E="button, a, input, select, textarea, label, [role='button'], [contenteditable='true']",O=d.createContext(!1),I=d.createContext(()=>{});function F(t){var e=t,{open:a,defaultOpen:o=!1,onOpenChange:s}=e,n=p(e,["open","defaultOpen","onOpenChange"]);const l=a!==void 0,[i,u]=d.useState(o),h=l?a:i,g=d.useCallback(v=>{l||u(v),s==null||s(v)},[l,s]),x=d.useCallback(()=>g(!1),[g]);return r.jsx(I.Provider,{value:x,children:r.jsx(f.Dialog.Root,m({"data-slot":"dialog",open:h,onOpenChange:g},n))})}function b(t,e){return a=>{t==null||t(a),a.defaultPrevented||e(a)}}function L(t){const e=t.currentTarget,a=t.target,o=e.querySelector('[data-slot="dialog-handle"]');return t.button!==0||!(o!=null&&o.getClientRects().length)||a.closest('[data-slot="dialog-container"]')!==e||a.closest(E)?!1:t.clientY-e.getBoundingClientRect().top<=R||!!a.closest('[data-slot="dialog-header"]')}function $(t){const e=d.useRef(null),a=n=>{if(!L(n))return;const l=n.currentTarget;l.setPointerCapture(n.pointerId),l.dataset.dragging="",e.current={pointerId:n.pointerId,startY:n.clientY,startTime:n.timeStamp,offset:0}},o=n=>{const l=e.current;(l==null?void 0:l.pointerId)===n.pointerId&&(l.offset=Math.max(0,n.clientY-l.startY),n.currentTarget.style.transform=`translateY(${l.offset}px)`)},s=n=>{const l=e.current;if((l==null?void 0:l.pointerId)!==n.pointerId)return;const i=n.currentTarget;e.current=null,delete i.dataset.dragging,i.hasPointerCapture(n.pointerId)&&i.releasePointerCapture(n.pointerId);const u=l.offset/Math.max(n.timeStamp-l.startTime,1);if(!(n.type==="pointerup"&&(l.offset>i.offsetHeight*k||l.offset>Y&&u>U))){i.style.transform="";return}t(),requestAnimationFrame(()=>{i.dataset.state==="open"&&(i.style.transform="")})};return{onPointerDown:a,onPointerMove:o,onPointerUp:s,onPointerCancel:s}}const _=d.forwardRef(function(t,e){return r.jsx(f.Dialog.Trigger,m({ref:e,"data-slot":"dialog-trigger"},t))});function S(t){var e=p(t,[]);return r.jsx(f.Dialog.Portal,m({"data-slot":"dialog-portal"},e))}const A=d.forwardRef(function(t,e){return r.jsx(f.Dialog.Close,m({ref:e,"data-slot":"dialog-close"},t))});function T(t){var e=t,{className:a}=e,o=p(e,["className"]);return r.jsx(f.Dialog.Overlay,m({"data-slot":"dialog-overlay",className:c.cn("fixed inset-0 z-50 bg-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:!animate-none",a)},o))}function B(t){var e=t,{className:a,overlayClassName:o,children:s,showCloseButton:n=!0,closeLabel:l="Fechar",onPointerDown:i,onPointerMove:u,onPointerUp:h,onPointerCancel:g}=e,x=p(e,["className","overlayClassName","children","showCloseButton","closeLabel","onPointerDown","onPointerMove","onPointerUp","onPointerCancel"]);const v=$(d.useContext(I));return r.jsxs(S,{"data-slot":"dialog-portal",children:[r.jsx(T,{className:c.cn("modal-overlay",o)}),r.jsxs(f.Dialog.Content,w(m({"data-slot":"dialog-container",className:c.cn("modal-overlay fixed left-1/2 top-1/2 z-50 flex max-h-[85dvh] w-full max-w-[568px] -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-y-auto rounded-lg bg-surface-elevated p-0 shadow-level-5 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 motion-reduce:!animate-none md:max-h-[85vh]","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:translate-x-0 max-md:translate-y-0 max-md:rounded-b-none max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 max-md:data-[state=closed]:slide-out-to-bottom max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-bottom max-md:data-[state=open]:slide-in-from-left-0","data-[dragging]:transition-none max-md:ease-out max-md:motion-safe:transition-transform max-md:[&>[data-slot=dialog-handle]+[data-slot=dialog-header]]:pt-10 max-md:[&_[data-slot=dialog-header]]:touch-none",a)},x),{onPointerDown:b(i,v.onPointerDown),onPointerMove:b(u,v.onPointerMove),onPointerUp:b(h,v.onPointerUp),onPointerCancel:b(g,v.onPointerCancel),children:[r.jsx("div",{"aria-hidden":!0,"data-slot":"dialog-handle",className:"pointer-events-none absolute left-1/2 top-4 z-10 h-1 w-11 -translate-x-1/2 rounded-pill bg-gray-stroke md:hidden"}),r.jsx(O.Provider,{value:n,children:s}),n&&r.jsx(f.Dialog.Close,{"data-slot":"dialog-close",asChild:!0,children:r.jsx(C.Dismiss,{label:l,className:c.cn(C.DISMISS_PANEL_POSITION,"max-md:top-[34px]")})})]}))]})}function H(t){var e=t,{containerClassName:a,className:o}=e,s=p(e,["containerClassName","className"]);return r.jsx("div",{className:c.cn("mb-auto overflow-y-auto",a),children:r.jsx("div",m({"data-slot":"dialog-content",className:c.cn("px-8 py-6 text-md leading-md text-primary-foreground",o)},s))})}function V(t){var e=t,{className:a,separator:o=!1}=e,s=p(e,["className","separator"]);const n=d.useContext(O);return r.jsxs(r.Fragment,{children:[r.jsx("div",m({"data-slot":"dialog-header",className:c.cn("flex flex-col gap-2 px-8 py-6 text-left",n&&"pr-14",a)},s)),o&&r.jsx(D.Separator,{})]})}function W(t){var e=t,{className:a,separator:o=!1}=e,s=p(e,["className","separator"]);return r.jsxs(r.Fragment,{children:[o&&r.jsx(D.Separator,{}),r.jsx("div",m({"data-slot":"dialog-footer",className:c.cn("flex justify-end gap-2 px-8 py-6",a)},s))]})}function G(t){var e=t,{className:a,iconLeft:o,iconRight:s,children:n}=e,l=p(e,["className","iconLeft","iconRight","children"]);const i=u=>{var h,g;if(d.isValidElement(u)){const x=u;return d.cloneElement(x,{size:(h=x.props.size)!=null?h:32,strokeWidth:(g=x.props.strokeWidth)!=null?g:2.2,className:c.cn("flex-shrink-0",x.props.className)})}return u};return r.jsxs(f.Dialog.Title,w(m({"data-slot":"dialog-title",className:c.cn("flex items-center gap-3 text-title-md font-semibold leading-title-md !text-content-title",a)},l),{children:[o&&i(o),n,s&&i(s)]}))}function J(t){var e=t,{className:a}=e,o=p(e,["className"]);return r.jsx(f.Dialog.Description,m({"data-slot":"dialog-description",className:c.cn("text-md leading-md text-content-paragraph",a)},o))}exports.Dialog=F,exports.DialogClose=A,exports.DialogContainer=B,exports.DialogContent=H,exports.DialogDescription=J,exports.DialogFooter=W,exports.DialogHeader=V,exports.DialogOverlay=T,exports.DialogPortal=S,exports.DialogTitle=G,exports.DialogTrigger=_;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsx as l,jsxs as
|
|
3
|
+
import{jsx as l,jsxs as h,Fragment as b}from"react/jsx-runtime";import{Dialog as u}from"radix-ui";import{createContext as y,forwardRef as C,useState as U,useCallback as D,useContext as w,useRef as Y,isValidElement as E,cloneElement as L}from"react";import{Dismiss as F,DISMISS_PANEL_POSITION as _}from"./Dismiss.mjs";import{Separator as O}from"./Separator.mjs";import{cn as d}from"../lib/utils.mjs";var q=Object.defineProperty,A=Object.defineProperties,B=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,j=(t,e,a)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,c=(t,e)=>{for(var a in e||(e={}))I.call(e,a)&&j(t,a,e[a]);if(P)for(var a of P(e))T.call(e,a)&&j(t,a,e[a]);return t},z=(t,e)=>A(t,B(e)),f=(t,e)=>{var a={};for(var o in t)I.call(t,o)&&e.indexOf(o)<0&&(a[o]=t[o]);if(t!=null&&P)for(var o of P(t))e.indexOf(o)<0&&T.call(t,o)&&(a[o]=t[o]);return a};const H=40,$=.25,V=.5,W=16,G="button, a, input, select, textarea, label, [role='button'], [contenteditable='true']",S=y(!1),M=y(()=>{});function J(t){var e=t,{open:a,defaultOpen:o=!1,onOpenChange:s}=e,n=f(e,["open","defaultOpen","onOpenChange"]);const r=a!==void 0,[i,m]=U(o),v=r?a:i,p=D(x=>{r||m(x),s==null||s(x)},[r,s]),g=D(()=>p(!1),[p]);return l(M.Provider,{value:g,children:l(u.Root,c({"data-slot":"dialog",open:v,onOpenChange:p},n))})}function N(t,e){return a=>{t==null||t(a),a.defaultPrevented||e(a)}}function K(t){const e=t.currentTarget,a=t.target,o=e.querySelector('[data-slot="dialog-handle"]');return t.button!==0||!(o!=null&&o.getClientRects().length)||a.closest('[data-slot="dialog-container"]')!==e||a.closest(G)?!1:t.clientY-e.getBoundingClientRect().top<=H||!!a.closest('[data-slot="dialog-header"]')}function Q(t){const e=Y(null),a=n=>{if(!K(n))return;const r=n.currentTarget;r.setPointerCapture(n.pointerId),r.dataset.dragging="",e.current={pointerId:n.pointerId,startY:n.clientY,startTime:n.timeStamp,offset:0}},o=n=>{const r=e.current;(r==null?void 0:r.pointerId)===n.pointerId&&(r.offset=Math.max(0,n.clientY-r.startY),n.currentTarget.style.transform=`translateY(${r.offset}px)`)},s=n=>{const r=e.current;if((r==null?void 0:r.pointerId)!==n.pointerId)return;const i=n.currentTarget;e.current=null,delete i.dataset.dragging,i.hasPointerCapture(n.pointerId)&&i.releasePointerCapture(n.pointerId);const m=r.offset/Math.max(n.timeStamp-r.startTime,1);if(!(n.type==="pointerup"&&(r.offset>i.offsetHeight*$||r.offset>W&&m>V))){i.style.transform="";return}t(),requestAnimationFrame(()=>{i.dataset.state==="open"&&(i.style.transform="")})};return{onPointerDown:a,onPointerMove:o,onPointerUp:s,onPointerCancel:s}}const X=C(function(t,e){return l(u.Trigger,c({ref:e,"data-slot":"dialog-trigger"},t))});function R(t){var e=f(t,[]);return l(u.Portal,c({"data-slot":"dialog-portal"},e))}const Z=C(function(t,e){return l(u.Close,c({ref:e,"data-slot":"dialog-close"},t))});function k(t){var e=t,{className:a}=e,o=f(e,["className"]);return l(u.Overlay,c({"data-slot":"dialog-overlay",className:d("fixed inset-0 z-50 bg-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:!animate-none",a)},o))}function ee(t){var e=t,{className:a,overlayClassName:o,children:s,showCloseButton:n=!0,closeLabel:r="Fechar",onPointerDown:i,onPointerMove:m,onPointerUp:v,onPointerCancel:p}=e,g=f(e,["className","overlayClassName","children","showCloseButton","closeLabel","onPointerDown","onPointerMove","onPointerUp","onPointerCancel"]);const x=Q(w(M));return h(R,{"data-slot":"dialog-portal",children:[l(k,{className:d("modal-overlay",o)}),h(u.Content,z(c({"data-slot":"dialog-container",className:d("modal-overlay fixed left-1/2 top-1/2 z-50 flex max-h-[85dvh] w-full max-w-[568px] -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-y-auto rounded-lg bg-surface-elevated p-0 shadow-level-5 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 motion-reduce:!animate-none md:max-h-[85vh]","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:translate-x-0 max-md:translate-y-0 max-md:rounded-b-none max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 max-md:data-[state=closed]:slide-out-to-bottom max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-bottom max-md:data-[state=open]:slide-in-from-left-0","data-[dragging]:transition-none max-md:ease-out max-md:motion-safe:transition-transform max-md:[&>[data-slot=dialog-handle]+[data-slot=dialog-header]]:pt-10 max-md:[&_[data-slot=dialog-header]]:touch-none",a)},g),{onPointerDown:N(i,x.onPointerDown),onPointerMove:N(m,x.onPointerMove),onPointerUp:N(v,x.onPointerUp),onPointerCancel:N(p,x.onPointerCancel),children:[l("div",{"aria-hidden":!0,"data-slot":"dialog-handle",className:"pointer-events-none absolute left-1/2 top-4 z-10 h-1 w-11 -translate-x-1/2 rounded-pill bg-gray-stroke md:hidden"}),l(S.Provider,{value:n,children:s}),n&&l(u.Close,{"data-slot":"dialog-close",asChild:!0,children:l(F,{label:r,className:d(_,"max-md:top-[34px]")})})]}))]})}function te(t){var e=t,{containerClassName:a,className:o}=e,s=f(e,["containerClassName","className"]);return l("div",{className:d("mb-auto overflow-y-auto",a),children:l("div",c({"data-slot":"dialog-content",className:d("px-8 py-6 text-md leading-md text-primary-foreground",o)},s))})}function ae(t){var e=t,{className:a,separator:o=!1}=e,s=f(e,["className","separator"]);const n=w(S);return h(b,{children:[l("div",c({"data-slot":"dialog-header",className:d("flex flex-col gap-2 px-8 py-6 text-left",n&&"pr-14",a)},s)),o&&l(O,{})]})}function oe(t){var e=t,{className:a,separator:o=!1}=e,s=f(e,["className","separator"]);return h(b,{children:[o&&l(O,{}),l("div",c({"data-slot":"dialog-footer",className:d("flex justify-end gap-2 px-8 py-6",a)},s))]})}function ne(t){var e=t,{className:a,iconLeft:o,iconRight:s,children:n}=e,r=f(e,["className","iconLeft","iconRight","children"]);const i=m=>{var v,p;if(E(m)){const g=m;return L(g,{size:(v=g.props.size)!=null?v:32,strokeWidth:(p=g.props.strokeWidth)!=null?p:2.2,className:d("flex-shrink-0",g.props.className)})}return m};return h(u.Title,z(c({"data-slot":"dialog-title",className:d("flex items-center gap-3 text-title-md font-semibold leading-title-md !text-content-title",a)},r),{children:[o&&i(o),n,s&&i(s)]}))}function re(t){var e=t,{className:a}=e,o=f(e,["className"]);return l(u.Description,c({"data-slot":"dialog-description",className:d("text-md leading-md text-content-paragraph",a)},o))}export{J as Dialog,Z as DialogClose,ee as DialogContainer,te as DialogContent,re as DialogDescription,oe as DialogFooter,ae as DialogHeader,k as DialogOverlay,R as DialogPortal,ne as DialogTitle,X as DialogTrigger};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsx as e,jsxs as d}from"react/jsx-runtime";import{useRef as g,useState as u}from"react";import{normalizeLinkInput as C}from"@medway-ui/notes-core";import{Button as h}from"./Button.mjs";import{Dialog as b,DialogContainer as N,DialogHeader as D,DialogTitle as y,DialogFooter as S}from"./Dialog.mjs";import{Input as x}from"./Input.mjs";import{Label as k}from"./Label.mjs";import{useId as $}from"../hooks/use-id.mjs";function E({draft:r,onSave:f,onRemove:v,onCancel:s}){const
|
|
3
|
+
import{jsx as e,jsxs as d}from"react/jsx-runtime";import{useRef as g,useState as u}from"react";import{normalizeLinkInput as C}from"@medway-ui/notes-core";import{Button as h}from"./Button.mjs";import{Dialog as b,DialogContainer as N,DialogHeader as D,DialogTitle as y,DialogFooter as S}from"./Dialog.mjs";import{Input as x}from"./Input.mjs";import{Label as k}from"./Label.mjs";import{useId as $}from"../hooks/use-id.mjs";function E({draft:r,onSave:f,onRemove:v,onCancel:s}){const t=$(),[i,c]=u(r.text),[l,p]=u(r.href),[a,o]=u(!1);return d("form",{onSubmit:n=>{n.preventDefault();const m=C(l);if(!m){o(!0);return}f({text:i.trim()?i:l.trim(),href:m})},noValidate:!0,children:[e(D,{className:"pb-0",children:e(y,{children:r.isEditing?"Editar link":"Adicionar link"})}),d("div",{className:"flex flex-col gap-5 px-8 pt-6",children:[d("div",{className:"flex flex-col gap-2",children:[e(k,{htmlFor:`${t}-text`,className:"font-semibold",children:"Texto"}),e(x,{id:`${t}-text`,"data-link-field":"text",size:"md",value:i,onChange:n=>c(n.target.value),autoComplete:"off"})]}),d("div",{className:"flex flex-col gap-2",children:[e(k,{htmlFor:`${t}-href`,className:"font-semibold",children:"Link"}),e(x,{id:`${t}-href`,"data-link-field":"href",size:"md",value:l,invalid:a,"aria-invalid":a||void 0,"aria-describedby":a?`${t}-error`:void 0,onChange:n=>{p(n.target.value),o(!1)},inputMode:"url",autoComplete:"off",spellCheck:!1}),a?e("span",{id:`${t}-error`,role:"alert",className:"text-xs text-feedback-error-foreground",children:"Link inv\xE1lido. Use um endere\xE7o como medway.com.br"}):null]})]}),d(S,{className:"items-center",children:[r.isEditing?e(h,{variant:"error-basic",className:"mr-auto",onClick:v,children:"Remover link"}):null,e(h,{variant:"outlined",onClick:s,children:"Cancelar"}),e(h,{type:"submit",disabled:l.trim()==="",children:"Salvar"})]})]})}function F({draft:r,onSave:f,onRemove:v,onCancel:s,onClosed:t}){var i;const c=g(null),[l,p]=u(null);return r&&r!==(l==null?void 0:l.draft)&&p({draft:r,key:((i=l==null?void 0:l.key)!=null?i:0)+1}),e(b,{open:r!==null,onOpenChange:a=>{a||s()},children:e(N,{"aria-describedby":void 0,className:"max-w-md",onOpenAutoFocus:a=>{var o,n;a.preventDefault();const m=r!=null&&r.text?"href":"text";(n=(o=c.current)==null?void 0:o.querySelector(`[data-link-field="${m}"]`))==null||n.focus()},onCloseAutoFocus:a=>{a.preventDefault(),t()},children:e("div",{ref:c,children:l?e(E,{draft:l.draft,onSave:f,onRemove:v,onCancel:s},l.key):null})})})}export{F as NoteEditorLinkDialog};
|