@ngrok/mantle 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/alert.d.ts +2 -2
  2. package/dist/alert.js +1 -1
  3. package/dist/alert.js.map +1 -1
  4. package/dist/anchor.js +1 -1
  5. package/dist/anchor.js.map +1 -1
  6. package/dist/badge.js +1 -1
  7. package/dist/badge.js.map +1 -1
  8. package/dist/button.js +1 -1
  9. package/dist/calendar.js +1 -1
  10. package/dist/calendar.js.map +1 -1
  11. package/dist/card.js +1 -1
  12. package/dist/card.js.map +1 -1
  13. package/dist/checkbox.js +1 -1
  14. package/dist/checkbox.js.map +1 -1
  15. package/dist/{chunk-YPNOQPCP.js → chunk-47UGLBIG.js} +2 -2
  16. package/dist/chunk-47UGLBIG.js.map +1 -0
  17. package/dist/chunk-4LSFAAZW.js +1 -0
  18. package/dist/chunk-4LSFAAZW.js.map +1 -0
  19. package/dist/chunk-5E73VWJX.js +2 -0
  20. package/dist/chunk-6EMCH2HX.js +2 -0
  21. package/dist/chunk-6EMCH2HX.js.map +1 -0
  22. package/dist/chunk-CXQLUXDJ.js +2 -0
  23. package/dist/chunk-CXQLUXDJ.js.map +1 -0
  24. package/dist/chunk-DK2VDJHL.js +2 -0
  25. package/dist/chunk-DK2VDJHL.js.map +1 -0
  26. package/dist/{chunk-5YA2UTFS.js → chunk-E6LNHWJ3.js} +2 -2
  27. package/dist/chunk-E6LNHWJ3.js.map +1 -0
  28. package/dist/chunk-ERBZR6SY.js +2 -0
  29. package/dist/chunk-ERBZR6SY.js.map +1 -0
  30. package/dist/chunk-EW5CFGXT.js +2 -0
  31. package/dist/chunk-Q5QAMVGX.js +1 -0
  32. package/dist/chunk-Q5QAMVGX.js.map +1 -0
  33. package/dist/{chunk-7PF4QIBH.js → chunk-RDMTCZPT.js} +1 -1
  34. package/dist/chunk-VTEPKCRP.js +2 -0
  35. package/dist/chunk-VTEPKCRP.js.map +1 -0
  36. package/dist/chunk-ZBC4B4EM.js +2 -0
  37. package/dist/chunk-ZBC4B4EM.js.map +1 -0
  38. package/dist/chunk-ZOQ33WW5.js +2 -0
  39. package/dist/chunk-ZOQ33WW5.js.map +1 -0
  40. package/dist/code-block.d.ts +1 -1
  41. package/dist/code-block.js +2 -2
  42. package/dist/code-block.js.map +1 -1
  43. package/dist/compose-refs.js +1 -1
  44. package/dist/cx.js +1 -1
  45. package/dist/dialog.js +1 -1
  46. package/dist/dialog.js.map +1 -1
  47. package/dist/dropdown-menu.js +1 -1
  48. package/dist/dropdown-menu.js.map +1 -1
  49. package/dist/hooks.js +1 -1
  50. package/dist/hooks.js.map +1 -1
  51. package/dist/icon.js +1 -1
  52. package/dist/inline-code.js +1 -1
  53. package/dist/inline-code.js.map +1 -1
  54. package/dist/input.js +1 -1
  55. package/dist/input.js.map +1 -1
  56. package/dist/label.js +1 -1
  57. package/dist/label.js.map +1 -1
  58. package/dist/media-object.js +1 -1
  59. package/dist/media-object.js.map +1 -1
  60. package/dist/pagination.d.ts +31 -2
  61. package/dist/pagination.js +1 -1
  62. package/dist/pagination.js.map +1 -1
  63. package/dist/popover.js +1 -1
  64. package/dist/popover.js.map +1 -1
  65. package/dist/progress.d.ts +3 -4
  66. package/dist/progress.js +1 -1
  67. package/dist/progress.js.map +1 -1
  68. package/dist/radio-group.d.ts +3 -3
  69. package/dist/radio-group.js +1 -1
  70. package/dist/radio-group.js.map +1 -1
  71. package/dist/select.js +1 -1
  72. package/dist/separator.js +1 -1
  73. package/dist/sheet.js +1 -1
  74. package/dist/sheet.js.map +1 -1
  75. package/dist/skeleton.js +1 -1
  76. package/dist/skeleton.js.map +1 -1
  77. package/dist/switch.js +1 -1
  78. package/dist/switch.js.map +1 -1
  79. package/dist/table.js +1 -1
  80. package/dist/table.js.map +1 -1
  81. package/dist/tabs.js +1 -1
  82. package/dist/tabs.js.map +1 -1
  83. package/dist/tailwind-preset.cjs +1 -1
  84. package/dist/tailwind-preset.cjs.map +1 -1
  85. package/dist/tailwind-preset.d.cts +3 -3
  86. package/dist/tailwind-preset.d.ts +3 -3
  87. package/dist/tailwind-preset.js +1 -1
  88. package/dist/tailwind-preset.js.map +1 -1
  89. package/dist/text-area.js +1 -1
  90. package/dist/text-area.js.map +1 -1
  91. package/dist/theme-provider.js +2 -2
  92. package/dist/theme-provider.js.map +1 -1
  93. package/dist/tooltip.js +1 -1
  94. package/dist/tooltip.js.map +1 -1
  95. package/dist/types.js +1 -1
  96. package/package.json +61 -22
  97. package/dist/chunk-5YA2UTFS.js.map +0 -1
  98. package/dist/chunk-EAKUJEO5.js +0 -2
  99. package/dist/chunk-EAKUJEO5.js.map +0 -1
  100. package/dist/chunk-EEMNPJIL.js +0 -2
  101. package/dist/chunk-EEMNPJIL.js.map +0 -1
  102. package/dist/chunk-EQOASS6Y.js +0 -2
  103. package/dist/chunk-EQOASS6Y.js.map +0 -1
  104. package/dist/chunk-G2WLA5VU.js +0 -2
  105. package/dist/chunk-JE2MBLEH.js +0 -2
  106. package/dist/chunk-JE2MBLEH.js.map +0 -1
  107. package/dist/chunk-LKCV5U37.js +0 -2
  108. package/dist/chunk-LKCV5U37.js.map +0 -1
  109. package/dist/chunk-NSJFPSQC.js +0 -2
  110. package/dist/chunk-XGNB7VBZ.js +0 -2
  111. package/dist/chunk-XGNB7VBZ.js.map +0 -1
  112. package/dist/chunk-YPNOQPCP.js.map +0 -1
  113. /package/dist/{chunk-G2WLA5VU.js.map → chunk-5E73VWJX.js.map} +0 -0
  114. /package/dist/{chunk-NSJFPSQC.js.map → chunk-EW5CFGXT.js.map} +0 -0
  115. /package/dist/{chunk-7PF4QIBH.js.map → chunk-RDMTCZPT.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as S}from"./chunk-IWKI4XHM.js";import{a as u}from"./chunk-NSJFPSQC.js";import{Slot as O}from"@radix-ui/react-slot";import H from"prismjs";import{createContext as W,forwardRef as m,useContext as v,useEffect as y,useId as F,useMemo as Y,useState as g}from"react";import"prismjs/components/prism-bash.js";import"prismjs/components/prism-bash.js";import"prismjs/components/prism-csharp.js";import"prismjs/components/prism-css.js";import"prismjs/components/prism-go.js";import"prismjs/components/prism-java.js";import"prismjs/components/prism-javascript.js";import"prismjs/components/prism-json.js";import"prismjs/components/prism-jsx.js";import"prismjs/components/prism-markup.js";import"prismjs/components/prism-python.js";import"prismjs/components/prism-ruby.js";import"prismjs/components/prism-rust.js";import"prismjs/components/prism-tsx.js";import"prismjs/components/prism-typescript.js";import"prismjs/components/prism-yaml.js";import{CaretDown as J}from"@phosphor-icons/react/CaretDown";import{Check as Q}from"@phosphor-icons/react/Check";import{Copy as V}from"@phosphor-icons/react/Copy";import M from"tiny-invariant";var b=["bash","cs","csharp","css","dotnet","go","html","java","javascript","js","json","jsx","markup","plain","plaintext","py","python","rb","ruby","rust","sh","shell","text","ts","tsx","txt","typescript","xml","yaml","yml"];function R(e){if(!e)return"sh";let o=e.trim().slice(e.indexOf("-")+1);return w(o)?o:"sh"}var w=e=>typeof e=="string"&&b.includes(e);function L(e="sh"){return`language-${e??"sh"}`}import{Fragment as q,jsx as l,jsxs as T}from"react/jsx-runtime";var B=W({codeId:void 0,copyText:"",hasCodeExpander:!1,isCodeExpanded:!1,registerCodeId:()=>{},setCopyText:()=>{},setHasCodeExpander:()=>{},setIsCodeExpanded:()=>{},unregisterCodeId:()=>{}}),I=m(({className:e,...o},r)=>{let[t,a]=g(""),[n,i]=g(!1),[s,c]=g(!1),[d,f]=g(void 0),h=Y(()=>({codeId:d,copyText:t,hasCodeExpander:n,isCodeExpanded:s,registerCodeId:p=>{f(C=>(M(C==null,"You can only render a single CodeBlockCode within a CodeBlock."),p))},setCopyText:a,setHasCodeExpander:i,setIsCodeExpanded:c,unregisterCodeId:p=>{f(C=>{M(C===p,"You can only render a single CodeBlockCode within a CodeBlock.")})}}),[d,t,n,s]);return l(B.Provider,{value:h,children:l("div",{className:u("overflow-hidden rounded-md border border-gray-300 bg-gray-50 font-mono text-[0.8125rem]",e),ref:r,...o})})});I.displayName="CodeBlock";var N=m(({className:e,...o},r)=>l("div",{className:u("relative",e),ref:r,...o}));N.displayName="CodeBlockBody";var A=m((e,o)=>{let{className:r,language:t="text",style:a,value:n}=e,i=F(),{hasCodeExpander:s,isCodeExpanded:c,registerCodeId:d,setCopyText:f,unregisterCodeId:h}=v(B),p=n?.trim()??"",[C,z]=g(p);return y(()=>{let E=H.languages[t];M(E,`CodeBlock does not support the language "${t}". The syntax highlighter does not have a grammar for this language. The supported languages are: ${b.join(", ")}.`);let $=H.highlight(p,E,t);z($)},[p,t]),y(()=>{f(p)},[p,f]),y(()=>(d(i),()=>{h(i)}),[i,d,h]),l("pre",{"aria-expanded":s?c:void 0,className:u(L(t),"scrollbar firefox:after:mr-[3.375rem] firefox:after:inline-block firefox:after:content-[''] overflow-x-auto overflow-y-hidden p-4 pr-[3.375rem]","aria-collapsed:max-h-[13.6rem]",r),"data-lang":t,id:i,ref:o,style:{...a,tabSize:2,MozTabSize:2},children:l("code",{dangerouslySetInnerHTML:{__html:C}})})});A.displayName="CodeBlockCode";var P=m(({className:e,...o},r)=>l("div",{className:u("flex items-center gap-1 border-b border-gray-300 bg-gray-100 px-4 py-2 text-gray-700",e),ref:r,...o}));P.displayName="CodeBlockHeader";var D=m(({asChild:e=!1,className:o,...r},t)=>l(e?O:"h3",{ref:t,className:u("font-mono text-[0.8125rem] font-normal",o),...r}));D.displayName="CodeBlockTitle";var _=m(({className:e,onCopy:o,onCopyError:r,style:t},a)=>{let{copyText:n}=v(B),[,i]=S(),[s,c]=g(!1);return y(()=>{if(s){let d=window.setTimeout(()=>{c(!1)},2e3);return()=>{clearTimeout(d)}}},[s]),T("button",{type:"button",className:u("focus-visible:border-accent-600 focus-visible:ring-focus-accent absolute right-3 top-3 z-10 flex h-7 w-7 items-center justify-center rounded border border-gray-300 bg-gray-50 shadow-[-1rem_0_0.75rem_-0.375rem_hsl(var(--gray-50)),1rem_0_0_-0.25rem_hsl(var(--gray-50))] hover:border-gray-400 hover:bg-gray-200 focus-visible:outline-none focus-visible:ring-4",s&&"bg-filled-success text-on-filled hover:bg-filled-success focus:bg-filled-success focus-visible:border-success-600 focus-visible:ring-focus-success w-auto gap-1 border-transparent pl-2 pr-1.5 hover:border-transparent",e),ref:a,style:t,onClick:async()=>{try{await i(n),o?.(n),c(!0)}catch(d){r?.(d)}},children:[l("span",{className:"sr-only",children:"Copy code"}),s?T(q,{children:["Copied",l(Q,{className:"h-4 w-4",weight:"bold"})]}):l(V,{className:"-ml-px h-5 w-5"})]})});_.displayName="CodeBlockCopyButton";var j=m(({className:e,onClick:o,...r},t)=>{let{codeId:a,isCodeExpanded:n,setIsCodeExpanded:i,setHasCodeExpander:s}=v(B);return y(()=>(s(!0),()=>{s(!1)}),[s]),T("button",{...r,"aria-controls":a,"aria-expanded":n,className:u("flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-gray-50 px-4 py-2 font-sans text-gray-700 hover:bg-gray-100",e),ref:t,type:"button",onClick:c=>{i(d=>!d),o?.(c)},children:[n?"Show less":"Show more"," ",l(J,{className:u("h-4 w-4",n&&"rotate-180","transition-all duration-150"),weight:"bold"})]})});j.displayName="CodeBlockExpanderButton";function G(e,...o){if(!U(e)||!Array.isArray(o))throw new Error("It looks like you tried to call `fmtCode` as a function. Make sure to use it as a tagged template.\n Example: fmtCode`SELECT * FROM users`, not fmtCode('SELECT * FROM users')");let r=String.raw({raw:e},...o),t=K(r);return r.trim().split(`
1
+ import{a as S}from"./chunk-IWKI4XHM.js";import{a as u}from"./chunk-EW5CFGXT.js";import{Slot as O}from"@radix-ui/react-slot";import H from"prismjs";import{createContext as W,forwardRef as m,useContext as v,useEffect as y,useId as F,useMemo as Y,useState as g}from"react";import"prismjs/components/prism-bash.js";import"prismjs/components/prism-bash.js";import"prismjs/components/prism-csharp.js";import"prismjs/components/prism-css.js";import"prismjs/components/prism-go.js";import"prismjs/components/prism-java.js";import"prismjs/components/prism-javascript.js";import"prismjs/components/prism-json.js";import"prismjs/components/prism-jsx.js";import"prismjs/components/prism-markup.js";import"prismjs/components/prism-python.js";import"prismjs/components/prism-ruby.js";import"prismjs/components/prism-rust.js";import"prismjs/components/prism-tsx.js";import"prismjs/components/prism-typescript.js";import"prismjs/components/prism-yaml.js";import{CaretDown as J}from"@phosphor-icons/react/CaretDown";import{Check as Q}from"@phosphor-icons/react/Check";import{Copy as V}from"@phosphor-icons/react/Copy";import M from"tiny-invariant";var b=["bash","cs","csharp","css","dotnet","go","html","java","javascript","js","json","jsx","markup","plain","plaintext","py","python","rb","ruby","rust","sh","shell","text","ts","tsx","txt","typescript","xml","yaml","yml"];function R(e){if(!e)return"sh";let o=e.trim().slice(e.indexOf("-")+1);return w(o)?o:"sh"}var w=e=>typeof e=="string"&&b.includes(e);function L(e="sh"){return`language-${e??"sh"}`}import{Fragment as q,jsx as l,jsxs as T}from"react/jsx-runtime";var B=W({codeId:void 0,copyText:"",hasCodeExpander:!1,isCodeExpanded:!1,registerCodeId:()=>{},setCopyText:()=>{},setHasCodeExpander:()=>{},setIsCodeExpanded:()=>{},unregisterCodeId:()=>{}}),I=m(({className:e,...o},r)=>{let[t,a]=g(""),[n,i]=g(!1),[s,c]=g(!1),[d,f]=g(void 0),h=Y(()=>({codeId:d,copyText:t,hasCodeExpander:n,isCodeExpanded:s,registerCodeId:p=>{f(C=>(M(C==null,"You can only render a single CodeBlockCode within a CodeBlock."),p))},setCopyText:a,setHasCodeExpander:i,setIsCodeExpanded:c,unregisterCodeId:p=>{f(C=>{M(C===p,"You can only render a single CodeBlockCode within a CodeBlock.")})}}),[d,t,n,s]);return l(B.Provider,{value:h,children:l("div",{className:u("overflow-hidden rounded-md border border-gray-300 bg-gray-50 font-mono text-[0.8125rem]",e),ref:r,...o})})});I.displayName="CodeBlock";var N=m(({className:e,...o},r)=>l("div",{className:u("relative",e),ref:r,...o}));N.displayName="CodeBlockBody";var A=m((e,o)=>{let{className:r,language:t="text",style:a,value:n}=e,i=F(),{hasCodeExpander:s,isCodeExpanded:c,registerCodeId:d,setCopyText:f,unregisterCodeId:h}=v(B),p=n?.trim()??"",[C,z]=g(p);return y(()=>{let E=H.languages[t];M(E,`CodeBlock does not support the language "${t}". The syntax highlighter does not have a grammar for this language. The supported languages are: ${b.join(", ")}.`);let $=H.highlight(p,E,t);z($)},[p,t]),y(()=>{f(p)},[p,f]),y(()=>(d(i),()=>{h(i)}),[i,d,h]),l("pre",{"aria-expanded":s?c:void 0,className:u(L(t),"scrollbar firefox:after:mr-[3.375rem] firefox:after:inline-block firefox:after:content-[''] overflow-x-auto overflow-y-hidden p-4 pr-[3.375rem]","aria-collapsed:max-h-[13.6rem]",r),"data-lang":t,id:i,ref:o,style:{...a,tabSize:2,MozTabSize:2},children:l("code",{dangerouslySetInnerHTML:{__html:C}})})});A.displayName="CodeBlockCode";var P=m(({className:e,...o},r)=>l("div",{className:u("flex items-center gap-1 border-b border-gray-300 bg-gray-100 px-4 py-2 text-gray-700",e),ref:r,...o}));P.displayName="CodeBlockHeader";var j=m(({asChild:e=!1,className:o,...r},t)=>l(e?O:"h3",{ref:t,className:u("font-mono text-[0.8125rem] font-normal",o),...r}));j.displayName="CodeBlockTitle";var D=m(({className:e,onCopy:o,onCopyError:r,style:t},a)=>{let{copyText:n}=v(B),[,i]=S(),[s,c]=g(!1);return y(()=>{if(s){let d=window.setTimeout(()=>{c(!1)},2e3);return()=>{clearTimeout(d)}}},[s]),T("button",{type:"button",className:u("focus-visible:border-accent-600 focus-visible:ring-focus-accent absolute right-3 top-3 z-10 flex h-7 w-7 items-center justify-center rounded border border-gray-300 bg-gray-50 shadow-[-1rem_0_0.75rem_-0.375rem_hsl(var(--gray-50)),1rem_0_0_-0.25rem_hsl(var(--gray-50))] hover:border-gray-400 hover:bg-gray-200 focus-visible:outline-none focus-visible:ring-4",s&&"bg-filled-success text-on-filled hover:bg-filled-success focus:bg-filled-success focus-visible:border-success-600 focus-visible:ring-focus-success w-auto gap-1 border-transparent pl-2 pr-1.5 hover:border-transparent",e),ref:a,style:t,onClick:async()=>{try{await i(n),o?.(n),c(!0)}catch(d){r?.(d)}},children:[l("span",{className:"sr-only",children:"Copy code"}),s?T(q,{children:["Copied",l(Q,{className:"h-4 w-4",weight:"bold"})]}):l(V,{className:"-ml-px h-5 w-5"})]})});D.displayName="CodeBlockCopyButton";var _=m(({className:e,onClick:o,...r},t)=>{let{codeId:a,isCodeExpanded:n,setIsCodeExpanded:i,setHasCodeExpander:s}=v(B);return y(()=>(s(!0),()=>{s(!1)}),[s]),T("button",{...r,"aria-controls":a,"aria-expanded":n,className:u("flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-gray-50 px-4 py-2 font-sans text-gray-700 hover:bg-gray-100",e),ref:t,type:"button",onClick:c=>{i(d=>!d),o?.(c)},children:[n?"Show less":"Show more"," ",l(J,{className:u("h-4 w-4",n&&"rotate-180","transition-all duration-150"),weight:"bold"})]})});_.displayName="CodeBlockExpanderButton";function G(e,...o){if(!U(e)||!Array.isArray(o))throw new Error("It looks like you tried to call `fmtCode` as a function. Make sure to use it as a tagged template.\n Example: fmtCode`SELECT * FROM users`, not fmtCode('SELECT * FROM users')");let r=String.raw({raw:e},...o),t=K(r);return r.trim().split(`
2
2
  `).map(n=>/^\S+/.test(n)?n:n.slice(t)).join(`
3
- `)}function K(e){let o=e.match(/^[ \t]*(?=\S)/gm);return o?o.reduce((r,t)=>Math.min(r,t.length),1/0):0}function U(e){return Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw)}import{z as x}from"zod";var X=["file","cli"],Z=x.object({collapsible:x.boolean().default(!1),disableCopy:x.boolean().default(!1),mode:x.enum(X).optional(),title:x.string().trim().optional()}),k={collapsible:!1,disableCopy:!1,mode:void 0,title:void 0};function ee(e){let o=e?.trim()??"";if(!o)return k;let r=oe(o).reduce((t,a)=>{let[n,i]=a.split("=");if(!n)return t;let s=te(i);return t[n]=s??!0,t},{});try{let t=Z.parse(r);return{...k,...t}}catch{return k}}function te(e){return e?.trim().replace(/^"(.*)"$/,"$1")}function oe(e){let o=e?.trim()??"",r=[],t="",a=!1;for(let n of o)n===" "&&!a?t&&(r.push(t),t=""):(n==='"'&&(a=!a),t+=n);return t&&r.push(t),r}export{I as CodeBlock,N as CodeBlockBody,A as CodeBlockCode,_ as CodeBlockCopyButton,j as CodeBlockExpanderButton,P as CodeBlockHeader,D as CodeBlockTitle,k as defaultMeta,G as fmtCode,L as formatLanguageClassName,w as isSupportedLanguage,R as parseLanguage,ee as parseMetastring,b as supportedLanguages};
3
+ `)}function K(e){let o=e.match(/^[ \t]*(?=\S)/gm);return o?o.reduce((r,t)=>Math.min(r,t.length),1/0):0}function U(e){return Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw)}import{z as x}from"zod";var X=["file","cli"],Z=x.object({collapsible:x.boolean().default(!1),disableCopy:x.boolean().default(!1),mode:x.enum(X).optional(),title:x.string().trim().optional()}),k={collapsible:!1,disableCopy:!1,mode:void 0,title:void 0};function ee(e){let o=e?.trim()??"";if(!o)return k;let r=oe(o).reduce((t,a)=>{let[n,i]=a.split("=");if(!n)return t;let s=te(i);return t[n]=s??!0,t},{});try{let t=Z.parse(r);return{...k,...t}}catch{return k}}function te(e){return e?.trim().replace(/^"(.*)"$/,"$1")}function oe(e){let o=e?.trim()??"",r=[],t="",a=!1;for(let n of o)n===" "&&!a?t&&(r.push(t),t=""):(n==='"'&&(a=!a),t+=n);return t&&r.push(t),r}export{I as CodeBlock,N as CodeBlockBody,A as CodeBlockCode,D as CodeBlockCopyButton,_ as CodeBlockExpanderButton,P as CodeBlockHeader,j as CodeBlockTitle,k as defaultMeta,G as fmtCode,L as formatLanguageClassName,w as isSupportedLanguage,R as parseLanguage,ee as parseMetastring,b as supportedLanguages};
4
4
  //# sourceMappingURL=code-block.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/code-block/code-block.tsx","../src/components/code-block/supported-languages.ts","../src/components/code-block/fmt-code.ts","../src/components/code-block/parse-metastring.ts"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport Prism from \"prismjs\";\nimport { createContext, forwardRef, useContext, useEffect, useId, useMemo, useState } from \"react\";\nimport type { Dispatch, HTMLAttributes, SetStateAction } from \"react\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-csharp.js\";\nimport \"prismjs/components/prism-css.js\";\nimport \"prismjs/components/prism-go.js\";\nimport \"prismjs/components/prism-java.js\";\nimport \"prismjs/components/prism-javascript.js\";\nimport \"prismjs/components/prism-json.js\";\nimport \"prismjs/components/prism-jsx.js\";\nimport \"prismjs/components/prism-markup.js\";\nimport \"prismjs/components/prism-python.js\";\nimport \"prismjs/components/prism-ruby.js\";\nimport \"prismjs/components/prism-rust.js\";\nimport \"prismjs/components/prism-tsx.js\";\nimport \"prismjs/components/prism-typescript.js\";\nimport \"prismjs/components/prism-yaml.js\";\nimport { CaretDown } from \"@phosphor-icons/react/CaretDown\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport { Copy } from \"@phosphor-icons/react/Copy\";\nimport assert from \"tiny-invariant\";\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard\";\nimport type { WithStyleProps } from \"../../types/with-style-props\";\nimport { cx } from \"../../utils/cx\";\nimport type { LineRange } from \"./line-numbers\";\nimport { formatLanguageClassName, supportedLanguages } from \"./supported-languages\";\nimport type { SupportedLanguage } from \"./supported-languages\";\n\n/**\n * TODO(cody):\n * - fix line numbers, maybe try grid instead of :before and flex?\n * - fix line hightlighting\n * - fix line wrapping? horizontal scrolling has problems w/ line highlighting :(\n */\n\ntype CodeBlockContextType = {\n\tcodeId: string | undefined;\n\tcopyText: string;\n\thasCodeExpander: boolean;\n\tisCodeExpanded: boolean;\n\tregisterCodeId: (id: string) => void;\n\tsetCopyText: (newCopyText: string) => void;\n\tsetHasCodeExpander: (value: boolean) => void;\n\tsetIsCodeExpanded: Dispatch<SetStateAction<boolean>>;\n\tunregisterCodeId: (id: string) => void;\n};\n\nconst CodeBlockContext = createContext<CodeBlockContextType>({\n\tcodeId: undefined,\n\tcopyText: \"\",\n\thasCodeExpander: false,\n\tisCodeExpanded: false,\n\tregisterCodeId: () => {},\n\tsetCopyText: () => {},\n\tsetHasCodeExpander: () => {},\n\tsetIsCodeExpanded: () => {},\n\tunregisterCodeId: () => {},\n});\n\nconst CodeBlock = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => {\n\tconst [copyText, setCopyText] = useState(\"\");\n\tconst [hasCodeExpander, setHasCodeExpander] = useState(false);\n\tconst [isCodeExpanded, setIsCodeExpanded] = useState(false);\n\tconst [codeId, setCodeId] = useState<string | undefined>(undefined);\n\n\tconst context: CodeBlockContextType = useMemo(\n\t\t() =>\n\t\t\t({\n\t\t\t\tcodeId,\n\t\t\t\tcopyText,\n\t\t\t\thasCodeExpander,\n\t\t\t\tisCodeExpanded,\n\t\t\t\tregisterCodeId: (id) => {\n\t\t\t\t\tsetCodeId((old) => {\n\t\t\t\t\t\tassert(old == null, \"You can only render a single CodeBlockCode within a CodeBlock.\");\n\t\t\t\t\t\treturn id;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tsetCopyText,\n\t\t\t\tsetHasCodeExpander,\n\t\t\t\tsetIsCodeExpanded,\n\t\t\t\tunregisterCodeId: (id) => {\n\t\t\t\t\tsetCodeId((old) => {\n\t\t\t\t\t\tassert(old === id, \"You can only render a single CodeBlockCode within a CodeBlock.\");\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}) as const,\n\t\t[codeId, copyText, hasCodeExpander, isCodeExpanded],\n\t);\n\n\treturn (\n\t\t<CodeBlockContext.Provider value={context}>\n\t\t\t<div\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"overflow-hidden rounded-md border border-gray-300 bg-gray-50 font-mono text-[0.8125rem]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</CodeBlockContext.Provider>\n\t);\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nconst CodeBlockBody = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (\n\t<div className={cx(\"relative\", className)} ref={ref} {...props} />\n));\nCodeBlockBody.displayName = \"CodeBlockBody\";\n\ntype CodeBlockCodeProps = WithStyleProps & {\n\t/**\n\t * The code to display in the code block. Should be code formatted as a string. This code will be passed to our syntax highlighter.\n\t */\n\tvalue: string;\n\t/**\n\t * @todo not implemented yet\n\t */\n\thighlightLines?: (LineRange | number)[];\n\t/**\n\t * The language of the code block. This will be used to determine how to syntax highlight the code. @default `\"text\"`.\n\t */\n\tlanguage?: SupportedLanguage;\n\t/**\n\t * @todo not implemented yet\n\t */\n\tshowLineNumbers?: boolean;\n};\n\nconst CodeBlockCode = forwardRef<HTMLPreElement, CodeBlockCodeProps>((props, ref) => {\n\tconst { className, language = \"text\", style, value } = props;\n\tconst id = useId();\n\tconst { hasCodeExpander, isCodeExpanded, registerCodeId, setCopyText, unregisterCodeId } =\n\t\tuseContext(CodeBlockContext);\n\n\t// trim any leading and trailing whitespace/empty lines\n\tconst trimmedCode = value?.trim() ?? \"\";\n\tconst [highlightedCodeInnerHtml, setHighlightedCodeInnerHtml] = useState(trimmedCode);\n\n\tuseEffect(() => {\n\t\tconst grammar = Prism.languages[language];\n\t\tassert(\n\t\t\tgrammar,\n\t\t\t`CodeBlock does not support the language \"${language}\". The syntax highlighter does not have a grammar for this language. The supported languages are: ${supportedLanguages.join(\", \")}.`,\n\t\t);\n\t\tconst newHighlightedCodeInnerHtml = Prism.highlight(trimmedCode, grammar, language);\n\t\tsetHighlightedCodeInnerHtml(newHighlightedCodeInnerHtml);\n\t}, [trimmedCode, language]);\n\n\tuseEffect(() => {\n\t\tsetCopyText(trimmedCode);\n\t}, [trimmedCode, setCopyText]);\n\n\tuseEffect(() => {\n\t\tregisterCodeId(id);\n\n\t\treturn () => {\n\t\t\tunregisterCodeId(id);\n\t\t};\n\t}, [id, registerCodeId, unregisterCodeId]);\n\n\treturn (\n\t\t<pre\n\t\t\taria-expanded={hasCodeExpander ? isCodeExpanded : undefined}\n\t\t\tclassName={cx(\n\t\t\t\tformatLanguageClassName(language),\n\t\t\t\t\"scrollbar firefox:after:mr-[3.375rem] firefox:after:inline-block firefox:after:content-[''] overflow-x-auto overflow-y-hidden p-4 pr-[3.375rem]\",\n\t\t\t\t\"aria-collapsed:max-h-[13.6rem]\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tdata-lang={language}\n\t\t\tid={id}\n\t\t\tref={ref}\n\t\t\tstyle={{\n\t\t\t\t...style,\n\t\t\t\ttabSize: 2,\n\t\t\t\tMozTabSize: 2,\n\t\t\t}}\n\t\t>\n\t\t\t<code dangerouslySetInnerHTML={{ __html: highlightedCodeInnerHtml }} />\n\t\t</pre>\n\t);\n});\nCodeBlockCode.displayName = \"CodeBlockCode\";\n\nconst CodeBlockHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (\n\t<div\n\t\tclassName={cx(\"flex items-center gap-1 border-b border-gray-300 bg-gray-100 px-4 py-2 text-gray-700\", className)}\n\t\tref={ref}\n\t\t{...props}\n\t/>\n));\nCodeBlockHeader.displayName = \"CodeBlockHeader\";\n\nconst CodeBlockTitle = forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement> & { asChild?: boolean }>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Comp = asChild ? Slot : \"h3\";\n\t\treturn <Comp ref={ref} className={cx(\"font-mono text-[0.8125rem] font-normal\", className)} {...props} />;\n\t},\n);\nCodeBlockTitle.displayName = \"CodeBlockTitle\";\n\ntype CodeBlockCopyButtonProps = WithStyleProps & {\n\t/**\n\t * Callback fired when the copy button is clicked, passes the copied text as an argument.\n\t */\n\tonCopy?: (value: string) => void;\n\t/**\n\t * Callback fired when an error occurs during copying.\n\t */\n\tonCopyError?: (error: unknown) => void;\n};\n\nconst CodeBlockCopyButton = forwardRef<HTMLButtonElement, CodeBlockCopyButtonProps>(\n\t({ className, onCopy, onCopyError, style }, ref) => {\n\t\tconst { copyText } = useContext(CodeBlockContext);\n\t\tconst [, copyToClipboard] = useCopyToClipboard();\n\t\tconst [copied, setCopied] = useState(false);\n\n\t\tuseEffect(() => {\n\t\t\tif (copied) {\n\t\t\t\tconst timeoutId = window.setTimeout(() => {\n\t\t\t\t\tsetCopied(false);\n\t\t\t\t}, 2000);\n\n\t\t\t\treturn () => {\n\t\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\t};\n\t\t\t}\n\t\t}, [copied]);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"focus-visible:border-accent-600 focus-visible:ring-focus-accent absolute right-3 top-3 z-10 flex h-7 w-7 items-center justify-center rounded border border-gray-300 bg-gray-50 shadow-[-1rem_0_0.75rem_-0.375rem_hsl(var(--gray-50)),1rem_0_0_-0.25rem_hsl(var(--gray-50))] hover:border-gray-400 hover:bg-gray-200 focus-visible:outline-none focus-visible:ring-4\",\n\t\t\t\t\tcopied &&\n\t\t\t\t\t\t\"bg-filled-success text-on-filled hover:bg-filled-success focus:bg-filled-success focus-visible:border-success-600 focus-visible:ring-focus-success w-auto gap-1 border-transparent pl-2 pr-1.5 hover:border-transparent\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\tstyle={style}\n\t\t\t\tonClick={async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/await-thenable\n\t\t\t\t\t\tawait copyToClipboard(copyText);\n\t\t\t\t\t\tonCopy?.(copyText);\n\t\t\t\t\t\tsetCopied(true);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tonCopyError?.(error);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span className=\"sr-only\">Copy code</span>\n\t\t\t\t{copied ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\tCopied\n\t\t\t\t\t\t<Check className=\"h-4 w-4\" weight=\"bold\" />\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<Copy className=\"-ml-px h-5 w-5\" />\n\t\t\t\t)}\n\t\t\t</button>\n\t\t);\n\t},\n);\nCodeBlockCopyButton.displayName = \"CodeBlockCopyButton\";\n\ntype CodeBlockExpanderButtonProps = Omit<\n\tHTMLAttributes<HTMLButtonElement>,\n\t\"children\" | \"aria-controls\" | \"aria-expanded\"\n>;\n\nconst CodeBlockExpanderButton = forwardRef<HTMLButtonElement, CodeBlockExpanderButtonProps>(\n\t({ className, onClick, ...props }, ref) => {\n\t\tconst { codeId, isCodeExpanded, setIsCodeExpanded, setHasCodeExpander } = useContext(CodeBlockContext);\n\n\t\tuseEffect(() => {\n\t\t\tsetHasCodeExpander(true);\n\n\t\t\treturn () => {\n\t\t\t\tsetHasCodeExpander(false);\n\t\t\t};\n\t\t}, [setHasCodeExpander]);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\t{...props}\n\t\t\t\taria-controls={codeId}\n\t\t\t\taria-expanded={isCodeExpanded}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-gray-50 px-4 py-2 font-sans text-gray-700 hover:bg-gray-100\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tsetIsCodeExpanded((prev) => !prev);\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isCodeExpanded ? \"Show less\" : \"Show more\"}{\" \"}\n\t\t\t\t<CaretDown\n\t\t\t\t\tclassName={cx(\"h-4 w-4\", isCodeExpanded && \"rotate-180\", \"transition-all duration-150\")}\n\t\t\t\t\tweight=\"bold\"\n\t\t\t\t/>\n\t\t\t</button>\n\t\t);\n\t},\n);\nCodeBlockExpanderButton.displayName = \"CodeBlockExpanderButton\";\n\nexport {\n\tCodeBlock,\n\tCodeBlockBody,\n\tCodeBlockCode,\n\tCodeBlockCopyButton,\n\tCodeBlockExpanderButton,\n\tCodeBlockHeader,\n\tCodeBlockTitle,\n};\n","/**\n * List of supported languages for syntax highlighting.\n * @private\n */\nexport const supportedLanguages = [\n\t\"bash\",\n\t\"cs\",\n\t\"csharp\",\n\t\"css\",\n\t\"dotnet\",\n\t\"go\",\n\t\"html\",\n\t\"java\",\n\t\"javascript\",\n\t\"js\",\n\t\"json\",\n\t\"jsx\",\n\t\"markup\",\n\t\"plain\",\n\t\"plaintext\",\n\t\"py\",\n\t\"python\",\n\t\"rb\",\n\t\"ruby\",\n\t\"rust\",\n\t\"sh\",\n\t\"shell\",\n\t\"text\",\n\t\"ts\",\n\t\"tsx\",\n\t\"txt\",\n\t\"typescript\",\n\t\"xml\",\n\t\"yaml\",\n\t\"yml\",\n] as const;\n\n/**\n * Supported languages for syntax highlighting.\n */\ntype SupportedLanguage = (typeof supportedLanguages)[number];\n\n/**\n * Parses a markdown code block (```) language class into a SupportedLanguage.\n * Defaults to \"sh\" if no supported language is found.\n */\nfunction parseLanguage(value: `language-${string}` | `lang-${string}` | (string & {}) | undefined): SupportedLanguage {\n\tif (!value) {\n\t\treturn \"sh\";\n\t}\n\n\t// remove leading \"language-\" and \"lang-\" prefixes\n\t// find first '-' and slice from there\n\tconst maybeLanguage = value.trim().slice(value.indexOf(\"-\") + 1);\n\n\treturn isSupportedLanguage(maybeLanguage) ? maybeLanguage : \"sh\";\n}\n\n/**\n * Type Predicate: checks if an arbitrary value is a supported syntax highlighting language.\n */\nconst isSupportedLanguage = (value: unknown): value is SupportedLanguage => {\n\treturn typeof value === \"string\" && supportedLanguages.includes(value as SupportedLanguage);\n};\n\n/**\n * A class name for a language that Prism.js can understand.\n */\ntype LanguageClass = `language-${SupportedLanguage}`;\n\n/**\n * Formats a language name into a class name that Prism.js can understand.\n * @default \"language-sh\"\n */\nfunction formatLanguageClassName(language: SupportedLanguage | undefined = \"sh\") {\n\tconst lang = language ?? \"sh\";\n\tconst className: LanguageClass = `language-${lang}`;\n\treturn className;\n}\n\nexport { isSupportedLanguage, parseLanguage, formatLanguageClassName };\nexport type { SupportedLanguage };\n","type Primitive = string | number | boolean | undefined | null;\n\n/**\n * Tagged template literal to format code blocks and normalize leading indentation\n */\nexport function fmtCode(strings: TemplateStringsArray, ...values: Primitive[]): string {\n\tif (!isTemplateStringsArray(strings) || !Array.isArray(values)) {\n\t\tthrow new Error(\n\t\t\t\"It looks like you tried to call `fmtCode` as a function. Make sure to use it as a tagged template.\\n\\tExample: fmtCode`SELECT * FROM users`, not fmtCode('SELECT * FROM users')\",\n\t\t);\n\t}\n\n\tconst text = String.raw({ raw: strings }, ...values);\n\n\t// fine the minimum indentation of the code block\n\tconst minIndent = findMinIndent(text);\n\tconst lines = text.trim().split(\"\\n\");\n\n\treturn lines\n\t\t.map((line) => {\n\t\t\t// remove nothing if the line doesn't start with indentation\n\t\t\tif (/^\\S+/.test(line)) {\n\t\t\t\treturn line;\n\t\t\t}\n\t\t\treturn line.slice(minIndent);\n\t\t})\n\t\t.join(\"\\n\");\n\t// replace all tabs with 2 spaces\n\t// .replace(/\\t/g, \" \")\n}\n\n/**\n * Find the shortest indentation of a multiline string\n */\nfunction findMinIndent(value: string): number {\n\tconst match = value.match(/^[ \\t]*(?=\\S)/gm);\n\n\tif (!match) {\n\t\treturn 0;\n\t}\n\n\treturn match.reduce((acc, curr) => Math.min(acc, curr.length), Infinity);\n}\n\n/**\n * Type guard to check if a value is a `TemplateStringsArray`\n */\nfunction isTemplateStringsArray(strings: unknown): strings is TemplateStringsArray {\n\treturn Array.isArray(strings) && \"raw\" in strings && Array.isArray(strings.raw);\n}\n","import { z } from \"zod\";\n\nconst modes = [\"file\", \"cli\"] as const;\ntype Mode = (typeof modes)[number];\n\nconst metaSchema = z.object({\n\tcollapsible: z.boolean().default(false),\n\tdisableCopy: z.boolean().default(false),\n\tmode: z.enum(modes).optional(),\n\ttitle: z.string().trim().optional(),\n});\n\ntype MetaInput = z.input<typeof metaSchema>;\n\ntype Meta = z.infer<typeof metaSchema>;\n\nconst defaultMeta = {\n\tcollapsible: false,\n\tdisableCopy: false,\n\tmode: undefined,\n\ttitle: undefined,\n} as const satisfies Meta;\n\ntype DefaultMeta = typeof defaultMeta;\n\n/**\n * Parses a markdown code block (```) metastring into a meta object.\n * Defaults to DefaultMeta if no metastring given or if metastring is invalid.\n * Useful for parsing the metastring from a markdown code block to pass into the\n * CodeBlock components as props.\n */\nfunction parseMetastring(value: string | undefined): Meta {\n\tconst metastring = value?.trim() ?? \"\";\n\tif (!metastring) {\n\t\treturn defaultMeta;\n\t}\n\n\tconst metaJson = tokenizeMetastring(metastring).reduce<Record<string, unknown>>((acc, token) => {\n\t\tconst [key, _value] = token.split(\"=\");\n\t\tif (!key) {\n\t\t\treturn acc;\n\t\t}\n\t\tconst value = normalizeValue(_value);\n\t\tacc[key] = value ?? true;\n\t\treturn acc;\n\t}, {});\n\n\ttry {\n\t\tconst parsed = metaSchema.parse(metaJson);\n\n\t\t// return the parsed meta object, with default values filled in\n\t\treturn {\n\t\t\t...defaultMeta,\n\t\t\t...parsed,\n\t\t};\n\t} catch (_) {\n\t\treturn defaultMeta;\n\t}\n}\n\nexport { defaultMeta, parseMetastring };\nexport type { Meta, MetaInput, Mode, DefaultMeta };\n\n/**\n * Remove leading and trailing `\"` quotes around value\n * @private\n */\nexport function normalizeValue(value: string | undefined) {\n\treturn value?.trim().replace(/^\"(.*)\"$/, \"$1\");\n}\n\n/**\n * Splits a metastring into an array of tokens that can be parsed into a meta object.\n * Should allow for quotes and spaces in tokens\n * @private\n */\nexport function tokenizeMetastring(value: string | undefined): string[] {\n\tconst input = value?.trim() ?? \"\";\n\tconst result: string[] = [];\n\n\tlet currentString = \"\";\n\tlet inQuotes = false;\n\n\tfor (const char of input) {\n\t\tif (char === \" \" && !inQuotes) {\n\t\t\tif (currentString) {\n\t\t\t\tresult.push(currentString);\n\t\t\t\tcurrentString = \"\";\n\t\t\t}\n\t\t} else if (char === '\"') {\n\t\t\tinQuotes = !inQuotes;\n\t\t\tcurrentString += char;\n\t\t} else {\n\t\t\tcurrentString += char;\n\t\t}\n\t}\n\n\tif (currentString) {\n\t\tresult.push(currentString);\n\t}\n\n\treturn result;\n}\n"],"mappings":"gFAAA,OAAS,QAAAA,MAAY,uBACrB,OAAOC,MAAW,UAClB,OAAS,iBAAAC,EAAe,cAAAC,EAAY,cAAAC,EAAY,aAAAC,EAAW,SAAAC,EAAO,WAAAC,EAAS,YAAAC,MAAgB,QAE3F,MAAO,mCACP,MAAO,mCACP,MAAO,qCACP,MAAO,kCACP,MAAO,iCACP,MAAO,mCACP,MAAO,yCACP,MAAO,mCACP,MAAO,kCACP,MAAO,qCACP,MAAO,qCACP,MAAO,mCACP,MAAO,mCACP,MAAO,kCACP,MAAO,yCACP,MAAO,mCACP,OAAS,aAAAC,MAAiB,kCAC1B,OAAS,SAAAC,MAAa,8BACtB,OAAS,QAAAC,MAAY,6BACrB,OAAOC,MAAY,iBCnBZ,IAAMC,EAAqB,CACjC,OACA,KACA,SACA,MACA,SACA,KACA,OACA,OACA,aACA,KACA,OACA,MACA,SACA,QACA,YACA,KACA,SACA,KACA,OACA,OACA,KACA,QACA,OACA,KACA,MACA,MACA,aACA,MACA,OACA,KACD,EAWA,SAASC,EAAcC,EAA+F,CACrH,GAAI,CAACA,EACJ,MAAO,KAKR,IAAMC,EAAgBD,EAAM,KAAK,EAAE,MAAMA,EAAM,QAAQ,GAAG,EAAI,CAAC,EAE/D,OAAOE,EAAoBD,CAAa,EAAIA,EAAgB,IAC7D,CAKA,IAAMC,EAAuBF,GACrB,OAAOA,GAAU,UAAYF,EAAmB,SAASE,CAA0B,EAY3F,SAASG,EAAwBC,EAA0C,KAAM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ACHD,EAAO,KAAKC,CAAa,EACzBA,EAAgB,KAEPE,IAAS,MACnBD,EAAW,CAACA,GACZD,GAAiBE,GAMnB,OAAIF,GACHD,EAAO,KAAKC,CAAa,EAGnBD,CACR","names":["Slot","Prism","createContext","forwardRef","useContext","useEffect","useId","useMemo","useState","CaretDown","Check","Copy","assert","supportedLanguages","parseLanguage","value","maybeLanguage","isSupportedLanguage","formatLanguageClassName","language","Fragment","jsx","jsxs","CodeBlockContext","createContext","CodeBlock","forwardRef","className","props","ref","copyText","setCopyText","useState","hasCodeExpander","setHasCodeExpander","isCodeExpanded","setIsCodeExpanded","codeId","setCodeId","context","useMemo","id","old","assert","cx","CodeBlockBody","CodeBlockCode","language","style","value","useId","registerCodeId","unregisterCodeId","useContext","trimmedCode","highlightedCodeInnerHtml","setHighlightedCodeInnerHtml","useEffect","grammar","Prism","supportedLanguages","newHighlightedCodeInnerHtml","formatLanguageClassName","CodeBlockHeader","CodeBlockTitle","asChild","Slot","CodeBlockCopyButton","onCopy","onCopyError","copyToClipboard","useCopyToClipboard","copied","setCopied","timeoutId","error","Check","Copy","CodeBlockExpanderButton","onClick","event","prev","CaretDown","fmtCode","strings","values","isTemplateStringsArray","text","minIndent","findMinIndent","line","value","match","acc","curr","z","modes","metaSchema","defaultMeta","parseMetastring","value","metastring","metaJson","tokenizeMetastring","acc","token","key","_value","normalizeValue","parsed","normalizeValue","value","tokenizeMetastring","input","result","currentString","inQuotes","char"]}
1
+ {"version":3,"sources":["../src/components/code-block/code-block.tsx","../src/components/code-block/supported-languages.ts","../src/components/code-block/fmt-code.ts","../src/components/code-block/parse-metastring.ts"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport Prism from \"prismjs\";\nimport { createContext, forwardRef, useContext, useEffect, useId, useMemo, useState } from \"react\";\nimport type { Dispatch, HTMLAttributes, SetStateAction } from \"react\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-csharp.js\";\nimport \"prismjs/components/prism-css.js\";\nimport \"prismjs/components/prism-go.js\";\nimport \"prismjs/components/prism-java.js\";\nimport \"prismjs/components/prism-javascript.js\";\nimport \"prismjs/components/prism-json.js\";\nimport \"prismjs/components/prism-jsx.js\";\nimport \"prismjs/components/prism-markup.js\";\nimport \"prismjs/components/prism-python.js\";\nimport \"prismjs/components/prism-ruby.js\";\nimport \"prismjs/components/prism-rust.js\";\nimport \"prismjs/components/prism-tsx.js\";\nimport \"prismjs/components/prism-typescript.js\";\nimport \"prismjs/components/prism-yaml.js\";\nimport { CaretDown } from \"@phosphor-icons/react/CaretDown\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport { Copy } from \"@phosphor-icons/react/Copy\";\nimport assert from \"tiny-invariant\";\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard.js\";\nimport type { WithStyleProps } from \"../../types/with-style-props.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport type { LineRange } from \"./line-numbers.js\";\nimport { formatLanguageClassName, supportedLanguages } from \"./supported-languages.js\";\nimport type { SupportedLanguage } from \"./supported-languages.js\";\n\n/**\n * TODO(cody):\n * - fix line numbers, maybe try grid instead of :before and flex?\n * - fix line hightlighting\n * - fix line wrapping? horizontal scrolling has problems w/ line highlighting :(\n */\n\ntype CodeBlockContextType = {\n\tcodeId: string | undefined;\n\tcopyText: string;\n\thasCodeExpander: boolean;\n\tisCodeExpanded: boolean;\n\tregisterCodeId: (id: string) => void;\n\tsetCopyText: (newCopyText: string) => void;\n\tsetHasCodeExpander: (value: boolean) => void;\n\tsetIsCodeExpanded: Dispatch<SetStateAction<boolean>>;\n\tunregisterCodeId: (id: string) => void;\n};\n\nconst CodeBlockContext = createContext<CodeBlockContextType>({\n\tcodeId: undefined,\n\tcopyText: \"\",\n\thasCodeExpander: false,\n\tisCodeExpanded: false,\n\tregisterCodeId: () => {},\n\tsetCopyText: () => {},\n\tsetHasCodeExpander: () => {},\n\tsetIsCodeExpanded: () => {},\n\tunregisterCodeId: () => {},\n});\n\nconst CodeBlock = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => {\n\tconst [copyText, setCopyText] = useState(\"\");\n\tconst [hasCodeExpander, setHasCodeExpander] = useState(false);\n\tconst [isCodeExpanded, setIsCodeExpanded] = useState(false);\n\tconst [codeId, setCodeId] = useState<string | undefined>(undefined);\n\n\tconst context: CodeBlockContextType = useMemo(\n\t\t() =>\n\t\t\t({\n\t\t\t\tcodeId,\n\t\t\t\tcopyText,\n\t\t\t\thasCodeExpander,\n\t\t\t\tisCodeExpanded,\n\t\t\t\tregisterCodeId: (id) => {\n\t\t\t\t\tsetCodeId((old) => {\n\t\t\t\t\t\tassert(old == null, \"You can only render a single CodeBlockCode within a CodeBlock.\");\n\t\t\t\t\t\treturn id;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tsetCopyText,\n\t\t\t\tsetHasCodeExpander,\n\t\t\t\tsetIsCodeExpanded,\n\t\t\t\tunregisterCodeId: (id) => {\n\t\t\t\t\tsetCodeId((old) => {\n\t\t\t\t\t\tassert(old === id, \"You can only render a single CodeBlockCode within a CodeBlock.\");\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t}) as const,\n\t\t[codeId, copyText, hasCodeExpander, isCodeExpanded],\n\t);\n\n\treturn (\n\t\t<CodeBlockContext.Provider value={context}>\n\t\t\t<div\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"overflow-hidden rounded-md border border-gray-300 bg-gray-50 font-mono text-[0.8125rem]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</CodeBlockContext.Provider>\n\t);\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nconst CodeBlockBody = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (\n\t<div className={cx(\"relative\", className)} ref={ref} {...props} />\n));\nCodeBlockBody.displayName = \"CodeBlockBody\";\n\ntype CodeBlockCodeProps = WithStyleProps & {\n\t/**\n\t * The code to display in the code block. Should be code formatted as a string. This code will be passed to our syntax highlighter.\n\t */\n\tvalue: string;\n\t/**\n\t * @todo not implemented yet\n\t */\n\thighlightLines?: (LineRange | number)[];\n\t/**\n\t * The language of the code block. This will be used to determine how to syntax highlight the code. @default `\"text\"`.\n\t */\n\tlanguage?: SupportedLanguage;\n\t/**\n\t * @todo not implemented yet\n\t */\n\tshowLineNumbers?: boolean;\n};\n\nconst CodeBlockCode = forwardRef<HTMLPreElement, CodeBlockCodeProps>((props, ref) => {\n\tconst { className, language = \"text\", style, value } = props;\n\tconst id = useId();\n\tconst { hasCodeExpander, isCodeExpanded, registerCodeId, setCopyText, unregisterCodeId } =\n\t\tuseContext(CodeBlockContext);\n\n\t// trim any leading and trailing whitespace/empty lines\n\tconst trimmedCode = value?.trim() ?? \"\";\n\tconst [highlightedCodeInnerHtml, setHighlightedCodeInnerHtml] = useState(trimmedCode);\n\n\tuseEffect(() => {\n\t\tconst grammar = Prism.languages[language];\n\t\tassert(\n\t\t\tgrammar,\n\t\t\t`CodeBlock does not support the language \"${language}\". The syntax highlighter does not have a grammar for this language. The supported languages are: ${supportedLanguages.join(\", \")}.`,\n\t\t);\n\t\tconst newHighlightedCodeInnerHtml = Prism.highlight(trimmedCode, grammar, language);\n\t\tsetHighlightedCodeInnerHtml(newHighlightedCodeInnerHtml);\n\t}, [trimmedCode, language]);\n\n\tuseEffect(() => {\n\t\tsetCopyText(trimmedCode);\n\t}, [trimmedCode, setCopyText]);\n\n\tuseEffect(() => {\n\t\tregisterCodeId(id);\n\n\t\treturn () => {\n\t\t\tunregisterCodeId(id);\n\t\t};\n\t}, [id, registerCodeId, unregisterCodeId]);\n\n\treturn (\n\t\t<pre\n\t\t\taria-expanded={hasCodeExpander ? isCodeExpanded : undefined}\n\t\t\tclassName={cx(\n\t\t\t\tformatLanguageClassName(language),\n\t\t\t\t\"scrollbar firefox:after:mr-[3.375rem] firefox:after:inline-block firefox:after:content-[''] overflow-x-auto overflow-y-hidden p-4 pr-[3.375rem]\",\n\t\t\t\t\"aria-collapsed:max-h-[13.6rem]\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tdata-lang={language}\n\t\t\tid={id}\n\t\t\tref={ref}\n\t\t\tstyle={{\n\t\t\t\t...style,\n\t\t\t\ttabSize: 2,\n\t\t\t\tMozTabSize: 2,\n\t\t\t}}\n\t\t>\n\t\t\t<code dangerouslySetInnerHTML={{ __html: highlightedCodeInnerHtml }} />\n\t\t</pre>\n\t);\n});\nCodeBlockCode.displayName = \"CodeBlockCode\";\n\nconst CodeBlockHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (\n\t<div\n\t\tclassName={cx(\"flex items-center gap-1 border-b border-gray-300 bg-gray-100 px-4 py-2 text-gray-700\", className)}\n\t\tref={ref}\n\t\t{...props}\n\t/>\n));\nCodeBlockHeader.displayName = \"CodeBlockHeader\";\n\nconst CodeBlockTitle = forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement> & { asChild?: boolean }>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Comp = asChild ? Slot : \"h3\";\n\t\treturn <Comp ref={ref} className={cx(\"font-mono text-[0.8125rem] font-normal\", className)} {...props} />;\n\t},\n);\nCodeBlockTitle.displayName = \"CodeBlockTitle\";\n\ntype CodeBlockCopyButtonProps = WithStyleProps & {\n\t/**\n\t * Callback fired when the copy button is clicked, passes the copied text as an argument.\n\t */\n\tonCopy?: (value: string) => void;\n\t/**\n\t * Callback fired when an error occurs during copying.\n\t */\n\tonCopyError?: (error: unknown) => void;\n};\n\nconst CodeBlockCopyButton = forwardRef<HTMLButtonElement, CodeBlockCopyButtonProps>(\n\t({ className, onCopy, onCopyError, style }, ref) => {\n\t\tconst { copyText } = useContext(CodeBlockContext);\n\t\tconst [, copyToClipboard] = useCopyToClipboard();\n\t\tconst [copied, setCopied] = useState(false);\n\n\t\tuseEffect(() => {\n\t\t\tif (copied) {\n\t\t\t\tconst timeoutId = window.setTimeout(() => {\n\t\t\t\t\tsetCopied(false);\n\t\t\t\t}, 2000);\n\n\t\t\t\treturn () => {\n\t\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\t};\n\t\t\t}\n\t\t}, [copied]);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"focus-visible:border-accent-600 focus-visible:ring-focus-accent absolute right-3 top-3 z-10 flex h-7 w-7 items-center justify-center rounded border border-gray-300 bg-gray-50 shadow-[-1rem_0_0.75rem_-0.375rem_hsl(var(--gray-50)),1rem_0_0_-0.25rem_hsl(var(--gray-50))] hover:border-gray-400 hover:bg-gray-200 focus-visible:outline-none focus-visible:ring-4\",\n\t\t\t\t\tcopied &&\n\t\t\t\t\t\t\"bg-filled-success text-on-filled hover:bg-filled-success focus:bg-filled-success focus-visible:border-success-600 focus-visible:ring-focus-success w-auto gap-1 border-transparent pl-2 pr-1.5 hover:border-transparent\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\tstyle={style}\n\t\t\t\tonClick={async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/await-thenable\n\t\t\t\t\t\tawait copyToClipboard(copyText);\n\t\t\t\t\t\tonCopy?.(copyText);\n\t\t\t\t\t\tsetCopied(true);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tonCopyError?.(error);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span className=\"sr-only\">Copy code</span>\n\t\t\t\t{copied ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\tCopied\n\t\t\t\t\t\t<Check className=\"h-4 w-4\" weight=\"bold\" />\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<Copy className=\"-ml-px h-5 w-5\" />\n\t\t\t\t)}\n\t\t\t</button>\n\t\t);\n\t},\n);\nCodeBlockCopyButton.displayName = \"CodeBlockCopyButton\";\n\ntype CodeBlockExpanderButtonProps = Omit<\n\tHTMLAttributes<HTMLButtonElement>,\n\t\"children\" | \"aria-controls\" | \"aria-expanded\"\n>;\n\nconst CodeBlockExpanderButton = forwardRef<HTMLButtonElement, CodeBlockExpanderButtonProps>(\n\t({ className, onClick, ...props }, ref) => {\n\t\tconst { codeId, isCodeExpanded, setIsCodeExpanded, setHasCodeExpander } = useContext(CodeBlockContext);\n\n\t\tuseEffect(() => {\n\t\t\tsetHasCodeExpander(true);\n\n\t\t\treturn () => {\n\t\t\t\tsetHasCodeExpander(false);\n\t\t\t};\n\t\t}, [setHasCodeExpander]);\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\t{...props}\n\t\t\t\taria-controls={codeId}\n\t\t\t\taria-expanded={isCodeExpanded}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-gray-50 px-4 py-2 font-sans text-gray-700 hover:bg-gray-100\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tref={ref}\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tsetIsCodeExpanded((prev) => !prev);\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{isCodeExpanded ? \"Show less\" : \"Show more\"}{\" \"}\n\t\t\t\t<CaretDown\n\t\t\t\t\tclassName={cx(\"h-4 w-4\", isCodeExpanded && \"rotate-180\", \"transition-all duration-150\")}\n\t\t\t\t\tweight=\"bold\"\n\t\t\t\t/>\n\t\t\t</button>\n\t\t);\n\t},\n);\nCodeBlockExpanderButton.displayName = \"CodeBlockExpanderButton\";\n\nexport {\n\tCodeBlock,\n\tCodeBlockBody,\n\tCodeBlockCode,\n\tCodeBlockCopyButton,\n\tCodeBlockExpanderButton,\n\tCodeBlockHeader,\n\tCodeBlockTitle,\n};\n","/**\n * List of supported languages for syntax highlighting.\n * @private\n */\nexport const supportedLanguages = [\n\t\"bash\",\n\t\"cs\",\n\t\"csharp\",\n\t\"css\",\n\t\"dotnet\",\n\t\"go\",\n\t\"html\",\n\t\"java\",\n\t\"javascript\",\n\t\"js\",\n\t\"json\",\n\t\"jsx\",\n\t\"markup\",\n\t\"plain\",\n\t\"plaintext\",\n\t\"py\",\n\t\"python\",\n\t\"rb\",\n\t\"ruby\",\n\t\"rust\",\n\t\"sh\",\n\t\"shell\",\n\t\"text\",\n\t\"ts\",\n\t\"tsx\",\n\t\"txt\",\n\t\"typescript\",\n\t\"xml\",\n\t\"yaml\",\n\t\"yml\",\n] as const;\n\n/**\n * Supported languages for syntax highlighting.\n */\ntype SupportedLanguage = (typeof supportedLanguages)[number];\n\n/**\n * Parses a markdown code block (```) language class into a SupportedLanguage.\n * Defaults to \"sh\" if no supported language is found.\n */\nfunction parseLanguage(value: `language-${string}` | `lang-${string}` | (string & {}) | undefined): SupportedLanguage {\n\tif (!value) {\n\t\treturn \"sh\";\n\t}\n\n\t// remove leading \"language-\" and \"lang-\" prefixes\n\t// find first '-' and slice from there\n\tconst maybeLanguage = value.trim().slice(value.indexOf(\"-\") + 1);\n\n\treturn isSupportedLanguage(maybeLanguage) ? maybeLanguage : \"sh\";\n}\n\n/**\n * Type Predicate: checks if an arbitrary value is a supported syntax highlighting language.\n */\nconst isSupportedLanguage = (value: unknown): value is SupportedLanguage => {\n\treturn typeof value === \"string\" && supportedLanguages.includes(value as SupportedLanguage);\n};\n\n/**\n * A class name for a language that Prism.js can understand.\n */\ntype LanguageClass = `language-${SupportedLanguage}`;\n\n/**\n * Formats a language name into a class name that Prism.js can understand.\n * @default \"language-sh\"\n */\nfunction formatLanguageClassName(language: SupportedLanguage | undefined = \"sh\") {\n\tconst lang = language ?? \"sh\";\n\tconst className: LanguageClass = `language-${lang}`;\n\treturn className;\n}\n\nexport { isSupportedLanguage, parseLanguage, formatLanguageClassName };\nexport type { SupportedLanguage };\n","type Primitive = string | number | boolean | undefined | null;\n\n/**\n * Tagged template literal to format code blocks and normalize leading indentation\n */\nexport function fmtCode(strings: TemplateStringsArray, ...values: Primitive[]): string {\n\tif (!isTemplateStringsArray(strings) || !Array.isArray(values)) {\n\t\tthrow new Error(\n\t\t\t\"It looks like you tried to call `fmtCode` as a function. Make sure to use it as a tagged template.\\n\\tExample: fmtCode`SELECT * FROM users`, not fmtCode('SELECT * FROM users')\",\n\t\t);\n\t}\n\n\tconst text = String.raw({ raw: strings }, ...values);\n\n\t// fine the minimum indentation of the code block\n\tconst minIndent = findMinIndent(text);\n\tconst lines = text.trim().split(\"\\n\");\n\n\treturn lines\n\t\t.map((line) => {\n\t\t\t// remove nothing if the line doesn't start with indentation\n\t\t\tif (/^\\S+/.test(line)) {\n\t\t\t\treturn line;\n\t\t\t}\n\t\t\treturn line.slice(minIndent);\n\t\t})\n\t\t.join(\"\\n\");\n\t// replace all tabs with 2 spaces\n\t// .replace(/\\t/g, \" \")\n}\n\n/**\n * Find the shortest indentation of a multiline string\n */\nfunction findMinIndent(value: string): number {\n\tconst match = value.match(/^[ \\t]*(?=\\S)/gm);\n\n\tif (!match) {\n\t\treturn 0;\n\t}\n\n\treturn match.reduce((acc, curr) => Math.min(acc, curr.length), Infinity);\n}\n\n/**\n * Type guard to check if a value is a `TemplateStringsArray`\n */\nfunction isTemplateStringsArray(strings: unknown): strings is TemplateStringsArray {\n\treturn Array.isArray(strings) && \"raw\" in strings && Array.isArray(strings.raw);\n}\n","import { z } from \"zod\";\n\nconst modes = [\"file\", \"cli\"] as const;\ntype Mode = (typeof modes)[number];\n\nconst metaSchema = z.object({\n\tcollapsible: z.boolean().default(false),\n\tdisableCopy: z.boolean().default(false),\n\tmode: z.enum(modes).optional(),\n\ttitle: z.string().trim().optional(),\n});\n\ntype MetaInput = z.input<typeof metaSchema>;\n\ntype Meta = z.infer<typeof metaSchema>;\n\nconst defaultMeta = {\n\tcollapsible: false,\n\tdisableCopy: false,\n\tmode: undefined,\n\ttitle: undefined,\n} as const satisfies Meta;\n\ntype DefaultMeta = typeof defaultMeta;\n\n/**\n * Parses a markdown code block (```) metastring into a meta object.\n * Defaults to DefaultMeta if no metastring given or if metastring is invalid.\n * Useful for parsing the metastring from a markdown code block to pass into the\n * CodeBlock components as props.\n */\nfunction parseMetastring(value: string | undefined): Meta {\n\tconst metastring = value?.trim() ?? \"\";\n\tif (!metastring) {\n\t\treturn defaultMeta;\n\t}\n\n\tconst metaJson = tokenizeMetastring(metastring).reduce<Record<string, unknown>>((acc, token) => {\n\t\tconst [key, _value] = token.split(\"=\");\n\t\tif (!key) {\n\t\t\treturn acc;\n\t\t}\n\t\tconst value = normalizeValue(_value);\n\t\tacc[key] = value ?? true;\n\t\treturn acc;\n\t}, {});\n\n\ttry {\n\t\tconst parsed = metaSchema.parse(metaJson);\n\n\t\t// return the parsed meta object, with default values filled in\n\t\treturn {\n\t\t\t...defaultMeta,\n\t\t\t...parsed,\n\t\t};\n\t} catch (_) {\n\t\treturn defaultMeta;\n\t}\n}\n\nexport { defaultMeta, parseMetastring };\nexport type { Meta, MetaInput, Mode, DefaultMeta };\n\n/**\n * Remove leading and trailing `\"` quotes around value\n * @private\n */\nexport function normalizeValue(value: string | undefined) {\n\treturn value?.trim().replace(/^\"(.*)\"$/, \"$1\");\n}\n\n/**\n * Splits a metastring into an array of tokens that can be parsed into a meta object.\n * Should allow for quotes and spaces in tokens\n * @private\n */\nexport function tokenizeMetastring(value: string | undefined): string[] {\n\tconst input = value?.trim() ?? \"\";\n\tconst result: string[] = [];\n\n\tlet currentString = \"\";\n\tlet inQuotes = false;\n\n\tfor (const char of input) {\n\t\tif (char === \" \" && !inQuotes) {\n\t\t\tif (currentString) {\n\t\t\t\tresult.push(currentString);\n\t\t\t\tcurrentString = \"\";\n\t\t\t}\n\t\t} else if (char === '\"') {\n\t\t\tinQuotes = !inQuotes;\n\t\t\tcurrentString += char;\n\t\t} else {\n\t\t\tcurrentString += char;\n\t\t}\n\t}\n\n\tif (currentString) {\n\t\tresult.push(currentString);\n\t}\n\n\treturn result;\n}\n"],"mappings":"gFAAA,OAAS,QAAAA,MAAY,uBACrB,OAAOC,MAAW,UAClB,OAAS,iBAAAC,EAAe,cAAAC,EAAY,cAAAC,EAAY,aAAAC,EAAW,SAAAC,EAAO,WAAAC,EAAS,YAAAC,MAAgB,QAE3F,MAAO,mCACP,MAAO,mCACP,MAAO,qCACP,MAAO,kCACP,MAAO,iCACP,MAAO,mCACP,MAAO,yCACP,MAAO,mCACP,MAAO,kCACP,MAAO,qCACP,MAAO,qCACP,MAAO,mCACP,MAAO,mCACP,MAAO,kCACP,MAAO,yCACP,MAAO,mCACP,OAAS,aAAAC,MAAiB,kCAC1B,OAAS,SAAAC,MAAa,8BACtB,OAAS,QAAAC,MAAY,6BACrB,OAAOC,MAAY,iBCnBZ,IAAMC,EAAqB,CACjC,OACA,KACA,SACA,MACA,SACA,KACA,OACA,OACA,aACA,KACA,OACA,MACA,SACA,QACA,YACA,KACA,SACA,KACA,OACA,OACA,KACA,QACA,OACA,KACA,MACA,MACA,aACA,MACA,OACA,KACD,EAWA,SAASC,EAAcC,EAA+F,CACrH,GAAI,CAACA,EACJ,MAAO,KAKR,IAAMC,EAAgBD,EAAM,KAAK,EAAE,MAAMA,EAAM,QAAQ,GAAG,EAAI,CAAC,EAE/D,OAAOE,EAAoBD,CAAa,EAAIA,EAAgB,IAC7D,CAKA,IAAMC,EAAuBF,GACrB,OAAOA,GAAU,UAAYF,EAAmB,SAASE,CAA0B,EAY3F,SAASG,EAAwBC,EAA0C,KAAM,CAGhF,MADiC,YADpBA,GAAY,IACwB,EAElD,CDkBG,OAmKE,YAAAC,EAnKF,OAAAC,EAmKE,QAAAC,MAnKF,oBA9CH,IAAMC,EAAmBC,EAAoC,CAC5D,OAAQ,OACR,SAAU,GACV,gBAAiB,GACjB,eAAgB,GAChB,eAAgB,IAAM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KAAK,EAGtBC,EAAaF,EAAE,OAAO,CAC3B,YAAaA,EAAE,QAAQ,EAAE,QAAQ,EAAK,EACtC,YAAaA,EAAE,QAAQ,EAAE,QAAQ,EAAK,EACtC,KAAMA,EAAE,KAAKC,CAAK,EAAE,SAAS,EAC7B,MAAOD,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,CACnC,CAAC,EAMKG,EAAc,CACnB,YAAa,GACb,YAAa,GACb,KAAM,OACN,MAAO,MACR,EAUA,SAASC,GAAgBC,EAAiC,CACzD,IAAMC,EAAaD,GAAO,KAAK,GAAK,GACpC,GAAI,CAACC,EACJ,OAAOH,EAGR,IAAMI,EAAWC,GAAmBF,CAAU,EAAE,OAAgC,CAACG,EAAKC,IAAU,CAC/F,GAAM,CAACC,EAAKC,CAAM,EAAIF,EAAM,MAAM,GAAG,EACrC,GAAI,CAACC,EACJ,OAAOF,EAER,IAAMJ,EAAQQ,GAAeD,CAAM,EACnC,OAAAH,EAAIE,CAAG,EAAIN,GAAS,GACbI,CACR,EAAG,CAAC,CAAC,EAEL,GAAI,CACH,IAAMK,EAASZ,EAAW,MAAMK,CAAQ,EAGxC,MAAO,CACN,GAAGJ,EACH,GAAGW,CACJ,CACD,MAAY,CACX,OAAOX,CACR,CACD,CASO,SAASY,GAAeC,EAA2B,CACzD,OAAOA,GAAO,KAAK,EAAE,QAAQ,WAAY,IAAI,CAC9C,CAOO,SAASC,GAAmBD,EAAqC,CACvE,IAAME,EAAQF,GAAO,KAAK,GAAK,GACzBG,EAAmB,CAAC,EAEtBC,EAAgB,GAChBC,EAAW,GAEf,QAAWC,KAAQJ,EACdI,IAAS,KAAO,CAACD,EAChBD,IACHD,EAAO,KAAKC,CAAa,EACzBA,EAAgB,KAEPE,IAAS,MACnBD,EAAW,CAACA,GACZD,GAAiBE,GAMnB,OAAIF,GACHD,EAAO,KAAKC,CAAa,EAGnBD,CACR","names":["Slot","Prism","createContext","forwardRef","useContext","useEffect","useId","useMemo","useState","CaretDown","Check","Copy","assert","supportedLanguages","parseLanguage","value","maybeLanguage","isSupportedLanguage","formatLanguageClassName","language","Fragment","jsx","jsxs","CodeBlockContext","createContext","CodeBlock","forwardRef","className","props","ref","copyText","setCopyText","useState","hasCodeExpander","setHasCodeExpander","isCodeExpanded","setIsCodeExpanded","codeId","setCodeId","context","useMemo","id","old","assert","cx","CodeBlockBody","CodeBlockCode","language","style","value","useId","registerCodeId","unregisterCodeId","useContext","trimmedCode","highlightedCodeInnerHtml","setHighlightedCodeInnerHtml","useEffect","grammar","Prism","supportedLanguages","newHighlightedCodeInnerHtml","formatLanguageClassName","CodeBlockHeader","CodeBlockTitle","asChild","Slot","CodeBlockCopyButton","onCopy","onCopyError","copyToClipboard","useCopyToClipboard","copied","setCopied","timeoutId","error","Check","Copy","CodeBlockExpanderButton","onClick","event","prev","CaretDown","fmtCode","strings","values","isTemplateStringsArray","text","minIndent","findMinIndent","line","value","match","acc","curr","z","modes","metaSchema","defaultMeta","parseMetastring","value","metastring","metaJson","tokenizeMetastring","acc","token","key","_value","normalizeValue","parsed","normalizeValue","value","tokenizeMetastring","input","result","currentString","inQuotes","char"]}
@@ -1,2 +1,2 @@
1
- import{a,b}from"./chunk-G2WLA5VU.js";export{a as composeRefs,b as useComposedRefs};
1
+ import"./chunk-Q5QAMVGX.js";import{a,b}from"./chunk-5E73VWJX.js";export{a as composeRefs,b as useComposedRefs};
2
2
  //# sourceMappingURL=compose-refs.js.map
package/dist/cx.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-NSJFPSQC.js";export{a as cx};
1
+ import{a as o}from"./chunk-EW5CFGXT.js";export{o as cx};
2
2
  //# sourceMappingURL=cx.js.map
package/dist/dialog.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-EEMNPJIL.js";import"./chunk-YPNOQPCP.js";import"./chunk-7PF4QIBH.js";import"./chunk-XGNB7VBZ.js";import"./chunk-EAKUJEO5.js";import{a as l}from"./chunk-NSJFPSQC.js";import{X as u}from"@phosphor-icons/react/X";import*as e from"@radix-ui/react-dialog";import{forwardRef as r}from"react";import{jsx as i,jsxs as N}from"react/jsx-runtime";var P=e.Root,x=e.Trigger,g=e.Portal,C=e.Close,s=r(({className:o,...t},a)=>i(e.Overlay,{ref:a,className:l("bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm",o),...t}));s.displayName=e.Overlay.displayName;var d=r(({className:o,children:t,...a},n)=>N(g,{children:[i(s,{}),i("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:i(e.Content,{className:l("flex max-h-full w-full max-w-lg flex-1 flex-col","outline-none focus-within:outline-none","border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200","data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95",o),ref:n,...a,children:t})})]}));d.displayName=e.Content.displayName;var p=({className:o,children:t,...a})=>i("div",{className:l("border-dialog-muted text-strong relative flex shrink-0 items-center justify-between gap-2 border-b px-6 py-4","has-[.icon-button]:pr-4",o),...a,children:t});p.displayName="DialogHeader";var b=({size:o="md",type:t="button",label:a="Close Dialog",appearance:n="ghost",...y})=>i(e.Close,{asChild:!0,children:i(m,{appearance:n,icon:i(u,{}),label:a,size:o,type:t,...y})}),D=({className:o,...t})=>i("div",{className:l("scrollbar text-body flex-1 overflow-y-auto p-6",o),...t});D.displayName="DialogBody";var c=({className:o,...t})=>i("div",{className:l("border-dialog-muted flex shrink-0 flex-row-reverse gap-2 border-t px-6 py-4",o),...t});c.displayName="DialogFooter";var f=r(({className:o,...t},a)=>i(e.Title,{ref:a,className:l("text-strong truncate text-lg font-medium",o),...t}));f.displayName=e.Title.displayName;var v=r(({className:o,...t},a)=>i(e.Description,{ref:a,className:l("text-muted",o),...t}));v.displayName=e.Description.displayName;export{P as Dialog,D as DialogBody,C as DialogClose,b as DialogCloseIconButton,d as DialogContent,v as DialogDescription,c as DialogFooter,p as DialogHeader,s as DialogOverlay,g as DialogPortal,f as DialogTitle,x as DialogTrigger};
1
+ import{a as m}from"./chunk-DK2VDJHL.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-6EMCH2HX.js";import"./chunk-ZOQ33WW5.js";import{a as l}from"./chunk-EW5CFGXT.js";import{X as u}from"@phosphor-icons/react/X";import*as e from"@radix-ui/react-dialog";import{forwardRef as r}from"react";import{jsx as i,jsxs as N}from"react/jsx-runtime";var P=e.Root,x=e.Trigger,g=e.Portal,C=e.Close,s=r(({className:o,...t},a)=>i(e.Overlay,{ref:a,className:l("bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm",o),...t}));s.displayName=e.Overlay.displayName;var d=r(({className:o,children:t,...a},n)=>N(g,{children:[i(s,{}),i("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:i(e.Content,{className:l("flex max-h-full w-full max-w-lg flex-1 flex-col","outline-none focus-within:outline-none","border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200","data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95",o),ref:n,...a,children:t})})]}));d.displayName=e.Content.displayName;var p=({className:o,children:t,...a})=>i("div",{className:l("border-dialog-muted text-strong relative flex shrink-0 items-center justify-between gap-2 border-b px-6 py-4","has-[.icon-button]:pr-4",o),...a,children:t});p.displayName="DialogHeader";var b=({size:o="md",type:t="button",label:a="Close Dialog",appearance:n="ghost",...y})=>i(e.Close,{asChild:!0,children:i(m,{appearance:n,icon:i(u,{}),label:a,size:o,type:t,...y})}),D=({className:o,...t})=>i("div",{className:l("scrollbar text-body flex-1 overflow-y-auto p-6",o),...t});D.displayName="DialogBody";var c=({className:o,...t})=>i("div",{className:l("border-dialog-muted flex shrink-0 flex-row-reverse gap-2 border-t px-6 py-4",o),...t});c.displayName="DialogFooter";var f=r(({className:o,...t},a)=>i(e.Title,{ref:a,className:l("text-strong truncate text-lg font-medium",o),...t}));f.displayName=e.Title.displayName;var v=r(({className:o,...t},a)=>i(e.Description,{ref:a,className:l("text-muted",o),...t}));v.displayName=e.Description.displayName;export{P as Dialog,D as DialogBody,C as DialogClose,b as DialogCloseIconButton,d as DialogContent,v as DialogDescription,c as DialogFooter,p as DialogHeader,s as DialogOverlay,g as DialogPortal,f as DialogTitle,x as DialogTrigger};
2
2
  //# sourceMappingURL=dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/dialog/dialog.tsx"],"sourcesContent":["import { X } from \"@phosphor-icons/react/X\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { IconButton, type IconButtonProps } from \"../button\";\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = forwardRef<\n\tElementRef<typeof DialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Overlay\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = forwardRef<ElementRef<\"div\">, ComponentPropsWithoutRef<typeof DialogPrimitive.Content>>(\n\t({ className, children, ...props }, ref) => (\n\t\t<DialogPortal>\n\t\t\t<DialogOverlay />\n\t\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t\t<DialogPrimitive.Content\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"flex max-h-full w-full max-w-lg flex-1 flex-col\",\n\t\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tref={ref}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</DialogPrimitive.Content>\n\t\t\t</div>\n\t\t</DialogPortal>\n\t),\n);\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\n\t\t\t\"border-dialog-muted text-strong relative flex shrink-0 items-center justify-between gap-2 border-b px-6 py-4\",\n\t\t\t\"has-[.icon-button]:pr-4\", // when there are actions in the header, shorten the padding\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</div>\n);\nDialogHeader.displayName = \"DialogHeader\";\n\ntype DialogCloseIconButtonProps = Partial<Omit<IconButtonProps, \"icon\">>;\nconst DialogCloseIconButton = ({\n\tsize = \"md\",\n\ttype = \"button\",\n\tlabel = \"Close Dialog\",\n\tappearance = \"ghost\",\n\t...props\n}: DialogCloseIconButtonProps) => (\n\t<DialogPrimitive.Close asChild>\n\t\t<IconButton appearance={appearance} icon={<X />} label={label} size={size} type={type} {...props} />\n\t</DialogPrimitive.Close>\n);\n\nconst DialogBody = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"scrollbar text-body flex-1 overflow-y-auto p-6\", className)} {...props} />\n);\nDialogBody.displayName = \"DialogBody\";\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\"border-dialog-muted flex shrink-0 flex-row-reverse gap-2 border-t px-6 py-4\", className)}\n\t\t{...props}\n\t/>\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = forwardRef<\n\tElementRef<typeof DialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Title ref={ref} className={cx(\"text-strong truncate text-lg font-medium\", className)} {...props} />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = forwardRef<\n\tElementRef<typeof DialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Description ref={ref} className={cx(\"text-muted\", className)} {...props} />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n\tDialog,\n\tDialogBody,\n\tDialogClose,\n\tDialogCloseIconButton,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogOverlay,\n\tDialogPortal,\n\tDialogTitle,\n\tDialogTrigger,\n};\n"],"mappings":"gMAAA,OAAS,KAAAA,MAAS,0BAClB,UAAYC,MAAqB,yBACjC,OAAS,cAAAC,MAAkB,QAiB1B,cAAAC,EAaC,QAAAC,MAbD,oBAZD,IAAMC,EAAyB,OAEzBC,EAAgC,UAEhCC,EAA+B,SAE/BC,EAA8B,QAE9BC,EAAgBC,EAGpB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAiB,UAAhB,CACA,IAAKU,EACL,UAAWC,EACV,iKACAH,CACD,EACC,GAAGC,EACL,CACA,EACDH,EAAc,YAA8B,UAAQ,YAEpD,IAAMM,EAAgBL,EACrB,CAAC,CAAE,UAAAC,EAAW,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EAAoBlB,EAGxB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAiB,cAAhB,CAA4B,IAAKU,EAAK,UAAWC,EAAG,aAAcH,CAAS,EAAI,GAAGC,EAAO,CAC1F,EACDgB,EAAkB,YAA8B,cAAY","names":["X","DialogPrimitive","forwardRef","jsx","jsxs","Dialog","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","forwardRef","className","props","ref","cx","DialogContent","children","DialogHeader","DialogCloseIconButton","size","type","label","appearance","IconButton","X","DialogBody","DialogFooter","DialogTitle","DialogDescription"]}
1
+ {"version":3,"sources":["../src/components/dialog/dialog.tsx"],"sourcesContent":["import { X } from \"@phosphor-icons/react/X\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { IconButton, type IconButtonProps } from \"../button/icon-button.js\";\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = forwardRef<\n\tElementRef<typeof DialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Overlay\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = forwardRef<ElementRef<\"div\">, ComponentPropsWithoutRef<typeof DialogPrimitive.Content>>(\n\t({ className, children, ...props }, ref) => (\n\t\t<DialogPortal>\n\t\t\t<DialogOverlay />\n\t\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t\t<DialogPrimitive.Content\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"flex max-h-full w-full max-w-lg flex-1 flex-col\",\n\t\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tref={ref}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</DialogPrimitive.Content>\n\t\t\t</div>\n\t\t</DialogPortal>\n\t),\n);\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\n\t\t\t\"border-dialog-muted text-strong relative flex shrink-0 items-center justify-between gap-2 border-b px-6 py-4\",\n\t\t\t\"has-[.icon-button]:pr-4\", // when there are actions in the header, shorten the padding\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</div>\n);\nDialogHeader.displayName = \"DialogHeader\";\n\ntype DialogCloseIconButtonProps = Partial<Omit<IconButtonProps, \"icon\">>;\nconst DialogCloseIconButton = ({\n\tsize = \"md\",\n\ttype = \"button\",\n\tlabel = \"Close Dialog\",\n\tappearance = \"ghost\",\n\t...props\n}: DialogCloseIconButtonProps) => (\n\t<DialogPrimitive.Close asChild>\n\t\t<IconButton appearance={appearance} icon={<X />} label={label} size={size} type={type} {...props} />\n\t</DialogPrimitive.Close>\n);\n\nconst DialogBody = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div className={cx(\"scrollbar text-body flex-1 overflow-y-auto p-6\", className)} {...props} />\n);\nDialogBody.displayName = \"DialogBody\";\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n\t<div\n\t\tclassName={cx(\"border-dialog-muted flex shrink-0 flex-row-reverse gap-2 border-t px-6 py-4\", className)}\n\t\t{...props}\n\t/>\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = forwardRef<\n\tElementRef<typeof DialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Title ref={ref} className={cx(\"text-strong truncate text-lg font-medium\", className)} {...props} />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = forwardRef<\n\tElementRef<typeof DialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<DialogPrimitive.Description ref={ref} className={cx(\"text-muted\", className)} {...props} />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n\tDialog,\n\tDialogBody,\n\tDialogClose,\n\tDialogCloseIconButton,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogOverlay,\n\tDialogPortal,\n\tDialogTitle,\n\tDialogTrigger,\n};\n"],"mappings":"gMAAA,OAAS,KAAAA,MAAS,0BAClB,UAAYC,MAAqB,yBACjC,OAAS,cAAAC,MAAkB,QAiB1B,cAAAC,EAaC,QAAAC,MAbD,oBAZD,IAAMC,EAAyB,OAEzBC,EAAgC,UAEhCC,EAA+B,SAE/BC,EAA8B,QAE9BC,EAAgBC,EAGpB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAiB,UAAhB,CACA,IAAKU,EACL,UAAWC,EACV,iKACAH,CACD,EACC,GAAGC,EACL,CACA,EACDH,EAAc,YAA8B,UAAQ,YAEpD,IAAMM,EAAgBL,EACrB,CAAC,CAAE,UAAAC,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AAMC,EAAoBlB,EAGxB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BV,EAAiB,cAAhB,CAA4B,IAAKU,EAAK,UAAWC,EAAG,aAAcH,CAAS,EAAI,GAAGC,EAAO,CAC1F,EACDgB,EAAkB,YAA8B,cAAY","names":["X","DialogPrimitive","forwardRef","jsx","jsxs","Dialog","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","forwardRef","className","props","ref","cx","DialogContent","children","DialogHeader","DialogCloseIconButton","size","type","label","appearance","IconButton","X","DialogBody","DialogFooter","DialogTitle","DialogDescription"]}
@@ -1,2 +1,2 @@
1
- import{b as u}from"./chunk-JE2MBLEH.js";import{a}from"./chunk-NSJFPSQC.js";import{CaretRight as P}from"@phosphor-icons/react/CaretRight";import{Check as l}from"@phosphor-icons/react/Check";import*as e from"@radix-ui/react-dropdown-menu";import{forwardRef as d}from"react";import{jsx as n,jsxs as m}from"react/jsx-runtime";var x=e.Root,y=e.Trigger,R=e.Group,s=e.Portal,C=e.Sub,I=e.RadioGroup,c=d(({className:o,inset:t,children:r,...i},p)=>m(e.SubTrigger,{className:a("focus:bg-accent data-state-open:bg-accent relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-2 pr-9 text-base outline-none sm:text-sm","data-highlighted:bg-popover-hover data-state-open:bg-popover-hover","[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0",t&&"pl-8",o),ref:p,...i,children:[r,n("span",{className:"absolute right-2 flex items-center",children:n(P,{className:"size-5 shrink-0 sm:size-4",weight:"bold"})})]}));c.displayName="DropdownMenuSubTrigger";var w=d(({className:o,loop:t=!0,...r},i)=>n(s,{children:n(e.SubContent,{className:a("scrollbar","text-popover-foreground border-popover bg-popover p-1.25 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 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 z-50 min-w-[8rem] overflow-hidden rounded border shadow-xl","my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)_-_16px)] overflow-auto",o),loop:t,ref:i,...r})}));w.displayName="DropdownMenuSubContent";var f=d(({className:o,loop:t=!0,width:r,...i},p)=>n(s,{children:n(e.Content,{ref:p,className:a("scrollbar","text-popover-foreground border-popover bg-popover p-1.25 z-50 min-w-[8rem] overflow-hidden rounded border shadow-xl outline-none","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 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95","my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)_-_16px)] overflow-auto",r==="trigger"&&"w-[var(--radix-dropdown-menu-trigger-width)]",o),loop:t,...i})}));f.displayName="DropdownMenuContent";var g=d(({className:o,inset:t,...r},i)=>n(e.Item,{ref:i,className:a("focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-popover-hover data-active-item:dark:bg-popover-hover relative flex cursor-pointer select-none items-center rounded px-2 py-1.5 text-base font-normal outline-none transition-colors sm:text-sm","[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0",t&&"pl-8",o),...r}));g.displayName="DropdownMenuItem";var v=d(({className:o,children:t,checked:r,...i},p)=>m(e.CheckboxItem,{ref:p,className:a("text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-base font-normal outline-none sm:text-sm","data-highlighted:bg-popover-hover data-highlighted:dark:bg-popover-hover","aria-checked:!bg-filled-accent aria-checked:text-on-filled aria-checked:font-medium","[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0",o),checked:r,...i,children:[n("span",{className:"absolute right-2 flex items-center",children:n(e.ItemIndicator,{children:n(l,{className:"size-5 shrink-0 sm:size-4",weight:"bold"})})}),t]}));v.displayName="DropdownMenuCheckboxItem";var h=d(({className:o,children:t,...r},i)=>m(e.RadioItem,{className:a("text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-base font-normal outline-none sm:text-sm","data-highlighted:bg-popover-hover data-highlighted:dark:bg-popover-hover","aria-checked:!bg-filled-accent aria-checked:text-on-filled aria-checked:font-medium","[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0",o),ref:i,...r,children:[n("span",{className:"absolute right-2 flex items-center",children:n(e.ItemIndicator,{children:n(l,{className:"size-5 shrink-0 sm:size-4",weight:"bold"})})}),t]}));h.displayName="DropdownMenuRadioItem";var M=d(({className:o,inset:t,...r},i)=>n(e.Label,{ref:i,className:a("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",o),...r}));M.displayName="DropdownMenuLabel";var D=d(({className:o,...t},r)=>n(u,{ref:r,className:a("-mx-1.25 my-1 w-auto",o),...t}));D.displayName="DropdownMenuSeparator";var b=({className:o,...t})=>n("span",{className:a("ml-auto text-xs tracking-widest opacity-60",o),...t});b.displayName="DropdownMenuShortcut";export{x as DropdownMenu,v as DropdownMenuCheckboxItem,f as DropdownMenuContent,R as DropdownMenuGroup,g as DropdownMenuItem,M as DropdownMenuLabel,s as DropdownMenuPortal,I as DropdownMenuRadioGroup,h as DropdownMenuRadioItem,D as DropdownMenuSeparator,b as DropdownMenuShortcut,C as DropdownMenuSub,w as DropdownMenuSubContent,c as DropdownMenuSubTrigger,y as DropdownMenuTrigger};
1
+ import{b as u}from"./chunk-CXQLUXDJ.js";import{a}from"./chunk-EW5CFGXT.js";import{CaretRight as P}from"@phosphor-icons/react/CaretRight";import{Check as l}from"@phosphor-icons/react/Check";import*as e from"@radix-ui/react-dropdown-menu";import{forwardRef as d}from"react";import{jsx as n,jsxs as m}from"react/jsx-runtime";var x=e.Root,y=e.Trigger,R=e.Group,s=e.Portal,C=e.Sub,I=e.RadioGroup,c=d(({className:o,inset:t,children:r,...i},p)=>m(e.SubTrigger,{className:a("focus:bg-accent data-state-open:bg-accent relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-2 pr-9 text-base outline-none sm:text-sm","data-highlighted:bg-popover-hover data-state-open:bg-popover-hover","[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0",t&&"pl-8",o),ref:p,...i,children:[r,n("span",{className:"absolute right-2 flex items-center",children:n(P,{className:"size-5 shrink-0 sm:size-4",weight:"bold"})})]}));c.displayName="DropdownMenuSubTrigger";var w=d(({className:o,loop:t=!0,...r},i)=>n(s,{children:n(e.SubContent,{className:a("scrollbar","text-popover-foreground border-popover bg-popover p-1.25 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 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 z-50 min-w-[8rem] overflow-hidden rounded border shadow-xl","my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)_-_16px)] overflow-auto",o),loop:t,ref:i,...r})}));w.displayName="DropdownMenuSubContent";var f=d(({className:o,loop:t=!0,width:r,...i},p)=>n(s,{children:n(e.Content,{ref:p,className:a("scrollbar","text-popover-foreground border-popover bg-popover p-1.25 z-50 min-w-[8rem] overflow-hidden rounded border shadow-xl outline-none","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 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95","my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)_-_16px)] overflow-auto",r==="trigger"&&"w-[var(--radix-dropdown-menu-trigger-width)]",o),loop:t,...i})}));f.displayName="DropdownMenuContent";var g=d(({className:o,inset:t,...r},i)=>n(e.Item,{ref:i,className:a("focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-popover-hover data-active-item:dark:bg-popover-hover relative flex cursor-pointer select-none items-center rounded px-2 py-1.5 text-base font-normal outline-none transition-colors sm:text-sm","[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0",t&&"pl-8",o),...r}));g.displayName="DropdownMenuItem";var v=d(({className:o,children:t,checked:r,...i},p)=>m(e.CheckboxItem,{ref:p,className:a("text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-base font-normal outline-none sm:text-sm","data-highlighted:bg-popover-hover data-highlighted:dark:bg-popover-hover","aria-checked:!bg-filled-accent aria-checked:text-on-filled aria-checked:font-medium","[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0",o),checked:r,...i,children:[n("span",{className:"absolute right-2 flex items-center",children:n(e.ItemIndicator,{children:n(l,{className:"size-5 shrink-0 sm:size-4",weight:"bold"})})}),t]}));v.displayName="DropdownMenuCheckboxItem";var h=d(({className:o,children:t,...r},i)=>m(e.RadioItem,{className:a("text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-base font-normal outline-none sm:text-sm","data-highlighted:bg-popover-hover data-highlighted:dark:bg-popover-hover","aria-checked:!bg-filled-accent aria-checked:text-on-filled aria-checked:font-medium","[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0",o),ref:i,...r,children:[n("span",{className:"absolute right-2 flex items-center",children:n(e.ItemIndicator,{children:n(l,{className:"size-5 shrink-0 sm:size-4",weight:"bold"})})}),t]}));h.displayName="DropdownMenuRadioItem";var M=d(({className:o,inset:t,...r},i)=>n(e.Label,{ref:i,className:a("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",o),...r}));M.displayName="DropdownMenuLabel";var D=d(({className:o,...t},r)=>n(u,{ref:r,className:a("-mx-1.25 my-1 w-auto",o),...t}));D.displayName="DropdownMenuSeparator";var b=({className:o,...t})=>n("span",{className:a("ml-auto text-xs tracking-widest opacity-60",o),...t});b.displayName="DropdownMenuShortcut";export{x as DropdownMenu,v as DropdownMenuCheckboxItem,f as DropdownMenuContent,R as DropdownMenuGroup,g as DropdownMenuItem,M as DropdownMenuLabel,s as DropdownMenuPortal,I as DropdownMenuRadioGroup,h as DropdownMenuRadioItem,D as DropdownMenuSeparator,b as DropdownMenuShortcut,C as DropdownMenuSub,w as DropdownMenuSubContent,c as DropdownMenuSubTrigger,y as DropdownMenuTrigger};
2
2
  //# sourceMappingURL=dropdown-menu.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["import { CaretRight } from \"@phosphor-icons/react/CaretRight\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport { Separator } from \"../separator\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, children, ...props }, ref) => (\n\t<DropdownMenuPrimitive.SubTrigger\n\t\tclassName={cx(\n\t\t\t\"focus:bg-accent data-state-open:bg-accent relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-2 pr-9 text-base outline-none sm:text-sm\",\n\t\t\t\"data-highlighted:bg-popover-hover data-state-open:bg-popover-hover\",\n\t\t\t\"[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\tref={ref}\n\t\t{...props}\n\t>\n\t\t{children}\n\t\t<span className=\"absolute right-2 flex items-center\">\n\t\t\t<CaretRight className=\"size-5 shrink-0 sm:size-4\" weight=\"bold\" />\n\t\t</span>\n\t</DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = \"DropdownMenuSubTrigger\";\n\nconst DropdownMenuSubContent = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.SubContent>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, loop = true, ...props }, ref) => (\n\t<DropdownMenuPortal>\n\t\t<DropdownMenuPrimitive.SubContent\n\t\t\tclassName={cx(\n\t\t\t\t\"scrollbar\",\n\t\t\t\t\"text-popover-foreground border-popover bg-popover p-1.25 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 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 z-50 min-w-[8rem] overflow-hidden rounded border shadow-xl\",\n\t\t\t\t\"my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)_-_16px)] overflow-auto\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tloop={loop}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t</DropdownMenuPortal>\n));\nDropdownMenuSubContent.displayName = \"DropdownMenuSubContent\";\n\ntype DropdownMenuContentProps = ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> & {\n\t/**\n\t * Whether the DropdownMenuContent should match the width of the trigger or use the intrinsic content width.\n\t */\n\twidth?: \"trigger\" | \"content\";\n};\n\nconst DropdownMenuContent = forwardRef<ElementRef<typeof DropdownMenuPrimitive.Content>, DropdownMenuContentProps>(\n\t({ className, loop = true, width, ...props }, ref) => (\n\t\t<DropdownMenuPortal>\n\t\t\t<DropdownMenuPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"scrollbar\",\n\t\t\t\t\t\"text-popover-foreground border-popover bg-popover p-1.25 z-50 min-w-[8rem] overflow-hidden rounded border shadow-xl outline-none\",\n\t\t\t\t\t\"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 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\"my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)_-_16px)] overflow-auto\",\n\t\t\t\t\twidth === \"trigger\" && \"w-[var(--radix-dropdown-menu-trigger-width)]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tloop={loop}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</DropdownMenuPortal>\n\t),\n);\nDropdownMenuContent.displayName = \"DropdownMenuContent\";\n\nconst DropdownMenuItem = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.Item>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-popover-hover data-active-item:dark:bg-popover-hover relative flex cursor-pointer select-none items-center rounded px-2 py-1.5 text-base font-normal outline-none transition-colors sm:text-sm\",\n\t\t\t\"[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuItem.displayName = \"DropdownMenuItem\";\n\nconst DropdownMenuCheckboxItem = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n\t<DropdownMenuPrimitive.CheckboxItem\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-base font-normal outline-none sm:text-sm\",\n\t\t\t\"data-highlighted:bg-popover-hover data-highlighted:dark:bg-popover-hover\",\n\t\t\t\"aria-checked:!bg-filled-accent aria-checked:text-on-filled aria-checked:font-medium\",\n\t\t\t\"[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0\",\n\t\t\tclassName,\n\t\t)}\n\t\tchecked={checked}\n\t\t{...props}\n\t>\n\t\t<span className=\"absolute right-2 flex items-center\">\n\t\t\t<DropdownMenuPrimitive.ItemIndicator>\n\t\t\t\t<Check className=\"size-5 shrink-0 sm:size-4\" weight=\"bold\" />\n\t\t\t</DropdownMenuPrimitive.ItemIndicator>\n\t\t</span>\n\t\t{children}\n\t</DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\";\n\ntype DropdownMenuRadioItemProps = ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> & {\n\tname?: string;\n\tid?: string;\n};\n\nconst DropdownMenuRadioItem = forwardRef<ElementRef<\"input\">, DropdownMenuRadioItemProps>(\n\t({ className, children, ...props }, ref) => (\n\t\t<DropdownMenuPrimitive.RadioItem\n\t\t\tclassName={cx(\n\t\t\t\t\"text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-base font-normal outline-none sm:text-sm\",\n\t\t\t\t\"data-highlighted:bg-popover-hover data-highlighted:dark:bg-popover-hover\",\n\t\t\t\t\"aria-checked:!bg-filled-accent aria-checked:text-on-filled aria-checked:font-medium\",\n\t\t\t\t\"[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className=\"absolute right-2 flex items-center\">\n\t\t\t\t<DropdownMenuPrimitive.ItemIndicator>\n\t\t\t\t\t<Check className=\"size-5 shrink-0 sm:size-4\" weight=\"bold\" />\n\t\t\t\t</DropdownMenuPrimitive.ItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</DropdownMenuPrimitive.RadioItem>\n\t),\n);\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\";\n\nconst DropdownMenuLabel = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.Label>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Label\n\t\tref={ref}\n\t\tclassName={cx(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuLabel.displayName = \"DropdownMenuLabel\";\n\nconst DropdownMenuSeparator = forwardRef<ElementRef<typeof Separator>, ComponentPropsWithoutRef<typeof Separator>>(\n\t({ className, ...props }, ref) => (\n\t\t<Separator ref={ref} className={cx(\"-mx-1.25 my-1 w-auto\", className)} {...props} />\n\t),\n);\nDropdownMenuSeparator.displayName = \"DropdownMenuSeparator\";\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n\treturn <span className={cx(\"ml-auto text-xs tracking-widest opacity-60\", className)} {...props} />;\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuPortal,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuTrigger,\n};\n"],"mappings":"2EAAA,OAAS,cAAAA,MAAkB,mCAC3B,OAAS,SAAAC,MAAa,8BACtB,UAAYC,MAA2B,gCAEvC,OAAS,cAAAC,MAAkB,QAsB1B,OAaE,OAAAC,EAbF,QAAAC,MAAA,oBAlBD,IAAMC,EAAqC,OAErCC,EAA4C,UAE5CC,EAA0C,QAE1CC,EAA2C,SAE3CC,EAAwC,MAExCC,EAA+C,aAE/CC,EAAyBC,EAK7B,CAAC,CAAE,UAAAC,EAAW,MAAAC,EAAO,SAAAC,EAAU,GAAGC,CAAM,EAAGC,IAC5Cb,EAAuB,aAAtB,CACA,UAAWc,EACV,gKACA,qEACA,oDACAJ,GAAS,OACTD,CACD,EACA,IAAKI,EACJ,GAAGD,EAEH,UAAAD,EACDZ,EAAC,QAAK,UAAU,qCACf,SAAAA,EAACgB,EAAA,CAAW,UAAU,4BAA4B,OAAO,OAAO,EACjE,GACD,CACA,EACDR,EAAuB,YAAc,yBAErC,IAAMS,EAAyBR,EAG7B,CAAC,CAAE,UAAAC,EAAW,KAAAQ,EAAO,GAAM,GAAGL,CAAM,EAAGC,IACxCd,EAACK,EAAA,CACA,SAAAL,EAAuB,aAAtB,CACA,UAAWe,EACV,YACA,2bACA,8FACAL,CAC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,CAAM,UAAU,4BAA4B,OAAO,OAAO,EAC5D,EACD,EACCZ,GACF,CAEF,EACAa,EAAsB,YAAc,wBAEpC,IAAMC,EAAoBjB,EAKxB,CAAC,CAAE,UAAAC,EAAW,MAAAC,EAAO,GAAGE,CAAM,EAAGC,IAClCd,EAAuB,QAAtB,CACA,IAAKc,EACL,UAAWC,EAAG,oCAAqCJ,GAAS,OAAQD,CAAS,EAC5E,GAAGG,EACL,CACA,EACDa,EAAkB,YAAc,oBAEhC,IAAMC,EAAwBlB,EAC7B,CAAC,CAAE,UAAAC,EAAW,GAAGG,CAAM,EAAGC,IACzBd,EAAC4B,EAAA,CAAU,IAAKd,EAAK,UAAWC,EAAG,uBAAwBL,CAAS,EAAI,GAAGG,EAAO,CAEpF,EACAc,EAAsB,YAAc,wBAEpC,IAAME,EAAuB,CAAC,CAAE,UAAAnB,EAAW,GAAGG,CAAM,IAC5Cb,EAAC,QAAK,UAAWe,EAAG,6CAA8CL,CAAS,EAAI,GAAGG,EAAO,EAEjGgB,EAAqB,YAAc","names":["CaretRight","Check","DropdownMenuPrimitive","forwardRef","jsx","jsxs","DropdownMenu","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuPortal","DropdownMenuSub","DropdownMenuRadioGroup","DropdownMenuSubTrigger","forwardRef","className","inset","children","props","ref","cx","CaretRight","DropdownMenuSubContent","loop","DropdownMenuContent","width","DropdownMenuItem","DropdownMenuCheckboxItem","checked","Check","DropdownMenuRadioItem","DropdownMenuLabel","DropdownMenuSeparator","Separator","DropdownMenuShortcut"]}
1
+ {"version":3,"sources":["../src/components/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["import { CaretRight } from \"@phosphor-icons/react/CaretRight\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { forwardRef } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Separator } from \"../separator/separator.js\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, children, ...props }, ref) => (\n\t<DropdownMenuPrimitive.SubTrigger\n\t\tclassName={cx(\n\t\t\t\"focus:bg-accent data-state-open:bg-accent relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-2 pr-9 text-base outline-none sm:text-sm\",\n\t\t\t\"data-highlighted:bg-popover-hover data-state-open:bg-popover-hover\",\n\t\t\t\"[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\tref={ref}\n\t\t{...props}\n\t>\n\t\t{children}\n\t\t<span className=\"absolute right-2 flex items-center\">\n\t\t\t<CaretRight className=\"size-5 shrink-0 sm:size-4\" weight=\"bold\" />\n\t\t</span>\n\t</DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = \"DropdownMenuSubTrigger\";\n\nconst DropdownMenuSubContent = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.SubContent>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, loop = true, ...props }, ref) => (\n\t<DropdownMenuPortal>\n\t\t<DropdownMenuPrimitive.SubContent\n\t\t\tclassName={cx(\n\t\t\t\t\"scrollbar\",\n\t\t\t\t\"text-popover-foreground border-popover bg-popover p-1.25 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 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 z-50 min-w-[8rem] overflow-hidden rounded border shadow-xl\",\n\t\t\t\t\"my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)_-_16px)] overflow-auto\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tloop={loop}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t</DropdownMenuPortal>\n));\nDropdownMenuSubContent.displayName = \"DropdownMenuSubContent\";\n\ntype DropdownMenuContentProps = ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> & {\n\t/**\n\t * Whether the DropdownMenuContent should match the width of the trigger or use the intrinsic content width.\n\t */\n\twidth?: \"trigger\" | \"content\";\n};\n\nconst DropdownMenuContent = forwardRef<ElementRef<typeof DropdownMenuPrimitive.Content>, DropdownMenuContentProps>(\n\t({ className, loop = true, width, ...props }, ref) => (\n\t\t<DropdownMenuPortal>\n\t\t\t<DropdownMenuPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"scrollbar\",\n\t\t\t\t\t\"text-popover-foreground border-popover bg-popover p-1.25 z-50 min-w-[8rem] overflow-hidden rounded border shadow-xl outline-none\",\n\t\t\t\t\t\"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 data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\"my-2 max-h-[calc(var(--radix-dropdown-menu-content-available-height)_-_16px)] overflow-auto\",\n\t\t\t\t\twidth === \"trigger\" && \"w-[var(--radix-dropdown-menu-trigger-width)]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tloop={loop}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</DropdownMenuPortal>\n\t),\n);\nDropdownMenuContent.displayName = \"DropdownMenuContent\";\n\nconst DropdownMenuItem = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.Item>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-popover-hover data-active-item:dark:bg-popover-hover relative flex cursor-pointer select-none items-center rounded px-2 py-1.5 text-base font-normal outline-none transition-colors sm:text-sm\",\n\t\t\t\"[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0\",\n\t\t\tinset && \"pl-8\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuItem.displayName = \"DropdownMenuItem\";\n\nconst DropdownMenuCheckboxItem = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n\t<DropdownMenuPrimitive.CheckboxItem\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-base font-normal outline-none sm:text-sm\",\n\t\t\t\"data-highlighted:bg-popover-hover data-highlighted:dark:bg-popover-hover\",\n\t\t\t\"aria-checked:!bg-filled-accent aria-checked:text-on-filled aria-checked:font-medium\",\n\t\t\t\"[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0\",\n\t\t\tclassName,\n\t\t)}\n\t\tchecked={checked}\n\t\t{...props}\n\t>\n\t\t<span className=\"absolute right-2 flex items-center\">\n\t\t\t<DropdownMenuPrimitive.ItemIndicator>\n\t\t\t\t<Check className=\"size-5 shrink-0 sm:size-4\" weight=\"bold\" />\n\t\t\t</DropdownMenuPrimitive.ItemIndicator>\n\t\t</span>\n\t\t{children}\n\t</DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = \"DropdownMenuCheckboxItem\";\n\ntype DropdownMenuRadioItemProps = ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> & {\n\tname?: string;\n\tid?: string;\n};\n\nconst DropdownMenuRadioItem = forwardRef<ElementRef<\"input\">, DropdownMenuRadioItemProps>(\n\t({ className, children, ...props }, ref) => (\n\t\t<DropdownMenuPrimitive.RadioItem\n\t\t\tclassName={cx(\n\t\t\t\t\"text-strong data-disabled:pointer-events-none data-disabled:opacity-50 relative flex cursor-pointer select-none items-center gap-2 rounded py-1.5 pl-2 pr-9 text-base font-normal outline-none sm:text-sm\",\n\t\t\t\t\"data-highlighted:bg-popover-hover data-highlighted:dark:bg-popover-hover\",\n\t\t\t\t\"aria-checked:!bg-filled-accent aria-checked:text-on-filled aria-checked:font-medium\",\n\t\t\t\t\"[&>svg]:size-6 [&>svg]:sm:size-5 [&_svg]:shrink-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className=\"absolute right-2 flex items-center\">\n\t\t\t\t<DropdownMenuPrimitive.ItemIndicator>\n\t\t\t\t\t<Check className=\"size-5 shrink-0 sm:size-4\" weight=\"bold\" />\n\t\t\t\t</DropdownMenuPrimitive.ItemIndicator>\n\t\t\t</span>\n\t\t\t{children}\n\t\t</DropdownMenuPrimitive.RadioItem>\n\t),\n);\nDropdownMenuRadioItem.displayName = \"DropdownMenuRadioItem\";\n\nconst DropdownMenuLabel = forwardRef<\n\tElementRef<typeof DropdownMenuPrimitive.Label>,\n\tComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n\t\tinset?: boolean;\n\t}\n>(({ className, inset, ...props }, ref) => (\n\t<DropdownMenuPrimitive.Label\n\t\tref={ref}\n\t\tclassName={cx(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\n\t\t{...props}\n\t/>\n));\nDropdownMenuLabel.displayName = \"DropdownMenuLabel\";\n\nconst DropdownMenuSeparator = forwardRef<ElementRef<typeof Separator>, ComponentPropsWithoutRef<typeof Separator>>(\n\t({ className, ...props }, ref) => (\n\t\t<Separator ref={ref} className={cx(\"-mx-1.25 my-1 w-auto\", className)} {...props} />\n\t),\n);\nDropdownMenuSeparator.displayName = \"DropdownMenuSeparator\";\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => {\n\treturn <span className={cx(\"ml-auto text-xs tracking-widest opacity-60\", className)} {...props} />;\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n\tDropdownMenu,\n\tDropdownMenuCheckboxItem,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuItem,\n\tDropdownMenuLabel,\n\tDropdownMenuPortal,\n\tDropdownMenuRadioGroup,\n\tDropdownMenuRadioItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuShortcut,\n\tDropdownMenuSub,\n\tDropdownMenuSubContent,\n\tDropdownMenuSubTrigger,\n\tDropdownMenuTrigger,\n};\n"],"mappings":"2EAAA,OAAS,cAAAA,MAAkB,mCAC3B,OAAS,SAAAC,MAAa,8BACtB,UAAYC,MAA2B,gCAEvC,OAAS,cAAAC,MAAkB,QAsB1B,OAaE,OAAAC,EAbF,QAAAC,MAAA,oBAlBD,IAAMC,EAAqC,OAErCC,EAA4C,UAE5CC,EAA0C,QAE1CC,EAA2C,SAE3CC,EAAwC,MAExCC,EAA+C,aAE/CC,EAAyBC,EAK7B,CAAC,CAAE,UAAAC,EAAW,MAAAC,EAAO,SAAAC,EAAU,GAA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,UAAAb,EAAC,QAAK,UAAU,qCACf,SAAAA,EAAuB,gBAAtB,CACA,SAAAA,EAACwB,EAAA,CAAM,UAAU,4BAA4B,OAAO,OAAO,EAC5D,EACD,EACCZ,GACF,CACA,EACDU,EAAyB,YAAc,2BAOvC,IAAMG,EAAwBhB,EAC7B,CAAC,CAAE,UAAAC,EAAW,SAAAE,EAAU,GAAGC,CAAM,EAAGC,IACnCb,EAAuB,YAAtB,CACA,UAAWc,EACV,4MACA,2EACA,sFACA,oDACAL,CACD,EACA,IAAKI,EACJ,GAAGD,EAEJ,UAAAb,EAAC,QAAK,UAAU,qCACf,SAAAA,EAAuB,gBAAtB,CACA,SAAAA,EAACwB,EAAA,CAAM,UAAU,4BAA4B,OAAO,OAAO,EAC5D,EACD,EACCZ,GACF,CAEF,EACAa,EAAsB,YAAc,wBAEpC,IAAMC,EAAoBjB,EAKxB,CAAC,CAAE,UAAAC,EAAW,MAAAC,EAAO,GAAGE,CAAM,EAAGC,IAClCd,EAAuB,QAAtB,CACA,IAAKc,EACL,UAAWC,EAAG,oCAAqCJ,GAAS,OAAQD,CAAS,EAC5E,GAAGG,EACL,CACA,EACDa,EAAkB,YAAc,oBAEhC,IAAMC,EAAwBlB,EAC7B,CAAC,CAAE,UAAAC,EAAW,GAAGG,CAAM,EAAGC,IACzBd,EAAC4B,EAAA,CAAU,IAAKd,EAAK,UAAWC,EAAG,uBAAwBL,CAAS,EAAI,GAAGG,EAAO,CAEpF,EACAc,EAAsB,YAAc,wBAEpC,IAAME,EAAuB,CAAC,CAAE,UAAAnB,EAAW,GAAGG,CAAM,IAC5Cb,EAAC,QAAK,UAAWe,EAAG,6CAA8CL,CAAS,EAAI,GAAGG,EAAO,EAEjGgB,EAAqB,YAAc","names":["CaretRight","Check","DropdownMenuPrimitive","forwardRef","jsx","jsxs","DropdownMenu","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuPortal","DropdownMenuSub","DropdownMenuRadioGroup","DropdownMenuSubTrigger","forwardRef","className","inset","children","props","ref","cx","CaretRight","DropdownMenuSubContent","loop","DropdownMenuContent","width","DropdownMenuItem","DropdownMenuCheckboxItem","checked","Check","DropdownMenuRadioItem","DropdownMenuLabel","DropdownMenuSeparator","Separator","DropdownMenuShortcut"]}
package/dist/hooks.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as b,b as d,c as e}from"./chunk-LKCV5U37.js";import{a as c}from"./chunk-D3XF6J5A.js";import{a}from"./chunk-IWKI4XHM.js";export{a as useCopyToClipboard,b as useIsomorphicLayoutEffect,c as useMatchesMediaQuery,d as usePrefersReducedMotion,e as useRandomStableId};
1
+ import{a as f}from"./chunk-D3XF6J5A.js";import{a as u}from"./chunk-ZBC4B4EM.js";import{a as n}from"./chunk-IWKI4XHM.js";import{useEffect as c,useLayoutEffect as i}from"react";var d=typeof window<"u"?i:c;import{useEffect as a,useState as m}from"react";var p="(prefers-reduced-motion: no-preference)";function y(){let[r,o]=m(!0);return a(()=>{let e=window.matchMedia(p);o(!e.matches);function t(s){o(!s.matches)}return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[]),r}export{n as useCopyToClipboard,d as useIsomorphicLayoutEffect,f as useMatchesMediaQuery,y as usePrefersReducedMotion,u as useRandomStableId};
2
2
  //# sourceMappingURL=hooks.js.map
package/dist/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../src/hooks/use-isomorphic-layout-effect.tsx","../src/hooks/use-prefers-reduced-motion.tsx"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\n/**\n * useIsomorphicLayoutEffect is a hook that uses useLayoutEffect on the client and useEffect on the server.\n */\nexport const useIsomorphicLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n","import { useEffect, useState } from \"react\";\n\n/**\n * no-preference is the default value for the prefers-reduced-motion media query.\n * Users who have never fiddled with their a11y settings will still see animations\n * (no explicit opt-in required from a user's perspective)\n */\nconst query = \"(prefers-reduced-motion: no-preference)\";\n\n/**\n * usePrefersReducedMotion returns true if the user has opted out of animations\n */\nexport function usePrefersReducedMotion() {\n\t// default to no animations, since we don't know what the user's preference is on the server\n\tconst [prefersReducedMotion, setPrefersReducedMotion] = useState(true);\n\n\tuseEffect(() => {\n\t\tconst mediaQueryList = window.matchMedia(query);\n\n\t\t// set the _real_ initial value now that we're on the client\n\t\tsetPrefersReducedMotion(!mediaQueryList.matches);\n\n\t\t// register for updates\n\t\tfunction listener(event: MediaQueryListEvent) {\n\t\t\tsetPrefersReducedMotion(!event.matches);\n\t\t}\n\n\t\tmediaQueryList.addEventListener(\"change\", listener);\n\n\t\treturn () => {\n\t\t\tmediaQueryList.removeEventListener(\"change\", listener);\n\t\t};\n\t}, []);\n\n\treturn prefersReducedMotion;\n}\n"],"mappings":"wHAAA,OAAS,aAAAA,EAAW,mBAAAC,MAAuB,QAKpC,IAAMC,EAA4B,OAAO,OAAW,IAAcD,EAAkBD,ECL3F,OAAS,aAAAG,EAAW,YAAAC,MAAgB,QAOpC,IAAMC,EAAQ,0CAKP,SAASC,GAA0B,CAEzC,GAAM,CAACC,EAAsBC,CAAuB,EAAIJ,EAAS,EAAI,EAErE,OAAAD,EAAU,IAAM,CACf,IAAMM,EAAiB,OAAO,WAAWJ,CAAK,EAG9CG,EAAwB,CAACC,EAAe,OAAO,EAG/C,SAASC,EAASC,EAA4B,CAC7CH,EAAwB,CAACG,EAAM,OAAO,CACvC,CAEA,OAAAF,EAAe,iBAAiB,SAAUC,CAAQ,EAE3C,IAAM,CACZD,EAAe,oBAAoB,SAAUC,CAAQ,CACtD,CACD,EAAG,CAAC,CAAC,EAEEH,CACR","names":["useEffect","useLayoutEffect","useIsomorphicLayoutEffect","useEffect","useState","query","usePrefersReducedMotion","prefersReducedMotion","setPrefersReducedMotion","mediaQueryList","listener","event"]}
package/dist/icon.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-XGNB7VBZ.js";import"./chunk-EAKUJEO5.js";import"./chunk-NSJFPSQC.js";export{a as Icon};
1
+ import{a}from"./chunk-6EMCH2HX.js";import"./chunk-ZOQ33WW5.js";import"./chunk-EW5CFGXT.js";export{a as Icon};
2
2
  //# sourceMappingURL=icon.js.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-NSJFPSQC.js";import{forwardRef as n}from"react";import{jsx as d}from"react/jsx-runtime";var o=n(({className:r,...t},m)=>d("code",{ref:m,className:e("border-card rounded-md border bg-gray-500/5 px-1 py-0.5 font-mono text-[0.8em]",r),...t}));o.displayName="InlineCode";export{o as InlineCode};
1
+ import{a as e}from"./chunk-EW5CFGXT.js";import{forwardRef as n}from"react";import{jsx as d}from"react/jsx-runtime";var o=n(({className:r,...t},m)=>d("code",{ref:m,className:e("border-card rounded-md border bg-gray-500/5 px-1 py-0.5 font-mono text-[0.8em]",r),...t}));o.displayName="InlineCode";export{o as InlineCode};
2
2
  //# sourceMappingURL=inline-code.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/inline-code/inline-code.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\n/**\n * A component to render inline code.\n */\nconst InlineCode = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(({ className, ...props }, ref) => (\n\t<code\n\t\tref={ref}\n\t\tclassName={cx(\"border-card rounded-md border bg-gray-500/5 px-1 py-0.5 font-mono text-[0.8em]\", className)}\n\t\t{...props}\n\t/>\n));\nInlineCode.displayName = \"InlineCode\";\n\nexport { InlineCode };\n"],"mappings":"wCAAA,OAAS,cAAAA,MAAkB,QAQ1B,cAAAC,MAAA,oBADD,IAAMC,EAAaC,EAA6D,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzGL,EAAC,QACA,IAAKK,EACL,UAAWC,EAAG,iFAAkFH,CAAS,EACxG,GAAGC,EACL,CACA,EACDH,EAAW,YAAc","names":["forwardRef","jsx","InlineCode","forwardRef","className","props","ref","cx"]}
1
+ {"version":3,"sources":["../src/components/inline-code/inline-code.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\n\n/**\n * A component to render inline code.\n */\nconst InlineCode = forwardRef<HTMLSpanElement, HTMLAttributes<HTMLSpanElement>>(({ className, ...props }, ref) => (\n\t<code\n\t\tref={ref}\n\t\tclassName={cx(\"border-card rounded-md border bg-gray-500/5 px-1 py-0.5 font-mono text-[0.8em]\", className)}\n\t\t{...props}\n\t/>\n));\nInlineCode.displayName = \"InlineCode\";\n\nexport { InlineCode };\n"],"mappings":"wCAAA,OAAS,cAAAA,MAAkB,QAQ1B,cAAAC,MAAA,oBADD,IAAMC,EAAaC,EAA6D,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IACzGL,EAAC,QACA,IAAKK,EACL,UAAWC,EAAG,iFAAkFH,CAAS,EACxG,GAAGC,EACL,CACA,EACDH,EAAW,YAAc","names":["forwardRef","jsx","InlineCode","forwardRef","className","props","ref","cx"]}
package/dist/input.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a,b,c,d}from"./chunk-EQOASS6Y.js";import"./chunk-G2WLA5VU.js";import"./chunk-NSJFPSQC.js";export{a as Input,b as InputCapture,c as PasswordInput,d as isInput};
1
+ import{a as H}from"./chunk-ERBZR6SY.js";import{a as w}from"./chunk-5E73VWJX.js";import{a as y}from"./chunk-EW5CFGXT.js";import{CheckCircle as E}from"@phosphor-icons/react/CheckCircle";import{Warning as L}from"@phosphor-icons/react/Warning";import{WarningDiamond as W}from"@phosphor-icons/react/WarningDiamond";import A from"clsx";import{createContext as N,forwardRef as C,useContext as V,useRef as k}from"react";import{jsx as e,jsxs as P}from"react/jsx-runtime";var I=C(({children:t,className:n,...a},i)=>{let o=!!t,p=k(null);return o?e(x,{className:n,forwardedRef:i,innerRef:p,...a,children:t}):e(x,{...a,className:n,forwardedRef:i,innerRef:p,children:e(f,{...a})})});I.displayName="Input";var f=C(({"aria-invalid":t,className:n,validation:a,...i},o)=>{let{"aria-invalid":p,forwardedRef:d,innerRef:r,validation:c,...u}=V(g),l=c??a,m=p??t??l==="error",s={...u,...i,type:i.type??u.type??"text"};return e("div",{className:"min-w-0 flex-1 text-left",children:e("input",{"aria-invalid":m,"data-validation":l||void 0,className:y("bg-form placeholder:text-placeholder w-full focus:outline-none",n),ref:w(o,d,r),...s})})});f.displayName="InputCapture";var g=N({validation:void 0,innerRef:{current:null}}),x=({"aria-invalid":t,"aria-disabled":n,children:a,className:i,disabled:o,forwardedRef:p,innerRef:d,style:r,type:c,validation:u,...l})=>{let s=t!=null&&t!=="false"?"error":typeof u=="function"?u():u,h=t??s==="error";return e(g.Provider,{value:{"aria-invalid":t,"aria-disabled":n,disabled:o,type:c,validation:s,...l,forwardedRef:p,innerRef:d},children:P("div",{"aria-invalid":h,"aria-disabled":o??n,"data-validation":s||void 0,className:y("h-11 text-base sm:h-9 sm:text-sm","bg-form relative flex w-full items-center gap-1.5 rounded-md border px-3 py-2 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-within:outline-none focus-within:ring-4 focus-visible:outline-none focus-visible:ring-4","aria-disabled:opacity-50","has-[input:not(:first-child)]:ps-2.5 has-[input:not(:last-child)]:pe-2.5 [&>:not(input)]:shrink-0 [&_svg]:size-6 sm:[&_svg]:size-5","border-form text-strong has-[:focus-visible]:border-accent-600 has-[:focus-visible]:ring-focus-accent","data-validation-success:border-success-600 has-[:focus-visible]:data-validation-success:border-success-600 has-[:focus-visible]:data-validation-success:ring-focus-success","data-validation-warning:border-warning-600 has-[:focus-visible]:data-validation-warning:border-warning-600 has-[:focus-visible]:data-validation-warning:ring-focus-warning","data-validation-error:border-danger-600 has-[:focus-visible]:data-validation-error:border-danger-600 has-[:focus-visible]:data-validation-error:ring-focus-danger",i),onClick:()=>{d?.current?.focus()},style:r,children:[a,e(F,{name:l.name,validation:s})]})})};var F=({name:t,validation:n})=>{switch(n){case"error":return P("div",{className:"text-danger-600 pointer-events-none order-last select-none",children:[e("span",{className:"sr-only",children:A("The value entered for the",t,"input has failed validation.")}),e(L,{"aria-hidden":!0,weight:"fill"})]});case"success":return e("div",{className:"text-success-600 pointer-events-none order-last select-none",children:e(E,{weight:"fill"})});case"warning":return e("div",{className:"text-warning-600 pointer-events-none order-last select-none",children:e(W,{weight:"fill"})});default:return null}};import{Eye as B}from"@phosphor-icons/react/Eye";import{EyeClosed as O}from"@phosphor-icons/react/EyeClosed";import j from"clsx";import{forwardRef as z,useEffect as S,useState as T}from"react";import{jsx as M,jsxs as b}from"react/jsx-runtime";var R=z(({maskHiddenValue:t=!1,onBlur:n,onFocus:a,onValueVisibilityChange:i,showValue:o=!1,...p},d)=>{let[r,c]=T(o),u=r?"text":"password",l=r?B:O;S(()=>{c(o)},[o]);let[m,s]=T(!1);return b(I,{onBlur:v=>{s(!1),n?.(v)},onFocus:v=>{s(!0),a?.(v)},type:u,ref:d,...p,children:[M(f,{className:j(t&&!r&&!m&&"max-w-6")}),b("button",{type:"button",tabIndex:-1,className:"text-body hover:text-strong ml-1 cursor-pointer bg-inherit p-0",onClick:()=>{c(!r),i?.(!r)},children:[b("span",{className:"sr-only",children:["Turn password visibility ",r?"off":"on"]}),M(l,{"aria-hidden":!0})]})]})});R.displayName="PasswordInput";export{I as Input,f as InputCapture,R as PasswordInput,H as isInput};
2
2
  //# sourceMappingURL=input.js.map
package/dist/input.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../src/components/input/input.tsx","../src/components/input/password-input.tsx"],"sourcesContent":["import { CheckCircle } from \"@phosphor-icons/react/CheckCircle\";\nimport { Warning } from \"@phosphor-icons/react/Warning\";\nimport { WarningDiamond } from \"@phosphor-icons/react/WarningDiamond\";\nimport clsx from \"clsx\";\nimport type { ElementRef, ForwardedRef, InputHTMLAttributes, MutableRefObject, PropsWithChildren } from \"react\";\nimport { createContext, forwardRef, useContext, useRef } from \"react\";\nimport { composeRefs } from \"../../utils/compose-refs/compose-refs.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport type { Validation, WithAutoComplete, WithInputType, WithValidation } from \"./types.js\";\n\ntype BaseProps = WithAutoComplete & WithInputType & WithValidation;\n\n/**\n * The props for the `Input` component.\n */\ntype InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> & BaseProps & PropsWithChildren;\n\n/**\n * Used to create interactive controls for web-based forms in order to accept data from the user\n */\nconst Input = forwardRef<HTMLInputElement, InputProps>(({ children, className, ...props }, forwardedRef) => {\n\tconst hasChildren = Boolean(children);\n\tconst innerRef = useRef<ElementRef<\"input\">>(null);\n\n\tif (hasChildren) {\n\t\treturn (\n\t\t\t<InputContainer className={className} forwardedRef={forwardedRef} innerRef={innerRef} {...props}>\n\t\t\t\t{children}\n\t\t\t</InputContainer>\n\t\t);\n\t}\n\n\treturn (\n\t\t<InputContainer {...props} className={className} forwardedRef={forwardedRef} innerRef={innerRef}>\n\t\t\t<InputCapture {...props} />\n\t\t</InputContainer>\n\t);\n});\nInput.displayName = \"Input\";\n\ntype InputCaptureProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> & BaseProps;\n\n/**\n * The actual <input /> element that captures user input.\n */\nconst InputCapture = forwardRef<HTMLInputElement, InputCaptureProps>(\n\t({ \"aria-invalid\": _ariaInvalid, className, validation: _validation, ...restProps }, ref) => {\n\t\tconst {\n\t\t\t\"aria-invalid\": ctxAriaInvalid,\n\t\t\tforwardedRef: ctxForwardedRef,\n\t\t\tinnerRef: ctxInnerRef,\n\t\t\tvalidation: ctxValidation,\n\t\t\t...ctx\n\t\t} = useContext(InputContext);\n\n\t\tconst validation = ctxValidation ?? _validation;\n\t\tconst ariaInvalid = ctxAriaInvalid ?? _ariaInvalid ?? validation === \"error\";\n\t\tconst props = { ...ctx, ...restProps, type: restProps.type ?? ctx.type ?? \"text\" };\n\n\t\treturn (\n\t\t\t<div className=\"min-w-0 flex-1 text-left\">\n\t\t\t\t<input\n\t\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\t\tdata-validation={validation || undefined}\n\t\t\t\t\tclassName={cx(\"bg-form placeholder:text-placeholder w-full focus:outline-none\", className)}\n\t\t\t\t\tref={composeRefs(ref, ctxForwardedRef, ctxInnerRef)}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t},\n);\nInputCapture.displayName = \"InputCapture\";\n\ntype InputContextType = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> &\n\tBaseProps & {\n\t\t/**\n\t\t * inner ref for the input element, controlled by `Input`\n\t\t */\n\t\tinnerRef: MutableRefObject<HTMLInputElement | null>;\n\t\t/**\n\t\t * forwarded ref to the input element, forwarded from `Input` to `InputCapture`\n\t\t */\n\t\tforwardedRef?: ForwardedRef<HTMLInputElement>;\n\t};\n\nconst InputContext = createContext<InputContextType>({ validation: undefined, innerRef: { current: null } });\n\ntype InputContainerProps = InputHTMLAttributes<HTMLInputElement> &\n\tBaseProps & {\n\t\t/**\n\t\t * @private inner ref for the input element, controlled by `Input`\n\t\t */\n\t\tinnerRef: MutableRefObject<HTMLInputElement | null>;\n\t\t/**\n\t\t * @private ref to the input element, forwarded from `Input` to `InputCapture`\n\t\t */\n\t\tforwardedRef: ForwardedRef<HTMLInputElement>;\n\t};\n\n/**\n * The container for the input element.\n */\nconst InputContainer = ({\n\t\"aria-invalid\": _ariaInvalid,\n\t\"aria-disabled\": _ariaDisabled,\n\tchildren,\n\tclassName,\n\tdisabled,\n\tforwardedRef,\n\tinnerRef,\n\tstyle,\n\ttype,\n\tvalidation: _validation,\n\t...props\n}: InputContainerProps) => {\n\tconst isInvalid = _ariaInvalid != null && _ariaInvalid !== \"false\";\n\tconst validation = isInvalid ? \"error\" : typeof _validation === \"function\" ? _validation() : _validation;\n\tconst ariaInvalid = _ariaInvalid ?? validation === \"error\";\n\n\treturn (\n\t\t<InputContext.Provider\n\t\t\tvalue={{\n\t\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\t\t\"aria-disabled\": _ariaDisabled,\n\t\t\t\tdisabled,\n\t\t\t\ttype,\n\t\t\t\tvalidation,\n\t\t\t\t...props,\n\t\t\t\tforwardedRef,\n\t\t\t\tinnerRef,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\taria-disabled={disabled ?? _ariaDisabled}\n\t\t\t\tdata-validation={validation || undefined}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"h-11 text-base sm:h-9 sm:text-sm\",\n\t\t\t\t\t\"bg-form relative flex w-full items-center gap-1.5 rounded-md border px-3 py-2 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-within:outline-none focus-within:ring-4 focus-visible:outline-none focus-visible:ring-4\",\n\t\t\t\t\t\"aria-disabled:opacity-50\",\n\t\t\t\t\t\"has-[input:not(:first-child)]:ps-2.5 has-[input:not(:last-child)]:pe-2.5 [&>:not(input)]:shrink-0 [&_svg]:size-6 sm:[&_svg]:size-5\",\n\t\t\t\t\t\"border-form text-strong has-[:focus-visible]:border-accent-600 has-[:focus-visible]:ring-focus-accent\",\n\t\t\t\t\t\"data-validation-success:border-success-600 has-[:focus-visible]:data-validation-success:border-success-600 has-[:focus-visible]:data-validation-success:ring-focus-success\",\n\t\t\t\t\t\"data-validation-warning:border-warning-600 has-[:focus-visible]:data-validation-warning:border-warning-600 has-[:focus-visible]:data-validation-warning:ring-focus-warning\",\n\t\t\t\t\t\"data-validation-error:border-danger-600 has-[:focus-visible]:data-validation-error:border-danger-600 has-[:focus-visible]:data-validation-error:ring-focus-danger\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonClick={() => {\n\t\t\t\t\tinnerRef?.current?.focus();\n\t\t\t\t}}\n\t\t\t\tstyle={style}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t<ValidationFeedback name={props.name} validation={validation} />\n\t\t\t</div>\n\t\t</InputContext.Provider>\n\t);\n};\n\nexport { Input, InputCapture };\nexport type { InputProps, InputCaptureProps };\n\nconst ValidationFeedback = ({ name, validation }: { name?: string; validation: Validation | undefined }) => {\n\tswitch (validation) {\n\t\tcase \"error\":\n\t\t\treturn (\n\t\t\t\t<div className=\"text-danger-600 pointer-events-none order-last select-none\">\n\t\t\t\t\t<span className=\"sr-only\">{clsx(\"The value entered for the\", name, \"input has failed validation.\")}</span>\n\t\t\t\t\t<Warning aria-hidden weight=\"fill\" />\n\t\t\t\t</div>\n\t\t\t);\n\t\tcase \"success\":\n\t\t\treturn (\n\t\t\t\t<div className=\"text-success-600 pointer-events-none order-last select-none\">\n\t\t\t\t\t<CheckCircle weight=\"fill\" />\n\t\t\t\t</div>\n\t\t\t);\n\t\tcase \"warning\":\n\t\t\treturn (\n\t\t\t\t<div className=\"text-warning-600 pointer-events-none order-last select-none\">\n\t\t\t\t\t<WarningDiamond weight=\"fill\" />\n\t\t\t\t</div>\n\t\t\t);\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n","import { Eye } from \"@phosphor-icons/react/Eye\";\nimport { EyeClosed } from \"@phosphor-icons/react/EyeClosed\";\nimport clsx from \"clsx\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport type { InputHTMLAttributes } from \"react\";\nimport { Input, InputCapture } from \"./input.js\";\nimport type { InputType, WithAutoComplete, WithValidation } from \"./types.js\";\n\ntype PasswordInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"autoComplete\" | \"type\"> &\n\tWithValidation &\n\tWithAutoComplete & {\n\t\t/**\n\t\t * Mask the true length of the password input with a fixed width when the value is hidden and the input is not focused.\n\t\t * @default false\n\t\t */\n\t\tmaskHiddenValue?: boolean;\n\t\t/**\n\t\t * Callback for when the visibility of the password value changes.\n\t\t */\n\t\tonValueVisibilityChange?: (visible: boolean) => void;\n\t\t/**\n\t\t * Show/hide the password value as a controlled state.\n\t\t * @default false\n\t\t */\n\t\tshowValue?: boolean;\n\t};\n\ntype PasswordInputType = Extract<InputType, \"text\" | \"password\">;\n\nconst PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(\n\t({ maskHiddenValue = false, onBlur, onFocus, onValueVisibilityChange, showValue = false, ...props }, ref) => {\n\t\tconst [showPassword, setShowPassword] = useState<boolean>(showValue);\n\t\tconst type: PasswordInputType = showPassword ? \"text\" : \"password\";\n\t\tconst EyeCon = showPassword ? Eye : EyeClosed;\n\n\t\tuseEffect(() => {\n\t\t\tsetShowPassword(showValue);\n\t\t}, [showValue]);\n\n\t\tconst [isFocused, setIsFocused] = useState(false);\n\t\tconst shouldMaskHiddenValue = maskHiddenValue && !showPassword && !isFocused;\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\tonBlur={(event) => {\n\t\t\t\t\tsetIsFocused(false);\n\t\t\t\t\tonBlur?.(event);\n\t\t\t\t}}\n\t\t\t\tonFocus={(event) => {\n\t\t\t\t\tsetIsFocused(true);\n\t\t\t\t\tonFocus?.(event);\n\t\t\t\t}}\n\t\t\t\ttype={type}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<InputCapture className={clsx(shouldMaskHiddenValue && \"max-w-6\")} />\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\tclassName=\"text-body hover:text-strong ml-1 cursor-pointer bg-inherit p-0\"\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tsetShowPassword(!showPassword);\n\t\t\t\t\t\tonValueVisibilityChange?.(!showPassword);\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<span className=\"sr-only\">Turn password visibility {showPassword ? \"off\" : \"on\"}</span>\n\t\t\t\t\t<EyeCon aria-hidden />\n\t\t\t\t</button>\n\t\t\t</Input>\n\t\t);\n\t},\n);\nPasswordInput.displayName = \"PasswordInput\";\n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Circle","Warning","WarningDiamond","clsx","createContext","forwardRef","useContext","useRef","jsx","jsxs","Input","forwardRef","children","className","props","forwardedRef","hasChildren","innerRef","useRef","InputContainer","InputCapture","_ariaInvalid","_validation","restProps","ref","ctxAriaInvalid","ctxForwardedRef","ctxInnerRef","ctxValidation","ctx","useContext","InputContext","validation","ariaInvalid","cx","composeRefs","createContext","_ariaDisabled","disabled","style","type","ValidationFeedback","ValidationFeedback","name","validation","jsxs","jsx","clsx","Warning","CheckCircle","WarningDiamond","Eye","EyeClosed","clsx","forwardRef","useEffect","useState","jsx","jsxs","PasswordInput","forwardRef","maskHiddenValue","onBlur","onFocus","onValueVisibilityChange","showValue","props","ref","showPassword","setShowPassword","useState","type","EyeCon","Eye","EyeClosed","useEffect","isFocused","setIsFocused","Input","event","InputCapture","clsx"]}
package/dist/label.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-NSJFPSQC.js";import{forwardRef as p}from"react";import{jsx as b}from"react/jsx-runtime";var a=p(({"aria-disabled":r,children:o,className:l,disabled:s,onMouseDown:d,...i},f)=>b("label",{"aria-disabled":s??r,className:t("text-strong cursor-pointer text-sm peer-disabled:cursor-default has-[:disabled]:cursor-default aria-disabled:cursor-default",l),onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(d?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())},ref:f,...i,children:o}));a.displayName="Label";export{a as Label};
1
+ import{a as t}from"./chunk-EW5CFGXT.js";import{forwardRef as p}from"react";import{jsx as b}from"react/jsx-runtime";var a=p(({"aria-disabled":r,children:o,className:l,disabled:s,onMouseDown:d,...i},f)=>b("label",{"aria-disabled":s??r,className:t("text-strong cursor-pointer text-sm peer-disabled:cursor-default has-[:disabled]:cursor-default aria-disabled:cursor-default",l),onMouseDown:e=>{e.target.closest("button, input, select, textarea")||(d?.(e),!e.defaultPrevented&&e.detail>1&&e.preventDefault())},ref:f,...i,children:o}));a.displayName="Label";export{a as Label};
2
2
  //# sourceMappingURL=label.js.map
package/dist/label.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/label/label.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\ntype LabelProps = ComponentPropsWithoutRef<\"label\"> & {\n\tdisabled?: boolean;\n};\n\nconst Label = forwardRef<ElementRef<\"label\">, LabelProps>(\n\t({ \"aria-disabled\": _ariaDisabled, children, className, disabled, onMouseDown, ...props }, ref) => (\n\t\t<label\n\t\t\taria-disabled={disabled ?? _ariaDisabled}\n\t\t\tclassName={cx(\n\t\t\t\t\"text-strong cursor-pointer text-sm peer-disabled:cursor-default has-[:disabled]:cursor-default aria-disabled:cursor-default\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tonMouseDown={(event) => {\n\t\t\t\t// only prevent text selection if clicking inside the label itself\n\t\t\t\tconst target = event.target as HTMLElement;\n\t\t\t\tif (target.closest(\"button, input, select, textarea\")) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tonMouseDown?.(event);\n\n\t\t\t\t// prevent text selection when double clicking label\n\t\t\t\tif (!event.defaultPrevented && event.detail > 1) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t}}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</label>\n\t),\n);\nLabel.displayName = \"Label\";\n\nexport {\n\t//\n\tLabel,\n};\n"],"mappings":"wCAAA,OAAS,cAAAA,MAAkB,QAUzB,cAAAC,MAAA,oBAFF,IAAMC,EAAQC,EACb,CAAC,CAAE,gBAAiBC,EAAe,SAAAC,EAAU,UAAAC,EAAW,SAAAC,EAAU,YAAAC,EAAa,GAAGC,CAAM,EAAGC,IAC1FT,EAAC,SACA,gBAAeM,GAAYH,EAC3B,UAAWO,EACV,8HACAL,CACD,EACA,YAAcM,GAAU,CAERA,EAAM,OACV,QAAQ,iCAAiC,IAIpDJ,IAAcI,CAAK,EAGf,CAACA,EAAM,kBAAoBA,EAAM,OAAS,GAC7CA,EAAM,eAAe,EAEvB,EACA,IAAKF,EACJ,GAAGD,EAEH,SAAAJ,EACF,CAEF,EACAH,EAAM,YAAc","names":["forwardRef","jsx","Label","forwardRef","_ariaDisabled","children","className","disabled","onMouseDown","props","ref","cx","event"]}
1
+ {"version":3,"sources":["../src/components/label/label.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\n\ntype LabelProps = ComponentPropsWithoutRef<\"label\"> & {\n\tdisabled?: boolean;\n};\n\nconst Label = forwardRef<ElementRef<\"label\">, LabelProps>(\n\t({ \"aria-disabled\": _ariaDisabled, children, className, disabled, onMouseDown, ...props }, ref) => (\n\t\t<label\n\t\t\taria-disabled={disabled ?? _ariaDisabled}\n\t\t\tclassName={cx(\n\t\t\t\t\"text-strong cursor-pointer text-sm peer-disabled:cursor-default has-[:disabled]:cursor-default aria-disabled:cursor-default\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tonMouseDown={(event) => {\n\t\t\t\t// only prevent text selection if clicking inside the label itself\n\t\t\t\tconst target = event.target as HTMLElement;\n\t\t\t\tif (target.closest(\"button, input, select, textarea\")) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tonMouseDown?.(event);\n\n\t\t\t\t// prevent text selection when double clicking label\n\t\t\t\tif (!event.defaultPrevented && event.detail > 1) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t}}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</label>\n\t),\n);\nLabel.displayName = \"Label\";\n\nexport {\n\t//\n\tLabel,\n};\n"],"mappings":"wCAAA,OAAS,cAAAA,MAAkB,QAUzB,cAAAC,MAAA,oBAFF,IAAMC,EAAQC,EACb,CAAC,CAAE,gBAAiBC,EAAe,SAAAC,EAAU,UAAAC,EAAW,SAAAC,EAAU,YAAAC,EAAa,GAAGC,CAAM,EAAGC,IAC1FT,EAAC,SACA,gBAAeM,GAAYH,EAC3B,UAAWO,EACV,8HACAL,CACD,EACA,YAAcM,GAAU,CAERA,EAAM,OACV,QAAQ,iCAAiC,IAIpDJ,IAAcI,CAAK,EAGf,CAACA,EAAM,kBAAoBA,EAAM,OAAS,GAC7CA,EAAM,eAAe,EAEvB,EACA,IAAKF,EACJ,GAAGD,EAEH,SAAAJ,EACF,CAEF,EACAH,EAAM,YAAc","names":["forwardRef","jsx","Label","forwardRef","_ariaDisabled","children","className","disabled","onMouseDown","props","ref","cx","event"]}
@@ -1,2 +1,2 @@
1
- import{a as d}from"./chunk-NSJFPSQC.js";import{forwardRef as M}from"react";import{jsx as m}from"react/jsx-runtime";var n=M(({className:e,children:t,style:i},a)=>m("div",{ref:a,className:d("flex gap-4",e),style:i,children:t}));n.displayName="MediaObject";var s=M(({className:e,children:t,style:i},a)=>m("div",{ref:a,className:d("shrink-0 leading-none",e),style:i,children:t}));s.displayName="MediaObjectMedia";var l=M(({className:e,children:t,style:i},a)=>m("div",{ref:a,className:d("min-w-0 flex-1",e),style:i,children:t}));l.displayName="MediaObjectContent";export{n as MediaObject,l as MediaObjectContent,s as MediaObjectMedia};
1
+ import{a as d}from"./chunk-EW5CFGXT.js";import{forwardRef as M}from"react";import{jsx as m}from"react/jsx-runtime";var n=M(({className:e,children:t,style:i},a)=>m("div",{ref:a,className:d("flex gap-4",e),style:i,children:t}));n.displayName="MediaObject";var s=M(({className:e,children:t,style:i},a)=>m("div",{ref:a,className:d("shrink-0 leading-none",e),style:i,children:t}));s.displayName="MediaObjectMedia";var l=M(({className:e,children:t,style:i},a)=>m("div",{ref:a,className:d("min-w-0 flex-1",e),style:i,children:t}));l.displayName="MediaObjectContent";export{n as MediaObject,l as MediaObjectContent,s as MediaObjectMedia};
2
2
  //# sourceMappingURL=media-object.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/media-object/media-object.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx\";\n\n/**\n * The media object is an image/icon (media) to the left, with descriptive\n * content (title and subtitle/description) to the right.\n *\n * Change the spacing between the media and content by passing a `gap-*` class.\n * The default gap is `gap-4`.\n *\n * Use flexbox utilities to change the alignment of the media and content.\n *\n * Compose the media object with the `MediaObjectMedia` and `MediaObjectContent`\n * components as direct children.\n */\nconst MediaObject = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n\t({ className, children, style }, ref) => (\n\t\t<div ref={ref} className={cx(\"flex gap-4\", className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nMediaObject.displayName = \"MediaObject\";\n\n/**\n * The container for an image or icon to display in the media slot of the media object.\n */\nconst MediaObjectMedia = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n\t({ className, children, style }, ref) => (\n\t\t<div ref={ref} className={cx(\"shrink-0 leading-none\", className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nMediaObjectMedia.displayName = \"MediaObjectMedia\";\n\n/**\n * The container for the content slot of a media object.\n */\nconst MediaObjectContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n\t({ className, children, style }, ref) => (\n\t\t<div ref={ref} className={cx(\"min-w-0 flex-1\", className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nMediaObjectContent.displayName = \"MediaObjectContent\";\n\nexport { MediaObject, MediaObjectMedia, MediaObjectContent };\n"],"mappings":"wCAAA,OAAS,cAAAA,MAAkB,QAkBzB,cAAAC,MAAA,oBAFF,IAAMC,EAAcC,EACnB,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAChCN,EAAC,OAAI,IAAKM,EAAK,UAAWC,EAAG,aAAcJ,CAAS,EAAG,MAAOE,EAC5D,SAAAD,EACF,CAEF,EACAH,EAAY,YAAc,cAK1B,IAAMO,EAAmBN,EACxB,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAChCN,EAAC,OAAI,IAAKM,EAAK,UAAWC,EAAG,wBAAyBJ,CAAS,EAAG,MAAOE,EACvE,SAAAD,EACF,CAEF,EACAI,EAAiB,YAAc,mBAK/B,IAAMC,EAAqBP,EAC1B,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAChCN,EAAC,OAAI,IAAKM,EAAK,UAAWC,EAAG,iBAAkBJ,CAAS,EAAG,MAAOE,EAChE,SAAAD,EACF,CAEF,EACAK,EAAmB,YAAc","names":["forwardRef","jsx","MediaObject","forwardRef","className","children","style","ref","cx","MediaObjectMedia","MediaObjectContent"]}
1
+ {"version":3,"sources":["../src/components/media-object/media-object.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\n\n/**\n * The media object is an image/icon (media) to the left, with descriptive\n * content (title and subtitle/description) to the right.\n *\n * Change the spacing between the media and content by passing a `gap-*` class.\n * The default gap is `gap-4`.\n *\n * Use flexbox utilities to change the alignment of the media and content.\n *\n * Compose the media object with the `MediaObjectMedia` and `MediaObjectContent`\n * components as direct children.\n */\nconst MediaObject = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n\t({ className, children, style }, ref) => (\n\t\t<div ref={ref} className={cx(\"flex gap-4\", className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nMediaObject.displayName = \"MediaObject\";\n\n/**\n * The container for an image or icon to display in the media slot of the media object.\n */\nconst MediaObjectMedia = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n\t({ className, children, style }, ref) => (\n\t\t<div ref={ref} className={cx(\"shrink-0 leading-none\", className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nMediaObjectMedia.displayName = \"MediaObjectMedia\";\n\n/**\n * The container for the content slot of a media object.\n */\nconst MediaObjectContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n\t({ className, children, style }, ref) => (\n\t\t<div ref={ref} className={cx(\"min-w-0 flex-1\", className)} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t),\n);\nMediaObjectContent.displayName = \"MediaObjectContent\";\n\nexport { MediaObject, MediaObjectMedia, MediaObjectContent };\n"],"mappings":"wCAAA,OAAS,cAAAA,MAAkB,QAkBzB,cAAAC,MAAA,oBAFF,IAAMC,EAAcC,EACnB,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAChCN,EAAC,OAAI,IAAKM,EAAK,UAAWC,EAAG,aAAcJ,CAAS,EAAG,MAAOE,EAC5D,SAAAD,EACF,CAEF,EACAH,EAAY,YAAc,cAK1B,IAAMO,EAAmBN,EACxB,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAChCN,EAAC,OAAI,IAAKM,EAAK,UAAWC,EAAG,wBAAyBJ,CAAS,EAAG,MAAOE,EACvE,SAAAD,EACF,CAEF,EACAI,EAAiB,YAAc,mBAK/B,IAAMC,EAAqBP,EAC1B,CAAC,CAAE,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAChCN,EAAC,OAAI,IAAKM,EAAK,UAAWC,EAAG,iBAAkBJ,CAAS,EAAG,MAAOE,EAChE,SAAAD,EACF,CAEF,EACAK,EAAmB,YAAc","names":["forwardRef","jsx","MediaObject","forwardRef","className","children","style","ref","cx","MediaObjectMedia","MediaObjectContent"]}
@@ -1,5 +1,7 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
1
2
  import * as react from 'react';
2
3
  import { ComponentProps } from 'react';
4
+ import { W as WithAsChild } from './as-child-Cvu56SuO.js';
3
5
  import { B as ButtonGroup } from './button-group-CKDEXxVI.js';
4
6
  import { SelectTrigger } from './select.js';
5
7
  import 'class-variance-authority/types';
@@ -11,6 +13,9 @@ import '@radix-ui/react-select';
11
13
  import './types-Cs5ck3Vt.js';
12
14
 
13
15
  type CursorPaginationProps = ComponentProps<"div"> & {
16
+ /**
17
+ * The default number of items per page.
18
+ */
14
19
  defaultPageSize: number;
15
20
  };
16
21
  /**
@@ -24,23 +29,47 @@ type CursorPaginationProps = ComponentProps<"div"> & {
24
29
  */
25
30
  declare const CursorPagination: react.ForwardRefExoticComponent<Omit<CursorPaginationProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
26
31
  type CursorButtonsProps = Omit<ComponentProps<typeof ButtonGroup>, "appearance"> & {
32
+ /**
33
+ * Whether there is a next page of data to load.
34
+ */
27
35
  hasNextPage: boolean;
36
+ /**
37
+ * Whether there is a previous page of data to load.
38
+ */
28
39
  hasPreviousPage: boolean;
40
+ /**
41
+ * A callback that is called when the next page button is clicked.
42
+ */
29
43
  onNextPage?: () => void;
44
+ /**
45
+ * A callback that is called when the previous page button is clicked.
46
+ */
30
47
  onPreviousPage?: () => void;
31
48
  };
32
49
  /**
33
50
  * A pair of buttons for navigating between pages of data when using cursor-based pagination.
34
51
  */
35
52
  declare const CursorButtons: react.ForwardRefExoticComponent<Omit<CursorButtonsProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
53
+ declare const defaultPageSizes: readonly [5, 10, 20, 50, 100];
36
54
  type CursorPageSizeSelectProps = Omit<ComponentProps<typeof SelectTrigger>, "children"> & {
37
- pageSizes?: readonly number[];
55
+ /**
56
+ * A list of page sizes to choose from. The default page size must be included in this list.
57
+ */
58
+ pageSizes?: typeof defaultPageSizes | readonly number[];
59
+ /**
60
+ * A callback that is called when the page size is changed.
61
+ */
38
62
  onChangePageSize?: (value: number) => void;
39
63
  };
40
64
  /**
41
65
  * A select input for changing the number of items per page when using cursor-based pagination.
42
66
  */
43
67
  declare const CursorPageSizeSelect: react.ForwardRefExoticComponent<Omit<CursorPageSizeSelectProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
68
+ type CursorPageSizeValueProps = Omit<ComponentProps<"span">, "children"> & WithAsChild;
69
+ /**
70
+ * Displays the current page size when using cursor-based pagination as a read-only value.
71
+ */
72
+ declare function CursorPageSizeValue({ asChild, className, ...props }: CursorPageSizeValueProps): react_jsx_runtime.JSX.Element;
44
73
 
45
74
  type UseOffsetPaginationProps = {
46
75
  /**
@@ -107,4 +136,4 @@ type OffsetPaginationState = {
107
136
  */
108
137
  declare function useOffsetPagination({ listSize, pageSize }: UseOffsetPaginationProps): OffsetPaginationState;
109
138
 
110
- export { CursorButtons, type CursorButtonsProps, CursorPageSizeSelect, type CursorPageSizeSelectProps, CursorPagination, type CursorPaginationProps, type OffsetPaginationState, type UseOffsetPaginationProps, useOffsetPagination };
139
+ export { CursorButtons, type CursorButtonsProps, CursorPageSizeSelect, type CursorPageSizeSelectProps, CursorPageSizeValue, type CursorPageSizeValueProps, CursorPagination, type CursorPaginationProps, type OffsetPaginationState, type UseOffsetPaginationProps, useOffsetPagination };
@@ -1,2 +1,2 @@
1
- import{a as b,c as z,d as v,e as x,g as y}from"./chunk-5YA2UTFS.js";import{b as d}from"./chunk-JE2MBLEH.js";import{a as P,b as C}from"./chunk-EEMNPJIL.js";import"./chunk-YPNOQPCP.js";import"./chunk-7PF4QIBH.js";import"./chunk-XGNB7VBZ.js";import"./chunk-EAKUJEO5.js";import"./chunk-G2WLA5VU.js";import{a as p}from"./chunk-NSJFPSQC.js";import{CaretLeft as V}from"@phosphor-icons/react/dist/icons/CaretLeft";import{CaretRight as k}from"@phosphor-icons/react/dist/icons/CaretRight";import{createContext as F,forwardRef as l,useContext as $,useState as D}from"react";import f from"tiny-invariant";import{jsx as n,jsxs as m}from"react/jsx-runtime";var h=F(void 0),N=l(({className:s,children:a,defaultPageSize:r,...e},i)=>{let[t,o]=D(r);return n(h.Provider,{value:{defaultPageSize:r,pageSize:t,setPageSize:o},children:n("div",{className:p("inline-flex items-center justify-between gap-2",s),ref:i,...e,children:a})})});N.displayName="CursorPagination";var B=l(({hasNextPage:s,hasPreviousPage:a,onNextPage:r,onPreviousPage:e,...i},t)=>m(C,{appearance:"panel",ref:t,...i,children:[n(P,{appearance:"ghost",disabled:!a,icon:n(V,{}),label:"Previous page",onClick:e,size:"sm",type:"button"}),n(d,{orientation:"vertical",className:"min-h-5"}),n(P,{appearance:"ghost",disabled:!s,icon:n(k,{}),label:"Next page",onClick:r,size:"sm",type:"button"})]}));B.displayName="CursorButtons";var H=[5,10,20,50,100],O=l(({className:s,pageSizes:a=H,onChangePageSize:r,...e},i)=>{let t=$(h);return f(t,"CursorPageSizeSelect must be used as a child of a CursorPagination component"),f(a.includes(t.defaultPageSize),"defaultPageSize must be included in pageSizes"),f(a.includes(t.pageSize),"pageSize must be included in pageSizes"),m(b,{defaultValue:`${t.pageSize}`,onChange:o=>{let g=Number.parseInt(o,10);Number.isNaN(g)&&(g=t.defaultPageSize),t.setPageSize(g),r?.(g)},children:[n(v,{ref:i,className:p("w-auto min-w-36",s),value:t.pageSize,...e,children:n(z,{})}),n(x,{width:"trigger",children:a.map(o=>m(y,{value:`${o}`,children:[o," per page"]},o))})]})});O.displayName="CursorPageSizeSelect";import{useEffect as T,useState as w}from"react";function j({listSize:s,pageSize:a}){let[r,e]=w(1),[i,t]=w(a);T(()=>{t(a),e(1)},[a]),T(()=>{e(1)},[s]);let o=Math.ceil(s/i),g=(r-1)*i,c=r>1,S=r<o;function M(u){let U=Math.max(1,Math.min(u,o));e(U)}function E(){S&&e(u=>Math.min(u+1,o))}function R(){c&&e(u=>Math.max(u-1,1))}function G(u){t(u),e(1)}function I(){e(o)}function L(){e(1)}return{currentPage:r,goToFirstPage:L,goToLastPage:I,goToPage:M,hasNextPage:S,hasPreviousPage:c,nextPage:E,offset:g,pageSize:i,previousPage:R,setPageSize:G,totalPages:o}}export{B as CursorButtons,O as CursorPageSizeSelect,N as CursorPagination,j as useOffsetPagination};
1
+ import{a as b,c as v,d as x,e as y,g as h}from"./chunk-E6LNHWJ3.js";import{b as z}from"./chunk-CXQLUXDJ.js";import{a as d}from"./chunk-VTEPKCRP.js";import{a as m}from"./chunk-DK2VDJHL.js";import"./chunk-47UGLBIG.js";import"./chunk-4LSFAAZW.js";import"./chunk-RDMTCZPT.js";import"./chunk-6EMCH2HX.js";import"./chunk-ZOQ33WW5.js";import"./chunk-5E73VWJX.js";import{a as p}from"./chunk-EW5CFGXT.js";import{CaretLeft as j}from"@phosphor-icons/react/dist/icons/CaretLeft";import{CaretRight as k}from"@phosphor-icons/react/dist/icons/CaretRight";import{Slot as A}from"@radix-ui/react-slot";import{createContext as F,forwardRef as f,useContext as N,useState as W}from"react";import P from"tiny-invariant";import{jsx as s,jsxs as l}from"react/jsx-runtime";var c=F(void 0),O=f(({className:n,children:o,defaultPageSize:a,...e},i)=>{let[t,r]=W(a);return s(c.Provider,{value:{defaultPageSize:a,pageSize:t,setPageSize:r},children:s("div",{className:p("inline-flex items-center justify-between gap-2",n),ref:i,...e,children:o})})});O.displayName="CursorPagination";var B=f(({hasNextPage:n,hasPreviousPage:o,onNextPage:a,onPreviousPage:e,...i},t)=>l(d,{appearance:"panel",ref:t,...i,children:[s(m,{appearance:"ghost",disabled:!o,icon:s(j,{}),label:"Previous page",onClick:e,size:"sm",type:"button"}),s(z,{orientation:"vertical",className:"min-h-5"}),s(m,{appearance:"ghost",disabled:!n,icon:s(k,{}),label:"Next page",onClick:a,size:"sm",type:"button"})]}));B.displayName="CursorButtons";var $=[5,10,20,50,100],T=f(({className:n,pageSizes:o=$,onChangePageSize:a,...e},i)=>{let t=N(c);return P(t,"CursorPageSizeSelect must be used as a child of a CursorPagination component"),P(o.includes(t.defaultPageSize),"CursorPagination.defaultPageSize must be included in CursorPageSizeSelect.pageSizes"),P(o.includes(t.pageSize),"CursorPagination.pageSize must be included in CursorPageSizeSelect.pageSizes"),l(b,{defaultValue:`${t.pageSize}`,onChange:r=>{let g=Number.parseInt(r,10);Number.isNaN(g)&&(g=t.defaultPageSize),t.setPageSize(g),a?.(g)},children:[s(x,{ref:i,className:p("w-auto min-w-36",n),value:t.pageSize,...e,children:s(v,{})}),s(y,{width:"trigger",children:o.map(r=>l(h,{value:`${r}`,children:[r," per page"]},r))})]})});T.displayName="CursorPageSizeSelect";function D({asChild:n=!1,className:o,...a}){let e=N(c);return P(e,"CursorPageSizeValue must be used as a child of a CursorPagination component"),l(n?A:"span",{className:p("text-muted text-sm font-normal",o),...a,children:[e.pageSize," per page"]})}import{useEffect as V,useState as w}from"react";function H({listSize:n,pageSize:o}){let[a,e]=w(1),[i,t]=w(o);V(()=>{t(o),e(1)},[o]),V(()=>{e(1)},[n]);let r=Math.ceil(n/i),g=(a-1)*i,S=a>1,C=a<r;function M(u){let U=Math.max(1,Math.min(u,r));e(U)}function E(){C&&e(u=>Math.min(u+1,r))}function R(){S&&e(u=>Math.max(u-1,1))}function G(u){t(u),e(1)}function I(){e(r)}function L(){e(1)}return{currentPage:a,goToFirstPage:L,goToLastPage:I,goToPage:M,hasNextPage:C,hasPreviousPage:S,nextPage:E,offset:g,pageSize:i,previousPage:R,setPageSize:G,totalPages:r}}export{B as CursorButtons,T as CursorPageSizeSelect,D as CursorPageSizeValue,O as CursorPagination,H as useOffsetPagination};
2
2
  //# sourceMappingURL=pagination.js.map