@medway-ui/core 1.43.0 → 1.43.1

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 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.43.0 · Generated 2026-11-06
4
+ > Package `@medway-ui/core` · v1.43.1 · Generated 2026-11-10
5
5
 
6
6
  All components require React 18+ and are client components (`"use client"`).
7
7
 
@@ -1,6 +1,6 @@
1
1
  # @medway-ui/core — Component Summary
2
2
 
3
- > v1.43.0 · For the full prop/variant reference see `COMPONENTS.md`.
3
+ > v1.43.1 · For the full prop/variant reference see `COMPONENTS.md`.
4
4
 
5
5
  ## Components
6
6
 
@@ -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.43.0 · Generated 2026-11-06
4
+ > Package `@medway-ui/core` · v1.43.1 · Generated 2026-11-10
5
5
 
6
6
  All components require React 18+ and are client components (`"use client"`).
7
7
 
@@ -1,6 +1,6 @@
1
1
  # @medway-ui/core — Component Summary
2
2
 
3
- > v1.43.0 · For the full prop/variant reference see `COMPONENTS.md`.
3
+ > v1.43.1 · For the full prop/variant reference see `COMPONENTS.md`.
4
4
 
5
5
  ## Components
6
6
 
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- "use strict";var t=require("react/jsx-runtime"),x=require("@medway-ui/icons"),Z=require("class-variance-authority"),i=require("radix-ui"),d=require("react"),v=require("./Button.js"),$=require("./Separator.js"),C=require("./Tooltip.js"),B=require("../lib/utils.js"),ee=Object.defineProperty,re=Object.defineProperties,te=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,L=(e,r,o)=>r in e?ee(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,E=(e,r)=>{for(var o in r||(r={}))oe.call(r,o)&&L(e,o,r[o]);if(q)for(var o of q(r))ne.call(r,o)&&L(e,o,r[o]);return e},M=(e,r)=>re(e,te(r));const F=Object.freeze(["cm","go","cir","ped","prev"]),ae={cm:"Azul",go:"Rosa",cir:"Verde",ped:"Amarelo",prev:"Roxo"},ie={toolbar:"Marca\xE7\xE3o da sele\xE7\xE3o",color:"Cor",strikethrough:"Riscar",strikethroughHint:"Riscar: passa um tra\xE7o sobre o trecho para destacar o que n\xE3o importa",underline:"Sublinhar",underlineHint:"Sublinhar: passa um tra\xE7o sob o trecho para destacar o que importa",annotate:"Anotar",annotateHint:"Anotar: abre a nota com o trecho selecionado",pin:"Fixar",pinHint:"Fixar: escolha uma cor e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem marcadas com ela",pinArmedHint:"Escolha a cor que vai ficar fixada",unpinHint:"Desafixar: as pr\xF3ximas sele\xE7\xF5es voltam a abrir esta ferramenta",remove:"Remover marca\xE7\xE3o",removeHint:"Remover a marca\xE7\xE3o deste trecho",colorName:e=>ae[e]},le={cm:"bg-cm-background-fill",go:"bg-go-background-fill",cir:"bg-cir-background-fill",ped:"bg-ped-background-fill",prev:"bg-prev-background-fill"},se={cm:"bg-cm-16 dark:bg-cm-48",go:"bg-go-16 dark:bg-go-48",cir:"bg-cir-16 dark:bg-cir-24",ped:"bg-ped-24 dark:bg-ped-48",prev:"bg-prev-16 dark:bg-prev-48"},de=Z.cva("rounded-[2px] [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:M(E({},se),{none:"bg-transparent"}),strikethrough:{true:"text-gray-foreground-muted line-through",false:"text-inherit"},underline:{true:"underline underline-offset-2",false:""}},defaultVariants:{color:"none",strikethrough:!1,underline:!1}}),ce={cm:"aria-pressed:border-cm-background-fill",go:"aria-pressed:border-go-background-fill",cir:"aria-pressed:border-cir-background-fill",ped:"aria-pressed:border-ped-background-fill",prev:"aria-pressed:border-prev-background-fill"},ue="inline-flex items-center gap-2 rounded-pill border border-gray-stroke-muted bg-surface-elevated py-2 pl-3 pr-2 text-gray-foreground shadow-level-1",D="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",pe="aria-pressed:bg-primary-background-fill aria-pressed:text-primary-foreground-onfill aria-pressed:hover:bg-primary-background-fill-emphasis aria-pressed:hover:text-primary-foreground-onfill";function h({label:e,children:r}){return t.jsxs(C.Tooltip,{children:[t.jsx(C.TooltipTrigger,{asChild:!0,children:r}),t.jsx(C.TooltipContent,{side:"bottom",className:"max-w-64",children:e})]})}function be({color:e,pressed:r,name:o,disabled:l,onSelect:c}){return t.jsx(h,{label:o,children:t.jsx(i.Toolbar.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":o,"aria-pressed":r,disabled:l,onClick:()=>c(e),className:B.cn("inline-flex size-8 shrink-0 items-center justify-center rounded-circular border border-transparent p-1 outline-none hover:cursor-pointer focus-visible:ring-[3px] focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",ce[e]),children:t.jsx("span",{"aria-hidden":"true",className:B.cn("size-6 shrink-0 rounded-circular",le[e])})})})}function _(){return t.jsx($.Separator,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function he(e){var r;if("getBoundingClientRect"in e){const p="commonAncestorContainer"in e?e.commonAncestorContainer:e,u=p.nodeType===Node.ELEMENT_NODE?p:(r=p.parentElement)!=null?r:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:u}}const{top:o,left:l,width:c,height:j}=e,m={x:l,y:o,top:o,left:l,width:c,height:j,right:l+c,bottom:o+j};return{getBoundingClientRect:()=>M(E({},m),{toJSON:()=>m})}}function me(){const e=d.useRef(!1);return d.useEffect(()=>{const r=()=>{e.current=!1},o=()=>{e.current=!0};return document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",o,!0)}},[]),e}function V(e,r){return!e||!r||"getBoundingClientRect"in e||"getBoundingClientRect"in r?!1:e.top===r.top&&e.left===r.left&&e.bottom===r.bottom&&e.width===r.width&&e.height===r.height}function ge(e){const[r,o]=d.useState(e);return e!==r&&!V(e,r)&&o(e),V(e,r)?r:e}function fe({open:e=!1,anchor:r=null,mode:o="create",selectedText:l,color:c,colors:j=F,strikethrough:m=!1,underline:p=!1,pinnedColor:u=null,disabled:b=!1,className:U,labels:I,onHighlight:O,onStrikethrough:P,onUnderline:S,onPinnedColorChange:k,onNote:H,onRemove:s,onClose:z}){const n=E(E({},ie),I),J=me(),y=ge(r),g=d.useMemo(()=>y?{current:he(y)}:null,[y]),R=d.useRef(null),T=d.useRef(!1),[A,w]=d.useState(null),[K,W]=d.useState(e);e!==K&&(W(e),e||w(null));const f=e&&A!==null&&A===g,X=!!u||f,G=u?n.unpinHint:f?n.pinArmedHint:n.pinHint,Q=a=>{if(a===c&&!f){s==null||s();return}f&&(w(null),k==null||k(a)),O==null||O(a)},Y=()=>{if(u){k==null||k(null);return}w(f?null:g)};return t.jsxs(i.Popover.Root,{open:e&&!!g,onOpenChange:a=>{a||z==null||z()},children:[g?t.jsx(i.Popover.Anchor,{virtualRef:g}):null,t.jsx(i.Popover.Portal,{children:t.jsx(i.Popover.Content,{asChild:!0,role:"toolbar",side:"top",sideOffset:4,collisionPadding:16,sticky:"always",hideWhenDetached:!0,onOpenAutoFocus:a=>{R.current=document.activeElement instanceof HTMLElement?document.activeElement:null,T.current=!1,J.current||a.preventDefault()},onInteractOutside:()=>{T.current=!0},onCloseAutoFocus:a=>{a.preventDefault();const N=R.current;R.current=null,!T.current&&N!=null&&N.isConnected&&N.focus({preventScroll:!0})},children:t.jsxs(i.Toolbar.Root,{"aria-label":n.toolbar,"data-slot":"text-marker","data-mode":o,"data-text-marker-chrome":"",className:B.cn("z-50",ue,U),children:[t.jsxs(C.TooltipProvider,{delayDuration:200,children:[t.jsx("div",{role:"group","aria-label":n.color,className:"flex items-center gap-2",children:j.map(a=>t.jsx(be,{color:a,name:n.colorName(a),pressed:c===a,disabled:b,onSelect:Q},a))}),t.jsx(_,{}),t.jsx(h,{label:n.strikethroughHint,children:t.jsx(i.Toolbar.Button,{asChild:!0,children:t.jsx(v.Button,{variant:"regular-basic",size:"sm","aria-label":n.strikethrough,"aria-pressed":m,disabled:b,className:D,iconLeft:t.jsx(x.Strikethrough,{size:16,"aria-hidden":"true"}),onClick:()=>m?s==null?void 0:s():P==null?void 0:P()})})}),t.jsx(h,{label:n.underlineHint,children:t.jsx(i.Toolbar.Button,{asChild:!0,children:t.jsx(v.Button,{variant:"regular-basic",size:"sm","aria-label":n.underline,"aria-pressed":p,disabled:b,className:D,iconLeft:t.jsx(x.Underline,{size:16,"aria-hidden":"true"}),onClick:()=>p?s==null?void 0:s():S==null?void 0:S()})})}),t.jsx(h,{label:n.annotateHint,children:t.jsx(i.Toolbar.Button,{asChild:!0,children:t.jsx(v.Button,{variant:"regular-basic",size:"sm","aria-label":n.annotate,disabled:b,iconLeft:t.jsx(x.Note,{size:16,"aria-hidden":"true"}),onClick:()=>H==null?void 0:H(l!=null?l:"")})})}),t.jsx(_,{}),t.jsx(h,{label:G,children:t.jsx(i.Toolbar.Button,{asChild:!0,children:t.jsx(v.Button,{variant:"regular-basic",size:"sm","aria-label":n.pin,"aria-pressed":X,"data-pinned-color":u!=null?u:void 0,disabled:b,className:pe,iconLeft:t.jsx(x.Pin,{size:16,"aria-hidden":"true"}),onClick:Y})})}),o==="edit"?t.jsx(h,{label:n.removeHint,children:t.jsx(i.Toolbar.Button,{asChild:!0,children:t.jsx(v.Button,{variant:"error-soft",size:"sm","aria-label":n.remove,disabled:b,iconLeft:t.jsx(x.CloseSm,{size:16,"aria-hidden":"true"}),onClick:()=>s==null?void 0:s()})})}):null]}),t.jsx(i.Popover.Arrow,{width:16,height:10,className:"-my-px fill-surface-elevated drop-shadow-[0_1px_0_var(--color-gray-stroke-muted)]"})]})})})]})}exports.TEXT_MARKER_COLORS=F,exports.TextMarker=fe,exports.textMarkerMarkVariants=de;
3
+ "use strict";var r=require("react/jsx-runtime"),f=require("@medway-ui/icons"),Z=require("class-variance-authority"),i=require("radix-ui"),d=require("react"),v=require("./Button.js"),$=require("./Separator.js"),C=require("./Tooltip.js"),B=require("../lib/utils.js"),ee=Object.defineProperty,re=Object.defineProperties,te=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,L=(e,t,o)=>t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))oe.call(t,o)&&L(e,o,t[o]);if(q)for(var o of q(t))ne.call(t,o)&&L(e,o,t[o]);return e},M=(e,t)=>re(e,te(t));const F=Object.freeze(["cm","go","cir","ped","prev"]),ae={cm:"Azul",go:"Rosa",cir:"Verde",ped:"Amarelo",prev:"Roxo"},ie={toolbar:"Marca\xE7\xE3o da sele\xE7\xE3o",color:"Cor",strikethrough:"Riscar",strikethroughHint:"Riscar: passa um tra\xE7o sobre o trecho para destacar o que n\xE3o importa",underline:"Sublinhar",underlineHint:"Sublinhar: passa um tra\xE7o sob o trecho para destacar o que importa",annotate:"Anotar",annotateHint:"Anotar: abre a nota com o trecho selecionado",pin:"Fixar",pinHint:"Fixar: escolha uma cor e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem marcadas com ela",pinArmedHint:"Escolha a cor que vai ficar fixada",unpinHint:"Desafixar: as pr\xF3ximas sele\xE7\xF5es voltam a abrir esta ferramenta",remove:"Remover marca\xE7\xE3o",removeHint:"Remover a marca\xE7\xE3o deste trecho",colorName:e=>ae[e]},le={cm:"bg-cm-background-fill",go:"bg-go-background-fill",cir:"bg-cir-background-fill",ped:"bg-ped-background-fill",prev:"bg-prev-background-fill"},se={cm:"bg-cm-16 dark:bg-cm-48",go:"bg-go-16 dark:bg-go-48",cir:"bg-cir-16 dark:bg-cir-24",ped:"bg-ped-24 dark:bg-ped-48",prev:"bg-prev-16 dark:bg-prev-48"},de=Z.cva("rounded-[2px] [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:M(E({},se),{none:"bg-transparent"}),strikethrough:{true:"text-gray-foreground-muted line-through",false:"text-inherit"},underline:{true:"underline underline-offset-2",false:""}},defaultVariants:{color:"none",strikethrough:!1,underline:!1}}),ce={cm:"aria-pressed:border-cm-background-fill",go:"aria-pressed:border-go-background-fill",cir:"aria-pressed:border-cir-background-fill",ped:"aria-pressed:border-ped-background-fill",prev:"aria-pressed:border-prev-background-fill"},ue="inline-flex max-w-[calc(100vw-32px)] items-center rounded-pill border border-gray-stroke-muted bg-surface-elevated text-gray-foreground shadow-level-1",pe="flex min-w-0 items-center gap-2 overflow-x-auto overscroll-x-contain rounded-pill py-2 pl-3 pr-2 [&>*]:shrink-0",D="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",be="aria-pressed:bg-primary-background-fill aria-pressed:text-primary-foreground-onfill aria-pressed:hover:bg-primary-background-fill-emphasis aria-pressed:hover:text-primary-foreground-onfill";function h({label:e,children:t}){return r.jsxs(C.Tooltip,{children:[r.jsx(C.TooltipTrigger,{asChild:!0,children:t}),r.jsx(C.TooltipContent,{side:"bottom",className:"max-w-64",children:e})]})}function he({color:e,pressed:t,name:o,disabled:l,onSelect:c}){return r.jsx(h,{label:o,children:r.jsx(i.Toolbar.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":o,"aria-pressed":t,disabled:l,onClick:()=>c(e),className:B.cn("inline-flex size-8 shrink-0 items-center justify-center rounded-circular border border-transparent p-1 outline-none hover:cursor-pointer focus-visible:ring-[3px] focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",ce[e]),children:r.jsx("span",{"aria-hidden":"true",className:B.cn("size-6 shrink-0 rounded-circular",le[e])})})})}function _(){return r.jsx($.Separator,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function me(e){var t;if("getBoundingClientRect"in e){const p="commonAncestorContainer"in e?e.commonAncestorContainer:e,u=p.nodeType===Node.ELEMENT_NODE?p:(t=p.parentElement)!=null?t:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:u}}const{top:o,left:l,width:c,height:j}=e,m={x:l,y:o,top:o,left:l,width:c,height:j,right:l+c,bottom:o+j};return{getBoundingClientRect:()=>M(E({},m),{toJSON:()=>m})}}function ge(){const e=d.useRef(!1);return d.useEffect(()=>{const t=()=>{e.current=!1},o=()=>{e.current=!0};return document.addEventListener("pointerdown",t,!0),document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",o,!0)}},[]),e}function V(e,t){return!e||!t||"getBoundingClientRect"in e||"getBoundingClientRect"in t?!1:e.top===t.top&&e.left===t.left&&e.bottom===t.bottom&&e.width===t.width&&e.height===t.height}function xe(e){const[t,o]=d.useState(e);return e!==t&&!V(e,t)&&o(e),V(e,t)?t:e}function fe({open:e=!1,anchor:t=null,mode:o="create",selectedText:l,color:c,colors:j=F,strikethrough:m=!1,underline:p=!1,pinnedColor:u=null,disabled:b=!1,className:U,labels:I,onHighlight:O,onStrikethrough:S,onUnderline:H,onPinnedColorChange:k,onNote:P,onRemove:s,onClose:z}){const n=E(E({},ie),I),J=ge(),y=xe(t),g=d.useMemo(()=>y?{current:me(y)}:null,[y]),w=d.useRef(null),R=d.useRef(!1),[A,N]=d.useState(null),[K,W]=d.useState(e);e!==K&&(W(e),e||N(null));const x=e&&A!==null&&A===g,X=!!u||x,G=u?n.unpinHint:x?n.pinArmedHint:n.pinHint,Q=a=>{if(a===c&&!x){s==null||s();return}x&&(N(null),k==null||k(a)),O==null||O(a)},Y=()=>{if(u){k==null||k(null);return}N(x?null:g)};return r.jsxs(i.Popover.Root,{open:e&&!!g,onOpenChange:a=>{a||z==null||z()},children:[g?r.jsx(i.Popover.Anchor,{virtualRef:g}):null,r.jsx(i.Popover.Portal,{children:r.jsx(i.Popover.Content,{asChild:!0,role:"toolbar",side:"top",sideOffset:4,collisionPadding:16,sticky:"always",hideWhenDetached:!0,onOpenAutoFocus:a=>{w.current=document.activeElement instanceof HTMLElement?document.activeElement:null,R.current=!1,J.current||a.preventDefault()},onInteractOutside:()=>{R.current=!0},onCloseAutoFocus:a=>{a.preventDefault();const T=w.current;w.current=null,!R.current&&T!=null&&T.isConnected&&T.focus({preventScroll:!0})},children:r.jsxs(i.Toolbar.Root,{"aria-label":n.toolbar,"data-slot":"text-marker","data-mode":o,"data-text-marker-chrome":"",className:B.cn("z-50",ue,U),children:[r.jsx(C.TooltipProvider,{delayDuration:200,children:r.jsxs("div",{className:pe,children:[r.jsx("div",{role:"group","aria-label":n.color,className:"flex items-center gap-2",children:j.map(a=>r.jsx(he,{color:a,name:n.colorName(a),pressed:c===a,disabled:b,onSelect:Q},a))}),r.jsx(_,{}),r.jsx(h,{label:n.strikethroughHint,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(v.Button,{variant:"regular-basic",size:"sm","aria-label":n.strikethrough,"aria-pressed":m,disabled:b,className:D,iconLeft:r.jsx(f.Strikethrough,{size:16,"aria-hidden":"true"}),onClick:()=>m?s==null?void 0:s():S==null?void 0:S()})})}),r.jsx(h,{label:n.underlineHint,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(v.Button,{variant:"regular-basic",size:"sm","aria-label":n.underline,"aria-pressed":p,disabled:b,className:D,iconLeft:r.jsx(f.Underline,{size:16,"aria-hidden":"true"}),onClick:()=>p?s==null?void 0:s():H==null?void 0:H()})})}),r.jsx(h,{label:n.annotateHint,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(v.Button,{variant:"regular-basic",size:"sm","aria-label":n.annotate,disabled:b,iconLeft:r.jsx(f.Note,{size:16,"aria-hidden":"true"}),onClick:()=>P==null?void 0:P(l!=null?l:"")})})}),r.jsx(_,{}),r.jsx(h,{label:G,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(v.Button,{variant:"regular-basic",size:"sm","aria-label":n.pin,"aria-pressed":X,"data-pinned-color":u!=null?u:void 0,disabled:b,className:be,iconLeft:r.jsx(f.Pin,{size:16,"aria-hidden":"true"}),onClick:Y})})}),o==="edit"?r.jsx(h,{label:n.removeHint,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(v.Button,{variant:"error-soft",size:"sm","aria-label":n.remove,disabled:b,iconLeft:r.jsx(f.CloseSm,{size:16,"aria-hidden":"true"}),onClick:()=>s==null?void 0:s()})})}):null]})}),r.jsx(i.Popover.Arrow,{width:16,height:10,className:"-my-px fill-surface-elevated drop-shadow-[0_1px_0_var(--color-gray-stroke-muted)]"})]})})})]})}exports.TEXT_MARKER_COLORS=F,exports.TextMarker=fe,exports.textMarkerMarkVariants=de;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- import{jsxs as C,jsx as t}from"react/jsx-runtime";import{Strikethrough as Z,Underline as ee,Note as re,Pin as te,CloseSm as ne}from"@medway-ui/icons";import{cva as oe}from"class-variance-authority";import{Popover as g,Toolbar as c}from"radix-ui";import{useMemo as ae,useRef as H,useState as z,useEffect as ie}from"react";import{Button as v}from"./Button.mjs";import{Separator as le}from"./Separator.mjs";import{TooltipProvider as se,Tooltip as de,TooltipTrigger as ce,TooltipContent as ue}from"./Tooltip.mjs";import{cn as T}from"../lib/utils.mjs";var pe=Object.defineProperty,me=Object.defineProperties,he=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable,F=(e,r,n)=>r in e?pe(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,E=(e,r)=>{for(var n in r||(r={}))be.call(r,n)&&F(e,n,r[n]);if(M)for(var n of M(r))fe.call(r,n)&&F(e,n,r[n]);return e},D=(e,r)=>me(e,he(r));const _=Object.freeze(["cm","go","cir","ped","prev"]),ge={cm:"Azul",go:"Rosa",cir:"Verde",ped:"Amarelo",prev:"Roxo"},ve={toolbar:"Marca\xE7\xE3o da sele\xE7\xE3o",color:"Cor",strikethrough:"Riscar",strikethroughHint:"Riscar: passa um tra\xE7o sobre o trecho para destacar o que n\xE3o importa",underline:"Sublinhar",underlineHint:"Sublinhar: passa um tra\xE7o sob o trecho para destacar o que importa",annotate:"Anotar",annotateHint:"Anotar: abre a nota com o trecho selecionado",pin:"Fixar",pinHint:"Fixar: escolha uma cor e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem marcadas com ela",pinArmedHint:"Escolha a cor que vai ficar fixada",unpinHint:"Desafixar: as pr\xF3ximas sele\xE7\xF5es voltam a abrir esta ferramenta",remove:"Remover marca\xE7\xE3o",removeHint:"Remover a marca\xE7\xE3o deste trecho",colorName:e=>ge[e]},xe={cm:"bg-cm-background-fill",go:"bg-go-background-fill",cir:"bg-cir-background-fill",ped:"bg-ped-background-fill",prev:"bg-prev-background-fill"},ke={cm:"bg-cm-16 dark:bg-cm-48",go:"bg-go-16 dark:bg-go-48",cir:"bg-cir-16 dark:bg-cir-24",ped:"bg-ped-24 dark:bg-ped-48",prev:"bg-prev-16 dark:bg-prev-48"},Ce=oe("rounded-[2px] [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:D(E({},ke),{none:"bg-transparent"}),strikethrough:{true:"text-gray-foreground-muted line-through",false:"text-inherit"},underline:{true:"underline underline-offset-2",false:""}},defaultVariants:{color:"none",strikethrough:!1,underline:!1}}),Ee={cm:"aria-pressed:border-cm-background-fill",go:"aria-pressed:border-go-background-fill",cir:"aria-pressed:border-cir-background-fill",ped:"aria-pressed:border-ped-background-fill",prev:"aria-pressed:border-prev-background-fill"},ye="inline-flex items-center gap-2 rounded-pill border border-gray-stroke-muted bg-surface-elevated py-2 pl-3 pr-2 text-gray-foreground shadow-level-1",V="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",Re="aria-pressed:bg-primary-background-fill aria-pressed:text-primary-foreground-onfill aria-pressed:hover:bg-primary-background-fill-emphasis aria-pressed:hover:text-primary-foreground-onfill";function m({label:e,children:r}){return C(de,{children:[t(ce,{asChild:!0,children:r}),t(ue,{side:"bottom",className:"max-w-64",children:e})]})}function we({color:e,pressed:r,name:n,disabled:i,onSelect:s}){return t(m,{label:n,children:t(c.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":n,"aria-pressed":r,disabled:i,onClick:()=>s(e),className:T("inline-flex size-8 shrink-0 items-center justify-center rounded-circular border border-transparent p-1 outline-none hover:cursor-pointer focus-visible:ring-[3px] focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",Ee[e]),children:t("span",{"aria-hidden":"true",className:T("size-6 shrink-0 rounded-circular",xe[e])})})})}function q(){return t(le,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function Ne(e){var r;if("getBoundingClientRect"in e){const u="commonAncestorContainer"in e?e.commonAncestorContainer:e,d=u.nodeType===Node.ELEMENT_NODE?u:(r=u.parentElement)!=null?r:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:d}}const{top:n,left:i,width:s,height:x}=e,h={x:i,y:n,top:n,left:i,width:s,height:x,right:i+s,bottom:n+x};return{getBoundingClientRect:()=>D(E({},h),{toJSON:()=>h})}}function Oe(){const e=H(!1);return ie(()=>{const r=()=>{e.current=!1},n=()=>{e.current=!0};return document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",n,!0),()=>{document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",n,!0)}},[]),e}function U(e,r){return!e||!r||"getBoundingClientRect"in e||"getBoundingClientRect"in r?!1:e.top===r.top&&e.left===r.left&&e.bottom===r.bottom&&e.width===r.width&&e.height===r.height}function He(e){const[r,n]=z(e);return e!==r&&!U(e,r)&&n(e),U(e,r)?r:e}function ze({open:e=!1,anchor:r=null,mode:n="create",selectedText:i,color:s,colors:x=_,strikethrough:h=!1,underline:u=!1,pinnedColor:d=null,disabled:p=!1,className:W,labels:I,onHighlight:A,onStrikethrough:B,onUnderline:S,onPinnedColorChange:k,onNote:P,onRemove:l,onClose:j}){const o=E(E({},ve),I),J=Oe(),y=He(r),b=ae(()=>y?{current:Ne(y)}:null,[y]),R=H(null),w=H(!1),[L,N]=z(null),[K,X]=z(e);e!==K&&(X(e),e||N(null));const f=e&&L!==null&&L===b,$=!!d||f,G=d?o.unpinHint:f?o.pinArmedHint:o.pinHint,Q=a=>{if(a===s&&!f){l==null||l();return}f&&(N(null),k==null||k(a)),A==null||A(a)},Y=()=>{if(d){k==null||k(null);return}N(f?null:b)};return C(g.Root,{open:e&&!!b,onOpenChange:a=>{a||j==null||j()},children:[b?t(g.Anchor,{virtualRef:b}):null,t(g.Portal,{children:t(g.Content,{asChild:!0,role:"toolbar",side:"top",sideOffset:4,collisionPadding:16,sticky:"always",hideWhenDetached:!0,onOpenAutoFocus:a=>{R.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w.current=!1,J.current||a.preventDefault()},onInteractOutside:()=>{w.current=!0},onCloseAutoFocus:a=>{a.preventDefault();const O=R.current;R.current=null,!w.current&&O!=null&&O.isConnected&&O.focus({preventScroll:!0})},children:C(c.Root,{"aria-label":o.toolbar,"data-slot":"text-marker","data-mode":n,"data-text-marker-chrome":"",className:T("z-50",ye,W),children:[C(se,{delayDuration:200,children:[t("div",{role:"group","aria-label":o.color,className:"flex items-center gap-2",children:x.map(a=>t(we,{color:a,name:o.colorName(a),pressed:s===a,disabled:p,onSelect:Q},a))}),t(q,{}),t(m,{label:o.strikethroughHint,children:t(c.Button,{asChild:!0,children:t(v,{variant:"regular-basic",size:"sm","aria-label":o.strikethrough,"aria-pressed":h,disabled:p,className:V,iconLeft:t(Z,{size:16,"aria-hidden":"true"}),onClick:()=>h?l==null?void 0:l():B==null?void 0:B()})})}),t(m,{label:o.underlineHint,children:t(c.Button,{asChild:!0,children:t(v,{variant:"regular-basic",size:"sm","aria-label":o.underline,"aria-pressed":u,disabled:p,className:V,iconLeft:t(ee,{size:16,"aria-hidden":"true"}),onClick:()=>u?l==null?void 0:l():S==null?void 0:S()})})}),t(m,{label:o.annotateHint,children:t(c.Button,{asChild:!0,children:t(v,{variant:"regular-basic",size:"sm","aria-label":o.annotate,disabled:p,iconLeft:t(re,{size:16,"aria-hidden":"true"}),onClick:()=>P==null?void 0:P(i!=null?i:"")})})}),t(q,{}),t(m,{label:G,children:t(c.Button,{asChild:!0,children:t(v,{variant:"regular-basic",size:"sm","aria-label":o.pin,"aria-pressed":$,"data-pinned-color":d!=null?d:void 0,disabled:p,className:Re,iconLeft:t(te,{size:16,"aria-hidden":"true"}),onClick:Y})})}),n==="edit"?t(m,{label:o.removeHint,children:t(c.Button,{asChild:!0,children:t(v,{variant:"error-soft",size:"sm","aria-label":o.remove,disabled:p,iconLeft:t(ne,{size:16,"aria-hidden":"true"}),onClick:()=>l==null?void 0:l()})})}):null]}),t(g.Arrow,{width:16,height:10,className:"-my-px fill-surface-elevated drop-shadow-[0_1px_0_var(--color-gray-stroke-muted)]"})]})})})]})}export{_ as TEXT_MARKER_COLORS,ze as TextMarker,Ce as textMarkerMarkVariants};
3
+ import{jsxs as C,jsx as t}from"react/jsx-runtime";import{Strikethrough as Z,Underline as ee,Note as re,Pin as te,CloseSm as ne}from"@medway-ui/icons";import{cva as oe}from"class-variance-authority";import{Popover as g,Toolbar as c}from"radix-ui";import{useMemo as ae,useRef as H,useState as z,useEffect as ie}from"react";import{Button as v}from"./Button.mjs";import{Separator as le}from"./Separator.mjs";import{TooltipProvider as se,Tooltip as de,TooltipTrigger as ce,TooltipContent as ue}from"./Tooltip.mjs";import{cn as T}from"../lib/utils.mjs";var me=Object.defineProperty,pe=Object.defineProperties,he=Object.getOwnPropertyDescriptors,M=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable,F=(e,r,n)=>r in e?me(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,E=(e,r)=>{for(var n in r||(r={}))be.call(r,n)&&F(e,n,r[n]);if(M)for(var n of M(r))fe.call(r,n)&&F(e,n,r[n]);return e},D=(e,r)=>pe(e,he(r));const _=Object.freeze(["cm","go","cir","ped","prev"]),ge={cm:"Azul",go:"Rosa",cir:"Verde",ped:"Amarelo",prev:"Roxo"},ve={toolbar:"Marca\xE7\xE3o da sele\xE7\xE3o",color:"Cor",strikethrough:"Riscar",strikethroughHint:"Riscar: passa um tra\xE7o sobre o trecho para destacar o que n\xE3o importa",underline:"Sublinhar",underlineHint:"Sublinhar: passa um tra\xE7o sob o trecho para destacar o que importa",annotate:"Anotar",annotateHint:"Anotar: abre a nota com o trecho selecionado",pin:"Fixar",pinHint:"Fixar: escolha uma cor e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem marcadas com ela",pinArmedHint:"Escolha a cor que vai ficar fixada",unpinHint:"Desafixar: as pr\xF3ximas sele\xE7\xF5es voltam a abrir esta ferramenta",remove:"Remover marca\xE7\xE3o",removeHint:"Remover a marca\xE7\xE3o deste trecho",colorName:e=>ge[e]},xe={cm:"bg-cm-background-fill",go:"bg-go-background-fill",cir:"bg-cir-background-fill",ped:"bg-ped-background-fill",prev:"bg-prev-background-fill"},ke={cm:"bg-cm-16 dark:bg-cm-48",go:"bg-go-16 dark:bg-go-48",cir:"bg-cir-16 dark:bg-cir-24",ped:"bg-ped-24 dark:bg-ped-48",prev:"bg-prev-16 dark:bg-prev-48"},Ce=oe("rounded-[2px] [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:D(E({},ke),{none:"bg-transparent"}),strikethrough:{true:"text-gray-foreground-muted line-through",false:"text-inherit"},underline:{true:"underline underline-offset-2",false:""}},defaultVariants:{color:"none",strikethrough:!1,underline:!1}}),Ee={cm:"aria-pressed:border-cm-background-fill",go:"aria-pressed:border-go-background-fill",cir:"aria-pressed:border-cir-background-fill",ped:"aria-pressed:border-ped-background-fill",prev:"aria-pressed:border-prev-background-fill"},ye="inline-flex max-w-[calc(100vw-32px)] items-center rounded-pill border border-gray-stroke-muted bg-surface-elevated text-gray-foreground shadow-level-1",we="flex min-w-0 items-center gap-2 overflow-x-auto overscroll-x-contain rounded-pill py-2 pl-3 pr-2 [&>*]:shrink-0",V="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",Ne="aria-pressed:bg-primary-background-fill aria-pressed:text-primary-foreground-onfill aria-pressed:hover:bg-primary-background-fill-emphasis aria-pressed:hover:text-primary-foreground-onfill";function p({label:e,children:r}){return C(de,{children:[t(ce,{asChild:!0,children:r}),t(ue,{side:"bottom",className:"max-w-64",children:e})]})}function Re({color:e,pressed:r,name:n,disabled:i,onSelect:s}){return t(p,{label:n,children:t(c.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":n,"aria-pressed":r,disabled:i,onClick:()=>s(e),className:T("inline-flex size-8 shrink-0 items-center justify-center rounded-circular border border-transparent p-1 outline-none hover:cursor-pointer focus-visible:ring-[3px] focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",Ee[e]),children:t("span",{"aria-hidden":"true",className:T("size-6 shrink-0 rounded-circular",xe[e])})})})}function q(){return t(le,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function Oe(e){var r;if("getBoundingClientRect"in e){const u="commonAncestorContainer"in e?e.commonAncestorContainer:e,d=u.nodeType===Node.ELEMENT_NODE?u:(r=u.parentElement)!=null?r:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:d}}const{top:n,left:i,width:s,height:x}=e,h={x:i,y:n,top:n,left:i,width:s,height:x,right:i+s,bottom:n+x};return{getBoundingClientRect:()=>D(E({},h),{toJSON:()=>h})}}function He(){const e=H(!1);return ie(()=>{const r=()=>{e.current=!1},n=()=>{e.current=!0};return document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",n,!0),()=>{document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",n,!0)}},[]),e}function U(e,r){return!e||!r||"getBoundingClientRect"in e||"getBoundingClientRect"in r?!1:e.top===r.top&&e.left===r.left&&e.bottom===r.bottom&&e.width===r.width&&e.height===r.height}function ze(e){const[r,n]=z(e);return e!==r&&!U(e,r)&&n(e),U(e,r)?r:e}function Te({open:e=!1,anchor:r=null,mode:n="create",selectedText:i,color:s,colors:x=_,strikethrough:h=!1,underline:u=!1,pinnedColor:d=null,disabled:m=!1,className:W,labels:I,onHighlight:A,onStrikethrough:S,onUnderline:B,onPinnedColorChange:k,onNote:j,onRemove:l,onClose:L}){const o=E(E({},ve),I),J=He(),y=ze(r),b=ae(()=>y?{current:Oe(y)}:null,[y]),w=H(null),N=H(!1),[P,R]=z(null),[K,X]=z(e);e!==K&&(X(e),e||R(null));const f=e&&P!==null&&P===b,$=!!d||f,G=d?o.unpinHint:f?o.pinArmedHint:o.pinHint,Q=a=>{if(a===s&&!f){l==null||l();return}f&&(R(null),k==null||k(a)),A==null||A(a)},Y=()=>{if(d){k==null||k(null);return}R(f?null:b)};return C(g.Root,{open:e&&!!b,onOpenChange:a=>{a||L==null||L()},children:[b?t(g.Anchor,{virtualRef:b}):null,t(g.Portal,{children:t(g.Content,{asChild:!0,role:"toolbar",side:"top",sideOffset:4,collisionPadding:16,sticky:"always",hideWhenDetached:!0,onOpenAutoFocus:a=>{w.current=document.activeElement instanceof HTMLElement?document.activeElement:null,N.current=!1,J.current||a.preventDefault()},onInteractOutside:()=>{N.current=!0},onCloseAutoFocus:a=>{a.preventDefault();const O=w.current;w.current=null,!N.current&&O!=null&&O.isConnected&&O.focus({preventScroll:!0})},children:C(c.Root,{"aria-label":o.toolbar,"data-slot":"text-marker","data-mode":n,"data-text-marker-chrome":"",className:T("z-50",ye,W),children:[t(se,{delayDuration:200,children:C("div",{className:we,children:[t("div",{role:"group","aria-label":o.color,className:"flex items-center gap-2",children:x.map(a=>t(Re,{color:a,name:o.colorName(a),pressed:s===a,disabled:m,onSelect:Q},a))}),t(q,{}),t(p,{label:o.strikethroughHint,children:t(c.Button,{asChild:!0,children:t(v,{variant:"regular-basic",size:"sm","aria-label":o.strikethrough,"aria-pressed":h,disabled:m,className:V,iconLeft:t(Z,{size:16,"aria-hidden":"true"}),onClick:()=>h?l==null?void 0:l():S==null?void 0:S()})})}),t(p,{label:o.underlineHint,children:t(c.Button,{asChild:!0,children:t(v,{variant:"regular-basic",size:"sm","aria-label":o.underline,"aria-pressed":u,disabled:m,className:V,iconLeft:t(ee,{size:16,"aria-hidden":"true"}),onClick:()=>u?l==null?void 0:l():B==null?void 0:B()})})}),t(p,{label:o.annotateHint,children:t(c.Button,{asChild:!0,children:t(v,{variant:"regular-basic",size:"sm","aria-label":o.annotate,disabled:m,iconLeft:t(re,{size:16,"aria-hidden":"true"}),onClick:()=>j==null?void 0:j(i!=null?i:"")})})}),t(q,{}),t(p,{label:G,children:t(c.Button,{asChild:!0,children:t(v,{variant:"regular-basic",size:"sm","aria-label":o.pin,"aria-pressed":$,"data-pinned-color":d!=null?d:void 0,disabled:m,className:Ne,iconLeft:t(te,{size:16,"aria-hidden":"true"}),onClick:Y})})}),n==="edit"?t(p,{label:o.removeHint,children:t(c.Button,{asChild:!0,children:t(v,{variant:"error-soft",size:"sm","aria-label":o.remove,disabled:m,iconLeft:t(ne,{size:16,"aria-hidden":"true"}),onClick:()=>l==null?void 0:l()})})}):null]})}),t(g.Arrow,{width:16,height:10,className:"-my-px fill-surface-elevated drop-shadow-[0_1px_0_var(--color-gray-stroke-muted)]"})]})})})]})}export{_ as TEXT_MARKER_COLORS,Te as TextMarker,Ce as textMarkerMarkVariants};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medway-ui/core",
3
- "version": "1.43.0",
3
+ "version": "1.43.1",
4
4
  "private": false,
5
5
  "description": "Biblioteca de componentes e assets para o sistema Medway",
6
6
  "author": "Alekcarvalho",
@@ -39,7 +39,7 @@
39
39
  "use-sync-external-store": "^1.5.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "@medway-ui/icons": "^1.19.0",
42
+ "@medway-ui/icons": "^1.20.0",
43
43
  "@tiptap/pm": "^3.31.3",
44
44
  "@tiptap/react": "^3.31.3",
45
45
  "react": ">=17.0.2",
@@ -55,7 +55,7 @@
55
55
  }
56
56
  },
57
57
  "devDependencies": {
58
- "@medway-ui/icons": "1.19.0",
58
+ "@medway-ui/icons": "1.20.0",
59
59
  "@rollup/plugin-node-resolve": "^16.0.3",
60
60
  "@tiptap/core": "^3.31.3",
61
61
  "@tiptap/extension-blockquote": "^3.31.3",