@medway-ui/core 1.38.1 → 1.40.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/dist/components/Pagination.d.ts +1 -1
- package/dist/components/Pagination.js +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Ranking.d.ts +1 -1
- package/dist/components/Ranking.js +1 -1
- package/dist/components/Ranking.mjs +1 -1
- package/dist/components/TagPicker.js +1 -1
- package/dist/components/TagPicker.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.40.0 · Generated 2026-10-30
|
|
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.40.0 · Generated 2026-10-30
|
|
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};
|
|
@@ -25,7 +25,7 @@ type PaginationLinkProps = {
|
|
|
25
25
|
type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>["variant"]>;
|
|
26
26
|
declare function PaginationRoot({ className, ...props }: ComponentProps<"nav">): import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
declare function PaginationContent({ className, ...props }: ComponentProps<"ul">): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
declare function PaginationInfo({ count, label, className, ...props }: ComponentProps<"
|
|
28
|
+
declare function PaginationInfo({ count, label, className, ...props }: ComponentProps<"span"> & {
|
|
29
29
|
count?: number;
|
|
30
30
|
label?: string;
|
|
31
31
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var i=require("react/jsx-runtime"),F=require("../assets/js/tokens.js"),P=require("./Button.js"),x=require("../lib/utils.js"),z=require("@medway-ui/icons"),g=require("react"),S=Object.defineProperty,$=Object.defineProperties,H=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,C=(a,e,r)=>e in a?S(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,f=(a,e)=>{for(var r in e||(e={}))R.call(e,r)&&C(a,r,e[r]);if(b)for(var r of b(e))E.call(e,r)&&C(a,r,e[r]);return a},h=(a,e)=>$(a,H(e)),m=(a,e)=>{var r={};for(var s in a)R.call(a,s)&&e.indexOf(s)<0&&(r[s]=a[s]);if(a!=null&&b)for(var s of b(a))e.indexOf(s)<0&&E.call(a,s)&&(r[s]=a[s]);return r};const W={regular:"regular-soft",emphasis:"emphasis-soft",error:"error-soft",warning:"warning-soft",success:"success-soft",outlined:"regular-basic"};function L(a){var e=a,{className:r}=e,s=m(e,["className"]);return i.jsx("nav",f({"aria-label":"Pagina\xE7\xE3o",className:x.cn("flex w-full flex-wrap items-center justify-between gap-4",r)},s))}function
|
|
3
|
+
"use strict";var i=require("react/jsx-runtime"),F=require("../assets/js/tokens.js"),P=require("./Button.js"),x=require("../lib/utils.js"),z=require("@medway-ui/icons"),g=require("react"),S=Object.defineProperty,$=Object.defineProperties,H=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,C=(a,e,r)=>e in a?S(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,f=(a,e)=>{for(var r in e||(e={}))R.call(e,r)&&C(a,r,e[r]);if(b)for(var r of b(e))E.call(e,r)&&C(a,r,e[r]);return a},h=(a,e)=>$(a,H(e)),m=(a,e)=>{var r={};for(var s in a)R.call(a,s)&&e.indexOf(s)<0&&(r[s]=a[s]);if(a!=null&&b)for(var s of b(a))e.indexOf(s)<0&&E.call(a,s)&&(r[s]=a[s]);return r};const W={regular:"regular-soft",emphasis:"emphasis-soft",error:"error-soft",warning:"warning-soft",success:"success-soft",outlined:"regular-basic"};function L(a){var e=a,{className:r}=e,s=m(e,["className"]);return i.jsx("nav",f({"aria-label":"Pagina\xE7\xE3o",className:x.cn("flex w-full flex-wrap items-center justify-between gap-4",r)},s))}function k(a){var e=a,{className:r}=e,s=m(e,["className"]);return i.jsx("ul",f({className:x.cn("flex min-w-0 max-w-full flex-row flex-wrap items-center justify-center gap-2",r)},s))}function y(a){var e=a,{count:r,label:s="itens",className:n}=e,t=m(e,["count","label","className"]);return i.jsx("span",h(f({className:x.cn("block text-xs font-medium text-gray-foreground-muted",n)},t),{children:s==="itens"?i.jsxs(i.Fragment,{children:["Mostrando"," ",i.jsx("span",{className:"font-semibold text-gray-foreground",children:r})," ",s]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"font-semibold text-gray-foreground",children:r})," ",s]})}))}function w(a){var e=a,{className:r}=e,s=m(e,["className"]);return i.jsx("li",f({className:r},s))}const I=g.forwardRef(function(a,e){var r=a,{className:s,isActive:n,iconLeft:t,iconRight:o,size:l="md",variant:u="regular",activeVariant:p,inactiveVariant:d}=r,j=m(r,["className","isActive","iconLeft","iconRight","size","variant","activeVariant","inactiveVariant"]);return i.jsx(P.Button,h(f({ref:e,"aria-current":n?"page":void 0,variant:(()=>{var N;return n&&p?p:!n&&d?d:n?u:(N=W[u])!=null?N:u})(),className:x.cn("transition-none",s),size:l,iconLeft:t,iconRight:o},j),{children:j.children}))}),q=g.forwardRef(function(a,e){var r=a,{className:s,size:n="md",variant:t="regular-basic"}=r,o=m(r,["className","size","variant"]);return i.jsx(P.Button,h(f({ref:e,"aria-label":"P\xE1gina anterior",className:s,iconLeft:i.jsx(z.ChevronLeftDuo,{}),variant:t,size:n},o),{children:o.children||"Anterior"}))}),M=g.forwardRef(function(a,e){var r=a,{className:s,size:n="md",variant:t="regular-basic"}=r,o=m(r,["className","size","variant"]);return i.jsx(P.Button,h(f({ref:e,className:s,variant:t,iconRight:i.jsx(z.ChevronRightDuo,{}),size:n},o),{children:o.children||"Pr\xF3ximo"}))});function V(a){var e=a,{className:r,size:s="md"}=e,n=m(e,["className","size"]);return i.jsx("span",h(f({"aria-hidden":!0,className:x.cn("flex items-center justify-center text-gray-foreground-muted",{sm:"size-8",md:"size-10",lg:"size-12"}[s],r)},n),{children:i.jsx(z.MoreHorizontal,{className:"h-4 w-4"})}))}function A(a,e,r=2){const s=[];if(e<=r+2)for(let n=1;n<=e;n++)s.push(n);else{const n=Math.floor(r/2);if(a<=n+1){for(let t=1;t<=r+1;t++)s.push(t);r+1<e&&s.push(-1,e)}else if(a>=e-n){s.push(1),e-r>1&&s.push(-1);for(let t=e-r;t<=e;t++)s.push(t)}else{const t=a-n,o=a+n;s.push(1),t>2&&s.push(-1);for(let l=t;l<=o;l++)s.push(l);o<e-1&&s.push(-1),s.push(e)}}return s}function Q({currentPage:a,totalPages:e,maxVisibleItems:r,onPageChange:s,itemsPerPage:n,totalItems:t,className:o,responsive:l=!0,size:u="md",variant:p="regular"}){const[d,j]=g.useState(!1);g.useEffect(()=>{if(typeof window=="undefined"||!l)return;const c=parseInt(F.screens.tablet),v=()=>{j(window.innerWidth<=c)};return window.addEventListener("resize",v),v(),()=>window.removeEventListener("resize",v)},[l]);const N=typeof r=="number"?r:l&&d?0:2,O=l&&d,B=l?"max-[500px]:hidden":void 0,D=()=>A(a,e,N);return i.jsxs(L,{className:o,children:[n!==void 0&&!O?i.jsx(y,{count:n,label:"itens"}):i.jsx("div",{}),i.jsxs(k,{className:l?"max-[500px]:w-full max-[500px]:justify-between":void 0,children:[i.jsx(w,{children:i.jsx(q,{onClick:()=>s(Math.max(1,a-1)),disabled:a<=1,size:u})}),D().map((c,v)=>i.jsx(w,{className:B,children:c===-1?i.jsx(V,{size:u}):i.jsx(I,{"aria-label":`P\xE1gina ${c}`,onClick:()=>{c!==a&&s(c)},isActive:c===a,size:u,variant:p,children:c})},c===-1?`ellipsis-${v}`:c)),i.jsx(w,{children:i.jsx(M,{onClick:()=>s(Math.min(e,a+1)),disabled:a>=e,size:u})})]}),t!==void 0&&!O?i.jsx(y,{count:t,label:"total"}):i.jsx("div",{})]})}exports.Pagination=Q,exports.PaginationContent=k,exports.PaginationEllipsis=V,exports.PaginationInfo=y,exports.PaginationItem=w,exports.PaginationLink=I,exports.PaginationNext=M,exports.PaginationPrevious=q,exports.PaginationRoot=L,exports.calculatePageNumbers=A;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsx as n,jsxs as b,Fragment as E}from"react/jsx-runtime";import{screens as B}from"../assets/js/tokens.mjs";import{Button as z}from"./Button.mjs";import{cn as p}from"../lib/utils.mjs";import{ChevronLeftDuo as F,ChevronRightDuo as H,MoreHorizontal as Q}from"@medway-ui/icons";import{forwardRef as y,useState as T,useEffect as U}from"react";var q=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,R=(a,e,r)=>e in a?q(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,m=(a,e)=>{for(var r in e||(e={}))C.call(e,r)&&R(a,r,e[r]);if(w)for(var r of w(e))L.call(e,r)&&R(a,r,e[r]);return a},h=(a,e)=>G(a,J(e)),f=(a,e)=>{var r={};for(var i in a)C.call(a,i)&&e.indexOf(i)<0&&(r[i]=a[i]);if(a!=null&&w)for(var i of w(a))e.indexOf(i)<0&&L.call(a,i)&&(r[i]=a[i]);return r};const K={regular:"regular-soft",emphasis:"emphasis-soft",error:"error-soft",warning:"warning-soft",success:"success-soft",outlined:"regular-basic"};function I(a){var e=a,{className:r}=e,i=f(e,["className"]);return n("nav",m({"aria-label":"Pagina\xE7\xE3o",className:p("flex w-full flex-wrap items-center justify-between gap-4",r)},i))}function
|
|
3
|
+
import{jsx as n,jsxs as b,Fragment as E}from"react/jsx-runtime";import{screens as B}from"../assets/js/tokens.mjs";import{Button as z}from"./Button.mjs";import{cn as p}from"../lib/utils.mjs";import{ChevronLeftDuo as F,ChevronRightDuo as H,MoreHorizontal as Q}from"@medway-ui/icons";import{forwardRef as y,useState as T,useEffect as U}from"react";var q=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,R=(a,e,r)=>e in a?q(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,m=(a,e)=>{for(var r in e||(e={}))C.call(e,r)&&R(a,r,e[r]);if(w)for(var r of w(e))L.call(e,r)&&R(a,r,e[r]);return a},h=(a,e)=>G(a,J(e)),f=(a,e)=>{var r={};for(var i in a)C.call(a,i)&&e.indexOf(i)<0&&(r[i]=a[i]);if(a!=null&&w)for(var i of w(a))e.indexOf(i)<0&&L.call(a,i)&&(r[i]=a[i]);return r};const K={regular:"regular-soft",emphasis:"emphasis-soft",error:"error-soft",warning:"warning-soft",success:"success-soft",outlined:"regular-basic"};function I(a){var e=a,{className:r}=e,i=f(e,["className"]);return n("nav",m({"aria-label":"Pagina\xE7\xE3o",className:p("flex w-full flex-wrap items-center justify-between gap-4",r)},i))}function k(a){var e=a,{className:r}=e,i=f(e,["className"]);return n("ul",m({className:p("flex min-w-0 max-w-full flex-row flex-wrap items-center justify-center gap-2",r)},i))}function j(a){var e=a,{count:r,label:i="itens",className:s}=e,t=f(e,["count","label","className"]);return n("span",h(m({className:p("block text-xs font-medium text-gray-foreground-muted",s)},t),{children:i==="itens"?b(E,{children:["Mostrando"," ",n("span",{className:"font-semibold text-gray-foreground",children:r})," ",i]}):b(E,{children:[n("span",{className:"font-semibold text-gray-foreground",children:r})," ",i]})}))}function P(a){var e=a,{className:r}=e,i=f(e,["className"]);return n("li",m({className:r},i))}const M=y(function(a,e){var r=a,{className:i,isActive:s,iconLeft:t,iconRight:o,size:l="md",variant:u="regular",activeVariant:g,inactiveVariant:d}=r,N=f(r,["className","isActive","iconLeft","iconRight","size","variant","activeVariant","inactiveVariant"]);return n(z,h(m({ref:e,"aria-current":s?"page":void 0,variant:(()=>{var x;return s&&g?g:!s&&d?d:s?u:(x=K[u])!=null?x:u})(),className:p("transition-none",i),size:l,iconLeft:t,iconRight:o},N),{children:N.children}))}),V=y(function(a,e){var r=a,{className:i,size:s="md",variant:t="regular-basic"}=r,o=f(r,["className","size","variant"]);return n(z,h(m({ref:e,"aria-label":"P\xE1gina anterior",className:i,iconLeft:n(F,{}),variant:t,size:s},o),{children:o.children||"Anterior"}))}),A=y(function(a,e){var r=a,{className:i,size:s="md",variant:t="regular-basic"}=r,o=f(r,["className","size","variant"]);return n(z,h(m({ref:e,className:i,variant:t,iconRight:n(H,{}),size:s},o),{children:o.children||"Pr\xF3ximo"}))});function $(a){var e=a,{className:r,size:i="md"}=e,s=f(e,["className","size"]);return n("span",h(m({"aria-hidden":!0,className:p("flex items-center justify-center text-gray-foreground-muted",{sm:"size-8",md:"size-10",lg:"size-12"}[i],r)},s),{children:n(Q,{className:"h-4 w-4"})}))}function D(a,e,r=2){const i=[];if(e<=r+2)for(let s=1;s<=e;s++)i.push(s);else{const s=Math.floor(r/2);if(a<=s+1){for(let t=1;t<=r+1;t++)i.push(t);r+1<e&&i.push(-1,e)}else if(a>=e-s){i.push(1),e-r>1&&i.push(-1);for(let t=e-r;t<=e;t++)i.push(t)}else{const t=a-s,o=a+s;i.push(1),t>2&&i.push(-1);for(let l=t;l<=o;l++)i.push(l);o<e-1&&i.push(-1),i.push(e)}}return i}function X({currentPage:a,totalPages:e,maxVisibleItems:r,onPageChange:i,itemsPerPage:s,totalItems:t,className:o,responsive:l=!0,size:u="md",variant:g="regular"}){const[d,N]=T(!1);U(()=>{if(typeof window=="undefined"||!l)return;const c=parseInt(B.tablet),v=()=>{N(window.innerWidth<=c)};return window.addEventListener("resize",v),v(),()=>window.removeEventListener("resize",v)},[l]);const x=typeof r=="number"?r:l&&d?0:2,O=l&&d,S=l?"max-[500px]:hidden":void 0,W=()=>D(a,e,x);return b(I,{className:o,children:[s!==void 0&&!O?n(j,{count:s,label:"itens"}):n("div",{}),b(k,{className:l?"max-[500px]:w-full max-[500px]:justify-between":void 0,children:[n(P,{children:n(V,{onClick:()=>i(Math.max(1,a-1)),disabled:a<=1,size:u})}),W().map((c,v)=>n(P,{className:S,children:c===-1?n($,{size:u}):n(M,{"aria-label":`P\xE1gina ${c}`,onClick:()=>{c!==a&&i(c)},isActive:c===a,size:u,variant:g,children:c})},c===-1?`ellipsis-${v}`:c)),n(P,{children:n(A,{onClick:()=>i(Math.min(e,a+1)),disabled:a>=e,size:u})})]}),t!==void 0&&!O?n(j,{count:t,label:"total"}):n("div",{})]})}export{X as Pagination,k as PaginationContent,$ as PaginationEllipsis,j as PaginationInfo,P as PaginationItem,M as PaginationLink,A as PaginationNext,V as PaginationPrevious,I as PaginationRoot,D as calculatePageNumbers};
|
|
@@ -36,7 +36,7 @@ interface RankingSuperFocusProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
36
36
|
interface RankingAssigneesColumnProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
37
37
|
children: ReactNode;
|
|
38
38
|
}
|
|
39
|
-
interface RankingAssigneeLabelProps extends HTMLAttributes<
|
|
39
|
+
interface RankingAssigneeLabelProps extends HTMLAttributes<HTMLSpanElement> {
|
|
40
40
|
children: ReactNode;
|
|
41
41
|
}
|
|
42
42
|
interface RankingAssigneeGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var n=require("react/jsx-runtime"),i=require("../lib/utils.js"),u=require("@medway-ui/icons"),b=require("./Button.js"),p=require("./Avatar.js"),v=require("./Tag.js"),x=require("./Tooltip.js"),F=Object.defineProperty,M=Object.defineProperties,E=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,w=(r,e,s)=>e in r?F(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,l=(r,e)=>{for(var s in e||(e={}))y.call(e,s)&&w(r,s,e[s]);if(h)for(var s of h(e))k.call(e,s)&&w(r,s,e[s]);return r},c=(r,e)=>M(r,E(e)),o=(r,e)=>{var s={};for(var a in r)y.call(r,a)&&e.indexOf(a)<0&&(s[a]=r[a]);if(r!=null&&h)for(var a of h(r))e.indexOf(a)<0&&k.call(r,a)&&(s[a]=r[a]);return s};function I(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("div",{className:"w-full overflow-x-auto rounded-lg border border-gray-stroke-muted",children:n.jsx("table",c(l({className:i.cn("w-full border-collapse text-left",a)},t),{children:s}))})}function B(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("thead",c(l({className:i.cn("h-11 border-b border-gray-stroke-muted bg-surface-card",a)},t),{children:n.jsx("tr",{children:s})}))}function D(r){var e=r,{children:s,className:a,tooltip:t,highlight:d}=e,m=o(e,["children","className","tooltip","highlight"]);return n.jsx("th",c(l({className:i.cn("text-ellipsis whitespace-nowrap px-5 text-sm font-semibold text-gray-foreground first:pr-0",a)},m),{children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:i.cn(d&&"flex size-7 shrink-0 items-center justify-center rounded-full bg-primary-foreground-onfill"),children:s}),t&&n.jsx(x.TooltipProvider,{children:n.jsxs(x.Tooltip,{children:[n.jsx(x.TooltipTrigger,{asChild:!0,children:n.jsx(b.Button,{type:"button",variant:"regular-basic",size:"sm","aria-label":t,className:"!h-6 !min-h-6 !w-6 !min-w-6 !p-0 text-gray-foreground",iconLeft:n.jsx(u.Info,{"aria-hidden":"true",className:"size-4"})})}),n.jsx(x.TooltipContent,{children:t})]})})]})}))}function S(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("tbody",c(l({className:i.cn("bg-surface-card",a)},t),{children:s}))}function L(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("tr",c(l({className:i.cn("w-full border-t border-solid border-gray-stroke-muted first:border-t-0",a)},t),{children:s}))}function Q(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("td",{className:"py-4 pl-5 align-middle",children:n.jsx("div",c(l({className:i.cn("flex size-7 shrink-0 items-center justify-center overflow-hidden whitespace-nowrap rounded-full bg-primary-foreground text-sm font-semibold text-primary-foreground-onfill",a)},t),{children:s}))})}function W(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("td",c(l({className:"px-5 py-4 align-middle"},t),{children:n.jsx("div",{className:i.cn("flex items-center gap-5",a),children:n.jsx("div",{className:"flex shrink-0 items-center gap-5 pr-8",children:s})})}))}function G(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("div",c(l({className:i.cn("flex shrink-0 flex-col items-start whitespace-nowrap text-gray-foreground",a)},t),{children:s}))}function H(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("span",c(l({className:i.cn("shrink-0 overflow-hidden text-ellipsis font-sans text-xxs font-medium leading-xxs",a)},t),{children:s}))}function X(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("span",c(l({className:i.cn("shrink-0 overflow-hidden text-ellipsis font-sans text-sm font-semibold leading-sm",a)},t),{children:s}))}function Y(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx(v.Tag,c(l({className:i.cn("bg-gradient-to-r from-cm-24 to-secondary-24 text-primary-foreground",a)},t),{icon:n.jsx(u.CheckboxFill,{className:"text-primary-foreground"}),children:s}))}function Z(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("td",c(l({className:"px-5 py-4 align-middle"},t),{children:n.jsx("div",{className:i.cn("flex flex-col items-start gap-2",a),children:s})}))}function J(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("p",c(l({className:i.cn("relative shrink-0 overflow-hidden text-ellipsis whitespace-nowrap text-xxs font-medium leading-xxs text-gray-foreground",a)},t),{children:s}))}function K(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("div",c(l({className:i.cn("avatar-group flex shrink-0 items-center gap-2",a)},t),{children:s}))}function U(r){var e=r,{src:s,alt:a,fallback:t="?",className:d,tooltip:m}=e,g=o(e,["src","alt","fallback","className","tooltip"]);const f=n.jsxs(p.Avatar,c(l({size:"sm",tabIndex:m?0:void 0,className:i.cn("ring-2 ring-background",m&&"outline-none focus-visible:ring-4 focus-visible:ring-state-focus",d)},g),{children:[n.jsx(p.AvatarImage,{src:s,alt:a!=null?a:typeof m=="string"?m:""}),n.jsx(p.AvatarFallback,{children:t})]}));return m?n.jsx(x.TooltipProvider,{children:n.jsxs(x.Tooltip,{children:[n.jsx(x.TooltipTrigger,{asChild:!0,children:f}),n.jsx(x.TooltipContent,{children:m})]})}):f}function V(r){var e=r,{children:s,className:a,icon:t}=e,d=o(e,["children","className","icon"]);return n.jsx("td",c(l({className:"px-5 py-4 align-middle"},d),{children:n.jsx(v.Tag,{variant:"regular-soft",className:a,icon:t,children:s})}))}function _({className:r,percentage:e,label:s}){return n.jsx("div",{role:"progressbar","aria-label":s,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i.clampPercentage(e)),className:i.cn("relative h-0.5 w-full overflow-hidden rounded-pill bg-gray-stroke-muted",r),children:n.jsx("div",{className:i.cn("absolute inset-y-0 left-0 rounded-pill bg-primary-stroke transition-[width] duration-300 motion-reduce:transition-none"),style:{width:`${i.clampPercentage(e)}%`}})})}function ee(r){var e=r,{questions:s,answered:a,className:t}=e,d=o(e,["questions","answered","className"]);const m=a>0&&s>0?i.clampPercentage(a/s*100):0;return a===0?n.jsx("td",c(l({className:"px-5 py-4 align-middle"},d),{children:n.jsx("div",{className:i.cn("flex min-w-[140px] flex-col items-start justify-center gap-2",t),children:n.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-2 text-xs font-medium text-gray-foreground-muted",children:[n.jsx("div",{className:"flex size-4 items-center justify-center rounded-full bg-gray-background-soft",children:n.jsx(u.RemoveMinus,{className:"size-3 text-gray-foreground",strokeWidth:2.6})}),n.jsx("span",{className:"whitespace-nowrap font-medium text-gray-foreground-muted",children:"N\xE3o iniciado"})]})})})):n.jsx("td",c(l({className:"px-5 py-4 align-middle"},d),{children:n.jsxs("div",{className:i.cn("flex min-w-[140px] flex-col items-start justify-center gap-2",t),children:[n.jsx("div",{className:"flex shrink-0 items-center gap-0.5 text-xs leading-xs",children:n.jsxs("span",{className:"relative shrink-0 whitespace-nowrap font-medium text-gray-foreground-muted",children:[n.jsx("span",{className:"font-semibold text-gray-foreground",children:a})," ",a>1?"respondidas":"respondida"]})}),n.jsx(_,{percentage:m,label:`${a} ${a>1?"respondidas":"respondida"}`})]})}))}const re={notStarted:{icon:u.RemoveMinus,bgColor:"bg-gray-background-soft",iconColor:"text-gray-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:()=>"N\xE3o iniciado",subtitle:()=>""},minNotReached:{icon:u.Warning,bgColor:"bg-feedback-warning-background-soft",iconColor:"text-feedback-warning-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:()=>"M\xEDnimo n\xE3o atingido",subtitle:({remainingQuestions:r})=>r>1?`Faltam ${r} quest\xF5es`:`Falta ${r} quest\xE3o`},dominated:{icon:u.Check,statusLabel:"Dominado",bgColor:"bg-feedback-success-background-soft",iconColor:"text-feedback-success-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:({progress:r})=>n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"font-semibold text-gray-foreground",children:[Math.round(r),"%"]})," ","de ",r>1?"acertos":"acerto"]}),subtitle:({correct:r,answered:e})=>`${r} de ${e} acertos`},notDominated:{icon:u.CloseMd,statusLabel:"N\xE3o dominado",bgColor:"bg-feedback-error-background-soft",iconColor:"text-feedback-error-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:({progress:r})=>n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"font-semibold text-gray-foreground",children:[Math.round(r),"%"]})," ","de ",r>1?"acertos":"acerto"]}),subtitle:({correct:r,answered:e})=>`${r} de ${e} acertos`}};function ne(r,e,s){return[[r,"notStarted"],[e,"minNotReached"],[s>=80,"dominated"],[!0,"notDominated"]].find(([a])=>a)[1]}function se(r){var e=r,{answered:s,correct:a,minQuestions:t,className:d}=e,m=o(e,["answered","correct","minQuestions","className"]);const g=s>0?a/s*100:0,f=s===0,C=s<t,R=t-s,T=ne(f,C,g),{icon:z,bgColor:P,iconColor:q,titleClassName:O,statusLabel:N,title:$,subtitle:A}=re[T],j={progress:g,correct:a,answered:s,remainingQuestions:R};return n.jsx("td",c(l({className:"px-5 py-4 align-middle"},m),{children:n.jsx("div",{className:i.cn("flex min-w-[140px] flex-col items-start justify-center gap-2",d),children:n.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-2 text-xs font-medium text-gray-foreground-muted",children:[n.jsx("div",{className:i.cn("flex size-4 items-center justify-center rounded-full",P),children:n.jsx(z,{"aria-hidden":"true",className:i.cn("size-3",q),strokeWidth:2.6})}),n.jsxs("div",{className:"flex flex-col items-start justify-center",children:[N&&n.jsxs("span",{className:"sr-only",children:[N,": "]}),n.jsx("span",{className:i.cn("whitespace-nowrap",O),children:$(j)}),n.jsx("span",{className:"whitespace-nowrap text-xxs font-semibold text-gray-foreground-muted",children:A(j)})]})]})})}))}function ae(r){var e=r,{children:s,className:a,onClick:t}=e,d=o(e,["children","className","onClick"]);return n.jsx("td",{className:"px-5 py-4 align-middle",children:n.jsx(b.Button,c(l({variant:"regular-soft",size:"sm",iconRight:n.jsx(u.ArrowRightMd,{className:"size-4"}),onClick:t,className:a},d),{children:s}))})}exports.Ranking=I,exports.RankingAssigneeGroup=K,exports.RankingAssigneeItem=U,exports.RankingAssigneeLabel=J,exports.RankingAssigneesColumn=Z,exports.RankingBody=S,exports.RankingButton=ae,exports.RankingHeader=B,exports.RankingHeaderCell=D,exports.RankingItem=L,exports.RankingNumber=Q,exports.RankingPerformance=se,exports.RankingPriority=V,exports.RankingQuestions=ee,exports.RankingSpecialty=H,exports.RankingSuperFocus=Y,exports.RankingTopic=X,exports.RankingTopicColumn=W,exports.RankingTopicContent=G;
|
|
3
|
+
"use strict";var n=require("react/jsx-runtime"),i=require("../lib/utils.js"),u=require("@medway-ui/icons"),j=require("./Button.js"),p=require("./Avatar.js"),v=require("./Tag.js"),x=require("./Tooltip.js"),F=Object.defineProperty,M=Object.defineProperties,E=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,w=(r,e,s)=>e in r?F(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s,l=(r,e)=>{for(var s in e||(e={}))y.call(e,s)&&w(r,s,e[s]);if(h)for(var s of h(e))k.call(e,s)&&w(r,s,e[s]);return r},c=(r,e)=>M(r,E(e)),o=(r,e)=>{var s={};for(var a in r)y.call(r,a)&&e.indexOf(a)<0&&(s[a]=r[a]);if(r!=null&&h)for(var a of h(r))e.indexOf(a)<0&&k.call(r,a)&&(s[a]=r[a]);return s};function I(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("div",{className:"w-full overflow-x-auto rounded-lg border border-gray-stroke-muted",children:n.jsx("table",c(l({className:i.cn("w-full border-collapse text-left",a)},t),{children:s}))})}function B(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("thead",c(l({className:i.cn("h-11 border-b border-gray-stroke-muted bg-surface-card",a)},t),{children:n.jsx("tr",{children:s})}))}function D(r){var e=r,{children:s,className:a,tooltip:t,highlight:d}=e,m=o(e,["children","className","tooltip","highlight"]);return n.jsx("th",c(l({className:i.cn("text-ellipsis whitespace-nowrap px-5 text-sm font-semibold text-gray-foreground first:pr-0",a)},m),{children:n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:i.cn(d&&"flex size-7 shrink-0 items-center justify-center rounded-full bg-primary-foreground-onfill"),children:s}),t&&n.jsx(x.TooltipProvider,{children:n.jsxs(x.Tooltip,{children:[n.jsx(x.TooltipTrigger,{asChild:!0,children:n.jsx(j.Button,{type:"button",variant:"regular-basic",size:"sm","aria-label":t,className:"!h-6 !min-h-6 !w-6 !min-w-6 !p-0 text-gray-foreground",iconLeft:n.jsx(u.Info,{"aria-hidden":"true",className:"size-4"})})}),n.jsx(x.TooltipContent,{children:t})]})})]})}))}function S(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("tbody",c(l({className:i.cn("bg-surface-card",a)},t),{children:s}))}function L(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("tr",c(l({className:i.cn("w-full border-t border-solid border-gray-stroke-muted first:border-t-0",a)},t),{children:s}))}function Q(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("td",{className:"py-4 pl-5 align-middle",children:n.jsx("div",c(l({className:i.cn("flex size-7 shrink-0 items-center justify-center overflow-hidden whitespace-nowrap rounded-full bg-primary-foreground text-sm font-semibold text-primary-foreground-onfill",a)},t),{children:s}))})}function W(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("td",c(l({className:"px-5 py-4 align-middle"},t),{children:n.jsx("div",{className:i.cn("flex items-center gap-5",a),children:n.jsx("div",{className:"flex shrink-0 items-center gap-5 pr-8",children:s})})}))}function G(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("div",c(l({className:i.cn("flex shrink-0 flex-col items-start whitespace-nowrap text-gray-foreground",a)},t),{children:s}))}function H(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("span",c(l({className:i.cn("shrink-0 overflow-hidden text-ellipsis font-sans text-xxs font-medium leading-xxs",a)},t),{children:s}))}function X(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("span",c(l({className:i.cn("shrink-0 overflow-hidden text-ellipsis font-sans text-sm font-semibold leading-sm",a)},t),{children:s}))}function Y(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx(v.Tag,c(l({className:i.cn("bg-gradient-to-r from-cm-24 to-secondary-24 text-primary-foreground",a)},t),{icon:n.jsx(u.CheckboxFill,{className:"text-primary-foreground"}),children:s}))}function Z(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("td",c(l({className:"px-5 py-4 align-middle"},t),{children:n.jsx("div",{className:i.cn("flex flex-col items-start gap-2",a),children:s})}))}function J(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("span",c(l({className:i.cn("relative block shrink-0 overflow-hidden text-ellipsis whitespace-nowrap text-xxs font-medium leading-xxs text-gray-foreground",a)},t),{children:s}))}function K(r){var e=r,{children:s,className:a}=e,t=o(e,["children","className"]);return n.jsx("div",c(l({className:i.cn("avatar-group flex shrink-0 items-center gap-2",a)},t),{children:s}))}function U(r){var e=r,{src:s,alt:a,fallback:t="?",className:d,tooltip:m}=e,g=o(e,["src","alt","fallback","className","tooltip"]);const f=n.jsxs(p.Avatar,c(l({size:"sm",tabIndex:m?0:void 0,className:i.cn("ring-2 ring-background",m&&"outline-none focus-visible:ring-4 focus-visible:ring-state-focus",d)},g),{children:[n.jsx(p.AvatarImage,{src:s,alt:a!=null?a:typeof m=="string"?m:""}),n.jsx(p.AvatarFallback,{children:t})]}));return m?n.jsx(x.TooltipProvider,{children:n.jsxs(x.Tooltip,{children:[n.jsx(x.TooltipTrigger,{asChild:!0,children:f}),n.jsx(x.TooltipContent,{children:m})]})}):f}function V(r){var e=r,{children:s,className:a,icon:t}=e,d=o(e,["children","className","icon"]);return n.jsx("td",c(l({className:"px-5 py-4 align-middle"},d),{children:n.jsx(v.Tag,{variant:"regular-soft",className:a,icon:t,children:s})}))}function _({className:r,percentage:e,label:s}){return n.jsx("div",{role:"progressbar","aria-label":s,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i.clampPercentage(e)),className:i.cn("relative h-0.5 w-full overflow-hidden rounded-pill bg-gray-stroke-muted",r),children:n.jsx("div",{className:i.cn("absolute inset-y-0 left-0 rounded-pill bg-primary-stroke transition-[width] duration-300 motion-reduce:transition-none"),style:{width:`${i.clampPercentage(e)}%`}})})}function ee(r){var e=r,{questions:s,answered:a,className:t}=e,d=o(e,["questions","answered","className"]);const m=a>0&&s>0?i.clampPercentage(a/s*100):0;return a===0?n.jsx("td",c(l({className:"px-5 py-4 align-middle"},d),{children:n.jsx("div",{className:i.cn("flex min-w-[140px] flex-col items-start justify-center gap-2",t),children:n.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-2 text-xs font-medium text-gray-foreground-muted",children:[n.jsx("div",{className:"flex size-4 items-center justify-center rounded-full bg-gray-background-soft",children:n.jsx(u.RemoveMinus,{className:"size-3 text-gray-foreground",strokeWidth:2.6})}),n.jsx("span",{className:"whitespace-nowrap font-medium text-gray-foreground-muted",children:"N\xE3o iniciado"})]})})})):n.jsx("td",c(l({className:"px-5 py-4 align-middle"},d),{children:n.jsxs("div",{className:i.cn("flex min-w-[140px] flex-col items-start justify-center gap-2",t),children:[n.jsx("div",{className:"flex shrink-0 items-center gap-0.5 text-xs leading-xs",children:n.jsxs("span",{className:"relative shrink-0 whitespace-nowrap font-medium text-gray-foreground-muted",children:[n.jsx("span",{className:"font-semibold text-gray-foreground",children:a})," ",a>1?"respondidas":"respondida"]})}),n.jsx(_,{percentage:m,label:`${a} ${a>1?"respondidas":"respondida"}`})]})}))}const re={notStarted:{icon:u.RemoveMinus,bgColor:"bg-gray-background-soft",iconColor:"text-gray-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:()=>"N\xE3o iniciado",subtitle:()=>""},minNotReached:{icon:u.Warning,bgColor:"bg-feedback-warning-background-soft",iconColor:"text-feedback-warning-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:()=>"M\xEDnimo n\xE3o atingido",subtitle:({remainingQuestions:r})=>r>1?`Faltam ${r} quest\xF5es`:`Falta ${r} quest\xE3o`},dominated:{icon:u.Check,statusLabel:"Dominado",bgColor:"bg-feedback-success-background-soft",iconColor:"text-feedback-success-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:({progress:r})=>n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"font-semibold text-gray-foreground",children:[Math.round(r),"%"]})," ","de ",r>1?"acertos":"acerto"]}),subtitle:({correct:r,answered:e})=>`${r} de ${e} acertos`},notDominated:{icon:u.CloseMd,statusLabel:"N\xE3o dominado",bgColor:"bg-feedback-error-background-soft",iconColor:"text-feedback-error-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:({progress:r})=>n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"font-semibold text-gray-foreground",children:[Math.round(r),"%"]})," ","de ",r>1?"acertos":"acerto"]}),subtitle:({correct:r,answered:e})=>`${r} de ${e} acertos`}};function ne(r,e,s){return[[r,"notStarted"],[e,"minNotReached"],[s>=80,"dominated"],[!0,"notDominated"]].find(([a])=>a)[1]}function se(r){var e=r,{answered:s,correct:a,minQuestions:t,className:d}=e,m=o(e,["answered","correct","minQuestions","className"]);const g=s>0?a/s*100:0,f=s===0,C=s<t,R=t-s,T=ne(f,C,g),{icon:z,bgColor:P,iconColor:q,titleClassName:O,statusLabel:N,title:$,subtitle:A}=re[T],b={progress:g,correct:a,answered:s,remainingQuestions:R};return n.jsx("td",c(l({className:"px-5 py-4 align-middle"},m),{children:n.jsx("div",{className:i.cn("flex min-w-[140px] flex-col items-start justify-center gap-2",d),children:n.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-2 text-xs font-medium text-gray-foreground-muted",children:[n.jsx("div",{className:i.cn("flex size-4 items-center justify-center rounded-full",P),children:n.jsx(z,{"aria-hidden":"true",className:i.cn("size-3",q),strokeWidth:2.6})}),n.jsxs("div",{className:"flex flex-col items-start justify-center",children:[N&&n.jsxs("span",{className:"sr-only",children:[N,": "]}),n.jsx("span",{className:i.cn("whitespace-nowrap",O),children:$(b)}),n.jsx("span",{className:"whitespace-nowrap text-xxs font-semibold text-gray-foreground-muted",children:A(b)})]})]})})}))}function ae(r){var e=r,{children:s,className:a,onClick:t}=e,d=o(e,["children","className","onClick"]);return n.jsx("td",{className:"px-5 py-4 align-middle",children:n.jsx(j.Button,c(l({variant:"regular-soft",size:"sm",iconRight:n.jsx(u.ArrowRightMd,{className:"size-4"}),onClick:t,className:a},d),{children:s}))})}exports.Ranking=I,exports.RankingAssigneeGroup=K,exports.RankingAssigneeItem=U,exports.RankingAssigneeLabel=J,exports.RankingAssigneesColumn=Z,exports.RankingBody=S,exports.RankingButton=ae,exports.RankingHeader=B,exports.RankingHeaderCell=D,exports.RankingItem=L,exports.RankingNumber=Q,exports.RankingPerformance=se,exports.RankingPriority=V,exports.RankingQuestions=ee,exports.RankingSpecialty=H,exports.RankingSuperFocus=Y,exports.RankingTopic=X,exports.RankingTopicColumn=W,exports.RankingTopicContent=G;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsx as s,jsxs as d,Fragment as b}from"react/jsx-runtime";import{cn as i,clampPercentage as p}from"../lib/utils.mjs";import{ArrowRightMd as q,Info as L,CloseMd as Q,Check as B,Warning as W,RemoveMinus as v,CheckboxFill as G}from"@medway-ui/icons";import{Button as y}from"./Button.mjs";import{Avatar as H,AvatarImage as X,AvatarFallback as Y}from"./Avatar.mjs";import{Tag as k}from"./Tag.mjs";import{TooltipProvider as w,Tooltip as C,TooltipTrigger as R,TooltipContent as j}from"./Tooltip.mjs";var Z=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,O=(r,e,a)=>e in r?Z(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,l=(r,e)=>{for(var a in e||(e={}))z.call(e,a)&&O(r,a,e[a]);if(h)for(var a of h(e))$.call(e,a)&&O(r,a,e[a]);return r},o=(r,e)=>J(r,K(e)),c=(r,e)=>{var a={};for(var n in r)z.call(r,n)&&e.indexOf(n)<0&&(a[n]=r[n]);if(r!=null&&h)for(var n of h(r))e.indexOf(n)<0&&$.call(r,n)&&(a[n]=r[n]);return a};function U(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("div",{className:"w-full overflow-x-auto rounded-lg border border-gray-stroke-muted",children:s("table",o(l({className:i("w-full border-collapse text-left",n)},t),{children:a}))})}function V(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("thead",o(l({className:i("h-11 border-b border-gray-stroke-muted bg-surface-card",n)},t),{children:s("tr",{children:a})}))}function _(r){var e=r,{children:a,className:n,tooltip:t,highlight:m}=e,u=c(e,["children","className","tooltip","highlight"]);return s("th",o(l({className:i("text-ellipsis whitespace-nowrap px-5 text-sm font-semibold text-gray-foreground first:pr-0",n)},u),{children:d("div",{className:"flex items-center gap-1.5",children:[s("span",{className:i(m&&"flex size-7 shrink-0 items-center justify-center rounded-full bg-primary-foreground-onfill"),children:a}),t&&s(w,{children:d(C,{children:[s(R,{asChild:!0,children:s(y,{type:"button",variant:"regular-basic",size:"sm","aria-label":t,className:"!h-6 !min-h-6 !w-6 !min-w-6 !p-0 text-gray-foreground",iconLeft:s(L,{"aria-hidden":"true",className:"size-4"})})}),s(j,{children:t})]})})]})}))}function ee(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("tbody",o(l({className:i("bg-surface-card",n)},t),{children:a}))}function re(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("tr",o(l({className:i("w-full border-t border-solid border-gray-stroke-muted first:border-t-0",n)},t),{children:a}))}function ae(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("td",{className:"py-4 pl-5 align-middle",children:s("div",o(l({className:i("flex size-7 shrink-0 items-center justify-center overflow-hidden whitespace-nowrap rounded-full bg-primary-foreground text-sm font-semibold text-primary-foreground-onfill",n)},t),{children:a}))})}function ne(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("td",o(l({className:"px-5 py-4 align-middle"},t),{children:s("div",{className:i("flex items-center gap-5",n),children:s("div",{className:"flex shrink-0 items-center gap-5 pr-8",children:a})})}))}function se(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("div",o(l({className:i("flex shrink-0 flex-col items-start whitespace-nowrap text-gray-foreground",n)},t),{children:a}))}function te(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("span",o(l({className:i("shrink-0 overflow-hidden text-ellipsis font-sans text-xxs font-medium leading-xxs",n)},t),{children:a}))}function ie(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("span",o(l({className:i("shrink-0 overflow-hidden text-ellipsis font-sans text-sm font-semibold leading-sm",n)},t),{children:a}))}function le(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s(k,o(l({className:i("bg-gradient-to-r from-cm-24 to-secondary-24 text-primary-foreground",n)},t),{icon:s(G,{className:"text-primary-foreground"}),children:a}))}function oe(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("td",o(l({className:"px-5 py-4 align-middle"},t),{children:s("div",{className:i("flex flex-col items-start gap-2",n),children:a})}))}function ce(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("p",o(l({className:i("relative shrink-0 overflow-hidden text-ellipsis whitespace-nowrap text-xxs font-medium leading-xxs text-gray-foreground",n)},t),{children:a}))}function de(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("div",o(l({className:i("avatar-group flex shrink-0 items-center gap-2",n)},t),{children:a}))}function me(r){var e=r,{src:a,alt:n,fallback:t="?",className:m,tooltip:u}=e,f=c(e,["src","alt","fallback","className","tooltip"]);const g=d(H,o(l({size:"sm",tabIndex:u?0:void 0,className:i("ring-2 ring-background",u&&"outline-none focus-visible:ring-4 focus-visible:ring-state-focus",m)},f),{children:[s(X,{src:a,alt:n!=null?n:typeof u=="string"?u:""}),s(Y,{children:t})]}));return u?s(w,{children:d(C,{children:[s(R,{asChild:!0,children:g}),s(j,{children:u})]})}):g}function ue(r){var e=r,{children:a,className:n,icon:t}=e,m=c(e,["children","className","icon"]);return s("td",o(l({className:"px-5 py-4 align-middle"},m),{children:s(k,{variant:"regular-soft",className:n,icon:t,children:a})}))}function fe({className:r,percentage:e,label:a}){return s("div",{role:"progressbar","aria-label":a,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(p(e)),className:i("relative h-0.5 w-full overflow-hidden rounded-pill bg-gray-stroke-muted",r),children:s("div",{className:i("absolute inset-y-0 left-0 rounded-pill bg-primary-stroke transition-[width] duration-300 motion-reduce:transition-none"),style:{width:`${p(e)}%`}})})}function ge(r){var e=r,{questions:a,answered:n,className:t}=e,m=c(e,["questions","answered","className"]);const u=n>0&&a>0?p(n/a*100):0;return n===0?s("td",o(l({className:"px-5 py-4 align-middle"},m),{children:s("div",{className:i("flex min-w-[140px] flex-col items-start justify-center gap-2",t),children:d("div",{className:"flex shrink-0 items-center justify-center gap-2 text-xs font-medium text-gray-foreground-muted",children:[s("div",{className:"flex size-4 items-center justify-center rounded-full bg-gray-background-soft",children:s(v,{className:"size-3 text-gray-foreground",strokeWidth:2.6})}),s("span",{className:"whitespace-nowrap font-medium text-gray-foreground-muted",children:"N\xE3o iniciado"})]})})})):s("td",o(l({className:"px-5 py-4 align-middle"},m),{children:d("div",{className:i("flex min-w-[140px] flex-col items-start justify-center gap-2",t),children:[s("div",{className:"flex shrink-0 items-center gap-0.5 text-xs leading-xs",children:d("span",{className:"relative shrink-0 whitespace-nowrap font-medium text-gray-foreground-muted",children:[s("span",{className:"font-semibold text-gray-foreground",children:n})," ",n>1?"respondidas":"respondida"]})}),s(fe,{percentage:u,label:`${n} ${n>1?"respondidas":"respondida"}`})]})}))}const he={notStarted:{icon:v,bgColor:"bg-gray-background-soft",iconColor:"text-gray-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:()=>"N\xE3o iniciado",subtitle:()=>""},minNotReached:{icon:W,bgColor:"bg-feedback-warning-background-soft",iconColor:"text-feedback-warning-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:()=>"M\xEDnimo n\xE3o atingido",subtitle:({remainingQuestions:r})=>r>1?`Faltam ${r} quest\xF5es`:`Falta ${r} quest\xE3o`},dominated:{icon:B,statusLabel:"Dominado",bgColor:"bg-feedback-success-background-soft",iconColor:"text-feedback-success-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:({progress:r})=>d(b,{children:[d("span",{className:"font-semibold text-gray-foreground",children:[Math.round(r),"%"]})," ","de ",r>1?"acertos":"acerto"]}),subtitle:({correct:r,answered:e})=>`${r} de ${e} acertos`},notDominated:{icon:Q,statusLabel:"N\xE3o dominado",bgColor:"bg-feedback-error-background-soft",iconColor:"text-feedback-error-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:({progress:r})=>d(b,{children:[d("span",{className:"font-semibold text-gray-foreground",children:[Math.round(r),"%"]})," ","de ",r>1?"acertos":"acerto"]}),subtitle:({correct:r,answered:e})=>`${r} de ${e} acertos`}};function pe(r,e,a){return[[r,"notStarted"],[e,"minNotReached"],[a>=80,"dominated"],[!0,"notDominated"]].find(([n])=>n)[1]}function xe(r){var e=r,{answered:a,correct:n,minQuestions:t,className:m}=e,u=c(e,["answered","correct","minQuestions","className"]);const f=a>0?n/a*100:0,g=a===0,T=a<t,P=t-a,A=pe(g,T,f),{icon:E,bgColor:F,iconColor:M,titleClassName:I,statusLabel:x,title:D,subtitle:S}=he[A],N={progress:f,correct:n,answered:a,remainingQuestions:P};return s("td",o(l({className:"px-5 py-4 align-middle"},u),{children:s("div",{className:i("flex min-w-[140px] flex-col items-start justify-center gap-2",m),children:d("div",{className:"flex shrink-0 items-center justify-center gap-2 text-xs font-medium text-gray-foreground-muted",children:[s("div",{className:i("flex size-4 items-center justify-center rounded-full",F),children:s(E,{"aria-hidden":"true",className:i("size-3",M),strokeWidth:2.6})}),d("div",{className:"flex flex-col items-start justify-center",children:[x&&d("span",{className:"sr-only",children:[x,": "]}),s("span",{className:i("whitespace-nowrap",I),children:D(N)}),s("span",{className:"whitespace-nowrap text-xxs font-semibold text-gray-foreground-muted",children:S(N)})]})]})})}))}function Ne(r){var e=r,{children:a,className:n,onClick:t}=e,m=c(e,["children","className","onClick"]);return s("td",{className:"px-5 py-4 align-middle",children:s(y,o(l({variant:"regular-soft",size:"sm",iconRight:s(q,{className:"size-4"}),onClick:t,className:n},m),{children:a}))})}export{U as Ranking,de as RankingAssigneeGroup,me as RankingAssigneeItem,ce as RankingAssigneeLabel,oe as RankingAssigneesColumn,ee as RankingBody,Ne as RankingButton,V as RankingHeader,_ as RankingHeaderCell,re as RankingItem,ae as RankingNumber,xe as RankingPerformance,ue as RankingPriority,ge as RankingQuestions,te as RankingSpecialty,le as RankingSuperFocus,ie as RankingTopic,ne as RankingTopicColumn,se as RankingTopicContent};
|
|
3
|
+
import{jsx as s,jsxs as d,Fragment as b}from"react/jsx-runtime";import{cn as i,clampPercentage as p}from"../lib/utils.mjs";import{ArrowRightMd as q,Info as L,CloseMd as Q,Check as B,Warning as W,RemoveMinus as v,CheckboxFill as G}from"@medway-ui/icons";import{Button as y}from"./Button.mjs";import{Avatar as H,AvatarImage as X,AvatarFallback as Y}from"./Avatar.mjs";import{Tag as k}from"./Tag.mjs";import{TooltipProvider as w,Tooltip as C,TooltipTrigger as R,TooltipContent as j}from"./Tooltip.mjs";var Z=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,O=(r,e,a)=>e in r?Z(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,l=(r,e)=>{for(var a in e||(e={}))z.call(e,a)&&O(r,a,e[a]);if(h)for(var a of h(e))$.call(e,a)&&O(r,a,e[a]);return r},o=(r,e)=>J(r,K(e)),c=(r,e)=>{var a={};for(var n in r)z.call(r,n)&&e.indexOf(n)<0&&(a[n]=r[n]);if(r!=null&&h)for(var n of h(r))e.indexOf(n)<0&&$.call(r,n)&&(a[n]=r[n]);return a};function U(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("div",{className:"w-full overflow-x-auto rounded-lg border border-gray-stroke-muted",children:s("table",o(l({className:i("w-full border-collapse text-left",n)},t),{children:a}))})}function V(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("thead",o(l({className:i("h-11 border-b border-gray-stroke-muted bg-surface-card",n)},t),{children:s("tr",{children:a})}))}function _(r){var e=r,{children:a,className:n,tooltip:t,highlight:m}=e,u=c(e,["children","className","tooltip","highlight"]);return s("th",o(l({className:i("text-ellipsis whitespace-nowrap px-5 text-sm font-semibold text-gray-foreground first:pr-0",n)},u),{children:d("div",{className:"flex items-center gap-1.5",children:[s("span",{className:i(m&&"flex size-7 shrink-0 items-center justify-center rounded-full bg-primary-foreground-onfill"),children:a}),t&&s(w,{children:d(C,{children:[s(R,{asChild:!0,children:s(y,{type:"button",variant:"regular-basic",size:"sm","aria-label":t,className:"!h-6 !min-h-6 !w-6 !min-w-6 !p-0 text-gray-foreground",iconLeft:s(L,{"aria-hidden":"true",className:"size-4"})})}),s(j,{children:t})]})})]})}))}function ee(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("tbody",o(l({className:i("bg-surface-card",n)},t),{children:a}))}function re(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("tr",o(l({className:i("w-full border-t border-solid border-gray-stroke-muted first:border-t-0",n)},t),{children:a}))}function ae(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("td",{className:"py-4 pl-5 align-middle",children:s("div",o(l({className:i("flex size-7 shrink-0 items-center justify-center overflow-hidden whitespace-nowrap rounded-full bg-primary-foreground text-sm font-semibold text-primary-foreground-onfill",n)},t),{children:a}))})}function ne(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("td",o(l({className:"px-5 py-4 align-middle"},t),{children:s("div",{className:i("flex items-center gap-5",n),children:s("div",{className:"flex shrink-0 items-center gap-5 pr-8",children:a})})}))}function se(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("div",o(l({className:i("flex shrink-0 flex-col items-start whitespace-nowrap text-gray-foreground",n)},t),{children:a}))}function te(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("span",o(l({className:i("shrink-0 overflow-hidden text-ellipsis font-sans text-xxs font-medium leading-xxs",n)},t),{children:a}))}function ie(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("span",o(l({className:i("shrink-0 overflow-hidden text-ellipsis font-sans text-sm font-semibold leading-sm",n)},t),{children:a}))}function le(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s(k,o(l({className:i("bg-gradient-to-r from-cm-24 to-secondary-24 text-primary-foreground",n)},t),{icon:s(G,{className:"text-primary-foreground"}),children:a}))}function oe(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("td",o(l({className:"px-5 py-4 align-middle"},t),{children:s("div",{className:i("flex flex-col items-start gap-2",n),children:a})}))}function ce(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("span",o(l({className:i("relative block shrink-0 overflow-hidden text-ellipsis whitespace-nowrap text-xxs font-medium leading-xxs text-gray-foreground",n)},t),{children:a}))}function de(r){var e=r,{children:a,className:n}=e,t=c(e,["children","className"]);return s("div",o(l({className:i("avatar-group flex shrink-0 items-center gap-2",n)},t),{children:a}))}function me(r){var e=r,{src:a,alt:n,fallback:t="?",className:m,tooltip:u}=e,f=c(e,["src","alt","fallback","className","tooltip"]);const g=d(H,o(l({size:"sm",tabIndex:u?0:void 0,className:i("ring-2 ring-background",u&&"outline-none focus-visible:ring-4 focus-visible:ring-state-focus",m)},f),{children:[s(X,{src:a,alt:n!=null?n:typeof u=="string"?u:""}),s(Y,{children:t})]}));return u?s(w,{children:d(C,{children:[s(R,{asChild:!0,children:g}),s(j,{children:u})]})}):g}function ue(r){var e=r,{children:a,className:n,icon:t}=e,m=c(e,["children","className","icon"]);return s("td",o(l({className:"px-5 py-4 align-middle"},m),{children:s(k,{variant:"regular-soft",className:n,icon:t,children:a})}))}function fe({className:r,percentage:e,label:a}){return s("div",{role:"progressbar","aria-label":a,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(p(e)),className:i("relative h-0.5 w-full overflow-hidden rounded-pill bg-gray-stroke-muted",r),children:s("div",{className:i("absolute inset-y-0 left-0 rounded-pill bg-primary-stroke transition-[width] duration-300 motion-reduce:transition-none"),style:{width:`${p(e)}%`}})})}function ge(r){var e=r,{questions:a,answered:n,className:t}=e,m=c(e,["questions","answered","className"]);const u=n>0&&a>0?p(n/a*100):0;return n===0?s("td",o(l({className:"px-5 py-4 align-middle"},m),{children:s("div",{className:i("flex min-w-[140px] flex-col items-start justify-center gap-2",t),children:d("div",{className:"flex shrink-0 items-center justify-center gap-2 text-xs font-medium text-gray-foreground-muted",children:[s("div",{className:"flex size-4 items-center justify-center rounded-full bg-gray-background-soft",children:s(v,{className:"size-3 text-gray-foreground",strokeWidth:2.6})}),s("span",{className:"whitespace-nowrap font-medium text-gray-foreground-muted",children:"N\xE3o iniciado"})]})})})):s("td",o(l({className:"px-5 py-4 align-middle"},m),{children:d("div",{className:i("flex min-w-[140px] flex-col items-start justify-center gap-2",t),children:[s("div",{className:"flex shrink-0 items-center gap-0.5 text-xs leading-xs",children:d("span",{className:"relative shrink-0 whitespace-nowrap font-medium text-gray-foreground-muted",children:[s("span",{className:"font-semibold text-gray-foreground",children:n})," ",n>1?"respondidas":"respondida"]})}),s(fe,{percentage:u,label:`${n} ${n>1?"respondidas":"respondida"}`})]})}))}const he={notStarted:{icon:v,bgColor:"bg-gray-background-soft",iconColor:"text-gray-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:()=>"N\xE3o iniciado",subtitle:()=>""},minNotReached:{icon:W,bgColor:"bg-feedback-warning-background-soft",iconColor:"text-feedback-warning-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:()=>"M\xEDnimo n\xE3o atingido",subtitle:({remainingQuestions:r})=>r>1?`Faltam ${r} quest\xF5es`:`Falta ${r} quest\xE3o`},dominated:{icon:B,statusLabel:"Dominado",bgColor:"bg-feedback-success-background-soft",iconColor:"text-feedback-success-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:({progress:r})=>d(b,{children:[d("span",{className:"font-semibold text-gray-foreground",children:[Math.round(r),"%"]})," ","de ",r>1?"acertos":"acerto"]}),subtitle:({correct:r,answered:e})=>`${r} de ${e} acertos`},notDominated:{icon:Q,statusLabel:"N\xE3o dominado",bgColor:"bg-feedback-error-background-soft",iconColor:"text-feedback-error-foreground",titleClassName:"font-medium text-gray-foreground-muted",title:({progress:r})=>d(b,{children:[d("span",{className:"font-semibold text-gray-foreground",children:[Math.round(r),"%"]})," ","de ",r>1?"acertos":"acerto"]}),subtitle:({correct:r,answered:e})=>`${r} de ${e} acertos`}};function pe(r,e,a){return[[r,"notStarted"],[e,"minNotReached"],[a>=80,"dominated"],[!0,"notDominated"]].find(([n])=>n)[1]}function xe(r){var e=r,{answered:a,correct:n,minQuestions:t,className:m}=e,u=c(e,["answered","correct","minQuestions","className"]);const f=a>0?n/a*100:0,g=a===0,T=a<t,P=t-a,A=pe(g,T,f),{icon:E,bgColor:F,iconColor:M,titleClassName:I,statusLabel:x,title:D,subtitle:S}=he[A],N={progress:f,correct:n,answered:a,remainingQuestions:P};return s("td",o(l({className:"px-5 py-4 align-middle"},u),{children:s("div",{className:i("flex min-w-[140px] flex-col items-start justify-center gap-2",m),children:d("div",{className:"flex shrink-0 items-center justify-center gap-2 text-xs font-medium text-gray-foreground-muted",children:[s("div",{className:i("flex size-4 items-center justify-center rounded-full",F),children:s(E,{"aria-hidden":"true",className:i("size-3",M),strokeWidth:2.6})}),d("div",{className:"flex flex-col items-start justify-center",children:[x&&d("span",{className:"sr-only",children:[x,": "]}),s("span",{className:i("whitespace-nowrap",I),children:D(N)}),s("span",{className:"whitespace-nowrap text-xxs font-semibold text-gray-foreground-muted",children:S(N)})]})]})})}))}function Ne(r){var e=r,{children:a,className:n,onClick:t}=e,m=c(e,["children","className","onClick"]);return s("td",{className:"px-5 py-4 align-middle",children:s(y,o(l({variant:"regular-soft",size:"sm",iconRight:s(q,{className:"size-4"}),onClick:t,className:n},m),{children:a}))})}export{U as Ranking,de as RankingAssigneeGroup,me as RankingAssigneeItem,ce as RankingAssigneeLabel,oe as RankingAssigneesColumn,ee as RankingBody,Ne as RankingButton,V as RankingHeader,_ as RankingHeaderCell,re as RankingItem,ae as RankingNumber,xe as RankingPerformance,ue as RankingPriority,ge as RankingQuestions,te as RankingSpecialty,le as RankingSuperFocus,ie as RankingTopic,ne as RankingTopicColumn,se as RankingTopicContent};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var r=require("react/jsx-runtime"),s=require("react"),K=require("@medway-ui/icons"),G=require("./Button.js"),Oe=require("./Checkbox.js"),Re=require("./ConfirmDeleteButton.js"),M=require("./Input.js"),_=require("./Popover.js"),ce=require("./Separator.js"),ue=require("./Tag.js"),Ae=require("../hooks/use-id.js"),D=require("../lib/utils.js"),Ve=Object.defineProperty,de=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable,me=(a,n,l)=>n in a?Ve(a,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[n]=l,ge=(a,n)=>{for(var l in n||(n={}))Le.call(n,l)&&me(a,l,n[l]);if(de)for(var l of de(n))Fe.call(n,l)&&me(a,l,n[l]);return a};const fe=Object.freeze(["regular","emphasis","success","warning","error","gray","success-soft","warning-soft","error-soft","gray-soft","cm","cir","go","ped","prev","ia"]),Ke={regular:"Azul-marinho",emphasis:"Verde-\xE1gua",gray:"Cinza",success:"Verde",warning:"Amarelo",error:"Vermelho",cm:"Cl\xEDnica m\xE9dica",cir:"Cirurgia",go:"Ginecologia e obstetr\xEDcia",ped:"Pediatria",prev:"Preventiva",ia:"IA"},Ge={soft:"suave",basic:"sem fundo"};function Me(a){var n,l;const[f,m]=a.split("-"),d=(n=Ke[f])!=null?n:f;return m?`${d} ${(l=Ge[m])!=null?l:m}`:d}const _e={trigger:"Adicionar tag",searchPlaceholder:"Buscar...",createPlaceholder:"Criar nova tag...",create:"Criar",loading:"Carregando...",empty:"Nenhuma tag criada ainda.",noResults:"Nenhuma tag encontrada.",confirmDelete:"Confirmar",cancelDelete:"Cancelar exclus\xE3o",newTagColor:"Cor da nova tag",renameTag:a=>`Renomear tag ${a}`,changeTagColor:a=>`Trocar cor da tag ${a}`,tagColor:a=>`Cor da tag ${a}`,deleteTag:a=>`Excluir tag ${a}`,confirmDeleteTag:a=>`Confirmar exclus\xE3o da tag ${a}`,variantName:Me},he=a=>a.normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase();async function Q(a){try{return{ok:!0,value:await a()}}catch(n){return{ok:!1}}}const pe=a=>a.key==="Enter"&&!a.nativeEvent.isComposing,X=a=>{const n=document.getElementById(a);return!!(n&&n.contains(document.activeElement))};function ve({id:a,value:n,variants:l,onChange:f,label:m,variantName:d,busy:h=!1}){return r.jsx("div",{id:a,role:"group","aria-label":m,"aria-busy":h||void 0,"data-slot":"tag-picker-swatches",className:"grid w-full grid-cols-8 gap-2 px-2 py-2",children:l.map(g=>r.jsx("button",{type:"button",title:d(g),"aria-label":d(g),"aria-pressed":n===g,"aria-disabled":h||void 0,onClick:()=>{h||f(g)},className:D.cn(ue.tagVariants({variant:g}),"relative size-5 shrink-0 cursor-pointer overflow-visible rounded-full border p-0 outline-none after:absolute after:-inset-0.5 after:rounded-full focus-visible:ring-[3px] focus-visible:ring-state-focus aria-disabled:cursor-default aria-disabled:opacity-50",n===g&&"ring-2 ring-primary-foreground ring-offset-1 ring-offset-surface-card focus-visible:ring-2")},g))})}function Qe({tags:a,selectedIds:n,onToggle:l,onCreate:f,onRename:m,onChangeVariant:d,onDelete:h,variants:g=fe,defaultVariant:I="gray-soft",loading:xe=!1,disabled:be=!1,children:Y,align:ye="start",contentClassName:Ce,labels:je,open:z,defaultOpen:Z,onOpenChange:U,modal:we=!1}){const i=ge(ge({},_e),je),y=Ae.useId(),c={search:`${y}-search`,checkbox:e=>`${y}-${e}`,renameButton:e=>`${y}-${e}-rename`,renameInput:e=>`${y}-${e}-rename-input`,colorButton:e=>`${y}-${e}-color`,swatches:e=>`${y}-${e}-swatches`},[Ne
|
|
3
|
+
"use strict";var r=require("react/jsx-runtime"),s=require("react"),K=require("@medway-ui/icons"),G=require("./Button.js"),Oe=require("./Checkbox.js"),Re=require("./ConfirmDeleteButton.js"),M=require("./Input.js"),_=require("./Popover.js"),ce=require("./Separator.js"),ue=require("./Tag.js"),Ae=require("../hooks/use-id.js"),D=require("../lib/utils.js"),Ve=Object.defineProperty,de=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable,me=(a,n,l)=>n in a?Ve(a,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):a[n]=l,ge=(a,n)=>{for(var l in n||(n={}))Le.call(n,l)&&me(a,l,n[l]);if(de)for(var l of de(n))Fe.call(n,l)&&me(a,l,n[l]);return a};const fe=Object.freeze(["regular","emphasis","success","warning","error","gray","success-soft","warning-soft","error-soft","gray-soft","cm","cir","go","ped","prev","ia"]),Ke={regular:"Azul-marinho",emphasis:"Verde-\xE1gua",gray:"Cinza",success:"Verde",warning:"Amarelo",error:"Vermelho",cm:"Cl\xEDnica m\xE9dica",cir:"Cirurgia",go:"Ginecologia e obstetr\xEDcia",ped:"Pediatria",prev:"Preventiva",ia:"IA"},Ge={soft:"suave",basic:"sem fundo"};function Me(a){var n,l;const[f,m]=a.split("-"),d=(n=Ke[f])!=null?n:f;return m?`${d} ${(l=Ge[m])!=null?l:m}`:d}const _e={trigger:"Adicionar tag",searchPlaceholder:"Buscar...",createPlaceholder:"Criar nova tag...",create:"Criar",loading:"Carregando...",empty:"Nenhuma tag criada ainda.",noResults:"Nenhuma tag encontrada.",confirmDelete:"Confirmar",cancelDelete:"Cancelar exclus\xE3o",newTagColor:"Cor da nova tag",renameTag:a=>`Renomear tag ${a}`,changeTagColor:a=>`Trocar cor da tag ${a}`,tagColor:a=>`Cor da tag ${a}`,deleteTag:a=>`Excluir tag ${a}`,confirmDeleteTag:a=>`Confirmar exclus\xE3o da tag ${a}`,variantName:Me},he=a=>a.normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase();async function Q(a){try{return{ok:!0,value:await a()}}catch(n){return{ok:!1}}}const pe=a=>a.key==="Enter"&&!a.nativeEvent.isComposing,X=a=>{const n=document.getElementById(a);return!!(n&&n.contains(document.activeElement))};function ve({id:a,value:n,variants:l,onChange:f,label:m,variantName:d,busy:h=!1}){return r.jsx("div",{id:a,role:"group","aria-label":m,"aria-busy":h||void 0,"data-slot":"tag-picker-swatches",className:"grid w-full grid-cols-8 gap-2 px-2 py-2",children:l.map(g=>r.jsx("button",{type:"button",title:d(g),"aria-label":d(g),"aria-pressed":n===g,"aria-disabled":h||void 0,onClick:()=>{h||f(g)},className:D.cn(ue.tagVariants({variant:g}),"relative size-5 shrink-0 cursor-pointer overflow-visible rounded-full border p-0 outline-none after:absolute after:-inset-0.5 after:rounded-full focus-visible:ring-[3px] focus-visible:ring-state-focus aria-disabled:cursor-default aria-disabled:opacity-50",n===g&&"ring-2 ring-primary-foreground ring-offset-1 ring-offset-surface-card focus-visible:ring-2")},g))})}function Qe({tags:a,selectedIds:n,onToggle:l,onCreate:f,onRename:m,onChangeVariant:d,onDelete:h,variants:g=fe,defaultVariant:I="gray-soft",loading:xe=!1,disabled:be=!1,children:Y,align:ye="start",contentClassName:Ce,labels:je,open:z,defaultOpen:Z,onOpenChange:U,modal:we=!1}){const i=ge(ge({},_e),je),y=Ae.useId(),c={search:`${y}-search`,checkbox:e=>`${y}-${e}`,renameButton:e=>`${y}-${e}-rename`,renameInput:e=>`${y}-${e}-rename-input`,colorButton:e=>`${y}-${e}-color`,swatches:e=>`${y}-${e}-swatches`},[ke,Ne]=s.useState(Z!=null?Z:!1),k=z!=null?z:ke,[B,W]=s.useState(""),[N,p]=s.useState(null),[H,v]=s.useState(null),[E,q]=s.useState(null),[J,P]=s.useState(""),[Te,De]=s.useState(()=>new Set),[O,ee]=s.useState(""),[ae,re]=s.useState(I),[S,te]=s.useState(!1),x=s.useRef(null),C=s.useRef(new Set),R=s.useRef(!1),A=s.useRef(null);s.useEffect(()=>{var e;const t=A.current;if(!t)return;A.current=null;const o=document.activeElement;(!o||o===document.body)&&((e=document.getElementById(t))==null||e.focus())});const $=e=>{A.current=e},[Ee,Pe]=s.useState(k);Ee!==k&&(Pe(k),k||(W(""),v(null),p(null),q(null),P(""),x.current=null));const ne=s.useMemo(()=>new Set(n),[n]),ie=s.useMemo(()=>{const e=he(B);return e?a.filter(t=>he(t.name).includes(e)):a},[a,B]),V=e=>{var t;return(t=e.variant)!=null?t:I},j=(e,t)=>{t?C.current.add(e):C.current.delete(e),De(new Set(C.current))},Se=e=>{v(null),p(null),q(e.id),x.current=e.id,P(e.name)},$e=()=>{q(null),x.current=null,P("")},L=(e,t)=>{X(c.renameInput(e))&&$(t),$e()},F=async e=>{if(!m||x.current!==e.id||C.current.has(e.id))return;const t=J.trim();if(!t||t===e.name){L(e.id,c.checkbox(e.id));return}j(e.id,!0);const o=await Q(()=>m(e,t));j(e.id,!1),o.ok&&x.current===e.id&&L(e.id,c.checkbox(e.id))},Ie=async(e,t)=>{if(!d||C.current.has(e.id))return;const o=()=>{X(c.swatches(e.id))&&$(c.colorButton(e.id)),p(b=>b===e.id?null:b)};if(t===V(e)){o();return}j(e.id,!0);const T=await Q(()=>d(e,t));j(e.id,!1),T.ok&&o()},ze=async e=>{if(!(!h||C.current.has(e.id))){j(e.id,!0);try{await h(e)}finally{j(e.id,!1)}$(c.search)}},le=async()=>{const e=O.trim();if(!f||!e||R.current)return;R.current=!0,te(!0);const t=await Q(()=>f({name:e,variant:ae}));if(R.current=!1,te(!1),!t.ok)return;const o=t.value;o&&!ne.has(o.id)&&l(o.id,!0),ee(""),re(I)},Be=e=>{if(!e&&x.current){const t=a.find(o=>o.id===x.current);t&&F(t)}z===void 0&&Ne(e),U==null||U(e)},qe=!!(m||d||h);return r.jsxs(_.Popover,{open:k,onOpenChange:Be,modal:we,children:[r.jsx(_.PopoverTrigger,{asChild:!0,children:Y!=null?Y:r.jsx(G.Button,{type:"button",variant:"outlined",size:"sm",disabled:be,"data-slot":"tag-picker-trigger",className:"border-dashed",iconLeft:r.jsx(K.AddPlus,{"aria-hidden":"true"}),children:i.trigger})}),r.jsxs(_.PopoverContent,{align:ye,"data-slot":"tag-picker-content",onEscapeKeyDown:e=>{E?(e.preventDefault(),L(E,c.renameButton(E))):(H||N)&&(e.preventDefault(),N&&X(c.swatches(N))&&$(c.colorButton(N)),v(null),p(null))},className:D.cn("w-[300px] bg-surface-elevated p-3 pb-2",Ce),children:[r.jsx(M.Input,{id:c.search,size:"md",value:B,onChange:e=>{W(e.target.value),v(null),p(null)},placeholder:i.searchPlaceholder,"aria-label":i.searchPlaceholder,iconLeft:r.jsx(K.SearchMagnifyingGlass,{"aria-hidden":"true"}),className:"h-9 max-h-9 text-sm"}),r.jsx(ce.Separator,{className:"my-2"}),r.jsx("div",{"data-slot":"tag-picker-list",className:"max-h-56 overflow-y-auto",children:xe?r.jsx("span",{className:"block px-2 py-1.5 text-sm text-content-paragraph",children:i.loading}):a.length===0?r.jsx("span",{className:"block px-2 py-1.5 text-sm text-content-paragraph",children:i.empty}):ie.length===0?r.jsx("span",{className:"block px-2 py-1.5 text-sm text-content-paragraph",children:i.noResults}):r.jsx("ul",{className:"flex flex-col gap-1",children:ie.map(e=>{const t=ne.has(e.id),o=E===e.id,T=H===e.id,b=N===e.id,w=Te.has(e.id),se=qe&&!e.locked&&!o;return r.jsxs("li",{className:"group","data-slot":"tag-picker-item",children:[r.jsxs("div",{className:D.cn("flex items-center gap-2 rounded-md px-1.5 py-1.5 transition-colors hover:bg-state-focus",t&&"bg-state-focus"),children:[r.jsx(Oe.Checkbox,{id:c.checkbox(e.id),checked:t,onCheckedChange:u=>l(e.id,u===!0),"aria-label":o?e.name:void 0,size:"md"}),o?r.jsx(M.Input,{id:c.renameInput(e.id),autoFocus:!0,size:"md",value:J,onChange:u=>P(u.target.value),onKeyDown:u=>{pe(u)&&(u.preventDefault(),F(e))},onBlur:()=>void F(e),readOnly:w,"aria-busy":w||void 0,"aria-label":i.renameTag(e.name),className:"h-7 max-h-7 flex-1 text-sm"}):r.jsx("label",{htmlFor:c.checkbox(e.id),className:"min-w-0 flex-1 cursor-pointer truncate text-sm font-semibold text-content-title",children:e.name}),se&&r.jsxs("div",{className:D.cn("flex shrink-0 items-center gap-1.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 [@media(hover:none)]:opacity-100",(T||b)&&"opacity-100"),children:[m&&r.jsx(G.Button,{id:c.renameButton(e.id),type:"button",variant:"regular-basic",size:"sm",title:i.renameTag(e.name),"aria-label":i.renameTag(e.name),disabled:w,onClick:()=>Se(e),iconLeft:r.jsx(K.EditPencil,{size:14,"aria-hidden":"true"})}),d&&r.jsx("button",{id:c.colorButton(e.id),type:"button",title:i.changeTagColor(e.name),"aria-label":i.changeTagColor(e.name),"aria-expanded":b,disabled:w&&!b,onClick:()=>{v(null),p(u=>u===e.id?null:e.id)},className:D.cn(ue.tagVariants({variant:V(e)}),"relative size-4 shrink-0 cursor-pointer overflow-visible rounded-full border p-0 outline-none after:absolute after:-inset-1 after:rounded-full focus-visible:ring-[3px] focus-visible:ring-state-focus")}),h&&r.jsx(Re.ConfirmDeleteButton,{label:i.deleteTag(e.name),confirmLabel:i.confirmDelete,confirmAriaLabel:i.confirmDeleteTag(e.name),cancelLabel:i.cancelDelete,confirming:T,onConfirmingChange:u=>{u?(p(null),v(e.id)):v(oe=>oe===e.id?null:oe)},disabled:w&&!T,onConfirm:()=>ze(e)})]})]}),b&&se&&d&&r.jsx(ve,{id:c.swatches(e.id),label:i.tagColor(e.name),value:V(e),variants:g,variantName:i.variantName,busy:w,onChange:u=>void Ie(e,u)})]},e.id)})})}),f&&r.jsxs(r.Fragment,{children:[r.jsx(ce.Separator,{className:"my-2"}),r.jsxs("div",{className:"flex flex-col gap-2","data-slot":"tag-picker-create",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(M.Input,{size:"md",value:O,onChange:e=>ee(e.target.value),onKeyDown:e=>{pe(e)&&(e.preventDefault(),le())},placeholder:i.createPlaceholder,"aria-label":i.createPlaceholder,readOnly:S,"aria-busy":S||void 0,className:"h-9 max-h-9 flex-1 text-sm"}),r.jsx(G.Button,{type:"button",size:"sm",className:"shrink-0",disabled:!O.trim(),loading:S,onClick:()=>void le(),children:i.create})]}),r.jsx(ve,{label:i.newTagColor,value:ae,variants:g,variantName:i.variantName,busy:S,onChange:re})]})]})]})]})}exports.TAG_PICKER_PALETTE=fe,exports.TagPicker=Qe;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsxs as h,jsx as t,Fragment as Le}from"react/jsx-runtime";import{useState as d,useRef as O,useEffect as Re,useMemo as ce}from"react";import{AddPlus as Se,SearchMagnifyingGlass as Fe,EditPencil as Ke}from"@medway-ui/icons";import{Button as _}from"./Button.mjs";import{Checkbox as Ge}from"./Checkbox.mjs";import{ConfirmDeleteButton as We}from"./ConfirmDeleteButton.mjs";import{Input as M}from"./Input.mjs";import{Popover as _e,PopoverTrigger as Me,PopoverContent as Qe}from"./Popover.mjs";import{Separator as ue}from"./Separator.mjs";import{tagVariants as de}from"./Tag.mjs";import{useId as Xe}from"../hooks/use-id.mjs";import{cn as D}from"../lib/utils.mjs";var Ye=Object.defineProperty,me=Object.getOwnPropertySymbols,Ze=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,fe=(a,n,
|
|
3
|
+
import{jsxs as h,jsx as t,Fragment as Le}from"react/jsx-runtime";import{useState as d,useRef as O,useEffect as Re,useMemo as ce}from"react";import{AddPlus as Se,SearchMagnifyingGlass as Fe,EditPencil as Ke}from"@medway-ui/icons";import{Button as _}from"./Button.mjs";import{Checkbox as Ge}from"./Checkbox.mjs";import{ConfirmDeleteButton as We}from"./ConfirmDeleteButton.mjs";import{Input as M}from"./Input.mjs";import{Popover as _e,PopoverTrigger as Me,PopoverContent as Qe}from"./Popover.mjs";import{Separator as ue}from"./Separator.mjs";import{tagVariants as de}from"./Tag.mjs";import{useId as Xe}from"../hooks/use-id.mjs";import{cn as D}from"../lib/utils.mjs";var Ye=Object.defineProperty,me=Object.getOwnPropertySymbols,Ze=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,fe=(a,n,i)=>n in a?Ye(a,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[n]=i,ge=(a,n)=>{for(var i in n||(n={}))Ze.call(n,i)&&fe(a,i,n[i]);if(me)for(var i of me(n))qe.call(n,i)&&fe(a,i,n[i]);return a};const pe=Object.freeze(["regular","emphasis","success","warning","error","gray","success-soft","warning-soft","error-soft","gray-soft","cm","cir","go","ped","prev","ia"]),Ue={regular:"Azul-marinho",emphasis:"Verde-\xE1gua",gray:"Cinza",success:"Verde",warning:"Amarelo",error:"Vermelho",cm:"Cl\xEDnica m\xE9dica",cir:"Cirurgia",go:"Ginecologia e obstetr\xEDcia",ped:"Pediatria",prev:"Preventiva",ia:"IA"},He={soft:"suave",basic:"sem fundo"};function Je(a){var n,i;const[g,m]=a.split("-"),u=(n=Ue[g])!=null?n:g;return m?`${u} ${(i=He[m])!=null?i:m}`:u}const ea={trigger:"Adicionar tag",searchPlaceholder:"Buscar...",createPlaceholder:"Criar nova tag...",create:"Criar",loading:"Carregando...",empty:"Nenhuma tag criada ainda.",noResults:"Nenhuma tag encontrada.",confirmDelete:"Confirmar",cancelDelete:"Cancelar exclus\xE3o",newTagColor:"Cor da nova tag",renameTag:a=>`Renomear tag ${a}`,changeTagColor:a=>`Trocar cor da tag ${a}`,tagColor:a=>`Cor da tag ${a}`,deleteTag:a=>`Excluir tag ${a}`,confirmDeleteTag:a=>`Confirmar exclus\xE3o da tag ${a}`,variantName:Je},he=a=>a.normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase();async function Q(a){try{return{ok:!0,value:await a()}}catch(n){return{ok:!1}}}const ve=a=>a.key==="Enter"&&!a.nativeEvent.isComposing,X=a=>{const n=document.getElementById(a);return!!(n&&n.contains(document.activeElement))};function be({id:a,value:n,variants:i,onChange:g,label:m,variantName:u,busy:p=!1}){return t("div",{id:a,role:"group","aria-label":m,"aria-busy":p||void 0,"data-slot":"tag-picker-swatches",className:"grid w-full grid-cols-8 gap-2 px-2 py-2",children:i.map(f=>t("button",{type:"button",title:u(f),"aria-label":u(f),"aria-pressed":n===f,"aria-disabled":p||void 0,onClick:()=>{p||g(f)},className:D(de({variant:f}),"relative size-5 shrink-0 cursor-pointer overflow-visible rounded-full border p-0 outline-none after:absolute after:-inset-0.5 after:rounded-full focus-visible:ring-[3px] focus-visible:ring-state-focus aria-disabled:cursor-default aria-disabled:opacity-50",n===f&&"ring-2 ring-primary-foreground ring-offset-1 ring-offset-surface-card focus-visible:ring-2")},f))})}function aa({tags:a,selectedIds:n,onToggle:i,onCreate:g,onRename:m,onChangeVariant:u,onDelete:p,variants:f=pe,defaultVariant:A="gray-soft",loading:ye=!1,disabled:xe=!1,children:Y,align:Ce="start",contentClassName:we,labels:ke,open:V,defaultOpen:Z,onOpenChange:q,modal:Ne=!1}){const l=ge(ge({},ea),ke),C=Xe(),s={search:`${C}-search`,checkbox:e=>`${C}-${e}`,renameButton:e=>`${C}-${e}-rename`,renameInput:e=>`${C}-${e}-rename-input`,colorButton:e=>`${C}-${e}-color`,swatches:e=>`${C}-${e}-swatches`},[$e,Te]=d(Z!=null?Z:!1),$=V!=null?V:$e,[j,U]=d(""),[T,v]=d(null),[H,b]=d(null),[P,L]=d(null),[J,z]=d(""),[Ee,De]=d(()=>new Set),[R,ee]=d(""),[ae,re]=d(A),[I,te]=d(!1),y=O(null),w=O(new Set),S=O(!1),F=O(null);Re(()=>{var e;const r=F.current;if(!r)return;F.current=null;const o=document.activeElement;(!o||o===document.body)&&((e=document.getElementById(r))==null||e.focus())});const B=e=>{F.current=e},[Pe,ze]=d($);Pe!==$&&(ze($),$||(U(""),b(null),v(null),L(null),z(""),y.current=null));const ne=ce(()=>new Set(n),[n]),le=ce(()=>{const e=he(j);return e?a.filter(r=>he(r.name).includes(e)):a},[a,j]),K=e=>{var r;return(r=e.variant)!=null?r:A},k=(e,r)=>{r?w.current.add(e):w.current.delete(e),De(new Set(w.current))},Ie=e=>{b(null),v(null),L(e.id),y.current=e.id,z(e.name)},Be=()=>{L(null),y.current=null,z("")},G=(e,r)=>{X(s.renameInput(e))&&B(r),Be()},W=async e=>{if(!m||y.current!==e.id||w.current.has(e.id))return;const r=J.trim();if(!r||r===e.name){G(e.id,s.checkbox(e.id));return}k(e.id,!0);const o=await Q(()=>m(e,r));k(e.id,!1),o.ok&&y.current===e.id&&G(e.id,s.checkbox(e.id))},Oe=async(e,r)=>{if(!u||w.current.has(e.id))return;const o=()=>{X(s.swatches(e.id))&&B(s.colorButton(e.id)),v(x=>x===e.id?null:x)};if(r===K(e)){o();return}k(e.id,!0);const E=await Q(()=>u(e,r));k(e.id,!1),E.ok&&o()},Ae=async e=>{if(!(!p||w.current.has(e.id))){k(e.id,!0);try{await p(e)}finally{k(e.id,!1)}B(s.search)}},ie=async()=>{const e=R.trim();if(!g||!e||S.current)return;S.current=!0,te(!0);const r=await Q(()=>g({name:e,variant:ae}));if(S.current=!1,te(!1),!r.ok)return;const o=r.value;o&&!ne.has(o.id)&&i(o.id,!0),ee(""),re(A)},Ve=e=>{if(!e&&y.current){const r=a.find(o=>o.id===y.current);r&&W(r)}V===void 0&&Te(e),q==null||q(e)},je=!!(m||u||p);return h(_e,{open:$,onOpenChange:Ve,modal:Ne,children:[t(Me,{asChild:!0,children:Y!=null?Y:t(_,{type:"button",variant:"outlined",size:"sm",disabled:xe,"data-slot":"tag-picker-trigger",className:"border-dashed",iconLeft:t(Se,{"aria-hidden":"true"}),children:l.trigger})}),h(Qe,{align:Ce,"data-slot":"tag-picker-content",onEscapeKeyDown:e=>{P?(e.preventDefault(),G(P,s.renameButton(P))):(H||T)&&(e.preventDefault(),T&&X(s.swatches(T))&&B(s.colorButton(T)),b(null),v(null))},className:D("w-[300px] bg-surface-elevated p-3 pb-2",we),children:[t(M,{id:s.search,size:"md",value:j,onChange:e=>{U(e.target.value),b(null),v(null)},placeholder:l.searchPlaceholder,"aria-label":l.searchPlaceholder,iconLeft:t(Fe,{"aria-hidden":"true"}),className:"h-9 max-h-9 text-sm"}),t(ue,{className:"my-2"}),t("div",{"data-slot":"tag-picker-list",className:"max-h-56 overflow-y-auto",children:ye?t("span",{className:"block px-2 py-1.5 text-sm text-content-paragraph",children:l.loading}):a.length===0?t("span",{className:"block px-2 py-1.5 text-sm text-content-paragraph",children:l.empty}):le.length===0?t("span",{className:"block px-2 py-1.5 text-sm text-content-paragraph",children:l.noResults}):t("ul",{className:"flex flex-col gap-1",children:le.map(e=>{const r=ne.has(e.id),o=P===e.id,E=H===e.id,x=T===e.id,N=Ee.has(e.id),oe=je&&!e.locked&&!o;return h("li",{className:"group","data-slot":"tag-picker-item",children:[h("div",{className:D("flex items-center gap-2 rounded-md px-1.5 py-1.5 transition-colors hover:bg-state-focus",r&&"bg-state-focus"),children:[t(Ge,{id:s.checkbox(e.id),checked:r,onCheckedChange:c=>i(e.id,c===!0),"aria-label":o?e.name:void 0,size:"md"}),o?t(M,{id:s.renameInput(e.id),autoFocus:!0,size:"md",value:J,onChange:c=>z(c.target.value),onKeyDown:c=>{ve(c)&&(c.preventDefault(),W(e))},onBlur:()=>void W(e),readOnly:N,"aria-busy":N||void 0,"aria-label":l.renameTag(e.name),className:"h-7 max-h-7 flex-1 text-sm"}):t("label",{htmlFor:s.checkbox(e.id),className:"min-w-0 flex-1 cursor-pointer truncate text-sm font-semibold text-content-title",children:e.name}),oe&&h("div",{className:D("flex shrink-0 items-center gap-1.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 [@media(hover:none)]:opacity-100",(E||x)&&"opacity-100"),children:[m&&t(_,{id:s.renameButton(e.id),type:"button",variant:"regular-basic",size:"sm",title:l.renameTag(e.name),"aria-label":l.renameTag(e.name),disabled:N,onClick:()=>Ie(e),iconLeft:t(Ke,{size:14,"aria-hidden":"true"})}),u&&t("button",{id:s.colorButton(e.id),type:"button",title:l.changeTagColor(e.name),"aria-label":l.changeTagColor(e.name),"aria-expanded":x,disabled:N&&!x,onClick:()=>{b(null),v(c=>c===e.id?null:e.id)},className:D(de({variant:K(e)}),"relative size-4 shrink-0 cursor-pointer overflow-visible rounded-full border p-0 outline-none after:absolute after:-inset-1 after:rounded-full focus-visible:ring-[3px] focus-visible:ring-state-focus")}),p&&t(We,{label:l.deleteTag(e.name),confirmLabel:l.confirmDelete,confirmAriaLabel:l.confirmDeleteTag(e.name),cancelLabel:l.cancelDelete,confirming:E,onConfirmingChange:c=>{c?(v(null),b(e.id)):b(se=>se===e.id?null:se)},disabled:N&&!E,onConfirm:()=>Ae(e)})]})]}),x&&oe&&u&&t(be,{id:s.swatches(e.id),label:l.tagColor(e.name),value:K(e),variants:f,variantName:l.variantName,busy:N,onChange:c=>void Oe(e,c)})]},e.id)})})}),g&&h(Le,{children:[t(ue,{className:"my-2"}),h("div",{className:"flex flex-col gap-2","data-slot":"tag-picker-create",children:[h("div",{className:"flex items-center gap-2",children:[t(M,{size:"md",value:R,onChange:e=>ee(e.target.value),onKeyDown:e=>{ve(e)&&(e.preventDefault(),ie())},placeholder:l.createPlaceholder,"aria-label":l.createPlaceholder,readOnly:I,"aria-busy":I||void 0,className:"h-9 max-h-9 flex-1 text-sm"}),t(_,{type:"button",size:"sm",className:"shrink-0",disabled:!R.trim(),loading:I,onClick:()=>void ie(),children:l.create})]}),t(be,{label:l.newTagColor,value:ae,variants:f,variantName:l.variantName,busy:I,onChange:re})]})]})]})]})}export{pe as TAG_PICKER_PALETTE,aa as TagPicker};
|