plainframe-ui 0.1.55 → 0.1.56
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 +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import de,{forwardRef,createContext,useId,useMemo,useState,useCallback,useRef,useEffect,useContext,isValidElement,cloneElement,Children,memo,useSyncExternalStore,useLayoutEffect}from'react';import {css,keyframes,useTheme,ThemeProvider,Global}from'@emotion/react';import {jsxs,jsx,Fragment}from'@emotion/react/jsx-runtime';import {ChevronDown,CircleAlert,TriangleAlert,CircleCheckBig,Info,X,Eye,EyeOff,ChevronRight,Check,ChevronFirst,ChevronLeft,ChevronLast,ChevronsUpDown}from'lucide-react';import {useFloating,offset,flip,shift,autoUpdate,useDismiss,useRole,useInteractions,FloatingPortal,size,arrow,useHover,safePolygon,useFocus}from'@floating-ui/react';import {motion,AnimatePresence,useAnimationControls}from'framer-motion';import {createRoot}from'react-dom/client';var xa={xxs:"0.15rem",xs:"0.25rem",sm:"0.5rem",md:"0.75rem",lg:"1rem",xl:"1.5rem"},va={xxs:"0.3rem",xs:"0.4rem",sm:"0.6rem",md:"0.7rem",lg:"1rem",xl:"2rem",full:"9999px"},Ca={sm:32,md:36,lg:40,border:"1px"},Ra={fonts:{sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},sizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px","6xl":"60px"}},jr={0:"#ffffff",50:"#f9f9f9",100:"#f5f5f5",200:"#eeeeee",300:"#e5e5e5",400:"#d0d0d0ff",500:"#b3b3b3",600:"#737373",700:"#4a4a4a",800:"#2b2b2b",900:"#111111"},Vr={0:"#080808",50:"#121212",100:"#1a1a1a",200:"#222222",300:"#2b2b2b",400:"#333333",500:"#444444",600:"#6e6e6e",700:"#a6a6a6",800:"#e5e5e5",900:"#ffffff"},ha={mono:{0:"#FFFFFF",50:"#FAFAFA",100:"#F2F2F2",200:"#E6E6E6",300:"#D1D1D1",400:"#8A8A8A",500:"#2A2A2A",600:"#1A1A1A",700:"#121212",800:"#0B0B0B",900:"#000000"},danger:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},success:{0:"#FFFFFF",50:"#EEFFF3",100:"#D7FFE8",200:"#d6ffe7ff",300:"#8EF5BB",400:"#5BEA9A",500:"#0FD45D",600:"#00C853",700:"#109C47",800:"#0E8242",900:"#064D2B"},warning:{0:"#FFFFFF",50:"#FFF7EB",100:"#FFEFC6",200:"#FFE094",300:"#FFC552",400:"#FFB83A",500:"#FFA414",600:"#FF9F0A",700:"#D97500",800:"#AF5E00",900:"#6E3600"},info:{0:"#FFFFFF",50:"#ECFAFF",100:"#D2F2FF",200:"#AEE6FF",300:"#84D6FF",400:"#4BC1FF",500:"#2B9FFF",600:"#1093FF",700:"#0077C0",800:"#0066A8",900:"#083B61"},red:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},amber:{0:"#FFFFFF",50:"#FFF3EA",100:"#FFE3D1",200:"#FFC7A6",300:"#FFAC80",400:"#FF874D",500:"#FF6C1F",600:"#FF5A00",700:"#D24500",800:"#B63C00",900:"#6F2300"},orange:{0:"#FFFFFF",50:"#FFF4EB",100:"#FFE6CC",200:"#FFCE9E",300:"#FFAE66",400:"#FF8B33",500:"#FF7310",600:"#FF6B00",700:"#CC4400",800:"#AF3F00",900:"#6B2400"},yellow:{0:"#FFFFFF",50:"#FFFAE6",100:"#FFF2BF",200:"#FFE780",300:"#FFDB3D",400:"#FFD000",500:"#FFE03F",600:"#FFD60A",700:"#B38600",800:"#8E6D00",900:"#534300"},lime:{0:"#FFFFFF",50:"#F6FFE8",100:"#E7FFC2",200:"#CCFF83",300:"#A8FA3D",400:"#8BE11C",500:"#87DE10",600:"#7ACC00",700:"#4A8C00",800:"#3B7100",900:"#224300"},green:{0:"#FFFFFF",50:"#F0FFF5",100:"#DBFFE9",200:"#BDF7CF",300:"#8FE7A8",400:"#5BD57D",500:"#1DAE52",600:"#16A34A",700:"#168A40",800:"#136A34",900:"#0B3D1F"},teal:{0:"#FFFFFF",50:"#EDFFFB",100:"#D2FFF4",200:"#A6FAEA",300:"#74EEDC",400:"#41DECB",500:"#00CFAA",600:"#00BFA5",700:"#0C8C7F",800:"#0B786C",900:"#084741"},cyan:{0:"#FFFFFF",50:"#EFFFFF",100:"#D4FCFF",200:"#AFF5FD",300:"#7FE8F6",400:"#45D3EB",500:"#09C6E7",600:"#00B8D9",700:"#0A7C92",800:"#0B6E81",900:"#0A4250"},blue:{0:"#FFFFFF",50:"#EFF6FF",100:"#DBE8FF",200:"#B8D3FF",300:"#90BAFF",400:"#5E97FF",500:"#406FFF",600:"#2F66FF",700:"#2452DE",800:"#2248C8",900:"#172C80"},indigo:{0:"#FFFFFF",50:"#EEF2FF",100:"#E0E6FF",200:"#C5D0FF",300:"#A3B5FF",400:"#879CFF",500:"#707AF5",600:"#5A63F3",700:"#4951DA",800:"#3E40BF",900:"#2A2A82"},purple:{0:"#FFFFFF",50:"#F4F0FF",100:"#E8DBFF",200:"#D2B8FF",300:"#B590FF",400:"#996AF5",500:"#7A52F1",600:"#6B3CF0",700:"#592FBE",800:"#4D27A3",900:"#2F1767"},magenta:{0:"#FFFFFF",50:"#FFF0FE",100:"#FCE0FF",200:"#F7BCFF",300:"#F393FD",400:"#E85FF8",500:"#C645D6",600:"#C026D3",700:"#951CAB",800:"#801790",900:"#4C0C59"},pink:{0:"#FFFFFF",50:"#FFF0F7",100:"#FFE0F0",200:"#FFC0E2",300:"#FF9ACE",400:"#FF6CB3",500:"#ED5CA2",600:"#EC4899",700:"#AB236F",800:"#96205D",900:"#5A1238"},rose:{0:"#FFFFFF",50:"#FFF0F3",100:"#FFE1E9",200:"#FFC1D3",300:"#FF98B8",400:"#FF6B98",500:"#EE4278",600:"#E52E69",700:"#B52156",800:"#991A43",900:"#5B0F28"}},ya={mono:{0:"#0B0B0C",50:"#0F0F10",100:"#151515",200:"#1B1B1C",300:"#232323",400:"#DADADA",500:"#E0E0E0",600:"#EDEDED",700:"#F5F5F5",800:"#FCFCFC",900:"#FFFFFF"},danger:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},success:{0:"#06150B",50:"#0A1B10",100:"#0E2416",200:"#11301C",300:"#143B21",400:"#16502C",500:"#22D85A",600:"#00C853",700:"#2FE976",800:"#7FF1AE",900:"#D6FADF"},warning:{0:"#150E05",50:"#1C1408",100:"#261B0B",200:"#31240E",300:"#3D2C12",400:"#583C16",500:"#FFA61A",600:"#FF9F0A",700:"#FFB347",800:"#FFD089",900:"#FFF0C9"},info:{0:"#07131E",50:"#0A1926",100:"#0E2233",200:"#112C44",300:"#143654",400:"#184A78",500:"#1C9CFF",600:"#1093FF",700:"#4FB2FF",800:"#9DD2FF",900:"#D8ECFF"},red:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},amber:{0:"#150D07",50:"#1C120A",100:"#26180E",200:"#311F12",300:"#3E2716",400:"#59361C",500:"#FF6A1E",600:"#FF5A00",700:"#FF8747",800:"#FFB98A",900:"#FFE2CC"},orange:{0:"#140D07",50:"#1B120A",100:"#25190D",200:"#302010",300:"#3B2813",400:"#553817",500:"#FF7F22",600:"#FF6B00",700:"#FF9247",800:"#FFBE8A",900:"#FFE1CC"},yellow:{0:"#141303",50:"#1B1906",100:"#25210A",200:"#2F2A0D",300:"#383212",400:"#524717",500:"#FFE042",600:"#FFD60A",700:"#FFE457",800:"#FFF194",900:"#FFF8CF"},lime:{0:"#0C1306",50:"#101A08",100:"#14210B",200:"#1A2B0F",300:"#203614",400:"#2A4A1A",500:"#86E21A",600:"#7ACC00",700:"#9EEA3B",800:"#C9F57F",900:"#EAFCC4"},green:{0:"#07140C",50:"#0B1B11",100:"#0E2416",200:"#112C1B",300:"#143722",400:"#17502F",500:"#20BF55",600:"#16A34A",700:"#39C964",800:"#86E5A5",900:"#D4F6E1"},teal:{0:"#081815",50:"#0B1F1C",100:"#0F2824",200:"#13322E",300:"#173E39",400:"#14584F",500:"#14CEBD",600:"#00BFA5",700:"#2CD6C6",800:"#7FEAE3",900:"#CFF7F3"},cyan:{0:"#07171C",50:"#0A1E24",100:"#0E2830",200:"#11333D",300:"#153E4A",400:"#165B6A",500:"#20CBE6",600:"#00B8D9",700:"#3FD2E9",800:"#93EBF6",900:"#D5F7FC"},blue:{0:"#081421",50:"#0A1829",100:"#0E2139",200:"#112A4B",300:"#153660",400:"#184A86",500:"#4A78FF",600:"#2F66FF",700:"#5A8AFF",800:"#A7C3FF",900:"#D9E7FF"},indigo:{0:"#0B1023",50:"#0E162C",100:"#141F3F",200:"#1C2A56",300:"#24366E",400:"#2F4894",500:"#707CF6",600:"#5A63F3",700:"#7D86FF",800:"#B5C0FF",900:"#E0E6FF"},purple:{0:"#100B1F",50:"#130E26",100:"#1A1638",200:"#231F4E",300:"#2E2A67",400:"#3C388D",500:"#8256F3",600:"#6B3CF0",700:"#8B66FA",800:"#C1B0FF",900:"#E4DCFF"},magenta:{0:"#160A18",50:"#1C0C21",100:"#25102E",200:"#321544",300:"#421A5C",400:"#58247C",500:"#CB44DB",600:"#C026D3",700:"#D960EB",800:"#F0B5FA",900:"#F9E4FE"},pink:{0:"#170911",50:"#1D0C18",100:"#271220",200:"#371830",300:"#462042",400:"#622C5C",500:"#F067AE",600:"#EC4899",700:"#F679BB",800:"#FFC2E1",900:"#FFE6F3"},rose:{0:"#17090E",50:"#1F0C13",100:"#2A121B",200:"#3A1B28",300:"#4B2636",400:"#673449",500:"#EE457B",600:"#E52E69",700:"#FF558A",800:"#FFA9C6",900:"#FFE0EA"}},Ta=e=>({...e,red:e.danger,error:e.danger,green:e.success,success:e.success,orange:e.orange,amber:e.amber,yellow:e.yellow,lime:e.lime,teal:e.teal,cyan:e.cyan,blue:e.blue,indigo:e.indigo,purple:e.purple,violet:e.purple,magenta:e.magenta,fuchsia:e.magenta,pink:e.pink,rose:e.rose,gray:e.mono,grey:e.mono,neutral:e.mono}),Jn=(e,t)=>e==="light"?{appBg:t[0],panelBg:t[0],subtleBg:t[100],panelHover:t[50],subtleHover:t[200],overlayBg:"linear-gradient(rgba(0,0,0,.15),rgba(0,0,0,.525))",border:t[300]}:{appBg:t[0],panelBg:t[0],subtleBg:t[50],panelHover:t[50],subtleHover:t[100],overlayBg:"linear-gradient(rgba(0,0,0,.35),rgba(0,0,0,.75))",border:t[200]},Ko=e=>({primary:e[900],secondary:e[600],muted:e[500],onColors:{}}),_o=e=>({primary:e[900],secondary:e[700],muted:e[600],onColors:{}}),yc=["danger","success","warning","info","amber","orange","yellow","lime","green","teal","cyan","blue","indigo","purple","magenta","pink","rose"],wa=e=>yc.reduce((t,n)=>(t[n]=e[n]??"#FFFFFF",t),{}),jo={spacing:xa,radius:va,componentHeights:Ca,typography:Ra,neutral:jr,palette:{...Ta(ha),primary:ha.mono},surface:Jn("light",jr),text:{...Ko(jr),onColors:{primary:"#FFFFFF",...wa({yellow:"#000000"})}}},Ea={spacing:xa,radius:va,componentHeights:Ca,typography:Ra,neutral:Vr,palette:{...Ta(ya),primary:ya.mono},surface:Jn("dark",Vr),text:{..._o(Vr),onColors:{primary:"#FFFFFF",...wa({yellow:"#000000"})}}};function Ia(e){let t=e,n=new Set;return {get:()=>t,set:o=>{t=o,n.forEach(r=>r());},subscribe:o=>(n.add(o),()=>{n.delete(o);})}}var Aa={destructive:"danger",error:"danger",violet:"purple",fuchsia:"magenta",gray:"mono",grey:"mono",neutral:"mono"},ut=e=>Aa[e]??e;function nn(e){let t={...e};return Object.entries(Aa).forEach(([n,o])=>{t[o]!=null&&t[n]==null&&(t[n]=t[o]);}),t}var qr=de.createContext(null),Fa=de.createContext(null),Gr=de.createContext({setMode:e=>{},toggleMode:()=>{}}),Pa=de.createContext({setPrimary:e=>{}}),Da=de.createContext(null);function j(){return useTheme()}function Cc(){let e=de.useContext(qr);if(!e)throw new Error("useColorMode must be used within ThemeProvider");let t=de.useContext(Gr),[n,o]=de.useState(()=>e.get());return de.useEffect(()=>{o(e.get());let r=e.subscribe(()=>o(e.get()));return ()=>{r();}},[e]),{mode:n,setMode:t.setMode,toggleMode:t.toggleMode}}function Rc(){let e=de.useContext(Fa);if(!e)throw new Error("usePrimary must be used within ThemeProvider");let t=de.useContext(Pa),[n,o]=de.useState(()=>e.get());return de.useEffect(()=>{o(e.get());let r=e.subscribe(()=>o(e.get()));return ()=>{r();}},[e]),{primary:n,setPrimary:t.setPrimary}}function cb(e){let t=de.useContext(Da);if(!t)throw new Error("usePrimitives must be used within ThemeProvider");let{mode:n}=Cc(),{primary:o}=Rc(),r=de.useMemo(()=>{let s=n==="light"?t.light:t.dark,a=s.palette[ut(o)]??s.palette.primary,c=nn(s.text.onColors)[ut(o)]??Xr(a[600]);return {...s,palette:{...s.palette,primary:a},text:{...s.text,onColors:{...nn(s.text.onColors),primary:c,[ut(o)]:c,[o]:c}}}},[t,n,o]);return e?e(r):r}function Vo(e,t){if(!t)return e;let n={...e.palette};if(t.palette)for(let o of Object.keys(t.palette)){let r=t.palette[o];r&&(n[o]={...e.palette[o]??{},...r});}return {...e,spacing:{...e.spacing,...t.spacing??{}},radius:{...e.radius,...t.radius??{}},componentHeights:{...e.componentHeights,...t.componentHeights??{}},typography:{fonts:{...e.typography.fonts,...t.typography?.fonts??{}},sizes:{...e.typography.sizes,...t.typography?.sizes??{}}},palette:n,neutral:t.neutral?{...e.neutral,...t.neutral}:e.neutral,surface:{...e.surface,...t.surface??{}},text:{...e.text,...t.text??{},onColors:{...e.text.onColors,...t.text?.onColors??{}}}}}function Xr(e){let t=e.replace("#",""),n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16),s=c=>{let i=c/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)};return .2126*s(n)+.7152*s(o)+.0722*s(r)>.53?"#000":"#FFF"}function ka(e,t){if(e.current)return;let n=document.createElement("style");n.id=t,document.head.appendChild(n),e.current=n;}function Ur(e){return e?`[data-pfui-scope="${e}"]`:":root"}function Yr(e,t,n){let o=[],r=i=>i.startsWith("var(")?i.replace(/^var\([^,]+,\s*/,"").replace(/\)\s*$/,"").trim():i;o.push(`--pf-font-sans:${r(e.typography.fonts.sans)};`),o.push(`--pf-font-mono:${r(e.typography.fonts.mono)};`),o.push(`--pf-text-primary:${e.text.primary};`),o.push(`--pf-text-secondary:${e.text.secondary};`),o.push(`--pf-text-muted:${e.text.muted};`),Object.entries(e.text.onColors).forEach(([i,l])=>o.push(`--pf-text-on-${i}:${l};`)),Object.entries(e.spacing).forEach(([i,l])=>o.push(`--pf-space-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.radius).forEach(([i,l])=>o.push(`--pf-radius-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.typography.sizes).forEach(([i,l])=>o.push(`--pf-fontSize-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.componentHeights).forEach(([i,l])=>o.push(`--pf-cmph-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.neutral).forEach(([i,l])=>o.push(`--pf-neutral-${i}:${l};`)),o.push(`--pf-surface-appBg:${e.surface.appBg};`),o.push(`--pf-surface-panelBg:${e.surface.panelBg};`),o.push(`--pf-surface-subtleBg:${e.surface.subtleBg};`),o.push(`--pf-surface-panelHover:${e.surface.panelHover};`),o.push(`--pf-surface-subtleHover:${e.surface.subtleHover};`),o.push(`--pf-surface-overlayBg:${e.surface.overlayBg};`),o.push(`--pf-surface-border:${e.surface.border};`),o.push("--pf-focus-main:var(--pf-neutral-400);"),o.push(n==="dark"?"--pf-focus-soft:var(--pf-neutral-200);":"--pf-focus-soft:var(--pf-neutral-300);"),Object.entries(e.palette).forEach(([i,l])=>{Object.entries(l).forEach(([u,m])=>{o.push(`--pf-palette-${i}-${u}:${m};`);});});let s="300";Object.keys(e.palette).forEach(i=>{o.push(`--pf-focus-${i}-main: var(--pf-palette-${i}-${s});`),o.push(`--pf-focus-${i}-soft: transparent;`);});let a=t;[0,50,100,200,300,400,500,600,700,800,900].forEach(i=>o.push(`--pf-primary-${i}:var(--pf-palette-${a}-${i});`)),o.push("--pf-focus-accent-main:var(--pf-primary-300);"),o.push("--pf-focus-accent-soft: transparent;");let c=e.text.onColors[a]??(()=>{let l=(e.palette[a]?.[600]??e.palette.primary[600]).replace("#",""),u=parseInt(l.slice(0,2),16),m=parseInt(l.slice(2,4),16),h=parseInt(l.slice(4,6),16),f=k=>{let y=k/255;return y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4)};return .2126*f(u)+.7152*f(m)+.0722*f(h)>.53?"#000":"#FFF"})();return o.push(`--pf-text-on-primary:${c};`),o.push(`color-scheme:${n==="dark"?"dark":"light"};`),o}function Uo(e,t,n){return Yr(e,t,n).join("")}var Jr=e=>{for(let t=e.style.length-1;t>=0;t--){let n=e.style.item(t);n&&n.startsWith("--pf-")&&e.style.removeProperty(n);}},Ma=(e,t)=>{Jr(e);for(let n of t){let o=n.indexOf(":");if(o===-1)continue;let r=n.slice(0,o).trim(),s=n.slice(o+1).trim();s.endsWith(";")&&(s=s.slice(0,-1)),r&&e.style.setProperty(r,s);}},qo=(e,t)=>{e.classList.toggle("pf-light",t==="light"),e.classList.toggle("pf-dark",t==="dark");},Na=({children:e,theme:t,initialMode:n="light",storageKey:o="pfui:pref",scope:r})=>{let s=!!r,a=t?.primaryKey??"mono",c=de.useContext(qr),i=de.useContext(Gr),l=!!c,m=useRef((()=>{if(!s)try{let E=JSON.parse(localStorage.getItem(o)||"null");if(E?.mode==="light"||E?.mode==="dark")return E.mode}catch{}return n==="system"?window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":n??"light"})()),h=de.useMemo(()=>c??Ia(m.current),[c]),f=de.useMemo(()=>Ia(a),[]);de.useLayoutEffect(()=>{f.get()!==a&&f.set(a);},[a,f]);let T=useRef(null),k=useRef(0),y=useRef(r??"__root__");de.useLayoutEffect(()=>{let E=0,g=T.current;for(;g&&g!==document.body;)g.hasAttribute("data-pfui-scope")&&E++,g=g.parentElement;k.current=E;},[r]);let x=useMemo(()=>{let E=Vo(jo,t),g=Vo(E,t?.light),v=t?.light?.primaryKey??a,L=ut(v),H=g.palette.primary??g.palette[L]??g.palette.mono,O=nn({...Ko(g.neutral).onColors,...g.text.onColors}),_=O[L]??Xr(H[600]),N=t?.surface||t?.light?.surface?g.surface:Jn("light",g.neutral),G={...t?.text||t?.light?.text?g.text:Ko(g.neutral),onColors:nn({...O,primary:_,[L]:_})};return {...g,palette:{...g.palette,primary:H},surface:N,text:G}},[t,a]),b=useMemo(()=>{let E=Vo(Ea,t),g=Vo(E,t?.dark),v=t?.dark?.primaryKey??a,L=ut(v),H=g.palette.primary??g.palette[L]??g.palette.mono,O=nn({..._o(g.neutral).onColors,...g.text.onColors}),_=O[L]??Xr(H[600]),N=t?.surface||t?.dark?.surface?g.surface:Jn("dark",g.neutral),G={...t?.text||t?.dark?.text?g.text:_o(g.neutral),onColors:nn({...O,primary:_,[L]:_})};return {...g,palette:{...g.palette,primary:H},surface:N,text:G}},[t,a]),d=useRef(null),p=useRef(null),C=de.useInsertionEffect||de.useLayoutEffect,F=useCallback(()=>{let E=Ur(r);ka(p,s?`pfui-guard-${r}`:"pfui-guard-root"),p.current.textContent=`${E} *{transition:none!important;animation:none!important}`,requestAnimationFrame(()=>{p.current.textContent="";});},[r,s]);C(()=>{ka(d,s?`pfui-vars-${r}`:"pfui-vars-root");let E=t?.light?.primaryKey??t?.primaryKey??a,g=t?.dark?.primaryKey??t?.primaryKey??a,v=Ur(r),L=Uo(x,ut(E),"light"),H=Uo(b,ut(g),"dark");d.current.textContent=`${v}.pf-light{${L}}
|
|
1
|
+
import de,{forwardRef,createContext,useId,useMemo,useState,useCallback,useRef,useEffect,useContext,isValidElement,cloneElement,Children,memo,useSyncExternalStore,useLayoutEffect}from'react';import {css,keyframes,useTheme,ThemeProvider,Global}from'@emotion/react';import {jsxs,jsx,Fragment}from'@emotion/react/jsx-runtime';import {ChevronDown,CircleAlert,TriangleAlert,CircleCheckBig,Info,X,Eye,EyeOff,ChevronRight,Check,ChevronFirst,ChevronLeft,ChevronLast,ChevronsUpDown}from'lucide-react';import {useFloating,offset,flip,shift,autoUpdate,useDismiss,useRole,useInteractions,FloatingPortal,size,arrow,useHover,safePolygon,useFocus}from'@floating-ui/react';import {motion,AnimatePresence,useAnimationControls}from'framer-motion';import {createRoot}from'react-dom/client';var xa={xxs:"0.15rem",xs:"0.25rem",sm:"0.5rem",md:"0.75rem",lg:"1rem",xl:"1.5rem"},va={xxs:"0.3rem",xs:"0.4rem",sm:"0.6rem",md:"0.7rem",lg:"1rem",xl:"2rem",full:"9999px"},Ca={sm:32,md:36,lg:40,border:"1px"},Ra={fonts:{sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"},sizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px","6xl":"60px"}},jr={0:"#ffffff",50:"#f9f9f9",100:"#f5f5f5",200:"#eeeeee",300:"#e5e5e5",400:"#d7d7d7ff",500:"#b3b3b3",600:"#737373",700:"#4a4a4a",800:"#2b2b2b",900:"#111111"},Vr={0:"#080808",50:"#121212",100:"#1a1a1a",200:"#222222",300:"#2b2b2b",400:"#333333",500:"#444444",600:"#6e6e6e",700:"#a6a6a6",800:"#e5e5e5",900:"#ffffff"},ha={mono:{0:"#FFFFFF",50:"#FAFAFA",100:"#F2F2F2",200:"#E6E6E6",300:"#D1D1D1",400:"#8A8A8A",500:"#2A2A2A",600:"#1A1A1A",700:"#121212",800:"#0B0B0B",900:"#000000"},danger:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},success:{0:"#FFFFFF",50:"#EEFFF3",100:"#D7FFE8",200:"#d6ffe7ff",300:"#8EF5BB",400:"#5BEA9A",500:"#0FD45D",600:"#00C853",700:"#109C47",800:"#0E8242",900:"#064D2B"},warning:{0:"#FFFFFF",50:"#FFF7EB",100:"#FFEFC6",200:"#FFE094",300:"#FFC552",400:"#FFB83A",500:"#FFA414",600:"#FF9F0A",700:"#D97500",800:"#AF5E00",900:"#6E3600"},info:{0:"#FFFFFF",50:"#ECFAFF",100:"#D2F2FF",200:"#AEE6FF",300:"#84D6FF",400:"#4BC1FF",500:"#2B9FFF",600:"#1093FF",700:"#0077C0",800:"#0066A8",900:"#083B61"},red:{0:"#FFFFFF",50:"#FFF1F1",100:"#FFE0E0",200:"#ffd2d5ff",300:"#FF9AA6",400:"#FF6A7B",500:"#EF2F23",600:"#E7000B",700:"#DB1424",800:"#C11225",900:"#7A0A18"},amber:{0:"#FFFFFF",50:"#FFF3EA",100:"#FFE3D1",200:"#FFC7A6",300:"#FFAC80",400:"#FF874D",500:"#FF6C1F",600:"#FF5A00",700:"#D24500",800:"#B63C00",900:"#6F2300"},orange:{0:"#FFFFFF",50:"#FFF4EB",100:"#FFE6CC",200:"#FFCE9E",300:"#FFAE66",400:"#FF8B33",500:"#FF7310",600:"#FF6B00",700:"#CC4400",800:"#AF3F00",900:"#6B2400"},yellow:{0:"#FFFFFF",50:"#FFFAE6",100:"#FFF2BF",200:"#FFE780",300:"#FFDB3D",400:"#FFD000",500:"#FFE03F",600:"#FFD60A",700:"#B38600",800:"#8E6D00",900:"#534300"},lime:{0:"#FFFFFF",50:"#F6FFE8",100:"#E7FFC2",200:"#CCFF83",300:"#A8FA3D",400:"#8BE11C",500:"#87DE10",600:"#7ACC00",700:"#4A8C00",800:"#3B7100",900:"#224300"},green:{0:"#FFFFFF",50:"#F0FFF5",100:"#DBFFE9",200:"#BDF7CF",300:"#8FE7A8",400:"#5BD57D",500:"#1DAE52",600:"#16A34A",700:"#168A40",800:"#136A34",900:"#0B3D1F"},teal:{0:"#FFFFFF",50:"#EDFFFB",100:"#D2FFF4",200:"#A6FAEA",300:"#74EEDC",400:"#41DECB",500:"#00CFAA",600:"#00BFA5",700:"#0C8C7F",800:"#0B786C",900:"#084741"},cyan:{0:"#FFFFFF",50:"#EFFFFF",100:"#D4FCFF",200:"#AFF5FD",300:"#7FE8F6",400:"#45D3EB",500:"#09C6E7",600:"#00B8D9",700:"#0A7C92",800:"#0B6E81",900:"#0A4250"},blue:{0:"#FFFFFF",50:"#EFF6FF",100:"#DBE8FF",200:"#B8D3FF",300:"#90BAFF",400:"#5E97FF",500:"#406FFF",600:"#2F66FF",700:"#2452DE",800:"#2248C8",900:"#172C80"},indigo:{0:"#FFFFFF",50:"#EEF2FF",100:"#E0E6FF",200:"#C5D0FF",300:"#A3B5FF",400:"#879CFF",500:"#707AF5",600:"#5A63F3",700:"#4951DA",800:"#3E40BF",900:"#2A2A82"},purple:{0:"#FFFFFF",50:"#F4F0FF",100:"#E8DBFF",200:"#D2B8FF",300:"#B590FF",400:"#996AF5",500:"#7A52F1",600:"#6B3CF0",700:"#592FBE",800:"#4D27A3",900:"#2F1767"},magenta:{0:"#FFFFFF",50:"#FFF0FE",100:"#FCE0FF",200:"#F7BCFF",300:"#F393FD",400:"#E85FF8",500:"#C645D6",600:"#C026D3",700:"#951CAB",800:"#801790",900:"#4C0C59"},pink:{0:"#FFFFFF",50:"#FFF0F7",100:"#FFE0F0",200:"#FFC0E2",300:"#FF9ACE",400:"#FF6CB3",500:"#ED5CA2",600:"#EC4899",700:"#AB236F",800:"#96205D",900:"#5A1238"},rose:{0:"#FFFFFF",50:"#FFF0F3",100:"#FFE1E9",200:"#FFC1D3",300:"#FF98B8",400:"#FF6B98",500:"#EE4278",600:"#E52E69",700:"#B52156",800:"#991A43",900:"#5B0F28"}},ya={mono:{0:"#0B0B0C",50:"#0F0F10",100:"#151515",200:"#1B1B1C",300:"#232323",400:"#DADADA",500:"#E0E0E0",600:"#EDEDED",700:"#F5F5F5",800:"#FCFCFC",900:"#FFFFFF"},danger:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},success:{0:"#06150B",50:"#0A1B10",100:"#0E2416",200:"#11301C",300:"#143B21",400:"#16502C",500:"#22D85A",600:"#00C853",700:"#2FE976",800:"#7FF1AE",900:"#D6FADF"},warning:{0:"#150E05",50:"#1C1408",100:"#261B0B",200:"#31240E",300:"#3D2C12",400:"#583C16",500:"#FFA61A",600:"#FF9F0A",700:"#FFB347",800:"#FFD089",900:"#FFF0C9"},info:{0:"#07131E",50:"#0A1926",100:"#0E2233",200:"#112C44",300:"#143654",400:"#184A78",500:"#1C9CFF",600:"#1093FF",700:"#4FB2FF",800:"#9DD2FF",900:"#D8ECFF"},red:{0:"#17080A",50:"#1E0B0D",100:"#290F11",200:"#3A1416",300:"#4B191B",400:"#6A1D21",500:"#FF3B30",600:"#E7000B",700:"#FF2A20",800:"#FF463D",900:"#FFD9DB"},amber:{0:"#150D07",50:"#1C120A",100:"#26180E",200:"#311F12",300:"#3E2716",400:"#59361C",500:"#FF6A1E",600:"#FF5A00",700:"#FF8747",800:"#FFB98A",900:"#FFE2CC"},orange:{0:"#140D07",50:"#1B120A",100:"#25190D",200:"#302010",300:"#3B2813",400:"#553817",500:"#FF7F22",600:"#FF6B00",700:"#FF9247",800:"#FFBE8A",900:"#FFE1CC"},yellow:{0:"#141303",50:"#1B1906",100:"#25210A",200:"#2F2A0D",300:"#383212",400:"#524717",500:"#FFE042",600:"#FFD60A",700:"#FFE457",800:"#FFF194",900:"#FFF8CF"},lime:{0:"#0C1306",50:"#101A08",100:"#14210B",200:"#1A2B0F",300:"#203614",400:"#2A4A1A",500:"#86E21A",600:"#7ACC00",700:"#9EEA3B",800:"#C9F57F",900:"#EAFCC4"},green:{0:"#07140C",50:"#0B1B11",100:"#0E2416",200:"#112C1B",300:"#143722",400:"#17502F",500:"#20BF55",600:"#16A34A",700:"#39C964",800:"#86E5A5",900:"#D4F6E1"},teal:{0:"#081815",50:"#0B1F1C",100:"#0F2824",200:"#13322E",300:"#173E39",400:"#14584F",500:"#14CEBD",600:"#00BFA5",700:"#2CD6C6",800:"#7FEAE3",900:"#CFF7F3"},cyan:{0:"#07171C",50:"#0A1E24",100:"#0E2830",200:"#11333D",300:"#153E4A",400:"#165B6A",500:"#20CBE6",600:"#00B8D9",700:"#3FD2E9",800:"#93EBF6",900:"#D5F7FC"},blue:{0:"#081421",50:"#0A1829",100:"#0E2139",200:"#112A4B",300:"#153660",400:"#184A86",500:"#4A78FF",600:"#2F66FF",700:"#5A8AFF",800:"#A7C3FF",900:"#D9E7FF"},indigo:{0:"#0B1023",50:"#0E162C",100:"#141F3F",200:"#1C2A56",300:"#24366E",400:"#2F4894",500:"#707CF6",600:"#5A63F3",700:"#7D86FF",800:"#B5C0FF",900:"#E0E6FF"},purple:{0:"#100B1F",50:"#130E26",100:"#1A1638",200:"#231F4E",300:"#2E2A67",400:"#3C388D",500:"#8256F3",600:"#6B3CF0",700:"#8B66FA",800:"#C1B0FF",900:"#E4DCFF"},magenta:{0:"#160A18",50:"#1C0C21",100:"#25102E",200:"#321544",300:"#421A5C",400:"#58247C",500:"#CB44DB",600:"#C026D3",700:"#D960EB",800:"#F0B5FA",900:"#F9E4FE"},pink:{0:"#170911",50:"#1D0C18",100:"#271220",200:"#371830",300:"#462042",400:"#622C5C",500:"#F067AE",600:"#EC4899",700:"#F679BB",800:"#FFC2E1",900:"#FFE6F3"},rose:{0:"#17090E",50:"#1F0C13",100:"#2A121B",200:"#3A1B28",300:"#4B2636",400:"#673449",500:"#EE457B",600:"#E52E69",700:"#FF558A",800:"#FFA9C6",900:"#FFE0EA"}},Ta=e=>({...e,red:e.danger,error:e.danger,green:e.success,success:e.success,orange:e.orange,amber:e.amber,yellow:e.yellow,lime:e.lime,teal:e.teal,cyan:e.cyan,blue:e.blue,indigo:e.indigo,purple:e.purple,violet:e.purple,magenta:e.magenta,fuchsia:e.magenta,pink:e.pink,rose:e.rose,gray:e.mono,grey:e.mono,neutral:e.mono}),Jn=(e,t)=>e==="light"?{appBg:t[0],panelBg:t[0],subtleBg:t[100],panelHover:t[50],subtleHover:t[200],overlayBg:"linear-gradient(rgba(0,0,0,.15),rgba(0,0,0,.525))",border:t[300]}:{appBg:t[0],panelBg:t[0],subtleBg:t[50],panelHover:t[50],subtleHover:t[100],overlayBg:"linear-gradient(rgba(0,0,0,.35),rgba(0,0,0,.75))",border:t[200]},Ko=e=>({primary:e[900],secondary:e[600],muted:e[500],onColors:{}}),_o=e=>({primary:e[900],secondary:e[700],muted:e[600],onColors:{}}),yc=["danger","success","warning","info","amber","orange","yellow","lime","green","teal","cyan","blue","indigo","purple","magenta","pink","rose"],wa=e=>yc.reduce((t,n)=>(t[n]=e[n]??"#FFFFFF",t),{}),jo={spacing:xa,radius:va,componentHeights:Ca,typography:Ra,neutral:jr,palette:{...Ta(ha),primary:ha.mono},surface:Jn("light",jr),text:{...Ko(jr),onColors:{primary:"#FFFFFF",...wa({yellow:"#000000"})}}},Ea={spacing:xa,radius:va,componentHeights:Ca,typography:Ra,neutral:Vr,palette:{...Ta(ya),primary:ya.mono},surface:Jn("dark",Vr),text:{..._o(Vr),onColors:{primary:"#FFFFFF",...wa({yellow:"#000000"})}}};function Ia(e){let t=e,n=new Set;return {get:()=>t,set:o=>{t=o,n.forEach(r=>r());},subscribe:o=>(n.add(o),()=>{n.delete(o);})}}var Aa={destructive:"danger",error:"danger",violet:"purple",fuchsia:"magenta",gray:"mono",grey:"mono",neutral:"mono"},ut=e=>Aa[e]??e;function nn(e){let t={...e};return Object.entries(Aa).forEach(([n,o])=>{t[o]!=null&&t[n]==null&&(t[n]=t[o]);}),t}var qr=de.createContext(null),Fa=de.createContext(null),Gr=de.createContext({setMode:e=>{},toggleMode:()=>{}}),Pa=de.createContext({setPrimary:e=>{}}),Da=de.createContext(null);function j(){return useTheme()}function Cc(){let e=de.useContext(qr);if(!e)throw new Error("useColorMode must be used within ThemeProvider");let t=de.useContext(Gr),[n,o]=de.useState(()=>e.get());return de.useEffect(()=>{o(e.get());let r=e.subscribe(()=>o(e.get()));return ()=>{r();}},[e]),{mode:n,setMode:t.setMode,toggleMode:t.toggleMode}}function Rc(){let e=de.useContext(Fa);if(!e)throw new Error("usePrimary must be used within ThemeProvider");let t=de.useContext(Pa),[n,o]=de.useState(()=>e.get());return de.useEffect(()=>{o(e.get());let r=e.subscribe(()=>o(e.get()));return ()=>{r();}},[e]),{primary:n,setPrimary:t.setPrimary}}function cb(e){let t=de.useContext(Da);if(!t)throw new Error("usePrimitives must be used within ThemeProvider");let{mode:n}=Cc(),{primary:o}=Rc(),r=de.useMemo(()=>{let s=n==="light"?t.light:t.dark,a=s.palette[ut(o)]??s.palette.primary,c=nn(s.text.onColors)[ut(o)]??Xr(a[600]);return {...s,palette:{...s.palette,primary:a},text:{...s.text,onColors:{...nn(s.text.onColors),primary:c,[ut(o)]:c,[o]:c}}}},[t,n,o]);return e?e(r):r}function Vo(e,t){if(!t)return e;let n={...e.palette};if(t.palette)for(let o of Object.keys(t.palette)){let r=t.palette[o];r&&(n[o]={...e.palette[o]??{},...r});}return {...e,spacing:{...e.spacing,...t.spacing??{}},radius:{...e.radius,...t.radius??{}},componentHeights:{...e.componentHeights,...t.componentHeights??{}},typography:{fonts:{...e.typography.fonts,...t.typography?.fonts??{}},sizes:{...e.typography.sizes,...t.typography?.sizes??{}}},palette:n,neutral:t.neutral?{...e.neutral,...t.neutral}:e.neutral,surface:{...e.surface,...t.surface??{}},text:{...e.text,...t.text??{},onColors:{...e.text.onColors,...t.text?.onColors??{}}}}}function Xr(e){let t=e.replace("#",""),n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16),s=c=>{let i=c/255;return i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)};return .2126*s(n)+.7152*s(o)+.0722*s(r)>.53?"#000":"#FFF"}function ka(e,t){if(e.current)return;let n=document.createElement("style");n.id=t,document.head.appendChild(n),e.current=n;}function Ur(e){return e?`[data-pfui-scope="${e}"]`:":root"}function Yr(e,t,n){let o=[],r=i=>i.startsWith("var(")?i.replace(/^var\([^,]+,\s*/,"").replace(/\)\s*$/,"").trim():i;o.push(`--pf-font-sans:${r(e.typography.fonts.sans)};`),o.push(`--pf-font-mono:${r(e.typography.fonts.mono)};`),o.push(`--pf-text-primary:${e.text.primary};`),o.push(`--pf-text-secondary:${e.text.secondary};`),o.push(`--pf-text-muted:${e.text.muted};`),Object.entries(e.text.onColors).forEach(([i,l])=>o.push(`--pf-text-on-${i}:${l};`)),Object.entries(e.spacing).forEach(([i,l])=>o.push(`--pf-space-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.radius).forEach(([i,l])=>o.push(`--pf-radius-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.typography.sizes).forEach(([i,l])=>o.push(`--pf-fontSize-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.componentHeights).forEach(([i,l])=>o.push(`--pf-cmph-${i}:${typeof l=="number"?`${l}px`:l};`)),Object.entries(e.neutral).forEach(([i,l])=>o.push(`--pf-neutral-${i}:${l};`)),o.push(`--pf-surface-appBg:${e.surface.appBg};`),o.push(`--pf-surface-panelBg:${e.surface.panelBg};`),o.push(`--pf-surface-subtleBg:${e.surface.subtleBg};`),o.push(`--pf-surface-panelHover:${e.surface.panelHover};`),o.push(`--pf-surface-subtleHover:${e.surface.subtleHover};`),o.push(`--pf-surface-overlayBg:${e.surface.overlayBg};`),o.push(`--pf-surface-border:${e.surface.border};`),o.push("--pf-focus-main:var(--pf-neutral-400);"),o.push(n==="dark"?"--pf-focus-soft:var(--pf-neutral-200);":"--pf-focus-soft:var(--pf-neutral-300);"),Object.entries(e.palette).forEach(([i,l])=>{Object.entries(l).forEach(([u,m])=>{o.push(`--pf-palette-${i}-${u}:${m};`);});});let s="300";Object.keys(e.palette).forEach(i=>{o.push(`--pf-focus-${i}-main: var(--pf-palette-${i}-${s});`),o.push(`--pf-focus-${i}-soft: transparent;`);});let a=t;[0,50,100,200,300,400,500,600,700,800,900].forEach(i=>o.push(`--pf-primary-${i}:var(--pf-palette-${a}-${i});`)),o.push("--pf-focus-accent-main:var(--pf-primary-300);"),o.push("--pf-focus-accent-soft: transparent;");let c=e.text.onColors[a]??(()=>{let l=(e.palette[a]?.[600]??e.palette.primary[600]).replace("#",""),u=parseInt(l.slice(0,2),16),m=parseInt(l.slice(2,4),16),h=parseInt(l.slice(4,6),16),f=k=>{let y=k/255;return y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4)};return .2126*f(u)+.7152*f(m)+.0722*f(h)>.53?"#000":"#FFF"})();return o.push(`--pf-text-on-primary:${c};`),o.push(`color-scheme:${n==="dark"?"dark":"light"};`),o}function Uo(e,t,n){return Yr(e,t,n).join("")}var Jr=e=>{for(let t=e.style.length-1;t>=0;t--){let n=e.style.item(t);n&&n.startsWith("--pf-")&&e.style.removeProperty(n);}},Ma=(e,t)=>{Jr(e);for(let n of t){let o=n.indexOf(":");if(o===-1)continue;let r=n.slice(0,o).trim(),s=n.slice(o+1).trim();s.endsWith(";")&&(s=s.slice(0,-1)),r&&e.style.setProperty(r,s);}},qo=(e,t)=>{e.classList.toggle("pf-light",t==="light"),e.classList.toggle("pf-dark",t==="dark");},Na=({children:e,theme:t,initialMode:n="light",storageKey:o="pfui:pref",scope:r})=>{let s=!!r,a=t?.primaryKey??"mono",c=de.useContext(qr),i=de.useContext(Gr),l=!!c,m=useRef((()=>{if(!s)try{let E=JSON.parse(localStorage.getItem(o)||"null");if(E?.mode==="light"||E?.mode==="dark")return E.mode}catch{}return n==="system"?window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light":n??"light"})()),h=de.useMemo(()=>c??Ia(m.current),[c]),f=de.useMemo(()=>Ia(a),[]);de.useLayoutEffect(()=>{f.get()!==a&&f.set(a);},[a,f]);let T=useRef(null),k=useRef(0),y=useRef(r??"__root__");de.useLayoutEffect(()=>{let E=0,g=T.current;for(;g&&g!==document.body;)g.hasAttribute("data-pfui-scope")&&E++,g=g.parentElement;k.current=E;},[r]);let x=useMemo(()=>{let E=Vo(jo,t),g=Vo(E,t?.light),v=t?.light?.primaryKey??a,L=ut(v),H=g.palette.primary??g.palette[L]??g.palette.mono,O=nn({...Ko(g.neutral).onColors,...g.text.onColors}),_=O[L]??Xr(H[600]),N=t?.surface||t?.light?.surface?g.surface:Jn("light",g.neutral),G={...t?.text||t?.light?.text?g.text:Ko(g.neutral),onColors:nn({...O,primary:_,[L]:_})};return {...g,palette:{...g.palette,primary:H},surface:N,text:G}},[t,a]),b=useMemo(()=>{let E=Vo(Ea,t),g=Vo(E,t?.dark),v=t?.dark?.primaryKey??a,L=ut(v),H=g.palette.primary??g.palette[L]??g.palette.mono,O=nn({..._o(g.neutral).onColors,...g.text.onColors}),_=O[L]??Xr(H[600]),N=t?.surface||t?.dark?.surface?g.surface:Jn("dark",g.neutral),G={...t?.text||t?.dark?.text?g.text:_o(g.neutral),onColors:nn({...O,primary:_,[L]:_})};return {...g,palette:{...g.palette,primary:H},surface:N,text:G}},[t,a]),d=useRef(null),p=useRef(null),C=de.useInsertionEffect||de.useLayoutEffect,F=useCallback(()=>{let E=Ur(r);ka(p,s?`pfui-guard-${r}`:"pfui-guard-root"),p.current.textContent=`${E} *{transition:none!important;animation:none!important}`,requestAnimationFrame(()=>{p.current.textContent="";});},[r,s]);C(()=>{ka(d,s?`pfui-vars-${r}`:"pfui-vars-root");let E=t?.light?.primaryKey??t?.primaryKey??a,g=t?.dark?.primaryKey??t?.primaryKey??a,v=Ur(r),L=Uo(x,ut(E),"light"),H=Uo(b,ut(g),"dark");d.current.textContent=`${v}.pf-light{${L}}
|
|
2
2
|
${v}.pf-dark{${H}}`+(s?`
|
|
3
3
|
${v}{background:var(--pf-surface-appBg);color:var(--pf-text-primary);}`:"");},[x,b,t?.primaryKey,t?.light?.primaryKey,t?.dark?.primaryKey,r,s,a]);let R=useRef(false);de.useLayoutEffect(()=>{if(R.current)return;R.current=true;let E=s?T.current:document.documentElement;if(!E)return;let g=h.get();Jr(E),qo(E,g),E.setAttribute("data-pfui-mode",g),E.setAttribute("data-pfui-primary",f.get()),l||h.set(g);},[s,h,f,l]);let w=useCallback(()=>{window.__pfuiActiveScope={id:y.current,depth:k.current,ts:Date.now()};},[]),M=useCallback(()=>{let E=s?T.current:document.documentElement,g={capture:true},v=()=>w();return E?.addEventListener("pointerdown",v,g),E?.addEventListener("mouseenter",v,g),E?.addEventListener("focusin",v,g),E?.addEventListener("keydown",v,g),()=>{E?.removeEventListener("pointerdown",v,g),E?.removeEventListener("mouseenter",v,g),E?.removeEventListener("focusin",v,g),E?.removeEventListener("keydown",v,g);}},[s,w]),$=useCallback(E=>{let g=window.__pfuiActiveScope,v=g&&Date.now()-g.ts<1500;if(!g||!v||g.id!==y.current)return;let L=h.get(),H=f.get(),_=Yr(L==="light"?x:b,ut(H),L);Ma(E,_),qo(E,L),E.setAttribute("data-pfui-portal-owner",y.current),E.setAttribute("data-pfui-mode",L),E.setAttribute("data-pfui-primary",H);},[h,f,x,b]),K=E=>{if(E.getAttribute("data-floating-ui-portal")==="true"||E.getAttribute("data-radix-portal")==="true"||E.getAttribute("data-portal")==="true")return true;let g=E.getAttribute("role");if(g==="tooltip"||g==="dialog")return true;let v=window.getComputedStyle(E);return v.position==="fixed"||v.position==="absolute"},W=useCallback(()=>{let E=new MutationObserver(g=>{for(let v of g)v.addedNodes.forEach(L=>{L instanceof HTMLElement&&(K(L)&&$(L),L.querySelectorAll('[data-floating-ui-portal="true"],[data-radix-portal="true"],[data-portal="true"],[role="tooltip"],[role="dialog"]').forEach(H=>$(H)));});});return E.observe(document.body,{childList:true,subtree:true}),()=>E.disconnect()},[$]);de.useEffect(()=>{let E=M(),g=W();return ()=>{E(),g();}},[M,W]);let S=useCallback(E=>{let g=s?T.current:document.documentElement;g&&(Jr(g),qo(g,E),g.setAttribute("data-pfui-mode",E),g.setAttribute("data-pfui-primary",f.get()));},[s,f]),A=useCallback(E=>{let g=ut(f.get()),L=Yr(E==="light"?x:b,g,E);document.querySelectorAll(`[data-pfui-portal-owner="${y.current}"]`).forEach(H=>{Ma(H,L),qo(H,E),H.setAttribute("data-pfui-mode",E),H.setAttribute("data-pfui-primary",g);});},[x,b,f]);de.useLayoutEffect(()=>{A(h.get());},[A,x,b,a,h]),de.useLayoutEffect(()=>{if(!l)return;let E=()=>{let v=h.get();F(),S(v),A(v);};E();let g=h.subscribe(E);return ()=>g()},[l,h,F,S,A]);let I=useCallback(E=>{if(h.get()!==E&&(F(),h.set(E),S(E),A(E),!s))try{let g=JSON.parse(localStorage.getItem(o)||"{}");localStorage.setItem(o,JSON.stringify({...g,mode:E}));}catch{}},[h,s,o,F,S,A]),P=useCallback(()=>I(h.get()==="light"?"dark":"light"),[I,h]),D=useCallback(E=>{f.set(E);let g=Ur(r),v=Uo(x,ut(E),"light"),L=Uo(b,ut(E),"dark");d.current&&(d.current.textContent=`${g}.pf-light{${v}}
|
|
4
4
|
${g}.pf-dark{${L}}`+(s?`
|