@medway-ui/core 1.43.1 → 1.44.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 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.1 · Generated 2026-11-10
4
+ > Package `@medway-ui/core` · v1.44.0 · Generated 2026-11-10
5
5
 
6
6
  All components require React 18+ and are client components (`"use client"`).
7
7
 
@@ -2352,7 +2352,7 @@ type TagSize = NonNullable<VariantProps<typeof tagVariants>["size"]>
2352
2352
 
2353
2353
  **Functions / variant helpers:** `textMarkerMarkVariants`
2354
2354
 
2355
- **Exported types:** `TextMarkerAnchor`, `TextMarkerColor`, `TextMarkerLabels`, `TextMarkerMode`, `TextMarkerProps`, `TextMarkerRect`
2355
+ **Exported types:** `TextMarkerAnchor`, `TextMarkerColor`, `TextMarkerLabels`, `TextMarkerMode`, `TextMarkerProps`, `TextMarkerRect`, `TextMarkerTool`
2356
2356
 
2357
2357
  > **Radix UI base:** `Popover`, `Toolbar` — sub-components forward all Radix UI props.
2358
2358
 
@@ -2402,6 +2402,7 @@ type TagSize = NonNullable<VariantProps<typeof tagVariants>["size"]>
2402
2402
  | `colors` | `readonly TextMarkerColor[]` | |
2403
2403
  | `strikethrough` | `boolean` | |
2404
2404
  | `underline` | `boolean` | |
2405
+ | `pinned` | `TextMarkerTool \| null` | |
2405
2406
  | `pinnedColor` | `TextMarkerColor \| null` | |
2406
2407
  | `disabled` | `boolean` | |
2407
2408
  | `className` | `string` | |
@@ -2409,6 +2410,7 @@ type TagSize = NonNullable<VariantProps<typeof tagVariants>["size"]>
2409
2410
  | `onHighlight` | `(color: TextMarkerColor) => void` | |
2410
2411
  | `onStrikethrough` | `() => void` | |
2411
2412
  | `onUnderline` | `() => void` | |
2413
+ | `onPinnedChange` | `(tool: TextMarkerTool \| null) => void` | |
2412
2414
  | `onPinnedColorChange` | `(color: TextMarkerColor \| null) => void` | |
2413
2415
  | `onNote` | `(selectedText: string) => void` | |
2414
2416
  | `onRemove` | `() => void` | |
@@ -2426,6 +2428,15 @@ type TextMarkerColor = "cm" | "go" | "cir" | "ped" | "prev"
2426
2428
  type TextMarkerMode = "create" | "edit"
2427
2429
  ```
2428
2430
 
2431
+ ### `TextMarkerTool` *(type)*
2432
+
2433
+ ```typescript
2434
+ type TextMarkerTool = | TextMarkerColor
2435
+ | "strikethrough"
2436
+ | "underline"
2437
+ | "note"
2438
+ ```
2439
+
2429
2440
  ### `TextMarkerRect` *(type)*
2430
2441
 
2431
2442
  ```typescript
@@ -1,6 +1,6 @@
1
1
  # @medway-ui/core — Component Summary
2
2
 
3
- > v1.43.1 · For the full prop/variant reference see `COMPONENTS.md`.
3
+ > v1.44.0 · 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.1 · Generated 2026-11-10
4
+ > Package `@medway-ui/core` · v1.44.0 · Generated 2026-11-10
5
5
 
6
6
  All components require React 18+ and are client components (`"use client"`).
7
7
 
@@ -2352,7 +2352,7 @@ type TagSize = NonNullable<VariantProps<typeof tagVariants>["size"]>
2352
2352
 
2353
2353
  **Functions / variant helpers:** `textMarkerMarkVariants`
2354
2354
 
2355
- **Exported types:** `TextMarkerAnchor`, `TextMarkerColor`, `TextMarkerLabels`, `TextMarkerMode`, `TextMarkerProps`, `TextMarkerRect`
2355
+ **Exported types:** `TextMarkerAnchor`, `TextMarkerColor`, `TextMarkerLabels`, `TextMarkerMode`, `TextMarkerProps`, `TextMarkerRect`, `TextMarkerTool`
2356
2356
 
2357
2357
  > **Radix UI base:** `Popover`, `Toolbar` — sub-components forward all Radix UI props.
2358
2358
 
@@ -2402,6 +2402,7 @@ type TagSize = NonNullable<VariantProps<typeof tagVariants>["size"]>
2402
2402
  | `colors` | `readonly TextMarkerColor[]` | |
2403
2403
  | `strikethrough` | `boolean` | |
2404
2404
  | `underline` | `boolean` | |
2405
+ | `pinned` | `TextMarkerTool \| null` | |
2405
2406
  | `pinnedColor` | `TextMarkerColor \| null` | |
2406
2407
  | `disabled` | `boolean` | |
2407
2408
  | `className` | `string` | |
@@ -2409,6 +2410,7 @@ type TagSize = NonNullable<VariantProps<typeof tagVariants>["size"]>
2409
2410
  | `onHighlight` | `(color: TextMarkerColor) => void` | |
2410
2411
  | `onStrikethrough` | `() => void` | |
2411
2412
  | `onUnderline` | `() => void` | |
2413
+ | `onPinnedChange` | `(tool: TextMarkerTool \| null) => void` | |
2412
2414
  | `onPinnedColorChange` | `(color: TextMarkerColor \| null) => void` | |
2413
2415
  | `onNote` | `(selectedText: string) => void` | |
2414
2416
  | `onRemove` | `() => void` | |
@@ -2426,6 +2428,15 @@ type TextMarkerColor = "cm" | "go" | "cir" | "ped" | "prev"
2426
2428
  type TextMarkerMode = "create" | "edit"
2427
2429
  ```
2428
2430
 
2431
+ ### `TextMarkerTool` *(type)*
2432
+
2433
+ ```typescript
2434
+ type TextMarkerTool = | TextMarkerColor
2435
+ | "strikethrough"
2436
+ | "underline"
2437
+ | "note"
2438
+ ```
2439
+
2429
2440
  ### `TextMarkerRect` *(type)*
2430
2441
 
2431
2442
  ```typescript
@@ -1,6 +1,6 @@
1
1
  # @medway-ui/core — Component Summary
2
2
 
3
- > v1.43.1 · For the full prop/variant reference see `COMPONENTS.md`.
3
+ > v1.44.0 · For the full prop/variant reference see `COMPONENTS.md`.
4
4
 
5
5
  ## Components
6
6
 
@@ -1,5 +1,7 @@
1
1
  export type TextMarkerColor = "cm" | "go" | "cir" | "ped" | "prev";
2
2
  export type TextMarkerMode = "create" | "edit";
3
+ /** O que o Fixar guarda: uma cor, Riscar, Sublinhar ou Anotar. */
4
+ export type TextMarkerTool = TextMarkerColor | "strikethrough" | "underline" | "note";
3
5
  export type TextMarkerRect = Pick<DOMRect, "top" | "left" | "bottom" | "width" | "height">;
4
6
  /**
5
7
  * Onde a toolbar se apoia. Prefira o `Range` da seleção ou o elemento da
@@ -53,9 +55,12 @@ export interface TextMarkerProps {
53
55
  */
54
56
  underline?: boolean;
55
57
  /**
56
- * Cor fixada. Com ela, o app marca as próximas seleções direto, sem abrir a
57
- * toolbar. `null` ou ausente: nada fixado.
58
+ * Ferramenta fixada: uma cor, `"strikethrough"`, `"underline"` ou `"note"`.
59
+ * Com ela, o app aplica a ferramenta nas próximas seleções direto, sem abrir
60
+ * a toolbar. `null` ou ausente: nada fixado.
58
61
  */
62
+ pinned?: TextMarkerTool | null;
63
+ /** @deprecated Use `pinned`, que também aceita Riscar, Sublinhar e Anotar. */
59
64
  pinnedColor?: TextMarkerColor | null;
60
65
  disabled?: boolean;
61
66
  className?: string;
@@ -66,8 +71,13 @@ export interface TextMarkerProps {
66
71
  /** Clique em Sublinhar num trecho que ainda não está sublinhado. */
67
72
  onUnderline?: () => void;
68
73
  /**
69
- * Fixar ou desafixar. Recebe a cor escolhida depois de Fixar, ou `null` ao
70
- * desafixar.
74
+ * Fixar ou desafixar. Recebe a ferramenta escolhida depois de Fixar (uma cor,
75
+ * `"strikethrough"`, `"underline"` ou `"note"`), ou `null` ao desafixar.
76
+ */
77
+ onPinnedChange?: (tool: TextMarkerTool | null) => void;
78
+ /**
79
+ * @deprecated Use `onPinnedChange`. Só recebe cores: fixar Riscar,
80
+ * Sublinhar ou Anotar não chama este callback.
71
81
  */
72
82
  onPinnedColorChange?: (color: TextMarkerColor | null) => void;
73
83
  /**
@@ -84,5 +94,5 @@ declare const textMarkerMarkVariants: (props?: ({
84
94
  strikethrough?: boolean | null | undefined;
85
95
  underline?: boolean | null | undefined;
86
96
  } & ({ class: import("clsx").ClassValue; className?: never } | { class?: never; className: import("clsx").ClassValue } | { class?: never; className?: never })) | undefined) => string;
87
- declare function TextMarker({ open, anchor, mode, selectedText, color, colors, strikethrough, underline, pinnedColor, disabled, className, labels: labelsProp, onHighlight, onStrikethrough, onUnderline, onPinnedColorChange, onNote, onRemove, onClose, }: TextMarkerProps): import("react/jsx-runtime").JSX.Element;
97
+ declare function TextMarker({ open, anchor, mode, selectedText, color, colors, strikethrough, underline, pinned: pinnedProp, pinnedColor, disabled, className, labels: labelsProp, onHighlight, onStrikethrough, onUnderline, onPinnedChange, onPinnedColorChange, onNote, onRemove, onClose, }: TextMarkerProps): import("react/jsx-runtime").JSX.Element;
88
98
  export { TEXT_MARKER_COLORS, TextMarker, textMarkerMarkVariants };
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
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;
3
+ "use strict";var r=require("react/jsx-runtime"),j=require("@medway-ui/icons"),ce=require("class-variance-authority"),i=require("radix-ui"),c=require("react"),E=require("./Button.js"),pe=require("./Separator.js"),R=require("./Tooltip.js"),A=require("../lib/utils.js"),me=Object.defineProperty,he=Object.defineProperties,be=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable,J=(e,n,a)=>n in e?me(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,C=(e,n)=>{for(var a in n||(n={}))xe.call(n,a)&&J(e,a,n[a]);if(W)for(var a of W(n))fe.call(n,a)&&J(e,a,n[a]);return e},X=(e,n)=>he(e,be(n));const S=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 ou uma a\xE7\xE3o e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem com ela",pinArmedHint:"Escolha a cor ou a a\xE7\xE3o 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]},ke={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"},je={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"},Ee={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=ce.cva("rounded-[2px] [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:X(C({},Ee),{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}}),ye={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"},we="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",Re="flex min-w-0 items-center gap-2 overflow-x-auto overscroll-x-contain rounded-pill py-2 pl-3 pr-2 [&>*]:shrink-0",G="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",Te="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 g({label:e,children:n}){return r.jsxs(R.Tooltip,{children:[r.jsx(R.TooltipTrigger,{asChild:!0,children:n}),r.jsx(R.TooltipContent,{side:"bottom",className:"max-w-64",children:e})]})}function Ne({color:e,pressed:n,name:a,hint:l,disabled:p,onSelect:h}){return r.jsx(g,{label:l?`${a}. ${l}`:a,children:r.jsx(i.Toolbar.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":a,"aria-pressed":n,disabled:p,onClick:()=>h(e),className:A.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",ye[e]),children:r.jsx("span",{"aria-hidden":"true",className:A.cn("size-6 shrink-0 rounded-circular",je[e])})})})}function Q(){return r.jsx(pe.Separator,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function Oe(e){var n;if("getBoundingClientRect"in e){const b="commonAncestorContainer"in e?e.commonAncestorContainer:e,y=b.nodeType===Node.ELEMENT_NODE?b:(n=b.parentElement)!=null?n:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:y}}const{top:a,left:l,width:p,height:h}=e,v={x:l,y:a,top:a,left:l,width:p,height:h,right:l+p,bottom:a+h};return{getBoundingClientRect:()=>X(C({},v),{toJSON:()=>v})}}function Be(){const e=c.useRef(!1);return c.useEffect(()=>{const n=()=>{e.current=!1},a=()=>{e.current=!0};return document.addEventListener("pointerdown",n,!0),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("keydown",a,!0)}},[]),e}function Y(e,n){return!e||!n||"getBoundingClientRect"in e||"getBoundingClientRect"in n?!1:e.top===n.top&&e.left===n.left&&e.bottom===n.bottom&&e.width===n.width&&e.height===n.height}function He(e){const[n,a]=c.useState(e);return e!==n&&!Y(e,n)&&a(e),Y(e,n)?n:e}function P(e){return S.includes(e)}function ze({open:e=!1,anchor:n=null,mode:a="create",selectedText:l,color:p,colors:h=S,strikethrough:v=!1,underline:b=!1,pinned:y,pinnedColor:q,disabled:x=!1,className:Z,labels:$,onHighlight:F,onStrikethrough:L,onUnderline:D,onPinnedChange:T,onPinnedColorChange:M,onNote:_,onRemove:s,onClose:d}){const V=!!T,o=C(C(C({},ve),V?null:ke),$),ee=Be(),N=He(n),k=c.useMemo(()=>N?{current:Oe(N)}:null,[N]),O=c.useRef(null),B=c.useRef(!1),[I,H]=c.useState(null),[re,ne]=c.useState(e);e!==re&&(ne(e),e||H(null));const u=y!==void 0?y:q!=null?q:null,f=e&&I!==null&&I===k,te=!!u||f,ae=u?o.unpinHint:f?o.pinArmedHint:o.pinHint,U=t=>{T==null||T(t),(t===null||P(t))&&(M==null||M(t))},K=t=>V||P(t),z=(t,m,ue)=>f&&K(t)?`${m}. ${o.pinArmedHint}`:ue,w=t=>!f||!K(t)?!1:(H(null),U(t),!0),oe=t=>{const m=w(t);if(t===p){m?d==null||d():s==null||s();return}F==null||F(t)},ie=()=>{const t=w("strikethrough");if(v){t?d==null||d():s==null||s();return}L==null||L()},le=()=>{const t=w("underline");if(b){t?d==null||d():s==null||s();return}D==null||D()},se=()=>{w("note"),_==null||_(l!=null?l:"")},de=()=>{if(u){U(null);return}H(f?null:k)};return r.jsxs(i.Popover.Root,{open:e&&!!k,onOpenChange:t=>{t||d==null||d()},children:[k?r.jsx(i.Popover.Anchor,{virtualRef:k}):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:t=>{O.current=document.activeElement instanceof HTMLElement?document.activeElement:null,B.current=!1,ee.current||t.preventDefault()},onInteractOutside:()=>{B.current=!0},onCloseAutoFocus:t=>{t.preventDefault();const m=O.current;O.current=null,!B.current&&m!=null&&m.isConnected&&m.focus({preventScroll:!0})},children:r.jsxs(i.Toolbar.Root,{"aria-label":o.toolbar,"data-slot":"text-marker","data-mode":a,"data-text-marker-chrome":"",className:A.cn("z-50",we,Z),children:[r.jsx(R.TooltipProvider,{delayDuration:200,children:r.jsxs("div",{className:Re,children:[r.jsx("div",{role:"group","aria-label":o.color,className:"flex items-center gap-2",children:h.map(t=>r.jsx(Ne,{color:t,name:o.colorName(t),hint:f?o.pinArmedHint:void 0,pressed:p===t,disabled:x,onSelect:oe},t))}),r.jsx(Q,{}),r.jsx(g,{label:z("strikethrough",o.strikethrough,o.strikethroughHint),children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":o.strikethrough,"aria-pressed":v,disabled:x,className:G,iconLeft:r.jsx(j.Strikethrough,{size:16,"aria-hidden":"true"}),onClick:ie})})}),r.jsx(g,{label:z("underline",o.underline,o.underlineHint),children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":o.underline,"aria-pressed":b,disabled:x,className:G,iconLeft:r.jsx(j.Underline,{size:16,"aria-hidden":"true"}),onClick:le})})}),r.jsx(g,{label:z("note",o.annotate,o.annotateHint),children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":o.annotate,disabled:x,iconLeft:r.jsx(j.Note,{size:16,"aria-hidden":"true"}),onClick:se})})}),r.jsx(Q,{}),r.jsx(g,{label:ae,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":o.pin,"aria-pressed":te,"data-pinned":u!=null?u:void 0,"data-pinned-color":u&&P(u)?u:void 0,disabled:x,className:Te,iconLeft:r.jsx(j.Pin,{size:16,"aria-hidden":"true"}),onClick:de})})}),a==="edit"?r.jsx(g,{label:o.removeHint,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"error-soft",size:"sm","aria-label":o.remove,disabled:x,iconLeft:r.jsx(j.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=S,exports.TextMarker=ze,exports.textMarkerMarkVariants=Ce;
@@ -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 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};
3
+ import{jsxs as R,jsx as n}from"react/jsx-runtime";import{Strikethrough as me,Underline as pe,Note as he,Pin as fe,CloseSm as be}from"@medway-ui/icons";import{cva as ge}from"class-variance-authority";import{Popover as k,Toolbar as m}from"radix-ui";import{useMemo as ve,useRef as j,useState as B,useEffect as xe}from"react";import{Button as E}from"./Button.mjs";import{Separator as ke}from"./Separator.mjs";import{TooltipProvider as Ee,Tooltip as Ce,TooltipTrigger as ye,TooltipContent as we}from"./Tooltip.mjs";import{cn as S}from"../lib/utils.mjs";var Re=Object.defineProperty,Ne=Object.defineProperties,Oe=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,J=(e,r,a)=>r in e?Re(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,C=(e,r)=>{for(var a in r||(r={}))He.call(r,a)&&J(e,a,r[a]);if(U)for(var a of U(r))ze.call(r,a)&&J(e,a,r[a]);return e},X=(e,r)=>Ne(e,Oe(r));const F=Object.freeze(["cm","go","cir","ped","prev"]),Ae={cm:"Azul",go:"Rosa",cir:"Verde",ped:"Amarelo",prev:"Roxo"},Te={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 ou uma a\xE7\xE3o e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem com ela",pinArmedHint:"Escolha a cor ou a a\xE7\xE3o 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]},je={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"},Be={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"},Fe=ge("rounded-[2px] [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:X(C({},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}}),Le={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"},Pe="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",De="flex min-w-0 items-center gap-2 overflow-x-auto overscroll-x-contain rounded-pill py-2 pl-3 pr-2 [&>*]:shrink-0",G="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",$e="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 g({label:e,children:r}){return R(Ce,{children:[n(ye,{asChild:!0,children:r}),n(we,{side:"bottom",className:"max-w-64",children:e})]})}function Me({color:e,pressed:r,name:a,hint:i,disabled:c,onSelect:p}){return n(g,{label:i?`${a}. ${i}`:a,children:n(m.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":a,"aria-pressed":r,disabled:c,onClick:()=>p(e),className:S("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",Le[e]),children:n("span",{"aria-hidden":"true",className:S("size-6 shrink-0 rounded-circular",Be[e])})})})}function Q(){return n(ke,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function _e(e){var r;if("getBoundingClientRect"in e){const h="commonAncestorContainer"in e?e.commonAncestorContainer:e,y=h.nodeType===Node.ELEMENT_NODE?h:(r=h.parentElement)!=null?r:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:y}}const{top:a,left:i,width:c,height:p}=e,v={x:i,y:a,top:a,left:i,width:c,height:p,right:i+c,bottom:a+p};return{getBoundingClientRect:()=>X(C({},v),{toJSON:()=>v})}}function qe(){const e=j(!1);return xe(()=>{const r=()=>{e.current=!1},a=()=>{e.current=!0};return document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",a,!0)}},[]),e}function Y(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 Ie(e){const[r,a]=B(e);return e!==r&&!Y(e,r)&&a(e),Y(e,r)?r:e}function L(e){return F.includes(e)}function Ve({open:e=!1,anchor:r=null,mode:a="create",selectedText:i,color:c,colors:p=F,strikethrough:v=!1,underline:h=!1,pinned:y,pinnedColor:P,disabled:f=!1,className:Z,labels:ee,onHighlight:D,onStrikethrough:$,onUnderline:M,onPinnedChange:N,onPinnedColorChange:_,onNote:q,onRemove:l,onClose:s}){const I=!!N,o=C(C(C({},Te),I?null:je),ee),re=qe(),O=Ie(r),x=ve(()=>O?{current:_e(O)}:null,[O]),H=j(null),z=j(!1),[V,A]=B(null),[ne,te]=B(e);e!==ne&&(te(e),e||A(null));const d=y!==void 0?y:P!=null?P:null,b=e&&V!==null&&V===x,ae=!!d||b,oe=d?o.unpinHint:b?o.pinArmedHint:o.pinHint,W=t=>{N==null||N(t),(t===null||L(t))&&(_==null||_(t))},K=t=>I||L(t),T=(t,u,ue)=>b&&K(t)?`${u}. ${o.pinArmedHint}`:ue,w=t=>!b||!K(t)?!1:(A(null),W(t),!0),ie=t=>{const u=w(t);if(t===c){u?s==null||s():l==null||l();return}D==null||D(t)},le=()=>{const t=w("strikethrough");if(v){t?s==null||s():l==null||l();return}$==null||$()},se=()=>{const t=w("underline");if(h){t?s==null||s():l==null||l();return}M==null||M()},de=()=>{w("note"),q==null||q(i!=null?i:"")},ce=()=>{if(d){W(null);return}A(b?null:x)};return R(k.Root,{open:e&&!!x,onOpenChange:t=>{t||s==null||s()},children:[x?n(k.Anchor,{virtualRef:x}):null,n(k.Portal,{children:n(k.Content,{asChild:!0,role:"toolbar",side:"top",sideOffset:4,collisionPadding:16,sticky:"always",hideWhenDetached:!0,onOpenAutoFocus:t=>{H.current=document.activeElement instanceof HTMLElement?document.activeElement:null,z.current=!1,re.current||t.preventDefault()},onInteractOutside:()=>{z.current=!0},onCloseAutoFocus:t=>{t.preventDefault();const u=H.current;H.current=null,!z.current&&u!=null&&u.isConnected&&u.focus({preventScroll:!0})},children:R(m.Root,{"aria-label":o.toolbar,"data-slot":"text-marker","data-mode":a,"data-text-marker-chrome":"",className:S("z-50",Pe,Z),children:[n(Ee,{delayDuration:200,children:R("div",{className:De,children:[n("div",{role:"group","aria-label":o.color,className:"flex items-center gap-2",children:p.map(t=>n(Me,{color:t,name:o.colorName(t),hint:b?o.pinArmedHint:void 0,pressed:c===t,disabled:f,onSelect:ie},t))}),n(Q,{}),n(g,{label:T("strikethrough",o.strikethrough,o.strikethroughHint),children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":o.strikethrough,"aria-pressed":v,disabled:f,className:G,iconLeft:n(me,{size:16,"aria-hidden":"true"}),onClick:le})})}),n(g,{label:T("underline",o.underline,o.underlineHint),children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":o.underline,"aria-pressed":h,disabled:f,className:G,iconLeft:n(pe,{size:16,"aria-hidden":"true"}),onClick:se})})}),n(g,{label:T("note",o.annotate,o.annotateHint),children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":o.annotate,disabled:f,iconLeft:n(he,{size:16,"aria-hidden":"true"}),onClick:de})})}),n(Q,{}),n(g,{label:oe,children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":o.pin,"aria-pressed":ae,"data-pinned":d!=null?d:void 0,"data-pinned-color":d&&L(d)?d:void 0,disabled:f,className:$e,iconLeft:n(fe,{size:16,"aria-hidden":"true"}),onClick:ce})})}),a==="edit"?n(g,{label:o.removeHint,children:n(m.Button,{asChild:!0,children:n(E,{variant:"error-soft",size:"sm","aria-label":o.remove,disabled:f,iconLeft:n(be,{size:16,"aria-hidden":"true"}),onClick:()=>l==null?void 0:l()})})}):null]})}),n(k.Arrow,{width:16,height:10,className:"-my-px fill-surface-elevated drop-shadow-[0_1px_0_var(--color-gray-stroke-muted)]"})]})})})]})}export{F as TEXT_MARKER_COLORS,Ve as TextMarker,Fe as textMarkerMarkVariants};
package/dist/index.d.ts CHANGED
@@ -95,7 +95,7 @@ export type { TagProps, TagSize, TagVariant } from "./components/Tag.js";
95
95
  export { TAG_PICKER_PALETTE, TagPicker } from "./components/TagPicker.js";
96
96
  export type { TagPickerCreateInput, TagPickerLabels, TagPickerProps, TagPickerTag, } from "./components/TagPicker.js";
97
97
  export { TEXT_MARKER_COLORS, TextMarker, textMarkerMarkVariants, } from "./components/TextMarker.js";
98
- export type { TextMarkerAnchor, TextMarkerColor, TextMarkerLabels, TextMarkerMode, TextMarkerProps, TextMarkerRect, } from "./components/TextMarker.js";
98
+ export type { TextMarkerAnchor, TextMarkerColor, TextMarkerLabels, TextMarkerMode, TextMarkerProps, TextMarkerRect, TextMarkerTool, } from "./components/TextMarker.js";
99
99
  export { Textarea, textareaVariants } from "./components/Textarea.js";
100
100
  export type { TextareaProps } from "./components/Textarea.js";
101
101
  export { Tile, TileDescription, TileIcon, TileTitle, tileVariants, } from "./components/Tile.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medway-ui/core",
3
- "version": "1.43.1",
3
+ "version": "1.44.0",
4
4
  "private": false,
5
5
  "description": "Biblioteca de componentes e assets para o sistema Medway",
6
6
  "author": "Alekcarvalho",