@6thbridge/hexa 0.0.0-pr76-137 → 0.0.0-pr77-138

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/index.js CHANGED
@@ -11,5 +11,5 @@
11
11
  focus-visible:border-status-success-fill focus-visible:!ring-offset-status-success-bg focus-visible:!ring-status-success-bg focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-status-success-fill
12
12
  focus:border-status-success-fill focus:!ring-offset-status-success-bg focus:!ring-status-success-bg focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-status-success-fill
13
13
  disabled:cursor-not-allowed disabled:opacity-50 peer`,e==="md"?"h-5 w-5":e==="lg"?"h-6 w-6":"","data-[state=checked]:border-status-success-fill data-[state=checked]:bg-status-success-bg",o),id:r,disabled:c,...u,children:(0,Re.jsx)(_t.Indicator,{className:i(`text-white dark:text-black data-[state=checked]:text-status-success-fill
14
- flex items-center justify-center text-current`),children:t?(0,Re.jsx)(Jo.motion.svg,{initial:{opacity:0,scale:.8},exit:{opacity:0},animate:{opacity:1,scale:1},transition:{duration:.1},width:"12",height:"2",viewBox:"0 0 12 2",fill:"none",children:(0,Re.jsx)("path",{d:"M1.9165 1H10.0832",stroke:c?"#B0B0B0":"#00D488",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):(0,Re.jsx)(Jo.motion.svg,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.1},exit:{opacity:0},width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:(0,Re.jsx)("path",{d:"M1 3.99996L3.66353 6.66349L9 1.33643",stroke:c?"#B0B0B0":"#00D488",strokeWidth:"1.06667",strokeLinecap:"round",strokeLinejoin:"round"})})})}),(a||m)&&(0,Re.jsxs)("div",{className:i("flex flex-col justify-start items-start text-base-700 dark:text-white peer-aria-checked:text-base-900 dark:peer-aria-checked:text-white peer-focus-visible:text-base-900 dark:peer-focus-visible:text-white peer-focus:text-base-900 dark:peer-focus:text-white peer-hover:text-base-900 dark:peer-hover:text-white",s),children:[(0,Re.jsx)("label",{htmlFor:r,className:i(n,"text-sm font-normal cursor-pointer disabled:cursor-not-allowed transition-colors",{"cursor-not-allowed opacity-50":c}),children:a}),m&&(0,Re.jsx)("p",{className:i("text-sm text-base-500",{"cursor-not-allowed opacity-50":c},l),children:m})]})]}));Gt.displayName=_t.Root.displayName;var L=require("react/jsx-runtime"),Ja=U.memo(({item:e,onDelete:t})=>(0,L.jsxs)("p",{className:"text-xs p-1.5 py-1 bg-gray-100 rounded-md flex items-center",children:[(0,L.jsx)("span",{children:e.label}),(0,L.jsx)("button",{type:"button",className:"pl-2",onClick:o=>{o.stopPropagation(),t(e)},children:(0,L.jsx)(qa.X,{size:12})})]}));Ja.displayName="SelectedChip";var xo=U.memo(({disabled:e,className:t,values:o,placeholder:r="",status:a,onDelete:n})=>(0,L.jsx)(j,{asChild:!0,disabled:e,children:(0,L.jsxs)("div",{className:i(oe({status:a}),"cursor-pointer [&>svg]:shrink-0 h-auto min-h-12 flex items-center justify-between w-full gap-2",t),children:[(0,L.jsx)("div",{className:"w-full flex flex-row items-center gap-2 flex-wrap",children:o.length?o.map(s=>(0,L.jsx)(Ja,{item:s,onDelete:n},s.value)):(0,L.jsx)("span",{className:"text-[#79818C] dark:text-[#959BA4]",children:r})}),(0,L.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,L.jsx)("path",{d:"M16.5999 7.45825L11.1666 12.8916C10.5249 13.5333 9.4749 13.5333 8.83324 12.8916L3.3999 7.45825",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})})]})}));xo.displayName="MultiSelectTrigger";var Qa=U.memo(({option:e,isChecked:t,onSelect:o,optionComponent:r})=>(0,L.jsx)("article",{className:"cursor-pointer relative hover:bg-status-success-bg transition flex w-[calc(100%-0.375rem)] mx-auto rounded-md items-center focus:dark:!text-[#DDDFE0] py-1.5 px-2 text-sm outline-none focus:bg-status-success-bg dark:!text-[#DDDFE0] focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus-visible:ring-1 focus-visible:ring-status-success-fill focus-visible:ring-offset-1 focus-visible:ring-offset-status-success-fill",onClick:()=>o(e),children:(0,L.jsx)("div",{className:"w-full h-[30px] flex flex-row items-center dark:!text-white",children:(0,L.jsx)(Gt,{onSelect:()=>o(e),value:e.value,label:r?r(e):(0,L.jsx)("span",{children:e.label}),bodyClassName:"w-full",labelWrapperClassName:"w-full",labelClassName:i(r&&"w-full"),checked:t})})}));Qa.displayName="OptionItem";var en=({options:e,children:t,onChange:o,optionComponent:r,values:a,hideSearch:n,modal:s,placeholder:c,isLoading:m,showSelectedValues:l=!1,error:p,label:u,showAsterisk:d})=>{let[f,N]=U.useState(""),y=a,v=U.useMemo(()=>new Set(y.map(P=>P.value)),[y]),g=U.useMemo(()=>{if(!f)return e;let P=f.trim().toLowerCase();return e.filter(V=>V.label?.trim()?.toLowerCase()?.includes(P))},[e,f]),R=U.useCallback(P=>{let V=v.has(P.value);o(V?y.filter(He=>He.value!==P.value):[...y,P])},[y,v,o]),x=U.useRef(null),[b,h]=U.useState(void 0);U.useLayoutEffect(()=>{if(!x.current)return;let P=x.current,V=()=>{h(P.getBoundingClientRect().width)};V();let He=new ResizeObserver(()=>{V()});return He.observe(P),()=>He.disconnect()},[]);let C=U.useCallback(P=>{let V=y.filter(He=>He.value!==P.value);o(V)},[y,o]),w=U.useCallback(()=>{y.length===e.length?o([]):o(e)},[y.length,e,o]),A=U.useCallback(P=>{N(P.target.value)},[]);return(0,L.jsxs)("div",{className:"relative space-y-1",children:[(0,L.jsx)(W,{showAsterisk:d,error:p,children:u}),(0,L.jsxs)(ae,{modal:s,children:[(0,L.jsx)("div",{ref:x,children:t??(0,L.jsx)(xo,{values:y,placeholder:c??"Select",onDelete:C,className:"h-auto"})}),l&&(0,L.jsx)("div",{className:"flex py-2 gap-2 flex-wrap",children:y.map(P=>(0,L.jsx)("div",{className:"bg-gray-100 border text-black rounded-xl text-[10px] font-medium px-2 py-1",children:(0,L.jsx)("span",{children:P.label})},(0,Qo.v4)()))}),(0,L.jsxs)(Q,{portal:!s,align:"start",className:"min-w-[200px] p-0",style:{width:b?`${b}px`:void 0},children:[!n&&(0,L.jsx)("div",{className:"w-full px-4",children:(0,L.jsxs)("div",{className:"w-full h-[36px] px-1 flex items-center justify-start border-[0.5px] rounded-md border-[#D7D7D7] mb-[5px]",children:[m?(0,L.jsx)(ye,{}):(0,L.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,L.jsx)("path",{d:"M11.5 21C16.7467 21 21 16.7467 21 11.5C21 6.25329 16.7467 2 11.5 2C6.25329 2 2 6.25329 2 11.5C2 16.7467 6.25329 21 11.5 21Z",stroke:"#959595",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,L.jsx)("path",{d:"M22 22L20 20",stroke:"#959595",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,L.jsx)("input",{value:f,placeholder:"Search",type:"text",disabled:m,className:"oultine-0 focus-visible:outline-0 focus-visible:ring-0 ml-1 w-full !border-transparent placeholder:text-sm placeholder:font-normal dark:bg-transparent placeholder:text-[#959595] dark:placeholder:text-[#DDDFE0] focus:ring-0 focus:ring-offset-0 focus:bg-white dark:focus:bg-transparent dark:text-[#DDDFE0]",onChange:A})]})}),(0,L.jsxs)("div",{className:i("w-full h-[44px] px-2.5 flex items-center justify-between mb-[5px] border-[#D7D7D7] dark:border-[#5C636B]",n?"border-b-[0.5px]":"border-y-[0.5px]"),children:[(0,L.jsx)("button",{className:"text-sm text-primary-main font-normal",onClick:w,disabled:g.length<1||m,children:(0,L.jsxs)("span",{children:[y.length===e.length?"Unselect":"Select"," all"]})}),(0,L.jsxs)("p",{className:"text-sm text-[#959595] font-normal dark:text-[#DDDFE0]",children:[y.length," selected"]})]}),(0,L.jsxs)(ve,{viewPortClassName:"max-h-[225px]",className:"pb-1",children:[m&&(0,L.jsx)("div",{className:"py-7 flex justify-center",children:(0,L.jsx)(ye,{})}),!m&&g.map(P=>(0,L.jsx)(Qa,{option:P,isChecked:v.has(P.value),onSelect:R,optionComponent:r},(0,Qo.v4)()))]})]})]})]})};var Xe=k(require("@radix-ui/react-tabs"));var Pe=require("react/jsx-runtime");function tn({tabs:e,defaultValue:t,onChange:o}){return(0,Pe.jsxs)(Xe.Root,{defaultValue:t,onValueChange:o,className:"flex flex-col items-start justify-start gap-2.5",children:[(0,Pe.jsxs)(ve,{className:"w-full",children:[(0,Pe.jsx)(Yt,{className:"z-[1000]",orientation:"horizontal"}),(0,Pe.jsx)(Xe.List,{className:"my-2 border-b border-gray-300 items-center flex",children:e.map(r=>(0,Pe.jsxs)(Xe.Trigger,{className:"flex items-center gap-2 whitespace-nowrap rounded-t-md px-5 py-2 relative transition-all group hover:!bg-gray-200/50 dark:hover:!bg-gray-200/10 data-[state=active]:dark:hover:!bg-gray-200 data-[state=active]:hover:!bg-gray-200 data-[state=active]:bg-gray-200 before:absolute before:bottom-[0px] before:left-0 before:h-[2px] dark:before:h-[0px] before:w-full before:rounded-sm data-[state=active]:before:!bg-texts-50 before:content-['']",value:r?.key,children:[(0,Pe.jsx)("p",{className:"text-center text-sm leading-5 font-normal text-gray-500 group-data-[state=active]:font-medium group-data-[state=active]:text-gray-800",children:(0,Pe.jsx)("span",{children:r.title})}),r.count&&(0,Pe.jsx)("div",{className:"bg-gray-300 group-data-[state=active]:bg-texts-50 group-data-[state=active]:text-white text-texts-50 text-xs font-medium me-2 px-2.5 py-0.5 rounded-full",children:(0,Pe.jsx)("span",{children:r.count})})]},r?.key))})]}),e.map(r=>(0,Pe.jsx)(Xe.Content,{value:r?.key,className:"w-full",children:r.content},r?.key))]})}var Wt=require("react-icons/bi");var rn=require("class-variance-authority"),an=(0,rn.cva)("relative rounded-lg border px-4 py-4 text-sm",{variants:{variant:{default:"border-blue-200 bg-blue-50 text-blue-800",danger:"border-red-200 bg-red-50 text-red-800",success:"border-green-200 bg-green-50 text-green-800",pending:"border-yellow-200 bg-yellow-50 text-yellow-800"}},defaultVariants:{variant:"default"}}),on={default:{primary:"",outlined:""},danger:{primary:"bg-red-600 hover:bg-red-600/80 text-white border-red-600",outlined:"border-red-600 text-red-600 hover:bg-red-50"},success:{primary:"bg-green-600 hover:bg-green-600/80 text-white border-green-600",outlined:"border-green-600 text-green-600 hover:bg-green-50"},pending:{primary:"bg-yellow-600 hover:bg-yellow-600/80 text-white border-yellow-600",outlined:"border-yellow-600 text-yellow-600 hover:bg-yellow-50"}},nn=(e,t)=>(on[e]??on.default)[t];var ee=require("react/jsx-runtime"),sn=({title:e,message:t,variant:o="default",icon:r,action:a,dismissible:n=!1,onDismiss:s,isOpen:c=!0,align:m="start",classNames:l})=>{if(!c)return null;let p=a?.variant??"primary",u=nn(o??"default",p),d=m==="center";return(0,ee.jsxs)("div",{className:i(an({variant:o}),l?.root),children:[n&&(0,ee.jsx)("button",{type:"button",onClick:s,className:"absolute top-3 right-3 opacity-60 transition-opacity hover:opacity-100 sm:hidden","aria-label":"Dismiss",id:"feature_banner_dismiss_button_mobile",children:(0,ee.jsx)(Wt.BiX,{size:20})}),(0,ee.jsxs)("div",{className:i("flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",d&&"sm:items-center"),id:"feature_banner_container",children:[(0,ee.jsxs)("div",{className:i("flex items-start gap-3 pr-6 sm:pr-0",d&&"sm:items-center"),id:"feature_banner_content_wrapper",children:[(0,ee.jsx)("span",{className:i("shrink-0 mt-0.5",d&&"sm:mt-0",l?.icon),id:"feature_banner_icon",children:r??(0,ee.jsx)(Wt.BiInfoCircle,{size:18})}),(0,ee.jsxs)("div",{className:"min-w-0",id:"feature_banner_content",children:[(0,ee.jsx)("p",{className:i("font-semibold",l?.title),id:"feature_banner_title",children:e}),t&&(0,ee.jsx)("p",{id:"feature_banner_message",className:i("mt-1 text-sm opacity-90 break-words",l?.message),children:t})]})]}),(a||n)&&(0,ee.jsxs)("div",{className:i("flex flex-col items-end gap-3 sm:flex-row sm:items-center",d&&"sm:items-center"),id:"feature_banner_actions_wrapper",children:[a&&(0,ee.jsx)(ie,{variant:p,type:"button",onClick:a.onClick,className:i(u,l?.action),id:"feature_banner_action_button",children:a.label}),n&&(0,ee.jsx)("button",{type:"button",onClick:s,className:"hidden sm:flex opacity-60 transition-opacity hover:opacity-100","aria-label":"Dismiss",id:"feature_banner_dismiss_button",children:(0,ee.jsx)(Wt.BiX,{size:20})})]})]})]})};var xn=k(require("@tiptap/extension-font-family")),Cn=k(require("@tiptap/extension-link")),wn=k(require("@tiptap/extension-underline")),wo=require("@tiptap/react"),Nn=k(require("@tiptap/starter-kit")),Co=k(require("clsx"));var hn=k(require("clsx"));var me=require("lucide-react"),ln=require("react/jsx-runtime"),fi=()=>(0,ln.jsx)("span",{className:"text-sm font-semibold",children:"H1"}),rt={bold:{icon:me.Bold,action:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),title:"Bold"},italic:{icon:me.Italic,action:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),title:"Italic"},underline:{icon:me.Underline,action:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),title:"Underline"},strike:{icon:me.Strikethrough,action:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),title:"Strikethrough"},heading1:{icon:fi,action:e=>e.chain().focus().toggleHeading({level:1}).run(),isActive:e=>e.isActive("heading",{level:1}),title:"Heading 1"},bulletList:{icon:me.List,action:e=>e.chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),title:"Bullet List"},orderedList:{icon:me.ListOrdered,action:e=>e.chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),title:"Numbered List"},blockquote:{icon:me.Quote,action:e=>e.chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),title:"Quote"},textStyle:{icon:()=>null,action:()=>!0,isActive:()=>!1,title:"Text Style"},link:{icon:()=>null,action:()=>!0,isActive:()=>!1,title:"Link"}};var cn=k(require("clsx")),er=require("react/jsx-runtime"),dn=({editor:e,icon:t,action:o,isActive:r,disabled:a,title:n,className:s})=>(0,er.jsx)("button",{type:"button",onClick:()=>o(e),disabled:a??!e.can().chain().focus().run(),title:n,className:(0,cn.default)("p-2 rounded hover:bg-gray-100 transition",{"opacity-100 text-black":r(e),"opacity-40 text-gray-500":!r(e),"cursor-not-allowed":a},s),children:(0,er.jsx)(t,{width:18,height:18})});var pn=k(require("clsx")),mn=require("lucide-react"),Le=require("react");var te=require("react/jsx-runtime"),un=({editor:e})=>{let[t,o]=(0,Le.useState)(!1),[r,a]=(0,Le.useState)(""),n=(0,Le.useMemo)(()=>!e.state.selection.empty,[e.state.selection]),s=(0,Le.useMemo)(()=>e.isActive("link"),[e]),c=(0,Le.useMemo)(()=>n||s,[n,s]),m=(0,Le.useCallback)(()=>{r.trim()&&(e.chain().focus().extendMarkRange("link").setLink({href:r.trim()}).run(),o(!1),a(""))},[e,r]),l=(0,Le.useCallback)(()=>{e.chain().focus().extendMarkRange("link").unsetLink().run(),o(!1),a("")},[e]),p=(0,Le.useCallback)(d=>{let f=e.getAttributes("link").href;a(f||""),o(d)},[c,e]),u=(0,Le.useCallback)(d=>{d.key==="Enter"&&(d.preventDefault(),m()),d.key==="Escape"&&o(!1)},[m]);return(0,te.jsx)(be,{open:t,onOpenChange:p,trigger:(0,te.jsx)("div",{className:(0,pn.default)("",{"opacity-100 text-black":t,"opacity-40 text-gray-500":!t}),title:c?e.isActive("link")?"Edit link":"Add link":"Select text to add a link",children:(0,te.jsx)(mn.Link,{width:18,height:18})}),contentClassName:"w-80 p-4",align:"start",children:(0,te.jsx)("div",{className:"space-y-4",children:!n&&!s?(0,te.jsx)("div",{className:"text-sm text-gray-500 bg-gray-50 rounded p-3 border border-gray-200",children:"Please select some text in the editor to apply a link."}):(0,te.jsxs)(te.Fragment,{children:[(0,te.jsxs)("div",{children:[(0,te.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Link URL"}),(0,te.jsx)(J,{type:"url",value:r,onChange:d=>a(d.target.value),placeholder:"https://example.com",autoFocus:!0,onKeyDown:u})]}),(0,te.jsxs)("div",{className:"flex justify-between space-x-2",children:[(0,te.jsx)(ie,{type:"button",onClick:m,disabled:!r.trim(),variant:"primary",size:"sm",className:"flex-1",children:e.isActive("link")?"Update Link":"Add Link"}),e.isActive("link")&&(0,te.jsx)(ie,{type:"button",onClick:l,variant:"neutral",size:"sm",className:"px-3 py-2 bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200 transition text-sm font-medium",children:"Remove"})]})]})})})};var fn=k(require("clsx")),gn=require("lucide-react"),bn=require("react");var Me=require("react/jsx-runtime"),vn=({editor:e})=>{let[t,o]=(0,bn.useState)(!1),r=()=>e.isActive("heading",{level:1})?"Heading 1":e.isActive("heading",{level:2})?"Heading 2":e.isActive("heading",{level:3})?"Heading 3":"Normal",a=[{label:"Normal",action:()=>e.chain().focus().setParagraph().run(),isActive:!e.isActive("heading")},{label:"Heading 1",action:()=>e.chain().focus().toggleHeading({level:1}).run(),isActive:e.isActive("heading",{level:1})},{label:"Heading 2",action:()=>e.chain().focus().toggleHeading({level:2}).run(),isActive:e.isActive("heading",{level:2})},{label:"Heading 3",action:()=>e.chain().focus().toggleHeading({level:3}).run(),isActive:e.isActive("heading",{level:3})}];return(0,Me.jsx)(be,{open:t,onOpenChange:o,trigger:(0,Me.jsxs)("button",{type:"button",className:"flex items-center space-x-1 p-2 rounded hover:bg-gray-100 transition min-w-[110px] justify-between text-gray-600",children:[(0,Me.jsx)("span",{className:"text-base ",children:r()}),(0,Me.jsx)(gn.ChevronDown,{width:16,height:16})]}),contentClassName:"w-48 w-auto- p-1",align:"start",children:(0,Me.jsx)("div",{className:"space-y-1",children:a.map((n,s)=>(0,Me.jsxs)("div",{children:[s===1&&(0,Me.jsx)("div",{className:"border-b border-gray-200 my-1"}),(0,Me.jsx)("button",{type:"button",onClick:()=>{n.action(),o(!1)},className:(0,fn.default)("w-full text-left px-3 py-2 rounded text-sm hover:bg-gray-100 transition",{"bg-gray-100 font-medium":n.isActive}),children:n.label})]},n.label))})})};var at=require("react/jsx-runtime"),yn=({editor:e,controls:t=["textStyle","bold","italic","underline","strike","link","bulletList","orderedList","blockquote"],className:o,extraNodes:r})=>{let a=Array.isArray(t)?t:[];return(0,at.jsxs)("div",{className:(0,hn.default)("sticky top-0 z-10 flex w-full flex-wrap items-center space-x-1 border-b bg-white/80 backdrop-blur-md p-2",o),children:[a.map(n=>n==="textStyle"||n==="link"||rt&&rt[n]?(0,at.jsx)("div",{className:"flex items-center",children:n==="textStyle"?(0,at.jsx)(vn,{editor:e}):n==="link"?(0,at.jsx)(un,{editor:e}):(0,at.jsx)(dn,{editor:e,icon:rt[n].icon,action:rt[n].action,isActive:rt[n].isActive,title:rt[n].title})},n):null),r]})};var ke=require("react/jsx-runtime"),Rn=({label:e,helpText:t,error:o,value:r="",onChange:a,optional:n,isRequired:s,extensions:c=[],editorClassName:m,wrapperClassName:l,controls:p,extraMenuNodes:u,placeholder:d})=>{let f=(0,wo.useEditor)({immediatelyRender:!1,content:r,editorProps:{attributes:{class:"px-3 h-40"}},extensions:[Nn.default,wn.default,xn.default,Cn.default.configure({openOnClick:!1,HTMLAttributes:{class:"text-blue-600 underline hover:text-blue-800"}}),...c],onFocus:({event:N})=>{N.preventDefault(),N.stopPropagation()},onUpdate:({editor:N})=>{let y=N.getHTML();a?.(N.isEmpty?"":y)}});return f?(0,ke.jsxs)("div",{className:(0,Co.default)("flex flex-col w-full",l),children:[e&&(0,ke.jsxs)("div",{className:"flex justify-between mb-1",children:[(0,ke.jsxs)("label",{className:"text-sm font-medium text-gray-900 flex items-center",htmlFor:"editor-id",children:[e,s&&(0,ke.jsx)("span",{className:"ml-1 text-red-500",children:"*"})]}),n&&(0,ke.jsx)("span",{className:"text-sm text-gray-400",children:"Optional"})]}),(0,ke.jsxs)("div",{className:(0,Co.default)("relative border-none rounded-md overflow-hidden",o?"ring-1 ring-red-300 focus-within:ring-red-500":"ring-1 ring-gray-300 focus-within:ring-primary-main"),children:[(0,ke.jsx)(yn,{editor:f,controls:p,extraNodes:u}),(0,ke.jsx)(wo.EditorContent,{editor:f,className:(0,Co.default)("overflow-y-auto p-3 h-full bg-white",m),placeholder:d})]}),o&&(0,ke.jsx)("p",{className:"mt-2 text-sm text-red-600",id:"editor-error",children:o}),t&&(0,ke.jsx)("p",{className:"mt-2 text-sm text-gray-500",id:"editor-helptext",children:t})]}):null};var zt=require("lucide-react"),K=k(require("react"));var S=require("react/jsx-runtime"),Pn={success:"bg-green-500/20 text-green-500 ring-1 ring-inset ring-current",failed:"bg-red-500/20 text-red-500 ring-1 ring-inset ring-current",pending:"bg-yellow-500/20 text-yellow-500 ring-1 ring-inset ring-current",default:"bg-gray-100 text-gray-700"},Ln=K.memo(({tag:e,onRemove:t})=>(0,S.jsxs)("p",{className:i("text-xs p-1.5 py-1 rounded-md flex items-center gap-1",Pn[e.variant??"default"]??Pn.default),children:[(0,S.jsx)("span",{children:e.label}),(0,S.jsx)("button",{type:"button",className:"pl-1",onClick:o=>{o.stopPropagation(),t()},children:(0,S.jsx)(zt.X,{size:12})})]}));Ln.displayName="SelectedChip";var kn=K.memo(({option:e,isChecked:t,onSelect:o,renderOption:r,disabled:a})=>(0,S.jsx)("article",{className:"cursor-pointer relative hover:bg-status-success-bg transition flex w-[calc(100%-0.375rem)] mx-auto rounded-md items-center py-1.5 px-2 text-sm outline-none focus:bg-status-success-bg dark:!text-[#DDDFE0] focus-visible:ring-1 focus-visible:ring-status-success-fill focus-visible:ring-offset-1",onClick:()=>!a&&o(e),children:(0,S.jsx)("div",{className:"w-full h-[20px] flex flex-row items-center dark:!text-white",children:(0,S.jsx)(Gt,{onSelect:()=>!a&&o(e),disabled:a,value:e.value,label:r?r(e,t):(0,S.jsx)("span",{children:e.label}),bodyClassName:"w-full",labelWrapperClassName:"w-full",checked:t})})}));kn.displayName="OptionItem";var Dn=({value:e,onChange:t,options:o=[],label:r,error:a,placeholder:n="Add tag...",description:s,showAsterisk:c,disabled:m,isLoading:l,allowCreate:p=!0,renderTag:u,renderOption:d,validateTag:f,onCreate:N,maxTags:y})=>{let[v,g]=K.useState(""),R=K.useRef(null),[x,b]=K.useState();K.useLayoutEffect(()=>{if(!R.current)return;let D=()=>b(R.current?.getBoundingClientRect().width);D();let G=new ResizeObserver(D);return G.observe(R.current),()=>G.disconnect()},[]);let h=K.useMemo(()=>new Set(e.map(D=>D.value)),[e]),C=K.useMemo(()=>{let D=v.trim().toLowerCase();return D?o.filter(G=>G.label.toLowerCase().includes(D)):o},[o,v]),w=K.useCallback(D=>t(e.filter(G=>G.value!==D)),[e,t]),A=K.useCallback(D=>{h.has(D.value)||y&&e.length>=y||t([...e,D])},[e,t,h,y]),P=K.useCallback(D=>{let G=D.trim();if(!G||!(f?f(G):!0))return;let or=o.find(rr=>rr.value.toLowerCase()===G.toLowerCase()||rr.label.toLowerCase()===G.toLowerCase());if(or){A(or),g("");return}p&&(A(N?.(G)??{value:G,label:G}),g(""))},[o,p,N,f,A]),V=D=>{D.key==="Enter"&&(D.preventDefault(),P(v)),D.key==="Backspace"&&!v&&e.length&&w(e[e.length-1].value)},He=!l&&p&&v.trim()&&!o.some(D=>D.value.toLowerCase()===v.trim().toLowerCase());return(0,S.jsxs)("div",{className:"relative space-y-1",children:[(0,S.jsx)(W,{showAsterisk:c,error:a,children:r}),(0,S.jsxs)(ae,{children:[(0,S.jsx)("div",{ref:R,children:(0,S.jsx)(j,{asChild:!0,disabled:m,children:(0,S.jsxs)("div",{id:"tags_trigger_container",className:i(oe({status:a?"error":"default"}),"cursor-pointer [&>svg]:shrink-0 h-auto min-h-10 flex items-center justify-between w-full gap-2 p-2"),children:[(0,S.jsxs)("div",{className:"w-full flex flex-row items-center gap-2 flex-wrap",children:[e.length>0&&e?.map(D=>{let G=()=>w(D.value);return u?(0,S.jsx)(K.Fragment,{children:(0,S.jsxs)("div",{className:"flex items-center",children:[u(D),(0,S.jsx)("button",{type:"button",className:"pl-1",onClick:tr=>{tr.stopPropagation(),G()},children:(0,S.jsx)(zt.X,{size:12})})]})},D.value):(0,S.jsx)(Ln,{tag:D,onRemove:G},D.value)}),(0,S.jsx)("input",{value:v,disabled:m,readOnly:!p||void 0,placeholder:n,className:"flex-1 min-w-[80px] !border-none !outline-none bg-transparent text-sm p-0 h-auto !focus-visible:ring-0 placeholder:text-[#79818C] placeholder:text-sm",onChange:D=>g(D.target.value),onKeyDown:V})]}),(0,S.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,S.jsx)("path",{d:"M16.5999 7.45825L11.1666 12.8916C10.5249 13.5333 9.4749 13.5333 8.83324 12.8916L3.3999 7.45825",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})})]})})}),(0,S.jsxs)(Q,{align:"start",className:"min-w-[200px] p-0 mt-1",style:{width:x?`${x}px`:void 0},children:[(0,S.jsx)("div",{className:"w-full",children:(0,S.jsx)("div",{className:i("w-full mt-1 h-10 flex items-center justify-start mb-[5px] px-2 pt-2",{"mt-3":a}),children:(0,S.jsx)(J,{error:a,leftNode:(0,S.jsx)(zt.Search,{className:"text-gray-400"}),value:v,placeholder:"Type to search or create",type:"text",disabled:l,rightNode:l?(0,S.jsx)(ye,{colour:"secondary"}):void 0,onChange:D=>g(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),P(v))}})})}),(0,S.jsxs)(ve,{viewPortClassName:"max-h-[225px] px",className:"pb-1 mt-3",children:[l&&(0,S.jsx)("div",{className:"py-7 flex justify-center",children:(0,S.jsx)(ye,{})}),!l&&C.map(D=>(0,S.jsx)(kn,{option:D,isChecked:h.has(D.value),disabled:D.disabled,onSelect:G=>h.has(G.value)?w(G.value):A(G),renderOption:d},D.value)),He&&(0,S.jsxs)("button",{type:"button",className:i("w-full text-left px-3 py-2 text-sm border-t border-t-gray-300 hover:bg-gray-50 mt-1",{"mt-3":a}),onClick:()=>P(v),children:['Create "',v.trim(),'"']})]})]})]}),s&&!a&&(0,S.jsx)("div",{className:"text-sm text-gray-500",children:s}),(0,S.jsx)(fe,{error:a})]})};0&&(module.exports={AmountAction,Banner,Button,CalendarInput,CopyableLabel,Country,CurrencySymbolMap,DateAction,DebouncedInput,DevBanner,Dialog,Drawer,DrawerClose,DrawerRoot,FeatureBanner,FilterPopover,FlagComponent,FormLabel,HasResourcePermission,Input,Loader,LocaleSelector,MultiSelect,MultiSelectTrigger,OTPInput,PageDataToolbar,Pagination,PasswordInput,PermissionsContext,PermissionsProvider,PhoneInput,Popover,PopoverContent,PopoverRoot,PopoverTrigger,RadioGroup,RadioGroupItem,RichTextEditor,ScrollArea,Select,Sidebar,Status,StringAction,Table,Tabs,TagsInput,TextOverflow,Textarea,Tooltip,TooltipContent,TooltipProvider,TooltipRoot,TooltipTrigger,buttonVariants,cn,useFilterStore,useHasPermission,usePermissions});
14
+ flex items-center justify-center text-current`),children:t?(0,Re.jsx)(Jo.motion.svg,{initial:{opacity:0,scale:.8},exit:{opacity:0},animate:{opacity:1,scale:1},transition:{duration:.1},width:"12",height:"2",viewBox:"0 0 12 2",fill:"none",children:(0,Re.jsx)("path",{d:"M1.9165 1H10.0832",stroke:c?"#B0B0B0":"#00D488",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):(0,Re.jsx)(Jo.motion.svg,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.1},exit:{opacity:0},width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:(0,Re.jsx)("path",{d:"M1 3.99996L3.66353 6.66349L9 1.33643",stroke:c?"#B0B0B0":"#00D488",strokeWidth:"1.06667",strokeLinecap:"round",strokeLinejoin:"round"})})})}),(a||m)&&(0,Re.jsxs)("div",{className:i("flex flex-col justify-start items-start text-base-700 dark:text-white peer-aria-checked:text-base-900 dark:peer-aria-checked:text-white peer-focus-visible:text-base-900 dark:peer-focus-visible:text-white peer-focus:text-base-900 dark:peer-focus:text-white peer-hover:text-base-900 dark:peer-hover:text-white",s),children:[(0,Re.jsx)("label",{htmlFor:r,className:i(n,"text-sm font-normal cursor-pointer disabled:cursor-not-allowed transition-colors",{"cursor-not-allowed opacity-50":c}),children:a}),m&&(0,Re.jsx)("p",{className:i("text-sm text-base-500",{"cursor-not-allowed opacity-50":c},l),children:m})]})]}));Gt.displayName=_t.Root.displayName;var L=require("react/jsx-runtime"),Ja=U.memo(({item:e,onDelete:t})=>(0,L.jsxs)("p",{className:"text-xs p-1.5 py-1 bg-gray-100 rounded-md flex items-center",children:[(0,L.jsx)("span",{children:e.label}),(0,L.jsx)("button",{type:"button",className:"pl-2",onClick:o=>{o.stopPropagation(),t(e)},children:(0,L.jsx)(qa.X,{size:12})})]}));Ja.displayName="SelectedChip";var xo=U.memo(({disabled:e,className:t,values:o,placeholder:r="",status:a,onDelete:n})=>(0,L.jsx)(j,{asChild:!0,disabled:e,children:(0,L.jsxs)("div",{className:i(oe({status:a}),"cursor-pointer [&>svg]:shrink-0 h-auto min-h-12 flex items-center justify-between w-full gap-2",t),children:[(0,L.jsx)("div",{className:"w-full flex flex-row items-center gap-2 flex-wrap",children:o.length?o.map(s=>(0,L.jsx)(Ja,{item:s,onDelete:n},s.value)):(0,L.jsx)("span",{className:"text-[#79818C] dark:text-[#959BA4]",children:r})}),(0,L.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,L.jsx)("path",{d:"M16.5999 7.45825L11.1666 12.8916C10.5249 13.5333 9.4749 13.5333 8.83324 12.8916L3.3999 7.45825",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})})]})}));xo.displayName="MultiSelectTrigger";var Qa=U.memo(({option:e,isChecked:t,onSelect:o,optionComponent:r})=>(0,L.jsx)("article",{className:"cursor-pointer relative hover:bg-status-success-bg transition flex w-[calc(100%-0.375rem)] mx-auto rounded-md items-center focus:dark:!text-[#DDDFE0] py-1.5 px-2 text-sm outline-none focus:bg-status-success-bg dark:!text-[#DDDFE0] focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus-visible:ring-1 focus-visible:ring-status-success-fill focus-visible:ring-offset-1 focus-visible:ring-offset-status-success-fill",onClick:()=>o(e),children:(0,L.jsx)("div",{className:"w-full h-[30px] flex flex-row items-center dark:!text-white",children:(0,L.jsx)(Gt,{onClick:a=>a.stopPropagation(),onSelect:()=>o(e),value:e.value,label:r?r(e):(0,L.jsx)("span",{children:e.label}),bodyClassName:"w-full",labelWrapperClassName:"w-full",labelClassName:i(r&&"w-full"),checked:t})})}));Qa.displayName="OptionItem";var en=({options:e,children:t,onChange:o,optionComponent:r,values:a,hideSearch:n,modal:s,placeholder:c,isLoading:m,showSelectedValues:l=!1,error:p,label:u,showAsterisk:d})=>{let[f,N]=U.useState(""),y=a,v=U.useMemo(()=>new Set(y.map(P=>P.value)),[y]),g=U.useMemo(()=>{if(!f)return e;let P=f.trim().toLowerCase();return e.filter(V=>V.label?.trim()?.toLowerCase()?.includes(P))},[e,f]),R=U.useCallback(P=>{let V=v.has(P.value);o(V?y.filter(He=>He.value!==P.value):[...y,P])},[y,v,o]),x=U.useRef(null),[b,h]=U.useState(void 0);U.useLayoutEffect(()=>{if(!x.current)return;let P=x.current,V=()=>{h(P.getBoundingClientRect().width)};V();let He=new ResizeObserver(()=>{V()});return He.observe(P),()=>He.disconnect()},[]);let C=U.useCallback(P=>{let V=y.filter(He=>He.value!==P.value);o(V)},[y,o]),w=U.useCallback(()=>{y.length===e.length?o([]):o(e)},[y.length,e,o]),A=U.useCallback(P=>{N(P.target.value)},[]);return(0,L.jsxs)("div",{className:"relative space-y-1",children:[(0,L.jsx)(W,{showAsterisk:d,error:p,children:u}),(0,L.jsxs)(ae,{modal:s,children:[(0,L.jsx)("div",{ref:x,children:t??(0,L.jsx)(xo,{values:y,placeholder:c??"Select",onDelete:C,className:"h-auto"})}),l&&(0,L.jsx)("div",{className:"flex py-2 gap-2 flex-wrap",children:y.map(P=>(0,L.jsx)("div",{className:"bg-gray-100 border text-black rounded-xl text-[10px] font-medium px-2 py-1",children:(0,L.jsx)("span",{children:P.label})},(0,Qo.v4)()))}),(0,L.jsxs)(Q,{portal:!s,align:"start",className:"min-w-[200px] p-0",style:{width:b?`${b}px`:void 0},children:[!n&&(0,L.jsx)("div",{className:"w-full px-4",children:(0,L.jsxs)("div",{className:"w-full h-[36px] px-1 flex items-center justify-start border-[0.5px] rounded-md border-[#D7D7D7] mb-[5px]",children:[m?(0,L.jsx)(ye,{}):(0,L.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,L.jsx)("path",{d:"M11.5 21C16.7467 21 21 16.7467 21 11.5C21 6.25329 16.7467 2 11.5 2C6.25329 2 2 6.25329 2 11.5C2 16.7467 6.25329 21 11.5 21Z",stroke:"#959595",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,L.jsx)("path",{d:"M22 22L20 20",stroke:"#959595",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,L.jsx)("input",{value:f,placeholder:"Search",type:"text",disabled:m,className:"oultine-0 focus-visible:outline-0 focus-visible:ring-0 ml-1 w-full !border-transparent placeholder:text-sm placeholder:font-normal dark:bg-transparent placeholder:text-[#959595] dark:placeholder:text-[#DDDFE0] focus:ring-0 focus:ring-offset-0 focus:bg-white dark:focus:bg-transparent dark:text-[#DDDFE0]",onChange:A})]})}),(0,L.jsxs)("div",{className:i("w-full h-[44px] px-2.5 flex items-center justify-between mb-[5px] border-[#D7D7D7] dark:border-[#5C636B]",n?"border-b-[0.5px]":"border-y-[0.5px]"),children:[(0,L.jsx)("button",{className:"text-sm text-primary-main font-normal",onClick:w,disabled:g.length<1||m,children:(0,L.jsxs)("span",{children:[y.length===e.length?"Unselect":"Select"," all"]})}),(0,L.jsxs)("p",{className:"text-sm text-[#959595] font-normal dark:text-[#DDDFE0]",children:[y.length," selected"]})]}),(0,L.jsxs)(ve,{viewPortClassName:"max-h-[225px]",className:"pb-1",children:[m&&(0,L.jsx)("div",{className:"py-7 flex justify-center",children:(0,L.jsx)(ye,{})}),!m&&g.map(P=>(0,L.jsx)(Qa,{option:P,isChecked:v.has(P.value),onSelect:R,optionComponent:r},(0,Qo.v4)()))]})]})]})]})};var Xe=k(require("@radix-ui/react-tabs"));var Pe=require("react/jsx-runtime");function tn({tabs:e,defaultValue:t,onChange:o}){return(0,Pe.jsxs)(Xe.Root,{defaultValue:t,onValueChange:o,className:"flex flex-col items-start justify-start gap-2.5",children:[(0,Pe.jsxs)(ve,{className:"w-full",children:[(0,Pe.jsx)(Yt,{className:"z-[1000]",orientation:"horizontal"}),(0,Pe.jsx)(Xe.List,{className:"my-2 border-b border-gray-300 items-center flex",children:e.map(r=>(0,Pe.jsxs)(Xe.Trigger,{className:"flex items-center gap-2 whitespace-nowrap rounded-t-md px-5 py-2 relative transition-all group hover:!bg-gray-200/50 dark:hover:!bg-gray-200/10 data-[state=active]:dark:hover:!bg-gray-200 data-[state=active]:hover:!bg-gray-200 data-[state=active]:bg-gray-200 before:absolute before:bottom-[0px] before:left-0 before:h-[2px] dark:before:h-[0px] before:w-full before:rounded-sm data-[state=active]:before:!bg-texts-50 before:content-['']",value:r?.key,children:[(0,Pe.jsx)("p",{className:"text-center text-sm leading-5 font-normal text-gray-500 group-data-[state=active]:font-medium group-data-[state=active]:text-gray-800",children:(0,Pe.jsx)("span",{children:r.title})}),r.count&&(0,Pe.jsx)("div",{className:"bg-gray-300 group-data-[state=active]:bg-texts-50 group-data-[state=active]:text-white text-texts-50 text-xs font-medium me-2 px-2.5 py-0.5 rounded-full",children:(0,Pe.jsx)("span",{children:r.count})})]},r?.key))})]}),e.map(r=>(0,Pe.jsx)(Xe.Content,{value:r?.key,className:"w-full",children:r.content},r?.key))]})}var Wt=require("react-icons/bi");var rn=require("class-variance-authority"),an=(0,rn.cva)("relative rounded-lg border px-4 py-4 text-sm",{variants:{variant:{default:"border-blue-200 bg-blue-50 text-blue-800",danger:"border-red-200 bg-red-50 text-red-800",success:"border-green-200 bg-green-50 text-green-800",pending:"border-yellow-200 bg-yellow-50 text-yellow-800"}},defaultVariants:{variant:"default"}}),on={default:{primary:"",outlined:""},danger:{primary:"bg-red-600 hover:bg-red-600/80 text-white border-red-600",outlined:"border-red-600 text-red-600 hover:bg-red-50"},success:{primary:"bg-green-600 hover:bg-green-600/80 text-white border-green-600",outlined:"border-green-600 text-green-600 hover:bg-green-50"},pending:{primary:"bg-yellow-600 hover:bg-yellow-600/80 text-white border-yellow-600",outlined:"border-yellow-600 text-yellow-600 hover:bg-yellow-50"}},nn=(e,t)=>(on[e]??on.default)[t];var ee=require("react/jsx-runtime"),sn=({title:e,message:t,variant:o="default",icon:r,action:a,dismissible:n=!1,onDismiss:s,isOpen:c=!0,align:m="start",classNames:l})=>{if(!c)return null;let p=a?.variant??"primary",u=nn(o??"default",p),d=m==="center";return(0,ee.jsxs)("div",{className:i(an({variant:o}),l?.root),children:[n&&(0,ee.jsx)("button",{type:"button",onClick:s,className:"absolute top-3 right-3 opacity-60 transition-opacity hover:opacity-100 sm:hidden","aria-label":"Dismiss",id:"feature_banner_dismiss_button_mobile",children:(0,ee.jsx)(Wt.BiX,{size:20})}),(0,ee.jsxs)("div",{className:i("flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",d&&"sm:items-center"),id:"feature_banner_container",children:[(0,ee.jsxs)("div",{className:i("flex items-start gap-3 pr-6 sm:pr-0",d&&"sm:items-center"),id:"feature_banner_content_wrapper",children:[(0,ee.jsx)("span",{className:i("shrink-0 mt-0.5",d&&"sm:mt-0",l?.icon),id:"feature_banner_icon",children:r??(0,ee.jsx)(Wt.BiInfoCircle,{size:18})}),(0,ee.jsxs)("div",{className:"min-w-0",id:"feature_banner_content",children:[(0,ee.jsx)("p",{className:i("font-semibold",l?.title),id:"feature_banner_title",children:e}),t&&(0,ee.jsx)("p",{id:"feature_banner_message",className:i("mt-1 text-sm opacity-90 break-words",l?.message),children:t})]})]}),(a||n)&&(0,ee.jsxs)("div",{className:i("flex flex-col items-end gap-3 sm:flex-row sm:items-center",d&&"sm:items-center"),id:"feature_banner_actions_wrapper",children:[a&&(0,ee.jsx)(ie,{variant:p,type:"button",onClick:a.onClick,className:i(u,l?.action),id:"feature_banner_action_button",children:a.label}),n&&(0,ee.jsx)("button",{type:"button",onClick:s,className:"hidden sm:flex opacity-60 transition-opacity hover:opacity-100","aria-label":"Dismiss",id:"feature_banner_dismiss_button",children:(0,ee.jsx)(Wt.BiX,{size:20})})]})]})]})};var xn=k(require("@tiptap/extension-font-family")),Cn=k(require("@tiptap/extension-link")),wn=k(require("@tiptap/extension-underline")),wo=require("@tiptap/react"),Nn=k(require("@tiptap/starter-kit")),Co=k(require("clsx"));var hn=k(require("clsx"));var me=require("lucide-react"),ln=require("react/jsx-runtime"),fi=()=>(0,ln.jsx)("span",{className:"text-sm font-semibold",children:"H1"}),rt={bold:{icon:me.Bold,action:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),title:"Bold"},italic:{icon:me.Italic,action:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),title:"Italic"},underline:{icon:me.Underline,action:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),title:"Underline"},strike:{icon:me.Strikethrough,action:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),title:"Strikethrough"},heading1:{icon:fi,action:e=>e.chain().focus().toggleHeading({level:1}).run(),isActive:e=>e.isActive("heading",{level:1}),title:"Heading 1"},bulletList:{icon:me.List,action:e=>e.chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),title:"Bullet List"},orderedList:{icon:me.ListOrdered,action:e=>e.chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),title:"Numbered List"},blockquote:{icon:me.Quote,action:e=>e.chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),title:"Quote"},textStyle:{icon:()=>null,action:()=>!0,isActive:()=>!1,title:"Text Style"},link:{icon:()=>null,action:()=>!0,isActive:()=>!1,title:"Link"}};var cn=k(require("clsx")),er=require("react/jsx-runtime"),dn=({editor:e,icon:t,action:o,isActive:r,disabled:a,title:n,className:s})=>(0,er.jsx)("button",{type:"button",onClick:()=>o(e),disabled:a??!e.can().chain().focus().run(),title:n,className:(0,cn.default)("p-2 rounded hover:bg-gray-100 transition",{"opacity-100 text-black":r(e),"opacity-40 text-gray-500":!r(e),"cursor-not-allowed":a},s),children:(0,er.jsx)(t,{width:18,height:18})});var pn=k(require("clsx")),mn=require("lucide-react"),Le=require("react");var te=require("react/jsx-runtime"),un=({editor:e})=>{let[t,o]=(0,Le.useState)(!1),[r,a]=(0,Le.useState)(""),n=(0,Le.useMemo)(()=>!e.state.selection.empty,[e.state.selection]),s=(0,Le.useMemo)(()=>e.isActive("link"),[e]),c=(0,Le.useMemo)(()=>n||s,[n,s]),m=(0,Le.useCallback)(()=>{r.trim()&&(e.chain().focus().extendMarkRange("link").setLink({href:r.trim()}).run(),o(!1),a(""))},[e,r]),l=(0,Le.useCallback)(()=>{e.chain().focus().extendMarkRange("link").unsetLink().run(),o(!1),a("")},[e]),p=(0,Le.useCallback)(d=>{let f=e.getAttributes("link").href;a(f||""),o(d)},[c,e]),u=(0,Le.useCallback)(d=>{d.key==="Enter"&&(d.preventDefault(),m()),d.key==="Escape"&&o(!1)},[m]);return(0,te.jsx)(be,{open:t,onOpenChange:p,trigger:(0,te.jsx)("div",{className:(0,pn.default)("",{"opacity-100 text-black":t,"opacity-40 text-gray-500":!t}),title:c?e.isActive("link")?"Edit link":"Add link":"Select text to add a link",children:(0,te.jsx)(mn.Link,{width:18,height:18})}),contentClassName:"w-80 p-4",align:"start",children:(0,te.jsx)("div",{className:"space-y-4",children:!n&&!s?(0,te.jsx)("div",{className:"text-sm text-gray-500 bg-gray-50 rounded p-3 border border-gray-200",children:"Please select some text in the editor to apply a link."}):(0,te.jsxs)(te.Fragment,{children:[(0,te.jsxs)("div",{children:[(0,te.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Link URL"}),(0,te.jsx)(J,{type:"url",value:r,onChange:d=>a(d.target.value),placeholder:"https://example.com",autoFocus:!0,onKeyDown:u})]}),(0,te.jsxs)("div",{className:"flex justify-between space-x-2",children:[(0,te.jsx)(ie,{type:"button",onClick:m,disabled:!r.trim(),variant:"primary",size:"sm",className:"flex-1",children:e.isActive("link")?"Update Link":"Add Link"}),e.isActive("link")&&(0,te.jsx)(ie,{type:"button",onClick:l,variant:"neutral",size:"sm",className:"px-3 py-2 bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200 transition text-sm font-medium",children:"Remove"})]})]})})})};var fn=k(require("clsx")),gn=require("lucide-react"),bn=require("react");var Me=require("react/jsx-runtime"),vn=({editor:e})=>{let[t,o]=(0,bn.useState)(!1),r=()=>e.isActive("heading",{level:1})?"Heading 1":e.isActive("heading",{level:2})?"Heading 2":e.isActive("heading",{level:3})?"Heading 3":"Normal",a=[{label:"Normal",action:()=>e.chain().focus().setParagraph().run(),isActive:!e.isActive("heading")},{label:"Heading 1",action:()=>e.chain().focus().toggleHeading({level:1}).run(),isActive:e.isActive("heading",{level:1})},{label:"Heading 2",action:()=>e.chain().focus().toggleHeading({level:2}).run(),isActive:e.isActive("heading",{level:2})},{label:"Heading 3",action:()=>e.chain().focus().toggleHeading({level:3}).run(),isActive:e.isActive("heading",{level:3})}];return(0,Me.jsx)(be,{open:t,onOpenChange:o,trigger:(0,Me.jsxs)("button",{type:"button",className:"flex items-center space-x-1 p-2 rounded hover:bg-gray-100 transition min-w-[110px] justify-between text-gray-600",children:[(0,Me.jsx)("span",{className:"text-base ",children:r()}),(0,Me.jsx)(gn.ChevronDown,{width:16,height:16})]}),contentClassName:"w-48 w-auto- p-1",align:"start",children:(0,Me.jsx)("div",{className:"space-y-1",children:a.map((n,s)=>(0,Me.jsxs)("div",{children:[s===1&&(0,Me.jsx)("div",{className:"border-b border-gray-200 my-1"}),(0,Me.jsx)("button",{type:"button",onClick:()=>{n.action(),o(!1)},className:(0,fn.default)("w-full text-left px-3 py-2 rounded text-sm hover:bg-gray-100 transition",{"bg-gray-100 font-medium":n.isActive}),children:n.label})]},n.label))})})};var at=require("react/jsx-runtime"),yn=({editor:e,controls:t=["textStyle","bold","italic","underline","strike","link","bulletList","orderedList","blockquote"],className:o,extraNodes:r})=>{let a=Array.isArray(t)?t:[];return(0,at.jsxs)("div",{className:(0,hn.default)("sticky top-0 z-10 flex w-full flex-wrap items-center space-x-1 border-b bg-white/80 backdrop-blur-md p-2",o),children:[a.map(n=>n==="textStyle"||n==="link"||rt&&rt[n]?(0,at.jsx)("div",{className:"flex items-center",children:n==="textStyle"?(0,at.jsx)(vn,{editor:e}):n==="link"?(0,at.jsx)(un,{editor:e}):(0,at.jsx)(dn,{editor:e,icon:rt[n].icon,action:rt[n].action,isActive:rt[n].isActive,title:rt[n].title})},n):null),r]})};var ke=require("react/jsx-runtime"),Rn=({label:e,helpText:t,error:o,value:r="",onChange:a,optional:n,isRequired:s,extensions:c=[],editorClassName:m,wrapperClassName:l,controls:p,extraMenuNodes:u,placeholder:d})=>{let f=(0,wo.useEditor)({immediatelyRender:!1,content:r,editorProps:{attributes:{class:"px-3 h-40"}},extensions:[Nn.default,wn.default,xn.default,Cn.default.configure({openOnClick:!1,HTMLAttributes:{class:"text-blue-600 underline hover:text-blue-800"}}),...c],onFocus:({event:N})=>{N.preventDefault(),N.stopPropagation()},onUpdate:({editor:N})=>{let y=N.getHTML();a?.(N.isEmpty?"":y)}});return f?(0,ke.jsxs)("div",{className:(0,Co.default)("flex flex-col w-full",l),children:[e&&(0,ke.jsxs)("div",{className:"flex justify-between mb-1",children:[(0,ke.jsxs)("label",{className:"text-sm font-medium text-gray-900 flex items-center",htmlFor:"editor-id",children:[e,s&&(0,ke.jsx)("span",{className:"ml-1 text-red-500",children:"*"})]}),n&&(0,ke.jsx)("span",{className:"text-sm text-gray-400",children:"Optional"})]}),(0,ke.jsxs)("div",{className:(0,Co.default)("relative border-none rounded-md overflow-hidden",o?"ring-1 ring-red-300 focus-within:ring-red-500":"ring-1 ring-gray-300 focus-within:ring-primary-main"),children:[(0,ke.jsx)(yn,{editor:f,controls:p,extraNodes:u}),(0,ke.jsx)(wo.EditorContent,{editor:f,className:(0,Co.default)("overflow-y-auto p-3 h-full bg-white",m),placeholder:d})]}),o&&(0,ke.jsx)("p",{className:"mt-2 text-sm text-red-600",id:"editor-error",children:o}),t&&(0,ke.jsx)("p",{className:"mt-2 text-sm text-gray-500",id:"editor-helptext",children:t})]}):null};var zt=require("lucide-react"),K=k(require("react"));var S=require("react/jsx-runtime"),Pn={success:"bg-green-500/20 text-green-500 ring-1 ring-inset ring-current",failed:"bg-red-500/20 text-red-500 ring-1 ring-inset ring-current",pending:"bg-yellow-500/20 text-yellow-500 ring-1 ring-inset ring-current",default:"bg-gray-100 text-gray-700"},Ln=K.memo(({tag:e,onRemove:t})=>(0,S.jsxs)("p",{className:i("text-xs p-1.5 py-1 rounded-md flex items-center gap-1",Pn[e.variant??"default"]??Pn.default),children:[(0,S.jsx)("span",{children:e.label}),(0,S.jsx)("button",{type:"button",className:"pl-1",onClick:o=>{o.stopPropagation(),t()},children:(0,S.jsx)(zt.X,{size:12})})]}));Ln.displayName="SelectedChip";var kn=K.memo(({option:e,isChecked:t,onSelect:o,renderOption:r,disabled:a})=>(0,S.jsx)("article",{className:"cursor-pointer relative hover:bg-status-success-bg transition flex w-[calc(100%-0.375rem)] mx-auto rounded-md items-center py-1.5 px-2 text-sm outline-none focus:bg-status-success-bg dark:!text-[#DDDFE0] focus-visible:ring-1 focus-visible:ring-status-success-fill focus-visible:ring-offset-1",onClick:()=>!a&&o(e),children:(0,S.jsx)("div",{className:"w-full h-[20px] flex flex-row items-center dark:!text-white",children:(0,S.jsx)(Gt,{onSelect:()=>!a&&o(e),disabled:a,value:e.value,label:r?r(e,t):(0,S.jsx)("span",{children:e.label}),bodyClassName:"w-full",labelWrapperClassName:"w-full",checked:t})})}));kn.displayName="OptionItem";var Dn=({value:e,onChange:t,options:o=[],label:r,error:a,placeholder:n="Add tag...",description:s,showAsterisk:c,disabled:m,isLoading:l,allowCreate:p=!0,renderTag:u,renderOption:d,validateTag:f,onCreate:N,maxTags:y})=>{let[v,g]=K.useState(""),R=K.useRef(null),[x,b]=K.useState();K.useLayoutEffect(()=>{if(!R.current)return;let D=()=>b(R.current?.getBoundingClientRect().width);D();let G=new ResizeObserver(D);return G.observe(R.current),()=>G.disconnect()},[]);let h=K.useMemo(()=>new Set(e.map(D=>D.value)),[e]),C=K.useMemo(()=>{let D=v.trim().toLowerCase();return D?o.filter(G=>G.label.toLowerCase().includes(D)):o},[o,v]),w=K.useCallback(D=>t(e.filter(G=>G.value!==D)),[e,t]),A=K.useCallback(D=>{h.has(D.value)||y&&e.length>=y||t([...e,D])},[e,t,h,y]),P=K.useCallback(D=>{let G=D.trim();if(!G||!(f?f(G):!0))return;let or=o.find(rr=>rr.value.toLowerCase()===G.toLowerCase()||rr.label.toLowerCase()===G.toLowerCase());if(or){A(or),g("");return}p&&(A(N?.(G)??{value:G,label:G}),g(""))},[o,p,N,f,A]),V=D=>{D.key==="Enter"&&(D.preventDefault(),P(v)),D.key==="Backspace"&&!v&&e.length&&w(e[e.length-1].value)},He=!l&&p&&v.trim()&&!o.some(D=>D.value.toLowerCase()===v.trim().toLowerCase());return(0,S.jsxs)("div",{className:"relative space-y-1",children:[(0,S.jsx)(W,{showAsterisk:c,error:a,children:r}),(0,S.jsxs)(ae,{children:[(0,S.jsx)("div",{ref:R,children:(0,S.jsx)(j,{asChild:!0,disabled:m,children:(0,S.jsxs)("div",{id:"tags_trigger_container",className:i(oe({status:a?"error":"default"}),"cursor-pointer [&>svg]:shrink-0 h-auto min-h-10 flex items-center justify-between w-full gap-2 p-2"),children:[(0,S.jsxs)("div",{className:"w-full flex flex-row items-center gap-2 flex-wrap",children:[e.length>0&&e?.map(D=>{let G=()=>w(D.value);return u?(0,S.jsx)(K.Fragment,{children:(0,S.jsxs)("div",{className:"flex items-center",children:[u(D),(0,S.jsx)("button",{type:"button",className:"pl-1",onClick:tr=>{tr.stopPropagation(),G()},children:(0,S.jsx)(zt.X,{size:12})})]})},D.value):(0,S.jsx)(Ln,{tag:D,onRemove:G},D.value)}),(0,S.jsx)("input",{value:v,disabled:m,readOnly:!p||void 0,placeholder:n,className:"flex-1 min-w-[80px] !border-none !outline-none bg-transparent text-sm p-0 h-auto !focus-visible:ring-0 placeholder:text-[#79818C] placeholder:text-sm",onChange:D=>g(D.target.value),onKeyDown:V})]}),(0,S.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,S.jsx)("path",{d:"M16.5999 7.45825L11.1666 12.8916C10.5249 13.5333 9.4749 13.5333 8.83324 12.8916L3.3999 7.45825",stroke:"currentColor",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})})]})})}),(0,S.jsxs)(Q,{align:"start",className:"min-w-[200px] p-0 mt-1",style:{width:x?`${x}px`:void 0},children:[(0,S.jsx)("div",{className:"w-full",children:(0,S.jsx)("div",{className:i("w-full mt-1 h-10 flex items-center justify-start mb-[5px] px-2 pt-2",{"mt-3":a}),children:(0,S.jsx)(J,{error:a,leftNode:(0,S.jsx)(zt.Search,{className:"text-gray-400"}),value:v,placeholder:"Type to search or create",type:"text",disabled:l,rightNode:l?(0,S.jsx)(ye,{colour:"secondary"}):void 0,onChange:D=>g(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),P(v))}})})}),(0,S.jsxs)(ve,{viewPortClassName:"max-h-[225px] px",className:"pb-1 mt-3",children:[l&&(0,S.jsx)("div",{className:"py-7 flex justify-center",children:(0,S.jsx)(ye,{})}),!l&&C.map(D=>(0,S.jsx)(kn,{option:D,isChecked:h.has(D.value),disabled:D.disabled,onSelect:G=>h.has(G.value)?w(G.value):A(G),renderOption:d},D.value)),He&&(0,S.jsxs)("button",{type:"button",className:i("w-full text-left px-3 py-2 text-sm border-t border-t-gray-300 hover:bg-gray-50 mt-1",{"mt-3":a}),onClick:()=>P(v),children:['Create "',v.trim(),'"']})]})]})]}),s&&!a&&(0,S.jsx)("div",{className:"text-sm text-gray-500",children:s}),(0,S.jsx)(fe,{error:a})]})};0&&(module.exports={AmountAction,Banner,Button,CalendarInput,CopyableLabel,Country,CurrencySymbolMap,DateAction,DebouncedInput,DevBanner,Dialog,Drawer,DrawerClose,DrawerRoot,FeatureBanner,FilterPopover,FlagComponent,FormLabel,HasResourcePermission,Input,Loader,LocaleSelector,MultiSelect,MultiSelectTrigger,OTPInput,PageDataToolbar,Pagination,PasswordInput,PermissionsContext,PermissionsProvider,PhoneInput,Popover,PopoverContent,PopoverRoot,PopoverTrigger,RadioGroup,RadioGroupItem,RichTextEditor,ScrollArea,Select,Sidebar,Status,StringAction,Table,Tabs,TagsInput,TextOverflow,Textarea,Tooltip,TooltipContent,TooltipProvider,TooltipRoot,TooltipTrigger,buttonVariants,cn,useFilterStore,useHasPermission,usePermissions});
15
15
  //# sourceMappingURL=index.js.map