@ngrok/mantle 0.25.2 → 0.27.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 (45) hide show
  1. package/dist/alert-dialog.js +1 -1
  2. package/dist/chunk-DDMTW6XB.js +2 -0
  3. package/dist/chunk-DDMTW6XB.js.map +1 -0
  4. package/dist/chunk-FHW7SSNY.js +2 -0
  5. package/dist/chunk-FHW7SSNY.js.map +1 -0
  6. package/dist/chunk-GOXG4BVJ.js +2 -0
  7. package/dist/chunk-GOXG4BVJ.js.map +1 -0
  8. package/dist/chunk-GYPSB3OK.js +2 -0
  9. package/dist/chunk-GYPSB3OK.js.map +1 -0
  10. package/dist/chunk-WGF5NYWL.js +2 -0
  11. package/dist/chunk-WGF5NYWL.js.map +1 -0
  12. package/dist/chunk-YAT4IMMN.js +2 -0
  13. package/dist/chunk-YAT4IMMN.js.map +1 -0
  14. package/dist/code-block.js +3 -3
  15. package/dist/code-block.js.map +1 -1
  16. package/dist/data-table.d.ts +42 -0
  17. package/dist/data-table.js +1 -1
  18. package/dist/data-table.js.map +1 -1
  19. package/dist/dialog.js +1 -1
  20. package/dist/direction-veAOo2is.d.ts +143 -0
  21. package/dist/icons.d.ts +37 -0
  22. package/dist/icons.js +2 -0
  23. package/dist/icons.js.map +1 -0
  24. package/dist/pagination.js +1 -1
  25. package/dist/select.d.ts +22 -6
  26. package/dist/select.js +1 -1
  27. package/dist/sheet.js +1 -1
  28. package/dist/sorting.d.ts +18 -0
  29. package/dist/sorting.js +2 -0
  30. package/dist/sorting.js.map +1 -0
  31. package/dist/table.d.ts +375 -10
  32. package/dist/table.js +1 -1
  33. package/dist/table.js.map +1 -1
  34. package/dist/tailwind-preset.cjs +1 -1
  35. package/dist/tailwind-preset.cjs.map +1 -1
  36. package/dist/tailwind-preset.d.cts +1 -1
  37. package/dist/tailwind-preset.d.ts +1 -1
  38. package/dist/tailwind-preset.js +1 -1
  39. package/dist/tailwind-preset.js.map +1 -1
  40. package/dist/toast.js +1 -1
  41. package/package.json +25 -15
  42. package/dist/chunk-7FIV4E5C.js +0 -2
  43. package/dist/chunk-7FIV4E5C.js.map +0 -1
  44. package/dist/chunk-ATNIDU3M.js +0 -2
  45. package/dist/chunk-ATNIDU3M.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{a as A,b as D,c as y,d as g,e as u,f as C,g as P,h as v}from"./chunk-PBARMKNJ.js";import{g as c}from"./chunk-ATNIDU3M.js";import"./chunk-DOTYPWKO.js";import"./chunk-D3XF6J5A.js";import{b as m}from"./chunk-J3NVDJIE.js";import"./chunk-4LSFAAZW.js";import"./chunk-3C5O3AQA.js";import"./chunk-72TJUKMV.js";import"./chunk-7O36LG52.js";import{a as f}from"./chunk-HDPLH5HC.js";import{a}from"./chunk-AZ56JGNY.js";import{Info as j}from"@phosphor-icons/react/Info";import{Warning as F}from"@phosphor-icons/react/Warning";import{Slot as d}from"@radix-ui/react-slot";import{createContext as H,forwardRef as n,useContext as V,useMemo as k}from"react";import M from"tiny-invariant";import{jsx as i,jsxs as G}from"react/jsx-runtime";var x=H(null);function N(){let t=V(x);return M(t,"AlertDialog child component used outside of AlertDialog parent!"),t}function R({priority:t,...e}){let o=k(()=>({priority:t}),[t]);return i(x.Provider,{value:o,children:i(A,{...e})})}R.displayName="AlertDialog";var $=D,q=y,h=n(({className:t,...e},o)=>i(u,{className:a("data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-sm",t),...e,ref:o}));h.displayName="AlertDialogOverlay";var b=n(({className:t,onInteractOutside:e,onPointerDownOutside:o,preferredWidth:l="max-w-md",...r},p)=>G(q,{children:[i(h,{}),i("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:i(C,{ref:p,className:a("flex w-full flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start","outline-none focus-within:outline-none","p-6","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",l,t),onInteractOutside:s=>{c(s),e?.(s)},onPointerDownOutside:s=>{c(s),o?.(s)},...r})})]}));b.displayName="AlertDialogContent";var W=n(({asChild:t=!1,className:e,...o},l)=>i(t?d:"div",{className:a("flex-1 space-y-4",e),ref:l,...o}));W.displayName="AlertDialogBody";var O=n(({asChild:t=!1,className:e,...o},l)=>i(t?d:"div",{className:a("flex flex-col space-y-2 text-center sm:text-start",e),...o}));O.displayName="AlertDialogHeader";var w=n(({asChild:t=!1,className:e,...o},l)=>i(t?d:"div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...o}));w.displayName="AlertDialogFooter";var B=n(({className:t,...e},o)=>i(P,{ref:o,className:a("text-strong text-center text-lg font-medium sm:text-start",t),...e}));B.displayName="AlertDialogTitle";var I=n(({className:t,...e},o)=>i(v,{ref:o,className:a("text-body text-center text-sm font-normal sm:text-start",t),...e}));I.displayName="AlertDialogDescription";var T=n(({appearance:t="filled",...e},o)=>{let l=N(),r="default";return l.priority==="danger"&&(r="danger"),i(m,{appearance:t,priority:r,ref:o,...e})});T.displayName="AlertDialogAction";var z=n(({appearance:t="outlined",className:e,priority:o="neutral",...l},r)=>i(g,{asChild:!0,children:i(m,{appearance:t,className:a("mt-2 sm:mt-0",e),priority:o,ref:r,...l})}));z.displayName="AlertDialogCancel";var S=n(({className:t,svg:e,...o},l)=>{let r=N(),p=r.priority==="danger"?"text-danger-600":"text-accent-600",s=r.priority==="danger"?i(F,{}):i(j,{});return i(f,{ref:l,className:a("size-12 sm:size-7",p,t),svg:e??s,...o})});S.displayName="AlertDialogIcon";var E=g;export{R as AlertDialog,T as AlertDialogAction,W as AlertDialogBody,z as AlertDialogCancel,E as AlertDialogClose,b as AlertDialogContent,I as AlertDialogDescription,w as AlertDialogFooter,O as AlertDialogHeader,S as AlertDialogIcon,B as AlertDialogTitle,$ as AlertDialogTrigger};
1
+ import{a as A,b as D,c as y,d as g,e as u,f as C,g as P,h as v}from"./chunk-PBARMKNJ.js";import{g as c}from"./chunk-DDMTW6XB.js";import"./chunk-DOTYPWKO.js";import"./chunk-D3XF6J5A.js";import{b as m}from"./chunk-J3NVDJIE.js";import"./chunk-4LSFAAZW.js";import"./chunk-3C5O3AQA.js";import"./chunk-72TJUKMV.js";import"./chunk-7O36LG52.js";import{a as f}from"./chunk-HDPLH5HC.js";import{a}from"./chunk-AZ56JGNY.js";import{Info as j}from"@phosphor-icons/react/Info";import{Warning as F}from"@phosphor-icons/react/Warning";import{Slot as d}from"@radix-ui/react-slot";import{createContext as H,forwardRef as n,useContext as V,useMemo as k}from"react";import M from"tiny-invariant";import{jsx as i,jsxs as G}from"react/jsx-runtime";var x=H(null);function N(){let t=V(x);return M(t,"AlertDialog child component used outside of AlertDialog parent!"),t}function R({priority:t,...e}){let o=k(()=>({priority:t}),[t]);return i(x.Provider,{value:o,children:i(A,{...e})})}R.displayName="AlertDialog";var $=D,q=y,h=n(({className:t,...e},o)=>i(u,{className:a("data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-sm",t),...e,ref:o}));h.displayName="AlertDialogOverlay";var b=n(({className:t,onInteractOutside:e,onPointerDownOutside:o,preferredWidth:l="max-w-md",...r},p)=>G(q,{children:[i(h,{}),i("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:i(C,{ref:p,className:a("flex w-full flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start","outline-none focus-within:outline-none","p-6","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",l,t),onInteractOutside:s=>{c(s),e?.(s)},onPointerDownOutside:s=>{c(s),o?.(s)},...r})})]}));b.displayName="AlertDialogContent";var W=n(({asChild:t=!1,className:e,...o},l)=>i(t?d:"div",{className:a("flex-1 space-y-4",e),ref:l,...o}));W.displayName="AlertDialogBody";var O=n(({asChild:t=!1,className:e,...o},l)=>i(t?d:"div",{className:a("flex flex-col space-y-2 text-center sm:text-start",e),...o}));O.displayName="AlertDialogHeader";var w=n(({asChild:t=!1,className:e,...o},l)=>i(t?d:"div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...o}));w.displayName="AlertDialogFooter";var B=n(({className:t,...e},o)=>i(P,{ref:o,className:a("text-strong text-center text-lg font-medium sm:text-start",t),...e}));B.displayName="AlertDialogTitle";var I=n(({className:t,...e},o)=>i(v,{ref:o,className:a("text-body text-center text-sm font-normal sm:text-start",t),...e}));I.displayName="AlertDialogDescription";var T=n(({appearance:t="filled",...e},o)=>{let l=N(),r="default";return l.priority==="danger"&&(r="danger"),i(m,{appearance:t,priority:r,ref:o,...e})});T.displayName="AlertDialogAction";var z=n(({appearance:t="outlined",className:e,priority:o="neutral",...l},r)=>i(g,{asChild:!0,children:i(m,{appearance:t,className:a("mt-2 sm:mt-0",e),priority:o,ref:r,...l})}));z.displayName="AlertDialogCancel";var S=n(({className:t,svg:e,...o},l)=>{let r=N(),p=r.priority==="danger"?"text-danger-600":"text-accent-600",s=r.priority==="danger"?i(F,{}):i(j,{});return i(f,{ref:l,className:a("size-12 sm:size-7",p,t),svg:e??s,...o})});S.displayName="AlertDialogIcon";var E=g;export{R as AlertDialog,T as AlertDialogAction,W as AlertDialogBody,z as AlertDialogCancel,E as AlertDialogClose,b as AlertDialogContent,I as AlertDialogDescription,w as AlertDialogFooter,O as AlertDialogHeader,S as AlertDialogIcon,B as AlertDialogTitle,$ as AlertDialogTrigger};
2
2
  //# sourceMappingURL=alert-dialog.js.map
@@ -0,0 +1,2 @@
1
+ import{l as P}from"./chunk-DOTYPWKO.js";import{a as p}from"./chunk-7O36LG52.js";import{a as i}from"./chunk-AZ56JGNY.js";import{CheckCircle as v}from"@phosphor-icons/react/CheckCircle";import{Info as h}from"@phosphor-icons/react/Info";import{Warning as C}from"@phosphor-icons/react/Warning";import{WarningDiamond as b}from"@phosphor-icons/react/WarningDiamond";import{Slot as u}from"@radix-ui/react-slot";import{createContext as y,forwardRef as d,useContext as f}from"react";import*as m from"sonner";import{jsx as r,jsxs as A}from"react/jsx-runtime";var B=({className:t,containerAriaLabel:o,dir:e,duration_ms:s=4e3,position:n="top-center",style:a})=>{let c=P();return r(m.Toaster,{className:i("toaster overlay-prompt pointer-events-auto font-sans *:duration-200",t),containerAriaLabel:o,dir:e,duration:s,gap:12,position:n??"top-center",style:a,theme:c,toastOptions:{unstyled:!0}})},g=y("");function _(t,o){return m.toast.custom(e=>r(g.Provider,{value:e,children:t}),{duration:o?.duration_ms,...o?.id?{id:o.id}:{},unstyled:!0})}var T=y({priority:"info"}),j=d(({asChild:t,children:o,className:e,priority:s,...n},a)=>{let c=t?u:"div";return r(T.Provider,{value:{priority:s},children:A(c,{className:i("relative flex items-start gap-2 text-sm","p-3 pl-[0.9375rem]","bg-popover high-contrast:border-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg",e),ref:a,...n,children:[r(w,{priority:s}),o]})})}),D=d(({className:t,svg:o,...e},s)=>{let n=f(T);switch(n.priority){case"danger":return r(p,{className:i("text-danger-600",t),ref:s,svg:o??r(C,{weight:"fill"}),...e});case"warning":return r(p,{className:i("text-warning-600",t),ref:s,svg:o??r(b,{weight:"fill"}),...e});case"success":return r(p,{className:i("text-success-600",t),ref:s,svg:o??r(v,{weight:"fill"}),...e});case"info":return r(p,{className:i("text-accent-600",t),ref:s,svg:r(h,{weight:"fill"}),...e});default:throw new Error(`Unreachable Case: ${n.priority}`)}}),L=d(({asChild:t,className:o,onClick:e,...s},n)=>{let a=f(g);return r(t?u:"button",{className:i("shrink-0","data-[icon-button]:-mr-0.5 data-[icon-button]:-mt-0.5 data-[icon-button]:rounded-sm",o),onClick:l=>{e?.(l),!l.defaultPrevented&&m.toast.dismiss(a)},ref:n,...s})}),z=d(({asChild:t,className:o,...e},s)=>r(t?u:"p",{className:i("text-strong flex-1 text-sm",o),ref:s,...e}));function F(t){t.target instanceof Element&&t.target.closest(".overlay-prompt")&&t.preventDefault()}var x={info:"bg-accent-600",warning:"bg-warning-600",success:"bg-success-600",danger:"bg-danger-600"};function w({className:t,priority:o,...e}){return r("div",{"aria-hidden":!0,className:i("z-1 absolute -inset-px right-auto w-1.5 rounded-l",x[o],t),...e})}export{B as a,_ as b,j as c,D as d,L as e,z as f,F as g};
2
+ //# sourceMappingURL=chunk-DDMTW6XB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/toast/toast.tsx"],"sourcesContent":["\"use client\";\n\nimport { CheckCircle } from \"@phosphor-icons/react/CheckCircle\";\nimport { Info } from \"@phosphor-icons/react/Info\";\nimport { Warning } from \"@phosphor-icons/react/Warning\";\nimport { WarningDiamond } from \"@phosphor-icons/react/WarningDiamond\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n\ttype ComponentProps,\n\ttype ComponentRef,\n\ttype ReactNode,\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n} from \"react\";\nimport * as ToastPrimitive from \"sonner\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport type { WithStyleProps } from \"../../types/with-style-props.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon } from \"../icon/icon.js\";\nimport type { SvgOnlyProps } from \"../icon/svg-only.js\";\nimport { useAppliedTheme } from \"../theme-provider/theme-provider.js\";\n\ntype ToasterPrimitiveProps = ComponentProps<typeof ToastPrimitive.Toaster>;\ntype ToasterPrimitiveTheme = ToasterPrimitiveProps[\"theme\"];\n\ntype ToasterProps = WithStyleProps &\n\tPick<ToasterPrimitiveProps, \"containerAriaLabel\" | \"dir\" | \"position\"> & {\n\t\t/**\n\t\t * Time in milliseconds that should elapse before automatically dismissing toasts.\n\t\t * When set here, this will be the default duration for all toasts.\n\t\t * @default 4000\n\t\t */\n\t\tduration_ms?: number;\n\t};\n\n/**\n * A container for displaying all toasts.\n *\n * Only one `<Toaster />` should be rendered in an app a time, preferably at the\n * root level of the app.\n */\nconst Toaster = ({\n\t//,\n\tclassName,\n\tcontainerAriaLabel,\n\tdir,\n\tduration_ms = 4000,\n\tposition = \"top-center\",\n\tstyle,\n}: ToasterProps) => {\n\tconst theme = useAppliedTheme();\n\n\treturn (\n\t\t<ToastPrimitive.Toaster\n\t\t\tclassName={cx(\n\t\t\t\t\"toaster overlay-prompt pointer-events-auto font-sans *:duration-200\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tcontainerAriaLabel={containerAriaLabel}\n\t\t\tdir={dir}\n\t\t\tduration={duration_ms}\n\t\t\tgap={12}\n\t\t\tposition={position ?? \"top-center\"}\n\t\t\tstyle={style}\n\t\t\ttheme={theme as ToasterPrimitiveTheme} // we have additional themes that are not in the sonner types, so we need to cast for now\n\t\t\ttoastOptions={{\n\t\t\t\tunstyled: true,\n\t\t\t}}\n\t\t/>\n\t);\n};\n\nconst ToastIdContext = createContext<string | number>(\"\");\n\ntype MakeToastOptions = {\n\t/**\n\t * Time in milliseconds that should elapse before automatically closing the toast.\n\t * Will default to the `<Toaster />`'s `duration_ms` if not provided.\n\t */\n\tduration_ms?: number;\n\t/**\n\t * An optional custom ID for this toast. If not given, a unique ID is provided for you.\n\t */\n\tid?: string;\n};\n\n/**\n * Create a toast. Provide a `<Toast>` component as the `children` to be rendered\n * inside the `<Toaster />` section.\n */\nfunction makeToast(children: ReactNode, options?: MakeToastOptions) {\n\treturn ToastPrimitive.toast.custom(\n\t\t(toastId) => (\n\t\t\t<ToastIdContext.Provider value={toastId}>\n\t\t\t\t{children}\n\t\t\t</ToastIdContext.Provider>\n\t\t),\n\t\t{\n\t\t\t//\n\t\t\tduration: options?.duration_ms,\n\t\t\t// If a custom ID is provided, use it, else use the toastId provided by the sonner library\n\t\t\t// don't set an ID to `undefined` as it breaks the sonner library\n\t\t\t...(options?.id ? { id: options.id } : {}),\n\t\t\tunstyled: true,\n\t\t},\n\t);\n}\n\nconst priorities = [\n\t//,\n\t\"danger\",\n\t\"info\",\n\t\"success\",\n\t\"warning\",\n] as const;\ntype Priority = (typeof priorities)[number];\n\ntype ToastState = {\n\tpriority: Priority;\n};\n\nconst ToastStateContext = createContext<ToastState>({\n\tpriority: \"info\",\n});\n\ntype ToastProps = ComponentProps<\"div\"> &\n\tWithAsChild & {\n\t\tpriority: Priority;\n\t};\n\n/**\n * A succinct message with a priority that is displayed temporarily.\n * Toasts are used to provide feedback to the user without interrupting their workflow.\n */\nconst Toast = forwardRef<ComponentRef<\"div\">, ToastProps>(\n\t({ asChild, children, className, priority, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"div\";\n\n\t\treturn (\n\t\t\t<ToastStateContext.Provider value={{ priority }}>\n\t\t\t\t<Component\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"relative flex items-start gap-2 text-sm\",\n\t\t\t\t\t\t\"p-3 pl-[0.9375rem]\",\n\t\t\t\t\t\t\"bg-popover high-contrast:border-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg\",\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Do not apply overflow-hidden because we want the priority bar accent\n\t\t\t\t\t\t * to overlap the toast border, else the border flows over the\n\t\t\t\t\t\t * priority bar.\n\t\t\t\t\t\t */\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<PriorityBarAccent priority={priority} />\n\t\t\t\t\t{children}\n\t\t\t\t</Component>\n\t\t\t</ToastStateContext.Provider>\n\t\t);\n\t},\n);\n\ntype ToastIconProps = Partial<SvgOnlyProps>;\n\n/**\n * An icon that visually represents the priority of the toast.\n * If you do not provide an icon, the default icon and color for the priority is used.\n */\nconst ToastIcon = forwardRef<ComponentRef<\"svg\">, ToastIconProps>(\n\t({ className, svg, ...props }, ref) => {\n\t\tconst ctx = useContext(ToastStateContext);\n\n\t\tswitch (ctx.priority) {\n\t\t\tcase \"danger\":\n\t\t\t\treturn (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={cx(\"text-danger-600\", className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\tsvg={svg ?? <Warning weight=\"fill\" />}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tcase \"warning\":\n\t\t\t\treturn (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={cx(\"text-warning-600\", className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\tsvg={svg ?? <WarningDiamond weight=\"fill\" />}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tcase \"success\":\n\t\t\t\treturn (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={cx(\"text-success-600\", className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\tsvg={svg ?? <CheckCircle weight=\"fill\" />}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tcase \"info\":\n\t\t\t\treturn (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\t//\n\t\t\t\t\t\tclassName={cx(\"text-accent-600\", className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\tsvg={<Info weight=\"fill\" />}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Unreachable Case: ${ctx.priority}`);\n\t\t}\n\t},\n);\n\ntype ToastActionProps = ComponentProps<\"button\"> & WithAsChild;\n\n/**\n * A button that dismisses the toast when clicked.\n * You can prevent the toast from being dismissed `onClick` by calling `event.preventDefault()`\n */\nconst ToastAction = forwardRef<ComponentRef<\"button\">, ToastActionProps>(\n\t({ asChild, className, onClick, ...props }, ref) => {\n\t\tconst ctx = useContext(ToastIdContext);\n\n\t\tconst Component = asChild ? Slot : \"button\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tclassName={cx(\n\t\t\t\t\t//,\n\t\t\t\t\t\"shrink-0\",\n\t\t\t\t\t// 👇 wiggle the bits so that icon buttons toast actions are aligned with the toast icon\n\t\t\t\t\t\"data-[icon-button]:-mr-0.5 data-[icon-button]:-mt-0.5 data-[icon-button]:rounded-sm\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonClick={(event) => {\n\t\t\t\t\tonClick?.(event);\n\t\t\t\t\tif (event.defaultPrevented) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tToastPrimitive.toast.dismiss(ctx);\n\t\t\t\t}}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\n\ntype ToastMessageProps = ComponentProps<\"p\"> & WithAsChild;\n\n/**\n * The message content of the toast.\n */\nconst ToastMessage = forwardRef<ComponentRef<\"p\">, ToastMessageProps>(\n\t({ asChild, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"p\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\t//\n\t\t\t\tclassName={cx(\"text-strong flex-1 text-sm\", className)}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\n\nexport {\n\t//,\n\tmakeToast,\n\tToast,\n\tToastAction,\n\tToaster,\n\tToastIcon,\n\tToastMessage,\n};\n\nexport type {\n\t//,\n\tPriority,\n};\n\n/**\n * @private\n *\n * Allows any mantle floating prompt (e.g. toasts and notifications) to be interacted with\n * even when a modaled view (e.g. dialog, sheet, etc) is open and a focus trap is active.\n *\n * Without this, interacting with the prompt would close the modaled view.\n */\nexport function preventCloseOnPromptInteraction(\n\tevent: CustomEvent | PointerEvent | MouseEvent | TouchEvent | FocusEvent,\n) {\n\tif (!(event.target instanceof Element)) {\n\t\treturn;\n\t}\n\n\tif (event.target.closest(\".overlay-prompt\")) {\n\t\tevent.preventDefault();\n\t}\n}\n\nconst priorityBackgroundColor = {\n\tinfo: \"bg-accent-600\",\n\twarning: \"bg-warning-600\",\n\tsuccess: \"bg-success-600\",\n\tdanger: \"bg-danger-600\",\n} as const satisfies Record<Priority, string>;\n\ntype PriorityBarAccentProps = Omit<ComponentProps<\"div\">, \"children\"> & {\n\tpriority: Priority;\n};\n\n/**\n * @private\n *\n * A colored bar that visually represents the priority of the toast.\n */\nfunction PriorityBarAccent({\n\tclassName,\n\tpriority,\n\t...props\n}: PriorityBarAccentProps) {\n\treturn (\n\t\t<div\n\t\t\taria-hidden\n\t\t\tclassName={cx(\n\t\t\t\t//\n\t\t\t\t\"z-1 absolute -inset-px right-auto w-1.5 rounded-l\",\n\t\t\t\tpriorityBackgroundColor[priority],\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n"],"mappings":"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","names":["CheckCircle","Info","Warning","WarningDiamond","Slot","createContext","forwardRef","useContext","ToastPrimitive","jsx","jsxs","Toaster","className","containerAriaLabel","dir","duration_ms","position","style","theme","useAppliedTheme","cx","ToastIdContext","createContext","makeToast","children","options","toastId","ToastStateContext","createContext","Toast","forwardRef","asChild","children","className","priority","props","ref","Component","Slot","jsx","jsxs","cx","PriorityBarAccent","ToastIcon","svg","ctx","useContext","Icon","Warning","WarningDiamond","CheckCircle","Info","ToastAction","onClick","ToastIdContext","event","ToastMessage","preventCloseOnPromptInteraction","event","priorityBackgroundColor","PriorityBarAccent","className","priority","props","jsx","cx"]}
@@ -0,0 +1,2 @@
1
+ import{m as r}from"./chunk-GYPSB3OK.js";import{SortAscending as o}from"@phosphor-icons/react/SortAscending";import{SortDescending as n}from"@phosphor-icons/react/SortDescending";import"react";import{jsx as i}from"react/jsx-runtime";var m=({mode:c,direction:t,...e})=>{switch(c){case"alphanumeric":switch(t){case"asc":return i(o,{...e});case"desc":return i(n,{...e});default:throw new Error(`Invalid alphanumeric sorting direction given: "${t}"`)}case"time":switch(r(t)){case"oldest-to-newest":return i(n,{...e});case"newest-to-oldest":return i(o,{...e});default:throw new Error(`Invalid time sorting direction given: "${t}"`)}}};m.displayName="Sort";export{m as a};
2
+ //# sourceMappingURL=chunk-FHW7SSNY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/icons/sort.tsx"],"sourcesContent":["import { SortAscending } from \"@phosphor-icons/react/SortAscending\";\nimport { SortDescending } from \"@phosphor-icons/react/SortDescending\";\nimport { type ComponentRef, forwardRef } from \"react\";\nimport {\n\t$timeSortingDirection,\n\ttype AlphanumericSortingDirection,\n\ttype SortingDirection,\n\ttype SortingMode,\n\ttype TimeSortingDirection,\n} from \"../../utils/sorting/direction.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\n\ntype Props = SvgAttributes &\n\t(\n\t\t| {\n\t\t\t\tmode: Extract<SortingMode, \"alphanumeric\">;\n\t\t\t\t/**\n\t\t\t\t * Sort by alphanumeric order in \"ascending\" (asc) or \"descending\" (desc) order.\n\t\t\t\t * @example \"asc\" for A-Z, 0-9\n\t\t\t\t * @example \"desc\" for Z-A, 0-9\n\t\t\t\t */\n\t\t\t\tdirection: AlphanumericSortingDirection;\n\t\t }\n\t\t| {\n\t\t\t\tmode: Extract<SortingMode, \"time\">;\n\t\t\t\t/**\n\t\t\t\t * Sort by time in \"newest-to-oldest\" (descending, desc) or \"oldest-to-newest\" (ascending, asc) order.\n\t\t\t\t * @example \"newest-to-oldest\" for newest first (aka descending, desc)\n\t\t\t\t * @example \"oldest-to-newest\" for oldest first (aka ascending, asc)\n\t\t\t\t */\n\t\t\t\tdirection: TimeSortingDirection | SortingDirection;\n\t\t }\n\t);\n\n/**\n * A sorting icon that can be used to indicate the sorting direction of a table column or list.\n * It is aware of the sorting mode (alphanumeric or time) and the sorting direction (ascending or descending).\n */\nconst Sort = ({ mode, direction, ...props }: Props) => {\n\tswitch (mode) {\n\t\tcase \"alphanumeric\": {\n\t\t\tswitch (direction) {\n\t\t\t\tcase \"asc\":\n\t\t\t\t\treturn <SortAscending {...props} />;\n\t\t\t\tcase \"desc\":\n\t\t\t\t\treturn <SortDescending {...props} />;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Invalid alphanumeric sorting direction given: \"${direction}\"`,\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tcase \"time\": {\n\t\t\tconst timeSortingDirection = $timeSortingDirection(direction);\n\n\t\t\tswitch (timeSortingDirection) {\n\t\t\t\tcase \"oldest-to-newest\":\n\t\t\t\t\treturn <SortDescending {...props} />;\n\t\t\t\tcase \"newest-to-oldest\":\n\t\t\t\t\treturn <SortAscending {...props} />;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Invalid time sorting direction given: \"${direction}\"`,\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n};\nSort.displayName = \"Sort\";\n\nexport {\n\t//,\n\tSort,\n};\n"],"mappings":"wCAAA,OAAS,iBAAAA,MAAqB,sCAC9B,OAAS,kBAAAC,MAAsB,uCAC/B,MAA8C,QAyClC,cAAAC,MAAA,oBALZ,IAAMC,EAAO,CAAC,CAAE,KAAAC,EAAM,UAAAC,EAAW,GAAGC,CAAM,IAAa,CACtD,OAAQF,EAAM,CACb,IAAK,eACJ,OAAQC,EAAW,CAClB,IAAK,MACJ,OAAOH,EAACK,EAAA,CAAe,GAAGD,EAAO,EAClC,IAAK,OACJ,OAAOJ,EAACM,EAAA,CAAgB,GAAGF,EAAO,EACnC,QACC,MAAM,IAAI,MACT,kDAAkDD,CAAS,GAC5D,CACF,CAED,IAAK,OAGJ,OAF6BI,EAAsBJ,CAAS,EAE9B,CAC7B,IAAK,mBACJ,OAAOH,EAACM,EAAA,CAAgB,GAAGF,EAAO,EACnC,IAAK,mBACJ,OAAOJ,EAACK,EAAA,CAAe,GAAGD,EAAO,EAClC,QACC,MAAM,IAAI,MACT,0CAA0CD,CAAS,GACpD,CACF,CAEF,CACD,EACAF,EAAK,YAAc","names":["SortAscending","SortDescending","jsx","Sort","mode","direction","props","SortAscending","SortDescending","$timeSortingDirection"]}
@@ -0,0 +1,2 @@
1
+ import{jsx as c,jsxs as t}from"react/jsx-runtime";function s(h){return t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...h,children:[c("path",{fill:"none",d:"M0 0h256v256H0z"}),c("path",{d:"m213.7 82.3-56-56c-1.5-1.5-3.5-2.3-5.7-2.3H56c-8.8 0-16 7.2-16 16v88c0 4.4 3.6 8 8 8s8-3.6 8-8V40h88v48c0 4.4 3.6 8 8 8h48v120h-40c-4.4 0-8 3.6-8 8s3.6 8 8 8h40c8.8 0 16-7.2 16-16V88c0-2.1-.8-4.2-2.3-5.7zm-53.7-31L188.7 80H160V51.3z"}),c("path",{d:"M124.6 194.5h-6.8v-27.3h6.8c1.9 0 3.4-1.5 3.4-3.4s-1.5-3.4-3.4-3.4h-6.8v-10.2c0-3.8-3.1-6.8-6.8-6.8H63.3c-3.8 0-6.8 3.1-6.8 6.8v10.2h-6.8c-1.9 0-3.4 1.5-3.4 3.4s1.5 3.4 3.4 3.4h6.8v27.3h-6.8c-1.9 0-3.4 1.5-3.4 3.4s1.5 3.4 3.4 3.4h6.8v23.9c0 3.8 3.1 6.8 6.8 6.8H111c3.8 0 6.8-3.1 6.8-6.8v-23.9h6.8c1.9 0 3.4-1.5 3.4-3.4s-1.5-3.4-3.4-3.4zm-37.5-11.9c-6.6 0-11.9-5.3-11.9-11.9s5.3-11.9 11.9-11.9S99 164.1 99 170.7s-5.3 11.9-11.9 11.9zm0 10.2c6.6 0 11.9 5.3 11.9 11.9s-5.3 11.9-11.9 11.9-11.9-5.3-11.9-11.9 5.3-11.9 11.9-11.9z"})]})}export{s as a};
2
+ //# sourceMappingURL=chunk-GOXG4BVJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/icons/traffic-policy-file.tsx"],"sourcesContent":["import type { SvgAttributes } from \"../icon/types.js\";\n\n/**\n * An icon representing a traffic policy file.\n */\nfunction TrafficPolicyFile(props: SvgAttributes) {\n\treturn (\n\t\t<svg\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\twidth=\"1em\"\n\t\t\theight=\"1em\"\n\t\t\tfill=\"currentColor\"\n\t\t\tviewBox=\"0 0 256 256\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<path fill=\"none\" d=\"M0 0h256v256H0z\" />\n\t\t\t<path d=\"m213.7 82.3-56-56c-1.5-1.5-3.5-2.3-5.7-2.3H56c-8.8 0-16 7.2-16 16v88c0 4.4 3.6 8 8 8s8-3.6 8-8V40h88v48c0 4.4 3.6 8 8 8h48v120h-40c-4.4 0-8 3.6-8 8s3.6 8 8 8h40c8.8 0 16-7.2 16-16V88c0-2.1-.8-4.2-2.3-5.7zm-53.7-31L188.7 80H160V51.3z\" />\n\t\t\t<path d=\"M124.6 194.5h-6.8v-27.3h6.8c1.9 0 3.4-1.5 3.4-3.4s-1.5-3.4-3.4-3.4h-6.8v-10.2c0-3.8-3.1-6.8-6.8-6.8H63.3c-3.8 0-6.8 3.1-6.8 6.8v10.2h-6.8c-1.9 0-3.4 1.5-3.4 3.4s1.5 3.4 3.4 3.4h6.8v27.3h-6.8c-1.9 0-3.4 1.5-3.4 3.4s1.5 3.4 3.4 3.4h6.8v23.9c0 3.8 3.1 6.8 6.8 6.8H111c3.8 0 6.8-3.1 6.8-6.8v-23.9h6.8c1.9 0 3.4-1.5 3.4-3.4s-1.5-3.4-3.4-3.4zm-37.5-11.9c-6.6 0-11.9-5.3-11.9-11.9s5.3-11.9 11.9-11.9S99 164.1 99 170.7s-5.3 11.9-11.9 11.9zm0 10.2c6.6 0 11.9 5.3 11.9 11.9s-5.3 11.9-11.9 11.9-11.9-5.3-11.9-11.9 5.3-11.9 11.9-11.9z\" />\n\t\t</svg>\n\t);\n}\n\nexport {\n\t//,\n\tTrafficPolicyFile,\n};\n"],"mappings":"AAOE,OAQC,OAAAA,EARD,QAAAC,MAAA,oBAFF,SAASC,EAAkBC,EAAsB,CAChD,OACCF,EAAC,OACA,MAAM,6BACN,MAAM,MACN,OAAO,MACP,KAAK,eACL,QAAQ,cACP,GAAGE,EAEJ,UAAAH,EAAC,QAAK,KAAK,OAAO,EAAE,kBAAkB,EACtCA,EAAC,QAAK,EAAE,2OAA2O,EACnPA,EAAC,QAAK,EAAE,6gBAA6gB,GACthB,CAEF","names":["jsx","jsxs","TrafficPolicyFile","props"]}
@@ -0,0 +1,2 @@
1
+ var t=["alphanumeric","time"],g=i=>typeof i=="string"&&t.includes(i),S=i=>i,n=["asc","desc"],o=i=>typeof i=="string"&&n.includes(i),D=i=>i,e=[...n],m=i=>typeof i=="string"&&e.includes(i),d=i=>i,r=["newest-to-oldest","oldest-to-newest"],s=i=>typeof i=="string"&&r.includes(i),c={asc:"oldest-to-newest",desc:"newest-to-oldest"};function p(i){if(o(i))return c[i];if(s(i))return i;throw new Error(`Invalid time sorting direction given: "${i}"`)}export{t as a,g as b,S as c,n as d,o as e,D as f,e as g,m as h,d as i,r as j,s as k,c as l,p as m};
2
+ //# sourceMappingURL=chunk-GYPSB3OK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/sorting/direction.ts"],"sourcesContent":["/**\n * Sorting modes\n * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)\n * - time: Sort by time (newest-to-oldest, oldest-to-newest)\n */\nconst sortingModes = [\"alphanumeric\", \"time\"] as const;\n\n/**\n * Sorting modes\n * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)\n * - time: Sort by time (newest-to-oldest, oldest-to-newest)\n */\ntype SortingMode = (typeof sortingModes)[number];\n\n/**\n * Type guard for sorting modes\n * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)\n * - time: Sort by time (newest-to-oldest, oldest-to-newest)\n *\n * @example isSortingMode(\"alphanumeric\") // true\n * @example isSortingMode(\"time\") // true\n * @example isSortingMode(\"foo\") // false\n */\nconst isSortingMode = (value: unknown): value is SortingMode =>\n\ttypeof value === \"string\" && sortingModes.includes(value as SortingMode);\n\n/**\n * Runtime type-to-value helper for sorting modes\n * - alphanumeric: Sort by alphanumeric order (A-Z, 0-9, Z-A, 9-0)\n * - time: Sort by time (newest-to-oldest, oldest-to-newest)\n *\n * @example $sortingMode(\"alphanumeric\") // \"alphanumeric\"\n * @example $sortingMode(\"time\") // \"time\"\n */\nconst $sortingMode = <T extends SortingMode = SortingMode>(value: T) => value;\n\n/**\n * Sorting directions\n * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)\n * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)\n */\nconst sortingDirections = [\"asc\", \"desc\"] as const;\n\n/**\n * Sorting directions\n * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)\n * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)\n */\ntype SortingDirection = (typeof sortingDirections)[number];\n\n/**\n * Type guard for sorting directions\n * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)\n * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)\n *\n * @example isSortingDirection(\"asc\") // true\n * @example isSortingDirection(\"desc\") // true\n * @example isSortingDirection(\"foo\") // false\n */\nconst isSortingDirection = (value: unknown): value is SortingDirection =>\n\ttypeof value === \"string\" &&\n\tsortingDirections.includes(value as SortingDirection);\n\n/**\n * Runtime type-to-value helper for sorting directions\n * - asc: Ascending order (alphanumeric: A-Z, 0-9; time: oldest-to-newest)\n * - desc: Descending order (alphanumeric: Z-A, 9-0; time: newest-to-oldest)\n *\n * @example $sortingDirection(\"asc\") // \"asc\"\n * @example $sortingDirection(\"desc\") // \"desc\"\n */\nconst $sortingDirection = <T extends SortingDirection = SortingDirection>(\n\tvalue: T,\n) => value;\n\n/**\n * Alphanumeric sorting directions\n * - asc: Ascending order (A-Z, 0-9)\n * - desc: Descending order (Z-A, 9-0)\n */\nconst alphanumericSortingDirections = [...sortingDirections] as const;\n\n/**\n * Alphanumeric sorting directions\n * - asc: Ascending order (A-Z, 0-9)\n * - desc: Descending order (Z-A, 9-0)\n */\ntype AlphanumericSortingDirection =\n\t(typeof alphanumericSortingDirections)[number];\n\n/**\n * Type guard for alphanumeric sorting directions\n * - asc: Ascending order (A-Z, 0-9)\n * - desc: Descending order (Z-A, 9-0)\n *\n * @example isAlphanumericSortingDirection(\"asc\") // true\n * @example isAlphanumericSortingDirection(\"desc\") // true\n * @example isAlphanumericSortingDirection(\"foo\") // false\n */\nconst isAlphanumericSortingDirection = (\n\tvalue: unknown,\n): value is AlphanumericSortingDirection =>\n\ttypeof value === \"string\" &&\n\talphanumericSortingDirections.includes(value as AlphanumericSortingDirection);\n\n/**\n * Runtime type-to-value helper for alphanumeric sorting directions\n * - asc: Ascending order (A-Z, 0-9)\n * - desc: Descending order (Z-A, 9-0)\n *\n * @example $alphanumericSortingDirection(\"asc\") // \"asc\"\n * @example $alphanumericSortingDirection(\"desc\") // \"desc\"\n */\nconst $alphanumericSortingDirection = <\n\tT extends AlphanumericSortingDirection = AlphanumericSortingDirection,\n>(\n\tvalue: T,\n) => value;\n\n/**\n * Time sorting directions\n * - newest-to-oldest: Descending order (newest first, oldest last)\n * - oldest-to-newest: Ascending order (oldest first, newest last)\n */\nconst timeSortingDirections = [\"newest-to-oldest\", \"oldest-to-newest\"] as const;\n\n/**\n * Time sorting directions\n * - newest-to-oldest: Descending order (newest first, oldest last)\n * - oldest-to-newest: Ascending order (oldest first, newest last)\n */\ntype TimeSortingDirection = (typeof timeSortingDirections)[number];\n\n/**\n * Type guard for time sorting directions\n * - newest-to-oldest: Descending order (newest first, oldest last)\n * - oldest-to-newest: Ascending order (oldest first, newest last)\n *\n * @example isTimeSortingDirection(\"newest-to-oldest\") // true\n * @example isTimeSortingDirection(\"oldest-to-newest\") // true\n * @example isTimeSortingDirection(\"foo\") // false\n * @example isTimeSortingDirection(\"asc\") // false\n * @example isTimeSortingDirection(\"desc\") // false\n */\nconst isTimeSortingDirection = (\n\tvalue: unknown,\n): value is TimeSortingDirection =>\n\ttypeof value === \"string\" &&\n\ttimeSortingDirections.includes(value as TimeSortingDirection);\n\n/**\n * Converts a sorting direction to a time sorting direction\n * - asc -> oldest-to-newest\n * - desc -> newest-to-oldest\n */\nconst timeSortingByDirection = {\n\tasc: \"oldest-to-newest\",\n\tdesc: \"newest-to-oldest\",\n} as const satisfies Record<SortingDirection, TimeSortingDirection>;\n\n/**\n * Runtime type-to-value helper for time sorting directions.\n * If given a sorting direction, it will convert it to a time sorting direction.\n * - newest-to-oldest: Descending order (desc; newest first, oldest last)\n * - oldest-to-newest: Ascending order (asc; oldest first, newest last)\n *\n * @example $timeSortingDirection(\"asc\") // \"oldest-to-newest\"\n * @example $timeSortingDirection(\"desc\") // \"newest-to-oldest\"\n * @example $timeSortingDirection(\"oldest-to-newest\") // \"oldest-to-newest\"\n * @example $timeSortingDirection(\"newest-to-oldest\") // \"newest-to-oldest\"\n */\nfunction $timeSortingDirection<\n\tT extends TimeSortingDirection | SortingDirection,\n>(value: T) {\n\tif (isSortingDirection(value)) {\n\t\treturn timeSortingByDirection[value];\n\t}\n\tif (isTimeSortingDirection(value)) {\n\t\treturn value;\n\t}\n\tthrow new Error(`Invalid time sorting direction given: \"${value}\"`);\n}\n\nexport {\n\t//,\n\t$alphanumericSortingDirection,\n\t$sortingDirection,\n\t$sortingMode,\n\t$timeSortingDirection,\n\talphanumericSortingDirections,\n\tisAlphanumericSortingDirection,\n\tisSortingDirection,\n\tisSortingMode,\n\tisTimeSortingDirection,\n\tsortingDirections,\n\tsortingModes,\n\ttimeSortingByDirection,\n\ttimeSortingDirections,\n};\n\nexport type {\n\t//,\n\tAlphanumericSortingDirection,\n\tSortingDirection,\n\tSortingMode,\n\tTimeSortingDirection,\n};\n"],"mappings":"AAKA,IAAMA,EAAe,CAAC,eAAgB,MAAM,EAkBtCC,EAAiBC,GACtB,OAAOA,GAAU,UAAYF,EAAa,SAASE,CAAoB,EAUlEC,EAAqDD,GAAaA,EAOlEE,EAAoB,CAAC,MAAO,MAAM,EAkBlCC,EAAsBH,GAC3B,OAAOA,GAAU,UACjBE,EAAkB,SAASF,CAAyB,EAU/CI,EACLJ,GACIA,EAOCK,EAAgC,CAAC,GAAGH,CAAiB,EAmBrDI,EACLN,GAEA,OAAOA,GAAU,UACjBK,EAA8B,SAASL,CAAqC,EAUvEO,EAGLP,GACIA,EAOCQ,EAAwB,CAAC,mBAAoB,kBAAkB,EAoB/DC,EACLT,GAEA,OAAOA,GAAU,UACjBQ,EAAsB,SAASR,CAA6B,EAOvDU,EAAyB,CAC9B,IAAK,mBACL,KAAM,kBACP,EAaA,SAASC,EAEPX,EAAU,CACX,GAAIG,EAAmBH,CAAK,EAC3B,OAAOU,EAAuBV,CAAK,EAEpC,GAAIS,EAAuBT,CAAK,EAC/B,OAAOA,EAER,MAAM,IAAI,MAAM,0CAA0CA,CAAK,GAAG,CACnE","names":["sortingModes","isSortingMode","value","$sortingMode","sortingDirections","isSortingDirection","$sortingDirection","alphanumericSortingDirections","isAlphanumericSortingDirection","$alphanumericSortingDirection","timeSortingDirections","isTimeSortingDirection","timeSortingByDirection","$timeSortingDirection"]}
@@ -0,0 +1,2 @@
1
+ import{a as g}from"./chunk-MF2QITTY.js";import{b as h}from"./chunk-UXH22BMO.js";import{a as r}from"./chunk-AZ56JGNY.js";import{CaretDown as P}from"@phosphor-icons/react/CaretDown";import{CaretUp as R}from"@phosphor-icons/react/CaretUp";import{Check as I}from"@phosphor-icons/react/Check";import*as e from"@radix-ui/react-select";import{createContext as N,forwardRef as n,useContext as T}from"react";import{jsx as i,jsxs as v}from"react/jsx-runtime";var b=N({}),B=n(({"aria-invalid":o,children:a,id:t,validation:l,onBlur:s,onValueChange:d,onChange:f,...c},p)=>i(e.Root,{...c,onValueChange:m=>{f?.(m),d?.(m)},children:i(b.Provider,{value:{"aria-invalid":o,id:t,validation:l,onBlur:s,ref:p},children:a})}));B.displayName="Select";var F=e.Group,G=e.Value,W=n(({"aria-invalid":o,className:a,children:t,id:l,validation:s,...d},f)=>{let c=T(b),p=c["aria-invalid"]??o,m=p!=null&&p!=="false",u=c.validation??s,S=m?"error":typeof u=="function"?u():u,C=p??S==="error",w=c.id??l;return v(e.Trigger,{"aria-invalid":C,className:r("h-9 text-sm","border-form bg-form text-strong placeholder:text-placeholder hover:bg-form-hover hover:text-strong flex w-full items-center justify-between gap-1.5 rounded-md border px-3 py-2 disabled:pointer-events-none disabled:opacity-50 [&>span]:line-clamp-1 [&>span]:text-left","hover:border-neutral-400","focus:outline-none focus:ring-4 aria-expanded:ring-4","focus:border-accent-600 focus:ring-focus-accent aria-expanded:border-accent-600 aria-expanded:ring-focus-accent","data-validation-success:border-success-600 data-validation-success:focus:border-success-600 data-validation-success:focus:ring-focus-success data-validation-success:aria-expanded:border-success-600 data-validation-success:aria-expanded:ring-focus-success","data-validation-warning:border-warning-600 data-validation-warning:focus:border-warning-600 data-validation-warning:focus:ring-focus-warning data-validation-warning:aria-expanded:border-warning-600 data-validation-warning:aria-expanded:ring-focus-warning","data-validation-error:border-danger-600 data-validation-error:focus:border-danger-600 data-validation-error:focus:ring-focus-danger data-validation-error:aria-expanded:border-danger-600 data-validation-error:aria-expanded:ring-focus-danger",a),"data-validation":S||void 0,id:w,ref:g(f,c.ref),...d,children:[t,i(e.Icon,{asChild:!0,children:i(P,{className:"size-4 shrink-0",weight:"bold"})})]})});W.displayName="SelectTrigger";var y=n(({className:o,...a},t)=>i(e.ScrollUpButton,{ref:t,className:r("flex cursor-default items-center justify-center py-1",o),...a,children:i(R,{className:"size-4 shrink-0",weight:"bold"})}));y.displayName="SelectScrollUpButton";var x=n(({className:o,...a},t)=>i(e.ScrollDownButton,{ref:t,className:r("flex cursor-default items-center justify-center py-1",o),...a,children:i(P,{className:"size-4 shrink-0",weight:"bold"})}));x.displayName="SelectScrollDownButton";var L=n(({className:o,children:a,position:t="popper",width:l="trigger",...s},d)=>i(e.Portal,{children:v(e.Content,{ref:d,className:r("border-popover 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 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md","bg-popover",t==="popper"&&"data-side-bottom:translate-y-2 data-side-left:-translate-x-2 data-side-right:translate-x-2 data-side-top:-translate-y-2 max-h-[var(--radix-select-content-available-height)]",l==="trigger"&&"w-[var(--radix-select-trigger-width)]",o),position:t,...s,children:[i(y,{}),i(e.Viewport,{className:r("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full"),children:a}),i(x,{})]})}));L.displayName="SelectContent";var V=n(({className:o,...a},t)=>i(e.Label,{ref:t,className:r("px-2 py-1.5 text-sm font-semibold",o),...a}));V.displayName="SelectLabel";var k=n(({className:o,children:a,...t},l)=>v(e.Item,{ref:l,className:r("relative flex w-full cursor-pointer select-none items-center rounded py-1.5 pl-2 pr-8 text-sm outline-none","focus:bg-popover-hover","data-disabled:pointer-events-none data-disabled:opacity-50","data-state-checked:bg-filled-accent data-state-checked:text-on-filled","focus:data-state-checked:bg-filled-accent",o),...t,children:[i(e.ItemText,{children:a}),i(e.ItemIndicator,{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:i(I,{className:"size-4 shrink-0",weight:"bold"})})]}));k.displayName="SelectItem";var E=n(({className:o,...a},t)=>i(h,{ref:t,className:r("-mx-1 my-1 h-px w-auto",o),...a}));E.displayName="SelectSeparator";export{B as a,F as b,G as c,W as d,L as e,V as f,k as g,E as h};
2
+ //# sourceMappingURL=chunk-WGF5NYWL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/select/select.tsx"],"sourcesContent":["import { CaretDown } from \"@phosphor-icons/react/CaretDown\";\nimport { CaretUp } from \"@phosphor-icons/react/CaretUp\";\nimport { Check } from \"@phosphor-icons/react/Check\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport type {\n\tComponentProps,\n\tComponentPropsWithoutRef,\n\tComponentRef,\n\tFocusEvent,\n\tPropsWithChildren,\n\tRef,\n\tSelectHTMLAttributes,\n} from \"react\";\nimport { createContext, forwardRef, useContext } from \"react\";\nimport { composeRefs } from \"../../utils/compose-refs/compose-refs.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport type { WithValidation } from \"../input/types.js\";\nimport { Separator } from \"../separator/separator.js\";\n\ntype WithAriaInvalid = Pick<\n\tSelectHTMLAttributes<HTMLSelectElement>,\n\t\"aria-invalid\"\n>;\ntype SelectContextType = WithValidation &\n\tWithAriaInvalid & {\n\t\t/**\n\t\t * Ref for the trigger button.\n\t\t */\n\t\tref?: Ref<HTMLButtonElement>;\n\t\t/**\n\t\t * Event handler called when Select blurs.\n\t\t * @note this is a no-op for now until we can guarantee that it works identically to a native select onBlur\n\t\t */\n\t\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t} & Pick<ComponentProps<\"button\">, \"id\">;\n\nconst SelectContext = createContext<SelectContextType>({});\n\ntype SelectProps = PropsWithChildren & {\n\tautoComplete?: string;\n\tdefaultOpen?: boolean;\n\tdefaultValue?: string;\n\tdir?: \"ltr\" | \"rtl\";\n\tdisabled?: boolean;\n\tform?: string;\n\tid?: string;\n\tname?: string;\n\t/**\n\t * Event handler called when Select blurs.\n\t * @note this is a no-op for now until we can guarantee that it works identically to a native select onBlur\n\t */\n\tonBlur?: (event: FocusEvent<HTMLButtonElement>) => void;\n\t/**\n\t * Event handler called when the value changes.\n\t * @deprecated Use `onValueChange` instead.\n\t */\n\tonChange?: (value: string) => void;\n\tonOpenChange?(open: boolean): void;\n\tonValueChange?(value: string): void;\n\topen?: boolean;\n\trequired?: boolean;\n\tvalue?: string;\n} & WithValidation &\n\tWithAriaInvalid;\n\n/**\n * Displays a list of options for the user to pick from—triggered by a button.\n *\n * @example\n * <Select>\n * <SelectTrigger>\n * <SelectValue placeholder=\"Select a fruit\" />\n * </SelectTrigger>\n * <SelectContent>\n * <SelectGroup>\n * <SelectLabel>Fruits</SelectLabel>\n * <SelectItem value=\"apple\">Apple</SelectItem>\n * <SelectItem value=\"banana\">Banana</SelectItem>\n * <SelectItem value=\"cherry\">Cherry</SelectItem>\n * </SelectGroup>\n * <SelectSeparator />\n * <SelectGroup>\n * <SelectLabel>Veggies</SelectLabel>\n * <SelectItem value=\"carrot\">Carrot</SelectItem>\n * <SelectItem value=\"cucumber\">Cucumber</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n * </Select>\n *\n * @see https://mantle.ngrok.com/components/select#api-select\n */\nconst Select = forwardRef<HTMLButtonElement, SelectProps>(\n\t(\n\t\t{\n\t\t\t\"aria-invalid\": _ariaInvalid,\n\t\t\tchildren,\n\t\t\tid,\n\t\t\tvalidation,\n\t\t\tonBlur,\n\t\t\tonValueChange,\n\t\t\tonChange,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\treturn (\n\t\t\t<SelectPrimitive.Root\n\t\t\t\t{...props}\n\t\t\t\tonValueChange={(value) => {\n\t\t\t\t\tonChange?.(value);\n\t\t\t\t\tonValueChange?.(value);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<SelectContext.Provider\n\t\t\t\t\tvalue={{ \"aria-invalid\": _ariaInvalid, id, validation, onBlur, ref }}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</SelectContext.Provider>\n\t\t\t</SelectPrimitive.Root>\n\t\t);\n\t},\n);\nSelect.displayName = \"Select\";\n\n/**\n * A group of related options within a select menu. Similar to an html `<optgroup>` element.\n * Use in conjunction with SelectLabel to ensure good accessibility via automatic labelling.\n *\n * @example\n * <Select>\n * <SelectTrigger>\n * <SelectValue placeholder=\"Select a fruit\" />\n * </SelectTrigger>\n * <SelectContent>\n * <SelectGroup>\n * <SelectLabel>Fruits</SelectLabel>\n * <SelectItem value=\"apple\">Apple</SelectItem>\n * <SelectItem value=\"banana\">Banana</SelectItem>\n * <SelectItem value=\"cherry\">Cherry</SelectItem>\n * </SelectGroup>\n * <SelectGroup>\n * <SelectLabel>Veggies</SelectLabel>\n * <SelectItem value=\"carrot\">Carrot</SelectItem>\n * <SelectItem value=\"cucumber\">Cucumber</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n * </Select>\n *\n * @see https://mantle.ngrok.com/components/select#api-select-group\n */\nconst SelectGroup = SelectPrimitive.Group;\n\n/**\n * The part that reflects the selected value. By default the selected item's text will be rendered. if you require more control, you can instead control the select and pass your own children. It should not be styled to ensure correct positioning. An optional placeholder prop is also available for when the select has no value.\n *\n * @example\n * <Select>\n * <SelectTrigger>\n * <SelectValue placeholder=\"Select a fruit\" />\n * </SelectTrigger>\n * <SelectContent>\n * <SelectItem value=\"apple\">Apple</SelectItem>\n * <SelectItem value=\"banana\">Banana</SelectItem>\n * <SelectItem value=\"cherry\">Cherry</SelectItem>\n * </SelectContent>\n * </Select>\n *\n * @see https://mantle.ngrok.com/components/select#api-select-value\n */\nconst SelectValue = SelectPrimitive.Value;\n\ntype SelectTriggerProps = ComponentPropsWithoutRef<\n\ttypeof SelectPrimitive.Trigger\n> &\n\tWithAriaInvalid &\n\tWithValidation;\n\n/**\n * The button that toggles the select. The SelectContent will position itself adjacent to the trigger.\n *\n * @example\n * <Select>\n * <SelectTrigger>\n * <SelectValue placeholder=\"Select a fruit\" />\n * </SelectTrigger>\n * <SelectContent>\n * <SelectItem value=\"apple\">Apple</SelectItem>\n * <SelectItem value=\"banana\">Banana</SelectItem>\n * <SelectItem value=\"cherry\">Cherry</SelectItem>\n * </SelectContent>\n * </Select>\n *\n * @see https://mantle.ngrok.com/components/select#api-select-trigger\n */\nconst SelectTrigger = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Trigger>,\n\tSelectTriggerProps\n>(\n\t(\n\t\t{\n\t\t\t\"aria-invalid\": ariaInValidProp,\n\t\t\tclassName,\n\t\t\tchildren,\n\t\t\tid: propId,\n\t\t\tvalidation: propValidation,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ctx = useContext(SelectContext);\n\t\tconst _ariaInvalid = ctx[\"aria-invalid\"] ?? ariaInValidProp;\n\t\tconst isInvalid = _ariaInvalid != null && _ariaInvalid !== \"false\";\n\t\tconst _validation = ctx.validation ?? propValidation;\n\t\tconst validation = isInvalid\n\t\t\t? \"error\"\n\t\t\t: typeof _validation === \"function\"\n\t\t\t\t? _validation()\n\t\t\t\t: _validation;\n\t\tconst ariaInvalid = _ariaInvalid ?? validation === \"error\";\n\t\tconst id = ctx.id ?? propId;\n\n\t\treturn (\n\t\t\t<SelectPrimitive.Trigger\n\t\t\t\taria-invalid={ariaInvalid}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"h-9 text-sm\",\n\t\t\t\t\t\"border-form bg-form text-strong placeholder:text-placeholder hover:bg-form-hover hover:text-strong flex w-full items-center justify-between gap-1.5 rounded-md border px-3 py-2 disabled:pointer-events-none disabled:opacity-50 [&>span]:line-clamp-1 [&>span]:text-left\",\n\t\t\t\t\t\"hover:border-neutral-400\",\n\t\t\t\t\t\"focus:outline-none focus:ring-4 aria-expanded:ring-4\",\n\t\t\t\t\t\"focus:border-accent-600 focus:ring-focus-accent aria-expanded:border-accent-600 aria-expanded:ring-focus-accent\",\n\t\t\t\t\t\"data-validation-success:border-success-600 data-validation-success:focus:border-success-600 data-validation-success:focus:ring-focus-success data-validation-success:aria-expanded:border-success-600 data-validation-success:aria-expanded:ring-focus-success\",\n\t\t\t\t\t\"data-validation-warning:border-warning-600 data-validation-warning:focus:border-warning-600 data-validation-warning:focus:ring-focus-warning data-validation-warning:aria-expanded:border-warning-600 data-validation-warning:aria-expanded:ring-focus-warning\",\n\t\t\t\t\t\"data-validation-error:border-danger-600 data-validation-error:focus:border-danger-600 data-validation-error:focus:ring-focus-danger data-validation-error:aria-expanded:border-danger-600 data-validation-error:aria-expanded:ring-focus-danger\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-validation={validation || undefined}\n\t\t\t\tid={id}\n\t\t\t\tref={composeRefs(ref, ctx.ref)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t<SelectPrimitive.Icon asChild>\n\t\t\t\t\t<CaretDown className=\"size-4 shrink-0\" weight=\"bold\" />\n\t\t\t\t</SelectPrimitive.Icon>\n\t\t\t</SelectPrimitive.Trigger>\n\t\t);\n\t},\n);\nSelectTrigger.displayName = \"SelectTrigger\";\n\n/**\n * The button that scrolls the select content up.\n * @private\n */\nconst SelectScrollUpButton = forwardRef<\n\tComponentRef<typeof SelectPrimitive.ScrollUpButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollUpButton\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"flex cursor-default items-center justify-center py-1\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<CaretUp className=\"size-4 shrink-0\" weight=\"bold\" />\n\t</SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = \"SelectScrollUpButton\";\n\n/**\n * The button that scrolls the select content down.\n * @private\n */\nconst SelectScrollDownButton = forwardRef<\n\tComponentRef<typeof SelectPrimitive.ScrollDownButton>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.ScrollDownButton\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"flex cursor-default items-center justify-center py-1\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<CaretDown className=\"size-4 shrink-0\" weight=\"bold\" />\n\t</SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = \"SelectScrollDownButton\";\n\ntype SelectContentProps = ComponentPropsWithoutRef<\n\ttypeof SelectPrimitive.Content\n> & {\n\t/**\n\t * The width of the content. Defaults to the width of the trigger.\n\t * If set to \"content\", the content will use the intrinsic content width; it will be the width of the longest/widest item.\n\t * @default \"trigger\"\n\t */\n\twidth?: \"trigger\" | \"content\";\n};\n\n/**\n * The component that pops out when the select is open as a portal adjacent to the trigger button.\n * It contains a scrolling viewport of the select items.\n *\n * @example\n * <Select>\n * <SelectTrigger>\n * <SelectValue placeholder=\"Select a fruit\" />\n * </SelectTrigger>\n * <SelectContent>\n * <SelectItem value=\"apple\">Apple</SelectItem>\n * <SelectItem value=\"banana\">Banana</SelectItem>\n * <SelectItem value=\"cherry\">Cherry</SelectItem>\n * </SelectContent>\n * </Select>\n *\n * @see https://mantle.ngrok.com/components/select#api-select-content\n */\nconst SelectContent = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Content>,\n\tSelectContentProps\n>(\n\t(\n\t\t{ className, children, position = \"popper\", width = \"trigger\", ...props },\n\t\tref,\n\t) => (\n\t\t<SelectPrimitive.Portal>\n\t\t\t<SelectPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"border-popover 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 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md\",\n\t\t\t\t\t\"bg-popover\",\n\t\t\t\t\tposition === \"popper\" &&\n\t\t\t\t\t\t\"data-side-bottom:translate-y-2 data-side-left:-translate-x-2 data-side-right:translate-x-2 data-side-top:-translate-y-2 max-h-[var(--radix-select-content-available-height)]\",\n\t\t\t\t\twidth === \"trigger\" && \"w-[var(--radix-select-trigger-width)]\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tposition={position}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<SelectScrollUpButton />\n\t\t\t\t<SelectPrimitive.Viewport\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"p-1\",\n\t\t\t\t\t\tposition === \"popper\" &&\n\t\t\t\t\t\t\t\"h-[var(--radix-select-trigger-height)] w-full\",\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</SelectPrimitive.Viewport>\n\t\t\t\t<SelectScrollDownButton />\n\t\t\t</SelectPrimitive.Content>\n\t\t</SelectPrimitive.Portal>\n\t),\n);\nSelectContent.displayName = \"SelectContent\";\n\n/**\n * Used to render the label of a group. It won't be focusable using arrow keys.\n *\n * @example\n * <Select>\n * <SelectTrigger>\n * <SelectValue placeholder=\"Select a fruit\" />\n * </SelectTrigger>\n * <SelectContent>\n * <SelectGroup>\n * <SelectLabel>Fruits</SelectLabel>\n * <SelectItem value=\"apple\">Apple</SelectItem>\n * <SelectItem value=\"banana\">Banana</SelectItem>\n * <SelectItem value=\"cherry\">Cherry</SelectItem>\n * </SelectGroup>\n * <SelectGroup>\n * <SelectLabel>Veggies</SelectLabel>\n * <SelectItem value=\"carrot\">Carrot</SelectItem>\n * <SelectItem value=\"cucumber\">Cucumber</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n * </Select>\n *\n * @see https://mantle.ngrok.com/components/select#api-select-label\n */\nconst SelectLabel = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Label>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n\t<SelectPrimitive.Label\n\t\tref={ref}\n\t\tclassName={cx(\"px-2 py-1.5 text-sm font-semibold\", className)}\n\t\t{...props}\n\t/>\n));\nSelectLabel.displayName = \"SelectLabel\";\n\n/**\n * An option within a select menu. Similar to an html `<option>` element.\n * Has a required `value` prop that will be passed to the `onChange` handler of the `Select` component when this item is selected.\n * Displays the children as the option's text.\n *\n * @example\n * <Select>\n * <SelectTrigger>\n * <SelectValue placeholder=\"Select a fruit\" />\n * </SelectTrigger>\n * <SelectContent>\n * <SelectItem value=\"apple\">Apple</SelectItem>\n * <SelectItem value=\"banana\">Banana</SelectItem>\n * <SelectItem value=\"cherry\">Cherry</SelectItem>\n * </SelectContent>\n * </Select>\n *\n * @see https://mantle.ngrok.com/components/select#api-select-item\n */\nconst SelectItem = forwardRef<\n\tComponentRef<typeof SelectPrimitive.Item>,\n\tComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n\t<SelectPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"relative flex w-full cursor-pointer select-none items-center rounded py-1.5 pl-2 pr-8 text-sm outline-none\",\n\t\t\t\"focus:bg-popover-hover\",\n\t\t\t\"data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\t\"data-state-checked:bg-filled-accent data-state-checked:text-on-filled\",\n\t\t\t\"focus:data-state-checked:bg-filled-accent\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n\t\t<SelectPrimitive.ItemIndicator className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t<Check className=\"size-4 shrink-0\" weight=\"bold\" />\n\t\t</SelectPrimitive.ItemIndicator>\n\t</SelectPrimitive.Item>\n));\nSelectItem.displayName = \"SelectItem\";\n\n/**\n * Used to visually separate items or groups of items in the select content.\n *\n * @example\n * <Select>\n * <SelectTrigger>\n * <SelectValue placeholder=\"Select a fruit\" />\n * </SelectTrigger>\n * <SelectContent>\n * <SelectGroup>\n * <SelectLabel>Fruits</SelectLabel>\n * <SelectItem value=\"apple\">Apple</SelectItem>\n * <SelectItem value=\"banana\">Banana</SelectItem>\n * <SelectItem value=\"cherry\">Cherry</SelectItem>\n * </SelectGroup>\n * <SelectSeparator />\n * <SelectGroup>\n * <SelectLabel>Veggies</SelectLabel>\n * <SelectItem value=\"carrot\">Carrot</SelectItem>\n * <SelectItem value=\"cucumber\">Cucumber</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n * </Select>\n *\n * @see https://mantle.ngrok.com/components/select#api-select-separator\n */\nconst SelectSeparator = forwardRef<\n\tComponentRef<typeof Separator>,\n\tComponentPropsWithoutRef<typeof Separator>\n>(({ className, ...props }, ref) => (\n\t<Separator\n\t\tref={ref}\n\t\tclassName={cx(\"-mx-1 my-1 h-px w-auto\", className)}\n\t\t{...props}\n\t/>\n));\nSelectSeparator.displayName = \"SelectSeparator\";\n\nexport {\n\t//,\n\tSelect,\n\tSelectContent,\n\tSelectGroup,\n\tSelectItem,\n\tSelectLabel,\n\tSelectSeparator,\n\tSelectTrigger,\n\tSelectValue,\n};\n"],"mappings":"wHAAA,OAAS,aAAAA,MAAiB,kCAC1B,OAAS,WAAAC,MAAe,gCACxB,OAAS,SAAAC,MAAa,8BACtB,UAAYC,MAAqB,yBAUjC,OAAS,iBAAAC,EAAe,cAAAC,EAAY,cAAAC,MAAkB,QAoGlD,cAAAC,EA6GD,QAAAC,MA7GC,oBA7EJ,IAAMC,EAAgBC,EAAiC,CAAC,CAAC,EAuDnDC,EAASC,EACd,CACC,CACC,eAAgBC,EAChB,SAAAC,EACA,GAAAC,EACA,WAAAC,EACA,OAAAC,EACA,cAAAC,EACA,SAAAC,EACA,GAAGC,CACJ,EACAC,IAGCd,EAAiB,OAAhB,CACC,GAAGa,EACJ,cAAgBE,GAAU,CACzBH,IAAWG,CAAK,EAChBJ,IAAgBI,CAAK,CACtB,EAEA,SAAAf,EAACE,EAAc,SAAd,CACA,MAAO,CAAE,eAAgBI,EAAc,GAAAE,EAAI,WAAAC,EAAY,OAAAC,EAAQ,IAAAI,CAAI,EAElE,SAAAP,EACF,EACD,CAGH,EACAH,EAAO,YAAc,SA4BrB,IAAMY,EAA8B,QAmB9BC,EAA8B,QAyB9BC,EAAgBb,EAIrB,CACC,CACC,eAAgBc,EAChB,UAAAC,EACA,SAAAb,EACA,GAAIc,EACJ,WAAYC,EACZ,GAAGT,CACJ,EACAC,IACI,CACJ,IAAMS,EAAMC,EAAWtB,CAAa,EAC9BI,EAAeiB,EAAI,cAAc,GAAKJ,EACtCM,EAAYnB,GAAgB,MAAQA,IAAiB,QACrDoB,EAAcH,EAAI,YAAcD,EAChCb,EAAagB,EAChB,QACA,OAAOC,GAAgB,WACtBA,EAAY,EACZA,EACEC,EAAcrB,GAAgBG,IAAe,QAC7CD,EAAKe,EAAI,IAAMF,EAErB,OACCpB,EAAiB,UAAhB,CACA,eAAc0B,EACd,UAAWC,EACV,cACA,4QACA,2BACA,uDACA,kHACA,iQACA,iQACA,kPACAR,CACD,EACA,kBAAiBX,GAAc,OAC/B,GAAID,EACJ,IAAKqB,EAAYf,EAAKS,EAAI,GAAG,EAC5B,GAAGV,EAEH,UAAAN,EACDP,EAAiB,OAAhB,CAAqB,QAAO,GAC5B,SAAAA,EAAC8B,EAAA,CAAU,UAAU,kBAAkB,OAAO,OAAO,EACtD,GACD,CAEF,CACD,EACAZ,EAAc,YAAc,gBAM5B,IAAMa,EAAuB1B,EAG3B,CAAC,CAAE,UAAAe,EAAW,GAAGP,CAAM,EAAGC,IAC3Bd,EAAiB,iBAAhB,CACA,IAAKc,EACL,UAAWc,EACV,uDACAR,CACD,EACC,GAAGP,EAEJ,SAAAb,EAACgC,EAAA,CAAQ,UAAU,kBAAkB,OAAO,OAAO,EACpD,CACA,EACDD,EAAqB,YAAc,uBAMnC,IAAME,EAAyB5B,EAG7B,CAAC,CAAE,UAAAe,EAAW,GAAGP,CAAM,EAAGC,IAC3Bd,EAAiB,mBAAhB,CACA,IAAKc,EACL,UAAWc,EACV,uDACAR,CACD,EACC,GAAGP,EAEJ,SAAAb,EAAC8B,EAAA,CAAU,UAAU,kBAAkB,OAAO,OAAO,EACtD,CACA,EACDG,EAAuB,YAAc,yBA+BrC,IAAMC,EAAgB7B,EAIrB,CACC,CAAE,UAAAe,EAAW,SAAAb,EAAU,SAAA4B,EAAW,SAAU,MAAAC,EAAQ,UAAW,GAAGvB,CAAM,EACxEC,IAEAd,EAAiB,SAAhB,CACA,SAAAC,EAAiB,UAAhB,CACA,IAAKa,EACL,UAAWc,EACV,8ZACA,aACAO,IAAa,UACZ,+KACDC,IAAU,WAAa,wCACvBhB,CACD,EACA,SAAUe,EACT,GAAGtB,EAEJ,UAAAb,EAAC+B,EAAA,EAAqB,EACtB/B,EAAiB,WAAhB,CACA,UAAW4B,EACV,MACAO,IAAa,UACZ,+CACF,EAEC,SAAA5B,EACF,EACAP,EAACiC,EAAA,EAAuB,GACzB,EACD,CAEF,EACAC,EAAc,YAAc,gBA2B5B,IAAMG,EAAchC,EAGlB,CAAC,CAAE,UAAAe,EAAW,GAAGP,CAAM,EAAGC,IAC3Bd,EAAiB,QAAhB,CACA,IAAKc,EACL,UAAWc,EAAG,oCAAqCR,CAAS,EAC3D,GAAGP,EACL,CACA,EACDwB,EAAY,YAAc,cAqB1B,IAAMC,EAAajC,EAGjB,CAAC,CAAE,UAAAe,EAAW,SAAAb,EAAU,GAAGM,CAAM,EAAGC,IACrCb,EAAiB,OAAhB,CACA,IAAKa,EACL,UAAWc,EACV,6GACA,yBACA,6DACA,wEACA,4CACAR,CACD,EACC,GAAGP,EAEJ,UAAAb,EAAiB,WAAhB,CAA0B,SAAAO,EAAS,EACpCP,EAAiB,gBAAhB,CAA8B,UAAU,gEACxC,SAAAA,EAACuC,EAAA,CAAM,UAAU,kBAAkB,OAAO,OAAO,EAClD,GACD,CACA,EACDD,EAAW,YAAc,aA4BzB,IAAME,EAAkBnC,EAGtB,CAAC,CAAE,UAAAe,EAAW,GAAGP,CAAM,EAAGC,IAC3Bd,EAACyC,EAAA,CACA,IAAK3B,EACL,UAAWc,EAAG,yBAA0BR,CAAS,EAChD,GAAGP,EACL,CACA,EACD2B,EAAgB,YAAc","names":["CaretDown","CaretUp","Check","SelectPrimitive","createContext","forwardRef","useContext","jsx","jsxs","SelectContext","createContext","Select","forwardRef","_ariaInvalid","children","id","validation","onBlur","onValueChange","onChange","props","ref","value","SelectGroup","SelectValue","SelectTrigger","ariaInValidProp","className","propId","propValidation","ctx","useContext","isInvalid","_validation","ariaInvalid","cx","composeRefs","CaretDown","SelectScrollUpButton","CaretUp","SelectScrollDownButton","SelectContent","position","width","SelectLabel","SelectItem","Check","SelectSeparator","Separator"]}
@@ -0,0 +1,2 @@
1
+ import{a as s}from"./chunk-AZ56JGNY.js";import{forwardRef as l,useEffect as p,useMemo as h,useRef as y,useState as u}from"react";import{jsx as n}from"react/jsx-runtime";var v=l(({children:e,className:t,style:o,...r},d)=>{let a=x();return n("div",{className:s("group/table scrollbar overflow-auto rounded-lg border border-gray-300 bg-white dark:bg-gray-100 relative",t),"data-sticky-active":a.state.hasOverflow&&!a.state.scrolledToEnd||void 0,"data-x-overflow":a.state.hasOverflow,"data-x-scroll-end":a.state.hasOverflow&&a.state.scrolledToEnd,ref:a.ref,children:n("table",{ref:d,className:"table-auto border-separate caption-bottom border-spacing-0 w-full text-left",...r,children:e})})});v.displayName="Table";var i=l(({className:e,...t},o)=>n("thead",{ref:o,className:s("text-strong bg-base [&_tr]:border-b",e),...t}));i.displayName="TableHead";var T=l(({children:e,className:t,...o},r)=>n("tbody",{className:s("text-body",t),ref:r,...o,children:e}));T.displayName="TableBody";var C=l(({className:e,...t},o)=>n("tfoot",{ref:o,className:s("bg-gray-50/50 font-medium [&>tr:first-child>td]:border-t text-body",e),...t}));C.displayName="TableFoot";var g=l(({className:e,...t},o)=>n("tr",{ref:o,className:s("[&>td]:border-b [&>td]:border-gray-300 [&>td]:last:border-b-0 [&>td]:bg-card [&>td]:hover:bg-gray-200/50",e),...t}));g.displayName="TableRow";var E=l(({className:e,...t},o)=>n("th",{ref:o,className:s("h-12 px-4 text-left align-middle text-sm font-medium [&:has([role=checkbox])]:pr-0",e),...t}));i.displayName="TableHead";var w=l(({className:e,...t},o)=>n("td",{ref:o,className:s("p-4 align-middle [&:has([role=checkbox])]:pr-0 font-mono text-size-mono",e),...t}));w.displayName="TableCell";var N=l(({className:e,...t},o)=>n("caption",{ref:o,className:s("border-t border-gray-300 py-4 text-sm text-gray-500",e),...t}));N.displayName="TableCaption";function x(){let e=y(null),[t,o]=u({hasOverflow:!1,scrolledToEnd:!1});return p(()=>{let r=e.current;if(!r)return;let d=()=>{let m=r.scrollWidth>r.clientWidth,f=Math.abs(r.scrollWidth-r.scrollLeft-r.clientWidth)<1;o(c=>c.hasOverflow!==m||c.scrolledToEnd!==f?{hasOverflow:m,scrolledToEnd:f}:c)},a=new ResizeObserver(d);a.observe(r);let b=new MutationObserver(d);return b.observe(r,{childList:!0,subtree:!0}),r.addEventListener("scroll",d,{passive:!0}),d(),()=>{a.disconnect(),b.disconnect(),r.removeEventListener("scroll",d)}},[]),h(()=>({ref:e,state:t}),[t])}export{v as a,i as b,T as c,C as d,g as e,E as f,w as g,N as h};
2
+ //# sourceMappingURL=chunk-YAT4IMMN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/table/table.tsx"],"sourcesContent":["import type { ComponentProps, ComponentRef } from \"react\";\nimport { forwardRef, useEffect, useMemo, useRef, useState } from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\n\n/**\n * The `<Table>` is a structured way to display data in rows and columns. The API\n * matches the HTML `<table>` element 1:1.\n *\n * Permitted content in this order:\n * 1. optional: `<TableCaption>`\n * 2. 0 or more: `<colgroup>` elements\n * 3. optional: `<TableHead>`\n * 4. either one of the following:\n * - 0 or more: `<TableBody>`\n * - 0 or more: `<TableRow>`\n * 5. optional: `<TableFoot>`\n *\n * @description\n * Establishes a table formatting context. Elements inside the `<Table>`\n * generate rectangular boxes. Each box occupies a number of table cells\n * according to the following rules:\n * 1. The row boxes fill the table in the source code order from top to bottom.\n * Each row box occupies one row of cells.\n * 2. A row group box occupies one or more row boxes.\n * 3. Column boxes are placed next to each other in source code order.\n * Depending on the value of the dir attribute, the columns are laid in\n * left-to-right or right-to-left direction. A column box occupies one or\n * more columns of table cells.\n * 4. A column group box occupies one or more column boxes.\n * 5. A cell box may span over multiple rows and columns. User agents trim\n * cells to fit in the available number of rows and columns.\n * Table cells do have padding. Boxes that make up a table do not have margins.\n * For more in depth information, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table).\n *\n * @example\n * ```tsx\n * <Table>\n * <TableCaption>A list of your recent invoices.</TableCaption>\n * <TableHead>\n * <TableRow>\n * <TableHeader className=\"w-[100px]\">Invoice</TableHeader>\n * <TableHeader>Status</TableHeader>\n * <TableHeader>Method</TableHeader>\n * <TableHeader className=\"text-right\">Amount</TableHeader>\n * </TableRow>\n * </TableHead>\n * <TableBody>\n * {invoices.map((invoice) => (\n * <TableRow key={invoice.invoice}>\n * <TableCell className=\"font-medium\">{invoice.invoice}</TableCell>\n * <TableCell>{invoice.paymentStatus}</TableCell>\n * <TableCell>{invoice.paymentMethod}</TableCell>\n * <TableCell className=\"text-right\">{invoice.totalAmount}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * <TableFoot>\n * <TableRow>\n * <TableCell colSpan={3}>Total</TableCell>\n * <TableCell className=\"text-right\">$2,500.00</TableCell>\n * </TableRow>\n * </TableFoot>\n * </Table>\n * ```\n *\n * @see https://mantle.ngrok.com/components/table#api-table\n */\nconst Table = forwardRef<ComponentRef<\"table\">, ComponentProps<\"table\">>(\n\t({ children, className, style, ...props }, ref) => {\n\t\tconst horizontalOverflow =\n\t\t\tuseHorizontalOverflowObserver<ComponentRef<\"div\">>();\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"group/table scrollbar overflow-auto rounded-lg border border-gray-300 bg-white dark:bg-gray-100 relative\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-sticky-active={\n\t\t\t\t\t(horizontalOverflow.state.hasOverflow &&\n\t\t\t\t\t\t!horizontalOverflow.state.scrolledToEnd) ||\n\t\t\t\t\tundefined\n\t\t\t\t}\n\t\t\t\tdata-x-overflow={horizontalOverflow.state.hasOverflow}\n\t\t\t\tdata-x-scroll-end={\n\t\t\t\t\thorizontalOverflow.state.hasOverflow &&\n\t\t\t\t\thorizontalOverflow.state.scrolledToEnd\n\t\t\t\t}\n\t\t\t\tref={horizontalOverflow.ref}\n\t\t\t>\n\t\t\t\t<table\n\t\t\t\t\tref={ref}\n\t\t\t\t\tclassName=\"table-auto border-separate caption-bottom border-spacing-0 w-full text-left\"\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t);\n\t},\n);\nTable.displayName = \"Table\";\n\n/**\n * The `<TableHead>` is a container for the table's column headers.\n * Encapsulates a set of `<TableRow>`s, indicating that they comprise the head\n * of a table with information about the table's columns. This is usually in the\n * form of column headers (`<TableHeader>`).\n *\n * Must be used as a child of a `<Table>`. It should only come after any\n * `<TableCaption>` or `<colgroup>` and before any `<TableBody>` or `<TableFoot>`.\n *\n * Permitted Content:\n * 1. 0 or more: `<TableRow>`\n *\n * @example\n * ```tsx\n * <Table>\n * <TableCaption>A list of your recent invoices.</TableCaption>\n * <TableHead>\n * <TableRow>\n * <TableHeader className=\"w-[100px]\">Invoice</TableHeader>\n * <TableHeader>Status</TableHeader>\n * <TableHeader>Method</TableHeader>\n * <TableHeader className=\"text-right\">Amount</TableHeader>\n * </TableRow>\n * </TableHead>\n * <TableBody>\n * {invoices.map((invoice) => (\n * <TableRow key={invoice.invoice}>\n * <TableCell className=\"font-medium\">{invoice.invoice}</TableCell>\n * <TableCell>{invoice.paymentStatus}</TableCell>\n * <TableCell>{invoice.paymentMethod}</TableCell>\n * <TableCell className=\"text-right\">{invoice.totalAmount}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * <TableFoot>\n * <TableRow>\n * <TableCell colSpan={3}>Total</TableCell>\n * <TableCell className=\"text-right\">$2,500.00</TableCell>\n * </TableRow>\n * </TableFoot>\n * </Table>\n * ```\n *\n * @see https://mantle.ngrok.com/components/table#api-table-header\n */\nconst TableHead = forwardRef<ComponentRef<\"thead\">, ComponentProps<\"thead\">>(\n\t({ className, ...props }, ref) => (\n\t\t<thead\n\t\t\tref={ref}\n\t\t\tclassName={cx(\"text-strong bg-base [&_tr]:border-b\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTableHead.displayName = \"TableHead\";\n\n/**\n * The `<TableBody>` encapsulates a set of `<TableRow>`s, indicating that they\n * comprise the body of a table's (main) data.\n *\n * Must be used as a child of a `<Table>` and only come after any\n * `<TableCaption>`, `<colgroup>`, or `<TableHead>`.\n *\n * Permitted Content:\n * 1. 0 or more: `<TableRow>`\n *\n * @example\n * ```tsx\n * <Table>\n * <TableCaption>A list of your recent invoices.</TableCaption>\n * <TableHead>\n * <TableRow>\n * <TableHeader className=\"w-[100px]\">Invoice</TableHeader>\n * <TableHeader>Status</TableHeader>\n * <TableHeader>Method</TableHeader>\n * <TableHeader className=\"text-right\">Amount</TableHeader>\n * </TableRow>\n * </TableHead>\n * <TableBody>\n * {invoices.map((invoice) => (\n * <TableRow key={invoice.invoice}>\n * <TableCell className=\"font-medium\">{invoice.invoice}</TableCell>\n * <TableCell>{invoice.paymentStatus}</TableCell>\n * <TableCell>{invoice.paymentMethod}</TableCell>\n * <TableCell className=\"text-right\">{invoice.totalAmount}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * <TableFoot>\n * <TableRow>\n * <TableCell colSpan={3}>Total</TableCell>\n * <TableCell className=\"text-right\">$2,500.00</TableCell>\n * </TableRow>\n * </TableFoot>\n * </Table>\n * ```\n *\n * @see https://mantle.ngrok.com/components/table#api-table-body\n */\nconst TableBody = forwardRef<ComponentRef<\"tbody\">, ComponentProps<\"tbody\">>(\n\t({ children, className, ...props }, ref) => (\n\t\t<tbody className={cx(\"text-body\", className)} ref={ref} {...props}>\n\t\t\t{children}\n\t\t</tbody>\n\t),\n);\nTableBody.displayName = \"TableBody\";\n\n/**\n * The `<TableFoot>` encapsulates a set of `<TableRow>`s, indicating that they\n * comprise the foot of a table with information about the table's columns. This\n * is usually a summary of the columns, e.g., a sum of the given numbers in a\n * column.\n *\n * Must be used as a child of a `<Table>` and only come after any\n * `<TableCaption>`, `<colgroup>`, `<TableHead>`, and `<TableBody>`.\n *\n * Permitted Content:\n * 1. 0 or more: `<TableRow>` elements\n *\n * @example\n * ```tsx\n * <Table>\n * <TableCaption>A list of your recent invoices.</TableCaption>\n * <TableHead>\n * <TableRow>\n * <TableHeader className=\"w-[100px]\">Invoice</TableHeader>\n * <TableHeader>Status</TableHeader>\n * <TableHeader>Method</TableHeader>\n * <TableHeader className=\"text-right\">Amount</TableHeader>\n * </TableRow>\n * </TableHead>\n * <TableBody>\n * {invoices.map((invoice) => (\n * <TableRow key={invoice.invoice}>\n * <TableCell className=\"font-medium\">{invoice.invoice}</TableCell>\n * <TableCell>{invoice.paymentStatus}</TableCell>\n * <TableCell>{invoice.paymentMethod}</TableCell>\n * <TableCell className=\"text-right\">{invoice.totalAmount}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * <TableFoot>\n * <TableRow>\n * <TableCell colSpan={3}>Total</TableCell>\n * <TableCell className=\"text-right\">$2,500.00</TableCell>\n * </TableRow>\n * </TableFoot>\n * </Table>\n * ```\n *\n * @see https://mantle.ngrok.com/components/table#api-table-foot\n */\nconst TableFoot = forwardRef<ComponentRef<\"tfoot\">, ComponentProps<\"tfoot\">>(\n\t({ className, ...props }, ref) => (\n\t\t<tfoot\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"bg-gray-50/50 font-medium [&>tr:first-child>td]:border-t text-body\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTableFoot.displayName = \"TableFoot\";\n\n/**\n * The `<TableRow>` defines a row of cells in a table. The row's cells can then\n * be established using a mix of `<TableCell>` and `<TableHeader>` components.\n *\n * Must be used as a child of a `<TableHead>`, `<TableBody>`, or `<TableFoot>`.\n *\n * Permitted Content:\n * 1. 0 or more: `<TableHeader>` or `<TableCell>`\n *\n * @example\n * ```tsx\n * <Table>\n * <TableCaption>A list of your recent invoices.</TableCaption>\n * <TableHead>\n * <TableRow>\n * <TableHeader className=\"w-[100px]\">Invoice</TableHeader>\n * <TableHeader>Status</TableHeader>\n * <TableHeader>Method</TableHeader>\n * <TableHeader className=\"text-right\">Amount</TableHeader>\n * </TableRow>\n * </TableHead>\n * <TableBody>\n * {invoices.map((invoice) => (\n * <TableRow key={invoice.invoice}>\n * <TableCell className=\"font-medium\">{invoice.invoice}</TableCell>\n * <TableCell>{invoice.paymentStatus}</TableCell>\n * <TableCell>{invoice.paymentMethod}</TableCell>\n * <TableCell className=\"text-right\">{invoice.totalAmount}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * <TableFoot>\n * <TableRow>\n * <TableCell colSpan={3}>Total</TableCell>\n * <TableCell className=\"text-right\">$2,500.00</TableCell>\n * </TableRow>\n * </TableFoot>\n * </Table>\n * ```\n *\n * @see https://mantle.ngrok.com/components/table#api-table-row\n */\nconst TableRow = forwardRef<ComponentRef<\"tr\">, ComponentProps<\"tr\">>(\n\t({ className, ...props }, ref) => (\n\t\t<tr\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t// \"data-state-selected:bg-gray-200\",\n\t\t\t\t\"[&>td]:border-b [&>td]:border-gray-300 [&>td]:last:border-b-0 [&>td]:bg-card [&>td]:hover:bg-gray-200/50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTableRow.displayName = \"TableRow\";\n\n/**\n * The `<TableHeader>` defines a cell as the header of a group of table cells\n * and may be used as a child of a `<TableRow>`. The exact nature of this group\n * is defined by the scope and headers attributes.\n *\n * Must be used as a child of a `<TableRow>`.\n *\n * Permitted Content:\n * 1. Flow content, but with no header, footer, sectioning content, or heading\n * content descendants.\n *\n * @example\n * ```tsx\n * <Table>\n * <TableCaption>A list of your recent invoices.</TableCaption>\n * <TableHead>\n * <TableRow>\n * <TableHeader className=\"w-[100px]\">Invoice</TableHeader>\n * <TableHeader>Status</TableHeader>\n * <TableHeader>Method</TableHeader>\n * <TableHeader className=\"text-right\">Amount</TableHeader>\n * </TableRow>\n * </TableHead>\n * <TableBody>\n * {invoices.map((invoice) => (\n * <TableRow key={invoice.invoice}>\n * <TableCell className=\"font-medium\">{invoice.invoice}</TableCell>\n * <TableCell>{invoice.paymentStatus}</TableCell>\n * <TableCell>{invoice.paymentMethod}</TableCell>\n * <TableCell className=\"text-right\">{invoice.totalAmount}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * <TableFoot>\n * <TableRow>\n * <TableCell colSpan={3}>Total</TableCell>\n * <TableCell className=\"text-right\">$2,500.00</TableCell>\n * </TableRow>\n * </TableFoot>\n * </Table>\n * ```\n *\n * @see https://mantle.ngrok.com/components/table#api-table-header\n */\nconst TableHeader = forwardRef<ComponentRef<\"th\">, ComponentProps<\"th\">>(\n\t({ className, ...props }, ref) => (\n\t\t<th\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"h-12 px-4 text-left align-middle text-sm font-medium [&:has([role=checkbox])]:pr-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTableHead.displayName = \"TableHead\";\n\n/**\n * The `<TableCell>` defines a cell of a table that contains data and may be\n * used as a child of a `<TableRow>`.\n *\n * Must be used as a child of a `<TableRow>`.\n *\n * Permitted Content:\n * 1. Flow content\n *\n * @example\n * ```tsx\n * <Table>\n * <TableCaption>A list of your recent invoices.</TableCaption>\n * <TableHead>\n * <TableRow>\n * <TableHeader className=\"w-[100px]\">Invoice</TableHeader>\n * <TableHeader>Status</TableHeader>\n * <TableHeader>Method</TableHeader>\n * <TableHeader className=\"text-right\">Amount</TableHeader>\n * </TableRow>\n * </TableHead>\n * <TableBody>\n * {invoices.map((invoice) => (\n * <TableRow key={invoice.invoice}>\n * <TableCell className=\"font-medium\">{invoice.invoice}</TableCell>\n * <TableCell>{invoice.paymentStatus}</TableCell>\n * <TableCell>{invoice.paymentMethod}</TableCell>\n * <TableCell className=\"text-right\">{invoice.totalAmount}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * <TableFoot>\n * <TableRow>\n * <TableCell colSpan={3}>Total</TableCell>\n * <TableCell className=\"text-right\">$2,500.00</TableCell>\n * </TableRow>\n * </TableFoot>\n * </Table>\n * ```\n *\n * @see https://mantle.ngrok.com/components/table#api-table-cell\n */\nconst TableCell = forwardRef<ComponentRef<\"td\">, ComponentProps<\"td\">>(\n\t({ className, ...props }, ref) => (\n\t\t<td\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"p-4 align-middle [&:has([role=checkbox])]:pr-0 font-mono text-size-mono\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nTableCell.displayName = \"TableCell\";\n\n/**\n * The optional `<TableCaption>` specifies the caption (or title) of a table,\n * providing the table an accessible description.\n *\n * If used, must be the first child of a `<Table>`.\n *\n * Permitted Content:\n * 1. Flow content\n *\n * @example\n * ```tsx\n * <Table>\n * <TableCaption>A list of your recent invoices.</TableCaption>\n * <TableHead>\n * <TableRow>\n * <TableHeader className=\"w-[100px]\">Invoice</TableHeader>\n * <TableHeader>Status</TableHeader>\n * <TableHeader>Method</TableHeader>\n * <TableHeader className=\"text-right\">Amount</TableHeader>\n * </TableRow>\n * </TableHead>\n * <TableBody>\n * {invoices.map((invoice) => (\n * <TableRow key={invoice.invoice}>\n * <TableCell className=\"font-medium\">{invoice.invoice}</TableCell>\n * <TableCell>{invoice.paymentStatus}</TableCell>\n * <TableCell>{invoice.paymentMethod}</TableCell>\n * <TableCell className=\"text-right\">{invoice.totalAmount}</TableCell>\n * </TableRow>\n * ))}\n * </TableBody>\n * <TableFoot>\n * <TableRow>\n * <TableCell colSpan={3}>Total</TableCell>\n * <TableCell className=\"text-right\">$2,500.00</TableCell>\n * </TableRow>\n * </TableFoot>\n * </Table>\n * ```\n *\n * @see https://mantle.ngrok.com/components/table#api-table-caption\n */\nconst TableCaption = forwardRef<\n\tComponentRef<\"caption\">,\n\tComponentProps<\"caption\">\n>(({ className, ...props }, ref) => (\n\t<caption\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"border-t border-gray-300 py-4 text-sm text-gray-500\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nTableCaption.displayName = \"TableCaption\";\n\nexport {\n\t//,\n\tTable,\n\tTableBody,\n\tTableCaption,\n\tTableCell,\n\tTableFoot,\n\tTableHead,\n\tTableHeader,\n\tTableRow,\n};\n\n/**\n * A custom hook that observes the horizontal overflow of an element and determines\n * if it has overflow and if it is scrolled to the end.\n *\n * @private\n */\nfunction useHorizontalOverflowObserver<T extends HTMLElement>() {\n\tconst ref = useRef<T | null>(null);\n\tconst [state, setState] = useState({\n\t\thasOverflow: false,\n\t\tscrolledToEnd: false,\n\t});\n\n\tuseEffect(() => {\n\t\tconst element = ref.current;\n\t\tif (!element) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst checkState = () => {\n\t\t\tconst hasOverflow = element.scrollWidth > element.clientWidth;\n\t\t\tconst scrolledToEnd =\n\t\t\t\tMath.abs(\n\t\t\t\t\telement.scrollWidth - element.scrollLeft - element.clientWidth,\n\t\t\t\t) < 1;\n\n\t\t\tsetState((previous) => {\n\t\t\t\tif (\n\t\t\t\t\tprevious.hasOverflow !== hasOverflow ||\n\t\t\t\t\tprevious.scrolledToEnd !== scrolledToEnd\n\t\t\t\t) {\n\t\t\t\t\treturn { hasOverflow, scrolledToEnd };\n\t\t\t\t}\n\t\t\t\treturn previous; // No state change\n\t\t\t});\n\t\t};\n\n\t\tconst resizeObserver = new ResizeObserver(checkState);\n\t\tresizeObserver.observe(element);\n\n\t\tconst mutationObserver = new MutationObserver(checkState);\n\t\tmutationObserver.observe(element, { childList: true, subtree: true });\n\n\t\telement.addEventListener(\"scroll\", checkState, { passive: true });\n\n\t\tcheckState();\n\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect();\n\t\t\tmutationObserver.disconnect();\n\t\t\telement.removeEventListener(\"scroll\", checkState);\n\t\t};\n\t}, []);\n\n\treturn useMemo(() => ({ ref, state }), [state]);\n}\n"],"mappings":"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","names":["forwardRef","useEffect","useMemo","useRef","useState","jsx","Table","forwardRef","children","className","style","props","ref","horizontalOverflow","useHorizontalOverflowObserver","cx","TableHead","TableBody","TableFoot","TableRow","TableHeader","TableCell","TableCaption","useHorizontalOverflowObserver","ref","useRef","state","setState","useState","useEffect","element","checkState","hasOverflow","scrolledToEnd","previous","resizeObserver","mutationObserver","useMemo"]}
@@ -1,4 +1,4 @@
1
- import{a as _}from"./chunk-IWKI4XHM.js";import{a as R}from"./chunk-7O36LG52.js";import"./chunk-HDPLH5HC.js";import{a as u}from"./chunk-AZ56JGNY.js";import{CaretDown as re}from"@phosphor-icons/react/CaretDown";import{Check as se}from"@phosphor-icons/react/Check";import{Copy as ae}from"@phosphor-icons/react/Copy";import{FileText as ie}from"@phosphor-icons/react/FileText";import{Terminal as de}from"@phosphor-icons/react/Terminal";import{Slot as b}from"@radix-ui/react-slot";import pe from"clsx";import{createContext as ce,forwardRef as C,useContext as j,useEffect as B,useId as le,useMemo as D,useRef as ue,useState as y}from"react";import z from"tiny-invariant";function E(e){let t="";for(let n of e)switch(n){case"&":t+="&amp;";break;case"<":t+="&lt;";break;case">":t+="&gt;";break;case'"':t+="&quot;";break;case"'":t+="&#39;";break;default:t+=n}return t}import N from"prismjs";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";var O=["tabs","spaces"];function W(e,t){return t||(te(e)?"tabs":(oe(e),"spaces"))}var Z=["csharp","css","go","html","java","javascript","js","jsx","ts","tsx","typescript","xml"],ee=["python","py","yaml","yml","ruby","rb"];function te(e){return Z.includes(e)}function oe(e){return ee.includes(e)}function I(e,t){let{indentation:n="spaces"}=t||{};return e.trim().replace(/^[ \t]*(?=\S)/gm,o=>n==="spaces"?o.replace(/\t/g," "):o.replace(/ {2}/g," "))}var L=["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 ne(e){if(!e)return"sh";let t=e.trim().slice(e.indexOf("-")+1);return $(t)?t:"sh"}var $=e=>typeof e=="string"&&L.includes(e);function H(e="sh"){return`language-${e??"sh"}`}import{Fragment as fe,jsx as a,jsxs as w}from"react/jsx-runtime";var S=ce({codeId:void 0,copyText:"",hasCodeExpander:!1,isCodeExpanded:!1,registerCodeId:()=>{},setCopyText:()=>{},setHasCodeExpander:()=>{},setIsCodeExpanded:()=>{},unregisterCodeId:()=>{}}),V=C(({asChild:e=!1,className:t,...n},o)=>{let[r,s]=y(""),[i,d]=y(!1),[c,g]=y(!1),[p,l]=y(void 0),v=D(()=>({codeId:p,copyText:r,hasCodeExpander:i,isCodeExpanded:c,registerCodeId:m=>{l(h=>(z(h==null,"You can only render a single CodeBlockCode within a CodeBlock."),m))},setCopyText:s,setHasCodeExpander:d,setIsCodeExpanded:g,unregisterCodeId:m=>{l(h=>{z(h===m,"You can only render a single CodeBlockCode within a CodeBlock.")})}}),[p,r,i,c]),f=e?b:"div";return a(S.Provider,{value:v,children:a(f,{className:u("text-mono overflow-hidden rounded-md border border-gray-300 bg-gray-50 font-mono","[&_svg]:shrink-0",t),ref:o,...n})})});V.displayName="CodeBlock";var F=C(({asChild:e=!1,className:t,...n},o)=>a(e?b:"div",{className:u("relative",t),ref:o,...n}));F.displayName="CodeBlockBody";var Y=C(({className:e,highlightLines:t,indentation:n,language:o="text",showLineNumbers:r,style:s,tabIndex:i,value:d,...c},g)=>{let p=le(),{hasCodeExpander:l,isCodeExpanded:v,registerCodeId:f,setCopyText:m,unregisterCodeId:h}=j(S),M=W(o,n),k=D(()=>I(d,{indentation:M}),[d,M]),[K,U]=y(E(I(d,{indentation:M})));B(()=>{let A=N.languages[o];z(A,`CodeBlock does not support the language "${o}". The syntax highlighter does not have a grammar for this language. The supported languages are: ${L.join(", ")}.`);let X=N.highlight(k,A,o);U(X)},[k,o]),B(()=>{m(k)},[k,m]),B(()=>(f(p),()=>{h(p)}),[p,f,h]);let P=H(o);return a("pre",{"aria-expanded":l?v:void 0,className:u("scrollbar firefox:after:mr-[3.375rem] firefox:after:inline-block firefox:after:content-[''] overflow-x-auto overflow-y-hidden p-4 pr-14","text-size-inherit text-mono m-0 font-mono","aria-collapsed:max-h-[13.6rem]",P,e),"data-lang":o,id:p,ref:g,style:{...s,tabSize:2,MozTabSize:2},tabIndex:i??-1,...c,children:a("code",{className:pe("text-size-inherit",P),dangerouslySetInnerHTML:{__html:K},suppressHydrationWarning:!0})})});Y.displayName="CodeBlockCode";var q=C(({asChild:e=!1,className:t,...n},o)=>a(e?b:"div",{className:u("flex items-center gap-1 border-b border-gray-300 bg-gray-100 px-4 py-2 text-gray-700",t),ref:o,...n}));q.displayName="CodeBlockHeader";var J=C(({asChild:e=!1,className:t,...n},o)=>a(e?b:"h3",{ref:o,className:u("text-mono m-0 font-mono font-normal",t),...n}));J.displayName="CodeBlockTitle";var Q=C(({asChild:e=!1,className:t,onCopy:n,onCopyError:o,onClick:r,...s},i)=>{let{copyText:d}=j(S),[,c]=_(),[g,p]=y(!1),l=ue(0);return w(e?b:"button",{type:"button",className:u("focus-visible:border-accent-600 focus-visible:ring-focus-accent absolute right-2.5 top-2.5 z-10 flex size-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",g&&"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",t),ref:i,onClick:async f=>{try{if(r?.(f),f.defaultPrevented){window.clearTimeout(l.current);return}await c(d),n?.(d),p(!0),window.clearTimeout(l.current),l.current=window.setTimeout(()=>{p(!1)},2e3)}catch(m){o?.(m)}},...s,children:[a("span",{className:"sr-only",children:"Copy code"}),g?w(fe,{children:["Copied",a(se,{className:"size-4 shrink-0",weight:"bold"})]}):a(ae,{className:"-ml-px size-5 shrink-0"})]})});Q.displayName="CodeBlockCopyButton";var G=C(({asChild:e=!1,className:t,onClick:n,...o},r)=>{let{codeId:s,isCodeExpanded:i,setIsCodeExpanded:d,setHasCodeExpander:c}=j(S);return B(()=>(c(!0),()=>{c(!1)}),[c]),w(e?b:"button",{...o,"aria-controls":s,"aria-expanded":i,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",t),ref:r,type:"button",onClick:p=>{d(l=>!l),n?.(p)},children:[i?"Show less":"Show more"," ",a(re,{className:u("size-4 shrink-0",i&&"rotate-180","transition-all duration-150"),weight:"bold"})]})});G.displayName="CodeBlockExpanderButton";function me({className:e,preset:t,svg:n,...o}){let r=n;if(t!=null)switch(t){case"file":r=a(ie,{weight:"fill"});break;case"cli":r=a(de,{weight:"fill"});break;case"traffic-policy":r=a(ge,{});break}return a(R,{className:e,svg:r,...o})}function ge(e){return w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 256 256",...e,children:[a("path",{fill:"none",d:"M0 0h256v256H0z"}),a("path",{d:"m213.7 82.3-56-56c-1.5-1.5-3.5-2.3-5.7-2.3H56c-8.8 0-16 7.2-16 16v88c0 4.4 3.6 8 8 8s8-3.6 8-8V40h88v48c0 4.4 3.6 8 8 8h48v120h-40c-4.4 0-8 3.6-8 8s3.6 8 8 8h40c8.8 0 16-7.2 16-16V88c0-2.1-.8-4.2-2.3-5.7zm-53.7-31L188.7 80H160V51.3z"}),a("path",{d:"M124.6 194.5h-6.8v-27.3h6.8c1.9 0 3.4-1.5 3.4-3.4s-1.5-3.4-3.4-3.4h-6.8v-10.2c0-3.8-3.1-6.8-6.8-6.8H63.3c-3.8 0-6.8 3.1-6.8 6.8v10.2h-6.8c-1.9 0-3.4 1.5-3.4 3.4s1.5 3.4 3.4 3.4h6.8v27.3h-6.8c-1.9 0-3.4 1.5-3.4 3.4s1.5 3.4 3.4 3.4h6.8v23.9c0 3.8 3.1 6.8 6.8 6.8H111c3.8 0 6.8-3.1 6.8-6.8v-23.9h6.8c1.9 0 3.4-1.5 3.4-3.4s-1.5-3.4-3.4-3.4zm-37.5-11.9c-6.6 0-11.9-5.3-11.9-11.9s5.3-11.9 11.9-11.9S99 164.1 99 170.7s-5.3 11.9-11.9 11.9zm0 10.2c6.6 0 11.9 5.3 11.9 11.9s-5.3 11.9-11.9 11.9-11.9-5.3-11.9-11.9 5.3-11.9 11.9-11.9z"})]})}function Ce(e,...t){if(!ye(e)||!Array.isArray(t))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 n=String.raw({raw:e},...t),o=he(n);return n.trim().split(`
2
- `).map(s=>/^\S+/.test(s)?s:s.slice(o)).join(`
3
- `)}function he(e){let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((n,o)=>Math.min(n,o.length),Number.POSITIVE_INFINITY):0}function ye(e){return Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw)}import{z as x}from"zod";var be=["cli","file","traffic-policy"],xe=x.object({collapsible:x.boolean().default(!1),disableCopy:x.boolean().default(!1),mode:x.enum(be).optional(),title:x.string().trim().optional(),indentation:x.enum(O).optional()}),T={collapsible:!1,disableCopy:!1,mode:void 0,title:void 0,indentation:void 0};function ve(e){let t=e?.trim()??"";if(!t)return T;let n=Ie(t).reduce((o,r)=>{let[s,i]=r.split("=");if(!s)return o;let d=ke(i);return o[s]=d??!0,o},{});try{let o=xe.parse(n);return{...T,...o}}catch{return T}}function ke(e){return e?.trim().replace(/^"(.*)"$/,"$1")}function Ie(e){let t=e?.trim()??"",n=[],o="",r=!1;for(let s of t)s===" "&&!r?o&&(n.push(o),o=""):(s==='"'&&(r=!r),o+=s);return o&&n.push(o),n}export{V as CodeBlock,F as CodeBlockBody,Y as CodeBlockCode,Q as CodeBlockCopyButton,G as CodeBlockExpanderButton,q as CodeBlockHeader,me as CodeBlockIcon,J as CodeBlockTitle,T as defaultMeta,E as escapeHtml,Ce as fmtCode,H as formatLanguageClassName,$ as isSupportedLanguage,I as normalizeIndentation,ne as parseLanguage,ve as parseMetastring,L as supportedLanguages};
1
+ import{a as _}from"./chunk-IWKI4XHM.js";import{a as O}from"./chunk-GOXG4BVJ.js";import{a as R}from"./chunk-7O36LG52.js";import"./chunk-HDPLH5HC.js";import{a as c}from"./chunk-AZ56JGNY.js";import{CaretDown as ae}from"@phosphor-icons/react/CaretDown";import{Check as se}from"@phosphor-icons/react/Check";import{Copy as ie}from"@phosphor-icons/react/Copy";import{FileText as de}from"@phosphor-icons/react/FileText";import{Terminal as pe}from"@phosphor-icons/react/Terminal";import{Slot as b}from"@radix-ui/react-slot";import le from"clsx";import{createContext as ue,forwardRef as C,useContext as P,useEffect as B,useId as ce,useMemo as F,useRef as me,useState as h}from"react";import H from"tiny-invariant";function M(e){let t="";for(let n of e)switch(n){case"&":t+="&amp;";break;case"<":t+="&lt;";break;case">":t+="&gt;";break;case'"':t+="&quot;";break;case"'":t+="&#39;";break;default:t+=n}return t}import E from"prismjs";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";var W=["tabs","spaces"];function $(e,t){return t||(oe(e)?"tabs":(ne(e),"spaces"))}var ee=["csharp","css","go","html","java","javascript","js","jsx","ts","tsx","typescript","xml"],te=["python","py","yaml","yml","ruby","rb"];function oe(e){return ee.includes(e)}function ne(e){return te.includes(e)}function L(e,t){let{indentation:n="spaces"}=t||{};return e.trim().replace(/^[ \t]*(?=\S)/gm,o=>n==="spaces"?o.replace(/\t/g," "):o.replace(/ {2}/g," "))}var v=["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 re(e){if(!e)return"sh";let t=e.trim().slice(e.indexOf("-")+1);return D(t)?t:"sh"}var D=e=>typeof e=="string"&&v.includes(e);function N(e="sh"){return`language-${e??"sh"}`}import{Fragment as fe,jsx as s,jsxs as j}from"react/jsx-runtime";var S=ue({codeId:void 0,copyText:"",hasCodeExpander:!1,isCodeExpanded:!1,registerCodeId:()=>{},setCopyText:()=>{},setHasCodeExpander:()=>{},setIsCodeExpanded:()=>{},unregisterCodeId:()=>{}}),V=C(({asChild:e=!1,className:t,...n},o)=>{let[r,a]=h(""),[i,d]=h(!1),[l,g]=h(!1),[p,u]=h(void 0),k=F(()=>({codeId:p,copyText:r,hasCodeExpander:i,isCodeExpanded:l,registerCodeId:m=>{u(y=>(H(y==null,"You can only render a single CodeBlockCode within a CodeBlock."),m))},setCopyText:a,setHasCodeExpander:d,setIsCodeExpanded:g,unregisterCodeId:m=>{u(y=>{H(y===m,"You can only render a single CodeBlockCode within a CodeBlock.")})}}),[p,r,i,l]),f=e?b:"div";return s(S.Provider,{value:k,children:s(f,{className:c("text-size-mono overflow-hidden rounded-md border border-gray-300 bg-gray-50 font-mono","[&_svg]:shrink-0",t),ref:o,...n})})});V.displayName="CodeBlock";var Y=C(({asChild:e=!1,className:t,...n},o)=>s(e?b:"div",{className:c("relative",t),ref:o,...n}));Y.displayName="CodeBlockBody";var q=C(({className:e,highlightLines:t,indentation:n,language:o="text",showLineNumbers:r,style:a,tabIndex:i,value:d,...l},g)=>{let p=ce(),{hasCodeExpander:u,isCodeExpanded:k,registerCodeId:f,setCopyText:m,unregisterCodeId:y}=P(S),T=$(o,n),I=F(()=>L(d,{indentation:T}),[d,T]),[U,X]=h(M(L(d,{indentation:T})));B(()=>{let A=E.languages[o];H(A,`CodeBlock does not support the language "${o}". The syntax highlighter does not have a grammar for this language. The supported languages are: ${v.join(", ")}.`);let Z=E.highlight(I,A,o);X(Z)},[I,o]),B(()=>{m(I)},[I,m]),B(()=>(f(p),()=>{y(p)}),[p,f,y]);let z=N(o);return s("pre",{"aria-expanded":u?k:void 0,className:c("scrollbar firefox:after:mr-[3.375rem] firefox:after:inline-block firefox:after:content-[''] overflow-x-auto overflow-y-hidden p-4 pr-14","text-size-inherit text-size-mono m-0 font-mono","aria-collapsed:max-h-[13.6rem]",z,e),"data-lang":o,id:p,ref:g,style:{...a,tabSize:2,MozTabSize:2},tabIndex:i??-1,...l,children:s("code",{className:le("text-size-inherit",z),dangerouslySetInnerHTML:{__html:U},suppressHydrationWarning:!0})})});q.displayName="CodeBlockCode";var J=C(({asChild:e=!1,className:t,...n},o)=>s(e?b:"div",{className:c("flex items-center gap-1 border-b border-gray-300 bg-gray-100 px-4 py-2 text-gray-700",t),ref:o,...n}));J.displayName="CodeBlockHeader";var Q=C(({asChild:e=!1,className:t,...n},o)=>s(e?b:"h3",{ref:o,className:c("text-size-mono m-0 font-mono font-normal",t),...n}));Q.displayName="CodeBlockTitle";var G=C(({asChild:e=!1,className:t,onCopy:n,onCopyError:o,onClick:r,...a},i)=>{let{copyText:d}=P(S),[,l]=_(),[g,p]=h(!1),u=me(0);return j(e?b:"button",{type:"button",className:c("focus-visible:border-accent-600 focus-visible:ring-focus-accent absolute right-2.5 top-2.5 z-10 flex size-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",g&&"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",t),ref:i,onClick:async f=>{try{if(r?.(f),f.defaultPrevented){window.clearTimeout(u.current);return}await l(d),n?.(d),p(!0),window.clearTimeout(u.current),u.current=window.setTimeout(()=>{p(!1)},2e3)}catch(m){o?.(m)}},...a,children:[s("span",{className:"sr-only",children:"Copy code"}),g?j(fe,{children:["Copied",s(se,{className:"size-4 shrink-0",weight:"bold"})]}):s(ie,{className:"-ml-px size-5 shrink-0"})]})});G.displayName="CodeBlockCopyButton";var K=C(({asChild:e=!1,className:t,onClick:n,...o},r)=>{let{codeId:a,isCodeExpanded:i,setIsCodeExpanded:d,setHasCodeExpander:l}=P(S);return B(()=>(l(!0),()=>{l(!1)}),[l]),j(e?b:"button",{...o,"aria-controls":a,"aria-expanded":i,className:c("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",t),ref:r,type:"button",onClick:p=>{d(u=>!u),n?.(p)},children:[i?"Show less":"Show more"," ",s(ae,{className:c("size-4 shrink-0",i&&"rotate-180","transition-all duration-150"),weight:"bold"})]})});K.displayName="CodeBlockExpanderButton";function ge({className:e,preset:t,svg:n,...o}){let r=n;if(t!=null)switch(t){case"file":r=s(de,{weight:"fill"});break;case"cli":r=s(pe,{weight:"fill"});break;case"traffic-policy":r=s(O,{});break}return s(R,{className:e,svg:r,...o})}function Ce(e,...t){if(!he(e)||!Array.isArray(t))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 n=String.raw({raw:e},...t),o=ye(n);return n.trim().split(`
2
+ `).map(a=>/^\S+/.test(a)?a:a.slice(o)).join(`
3
+ `)}function ye(e){let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((n,o)=>Math.min(n,o.length),Number.POSITIVE_INFINITY):0}function he(e){return Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw)}import{z as x}from"zod";var be=["cli","file","traffic-policy"],xe=x.object({collapsible:x.boolean().default(!1),disableCopy:x.boolean().default(!1),mode:x.enum(be).optional(),title:x.string().trim().optional(),indentation:x.enum(W).optional()}),w={collapsible:!1,disableCopy:!1,mode:void 0,title:void 0,indentation:void 0};function ke(e){let t=e?.trim()??"";if(!t)return w;let n=Le(t).reduce((o,r)=>{let[a,i]=r.split("=");if(!a)return o;let d=Ie(i);return o[a]=d??!0,o},{});try{let o=xe.parse(n);return{...w,...o}}catch{return w}}function Ie(e){return e?.trim().replace(/^"(.*)"$/,"$1")}function Le(e){let t=e?.trim()??"",n=[],o="",r=!1;for(let a of t)a===" "&&!r?o&&(n.push(o),o=""):(a==='"'&&(r=!r),o+=a);return o&&n.push(o),n}export{V as CodeBlock,Y as CodeBlockBody,q as CodeBlockCode,G as CodeBlockCopyButton,K as CodeBlockExpanderButton,J as CodeBlockHeader,ge as CodeBlockIcon,Q as CodeBlockTitle,w as defaultMeta,M as escapeHtml,Ce as fmtCode,N as formatLanguageClassName,D as isSupportedLanguage,L as normalizeIndentation,re as parseLanguage,ke as parseMetastring,v as supportedLanguages};
4
4
  //# sourceMappingURL=code-block.js.map