@yoopta/themes-shadcn 6.0.2 → 6.0.4
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/dist/accordion.js +1 -1
- package/dist/applyTheme.d.ts.map +1 -1
- package/dist/carousel.js +1 -1
- package/dist/chunks/button-f335deaa.js +1 -0
- package/dist/chunks/{dropdown-menu-eb328f8d.js → dropdown-menu-36750aec.js} +3 -3
- package/dist/chunks/{hover-card-d6a71398.js → hover-card-8048e9ce.js} +1 -1
- package/dist/chunks/index-371259c9.js +1 -0
- package/dist/chunks/{index-f85dae42.js → index-5b487f4e.js} +1 -1
- package/dist/chunks/{index-ba3032f8.js → index-a77c7d53.js} +1 -1
- package/dist/chunks/{index-23db6fea.js → index-bd6363d4.js} +1 -1
- package/dist/chunks/label-35a74462.js +1 -0
- package/dist/chunks/{language-select-89735035.js → language-select-ee2698cf.js} +1 -1
- package/dist/chunks/pen-d6258303.js +7 -0
- package/dist/chunks/popover-dae0ce5f.js +1 -0
- package/dist/chunks/{scroll-area-dae47c2c.js → scroll-area-8321348a.js} +1 -1
- package/dist/chunks/{select-a8bcd8b5.js → select-a3724728.js} +1 -1
- package/dist/chunks/separator-f4e74aca.js +1 -0
- package/dist/chunks/{tabs-294764a6.js → tabs-370c3f2c.js} +1 -1
- package/dist/chunks/{tooltip-65b9c3a0.js → tooltip-5defff1d.js} +2 -2
- package/dist/code-group.js +1 -1
- package/dist/code.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/embed/elements/embed/embed-inline-toolbar.d.ts.map +1 -1
- package/dist/embed.js +2 -2
- package/dist/emoji.js +1 -1
- package/dist/file/elements/file/file-inline-toolbar.d.ts.map +1 -1
- package/dist/file.js +3 -3
- package/dist/image/elements/image/image-inline-toolbar.d.ts.map +1 -1
- package/dist/image.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/link.js +1 -7
- package/dist/math/elements/math/math-edit.d.ts +13 -0
- package/dist/math/elements/math/math-edit.d.ts.map +1 -0
- package/dist/math/elements/math/math-element.d.ts +3 -0
- package/dist/math/elements/math/math-element.d.ts.map +1 -0
- package/dist/math/elements/math/math-preview.d.ts +10 -0
- package/dist/math/elements/math/math-preview.d.ts.map +1 -0
- package/dist/math/elements/math-block/math-block-element.d.ts +3 -0
- package/dist/math/elements/math-block/math-block-element.d.ts.map +1 -0
- package/dist/math/index.d.ts +15 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math.js +1 -0
- package/dist/mention.js +3 -3
- package/dist/steps.js +1 -1
- package/dist/table-of-contents/elements/table-of-contents.d.ts.map +1 -1
- package/dist/table-of-contents.js +1 -1
- package/dist/table.js +3 -3
- package/dist/tabs.js +1 -1
- package/dist/video/elements/video/video-inline-toolbar.d.ts.map +1 -1
- package/dist/video.js +2 -2
- package/package.json +20 -13
- package/dist/chunks/button-7aec29d6.js +0 -1
- package/dist/chunks/index-23c7fb16.js +0 -1
- package/dist/chunks/label-21d46c31.js +0 -1
- package/dist/chunks/popover-8e6ee2ab.js +0 -1
- package/dist/chunks/separator-219dc1f7.js +0 -1
package/dist/table.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{forwardRef as o,useState as n,useRef as r,useEffect as a,useCallback as s,useMemo as i}from"react";import{useYooptaEditor as c,Blocks as d}from"@yoopta/editor";import{TableCommands as u,TABLE_CELLS_IN_SELECTION as m,TABLE_SLATE_TO_SELECTION_SET as h}from"@yoopta/table";import{useElementOptions as b,useUpdateElementProps as p,ElementOptions as g}from"@yoopta/ui/element-options";import{_ as v}from"./chunks/_tslib-35bb891d.js";import{c as f}from"./chunks/utils-3345eade.js";import{Portal as y}from"@yoopta/ui/portal";import{Editor as w,Element as x}from"slate";import{B as k}from"./chunks/button-
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{forwardRef as o,useState as n,useRef as r,useEffect as a,useCallback as s,useMemo as i}from"react";import{useYooptaEditor as c,Blocks as d}from"@yoopta/editor";import{TableCommands as u,TABLE_CELLS_IN_SELECTION as m,TABLE_SLATE_TO_SELECTION_SET as h}from"@yoopta/table";import{useElementOptions as b,useUpdateElementProps as p,ElementOptions as g}from"@yoopta/ui/element-options";import{_ as v}from"./chunks/_tslib-35bb891d.js";import{c as f}from"./chunks/utils-3345eade.js";import{Portal as y}from"@yoopta/ui/portal";import{Editor as w,Element as x}from"slate";import{B as k}from"./chunks/button-f335deaa.js";import{P as j}from"./chunks/plus-840fe920.js";import{D as N,a as C,b as O,c as M,e as z,M as E,A as L,d as I,f as $,g as S,h as B}from"./chunks/dropdown-menu-36750aec.js";import{c as R}from"./chunks/createLucideIcon-8605f860.js";import{A as T,a as q}from"./chunks/arrow-right-38c3a9bd.js";import{T as A}from"./chunks/trash-2-f36597ff.js";import{L as D}from"./chunks/label-35a74462.js";import{P as H,a as P,b as G}from"./chunks/popover-dae0ce5f.js";import{S as _}from"./chunks/separator-f4e74aca.js";import{C as V}from"./chunks/chevron-down-28dfb290.js";import{s as F}from"./chunks/style-inject.es-e87a8d02.js";import"./chunks/index-17323747.js";import"react-dom";import"./chunks/index-91a5b8d5.js";import"./chunks/index-ff0e3962.js";import"./chunks/index-5b487f4e.js";import"./chunks/index-13505606.js";import"./chunks/index-371259c9.js";import"./chunks/index-70f4e709.js";import"./chunks/Combination-575d4475.js";import"./chunks/index-ce60ba41.js";import"./chunks/index-bd6363d4.js";import"./chunks/index-a77c7d53.js";import"./chunks/index-a5cba5f7.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.294.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const
|
|
7
|
+
*/const W=R("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),X=R("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]),Y=R("MoreHorizontal",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),J=R("MoveHorizontal",[["polyline",{points:"18 8 22 12 18 16",key:"1hqrds"}],["polyline",{points:"6 8 2 12 6 16",key:"f0ernq"}],["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}]]),K=R("MoveVertical",[["polyline",{points:"8 18 12 22 16 18",key:"1uutw3"}],["polyline",{points:"8 6 12 2 16 6",key:"d60sxy"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}]]),Z=R("Paintbrush",[["path",{d:"M18.37 2.63 14 7l-1.59-1.59a2 2 0 0 0-2.82 0L8 7l9 9 1.59-1.59a2 2 0 0 0 0-2.82L17 10l4.37-4.37a2.12 2.12 0 1 0-3-3Z",key:"m6k5sh"}],["path",{d:"M9 8c-2 3-4 3.5-7 4l8 10c2-1 6-5 6-7",key:"arzq70"}],["path",{d:"M14.5 17.5 4.5 15",key:"s7fvrz"}]]),Q=R("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]),U=R("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),ee=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("table",Object.assign({ref:l,"data-slot":"table",className:f("caption-bottom text-sm table-fixed border-collapse",o)},n))});
|
|
8
8
|
/**
|
|
9
9
|
* @license lucide-react v0.294.0 - ISC
|
|
10
10
|
*
|
|
11
11
|
* This source code is licensed under the ISC license.
|
|
12
12
|
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/ee.displayName="Table";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("thead",Object.assign({ref:l,"data-slot":"table-header",className:f("[&_tr]:border-b",o)},n))}).displayName="TableHeader";const te=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tbody",Object.assign({ref:l,"data-slot":"table-body",className:f("[&_tr:first-child]:border-t [&_tr]:border-b [&_tr]:border-border",o)},n))});te.displayName="TableBody";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tfoot",Object.assign({ref:l,"data-slot":"table-footer",className:f("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",o)},n))}).displayName="TableFooter";const le=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tr",Object.assign({ref:l,"data-slot":"table-row",className:f("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",o)},n))});le.displayName="TableRow";const oe=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("th",Object.assign({ref:l,"data-slot":"table-head",className:f("border-border border-r last:border-r-0 text-foreground h-10 px-2 text-left font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] bg-muted/50",o)},n))});oe.displayName="TableHead";const ne=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("td",Object.assign({ref:l,"data-slot":"table-cell",className:f("border-border border-r last:border-r-0 p-2 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",o)},n))});ne.displayName="TableCell";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("caption",Object.assign({ref:l,"data-slot":"table-caption",className:f("text-muted-foreground mt-4 text-sm",o)},n))}).displayName="TableCaption";const re=({blockId:t})=>{const l=c(),[o,i]=n(null),[d,m]=n(!1),[h,b]=n(null),[p,g]=n([]),v=r(0),f=r(0),w=r([]),x=r(null),k=r(null),j=r(null);a(()=>{w.current=p},[p]),a(()=>{k.current=o},[o]),a(()=>{x.current=h},[h]);const N=s(()=>{const e=document.querySelector(`[data-yoopta-block-id="${t}"][data-table-container]`);if(!e)return;const l=e.querySelector("table");if(!l)return;const o=l.getBoundingClientRect();i(o);const n=l.querySelector("colgroup");j.current=n;const r=l.querySelectorAll("colgroup col"),a=l.querySelector("tr");if(r.length>0){const e=[];o.left,r.forEach((t,l)=>{const o=window.getComputedStyle(t),n=parseInt(o.width,10)||200;e.push(n)}),g(e)}else if(a){const e=a.querySelectorAll("td, th"),t=[],l=[];e.forEach((e,o)=>{const n=e.getBoundingClientRect();l.push(n.width),t.push({index:o,left:n.left,width:n.width})}),g(l)}},[t]);a(()=>{N();const e=document.querySelector(`[data-yoopta-block-id="${t}"][data-table-container]`);if(!e)return;const l=e.querySelector("table");if(!l)return;const o=new ResizeObserver(()=>{d||N()});o.observe(l);const n=new MutationObserver(()=>{d||N()});n.observe(l,{childList:!0,subtree:!0});const r=()=>{d||N()};return window.addEventListener("scroll",r,!0),()=>{o.disconnect(),n.disconnect(),window.removeEventListener("scroll",r,!0)}},[t,N,d]);const C=s(e=>{if(!j.current)return;j.current.querySelectorAll("col").forEach((t,l)=>{void 0!==e[l]&&(t.style.width=`${e[l]}px`)})},[]),O=s((e,t)=>{if(!t||0===e.length)return[];let l=t.left;return e.map((e,t)=>{const o={index:t,left:l,width:e};return l+=e,o})},[]),M=s((e,t)=>{e.preventDefault(),e.stopPropagation();const l=p[t];void 0!==l&&(m(!0),b(t),v.current=e.clientX,f.current=l,document.body.classList.add("resizing-column"))},[p]),z=s(e=>{const t=x.current;if(null===t)return;const l=e.clientX-v.current,o=Math.max(50,f.current+l),n=[...w.current];n[t]=o,g(n),C(n)},[C]),E=s(()=>{const e=x.current,o=w.current;null!==e&&void 0!==o[e]&&u.setColumnWidth(l,t,e,o[e]),m(!1),b(null),document.body.classList.remove("resizing-column"),setTimeout(N,50)},[l,t,N]);if(a(()=>{if(d)return document.addEventListener("mousemove",z),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",E)}},[d,z,E]),!o||0===p.length)return null;const L=O(p,o).slice(0,-1).map(t=>{const l=t.left+t.width-3;return e("div",{className:"column-resize-handle",style:{position:"fixed",left:`${l}px`,top:`${o.top}px`,width:"6px",height:`${o.height}px`,cursor:"col-resize",zIndex:50,backgroundColor:d&&h===t.index?"hsl(var(--primary))":"transparent"},onMouseDown:e=>M(e,t.index),onMouseEnter:e=>{d||(e.target.style.backgroundColor="hsl(var(--primary) / 0.3)")},onMouseLeave:e=>{d||(e.target.style.backgroundColor="transparent")}},`resize-${t.index}`)});return e(y,Object.assign({id:"column-resize-handles-container"},{children:e("div",Object.assign({className:"column-resize-handles-container",style:{pointerEvents:d?"auto":void 0}},{children:L}))}))},ae=({blockId:t,totalColumns:l,position:o,onMouseEnter:n,onMouseLeave:r})=>{const a=c(),i=s(()=>{const e=[0,0,l-1,0];u.insertTableColumn(a,t,{path:e,insertMode:"after"})},[a,t,l]);return e(y,Object.assign({id:`table-add-column-button-${t}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${o.left+4}px`,top:`${o.top}px`,width:"18px",height:`${o.height}px`},onMouseEnter:n,onMouseLeave:r},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"p-0 h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md transition-all hover:shadow-md flex items-center justify-center text-muted-foreground hover:text-foreground",onClick:i,onMouseDown:e=>e.preventDefault()},{children:e(j,{className:"h-3 w-3"})}))}))}))},se=({blockId:t,totalRows:l,position:o,onMouseEnter:n,onMouseLeave:r})=>{const a=c(),i=s(()=>{const e=[0,l-1,0,0];u.insertTableRow(a,t,{path:e,insertMode:"after"})},[a,t,l]);return e(y,Object.assign({id:`table-add-row-button-${t}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${o.left}px`,top:`${o.top+4}px`,width:`${o.width}px`,height:"18px"},onMouseEnter:n,onMouseLeave:r},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md transition-all hover:shadow-md flex items-center justify-center gap-1.5 text-muted-foreground hover:text-foreground",onClick:i,onMouseDown:e=>e.preventDefault()},{children:e(j,{className:"h-3 w-3"})}))}))}))},ie=({blockId:o,colIndex:n,position:r,onMouseEnter:a,onMouseLeave:d})=>{const m=c(),h=i(()=>[0,0,n,0],[n]),b=s(()=>{u.insertTableColumn(m,o,{path:h,insertMode:"before"})},[m,o,h]),p=s(()=>{u.insertTableColumn(m,o,{path:h,insertMode:"after"})},[m,o,h]),g=s(()=>{u.deleteTableColumn(m,o,{path:h})},[m,o,h]),v=s(()=>{u.toggleHeaderColumn(m,o)},[m,o]);return e(y,Object.assign({id:`table-column-controls-${o}-${n}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${r.left}px`,top:`${r.top+4}px`,width:`${r.width}px`,height:"18px"},onMouseEnter:a,onMouseLeave:d},{children:t(N,{children:[e(C,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md p-0 transition-all hover:shadow-md",onMouseDown:e=>e.preventDefault()},{children:e(X,{className:"h-3 w-3 text-muted-foreground"})}))})),t(O,Object.assign({align:"start",side:"top",className:"w-48"},{children:[0===n&&t(l,{children:[t(M,Object.assign({onClick:v},{children:[e(Q,{className:"mr-2 h-4 w-4"}),"Header column"]})),e(z,{})]}),t(M,Object.assign({onClick:b},{children:[e(T,{className:"mr-2 h-4 w-4"}),"Insert column left"]})),t(M,Object.assign({onClick:p},{children:[e(q,{className:"mr-2 h-4 w-4"}),"Insert column right"]})),e(z,{}),t(M,Object.assign({onClick:g,className:"text-destructive focus:text-destructive"},{children:[e(A,{className:"mr-2 h-4 w-4"}),"Delete column"]}))]}))]})}))}))},ce=({blockId:o,rowIndex:n,position:r,onMouseEnter:a,onMouseLeave:d})=>{const m=c(),h=i(()=>[0,n,0,0],[n]),b=s(()=>{u.insertTableRow(m,o,{path:h,insertMode:"before"})},[m,o,h]),p=s(()=>{u.insertTableRow(m,o,{path:h,insertMode:"after"})},[m,o,h]),g=s(()=>{u.deleteTableRow(m,o,{path:h})},[m,o,h]),v=s(()=>{u.toggleHeaderRow(m,o)},[m,o]);return e(y,Object.assign({id:`table-row-controls-${o}-${n}`},{children:e("div",Object.assign({className:"fixed z-[9998] pointer-events-auto",style:{left:`${r.left+20}px`,top:`${r.top}px`,width:"18px",height:`${r.height}px`},onMouseEnter:a,onMouseLeave:d},{children:t(N,{children:[e(C,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md p-0 transition-all hover:shadow-md flex items-center justify-center",onMouseDown:e=>e.preventDefault()},{children:e(E,{className:"h-3 w-3 text-muted-foreground"})}))})),t(O,Object.assign({align:"start",side:"left",className:"w-48"},{children:[0===n&&t(l,{children:[t(M,Object.assign({onClick:v},{children:[e(Q,{className:"mr-2 h-4 w-4"}),"Header row"]})),e(z,{})]}),t(M,Object.assign({onClick:b},{children:[e(L,{className:"mr-2 h-4 w-4"}),"Insert row above"]})),t(M,Object.assign({onClick:p},{children:[e(I,{className:"mr-2 h-4 w-4"}),"Insert row below"]})),e(z,{}),t(M,Object.assign({onClick:g,className:"text-destructive focus:text-destructive"},{children:[e(A,{className:"mr-2 h-4 w-4"}),"Delete row"]}))]}))]})}))}))},de=({blockId:o})=>{const u=c(),m=i(()=>d.getBlockSlate(u,{id:o}),[o,u]),[h,b]=n(null),[p,g]=n(!1),[v,f]=n({rowControls:null,columnControls:null,addRowButton:null,addColumnButton:null}),y=r(!1),k=r(!1),j=r(null),N=r(null);N.current=h;const C=s(()=>{var e,t;const l=N.current;if(!l)return void f({rowControls:null,columnControls:null,addRowButton:null,addColumnButton:null});const n=document.querySelector(`[data-yoopta-block-id="${o}"][data-table-container]`);if(!n)return;const r=n.querySelector(".overflow-x-auto"),a=null==r?void 0:r.getBoundingClientRect(),s=n.querySelector("table");if(!s)return;const i=s.getBoundingClientRect(),c=Array.from(n.querySelectorAll("tr")),d=c[l.rowIndex];if(!d)return;const u=Array.from(d.querySelectorAll('[data-element-type="table-data-cell"]'));if(0===u.length)return;const m=u.map(e=>e.getBoundingClientRect()),h=Math.min(...m.map(e=>e.top)),b=Math.max(...m.map(e=>e.bottom)),p=Math.min(...m.map(e=>e.left)),g=b-h,v=[];c.forEach(e=>{const t=Array.from(e.querySelectorAll('[data-element-type="table-data-cell"]'));t[l.colIndex]&&v.push(t[l.colIndex].getBoundingClientRect())});const y=v.length>0?Math.min(...v.map(e=>e.left)):p,w=v.length>0?Math.max(...v.map(e=>e.right)):p,x=w-y,k=v.length>0?Math.min(...v.map(e=>e.top)):h,j=l.rowIndex===l.totalRows-1,C=l.colIndex===l.totalColumns-1,O=!a||y>=a.left-x&&w<=a.right+x,M=null!==(e=null==a?void 0:a.left)&&void 0!==e?e:i.left,z=null!==(t=null==a?void 0:a.right)&&void 0!==t?t:i.right,E=z-M;f({rowControls:{left:Math.max(0,p-32),top:h,height:g},columnControls:O?{left:y,top:k-32,width:x}:null,addRowButton:j?{left:M,top:i.bottom,width:E}:null,addColumnButton:C?{left:Math.min(i.right,z),top:i.top,height:i.height}:null})},[o]);a(()=>{if(!h||!p)return;const e=()=>{C()};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),C(),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[h,p,C]);const O=s(()=>{j.current&&(clearTimeout(j.current),j.current=null)},[]),M=s(()=>{O(),j.current=setTimeout(()=>{y.current||k.current||(g(!1),b(null))},150)},[O]),z=s(e=>{if(!m)return null;const t=Array.from(w.nodes(m,{at:[0],match:t=>{if(!x.isElement(t))return!1;const l=t;return"table-data-cell"===l.type&&"id"in l&&l.id===e},mode:"all"}));if(0===t.length)return null;const[,l]=t[0],o=l[l.length-2],n=l[l.length-1],r=Array.from(w.nodes(m,{at:[0],match:e=>x.isElement(e)&&"table"===e.type,mode:"lowest"}));if(0===r.length)return null;const[a]=r[0];if(!x.isElement(a))return null;const s=a.children.length,i=a.children[0];if(!x.isElement(i))return null;const c=i.children.length;return{rowIndex:o,colIndex:n,cellElementId:e,totalRows:s,totalColumns:c}},[m]);a(()=>{const e=document.querySelector(`[data-yoopta-block-id="${o}"][data-table-container]`);if(!e||!m)return;const t=e=>{O(),y.current=!0;const t=e.target.closest('[data-element-type="table-data-cell"]');if(!t)return;const l=t.getAttribute("data-yoopta-element-id");if(!l)return;const o=N.current;if((null==o?void 0:o.cellElementId)===l)return void g(!0);const n=z(l);n&&(b(n),g(!0))},l=()=>{y.current=!1,M()};return e.addEventListener("mousemove",t),e.addEventListener("mouseleave",l),()=>{O(),e.removeEventListener("mousemove",t),e.removeEventListener("mouseleave",l)}},[o,m,z,O,M]);const E=s(()=>{O(),k.current=!0},[O]),L=s(()=>{k.current=!1,M()},[M]);return p&&h?t(l,{children:[v.rowControls&&e(ce,{blockId:o,rowIndex:h.rowIndex,position:v.rowControls,onMouseEnter:E,onMouseLeave:L}),v.columnControls&&e(ie,{blockId:o,colIndex:h.colIndex,position:v.columnControls,onMouseEnter:E,onMouseLeave:L}),v.addColumnButton&&e(ae,{blockId:o,totalColumns:h.totalColumns,position:v.addColumnButton,onMouseEnter:E,onMouseLeave:L}),v.addRowButton&&e(se,{blockId:o,totalRows:h.totalRows,position:v.addRowButton,onMouseEnter:E,onMouseLeave:L})]}):null},ue=()=>{var l,o,n,r;const{element:a}=b(),s=p(),i=null!==(l=a.props)&&void 0!==l?l:{};return e(g.Content,Object.assign({side:"bottom",align:"end",sideOffset:8,className:"min-w-[180px] rounded-lg border bg-popover p-2 shadow-md"},{children:t(g.Group,Object.assign({className:"flex flex-col gap-1.5"},{children:[e(g.Label,Object.assign({className:"px-2 text-xs font-bold text-muted-foreground"},{children:"Appearance"})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Bordered"})),e(g.Toggle,{checked:null===(o=i.bordered)||void 0===o||o,onCheckedChange:e=>s({bordered:e})})]})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Compact"})),e(g.Toggle,{checked:null!==(n=i.compact)&&void 0!==n&&n,onCheckedChange:e=>s({compact:e})})]})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Scrollable"})),e(g.Toggle,{checked:null===(r=i.scrollable)||void 0===r||r,onCheckedChange:e=>s({scrollable:e})})]}))]}))}))},me=[{label:"None",value:"transparent",color:"transparent"},{label:"Gray",value:"hsl(var(--muted))",color:"hsl(var(--muted))"},{label:"Red",value:"hsl(0 70% 95%)",color:"hsl(0 70% 95%)"},{label:"Orange",value:"hsl(30 70% 95%)",color:"hsl(30 70% 95%)"},{label:"Yellow",value:"hsl(60 70% 95%)",color:"hsl(60 70% 95%)"},{label:"Green",value:"hsl(120 70% 95%)",color:"hsl(120 70% 95%)"},{label:"Blue",value:"hsl(210 70% 95%)",color:"hsl(210 70% 95%)"},{label:"Purple",value:"hsl(270 70% 95%)",color:"hsl(270 70% 95%)"}],he=[{label:"Default",value:"inherit",color:"currentColor"},{label:"Gray",value:"hsl(var(--muted-foreground))",color:"hsl(var(--muted-foreground))"},{label:"Red",value:"hsl(0 70% 50%)",color:"hsl(0 70% 50%)"},{label:"Orange",value:"hsl(30 70% 50%)",color:"hsl(30 70% 50%)"},{label:"Yellow",value:"hsl(60 70% 40%)",color:"hsl(60 70% 40%)"},{label:"Green",value:"hsl(120 70% 40%)",color:"hsl(120 70% 40%)"},{label:"Blue",value:"hsl(210 70% 50%)",color:"hsl(210 70% 50%)"},{label:"Purple",value:"hsl(270 70% 50%)",color:"hsl(270 70% 50%)"}],be=({blockId:o})=>{const r=c(),s=i(()=>d.getBlockSlate(r,{id:o}),[o,r]),[h,b]=n(null),[p,g]=n(!1),[v,f]=n([]),y=s?m.get(s):[];a(()=>{f(y)},[y]);const w=Array.isArray(y)&&(null==y?void 0:y.length)>0?y:v;a(()=>{if(!s||!w||w.length<=1)return void b(null);const e=document.querySelector(`[data-yoopta-block-id="${o}"]`);if(!e)return void b(null);const t=e.getBoundingClientRect();let l=1/0,n=-1/0,r=1/0,a=-1/0;for(const[e]of w){const t=document.querySelector(`[data-yoopta-block-id="${o}"] [data-yoopta-element-id="${e.id}"]`);if(!t)continue;const s=t.getBoundingClientRect();if(!s)continue;const{top:i,bottom:c,left:d,right:u}=s;l=Math.min(l,i),n=Math.max(n,c),r=Math.min(r,d),a=Math.max(a,u)}b(l!==1/0?{top:l-t.top,left:r-t.left,width:a-r,height:n-l}:null)},[s,w,o]),a(()=>{if(!w||w.length<=1)return;const e=()=>{b(e=>e?Object.assign({},e):null)};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[w]);const x=e=>{r&&w&&0!==w.length&&(u.setCellHorizontalAlign(r,o,{cells:w,align:e}),g(!1))},j=e=>{r&&w&&0!==w.length&&(u.setCellVerticalAlign(r,o,{cells:w,align:e}),g(!1))};return h?t(l,{children:[e("div",{className:"pointer-events-none absolute z-[9999]",style:{top:`${h.top}px`,left:`${h.left}px`,width:`${h.width}px`,height:`${h.height}px`,border:"2px solid hsl(var(--primary))",backgroundColor:"hsl(var(--primary) / 0.05)",borderRadius:"2px"}}),e("div",Object.assign({className:"absolute z-20 pointer-events-auto",style:{top:`${h.top+h.height/2}px`,left:`${h.left+h.width}px`,transform:"translate(-50%, -50%)"}},{children:t(H,Object.assign({open:p,onOpenChange:g},{children:[e(P,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"secondary",size:"icon",className:"h-4 w-4 rounded-full shadow-lg bg-primary hover:bg-primary/90",onMouseDown:e=>e.preventDefault()},{children:e(E,{className:"h-3 w-3 text-primary-foreground"})}))})),e(_,Object.assign({className:"w-64 p-2",align:"start",side:"right"},{children:t("div",Object.assign({className:"space-y-2"},{children:[t(k,Object.assign({variant:"ghost",size:"sm",className:"w-full justify-start gap-2",onClick:()=>{!r||!w||w.length<=1||(u.mergeCells(r,o,{cells:w}),g(!1))},disabled:!w||w.length<=1},{children:[e(W,{className:"h-4 w-4"}),"Merge cells"]})),e(G,{}),t("div",Object.assign({className:"space-y-1"},{children:[e(D,Object.assign({className:"text-sm font-medium"},{children:"Color"})),t(N,{children:[e(C,Object.assign({asChild:!0},{children:t(k,Object.assign({variant:"outline",size:"sm",className:"w-full justify-between"},{children:[t("span",Object.assign({className:"flex items-center gap-2"},{children:[e(Z,{className:"h-4 w-4"}),"Select color"]})),e(V,{className:"h-4 w-4 opacity-50"})]}))})),t(O,Object.assign({className:"w-56",align:"start"},{children:[t($,{children:[t(S,{children:[e(Z,{className:"mr-2 h-4 w-4"}),"Background color"]}),e(B,{children:me.map(l=>e(M,Object.assign({onClick:()=>(e=>{r&&w&&0!==w.length&&(u.setCellBackgroundColor(r,o,{cells:w,color:e}),g(!1))})(l.value)},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("div",{className:"h-4 w-4 rounded border",style:{backgroundColor:l.color}}),l.label]}))}),l.value))})]}),t($,{children:[t(S,{children:[e(U,{className:"mr-2 h-4 w-4"}),"Text color"]}),e(B,{children:he.map(l=>e(M,Object.assign({onClick:()=>(e=>{r&&w&&0!==w.length&&(u.setCellTextColor(r,o,{cells:w,color:e}),g(!1))})(l.value)},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("div",Object.assign({className:"h-4 w-4 rounded border flex items-center justify-center text-xs font-bold",style:{color:l.color}},{children:"A"})),l.label]}))}),l.value))})]})]}))]})]})),t("div",Object.assign({className:"space-y-1"},{children:[e(D,Object.assign({className:"text-sm font-medium"},{children:"Alignment"})),t(N,{children:[e(C,Object.assign({asChild:!0},{children:t(k,Object.assign({variant:"outline",size:"sm",className:"w-full justify-between"},{children:[t("span",Object.assign({className:"flex items-center gap-2"},{children:[e(Y,{className:"h-4 w-4"}),"Select alignment"]})),e(V,{className:"h-4 w-4 opacity-50"})]}))})),t(O,Object.assign({className:"w-56",align:"start"},{children:[t($,{children:[t(S,{children:[e(Y,{className:"mr-2 h-4 w-4"}),"Horizontal"]}),t(B,{children:[e(M,Object.assign({onClick:()=>x("left")},{children:"Left"})),e(M,Object.assign({onClick:()=>x("center")},{children:"Center"})),e(M,Object.assign({onClick:()=>x("right")},{children:"Right"})),e(M,Object.assign({onClick:()=>x("justify")},{children:"Justify"}))]})]}),t($,{children:[t(S,{children:[e(K,{className:"mr-2 h-4 w-4"}),"Vertical"]}),t(B,{children:[e(M,Object.assign({onClick:()=>j("top")},{children:"Top"})),e(M,Object.assign({onClick:()=>j("middle")},{children:"Middle"})),e(M,Object.assign({onClick:()=>j("bottom")},{children:"Bottom"}))]})]})]}))]})]})),e(G,{}),t(k,Object.assign({variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-destructive hover:text-destructive",onClick:()=>{r&&w&&0!==w.length&&(u.clearContents(r,o,{cells:w}),g(!1))}},{children:[e(J,{className:"h-4 w-4"}),"Clear contents"]}))]}))}))]}))}))]}):null};F("[data-element-type=table-data-cell] [data-slate-node=element]{margin:0}[data-slate-node=table]{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-slate-node=table-data-cell]{cursor:cell}[data-slate-node=table-data-cell]:active{cursor:crosshair}[data-is-selecting=true] ::-moz-selection{background:none}[data-is-selecting=true] ::selection{background:none}.column-resize-handle{transition:background-color .15s ease}.column-resize-handle:hover{background-color:hsl(var(--primary)/.3)!important}.yoopta-table-bordered [data-slot=table-cell]:first-child,.yoopta-table-bordered [data-slot=table-head]:first-child{border-left:1px solid hsl(var(--border))}.yoopta-table-bordered [data-slot=table-cell]:last-child,.yoopta-table-bordered [data-slot=table-head]:last-child{border-right:1px solid hsl(var(--border))}.yoopta-table-no-borders [data-slot=table-body] tr:first-child{border-top:none}.yoopta-table-no-borders [data-slot=table-body] tr:last-child{border-bottom:none}.yoopta-table-striped [data-slot=table-body] tr:nth-child(2n){background-color:hsl(var(--muted)/.4)}.yoopta-table-compact [data-slot=table-cell],.yoopta-table-compact [data-slot=table-head]{padding:4px 6px}.yoopta-table-compact [data-slot=table-head]{height:auto}.yoopta-table-scrollable table[data-slot=table]{min-width:100%}body.resizing-column{-webkit-user-select:none!important;-moz-user-select:none!important;user-select:none!important}body.resizing-column,body.resizing-column *{cursor:col-resize!important}");const pe={table:{render:o=>{var n,r,a,s,u,m,b;const{attributes:p,children:v,element:y,blockId:w}=o,x=y,k=c(),j=i(()=>d.getBlockSlate(k,{id:w}),[k,w]),N=j?h.get(j):null,C=null===(r=null===(n=x.props)||void 0===n?void 0:n.bordered)||void 0===r||r,O=null!==(s=null===(a=x.props)||void 0===a?void 0:a.compact)&&void 0!==s&&s,M=null===(m=null===(u=x.props)||void 0===u?void 0:u.scrollable)||void 0===m||m,z=null===(b=x.props)||void 0===b?void 0:b.columnWidths,E=i(()=>{if(M&&z&&0!==z.length)return z.reduce((e,t)=>e+("number"==typeof t?t:parseFloat(String(t))||0),0)},[M,z]);return t("div",Object.assign({className:f("group relative p-4",C?"yoopta-table-bordered":"yoopta-table-no-borders",O&&"yoopta-table-compact",M&&"yoopta-table-scrollable"),"data-yoopta-block-id":w,"data-table-container":!0},{children:[t(g.Root,Object.assign({blockId:w,element:y},{children:[e(g.Trigger,{className:"absolute right-0 top-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity rounded-md p-1 hover:bg-accent"}),e(ue,{})]})),e("div",Object.assign({className:f(M&&"overflow-x-auto")},{children:t(ee,Object.assign({},p,{style:M&&E?{width:`${E}px`}:void 0,"data-is-selecting":!!N},{children:[e("colgroup",{children:null==z?void 0:z.map((t,l)=>e("col",{style:{width:`${t}px`}},l))}),e(te,{children:v})]}))})),!k.readOnly&&t(l,{children:[e(be,{blockId:w}),e(de,{blockId:w}),e(re,{blockId:w})]})]}))}},"table-row":{render:t=>{const{attributes:l,children:o}=t;return e(le,Object.assign({},l,{children:o}))}},"table-data-cell":{render:t=>{var l,o,n,r,a,s,u,b,p,g,v,y;const{attributes:w,children:x,element:k}=t,j=k,N=c(),C=i(()=>d.getBlockSlate(N,{id:t.blockId}),[N,t.blockId]),O=(null===(l=j.props)||void 0===l?void 0:l.asHeader)?oe:ne;return e(O,Object.assign({},w,{onMouseDown:e=>{N.readOnly||(e.stopPropagation(),C&&(m.delete(C),h.delete(C)))},colSpan:null!==(n=null===(o=j.props)||void 0===o?void 0:o.colSpan)&&void 0!==n?n:1,rowSpan:null!==(a=null===(r=j.props)||void 0===r?void 0:r.rowSpan)&&void 0!==a?a:1,align:null!==(u=null===(s=j.props)||void 0===s?void 0:s.align)&&void 0!==u?u:"left",valign:null!==(p=null===(b=j.props)||void 0===b?void 0:b.verticalAlign)&&void 0!==p?p:"middle","data-yoopta-element-id":j.id,className:f("relative group transition-colors"),style:{backgroundColor:null===(g=j.props)||void 0===g?void 0:g.backgroundColor,color:null!==(y=null===(v=j.props)||void 0===v?void 0:v.color)&&void 0!==y?y:"inherit"}},{children:x}))}}};export{pe as TableUI};
|
|
13
|
+
*/ee.displayName="Table";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("thead",Object.assign({ref:l,"data-slot":"table-header",className:f("[&_tr]:border-b",o)},n))}).displayName="TableHeader";const te=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tbody",Object.assign({ref:l,"data-slot":"table-body",className:f("[&_tr:first-child]:border-t [&_tr]:border-b [&_tr]:border-border",o)},n))});te.displayName="TableBody";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tfoot",Object.assign({ref:l,"data-slot":"table-footer",className:f("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",o)},n))}).displayName="TableFooter";const le=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("tr",Object.assign({ref:l,"data-slot":"table-row",className:f("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",o)},n))});le.displayName="TableRow";const oe=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("th",Object.assign({ref:l,"data-slot":"table-head",className:f("border-border border-r last:border-r-0 text-foreground h-10 px-2 text-left font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] bg-muted/50",o)},n))});oe.displayName="TableHead";const ne=o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("td",Object.assign({ref:l,"data-slot":"table-cell",className:f("border-border border-r last:border-r-0 p-2 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",o)},n))});ne.displayName="TableCell";o((t,l)=>{var{className:o}=t,n=v(t,["className"]);return e("caption",Object.assign({ref:l,"data-slot":"table-caption",className:f("text-muted-foreground mt-4 text-sm",o)},n))}).displayName="TableCaption";const re=({blockId:t})=>{const l=c(),[o,i]=n(null),[d,m]=n(!1),[h,b]=n(null),[p,g]=n([]),v=r(0),f=r(0),w=r([]),x=r(null),k=r(null),j=r(null);a(()=>{w.current=p},[p]),a(()=>{k.current=o},[o]),a(()=>{x.current=h},[h]);const N=s(()=>{const e=document.querySelector(`[data-yoopta-block-id="${t}"][data-table-container]`);if(!e)return;const l=e.querySelector("table");if(!l)return;const o=l.getBoundingClientRect();i(o);const n=l.querySelector("colgroup");j.current=n;const r=l.querySelectorAll("colgroup col"),a=l.querySelector("tr");if(r.length>0){const e=[];o.left,r.forEach((t,l)=>{const o=window.getComputedStyle(t),n=parseInt(o.width,10)||200;e.push(n)}),g(e)}else if(a){const e=a.querySelectorAll("td, th"),t=[],l=[];e.forEach((e,o)=>{const n=e.getBoundingClientRect();l.push(n.width),t.push({index:o,left:n.left,width:n.width})}),g(l)}},[t]);a(()=>{N();const e=document.querySelector(`[data-yoopta-block-id="${t}"][data-table-container]`);if(!e)return;const l=e.querySelector("table");if(!l)return;const o=new ResizeObserver(()=>{d||N()});o.observe(l);const n=new MutationObserver(()=>{d||N()});n.observe(l,{childList:!0,subtree:!0});const r=()=>{d||N()};return window.addEventListener("scroll",r,!0),()=>{o.disconnect(),n.disconnect(),window.removeEventListener("scroll",r,!0)}},[t,N,d]);const C=s(e=>{if(!j.current)return;j.current.querySelectorAll("col").forEach((t,l)=>{void 0!==e[l]&&(t.style.width=`${e[l]}px`)})},[]),O=s((e,t)=>{if(!t||0===e.length)return[];let l=t.left;return e.map((e,t)=>{const o={index:t,left:l,width:e};return l+=e,o})},[]),M=s((e,t)=>{e.preventDefault(),e.stopPropagation();const l=p[t];void 0!==l&&(m(!0),b(t),v.current=e.clientX,f.current=l,document.body.classList.add("resizing-column"))},[p]),z=s(e=>{const t=x.current;if(null===t)return;const l=e.clientX-v.current,o=Math.max(50,f.current+l),n=[...w.current];n[t]=o,g(n),C(n)},[C]),E=s(()=>{const e=x.current,o=w.current;null!==e&&void 0!==o[e]&&u.setColumnWidth(l,t,e,o[e]),m(!1),b(null),document.body.classList.remove("resizing-column"),setTimeout(N,50)},[l,t,N]);if(a(()=>{if(d)return document.addEventListener("mousemove",z),document.addEventListener("mouseup",E),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",E)}},[d,z,E]),!o||0===p.length)return null;const L=O(p,o).slice(0,-1).map(t=>{const l=t.left+t.width-3;return e("div",{className:"column-resize-handle",style:{position:"fixed",left:`${l}px`,top:`${o.top}px`,width:"6px",height:`${o.height}px`,cursor:"col-resize",zIndex:50,backgroundColor:d&&h===t.index?"hsl(var(--primary))":"transparent"},onMouseDown:e=>M(e,t.index),onMouseEnter:e=>{d||(e.target.style.backgroundColor="hsl(var(--primary) / 0.3)")},onMouseLeave:e=>{d||(e.target.style.backgroundColor="transparent")}},`resize-${t.index}`)});return e(y,Object.assign({id:"column-resize-handles-container"},{children:e("div",Object.assign({className:"column-resize-handles-container",style:{pointerEvents:d?"auto":void 0}},{children:L}))}))},ae=({blockId:t,totalColumns:l,position:o,onMouseEnter:n,onMouseLeave:r})=>{const a=c(),i=s(()=>{const e=[0,0,l-1,0];u.insertTableColumn(a,t,{path:e,insertMode:"after"})},[a,t,l]);return e(y,Object.assign({id:`table-add-column-button-${t}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${o.left+4}px`,top:`${o.top}px`,width:"18px",height:`${o.height}px`},onMouseEnter:n,onMouseLeave:r},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"p-0 h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md transition-all hover:shadow-md flex items-center justify-center text-muted-foreground hover:text-foreground",onClick:i,onMouseDown:e=>e.preventDefault()},{children:e(j,{className:"h-3 w-3"})}))}))}))},se=({blockId:t,totalRows:l,position:o,onMouseEnter:n,onMouseLeave:r})=>{const a=c(),i=s(()=>{const e=[0,l-1,0,0];u.insertTableRow(a,t,{path:e,insertMode:"after"})},[a,t,l]);return e(y,Object.assign({id:`table-add-row-button-${t}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${o.left}px`,top:`${o.top+4}px`,width:`${o.width}px`,height:"18px"},onMouseEnter:n,onMouseLeave:r},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md transition-all hover:shadow-md flex items-center justify-center gap-1.5 text-muted-foreground hover:text-foreground",onClick:i,onMouseDown:e=>e.preventDefault()},{children:e(j,{className:"h-3 w-3"})}))}))}))},ie=({blockId:o,colIndex:n,position:r,onMouseEnter:a,onMouseLeave:d})=>{const m=c(),h=i(()=>[0,0,n,0],[n]),b=s(()=>{u.insertTableColumn(m,o,{path:h,insertMode:"before"})},[m,o,h]),p=s(()=>{u.insertTableColumn(m,o,{path:h,insertMode:"after"})},[m,o,h]),g=s(()=>{u.deleteTableColumn(m,o,{path:h})},[m,o,h]),v=s(()=>{u.toggleHeaderColumn(m,o)},[m,o]);return e(y,Object.assign({id:`table-column-controls-${o}-${n}`},{children:e("div",Object.assign({className:"fixed z-[9999] pointer-events-auto",style:{left:`${r.left}px`,top:`${r.top+4}px`,width:`${r.width}px`,height:"18px"},onMouseEnter:a,onMouseLeave:d},{children:t(N,{children:[e(C,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md p-0 transition-all hover:shadow-md",onMouseDown:e=>e.preventDefault()},{children:e(Y,{className:"h-3 w-3 text-muted-foreground"})}))})),t(O,Object.assign({align:"start",side:"top",className:"w-48"},{children:[0===n&&t(l,{children:[t(M,Object.assign({onClick:v},{children:[e(Q,{className:"mr-2 h-4 w-4"}),"Header column"]})),e(z,{})]}),t(M,Object.assign({onClick:b},{children:[e(T,{className:"mr-2 h-4 w-4"}),"Insert column left"]})),t(M,Object.assign({onClick:p},{children:[e(q,{className:"mr-2 h-4 w-4"}),"Insert column right"]})),e(z,{}),t(M,Object.assign({onClick:g,className:"text-destructive focus:text-destructive"},{children:[e(A,{className:"mr-2 h-4 w-4"}),"Delete column"]}))]}))]})}))}))},ce=({blockId:o,rowIndex:n,position:r,onMouseEnter:a,onMouseLeave:d})=>{const m=c(),h=i(()=>[0,n,0,0],[n]),b=s(()=>{u.insertTableRow(m,o,{path:h,insertMode:"before"})},[m,o,h]),p=s(()=>{u.insertTableRow(m,o,{path:h,insertMode:"after"})},[m,o,h]),g=s(()=>{u.deleteTableRow(m,o,{path:h})},[m,o,h]),v=s(()=>{u.toggleHeaderRow(m,o)},[m,o]);return e(y,Object.assign({id:`table-row-controls-${o}-${n}`},{children:e("div",Object.assign({className:"fixed z-[9998] pointer-events-auto",style:{left:`${r.left+20}px`,top:`${r.top}px`,width:"18px",height:`${r.height}px`},onMouseEnter:a,onMouseLeave:d},{children:t(N,{children:[e(C,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"ghost",size:"sm",className:"h-full w-full bg-background/95 hover:bg-accent border border-border/50 shadow-sm rounded-md p-0 transition-all hover:shadow-md flex items-center justify-center",onMouseDown:e=>e.preventDefault()},{children:e(E,{className:"h-3 w-3 text-muted-foreground"})}))})),t(O,Object.assign({align:"start",side:"left",className:"w-48"},{children:[0===n&&t(l,{children:[t(M,Object.assign({onClick:v},{children:[e(Q,{className:"mr-2 h-4 w-4"}),"Header row"]})),e(z,{})]}),t(M,Object.assign({onClick:b},{children:[e(L,{className:"mr-2 h-4 w-4"}),"Insert row above"]})),t(M,Object.assign({onClick:p},{children:[e(I,{className:"mr-2 h-4 w-4"}),"Insert row below"]})),e(z,{}),t(M,Object.assign({onClick:g,className:"text-destructive focus:text-destructive"},{children:[e(A,{className:"mr-2 h-4 w-4"}),"Delete row"]}))]}))]})}))}))},de=({blockId:o})=>{const u=c(),m=i(()=>d.getBlockSlate(u,{id:o}),[o,u]),[h,b]=n(null),[p,g]=n(!1),[v,f]=n({rowControls:null,columnControls:null,addRowButton:null,addColumnButton:null}),y=r(!1),k=r(!1),j=r(null),N=r(null);N.current=h;const C=s(()=>{var e,t;const l=N.current;if(!l)return void f({rowControls:null,columnControls:null,addRowButton:null,addColumnButton:null});const n=document.querySelector(`[data-yoopta-block-id="${o}"][data-table-container]`);if(!n)return;const r=n.querySelector(".overflow-x-auto"),a=null==r?void 0:r.getBoundingClientRect(),s=n.querySelector("table");if(!s)return;const i=s.getBoundingClientRect(),c=Array.from(n.querySelectorAll("tr")),d=c[l.rowIndex];if(!d)return;const u=Array.from(d.querySelectorAll('[data-element-type="table-data-cell"]'));if(0===u.length)return;const m=u.map(e=>e.getBoundingClientRect()),h=Math.min(...m.map(e=>e.top)),b=Math.max(...m.map(e=>e.bottom)),p=Math.min(...m.map(e=>e.left)),g=b-h,v=[];c.forEach(e=>{const t=Array.from(e.querySelectorAll('[data-element-type="table-data-cell"]'));t[l.colIndex]&&v.push(t[l.colIndex].getBoundingClientRect())});const y=v.length>0?Math.min(...v.map(e=>e.left)):p,w=v.length>0?Math.max(...v.map(e=>e.right)):p,x=w-y,k=v.length>0?Math.min(...v.map(e=>e.top)):h,j=l.rowIndex===l.totalRows-1,C=l.colIndex===l.totalColumns-1,O=!a||y>=a.left-x&&w<=a.right+x,M=null!==(e=null==a?void 0:a.left)&&void 0!==e?e:i.left,z=null!==(t=null==a?void 0:a.right)&&void 0!==t?t:i.right,E=z-M;f({rowControls:{left:Math.max(0,p-32),top:h,height:g},columnControls:O?{left:y,top:k-32,width:x}:null,addRowButton:j?{left:M,top:i.bottom,width:E}:null,addColumnButton:C?{left:Math.min(i.right,z),top:i.top,height:i.height}:null})},[o]);a(()=>{if(!h||!p)return;const e=()=>{C()};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),C(),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[h,p,C]);const O=s(()=>{j.current&&(clearTimeout(j.current),j.current=null)},[]),M=s(()=>{O(),j.current=setTimeout(()=>{y.current||k.current||(g(!1),b(null))},150)},[O]),z=s(e=>{if(!m)return null;const t=Array.from(w.nodes(m,{at:[0],match:t=>{if(!x.isElement(t))return!1;const l=t;return"table-data-cell"===l.type&&"id"in l&&l.id===e},mode:"all"}));if(0===t.length)return null;const[,l]=t[0],o=l[l.length-2],n=l[l.length-1],r=Array.from(w.nodes(m,{at:[0],match:e=>x.isElement(e)&&"table"===e.type,mode:"lowest"}));if(0===r.length)return null;const[a]=r[0];if(!x.isElement(a))return null;const s=a.children.length,i=a.children[0];if(!x.isElement(i))return null;const c=i.children.length;return{rowIndex:o,colIndex:n,cellElementId:e,totalRows:s,totalColumns:c}},[m]);a(()=>{const e=document.querySelector(`[data-yoopta-block-id="${o}"][data-table-container]`);if(!e||!m)return;const t=e=>{O(),y.current=!0;const t=e.target.closest('[data-element-type="table-data-cell"]');if(!t)return;const l=t.getAttribute("data-yoopta-element-id");if(!l)return;const o=N.current;if((null==o?void 0:o.cellElementId)===l)return void g(!0);const n=z(l);n&&(b(n),g(!0))},l=()=>{y.current=!1,M()};return e.addEventListener("mousemove",t),e.addEventListener("mouseleave",l),()=>{O(),e.removeEventListener("mousemove",t),e.removeEventListener("mouseleave",l)}},[o,m,z,O,M]);const E=s(()=>{O(),k.current=!0},[O]),L=s(()=>{k.current=!1,M()},[M]);return p&&h?t(l,{children:[v.rowControls&&e(ce,{blockId:o,rowIndex:h.rowIndex,position:v.rowControls,onMouseEnter:E,onMouseLeave:L}),v.columnControls&&e(ie,{blockId:o,colIndex:h.colIndex,position:v.columnControls,onMouseEnter:E,onMouseLeave:L}),v.addColumnButton&&e(ae,{blockId:o,totalColumns:h.totalColumns,position:v.addColumnButton,onMouseEnter:E,onMouseLeave:L}),v.addRowButton&&e(se,{blockId:o,totalRows:h.totalRows,position:v.addRowButton,onMouseEnter:E,onMouseLeave:L})]}):null},ue=()=>{var l,o,n,r;const{element:a}=b(),s=p(),i=null!==(l=a.props)&&void 0!==l?l:{};return e(g.Content,Object.assign({side:"bottom",align:"end",sideOffset:8,className:"min-w-[180px] rounded-lg border bg-popover p-2 shadow-md"},{children:t(g.Group,Object.assign({className:"flex flex-col gap-1.5"},{children:[e(g.Label,Object.assign({className:"px-2 text-xs font-bold text-muted-foreground"},{children:"Appearance"})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Bordered"})),e(g.Toggle,{checked:null===(o=i.bordered)||void 0===o||o,onCheckedChange:e=>s({bordered:e})})]})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Compact"})),e(g.Toggle,{checked:null!==(n=i.compact)&&void 0!==n&&n,onCheckedChange:e=>s({compact:e})})]})),t("div",Object.assign({className:"flex items-center justify-between px-2"},{children:[e("span",Object.assign({className:"text-xs font-medium text-muted-foreground"},{children:"Scrollable"})),e(g.Toggle,{checked:null===(r=i.scrollable)||void 0===r||r,onCheckedChange:e=>s({scrollable:e})})]}))]}))}))},me=[{label:"None",value:"transparent",color:"transparent"},{label:"Gray",value:"hsl(var(--muted))",color:"hsl(var(--muted))"},{label:"Red",value:"hsl(0 70% 95%)",color:"hsl(0 70% 95%)"},{label:"Orange",value:"hsl(30 70% 95%)",color:"hsl(30 70% 95%)"},{label:"Yellow",value:"hsl(60 70% 95%)",color:"hsl(60 70% 95%)"},{label:"Green",value:"hsl(120 70% 95%)",color:"hsl(120 70% 95%)"},{label:"Blue",value:"hsl(210 70% 95%)",color:"hsl(210 70% 95%)"},{label:"Purple",value:"hsl(270 70% 95%)",color:"hsl(270 70% 95%)"}],he=[{label:"Default",value:"inherit",color:"currentColor"},{label:"Gray",value:"hsl(var(--muted-foreground))",color:"hsl(var(--muted-foreground))"},{label:"Red",value:"hsl(0 70% 50%)",color:"hsl(0 70% 50%)"},{label:"Orange",value:"hsl(30 70% 50%)",color:"hsl(30 70% 50%)"},{label:"Yellow",value:"hsl(60 70% 40%)",color:"hsl(60 70% 40%)"},{label:"Green",value:"hsl(120 70% 40%)",color:"hsl(120 70% 40%)"},{label:"Blue",value:"hsl(210 70% 50%)",color:"hsl(210 70% 50%)"},{label:"Purple",value:"hsl(270 70% 50%)",color:"hsl(270 70% 50%)"}],be=({blockId:o})=>{const r=c(),s=i(()=>d.getBlockSlate(r,{id:o}),[o,r]),[h,b]=n(null),[p,g]=n(!1),[v,f]=n([]),y=s?m.get(s):[];a(()=>{f(y)},[y]);const w=Array.isArray(y)&&(null==y?void 0:y.length)>0?y:v;a(()=>{if(!s||!w||w.length<=1)return void b(null);const e=document.querySelector(`[data-yoopta-block-id="${o}"]`);if(!e)return void b(null);const t=e.getBoundingClientRect();let l=1/0,n=-1/0,r=1/0,a=-1/0;for(const[e]of w){const t=document.querySelector(`[data-yoopta-block-id="${o}"] [data-yoopta-element-id="${e.id}"]`);if(!t)continue;const s=t.getBoundingClientRect();if(!s)continue;const{top:i,bottom:c,left:d,right:u}=s;l=Math.min(l,i),n=Math.max(n,c),r=Math.min(r,d),a=Math.max(a,u)}b(l!==1/0?{top:l-t.top,left:r-t.left,width:a-r,height:n-l}:null)},[s,w,o]),a(()=>{if(!w||w.length<=1)return;const e=()=>{b(e=>e?Object.assign({},e):null)};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[w]);const x=e=>{r&&w&&0!==w.length&&(u.setCellHorizontalAlign(r,o,{cells:w,align:e}),g(!1))},j=e=>{r&&w&&0!==w.length&&(u.setCellVerticalAlign(r,o,{cells:w,align:e}),g(!1))};return h?t(l,{children:[e("div",{className:"pointer-events-none absolute z-[9999]",style:{top:`${h.top}px`,left:`${h.left}px`,width:`${h.width}px`,height:`${h.height}px`,border:"2px solid hsl(var(--primary))",backgroundColor:"hsl(var(--primary) / 0.05)",borderRadius:"2px"}}),e("div",Object.assign({className:"absolute z-20 pointer-events-auto",style:{top:`${h.top+h.height/2}px`,left:`${h.left+h.width}px`,transform:"translate(-50%, -50%)"}},{children:t(H,Object.assign({open:p,onOpenChange:g},{children:[e(P,Object.assign({asChild:!0},{children:e(k,Object.assign({variant:"secondary",size:"icon",className:"h-4 w-4 rounded-full shadow-lg bg-primary hover:bg-primary/90",onMouseDown:e=>e.preventDefault()},{children:e(E,{className:"h-3 w-3 text-primary-foreground"})}))})),e(G,Object.assign({className:"w-64 p-2",align:"start",side:"right"},{children:t("div",Object.assign({className:"space-y-2"},{children:[t(k,Object.assign({variant:"ghost",size:"sm",className:"w-full justify-start gap-2",onClick:()=>{!r||!w||w.length<=1||(u.mergeCells(r,o,{cells:w}),g(!1))},disabled:!w||w.length<=1},{children:[e(X,{className:"h-4 w-4"}),"Merge cells"]})),e(_,{}),t("div",Object.assign({className:"space-y-1"},{children:[e(D,Object.assign({className:"text-sm font-medium"},{children:"Color"})),t(N,{children:[e(C,Object.assign({asChild:!0},{children:t(k,Object.assign({variant:"outline",size:"sm",className:"w-full justify-between"},{children:[t("span",Object.assign({className:"flex items-center gap-2"},{children:[e(Z,{className:"h-4 w-4"}),"Select color"]})),e(V,{className:"h-4 w-4 opacity-50"})]}))})),t(O,Object.assign({className:"w-56",align:"start"},{children:[t($,{children:[t(S,{children:[e(Z,{className:"mr-2 h-4 w-4"}),"Background color"]}),e(B,{children:me.map(l=>e(M,Object.assign({onClick:()=>(e=>{r&&w&&0!==w.length&&(u.setCellBackgroundColor(r,o,{cells:w,color:e}),g(!1))})(l.value)},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("div",{className:"h-4 w-4 rounded border",style:{backgroundColor:l.color}}),l.label]}))}),l.value))})]}),t($,{children:[t(S,{children:[e(U,{className:"mr-2 h-4 w-4"}),"Text color"]}),e(B,{children:he.map(l=>e(M,Object.assign({onClick:()=>(e=>{r&&w&&0!==w.length&&(u.setCellTextColor(r,o,{cells:w,color:e}),g(!1))})(l.value)},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[e("div",Object.assign({className:"h-4 w-4 rounded border flex items-center justify-center text-xs font-bold",style:{color:l.color}},{children:"A"})),l.label]}))}),l.value))})]})]}))]})]})),t("div",Object.assign({className:"space-y-1"},{children:[e(D,Object.assign({className:"text-sm font-medium"},{children:"Alignment"})),t(N,{children:[e(C,Object.assign({asChild:!0},{children:t(k,Object.assign({variant:"outline",size:"sm",className:"w-full justify-between"},{children:[t("span",Object.assign({className:"flex items-center gap-2"},{children:[e(J,{className:"h-4 w-4"}),"Select alignment"]})),e(V,{className:"h-4 w-4 opacity-50"})]}))})),t(O,Object.assign({className:"w-56",align:"start"},{children:[t($,{children:[t(S,{children:[e(J,{className:"mr-2 h-4 w-4"}),"Horizontal"]}),t(B,{children:[e(M,Object.assign({onClick:()=>x("left")},{children:"Left"})),e(M,Object.assign({onClick:()=>x("center")},{children:"Center"})),e(M,Object.assign({onClick:()=>x("right")},{children:"Right"})),e(M,Object.assign({onClick:()=>x("justify")},{children:"Justify"}))]})]}),t($,{children:[t(S,{children:[e(K,{className:"mr-2 h-4 w-4"}),"Vertical"]}),t(B,{children:[e(M,Object.assign({onClick:()=>j("top")},{children:"Top"})),e(M,Object.assign({onClick:()=>j("middle")},{children:"Middle"})),e(M,Object.assign({onClick:()=>j("bottom")},{children:"Bottom"}))]})]})]}))]})]})),e(_,{}),t(k,Object.assign({variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-destructive hover:text-destructive",onClick:()=>{r&&w&&0!==w.length&&(u.clearContents(r,o,{cells:w}),g(!1))}},{children:[e(W,{className:"h-4 w-4"}),"Clear contents"]}))]}))}))]}))}))]}):null};F("[data-element-type=table-data-cell] [data-slate-node=element]{margin:0}[data-slate-node=table]{-webkit-user-select:none;-moz-user-select:none;user-select:none}[data-slate-node=table-data-cell]{cursor:cell}[data-slate-node=table-data-cell]:active{cursor:crosshair}[data-is-selecting=true] ::-moz-selection{background:none}[data-is-selecting=true] ::selection{background:none}.column-resize-handle{transition:background-color .15s ease}.column-resize-handle:hover{background-color:hsl(var(--primary)/.3)!important}.yoopta-table-bordered [data-slot=table-cell]:first-child,.yoopta-table-bordered [data-slot=table-head]:first-child{border-left:1px solid hsl(var(--border))}.yoopta-table-bordered [data-slot=table-cell]:last-child,.yoopta-table-bordered [data-slot=table-head]:last-child{border-right:1px solid hsl(var(--border))}.yoopta-table-no-borders [data-slot=table-body] tr:first-child{border-top:none}.yoopta-table-no-borders [data-slot=table-body] tr:last-child{border-bottom:none}.yoopta-table-striped [data-slot=table-body] tr:nth-child(2n){background-color:hsl(var(--muted)/.4)}.yoopta-table-compact [data-slot=table-cell],.yoopta-table-compact [data-slot=table-head]{padding:4px 6px}.yoopta-table-compact [data-slot=table-head]{height:auto}.yoopta-table-scrollable table[data-slot=table]{min-width:100%}body.resizing-column{-webkit-user-select:none!important;-moz-user-select:none!important;user-select:none!important}body.resizing-column,body.resizing-column *{cursor:col-resize!important}");const pe={table:{render:o=>{var n,r,a,s,u,m,b;const{attributes:p,children:v,element:y,blockId:w}=o,x=y,k=c(),j=i(()=>d.getBlockSlate(k,{id:w}),[k,w]),N=j?h.get(j):null,C=null===(r=null===(n=x.props)||void 0===n?void 0:n.bordered)||void 0===r||r,O=null!==(s=null===(a=x.props)||void 0===a?void 0:a.compact)&&void 0!==s&&s,M=null===(m=null===(u=x.props)||void 0===u?void 0:u.scrollable)||void 0===m||m,z=null===(b=x.props)||void 0===b?void 0:b.columnWidths,E=i(()=>{if(M&&z&&0!==z.length)return z.reduce((e,t)=>e+("number"==typeof t?t:parseFloat(String(t))||0),0)},[M,z]);return t("div",Object.assign({className:f("group relative p-4",C?"yoopta-table-bordered":"yoopta-table-no-borders",O&&"yoopta-table-compact",M&&"yoopta-table-scrollable"),"data-yoopta-block-id":w,"data-table-container":!0},{children:[t(g.Root,Object.assign({blockId:w,element:y},{children:[e(g.Trigger,{className:"absolute right-0 top-0 z-10 opacity-0 group-hover:opacity-100 transition-opacity rounded-md p-1 hover:bg-accent"}),e(ue,{})]})),e("div",Object.assign({className:f(M&&"overflow-x-auto")},{children:t(ee,Object.assign({},p,{style:M&&E?{width:`${E}px`}:void 0,"data-is-selecting":!!N},{children:[e("colgroup",{children:null==z?void 0:z.map((t,l)=>e("col",{style:{width:`${t}px`}},l))}),e(te,{children:v})]}))})),!k.readOnly&&t(l,{children:[e(be,{blockId:w}),e(de,{blockId:w}),e(re,{blockId:w})]})]}))}},"table-row":{render:t=>{const{attributes:l,children:o}=t;return e(le,Object.assign({},l,{children:o}))}},"table-data-cell":{render:t=>{var l,o,n,r,a,s,u,b,p,g,v,y;const{attributes:w,children:x,element:k}=t,j=k,N=c(),C=i(()=>d.getBlockSlate(N,{id:t.blockId}),[N,t.blockId]),O=(null===(l=j.props)||void 0===l?void 0:l.asHeader)?oe:ne;return e(O,Object.assign({},w,{onMouseDown:e=>{N.readOnly||(e.stopPropagation(),C&&(m.delete(C),h.delete(C)))},colSpan:null!==(n=null===(o=j.props)||void 0===o?void 0:o.colSpan)&&void 0!==n?n:1,rowSpan:null!==(a=null===(r=j.props)||void 0===r?void 0:r.rowSpan)&&void 0!==a?a:1,align:null!==(u=null===(s=j.props)||void 0===s?void 0:s.align)&&void 0!==u?u:"left",valign:null!==(p=null===(b=j.props)||void 0===b?void 0:b.verticalAlign)&&void 0!==p?p:"middle","data-yoopta-element-id":j.id,className:f("relative group transition-colors"),style:{backgroundColor:null===(g=j.props)||void 0===g?void 0:g.backgroundColor,color:null!==(y=null===(v=j.props)||void 0===v?void 0:v.color)&&void 0!==y?y:"inherit"}},{children:x}))}}};export{pe as TableUI};
|
package/dist/tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useYooptaEditor as s,Blocks as n}from"@yoopta/editor";import{Transforms as i,Element as r}from"slate";import{T as o,a,b as c,c as l}from"./chunks/tabs-
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useYooptaEditor as s,Blocks as n}from"@yoopta/editor";import{Transforms as i,Element as r}from"slate";import{T as o,a,b as c,c as l}from"./chunks/tabs-370c3f2c.js";import{TabsCommands as d}from"@yoopta/tabs";import{X as u}from"./chunks/x-9bfeb90f.js";import{S as m,a as p}from"./chunks/scroll-area-8321348a.js";import{P as b}from"./chunks/plus-840fe920.js";import"./chunks/_tslib-35bb891d.js";import"react";import"./chunks/index-17323747.js";import"react-dom";import"./chunks/index-91a5b8d5.js";import"./chunks/index-a77c7d53.js";import"./chunks/index-5b487f4e.js";import"./chunks/index-ce60ba41.js";import"./chunks/index-70f4e709.js";import"./chunks/index-ff0e3962.js";import"./chunks/index-13505606.js";import"./chunks/index-bd6363d4.js";import"./chunks/utils-3345eade.js";import"./chunks/createLucideIcon-8605f860.js";import"./chunks/index-056e5c06.js";const h={"tabs-container":{render:t=>{var a;const{attributes:c,children:l,blockId:d,element:u}=t,m=s();return e(o,Object.assign({},c,{value:null===(a=u.props)||void 0===a?void 0:a.activeTabId,onValueChange:e=>{const t=n.getBlockSlate(m,{id:d});t&&i.setNodes(t,{props:Object.assign(Object.assign({},u.props),{activeTabId:e})},{at:[0],match:e=>r.isElement(e)&&"tabs-container"===e.type})},className:"w-full"},{children:l}))}},"tabs-list":{render:n=>{const{attributes:i,children:r,blockId:o}=n,a=s();return t(m,Object.assign({className:"w-full"},{children:[t(l,Object.assign({},i,{className:"w-full mt-2 relative justify-start"},{children:[r,!a.readOnly&&e("button",Object.assign({type:"button",contentEditable:!1,onClick:e=>{e.preventDefault(),e.stopPropagation(),d.addTabItem(a,o)},className:"ml-1 flex items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 p-1.5",title:"Add tab"},{children:e(b,{className:"h-4 w-4 shrink-0 text-muted-foreground"})}))]})),e(p,{orientation:"horizontal"})]}))}},"tabs-item-heading":{render:n=>{const{attributes:i,children:r,element:o,blockId:a}=n,l=s();return t(c,Object.assign({},i,{value:o.id,className:"relative group/tab flex items-center gap-2 pr-8 whitespace-nowrap"},{children:[e("div",Object.assign({className:"flex-1 min-w-0"},{children:r})),!l.readOnly&&e("span",Object.assign({contentEditable:!1,onClick:()=>{l.readOnly||d.deleteTabItem(l,a,{tabId:o.id})},className:"absolute right-1 flex items-center justify-center rounded-sm opacity-0 group-hover/tab:opacity-100 transition-opacity hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 p-1",title:"Close tab"},{children:e(u,{className:"h-3 w-3 shrink-0 text-muted-foreground"})}))]}))}},"tabs-item-content":{render:t=>{var s;const{attributes:n,children:i,element:r}=t;return e(a,Object.assign({},n,{value:null===(s=r.props)||void 0===s?void 0:s.referenceId,className:"mt-2"},{children:i}))}}};export{h as TabsUI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-inline-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/video/elements/video/video-inline-toolbar.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"video-inline-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/video/elements/video/video-inline-toolbar.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,KAAK,uBAAuB,GAAG;IAC7B,YAAY,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzD,YAAY,EAAE,iBAAiB,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACtD,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,kBAAkB,uFAQ5B,uBAAuB,mDA0MzB,CAAC"}
|
package/dist/video.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{_ as e,a as i}from"./chunks/_tslib-35bb891d.js";import{jsxs as t,jsx as s,Fragment as n}from"react/jsx-runtime";import*as a from"react";import{useRef as r,useState as l,useLayoutEffect as o,useEffect as c,useCallback as d}from"react";import{
|
|
1
|
+
import{_ as e,a as i}from"./chunks/_tslib-35bb891d.js";import{jsxs as t,jsx as s,Fragment as n}from"react/jsx-runtime";import*as a from"react";import{useRef as r,useState as l,useLayoutEffect as o,useEffect as c,useCallback as d}from"react";import{useYooptaEditor as h,useElementSelected as m,useBlockSelected as u,useYooptaPluginOptions as p,Elements as g,Blocks as b}from"@yoopta/editor";import{parseVideoUrl as v,getEmbedUrl as f,useVideoUpload as j,useVideoDelete as x,useVideoPreview as w,buildVideoProvider as y}from"@yoopta/video";import{Editor as N,Element as O}from"slate";import{B as k}from"./chunks/button-f335deaa.js";import{I as C}from"./chunks/input-b2431223.js";import{T as z,c as I,b as E,a as R}from"./chunks/tabs-370c3f2c.js";import{c as U}from"./chunks/utils-3345eade.js";import{L as P,U as S,D}from"./chunks/upload-b1dd210d.js";import{L,A as H,a as F,b as W,R as _}from"./chunks/index-87b75648.js";import{c as V}from"./chunks/createLucideIcon-8605f860.js";import{P as A}from"./chunks/play-998f23d2.js";import{T as B,a as q,b as M,c as T,u as $,F as Y,R as K}from"./chunks/tooltip-5defff1d.js";import{C as G,c as J}from"./chunks/index-0bca29df.js";import{L as X}from"./chunks/label-35a74462.js";import{P as Z,a as Q,b as ee}from"./chunks/popover-dae0ce5f.js";import{u as ie,S as te,a as se,b as ne,c as ae,e as re,d as le}from"./chunks/select-a3724728.js";import{S as oe}from"./chunks/separator-f4e74aca.js";import{c as ce,P as de,a as he}from"./chunks/index-17323747.js";import{u as me}from"./chunks/index-91a5b8d5.js";import{u as ue}from"./chunks/index-ff0e3962.js";import{e as pe,o as ge,f as be,s as ve,b as fe}from"./chunks/index-371259c9.js";import{S as je}from"./chunks/settings-2-84fe63d9.js";import{E as xe}from"./chunks/external-link-1579dd7f.js";import{T as we}from"./chunks/trash-2-f36597ff.js";import"./chunks/index-a77c7d53.js";import"./chunks/index-5b487f4e.js";import"./chunks/index-ce60ba41.js";import"./chunks/index-70f4e709.js";import"./chunks/index-13505606.js";import"./chunks/index-bd6363d4.js";import"react-dom";import"./chunks/index-1674c2c8.js";import"./chunks/index-a5cba5f7.js";import"./chunks/Combination-575d4475.js";import"./chunks/index-056e5c06.js";import"./chunks/chevron-down-28dfb290.js";import"./chunks/check-06bd6a78.js";import"./chunks/chevron-up-9a13532e.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.294.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const ye=V("Video",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]]),Ne=({preview:e})=>s("div",Object.assign({className:"absolute inset-0 overflow-hidden flex items-center justify-center bg-black/5"},{children:s("video",{src:e.url,className:"max-w-full max-h-full object-contain",style:{maxWidth:e.width||"100%",maxHeight:e.height||"100%"},controls:!1,muted:!0,draggable:!1})})),Oe=({progress:e})=>s("div",Object.assign({className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-4 bg-black/70 backdrop-blur-sm p-6"},{children:s("div",Object.assign({className:"w-full max-w-md space-y-4"},{children:t("div",Object.assign({className:"space-y-2"},{children:[t("div",Object.assign({className:"flex items-center justify-between text-sm"},{children:[s("span",Object.assign({className:"font-medium text-white"},{children:"Uploading video..."})),t("span",Object.assign({className:"text-white/80"},{children:[e.percentage,"%"]}))]})),s("div",Object.assign({className:"h-2 w-full overflow-hidden rounded-full bg-white/20"},{children:s("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${e.percentage}%`}})})),t("div",Object.assign({className:"flex items-center justify-between text-xs text-white/60"},{children:[t("span",{children:[(e.loaded/1024/1024).toFixed(2)," MB /"," ",(e.total/1024/1024).toFixed(2)," MB"]}),s(S,{className:"h-3.5 w-3.5 animate-spin"})]}))]}))}))})),ke=({onUpload:e,hasPreview:i})=>{const n=r(null);return t("div",i?Object.assign({className:"flex flex-col items-center justify-center gap-4 py-8"},{children:[t("div",Object.assign({className:"text-center space-y-2"},{children:[s("p",Object.assign({className:"text-sm font-medium text-white"},{children:"Video preview"})),s("p",Object.assign({className:"text-xs text-white/80"},{children:"Uploading your video..."}))]})),s("input",{ref:n,type:"file",accept:"video/*",onChange:e,className:"hidden"})]}):Object.assign({className:"flex flex-col items-center gap-3 py-6"},{children:[s("div",Object.assign({className:"rounded-lg bg-muted p-3"},{children:s(ye,{className:"h-6 w-6 text-muted-foreground"})})),t("div",Object.assign({className:"text-center"},{children:[s("p",Object.assign({className:"text-sm font-medium"},{children:"Upload a video"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Click or drag and drop"}))]})),s(k,Object.assign({onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.click()}},{children:"Choose file"})),s("input",{ref:n,type:"file",accept:"video/*",onChange:e,className:"hidden"})]}))},Ce=({onInsertUrl:e})=>{const[i,n]=l(""),[a,r]=l(!1),[o,c]=l(null),d=()=>{i.trim()&&(e(i.trim()),n(""),r(!1),c(null))};return t("div",Object.assign({className:"mt-4 space-y-3"},{children:[t("div",Object.assign({className:"space-y-2"},{children:[s(C,{placeholder:"Paste video URL (YouTube, Vimeo, Dailymotion, Loom, Wistia)...",value:i,onChange:e=>(e=>{if(n(e),e.trim()){const i=v(e.trim());r(i.isValid),c(i.provider?i.provider.charAt(0).toUpperCase()+i.provider.slice(1):null)}else r(!1),c(null)})(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i.trim()&&a&&d()}}),i.trim()&&s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:a?t("span",Object.assign({className:"flex items-center gap-1.5 text-green-600 dark:text-green-400"},{children:[s(A,{className:"h-3 w-3"}),o," video detected"]})):s("span",Object.assign({className:"text-destructive"},{children:"Invalid video URL. Supported: YouTube, Vimeo, Dailymotion, Loom, Wistia"}))}))]})),s(k,Object.assign({className:"w-full",onClick:d,disabled:!i.trim()||!a},{children:a?`Embed ${o} video`:"Embed video"}))]}))},Ie=({onUpload:e,onInsertUrl:i,hasPreview:n})=>s("div",Object.assign({className:P("relative p-4",n&&"min-h-[300px] flex flex-col")},{children:t(I,Object.assign({defaultValue:"upload",className:"w-full"},{children:[t(z,Object.assign({className:P("grid w-full grid-cols-2",n&&"bg-background/80 backdrop-blur-sm")},{children:[t(R,Object.assign({value:"upload",className:"gap-1.5"},{children:[s(E,{className:"h-3.5 w-3.5"}),"Upload"]})),t(R,Object.assign({value:"link",className:"gap-1.5"},{children:[s(L,{className:"h-3.5 w-3.5"}),"Link"]}))]})),s(U,Object.assign({value:"upload",className:"mt-4"},{children:s(ke,{onUpload:e,hasPreview:n})})),s(U,Object.assign({value:"link"},{children:s(Ce,{onInsertUrl:i})}))]}))})),ze=({onUpload:e,onInsertUrl:i,className:n,attributes:a,children:r,preview:l,progress:o,loading:c})=>{const d=null!==l&&!!l.url,h=c&&o;return t("div",Object.assign({className:P("mt-2 relative rounded-lg border bg-background overflow-hidden",d&&"min-h-[300px]",n)},a,{contentEditable:!1},{children:[d&&s(Ne,{preview:l}),!d&&s(Ie,{onUpload:e,onInsertUrl:i,hasPreview:d}),h&&o&&s(Oe,{progress:o}),r]}))};var Re="Switch",[Ue,Pe]=ce(Re),[Se,Ee]=Ue(Re),De=a.forwardRef((e,i)=>{const{__scopeSwitch:n,name:r,checked:l,defaultChecked:o,required:c,disabled:d,value:h="on",onCheckedChange:m,form:u,...p}=e,[g,b]=a.useState(null),v=me(i,e=>b(e)),f=a.useRef(!1),j=!g||(u||!!g.closest("form")),[x,w]=ue({prop:l,defaultProp:o??!1,onChange:m,caller:Re});return t(Se,{scope:n,checked:x,disabled:d,children:[s(de.button,{type:"button",role:"switch","aria-checked":x,"aria-required":c,"data-state":We(x),"data-disabled":d?"":void 0,disabled:d,value:h,...p,ref:v,onClick:he(e.onClick,e=>{w(e=>!e),j&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})}),j&&s(Fe,{control:g,bubbles:!f.current,name:r,value:h,checked:x,required:c,disabled:d,form:u,style:{transform:"translateX(-100%)"}})]})});De.displayName=Re;var Le="SwitchThumb",He=a.forwardRef((e,i)=>{const{__scopeSwitch:t,...n}=e,a=Ee(Le,t);return s(de.span,{"data-state":We(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:i})});He.displayName=Le;var Fe=a.forwardRef(({__scopeSwitch:e,control:i,checked:t,bubbles:n=!0,...r},l)=>{const o=a.useRef(null),c=me(o,l),d=ie(t),h=pe(i);return a.useEffect(()=>{const e=o.current;if(!e)return;const i=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(i,"checked").set;if(d!==t&&s){const i=new Event("click",{bubbles:n});s.call(e,t),e.dispatchEvent(i)}},[d,t,n]),s("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:c,style:{...r.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function We(e){return e?"checked":"unchecked"}Fe.displayName="SwitchBubbleInput";var _e=De,Ve=He;const Ae=a.forwardRef((i,t)=>{var{className:n}=i,a=e(i,["className"]);return s(_e,Object.assign({className:P("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n)},a,{ref:t},{children:s(Ve,{className:P("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}))});Ae.displayName=_e.displayName;const Be={contain:{label:"Contain",description:"Fit within bounds"},cover:{label:"Cover",description:"Fill and crop"},fill:{label:"Fill",description:"Stretch to fit"}},qe=({fit:e,settings:i,onUpdate:n})=>{var a,r,o,c,d,h,m,u,p,g,b,v;const[f,j]=l(!1),x=e=>{n({settings:Object.assign(Object.assign({},i),e)})};return t(Z,Object.assign({open:f,onOpenChange:j},{children:[s(B,{children:t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(Q,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:f?"secondary":"ghost",size:"icon",className:"h-7 w-7"},{children:s(je,{className:"h-4 w-4"})}))}))})),s(T,{children:"Settings"})]})}),s(ee,Object.assign({className:"w-80 p-3",align:"start",contentEditable:!1,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()},{children:t("div",Object.assign({className:"space-y-3"},{children:[t("div",{children:[s("h4",Object.assign({className:"font-semibold"},{children:"Video settings"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Customize video playback and display"}))]}),s(oe,{}),t("div",Object.assign({className:"space-y-1"},{children:[s(X,Object.assign({htmlFor:"object-fit",className:"text-sm font-medium"},{children:"How video fits"})),t(te,Object.assign({value:e||"contain",onValueChange:e=>n({fit:e})},{children:[s(se,Object.assign({id:"object-fit",className:"h-9 w-full"},{children:s(ne,Object.assign({placeholder:"Select how video fits"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(a=Be[e||"contain"])||void 0===a?void 0:a.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(r=Be[e||"contain"])||void 0===r?void 0:r.description}))]}))}))})),s(ae,{children:t(re,{children:[s(le,Object.assign({value:"contain",className:"cursor-pointer"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-4 w-3 rounded bg-primary"})})),t("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(o=Be.contain)||void 0===o?void 0:o.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(c=Be.contain)||void 0===c?void 0:c.description}))]}))]}))})),s(le,Object.assign({value:"cover",className:"cursor-pointer"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-8 w-6 rounded bg-primary"})})),t("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(d=Be.cover)||void 0===d?void 0:d.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(h=Be.cover)||void 0===h?void 0:h.description}))]}))]}))})),s(le,Object.assign({value:"fill",className:"cursor-pointer"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-8 w-8 rounded bg-primary"})})),t("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(m=Be.fill)||void 0===m?void 0:m.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(u=Be.fill)||void 0===u?void 0:u.description}))]}))]}))}))]})})]}))]})),s(oe,{}),t("div",Object.assign({className:"space-y-3"},{children:[t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"controls",className:"text-sm font-medium"},{children:"Show controls"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Display video player controls"}))]})),s(Ae,{id:"controls",checked:null!==(p=i.controls)&&void 0!==p&&p,onCheckedChange:e=>x({controls:e})})]})),t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"loop",className:"text-sm font-medium"},{children:"Loop video"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Automatically replay when finished"}))]})),s(Ae,{id:"loop",checked:null!==(g=i.loop)&&void 0!==g&&g,onCheckedChange:e=>x({loop:e})})]})),t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"muted",className:"text-sm font-medium"},{children:"Muted"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Start video without sound"}))]})),s(Ae,{id:"muted",checked:null!==(b=i.muted)&&void 0!==b&&b,onCheckedChange:e=>x({muted:e})})]})),t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"autoplay",className:"text-sm font-medium"},{children:"Autoplay"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Start playing automatically (may require muted)"}))]})),s(Ae,{id:"autoplay",checked:null!==(v=i.autoPlay)&&void 0!==v&&v,onCheckedChange:e=>x({autoPlay:e})})]}))]}))]}))}))]}))},Me=({referenceRef:e,elementProps:i,onUpdate:a,onReplace:r,onDelete:c,onDownload:d,onCopy:h})=>{var m,u;const[p,g]=l(!1),[b,v]=l(!1),f=i.provider&&i.provider.type,j="alignment"in i,{refs:x,floatingStyles:w}=$({placement:"top-end",strategy:"absolute",middleware:[ge(8),be({fallbackPlacements:["bottom-end","top-start","bottom-start"],padding:10}),ve({padding:10})],whileElementsMounted:fe});o(()=>{const i=e.current;i&&(x.setReference(i),v(!0))},[e,x]),o(()=>{if(b){const e=requestAnimationFrame(()=>{g(!0)});return()=>cancelAnimationFrame(e)}},[b]);return b?s(Y,{children:s("div",Object.assign({ref:x.setFloating,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>e.stopPropagation(),className:P("pointer-events-auto","flex items-center gap-1 rounded-lg border bg-background/95 backdrop-blur-sm p-1 shadow-lg","transition-opacity duration-200 ease-out",p?"opacity-100 translate-y-0":"opacity-0 translate-y-2"),style:w},{children:t(B,Object.assign({delayDuration:0},{children:[j&&t("div",Object.assign({className:"flex items-center gap-0.5 border-r pr-1"},{children:[t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"left"===i.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"left"})},{children:s(H,{className:"h-4 w-4"})}))})),s(T,{children:"Align left"})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"center"===i.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"center"})},{children:s(F,{className:"h-4 w-4"})}))})),s(T,{children:"Align center"})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"right"===i.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"right"})},{children:s(W,{className:"h-4 w-4"})}))})),s(T,{children:"Align right"})]})]})),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:r},{children:s(K,{className:"h-4 w-4"})}))})),s(T,{children:"Replace"})]}),!f&&i.src&&t(n,{children:[t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{if(d)d();else if(i.src&&!f){const e=document.createElement("a");e.href=i.src,e.download=`video-${Date.now()}.mp4`,e.click()}}},{children:s(D,{className:"h-4 w-4"})}))})),s(T,{children:"Download"})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{h?h():i.src&&J(i.src)}},{children:s(G,{className:"h-4 w-4"})}))})),s(T,{children:"Copy URL"})]})]}),f&&(null===(m=i.provider)||void 0===m?void 0:m.url)&&t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{var e;(null===(e=i.provider)||void 0===e?void 0:e.url)&&window.open(i.provider.url,"_blank")}},{children:s(xe,{className:"h-4 w-4"})}))})),s(T,{children:"Open in new tab"})]}),!f&&t(n,{children:[s(oe,{orientation:"vertical",className:"h-4"}),s(qe,{fit:null!==(u=i.fit)&&void 0!==u?u:"contain",settings:i.settings||{controls:!1,loop:!1,muted:!1,autoPlay:!1},onUpdate:a})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:c},{children:s(we,{className:"h-4 w-4"})}))})),s(T,{children:"Delete"})]})]}))}))}):null},Te=({blockId:e,attributes:n,children:a,elementProps:o,onUpdate:d,onDelete:p,onReplace:g,pluginOptions:b})=>{var v,j,x,w,y;const[N,O]=l(o.sizes),{isElementSelected:k}=h(),C=m({blockId:e}),I=k&&C,z=r(null),R=u(),[U,S]=l(()=>{var e;const i=(null===(e=R.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||0,t=null==b?void 0:b.maxSizes;return{maxWidth:(null==t?void 0:t.maxWidth)?"number"==typeof t.maxWidth?t.maxWidth:parseInt(String(t.maxWidth).replace(/[^\d]/g,""),10):i,maxHeight:(null==t?void 0:t.maxHeight)?"number"==typeof t.maxHeight?t.maxHeight:parseInt(String(t.maxHeight).replace(/[^\d]/g,""),10):0}});c(()=>{const e=()=>{var e;const i=(null===(e=R.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||0,t=null==b?void 0:b.maxSizes;S({maxWidth:(null==t?void 0:t.maxWidth)?"number"==typeof t.maxWidth?t.maxWidth:parseInt(String(t.maxWidth).replace(/[^\d]/g,""),10):i,maxHeight:(null==t?void 0:t.maxHeight)?"number"==typeof t.maxHeight?t.maxHeight:parseInt(String(t.maxHeight).replace(/[^\d]/g,""),10):0})};e();const i=new ResizeObserver(e);return R.refElement&&i.observe(R.refElement),window.addEventListener("resize",e),()=>{i.disconnect(),window.removeEventListener("resize",e)}},[R,b]);const E=o.provider&&o.provider.type,D=o.src||"",L=E&&(null===(v=o.provider)||void 0===v?void 0:v.id)?f(o.provider.type,o.provider.id):null,H=null!==(j=o.settings)&&void 0!==j?j:{controls:!0,loop:!1,muted:!1,autoPlay:!1},F={left:"justify-start",center:"justify-center",right:"justify-end"}[null!==(x=o.alignment)&&void 0!==x?x:"center"];return t("div",Object.assign({},n,{className:P("group/video mt-4 relative transition-all w-full flex",F)},{children:[t("div",Object.assign({className:"relative",contentEditable:!1,ref:z},{children:[s(_,Object.assign({style:{position:"relative",outline:I?".125rem solid rgba(0, 0, 0, 0)":"none",outlineColor:I?"hsl(var(--primary))":"none",padding:2},onResize:(e,i,t)=>{const s=parseInt(t.style.width,10),n=parseInt(t.style.height,10);O({width:s,height:n})},onResizeStop:(e,i,t)=>{const s=parseInt(t.style.width,10),n=parseInt(t.style.height,10);d({sizes:{width:s,height:n}})},lockAspectRatio:!0,minWidth:200,minHeight:150,maxWidth:U.maxWidth-8||void 0,maxHeight:U.maxHeight||void 0,position:{x:0,y:0},enableResizing:!!I&&{bottom:!1,bottomLeft:!1,bottomRight:!1,left:!0,right:!0,top:!1,topLeft:!1,topRight:!1},disableDragging:!0,resizeHandleStyles:{left:{width:"auto",height:"40px",left:"5px",top:"50%",transform:"translateY(-50%)",cursor:"ew-resize"},right:{width:"auto",height:"40px",right:"5px",top:"50%",transform:"translateY(-50%)",cursor:"ew-resize"}},resizeHandleComponent:{left:s("div",{className:"h-10 w-1.5 rounded-full bg-white border border-border shadow-[0_0_4px_rgba(0,0,0,0.3)]"}),right:s("div",{className:"h-10 w-1.5 rounded-full bg-white border border-border shadow-[0_0_4px_rgba(0,0,0,0.3)]"})},className:P("rounded-sm overflow-hidden")},{children:E&&L?s("iframe",{title:o.provider.type,src:L,width:"100%",height:"100%",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"w-full h-full",style:{aspectRatio:`${null==N?void 0:N.width} / ${null==N?void 0:N.height}`}}):s("video",{title:"Video",src:D,controls:H.controls,loop:H.loop,muted:H.muted,autoPlay:H.autoPlay,poster:null!==(w=o.poster)&&void 0!==w?w:void 0,className:"w-full h-full transition-all duration-200",style:{objectFit:null!==(y=o.fit)&&void 0!==y?y:"contain"},draggable:!1})})),I&&s(Me,{referenceRef:z,elementProps:o,onUpdate:d,onReplace:g,onDelete:p,onDownload:()=>i(void 0,void 0,void 0,function*(){if(o.src&&!E)try{const e=yield fetch(o.src),i=yield e.blob(),t=URL.createObjectURL(i),s=document.createElement("a");s.href=t,s.download=`video-${Date.now()}.mp4`,s.click(),URL.revokeObjectURL(t)}catch(e){}}),onCopy:()=>i(void 0,void 0,void 0,function*(){var e;if(o.src)try{if(E&&(null===(e=o.provider)||void 0===e?void 0:e.url)){const{default:e}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});e(o.provider.url)}else{const e=yield fetch(o.src),i=yield e.blob();if(navigator.clipboard&&ClipboardItem)yield navigator.clipboard.write([new ClipboardItem({[i.type]:i})]);else{const{default:e}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});e(o.src)}}}catch(e){const{default:i}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});i(o.src||"")}})})]})),a]}))},$e={video:{render:({element:e,attributes:t,children:n,blockId:a})=>{const r=u(),l=p("Video"),{upload:o,progress:c,loading:h}=j(l.upload),{deleteVideo:m}=x(l.delete),{preview:f,generatePreview:k,clearPreview:C}=w(),I=d(i=>{g.updateElement(r,{blockId:a,type:"video",props:Object.assign(Object.assign({},e.props),i)})},[r,a,e.props]),z=d(()=>i(void 0,void 0,void 0,function*(){yield m(e);const i=b.getBlockSlate(r,{id:a});if(!i)return;const t=g.getElementPath(r,{blockId:a,element:e});if(!t)return;const s=t?N.parent(i,t):void 0;s&&O.isElement(s[0])&&!N.isEditor(s[0])?g.deleteElement(r,{blockId:a,type:"video",path:t}):b.deleteBlock(r,{blockId:a,focus:!0})}),[r,a,e,m]),R=d(()=>{g.updateElement(r,{blockId:a,type:"video",props:Object.assign(Object.assign({},e.props),{src:null,provider:null})})},[r,a,e.props]),U=d(t=>i(void 0,void 0,void 0,function*(){var i;const s=null===(i=t.target.files)||void 0===i?void 0:i[0];if(!s)return;k(s);const n=yield o(s);I({id:n.id||n.fileId,src:n.url,sizes:n.width&&n.height?{width:n.width,height:n.height}:e.props.sizes||{width:650,height:400},provider:n.provider||null,poster:n.poster||null}),C()}),[o,I,k,C,e.props.sizes]),P=d(t=>i(void 0,void 0,void 0,function*(){const i=v(t);if(i.isValid&&i.provider){const s=y(t);I({src:i.embedUrl,provider:s,sizes:e.props.sizes||{width:650,height:400}})}else t.trim()&&I({src:t.trim(),provider:null,sizes:e.props.sizes||{width:650,height:400}})}),[I,e.props.sizes]);return e.props.src||e.props.provider?s(Te,Object.assign({blockId:a,elementId:e.id,onUpdate:I,onDelete:z,attributes:t,onReplace:R,elementProps:e.props,pluginOptions:l},{children:n})):r.readOnly?null:s(ze,Object.assign({onUpload:U,preview:f,progress:c,loading:h,onInsertUrl:P,attributes:t},{children:n}))}}};export{$e as VideoUI};
|
|
7
|
+
*/const ye=V("Video",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]]),Ne=({preview:e})=>s("div",Object.assign({className:"absolute inset-0 overflow-hidden flex items-center justify-center bg-black/5"},{children:s("video",{src:e.url,className:"max-w-full max-h-full object-contain",style:{maxWidth:e.width||"100%",maxHeight:e.height||"100%"},controls:!1,muted:!0,draggable:!1})})),Oe=({progress:e})=>s("div",Object.assign({className:"absolute inset-0 z-20 flex flex-col items-center justify-center gap-4 bg-black/70 backdrop-blur-sm p-6"},{children:s("div",Object.assign({className:"w-full max-w-md space-y-4"},{children:t("div",Object.assign({className:"space-y-2"},{children:[t("div",Object.assign({className:"flex items-center justify-between text-sm"},{children:[s("span",Object.assign({className:"font-medium text-white"},{children:"Uploading video..."})),t("span",Object.assign({className:"text-white/80"},{children:[e.percentage,"%"]}))]})),s("div",Object.assign({className:"h-2 w-full overflow-hidden rounded-full bg-white/20"},{children:s("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${e.percentage}%`}})})),t("div",Object.assign({className:"flex items-center justify-between text-xs text-white/60"},{children:[t("span",{children:[(e.loaded/1024/1024).toFixed(2)," MB /"," ",(e.total/1024/1024).toFixed(2)," MB"]}),s(P,{className:"h-3.5 w-3.5 animate-spin"})]}))]}))}))})),ke=({onUpload:e,hasPreview:i})=>{const n=r(null);return t("div",i?Object.assign({className:"flex flex-col items-center justify-center gap-4 py-8"},{children:[t("div",Object.assign({className:"text-center space-y-2"},{children:[s("p",Object.assign({className:"text-sm font-medium text-white"},{children:"Video preview"})),s("p",Object.assign({className:"text-xs text-white/80"},{children:"Uploading your video..."}))]})),s("input",{ref:n,type:"file",accept:"video/*",onChange:e,className:"hidden"})]}):Object.assign({className:"flex flex-col items-center gap-3 py-6"},{children:[s("div",Object.assign({className:"rounded-lg bg-muted p-3"},{children:s(ye,{className:"h-6 w-6 text-muted-foreground"})})),t("div",Object.assign({className:"text-center"},{children:[s("p",Object.assign({className:"text-sm font-medium"},{children:"Upload a video"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Click or drag and drop"}))]})),s(k,Object.assign({onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.click()}},{children:"Choose file"})),s("input",{ref:n,type:"file",accept:"video/*",onChange:e,className:"hidden"})]}))},Ce=({onInsertUrl:e})=>{const[i,n]=l(""),[a,r]=l(!1),[o,c]=l(null),d=()=>{i.trim()&&(e(i.trim()),n(""),r(!1),c(null))};return t("div",Object.assign({className:"mt-4 space-y-3"},{children:[t("div",Object.assign({className:"space-y-2"},{children:[s(C,{placeholder:"Paste video URL (YouTube, Vimeo, Dailymotion, Loom, Wistia)...",value:i,onChange:e=>(e=>{if(n(e),e.trim()){const i=v(e.trim());r(i.isValid),c(i.provider?i.provider.charAt(0).toUpperCase()+i.provider.slice(1):null)}else r(!1),c(null)})(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i.trim()&&a&&d()}}),i.trim()&&s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:a?t("span",Object.assign({className:"flex items-center gap-1.5 text-green-600 dark:text-green-400"},{children:[s(A,{className:"h-3 w-3"}),o," video detected"]})):s("span",Object.assign({className:"text-destructive"},{children:"Invalid video URL. Supported: YouTube, Vimeo, Dailymotion, Loom, Wistia"}))}))]})),s(k,Object.assign({className:"w-full",onClick:d,disabled:!i.trim()||!a},{children:a?`Embed ${o} video`:"Embed video"}))]}))},ze=({onUpload:e,onInsertUrl:i,hasPreview:n})=>s("div",Object.assign({className:U("relative p-4",n&&"min-h-[300px] flex flex-col")},{children:t(z,Object.assign({defaultValue:"upload",className:"w-full"},{children:[t(I,Object.assign({className:U("grid w-full grid-cols-2",n&&"bg-background/80 backdrop-blur-sm")},{children:[t(E,Object.assign({value:"upload",className:"gap-1.5"},{children:[s(S,{className:"h-3.5 w-3.5"}),"Upload"]})),t(E,Object.assign({value:"link",className:"gap-1.5"},{children:[s(L,{className:"h-3.5 w-3.5"}),"Link"]}))]})),s(R,Object.assign({value:"upload",className:"mt-4"},{children:s(ke,{onUpload:e,hasPreview:n})})),s(R,Object.assign({value:"link"},{children:s(Ce,{onInsertUrl:i})}))]}))})),Ie=({onUpload:e,onInsertUrl:i,className:n,attributes:a,children:r,preview:l,progress:o,loading:c})=>{const d=null!==l&&!!l.url,h=c&&o;return t("div",Object.assign({className:U("mt-2 relative rounded-lg border bg-background overflow-hidden",d&&"min-h-[300px]",n)},a,{contentEditable:!1},{children:[d&&s(Ne,{preview:l}),!d&&s(ze,{onUpload:e,onInsertUrl:i,hasPreview:d}),h&&o&&s(Oe,{progress:o}),r]}))};var Ee="Switch",[Re,Ue]=ce(Ee),[Pe,Se]=Re(Ee),De=a.forwardRef((e,i)=>{const{__scopeSwitch:n,name:r,checked:l,defaultChecked:o,required:c,disabled:d,value:h="on",onCheckedChange:m,form:u,...p}=e,[g,b]=a.useState(null),v=me(i,e=>b(e)),f=a.useRef(!1),j=!g||(u||!!g.closest("form")),[x,w]=ue({prop:l,defaultProp:o??!1,onChange:m,caller:Ee});return t(Pe,{scope:n,checked:x,disabled:d,children:[s(de.button,{type:"button",role:"switch","aria-checked":x,"aria-required":c,"data-state":We(x),"data-disabled":d?"":void 0,disabled:d,value:h,...p,ref:v,onClick:he(e.onClick,e=>{w(e=>!e),j&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})}),j&&s(Fe,{control:g,bubbles:!f.current,name:r,value:h,checked:x,required:c,disabled:d,form:u,style:{transform:"translateX(-100%)"}})]})});De.displayName=Ee;var Le="SwitchThumb",He=a.forwardRef((e,i)=>{const{__scopeSwitch:t,...n}=e,a=Se(Le,t);return s(de.span,{"data-state":We(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:i})});He.displayName=Le;var Fe=a.forwardRef(({__scopeSwitch:e,control:i,checked:t,bubbles:n=!0,...r},l)=>{const o=a.useRef(null),c=me(o,l),d=ie(t),h=pe(i);return a.useEffect(()=>{const e=o.current;if(!e)return;const i=window.HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(i,"checked").set;if(d!==t&&s){const i=new Event("click",{bubbles:n});s.call(e,t),e.dispatchEvent(i)}},[d,t,n]),s("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:c,style:{...r.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function We(e){return e?"checked":"unchecked"}Fe.displayName="SwitchBubbleInput";var _e=De,Ve=He;const Ae=a.forwardRef((i,t)=>{var{className:n}=i,a=e(i,["className"]);return s(_e,Object.assign({className:U("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n)},a,{ref:t},{children:s(Ve,{className:U("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}))});Ae.displayName=_e.displayName;const Be={contain:{label:"Contain",description:"Fit within bounds"},cover:{label:"Cover",description:"Fill and crop"},fill:{label:"Fill",description:"Stretch to fit"}},qe=({fit:e,settings:i,onUpdate:n})=>{var a,r,o,c,d,h,m,u,p,g,b,v;const[f,j]=l(!1),x=e=>{n({settings:Object.assign(Object.assign({},i),e)})};return t(Z,Object.assign({open:f,onOpenChange:j},{children:[s(B,{children:t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(Q,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:f?"secondary":"ghost",size:"icon",className:"h-7 w-7"},{children:s(je,{className:"h-4 w-4"})}))}))})),s(T,{children:"Settings"})]})}),s(ee,Object.assign({className:"w-80 p-3",align:"start",contentEditable:!1,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()},{children:t("div",Object.assign({className:"space-y-3"},{children:[t("div",{children:[s("h4",Object.assign({className:"font-semibold"},{children:"Video settings"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Customize video playback and display"}))]}),s(oe,{}),t("div",Object.assign({className:"space-y-1"},{children:[s(X,Object.assign({htmlFor:"object-fit",className:"text-sm font-medium"},{children:"How video fits"})),t(te,Object.assign({value:e||"contain",onValueChange:e=>n({fit:e})},{children:[s(se,Object.assign({id:"object-fit",className:"h-9 w-full"},{children:s(ne,Object.assign({placeholder:"Select how video fits"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(a=Be[e||"contain"])||void 0===a?void 0:a.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(r=Be[e||"contain"])||void 0===r?void 0:r.description}))]}))}))})),s(ae,{children:t(re,{children:[s(le,Object.assign({value:"contain",className:"cursor-pointer"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-4 w-3 rounded bg-primary"})})),t("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(o=Be.contain)||void 0===o?void 0:o.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(c=Be.contain)||void 0===c?void 0:c.description}))]}))]}))})),s(le,Object.assign({value:"cover",className:"cursor-pointer"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-8 w-6 rounded bg-primary"})})),t("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(d=Be.cover)||void 0===d?void 0:d.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(h=Be.cover)||void 0===h?void 0:h.description}))]}))]}))})),s(le,Object.assign({value:"fill",className:"cursor-pointer"},{children:t("div",Object.assign({className:"flex items-center gap-2"},{children:[s("div",Object.assign({className:"flex h-8 w-8 shrink-0 items-center justify-center rounded border"},{children:s("div",{className:"h-8 w-8 rounded bg-primary"})})),t("div",Object.assign({className:"flex-1"},{children:[s("div",Object.assign({className:"font-medium"},{children:null===(m=Be.fill)||void 0===m?void 0:m.label})),s("div",Object.assign({className:"text-xs text-muted-foreground"},{children:null===(u=Be.fill)||void 0===u?void 0:u.description}))]}))]}))}))]})})]}))]})),s(oe,{}),t("div",Object.assign({className:"space-y-3"},{children:[t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"controls",className:"text-sm font-medium"},{children:"Show controls"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Display video player controls"}))]})),s(Ae,{id:"controls",checked:null!==(p=i.controls)&&void 0!==p&&p,onCheckedChange:e=>x({controls:e})})]})),t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"loop",className:"text-sm font-medium"},{children:"Loop video"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Automatically replay when finished"}))]})),s(Ae,{id:"loop",checked:null!==(g=i.loop)&&void 0!==g&&g,onCheckedChange:e=>x({loop:e})})]})),t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"muted",className:"text-sm font-medium"},{children:"Muted"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Start video without sound"}))]})),s(Ae,{id:"muted",checked:null!==(b=i.muted)&&void 0!==b&&b,onCheckedChange:e=>x({muted:e})})]})),t("div",Object.assign({className:"flex items-center justify-between"},{children:[t("div",Object.assign({className:"space-y-0.5"},{children:[s(X,Object.assign({htmlFor:"autoplay",className:"text-sm font-medium"},{children:"Autoplay"})),s("p",Object.assign({className:"text-xs text-muted-foreground"},{children:"Start playing automatically (may require muted)"}))]})),s(Ae,{id:"autoplay",checked:null!==(v=i.autoPlay)&&void 0!==v&&v,onCheckedChange:e=>x({autoPlay:e})})]}))]}))]}))}))]}))},Me=({referenceRef:e,elementProps:i,onUpdate:a,onReplace:r,onDelete:c,onDownload:d,onCopy:m})=>{var u,p;const[g,b]=l(!1),[v,f]=l(!1),j=i.provider&&i.provider.type,x="alignment"in i,w=h(),{refs:y,floatingStyles:N}=$({placement:"top-end",strategy:"absolute",middleware:[ge(8),be({fallbackPlacements:["bottom-end","top-start","bottom-start"],padding:10}),ve({padding:10})],whileElementsMounted:fe});o(()=>{const i=e.current;i&&(y.setReference(i),f(!0))},[e,y]),o(()=>{if(v){const e=requestAnimationFrame(()=>{b(!0)});return()=>cancelAnimationFrame(e)}},[v]);return v?s(Y,Object.assign({id:"video-inline-toolbar",root:w.refElement},{children:s("div",Object.assign({ref:y.setFloating,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>e.stopPropagation(),className:U("pointer-events-auto","flex items-center gap-1 rounded-lg border bg-background/95 backdrop-blur-sm p-1 shadow-lg","transition-opacity duration-200 ease-out",g?"opacity-100 translate-y-0":"opacity-0 translate-y-2"),style:N},{children:t(B,Object.assign({delayDuration:0},{children:[x&&t("div",Object.assign({className:"flex items-center gap-0.5 border-r pr-1"},{children:[t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"left"===i.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"left"})},{children:s(H,{className:"h-4 w-4"})}))})),s(T,{children:"Align left"})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"center"===i.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"center"})},{children:s(F,{className:"h-4 w-4"})}))})),s(T,{children:"Align center"})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"right"===i.alignment?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:()=>a({alignment:"right"})},{children:s(W,{className:"h-4 w-4"})}))})),s(T,{children:"Align right"})]})]})),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:r},{children:s(K,{className:"h-4 w-4"})}))})),s(T,{children:"Replace"})]}),!j&&i.src&&t(n,{children:[t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{if(d)d();else if(i.src&&!j){const e=document.createElement("a");e.href=i.src,e.download=`video-${Date.now()}.mp4`,e.click()}}},{children:s(D,{className:"h-4 w-4"})}))})),s(T,{children:"Download"})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{m?m():i.src&&J(i.src)}},{children:s(G,{className:"h-4 w-4"})}))})),s(T,{children:"Copy URL"})]})]}),j&&(null===(u=i.provider)||void 0===u?void 0:u.url)&&t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{var e;(null===(e=i.provider)||void 0===e?void 0:e.url)&&window.open(i.provider.url,"_blank")}},{children:s(xe,{className:"h-4 w-4"})}))})),s(T,{children:"Open in new tab"})]}),!j&&t(n,{children:[s(oe,{orientation:"vertical",className:"h-4"}),s(qe,{fit:null!==(p=i.fit)&&void 0!==p?p:"contain",settings:i.settings||{controls:!1,loop:!1,muted:!1,autoPlay:!1},onUpdate:a})]}),t(q,{children:[s(M,Object.assign({asChild:!0},{children:s(k,Object.assign({variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:c},{children:s(we,{className:"h-4 w-4"})}))})),s(T,{children:"Delete"})]})]}))}))})):null},Te=({blockId:e,attributes:n,children:a,elementProps:o,onUpdate:d,onDelete:p,onReplace:g,pluginOptions:b})=>{var v,j,x,w,y;const[N,O]=l(o.sizes),{isElementSelected:k}=m(),C=u({blockId:e}),z=k&&C,I=r(null),E=h(),[R,P]=l(()=>{var e;const i=(null===(e=E.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||0,t=null==b?void 0:b.maxSizes;return{maxWidth:(null==t?void 0:t.maxWidth)?"number"==typeof t.maxWidth?t.maxWidth:parseInt(String(t.maxWidth).replace(/[^\d]/g,""),10):i,maxHeight:(null==t?void 0:t.maxHeight)?"number"==typeof t.maxHeight?t.maxHeight:parseInt(String(t.maxHeight).replace(/[^\d]/g,""),10):0}});c(()=>{const e=()=>{var e;const i=(null===(e=E.refElement)||void 0===e?void 0:e.getBoundingClientRect().width)||0,t=null==b?void 0:b.maxSizes;P({maxWidth:(null==t?void 0:t.maxWidth)?"number"==typeof t.maxWidth?t.maxWidth:parseInt(String(t.maxWidth).replace(/[^\d]/g,""),10):i,maxHeight:(null==t?void 0:t.maxHeight)?"number"==typeof t.maxHeight?t.maxHeight:parseInt(String(t.maxHeight).replace(/[^\d]/g,""),10):0})};e();const i=new ResizeObserver(e);return E.refElement&&i.observe(E.refElement),window.addEventListener("resize",e),()=>{i.disconnect(),window.removeEventListener("resize",e)}},[E,b]);const S=o.provider&&o.provider.type,D=o.src||"",L=S&&(null===(v=o.provider)||void 0===v?void 0:v.id)?f(o.provider.type,o.provider.id):null,H=null!==(j=o.settings)&&void 0!==j?j:{controls:!0,loop:!1,muted:!1,autoPlay:!1},F={left:"justify-start",center:"justify-center",right:"justify-end"}[null!==(x=o.alignment)&&void 0!==x?x:"center"];return t("div",Object.assign({},n,{className:U("group/video mt-4 relative transition-all w-full flex",F)},{children:[t("div",Object.assign({className:"relative",contentEditable:!1,ref:I},{children:[s(_,Object.assign({style:{position:"relative",outline:z?".125rem solid rgba(0, 0, 0, 0)":"none",outlineColor:z?"hsl(var(--primary))":"none",padding:2},onResize:(e,i,t)=>{const s=parseInt(t.style.width,10),n=parseInt(t.style.height,10);O({width:s,height:n})},onResizeStop:(e,i,t)=>{const s=parseInt(t.style.width,10),n=parseInt(t.style.height,10);d({sizes:{width:s,height:n}})},lockAspectRatio:!0,minWidth:200,minHeight:150,maxWidth:R.maxWidth-8||void 0,maxHeight:R.maxHeight||void 0,position:{x:0,y:0},enableResizing:!!z&&{bottom:!1,bottomLeft:!1,bottomRight:!1,left:!0,right:!0,top:!1,topLeft:!1,topRight:!1},disableDragging:!0,resizeHandleStyles:{left:{width:"auto",height:"40px",left:"5px",top:"50%",transform:"translateY(-50%)",cursor:"ew-resize"},right:{width:"auto",height:"40px",right:"5px",top:"50%",transform:"translateY(-50%)",cursor:"ew-resize"}},resizeHandleComponent:{left:s("div",{className:"h-10 w-1.5 rounded-full bg-white border border-border shadow-[0_0_4px_rgba(0,0,0,0.3)]"}),right:s("div",{className:"h-10 w-1.5 rounded-full bg-white border border-border shadow-[0_0_4px_rgba(0,0,0,0.3)]"})},className:U("rounded-sm overflow-hidden")},{children:S&&L?s("iframe",{title:o.provider.type,src:L,width:"100%",height:"100%",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,className:"w-full h-full",style:{aspectRatio:`${null==N?void 0:N.width} / ${null==N?void 0:N.height}`}}):s("video",{title:"Video",src:D,controls:H.controls,loop:H.loop,muted:H.muted,autoPlay:H.autoPlay,poster:null!==(w=o.poster)&&void 0!==w?w:void 0,className:"w-full h-full transition-all duration-200",style:{objectFit:null!==(y=o.fit)&&void 0!==y?y:"contain"},draggable:!1})})),z&&s(Me,{referenceRef:I,elementProps:o,onUpdate:d,onReplace:g,onDelete:p,onDownload:()=>i(void 0,void 0,void 0,function*(){if(o.src&&!S)try{const e=yield fetch(o.src),i=yield e.blob(),t=URL.createObjectURL(i),s=document.createElement("a");s.href=t,s.download=`video-${Date.now()}.mp4`,s.click(),URL.revokeObjectURL(t)}catch(e){}}),onCopy:()=>i(void 0,void 0,void 0,function*(){var e;if(o.src)try{if(S&&(null===(e=o.provider)||void 0===e?void 0:e.url)){const{default:e}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});e(o.provider.url)}else{const e=yield fetch(o.src),i=yield e.blob();if(navigator.clipboard&&ClipboardItem)yield navigator.clipboard.write([new ClipboardItem({[i.type]:i})]);else{const{default:e}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});e(o.src)}}}catch(e){const{default:i}=yield import("./chunks/index-0bca29df.js").then(function(e){return e.i});i(o.src||"")}})})]})),a]}))},$e={video:{render:({element:e,attributes:t,children:n,blockId:a})=>{const r=h(),l=p("Video"),{upload:o,progress:c,loading:m}=j(l.upload),{deleteVideo:u}=x(l.delete),{preview:f,generatePreview:k,clearPreview:C}=w(),z=d(i=>{g.updateElement(r,{blockId:a,type:"video",props:Object.assign(Object.assign({},e.props),i)})},[r,a,e.props]),I=d(()=>i(void 0,void 0,void 0,function*(){yield u(e);const i=b.getBlockSlate(r,{id:a});if(!i)return;const t=g.getElementPath(r,{blockId:a,element:e});if(!t)return;const s=t?N.parent(i,t):void 0;s&&O.isElement(s[0])&&!N.isEditor(s[0])?g.deleteElement(r,{blockId:a,type:"video",path:t}):b.deleteBlock(r,{blockId:a,focus:!0})}),[r,a,e,u]),E=d(()=>{g.updateElement(r,{blockId:a,type:"video",props:Object.assign(Object.assign({},e.props),{src:null,provider:null})})},[r,a,e.props]),R=d(t=>i(void 0,void 0,void 0,function*(){var i;const s=null===(i=t.target.files)||void 0===i?void 0:i[0];if(!s)return;k(s);const n=yield o(s);z({id:n.id||n.fileId,src:n.url,sizes:n.width&&n.height?{width:n.width,height:n.height}:e.props.sizes||{width:650,height:400},provider:n.provider||null,poster:n.poster||null}),C()}),[o,z,k,C,e.props.sizes]),U=d(t=>i(void 0,void 0,void 0,function*(){const i=v(t);if(i.isValid&&i.provider){const s=y(t);z({src:i.embedUrl,provider:s,sizes:e.props.sizes||{width:650,height:400}})}else t.trim()&&z({src:t.trim(),provider:null,sizes:e.props.sizes||{width:650,height:400}})}),[z,e.props.sizes]);return e.props.src||e.props.provider?s(Te,Object.assign({blockId:a,elementId:e.id,onUpdate:z,onDelete:I,attributes:t,onReplace:E,elementProps:e.props,pluginOptions:l},{children:n})):r.readOnly?null:s(Ie,Object.assign({onUpload:R,preview:f,progress:c,loading:m,onInsertUrl:U,attributes:t},{children:n}))}}};export{$e as VideoUI};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/themes-shadcn",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.4",
|
|
4
4
|
"description": "Shadcn UI theme for Yoopta Editor plugins",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
"lists": [
|
|
51
51
|
"./dist/types/lists/index.d.ts"
|
|
52
52
|
],
|
|
53
|
+
"math": [
|
|
54
|
+
"./dist/types/math/index.d.ts"
|
|
55
|
+
],
|
|
53
56
|
"mention": [
|
|
54
57
|
"./dist/types/mention/index.d.ts"
|
|
55
58
|
],
|
|
@@ -134,6 +137,10 @@
|
|
|
134
137
|
"types": "./dist/types/lists/index.d.ts",
|
|
135
138
|
"import": "./dist/lists.js"
|
|
136
139
|
},
|
|
140
|
+
"./math": {
|
|
141
|
+
"types": "./dist/types/math/index.d.ts",
|
|
142
|
+
"import": "./dist/math.js"
|
|
143
|
+
},
|
|
137
144
|
"./mention": {
|
|
138
145
|
"types": "./dist/types/mention/index.d.ts",
|
|
139
146
|
"import": "./dist/mention.js"
|
|
@@ -171,18 +178,18 @@
|
|
|
171
178
|
"dist/"
|
|
172
179
|
],
|
|
173
180
|
"peerDependencies": {
|
|
174
|
-
"@yoopta/code": "^6.0.
|
|
175
|
-
"@yoopta/editor": "^6.0.
|
|
176
|
-
"@yoopta/embed": "^6.0.
|
|
177
|
-
"@yoopta/file": "^6.0.
|
|
178
|
-
"@yoopta/image": "^6.0.
|
|
179
|
-
"@yoopta/lists": "^6.0.
|
|
180
|
-
"@yoopta/steps": "^6.0.
|
|
181
|
-
"@yoopta/table": "^6.0.
|
|
182
|
-
"@yoopta/table-of-contents": "^6.0.
|
|
183
|
-
"@yoopta/tabs": "^6.0.
|
|
184
|
-
"@yoopta/ui": "^6.0.
|
|
185
|
-
"@yoopta/video": "^6.0.
|
|
181
|
+
"@yoopta/code": "^6.0.4",
|
|
182
|
+
"@yoopta/editor": "^6.0.4",
|
|
183
|
+
"@yoopta/embed": "^6.0.4",
|
|
184
|
+
"@yoopta/file": "^6.0.4",
|
|
185
|
+
"@yoopta/image": "^6.0.4",
|
|
186
|
+
"@yoopta/lists": "^6.0.4",
|
|
187
|
+
"@yoopta/steps": "^6.0.4",
|
|
188
|
+
"@yoopta/table": "^6.0.4",
|
|
189
|
+
"@yoopta/table-of-contents": "^6.0.4",
|
|
190
|
+
"@yoopta/tabs": "^6.0.4",
|
|
191
|
+
"@yoopta/ui": "^6.0.4",
|
|
192
|
+
"@yoopta/video": "^6.0.4",
|
|
186
193
|
"react": ">=18.2.0",
|
|
187
194
|
"react-dom": ">=18.2.0",
|
|
188
195
|
"slate": "^0.120.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e}from"./_tslib-35bb891d.js";import{jsx as r}from"react/jsx-runtime";import*as t from"react";import{a,c as s}from"./utils-3345eade.js";const n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,o=a,i=(e,r)=>t=>{var a;if(null==(null==r?void 0:r.variants))return o(e,null==t?void 0:t.class,null==t?void 0:t.className);const{variants:s,defaultVariants:i}=r,l=Object.keys(s).map(e=>{const r=null==t?void 0:t[e],a=null==i?void 0:i[e];if(null===r)return null;const o=n(r)||n(a);return s[e][o]}),d=t&&Object.entries(t).reduce((e,r)=>{let[t,a]=r;return void 0===a||(e[t]=a),e},{}),u=null==r||null===(a=r.compoundVariants)||void 0===a?void 0:a.reduce((e,r)=>{let{class:t,className:a,...s}=r;return Object.entries(s).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...i,...d}[r]):{...i,...d}[r]===t})?[...e,t,a]:e},[]);return o(e,l,u,null==t?void 0:t.class,null==t?void 0:t.className)},l=i("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),d=t.forwardRef((t,a)=>{var{className:n,variant:o,size:i}=t,d=e(t,["className","variant","size"]);return r("button",Object.assign({className:s(l({variant:o,size:i,className:n})),ref:a},d))});d.displayName="Button";export{d as B,i as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import{useLayoutEffect as t}from"react";import{P as n,a as r,d as o,u as i,c as s}from"./index-17323747.js";import{u as a}from"./index-91a5b8d5.js";import{u as l}from"./index-70f4e709.js";import{jsx as c}from"react/jsx-runtime";import*as f from"react-dom";import u from"react-dom";var d,p="dismissableLayer.update",m="dismissableLayer.pointerDownOutside",h="dismissableLayer.focusOutside",g=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),y=e.forwardRef((t,o)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:s,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:y,onDismiss:x,...b}=t,E=e.useContext(g),[R,P]=e.useState(null),A=R?.ownerDocument??globalThis?.document,[,O]=e.useState({}),S=a(o,e=>P(e)),L=Array.from(E.layers),[C]=[...E.layersWithOutsidePointerEventsDisabled].slice(-1),D=L.indexOf(C),T=R?L.indexOf(R):-1,k=E.layersWithOutsidePointerEventsDisabled.size>0,W=T>=D,F=function(t,n=globalThis?.document){const r=l(t),o=e.useRef(!1),i=e.useRef(()=>{});return e.useEffect(()=>{const e=e=>{if(e.target&&!o.current){let t=function(){v(m,r,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",i.current),i.current=t,n.addEventListener("click",i.current,{once:!0})):t()}else n.removeEventListener("click",i.current);o.current=!1},t=window.setTimeout(()=>{n.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",i.current)}},[n,r]),{onPointerDownCapture:()=>o.current=!0}}(e=>{const t=e.target,n=[...E.branches].some(e=>e.contains(t));W&&!n&&(f?.(e),y?.(e),e.defaultPrevented||x?.())},A),H=function(t,n=globalThis?.document){const r=l(t),o=e.useRef(!1);return e.useEffect(()=>{const e=e=>{if(e.target&&!o.current){v(h,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)},[n,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}(e=>{const t=e.target;[...E.branches].some(e=>e.contains(t))||(u?.(e),y?.(e),e.defaultPrevented||x?.())},A);return function(t,n=globalThis?.document){const r=l(t);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&r(e)};return n.addEventListener("keydown",e,{capture:!0}),()=>n.removeEventListener("keydown",e,{capture:!0})},[r,n])}(e=>{T===E.layers.size-1&&(s?.(e),!e.defaultPrevented&&x&&(e.preventDefault(),x()))},A),e.useEffect(()=>{if(R)return i&&(0===E.layersWithOutsidePointerEventsDisabled.size&&(d=A.body.style.pointerEvents,A.body.style.pointerEvents="none"),E.layersWithOutsidePointerEventsDisabled.add(R)),E.layers.add(R),w(),()=>{i&&1===E.layersWithOutsidePointerEventsDisabled.size&&(A.body.style.pointerEvents=d)}},[R,A,i,E]),e.useEffect(()=>()=>{R&&(E.layers.delete(R),E.layersWithOutsidePointerEventsDisabled.delete(R),w())},[R,E]),e.useEffect(()=>{const e=()=>O({});return document.addEventListener(p,e),()=>document.removeEventListener(p,e)},[]),c(n.div,{...b,ref:S,style:{pointerEvents:k?W?"auto":"none":void 0,...t.style},onFocusCapture:r(t.onFocusCapture,H.onFocusCapture),onBlurCapture:r(t.onBlurCapture,H.onBlurCapture),onPointerDownCapture:r(t.onPointerDownCapture,F.onPointerDownCapture)})});y.displayName="DismissableLayer";function w(){const e=new CustomEvent(p);document.dispatchEvent(e)}function v(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?o(i,s):i.dispatchEvent(s)}e.forwardRef((t,r)=>{const o=e.useContext(g),i=e.useRef(null),s=a(r,i);return e.useEffect(()=>{const e=i.current;if(e)return o.branches.add(e),()=>{o.branches.delete(e)}},[o.branches]),c(n.div,{...t,ref:s})}).displayName="DismissableLayerBranch";const x=["top","right","bottom","left"],b=Math.min,E=Math.max,R=Math.round,P=Math.floor,A=e=>({x:e,y:e}),O={left:"right",right:"left",bottom:"top",top:"bottom"},S={start:"end",end:"start"};function L(e,t,n){return E(e,b(t,n))}function C(e,t){return"function"==typeof e?e(t):e}function D(e){return e.split("-")[0]}function T(e){return e.split("-")[1]}function k(e){return"x"===e?"y":"x"}function W(e){return"y"===e?"height":"width"}const F=new Set(["top","bottom"]);function H(e){return F.has(D(e))?"y":"x"}function B(e){return k(H(e))}function z(e){return e.replace(/start|end/g,e=>S[e])}const M=["left","right"],N=["right","left"],$=["top","bottom"],_=["bottom","top"];function j(e,t,n,r){const o=T(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?N:M:t?M:N;case"left":case"right":return t?$:_;default:return[]}}(D(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(z)))),i}function V(e){return e.replace(/left|right|bottom|top/g,e=>O[e])}function Y(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function I(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function X(e,t,n){let{reference:r,floating:o}=e;const i=H(t),s=B(t),a=W(s),l=D(t),c="y"===i,f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[a]/2-o[a]/2;let p;switch(l){case"top":p={x:f,y:r.y-o.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(T(t)){case"start":p[s]-=d*(n&&c?-1:1);break;case"end":p[s]+=d*(n&&c?-1:1)}return p}async function q(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=C(t,e),m=Y(p),h=a[d?"floating"===u?"reference":"floating":u],g=I(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:l})),y="floating"===u?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,w=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),v=await(null==i.isElement?void 0:i.isElement(w))&&await(null==i.getScale?void 0:i.getScale(w))||{x:1,y:1},x=I(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:l}):y);return{top:(g.top-x.top+m.top)/v.y,bottom:(x.bottom-g.bottom+m.bottom)/v.y,left:(g.left-x.left+m.left)/v.x,right:(x.right-g.right+m.right)/v.x}}function K(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function G(e){return x.some(t=>e[t]>=0)}const J=new Set(["left","top"]);function Q(){return"undefined"!=typeof window}function U(e){return te(e)?(e.nodeName||"").toLowerCase():"#document"}function Z(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function ee(e){var t;return null==(t=(te(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function te(e){return!!Q()&&(e instanceof Node||e instanceof Z(e).Node)}function ne(e){return!!Q()&&(e instanceof Element||e instanceof Z(e).Element)}function re(e){return!!Q()&&(e instanceof HTMLElement||e instanceof Z(e).HTMLElement)}function oe(e){return!(!Q()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Z(e).ShadowRoot)}const ie=new Set(["inline","contents"]);function se(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=we(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!ie.has(o)}const ae=new Set(["table","td","th"]);function le(e){return ae.has(U(e))}const ce=[":popover-open",":modal"];function fe(e){return ce.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const ue=["transform","translate","scale","rotate","perspective"],de=["transform","translate","scale","rotate","perspective","filter"],pe=["paint","layout","strict","content"];function me(e){const t=he(),n=ne(e)?we(e):e;return ue.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||de.some(e=>(n.willChange||"").includes(e))||pe.some(e=>(n.contain||"").includes(e))}function he(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const ge=new Set(["html","body","#document"]);function ye(e){return ge.has(U(e))}function we(e){return Z(e).getComputedStyle(e)}function ve(e){return ne(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xe(e){if("html"===U(e))return e;const t=e.assignedSlot||e.parentNode||oe(e)&&e.host||ee(e);return oe(t)?t.host:t}function be(e){const t=xe(e);return ye(t)?e.ownerDocument?e.ownerDocument.body:e.body:re(t)&&se(t)?t:be(t)}function Ee(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=be(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),s=Z(o);if(i){const e=Re(s);return t.concat(s,s.visualViewport||[],se(o)?o:[],e&&n?Ee(e):[])}return t.concat(o,Ee(o,[],n))}function Re(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Pe(e){const t=we(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=re(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=R(n)!==i||R(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Ae(e){return ne(e)?e:e.contextElement}function Oe(e){const t=Ae(e);if(!re(t))return A(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Pe(t);let s=(i?R(n.width):n.width)/r,a=(i?R(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Se=A(0);function Le(e){const t=Z(e);return he()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Se}function Ce(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Ae(e);let s=A(1);t&&(r?ne(r)&&(s=Oe(r)):s=Oe(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Z(e))&&t}(i,n,r)?Le(i):A(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,f=o.width/s.x,u=o.height/s.y;if(i){const e=Z(i),t=r&&ne(r)?Z(r):r;let n=e,o=Re(n);for(;o&&r&&t!==n;){const e=Oe(o),t=o.getBoundingClientRect(),r=we(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,f*=e.x,u*=e.y,l+=i,c+=s,n=Z(o),o=Re(n)}}return I({width:f,height:u,x:l,y:c})}function De(e,t){const n=ve(e).scrollLeft;return t?t.left+n:Ce(ee(e)).left+n}function Te(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-De(e,n),y:n.top+t.scrollTop}}const ke=new Set(["absolute","fixed"]);function We(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Z(e),r=ee(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const e=he();(!e||e&&"fixed"===t)&&(a=o.offsetLeft,l=o.offsetTop)}const c=De(r);if(c<=0){const e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-o);s<=25&&(i-=s)}else c<=25&&(i+=c);return{width:i,height:s,x:a,y:l}}(e,n);else if("document"===t)r=function(e){const t=ee(e),n=ve(e),r=e.ownerDocument.body,o=E(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=E(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+De(e);const a=-n.scrollTop;return"rtl"===we(r).direction&&(s+=E(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}(ee(e));else if(ne(t))r=function(e,t){const n=Ce(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=re(e)?Oe(e):A(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=Le(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return I(r)}function Fe(e,t){const n=xe(e);return!(n===t||!ne(n)||ye(n))&&("fixed"===we(n).position||Fe(n,t))}function He(e,t,n){const r=re(t),o=ee(t),i="fixed"===n,s=Ce(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=A(0);function c(){l.x=De(o)}if(r||!r&&!i)if(("body"!==U(t)||se(o))&&(a=ve(t)),r){const e=Ce(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();i&&!r&&o&&c();const f=!o||r||i?A(0):Te(o,a);return{x:s.left+a.scrollLeft-l.x-f.x,y:s.top+a.scrollTop-l.y-f.y,width:s.width,height:s.height}}function Be(e){return"static"===we(e).position}function ze(e,t){if(!re(e)||"fixed"===we(e).position)return null;if(t)return t(e);let n=e.offsetParent;return ee(e)===n&&(n=n.ownerDocument.body),n}function Me(e,t){const n=Z(e);if(fe(e))return n;if(!re(e)){let t=xe(e);for(;t&&!ye(t);){if(ne(t)&&!Be(t))return t;t=xe(t)}return n}let r=ze(e,t);for(;r&&le(r)&&Be(r);)r=ze(r,t);return r&&ye(r)&&Be(r)&&!me(r)?n:r||function(e){let t=xe(e);for(;re(t)&&!ye(t);){if(me(t))return t;if(fe(t))return null;t=xe(t)}return null}(e)||n}const Ne={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,s=ee(r),a=!!t&&fe(t.floating);if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=A(1);const f=A(0),u=re(r);if((u||!u&&!i)&&(("body"!==U(r)||se(s))&&(l=ve(r)),re(r))){const e=Ce(r);c=Oe(r),f.x=e.x+r.clientLeft,f.y=e.y+r.clientTop}const d=!s||u||i?A(0):Te(s,l);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+d.x,y:n.y*c.y-l.scrollTop*c.y+f.y+d.y}},getDocumentElement:ee,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?fe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Ee(e,[],!1).filter(e=>ne(e)&&"body"!==U(e)),o=null;const i="fixed"===we(e).position;let s=i?xe(e):e;for(;ne(s)&&!ye(s);){const t=we(s),n=me(s);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&ke.has(o.position)||se(s)&&!n&&Fe(e,s))?r=r.filter(e=>e!==s):o=t,s=xe(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=i[0],a=i.reduce((e,n)=>{const r=We(t,n,o);return e.top=E(r.top,e.top),e.right=b(r.right,e.right),e.bottom=b(r.bottom,e.bottom),e.left=E(r.left,e.left),e},We(t,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Me,getElementRects:async function(e){const t=this.getOffsetParent||Me,n=this.getDimensions,r=await n(e.floating);return{reference:He(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Pe(e);return{width:t,height:n}},getScale:Oe,isElement:ne,isRTL:function(e){return"rtl"===we(e).direction}};function $e(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _e(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=Ae(e),f=o||i?[...c?Ee(c):[],...Ee(t)]:[];f.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)});const u=c&&a?function(e,t){let n,r=null;const o=ee(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),i();const c=e.getBoundingClientRect(),{left:f,top:u,width:d,height:p}=c;if(a||t(),!d||!p)return;const m={rootMargin:-P(u)+"px "+-P(o.clientWidth-(f+d))+"px "+-P(o.clientHeight-(u+p))+"px "+-P(f)+"px",threshold:E(0,b(1,l))||1};let h=!0;function g(t){const r=t[0].intersectionRatio;if(r!==l){if(!h)return s();r?s(!1,r):n=setTimeout(()=>{s(!1,1e-7)},1e3)}1!==r||$e(c,e.getBoundingClientRect())||s(),h=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),i}(c,n):null;let d,p=-1,m=null;s&&(m=new ResizeObserver(e=>{let[r]=e;r&&r.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),n()}),c&&!l&&m.observe(c),m.observe(t));let h=l?Ce(e):null;return l&&function t(){const r=Ce(e);h&&!$e(h,r)&&n();h=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==u||u(),null==(e=m)||e.disconnect(),m=null,l&&cancelAnimationFrame(d)}}const je=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),s=D(n),a=T(n),l="y"===H(n),c=J.has(s)?-1:1,f=i&&l?-1:1,u=C(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&"number"==typeof m&&(p="end"===a?-1*m:m),l?{x:p*f,y:d*c}:{x:d*c,y:p*f}}(t,e);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},Ve=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=C(e,t),f={x:n,y:r},u=await i.detectOverflow(t,c),d=H(D(o)),p=k(d);let m=f[p],h=f[d];if(s){const e="y"===p?"bottom":"right";m=L(m+u["y"===p?"top":"left"],m,m-u[e])}if(a){const e="y"===d?"bottom":"right";h=L(h+u["y"===d?"top":"left"],h,h-u[e])}const g=l.fn({...t,[p]:m,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:s,[d]:a}}}}}},Ye=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=C(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=D(o),w=H(a),v=D(a)===a,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),b=d||(v||!h?[V(a)]:function(e){const t=V(e);return[z(e),t,z(t)]}(a)),E="none"!==m;!d&&E&&b.push(...j(a,h,m,x));const R=[a,...b],P=await l.detectOverflow(t,g),A=[];let O=(null==(r=i.flip)?void 0:r.overflows)||[];if(f&&A.push(P[y]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=T(e),o=B(e),i=W(o);let s="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=V(s)),[s,V(s)]}(o,s,x);A.push(P[e[0]],P[e[1]])}if(O=[...O,{placement:o,overflows:A}],!A.every(e=>e<=0)){var S,L;const e=((null==(S=i.flip)?void 0:S.index)||0)+1,t=R[e];if(t){if(!("alignment"===u&&w!==H(t))||O.every(e=>H(e.placement)!==w||e.overflows[0]>0))return{data:{index:e,overflows:O},reset:{placement:t}}}let n=null==(L=O.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:L.placement;if(!n)switch(p){case"bestFit":{var k;const e=null==(k=O.filter(e=>{if(E){const t=H(e.placement);return t===w||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:k[0];e&&(n=e);break}case"initialPlacement":n=a}if(o!==n)return{reset:{placement:n}}}return{}}}},Ie=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=C(e,t),f=await s.detectOverflow(t,c),u=D(o),d=T(o),p="y"===H(o),{width:m,height:h}=i.floating;let g,y;"top"===u||"bottom"===u?(g=u,y=d===(await(null==s.isRTL?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(y=u,g="end"===d?"top":"bottom");const w=h-f.top-f.bottom,v=m-f.left-f.right,x=b(h-f[g],w),R=b(m-f[y],v),P=!t.middlewareData.shift;let A=x,O=R;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(O=v),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(A=w),P&&!d){const e=E(f.left,0),t=E(f.right,0),n=E(f.top,0),r=E(f.bottom,0);p?O=m-2*(0!==e||0!==t?e+t:E(f.left,f.right)):A=h-2*(0!==n||0!==r?n+r:E(f.top,f.bottom))}await l({...t,availableWidth:O,availableHeight:A});const S=await s.getDimensions(a.floating);return m!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}},Xe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=C(e,t);switch(o){case"referenceHidden":{const e=K(await r.detectOverflow(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:G(e)}}}case"escaped":{const e=K(await r.detectOverflow(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:G(e)}}}default:return{}}}}},qe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:f=0}=C(e,t)||{};if(null==c)return{};const u=Y(f),d={x:n,y:r},p=B(o),m=W(p),h=await s.getDimensions(c),g="y"===p,y=g?"top":"left",w=g?"bottom":"right",v=g?"clientHeight":"clientWidth",x=i.reference[m]+i.reference[p]-d[p]-i.floating[m],E=d[p]-i.reference[p],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(c));let P=R?R[v]:0;P&&await(null==s.isElement?void 0:s.isElement(R))||(P=a.floating[v]||i.floating[m]);const A=x/2-E/2,O=P/2-h[m]/2-1,S=b(u[y],O),D=b(u[w],O),k=S,F=P-h[m]-D,H=P/2-h[m]/2+A,z=L(k,H,F),M=!l.arrow&&null!=T(o)&&H!==z&&i.reference[m]/2-(H<k?S:D)-h[m]/2<0,N=M?H<k?H-k:H-F:0;return{[p]:d[p]+N,data:{[p]:z,centerOffset:H-z-N,...M&&{alignmentOffset:N}},reset:M}}}),Ke=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=C(e,t),f={x:n,y:r},u=H(o),d=k(u);let p=f[d],m=f[u];const h=C(a,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===d?"height":"width",t=i.reference[d]-i.floating[e]+g.mainAxis,n=i.reference[d]+i.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(c){var y,w;const e="y"===d?"width":"height",t=J.has(D(o)),n=i.reference[u]-i.floating[e]+(t&&(null==(y=s.offset)?void 0:y[u])||0)+(t?0:g.crossAxis),r=i.reference[u]+i.reference[e]+(t?0:(null==(w=s.offset)?void 0:w[u])||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[d]:p,[u]:m}}}},Ge=(e,t,n)=>{const r=new Map,o={platform:Ne,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=X(c,r,l),d=r,p={},m=0;for(let n=0;n<a.length;n++){var h;const{name:i,fn:g}=a[n],{x:y,y:w,data:v,reset:x}=await g({x:f,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:c,platform:{...s,detectOverflow:null!=(h=s.detectOverflow)?h:q},elements:{reference:e,floating:t}});f=null!=y?y:f,u=null!=w?w:u,p={...p,[i]:{...p[i],...v}},x&&m<=50&&(m++,"object"==typeof x&&(x.placement&&(d=x.placement),x.rects&&(c=!0===x.rects?await s.getElementRects({reference:e,floating:t,strategy:o}):x.rects),({x:f,y:u}=X(c,d,l))),n=-1)}return{x:f,y:u,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Je="undefined"!=typeof document?t:function(){};function Qe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!Qe(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Qe(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ue(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ze(e,t){const n=Ue(e);return Math.round(t*n)/n}function et(t){const n=e.useRef(t);return Je(()=>{n.current=t}),n}function tt(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=e.useState(o);Qe(m,o)||h(o);const[g,y]=e.useState(null),[w,v]=e.useState(null),x=e.useCallback(e=>{e!==P.current&&(P.current=e,y(e))},[]),b=e.useCallback(e=>{e!==A.current&&(A.current=e,v(e))},[]),E=s||g,R=a||w,P=e.useRef(null),A=e.useRef(null),O=e.useRef(d),S=null!=c,L=et(c),C=et(i),D=et(u),T=e.useCallback(()=>{if(!P.current||!A.current)return;const e={placement:n,strategy:r,middleware:m};C.current&&(e.platform=C.current),Ge(P.current,A.current,e).then(e=>{const t={...e,isPositioned:!1!==D.current};k.current&&!Qe(O.current,t)&&(O.current=t,f.flushSync(()=>{p(t)}))})},[m,n,r,C,D]);Je(()=>{!1===u&&O.current.isPositioned&&(O.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const k=e.useRef(!1);Je(()=>(k.current=!0,()=>{k.current=!1}),[]),Je(()=>{if(E&&(P.current=E),R&&(A.current=R),E&&R){if(L.current)return L.current(E,R,T);T()}},[E,R,T,L,S]);const W=e.useMemo(()=>({reference:P,floating:A,setReference:x,setFloating:b}),[x,b]),F=e.useMemo(()=>({reference:E,floating:R}),[E,R]),H=e.useMemo(()=>{const e={position:r,left:0,top:0};if(!F.floating)return e;const t=Ze(F.floating,d.x),n=Ze(F.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...Ue(F.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,F.floating,d.x,d.y]);return e.useMemo(()=>({...d,update:T,refs:W,elements:F,floatingStyles:H}),[d,T,W,F,H])}const nt=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?qe({element:n.current,padding:r}).fn(t):{}:n?qe({element:n,padding:r}).fn(t):{};var o}}),rt=(e,t)=>({...je(e),options:[e,t]}),ot=(e,t)=>({...Ve(e),options:[e,t]}),it=(e,t)=>({...Ye(e),options:[e,t]}),st=(e,t)=>({...Ie(e),options:[e,t]}),at=(e,t)=>({...Xe(e),options:[e,t]}),lt=(e,t)=>({...nt(e),options:[e,t]});var ct=e.forwardRef((e,t)=>{const{children:r,width:o=10,height:i=5,...s}=e;return c(n.svg,{...s,ref:t,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:c("polygon",{points:"0,0 30,0 15,10"})})});ct.displayName="Arrow";var ft=ct;function ut(t){const[n,r]=e.useState(void 0);return i(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver(e=>{if(!Array.isArray(e))return;if(!e.length)return;const n=e[0];let o,i;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=t.offsetWidth,i=t.offsetHeight;r({width:o,height:i})});return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}r(void 0)},[t]),n}var dt="Popper",[pt,mt]=s(dt),[ht,gt]=pt(dt),yt=t=>{const{__scopePopper:n,children:r}=t,[o,i]=e.useState(null);return c(ht,{scope:n,anchor:o,onAnchorChange:i,children:r})};yt.displayName=dt;var wt="PopperAnchor",vt=e.forwardRef((t,r)=>{const{__scopePopper:o,virtualRef:i,...s}=t,l=gt(wt,o),f=e.useRef(null),u=a(r,f),d=e.useRef(null);return e.useEffect(()=>{const e=d.current;d.current=i?.current||f.current,e!==d.current&&l.onAnchorChange(d.current)}),i?null:c(n.div,{...s,ref:u})});vt.displayName=wt;var xt="PopperContent",[bt,Et]=pt(xt),Rt=e.forwardRef((t,r)=>{const{__scopePopper:o,side:s="bottom",sideOffset:f=0,align:u="center",alignOffset:d=0,arrowPadding:p=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:g=0,sticky:y="partial",hideWhenDetached:w=!1,updatePositionStrategy:v="optimized",onPlaced:x,...b}=t,E=gt(xt,o),[R,P]=e.useState(null),A=a(r,e=>P(e)),[O,S]=e.useState(null),L=ut(O),C=L?.width??0,D=L?.height??0,T=s+("center"!==u?"-"+u:""),k="number"==typeof g?g:{top:0,right:0,bottom:0,left:0,...g},W=Array.isArray(h)?h:[h],F=W.length>0,H={padding:k,boundary:W.filter(St),altBoundary:F},{refs:B,floatingStyles:z,placement:M,isPositioned:N,middlewareData:$}=tt({strategy:"fixed",placement:T,whileElementsMounted:(...e)=>_e(...e,{animationFrame:"always"===v}),elements:{reference:E.anchor},middleware:[rt({mainAxis:f+D,alignmentAxis:d}),m&&ot({mainAxis:!0,crossAxis:!1,limiter:"partial"===y?{...Ke(_),options:[_,j]}:void 0,...H}),m&&it({...H}),st({...H,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=t.reference,s=e.floating.style;s.setProperty("--radix-popper-available-width",`${n}px`),s.setProperty("--radix-popper-available-height",`${r}px`),s.setProperty("--radix-popper-anchor-width",`${o}px`),s.setProperty("--radix-popper-anchor-height",`${i}px`)}}),O&<({element:O,padding:p}),Lt({arrowWidth:C,arrowHeight:D}),w&&at({strategy:"referenceHidden",...H})]});var _,j;const[V,Y]=Ct(M),I=l(x);i(()=>{N&&I?.()},[N,I]);const X=$.arrow?.x,q=$.arrow?.y,K=0!==$.arrow?.centerOffset,[G,J]=e.useState();return i(()=>{R&&J(window.getComputedStyle(R).zIndex)},[R]),c("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:N?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[$.transformOrigin?.x,$.transformOrigin?.y].join(" "),...$.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:c(bt,{scope:o,placedSide:V,onArrowChange:S,arrowX:X,arrowY:q,shouldHideArrow:K,children:c(n.div,{"data-side":V,"data-align":Y,...b,ref:A,style:{...b.style,animation:N?void 0:"none"}})})})});Rt.displayName=xt;var Pt="PopperArrow",At={top:"bottom",right:"left",bottom:"top",left:"right"},Ot=e.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,o=Et(Pt,n),i=At[o.placedSide];return c("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:c(ft,{...r,ref:t,style:{...r.style,display:"block"}})})});function St(e){return null!==e}Ot.displayName=Pt;var Lt=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=0!==o.arrow?.centerOffset,s=i?0:e.arrowWidth,a=i?0:e.arrowHeight,[l,c]=Ct(n),f={start:"0%",center:"50%",end:"100%"}[c],u=(o.arrow?.x??0)+s/2,d=(o.arrow?.y??0)+a/2;let p="",m="";return"bottom"===l?(p=i?f:`${u}px`,m=-a+"px"):"top"===l?(p=i?f:`${u}px`,m=`${r.floating.height+a}px`):"right"===l?(p=-a+"px",m=i?f:`${d}px`):"left"===l&&(p=`${r.floating.width+a}px`,m=i?f:`${d}px`),{data:{x:p,y:m}}}});function Ct(e){const[t,n="center"]=e.split("-");return[t,n]}var Dt=yt,Tt=vt,kt=Rt,Wt=Ot,Ft=e.forwardRef((t,r)=>{const{container:o,...s}=t,[a,l]=e.useState(!1);i(()=>l(!0),[]);const f=o||a&&globalThis?.document?.body;return f?u.createPortal(c(n.div,{...s,ref:r}),f):null});Ft.displayName="Portal";export{Tt as A,kt as C,y as D,Ft as P,Dt as R,Wt as a,_e as b,mt as c,ne as d,ut as e,it as f,oe as i,rt as o,ot as s,tt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e}from"./_tslib-35bb891d.js";import{jsx as a}from"react/jsx-runtime";import*as r from"react";import"react-dom";import{c as t}from"./index-a5cba5f7.js";import{c as o}from"./button-7aec29d6.js";import{c as s}from"./utils-3345eade.js";var i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,o)=>{const s=t(`Primitive.${o}`),i=r.forwardRef((e,r)=>{const{asChild:t,...i}=e,n=t?s:o;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),a(n,{...i,ref:r})});return i.displayName=`Primitive.${o}`,{...e,[o]:i}},{}),n=r.forwardRef((e,r)=>a(i.label,{...e,ref:r,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(e.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));n.displayName="Label";var l=n;const m=o("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=r.forwardRef((r,t)=>{var{className:o}=r,i=e(r,["className"]);return a(l,Object.assign({ref:t,className:s(m(),o)},i))});d.displayName=l.displayName;export{d as L};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e}from"./_tslib-35bb891d.js";import{jsx as o}from"react/jsx-runtime";import*as r from"react";import{c as t,P as n,a}from"./index-17323747.js";import{c as s,u as i}from"./index-91a5b8d5.js";import{c,A as d,D as l,C as p,a as u,P as f,R as m}from"./index-23c7fb16.js";import{h as v,R as h,u as g,F as P}from"./Combination-575d4475.js";import{u as C}from"./index-ce60ba41.js";import{P as y}from"./index-23db6fea.js";import{u as O}from"./index-ff0e3962.js";import{c as R}from"./utils-3345eade.js";function b(e){const o=r.forwardRef((e,o)=>{const{children:t,...n}=e;if(r.isValidElement(t)){const e=function(e){let o=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=o&&"isReactWarning"in o&&o.isReactWarning;if(r)return e.ref;if(o=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=o&&"isReactWarning"in o&&o.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(t),a=function(e,o){const r={...o};for(const t in o){const n=e[t],a=o[t];/^on[A-Z]/.test(t)?n&&a?r[t]=(...e)=>{const o=a(...e);return n(...e),o}:n&&(r[t]=n):"style"===t?r[t]={...n,...a}:"className"===t&&(r[t]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}(n,t.props);return t.type!==r.Fragment&&(a.ref=o?s(o,e):e),r.cloneElement(t,a)}return r.Children.count(t)>1?r.Children.only(null):null});return o.displayName=`${e}.SlotClone`,o}var w=Symbol("radix.slottable");function _(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===w}var x="Popover",[A,F]=t(x,[c]),E=c(),[D,N]=A(x),j=e=>{const{__scopePopover:t,children:n,open:a,defaultOpen:s,onOpenChange:i,modal:c=!1}=e,d=E(t),l=r.useRef(null),[p,u]=r.useState(!1),[f,v]=O({prop:a,defaultProp:s??!1,onChange:i,caller:x});return o(m,{...d,children:o(D,{scope:t,contentId:C(),triggerRef:l,open:f,onOpenChange:v,onOpenToggle:r.useCallback(()=>v(e=>!e),[v]),hasCustomAnchor:p,onCustomAnchorAdd:r.useCallback(()=>u(!0),[]),onCustomAnchorRemove:r.useCallback(()=>u(!1),[]),modal:c,children:n})})};j.displayName=x;var k="PopoverAnchor";r.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,s=N(k,n),i=E(n),{onCustomAnchorAdd:c,onCustomAnchorRemove:l}=s;return r.useEffect(()=>(c(),()=>l()),[c,l]),o(d,{...i,...a,ref:t})}).displayName=k;var I="PopoverTrigger",M=r.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,c=N(I,t),l=E(t),p=i(r,c.triggerRef),u=o(n.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":G(c.open),...s,ref:p,onClick:a(e.onClick,c.onOpenToggle)});return c.hasCustomAnchor?u:o(d,{asChild:!0,...l,children:u})});M.displayName=I;var S="PopoverPortal",[V,W]=A(S,{forceMount:void 0}),z=e=>{const{__scopePopover:r,forceMount:t,children:n,container:a}=e,s=N(S,r);return o(V,{scope:r,forceMount:t,children:o(y,{present:t||s.open,children:o(f,{asChild:!0,container:a,children:n})})})};z.displayName=S;var K="PopoverContent",T=r.forwardRef((e,r)=>{const t=W(K,e.__scopePopover),{forceMount:n=t.forceMount,...a}=e,s=N(K,e.__scopePopover);return o(y,{present:n||s.open,children:s.modal?o($,{...a,ref:r}):o(B,{...a,ref:r})})});T.displayName=K;var Z=function(e){const t=b(e),n=r.forwardRef((e,n)=>{const{children:a,...s}=e,i=r.Children.toArray(a),c=i.find(_);if(c){const e=c.props.children,a=i.map(o=>o===c?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:o);return o(t,{...s,ref:n,children:r.isValidElement(e)?r.cloneElement(e,void 0,a):null})}return o(t,{...s,ref:n,children:a})});return n.displayName=`${e}.Slot`,n}("PopoverContent.RemoveScroll"),$=r.forwardRef((e,t)=>{const n=N(K,e.__scopePopover),s=r.useRef(null),c=i(t,s),d=r.useRef(!1);return r.useEffect(()=>{const e=s.current;if(e)return v(e)},[]),o(h,{as:Z,allowPinchZoom:!0,children:o(U,{...e,ref:c,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:a(e.onCloseAutoFocus,e=>{e.preventDefault(),d.current||n.triggerRef.current?.focus()}),onPointerDownOutside:a(e.onPointerDownOutside,e=>{const o=e.detail.originalEvent,r=0===o.button&&!0===o.ctrlKey,t=2===o.button||r;d.current=t},{checkForDefaultPrevented:!1}),onFocusOutside:a(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),B=r.forwardRef((e,t)=>{const n=N(K,e.__scopePopover),a=r.useRef(!1),s=r.useRef(!1);return o(U,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(a.current||n.triggerRef.current?.focus(),o.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(a.current=!0,"pointerdown"===o.detail.originalEvent.type&&(s.current=!0));const r=o.target,t=n.triggerRef.current?.contains(r);t&&o.preventDefault(),"focusin"===o.detail.originalEvent.type&&s.current&&o.preventDefault()}})}),U=r.forwardRef((e,r)=>{const{__scopePopover:t,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,...m}=e,v=N(K,t),h=E(t);return g(),o(P,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o(l,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:u,onDismiss:()=>v.onOpenChange(!1),children:o(p,{"data-state":G(v.open),role:"dialog",id:v.contentId,...h,...m,ref:r,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),q="PopoverClose";r.forwardRef((e,r)=>{const{__scopePopover:t,...s}=e,i=N(q,t);return o(n.button,{type:"button",...s,ref:r,onClick:a(e.onClick,()=>i.onOpenChange(!1))})}).displayName=q;function G(e){return e?"open":"closed"}r.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=E(t);return o(u,{...a,...n,ref:r})}).displayName="PopoverArrow";var H=z,J=T;const L=j,Q=M,X=r.forwardRef((r,t)=>{var{className:n,align:a="center",sideOffset:s=4}=r,i=e(r,["className","align","sideOffset"]);return o(H,{children:o(J,Object.assign({ref:t,align:a,sideOffset:s,className:R("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n)},i))})});X.displayName=J.displayName;export{L as P,Q as a,X as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as r}from"./_tslib-35bb891d.js";import{jsx as a}from"react/jsx-runtime";import*as o from"react";import"react-dom";import{c as i}from"./index-a5cba5f7.js";import{c as e}from"./utils-3345eade.js";var t=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((r,e)=>{const t=i(`Primitive.${e}`),n=o.forwardRef((r,o)=>{const{asChild:i,...n}=r,s=i?t:e;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),a(s,{...n,ref:o})});return n.displayName=`Primitive.${e}`,{...r,[e]:n}},{}),n="horizontal",s=["horizontal","vertical"],l=o.forwardRef((r,o)=>{const{decorative:i,orientation:e=n,...l}=r,d=function(r){return s.includes(r)}(e)?e:n,m=i?{role:"none"}:{"aria-orientation":"vertical"===d?d:void 0,role:"separator"};return a(t.div,{"data-orientation":d,...m,...l,ref:o})});l.displayName="Separator";var d=l;const m=o.forwardRef((o,i)=>{var{className:t,orientation:n="horizontal",decorative:s=!0}=o,l=r(o,["className","orientation","decorative"]);return a(d,Object.assign({ref:i,decorative:s,orientation:n,className:e("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",t)},l))});m.displayName=d.displayName;export{m as S};
|